diff --git a/hwe/sammo/ServerTool.php b/hwe/sammo/ServerTool.php index 3188b3f7..1df104d0 100644 --- a/hwe/sammo/ServerTool.php +++ b/hwe/sammo/ServerTool.php @@ -14,12 +14,23 @@ final class ServerTool if ((120 % $turnterm) != 0) { return 'invalid minute'; } - + $db = DB::db(); $gameStor = KVStorage::getStorage($db, 'game_env'); $admin = $gameStor->getValues(['turntime', 'turnterm', 'year', 'startyear', 'month', 'isunited']); + $oldunit = $admin['turnterm'] * 60; + $unit = $turnterm * 60; + + if($unit == $oldunit){ + return null; + } + + if($oldunit < 0 || $unit < 0){ + return 'variable_turnterm'; + } + $reqGameLock = $admin['isunited'] != 2 && !$ignoreLock; $locked = false; @@ -40,15 +51,6 @@ final class ServerTool $locked = tryLock(); } - $oldunit = $admin['turnterm'] * 60; - $unit = $turnterm * 60; - - if($unit == $oldunit){ - if($locked){ - unlock(); - } - return null; - } $unitDiff = $unit / $oldunit;