1
0

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:
Alexander Harkness 2013-07-31 17:10:59 +01:00
parent c700108ab6
commit 8ced99994b
27 changed files with 120 additions and 160 deletions

View File

@ -1,9 +1,9 @@
function HandleBackCommand( Split, Player ) function HandleBackCommand( Split, Player )
if BackCoords[Player:GetName()] == nil then 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 else
Player:TeleportToCoords(BackCoords[Player:GetName()].x, BackCoords[Player:GetName()].y, BackCoords[Player:GetName()].z) 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 end
return true return true
end end

View File

@ -1,6 +1,6 @@
function HandleBanCommand( Split, Player ) function HandleBanCommand( Split, Player )
if( #Split < 2 ) then 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 return true
end end
@ -10,7 +10,7 @@ function HandleBanCommand( Split, Player )
end end
if( BanPlayer(Split[2], Reason) == false ) then 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 return true
end end
@ -40,12 +40,12 @@ end
function HandleUnbanCommand( Split, Player ) function HandleUnbanCommand( Split, Player )
if( #Split < 2 ) then if( #Split < 2 ) then
Player:SendMessage( cChatColor.Green .. "Usage: /unban [Player]" ) Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /unban [Player]" )
return true return true
end end
if( BannedPlayersIni:GetValueB("Banned", Split[2], false) == false ) then 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 return true
end end

View File

@ -1,6 +1,6 @@
function HandleGiveCommand(Split, Player) function HandleGiveCommand(Split, Player)
if ((#Split ~= 2) and (#Split ~=3)) then 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; return true;
end end
@ -12,7 +12,7 @@ function HandleGiveCommand(Split, Player)
end end
if not(FoundItem) then 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 return true
end end
@ -20,7 +20,7 @@ function HandleGiveCommand(Split, Player)
if (#Split == 3) then if (#Split == 3) then
ItemAmount = tonumber(Split[3]); ItemAmount = tonumber(Split[3]);
if ((ItemAmount == nil) or (ItemAmount < 1) or (ItemAmount > 512)) then 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; return true;
end end
end end
@ -29,10 +29,10 @@ function HandleGiveCommand(Split, Player)
local ItemsGiven = Player:GetInventory():AddItem(Item); local ItemsGiven = Player:GetInventory():AddItem(Item);
if (ItemsGiven == ItemAmount) then 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); LOG("Gave " .. Player:GetName() .. " " .. Item.m_ItemCount .. " times " .. Item.m_ItemType .. ":" .. Item.m_ItemDamage);
else 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); LOG("Player " .. Player:GetName() .. " asked for " .. Item.m_ItemCount .. " times " .. Item.m_ItemType .. ":" .. Item.m_ItemDamage ..", but only could fit " .. ItemsGiven);
end end
return true; return true;

View File

@ -1,6 +1,6 @@
function HandleChangeGMCommand( Split, Player ) function HandleChangeGMCommand( Split, Player )
if( #Split ~= 2 ) then 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 return true
end end
Player:SetGameMode(Split[2]) Player:SetGameMode(Split[2])

View File

@ -1,6 +1,6 @@
function HandleKickCommand( Split, Player ) function HandleKickCommand( Split, Player )
if( #Split < 2 ) then 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 return true
end end
@ -10,7 +10,7 @@ function HandleKickCommand( Split, Player )
end end
if( KickPlayer( Split[2], Reason ) == false ) then 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 end
return true return true

View File

@ -1,4 +1,4 @@
function HandleLocateCommand( Split, Player ) 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 return true
end end

View File

@ -4,7 +4,6 @@ BannedPlayersIni = {}
WhiteListIni = {} WhiteListIni = {}
BackCoords = {} BackCoords = {}
Messages = {} Messages = {}
LimitWorldsCuboid = {}
--END VARIABLES --END VARIABLES
--COMMENCE AWESOMENESS! --COMMENCE AWESOMENESS!
@ -17,13 +16,13 @@ function Initialize(Plugin)
--ADD HOOKS --ADD HOOKS
PluginManager = cRoot:Get():GetPluginManager() PluginManager = cRoot:Get():GetPluginManager()
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_JOINED) 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_BREAKING_BLOCK)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_PLACING_BLOCK) PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_PLACING_BLOCK)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_LOGIN) PluginManager:AddHook(Plugin, cPluginManager.HOOK_LOGIN)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_KILLING) PluginManager:AddHook(Plugin, cPluginManager.HOOK_KILLING)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_CRAFTING_NO_RECIPE) PluginManager:AddHook(Plugin, cPluginManager.HOOK_CRAFTING_NO_RECIPE)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHAT) -- used in web_chat.lua 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) PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_MOVING)
--PLEASE ALPHA SORT http://elmosaukko.com/sort-alphabetically/ THIS LIST --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("/gm", "core.changegm", HandleChangeGMCommand, " ~ Change your gamemode");
PluginManager:BindCommand("/help", "core.help", HandleHelpCommand, " ~ Show available commands"); PluginManager:BindCommand("/help", "core.help", HandleHelpCommand, " ~ Show available commands");
PluginManager:BindCommand("/kick", "core.kick", HandleKickCommand, " ~ Kick a player"); PluginManager:BindCommand("/kick", "core.kick", HandleKickCommand, " ~ Kick a player");
PluginManager:BindCommand("/list", "core.playerlist", HandlePlayerListCommand, " - Shows list of connected players"); PluginManager:BindCommand("/groups", "core.groups", HandleGroupsCommand, " - Shows a list of all the groups");
PluginManager:BindCommand("/listgroups", "core.listgroups", HandleListGroupsCommand, " - Shows a list of all the groups");
PluginManager:BindCommand("/locate", "core.locate", HandleLocateCommand, " - Show your current server coordinates"); PluginManager:BindCommand("/locate", "core.locate", HandleLocateCommand, " - Show your current server coordinates");
PluginManager:BindCommand("/motd", "core.motd", HandleMOTDCommand, " - Show message of the day"); 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("/plugins", "core.plugins", HandlePluginsCommand, " - Show list of plugins");
PluginManager:BindCommand("/portal", "core.portal", HandlePortalCommand, " ~ Move to a different world"); PluginManager:BindCommand("/portal", "core.portal", HandlePortalCommand, " ~ Move to a different world");
PluginManager:BindCommand("/rank", "core.rank", HandleRankCommand, " ~ Add someone to a group"); 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("/spawn", "core.spawn", HandleSpawnCommand, " - Return to the spawn");
PluginManager:BindCommand("/stop", "core.stop", HandleStopCommand, " - Stops the server"); PluginManager:BindCommand("/stop", "core.stop", HandleStopCommand, " - Stops the server");
PluginManager:BindCommand("/time", "core.time", HandleTimeCommand, " ~ Sets the time of day"); 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("/me", "core.me", HandleMeCommand, " ~ Tell what you are doing");
PluginManager:BindCommand("/top", "core.top", HandleTopCommand, " - Teleport yourself to the top most block"); 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("/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("/tpaccept", "core.teleport", HandleTPAcceptCommand, " ~ Accept a teleportation request");
PluginManager:BindCommand("/unban", "core.unban", HandleUnbanCommand, " ~ Unban a player"); 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("/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"); PluginManager:BindCommand("/worlds", "core.worlds", HandleWorldsCommand, " - Shows a list of all the worlds");
InitConsoleCommands(); InitConsoleCommands();
@ -65,14 +61,12 @@ function Initialize(Plugin)
IniFile = cIniFile("settings.ini") IniFile = cIniFile("settings.ini")
if ( IniFile:ReadFile() == true ) then if ( IniFile:ReadFile() == true ) then
HardCore = IniFile:GetValueSet("GameMode", "Hardcore", "false") HardCore = IniFile:GetValueSet("GameMode", "Hardcore", "false")
LimitWorld = IniFile:GetValueSetB("Worlds", "LimitWorld", false)
LimitWorldWidth = IniFile:GetValueSetI("Worlds", "LimitWorldWidth", 10)
IniFile:WriteFile() IniFile:WriteFile()
end end
WorldsSpawnProtect = {} WorldsSpawnProtect = {}
local KeyIdx = IniFile:FindKey("Worlds") --(FIND WHERE 'WORLDS' KEY IS LOCATED) 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) 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") WorldIni = cIniFile(IniFile:GetValue(KeyIdx, i) .. "/world.ini")
if WorldIni:ReadFile() == true then if WorldIni:ReadFile() == true then
@ -80,16 +74,15 @@ function Initialize(Plugin)
WorldIni:WriteFile() WorldIni:WriteFile()
end end
end end
WorldsWorldLimit = {}
if LimitWorld == true then local KeyIdx = IniFile:FindKey("Worlds") --(FIND WHERE 'WORLDS' KEY IS LOCATED)
cRoot:Get():ForEachWorld( local NumValues = (IniFile:GetNumValues( KeyIdx )) --(HOW MANY VALUES ARE THERE?)
function( World ) for i = 0, NumValues - 1 do --(FOR EVERY WORLD KEY, TAKING ACCOUNT OF OFF BY ONE ERRORS)
LimitWorldsCuboid[World:GetName()] = cCuboid() WorldIni = cIniFile(IniFile:GetValue(KeyIdx, i) .. "/world.ini")
LimitWorldsCuboid[World:GetName()].p1 = Vector3i( math.floor(World:GetSpawnX() / 16) + LimitWorldWidth, 0, math.floor(World:GetSpawnZ() / 16) + LimitWorldWidth) if WorldIni:ReadFile() == true then
LimitWorldsCuboid[World:GetName()].p2 = Vector3i( math.floor(World:GetSpawnX() / 16) - LimitWorldWidth, 256, math.floor(World:GetSpawnZ() / 16) - LimitWorldWidth) WorldsWorldLimit[IniFile:GetValue(KeyIdx, i)] = WorldIni:GetValueSetI("WorldLimit", "LimitRadius", 0)
LimitWorldsCuboid[World:GetName()]:Sort() WorldIni:WriteFile()
end end
)
end end
--LOAD WHITELIST --LOAD WHITELIST
@ -178,7 +171,7 @@ function WriteLog(breakPlace, X, Y, Z, player, id, meta)
end end
function WarnPlayer(Player) 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 return
end end

