summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--MCServer/Plugins/Core/back.lua9
-rw-r--r--MCServer/Plugins/Core/main.lua5
-rw-r--r--MCServer/Plugins/Core/onplayerjoined.lua1
-rw-r--r--MCServer/Plugins/Core/saveall.lua5
-rw-r--r--MCServer/Plugins/Core/spawn.lua3
-rw-r--r--MCServer/Plugins/Core/teleport.lua23
-rw-r--r--MCServer/Plugins/Core/top.lua4
-rw-r--r--MCServer/Plugins/Core/web_chat.lua17
8 files changed, 56 insertions, 11 deletions
diff --git a/MCServer/Plugins/Core/back.lua b/MCServer/Plugins/Core/back.lua
new file mode 100644
index 000000000..e57f224f2
--- /dev/null
+++ b/MCServer/Plugins/Core/back.lua
@@ -0,0 +1,9 @@
+function HandleBackCommand( Split, Player )
+ if (X[Player:GetName()] == nil) or (Y[Player:GetName()] == nil) or (Z[Player:GetName()] == nil) then
+ Player:SendMessage(cChatColor.Green .. "There is no last position known")
+ else
+ Player:TeleportTo(X[Player:GetName()], Y[Player:GetName()], Z[Player:GetName()])
+ Player:SendMessage(cChatColor.Green .. "You teleported back to your last known position")
+ end
+ return true
+end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/main.lua b/MCServer/Plugins/Core/main.lua
index d9049bfda..579ee4df3 100644
--- a/MCServer/Plugins/Core/main.lua
+++ b/MCServer/Plugins/Core/main.lua
@@ -7,6 +7,9 @@ SHOW_PLUGIN_NAMES = true -- If true, plugin name will be shown before commands
PLUGIN = {} -- Reference to own plugin object
BannedPlayersIni = {}
WhiteListIni = {}
+X = {}
+Y = {}
+Z = {}
@@ -27,6 +30,8 @@ function Initialize(Plugin)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_CRAFTING_NO_RECIPE)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHAT) -- used in web_chat.lua
+ 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("/pluginlist", "core.pluginlist", HandlePluginListCommand, " - Show list of plugins");
PluginManager:BindCommand("/tp", "core.teleport", HandleTPCommand, " [Player] - Teleport yourself to a player");
diff --git a/MCServer/Plugins/Core/onplayerjoined.lua b/MCServer/Plugins/Core/onplayerjoined.lua
index 8aa067a0c..334307000 100644
--- a/MCServer/Plugins/Core/onplayerjoined.lua
+++ b/MCServer/Plugins/Core/onplayerjoined.lua
@@ -1,4 +1,5 @@
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/saveall.lua b/MCServer/Plugins/Core/saveall.lua
new file mode 100644
index 000000000..1dd12335b
--- /dev/null
+++ b/MCServer/Plugins/Core/saveall.lua
@@ -0,0 +1,5 @@
+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 73034d9cf..2938318b2 100644
--- a/MCServer/Plugins/Core/spawn.lua
+++ b/MCServer/Plugins/Core/spawn.lua
@@ -1,5 +1,8 @@
function HandleSpawnCommand( Split, Player )
World = Player:GetWorld()
+ X[Player:GetName()] = Player:GetPosX()
+ Y[Player:GetName()] = Player:GetPosY()
+ Z[Player:GetName()] = Player:GetPosZ()
Player:TeleportTo( World:GetSpawnX(), World:GetSpawnY(), World:GetSpawnZ() )
LOGINFO( Player:GetName() .. " returned to spawn." )
return true
diff --git a/MCServer/Plugins/Core/teleport.lua b/MCServer/Plugins/Core/teleport.lua
index 90eb3529a..b991b6185 100644
--- a/MCServer/Plugins/Core/teleport.lua
+++ b/MCServer/Plugins/Core/teleport.lua
@@ -1,23 +1,26 @@
function HandleTPCommand( Split, Player )
- if( #Split ~= 2 ) then
- Player:SendMessage( cChatColor.Green .. "Usage: /tp [PlayerName]" )
+ if( Split[2] == nil ) then
+ Player:SendMessage( cChatColor.Green .. "Usage: /tp [PlayerName] (-h)" )
return true
end
- World = Player:GetWorld()
-
local TeleportDestination = function(OtherPlayer)
if( OtherPlayer == Player ) then
Player:SendMessage( cChatColor.Green .. "Already there :)" )
else
+ X[Player:GetName()] = Player:GetPosX()
+ Y[Player:GetName()] = Player:GetPosY()
+ Z[Player:GetName()] = Player:GetPosZ()
Player:TeleportToEntity( OtherPlayer )
Player:SendMessage( cChatColor.Green .. "You teleported to "..OtherPlayer:GetName().."!" )
- OtherPlayer:SendMessage( cChatColor.Green .. Player:GetName().." teleported to you!" )
+ if Split[3] ~= "-h" then
+ OtherPlayer:SendMessage( cChatColor.Green .. Player:GetName().." teleported to you!" )
+ end
end
- end
-
- if (not(World:DoWithPlayer(Split[2], TeleportDestination))) then
+ end
+ World = Player:GetWorld()
+ if (not(World:DoWithPlayer(Split[2], TeleportDestination))) then
Player:SendMessage( cChatColor.Green .. "Can't find player " .. Split[2] )
- end
+ end
return true
-end \ No newline at end of file
+end
diff --git a/MCServer/Plugins/Core/top.lua b/MCServer/Plugins/Core/top.lua
index 0f7a8f95f..91f9aa297 100644
--- a/MCServer/Plugins/Core/top.lua
+++ b/MCServer/Plugins/Core/top.lua
@@ -3,7 +3,9 @@ function HandleTopCommand( Split, Player )
local PlayerPos = Player:GetPosition()
local Height = World:GetHeight( math.floor(PlayerPos.x), math.floor(PlayerPos.z) )
-
+ X[Player:GetName()] = Player:GetPosX()
+ Y[Player:GetName()] = Player:GetPosY()
+ Z[Player:GetName()] = Player:GetPosZ()
Player:TeleportTo( PlayerPos.x, Height+1, PlayerPos.z )
Player:SendMessage("Teleported to the top block")
diff --git a/MCServer/Plugins/Core/web_chat.lua b/MCServer/Plugins/Core/web_chat.lua
index 4ee679729..dd03203bd 100644
--- a/MCServer/Plugins/Core/web_chat.lua
+++ b/MCServer/Plugins/Core/web_chat.lua
@@ -125,6 +125,23 @@ function HandleRequest_Chat( Request )
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"] )