summaryrefslogtreecommitdiffstats
path: root/MCServer
diff options
context:
space:
mode:
Diffstat (limited to 'MCServer')
-rw-r--r--MCServer/.gitignore23
-rw-r--r--MCServer/Plugins/APIDump/main.lua61
-rw-r--r--MCServer/Plugins/ChatLog/plugin.lua62
-rw-r--r--MCServer/Plugins/ChunkWorx/chunkworx_web.lua512
-rw-r--r--MCServer/Plugins/Core/Core.deproj126
-rw-r--r--MCServer/Plugins/Core/README.md23
-rw-r--r--MCServer/Plugins/Core/back.lua16
-rw-r--r--MCServer/Plugins/Core/ban-unban.lua60
-rw-r--r--MCServer/Plugins/Core/ban.lua44
-rw-r--r--MCServer/Plugins/Core/console.lua631
-rw-r--r--MCServer/Plugins/Core/coords.lua4
-rw-r--r--MCServer/Plugins/Core/functions.lua4
-rw-r--r--MCServer/Plugins/Core/give.lua (renamed from MCServer/Plugins/Core/item.lua)76
-rw-r--r--MCServer/Plugins/Core/gm.lua (renamed from MCServer/Plugins/Core/gamemode.lua)16
-rw-r--r--MCServer/Plugins/Core/gotoworld.lua15
-rw-r--r--MCServer/Plugins/Core/help.lua79
-rw-r--r--MCServer/Plugins/Core/itemrepair.lua (renamed from MCServer/Plugins/Core/oncraftingnorecipe.lua)416
-rw-r--r--MCServer/Plugins/Core/kick.lua86
-rw-r--r--MCServer/Plugins/Core/listgroups.lua14
-rw-r--r--MCServer/Plugins/Core/listworlds.lua20
-rw-r--r--MCServer/Plugins/Core/locate.lua4
-rw-r--r--MCServer/Plugins/Core/main.lua310
-rw-r--r--MCServer/Plugins/Core/me.lua15
-rw-r--r--MCServer/Plugins/Core/motd.lua183
-rw-r--r--MCServer/Plugins/Core/onbreakplaceblock.lua119
-rw-r--r--MCServer/Plugins/Core/onchunkgenerating.lua16
-rw-r--r--MCServer/Plugins/Core/ondeath.lua65
-rw-r--r--MCServer/Plugins/Core/onjoinleave.lua11
-rw-r--r--MCServer/Plugins/Core/onkilling.lua65
-rw-r--r--MCServer/Plugins/Core/onlogin.lua37
-rw-r--r--MCServer/Plugins/Core/onplayerbreakingblock.lua10
-rw-r--r--MCServer/Plugins/Core/onplayerjoined.lua5
-rw-r--r--MCServer/Plugins/Core/onplayerplacingblock.lua63
-rw-r--r--MCServer/Plugins/Core/playerlist.lua14
-rw-r--r--MCServer/Plugins/Core/plugins.lua (renamed from MCServer/Plugins/Core/pluginlist.lua)28
-rw-r--r--MCServer/Plugins/Core/portal-worlds.lua36
-rw-r--r--MCServer/Plugins/Core/rank-groups.lua48
-rw-r--r--MCServer/Plugins/Core/rank.lua33
-rw-r--r--MCServer/Plugins/Core/regen.lua18
-rw-r--r--MCServer/Plugins/Core/regeneratechunk.lua18
-rw-r--r--MCServer/Plugins/Core/reload.lua6
-rw-r--r--MCServer/Plugins/Core/save-reload-stop.lua22
-rw-r--r--MCServer/Plugins/Core/saveall.lua5
-rw-r--r--MCServer/Plugins/Core/spawn.lua12
-rw-r--r--MCServer/Plugins/Core/stop.lua6
-rw-r--r--MCServer/Plugins/Core/teleport.lua126
-rw-r--r--MCServer/Plugins/Core/time.lua44
-rw-r--r--MCServer/Plugins/Core/top.lua20
-rw-r--r--MCServer/Plugins/Core/unban.lua20
-rw-r--r--MCServer/Plugins/Core/viewdistance.lua18
-rw-r--r--MCServer/Plugins/Core/weather.lua18
-rw-r--r--MCServer/Plugins/Core/web_chat.lua312
-rw-r--r--MCServer/Plugins/Core/web_manageplugins.lua312
-rw-r--r--MCServer/Plugins/Core/web_permissions.lua266
-rw-r--r--MCServer/Plugins/Core/web_playerlist.lua74
-rw-r--r--MCServer/Plugins/Core/web_serversettings.lua1840
-rw-r--r--MCServer/Plugins/Core/web_whitelist.lua156
-rw-r--r--MCServer/Plugins/Core/worldlimiter.lua (renamed from MCServer/Plugins/Core/onplayermoving.lua)41
-rw-r--r--MCServer/Plugins/Debuggers/Debuggers.lua1426
-rw-r--r--MCServer/Plugins/DiamondMover/DiamondMover.lua164
-rw-r--r--MCServer/Plugins/Handy/handy.lua54
-rw-r--r--MCServer/Plugins/Handy/handy_functions.lua708
-rw-r--r--MCServer/Plugins/HookNotify/HookNotify.lua808
-rw-r--r--MCServer/Plugins/MagicCarpet/objects.lua192
-rw-r--r--MCServer/Plugins/ProtectionAreas/CommandHandlers.lua644
-rw-r--r--MCServer/Plugins/ProtectionAreas/CommandState.lua242
-rw-r--r--MCServer/Plugins/ProtectionAreas/Config.lua108
-rw-r--r--MCServer/Plugins/ProtectionAreas/CurrentLng.lua152
-rw-r--r--MCServer/Plugins/ProtectionAreas/HookHandlers.lua278
-rw-r--r--MCServer/Plugins/ProtectionAreas/LICENSE.txt14
-rw-r--r--MCServer/Plugins/ProtectionAreas/PlayerAreas.lua218
-rw-r--r--MCServer/Plugins/ProtectionAreas/ProtectionAreas.lua142
-rw-r--r--MCServer/Plugins/ProtectionAreas/Storage.lua1036
-rw-r--r--MCServer/Plugins/SquirrelChatLog.nut26
-rw-r--r--MCServer/crafting.txt784
-rw-r--r--MCServer/furnace.txt150
-rw-r--r--MCServer/groups.ini32
-rw-r--r--MCServer/hg.supp44
-rw-r--r--MCServer/items.ini1086
-rw-r--r--MCServer/monsters.ini220
-rw-r--r--MCServer/settings.example.ini (renamed from MCServer/settings.ini)62
-rw-r--r--MCServer/terrain.ini8
-rw-r--r--MCServer/users.ini44
-rw-r--r--MCServer/webadmin.example.ini (renamed from MCServer/webadmin.ini)10
-rw-r--r--MCServer/webadmin/template.html258
-rw-r--r--MCServer/webadmin/template.lua453
86 files changed, 8254 insertions, 7793 deletions
diff --git a/MCServer/.gitignore b/MCServer/.gitignore
new file mode 100644
index 000000000..62225e137
--- /dev/null
+++ b/MCServer/.gitignore
@@ -0,0 +1,23 @@
+*.exe
+ChunkWorx.ini
+ChunkWorxSave.ini
+MCServer
+banned.ini
+logs
+players
+whitelist.ini
+world*
+API.txt
+*.dat
+schematics
+*.schematic
+*.ilk
+*.pdb
+memdump.xml
+*.grab
+ProtectionAreas.ini
+ProtectionAreas.sqlite
+helgrind.log
+settings.ini
+webadmin.ini
+motd.txt
diff --git a/MCServer/Plugins/APIDump/main.lua b/MCServer/Plugins/APIDump/main.lua
new file mode 100644
index 000000000..853ff6301
--- /dev/null
+++ b/MCServer/Plugins/APIDump/main.lua
@@ -0,0 +1,61 @@
+-- Global variables
+PLUGIN = {}; -- Reference to own plugin object
+
+
+
+
+
+
+function Initialize(Plugin)
+ PLUGIN = Plugin
+
+ Plugin:SetName("APIDump")
+ Plugin:SetVersion(1)
+
+ PluginManager = cRoot:Get():GetPluginManager()
+ LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
+
+ -- dump all available API functions and objects:
+ DumpAPI();
+
+ return true
+end
+
+
+
+
+
+
+function DumpAPI()
+ LOG("Dumping all available functions to API.txt...");
+ function dump (prefix, a, Output)
+ for i, v in pairs (a) do
+ if (type(v) == "table") then
+ if (GetChar(i, 1) ~= ".") then
+ if (v == _G) then
+ LOG(prefix .. i .. " == _G, CYCLE, ignoring");
+ elseif (v == _G.package) then
+ LOG(prefix .. i .. " == _G.package, ignoring");
+ else
+ dump(prefix .. i .. ".", v, Output)
+ end
+ end
+ elseif (type(v) == "function") then
+ if (string.sub(i, 1, 2) ~= "__") then
+ table.insert(Output, prefix .. i .. "()");
+ end
+ end
+ end
+ end
+
+ local Output = {};
+ dump("", _G, Output);
+
+ table.sort(Output);
+ local f = io.open("API.txt", "w");
+ for i, n in ipairs(Output) do
+ f:write(n, "\n");
+ end
+ f:close();
+ LOG("API.txt written.");
+end
diff --git a/MCServer/Plugins/ChatLog/plugin.lua b/MCServer/Plugins/ChatLog/plugin.lua
index c8358a6d3..c2f6fb81a 100644
--- a/MCServer/Plugins/ChatLog/plugin.lua
+++ b/MCServer/Plugins/ChatLog/plugin.lua
@@ -1,32 +1,32 @@
-
--- plugin.lua
-
--- Implements the main entrypoint for the plugin, as well as all the handling needed
-
--- ChatLog plugin logs all chat messages into the server log
-
-
-
-
-
-function Initialize(Plugin)
- Plugin:SetName("ChatLog")
- Plugin:SetVersion(3)
-
- PluginManager = cRoot:Get():GetPluginManager()
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHAT)
-
- LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
- return true
-end
-
-
-
-
-
-function OnChat(Player, Message)
- -- Lets get loggin'
- LOGINFO("[" .. Player:GetName() .. "]: " .. StripColorCodes(Message));
-
- return false
+
+-- plugin.lua
+
+-- Implements the main entrypoint for the plugin, as well as all the handling needed
+
+-- ChatLog plugin logs all chat messages into the server log
+
+
+
+
+
+function Initialize(Plugin)
+ Plugin:SetName("ChatLog")
+ Plugin:SetVersion(3)
+
+ PluginManager = cRoot:Get():GetPluginManager()
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHAT)
+
+ LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
+ return true
+end
+
+
+
+
+
+function OnChat(Player, Message)
+ -- Lets get loggin'
+ LOGINFO("[" .. Player:GetName() .. "]: " .. StripColorCodes(Message));
+
+ return false
end \ No newline at end of file
diff --git a/MCServer/Plugins/ChunkWorx/chunkworx_web.lua b/MCServer/Plugins/ChunkWorx/chunkworx_web.lua
index aeccb9719..e9a930c92 100644
--- a/MCServer/Plugins/ChunkWorx/chunkworx_web.lua
+++ b/MCServer/Plugins/ChunkWorx/chunkworx_web.lua
@@ -1,257 +1,257 @@
-local function Buttons_Player( Name )
- return "<form method='POST'><input type='hidden' name='PlayerName' value='"..Name.."'><input type='submit' name='PlayerExact' value='Exact'><input type='submit' name='Player3x3' value='3x3'></form>"
-end
-
-local function Button_World( Name )
- return "<form method='POST'><input type='hidden' name='WorldName' value='"..Name.."'><input type='submit' name='SelectWorld' value='Select'></form>"
-end
-
-function HandleRequest_Generation( Request )
- local Content = ""
- if (Request.PostParams["AGHRRRR"] ~= nil) then
- GENERATION_STATE = 0
- WW_instance:SaveAllChunks()
- WW_instance:UnloadUnusedChunks()
- LOGERROR("" .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. ": works ABORTED by admin")
- end
- --Content = Content .. "<head><meta http-equiv=\"refresh\" content=\"2;\"></head>"
- -- PROCESSING
- --------------------------------------------------------------------------------------------------
- local function ProcessingContent()
- local _small_content = ""
- _small_content = _small_content .. "<head><meta http-equiv=\"refresh\" content=\"2;\"></head>"
- _small_content = _small_content .. "<h4>World for operations:</h4>"..WORK_WORLD
- if (OPERATION_CODE == 0) then
- _small_content = _small_content .. "<h4>Operation:</h4>Generation"
- elseif (OPERATION_CODE == 1) then
- _small_content = _small_content .. "<h4>Operation:</h4>Regeneration"
- end
- _small_content = _small_content .. "<h4>Area: </h4>["..AreaStartX..":"..AreaStartZ.."] ["..AreaEndX..":"..AreaEndZ.."]"
- _small_content = _small_content .. "<h4>Progress:</h4>"..CURRENT.."/"..TOTAL
- _small_content = _small_content .. "<br>"
- _small_content = _small_content .. "<form method='POST'>"
- _small_content = _small_content .. "<input type='submit' name='AGHRRRR' value='Stop'>"
- _small_content = _small_content .. "</form>"
- return _small_content
- end
- if (GENERATION_STATE == 2 or GENERATION_STATE == 4) then
- Content = ProcessingContent()
- return Content
- end
- -- SELECTING
- --------------------------------------------------------------------------------------------------
- if ( Request.PostParams["FormSetWorld"] ) then
- WORK_WORLD = Request.PostParams["FormWorldName"]
- WW_instance = cRoot:Get():GetWorld(WORK_WORLD)
- end
-
- if( Request.PostParams["SelectWorld"] ~= nil
- and Request.PostParams["WorldName"] ~= nil ) then -- World is selected!
- WORK_WORLD = Request.PostParams["WorldName"]
- WW_instance = cRoot:Get():GetWorld(WORK_WORLD)
- end
-
- if(Request.PostParams["OperationGenerate"] ~= nil) then
- OPERATION_CODE = 0
- end
- if(Request.PostParams["OperationReGenerate"] ~= nil) then
- OPERATION_CODE = 1
- end
-
- if (GENERATION_STATE == 0) then
- if( Request.PostParams["FormAreaStartX"] ~= nil
- and Request.PostParams["FormAreaStartZ"] ~= nil
- and Request.PostParams["FormAreaEndX"] ~= nil
- and Request.PostParams["FormAreaEndZ"] ~= nil ) then --(Re)Generation valid!
- -- COMMON (Re)gen
- if( Request.PostParams["StartArea"]) then
- AreaStartX = tonumber(Request.PostParams["FormAreaStartX"])
- AreaStartZ = tonumber(Request.PostParams["FormAreaStartZ"])
- AreaEndX = tonumber(Request.PostParams["FormAreaEndX"])
- AreaEndZ = tonumber(Request.PostParams["FormAreaEndZ"])
-
- PLUGIN.IniFile:DeleteValue("Area data", "StartX")
- PLUGIN.IniFile:DeleteValue("Area data", "StartZ")
- PLUGIN.IniFile:DeleteValue("Area data", "EndX")
- PLUGIN.IniFile:DeleteValue("Area data", "EndZ")
- PLUGIN.IniFile:SetValueI("Area data", "StartX", AreaStartX)
- PLUGIN.IniFile:SetValueI("Area data", "StartZ", AreaStartZ)
- PLUGIN.IniFile:SetValueI("Area data", "EndX", AreaEndX)
- PLUGIN.IniFile:SetValueI("Area data", "EndZ", AreaEndZ)
- if (OPERATION_CODE == 0) then
- GENERATION_STATE = 1
- elseif (OPERATION_CODE == 1) then
- GENERATION_STATE = 3
- end
- PLUGIN.IniFile:WriteFile()
- Content = ProcessingContent()
- return Content
- end
- end
- if( Request.PostParams["FormRadialX"] ~= nil
- and Request.PostParams["FormRadialZ"] ~= nil
- and Request.PostParams["FormRadius"] ~= nil ) then --(Re)Generation valid!
- -- COMMON (Re)gen
- if( Request.PostParams["StartRadial"]) then
- RadialX = tonumber(Request.PostParams["FormRadialX"])
- RadialZ = tonumber(Request.PostParams["FormRadialZ"])
- Radius = tonumber(Request.PostParams["FormRadius"])
- AreaStartX = RadialX - Radius
- AreaStartZ = RadialZ - Radius
- AreaEndX = RadialX + Radius
- AreaEndZ = RadialZ + Radius
-
- PLUGIN.IniFile:DeleteValue("Radial data", "RadialX")
- PLUGIN.IniFile:DeleteValue("Radial data", "RadialZ")
- PLUGIN.IniFile:DeleteValue("Radial data", "Radius")
- PLUGIN.IniFile:SetValueI("Radial data", "RadialX", RadialX)
- PLUGIN.IniFile:SetValueI("Radial data", "RadialZ", RadialZ)
- PLUGIN.IniFile:SetValueI("Radial data", "Radius", Radius)
- if (OPERATION_CODE == 0) then
- GENERATION_STATE = 1
- elseif (OPERATION_CODE == 1) then
- GENERATION_STATE = 3
- end
- PLUGIN.IniFile:WriteFile()
- Content = ProcessingContent()
- return Content
- end
- end
- -- POINT REGEN!
- if( Request.PostParams["FormPointX"] ~= nil
- and Request.PostParams["FormPointZ"] ~= nil ) then --ReGeneration valid!
- -- EXACT
- if ( Request.PostParams["PointExact"] ~= nil) then
- AreaStartX = tonumber(Request.PostParams["FormPointX"])
- AreaStartZ = tonumber(Request.PostParams["FormPointZ"])
- AreaEndX = AreaStartX
- AreaEndZ = AreaStartZ
- GENERATION_STATE = 3
- Content = ProcessingContent()
- return Content
- end
- -- 3x3
- if ( Request.PostParams["Point3x3"] ~= nil) then
- AreaStartX = tonumber(Request.PostParams["FormPointX"]) - 1
- AreaStartZ = tonumber(Request.PostParams["FormPointZ"]) - 1
- AreaEndX = AreaStartX + 2
- AreaEndZ = AreaStartZ + 2
- GENERATION_STATE = 3
- Content = ProcessingContent()
- return Content
- end
- end
-
- local GetAreaByPlayer = function(Player)
- -- Player is valid only within this function, it cannot be stord and used later!
- AreaStartX = Player:GetChunkX()
- AreaStartZ = Player:GetChunkZ()
- end
- -- PLAYERS REGEN!
- if( Request.PostParams["PlayerExact"] ~= nil
- and Request.PostParams["PlayerName"] ~= nil ) then -- Making BOOM! I meant, regenereate...
- cRoot:Get():GetWorld(WORK_WORLD):DoWithPlayer(Request.PostParams["PlayerName"],GetAreaByPlayer)
- AreaEndX = AreaStartX
- AreaEndZ = AreaStartZ
- GENERATION_STATE = 3
- Content = ProcessingContent()
- return Content
- end
- if( Request.PostParams["Player3x3"] ~= nil
- and Request.PostParams["PlayerName"] ~= nil ) then -- Making BOOM! I meant, regenereate...
- cRoot:Get():GetWorld(WORK_WORLD):DoWithPlayer(Request.PostParams["PlayerName"],GetAreaByPlayer)
- AreaStartX = AreaStartX - 1
- AreaStartZ = AreaStartZ - 1
- AreaEndX = AreaStartX + 2
- AreaEndZ = AreaStartZ + 2
- GENERATION_STATE = 3
- Content = ProcessingContent()
- return Content
- end
- end
-
- --Content = Content .. "<h4>World for operations: " .. WORK_WORLD .. "</h4>"
- --Content = Content .. "<form method='POST'>"
- --Content = Content .. "<input type='text' name='FormWorldName' value='Input world name here'><input type='submit' name='FormSetWorld' value='Set world'>"
- --Content = Content .. "</form>"
-
- -- SELECTING WORK_WORLD
- Content = Content .. "<h4>World for operations: " .. WORK_WORLD .. "</h4>"
- Content = Content .. "<table>"
- local WorldNum = 0
- local AddWorldToTable = function(World)
- WorldNum = WorldNum + 1
- Content = Content .. "<tr>"
- Content = Content .. "<td style='width: 10px;'>" .. WorldNum .. ".</td>"
- Content = Content .. "<td>" .. World:GetName() .. "</td>"
- Content = Content .. "<td>" .. Button_World(World:GetName()) .. "</td>"
- Content = Content .. "</tr>"
- end
- cRoot:Get():ForEachWorld(AddWorldToTable)
- if( WorldNum == 0 ) then
- Content = Content .. "<tr><td>No worlds! O_O</td></tr>"
- end
- Content = Content .. "</table>"
- Content = Content .. "<br>"
-
- -- SELECTING OPERATION
- if (OPERATION_CODE == 0) then
- Content = Content .. "<h4>Operation: Generation</h4>"
- elseif (OPERATION_CODE == 1) then
- Content = Content .. "<h4>Operation: Regeneration</h4>"
- end
- Content = Content .. "<form method='POST'>"
- Content = Content .. "<input type='submit' name='OperationGenerate' value='Generation'>"
- Content = Content .. "<input type='submit' name='OperationReGenerate' value='Regeneration'>"
- Content = Content .. "</form>"
-
- -- SELECTING AREA
- Content = Content .. "<h4>Area: </h4>Start X, Start Z; End X, End Z"
- Content = Content .. "<form method='POST'>"
- Content = Content .. "<input type='text' name='FormAreaStartX' value='" .. AreaStartX .. "'><input type='text' name='FormAreaStartZ' value='" .. AreaStartZ .. "'>"
- Content = Content .. "<input type='text' name='FormAreaEndX' value='" .. AreaEndX .. "'><input type='text' name='FormAreaEndZ' value='" .. AreaEndZ .. "'>"
- Content = Content .. "<input type='submit' name='StartArea' value='Start'>"
- Content = Content .. "</form>"
-
- -- SELECTING RADIAL
- Content = Content .. "<h4>Radial: </h4>Center X, Center Z, Raduis (0 to any)"
- Content = Content .. "<form method='POST'>"
- Content = Content .. "<input type='text' name='FormRadialX' value='" .. RadialX .. "'><input type='text' name='FormRadialZ' value='" .. RadialZ .. "'><input type='text' name='FormRadius' value='" .. Radius .. "'>"
- Content = Content .. "<input type='submit' name='StartRadial' value='Start'>"
- Content = Content .. "</form>"
- Content = Content .. "<br>"
- Content = Content .. "<br>"
- Content = Content .. "<br>"
-
- -- SELECTING POINT
- Content = Content .. "<h4>Point regeneration:</h4> X, Z"
- Content = Content .. "<form method='POST'>"
- Content = Content .. "<input type='text' name='FormPointX' value='0'><input type='text' name='FormPointZ' value='0'>"
- Content = Content .. "<input type='submit' name='PointExact' value='Exact'>"
- Content = Content .. "<input type='submit' name='Point3x3' value='3x3'>"
- Content = Content .. "</form>"
-
- -- SELECTING PLAYERS
- Content = Content .. "<h4>Player-based regeneration:</h4>"
- Content = Content .. "<table>"
- local PlayerNum = 0
- local AddPlayerToTable = function( Player )
- PlayerNum = PlayerNum + 1
- Content = Content .. "<tr>"
- Content = Content .. "<td style='width: 10px;'>" .. PlayerNum .. ".</td>"
- Content = Content .. "<td>" .. Player:GetName() .. "</td>"
- Content = Content .. "<td>" .. Buttons_Player(Player:GetName()) .. "</td>"
- Content = Content .. "</tr>"
- end
- if (cRoot:Get():GetWorld(WORK_WORLD) == nil) then
- Content = Content .. "<tr><td>Incorrect world selection</td></tr>"
- else
- cRoot:Get():GetWorld(WORK_WORLD):ForEachPlayer( AddPlayerToTable )
- if( PlayerNum == 0 ) then
- Content = Content .. "<tr><td>No connected players</td></tr>"
- end
- end
- Content = Content .. "</table>"
- Content = Content .. "<br>"
- return Content
+local function Buttons_Player( Name )
+ return "<form method='POST'><input type='hidden' name='PlayerName' value='"..Name.."'><input type='submit' name='PlayerExact' value='Exact'><input type='submit' name='Player3x3' value='3x3'></form>"
+end
+
+local function Button_World( Name )
+ return "<form method='POST'><input type='hidden' name='WorldName' value='"..Name.."'><input type='submit' name='SelectWorld' value='Select'></form>"
+end
+
+function HandleRequest_Generation( Request )
+ local Content = ""
+ if (Request.PostParams["AGHRRRR"] ~= nil) then
+ GENERATION_STATE = 0
+ WW_instance:SaveAllChunks()
+ WW_instance:UnloadUnusedChunks()
+ LOGERROR("" .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. ": works ABORTED by admin")
+ end
+ --Content = Content .. "<head><meta http-equiv=\"refresh\" content=\"2;\"></head>"
+ -- PROCESSING
+ --------------------------------------------------------------------------------------------------
+ local function ProcessingContent()
+ local _small_content = ""
+ _small_content = _small_content .. "<head><meta http-equiv=\"refresh\" content=\"2;\"></head>"
+ _small_content = _small_content .. "<h4>World for operations:</h4>"..WORK_WORLD
+ if (OPERATION_CODE == 0) then
+ _small_content = _small_content .. "<h4>Operation:</h4>Generation"
+ elseif (OPERATION_CODE == 1) then
+ _small_content = _small_content .. "<h4>Operation:</h4>Regeneration"
+ end
+ _small_content = _small_content .. "<h4>Area: </h4>["..AreaStartX..":"..AreaStartZ.."] ["..AreaEndX..":"..AreaEndZ.."]"
+ _small_content = _small_content .. "<h4>Progress:</h4>"..CURRENT.."/"..TOTAL
+ _small_content = _small_content .. "<br>"
+ _small_content = _small_content .. "<form method='POST'>"
+ _small_content = _small_content .. "<input type='submit' name='AGHRRRR' value='Stop'>"
+ _small_content = _small_content .. "</form>"
+ return _small_content
+ end
+ if (GENERATION_STATE == 2 or GENERATION_STATE == 4) then
+ Content = ProcessingContent()
+ return Content
+ end
+ -- SELECTING
+ --------------------------------------------------------------------------------------------------
+ if ( Request.PostParams["FormSetWorld"] ) then
+ WORK_WORLD = Request.PostParams["FormWorldName"]
+ WW_instance = cRoot:Get():GetWorld(WORK_WORLD)
+ end
+
+ if( Request.PostParams["SelectWorld"] ~= nil
+ and Request.PostParams["WorldName"] ~= nil ) then -- World is selected!
+ WORK_WORLD = Request.PostParams["WorldName"]
+ WW_instance = cRoot:Get():GetWorld(WORK_WORLD)
+ end
+
+ if(Request.PostParams["OperationGenerate"] ~= nil) then
+ OPERATION_CODE = 0
+ end
+ if(Request.PostParams["OperationReGenerate"] ~= nil) then
+ OPERATION_CODE = 1
+ end
+
+ if (GENERATION_STATE == 0) then
+ if( Request.PostParams["FormAreaStartX"] ~= nil
+ and Request.PostParams["FormAreaStartZ"] ~= nil
+ and Request.PostParams["FormAreaEndX"] ~= nil
+ and Request.PostParams["FormAreaEndZ"] ~= nil ) then --(Re)Generation valid!
+ -- COMMON (Re)gen
+ if( Request.PostParams["StartArea"]) then
+ AreaStartX = tonumber(Request.PostParams["FormAreaStartX"])
+ AreaStartZ = tonumber(Request.PostParams["FormAreaStartZ"])
+ AreaEndX = tonumber(Request.PostParams["FormAreaEndX"])
+ AreaEndZ = tonumber(Request.PostParams["FormAreaEndZ"])
+
+ PLUGIN.IniFile:DeleteValue("Area data", "StartX")
+ PLUGIN.IniFile:DeleteValue("Area data", "StartZ")
+ PLUGIN.IniFile:DeleteValue("Area data", "EndX")
+ PLUGIN.IniFile:DeleteValue("Area data", "EndZ")
+ PLUGIN.IniFile:SetValueI("Area data", "StartX", AreaStartX)
+ PLUGIN.IniFile:SetValueI("Area data", "StartZ", AreaStartZ)
+ PLUGIN.IniFile:SetValueI("Area data", "EndX", AreaEndX)
+ PLUGIN.IniFile:SetValueI("Area data", "EndZ", AreaEndZ)
+ if (OPERATION_CODE == 0) then
+ GENERATION_STATE = 1
+ elseif (OPERATION_CODE == 1) then
+ GENERATION_STATE = 3
+ end
+ PLUGIN.IniFile:WriteFile()
+ Content = ProcessingContent()
+ return Content
+ end
+ end
+ if( Request.PostParams["FormRadialX"] ~= nil
+ and Request.PostParams["FormRadialZ"] ~= nil
+ and Request.PostParams["FormRadius"] ~= nil ) then --(Re)Generation valid!
+ -- COMMON (Re)gen
+ if( Request.PostParams["StartRadial"]) then
+ RadialX = tonumber(Request.PostParams["FormRadialX"])
+ RadialZ = tonumber(Request.PostParams["FormRadialZ"])
+ Radius = tonumber(Request.PostParams["FormRadius"])
+ AreaStartX = RadialX - Radius
+ AreaStartZ = RadialZ - Radius
+ AreaEndX = RadialX + Radius
+ AreaEndZ = RadialZ + Radius
+
+ PLUGIN.IniFile:DeleteValue("Radial data", "RadialX")
+ PLUGIN.IniFile:DeleteValue("Radial data", "RadialZ")
+ PLUGIN.IniFile:DeleteValue("Radial data", "Radius")
+ PLUGIN.IniFile:SetValueI("Radial data", "RadialX", RadialX)
+ PLUGIN.IniFile:SetValueI("Radial data", "RadialZ", RadialZ)
+ PLUGIN.IniFile:SetValueI("Radial data", "Radius", Radius)
+ if (OPERATION_CODE == 0) then
+ GENERATION_STATE = 1
+ elseif (OPERATION_CODE == 1) then
+ GENERATION_STATE = 3
+ end
+ PLUGIN.IniFile:WriteFile()
+ Content = ProcessingContent()
+ return Content
+ end
+ end
+ -- POINT REGEN!
+ if( Request.PostParams["FormPointX"] ~= nil
+ and Request.PostParams["FormPointZ"] ~= nil ) then --ReGeneration valid!
+ -- EXACT
+ if ( Request.PostParams["PointExact"] ~= nil) then
+ AreaStartX = tonumber(Request.PostParams["FormPointX"])
+ AreaStartZ = tonumber(Request.PostParams["FormPointZ"])
+ AreaEndX = AreaStartX
+ AreaEndZ = AreaStartZ
+ GENERATION_STATE = 3
+ Content = ProcessingContent()
+ return Content
+ end
+ -- 3x3
+ if ( Request.PostParams["Point3x3"] ~= nil) then
+ AreaStartX = tonumber(Request.PostParams["FormPointX"]) - 1
+ AreaStartZ = tonumber(Request.PostParams["FormPointZ"]) - 1
+ AreaEndX = AreaStartX + 2
+ AreaEndZ = AreaStartZ + 2
+ GENERATION_STATE = 3
+ Content = ProcessingContent()
+ return Content
+ end
+ end
+
+ local GetAreaByPlayer = function(Player)
+ -- Player is valid only within this function, it cannot be stord and used later!
+ AreaStartX = Player:GetChunkX()
+ AreaStartZ = Player:GetChunkZ()
+ end
+ -- PLAYERS REGEN!
+ if( Request.PostParams["PlayerExact"] ~= nil
+ and Request.PostParams["PlayerName"] ~= nil ) then -- Making BOOM! I meant, regenereate...
+ cRoot:Get():GetWorld(WORK_WORLD):DoWithPlayer(Request.PostParams["PlayerName"],GetAreaByPlayer)
+ AreaEndX = AreaStartX
+ AreaEndZ = AreaStartZ
+ GENERATION_STATE = 3
+ Content = ProcessingContent()
+ return Content
+ end
+ if( Request.PostParams["Player3x3"] ~= nil
+ and Request.PostParams["PlayerName"] ~= nil ) then -- Making BOOM! I meant, regenereate...
+ cRoot:Get():GetWorld(WORK_WORLD):DoWithPlayer(Request.PostParams["PlayerName"],GetAreaByPlayer)
+ AreaStartX = AreaStartX - 1
+ AreaStartZ = AreaStartZ - 1
+ AreaEndX = AreaStartX + 2
+ AreaEndZ = AreaStartZ + 2
+ GENERATION_STATE = 3
+ Content = ProcessingContent()
+ return Content
+ end
+ end
+
+ --Content = Content .. "<h4>World for operations: " .. WORK_WORLD .. "</h4>"
+ --Content = Content .. "<form method='POST'>"
+ --Content = Content .. "<input type='text' name='FormWorldName' value='Input world name here'><input type='submit' name='FormSetWorld' value='Set world'>"
+ --Content = Content .. "</form>"
+
+ -- SELECTING WORK_WORLD
+ Content = Content .. "<h4>World for operations: " .. WORK_WORLD .. "</h4>"
+ Content = Content .. "<table>"
+ local WorldNum = 0
+ local AddWorldToTable = function(World)
+ WorldNum = WorldNum + 1
+ Content = Content .. "<tr>"
+ Content = Content .. "<td style='width: 10px;'>" .. WorldNum .. ".</td>"
+ Content = Content .. "<td>" .. World:GetName() .. "</td>"
+ Content = Content .. "<td>" .. Button_World(World:GetName()) .. "</td>"
+ Content = Content .. "</tr>"
+ end
+ cRoot:Get():ForEachWorld(AddWorldToTable)
+ if( WorldNum == 0 ) then
+ Content = Content .. "<tr><td>No worlds! O_O</td></tr>"
+ end
+ Content = Content .. "</table>"
+ Content = Content .. "<br>"
+
+ -- SELECTING OPERATION
+ if (OPERATION_CODE == 0) then
+ Content = Content .. "<h4>Operation: Generation</h4>"
+ elseif (OPERATION_CODE == 1) then
+ Content = Content .. "<h4>Operation: Regeneration</h4>"
+ end
+ Content = Content .. "<form method='POST'>"
+ Content = Content .. "<input type='submit' name='OperationGenerate' value='Generation'>"
+ Content = Content .. "<input type='submit' name='OperationReGenerate' value='Regeneration'>"
+ Content = Content .. "</form>"
+
+ -- SELECTING AREA
+ Content = Content .. "<h4>Area: </h4>Start X, Start Z; End X, End Z"
+ Content = Content .. "<form method='POST'>"
+ Content = Content .. "<input type='text' name='FormAreaStartX' value='" .. AreaStartX .. "'><input type='text' name='FormAreaStartZ' value='" .. AreaStartZ .. "'>"
+ Content = Content .. "<input type='text' name='FormAreaEndX' value='" .. AreaEndX .. "'><input type='text' name='FormAreaEndZ' value='" .. AreaEndZ .. "'>"
+ Content = Content .. "<input type='submit' name='StartArea' value='Start'>"
+ Content = Content .. "</form>"
+
+ -- SELECTING RADIAL
+ Content = Content .. "<h4>Radial: </h4>Center X, Center Z, Raduis (0 to any)"
+ Content = Content .. "<form method='POST'>"
+ Content = Content .. "<input type='text' name='FormRadialX' value='" .. RadialX .. "'><input type='text' name='FormRadialZ' value='" .. RadialZ .. "'><input type='text' name='FormRadius' value='" .. Radius .. "'>"
+ Content = Content .. "<input type='submit' name='StartRadial' value='Start'>"
+ Content = Content .. "</form>"
+ Content = Content .. "<br>"
+ Content = Content .. "<br>"
+ Content = Content .. "<br>"
+
+ -- SELECTING POINT
+ Content = Content .. "<h4>Point regeneration:</h4> X, Z"
+ Content = Content .. "<form method='POST'>"
+ Content = Content .. "<input type='text' name='FormPointX' value='0'><input type='text' name='FormPointZ' value='0'>"
+ Content = Content .. "<input type='submit' name='PointExact' value='Exact'>"
+ Content = Content .. "<input type='submit' name='Point3x3' value='3x3'>"
+ Content = Content .. "</form>"
+
+ -- SELECTING PLAYERS
+ Content = Content .. "<h4>Player-based regeneration:</h4>"
+ Content = Content .. "<table>"
+ local PlayerNum = 0
+ local AddPlayerToTable = function( Player )
+ PlayerNum = PlayerNum + 1
+ Content = Content .. "<tr>"
+ Content = Content .. "<td style='width: 10px;'>" .. PlayerNum .. ".</td>"
+ Content = Content .. "<td>" .. Player:GetName() .. "</td>"
+ Content = Content .. "<td>" .. Buttons_Player(Player:GetName()) .. "</td>"
+ Content = Content .. "</tr>"
+ end
+ if (cRoot:Get():GetWorld(WORK_WORLD) == nil) then
+ Content = Content .. "<tr><td>Incorrect world selection</td></tr>"
+ else
+ cRoot:Get():GetWorld(WORK_WORLD):ForEachPlayer( AddPlayerToTable )
+ if( PlayerNum == 0 ) then
+ Content = Content .. "<tr><td>No connected players</td></tr>"
+ end
+ end
+ Content = Content .. "</table>"
+ Content = Content .. "<br>"
+ return Content
end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/Core.deproj b/MCServer/Plugins/Core/Core.deproj
deleted file mode 100644
index 36ba2d29a..000000000
--- a/MCServer/Plugins/Core/Core.deproj
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<project>
- <file>
- <filename>back.lua</filename>
- </file>
- <file>
- <filename>ban.lua</filename>
- </file>
- <file>
- <filename>console.lua</filename>
- </file>
- <file>
- <filename>coords.lua</filename>
- </file>
- <file>
- <filename>gamemode.lua</filename>
- </file>
- <file>
- <filename>gotoworld.lua</filename>
- </file>
- <file>
- <filename>help.lua</filename>
- </file>
- <file>
- <filename>item.lua</filename>
- </file>
- <file>
- <filename>kick.lua</filename>
- </file>
- <file>
- <filename>listgroups.lua</filename>
- </file>
- <file>
- <filename>main.lua</filename>
- </file>
- <file>
- <filename>motd.lua</filename>
- </file>
- <file>
- <filename>onchunkgenerating.lua</filename>
- </file>
- <file>
- <filename>oncraftingnorecipe.lua</filename>
- </file>
- <file>
- <filename>onkilling.lua</filename>
- </file>
- <file>
- <filename>onlogin.lua</filename>
- </file>
- <file>
- <filename>onplayerbreakingblock.lua</filename>
- </file>
- <file>
- <filename>onplayerjoined.lua</filename>
- </file>
- <file>
- <filename>onplayermoving.lua</filename>
- </file>
- <file>
- <filename>onplayerplacingblock.lua</filename>
- </file>
- <file>
- <filename>playerlist.lua</filename>
- </file>
- <file>
- <filename>pluginlist.lua</filename>
- </file>
- <file>
- <filename>rank.lua</filename>
- </file>
- <file>
- <filename>regeneratechunk.lua</filename>
- </file>
- <file>
- <filename>reload.lua</filename>
- </file>
- <file>
- <filename>saveall.lua</filename>
- </file>
- <file>
- <filename>spawn.lua</filename>
- </file>
- <file>
- <filename>stop.lua</filename>
- </file>
- <file>
- <filename>teleport.lua</filename>
- </file>
- <file>
- <filename>time.lua</filename>
- </file>
- <file>
- <filename>top.lua</filename>
- </file>
- <file>
- <filename>unban.lua</filename>
- </file>
- <file>
- <filename>viewdistance.lua</filename>
- </file>
- <file>
- <filename>weather.lua</filename>
- </file>
- <file>
- <filename>web_chat.lua</filename>
- </file>
- <file>
- <filename>web_manageplugins.lua</filename>
- </file>
- <file>
- <filename>web_manageserver.lua</filename>
- </file>
- <file>
- <filename>web_permissions.lua</filename>
- </file>
- <file>
- <filename>web_playerlist.lua</filename>
- </file>
- <file>
- <filename>web_serversettings.lua</filename>
- </file>
- <file>
- <filename>web_whitelist.lua</filename>
- </file>
-</project>
diff --git a/MCServer/Plugins/Core/README.md b/MCServer/Plugins/Core/README.md
new file mode 100644
index 000000000..d840459a0
--- /dev/null
+++ b/MCServer/Plugins/Core/README.md
@@ -0,0 +1,23 @@
+Core Plugin (Forked)
+===========
+
+A fork of MCServer's Core plugin.
+
+**New Features:**
+* Simplified commands, such as 'gotoworld' -> 'portal'
+* Simplified and combined LUA files, such as 'listworlds.lua & gotoworld.lua' -> 'worlds-portal.lua'
+* Fixed 'tp' command not working due to typography errors
+* Fixed 'arithmetic on nil value' on startup due to inactivation of world limiter
+* Massive overhaul / redesign of webadmin GUI interface.
+ * Added jQuery transition effect
+ * Completely redesigned CSS
+ * Added new logo
+ * Made HTML5 compliant
+* Beautified 'help' menu
+* Rewrite of death messages - fixed strange grammar and edited to more faithfully reflect Vanilla
+* Added 'unban' console command
+
+**How to Use**
+
+Simply copy all LUA files into Plugins/Core (delete existing files first, except banned.ini and whitelist.ini!)
+Then, copy webadmin to MCServer root directory (delete existing directory first!)
diff --git a/MCServer/Plugins/Core/back.lua b/MCServer/Plugins/Core/back.lua
index 63ec1d857..7afd5436f 100644
--- a/MCServer/Plugins/Core/back.lua
+++ b/MCServer/Plugins/Core/back.lua
@@ -1,9 +1,9 @@
-function HandleBackCommand( Split, Player )
- if BackCoords[Player:GetName()] == nil then
- Player:SendMessage(cChatColor.Green .. "There is no last position known")
- 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")
- end
- return true
+function HandleBackCommand( Split, Player )
+ if BackCoords[Player:GetName()] == nil then
+ 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 .. "[INFO] " .. cChatColor.White .. "Teleported back to your last known position")
+ end
+ return true
end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/ban-unban.lua b/MCServer/Plugins/Core/ban-unban.lua
new file mode 100644
index 000000000..1ad9b7e75
--- /dev/null
+++ b/MCServer/Plugins/Core/ban-unban.lua
@@ -0,0 +1,60 @@
+function HandleBanCommand( Split, Player )
+ if( #Split < 2 ) then
+ Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /ban [Player] <Reason>" )
+ return true
+ end
+
+ local Reason = "You have been banned"
+ if( #Split > 2 ) then
+ Reason = table.concat(Split, " ", 3)
+ end
+
+ if( BanPlayer(Split[2], Reason) == false ) then
+ Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Could not find player " .. Split[2] )
+ return true
+ end
+
+ return true
+end
+
+function BanPlayer(PlayerName, Reason)
+ -- Ban the player in the banned.ini:
+ BannedPlayersIni:SetValueB("Banned", PlayerName, true)
+ BannedPlayersIni:WriteFile()
+
+ -- Kick the player:
+ if (Reason == nil) then
+ Reason = "You have been banned"
+ end
+ local Success = KickPlayer(PlayerName, Reason)
+ if (not(Success)) then
+ return false;
+ end
+
+ LOGINFO("'" .. PlayerName .. "' has been banned (\"" .. Reason .. "\") ");
+ local Server = cRoot:Get():GetServer();
+ Server:SendMessage("Banned " .. PlayerName);
+
+ return true
+end
+
+function HandleUnbanCommand( Split, Player )
+ if( #Split < 2 ) then
+ 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.Rose .. "[INFO] " .. cChatColor.White .. " is not banned!" )
+ return true
+ end
+
+ BannedPlayersIni:SetValueB("Banned", Split[2], false, false)
+ BannedPlayersIni:WriteFile()
+
+ local Server = cRoot:Get():GetServer()
+ LOGINFO( Player:GetName() .. " is unbanning " .. Split[2] )
+ Server:SendMessage( "Unbanning " .. Split[2] )
+
+ return true
+end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/ban.lua b/MCServer/Plugins/Core/ban.lua
deleted file mode 100644
index 4e882b66f..000000000
--- a/MCServer/Plugins/Core/ban.lua
+++ /dev/null
@@ -1,44 +0,0 @@
-function HandleBanCommand( Split, Player )
- if( #Split < 2 ) then
- Player:SendMessage( cChatColor.Green .. "Usage: /ban [Player] <Reason>" )
- return true
- end
-
- local Reason = "You have been banned"
- if( #Split > 2 ) then
- Reason = table.concat(Split, " ", 3)
- end
-
-
- if( BanPlayer(Split[2], Reason) == false ) then
- Player:SendMessage( cChatColor.Green .. "Could not find player " .. Split[2] )
- return true
- end
-
- return true
-end
-
-
-
-
-
-function BanPlayer(PlayerName, Reason)
- -- Ban the player in the banned.ini:
- BannedPlayersIni:SetValueB("Banned", PlayerName, true)
- BannedPlayersIni:WriteFile()
-
- -- Kick the player:
- if (Reason == nil) then
- Reason = "You have been banned"
- end
- local Success = KickPlayer(PlayerName, Reason)
- if (not(Success)) then
- return false;
- end
-
- LOGINFO("'" .. PlayerName .. "' has been banned (\"" .. Reason .. "\") ");
- local Server = cRoot:Get():GetServer();
- Server:SendMessage("Banned " .. PlayerName);
-
- return true
-end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/console.lua b/MCServer/Plugins/Core/console.lua
index df90a9b9a..7c1e6abde 100644
--- a/MCServer/Plugins/Core/console.lua
+++ b/MCServer/Plugins/Core/console.lua
@@ -1,343 +1,288 @@
-
--- console.lua
-
--- Implements things related to console commands
-
-
-
-
-
-function InitConsoleCommands()
- local PluginMgr = cPluginManager:Get();
-
- -- Please keep the list alpha-sorted
- PluginMgr:BindConsoleCommand("ban", HandleConsoleBan, "Bans a player by name");
- PluginMgr:BindConsoleCommand("banlist", HandleConsoleBanList, "Lists all players banned by name");
- PluginMgr:BindConsoleCommand("banlist ips", HandleConsoleBanList, "Lists all players banned by IP");
- PluginMgr:BindConsoleCommand("help", HandleConsoleHelp, "Lists all commands");
- PluginMgr:BindConsoleCommand("list", HandleConsoleList, "Lists all players in a machine-readable format");
- PluginMgr:BindConsoleCommand("listgroups", HandleConsoleListGroups, "Shows a list of all the groups");
- PluginMgr:BindConsoleCommand("numchunks", HandleConsoleNumChunks, "Shows number of chunks currently loaded");
- PluginMgr:BindConsoleCommand("players", HandleConsolePlayers, "Lists all connected players");
- PluginMgr:BindConsoleCommand("primaryserverversion", HandleConsolePrimaryServerVersion, "Gets or sets server version reported to 1.4+ clients");
- PluginMgr:BindConsoleCommand("rank", HandleConsoleRank, " [Player] [Group] - add a player to a group");
- PluginMgr:BindConsoleCommand("reload", HandleConsoleReload, "Reloads all plugins");
- PluginMgr:BindConsoleCommand("save-all", HandleConsoleSaveAll, "Saves all chunks");
- PluginMgr:BindConsoleCommand("say", HandleConsoleSay, "Sends a chat message to all players");
- PluginMgr:BindConsoleCommand("unload", HandleConsoleUnload, "Unloads all unused chunks");
-end
-
-
-
-
-
-function HandleConsoleBan(Split)
- if (#Split < 2) then
- return true, cChatColor.Green .. "Usage: /ban [Player] <Reason>";
- end
-
- local Reason = "You have been banned"
- if (#Split > 2) then
- Reason = table.concat(Split, " ", 3);
- end
-
-
- if (not(BanPlayer(Split[2], Reason))) then
- return true, cChatColor.Green .. "Could not find player " .. Split[2];
- end
-
- return true, "Player " .. Split[2] .. " has been banned.";
-end
-
-
-
-
-
-function HandleConsoleBanList(Split)
- if (#Split == 1) then
- return true, BanListByName();
- end
-
- if (string.lower(Split[2]) == "ips") then
- return true, BanListByIPs();
- end
-
- return true, "Unknown banlist subcommand";
-end
-
-
-
-
-
-function HandleConsoleHelp(Split)
- local Commands = {}; -- {index => {"Command", "HelpString"} }
- local MaxLength = 0;
- local AddToTable = function(Command, HelpString)
- table.insert(Commands, { Command, HelpString });
- local CmdLen = Command:len();
- if (CmdLen > MaxLength) then
- MaxLength = CmdLen;
- end
- end
-
- cPluginManager:Get():ForEachConsoleCommand(AddToTable);
-
- -- Sort the table:
- local CompareCommands = function(a, b)
- return a[1] < b[1]; -- compare command strings
- end
- table.sort(Commands, CompareCommands);
-
- local Out = "";
- for i, Command in ipairs(Commands) do
- Out = Out .. Command[1] .. string.rep(" ", MaxLength - Command[1]:len()); -- Align to a table
- Out = Out .. " - " .. Command[2] .. "\n";
- end
- return true, Out;
-end
-
-
-
-
-
-function HandleConsoleList(Split)
- -- Get a list of all players, one playername per line
- local Out = "";
- cRoot:Get():ForEachWorld(
- function (a_World)
- a_World:ForEachPlayer(
- function (a_Player)
- Out = Out .. a_Player:GetName() .. "\n";
- end
- );
- end
- );
- return true, Out;
-end
-
-
-
-
-
-function HandleConsoleListGroups(Split)
- -- Read the groups.ini file:
- local GroupsIni = cIniFile("groups.ini");
- if (not(GroupsIni:ReadFile())) then
- return true, "No groups found";
- end
-
- -- Read the groups:
- Number = GroupsIni:NumKeys();
- Groups = {};
- for i = 0, Number do
- table.insert(Groups, GroupsIni:KeyName(i))
- end
-
- -- Output the groups, concatenated to a string:
- local Out = "Groups:\n"
- Out = Out .. table.concat(Groups, ", ");
- return true, Out;
-end
-
-
-
-
-
-function HandleConsoleNumChunks(Split)
- local Output = {};
- local AddNumChunks = function(World)
- Output[World:GetName()] = World:GetNumChunks();
- end;
-
- cRoot:Get():ForEachWorld(AddNumChunks);
-
- local Total = 0;
- local Out = "";
- for name, num in pairs(Output) do
- Out = Out .. " " .. name .. ": " .. num .. " chunks\n";
- Total = Total + num;
- end
- Out = Out .. "Total: " .. Total .. " chunks\n";
-
- return true, Out;
-end
-
-
-
-
-
-function HandleConsolePlayers(Split)
- local PlayersInWorlds = {}; -- "WorldName" => [players array]
- local AddToTable = function(Player)
- local WorldName = Player:GetWorld():GetName();
- if (PlayersInWorlds[WorldName] == nil) then
- PlayersInWorlds[WorldName] = {};
- end
- table.insert(PlayersInWorlds[WorldName], Player:GetName() .. " @ " .. Player:GetIP());
- end
-
- cRoot:Get():ForEachPlayer(AddToTable);
-
- local Out = "";
- for WorldName, Players in pairs(PlayersInWorlds) do
- Out = Out .. "World " .. WorldName .. ":\n";
- for i, PlayerName in ipairs(Players) do
- Out = Out .. " " .. PlayerName .. "\n";
- end
- end
-
- return true, Out;
-end
-
-
-
-
-
-function HandleConsolePrimaryServerVersion(Split)
- if (#Split == 1) then
- -- Display current version:
- local Version = cRoot:Get():GetPrimaryServerVersion();
- return true, "Primary server version: #" .. Version .. ", " .. cRoot:GetProtocolVersionTextFromInt(Version);
- end
-
- -- Set new value as the version:
- cRoot:Get():SetPrimaryServerVersion(tonumber(Split[2]));
- local Version = cRoot:Get():GetPrimaryServerVersion();
- return true, "Primary server version is now #" .. Version .. ", " .. cRoot:GetProtocolVersionTextFromInt(Version);
-end
-
-
-
-
-
-function HandleConsoleRank(Split)
- if (Split[2] == nil) or (Split[3] == nil) then
- return true, "Usage: /rank [Player] [Group]";
- end
- local Out = "";
-
- -- Read the groups.ini file:
- local GroupsIni = cIniFile("groups.ini")
- if (not(GroupsIni:ReadFile())) then
- Out = "Could not read groups.ini, creating anew!\n"
- end
-
- -- Find the group:
- if (GroupsIni:FindKey(Split[3]) == -1) then
- return true, Out .. "Group does not exist";
- end
-
- -- Read the users.ini file:
- local UsersIni = cIniFile("users.ini");
- if (not(UsersIni:ReadFile())) then
- Out = Out .. "Could not read users.ini, creating anew!\n";
- end
-
- -- Write the new group value to users.ini:
- UsersIni:DeleteKey(Split[2]);
- UsersIni:GetValueSet(Split[2], "Groups", Split[3]);
- UsersIni:WriteFile();
-
- -- Reload the player's permissions:
- cRoot:Get():ForEachWorld(
- function (World)
- World:ForEachPlayer(
- function (Player)
- if (Player:GetName() == Split[2]) then
- Player:SendMessage(cChatColor.Green .. "You were moved to group " .. Split[3]);
- Player:LoadPermissionsFromDisk();
- end
- end
- );
- end
- )
-
- return true, Out .. "Player " .. Split[2] .. " was moved to " .. Split[3];
-end
-
-
-
-
-
-function HandleConsoleReload(Split)
- Server = cRoot:Get():GetServer();
- Server:SendMessage(cChatColor.Green .. "Reloading all plugins.");
- cPluginManager:Get():ReloadPlugins();
- return true;
-end
-
-
-
-
-
-function HandleConsoleSaveAll(Split)
- cRoot:Get():SaveAllChunks();
- return true;
-end
-
-
-
-
-
-function HandleConsoleSay(Split)
- table.remove(Split, 1);
- local Message = "";
- for i, Text in ipairs(Split) do
- Message = Message .. " " .. Text;
- end
- Message = Message:sub(2); -- Cut off the first space
- cRoot:Get():GetServer():BroadcastChat(cChatColor.Purple .. "[SERVER] " .. Message);
- return true;
-end
-
-
-
-
-
-function HandleConsoleUnload(Split)
- local UnloadChunks = function(World)
- World:UnloadUnusedChunks();
- end
-
- local Out = "Num loaded chunks before: " .. cRoot:Get():GetTotalChunkCount() .. "\n";
- cRoot:Get():ForEachWorld(UnloadChunks);
- Out = Out .. "Num loaded chunks after: " .. cRoot:Get():GetTotalChunkCount();
- return true, Out;
-end
-
-
-
-
-
-
--------------------------------------------------------------------------------------------
--- Helper functions:
-
---- Returns the list of players banned by name, separated by ", "
-function BanListByName()
- local NumValues = BannedPlayersIni:NumValues("Banned");
- local Banned = {};
- local KeyID = BannedPlayersIni:FindKey("Banned");
- for i = 1, NumValues do
- local PlayerName = BannedPlayersIni:ValueName(KeyID, i - 1);
- if (BannedPlayersIni:GetValueB("Banned", PlayerName)) then
- -- Player listed AND banned
- table.insert(Banned, PlayerName);
- end
- end
- return table.concat(Banned, ", ");
-end
-
-
-
-
-
---- Returns the list of players banned by IP, separated by ", "
-function BanListByIPs()
- -- TODO: No IP ban implemented yet
- return "";
-end
-
-
-
-
+-- Implements things related to console commands
+
+function InitConsoleCommands()
+ local PluginMgr = cPluginManager:Get();
+
+ -- Please keep the list alpha-sorted
+ PluginMgr:BindConsoleCommand("ban", HandleConsoleBan, "Bans a player by name");
+ PluginMgr:BindConsoleCommand("unban", HandleConsoleUnban, "Unbans a player by name");
+ PluginMgr:BindConsoleCommand("banlist", HandleConsoleBanList, "Lists all players banned by name");
+ PluginMgr:BindConsoleCommand("banlist ips", HandleConsoleBanList, "Lists all players banned by IP");
+ PluginMgr:BindConsoleCommand("help", HandleConsoleHelp, "Lists all commands");
+ PluginMgr:BindConsoleCommand("list", HandleConsoleList, "Lists all players in a machine-readable format");
+ PluginMgr:BindConsoleCommand("listgroups", HandleConsoleListGroups, "Shows a list of all the groups");
+ PluginMgr:BindConsoleCommand("numchunks", HandleConsoleNumChunks, "Shows number of chunks currently loaded");
+ PluginMgr:BindConsoleCommand("players", HandleConsolePlayers, "Lists all connected players");
+ PluginMgr:BindConsoleCommand("primaryserverversion", HandleConsolePrimaryServerVersion, "Gets or sets server version reported to 1.4+ clients");
+ PluginMgr:BindConsoleCommand("rank", HandleConsoleRank, " [Player] [Group] - add a player to a group");
+ PluginMgr:BindConsoleCommand("reload", HandleConsoleReload, "Reloads all plugins");
+ PluginMgr:BindConsoleCommand("save-all", HandleConsoleSaveAll, "Saves all chunks");
+ PluginMgr:BindConsoleCommand("say", HandleConsoleSay, "Sends a chat message to all players");
+ PluginMgr:BindConsoleCommand("unload", HandleConsoleUnload, "Unloads all unused chunks");
+end
+
+function HandleConsoleBan(Split)
+ if (#Split < 2) then
+ return true, "Usage: ban [Player] <Reason>";
+ end
+
+ local Reason = "You have been banned"
+ if (#Split > 2) then
+ Reason = table.concat(Split, " ", 3);
+ end
+
+
+ if (not(BanPlayer(Split[2], Reason))) then
+ return true, "Could not find player " .. Split[2];
+ end
+
+ return true, "Player " .. Split[2] .. " has been banned.";
+end
+
+function HandleConsoleUnban(Split)
+ if( #Split < 2 ) then
+ return true, "Usage: /unban [Player]"
+ end
+
+ if( BannedPlayersIni:GetValueB("Banned", Split[2], false) == false ) then
+ return true, Split[2] .. " is not banned!"
+ end
+
+ BannedPlayersIni:SetValueB("Banned", Split[2], false, false)
+ BannedPlayersIni:WriteFile()
+
+ local Server = cRoot:Get():GetServer()
+ return true, "Unbanned " .. Split[2]
+end
+
+function HandleConsoleBanList(Split)
+ if (#Split == 1) then
+ return true, BanListByName();
+ end
+
+ if (string.lower(Split[2]) == "ips") then
+ return true, BanListByIPs();
+ end
+
+ return true, "Unknown banlist subcommand";
+end
+
+function HandleConsoleHelp(Split)
+ local Commands = {}; -- {index => {"Command", "HelpString"} }
+ local MaxLength = 0;
+ local AddToTable = function(Command, HelpString)
+ table.insert(Commands, { Command, HelpString });
+ local CmdLen = Command:len();
+ if (CmdLen > MaxLength) then
+ MaxLength = CmdLen;
+ end
+ end
+
+ cPluginManager:Get():ForEachConsoleCommand(AddToTable);
+
+ -- Sort the table:
+ local CompareCommands = function(a, b)
+ return a[1] < b[1]; -- compare command strings
+ end
+ table.sort(Commands, CompareCommands);
+
+ local Out = "";
+ for i, Command in ipairs(Commands) do
+ Out = Out .. Command[1] .. string.rep(" ", MaxLength - Command[1]:len()); -- Align to a table
+ Out = Out .. " - " .. Command[2] .. "\n";
+ end
+ return true, Out;
+end
+
+function HandleConsoleList(Split)
+ -- Get a list of all players, one playername per line
+ local Out = "";
+ cRoot:Get():ForEachWorld(
+ function (a_World)
+ a_World:ForEachPlayer(
+ function (a_Player)
+ Out = Out .. a_Player:GetName() .. "\n";
+ end
+ );
+ end
+ );
+ return true, Out;
+end
+
+function HandleConsoleListGroups(Split)
+ -- Read the groups.ini file:
+ local GroupsIni = cIniFile("groups.ini");
+ if (not(GroupsIni:ReadFile())) then
+ return true, "No groups found";
+ end
+
+ -- Read the groups:
+ Number = GroupsIni:NumKeys();
+ Groups = {};
+ for i = 0, Number do
+ table.insert(Groups, GroupsIni:KeyName(i))
+ end
+
+ -- Output the groups, concatenated to a string:
+ local Out = "Groups:\n"
+ Out = Out .. table.concat(Groups, ", ");
+ return true, Out;
+end
+
+function HandleConsoleNumChunks(Split)
+ local Output = {};
+ local AddNumChunks = function(World)
+ Output[World:GetName()] = World:GetNumChunks();
+ end;
+
+ cRoot:Get():ForEachWorld(AddNumChunks);
+
+ local Total = 0;
+ local Out = "";
+ for name, num in pairs(Output) do
+ Out = Out .. " " .. name .. ": " .. num .. " chunks\n";
+ Total = Total + num;
+ end
+ Out = Out .. "Total: " .. Total .. " chunks\n";
+
+ return true, Out;
+end
+
+function HandleConsolePlayers(Split)
+ local PlayersInWorlds = {}; -- "WorldName" => [players array]
+ local AddToTable = function(Player)
+ local WorldName = Player:GetWorld():GetName();
+ if (PlayersInWorlds[WorldName] == nil) then
+ PlayersInWorlds[WorldName] = {};
+ end
+ table.insert(PlayersInWorlds[WorldName], Player:GetName() .. " @ " .. Player:GetIP());
+ end
+
+ cRoot:Get():ForEachPlayer(AddToTable);
+
+ local Out = "";
+ for WorldName, Players in pairs(PlayersInWorlds) do
+ Out = Out .. "World " .. WorldName .. ":\n";
+ for i, PlayerName in ipairs(Players) do
+ Out = Out .. " " .. PlayerName .. "\n";
+ end
+ end
+
+ return true, Out;
+end
+
+function HandleConsolePrimaryServerVersion(Split)
+ if (#Split == 1) then
+ -- Display current version:
+ local Version = cRoot:Get():GetPrimaryServerVersion();
+ return true, "Primary server version: #" .. Version .. ", " .. cRoot:GetProtocolVersionTextFromInt(Version);
+ end
+
+ -- Set new value as the version:
+ cRoot:Get():SetPrimaryServerVersion(tonumber(Split[2]));
+ local Version = cRoot:Get():GetPrimaryServerVersion();
+ return true, "Primary server version is now #" .. Version .. ", " .. cRoot:GetProtocolVersionTextFromInt(Version);
+end
+
+function HandleConsoleRank(Split)
+ if (Split[2] == nil) or (Split[3] == nil) then
+ return true, "Usage: /rank [Player] [Group]";
+ end
+ local Out = "";
+
+ -- Read the groups.ini file:
+ local GroupsIni = cIniFile("groups.ini")
+ if (not(GroupsIni:ReadFile())) then
+ Out = "Could not read groups.ini, creating anew!\n"
+ end
+
+ -- Find the group:
+ if (GroupsIni:FindKey(Split[3]) == -1) then
+ return true, Out .. "Group does not exist";
+ end
+
+ -- Read the users.ini file:
+ local UsersIni = cIniFile("users.ini");
+ if (not(UsersIni:ReadFile())) then
+ Out = Out .. "Could not read users.ini, creating anew!\n";
+ end
+
+ -- Write the new group value to users.ini:
+ UsersIni:DeleteKey(Split[2]);
+ UsersIni:GetValueSet(Split[2], "Groups", Split[3]);
+ UsersIni:WriteFile();
+
+ -- Reload the player's permissions:
+ cRoot:Get():ForEachWorld(
+ function (World)
+ World:ForEachPlayer(
+ function (Player)
+ if (Player:GetName() == Split[2]) then
+ Player:SendMessage(cChatColor.Green .. "You were moved to group " .. Split[3]);
+ Player:LoadPermissionsFromDisk();
+ end
+ end
+ );
+ end
+ )
+
+ return true, Out .. "Player " .. Split[2] .. " was moved to " .. Split[3];
+end
+
+function HandleConsoleReload(Split)
+ Server = cRoot:Get():GetServer();
+ Server:SendMessage(cChatColor.Green .. "Reloading all plugins.");
+ cPluginManager:Get():ReloadPlugins();
+ return true;
+end
+
+function HandleConsoleSaveAll(Split)
+ cRoot:Get():SaveAllChunks();
+ return true;
+end
+
+function HandleConsoleSay(Split)
+ table.remove(Split, 1);
+ local Message = "";
+ for i, Text in ipairs(Split) do
+ Message = Message .. " " .. Text;
+ end
+ Message = Message:sub(2); -- Cut off the first space
+ cRoot:Get():GetServer():BroadcastChat(cChatColor.Purple .. "[SERVER] " .. Message);
+ return true;
+end
+
+function HandleConsoleUnload(Split)
+ local UnloadChunks = function(World)
+ World:UnloadUnusedChunks();
+ end
+
+ local Out = "Num loaded chunks before: " .. cRoot:Get():GetTotalChunkCount() .. "\n";
+ cRoot:Get():ForEachWorld(UnloadChunks);
+ Out = Out .. "Num loaded chunks after: " .. cRoot:Get():GetTotalChunkCount();
+ return true, Out;
+end
+
+
+-- Helper functions:
+
+--- Returns the list of players banned by name, separated by ", "
+function BanListByName()
+ local NumValues = BannedPlayersIni:NumValues("Banned");
+ local Banned = {};
+ local KeyID = BannedPlayersIni:FindKey("Banned");
+ for i = 1, NumValues do
+ local PlayerName = BannedPlayersIni:ValueName(KeyID, i - 1);
+ if (BannedPlayersIni:GetValueB("Banned", PlayerName)) then
+ -- Player listed AND banned
+ table.insert(Banned, PlayerName);
+ end
+ end
+ return table.concat(Banned, ", ");
+end
+
+--- Returns the list of players banned by IP, separated by ", "
+function BanListByIPs()
+ -- TODO: No IP ban implemented yet
+ return "";
+end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/coords.lua b/MCServer/Plugins/Core/coords.lua
deleted file mode 100644
index 07cda1a92..000000000
--- a/MCServer/Plugins/Core/coords.lua
+++ /dev/null
@@ -1,4 +0,0 @@
-function HandleCoordsCommand( Split, Player )
- Player:SendMessage(cChatColor.Green .. string.format("[X:%0.2f] [Y:%0.2f] [Z:%0.2f]", Player:GetPosX(), Player:GetPosY(), Player:GetPosZ() ) )
- return true
-end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/functions.lua b/MCServer/Plugins/Core/functions.lua
index 36fb3786f..5fc0173b9 100644
--- a/MCServer/Plugins/Core/functions.lua
+++ b/MCServer/Plugins/Core/functions.lua
@@ -1,3 +1,3 @@
-function SetBackCoordinates( Player )
- BackCoords[Player:GetName()] = Vector3i( Player:GetPosX(), Player:GetPosY(), Player:GetPosZ() )
+function SetBackCoordinates( Player )
+ BackCoords[Player:GetName()] = Vector3i( Player:GetPosX(), Player:GetPosY(), Player:GetPosZ() )
end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/item.lua b/MCServer/Plugins/Core/give.lua
index 86ff0576f..d1c7ae59f 100644
--- a/MCServer/Plugins/Core/item.lua
+++ b/MCServer/Plugins/Core/give.lua
@@ -1,39 +1,39 @@
-function HandleItemCommand(Split, Player)
- if ((#Split ~= 2) and (#Split ~=3)) then
- Player:SendMessage(cChatColor.Green .. "Usage: /item [ItemType/Name:Dmg] <Amount>");
- return true;
- end
-
- local Item = cItem();
- local FoundItem = StringToItem(Split[2], Item);
-
- if not(IsValidItem(Item.m_ItemType)) then -- StringToItem does not check if item is valid
- FoundItem = false
- end
-
- if not(FoundItem) then
- Player:SendMessage( cChatColor.Green .. "Invalid Item type / name !" )
- return true
- end
-
- local ItemAmount = 1;
- if (#Split == 3) then
- ItemAmount = tonumber(Split[3]);
- if ((ItemAmount == nil) or (ItemAmount < 1) or (ItemAmount > 512)) then
- Player:SendMessage(cChatColor.Green .. "Invalid Amount!");
- return true;
- end
- end
-
- Item.m_ItemCount = ItemAmount;
-
- local ItemsGiven = Player:GetInventory():AddItem(Item);
- if (ItemsGiven == ItemAmount) then
- Player:SendMessage( cChatColor.Green .. "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);
- LOG("Player " .. Player:GetName() .. " asked for " .. Item.m_ItemCount .. " times " .. Item.m_ItemType .. ":" .. Item.m_ItemDamage ..", but only could fit " .. ItemsGiven);
- end
- return true;
+function HandleGiveCommand(Split, Player)
+ if ((#Split ~= 2) and (#Split ~=3)) then
+ Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /give [ItemType/Name:Dmg] <Amount>" );
+ return true;
+ end
+
+ local Item = cItem();
+ local FoundItem = StringToItem(Split[2], Item);
+
+ if not(IsValidItem(Item.m_ItemType)) then -- StringToItem does not check if item is valid
+ FoundItem = false
+ end
+
+ if not(FoundItem) then
+ Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Invalid item id or name!" )
+ return true
+ end
+
+ local ItemAmount = 1;
+ if (#Split == 3) then
+ ItemAmount = tonumber(Split[3]);
+ if ((ItemAmount == nil) or (ItemAmount < 1) or (ItemAmount > 512)) then
+ Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Invalid amount!" );
+ return true;
+ end
+ end
+
+ Item.m_ItemCount = ItemAmount;
+
+ local ItemsGiven = Player:GetInventory():AddItem(Item);
+ if (ItemsGiven == ItemAmount) then
+ 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.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;
end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/gamemode.lua b/MCServer/Plugins/Core/gm.lua
index 1e73b46fd..5aa6cb2f3 100644
--- a/MCServer/Plugins/Core/gamemode.lua
+++ b/MCServer/Plugins/Core/gm.lua
@@ -1,10 +1,8 @@
-function HandleChangeGMCommand( Split, Player )
- if( #Split ~= 2 ) then
- Player:SendMessage( cChatColor.Green .. "Usage: /gm [GameMode (0|1)]" )
- return true
- end
-
- Player:SetGameMode(Split[2])
-
- return true
+function HandleChangeGMCommand( Split, Player )
+ if( #Split ~= 2 ) then
+ Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /gm [GameMode (0|1)]" )
+ return true
+ end
+ Player:SetGameMode(Split[2])
+ return true
end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/gotoworld.lua b/MCServer/Plugins/Core/gotoworld.lua
deleted file mode 100644
index d5113b667..000000000
--- a/MCServer/Plugins/Core/gotoworld.lua
+++ /dev/null
@@ -1,15 +0,0 @@
-function HandleGotoWorldCommand( Split, Player )
- if( #Split ~= 2 ) then
- Player:SendMessage( cChatColor.Green .. "Usage: /gotoworld [WorldName]" )
- return true
- end
-
- if( Player:MoveToWorld(Split[2]) == false ) then
- Player:SendMessage( cChatColor.Green .. "Could not move to world '" .. Split[2] .. "'!" )
- return true
- end
-
-
- Player:SendMessage( cChatColor.Green .. "Moved successfully to '" .. Split[2] .. "'! :D" )
- return true
-end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/help.lua b/MCServer/Plugins/Core/help.lua
index 68cdeca66..9ec79e056 100644
--- a/MCServer/Plugins/Core/help.lua
+++ b/MCServer/Plugins/Core/help.lua
@@ -1,40 +1,41 @@
-function HandleHelpCommand(Split, Player)
- local PluginManager = cRoot:Get():GetPluginManager()
-
- local LinesPerPage = 9;
- local CurrentPage = 1;
- local CurrentLine = 0;
- local PageRequested = 1;
- local Output = {};
-
- if (#Split == 2) then
- PageRequested = tonumber(Split[2]);
- end
-
- local Process = function(Command, Permission, HelpString)
- if not(Player:HasPermission(Permission)) then
- return false;
- end;
- if (HelpString == "") then
- return false;
- end;
-
- CurrentLine = CurrentLine + 1;
- CurrentPage = math.floor(CurrentLine / LinesPerPage) + 1;
- if (CurrentPage ~= PageRequested) then
- return false;
- end;
- table.insert(Output, cChatColor.Blue .. Command .. HelpString);
- end
-
- PluginManager:ForEachCommand(Process);
-
- -- CurrentPage now contains the total number of pages, and Output has the individual help lines to be sent
-
- Player:SendMessage(cChatColor.Purple .. "- All commands - " .. cChatColor.Gold .. "[Page " .. PageRequested .. " / " .. CurrentPage .. "]");
- for idx, msg in ipairs(Output) do
- Player:SendMessage(msg);
- end;
-
- return true
+function HandleHelpCommand(Split, Player)
+ local PluginManager = cRoot:Get():GetPluginManager()
+
+ local LinesPerPage = 8;
+ local CurrentPage = 1;
+ local CurrentLine = 0;
+ local PageRequested = 1;
+ local Output = {};
+
+ if (#Split == 2) then
+ PageRequested = tonumber(Split[2]);
+ end
+
+ local Process = function(Command, Permission, HelpString)
+ if not(Player:HasPermission(Permission)) then
+ return false;
+ end;
+ if (HelpString == "") then
+ return false;
+ end;
+
+ CurrentLine = CurrentLine + 1;
+ CurrentPage = math.floor(CurrentLine / LinesPerPage) + 1;
+ if (CurrentPage ~= PageRequested) then
+ return false;
+ end;
+ table.insert(Output, cChatColor.Blue .. Command .. HelpString);
+ end
+
+ PluginManager:ForEachCommand(Process);
+
+ -- CurrentPage now contains the total number of pages, and Output has the individual help lines to be sent
+
+ Player:SendMessage(cChatColor.Purple .. "---------- [COMMANDS HELP " .. cChatColor.Gold .. "(Page " .. PageRequested .. " / " .. CurrentPage .. ")" .. cChatColor.Purple .. "] -----------");
+ Player:SendMessage(cChatColor.Purple .. "'-' means no prefix, '~' means a value is required.");
+ for idx, msg in ipairs(Output) do
+ Player:SendMessage(msg);
+ end;
+
+ return true
end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/oncraftingnorecipe.lua b/MCServer/Plugins/Core/itemrepair.lua
index b6909d672..ee411dcc2 100644
--- a/MCServer/Plugins/Core/oncraftingnorecipe.lua
+++ b/MCServer/Plugins/Core/itemrepair.lua
@@ -1,214 +1,202 @@
-
--- Implements item-repair using the HOOK_CRAFTING_NO_RECIPE hook
--- Based on Fixies plugin v2 by Taugeshtu
-
-
--- how much "extra" points are healed per a repair operation (fraction of full health)
-BONUS = 0.1
-
-
-
-
-
-function OnCraftingNoRecipe(Player, Grid, Recipe)
- local _do_fix = false
- local Items = {}
- for x = 0, Grid:GetWidth() - 1 do
- for y = 0, Grid:GetHeight() - 1 do
- local Item = Grid:GetItem(x, y)
- if (Item.m_ItemType ~= E_ITEM_EMPTY) then
- table.insert(Items, Item)
- end
- end
- end
-
- if (#Items ~= 2) then
- -- Only two items together can be fixed
- return false
- end
-
- if (Items[1].m_ItemType ~= Items[2].m_ItemType) then
- -- Only items of the same type may be fixed
- return false
- end
-
- if (
- (Items[1].m_ItemDamage == 0) or
- (Items[2].m_ItemDamage == 0)
- )
- then
- -- Only damaged items may be fixed
- return false
- end
-
- local _ID = Items[1].m_ItemType
- local _least_hp = math.max(Items[1].m_ItemDamage, Items[2].m_ItemDamage)
- local _most_hp = math.min(Items[1].m_ItemDamage, Items[2].m_ItemDamage)
- local _item_hp = 0
-
- -- TODO: This could be refactored into better code, using an _ID-indexed table for _item_hp
-
- if (
- (_ID == E_ITEM_WOODEN_SHOVEL) or
- (_ID == E_ITEM_WOODEN_AXE) or
- (_ID == E_ITEM_WOODEN_PICKAXE) or
- (_ID == E_ITEM_WOODEN_SWORD) or
- (_ID == E_ITEM_WOODEN_HOE)
- )
- then
- _item_hp = 60
- _do_fix = true
- end
-
- if (
- (_ID == E_ITEM_STONE_SHOVEL) or
- (_ID == E_ITEM_STONE_AXE) or
- (_ID == E_ITEM_STONE_PICKAXE) or
- (_ID == E_ITEM_STONE_SWORD) or
- (_ID == E_ITEM_STONE_HOE)
- )
- then
- _item_hp = 132
- _do_fix = true
- end
-
- if (
- (_ID == E_ITEM_IRON_SHOVEL) or
- (_ID == E_ITEM_IRON_AXE) or
- (_ID == E_ITEM_IRON_PICKAXE) or
- (_ID == E_ITEM_IRON_SWORD) or
- (_ID == E_ITEM_IRON_HOE)
- )
- then
- _item_hp = 251
- _do_fix = true
- end
-
- if (
- (_ID == E_ITEM_GOLD_SHOVEL) or
- (_ID == E_ITEM_GOLD_AXE) or
- (_ID == E_ITEM_GOLD_PICKAXE) or
- (_ID == E_ITEM_GOLD_SWORD) or
- (_ID == E_ITEM_GOLD_HOE)
- )
- then
- _item_hp = 33
- _do_fix = true
- end
-
- if (
- (_ID == E_ITEM_DIAMOND_SHOVEL) or
- (_ID == E_ITEM_DIAMOND_AXE) or
- (_ID == E_ITEM_DIAMOND_PICKAXE) or
- (_ID == E_ITEM_DIAMOND_SWORD) or
- (_ID == E_ITEM_DIAMOND_HOE)
- )
- then
- _item_hp = 1562
- _do_fix = true
- end
-
- if (_ID == E_ITEM_LEATHER_CAP) then
- _item_hp = 56
- _do_fix = true
- end
- if (_ID == E_ITEM_LEATHER_TUNIC) then
- _item_hp = 82
- _do_fix = true
- end
- if (_ID == E_ITEM_LEATHER_PANTS) then
- _item_hp = 76
- _do_fix = true
- end
- if (_ID == E_ITEM_LEATHER_BOOTS) then
- _item_hp = 66
- _do_fix = true
- end
-
-
- if (_ID == E_ITEM_CHAIN_HELMET) then
- _item_hp = 78
- _do_fix = true
- end
- if (_ID == E_ITEM_CHAIN_CHESTPLATE) then
- _item_hp = 114
- _do_fix = true
- end
- if (_ID == E_ITEM_CHAIN_LEGGINGS) then
- _item_hp = 106
- _do_fix = true
- end
- if (_ID == E_ITEM_CHAIN_BOOTS) then
- _item_hp = 92
- _do_fix = true
- end
-
-
- if (_ID == E_ITEM_IRON_HELMET) then
- _item_hp = 166
- _do_fix = true
- end
- if (_ID == E_ITEM_IRON_CHESTPLATE) then
- _item_hp = 242
- _do_fix = true
- end
- if (_ID == E_ITEM_IRON_LEGGINGS) then
- _item_hp = 226
- _do_fix = true
- end
- if (_ID == E_ITEM_IRON_BOOTS) then
- _item_hp = 196
- _do_fix = true
- end
-
-
- if (_ID == E_ITEM_GOLD_HELMET) then
- _item_hp = 78
- _do_fix = true
- end
- if (_ID == E_ITEM_GOLD_CHESTPLATE) then
- _item_hp = 114
- _do_fix = true
- end
- if (_ID == E_ITEM_GOLD_LEGGINGS) then
- _item_hp = 106
- _do_fix = true
- end
- if (_ID == E_ITEM_GOLD_BOOTS) then
- _item_hp = 92
- _do_fix = true
- end
-
-
- if (_ID == E_ITEM_DIAMOND_HELMET) then
- _item_hp = 364
- _do_fix = true
- end
- if (_ID == E_ITEM_DIAMOND_CHESTPLATE)then
- _item_hp = 529
- _do_fix = true
- end
- if (_ID == E_ITEM_DIAMOND_LEGGINGS) then
- _item_hp = 496
- _do_fix = true
- end
- if (_ID == E_ITEM_DIAMOND_BOOTS) then
- _item_hp = 430
- _do_fix = true
- end
- -- /////////////////////////////////////////////////////
-
- if (_do_fix == true) then
- local _hp = _most_hp - (_item_hp - _least_hp) - _item_hp * BONUS
- _hp = math.max(_hp, 0)
- Recipe:SetResult(_ID, 1, _hp)
- Recipe:SetIngredient(Items[1].x, Items[1].y, Items[1]);
- Recipe:SetIngredient(Items[2].x, Items[2].y, Items[2]);
- return true
- end
- return false
-end
-
-
-
-
+-- Based on Fixies plugin v2 by Taugeshtu
+-- how much "extra" points are healed per a repair operation (fraction of full health)
+BONUS = 0.1
+
+function OnCraftingNoRecipe(Player, Grid, Recipe)
+ local _do_fix = false
+ local Items = {}
+ for x = 0, Grid:GetWidth() - 1 do
+ for y = 0, Grid:GetHeight() - 1 do
+ local Item = Grid:GetItem(x, y)
+ if (Item.m_ItemType ~= E_ITEM_EMPTY) then
+ table.insert(Items, Item)
+ end
+ end
+ end
+
+ if (#Items ~= 2) then
+ -- Only two items together can be fixed
+ return false
+ end
+
+ if (Items[1].m_ItemType ~= Items[2].m_ItemType) then
+ -- Only items of the same type may be fixed
+ return false
+ end
+
+ if (
+ (Items[1].m_ItemDamage == 0) or
+ (Items[2].m_ItemDamage == 0)
+ )
+ then
+ -- Only damaged items may be fixed
+ return false
+ end
+
+ local _ID = Items[1].m_ItemType
+ local _least_hp = math.max(Items[1].m_ItemDamage, Items[2].m_ItemDamage)
+ local _most_hp = math.min(Items[1].m_ItemDamage, Items[2].m_ItemDamage)
+ local _item_hp = 0
+
+ -- TODO: This could be refactored into better code, using an _ID-indexed table for _item_hp
+
+ if (
+ (_ID == E_ITEM_WOODEN_SHOVEL) or
+ (_ID == E_ITEM_WOODEN_AXE) or
+ (_ID == E_ITEM_WOODEN_PICKAXE) or
+ (_ID == E_ITEM_WOODEN_SWORD) or
+ (_ID == E_ITEM_WOODEN_HOE)
+ )
+ then
+ _item_hp = 60
+ _do_fix = true
+ end
+
+ if (
+ (_ID == E_ITEM_STONE_SHOVEL) or
+ (_ID == E_ITEM_STONE_AXE) or
+ (_ID == E_ITEM_STONE_PICKAXE) or
+ (_ID == E_ITEM_STONE_SWORD) or
+ (_ID == E_ITEM_STONE_HOE)
+ )
+ then
+ _item_hp = 132
+ _do_fix = true
+ end
+
+ if (
+ (_ID == E_ITEM_IRON_SHOVEL) or
+ (_ID == E_ITEM_IRON_AXE) or
+ (_ID == E_ITEM_IRON_PICKAXE) or
+ (_ID == E_ITEM_IRON_SWORD) or
+ (_ID == E_ITEM_IRON_HOE)
+ )
+ then
+ _item_hp = 251
+ _do_fix = true
+ end
+
+ if (
+ (_ID == E_ITEM_GOLD_SHOVEL) or
+ (_ID == E_ITEM_GOLD_AXE) or
+ (_ID == E_ITEM_GOLD_PICKAXE) or
+ (_ID == E_ITEM_GOLD_SWORD) or
+ (_ID == E_ITEM_GOLD_HOE)
+ )
+ then
+ _item_hp = 33
+ _do_fix = true
+ end
+
+ if (
+ (_ID == E_ITEM_DIAMOND_SHOVEL) or
+ (_ID == E_ITEM_DIAMOND_AXE) or
+ (_ID == E_ITEM_DIAMOND_PICKAXE) or
+ (_ID == E_ITEM_DIAMOND_SWORD) or
+ (_ID == E_ITEM_DIAMOND_HOE)
+ )
+ then
+ _item_hp = 1562
+ _do_fix = true
+ end
+
+ if (_ID == E_ITEM_LEATHER_CAP) then
+ _item_hp = 56
+ _do_fix = true
+ end
+ if (_ID == E_ITEM_LEATHER_TUNIC) then
+ _item_hp = 82
+ _do_fix = true
+ end
+ if (_ID == E_ITEM_LEATHER_PANTS) then
+ _item_hp = 76
+ _do_fix = true
+ end
+ if (_ID == E_ITEM_LEATHER_BOOTS) then
+ _item_hp = 66
+ _do_fix = true
+ end
+
+
+ if (_ID == E_ITEM_CHAIN_HELMET) then
+ _item_hp = 78
+ _do_fix = true
+ end
+ if (_ID == E_ITEM_CHAIN_CHESTPLATE) then
+ _item_hp = 114
+ _do_fix = true
+ end
+ if (_ID == E_ITEM_CHAIN_LEGGINGS) then
+ _item_hp = 106
+ _do_fix = true
+ end
+ if (_ID == E_ITEM_CHAIN_BOOTS) then
+ _item_hp = 92
+ _do_fix = true
+ end
+
+
+ if (_ID == E_ITEM_IRON_HELMET) then
+ _item_hp = 166
+ _do_fix = true
+ end
+ if (_ID == E_ITEM_IRON_CHESTPLATE) then
+ _item_hp = 242
+ _do_fix = true
+ end
+ if (_ID == E_ITEM_IRON_LEGGINGS) then
+ _item_hp = 226
+ _do_fix = true
+ end
+ if (_ID == E_ITEM_IRON_BOOTS) then
+ _item_hp = 196
+ _do_fix = true
+ end
+
+
+ if (_ID == E_ITEM_GOLD_HELMET) then
+ _item_hp = 78
+ _do_fix = true
+ end
+ if (_ID == E_ITEM_GOLD_CHESTPLATE) then
+ _item_hp = 114
+ _do_fix = true
+ end
+ if (_ID == E_ITEM_GOLD_LEGGINGS) then
+ _item_hp = 106
+ _do_fix = true
+ end
+ if (_ID == E_ITEM_GOLD_BOOTS) then
+ _item_hp = 92
+ _do_fix = true
+ end
+
+
+ if (_ID == E_ITEM_DIAMOND_HELMET) then
+ _item_hp = 364
+ _do_fix = true
+ end
+ if (_ID == E_ITEM_DIAMOND_CHESTPLATE)then
+ _item_hp = 529
+ _do_fix = true
+ end
+ if (_ID == E_ITEM_DIAMOND_LEGGINGS) then
+ _item_hp = 496
+ _do_fix = true
+ end
+ if (_ID == E_ITEM_DIAMOND_BOOTS) then
+ _item_hp = 430
+ _do_fix = true
+ end
+ -- /////////////////////////////////////////////////////
+
+ if (_do_fix == true) then
+ local _hp = _most_hp - (_item_hp - _least_hp) - _item_hp * BONUS
+ _hp = math.max(_hp, 0)
+ Recipe:SetResult(_ID, 1, _hp)
+ Recipe:SetIngredient(Items[1].x, Items[1].y, Items[1]);
+ Recipe:SetIngredient(Items[2].x, Items[2].y, Items[2]);
+ return true
+ end
+ return false
+end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/kick.lua b/MCServer/Plugins/Core/kick.lua
index 4091fd701..c396f9232 100644
--- a/MCServer/Plugins/Core/kick.lua
+++ b/MCServer/Plugins/Core/kick.lua
@@ -1,46 +1,42 @@
-function HandleKickCommand( Split, Player )
- if( #Split < 2 ) then
- Player:SendMessage( cChatColor.Green .. "Usage: /kick [Player] <Reason>" )
- return true
- end
-
- local Reason = "You have been kicked"
- if( #Split > 2 ) then
- Reason = table.concat(Split, " ", 3)
- end
-
- if( KickPlayer( Split[2], Reason ) == false ) then
- Player:SendMessage( cChatColor.Green .. "Could not find player " .. Split[2] )
- end
-
- return true
-end
-
-
-
-
-
---- Kicks a player by name, with the specified reason; returns bool whether found and player's real name
-function KickPlayer(PlayerName, Reason)
- local RealName = "";
- if (Reason == nil) then
- Reason = "You have been kicked";
- end
-
- local FoundPlayerCallback = function(a_Player)
- RealName = a_Player:GetName()
-
- local Server = cRoot:Get():GetServer()
- LOGINFO( "'" .. RealName .. "' is being kicked for ( "..Reason..") " )
- Server:SendMessage("Kicking " .. RealName)
-
- a_Player:GetClientHandle():Kick(Reason);
- end
-
- if (not(cRoot:Get():FindAndDoWithPlayer( PlayerName, FoundPlayerCallback))) then
- -- Could not find player
- return false;
- end
-
- return true, RealName; -- Player has been kicked
+function HandleKickCommand( Split, Player )
+ if( #Split < 2 ) then
+ Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /kick [Player] <Reason>" )
+ return true
+ end
+
+ local Reason = "You have been kicked"
+ if( #Split > 2 ) then
+ Reason = table.concat(Split, " ", 3)
+ end
+
+ if( KickPlayer( Split[2], Reason ) == false ) then
+ Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Could not find player " .. Split[2] )
+ end
+
+ return true
+end
+
+--- Kicks a player by name, with the specified reason; returns bool whether found and player's real name
+function KickPlayer(PlayerName, Reason)
+ local RealName = "";
+ if (Reason == nil) then
+ Reason = "You have been kicked";
+ end
+
+ local FoundPlayerCallback = function(a_Player)
+ RealName = a_Player:GetName()
+
+ local Server = cRoot:Get():GetServer()
+ LOGINFO( "'" .. RealName .. "' is being kicked for ( "..Reason..") " )
+ Server:SendMessage("Kicking " .. RealName)
+
+ a_Player:GetClientHandle():Kick(Reason);
+ end
+
+ if (not(cRoot:Get():FindAndDoWithPlayer( PlayerName, FoundPlayerCallback))) then
+ -- Could not find player
+ return false;
+ end
+
+ return true, RealName; -- Player has been kicked
end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/listgroups.lua b/MCServer/Plugins/Core/listgroups.lua
deleted file mode 100644
index 531b46463..000000000
--- a/MCServer/Plugins/Core/listgroups.lua
+++ /dev/null
@@ -1,14 +0,0 @@
-function HandleListGroupsCommand( Split, Player )
- local GroupsIni = cIniFile("groups.ini")
- if GroupsIni:ReadFile() == false then
- Player:SendMessage( cChatColor.Green .. "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, ", " ) )
- return true
-end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/listworlds.lua b/MCServer/Plugins/Core/listworlds.lua
deleted file mode 100644
index 753345426..000000000
--- a/MCServer/Plugins/Core/listworlds.lua
+++ /dev/null
@@ -1,20 +0,0 @@
-function HandleListWorldsCommand( Split, Player )
- local SettingsIni = cIniFile("settings.ini")
- if SettingsIni:ReadFile() == false then
- Player:SendMessage( cChatColor.Green .. "No worlds found" )
- end
- Number = SettingsIni:NumValues("Worlds") - 1
- Worlds = {}
- for i=0, SettingsIni:GetNumKeys() - 1 do
- if SettingsIni:GetKeyName(i) == "Worlds" then
- Key = i
- break
- end
- end
- 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, ", " ) )
- return true
-end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/locate.lua b/MCServer/Plugins/Core/locate.lua
new file mode 100644
index 000000000..9e0b50d8b
--- /dev/null
+++ b/MCServer/Plugins/Core/locate.lua
@@ -0,0 +1,4 @@
+function HandleLocateCommand( Split, Player )
+ 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 \ No newline at end of file
diff --git a/MCServer/Plugins/Core/main.lua b/MCServer/Plugins/Core/main.lua
index 7558a5e6f..3fd9c6585 100644
--- a/MCServer/Plugins/Core/main.lua
+++ b/MCServer/Plugins/Core/main.lua
@@ -1,129 +1,181 @@
----- Some settings -----
-SHOW_PLUGIN_NAMES = true -- If true, plugin name will be shown before commands
- -- This is overwritten in the Initialize() function
-------------------------
-
--- Global variables
-PLUGIN = {} -- Reference to own plugin object
-BannedPlayersIni = {}
-WhiteListIni = {}
-BackCoords = {}
-Messages = {}
-LimitWorldsCuboid = {}
-
-
-
-
-function Initialize(Plugin)
- PLUGIN = Plugin
-
- Plugin:SetName("Core")
- Plugin:SetVersion(13)
-
- PluginManager = cRoot:Get():GetPluginManager()
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_JOINED)
- 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)
-
- PluginManager:BindCommand("/listworlds", "core.listworlds", HandleListWorldsCommand, " - Shows a list of all the worlds");
- PluginManager:BindCommand("/listgroups", "core.listgroups", HandleListGroupsCommand, " - Shows a list of all the groups");
- PluginManager:BindCommand("/toggledownfall", "core.toggledownfall", HandleToggleDownfallCommand, " - Toggles the weather");
- PluginManager:BindCommand("/back", "core.back", HandleBackCommand, " - Return to your last position");
- PluginManager:BindCommand("/save-all", "core.save-all", HandleSaveAllCommand, " - Saves all your worlds");
- PluginManager:BindCommand("/help", "core.help", HandleHelpCommand, " [Page] - Show available commands");
- PluginManager:BindCommand("/rank", "core.rank", HandleRankCommand, " [Player] [Rank] - to add someone to a group");
- PluginManager:BindCommand("/pluginlist", "core.pluginlist", HandlePluginListCommand, " - Show list of plugins");
- PluginManager:BindCommand("/tp", "core.teleport", HandleTPCommand, " [Player] - Teleport yourself to a player");
- PluginManager:BindCommand("/item", "core.item", HandleItemCommand, " [ItemType/Name] <Amount> - Give yourself an item");
- PluginManager:BindCommand("/i", "core.item", HandleItemCommand, "");
- PluginManager:BindCommand("/list", "core.playerlist", HandlePlayerListCommand, " - Shows list of connected players");
- PluginManager:BindCommand("/who", "core.playerlist", HandlePlayerListCommand, " - Shows list of connected players");
- PluginManager:BindCommand("/playerlist", "core.playerlist", HandlePlayerListCommand, " - Shows list of connected players");
- PluginManager:BindCommand("/motd", "core.motd", HandleMOTDCommand, " - Show message of the day");
- PluginManager:BindCommand("/reload", "core.reload", HandleReloadCommand, " - Reload all plugins");
- PluginManager:BindCommand("/stop", "core.stop", HandleStopCommand, " - Stops the server");
- PluginManager:BindCommand("/time", "core.time", HandleTimeCommand, " [Day/Night] - Sets the time of day");
- PluginManager:BindCommand("/spawn", "core.spawn", HandleSpawnCommand, " - Return to the spawn");
- PluginManager:BindCommand("/kick", "core.kick", HandleKickCommand, " [Player] - Kick a player");
- PluginManager:BindCommand("/ban", "core.ban", HandleBanCommand, " [Player] - Ban a player");
- PluginManager:BindCommand("/unban", "core.unban", HandleUnbanCommand, " [Player] - Unban a player");
- PluginManager:BindCommand("/top", "core.top", HandleTopCommand, " - Teleport yourself to the top most block");
- PluginManager:BindCommand("/gm", "core.changegm", HandleChangeGMCommand, " [0|1] - Change your gamemode");
- PluginManager:BindCommand("/gotoworld", "core.gotoworld", HandleGotoWorldCommand, " [WorldName] - Move to a different world!");
- PluginManager:BindCommand("/coords", "core.coords", HandleCoordsCommand, " - Show your current server coordinates");
- PluginManager:BindCommand("/regeneratechunk", "core.regeneratechunk", HandleRegenerateChunkCommand, " <[X] [Z]> - Regenerates a chunk, current or specified");
- PluginManager:BindCommand("/viewdistance", "core.viewdistance", HandleViewDistanceCommand, " [".. cClientHandle.MIN_VIEW_DISTANCE .."-".. cClientHandle.MAX_VIEW_DISTANCE .."] - Change your view distance")
-
- InitConsoleCommands();
-
- -- Load the settings
- IniFile = cIniFile("Settings.ini")
- if ( IniFile:ReadFile() == true ) then
- HardCore = IniFile:GetValueSet("GameMode", "Hardcore", "false")
- LimitWorld = IniFile:GetValueSetB("Worlds", "LimitWorld", true)
- LimitWorldWidth = IniFile:GetValueSetI("Worlds", "LimitWorldWidth", 10)
- SHOW_PLUGIN_NAMES = IniFile:GetValueSetB("HelpPlugin", "ShowPluginNames", true )
- IniFile:WriteFile()
- end
-
- 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
- )
- -- Load whitelist, and add default values and stuff
- WhiteListIni = cIniFile( Plugin:GetLocalDirectory() .. "/whitelist.ini" )
- if ( WhiteListIni:ReadFile() == true ) then
- if( WhiteListIni:GetValueB("WhiteListSettings", "WhiteListOn", false) == true ) then
- if( WhiteListIni:GetNumValues("WhiteList") > 0 ) then
- LOGINFO("Core: loaded " .. WhiteListIni:GetNumValues('WhiteList') .. " whitelisted players.")
- else
- LOGWARN("WARNING: WhiteList is on, but there are no people in the whitelist!")
- end
- end
- else
- WhiteListIni:SetValueB("WhiteListSettings", "WhiteListOn", false )
- WhiteListIni:SetValue("WhiteList", "", "") -- So it adds an empty header
- WhiteListIni:DeleteValue("WhiteList", "") -- And remove the value
- WhiteListIni:KeyComment("WhiteList", "PlayerName=1")
- if( WhiteListIni:WriteFile() == false ) then
- LOGWARN("WARNING: Could not write to whitelist.ini")
- end
- end
-
- -- Load banned players, and add default values and stuff
- BannedPlayersIni = cIniFile( Plugin:GetLocalDirectory() .. "/banned.ini" )
- if ( BannedPlayersIni:ReadFile() == true ) then
- if( BannedPlayersIni:GetNumValues("Banned") > 0 ) then
- LOGINFO("Core: loaded " .. BannedPlayersIni:GetNumValues("Banned") .. " banned players.")
- end
- else
- BannedPlayersIni:SetValue("Banned", "", "") -- So it adds an empty header
- BannedPlayersIni:DeleteValue("Banned", "") -- And remove the value
- BannedPlayersIni:KeyComment("Banned", "PlayerName=1")
- if( BannedPlayersIni:WriteFile() == false ) then
- LOGWARN("WARNING: Could not write to banned.ini")
- end
- end
-
- Plugin:AddWebTab("Manage Server", HandleRequest_ManageServer);
- Plugin:AddWebTab("Server Settings", HandleRequest_ServerSettings);
- Plugin:AddWebTab("Chat", HandleRequest_Chat);
- Plugin:AddWebTab("Playerlist", HandleRequest_PlayerList);
- Plugin:AddWebTab("Whitelist", HandleRequest_WhiteList);
- Plugin:AddWebTab("Permissions", HandleRequest_Permissions);
- Plugin:AddWebTab("Manage Plugins", HandleRequest_ManagePlugins);
-
- LoadMotd()
- LOG( "Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion() )
- return true
-end \ No newline at end of file
+--COMMENCE VARIABLES
+PLUGIN = {}
+BannedPlayersIni = {}
+WhiteListIni = {}
+BackCoords = {}
+Messages = {}
+--END VARIABLES
+
+--COMMENCE AWESOMENESS!
+function Initialize(Plugin)
+ PLUGIN = Plugin
+
+ Plugin:SetName("Core")
+ Plugin:SetVersion(13)
+
+ --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_PLAYER_MOVING)
+
+ --PLEASE ALPHA SORT http://elmosaukko.com/sort-alphabetically/ THIS LIST
+ --BIND COMMANDS
+ PluginManager:BindCommand("/back", "core.back", HandleBackCommand, " - Return to your last position");
+ PluginManager:BindCommand("/ban", "core.ban", HandleBanCommand, " ~ Ban a player");
+ PluginManager:BindCommand("/give", "core.give", HandleGiveCommand, " ~ Give yourself an item");
+ PluginManager:BindCommand("/gm", "core.changegm", HandleChangeGMCommand, " ~ Change your gamemode");
+ PluginManager:BindCommand("/help", "core.help", HandleHelpCommand, " ~ Show available commands");
+ PluginManager:BindCommand("/kick", "core.kick", HandleKickCommand, " ~ Kick a player");
+ 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("/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");
+ PluginManager:BindCommand("/regen", "core.regen", HandleRegenCommand, " ~ Regenerates a chunk, current or specified");
+ PluginManager:BindCommand("/reload", "core.reload", HandleReloadCommand, " - Reload all plugins");
+ PluginManager:BindCommand("/save-all", "core.save-all", HandleSaveAllCommand, " - Saves all your worlds");
+ 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("/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");
+ PluginManager:BindCommand("/tpa", "core.teleport", HandleTPACommand, " ~ Ask to teleport yourself to a player");
+ PluginManager:BindCommand("/tpaccept", "core.teleport", HandleTPAcceptCommand, " ~ Accept a teleportation request");
+ PluginManager:BindCommand("/unban", "core.unban", HandleUnbanCommand, " ~ Unban a player");
+ PluginManager:BindCommand("/viewdistance", "core.viewdistance", HandleViewDistanceCommand, " [".. cClientHandle.MIN_VIEW_DISTANCE .."-".. cClientHandle.MAX_VIEW_DISTANCE .."] - Change your view distance")
+ PluginManager:BindCommand("/worlds", "core.worlds", HandleWorldsCommand, " - Shows a list of all the worlds");
+
+ InitConsoleCommands();
+
+ --LOAD SETTINGS
+ IniFile = cIniFile("settings.ini")
+ if ( IniFile:ReadFile() == true ) then
+ HardCore = IniFile:GetValueSet("GameMode", "Hardcore", "false")
+ IniFile:WriteFile()
+ end
+
+ WorldsSpawnProtect = {}
+ local KeyIdx = IniFile:FindKey("Worlds") --(FIND WHERE 'WORLDS' KEY IS LOCATED)
+ local NumValues = (IniFile:GetNumValues( KeyIdx )) --(HOW MANY VALUES ARE THERE?)
+ for i = 0, NumValues - 1 do --(FOR EVERY WORLD KEY, TAKING ACCOUNT OF OFF BY ONE ERRORS)
+ WorldIni = cIniFile(IniFile:GetValue(KeyIdx, i) .. "/world.ini")
+ if WorldIni:ReadFile() == true then
+ WorldsSpawnProtect[IniFile:GetValue(KeyIdx, i)] = WorldIni:GetValueSetI("SpawnProtect", "ProtectRadius", 10)
+ WorldIni:WriteFile()
+ end
+ end
+ WorldsWorldLimit = {}
+ local KeyIdx = IniFile:FindKey("Worlds") --(FIND WHERE 'WORLDS' KEY IS LOCATED)
+ local NumValues = (IniFile:GetNumValues( KeyIdx )) --(HOW MANY VALUES ARE THERE?)
+ for i = 0, NumValues - 1 do --(FOR EVERY WORLD KEY, TAKING ACCOUNT OF OFF BY ONE ERRORS)
+ WorldIni = cIniFile(IniFile:GetValue(KeyIdx, i) .. "/world.ini")
+ if WorldIni:ReadFile() == true then
+ WorldsWorldLimit[IniFile:GetValue(KeyIdx, i)] = WorldIni:GetValueSetI("WorldLimit", "LimitRadius", 0)
+ WorldIni:WriteFile()
+ end
+ end
+
+ --LOAD WHITELIST
+ WhiteListIni = cIniFile( Plugin:GetLocalDirectory() .. "/whitelist.ini" )
+ if ( WhiteListIni:ReadFile() == true ) then
+ if( WhiteListIni:GetValueB("WhiteListSettings", "WhiteListOn", false) == true ) then
+ if( WhiteListIni:GetNumValues("WhiteList") > 0 ) then
+ LOGINFO("Core: loaded " .. WhiteListIni:GetNumValues('WhiteList') .. " whitelisted players.")
+ else
+ LOGWARN("WARNING: WhiteList is on, but there are no people in the whitelist!")
+ end
+ end
+ else
+ WhiteListIni:SetValueB("WhiteListSettings", "WhiteListOn", false )
+ WhiteListIni:SetValue("WhiteList", "", "") -- So it adds an empty header
+ WhiteListIni:DeleteValue("WhiteList", "") -- And remove the value
+ WhiteListIni:KeyComment("WhiteList", "PlayerName=1")
+ if( WhiteListIni:WriteFile() == false ) then
+ LOGWARN("WARNING: Could not write to whitelist.ini")
+ end
+ end
+
+ --LOAD BANNED (BAD LUCK, BRO)
+ BannedPlayersIni = cIniFile( Plugin:GetLocalDirectory() .. "/banned.ini" )
+ if ( BannedPlayersIni:ReadFile() == true ) then
+ if( BannedPlayersIni:GetNumValues("Banned") > 0 ) then
+ LOGINFO("Core: loaded " .. BannedPlayersIni:GetNumValues("Banned") .. " banned players.")
+ end
+ else
+ BannedPlayersIni:SetValue("Banned", "", "") -- So it adds an empty header
+ BannedPlayersIni:DeleteValue("Banned", "") -- And remove the value
+ BannedPlayersIni:KeyComment("Banned", "PlayerName=1")
+ if( BannedPlayersIni:WriteFile() == false ) then
+ LOGWARN("WARNING: Could not write to banned.ini")
+ end
+ end
+
+ --ADD WEB INTERFACE TABULATES
+ Plugin:AddWebTab("Manage Server", HandleRequest_ManageServer);
+ Plugin:AddWebTab("Server Settings", HandleRequest_ServerSettings);
+ Plugin:AddWebTab("Chat", HandleRequest_Chat);
+ Plugin:AddWebTab("Playerlist", HandleRequest_PlayerList);
+ Plugin:AddWebTab("Whitelist", HandleRequest_WhiteList);
+ Plugin:AddWebTab("Permissions", HandleRequest_Permissions);
+ Plugin:AddWebTab("Manage Plugins", HandleRequest_ManagePlugins);
+
+ LoadMotd()
+ LOG( "Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion() )
+
+ return true
+end
+--AWESOMENESS STILL GOING!
+
+--BEGIN SPAWNPROTECT LOGFILE CODE (COURTSEY OF BEARBIN)
+function WriteLog(breakPlace, X, Y, Z, player, id, meta)
+ local logText = {}
+
+ table.insert(logText, player)
+ table.insert(logText, " tried to ")
+
+ if breakPlace == 0 then
+ table.insert(logText, "break ")
+ else
+ table.insert(logText, "place ")
+ end
+
+
+ table.insert(logText, ItemToString(cItem(id, 1, meta)))
+ table.insert(logText, " at ")
+ table.insert(logText, tostring(X))
+ table.insert(logText, ", ")
+ table.insert(logText, tostring(Y))
+ table.insert(logText, ", ")
+ table.insert(logText, tostring(Z))
+ table.insert(logText, ".")
+
+ LOGINFO(table.concat(logText,''))
+
+ if LOGTOFILE then
+ local logFile = io.open( Plugin:GetLocalDirectory() .. '/blocks.log', 'a')
+ logFile:write(table.concat(logText,'').."\n")
+ logFile:close()
+ end
+
+ return
+end
+
+function WarnPlayer(Player)
+ Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Go further from spawn to build")
+ return
+end
+
+function OnDisable()
+ LOG( "Disabled Core!")
+end
+--END AWESOMENESS :'(
diff --git a/MCServer/Plugins/Core/me.lua b/MCServer/Plugins/Core/me.lua
new file mode 100644
index 000000000..783c15556
--- /dev/null
+++ b/MCServer/Plugins/Core/me.lua
@@ -0,0 +1,15 @@
+function HandleMeCommand( Split, Player )
+ table.remove(Split, 1);
+ local Message = "";
+ for i, Text in ipairs(Split) do
+ Message = Message .. " " .. Text;
+ end
+ if (Split[1] == nil) then
+ Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /me <action>")
+ return true
+ end
+ if (Split[1] ~= nil) then
+ cRoot:Get():GetServer():BroadcastChat(Player:GetName() .. "" .. Message);
+ return true
+ end
+end
diff --git a/MCServer/Plugins/Core/motd.lua b/MCServer/Plugins/Core/motd.lua
index 928e7ebb3..cbcad2b98 100644
--- a/MCServer/Plugins/Core/motd.lua
+++ b/MCServer/Plugins/Core/motd.lua
@@ -1,97 +1,88 @@
-function HandleMOTDCommand( Split, Player )
- ShowMOTDTo( Player )
- return true
-end
-
-
-
-
-function LoadMotd()
- local File = io.open("motd.txt", "r")
- -- Check if the file 'motd.txt' exists, else create it.
- if not File then
- CreateFile = io.open("motd.txt", "w")
- CreateFile:write("@6Welcome to the MCServer test server!\n@6http://www.mc-server.org/\n@6Type /help for all commands")
- CreateFile:close()
- else
- File:close()
- end
- for line in io.lines("motd.txt") do
- local TempMessage = line
- -- Do a for loop that goes to each char in the line.
- for I=1, string.len(TempMessage) do
- -- If the char is a '@' then check if the next char represents a color.
- if string.sub(TempMessage, I, I) == "@" then
- local Char = string.sub(TempMessage, I + 1, I + 1)
- local Color = ReturnColorFromChar(TempMessage, Char)
- -- If the next char represented a color then put the color in the string.
- if (Color ~= nil) then
- TempMessage = string.gsub(TempMessage, "@" .. Char, Color)
- end
- end
- end
- -- Add the message to the list of messages.
- Messages[#Messages + 1] = TempMessage
- 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
- return cChatColor.Black
- elseif char == "1" then
- return cChatColor.Navy
- elseif char == "2" then
- return cChatColor.Green
- elseif char == "3" then
- return cChatColor.Blue
- elseif char == "4" then
- return cChatColor.Red
- elseif char == "5" then
- return cChatColor.Purple
- elseif char == "6" then
- return cChatColor.Gold
- elseif char == "7" then
- return cChatColor.LightGray
- elseif char == "8" then
- return cChatColor.Gray
- elseif char == "9" then
- return cChatColor.DarkPurple
- elseif char == "a" then
- return cChatColor.LightGreen
- elseif char == "b" then
- return cChatColor.LightBlue
- elseif char == "c" then
- return cChatColor.Rose
- elseif char == "d" then
- return cChatColor.LightPurple
- elseif char == "e" then
- return cChatColor.Yellow
- elseif char == "f" then
- return cChatColor.White
- elseif char == "k" then
- return cChatColor.Random
- elseif char == "l" then
- return cChatColor.Bold
- elseif char == "m" then
- return cChatColor.Strikethrough
- elseif char == "n" then
- return cChatColor.Underlined
- elseif char == "o" then
- return cChatColor.Italic
- elseif char == "r" then
- return cChatColor.Plain
- end
+function HandleMOTDCommand( Split, Player )
+ ShowMOTDTo( Player )
+ return true
+end
+
+function LoadMotd()
+ local File = io.open("motd.txt", "r")
+ -- Check if the file 'motd.txt' exists, else create it.
+ if not File then
+ CreateFile = io.open("motd.txt", "w")
+ CreateFile:write("@6Welcome to the MCServer test server!\n@6http://www.mc-server.org/\n@6Type /help for all commands")
+ CreateFile:close()
+ else
+ File:close()
+ end
+ for line in io.lines("motd.txt") do
+ local TempMessage = line
+ -- Do a for loop that goes to each char in the line.
+ for I=1, string.len(TempMessage) do
+ -- If the char is a '@' then check if the next char represents a color.
+ if string.sub(TempMessage, I, I) == "@" then
+ local Char = string.sub(TempMessage, I + 1, I + 1)
+ local Color = ReturnColorFromChar(TempMessage, Char)
+ -- If the next char represented a color then put the color in the string.
+ if (Color ~= nil) then
+ TempMessage = string.gsub(TempMessage, "@" .. Char, Color)
+ end
+ end
+ end
+ -- Add the message to the list of messages.
+ Messages[#Messages + 1] = TempMessage
+ 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
+ return cChatColor.Black
+ elseif char == "1" then
+ return cChatColor.Navy
+ elseif char == "2" then
+ return cChatColor.Green
+ elseif char == "3" then
+ return cChatColor.Blue
+ elseif char == "4" then
+ return cChatColor.Red
+ elseif char == "5" then
+ return cChatColor.Purple
+ elseif char == "6" then
+ return cChatColor.Gold
+ elseif char == "7" then
+ return cChatColor.LightGray
+ elseif char == "8" then
+ return cChatColor.Gray
+ elseif char == "9" then
+ return cChatColor.DarkPurple
+ elseif char == "a" then
+ return cChatColor.LightGreen
+ elseif char == "b" then
+ return cChatColor.LightBlue
+ elseif char == "c" then
+ return cChatColor.Rose
+ elseif char == "d" then
+ return cChatColor.LightPurple
+ elseif char == "e" then
+ return cChatColor.Yellow
+ elseif char == "f" then
+ return cChatColor.White
+ elseif char == "k" then
+ return cChatColor.Random
+ elseif char == "l" then
+ return cChatColor.Bold
+ elseif char == "m" then
+ return cChatColor.Strikethrough
+ elseif char == "n" then
+ return cChatColor.Underlined
+ elseif char == "o" then
+ return cChatColor.Italic
+ elseif char == "r" then
+ return cChatColor.Plain
+ end
end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/onbreakplaceblock.lua b/MCServer/Plugins/Core/onbreakplaceblock.lua
new file mode 100644
index 000000000..5eddc1511
--- /dev/null
+++ b/MCServer/Plugins/Core/onbreakplaceblock.lua
@@ -0,0 +1,119 @@
+function OnPlayerPlacingBlock(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ, BlockType)
+ -- Direction is air check
+ if (BlockFace == -1) then
+ return false
+ end
+
+ local PROTECTRADIUS = WorldsSpawnProtect[Player:GetWorld():GetName()];
+
+ if not (Player:HasPermission("core.build")) then
+ return true
+ else
+ if not (Player:HasPermission("core.spawnprotect.bypass")) and not (PROTECTRADIUS == 0) then
+ local World = Player:GetWorld()
+ local xcoord = World:GetSpawnX()
+ local ycoord = World:GetSpawnY()
+ local zcoord = World:GetSpawnZ()
+
+ if not ((BlockX <= (xcoord + PROTECTRADIUS)) and (BlockX >= (xcoord - PROTECTRADIUS))) then
+ return false -- Not in spawn area.
+ end
+ if not ((BlockY <= (ycoord + PROTECTRADIUS)) and (BlockY >= (ycoord - PROTECTRADIUS))) then
+ return false -- Not in spawn area.
+ end
+ if not ((BlockZ <= (zcoord + PROTECTRADIUS)) and (BlockZ >= (zcoord - PROTECTRADIUS))) then
+ return false -- Not in spawn area.
+ end
+
+ --WriteLog(1, BlockX, BlockY, BlockZ, Player:GetName(), id, meta)
+
+ WarnPlayer(Player)
+
+ return true
+ else
+ if BlockType == "50" or BlockType == "76" then
+ local X = BlockX
+ local Y = BlockY
+ local Z = BlockZ
+ X, Y, Z = AddFaceDirection(X, Y, Z, BlockFace)
+ if (Y >= 256 or Y < 0) then
+ return true
+ end
+
+ local CheckCollision = function(Player)
+ -- drop the decimals, we only care about the full block X,Y,Z
+ local PlayerX = math.floor(Player:GetPosX(), 0)
+ local PlayerY = math.floor(Player:GetPosY(), 0)
+ local PlayerZ = math.floor(Player:GetPosZ(), 0)
+
+ local collision = false
+ if ((BlockFace == BLOCK_FACE_TOP) and (PlayerY == BlockY - 2) and (PlayerX == BlockX) and (PlayerZ == BlockZ)) then
+ collision = true
+ end
+
+ if ((BlockFace == BLOCK_FACE_BOTTOM) and (PlayerY == BlockY + 1) and (PlayerX == BlockX) and (PlayerZ == BlockZ)) then
+ collision = true
+ end
+
+ if ((BlockFace == BLOCK_FACE_NORTH) and (PlayerX == BlockX) and (PlayerZ == BlockZ - 1)) then
+ if ((PlayerY == BlockY) or (PlayerY + 1 == BlockY)) then collision = true end
+ end
+
+ if ((BlockFace == BLOCK_FACE_SOUTH) and (PlayerX == BlockX) and (PlayerZ == BlockZ + 1)) then
+ if ((PlayerY == BlockY) or (PlayerY + 1 == BlockY)) then collision = true end
+ end
+
+ if ((BlockFace == BLOCK_FACE_WEST) and (PlayerX == BlockX - 1) and (PlayerZ == BlockZ)) then
+ if ((PlayerY == BlockY) or (PlayerY + 1 == BlockY)) then collision = true end
+ end
+
+ if ((BlockFace == BLOCK_FACE_EAST) and (PlayerX == BlockX + 1) and (PlayerZ == BlockZ)) then
+ if ((PlayerY == BlockY) or (PlayerY + 1 == BlockY)) then collision = true end
+ end
+ return collision
+ end
+ if (Player:GetWorld():ForEachPlayer(CheckCollision) == false) then
+ return true
+ end
+ end
+ end
+ end
+ return false
+end
+
+function OnPlayerBreakingBlock(Player, BlockX, BlockY, BlockZ, BlockFace, Status, OldBlockType, OldBlockMeta)
+ -- dont check if the direction is in the air
+ if (BlockFace ~= -1) then
+
+ local PROTECTRADIUS = WorldsSpawnProtect[Player:GetWorld():GetName()];
+
+ if not (Player:HasPermission("core.build")) then
+ return true
+ else
+ if not (Player:HasPermission("core.spawnprotect.bypass")) and not (PROTECTRADIUS == 0) then
+ local World = Player:GetWorld()
+ local xcoord = World:GetSpawnX()
+ local ycoord = World:GetSpawnY()
+ local zcoord = World:GetSpawnZ()
+
+ if not ((BlockX <= (xcoord + PROTECTRADIUS)) and (BlockX >= (xcoord - PROTECTRADIUS))) then
+ return false -- Not in spawn area.
+ end
+ if not ((BlockY <= (ycoord + PROTECTRADIUS)) and (BlockY >= (ycoord - PROTECTRADIUS))) then
+ return false -- Not in spawn area.
+ end
+ if not ((BlockZ <= (zcoord + PROTECTRADIUS)) and (BlockZ >= (zcoord - PROTECTRADIUS))) then
+ return false -- Not in spawn area.
+ end
+
+ --WriteLog(0, BlockX, BlockY, BlockZ, Player:GetName(), id, meta)
+
+ WarnPlayer(Player)
+
+ return true
+ end
+ end
+ end
+
+ return false
+end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/onchunkgenerating.lua b/MCServer/Plugins/Core/onchunkgenerating.lua
deleted file mode 100644
index 44a6cf298..000000000
--- a/MCServer/Plugins/Core/onchunkgenerating.lua
+++ /dev/null
@@ -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 \ No newline at end of file
diff --git a/MCServer/Plugins/Core/ondeath.lua b/MCServer/Plugins/Core/ondeath.lua
new file mode 100644
index 000000000..a5f8f6745
--- /dev/null
+++ b/MCServer/Plugins/Core/ondeath.lua
@@ -0,0 +1,65 @@
+function OnKilling(Victim, Killer)
+ if Victim:IsPlayer() then
+ SetBackCoordinates( Victim )
+ Server = cRoot:Get():GetServer()
+ if Killer == nil then
+ if Victim:GetWorld():GetBlock(Victim:GetPosX(), Victim:GetPosY(), Victim:GetPosZ()) == 10 or Victim:GetWorld():GetBlock(Victim:GetPosX(), Victim:GetPosY(), Victim:GetPosZ()) == 11 then
+ Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " tried to swim in lava (and failed)" )
+ CheckHardcore(Victim)
+ return false
+ end
+ 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 .. "[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 .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " was eaten by a zombie")
+ elseif Killer:IsA("cSkeleton") then
+ Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " was shot by a skeleton" )
+ elseif Killer:IsA("cCreeper") then
+ Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " was blown up by a creeper")
+ elseif Killer:IsA("cSpider") then
+ 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 .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " was poisoned by a giant cave spider")
+ elseif Killer:IsA("cBlaze") then
+ Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " was flamed by a blaze")
+ elseif Killer:IsA("cEnderman") then
+ Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " was " .. cChatColor.Random .. " by an enderman")
+ elseif Killer:IsA("cSilverfish") then
+ Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " encountered an unexpectedly fatal silverfish attack")
+ elseif Killer:IsA("cSlime") then
+ 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 .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " was enchanted (to death) by a witch")
+ elseif Killer:IsA("cZombiepigman") then
+ Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " was slain by a zombie pigman")
+ elseif Killer:IsA("cMagmacube") then
+ Server:SendMessage( cChatColor.Red .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " was incinerated by a magmacube")
+ elseif Killer:IsA("cWolf") then
+ 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 .. "[FATALITY] " .. cChatColor.White .. Victim:GetName() .. " died of mysterious circumstances")
+ CheckHardcore(Victim)
+ end
+end
+
+function CheckHardcore(Victim)
+ if HardCore == "true" then
+ if Victim:IsPlayer() == true then
+ local KilledPlayer = tolua.cast(Victim, "cPlayer")
+ BanPlayer(KilledPlayer:GetName(), "You died, haha. Good game, bro.")
+ end
+ end
+end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/onjoinleave.lua b/MCServer/Plugins/Core/onjoinleave.lua
new file mode 100644
index 000000000..7acef47de
--- /dev/null
+++ b/MCServer/Plugins/Core/onjoinleave.lua
@@ -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 \ No newline at end of file
diff --git a/MCServer/Plugins/Core/onkilling.lua b/MCServer/Plugins/Core/onkilling.lua
deleted file mode 100644
index e74f36065..000000000
--- a/MCServer/Plugins/Core/onkilling.lua
+++ /dev/null
@@ -1,65 +0,0 @@
-function OnKilling(Victim, Killer)
- if Victim:IsPlayer() then
- SetBackCoordinates( Victim )
- Server = cRoot:Get():GetServer()
- if Killer == nil then
- if Victim:IsOnFire() then
- Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " burned away." )
- 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" )
- CheckHardcore(Victim)
- return false
- end
- else
- if Killer:IsPlayer() then
- Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is killed by " .. Killer:GetName() )
- CheckHardcore(Victim)
- return false
- elseif Killer:IsMob() then
- if Killer:IsA("cZombie") then
- Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is eaten by a zombie")
- elseif Killer:IsA("cSkeleton") then
- Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is killed by a skeleton" )
- elseif Killer:IsA("cCreeper") then
- Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is blown up by a creeper")
- elseif Killer:IsA("cSpider") then
- Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is killed by a spider")
- elseif Killer:IsA("cCaveSpider") then
- Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is killed by a cavespider")
- elseif Killer:IsA("cBlaze") then
- Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is killed by a blaze")
- elseif Killer:IsA("cEnderman") then
- Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is slain by a enderman")
- elseif Killer:IsA("cSilverfish") then
- Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is killed by a silverfish")
- elseif Killer:IsA("cSlime") then
- Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is killed by a slime")
- elseif Killer:IsA("cWitch") then
- Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is killed by a witch")
- elseif Killer:IsA("cZombiepigman") then
- Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is slain by a zombiepigman")
- elseif Killer:IsA("cMagmacube") then
- Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is killed by a magmacube")
- elseif Killer:IsA("cWolf") then
- Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is killed by a wolf")
- end
- CheckHardcore(Victim)
- return false
- end
- end
- Server:SendMessage( cChatColor.Red .. Victim:GetName() .. " Died")
- CheckHardcore(Victim)
- end
-end
-
-function CheckHardcore(Victim)
- if HardCore == "true" then
- if Victim:IsPlayer() == true then
- local KilledPlayer = tolua.cast(Victim, "cPlayer")
- BanPlayer(KilledPlayer:GetName(), "You Died")
- end
- end
-end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/onlogin.lua b/MCServer/Plugins/Core/onlogin.lua
index 07b8460ee..cc79bb0ae 100644
--- a/MCServer/Plugins/Core/onlogin.lua
+++ b/MCServer/Plugins/Core/onlogin.lua
@@ -1,20 +1,19 @@
-function OnLogin(Client, ProtocolVersion, Username)
- if( Username ~= "" ) then
- if( BannedPlayersIni:GetValueB("Banned", Username, false) == true ) then
- local Server = cRoot:Get():GetServer()
- Server:SendMessage( Username .. " tried to join, but is banned!" )
- LOGINFO( Username .. " tried to join, but is banned!")
- return true -- Player is banned, return true to deny access
- end
- if( WhiteListIni:GetValueB("WhiteListSettings", "WhiteListOn", false ) == true ) then
- if( WhiteListIni:GetValueB("WhiteList", Username, false ) == false ) then -- not on whitelist
- local Server = cRoot:Get():GetServer()
- Server:SendMessage( Username .. " tried to join, but is not on the whitelist." )
- LOGINFO( Username .. " tried to join, but is not on the whitelist." )
- return true -- Deny access to the server
- end
- end
- end
-
- return false
+function OnLogin(Client, ProtocolVersion, Username)
+ if( Username ~= "" ) then
+ if( BannedPlayersIni:GetValueB("Banned", Username, false) == true ) then
+ local Server = cRoot:Get():GetServer()
+ Server:SendMessage( Username .. " tried to join, but is banned!" )
+ LOGINFO( Username .. " tried to join, but is banned!")
+ return true -- Player is banned, return true to deny access
+ end
+ if( WhiteListIni:GetValueB("WhiteListSettings", "WhiteListOn", false ) == true ) then
+ if( WhiteListIni:GetValueB("WhiteList", Username, false ) == false ) then -- not on whitelist
+ local Server = cRoot:Get():GetServer()
+ Server:SendMessage( Username .. " tried to join, but is not on the whitelist." )
+ LOGINFO( Username .. " tried to join, but is not on the whitelist." )
+ return true -- Deny access to the server
+ end
+ end
+ end
+ return false
end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/onplayerbreakingblock.lua b/MCServer/Plugins/Core/onplayerbreakingblock.lua
deleted file mode 100644
index fc7d5897d..000000000
--- a/MCServer/Plugins/Core/onplayerbreakingblock.lua
+++ /dev/null
@@ -1,10 +0,0 @@
-function OnPlayerBreakingBlock(Player, BlockX, BlockY, BlockZ, BlockFace, Status, OldBlockType, OldBlockMeta)
- -- dont check if the direction is in the air
- if (BlockFace ~= -1) then
-
- if (Player:HasPermission("core.build") == false) then
- return true
- end
- end
- return false
-end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/onplayerjoined.lua b/MCServer/Plugins/Core/onplayerjoined.lua
deleted file mode 100644
index 334307000..000000000
--- a/MCServer/Plugins/Core/onplayerjoined.lua
+++ /dev/null
@@ -1,5 +0,0 @@
-function OnPlayerJoined(Player)
- ShowMOTDTo( Player )
- AddMessage( Player:GetName() .. " has joined the game", " " )
- return false
-end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/onplayerplacingblock.lua b/MCServer/Plugins/Core/onplayerplacingblock.lua
deleted file mode 100644
index be2fd64d3..000000000
--- a/MCServer/Plugins/Core/onplayerplacingblock.lua
+++ /dev/null
@@ -1,63 +0,0 @@
-function OnPlayerPlacingBlock(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ, BlockType)
-
- -- dont check if the direction is in the air
- if (BlockFace == -1) then
- return false
- end
-
- if( Player:HasPermission("core.build") == false ) then
- return true
- end
-
- -- TODO: If the placed block is not a block (torch etc.), allow it without checking for collisions
-
- local X = BlockX
- local Y = BlockY
- local Z = BlockZ
- X, Y, Z = AddFaceDirection(X, Y, Z, BlockFace)
- if (Y >= 256 or Y < 0) then
- return true
- end
-
- local CheckCollision = function(Player)
- -- drop the decimals, we only care about the full block X,Y,Z
- local PlayerX = math.floor(Player:GetPosX(), 0)
- local PlayerY = math.floor(Player:GetPosY(), 0)
- local PlayerZ = math.floor(Player:GetPosZ(), 0)
-
- -- player height is 2 blocks, so we check the position and then offset it up one
- -- so they can't place a block in anyone's face
-
- local collision = false
- if ((BlockFace == BLOCK_FACE_TOP) and (PlayerY == BlockY - 2) and (PlayerX == BlockX) and (PlayerZ == BlockZ)) then
- collision = true
- end
-
- if ((BlockFace == BLOCK_FACE_BOTTOM) and (PlayerY == BlockY + 1) and (PlayerX == BlockX) and (PlayerZ == BlockZ)) then
- collision = true
- end
-
- if ((BlockFace == BLOCK_FACE_NORTH) and (PlayerX == BlockX) and (PlayerZ == BlockZ - 1)) then
- if ((PlayerY == BlockY) or (PlayerY + 1 == BlockY)) then collision = true end
- end
-
- if ((BlockFace == BLOCK_FACE_SOUTH) and (PlayerX == BlockX) and (PlayerZ == BlockZ + 1)) then
- if ((PlayerY == BlockY) or (PlayerY + 1 == BlockY)) then collision = true end
- end
-
- if ((BlockFace == BLOCK_FACE_WEST) and (PlayerX == BlockX - 1) and (PlayerZ == BlockZ)) then
- if ((PlayerY == BlockY) or (PlayerY + 1 == BlockY)) then collision = true end
- end
-
- if ((BlockFace == BLOCK_FACE_EAST) and (PlayerX == BlockX + 1) and (PlayerZ == BlockZ)) then
- if ((PlayerY == BlockY) or (PlayerY + 1 == BlockY)) then collision = true end
- end
-
- return collision
- end
-
- if (Player:GetWorld():ForEachPlayer(CheckCollision) == false) then
- return true
- end
- return false
-end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/playerlist.lua b/MCServer/Plugins/Core/playerlist.lua
deleted file mode 100644
index f06dfed85..000000000
--- a/MCServer/Plugins/Core/playerlist.lua
+++ /dev/null
@@ -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 \ No newline at end of file
diff --git a/MCServer/Plugins/Core/pluginlist.lua b/MCServer/Plugins/Core/plugins.lua
index 5f01c0339..66b6b4d90 100644
--- a/MCServer/Plugins/Core/pluginlist.lua
+++ b/MCServer/Plugins/Core/plugins.lua
@@ -1,15 +1,15 @@
-function HandlePluginListCommand( Split, Player )
- local PluginManager = cRoot:Get():GetPluginManager()
- local PluginList = PluginManager:GetAllPlugins()
-
- local PluginTable = {}
- for k, Plugin in pairs( PluginList ) do
- if ( Plugin ) then
- table.insert(PluginTable, Plugin:GetName() )
- end
- end
-
- Player:SendMessage( cChatColor.Green .. "Loaded plugins: (" .. #PluginTable .. ")" )
- Player:SendMessage( cChatColor.Gold .. table.concat(PluginTable, cChatColor.Gold.." ") )
- return true
+function HandlePluginsCommand( Split, Player )
+ local PluginManager = cRoot:Get():GetPluginManager()
+ local PluginList = PluginManager:GetAllPlugins()
+
+ local PluginTable = {}
+ for k, Plugin in pairs( PluginList ) do
+ if ( Plugin ) then
+ table.insert(PluginTable, Plugin:GetName() )
+ end
+ end
+
+ Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "There are " .. #PluginTable .. " loaded plugins")
+ Player:SendMessage(cChatColor.Gold .. table.concat(PluginTable, cChatColor.Gold.." ") )
+ return true
end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/portal-worlds.lua b/MCServer/Plugins/Core/portal-worlds.lua
new file mode 100644
index 000000000..da48f1637
--- /dev/null
+++ b/MCServer/Plugins/Core/portal-worlds.lua
@@ -0,0 +1,36 @@
+function HandlePortalCommand( Split, Player )
+ if( #Split ~= 2 ) then
+ Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /portal [WorldName]" )
+ return true
+ end
+
+ if( Player:MoveToWorld(Split[2]) == false ) then
+ Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Could not move to world " .. Split[2] .. "!" )
+ return true
+ end
+
+
+ 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.Yellow .. "[INFO] " .. cChatColor.White .. "No worlds found" )
+ end
+ Number = SettingsIni:NumValues("Worlds") - 1
+ Worlds = {}
+ for i=0, SettingsIni:GetNumKeys() - 1 do
+ if SettingsIni:GetKeyName(i) == "Worlds" then
+ Key = i
+ break
+ end
+ end
+ for i=0, Number do
+ table.insert( Worlds, SettingsIni:GetValue( Key, i) )
+ end
+ Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Found " .. #Worlds .. " worlds" )
+ Player:SendMessage(cChatColor.Gold .. table.concat( Worlds, ", " ) )
+ return true
+end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/rank-groups.lua b/MCServer/Plugins/Core/rank-groups.lua
new file mode 100644
index 000000000..bb7d2ae5c
--- /dev/null
+++ b/MCServer/Plugins/Core/rank-groups.lua
@@ -0,0 +1,48 @@
+function HandleRankCommand( Split, Player )
+ if Split[2] == nil or Split[3] == nil then
+ Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /rank [Player] [Group]")
+ return true
+ end
+ local GroupsIni = cIniFile("groups.ini")
+ if( GroupsIni:ReadFile() == false ) then
+ LOG("Could not read groups.ini!")
+ end
+ if GroupsIni:FindKey(Split[3]) == -1 then
+ Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Group does not exist")
+ return true
+ end
+ local UsersIni = cIniFile("users.ini")
+ if( UsersIni:ReadFile() == false ) then
+ LOG("Could not read users.ini!")
+ end
+ UsersIni:DeleteKey(Split[2])
+ UsersIni:GetValueSet(Split[2], "Groups", Split[3])
+ UsersIni:WriteFile()
+ local loopPlayers = function( Player )
+ if Player:GetName() == Split[2] then
+ Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "You were moved to group " .. Split[3] )
+ Player:LoadPermissionsFromDisk()
+ end
+ end
+ local loopWorlds = function ( World )
+ World:ForEachPlayer( loopPlayers )
+ end
+ cRoot:Get():ForEachWorld( loopWorlds )
+ Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Player " .. Split[2] .. " Was moved to " .. Split[3])
+ return true
+end
+
+function HandleGroupsCommand( Split, Player )
+ local GroupsIni = cIniFile("groups.ini")
+ if GroupsIni:ReadFile() == false then
+ 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.Yellow .. "[INFO] " .. cChatColor.White .. "Found " .. #Groups .. " groups" )
+ Player:SendMessage(cChatColor.Gold .. table.concat( Groups, " " ) )
+ return true
+end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/rank.lua b/MCServer/Plugins/Core/rank.lua
deleted file mode 100644
index e178f0a2b..000000000
--- a/MCServer/Plugins/Core/rank.lua
+++ /dev/null
@@ -1,33 +0,0 @@
-function HandleRankCommand( Split, Player )
- if Split[2] == nil or Split[3] == nil then
- Player:SendMessage(cChatColor.Rose .. "Usage: /rank [Player] [Group]")
- return true
- end
- local GroupsIni = cIniFile("groups.ini")
- if( GroupsIni:ReadFile() == false ) then
- LOG("Could not read groups.ini!")
- end
- if GroupsIni:FindKey(Split[3]) == -1 then
- Player:SendMessage(cChatColor.Rose .. "Group does not exist")
- return true
- end
- local UsersIni = cIniFile("users.ini")
- if( UsersIni:ReadFile() == false ) then
- LOG("Could not read users.ini!")
- end
- UsersIni:DeleteKey(Split[2])
- UsersIni:GetValueSet(Split[2], "Groups", Split[3])
- UsersIni:WriteFile()
- local loopPlayers = function( Player )
- if Player:GetName() == Split[2] then
- Player:SendMessage( cChatColor.Green .. "You were moved to group " .. Split[3] )
- Player:LoadPermissionsFromDisk()
- end
- end
- local loopWorlds = function ( World )
- World:ForEachPlayer( loopPlayers )
- end
- cRoot:Get():ForEachWorld( loopWorlds )
- Player:SendMessage(cChatColor.Green .. "Player " .. Split[2] .. " Was moved to " .. Split[3])
- return true
-end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/regen.lua b/MCServer/Plugins/Core/regen.lua
new file mode 100644
index 000000000..176396734
--- /dev/null
+++ b/MCServer/Plugins/Core/regen.lua
@@ -0,0 +1,18 @@
+function HandleRegenCommand(Split, Player)
+ if ((#Split == 2) or (#Split > 3)) then
+ Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: '/regeneratechunk' or '/regeneratechunk [X] [Z]'");
+ return true;
+ end
+
+ local X = Player:GetChunkX();
+ local Z = Player:GetChunkZ();
+
+ if (#Split == 3) then
+ X = Split[2];
+ Z = Split[3];
+ end
+
+ Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Regenerating chunk ["..X..", "..Z.."]");
+ Player:GetWorld():RegenerateChunk(X, Z);
+ return true;
+end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/regeneratechunk.lua b/MCServer/Plugins/Core/regeneratechunk.lua
deleted file mode 100644
index 7f91f48c1..000000000
--- a/MCServer/Plugins/Core/regeneratechunk.lua
+++ /dev/null
@@ -1,18 +0,0 @@
-function HandleRegenerateChunkCommand(Split, Player)
- if ((#Split == 2) or (#Split > 3)) then
- Player:SendMessage( cChatColor.Green .. "Usage: '/regeneratechunk' or '/regeneratechunk [X] [Z]'");
- return true;
- end
-
- local X = Player:GetChunkX();
- local Z = Player:GetChunkZ();
-
- if (#Split == 3) then
- X = Split[2];
- Z = Split[3];
- end
-
- Player:SendMessage(cChatColor.Green .. "Regenerating chunk ["..X..", "..Z.."]");
- Player:GetWorld():RegenerateChunk(X, Z);
- return true;
-end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/reload.lua b/MCServer/Plugins/Core/reload.lua
deleted file mode 100644
index e2b338ba1..000000000
--- a/MCServer/Plugins/Core/reload.lua
+++ /dev/null
@@ -1,6 +0,0 @@
-function HandleReloadCommand( Split, Player )
- Server = cRoot:Get():GetServer()
- Server:SendMessage( cChatColor.Green .. "Reloading all plugins." )
- cRoot:Get():GetPluginManager():ReloadPlugins()
- return true
-end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/save-reload-stop.lua b/MCServer/Plugins/Core/save-reload-stop.lua
new file mode 100644
index 000000000..976052fc7
--- /dev/null
+++ b/MCServer/Plugins/Core/save-reload-stop.lua
@@ -0,0 +1,22 @@
+function HandleSaveAllCommand( Split, Player )
+ cRoot:Get():SaveAllChunks();
+ local Server = cRoot:Get():GetServer()
+ Server:SendMessage(cChatColor.Rose .. "[WARNING] " .. cChatColor.White .. "Saving all worlds!")
+ return true;
+end
+
+function HandleStopCommand( Split, Player )
+ Server = cRoot:Get():GetServer()
+ local Server = cRoot:Get():GetServer()
+ Server:SendMessage(cChatColor.Red .. "[WARNING] " .. cChatColor.White .. "Server is terminating!" )
+ cRoot:Get():QueueExecuteConsoleCommand("stop")
+ return true
+end
+
+function HandleReloadCommand( Split, Player )
+ Server = cRoot:Get():GetServer()
+ local Server = cRoot:Get():GetServer()
+ Server:SendMessage(cChatColor.Rose .. "[WARNING] " .. cChatColor.White .. "Reloading all plugins!" )
+ cRoot:Get():GetPluginManager():ReloadPlugins()
+ return true
+end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/saveall.lua b/MCServer/Plugins/Core/saveall.lua
deleted file mode 100644
index 1dd12335b..000000000
--- a/MCServer/Plugins/Core/saveall.lua
+++ /dev/null
@@ -1,5 +0,0 @@
-function HandleSaveAllCommand( Split, Player )
- cRoot:Get():SaveAllChunks();
- Player:SendMessage(cChatColor.Green .. "All the worlds are saved")
- return true;
-end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/spawn.lua b/MCServer/Plugins/Core/spawn.lua
index d4e033c7e..d1ef7399b 100644
--- a/MCServer/Plugins/Core/spawn.lua
+++ b/MCServer/Plugins/Core/spawn.lua
@@ -1,7 +1,7 @@
-function HandleSpawnCommand(Split, Player)
- World = Player:GetWorld()
- SetBackCoordinates(Player)
- Player:TeleportToCoords(World:GetSpawnX(), World:GetSpawnY(), World:GetSpawnZ())
- LOGINFO(Player:GetName() .. " returned to spawn.")
- return true
+function HandleSpawnCommand(Split, Player)
+ World = Player:GetWorld()
+ SetBackCoordinates(Player)
+ Player:TeleportToCoords(World:GetSpawnX(), World:GetSpawnY(), World:GetSpawnZ())
+ Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Returned to world spawn" )
+ return true
end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/stop.lua b/MCServer/Plugins/Core/stop.lua
deleted file mode 100644
index 1240c49d8..000000000
--- a/MCServer/Plugins/Core/stop.lua
+++ /dev/null
@@ -1,6 +0,0 @@
-function HandleStopCommand( Split, Player )
- Server = cRoot:Get():GetServer()
- Server:SendMessage( cChatColor.Green .. "Stopping the server..." )
- cRoot:Get():QueueExecuteConsoleCommand("stop")
- return true
-end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/teleport.lua b/MCServer/Plugins/Core/teleport.lua
index ad9e7be69..1e2cab6f7 100644
--- a/MCServer/Plugins/Core/teleport.lua
+++ b/MCServer/Plugins/Core/teleport.lua
@@ -1,46 +1,80 @@
-function HandleTPCommand(a_Split, a_Player)
- if ((#a_Split == 2) or (#a_Split == 3)) then
- -- Teleport to player specified in a_Split[2], tell them unless a_Split[3] equals "-h":
- TeleportToPlayer(a_Player, a_Split[2], (a_Split[3] ~= "-h"));
- return true;
- elseif (#a_Split == 4) then
- -- 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] .. "}");
- return true;
- else
- Player:SendMessage( cChatColor.Green .. "Usage: /tp [PlayerName] (-h)" )
- return true
- end
-end
-
-
-
-
-
--- Teleports a_SrcPlayer to a player named a_DstPlayerName; if a_TellDst is true, will send a notice to the destination player
-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 .. "Already there :)");
- else
- SetBackCoordinates(a_SrcPlayer);
- a_SrcPlayer:TeleportToEntity(OtherPlayer);
- a_SrcPlayer:SendMessage(cChatColor.Green .. "You teleported to " .. OtherPlayer:GetName() .. "!");
- if (a_TellDst) then
- OtherPlayer:SendMessage(cChatColor.Green .. Player:GetName().." teleported to you!");
- end
- end
- end
-
- local World = Player:GetWorld();
- if (not(World:DoWithPlayer(s_DstPlayerName, teleport))) then
- a_SrcPlayer:SendMessage(cChatColor.Green .. "Can't find player " .. a_DstPlayerName);
- end
-end
-
-
-
-
+function HandleTPCommand(a_Split, a_Player)
+ if ((#a_Split == 2) or (#a_Split == 3)) then
+ -- Teleport to player specified in a_Split[2], tell them unless a_Split[3] equals "-h":
+ TeleportToPlayer(a_Player, a_Split[2], (a_Split[3] ~= "-h"));
+ return true;
+ elseif (#a_Split == 4) then
+ -- 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 .. "[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.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.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /tpa [Player]" )
+ return true
+ end
+ local loopPlayer = function( OtherPlayer )
+ if OtherPlayer:GetName() == Split[2] then
+ OtherPlayer:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. Player:GetName() .. " send a teleport request" )
+ Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "You send a teleport request to " .. OtherPlayer:GetName() )
+ Destination[OtherPlayer:GetName()] = Player:GetName()
+ end
+ end
+ local loopWorlds = function( World )
+ World:ForEachPlayer( loopPlayer )
+ end
+ cRoot:Get():ForEachWorld( loopWorlds )
+ return true
+end
+
+function HandleTPAcceptCommand( Split, Player )
+ if Destination[Player:GetName()] == nil then
+ Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Nobody has send you a teleport request" )
+ return true
+ end
+ local loopPlayer = function( OtherPlayer )
+ if Destination[Player:GetName()] == OtherPlayer:GetName() then
+ if OtherPlayer:GetWorld():GetName() ~= Player:GetWorld():GetName() then
+ OtherPlayer:MoveToWorld( Player:GetWorld():GetName() )
+ end
+ OtherPlayer:TeleportToEntity( Player )
+ Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. OtherPlayer:GetName() .. " teleported to you" )
+ OtherPlayer:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "You teleported to " .. Player:GetName() )
+ Destination[Player:GetName()] = nil
+ end
+ end
+ local loopWorlds = function( World )
+ World:ForEachPlayer( loopPlayer )
+ end
+ cRoot:Get():ForEachWorld( loopWorlds )
+ return true
+end
+
+-- Teleports a_SrcPlayer to a player named a_DstPlayerName; if a_TellDst is true, will send a notice to the destination player
+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.Rose .. "[INFO] " .. cChatColor.White .. "Y' can't teleport to yerself!");
+ else
+ SetBackCoordinates(a_SrcPlayer);
+ a_SrcPlayer:TeleportToEntity(OtherPlayer);
+ a_SrcPlayer:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "You teleported to " .. OtherPlayer:GetName() .. "!");
+ if (a_TellDst) then
+ 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.Rose .. "[INFO] " .. cChatColor.White .. "Can't find player " .. a_DstPlayerName);
+ end
+end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/time.lua b/MCServer/Plugins/Core/time.lua
index 637773b45..b5d3c991a 100644
--- a/MCServer/Plugins/Core/time.lua
+++ b/MCServer/Plugins/Core/time.lua
@@ -1,23 +1,23 @@
-function HandleTimeCommand( Split, Player )
- if Split[2] == nil then
- Player:SendMessage( cChatColor.Green .. "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.")
- elseif( string.upper( Split[2] ) == "NIGHT") then
- Player:GetWorld():SetTimeOfDay( 12000 + 1000 )
- Server:SendMessage( cChatColor.Green .. Player:GetName() .. " set the time to Night.")
- 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] )
- 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" )
- else
- Player:SendMessage( cChatColor.Green .. "Usage: /time [Day/Night/Set/Add]" )
- end
- return true
+function HandleTimeCommand( Split, Player )
+ if Split[2] == nil then
+ 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 .. "[INFO] " .. cChatColor.White .. "Time was set to daytime" )
+ elseif( string.upper( Split[2] ) == "NIGHT") then
+ Player:GetWorld():SetTimeOfDay( 12000 + 1000 )
+ 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 .. "[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 .. "[INFO] " .. cChatColor.White .. Split[3] .. "Was added to the time" )
+ else
+ Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /time [Day/Night/Set/Add]" )
+ end
+ return true
end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/top.lua b/MCServer/Plugins/Core/top.lua
index 99bea5f75..916582543 100644
--- a/MCServer/Plugins/Core/top.lua
+++ b/MCServer/Plugins/Core/top.lua
@@ -1,11 +1,11 @@
-function HandleTopCommand( Split, Player )
- local World = Player:GetWorld()
-
- local PlayerPos = Player:GetPosition()
- 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")
-
- return true
+function HandleTopCommand( Split, Player )
+ local World = Player:GetWorld()
+
+ local PlayerPos = Player:GetPosition()
+ local Height = World:GetHeight( math.floor(PlayerPos.x), math.floor(PlayerPos.z) )
+ SetBackCoordinates( Player )
+ Player:TeleportToCoords( PlayerPos.x, Height+1, PlayerPos.z )
+ Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Teleported to the topmost block")
+
+ return true
end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/unban.lua b/MCServer/Plugins/Core/unban.lua
deleted file mode 100644
index 9defbe323..000000000
--- a/MCServer/Plugins/Core/unban.lua
+++ /dev/null
@@ -1,20 +0,0 @@
-function HandleUnbanCommand( Split, Player )
- if( #Split < 2 ) then
- Player:SendMessage( cChatColor.Green .. "Usage: /unban [Player]" )
- return true
- end
-
- if( BannedPlayersIni:GetValueB("Banned", Split[2], false) == false ) then
- Player:SendMessage( cChatColor.Green .. Split[2] .. " is not banned!" )
- return true
- end
-
- BannedPlayersIni:SetValueB("Banned", Split[2], false, false)
- BannedPlayersIni:WriteFile()
-
- local Server = cRoot:Get():GetServer()
- LOGINFO( Player:GetName() .. " is unbanning " .. Split[2] )
- Server:SendMessage( "Unbanning " .. Split[2] )
-
- return true
-end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/viewdistance.lua b/MCServer/Plugins/Core/viewdistance.lua
index 43d2a7de8..2cf96d8bc 100644
--- a/MCServer/Plugins/Core/viewdistance.lua
+++ b/MCServer/Plugins/Core/viewdistance.lua
@@ -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 .."]" )
- return true
- end
-
- Player:GetClientHandle():SetViewDistance( Split[2] )
- Player:SendMessage(cChatColor.Green .. "Your viewdistance has been set to " .. Player:GetClientHandle():GetViewDistance() )
- return true
+function HandleViewDistanceCommand( Split, Player )
+ if( #Split ~= 2 ) then
+ 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 .. "[INFO] " .. cChatColor.White .. "Your view distance has been set to " .. Player:GetClientHandle():GetViewDistance() )
+ return true
end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/weather.lua b/MCServer/Plugins/Core/weather.lua
index 49cbaa079..a03cad3ab 100644
--- a/MCServer/Plugins/Core/weather.lua
+++ b/MCServer/Plugins/Core/weather.lua
@@ -1,10 +1,10 @@
-function HandleToggleDownfallCommand( Split, Player )
- World = Player:GetWorld()
- if World:GetWeather() == 0 then
- World:SetWeather(1)
- else
- World:SetWeather(0)
- end
- Player:SendMessage( cChatColor.Green .. "Weather toggled")
- return true
+function HandleDownfallCommand( Split, Player )
+ World = Player:GetWorld()
+ if World:GetWeather() == 0 then
+ World:SetWeather(1)
+ else
+ World:SetWeather(0)
+ end
+ Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Downfall toggled")
+ return true
end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/web_chat.lua b/MCServer/Plugins/Core/web_chat.lua
index dd03203bd..dfb17091e 100644
--- a/MCServer/Plugins/Core/web_chat.lua
+++ b/MCServer/Plugins/Core/web_chat.lua
@@ -1,157 +1,157 @@
-local CHAT_HISTORY = 50
-local LastMessageID = 0
-
-local JavaScript = [[
- <script type="text/javascript">
- function createXHR()
- {
- var request = false;
- try {
- request = new ActiveXObject('Msxml2.XMLHTTP');
- }
- catch (err2) {
- try {
- request = new ActiveXObject('Microsoft.XMLHTTP');
- }
- catch (err3) {
- try {
- request = new XMLHttpRequest();
- }
- catch (err1) {
- request = false;
- }
- }
- }
- return request;
- }
-
- function OpenPage( url, postParams, callback )
- {
- var xhr = createXHR();
- xhr.onreadystatechange=function()
- {
- if (xhr.readyState == 4)
- {
- callback( xhr )
- }
- };
- xhr.open( (postParams!=null)?"POST":"GET", url , true);
- if( postParams != null )
- {
- xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
- }
- xhr.send(postParams);
- }
-
- function LoadPageInto( url, postParams, storage )
- {
- OpenPage( url, postParams, function( xhr )
- {
- var ScrollBottom = storage.scrollTop + storage.offsetHeight;
- var bAutoScroll = (ScrollBottom >= storage.scrollHeight); // Detect whether we scrolled to the bottom of the div
-
- results = xhr.responseText.split("<<divider>>");
- if( results[2] != LastMessageID ) return; // Check if this message was meant for us
-
- LastMessageID = results[1];
- if( results[0] != "" )
- {
- storage.innerHTML += results[0];
-
- if( bAutoScroll == true )
- {
- storage.scrollTop = storage.scrollHeight;
- }
- }
- } );
-
-
- return false;
- }
-
- function SendChatMessage()
- {
- var MessageContainer = document.getElementById('ChatMessage');
- if( MessageContainer.value == "" ) return;
-
- var postParams = "ChatMessage=" + MessageContainer.value;
- OpenPage( "/~webadmin/Core/Chat/", postParams, function( xhr )
- {
- RefreshChat();
- } );
- MessageContainer.value = "";
- }
-
- function RefreshChat()
- {
- var postParams = "JustChat=true&LastMessageID=" + LastMessageID;
- LoadPageInto("/~webadmin/Core/Chat/", postParams, document.getElementById('ChatDiv'));
- }
-
- setInterval(RefreshChat, 1000);
- window.onload = RefreshChat;
-
- var LastMessageID = 0;
-
- </script>
-]]
-
-local ChatLogMessages = {}
-
-function AddMessage( PlayerName, Message )
- LastMessageID = LastMessageID + 1
- table.insert( ChatLogMessages, { name = PlayerName, message = Message, id = LastMessageID } )
- while( #ChatLogMessages > CHAT_HISTORY ) do
- table.remove( ChatLogMessages, 1 )
- end
-end
-
-function OnChat( Player, Message )
- AddMessage( Player:GetName(), Message )
-end
-
-function HandleRequest_Chat( Request )
- if( Request.PostParams["JustChat"] ~= nil ) then
- local LastIdx = 0
- if( Request.PostParams["LastMessageID"] ~= nil ) then LastIdx = tonumber( Request.PostParams["LastMessageID"] ) end
- local Content = ""
- for key, value in pairs(ChatLogMessages) do
- if( value.id > LastIdx ) then
- Content = Content .. "[" .. value.name .. "]: " .. value.message .. "<br>"
- end
- end
- Content = Content .. "<<divider>>" .. LastMessageID .. "<<divider>>" .. LastIdx
- return Content
- end
-
- if( Request.PostParams["ChatMessage"] ~= nil ) then
- if( Request.PostParams["ChatMessage"] == "/help" ) then
- Commands = "Available commands"
- AddMessage(Commands, "<br>" .. "/help, /reload" )
- return Commands
- elseif( Request.PostParams["ChatMessage"] == "/reload" ) then
- Server = cRoot:Get():GetServer()
- Server:SendMessage( cChatColor.Green .. "Reloading all plugins." )
- AddMessage("Reloading all plugins", "")
- cRoot:Get():GetPluginManager():ReloadPlugins()
- return ""
- else
- cmd = Request.PostParams["ChatMessage"]
- if string.sub(cmd,1,string.len("/")) == "/" then
- AddMessage('Unknown Command "' .. Request.PostParams["ChatMessage"] .. '"', "")
- return ""
- end
- end
- local Message = "[WebAdmin]: " .. Request.PostParams["ChatMessage"]
- cRoot:Get():GetServer():SendMessage( Message )
- AddMessage("WebAdmin", Request.PostParams["ChatMessage"] )
- return ""
- end
-
- local Content = JavaScript
- Content = Content .. [[
- <div style="font-family: Courier; border: 1px solid #DDD; padding: 10px; width: 97%; height: 200px; overflow: scroll;" id="ChatDiv"></div>
- <input type="text" id="ChatMessage" onKeyPress="if (event.keyCode == 13) { SendChatMessage(); }"><input type="submit" value="Submit" onClick="SendChatMessage();">
- ]]
- return Content
+local CHAT_HISTORY = 50
+local LastMessageID = 0
+
+local JavaScript = [[
+ <script type="text/javascript">
+ function createXHR()
+ {
+ var request = false;
+ try {
+ request = new ActiveXObject('Msxml2.XMLHTTP');
+ }
+ catch (err2) {
+ try {
+ request = new ActiveXObject('Microsoft.XMLHTTP');
+ }
+ catch (err3) {
+ try {
+ request = new XMLHttpRequest();
+ }
+ catch (err1) {
+ request = false;
+ }
+ }
+ }
+ return request;
+ }
+
+ function OpenPage( url, postParams, callback )
+ {
+ var xhr = createXHR();
+ xhr.onreadystatechange=function()
+ {
+ if (xhr.readyState == 4)
+ {
+ callback( xhr )
+ }
+ };
+ xhr.open( (postParams!=null)?"POST":"GET", url , true);
+ if( postParams != null )
+ {
+ xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
+ }
+ xhr.send(postParams);
+ }
+
+ function LoadPageInto( url, postParams, storage )
+ {
+ OpenPage( url, postParams, function( xhr )
+ {
+ var ScrollBottom = storage.scrollTop + storage.offsetHeight;
+ var bAutoScroll = (ScrollBottom >= storage.scrollHeight); // Detect whether we scrolled to the bottom of the div
+
+ results = xhr.responseText.split("<<divider>>");
+ if( results[2] != LastMessageID ) return; // Check if this message was meant for us
+
+ LastMessageID = results[1];
+ if( results[0] != "" )
+ {
+ storage.innerHTML += results[0];
+
+ if( bAutoScroll == true )
+ {
+ storage.scrollTop = storage.scrollHeight;
+ }
+ }
+ } );
+
+
+ return false;
+ }
+
+ function SendChatMessage()
+ {
+ var MessageContainer = document.getElementById('ChatMessage');
+ if( MessageContainer.value == "" ) return;
+
+ var postParams = "ChatMessage=" + MessageContainer.value;
+ OpenPage( "/~webadmin/Core/Chat/", postParams, function( xhr )
+ {
+ RefreshChat();
+ } );
+ MessageContainer.value = "";
+ }
+
+ function RefreshChat()
+ {
+ var postParams = "JustChat=true&LastMessageID=" + LastMessageID;
+ LoadPageInto("/~webadmin/Core/Chat/", postParams, document.getElementById('ChatDiv'));
+ }
+
+ setInterval(RefreshChat, 1000);
+ window.onload = RefreshChat;
+
+ var LastMessageID = 0;
+
+ </script>
+]]
+
+local ChatLogMessages = {}
+
+function AddMessage( PlayerName, Message )
+ LastMessageID = LastMessageID + 1
+ table.insert( ChatLogMessages, { name = PlayerName, message = Message, id = LastMessageID } )
+ while( #ChatLogMessages > CHAT_HISTORY ) do
+ table.remove( ChatLogMessages, 1 )
+ end
+end
+
+function OnChat( Player, Message )
+ AddMessage( Player:GetName(), Message )
+end
+
+function HandleRequest_Chat( Request )
+ if( Request.PostParams["JustChat"] ~= nil ) then
+ local LastIdx = 0
+ if( Request.PostParams["LastMessageID"] ~= nil ) then LastIdx = tonumber( Request.PostParams["LastMessageID"] ) end
+ local Content = ""
+ for key, value in pairs(ChatLogMessages) do
+ if( value.id > LastIdx ) then
+ Content = Content .. "[" .. value.name .. "]: " .. value.message .. "<br>"
+ end
+ end
+ Content = Content .. "<<divider>>" .. LastMessageID .. "<<divider>>" .. LastIdx
+ return Content
+ end
+
+ if( Request.PostParams["ChatMessage"] ~= nil ) then
+ if( Request.PostParams["ChatMessage"] == "/help" ) then
+ Commands = "Available commands"
+ AddMessage(Commands, "<br>" .. "/help, /reload" )
+ return Commands
+ elseif( Request.PostParams["ChatMessage"] == "/reload" ) then
+ Server = cRoot:Get():GetServer()
+ Server:SendMessage( cChatColor.Green .. "Reloading all plugins." )
+ AddMessage("Reloading all plugins", "")
+ cRoot:Get():GetPluginManager():ReloadPlugins()
+ return ""
+ else
+ cmd = Request.PostParams["ChatMessage"]
+ if string.sub(cmd,1,string.len("/")) == "/" then
+ AddMessage('Unknown Command "' .. Request.PostParams["ChatMessage"] .. '"', "")
+ return ""
+ end
+ end
+ local Message = "[WebAdmin]: " .. Request.PostParams["ChatMessage"]
+ cRoot:Get():GetServer():SendMessage( Message )
+ AddMessage("WebAdmin", Request.PostParams["ChatMessage"] )
+ return ""
+ end
+
+ local Content = JavaScript
+ Content = Content .. [[
+ <div style="font-family: Courier; border: 1px solid #DDD; padding: 10px; width: 97%; height: 200px; overflow: scroll;" id="ChatDiv"></div>
+ <input type="text" id="ChatMessage" onKeyPress="if (event.keyCode == 13) { SendChatMessage(); }"><input type="submit" value="Submit" onClick="SendChatMessage();">
+ ]]
+ return Content
end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/web_manageplugins.lua b/MCServer/Plugins/Core/web_manageplugins.lua
index bf1f04ff5..543638183 100644
--- a/MCServer/Plugins/Core/web_manageplugins.lua
+++ b/MCServer/Plugins/Core/web_manageplugins.lua
@@ -1,157 +1,157 @@
-local function Button_RemovePlugin( Name, Index )
- return "<form method='POST'><input type='hidden' name='PluginName' value='"..Name.."'><input type='hidden' name='PluginIndex' value='"..Index.."'><input type='submit' name='RemovePlugin' value='Remove'></form>"
-end
-
-local function Button_EnablePlugin( Name )
- return [[<form method="POST"><input type="hidden" name="PluginName", value="]].. Name ..[["><input type="submit" name="EnablePlugin" value="Enable"></form>]]
-end
-
-local function Button_DisablePlugin( Name )
- return [[<form method="POST"><input type="hidden" name="PluginName", value="]].. Name ..[["><input type="submit" name="DisablePlugin" value="Disable"></form>]]
-end
-
-local function FindPluginID( SettingsIni, PluginName )
- local KeyIdx = SettingsIni:FindKey("Plugins")
- local NumValues = SettingsIni:GetNumValues( KeyIdx )
-
- for i = 0, NumValues-1 do
- LOGINFO( SettingsIni:GetValue(KeyIdx, i) )
- if( SettingsIni:GetValue(KeyIdx, i) == PluginName ) then
- return i
- end
- end
-
- return nil
-end
-
-local function RemovePluginFromIni( SettingsIni, PluginName )
- local KeyIdx = SettingsIni:FindKey("Plugins")
- local PluginIdx = FindPluginID( SettingsIni, PluginName )
-
- if( PluginIdx == nil ) then
- LOGINFO("Got nil! NOOOO")
- return false
- end
-
- local Name = SettingsIni:GetValue( KeyIdx, PluginIdx )
- if( Name ~= PluginName ) then
- LOGINFO("not the same name T_T '" .. Name .. "' '" .. PluginName .. "'")
- end
- if( (Name == PluginName) and (SettingsIni:DeleteValueByID( KeyIdx, PluginIdx ) == true) ) then
- return SettingsIni:WriteFile()
- end
-
- return false
-end
-
-local function AddPluginToIni( SettingsIni, PluginName )
- RemovePluginFromIni( SettingsIni, PluginName ) -- Make sure there are no duplicates
-
- if( SettingsIni:SetValue("Plugins", "Plugin", PluginName, true ) == true ) then
- return SettingsIni:WriteFile()
- end
-
- return false
-end
-
-local function HandlePluginListChanges( Request, SettingsIni )
- local Content = ""
-
- if( Request.PostParams["EnablePlugin"] ~= nil
- and Request.PostParams["PluginName"] ~= nil ) then
-
- local PluginName = Request.PostParams["PluginName"]
-
- local PM = cRoot:Get():GetPluginManager()
- if( PM:LoadPlugin( PluginName ) == false ) then
- Content = "Could not enable '".. PluginName .."'!"
- end
-
- if( AddPluginToIni( SettingsIni, PluginName ) == true ) then
- Content = "Enabled plugin '".. PluginName .."'"
- else
- Content = "Enabled plugin '".. PluginName .."' but could not add it to settings.ini"
- end
-
-
- elseif( Request.PostParams["DisablePlugin"] ~= nil
- and Request.PostParams["PluginName"] ~= nil ) then
-
- local PluginName = Request.PostParams["PluginName"]
-
- local PM = cRoot:Get():GetPluginManager()
- PM:DisablePlugin( PluginName )
-
- if( RemovePluginFromIni( SettingsIni, PluginName ) == true ) then
- Content = "Disabled plugin '".. PluginName .."'"
- else
- Content = "Disabled plugin '".. PluginName .."' but could not remove it from settings.ini"
- end
-
-
-
- end
-
- if( #Content > 0 ) then
- return "<p><font color='red'><strong>INFO: " .. Content .. "</strong></font></p>"
- else
- return ""
- end
-end
-
-function HandleRequest_ManagePlugins( Request )
- local Content = ""
-
- if( Request.PostParams["reload"] ~= nil ) then
- Content = Content .. "<head><meta http-equiv=\"refresh\" content=\"2;\"></head>"
- Content = Content .. "<p>Reloading plugins... This can take a while depending on the plugins you're using.</p>"
- cRoot:Get():GetPluginManager():ReloadPlugins()
- return Content
- end
-
- local SettingsIni = cIniFile("settings.ini")
- if( SettingsIni:ReadFile() == true ) then
- Content = Content .. HandlePluginListChanges( Request, SettingsIni )
- else
- Content = Content .. "Cannot find/modify settings.ini"
- end
-
- local PluginManager = cRoot:Get():GetPluginManager()
- PluginManager:FindPlugins() -- Refreshes the plugin list
- local PluginList = PluginManager:GetAllPlugins()
-
- Content = Content .. "<h4>Currently installed plugins</h4>"
- Content = Content .. "<table>"
- ActivePluginsName = {}
- ActivePluginVersion = {}
- InactivePlugins = {}
- for k, Plugin in pairs(PluginList) do
- if( Plugin ) then
- table.insert( ActivePluginsName, k )
- table.insert( ActivePluginVersion, Plugin:GetVersion() )
- else
- table.insert( InactivePlugins, k )
- end
- end
- table.sort( ActivePluginsName )
- table.sort( InactivePlugins )
- for i = 1, #ActivePluginsName do
- Content = Content .. "<tr><td>".. ActivePluginsName[i] .."</td>"
- Content = Content .. "<td>" .. ActivePluginsName[i] .. " V. " .. ActivePluginVersion[i] .. "</td><td>" .. Button_DisablePlugin(ActivePluginsName[i]) .. "</td>"
- Content = Content .. "</tr>"
- end
- for i = 1, #InactivePlugins do
- Content = Content .. "<tr><td>".. InactivePlugins[i] .."</td>"
- Content = Content .. "<td></td><td>" .. Button_EnablePlugin(InactivePlugins[i]) .. "</td>"
- Content = Content .. "</tr>"
- end
- Content = Content .. "</table>"
-
- Content = Content .. "<h4>Reload</h4>"
- Content = Content .. "<form method='POST'>"
- Content = Content .. "<p>Click the reload button to reload all plugins according to <strong>settings.ini</strong>!"
- Content = Content .. "<input type='submit' name='reload' value='Reload!'></p>"
- Content = Content .. "</form>"
-
- return Content
+local function Button_RemovePlugin( Name, Index )
+ return "<form method='POST'><input type='hidden' name='PluginName' value='"..Name.."'><input type='hidden' name='PluginIndex' value='"..Index.."'><input type='submit' name='RemovePlugin' value='Remove'></form>"
+end
+
+local function Button_EnablePlugin( Name )
+ return [[<form method="POST"><input type="hidden" name="PluginName", value="]].. Name ..[["><input type="submit" name="EnablePlugin" value="Enable"></form>]]
+end
+
+local function Button_DisablePlugin( Name )
+ return [[<form method="POST"><input type="hidden" name="PluginName", value="]].. Name ..[["><input type="submit" name="DisablePlugin" value="Disable"></form>]]
+end
+
+local function FindPluginID( SettingsIni, PluginName )
+ local KeyIdx = SettingsIni:FindKey("Plugins")
+ local NumValues = SettingsIni:GetNumValues( KeyIdx )
+
+ for i = 0, NumValues-1 do
+ LOGINFO( SettingsIni:GetValue(KeyIdx, i) )
+ if( SettingsIni:GetValue(KeyIdx, i) == PluginName ) then
+ return i
+ end
+ end
+
+ return nil
+end
+
+local function RemovePluginFromIni( SettingsIni, PluginName )
+ local KeyIdx = SettingsIni:FindKey("Plugins")
+ local PluginIdx = FindPluginID( SettingsIni, PluginName )
+
+ if( PluginIdx == nil ) then
+ LOGINFO("Got nil! NOOOO")
+ return false
+ end
+
+ local Name = SettingsIni:GetValue( KeyIdx, PluginIdx )
+ if( Name ~= PluginName ) then
+ LOGINFO("not the same name T_T '" .. Name .. "' '" .. PluginName .. "'")
+ end
+ if( (Name == PluginName) and (SettingsIni:DeleteValueByID( KeyIdx, PluginIdx ) == true) ) then
+ return SettingsIni:WriteFile()
+ end
+
+ return false
+end
+
+local function AddPluginToIni( SettingsIni, PluginName )
+ RemovePluginFromIni( SettingsIni, PluginName ) -- Make sure there are no duplicates
+
+ if( SettingsIni:SetValue("Plugins", "Plugin", PluginName, true ) == true ) then
+ return SettingsIni:WriteFile()
+ end
+
+ return false
+end
+
+local function HandlePluginListChanges( Request, SettingsIni )
+ local Content = ""
+
+ if( Request.PostParams["EnablePlugin"] ~= nil
+ and Request.PostParams["PluginName"] ~= nil ) then
+
+ local PluginName = Request.PostParams["PluginName"]
+
+ local PM = cRoot:Get():GetPluginManager()
+ if( PM:LoadPlugin( PluginName ) == false ) then
+ Content = "Could not enable '".. PluginName .."'!"
+ end
+
+ if( AddPluginToIni( SettingsIni, PluginName ) == true ) then
+ Content = "Enabled plugin '".. PluginName .."'"
+ else
+ Content = "Enabled plugin '".. PluginName .."' but could not add it to settings.ini"
+ end
+
+
+ elseif( Request.PostParams["DisablePlugin"] ~= nil
+ and Request.PostParams["PluginName"] ~= nil ) then
+
+ local PluginName = Request.PostParams["PluginName"]
+
+ local PM = cRoot:Get():GetPluginManager()
+ PM:DisablePlugin( PluginName )
+
+ if( RemovePluginFromIni( SettingsIni, PluginName ) == true ) then
+ Content = "Disabled plugin '".. PluginName .."'"
+ else
+ Content = "Disabled plugin '".. PluginName .."' but could not remove it from settings.ini"
+ end
+
+
+
+ end
+
+ if( #Content > 0 ) then
+ return "<p><font color='red'><strong>INFO: " .. Content .. "</strong></font></p>"
+ else
+ return ""
+ end
+end
+
+function HandleRequest_ManagePlugins( Request )
+ local Content = ""
+
+ if( Request.PostParams["reload"] ~= nil ) then
+ Content = Content .. "<head><meta http-equiv=\"refresh\" content=\"2;\"></head>"
+ Content = Content .. "<p>Reloading plugins... This can take a while depending on the plugins you're using.</p>"
+ cRoot:Get():GetPluginManager():ReloadPlugins()
+ return Content
+ end
+
+ local SettingsIni = cIniFile("settings.ini")
+ if( SettingsIni:ReadFile() == true ) then
+ Content = Content .. HandlePluginListChanges( Request, SettingsIni )
+ else
+ Content = Content .. "Cannot find/modify settings.ini"
+ end
+
+ local PluginManager = cRoot:Get():GetPluginManager()
+ PluginManager:FindPlugins() -- Refreshes the plugin list
+ local PluginList = PluginManager:GetAllPlugins()
+
+ Content = Content .. "<h4>Currently installed plugins</h4>"
+ Content = Content .. "<table>"
+ ActivePluginsName = {}
+ ActivePluginVersion = {}
+ InactivePlugins = {}
+ for k, Plugin in pairs(PluginList) do
+ if( Plugin ) then
+ table.insert( ActivePluginsName, k )
+ table.insert( ActivePluginVersion, Plugin:GetVersion() )
+ else
+ table.insert( InactivePlugins, k )
+ end
+ end
+ table.sort( ActivePluginsName )
+ table.sort( InactivePlugins )
+ for i = 1, #ActivePluginsName do
+ Content = Content .. "<tr><td>".. ActivePluginsName[i] .."</td>"
+ Content = Content .. "<td>" .. ActivePluginsName[i] .. " V. " .. ActivePluginVersion[i] .. "</td><td>" .. Button_DisablePlugin(ActivePluginsName[i]) .. "</td>"
+ Content = Content .. "</tr>"
+ end
+ for i = 1, #InactivePlugins do
+ Content = Content .. "<tr><td>".. InactivePlugins[i] .."</td>"
+ Content = Content .. "<td></td><td>" .. Button_EnablePlugin(InactivePlugins[i]) .. "</td>"
+ Content = Content .. "</tr>"
+ end
+ Content = Content .. "</table>"
+
+ Content = Content .. "<h4>Reload</h4>"
+ Content = Content .. "<form method='POST'>"
+ Content = Content .. "<p>Click the reload button to reload all plugins according to <strong>settings.ini</strong>!"
+ Content = Content .. "<input type='submit' name='reload' value='Reload!'></p>"
+ Content = Content .. "</form>"
+
+ return Content
end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/web_permissions.lua b/MCServer/Plugins/Core/web_permissions.lua
index 5278767e7..7a8af56e9 100644
--- a/MCServer/Plugins/Core/web_permissions.lua
+++ b/MCServer/Plugins/Core/web_permissions.lua
@@ -1,134 +1,134 @@
-local function HTML_Option( value, text, selected )
- if( selected == true ) then
- return [[<option value="]] .. value .. [[" selected>]] .. text .. [[</option>]]
- else
- return [[<option value="]] .. value .. [[">]] .. text .. [[</option>"]]
- end
-end
-
-local function ShowUsersTable()
- local Content = "<h4>Users</h4>"
-
- local NumUsers = UsersIni:GetNumKeys()
-
- Content = Content .. "<table>"
-
- if( NumUsers > 0 ) then
- Content = Content .. "<tr><th></th><th>User</th><th>Groups</th></tr>"
-
- for i=0, NumUsers-1 do
- local UserName = UsersIni:GetKeyName( i )
-
- Content = Content .. "<tr>"
- Content = Content .. "<td style='width: 10px;'>" .. i .. ".</td>"
- Content = Content .. "<td>" .. UserName .. "</td>"
- Content = Content .. "<td>"
- Content = Content .. UsersIni:GetValue( UserName, "Groups", "-" )
- Content = Content .. "</td>"
- Content = Content .. "</tr>"
- end
- else
- Content = Content .. "<tr><td>None</td></tr>"
- end
- Content = Content .. "</table>"
-
-
- return Content
-end
-
-local function ShowGroupsTable()
- local Content = "<h4>Groups</h4>"
-
- local NumGroups = GroupsIni:GetNumKeys()
-
- Content = Content .. "<table>"
- if( NumGroups > 0 ) then
- Content = Content .. "<tr><th></th><th>Name</th><th>Permissions</th><th>Color</th></tr>"
-
- for i=0, NumGroups-1 do
- local GroupName = GroupsIni:GetKeyName( i )
-
- Content = Content .. "<tr>"
- Content = Content .. "<td style='width: 10px;'>" .. i .. ".</td>"
- Content = Content .. "<td>" .. GroupName .. "</td>"
- Content = Content .. "<td>"
- Content = Content .. GroupsIni:GetValue( GroupName, "Permissions", "-" )
- Content = Content .. "</td>"
- Content = Content .. "<td>"
- Content = Content .. GroupsIni:GetValue( GroupName, "Color", "-" )
- Content = Content .. "</td>"
- Content = Content .. "</tr>"
- end
- else
- Content = Content .. "<tr><td>None</td></tr>"
- end
- Content = Content .. "</table>"
-
- return Content
-end
-
-local function HTML_Select_Group( name, defaultValue )
- Groups = ""
- for I=0, GroupsIni:GetNumKeys() - 1 do
- Groups = Groups ..
- HTML_Option(GroupsIni:KeyName(I), GroupsIni:KeyName(I), defaultValue == GroupsIni:KeyName(I) )
- end
- return [[<select name="]] .. name .. [[">]] .. Groups .. [[</select>]]
-end
-
-
-local function AddPlayers( Request )
- local Content = "<h4>Add or change Players</h4>"
- if( Request.PostParams["AddPlayerToGroup"] ~= nil ) then
- if Request.PostParams["AddPlayer"] ~= "" then
- if Request.PostParams["AddGroups"] ~= "" then
- if GroupsIni:FindKey(Request.PostParams["AddGroup"]) == -1 then
- return "Group does not exist"
- end
- UsersIni:DeleteKey(Request.PostParams["AddPlayer"])
- UsersIni:GetValueSet(Request.PostParams["AddPlayer"], "Groups", Request.PostParams["AddGroup"])
- UsersIni:WriteFile()
- local loopPlayers = function( Player )
- if Player:GetName() == Request.PostParams["AddPlayer"] then
- Player:SendMessage( cChatColor.Green .. "You were moved to group " .. Request.PostParams["AddGroup"] )
- Player:LoadPermissionsFromDisk()
- end
- end
- local loopWorlds = function ( World )
- World:ForEachPlayer( loopPlayers )
- end
- cRoot:Get():ForEachWorld( loopWorlds )
- end
- end
- end
- Content = Content .. [[
- <form method="POST">
- <table>
- <tr><td style="width: 20%;">Player:</td>
- <td><input type="text" name="AddPlayer" value=""></td></tr><br>
- <tr><td style="width: 20%;">Group:</td>
- <td>]] .. HTML_Select_Group("AddGroup", GroupsIni:KeyName(0) ) .. [[</td></tr>
- </table>
- <input type="submit" value="Add Player" name="AddPlayerToGroup">]]
-
- return Content
-end
-
-function HandleRequest_Permissions( Request )
- GroupsIni = cIniFile("groups.ini")
- if( GroupsIni:ReadFile() == false ) then
- return "Could not read groups.ini!"
- end
- UsersIni = cIniFile("users.ini")
- if( UsersIni:ReadFile() == false ) then
- return "Could not read users.ini!"
- end
-
- local Content = ""
-
- Content = Content .. AddPlayers( Request )
- Content = Content .. ShowGroupsTable()
- Content = Content .. ShowUsersTable()
-
- return Content
+local function HTML_Option( value, text, selected )
+ if( selected == true ) then
+ return [[<option value="]] .. value .. [[" selected>]] .. text .. [[</option>]]
+ else
+ return [[<option value="]] .. value .. [[">]] .. text .. [[</option>"]]
+ end
+end
+
+local function ShowUsersTable()
+ local Content = "<h4>Users</h4>"
+
+ local NumUsers = UsersIni:GetNumKeys()
+
+ Content = Content .. "<table>"
+
+ if( NumUsers > 0 ) then
+ Content = Content .. "<tr><th></th><th>User</th><th>Groups</th></tr>"
+
+ for i=0, NumUsers-1 do
+ local UserName = UsersIni:GetKeyName( i )
+
+ Content = Content .. "<tr>"
+ Content = Content .. "<td style='width: 10px;'>" .. i .. ".</td>"
+ Content = Content .. "<td>" .. UserName .. "</td>"
+ Content = Content .. "<td>"
+ Content = Content .. UsersIni:GetValue( UserName, "Groups", "-" )
+ Content = Content .. "</td>"
+ Content = Content .. "</tr>"
+ end
+ else
+ Content = Content .. "<tr><td>None</td></tr>"
+ end
+ Content = Content .. "</table>"
+
+
+ return Content
+end
+
+local function ShowGroupsTable()
+ local Content = "<h4>Groups</h4>"
+
+ local NumGroups = GroupsIni:GetNumKeys()
+
+ Content = Content .. "<table>"
+ if( NumGroups > 0 ) then
+ Content = Content .. "<tr><th></th><th>Name</th><th>Permissions</th><th>Color</th></tr>"
+
+ for i=0, NumGroups-1 do
+ local GroupName = GroupsIni:GetKeyName( i )
+
+ Content = Content .. "<tr>"
+ Content = Content .. "<td style='width: 10px;'>" .. i .. ".</td>"
+ Content = Content .. "<td>" .. GroupName .. "</td>"
+ Content = Content .. "<td>"
+ Content = Content .. GroupsIni:GetValue( GroupName, "Permissions", "-" )
+ Content = Content .. "</td>"
+ Content = Content .. "<td>"
+ Content = Content .. GroupsIni:GetValue( GroupName, "Color", "-" )
+ Content = Content .. "</td>"
+ Content = Content .. "</tr>"
+ end
+ else
+ Content = Content .. "<tr><td>None</td></tr>"
+ end
+ Content = Content .. "</table>"
+
+ return Content
+end
+
+local function HTML_Select_Group( name, defaultValue )
+ Groups = ""
+ for I=0, GroupsIni:GetNumKeys() - 1 do
+ Groups = Groups ..
+ HTML_Option(GroupsIni:KeyName(I), GroupsIni:KeyName(I), defaultValue == GroupsIni:KeyName(I) )
+ end
+ return [[<select name="]] .. name .. [[">]] .. Groups .. [[</select>]]
+end
+
+
+local function AddPlayers( Request )
+ local Content = "<h4>Add or change Players</h4>"
+ if( Request.PostParams["AddPlayerToGroup"] ~= nil ) then
+ if Request.PostParams["AddPlayer"] ~= "" then
+ if Request.PostParams["AddGroups"] ~= "" then
+ if GroupsIni:FindKey(Request.PostParams["AddGroup"]) == -1 then
+ return "Group does not exist"
+ end
+ UsersIni:DeleteKey(Request.PostParams["AddPlayer"])
+ UsersIni:GetValueSet(Request.PostParams["AddPlayer"], "Groups", Request.PostParams["AddGroup"])
+ UsersIni:WriteFile()
+ local loopPlayers = function( Player )
+ if Player:GetName() == Request.PostParams["AddPlayer"] then
+ Player:SendMessage( cChatColor.Green .. "You were moved to group " .. Request.PostParams["AddGroup"] )
+ Player:LoadPermissionsFromDisk()
+ end
+ end
+ local loopWorlds = function ( World )
+ World:ForEachPlayer( loopPlayers )
+ end
+ cRoot:Get():ForEachWorld( loopWorlds )
+ end
+ end
+ end
+ Content = Content .. [[
+ <form method="POST">
+ <table>
+ <tr><td style="width: 20%;">Player:</td>
+ <td><input type="text" name="AddPlayer" value=""></td></tr><br>
+ <tr><td style="width: 20%;">Group:</td>
+ <td>]] .. HTML_Select_Group("AddGroup", GroupsIni:KeyName(0) ) .. [[</td></tr>
+ </table>
+ <input type="submit" value="Add Player" name="AddPlayerToGroup">]]
+
+ return Content
+end
+
+function HandleRequest_Permissions( Request )
+ GroupsIni = cIniFile("groups.ini")
+ if( GroupsIni:ReadFile() == false ) then
+ return "Could not read groups.ini!"
+ end
+ UsersIni = cIniFile("users.ini")
+ if( UsersIni:ReadFile() == false ) then
+ return "Could not read users.ini!"
+ end
+
+ local Content = ""
+
+ Content = Content .. AddPlayers( Request )
+ Content = Content .. ShowGroupsTable()
+ Content = Content .. ShowUsersTable()
+
+ return Content
end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/web_playerlist.lua b/MCServer/Plugins/Core/web_playerlist.lua
index c042c0072..6ac25db86 100644
--- a/MCServer/Plugins/Core/web_playerlist.lua
+++ b/MCServer/Plugins/Core/web_playerlist.lua
@@ -1,38 +1,38 @@
-function HandleRequest_PlayerList( Request )
- local World = cRoot:Get():GetDefaultWorld()
- local Content = ""
-
- if( Request.Params["playerlist-kick"] ~= nil ) then
- local KickPlayerName = Request.Params["playerlist-kick"]
- local FoundPlayerCallback = function( Player )
- if( Player:GetName() == KickPlayerName ) then
- Player:GetClientHandle():Kick("You were kicked from the game!")
- Content = Content .. "<p>" .. KickPlayerName .. " has been kicked from the game!</p>"
- end
- end
- if( World:DoWithPlayer( KickPlayerName, FoundPlayerCallback ) == false ) then
- Content = Content .. "<p>Could not find player " .. KickPlayerName .. " !</p>"
- end
- end
-
- Content = Content .. "<p>Connected Players: <b>" .. World:GetNumPlayers() .. "</b></p>"
- Content = Content .. "<table>"
-
- local PlayerNum = 0
- local AddPlayerToTable = function( Player )
- PlayerNum = PlayerNum + 1
- Content = Content .. "<tr>"
- Content = Content .. "<td style='width: 10px;'>" .. PlayerNum .. ".</td>"
- Content = Content .. "<td>" .. Player:GetName() .. "</td>"
- Content = Content .. "<td><a href='?playerlist-kick=" .. Player:GetName() .. "'>Kick</a></td>"
- Content = Content .. "</tr>"
- end
- cRoot:Get():ForEachPlayer( AddPlayerToTable )
-
- if( PlayerNum == 0 ) then
- Content = Content .. "<tr><td>None</td></tr>"
- end
- Content = Content .. "</table>"
- Content = Content .. "<br>"
- return Content
+function HandleRequest_PlayerList( Request )
+ local World = cRoot:Get():GetDefaultWorld()
+ local Content = ""
+
+ if( Request.Params["playerlist-kick"] ~= nil ) then
+ local KickPlayerName = Request.Params["playerlist-kick"]
+ local FoundPlayerCallback = function( Player )
+ if( Player:GetName() == KickPlayerName ) then
+ Player:GetClientHandle():Kick("You were kicked from the game!")
+ Content = Content .. "<p>" .. KickPlayerName .. " has been kicked from the game!</p>"
+ end
+ end
+ if( World:DoWithPlayer( KickPlayerName, FoundPlayerCallback ) == false ) then
+ Content = Content .. "<p>Could not find player " .. KickPlayerName .. " !</p>"
+ end
+ end
+
+ Content = Content .. "<p>Connected Players: <b>" .. World:GetNumPlayers() .. "</b></p>"
+ Content = Content .. "<table>"
+
+ local PlayerNum = 0
+ local AddPlayerToTable = function( Player )
+ PlayerNum = PlayerNum + 1
+ Content = Content .. "<tr>"
+ Content = Content .. "<td style='width: 10px;'>" .. PlayerNum .. ".</td>"
+ Content = Content .. "<td>" .. Player:GetName() .. "</td>"
+ Content = Content .. "<td><a href='?playerlist-kick=" .. Player:GetName() .. "'>Kick</a></td>"
+ Content = Content .. "</tr>"
+ end
+ cRoot:Get():ForEachPlayer( AddPlayerToTable )
+
+ if( PlayerNum == 0 ) then
+ Content = Content .. "<tr><td>None</td></tr>"
+ end
+ Content = Content .. "</table>"
+ Content = Content .. "<br>"
+ return Content
end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/web_serversettings.lua b/MCServer/Plugins/Core/web_serversettings.lua
index d3a890b0c..a53756b21 100644
--- a/MCServer/Plugins/Core/web_serversettings.lua
+++ b/MCServer/Plugins/Core/web_serversettings.lua
@@ -1,922 +1,920 @@
--- Some HTML helper functions
-local function HTML_Option( value, text, selected )
- if( selected == true ) then
- return [[<option value="]] .. value .. [[" selected>]] .. text .. [[</option>]]
- else
- return [[<option value="]] .. value .. [[">]] .. text .. [[</option>"]]
- end
-end
-
-local function HTML_Select_On_Off( name, defaultValue )
- return [[<select name="]] .. name .. [[">]]
- .. HTML_Option("1", "On", defaultValue == 1 )
- .. HTML_Option("0", "Off", defaultValue == 0 )
- .. [[</select>]]
-end
-
-local function HTML_Select_Version( name, defaultValue )
- return [[<select name="]] .. name .. [[">]]
- .. HTML_Option("0", "Latest Version", defaultValue == 0 )
- .. HTML_Option("61", "1.5.2", defaultValue == 1 )
- .. HTML_Option("60", "1.5.0", defaultValue == 2 )
- .. HTML_Option("49", "1.4.5", defaultValue == 3 )
- .. HTML_Option("47", "1.4.2", defaultValue == 4 )
- .. HTML_Option("39", "1.3.2", defaultValue == 5 )
- .. HTML_Option("29", "1.2.5", defaultValue == 6 )
- .. [[</select>]]
-end
-
-
-local function ShowGeneralSettings( Request )
- local Content = ""
- local InfoMsg = nil
-
- local SettingsIni = cIniFile("settings.ini")
- if( SettingsIni:ReadFile() == false ) then
- InfoMsg = "<b style=\"color: red;\">ERROR: Could not read settings.ini!</b>"
- end
-
- if( Request.PostParams["general_submit"] ~= nil ) then
-
- SettingsIni:SetValue("Server", "Description",Request.PostParams["Server_Description"],false )
- if( tonumber( Request.PostParams["Server_MaxPlayers"] ) ~= nil ) then
- SettingsIni:SetValue("Server", "MaxPlayers", Request.PostParams["Server_MaxPlayers"], false )
- end
- if( tonumber( Request.PostParams["Server_Port"] ) ~= nil ) then
- SettingsIni:SetValue("Server", "Port", Request.PostParams["Server_Port"], false )
- end
- if( tonumber( Request.PostParams["Server_PortsIPv6"] ) ~= nil ) then
- SettingsIni:SetValue("Server", "PortsIPv6", Request.PostParams["Server_PortsIPv6"], false )
- end
- if( tonumber( Request.PostParams["Server_Version"] ) ~= nil ) then
- SettingsIni:SetValue("Server", "PrimaryServerVersion", Request.PostParams["Server_Version"], false )
- end
- 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>]]
- else
- InfoMsg = [[<b style="color: green;">INFO: Successfully saved changes to settings.ini</b>]]
- end
- end
-
-
- Content = Content .. [[
- <form method="POST">
- <h4>General Settings</h4>]]
-
- if( InfoMsg ~= nil ) then
- Content = Content .. "<p>" .. InfoMsg .. "</p>"
- end
- Content = Content .. [[
- <table>
- <th colspan="2">Server</th>
- <tr><td style="width: 50%;">Description:</td>
- <td><input type="text" name="Server_Description" value="]] .. SettingsIni:GetValue("Server", "Description") .. [["></td></tr>
- <tr><td>Max Players:</td>
- <td><input type="text" name="Server_MaxPlayers" value="]] .. SettingsIni:GetValue("Server", "MaxPlayers") .. [["></td></tr>
- <tr><td>Port:</td>
- <td><input type="text" name="Server_Port" value="]] .. SettingsIni:GetValue("Server", "Port") .. [["></td></tr>
- <tr><td>PortsIPv6:</td>
- <td><input type="text" name="Server_PortsIPv6" value="]] .. SettingsIni:GetValue("Server", "PortsIPv6") .. [["></td></tr>
- <tr><td>Shown Version:</td>
- <td>]] .. HTML_Select_Version("Server_Version", SettingsIni:GetValueI("Server", "PrimaryServerVersion") ) .. [[</td></tr>
- </table><br />
-
- <table>
- <th colspan="2">Authentication</th>
- <tr><td style="width: 50%;">Authenticate:</td>
- <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>]]
-
- return Content
-end
-
-
-local function ShowMonstersSettings( Request )
- local Content = ""
- local InfoMsg = nil
-
- local SettingsIni = cIniFile("settings.ini")
- if( SettingsIni:ReadFile() == false ) then
- InfoMsg = "<b style=\"color: red;\">ERROR: Could not read settings.ini!</b>"
- end
-
- if( Request.PostParams["monsters_submit"] ~= nil ) then
-
- if( tonumber( Request.PostParams["Monsters_AnimalsOn"] ) ~= nil ) then
- SettingsIni:SetValue("Monsters", "AnimalsOn", Request.PostParams["Monsters_AnimalsOn"], false )
- end
- if( tonumber( Request.PostParams["Monsters_AnimalSpawnInterval"] ) ~= nil ) then
- SettingsIni:SetValue("Monsters", "AnimalSpawnInterval", Request.PostParams["Monsters_AnimalSpawnInterval"], false )
- end
- SettingsIni:SetValue("Monsters", "Types", Request.PostParams["Monsters_Types"], false )
- if( SettingsIni:WriteFile() == false ) then
- InfoMsg = "<b style=\"color: red;\">ERROR: Could not write to settings.ini!</b>"
- else
- InfoMsg = "<b style=\"color: green;\">INFO: Successfully saved changes to settings.ini</b>"
- end
- end
-
-
- Content = Content .. "<form method=\"POST\">"
-
- Content = Content .. "<h4>Monsters Settings</h4>"
- if( InfoMsg ~= nil ) then
- Content = Content .. "<p>" .. InfoMsg .. "</p>"
- end
-
- Content = Content .. [[
- <table>
- <th colspan="2">Monsters</th>
- <tr><td style="width: 50%;">Animals On:</td>
- <td>]] .. HTML_Select_On_Off("Monsters_AnimalsOn", SettingsIni:GetValueI("Monsters", "AnimalsOn") ) .. [[</td></tr>
- <tr><td>Animal Spawn Interval:</td>
- <td><input type="text" name="Monsters_AnimalSpawnInterval" value="]] .. SettingsIni:GetValue("Monsters", "AnimalSpawnInterval") .. [["></td></tr>
- <tr><td>Monster Types:</td>
- <td><input type="text" name="Monsters_Types" value="]] .. SettingsIni:GetValue("Monsters", "Types") .. [["></td></tr>
- </table><br />
- <input type="submit" value="Save Settings" name="monsters_submit"> WARNING: Any changes made here might require a server restart in order to be applied!
- </form>]]
-
- return Content
-end
-
-local function ShowWorldsSettings( Request )
- local Content = ""
- local InfoMsg = nil
- local bSaveIni = false
-
- local SettingsIni = cIniFile("settings.ini")
- if( SettingsIni:ReadFile() == false ) then
- InfoMsg = [[<b style="color: red;">ERROR: Could not read settings.ini!</b>]]
- end
-
- if( Request.PostParams["RemoveWorld"] ~= nil ) then
- Content = Content .. Request.PostParams["RemoveWorld"]
- local WorldIdx = string.sub( Request.PostParams["RemoveWorld"], string.len("Remove ") )
- local KeyIdx = SettingsIni:FindKey("Worlds")
- local WorldName = SettingsIni:GetValue( KeyIdx, WorldIdx )
- if( SettingsIni:DeleteValueByID( KeyIdx, WorldIdx ) == true ) then
- InfoMsg = "<b style=\"color: green;\">INFO: Successfully removed world " .. WorldName .. "!</b><br />"
- bSaveIni = true
- end
- end
-
- if( Request.PostParams["AddWorld"] ~= nil ) then
- if( Request.PostParams["WorldName"] ~= nil and Request.PostParams["WorldName"] ~= "" ) then
- SettingsIni:SetValue("Worlds", "World", Request.PostParams["WorldName"], true )
- InfoMsg = "<b style=\"color: green;\">INFO: Successfully added world " .. Request.PostParams["WorldName"] .. "!</b><br />"
- bSaveIni = true
- end
- end
-
- if( Request.PostParams["worlds_submit"] ~= nil ) then
- SettingsIni:SetValue("Worlds", "DefaultWorld", Request.PostParams["Worlds_DefaultWorld"], false )
- if( Request.PostParams["Worlds_World"] ~= nil ) then
- SettingsIni:SetValue("Worlds", "World", Request.PostParams["Worlds_World"], true )
- end
- bSaveIni = true
- end
-
- if( bSaveIni == true ) then
- if( InfoMsg == nil ) then InfoMsg = "" end
- if( SettingsIni:WriteFile() == false ) then
- InfoMsg = InfoMsg .. "<b style=\"color: red;\">ERROR: Could not write to settings.ini!</b>"
- else
- InfoMsg = InfoMsg .. "<b style=\"color: green;\">INFO: Successfully saved changes to settings.ini</b>"
- end
- end
-
- Content = Content .. "<h4>Worlds Settings</h4>"
- if( InfoMsg ~= nil ) then
- Content = Content .. "<p>" .. InfoMsg .. "</p>"
- end
-
- Content = Content .. [[
- <form method="POST">
- <table>
- <th colspan="2">Worlds</th>
- <tr><td style="width: 50%;">Default World:</td>
- <td><input type="Submit" name="Worlds_DefaultWorld" value="]] .. SettingsIni:GetValue("Worlds", "DefaultWorld") .. [["></td></tr>]]
-
- local KeyIdx = SettingsIni:FindKey("Worlds")
- local NumValues = SettingsIni:GetNumValues( KeyIdx )
- for i = 0, NumValues-1 do
- local ValueName = SettingsIni:GetValueName(KeyIdx, i )
- if( ValueName == "World" ) then
- local WorldName = SettingsIni:GetValue(KeyIdx, i)
- Content = Content .. [[
- <tr><td>]] .. ValueName .. [[:</td><td><div style="width: 100px; display: inline-block;">]] .. WorldName .. [[</div><input type="submit" value="Remove ]] .. i .. [[" name="RemoveWorld"></td></tr>]]
- end
- end
-
- Content = Content .. [[
- <tr><td>Add World:</td>
- <td><input type='text' name='WorldName'><input type='submit' name='AddWorld' value='Add World'></td></tr>
- </table><br />
-
- <input type="submit" value="Save Settings" name="worlds_submit"> WARNING: Any changes made here might require a server restart in order to be applied!
- </form>]]
- return Content
-end
-
-local function SelectWorldButton( WorldName )
- return "<form method='POST'><input type='hidden' name='WorldName' value='"..WorldName.."'><input type='submit' name='SelectWorld' value='Select'></form>"
-end
-
-local function HTML_Select_Dimension( name, defaultValue )
- return [[<select name="]] .. name .. [[">]]
- .. HTML_Option("0", "Overworld", defaultValue == 0 )
- .. HTML_Option("-1", "Nether", defaultValue == 1 )
- .. HTML_Option("1", "The End", defaultValue == 2 )
- .. [[</select>]]
-end
-
-local function HTML_Select_Scheme( name, defaultValue )
- return [[<select name="]] .. name .. [[">]]
- .. HTML_Option("Default", "Default", defaultValue == "Default" )
- .. HTML_Option("Forgetful", "Forgetful", defaultValue == "Forgetful" )
- .. HTML_Option("Compact", "Compact", defaultValue == "Compact" )
- .. [[</select>]]
-end
-
-local function HTML_Select_GameMode( name, defaultValue )
- return [[<select name="]] .. name .. [[">]]
- .. HTML_Option("0", "Survival", defaultValue == 0 )
- .. HTML_Option("1", "Creative", defaultValue == 1 )
- .. HTML_Option("2", "Adventure", defaultValue == 2 )
- .. [[</select>]]
-end
-
-local function HTML_Select_Simulator( name, defaultValue )
- return [[<select name="]] .. name .. [[">]]
- .. HTML_Option("Floody", "Floody", defaultValue == 0 )
- .. HTML_Option("Noop", "Noop", defaultValue == 1 )
- .. HTML_Option("Vaporize", "Vaporize", defaultValue == 2 )
- .. [[</select>]]
-end
-
-local function HTML_Select_BiomeGen( name, defaultValue )
- return [[<select name="]] .. name .. [[">]]
- .. HTML_Option("MultiStepMap", "MultiStepMap", defaultValue == "MultiStepMap" )
- .. HTML_Option("DistortedVoronoi", "DistortedVoronoi", defaultValue == "DistortedVoronoi" )
- .. HTML_Option("Voronoi", "Voronoi", defaultValue == "Voronoi" )
- .. HTML_Option("CheckerBoard", "CheckerBoard", defaultValue == "CheckerBoard" )
- .. HTML_Option("Constant", "Constant", defaultValue == "Constant" )
- .. [[</select>]]
-end
-
-local function HTML_Select_HeightGen( name, defaultValue )
- return [[<select name="]] .. name .. [[">]]
- .. HTML_Option("Noise3D", "Noise3D", defaultValue == "Noise3D" )
- .. HTML_Option("Biomal", "Biomal", defaultValue == "Biomal" )
- .. HTML_Option("Classic", "Classic", defaultValue == "Classic" )
- .. HTML_Option("Flat", "Flat", defaultValue == "Flat" )
- .. [[</select>]]
-end
-
-local function HTML_Select_CompositionGen( name, defaultValue )
- return [[<select name="]] .. name .. [[">]]
- .. HTML_Option("Noise3D", "Noise3D", defaultValue == "Noise3D" )
- .. HTML_Option("Biomal", "Biomal", defaultValue == "Biomal" )
- .. HTML_Option("Classic", "Classic", defaultValue == "Classic" )
- .. HTML_Option("SameBlock", "SameBlock", defaultValue == "SameBlock" )
- .. HTML_Option("DebugBiomes", "DebugBiomes", defaultValue == "DebugBiomes" )
- .. [[</select>]]
-end
-
-local function HTML_Select_Generator( name, defaultValue )
- return [[<select name="]] .. name .. [[">]]
- .. HTML_Option("Composable", "Composable", defaultValue == "Composable" )
- .. [[</select>]]
-end
-
-local function HTML_Select_Biome( name, defaultValue )
- return [[<select name="]] .. name .. [[">]]
- .. HTML_Option("Ocean", "Ocean", defaultValue == "Ocean" )
- .. HTML_Option("Plains", "Plains", defaultValue == "Plains" )
- .. HTML_Option("Extreme Hills", "Extreme Hills", defaultValue == "Extreme Hills" )
- .. HTML_Option("Forest", "Forest", defaultValue == "Forest" )
- .. HTML_Option("Taiga", "Taiga", defaultValue == "Taiga" )
- .. HTML_Option("Swampland", "Swampland", defaultValue == "Swampland" )
- .. HTML_Option("River", "River", defaultValue == "River" )
- .. HTML_Option("Hell", "Hell", defaultValue == "Hell" )
- .. HTML_Option("Sky", "Sky", defaultValue == "Sky" )
- .. HTML_Option("FrozenOcean", "FrozenOcean", defaultValue == "FrozenOcean" )
- .. HTML_Option("FrozenRiver", "FrozenRiver", defaultValue == "FrozenRiver" )
- .. HTML_Option("Ice Plains", "Ice Plains", defaultValue == "Ice Plains" )
- .. HTML_Option("Ice Mountains", "Ice Mountains", defaultValue == "Ice Mountains" )
- .. HTML_Option("MushroomIsland", "MushroomIsland", defaultValue == "MushroomIsland" )
- .. HTML_Option("MushroomIslandShore", "MushroomIslandShore", defaultValue == "MushroomIslandShore" )
- .. HTML_Option("Beach", "Beach", defaultValue == "Beach" )
- .. HTML_Option("DesertHills", "DesertHills", defaultValue == "DesertHills" )
- .. HTML_Option("ForestHills", "ForestHills", defaultValue == "ForestHills" )
- .. HTML_Option("TaigaHills", "TaigaHills", defaultValue == "TaigaHills" )
- .. HTML_Option("Extreme Hills Edge", "Extreme Hills Edge", defaultValue == "Extreme Hills Edge" )
- .. HTML_Option("Jungle", "Jungle", defaultValue == "Jungle" )
- .. HTML_Option("JungleHills", "JungleHills", defaultValue == "JungleHills" )
- .. [[</select>]]
-end
-
-function ShowWorldSettings( Request )
- local Content = ""
- local InfoMsg = nil
- local SettingsIni = cIniFile("settings.ini")
- if( SettingsIni:ReadFile() == false ) then
- InfoMsg = [[<b style="color: red;">ERROR: Could not read settings.ini!</b>]]
- end
- if (Request.PostParams["SelectWorld"] ~= nil and Request.PostParams["WorldName"] ~= nil) then -- World is selected!
- WORLD = Request.PostParams["WorldName"]
- SelectedWorld = cRoot:Get():GetWorld(WORLD)
- elseif SelectedWorld == nil then
- WORLD = SettingsIni:GetValue("Worlds", "DefaultWorld")
- SelectedWorld = cRoot:Get():GetWorld( WORLD )
- end
- local WorldIni = cIniFile(SelectedWorld:GetName() .. "/world.ini")
- WorldIni:ReadFile()
- if (Request.PostParams["world_submit"]) ~= nil then
- if( tonumber( Request.PostParams["World_Dimension"] ) ~= nil ) then
- WorldIni:DeleteValue( "General", "Dimension" )
- WorldIni:SetValue( "General", "Dimension", Request.PostParams["World_Dimension"] )
- end
- if( tonumber( Request.PostParams["World_Schema"] ) ~= nil ) then
- WorldIni:DeleteValue( "General", "Schema" )
- WorldIni:SetValue( "General", "Schema", Request.PostParams["World_Schema"] )
- end
- if( tonumber( Request.PostParams["World_SpawnX"] ) ~= nil ) then
- WorldIni:DeleteValue( "SpawnPosition", "X" )
- WorldIni:SetValue( "SpawnPosition", "X", Request.PostParams["World_SpawnX"] )
- end
- if( tonumber( Request.PostParams["World_SpawnY"] ) ~= nil ) then
- WorldIni:DeleteValue( "SpawnPosition", "Y" )
- WorldIni:SetValue( "SpawnPosition", "Y", Request.PostParams["World_SpawnY"] )
- end
- if( tonumber( Request.PostParams["World_SpawnZ"] ) ~= nil ) then
- WorldIni:DeleteValue( "SpawnPosition", "Z" )
- WorldIni:SetValue( "SpawnPosition", "Z", Request.PostParams["World_SpawnZ"] )
- end
- if( tonumber( Request.PostParams["World_Seed"] ) ~= nil ) then
- WorldIni:DeleteValue( "Seed", "Seed" )
- WorldIni:SetValue( "Seed", "Seed", Request.PostParams["World_Seed"] )
- end
- if( tonumber( Request.PostParams["World_PVP"] ) ~= nil ) then
- WorldIni:DeleteValue( "PVP", "Enabled" )
- WorldIni:SetValue( "PVP", "Enabled", Request.PostParams["World_PVP"] )
- end
- if( tonumber( Request.PostParams["World_GameMode"] ) ~= nil ) then
- WorldIni:DeleteValue( "GameMode", "GameMode" )
- WorldIni:SetValue( "GameMode", "GameMode", Request.PostParams["World_GameMode"] )
- end
- if( tonumber( Request.PostParams["World_DeepSnow"] ) ~= nil ) then
- WorldIni:DeleteValue( "Physics", "DeepSnow" )
- WorldIni:SetValue( "Physics", "DeepSnow", Request.PostParams["World_DeepSnow"] )
- end
- if( tonumber( Request.PostParams["World_SandInstantFall"] ) ~= nil ) then
- WorldIni:DeleteValue( "Physics", "SandInstantFall" )
- WorldIni:SetValue( "Physics", "SandInstantFall", Request.PostParams["World_SandInstantFall"] )
- end
- if( tonumber( Request.PostParams["World_WaterSimulator"] ) ~= nil ) then
- WorldIni:DeleteValue( "Physics", "WaterSimulator" )
- WorldIni:SetValue( "Physics", "WaterSimulator", Request.PostParams["World_WaterSimulator"] )
- end
- if( tonumber( Request.PostParams["World_LavaSimulator"] ) ~= nil ) then
- WorldIni:DeleteValue( "Physics", "LavaSimulator" )
- WorldIni:SetValue( "Physics", "LavaSimulator", Request.PostParams["World_LavaSimulator"] )
- end
- if( tonumber( Request.PostParams["World_MaxSugarcaneHeight"] ) ~= nil ) then
- WorldIni:DeleteValue( "Plants", "MaxSugarcaneHeight" )
- WorldIni:SetValue( "Plants", "MaxSugarcaneHeight", Request.PostParams["World_MaxSugarcaneHeight"] )
- end
- if( tonumber( Request.PostParams["World_MaxCactusHeight"] ) ~= nil ) then
- WorldIni:DeleteValue( "Plants", "MaxCactusHeight" )
- WorldIni:SetValue( "Plants", "MaxCactusHeight", Request.PostParams["World_MaxCactusHeight"] )
- end
- if( tonumber( Request.PostParams["World_CarrotsBonemealable"] ) ~= nil ) then
- WorldIni:DeleteValue( "Plants", "IsCarrotsBonemealable" )
- WorldIni:SetValue( "Plants", "IsCarrotsBonemealable", Request.PostParams["World_CarrotsBonemealable"] )
- end
- if( tonumber( Request.PostParams["World_CropsBonemealable"] ) ~= nil ) then
- WorldIni:DeleteValue( "Plants", "IsCropsBonemealable" )
- WorldIni:SetValue( "Plants", "IsCropsBonemealable", Request.PostParams["World_CropsBonemealable"] )
- end
- if( tonumber( Request.PostParams["World_GrassBonemealable"] ) ~= nil ) then
- WorldIni:DeleteValue( "Plants", "IsGrassBonemealable" )
- WorldIni:SetValue( "Plants", "IsGrassBonemealable", Request.PostParams["World_GrassBonemealable"] )
- end
- if( tonumber( Request.PostParams["World_SaplingBonemealable"] ) ~= nil ) then
- WorldIni:DeleteValue( "Plants", "IsSaplingBonemealable" )
- WorldIni:SetValue( "Plants", "IsSaplingBonemealable", Request.PostParams["World_SaplingBonemealable"] )
- end
- if( tonumber( Request.PostParams["World_MelonStemBonemealable"] ) ~= nil ) then
- WorldIni:DeleteValue( "Plants", "IsMelonStemBonemealable" )
- WorldIni:SetValue( "Plants", "IsMelonStemBonemealable", Request.PostParams["World_MelonStemBonemealable"] )
- end
- if( tonumber( Request.PostParams["World_MelonBonemealable"] ) ~= nil ) then
- WorldIni:DeleteValue( "Plants", "IsMelonBonemealable" )
- WorldIni:SetValue( "Plants", "IsMelonBonemealable", Request.PostParams["World_MelonBonemealable"] )
- end
- if( tonumber( Request.PostParams["World_PotatoesBonemealable"] ) ~= nil ) then
- WorldIni:DeleteValue( "Plants", "IsPotatoesBonemealable" )
- WorldIni:SetValue( "Plants", "IsPotatoesBonemealable", Request.PostParams["World_PotatoesBonemealable"] )
- end
- if( tonumber( Request.PostParams["World_PumpkinStemBonemealable"] ) ~= nil ) then
- WorldIni:DeleteValue( "Plants", "IsPumpkinStemBonemealable" )
- WorldIni:SetValue( "Plants", "IsPumpkinStemBonemealable", Request.PostParams["World_PumpkinStemBonemealable"] )
- end
- if( tonumber( Request.PostParams["World_PumpkinBonemealable"] ) ~= nil ) then
- WorldIni:DeleteValue( "Plants", "IsPumpkinBonemealable" )
- WorldIni:SetValue( "Plants", "IsPumpkinBonemealable", Request.PostParams["World_PumpkinBonemealable"] )
- end
- if( tonumber( Request.PostParams["World_SugarCaneBonemealable"] ) ~= nil ) then
- WorldIni:DeleteValue( "Plants", "IsSugarCaneBonemealable" )
- WorldIni:SetValue( "Plants", "IsSugarCaneBonemealable", Request.PostParams["World_SugarCaneBonemealable"] )
- end
- if( tonumber( Request.PostParams["World_CactusBonemealable"] ) ~= nil ) then
- WorldIni:DeleteValue( "Plants", "IsCactusBonemealable" )
- WorldIni:SetValue( "Plants", "IsCactusBonemealable", Request.PostParams["World_CactusBonemealable"] )
- end
- if( ( Request.PostParams["World_BiomeGen"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "BiomeGen" )
- WorldIni:SetValue( "Generator", "BiomeGen", Request.PostParams["World_BiomeGen"] )
- end
- if( ( Request.PostParams["World_Biome"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "ConstantBiome" )
- WorldIni:SetValue( "Generator", "ConstantBiome", Request.PostParams["World_Biome"] )
- end
- if( ( Request.PostParams["World_MultiStepMapOceanCellSize"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "MultiStepMapOceanCellSize" )
- WorldIni:SetValue( "Generator", "MultiStepMapOceanCellSize", Request.PostParams["World_MultiStepMapOceanCellSize"] )
- end
- if( ( Request.PostParams["World_MultiStepMapMushroomIslandSize"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "MultiStepMapMushroomIslandSize" )
- WorldIni:SetValue( "Generator", "MultiStepMapMushroomIslandSize", Request.PostParams["World_MultiStepMapMushroomIslandSize"] )
- end
- if( ( Request.PostParams["World_MultiStepMapRiverCellSize"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "MultiStepMapRiverCellSize" )
- WorldIni:SetValue( "Generator", "MultiStepMapRiverCellSize", Request.PostParams["World_MultiStepMapRiverCellSize"] )
- end
- if( ( Request.PostParams["World_MultiStepMapRiverWidth"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "MultiStepMapRiverWidth" )
- WorldIni:SetValue( "Generator", "MultiStepMapRiverWidth", Request.PostParams["World_MultiStepMapRiverWidth"] )
- end
- if( ( Request.PostParams["World_MultiStepMapLandBiomeSize"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "MultiStepMapLandBiomeSize" )
- WorldIni:SetValue( "Generator", "MultiStepMapLandBiomeSize", Request.PostParams["World_MultiStepMapLandBiomeSize"] )
- end
- if( ( Request.PostParams["World_DistortedVoronoiCellSize"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "DistortedVoronoiCellSize" )
- WorldIni:SetValue( "Generator", "DistortedVoronoiCellSize", Request.PostParams["World_DistortedVoronoiCellSize"] )
- end
- if( ( Request.PostParams["World_DistortedVoronoiBiomes"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "DistortedVoronoiBiomes" )
- WorldIni:SetValue( "Generator", "DistortedVoronoiBiomes", Request.PostParams["World_DistortedVoronoiBiomes"] )
- end
- if( ( Request.PostParams["World_VoronoiCellSize"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "VoronoiCellSize" )
- WorldIni:SetValue( "Generator", "VoronoiCellSize", Request.PostParams["World_VoronoiCellSize"] )
- end
- if( ( Request.PostParams["World_VoronoiBiomesdVoronoiBiomes"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "VoronoiBiomes" )
- WorldIni:SetValue( "Generator", "VoronoiBiomes", Request.PostParams["World_VoronoiBiomes"] )
- end
- if( ( Request.PostParams["World_CheckerBoardBiomes"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "CheckerBoardBiomes" )
- WorldIni:SetValue( "Generator", "CheckerBoardBiomes", Request.PostParams["World_CheckerBoardBiomes"] )
- end
- if( ( Request.PostParams["World_CheckerBoardBiomeSize"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "CheckerBoardBiomeSize" )
- WorldIni:SetValue( "Generator", "CheckerBoardBiomeSize", Request.PostParams["World_CheckerBoardBiomeSize"] )
- end
- if( ( Request.PostParams["World_HeightGen"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "HeightGen" )
- WorldIni:SetValue( "Generator", "HeightGen", Request.PostParams["World_HeightGen"] )
- end
- if( ( Request.PostParams["World_FlatHeight"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "FlatHeight" )
- WorldIni:SetValue( "Generator", "FlatHeight", Request.PostParams["World_FlatHeight"] )
- end
- if( ( Request.PostParams["World_CompositionGen"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "CompositionGen" )
- WorldIni:SetValue( "Generator", "CompositionGen", Request.PostParams["World_CompositionGen"] )
- end
- if( ( Request.PostParams["World_Noise3DSeaLevel"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "Noise3DSeaLevel" )
- WorldIni:SetValue( "Generator", "Noise3DSeaLevel", Request.PostParams["World_Noise3DSeaLevel"] )
- end
- if( ( Request.PostParams["World_Noise3DHeightAmplification"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "Noise3DHeightAmplification" )
- WorldIni:SetValue( "Generator", "Noise3DHeightAmplification", Request.PostParams["World_Noise3DHeightAmplification"] )
- end
- if( ( Request.PostParams["World_Noise3DMidPoint"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "Noise3DMidPoint" )
- WorldIni:SetValue( "Generator", "Noise3DMidPoint", Request.PostParams["World_Noise3DMidPoint"] )
- end
- if( ( Request.PostParams["World_Noise3DFrequencyX"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "Noise3DFrequencyX" )
- WorldIni:SetValue( "Generator", "Noise3DFrequencyX", Request.PostParams["World_Noise3DFrequencyX"] )
- end
- if( ( Request.PostParams["World_Noise3DFrequencyY"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "Noise3DFrequencyY" )
- WorldIni:SetValue( "Generator", "Noise3DFrequencyY", Request.PostParams["World_Noise3DFrequencyY"] )
- end
- if( ( Request.PostParams["World_Noise3DFrequencyZ"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "Noise3DFrequencyZ" )
- WorldIni:SetValue( "Generator", "Noise3DFrequencyZ", Request.PostParams["World_Noise3DFrequencyZ"] )
- end
- if( ( Request.PostParams["World_Noise3DAirThreshold"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "Noise3DAirThreshold" )
- WorldIni:SetValue( "Generator", "Noise3DAirThreshold", Request.PostParams["World_Noise3DAirThreshold"] )
- end
- if( ( Request.PostParams["World_ClassicSeaLevel"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "ClassicSeaLevel" )
- WorldIni:SetValue( "Generator", "ClassicSeaLevel", Request.PostParams["World_ClassicSeaLevel"] )
- end
- if( ( Request.PostParams["World_ClassicBeachHeight"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "ClassicBeachHeight" )
- WorldIni:SetValue( "Generator", "ClassicBeachHeight", Request.PostParams["World_ClassicBeachHeight"] )
- end
- if( ( Request.PostParams["World_ClassicBeachDepth"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "ClassicBeachDepth" )
- WorldIni:SetValue( "Generator", "ClassicBeachDepth", Request.PostParams["World_ClassicBeachDepth"] )
- end
- if( ( Request.PostParams["World_ClassicBlockTop"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "ClassicBlockTop" )
- WorldIni:SetValue( "Generator", "ClassicBlockTop", Request.PostParams["World_ClassicBlockTop"] )
- end
- if( ( Request.PostParams["World_ClassicBlockMiddle"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "ClassicBlockMiddle" )
- WorldIni:SetValue( "Generator", "ClassicBlockMiddle", Request.PostParams["World_ClassicBlockMiddle"] )
- end
- if( ( Request.PostParams["World_ClassicBlockBottom"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "ClassicBlockBottom" )
- WorldIni:SetValue( "Generator", "ClassicBlockBottom", Request.PostParams["World_ClassicBlockBottom"] )
- end
- if( ( Request.PostParams["World_ClassicBlockBeach"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "ClassicBlockBeach" )
- WorldIni:SetValue( "Generator", "ClassicBlockBeach", Request.PostParams["World_ClassicBlockBeach"] )
- end
- if( ( Request.PostParams["World_ClassicBlockBeachBottom"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "ClassicBlockBeachBottom" )
- WorldIni:SetValue( "Generator", "ClassicBlockBeachBottom", Request.PostParams["World_ClassicBlockBeachBottom"] )
- end
- if( ( Request.PostParams["World_ClassicBlockSea"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "ClassicBlockSea" )
- WorldIni:SetValue( "Generator", "ClassicBlockSea", Request.PostParams["World_ClassicBlockSea"] )
- end
- if( ( Request.PostParams["World_SameBlockType"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "SameBlockType" )
- WorldIni:SetValue( "Generator", "SameBlockType", Request.PostParams["World_SameBlockType"] )
- end
- if( ( Request.PostParams["World_SameBlockBedrocked"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "SameBlockBedrocked" )
- WorldIni:SetValue( "Generator", "SameBlockBedrocked", Request.PostParams["World_SameBlockBedrocked"] )
- end
- if( ( Request.PostParams["World_Structures"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "Structures" )
- WorldIni:SetValue( "Generator", "Structures", Request.PostParams["World_Structures"] )
- end
- if( ( Request.PostParams["World_Finishers"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "Finishers" )
- WorldIni:SetValue( "Generator", "Finishers", Request.PostParams["World_Finishers"] )
- end
- if( ( Request.PostParams["World_Generator"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "Generator" )
- WorldIni:SetValue( "Generator", "Generator", Request.PostParams["World_Generator"] )
- end
- if( ( Request.PostParams["World_MineShaftsGridSize"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "MineShaftsGridSize" )
- WorldIni:SetValue( "Generator", "MineShaftsGridSize", Request.PostParams["World_MineShaftsGridSize"] )
- end
- if( ( Request.PostParams["World_MineShaftsMaxSystemSize"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "MineShaftsMaxSystemSize" )
- WorldIni:SetValue( "Generator", "MineShaftsMaxSystemSize", Request.PostParams["World_MineShaftsMaxSystemSize"] )
- end
- if( ( Request.PostParams["World_MineShaftsChanceCorridor"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "MineShaftsChanceCorridor" )
- WorldIni:SetValue( "Generator", "MineShaftsChanceCorridor", Request.PostParams["World_MineShaftsChanceCorridor"] )
- end
- if( ( Request.PostParams["World_MineShaftsChanceCrossing"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "MineShaftsChanceCrossing" )
- WorldIni:SetValue( "Generator", "MineShaftsChanceCrossing", Request.PostParams["World_MineShaftsChanceCrossing"] )
- end
- if( ( Request.PostParams["World_MineShaftsChanceStaircase"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "MineShaftsChanceStaircase" )
- WorldIni:SetValue( "Generator", "MineShaftsChanceStaircase", Request.PostParams["World_MineShaftsChanceStaircase"] )
- end
- if( ( Request.PostParams["World_LavaLakesProbability"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "LavaLakesProbability" )
- WorldIni:SetValue( "Generator", "LavaLakesProbability", Request.PostParams["World_LavaLakesProbability"] )
- end
- if( ( Request.PostParams["World_WaterLakesProbability"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "WaterLakesProbability" )
- WorldIni:SetValue( "Generator", "WaterLakesProbability", Request.PostParams["World_WaterLakesProbability"] )
- end
- if( ( Request.PostParams["World_BottomLavaLevel"] ) ~= nil ) then
- WorldIni:DeleteValue( "Generator", "BottomLavaLevel" )
- WorldIni:SetValue( "Generator", "BottomLavaLevel", Request.PostParams["World_BottomLavaLevel"] )
- end
-
- WorldIni:WriteFile()
- end
- Content = Content .. "<h4>World for operations: " .. WORLD .. "</h4>"
- Content = Content .. "<table>"
- local WorldNum = 0
- local AddWorldToTable = function(World)
- WorldNum = WorldNum + 1
- Content = Content .. "<tr>"
- Content = Content .. "<td style='width: 10px;'>" .. WorldNum .. ".</td>"
- Content = Content .. "<td>" .. World:GetName() .. "</td>"
- Content = Content .. "<td>" .. SelectWorldButton(World:GetName()) .. "</td>"
- Content = Content .. "</tr>"
- end
- cRoot:Get():ForEachWorld(AddWorldToTable)
- Content = Content .. "</table>"
-
-
- Content = Content .. [[<table>
- <form method="POST">
- <br />
- <th colspan="2">General</th>
- <tr><td>Dimension:</td>
- <td>]] .. HTML_Select_Dimension("World_Dimension", WorldIni:GetValueI("General", "Dimension") ) .. [[</td></tr>
- </table>
- <br />
- <table>
- <th colspan="2">Storage</th>
- <tr><td>Schema:</td>
- <td>]] .. HTML_Select_Scheme("World_Schema", WorldIni:GetValueI("Storage", "Schema") ) .. [[</td></tr>
- </table>
- <br />
- <table>
- <th colspan="2">Spawn Position</th>
- <tr><td>X:</td>
- <td><input type="text" name="World_SpawnX" value="]] .. WorldIni:GetValue("SpawnPosition", "X") .. [["></td></tr>
- <tr><td>Y:</td>
- <td><input type="text" name="World_SpawnY" value="]] .. WorldIni:GetValue("SpawnPosition", "Y") .. [["></td></tr>
- <tr><td>Z:</td>
- <td><input type="text" name="World_SpawnZ" value="]] .. WorldIni:GetValue("SpawnPosition", "Z") .. [["></td></tr>
- </table>
- <br />
- <table>
- <th colspan="2">Seed</th>
- <tr><td>Seed:</td>
- <td><input type="text" name="World_Seed" value="]] .. WorldIni:GetValue("Seed", "Seed") .. [["></td></tr>
- </table>
- <br />
- <table>
- <th colspan="2">PVP</th>
- <tr><td style="width: 50%;">PVP:</td>
- <td>]] .. HTML_Select_On_Off("World_PVP", WorldIni:GetValueI("PVP", "Enabled") ) .. [[</td></tr>
- </table>
- <br />
- <table>
- <th colspan="2">GameMode</th>
- <tr><td style="width: 50%;">GameMode:</td>
- <td>]] .. HTML_Select_GameMode("World_GameMode", WorldIni:GetValueI("GameMode", "GameMode") ) .. [[</td></tr>
- </table>
- <br />
- <table>
- <th colspan="2">Physics</th>
- <tr><td style="width: 50%;">DeepSnow:</td>
- <td>]] .. HTML_Select_On_Off("World_DeepSnow", WorldIni:GetValueI("Physics", "DeepSnow") ) .. [[</td></tr>
- <tr><td style="width: 50%;">SandInstantFall:</td>
- <td>]] .. HTML_Select_On_Off("World_SandInstantFall", WorldIni:GetValueI("Physics", "SandInstantFall") ) .. [[</td></tr>
- <tr><td style="width: 50%;">WaterSimulator:</td>
- <td>]] .. HTML_Select_Simulator("World_WaterSimulator", WorldIni:GetValue("Physics", "WaterSimulator") ) .. [[</td></tr>
- <tr><td style="width: 50%;">LavaSimulator:</td>
- <td>]] .. HTML_Select_Simulator("World_LavaSimulator", WorldIni:GetValue("Physics", "LavaSimulator") ) .. [[</td></tr>
- </table>
- <br />
- <table>
- <th colspan="2">Plants</th>
- <tr><td>MaxCactusHeight:</td>
- <td><input type="text" name="World_MaxCactusHeight" value="]] .. WorldIni:GetValue("Plants", "MaxCactusHeight") .. [["></td></tr>
- <tr><td>MaxSugarcaneHeigh:</td>
- <td><input type="text" name="World_MaxSugarcaneHeight" value="]] .. WorldIni:GetValue("Plants", "MaxSugarcaneHeight") .. [["></td></tr>
- <tr><td style="width: 50%;">CarrotsBonemealable:</td>
- <td>]] .. HTML_Select_On_Off("World_CarrotsBonemealable", WorldIni:GetValueI("Plants", "IsCarrotsBonemealable") ) .. [[</td></tr>
- <tr><td style="width: 50%;">CropsBonemealable:</td>
- <td>]] .. HTML_Select_On_Off("World_CropsBonemealable", WorldIni:GetValueI("Plants", "IsCropsBonemealable") ) .. [[</td></tr>
- <tr><td style="width: 50%;">GrassBonemealabl:</td>
- <td>]] .. HTML_Select_On_Off("World_GrassBonemealable", WorldIni:GetValueI("Plants", "IsGrassBonemealable") ) .. [[</td></tr>
- <tr><td style="width: 50%;">SaplingBonemealable:</td>
- <td>]] .. HTML_Select_On_Off("World_SaplingBonemealable", WorldIni:GetValueI("Plants", "IsSaplingBonemealable") ) .. [[</td></tr>
- <tr><td style="width: 50%;">MelonStemBonemealable:</td>
- <td>]] .. HTML_Select_On_Off("World_MelonStemBonemealable", WorldIni:GetValueI("Plants", "IsMelonStemBonemealable") ) .. [[</td></tr>
- <tr><td style="width: 50%;">MelonBonemealable:</td>
- <td>]] .. HTML_Select_On_Off("World_MelonBonemealable", WorldIni:GetValueI("Plants", "IsMelonBonemealable") ) .. [[</td></tr>
- <tr><td style="width: 50%;">PotatoesBonemealable:</td>
- <td>]] .. HTML_Select_On_Off("World_PotatoesBonemealable", WorldIni:GetValueI("Plants", "IsPotatoesBonemealable") ) .. [[</td></tr>
- <tr><td style="width: 50%;">PumpkinStemBonemealable:</td>
- <td>]] .. HTML_Select_On_Off("World_PumpkinStemBonemealable", WorldIni:GetValueI("Plants", "IsPumpkinStemBonemealable") ) .. [[</td></tr>
- <tr><td style="width: 50%;">PumpkinBonemealable:</td>
- <td>]] .. HTML_Select_On_Off("World_PumpkinBonemealable", WorldIni:GetValueI("Plants", "IsPumpkinBonemealable") ) .. [[</td></tr>
- <tr><td style="width: 50%;">SugarcaneBonemealabl:</td>
- <td>]] .. HTML_Select_On_Off("World_SugarcaneBonemealable", WorldIni:GetValueI("Plants", "IsSugarcaneBonemealable") ) .. [[</td></tr>
- <tr><td style="width: 50%;">CactusBonemealable:</td>
- <td>]] .. HTML_Select_On_Off("World_CactusBonemealable", WorldIni:GetValueI("Plants", "IsCactusBonemealable") ) .. [[</td></tr>
- </table>
- <br />
- <table>
- <th colspan="2">Generator</th>
- <tr><td style="width: 50%;">BiomeGen:</td>
- <td>]] .. HTML_Select_BiomeGen("World_BiomeGen", WorldIni:GetValue("Generator", "BiomeGen") ) .. [[</td></tr>
- <tr><td style="width: 50%;">HeightGen:</td>
- <td>]] .. HTML_Select_HeightGen("World_HeightGen", WorldIni:GetValue("Generator", "HeightGen") ) .. [[</td></tr>
- <tr><td style="width: 50%;">CompositionGen:</td>
- <td>]] .. HTML_Select_CompositionGen("World_CompositionGen", WorldIni:GetValue("Generator", "CompositionGen") ) .. [[</td></tr>
- <tr><td>Structures:</td>
- <td><input type="text" size="50" name="World_Structures" value="]] .. WorldIni:GetValue("Generator", "Structures") .. [["></td></tr>
- <tr><td>Finishers:</td>
- <td><input type="text" size="50" name="World_Finishers" value="]] .. WorldIni:GetValue("Generator", "Finishers") .. [["></td></tr>
- <tr><td style="width: 50%;">Generator:</td>
- <td>]] .. HTML_Select_Generator("World_Generator", WorldIni:GetValue("Generator", "Generator") ) .. [[</td></tr>
-
- </table>
- <br />
- <table>
- <th colspan="1">Finetuning</th><br />
- </table>
- <table>
- ]]
- if WorldIni:GetValue( "Generator", "BiomeGen" ) == "Constant" then
- Content = Content .. [[
- <th colspan="2">Biome Generator</th>
- <tr><td style="width: 50%;">ConstantBiome:</td>
- <td>]] .. HTML_Select_Biome( "World_Biome", WorldIni:GetValue("Generator", "ConstantBiome" ) ) .. [[</td></tr>]]
- elseif WorldIni:GetValue( "Generator", "BiomeGen" ) == "MultiStepMap" then
- Content = Content .. [[
- <th colspan="2">Biome Generator</th>
- <tr><td>MultiStepMapOceanCellSize:</td>
- <td><input type="text" name="World_MultiStepMapOceanCellSize" value="]] .. WorldIni:GetValue("Generator", "MultiStepMapOceanCellSize") .. [["></td></tr>
- <tr><td>MultiStepMapOceanCellSize:</td>
- <td><input type="text" name="World_MultiStepMapMushroomIslandSize" value="]] .. WorldIni:GetValue("Generator", "MultiStepMapMushroomIslandSize") .. [["></td></tr>
- <tr><td>MultiStepMapOceanCellSize:</td>
- <td><input type="text" name="World_MultiStepMapRiverCellSize" value="]] .. WorldIni:GetValue("Generator", "MultiStepMapRiverCellSize") .. [["></td></tr>
- <tr><td>MultiStepMapOceanCellSize:</td>
- <td><input type="text" name="World_MultiStepMapRiverWidth" value="]] .. WorldIni:GetValue("Generator", "MultiStepMapRiverWidth") .. [["></td></tr>
- <tr><td>MultiStepMapOceanCellSize:</td>
- <td><input type="text" name="World_MultiStepMapLandBiomeSize" value="]] .. WorldIni:GetValue("Generator", "MultiStepMapLandBiomeSize") .. [["></td></tr>]]
- elseif WorldIni:GetValue( "Generator", "BiomeGen" ) == "DistortedVoronoi" then
- Content = Content .. [[
- <th colspan="2">Biome Generator</th>
- <tr><td>DistortedVoronoiCellSize:</td>
- <td><input type="text" name="World_DistortedVoronoiCellSize" value="]] .. WorldIni:GetValue("Generator", "DistortedVoronoiCellSize") .. [["></td></tr>
- <tr><td>DistortedVoronoiBiomes:</td>
- <td><input type="text" name="World_DistortedVoronoiBiomes" value="]] .. WorldIni:GetValue("Generator", "DistortedVoronoiBiomes") .. [["></td></tr>]]
- elseif WorldIni:GetValue( "Generator", "BiomeGen" ) == "Voronoi" then
- Content = Content .. [[
- <th colspan="2">Biome Generator</th>
- <tr><td>VoronoiCellSize:</td>
- <td><input type="text" name="World_VoronoiCellSize" value="]] .. WorldIni:GetValue("Generator", "VoronoiCellSize") .. [["></td></tr>
- <tr><td>VoronoiBiomes:</td>
- <td><input type="text" name="World_VoronoiBiomes" value="]] .. WorldIni:GetValue("Generator", "VoronoiBiomes") .. [["></td></tr>]]
- elseif WorldIni:GetValue( "Generator", "BiomeGen" ) == "CheckerBoard" then
- Content = Content .. [[
- <th colspan="2">Biome Generator</th>
- <tr><td>CheckerBoardBiomes:</td>
- <td><input type="text" name="World_CheckerBoardBiomes" value="]] .. WorldIni:GetValue("Generator", "CheckerBoardBiomes") .. [["></td></tr>
- <tr><td>CheckerBoardBiomeSize:</td>
- <td><input type="text" name="World_CheckerBoardBiomeSize" value="]] .. WorldIni:GetValue("Generator", "CheckerBoardBiomeSize") .. [["></td></tr>]]
- end
-
- if WorldIni:GetValue( "Generator", "CompositionGen" ) == "Noise3D" then
- Content = Content .. [[
- <th colspan="2">Composition Generator</th>
- <tr><td>Noise3DSeaLevel:</td>
- <td><input type="text" name="World_Noise3DSeaLevel" value="]] .. WorldIni:GetValue("Generator", "Noise3DSeaLevel") .. [["></td></tr>
- <tr><td>Noise3DHeightAmplification:</td>
- <td><input type="text" name="World_Noise3DHeightAmplification" value="]] .. WorldIni:GetValue("Generator", "Noise3DHeightAmplification") .. [["></td></tr>
- <tr><td>Noise3DMidPoint:</td>
- <td><input type="text" name="World_Noise3DMidPoint" value="]] .. WorldIni:GetValue("Generator", "Noise3DMidPoint") .. [["></td></tr>
- <tr><td>Noise3DFrequencyX:</td>
- <td><input type="text" name="World_Noise3DFrequencyX" value="]] .. WorldIni:GetValue("Generator", "Noise3DFrequencyX") .. [["></td></tr>
- <tr><td>Noise3DFrequencyY:</td>
- <td><input type="text" name="World_Noise3DFrequencyY" value="]] .. WorldIni:GetValue("Generator", "Noise3DFrequencyY") .. [["></td></tr>
- <tr><td>Noise3DFrequencyZ:</td>
- <td><input type="text" name="World_Noise3DFrequencyZ" value="]] .. WorldIni:GetValue("Generator", "Noise3DFrequencyZ") .. [["></td></tr>
- <tr><td>Noise3DAirThreshold:</td>
- <td><input type="text" name="World_Noise3DAirThreshold" value="]] .. WorldIni:GetValue("Generator", "Noise3DAirThreshold") .. [["></td></tr>]]
- elseif WorldIni:GetValue( "Generator", "CompositionGen" ) == "Classic" then
- Content = Content .. [[
- <th colspan="2">Composition Generator</th>
- <tr><td>ClassicSeaLevel:</td>
- <td><input type="text" name="World_ClassicSeaLevel" value="]] .. WorldIni:GetValue("Generator", "ClassicSeaLevel") .. [["></td></tr>
- <tr><td>ClassicBeachHeight:</td>
- <td><input type="text" name="World_ClassicBeachHeight" value="]] .. WorldIni:GetValue("Generator", "ClassicBeachHeight") .. [["></td></tr>
- <tr><td>ClassicBeachDepth:</td>
- <td><input type="text" name="World_ClassicBeachDepth" value="]] .. WorldIni:GetValue("Generator", "ClassicBeachDepth") .. [["></td></tr>
- <tr><td>ClassicBlockTop:</td>
- <td><input type="text" name="World_ClassicBlockTop" value="]] .. WorldIni:GetValue("Generator", "ClassicBlockTop") .. [["></td></tr>
- <tr><td>ClassicBlockMiddle:</td>
- <td><input type="text" name="World_ClassicBlockMiddle" value="]] .. WorldIni:GetValue("Generator", "ClassicBlockMiddle") .. [["></td></tr>
- <tr><td>ClassicBlockBottom:</td>
- <td><input type="text" name="World_ClassicBlockBottom" value="]] .. WorldIni:GetValue("Generator", "ClassicBlockBottom") .. [["></td></tr>
- <tr><td>ClassicBlockBeach:</td>
- <td><input type="text" name="World_ClassicBlockBeach" value="]] .. WorldIni:GetValue("Generator", "ClassicBlockBeach") .. [["></td></tr>
- <tr><td>ClassicBlockBeachBottom:</td>
- <td><input type="text" name="World_ClassicBlockBeachBottom" value="]] .. WorldIni:GetValue("Generator", "ClassicBlockBeachBottom") .. [["></td></tr>
- <tr><td>ClassicBlockSea:</td>
- <td><input type="text" name="World_ClassicBlockSea" value="]] .. WorldIni:GetValue("Generator", "ClassicBlockSea") .. [["></td></tr>]]
- elseif WorldIni:GetValue( "Generator", "CompositionGen" ) == "SameBlock" then
- Content = Content .. [[
- <th colspan="2">Composition Generator</th>
- <tr><td>SameBlockType:</td>
- <td><input type="text" name="World_SameBlockType" value="]] .. WorldIni:GetValue("Generator", "SameBlockType") .. [["></td></tr>
- <tr><td>SameBlockBedrocked:</td>
- <td><input type="text" name="World_SameBlockBedrocked" value="]] .. WorldIni:GetValue("Generator", "SameBlockBedrocked") .. [["></td></tr>]]
- end
- if WorldIni:GetValue( "Generator", "HeightGen" ) == "Flat" then
- Content = Content .. [[
- <th colspan="2">Height Generator</th>
- <tr><td>FlatHeight:</td>
- <td><input type="text" name="World_FlatHeight" value="]] .. WorldIni:GetValue("Generator", "FlatHeight") .. [["></td></tr>]]
- end
- if string.find( WorldIni:GetValue( "Generator", "Structures" ), "MineShafts" ) ~= nil then
- Content = Content .. [[
- <th colspan="2">MineShafts</th>
- <tr><td>MineShaftsGridSize:</td>
- <td><input type="text" name="World_MineShaftsGridSize" value="]] .. WorldIni:GetValue("Generator", "MineShaftsGridSize") .. [["></td></tr>
- <tr><td>MineShaftsMaxSystemSize:</td>
- <td><input type="text" name="World_MineShaftsMaxSystemSize" value="]] .. WorldIni:GetValue("Generator", "MineShaftsMaxSystemSize") .. [["></td></tr>
- <tr><td>MineShaftsChanceCorridor:</td>
- <td><input type="text" name="World_MineShaftsChanceCorridor" value="]] .. WorldIni:GetValue("Generator", "MineShaftsChanceCorridor") .. [["></td></tr>
- <tr><td>MineShaftsChanceCrossing:</td>
- <td><input type="text" name="World_MineShaftsChanceCrossing" value="]] .. WorldIni:GetValue("Generator", "MineShaftsChanceCrossing") .. [["></td></tr>
- <tr><td>MineShaftsChanceStaircase:</td>
- <td><input type="text" name="World_MineShaftsChanceStaircase" value="]] .. WorldIni:GetValue("Generator", "MineShaftsChanceStaircase") .. [["></td></tr>]]
- end
- if string.find( WorldIni:GetValue( "Generator", "Structures" ), "LavaLakes" ) ~= nil then
- Content = Content .. [[
- <th colspan="2">LavaLakes</th>
- <tr><td>LavaLakesProbability:</td>
- <td><input type="text" name="World_LavaLakesProbability" value="]] .. WorldIni:GetValue("Generator", "LavaLakesProbability") .. [["></td></tr>]]
- end
- if string.find( WorldIni:GetValue( "Generator", "Structures" ), "WaterLakes" ) ~= nil then
- Content = Content .. [[
- <th colspan="2">WaterLakes</th>
- <tr><td>WaterLakesProbability:</td>
- <td><input type="text" name="World_WaterLakesProbability" value="]] .. WorldIni:GetValue("Generator", "WaterLakesProbability") .. [["></td></tr>]]
- end
- if string.find( WorldIni:GetValue( "Generator", "Finishers" ), "BottomLava" ) ~= nil then
- Content = Content .. [[
- <th colspan="2">BottomLavaLevel</th>
- <tr><td>BottomLavaLevel:</td>
- <td><input type="text" name="World_BottomLavaLevel" value="]] .. WorldIni:GetValue("Generator", "BottomLavaLevel") .. [["></td></tr>]]
- end
- Content = Content .. [[</table>]]
-
- Content = Content .. [[ <br />
- <input type="submit" value="Save Settings" name="world_submit"> </form>WARNING: Any changes made here might require a server restart in order to be applied!
- </form>]]
- return Content
-end
-
-
-
-function HandleRequest_ServerSettings( Request )
- local Content = ""
-
- Content = Content .. [[
- <p><b>Server Settings</b></p>
- <table>
- <tr>
- <td><a href="?tab=General">General</a></td>
- <td><a href="?tab=Monsters">Monsters</a></td>
- <td><a href="?tab=Worlds">Worlds</a></td>
- <td><a href="?tab=World">World</a></td>
- </tr>
- </table>
- <br />]]
-
- if( Request.Params["tab"] == "Monsters" ) then
- Content = Content .. ShowMonstersSettings( Request )
- elseif( Request.Params["tab"] == "Worlds" ) then
- Content = Content .. ShowWorldsSettings( Request )
- elseif( Request.Params["tab"] == "World" ) then
- Content = Content .. ShowWorldSettings( Request )
- else
- Content = Content .. ShowGeneralSettings( Request ) -- Default to general settings
- end
-
- return Content
+-- Some HTML helper functions
+local function HTML_Option( value, text, selected )
+ if( selected == true ) then
+ return [[<option value="]] .. value .. [[" selected>]] .. text .. [[</option>]]
+ else
+ return [[<option value="]] .. value .. [[">]] .. text .. [[</option>"]]
+ end
+end
+
+local function HTML_Select_On_Off( name, defaultValue )
+ return [[<select name="]] .. name .. [[">]]
+ .. HTML_Option("1", "On", defaultValue == 1 )
+ .. HTML_Option("0", "Off", defaultValue == 0 )
+ .. [[</select>]]
+end
+
+local function HTML_Select_Version( name, defaultValue )
+ return [[<select name="]] .. name .. [[">]]
+ .. HTML_Option("0", "Latest Version", defaultValue == 0 )
+ .. HTML_Option("61", "1.5.2", defaultValue == 1 )
+ .. HTML_Option("60", "1.5.0", defaultValue == 2 )
+ .. HTML_Option("49", "1.4.5", defaultValue == 3 )
+ .. HTML_Option("47", "1.4.2", defaultValue == 4 )
+ .. HTML_Option("39", "1.3.2", defaultValue == 5 )
+ .. HTML_Option("29", "1.2.5", defaultValue == 6 )
+ .. [[</select>]]
+end
+
+
+local function ShowGeneralSettings( Request )
+ local Content = ""
+ local InfoMsg = nil
+
+ local SettingsIni = cIniFile("settings.ini")
+ if( SettingsIni:ReadFile() == false ) then
+ InfoMsg = "<b style=\"color: red;\">ERROR: Could not read settings.ini!</b>"
+ end
+
+ if( Request.PostParams["general_submit"] ~= nil ) then
+
+ SettingsIni:SetValue("Server", "Description",Request.PostParams["Server_Description"],false )
+ if( tonumber( Request.PostParams["Server_MaxPlayers"] ) ~= nil ) then
+ SettingsIni:SetValue("Server", "MaxPlayers", Request.PostParams["Server_MaxPlayers"], false )
+ end
+ if( tonumber( Request.PostParams["Server_Port"] ) ~= nil ) then
+ if( tonumber( Request.PostParams["Server_Port"] ) > 0 ) then
+ SettingsIni:SetValue("Server", "Port", Request.PostParams["Server_Port"], false )
+ end
+ end
+ if( tonumber( Request.PostParams["Server_PortsIPv6"] ) ~= nil ) then
+ SettingsIni:SetValue("Server", "PortsIPv6", Request.PostParams["Server_PortsIPv6"], false )
+ end
+ if( tonumber( Request.PostParams["Server_Version"] ) ~= nil ) then
+ SettingsIni:SetValue("Server", "PrimaryServerVersion", Request.PostParams["Server_Version"], false )
+ end
+ if( tonumber( Request.PostParams["Authentication_Authenticate"] ) ~= nil ) then
+ SettingsIni:SetValue("Authentication", "Authenticate", Request.PostParams["Authentication_Authenticate"], false )
+ end
+
+ if( SettingsIni:WriteFile() == false ) then
+ InfoMsg = [[<b style="color: red;">ERROR: Could not write to settings.ini!</b>]]
+ else
+ InfoMsg = [[<b style="color: green;">INFO: Successfully saved changes to settings.ini</b>]]
+ end
+ end
+
+
+ Content = Content .. [[
+ <form method="POST">
+ <h4>General Settings</h4>]]
+
+ if( InfoMsg ~= nil ) then
+ Content = Content .. "<p>" .. InfoMsg .. "</p>"
+ end
+ Content = Content .. [[
+ <table>
+ <th colspan="2">Server</th>
+ <tr><td style="width: 50%;">Description:</td>
+ <td><input type="text" name="Server_Description" value="]] .. SettingsIni:GetValue("Server", "Description") .. [["></td></tr>
+ <tr><td>Max Players:</td>
+ <td><input type="text" name="Server_MaxPlayers" value="]] .. SettingsIni:GetValue("Server", "MaxPlayers") .. [["></td></tr>
+ <tr><td>Port:</td>
+ <td><input type="text" name="Server_Port" value="]] .. SettingsIni:GetValue("Server", "Port") .. [["></td></tr>
+ <tr><td>PortsIPv6:</td>
+ <td><input type="text" name="Server_PortsIPv6" value="]] .. SettingsIni:GetValue("Server", "PortsIPv6") .. [["></td></tr>
+ <tr><td>Shown Version:</td>
+ <td>]] .. HTML_Select_Version("Server_Version", SettingsIni:GetValueI("Server", "PrimaryServerVersion") ) .. [[</td></tr>
+ </table><br />
+
+ <table>
+ <th colspan="2">Authentication</th>
+ <tr><td style="width: 50%;">Authenticate:</td>
+ <td>]] .. HTML_Select_On_Off("Authentication_Authenticate", SettingsIni:GetValueI("Authentication", "Authenticate") ) .. [[</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>]]
+
+ return Content
+end
+
+
+local function ShowMonstersSettings( Request )
+ local Content = ""
+ local InfoMsg = nil
+
+ local SettingsIni = cIniFile("settings.ini")
+ if( SettingsIni:ReadFile() == false ) then
+ InfoMsg = "<b style=\"color: red;\">ERROR: Could not read settings.ini!</b>"
+ end
+
+ if( Request.PostParams["monsters_submit"] ~= nil ) then
+
+ if( tonumber( Request.PostParams["Monsters_AnimalsOn"] ) ~= nil ) then
+ SettingsIni:SetValue("Monsters", "AnimalsOn", Request.PostParams["Monsters_AnimalsOn"], false )
+ end
+ if( tonumber( Request.PostParams["Monsters_AnimalSpawnInterval"] ) ~= nil ) then
+ SettingsIni:SetValue("Monsters", "AnimalSpawnInterval", Request.PostParams["Monsters_AnimalSpawnInterval"], false )
+ end
+ SettingsIni:SetValue("Monsters", "Types", Request.PostParams["Monsters_Types"], false )
+ if( SettingsIni:WriteFile() == false ) then
+ InfoMsg = "<b style=\"color: red;\">ERROR: Could not write to settings.ini!</b>"
+ else
+ InfoMsg = "<b style=\"color: green;\">INFO: Successfully saved changes to settings.ini</b>"
+ end
+ end
+
+
+ Content = Content .. "<form method=\"POST\">"
+
+ Content = Content .. "<h4>Monsters Settings</h4>"
+ if( InfoMsg ~= nil ) then
+ Content = Content .. "<p>" .. InfoMsg .. "</p>"
+ end
+
+ Content = Content .. [[
+ <table>
+ <th colspan="2">Monsters</th>
+ <tr><td style="width: 50%;">Animals On:</td>
+ <td>]] .. HTML_Select_On_Off("Monsters_AnimalsOn", SettingsIni:GetValueI("Monsters", "AnimalsOn") ) .. [[</td></tr>
+ <tr><td>Animal Spawn Interval:</td>
+ <td><input type="text" name="Monsters_AnimalSpawnInterval" value="]] .. SettingsIni:GetValue("Monsters", "AnimalSpawnInterval") .. [["></td></tr>
+ <tr><td>Monster Types:</td>
+ <td><input type="text" name="Monsters_Types" value="]] .. SettingsIni:GetValue("Monsters", "Types") .. [["></td></tr>
+ </table><br />
+ <input type="submit" value="Save Settings" name="monsters_submit"> WARNING: Any changes made here might require a server restart in order to be applied!
+ </form>]]
+
+ return Content
+end
+
+local function ShowWorldsSettings( Request )
+ local Content = ""
+ local InfoMsg = nil
+ local bSaveIni = false
+
+ local SettingsIni = cIniFile("settings.ini")
+ if( SettingsIni:ReadFile() == false ) then
+ InfoMsg = [[<b style="color: red;">ERROR: Could not read settings.ini!</b>]]
+ end
+
+ if( Request.PostParams["RemoveWorld"] ~= nil ) then
+ Content = Content .. Request.PostParams["RemoveWorld"]
+ local WorldIdx = string.sub( Request.PostParams["RemoveWorld"], string.len("Remove ") )
+ local KeyIdx = SettingsIni:FindKey("Worlds")
+ local WorldName = SettingsIni:GetValue( KeyIdx, WorldIdx )
+ if( SettingsIni:DeleteValueByID( KeyIdx, WorldIdx ) == true ) then
+ InfoMsg = "<b style=\"color: green;\">INFO: Successfully removed world " .. WorldName .. "!</b><br />"
+ bSaveIni = true
+ end
+ end
+
+ if( Request.PostParams["AddWorld"] ~= nil ) then
+ if( Request.PostParams["WorldName"] ~= nil and Request.PostParams["WorldName"] ~= "" ) then
+ SettingsIni:SetValue("Worlds", "World", Request.PostParams["WorldName"], true )
+ InfoMsg = "<b style=\"color: green;\">INFO: Successfully added world " .. Request.PostParams["WorldName"] .. "!</b><br />"
+ bSaveIni = true
+ end
+ end
+
+ if( Request.PostParams["worlds_submit"] ~= nil ) then
+ SettingsIni:SetValue("Worlds", "DefaultWorld", Request.PostParams["Worlds_DefaultWorld"], false )
+ if( Request.PostParams["Worlds_World"] ~= nil ) then
+ SettingsIni:SetValue("Worlds", "World", Request.PostParams["Worlds_World"], true )
+ end
+ bSaveIni = true
+ end
+
+ if( bSaveIni == true ) then
+ if( InfoMsg == nil ) then InfoMsg = "" end
+ if( SettingsIni:WriteFile() == false ) then
+ InfoMsg = InfoMsg .. "<b style=\"color: red;\">ERROR: Could not write to settings.ini!</b>"
+ else
+ InfoMsg = InfoMsg .. "<b style=\"color: green;\">INFO: Successfully saved changes to settings.ini</b>"
+ end
+ end
+
+ Content = Content .. "<h4>Worlds Settings</h4>"
+ if( InfoMsg ~= nil ) then
+ Content = Content .. "<p>" .. InfoMsg .. "</p>"
+ end
+
+ Content = Content .. [[
+ <form method="POST">
+ <table>
+ <th colspan="2">Worlds</th>
+ <tr><td style="width: 50%;">Default World:</td>
+ <td><input type="Submit" name="Worlds_DefaultWorld" value="]] .. SettingsIni:GetValue("Worlds", "DefaultWorld") .. [["></td></tr>]]
+
+ local KeyIdx = SettingsIni:FindKey("Worlds")
+ local NumValues = SettingsIni:GetNumValues( KeyIdx )
+ for i = 0, NumValues-1 do
+ local ValueName = SettingsIni:GetValueName(KeyIdx, i )
+ if( ValueName == "World" ) then
+ local WorldName = SettingsIni:GetValue(KeyIdx, i)
+ Content = Content .. [[
+ <tr><td>]] .. ValueName .. [[:</td><td><div style="width: 100px; display: inline-block;">]] .. WorldName .. [[</div><input type="submit" value="Remove ]] .. i .. [[" name="RemoveWorld"></td></tr>]]
+ end
+ end
+
+ Content = Content .. [[
+ <tr><td>Add World:</td>
+ <td><input type='text' name='WorldName'><input type='submit' name='AddWorld' value='Add World'></td></tr>
+ </table><br />
+
+ <input type="submit" value="Save Settings" name="worlds_submit"> WARNING: Any changes made here might require a server restart in order to be applied!
+ </form>]]
+ return Content
+end
+
+local function SelectWorldButton( WorldName )
+ return "<form method='POST'><input type='hidden' name='WorldName' value='"..WorldName.."'><input type='submit' name='SelectWorld' value='Select'></form>"
+end
+
+local function HTML_Select_Dimension( name, defaultValue )
+ return [[<select name="]] .. name .. [[">]]
+ .. HTML_Option("0", "Overworld", defaultValue == 0 )
+ .. HTML_Option("-1", "Nether", defaultValue == 1 )
+ .. HTML_Option("1", "The End", defaultValue == 2 )
+ .. [[</select>]]
+end
+
+local function HTML_Select_Scheme( name, defaultValue )
+ return [[<select name="]] .. name .. [[">]]
+ .. HTML_Option("Default", "Default", defaultValue == "Default" )
+ .. HTML_Option("Forgetful", "Forgetful", defaultValue == "Forgetful" )
+ .. HTML_Option("Compact", "Compact", defaultValue == "Compact" )
+ .. [[</select>]]
+end
+
+local function HTML_Select_GameMode( name, defaultValue )
+ return [[<select name="]] .. name .. [[">]]
+ .. HTML_Option("0", "Survival", defaultValue == 0 )
+ .. HTML_Option("1", "Creative", defaultValue == 1 )
+ .. HTML_Option("2", "Adventure", defaultValue == 2 )
+ .. [[</select>]]
+end
+
+local function HTML_Select_Simulator( name, defaultValue )
+ return [[<select name="]] .. name .. [[">]]
+ .. HTML_Option("Floody", "Floody", defaultValue == 0 )
+ .. HTML_Option("Noop", "Noop", defaultValue == 1 )
+ .. HTML_Option("Vaporize", "Vaporize", defaultValue == 2 )
+ .. [[</select>]]
+end
+
+local function HTML_Select_BiomeGen( name, defaultValue )
+ return [[<select name="]] .. name .. [[">]]
+ .. HTML_Option("MultiStepMap", "MultiStepMap", defaultValue == "MultiStepMap" )
+ .. HTML_Option("DistortedVoronoi", "DistortedVoronoi", defaultValue == "DistortedVoronoi" )
+ .. HTML_Option("Voronoi", "Voronoi", defaultValue == "Voronoi" )
+ .. HTML_Option("CheckerBoard", "CheckerBoard", defaultValue == "CheckerBoard" )
+ .. HTML_Option("Constant", "Constant", defaultValue == "Constant" )
+ .. [[</select>]]
+end
+
+local function HTML_Select_HeightGen( name, defaultValue )
+ return [[<select name="]] .. name .. [[">]]
+ .. HTML_Option("Noise3D", "Noise3D", defaultValue == "Noise3D" )
+ .. HTML_Option("Biomal", "Biomal", defaultValue == "Biomal" )
+ .. HTML_Option("Classic", "Classic", defaultValue == "Classic" )
+ .. HTML_Option("Flat", "Flat", defaultValue == "Flat" )
+ .. [[</select>]]
+end
+
+local function HTML_Select_CompositionGen( name, defaultValue )
+ return [[<select name="]] .. name .. [[">]]
+ .. HTML_Option("Noise3D", "Noise3D", defaultValue == "Noise3D" )
+ .. HTML_Option("Biomal", "Biomal", defaultValue == "Biomal" )
+ .. HTML_Option("Classic", "Classic", defaultValue == "Classic" )
+ .. HTML_Option("SameBlock", "SameBlock", defaultValue == "SameBlock" )
+ .. HTML_Option("DebugBiomes", "DebugBiomes", defaultValue == "DebugBiomes" )
+ .. [[</select>]]
+end
+
+local function HTML_Select_Generator( name, defaultValue )
+ return [[<select name="]] .. name .. [[">]]
+ .. HTML_Option("Composable", "Composable", defaultValue == "Composable" )
+ .. [[</select>]]
+end
+
+local function HTML_Select_Biome( name, defaultValue )
+ return [[<select name="]] .. name .. [[">]]
+ .. HTML_Option("Ocean", "Ocean", defaultValue == "Ocean" )
+ .. HTML_Option("Plains", "Plains", defaultValue == "Plains" )
+ .. HTML_Option("Extreme Hills", "Extreme Hills", defaultValue == "Extreme Hills" )
+ .. HTML_Option("Forest", "Forest", defaultValue == "Forest" )
+ .. HTML_Option("Taiga", "Taiga", defaultValue == "Taiga" )
+ .. HTML_Option("Swampland", "Swampland", defaultValue == "Swampland" )
+ .. HTML_Option("River", "River", defaultValue == "River" )
+ .. HTML_Option("Hell", "Hell", defaultValue == "Hell" )
+ .. HTML_Option("Sky", "Sky", defaultValue == "Sky" )
+ .. HTML_Option("FrozenOcean", "FrozenOcean", defaultValue == "FrozenOcean" )
+ .. HTML_Option("FrozenRiver", "FrozenRiver", defaultValue == "FrozenRiver" )
+ .. HTML_Option("Ice Plains", "Ice Plains", defaultValue == "Ice Plains" )
+ .. HTML_Option("Ice Mountains", "Ice Mountains", defaultValue == "Ice Mountains" )
+ .. HTML_Option("MushroomIsland", "MushroomIsland", defaultValue == "MushroomIsland" )
+ .. HTML_Option("MushroomIslandShore", "MushroomIslandShore", defaultValue == "MushroomIslandShore" )
+ .. HTML_Option("Beach", "Beach", defaultValue == "Beach" )
+ .. HTML_Option("DesertHills", "DesertHills", defaultValue == "DesertHills" )
+ .. HTML_Option("ForestHills", "ForestHills", defaultValue == "ForestHills" )
+ .. HTML_Option("TaigaHills", "TaigaHills", defaultValue == "TaigaHills" )
+ .. HTML_Option("Extreme Hills Edge", "Extreme Hills Edge", defaultValue == "Extreme Hills Edge" )
+ .. HTML_Option("Jungle", "Jungle", defaultValue == "Jungle" )
+ .. HTML_Option("JungleHills", "JungleHills", defaultValue == "JungleHills" )
+ .. [[</select>]]
+end
+
+function ShowWorldSettings( Request )
+ local Content = ""
+ local InfoMsg = nil
+ local SettingsIni = cIniFile("settings.ini")
+ if( SettingsIni:ReadFile() == false ) then
+ InfoMsg = [[<b style="color: red;">ERROR: Could not read settings.ini!</b>]]
+ end
+ if (Request.PostParams["SelectWorld"] ~= nil and Request.PostParams["WorldName"] ~= nil) then -- World is selected!
+ WORLD = Request.PostParams["WorldName"]
+ SelectedWorld = cRoot:Get():GetWorld(WORLD)
+ elseif SelectedWorld == nil then
+ WORLD = SettingsIni:GetValue("Worlds", "DefaultWorld")
+ SelectedWorld = cRoot:Get():GetWorld( WORLD )
+ end
+ local WorldIni = cIniFile(SelectedWorld:GetName() .. "/world.ini")
+ WorldIni:ReadFile()
+ if (Request.PostParams["world_submit"]) ~= nil then
+ if( tonumber( Request.PostParams["World_Dimension"] ) ~= nil ) then
+ WorldIni:DeleteValue( "General", "Dimension" )
+ WorldIni:SetValue( "General", "Dimension", Request.PostParams["World_Dimension"] )
+ end
+ if( tonumber( Request.PostParams["World_Schema"] ) ~= nil ) then
+ WorldIni:DeleteValue( "General", "Schema" )
+ WorldIni:SetValue( "General", "Schema", Request.PostParams["World_Schema"] )
+ end
+ if( tonumber( Request.PostParams["World_SpawnX"] ) ~= nil ) then
+ WorldIni:DeleteValue( "SpawnPosition", "X" )
+ WorldIni:SetValue( "SpawnPosition", "X", Request.PostParams["World_SpawnX"] )
+ end
+ if( tonumber( Request.PostParams["World_SpawnY"] ) ~= nil ) then
+ WorldIni:DeleteValue( "SpawnPosition", "Y" )
+ WorldIni:SetValue( "SpawnPosition", "Y", Request.PostParams["World_SpawnY"] )
+ end
+ if( tonumber( Request.PostParams["World_SpawnZ"] ) ~= nil ) then
+ 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"] )
+ end
+ if( tonumber( Request.PostParams["World_PVP"] ) ~= nil ) then
+ WorldIni:DeleteValue( "PVP", "Enabled" )
+ WorldIni:SetValue( "PVP", "Enabled", Request.PostParams["World_PVP"] )
+ end
+ if( tonumber( Request.PostParams["World_GameMode"] ) ~= nil ) then
+ WorldIni:DeleteValue( "GameMode", "GameMode" )
+ WorldIni:SetValue( "GameMode", "GameMode", Request.PostParams["World_GameMode"] )
+ end
+ if( tonumber( Request.PostParams["World_DeepSnow"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Physics", "DeepSnow" )
+ WorldIni:SetValue( "Physics", "DeepSnow", Request.PostParams["World_DeepSnow"] )
+ end
+ if( tonumber( Request.PostParams["World_SandInstantFall"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Physics", "SandInstantFall" )
+ WorldIni:SetValue( "Physics", "SandInstantFall", Request.PostParams["World_SandInstantFall"] )
+ end
+ if( tonumber( Request.PostParams["World_WaterSimulator"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Physics", "WaterSimulator" )
+ WorldIni:SetValue( "Physics", "WaterSimulator", Request.PostParams["World_WaterSimulator"] )
+ end
+ if( tonumber( Request.PostParams["World_LavaSimulator"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Physics", "LavaSimulator" )
+ WorldIni:SetValue( "Physics", "LavaSimulator", Request.PostParams["World_LavaSimulator"] )
+ end
+ if( tonumber( Request.PostParams["World_MaxSugarcaneHeight"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Plants", "MaxSugarcaneHeight" )
+ WorldIni:SetValue( "Plants", "MaxSugarcaneHeight", Request.PostParams["World_MaxSugarcaneHeight"] )
+ end
+ if( tonumber( Request.PostParams["World_MaxCactusHeight"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Plants", "MaxCactusHeight" )
+ WorldIni:SetValue( "Plants", "MaxCactusHeight", Request.PostParams["World_MaxCactusHeight"] )
+ end
+ if( tonumber( Request.PostParams["World_CarrotsBonemealable"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Plants", "IsCarrotsBonemealable" )
+ WorldIni:SetValue( "Plants", "IsCarrotsBonemealable", Request.PostParams["World_CarrotsBonemealable"] )
+ end
+ if( tonumber( Request.PostParams["World_CropsBonemealable"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Plants", "IsCropsBonemealable" )
+ WorldIni:SetValue( "Plants", "IsCropsBonemealable", Request.PostParams["World_CropsBonemealable"] )
+ end
+ if( tonumber( Request.PostParams["World_GrassBonemealable"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Plants", "IsGrassBonemealable" )
+ WorldIni:SetValue( "Plants", "IsGrassBonemealable", Request.PostParams["World_GrassBonemealable"] )
+ end
+ if( tonumber( Request.PostParams["World_SaplingBonemealable"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Plants", "IsSaplingBonemealable" )
+ WorldIni:SetValue( "Plants", "IsSaplingBonemealable", Request.PostParams["World_SaplingBonemealable"] )
+ end
+ if( tonumber( Request.PostParams["World_MelonStemBonemealable"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Plants", "IsMelonStemBonemealable" )
+ WorldIni:SetValue( "Plants", "IsMelonStemBonemealable", Request.PostParams["World_MelonStemBonemealable"] )
+ end
+ if( tonumber( Request.PostParams["World_MelonBonemealable"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Plants", "IsMelonBonemealable" )
+ WorldIni:SetValue( "Plants", "IsMelonBonemealable", Request.PostParams["World_MelonBonemealable"] )
+ end
+ if( tonumber( Request.PostParams["World_PotatoesBonemealable"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Plants", "IsPotatoesBonemealable" )
+ WorldIni:SetValue( "Plants", "IsPotatoesBonemealable", Request.PostParams["World_PotatoesBonemealable"] )
+ end
+ if( tonumber( Request.PostParams["World_PumpkinStemBonemealable"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Plants", "IsPumpkinStemBonemealable" )
+ WorldIni:SetValue( "Plants", "IsPumpkinStemBonemealable", Request.PostParams["World_PumpkinStemBonemealable"] )
+ end
+ if( tonumber( Request.PostParams["World_PumpkinBonemealable"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Plants", "IsPumpkinBonemealable" )
+ WorldIni:SetValue( "Plants", "IsPumpkinBonemealable", Request.PostParams["World_PumpkinBonemealable"] )
+ end
+ if( tonumber( Request.PostParams["World_SugarCaneBonemealable"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Plants", "IsSugarCaneBonemealable" )
+ WorldIni:SetValue( "Plants", "IsSugarCaneBonemealable", Request.PostParams["World_SugarCaneBonemealable"] )
+ end
+ if( tonumber( Request.PostParams["World_CactusBonemealable"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Plants", "IsCactusBonemealable" )
+ WorldIni:SetValue( "Plants", "IsCactusBonemealable", Request.PostParams["World_CactusBonemealable"] )
+ end
+ if( ( Request.PostParams["World_BiomeGen"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "BiomeGen" )
+ WorldIni:SetValue( "Generator", "BiomeGen", Request.PostParams["World_BiomeGen"] )
+ end
+ if( ( Request.PostParams["World_Biome"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "ConstantBiome" )
+ WorldIni:SetValue( "Generator", "ConstantBiome", Request.PostParams["World_Biome"] )
+ end
+ if( ( Request.PostParams["World_MultiStepMapOceanCellSize"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "MultiStepMapOceanCellSize" )
+ WorldIni:SetValue( "Generator", "MultiStepMapOceanCellSize", Request.PostParams["World_MultiStepMapOceanCellSize"] )
+ end
+ if( ( Request.PostParams["World_MultiStepMapMushroomIslandSize"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "MultiStepMapMushroomIslandSize" )
+ WorldIni:SetValue( "Generator", "MultiStepMapMushroomIslandSize", Request.PostParams["World_MultiStepMapMushroomIslandSize"] )
+ end
+ if( ( Request.PostParams["World_MultiStepMapRiverCellSize"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "MultiStepMapRiverCellSize" )
+ WorldIni:SetValue( "Generator", "MultiStepMapRiverCellSize", Request.PostParams["World_MultiStepMapRiverCellSize"] )
+ end
+ if( ( Request.PostParams["World_MultiStepMapRiverWidth"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "MultiStepMapRiverWidth" )
+ WorldIni:SetValue( "Generator", "MultiStepMapRiverWidth", Request.PostParams["World_MultiStepMapRiverWidth"] )
+ end
+ if( ( Request.PostParams["World_MultiStepMapLandBiomeSize"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "MultiStepMapLandBiomeSize" )
+ WorldIni:SetValue( "Generator", "MultiStepMapLandBiomeSize", Request.PostParams["World_MultiStepMapLandBiomeSize"] )
+ end
+ if( ( Request.PostParams["World_DistortedVoronoiCellSize"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "DistortedVoronoiCellSize" )
+ WorldIni:SetValue( "Generator", "DistortedVoronoiCellSize", Request.PostParams["World_DistortedVoronoiCellSize"] )
+ end
+ if( ( Request.PostParams["World_DistortedVoronoiBiomes"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "DistortedVoronoiBiomes" )
+ WorldIni:SetValue( "Generator", "DistortedVoronoiBiomes", Request.PostParams["World_DistortedVoronoiBiomes"] )
+ end
+ if( ( Request.PostParams["World_VoronoiCellSize"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "VoronoiCellSize" )
+ WorldIni:SetValue( "Generator", "VoronoiCellSize", Request.PostParams["World_VoronoiCellSize"] )
+ end
+ if( ( Request.PostParams["World_VoronoiBiomesdVoronoiBiomes"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "VoronoiBiomes" )
+ WorldIni:SetValue( "Generator", "VoronoiBiomes", Request.PostParams["World_VoronoiBiomes"] )
+ end
+ if( ( Request.PostParams["World_CheckerBoardBiomes"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "CheckerBoardBiomes" )
+ WorldIni:SetValue( "Generator", "CheckerBoardBiomes", Request.PostParams["World_CheckerBoardBiomes"] )
+ end
+ if( ( Request.PostParams["World_CheckerBoardBiomeSize"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "CheckerBoardBiomeSize" )
+ WorldIni:SetValue( "Generator", "CheckerBoardBiomeSize", Request.PostParams["World_CheckerBoardBiomeSize"] )
+ end
+ if( ( Request.PostParams["World_HeightGen"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "HeightGen" )
+ WorldIni:SetValue( "Generator", "HeightGen", Request.PostParams["World_HeightGen"] )
+ end
+ if( ( Request.PostParams["World_FlatHeight"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "FlatHeight" )
+ WorldIni:SetValue( "Generator", "FlatHeight", Request.PostParams["World_FlatHeight"] )
+ end
+ if( ( Request.PostParams["World_CompositionGen"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "CompositionGen" )
+ WorldIni:SetValue( "Generator", "CompositionGen", Request.PostParams["World_CompositionGen"] )
+ end
+ if( ( Request.PostParams["World_Noise3DSeaLevel"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "Noise3DSeaLevel" )
+ WorldIni:SetValue( "Generator", "Noise3DSeaLevel", Request.PostParams["World_Noise3DSeaLevel"] )
+ end
+ if( ( Request.PostParams["World_Noise3DHeightAmplification"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "Noise3DHeightAmplification" )
+ WorldIni:SetValue( "Generator", "Noise3DHeightAmplification", Request.PostParams["World_Noise3DHeightAmplification"] )
+ end
+ if( ( Request.PostParams["World_Noise3DMidPoint"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "Noise3DMidPoint" )
+ WorldIni:SetValue( "Generator", "Noise3DMidPoint", Request.PostParams["World_Noise3DMidPoint"] )
+ end
+ if( ( Request.PostParams["World_Noise3DFrequencyX"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "Noise3DFrequencyX" )
+ WorldIni:SetValue( "Generator", "Noise3DFrequencyX", Request.PostParams["World_Noise3DFrequencyX"] )
+ end
+ if( ( Request.PostParams["World_Noise3DFrequencyY"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "Noise3DFrequencyY" )
+ WorldIni:SetValue( "Generator", "Noise3DFrequencyY", Request.PostParams["World_Noise3DFrequencyY"] )
+ end
+ if( ( Request.PostParams["World_Noise3DFrequencyZ"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "Noise3DFrequencyZ" )
+ WorldIni:SetValue( "Generator", "Noise3DFrequencyZ", Request.PostParams["World_Noise3DFrequencyZ"] )
+ end
+ if( ( Request.PostParams["World_Noise3DAirThreshold"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "Noise3DAirThreshold" )
+ WorldIni:SetValue( "Generator", "Noise3DAirThreshold", Request.PostParams["World_Noise3DAirThreshold"] )
+ end
+ if( ( Request.PostParams["World_ClassicSeaLevel"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "ClassicSeaLevel" )
+ WorldIni:SetValue( "Generator", "ClassicSeaLevel", Request.PostParams["World_ClassicSeaLevel"] )
+ end
+ if( ( Request.PostParams["World_ClassicBeachHeight"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "ClassicBeachHeight" )
+ WorldIni:SetValue( "Generator", "ClassicBeachHeight", Request.PostParams["World_ClassicBeachHeight"] )
+ end
+ if( ( Request.PostParams["World_ClassicBeachDepth"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "ClassicBeachDepth" )
+ WorldIni:SetValue( "Generator", "ClassicBeachDepth", Request.PostParams["World_ClassicBeachDepth"] )
+ end
+ if( ( Request.PostParams["World_ClassicBlockTop"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "ClassicBlockTop" )
+ WorldIni:SetValue( "Generator", "ClassicBlockTop", Request.PostParams["World_ClassicBlockTop"] )
+ end
+ if( ( Request.PostParams["World_ClassicBlockMiddle"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "ClassicBlockMiddle" )
+ WorldIni:SetValue( "Generator", "ClassicBlockMiddle", Request.PostParams["World_ClassicBlockMiddle"] )
+ end
+ if( ( Request.PostParams["World_ClassicBlockBottom"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "ClassicBlockBottom" )
+ WorldIni:SetValue( "Generator", "ClassicBlockBottom", Request.PostParams["World_ClassicBlockBottom"] )
+ end
+ if( ( Request.PostParams["World_ClassicBlockBeach"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "ClassicBlockBeach" )
+ WorldIni:SetValue( "Generator", "ClassicBlockBeach", Request.PostParams["World_ClassicBlockBeach"] )
+ end
+ if( ( Request.PostParams["World_ClassicBlockBeachBottom"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "ClassicBlockBeachBottom" )
+ WorldIni:SetValue( "Generator", "ClassicBlockBeachBottom", Request.PostParams["World_ClassicBlockBeachBottom"] )
+ end
+ if( ( Request.PostParams["World_ClassicBlockSea"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "ClassicBlockSea" )
+ WorldIni:SetValue( "Generator", "ClassicBlockSea", Request.PostParams["World_ClassicBlockSea"] )
+ end
+ if( ( Request.PostParams["World_SameBlockType"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "SameBlockType" )
+ WorldIni:SetValue( "Generator", "SameBlockType", Request.PostParams["World_SameBlockType"] )
+ end
+ if( ( Request.PostParams["World_SameBlockBedrocked"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "SameBlockBedrocked" )
+ WorldIni:SetValue( "Generator", "SameBlockBedrocked", Request.PostParams["World_SameBlockBedrocked"] )
+ end
+ if( ( Request.PostParams["World_Structures"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "Structures" )
+ WorldIni:SetValue( "Generator", "Structures", Request.PostParams["World_Structures"] )
+ end
+ if( ( Request.PostParams["World_Finishers"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "Finishers" )
+ WorldIni:SetValue( "Generator", "Finishers", Request.PostParams["World_Finishers"] )
+ end
+ if( ( Request.PostParams["World_Generator"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "Generator" )
+ WorldIni:SetValue( "Generator", "Generator", Request.PostParams["World_Generator"] )
+ end
+ if( ( Request.PostParams["World_MineShaftsGridSize"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "MineShaftsGridSize" )
+ WorldIni:SetValue( "Generator", "MineShaftsGridSize", Request.PostParams["World_MineShaftsGridSize"] )
+ end
+ if( ( Request.PostParams["World_MineShaftsMaxSystemSize"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "MineShaftsMaxSystemSize" )
+ WorldIni:SetValue( "Generator", "MineShaftsMaxSystemSize", Request.PostParams["World_MineShaftsMaxSystemSize"] )
+ end
+ if( ( Request.PostParams["World_MineShaftsChanceCorridor"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "MineShaftsChanceCorridor" )
+ WorldIni:SetValue( "Generator", "MineShaftsChanceCorridor", Request.PostParams["World_MineShaftsChanceCorridor"] )
+ end
+ if( ( Request.PostParams["World_MineShaftsChanceCrossing"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "MineShaftsChanceCrossing" )
+ WorldIni:SetValue( "Generator", "MineShaftsChanceCrossing", Request.PostParams["World_MineShaftsChanceCrossing"] )
+ end
+ if( ( Request.PostParams["World_MineShaftsChanceStaircase"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "MineShaftsChanceStaircase" )
+ WorldIni:SetValue( "Generator", "MineShaftsChanceStaircase", Request.PostParams["World_MineShaftsChanceStaircase"] )
+ end
+ if( ( Request.PostParams["World_LavaLakesProbability"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "LavaLakesProbability" )
+ WorldIni:SetValue( "Generator", "LavaLakesProbability", Request.PostParams["World_LavaLakesProbability"] )
+ end
+ if( ( Request.PostParams["World_WaterLakesProbability"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "WaterLakesProbability" )
+ WorldIni:SetValue( "Generator", "WaterLakesProbability", Request.PostParams["World_WaterLakesProbability"] )
+ end
+ if( ( Request.PostParams["World_BottomLavaLevel"] ) ~= nil ) then
+ WorldIni:DeleteValue( "Generator", "BottomLavaLevel" )
+ WorldIni:SetValue( "Generator", "BottomLavaLevel", Request.PostParams["World_BottomLavaLevel"] )
+ end
+
+ WorldIni:WriteFile()
+ end
+ Content = Content .. "<h4>World for operations: " .. WORLD .. "</h4>"
+ Content = Content .. "<table>"
+ local WorldNum = 0
+ local AddWorldToTable = function(World)
+ WorldNum = WorldNum + 1
+ Content = Content .. "<tr>"
+ Content = Content .. "<td style='width: 10px;'>" .. WorldNum .. ".</td>"
+ Content = Content .. "<td>" .. World:GetName() .. "</td>"
+ Content = Content .. "<td>" .. SelectWorldButton(World:GetName()) .. "</td>"
+ Content = Content .. "</tr>"
+ end
+ cRoot:Get():ForEachWorld(AddWorldToTable)
+ Content = Content .. "</table>"
+
+
+ Content = Content .. [[<table>
+ <form method="POST">
+ <br />
+ <th colspan="2">General</th>
+ <tr><td>Dimension:</td>
+ <td>]] .. HTML_Select_Dimension("World_Dimension", WorldIni:GetValueI("General", "Dimension") ) .. [[</td></tr>
+ </table>
+ <br />
+ <table>
+ <th colspan="2">Storage</th>
+ <tr><td>Schema:</td>
+ <td>]] .. HTML_Select_Scheme("World_Schema", WorldIni:GetValueI("Storage", "Schema") ) .. [[</td></tr>
+ </table>
+ <br />
+ <table>
+ <th colspan="2">Spawn Position</th>
+ <tr><td>X:</td>
+ <td><input type="text" name="World_SpawnX" value="]] .. WorldIni:GetValue("SpawnPosition", "X") .. [["></td></tr>
+ <tr><td>Y:</td>
+ <td><input type="text" name="World_SpawnY" value="]] .. WorldIni:GetValue("SpawnPosition", "Y") .. [["></td></tr>
+ <tr><td>Z:</td>
+ <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>
+ <td><input type="text" name="World_Seed" value="]] .. WorldIni:GetValue("Seed", "Seed") .. [["></td></tr>
+ </table>
+ <br />
+ <table>
+ <th colspan="2">PVP</th>
+ <tr><td style="width: 50%;">PVP:</td>
+ <td>]] .. HTML_Select_On_Off("World_PVP", WorldIni:GetValueI("PVP", "Enabled") ) .. [[</td></tr>
+ </table>
+ <br />
+ <table>
+ <th colspan="2">GameMode</th>
+ <tr><td style="width: 50%;">GameMode:</td>
+ <td>]] .. HTML_Select_GameMode("World_GameMode", WorldIni:GetValueI("GameMode", "GameMode") ) .. [[</td></tr>
+ </table>
+ <br />
+ <table>
+ <th colspan="2">Physics</th>
+ <tr><td style="width: 50%;">DeepSnow:</td>
+ <td>]] .. HTML_Select_On_Off("World_DeepSnow", WorldIni:GetValueI("Physics", "DeepSnow") ) .. [[</td></tr>
+ <tr><td style="width: 50%;">SandInstantFall:</td>
+ <td>]] .. HTML_Select_On_Off("World_SandInstantFall", WorldIni:GetValueI("Physics", "SandInstantFall") ) .. [[</td></tr>
+ <tr><td style="width: 50%;">WaterSimulator:</td>
+ <td>]] .. HTML_Select_Simulator("World_WaterSimulator", WorldIni:GetValue("Physics", "WaterSimulator") ) .. [[</td></tr>
+ <tr><td style="width: 50%;">LavaSimulator:</td>
+ <td>]] .. HTML_Select_Simulator("World_LavaSimulator", WorldIni:GetValue("Physics", "LavaSimulator") ) .. [[</td></tr>
+ </table>
+ <br />
+ <table>
+ <th colspan="2">Plants</th>
+ <tr><td>MaxCactusHeight:</td>
+ <td><input type="text" name="World_MaxCactusHeight" value="]] .. WorldIni:GetValue("Plants", "MaxCactusHeight") .. [["></td></tr>
+ <tr><td>MaxSugarcaneHeigh:</td>
+ <td><input type="text" name="World_MaxSugarcaneHeight" value="]] .. WorldIni:GetValue("Plants", "MaxSugarcaneHeight") .. [["></td></tr>
+ <tr><td style="width: 50%;">CarrotsBonemealable:</td>
+ <td>]] .. HTML_Select_On_Off("World_CarrotsBonemealable", WorldIni:GetValueI("Plants", "IsCarrotsBonemealable") ) .. [[</td></tr>
+ <tr><td style="width: 50%;">CropsBonemealable:</td>
+ <td>]] .. HTML_Select_On_Off("World_CropsBonemealable", WorldIni:GetValueI("Plants", "IsCropsBonemealable") ) .. [[</td></tr>
+ <tr><td style="width: 50%;">GrassBonemealabl:</td>
+ <td>]] .. HTML_Select_On_Off("World_GrassBonemealable", WorldIni:GetValueI("Plants", "IsGrassBonemealable") ) .. [[</td></tr>
+ <tr><td style="width: 50%;">SaplingBonemealable:</td>
+ <td>]] .. HTML_Select_On_Off("World_SaplingBonemealable", WorldIni:GetValueI("Plants", "IsSaplingBonemealable") ) .. [[</td></tr>
+ <tr><td style="width: 50%;">MelonStemBonemealable:</td>
+ <td>]] .. HTML_Select_On_Off("World_MelonStemBonemealable", WorldIni:GetValueI("Plants", "IsMelonStemBonemealable") ) .. [[</td></tr>
+ <tr><td style="width: 50%;">MelonBonemealable:</td>
+ <td>]] .. HTML_Select_On_Off("World_MelonBonemealable", WorldIni:GetValueI("Plants", "IsMelonBonemealable") ) .. [[</td></tr>
+ <tr><td style="width: 50%;">PotatoesBonemealable:</td>
+ <td>]] .. HTML_Select_On_Off("World_PotatoesBonemealable", WorldIni:GetValueI("Plants", "IsPotatoesBonemealable") ) .. [[</td></tr>
+ <tr><td style="width: 50%;">PumpkinStemBonemealable:</td>
+ <td>]] .. HTML_Select_On_Off("World_PumpkinStemBonemealable", WorldIni:GetValueI("Plants", "IsPumpkinStemBonemealable") ) .. [[</td></tr>
+ <tr><td style="width: 50%;">PumpkinBonemealable:</td>
+ <td>]] .. HTML_Select_On_Off("World_PumpkinBonemealable", WorldIni:GetValueI("Plants", "IsPumpkinBonemealable") ) .. [[</td></tr>
+ <tr><td style="width: 50%;">SugarcaneBonemealabl:</td>
+ <td>]] .. HTML_Select_On_Off("World_SugarcaneBonemealable", WorldIni:GetValueI("Plants", "IsSugarcaneBonemealable") ) .. [[</td></tr>
+ <tr><td style="width: 50%;">CactusBonemealable:</td>
+ <td>]] .. HTML_Select_On_Off("World_CactusBonemealable", WorldIni:GetValueI("Plants", "IsCactusBonemealable") ) .. [[</td></tr>
+ </table>
+ <br />
+ <table>
+ <th colspan="2">Generator</th>
+ <tr><td style="width: 50%;">BiomeGen:</td>
+ <td>]] .. HTML_Select_BiomeGen("World_BiomeGen", WorldIni:GetValue("Generator", "BiomeGen") ) .. [[</td></tr>
+ <tr><td style="width: 50%;">HeightGen:</td>
+ <td>]] .. HTML_Select_HeightGen("World_HeightGen", WorldIni:GetValue("Generator", "HeightGen") ) .. [[</td></tr>
+ <tr><td style="width: 50%;">CompositionGen:</td>
+ <td>]] .. HTML_Select_CompositionGen("World_CompositionGen", WorldIni:GetValue("Generator", "CompositionGen") ) .. [[</td></tr>
+ <tr><td>Structures:</td>
+ <td><input type="text" size="50" name="World_Structures" value="]] .. WorldIni:GetValue("Generator", "Structures") .. [["></td></tr>
+ <tr><td>Finishers:</td>
+ <td><input type="text" size="50" name="World_Finishers" value="]] .. WorldIni:GetValue("Generator", "Finishers") .. [["></td></tr>
+ <tr><td style="width: 50%;">Generator:</td>
+ <td>]] .. HTML_Select_Generator("World_Generator", WorldIni:GetValue("Generator", "Generator") ) .. [[</td></tr>
+
+ </table>
+ <br />
+ <table>
+ <th colspan="1">Finetuning</th><br />
+ </table>
+ <table>
+ ]]
+ if WorldIni:GetValue( "Generator", "BiomeGen" ) == "Constant" then
+ Content = Content .. [[
+ <th colspan="2">Biome Generator</th>
+ <tr><td style="width: 50%;">ConstantBiome:</td>
+ <td>]] .. HTML_Select_Biome( "World_Biome", WorldIni:GetValue("Generator", "ConstantBiome" ) ) .. [[</td></tr>]]
+ elseif WorldIni:GetValue( "Generator", "BiomeGen" ) == "MultiStepMap" then
+ Content = Content .. [[
+ <th colspan="2">Biome Generator</th>
+ <tr><td>MultiStepMapOceanCellSize:</td>
+ <td><input type="text" name="World_MultiStepMapOceanCellSize" value="]] .. WorldIni:GetValue("Generator", "MultiStepMapOceanCellSize") .. [["></td></tr>
+ <tr><td>MultiStepMapOceanCellSize:</td>
+ <td><input type="text" name="World_MultiStepMapMushroomIslandSize" value="]] .. WorldIni:GetValue("Generator", "MultiStepMapMushroomIslandSize") .. [["></td></tr>
+ <tr><td>MultiStepMapOceanCellSize:</td>
+ <td><input type="text" name="World_MultiStepMapRiverCellSize" value="]] .. WorldIni:GetValue("Generator", "MultiStepMapRiverCellSize") .. [["></td></tr>
+ <tr><td>MultiStepMapOceanCellSize:</td>
+ <td><input type="text" name="World_MultiStepMapRiverWidth" value="]] .. WorldIni:GetValue("Generator", "MultiStepMapRiverWidth") .. [["></td></tr>
+ <tr><td>MultiStepMapOceanCellSize:</td>
+ <td><input type="text" name="World_MultiStepMapLandBiomeSize" value="]] .. WorldIni:GetValue("Generator", "MultiStepMapLandBiomeSize") .. [["></td></tr>]]
+ elseif WorldIni:GetValue( "Generator", "BiomeGen" ) == "DistortedVoronoi" then
+ Content = Content .. [[
+ <th colspan="2">Biome Generator</th>
+ <tr><td>DistortedVoronoiCellSize:</td>
+ <td><input type="text" name="World_DistortedVoronoiCellSize" value="]] .. WorldIni:GetValue("Generator", "DistortedVoronoiCellSize") .. [["></td></tr>
+ <tr><td>DistortedVoronoiBiomes:</td>
+ <td><input type="text" name="World_DistortedVoronoiBiomes" value="]] .. WorldIni:GetValue("Generator", "DistortedVoronoiBiomes") .. [["></td></tr>]]
+ elseif WorldIni:GetValue( "Generator", "BiomeGen" ) == "Voronoi" then
+ Content = Content .. [[
+ <th colspan="2">Biome Generator</th>
+ <tr><td>VoronoiCellSize:</td>
+ <td><input type="text" name="World_VoronoiCellSize" value="]] .. WorldIni:GetValue("Generator", "VoronoiCellSize") .. [["></td></tr>
+ <tr><td>VoronoiBiomes:</td>
+ <td><input type="text" name="World_VoronoiBiomes" value="]] .. WorldIni:GetValue("Generator", "VoronoiBiomes") .. [["></td></tr>]]
+ elseif WorldIni:GetValue( "Generator", "BiomeGen" ) == "CheckerBoard" then
+ Content = Content .. [[
+ <th colspan="2">Biome Generator</th>
+ <tr><td>CheckerBoardBiomes:</td>
+ <td><input type="text" name="World_CheckerBoardBiomes" value="]] .. WorldIni:GetValue("Generator", "CheckerBoardBiomes") .. [["></td></tr>
+ <tr><td>CheckerBoardBiomeSize:</td>
+ <td><input type="text" name="World_CheckerBoardBiomeSize" value="]] .. WorldIni:GetValue("Generator", "CheckerBoardBiomeSize") .. [["></td></tr>]]
+ end
+
+ if WorldIni:GetValue( "Generator", "CompositionGen" ) == "Noise3D" then
+ Content = Content .. [[
+ <th colspan="2">Composition Generator</th>
+ <tr><td>Noise3DSeaLevel:</td>
+ <td><input type="text" name="World_Noise3DSeaLevel" value="]] .. WorldIni:GetValue("Generator", "Noise3DSeaLevel") .. [["></td></tr>
+ <tr><td>Noise3DHeightAmplification:</td>
+ <td><input type="text" name="World_Noise3DHeightAmplification" value="]] .. WorldIni:GetValue("Generator", "Noise3DHeightAmplification") .. [["></td></tr>
+ <tr><td>Noise3DMidPoint:</td>
+ <td><input type="text" name="World_Noise3DMidPoint" value="]] .. WorldIni:GetValue("Generator", "Noise3DMidPoint") .. [["></td></tr>
+ <tr><td>Noise3DFrequencyX:</td>
+ <td><input type="text" name="World_Noise3DFrequencyX" value="]] .. WorldIni:GetValue("Generator", "Noise3DFrequencyX") .. [["></td></tr>
+ <tr><td>Noise3DFrequencyY:</td>
+ <td><input type="text" name="World_Noise3DFrequencyY" value="]] .. WorldIni:GetValue("Generator", "Noise3DFrequencyY") .. [["></td></tr>
+ <tr><td>Noise3DFrequencyZ:</td>
+ <td><input type="text" name="World_Noise3DFrequencyZ" value="]] .. WorldIni:GetValue("Generator", "Noise3DFrequencyZ") .. [["></td></tr>
+ <tr><td>Noise3DAirThreshold:</td>
+ <td><input type="text" name="World_Noise3DAirThreshold" value="]] .. WorldIni:GetValue("Generator", "Noise3DAirThreshold") .. [["></td></tr>]]
+ elseif WorldIni:GetValue( "Generator", "CompositionGen" ) == "Classic" then
+ Content = Content .. [[
+ <th colspan="2">Composition Generator</th>
+ <tr><td>ClassicSeaLevel:</td>
+ <td><input type="text" name="World_ClassicSeaLevel" value="]] .. WorldIni:GetValue("Generator", "ClassicSeaLevel") .. [["></td></tr>
+ <tr><td>ClassicBeachHeight:</td>
+ <td><input type="text" name="World_ClassicBeachHeight" value="]] .. WorldIni:GetValue("Generator", "ClassicBeachHeight") .. [["></td></tr>
+ <tr><td>ClassicBeachDepth:</td>
+ <td><input type="text" name="World_ClassicBeachDepth" value="]] .. WorldIni:GetValue("Generator", "ClassicBeachDepth") .. [["></td></tr>
+ <tr><td>ClassicBlockTop:</td>
+ <td><input type="text" name="World_ClassicBlockTop" value="]] .. WorldIni:GetValue("Generator", "ClassicBlockTop") .. [["></td></tr>
+ <tr><td>ClassicBlockMiddle:</td>
+ <td><input type="text" name="World_ClassicBlockMiddle" value="]] .. WorldIni:GetValue("Generator", "ClassicBlockMiddle") .. [["></td></tr>
+ <tr><td>ClassicBlockBottom:</td>
+ <td><input type="text" name="World_ClassicBlockBottom" value="]] .. WorldIni:GetValue("Generator", "ClassicBlockBottom") .. [["></td></tr>
+ <tr><td>ClassicBlockBeach:</td>
+ <td><input type="text" name="World_ClassicBlockBeach" value="]] .. WorldIni:GetValue("Generator", "ClassicBlockBeach") .. [["></td></tr>
+ <tr><td>ClassicBlockBeachBottom:</td>
+ <td><input type="text" name="World_ClassicBlockBeachBottom" value="]] .. WorldIni:GetValue("Generator", "ClassicBlockBeachBottom") .. [["></td></tr>
+ <tr><td>ClassicBlockSea:</td>
+ <td><input type="text" name="World_ClassicBlockSea" value="]] .. WorldIni:GetValue("Generator", "ClassicBlockSea") .. [["></td></tr>]]
+ elseif WorldIni:GetValue( "Generator", "CompositionGen" ) == "SameBlock" then
+ Content = Content .. [[
+ <th colspan="2">Composition Generator</th>
+ <tr><td>SameBlockType:</td>
+ <td><input type="text" name="World_SameBlockType" value="]] .. WorldIni:GetValue("Generator", "SameBlockType") .. [["></td></tr>
+ <tr><td>SameBlockBedrocked:</td>
+ <td><input type="text" name="World_SameBlockBedrocked" value="]] .. WorldIni:GetValue("Generator", "SameBlockBedrocked") .. [["></td></tr>]]
+ end
+ if WorldIni:GetValue( "Generator", "HeightGen" ) == "Flat" then
+ Content = Content .. [[
+ <th colspan="2">Height Generator</th>
+ <tr><td>FlatHeight:</td>
+ <td><input type="text" name="World_FlatHeight" value="]] .. WorldIni:GetValue("Generator", "FlatHeight") .. [["></td></tr>]]
+ end
+ if string.find( WorldIni:GetValue( "Generator", "Structures" ), "MineShafts" ) ~= nil then
+ Content = Content .. [[
+ <th colspan="2">MineShafts</th>
+ <tr><td>MineShaftsGridSize:</td>
+ <td><input type="text" name="World_MineShaftsGridSize" value="]] .. WorldIni:GetValue("Generator", "MineShaftsGridSize") .. [["></td></tr>
+ <tr><td>MineShaftsMaxSystemSize:</td>
+ <td><input type="text" name="World_MineShaftsMaxSystemSize" value="]] .. WorldIni:GetValue("Generator", "MineShaftsMaxSystemSize") .. [["></td></tr>
+ <tr><td>MineShaftsChanceCorridor:</td>
+ <td><input type="text" name="World_MineShaftsChanceCorridor" value="]] .. WorldIni:GetValue("Generator", "MineShaftsChanceCorridor") .. [["></td></tr>
+ <tr><td>MineShaftsChanceCrossing:</td>
+ <td><input type="text" name="World_MineShaftsChanceCrossing" value="]] .. WorldIni:GetValue("Generator", "MineShaftsChanceCrossing") .. [["></td></tr>
+ <tr><td>MineShaftsChanceStaircase:</td>
+ <td><input type="text" name="World_MineShaftsChanceStaircase" value="]] .. WorldIni:GetValue("Generator", "MineShaftsChanceStaircase") .. [["></td></tr>]]
+ end
+ if string.find( WorldIni:GetValue( "Generator", "Structures" ), "LavaLakes" ) ~= nil then
+ Content = Content .. [[
+ <th colspan="2">LavaLakes</th>
+ <tr><td>LavaLakesProbability:</td>
+ <td><input type="text" name="World_LavaLakesProbability" value="]] .. WorldIni:GetValue("Generator", "LavaLakesProbability") .. [["></td></tr>]]
+ end
+ if string.find( WorldIni:GetValue( "Generator", "Structures" ), "WaterLakes" ) ~= nil then
+ Content = Content .. [[
+ <th colspan="2">WaterLakes</th>
+ <tr><td>WaterLakesProbability:</td>
+ <td><input type="text" name="World_WaterLakesProbability" value="]] .. WorldIni:GetValue("Generator", "WaterLakesProbability") .. [["></td></tr>]]
+ end
+ if string.find( WorldIni:GetValue( "Generator", "Finishers" ), "BottomLava" ) ~= nil then
+ Content = Content .. [[
+ <th colspan="2">BottomLavaLevel</th>
+ <tr><td>BottomLavaLevel:</td>
+ <td><input type="text" name="World_BottomLavaLevel" value="]] .. WorldIni:GetValue("Generator", "BottomLavaLevel") .. [["></td></tr>]]
+ end
+ Content = Content .. [[</table>]]
+
+ Content = Content .. [[ <br />
+ <input type="submit" value="Save Settings" name="world_submit"> </form>WARNING: Any changes made here might require a server restart in order to be applied!
+ </form>]]
+ return Content
+end
+
+
+
+function HandleRequest_ServerSettings( Request )
+ local Content = ""
+
+ Content = Content .. [[
+ <p><b>Server Settings</b></p>
+ <table>
+ <tr>
+ <td><a href="?tab=General">General</a></td>
+ <td><a href="?tab=Monsters">Monsters</a></td>
+ <td><a href="?tab=Worlds">Worlds</a></td>
+ <td><a href="?tab=World">World</a></td>
+ </tr>
+ </table>
+ <br />]]
+
+ if( Request.Params["tab"] == "Monsters" ) then
+ Content = Content .. ShowMonstersSettings( Request )
+ elseif( Request.Params["tab"] == "Worlds" ) then
+ Content = Content .. ShowWorldsSettings( Request )
+ elseif( Request.Params["tab"] == "World" ) then
+ Content = Content .. ShowWorldSettings( Request )
+ else
+ Content = Content .. ShowGeneralSettings( Request ) -- Default to general settings
+ end
+
+ return Content
end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/web_whitelist.lua b/MCServer/Plugins/Core/web_whitelist.lua
index 2c9ddb953..61cc6fd8b 100644
--- a/MCServer/Plugins/Core/web_whitelist.lua
+++ b/MCServer/Plugins/Core/web_whitelist.lua
@@ -1,79 +1,79 @@
-local function HTMLDeleteButton( name )
- return "<form method=\"POST\"><input type=\"hidden\" name=\"whitelist-delete\" value=\"".. name .."\"><input type=\"submit\" value=\"Remove from whitelist\"></form>"
-end
-
-function HandleRequest_WhiteList( Request )
- local UpdateMessage = ""
- if( Request.PostParams["whitelist-add"] ~= nil ) then
- local PlayerName = Request.PostParams["whitelist-add"]
-
- if( WhiteListIni:GetValueB("WhiteList", PlayerName, false) == true ) then
- UpdateMessage = "<b>".. PlayerName.."</b> is already on the whitelist"
- else
- WhiteListIni:SetValueB("WhiteList", PlayerName, true )
- UpdateMessage = "Added <b>" .. PlayerName .. "</b> to whitelist."
- WhiteListIni:WriteFile()
- end
- elseif( Request.PostParams["whitelist-delete"] ~= nil ) then
- local PlayerName = Request.PostParams["whitelist-delete"]
- WhiteListIni:DeleteValue( "WhiteList", PlayerName )
- UpdateMessage = "Removed <b>" .. PlayerName .. "</b> from whitelist."
- WhiteListIni:WriteFile()
- elseif( Request.PostParams["whitelist-reload"] ~= nil ) then
- WhiteListIni:Erase() -- Empty entire loaded ini first, otherwise weird shit goes down
- WhiteListIni:ReadFile()
- UpdateMessage = "Loaded from disk"
- elseif( Request.Params["whitelist-setenable"] ~= nil ) then
- local Enabled = Request.Params["whitelist-setenable"]
- local CreateNewValue = false
- if( WhiteListIni:FindValue( WhiteListIni:FindKey("WhiteListSettings"), "WhiteListOn" ) == cIniFile.noID ) then -- Find out whether the value is in the ini
- CreateNewValue = true
- end
-
- if( Enabled == "1" ) then
- WhiteListIni:SetValueB("WhiteListSettings", "WhiteListOn", true, CreateNewValue )
- else
- WhiteListIni:SetValueB("WhiteListSettings", "WhiteListOn", false, CreateNewValue )
- end
- WhiteListIni:WriteFile()
- end
-
-
- local Content = ""
-
- local WhiteListEnabled = WhiteListIni:GetValueB("WhiteListSettings", "WhiteListOn", false)
- if( WhiteListEnabled == false ) then
- Content = Content .. "<p>Whitelist is currently disabled! Click <a href='?whitelist-setenable=1'>here</a> to enable.</p>"
- end
-
-
- Content = Content .. "<h4>Whitelisted players</h4>"
- Content = Content .. "<table>"
- local KeyNum = WhiteListIni:FindKey("WhiteList")
- local NumValues = WhiteListIni:GetNumValues(KeyNum)
- if( NumValues > 0 ) then
- for Num = 0, NumValues-1 do
- if( WhiteListIni:GetValue(KeyNum, Num, "0") == "1" ) then
- local PlayerName = WhiteListIni:GetValueName(KeyNum, Num )
- Content = Content .. "<tr><td>" .. PlayerName .. "</td><td>" .. HTMLDeleteButton( PlayerName ) .. "</td></tr>"
- end
- end
- else
- Content = Content .. "<tr><td>None</td></tr>"
- end
- Content = Content .. "</table>"
- Content = Content .. "<br><h4>Add player to whitelist</h4>"
- Content = Content .. "<form method=\"POST\">"
- Content = Content .. "<input type=\"text\" name=\"whitelist-add\"><input type=\"submit\" value=\"Add player\">"
- Content = Content .. "</form>"
- Content = Content .. "<form method=\"POST\">"
- Content = Content .. "<input type=\"submit\" name=\"whitelist-reload\" value=\"Reload from disk\">"
- Content = Content .. "</form>"
- Content = Content .. "<br>"..UpdateMessage
-
- if( WhiteListEnabled == true ) then
- Content = Content .. "<br><br><p>Whitelist is currently enabled, click <a href='?whitelist-setenable=0'>here</a> to disable.</p>"
- end
-
- return Content
+local function HTMLDeleteButton( name )
+ return "<form method=\"POST\"><input type=\"hidden\" name=\"whitelist-delete\" value=\"".. name .."\"><input type=\"submit\" value=\"Remove from whitelist\"></form>"
+end
+
+function HandleRequest_WhiteList( Request )
+ local UpdateMessage = ""
+ if( Request.PostParams["whitelist-add"] ~= nil ) then
+ local PlayerName = Request.PostParams["whitelist-add"]
+
+ if( WhiteListIni:GetValueB("WhiteList", PlayerName, false) == true ) then
+ UpdateMessage = "<b>".. PlayerName.."</b> is already on the whitelist"
+ else
+ WhiteListIni:SetValueB("WhiteList", PlayerName, true )
+ UpdateMessage = "Added <b>" .. PlayerName .. "</b> to whitelist."
+ WhiteListIni:WriteFile()
+ end
+ elseif( Request.PostParams["whitelist-delete"] ~= nil ) then
+ local PlayerName = Request.PostParams["whitelist-delete"]
+ WhiteListIni:DeleteValue( "WhiteList", PlayerName )
+ UpdateMessage = "Removed <b>" .. PlayerName .. "</b> from whitelist."
+ WhiteListIni:WriteFile()
+ elseif( Request.PostParams["whitelist-reload"] ~= nil ) then
+ WhiteListIni:Erase() -- Empty entire loaded ini first, otherwise weird shit goes down
+ WhiteListIni:ReadFile()
+ UpdateMessage = "Loaded from disk"
+ elseif( Request.Params["whitelist-setenable"] ~= nil ) then
+ local Enabled = Request.Params["whitelist-setenable"]
+ local CreateNewValue = false
+ if( WhiteListIni:FindValue( WhiteListIni:FindKey("WhiteListSettings"), "WhiteListOn" ) == cIniFile.noID ) then -- Find out whether the value is in the ini
+ CreateNewValue = true
+ end
+
+ if( Enabled == "1" ) then
+ WhiteListIni:SetValueB("WhiteListSettings", "WhiteListOn", true, CreateNewValue )
+ else
+ WhiteListIni:SetValueB("WhiteListSettings", "WhiteListOn", false, CreateNewValue )
+ end
+ WhiteListIni:WriteFile()
+ end
+
+
+ local Content = ""
+
+ local WhiteListEnabled = WhiteListIni:GetValueB("WhiteListSettings", "WhiteListOn", false)
+ if( WhiteListEnabled == false ) then
+ Content = Content .. "<p>Whitelist is currently disabled! Click <a href='?whitelist-setenable=1'>here</a> to enable.</p>"
+ end
+
+
+ Content = Content .. "<h4>Whitelisted players</h4>"
+ Content = Content .. "<table>"
+ local KeyNum = WhiteListIni:FindKey("WhiteList")
+ local NumValues = WhiteListIni:GetNumValues(KeyNum)
+ if( NumValues > 0 ) then
+ for Num = 0, NumValues-1 do
+ if( WhiteListIni:GetValue(KeyNum, Num, "0") == "1" ) then
+ local PlayerName = WhiteListIni:GetValueName(KeyNum, Num )
+ Content = Content .. "<tr><td>" .. PlayerName .. "</td><td>" .. HTMLDeleteButton( PlayerName ) .. "</td></tr>"
+ end
+ end
+ else
+ Content = Content .. "<tr><td>None</td></tr>"
+ end
+ Content = Content .. "</table>"
+ Content = Content .. "<br><h4>Add player to whitelist</h4>"
+ Content = Content .. "<form method=\"POST\">"
+ Content = Content .. "<input type=\"text\" name=\"whitelist-add\"><input type=\"submit\" value=\"Add player\">"
+ Content = Content .. "</form>"
+ Content = Content .. "<form method=\"POST\">"
+ Content = Content .. "<input type=\"submit\" name=\"whitelist-reload\" value=\"Reload from disk\">"
+ Content = Content .. "</form>"
+ Content = Content .. "<br>"..UpdateMessage
+
+ if( WhiteListEnabled == true ) then
+ Content = Content .. "<br><br><p>Whitelist is currently enabled, click <a href='?whitelist-setenable=0'>here</a> to disable.</p>"
+ end
+
+ return Content
end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/onplayermoving.lua b/MCServer/Plugins/Core/worldlimiter.lua
index c95eb0c5a..1bb1b4fc6 100644
--- a/MCServer/Plugins/Core/onplayermoving.lua
+++ b/MCServer/Plugins/Core/worldlimiter.lua
@@ -1,21 +1,22 @@
-function OnPlayerMoving( Player )
- if LimitWorld == true then
- local World = Player:GetWorld()
- local SpawnX = math.floor(World:GetSpawnX() / 16)
- local SpawnZ = math.floor(World:GetSpawnZ() / 16)
- local X = math.floor(Player:GetPosX() / 16)
- local Z = math.floor(Player:GetPosZ() / 16)
- if ( (SpawnX + LimitWorldWidth - 1) < X ) then
- Player:TeleportToCoords(Player:GetPosX() - 1, Player:GetPosY(), Player:GetPosZ())
- end
- if ( (SpawnX - LimitWorldWidth + 1) > X ) then
- Player:TeleportToCoords(Player:GetPosX() + 1, Player:GetPosY(), Player:GetPosZ())
- end
- if ( (SpawnZ + LimitWorldWidth - 1) < Z ) then
- Player:TeleportToCoords(Player:GetPosX(), Player:GetPosY(), Player:GetPosZ() - 1)
- end
- if ( (SpawnZ - LimitWorldWidth + 1) > Z ) then
- Player:TeleportToCoords(Player:GetPosX(), Player:GetPosY(), Player:GetPosZ() + 1)
- end
- end
+function OnPlayerMoving( Player )
+ 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)
+ local X = math.floor(Player:GetPosX() / 16)
+ local Z = math.floor(Player:GetPosZ() / 16)
+ if ( (SpawnX + LimitWorldWidth - 1) < X ) then
+ Player:TeleportToCoords(Player:GetPosX() - 1, Player:GetPosY(), Player:GetPosZ())
+ end
+ if ( (SpawnX - LimitWorldWidth + 1) > X ) then
+ Player:TeleportToCoords(Player:GetPosX() + 1, Player:GetPosY(), Player:GetPosZ())
+ end
+ if ( (SpawnZ + LimitWorldWidth - 1) < Z ) then
+ Player:TeleportToCoords(Player:GetPosX(), Player:GetPosY(), Player:GetPosZ() - 1)
+ end
+ if ( (SpawnZ - LimitWorldWidth + 1) > Z ) then
+ Player:TeleportToCoords(Player:GetPosX(), Player:GetPosY(), Player:GetPosZ() + 1)
+ end
+ end
end \ No newline at end of file
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua
index e2523e63e..f26b9a98d 100644
--- a/MCServer/Plugins/Debuggers/Debuggers.lua
+++ b/MCServer/Plugins/Debuggers/Debuggers.lua
@@ -1,717 +1,709 @@
-
--- Global variables
-PLUGIN = {}; -- Reference to own plugin object
-ShouldDumpFunctions = true; -- If set to true, all available functions are written to the API.txt file upon plugin initialization
-
-g_DropSpensersToActivate = {}; -- A list of dispensers and droppers (as {World, X, Y Z} quadruplets) that are to be activated every tick
-
-g_HungerReportTick = 10;
-
-
-
-
-
-function Initialize(Plugin)
- PLUGIN = Plugin
-
- Plugin:SetName("Debuggers")
- Plugin:SetVersion(1)
-
- PluginManager = cRoot:Get():GetPluginManager()
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USING_BLOCK);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USING_ITEM);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_TAKE_DAMAGE);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_TICK);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHAT);
-
- PluginManager:BindCommand("/le", "debuggers", HandleListEntitiesCmd, "Shows a list of all the loaded entities");
- PluginManager:BindCommand("/ke", "debuggers", HandleKillEntitiesCmd, "Kills all the loaded entities");
- PluginManager:BindCommand("/wool", "debuggers", HandleWoolCmd, "Sets all your armor to blue wool");
- PluginManager:BindCommand("/testwnd", "debuggers", HandleTestWndCmd, "Opens up a window using plugin API");
- PluginManager:BindCommand("/gc", "debuggers", HandleGCCmd, "Activates the Lua garbage collector");
- PluginManager:BindCommand("/fast", "debuggers", HandleFastCmd, "Switches between fast and normal movement speed");
- PluginManager:BindCommand("/dash", "debuggers", HandleDashCmd, "Switches between fast and normal sprinting speed");
- PluginManager:BindCommand("/hunger", "debuggers", HandleHungerCmd, "Lists the current hunger-related variables");
- PluginManager:BindCommand("/poison", "debuggers", HandlePoisonCmd, "Sets food-poisoning for 15 seconds");
-
- -- Enable the following line for BlockArea / Generator interface testing:
- -- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATED);
-
- LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
-
- -- dump all available API functions and objects:
- if (ShouldDumpFunctions) then
- DumpAPI();
- end
-
-
- -- TestBlockAreas();
- -- TestSQLiteBindings();
- -- TestExpatBindings();
-
- return true
-end;
-
-
-
-
-
-function DumpAPI()
- LOG("Dumping all available functions to API.txt...");
- function dump (prefix, a, Output)
- for i, v in pairs (a) do
- if (type(v) == "table") then
- if (GetChar(i, 1) ~= ".") then
- if (v == _G) then
- LOG(prefix .. i .. " == _G, CYCLE, ignoring");
- elseif (v == _G.package) then
- LOG(prefix .. i .. " == _G.package, ignoring");
- else
- dump(prefix .. i .. ".", v, Output)
- end
- end
- elseif (type(v) == "function") then
- if (string.sub(i, 1, 2) ~= "__") then
- table.insert(Output, prefix .. i .. "()");
- end
- end
- end
- end
-
- local Output = {};
- dump("", _G, Output);
-
- table.sort(Output);
- local f = io.open("API.txt", "w");
- for i, n in ipairs(Output) do
- f:write(n, "\n");
- end
- f:close();
- LOG("API.txt written.");
-end
-
-
-
-
-
-function TestBlockAreas()
- LOG("Testing block areas...");
-
- -- Debug block area merging:
- local BA1 = cBlockArea();
- local BA2 = cBlockArea();
- if (BA1:LoadFromSchematicFile("schematics/test.schematic")) then
- if (BA2:LoadFromSchematicFile("schematics/fountain.schematic")) then
- BA2:SetRelBlockType(0, 0, 0, E_BLOCK_LAPIS_BLOCK);
- BA2:SetRelBlockType(1, 0, 0, E_BLOCK_LAPIS_BLOCK);
- BA2:SetRelBlockType(2, 0, 0, E_BLOCK_LAPIS_BLOCK);
- BA1:Merge(BA2, 1, 10, 1, cBlockArea.msImprint);
- BA1:SaveToSchematicFile("schematics/merge.schematic");
- end
- else
- BA1:Create(16, 16, 16);
- end
-
- -- Debug block area cuboid filling:
- BA1:FillRelCuboid(2, 9, 2, 8, 2, 8, cBlockArea.baTypes, E_BLOCK_GOLD_BLOCK);
- BA1:RelLine(2, 2, 2, 9, 8, 8, cBlockArea.baTypes or cBlockArea.baMetas, E_BLOCK_SAPLING, E_META_SAPLING_BIRCH);
- BA1:SaveToSchematicFile("schematics/fillrel.schematic");
-
- -- Debug block area mirroring:
- if (BA1:LoadFromSchematicFile("schematics/lt.schematic")) then
- BA1:MirrorXYNoMeta();
- BA1:SaveToSchematicFile("schematics/lt_XY.schematic");
- BA1:MirrorXYNoMeta();
- BA1:SaveToSchematicFile("schematics/lt_XY2.schematic");
-
- BA1:MirrorXZNoMeta();
- BA1:SaveToSchematicFile("schematics/lt_XZ.schematic");
- BA1:MirrorXZNoMeta();
- BA1:SaveToSchematicFile("schematics/lt_XZ2.schematic");
-
- BA1:MirrorYZNoMeta();
- BA1:SaveToSchematicFile("schematics/lt_YZ.schematic");
- BA1:MirrorYZNoMeta();
- BA1:SaveToSchematicFile("schematics/lt_YZ2.schematic");
- end
-
- -- Debug block area rotation:
- if (BA1:LoadFromSchematicFile("schematics/rot.schematic")) then
- BA1:RotateCWNoMeta();
- BA1:SaveToSchematicFile("schematics/rot1.schematic");
- BA1:RotateCWNoMeta();
- BA1:SaveToSchematicFile("schematics/rot2.schematic");
- BA1:RotateCWNoMeta();
- BA1:SaveToSchematicFile("schematics/rot3.schematic");
- BA1:RotateCWNoMeta();
- BA1:SaveToSchematicFile("schematics/rot4.schematic");
- end
-
- -- Debug block area rotation:
- if (BA1:LoadFromSchematicFile("schematics/rotm.schematic")) then
- BA1:RotateCCW();
- BA1:SaveToSchematicFile("schematics/rotm1.schematic");
- BA1:RotateCCW();
- BA1:SaveToSchematicFile("schematics/rotm2.schematic");
- BA1:RotateCCW();
- BA1:SaveToSchematicFile("schematics/rotm3.schematic");
- BA1:RotateCCW();
- BA1:SaveToSchematicFile("schematics/rotm4.schematic");
- end
-
- -- Debug block area mirroring:
- if (BA1:LoadFromSchematicFile("schematics/ltm.schematic")) then
- BA1:MirrorXY();
- BA1:SaveToSchematicFile("schematics/ltm_XY.schematic");
- BA1:MirrorXY();
- BA1:SaveToSchematicFile("schematics/ltm_XY2.schematic");
-
- BA1:MirrorXZ();
- BA1:SaveToSchematicFile("schematics/ltm_XZ.schematic");
- BA1:MirrorXZ();
- BA1:SaveToSchematicFile("schematics/ltm_XZ2.schematic");
-
- BA1:MirrorYZ();
- BA1:SaveToSchematicFile("schematics/ltm_YZ.schematic");
- BA1:MirrorYZ();
- BA1:SaveToSchematicFile("schematics/ltm_YZ2.schematic");
- end
-
- LOG("Block areas test ended");
-end
-
-
-
-
-
-
-function TestSQLiteBindings()
- LOG("Testing SQLite bindings...");
-
- -- Debug SQLite binding
- local TestDB, ErrCode, ErrMsg = sqlite3.open("test.sqlite");
- if (TestDB ~= nil) then
- local function ShowRow(UserData, NumCols, Values, Names)
- assert(UserData == 'UserData');
- LOG("New row");
- for i = 1, NumCols do
- LOG(" " .. Names[i] .. " = " .. Values[i]);
- end
- return 0;
- end
- local sql = [=[
- CREATE TABLE numbers(num1,num2,str);
- INSERT INTO numbers VALUES(1, 11, "ABC");
- INSERT INTO numbers VALUES(2, 22, "DEF");
- INSERT INTO numbers VALUES(3, 33, "UVW");
- INSERT INTO numbers VALUES(4, 44, "XYZ");
- SELECT * FROM numbers;
- ]=]
- local Res = TestDB:exec(sql, ShowRow, 'UserData');
- if (Res ~= sqlite3.OK) then
- LOG("TestDB:exec() failed: " .. Res .. " (" .. TestDB:errmsg() .. ")");
- end;
- TestDB:close();
- else
- -- This happens if for example SQLite cannot open the file (eg. a folder with the same name exists)
- LOG("SQLite3 failed to open DB! (" .. ErrCode .. ", " .. ErrMsg ..")");
- end
-
- LOG("SQLite bindings test ended");
-end
-
-
-
-
-
-function TestExpatBindings()
- LOG("Testing Expat bindings...");
-
- -- Debug LuaExpat bindings:
- local count = 0
- callbacks = {
- StartElement = function (parser, name)
- LOG("+ " .. string.rep(" ", count) .. name);
- count = count + 1;
- end,
- EndElement = function (parser, name)
- count = count - 1;
- LOG("- " .. string.rep(" ", count) .. name);
- end
- }
-
- local p = lxp.new(callbacks);
- p:parse("<elem1>\nnext line\nanother line");
- p:parse("text\n");
- p:parse("<elem2/>\n");
- p:parse("more text");
- p:parse("</elem1>");
- p:parse("\n");
- p:parse(); -- finishes the document
- p:close(); -- closes the parser
-
- LOG("Expat bindings test ended");
-end
-
-
-
-
-
-function OnUsingBlazeRod(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ)
- -- Magic rod of query: show block types and metas for both neighbors of the pointed face
- local Type, Meta, Valid = Player:GetWorld():GetBlockTypeMeta(BlockX, BlockY, BlockZ, Type, Meta);
-
- if (Type == E_BLOCK_AIR) then
- Player:SendMessage(cChatColor.LightGray .. "Block {" .. BlockX .. ", " .. BlockY .. ", " .. BlockZ .. "}: air:" .. Meta);
- else
- local TempItem = cItem(Type, 1, Meta);
- Player:SendMessage(cChatColor.LightGray .. "Block {" .. BlockX .. ", " .. BlockY .. ", " .. BlockZ .. "}: " .. ItemToFullString(TempItem) .. " (" .. Type .. ":" .. Meta .. ")");
- end
-
- local X, Y, Z = AddFaceDirection(BlockX, BlockY, BlockZ, BlockFace);
- Valid, Type, Meta = Player:GetWorld():GetBlockTypeMeta(X, Y, Z, Type, Meta);
- if (Type == E_BLOCK_AIR) then
- Player:SendMessage(cChatColor.LightGray .. "Block {" .. X .. ", " .. Y .. ", " .. Z .. "}: air:" .. Meta);
- else
- local TempItem = cItem(Type, 1, Meta);
- Player:SendMessage(cChatColor.LightGray .. "Block {" .. X .. ", " .. Y .. ", " .. Z .. "}: " .. ItemToFullString(TempItem) .. " (" .. Type .. ":" .. Meta .. ")");
- end
- return false;
-end
-
-
-
-
-
-function OnUsingDiamond(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ)
- -- Rclk with a diamond to test block area cropping and expanding
- local Area = cBlockArea();
- Area:Read(Player:GetWorld(),
- BlockX - 19, BlockX + 19,
- BlockY - 7, BlockY + 7,
- BlockZ - 19, BlockZ + 19
- );
-
- LOG("Size before cropping: " .. Area:GetSizeX() .. " x " .. Area:GetSizeY() .. " x " .. Area:GetSizeZ());
- Area:DumpToRawFile("crop0.dat");
-
- Area:Crop(2, 3, 0, 0, 0, 0);
- LOG("Size after cropping 1: " .. Area:GetSizeX() .. " x " .. Area:GetSizeY() .. " x " .. Area:GetSizeZ());
- Area:DumpToRawFile("crop1.dat");
-
- Area:Crop(2, 3, 0, 0, 0, 0);
- LOG("Size after cropping 2: " .. Area:GetSizeX() .. " x " .. Area:GetSizeY() .. " x " .. Area:GetSizeZ());
- Area:DumpToRawFile("crop2.dat");
-
- Area:Expand(2, 3, 0, 0, 0, 0);
- LOG("Size after expanding 1: " .. Area:GetSizeX() .. " x " .. Area:GetSizeY() .. " x " .. Area:GetSizeZ());
- Area:DumpToRawFile("expand1.dat");
-
- Area:Expand(3, 2, 1, 1, 0, 0);
- LOG("Size after expanding 2: " .. Area:GetSizeX() .. " x " .. Area:GetSizeY() .. " x " .. Area:GetSizeZ());
- Area:DumpToRawFile("expand2.dat");
-
- Area:Crop(0, 0, 0, 0, 3, 2);
- LOG("Size after cropping 3: " .. Area:GetSizeX() .. " x " .. Area:GetSizeY() .. " x " .. Area:GetSizeZ());
- Area:DumpToRawFile("crop3.dat");
-
- Area:Crop(0, 0, 3, 2, 0, 0);
- LOG("Size after cropping 4: " .. Area:GetSizeX() .. " x " .. Area:GetSizeY() .. " x " .. Area:GetSizeZ());
- Area:DumpToRawFile("crop4.dat");
-
- LOG("Crop test done");
- Player:SendMessage("Crop / expand test done.");
- return false;
-end
-
-
-
-
-
-function OnUsingEyeOfEnder(Player, BlockX, BlockY, BlockZ)
- -- Rclk with an eye of ender places a predefined schematic at the cursor
- local Area = cBlockArea();
- if not(Area:LoadFromSchematicFile("schematics/test.schematic")) then
- LOG("Loading failed");
- return false;
- end
- LOG("Schematic loaded, placing now.");
- Area:Write(Player:GetWorld(), BlockX, BlockY, BlockZ);
- LOG("Done.");
- return false;
-end
-
-
-
-
-
-function OnUsingEnderPearl(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ)
- -- Rclk with an ender pearl saves a predefined area around the cursor into a .schematic file. Also tests area copying
- local Area = cBlockArea();
- if not(Area:Read(Player:GetWorld(),
- BlockX - 8, BlockX + 8, BlockY - 8, BlockY + 8, BlockZ - 8, BlockZ + 8)
- ) then
- LOG("LUA: Area couldn't be read");
- return false;
- end
- LOG("LUA: Area read, copying now.");
- local Area2 = cBlockArea();
- Area2:CopyFrom(Area);
- LOG("LUA: Copied, now saving.");
- if not(Area2:SaveToSchematicFile("schematics/test.schematic")) then
- LOG("LUA: Cannot save schematic file.");
- return false;
- end
- LOG("LUA: Done.");
- return false;
-end
-
-
-
-
-
-function OnUsingRedstoneTorch(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ)
- -- Redstone torch activates a rapid dispenser / dropper discharge (at every tick):
- local BlockType = Player:GetWorld():GetBlock(BlockX, BlockY, BlockZ);
- if (BlockType == E_BLOCK_DISPENSER) then
- table.insert(g_DropSpensersToActivate, {World = Player:GetWorld(), x = BlockX, y = BlockY, z = BlockZ});
- Player:SendMessage("Dispenser at {" .. BlockX .. ", " .. BlockY .. ", " .. BlockZ .. "} discharging");
- return true;
- elseif (BlockType == E_BLOCK_DROPPER) then
- table.insert(g_DropSpensersToActivate, {World = Player:GetWorld(), x = BlockX, y = BlockY, z = BlockZ});
- Player:SendMessage("Dropper at {" .. BlockX .. ", " .. BlockY .. ", " .. BlockZ .. "} discharging");
- return true;
- else
- Player:SendMessage("Neither a dispenser nor a dropper at {" .. BlockX .. ", " .. BlockY .. ", " .. BlockZ .. "}: " .. BlockType);
- end
- return false;
-end
-
-
-
-
-
-function OnPlayerUsingItem(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ)
-
- -- dont check if the direction is in the air
- if (BlockFace == BLOCK_FACE_NONE) then
- return false
- end
-
- local HeldItem = Player:GetEquippedItem();
- local HeldItemType = HeldItem.m_ItemType;
-
- if (HeldItemType == E_ITEM_STICK) then
- -- Magic sTick of ticking: set the pointed block for ticking at the next tick
- Player:SendMessage(cChatColor.LightGray .. "Setting next block tick to {" .. BlockX .. ", " .. BlockY .. ", " .. BlockZ .. "}")
- Player:GetWorld():SetNextBlockTick(BlockX, BlockY, BlockZ);
- return true
- elseif (HeldItemType == E_ITEM_BLAZE_ROD) then
- return OnUsingBlazeRod(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ);
- elseif (HeldItemType == E_ITEM_DIAMOND) then
- return OnUsingDiamond(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ);
- elseif (HeldItemType == E_ITEM_EYE_OF_ENDER) then
- return OnUsingEyeOfEnder(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ);
- elseif (HeldItemType == E_ITEM_ENDER_PEARL) then
- return OnUsingEnderPearl(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ);
- end
- return false;
-end
-
-
-
-
-
-function OnPlayerUsingBlock(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ, BlockType, BlockMeta)
- -- dont check if the direction is in the air
- if (BlockFace == BLOCK_FACE_NONE) then
- return false
- end
-
- local HeldItem = Player:GetEquippedItem();
- local HeldItemType = HeldItem.m_ItemType;
-
- if (HeldItemType == E_BLOCK_REDSTONE_TORCH_ON) then
- return OnUsingRedstoneTorch(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ);
- end
-end
-
-
-
-
-
-function OnTakeDamage(Receiver, TDI)
- -- Receiver is cPawn
- -- TDI is TakeDamageInfo
-
- LOG(Receiver:GetClass() .. " was dealt " .. DamageTypeToString(TDI.DamageType) .. " damage: Raw " .. TDI.RawDamage .. ", Final " .. TDI.FinalDamage .. " (" .. (TDI.RawDamage - TDI.FinalDamage) .. " covered by armor)");
- return false;
-end
-
-
-
-
-
---- When set to a positive number, the following OnTick() will perform GC and decrease until 0 again
-GCOnTick = 0;
-
-
-
-
-
-function OnTick()
- -- Activate all dropspensers in the g_DropSpensersToActivate list:
- local ActivateDrSp = function(DropSpenser)
- if (DropSpenser:GetContents():GetFirstUsedSlot() == -1) then
- return true;
- end
- DropSpenser:Activate();
- return false;
- end
- -- Walk the list backwards, because we're removing some items
- local idx = #g_DropSpensersToActivate;
- for i = idx, 1, -1 do
- local DrSp = g_DropSpensersToActivate[i];
- if not(DrSp.World:DoWithDropSpenserAt(DrSp.x, DrSp.y, DrSp.z, ActivateDrSp)) then
- table.remove(g_DropSpensersToActivate, i);
- end
- end
-
-
- -- If GCOnTick > 0, do a garbage-collect and decrease by one
- if (GCOnTick > 0) then
- collectgarbage();
- GCOnTick = GCOnTick - 1;
- end
-
- --[[
- if (g_HungerReportTick > 0) then
- g_HungerReportTick = g_HungerReportTick - 1;
- else
- g_HungerReportTick = 10;
- cRoot:Get():GetDefaultWorld():ForEachPlayer(
- function(a_Player)
- a_Player:SendMessage("FoodStat: " .. a_Player:GetFoodLevel() .. " / " .. a_Player:GetFoodExhaustionLevel());
- end
- );
- end
- ]]
-
- return false;
-end
-
-
-
-
-
-function OnChunkGenerated(World, ChunkX, ChunkZ, ChunkDesc)
- -- Test ChunkDesc / BlockArea interaction
- local BlockArea = cBlockArea();
- ChunkDesc:ReadBlockArea(BlockArea, 0, 15, 50, 70, 0, 15);
-
- -- BlockArea:SaveToSchematicFile("ChunkBlocks_" .. ChunkX .. "_" .. ChunkZ .. ".schematic");
-
- ChunkDesc:WriteBlockArea(BlockArea, 5, 115, 5);
- return false;
-end
-
-
-
-
-
-function OnChat(a_Player, a_Message)
- return false, "blabla " .. a_Message;
-end
-
-
-
-
-
--- Function "round" copied from http://lua-users.org/wiki/SimpleRound
-function round(num, idp)
- local mult = 10^(idp or 0)
- if num >= 0 then return math.floor(num * mult + 0.5) / mult
- else return math.ceil(num * mult - 0.5) / mult end
-end
-
-
-
-
-
-function HandleListEntitiesCmd(Split, Player)
- local NumEntities = 0;
-
- local ListEntity = function(Entity)
- if (Entity:IsDestroyed()) then
- -- The entity has already been destroyed, don't list it
- return false;
- end;
- Player:SendMessage(" " .. Entity:GetUniqueID() .. ": " .. Entity:GetClass() .. " {" .. round(Entity:GetPosX(), 2) .. ", " .. round(Entity:GetPosY(), 2) .. ", " .. round(Entity:GetPosZ(), 2) .."}");
- NumEntities = NumEntities + 1;
- end
-
- Player:SendMessage("Listing all entities...");
- Player:GetWorld():ForEachEntity(ListEntity);
- Player:SendMessage("List finished, " .. NumEntities .. " entities listed");
- return true;
-end
-
-
-
-
-
-function HandleKillEntitiesCmd(Split, Player)
- local NumEntities = 0;
-
- local KillEntity = function(Entity)
- -- kill everything except for players:
- if (Entity:GetEntityType() ~= cEntity.etPlayer) then
- Entity:Destroy();
- NumEntities = NumEntities + 1;
- end;
- end
-
- Player:SendMessage("Killing all entities...");
- Player:GetWorld():ForEachEntity(KillEntity);
- Player:SendMessage("Killed " .. NumEntities .. " entities.");
- return true;
-end
-
-
-
-
-
-function HandleWoolCmd(Split, Player)
- local Wool = cItem(E_BLOCK_WOOL, 1, E_META_WOOL_BLUE);
- Player:GetInventory():SetArmorSlot(0, Wool);
- Player:GetInventory():SetArmorSlot(1, Wool);
- Player:GetInventory():SetArmorSlot(2, Wool);
- Player:GetInventory():SetArmorSlot(3, Wool);
- Player:SendMessage("You have been bluewooled :)");
- return true;
-end
-
-
-
-
-
-function HandleTestWndCmd(a_Split, a_Player)
- local WindowType = cWindow.Hopper;
- local WindowSizeX = 5;
- local WindowSizeY = 1;
- if (#a_Split == 4) then
- WindowType = tonumber(a_Split[2]);
- WindowSizeX = tonumber(a_Split[3]);
- WindowSizeY = tonumber(a_Split[4]);
- elseif (#a_Split ~= 1) then
- a_Player:SendMessage("Usage: /testwnd [WindowType WindowSizeX WindowSizeY]");
- return true;
- end
-
- -- Test out the OnClosing callback's ability to refuse to close the window
- local attempt = 1;
- local OnClosing = function(Window, Player, CanRefuse)
- Player:SendMessage("Window closing attempt #" .. attempt .. "; CanRefuse = " .. tostring(CanRefuse));
- attempt = attempt + 1;
- return CanRefuse and (attempt <= 3); -- refuse twice, then allow, unless CanRefuse is set to true
- end
-
- -- Log the slot changes
- local OnSlotChanged = function(Window, SlotNum)
- LOG("Window \"" .. Window:GetWindowTitle() .. "\" slot " .. SlotNum .. " changed.");
- end
-
- local Window = cLuaWindow(WindowType, WindowSizeX, WindowSizeY, "TestWnd");
- local Item2 = cItem(E_ITEM_DIAMOND_SWORD, 1, 0, "1=1");
- local Item3 = cItem(E_ITEM_DIAMOND_SHOVEL);
- Item3.m_Enchantments:SetLevel(cEnchantments.enchUnbreaking, 4);
- local Item4 = cItem(Item3); -- Copy
- Item4.m_Enchantments:SetLevel(cEnchantments.enchEfficiency, 3); -- Add enchantment
- Item4.m_Enchantments:SetLevel(cEnchantments.enchUnbreaking, 5); -- Overwrite existing level
- local Item5 = cItem(E_ITEM_DIAMOND_CHESTPLATE, 1, 0, "thorns=1;unbreaking=3");
- Window:SetSlot(a_Player, 0, cItem(E_ITEM_DIAMOND, 64));
- Window:SetSlot(a_Player, 1, Item2);
- Window:SetSlot(a_Player, 2, Item3);
- Window:SetSlot(a_Player, 3, Item4);
- Window:SetSlot(a_Player, 4, Item5);
- Window:SetOnClosing(OnClosing);
- Window:SetOnSlotChanged(OnSlotChanged);
-
- a_Player:OpenWindow(Window);
-
- -- To make sure that the object has the correct life-management in Lua,
- -- let's garbage-collect in the following few ticks
- GCOnTick = 10;
-
- return true;
-end
-
-
-
-
-
-function HandleGCCmd(a_Split, a_Player)
- collectgarbage();
- return true;
-end
-
-
-
-
-
-
-function HandleFastCmd(a_Split, a_Player)
- if (a_Player:GetNormalMaxSpeed() <= 0.11) then
- -- The player has normal speed, set double speed:
- a_Player:SetNormalMaxSpeed(0.2);
- a_Player:SendMessage("You are now fast");
- else
- -- The player has fast speed, set normal speed:
- a_Player:SetNormalMaxSpeed(0.1);
- a_Player:SendMessage("Back to normal speed");
- end
- return true;
-end
-
-
-
-
-
-function HandleDashCmd(a_Split, a_Player)
- if (a_Player:GetSprintingMaxSpeed() <= 0.14) then
- -- The player has normal sprinting speed, set double Sprintingspeed:
- a_Player:SetSprintingMaxSpeed(0.4);
- a_Player:SendMessage("You can now sprint very fast");
- else
- -- The player has fast sprinting speed, set normal sprinting speed:
- a_Player:SetSprintingMaxSpeed(0.13);
- a_Player:SendMessage("Back to normal sprinting");
- end
- return true;
-end;
-
-
-
-
-
-function HandleHungerCmd(a_Split, a_Player)
- a_Player:SendMessage("FoodLevel: " .. a_Player:GetFoodLevel());
- a_Player:SendMessage("FoodSaturationLevel: " .. a_Player:GetFoodSaturationLevel());
- a_Player:SendMessage("FoodTickTimer: " .. a_Player:GetFoodTickTimer());
- a_Player:SendMessage("FoodExhaustionLevel: " .. a_Player:GetFoodExhaustionLevel());
- a_Player:SendMessage("FoodPoisonedTicksRemaining: " .. a_Player:GetFoodPoisonedTicksRemaining());
- return true;
-end
-
-
-
-
-
-function HandlePoisonCmd(a_Split, a_Player)
- a_Player:FoodPoison(15 * 20);
- return true;
-end
-
-
-
-
+-- Global variables
+PLUGIN = {}; -- Reference to own plugin object
+
+g_DropSpensersToActivate = {}; -- A list of dispensers and droppers (as {World, X, Y Z} quadruplets) that are to be activated every tick
+g_HungerReportTick = 10;
+
+
+
+
+
+
+function Initialize(Plugin)
+ PLUGIN = Plugin
+
+ Plugin:SetName("Debuggers")
+ Plugin:SetVersion(1)
+
+ PluginManager = cRoot:Get():GetPluginManager()
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USING_BLOCK);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USING_ITEM);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_TAKE_DAMAGE);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_TICK);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHAT);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_RIGHT_CLICKING_ENTITY);
+
+ PluginManager:BindCommand("/le", "debuggers", HandleListEntitiesCmd, "Shows a list of all the loaded entities");
+ PluginManager:BindCommand("/ke", "debuggers", HandleKillEntitiesCmd, "Kills all the loaded entities");
+ PluginManager:BindCommand("/wool", "debuggers", HandleWoolCmd, "Sets all your armor to blue wool");
+ PluginManager:BindCommand("/testwnd", "debuggers", HandleTestWndCmd, "Opens up a window using plugin API");
+ PluginManager:BindCommand("/gc", "debuggers", HandleGCCmd, "Activates the Lua garbage collector");
+ PluginManager:BindCommand("/fast", "debuggers", HandleFastCmd, "Switches between fast and normal movement speed");
+ PluginManager:BindCommand("/dash", "debuggers", HandleDashCmd, "Switches between fast and normal sprinting speed");
+ PluginManager:BindCommand("/hunger", "debuggers", HandleHungerCmd, "Lists the current hunger-related variables");
+ PluginManager:BindCommand("/poison", "debuggers", HandlePoisonCmd, "Sets food-poisoning for 15 seconds");
+ PluginManager:BindCommand("/starve", "debuggers", HandleStarveCmd, "Sets the food level to zero");
+ PluginManager:BindCommand("/fl", "debuggers", HandleFoodLevelCmd, "Sets the food level to the given value");
+
+ -- Enable the following line for BlockArea / Generator interface testing:
+ -- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATED);
+
+ LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
+
+ -- TestBlockAreas();
+ -- TestSQLiteBindings();
+ -- TestExpatBindings();
+
+ return true
+end;
+
+
+
+
+
+
+function TestBlockAreas()
+ LOG("Testing block areas...");
+
+ -- Debug block area merging:
+ local BA1 = cBlockArea();
+ local BA2 = cBlockArea();
+ if (BA1:LoadFromSchematicFile("schematics/test.schematic")) then
+ if (BA2:LoadFromSchematicFile("schematics/fountain.schematic")) then
+ BA2:SetRelBlockType(0, 0, 0, E_BLOCK_LAPIS_BLOCK);
+ BA2:SetRelBlockType(1, 0, 0, E_BLOCK_LAPIS_BLOCK);
+ BA2:SetRelBlockType(2, 0, 0, E_BLOCK_LAPIS_BLOCK);
+ BA1:Merge(BA2, 1, 10, 1, cBlockArea.msImprint);
+ BA1:SaveToSchematicFile("schematics/merge.schematic");
+ end
+ else
+ BA1:Create(16, 16, 16);
+ end
+
+ -- Debug block area cuboid filling:
+ BA1:FillRelCuboid(2, 9, 2, 8, 2, 8, cBlockArea.baTypes, E_BLOCK_GOLD_BLOCK);
+ BA1:RelLine(2, 2, 2, 9, 8, 8, cBlockArea.baTypes or cBlockArea.baMetas, E_BLOCK_SAPLING, E_META_SAPLING_BIRCH);
+ BA1:SaveToSchematicFile("schematics/fillrel.schematic");
+
+ -- Debug block area mirroring:
+ if (BA1:LoadFromSchematicFile("schematics/lt.schematic")) then
+ BA1:MirrorXYNoMeta();
+ BA1:SaveToSchematicFile("schematics/lt_XY.schematic");
+ BA1:MirrorXYNoMeta();
+ BA1:SaveToSchematicFile("schematics/lt_XY2.schematic");
+
+ BA1:MirrorXZNoMeta();
+ BA1:SaveToSchematicFile("schematics/lt_XZ.schematic");
+ BA1:MirrorXZNoMeta();
+ BA1:SaveToSchematicFile("schematics/lt_XZ2.schematic");
+
+ BA1:MirrorYZNoMeta();
+ BA1:SaveToSchematicFile("schematics/lt_YZ.schematic");
+ BA1:MirrorYZNoMeta();
+ BA1:SaveToSchematicFile("schematics/lt_YZ2.schematic");
+ end
+
+ -- Debug block area rotation:
+ if (BA1:LoadFromSchematicFile("schematics/rot.schematic")) then
+ BA1:RotateCWNoMeta();
+ BA1:SaveToSchematicFile("schematics/rot1.schematic");
+ BA1:RotateCWNoMeta();
+ BA1:SaveToSchematicFile("schematics/rot2.schematic");
+ BA1:RotateCWNoMeta();
+ BA1:SaveToSchematicFile("schematics/rot3.schematic");
+ BA1:RotateCWNoMeta();
+ BA1:SaveToSchematicFile("schematics/rot4.schematic");
+ end
+
+ -- Debug block area rotation:
+ if (BA1:LoadFromSchematicFile("schematics/rotm.schematic")) then
+ BA1:RotateCCW();
+ BA1:SaveToSchematicFile("schematics/rotm1.schematic");
+ BA1:RotateCCW();
+ BA1:SaveToSchematicFile("schematics/rotm2.schematic");
+ BA1:RotateCCW();
+ BA1:SaveToSchematicFile("schematics/rotm3.schematic");
+ BA1:RotateCCW();
+ BA1:SaveToSchematicFile("schematics/rotm4.schematic");
+ end
+
+ -- Debug block area mirroring:
+ if (BA1:LoadFromSchematicFile("schematics/ltm.schematic")) then
+ BA1:MirrorXY();
+ BA1:SaveToSchematicFile("schematics/ltm_XY.schematic");
+ BA1:MirrorXY();
+ BA1:SaveToSchematicFile("schematics/ltm_XY2.schematic");
+
+ BA1:MirrorXZ();
+ BA1:SaveToSchematicFile("schematics/ltm_XZ.schematic");
+ BA1:MirrorXZ();
+ BA1:SaveToSchematicFile("schematics/ltm_XZ2.schematic");
+
+ BA1:MirrorYZ();
+ BA1:SaveToSchematicFile("schematics/ltm_YZ.schematic");
+ BA1:MirrorYZ();
+ BA1:SaveToSchematicFile("schematics/ltm_YZ2.schematic");
+ end
+
+ LOG("Block areas test ended");
+end
+
+
+
+
+
+
+function TestSQLiteBindings()
+ LOG("Testing SQLite bindings...");
+
+ -- Debug SQLite binding
+ local TestDB, ErrCode, ErrMsg = sqlite3.open("test.sqlite");
+ if (TestDB ~= nil) then
+ local function ShowRow(UserData, NumCols, Values, Names)
+ assert(UserData == 'UserData');
+ LOG("New row");
+ for i = 1, NumCols do
+ LOG(" " .. Names[i] .. " = " .. Values[i]);
+ end
+ return 0;
+ end
+ local sql = [=[
+ CREATE TABLE numbers(num1,num2,str);
+ INSERT INTO numbers VALUES(1, 11, "ABC");
+ INSERT INTO numbers VALUES(2, 22, "DEF");
+ INSERT INTO numbers VALUES(3, 33, "UVW");
+ INSERT INTO numbers VALUES(4, 44, "XYZ");
+ SELECT * FROM numbers;
+ ]=]
+ local Res = TestDB:exec(sql, ShowRow, 'UserData');
+ if (Res ~= sqlite3.OK) then
+ LOG("TestDB:exec() failed: " .. Res .. " (" .. TestDB:errmsg() .. ")");
+ end;
+ TestDB:close();
+ else
+ -- This happens if for example SQLite cannot open the file (eg. a folder with the same name exists)
+ LOG("SQLite3 failed to open DB! (" .. ErrCode .. ", " .. ErrMsg ..")");
+ end
+
+ LOG("SQLite bindings test ended");
+end
+
+
+
+
+
+function TestExpatBindings()
+ LOG("Testing Expat bindings...");
+
+ -- Debug LuaExpat bindings:
+ local count = 0
+ callbacks = {
+ StartElement = function (parser, name)
+ LOG("+ " .. string.rep(" ", count) .. name);
+ count = count + 1;
+ end,
+ EndElement = function (parser, name)
+ count = count - 1;
+ LOG("- " .. string.rep(" ", count) .. name);
+ end
+ }
+
+ local p = lxp.new(callbacks);
+ p:parse("<elem1>\nnext line\nanother line");
+ p:parse("text\n");
+ p:parse("<elem2/>\n");
+ p:parse("more text");
+ p:parse("</elem1>");
+ p:parse("\n");
+ p:parse(); -- finishes the document
+ p:close(); -- closes the parser
+
+ LOG("Expat bindings test ended");
+end
+
+
+
+
+
+function OnUsingBlazeRod(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ)
+ -- Magic rod of query: show block types and metas for both neighbors of the pointed face
+ local Type, Meta, Valid = Player:GetWorld():GetBlockTypeMeta(BlockX, BlockY, BlockZ, Type, Meta);
+
+ if (Type == E_BLOCK_AIR) then
+ Player:SendMessage(cChatColor.LightGray .. "Block {" .. BlockX .. ", " .. BlockY .. ", " .. BlockZ .. "}: air:" .. Meta);
+ else
+ local TempItem = cItem(Type, 1, Meta);
+ Player:SendMessage(cChatColor.LightGray .. "Block {" .. BlockX .. ", " .. BlockY .. ", " .. BlockZ .. "}: " .. ItemToFullString(TempItem) .. " (" .. Type .. ":" .. Meta .. ")");
+ end
+
+ local X, Y, Z = AddFaceDirection(BlockX, BlockY, BlockZ, BlockFace);
+ Valid, Type, Meta = Player:GetWorld():GetBlockTypeMeta(X, Y, Z, Type, Meta);
+ if (Type == E_BLOCK_AIR) then
+ Player:SendMessage(cChatColor.LightGray .. "Block {" .. X .. ", " .. Y .. ", " .. Z .. "}: air:" .. Meta);
+ else
+ local TempItem = cItem(Type, 1, Meta);
+ Player:SendMessage(cChatColor.LightGray .. "Block {" .. X .. ", " .. Y .. ", " .. Z .. "}: " .. ItemToFullString(TempItem) .. " (" .. Type .. ":" .. Meta .. ")");
+ end
+ return false;
+end
+
+
+
+
+
+function OnUsingDiamond(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ)
+ -- Rclk with a diamond to test block area cropping and expanding
+ local Area = cBlockArea();
+ Area:Read(Player:GetWorld(),
+ BlockX - 19, BlockX + 19,
+ BlockY - 7, BlockY + 7,
+ BlockZ - 19, BlockZ + 19
+ );
+
+ LOG("Size before cropping: " .. Area:GetSizeX() .. " x " .. Area:GetSizeY() .. " x " .. Area:GetSizeZ());
+ Area:DumpToRawFile("crop0.dat");
+
+ Area:Crop(2, 3, 0, 0, 0, 0);
+ LOG("Size after cropping 1: " .. Area:GetSizeX() .. " x " .. Area:GetSizeY() .. " x " .. Area:GetSizeZ());
+ Area:DumpToRawFile("crop1.dat");
+
+ Area:Crop(2, 3, 0, 0, 0, 0);
+ LOG("Size after cropping 2: " .. Area:GetSizeX() .. " x " .. Area:GetSizeY() .. " x " .. Area:GetSizeZ());
+ Area:DumpToRawFile("crop2.dat");
+
+ Area:Expand(2, 3, 0, 0, 0, 0);
+ LOG("Size after expanding 1: " .. Area:GetSizeX() .. " x " .. Area:GetSizeY() .. " x " .. Area:GetSizeZ());
+ Area:DumpToRawFile("expand1.dat");
+
+ Area:Expand(3, 2, 1, 1, 0, 0);
+ LOG("Size after expanding 2: " .. Area:GetSizeX() .. " x " .. Area:GetSizeY() .. " x " .. Area:GetSizeZ());
+ Area:DumpToRawFile("expand2.dat");
+
+ Area:Crop(0, 0, 0, 0, 3, 2);
+ LOG("Size after cropping 3: " .. Area:GetSizeX() .. " x " .. Area:GetSizeY() .. " x " .. Area:GetSizeZ());
+ Area:DumpToRawFile("crop3.dat");
+
+ Area:Crop(0, 0, 3, 2, 0, 0);
+ LOG("Size after cropping 4: " .. Area:GetSizeX() .. " x " .. Area:GetSizeY() .. " x " .. Area:GetSizeZ());
+ Area:DumpToRawFile("crop4.dat");
+
+ LOG("Crop test done");
+ Player:SendMessage("Crop / expand test done.");
+ return false;
+end
+
+
+
+
+
+function OnUsingEyeOfEnder(Player, BlockX, BlockY, BlockZ)
+ -- Rclk with an eye of ender places a predefined schematic at the cursor
+ local Area = cBlockArea();
+ if not(Area:LoadFromSchematicFile("schematics/test.schematic")) then
+ LOG("Loading failed");
+ return false;
+ end
+ LOG("Schematic loaded, placing now.");
+ Area:Write(Player:GetWorld(), BlockX, BlockY, BlockZ);
+ LOG("Done.");
+ return false;
+end
+
+
+
+
+
+function OnUsingEnderPearl(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ)
+ -- Rclk with an ender pearl saves a predefined area around the cursor into a .schematic file. Also tests area copying
+ local Area = cBlockArea();
+ if not(Area:Read(Player:GetWorld(),
+ BlockX - 8, BlockX + 8, BlockY - 8, BlockY + 8, BlockZ - 8, BlockZ + 8)
+ ) then
+ LOG("LUA: Area couldn't be read");
+ return false;
+ end
+ LOG("LUA: Area read, copying now.");
+ local Area2 = cBlockArea();
+ Area2:CopyFrom(Area);
+ LOG("LUA: Copied, now saving.");
+ if not(Area2:SaveToSchematicFile("schematics/test.schematic")) then
+ LOG("LUA: Cannot save schematic file.");
+ return false;
+ end
+ LOG("LUA: Done.");
+ return false;
+end
+
+
+
+
+
+function OnUsingRedstoneTorch(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ)
+ -- Redstone torch activates a rapid dispenser / dropper discharge (at every tick):
+ local BlockType = Player:GetWorld():GetBlock(BlockX, BlockY, BlockZ);
+ if (BlockType == E_BLOCK_DISPENSER) then
+ table.insert(g_DropSpensersToActivate, {World = Player:GetWorld(), x = BlockX, y = BlockY, z = BlockZ});
+ Player:SendMessage("Dispenser at {" .. BlockX .. ", " .. BlockY .. ", " .. BlockZ .. "} discharging");
+ return true;
+ elseif (BlockType == E_BLOCK_DROPPER) then
+ table.insert(g_DropSpensersToActivate, {World = Player:GetWorld(), x = BlockX, y = BlockY, z = BlockZ});
+ Player:SendMessage("Dropper at {" .. BlockX .. ", " .. BlockY .. ", " .. BlockZ .. "} discharging");
+ return true;
+ else
+ Player:SendMessage("Neither a dispenser nor a dropper at {" .. BlockX .. ", " .. BlockY .. ", " .. BlockZ .. "}: " .. BlockType);
+ end
+ return false;
+end
+
+
+
+
+
+function OnPlayerUsingItem(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ)
+
+ -- dont check if the direction is in the air
+ if (BlockFace == BLOCK_FACE_NONE) then
+ return false
+ end
+
+ local HeldItem = Player:GetEquippedItem();
+ local HeldItemType = HeldItem.m_ItemType;
+
+ if (HeldItemType == E_ITEM_STICK) then
+ -- Magic sTick of ticking: set the pointed block for ticking at the next tick
+ Player:SendMessage(cChatColor.LightGray .. "Setting next block tick to {" .. BlockX .. ", " .. BlockY .. ", " .. BlockZ .. "}")
+ Player:GetWorld():SetNextBlockTick(BlockX, BlockY, BlockZ);
+ return true
+ elseif (HeldItemType == E_ITEM_BLAZE_ROD) then
+ return OnUsingBlazeRod(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ);
+ elseif (HeldItemType == E_ITEM_DIAMOND) then
+ return OnUsingDiamond(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ);
+ elseif (HeldItemType == E_ITEM_EYE_OF_ENDER) then
+ return OnUsingEyeOfEnder(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ);
+ elseif (HeldItemType == E_ITEM_ENDER_PEARL) then
+ return OnUsingEnderPearl(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ);
+ end
+ return false;
+end
+
+
+
+
+
+function OnPlayerUsingBlock(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ, BlockType, BlockMeta)
+ -- dont check if the direction is in the air
+ if (BlockFace == BLOCK_FACE_NONE) then
+ return false
+ end
+
+ local HeldItem = Player:GetEquippedItem();
+ local HeldItemType = HeldItem.m_ItemType;
+
+ if (HeldItemType == E_BLOCK_REDSTONE_TORCH_ON) then
+ return OnUsingRedstoneTorch(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ);
+ end
+end
+
+
+
+
+
+function OnTakeDamage(Receiver, TDI)
+ -- Receiver is cPawn
+ -- TDI is TakeDamageInfo
+
+ LOG(Receiver:GetClass() .. " was dealt " .. DamageTypeToString(TDI.DamageType) .. " damage: Raw " .. TDI.RawDamage .. ", Final " .. TDI.FinalDamage .. " (" .. (TDI.RawDamage - TDI.FinalDamage) .. " covered by armor)");
+ return false;
+end
+
+
+
+
+
+--- When set to a positive number, the following OnTick() will perform GC and decrease until 0 again
+GCOnTick = 0;
+
+
+
+
+
+function OnTick()
+ -- Activate all dropspensers in the g_DropSpensersToActivate list:
+ local ActivateDrSp = function(DropSpenser)
+ if (DropSpenser:GetContents():GetFirstUsedSlot() == -1) then
+ return true;
+ end
+ DropSpenser:Activate();
+ return false;
+ end
+ -- Walk the list backwards, because we're removing some items
+ local idx = #g_DropSpensersToActivate;
+ for i = idx, 1, -1 do
+ local DrSp = g_DropSpensersToActivate[i];
+ if not(DrSp.World:DoWithDropSpenserAt(DrSp.x, DrSp.y, DrSp.z, ActivateDrSp)) then
+ table.remove(g_DropSpensersToActivate, i);
+ end
+ end
+
+
+ -- If GCOnTick > 0, do a garbage-collect and decrease by one
+ if (GCOnTick > 0) then
+ collectgarbage();
+ GCOnTick = GCOnTick - 1;
+ end
+
+ --[[
+ if (g_HungerReportTick > 0) then
+ g_HungerReportTick = g_HungerReportTick - 1;
+ else
+ g_HungerReportTick = 10;
+ cRoot:Get():GetDefaultWorld():ForEachPlayer(
+ function(a_Player)
+ a_Player:SendMessage("FoodStat: " .. a_Player:GetFoodLevel() .. " / " .. a_Player:GetFoodExhaustionLevel());
+ end
+ );
+ end
+ ]]
+
+ return false;
+end
+
+
+
+
+
+function OnChunkGenerated(World, ChunkX, ChunkZ, ChunkDesc)
+ -- Test ChunkDesc / BlockArea interaction
+ local BlockArea = cBlockArea();
+ ChunkDesc:ReadBlockArea(BlockArea, 0, 15, 50, 70, 0, 15);
+
+ -- BlockArea:SaveToSchematicFile("ChunkBlocks_" .. ChunkX .. "_" .. ChunkZ .. ".schematic");
+
+ ChunkDesc:WriteBlockArea(BlockArea, 5, 115, 5);
+ return false;
+end
+
+
+
+
+
+function OnChat(a_Player, a_Message)
+ return false, "blabla " .. a_Message;
+end
+
+
+
+
+
+function OnPlayerRightClickingEntity(a_Player, a_Entity)
+ LOG("Player " .. a_Player:GetName() .. " right-clicking entity ID " .. a_Entity:GetUniqueID() .. ", a " .. a_Entity:GetClass());
+ return false;
+end
+
+
+
+
+
+-- Function "round" copied from http://lua-users.org/wiki/SimpleRound
+function round(num, idp)
+ local mult = 10^(idp or 0)
+ if num >= 0 then return math.floor(num * mult + 0.5) / mult
+ else return math.ceil(num * mult - 0.5) / mult end
+end
+
+
+
+
+
+function HandleListEntitiesCmd(Split, Player)
+ local NumEntities = 0;
+
+ local ListEntity = function(Entity)
+ if (Entity:IsDestroyed()) then
+ -- The entity has already been destroyed, don't list it
+ return false;
+ end;
+ Player:SendMessage(" " .. Entity:GetUniqueID() .. ": " .. Entity:GetClass() .. " {" .. round(Entity:GetPosX(), 2) .. ", " .. round(Entity:GetPosY(), 2) .. ", " .. round(Entity:GetPosZ(), 2) .."}");
+ NumEntities = NumEntities + 1;
+ end
+
+ Player:SendMessage("Listing all entities...");
+ Player:GetWorld():ForEachEntity(ListEntity);
+ Player:SendMessage("List finished, " .. NumEntities .. " entities listed");
+ return true;
+end
+
+
+
+
+
+function HandleKillEntitiesCmd(Split, Player)
+ local NumEntities = 0;
+
+ local KillEntity = function(Entity)
+ -- kill everything except for players:
+ if (Entity:GetEntityType() ~= cEntity.etPlayer) then
+ Entity:Destroy();
+ NumEntities = NumEntities + 1;
+ end;
+ end
+
+ Player:SendMessage("Killing all entities...");
+ Player:GetWorld():ForEachEntity(KillEntity);
+ Player:SendMessage("Killed " .. NumEntities .. " entities.");
+ return true;
+end
+
+
+
+
+
+function HandleWoolCmd(Split, Player)
+ local Wool = cItem(E_BLOCK_WOOL, 1, E_META_WOOL_BLUE);
+ Player:GetInventory():SetArmorSlot(0, Wool);
+ Player:GetInventory():SetArmorSlot(1, Wool);
+ Player:GetInventory():SetArmorSlot(2, Wool);
+ Player:GetInventory():SetArmorSlot(3, Wool);
+ Player:SendMessage("You have been bluewooled :)");
+ return true;
+end
+
+
+
+
+
+function HandleTestWndCmd(a_Split, a_Player)
+ local WindowType = cWindow.Hopper;
+ local WindowSizeX = 5;
+ local WindowSizeY = 1;
+ if (#a_Split == 4) then
+ WindowType = tonumber(a_Split[2]);
+ WindowSizeX = tonumber(a_Split[3]);
+ WindowSizeY = tonumber(a_Split[4]);
+ elseif (#a_Split ~= 1) then
+ a_Player:SendMessage("Usage: /testwnd [WindowType WindowSizeX WindowSizeY]");
+ return true;
+ end
+
+ -- Test out the OnClosing callback's ability to refuse to close the window
+ local attempt = 1;
+ local OnClosing = function(Window, Player, CanRefuse)
+ Player:SendMessage("Window closing attempt #" .. attempt .. "; CanRefuse = " .. tostring(CanRefuse));
+ attempt = attempt + 1;
+ return CanRefuse and (attempt <= 3); -- refuse twice, then allow, unless CanRefuse is set to true
+ end
+
+ -- Log the slot changes
+ local OnSlotChanged = function(Window, SlotNum)
+ LOG("Window \"" .. Window:GetWindowTitle() .. "\" slot " .. SlotNum .. " changed.");
+ end
+
+ local Window = cLuaWindow(WindowType, WindowSizeX, WindowSizeY, "TestWnd");
+ local Item2 = cItem(E_ITEM_DIAMOND_SWORD, 1, 0, "1=1");
+ local Item3 = cItem(E_ITEM_DIAMOND_SHOVEL);
+ Item3.m_Enchantments:SetLevel(cEnchantments.enchUnbreaking, 4);
+ local Item4 = cItem(Item3); -- Copy
+ Item4.m_Enchantments:SetLevel(cEnchantments.enchEfficiency, 3); -- Add enchantment
+ Item4.m_Enchantments:SetLevel(cEnchantments.enchUnbreaking, 5); -- Overwrite existing level
+ local Item5 = cItem(E_ITEM_DIAMOND_CHESTPLATE, 1, 0, "thorns=1;unbreaking=3");
+ Window:SetSlot(a_Player, 0, cItem(E_ITEM_DIAMOND, 64));
+ Window:SetSlot(a_Player, 1, Item2);
+ Window:SetSlot(a_Player, 2, Item3);
+ Window:SetSlot(a_Player, 3, Item4);
+ Window:SetSlot(a_Player, 4, Item5);
+ Window:SetOnClosing(OnClosing);
+ Window:SetOnSlotChanged(OnSlotChanged);
+
+ a_Player:OpenWindow(Window);
+
+ -- To make sure that the object has the correct life-management in Lua,
+ -- let's garbage-collect in the following few ticks
+ GCOnTick = 10;
+
+ return true;
+end
+
+
+
+
+
+function HandleGCCmd(a_Split, a_Player)
+ collectgarbage();
+ return true;
+end
+
+
+
+
+
+
+function HandleFastCmd(a_Split, a_Player)
+ if (a_Player:GetNormalMaxSpeed() <= 0.11) then
+ -- The player has normal speed, set double speed:
+ a_Player:SetNormalMaxSpeed(0.2);
+ a_Player:SendMessage("You are now fast");
+ else
+ -- The player has fast speed, set normal speed:
+ a_Player:SetNormalMaxSpeed(0.1);
+ a_Player:SendMessage("Back to normal speed");
+ end
+ return true;
+end
+
+
+
+
+
+function HandleDashCmd(a_Split, a_Player)
+ if (a_Player:GetSprintingMaxSpeed() <= 0.14) then
+ -- The player has normal sprinting speed, set double Sprintingspeed:
+ a_Player:SetSprintingMaxSpeed(0.4);
+ a_Player:SendMessage("You can now sprint very fast");
+ else
+ -- The player has fast sprinting speed, set normal sprinting speed:
+ a_Player:SetSprintingMaxSpeed(0.13);
+ a_Player:SendMessage("Back to normal sprinting");
+ end
+ return true;
+end;
+
+
+
+
+
+function HandleHungerCmd(a_Split, a_Player)
+ a_Player:SendMessage("FoodLevel: " .. a_Player:GetFoodLevel());
+ a_Player:SendMessage("FoodSaturationLevel: " .. a_Player:GetFoodSaturationLevel());
+ a_Player:SendMessage("FoodTickTimer: " .. a_Player:GetFoodTickTimer());
+ a_Player:SendMessage("FoodExhaustionLevel: " .. a_Player:GetFoodExhaustionLevel());
+ a_Player:SendMessage("FoodPoisonedTicksRemaining: " .. a_Player:GetFoodPoisonedTicksRemaining());
+ return true;
+end
+
+
+
+
+
+function HandlePoisonCmd(a_Split, a_Player)
+ a_Player:FoodPoison(15 * 20);
+ return true;
+end
+
+
+
+
+
+function HandleStarveCmd(a_Split, a_Player)
+ a_Player:SetFoodLevel(0);
+ a_Player:SendMessage("You are now starving");
+ return true;
+end
+
+
+
+
+
+function HandleFoodLevelCmd(a_Split, a_Player)
+ if (#a_Split ~= 2) then
+ a_Player:SendMessage("Missing an argument: the food level to set");
+ return true;
+ end
+
+ a_Player:SetFoodLevel(tonumber(a_Split[2]));
+ a_Player:SendMessage("Food level set to " .. a_Player:GetFoodLevel());
+ return true;
+end
+
+
+
+
diff --git a/MCServer/Plugins/DiamondMover/DiamondMover.lua b/MCServer/Plugins/DiamondMover/DiamondMover.lua
index eaced1058..c89a3394f 100644
--- a/MCServer/Plugins/DiamondMover/DiamondMover.lua
+++ b/MCServer/Plugins/DiamondMover/DiamondMover.lua
@@ -1,83 +1,83 @@
-
--- DiamondMover.lua
-
--- An example Lua plugin using the cBlockArea object
--- When a player rclks with a diamond in their hand, an area around the clicked block is moved in the direction the player is facing
-
-
-
-
-
--- Global variables
-PLUGIN = {} -- Reference to own plugin object
-MOVER_SIZE_X = 4;
-MOVER_SIZE_Y = 4;
-MOVER_SIZE_Z = 4;
-
-
-
-
-
-function Initialize(Plugin)
- PLUGIN = Plugin;
-
- Plugin:SetName("DiamondMover");
- Plugin:SetVersion(1);
-
- PluginManager = cRoot:Get():GetPluginManager();
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USED_ITEM);
- return true;
-end
-
-
-
-
-
-function OnPlayerUsedItem(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ)
-
- -- Don't check if the direction is in the air
- if (BlockFace == -1) then
- return false;
- end;
-
- if (Player:HasPermission("diamondmover.move") == false) then
- return true;
- end;
-
- -- Rclk with a diamond to push in the direction the player is facing
- if (Player:GetEquippedItem().m_ItemType == E_ITEM_DIAMOND) then
- local Area = cBlockArea();
- Area:Read(Player:GetWorld(),
- BlockX - MOVER_SIZE_X, BlockX + MOVER_SIZE_X,
- BlockY - MOVER_SIZE_Y, BlockY + MOVER_SIZE_Y,
- BlockZ - MOVER_SIZE_Z, BlockZ + MOVER_SIZE_Z
- );
-
- local PlayerPitch = Player:GetPitch();
- if (PlayerPitch < -70) then -- looking up
- BlockY = BlockY + 1;
- else
- if (PlayerPitch > 70) then -- looking down
- BlockY = BlockY - 1;
- else
- local PlayerRot = Player:GetRotation() + 180; -- Convert [-180, 180] into [0, 360] for simpler conditions
- if ((PlayerRot < 45) or (PlayerRot > 315)) then
- BlockZ = BlockZ - 1;
- else
- if (PlayerRot < 135) then
- BlockX = BlockX + 1;
- else
- if (PlayerRot < 225) then
- BlockZ = BlockZ + 1;
- else
- BlockX = BlockX - 1;
- end;
- end;
- end;
- end;
- end;
-
- Area:Write(Player:GetWorld(), BlockX - MOVER_SIZE_X, BlockY - MOVER_SIZE_Y, BlockZ - MOVER_SIZE_Z);
- return false;
- end
+
+-- DiamondMover.lua
+
+-- An example Lua plugin using the cBlockArea object
+-- When a player rclks with a diamond in their hand, an area around the clicked block is moved in the direction the player is facing
+
+
+
+
+
+-- Global variables
+PLUGIN = {} -- Reference to own plugin object
+MOVER_SIZE_X = 4;
+MOVER_SIZE_Y = 4;
+MOVER_SIZE_Z = 4;
+
+
+
+
+
+function Initialize(Plugin)
+ PLUGIN = Plugin;
+
+ Plugin:SetName("DiamondMover");
+ Plugin:SetVersion(1);
+
+ PluginManager = cRoot:Get():GetPluginManager();
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USED_ITEM);
+ return true;
+end
+
+
+
+
+
+function OnPlayerUsedItem(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ)
+
+ -- Don't check if the direction is in the air
+ if (BlockFace == -1) then
+ return false;
+ end;
+
+ if (Player:HasPermission("diamondmover.move") == false) then
+ return true;
+ end;
+
+ -- Rclk with a diamond to push in the direction the player is facing
+ if (Player:GetEquippedItem().m_ItemType == E_ITEM_DIAMOND) then
+ local Area = cBlockArea();
+ Area:Read(Player:GetWorld(),
+ BlockX - MOVER_SIZE_X, BlockX + MOVER_SIZE_X,
+ BlockY - MOVER_SIZE_Y, BlockY + MOVER_SIZE_Y,
+ BlockZ - MOVER_SIZE_Z, BlockZ + MOVER_SIZE_Z
+ );
+
+ local PlayerPitch = Player:GetPitch();
+ if (PlayerPitch < -70) then -- looking up
+ BlockY = BlockY + 1;
+ else
+ if (PlayerPitch > 70) then -- looking down
+ BlockY = BlockY - 1;
+ else
+ local PlayerRot = Player:GetRotation() + 180; -- Convert [-180, 180] into [0, 360] for simpler conditions
+ if ((PlayerRot < 45) or (PlayerRot > 315)) then
+ BlockZ = BlockZ - 1;
+ else
+ if (PlayerRot < 135) then
+ BlockX = BlockX + 1;
+ else
+ if (PlayerRot < 225) then
+ BlockZ = BlockZ + 1;
+ else
+ BlockX = BlockX - 1;
+ end;
+ end;
+ end;
+ end;
+ end;
+
+ Area:Write(Player:GetWorld(), BlockX - MOVER_SIZE_X, BlockY - MOVER_SIZE_Y, BlockZ - MOVER_SIZE_Z);
+ return false;
+ end
end \ No newline at end of file
diff --git a/MCServer/Plugins/Handy/handy.lua b/MCServer/Plugins/Handy/handy.lua
index c2330abab..6d226ccaf 100644
--- a/MCServer/Plugins/Handy/handy.lua
+++ b/MCServer/Plugins/Handy/handy.lua
@@ -1,28 +1,28 @@
--- Global variables
-PLUGIN = {} -- Reference to own plugin object
-CHEST_WIDTH = 9
-HANDY_VERSION = 1
---[[
-
-Handy is a plugin for other plugins. It contain no commands, no hooks, but functions to ease plugins developers' life.
-
-API:
-
-
-TODO:
-1. GetChestSlot wrapper, so it will detect double chest neighbour chest and will be able to access it.
-]]
-
-function Initialize(Plugin)
- PLUGIN = Plugin
- PLUGIN:SetName("Handy")
- PLUGIN:SetVersion(HANDY_VERSION)
-
- PluginManager = cRoot:Get():GetPluginManager()
- LOG("Initialized " .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion())
- return true
-end
-
-function OnDisable()
- LOG(PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. " is shutting down...")
+-- Global variables
+PLUGIN = {} -- Reference to own plugin object
+CHEST_WIDTH = 9
+HANDY_VERSION = 1
+--[[
+
+Handy is a plugin for other plugins. It contain no commands, no hooks, but functions to ease plugins developers' life.
+
+API:
+
+
+TODO:
+1. GetChestSlot wrapper, so it will detect double chest neighbour chest and will be able to access it.
+]]
+
+function Initialize(Plugin)
+ PLUGIN = Plugin
+ PLUGIN:SetName("Handy")
+ PLUGIN:SetVersion(HANDY_VERSION)
+
+ PluginManager = cRoot:Get():GetPluginManager()
+ LOG("Initialized " .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion())
+ return true
+end
+
+function OnDisable()
+ LOG(PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. " is shutting down...")
end \ No newline at end of file
diff --git a/MCServer/Plugins/Handy/handy_functions.lua b/MCServer/Plugins/Handy/handy_functions.lua
index f8423312f..a76980c6e 100644
--- a/MCServer/Plugins/Handy/handy_functions.lua
+++ b/MCServer/Plugins/Handy/handy_functions.lua
@@ -1,355 +1,355 @@
---[[
-General stuff
-]]
--- Returns Handy plugin version number
-function GetHandyVersion()
- return HANDY_VERSION
-end
--- Checks if handy is in proper version
-function CheckForRequiedVersion(IN_version)
- if (IN_version > HANDY_VERSION) then return false end
- return true
-end
---[[
-MCS-specific _functions and nasty hacks :D
-]]
--- There's a "GetChestHeight" function inside source code, but it's not lua-exported
-function GetChestHeightCheat(IN_chest)
- if (IN_chest:GetSlot(28) == nil) then -- this means we're trying to get double chest slot and FAIL
- LOGWARN("HANDY: single chest checked")
- return 3
- end
- LOGWARN("HANDY: double chest checked")
- return 6
-end
--- Those two checks how many items of given IN_itemID chest and player have, and how much they could fit inside them
-function ReadChestForItem(IN_chest, IN_itemID)
- local _items_found = 0
- local _free_space = 0
- -- stalk through chest slots...
- local _slot_counter = 0
- local _slot_item
- local _item_max_stack = GetItemMaxStack(IN_itemID)
- while true do
- _slot_item = IN_chest:GetSlot(_slot_counter)
- if (_slot_item ~= nil) then
- if (_slot_item.m_ItemID == IN_itemID) then
- _items_found = _items_found + _slot_item.m_ItemCount
- _free_space = _free_space + (_item_max_stack - _slot_item.m_ItemCount)
- end
- if (_slot_item:IsEmpty() == true) then
- _free_space = _free_space + _item_max_stack
- end
- end
- _slot_counter = _slot_counter + 1
- if (_slot_counter == CHEST_WIDTH*GetChestHeightCheat(IN_chest)) then
- break
- end
- end
- return _items_found, _free_space
-end
-function ReadPlayerForItem(IN_player, IN_itemID)
- local _items_found = 0
- local _free_space = 0
- -- stalk through IN_player inventory slots...
- local _slot_counter = 9
- if (ItemIsArmor(IN_itemID) == true) then _slot_counter = 5 end
- local _slot_item
- local _item_max_stack = GetItemMaxStack(IN_itemID)
- while true do
- _slot_item = IN_player:GetInventory():GetSlot(_slot_counter)
- if (_slot_item ~= nil) then
- if (_slot_item.m_ItemID == IN_itemID) then
- _items_found = _items_found + _slot_item.m_ItemCount
- _free_space = _free_space + (_item_max_stack - _slot_item.m_ItemCount)
- end
- if (_slot_item:IsEmpty() == true) then
- _free_space = _free_space + _item_max_stack
- end
- end
- _slot_counter = _slot_counter + 1
- if (_slot_counter == 45) then
- break
- end
- end
- return _items_found, _free_space
-end
--- Following functions are for chest-related operations (since noone was bothered writing them in MCS code)
--- BEWARE! Those assume you did checked if chest has items/space in it!
-function TakeItemsFromChest(IN_chest, IN_itemID, IN_ammount) -- UNSAFE! CHECK FOR ITEMS FIRST!!
- -- stalk through chest slots...
- local _slot_counter = 0
- local _slot_item
- local _take_count = IN_ammount
- while true do
- _slot_item = IN_chest:GetSlot(_slot_counter)
- if (_slot_item ~= nil) then
- if (_slot_item.m_ItemID == IN_itemID) then
- -- assuming player have enought money
- if (_take_count > 0) then
- if (_take_count > _slot_item.m_ItemCount) then
- _take_count = _take_count - _slot_item.m_ItemCount
- IN_chest:SetSlot(_slot_counter, cItem()) -- a bit hacky, can't make cItem:Clear() work(
- else
- local _left_count = _slot_item.m_ItemCount - _take_count
- IN_chest:SetSlot(_slot_counter, cItem(_slot_item.m_ItemID, _left_count)) -- a bit hacky
- _take_count = 0
- end
- end
- if (_take_count == 0) then
- break
- end
- end
- end
- _slot_counter = _slot_counter + 1
- if (_slot_counter == CHEST_WIDTH*GetChestHeightCheat(IN_chest)) then
- break
- end
- end
-end
-function PutItemsToChest(IN_chest, IN_itemID, IN_ammount) -- UNSAFE! CHECK FOR SPACE FIRST!!
- -- stalk through chest slots...
- local _slot_counter = 0
- local _slot_item
- local _put_count = IN_ammount
- local _max_stack = GetItemMaxStack(IN_itemID)
- while true do
- _slot_item = IN_chest:GetSlot(_slot_counter)
- local _portion = 0
- local _ammount_to_set = 0
- if (_slot_item ~= nil) then
- if (_slot_item:IsEmpty() == true) then
- _portion = math.min(_max_stack, _put_count)
- _ammount_to_set = _portion
- else
- if (_slot_item.m_ItemID == IN_itemID) then
- -- choose between how much we need to put and how much free space left
- _portion = math.min(_put_count, _max_stack - _slot_item.m_ItemCount)
- _ammount_to_set = _slot_item.m_ItemCount + _portion
- end
- end
- end
- IN_chest:SetSlot(_slot_counter, cItem(IN_itemID, _ammount_to_set)) -- we add max stack to chest
- _put_count = _put_count - _portion
- if (_put_count == 0) then break end
- _slot_counter = _slot_counter + 1
- if (_slot_counter == CHEST_WIDTH*GetChestHeightCheat(IN_chest)) then
- break
- end
- end
-end
--- Similar to chest-related.
-function TakeItemsFromPlayer(IN_player, IN_itemID, IN_ammount) -- UNSAFE! CHECK FIRST!
- local _put_count = IN_ammount
- local _max_stack = GetItemMaxStack(IN_itemID)
- while true do
- local _portion = math.min(_max_stack, _put_count)
- IN_player:GetInventory():RemoveItem(cItem(IN_itemID, _portion))
- _put_count = _put_count - _portion
- if (_put_count == 0) then break end
- end
-end
-function GiveItemsToPlayer(IN_player, IN_itemID, IN_ammount) -- UNSAFE! CHECK FIRST!
- local _put_count = IN_ammount
- local _max_stack = GetItemMaxStack(IN_itemID)
- while true do
- local _portion = math.min(_max_stack, _put_count)
- IN_player:GetInventory():AddItem(cItem(IN_itemID, _portion))
- _put_count = _put_count - _portion
- if (_put_count == 0) then break end
- end
-end
--- This function returns item max stack for a given itemID. It uses vanilla max stack size, and uses several non-common items notations;
--- Those are:
--- oneonerecord (because aparently 11record wasn't the best idea in lua scripting application)
--- carrotonastick (because it wasn't added to items.txt yet)
--- waitrecord (for same reason)
--- Feel free to ignore the difference, or to add those to items.txt
-function GetItemMaxStack(IN_itemID)
- local _result = 64
- -- Tools and swords
- if (IN_itemID == woodensword) then _result = 1 end
- if (IN_itemID == woodenshovel) then _result = 1 end
- if (IN_itemID == woodenpickaxe) then _result = 1 end
- if (IN_itemID == woodenaxe) then _result = 1 end
- if (IN_itemID == woodenhoe) then _result = 1 end
- if (IN_itemID == stonesword) then _result = 1 end
- if (IN_itemID == stoneshovel) then _result = 1 end
- if (IN_itemID == stonepickaxe) then _result = 1 end
- if (IN_itemID == stoneaxe) then _result = 1 end
- if (IN_itemID == stonehoe) then _result = 1 end
- if (IN_itemID == ironsword) then _result = 1 end
- if (IN_itemID == ironshovel) then _result = 1 end
- if (IN_itemID == ironpickaxe) then _result = 1 end
- if (IN_itemID == ironaxe) then _result = 1 end
- if (IN_itemID == ironhoe) then _result = 1 end
- if (IN_itemID == diamondsword) then _result = 1 end
- if (IN_itemID == diamondshovel) then _result = 1 end
- if (IN_itemID == diamondpickaxe) then _result = 1 end
- if (IN_itemID == diamondaxe) then _result = 1 end
- if (IN_itemID == diamondhoe) then _result = 1 end
- if (IN_itemID == goldensword) then _result = 1 end
- if (IN_itemID == goldenshovel) then _result = 1 end
- if (IN_itemID == goldenpickaxe) then _result = 1 end
- if (IN_itemID == goldenaxe) then _result = 1 end
- if (IN_itemID == goldenhoe) then _result = 1 end
-
- if (IN_itemID == flintandsteel) then _result = 1 end
- if (IN_itemID == bow) then _result = 1 end
- if (IN_itemID == sign) then _result = 16 end
- if (IN_itemID == woodendoor) then _result = 1 end
- if (IN_itemID == irondoor) then _result = 1 end
- if (IN_itemID == cake) then _result = 1 end
- if (IN_itemID == cauldron) then _result = 1 end
- if (IN_itemID == mushroomstew) then _result = 1 end
- if (IN_itemID == painting) then _result = 1 end
- if (IN_itemID == bucket) then _result = 16 end
- if (IN_itemID == waterbucket) then _result = 1 end
- if (IN_itemID == lavabucket) then _result = 1 end
- if (IN_itemID == minecart) then _result = 1 end
- if (IN_itemID == saddle) then _result = 1 end
- if (IN_itemID == snowball) then _result = 16 end
- if (IN_itemID == boat) then _result = 1 end
- if (IN_itemID == milkbucket) then _result = 1 end
- if (IN_itemID == storageminecart) then _result = 1 end
- if (IN_itemID == poweredminecart) then _result = 1 end
- if (IN_itemID == egg) then _result = 16 end
- if (IN_itemID == fishingrod) then _result = 1 end
- if (IN_itemID == bed) then _result = 1 end
- if (IN_itemID == map) then _result = 1 end
- if (IN_itemID == shears) then _result = 1 end
- if (IN_itemID == enderpearl) then _result = 16 end
- if (IN_itemID == potion) then _result = 1 end
- if (IN_itemID == spawnegg) then _result = 1 end
- if (IN_itemID == bookandquill) then _result = 1 end
- if (IN_itemID == writtenbook) then _result = 1 end
- if (IN_itemID == carrotonastick) then _result = 1 end
-
- if (IN_itemID == goldrecord) then _result = 1 end
- if (IN_itemID == greenrecord) then _result = 1 end
- if (IN_itemID == blocksrecord) then _result = 1 end
- if (IN_itemID == chirprecord) then _result = 1 end
- if (IN_itemID == farrecord) then _result = 1 end
- if (IN_itemID == mallrecord) then _result = 1 end
- if (IN_itemID == mellohirecord) then _result = 1 end
- if (IN_itemID == stalrecord) then _result = 1 end
- if (IN_itemID == stradrecord) then _result = 1 end
- if (IN_itemID == wardrecord) then _result = 1 end
- if (IN_itemID == oneonerecord) then _result = 1 end
- if (IN_itemID == waitrecord) then _result = 1 end
-
- --if (IN_itemID == xxxxxxxxx) then _result = 1 end
-
- if (IN_itemID == leatherhelmet) then _result = 1 end
- if (IN_itemID == leatherchestplate) then _result = 1 end
- if (IN_itemID == leatherpants) then _result = 1 end
- if (IN_itemID == leatherboots) then _result = 1 end
-
- if (IN_itemID == chainmailhelmet) then _result = 1 end
- if (IN_itemID == chainmailchestplate) then _result = 1 end
- if (IN_itemID == chainmailpants) then _result = 1 end
- if (IN_itemID == chainmailboots) then _result = 1 end
-
- if (IN_itemID == ironhelmet) then _result = 1 end
- if (IN_itemID == ironchestplate) then _result = 1 end
- if (IN_itemID == ironpants) then _result = 1 end
- if (IN_itemID == ironboots) then _result = 1 end
-
- if (IN_itemID == diamondhelmet) then _result = 1 end
- if (IN_itemID == diamondchestplate) then _result = 1 end
- if (IN_itemID == diamondpants) then _result = 1 end
- if (IN_itemID == diamondboots) then _result = 1 end
-
- if (IN_itemID == goldenhelmet) then _result = 1 end
- if (IN_itemID == goldenchestplate) then _result = 1 end
- if (IN_itemID == goldenpants) then _result = 1 end
- if (IN_itemID == goldenboots) then _result = 1 end
- return _result
-end
-function ItemIsArmor(IN_itemID)
- local _result = false
- if (IN_itemID == leatherhelmet) then _result = true end
- if (IN_itemID == leatherchestplate) then _result = true end
- if (IN_itemID == leatherpants) then _result = true end
- if (IN_itemID == leatherboots) then _result = true end
-
- if (IN_itemID == chainmailhelmet) then _result = true end
- if (IN_itemID == chainmailchestplate) then _result = true end
- if (IN_itemID == chainmailpants) then _result = true end
- if (IN_itemID == chainmailboots) then _result = true end
-
- if (IN_itemID == ironhelmet) then _result = true end
- if (IN_itemID == ironchestplate) then _result = true end
- if (IN_itemID == ironpants) then _result = true end
- if (IN_itemID == ironboots) then _result = true end
-
- if (IN_itemID == diamondhelmet) then _result = true end
- if (IN_itemID == diamondchestplate) then _result = true end
- if (IN_itemID == diamondpants) then _result = true end
- if (IN_itemID == diamondboots) then _result = true end
-
- if (IN_itemID == goldenhelmet) then _result = true end
- if (IN_itemID == goldenchestplate) then _result = true end
- if (IN_itemID == goldenpants) then _result = true end
- if (IN_itemID == goldenboots) then _result = true end
- return _result
-end
--- Returns full-length playername for a short name (usefull for parsing commands)
-function GetExactPlayername(IN_playername)
- local _result = IN_playername
- local function SetProcessingPlayername(IN_player)
- _result = IN_player:GetName()
- end
- cRoot:Get():FindAndDoWithPlayer(IN_playername, SetProcessingPlayername)
- return _result
-end
-function GetPlayerByName(IN_playername)
- local _player
- local PlayerSetter = function (Player)
- _player = Player
- end
- cRoot:Get():FindAndDoWithPlayer(IN_playername, PlayerSetter)
- return _player
-end
---[[
-Not-so-usual math _functions
-]]
--- Rounds floating point number. Because lua guys think this function doesn't deserve to be presented in lua's math
-function round(IN_x)
- if (IN_x%2 ~= 0.5) then
- return math.floor(IN_x+0.5)
- end
- return IN_x-0.5
-end
---[[
-Functions I use for filework and stringswork
-]]
-function PluralString(IN_value, IN_singular_string, IN_plural_string)
- local _value_string = tostring(IN_value)
- if (_value_string[#_value_string] == "1") then
- return IN_singular_string
- end
- return IN_plural_string
-end
-function PluralItemName(IN_itemID, IN_ammount) -- BEWARE! TEMPORAL SOLUTION THERE! :D
- local _value_string = tostring(IN_value)
- local _name = ""
- if (_value_string[#_value_string] == "1") then
- -- singular names
- _name = ItemTypeToString(IN_itemID)
- else
- -- plural names
- _name = ItemTypeToString(IN_itemID).."s"
- end
- return _name
-end
--- for filewriting purposes. 0 = false, 1 = true
-function StringToBool(value)
- if value=="1" then return true end
- return false
-end
--- same, but reversal
-function BoolToString(value)
- if value==true then return 1 end
- return 0
+--[[
+General stuff
+]]
+-- Returns Handy plugin version number
+function GetHandyVersion()
+ return HANDY_VERSION
+end
+-- Checks if handy is in proper version
+function CheckForRequiedVersion(IN_version)
+ if (IN_version > HANDY_VERSION) then return false end
+ return true
+end
+--[[
+MCS-specific _functions and nasty hacks :D
+]]
+-- There's a "GetChestHeight" function inside source code, but it's not lua-exported
+function GetChestHeightCheat(IN_chest)
+ if (IN_chest:GetSlot(28) == nil) then -- this means we're trying to get double chest slot and FAIL
+ LOGWARN("HANDY: single chest checked")
+ return 3
+ end
+ LOGWARN("HANDY: double chest checked")
+ return 6
+end
+-- Those two checks how many items of given IN_itemID chest and player have, and how much they could fit inside them
+function ReadChestForItem(IN_chest, IN_itemID)
+ local _items_found = 0
+ local _free_space = 0
+ -- stalk through chest slots...
+ local _slot_counter = 0
+ local _slot_item
+ local _item_max_stack = GetItemMaxStack(IN_itemID)
+ while true do
+ _slot_item = IN_chest:GetSlot(_slot_counter)
+ if (_slot_item ~= nil) then
+ if (_slot_item.m_ItemID == IN_itemID) then
+ _items_found = _items_found + _slot_item.m_ItemCount
+ _free_space = _free_space + (_item_max_stack - _slot_item.m_ItemCount)
+ end
+ if (_slot_item:IsEmpty() == true) then
+ _free_space = _free_space + _item_max_stack
+ end
+ end
+ _slot_counter = _slot_counter + 1
+ if (_slot_counter == CHEST_WIDTH*GetChestHeightCheat(IN_chest)) then
+ break
+ end
+ end
+ return _items_found, _free_space
+end
+function ReadPlayerForItem(IN_player, IN_itemID)
+ local _items_found = 0
+ local _free_space = 0
+ -- stalk through IN_player inventory slots...
+ local _slot_counter = 9
+ if (ItemIsArmor(IN_itemID) == true) then _slot_counter = 5 end
+ local _slot_item
+ local _item_max_stack = GetItemMaxStack(IN_itemID)
+ while true do
+ _slot_item = IN_player:GetInventory():GetSlot(_slot_counter)
+ if (_slot_item ~= nil) then
+ if (_slot_item.m_ItemID == IN_itemID) then
+ _items_found = _items_found + _slot_item.m_ItemCount
+ _free_space = _free_space + (_item_max_stack - _slot_item.m_ItemCount)
+ end
+ if (_slot_item:IsEmpty() == true) then
+ _free_space = _free_space + _item_max_stack
+ end
+ end
+ _slot_counter = _slot_counter + 1
+ if (_slot_counter == 45) then
+ break
+ end
+ end
+ return _items_found, _free_space
+end
+-- Following functions are for chest-related operations (since noone was bothered writing them in MCS code)
+-- BEWARE! Those assume you did checked if chest has items/space in it!
+function TakeItemsFromChest(IN_chest, IN_itemID, IN_ammount) -- UNSAFE! CHECK FOR ITEMS FIRST!!
+ -- stalk through chest slots...
+ local _slot_counter = 0
+ local _slot_item
+ local _take_count = IN_ammount
+ while true do
+ _slot_item = IN_chest:GetSlot(_slot_counter)
+ if (_slot_item ~= nil) then
+ if (_slot_item.m_ItemID == IN_itemID) then
+ -- assuming player have enought money
+ if (_take_count > 0) then
+ if (_take_count > _slot_item.m_ItemCount) then
+ _take_count = _take_count - _slot_item.m_ItemCount
+ IN_chest:SetSlot(_slot_counter, cItem()) -- a bit hacky, can't make cItem:Clear() work(
+ else
+ local _left_count = _slot_item.m_ItemCount - _take_count
+ IN_chest:SetSlot(_slot_counter, cItem(_slot_item.m_ItemID, _left_count)) -- a bit hacky
+ _take_count = 0
+ end
+ end
+ if (_take_count == 0) then
+ break
+ end
+ end
+ end
+ _slot_counter = _slot_counter + 1
+ if (_slot_counter == CHEST_WIDTH*GetChestHeightCheat(IN_chest)) then
+ break
+ end
+ end
+end
+function PutItemsToChest(IN_chest, IN_itemID, IN_ammount) -- UNSAFE! CHECK FOR SPACE FIRST!!
+ -- stalk through chest slots...
+ local _slot_counter = 0
+ local _slot_item
+ local _put_count = IN_ammount
+ local _max_stack = GetItemMaxStack(IN_itemID)
+ while true do
+ _slot_item = IN_chest:GetSlot(_slot_counter)
+ local _portion = 0
+ local _ammount_to_set = 0
+ if (_slot_item ~= nil) then
+ if (_slot_item:IsEmpty() == true) then
+ _portion = math.min(_max_stack, _put_count)
+ _ammount_to_set = _portion
+ else
+ if (_slot_item.m_ItemID == IN_itemID) then
+ -- choose between how much we need to put and how much free space left
+ _portion = math.min(_put_count, _max_stack - _slot_item.m_ItemCount)
+ _ammount_to_set = _slot_item.m_ItemCount + _portion
+ end
+ end
+ end
+ IN_chest:SetSlot(_slot_counter, cItem(IN_itemID, _ammount_to_set)) -- we add max stack to chest
+ _put_count = _put_count - _portion
+ if (_put_count == 0) then break end
+ _slot_counter = _slot_counter + 1
+ if (_slot_counter == CHEST_WIDTH*GetChestHeightCheat(IN_chest)) then
+ break
+ end
+ end
+end
+-- Similar to chest-related.
+function TakeItemsFromPlayer(IN_player, IN_itemID, IN_ammount) -- UNSAFE! CHECK FIRST!
+ local _put_count = IN_ammount
+ local _max_stack = GetItemMaxStack(IN_itemID)
+ while true do
+ local _portion = math.min(_max_stack, _put_count)
+ IN_player:GetInventory():RemoveItem(cItem(IN_itemID, _portion))
+ _put_count = _put_count - _portion
+ if (_put_count == 0) then break end
+ end
+end
+function GiveItemsToPlayer(IN_player, IN_itemID, IN_ammount) -- UNSAFE! CHECK FIRST!
+ local _put_count = IN_ammount
+ local _max_stack = GetItemMaxStack(IN_itemID)
+ while true do
+ local _portion = math.min(_max_stack, _put_count)
+ IN_player:GetInventory():AddItem(cItem(IN_itemID, _portion))
+ _put_count = _put_count - _portion
+ if (_put_count == 0) then break end
+ end
+end
+-- This function returns item max stack for a given itemID. It uses vanilla max stack size, and uses several non-common items notations;
+-- Those are:
+-- oneonerecord (because aparently 11record wasn't the best idea in lua scripting application)
+-- carrotonastick (because it wasn't added to items.txt yet)
+-- waitrecord (for same reason)
+-- Feel free to ignore the difference, or to add those to items.txt
+function GetItemMaxStack(IN_itemID)
+ local _result = 64
+ -- Tools and swords
+ if (IN_itemID == woodensword) then _result = 1 end
+ if (IN_itemID == woodenshovel) then _result = 1 end
+ if (IN_itemID == woodenpickaxe) then _result = 1 end
+ if (IN_itemID == woodenaxe) then _result = 1 end
+ if (IN_itemID == woodenhoe) then _result = 1 end
+ if (IN_itemID == stonesword) then _result = 1 end
+ if (IN_itemID == stoneshovel) then _result = 1 end
+ if (IN_itemID == stonepickaxe) then _result = 1 end
+ if (IN_itemID == stoneaxe) then _result = 1 end
+ if (IN_itemID == stonehoe) then _result = 1 end
+ if (IN_itemID == ironsword) then _result = 1 end
+ if (IN_itemID == ironshovel) then _result = 1 end
+ if (IN_itemID == ironpickaxe) then _result = 1 end
+ if (IN_itemID == ironaxe) then _result = 1 end
+ if (IN_itemID == ironhoe) then _result = 1 end
+ if (IN_itemID == diamondsword) then _result = 1 end
+ if (IN_itemID == diamondshovel) then _result = 1 end
+ if (IN_itemID == diamondpickaxe) then _result = 1 end
+ if (IN_itemID == diamondaxe) then _result = 1 end
+ if (IN_itemID == diamondhoe) then _result = 1 end
+ if (IN_itemID == goldensword) then _result = 1 end
+ if (IN_itemID == goldenshovel) then _result = 1 end
+ if (IN_itemID == goldenpickaxe) then _result = 1 end
+ if (IN_itemID == goldenaxe) then _result = 1 end
+ if (IN_itemID == goldenhoe) then _result = 1 end
+
+ if (IN_itemID == flintandsteel) then _result = 1 end
+ if (IN_itemID == bow) then _result = 1 end
+ if (IN_itemID == sign) then _result = 16 end
+ if (IN_itemID == woodendoor) then _result = 1 end
+ if (IN_itemID == irondoor) then _result = 1 end
+ if (IN_itemID == cake) then _result = 1 end
+ if (IN_itemID == cauldron) then _result = 1 end
+ if (IN_itemID == mushroomstew) then _result = 1 end
+ if (IN_itemID == painting) then _result = 1 end
+ if (IN_itemID == bucket) then _result = 16 end
+ if (IN_itemID == waterbucket) then _result = 1 end
+ if (IN_itemID == lavabucket) then _result = 1 end
+ if (IN_itemID == minecart) then _result = 1 end
+ if (IN_itemID == saddle) then _result = 1 end
+ if (IN_itemID == snowball) then _result = 16 end
+ if (IN_itemID == boat) then _result = 1 end
+ if (IN_itemID == milkbucket) then _result = 1 end
+ if (IN_itemID == storageminecart) then _result = 1 end
+ if (IN_itemID == poweredminecart) then _result = 1 end
+ if (IN_itemID == egg) then _result = 16 end
+ if (IN_itemID == fishingrod) then _result = 1 end
+ if (IN_itemID == bed) then _result = 1 end
+ if (IN_itemID == map) then _result = 1 end
+ if (IN_itemID == shears) then _result = 1 end
+ if (IN_itemID == enderpearl) then _result = 16 end
+ if (IN_itemID == potion) then _result = 1 end
+ if (IN_itemID == spawnegg) then _result = 1 end
+ if (IN_itemID == bookandquill) then _result = 1 end
+ if (IN_itemID == writtenbook) then _result = 1 end
+ if (IN_itemID == carrotonastick) then _result = 1 end
+
+ if (IN_itemID == goldrecord) then _result = 1 end
+ if (IN_itemID == greenrecord) then _result = 1 end
+ if (IN_itemID == blocksrecord) then _result = 1 end
+ if (IN_itemID == chirprecord) then _result = 1 end
+ if (IN_itemID == farrecord) then _result = 1 end
+ if (IN_itemID == mallrecord) then _result = 1 end
+ if (IN_itemID == mellohirecord) then _result = 1 end
+ if (IN_itemID == stalrecord) then _result = 1 end
+ if (IN_itemID == stradrecord) then _result = 1 end
+ if (IN_itemID == wardrecord) then _result = 1 end
+ if (IN_itemID == oneonerecord) then _result = 1 end
+ if (IN_itemID == waitrecord) then _result = 1 end
+
+ --if (IN_itemID == xxxxxxxxx) then _result = 1 end
+
+ if (IN_itemID == leatherhelmet) then _result = 1 end
+ if (IN_itemID == leatherchestplate) then _result = 1 end
+ if (IN_itemID == leatherpants) then _result = 1 end
+ if (IN_itemID == leatherboots) then _result = 1 end
+
+ if (IN_itemID == chainmailhelmet) then _result = 1 end
+ if (IN_itemID == chainmailchestplate) then _result = 1 end
+ if (IN_itemID == chainmailpants) then _result = 1 end
+ if (IN_itemID == chainmailboots) then _result = 1 end
+
+ if (IN_itemID == ironhelmet) then _result = 1 end
+ if (IN_itemID == ironchestplate) then _result = 1 end
+ if (IN_itemID == ironpants) then _result = 1 end
+ if (IN_itemID == ironboots) then _result = 1 end
+
+ if (IN_itemID == diamondhelmet) then _result = 1 end
+ if (IN_itemID == diamondchestplate) then _result = 1 end
+ if (IN_itemID == diamondpants) then _result = 1 end
+ if (IN_itemID == diamondboots) then _result = 1 end
+
+ if (IN_itemID == goldenhelmet) then _result = 1 end
+ if (IN_itemID == goldenchestplate) then _result = 1 end
+ if (IN_itemID == goldenpants) then _result = 1 end
+ if (IN_itemID == goldenboots) then _result = 1 end
+ return _result
+end
+function ItemIsArmor(IN_itemID)
+ local _result = false
+ if (IN_itemID == leatherhelmet) then _result = true end
+ if (IN_itemID == leatherchestplate) then _result = true end
+ if (IN_itemID == leatherpants) then _result = true end
+ if (IN_itemID == leatherboots) then _result = true end
+
+ if (IN_itemID == chainmailhelmet) then _result = true end
+ if (IN_itemID == chainmailchestplate) then _result = true end
+ if (IN_itemID == chainmailpants) then _result = true end
+ if (IN_itemID == chainmailboots) then _result = true end
+
+ if (IN_itemID == ironhelmet) then _result = true end
+ if (IN_itemID == ironchestplate) then _result = true end
+ if (IN_itemID == ironpants) then _result = true end
+ if (IN_itemID == ironboots) then _result = true end
+
+ if (IN_itemID == diamondhelmet) then _result = true end
+ if (IN_itemID == diamondchestplate) then _result = true end
+ if (IN_itemID == diamondpants) then _result = true end
+ if (IN_itemID == diamondboots) then _result = true end
+
+ if (IN_itemID == goldenhelmet) then _result = true end
+ if (IN_itemID == goldenchestplate) then _result = true end
+ if (IN_itemID == goldenpants) then _result = true end
+ if (IN_itemID == goldenboots) then _result = true end
+ return _result
+end
+-- Returns full-length playername for a short name (usefull for parsing commands)
+function GetExactPlayername(IN_playername)
+ local _result = IN_playername
+ local function SetProcessingPlayername(IN_player)
+ _result = IN_player:GetName()
+ end
+ cRoot:Get():FindAndDoWithPlayer(IN_playername, SetProcessingPlayername)
+ return _result
+end
+function GetPlayerByName(IN_playername)
+ local _player
+ local PlayerSetter = function (Player)
+ _player = Player
+ end
+ cRoot:Get():FindAndDoWithPlayer(IN_playername, PlayerSetter)
+ return _player
+end
+--[[
+Not-so-usual math _functions
+]]
+-- Rounds floating point number. Because lua guys think this function doesn't deserve to be presented in lua's math
+function round(IN_x)
+ if (IN_x%2 ~= 0.5) then
+ return math.floor(IN_x+0.5)
+ end
+ return IN_x-0.5
+end
+--[[
+Functions I use for filework and stringswork
+]]
+function PluralString(IN_value, IN_singular_string, IN_plural_string)
+ local _value_string = tostring(IN_value)
+ if (_value_string[#_value_string] == "1") then
+ return IN_singular_string
+ end
+ return IN_plural_string
+end
+function PluralItemName(IN_itemID, IN_ammount) -- BEWARE! TEMPORAL SOLUTION THERE! :D
+ local _value_string = tostring(IN_value)
+ local _name = ""
+ if (_value_string[#_value_string] == "1") then
+ -- singular names
+ _name = ItemTypeToString(IN_itemID)
+ else
+ -- plural names
+ _name = ItemTypeToString(IN_itemID).."s"
+ end
+ return _name
+end
+-- for filewriting purposes. 0 = false, 1 = true
+function StringToBool(value)
+ if value=="1" then return true end
+ return false
+end
+-- same, but reversal
+function BoolToString(value)
+ if value==true then return 1 end
+ return 0
end \ No newline at end of file
diff --git a/MCServer/Plugins/HookNotify/HookNotify.lua b/MCServer/Plugins/HookNotify/HookNotify.lua
index ed463c5ca..09759451d 100644
--- a/MCServer/Plugins/HookNotify/HookNotify.lua
+++ b/MCServer/Plugins/HookNotify/HookNotify.lua
@@ -1,404 +1,404 @@
-
--- Global variables
-PLUGIN = {} -- Reference to own plugin object
-
-
-
-
-
-function Initialize(Plugin)
- PLUGIN = Plugin
-
- Plugin:SetName("HookNotify");
- Plugin:SetVersion(1);
-
- PluginManager = cPluginManager:Get();
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_BLOCK_TO_PICKUPS);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHAT);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_AVAILABLE);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATED);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATING);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_UNLOADED);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_UNLOADING);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_COLLECTING_PICKUP);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CRAFTING_NO_RECIPE);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_DISCONNECT);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_EXECUTE_COMMAND);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_HANDSHAKE);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_KILLING);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_LOGIN);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_BREAKING_BLOCK);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_BROKEN_BLOCK);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_EATING);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_JOINED);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_LEFT_CLICK);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_MOVING);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_PLACED_BLOCK);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_PLACING_BLOCK);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_RIGHT_CLICK);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_SHOOTING);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_SPAWNED);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_TOSSING_ITEM);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USED_BLOCK);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USED_ITEM);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USING_BLOCK);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USING_ITEM);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_POST_CRAFTING);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PRE_CRAFTING);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_TAKE_DAMAGE);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_UPDATED_SIGN);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_UPDATING_SIGN);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_WEATHER_CHANGED);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_WEATHER_CHANGING);
-
- LOGINFO("HookNotify plugin is installed, beware, the log output may be quite large!");
- LOGINFO("You want this plugin enabled only when developing another plugin, not for regular gameplay.");
-
- return true
-end
-
-
-
-
-
-function LogHook(FnName, ...)
- LOG(FnName .. "(");
- for i, v in ipairs(arg) do
- local vt = tostring(v);
- local TypeString = type(v);
- if (type(v) == "userdata") then
- TypeString = tolua.type(v);
- end;
- LOG(" " .. tostring(i) .. ": " .. TypeString .. ": " .. tostring(v));
- end
- LOG(")");
-end
-
-
-
-
-
-function OnBlockToPickups(...)
- LogHook("OnBlockToPickups", unpack(arg));
- local World, Digger, BlockX, BlockY, BlockZ, BlockType, BlockMeta, Pickups = unpack(arg);
- if (Pickups ~= nil) then
- local Name = "NULL";
- if (Digger ~= nil) then
- Name = Digger:GetName()
- end
- LOG("Got cItems from " .. Name .. ", trying to manipulate them.");
- Pickups:Add(cItem:new(E_ITEM_DIAMOND_SHOVEL, 1));
- LOG("Current size: " .. Pickups:Size());
- end;
-end;
-
-
-
-
-
-function OnChat(...)
- LogHook("OnChat", unpack(arg));
-end
-
-
-
-
-
-function OnChunkAvailable(...)
- LogHook("OnChunkAvailable", unpack(arg));
-end
-
-
-
-
-
-function OnChunkGenerated(...)
- LogHook("OnChunkGenerated", unpack(arg));
-end
-
-
-
-
-
-function OnChunkGenerating(...)
- LogHook("OnChunkGenerating", unpack(arg));
-end
-
-
-
-
-
-function OnChunkUnloaded(...)
- LogHook("OnChunkUnloaded", unpack(arg));
-end
-
-
-
-
-
-function OnChunkUnloading(...)
- LogHook("OnChunkUnloading", unpack(arg));
-end
-
-
-
-
-
-function OnPlayerUsingItem(...)
- LogHook("OnPlayerUsingItem", unpack(arg));
-end
-
-
-
-
-
-function OnCollectingPickup(...)
- LogHook("OnCollectingPickup", unpack(arg));
-end
-
-
-
-
-function OnCraftingNoRecipe(...)
- LogHook("OnCraftingNoRecipe", unpack(arg));
-end
-
-
-
-
-
-function OnDisconnect(...)
- LogHook("OnDisconnect", unpack(arg));
-end
-
-
-
-
-
-function OnExecuteCommand(...)
- LogHook("OnExecuteCommand", unpack(arg));
-
- -- For some reason logging doesn't work for this callback, so list some stuff manually to verify:
- LOG("arg1 type: " .. type(arg[1]));
- if (arg[1] ~= nil) then
- LOG("Player name: " .. arg[1]:GetName());
- end
- LOG("Command: " .. arg[2][1]);
-end
-
-
-
-
-
-function OnHandshake(...)
- LogHook("OnHandshake", unpack(arg));
-end
-
-
-
-
-
-function OnKilling(...)
- LogHook("OnKilling", unpack(arg));
-end
-
-
-
-
-
-function OnLogin(...)
- LogHook("OnLogin", unpack(arg));
-end
-
-
-
-
-
-function OnPlayerBreakingBlock(...)
- LogHook("OnPlayerBreakingBlock", unpack(arg));
-end
-
-
-
-
-
-function OnPlayerBrokenBlock(...)
- LogHook("OnPlayerBrokenBlock", unpack(arg));
-end
-
-
-
-
-
-function OnPlayerEating(...)
- LogHook("OnPlayerEating", unpack(arg));
-end
-
-
-
-
-
-function OnPlayerJoined(...)
- LogHook("OnPlayerJoined", unpack(arg));
-end
-
-
-
-
-
-function OnPlayerLeftClick(...)
- LogHook("OnPlayerLeftClick", unpack(arg));
-end
-
-
-
-
-
-function OnPlayerMoving(...)
- LogHook("OnPlayerMoving", unpack(arg));
-end
-
-
-
-
-
-function OnPlayerPlacedBlock(...)
- LogHook("OnPlayerPlacedBlock", unpack(arg));
-end
-
-
-
-
-
-function OnPlayerPlacingBlock(...)
- LogHook("OnPlayerPlacingBlock", unpack(arg));
-end
-
-
-
-
-
-function OnPlayerRightClick(...)
- LogHook("OnPlayerRightClick", unpack(arg));
-end
-
-
-
-
-
-function OnPlayerShooting(...)
- LogHook("OnPlayerShooting", unpack(arg));
-end
-
-
-
-
-
-function OnPlayerSpawned(...)
- LogHook("OnPlayerSpawned", unpack(arg));
-end
-
-
-
-
-
-function OnPlayerTossingItem(...)
- LogHook("OnPlayerTossingItem", unpack(arg));
-end
-
-
-
-
-
-function OnPlayerUsedBlock(...)
- LogHook("OnPlayerUsedBlock", unpack(arg));
-end
-
-
-
-
-
-function OnPlayerUsedItem(...)
- LogHook("OnPlayerUsedItem", unpack(arg));
-end
-
-
-
-
-
-function OnPlayerUsingBlock(...)
- LogHook("OnPlayerUsingBlock", unpack(arg));
-end
-
-
-
-
-
-function OnPlayerUsingItem(...)
- LogHook("OnPlayerUsingItem", unpack(arg));
-end
-
-
-
-
-
-function OnPostCrafting(...)
- LogHook("OnPostCrafting", unpack(arg));
-end
-
-
-
-
-
-function OnPreCrafting(...)
- LogHook("OnPreCrafting", unpack(arg));
-end
-
-
-
-
-
-function OnUpdatedSign(...)
- LogHook("OnUpdatedSign", unpack(arg));
-end
-
-
-
-
-
-function OnUpdatingSign(...)
- LogHook("OnUpdatingSign", unpack(arg));
-end
-
-
-
-
-
-function OnWeatherChanged(...)
- LogHook("OnWeatherChanged", unpack(arg));
-end
-
-
-
-
-
-function OnWeatherChanging(...)
- LogHook("OnWeatherChanging", unpack(arg));
-end
-
-
-
-
-
-------------------------------------------------------------------
--- Special handling for OnTakeDamage to print the contents of TDI:
-
-function OnTakeDamage(Receiver, TDI)
- -- Receiver is cPawn
- -- TDI is TakeDamageInfo
-
- LOG("OnTakeDamage(): " .. Receiver:GetClass() .. " was dealt RawDamage " .. TDI.RawDamage .. ", FinalDamage " .. TDI.FinalDamage .. " (that is, " .. (TDI.RawDamage - TDI.FinalDamage) .. " HPs covered by armor)");
-end
-
-
-
+
+-- Global variables
+PLUGIN = {} -- Reference to own plugin object
+
+
+
+
+
+function Initialize(Plugin)
+ PLUGIN = Plugin
+
+ Plugin:SetName("HookNotify");
+ Plugin:SetVersion(1);
+
+ PluginManager = cPluginManager:Get();
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_BLOCK_TO_PICKUPS);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHAT);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_AVAILABLE);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATED);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATING);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_UNLOADED);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_UNLOADING);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_COLLECTING_PICKUP);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_CRAFTING_NO_RECIPE);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_DISCONNECT);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_EXECUTE_COMMAND);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_HANDSHAKE);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_KILLING);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_LOGIN);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_BREAKING_BLOCK);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_BROKEN_BLOCK);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_EATING);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_JOINED);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_LEFT_CLICK);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_MOVING);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_PLACED_BLOCK);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_PLACING_BLOCK);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_RIGHT_CLICK);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_SHOOTING);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_SPAWNED);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_TOSSING_ITEM);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USED_BLOCK);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USED_ITEM);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USING_BLOCK);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USING_ITEM);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_POST_CRAFTING);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PRE_CRAFTING);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_TAKE_DAMAGE);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_UPDATED_SIGN);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_UPDATING_SIGN);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_WEATHER_CHANGED);
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_WEATHER_CHANGING);
+
+ LOGINFO("HookNotify plugin is installed, beware, the log output may be quite large!");
+ LOGINFO("You want this plugin enabled only when developing another plugin, not for regular gameplay.");
+
+ return true
+end
+
+
+
+
+
+function LogHook(FnName, ...)
+ LOG(FnName .. "(");
+ for i, v in ipairs(arg) do
+ local vt = tostring(v);
+ local TypeString = type(v);
+ if (type(v) == "userdata") then
+ TypeString = tolua.type(v);
+ end;
+ LOG(" " .. tostring(i) .. ": " .. TypeString .. ": " .. tostring(v));
+ end
+ LOG(")");
+end
+
+
+
+
+
+function OnBlockToPickups(...)
+ LogHook("OnBlockToPickups", unpack(arg));
+ local World, Digger, BlockX, BlockY, BlockZ, BlockType, BlockMeta, Pickups = unpack(arg);
+ if (Pickups ~= nil) then
+ local Name = "NULL";
+ if (Digger ~= nil) then
+ Name = Digger:GetName()
+ end
+ LOG("Got cItems from " .. Name .. ", trying to manipulate them.");
+ Pickups:Add(cItem:new(E_ITEM_DIAMOND_SHOVEL, 1));
+ LOG("Current size: " .. Pickups:Size());
+ end;
+end;
+
+
+
+
+
+function OnChat(...)
+ LogHook("OnChat", unpack(arg));
+end
+
+
+
+
+
+function OnChunkAvailable(...)
+ LogHook("OnChunkAvailable", unpack(arg));
+end
+
+
+
+
+
+function OnChunkGenerated(...)
+ LogHook("OnChunkGenerated", unpack(arg));
+end
+
+
+
+
+
+function OnChunkGenerating(...)
+ LogHook("OnChunkGenerating", unpack(arg));
+end
+
+
+
+
+
+function OnChunkUnloaded(...)
+ LogHook("OnChunkUnloaded", unpack(arg));
+end
+
+
+
+
+
+function OnChunkUnloading(...)
+ LogHook("OnChunkUnloading", unpack(arg));
+end
+
+
+
+
+
+function OnPlayerUsingItem(...)
+ LogHook("OnPlayerUsingItem", unpack(arg));
+end
+
+
+
+
+
+function OnCollectingPickup(...)
+ LogHook("OnCollectingPickup", unpack(arg));
+end
+
+
+
+
+function OnCraftingNoRecipe(...)
+ LogHook("OnCraftingNoRecipe", unpack(arg));
+end
+
+
+
+
+
+function OnDisconnect(...)
+ LogHook("OnDisconnect", unpack(arg));
+end
+
+
+
+
+
+function OnExecuteCommand(...)
+ LogHook("OnExecuteCommand", unpack(arg));
+
+ -- For some reason logging doesn't work for this callback, so list some stuff manually to verify:
+ LOG("arg1 type: " .. type(arg[1]));
+ if (arg[1] ~= nil) then
+ LOG("Player name: " .. arg[1]:GetName());
+ end
+ LOG("Command: " .. arg[2][1]);
+end
+
+
+
+
+
+function OnHandshake(...)
+ LogHook("OnHandshake", unpack(arg));
+end
+
+
+
+
+
+function OnKilling(...)
+ LogHook("OnKilling", unpack(arg));
+end
+
+
+
+
+
+function OnLogin(...)
+ LogHook("OnLogin", unpack(arg));
+end
+
+
+
+
+
+function OnPlayerBreakingBlock(...)
+ LogHook("OnPlayerBreakingBlock", unpack(arg));
+end
+
+
+
+
+
+function OnPlayerBrokenBlock(...)
+ LogHook("OnPlayerBrokenBlock", unpack(arg));
+end
+
+
+
+
+
+function OnPlayerEating(...)
+ LogHook("OnPlayerEating", unpack(arg));
+end
+
+
+
+
+
+function OnPlayerJoined(...)
+ LogHook("OnPlayerJoined", unpack(arg));
+end
+
+
+
+
+
+function OnPlayerLeftClick(...)
+ LogHook("OnPlayerLeftClick", unpack(arg));
+end
+
+
+
+
+
+function OnPlayerMoving(...)
+ LogHook("OnPlayerMoving", unpack(arg));
+end
+
+
+
+
+
+function OnPlayerPlacedBlock(...)
+ LogHook("OnPlayerPlacedBlock", unpack(arg));
+end
+
+
+
+
+
+function OnPlayerPlacingBlock(...)
+ LogHook("OnPlayerPlacingBlock", unpack(arg));
+end
+
+
+
+
+
+function OnPlayerRightClick(...)
+ LogHook("OnPlayerRightClick", unpack(arg));
+end
+
+
+
+
+
+function OnPlayerShooting(...)
+ LogHook("OnPlayerShooting", unpack(arg));
+end
+
+
+
+
+
+function OnPlayerSpawned(...)
+ LogHook("OnPlayerSpawned", unpack(arg));
+end
+
+
+
+
+
+function OnPlayerTossingItem(...)
+ LogHook("OnPlayerTossingItem", unpack(arg));
+end
+
+
+
+
+
+function OnPlayerUsedBlock(...)
+ LogHook("OnPlayerUsedBlock", unpack(arg));
+end
+
+
+
+
+
+function OnPlayerUsedItem(...)
+ LogHook("OnPlayerUsedItem", unpack(arg));
+end
+
+
+
+
+
+function OnPlayerUsingBlock(...)
+ LogHook("OnPlayerUsingBlock", unpack(arg));
+end
+
+
+
+
+
+function OnPlayerUsingItem(...)
+ LogHook("OnPlayerUsingItem", unpack(arg));
+end
+
+
+
+
+
+function OnPostCrafting(...)
+ LogHook("OnPostCrafting", unpack(arg));
+end
+
+
+
+
+
+function OnPreCrafting(...)
+ LogHook("OnPreCrafting", unpack(arg));
+end
+
+
+
+
+
+function OnUpdatedSign(...)
+ LogHook("OnUpdatedSign", unpack(arg));
+end
+
+
+
+
+
+function OnUpdatingSign(...)
+ LogHook("OnUpdatingSign", unpack(arg));
+end
+
+
+
+
+
+function OnWeatherChanged(...)
+ LogHook("OnWeatherChanged", unpack(arg));
+end
+
+
+
+
+
+function OnWeatherChanging(...)
+ LogHook("OnWeatherChanging", unpack(arg));
+end
+
+
+
+
+
+------------------------------------------------------------------
+-- Special handling for OnTakeDamage to print the contents of TDI:
+
+function OnTakeDamage(Receiver, TDI)
+ -- Receiver is cPawn
+ -- TDI is TakeDamageInfo
+
+ LOG("OnTakeDamage(): " .. Receiver:GetClass() .. " was dealt RawDamage " .. TDI.RawDamage .. ", FinalDamage " .. TDI.FinalDamage .. " (that is, " .. (TDI.RawDamage - TDI.FinalDamage) .. " HPs covered by armor)");
+end
+
+
+
diff --git a/MCServer/Plugins/MagicCarpet/objects.lua b/MCServer/Plugins/MagicCarpet/objects.lua
index 7c19fc232..8d81623a5 100644
--- a/MCServer/Plugins/MagicCarpet/objects.lua
+++ b/MCServer/Plugins/MagicCarpet/objects.lua
@@ -1,97 +1,97 @@
--- Location object
-cLocation = {}
-function cLocation:new( x, y, z )
- local object = { x = x, y = y, z = z }
- setmetatable(object, { __index = cLocation })
- return object
-end
-
--- Offsets
-cFibers = { }
-function cFibers:new()
- local object = {
- cLocation:new( 2, -1, 2 ),
- cLocation:new( 2, -1, 1 ),
- cLocation:new( 2, -1, 0 ),
- cLocation:new( 2, -1, -1 ),
- cLocation:new( 2, -1, -2 ),
- cLocation:new( 1, -1, 2 ),
- cLocation:new( 1, -1, 1 ),
- cLocation:new( 1, -1, 0 ),
- cLocation:new( 1, -1, -1 ),
- cLocation:new( 1, -1, -2 ),
- cLocation:new( 0, -1, 2 ),
- cLocation:new( 0, -1, 1 ),
- cLocation:new( 0, -1, 0 ),
- cLocation:new( 0, -1, -1 ),
- cLocation:new( 0, -1, -2 ),
- cLocation:new( -1, -1, 2 ),
- cLocation:new( -1, -1, 1 ),
- cLocation:new( -1, -1, 0 ),
- cLocation:new( -1, -1, -1 ),
- cLocation:new( -1, -1, -2 ),
- cLocation:new( -2, -1, 2 ),
- cLocation:new( -2, -1, 1 ),
- cLocation:new( -2, -1, 0 ),
- cLocation:new( -2, -1, -1 ),
- cLocation:new( -2, -1, -2 ),
- imadeit = false,
- }
- setmetatable(object, { __index = cFibers })
- return object;
-end
-
--- Carpet object
-cCarpet = {}
-function cCarpet:new()
- local object = { Location = cLocation:new(0,0,0),
- Fibers = cFibers:new(),
- }
- setmetatable(object, { __index = cCarpet })
- return object
-end
-
-function cCarpet:remove()
- local World = cRoot:Get():GetDefaultWorld()
- for i, fib in ipairs( self.Fibers ) do
- local x = self.Location.x + fib.x
- local y = self.Location.y + fib.y
- local z = self.Location.z + fib.z
- local BlockID = World:GetBlock( x, y, z )
- if( fib.imadeit == true and BlockID == E_BLOCK_GLASS ) then
- World:SetBlock( x, y, z, 0, 0 )
- fib.imadeit = false
- end
- end
-end
-
-function cCarpet:draw()
- local World = cRoot:Get():GetDefaultWorld()
- for i, fib in ipairs( self.Fibers ) do
- local x = self.Location.x + fib.x
- local y = self.Location.y + fib.y
- local z = self.Location.z + fib.z
- local BlockID = World:GetBlock( x, y, z )
- if( BlockID == 0 ) then
- fib.imadeit = true
- World:SetBlock( x, y, z, E_BLOCK_GLASS, 0 )
- else
- fib.imadeit = false
- end
- end
-end
-
-function cCarpet:moveTo( NewPos )
- local x = math.floor( NewPos.x )
- local y = math.floor( NewPos.y )
- local z = math.floor( NewPos.z )
- if( self.Location.x ~= x or self.Location.y ~= y or self.Location.z ~= z ) then
- self:remove()
- self.Location = cLocation:new( x, y, z )
- self:draw()
- end
-end
-
-function cCarpet:getY()
- return self.Location.y
+-- Location object
+cLocation = {}
+function cLocation:new( x, y, z )
+ local object = { x = x, y = y, z = z }
+ setmetatable(object, { __index = cLocation })
+ return object
+end
+
+-- Offsets
+cFibers = { }
+function cFibers:new()
+ local object = {
+ cLocation:new( 2, -1, 2 ),
+ cLocation:new( 2, -1, 1 ),
+ cLocation:new( 2, -1, 0 ),
+ cLocation:new( 2, -1, -1 ),
+ cLocation:new( 2, -1, -2 ),
+ cLocation:new( 1, -1, 2 ),
+ cLocation:new( 1, -1, 1 ),
+ cLocation:new( 1, -1, 0 ),
+ cLocation:new( 1, -1, -1 ),
+ cLocation:new( 1, -1, -2 ),
+ cLocation:new( 0, -1, 2 ),
+ cLocation:new( 0, -1, 1 ),
+ cLocation:new( 0, -1, 0 ),
+ cLocation:new( 0, -1, -1 ),
+ cLocation:new( 0, -1, -2 ),
+ cLocation:new( -1, -1, 2 ),
+ cLocation:new( -1, -1, 1 ),
+ cLocation:new( -1, -1, 0 ),
+ cLocation:new( -1, -1, -1 ),
+ cLocation:new( -1, -1, -2 ),
+ cLocation:new( -2, -1, 2 ),
+ cLocation:new( -2, -1, 1 ),
+ cLocation:new( -2, -1, 0 ),
+ cLocation:new( -2, -1, -1 ),
+ cLocation:new( -2, -1, -2 ),
+ imadeit = false,
+ }
+ setmetatable(object, { __index = cFibers })
+ return object;
+end
+
+-- Carpet object
+cCarpet = {}
+function cCarpet:new()
+ local object = { Location = cLocation:new(0,0,0),
+ Fibers = cFibers:new(),
+ }
+ setmetatable(object, { __index = cCarpet })
+ return object
+end
+
+function cCarpet:remove()
+ local World = cRoot:Get():GetDefaultWorld()
+ for i, fib in ipairs( self.Fibers ) do
+ local x = self.Location.x + fib.x
+ local y = self.Location.y + fib.y
+ local z = self.Location.z + fib.z
+ local BlockID = World:GetBlock( x, y, z )
+ if( fib.imadeit == true and BlockID == E_BLOCK_GLASS ) then
+ World:SetBlock( x, y, z, 0, 0 )
+ fib.imadeit = false
+ end
+ end
+end
+
+function cCarpet:draw()
+ local World = cRoot:Get():GetDefaultWorld()
+ for i, fib in ipairs( self.Fibers ) do
+ local x = self.Location.x + fib.x
+ local y = self.Location.y + fib.y
+ local z = self.Location.z + fib.z
+ local BlockID = World:GetBlock( x, y, z )
+ if( BlockID == 0 ) then
+ fib.imadeit = true
+ World:SetBlock( x, y, z, E_BLOCK_GLASS, 0 )
+ else
+ fib.imadeit = false
+ end
+ end
+end
+
+function cCarpet:moveTo( NewPos )
+ local x = math.floor( NewPos.x )
+ local y = math.floor( NewPos.y )
+ local z = math.floor( NewPos.z )
+ if( self.Location.x ~= x or self.Location.y ~= y or self.Location.z ~= z ) then
+ self:remove()
+ self.Location = cLocation:new( x, y, z )
+ self:draw()
+ end
+end
+
+function cCarpet:getY()
+ return self.Location.y
end \ No newline at end of file
diff --git a/MCServer/Plugins/ProtectionAreas/CommandHandlers.lua b/MCServer/Plugins/ProtectionAreas/CommandHandlers.lua
index b943df060..26df73075 100644
--- a/MCServer/Plugins/ProtectionAreas/CommandHandlers.lua
+++ b/MCServer/Plugins/ProtectionAreas/CommandHandlers.lua
@@ -1,322 +1,322 @@
-
--- CommandHandlers.lua
--- Defines the individual command handlers
-
-
-
-
-
-function InitializeCommandHandlers()
- local PlgMgr = cRoot:Get():GetPluginManager();
- for idx, Cmd in ipairs(CommandReg()) do
- PlgMgr:BindCommand(Cmd[2], Cmd[3], Cmd[1], Cmd[4]);
- end
-end
-
-
-
-
-
---- Handles the ProtAdd command
-function HandleAddArea(a_Split, a_Player)
- -- Command syntax: ProtAdd username1 [username2] [username3] ...
- if (#a_Split < 2) then
- a_Player:SendMessage(g_Msgs.ErrExpectedListOfUsernames);
- return true;
- end
-
- -- Get the cuboid that the player had selected
- local CmdState = GetCommandStateForPlayer(a_Player);
- if (CmdState == nil) then
- a_Player:SendMessage(g_Msgs.ErrCmdStateNilAddArea);
- return true;
- end
- local Cuboid = CmdState:GetCurrentCuboid();
- if (Cuboid == nil) then
- a_Player:SendMessage(g_Msgs.ErrNoAreaWanded);
- return true;
- end
-
- -- Put all allowed players into a table:
- AllowedNames = {};
- for i = 2, #a_Split do
- table.insert(AllowedNames, a_Split[i]);
- end
-
- -- Add the area to the storage
- local AreaID = g_Storage:AddArea(Cuboid, a_Player:GetWorld():GetName(), a_Player:GetName(), AllowedNames);
- a_Player:SendMessage(string.format(g_Msgs.AreaAdded, AreaID));
-
- -- Reload all currently logged in players
- ReloadAllPlayersInWorld(a_Player:GetWorld():GetName());
-
- return true;
-end
-
-
-
-
-
-function HandleAddAreaCoords(a_Split, a_Player)
- -- Command syntax: ProtAddCoords x1 z1 x2 z2 username1 [username2] [username3] ...
- if (#a_Split < 6) then
- a_Player:SendMessage(g_Msgs.ErrExpectedCoordsUsernames);
- return true;
- end
-
- -- Convert the coords to a cCuboid
- local x1, z1 = tonumber(a_Split[2]), tonumber(a_Split[3]);
- local x2, z2 = tonumber(a_Split[4]), tonumber(a_Split[5]);
- if ((x1 == nil) or (z1 == nil) or (x2 == nil) or (z2 == nil)) then
- a_Player:SendMessage(g_Msgs.ErrParseCoords);
- return true;
- end
- local Cuboid = cCuboid(x1, 0, z1, x2, 255, z1);
- Cuboid:Sort();
-
- -- Put all allowed players into a table:
- AllowedNames = {};
- for i = 6, #a_Split do
- table.insert(AllowedNames, a_Split[i]);
- end
-
- -- Add the area to the storage
- local AreaID = g_Storage:AddArea(Cuboid, a_Player:GetWorld():GetName(), a_Player:GetName(), AllowedNames);
- a_Player:SendMessage(string.format(g_Msgs.AreaAdded, AreaID));
-
- -- Reload all currently logged in players
- ReloadAllPlayersInWorld(a_Player:GetWorld():GetName());
-
- return true;
-end
-
-
-
-
-
-function HandleAddAreaUser(a_Split, a_Player)
- -- Command syntax: ProtAddUser AreaID username1 [username2] [username3] ...
- if (#a_Split < 3) then
- a_Player:SendMessage(g_Msgs.ErrExpectedAreaIDUsernames);
- return true;
- end
-
- -- Put all allowed players into a table:
- AllowedNames = {};
- for i = 3, #a_Split do
- table.insert(AllowedNames, a_Split[i]);
- end
-
- -- Add the area to the storage
- if (not(g_Storage:AddAreaUsers(
- tonumber(a_Split[2]), a_Player:GetWorld():GetName(), a_Player:GetName(), AllowedNames))
- ) then
- LOGWARNING("g_Storage:AddAreaUsers failed");
- a_Player:SendMessage(g_Msgs.ErrDBFailAddUsers);
- return true;
- end
- if (#AllowedNames == 0) then
- a_Player:SendMessage(g_Msgs.AllUsersAlreadyAllowed);
- else
- a_Player:SendMessage(string.format(g_Msgs.UsersAdded, table.concat(AllowedNames, ", ")));
- end
-
- -- Reload all currently logged in players
- ReloadAllPlayersInWorld(a_Player:GetWorld():GetName());
-
- return true;
-end
-
-
-
-
-
-function HandleDelArea(a_Split, a_Player)
- -- Command syntax: ProtDelArea AreaID
- if (#a_Split ~= 2) then
- a_Player:SendMessage(g_Msgs.ErrExpectedAreaID);
- return true;
- end
-
- -- Parse the AreaID
- local AreaID = tonumber(a_Split[2]);
- if (AreaID == nil) then
- a_Player:SendMessage(g_Msgs.ErrParseAreaID);
- return true;
- end
-
- -- Delete the area
- g_Storage:DelArea(a_Player:GetWorld():GetName(), AreaID);
-
- a_Player:SendMessage(string.format(g_Msgs.AreaDeleted, AreaID));
- -- Reload all currently logged in players
- ReloadAllPlayersInWorld(a_Player:GetWorld():GetName());
-
- return true;
-end
-
-
-
-
-
-function HandleGiveWand(a_Split, a_Player)
- local NumGiven = a_Player:GetInventory():AddItem(cConfig:GetWandItem());
- if (NumGiven == 1) then
- a_Player:SendMessage(g_Msgs.WandGiven);
- else
- a_Player:SendMessage(g_Msgs.ErrNoSpaceForWand);
- end
- return true;
-end
-
-
-
-
-
-function HandleListAreas(a_Split, a_Player)
- -- Command syntax: ProtListAreas [x, z]
-
- local x, z;
- if (#a_Split == 1) then
- -- Get the last "wanded" coord
- local CmdState = GetCommandStateForPlayer(a_Player);
- if (CmdState == nil) then
- a_Player:SendMessage(g_Msgs.ErrCmdStateNilListAreas);
- return true;
- end
- x, z = CmdState:GetLastCoords();
- if ((x == nil) or (z == nil)) then
- a_Player:SendMessage(g_Msgs.ErrListNotWanded);
- return true;
- end
- elseif (#a_Split == 3) then
- -- Parse the coords from the command params
- x = tonumber(a_Split[2]);
- z = tonumber(a_Split[3]);
- if ((x == nil) or (z == nil)) then
- a_Player:SendMessage(g_Msgs.ErrParseCoordsListAreas);
- return true;
- end
- else
- -- Wrong number of params, report back to the user
- a_Player:SendMessage(g_Msgs.ErrSyntaxErrorListAreas);
- return true;
- end
-
- a_Player:SendMessage(string.format(g_Msgs.ListAreasHeader, x, z));
-
- -- List areas intersecting the coords
- local PlayerName = a_Player:GetName();
- local WorldName = a_Player:GetWorld():GetName();
- g_Storage:ForEachArea(x, z, WorldName,
- function(AreaID, MinX, MinZ, MaxX, MaxZ, CreatorName)
- local Coords = string.format("%s: {%d, %d} - {%d, %d} ", AreaID, MinX, MinZ, MaxX, MaxZ);
- local Allowance;
- if (g_Storage:IsAreaAllowed(AreaID, PlayerName, WorldName)) then
- Allowance = g_Msgs.AreaAllowed;
- else
- Allowance = g_Msgs.AreaNotAllowed;
- end
- a_Player:SendMessage(string.format(g_Msgs.ListAreasRow, Coords, Allowance, CreatorName));
- end
- );
-
- a_Player:SendMessage(g_Msgs.ListAreasFooter);
- return true;
-end
-
-
-
-
---- Lists all allowed users for a particular area
-function HandleListUsers(a_Split, a_Player)
- -- Command syntax: ProtListUsers AreaID
- if (#a_Split ~= 2) then
- a_Player:SendMessage(g_Msgs.ErrExpectedAreaID);
- end
-
- -- Get the general info about the area
- local AreaID = a_Split[2];
- local WorldName = a_Player:GetWorld():GetName();
- local MinX, MinZ, MaxX, MaxZ, CreatorName = g_Storage:GetArea(AreaID, WorldName);
- if (MinX == nil) then
- a_Player:SendMessage(string.format(g_Msgs.ErrNoSuchArea, AreaID));
- return true;
- end
-
- -- Send the header
- a_Player:SendMessage(string.format(g_Msgs.ListUsersHeader, AreaID, MinX, MinZ, MaxX, MaxZ, CreatorName));
-
- -- List and count the allowed users
- local NumUsers = 0;
- g_Storage:ForEachUserInArea(AreaID, WorldName,
- function(UserName)
- a_Player:SendMessage(string.format(g_Msgs.ListUsersRow, UserName));
- NumUsers = NumUsers + 1;
- end
- );
-
- -- Send the footer
- a_Player:SendMessage(string.format(g_Msgs.ListUsersFooter, AreaID, NumUsers));
-
- return true;
-end
-
-
-
-
-
-function HandleRemoveUser(a_Split, a_Player)
- -- Command syntax: ProtRemUser AreaID UserName
- if (#a_Split ~= 3) then
- a_Player:SendMessage(g_Msgs.ErrExpectedAreaIDUserName);
- return true;
- end
-
- -- Parse the AreaID
- local AreaID = tonumber(a_Split[2]);
- if (AreaID == nil) then
- a_Player:SendMessage(g_Msgs.ErrParseAreaID);
- return true;
- end
-
- -- Remove the user from the DB
- local UserName = a_Split[3];
- g_Storage:RemoveUser(AreaID, UserName, a_Player:GetWorld():GetName());
-
- -- Send confirmation
- a_Player:SendMessage(string.format(g_Msgs.RemovedUser, UserName, AreaID));
-
- -- Reload all currently logged in players
- ReloadAllPlayersInWorld(a_Player:GetWorld():GetName());
-
- return true;
-end
-
-
-
-
-
-function HandleRemoveUserAll(a_Split, a_Player)
- -- Command syntax: ProtRemUserAll UserName
- if (#a_Split ~= 2) then
- a_Player:SendMessage(g_Msgs.ErrExpectedUserName);
- return true;
- end
-
- -- Remove the user from the DB
- g_Storage:RemoveUserAll(a_Split[2], a_Player:GetWorld():GetName());
-
- -- Send confirmation
- a_Player:SendMessage(string.format(g_Msgs.RemovedUserAll, UserName));
-
- -- Reload all currently logged in players
- ReloadAllPlayersInWorld(a_Player:GetWorld():GetName());
-
- return true;
-end
-
-
-
-
-
+
+-- CommandHandlers.lua
+-- Defines the individual command handlers
+
+
+
+
+
+function InitializeCommandHandlers()
+ local PlgMgr = cRoot:Get():GetPluginManager();
+ for idx, Cmd in ipairs(CommandReg()) do
+ PlgMgr:BindCommand(Cmd[2], Cmd[3], Cmd[1], Cmd[4]);
+ end
+end
+
+
+
+
+
+--- Handles the ProtAdd command
+function HandleAddArea(a_Split, a_Player)
+ -- Command syntax: ProtAdd username1 [username2] [username3] ...
+ if (#a_Split < 2) then
+ a_Player:SendMessage(g_Msgs.ErrExpectedListOfUsernames);
+ return true;
+ end
+
+ -- Get the cuboid that the player had selected
+ local CmdState = GetCommandStateForPlayer(a_Player);
+ if (CmdState == nil) then
+ a_Player:SendMessage(g_Msgs.ErrCmdStateNilAddArea);
+ return true;
+ end
+ local Cuboid = CmdState:GetCurrentCuboid();
+ if (Cuboid == nil) then
+ a_Player:SendMessage(g_Msgs.ErrNoAreaWanded);
+ return true;
+ end
+
+ -- Put all allowed players into a table:
+ AllowedNames = {};
+ for i = 2, #a_Split do
+ table.insert(AllowedNames, a_Split[i]);
+ end
+
+ -- Add the area to the storage
+ local AreaID = g_Storage:AddArea(Cuboid, a_Player:GetWorld():GetName(), a_Player:GetName(), AllowedNames);
+ a_Player:SendMessage(string.format(g_Msgs.AreaAdded, AreaID));
+
+ -- Reload all currently logged in players
+ ReloadAllPlayersInWorld(a_Player:GetWorld():GetName());
+
+ return true;
+end
+
+
+
+
+
+function HandleAddAreaCoords(a_Split, a_Player)
+ -- Command syntax: ProtAddCoords x1 z1 x2 z2 username1 [username2] [username3] ...
+ if (#a_Split < 6) then
+ a_Player:SendMessage(g_Msgs.ErrExpectedCoordsUsernames);
+ return true;
+ end
+
+ -- Convert the coords to a cCuboid
+ local x1, z1 = tonumber(a_Split[2]), tonumber(a_Split[3]);
+ local x2, z2 = tonumber(a_Split[4]), tonumber(a_Split[5]);
+ if ((x1 == nil) or (z1 == nil) or (x2 == nil) or (z2 == nil)) then
+ a_Player:SendMessage(g_Msgs.ErrParseCoords);
+ return true;
+ end
+ local Cuboid = cCuboid(x1, 0, z1, x2, 255, z1);
+ Cuboid:Sort();
+
+ -- Put all allowed players into a table:
+ AllowedNames = {};
+ for i = 6, #a_Split do
+ table.insert(AllowedNames, a_Split[i]);
+ end
+
+ -- Add the area to the storage
+ local AreaID = g_Storage:AddArea(Cuboid, a_Player:GetWorld():GetName(), a_Player:GetName(), AllowedNames);
+ a_Player:SendMessage(string.format(g_Msgs.AreaAdded, AreaID));
+
+ -- Reload all currently logged in players
+ ReloadAllPlayersInWorld(a_Player:GetWorld():GetName());
+
+ return true;
+end
+
+
+
+
+
+function HandleAddAreaUser(a_Split, a_Player)
+ -- Command syntax: ProtAddUser AreaID username1 [username2] [username3] ...
+ if (#a_Split < 3) then
+ a_Player:SendMessage(g_Msgs.ErrExpectedAreaIDUsernames);
+ return true;
+ end
+
+ -- Put all allowed players into a table:
+ AllowedNames = {};
+ for i = 3, #a_Split do
+ table.insert(AllowedNames, a_Split[i]);
+ end
+
+ -- Add the area to the storage
+ if (not(g_Storage:AddAreaUsers(
+ tonumber(a_Split[2]), a_Player:GetWorld():GetName(), a_Player:GetName(), AllowedNames))
+ ) then
+ LOGWARNING("g_Storage:AddAreaUsers failed");
+ a_Player:SendMessage(g_Msgs.ErrDBFailAddUsers);
+ return true;
+ end
+ if (#AllowedNames == 0) then
+ a_Player:SendMessage(g_Msgs.AllUsersAlreadyAllowed);
+ else
+ a_Player:SendMessage(string.format(g_Msgs.UsersAdded, table.concat(AllowedNames, ", ")));
+ end
+
+ -- Reload all currently logged in players
+ ReloadAllPlayersInWorld(a_Player:GetWorld():GetName());
+
+ return true;
+end
+
+
+
+
+
+function HandleDelArea(a_Split, a_Player)
+ -- Command syntax: ProtDelArea AreaID
+ if (#a_Split ~= 2) then
+ a_Player:SendMessage(g_Msgs.ErrExpectedAreaID);
+ return true;
+ end
+
+ -- Parse the AreaID
+ local AreaID = tonumber(a_Split[2]);
+ if (AreaID == nil) then
+ a_Player:SendMessage(g_Msgs.ErrParseAreaID);
+ return true;
+ end
+
+ -- Delete the area
+ g_Storage:DelArea(a_Player:GetWorld():GetName(), AreaID);
+
+ a_Player:SendMessage(string.format(g_Msgs.AreaDeleted, AreaID));
+ -- Reload all currently logged in players
+ ReloadAllPlayersInWorld(a_Player:GetWorld():GetName());
+
+ return true;
+end
+
+
+
+
+
+function HandleGiveWand(a_Split, a_Player)
+ local NumGiven = a_Player:GetInventory():AddItem(cConfig:GetWandItem());
+ if (NumGiven == 1) then
+ a_Player:SendMessage(g_Msgs.WandGiven);
+ else
+ a_Player:SendMessage(g_Msgs.ErrNoSpaceForWand);
+ end
+ return true;
+end
+
+
+
+
+
+function HandleListAreas(a_Split, a_Player)
+ -- Command syntax: ProtListAreas [x, z]
+
+ local x, z;
+ if (#a_Split == 1) then
+ -- Get the last "wanded" coord
+ local CmdState = GetCommandStateForPlayer(a_Player);
+ if (CmdState == nil) then
+ a_Player:SendMessage(g_Msgs.ErrCmdStateNilListAreas);
+ return true;
+ end
+ x, z = CmdState:GetLastCoords();
+ if ((x == nil) or (z == nil)) then
+ a_Player:SendMessage(g_Msgs.ErrListNotWanded);
+ return true;
+ end
+ elseif (#a_Split == 3) then
+ -- Parse the coords from the command params
+ x = tonumber(a_Split[2]);
+ z = tonumber(a_Split[3]);
+ if ((x == nil) or (z == nil)) then
+ a_Player:SendMessage(g_Msgs.ErrParseCoordsListAreas);
+ return true;
+ end
+ else
+ -- Wrong number of params, report back to the user
+ a_Player:SendMessage(g_Msgs.ErrSyntaxErrorListAreas);
+ return true;
+ end
+
+ a_Player:SendMessage(string.format(g_Msgs.ListAreasHeader, x, z));
+
+ -- List areas intersecting the coords
+ local PlayerName = a_Player:GetName();
+ local WorldName = a_Player:GetWorld():GetName();
+ g_Storage:ForEachArea(x, z, WorldName,
+ function(AreaID, MinX, MinZ, MaxX, MaxZ, CreatorName)
+ local Coords = string.format("%s: {%d, %d} - {%d, %d} ", AreaID, MinX, MinZ, MaxX, MaxZ);
+ local Allowance;
+ if (g_Storage:IsAreaAllowed(AreaID, PlayerName, WorldName)) then
+ Allowance = g_Msgs.AreaAllowed;
+ else
+ Allowance = g_Msgs.AreaNotAllowed;
+ end
+ a_Player:SendMessage(string.format(g_Msgs.ListAreasRow, Coords, Allowance, CreatorName));
+ end
+ );
+
+ a_Player:SendMessage(g_Msgs.ListAreasFooter);
+ return true;
+end
+
+
+
+
+--- Lists all allowed users for a particular area
+function HandleListUsers(a_Split, a_Player)
+ -- Command syntax: ProtListUsers AreaID
+ if (#a_Split ~= 2) then
+ a_Player:SendMessage(g_Msgs.ErrExpectedAreaID);
+ end
+
+ -- Get the general info about the area
+ local AreaID = a_Split[2];
+ local WorldName = a_Player:GetWorld():GetName();
+ local MinX, MinZ, MaxX, MaxZ, CreatorName = g_Storage:GetArea(AreaID, WorldName);
+ if (MinX == nil) then
+ a_Player:SendMessage(string.format(g_Msgs.ErrNoSuchArea, AreaID));
+ return true;
+ end
+
+ -- Send the header
+ a_Player:SendMessage(string.format(g_Msgs.ListUsersHeader, AreaID, MinX, MinZ, MaxX, MaxZ, CreatorName));
+
+ -- List and count the allowed users
+ local NumUsers = 0;
+ g_Storage:ForEachUserInArea(AreaID, WorldName,
+ function(UserName)
+ a_Player:SendMessage(string.format(g_Msgs.ListUsersRow, UserName));
+ NumUsers = NumUsers + 1;
+ end
+ );
+
+ -- Send the footer
+ a_Player:SendMessage(string.format(g_Msgs.ListUsersFooter, AreaID, NumUsers));
+
+ return true;
+end
+
+
+
+
+
+function HandleRemoveUser(a_Split, a_Player)
+ -- Command syntax: ProtRemUser AreaID UserName
+ if (#a_Split ~= 3) then
+ a_Player:SendMessage(g_Msgs.ErrExpectedAreaIDUserName);
+ return true;
+ end
+
+ -- Parse the AreaID
+ local AreaID = tonumber(a_Split[2]);
+ if (AreaID == nil) then
+ a_Player:SendMessage(g_Msgs.ErrParseAreaID);
+ return true;
+ end
+
+ -- Remove the user from the DB
+ local UserName = a_Split[3];
+ g_Storage:RemoveUser(AreaID, UserName, a_Player:GetWorld():GetName());
+
+ -- Send confirmation
+ a_Player:SendMessage(string.format(g_Msgs.RemovedUser, UserName, AreaID));
+
+ -- Reload all currently logged in players
+ ReloadAllPlayersInWorld(a_Player:GetWorld():GetName());
+
+ return true;
+end
+
+
+
+
+
+function HandleRemoveUserAll(a_Split, a_Player)
+ -- Command syntax: ProtRemUserAll UserName
+ if (#a_Split ~= 2) then
+ a_Player:SendMessage(g_Msgs.ErrExpectedUserName);
+ return true;
+ end
+
+ -- Remove the user from the DB
+ g_Storage:RemoveUserAll(a_Split[2], a_Player:GetWorld():GetName());
+
+ -- Send confirmation
+ a_Player:SendMessage(string.format(g_Msgs.RemovedUserAll, UserName));
+
+ -- Reload all currently logged in players
+ ReloadAllPlayersInWorld(a_Player:GetWorld():GetName());
+
+ return true;
+end
+
+
+
+
+
diff --git a/MCServer/Plugins/ProtectionAreas/CommandState.lua b/MCServer/Plugins/ProtectionAreas/CommandState.lua
index 2911688a8..f6d33d356 100644
--- a/MCServer/Plugins/ProtectionAreas/CommandState.lua
+++ b/MCServer/Plugins/ProtectionAreas/CommandState.lua
@@ -1,121 +1,121 @@
-
--- CommandState.lua
-
--- Implements the cCommandState class representing a command state for each VIP player
-
---[[
-The command state holds internal info, such as the coords they selected using the wand
-The command state needs to be held in a per-entity manner, so that we can support multiple logins
-from the same account (just for the fun of it)
-The OOP class implementation follows the PiL 16.1
-
-Also, a global table g_CommandStates is the map of PlayerEntityID -> cCommandState
---]]
-
-
-
-
-
-cCommandState = {
- -- Default coords
- m_Coords1 = {x = 0, z = 0}; -- lclk coords
- m_Coords2 = {x = 0, z = 0}; -- rclk coords
- m_LastCoords = 0; -- When Coords1 or Coords2 is set, this gets set to 1 or 2, signifying the last changed set of coords
- m_HasCoords1 = false; -- Set to true when m_Coords1 has been set by the user
- m_HasCoords2 = false; -- Set to true when m_Coords2 has been set by the user
-};
-
-g_CommandStates = {};
-
-
-
-
-
-function cCommandState:new(obj)
- obj = obj or {};
- setmetatable(obj, self);
- self.__index = self;
- return obj;
-end
-
-
-
-
-
---- Returns the current coord pair as a cCuboid object
-function cCommandState:GetCurrentCuboid()
- if (not(self.m_HasCoords1) or not(self.m_HasCoords2)) then
- -- Some of the coords haven't been set yet
- return nil;
- end
-
- local res = cCuboid(
- self.m_Coords1.x, 0, self.m_Coords1.z,
- self.m_Coords2.x, 255, self.m_Coords2.z
- );
- res:Sort();
- return res;
-end
-
-
-
-
-
---- Returns the x, z coords that were the set last,
--- That is, either m_Coords1 or m_Coords2, based on m_LastCoords member
--- Returns nothing if no coords were set yet
-function cCommandState:GetLastCoords()
- if (self.m_LastCoords == 0) then
- -- No coords have been set yet
- return;
- elseif (self.m_LastCoords == 1) then
- return self.m_Coords1.x, self.m_Coords1.z;
- elseif (self.m_LastCoords == 2) then
- return self.m_Coords2.x, self.m_Coords2.z;
- else
- LOGWARNING(PluginPrefix .. "cCommandState is in an unexpected state, m_LastCoords == " .. self.m_LastCoords);
- return;
- end
-end
-
-
-
-
-
---- Sets the first set of coords (upon rclk with a wand)
-function cCommandState:SetCoords1(a_BlockX, a_BlockZ)
- self.m_Coords1.x = a_BlockX;
- self.m_Coords1.z = a_BlockZ;
- self.m_LastCoords = 1;
- self.m_HasCoords1 = true;
-end
-
-
-
-
-
---- Sets the second set of coords (upon lclk with a wand)
-function cCommandState:SetCoords2(a_BlockX, a_BlockZ)
- self.m_Coords2.x = a_BlockX;
- self.m_Coords2.z = a_BlockZ;
- self.m_LastCoords = 2;
- self.m_HasCoords2 = true;
-end
-
-
-
-
-
---- Returns the cCommandState for the specified player; creates one if not existant
-function GetCommandStateForPlayer(a_Player)
- local res = g_CommandStates[a_Player:GetUniqueID()];
- if (res == nil) then
- res = cCommandState:new();
- g_CommandStates[a_Player:GetUniqueID()] = res;
- end
- return res;
-end;
-
-
-
-
+
+-- CommandState.lua
+
+-- Implements the cCommandState class representing a command state for each VIP player
+
+--[[
+The command state holds internal info, such as the coords they selected using the wand
+The command state needs to be held in a per-entity manner, so that we can support multiple logins
+from the same account (just for the fun of it)
+The OOP class implementation follows the PiL 16.1
+
+Also, a global table g_CommandStates is the map of PlayerEntityID -> cCommandState
+--]]
+
+
+
+
+
+cCommandState = {
+ -- Default coords
+ m_Coords1 = {x = 0, z = 0}; -- lclk coords
+ m_Coords2 = {x = 0, z = 0}; -- rclk coords
+ m_LastCoords = 0; -- When Coords1 or Coords2 is set, this gets set to 1 or 2, signifying the last changed set of coords
+ m_HasCoords1 = false; -- Set to true when m_Coords1 has been set by the user
+ m_HasCoords2 = false; -- Set to true when m_Coords2 has been set by the user
+};
+
+g_CommandStates = {};
+
+
+
+
+
+function cCommandState:new(obj)
+ obj = obj or {};
+ setmetatable(obj, self);
+ self.__index = self;
+ return obj;
+end
+
+
+
+
+
+--- Returns the current coord pair as a cCuboid object
+function cCommandState:GetCurrentCuboid()
+ if (not(self.m_HasCoords1) or not(self.m_HasCoords2)) then
+ -- Some of the coords haven't been set yet
+ return nil;
+ end
+
+ local res = cCuboid(
+ self.m_Coords1.x, 0, self.m_Coords1.z,
+ self.m_Coords2.x, 255, self.m_Coords2.z
+ );
+ res:Sort();
+ return res;
+end
+
+
+
+
+
+--- Returns the x, z coords that were the set last,
+-- That is, either m_Coords1 or m_Coords2, based on m_LastCoords member
+-- Returns nothing if no coords were set yet
+function cCommandState:GetLastCoords()
+ if (self.m_LastCoords == 0) then
+ -- No coords have been set yet
+ return;
+ elseif (self.m_LastCoords == 1) then
+ return self.m_Coords1.x, self.m_Coords1.z;
+ elseif (self.m_LastCoords == 2) then
+ return self.m_Coords2.x, self.m_Coords2.z;
+ else
+ LOGWARNING(PluginPrefix .. "cCommandState is in an unexpected state, m_LastCoords == " .. self.m_LastCoords);
+ return;
+ end
+end
+
+
+
+
+
+--- Sets the first set of coords (upon rclk with a wand)
+function cCommandState:SetCoords1(a_BlockX, a_BlockZ)
+ self.m_Coords1.x = a_BlockX;
+ self.m_Coords1.z = a_BlockZ;
+ self.m_LastCoords = 1;
+ self.m_HasCoords1 = true;
+end
+
+
+
+
+
+--- Sets the second set of coords (upon lclk with a wand)
+function cCommandState:SetCoords2(a_BlockX, a_BlockZ)
+ self.m_Coords2.x = a_BlockX;
+ self.m_Coords2.z = a_BlockZ;
+ self.m_LastCoords = 2;
+ self.m_HasCoords2 = true;
+end
+
+
+
+
+
+--- Returns the cCommandState for the specified player; creates one if not existant
+function GetCommandStateForPlayer(a_Player)
+ local res = g_CommandStates[a_Player:GetUniqueID()];
+ if (res == nil) then
+ res = cCommandState:new();
+ g_CommandStates[a_Player:GetUniqueID()] = res;
+ end
+ return res;
+end;
+
+
+
+
diff --git a/MCServer/Plugins/ProtectionAreas/Config.lua b/MCServer/Plugins/ProtectionAreas/Config.lua
index b6fe34535..b40be0c75 100644
--- a/MCServer/Plugins/ProtectionAreas/Config.lua
+++ b/MCServer/Plugins/ProtectionAreas/Config.lua
@@ -1,55 +1,55 @@
-
--- Config.lua
-
--- Implements the cConfig class that holds the general plugin configuration
-
-
-
-
-
-cConfig = {
- m_Wand = cItem(E_ITEM_STICK, 1, 1); -- The item to be used as the selection wand
- m_AllowInteractNoArea = true; -- If there's no area, is a player allowed to build / dig?
-};
-
-
-
-
-
---- Initializes the cConfig object, loads the configuration from an INI file
-function InitializeConfig()
- local ini = cIniFile("ProtectionAreas.ini");
- if (not(ini:ReadFile())) then
- LOGINFO(PluginPrefix .. "Cannot read ProtectionAreas.ini, all plugin configuration is set to defaults");
- end
- local WandItem = cItem();
- if (
- StringToItem(ini:GetValueSet("ProtectionAreas", "WandItem", ItemToString(cConfig.m_Wand)), WandItem) and
- IsValidItem(WandItem.m_ItemType)
- ) then
- cConfig.m_Wand = WandItem;
- end
- cConfig.m_AllowInteractNoArea = ini:GetValueSetB("ProtectionAreas", "AllowInteractNoArea", cConfig.m_AllowInteractNoArea);
- ini:WriteFile();
-end
-
-
-
-
-
---- Returns true if a_Item is the wand tool item
-function cConfig:IsWand(a_Item)
- return (
- (a_Item.m_ItemType == self.m_Wand.m_ItemType) and
- (a_Item.m_ItemDamage == self.m_Wand.m_ItemDamage)
- );
-end
-
-
-
-
-
---- Returns the wand tool item as a cItem object
-function cConfig:GetWandItem()
- return self.m_Wand;
+
+-- Config.lua
+
+-- Implements the cConfig class that holds the general plugin configuration
+
+
+
+
+
+cConfig = {
+ m_Wand = cItem(E_ITEM_STICK, 1, 1); -- The item to be used as the selection wand
+ m_AllowInteractNoArea = true; -- If there's no area, is a player allowed to build / dig?
+};
+
+
+
+
+
+--- Initializes the cConfig object, loads the configuration from an INI file
+function InitializeConfig()
+ local ini = cIniFile("ProtectionAreas.ini");
+ if (not(ini:ReadFile())) then
+ LOGINFO(PluginPrefix .. "Cannot read ProtectionAreas.ini, all plugin configuration is set to defaults");
+ end
+ local WandItem = cItem();
+ if (
+ StringToItem(ini:GetValueSet("ProtectionAreas", "WandItem", ItemToString(cConfig.m_Wand)), WandItem) and
+ IsValidItem(WandItem.m_ItemType)
+ ) then
+ cConfig.m_Wand = WandItem;
+ end
+ cConfig.m_AllowInteractNoArea = ini:GetValueSetB("ProtectionAreas", "AllowInteractNoArea", cConfig.m_AllowInteractNoArea);
+ ini:WriteFile();
+end
+
+
+
+
+
+--- Returns true if a_Item is the wand tool item
+function cConfig:IsWand(a_Item)
+ return (
+ (a_Item.m_ItemType == self.m_Wand.m_ItemType) and
+ (a_Item.m_ItemDamage == self.m_Wand.m_ItemDamage)
+ );
+end
+
+
+
+
+
+--- Returns the wand tool item as a cItem object
+function cConfig:GetWandItem()
+ return self.m_Wand;
end \ No newline at end of file
diff --git a/MCServer/Plugins/ProtectionAreas/CurrentLng.lua b/MCServer/Plugins/ProtectionAreas/CurrentLng.lua
index b0ad3863c..37ff135c5 100644
--- a/MCServer/Plugins/ProtectionAreas/CurrentLng.lua
+++ b/MCServer/Plugins/ProtectionAreas/CurrentLng.lua
@@ -1,76 +1,76 @@
-
--- CurrentLng.lua
--- This file provides all the translatable strings
--- The expectation is that the translators will create copies of this file, translate the texts and then the users will overwrite this file with a specific language version
--- Note that the individual languages must not have ".lua" extension, otherwise MCServer will load them and the plugin won't work!
-
-
-
-
--- Individual commands, and their help strings. Don't touch the first symbol on each line!
--- This needs to be implemented as a function, because it references other functions which might not yet be loaded while Lua is processing the globals
-
-function CommandReg()
- return {
- -- Handler function | Command | Permission | Help text
- {HandleAddArea, "/ProtAdd", "Prot.Add", "<UserNames> - Adds a new protected area"},
- {HandleAddAreaCoords, "/ProtAddCoords", "Prot.Add", "<x1> <z1> <x2> <z2> <UserNames> - Adds a new protected area by coords"},
- {HandleAddAreaUser, "/ProtAddUser", "Prot.AddUser", "<AreaID> <UserNames> - Adds new users to an existing protected area"},
- {HandleDelArea, "/ProtDelID", "Prot.Del", "<AreaID> - Deletes a protected area by ID"},
- {HandleGiveWand, "/ProtWand", "Prot.Wand", " - Gives you the wand used for protection"},
- {HandleListAreas, "/ProtList", "Prot.List", "[<x> <z>] - Lists all areas for the marked block or given coords"},
- {HandleListUsers, "/ProtUsers", "Prot.List", "<AreaID> - Lists all allowed users for a given area ID"},
- {HandleRemoveUser, "/ProtRemUser", "Prot.RemUser", "<AreaID> <UserName> - Removes a user from the protected area"},
- {HandleRemoveUserAll, "/ProtRemUserAll", "Prot.RemUser", "<UserName> - Removes a user from all protected areas"},
- };
-end;
-
-
-
-
-
---- Messages sent to players
-g_Msgs =
-{
- AllUsersAlreadyAllowed = "All the specified users were already allowed.";
- AreaAdded = "Area added, ID %s";
- AreaAllowed = "Allowed";
- AreaDeleted = "Area ID %s deleted";
- AreaNotAllowed = "NOT allowed";
- Coords1Set = "Coords1 set as {%d, %d}";
- Coords2Set = "Coords2 set as {%d, %d}";
- ErrCmdStateNilAddArea = "Cannot add area, internal plugin error (CmdState == nil)";
- ErrCmdStateNilListAreas = "Cannot list areas, internal plugin error (CmdState == nil)";
- ErrDBFailAddUsers = "Cannot add users, DB failure";
- ErrExpectedAreaID = "Parameter mismatch. Expected <AreaID>.";
- ErrExpectedAreaIDUserName = "Parameter mismatch. Expected <AreaID> <UserName>.";
- ErrExpectedAreaIDUsernames = "Not enough parameters. Expected <AreaID> and a list of usernames.";
- ErrExpectedCoordsUsernames = "Not enough parameters. Expected <x1> <z1> <x2> <z2> coords and a list of usernames.";
- ErrExpectedListOfUsernames = "Not enough parameters. Expected a list of usernames.";
- ErrExpectedUserName = "Parameter mismatch. Expected <UserName>.";
- ErrListNotWanded = "Cannot list areas, no query point has been selected. Use a ProtWand lclk / rclk to select a point first";
- ErrNoAreaWanded = "Cannot add area, no area has been selected. Use a ProtWand lclk / rclk to select area first";
- ErrNoSpaceForWand = "Cannot give wand, no space in your inventory";
- ErrNoSuchArea = "No such area: %s";
- ErrParseAreaID = "Cannot parse <AreaID>.";
- ErrParseCoords = "Cannot parse coords.";
- ErrParseCoordsListAreas = "Cannot list areas, cannot parse coords in params";
- ErrSyntaxErrorListAreas = "Cannot list areas, syntax error. Expected either no params or <x> <z>.";
- ListAreasFooter = "Area list finished";
- ListAreasHeader = "Listing protection areas intersecting block column {%d, %d}:";
- ListAreasRow = " %s, %s, created by %s";
- ListUsersFooter = "End of area %s user list, total %d users";
- ListUsersHeader = "Area ID %s: {%d, %d} - {%d, %d}, created by %s; allowed users:";
- ListUsersRow = " %s";
- NotAllowedToBuild = "You are not allowed to build here!";
- NotAllowedToDig = "You are not allowed to dig here!";
- RemovedUser = "Removed %s from area %d";
- RemovedUserAll = "Removed %s from all areas";
- UsersAdded = "Users added: %s";
- WandGiven = "Wand given";
-} ;
-
-
-
-
-
+
+-- CurrentLng.lua
+-- This file provides all the translatable strings
+-- The expectation is that the translators will create copies of this file, translate the texts and then the users will overwrite this file with a specific language version
+-- Note that the individual languages must not have ".lua" extension, otherwise MCServer will load them and the plugin won't work!
+
+
+
+
+-- Individual commands, and their help strings. Don't touch the first symbol on each line!
+-- This needs to be implemented as a function, because it references other functions which might not yet be loaded while Lua is processing the globals
+
+function CommandReg()
+ return {
+ -- Handler function | Command | Permission | Help text
+ {HandleAddArea, "/ProtAdd", "Prot.Add", "<UserNames> - Adds a new protected area"},
+ {HandleAddAreaCoords, "/ProtAddCoords", "Prot.Add", "<x1> <z1> <x2> <z2> <UserNames> - Adds a new protected area by coords"},
+ {HandleAddAreaUser, "/ProtAddUser", "Prot.AddUser", "<AreaID> <UserNames> - Adds new users to an existing protected area"},
+ {HandleDelArea, "/ProtDelID", "Prot.Del", "<AreaID> - Deletes a protected area by ID"},
+ {HandleGiveWand, "/ProtWand", "Prot.Wand", " - Gives you the wand used for protection"},
+ {HandleListAreas, "/ProtList", "Prot.List", "[<x> <z>] - Lists all areas for the marked block or given coords"},
+ {HandleListUsers, "/ProtUsers", "Prot.List", "<AreaID> - Lists all allowed users for a given area ID"},
+ {HandleRemoveUser, "/ProtRemUser", "Prot.RemUser", "<AreaID> <UserName> - Removes a user from the protected area"},
+ {HandleRemoveUserAll, "/ProtRemUserAll", "Prot.RemUser", "<UserName> - Removes a user from all protected areas"},
+ };
+end;
+
+
+
+
+
+--- Messages sent to players
+g_Msgs =
+{
+ AllUsersAlreadyAllowed = "All the specified users were already allowed.";
+ AreaAdded = "Area added, ID %s";
+ AreaAllowed = "Allowed";
+ AreaDeleted = "Area ID %s deleted";
+ AreaNotAllowed = "NOT allowed";
+ Coords1Set = "Coords1 set as {%d, %d}";
+ Coords2Set = "Coords2 set as {%d, %d}";
+ ErrCmdStateNilAddArea = "Cannot add area, internal plugin error (CmdState == nil)";
+ ErrCmdStateNilListAreas = "Cannot list areas, internal plugin error (CmdState == nil)";
+ ErrDBFailAddUsers = "Cannot add users, DB failure";
+ ErrExpectedAreaID = "Parameter mismatch. Expected <AreaID>.";
+ ErrExpectedAreaIDUserName = "Parameter mismatch. Expected <AreaID> <UserName>.";
+ ErrExpectedAreaIDUsernames = "Not enough parameters. Expected <AreaID> and a list of usernames.";
+ ErrExpectedCoordsUsernames = "Not enough parameters. Expected <x1> <z1> <x2> <z2> coords and a list of usernames.";
+ ErrExpectedListOfUsernames = "Not enough parameters. Expected a list of usernames.";
+ ErrExpectedUserName = "Parameter mismatch. Expected <UserName>.";
+ ErrListNotWanded = "Cannot list areas, no query point has been selected. Use a ProtWand lclk / rclk to select a point first";
+ ErrNoAreaWanded = "Cannot add area, no area has been selected. Use a ProtWand lclk / rclk to select area first";
+ ErrNoSpaceForWand = "Cannot give wand, no space in your inventory";
+ ErrNoSuchArea = "No such area: %s";
+ ErrParseAreaID = "Cannot parse <AreaID>.";
+ ErrParseCoords = "Cannot parse coords.";
+ ErrParseCoordsListAreas = "Cannot list areas, cannot parse coords in params";
+ ErrSyntaxErrorListAreas = "Cannot list areas, syntax error. Expected either no params or <x> <z>.";
+ ListAreasFooter = "Area list finished";
+ ListAreasHeader = "Listing protection areas intersecting block column {%d, %d}:";
+ ListAreasRow = " %s, %s, created by %s";
+ ListUsersFooter = "End of area %s user list, total %d users";
+ ListUsersHeader = "Area ID %s: {%d, %d} - {%d, %d}, created by %s; allowed users:";
+ ListUsersRow = " %s";
+ NotAllowedToBuild = "You are not allowed to build here!";
+ NotAllowedToDig = "You are not allowed to dig here!";
+ RemovedUser = "Removed %s from area %d";
+ RemovedUserAll = "Removed %s from all areas";
+ UsersAdded = "Users added: %s";
+ WandGiven = "Wand given";
+} ;
+
+
+
+
+
diff --git a/MCServer/Plugins/ProtectionAreas/HookHandlers.lua b/MCServer/Plugins/ProtectionAreas/HookHandlers.lua
index 18fd4fa03..ded64d298 100644
--- a/MCServer/Plugins/ProtectionAreas/HookHandlers.lua
+++ b/MCServer/Plugins/ProtectionAreas/HookHandlers.lua
@@ -1,139 +1,139 @@
-
--- HookHandlers.lua
--- Implements the handlers for individual hooks
-
-
-
-
-
---- Registers all the hooks that the plugin needs to know about
-function InitializeHooks(a_Plugin)
- local PlgMgr = cRoot:Get():GetPluginManager();
- PlgMgr:AddHook(a_Plugin, cPluginManager.HOOK_DISCONNECT);
- PlgMgr:AddHook(a_Plugin, cPluginManager.HOOK_PLAYER_LEFT_CLICK);
- PlgMgr:AddHook(a_Plugin, cPluginManager.HOOK_PLAYER_MOVING);
- PlgMgr:AddHook(a_Plugin, cPluginManager.HOOK_PLAYER_RIGHT_CLICK);
- PlgMgr:AddHook(a_Plugin, cPluginManager.HOOK_PLAYER_SPAWNED);
-end
-
-
-
-
-
---- Called by MCS when a player's connectino is lost - either they disconnected or timed out
-function OnDisconnect(a_Player, a_Reason)
- -- Remove the player's cProtectionArea object
- g_PlayerAreas[a_Player:GetUniqueID()] = nil;
-
- -- If the player is a VIP, they had a command state, remove that as well
- g_CommandStates[a_Player:GetUniqueID()] = nil;
-
- return false;
-end;
-
-
-
-
-
---- Called by MCS whenever a player enters a world (is spawned)
-function OnPlayerSpawned(a_Player)
- -- Create a new cPlayerAreas object for this player
- if (g_PlayerAreas[a_Player:GetUniqueID()] == nil) then
- LoadPlayerAreas(a_Player);
- end;
-
- return false;
-end
-
-
-
-
-
---- Called by MCS whenever a player is moving (at most once every tick)
-function OnPlayerMoving(a_Player)
- local PlayerID = a_Player:GetUniqueID();
-
- -- If for some reason we don't have a cPlayerAreas object for this player, load it up
- local PlayerAreas = g_PlayerAreas[PlayerID];
- if (PlayerAreas == nil) then
- LoadPlayerAreas(a_Player);
- return false;
- end;
-
- -- If the player is outside their areas' safe space, reload
- if (not(PlayerAreas:IsInSafe(a_Player:GetPosX(), a_Player:GetPosZ()))) then
- LoadPlayerAreas(a_Player);
- end
- return false;
-end
-
-
-
-
-
---- Called by MCS when a player left-clicks
-function OnPlayerLeftClick(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_Status)
- -- If the player has lclked with the wand; regardless of their permissions, let's set the coords:
- if (cConfig:IsWand(a_Player:GetEquippedItem())) then
- -- BlockFace < 0 means "use item", for which the coords are not given by the client
- if (a_BlockFace < 0) then
- return true;
- end
-
- -- Convert the clicked coords into the block space
- a_BlockX, a_BlockY, a_BlockZ = AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace);
-
- -- Set the coords in the CommandState
- GetCommandStateForPlayer(a_Player):SetCoords1(a_BlockX, a_BlockZ);
- a_Player:SendMessage(string.format(g_Msgs.Coords1Set, a_BlockX, a_BlockZ));
- return true;
- end;
-
- -- Check the player areas to see whether to disable this action
- local Areas = g_PlayerAreas[a_Player:GetUniqueID()];
- if not(Areas:CanInteractWithBlock(a_BlockX, a_BlockZ)) then
- a_Player:SendMessage(g_Msgs.NotAllowedToDig);
- return true;
- end
-
- -- Allow interaction
- return false;
-end
-
-
-
-
-
---- Called by MCS when a player right-clicks
-function OnPlayerRightClick(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, a_Status)
-
- -- BlockFace < 0 means "use item", for which the coords are not given by the client
- if (a_BlockFace < 0) then
- return true;
- end
-
- -- Convert the clicked coords into the block space
- a_BlockX, a_BlockY, a_BlockZ = AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace);
-
- -- If the player has rclked with the wand; regardless of their permissions, let's set the coords
- if (cConfig:IsWand(a_Player:GetEquippedItem())) then
- -- Set the coords in the CommandState
- GetCommandStateForPlayer(a_Player):SetCoords2(a_BlockX, a_BlockZ);
- a_Player:SendMessage(string.format(g_Msgs.Coords2Set, a_BlockX, a_BlockZ));
- return true;
- end;
-
- -- Check the player areas to see whether to disable this action
- local Areas = g_PlayerAreas[a_Player:GetUniqueID()];
- if not(Areas:CanInteractWithBlock(a_BlockX, a_BlockZ)) then
- a_Player:SendMessage(g_Msgs.NotAllowedToBuild);
- return true;
- end
-
- -- Allow interaction
- return false;
-end
-
-
-
-
+
+-- HookHandlers.lua
+-- Implements the handlers for individual hooks
+
+
+
+
+
+--- Registers all the hooks that the plugin needs to know about
+function InitializeHooks(a_Plugin)
+ local PlgMgr = cRoot:Get():GetPluginManager();
+ PlgMgr:AddHook(a_Plugin, cPluginManager.HOOK_DISCONNECT);
+ PlgMgr:AddHook(a_Plugin, cPluginManager.HOOK_PLAYER_LEFT_CLICK);
+ PlgMgr:AddHook(a_Plugin, cPluginManager.HOOK_PLAYER_MOVING);
+ PlgMgr:AddHook(a_Plugin, cPluginManager.HOOK_PLAYER_RIGHT_CLICK);
+ PlgMgr:AddHook(a_Plugin, cPluginManager.HOOK_PLAYER_SPAWNED);
+end
+
+
+
+
+
+--- Called by MCS when a player's connectino is lost - either they disconnected or timed out
+function OnDisconnect(a_Player, a_Reason)
+ -- Remove the player's cProtectionArea object
+ g_PlayerAreas[a_Player:GetUniqueID()] = nil;
+
+ -- If the player is a VIP, they had a command state, remove that as well
+ g_CommandStates[a_Player:GetUniqueID()] = nil;
+
+ return false;
+end;
+
+
+
+
+
+--- Called by MCS whenever a player enters a world (is spawned)
+function OnPlayerSpawned(a_Player)
+ -- Create a new cPlayerAreas object for this player
+ if (g_PlayerAreas[a_Player:GetUniqueID()] == nil) then
+ LoadPlayerAreas(a_Player);
+ end;
+
+ return false;
+end
+
+
+
+
+
+--- Called by MCS whenever a player is moving (at most once every tick)
+function OnPlayerMoving(a_Player)
+ local PlayerID = a_Player:GetUniqueID();
+
+ -- If for some reason we don't have a cPlayerAreas object for this player, load it up
+ local PlayerAreas = g_PlayerAreas[PlayerID];
+ if (PlayerAreas == nil) then
+ LoadPlayerAreas(a_Player);
+ return false;
+ end;
+
+ -- If the player is outside their areas' safe space, reload
+ if (not(PlayerAreas:IsInSafe(a_Player:GetPosX(), a_Player:GetPosZ()))) then
+ LoadPlayerAreas(a_Player);
+ end
+ return false;
+end
+
+
+
+
+
+--- Called by MCS when a player left-clicks
+function OnPlayerLeftClick(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_Status)
+ -- If the player has lclked with the wand; regardless of their permissions, let's set the coords:
+ if (cConfig:IsWand(a_Player:GetEquippedItem())) then
+ -- BlockFace < 0 means "use item", for which the coords are not given by the client
+ if (a_BlockFace < 0) then
+ return true;
+ end
+
+ -- Convert the clicked coords into the block space
+ a_BlockX, a_BlockY, a_BlockZ = AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace);
+
+ -- Set the coords in the CommandState
+ GetCommandStateForPlayer(a_Player):SetCoords1(a_BlockX, a_BlockZ);
+ a_Player:SendMessage(string.format(g_Msgs.Coords1Set, a_BlockX, a_BlockZ));
+ return true;
+ end;
+
+ -- Check the player areas to see whether to disable this action
+ local Areas = g_PlayerAreas[a_Player:GetUniqueID()];
+ if not(Areas:CanInteractWithBlock(a_BlockX, a_BlockZ)) then
+ a_Player:SendMessage(g_Msgs.NotAllowedToDig);
+ return true;
+ end
+
+ -- Allow interaction
+ return false;
+end
+
+
+
+
+
+--- Called by MCS when a player right-clicks
+function OnPlayerRightClick(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, a_Status)
+
+ -- BlockFace < 0 means "use item", for which the coords are not given by the client
+ if (a_BlockFace < 0) then
+ return true;
+ end
+
+ -- Convert the clicked coords into the block space
+ a_BlockX, a_BlockY, a_BlockZ = AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace);
+
+ -- If the player has rclked with the wand; regardless of their permissions, let's set the coords
+ if (cConfig:IsWand(a_Player:GetEquippedItem())) then
+ -- Set the coords in the CommandState
+ GetCommandStateForPlayer(a_Player):SetCoords2(a_BlockX, a_BlockZ);
+ a_Player:SendMessage(string.format(g_Msgs.Coords2Set, a_BlockX, a_BlockZ));
+ return true;
+ end;
+
+ -- Check the player areas to see whether to disable this action
+ local Areas = g_PlayerAreas[a_Player:GetUniqueID()];
+ if not(Areas:CanInteractWithBlock(a_BlockX, a_BlockZ)) then
+ a_Player:SendMessage(g_Msgs.NotAllowedToBuild);
+ return true;
+ end
+
+ -- Allow interaction
+ return false;
+end
+
+
+
+
diff --git a/MCServer/Plugins/ProtectionAreas/LICENSE.txt b/MCServer/Plugins/ProtectionAreas/LICENSE.txt
index c46949f66..86c9130cc 100644
--- a/MCServer/Plugins/ProtectionAreas/LICENSE.txt
+++ b/MCServer/Plugins/ProtectionAreas/LICENSE.txt
@@ -1,7 +1,7 @@
-
-ProtectionAreas license
-=======================
-
-The ProtectionAreas plugin is written by _Xoft(o) / Mattes and is hereby released as public domain.
-
-If you like it, I'd really appreciate a postcard, or something tiny typical from your country :) The current snailmail address is at my personal web, http://xoft.cz .
+
+ProtectionAreas license
+=======================
+
+The ProtectionAreas plugin is written by _Xoft(o) / Mattes and is hereby released as public domain.
+
+If you like it, I'd really appreciate a postcard, or something tiny typical from your country :) The current snailmail address is at my personal web, http://xoft.cz .
diff --git a/MCServer/Plugins/ProtectionAreas/PlayerAreas.lua b/MCServer/Plugins/ProtectionAreas/PlayerAreas.lua
index 5627f4d5f..f6106ee77 100644
--- a/MCServer/Plugins/ProtectionAreas/PlayerAreas.lua
+++ b/MCServer/Plugins/ProtectionAreas/PlayerAreas.lua
@@ -1,109 +1,109 @@
-
--- PlayerAreas.lua
--- Implements the cPlayerAreas class representing the per-player area storage object
-
---[[
-Each player instance is expected to have a separate object of type cPlayerAreas.
-Each object has an array of {cuboid, IsAllowed} tables, one for each area that is "within reach"
-The code can then ask each object, whether the player can interact with a certain block or not.
-A player can interact with a block if either one of these is true:
-1, There are no areas covering the block
-2, There is at least one area covering the block with IsAllowed set to true
-The object also has a m_SafeCuboid object that specified the area within which the player may move
-without the PlayerAreas needing a re-query.
-
-Also, a global table g_PlayerAreas is the actual map of PlayerID -> cPlayerAreas
---]]
-
-
-
-
-cPlayerAreas = {};
-
-g_PlayerAreas = {};
-
-
-
-
-
-function cPlayerAreas:new(a_SafeMinX, a_SafeMinZ, a_SafeMaxX, a_SafeMaxZ)
- assert(a_SafeMinX);
- assert(a_SafeMinZ);
- assert(a_SafeMaxX);
- assert(a_SafeMaxZ);
-
- local obj = {};
- setmetatable(obj, self);
- self.__index = self;
- self.m_SafeCuboid = cCuboid(a_SafeMinX, 0, a_SafeMinZ, a_SafeMaxX, 255, a_SafeMaxZ);
- return obj;
-end
-
-
-
-
--- Adds a new cuboid to the area list, where the player is either allowed or not, depending on the IsAllowed param
-function cPlayerAreas:AddArea(a_Cuboid, a_IsAllowed)
- table.insert(self, {m_Cuboid = a_Cuboid, m_IsAllowed = a_IsAllowed});
-end
-
-
-
-
-
---- returns true if the player owning this object can interact with the specified block
-function cPlayerAreas:CanInteractWithBlock(a_BlockX, a_BlockZ)
- assert(self);
-
- -- iterate through all the stored areas:
- local IsInsideAnyArea = false;
- for idx, Area in ipairs(self) do
- if (Area.m_Cuboid:IsInside(a_BlockX, 1, a_BlockZ)) then -- We don't care about Y coords, so use a dummy value
- if (Area.m_IsAllowed) then
- return true;
- end
- -- The coords are inside a cuboid for which the player doesn't have access, take a note of it
- IsInsideAnyArea = true;
- end
- end
-
- if (IsInsideAnyArea) then
- -- The specified coords are inside at least one area, but none of them allow the player to interact
- return false;
- end
-
- -- The coords are not inside any area
- return cConfig.m_AllowInteractNoArea;
-end
-
-
-
-
-
---- Calls the specified callback for each area contained within
--- a_Callback has a signature: function(a_Cuboid, a_IsAllowed)
--- Returns true if all areas have been enumerated, false if the callback has aborted by returning true
-function cPlayerAreas:ForEachArea(a_Callback)
- assert(self);
-
- for idx, Area in ipairs(self) do
- if (a_Callback(Area.m_Cuboid, Area.m_IsAllowed)) then
- return false;
- end
- end
- return true;
-end
-
-
-
-
-
---- Returns true if the player is withing the safe cuboid (no need to re-query the areas)
-function cPlayerAreas:IsInSafe(a_BlockX, a_BlockZ)
- assert(self);
- return self.m_SafeCuboid:IsInside(a_BlockX, 0, a_BlockZ);
-end
-
-
-
-
+
+-- PlayerAreas.lua
+-- Implements the cPlayerAreas class representing the per-player area storage object
+
+--[[
+Each player instance is expected to have a separate object of type cPlayerAreas.
+Each object has an array of {cuboid, IsAllowed} tables, one for each area that is "within reach"
+The code can then ask each object, whether the player can interact with a certain block or not.
+A player can interact with a block if either one of these is true:
+1, There are no areas covering the block
+2, There is at least one area covering the block with IsAllowed set to true
+The object also has a m_SafeCuboid object that specified the area within which the player may move
+without the PlayerAreas needing a re-query.
+
+Also, a global table g_PlayerAreas is the actual map of PlayerID -> cPlayerAreas
+--]]
+
+
+
+
+cPlayerAreas = {};
+
+g_PlayerAreas = {};
+
+
+
+
+
+function cPlayerAreas:new(a_SafeMinX, a_SafeMinZ, a_SafeMaxX, a_SafeMaxZ)
+ assert(a_SafeMinX);
+ assert(a_SafeMinZ);
+ assert(a_SafeMaxX);
+ assert(a_SafeMaxZ);
+
+ local obj = {};
+ setmetatable(obj, self);
+ self.__index = self;
+ self.m_SafeCuboid = cCuboid(a_SafeMinX, 0, a_SafeMinZ, a_SafeMaxX, 255, a_SafeMaxZ);
+ return obj;
+end
+
+
+
+
+-- Adds a new cuboid to the area list, where the player is either allowed or not, depending on the IsAllowed param
+function cPlayerAreas:AddArea(a_Cuboid, a_IsAllowed)
+ table.insert(self, {m_Cuboid = a_Cuboid, m_IsAllowed = a_IsAllowed});
+end
+
+
+
+
+
+--- returns true if the player owning this object can interact with the specified block
+function cPlayerAreas:CanInteractWithBlock(a_BlockX, a_BlockZ)
+ assert(self);
+
+ -- iterate through all the stored areas:
+ local IsInsideAnyArea = false;
+ for idx, Area in ipairs(self) do
+ if (Area.m_Cuboid:IsInside(a_BlockX, 1, a_BlockZ)) then -- We don't care about Y coords, so use a dummy value
+ if (Area.m_IsAllowed) then
+ return true;
+ end
+ -- The coords are inside a cuboid for which the player doesn't have access, take a note of it
+ IsInsideAnyArea = true;
+ end
+ end
+
+ if (IsInsideAnyArea) then
+ -- The specified coords are inside at least one area, but none of them allow the player to interact
+ return false;
+ end
+
+ -- The coords are not inside any area
+ return cConfig.m_AllowInteractNoArea;
+end
+
+
+
+
+
+--- Calls the specified callback for each area contained within
+-- a_Callback has a signature: function(a_Cuboid, a_IsAllowed)
+-- Returns true if all areas have been enumerated, false if the callback has aborted by returning true
+function cPlayerAreas:ForEachArea(a_Callback)
+ assert(self);
+
+ for idx, Area in ipairs(self) do
+ if (a_Callback(Area.m_Cuboid, Area.m_IsAllowed)) then
+ return false;
+ end
+ end
+ return true;
+end
+
+
+
+
+
+--- Returns true if the player is withing the safe cuboid (no need to re-query the areas)
+function cPlayerAreas:IsInSafe(a_BlockX, a_BlockZ)
+ assert(self);
+ return self.m_SafeCuboid:IsInside(a_BlockX, 0, a_BlockZ);
+end
+
+
+
+
diff --git a/MCServer/Plugins/ProtectionAreas/ProtectionAreas.lua b/MCServer/Plugins/ProtectionAreas/ProtectionAreas.lua
index 8c2db1387..cbe3fa94d 100644
--- a/MCServer/Plugins/ProtectionAreas/ProtectionAreas.lua
+++ b/MCServer/Plugins/ProtectionAreas/ProtectionAreas.lua
@@ -1,71 +1,71 @@
-
--- ProtectionAreas.lua
--- Defines the main plugin entrypoint, as well as some utility functions
-
-
-
-
-
---- Prefix for all messages logged to the server console
-PluginPrefix = "ProtectionAreas: ";
-
---- Bounds for the area loading. Areas less this far in any direction from the player will be loaded into cPlayerAreas
-g_AreaBounds = 48;
-
---- If a player moves this close to the PlayerAreas bounds, the PlayerAreas will be re-queried
-g_AreaSafeEdge = 12;
-
-
-
-
-
---- Called by MCS when the plugin loads
--- Returns true if initialization successful, false otherwise
-function Initialize(a_Plugin)
- a_Plugin:SetName("ProtectionAreas");
- a_Plugin:SetVersion(1);
-
- InitializeConfig();
- if (not(InitializeStorage())) then
- LOGWARNING(PluginPrefix .. "failed to initialize Storage, plugin is disabled");
- return false;
- end
- InitializeHooks(a_Plugin);
- InitializeCommandHandlers();
-
- -- We might be reloading, so there may be players already present in the server; reload all of them
- cRoot:Get():ForEachWorld(
- function(a_World)
- ReloadAllPlayersInWorld(a_World:GetName());
- end
- );
-
- return true;
-end
-
-
-
-
-
---- Loads a cPlayerAreas object from the DB for the player, and assigns it to the player map
-function LoadPlayerAreas(a_Player)
- local PlayerID = a_Player:GetUniqueID();
- local PlayerX = math.floor(a_Player:GetPosX());
- local PlayerZ = math.floor(a_Player:GetPosZ());
- local WorldName = a_Player:GetWorld():GetName();
- g_PlayerAreas[PlayerID] = g_Storage:LoadPlayerAreas(a_Player:GetName(), PlayerX, PlayerZ, WorldName);
-end
-
-
-
-
-
-function ReloadAllPlayersInWorld(a_WorldName)
- local World = cRoot:Get():GetWorld(a_WorldName);
- World:ForEachPlayer(LoadPlayerAreas);
-end
-
-
-
-
-
+
+-- ProtectionAreas.lua
+-- Defines the main plugin entrypoint, as well as some utility functions
+
+
+
+
+
+--- Prefix for all messages logged to the server console
+PluginPrefix = "ProtectionAreas: ";
+
+--- Bounds for the area loading. Areas less this far in any direction from the player will be loaded into cPlayerAreas
+g_AreaBounds = 48;
+
+--- If a player moves this close to the PlayerAreas bounds, the PlayerAreas will be re-queried
+g_AreaSafeEdge = 12;
+
+
+
+
+
+--- Called by MCS when the plugin loads
+-- Returns true if initialization successful, false otherwise
+function Initialize(a_Plugin)
+ a_Plugin:SetName("ProtectionAreas");
+ a_Plugin:SetVersion(1);
+
+ InitializeConfig();
+ if (not(InitializeStorage())) then
+ LOGWARNING(PluginPrefix .. "failed to initialize Storage, plugin is disabled");
+ return false;
+ end
+ InitializeHooks(a_Plugin);
+ InitializeCommandHandlers();
+
+ -- We might be reloading, so there may be players already present in the server; reload all of them
+ cRoot:Get():ForEachWorld(
+ function(a_World)
+ ReloadAllPlayersInWorld(a_World:GetName());
+ end
+ );
+
+ return true;
+end
+
+
+
+
+
+--- Loads a cPlayerAreas object from the DB for the player, and assigns it to the player map
+function LoadPlayerAreas(a_Player)
+ local PlayerID = a_Player:GetUniqueID();
+ local PlayerX = math.floor(a_Player:GetPosX());
+ local PlayerZ = math.floor(a_Player:GetPosZ());
+ local WorldName = a_Player:GetWorld():GetName();
+ g_PlayerAreas[PlayerID] = g_Storage:LoadPlayerAreas(a_Player:GetName(), PlayerX, PlayerZ, WorldName);
+end
+
+
+
+
+
+function ReloadAllPlayersInWorld(a_WorldName)
+ local World = cRoot:Get():GetWorld(a_WorldName);
+ World:ForEachPlayer(LoadPlayerAreas);
+end
+
+
+
+
+
diff --git a/MCServer/Plugins/ProtectionAreas/Storage.lua b/MCServer/Plugins/ProtectionAreas/Storage.lua
index 07825b172..a6cf564bf 100644
--- a/MCServer/Plugins/ProtectionAreas/Storage.lua
+++ b/MCServer/Plugins/ProtectionAreas/Storage.lua
@@ -1,518 +1,518 @@
-
--- Storage.lua
--- Implements the storage access object, shielding the rest of the code away from the DB
-
---[[
-The cStorage class is the interface to the underlying storage, the SQLite database.
-This class knows how to load player areas from the DB, how to add or remove areas in the DB
-and other such operations.
-
-Also, a g_Storage global variable is declared, it holds the single instance of the storage.
---]]
-
-
-
-
-
-cStorage = {};
-
-g_Storage = {};
-
-
-
-
-
---- Initializes the storage subsystem, creates the g_Storage object
--- Returns true if successful, false if not
-function InitializeStorage()
- g_Storage = cStorage:new();
- if (not(g_Storage:OpenDB())) then
- return false;
- end
-
- return true;
-end
-
-
-
-
-
-function cStorage:new(obj)
- obj = obj or {};
- setmetatable(obj, self);
- self.__index = self;
- return obj;
-end
-
-
-
-
---- Opens the DB and makes sure it has all the columns needed
--- Returns true if successful, false otherwise
-function cStorage:OpenDB()
- local ErrCode, ErrMsg;
- self.DB, ErrCode, ErrMsg = sqlite3.open("ProtectionAreas.sqlite");
- if (self.DB == nil) then
- LOGWARNING(PluginPrefix .. "Cannot open ProtectionAreas.sqlite, error " .. ErrCode .. " (" .. ErrMsg ..")");
- return false;
- end
-
- if (
- not(self:CreateTable("Areas", {"ID INTEGER PRIMARY KEY AUTOINCREMENT", "MinX", "MaxX", "MinZ", "MaxZ", "WorldName", "CreatorUserName"})) or
- not(self:CreateTable("AllowedUsers", {"AreaID", "UserName"}))
- ) then
- LOGWARNING(PluginPrefix .. "Cannot create DB tables!");
- return false;
- end
-
- return true;
-end
-
-
-
-
-
---- Executes the SQL command given, calling the a_Callback for each result
--- If the SQL command fails, prints it out on the server console and returns false
--- Returns true on success
-function cStorage:DBExec(a_SQL, a_Callback, a_CallbackParam)
- local ErrCode = self.DB:exec(a_SQL, a_Callback, a_CallbackParam);
- if (ErrCode ~= sqlite3.OK) then
- LOGWARNING(PluginPrefix .. "Error " .. ErrCode .. " (" .. self.DB:errmsg() ..
- ") while processing SQL command >>" .. a_SQL .. "<<"
- );
- return false;
- end
- return true;
-end
-
-
-
-
-
---- Creates the table of the specified name and columns[]
--- If the table exists, any columns missing are added; existing data is kept
-function cStorage:CreateTable(a_TableName, a_Columns)
- -- Try to create the table first
- local sql = "CREATE TABLE IF NOT EXISTS '" .. a_TableName .. "' (";
- sql = sql .. table.concat(a_Columns, ", ");
- sql = sql .. ")";
- if (not(self:DBExec(sql))) then
- LOGWARNING(PluginPrefix .. "Cannot create DB Table " .. a_TableName);
- return false;
- end
- -- SQLite doesn't inform us if it created the table or not, so we have to continue anyway
-
- -- Check each column whether it exists
- -- Remove all the existing columns from a_Columns:
- local RemoveExistingColumn = function(UserData, NumCols, Values, Names)
- -- Remove the received column from a_Columns. Search for column name in the Names[] / Values[] pairs
- for i = 1, NumCols do
- if (Names[i] == "name") then
- local ColumnName = Values[i]:lower();
- -- Search the a_Columns if they have that column:
- for j = 1, #a_Columns do
- -- Cut away all column specifiers (after the first space), if any:
- local SpaceIdx = string.find(a_Columns[j], " ");
- if (SpaceIdx ~= nil) then
- SpaceIdx = SpaceIdx - 1;
- end
- local ColumnTemplate = string.lower(string.sub(a_Columns[j], 1, SpaceIdx));
- -- If it is a match, remove from a_Columns:
- if (ColumnTemplate == ColumnName) then
- table.remove(a_Columns, j);
- break; -- for j
- end
- end -- for j - a_Columns[]
- end
- end -- for i - Names[] / Values[]
- return 0;
- end
- if (not(self:DBExec("PRAGMA table_info(" .. a_TableName .. ")", RemoveExistingColumn))) then
- LOGWARNING(PluginPrefix .. "Cannot query DB table structure");
- return false;
- end
-
- -- Create the missing columns
- -- a_Columns now contains only those columns that are missing in the DB
- if (#a_Columns > 0) then
- LOGINFO(PluginPrefix .. "Database table \"" .. a_TableName .. "\" is missing " .. #a_Columns .. " columns, fixing now.");
- for idx, ColumnName in ipairs(a_Columns) do
- if (not(self:DBExec("ALTER TABLE '" .. a_TableName .. "' ADD COLUMN " .. ColumnName))) then
- LOGWARNING(PluginPrefix .. "Cannot add DB table \"" .. a_TableName .. "\" column \"" .. ColumnName .. "\"");
- return false;
- end
- end
- LOGINFO(PluginPrefix .. "Database table \"" .. a_TableName .. "\" columns fixed.");
- end
-
- return true;
-end
-
-
-
-
-
---- Returns true if the specified area is allowed for the specified player
-function cStorage:IsAreaAllowed(a_AreaID, a_PlayerName, a_WorldName)
- assert(a_AreaID);
- assert(a_PlayerName);
- assert(a_WorldName);
- assert(self);
-
- local lcPlayerName = string.lower(a_PlayerName);
- local res = false;
- local sql = "SELECT COUNT(*) FROM AllowedUsers WHERE (AreaID = " .. a_AreaID ..
- ") AND (UserName ='" .. lcPlayerName .. "')";
- local function SetResTrue(UserData, NumValues, Values, Names)
- res = (tonumber(Values[1]) > 0);
- return 0;
- end
- if (not(self:DBExec(sql, SetResTrue))) then
- LOGWARNING("SQL error while determining area allowance");
- return false;
- end
- return res;
-end
-
-
-
-
-
---- Loads cPlayerAreas for the specified player from the DB. Returns a cPlayerAreas object
-function cStorage:LoadPlayerAreas(a_PlayerName, a_PlayerX, a_PlayerZ, a_WorldName)
- assert(a_PlayerName);
- assert(a_PlayerX);
- assert(a_PlayerZ);
- assert(a_WorldName);
- assert(self);
-
- -- Bounds for which the areas are loaded
- local BoundsMinX = a_PlayerX - g_AreaBounds;
- local BoundsMaxX = a_PlayerX + g_AreaBounds;
- local BoundsMinZ = a_PlayerZ - g_AreaBounds;
- local BoundsMaxZ = a_PlayerZ + g_AreaBounds;
-
- local res = cPlayerAreas:new(
- BoundsMinX + g_AreaSafeEdge, BoundsMinZ + g_AreaSafeEdge,
- BoundsMaxX - g_AreaSafeEdge, BoundsMaxZ - g_AreaSafeEdge
- );
-
- --[[
- LOG("Loading protection areas for player " .. a_PlayerName .. " centered around {" .. a_PlayerX .. ", " .. a_PlayerZ ..
- "}, bounds are {" .. BoundsMinX .. ", " .. BoundsMinZ .. "} - {" ..
- BoundsMaxX .. ", " .. BoundsMaxZ .. "}"
- );
- --]]
-
- -- Load the areas from the DB, based on the player's location
- local lcWorldName = string.lower(a_WorldName);
- local sql =
- "SELECT ID, MinX, MaxX, MinZ, MaxZ FROM Areas WHERE " ..
- "MinX < " .. BoundsMaxX .. " AND MaxX > " .. BoundsMinX .. " AND " ..
- "MinZ < " .. BoundsMaxZ .. " AND MaxZ > " .. BoundsMinZ .. " AND " ..
- "WorldName = '" .. lcWorldName .."'";
-
- local function AddAreas(UserData, NumValues, Values, Names)
- if ((NumValues < 5) or ((Values[1] and Values[2] and Values[3] and Values[4] and Values[5]) == nil)) then
- LOGWARNING("SQL query didn't return all data");
- return 0;
- end
- res:AddArea(cCuboid(Values[2], 0, Values[4], Values[3], 255, Values[5]), self:IsAreaAllowed(Values[1], a_PlayerName, a_WorldName));
- return 0;
- end
-
- if (not(self:DBExec(sql, AddAreas))) then
- LOGWARNING("SQL error while querying areas");
- return res;
- end
-
- return res;
-end
-
-
-
-
-
---- Adds a new area into the DB. a_AllowedNames is a table listing all the players that are allowed in the area
--- Returns the ID of the new area, or -1 on failure
-function cStorage:AddArea(a_Cuboid, a_WorldName, a_CreatorName, a_AllowedNames)
- assert(a_Cuboid);
- assert(a_WorldName);
- assert(a_CreatorName);
- assert(a_AllowedNames);
- assert(self);
-
- -- Store the area in the DB
- local ID = -1;
- local function RememberID(UserData, NumCols, Values, Names)
- for i = 1, NumCols do
- if (Names[i] == "ID") then
- ID = Values[i];
- end
- end
- return 0;
- end
- local lcWorldName = string.lower(a_WorldName);
- local lcCreatorName = string.lower(a_CreatorName);
- local sql =
- "INSERT INTO Areas (ID, MinX, MaxX, MinZ, MaxZ, WorldName, CreatorUserName) VALUES (NULL, " ..
- a_Cuboid.p1.x .. ", " .. a_Cuboid.p2.x .. ", " .. a_Cuboid.p1.z .. ", " .. a_Cuboid.p2.z ..
- ", '" .. lcWorldName .. "', '" .. lcCreatorName ..
- "'); SELECT last_insert_rowid() AS ID";
- if (not(self:DBExec(sql, RememberID))) then
- LOGWARNING(PluginPrefix .. "SQL Error while inserting new area");
- return -1;
- end
- if (ID == -1) then
- LOGWARNING(PluginPrefix .. "SQL Error while retrieving INSERTion ID");
- return -1;
- end
-
- -- Store each allowed player in the DB
- for idx, Name in ipairs(a_AllowedNames) do
- local lcName = string.lower(Name);
- local sql = "INSERT INTO AllowedUsers (AreaID, UserName) VALUES (" .. ID .. ", '" .. lcName .. "')";
- if (not(self:DBExec(sql))) then
- LOGWARNING(PluginPrefix .. "SQL Error while inserting new area's allowed player " .. Name);
- end
- end
- return ID;
-end
-
-
-
-
-
-function cStorage:DelArea(a_WorldName, a_AreaID)
- assert(a_WorldName);
- assert(a_AreaID);
- assert(self);
-
- -- Since all areas are stored in a single DB (for now), the worldname parameter isn't used at all
- -- Later if we change to a per-world DB, we'll need the world name
-
- -- Delete from both tables simultaneously
- local sql =
- "DELETE FROM Areas WHERE ID = " .. a_AreaID .. ";" ..
- "DELETE FROM AllowedUsers WHERE AreaID = " .. a_AreaID;
- if (not(self:DBExec(sql))) then
- LOGWARNING(PluginPrefix .. "SQL error while deleting area " .. a_AreaID .. " from world \"" .. a_WorldName .. "\"");
- return false;
- end
-
- return true;
-end
-
-
-
-
-
---- Removes the user from the specified area
-function cStorage:RemoveUser(a_AreaID, a_UserName, a_WorldName)
- assert(a_AreaID);
- assert(a_UserName);
- assert(a_WorldName);
- assert(self);
-
- -- WorldName is not used yet, because all the worlds share the same DB in this version
-
- local lcUserName = string.lower(a_UserName);
- local sql = "DELETE FROM AllowedUsers WHERE " ..
- "AreaID = " .. a_AreaID .. " AND UserName = '" .. lcUserName .. "'";
- if (not(self:DBExec(sql))) then
- LOGWARNING("SQL error while removing user " .. a_UserName .. " from area ID " .. a_AreaID);
- return false;
- end
- return true;
-end
-
-
-
-
-
---- Removes the user from all areas in the specified world
-function cStorage:RemoveUserAll(a_UserName, a_WorldName)
- assert(a_UserName);
- assert(a_WorldName);
- assert(self);
-
- local lcUserName = string.lower(a_UserName);
- local sql = "DELETE FROM AllowedUsers WHERE UserName = '" .. lcUserName .."'";
- if (not(self:DBExec(sql))) then
- LOGWARNING("SQL error while removing user " .. a_UserName .. " from all areas");
- return false;
- end
- return true;
-end
-
-
-
-
-
---- Calls the callback for each area intersecting the specified coords
--- Callback signature: function(ID, MinX, MinZ, MaxX, MaxZ, CreatorName)
-function cStorage:ForEachArea(a_BlockX, a_BlockZ, a_WorldName, a_Callback)
- assert(a_BlockX);
- assert(a_BlockZ);
- assert(a_WorldName);
- assert(a_Callback);
- assert(self);
-
- -- SQL callback that parses the values and calls our callback
- function CallCallback(UserData, NumValues, Values, Names)
- if (NumValues ~= 6) then
- -- Not enough values returned, skip this row
- return 0;
- end
- local ID = Values[1];
- local MinX = Values[2];
- local MinZ = Values[3];
- local MaxX = Values[4];
- local MaxZ = Values[5];
- local CreatorName = Values[6];
- a_Callback(ID, MinX, MinZ, MaxX, MaxZ, CreatorName);
- return 0;
- end
-
- local lcWorldName = string.lower(a_WorldName);
- local sql = "SELECT ID, MinX, MinZ, MaxX, MaxZ, CreatorUserName FROM Areas WHERE " ..
- "MinX <= " .. a_BlockX .. " AND MaxX >= " .. a_BlockX .. " AND " ..
- "MinZ <= " .. a_BlockZ .. " AND MaxZ >= " .. a_BlockZ .. " AND " ..
- "WorldName = '" .. lcWorldName .. "'";
- if (not(self:DBExec(sql, CallCallback))) then
- LOGWARNING("SQL Error while iterating through areas (cStorage:ForEachArea())");
- return false;
- end
- return true;
-end
-
-
-
-
-
---- Returns the info on the specified area
--- Returns MinX, MinZ, MaxX, MaxZ, CreatorName on success, or nothing on failure
-function cStorage:GetArea(a_AreaID, a_WorldName)
- assert(a_AreaID);
- assert(a_WorldName);
- assert(self);
-
- local MinX, MinZ, MaxX, MaxZ, CreatorName;
- local HasValues = false;
-
- -- SQL callback that parses the values and remembers them in variables
- function RememberValues(UserData, NumValues, Values, Names)
- if (NumValues ~= 5) then
- -- Not enough values returned, skip this row
- return 0;
- end
- MinX = Values[1];
- MinZ = Values[2];
- MaxX = Values[3];
- MaxZ = Values[4];
- CreatorName = Values[5];
- HasValues = true;
- return 0;
- end
-
- local lcWorldName = string.lower(a_WorldName);
- local sql = "SELECT MinX, MinZ, MaxX, MaxZ, CreatorUserName FROM Areas WHERE " ..
- "ID = " .. a_AreaID .. " AND WorldName = '" .. lcWorldName .. "'";
- if (not(self:DBExec(sql, RememberValues))) then
- LOGWARNING("SQL Error while getting area info (cStorage:ForEachArea())");
- return;
- end
-
- -- If no data has been retrieved, return nothing
- if (not(HasValues)) then
- return;
- end
-
- return MinX, MinZ, MaxX, MaxZ, CreatorName;
-end
-
-
-
-
-
---- Calls the callback for each allowed user for the specified area
--- Callback signature: function(UserName)
-function cStorage:ForEachUserInArea(a_AreaID, a_WorldName, a_Callback)
- assert(a_AreaID);
- assert(a_WorldName);
- assert(a_Callback);
- assert(self);
-
- -- Since in this version all the worlds share a single DB, the a_WorldName parameter is not actually used
- -- But this may change in the future, when we have a per-world DB
-
- local function CallCallback(UserData, NumValues, Values)
- if (NumValues ~= 1) then
- return 0;
- end
- a_Callback(Values[1]);
- return 0;
- end
- local sql = "SELECT UserName FROM AllowedUsers WHERE AreaID = " .. a_AreaID;
- if (not(self:DBExec(sql, CallCallback))) then
- LOGWARNING("SQL error while iterating area users for AreaID" .. a_AreaID);
- return false;
- end
- return true;
-end
-
-
-
-
-
---- Adds the specified usernames to the specified area, if not already present
--- a_Users is an array table of usernames to add
-function cStorage:AddAreaUsers(a_AreaID, a_WorldName, a_AddedBy, a_Users)
- assert(a_AreaID);
- assert(a_WorldName);
- assert(a_Users);
- assert(self);
-
- -- Convert all usernames to lowercase
- for idx, Name in ipairs(a_Users) do
- a_Users[idx] = string.lower(Name);
- end
-
- -- Remove from a_Users the usernames already present in the area
- local sql = "SELECT UserName FROM AllowedUsers WHERE AreaID = " .. a_AreaID;
- local function RemovePresent(UserData, NumValues, Values, Names)
- if (NumValues ~= 1) then
- -- Invalid response format
- return 0;
- end
- local DBName = Values[1];
- -- Remove the name from a_Users, if exists
- for idx, Name in ipairs(a_Users) do
- if (Name == DBName) then
- table.remove(a_Users, idx);
- return 0;
- end
- end
- return 0;
- end
- if (not(self:DBExec(sql, RemovePresent))) then
- LOGWARNING("SQL error while iterating through users");
- return false;
- end
-
- -- Add the users
- for idx, Name in ipairs(a_Users) do
- local sql = "INSERT INTO AllowedUsers (AreaID, UserName) VALUES (" .. a_AreaID .. ", '" .. Name .. "')";
- if (not(self:DBExec(sql))) then
- LOGWARNING("SQL error while adding user " .. Name .. " to area " .. a_AreaID);
- end
- end
-
- return true;
-end
-
-
-
-
-
+
+-- Storage.lua
+-- Implements the storage access object, shielding the rest of the code away from the DB
+
+--[[
+The cStorage class is the interface to the underlying storage, the SQLite database.
+This class knows how to load player areas from the DB, how to add or remove areas in the DB
+and other such operations.
+
+Also, a g_Storage global variable is declared, it holds the single instance of the storage.
+--]]
+
+
+
+
+
+cStorage = {};
+
+g_Storage = {};
+
+
+
+
+
+--- Initializes the storage subsystem, creates the g_Storage object
+-- Returns true if successful, false if not
+function InitializeStorage()
+ g_Storage = cStorage:new();
+ if (not(g_Storage:OpenDB())) then
+ return false;
+ end
+
+ return true;
+end
+
+
+
+
+
+function cStorage:new(obj)
+ obj = obj or {};
+ setmetatable(obj, self);
+ self.__index = self;
+ return obj;
+end
+
+
+
+
+--- Opens the DB and makes sure it has all the columns needed
+-- Returns true if successful, false otherwise
+function cStorage:OpenDB()
+ local ErrCode, ErrMsg;
+ self.DB, ErrCode, ErrMsg = sqlite3.open("ProtectionAreas.sqlite");
+ if (self.DB == nil) then
+ LOGWARNING(PluginPrefix .. "Cannot open ProtectionAreas.sqlite, error " .. ErrCode .. " (" .. ErrMsg ..")");
+ return false;
+ end
+
+ if (
+ not(self:CreateTable("Areas", {"ID INTEGER PRIMARY KEY AUTOINCREMENT", "MinX", "MaxX", "MinZ", "MaxZ", "WorldName", "CreatorUserName"})) or
+ not(self:CreateTable("AllowedUsers", {"AreaID", "UserName"}))
+ ) then
+ LOGWARNING(PluginPrefix .. "Cannot create DB tables!");
+ return false;
+ end
+
+ return true;
+end
+
+
+
+
+
+--- Executes the SQL command given, calling the a_Callback for each result
+-- If the SQL command fails, prints it out on the server console and returns false
+-- Returns true on success
+function cStorage:DBExec(a_SQL, a_Callback, a_CallbackParam)
+ local ErrCode = self.DB:exec(a_SQL, a_Callback, a_CallbackParam);
+ if (ErrCode ~= sqlite3.OK) then
+ LOGWARNING(PluginPrefix .. "Error " .. ErrCode .. " (" .. self.DB:errmsg() ..
+ ") while processing SQL command >>" .. a_SQL .. "<<"
+ );
+ return false;
+ end
+ return true;
+end
+
+
+
+
+
+--- Creates the table of the specified name and columns[]
+-- If the table exists, any columns missing are added; existing data is kept
+function cStorage:CreateTable(a_TableName, a_Columns)
+ -- Try to create the table first
+ local sql = "CREATE TABLE IF NOT EXISTS '" .. a_TableName .. "' (";
+ sql = sql .. table.concat(a_Columns, ", ");
+ sql = sql .. ")";
+ if (not(self:DBExec(sql))) then
+ LOGWARNING(PluginPrefix .. "Cannot create DB Table " .. a_TableName);
+ return false;
+ end
+ -- SQLite doesn't inform us if it created the table or not, so we have to continue anyway
+
+ -- Check each column whether it exists
+ -- Remove all the existing columns from a_Columns:
+ local RemoveExistingColumn = function(UserData, NumCols, Values, Names)
+ -- Remove the received column from a_Columns. Search for column name in the Names[] / Values[] pairs
+ for i = 1, NumCols do
+ if (Names[i] == "name") then
+ local ColumnName = Values[i]:lower();
+ -- Search the a_Columns if they have that column:
+ for j = 1, #a_Columns do
+ -- Cut away all column specifiers (after the first space), if any:
+ local SpaceIdx = string.find(a_Columns[j], " ");
+ if (SpaceIdx ~= nil) then
+ SpaceIdx = SpaceIdx - 1;
+ end
+ local ColumnTemplate = string.lower(string.sub(a_Columns[j], 1, SpaceIdx));
+ -- If it is a match, remove from a_Columns:
+ if (ColumnTemplate == ColumnName) then
+ table.remove(a_Columns, j);
+ break; -- for j
+ end
+ end -- for j - a_Columns[]
+ end
+ end -- for i - Names[] / Values[]
+ return 0;
+ end
+ if (not(self:DBExec("PRAGMA table_info(" .. a_TableName .. ")", RemoveExistingColumn))) then
+ LOGWARNING(PluginPrefix .. "Cannot query DB table structure");
+ return false;
+ end
+
+ -- Create the missing columns
+ -- a_Columns now contains only those columns that are missing in the DB
+ if (#a_Columns > 0) then
+ LOGINFO(PluginPrefix .. "Database table \"" .. a_TableName .. "\" is missing " .. #a_Columns .. " columns, fixing now.");
+ for idx, ColumnName in ipairs(a_Columns) do
+ if (not(self:DBExec("ALTER TABLE '" .. a_TableName .. "' ADD COLUMN " .. ColumnName))) then
+ LOGWARNING(PluginPrefix .. "Cannot add DB table \"" .. a_TableName .. "\" column \"" .. ColumnName .. "\"");
+ return false;
+ end
+ end
+ LOGINFO(PluginPrefix .. "Database table \"" .. a_TableName .. "\" columns fixed.");
+ end
+
+ return true;
+end
+
+
+
+
+
+--- Returns true if the specified area is allowed for the specified player
+function cStorage:IsAreaAllowed(a_AreaID, a_PlayerName, a_WorldName)
+ assert(a_AreaID);
+ assert(a_PlayerName);
+ assert(a_WorldName);
+ assert(self);
+
+ local lcPlayerName = string.lower(a_PlayerName);
+ local res = false;
+ local sql = "SELECT COUNT(*) FROM AllowedUsers WHERE (AreaID = " .. a_AreaID ..
+ ") AND (UserName ='" .. lcPlayerName .. "')";
+ local function SetResTrue(UserData, NumValues, Values, Names)
+ res = (tonumber(Values[1]) > 0);
+ return 0;
+ end
+ if (not(self:DBExec(sql, SetResTrue))) then
+ LOGWARNING("SQL error while determining area allowance");
+ return false;
+ end
+ return res;
+end
+
+
+
+
+
+--- Loads cPlayerAreas for the specified player from the DB. Returns a cPlayerAreas object
+function cStorage:LoadPlayerAreas(a_PlayerName, a_PlayerX, a_PlayerZ, a_WorldName)
+ assert(a_PlayerName);
+ assert(a_PlayerX);
+ assert(a_PlayerZ);
+ assert(a_WorldName);
+ assert(self);
+
+ -- Bounds for which the areas are loaded
+ local BoundsMinX = a_PlayerX - g_AreaBounds;
+ local BoundsMaxX = a_PlayerX + g_AreaBounds;
+ local BoundsMinZ = a_PlayerZ - g_AreaBounds;
+ local BoundsMaxZ = a_PlayerZ + g_AreaBounds;
+
+ local res = cPlayerAreas:new(
+ BoundsMinX + g_AreaSafeEdge, BoundsMinZ + g_AreaSafeEdge,
+ BoundsMaxX - g_AreaSafeEdge, BoundsMaxZ - g_AreaSafeEdge
+ );
+
+ --[[
+ LOG("Loading protection areas for player " .. a_PlayerName .. " centered around {" .. a_PlayerX .. ", " .. a_PlayerZ ..
+ "}, bounds are {" .. BoundsMinX .. ", " .. BoundsMinZ .. "} - {" ..
+ BoundsMaxX .. ", " .. BoundsMaxZ .. "}"
+ );
+ --]]
+
+ -- Load the areas from the DB, based on the player's location
+ local lcWorldName = string.lower(a_WorldName);
+ local sql =
+ "SELECT ID, MinX, MaxX, MinZ, MaxZ FROM Areas WHERE " ..
+ "MinX < " .. BoundsMaxX .. " AND MaxX > " .. BoundsMinX .. " AND " ..
+ "MinZ < " .. BoundsMaxZ .. " AND MaxZ > " .. BoundsMinZ .. " AND " ..
+ "WorldName = '" .. lcWorldName .."'";
+
+ local function AddAreas(UserData, NumValues, Values, Names)
+ if ((NumValues < 5) or ((Values[1] and Values[2] and Values[3] and Values[4] and Values[5]) == nil)) then
+ LOGWARNING("SQL query didn't return all data");
+ return 0;
+ end
+ res:AddArea(cCuboid(Values[2], 0, Values[4], Values[3], 255, Values[5]), self:IsAreaAllowed(Values[1], a_PlayerName, a_WorldName));
+ return 0;
+ end
+
+ if (not(self:DBExec(sql, AddAreas))) then
+ LOGWARNING("SQL error while querying areas");
+ return res;
+ end
+
+ return res;
+end
+
+
+
+
+
+--- Adds a new area into the DB. a_AllowedNames is a table listing all the players that are allowed in the area
+-- Returns the ID of the new area, or -1 on failure
+function cStorage:AddArea(a_Cuboid, a_WorldName, a_CreatorName, a_AllowedNames)
+ assert(a_Cuboid);
+ assert(a_WorldName);
+ assert(a_CreatorName);
+ assert(a_AllowedNames);
+ assert(self);
+
+ -- Store the area in the DB
+ local ID = -1;
+ local function RememberID(UserData, NumCols, Values, Names)
+ for i = 1, NumCols do
+ if (Names[i] == "ID") then
+ ID = Values[i];
+ end
+ end
+ return 0;
+ end
+ local lcWorldName = string.lower(a_WorldName);
+ local lcCreatorName = string.lower(a_CreatorName);
+ local sql =
+ "INSERT INTO Areas (ID, MinX, MaxX, MinZ, MaxZ, WorldName, CreatorUserName) VALUES (NULL, " ..
+ a_Cuboid.p1.x .. ", " .. a_Cuboid.p2.x .. ", " .. a_Cuboid.p1.z .. ", " .. a_Cuboid.p2.z ..
+ ", '" .. lcWorldName .. "', '" .. lcCreatorName ..
+ "'); SELECT last_insert_rowid() AS ID";
+ if (not(self:DBExec(sql, RememberID))) then
+ LOGWARNING(PluginPrefix .. "SQL Error while inserting new area");
+ return -1;
+ end
+ if (ID == -1) then
+ LOGWARNING(PluginPrefix .. "SQL Error while retrieving INSERTion ID");
+ return -1;
+ end
+
+ -- Store each allowed player in the DB
+ for idx, Name in ipairs(a_AllowedNames) do
+ local lcName = string.lower(Name);
+ local sql = "INSERT INTO AllowedUsers (AreaID, UserName) VALUES (" .. ID .. ", '" .. lcName .. "')";
+ if (not(self:DBExec(sql))) then
+ LOGWARNING(PluginPrefix .. "SQL Error while inserting new area's allowed player " .. Name);
+ end
+ end
+ return ID;
+end
+
+
+
+
+
+function cStorage:DelArea(a_WorldName, a_AreaID)
+ assert(a_WorldName);
+ assert(a_AreaID);
+ assert(self);
+
+ -- Since all areas are stored in a single DB (for now), the worldname parameter isn't used at all
+ -- Later if we change to a per-world DB, we'll need the world name
+
+ -- Delete from both tables simultaneously
+ local sql =
+ "DELETE FROM Areas WHERE ID = " .. a_AreaID .. ";" ..
+ "DELETE FROM AllowedUsers WHERE AreaID = " .. a_AreaID;
+ if (not(self:DBExec(sql))) then
+ LOGWARNING(PluginPrefix .. "SQL error while deleting area " .. a_AreaID .. " from world \"" .. a_WorldName .. "\"");
+ return false;
+ end
+
+ return true;
+end
+
+
+
+
+
+--- Removes the user from the specified area
+function cStorage:RemoveUser(a_AreaID, a_UserName, a_WorldName)
+ assert(a_AreaID);
+ assert(a_UserName);
+ assert(a_WorldName);
+ assert(self);
+
+ -- WorldName is not used yet, because all the worlds share the same DB in this version
+
+ local lcUserName = string.lower(a_UserName);
+ local sql = "DELETE FROM AllowedUsers WHERE " ..
+ "AreaID = " .. a_AreaID .. " AND UserName = '" .. lcUserName .. "'";
+ if (not(self:DBExec(sql))) then
+ LOGWARNING("SQL error while removing user " .. a_UserName .. " from area ID " .. a_AreaID);
+ return false;
+ end
+ return true;
+end
+
+
+
+
+
+--- Removes the user from all areas in the specified world
+function cStorage:RemoveUserAll(a_UserName, a_WorldName)
+ assert(a_UserName);
+ assert(a_WorldName);
+ assert(self);
+
+ local lcUserName = string.lower(a_UserName);
+ local sql = "DELETE FROM AllowedUsers WHERE UserName = '" .. lcUserName .."'";
+ if (not(self:DBExec(sql))) then
+ LOGWARNING("SQL error while removing user " .. a_UserName .. " from all areas");
+ return false;
+ end
+ return true;
+end
+
+
+
+
+
+--- Calls the callback for each area intersecting the specified coords
+-- Callback signature: function(ID, MinX, MinZ, MaxX, MaxZ, CreatorName)
+function cStorage:ForEachArea(a_BlockX, a_BlockZ, a_WorldName, a_Callback)
+ assert(a_BlockX);
+ assert(a_BlockZ);
+ assert(a_WorldName);
+ assert(a_Callback);
+ assert(self);
+
+ -- SQL callback that parses the values and calls our callback
+ function CallCallback(UserData, NumValues, Values, Names)
+ if (NumValues ~= 6) then
+ -- Not enough values returned, skip this row
+ return 0;
+ end
+ local ID = Values[1];
+ local MinX = Values[2];
+ local MinZ = Values[3];
+ local MaxX = Values[4];
+ local MaxZ = Values[5];
+ local CreatorName = Values[6];
+ a_Callback(ID, MinX, MinZ, MaxX, MaxZ, CreatorName);
+ return 0;
+ end
+
+ local lcWorldName = string.lower(a_WorldName);
+ local sql = "SELECT ID, MinX, MinZ, MaxX, MaxZ, CreatorUserName FROM Areas WHERE " ..
+ "MinX <= " .. a_BlockX .. " AND MaxX >= " .. a_BlockX .. " AND " ..
+ "MinZ <= " .. a_BlockZ .. " AND MaxZ >= " .. a_BlockZ .. " AND " ..
+ "WorldName = '" .. lcWorldName .. "'";
+ if (not(self:DBExec(sql, CallCallback))) then
+ LOGWARNING("SQL Error while iterating through areas (cStorage:ForEachArea())");
+ return false;
+ end
+ return true;
+end
+
+
+
+
+
+--- Returns the info on the specified area
+-- Returns MinX, MinZ, MaxX, MaxZ, CreatorName on success, or nothing on failure
+function cStorage:GetArea(a_AreaID, a_WorldName)
+ assert(a_AreaID);
+ assert(a_WorldName);
+ assert(self);
+
+ local MinX, MinZ, MaxX, MaxZ, CreatorName;
+ local HasValues = false;
+
+ -- SQL callback that parses the values and remembers them in variables
+ function RememberValues(UserData, NumValues, Values, Names)
+ if (NumValues ~= 5) then
+ -- Not enough values returned, skip this row
+ return 0;
+ end
+ MinX = Values[1];
+ MinZ = Values[2];
+ MaxX = Values[3];
+ MaxZ = Values[4];
+ CreatorName = Values[5];
+ HasValues = true;
+ return 0;
+ end
+
+ local lcWorldName = string.lower(a_WorldName);
+ local sql = "SELECT MinX, MinZ, MaxX, MaxZ, CreatorUserName FROM Areas WHERE " ..
+ "ID = " .. a_AreaID .. " AND WorldName = '" .. lcWorldName .. "'";
+ if (not(self:DBExec(sql, RememberValues))) then
+ LOGWARNING("SQL Error while getting area info (cStorage:ForEachArea())");
+ return;
+ end
+
+ -- If no data has been retrieved, return nothing
+ if (not(HasValues)) then
+ return;
+ end
+
+ return MinX, MinZ, MaxX, MaxZ, CreatorName;
+end
+
+
+
+
+
+--- Calls the callback for each allowed user for the specified area
+-- Callback signature: function(UserName)
+function cStorage:ForEachUserInArea(a_AreaID, a_WorldName, a_Callback)
+ assert(a_AreaID);
+ assert(a_WorldName);
+ assert(a_Callback);
+ assert(self);
+
+ -- Since in this version all the worlds share a single DB, the a_WorldName parameter is not actually used
+ -- But this may change in the future, when we have a per-world DB
+
+ local function CallCallback(UserData, NumValues, Values)
+ if (NumValues ~= 1) then
+ return 0;
+ end
+ a_Callback(Values[1]);
+ return 0;
+ end
+ local sql = "SELECT UserName FROM AllowedUsers WHERE AreaID = " .. a_AreaID;
+ if (not(self:DBExec(sql, CallCallback))) then
+ LOGWARNING("SQL error while iterating area users for AreaID" .. a_AreaID);
+ return false;
+ end
+ return true;
+end
+
+
+
+
+
+--- Adds the specified usernames to the specified area, if not already present
+-- a_Users is an array table of usernames to add
+function cStorage:AddAreaUsers(a_AreaID, a_WorldName, a_AddedBy, a_Users)
+ assert(a_AreaID);
+ assert(a_WorldName);
+ assert(a_Users);
+ assert(self);
+
+ -- Convert all usernames to lowercase
+ for idx, Name in ipairs(a_Users) do
+ a_Users[idx] = string.lower(Name);
+ end
+
+ -- Remove from a_Users the usernames already present in the area
+ local sql = "SELECT UserName FROM AllowedUsers WHERE AreaID = " .. a_AreaID;
+ local function RemovePresent(UserData, NumValues, Values, Names)
+ if (NumValues ~= 1) then
+ -- Invalid response format
+ return 0;
+ end
+ local DBName = Values[1];
+ -- Remove the name from a_Users, if exists
+ for idx, Name in ipairs(a_Users) do
+ if (Name == DBName) then
+ table.remove(a_Users, idx);
+ return 0;
+ end
+ end
+ return 0;
+ end
+ if (not(self:DBExec(sql, RemovePresent))) then
+ LOGWARNING("SQL error while iterating through users");
+ return false;
+ end
+
+ -- Add the users
+ for idx, Name in ipairs(a_Users) do
+ local sql = "INSERT INTO AllowedUsers (AreaID, UserName) VALUES (" .. a_AreaID .. ", '" .. Name .. "')";
+ if (not(self:DBExec(sql))) then
+ LOGWARNING("SQL error while adding user " .. Name .. " to area " .. a_AreaID);
+ end
+ end
+
+ return true;
+end
+
+
+
+
+
diff --git a/MCServer/Plugins/SquirrelChatLog.nut b/MCServer/Plugins/SquirrelChatLog.nut
index 4ef0fd595..d90cef126 100644
--- a/MCServer/Plugins/SquirrelChatLog.nut
+++ b/MCServer/Plugins/SquirrelChatLog.nut
@@ -1,13 +1,13 @@
-class SquirrelChatLog extends Plugin
-{
- function Initialize()
- {
- this.AddHook(Hook.Chat);
- return true;
- }
-
- function OnChat(Message, Player)
- {
- ::print(Player.GetName() + ": " + Message);
- }
-}
+class SquirrelChatLog extends Plugin
+{
+ function Initialize()
+ {
+ this.AddHook(Hook.Chat);
+ return true;
+ }
+
+ function OnChat(Message, Player)
+ {
+ ::print(Player.GetName() + ": " + Message);
+ }
+}
diff --git a/MCServer/crafting.txt b/MCServer/crafting.txt
index 9e044dbec..41672ddda 100644
--- a/MCServer/crafting.txt
+++ b/MCServer/crafting.txt
@@ -1,392 +1,392 @@
-
-# This file describes the crafting recipes that MCServer knows.
-# The syntax is as follows:
-# <Line> = <Recipe>#<Comment>
-# <Recipe> = <Result> = <Ingredient1> | <Ingredient2> | ... | <IngredientN>
-# <IngredientN> = <ItemID>, <X1> : <Y1>, <X2> : <Y2>, ..., <Xn> : <Yn>
-# <ItemID> = <ItemType> [^<DamageValue>]
-# <Xn>, <Yn> = "1" .. "3", or "*" for any value. "*:*" can be replaced by a single "*".
-# <Result> = <ItemType> [^<DamageValue>] [, <Count>]
-#
-# The Xn, Yn coordinates are a reference to the crafting grid:
-# 1:1 | 2:1 | 3:1
-# 1:2 | 2:2 | 3:2
-# 1:3 | 2:3 | 3:3
-#
-# <ItemType> can be either a number, or an item name (checked against items.ini)
-#
-# ^<DamageValue> is optional, if not present, any damage value is matched for ingredients and zero is produced for the result
-#
-# Ingredients with an asterisk for a coord will not match already matched crafting grid items. This enables simplifying some of the recipes,
-# e. g. hoe: "Iron, 2:1, *:1"
-# -- this means "one iron at 2:1, and another one at either 1:1 or 3:1"
-#
-# To require multiple items of the same type in a slot, specify the slot number several times:
-# "Iron, 1:1, 2:2, 2:2"
-# -- this means "take one iron from slot 1:1 and two irons from slot 2:2"
-# Note that asterisked items cannot require multiple items in a single slot.
-#
-# Note that due to technical problems, it is NOT advised to use asterisked ingredients in crossing directions, such as "*:1, "2:*".
-# The parser may be unable to match such a recipe to the crafting grid!
-#
-# Whitespace is optional. Use it reasonably. Please do NOT use Tabs in the middle of lines!
-
-
-
-
-
-#******************************************************#
-# Basic Crafts
-#
-
-# Need to list each of the four log types, otherwise all logs would get converted into apple planks (^0)
-ApplePlanks, 4 = AppleLog, *
-ConiferPlanks, 4 = ConiferLog, *
-BirchPlanks, 4 = BirchLog, *
-JunglePlanks, 4 = JungleLog, *
-Stick, 4 = Planks, 2:2, 2:3
-Torch, 4 = Stick, 1:2 | Coal, 1:1
-Workbench = Planks, 1:1, 1:2, 2:1, 2:2
-Chest = Planks, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3
-TrappedChest = TripWireHook, 1:1 | Chest, 2:1
-EnderChest = EyeOfEnder, 2:2 | Obsidian, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3
-Furnace = Cobblestone, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3
-
-
-
-
-
-#******************************************************#
-# Blocks
-#
-IronBlock = IronIngot, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
-GoldBlock = GoldIngot, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
-DiamondBlock = Diamond, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
-LapisBlock = LapisLazuli, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
-EmeraldBlock = Emerald, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
-RedstoneBlock = RedstoneDust, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
-QuartzBlock = NetherQuartz, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
-NetherBrick = netherbrickitem, 1:1, 1:2, 2:1, 2:2
-Glowstone = GlowstoneDust, 1:1, 1:2, 2:1, 2:2
-Wool = String, 1:1, 1:2, 2:1, 2:2
-TNT = Gunpowder, 1:1, 3:1, 2:2, 1:3, 3:3 | Sand, 2:1, 1:2, 3:2, 2:3
-PillarQuartzBlock = QuartzSlab, 1:1, 1:2
-ChiseledQuartzBlock, 2 = QuartzBlock, 1:1, 1:2
-
-# Slabs:
-StoneSlab, 6 = Stone, 1:1, 2:1, 3:1
-SandstoneSlab, 6 = Sandstone, 1:1, 2:1, 3:1
-WoodSlab, 6 = Planks, 1:1, 2:1, 3:1
-CobblestoneSlab, 6 = Cobblestone, 1:1, 2:1, 3:1
-BrickSlab, 6 = BrickBlock, 1:1, 2:1, 3:1
-StonebrickSlab, 6 = StoneBrick, 1:1, 2:1, 3:1
-NetherbrickSlab, 6 = NetherBrick, 1:1, 2:1, 3:1
-Quartzslab, 6 = QuartzBlock, 1:1, 2:1, 3:1
-snow, 6 = SnowBlock, 1:1, 2:1, 3:1
-
-# Stairs:
-WoodStairs, 4 = Planks, 1:1, 1:2, 2:2, 1:3, 2:3, 3:3
-WoodStairs, 4 = Planks, 3:1, 2:2, 3:2, 1:3, 2:3, 3:3
-cobblestoneStairs, 4 = Cobblestone, 1:1, 1:2, 2:2, 1:3, 2:3, 3:3
-cobblestoneStairs, 4 = Cobblestone, 3:1, 2:2, 3:2, 1:3, 2:3, 3:3
-BrickStairs, 4 = BrickBlock, 1:1, 1:2, 2:2, 1:3, 2:3, 3:3
-BrickStairs, 4 = BrickBlock, 3:1, 2:2, 3:2, 1:3, 2:3, 3:3
-SandstoneStairs, 4 = Sandstone, 1:1, 1:2, 2:2, 1:3, 2:3, 3:3
-SandstoneStairs, 4 = Sandstone, 3:1, 2:2, 3:2, 1:3, 2:3, 3:3
-NetherBrickStairs, 4 = NetherBrick, 1:1, 1:2, 2:2, 1:3, 2:3, 3:3
-quartzstairs, 4 = QuartzBlock, 1:1, 1:2, 2:2, 1:3, 2:3, 3:3
-SnowBlock = SnowBall, 1:1, 1:2, 2:1, 2:2
-ClayBlock = Clay, 1:1, 1:2, 2:1, 2:2
-BrickBlock = Brick, 1:1, 1:2, 2:1, 2:2
-StoneBrick, 4 = Stone, 1:1, 1:2, 2:1, 2:2
-BookShelf = Planks, 1:1, 2:1, 3:1, 1:3, 2:3, 3:3 | Book, 1:2, 2:2, 3:2
-Sandstone, 4 = Sand, 1:1, 1:2, 2:1, 2:2
-SmoothSandstone, 4 = Sandstone, 1:1, 1:2, 2:1, 2:2
-OrnamentSandstone = SandstoneSlab, 1:1, 1:2
-JackOLantern = Pumpkin, 1:1 | Torch, 1:2
-
-
-
-
-
-#******************************************************#
-# Tools
-#
-
-# Axes:
-WoodenAxe = Stick, 2:2, 2:3 | Planks, 2:1, 1:1, 1:2
-WoodenAxe = Stick, 2:2, 2:3 | Planks, 2:1, 3:1, 3:2
-StoneAxe = Stick, 2:2, 2:3 | Cobblestone, 2:1, 1:1, 1:2
-StoneAxe = Stick, 2:2, 2:3 | Cobblestone, 2:1, 3:1, 3:2
-GoldenAxe = Stick, 2:2, 2:3 | GoldIngot, 2:1, 1:1, 1:2
-GoldenAxe = Stick, 2:2, 2:3 | GoldIngot, 2:1, 3:1, 3:2
-IronAxe = Stick, 2:2, 2:3 | IronIngot, 2:1, 1:1, 1:2
-IronAxe = Stick, 2:2, 2:3 | IronIngot, 2:1, 3:1, 3:2
-DiamondAxe = Stick, 2:2, 2:3 | Diamond, 2:1, 1:1, 1:2
-DiamondAxe = Stick, 2:2, 2:3 | Diamond, 2:1, 3:1, 3:2
-
-# Pickaxes:
-WoodenPickaxe = Stick, 2:2, 2:3 | Planks, 1:1, 2:1, 3:1
-StonePickaxe = Stick, 2:2, 2:3 | Cobblestone, 1:1, 2:1, 3:1
-GoldenPickaxe = Stick, 2:2, 2:3 | GoldIngot, 1:1, 2:1, 3:1
-IronPickaxe = Stick, 2:2, 2:3 | IronIngot, 1:1, 2:1, 3:1
-DiamondPickaxe = Stick, 2:2, 2:3 | Diamond, 1:1, 2:1, 3:1
-
-# Shovels:
-WoodenShovel = Stick, 2:2, 2:3 | Planks, 2:1
-StoneShovel = Stick, 2:2, 2:3 | Cobblestone, 2:1
-GoldenShovel = Stick, 2:2, 2:3 | GoldIngot, 2:1
-IronShovel = Stick, 2:2, 2:3 | IronIngot, 2:1
-DiamondShovel = Stick, 2:2, 2:3 | Diamond, 2:1
-
-# Hoes:
-WoodenHoe = Stick, 2:2, 2:3 | Planks, 2:1, *:1
-StoneHoe = Stick, 2:2, 2:3 | Cobblestone, 2:1, *:1
-GoldenHoe = Stick, 2:2, 2:3 | GoldIngot, 2:1, *:1
-IronHoe = Stick, 2:2, 2:3 | IronIngot, 2:1, *:1
-DiamondHoe = Stick, 2:2, 2:3 | Diamond, 2:1, *:1
-
-Lighter = IronIngot, 1:1 | Flint, 2:2
-Lighter = IronIngot, 2:1 | Flint, 1:2
-Bucket = IronIngot, 1:1, 2:2, 3:1
-Compass = IronIngot, 2:1, 1:2, 3:2, 2:3 | RedstoneDust, 2:2
-Map = Paper, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | Compass, 2:2
-Watch = GoldIngot, 2:1, 1:2, 3:2, 2:3 | RedstoneDust, 2:2
-FishingRod = Stick, 1:3, 2:2, 3:1 | String, 3:2, 3:3
-FishingRod = Stick, 3:3, 2:2, 1:1 | String, 1:2, 1:3
-Shears = IronIngot, 1:1, 2:2
-Shears = IronIngot, 2:1, 1:2
-FireCharge = BlazePowder, * | Coal, * | Gunpowder, *
-
-
-
-
-
-#******************************************************#
-# Weapons
-#
-WoodenSword = Stick, 2:3 | Planks, 2:1, 2:2
-StoneSword = Stick, 2:3 | Cobblestone, 2:1, 2:2
-GoldenSword = Stick, 2:3 | GoldIngot, 2:1, 2:2
-IronSword = Stick, 2:3 | IronIngot, 2:1, 2:2
-DiamondSword = Stick, 2:3 | Diamond, 2:1, 2:2
-Bow = Stick, 2:1, 1:2, 2:3 | String, 3:1, 3:2, 3:3
-Bow = Stick, 2:1, 3:2, 2:3 | String, 1:1, 1:2, 1:3
-Arrow, 4 = Flint, 1:1 | Stick, 1:2 | Feather, 1:3
-
-
-
-
-
-
-#******************************************************#
-# Armor
-#
-
-# Helmets:
-LeatherHelmet = Leather, 1:1, 2:1, 3:1, 1:2, 3:2
-ChainmailHelmet = Fire, 1:1, 2:1, 3:1, 1:2, 3:2
-GoldenHelmet = GoldIngot, 1:1, 2:1, 3:1, 1:2, 3:2
-IronHelmet = IronIngot, 1:1, 2:1, 3:1, 1:2, 3:2
-DiamondHelmet = Diamond, 1:1, 2:1, 3:1, 1:2, 3:2
-
-# Chestplates:
-LeatherChestplate = Leather, 1:1, 3:1, 1:2, 2:2, 3:2, 1:3, 2:3, 3:3
-ChainmailChestplate = Fire, 1:1, 3:1, 1:2, 2:2, 3:2, 1:3, 2:3, 3:3
-GoldenChestplate = GoldIngot, 1:1, 3:1, 1:2, 2:2, 3:2, 1:3, 2:3, 3:3
-IronChestplate = IronIngot, 1:1, 3:1, 1:2, 2:2, 3:2, 1:3, 2:3, 3:3
-DiamondChestplate = Diamond, 1:1, 3:1, 1:2, 2:2, 3:2, 1:3, 2:3, 3:3
-
-# Leggins:
-LeatherPants = Leather, 1:1, 2:1, 3:1, 1:2, 3:2, 1:3, 3:3
-ChainmailPants = Fire, 1:1, 2:1, 3:1, 1:2, 3:2, 1:3, 3:3
-GoldenPants = GoldIngot, 1:1, 2:1, 3:1, 1:2, 3:2, 1:3, 3:3
-IronPants = IronIngot, 1:1, 2:1, 3:1, 1:2, 3:2, 1:3, 3:3
-DiamondPants = Diamond, 1:1, 2:1, 3:1, 1:2, 3:2, 1:3, 3:3
-
-# Boots:
-LeatherBoots = Leather, 1:1, 3:1, 1:2, 3:2
-ChainmailBoots = Fire, 1:1, 3:1, 1:2, 3:2
-GoldenBoots = GoldIngot, 1:1, 3:1, 1:2, 3:2
-IronBoots = IronIngot, 1:1, 3:1, 1:2, 3:2
-DiamondBoots = Diamond, 1:1, 3:1, 1:2, 3:2
-
-
-
-
-
-#******************************************************#
-# Transportation
-#
-CarrotOnAStick = FishingRod, 1:2 | Carrot, 2:3
-Minecart = IronIngot, 1:1, 3:1, 1:2, 2:2, 3:2
-PoweredMinecart = Minecart, * | Furnace, *
-StorageMinecart = Minecart, * | Chest, *
-TNTMinecart = Minecart, * | TNT, *
-hopperminecart = Minecart, * | Hopper, *
-Rails, 16 = IronIngot, 1:1, 3:1, 1:2, 3:2, 1:3, 3:3 | Stick, 2:2
-PoweredRail, 6 = GoldIngot, 1:1, 3:1, 1:2, 3:2, 1:3, 3:3 | Stick, 2:2 | RedstoneDust, 2:3
-DetectorRail, 6 = IronIngot, 1:1, 3:1, 1:2, 3:2, 1:3, 3:3 | StonePlate, 2:2 | RedstoneDust, 2:3
-Boat = Planks, 1:1, 3:1, 1:2, 2:2, 3:2
-ActivatorRail, 6 = IronIngot, 1:1, 1:2, 1:3, 3:1, 3:2, 3:3 | Stick, 2:1, 2:3 | RedstoneTorchon, 2:2
-
-
-
-
-#******************************************************#
-# Mechanisms
-#
-WoodenDoor = Planks, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3
-IronDoor = IronIngot, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3
-TrapDoor, 2 = Planks, 1:1, 2:1, 3:1, 1:2, 2:2, 3:2
-WoodPlate = Planks, 1:1, 2:1
-StonePlate = Stone, 1:1, 2:1
-StoneButton = Stone, 1:1
-WoodenButton = Planks, 1:1
-RedstoneTorchOn = Stick, 1:2 | RedstoneDust, 1:1
-Lever = Cobblestone, 1:2 | Stick, 1:1
-NoteBlock = Planks, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | RedstoneDust, 2:2
-Jukebox = Planks, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | Diamond, 2:2
-Dispenser = Cobblestone, 1:1, 1:2, 1:3, 2:1, 3:1, 3:2, 3:3 | RedstoneDust, 2:3 | Bow, 2:2
-Dropper = Cobblestone, 1:1, 2:1, 3:1, 1:2, 1:3, 3:2, 3:3 | Hopper, 2:2 | RedstoneDust, 2:3
-Repeater = Stone, 1:2, 2:2, 3:2 | RedstoneTorchOn, 1:1, 3:1 | RedstoneDust, 2:1
-Comparator = RedstoneTorchOn, 2:1, 1:2, 3:2 | NetherQuartz, 2:2 | Stone, 1:3, 2:3, 3:3
-DaylightSensor = Glass, 1:1, 2:1, 3:1 | NetherQuartz, 1:2, 2:2, 3:2 | Woodslab, 1:3, 2:3, 3:3
-Hopper = Ironbars, 1:1, 3:1, 1:2, 3:2, 2:3 | Chest, 2:2
-Piston = Planks, 1:1, 2:1, 3:1 | RedstoneDust, 2:3 | Cobblestone, 1:2, 3:2, 1:3, 3:3 | IronIngot, 2:2
-StickyPiston = Piston, * | SlimeBall, *
-RedstoneLamp = RedstoneDust, 2:1, 1:2, 3:2, 2:3 | Glowstone, 2:2
-tripwirehook, 2 = planks, 2:3 | stick, 2:2 | ironbar, 2:1
-
-
-
-
-
-#******************************************************#
-# Food
-#
-Bowl, 4 = Planks, 1:1, 2:2, 3:1
-MushroomStew = Bowl, * | BrownMushroom, * | RedMushroom, *
-Bread = Wheat, 1:1, 2:1, 3:1
-Sugar = Sugarcane, *
-Cake = MilkBucket, 1:1, 2:1, 3:1 | Sugar, 1:2, 3:2 | Egg, 2:2 | Wheat, 1:3, 2:3, 3:3
-Cookie = Wheat, *, * | CocoaBeans, *
-GoldenApple = RedApple, 2:2 | GoldNugget, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3
-EnchantedGoldenApple = RedApple, 2:2 | GoldBlock, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3
-Melon = MelonSlice, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
-MelonSeeds = MelonSlice, *
-PumpkinSeeds, 4 = Pumpkin, *
-PumpkinPie = Pumpkin, * | Sugar, * | egg, *
-
-
-
-
-
-#******************************************************#
-# Miscellaneous
-#
-
-# Minerals:
-IronIngot, 9 = IronBlock, *
-GoldIngot, 9 = GoldBlock, *
-Diamond, 9 = DiamondBlock, *
-LapisLazuli, 9 = LapisBlock, *
-Emerald, 9 = EmeraldBlock, *
-RedstoneDust, 9 = RedstoneBlock, *
-
-Painting = Stick, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | Wool, 2:2
-ItemFrame = Stick, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | Leather, 2:2
-Sign = Planks, 1:1, 2:1, 3:1, 1:2, 2:2, 3:2 | Stick, 2:3
-Ladder, 3 = Stick, 1:1, 3:1, 1:2, 2:2, 3:2, 1:3, 3:3
-GlassPane, 16 = Glass, 1:1, 2:1, 3:1, 1:2, 2:2, 3:2
-IronBars, 16 = IronIngot, 1:1, 2:1, 3:1, 1:2, 2:2, 3:2
-Paper, 3 = Sugarcane, 1:1, 2:1, 3:1
-Book = Paper, *, *, * | leather, *
-Bookandquill = Book, * | feather, * | inksac, *
-Fence, 2 = Stick, 1:1, 2:1, 3:1, 1:2, 2:2, 3:2
-Cobblestonewall, 6 = cobblestone, 1:2, 1:3, 2:2, 2:3, 3:2, 3:3
-mossycobblestonewall, 6 = mossycobblestone, 1:2, 1:3, 2:2, 2:3, 3:2, 3:3
-NetherBrickFence, 6 = NetherBrick, 1:1, 2:1, 3:1, 1:2, 2:2, 3:2
-FenceGate = Stick, 1:1, 1:2, 3:1, 3:2 | Planks, 2:1, 2:2
-Bed = Planks, 1:2, 2:2, 3:2 | Wool, 1:1, 2:1, 3:1
-GoldIngot = GoldNugget, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
-EyeOfEnder = EnderPearl, * | BlazePowder, *
-Beacon = Glass, 1:1, 1:2, 2:1, 3:1, 3:2 | Obsidian, 1:3, 2:3, 3:3 | NetherStar, 2:2
-Anvil = IronBlock, 1:1, 2:1, 3:1 | IronIngot, 2:2, 1:3, 2:3, 3:3
-FlowerPot = Brick, 1:2, 2:3, 3:2
-
-
-
-
-
-#******************************************************#
-# Dyes
-#
-
-WhiteDye, 3 = Bone, *
-RedDye, 2 = Rose, *
-YellowDye, 2 = Flower, *
-
-# Color mixing, duals:
-OrangeDye, 2 = YellowDye, * | RedDye, *
-CyanDye, 2 = GreenDye, * | BlueDye, *
-PurpleDye, 2 = RedDye, * | BlueDye, *
-GrayDye, 2 = BlackDye, * | WhiteDye, *
-LtBlueDye, 2 = BlueDye, * | WhiteDye, *
-PinkDye, 2 = RedDye, * | WhiteDye, *
-LimeDye, 2 = GreenDye, * | WhiteDye, *
-MagentaDye, 2 = PurpleDye, * | PinkDye, *
-LtGrayDye, 2 = GrayDye, * | WhiteDye, *
-
-# triplets:
-LtGrayDye, 3 = BlackDye, * | WhiteDye, *, *
-MagentaDye, 3 = BlueDye, * | PinkDye, * | RedDye, *
-
-# quads:
-MagentaDye, 4 = BlueDye, * | WhiteDye, * | RedDye, *, *
-
-
-
-
-
-#******************************************************#
-# Colored wool:
-#
-WhiteWool = Wool, * | BoneMeal, *
-OrangeWool = Wool, * | OrangeDye, *
-MagentaWool = Wool, * | MagentaDye, *
-LightBlueWool = Wool, * | LightBlueDye, *
-YellowWool = Wool, * | YellowDye, *
-LimeWool = Wool, * | LimeDye, *
-PinkWool = Wool, * | PinkDye, *
-GrayWool = Wool, * | GrayDye, *
-LightGrayWool = Wool, * | LightGrayDye, *
-CyanWool = Wool, * | CyanDye, *
-VioletWool = Wool, * | VioletDye, *
-BlueWool = Wool, * | BlueDye, *
-BrownWool = Wool, * | BrownDye, *
-GreenWool = Wool, * | GreenDye, *
-RedWool = Wool, * | RedDye, *
-BlackWool = Wool, * | BlackDye, *
-
-
-
-
-
-#******************************************************#
-# Enchantment & Brewing
-#
-GlassBottle, 3 = Glass, 1:1, 2:2, 3:1
-Cauldron = IronIngot, 1:1, 3:1, 1:2, 3:2, 1:3, 2:3, 3:3
-BrewingStand = Cobblestone, 1:2, 2:2, 3:2 | BlazeRod, 2:1
-BlazePowder, 2 = BlazeRod, *
-MagmaCream = SlimeBall, * | BlazePowder, *
-FermentedSpiderEye = SpiderEye, * | Sugar, * | BrownMushroom, *
-GlisteringMelon = MelonSlice, * | GoldNugget, *
-GoldNugget, 9 = GoldIngot, *
-EnchantmentTable = Obsidian, 1:3, 2:3, 3:3, 2:2 | Diamond, 1:2, 3:2 | Book, 2:1
-
-
-
-
-
+
+# This file describes the crafting recipes that MCServer knows.
+# The syntax is as follows:
+# <Line> = <Recipe>#<Comment>
+# <Recipe> = <Result> = <Ingredient1> | <Ingredient2> | ... | <IngredientN>
+# <IngredientN> = <ItemID>, <X1> : <Y1>, <X2> : <Y2>, ..., <Xn> : <Yn>
+# <ItemID> = <ItemType> [^<DamageValue>]
+# <Xn>, <Yn> = "1" .. "3", or "*" for any value. "*:*" can be replaced by a single "*".
+# <Result> = <ItemType> [^<DamageValue>] [, <Count>]
+#
+# The Xn, Yn coordinates are a reference to the crafting grid:
+# 1:1 | 2:1 | 3:1
+# 1:2 | 2:2 | 3:2
+# 1:3 | 2:3 | 3:3
+#
+# <ItemType> can be either a number, or an item name (checked against items.ini)
+#
+# ^<DamageValue> is optional, if not present, any damage value is matched for ingredients and zero is produced for the result
+#
+# Ingredients with an asterisk for a coord will not match already matched crafting grid items. This enables simplifying some of the recipes,
+# e. g. hoe: "Iron, 2:1, *:1"
+# -- this means "one iron at 2:1, and another one at either 1:1 or 3:1"
+#
+# To require multiple items of the same type in a slot, specify the slot number several times:
+# "Iron, 1:1, 2:2, 2:2"
+# -- this means "take one iron from slot 1:1 and two irons from slot 2:2"
+# Note that asterisked items cannot require multiple items in a single slot.
+#
+# Note that due to technical problems, it is NOT advised to use asterisked ingredients in crossing directions, such as "*:1, "2:*".
+# The parser may be unable to match such a recipe to the crafting grid!
+#
+# Whitespace is optional. Use it reasonably. Please do NOT use Tabs in the middle of lines!
+
+
+
+
+
+#******************************************************#
+# Basic Crafts
+#
+
+# Need to list each of the four log types, otherwise all logs would get converted into apple planks (^0)
+ApplePlanks, 4 = AppleLog, *
+ConiferPlanks, 4 = ConiferLog, *
+BirchPlanks, 4 = BirchLog, *
+JunglePlanks, 4 = JungleLog, *
+Stick, 4 = Planks, 2:2, 2:3
+Torch, 4 = Stick, 1:2 | Coal, 1:1
+Workbench = Planks, 1:1, 1:2, 2:1, 2:2
+Chest = Planks, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3
+TrappedChest = TripWireHook, 1:1 | Chest, 2:1
+EnderChest = EyeOfEnder, 2:2 | Obsidian, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3
+Furnace = Cobblestone, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3
+
+
+
+
+
+#******************************************************#
+# Blocks
+#
+IronBlock = IronIngot, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
+GoldBlock = GoldIngot, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
+DiamondBlock = Diamond, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
+LapisBlock = LapisLazuli, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
+EmeraldBlock = Emerald, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
+RedstoneBlock = RedstoneDust, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
+QuartzBlock = NetherQuartz, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
+NetherBrick = netherbrickitem, 1:1, 1:2, 2:1, 2:2
+Glowstone = GlowstoneDust, 1:1, 1:2, 2:1, 2:2
+Wool = String, 1:1, 1:2, 2:1, 2:2
+TNT = Gunpowder, 1:1, 3:1, 2:2, 1:3, 3:3 | Sand, 2:1, 1:2, 3:2, 2:3
+PillarQuartzBlock = QuartzSlab, 1:1, 1:2
+ChiseledQuartzBlock, 2 = QuartzBlock, 1:1, 1:2
+
+# Slabs:
+StoneSlab, 6 = Stone, 1:1, 2:1, 3:1
+SandstoneSlab, 6 = Sandstone, 1:1, 2:1, 3:1
+WoodSlab, 6 = Planks, 1:1, 2:1, 3:1
+CobblestoneSlab, 6 = Cobblestone, 1:1, 2:1, 3:1
+BrickSlab, 6 = BrickBlock, 1:1, 2:1, 3:1
+StonebrickSlab, 6 = StoneBrick, 1:1, 2:1, 3:1
+NetherbrickSlab, 6 = NetherBrick, 1:1, 2:1, 3:1
+Quartzslab, 6 = QuartzBlock, 1:1, 2:1, 3:1
+snow, 6 = SnowBlock, 1:1, 2:1, 3:1
+
+# Stairs:
+WoodStairs, 4 = Planks, 1:1, 1:2, 2:2, 1:3, 2:3, 3:3
+WoodStairs, 4 = Planks, 3:1, 2:2, 3:2, 1:3, 2:3, 3:3
+cobblestoneStairs, 4 = Cobblestone, 1:1, 1:2, 2:2, 1:3, 2:3, 3:3
+cobblestoneStairs, 4 = Cobblestone, 3:1, 2:2, 3:2, 1:3, 2:3, 3:3
+BrickStairs, 4 = BrickBlock, 1:1, 1:2, 2:2, 1:3, 2:3, 3:3
+BrickStairs, 4 = BrickBlock, 3:1, 2:2, 3:2, 1:3, 2:3, 3:3
+SandstoneStairs, 4 = Sandstone, 1:1, 1:2, 2:2, 1:3, 2:3, 3:3
+SandstoneStairs, 4 = Sandstone, 3:1, 2:2, 3:2, 1:3, 2:3, 3:3
+NetherBrickStairs, 4 = NetherBrick, 1:1, 1:2, 2:2, 1:3, 2:3, 3:3
+quartzstairs, 4 = QuartzBlock, 1:1, 1:2, 2:2, 1:3, 2:3, 3:3
+SnowBlock = SnowBall, 1:1, 1:2, 2:1, 2:2
+ClayBlock = Clay, 1:1, 1:2, 2:1, 2:2
+BrickBlock = Brick, 1:1, 1:2, 2:1, 2:2
+StoneBrick, 4 = Stone, 1:1, 1:2, 2:1, 2:2
+BookShelf = Planks, 1:1, 2:1, 3:1, 1:3, 2:3, 3:3 | Book, 1:2, 2:2, 3:2
+Sandstone, 4 = Sand, 1:1, 1:2, 2:1, 2:2
+SmoothSandstone, 4 = Sandstone, 1:1, 1:2, 2:1, 2:2
+OrnamentSandstone = SandstoneSlab, 1:1, 1:2
+JackOLantern = Pumpkin, 1:1 | Torch, 1:2
+
+
+
+
+
+#******************************************************#
+# Tools
+#
+
+# Axes:
+WoodenAxe = Stick, 2:2, 2:3 | Planks, 2:1, 1:1, 1:2
+WoodenAxe = Stick, 2:2, 2:3 | Planks, 2:1, 3:1, 3:2
+StoneAxe = Stick, 2:2, 2:3 | Cobblestone, 2:1, 1:1, 1:2
+StoneAxe = Stick, 2:2, 2:3 | Cobblestone, 2:1, 3:1, 3:2
+GoldenAxe = Stick, 2:2, 2:3 | GoldIngot, 2:1, 1:1, 1:2
+GoldenAxe = Stick, 2:2, 2:3 | GoldIngot, 2:1, 3:1, 3:2
+IronAxe = Stick, 2:2, 2:3 | IronIngot, 2:1, 1:1, 1:2
+IronAxe = Stick, 2:2, 2:3 | IronIngot, 2:1, 3:1, 3:2
+DiamondAxe = Stick, 2:2, 2:3 | Diamond, 2:1, 1:1, 1:2
+DiamondAxe = Stick, 2:2, 2:3 | Diamond, 2:1, 3:1, 3:2
+
+# Pickaxes:
+WoodenPickaxe = Stick, 2:2, 2:3 | Planks, 1:1, 2:1, 3:1
+StonePickaxe = Stick, 2:2, 2:3 | Cobblestone, 1:1, 2:1, 3:1
+GoldenPickaxe = Stick, 2:2, 2:3 | GoldIngot, 1:1, 2:1, 3:1
+IronPickaxe = Stick, 2:2, 2:3 | IronIngot, 1:1, 2:1, 3:1
+DiamondPickaxe = Stick, 2:2, 2:3 | Diamond, 1:1, 2:1, 3:1
+
+# Shovels:
+WoodenShovel = Stick, 2:2, 2:3 | Planks, 2:1
+StoneShovel = Stick, 2:2, 2:3 | Cobblestone, 2:1
+GoldenShovel = Stick, 2:2, 2:3 | GoldIngot, 2:1
+IronShovel = Stick, 2:2, 2:3 | IronIngot, 2:1
+DiamondShovel = Stick, 2:2, 2:3 | Diamond, 2:1
+
+# Hoes:
+WoodenHoe = Stick, 2:2, 2:3 | Planks, 2:1, *:1
+StoneHoe = Stick, 2:2, 2:3 | Cobblestone, 2:1, *:1
+GoldenHoe = Stick, 2:2, 2:3 | GoldIngot, 2:1, *:1
+IronHoe = Stick, 2:2, 2:3 | IronIngot, 2:1, *:1
+DiamondHoe = Stick, 2:2, 2:3 | Diamond, 2:1, *:1
+
+Lighter = IronIngot, 1:1 | Flint, 2:2
+Lighter = IronIngot, 2:1 | Flint, 1:2
+Bucket = IronIngot, 1:1, 2:2, 3:1
+Compass = IronIngot, 2:1, 1:2, 3:2, 2:3 | RedstoneDust, 2:2
+Map = Paper, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | Compass, 2:2
+Watch = GoldIngot, 2:1, 1:2, 3:2, 2:3 | RedstoneDust, 2:2
+FishingRod = Stick, 1:3, 2:2, 3:1 | String, 3:2, 3:3
+FishingRod = Stick, 3:3, 2:2, 1:1 | String, 1:2, 1:3
+Shears = IronIngot, 1:1, 2:2
+Shears = IronIngot, 2:1, 1:2
+FireCharge = BlazePowder, * | Coal, * | Gunpowder, *
+
+
+
+
+
+#******************************************************#
+# Weapons
+#
+WoodenSword = Stick, 2:3 | Planks, 2:1, 2:2
+StoneSword = Stick, 2:3 | Cobblestone, 2:1, 2:2
+GoldenSword = Stick, 2:3 | GoldIngot, 2:1, 2:2
+IronSword = Stick, 2:3 | IronIngot, 2:1, 2:2
+DiamondSword = Stick, 2:3 | Diamond, 2:1, 2:2
+Bow = Stick, 2:1, 1:2, 2:3 | String, 3:1, 3:2, 3:3
+Bow = Stick, 2:1, 3:2, 2:3 | String, 1:1, 1:2, 1:3
+Arrow, 4 = Flint, 1:1 | Stick, 1:2 | Feather, 1:3
+
+
+
+
+
+
+#******************************************************#
+# Armor
+#
+
+# Helmets:
+LeatherHelmet = Leather, 1:1, 2:1, 3:1, 1:2, 3:2
+ChainmailHelmet = Fire, 1:1, 2:1, 3:1, 1:2, 3:2
+GoldenHelmet = GoldIngot, 1:1, 2:1, 3:1, 1:2, 3:2
+IronHelmet = IronIngot, 1:1, 2:1, 3:1, 1:2, 3:2
+DiamondHelmet = Diamond, 1:1, 2:1, 3:1, 1:2, 3:2
+
+# Chestplates:
+LeatherChestplate = Leather, 1:1, 3:1, 1:2, 2:2, 3:2, 1:3, 2:3, 3:3
+ChainmailChestplate = Fire, 1:1, 3:1, 1:2, 2:2, 3:2, 1:3, 2:3, 3:3
+GoldenChestplate = GoldIngot, 1:1, 3:1, 1:2, 2:2, 3:2, 1:3, 2:3, 3:3
+IronChestplate = IronIngot, 1:1, 3:1, 1:2, 2:2, 3:2, 1:3, 2:3, 3:3
+DiamondChestplate = Diamond, 1:1, 3:1, 1:2, 2:2, 3:2, 1:3, 2:3, 3:3
+
+# Leggins:
+LeatherPants = Leather, 1:1, 2:1, 3:1, 1:2, 3:2, 1:3, 3:3
+ChainmailPants = Fire, 1:1, 2:1, 3:1, 1:2, 3:2, 1:3, 3:3
+GoldenPants = GoldIngot, 1:1, 2:1, 3:1, 1:2, 3:2, 1:3, 3:3
+IronPants = IronIngot, 1:1, 2:1, 3:1, 1:2, 3:2, 1:3, 3:3
+DiamondPants = Diamond, 1:1, 2:1, 3:1, 1:2, 3:2, 1:3, 3:3
+
+# Boots:
+LeatherBoots = Leather, 1:1, 3:1, 1:2, 3:2
+ChainmailBoots = Fire, 1:1, 3:1, 1:2, 3:2
+GoldenBoots = GoldIngot, 1:1, 3:1, 1:2, 3:2
+IronBoots = IronIngot, 1:1, 3:1, 1:2, 3:2
+DiamondBoots = Diamond, 1:1, 3:1, 1:2, 3:2
+
+
+
+
+
+#******************************************************#
+# Transportation
+#
+CarrotOnAStick = FishingRod, 1:2 | Carrot, 2:3
+Minecart = IronIngot, 1:1, 3:1, 1:2, 2:2, 3:2
+PoweredMinecart = Minecart, * | Furnace, *
+StorageMinecart = Minecart, * | Chest, *
+TNTMinecart = Minecart, * | TNT, *
+hopperminecart = Minecart, * | Hopper, *
+Rails, 16 = IronIngot, 1:1, 3:1, 1:2, 3:2, 1:3, 3:3 | Stick, 2:2
+PoweredRail, 6 = GoldIngot, 1:1, 3:1, 1:2, 3:2, 1:3, 3:3 | Stick, 2:2 | RedstoneDust, 2:3
+DetectorRail, 6 = IronIngot, 1:1, 3:1, 1:2, 3:2, 1:3, 3:3 | StonePlate, 2:2 | RedstoneDust, 2:3
+Boat = Planks, 1:1, 3:1, 1:2, 2:2, 3:2
+ActivatorRail, 6 = IronIngot, 1:1, 1:2, 1:3, 3:1, 3:2, 3:3 | Stick, 2:1, 2:3 | RedstoneTorchon, 2:2
+
+
+
+
+#******************************************************#
+# Mechanisms
+#
+WoodenDoor = Planks, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3
+IronDoor = IronIngot, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3
+TrapDoor, 2 = Planks, 1:1, 2:1, 3:1, 1:2, 2:2, 3:2
+WoodPlate = Planks, 1:1, 2:1
+StonePlate = Stone, 1:1, 2:1
+StoneButton = Stone, 1:1
+WoodenButton = Planks, 1:1
+RedstoneTorchOn = Stick, 1:2 | RedstoneDust, 1:1
+Lever = Cobblestone, 1:2 | Stick, 1:1
+NoteBlock = Planks, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | RedstoneDust, 2:2
+Jukebox = Planks, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | Diamond, 2:2
+Dispenser = Cobblestone, 1:1, 1:2, 1:3, 2:1, 3:1, 3:2, 3:3 | RedstoneDust, 2:3 | Bow, 2:2
+Dropper = Cobblestone, 1:1, 2:1, 3:1, 1:2, 1:3, 3:2, 3:3 | Hopper, 2:2 | RedstoneDust, 2:3
+Repeater = Stone, 1:2, 2:2, 3:2 | RedstoneTorchOn, 1:1, 3:1 | RedstoneDust, 2:1
+Comparator = RedstoneTorchOn, 2:1, 1:2, 3:2 | NetherQuartz, 2:2 | Stone, 1:3, 2:3, 3:3
+DaylightSensor = Glass, 1:1, 2:1, 3:1 | NetherQuartz, 1:2, 2:2, 3:2 | Woodslab, 1:3, 2:3, 3:3
+Hopper = Ironbars, 1:1, 3:1, 1:2, 3:2, 2:3 | Chest, 2:2
+Piston = Planks, 1:1, 2:1, 3:1 | RedstoneDust, 2:3 | Cobblestone, 1:2, 3:2, 1:3, 3:3 | IronIngot, 2:2
+StickyPiston = Piston, * | SlimeBall, *
+RedstoneLamp = RedstoneDust, 2:1, 1:2, 3:2, 2:3 | Glowstone, 2:2
+tripwirehook, 2 = planks, 2:3 | stick, 2:2 | ironbar, 2:1
+
+
+
+
+
+#******************************************************#
+# Food
+#
+Bowl, 4 = Planks, 1:1, 2:2, 3:1
+MushroomStew = Bowl, * | BrownMushroom, * | RedMushroom, *
+Bread = Wheat, 1:1, 2:1, 3:1
+Sugar = Sugarcane, *
+Cake = MilkBucket, 1:1, 2:1, 3:1 | Sugar, 1:2, 3:2 | Egg, 2:2 | Wheat, 1:3, 2:3, 3:3
+Cookie = Wheat, *, * | CocoaBeans, *
+GoldenApple = RedApple, 2:2 | GoldNugget, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3
+EnchantedGoldenApple = RedApple, 2:2 | GoldBlock, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3
+Melon = MelonSlice, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
+MelonSeeds = MelonSlice, *
+PumpkinSeeds, 4 = Pumpkin, *
+PumpkinPie = Pumpkin, * | Sugar, * | egg, *
+
+
+
+
+
+#******************************************************#
+# Miscellaneous
+#
+
+# Minerals:
+IronIngot, 9 = IronBlock, *
+GoldIngot, 9 = GoldBlock, *
+Diamond, 9 = DiamondBlock, *
+LapisLazuli, 9 = LapisBlock, *
+Emerald, 9 = EmeraldBlock, *
+RedstoneDust, 9 = RedstoneBlock, *
+
+Painting = Stick, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | Wool, 2:2
+ItemFrame = Stick, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | Leather, 2:2
+Sign = Planks, 1:1, 2:1, 3:1, 1:2, 2:2, 3:2 | Stick, 2:3
+Ladder, 3 = Stick, 1:1, 3:1, 1:2, 2:2, 3:2, 1:3, 3:3
+GlassPane, 16 = Glass, 1:1, 2:1, 3:1, 1:2, 2:2, 3:2
+IronBars, 16 = IronIngot, 1:1, 2:1, 3:1, 1:2, 2:2, 3:2
+Paper, 3 = Sugarcane, 1:1, 2:1, 3:1
+Book = Paper, *, *, * | leather, *
+Bookandquill = Book, * | feather, * | inksac, *
+Fence, 2 = Stick, 1:1, 2:1, 3:1, 1:2, 2:2, 3:2
+Cobblestonewall, 6 = cobblestone, 1:2, 1:3, 2:2, 2:3, 3:2, 3:3
+mossycobblestonewall, 6 = mossycobblestone, 1:2, 1:3, 2:2, 2:3, 3:2, 3:3
+NetherBrickFence, 6 = NetherBrick, 1:1, 2:1, 3:1, 1:2, 2:2, 3:2
+FenceGate = Stick, 1:1, 1:2, 3:1, 3:2 | Planks, 2:1, 2:2
+Bed = Planks, 1:2, 2:2, 3:2 | Wool, 1:1, 2:1, 3:1
+GoldIngot = GoldNugget, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
+EyeOfEnder = EnderPearl, * | BlazePowder, *
+Beacon = Glass, 1:1, 1:2, 2:1, 3:1, 3:2 | Obsidian, 1:3, 2:3, 3:3 | NetherStar, 2:2
+Anvil = IronBlock, 1:1, 2:1, 3:1 | IronIngot, 2:2, 1:3, 2:3, 3:3
+FlowerPot = Brick, 1:2, 2:3, 3:2
+
+
+
+
+
+#******************************************************#
+# Dyes
+#
+
+WhiteDye, 3 = Bone, *
+RedDye, 2 = Rose, *
+YellowDye, 2 = Flower, *
+
+# Color mixing, duals:
+OrangeDye, 2 = YellowDye, * | RedDye, *
+CyanDye, 2 = GreenDye, * | BlueDye, *
+PurpleDye, 2 = RedDye, * | BlueDye, *
+GrayDye, 2 = BlackDye, * | WhiteDye, *
+LtBlueDye, 2 = BlueDye, * | WhiteDye, *
+PinkDye, 2 = RedDye, * | WhiteDye, *
+LimeDye, 2 = GreenDye, * | WhiteDye, *
+MagentaDye, 2 = PurpleDye, * | PinkDye, *
+LtGrayDye, 2 = GrayDye, * | WhiteDye, *
+
+# triplets:
+LtGrayDye, 3 = BlackDye, * | WhiteDye, *, *
+MagentaDye, 3 = BlueDye, * | PinkDye, * | RedDye, *
+
+# quads:
+MagentaDye, 4 = BlueDye, * | WhiteDye, * | RedDye, *, *
+
+
+
+
+
+#******************************************************#
+# Colored wool:
+#
+WhiteWool = Wool, * | BoneMeal, *
+OrangeWool = Wool, * | OrangeDye, *
+MagentaWool = Wool, * | MagentaDye, *
+LightBlueWool = Wool, * | LightBlueDye, *
+YellowWool = Wool, * | YellowDye, *
+LimeWool = Wool, * | LimeDye, *
+PinkWool = Wool, * | PinkDye, *
+GrayWool = Wool, * | GrayDye, *
+LightGrayWool = Wool, * | LightGrayDye, *
+CyanWool = Wool, * | CyanDye, *
+VioletWool = Wool, * | VioletDye, *
+BlueWool = Wool, * | BlueDye, *
+BrownWool = Wool, * | BrownDye, *
+GreenWool = Wool, * | GreenDye, *
+RedWool = Wool, * | RedDye, *
+BlackWool = Wool, * | BlackDye, *
+
+
+
+
+
+#******************************************************#
+# Enchantment & Brewing
+#
+GlassBottle, 3 = Glass, 1:1, 2:2, 3:1
+Cauldron = IronIngot, 1:1, 3:1, 1:2, 3:2, 1:3, 2:3, 3:3
+BrewingStand = Cobblestone, 1:2, 2:2, 3:2 | BlazeRod, 2:1
+BlazePowder, 2 = BlazeRod, *
+MagmaCream = SlimeBall, * | BlazePowder, *
+FermentedSpiderEye = SpiderEye, * | Sugar, * | BrownMushroom, *
+GlisteringMelon = MelonSlice, * | GoldNugget, *
+GoldNugget, 9 = GoldIngot, *
+EnchantmentTable = Obsidian, 1:3, 2:3, 3:3, 2:2 | Diamond, 1:2, 3:2 | Book, 2:1
+
+
+
+
+
diff --git a/MCServer/furnace.txt b/MCServer/furnace.txt
index b25c79ab7..e5d4ca70f 100644
--- a/MCServer/furnace.txt
+++ b/MCServer/furnace.txt
@@ -1,75 +1,75 @@
-#*****************#
-# Furnace Recipes #
-#*****************#
-#
-#
-#******************************************************#
-# Basic Notation Help
-#
-# **** Item Definition ****
-# An Item is defined by an Item Type, an amount (and damage)
-# The damage is optional, and if not specified it's assumed to be 0
-#
-# -Cactus Green:
-# 351 : 1 ( : 2 )
-# ItemType : Amount ( : Damage )
-#
-#
-# **** Recipe and result ****
-#
-# 4:1@200=1:1 -> Produces 1 smooth stone from 1 cobblestone in 200 ticks (10 seconds)
-#
-# 4 : 1 @ 200 = 1 : 1
-# ItemType : Amount @ ticks = ItemID : Amount
-#
-#
-# **** Fuel ****
-#
-# !17:1 = 300 -> 1 Wood burns for 300 ticks (15 s)
-#
-# ! 17 : 1 = 300
-# Fuel ItemType : Amount = ticks
-#
-#******************************************************#
-
-
-
-
-
-#--------------------------
-# Smelting recipes
-
-4:1 @ 200 = 1:1 # 1 Cobblestone -> 1 Rock
-15:1 @ 200 = 265:1 # 1 Iron Ore -> 1 Iron Ingot
-14:1 @ 200 = 266:1 # 1 Gold Ore -> 1 Gold Ingot
-153:1 @ 200 = 406:1 # 1 Quartz Ore -> 1 Quartz
-12:1 @ 200 = 20:1 # 1 Sand -> 1 Glass
-319:1 @ 200 = 320:1 # 1 Raw Pork -> 1 Cooked Pork
-363:1 @ 200 = 364:1 # 1 Raw Beef -> 1 Cooked Beef (steak)
-365:1 @ 200 = 366:1 # 1 Raw Chicken -> 1 Cooked Chicken
-337:1 @ 200 = 336:1 # 1 Clay -> 1 Clay Brick
-87:1 @ 200 = 405:1 # 1 NetherRack -> 1 NetherBrick
-349:1 @ 200 = 350:1 # 1 Raw Fish -> 1 Cooked Fish
-17:1 @ 200 = 263:1:1 # 1 Log -> 1 Charcoal
-81:1 @ 200 = 351:1:2 # 1 Cactus -> 1 Green Dye
-
-
-
-
-
-#--------------------------
-# Fuels
-
-! 263:1 = 1600 # 1 Charcoal -> 80 sec
-! 42:126:1 = 150 # 1 Halfslab -> 7.5 seconds
-! 5:1 = 300 # 1 Planks -> 15 sec
-! 280:1 = 100 # 1 Stick -> 5 sec
-! 85:1 = 300 # 1 Fence -> 15 sec
-! 53:1 = 300 # 1 Wooden Stairs -> 15 sec
-! 58:1 = 300 # 1 Crafting Table -> 15 sec
-! 47:1 = 300 # 1 Bookshelf -> 15 sec
-! 54:1 = 300 # 1 Chest -> 15 sec
-! 84:1 = 300 # 1 Jukebox -> 15 sec
-! 327:1 = 200000 # 1 Lava Bucket -> 1000 sec
-! 17:1 = 300 # 1 Wood -> 15 sec
-! 6:1 = 100 # 1 Sapling -> 5 sec
+#*****************#
+# Furnace Recipes #
+#*****************#
+#
+#
+#******************************************************#
+# Basic Notation Help
+#
+# **** Item Definition ****
+# An Item is defined by an Item Type, an amount (and damage)
+# The damage is optional, and if not specified it's assumed to be 0
+#
+# -Cactus Green:
+# 351 : 1 ( : 2 )
+# ItemType : Amount ( : Damage )
+#
+#
+# **** Recipe and result ****
+#
+# 4:1@200=1:1 -> Produces 1 smooth stone from 1 cobblestone in 200 ticks (10 seconds)
+#
+# 4 : 1 @ 200 = 1 : 1
+# ItemType : Amount @ ticks = ItemID : Amount
+#
+#
+# **** Fuel ****
+#
+# !17:1 = 300 -> 1 Wood burns for 300 ticks (15 s)
+#
+# ! 17 : 1 = 300
+# Fuel ItemType : Amount = ticks
+#
+#******************************************************#
+
+
+
+
+
+#--------------------------
+# Smelting recipes
+
+4:1 @ 200 = 1:1 # 1 Cobblestone -> 1 Rock
+15:1 @ 200 = 265:1 # 1 Iron Ore -> 1 Iron Ingot
+14:1 @ 200 = 266:1 # 1 Gold Ore -> 1 Gold Ingot
+153:1 @ 200 = 406:1 # 1 Quartz Ore -> 1 Quartz
+12:1 @ 200 = 20:1 # 1 Sand -> 1 Glass
+319:1 @ 200 = 320:1 # 1 Raw Pork -> 1 Cooked Pork
+363:1 @ 200 = 364:1 # 1 Raw Beef -> 1 Cooked Beef (steak)
+365:1 @ 200 = 366:1 # 1 Raw Chicken -> 1 Cooked Chicken
+337:1 @ 200 = 336:1 # 1 Clay -> 1 Clay Brick
+87:1 @ 200 = 405:1 # 1 NetherRack -> 1 NetherBrick
+349:1 @ 200 = 350:1 # 1 Raw Fish -> 1 Cooked Fish
+17:1 @ 200 = 263:1:1 # 1 Log -> 1 Charcoal
+81:1 @ 200 = 351:1:2 # 1 Cactus -> 1 Green Dye
+
+
+
+
+
+#--------------------------
+# Fuels
+
+! 263:1 = 1600 # 1 Charcoal -> 80 sec
+! 42:126:1 = 150 # 1 Halfslab -> 7.5 seconds
+! 5:1 = 300 # 1 Planks -> 15 sec
+! 280:1 = 100 # 1 Stick -> 5 sec
+! 85:1 = 300 # 1 Fence -> 15 sec
+! 53:1 = 300 # 1 Wooden Stairs -> 15 sec
+! 58:1 = 300 # 1 Crafting Table -> 15 sec
+! 47:1 = 300 # 1 Bookshelf -> 15 sec
+! 54:1 = 300 # 1 Chest -> 15 sec
+! 84:1 = 300 # 1 Jukebox -> 15 sec
+! 327:1 = 200000 # 1 Lava Bucket -> 1000 sec
+! 17:1 = 300 # 1 Wood -> 15 sec
+! 6:1 = 100 # 1 Sapling -> 5 sec
diff --git a/MCServer/groups.ini b/MCServer/groups.ini
index 7f061204b..87b28b70d 100644
--- a/MCServer/groups.ini
+++ b/MCServer/groups.ini
@@ -1,17 +1,17 @@
-[Admins]
-Permissions=*
-Color=c
-
-[Mods]
-Color=5
-Inherits=Vips
-Permissions=core.time,core.item
-
-[Vips]
-Permissions=core.teleport
-Color=2
-Inherits=Default
-
-[Default]
-Permissions=core.build,core.help,core.playerlist,core.pluginlist,core.spawn
+[Admins]
+Permissions=*
+Color=c
+
+[Mods]
+Color=5
+Inherits=Vips
+Permissions=core.time,core.item
+
+[Vips]
+Permissions=core.teleport
+Color=2
+Inherits=Default
+
+[Default]
+Permissions=core.build,core.help,core.playerlist,core.pluginlist,core.spawn
Color=7 \ No newline at end of file
diff --git a/MCServer/hg.supp b/MCServer/hg.supp
index 048f1382f..27eb8c27a 100644
--- a/MCServer/hg.supp
+++ b/MCServer/hg.supp
@@ -1,22 +1,22 @@
-# This is a valgrind suppressions file for running helgrind on MCServer
-# Use by adding "--suppressions=hg.supp" to the helgrind commandline
-
-
-
-
-
-
-# This covers GCC bug 40518, http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40518
-# "Erasing an empty string causes a global value write / race condition warning in helgrind"
-# Original suppression authored by Jonathan Wakely: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40518#c20
-# Modified by Mattes to match the mangled function name used on Ubuntu
-
-{
- libstdcxx_std_string_race_pr40518
- Helgrind:Race
- fun:_ZNSs9_M_mutateEjjj
-}
-
-
-
-
+# This is a valgrind suppressions file for running helgrind on MCServer
+# Use by adding "--suppressions=hg.supp" to the helgrind commandline
+
+
+
+
+
+
+# This covers GCC bug 40518, http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40518
+# "Erasing an empty string causes a global value write / race condition warning in helgrind"
+# Original suppression authored by Jonathan Wakely: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40518#c20
+# Modified by Mattes to match the mangled function name used on Ubuntu
+
+{
+ libstdcxx_std_string_race_pr40518
+ Helgrind:Race
+ fun:_ZNSs9_M_mutateEjjj
+}
+
+
+
+
diff --git a/MCServer/items.ini b/MCServer/items.ini
index ec518cb0a..c9bd6df53 100644
--- a/MCServer/items.ini
+++ b/MCServer/items.ini
@@ -1,543 +1,543 @@
-[Items]
-rock=1
-stone=1
-grass=2
-dirt=3
-cobblestone=4
-cobble=4
-planks=5
-appleplanks=5:0
-oakplanks=5:0
-coniferplanks=5:1
-pineplanks=5:1
-spruceplanks=5:1
-darkplanks=5:1
-birchplanks=5:2
-lightplanks=5:2
-jungleplanks=5:3
-redplanks=5:3
-
-; Obsolete: do not use "wood", as its meaning is not clear - wiki uses log as wood, we use planks as wood.
-wood=5
-
-sapling=6
-applesapling=6:0
-oaksapling=6:0
-conifersapling=6:1
-pinesapling=6:1
-sprucesapling=6:1
-birchsapling=6:2
-junglesapling=6:3
-adminium=7
-bedrock=7
-water=8
-stillwater=9
-swater=9
-stationarywater=9
-lava=10
-stilllava=11
-slava=11
-stationarylava=11
-sand=12
-gravel=13
-goldore=14
-ironore=15
-coalore=16
-tree=17
-log=17
-applelog=17:0
-oaklog=17:0
-coniferlog=17:1
-pinelog=17:1
-sprucelog=17:1
-darklog=17:1
-birchlog=17:2
-whitelog=17:2
-junglelog=17:3
-leaves=18
-appleleaves=18:0
-oakleaves=18:0
-coniferleaves=18:1
-pineleaves=18:1
-spruceleaves=18:1
-birchleaves=18:2
-jungleleaves=18:3
-sponge=19
-glass=20
-lapisore=21
-lapisblock=22
-dispenser=23
-sandstone=24
-normalsandstone=24:0
-ornamentsandstone=24:1
-decorativesandstone=24:1
-smoothsandstone=24:2
-noteblock=25
-bedblock=26
-poweredrail=27
-detectorrail=28
-stickypiston=29
-cobweb=30
-tallgrass=31
-tallgrassone=31:1
-tallgrasstwo=31:2
-deadbush=32
-piston=33
-pistonextension=34
-pistonhead=34
-cloth=35
-wool=35
-whitewool=35:0
-orangewool=35:1
-magentawool=35:2
-lightbluewool=35:3
-yellowwool=35:4
-limewool=35:5
-lightgreenwool=35:5
-ltgreenwool=35:5
-pinkwool=35:6
-graywool=35:7
-greywool=35:7
-darkgraywool=35:7
-darkgreywool=35:7
-dkgraywool=35:7
-dkgreywool=35:7
-lightgraywool=35:8
-lightgreywool=35:8
-ltgraywool=35:8
-ltgreywool=35:8
-cyanwool=35:9
-purplewool=35:10
-violetwool=35:10
-bluewool=35:11
-darkbluewool=35:11
-brownwool=35:12
-greenwool=35:13
-darkgreenwool=35:13
-dkgreenwool=35:13
-redwool=35:14
-blackwool=35:15
-flower=37
-rose=38
-brownmushroom=39
-redmushroom=40
-gold=41
-goldblock=41
-iron=42
-ironblock=42
-doubleslab=43
-stonedoubleslab=43:0
-sandstonedoubleslab=43:1
-wooddoubleslab=43:2
-cobblestonedoubleslab=43:3
-brickdoubleslab=43:4
-stonebrickdoubleslab=43:5
-netherbrickdoubleslab=43:6
-quartzdoubleslab=43:7
-slab=44
-step=44
-stoneslab=44:0
-sandstoneslab=44:1
-woodslab=44:2
-cobblestoneslab=44:3
-brickslab=44:4
-stonebrickslab=44:5
-netherbrickslab=44:6
-quartzslab=44:7
-brickblock=45
-brickwall=45
-tnt=46
-bookshelf=47
-bookcase=47
-mossycobblestone=48
-mossy=48
-obsidian=49
-torch=50
-fire=51
-mobspawner=52
-woodstairs=53
-chest=54
-redstonedust=55
-redstonewire=55
-diamondore=56
-diamondblock=57
-workbench=58
-crop=59
-crops=59
-soil=60
-furnace=61
-litfurnace=62
-signblock=63
-wooddoorblock=64
-ladder=65
-rails=66
-rail=66
-track=66
-tracks=66
-cobblestonestairs=67
-stairs=67
-signblocktop=68
-wallsign=68
-lever=69
-rockplate=70
-stoneplate=70
-irondoorblock=71
-woodplate=72
-redstoneore=73
-redstoneorealt=74
-redstonetorchoff=75
-redstonetorchon=76
-stonebutton=77
-snow=78
-ice=79
-snowblock=80
-cactus=81
-clayblock=82
-reedblock=83
-jukebox=84
-fence=85
-pumpkin=86
-netherstone=87
-netherrack=87
-hellrock=87
-slowsand=88
-soulsand=88
-lightstone=89
-glowstone=89
-portal=90
-jackolantern=91
-jacko=91
-cakeblock=92
-lockedchest=95
-trapdoor=96
-silverfishblock=97
-stonebricks=98
-stonebrick=98
-mossystonebrick=98:1
-crackedstonebrick=98:2
-chiseledstonebrick=98:3
-hugebrownmushroom=99
-hugeredmushroom=100
-ironbars=101
-glasspane=102
-melon=103
-pumpkinstem=104
-melonstem=105
-vines=106
-fencegate=107
-brickstairs=108
-stonebrickstairs=109
-mycelium=110
-lilypad=111
-netherbrick=112
-netherbrickfence=113
-netherbrickstairs=114
-netherwartblock=115
-enchantmenttable=116
-brewingstandblock=117
-cauldronblock=118
-endportal=119
-endportalframe=120
-endstone=121
-dragonegg=122
-redstonelamp=123
-redstonelampoff=123
-redstonelampon=124
-woodendoubleslab=125
-woodenslab=126
-sandstonestairs=128
-emeraldore=129
-enderchest=130
-tripwirehook=131
-tripwire=132
-emeraldblock=133
-commandblock=137
-beacon=138
-cobblestonewall=139
-mossycobblestonewall=139:1
-flowerpotblock=140
-carrotcrop=141
-potatocrop=142
-woodenbutton=143
-skeletonhead=144
-witherhead=144:1
-zombiehead=144:2
-humanhead=144:3
-stevehead=144:3
-creeperhead=144:4
-anvil=145
-trappedchest=146
-lightweightedpressureplate=147
-heavyweightedpressureplate=148
-inactivecomparator=149
-activecomparator=150
-daylightsensor=151
-redstoneblock=152
-netherquartzore=153
-hopper=154
-quartzblock=155
-chiseledquartzblock=155:1
-pillarquartzblock=155:2
-quartzstairs=156
-activatorrail=157
-dropper=158
-
-ironshovel=256
-ironspade=256
-ironpickaxe=257
-ironpick=257
-ironaxe=258
-flintandsteel=259
-lighter=259
-apple=260
-redapple=260
-bow=261
-arrow=262
-coal=263
-charcoal=263:1
-diamond=264
-ironingot=265
-ironbar=265
-goldingot=266
-goldeningot=266
-goldbar=266
-goldenbar=266
-ironsword=267
-woodensword=268
-woodsword=268
-woodenshovel=269
-woodshovel=269
-woodenspade=269
-woodspade=269
-woodenpickaxe=270
-woodpickaxe=270
-woodenpick=270
-woodpick=270
-woodenaxe=271
-woodaxe=271
-stonesword=272
-stoneshovel=273
-stonespade=273
-stonepickaxe=274
-stonepick=274
-stoneaxe=275
-diamondsword=276
-diamondshovel=277
-diamondspade=277
-diamondpickaxe=278
-diamondpick=278
-diamondaxe=279
-stick=280
-bowl=281
-mushroomstew=282
-bowlwithsoup=282
-soupbowl=282
-soup=282
-goldensword=283
-goldsword=283
-goldenshovel=284
-goldshovel=284
-goldenspade=284
-goldspade=284
-goldenpickaxe=285
-goldpickaxe=285
-goldenpick=285
-goldpick=285
-goldenaxe=286
-goldaxe=286
-string=287
-feather=288
-gunpowder=289
-woodhoe=290
-woodenhoe=290
-stonehoe=291
-ironhoe=292
-diamondhoe=293
-goldhoe=294
-goldenhoe=294
-seeds=295
-wheat=296
-bread=297
-leatherhelmet=298
-leatherchestplate=299
-leatherpants=300
-leatherboots=301
-chainmailhelmet=302
-chainmailchestplate=303
-chainmailpants=304
-chainmailboots=305
-ironhelmet=306
-ironchestplate=307
-ironpants=308
-ironboots=309
-diamondhelmet=310
-diamondchestplate=311
-diamondpants=312
-diamondboots=313
-goldenhelmet=314
-goldhelmet=314
-goldenchestplate=315
-goldchestplate=315
-goldenpants=316
-goldpants=316
-goldenboots=317
-goldboots=317
-flint=318
-meat=319
-pork=319
-cookedmeat=320
-cookedpork=320
-painting=321
-paintings=321
-goldenapple=322
-goldapple=322
-enchantedgoldenapple=322:1
-enchantedgoldapple=322:1
-sign=323
-wooddoor=324
-woodendoor=324
-bucket=325
-waterbucket=326
-lavabucket=327
-minecart=328
-saddle=329
-irondoor=330
-redstonedust=331
-snowball=332
-boat=333
-leather=334
-milkbucket=335
-brick=336
-clay=337
-reed=338
-sugarcane=338
-paper=339
-book=340
-slimeorb=341
-slimeball=341
-storageminecart=342
-poweredminecart=343
-egg=344
-compass=345
-fishingrod=346
-watch=347
-lightstonedust=348
-lightdust=348
-glowstonedust=348
-glowdust=348
-rawfish=349
-fish=349
-cookedfish=350
-dye=351
-inksac=351:0
-blackdye=351:0
-reddye=351:1
-rosered=351:1
-greendye=351:2
-cactusgreen=351:2
-cocoabeans=351:3
-browndye=351:3
-lapislazuli=351:4
-bluedye=351:4
-darkbluedye=351:4
-dkbluedye=351:4
-purpledye=351:5
-violetdye=351:5
-cyandye=351:6
-lightgreydye=351:7
-lightgraydye=351:7
-ltgreydye=351:7
-ltgraydye=351:7
-greydye=351:8
-graydye=351:8
-darkgreydye=351:8
-darkgraydye=351:8
-dkgreydye=351:8
-dkgraydye=351:8
-pinkdye=351:9
-limedye=351:10
-lightgreendye=351:10
-ltgreendye=351:10
-dandellionyellow=351:11
-yellowdye=351:11
-lightbluedye=351:12
-ltbluedye=351:12
-magentadye=351:13
-orangedye=351:14
-bonemeal=351:15
-whitedye=351:15
-bone=352
-sugar=353
-cake=354
-bed=355
-repeater=356
-diode=356
-cookie=357
-map=358
-shears=359
-melonslice=360
-pumpkinseeds=361
-melonseeds=362
-rawbeef=363
-steak=364
-rawchicken=365
-cookedchicken=366
-rottenflesh=367
-enderpearl=368
-blazerod=369
-ghasttear=370
-goldnugget=371
-netherwart=372
-potion=373
-glassbottle=374
-spidereye=375
-fermentedspidereye=376
-blazepowder=377
-magmacream=378
-brewingstand=379
-cauldron=380
-eyeofender=381
-glisteringmelon=382
-spawnegg=383
-bottleoenchanting=384
-firecharge=385
-bookandquill=386
-writtenbook=387
-emerald=388
-itemframe=389
-flowerpot=390
-carrot=391
-potato=392
-bakedpotato=393
-poisonouspotato=394
-emptymap=395
-goldencarrot=396
-skeletonhead=397
-witherhead=397:1
-zombiehead=397:2
-stevehead=397:3
-creeperhead=397:4
-carrotonastick=398
-netherstar=399
-pumpkinpie=400
-fireworkrocket=401
-fireworkstar=402
-enchantedbook=403
-comparator=404
-netherbrickitem=405
-netherquartz=406
-tntminecart=407
-hopperminecart=408
-
-goldrecord=2256
-greenrecord=2257
-blocksrecord=2258
-chirprecord=2259
-farrecord=2260
-mallrecord=2261
-mellohirecord=2262
-stalrecord=2263
-stradrecord=2264
-wardrecord=2265
-11record=2266
-
+[Items]
+rock=1
+stone=1
+grass=2
+dirt=3
+cobblestone=4
+cobble=4
+planks=5
+appleplanks=5:0
+oakplanks=5:0
+coniferplanks=5:1
+pineplanks=5:1
+spruceplanks=5:1
+darkplanks=5:1
+birchplanks=5:2
+lightplanks=5:2
+jungleplanks=5:3
+redplanks=5:3
+
+; Obsolete: do not use "wood", as its meaning is not clear - wiki uses log as wood, we use planks as wood.
+wood=5
+
+sapling=6
+applesapling=6:0
+oaksapling=6:0
+conifersapling=6:1
+pinesapling=6:1
+sprucesapling=6:1
+birchsapling=6:2
+junglesapling=6:3
+adminium=7
+bedrock=7
+water=8
+stillwater=9
+swater=9
+stationarywater=9
+lava=10
+stilllava=11
+slava=11
+stationarylava=11
+sand=12
+gravel=13
+goldore=14
+ironore=15
+coalore=16
+tree=17
+log=17
+applelog=17:0
+oaklog=17:0
+coniferlog=17:1
+pinelog=17:1
+sprucelog=17:1
+darklog=17:1
+birchlog=17:2
+whitelog=17:2
+junglelog=17:3
+leaves=18
+appleleaves=18:0
+oakleaves=18:0
+coniferleaves=18:1
+pineleaves=18:1
+spruceleaves=18:1
+birchleaves=18:2
+jungleleaves=18:3
+sponge=19
+glass=20
+lapisore=21
+lapisblock=22
+dispenser=23
+sandstone=24
+normalsandstone=24:0
+ornamentsandstone=24:1
+decorativesandstone=24:1
+smoothsandstone=24:2
+noteblock=25
+bedblock=26
+poweredrail=27
+detectorrail=28
+stickypiston=29
+cobweb=30
+tallgrass=31
+tallgrassone=31:1
+tallgrasstwo=31:2
+deadbush=32
+piston=33
+pistonextension=34
+pistonhead=34
+cloth=35
+wool=35
+whitewool=35:0
+orangewool=35:1
+magentawool=35:2
+lightbluewool=35:3
+yellowwool=35:4
+limewool=35:5
+lightgreenwool=35:5
+ltgreenwool=35:5
+pinkwool=35:6
+graywool=35:7
+greywool=35:7
+darkgraywool=35:7
+darkgreywool=35:7
+dkgraywool=35:7
+dkgreywool=35:7
+lightgraywool=35:8
+lightgreywool=35:8
+ltgraywool=35:8
+ltgreywool=35:8
+cyanwool=35:9
+purplewool=35:10
+violetwool=35:10
+bluewool=35:11
+darkbluewool=35:11
+brownwool=35:12
+greenwool=35:13
+darkgreenwool=35:13
+dkgreenwool=35:13
+redwool=35:14
+blackwool=35:15
+flower=37
+rose=38
+brownmushroom=39
+redmushroom=40
+gold=41
+goldblock=41
+iron=42
+ironblock=42
+doubleslab=43
+stonedoubleslab=43:0
+sandstonedoubleslab=43:1
+wooddoubleslab=43:2
+cobblestonedoubleslab=43:3
+brickdoubleslab=43:4
+stonebrickdoubleslab=43:5
+netherbrickdoubleslab=43:6
+quartzdoubleslab=43:7
+slab=44
+step=44
+stoneslab=44:0
+sandstoneslab=44:1
+woodslab=44:2
+cobblestoneslab=44:3
+brickslab=44:4
+stonebrickslab=44:5
+netherbrickslab=44:6
+quartzslab=44:7
+brickblock=45
+brickwall=45
+tnt=46
+bookshelf=47
+bookcase=47
+mossycobblestone=48
+mossy=48
+obsidian=49
+torch=50
+fire=51
+mobspawner=52
+woodstairs=53
+chest=54
+redstonedust=55
+redstonewire=55
+diamondore=56
+diamondblock=57
+workbench=58
+crop=59
+crops=59
+soil=60
+furnace=61
+litfurnace=62
+signblock=63
+wooddoorblock=64
+ladder=65
+rails=66
+rail=66
+track=66
+tracks=66
+cobblestonestairs=67
+stairs=67
+signblocktop=68
+wallsign=68
+lever=69
+rockplate=70
+stoneplate=70
+irondoorblock=71
+woodplate=72
+redstoneore=73
+redstoneorealt=74
+redstonetorchoff=75
+redstonetorchon=76
+stonebutton=77
+snow=78
+ice=79
+snowblock=80
+cactus=81
+clayblock=82
+reedblock=83
+jukebox=84
+fence=85
+pumpkin=86
+netherstone=87
+netherrack=87
+hellrock=87
+slowsand=88
+soulsand=88
+lightstone=89
+glowstone=89
+portal=90
+jackolantern=91
+jacko=91
+cakeblock=92
+lockedchest=95
+trapdoor=96
+silverfishblock=97
+stonebricks=98
+stonebrick=98
+mossystonebrick=98:1
+crackedstonebrick=98:2
+chiseledstonebrick=98:3
+hugebrownmushroom=99
+hugeredmushroom=100
+ironbars=101
+glasspane=102
+melon=103
+pumpkinstem=104
+melonstem=105
+vines=106
+fencegate=107
+brickstairs=108
+stonebrickstairs=109
+mycelium=110
+lilypad=111
+netherbrick=112
+netherbrickfence=113
+netherbrickstairs=114
+netherwartblock=115
+enchantmenttable=116
+brewingstandblock=117
+cauldronblock=118
+endportal=119
+endportalframe=120
+endstone=121
+dragonegg=122
+redstonelamp=123
+redstonelampoff=123
+redstonelampon=124
+woodendoubleslab=125
+woodenslab=126
+sandstonestairs=128
+emeraldore=129
+enderchest=130
+tripwirehook=131
+tripwire=132
+emeraldblock=133
+commandblock=137
+beacon=138
+cobblestonewall=139
+mossycobblestonewall=139:1
+flowerpotblock=140
+carrotcrop=141
+potatocrop=142
+woodenbutton=143
+skeletonhead=144
+witherhead=144:1
+zombiehead=144:2
+humanhead=144:3
+stevehead=144:3
+creeperhead=144:4
+anvil=145
+trappedchest=146
+lightweightedpressureplate=147
+heavyweightedpressureplate=148
+inactivecomparator=149
+activecomparator=150
+daylightsensor=151
+redstoneblock=152
+netherquartzore=153
+hopper=154
+quartzblock=155
+chiseledquartzblock=155:1
+pillarquartzblock=155:2
+quartzstairs=156
+activatorrail=157
+dropper=158
+
+ironshovel=256
+ironspade=256
+ironpickaxe=257
+ironpick=257
+ironaxe=258
+flintandsteel=259
+lighter=259
+apple=260
+redapple=260
+bow=261
+arrow=262
+coal=263
+charcoal=263:1
+diamond=264
+ironingot=265
+ironbar=265
+goldingot=266
+goldeningot=266
+goldbar=266
+goldenbar=266
+ironsword=267
+woodensword=268
+woodsword=268
+woodenshovel=269
+woodshovel=269
+woodenspade=269
+woodspade=269
+woodenpickaxe=270
+woodpickaxe=270
+woodenpick=270
+woodpick=270
+woodenaxe=271
+woodaxe=271
+stonesword=272
+stoneshovel=273
+stonespade=273
+stonepickaxe=274
+stonepick=274
+stoneaxe=275
+diamondsword=276
+diamondshovel=277
+diamondspade=277
+diamondpickaxe=278
+diamondpick=278
+diamondaxe=279
+stick=280
+bowl=281
+mushroomstew=282
+bowlwithsoup=282
+soupbowl=282
+soup=282
+goldensword=283
+goldsword=283
+goldenshovel=284
+goldshovel=284
+goldenspade=284
+goldspade=284
+goldenpickaxe=285
+goldpickaxe=285
+goldenpick=285
+goldpick=285
+goldenaxe=286
+goldaxe=286
+string=287
+feather=288
+gunpowder=289
+woodhoe=290
+woodenhoe=290
+stonehoe=291
+ironhoe=292
+diamondhoe=293
+goldhoe=294
+goldenhoe=294
+seeds=295
+wheat=296
+bread=297
+leatherhelmet=298
+leatherchestplate=299
+leatherpants=300
+leatherboots=301
+chainmailhelmet=302
+chainmailchestplate=303
+chainmailpants=304
+chainmailboots=305
+ironhelmet=306
+ironchestplate=307
+ironpants=308
+ironboots=309
+diamondhelmet=310
+diamondchestplate=311
+diamondpants=312
+diamondboots=313
+goldenhelmet=314
+goldhelmet=314
+goldenchestplate=315
+goldchestplate=315
+goldenpants=316
+goldpants=316
+goldenboots=317
+goldboots=317
+flint=318
+meat=319
+pork=319
+cookedmeat=320
+cookedpork=320
+painting=321
+paintings=321
+goldenapple=322
+goldapple=322
+enchantedgoldenapple=322:1
+enchantedgoldapple=322:1
+sign=323
+wooddoor=324
+woodendoor=324
+bucket=325
+waterbucket=326
+lavabucket=327
+minecart=328
+saddle=329
+irondoor=330
+redstonedust=331
+snowball=332
+boat=333
+leather=334
+milkbucket=335
+brick=336
+clay=337
+reed=338
+sugarcane=338
+paper=339
+book=340
+slimeorb=341
+slimeball=341
+storageminecart=342
+poweredminecart=343
+egg=344
+compass=345
+fishingrod=346
+watch=347
+lightstonedust=348
+lightdust=348
+glowstonedust=348
+glowdust=348
+rawfish=349
+fish=349
+cookedfish=350
+dye=351
+inksac=351:0
+blackdye=351:0
+reddye=351:1
+rosered=351:1
+greendye=351:2
+cactusgreen=351:2
+cocoabeans=351:3
+browndye=351:3
+lapislazuli=351:4
+bluedye=351:4
+darkbluedye=351:4
+dkbluedye=351:4
+purpledye=351:5
+violetdye=351:5
+cyandye=351:6
+lightgreydye=351:7
+lightgraydye=351:7
+ltgreydye=351:7
+ltgraydye=351:7
+greydye=351:8
+graydye=351:8
+darkgreydye=351:8
+darkgraydye=351:8
+dkgreydye=351:8
+dkgraydye=351:8
+pinkdye=351:9
+limedye=351:10
+lightgreendye=351:10
+ltgreendye=351:10
+dandellionyellow=351:11
+yellowdye=351:11
+lightbluedye=351:12
+ltbluedye=351:12
+magentadye=351:13
+orangedye=351:14
+bonemeal=351:15
+whitedye=351:15
+bone=352
+sugar=353
+cake=354
+bed=355
+repeater=356
+diode=356
+cookie=357
+map=358
+shears=359
+melonslice=360
+pumpkinseeds=361
+melonseeds=362
+rawbeef=363
+steak=364
+rawchicken=365
+cookedchicken=366
+rottenflesh=367
+enderpearl=368
+blazerod=369
+ghasttear=370
+goldnugget=371
+netherwart=372
+potion=373
+glassbottle=374
+spidereye=375
+fermentedspidereye=376
+blazepowder=377
+magmacream=378
+brewingstand=379
+cauldron=380
+eyeofender=381
+glisteringmelon=382
+spawnegg=383
+bottleoenchanting=384
+firecharge=385
+bookandquill=386
+writtenbook=387
+emerald=388
+itemframe=389
+flowerpot=390
+carrot=391
+potato=392
+bakedpotato=393
+poisonouspotato=394
+emptymap=395
+goldencarrot=396
+skeletonhead=397
+witherhead=397:1
+zombiehead=397:2
+stevehead=397:3
+creeperhead=397:4
+carrotonastick=398
+netherstar=399
+pumpkinpie=400
+fireworkrocket=401
+fireworkstar=402
+enchantedbook=403
+comparator=404
+netherbrickitem=405
+netherquartz=406
+tntminecart=407
+hopperminecart=408
+
+goldrecord=2256
+greenrecord=2257
+blocksrecord=2258
+chirprecord=2259
+farrecord=2260
+mallrecord=2261
+mellohirecord=2262
+stalrecord=2263
+stradrecord=2264
+wardrecord=2265
+11record=2266
+
diff --git a/MCServer/monsters.ini b/MCServer/monsters.ini
index 6634c5bef..80a0c7dde 100644
--- a/MCServer/monsters.ini
+++ b/MCServer/monsters.ini
@@ -1,111 +1,111 @@
-[Spider]
-AttackRange=5.0
-AttackRate=1
-AttackDamage=1.0
-SightDistance=25.0
-MaxHealth=10
-
-[Chicken]
-AttackRange=5.0
-AttackRate=1
-AttackDamage=1.0
-SightDistance=25.0
-MaxHealth=4
-
-[Cow]
-AttackRange=5.0
-AttackRate=1
-AttackDamage=1.0
-SightDistance=25.0
-MaxHealth=10
-
-[Pig]
-AttackRange=5.0
-AttackRate=1
-AttackDamage=1.0
-SightDistance=25.0
-MaxHealth=10
-
-[Sheep]
-AttackRange=5.0
-AttackRate=1
-AttackDamage=1.0
-SightDistance=25.0
-MaxHealth=8
-
-[Squid]
-AttackRange=5.0
-AttackRate=1
-AttackDamage=1.0
-SightDistance=25.0
-MaxHealth=10
-
-[Enderman]
-AttackRange=5.0
-AttackRate=1
-AttackDamage=4.0
-SightDistance=25.0
-MaxHealth=40
-
-[Zombiepigman]
-AttackRange=5.0
-AttackRate=1
-AttackDamage=5.0
-SightDistance=25.0
-MaxHealth=20
-
-[Cavespider]
-AttackRange=5.0
-AttackRate=1
-AttackDamage=2.0
-SightDistance=25.0
-MaxHealth=12
-
-[Creeper]
-AttackRange=5.0
-AttackRate=1
-AttackDamage=0.0
-SightDistance=25.0
-MaxHealth=20
-
-[Ghast]
-AttackRange=5.0
-AttackRate=1
-AttackDamage=0.0
-SightDistance=25.0
-MaxHealth=10
-
-[Silverfish]
-AttackRange=5.0
-AttackRate=1
-AttackDamage=1.0
-SightDistance=25.0
-MaxHealth=8
-
-[Skeleton]
-AttackRange=5.0
-AttackRate=1
-AttackDamage=4.0
-SightDistance=25.0
-MaxHealth=20
-
-[Slime]
-AttackRange=5.0
-AttackRate=1
-AttackDamage=10.0
-SightDistance=25.0
-MaxHealth=32
-
-[Spider]
-AttackRange=5.0
-AttackRate=1
-AttackDamage=2.0
-SightDistance=25.0
-MaxHealth=16
-
-[Zombie]
-AttackRange=5.0
-AttackRate=1
-AttackDamage=4.0
-SightDistance=25.0
+[Spider]
+AttackRange=5.0
+AttackRate=1
+AttackDamage=1.0
+SightDistance=25.0
+MaxHealth=10
+
+[Chicken]
+AttackRange=5.0
+AttackRate=1
+AttackDamage=1.0
+SightDistance=25.0
+MaxHealth=4
+
+[Cow]
+AttackRange=5.0
+AttackRate=1
+AttackDamage=1.0
+SightDistance=25.0
+MaxHealth=10
+
+[Pig]
+AttackRange=5.0
+AttackRate=1
+AttackDamage=1.0
+SightDistance=25.0
+MaxHealth=10
+
+[Sheep]
+AttackRange=5.0
+AttackRate=1
+AttackDamage=1.0
+SightDistance=25.0
+MaxHealth=8
+
+[Squid]
+AttackRange=5.0
+AttackRate=1
+AttackDamage=1.0
+SightDistance=25.0
+MaxHealth=10
+
+[Enderman]
+AttackRange=5.0
+AttackRate=1
+AttackDamage=4.0
+SightDistance=25.0
+MaxHealth=40
+
+[Zombiepigman]
+AttackRange=5.0
+AttackRate=1
+AttackDamage=5.0
+SightDistance=25.0
+MaxHealth=20
+
+[Cavespider]
+AttackRange=5.0
+AttackRate=1
+AttackDamage=2.0
+SightDistance=25.0
+MaxHealth=12
+
+[Creeper]
+AttackRange=5.0
+AttackRate=1
+AttackDamage=0.0
+SightDistance=25.0
+MaxHealth=20
+
+[Ghast]
+AttackRange=5.0
+AttackRate=1
+AttackDamage=0.0
+SightDistance=25.0
+MaxHealth=10
+
+[Silverfish]
+AttackRange=5.0
+AttackRate=1
+AttackDamage=1.0
+SightDistance=25.0
+MaxHealth=8
+
+[Skeleton]
+AttackRange=5.0
+AttackRate=1
+AttackDamage=4.0
+SightDistance=25.0
+MaxHealth=20
+
+[Slime]
+AttackRange=5.0
+AttackRate=1
+AttackDamage=10.0
+SightDistance=25.0
+MaxHealth=32
+
+[Spider]
+AttackRange=5.0
+AttackRate=1
+AttackDamage=2.0
+SightDistance=25.0
+MaxHealth=16
+
+[Zombie]
+AttackRange=5.0
+AttackRate=1
+AttackDamage=4.0
+SightDistance=25.0
MaxHealth=20 \ No newline at end of file
diff --git a/MCServer/settings.ini b/MCServer/settings.example.ini
index 5e6ed4e2b..e2505368d 100644
--- a/MCServer/settings.ini
+++ b/MCServer/settings.example.ini
@@ -1,31 +1,31 @@
-; This is the main server configuration
-; For help, please visit the Wiki page: http://www.mc-server.org/wiki/doku.php?id=configure:settings.ini
-; Most of these settings can also be set using the webadmin interface, if it is enabled.
-
-[Server]
-Port=25565
-MaxPlayers=100
-Description=MCServer - in C++
-DefaultViewDistance=9
-
-[Worlds]
-DefaultWorld=world
-
-[Plugins]
-; Plugin=Debuggers
-; Plugin=DiamondMover
-; Plugin=HookNotify
-Plugin=Core
-Plugin=ChunkWorx
-Plugin=ChatLog
-
-[Monsters]
-AnimalsOn=0
-AnimalSpawnInterval=10
-Types=Spider,Chicken,Cow,Pig,Sheep,Squid,Enderman,Zombiepigman,Cavespider,Creeper,Ghast,Silverfish,Skeleton,Slime,Spider,Zombie
-
-[Authentication]
-Server=session.minecraft.net
-Address=/game/checkserver.jsp?user=%USERNAME%&serverId=%SERVERID%
-Authenticate=0
-
+; This is the main server configuration
+; For help, please visit the Wiki page: http://www.mc-server.org/wiki/doku.php?id=configure:settings.ini
+; Most of these settings can also be set using the webadmin interface, if it is enabled.
+
+[Server]
+Port=25565
+MaxPlayers=100
+Description=MCServer - in C++
+DefaultViewDistance=9
+
+[Worlds]
+DefaultWorld=world
+
+[Plugins]
+; Plugin=Debuggers
+; Plugin=DiamondMover
+; Plugin=HookNotify
+Plugin=Core
+Plugin=ChunkWorx
+Plugin=ChatLog
+
+[Monsters]
+AnimalsOn=0
+AnimalSpawnInterval=10
+Types=Spider,Chicken,Cow,Pig,Sheep,Squid,Enderman,Zombiepigman,Cavespider,Creeper,Ghast,Silverfish,Skeleton,Slime,Spider,Zombie
+
+[Authentication]
+Server=session.minecraft.net
+Address=/game/checkserver.jsp?user=%USERNAME%&serverId=%SERVERID%
+Authenticate=0
+
diff --git a/MCServer/terrain.ini b/MCServer/terrain.ini
deleted file mode 100644
index a917223f9..000000000
--- a/MCServer/terrain.ini
+++ /dev/null
@@ -1,8 +0,0 @@
-[Terrain]
-HeightFreq1=0.100000
-HeightFreq2=1.000000
-HeightFreq3=2.000000
-HeightAmp1=1.000000
-HeightAmp2=0.500000
-HeightAmp3=0.500000
-
diff --git a/MCServer/users.ini b/MCServer/users.ini
index 1015527cc..6726c0bf8 100644
--- a/MCServer/users.ini
+++ b/MCServer/users.ini
@@ -1,23 +1,23 @@
-[FakeTruth]
-Groups=Admins
-
-[Duralex]
-Groups=Admins
-
-[Luthrandel]
-Groups=Admins
-
-[cruisecho]
-Groups=Admins
-
-[Kwen]
-Groups=Admins
-
-[aloe_vera]
-Groups=Admins
-
-[xoft]
-Groups=Admins
-
-[Player]
+[FakeTruth]
+Groups=Admins
+
+[Duralex]
+Groups=Admins
+
+[Luthrandel]
+Groups=Admins
+
+[cruisecho]
+Groups=Admins
+
+[Kwen]
+Groups=Admins
+
+[aloe_vera]
+Groups=Admins
+
+[xoft]
+Groups=Admins
+
+[Player]
Groups=Admins \ No newline at end of file
diff --git a/MCServer/webadmin.ini b/MCServer/webadmin.example.ini
index 7384f0bde..8597225bb 100644
--- a/MCServer/webadmin.ini
+++ b/MCServer/webadmin.example.ini
@@ -1,6 +1,6 @@
-[WebAdmin]
-Enabled=1
-Port=8081
-
-[User:admin]
+[WebAdmin]
+Enabled=1
+Port=8081
+
+[User:admin]
Password=admin \ No newline at end of file
diff --git a/MCServer/webadmin/template.html b/MCServer/webadmin/template.html
index 4636959f2..822f73857 100644
--- a/MCServer/webadmin/template.html
+++ b/MCServer/webadmin/template.html
@@ -1,129 +1,129 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>{TITLE} | {PLUGIN_NAME}</title>
- <style type="text/css">
- body {
- line-height: 1;
- background: #B8B8B8;
- }
-
- #maincontent {
- padding: 0px 25px 10px 25px;
- }
-
- #wrapper {
- min-width: 850px;
- width: 75%;
- margin: 10px auto;
- background-color: white;
- border: 4px #888888 solid;
- border-radius: 10px;
- font-family: Calibri, Trebuchet MS;
- }
-
- header {
- text-align:center;
- padding: 10px; 0px;
- }
-
- span {
- text-align: right;
- float: right;
- border-left: 2px #C8C8C8 solid;
- border-bottom: 2px #C8C8C8 solid;
- padding: 2px 10px;
- }
-
- footer {
- font-family: helvetica;
- font-size: 10px;
- text-align: center;
- border-top: 1px #000 dotted;
- padding: 1px 0px 1px 0px;
- }
-
- table {
- border-collapse: collapse;
- border-spacing: 10;
- }
-
- table {
- border-top: 1px solid #ddd;
- width: 700px;
- }
-
- table tr th {
- text-align: left;
- background: #f6f6f6;
- padding: 0px 20px;
- height: 25px;
- line-height: 25px;
- border: 1px solid #ddd;
- border-radius: 3px;
- }
-
- table tr td {
- background: #f6f6f6;
- padding: 0px 20px;
- height: 29px;
- line-height: 29px;
- border: 1px solid #ddd;
- border-radius: 3px;
- }
- #main table tr.odd td {
- background: #fbfbfb;
- }
-
- table tr:hover td { background: #fdfcf6; }
- table .action {
- text-align: right;
- padding: 0 20px 0 10px;
- }
-
- table tr .action a { color: #9b9b9b; }
-
- #cssmenu{ height:10px; display:table; padding:0; margin: 0 auto; border:1px #707070 solid; border-radius:5px; }
- #cssmenu > ul {list-style:inside none; padding:0; margin:0;}
- #cssmenu > ul > li {list-style:inside none; padding:0; margin:0; float:left; display:block; position:relative;}
- #cssmenu > ul > li > a{ outline:none; display:block; position:relative; color:#E8E8E8; padding:10px 10px; font:bold 13px/100% Arial, Helvetica, sans-serif; text-align:center; text-decoration:none; text-shadow:1px 1px 0 rgba(0,0,0, 0.4); }
- #cssmenu > ul > li:first-child > a{border-radius:5px 0 0 5px;}
- /* #cssmenu > ul > li > a:after{ content:''; position:absolute; border-right:1px solid #FFFFFF; top:-1px; bottom:-1px; right:-2px; z-index:99; } */
- #cssmenu ul li.has-sub:hover > a:after{top:0; bottom:0;}
- #cssmenu > ul > li.has-sub > a:before{ content:''; position:absolute; top:18px; right:6px; border:5px solid transparent; border-top:5px solid #707070; }
- #cssmenu > ul > li.has-sub:hover > a:before{top:19px;}
- #cssmenu ul li.has-sub:hover > a{ background:#3f3f3f; border-color:#707070; padding-bottom:13px; padding-top:13px; top:-1px; z-index:999; }
- #cssmenu ul li.has-sub:hover > ul, #cssmenu ul li.has-sub:hover > div{display:block;}
- #cssmenu ul li.has-sub > a:hover{background:#3f3f3f; border-color:#3f3f3f;}
- #cssmenu ul li > ul, #cssmenu ul li > div{ display:none; width:auto; position:absolute; top:38px; padding:10px 0; background:#3f3f3f; border-radius:0 0 5px 5px; z-index:999; }
- #cssmenu ul li > ul{width:200px;}
- #cssmenu ul li > ul li{display:block; list-style:inside none; padding:0; margin:0; position:relative;}
- #cssmenu ul li > ul li a{ outline:none; display:block; position:relative; margin:0; padding:8px 20px; font:10pt Arial, Helvetica, sans-serif; color:#fff; text-decoration:none; text-shadow:1px 1px 0 rgba(0,0,0, 0.5); }
- #cssmenu, #cssmenu > ul > li > ul > li a:hover{ background:#C8C8C8;}
- #cssmenu > ul > li > a{border-right:1px solid #707070; color:#FFFFFF;}
- #cssmenu > ul > li > a:after{border-color:#707070;}
- #cssmenu > ul > li > a:hover{background:#B8B8B8;}
- </style>
- <meta name="msapplication-tooltip" content="MCServer WebAdministrator"/>
- <meta name="msapplication-navbutton-color" content="#B8B8B8" />
- <link rel="shortcut icon" href="http://mc-server.org/favicon.ico" />
-</head>
-
-<body>
- <div id="wrapper">
- <span><b>Login: {USERNAME}</b></span><br />
- <header>
- <img alt="" src="data:image/png;base64,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" />
- </header>
- <nav id="cssmenu">
- <ul>
- {MENU}
- </ul>
- </nav>
- <div id="maincontent">
- {CONTENT}
- </div>
- <footer><p>MCServer is using {MEM}MB of memory, with {NUMCHUNKS} chunks loaded.</p><p>Web Design by Tiger</p></footer>
- </div>
-</head>
-</html>
+<!DOCTYPE html>
+<html>
+<head>
+ <title>{TITLE} | {PLUGIN_NAME}</title>
+ <style type="text/css">
+ body {
+ line-height: 1;
+ background: #B8B8B8;
+ }
+
+ #maincontent {
+ padding: 0px 25px 10px 25px;
+ }
+
+ #wrapper {
+ min-width: 850px;
+ width: 75%;
+ margin: 10px auto;
+ background-color: white;
+ border: 4px #888888 solid;
+ border-radius: 10px;
+ font-family: Calibri, Trebuchet MS;
+ }
+
+ header {
+ text-align:center;
+ padding: 10px; 0px;
+ }
+
+ span {
+ text-align: right;
+ float: right;
+ border-left: 2px #C8C8C8 solid;
+ border-bottom: 2px #C8C8C8 solid;
+ padding: 2px 10px;
+ }
+
+ footer {
+ font-family: helvetica;
+ font-size: 10px;
+ text-align: center;
+ border-top: 1px #000 dotted;
+ padding: 1px 0px 1px 0px;
+ }
+
+ table {
+ border-collapse: collapse;
+ border-spacing: 10;
+ }
+
+ table {
+ border-top: 1px solid #ddd;
+ width: 700px;
+ }
+
+ table tr th {
+ text-align: left;
+ background: #f6f6f6;
+ padding: 0px 20px;
+ height: 25px;
+ line-height: 25px;
+ border: 1px solid #ddd;
+ border-radius: 3px;
+ }
+
+ table tr td {
+ background: #f6f6f6;
+ padding: 0px 20px;
+ height: 29px;
+ line-height: 29px;
+ border: 1px solid #ddd;
+ border-radius: 3px;
+ }
+ #main table tr.odd td {
+ background: #fbfbfb;
+ }
+
+ table tr:hover td { background: #fdfcf6; }
+ table .action {
+ text-align: right;
+ padding: 0 20px 0 10px;
+ }
+
+ table tr .action a { color: #9b9b9b; }
+
+ #cssmenu{ height:10px; display:table; padding:0; margin: 0 auto; border:1px #707070 solid; border-radius:5px; }
+ #cssmenu > ul {list-style:inside none; padding:0; margin:0;}
+ #cssmenu > ul > li {list-style:inside none; padding:0; margin:0; float:left; display:block; position:relative;}
+ #cssmenu > ul > li > a{ outline:none; display:block; position:relative; color:#E8E8E8; padding:10px 10px; font:bold 13px/100% Arial, Helvetica, sans-serif; text-align:center; text-decoration:none; text-shadow:1px 1px 0 rgba(0,0,0, 0.4); }
+ #cssmenu > ul > li:first-child > a{border-radius:5px 0 0 5px;}
+ /* #cssmenu > ul > li > a:after{ content:''; position:absolute; border-right:1px solid #FFFFFF; top:-1px; bottom:-1px; right:-2px; z-index:99; } */
+ #cssmenu ul li.has-sub:hover > a:after{top:0; bottom:0;}
+ #cssmenu > ul > li.has-sub > a:before{ content:''; position:absolute; top:18px; right:6px; border:5px solid transparent; border-top:5px solid #707070; }
+ #cssmenu > ul > li.has-sub:hover > a:before{top:19px;}
+ #cssmenu ul li.has-sub:hover > a{ background:#3f3f3f; border-color:#707070; padding-bottom:13px; padding-top:13px; top:-1px; z-index:999; }
+ #cssmenu ul li.has-sub:hover > ul, #cssmenu ul li.has-sub:hover > div{display:block;}
+ #cssmenu ul li.has-sub > a:hover{background:#3f3f3f; border-color:#3f3f3f;}
+ #cssmenu ul li > ul, #cssmenu ul li > div{ display:none; width:auto; position:absolute; top:38px; padding:10px 0; background:#3f3f3f; border-radius:0 0 5px 5px; z-index:999; }
+ #cssmenu ul li > ul{width:200px;}
+ #cssmenu ul li > ul li{display:block; list-style:inside none; padding:0; margin:0; position:relative;}
+ #cssmenu ul li > ul li a{ outline:none; display:block; position:relative; margin:0; padding:8px 20px; font:10pt Arial, Helvetica, sans-serif; color:#fff; text-decoration:none; text-shadow:1px 1px 0 rgba(0,0,0, 0.5); }
+ #cssmenu, #cssmenu > ul > li > ul > li a:hover{ background:#C8C8C8;}
+ #cssmenu > ul > li > a{border-right:1px solid #707070; color:#FFFFFF;}
+ #cssmenu > ul > li > a:after{border-color:#707070;}
+ #cssmenu > ul > li > a:hover{background:#B8B8B8;}
+ </style>
+ <meta name="msapplication-tooltip" content="MCServer WebAdministrator"/>
+ <meta name="msapplication-navbutton-color" content="#B8B8B8" />
+ <link rel="shortcut icon" href="http://mc-server.org/favicon.ico" />
+</head>
+
+<body>
+ <div id="wrapper">
+ <span><b>Login: {USERNAME}</b></span><br />
+ <header>
+ <img alt="" src="data:image/png;base64,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" />
+ </header>
+ <nav id="cssmenu">
+ <ul>
+ {MENU}
+ </ul>
+ </nav>
+ <div id="maincontent">
+ {CONTENT}
+ </div>
+ <footer><p>MCServer is using {MEM}MB of memory, with {NUMCHUNKS} chunks loaded.</p><p>Web Design by Tiger</p></footer>
+ </div>
+</head>
+</html>
diff --git a/MCServer/webadmin/template.lua b/MCServer/webadmin/template.lua
new file mode 100644
index 000000000..f508ad5aa
--- /dev/null
+++ b/MCServer/webadmin/template.lua
@@ -0,0 +1,453 @@
+-- Use a table for fast concatenation of strings
+local SiteContent = {}
+function Output(String)
+ table.insert(SiteContent, String)
+end
+
+function GetTableSize(Table)
+ local Size = 0
+ for key,value in pairs(Table) do
+ Size = Size + 1
+ end
+ return Size
+end
+
+function GetDefaultPage()
+ local PM = cRoot:Get():GetPluginManager()
+
+ local SubTitle = "Current Game"
+ local Content = ""
+
+ Content = Content .. "<h4>Server Name:</h4>"
+ Content = Content .. "<p>" .. cRoot:Get():GetServer():GetServerID() .. "</p>"
+
+ Content = Content .. "<h4>Plugins:</h4><ul>"
+ local AllPlugins = PM:GetAllPlugins()
+ for key,value in pairs(AllPlugins) do
+ if( value ~= nil and value ~= false ) then
+ Content = Content .. "<li>" .. key .. " V." .. value:GetVersion() .. "</li>"
+ end
+ end
+
+ Content = Content .. "</ul>"
+ Content = Content .. "<h4>Players:</h4><ul>"
+
+ local AddPlayerToTable = function( Player )
+ Content = Content .. "<li>" .. Player:GetName() .. "</li>"
+ end
+ cRoot:Get():ForEachPlayer( AddPlayerToTable )
+
+ Content = Content .. "</ul><br>";
+
+ return Content, SubTitle
+end
+
+function ShowPage(WebAdmin, TemplateRequest)
+ SiteContent = {}
+ local BaseURL = WebAdmin:GetBaseURL(TemplateRequest.Request.Path)
+ local Title = "MCServer"
+ local MemoryUsage = WebAdmin:GetMemoryUsage()
+ local NumChunks = cRoot:Get():GetTotalChunkCount()
+ local PluginPage = WebAdmin:GetPage(TemplateRequest.Request)
+ local PageContent = PluginPage.Content
+ local SubTitle = PluginPage.PluginName
+ if (PluginPage.TabName ~= "") then
+ SubTitle = PluginPage.PluginName .. " - " .. PluginPage.TabName
+ end
+ if (PageContent == "") then
+ PageContent, SubTitle = GetDefaultPage()
+ end
+
+ Output([[
+<!DOCTYPE html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<link rel="icon" href="data:application/octet-stream;base64,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">
+<title>]] .. Title .. [[</title>
+
+<style type="text/css" media="screen">
+
+ /* reset CSS */
+
+ html, body, div, span, applet, object, iframe,
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
+ a, abbr, acronym, address, big, cite, code,
+ del, dfn, em, font, img, ins, kbd, q, s, samp,
+ small, strike, strong, sub, sup, tt, var,
+ b, u, i, center,
+ dl, dt, dd, ol, ul, li,
+ fieldset, form, label, legend,
+ table, caption, tbody, tfoot, thead, tr, th, td {
+ margin: 0;
+ padding: 0;
+ border: 0;
+ outline: 0;
+ font-size: 100%;
+ vertical-align: baseline;
+ background: transparent;
+ }
+ body {
+ line-height: 1;
+ }
+ ol, ul {
+ list-style: none;
+ }
+ blockquote, q {
+ quotes: none;
+ }
+
+ /* remember to define focus styles! */
+ :focus {
+ outline: 0;
+ }
+
+ /* remove textarea resize at Safari */
+ textarea {
+ resize: none;
+ }
+
+ /* remember to highlight inserts somehow! */
+ ins {
+ text-decoration: none;
+ }
+ del {
+ text-decoration: line-through;
+ }
+
+ /* tables still need 'cellspacing="0"' in the markup */
+ table {
+ border-collapse: collapse;
+ border-spacing: 0;
+ }
+
+
+ /*
+ Origional from http://www.perspectived.com/
+ Modified by Ben Phelps
+ Made for FakeTruth - MCServer
+ */
+
+ /* Basic ---------------------------------------- */
+
+ .clear { clear: both; }
+
+ body {
+ background: white;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ color: #646464;
+ text-align: center;
+ }
+
+ #wrapper {
+ text-align: left;
+ width: 930px;
+ margin: 0 auto;
+ }
+
+ /* Logo ---------------------------------------- */
+
+ h1 {
+ margin: 15px 0 10px 5px;
+ width: 180px;
+ height: 36px;
+ background: url(data:image/png;base64,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) no-repeat left top;
+ }
+
+ h1 a {
+ display: block;
+ width: 225px;
+ height: 28px;
+ }
+
+ h1 span { display: none; }
+
+ a {
+ color: #646464;
+ }
+
+ /* Container ---------------------------------------- */
+
+ #containerHolder {
+ background: #eee;
+ padding: 5px;
+ }
+
+
+ #container {
+ background: #fff url(data:image/gif;base64,R0lGODlhtAABAIAAAN3d3f///yH5BAAAAAAALAAAAAC0AAEAAAIMjI+py+0Po5y0WgYKADs%3D) repeat-y left top;
+ border: 1px solid #ddd;
+ width: 918px;
+
+ }
+
+ #connectHolder {
+ background: #eee;
+ padding: 5px;
+ margin-bottom:8px;
+ }
+
+
+ #connect {
+ border: 1px solid #ddd;
+ background-color: #fff;
+ padding:5px;
+ width: 908px;
+ }
+
+ .pics {
+ height: 375px;
+ width: 600px;
+ }
+
+ .pics img {
+ padding: 5px;
+ border: 1px solid #ddd;
+ background-color: #eee;
+ width: 600px;
+ height: 375px;
+ margin-left: 15px;
+ }
+
+ /* Login -------------------------------------- */
+
+ #loginLogo {
+ margin: 0 auto;
+ margin-top:100px;
+ width: 180px;
+ height: 36px;
+ background-image: url(data:image/png;base64,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);
+ }
+
+ #loginHolder {
+ background: #eee;
+ padding: 5px;
+ width: 310px;
+ margin: 0 auto;
+ height: 90px;
+ margin-top:20px;
+ }
+
+ #login {
+ padding:10px;
+ width: 288px;
+ height: 68px;
+ border: 1px solid #ddd;
+ background:#fff;
+ text-align: left;
+ }
+
+
+ /* Sidebar ---------------------------------------- */
+
+ #sidebar {
+ width: 179px;
+ float: left;
+ }
+
+ #sidebar .sideNav { width: 179px; }
+
+ #sidebar .sideNav li { border-bottom: 1px solid #ddd; width: 179px; }
+
+ #sidebar .sideNav li a {
+ display: block;
+ color: #646464;
+ background: #f6f6f6;
+ text-decoration: none;
+ height: 29px;
+ line-height: 29px;
+ padding: 0 19px;
+ width: 141px;
+ }
+
+ #sidebar .sideNav li a:hover { background: #fdfcf6; }
+
+ #sidebar .sideNav li a.active, #sidebar .sideNav li a.active:hover {
+ background: #f0f7fa;
+ color: #c66653;
+ }
+
+ /* Breadcrumb ---------------------------------------- */
+
+ h2 {
+ width: 718px;
+ float: right;
+ color: #646464;
+ font-size: 16px;
+ line-height: 16px;
+ font-weight: bold;
+ margin: 20px 0 0 0;
+ padding: 0 0 10px 0;
+ border-bottom: 1px solid #ddd;
+ }
+
+ h2 a {
+ color: #646464;
+ text-decoration: none;
+ }
+
+ h2 a.active { color: #c66653; }
+
+ h2 a:hover { text-decoration: underline; }
+
+ /* Content ---------------------------------------- */
+
+ #main {
+ width: 700px;
+ float: right;
+ padding: 0 19px 0 0;
+ }
+
+ #main p {
+
+ padding: 10px;
+
+ }
+
+ h3 {
+ font-size: 14px;
+ line-height: 14px;
+ font-weight: bold;
+ color: #5494af;
+ padding: 0 0 0 10px;
+ margin: 20px 0 10px;
+ }
+
+ h4 {
+ padding: 0 0 0 10px;
+ margin: 20px 0 10px;
+ }
+
+ #main ul {
+ padding: 0 0 0 10px;
+ list-style-type: circle;
+ list-style-position: inside;
+ }
+
+ #main table {
+ border-top: 1px solid #ddd;
+ width: 700px;
+ }
+
+ #main table tr th {
+ text-align: left;
+ background: #f6f6f6;
+ padding: 0px 20px;
+ height: 20px;
+ line-height: 20px;
+ border-bottom: 1px solid #ddd;
+ }
+
+ #main table tr td {
+ background: #f6f6f6;
+ padding: 0px 20px;
+ height: 29px;
+ line-height: 29px;
+ border-bottom: 1px solid #ddd;
+ }
+
+ #main table tr.odd td {
+ background: #fbfbfb;
+ }
+
+ #main table tr:hover td { background: #fdfcf6; }
+
+ #main table .action {
+ text-align: right;
+ padding: 0 20px 0 10px;
+ }
+
+ #main table tr .action a { margin: 0 0 0 10px; text-decoration: none; color: #9b9b9b; }
+ #main table tr:hover .action .edit { color: #c5a059; }
+ #main table tr:hover .action .delete { color: #a02b2b; }
+ #main table tr:hover .action .view { color: #55a34a; }
+
+ #main table tr:hover .action a:hover { text-decoration: underline; }
+
+ fieldset {
+ border: 1px solid #ddd;
+ padding: 19px;
+ margin: 0 0 20px 0;
+ background: #fbfbfb;
+ }
+
+ form p { margin: 0 0 14px 0; float: left; width: 100%; }
+
+ label {
+ display: block;
+ width: 100%;
+ margin: 0 0 7px 0;
+ line-height: 12px;
+ }
+
+ /* Footer ---------------------------------------- */
+
+ #footer {
+ margin: 10px 0 30px 0;
+ font-size: 11px;
+ line-height: 11px;
+ color: #9B9B9B;
+ padding: 0 0 0 5px;
+ }
+
+ #footer a { color: #9B9B9B; }
+
+ #footer a:hover { text-decoration: none; }
+</style>
+
+</head>
+
+<body>
+ <div id="wrapper">
+ <!-- h1 tag stays for the logo, you can use the a tag for linking the index page -->
+ <h1>
+ <a href="]] .. BaseURL .. [["><span>MCServer</span></a>
+ </h1>
+ <div id="containerHolder">
+ <div id="container">
+ <div id="sidebar">
+ <ul class="sideNav">
+ ]])
+
+ local AllPlugins = WebAdmin:GetPlugins()
+ for key,value in pairs(AllPlugins) do
+ local PluginWebTitle = value:GetWebTitle()
+ local TabNames = value:GetTabNames()
+ if (GetTableSize(TabNames) > 0) then
+ Output("<li>"..PluginWebTitle.."</li>");
+
+ for webname,prettyname in pairs(TabNames) do
+ Output("<li><a href='" .. BaseURL .. PluginWebTitle .. "/" .. webname .. "'>" .. prettyname .. "</a></li>")
+ end
+ end
+ end
+
+ Output([[
+ </ul>
+ <!-- // .sideNav -->
+ </div>
+ <!-- // #sidebar -->
+ <!-- h2 stays for breadcrumbs -->
+ <h2>Welcome ]] .. TemplateRequest.Request.Username .. [[</h2>
+ <div id="main">
+ <h3>]] .. SubTitle .. [[</h3>
+ ]] .. PageContent .. [[
+ </div>
+ <!-- // #main -->
+
+ <div class="clear"></div>
+
+ </div>
+ <!-- // #container -->
+ </div>
+ <!-- // #containerHolder -->
+
+ <p id="footer">MCServer is using: ]] .. MemoryUsage .. [[MB of memory; Current chunk count: ]] .. NumChunks .. [[ </p>
+ </div>
+ <!-- // #wrapper -->
+</body>
+</html>
+ ]])
+
+ return table.concat(SiteContent)
+end \ No newline at end of file