Drag in the latest core changes.
Squashed commit of the following: commit 0f61781047fbe3a4986dde3079be4fc1fb9ff14d Author: Alexander Harkness <bearbin@gmail.com> Date: Wed Aug 7 18:26:12 2013 +0100 Fix the README - fixes #15 commit cc438b3229cdb730d308479c59491b5e66130118 Author: Alexander Harkness <bearbin@gmail.com> Date: Wed Aug 7 18:01:48 2013 +0100 Alpha-sort the console commands. commit aa22f647c27d50b3ccf7e763927bd24329da3a56 Author: Alexander Harkness <bearbin@gmail.com> Date: Wed Aug 7 18:00:44 2013 +0100 Alpha-sort the commands when they are bound. commit 5d9367fcdeeb8a5e1485aac539147edb7a0cd0ab Merge: a485101 01ccfaa Author: Alexander Harkness <bearbin@gmail.com> Date: Wed Aug 7 09:41:38 2013 -0700 Merge pull request #14 from mc-server/ireplace Told the player receiving items what they are getting, and fixed the console log. commit 01ccfaa340afa8a4b909a923702da48b8b5f0d4a Author: Alexander Harkness <bearbin@gmail.com> Date: Wed Aug 7 17:39:36 2013 +0100 Told the player reveiving items what they are getting, and fixed the console log. commit a4851010b2ff29bb55feb6331ea6ddec28532a0f Merge: 0ffbd4a ba923e4 Author: Alexander Harkness <bearbin@gmail.com> Date: Wed Aug 7 09:01:47 2013 -0700 Merge pull request #12 from mc-server/ireplace Re-implement the /i command and make /give conform to the vanilla standards commit ba923e4764b6a3064be6aacea86e059828b2d0e6 Author: Alexander Harkness <bearbin@gmail.com> Date: Wed Aug 7 16:59:53 2013 +0100 Added /item and made /i an alias of it. commit 25652d2d5390d46a9cfe8bc80ab702b831bb49ed Author: Alexander Harkness <bearbin@gmail.com> Date: Wed Aug 7 16:46:14 2013 +0100 Kept the stuff alpha-sorted. commit 7fc56322420c0f99c1d0f0e6ba5df6169ef57fcc Author: Alexander Harkness <bearbin@gmail.com> Date: Wed Aug 7 16:45:09 2013 +0100 Removed some extra semicolons. commit 06b1adbcde3d4d610f9d3646ac3dd912b4071ea7 Author: Alexander Harkness <bearbin@gmail.com> Date: Wed Aug 7 16:44:06 2013 +0100 Cleaned up the code a little and fixed the messed up stuff that tried to make sure a player was good. commit 0ffbd4adb80edf51cf7eb5117b0287c7ed286add Author: tonibm19 <tonibm19@gmail.com> Date: Wed Aug 7 13:52:02 2013 +0200 Fixed typo commit b9503b977bdfeed8795fcacd8c6d15bc2e6a723a Author: Alexander Harkness <bearbin@gmail.com> Date: Tue Aug 6 18:23:51 2013 +0100 Re-implement the /i command and make /give conform to the vanilla standards. This commit is experimental and may fail. Please test it! commit f4ac029a0f1903fc9e49365117a81293303c8811 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Fri Aug 2 23:23:15 2013 +0100 Miscellaneous Changes Reduced ban/unban code size a little. Clarified console commands. Added commented code to onjoin when bugs are fixed. Removed embarrassing server wide messages. commit da84f4977522ab48ead4af7a71efd43cdd4e3d0a Merge: cc77056 a631484 Author: bearbin <bearbin@gmail.com> Date: Thu Aug 1 10:58:05 2013 -0700 Merge pull request #10 from mc-server/tabmix Fix the inconsistency of spaces and tabs. commit a6314849c2b474b6e17a245c91a2ac74c7acf7bf Author: Alexander Harkness <bearbin@gmail.com> Date: Thu Aug 1 16:47:15 2013 +0100 Changed everything to use the correct system of tabs. commit cc7705645b6b387c618c9448fa6b0d5c789370c6 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Wed Jul 31 16:56:41 2013 +0100 Rewrote Info Messages + Implemented #7 [SEE DESC] Standardisation of info messages: [INFO] [WARNING] [JOIN] [LEAVE] [FATALITY] with colours Green, Gold, Red, Rose, and Yellow. Individual worlds have individual LimitWorld setting, with individual WebAdmin setting as well. commit 16cae4cdc0ec067e7e71fa5c5a3ba8c248ce063b Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Mon Jul 29 14:47:45 2013 +0100 Fix of nil value in SpawnProtect commit 7c33f75e7da7fc104112c17fcb53bc9f06fe09fc Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Mon Jul 29 13:19:11 2013 +0100 Fixed potential SpawnProtect nil value issue Now detects if PROTECTRADIUS is zero, and if so, cancels checks. commit 0c4a9d427620ab04ca01b5f31ed9b90530353d96 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Mon Jul 29 13:07:50 2013 +0100 Enhanced SpawnProtect greatly (thanks xoft) Wow. Who knew ~30 lines of code could become one? commit 17f5ef4fed0b6f32900cc7473563848466139655 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Mon Jul 29 11:11:22 2013 +0100 Removed Development LOGINFOs commit 02034bf2d67f2ae62092b0688d81338f7b0788df Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Mon Jul 29 10:40:57 2013 +0100 Implemented Issue #5 Enhancement [SEE DESC] Made spawn protection configurable in each world's world file. World has to be listed in settings.ini! commit ccc73db8c51e45372069ec0a42f437cfb25253b1 Merge: 6bf4b40 21c7c68 Author: Alexander Harkness <bearbin@gmail.com> Date: Sun Jul 28 14:00:15 2013 +0100 Merge branch 'master' of github.com:tigerw/MCSCore into tigerw-master Conflicts: main.lua commit 21c7c68d20782a7dfd0d8f9ce0996397549dd425 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Sun Jul 28 12:55:50 2013 +0100 Default WorldLimiter = Off commit 141298481f3adef30b68d0c4200204aa264cb3e2 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Sun Jul 28 12:47:24 2013 +0100 Fixed Potential WorldLimit & OnDisable Bugs Changed WorldLimiter if detection from nil value to config boolean. Changed OnDisable to use hardcoded name as Plugin:GetName was apparently a nil value. ?? commit 6bf4b40a0e27677afa6df9cb3521266e6b99c4f7 Merge: 1ca4217 bfd6c5f Author: bearbin <bearbin@gmail.com> Date: Sat Jul 27 11:44:18 2013 -0700 Merge pull request #3 from tonibm19/master Added /me command commit bfd6c5f2a47cda4ac98a7225736e2669eaf61849 Author: tonibm19 <tonibm19@gmail.com> Date: Sat Jul 27 20:35:22 2013 +0200 Added /me command commit d25abaf44a6f5828b90297ff80003d2cd2a90be5 Author: tonibm19 <tonibm19@gmail.com> Date: Sat Jul 27 20:30:31 2013 +0200 Added /me command commit 9047f7778aa1cdd42d22c4dcf925db792b4d684e Author: tonibm19 <tonibm19@gmail.com> Date: Sat Jul 27 20:29:24 2013 +0200 added /me command commit 1ca42172391d41ba71c65a3f15d3a96d15a80496 Merge: 52a6f4e 7a40336 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Sat Jul 27 09:01:45 2013 -0700 Merge pull request #2 from tigerw/master Fixed /give descriptor & removed webadmin commit 7a40336437525c447adae3d9800e75b39c0300c4 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Sat Jul 27 17:00:38 2013 +0100 Fixed /give descriptor & removed webadmin commit 52a6f4e35bdea2ae9f33977928b6693f5800e515 Merge: f5d56ff 2af1da8 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Sat Jul 27 08:51:45 2013 -0700 Merge pull request #1 from tigerw/master Added TPA (tonibm9's fork) commit 2af1da8a3cd8e94674b22805662b83de87ac4a95 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Sat Jul 27 16:38:10 2013 +0100 Added TPA (tonibm9's fork) With code from STR_Warrior. commit f5d56ffeb02fef4735e846661fa71d15622d25b9 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Sat Jul 27 15:51:18 2013 +0100 Integrated SpawnProtect & Bugfixes [SEE DESC.] Integrated bearbin's SpawnProtect. Fixed config file bugs. Improved SpawnProtect to use settings.ini. Variable cleanup (SHOW_PLUGIN_NAMES). File and filename cleanup. commit 56dc51c00af4514253c04e38b5ccc9fbed2f0022 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Fri Jul 26 23:14:40 2013 +0100 Update README.md Added info. commit acd7e2849dcd7f3ee7bdc6b0f9b777ee1d9cbb3c Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Fri Jul 26 19:37:59 2013 +0100 Implemented Block Property checking for Collisions Used g_BlockIsSolid, instead of checking data values. commit 246d423ff9660a2b00a1c51e6276ec74eb3419de Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Fri Jul 26 15:49:55 2013 +0100 Updated Files Buildpermandcollision: updated collision code to check for torches and redstone torches. Help: attempt at always showing page number Web_serversettings: attempt at introducing a check for Maximum Players (must be above zero). commit 868f99ab49edeee78f4fc1c212c6bf614b860378 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Thu Jul 25 19:46:08 2013 +0100 Update README.md Extended 'GUI Redesign' section. commit e0df40bd082bdeb5c6823b485bc5001103a77502 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Thu Jul 25 19:43:00 2013 +0100 Update README.md Added features and fixes and instructions for use. commit 332d8221f753f1a38d6c21bfc30af5890f48e3bb Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Thu Jul 25 19:35:27 2013 +0100 Uploaded All Files All Core files, both modified and unmodified. commit 3dd191f6bed71c863ee264856fbc3660e52cf88b Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Thu Jul 25 04:59:50 2013 -0700 Initial commit
This commit is contained in:
parent
f660475905
commit
f29b2b8ea6
@ -1,23 +1,70 @@
|
|||||||
Core Plugin (Forked)
|
MCServer Core Plugin
|
||||||
===========
|
====================
|
||||||
|
|
||||||
A fork of MCServer's Core plugin.
|
The Core plugin for MCServer provides the default utility commands and also a lot of WebAdmin goodness.
|
||||||
|
|
||||||
**New Features:**
|
Commands
|
||||||
* Simplified commands, such as 'gotoworld' -> 'portal'
|
--------
|
||||||
* Simplified and combined LUA files, such as 'listworlds.lua & gotoworld.lua' -> 'worlds-portal.lua'
|
|
||||||
* Fixed 'tp' command not working due to typography errors
|
|
||||||
* Fixed 'arithmetic on nil value' on startup due to inactivation of world limiter
|
|
||||||
* Massive overhaul / redesign of webadmin GUI interface.
|
|
||||||
* Added jQuery transition effect
|
|
||||||
* Completely redesigned CSS
|
|
||||||
* Added new logo
|
|
||||||
* Made HTML5 compliant
|
|
||||||
* Beautified 'help' menu
|
|
||||||
* Rewrite of death messages - fixed strange grammar and edited to more faithfully reflect Vanilla
|
|
||||||
* Added 'unban' console command
|
|
||||||
|
|
||||||
**How to Use**
|
* /back
|
||||||
|
* /ban
|
||||||
|
* /downfall
|
||||||
|
* /give
|
||||||
|
* /gm
|
||||||
|
* /groups
|
||||||
|
* /help
|
||||||
|
* /i
|
||||||
|
* /item
|
||||||
|
* /kick
|
||||||
|
* /locate
|
||||||
|
* /me
|
||||||
|
* /motd
|
||||||
|
* /plugins
|
||||||
|
* /portal
|
||||||
|
* /rank
|
||||||
|
* /regen
|
||||||
|
* /reload
|
||||||
|
* /save-all
|
||||||
|
* /spawn
|
||||||
|
* /stop
|
||||||
|
* /time
|
||||||
|
* /top
|
||||||
|
* /tp
|
||||||
|
* /tpa
|
||||||
|
* /tpaccept
|
||||||
|
* /unban
|
||||||
|
* /viewdistance
|
||||||
|
* /worlds
|
||||||
|
|
||||||
Simply copy all LUA files into Plugins/Core (delete existing files first, except banned.ini and whitelist.ini!)
|
**Also, console commands:**
|
||||||
Then, copy webadmin to MCServer root directory (delete existing directory first!)
|
|
||||||
|
* ban
|
||||||
|
* banlist
|
||||||
|
* getversion
|
||||||
|
* help
|
||||||
|
* list
|
||||||
|
* listgroups
|
||||||
|
* numchunks
|
||||||
|
* players
|
||||||
|
* rank
|
||||||
|
* reload
|
||||||
|
* say
|
||||||
|
* setversion
|
||||||
|
* unban
|
||||||
|
* unload
|
||||||
|
|
||||||
|
Contributors
|
||||||
|
------------
|
||||||
|
|
||||||
|
FakeTruth
|
||||||
|
xoft
|
||||||
|
tigerw
|
||||||
|
bearbin
|
||||||
|
tonibm19
|
||||||
|
|
||||||
|
(If you want your name here, please submit a PR after you've done your contributions.)
|
||||||
|
|
||||||
|
How to Use
|
||||||
|
----------
|
||||||
|
|
||||||
|
Core should be installed in MCServer by default.
|
||||||
|
@ -5,21 +5,22 @@ function InitConsoleCommands()
|
|||||||
|
|
||||||
-- Please keep the list alpha-sorted
|
-- Please keep the list alpha-sorted
|
||||||
PluginMgr:BindConsoleCommand("ban", HandleConsoleBan, " ~ Bans a player by name");
|
PluginMgr:BindConsoleCommand("ban", HandleConsoleBan, " ~ Bans 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("banlist ips", HandleConsoleBanList, " - Lists all players banned by IP");
|
||||||
|
PluginMgr:BindConsoleCommand("banlist", HandleConsoleBanList, " - Lists all players banned by name");
|
||||||
|
PluginMgr:BindConsoleCommand("getversion", HandleConsoleVersion, " - Gets server version reported to 1.4+ clients");
|
||||||
PluginMgr:BindConsoleCommand("help", HandleConsoleHelp, " - Lists all commands");
|
PluginMgr:BindConsoleCommand("help", HandleConsoleHelp, " - Lists all commands");
|
||||||
PluginMgr:BindConsoleCommand("list", HandleConsoleList, " - Lists all players in a machine-readable format");
|
PluginMgr:BindConsoleCommand("list", HandleConsoleList, " - Lists all players in a machine-readable format");
|
||||||
PluginMgr:BindConsoleCommand("listgroups", HandleConsoleListGroups, " - Shows a list of all the groups");
|
PluginMgr:BindConsoleCommand("listgroups", HandleConsoleListGroups, " - Shows a list of all the groups");
|
||||||
PluginMgr:BindConsoleCommand("numchunks", HandleConsoleNumChunks, " - Shows number of chunks currently loaded");
|
PluginMgr:BindConsoleCommand("numchunks", HandleConsoleNumChunks, " - Shows number of chunks currently loaded");
|
||||||
PluginMgr:BindConsoleCommand("players", HandleConsolePlayers, " - Lists all connected players");
|
PluginMgr:BindConsoleCommand("players", HandleConsolePlayers, " - Lists all connected players");
|
||||||
PluginMgr:BindConsoleCommand("getversion", HandleConsoleVersion, " - Gets server version reported to 1.4+ clients");
|
|
||||||
PluginMgr:BindConsoleCommand("setversion", HandleConsoleVersion, " ~ Sets server version reported to 1.4+ clients");
|
|
||||||
PluginMgr:BindConsoleCommand("rank", HandleConsoleRank, " ~ Add a player to a group");
|
PluginMgr:BindConsoleCommand("rank", HandleConsoleRank, " ~ Add a player to a group");
|
||||||
PluginMgr:BindConsoleCommand("reload", HandleConsoleReload, " - Reloads all plugins");
|
PluginMgr:BindConsoleCommand("reload", HandleConsoleReload, " - Reloads all plugins");
|
||||||
PluginMgr:BindConsoleCommand("save-all", HandleConsoleSaveAll, " - Saves all chunks");
|
PluginMgr:BindConsoleCommand("save-all", HandleConsoleSaveAll, " - Saves all chunks");
|
||||||
PluginMgr:BindConsoleCommand("say", HandleConsoleSay, " - Sends a chat message to all players");
|
PluginMgr:BindConsoleCommand("say", HandleConsoleSay, " - Sends a chat message to all players");
|
||||||
|
PluginMgr:BindConsoleCommand("setversion", HandleConsoleVersion, " ~ Sets server version reported to 1.4+ clients");
|
||||||
|
PluginMgr:BindConsoleCommand("unban", HandleConsoleUnban, " ~ Unbans a player by name");
|
||||||
PluginMgr:BindConsoleCommand("unload", HandleConsoleUnload, " - Unloads all unused chunks");
|
PluginMgr:BindConsoleCommand("unload", HandleConsoleUnload, " - Unloads all unused chunks");
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function HandleConsoleBan(Split)
|
function HandleConsoleBan(Split)
|
||||||
|
@ -1,39 +1,65 @@
|
|||||||
function HandleGiveCommand(Split, Player)
|
function HandleGiveCommand(Split, Player)
|
||||||
if ((#Split ~= 2) and (#Split ~=3)) then
|
|
||||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /give [ItemType/Name:Dmg] <Amount>" );
|
-- Make sure there are a correct number of arguments.
|
||||||
return true;
|
if #Split ~= 3 and #Split ~= 4 and #Split ~= 5 then
|
||||||
|
Player:SendMessage( cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /give <player> <item> [amount] [meta]" )
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
local Item = cItem();
|
-- Get the item from the arguments and check it's valid.
|
||||||
local FoundItem = StringToItem(Split[2], Item);
|
local Item = cItem()
|
||||||
|
if #Split == 5 then
|
||||||
if not(IsValidItem(Item.m_ItemType)) then -- StringToItem does not check if item is valid
|
local FoundItem = StringToItem(Split[3] .. ":" .. Split[5], Item)
|
||||||
|
else
|
||||||
|
local FoundItem = StringToItem(Split[3], Item)
|
||||||
|
end
|
||||||
|
if not IsValidItem(Item.m_ItemType) then -- StringToItem does not check if item is valid
|
||||||
FoundItem = false
|
FoundItem = false
|
||||||
end
|
end
|
||||||
|
|
||||||
if not(FoundItem) then
|
if not FoundItem then
|
||||||
Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Invalid item id or name!" )
|
Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Invalid item id or name!" )
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
local ItemAmount = 1;
|
-- Work out how many items the user wants.
|
||||||
if (#Split == 3) then
|
local ItemAmount = 1
|
||||||
ItemAmount = tonumber(Split[3]);
|
if #Split > 3 then
|
||||||
if ((ItemAmount == nil) or (ItemAmount < 1) or (ItemAmount > 512)) then
|
ItemAmount = tonumber(Split[4])
|
||||||
Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Invalid amount!" );
|
if ItemAmount == nil or ItemAmount < 1 or ItemAmount > 512 then
|
||||||
return true;
|
Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Invalid amount!" )
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Item.m_ItemCount = ItemAmount;
|
Item.m_ItemCount = ItemAmount
|
||||||
|
|
||||||
local ItemsGiven = Player:GetInventory():AddItem(Item);
|
-- Get the playername from the split.
|
||||||
if (ItemsGiven == ItemAmount) then
|
local playerName = Split[2]
|
||||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "There you go!" );
|
|
||||||
LOG("Gave " .. Player:GetName() .. " " .. Item.m_ItemCount .. " times " .. Item.m_ItemType .. ":" .. Item.m_ItemDamage);
|
local function giveItems(newPlayer)
|
||||||
else
|
local ItemsGiven = newPlayer:GetInventory():AddItem(Item)
|
||||||
Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Not enough space in inventory, only gave " .. ItemsGiven);
|
if ItemsGiven == ItemAmount then
|
||||||
LOG("Player " .. Player:GetName() .. " asked for " .. Item.m_ItemCount .. " times " .. Item.m_ItemType .. ":" .. Item.m_ItemDamage ..", but only could fit " .. ItemsGiven);
|
newPlayer:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "You were given " .. Item.m_ItemCount .. " of " .. Item.m_ItemType .. "." )
|
||||||
|
if not newPlayer == Player then
|
||||||
|
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Items given!" )
|
||||||
|
end
|
||||||
|
LOG("Gave " .. newPlayer:GetName() .. " " .. Item.m_ItemCount .. " times " .. Item.m_ItemType .. ":" .. Item.m_ItemDamage)
|
||||||
|
else
|
||||||
|
Player:SendMessage( cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Not enough space in inventory, only gave " .. ItemsGiven)
|
||||||
|
LOG( "Player " .. Player:GetName() .. " asked for " .. Item.m_ItemCount .. " times " .. Item.m_ItemType .. ":" .. Item.m_ItemDamage ..", but only could fit " .. ItemsGiven )
|
||||||
|
end
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
return true;
|
|
||||||
end
|
-- Finally give the items to the player.
|
||||||
|
itemStatus = cRoot:Get():FindAndDoWithPlayer(playerName, giveItems)
|
||||||
|
|
||||||
|
-- Check to make sure that giving items was successful.
|
||||||
|
if not itemStatus then
|
||||||
|
Player:SendMessage( cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "There was no player that matched your query.")
|
||||||
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
|
|
||||||
|
end
|
||||||
|
24
MCServer/Plugins/Core/item.lua
Normal file
24
MCServer/Plugins/Core/item.lua
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
function HandleItemCommand(Split, Player)
|
||||||
|
|
||||||
|
if ((#Split ~= 2) and (#Split ~=3)) then
|
||||||
|
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /i <item>[:meta] [amount]" )
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
itemSplit = StringSplit(Split[2], ":")
|
||||||
|
|
||||||
|
newSplit[1] = "/give"
|
||||||
|
newSplit[2] = Player:GetName()
|
||||||
|
newSplit[3] = itemSplit[1]
|
||||||
|
if Split[3] ~= nil then
|
||||||
|
newSplit[4] = Split[3]
|
||||||
|
else
|
||||||
|
newSplit[4] = 1
|
||||||
|
end
|
||||||
|
if itemSplit[2] ~= nil then
|
||||||
|
newSplit[5] = itemSplit[2]
|
||||||
|
end
|
||||||
|
|
||||||
|
HandleGiveCommand(newSplit, Player)
|
||||||
|
return true
|
||||||
|
end
|
@ -29,12 +29,16 @@ function Initialize(Plugin)
|
|||||||
--BIND COMMANDS
|
--BIND COMMANDS
|
||||||
PluginManager:BindCommand("/back", "core.back", HandleBackCommand, " - Return to your last position");
|
PluginManager:BindCommand("/back", "core.back", HandleBackCommand, " - Return to your last position");
|
||||||
PluginManager:BindCommand("/ban", "core.ban", HandleBanCommand, " ~ Ban a player");
|
PluginManager:BindCommand("/ban", "core.ban", HandleBanCommand, " ~ Ban a player");
|
||||||
PluginManager:BindCommand("/give", "core.give", HandleGiveCommand, " ~ Give yourself an item");
|
PluginManager:BindCommand("/downfall", "core.downfall", HandleDownfallCommand, " - Toggles the weather");
|
||||||
|
PluginManager:BindCommand("/give", "core.give", HandleGiveCommand, " ~ Give someone an item");
|
||||||
PluginManager:BindCommand("/gm", "core.changegm", HandleChangeGMCommand, " ~ Change your gamemode");
|
PluginManager:BindCommand("/gm", "core.changegm", HandleChangeGMCommand, " ~ Change your gamemode");
|
||||||
PluginManager:BindCommand("/help", "core.help", HandleHelpCommand, " ~ Show available commands");
|
|
||||||
PluginManager:BindCommand("/kick", "core.kick", HandleKickCommand, " ~ Kick a player");
|
|
||||||
PluginManager:BindCommand("/groups", "core.groups", HandleGroupsCommand, " - Shows a list of all the groups");
|
PluginManager:BindCommand("/groups", "core.groups", HandleGroupsCommand, " - Shows a list of all the groups");
|
||||||
|
PluginManager:BindCommand("/help", "core.help", HandleHelpCommand, " ~ Show available commands");
|
||||||
|
PluginManager:BindCommand("/i", "core.give", HandleItemCommand, "")
|
||||||
|
PluginManager:BindCommand("/item", "core.give", HandleItemCommand, " - Give yourself an item.")
|
||||||
|
PluginManager:BindCommand("/kick", "core.kick", HandleKickCommand, " ~ Kick a player");
|
||||||
PluginManager:BindCommand("/locate", "core.locate", HandleLocateCommand, " - Show your current server coordinates");
|
PluginManager:BindCommand("/locate", "core.locate", HandleLocateCommand, " - Show your current server coordinates");
|
||||||
|
PluginManager:BindCommand("/me", "core.me", HandleMeCommand, " ~ Tell what you are doing");
|
||||||
PluginManager:BindCommand("/motd", "core.motd", HandleMOTDCommand, " - Show message of the day");
|
PluginManager:BindCommand("/motd", "core.motd", HandleMOTDCommand, " - Show message of the day");
|
||||||
PluginManager:BindCommand("/plugins", "core.plugins", HandlePluginsCommand, " - Show list of plugins");
|
PluginManager:BindCommand("/plugins", "core.plugins", HandlePluginsCommand, " - Show list of plugins");
|
||||||
PluginManager:BindCommand("/portal", "core.portal", HandlePortalCommand, " ~ Move to a different world");
|
PluginManager:BindCommand("/portal", "core.portal", HandlePortalCommand, " ~ Move to a different world");
|
||||||
@ -45,8 +49,6 @@ function Initialize(Plugin)
|
|||||||
PluginManager:BindCommand("/spawn", "core.spawn", HandleSpawnCommand, " - Return to the spawn");
|
PluginManager:BindCommand("/spawn", "core.spawn", HandleSpawnCommand, " - Return to the spawn");
|
||||||
PluginManager:BindCommand("/stop", "core.stop", HandleStopCommand, " - Stops the server");
|
PluginManager:BindCommand("/stop", "core.stop", HandleStopCommand, " - Stops the server");
|
||||||
PluginManager:BindCommand("/time", "core.time", HandleTimeCommand, " ~ Sets the time of day");
|
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("/top", "core.top", HandleTopCommand, " - Teleport yourself to the top most block");
|
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("/tp", "core.teleport", HandleTPCommand, " ~ Teleport yourself to a player");
|
||||||
PluginManager:BindCommand("/tpa", "core.teleport", HandleTPACommand, " ~ Ask to teleport yourself to a player");
|
PluginManager:BindCommand("/tpa", "core.teleport", HandleTPACommand, " ~ Ask to teleport yourself to a player");
|
||||||
|
@ -9,7 +9,7 @@ function HandleTimeCommand( Split, Player )
|
|||||||
Server:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Time was set to daytime" )
|
Server:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Time was set to daytime" )
|
||||||
elseif( string.upper( Split[2] ) == "NIGHT") then
|
elseif( string.upper( Split[2] ) == "NIGHT") then
|
||||||
Player:GetWorld():SetTimeOfDay( 12000 + 1000 )
|
Player:GetWorld():SetTimeOfDay( 12000 + 1000 )
|
||||||
Server:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Time was set to nighttime" )
|
Server:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Time was set to night time" )
|
||||||
elseif( string.upper(Split[2]) == "SET" ) and ( tonumber(Split[3]) ~= nil) then
|
elseif( string.upper(Split[2]) == "SET" ) and ( tonumber(Split[3]) ~= nil) then
|
||||||
Player:GetWorld():SetTimeOfDay( tonumber(Split[3]) )
|
Player:GetWorld():SetTimeOfDay( tonumber(Split[3]) )
|
||||||
Server:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Time was set to " .. Split[3] )
|
Server:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Time was set to " .. Split[3] )
|
||||||
@ -20,4 +20,4 @@ function HandleTimeCommand( Split, Player )
|
|||||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /time [Day/Night/Set/Add]" )
|
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /time [Day/Night/Set/Add]" )
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user