summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-09-09 01:55:21 +0200
committerHowaner <franzi.moos@googlemail.com>2014-09-09 01:55:21 +0200
commit6fb0a76b1eab47a806723b0a856609e19c5c14f9 (patch)
treec6d8712bdc4167e51d030277b28256c9bb0efe7c /MCServer/Plugins
parentPlayerSpawn packet: Send the correct uuid. (diff)
parentcapitalisation error (diff)
downloadcuberite-6fb0a76b1eab47a806723b0a856609e19c5c14f9.tar
cuberite-6fb0a76b1eab47a806723b0a856609e19c5c14f9.tar.gz
cuberite-6fb0a76b1eab47a806723b0a856609e19c5c14f9.tar.bz2
cuberite-6fb0a76b1eab47a806723b0a856609e19c5c14f9.tar.lz
cuberite-6fb0a76b1eab47a806723b0a856609e19c5c14f9.tar.xz
cuberite-6fb0a76b1eab47a806723b0a856609e19c5c14f9.tar.zst
cuberite-6fb0a76b1eab47a806723b0a856609e19c5c14f9.zip
Diffstat (limited to '')
-rw-r--r--MCServer/Plugins/APIDump/APIDesc.lua2
-rw-r--r--MCServer/Plugins/APIDump/Writing-a-MCServer-plugin.html6
-rw-r--r--MCServer/Plugins/Debuggers/Debuggers.lua56
3 files changed, 61 insertions, 3 deletions
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
index ffd228d1a..c23120600 100644
--- a/MCServer/Plugins/APIDump/APIDesc.lua
+++ b/MCServer/Plugins/APIDump/APIDesc.lua
@@ -524,6 +524,7 @@ end
Functions =
{
GenerateOfflineUUID = { Params = "Username", Return = "string", Notes = "(STATIC) Generates an UUID based on the player name provided. This is used for the offline (non-auth) mode, when there's no UUID source. Each username generates a unique and constant UUID, so that when the player reconnects with the same name, their UUID is the same. Returns a 32-char UUID (no dashes)." },
+ GetIPString = { Params = "", Return = "string", Notes = "Returns the IP address of the connection, as a string. Only the address part is returned, without the port number." },
GetLocale = { Params = "", Return = "Locale", Notes = "Returns the locale string that the client sends as part of the protocol handshake. Can be used to provide localized strings." },
GetPing = { Params = "", Return = "number", Notes = "Returns the ping time, in ms" },
GetPlayer = { Params = "", Return = "{{cPlayer|cPlayer}}", Notes = "Returns the player object connected to this client. Note that this may be nil, for example if the player object is not yet spawned." },
@@ -2344,6 +2345,7 @@ end
ForEachBlockEntityInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each block entity in the chunk. Returns true if all block entities in the chunk have been processed (including when there are zero block entities), or false if the callback has aborted the enumeration by returning true. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cBlockEntity|BlockEntity}}, [CallbackData])</pre> The callback should return false or no value to continue with the next block entity, or true to abort the enumeration. Use {{tolua}}.cast() to cast the Callback's BlockEntity parameter to the correct {{cBlockEntity}} descendant." },
ForEachChestInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each chest in the chunk. Returns true if all chests in the chunk have been processed (including when there are zero chests), or false if the callback has aborted the enumeration by returning true. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cChestEntity|ChestEntity}}, [CallbackData])</pre> The callback should return false or no value to continue with the next chest, or true to abort the enumeration." },
ForEachEntity = { Params = "CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each entity in the loaded world. Returns true if all the entities have been processed (including when there are zero entities), or false if the callback function has aborted the enumeration by returning true. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cEntity|Entity}}, [CallbackData])</pre> The callback should return false or no value to continue with the next entity, or true to abort the enumeration." },
+ ForEachEntityInBox = { Params = "{{cBoundingBox|Box}}, CallbackFunction", Return = "bool", Notes = "Calls the specified callback for each entity in the specified bounding box. Returns true if all the entities have been processed (including when there are zero entities), or false if the callback function has aborted the enumeration by returning true. If any chunk within the bounding box is not valid, it is silently skipped without any notification. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cEntity|Entity}})</pre> The callback should return false or no value to continue with the next entity, or true to abort the enumeration." },
ForEachEntityInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each entity in the specified chunk. Returns true if all the entities have been processed (including when there are zero entities), or false if the chunk is not loaded or the callback function has aborted the enumeration by returning true. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cEntity|Entity}}, [CallbackData])</pre> The callback should return false or no value to continue with the next entity, or true to abort the enumeration." },
ForEachFurnaceInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each furnace in the chunk. Returns true if all furnaces in the chunk have been processed (including when there are zero furnaces), or false if the callback has aborted the enumeration by returning true. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cFurnaceEntity|FurnaceEntity}}, [CallbackData])</pre> The callback should return false or no value to continue with the next furnace, or true to abort the enumeration." },
ForEachPlayer = { Params = "CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each player in the loaded world. Returns true if all the players have been processed (including when there are zero players), or false if the callback function has aborted the enumeration by returning true. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cPlayer|Player}}, [CallbackData])</pre> The callback should return false or no value to continue with the next player, or true to abort the enumeration." },
diff --git a/MCServer/Plugins/APIDump/Writing-a-MCServer-plugin.html b/MCServer/Plugins/APIDump/Writing-a-MCServer-plugin.html
index 35c880b00..dd124e119 100644
--- a/MCServer/Plugins/APIDump/Writing-a-MCServer-plugin.html
+++ b/MCServer/Plugins/APIDump/Writing-a-MCServer-plugin.html
@@ -202,7 +202,7 @@ function Explode(Split, Player)
if (#Split ~= 2) then
-- There was more or less than one argument (excluding the "/explode" bit)
-- Send the proper usage to the player and exit
- SendMessage(Player, "Usage: /explode [playername]")
+ Player:SendMessage("Usage: /explode [playername]")
return true
end
@@ -213,7 +213,7 @@ function Explode(Split, Player)
if (Explodee:GetName() == Split[2]) then
-- Create an explosion at the same position as they are; see <a href="cWorld.html">API docs</a> for further details of this function
Player:GetWorld():DoExplosionAt(Explodee:GetPosX(), Explodee:GetPosY(), Explodee:GetPosZ(), false, esPlugin)
- SendMessageSuccess(Player, Split[2] .. " was successfully exploded")
+ Player:SendMessageSuccess(Split[2] .. " was successfully exploded")
HasExploded = true;
return true -- Signalize to MCS that we do not need to call this callback for any more players
end
@@ -224,7 +224,7 @@ function Explode(Split, Player)
if not(HasExploded) then
-- We have not broken out so far, therefore, the player must not exist, send failure
- SendMessageFailure(Player, Split[2] .. " was not found")
+ Player:SendMessageFailure(Split[2] .. " was not found")
end
return true
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua
index 179935c08..0e7e647d5 100644
--- a/MCServer/Plugins/Debuggers/Debuggers.lua
+++ b/MCServer/Plugins/Debuggers/Debuggers.lua
@@ -65,6 +65,8 @@ function Initialize(Plugin)
PM:BindCommand("/sb", "debuggers", HandleSetBiome, "- Sets the biome around you to the specified one");
PM:BindCommand("/wesel", "debuggers", HandleWESel, "- Expands the current WE selection by 1 block in X/Z");
PM:BindCommand("/rmitem", "debuggers", HandleRMItem, "- Remove the specified item from the inventory.");
+ PM:BindCommand("/pickups", "debuggers", HandlePickups, "- Spawns random pickups around you");
+ PM:BindCommand("/poof", "debuggers", HandlePoof, "- Nudges pickups close to you away from you");
Plugin:AddWebTab("Debuggers", HandleRequest_Debuggers)
Plugin:AddWebTab("StressTest", HandleRequest_StressTest)
@@ -1558,3 +1560,57 @@ end
+
+local PossibleItems =
+{
+ cItem(E_ITEM_DIAMOND),
+ cItem(E_ITEM_GOLD),
+ cItem(E_ITEM_IRON),
+ cItem(E_ITEM_DYE, 1, E_META_DYE_BLUE), -- Lapis lazuli
+ cItem(E_ITEM_COAL),
+}
+
+
+
+
+
+function HandlePickups(a_Split, a_Player)
+ local PlayerX = a_Player:GetPosX()
+ local PlayerY = a_Player:GetPosY()
+ local PlayerZ = a_Player:GetPosZ()
+ local World = a_Player:GetWorld()
+ local Range = 12
+ for x = 0, Range do for z = 0, Range do
+ local px = PlayerX + x - Range / 2
+ local pz = PlayerZ + z - Range / 2
+ local Items = cItems()
+ Items:Add(PossibleItems[math.random(#PossibleItems)])
+ World:SpawnItemPickups(Items, px, PlayerY, pz, 0)
+ end end -- for z, for x
+ return true
+end
+
+
+
+
+function HandlePoof(a_Split, a_Player)
+ local PlayerPos = Vector3d(a_Player:GetPosition()) -- Create a copy of the position
+ PlayerPos.y = PlayerPos.y - 1
+ local Box = cBoundingBox(PlayerPos, 4, 2)
+ local NumEntities = 0
+ a_Player:GetWorld():ForEachEntityInBox(Box,
+ function (a_Entity)
+ if not(a_Entity:IsPlayer()) then
+ local AddSpeed = a_Entity:GetPosition() - PlayerPos -- Speed away from the player
+ a_Entity:AddSpeed(AddSpeed * 32 / (AddSpeed:SqrLength() + 1)) -- The further away, the less speed to add
+ NumEntities = NumEntities + 1
+ end
+ end
+ )
+ a_Player:SendMessage("Poof! (" .. NumEntities .. " entities)")
+ return true
+end
+
+
+
+