View File

@ -5,11 +5,11 @@ function HandleMeCommand( Split, Player )
Message = Message .. " " .. Text; Message = Message .. " " .. Text;
end end
if (Split[1] == nil) then if (Split[1] == nil) then
Player:SendMessage("Usage: /me <action>") Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /me <action>")
return true return true
end end
if (Split[1] ~= nil) then if (Split[1] ~= nil) then
cRoot:Get():GetServer():BroadcastChat(Player:GetName().. ""..Message); cRoot:Get():GetServer():BroadcastChat(Player:GetName() .. "" .. Message);
return true return true
end end
end end

View File

@ -3,9 +3,6 @@ function HandleMOTDCommand( Split, Player )
return true return true
end end
function LoadMotd() function LoadMotd()
local File = io.open("motd.txt", "r") local File = io.open("motd.txt", "r")
-- Check if the file 'motd.txt' exists, else create it. -- Check if the file 'motd.txt' exists, else create it.
@ -35,18 +32,12 @@ function LoadMotd()
end end
end end
function ShowMOTDTo( Player ) function ShowMOTDTo( Player )
for I=1, #Messages do for I=1, #Messages do
Player:SendMessage(Messages[I]) Player:SendMessage(Messages[I])
end end
end end
function ReturnColorFromChar( Split, char ) function ReturnColorFromChar( Split, char )
-- Check if the char represents a color. Else return nil. -- Check if the char represents a color. Else return nil.
if char == "0" then if char == "0" then

