summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/Core
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-01-13 12:10:26 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-01-13 12:10:26 +0100
commit752057fb1b3a71058b5391bde9b0e21d87196539 (patch)
treecfeb16a291ce13dc8408a82459224f029f56cd2f /MCServer/Plugins/Core
parentMerged branch "branches/hooks" into "trunk". (diff)
downloadcuberite-752057fb1b3a71058b5391bde9b0e21d87196539.tar
cuberite-752057fb1b3a71058b5391bde9b0e21d87196539.tar.gz
cuberite-752057fb1b3a71058b5391bde9b0e21d87196539.tar.bz2
cuberite-752057fb1b3a71058b5391bde9b0e21d87196539.tar.lz
cuberite-752057fb1b3a71058b5391bde9b0e21d87196539.tar.xz
cuberite-752057fb1b3a71058b5391bde9b0e21d87196539.tar.zst
cuberite-752057fb1b3a71058b5391bde9b0e21d87196539.zip
Diffstat (limited to 'MCServer/Plugins/Core')
-rw-r--r--MCServer/Plugins/Core/item.lua4
-rw-r--r--MCServer/Plugins/Core/main.lua42
-rw-r--r--MCServer/Plugins/Core/oncraftingnorecipe.lua14
-rw-r--r--MCServer/Plugins/Core/onplayerbreakingblock.lua (renamed from MCServer/Plugins/Core/onblockdig.lua)2
-rw-r--r--MCServer/Plugins/Core/onplayerjoin.lua4
-rw-r--r--MCServer/Plugins/Core/onplayerjoined.lua4
-rw-r--r--MCServer/Plugins/Core/onplayerplacingblock.lua (renamed from MCServer/Plugins/Core/onblockplace.lua)4
7 files changed, 37 insertions, 37 deletions
diff --git a/MCServer/Plugins/Core/item.lua b/MCServer/Plugins/Core/item.lua
index ce80ec7d3..00a6aa790 100644
--- a/MCServer/Plugins/Core/item.lua
+++ b/MCServer/Plugins/Core/item.lua
@@ -1,6 +1,6 @@
function HandleItemCommand( Split, Player )
if( #Split ~= 2 and #Split ~=3 ) then
- Player:SendMessage( cChatColor.Green .. "Usage: /item [ItemID/Name:Dmg] <Amount>" )
+ Player:SendMessage( cChatColor.Green .. "Usage: /item [ItemType/Name:Dmg] <Amount>" )
return true
end
@@ -12,7 +12,7 @@ function HandleItemCommand( Split, Player )
end
if( FoundItem == false ) then
- Player:SendMessage( cChatColor.Green .. "Invalid Item ID / Name !" )
+ Player:SendMessage( cChatColor.Green .. "Invalid Item type / name !" )
return true
end
diff --git a/MCServer/Plugins/Core/main.lua b/MCServer/Plugins/Core/main.lua
index c6a1b7e6a..97263f1d6 100644
--- a/MCServer/Plugins/Core/main.lua
+++ b/MCServer/Plugins/Core/main.lua
@@ -12,34 +12,34 @@ function Initialize( Plugin )
PLUGIN = Plugin
Plugin:SetName( "Core" )
- Plugin:SetVersion( 8 )
+ Plugin:SetVersion(9)
PluginManager = cRoot:Get():GetPluginManager()
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_JOIN)
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_JOINED)
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_BREAKING_BLOCK)
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_PLACING_BLOCK)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_LOGIN)
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_BLOCK_PLACE)
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_BLOCK_DIG)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_KILLED)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_CRAFTING_NO_RECIPE)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHAT) -- used in web_chat.lua
- Plugin:AddCommand("/help", " - [Page] Show this message", "core.help")
- Plugin:AddCommand("/pluginlist", " - Show list of plugins", "core.pluginlist")
- Plugin:AddCommand("/tp", " - [Player] - Teleport yourself to a player", "core.teleport")
- Plugin:AddCommand("/item", " - [ItemID/Name] <Amount> - Spawn an item for yourself", "core.item")
- Plugin:AddCommand("/list", " - Shows list of connected players", "core.playerlist")
- Plugin:AddCommand("/motd", " - Show message of the day", "core.motd")
- Plugin:AddCommand("/reload", " - Reload all plugins", "core.reload")
- Plugin:AddCommand("/stop", " - Stops the server", "core.stop")
- Plugin:AddCommand("/time", " - [Day/Night] - Sets the time of day", "core.time")
- Plugin:AddCommand("/spawn", " - Return to the spawn", "core.spawn")
- Plugin:AddCommand("/kick", " - [Player] - Kick a player", "core.kick")
- Plugin:AddCommand("/ban", " - [Player] - Ban a player", "core.ban")
- Plugin:AddCommand("/unban", " - [Player] - Unban a player", "core.unban")
- Plugin:AddCommand("/top", " - Teleport yourself to the top most block", "core.top")
- Plugin:AddCommand("/gm", " - [Gamemode (0|1)] - Change your gamemode", "core.changegm")
- Plugin:AddCommand("/gotoworld", " - Move to a different world!", "core.gotoworld")
- Plugin:AddCommand("/coords", " - Show your current server coordinates", "core.coords")
+ Plugin:AddCommand("/help", " - [Page] Show this message", "core.help")
+ Plugin:AddCommand("/pluginlist", " - Show list of plugins", "core.pluginlist")
+ Plugin:AddCommand("/tp", " - [Player] - Teleport yourself to a player", "core.teleport")
+ Plugin:AddCommand("/item", " - [ItemType/Name] <Amount> - Give yourself an item", "core.item")
+ Plugin:AddCommand("/list", " - Shows list of connected players", "core.playerlist")
+ Plugin:AddCommand("/motd", " - Show message of the day", "core.motd")
+ Plugin:AddCommand("/reload", " - Reload all plugins", "core.reload")
+ Plugin:AddCommand("/stop", " - Stops the server", "core.stop")
+ Plugin:AddCommand("/time", " - [Day/Night] - Sets the time of day", "core.time")
+ Plugin:AddCommand("/spawn", " - Return to the spawn", "core.spawn")
+ Plugin:AddCommand("/kick", " - [Player] - Kick a player", "core.kick")
+ Plugin:AddCommand("/ban", " - [Player] - Ban a player", "core.ban")
+ Plugin:AddCommand("/unban", " - [Player] - Unban a player", "core.unban")
+ Plugin:AddCommand("/top", " - Teleport yourself to the top most block", "core.top")
+ Plugin:AddCommand("/gm", " - [Gamemode (0|1)] - Change your gamemode", "core.changegm")
+ Plugin:AddCommand("/gotoworld", " - Move to a different world!", "core.gotoworld")
+ Plugin:AddCommand("/coords", " - Show your current server coordinates", "core.coords")
Plugin:AddCommand("/viewdistance", " - [".. cClientHandle.MIN_VIEW_DISTANCE .."-".. cClientHandle.MAX_VIEW_DISTANCE .."] - Change your view distance", "core.viewdistance")
Plugin:AddCommand("/regeneratechunk", " - <X [Z]> - Regenerates a chunk", "core.regeneratechunk")
diff --git a/MCServer/Plugins/Core/oncraftingnorecipe.lua b/MCServer/Plugins/Core/oncraftingnorecipe.lua
index 2006e410f..b6909d672 100644
--- a/MCServer/Plugins/Core/oncraftingnorecipe.lua
+++ b/MCServer/Plugins/Core/oncraftingnorecipe.lua
@@ -16,7 +16,7 @@ function OnCraftingNoRecipe(Player, Grid, Recipe)
for x = 0, Grid:GetWidth() - 1 do
for y = 0, Grid:GetHeight() - 1 do
local Item = Grid:GetItem(x, y)
- if (Item.m_ItemID ~= E_ITEM_EMPTY) then
+ if (Item.m_ItemType ~= E_ITEM_EMPTY) then
table.insert(Items, Item)
end
end
@@ -27,23 +27,23 @@ function OnCraftingNoRecipe(Player, Grid, Recipe)
return false
end
- if (Items[1].m_ItemID ~= Items[2].m_ItemID) then
+ if (Items[1].m_ItemType ~= Items[2].m_ItemType) then
-- Only items of the same type may be fixed
return false
end
if (
- (Items[1].m_ItemHealth == 0) or
- (Items[2].m_ItemHealth == 0)
+ (Items[1].m_ItemDamage == 0) or
+ (Items[2].m_ItemDamage == 0)
)
then
-- Only damaged items may be fixed
return false
end
- local _ID = Items[1].m_ItemID
- local _least_hp = math.max(Items[1].m_ItemHealth, Items[2].m_ItemHealth)
- local _most_hp = math.min(Items[1].m_ItemHealth, Items[2].m_ItemHealth)
+ local _ID = Items[1].m_ItemType
+ local _least_hp = math.max(Items[1].m_ItemDamage, Items[2].m_ItemDamage)
+ local _most_hp = math.min(Items[1].m_ItemDamage, Items[2].m_ItemDamage)
local _item_hp = 0
-- TODO: This could be refactored into better code, using an _ID-indexed table for _item_hp
diff --git a/MCServer/Plugins/Core/onblockdig.lua b/MCServer/Plugins/Core/onplayerbreakingblock.lua
index 65e48576c..fc7d5897d 100644
--- a/MCServer/Plugins/Core/onblockdig.lua
+++ b/MCServer/Plugins/Core/onplayerbreakingblock.lua
@@ -1,4 +1,4 @@
-function OnBlockDig(Player, BlockX, BlockY, BlockZ, BlockFace, Status, OldBlockType, OldBlockMeta)
+function OnPlayerBreakingBlock(Player, BlockX, BlockY, BlockZ, BlockFace, Status, OldBlockType, OldBlockMeta)
-- dont check if the direction is in the air
if (BlockFace ~= -1) then
diff --git a/MCServer/Plugins/Core/onplayerjoin.lua b/MCServer/Plugins/Core/onplayerjoin.lua
deleted file mode 100644
index e8263f608..000000000
--- a/MCServer/Plugins/Core/onplayerjoin.lua
+++ /dev/null
@@ -1,4 +0,0 @@
-function OnPlayerJoin( Player )
- ShowMOTDTo( Player )
- return false
-end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/onplayerjoined.lua b/MCServer/Plugins/Core/onplayerjoined.lua
new file mode 100644
index 000000000..8aa067a0c
--- /dev/null
+++ b/MCServer/Plugins/Core/onplayerjoined.lua
@@ -0,0 +1,4 @@
+function OnPlayerJoined(Player)
+ ShowMOTDTo( Player )
+ return false
+end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/onblockplace.lua b/MCServer/Plugins/Core/onplayerplacingblock.lua
index 9032f8207..be2fd64d3 100644
--- a/MCServer/Plugins/Core/onblockplace.lua
+++ b/MCServer/Plugins/Core/onplayerplacingblock.lua
@@ -1,4 +1,4 @@
-function OnBlockPlace(Player, BlockX, BlockY, BlockZ, BlockFace, HeldItem)
+function OnPlayerPlacingBlock(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ, BlockType)
-- dont check if the direction is in the air
if (BlockFace == -1) then
@@ -14,7 +14,7 @@ function OnBlockPlace(Player, BlockX, BlockY, BlockZ, BlockFace, HeldItem)
local X = BlockX
local Y = BlockY
local Z = BlockZ
- X, Y, Z = AddDirection(X, Y, Z, BlockFace)
+ X, Y, Z = AddFaceDirection(X, Y, Z, BlockFace)
if (Y >= 256 or Y < 0) then
return true
end