aboutsummaryrefslogtreecommitdiff
path: root/mcwrapper
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2015-12-11 18:54:12 +0100
committerKarel Kočí <cynerd@email.cz>2015-12-11 18:54:12 +0100
commit89623a6e6d304c71285cb325ff6988fe9af0374c (patch)
tree24ef883b58695c4d8ca48471a6fe1aed80300dc2 /mcwrapper
parentd3bcf2e4366093049b5b372fbdbe14f902ae35be (diff)
downloadmcserver-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.
Diffstat (limited to 'mcwrapper')
-rwxr-xr-xmcwrapper18
1 files changed, 6 insertions, 12 deletions
diff --git a/mcwrapper b/mcwrapper
index f758707..a5269f6 100755
--- a/mcwrapper
+++ b/mcwrapper
@@ -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__)