View File

@ -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

View File

@ -3,54 +3,54 @@ function OnKilling(Victim, Killer)
SetBackCoordinates( Victim ) SetBackCoordinates( Victim )
Server = cRoot:Get():GetServer() Server = cRoot:Get():GetServer()
if Killer == nil then if Killer == nil then
if Victim:IsOnFire() 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 .. Victim:GetName() .. " was burnt to a cinder" ) Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " tried to swim in lava (and failed)" )
CheckHardcore(Victim) CheckHardcore(Victim)
return false return false
end end
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:IsOnFire() then
Server:SendMessage( cChatColor.Red .. Victim:GetName() .. " tried to swim in lava (and failed)" ) Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " was burnt to a cinder" )
CheckHardcore(Victim) CheckHardcore(Victim)
return false return false
end end
else else
if Killer:IsPlayer() then 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) CheckHardcore(Victim)
return false return false
elseif Killer:IsMob() then elseif Killer:IsMob() then
if Killer:IsA("cZombie") 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 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 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 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 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 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 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 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 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 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 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 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 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 end
CheckHardcore(Victim) CheckHardcore(Victim)
return false return false
end end
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) CheckHardcore(Victim)
end end
end end

View 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

View File

@ -1,5 +0,0 @@
function OnPlayerJoined(Player)
ShowMOTDTo( Player )
AddMessage( Player:GetName() .. " has joined the game", " " )
return false
end

