diff options
Diffstat (limited to 'MCServer/Plugins/Core')
-rw-r--r-- | MCServer/Plugins/Core/ban-unban.lua | 2 | ||||
-rw-r--r-- | MCServer/Plugins/Core/console.lua | 4 | ||||
-rw-r--r-- | MCServer/Plugins/Core/help.lua | 2 | ||||
-rw-r--r-- | MCServer/Plugins/Core/main.lua | 80 | ||||
-rw-r--r-- | MCServer/Plugins/Core/me.lua | 16 | ||||
-rw-r--r-- | MCServer/Plugins/Core/onbreakplaceblock.lua | 184 | ||||
-rw-r--r-- | MCServer/Plugins/Core/ondeath.lua | 2 | ||||
-rw-r--r-- | MCServer/Plugins/Core/onjoinleave.lua | 6 | ||||
-rw-r--r-- | MCServer/Plugins/Core/onlogin.lua | 2 | ||||
-rw-r--r-- | MCServer/Plugins/Core/portal-worlds.lua | 2 | ||||
-rw-r--r-- | MCServer/Plugins/Core/rank-groups.lua | 2 | ||||
-rw-r--r-- | MCServer/Plugins/Core/save-reload-stop.lua | 10 | ||||
-rw-r--r-- | MCServer/Plugins/Core/spawn.lua | 2 | ||||
-rw-r--r-- | MCServer/Plugins/Core/teleport.lua | 78 | ||||
-rw-r--r-- | MCServer/Plugins/Core/web_serversettings.lua | 10 | ||||
-rw-r--r-- | MCServer/Plugins/Core/worldlimiter.lua | 2 |
16 files changed, 202 insertions, 202 deletions
diff --git a/MCServer/Plugins/Core/ban-unban.lua b/MCServer/Plugins/Core/ban-unban.lua index da9ee2d6c..1ad9b7e75 100644 --- a/MCServer/Plugins/Core/ban-unban.lua +++ b/MCServer/Plugins/Core/ban-unban.lua @@ -39,7 +39,7 @@ function BanPlayer(PlayerName, Reason) end function HandleUnbanCommand( Split, Player ) - if( #Split < 2 ) then + if( #Split < 2 ) then Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /unban [Player]" ) return true end diff --git a/MCServer/Plugins/Core/console.lua b/MCServer/Plugins/Core/console.lua index b1c454d59..7c1e6abde 100644 --- a/MCServer/Plugins/Core/console.lua +++ b/MCServer/Plugins/Core/console.lua @@ -5,7 +5,7 @@ function InitConsoleCommands() -- Please keep the list alpha-sorted PluginMgr:BindConsoleCommand("ban", HandleConsoleBan, "Bans a player by name"); - PluginMgr:BindConsoleCommand("unban", HandleConsoleUnban, "Unbans a player by name"); + PluginMgr:BindConsoleCommand("unban", HandleConsoleUnban, "Unbans a player by name"); PluginMgr:BindConsoleCommand("banlist", HandleConsoleBanList, "Lists all players banned by name"); PluginMgr:BindConsoleCommand("banlist ips", HandleConsoleBanList, "Lists all players banned by IP"); PluginMgr:BindConsoleCommand("help", HandleConsoleHelp, "Lists all commands"); @@ -40,7 +40,7 @@ function HandleConsoleBan(Split) end function HandleConsoleUnban(Split) - if( #Split < 2 ) then + if( #Split < 2 ) then return true, "Usage: /unban [Player]" end diff --git a/MCServer/Plugins/Core/help.lua b/MCServer/Plugins/Core/help.lua index 339fc054b..9ec79e056 100644 --- a/MCServer/Plugins/Core/help.lua +++ b/MCServer/Plugins/Core/help.lua @@ -32,7 +32,7 @@ function HandleHelpCommand(Split, Player) -- CurrentPage now contains the total number of pages, and Output has the individual help lines to be sent Player:SendMessage(cChatColor.Purple .. "---------- [COMMANDS HELP " .. cChatColor.Gold .. "(Page " .. PageRequested .. " / " .. CurrentPage .. ")" .. cChatColor.Purple .. "] -----------"); - Player:SendMessage(cChatColor.Purple .. "'-' means no prefix, '~' means a value is required."); + Player:SendMessage(cChatColor.Purple .. "'-' means no prefix, '~' means a value is required."); for idx, msg in ipairs(Output) do Player:SendMessage(msg); end; diff --git a/MCServer/Plugins/Core/main.lua b/MCServer/Plugins/Core/main.lua index 755ec4db8..3fd9c6585 100644 --- a/MCServer/Plugins/Core/main.lua +++ b/MCServer/Plugins/Core/main.lua @@ -13,10 +13,10 @@ function Initialize(Plugin) Plugin:SetName("Core") Plugin:SetVersion(13) - --ADD HOOKS + --ADD HOOKS PluginManager = cRoot:Get():GetPluginManager() PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_JOINED) - PluginManager:AddHook(Plugin, cPluginManager.HOOK_DISCONNECT) + PluginManager:AddHook(Plugin, cPluginManager.HOOK_DISCONNECT) PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_BREAKING_BLOCK) PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_PLACING_BLOCK) PluginManager:AddHook(Plugin, cPluginManager.HOOK_LOGIN) @@ -25,9 +25,9 @@ function Initialize(Plugin) PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHAT) -- used in web_chat.lua PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_MOVING) - --PLEASE ALPHA SORT http://elmosaukko.com/sort-alphabetically/ THIS LIST - --BIND COMMANDS - PluginManager:BindCommand("/back", "core.back", HandleBackCommand, " - Return to your last position"); + --PLEASE ALPHA SORT http://elmosaukko.com/sort-alphabetically/ THIS LIST + --BIND COMMANDS + PluginManager:BindCommand("/back", "core.back", HandleBackCommand, " - Return to your last position"); PluginManager:BindCommand("/ban", "core.ban", HandleBanCommand, " ~ Ban a player"); PluginManager:BindCommand("/give", "core.give", HandleGiveCommand, " ~ Give yourself an item"); PluginManager:BindCommand("/gm", "core.changegm", HandleChangeGMCommand, " ~ Change your gamemode"); @@ -46,10 +46,10 @@ function Initialize(Plugin) PluginManager:BindCommand("/stop", "core.stop", HandleStopCommand, " - Stops the server"); PluginManager:BindCommand("/time", "core.time", HandleTimeCommand, " ~ Sets the time of day"); PluginManager:BindCommand("/downfall", "core.downfall", HandleDownfallCommand, " - Toggles the weather"); - PluginManager:BindCommand("/me", "core.me", HandleMeCommand, " ~ Tell what you are doing"); + PluginManager:BindCommand("/me", "core.me", HandleMeCommand, " ~ Tell what you are doing"); PluginManager:BindCommand("/top", "core.top", HandleTopCommand, " - Teleport yourself to the top most block"); - PluginManager:BindCommand("/tp", "core.teleport", HandleTPCommand, " ~ Teleport yourself to a player"); - PluginManager:BindCommand("/tpa", "core.teleport", HandleTPACommand, " ~ Ask to teleport yourself to a player"); + PluginManager:BindCommand("/tp", "core.teleport", HandleTPCommand, " ~ Teleport yourself to a player"); + PluginManager:BindCommand("/tpa", "core.teleport", HandleTPACommand, " ~ Ask to teleport yourself to a player"); PluginManager:BindCommand("/tpaccept", "core.teleport", HandleTPAcceptCommand, " ~ Accept a teleportation request"); PluginManager:BindCommand("/unban", "core.unban", HandleUnbanCommand, " ~ Unban a player"); PluginManager:BindCommand("/viewdistance", "core.viewdistance", HandleViewDistanceCommand, " [".. cClientHandle.MIN_VIEW_DISTANCE .."-".. cClientHandle.MAX_VIEW_DISTANCE .."] - Change your view distance") @@ -63,27 +63,27 @@ function Initialize(Plugin) HardCore = IniFile:GetValueSet("GameMode", "Hardcore", "false") IniFile:WriteFile() end - - WorldsSpawnProtect = {} - local KeyIdx = IniFile:FindKey("Worlds") --(FIND WHERE 'WORLDS' KEY IS LOCATED) - local NumValues = (IniFile:GetNumValues( KeyIdx )) --(HOW MANY VALUES ARE THERE?) + + WorldsSpawnProtect = {} + local KeyIdx = IniFile:FindKey("Worlds") --(FIND WHERE 'WORLDS' KEY IS LOCATED) + local NumValues = (IniFile:GetNumValues( KeyIdx )) --(HOW MANY VALUES ARE THERE?) for i = 0, NumValues - 1 do --(FOR EVERY WORLD KEY, TAKING ACCOUNT OF OFF BY ONE ERRORS) - WorldIni = cIniFile(IniFile:GetValue(KeyIdx, i) .. "/world.ini") - if WorldIni:ReadFile() == true then - WorldsSpawnProtect[IniFile:GetValue(KeyIdx, i)] = WorldIni:GetValueSetI("SpawnProtect", "ProtectRadius", 10) - WorldIni:WriteFile() - end - end - WorldsWorldLimit = {} - local KeyIdx = IniFile:FindKey("Worlds") --(FIND WHERE 'WORLDS' KEY IS LOCATED) - local NumValues = (IniFile:GetNumValues( KeyIdx )) --(HOW MANY VALUES ARE THERE?) - for i = 0, NumValues - 1 do --(FOR EVERY WORLD KEY, TAKING ACCOUNT OF OFF BY ONE ERRORS) - WorldIni = cIniFile(IniFile:GetValue(KeyIdx, i) .. "/world.ini") - if WorldIni:ReadFile() == true then - WorldsWorldLimit[IniFile:GetValue(KeyIdx, i)] = WorldIni:GetValueSetI("WorldLimit", "LimitRadius", 0) - WorldIni:WriteFile() - end - end + WorldIni = cIniFile(IniFile:GetValue(KeyIdx, i) .. "/world.ini") + if WorldIni:ReadFile() == true then + WorldsSpawnProtect[IniFile:GetValue(KeyIdx, i)] = WorldIni:GetValueSetI("SpawnProtect", "ProtectRadius", 10) + WorldIni:WriteFile() + end + end + WorldsWorldLimit = {} + local KeyIdx = IniFile:FindKey("Worlds") --(FIND WHERE 'WORLDS' KEY IS LOCATED) + local NumValues = (IniFile:GetNumValues( KeyIdx )) --(HOW MANY VALUES ARE THERE?) + for i = 0, NumValues - 1 do --(FOR EVERY WORLD KEY, TAKING ACCOUNT OF OFF BY ONE ERRORS) + WorldIni = cIniFile(IniFile:GetValue(KeyIdx, i) .. "/world.ini") + if WorldIni:ReadFile() == true then + WorldsWorldLimit[IniFile:GetValue(KeyIdx, i)] = WorldIni:GetValueSetI("WorldLimit", "LimitRadius", 0) + WorldIni:WriteFile() + end + end --LOAD WHITELIST WhiteListIni = cIniFile( Plugin:GetLocalDirectory() .. "/whitelist.ini" ) @@ -120,7 +120,7 @@ function Initialize(Plugin) end end - --ADD WEB INTERFACE TABULATES + --ADD WEB INTERFACE TABULATES Plugin:AddWebTab("Manage Server", HandleRequest_ManageServer); Plugin:AddWebTab("Server Settings", HandleRequest_ServerSettings); Plugin:AddWebTab("Chat", HandleRequest_Chat); @@ -132,7 +132,7 @@ function Initialize(Plugin) LoadMotd() LOG( "Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion() ) - return true + return true end --AWESOMENESS STILL GOING! @@ -140,12 +140,12 @@ end function WriteLog(breakPlace, X, Y, Z, player, id, meta) local logText = {} - table.insert(logText, player) + table.insert(logText, player) table.insert(logText, " tried to ") if breakPlace == 0 then - table.insert(logText, "break ") - else + table.insert(logText, "break ") + else table.insert(logText, "place ") end @@ -159,23 +159,23 @@ function WriteLog(breakPlace, X, Y, Z, player, id, meta) table.insert(logText, tostring(Z)) table.insert(logText, ".") - LOGINFO(table.concat(logText,'')) + LOGINFO(table.concat(logText,'')) if LOGTOFILE then - local logFile = io.open( Plugin:GetLocalDirectory() .. '/blocks.log', 'a') - logFile:write(table.concat(logText,'').."\n") - logFile:close() - end + local logFile = io.open( Plugin:GetLocalDirectory() .. '/blocks.log', 'a') + logFile:write(table.concat(logText,'').."\n") + logFile:close() + end return end - + function WarnPlayer(Player) Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Go further from spawn to build") return end function OnDisable() - LOG( "Disabled Core!") + LOG( "Disabled Core!") end --END AWESOMENESS :'( diff --git a/MCServer/Plugins/Core/me.lua b/MCServer/Plugins/Core/me.lua index 5ae15b97d..783c15556 100644 --- a/MCServer/Plugins/Core/me.lua +++ b/MCServer/Plugins/Core/me.lua @@ -4,12 +4,12 @@ function HandleMeCommand( Split, Player ) for i, Text in ipairs(Split) do Message = Message .. " " .. Text; end - if (Split[1] == nil) then - Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /me <action>") - return true - end - if (Split[1] ~= nil) then - cRoot:Get():GetServer():BroadcastChat(Player:GetName() .. "" .. Message); - return true - end + if (Split[1] == nil) then + Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /me <action>") + return true + end + if (Split[1] ~= nil) then + cRoot:Get():GetServer():BroadcastChat(Player:GetName() .. "" .. Message); + return true + end end diff --git a/MCServer/Plugins/Core/onbreakplaceblock.lua b/MCServer/Plugins/Core/onbreakplaceblock.lua index 49b3226c2..5eddc1511 100644 --- a/MCServer/Plugins/Core/onbreakplaceblock.lua +++ b/MCServer/Plugins/Core/onbreakplaceblock.lua @@ -4,116 +4,116 @@ function OnPlayerPlacingBlock(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX return false end - local PROTECTRADIUS = WorldsSpawnProtect[Player:GetWorld():GetName()]; + local PROTECTRADIUS = WorldsSpawnProtect[Player:GetWorld():GetName()]; if not (Player:HasPermission("core.build")) then return true else - if not (Player:HasPermission("core.spawnprotect.bypass")) and not (PROTECTRADIUS == 0) then - local World = Player:GetWorld() - local xcoord = World:GetSpawnX() - local ycoord = World:GetSpawnY() - local zcoord = World:GetSpawnZ() + if not (Player:HasPermission("core.spawnprotect.bypass")) and not (PROTECTRADIUS == 0) then + local World = Player:GetWorld() + local xcoord = World:GetSpawnX() + local ycoord = World:GetSpawnY() + local zcoord = World:GetSpawnZ() - if not ((BlockX <= (xcoord + PROTECTRADIUS)) and (BlockX >= (xcoord - PROTECTRADIUS))) then - return false -- Not in spawn area. - end - if not ((BlockY <= (ycoord + PROTECTRADIUS)) and (BlockY >= (ycoord - PROTECTRADIUS))) then - return false -- Not in spawn area. - end - if not ((BlockZ <= (zcoord + PROTECTRADIUS)) and (BlockZ >= (zcoord - PROTECTRADIUS))) then - return false -- Not in spawn area. - end + if not ((BlockX <= (xcoord + PROTECTRADIUS)) and (BlockX >= (xcoord - PROTECTRADIUS))) then + return false -- Not in spawn area. + end + if not ((BlockY <= (ycoord + PROTECTRADIUS)) and (BlockY >= (ycoord - PROTECTRADIUS))) then + return false -- Not in spawn area. + end + if not ((BlockZ <= (zcoord + PROTECTRADIUS)) and (BlockZ >= (zcoord - PROTECTRADIUS))) then + return false -- Not in spawn area. + end - --WriteLog(1, BlockX, BlockY, BlockZ, Player:GetName(), id, meta) + --WriteLog(1, BlockX, BlockY, BlockZ, Player:GetName(), id, meta) - WarnPlayer(Player) + WarnPlayer(Player) - return true - else - if BlockType == "50" or BlockType == "76" then - local X = BlockX - local Y = BlockY - local Z = BlockZ - X, Y, Z = AddFaceDirection(X, Y, Z, BlockFace) - if (Y >= 256 or Y < 0) then - return true - end - - local CheckCollision = function(Player) - -- drop the decimals, we only care about the full block X,Y,Z - local PlayerX = math.floor(Player:GetPosX(), 0) - local PlayerY = math.floor(Player:GetPosY(), 0) - local PlayerZ = math.floor(Player:GetPosZ(), 0) - - local collision = false - if ((BlockFace == BLOCK_FACE_TOP) and (PlayerY == BlockY - 2) and (PlayerX == BlockX) and (PlayerZ == BlockZ)) then - collision = true - end - - if ((BlockFace == BLOCK_FACE_BOTTOM) and (PlayerY == BlockY + 1) and (PlayerX == BlockX) and (PlayerZ == BlockZ)) then - collision = true - end - - if ((BlockFace == BLOCK_FACE_NORTH) and (PlayerX == BlockX) and (PlayerZ == BlockZ - 1)) then - if ((PlayerY == BlockY) or (PlayerY + 1 == BlockY)) then collision = true end - end - - if ((BlockFace == BLOCK_FACE_SOUTH) and (PlayerX == BlockX) and (PlayerZ == BlockZ + 1)) then - if ((PlayerY == BlockY) or (PlayerY + 1 == BlockY)) then collision = true end - end - - if ((BlockFace == BLOCK_FACE_WEST) and (PlayerX == BlockX - 1) and (PlayerZ == BlockZ)) then - if ((PlayerY == BlockY) or (PlayerY + 1 == BlockY)) then collision = true end - end - - if ((BlockFace == BLOCK_FACE_EAST) and (PlayerX == BlockX + 1) and (PlayerZ == BlockZ)) then - if ((PlayerY == BlockY) or (PlayerY + 1 == BlockY)) then collision = true end - end - return collision - end - if (Player:GetWorld():ForEachPlayer(CheckCollision) == false) then - return true - end - end - end - end - return false + return true + else + if BlockType == "50" or BlockType == "76" then + local X = BlockX + local Y = BlockY + local Z = BlockZ + X, Y, Z = AddFaceDirection(X, Y, Z, BlockFace) + if (Y >= 256 or Y < 0) then + return true + end + + local CheckCollision = function(Player) + -- drop the decimals, we only care about the full block X,Y,Z + local PlayerX = math.floor(Player:GetPosX(), 0) + local PlayerY = math.floor(Player:GetPosY(), 0) + local PlayerZ = math.floor(Player:GetPosZ(), 0) + + local collision = false + if ((BlockFace == BLOCK_FACE_TOP) and (PlayerY == BlockY - 2) and (PlayerX == BlockX) and (PlayerZ == BlockZ)) then + collision = true + end + + if ((BlockFace == BLOCK_FACE_BOTTOM) and (PlayerY == BlockY + 1) and (PlayerX == BlockX) and (PlayerZ == BlockZ)) then + collision = true + end + + if ((BlockFace == BLOCK_FACE_NORTH) and (PlayerX == BlockX) and (PlayerZ == BlockZ - 1)) then + if ((PlayerY == BlockY) or (PlayerY + 1 == BlockY)) then collision = true end + end + + if ((BlockFace == BLOCK_FACE_SOUTH) and (PlayerX == BlockX) and (PlayerZ == BlockZ + 1)) then + if ((PlayerY == BlockY) or (PlayerY + 1 == BlockY)) then collision = true end + end + + if ((BlockFace == BLOCK_FACE_WEST) and (PlayerX == BlockX - 1) and (PlayerZ == BlockZ)) then + if ((PlayerY == BlockY) or (PlayerY + 1 == BlockY)) then collision = true end + end + + if ((BlockFace == BLOCK_FACE_EAST) and (PlayerX == BlockX + 1) and (PlayerZ == BlockZ)) then + if ((PlayerY == BlockY) or (PlayerY + 1 == BlockY)) then collision = true end + end + return collision + end + if (Player:GetWorld():ForEachPlayer(CheckCollision) == false) then + return true + end + end + end + end + return false end function OnPlayerBreakingBlock(Player, BlockX, BlockY, BlockZ, BlockFace, Status, OldBlockType, OldBlockMeta) - -- dont check if the direction is in the air + -- dont check if the direction is in the air if (BlockFace ~= -1) then - local PROTECTRADIUS = WorldsSpawnProtect[Player:GetWorld():GetName()]; + local PROTECTRADIUS = WorldsSpawnProtect[Player:GetWorld():GetName()]; if not (Player:HasPermission("core.build")) then return true else - if not (Player:HasPermission("core.spawnprotect.bypass")) and not (PROTECTRADIUS == 0) then - local World = Player:GetWorld() - local xcoord = World:GetSpawnX() - local ycoord = World:GetSpawnY() - local zcoord = World:GetSpawnZ() - - if not ((BlockX <= (xcoord + PROTECTRADIUS)) and (BlockX >= (xcoord - PROTECTRADIUS))) then - return false -- Not in spawn area. - end - if not ((BlockY <= (ycoord + PROTECTRADIUS)) and (BlockY >= (ycoord - PROTECTRADIUS))) then - return false -- Not in spawn area. - end - if not ((BlockZ <= (zcoord + PROTECTRADIUS)) and (BlockZ >= (zcoord - PROTECTRADIUS))) then - return false -- Not in spawn area. - end - - --WriteLog(0, BlockX, BlockY, BlockZ, Player:GetName(), id, meta) - - WarnPlayer(Player) + if not (Player:HasPermission("core.spawnprotect.bypass")) and not (PROTECTRADIUS == 0) then + local World = Player:GetWorld() + local xcoord = World:GetSpawnX() + local ycoord = World:GetSpawnY() + local zcoord = World:GetSpawnZ() + + if not ((BlockX <= (xcoord + PROTECTRADIUS)) and (BlockX >= (xcoord - PROTECTRADIUS))) then + return false -- Not in spawn area. + end + if not ((BlockY <= (ycoord + PROTECTRADIUS)) and (BlockY >= (ycoord - PROTECTRADIUS))) then + return false -- Not in spawn area. + end + if not ((BlockZ <= (zcoord + PROTECTRADIUS)) and (BlockZ >= (zcoord - PROTECTRADIUS))) then + return false -- Not in spawn area. + end + + --WriteLog(0, BlockX, BlockY, BlockZ, Player:GetName(), id, meta) + + WarnPlayer(Player) - return true - end - end - end + return true + end + end + end return false end
\ No newline at end of file diff --git a/MCServer/Plugins/Core/ondeath.lua b/MCServer/Plugins/Core/ondeath.lua index 463890751..a5f8f6745 100644 --- a/MCServer/Plugins/Core/ondeath.lua +++ b/MCServer/Plugins/Core/ondeath.lua @@ -3,7 +3,7 @@ function OnKilling(Victim, Killer) SetBackCoordinates( Victim ) Server = cRoot:Get():GetServer() if Killer == nil then - if Victim:GetWorld():GetBlock(Victim:GetPosX(), Victim:GetPosY(), Victim:GetPosZ()) == 10 or Victim:GetWorld():GetBlock(Victim:GetPosX(), Victim:GetPosY(), Victim:GetPosZ()) == 11 then + if Victim:GetWorld():GetBlock(Victim:GetPosX(), Victim:GetPosY(), Victim:GetPosZ()) == 10 or Victim:GetWorld():GetBlock(Victim:GetPosX(), Victim:GetPosY(), Victim:GetPosZ()) == 11 then Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " tried to swim in lava (and failed)" ) CheckHardcore(Victim) return false diff --git a/MCServer/Plugins/Core/onjoinleave.lua b/MCServer/Plugins/Core/onjoinleave.lua index 34b1a29ae..7acef47de 100644 --- a/MCServer/Plugins/Core/onjoinleave.lua +++ b/MCServer/Plugins/Core/onjoinleave.lua @@ -1,11 +1,11 @@ function OnPlayerJoined(Player) ShowMOTDTo( Player ) - local Server = cRoot:Get():GetServer() + local Server = cRoot:Get():GetServer() Server:SendMessage(cChatColor.Yellow .. "[JOIN] " .. cChatColor.White .. Player:GetName() .. " has joined the game" ) return false end function OnDisconnect(Player, Reason) - local Server = cRoot:Get():GetServer() - Server:SendMessage(cChatColor.Yellow .. "[LEAVE] " .. cChatColor.White .. Player:GetName() .. " has left the game" ) + local Server = cRoot:Get():GetServer() + Server:SendMessage(cChatColor.Yellow .. "[LEAVE] " .. cChatColor.White .. Player:GetName() .. " has left the game" ) end
\ No newline at end of file diff --git a/MCServer/Plugins/Core/onlogin.lua b/MCServer/Plugins/Core/onlogin.lua index 4b2f24f17..cc79bb0ae 100644 --- a/MCServer/Plugins/Core/onlogin.lua +++ b/MCServer/Plugins/Core/onlogin.lua @@ -4,7 +4,7 @@ function OnLogin(Client, ProtocolVersion, Username) local Server = cRoot:Get():GetServer() Server:SendMessage( Username .. " tried to join, but is banned!" ) LOGINFO( Username .. " tried to join, but is banned!") - return true -- Player is banned, return true to deny access + return true -- Player is banned, return true to deny access end if( WhiteListIni:GetValueB("WhiteListSettings", "WhiteListOn", false ) == true ) then if( WhiteListIni:GetValueB("WhiteList", Username, false ) == false ) then -- not on whitelist diff --git a/MCServer/Plugins/Core/portal-worlds.lua b/MCServer/Plugins/Core/portal-worlds.lua index e0de77c85..da48f1637 100644 --- a/MCServer/Plugins/Core/portal-worlds.lua +++ b/MCServer/Plugins/Core/portal-worlds.lua @@ -15,7 +15,7 @@ function HandlePortalCommand( Split, Player ) end function HandleWorldsCommand( Split, Player ) - local SettingsIni = cIniFile("settings.ini") + local SettingsIni = cIniFile("settings.ini") if SettingsIni:ReadFile() == false then Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "No worlds found" ) end diff --git a/MCServer/Plugins/Core/rank-groups.lua b/MCServer/Plugins/Core/rank-groups.lua index 04050fc80..bb7d2ae5c 100644 --- a/MCServer/Plugins/Core/rank-groups.lua +++ b/MCServer/Plugins/Core/rank-groups.lua @@ -33,7 +33,7 @@ function HandleRankCommand( Split, Player ) end function HandleGroupsCommand( Split, Player ) - local GroupsIni = cIniFile("groups.ini") + local GroupsIni = cIniFile("groups.ini") if GroupsIni:ReadFile() == false then Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "No groups found" ) end diff --git a/MCServer/Plugins/Core/save-reload-stop.lua b/MCServer/Plugins/Core/save-reload-stop.lua index c4aa030cb..976052fc7 100644 --- a/MCServer/Plugins/Core/save-reload-stop.lua +++ b/MCServer/Plugins/Core/save-reload-stop.lua @@ -1,21 +1,21 @@ function HandleSaveAllCommand( Split, Player ) cRoot:Get():SaveAllChunks(); - local Server = cRoot:Get():GetServer() + local Server = cRoot:Get():GetServer() Server:SendMessage(cChatColor.Rose .. "[WARNING] " .. cChatColor.White .. "Saving all worlds!") return true; end function HandleStopCommand( Split, Player ) - Server = cRoot:Get():GetServer() - local Server = cRoot:Get():GetServer() + Server = cRoot:Get():GetServer() + local Server = cRoot:Get():GetServer() Server:SendMessage(cChatColor.Red .. "[WARNING] " .. cChatColor.White .. "Server is terminating!" ) cRoot:Get():QueueExecuteConsoleCommand("stop") return true end function HandleReloadCommand( Split, Player ) - Server = cRoot:Get():GetServer() - local Server = cRoot:Get():GetServer() + Server = cRoot:Get():GetServer() + local Server = cRoot:Get():GetServer() Server:SendMessage(cChatColor.Rose .. "[WARNING] " .. cChatColor.White .. "Reloading all plugins!" ) cRoot:Get():GetPluginManager():ReloadPlugins() return true diff --git a/MCServer/Plugins/Core/spawn.lua b/MCServer/Plugins/Core/spawn.lua index 09ada3ada..d1ef7399b 100644 --- a/MCServer/Plugins/Core/spawn.lua +++ b/MCServer/Plugins/Core/spawn.lua @@ -2,6 +2,6 @@ function HandleSpawnCommand(Split, Player) World = Player:GetWorld() SetBackCoordinates(Player) Player:TeleportToCoords(World:GetSpawnX(), World:GetSpawnY(), World:GetSpawnZ()) - Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Returned to world spawn" ) + Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Returned to world spawn" ) return true end
\ No newline at end of file diff --git a/MCServer/Plugins/Core/teleport.lua b/MCServer/Plugins/Core/teleport.lua index 3ba5e36ef..1e2cab6f7 100644 --- a/MCServer/Plugins/Core/teleport.lua +++ b/MCServer/Plugins/Core/teleport.lua @@ -16,45 +16,45 @@ function HandleTPCommand(a_Split, a_Player) end function HandleTPACommand( Split, Player ) - if Split[2] == nil then - Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /tpa [Player]" ) - return true - end - local loopPlayer = function( OtherPlayer ) - if OtherPlayer:GetName() == Split[2] then - OtherPlayer:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. Player:GetName() .. " send a teleport request" ) - Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "You send a teleport request to " .. OtherPlayer:GetName() ) - Destination[OtherPlayer:GetName()] = Player:GetName() - end - end - local loopWorlds = function( World ) - World:ForEachPlayer( loopPlayer ) - end - cRoot:Get():ForEachWorld( loopWorlds ) - return true + if Split[2] == nil then + Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /tpa [Player]" ) + return true + end + local loopPlayer = function( OtherPlayer ) + if OtherPlayer:GetName() == Split[2] then + OtherPlayer:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. Player:GetName() .. " send a teleport request" ) + Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "You send a teleport request to " .. OtherPlayer:GetName() ) + Destination[OtherPlayer:GetName()] = Player:GetName() + end + end + local loopWorlds = function( World ) + World:ForEachPlayer( loopPlayer ) + end + cRoot:Get():ForEachWorld( loopWorlds ) + return true end function HandleTPAcceptCommand( Split, Player ) - if Destination[Player:GetName()] == nil then - Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Nobody has send you a teleport request" ) - return true - end - local loopPlayer = function( OtherPlayer ) - if Destination[Player:GetName()] == OtherPlayer:GetName() then - if OtherPlayer:GetWorld():GetName() ~= Player:GetWorld():GetName() then - OtherPlayer:MoveToWorld( Player:GetWorld():GetName() ) - end - OtherPlayer:TeleportToEntity( Player ) - Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. OtherPlayer:GetName() .. " teleported to you" ) - OtherPlayer:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "You teleported to " .. Player:GetName() ) - Destination[Player:GetName()] = nil - end - end - local loopWorlds = function( World ) - World:ForEachPlayer( loopPlayer ) - end - cRoot:Get():ForEachWorld( loopWorlds ) - return true + if Destination[Player:GetName()] == nil then + Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Nobody has send you a teleport request" ) + return true + end + local loopPlayer = function( OtherPlayer ) + if Destination[Player:GetName()] == OtherPlayer:GetName() then + if OtherPlayer:GetWorld():GetName() ~= Player:GetWorld():GetName() then + OtherPlayer:MoveToWorld( Player:GetWorld():GetName() ) + end + OtherPlayer:TeleportToEntity( Player ) + Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. OtherPlayer:GetName() .. " teleported to you" ) + OtherPlayer:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "You teleported to " .. Player:GetName() ) + Destination[Player:GetName()] = nil + end + end + local loopWorlds = function( World ) + World:ForEachPlayer( loopPlayer ) + end + cRoot:Get():ForEachWorld( loopWorlds ) + return true end -- Teleports a_SrcPlayer to a player named a_DstPlayerName; if a_TellDst is true, will send a notice to the destination player @@ -73,8 +73,8 @@ function TeleportToPlayer(a_SrcPlayer, a_DstPlayerName, a_TellDst) end end - local World = a_SrcPlayer:GetWorld(); - if (not(World:DoWithPlayer(a_DstPlayerName, teleport))) then - a_SrcPlayer:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Can't find player " .. a_DstPlayerName); + local World = a_SrcPlayer:GetWorld(); + if (not(World:DoWithPlayer(a_DstPlayerName, teleport))) then + a_SrcPlayer:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Can't find player " .. a_DstPlayerName); end end
\ No newline at end of file diff --git a/MCServer/Plugins/Core/web_serversettings.lua b/MCServer/Plugins/Core/web_serversettings.lua index 75f9b46c2..a53756b21 100644 --- a/MCServer/Plugins/Core/web_serversettings.lua +++ b/MCServer/Plugins/Core/web_serversettings.lua @@ -43,8 +43,8 @@ local function ShowGeneralSettings( Request ) SettingsIni:SetValue("Server", "MaxPlayers", Request.PostParams["Server_MaxPlayers"], false ) end if( tonumber( Request.PostParams["Server_Port"] ) ~= nil ) then - if( tonumber( Request.PostParams["Server_Port"] ) > 0 ) then - SettingsIni:SetValue("Server", "Port", Request.PostParams["Server_Port"], false ) + if( tonumber( Request.PostParams["Server_Port"] ) > 0 ) then + SettingsIni:SetValue("Server", "Port", Request.PostParams["Server_Port"], false ) end end if( tonumber( Request.PostParams["Server_PortsIPv6"] ) ~= nil ) then @@ -363,7 +363,7 @@ function ShowWorldSettings( Request ) WorldIni:DeleteValue( "SpawnPosition", "Z" ) WorldIni:SetValue( "SpawnPosition", "Z", Request.PostParams["World_SpawnZ"] ) end - if( tonumber( Request.PostParams["LimitWorldWidth"] ) ~= nil ) then + if( tonumber( Request.PostParams["LimitWorldWidth"] ) ~= nil ) then WorldIni:DeleteValue( "WorldLimit", "LimitRadius" ) WorldIni:SetValue( "WorldLimit", "LimitRadius", Request.PostParams["LimitWorldWidth"] ) end @@ -669,8 +669,8 @@ function ShowWorldSettings( Request ) <td><input type="text" name="World_SpawnZ" value="]] .. WorldIni:GetValue("SpawnPosition", "Z") .. [["></td></tr> </table> <br /> - <table> - <th colspan="2">LimitWorld</th> + <table> + <th colspan="2">LimitWorld</th> <tr><td>Max chunks from spawn (0 to disable):</td> <td><input type="text" name="LimitWorldWidth" value="]] .. WorldIni:GetValue("WorldLimit", "LimitRadius") .. [["></td></tr> </table><br /> diff --git a/MCServer/Plugins/Core/worldlimiter.lua b/MCServer/Plugins/Core/worldlimiter.lua index 8fd3287b2..1bb1b4fc6 100644 --- a/MCServer/Plugins/Core/worldlimiter.lua +++ b/MCServer/Plugins/Core/worldlimiter.lua @@ -1,5 +1,5 @@ function OnPlayerMoving( Player ) - LimitWorldWidth = WorldsWorldLimit[Player:GetWorld():GetName()] + LimitWorldWidth = WorldsWorldLimit[Player:GetWorld():GetName()] if LimitWorldWidth > 0 then local World = Player:GetWorld() local SpawnX = math.floor(World:GetSpawnX() / 16) |