diff options
author | Karel Kočí <cynerd@email.cz> | 2015-12-11 18:54:12 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2015-12-11 18:54:12 +0100 |
commit | 89623a6e6d304c71285cb325ff6988fe9af0374c (patch) | |
tree | 24ef883b58695c4d8ca48471a6fe1aed80300dc2 | |
parent | d3bcf2e4366093049b5b372fbdbe14f902ae35be (diff) | |
download | mcserver-wrapper-89623a6e6d304c71285cb325ff6988fe9af0374c.tar.gz mcserver-wrapper-89623a6e6d304c71285cb325ff6988fe9af0374c.tar.bz2 mcserver-wrapper-89623a6e6d304c71285cb325ff6988fe9af0374c.zip |
Move some variable definitions
Server specific variables are now defined on one place. Before they
were defined on two separated places.
-rwxr-xr-x | mcwrapper | 18 |
1 files changed, 6 insertions, 12 deletions
@@ -86,10 +86,8 @@ __STATUSSTRINGS__ = { } def __user_join__(username): - global playerCount global playersFile global players - playerCount += 1 if conf.verbose_level >= 0: print("User '" + username + "' joined server.") with open(playersFile, 'a') as f: @@ -98,10 +96,8 @@ def __user_join__(username): autoshutdown_disable() def __user_leave__(username): - global playerCount global playersFile global players - playerCount -= 1 if conf.verbose_level >= 0: print("User '" + username + "' left server.") players.remove(username) @@ -124,18 +120,10 @@ def __server_start__(): print("Error: Server input pipe already exists. Is another wrapper running?") sys.exit(4) os.mkfifo(inputPipe, 0o640) - global statusFile - statusFile = conf.status + '/status' with open(statusFile, 'w') as f: f.write(__STATUSSTRINGS__[1] + '\n') - global playersFile - playersFile = conf.status + '/players' with open(playersFile, 'w') as f: pass - global playerCount - playerCount = 0 - global players - players = set() def __server_clean__(): if conf.verbose_level >= 0: @@ -300,6 +288,12 @@ if __name__ == '__main__': # Set inputPipe global inputPipe inputPipe = conf.status + '/input_pipe' + global statusFile + statusFile = conf.status + '/status' + global playersFile + playersFile = conf.status + '/players' + global players + players = set() signal.signal(signal.SIGTERM, __signal_term__) signal.signal(signal.SIGINT, __signal_term__) |