View File

@ -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

View File

@ -9,7 +9,7 @@ function HandlePluginsCommand( Split, Player )
end end
end end
Player:SendMessage( cChatColor.Green .. "Loaded plugins: (" .. #PluginTable .. ")" ) Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "There are " .. #PluginTable .. " loaded plugins")
Player:SendMessage( cChatColor.Gold .. table.concat(PluginTable, cChatColor.Gold.." ") ) Player:SendMessage(cChatColor.Gold .. table.concat(PluginTable, cChatColor.Gold.." ") )
return true return true
end end

View File

@ -1,23 +1,23 @@
function HandlePortalCommand( Split, Player ) function HandlePortalCommand( Split, Player )
if( #Split ~= 2 ) then if( #Split ~= 2 ) then
Player:SendMessage( cChatColor.Green .. "Usage: /gotoworld [WorldName]" ) Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /portal [WorldName]" )
return true return true
end end
if( Player:MoveToWorld(Split[2]) == false ) then 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 return true
end 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 return true
end end
function HandleWorldsCommand( Split, Player ) function HandleWorldsCommand( Split, Player )
local SettingsIni = cIniFile("settings.ini") local SettingsIni = cIniFile("settings.ini")
if SettingsIni:ReadFile() == false then if SettingsIni:ReadFile() == false then
Player:SendMessage( cChatColor.Green .. "No worlds found" ) Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "No worlds found" )
end end
Number = SettingsIni:NumValues("Worlds") - 1 Number = SettingsIni:NumValues("Worlds") - 1
Worlds = {} Worlds = {}
@ -30,7 +30,7 @@ function HandleWorldsCommand( Split, Player )
for i=0, Number do for i=0, Number do
table.insert( Worlds, SettingsIni:GetValue( Key, i) ) table.insert( Worlds, SettingsIni:GetValue( Key, i) )
end end
Player:SendMessage( cChatColor.Green .. "Worlds:" ) Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Found " .. #Worlds .. " worlds" )
Player:SendMessage( cChatColor.Green .. table.concat( Worlds, ", " ) ) Player:SendMessage(cChatColor.Gold .. table.concat( Worlds, ", " ) )
return true return true
end end

View File

@ -1,6 +1,6 @@
function HandleRankCommand( Split, Player ) function HandleRankCommand( Split, Player )
if Split[2] == nil or Split[3] == nil then 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 return true
end end
local GroupsIni = cIniFile("groups.ini") local GroupsIni = cIniFile("groups.ini")
@ -8,7 +8,7 @@ function HandleRankCommand( Split, Player )
LOG("Could not read groups.ini!") LOG("Could not read groups.ini!")
end end
if GroupsIni:FindKey(Split[3]) == -1 then 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 return true
end end
local UsersIni = cIniFile("users.ini") local UsersIni = cIniFile("users.ini")
@ -20,7 +20,7 @@ function HandleRankCommand( Split, Player )
UsersIni:WriteFile() UsersIni:WriteFile()
local loopPlayers = function( Player ) local loopPlayers = function( Player )
if Player:GetName() == Split[2] then 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() Player:LoadPermissionsFromDisk()
end end
end end
@ -28,21 +28,21 @@ function HandleRankCommand( Split, Player )
World:ForEachPlayer( loopPlayers ) World:ForEachPlayer( loopPlayers )
end end
cRoot:Get():ForEachWorld( loopWorlds ) 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 return true
end end
function HandleListGroupsCommand( Split, Player ) function HandleGroupsCommand( Split, Player )
local GroupsIni = cIniFile("groups.ini") local GroupsIni = cIniFile("groups.ini")
if GroupsIni:ReadFile() == false then if GroupsIni:ReadFile() == false then
Player:SendMessage( cChatColor.Green .. "No groups found" ) Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "No groups found" )
end end
Number = GroupsIni:NumKeys() - 1 Number = GroupsIni:NumKeys() - 1
Groups = {} Groups = {}
for i=0, Number do for i=0, Number do
table.insert( Groups, GroupsIni:KeyName(i) ) table.insert( Groups, GroupsIni:KeyName(i) )
end end
Player:SendMessage( cChatColor.Green .. "Groups:" ) Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Found " .. #Groups .. " groups" )
Player:SendMessage( cChatColor.Green .. table.concat( Groups, ", " ) ) Player:SendMessage(cChatColor.Gold .. table.concat( Groups, " " ) )
return true return true
end end

