summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MCServer/Plugins/Core/ban-unban.lua2
-rw-r--r--MCServer/Plugins/Core/console.lua4
-rw-r--r--MCServer/Plugins/Core/help.lua2
-rw-r--r--MCServer/Plugins/Core/main.lua80
-rw-r--r--MCServer/Plugins/Core/me.lua16
-rw-r--r--MCServer/Plugins/Core/onbreakplaceblock.lua184
-rw-r--r--MCServer/Plugins/Core/ondeath.lua2
-rw-r--r--MCServer/Plugins/Core/onjoinleave.lua6
-rw-r--r--MCServer/Plugins/Core/onlogin.lua2
-rw-r--r--MCServer/Plugins/Core/portal-worlds.lua2
-rw-r--r--MCServer/Plugins/Core/rank-groups.lua2
-rw-r--r--MCServer/Plugins/Core/save-reload-stop.lua10
-rw-r--r--MCServer/Plugins/Core/spawn.lua2
-rw-r--r--MCServer/Plugins/Core/teleport.lua78
-rw-r--r--MCServer/Plugins/Core/web_serversettings.lua10
-rw-r--r--MCServer/Plugins/Core/worldlimiter.lua2
-rw-r--r--MCServer/Plugins/Debuggers/Debuggers.lua12
-rw-r--r--Tools/ProtoProxy/Connection.cpp44
-rw-r--r--Tools/ProtoProxy/Connection.h2
-rw-r--r--source/Bindings.cpp3
-rw-r--r--source/Bindings.h2
-rw-r--r--source/ClientHandle.cpp30
-rw-r--r--source/ClientHandle.h130
-rw-r--r--source/Player.cpp9
-rw-r--r--source/Plugin.cpp12
-rw-r--r--source/Plugin.h75
-rw-r--r--source/PluginManager.cpp43
-rw-r--r--source/PluginManager.h84
-rw-r--r--source/Plugin_NewLua.cpp104
-rw-r--r--source/Plugin_NewLua.h75
-rw-r--r--source/Protocol/Protocol.h105
-rw-r--r--source/Protocol/Protocol125.cpp10
-rw-r--r--source/Protocol/Protocol125.h105
-rw-r--r--source/Protocol/Protocol132.cpp40
-rw-r--r--source/Protocol/Protocol132.h30
-rw-r--r--source/Protocol/ProtocolRecognizer.cpp10
-rw-r--r--source/Protocol/ProtocolRecognizer.h105
-rw-r--r--source/World.cpp18
-rw-r--r--source/World.h3
39 files changed, 861 insertions, 594 deletions
diff --git a/MCServer/Plugins/Core/ban-unban.lua b/MCServer/Plugins/Core/ban-unban.lua
index da9ee2d6c..1ad9b7e75 100644
--- a/MCServer/Plugins/Core/ban-unban.lua
+++ b/MCServer/Plugins/Core/ban-unban.lua
@@ -39,7 +39,7 @@ function BanPlayer(PlayerName, Reason)
end
function HandleUnbanCommand( Split, Player )
- if( #Split < 2 ) then
+ if( #Split < 2 ) then
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /unban [Player]" )
return true
end
diff --git a/MCServer/Plugins/Core/console.lua b/MCServer/Plugins/Core/console.lua
index b1c454d59..7c1e6abde 100644
--- a/MCServer/Plugins/Core/console.lua
+++ b/MCServer/Plugins/Core/console.lua
@@ -5,7 +5,7 @@ function InitConsoleCommands()
-- 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("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");
@@ -40,7 +40,7 @@ function HandleConsoleBan(Split)
end
function HandleConsoleUnban(Split)
- if( #Split < 2 ) then
+ if( #Split < 2 ) then
return true, "Usage: /unban [Player]"
end
diff --git a/MCServer/Plugins/Core/help.lua b/MCServer/Plugins/Core/help.lua
index 339fc054b..9ec79e056 100644
--- a/MCServer/Plugins/Core/help.lua
+++ b/MCServer/Plugins/Core/help.lua
@@ -32,7 +32,7 @@ function HandleHelpCommand(Split, Player)
-- 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.");
+ Player:SendMessage(cChatColor.Purple .. "'-' means no prefix, '~' means a value is required.");
for idx, msg in ipairs(Output) do
Player:SendMessage(msg);
end;
diff --git a/MCServer/Plugins/Core/main.lua b/MCServer/Plugins/Core/main.lua
index 755ec4db8..3fd9c6585 100644
--- a/MCServer/Plugins/Core/main.lua
+++ b/MCServer/Plugins/Core/main.lua
@@ -13,10 +13,10 @@ function Initialize(Plugin)
Plugin:SetName("Core")
Plugin:SetVersion(13)
- --ADD HOOKS
+ --ADD HOOKS
PluginManager = cRoot:Get():GetPluginManager()
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_JOINED)
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_DISCONNECT)
+ 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)
@@ -25,9 +25,9 @@ function Initialize(Plugin)
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");
+ --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");
@@ -46,10 +46,10 @@ function Initialize(Plugin)
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("/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("/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")
@@ -63,27 +63,27 @@ function Initialize(Plugin)
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?)
+
+ 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
+ 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" )
@@ -120,7 +120,7 @@ function Initialize(Plugin)
end
end
- --ADD WEB INTERFACE TABULATES
+ --ADD WEB INTERFACE TABULATES
Plugin:AddWebTab("Manage Server", HandleRequest_ManageServer);
Plugin:AddWebTab("Server Settings", HandleRequest_ServerSettings);
Plugin:AddWebTab("Chat", HandleRequest_Chat);
@@ -132,7 +132,7 @@ function Initialize(Plugin)
LoadMotd()
LOG( "Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion() )
- return true
+ return true
end
--AWESOMENESS STILL GOING!
@@ -140,12 +140,12 @@ end
function WriteLog(breakPlace, X, Y, Z, player, id, meta)
local logText = {}
- table.insert(logText, player)
+ table.insert(logText, player)
table.insert(logText, " tried to ")
if breakPlace == 0 then
- table.insert(logText, "break ")
- else
+ table.insert(logText, "break ")
+ else
table.insert(logText, "place ")
end
@@ -159,23 +159,23 @@ function WriteLog(breakPlace, X, Y, Z, player, id, meta)
table.insert(logText, tostring(Z))
table.insert(logText, ".")
- LOGINFO(table.concat(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
+ 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!")
+ LOG( "Disabled Core!")
end
--END AWESOMENESS :'(
diff --git a/MCServer/Plugins/Core/me.lua b/MCServer/Plugins/Core/me.lua
index 5ae15b97d..783c15556 100644
--- a/MCServer/Plugins/Core/me.lua
+++ b/MCServer/Plugins/Core/me.lua
@@ -4,12 +4,12 @@ function HandleMeCommand( Split, Player )
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
+ 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/onbreakplaceblock.lua b/MCServer/Plugins/Core/onbreakplaceblock.lua
index 49b3226c2..5eddc1511 100644
--- a/MCServer/Plugins/Core/onbreakplaceblock.lua
+++ b/MCServer/Plugins/Core/onbreakplaceblock.lua
@@ -4,116 +4,116 @@ function OnPlayerPlacingBlock(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX
return false
end
- local PROTECTRADIUS = WorldsSpawnProtect[Player:GetWorld():GetName()];
+ 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 (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
+ 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)
+ --WriteLog(1, BlockX, BlockY, BlockZ, Player:GetName(), id, meta)
- WarnPlayer(Player)
+ 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
+ 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
+ -- dont check if the direction is in the air
if (BlockFace ~= -1) then
- local PROTECTRADIUS = WorldsSpawnProtect[Player:GetWorld():GetName()];
+ 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)
+ 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 true
+ end
+ end
+ end
return false
end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/ondeath.lua b/MCServer/Plugins/Core/ondeath.lua
index 463890751..a5f8f6745 100644
--- a/MCServer/Plugins/Core/ondeath.lua
+++ b/MCServer/Plugins/Core/ondeath.lua
@@ -3,7 +3,7 @@ function OnKilling(Victim, Killer)
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
+ 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
diff --git a/MCServer/Plugins/Core/onjoinleave.lua b/MCServer/Plugins/Core/onjoinleave.lua
index 34b1a29ae..7acef47de 100644
--- a/MCServer/Plugins/Core/onjoinleave.lua
+++ b/MCServer/Plugins/Core/onjoinleave.lua
@@ -1,11 +1,11 @@
function OnPlayerJoined(Player)
ShowMOTDTo( Player )
- local Server = cRoot:Get():GetServer()
+ 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" )
+ 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/onlogin.lua b/MCServer/Plugins/Core/onlogin.lua
index 4b2f24f17..cc79bb0ae 100644
--- a/MCServer/Plugins/Core/onlogin.lua
+++ b/MCServer/Plugins/Core/onlogin.lua
@@ -4,7 +4,7 @@ function OnLogin(Client, ProtocolVersion, Username)
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
+ 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
diff --git a/MCServer/Plugins/Core/portal-worlds.lua b/MCServer/Plugins/Core/portal-worlds.lua
index e0de77c85..da48f1637 100644
--- a/MCServer/Plugins/Core/portal-worlds.lua
+++ b/MCServer/Plugins/Core/portal-worlds.lua
@@ -15,7 +15,7 @@ function HandlePortalCommand( Split, Player )
end
function HandleWorldsCommand( Split, Player )
- local SettingsIni = cIniFile("settings.ini")
+ local SettingsIni = cIniFile("settings.ini")
if SettingsIni:ReadFile() == false then
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "No worlds found" )
end
diff --git a/MCServer/Plugins/Core/rank-groups.lua b/MCServer/Plugins/Core/rank-groups.lua
index 04050fc80..bb7d2ae5c 100644
--- a/MCServer/Plugins/Core/rank-groups.lua
+++ b/MCServer/Plugins/Core/rank-groups.lua
@@ -33,7 +33,7 @@ function HandleRankCommand( Split, Player )
end
function HandleGroupsCommand( Split, Player )
- local GroupsIni = cIniFile("groups.ini")
+ local GroupsIni = cIniFile("groups.ini")
if GroupsIni:ReadFile() == false then
Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "No groups found" )
end
diff --git a/MCServer/Plugins/Core/save-reload-stop.lua b/MCServer/Plugins/Core/save-reload-stop.lua
index c4aa030cb..976052fc7 100644
--- a/MCServer/Plugins/Core/save-reload-stop.lua
+++ b/MCServer/Plugins/Core/save-reload-stop.lua
@@ -1,21 +1,21 @@
function HandleSaveAllCommand( Split, Player )
cRoot:Get():SaveAllChunks();
- local Server = cRoot:Get():GetServer()
+ 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 = 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 = cRoot:Get():GetServer()
+ local Server = cRoot:Get():GetServer()
Server:SendMessage(cChatColor.Rose .. "[WARNING] " .. cChatColor.White .. "Reloading all plugins!" )
cRoot:Get():GetPluginManager():ReloadPlugins()
return true
diff --git a/MCServer/Plugins/Core/spawn.lua b/MCServer/Plugins/Core/spawn.lua
index 09ada3ada..d1ef7399b 100644
--- a/MCServer/Plugins/Core/spawn.lua
+++ b/MCServer/Plugins/Core/spawn.lua
@@ -2,6 +2,6 @@ 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" )
+ 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/teleport.lua b/MCServer/Plugins/Core/teleport.lua
index 3ba5e36ef..1e2cab6f7 100644
--- a/MCServer/Plugins/Core/teleport.lua
+++ b/MCServer/Plugins/Core/teleport.lua
@@ -16,45 +16,45 @@ function HandleTPCommand(a_Split, a_Player)
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
+ 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
+ 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
@@ -73,8 +73,8 @@ function TeleportToPlayer(a_SrcPlayer, a_DstPlayerName, a_TellDst)
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);
+ 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/web_serversettings.lua b/MCServer/Plugins/Core/web_serversettings.lua
index 75f9b46c2..a53756b21 100644
--- a/MCServer/Plugins/Core/web_serversettings.lua
+++ b/MCServer/Plugins/Core/web_serversettings.lua
@@ -43,8 +43,8 @@ local function ShowGeneralSettings( Request )
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 )
+ 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
@@ -363,7 +363,7 @@ function ShowWorldSettings( Request )
WorldIni:DeleteValue( "SpawnPosition", "Z" )
WorldIni:SetValue( "SpawnPosition", "Z", Request.PostParams["World_SpawnZ"] )
end
- if( tonumber( Request.PostParams["LimitWorldWidth"] ) ~= nil ) then
+ if( tonumber( Request.PostParams["LimitWorldWidth"] ) ~= nil ) then
WorldIni:DeleteValue( "WorldLimit", "LimitRadius" )
WorldIni:SetValue( "WorldLimit", "LimitRadius", Request.PostParams["LimitWorldWidth"] )
end
@@ -669,8 +669,8 @@ function ShowWorldSettings( Request )
<td><input type="text" name="World_SpawnZ" value="]] .. WorldIni:GetValue("SpawnPosition", "Z") .. [["></td></tr>
</table>
<br />
- <table>
- <th colspan="2">LimitWorld</th>
+ <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 />
diff --git a/MCServer/Plugins/Core/worldlimiter.lua b/MCServer/Plugins/Core/worldlimiter.lua
index 8fd3287b2..1bb1b4fc6 100644
--- a/MCServer/Plugins/Core/worldlimiter.lua
+++ b/MCServer/Plugins/Core/worldlimiter.lua
@@ -1,5 +1,5 @@
function OnPlayerMoving( Player )
- LimitWorldWidth = WorldsWorldLimit[Player:GetWorld():GetName()]
+ LimitWorldWidth = WorldsWorldLimit[Player:GetWorld():GetName()]
if LimitWorldWidth > 0 then
local World = Player:GetWorld()
local SpawnX = math.floor(World:GetSpawnX() / 16)
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua
index ab3397f74..f26b9a98d 100644
--- a/MCServer/Plugins/Debuggers/Debuggers.lua
+++ b/MCServer/Plugins/Debuggers/Debuggers.lua
@@ -21,7 +21,8 @@ function Initialize(Plugin)
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");
@@ -484,6 +485,15 @@ 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)
diff --git a/Tools/ProtoProxy/Connection.cpp b/Tools/ProtoProxy/Connection.cpp
index 7c808f2c1..fd7914bb6 100644
--- a/Tools/ProtoProxy/Connection.cpp
+++ b/Tools/ProtoProxy/Connection.cpp
@@ -193,6 +193,7 @@ enum
PACKET_PLAYER_LIST_ITEM = 0xc9,
PACKET_PLAYER_ABILITIES = 0xca,
PACKET_INCREMENT_STATISTIC = 0xc8,
+ PACKET_TAB_COMPLETION = 0xcb,
PACKET_LOCALE_AND_VIEW = 0xcc,
PACKET_CLIENT_STATUSES = 0xcd,
PACKET_PLUGIN_MESSAGE = 0xfa,
@@ -579,6 +580,7 @@ bool cConnection::DecodeClientsPackets(const char * a_Data, int a_Size)
case PACKET_PLAYER_POSITION_LOOK: HANDLE_CLIENT_READ(HandleClientPlayerPositionLook); break;
case PACKET_PLUGIN_MESSAGE: HANDLE_CLIENT_READ(HandleClientPluginMessage); break;
case PACKET_SLOT_SELECT: HANDLE_CLIENT_READ(HandleClientSlotSelect); break;
+ case PACKET_TAB_COMPLETION: HANDLE_CLIENT_READ(HandleClientTabCompletion); break;
case PACKET_UPDATE_SIGN: HANDLE_CLIENT_READ(HandleClientUpdateSign); break;
case PACKET_USE_ENTITY: HANDLE_CLIENT_READ(HandleClientUseEntity); break;
case PACKET_WINDOW_CLICK: HANDLE_CLIENT_READ(HandleClientWindowClick); break;
@@ -687,6 +689,7 @@ bool cConnection::DecodeServersPackets(const char * a_Data, int a_Size)
case PACKET_SPAWN_OBJECT_VEHICLE: HANDLE_SERVER_READ(HandleServerSpawnObjectVehicle); break;
case PACKET_SPAWN_PAINTING: HANDLE_SERVER_READ(HandleServerSpawnPainting); break;
case PACKET_SPAWN_PICKUP: HANDLE_SERVER_READ(HandleServerSpawnPickup); break;
+ case PACKET_TAB_COMPLETION: HANDLE_SERVER_READ(HandleServerTabCompletion); break;
case PACKET_TIME_UPDATE: HANDLE_SERVER_READ(HandleServerTimeUpdate); break;
case PACKET_UPDATE_HEALTH: HANDLE_SERVER_READ(HandleServerUpdateHealth); break;
case PACKET_UPDATE_SIGN: HANDLE_SERVER_READ(HandleServerUpdateSign); break;
@@ -1072,6 +1075,19 @@ bool cConnection::HandleClientSlotSelect(void)
+bool cConnection::HandleClientTabCompletion(void)
+{
+ HANDLE_CLIENT_PACKET_READ(ReadBEUTF16String16, AString, Query);
+ Log("Received a PACKET_TAB_COMPLETION query from the client");
+ Log(" Query = \"%s\"", Query.c_str());
+ COPY_TO_SERVER();
+ return true;
+}
+
+
+
+
+
bool cConnection::HandleClientUpdateSign(void)
{
HANDLE_CLIENT_PACKET_READ(ReadBEInt, int, BlockX);
@@ -2103,6 +2119,34 @@ bool cConnection::HandleServerSpawnPickup(void)
+bool cConnection::HandleServerTabCompletion(void)
+{
+ HANDLE_SERVER_PACKET_READ(ReadBEUTF16String16, AString, Results);
+ Log("Received a PACKET_TAB_COMPLETION from the server, results given:");
+
+ // Parse the zero-terminated list of results:
+ size_t len = Results.size();
+ size_t last = 0;
+ for (size_t i = 0; i < len; i++)
+ {
+ if (Results[i] == 0)
+ {
+ Log(" \"%s\"", Results.substr(last, i - last).c_str());
+ last = i + 1;
+ }
+ }
+ if (last < len)
+ {
+ Log(" \"%s\"", Results.substr(last, len - last).c_str());
+ }
+ COPY_TO_CLIENT();
+ return true;
+}
+
+
+
+
+
bool cConnection::HandleServerTimeUpdate(void)
{
HANDLE_SERVER_PACKET_READ(ReadBEInt64, Int64, WorldAge);
diff --git a/Tools/ProtoProxy/Connection.h b/Tools/ProtoProxy/Connection.h
index 942ee6e06..8d466c62d 100644
--- a/Tools/ProtoProxy/Connection.h
+++ b/Tools/ProtoProxy/Connection.h
@@ -128,6 +128,7 @@ protected:
bool HandleClientPlayerPositionLook(void);
bool HandleClientPluginMessage(void);
bool HandleClientSlotSelect(void);
+ bool HandleClientTabCompletion(void);
bool HandleClientUpdateSign(void);
bool HandleClientUseEntity(void);
bool HandleClientWindowClick(void);
@@ -177,6 +178,7 @@ protected:
bool HandleServerSpawnObjectVehicle(void);
bool HandleServerSpawnPainting(void);
bool HandleServerSpawnPickup(void);
+ bool HandleServerTabCompletion(void);
bool HandleServerTimeUpdate(void);
bool HandleServerUpdateHealth(void);
bool HandleServerUpdateSign(void);
diff --git a/source/Bindings.cpp b/source/Bindings.cpp
index 40927fe96..df45cb1b3 100644
--- a/source/Bindings.cpp
+++ b/source/Bindings.cpp
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 07/29/13 19:22:49.
+** Generated automatically by tolua++-1.0.92 on 08/02/13 08:41:18.
*/
#ifndef __cplusplus
@@ -29459,6 +29459,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_constant(tolua_S,"HOOK_PLAYER_PLACED_BLOCK",cPluginManager::HOOK_PLAYER_PLACED_BLOCK);
tolua_constant(tolua_S,"HOOK_PLAYER_PLACING_BLOCK",cPluginManager::HOOK_PLAYER_PLACING_BLOCK);
tolua_constant(tolua_S,"HOOK_PLAYER_RIGHT_CLICK",cPluginManager::HOOK_PLAYER_RIGHT_CLICK);
+ tolua_constant(tolua_S,"HOOK_PLAYER_RIGHT_CLICKING_ENTITY",cPluginManager::HOOK_PLAYER_RIGHT_CLICKING_ENTITY);
tolua_constant(tolua_S,"HOOK_PLAYER_SHOOTING",cPluginManager::HOOK_PLAYER_SHOOTING);
tolua_constant(tolua_S,"HOOK_PLAYER_SPAWNED",cPluginManager::HOOK_PLAYER_SPAWNED);
tolua_constant(tolua_S,"HOOK_PLAYER_TOSSING_ITEM",cPluginManager::HOOK_PLAYER_TOSSING_ITEM);
diff --git a/source/Bindings.h b/source/Bindings.h
index b2f26025c..6dfe855d3 100644
--- a/source/Bindings.h
+++ b/source/Bindings.h
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 07/29/13 19:22:49.
+** Generated automatically by tolua++-1.0.92 on 08/02/13 08:41:19.
*/
/* Exported function */
diff --git a/source/ClientHandle.cpp b/source/ClientHandle.cpp
index 526d00b98..52c4b3061 100644
--- a/source/ClientHandle.cpp
+++ b/source/ClientHandle.cpp
@@ -1070,6 +1070,10 @@ void cClientHandle::HandleUseEntity(int a_TargetEntityID, bool a_IsLeftClick)
cPlayer & m_Player;
virtual bool Item(cEntity * a_Entity) override
{
+ if (cPluginManager::Get()->CallHookPlayerRightClickingEntity(m_Player, *a_Entity))
+ {
+ return false;
+ }
a_Entity->OnRightClicked(m_Player);
return false;
}
@@ -1235,6 +1239,23 @@ void cClientHandle::HandleUnmount(void)
+void cClientHandle::HandleTabCompletion(const AString & a_Text)
+{
+ AStringVector Results;
+ m_Player->GetWorld()->TabCompleteUserName(a_Text, Results);
+ cRoot::Get()->GetPluginManager()->TabCompleteCommand(a_Text, Results, m_Player);
+ if (Results.empty())
+ {
+ return;
+ }
+ std::sort(Results.begin(), Results.end());
+ SendTabCompletionResults(Results);
+}
+
+
+
+
+
void cClientHandle::SendData(const char * a_Data, int a_Size)
{
{
@@ -1781,6 +1802,15 @@ void cClientHandle::SendSpawnVehicle(const cEntity & a_Vehicle, char a_VehicleTy
+void cClientHandle::SendTabCompletionResults(const AStringVector & a_Results)
+{
+ m_Protocol->SendTabCompletionResults(a_Results);
+}
+
+
+
+
+
void cClientHandle::SendTeleportEntity(const cEntity & a_Entity)
{
m_Protocol->SendTeleportEntity(a_Entity);
diff --git a/source/ClientHandle.h b/source/ClientHandle.h
index 0f1daa72c..73edaf73c 100644
--- a/source/ClientHandle.h
+++ b/source/ClientHandle.h
@@ -87,56 +87,57 @@ public:
// The following functions send the various packets:
// (Please keep these alpha-sorted)
- void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle);
- void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType);
- void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage);
- void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); // tolua_export
- void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes);
- void SendChat (const AString & a_Message);
- void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer);
- void SendCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player);
- void SendDestroyEntity (const cEntity & a_Entity);
- void SendDisconnect (const AString & a_Reason);
- void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ);
- void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item);
- void SendEntityHeadLook (const cEntity & a_Entity);
- void SendEntityLook (const cEntity & a_Entity);
- void SendEntityMetadata (const cEntity & a_Entity);
- void SendEntityProperties (const cEntity & a_Entity);
- void SendEntityRelMove (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ);
- void SendEntityRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ);
- void SendEntityStatus (const cEntity & a_Entity, char a_Status);
- void SendEntityVelocity (const cEntity & a_Entity);
- void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion);
- void SendGameMode (eGameMode a_GameMode);
- void SendHealth (void);
- void SendInventoryProgress (char a_WindowID, short a_Progressbar, short a_Value);
- void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item);
- void SendPickupSpawn (const cPickup & a_Pickup);
- void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation);
- void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline);
- void SendPlayerMaxSpeed (void); ///< Informs the client of the maximum player speed (1.6.1+)
- void SendPlayerMoveLook (void);
- void SendPlayerPosition (void);
- void SendPlayerSpawn (const cPlayer & a_Player);
- void SendRespawn (void);
- void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch); // a_Src coords are Block * 8
- void SendSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data);
- void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock);
- void SendSpawnMob (const cMonster & a_Mob);
- void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch);
- void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType);
- void SendTeleportEntity (const cEntity & a_Entity);
- void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ);
- void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay);
- void SendUnloadChunk (int a_ChunkX, int a_ChunkZ);
- void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4);
- void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ );
- void SendWeather (eWeather a_Weather);
- void SendWholeInventory (const cInventory & a_Inventory);
- void SendWholeInventory (const cWindow & a_Window);
- void SendWindowClose (const cWindow & a_Window);
- void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots);
+ void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle);
+ void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType);
+ void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage);
+ void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); // tolua_export
+ void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes);
+ void SendChat (const AString & a_Message);
+ void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer);
+ void SendCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player);
+ void SendDestroyEntity (const cEntity & a_Entity);
+ void SendDisconnect (const AString & a_Reason);
+ void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ);
+ void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item);
+ void SendEntityHeadLook (const cEntity & a_Entity);
+ void SendEntityLook (const cEntity & a_Entity);
+ void SendEntityMetadata (const cEntity & a_Entity);
+ void SendEntityProperties (const cEntity & a_Entity);
+ void SendEntityRelMove (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ);
+ void SendEntityRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ);
+ void SendEntityStatus (const cEntity & a_Entity, char a_Status);
+ void SendEntityVelocity (const cEntity & a_Entity);
+ void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion);
+ void SendGameMode (eGameMode a_GameMode);
+ void SendHealth (void);
+ void SendInventoryProgress (char a_WindowID, short a_Progressbar, short a_Value);
+ void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item);
+ void SendPickupSpawn (const cPickup & a_Pickup);
+ void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation);
+ void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline);
+ void SendPlayerMaxSpeed (void); ///< Informs the client of the maximum player speed (1.6.1+)
+ void SendPlayerMoveLook (void);
+ void SendPlayerPosition (void);
+ void SendPlayerSpawn (const cPlayer & a_Player);
+ void SendRespawn (void);
+ void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch); // a_Src coords are Block * 8
+ void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data);
+ void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock);
+ void SendSpawnMob (const cMonster & a_Mob);
+ void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch);
+ void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType);
+ void SendTabCompletionResults(const AStringVector & a_Results);
+ void SendTeleportEntity (const cEntity & a_Entity);
+ void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ);
+ void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay);
+ void SendUnloadChunk (int a_ChunkX, int a_ChunkZ);
+ void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4);
+ void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ );
+ void SendWeather (eWeather a_Weather);
+ void SendWholeInventory (const cInventory & a_Inventory);
+ void SendWholeInventory (const cWindow & a_Window);
+ void SendWindowClose (const cWindow & a_Window);
+ void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots);
const AString & GetUsername(void) const; // tolua_export
void SetUsername( const AString & a_Username ); // tolua_export
@@ -160,31 +161,32 @@ public:
void PacketError(unsigned char a_PacketType);
// Calls that cProtocol descendants use for handling packets:
- void HandlePing (void);
+ void HandleAnimation (char a_Animation);
+ void HandleChat (const AString & a_Message);
void HandleCreativeInventory(short a_SlotNum, const cItem & a_HeldItem);
- void HandlePlayerPos (double a_PosX, double a_PosY, double a_PosZ, double a_Stance, bool a_IsOnGround);
+ void HandleDisconnect (const AString & a_Reason);
+ void HandleEntityAction (int a_EntityID, char a_ActionID);
+ bool HandleHandshake (const AString & a_Username);
+ void HandleKeepAlive (int a_KeepAliveID);
void HandleLeftClick (int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status);
- void HandleRightClick (int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, const cItem & a_HeldItem);
- void HandleChat (const AString & a_Message);
+ void HandlePing (void);
void HandlePlayerLook (float a_Rotation, float a_Pitch, bool a_IsOnGround);
void HandlePlayerMoveLook (double a_PosX, double a_PosY, double a_PosZ, double a_Stance, float a_Rotation, float a_Pitch, bool a_IsOnGround); // While m_bPositionConfirmed (normal gameplay)
- void HandleAnimation (char a_Animation);
+ void HandlePlayerPos (double a_PosX, double a_PosY, double a_PosZ, double a_Stance, bool a_IsOnGround);
+ void HandleRespawn (void);
+ void HandleRightClick (int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, const cItem & a_HeldItem);
void HandleSlotSelected (short a_SlotNum);
- void HandleWindowClose (char a_WindowID);
- void HandleWindowClick (char a_WindowID, short a_SlotNum, eClickAction a_ClickAction, const cItem & a_HeldItem);
+ void HandleTabCompletion (const AString & a_Text);
void HandleUpdateSign (
int a_BlockX, int a_BlockY, int a_BlockZ,
const AString & a_Line1, const AString & a_Line2,
const AString & a_Line3, const AString & a_Line4
);
- void HandleUseEntity (int a_TargetEntityID, bool a_IsLeftClick);
- void HandleRespawn (void);
- void HandleDisconnect (const AString & a_Reason);
- void HandleKeepAlive (int a_KeepAliveID);
- bool HandleHandshake (const AString & a_Username);
- void HandleEntityAction (int a_EntityID, char a_ActionID);
void HandleUnmount (void);
-
+ void HandleUseEntity (int a_TargetEntityID, bool a_IsLeftClick);
+ void HandleWindowClick (char a_WindowID, short a_SlotNum, eClickAction a_ClickAction, const cItem & a_HeldItem);
+ void HandleWindowClose (char a_WindowID);
+
/** Called when the protocol has finished logging the user in.
Return true to allow the user in; false to kick them.
*/
diff --git a/source/Player.cpp b/source/Player.cpp
index d59204e35..bbf39f789 100644
--- a/source/Player.cpp
+++ b/source/Player.cpp
@@ -50,7 +50,7 @@ cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName)
, m_TimeLastPickupCheck( 0.f )
, m_Color('-')
, m_ClientHandle( a_Client )
- , m_FoodLevel(20)
+ , m_FoodLevel(MAX_FOOD_LEVEL)
, m_FoodSaturationLevel(5)
, m_FoodTickTimer(0)
, m_FoodExhaustionLevel(0)
@@ -70,7 +70,8 @@ cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName)
m_CurrentWindow = m_InventoryWindow;
m_InventoryWindow->OpenedByPlayer(*this);
- SetMaxHealth(20);
+ SetMaxHealth(MAX_HEALTH);
+ m_Health = MAX_HEALTH;
cTimer t1;
m_LastPlayerListTime = t1.GetNowTime();
@@ -565,7 +566,7 @@ void cPlayer::Respawn(void)
m_Health = GetMaxHealth();
// Reset food level:
- m_FoodLevel = 20;
+ m_FoodLevel = MAX_FOOD_LEVEL;
m_FoodSaturationLevel = 5;
m_ClientHandle->SendRespawn();
@@ -1155,7 +1156,7 @@ bool cPlayer::LoadFromDisk()
cFile f;
if (!f.Open(SourceFile, cFile::fmRead))
{
- LOGWARNING("Cannot open player data file \"%s\" for reading", SourceFile.c_str());
+ // This is a new player whom we haven't seen yet, bail out, let them have the defaults
return false;
}
diff --git a/source/Plugin.cpp b/source/Plugin.cpp
index 23757f492..20943b916 100644
--- a/source/Plugin.cpp
+++ b/source/Plugin.cpp
@@ -2,7 +2,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Plugin.h"
-// #include "Pawn.h"
#include "Player.h"
#include "World.h"
#include "CommandOutput.h"
@@ -342,6 +341,17 @@ bool cPlugin::OnPlayerRightClick(cPlayer & a_Player, int a_BlockX, int a_BlockY,
+bool cPlugin::OnPlayerRightClickingEntity(cPlayer & a_Player, cEntity & a_Entity)
+{
+ UNUSED(a_Player);
+ UNUSED(a_Entity);
+ return false;
+}
+
+
+
+
+
bool cPlugin::OnPlayerShooting(cPlayer & a_Player)
{
UNUSED(a_Player);
diff --git a/source/Plugin.h b/source/Plugin.h
index edf3a7c9e..3b3feb99c 100644
--- a/source/Plugin.h
+++ b/source/Plugin.h
@@ -47,43 +47,44 @@ public:
* On all these functions, return true if you want to override default behavior and not call other plugins on that callback.
* You can also return false, so default behavior is used.
**/
- virtual bool OnBlockToPickups (cWorld * a_World, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cItems & a_Pickups);
- virtual bool OnChat (cPlayer * a_Player, AString & a_Message);
- virtual bool OnChunkAvailable (cWorld * a_World, int a_ChunkX, int a_ChunkZ);
- virtual bool OnChunkGenerated (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc);
- virtual bool OnChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc);
- virtual bool OnChunkUnloaded (cWorld * a_World, int a_ChunkX, int a_ChunkZ);
- virtual bool OnChunkUnloading (cWorld * a_World, int a_ChunkX, int a_ChunkZ);
- virtual bool OnCollectingPickup (cPlayer * a_Player, cPickup * a_Pickup);
- virtual bool OnCraftingNoRecipe (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
- virtual bool OnDisconnect (cPlayer * a_Player, const AString & a_Reason);
- virtual bool OnExecuteCommand (cPlayer * a_Player, const AStringVector & a_Split);
- virtual bool OnHandshake (cClientHandle * a_Client, const AString & a_Username);
- virtual bool OnKilling (cEntity & a_Victim, cEntity * a_Killer);
- virtual bool OnLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username);
- virtual bool OnPlayerBreakingBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
- virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
- virtual bool OnPlayerEating (cPlayer & a_Player);
- virtual bool OnPlayerJoined (cPlayer & a_Player);
- virtual bool OnPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status);
- virtual bool OnPlayerMoved (cPlayer & a_Player);
- virtual bool OnPlayerPlacedBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
- virtual bool OnPlayerPlacingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
- virtual bool OnPlayerRightClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ);
- virtual bool OnPlayerShooting (cPlayer & a_Player);
- virtual bool OnPlayerSpawned (cPlayer & a_Player);
- virtual bool OnPlayerTossingItem (cPlayer & a_Player);
- virtual bool OnPlayerUsedBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
- virtual bool OnPlayerUsedItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ);
- virtual bool OnPlayerUsingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
- virtual bool OnPlayerUsingItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ);
- virtual bool OnPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
- virtual bool OnPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
- virtual bool OnTakeDamage (cEntity & a_Receiver, TakeDamageInfo & a_TakeDamageInfo);
- virtual bool OnUpdatedSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player);
- virtual bool OnUpdatingSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4, cPlayer * a_Player);
- virtual bool OnWeatherChanged (cWorld & a_World);
- virtual bool OnWeatherChanging (cWorld & a_World, eWeather & a_NewWeather);
+ virtual bool OnBlockToPickups (cWorld * a_World, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cItems & a_Pickups);
+ virtual bool OnChat (cPlayer * a_Player, AString & a_Message);
+ virtual bool OnChunkAvailable (cWorld * a_World, int a_ChunkX, int a_ChunkZ);
+ virtual bool OnChunkGenerated (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc);
+ virtual bool OnChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc);
+ virtual bool OnChunkUnloaded (cWorld * a_World, int a_ChunkX, int a_ChunkZ);
+ virtual bool OnChunkUnloading (cWorld * a_World, int a_ChunkX, int a_ChunkZ);
+ virtual bool OnCollectingPickup (cPlayer * a_Player, cPickup * a_Pickup);
+ virtual bool OnCraftingNoRecipe (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
+ virtual bool OnDisconnect (cPlayer * a_Player, const AString & a_Reason);
+ virtual bool OnExecuteCommand (cPlayer * a_Player, const AStringVector & a_Split);
+ virtual bool OnHandshake (cClientHandle * a_Client, const AString & a_Username);
+ virtual bool OnKilling (cEntity & a_Victim, cEntity * a_Killer);
+ virtual bool OnLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username);
+ virtual bool OnPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
+ virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
+ virtual bool OnPlayerEating (cPlayer & a_Player);
+ virtual bool OnPlayerJoined (cPlayer & a_Player);
+ virtual bool OnPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status);
+ virtual bool OnPlayerMoved (cPlayer & a_Player);
+ virtual bool OnPlayerPlacedBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
+ virtual bool OnPlayerPlacingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
+ virtual bool OnPlayerRightClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ);
+ virtual bool OnPlayerRightClickingEntity(cPlayer & a_Player, cEntity & a_Entity);
+ virtual bool OnPlayerShooting (cPlayer & a_Player);
+ virtual bool OnPlayerSpawned (cPlayer & a_Player);
+ virtual bool OnPlayerTossingItem (cPlayer & a_Player);
+ virtual bool OnPlayerUsedBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
+ virtual bool OnPlayerUsedItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ);
+ virtual bool OnPlayerUsingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
+ virtual bool OnPlayerUsingItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ);
+ virtual bool OnPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
+ virtual bool OnPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
+ virtual bool OnTakeDamage (cEntity & a_Receiver, TakeDamageInfo & a_TakeDamageInfo);
+ virtual bool OnUpdatedSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player);
+ virtual bool OnUpdatingSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4, cPlayer * a_Player);
+ virtual bool OnWeatherChanged (cWorld & a_World);
+ virtual bool OnWeatherChanging (cWorld & a_World, eWeather & a_NewWeather);
/** Handles the command split into a_Split, issued by player a_Player.
Command permissions have already been checked.
diff --git a/source/PluginManager.cpp b/source/PluginManager.cpp
index b7a21a7ea..412200256 100644
--- a/source/PluginManager.cpp
+++ b/source/PluginManager.cpp
@@ -678,6 +678,27 @@ bool cPluginManager::CallHookPlayerRightClick(cPlayer & a_Player, int a_BlockX,
+bool cPluginManager::CallHookPlayerRightClickingEntity(cPlayer & a_Player, cEntity & a_Entity)
+{
+ HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_RIGHT_CLICKING_ENTITY);
+ if (Plugins == m_Hooks.end())
+ {
+ return false;
+ }
+ for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr)
+ {
+ if ((*itr)->OnPlayerRightClickingEntity(a_Player, a_Entity))
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+
+
+
bool cPluginManager::CallHookPlayerShooting(cPlayer & a_Player)
{
HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_SHOOTING);
@@ -1335,6 +1356,28 @@ bool cPluginManager::ExecuteConsoleCommand(const AStringVector & a_Split, cComma
+void cPluginManager::TabCompleteCommand(const AString & a_Text, AStringVector & a_Results, cPlayer * a_Player)
+{
+ for (CommandMap::iterator itr = m_Commands.begin(), end = m_Commands.end(); itr != end; ++itr)
+ {
+ if (NoCaseCompare(itr->first.substr(0, a_Text.length()), a_Text) != 0)
+ {
+ // Command name doesn't match
+ continue;
+ }
+ if ((a_Player != NULL) && !a_Player->HasPermission(itr->second.m_Permission))
+ {
+ // Player doesn't have permission for the command
+ continue;
+ }
+ a_Results.push_back(itr->first);
+ }
+}
+
+
+
+
+
bool cPluginManager::AddPlugin(cPlugin * a_Plugin)
{
m_Plugins[a_Plugin->GetDirectory()] = a_Plugin;
diff --git a/source/PluginManager.h b/source/PluginManager.h
index 3832ee455..26bd34dc5 100644
--- a/source/PluginManager.h
+++ b/source/PluginManager.h
@@ -15,6 +15,9 @@ class cWorld;
// fwd: ChunkDesc.h
class cChunkDesc;
+// fwd: Entityes/Entity.h
+class cEntity;
+
// fwd: Player.h
class cPlayer;
@@ -69,6 +72,7 @@ public: // tolua_export
HOOK_PLAYER_PLACED_BLOCK,
HOOK_PLAYER_PLACING_BLOCK,
HOOK_PLAYER_RIGHT_CLICK,
+ HOOK_PLAYER_RIGHT_CLICKING_ENTITY,
HOOK_PLAYER_SHOOTING,
HOOK_PLAYER_SPAWNED,
HOOK_PLAYER_TOSSING_ITEM,
@@ -114,43 +118,44 @@ public: // tolua_export
unsigned int GetNumPlugins() const; // tolua_export
- bool CallHookBlockToPickups (cWorld * a_World, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cItems & a_Pickups);
- bool CallHookChat (cPlayer * a_Player, AString & a_Message);
- bool CallHookChunkAvailable (cWorld * a_World, int a_ChunkX, int a_ChunkZ);
- bool CallHookChunkGenerated (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc);
- bool CallHookChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc);
- bool CallHookChunkUnloaded (cWorld * a_World, int a_ChunkX, int a_ChunkZ);
- bool CallHookChunkUnloading (cWorld * a_World, int a_ChunkX, int a_ChunkZ);
- bool CallHookCollectingPickup (cPlayer * a_Player, cPickup & a_Pickup);
- bool CallHookCraftingNoRecipe (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
- bool CallHookDisconnect (cPlayer * a_Player, const AString & a_Reason);
- bool CallHookExecuteCommand (cPlayer * a_Player, const AStringVector & a_Split); // If a_Player == NULL, it is a console cmd
- bool CallHookHandshake (cClientHandle * a_ClientHandle, const AString & a_Username);
- bool CallHookKilling (cEntity & a_Victim, cEntity * a_Killer);
- bool CallHookLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username);
- bool CallHookPlayerBreakingBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
- bool CallHookPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
- bool CallHookPlayerEating (cPlayer & a_Player);
- bool CallHookPlayerJoined (cPlayer & a_Player);
- bool CallHookPlayerMoving (cPlayer & a_Player);
- bool CallHookPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status);
- bool CallHookPlayerPlacedBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
- bool CallHookPlayerPlacingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
- bool CallHookPlayerRightClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ);
- bool CallHookPlayerShooting (cPlayer & a_Player);
- bool CallHookPlayerSpawned (cPlayer & a_Player);
- bool CallHookPlayerTossingItem (cPlayer & a_Player);
- bool CallHookPlayerUsedBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
- bool CallHookPlayerUsedItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ);
- bool CallHookPlayerUsingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
- bool CallHookPlayerUsingItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ);
- bool CallHookPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
- bool CallHookPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
- bool CallHookTakeDamage (cEntity & a_Receiver, TakeDamageInfo & a_TDI);
- bool CallHookUpdatedSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player);
- bool CallHookUpdatingSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4, cPlayer * a_Player);
- bool CallHookWeatherChanged (cWorld & a_World);
- bool CallHookWeatherChanging (cWorld & a_World, eWeather & a_NewWeather);
+ bool CallHookBlockToPickups (cWorld * a_World, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cItems & a_Pickups);
+ bool CallHookChat (cPlayer * a_Player, AString & a_Message);
+ bool CallHookChunkAvailable (cWorld * a_World, int a_ChunkX, int a_ChunkZ);
+ bool CallHookChunkGenerated (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc);
+ bool CallHookChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc);
+ bool CallHookChunkUnloaded (cWorld * a_World, int a_ChunkX, int a_ChunkZ);
+ bool CallHookChunkUnloading (cWorld * a_World, int a_ChunkX, int a_ChunkZ);
+ bool CallHookCollectingPickup (cPlayer * a_Player, cPickup & a_Pickup);
+ bool CallHookCraftingNoRecipe (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
+ bool CallHookDisconnect (cPlayer * a_Player, const AString & a_Reason);
+ bool CallHookExecuteCommand (cPlayer * a_Player, const AStringVector & a_Split); // If a_Player == NULL, it is a console cmd
+ bool CallHookHandshake (cClientHandle * a_ClientHandle, const AString & a_Username);
+ bool CallHookKilling (cEntity & a_Victim, cEntity * a_Killer);
+ bool CallHookLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username);
+ bool CallHookPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
+ bool CallHookPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
+ bool CallHookPlayerEating (cPlayer & a_Player);
+ bool CallHookPlayerJoined (cPlayer & a_Player);
+ bool CallHookPlayerMoving (cPlayer & a_Player);
+ bool CallHookPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status);
+ bool CallHookPlayerPlacedBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
+ bool CallHookPlayerPlacingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
+ bool CallHookPlayerRightClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ);
+ bool CallHookPlayerRightClickingEntity(cPlayer & a_Player, cEntity & a_Entity);
+ bool CallHookPlayerShooting (cPlayer & a_Player);
+ bool CallHookPlayerSpawned (cPlayer & a_Player);
+ bool CallHookPlayerTossingItem (cPlayer & a_Player);
+ bool CallHookPlayerUsedBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
+ bool CallHookPlayerUsedItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ);
+ bool CallHookPlayerUsingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
+ bool CallHookPlayerUsingItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ);
+ bool CallHookPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
+ bool CallHookPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
+ bool CallHookTakeDamage (cEntity & a_Receiver, TakeDamageInfo & a_TDI);
+ bool CallHookUpdatedSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player);
+ bool CallHookUpdatingSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4, cPlayer * a_Player);
+ bool CallHookWeatherChanged (cWorld & a_World);
+ bool CallHookWeatherChanging (cWorld & a_World, eWeather & a_NewWeather);
bool DisablePlugin(const AString & a_PluginName); // tolua_export
bool LoadPlugin (const AString & a_PluginName); // tolua_export
@@ -197,6 +202,11 @@ public: // tolua_export
/// Executes the command split into a_Split, as if it was given on the console. Returns true if executed. Output is sent to the a_Output callback
bool ExecuteConsoleCommand(const AStringVector & a_Split, cCommandOutputCallback & a_Output);
+ /** Appends all commands beginning with a_Text (case-insensitive) into a_Results.
+ If a_Player is not NULL, only commands for which the player has permissions are added.
+ */
+ void TabCompleteCommand(const AString & a_Text, AStringVector & a_Results, cPlayer * a_Player);
+
private:
friend class cRoot;
diff --git a/source/Plugin_NewLua.cpp b/source/Plugin_NewLua.cpp
index f4c05ab42..8b0f047cd 100644
--- a/source/Plugin_NewLua.cpp
+++ b/source/Plugin_NewLua.cpp
@@ -880,6 +880,33 @@ bool cPlugin_NewLua::OnPlayerRightClick(cPlayer & a_Player, int a_BlockX, int a_
+bool cPlugin_NewLua::OnPlayerRightClickingEntity(cPlayer & a_Player, cEntity & a_Entity)
+{
+ cCSLock Lock(m_CriticalSection);
+ const char * FnName = GetHookFnName(cPluginManager::HOOK_PLAYER_RIGHT_CLICKING_ENTITY);
+ ASSERT(FnName != NULL);
+ if (!PushFunction(FnName))
+ {
+ return false;
+ }
+
+ tolua_pushusertype(m_LuaState, &a_Player, "cPlayer");
+ tolua_pushusertype(m_LuaState, &a_Entity, "cEntity");
+
+ if (!CallFunction(2, 1, FnName))
+ {
+ return false;
+ }
+
+ bool bRetVal = (tolua_toboolean(m_LuaState, -1, 0) > 0);
+ lua_pop(m_LuaState, 1);
+ return bRetVal;
+}
+
+
+
+
+
bool cPlugin_NewLua::OnPlayerShooting(cPlayer & a_Player)
{
cCSLock Lock(m_CriticalSection);
@@ -1519,44 +1546,45 @@ const char * cPlugin_NewLua::GetHookFnName(cPluginManager::PluginHook a_Hook)
{
switch (a_Hook)
{
- case cPluginManager::HOOK_BLOCK_TO_PICKUPS: return "OnBlockToPickups";
- case cPluginManager::HOOK_CHAT: return "OnChat";
- case cPluginManager::HOOK_CHUNK_AVAILABLE: return "OnChunkAvailable";
- case cPluginManager::HOOK_CHUNK_GENERATED: return "OnChunkGenerated";
- case cPluginManager::HOOK_CHUNK_GENERATING: return "OnChunkGenerating";
- case cPluginManager::HOOK_CHUNK_UNLOADED: return "OnChunkUnloaded";
- case cPluginManager::HOOK_CHUNK_UNLOADING: return "OnChunkUnloading";
- case cPluginManager::HOOK_COLLECTING_PICKUP: return "OnCollectingPickup";
- case cPluginManager::HOOK_CRAFTING_NO_RECIPE: return "OnCraftingNoRecipe";
- case cPluginManager::HOOK_DISCONNECT: return "OnDisconnect";
- case cPluginManager::HOOK_EXECUTE_COMMAND: return "OnExecuteCommand";
- case cPluginManager::HOOK_HANDSHAKE: return "OnHandshake";
- case cPluginManager::HOOK_KILLING: return "OnKilling";
- case cPluginManager::HOOK_LOGIN: return "OnLogin";
- case cPluginManager::HOOK_PLAYER_BREAKING_BLOCK: return "OnPlayerBreakingBlock";
- case cPluginManager::HOOK_PLAYER_BROKEN_BLOCK: return "OnPlayerBrokenBlock";
- case cPluginManager::HOOK_PLAYER_EATING: return "OnPlayerEating";
- case cPluginManager::HOOK_PLAYER_JOINED: return "OnPlayerJoined";
- case cPluginManager::HOOK_PLAYER_LEFT_CLICK: return "OnPlayerLeftClick";
- case cPluginManager::HOOK_PLAYER_MOVING: return "OnPlayerMoving";
- case cPluginManager::HOOK_PLAYER_PLACED_BLOCK: return "OnPlayerPlacedBlock";
- case cPluginManager::HOOK_PLAYER_PLACING_BLOCK: return "OnPlayerPlacingBlock";
- case cPluginManager::HOOK_PLAYER_RIGHT_CLICK: return "OnPlayerRightClick";
- case cPluginManager::HOOK_PLAYER_SHOOTING: return "OnPlayerShooting";
- case cPluginManager::HOOK_PLAYER_SPAWNED: return "OnPlayerSpawned";
- case cPluginManager::HOOK_PLAYER_TOSSING_ITEM: return "OnPlayerTossingItem";
- case cPluginManager::HOOK_PLAYER_USED_BLOCK: return "OnPlayerUsedBlock";
- case cPluginManager::HOOK_PLAYER_USED_ITEM: return "OnPlayerUsedItem";
- case cPluginManager::HOOK_PLAYER_USING_BLOCK: return "OnPlayerUsingBlock";
- case cPluginManager::HOOK_PLAYER_USING_ITEM: return "OnPlayerUsingItem";
- case cPluginManager::HOOK_POST_CRAFTING: return "OnPostCrafting";
- case cPluginManager::HOOK_PRE_CRAFTING: return "OnPreCrafting";
- case cPluginManager::HOOK_TAKE_DAMAGE: return "OnTakeDamage";
- case cPluginManager::HOOK_TICK: return "OnTick";
- case cPluginManager::HOOK_UPDATED_SIGN: return "OnUpdatedSign";
- case cPluginManager::HOOK_UPDATING_SIGN: return "OnUpdatingSign";
- case cPluginManager::HOOK_WEATHER_CHANGED: return "OnWeatherChanged";
- case cPluginManager::HOOK_WEATHER_CHANGING: return "OnWeatherChanging";
+ case cPluginManager::HOOK_BLOCK_TO_PICKUPS: return "OnBlockToPickups";
+ case cPluginManager::HOOK_CHAT: return "OnChat";
+ case cPluginManager::HOOK_CHUNK_AVAILABLE: return "OnChunkAvailable";
+ case cPluginManager::HOOK_CHUNK_GENERATED: return "OnChunkGenerated";
+ case cPluginManager::HOOK_CHUNK_GENERATING: return "OnChunkGenerating";
+ case cPluginManager::HOOK_CHUNK_UNLOADED: return "OnChunkUnloaded";
+ case cPluginManager::HOOK_CHUNK_UNLOADING: return "OnChunkUnloading";
+ case cPluginManager::HOOK_COLLECTING_PICKUP: return "OnCollectingPickup";
+ case cPluginManager::HOOK_CRAFTING_NO_RECIPE: return "OnCraftingNoRecipe";
+ case cPluginManager::HOOK_DISCONNECT: return "OnDisconnect";
+ case cPluginManager::HOOK_EXECUTE_COMMAND: return "OnExecuteCommand";
+ case cPluginManager::HOOK_HANDSHAKE: return "OnHandshake";
+ case cPluginManager::HOOK_KILLING: return "OnKilling";
+ case cPluginManager::HOOK_LOGIN: return "OnLogin";
+ case cPluginManager::HOOK_PLAYER_BREAKING_BLOCK: return "OnPlayerBreakingBlock";
+ case cPluginManager::HOOK_PLAYER_BROKEN_BLOCK: return "OnPlayerBrokenBlock";
+ case cPluginManager::HOOK_PLAYER_EATING: return "OnPlayerEating";
+ case cPluginManager::HOOK_PLAYER_JOINED: return "OnPlayerJoined";
+ case cPluginManager::HOOK_PLAYER_LEFT_CLICK: return "OnPlayerLeftClick";
+ case cPluginManager::HOOK_PLAYER_MOVING: return "OnPlayerMoving";
+ case cPluginManager::HOOK_PLAYER_PLACED_BLOCK: return "OnPlayerPlacedBlock";
+ case cPluginManager::HOOK_PLAYER_PLACING_BLOCK: return "OnPlayerPlacingBlock";
+ case cPluginManager::HOOK_PLAYER_RIGHT_CLICK: return "OnPlayerRightClick";
+ case cPluginManager::HOOK_PLAYER_RIGHT_CLICKING_ENTITY: return "OnPlayerRightClickingEntity";
+ case cPluginManager::HOOK_PLAYER_SHOOTING: return "OnPlayerShooting";
+ case cPluginManager::HOOK_PLAYER_SPAWNED: return "OnPlayerSpawned";
+ case cPluginManager::HOOK_PLAYER_TOSSING_ITEM: return "OnPlayerTossingItem";
+ case cPluginManager::HOOK_PLAYER_USED_BLOCK: return "OnPlayerUsedBlock";
+ case cPluginManager::HOOK_PLAYER_USED_ITEM: return "OnPlayerUsedItem";
+ case cPluginManager::HOOK_PLAYER_USING_BLOCK: return "OnPlayerUsingBlock";
+ case cPluginManager::HOOK_PLAYER_USING_ITEM: return "OnPlayerUsingItem";
+ case cPluginManager::HOOK_POST_CRAFTING: return "OnPostCrafting";
+ case cPluginManager::HOOK_PRE_CRAFTING: return "OnPreCrafting";
+ case cPluginManager::HOOK_TAKE_DAMAGE: return "OnTakeDamage";
+ case cPluginManager::HOOK_TICK: return "OnTick";
+ case cPluginManager::HOOK_UPDATED_SIGN: return "OnUpdatedSign";
+ case cPluginManager::HOOK_UPDATING_SIGN: return "OnUpdatingSign";
+ case cPluginManager::HOOK_WEATHER_CHANGED: return "OnWeatherChanged";
+ case cPluginManager::HOOK_WEATHER_CHANGING: return "OnWeatherChanging";
default: return NULL;
} // switch (a_Hook)
}
diff --git a/source/Plugin_NewLua.h b/source/Plugin_NewLua.h
index 1ca208e9d..a79affd5d 100644
--- a/source/Plugin_NewLua.h
+++ b/source/Plugin_NewLua.h
@@ -37,43 +37,44 @@ public:
virtual void Tick(float a_Dt) override;
- virtual bool OnBlockToPickups (cWorld * a_World, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cItems & a_Pickups) override;
- virtual bool OnChat (cPlayer * a_Player, AString & a_Message) override;
- virtual bool OnChunkAvailable (cWorld * a_World, int a_ChunkX, int a_ChunkZ) override;
- virtual bool OnChunkGenerated (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc) override;
- virtual bool OnChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc) override;
- virtual bool OnChunkUnloaded (cWorld * a_World, int a_ChunkX, int a_ChunkZ) override;
- virtual bool OnChunkUnloading (cWorld * a_World, int a_ChunkX, int a_ChunkZ) override;
- virtual bool OnCollectingPickup (cPlayer * a_Player, cPickup * a_Pickup) override;
- virtual bool OnCraftingNoRecipe (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override;
- virtual bool OnDisconnect (cPlayer * a_Player, const AString & a_Reason) override;
- virtual bool OnExecuteCommand (cPlayer * a_Player, const AStringVector & a_Split) override;
- virtual bool OnHandshake (cClientHandle * a_Client, const AString & a_Username) override;
- virtual bool OnKilling (cEntity & a_Victim, cEntity * a_Killer) override;
- virtual bool OnLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username) override;
- virtual bool OnPlayerBreakingBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
- virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
- virtual bool OnPlayerEating (cPlayer & a_Player) override;
- virtual bool OnPlayerJoined (cPlayer & a_Player) override;
- virtual bool OnPlayerMoved (cPlayer & a_Player) override;
- virtual bool OnPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status) override;
- virtual bool OnPlayerPlacedBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
- virtual bool OnPlayerPlacingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
- virtual bool OnPlayerRightClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override;
- virtual bool OnPlayerShooting (cPlayer & a_Player) override;
- virtual bool OnPlayerSpawned (cPlayer & a_Player) override;
- virtual bool OnPlayerTossingItem (cPlayer & a_Player) override;
- virtual bool OnPlayerUsedBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
- virtual bool OnPlayerUsedItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override;
- virtual bool OnPlayerUsingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
- virtual bool OnPlayerUsingItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override;
- virtual bool OnPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override;
- virtual bool OnPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override;
- virtual bool OnTakeDamage (cEntity & a_Receiver, TakeDamageInfo & a_TakeDamageInfo) override;
- virtual bool OnUpdatedSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player) override;
- virtual bool OnUpdatingSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4, cPlayer * a_Player) override;
- virtual bool OnWeatherChanged (cWorld & a_World) override;
- virtual bool OnWeatherChanging (cWorld & a_World, eWeather & a_NewWeather) override;
+ virtual bool OnBlockToPickups (cWorld * a_World, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cItems & a_Pickups) override;
+ virtual bool OnChat (cPlayer * a_Player, AString & a_Message) override;
+ virtual bool OnChunkAvailable (cWorld * a_World, int a_ChunkX, int a_ChunkZ) override;
+ virtual bool OnChunkGenerated (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc) override;
+ virtual bool OnChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc) override;
+ virtual bool OnChunkUnloaded (cWorld * a_World, int a_ChunkX, int a_ChunkZ) override;
+ virtual bool OnChunkUnloading (cWorld * a_World, int a_ChunkX, int a_ChunkZ) override;
+ virtual bool OnCollectingPickup (cPlayer * a_Player, cPickup * a_Pickup) override;
+ virtual bool OnCraftingNoRecipe (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override;
+ virtual bool OnDisconnect (cPlayer * a_Player, const AString & a_Reason) override;
+ virtual bool OnExecuteCommand (cPlayer * a_Player, const AStringVector & a_Split) override;
+ virtual bool OnHandshake (cClientHandle * a_Client, const AString & a_Username) override;
+ virtual bool OnKilling (cEntity & a_Victim, cEntity * a_Killer) override;
+ virtual bool OnLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username) override;
+ virtual bool OnPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
+ virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
+ virtual bool OnPlayerEating (cPlayer & a_Player) override;
+ virtual bool OnPlayerJoined (cPlayer & a_Player) override;
+ virtual bool OnPlayerMoved (cPlayer & a_Player) override;
+ virtual bool OnPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status) override;
+ virtual bool OnPlayerPlacedBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
+ virtual bool OnPlayerPlacingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
+ virtual bool OnPlayerRightClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override;
+ virtual bool OnPlayerRightClickingEntity(cPlayer & a_Player, cEntity & a_Entity) override;
+ virtual bool OnPlayerShooting (cPlayer & a_Player) override;
+ virtual bool OnPlayerSpawned (cPlayer & a_Player) override;
+ virtual bool OnPlayerTossingItem (cPlayer & a_Player) override;
+ virtual bool OnPlayerUsedBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
+ virtual bool OnPlayerUsedItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override;
+ virtual bool OnPlayerUsingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
+ virtual bool OnPlayerUsingItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override;
+ virtual bool OnPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override;
+ virtual bool OnPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override;
+ virtual bool OnTakeDamage (cEntity & a_Receiver, TakeDamageInfo & a_TakeDamageInfo) override;
+ virtual bool OnUpdatedSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player) override;
+ virtual bool OnUpdatingSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4, cPlayer * a_Player) override;
+ virtual bool OnWeatherChanged (cWorld & a_World) override;
+ virtual bool OnWeatherChanging (cWorld & a_World, eWeather & a_NewWeather) override;
virtual bool HandleCommand(const AStringVector & a_Split, cPlayer * a_Player) override;
diff --git a/source/Protocol/Protocol.h b/source/Protocol/Protocol.h
index 1a154ea95..5c46b2726 100644
--- a/source/Protocol/Protocol.h
+++ b/source/Protocol/Protocol.h
@@ -50,58 +50,59 @@ public:
virtual void DataReceived(const char * a_Data, int a_Size) = 0;
// Sending stuff to clients (alphabetically sorted):
- virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) = 0;
- virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) = 0;
- virtual void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) = 0;
- virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0;
- virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) = 0;
- virtual void SendChat (const AString & a_Message) = 0;
- virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) = 0;
- virtual void SendCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player) = 0;
- virtual void SendDestroyEntity (const cEntity & a_Entity) = 0;
- virtual void SendDisconnect (const AString & a_Reason) = 0;
- virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) = 0; ///< Request the client to open up the sign editor for the sign (1.6+)
- virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) = 0;
- virtual void SendEntityHeadLook (const cEntity & a_Entity) = 0;
- virtual void SendEntityLook (const cEntity & a_Entity) = 0;
- virtual void SendEntityMetadata (const cEntity & a_Entity) = 0;
- virtual void SendEntityProperties (const cEntity & a_Entity) = 0;
- virtual void SendEntityRelMove (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) = 0;
- virtual void SendEntityRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) = 0;
- virtual void SendEntityStatus (const cEntity & a_Entity, char a_Status) = 0;
- virtual void SendEntityVelocity (const cEntity & a_Entity) = 0;
- virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) = 0;
- virtual void SendGameMode (eGameMode a_GameMode) = 0;
- virtual void SendHealth (void) = 0;
- virtual void SendInventoryProgress (char a_WindowID, short a_Progressbar, short a_Value) = 0;
- virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) = 0;
- virtual void SendKeepAlive (int a_PingID) = 0;
- virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) = 0;
- virtual void SendPickupSpawn (const cPickup & a_Pickup) = 0;
- virtual void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation) = 0;
- virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) = 0;
- virtual void SendPlayerMaxSpeed (void) = 0; ///< Informs the client of the maximum player speed (1.6.1+)
- virtual void SendPlayerMoveLook (void) = 0;
- virtual void SendPlayerPosition (void) = 0;
- virtual void SendPlayerSpawn (const cPlayer & a_Player) = 0;
- virtual void SendRespawn (void) = 0;
- virtual void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch) = 0; // a_Src coords are Block * 8
- virtual void SendSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) = 0;
- virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) = 0;
- virtual void SendSpawnMob (const cMonster & a_Mob) = 0;
- virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) = 0;
- virtual void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType) = 0;
- virtual void SendTeleportEntity (const cEntity & a_Entity) = 0;
- virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) = 0;
- virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay) = 0;
- virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) = 0;
- virtual void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) = 0;
- virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) = 0;
- virtual void SendWeather (eWeather a_Weather) = 0;
- virtual void SendWholeInventory (const cInventory & a_Inventory) = 0;
- virtual void SendWholeInventory (const cWindow & a_Window) = 0;
- virtual void SendWindowClose (const cWindow & a_Window) = 0;
- virtual void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) = 0;
+ virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) = 0;
+ virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) = 0;
+ virtual void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) = 0;
+ virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0;
+ virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) = 0;
+ virtual void SendChat (const AString & a_Message) = 0;
+ virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) = 0;
+ virtual void SendCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player) = 0;
+ virtual void SendDestroyEntity (const cEntity & a_Entity) = 0;
+ virtual void SendDisconnect (const AString & a_Reason) = 0;
+ virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) = 0; ///< Request the client to open up the sign editor for the sign (1.6+)
+ virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) = 0;
+ virtual void SendEntityHeadLook (const cEntity & a_Entity) = 0;
+ virtual void SendEntityLook (const cEntity & a_Entity) = 0;
+ virtual void SendEntityMetadata (const cEntity & a_Entity) = 0;
+ virtual void SendEntityProperties (const cEntity & a_Entity) = 0;
+ virtual void SendEntityRelMove (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) = 0;
+ virtual void SendEntityRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) = 0;
+ virtual void SendEntityStatus (const cEntity & a_Entity, char a_Status) = 0;
+ virtual void SendEntityVelocity (const cEntity & a_Entity) = 0;
+ virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) = 0;
+ virtual void SendGameMode (eGameMode a_GameMode) = 0;
+ virtual void SendHealth (void) = 0;
+ virtual void SendInventoryProgress (char a_WindowID, short a_Progressbar, short a_Value) = 0;
+ virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) = 0;
+ virtual void SendKeepAlive (int a_PingID) = 0;
+ virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) = 0;
+ virtual void SendPickupSpawn (const cPickup & a_Pickup) = 0;
+ virtual void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation) = 0;
+ virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) = 0;
+ virtual void SendPlayerMaxSpeed (void) = 0; ///< Informs the client of the maximum player speed (1.6.1+)
+ virtual void SendPlayerMoveLook (void) = 0;
+ virtual void SendPlayerPosition (void) = 0;
+ virtual void SendPlayerSpawn (const cPlayer & a_Player) = 0;
+ virtual void SendRespawn (void) = 0;
+ virtual void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch) = 0; // a_Src coords are Block * 8
+ virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) = 0;
+ virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) = 0;
+ virtual void SendSpawnMob (const cMonster & a_Mob) = 0;
+ virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) = 0;
+ virtual void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType) = 0;
+ virtual void SendTabCompletionResults(const AStringVector & a_Results) = 0;
+ virtual void SendTeleportEntity (const cEntity & a_Entity) = 0;
+ virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) = 0;
+ virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay) = 0;
+ virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) = 0;
+ virtual void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) = 0;
+ virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) = 0;
+ virtual void SendWeather (eWeather a_Weather) = 0;
+ virtual void SendWholeInventory (const cInventory & a_Inventory) = 0;
+ virtual void SendWholeInventory (const cWindow & a_Window) = 0;
+ virtual void SendWindowClose (const cWindow & a_Window) = 0;
+ virtual void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) = 0;
/// Returns the ServerID used for authentication through session.minecraft.net
virtual AString GetAuthServerID(void) = 0;
diff --git a/source/Protocol/Protocol125.cpp b/source/Protocol/Protocol125.cpp
index 1f6dcdec9..1f2acf50c 100644
--- a/source/Protocol/Protocol125.cpp
+++ b/source/Protocol/Protocol125.cpp
@@ -782,6 +782,16 @@ void cProtocol125::SendSpawnVehicle(const cEntity & a_Vehicle, char a_VehicleTyp
+void cProtocol125::SendTabCompletionResults(const AStringVector & a_Results)
+{
+ // This protocol version doesn't support tab completion
+ UNUSED(a_Results);
+}
+
+
+
+
+
void cProtocol125::SendTeleportEntity(const cEntity & a_Entity)
{
cCSLock Lock(m_CSPacket);
diff --git a/source/Protocol/Protocol125.h b/source/Protocol/Protocol125.h
index 6d0fe2408..ee8fd94eb 100644
--- a/source/Protocol/Protocol125.h
+++ b/source/Protocol/Protocol125.h
@@ -27,58 +27,59 @@ public:
virtual void DataReceived(const char * a_Data, int a_Size) override;
/// Sending stuff to clients (alphabetically sorted):
- virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) override;
- virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) override;
- virtual void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) override;
- virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
- virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) override;
- virtual void SendChat (const AString & a_Message) override;
- virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override;
- virtual void SendCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player) override;
- virtual void SendDestroyEntity (const cEntity & a_Entity) override;
- virtual void SendDisconnect (const AString & a_Reason) override;
- virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) override; ///< Request the client to open up the sign editor for the sign (1.6+)
- virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override;
- virtual void SendEntityHeadLook (const cEntity & a_Entity) override;
- virtual void SendEntityLook (const cEntity & a_Entity) override;
- virtual void SendEntityMetadata (const cEntity & a_Entity) override;
- virtual void SendEntityProperties (const cEntity & a_Entity) override;
- virtual void SendEntityRelMove (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override;
- virtual void SendEntityRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override;
- virtual void SendEntityStatus (const cEntity & a_Entity, char a_Status) override;
- virtual void SendEntityVelocity (const cEntity & a_Entity) override;
- virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) override;
- virtual void SendGameMode (eGameMode a_GameMode) override;
- virtual void SendHealth (void) override;
- virtual void SendInventoryProgress (char a_WindowID, short a_Progressbar, short a_Value) override;
- virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) override;
- virtual void SendKeepAlive (int a_PingID) override;
- virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
- virtual void SendPickupSpawn (const cPickup & a_Pickup) override;
- virtual void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation) override;
- virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) override;
- virtual void SendPlayerMaxSpeed (void) override;
- virtual void SendPlayerMoveLook (void) override;
- virtual void SendPlayerPosition (void) override;
- virtual void SendPlayerSpawn (const cPlayer & a_Player) override;
- virtual void SendRespawn (void) override;
- virtual void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch) override; // a_Src coords are Block * 8
- virtual void SendSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override;
- virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override;
- virtual void SendSpawnMob (const cMonster & a_Mob) override;
- virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) override;
- virtual void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType) override;
- virtual void SendTeleportEntity (const cEntity & a_Entity) override;
- virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override;
- virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay) override;
- virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
- virtual void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) override;
- virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) override;
- virtual void SendWeather (eWeather a_Weather) override;
- virtual void SendWholeInventory (const cInventory & a_Inventory) override;
- virtual void SendWholeInventory (const cWindow & a_Window) override;
- virtual void SendWindowClose (const cWindow & a_Window) override;
- virtual void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) override;
+ virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) override;
+ virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) override;
+ virtual void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) override;
+ virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
+ virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) override;
+ virtual void SendChat (const AString & a_Message) override;
+ virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override;
+ virtual void SendCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player) override;
+ virtual void SendDestroyEntity (const cEntity & a_Entity) override;
+ virtual void SendDisconnect (const AString & a_Reason) override;
+ virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) override; ///< Request the client to open up the sign editor for the sign (1.6+)
+ virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override;
+ virtual void SendEntityHeadLook (const cEntity & a_Entity) override;
+ virtual void SendEntityLook (const cEntity & a_Entity) override;
+ virtual void SendEntityMetadata (const cEntity & a_Entity) override;
+ virtual void SendEntityProperties (const cEntity & a_Entity) override;
+ virtual void SendEntityRelMove (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override;
+ virtual void SendEntityRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override;
+ virtual void SendEntityStatus (const cEntity & a_Entity, char a_Status) override;
+ virtual void SendEntityVelocity (const cEntity & a_Entity) override;
+ virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) override;
+ virtual void SendGameMode (eGameMode a_GameMode) override;
+ virtual void SendHealth (void) override;
+ virtual void SendInventoryProgress (char a_WindowID, short a_Progressbar, short a_Value) override;
+ virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) override;
+ virtual void SendKeepAlive (int a_PingID) override;
+ virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
+ virtual void SendPickupSpawn (const cPickup & a_Pickup) override;
+ virtual void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation) override;
+ virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) override;
+ virtual void SendPlayerMaxSpeed (void) override;
+ virtual void SendPlayerMoveLook (void) override;
+ virtual void SendPlayerPosition (void) override;
+ virtual void SendPlayerSpawn (const cPlayer & a_Player) override;
+ virtual void SendRespawn (void) override;
+ virtual void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch) override; // a_Src coords are Block * 8
+ virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override;
+ virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override;
+ virtual void SendSpawnMob (const cMonster & a_Mob) override;
+ virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) override;
+ virtual void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType) override;
+ virtual void SendTabCompletionResults(const AStringVector & a_Results) override;
+ virtual void SendTeleportEntity (const cEntity & a_Entity) override;
+ virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override;
+ virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay) override;
+ virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
+ virtual void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) override;
+ virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) override;
+ virtual void SendWeather (eWeather a_Weather) override;
+ virtual void SendWholeInventory (const cInventory & a_Inventory) override;
+ virtual void SendWholeInventory (const cWindow & a_Window) override;
+ virtual void SendWindowClose (const cWindow & a_Window) override;
+ virtual void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) override;
virtual AString GetAuthServerID(void) override;
diff --git a/source/Protocol/Protocol132.cpp b/source/Protocol/Protocol132.cpp
index 9a985ec1f..7a3975537 100644
--- a/source/Protocol/Protocol132.cpp
+++ b/source/Protocol/Protocol132.cpp
@@ -70,6 +70,7 @@ enum
PACKET_BLOCK_BREAK_ANIM = 0x37,
PACKET_SOUND_EFFECT = 0x3e,
PACKET_SOUND_PARTICLE_EFFECT = 0x3d,
+ PACKET_TAB_COMPLETION = 0xcb,
PACKET_LOCALE_VIEW_DISTANCE = 0xcc,
PACKET_CLIENT_STATUSES = 0xcd,
PACKET_ENCRYPTION_KEY_RESP = 0xfc,
@@ -426,6 +427,31 @@ void cProtocol132::SendSpawnMob(const cMonster & a_Mob)
+void cProtocol132::SendTabCompletionResults(const AStringVector & a_Results)
+{
+ if (a_Results.empty())
+ {
+ // No results to send
+ return;
+ }
+
+ AString Serialized(a_Results[0]);
+ for (AStringVector::const_iterator itr = a_Results.begin() + 1, end = a_Results.end(); itr != end; ++itr)
+ {
+ Serialized.push_back(0);
+ Serialized.append(*itr);
+ } // for itr - a_Results[]
+
+ cCSLock Lock(m_CSPacket);
+ WriteByte(PACKET_TAB_COMPLETION);
+ WriteString(Serialized);
+ Flush();
+}
+
+
+
+
+
void cProtocol132::SendUnloadChunk(int a_ChunkX, int a_ChunkZ)
{
// Not used in 1.3.2
@@ -484,9 +510,10 @@ int cProtocol132::ParsePacket(unsigned char a_PacketType)
switch (a_PacketType)
{
default: return super::ParsePacket(a_PacketType); // off-load previously known packets into cProtocol125
- case PACKET_LOCALE_VIEW_DISTANCE: return ParseLocaleViewDistance();
case PACKET_CLIENT_STATUSES: return ParseClientStatuses();
case PACKET_ENCRYPTION_KEY_RESP: return ParseEncryptionKeyResponse();
+ case PACKET_LOCALE_VIEW_DISTANCE: return ParseLocaleViewDistance();
+ case PACKET_TAB_COMPLETION: return ParseTabCompletion();
}
}
@@ -632,6 +659,17 @@ int cProtocol132::ParsePlayerAbilities(void)
+int cProtocol132::ParseTabCompletion(void)
+{
+ HANDLE_PACKET_READ(ReadBEUTF16String16, AString, Text);
+ m_Client->HandleTabCompletion(Text);
+ return PARSE_OK;
+}
+
+
+
+
+
void cProtocol132::SendData(const char * a_Data, int a_Size)
{
m_DataToSend.append(a_Data, a_Size);
diff --git a/source/Protocol/Protocol132.h b/source/Protocol/Protocol132.h
index bf8b4ff0e..dc4d8aeef 100644
--- a/source/Protocol/Protocol132.h
+++ b/source/Protocol/Protocol132.h
@@ -30,20 +30,21 @@ public:
virtual void DataReceived(const char * a_Data, int a_Size) override;
// Sending commands (alphabetically sorted):
- virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) override;
- virtual void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) override;
- virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
- virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override;
- virtual void SendCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player) override;
- virtual void SendDestroyEntity (const cEntity & a_Entity) override;
- virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override;
- virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
- virtual void SendPlayerSpawn (const cPlayer & a_Player) override;
- virtual void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch) override; // a_Src coords are Block * 8
- virtual void SendSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override;
- virtual void SendSpawnMob (const cMonster & a_Mob) override;
- virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
- virtual void SendWholeInventory (const cWindow & a_Window) override;
+ virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) override;
+ virtual void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) override;
+ virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
+ virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override;
+ virtual void SendCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player) override;
+ virtual void SendDestroyEntity (const cEntity & a_Entity) override;
+ virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override;
+ virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
+ virtual void SendPlayerSpawn (const cPlayer & a_Player) override;
+ virtual void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch) override; // a_Src coords are Block * 8
+ virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override;
+ virtual void SendSpawnMob (const cMonster & a_Mob) override;
+ virtual void SendTabCompletionResults(const AStringVector & a_Results) override;
+ virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
+ virtual void SendWholeInventory (const cWindow & a_Window) override;
virtual AString GetAuthServerID(void) override;
@@ -60,6 +61,7 @@ public:
virtual int ParseClientStatuses (void);
virtual int ParseEncryptionKeyResponse(void);
virtual int ParseLocaleViewDistance (void);
+ virtual int ParseTabCompletion (void);
protected:
bool m_IsEncrypted;
diff --git a/source/Protocol/ProtocolRecognizer.cpp b/source/Protocol/ProtocolRecognizer.cpp
index 3cff9789e..290f2df75 100644
--- a/source/Protocol/ProtocolRecognizer.cpp
+++ b/source/Protocol/ProtocolRecognizer.cpp
@@ -511,6 +511,16 @@ void cProtocolRecognizer::SendSpawnVehicle(const cEntity & a_Vehicle, char a_Veh
+void cProtocolRecognizer::SendTabCompletionResults(const AStringVector & a_Results)
+{
+ ASSERT(m_Protocol != NULL);
+ m_Protocol->SendTabCompletionResults(a_Results);
+}
+
+
+
+
+
void cProtocolRecognizer::SendTeleportEntity(const cEntity & a_Entity)
{
ASSERT(m_Protocol != NULL);
diff --git a/source/Protocol/ProtocolRecognizer.h b/source/Protocol/ProtocolRecognizer.h
index 1256f38e0..43d4a15e2 100644
--- a/source/Protocol/ProtocolRecognizer.h
+++ b/source/Protocol/ProtocolRecognizer.h
@@ -57,58 +57,59 @@ public:
virtual void DataReceived(const char * a_Data, int a_Size) override;
/// Sending stuff to clients (alphabetically sorted):
- virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) override;
- virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) override;
- virtual void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) override;
- virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
- virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) override;
- virtual void SendChat (const AString & a_Message) override;
- virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override;
- virtual void SendCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player) override;
- virtual void SendDestroyEntity (const cEntity & a_Entity) override;
- virtual void SendDisconnect (const AString & a_Reason) override;
- virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) override; ///< Request the client to open up the sign editor for the sign (1.6+)
- virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override;
- virtual void SendEntityHeadLook (const cEntity & a_Entity) override;
- virtual void SendEntityLook (const cEntity & a_Entity) override;
- virtual void SendEntityMetadata (const cEntity & a_Entity) override;
- virtual void SendEntityProperties (const cEntity & a_Entity) override;
- virtual void SendEntityRelMove (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override;
- virtual void SendEntityRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override;
- virtual void SendEntityStatus (const cEntity & a_Entity, char a_Status) override;
- virtual void SendEntityVelocity (const cEntity & a_Entity) override;
- virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) override;
- virtual void SendGameMode (eGameMode a_GameMode) override;
- virtual void SendHealth (void) override;
- virtual void SendInventoryProgress (char a_WindowID, short a_Progressbar, short a_Value) override;
- virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) override;
- virtual void SendKeepAlive (int a_PingID) override;
- virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
- virtual void SendPickupSpawn (const cPickup & a_Pickup) override;
- virtual void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation) override;
- virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) override;
- virtual void SendPlayerMaxSpeed (void) override;
- virtual void SendPlayerMoveLook (void) override;
- virtual void SendPlayerPosition (void) override;
- virtual void SendPlayerSpawn (const cPlayer & a_Player) override;
- virtual void SendRespawn (void) override;
- virtual void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch) override;
- virtual void SendSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override;
- virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override;
- virtual void SendSpawnMob (const cMonster & a_Mob) override;
- virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) override;
- virtual void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType) override;
- virtual void SendTeleportEntity (const cEntity & a_Entity) override;
- virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override;
- virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay) override;
- virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
- virtual void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) override;
- virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) override;
- virtual void SendWeather (eWeather a_Weather) override;
- virtual void SendWholeInventory (const cInventory & a_Inventory) override;
- virtual void SendWholeInventory (const cWindow & a_Window) override;
- virtual void SendWindowClose (const cWindow & a_Window) override;
- virtual void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) override;
+ virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) override;
+ virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) override;
+ virtual void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) override;
+ virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
+ virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) override;
+ virtual void SendChat (const AString & a_Message) override;
+ virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override;
+ virtual void SendCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player) override;
+ virtual void SendDestroyEntity (const cEntity & a_Entity) override;
+ virtual void SendDisconnect (const AString & a_Reason) override;
+ virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) override; ///< Request the client to open up the sign editor for the sign (1.6+)
+ virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override;
+ virtual void SendEntityHeadLook (const cEntity & a_Entity) override;
+ virtual void SendEntityLook (const cEntity & a_Entity) override;
+ virtual void SendEntityMetadata (const cEntity & a_Entity) override;
+ virtual void SendEntityProperties (const cEntity & a_Entity) override;
+ virtual void SendEntityRelMove (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override;
+ virtual void SendEntityRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override;
+ virtual void SendEntityStatus (const cEntity & a_Entity, char a_Status) override;
+ virtual void SendEntityVelocity (const cEntity & a_Entity) override;
+ virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) override;
+ virtual void SendGameMode (eGameMode a_GameMode) override;
+ virtual void SendHealth (void) override;
+ virtual void SendInventoryProgress (char a_WindowID, short a_Progressbar, short a_Value) override;
+ virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) override;
+ virtual void SendKeepAlive (int a_PingID) override;
+ virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
+ virtual void SendPickupSpawn (const cPickup & a_Pickup) override;
+ virtual void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation) override;
+ virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) override;
+ virtual void SendPlayerMaxSpeed (void) override;
+ virtual void SendPlayerMoveLook (void) override;
+ virtual void SendPlayerPosition (void) override;
+ virtual void SendPlayerSpawn (const cPlayer & a_Player) override;
+ virtual void SendRespawn (void) override;
+ virtual void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch) override;
+ virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override;
+ virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override;
+ virtual void SendSpawnMob (const cMonster & a_Mob) override;
+ virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) override;
+ virtual void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType) override;
+ virtual void SendTabCompletionResults(const AStringVector & a_Results) override;
+ virtual void SendTeleportEntity (const cEntity & a_Entity) override;
+ virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override;
+ virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay) override;
+ virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
+ virtual void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) override;
+ virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) override;
+ virtual void SendWeather (eWeather a_Weather) override;
+ virtual void SendWholeInventory (const cInventory & a_Inventory) override;
+ virtual void SendWholeInventory (const cWindow & a_Window) override;
+ virtual void SendWindowClose (const cWindow & a_Window) override;
+ virtual void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) override;
virtual AString GetAuthServerID(void) override;
diff --git a/source/World.cpp b/source/World.cpp
index b632fe7f9..880f6e5b2 100644
--- a/source/World.cpp
+++ b/source/World.cpp
@@ -2364,6 +2364,24 @@ int cWorld::SpawnMob(double a_PosX, double a_PosY, double a_PosZ, int a_EntityTy
+void cWorld::TabCompleteUserName(const AString & a_Text, AStringVector & a_Results)
+{
+ cCSLock Lock(m_CSPlayers);
+ for (cPlayerList::iterator itr = m_Players.begin(), end = m_Players.end(); itr != end; ++itr)
+ {
+ if (NoCaseCompare((*itr)->GetName().substr(0, a_Text.length()), a_Text) != 0)
+ {
+ // Player name doesn't match
+ continue;
+ }
+ a_Results.push_back((*itr)->GetName());
+ }
+}
+
+
+
+
+
cFluidSimulator * cWorld::InitializeFluidSimulator(cIniFile & a_IniFile, const char * a_FluidName, BLOCKTYPE a_SimulateBlock, BLOCKTYPE a_StationaryBlock)
{
AString SimulatorNameKey;
diff --git a/source/World.h b/source/World.h
index e67b06789..9de00ceec 100644
--- a/source/World.h
+++ b/source/World.h
@@ -519,6 +519,9 @@ public:
/// Returns a random number from the m_TickRand in range [0 .. a_Range]. To be used only in the tick thread!
int GetTickRandomNumber(unsigned a_Range) { return (int)(m_TickRand.randInt(a_Range)); }
+ /// Appends all usernames starting with a_Text (case-insensitive) into Results
+ void TabCompleteUserName(const AString & a_Text, AStringVector & a_Results);
+
private:
friend class cRoot;