diff options
Diffstat (limited to '')
-rw-r--r-- | Plugins/Core/ban.lua (renamed from Plugins/NewTest/ban.lua) | 0 | ||||
-rw-r--r-- | Plugins/Core/gamemode.lua (renamed from Plugins/NewTest/gamemode.lua) | 0 | ||||
-rw-r--r-- | Plugins/Core/gotoworld.lua (renamed from Plugins/NewTest/gotoworld.lua) | 0 | ||||
-rw-r--r-- | Plugins/Core/help.lua (renamed from Plugins/NewTest/help.lua) | 0 | ||||
-rw-r--r-- | Plugins/Core/item.lua (renamed from Plugins/NewTest/item.lua) | 0 | ||||
-rw-r--r-- | Plugins/Core/kick.lua (renamed from Plugins/NewTest/kick.lua) | 0 | ||||
-rw-r--r-- | Plugins/Core/main.lua (renamed from Plugins/NewTest/main.lua) | 8 | ||||
-rw-r--r-- | Plugins/Core/motd.lua (renamed from Plugins/NewTest/motd.lua) | 0 | ||||
-rw-r--r-- | Plugins/Core/onblockplace.lua (renamed from Plugins/NewTest/onblockplace.lua) | 0 | ||||
-rw-r--r-- | Plugins/Core/onkilled.lua (renamed from Plugins/NewTest/onkilled.lua) | 0 | ||||
-rw-r--r-- | Plugins/Core/onlogin.lua (renamed from Plugins/NewTest/onlogin.lua) | 0 | ||||
-rw-r--r-- | Plugins/Core/onplayerjoin.lua (renamed from Plugins/NewTest/onplayerjoin.lua) | 0 | ||||
-rw-r--r-- | Plugins/Core/playerlist.lua (renamed from Plugins/NewTest/playerlist.lua) | 0 | ||||
-rw-r--r-- | Plugins/Core/pluginlist.lua (renamed from Plugins/NewTest/pluginlist.lua) | 0 | ||||
-rw-r--r-- | Plugins/Core/reload.lua (renamed from Plugins/NewTest/reload.lua) | 0 | ||||
-rw-r--r-- | Plugins/Core/spawn.lua (renamed from Plugins/NewTest/spawn.lua) | 0 | ||||
-rw-r--r-- | Plugins/Core/teleport.lua (renamed from Plugins/NewTest/teleport.lua) | 0 | ||||
-rw-r--r-- | Plugins/Core/time.lua (renamed from Plugins/NewTest/time.lua) | 0 | ||||
-rw-r--r-- | Plugins/Core/top.lua (renamed from Plugins/NewTest/top.lua) | 0 | ||||
-rw-r--r-- | Plugins/Core/unban.lua (renamed from Plugins/NewTest/unban.lua) | 0 | ||||
-rw-r--r-- | Plugins/Core/web_playerlist.lua | 32 | ||||
-rw-r--r-- | Plugins/Core/web_reload.lua | 15 | ||||
-rw-r--r-- | Plugins/Core/web_whitelist.lua | 79 |
23 files changed, 133 insertions, 1 deletions
diff --git a/Plugins/NewTest/ban.lua b/Plugins/Core/ban.lua index a6a662c3c..a6a662c3c 100644 --- a/Plugins/NewTest/ban.lua +++ b/Plugins/Core/ban.lua diff --git a/Plugins/NewTest/gamemode.lua b/Plugins/Core/gamemode.lua index 1e73b46fd..1e73b46fd 100644 --- a/Plugins/NewTest/gamemode.lua +++ b/Plugins/Core/gamemode.lua diff --git a/Plugins/NewTest/gotoworld.lua b/Plugins/Core/gotoworld.lua index d5113b667..d5113b667 100644 --- a/Plugins/NewTest/gotoworld.lua +++ b/Plugins/Core/gotoworld.lua diff --git a/Plugins/NewTest/help.lua b/Plugins/Core/help.lua index 02ef25ebd..02ef25ebd 100644 --- a/Plugins/NewTest/help.lua +++ b/Plugins/Core/help.lua diff --git a/Plugins/NewTest/item.lua b/Plugins/Core/item.lua index 942fa8ce6..942fa8ce6 100644 --- a/Plugins/NewTest/item.lua +++ b/Plugins/Core/item.lua diff --git a/Plugins/NewTest/kick.lua b/Plugins/Core/kick.lua index ff4f8a705..ff4f8a705 100644 --- a/Plugins/NewTest/kick.lua +++ b/Plugins/Core/kick.lua diff --git a/Plugins/NewTest/main.lua b/Plugins/Core/main.lua index 3dfa3f2f1..90f86938f 100644 --- a/Plugins/NewTest/main.lua +++ b/Plugins/Core/main.lua @@ -12,7 +12,7 @@ ItemsTable = {} function Initialize( Plugin )
PLUGIN = Plugin
- Plugin:SetName( "NewCore" )
+ Plugin:SetName( "Core" )
Plugin:SetVersion( 8 )
PluginManager = cRoot:Get():GetPluginManager()
@@ -127,6 +127,12 @@ function Initialize( Plugin ) end
end
+ local WebPlugin = Plugin:CreateWebPlugin()
+ WebPlugin:SetName( Plugin:GetName() )
+ WebPlugin:AddTab( "Whitelist", HandleRequest_WhiteList )
+ WebPlugin:AddTab( "Reload", HandleRequest_Reload )
+ WebPlugin:AddTab( "Playerlist", HandleRequest_PlayerList )
+
LOG( "Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion() )
return true
end
\ No newline at end of file diff --git a/Plugins/NewTest/motd.lua b/Plugins/Core/motd.lua index 49cdcecad..49cdcecad 100644 --- a/Plugins/NewTest/motd.lua +++ b/Plugins/Core/motd.lua diff --git a/Plugins/NewTest/onblockplace.lua b/Plugins/Core/onblockplace.lua index ba75bf5c2..ba75bf5c2 100644 --- a/Plugins/NewTest/onblockplace.lua +++ b/Plugins/Core/onblockplace.lua diff --git a/Plugins/NewTest/onkilled.lua b/Plugins/Core/onkilled.lua index a8a92f667..a8a92f667 100644 --- a/Plugins/NewTest/onkilled.lua +++ b/Plugins/Core/onkilled.lua diff --git a/Plugins/NewTest/onlogin.lua b/Plugins/Core/onlogin.lua index a706f8024..a706f8024 100644 --- a/Plugins/NewTest/onlogin.lua +++ b/Plugins/Core/onlogin.lua diff --git a/Plugins/NewTest/onplayerjoin.lua b/Plugins/Core/onplayerjoin.lua index e8263f608..e8263f608 100644 --- a/Plugins/NewTest/onplayerjoin.lua +++ b/Plugins/Core/onplayerjoin.lua diff --git a/Plugins/NewTest/playerlist.lua b/Plugins/Core/playerlist.lua index c120f068f..c120f068f 100644 --- a/Plugins/NewTest/playerlist.lua +++ b/Plugins/Core/playerlist.lua diff --git a/Plugins/NewTest/pluginlist.lua b/Plugins/Core/pluginlist.lua index 6cb767868..6cb767868 100644 --- a/Plugins/NewTest/pluginlist.lua +++ b/Plugins/Core/pluginlist.lua diff --git a/Plugins/NewTest/reload.lua b/Plugins/Core/reload.lua index e2b338ba1..e2b338ba1 100644 --- a/Plugins/NewTest/reload.lua +++ b/Plugins/Core/reload.lua diff --git a/Plugins/NewTest/spawn.lua b/Plugins/Core/spawn.lua index 73034d9cf..73034d9cf 100644 --- a/Plugins/NewTest/spawn.lua +++ b/Plugins/Core/spawn.lua diff --git a/Plugins/NewTest/teleport.lua b/Plugins/Core/teleport.lua index 9fffec9a2..9fffec9a2 100644 --- a/Plugins/NewTest/teleport.lua +++ b/Plugins/Core/teleport.lua diff --git a/Plugins/NewTest/time.lua b/Plugins/Core/time.lua index 425d69e6a..425d69e6a 100644 --- a/Plugins/NewTest/time.lua +++ b/Plugins/Core/time.lua diff --git a/Plugins/NewTest/top.lua b/Plugins/Core/top.lua index 0f7a8f95f..0f7a8f95f 100644 --- a/Plugins/NewTest/top.lua +++ b/Plugins/Core/top.lua diff --git a/Plugins/NewTest/unban.lua b/Plugins/Core/unban.lua index 9defbe323..9defbe323 100644 --- a/Plugins/NewTest/unban.lua +++ b/Plugins/Core/unban.lua diff --git a/Plugins/Core/web_playerlist.lua b/Plugins/Core/web_playerlist.lua new file mode 100644 index 000000000..eeb9369c1 --- /dev/null +++ b/Plugins/Core/web_playerlist.lua @@ -0,0 +1,32 @@ +function HandleRequest_PlayerList( Request )
+ local World = cRoot:Get():GetWorld()
+ local Content = ""
+
+ if( Request.Params:get("playerlist-kick") ~= "" ) then
+ local KickPlayerName = Request.Params:get("playerlist-kick")
+ local Player = World:GetPlayer( KickPlayerName )
+ if( Player == nil ) then
+ Content = Content .. "<p>Could not find player " .. KickPlayerName .. " !</p>"
+ elseif( 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
+
+ Content = Content .. "<p>Connected Players: <b>" .. World:GetNumPlayers() .. "</b></p>"
+ Content = Content .. "<table>"
+
+
+ local PlayerList = World:GetAllPlayers()
+ for i, Player in ipairs( PlayerList ) do
+ Content = Content .. "<tr>"
+ Content = Content .. "<td style='width: 10px;'>" .. i .. ".</td>"
+ Content = Content .. "<td>" .. Player:GetName() .. "</td>"
+ Content = Content .. "<td><a href='?playerlist-kick=" .. Player:GetName() .. "'>Kick</a></td>"
+ Content = Content .. "</tr>"
+ end
+
+ Content = Content .. "</table>"
+ Content = Content .. "<br>"
+ return Content
+end
\ No newline at end of file diff --git a/Plugins/Core/web_reload.lua b/Plugins/Core/web_reload.lua new file mode 100644 index 000000000..f78297fcb --- /dev/null +++ b/Plugins/Core/web_reload.lua @@ -0,0 +1,15 @@ +function HandleRequest_Reload( Request )
+ local Content = ""
+
+ if( Request.Params:get("reload") ~= "" ) 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()
+ else
+ Content = Content .. "<form method=GET>"
+ Content = Content .. "<p>Click the reload button to reload all plugins!<br>"
+ Content = Content .. "<input type=\"submit\" name=\"reload\" value=\"Reload!\"></p>"
+ Content = Content .. "</form>"
+ end
+ return Content
+end
\ No newline at end of file diff --git a/Plugins/Core/web_whitelist.lua b/Plugins/Core/web_whitelist.lua new file mode 100644 index 000000000..b7a220515 --- /dev/null +++ b/Plugins/Core/web_whitelist.lua @@ -0,0 +1,79 @@ +local function HTMLDeleteButton( name )
+ return "<form method=GET><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.Params:get("whitelist-add") ~= "" ) then
+ local PlayerName = Request.Params:get("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.Params:get("whitelist-delete") ~= "" ) then
+ local PlayerName = Request.Params:get("whitelist-delete")
+ WhiteListIni:DeleteValue( "WhiteList", PlayerName )
+ UpdateMessage = "Removed <b>" .. PlayerName .. "</b> from whitelist."
+ WhiteListIni:WriteFile()
+ elseif( Request.Params:get("whitelist-reload") ~= "" ) then
+ WhiteListIni:Erase() -- Empty entire loaded ini first, otherwise weird shit goes down
+ WhiteListIni:ReadFile()
+ UpdateMessage = "Loaded from disk"
+ elseif( Request.Params:get("whitelist-setenable") ~= "" ) then
+ local Enabled = Request.Params:get("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=\"GET\">"
+ Content = Content .. "<input type=\"text\" name=\"whitelist-add\"><input type=\"submit\" value=\"Add player\">"
+ Content = Content .. "</form>"
+ Content = Content .. "<form method=\"GET\">"
+ 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 |