View File

@ -1,6 +1,6 @@
function HandleRegenCommand(Split, Player) function HandleRegenCommand(Split, Player)
if ((#Split == 2) or (#Split > 3)) then 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; return true;
end end
@ -12,7 +12,7 @@ function HandleRegenCommand(Split, Player)
Z = Split[3]; Z = Split[3];
end 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); Player:GetWorld():RegenerateChunk(X, Z);
return true; return true;
end end

View File

@ -1,19 +1,22 @@
function HandleSaveAllCommand( Split, Player ) function HandleSaveAllCommand( Split, Player )
cRoot:Get():SaveAllChunks(); 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; return true;
end end
function HandleStopCommand( Split, Player ) function HandleStopCommand( Split, Player )
Server = cRoot:Get():GetServer() 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") cRoot:Get():QueueExecuteConsoleCommand("stop")
return true return true
end end
function HandleReloadCommand( Split, Player ) function HandleReloadCommand( Split, Player )
Server = cRoot:Get():GetServer() 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() cRoot:Get():GetPluginManager():ReloadPlugins()
return true return true
end end

View File

@ -2,6 +2,6 @@ function HandleSpawnCommand(Split, Player)
World = Player:GetWorld() World = Player:GetWorld()
SetBackCoordinates(Player) SetBackCoordinates(Player)
Player:TeleportToCoords(World:GetSpawnX(), World:GetSpawnY(), World:GetSpawnZ()) 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 return true
end end

View File

@ -7,23 +7,23 @@ function HandleTPCommand(a_Split, a_Player)
-- Teleport to XYZ coords specified in a_Split[2, 3, 4]: -- Teleport to XYZ coords specified in a_Split[2, 3, 4]:
SetBackCoordinates(a_Player); SetBackCoordinates(a_Player);
a_Player:TeleportToCoords(a_Split[2], a_Split[3], a_Split[4]); 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; return true;
else 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 return true
end end
end end
function HandleTPACommand( Split, Player ) function HandleTPACommand( Split, Player )
if Split[2] == nil then if Split[2] == nil then
Player:SendMessage( cChatColor.Green .. "Usage: /tpa [Player]" ) Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /tpa [Player]" )
return true return true
end end
local loopPlayer = function( OtherPlayer ) local loopPlayer = function( OtherPlayer )
if OtherPlayer:GetName() == Split[2] then if OtherPlayer:GetName() == Split[2] then
OtherPlayer:SendMessage( cChatColor.Green .. Player:GetName() .. " send a teleport request" ) OtherPlayer:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. Player:GetName() .. " send a teleport request" )
Player:SendMessage( cChatColor.Green .. "You send a teleport request to " .. OtherPlayer:GetName() ) Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "You send a teleport request to " .. OtherPlayer:GetName() )
Destination[OtherPlayer:GetName()] = Player:GetName() Destination[OtherPlayer:GetName()] = Player:GetName()
end end
end end
@ -36,7 +36,7 @@ end
function HandleTPAcceptCommand( Split, Player ) function HandleTPAcceptCommand( Split, Player )
if Destination[Player:GetName()] == nil then 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 return true
end end
local loopPlayer = function( OtherPlayer ) local loopPlayer = function( OtherPlayer )
@ -45,8 +45,8 @@ function HandleTPAcceptCommand( Split, Player )
OtherPlayer:MoveToWorld( Player:GetWorld():GetName() ) OtherPlayer:MoveToWorld( Player:GetWorld():GetName() )
end end
OtherPlayer:TeleportToEntity( Player ) OtherPlayer:TeleportToEntity( Player )
Player:SendMessage( cChatColor.Green .. OtherPlayer:GetName() .. " teleported to you" ) Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. OtherPlayer:GetName() .. " teleported to you" )
OtherPlayer:SendMessage( cChatColor.Green .. "You teleported to " .. Player:GetName() ) OtherPlayer:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "You teleported to " .. Player:GetName() )
Destination[Player:GetName()] = nil Destination[Player:GetName()] = nil
end end
end end
@ -62,19 +62,19 @@ function TeleportToPlayer(a_SrcPlayer, a_DstPlayerName, a_TellDst)
local teleport = function(OtherPlayer) local teleport = function(OtherPlayer)
if (OtherPlayer == a_SrcPlayer) then if (OtherPlayer == a_SrcPlayer) then
-- Asked to teleport to self? -- 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 else
SetBackCoordinates(a_SrcPlayer); SetBackCoordinates(a_SrcPlayer);
a_SrcPlayer:TeleportToEntity(OtherPlayer); 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 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 end
end end
local World = a_SrcPlayer:GetWorld(); local World = a_SrcPlayer:GetWorld();
if (not(World:DoWithPlayer(a_DstPlayerName, teleport))) then 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
end end

