Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,21 @@ Server.prototype.writeServerConfig = function () {
fs.writeFileSync(file, config)
}

Server.prototype.writeBattleEyeConfig = function (config) {
if(this.options.battleEye)
Copy link
Owner

@Dahlgren Dahlgren Nov 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be conditional? Would the function be called if it isn't desired to create the file? Since config seems to be passed as argument instead of using the property? Or should it use the property instead?

{
Comment on lines +84 to +85
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(this.options.battleEye)
{
if (this.options.battleEye) {

To fix lint issues

var filePath = path.join(this.options.path, 'battleye/BEServer_x64.cfg')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var filePath = path.join(this.options.path, 'battleye/BEServer_x64.cfg')
var filePath = path.join(this.battleEyeConfigPath(), 'BEServer_x64.cfg')

fs.writeFileSync(filePath, config)

var filePath2 = path.join(this.options.path, 'battleye/BEServer.cfg')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var filePath2 = path.join(this.options.path, 'battleye/BEServer.cfg')
var filePath2 = path.join(this.battleEyeConfigPath(), 'BEServer.cfg')

fs.writeFileSync(filePath2, config)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of doing this twice you could make this into a loop

var self = this
['BEServer.cfg', 'BEServer_x64.cfg'].forEach(function (filename) {
  var filePath = path.join(self.battleEyeConfigPath(), filename)
  fs.writeFileSync(filePath, config)
})

}
}

Server.prototype.battleEyeConfigPath = function () {
return path.join(this.options.path, 'battleye')
}

Server.prototype.makeConfigParameter = function () {
return '-config=' + path.join(configsDirectory, this.options.config)
}
Expand Down