Merged in the latest core changes.
Squashed commit of the following: commit cc7705645b6b387c618c9448fa6b0d5c789370c6 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Wed Jul 31 16:56:41 2013 +0100 Rewrote Info Messages + Implemented #7 [SEE DESC] Standardisation of info messages: [INFO] [WARNING] [JOIN] [LEAVE] [FATALITY] with colours Green, Gold, Red, Rose, and Yellow. Individual worlds have individual LimitWorld setting, with individual WebAdmin setting as well. commit 16cae4cdc0ec067e7e71fa5c5a3ba8c248ce063b Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Mon Jul 29 14:47:45 2013 +0100 Fix of nil value in SpawnProtect commit 7c33f75e7da7fc104112c17fcb53bc9f06fe09fc Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Mon Jul 29 13:19:11 2013 +0100 Fixed potential SpawnProtect nil value issue Now detects if PROTECTRADIUS is zero, and if so, cancels checks. commit 0c4a9d427620ab04ca01b5f31ed9b90530353d96 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Mon Jul 29 13:07:50 2013 +0100 Enhanced SpawnProtect greatly (thanks xoft) Wow. Who knew ~30 lines of code could become one? commit 17f5ef4fed0b6f32900cc7473563848466139655 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Mon Jul 29 11:11:22 2013 +0100 Removed Development LOGINFOs commit 02034bf2d67f2ae62092b0688d81338f7b0788df Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Mon Jul 29 10:40:57 2013 +0100 Implemented Issue #5 Enhancement [SEE DESC] Made spawn protection configurable in each world's world file. World has to be listed in settings.ini! commit ccc73db8c51e45372069ec0a42f437cfb25253b1 Merge: 6bf4b40 21c7c68 Author: Alexander Harkness <bearbin@gmail.com> Date: Sun Jul 28 14:00:15 2013 +0100 Merge branch 'master' of github.com:tigerw/MCSCore into tigerw-master Conflicts: main.lua commit 21c7c68d20782a7dfd0d8f9ce0996397549dd425 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Sun Jul 28 12:55:50 2013 +0100 Default WorldLimiter = Off commit 141298481f3adef30b68d0c4200204aa264cb3e2 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Sun Jul 28 12:47:24 2013 +0100 Fixed Potential WorldLimit & OnDisable Bugs Changed WorldLimiter if detection from nil value to config boolean. Changed OnDisable to use hardcoded name as Plugin:GetName was apparently a nil value. ?? commit 6bf4b40a0e27677afa6df9cb3521266e6b99c4f7 Merge: 1ca4217 bfd6c5f Author: bearbin <bearbin@gmail.com> Date: Sat Jul 27 11:44:18 2013 -0700 Merge pull request #3 from tonibm19/master Added /me command commit bfd6c5f2a47cda4ac98a7225736e2669eaf61849 Author: tonibm19 <tonibm19@gmail.com> Date: Sat Jul 27 20:35:22 2013 +0200 Added /me command commit d25abaf44a6f5828b90297ff80003d2cd2a90be5 Author: tonibm19 <tonibm19@gmail.com> Date: Sat Jul 27 20:30:31 2013 +0200 Added /me command commit 9047f7778aa1cdd42d22c4dcf925db792b4d684e Author: tonibm19 <tonibm19@gmail.com> Date: Sat Jul 27 20:29:24 2013 +0200 added /me command commit 1ca42172391d41ba71c65a3f15d3a96d15a80496 Merge: 52a6f4e 7a40336 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Sat Jul 27 09:01:45 2013 -0700 Merge pull request #2 from tigerw/master Fixed /give descriptor & removed webadmin commit 7a40336437525c447adae3d9800e75b39c0300c4 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Sat Jul 27 17:00:38 2013 +0100 Fixed /give descriptor & removed webadmin commit 52a6f4e35bdea2ae9f33977928b6693f5800e515 Merge: f5d56ff 2af1da8 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Sat Jul 27 08:51:45 2013 -0700 Merge pull request #1 from tigerw/master Added TPA (tonibm9's fork) commit 2af1da8a3cd8e94674b22805662b83de87ac4a95 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Sat Jul 27 16:38:10 2013 +0100 Added TPA (tonibm9's fork) With code from STR_Warrior. commit f5d56ffeb02fef4735e846661fa71d15622d25b9 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Sat Jul 27 15:51:18 2013 +0100 Integrated SpawnProtect & Bugfixes [SEE DESC.] Integrated bearbin's SpawnProtect. Fixed config file bugs. Improved SpawnProtect to use settings.ini. Variable cleanup (SHOW_PLUGIN_NAMES). File and filename cleanup. commit 56dc51c00af4514253c04e38b5ccc9fbed2f0022 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Fri Jul 26 23:14:40 2013 +0100 Update README.md Added info. commit acd7e2849dcd7f3ee7bdc6b0f9b777ee1d9cbb3c Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Fri Jul 26 19:37:59 2013 +0100 Implemented Block Property checking for Collisions Used g_BlockIsSolid, instead of checking data values. commit 246d423ff9660a2b00a1c51e6276ec74eb3419de Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Fri Jul 26 15:49:55 2013 +0100 Updated Files Buildpermandcollision: updated collision code to check for torches and redstone torches. Help: attempt at always showing page number Web_serversettings: attempt at introducing a check for Maximum Players (must be above zero). commit 868f99ab49edeee78f4fc1c212c6bf614b860378 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Thu Jul 25 19:46:08 2013 +0100 Update README.md Extended 'GUI Redesign' section. commit e0df40bd082bdeb5c6823b485bc5001103a77502 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Thu Jul 25 19:43:00 2013 +0100 Update README.md Added features and fixes and instructions for use. commit 332d8221f753f1a38d6c21bfc30af5890f48e3bb Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Thu Jul 25 19:35:27 2013 +0100 Uploaded All Files All Core files, both modified and unmodified. commit 3dd191f6bed71c863ee264856fbc3660e52cf88b Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Thu Jul 25 04:59:50 2013 -0700 Initial commit
This commit is contained in:
parent
c700108ab6
commit
8ced99994b
@ -1,9 +1,9 @@
|
||||
function HandleBackCommand( Split, Player )
|
||||
if BackCoords[Player:GetName()] == nil then
|
||||
Player:SendMessage(cChatColor.Green .. "There is no last position known")
|
||||
Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "No known last position")
|
||||
else
|
||||
Player:TeleportToCoords(BackCoords[Player:GetName()].x, BackCoords[Player:GetName()].y, BackCoords[Player:GetName()].z)
|
||||
Player:SendMessage(cChatColor.Green .. "You teleported back to your last known position")
|
||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Teleported back to your last known position")
|
||||
end
|
||||
return true
|
||||
end
|
@ -1,6 +1,6 @@
|
||||
function HandleBanCommand( Split, Player )
|
||||
if( #Split < 2 ) then
|
||||
Player:SendMessage( cChatColor.Green .. "Usage: /ban [Player] <Reason>" )
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /ban [Player] <Reason>" )
|
||||
return true
|
||||
end
|
||||
|
||||
@ -10,7 +10,7 @@ function HandleBanCommand( Split, Player )
|
||||
end
|
||||
|
||||
if( BanPlayer(Split[2], Reason) == false ) then
|
||||
Player:SendMessage( cChatColor.Green .. "Could not find player " .. Split[2] )
|
||||
Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Could not find player " .. Split[2] )
|
||||
return true
|
||||
end
|
||||
|
||||
@ -40,12 +40,12 @@ end
|
||||
|
||||
function HandleUnbanCommand( Split, Player )
|
||||
if( #Split < 2 ) then
|
||||
Player:SendMessage( cChatColor.Green .. "Usage: /unban [Player]" )
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /unban [Player]" )
|
||||
return true
|
||||
end
|
||||
|
||||
if( BannedPlayersIni:GetValueB("Banned", Split[2], false) == false ) then
|
||||
Player:SendMessage( cChatColor.Green .. Split[2] .. " is not banned!" )
|
||||
Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. " is not banned!" )
|
||||
return true
|
||||
end
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
function HandleGiveCommand(Split, Player)
|
||||
if ((#Split ~= 2) and (#Split ~=3)) then
|
||||
Player:SendMessage(cChatColor.Green .. "Usage: /give [ItemType/Name:Dmg] <Amount>");
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /give [ItemType/Name:Dmg] <Amount>" );
|
||||
return true;
|
||||
end
|
||||
|
||||
@ -12,7 +12,7 @@ function HandleGiveCommand(Split, Player)
|
||||
end
|
||||
|
||||
if not(FoundItem) then
|
||||
Player:SendMessage( cChatColor.Green .. "Invalid item id or name!" )
|
||||
Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Invalid item id or name!" )
|
||||
return true
|
||||
end
|
||||
|
||||
@ -20,7 +20,7 @@ function HandleGiveCommand(Split, Player)
|
||||
if (#Split == 3) then
|
||||
ItemAmount = tonumber(Split[3]);
|
||||
if ((ItemAmount == nil) or (ItemAmount < 1) or (ItemAmount > 512)) then
|
||||
Player:SendMessage(cChatColor.Green .. "Invalid amount!");
|
||||
Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Invalid amount!" );
|
||||
return true;
|
||||
end
|
||||
end
|
||||
@ -29,10 +29,10 @@ function HandleGiveCommand(Split, Player)
|
||||
|
||||
local ItemsGiven = Player:GetInventory():AddItem(Item);
|
||||
if (ItemsGiven == ItemAmount) then
|
||||
Player:SendMessage( cChatColor.Green .. "There you go!");
|
||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "There you go!" );
|
||||
LOG("Gave " .. Player:GetName() .. " " .. Item.m_ItemCount .. " times " .. Item.m_ItemType .. ":" .. Item.m_ItemDamage);
|
||||
else
|
||||
Player:SendMessage(cChatColor.Green .. "Not enough space in inventory, only gave " .. ItemsGiven);
|
||||
Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Not enough space in inventory, only gave " .. ItemsGiven);
|
||||
LOG("Player " .. Player:GetName() .. " asked for " .. Item.m_ItemCount .. " times " .. Item.m_ItemType .. ":" .. Item.m_ItemDamage ..", but only could fit " .. ItemsGiven);
|
||||
end
|
||||
return true;
|
||||
|
@ -1,6 +1,6 @@
|
||||
function HandleChangeGMCommand( Split, Player )
|
||||
if( #Split ~= 2 ) then
|
||||
Player:SendMessage( cChatColor.Green .. "Usage: /gm [GameMode (0|1)]" )
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /gm [GameMode (0|1)]" )
|
||||
return true
|
||||
end
|
||||
Player:SetGameMode(Split[2])
|
||||
|
@ -1,6 +1,6 @@
|
||||
function HandleKickCommand( Split, Player )
|
||||
if( #Split < 2 ) then
|
||||
Player:SendMessage( cChatColor.Green .. "Usage: /kick [Player] <Reason>" )
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /kick [Player] <Reason>" )
|
||||
return true
|
||||
end
|
||||
|
||||
@ -10,7 +10,7 @@ function HandleKickCommand( Split, Player )
|
||||
end
|
||||
|
||||
if( KickPlayer( Split[2], Reason ) == false ) then
|
||||
Player:SendMessage( cChatColor.Green .. "Could not find player " .. Split[2] )
|
||||
Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Could not find player " .. Split[2] )
|
||||
end
|
||||
|
||||
return true
|
||||
|
@ -1,4 +1,4 @@
|
||||
function HandleLocateCommand( Split, Player )
|
||||
Player:SendMessage(cChatColor.Green .. string.format("[X:%0.2f] [Y:%0.2f] [Z:%0.2f]", Player:GetPosX(), Player:GetPosY(), Player:GetPosZ() ) )
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. string.format("You are at [X:%0.2f Y:%0.2f Z:%0.2f] in world %s", Player:GetPosX(), Player:GetPosY(), Player:GetPosZ(), Player:GetWorld():GetName()) )
|
||||
return true
|
||||
end
|
@ -4,7 +4,6 @@ BannedPlayersIni = {}
|
||||
WhiteListIni = {}
|
||||
BackCoords = {}
|
||||
Messages = {}
|
||||
LimitWorldsCuboid = {}
|
||||
--END VARIABLES
|
||||
|
||||
--COMMENCE AWESOMENESS!
|
||||
@ -17,13 +16,13 @@ function Initialize(Plugin)
|
||||
--ADD HOOKS
|
||||
PluginManager = cRoot:Get():GetPluginManager()
|
||||
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_JOINED)
|
||||
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)
|
||||
PluginManager:AddHook(Plugin, cPluginManager.HOOK_KILLING)
|
||||
PluginManager:AddHook(Plugin, cPluginManager.HOOK_CRAFTING_NO_RECIPE)
|
||||
PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHAT) -- used in web_chat.lua
|
||||
PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATING)
|
||||
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_MOVING)
|
||||
|
||||
--PLEASE ALPHA SORT http://elmosaukko.com/sort-alphabetically/ THIS LIST
|
||||
@ -34,11 +33,9 @@ function Initialize(Plugin)
|
||||
PluginManager:BindCommand("/gm", "core.changegm", HandleChangeGMCommand, " ~ Change your gamemode");
|
||||
PluginManager:BindCommand("/help", "core.help", HandleHelpCommand, " ~ Show available commands");
|
||||
PluginManager:BindCommand("/kick", "core.kick", HandleKickCommand, " ~ Kick a player");
|
||||
PluginManager:BindCommand("/list", "core.playerlist", HandlePlayerListCommand, " - Shows list of connected players");
|
||||
PluginManager:BindCommand("/listgroups", "core.listgroups", HandleListGroupsCommand, " - Shows a list of all the groups");
|
||||
PluginManager:BindCommand("/groups", "core.groups", HandleGroupsCommand, " - Shows a list of all the groups");
|
||||
PluginManager:BindCommand("/locate", "core.locate", HandleLocateCommand, " - Show your current server coordinates");
|
||||
PluginManager:BindCommand("/motd", "core.motd", HandleMOTDCommand, " - Show message of the day");
|
||||
PluginManager:BindCommand("/playerlist", "core.playerlist", HandlePlayerListCommand, " - Shows list of connected players");
|
||||
PluginManager:BindCommand("/plugins", "core.plugins", HandlePluginsCommand, " - Show list of plugins");
|
||||
PluginManager:BindCommand("/portal", "core.portal", HandlePortalCommand, " ~ Move to a different world");
|
||||
PluginManager:BindCommand("/rank", "core.rank", HandleRankCommand, " ~ Add someone to a group");
|
||||
@ -48,7 +45,7 @@ function Initialize(Plugin)
|
||||
PluginManager:BindCommand("/spawn", "core.spawn", HandleSpawnCommand, " - Return to the spawn");
|
||||
PluginManager:BindCommand("/stop", "core.stop", HandleStopCommand, " - Stops the server");
|
||||
PluginManager:BindCommand("/time", "core.time", HandleTimeCommand, " ~ Sets the time of day");
|
||||
PluginManager:BindCommand("/toggledownfall", "core.toggledownfall", HandleToggleDownfallCommand, " - Toggles the weather");
|
||||
PluginManager:BindCommand("/downfall", "core.downfall", HandleDownfallCommand, " - Toggles the weather");
|
||||
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");
|
||||
@ -56,7 +53,6 @@ function Initialize(Plugin)
|
||||
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")
|
||||
PluginManager:BindCommand("/who", "core.playerlist", HandlePlayerListCommand, " - Shows list of connected players");
|
||||
PluginManager:BindCommand("/worlds", "core.worlds", HandleWorldsCommand, " - Shows a list of all the worlds");
|
||||
|
||||
InitConsoleCommands();
|
||||
@ -65,14 +61,12 @@ function Initialize(Plugin)
|
||||
IniFile = cIniFile("settings.ini")
|
||||
if ( IniFile:ReadFile() == true ) then
|
||||
HardCore = IniFile:GetValueSet("GameMode", "Hardcore", "false")
|
||||
LimitWorld = IniFile:GetValueSetB("Worlds", "LimitWorld", false)
|
||||
LimitWorldWidth = IniFile:GetValueSetI("Worlds", "LimitWorldWidth", 10)
|
||||
IniFile:WriteFile()
|
||||
end
|
||||
|
||||
WorldsSpawnProtect = {}
|
||||
local KeyIdx = IniFile:FindKey("Worlds") --(FIND WHERE 'WORLDS' KEY IS LOCATED)
|
||||
local NumValues = (IniFile:GetNumValues( KeyIdx ) - 2) --(TAKE AWAY TWO OPTIONS FOR WORLD LIMITER)
|
||||
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
|
||||
@ -80,16 +74,15 @@ function Initialize(Plugin)
|
||||
WorldIni:WriteFile()
|
||||
end
|
||||
end
|
||||
|
||||
if LimitWorld == true then
|
||||
cRoot:Get():ForEachWorld(
|
||||
function( World )
|
||||
LimitWorldsCuboid[World:GetName()] = cCuboid()
|
||||
LimitWorldsCuboid[World:GetName()].p1 = Vector3i( math.floor(World:GetSpawnX() / 16) + LimitWorldWidth, 0, math.floor(World:GetSpawnZ() / 16) + LimitWorldWidth)
|
||||
LimitWorldsCuboid[World:GetName()].p2 = Vector3i( math.floor(World:GetSpawnX() / 16) - LimitWorldWidth, 256, math.floor(World:GetSpawnZ() / 16) - LimitWorldWidth)
|
||||
LimitWorldsCuboid[World:GetName()]:Sort()
|
||||
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
|
||||
@ -178,7 +171,7 @@ function WriteLog(breakPlace, X, Y, Z, player, id, meta)
|
||||
end
|
||||
|
||||
function WarnPlayer(Player)
|
||||
Player:SendMessage("Go further from spawn to build")
|
||||
Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Go further from spawn to build")
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -5,11 +5,11 @@ function HandleMeCommand( Split, Player )
|
||||
Message = Message .. " " .. Text;
|
||||
end
|
||||
if (Split[1] == nil) then
|
||||
Player:SendMessage("Usage: /me <action>")
|
||||
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);
|
||||
cRoot:Get():GetServer():BroadcastChat(Player:GetName() .. "" .. Message);
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
@ -3,9 +3,6 @@ function HandleMOTDCommand( Split, Player )
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
function LoadMotd()
|
||||
local File = io.open("motd.txt", "r")
|
||||
-- Check if the file 'motd.txt' exists, else create it.
|
||||
@ -35,18 +32,12 @@ function LoadMotd()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
function ShowMOTDTo( Player )
|
||||
for I=1, #Messages do
|
||||
Player:SendMessage(Messages[I])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
function ReturnColorFromChar( Split, char )
|
||||
-- Check if the char represents a color. Else return nil.
|
||||
if char == "0" then
|
||||
|
@ -1,16 +0,0 @@
|
||||
function OnChunkGenerating(World, ChunkX, ChunkZ, ChunkDesc)
|
||||
if (LimitWorld == true) then
|
||||
if not LimitWorldsCuboid[World:GetName()]:IsInside( Vector3i(ChunkX, 128, ChunkZ) ) then
|
||||
FillBlocks(ChunkDesc)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function FillBlocks(ChunkDesc)
|
||||
ChunkDesc:FillBlocks(0,0)
|
||||
ChunkDesc:SetUseDefaultBiomes(false)
|
||||
ChunkDesc:SetUseDefaultHeight(false)
|
||||
ChunkDesc:SetUseDefaultComposition(false)
|
||||
ChunkDesc:SetUseDefaultStructures(false)
|
||||
ChunkDesc:SetUseDefaultFinish(false)
|
||||
end
|
@ -3,54 +3,54 @@ function OnKilling(Victim, Killer)
|
||||
SetBackCoordinates( Victim )
|
||||
Server = cRoot:Get():GetServer()
|
||||
if Killer == nil then
|
||||
if Victim:IsOnFire() then
|
||||
Server:SendMessage( cChatColor.Red .. Victim:GetName() .. " was burnt to a cinder" )
|
||||
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
|
||||
end
|
||||
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 .. Victim:GetName() .. " tried to swim in lava (and failed)" )
|
||||
if Victim:IsOnFire() then
|
||||
Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " was burnt to a cinder" )
|
||||
CheckHardcore(Victim)
|
||||
return false
|
||||
end
|
||||
else
|
||||
if Killer:IsPlayer() then
|
||||
Server:SendMessage( cChatColor.Red .. Victim:GetName() .. " was terminated by " .. Killer:GetName() )
|
||||
Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " was terminated by " .. Killer:GetName() )
|
||||
CheckHardcore(Victim)
|
||||
return false
|
||||
elseif Killer:IsMob() then
|
||||
if Killer:IsA("cZombie") then
|
||||
Server:SendMessage( cChatColor.Red .. Victim:GetName() .. " was eaten by a Zombie")
|
||||
Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " was eaten by a zombie")
|
||||
elseif Killer:IsA("cSkeleton") then
|
||||
Server:SendMessage( cChatColor.Red .. Victim:GetName() .. " was shot by a Skeleton" )
|
||||
Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " was shot by a skeleton" )
|
||||
elseif Killer:IsA("cCreeper") then
|
||||
Server:SendMessage( cChatColor.Red .. Victim:GetName() .. " was blown up by a Creeper")
|
||||
Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " was blown up by a creeper")
|
||||
elseif Killer:IsA("cSpider") then
|
||||
Server:SendMessage( cChatColor.Red .. Victim:GetName() .. " was ripped apart by a giant Spider")
|
||||
Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " was ripped apart by a giant spider")
|
||||
elseif Killer:IsA("cCaveSpider") then
|
||||
Server:SendMessage( cChatColor.Red .. Victim:GetName() .. " was poisoned by a giant Cave Spider")
|
||||
Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " was poisoned by a giant cave spider")
|
||||
elseif Killer:IsA("cBlaze") then
|
||||
Server:SendMessage( cChatColor.Red .. Victim:GetName() .. " was flamed by a Blaze")
|
||||
Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " was flamed by a blaze")
|
||||
elseif Killer:IsA("cEnderman") then
|
||||
Server:SendMessage( cChatColor.Red .. Victim:GetName() .. " was " .. cChatColor.Random .. " by an Enderman")
|
||||
Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " was " .. cChatColor.Random .. " by an enderman")
|
||||
elseif Killer:IsA("cSilverfish") then
|
||||
Server:SendMessage( cChatColor.Red .. Victim:GetName() .. " was... DERPED by a Silverfish!")
|
||||
Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " encountered an unexpectedly fatal silverfish attack")
|
||||
elseif Killer:IsA("cSlime") then
|
||||
Server:SendMessage( cChatColor.Red .. Victim:GetName() .. " was stuck fast and killed by a Slime")
|
||||
Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " was absorbed and digested by a slime")
|
||||
elseif Killer:IsA("cWitch") then
|
||||
Server:SendMessage( cChatColor.Red .. Victim:GetName() .. " was enchanted (to death) by a Witch")
|
||||
Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " was enchanted (to death) by a witch")
|
||||
elseif Killer:IsA("cZombiepigman") then
|
||||
Server:SendMessage( cChatColor.Red .. Victim:GetName() .. " was slain by a Zombie Pigman")
|
||||
Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " was slain by a zombie pigman")
|
||||
elseif Killer:IsA("cMagmacube") then
|
||||
Server:SendMessage( cChatColor.Red .. Victim:GetName() .. " was incinerated by a Magmacube")
|
||||
Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " was incinerated by a magmacube")
|
||||
elseif Killer:IsA("cWolf") then
|
||||
Server:SendMessage( cChatColor.Red .. Victim:GetName() .. " was savaged by a Wolf")
|
||||
Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " was savaged by a wolf")
|
||||
end
|
||||
CheckHardcore(Victim)
|
||||
return false
|
||||
end
|
||||
end
|
||||
Server:SendMessage( cChatColor.Red .. Victim:GetName() .. " died of mysterious circumstances")
|
||||
Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " died of mysterious circumstances")
|
||||
CheckHardcore(Victim)
|
||||
end
|
||||
end
|
||||
|
11
MCServer/Plugins/Core/onjoinleave.lua
Normal file
11
MCServer/Plugins/Core/onjoinleave.lua
Normal file
@ -0,0 +1,11 @@
|
||||
function OnPlayerJoined(Player)
|
||||
ShowMOTDTo( Player )
|
||||
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" )
|
||||
end
|
@ -1,5 +0,0 @@
|
||||
function OnPlayerJoined(Player)
|
||||
ShowMOTDTo( Player )
|
||||
AddMessage( Player:GetName() .. " has joined the game", " " )
|
||||
return false
|
||||
end
|
@ -1,14 +0,0 @@
|
||||
function HandlePlayerListCommand( Split, Player )
|
||||
|
||||
local PlayerTable = {}
|
||||
local AppendToTable = function( Player )
|
||||
table.insert(PlayerTable, Player:GetName() )
|
||||
end
|
||||
Player:GetWorld():ForEachPlayer( AppendToTable )
|
||||
|
||||
local Message = cChatColor.Green .. "Connected players: (".. cChatColor.White.. #PlayerTable .. cChatColor.Green .. ")"
|
||||
Player:SendMessage( Message )
|
||||
|
||||
Player:SendMessage( table.concat(PlayerTable, " ") )
|
||||
return true
|
||||
end
|
@ -9,7 +9,7 @@ function HandlePluginsCommand( Split, Player )
|
||||
end
|
||||
end
|
||||
|
||||
Player:SendMessage( cChatColor.Green .. "Loaded plugins: (" .. #PluginTable .. ")" )
|
||||
Player:SendMessage( cChatColor.Gold .. table.concat(PluginTable, cChatColor.Gold.." ") )
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "There are " .. #PluginTable .. " loaded plugins")
|
||||
Player:SendMessage(cChatColor.Gold .. table.concat(PluginTable, cChatColor.Gold.." ") )
|
||||
return true
|
||||
end
|
@ -1,23 +1,23 @@
|
||||
function HandlePortalCommand( Split, Player )
|
||||
if( #Split ~= 2 ) then
|
||||
Player:SendMessage( cChatColor.Green .. "Usage: /gotoworld [WorldName]" )
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /portal [WorldName]" )
|
||||
return true
|
||||
end
|
||||
|
||||
if( Player:MoveToWorld(Split[2]) == false ) then
|
||||
Player:SendMessage( cChatColor.Green .. "Could not move to world '" .. Split[2] .. "'!" )
|
||||
Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Could not move to world " .. Split[2] .. "!" )
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
Player:SendMessage( cChatColor.Green .. "Moved successfully to '" .. Split[2] .. "'! :D" )
|
||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Moved successfully to '" .. Split[2] .. "'! :D" )
|
||||
return true
|
||||
end
|
||||
|
||||
function HandleWorldsCommand( Split, Player )
|
||||
local SettingsIni = cIniFile("settings.ini")
|
||||
if SettingsIni:ReadFile() == false then
|
||||
Player:SendMessage( cChatColor.Green .. "No worlds found" )
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "No worlds found" )
|
||||
end
|
||||
Number = SettingsIni:NumValues("Worlds") - 1
|
||||
Worlds = {}
|
||||
@ -30,7 +30,7 @@ function HandleWorldsCommand( Split, Player )
|
||||
for i=0, Number do
|
||||
table.insert( Worlds, SettingsIni:GetValue( Key, i) )
|
||||
end
|
||||
Player:SendMessage( cChatColor.Green .. "Worlds:" )
|
||||
Player:SendMessage( cChatColor.Green .. table.concat( Worlds, ", " ) )
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Found " .. #Worlds .. " worlds" )
|
||||
Player:SendMessage(cChatColor.Gold .. table.concat( Worlds, ", " ) )
|
||||
return true
|
||||
end
|
@ -1,6 +1,6 @@
|
||||
function HandleRankCommand( Split, Player )
|
||||
if Split[2] == nil or Split[3] == nil then
|
||||
Player:SendMessage(cChatColor.Rose .. "Usage: /rank [Player] [Group]")
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /rank [Player] [Group]")
|
||||
return true
|
||||
end
|
||||
local GroupsIni = cIniFile("groups.ini")
|
||||
@ -8,7 +8,7 @@ function HandleRankCommand( Split, Player )
|
||||
LOG("Could not read groups.ini!")
|
||||
end
|
||||
if GroupsIni:FindKey(Split[3]) == -1 then
|
||||
Player:SendMessage(cChatColor.Rose .. "Group does not exist")
|
||||
Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Group does not exist")
|
||||
return true
|
||||
end
|
||||
local UsersIni = cIniFile("users.ini")
|
||||
@ -20,7 +20,7 @@ function HandleRankCommand( Split, Player )
|
||||
UsersIni:WriteFile()
|
||||
local loopPlayers = function( Player )
|
||||
if Player:GetName() == Split[2] then
|
||||
Player:SendMessage( cChatColor.Green .. "You were moved to group " .. Split[3] )
|
||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "You were moved to group " .. Split[3] )
|
||||
Player:LoadPermissionsFromDisk()
|
||||
end
|
||||
end
|
||||
@ -28,21 +28,21 @@ function HandleRankCommand( Split, Player )
|
||||
World:ForEachPlayer( loopPlayers )
|
||||
end
|
||||
cRoot:Get():ForEachWorld( loopWorlds )
|
||||
Player:SendMessage(cChatColor.Green .. "Player " .. Split[2] .. " Was moved to " .. Split[3])
|
||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Player " .. Split[2] .. " Was moved to " .. Split[3])
|
||||
return true
|
||||
end
|
||||
|
||||
function HandleListGroupsCommand( Split, Player )
|
||||
function HandleGroupsCommand( Split, Player )
|
||||
local GroupsIni = cIniFile("groups.ini")
|
||||
if GroupsIni:ReadFile() == false then
|
||||
Player:SendMessage( cChatColor.Green .. "No groups found" )
|
||||
Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "No groups found" )
|
||||
end
|
||||
Number = GroupsIni:NumKeys() - 1
|
||||
Groups = {}
|
||||
for i=0, Number do
|
||||
table.insert( Groups, GroupsIni:KeyName(i) )
|
||||
end
|
||||
Player:SendMessage( cChatColor.Green .. "Groups:" )
|
||||
Player:SendMessage( cChatColor.Green .. table.concat( Groups, ", " ) )
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Found " .. #Groups .. " groups" )
|
||||
Player:SendMessage(cChatColor.Gold .. table.concat( Groups, " " ) )
|
||||
return true
|
||||
end
|
@ -1,6 +1,6 @@
|
||||
function HandleRegenCommand(Split, Player)
|
||||
if ((#Split == 2) or (#Split > 3)) then
|
||||
Player:SendMessage( cChatColor.Green .. "Usage: '/regeneratechunk' or '/regeneratechunk [X] [Z]'");
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: '/regeneratechunk' or '/regeneratechunk [X] [Z]'");
|
||||
return true;
|
||||
end
|
||||
|
||||
@ -12,7 +12,7 @@ function HandleRegenCommand(Split, Player)
|
||||
Z = Split[3];
|
||||
end
|
||||
|
||||
Player:SendMessage(cChatColor.Green .. "Regenerating chunk ["..X..", "..Z.."]");
|
||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Regenerating chunk ["..X..", "..Z.."]");
|
||||
Player:GetWorld():RegenerateChunk(X, Z);
|
||||
return true;
|
||||
end
|
@ -1,19 +1,22 @@
|
||||
function HandleSaveAllCommand( Split, Player )
|
||||
cRoot:Get():SaveAllChunks();
|
||||
Player:SendMessage(cChatColor.Green .. "All the worlds are saved")
|
||||
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()
|
||||
Server:SendMessage( cChatColor.Green .. "Stopping the server..." )
|
||||
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()
|
||||
Server:SendMessage( cChatColor.Green .. "Reloading all plugins." )
|
||||
local Server = cRoot:Get():GetServer()
|
||||
Server:SendMessage(cChatColor.Rose .. "[WARNING] " .. cChatColor.White .. "Reloading all plugins!" )
|
||||
cRoot:Get():GetPluginManager():ReloadPlugins()
|
||||
return true
|
||||
end
|
@ -2,6 +2,6 @@ function HandleSpawnCommand(Split, Player)
|
||||
World = Player:GetWorld()
|
||||
SetBackCoordinates(Player)
|
||||
Player:TeleportToCoords(World:GetSpawnX(), World:GetSpawnY(), World:GetSpawnZ())
|
||||
LOGINFO(Player:GetName() .. " returned to spawn.")
|
||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Returned to world spawn" )
|
||||
return true
|
||||
end
|
@ -7,23 +7,23 @@ function HandleTPCommand(a_Split, a_Player)
|
||||
-- Teleport to XYZ coords specified in a_Split[2, 3, 4]:
|
||||
SetBackCoordinates(a_Player);
|
||||
a_Player:TeleportToCoords(a_Split[2], a_Split[3], a_Split[4]);
|
||||
a_Player:SendMessage(cChatColor.Green .. "You teleported to {" .. a_Split[2] .. ", " .. a_Split[3] .. ", " .. a_Split[4] .. "}");
|
||||
a_Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "You teleported to [X:" .. a_Split[2] .. " Y:" .. a_Split[3] .. " Z:" .. a_Split[4] .. "]");
|
||||
return true;
|
||||
else
|
||||
a_Player:SendMessage( cChatColor.Green .. "Usage: /tp [PlayerName] (-h) or /tp [X Y Z]" )
|
||||
a_Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /tp [PlayerName] (-h) or /tp [X Y Z]" )
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function HandleTPACommand( Split, Player )
|
||||
if Split[2] == nil then
|
||||
Player:SendMessage( cChatColor.Green .. "Usage: /tpa [Player]" )
|
||||
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.Green .. Player:GetName() .. " send a teleport request" )
|
||||
Player:SendMessage( cChatColor.Green .. "You send a teleport request to " .. OtherPlayer:GetName() )
|
||||
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
|
||||
@ -36,7 +36,7 @@ end
|
||||
|
||||
function HandleTPAcceptCommand( Split, Player )
|
||||
if Destination[Player:GetName()] == nil then
|
||||
Player:SendMessage( cChatColor.Green .. "Nobody has send you a teleport request" )
|
||||
Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Nobody has send you a teleport request" )
|
||||
return true
|
||||
end
|
||||
local loopPlayer = function( OtherPlayer )
|
||||
@ -45,8 +45,8 @@ function HandleTPAcceptCommand( Split, Player )
|
||||
OtherPlayer:MoveToWorld( Player:GetWorld():GetName() )
|
||||
end
|
||||
OtherPlayer:TeleportToEntity( Player )
|
||||
Player:SendMessage( cChatColor.Green .. OtherPlayer:GetName() .. " teleported to you" )
|
||||
OtherPlayer:SendMessage( cChatColor.Green .. "You teleported to " .. Player:GetName() )
|
||||
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
|
||||
@ -62,19 +62,19 @@ function TeleportToPlayer(a_SrcPlayer, a_DstPlayerName, a_TellDst)
|
||||
local teleport = function(OtherPlayer)
|
||||
if (OtherPlayer == a_SrcPlayer) then
|
||||
-- Asked to teleport to self?
|
||||
a_SrcPlayer:SendMessage(cChatColor.Green .. "Y' can't teleport to yerself!");
|
||||
a_SrcPlayer:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Y' can't teleport to yerself!");
|
||||
else
|
||||
SetBackCoordinates(a_SrcPlayer);
|
||||
a_SrcPlayer:TeleportToEntity(OtherPlayer);
|
||||
a_SrcPlayer:SendMessage(cChatColor.Green .. "You teleported to " .. OtherPlayer:GetName() .. "!");
|
||||
a_SrcPlayer:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "You teleported to " .. OtherPlayer:GetName() .. "!");
|
||||
if (a_TellDst) then
|
||||
OtherPlayer:SendMessage(cChatColor.Green .. Player:GetName().." teleported to you!");
|
||||
OtherPlayer:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. Player:GetName().." teleported to you!");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local World = a_SrcPlayer:GetWorld();
|
||||
if (not(World:DoWithPlayer(a_DstPlayerName, teleport))) then
|
||||
a_SrcPlayer:SendMessage(cChatColor.Green .. "Can't find player " .. a_DstPlayerName);
|
||||
a_SrcPlayer:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Can't find player " .. a_DstPlayerName);
|
||||
end
|
||||
end
|
@ -1,23 +1,23 @@
|
||||
function HandleTimeCommand( Split, Player )
|
||||
if Split[2] == nil then
|
||||
Player:SendMessage( cChatColor.Green .. "Usage: /time [Day/Night/Set/Add]" )
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /time [Day/Night/Set/Add]" )
|
||||
return true
|
||||
end
|
||||
local Server = cRoot:Get():GetServer()
|
||||
if( string.upper( Split[2] ) == "DAY") then
|
||||
Player:GetWorld():SetTimeOfDay( 0 )
|
||||
Server:SendMessage( cChatColor.Green .. Player:GetName() .. " set the time to Day.")
|
||||
Server:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Time was set to daytime" )
|
||||
elseif( string.upper( Split[2] ) == "NIGHT") then
|
||||
Player:GetWorld():SetTimeOfDay( 12000 + 1000 )
|
||||
Server:SendMessage( cChatColor.Green .. Player:GetName() .. " set the time to Night.")
|
||||
Server:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Time was set to nighttime" )
|
||||
elseif( string.upper(Split[2]) == "SET" ) and ( tonumber(Split[3]) ~= nil) then
|
||||
Player:GetWorld():SetTimeOfDay( tonumber(Split[3]) )
|
||||
Server:SendMessage( cChatColor.Green .. Player:GetName() .. " set the time to " .. Split[3] )
|
||||
Server:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Time was set to " .. Split[3] )
|
||||
elseif( string.upper(Split[2]) == "ADD" ) and ( tonumber(Split[3]) ~= nil) then
|
||||
Player:GetWorld():SetTimeOfDay( Player:GetWorld():GetTimeOfDay() + Split[3] )
|
||||
Server:SendMessage( cChatColor.Green .. Player:GetName() .. " Added " .. Split[3] .. " to the time" )
|
||||
Server:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. Split[3] .. "Was added to the time" )
|
||||
else
|
||||
Player:SendMessage( cChatColor.Green .. "Usage: /time [Day/Night/Set/Add]" )
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /time [Day/Night/Set/Add]" )
|
||||
end
|
||||
return true
|
||||
end
|
@ -5,7 +5,7 @@ function HandleTopCommand( Split, Player )
|
||||
local Height = World:GetHeight( math.floor(PlayerPos.x), math.floor(PlayerPos.z) )
|
||||
SetBackCoordinates( Player )
|
||||
Player:TeleportToCoords( PlayerPos.x, Height+1, PlayerPos.z )
|
||||
Player:SendMessage("Teleported to the top block")
|
||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Teleported to the topmost block")
|
||||
|
||||
return true
|
||||
end
|
@ -1,10 +1,10 @@
|
||||
function HandleViewDistanceCommand( Split, Player )
|
||||
if( #Split ~= 2 ) then
|
||||
Player:SendMessage( cChatColor.Green .. "Usage: /viewdistance [".. cClientHandle.MIN_VIEW_DISTANCE .."-".. cClientHandle.MAX_VIEW_DISTANCE .."]" )
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /viewdistance [".. cClientHandle.MIN_VIEW_DISTANCE .."-".. cClientHandle.MAX_VIEW_DISTANCE .."]" )
|
||||
return true
|
||||
end
|
||||
|
||||
Player:GetClientHandle():SetViewDistance( Split[2] )
|
||||
Player:SendMessage(cChatColor.Green .. "Your viewdistance has been set to " .. Player:GetClientHandle():GetViewDistance() )
|
||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Your view distance has been set to " .. Player:GetClientHandle():GetViewDistance() )
|
||||
return true
|
||||
end
|
@ -1,10 +1,10 @@
|
||||
function HandleToggleDownfallCommand( Split, Player )
|
||||
function HandleDownfallCommand( Split, Player )
|
||||
World = Player:GetWorld()
|
||||
if World:GetWeather() == 0 then
|
||||
World:SetWeather(1)
|
||||
else
|
||||
World:SetWeather(0)
|
||||
end
|
||||
Player:SendMessage( cChatColor.Green .. "Weather toggled")
|
||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Downfall toggled")
|
||||
return true
|
||||
end
|
@ -56,12 +56,6 @@ local function ShowGeneralSettings( Request )
|
||||
if( tonumber( Request.PostParams["Authentication_Authenticate"] ) ~= nil ) then
|
||||
SettingsIni:SetValue("Authentication", "Authenticate", Request.PostParams["Authentication_Authenticate"], false )
|
||||
end
|
||||
if( tonumber( Request.PostParams["Limit_World"] ) ~= nil ) then
|
||||
SettingsIni:SetValue("Worlds", "LimitWorld", Request.PostParams["Limit_World"], false )
|
||||
end
|
||||
if( tonumber( Request.PostParams["LimitWorldWidth"] ) ~= nil ) then
|
||||
SettingsIni:SetValue("Worlds", "LimitWorldWidth", Request.PostParams["LimitWorldWidth"], false )
|
||||
end
|
||||
|
||||
if( SettingsIni:WriteFile() == false ) then
|
||||
InfoMsg = [[<b style="color: red;">ERROR: Could not write to settings.ini!</b>]]
|
||||
@ -99,13 +93,6 @@ local function ShowGeneralSettings( Request )
|
||||
<td>]] .. HTML_Select_On_Off("Authentication_Authenticate", SettingsIni:GetValueI("Authentication", "Authenticate") ) .. [[</td></tr>
|
||||
</table><br />
|
||||
|
||||
<table>
|
||||
<th colspan="2">LimitWorld</th>
|
||||
<tr><td style="width: 50%;">Limit World:</td>
|
||||
<td>]] .. HTML_Select_On_Off("Limit_World", SettingsIni:GetValueI("Worlds", "LimitWorld") ) .. [[</td></tr>
|
||||
<tr><td>Max Chunks from spawn:</td>
|
||||
<td><input type="text" name="LimitWorldWidth" value="]] .. SettingsIni:GetValue("Worlds", "LimitWorldWidth") .. [["></td></tr>
|
||||
</table><br />
|
||||
<input type="submit" value="Save Settings" name="general_submit"> WARNING: Any changes made here might require a server restart in order to be applied!
|
||||
</form>]]
|
||||
|
||||
@ -376,6 +363,10 @@ function ShowWorldSettings( Request )
|
||||
WorldIni:DeleteValue( "SpawnPosition", "Z" )
|
||||
WorldIni:SetValue( "SpawnPosition", "Z", Request.PostParams["World_SpawnZ"] )
|
||||
end
|
||||
if( tonumber( Request.PostParams["LimitWorldWidth"] ) ~= nil ) then
|
||||
WorldIni:DeleteValue( "WorldLimit", "LimitRadius" )
|
||||
WorldIni:SetValue( "WorldLimit", "LimitRadius", Request.PostParams["LimitWorldWidth"] )
|
||||
end
|
||||
if( tonumber( Request.PostParams["World_Seed"] ) ~= nil ) then
|
||||
WorldIni:DeleteValue( "Seed", "Seed" )
|
||||
WorldIni:SetValue( "Seed", "Seed", Request.PostParams["World_Seed"] )
|
||||
@ -678,6 +669,11 @@ 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>
|
||||
<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 />
|
||||
<table>
|
||||
<th colspan="2">Seed</th>
|
||||
<tr><td>Seed:</td>
|
||||
|
@ -1,5 +1,6 @@
|
||||
function OnPlayerMoving( Player )
|
||||
if LimitWorld == true then
|
||||
LimitWorldWidth = WorldsWorldLimit[Player:GetWorld():GetName()]
|
||||
if LimitWorldWidth > 0 then
|
||||
local World = Player:GetWorld()
|
||||
local SpawnX = math.floor(World:GetSpawnX() / 16)
|
||||
local SpawnZ = math.floor(World:GetSpawnZ() / 16)
|
||||
|
Loading…
Reference in New Issue
Block a user