View File

@ -1,23 +1,23 @@
function HandleTimeCommand( Split, Player ) function HandleTimeCommand( Split, Player )
if Split[2] == nil then 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 return true
end end
local Server = cRoot:Get():GetServer() local Server = cRoot:Get():GetServer()
if( string.upper( Split[2] ) == "DAY") then if( string.upper( Split[2] ) == "DAY") then
Player:GetWorld():SetTimeOfDay( 0 ) 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 elseif( string.upper( Split[2] ) == "NIGHT") then
Player:GetWorld():SetTimeOfDay( 12000 + 1000 ) 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 elseif( string.upper(Split[2]) == "SET" ) and ( tonumber(Split[3]) ~= nil) then
Player:GetWorld():SetTimeOfDay( tonumber(Split[3]) ) 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 elseif( string.upper(Split[2]) == "ADD" ) and ( tonumber(Split[3]) ~= nil) then
Player:GetWorld():SetTimeOfDay( Player:GetWorld():GetTimeOfDay() + Split[3] ) 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 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 end
return true return true
end end

View File

@ -5,7 +5,7 @@ function HandleTopCommand( Split, Player )
local Height = World:GetHeight( math.floor(PlayerPos.x), math.floor(PlayerPos.z) ) local Height = World:GetHeight( math.floor(PlayerPos.x), math.floor(PlayerPos.z) )
SetBackCoordinates( Player ) SetBackCoordinates( Player )
Player:TeleportToCoords( PlayerPos.x, Height+1, PlayerPos.z ) 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 return true
end end

View File

@ -1,10 +1,10 @@
function HandleViewDistanceCommand( Split, Player ) function HandleViewDistanceCommand( Split, Player )
if( #Split ~= 2 ) then 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 return true
end end
Player:GetClientHandle():SetViewDistance( Split[2] ) 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 return true
end end

View File

@ -1,10 +1,10 @@
function HandleToggleDownfallCommand( Split, Player ) function HandleDownfallCommand( Split, Player )
World = Player:GetWorld() World = Player:GetWorld()
if World:GetWeather() == 0 then if World:GetWeather() == 0 then
World:SetWeather(1) World:SetWeather(1)
else else
World:SetWeather(0) World:SetWeather(0)
end end
Player:SendMessage( cChatColor.Green .. "Weather toggled") Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Downfall toggled")
return true return true
end end

View File

@ -56,12 +56,6 @@ local function ShowGeneralSettings( Request )
if( tonumber( Request.PostParams["Authentication_Authenticate"] ) ~= nil ) then if( tonumber( Request.PostParams["Authentication_Authenticate"] ) ~= nil ) then
SettingsIni:SetValue("Authentication", "Authenticate", Request.PostParams["Authentication_Authenticate"], false ) SettingsIni:SetValue("Authentication", "Authenticate", Request.PostParams["Authentication_Authenticate"], false )
end 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 if( SettingsIni:WriteFile() == false ) then
InfoMsg = [[<b style="color: red;">ERROR: Could not write to settings.ini!</b>]] 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> <td>]] .. HTML_Select_On_Off("Authentication_Authenticate", SettingsIni:GetValueI("Authentication", "Authenticate") ) .. [[</td></tr>
</table><br /> </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! <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>]] </form>]]
@ -376,6 +363,10 @@ function ShowWorldSettings( Request )
WorldIni:DeleteValue( "SpawnPosition", "Z" ) WorldIni:DeleteValue( "SpawnPosition", "Z" )
WorldIni:SetValue( "SpawnPosition", "Z", Request.PostParams["World_SpawnZ"] ) WorldIni:SetValue( "SpawnPosition", "Z", Request.PostParams["World_SpawnZ"] )
end 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 if( tonumber( Request.PostParams["World_Seed"] ) ~= nil ) then
WorldIni:DeleteValue( "Seed", "Seed" ) WorldIni:DeleteValue( "Seed", "Seed" )
WorldIni:SetValue( "Seed", "Seed", Request.PostParams["World_Seed"] ) WorldIni:SetValue( "Seed", "Seed", Request.PostParams["World_Seed"] )
@ -679,6 +670,11 @@ function ShowWorldSettings( Request )
</table> </table>
<br /> <br />
<table> <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> <th colspan="2">Seed</th>
<tr><td>Seed:</td> <tr><td>Seed:</td>
<td><input type="text" name="World_Seed" value="]] .. WorldIni:GetValue("Seed", "Seed") .. [["></td></tr> <td><input type="text" name="World_Seed" value="]] .. WorldIni:GetValue("Seed", "Seed") .. [["></td></tr>

View File

@ -1,5 +1,6 @@
function OnPlayerMoving( Player ) function OnPlayerMoving( Player )
if LimitWorld == true then LimitWorldWidth = WorldsWorldLimit[Player:GetWorld():GetName()]
if LimitWorldWidth > 0 then
local World = Player:GetWorld() local World = Player:GetWorld()
local SpawnX = math.floor(World:GetSpawnX() / 16) local SpawnX = math.floor(World:GetSpawnX() / 16)
local SpawnZ = math.floor(World:GetSpawnZ() / 16) local SpawnZ = math.floor(World:GetSpawnZ() / 16)