Dragged in the latest changes for Core.
Squashed commit of the following: commit 9dc3f0d18af4a411f8a40b525e49e7598159f450 Author: Alexander Harkness <bearbin@gmail.com> Date: Sun Aug 11 15:46:05 2013 +0100 Alpha-sorted the command bindings. commit e22d2fcf3dd840b1a051f3b5b529040213c151c6 Merge: 3ff68e9 9e285ea Author: Alexander Harkness <bearbin@gmail.com> Date: Sun Aug 11 15:35:46 2013 +0100 Merge branch 'vanilla-commands' Conflicts: main.lua weather.lua commit 3ff68e9690ff365fd57343dd8d0609bdc6b6bb54 Author: Alexander Harkness <bearbin@gmail.com> Date: Sun Aug 11 15:22:33 2013 +0100 Cleaned up some files and also killed some demons that had survived the messaging update. commit 9e285ea6ceb3f2e279052fd10227a6dfeb48c062 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Sun Aug 11 15:09:28 2013 +0100 Fixed tabs and conforms to standards commit e092a35988074b7ebd58068c0b24a235a98596df Merge: f4038d2 c1c563b Author: Alexander Harkness <bearbin@gmail.com> Date: Sun Aug 11 15:06:35 2013 +0100 Merge branch 'message-standards' Conflicts: console.lua item.lua main.lua commit d68c84b8b74a54cc15965036d27ad0b1dde2d603 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Sun Aug 11 14:56:08 2013 +0100 Added /msg alias commit c1c563bda69d51cf5454c7584a25fa3968f0e3ad Author: Alexander Harkness <bearbin@gmail.com> Date: Sun Aug 11 14:55:56 2013 +0100 Cleaned up console a little and switched to new message system. Also fixed missing eof newline. commit dc6c5fafc32034321f6827b0c21e99212e2d559b Author: Alexander Harkness <bearbin@gmail.com> Date: Sun Aug 11 14:54:47 2013 +0100 Cleaned up web-perms and switched to new message system. Also added missing eof newline. commit f739fc83ace22cf1ee966ad5514bd3c708d08c20 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Sun Aug 11 14:54:10 2013 +0100 Remove command commit dc5ce476e871b425f79e510522e35db5608161d4 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Sun Aug 11 14:52:40 2013 +0100 Now conforms to chat standards commit 41e15803541f4a20ee5baf92106e2ba1cb40cbd7 Author: Alexander Harkness <bearbin@gmail.com> Date: Sun Aug 11 14:51:21 2013 +0100 Cleaned up weather and switched to new message system. Also added missing eof newline. commit d19caacaad67addaa30d1b6f48ec47c265b4832e Author: Alexander Harkness <bearbin@gmail.com> Date: Sun Aug 11 14:50:07 2013 +0100 Cleaned up viewdistance and switched to new messaging system. Also added missing eof newline. commit d6f6603773ae7beb87cb951988e7738ba9c1e538 Author: Alexander Harkness <bearbin@gmail.com> Date: Sun Aug 11 14:48:34 2013 +0100 Cleaned up top and changed to new messaging system. Also fixed missing eof newline. commit f50fb793a1332c1cc87b3c6e0dfa283f9dfc9e61 Author: Alexander Harkness <bearbin@gmail.com> Date: Sun Aug 11 14:47:28 2013 +0100 Cleaned up the time file and switched to new messaging system. commit aff076175ded4823da817547349537f3c33d4a43 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Sun Aug 11 14:43:38 2013 +0100 Now comforms to help standards commit 4c416d1d1944fa00d4bf07f2580b29b530545bb3 Author: tonibm19 <tonibm19@gmail.com> Date: Sun Aug 11 14:09:29 2013 +0200 Added /tell [playername] [message] commit 56db86812bfa7c4482b563af71846616a1716434 Author: tonibm19 <tonibm19@gmail.com> Date: Sun Aug 11 14:06:47 2013 +0200 Added /tell [playername] [message] commit 1b5f32e3b577474b0878dfe9211cafbdb00790bb Author: Alexander Harkness <bearbin@gmail.com> Date: Sun Aug 11 12:58:53 2013 +0100 Cleaned up teleport and switched to new message system. Also added missing eof newline. commit fb96b73831679735a9677d7f520d19d8276a15d6 Author: tonibm19 <tonibm19@gmail.com> Date: Sun Aug 11 13:33:49 2013 +0200 Added /weather [Clear/Rain/Thunder] commit 1e4676965a3ce6dc79912e0c8686b7de5026eb42 Author: tonibm19 <tonibm19@gmail.com> Date: Sun Aug 11 13:32:04 2013 +0200 Added /weather [Clear/Rain/Thunder] commit f4038d2f9d748df54af054661a18630219ebd25c Author: STRWarrior <niels.breuker@hotmail.nl> Date: Sun Aug 11 13:08:24 2013 +0200 changed /downfall to /toggledownfall becouse thats the way it is in vanilla. commit acdcefe61919e9ecbace1ee2f56dc24c94ffa4dc Author: tonibm19 <tonibm19@gmail.com> Date: Sun Aug 11 13:02:35 2013 +0200 Fixed /tpa and /tpaccept commit 9f526a63f07497fa7542515aa17afce9adc34abb Author: tonibm19 <tonibm19@gmail.com> Date: Sun Aug 11 12:59:22 2013 +0200 Updated README (new commands added) commit 717239095c638d86859f1b1b449e6bea0d093f02 Author: Alexander Harkness <bearbin@gmail.com> Date: Sun Aug 11 11:37:11 2013 +0100 Cleaned up spawn.lua and changed to new message system. Also fixed missing eof newline. commit 2a6a693efcffa1145270bc79ce403e5038a88308 Author: Alexander Harkness <bearbin@gmail.com> Date: Sun Aug 11 11:35:58 2013 +0100 Cleaned up the save-reload-stop file. Also fixed missing eof newline. commit d32223e4361509a598ee528261b113d92f402e7e Author: Alexander Harkness <bearbin@gmail.com> Date: Sun Aug 11 11:35:08 2013 +0100 Cleaned up the regen file and changed to the new message system. Also fixed missing eof newline. commit 7635e0cd1be051d60bbb6127f04b5b9b8decf51f Author: Alexander Harkness <bearbin@gmail.com> Date: Sun Aug 11 11:30:47 2013 +0100 Cleaned up rank-groups.lua and changed to new message system. Also fixed missing eof newline. commit 204e38aa33541794745a671092a3b5b37388f6d2 Merge: 42e95a6 a319162 Author: Alexander Harkness <bearbin@gmail.com> Date: Sun Aug 11 00:54:49 2013 -0700 Merge pull request #19 from mc-server/vanilla-commands Added /kill and /clear commit a31916277fcef2925fc96ce6833dac1ab7c62905 Author: tonibm19 <tonibm19@gmail.com> Date: Sat Aug 10 23:11:21 2013 +0200 You die if you dont specify a player commit 0aca0d8431cc69f841a3e3f3a0ada81c1d8b1fbb Author: Alexander Harkness <bearbin@gmail.com> Date: Sat Aug 10 21:05:03 2013 +0100 Cleaned up the portal and worlds file and added new message system. Also fixed missing eof newline. commit 9f4a1fe0ef18a3ee48ea5629969854e5a60616a0 Author: Alexander Harkness <bearbin@gmail.com> Date: Sat Aug 10 21:01:23 2013 +0100 Cleaned up plugins file and added new message system. also fixed missing eof newline. commit 9f04dfef81e8705597aac8fbc8912e3c3b9be6e8 Author: tonibm19 <tonibm19@gmail.com> Date: Sat Aug 10 21:23:41 2013 +0200 fixed /clear commit 13e9007844f15050ad4ecea79246d31426975898 Author: Alexander Harkness <bearbin@gmail.com> Date: Sat Aug 10 20:17:06 2013 +0100 Cleaned up the motd file. commit 6c8de9b3594221fbb092d9989166826754641eda Author: tonibm19 <tonibm19@gmail.com> Date: Sat Aug 10 21:13:42 2013 +0200 Added /clear command commit 97fe00aac1bf7d497e08a9622bb32786d64b4c0b Author: tonibm19 <tonibm19@gmail.com> Date: Sat Aug 10 21:11:31 2013 +0200 Added /clear command commit 8dec3c04acb9814db1c89cba2094494fd321e40a Author: Alexander Harkness <bearbin@gmail.com> Date: Sat Aug 10 20:11:26 2013 +0100 Cleaned up the me file and changed to new message system. commit 72c401fe65589adce446e7de59b3c47ac2147fc9 Author: Alexander Harkness <bearbin@gmail.com> Date: Sat Aug 10 20:09:26 2013 +0100 Cleaned up the main file, and changed to the new message system. commit c48604becd8da56590c9374a641a665d1d6dedab Author: tonibm19 <tonibm19@gmail.com> Date: Sat Aug 10 21:05:24 2013 +0200 Added /kill commit 41b90ad60fc944aa307447491e511879e64f108a Author: tonibm19 <tonibm19@gmail.com> Date: Sat Aug 10 21:03:47 2013 +0200 added /kill commit b2ffcfb1ea36758b013e1ea85c2515485ed30543 Author: Alexander Harkness <bearbin@gmail.com> Date: Sat Aug 10 19:57:50 2013 +0100 Added new messaging system to locate.lua. Also added the eof newline. commit 318e4dc85eb10d7d97279a19f2d21f3ec75c4598 Author: Alexander Harkness <bearbin@gmail.com> Date: Sat Aug 10 19:53:51 2013 +0100 Cleaned up the kick command and added new message system. Also fixed missing eof newline. commit 3d864b47a826911181604f83ea72ca0416ff25ce Author: Alexander Harkness <bearbin@gmail.com> Date: Sat Aug 10 19:49:56 2013 +0100 Cleaned the /i a bit more. commit 7c26e76048885e2cbc7bc5b57d6ba38b7475e2a5 Author: Alexander Harkness <bearbin@gmail.com> Date: Sat Aug 10 19:48:19 2013 +0100 Changed to the new message system for /i. Also fixed eof newline. commit 1bc7f1844942a4a675c125b06c81b418b009c037 Author: Alexander Harkness <bearbin@gmail.com> Date: Sat Aug 10 18:37:35 2013 +0100 Cleaned up help massively and implemented the new messages. Also added new eof newline. commit 150c88ccfe2d6e5210f95c31e56f824832a0c98c Author: Alexander Harkness <bearbin@gmail.com> Date: Sat Aug 10 18:36:14 2013 +0100 Added spaces after the tag for the messages so the results look good. commit a144b535cd51805ef8badfc6645aa654370913ed Author: Alexander Harkness <bearbin@gmail.com> Date: Sat Aug 10 18:30:21 2013 +0100 Added new messages to gm.lua. Also added spaces in functions and added a eof newline. commit 2237f62c1c6e40d7b2a2986916b2a6e1879f6bfd Author: Alexander Harkness <bearbin@gmail.com> Date: Sat Aug 10 18:23:29 2013 +0100 Removed a semicolon that was creeping around in the messages file. commit fbe68a2c28f0b7d54d8527b54a737218bc9a6da4 Author: Alexander Harkness <bearbin@gmail.com> Date: Sat Aug 10 18:22:48 2013 +0100 Fixed derpy spelling and added new messages to the give command. Also cleaned up the functions in the give command file. commit 66b33c0436d084a2fed1248d63f074c768545ad0 Author: Alexander Harkness <bearbin@gmail.com> Date: Sat Aug 10 18:04:55 2013 +0100 Added new messages to the ban and unban command. Also cleaned up the function calls and added the eof newline. commit c90dda25990de8ab6d529e83c9620d9bc8c9b9f1 Author: Alexander Harkness <bearbin@gmail.com> Date: Sat Aug 10 17:56:43 2013 +0100 Added new messages to /back command. Also fixed newline at end of file. commit 42e95a6d32da7227a84a5202a2e72fcf4007aaf2 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Sat Aug 10 17:04:36 2013 +0100 Fix concatenation issue commit 7432c25306b8125fca13100048b693bebad92d3d Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Sat Aug 10 16:44:47 2013 +0100 Fix of bracket commit 4e0b3f905e2f937951eebd322b204f8da3e745cd Author: Alexander Harkness <bearbin@gmail.com> Date: Sat Aug 10 16:38:53 2013 +0100 Fixed bugs in the console command file that were stopping it from working. There was an extra `end` and an extra `)` commit ea1215da739e65585b448103e0bf1bebec00dfac Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Sat Aug 10 16:06:30 2013 +0100 Fixed duplicate leave messages commit b6ecb378ca6f213b4676ca17efcb5baa64f2f132 Merge: b273df1 1a6f70f Author: Alexander Harkness <bearbin@gmail.com> Date: Sat Aug 10 06:05:32 2013 -0700 Merge pull request #13 from mc-server/give-console Added a console command for giving players items. commit b273df17c759eba82342466cf6e2291d84b77ab3 Author: Alexander Harkness <bearbin@gmail.com> Date: Sat Aug 10 08:27:14 2013 +0100 Hopefully fixed the /i command not working. I had not defined the newSplit variable before using it. commit 8a74037cc092d048364299f18e07c02c85ae3737 Author: Alexander Harkness <bearbin@gmail.com> Date: Thu Aug 8 10:18:48 2013 +0100 Fixed the contributors not being on their own lines. commit 57d842cbc61464a613c248d043a3fe7254d931a2 Author: Alexander Harkness <bearbin@gmail.com> Date: Thu Aug 8 10:17:03 2013 +0100 Added temporary messages.lua, seeing if people like it. 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 1a6f70f25ffa4c12a0d738c97435ae2c30cdb6a9 Author: Alexander Harkness <bearbin@gmail.com> Date: Wed Aug 7 17:35:48 2013 +0100 Added a console command for giving players items. 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
dd60f55bcc
commit
cc708f757c
@ -8,6 +8,7 @@ Commands
|
||||
|
||||
* /back
|
||||
* /ban
|
||||
* /clear
|
||||
* /downfall
|
||||
* /give
|
||||
* /gm
|
||||
@ -15,6 +16,7 @@ Commands
|
||||
* /help
|
||||
* /i
|
||||
* /item
|
||||
* /kill
|
||||
* /kick
|
||||
* /locate
|
||||
* /me
|
||||
|
@ -1,9 +1,10 @@
|
||||
function HandleBackCommand( Split, Player )
|
||||
if BackCoords[Player:GetName()] == nil then
|
||||
Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "No known last position")
|
||||
SendMessageFailure(Player, "No known last position")
|
||||
return true
|
||||
else
|
||||
Player:TeleportToCoords(BackCoords[Player:GetName()].x, BackCoords[Player:GetName()].y, BackCoords[Player:GetName()].z)
|
||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Teleported back to your last known position")
|
||||
SendMessageSuccess(Player, "Teleported back to your last known position")
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
@ -1,45 +1,49 @@
|
||||
function HandleBanCommand( Split, Player )
|
||||
|
||||
if( #Split < 2 ) then
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /ban [Player] <Reason>" )
|
||||
SendMessage( Player, "Usage: /ban [Player] <Reason>" )
|
||||
return true
|
||||
end
|
||||
|
||||
local Reason = cChatColor.Red .. "You have been banned." .. cChatColor.White .. " Did you do something illegal?"
|
||||
if( #Split > 2 ) then
|
||||
Reason = table.concat(Split, " ", 3)
|
||||
Reason = table.concat( Split, " ", 3 )
|
||||
end
|
||||
|
||||
|
||||
if KickPlayer(Split[2], Reason) == false then
|
||||
BannedPlayersIni:DeleteValue("Banned", Split[2])
|
||||
BannedPlayersIni:SetValueB("Banned", Split[2], true)
|
||||
BannedPlayersIni:DeleteValue( "Banned", Split[2] )
|
||||
BannedPlayersIni:SetValueB( "Banned", Split[2], true )
|
||||
BannedPlayersIni:WriteFile()
|
||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Could not find player, but banned anyway" )
|
||||
SendMessageFailure( Player, "Could not find player, but banned anyway" )
|
||||
else
|
||||
BannedPlayersIni:DeleteValue("Banned", Split[2])
|
||||
BannedPlayersIni:SetValueB("Banned", Split[2], true)
|
||||
BannedPlayersIni:DeleteValue( "Banned", Split[2] )
|
||||
BannedPlayersIni:SetValueB( "Banned", Split[2], true )
|
||||
BannedPlayersIni:WriteFile()
|
||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Successfully kicked and banned player" )
|
||||
SendMessageSuccess( Player, "Successfully kicked and banned player" )
|
||||
end
|
||||
return true
|
||||
|
||||
end
|
||||
|
||||
function HandleUnbanCommand( Split, Player )
|
||||
|
||||
if( #Split < 2 ) then
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /unban [Player]" )
|
||||
SendMessage( Player, "Usage: /unban [Player]" )
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
if( BannedPlayersIni:GetValueB("Banned", Split[2], false) == false ) then
|
||||
Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. Split[2] .. " is not banned!" )
|
||||
SendMessageFailure( Player, "Player is not banned!" )
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
BannedPlayersIni:DeleteValue("Banned", Split[2])
|
||||
BannedPlayersIni:SetValueB("Banned", Split[2], false)
|
||||
BannedPlayersIni:WriteFile()
|
||||
|
||||
LOGINFO( Player:GetName() .. " is unbanning " .. Split[2] )
|
||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Unbanning " .. Split[2] )
|
||||
SendMessageSuccess( Player, "Unbanning " .. Split[2] )
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
end
|
||||
|
25
MCServer/Plugins/Core/clear.lua
Normal file
25
MCServer/Plugins/Core/clear.lua
Normal file
@ -0,0 +1,25 @@
|
||||
function HandleClearCommand( Split, Player )
|
||||
|
||||
if (Split[2] == nil) then
|
||||
SendMessage( Player, "Usage: /clear <player>" )
|
||||
return true
|
||||
end
|
||||
|
||||
local InventoryCleared = false;
|
||||
local ClearInventory = function(OtherPlayer)
|
||||
if (OtherPlayer:GetName() == Split[2]) then
|
||||
OtherPlayer:GetInventory():Clear()
|
||||
InventoryCleared = true
|
||||
end
|
||||
end
|
||||
|
||||
cRoot:Get():FindAndDoWithPlayer(Split[2], ClearInventory);
|
||||
if (InventoryCleared) then
|
||||
SendMessageSuccess( Player, "You cleared the inventory of " .. Split[2] )
|
||||
return true
|
||||
else
|
||||
SendMessageFailure( Player, "Player not found" )
|
||||
return true
|
||||
end
|
||||
|
||||
end
|
@ -2,7 +2,7 @@
|
||||
|
||||
function InitConsoleCommands()
|
||||
local PluginMgr = cPluginManager:Get();
|
||||
|
||||
|
||||
-- Please keep the list alpha-sorted
|
||||
PluginMgr:BindConsoleCommand("ban", HandleConsoleBan, " ~ Bans a player by name");
|
||||
PluginMgr:BindConsoleCommand("banlist ips", HandleConsoleBanList, " - Lists all players banned by IP");
|
||||
@ -21,7 +21,7 @@ function InitConsoleCommands()
|
||||
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");
|
||||
|
||||
|
||||
end
|
||||
|
||||
function HandleConsoleGive(Split)
|
||||
@ -37,7 +37,7 @@ function HandleConsoleGive(Split)
|
||||
local FoundItem = StringToItem(Split[3] .. ":" .. Split[5], Item)
|
||||
else
|
||||
local FoundItem = StringToItem(Split[3], Item)
|
||||
end
|
||||
end
|
||||
if not IsValidItem(Item.m_ItemType) then -- StringToItem does not check if item is valid
|
||||
FoundItem = false
|
||||
end
|
||||
@ -63,10 +63,10 @@ function HandleConsoleGive(Split)
|
||||
local function giveItems(newPlayer)
|
||||
local ItemsGiven = newPlayer:GetInventory():AddItem(Item)
|
||||
if ItemsGiven == ItemAmount then
|
||||
newPlayer:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "There you go!" )
|
||||
SendMessageSuccess( newPlayer, "There you go!" )
|
||||
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)
|
||||
SendMessageFailure( Player, "Not enough space in inventory, only gave " .. ItemsGiven)
|
||||
return true, "Only " .. Item.m_ItemCount .. " out of " .. ItemsGiven .. "items could be delivered."
|
||||
end
|
||||
end
|
||||
@ -86,13 +86,13 @@ end
|
||||
function HandleConsoleBan(Split)
|
||||
if (#Split < 2) then
|
||||
return true, "Usage: ban [Player] <Reason>";
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local Reason = cChatColor.Red .. "You have been banned." .. cChatColor.White .. " Did you do something illegal?"
|
||||
if( #Split > 2 ) then
|
||||
Reason = table.concat(Split, " ", 3)
|
||||
end
|
||||
|
||||
|
||||
if KickPlayer(Split[2], Reason) == false then
|
||||
BannedPlayersIni:DeleteValue("Banned", Split[2])
|
||||
BannedPlayersIni:SetValueB("Banned", Split[2], true)
|
||||
@ -109,30 +109,32 @@ function HandleConsoleBan(Split)
|
||||
end
|
||||
|
||||
function HandleConsoleUnban(Split)
|
||||
if( #Split < 2 ) then
|
||||
return true, "Usage: unban [Player]"
|
||||
|
||||
if #Split < 2 then
|
||||
return true, "Usage: /unban [Player]"
|
||||
end
|
||||
|
||||
|
||||
if( BannedPlayersIni:GetValueB("Banned", Split[2], false) == false ) then
|
||||
return true, Split[2] .. " is not banned!"
|
||||
end
|
||||
|
||||
|
||||
BannedPlayersIni:SetValueB("Banned", Split[2], false, false)
|
||||
BannedPlayersIni:WriteFile()
|
||||
|
||||
local Server = cRoot:Get():GetServer()
|
||||
return true, "Unbanned " .. Split[2]
|
||||
|
||||
end
|
||||
|
||||
function HandleConsoleBanList(Split)
|
||||
if (#Split == 1) then
|
||||
return true, BanListByName();
|
||||
end
|
||||
|
||||
|
||||
if (string.lower(Split[2]) == "ips") then
|
||||
return true, BanListByIPs();
|
||||
end
|
||||
|
||||
|
||||
return true, "Unknown banlist subcommand";
|
||||
end
|
||||
|
||||
@ -146,15 +148,15 @@ function HandleConsoleHelp(Split)
|
||||
MaxLength = CmdLen;
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
cPluginManager:Get():ForEachConsoleCommand(AddToTable);
|
||||
|
||||
|
||||
-- Sort the table:
|
||||
local CompareCommands = function(a, b)
|
||||
return a[1] < b[1]; -- compare command strings
|
||||
end
|
||||
table.sort(Commands, CompareCommands);
|
||||
|
||||
|
||||
local Out = "";
|
||||
Out = "'-' denotes no prefix, '~' denotes that a value is required.\n"
|
||||
for i, Command in ipairs(Commands) do
|
||||
@ -185,14 +187,14 @@ function HandleConsoleListGroups(Split)
|
||||
if (not(GroupsIni:ReadFile())) then
|
||||
return true, "No groups found";
|
||||
end
|
||||
|
||||
|
||||
-- Read the groups:
|
||||
Number = GroupsIni:NumKeys();
|
||||
Groups = {};
|
||||
for i = 0, Number do
|
||||
table.insert(Groups, GroupsIni:KeyName(i))
|
||||
end
|
||||
|
||||
|
||||
-- Output the groups, concatenated to a string:
|
||||
local Out = "Groups:\n"
|
||||
Out = Out .. table.concat(Groups, ", ");
|
||||
@ -204,9 +206,9 @@ function HandleConsoleNumChunks(Split)
|
||||
local AddNumChunks = function(World)
|
||||
Output[World:GetName()] = World:GetNumChunks();
|
||||
end;
|
||||
|
||||
|
||||
cRoot:Get():ForEachWorld(AddNumChunks);
|
||||
|
||||
|
||||
local Total = 0;
|
||||
local Out = "";
|
||||
for name, num in pairs(Output) do
|
||||
@ -214,7 +216,7 @@ function HandleConsoleNumChunks(Split)
|
||||
Total = Total + num;
|
||||
end
|
||||
Out = Out .. "Total: " .. Total .. " chunks\n";
|
||||
|
||||
|
||||
return true, Out;
|
||||
end
|
||||
|
||||
@ -227,9 +229,9 @@ function HandleConsolePlayers(Split)
|
||||
end
|
||||
table.insert(PlayersInWorlds[WorldName], Player:GetName() .. " @ " .. Player:GetIP());
|
||||
end
|
||||
|
||||
|
||||
cRoot:Get():ForEachPlayer(AddToTable);
|
||||
|
||||
|
||||
local Out = "";
|
||||
for WorldName, Players in pairs(PlayersInWorlds) do
|
||||
Out = Out .. "World " .. WorldName .. ":\n";
|
||||
@ -237,7 +239,7 @@ function HandleConsolePlayers(Split)
|
||||
Out = Out .. " " .. PlayerName .. "\n";
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return true, Out;
|
||||
end
|
||||
|
||||
@ -247,7 +249,7 @@ function HandleConsoleVersion(Split)
|
||||
local Version = cRoot:Get():GetPrimaryServerVersion();
|
||||
return true, "Primary server version: #" .. Version .. ", " .. cRoot:GetProtocolVersionTextFromInt(Version);
|
||||
end
|
||||
|
||||
|
||||
-- Set new value as the version:
|
||||
cRoot:Get():SetPrimaryServerVersion(tonumber(Split[2]));
|
||||
local Version = cRoot:Get():GetPrimaryServerVersion();
|
||||
@ -259,36 +261,36 @@ function HandleConsoleRank(Split)
|
||||
return true, "Usage: /rank [Player] [Group]";
|
||||
end
|
||||
local Out = "";
|
||||
|
||||
|
||||
-- Read the groups.ini file:
|
||||
local GroupsIni = cIniFile("groups.ini")
|
||||
if (not(GroupsIni:ReadFile())) then
|
||||
Out = "Could not read groups.ini, creating anew!\n"
|
||||
end
|
||||
|
||||
|
||||
-- Find the group:
|
||||
if (GroupsIni:FindKey(Split[3]) == -1) then
|
||||
return true, Out .. "Group does not exist";
|
||||
end
|
||||
|
||||
|
||||
-- Read the users.ini file:
|
||||
local UsersIni = cIniFile("users.ini");
|
||||
if (not(UsersIni:ReadFile())) then
|
||||
Out = Out .. "Could not read users.ini, creating anew!\n";
|
||||
end
|
||||
|
||||
|
||||
-- Write the new group value to users.ini:
|
||||
UsersIni:DeleteKey(Split[2]);
|
||||
UsersIni:GetValueSet(Split[2], "Groups", Split[3]);
|
||||
UsersIni:WriteFile();
|
||||
|
||||
|
||||
-- Reload the player's permissions:
|
||||
cRoot:Get():ForEachWorld(
|
||||
function (World)
|
||||
World:ForEachPlayer(
|
||||
function (Player)
|
||||
if (Player:GetName() == Split[2]) then
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "You were moved to group " .. Split[3]);
|
||||
SendMessage( Player, "You were moved to group " .. Split[3] )
|
||||
Player:LoadPermissionsFromDisk();
|
||||
end
|
||||
end
|
||||
@ -328,7 +330,7 @@ function HandleConsoleUnload(Split)
|
||||
local UnloadChunks = function(World)
|
||||
World:UnloadUnusedChunks();
|
||||
end
|
||||
|
||||
|
||||
local Out = "Num loaded chunks before: " .. cRoot:Get():GetTotalChunkCount() .. "\n";
|
||||
cRoot:Get():ForEachWorld(UnloadChunks);
|
||||
Out = Out .. "Num loaded chunks after: " .. cRoot:Get():GetTotalChunkCount();
|
||||
@ -357,4 +359,4 @@ end
|
||||
function BanListByIPs()
|
||||
-- TODO: No IP ban implemented yet
|
||||
return "";
|
||||
end
|
||||
end
|
||||
|
@ -2,32 +2,33 @@ function HandleGiveCommand(Split, Player)
|
||||
|
||||
-- Make sure there are a correct number of arguments.
|
||||
if #Split ~= 3 and #Split ~= 4 and #Split ~= 5 then
|
||||
Player:SendMessage( cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /give <player> <item> [amount] [meta]" )
|
||||
SendMessage( Player, "Usage: /give <player> <item> [amount] [meta]" )
|
||||
return true
|
||||
end
|
||||
|
||||
-- Get the item from the arguments and check it's valid.
|
||||
local Item = cItem()
|
||||
if #Split == 5 then
|
||||
local FoundItem = StringToItem(Split[3] .. ":" .. Split[5], Item)
|
||||
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
|
||||
local FoundItem = StringToItem( Split[3], Item )
|
||||
end
|
||||
|
||||
if not IsValidItem( Item.m_ItemType ) then -- StringToItem does not check if item is valid
|
||||
FoundItem = false
|
||||
end
|
||||
|
||||
if not FoundItem then
|
||||
Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Invalid item id or name!" )
|
||||
SendMessageFailure( Player, "Invalid item id or name!" )
|
||||
return true
|
||||
end
|
||||
|
||||
-- Work out how many items the user wants.
|
||||
local ItemAmount = 1
|
||||
if #Split > 3 then
|
||||
ItemAmount = tonumber(Split[4])
|
||||
ItemAmount = tonumber( Split[4] )
|
||||
if ItemAmount == nil or ItemAmount < 1 or ItemAmount > 512 then
|
||||
Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Invalid amount!" )
|
||||
SendMessageFailure( Player, "Invalid amount!" )
|
||||
return true
|
||||
end
|
||||
end
|
||||
@ -37,27 +38,27 @@ function HandleGiveCommand(Split, Player)
|
||||
-- Get the playername from the split.
|
||||
local playerName = Split[2]
|
||||
|
||||
local function giveItems(newPlayer)
|
||||
local ItemsGiven = newPlayer:GetInventory():AddItem(Item)
|
||||
local function giveItems( newPlayer )
|
||||
local ItemsGiven = newPlayer:GetInventory():AddItem( Item )
|
||||
if ItemsGiven == ItemAmount then
|
||||
newPlayer:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "You were given " .. Item.m_ItemCount .. " of " .. Item.m_ItemType .. "." )
|
||||
SendMessageSuccess( newPlayer, "You were given " .. Item.m_ItemCount .. " of " .. Item.m_ItemType .. "." )
|
||||
if not newPlayer == Player then
|
||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Items given!" )
|
||||
SendMessageSuccess( Player, "Items given!" )
|
||||
end
|
||||
LOG("Gave " .. newPlayer:GetName() .. " " .. Item.m_ItemCount .. " times " .. Item.m_ItemType .. ":" .. Item.m_ItemDamage)
|
||||
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)
|
||||
SendMessageFailure( Player, "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
|
||||
|
||||
-- Finally give the items to the player.
|
||||
itemStatus = cRoot:Get():FindAndDoWithPlayer(playerName, giveItems)
|
||||
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.")
|
||||
SendMessageFailure( Player, "There was no player that matched your query." )
|
||||
end
|
||||
|
||||
return true
|
||||
|
@ -1,8 +1,11 @@
|
||||
function HandleChangeGMCommand( Split, Player )
|
||||
|
||||
if( #Split ~= 2 ) then
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /gm [GameMode (0|1)]" )
|
||||
SendMessage( Player, "Usage: /gm [0|1]" )
|
||||
return true
|
||||
end
|
||||
Player:SetGameMode(Split[2])
|
||||
|
||||
Player:SetGameMode( Split[2] )
|
||||
return true
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,41 +1,43 @@
|
||||
function HandleHelpCommand(Split, Player)
|
||||
function HandleHelpCommand( Split, Player )
|
||||
|
||||
local PluginManager = cRoot:Get():GetPluginManager()
|
||||
|
||||
local LinesPerPage = 8;
|
||||
local CurrentPage = 1;
|
||||
local CurrentLine = 0;
|
||||
local PageRequested = 1;
|
||||
local Output = {};
|
||||
|
||||
|
||||
local LinesPerPage = 8
|
||||
local CurrentPage = 1
|
||||
local CurrentLine = 0
|
||||
local PageRequested = 1
|
||||
local Output = {}
|
||||
|
||||
if (#Split == 2) then
|
||||
PageRequested = tonumber(Split[2]);
|
||||
PageRequested = tonumber( Split[2] )
|
||||
end
|
||||
|
||||
local Process = function(Command, Permission, HelpString)
|
||||
if not(Player:HasPermission(Permission)) then
|
||||
return false;
|
||||
end;
|
||||
|
||||
local Process = function( Command, Permission, HelpString )
|
||||
if not (Player:HasPermission(Permission)) then
|
||||
return false
|
||||
end
|
||||
if (HelpString == "") then
|
||||
return false;
|
||||
end;
|
||||
return false
|
||||
end
|
||||
|
||||
CurrentLine = CurrentLine + 1;
|
||||
CurrentPage = math.floor(CurrentLine / LinesPerPage) + 1;
|
||||
CurrentLine = CurrentLine + 1
|
||||
CurrentPage = math.floor( CurrentLine / LinesPerPage ) + 1
|
||||
if (CurrentPage ~= PageRequested) then
|
||||
return false;
|
||||
end;
|
||||
table.insert(Output, cChatColor.Blue .. Command .. HelpString);
|
||||
return false
|
||||
end
|
||||
table.insert( Output, Command .. HelpString )
|
||||
end
|
||||
|
||||
PluginManager:ForEachCommand(Process);
|
||||
PluginManager:ForEachCommand( Process )
|
||||
|
||||
-- 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.");
|
||||
for idx, msg in ipairs(Output) do
|
||||
Player:SendMessage(msg);
|
||||
end;
|
||||
|
||||
SendMessage( Player, "Page " .. PageRequested .. " out of " .. CurrentPage .. "." )
|
||||
SendMessage( Player, "'-' means no prefix, '~' means a value is required." )
|
||||
for idx, msg in ipairs( Output ) do
|
||||
SendMessage( Player, msg )
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,7 +1,7 @@
|
||||
function HandleItemCommand(Split, Player)
|
||||
function HandleItemCommand( Split, Player )
|
||||
|
||||
if ((#Split ~= 2) and (#Split ~=3)) then
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /i <item>[:meta] [amount]" )
|
||||
SendMessage( Player, "Usage: /i <item>[:meta] [amount]" )
|
||||
return true
|
||||
end
|
||||
|
||||
@ -20,7 +20,7 @@ function HandleItemCommand(Split, Player)
|
||||
newSplit[5] = itemSplit[2]
|
||||
end
|
||||
|
||||
HandleGiveCommand(newSplit, Player)
|
||||
HandleGiveCommand( newSplit, Player )
|
||||
return true
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,42 +1,46 @@
|
||||
function HandleKickCommand( Split, Player )
|
||||
|
||||
if( #Split < 2 ) then
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /kick [Player] <Reason>" )
|
||||
SendMessage( Player, "Usage: /kick [Player] <Reason>" )
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
local Reason = "You have been kicked"
|
||||
if( #Split > 2 ) then
|
||||
Reason = table.concat(Split, " ", 3)
|
||||
if ( #Split > 2 ) then
|
||||
Reason = table.concat( Split, " ", 3 )
|
||||
end
|
||||
|
||||
|
||||
if( KickPlayer( Split[2], Reason ) == false ) then
|
||||
Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Could not find player " .. Split[2] )
|
||||
SendMessageFailure( Player, "Could not find player " .. Split[2] )
|
||||
end
|
||||
|
||||
return true
|
||||
|
||||
end
|
||||
|
||||
--- Kicks a player by name, with the specified reason; returns bool whether found and player's real name
|
||||
function KickPlayer(PlayerName, Reason)
|
||||
local RealName = "";
|
||||
function KickPlayer( PlayerName, Reason )
|
||||
|
||||
local RealName = ""
|
||||
if (Reason == nil) then
|
||||
Reason = "You have been kicked";
|
||||
Reason = "You have been kicked"
|
||||
end
|
||||
|
||||
local FoundPlayerCallback = function(a_Player)
|
||||
|
||||
local FoundPlayerCallback = function( a_Player )
|
||||
RealName = a_Player:GetName()
|
||||
|
||||
local Server = cRoot:Get():GetServer()
|
||||
LOGINFO( "'" .. RealName .. "' is being kicked for ( "..Reason..") " )
|
||||
Server:SendMessage("Kicking " .. RealName)
|
||||
|
||||
a_Player:GetClientHandle():Kick(Reason);
|
||||
a_Player:GetClientHandle():Kick(Reason)
|
||||
end
|
||||
|
||||
if (not(cRoot:Get():FindAndDoWithPlayer( PlayerName, FoundPlayerCallback))) then
|
||||
if not cRoot:Get():FindAndDoWithPlayer( PlayerName, FoundPlayerCallback ) then
|
||||
-- Could not find player
|
||||
return false;
|
||||
return false
|
||||
end
|
||||
|
||||
return true, RealName; -- Player has been kicked
|
||||
end
|
||||
|
||||
return true, RealName -- Player has been kicked
|
||||
|
||||
end
|
||||
|
34
MCServer/Plugins/Core/kill.lua
Normal file
34
MCServer/Plugins/Core/kill.lua
Normal file
@ -0,0 +1,34 @@
|
||||
function HandleKillCommand( Split, Player )
|
||||
|
||||
if (Split[2] == nil) then
|
||||
Player:TakeDamage(dtInVoid, nil, 1000, 1000, 0)
|
||||
return true
|
||||
end
|
||||
|
||||
local HasKilled = false;
|
||||
local KillPlayer = function(OtherPlayer)
|
||||
if (OtherPlayer:GetName() == Split[2]) then
|
||||
if (OtherPlayer:GetGameMode() == 1) then
|
||||
HasKilled = creative
|
||||
end
|
||||
if (OtherPlayer:GetGameMode() == 0) then
|
||||
OtherPlayer:TakeDamage(dtInVoid, nil, 1000, 1000, 0)
|
||||
HasKilled = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
cRoot:Get():FindAndDoWithPlayer(Split[2], KillPlayer);
|
||||
if (HasKilled == creative) then
|
||||
SendMessageFailure( Player, "Player " .. Split[2] .. " is in creative mode" )
|
||||
return true
|
||||
end
|
||||
if (HasKilled) then
|
||||
SendMessageSuccess( Player, "Player " .. Split[2] .. " is killed" )
|
||||
return true
|
||||
else
|
||||
SendMessageFailure( Player, "Player not found" )
|
||||
return true
|
||||
end
|
||||
|
||||
end
|
@ -1,4 +1,4 @@
|
||||
function HandleLocateCommand( Split, Player )
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. string.format("You are at [X:%0.2f Y:%0.2f Z:%0.2f] in world %s", Player:GetPosX(), Player:GetPosY(), Player:GetPosZ(), Player:GetWorld():GetName()) )
|
||||
SendMessage( Player, string.format("You are at [X:%0.2f Y:%0.2f Z:%0.2f] in world %s", Player:GetPosX(), Player:GetPosY(), Player:GetPosZ(), Player:GetWorld():GetName()) )
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
@ -4,180 +4,188 @@ BannedPlayersIni = {}
|
||||
WhiteListIni = {}
|
||||
BackCoords = {}
|
||||
Messages = {}
|
||||
Destination = {}
|
||||
--END VARIABLES
|
||||
|
||||
--COMMENCE AWESOMENESS!
|
||||
function Initialize(Plugin)
|
||||
function Initialize( Plugin )
|
||||
PLUGIN = Plugin
|
||||
|
||||
Plugin:SetName("Core")
|
||||
Plugin:SetVersion(13)
|
||||
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_PLAYER_BREAKING_BLOCK)
|
||||
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_PLACING_BLOCK)
|
||||
PluginManager:AddHook(Plugin, cPluginManager.HOOK_LOGIN)
|
||||
PluginManager:AddHook(Plugin, cPluginManager.HOOK_KILLING)
|
||||
PluginManager:AddHook(Plugin, cPluginManager.HOOK_CRAFTING_NO_RECIPE)
|
||||
PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHAT) -- used in web_chat.lua
|
||||
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_MOVING)
|
||||
PluginManager:AddHook( Plugin, cPluginManager.HOOK_PLAYER_JOINED )
|
||||
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 )
|
||||
PluginManager:AddHook( Plugin, cPluginManager.HOOK_KILLING )
|
||||
PluginManager:AddHook( Plugin, cPluginManager.HOOK_CRAFTING_NO_RECIPE )
|
||||
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");
|
||||
PluginManager:BindCommand("/ban", "core.ban", HandleBanCommand, " ~ Ban a player");
|
||||
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("/groups", "core.groups", HandleGroupsCommand, " - Shows a list of all the groups");
|
||||
PluginManager:BindCommand("/help", "core.help", HandleHelpCommand, " ~ Show available commands");
|
||||
--BIND COMMANDS
|
||||
PluginManager:BindCommand("/back", "core.back", HandleBackCommand, " - Return to your last position")
|
||||
PluginManager:BindCommand("/ban", "core.ban", HandleBanCommand, " ~ Ban a player")
|
||||
PluginManager:BindCommand("/clear", "core.clear", HandleClearCommand, " - Clear the inventory of some player")
|
||||
PluginManager:BindCommand("/give", "core.give", HandleGiveCommand, " ~ Give someone an item")
|
||||
PluginManager:BindCommand("/gm", "core.changegm", HandleChangeGMCommand, " ~ Change your gamemode")
|
||||
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("/me", "core.me", HandleMeCommand, " ~ Tell what you are doing");
|
||||
PluginManager:BindCommand("/motd", "core.motd", HandleMOTDCommand, " - Show message of the day");
|
||||
PluginManager:BindCommand("/plugins", "core.plugins", HandlePluginsCommand, " - Show list of plugins");
|
||||
PluginManager:BindCommand("/portal", "core.portal", HandlePortalCommand, " ~ Move to a different world");
|
||||
PluginManager:BindCommand("/rank", "core.rank", HandleRankCommand, " ~ Add someone to a group");
|
||||
PluginManager:BindCommand("/regen", "core.regen", HandleRegenCommand, " ~ Regenerates a chunk, current or specified");
|
||||
PluginManager:BindCommand("/reload", "core.reload", HandleReloadCommand, " - Reload all plugins");
|
||||
PluginManager:BindCommand("/save-all", "core.save-all", HandleSaveAllCommand, " - Saves all your worlds");
|
||||
PluginManager:BindCommand("/spawn", "core.spawn", HandleSpawnCommand, " - Return to the spawn");
|
||||
PluginManager:BindCommand("/stop", "core.stop", HandleStopCommand, " - Stops the server");
|
||||
PluginManager:BindCommand("/time", "core.time", HandleTimeCommand, " ~ Sets the time of day");
|
||||
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("/tpaccept", "core.teleport", HandleTPAcceptCommand, " ~ Accept a teleportation request");
|
||||
PluginManager:BindCommand("/unban", "core.unban", HandleUnbanCommand, " ~ Unban a player");
|
||||
PluginManager:BindCommand("/kick", "core.kick", HandleKickCommand, " ~ Kick a player")
|
||||
PluginManager:BindCommand("/kill", "core.kill", HandleKillCommand, " - Kill some player")
|
||||
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("/msg", "core.tell", HandleTellCommand, "")
|
||||
PluginManager:BindCommand("/plugins", "core.plugins", HandlePluginsCommand, " - Show list of plugins")
|
||||
PluginManager:BindCommand("/portal", "core.portal", HandlePortalCommand, " ~ Move to a different world")
|
||||
PluginManager:BindCommand("/rank", "core.rank", HandleRankCommand, " ~ Add someone to a group")
|
||||
PluginManager:BindCommand("/regen", "core.regen", HandleRegenCommand, " ~ Regenerates a chunk, current or specified")
|
||||
PluginManager:BindCommand("/reload", "core.reload", HandleReloadCommand, " - Reload all plugins")
|
||||
PluginManager:BindCommand("/save-all", "core.save-all", HandleSaveAllCommand, " - Saves all your worlds")
|
||||
PluginManager:BindCommand("/spawn", "core.spawn", HandleSpawnCommand, " - Return to the spawn")
|
||||
PluginManager:BindCommand("/stop", "core.stop", HandleStopCommand, " - Stops the server")
|
||||
PluginManager:BindCommand("/tell", "core.tell", HandleTellCommand, " ~ Send a private message")
|
||||
PluginManager:BindCommand("/time", "core.time", HandleTimeCommand, " ~ Sets the time of day")
|
||||
PluginManager:BindCommand("/toggledownfall", "core.toggledownfall", HandleDownfallCommand, " - Toggles the weather")
|
||||
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("/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")
|
||||
PluginManager:BindCommand("/worlds", "core.worlds", HandleWorldsCommand, " - Shows a list of all the worlds");
|
||||
PluginManager:BindCommand("/weather", "core.weather", HandleWeatherCommand, " ~ Change world weather")
|
||||
PluginManager:BindCommand("/worlds", "core.worlds", HandleWorldsCommand, " - Shows a list of all the worlds")
|
||||
|
||||
InitConsoleCommands();
|
||||
InitConsoleCommands()
|
||||
|
||||
--LOAD SETTINGS
|
||||
IniFile = cIniFile("settings.ini")
|
||||
if ( IniFile:ReadFile() == true ) then
|
||||
HardCore = IniFile:GetValueSet("GameMode", "Hardcore", "false")
|
||||
IniFile = cIniFile( "settings.ini" )
|
||||
if IniFile:ReadFile() == true then
|
||||
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?)
|
||||
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")
|
||||
WorldIni = cIniFile( IniFile:GetValue(KeyIdx, i) .. "/world.ini" )
|
||||
if WorldIni:ReadFile() == true then
|
||||
WorldsSpawnProtect[IniFile:GetValue(KeyIdx, i)] = WorldIni:GetValueSetI("SpawnProtect", "ProtectRadius", 10)
|
||||
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?)
|
||||
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")
|
||||
WorldIni = cIniFile( IniFile:GetValue(KeyIdx, i) .. "/world.ini" )
|
||||
if WorldIni:ReadFile() == true then
|
||||
WorldsWorldLimit[IniFile:GetValue(KeyIdx, i)] = WorldIni:GetValueSetI("WorldLimit", "LimitRadius", 0)
|
||||
WorldsWorldLimit[IniFile:GetValue(KeyIdx, i)] = WorldIni:GetValueSetI( "WorldLimit", "LimitRadius", 0 )
|
||||
WorldIni:WriteFile()
|
||||
end
|
||||
end
|
||||
|
||||
--LOAD WHITELIST
|
||||
WhiteListIni = cIniFile( Plugin:GetLocalDirectory() .. "/whitelist.ini" )
|
||||
if ( WhiteListIni:ReadFile() == true ) then
|
||||
if( WhiteListIni:GetValueB("WhiteListSettings", "WhiteListOn", false) == true ) then
|
||||
if( WhiteListIni:GetNumValues("WhiteList") > 0 ) then
|
||||
LOGINFO("Core: loaded " .. WhiteListIni:GetNumValues('WhiteList') .. " whitelisted players.")
|
||||
if WhiteListIni:ReadFile() == true then
|
||||
if WhiteListIni:GetValueB( "WhiteListSettings", "WhiteListOn", false ) == true then
|
||||
if WhiteListIni:GetNumValues( "WhiteList" ) > 0 then
|
||||
LOGINFO( "Core: loaded " .. WhiteListIni:GetNumValues('WhiteList') .. " whitelisted players." )
|
||||
else
|
||||
LOGWARN("WARNING: WhiteList is on, but there are no people in the whitelist!")
|
||||
LOGWARN( "WARNING: WhiteList is on, but there are no people in the whitelist!" )
|
||||
end
|
||||
end
|
||||
else
|
||||
WhiteListIni:SetValueB("WhiteListSettings", "WhiteListOn", false )
|
||||
WhiteListIni:SetValue("WhiteList", "", "") -- So it adds an empty header
|
||||
WhiteListIni:DeleteValue("WhiteList", "") -- And remove the value
|
||||
WhiteListIni:KeyComment("WhiteList", "PlayerName=1")
|
||||
if( WhiteListIni:WriteFile() == false ) then
|
||||
LOGWARN("WARNING: Could not write to whitelist.ini")
|
||||
WhiteListIni:SetValueB( "WhiteListSettings", "WhiteListOn", false )
|
||||
WhiteListIni:SetValue( "WhiteList", "", "" ) -- So it adds an empty header
|
||||
WhiteListIni:DeleteValue( "WhiteList", "" ) -- And remove the value
|
||||
WhiteListIni:KeyComment( "WhiteList", "PlayerName=1" )
|
||||
if WhiteListIni:WriteFile() == false then
|
||||
LOGWARN( "WARNING: Could not write to whitelist.ini" )
|
||||
end
|
||||
end
|
||||
|
||||
--LOAD BANNED (BAD LUCK, BRO)
|
||||
BannedPlayersIni = cIniFile( Plugin:GetLocalDirectory() .. "/banned.ini" )
|
||||
if ( BannedPlayersIni:ReadFile() == true ) then
|
||||
if( BannedPlayersIni:GetNumValues("Banned") > 0 ) then
|
||||
LOGINFO("Core: loaded " .. BannedPlayersIni:GetNumValues("Banned") .. " banned players.")
|
||||
if BannedPlayersIni:ReadFile() == true then
|
||||
if BannedPlayersIni:GetNumValues( "Banned" ) > 0 then
|
||||
LOGINFO( "Core: loaded " .. BannedPlayersIni:GetNumValues("Banned") .. " banned players." )
|
||||
end
|
||||
else
|
||||
BannedPlayersIni:SetValue("Banned", "", "") -- So it adds an empty header
|
||||
BannedPlayersIni:DeleteValue("Banned", "") -- And remove the value
|
||||
BannedPlayersIni:KeyComment("Banned", "PlayerName=1")
|
||||
if( BannedPlayersIni:WriteFile() == false ) then
|
||||
LOGWARN("WARNING: Could not write to banned.ini")
|
||||
BannedPlayersIni:SetValue( "Banned", "", "" ) -- So it adds an empty header
|
||||
BannedPlayersIni:DeleteValue( "Banned", "" ) -- And remove the value
|
||||
BannedPlayersIni:KeyComment( "Banned", "PlayerName=1" )
|
||||
if BannedPlayersIni:WriteFile() == false then
|
||||
LOGWARN( "WARNING: Could not write to banned.ini" )
|
||||
end
|
||||
end
|
||||
|
||||
--ADD WEB INTERFACE TABULATES
|
||||
Plugin:AddWebTab("Manage Server", HandleRequest_ManageServer);
|
||||
Plugin:AddWebTab("Server Settings", HandleRequest_ServerSettings);
|
||||
Plugin:AddWebTab("Chat", HandleRequest_Chat);
|
||||
Plugin:AddWebTab("Playerlist", HandleRequest_PlayerList);
|
||||
Plugin:AddWebTab("Whitelist", HandleRequest_WhiteList);
|
||||
Plugin:AddWebTab("Permissions", HandleRequest_Permissions);
|
||||
Plugin:AddWebTab("Manage Plugins", HandleRequest_ManagePlugins);
|
||||
Plugin:AddWebTab( "Manage Server", HandleRequest_ManageServer )
|
||||
Plugin:AddWebTab( "Server Settings", HandleRequest_ServerSettings )
|
||||
Plugin:AddWebTab( "Chat", HandleRequest_Chat )
|
||||
Plugin:AddWebTab( "Playerlist", HandleRequest_PlayerList )
|
||||
Plugin:AddWebTab( "Whitelist", HandleRequest_WhiteList )
|
||||
Plugin:AddWebTab( "Permissions", HandleRequest_Permissions )
|
||||
Plugin:AddWebTab( "Manage Plugins", HandleRequest_ManagePlugins )
|
||||
|
||||
LoadMotd()
|
||||
LOG( "Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion() )
|
||||
|
||||
return true
|
||||
|
||||
end
|
||||
--AWESOMENESS STILL GOING!
|
||||
|
||||
--BEGIN SPAWNPROTECT LOGFILE CODE (COURTSEY OF BEARBIN)
|
||||
function WriteLog(breakPlace, X, Y, Z, player, id, meta)
|
||||
function WriteLog( breakPlace, X, Y, Z, player, id, meta )
|
||||
|
||||
local logText = {}
|
||||
|
||||
table.insert(logText, player)
|
||||
table.insert(logText, " tried to ")
|
||||
table.insert( logText, player )
|
||||
table.insert( logText, " tried to " )
|
||||
|
||||
if breakPlace == 0 then
|
||||
table.insert(logText, "break ")
|
||||
table.insert( logText, "break " )
|
||||
else
|
||||
table.insert(logText, "place ")
|
||||
table.insert( logText, "place " )
|
||||
end
|
||||
|
||||
|
||||
table.insert(logText, ItemToString(cItem(id, 1, meta)))
|
||||
table.insert(logText, " at ")
|
||||
table.insert(logText, tostring(X))
|
||||
table.insert(logText, ", ")
|
||||
table.insert(logText, tostring(Y))
|
||||
table.insert(logText, ", ")
|
||||
table.insert(logText, tostring(Z))
|
||||
table.insert(logText, ".")
|
||||
table.insert( logText, ItemToString(cItem(id, 1, meta)) )
|
||||
table.insert( logText, " at ")
|
||||
table.insert( logText, tostring(X) )
|
||||
table.insert( logText, ", ")
|
||||
table.insert( logText, tostring(Y) )
|
||||
table.insert( logText, ", ")
|
||||
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")
|
||||
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
|
||||
|
||||
function WarnPlayer( Player )
|
||||
SendMessageFailure( Player, "Go further from spawn to build" )
|
||||
return true
|
||||
end
|
||||
|
||||
function OnDisable()
|
||||
LOG( "Disabled Core!")
|
||||
LOG( "Disabled Core!" )
|
||||
end
|
||||
--END AWESOMENESS :'(
|
||||
|
@ -1,15 +1,20 @@
|
||||
function HandleMeCommand( Split, Player )
|
||||
table.remove(Split, 1);
|
||||
local Message = "";
|
||||
for i, Text in ipairs(Split) do
|
||||
Message = Message .. " " .. Text;
|
||||
|
||||
table.remove( Split, 1 )
|
||||
local Message = ""
|
||||
|
||||
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>")
|
||||
|
||||
if Split[1] == nil then
|
||||
SendMessage( Player, "Usage: /me <action>" )
|
||||
return true
|
||||
end
|
||||
if (Split[1] ~= nil) then
|
||||
cRoot:Get():GetServer():BroadcastChat(Player:GetName() .. "" .. Message);
|
||||
|
||||
if Split[1] ~= nil then
|
||||
cRoot:Get():GetServer():BroadcastChat( Player:GetName() .. "" .. Message )
|
||||
return true
|
||||
end
|
||||
|
||||
end
|
||||
|
27
MCServer/Plugins/Core/messages.lua
Normal file
27
MCServer/Plugins/Core/messages.lua
Normal file
@ -0,0 +1,27 @@
|
||||
-- Use prefixes or not.
|
||||
-- If set to true, messages are prefixed, e. g. "[FATAL]". If false, messages are colored.
|
||||
g_UsePrefixes = true
|
||||
|
||||
function SendMessage(a_Player, a_Message)
|
||||
if (g_UsePrefixes) then
|
||||
a_Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. a_Message)
|
||||
else
|
||||
a_Player:SendMessage(cChatColor.Yellow .. a_Message)
|
||||
end
|
||||
end
|
||||
|
||||
function SendMessageSuccess(a_Player, a_Message)
|
||||
if (g_UsePrefixes) then
|
||||
a_Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. a_Message)
|
||||
else
|
||||
a_Player:SendMessage(cChatColor.Green .. a_Message)
|
||||
end
|
||||
end
|
||||
|
||||
function SendMessageFailure(a_Player, a_Message)
|
||||
if (g_UsePrefixes) then
|
||||
a_Player:SendMessage(cChatColor.Red .. "[INFO] " .. cChatColor.White .. a_Message)
|
||||
else
|
||||
a_Player:SendMessage(cChatColor.Red .. a_Message)
|
||||
end
|
||||
end
|
@ -4,32 +4,36 @@ function HandleMOTDCommand( Split, Player )
|
||||
end
|
||||
|
||||
function LoadMotd()
|
||||
local File = io.open("motd.txt", "r")
|
||||
|
||||
local File = io.open( "motd.txt", "r" )
|
||||
|
||||
-- Check if the file 'motd.txt' exists, else create it.
|
||||
if not File then
|
||||
CreateFile = io.open("motd.txt", "w")
|
||||
CreateFile = io.open( "motd.txt", "w" )
|
||||
CreateFile:write("@6Welcome to the MCServer test server!\n@6http://www.mc-server.org/\n@6Type /help for all commands")
|
||||
CreateFile:close()
|
||||
else
|
||||
File:close()
|
||||
end
|
||||
for line in io.lines("motd.txt") do
|
||||
|
||||
for line in io.lines( "motd.txt" ) do
|
||||
local TempMessage = line
|
||||
-- Do a for loop that goes to each char in the line.
|
||||
for I=1, string.len(TempMessage) do
|
||||
for I=1, string.len( TempMessage ) do
|
||||
-- If the char is a '@' then check if the next char represents a color.
|
||||
if string.sub(TempMessage, I, I) == "@" then
|
||||
local Char = string.sub(TempMessage, I + 1, I + 1)
|
||||
local Color = ReturnColorFromChar(TempMessage, Char)
|
||||
if string.sub( TempMessage, I, I ) == "@" then
|
||||
local Char = string.sub( TempMessage, I + 1, I + 1 )
|
||||
local Color = ReturnColorFromChar( TempMessage, Char )
|
||||
-- If the next char represented a color then put the color in the string.
|
||||
if (Color ~= nil) then
|
||||
TempMessage = string.gsub(TempMessage, "@" .. Char, Color)
|
||||
if Color ~= nil then
|
||||
TempMessage = string.gsub( TempMessage, "@" .. Char, Color )
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Add the message to the list of messages.
|
||||
Messages[#Messages + 1] = TempMessage
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function ShowMOTDTo( Player )
|
||||
@ -39,6 +43,7 @@ function ShowMOTDTo( Player )
|
||||
end
|
||||
|
||||
function ReturnColorFromChar( Split, char )
|
||||
|
||||
-- Check if the char represents a color. Else return nil.
|
||||
if char == "0" then
|
||||
return cChatColor.Black
|
||||
@ -85,4 +90,5 @@ function ReturnColorFromChar( Split, char )
|
||||
elseif char == "r" then
|
||||
return cChatColor.Plain
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,15 +1,17 @@
|
||||
function HandlePluginsCommand( Split, Player )
|
||||
|
||||
local PluginManager = cRoot:Get():GetPluginManager()
|
||||
local PluginList = PluginManager:GetAllPlugins()
|
||||
|
||||
local PluginTable = {}
|
||||
for k, Plugin in pairs( PluginList ) do
|
||||
if ( Plugin ) then
|
||||
table.insert(PluginTable, Plugin:GetName() )
|
||||
if Plugin then
|
||||
table.insert( PluginTable, Plugin:GetName() )
|
||||
end
|
||||
end
|
||||
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "There are " .. #PluginTable .. " loaded plugins")
|
||||
Player:SendMessage(cChatColor.Gold .. table.concat(PluginTable, cChatColor.Gold.." ") )
|
||||
SendMessage( Player, "There are " .. #PluginTable .. " loaded plugins" )
|
||||
SendMessage( Player, table.concat( PluginTable , " " ) )
|
||||
return true
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,24 +1,27 @@
|
||||
function HandlePortalCommand( Split, Player )
|
||||
|
||||
if( #Split ~= 2 ) then
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /portal [WorldName]" )
|
||||
return true
|
||||
end
|
||||
|
||||
if( Player:MoveToWorld(Split[2]) == false ) then
|
||||
Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Could not move to world " .. Split[2] .. "!" )
|
||||
SendMessage( Player, "Usage: /portal [WorldName]" )
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Moved successfully to '" .. Split[2] .. "'! :D" )
|
||||
|
||||
if( Player:MoveToWorld(Split[2]) == false ) then
|
||||
SendMessageFailure( Player, "Could not move to world " .. Split[2] .. "!" )
|
||||
return true
|
||||
end
|
||||
|
||||
SendMessageSuccess( Player, "Moved successfully to '" .. Split[2] .. "'! :D" )
|
||||
return true
|
||||
|
||||
end
|
||||
|
||||
function HandleWorldsCommand( Split, Player )
|
||||
|
||||
local SettingsIni = cIniFile("settings.ini")
|
||||
if SettingsIni:ReadFile() == false then
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "No worlds found" )
|
||||
SendMessageFailure( Player, "No worlds found" )
|
||||
end
|
||||
|
||||
Number = SettingsIni:NumValues("Worlds") - 1
|
||||
Worlds = {}
|
||||
for i=0, SettingsIni:GetNumKeys() - 1 do
|
||||
@ -27,10 +30,12 @@ function HandleWorldsCommand( Split, Player )
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
for i=0, Number do
|
||||
table.insert( Worlds, SettingsIni:GetValue( Key, i) )
|
||||
table.insert( Worlds, SettingsIni:GetValue( Key, i ) )
|
||||
end
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Found " .. #Worlds .. " worlds" )
|
||||
Player:SendMessage(cChatColor.Gold .. table.concat( Worlds, ", " ) )
|
||||
SendMessage( Player, "Found " .. #Worlds .. " worlds" )
|
||||
SendMessage( Player, table.concat( Worlds, ", " ) )
|
||||
return true
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,48 +1,63 @@
|
||||
function HandleRankCommand( Split, Player )
|
||||
|
||||
if Split[2] == nil or Split[3] == nil then
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /rank [Player] [Group]")
|
||||
SendMessage( Player, "Usage: /rank [Player] [Group]" )
|
||||
return true
|
||||
end
|
||||
local GroupsIni = cIniFile("groups.ini")
|
||||
if( GroupsIni:ReadFile() == false ) then
|
||||
LOG("Could not read groups.ini!")
|
||||
|
||||
local GroupsIni = cIniFile( "groups.ini" )
|
||||
if GroupsIni:ReadFile() == false then
|
||||
LOG( "Could not read groups.ini!" )
|
||||
end
|
||||
|
||||
if GroupsIni:FindKey(Split[3]) == -1 then
|
||||
Player:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Group does not exist")
|
||||
SendMessageFailure( Player, "Group does not exist" )
|
||||
return true
|
||||
end
|
||||
|
||||
local UsersIni = cIniFile("users.ini")
|
||||
if( UsersIni:ReadFile() == false ) then
|
||||
LOG("Could not read users.ini!")
|
||||
if UsersIni:ReadFile() == false then
|
||||
LOG( "Could not read users.ini!" )
|
||||
end
|
||||
UsersIni:DeleteKey(Split[2])
|
||||
UsersIni:GetValueSet(Split[2], "Groups", Split[3])
|
||||
|
||||
UsersIni:DeleteKey( Split[2] )
|
||||
UsersIni:GetValueSet( Split[2], "Groups", Split[3] )
|
||||
UsersIni:WriteFile()
|
||||
|
||||
local loopPlayers = function( Player )
|
||||
if Player:GetName() == Split[2] then
|
||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "You were moved to group " .. Split[3] )
|
||||
SendMessageSuccess( Player, "You were moved to group " .. Split[3] )
|
||||
Player:LoadPermissionsFromDisk()
|
||||
end
|
||||
end
|
||||
|
||||
local loopWorlds = function ( World )
|
||||
World:ForEachPlayer( loopPlayers )
|
||||
end
|
||||
|
||||
cRoot:Get():ForEachWorld( loopWorlds )
|
||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Player " .. Split[2] .. " Was moved to " .. Split[3])
|
||||
SendMessageSuccess( Player, "Player " .. Split[2] .. " Was moved to " .. Split[3] )
|
||||
|
||||
return true
|
||||
|
||||
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" )
|
||||
SendMessageFailure( Player, "No groups found" )
|
||||
end
|
||||
|
||||
Number = GroupsIni:NumKeys() - 1
|
||||
Groups = {}
|
||||
for i=0, Number do
|
||||
table.insert( Groups, GroupsIni:KeyName(i) )
|
||||
table.insert( Groups, GroupsIni:KeyName( i ) )
|
||||
end
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Found " .. #Groups .. " groups" )
|
||||
Player:SendMessage(cChatColor.Gold .. table.concat( Groups, " " ) )
|
||||
|
||||
SendMessage( Player, "Found " .. #Groups .. " groups" )
|
||||
SendMessage( Player, table.concat( Groups, " " ) )
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,18 +1,20 @@
|
||||
function HandleRegenCommand(Split, Player)
|
||||
if ((#Split == 2) or (#Split > 3)) then
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: '/regeneratechunk' or '/regeneratechunk [X] [Z]'");
|
||||
return true;
|
||||
|
||||
if #Split == 2 or #Split > 3 then
|
||||
SendMessage( Player, "Usage: '/regeneratechunk' or '/regeneratechunk [X] [Z]'" )
|
||||
return true
|
||||
end
|
||||
|
||||
local X = Player:GetChunkX();
|
||||
local Z = Player:GetChunkZ();
|
||||
|
||||
if (#Split == 3) then
|
||||
X = Split[2];
|
||||
Z = Split[3];
|
||||
|
||||
local X = Player:GetChunkX()
|
||||
local Z = Player:GetChunkZ()
|
||||
|
||||
if #Split == 3 then
|
||||
X = Split[2]
|
||||
Z = Split[3]
|
||||
end
|
||||
|
||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Regenerating chunk ["..X..", "..Z.."]");
|
||||
Player:GetWorld():RegenerateChunk(X, Z);
|
||||
return true;
|
||||
end
|
||||
|
||||
SendMessageSuccess( Player, "Regenerating chunk ["..X..", "..Z.."]")
|
||||
Player:GetWorld():RegenerateChunk(X, Z)
|
||||
return true
|
||||
|
||||
end
|
||||
|
@ -1,22 +1,28 @@
|
||||
function HandleSaveAllCommand( Split, Player )
|
||||
cRoot:Get():SaveAllChunks();
|
||||
|
||||
cRoot:Get():SaveAllChunks()
|
||||
local Server = cRoot:Get():GetServer()
|
||||
Server:SendMessage(cChatColor.Rose .. "[WARNING] " .. cChatColor.White .. "Saving all worlds!")
|
||||
return true;
|
||||
return true
|
||||
|
||||
end
|
||||
|
||||
function HandleStopCommand( Split, Player )
|
||||
|
||||
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:SendMessage(cChatColor.Rose .. "[WARNING] " .. cChatColor.White .. "Reloading all plugins!" )
|
||||
cRoot:Get():GetPluginManager():ReloadPlugins()
|
||||
return true
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,7 +1,9 @@
|
||||
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" )
|
||||
SendMessageSuccess( Player, "Returned to world spawn" )
|
||||
return true
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,80 +1,100 @@
|
||||
function HandleTPCommand(a_Split, a_Player)
|
||||
if ((#a_Split == 2) or (#a_Split == 3)) then
|
||||
|
||||
if #a_Split == 2 or #a_Split == 3 then
|
||||
|
||||
-- Teleport to player specified in a_Split[2], tell them unless a_Split[3] equals "-h":
|
||||
TeleportToPlayer(a_Player, a_Split[2], (a_Split[3] ~= "-h"));
|
||||
return true;
|
||||
elseif (#a_Split == 4) then
|
||||
TeleportToPlayer( a_Player, a_Split[2], (a_Split[3] ~= "-h") )
|
||||
return true
|
||||
|
||||
elseif #a_Split == 4 then
|
||||
|
||||
-- Teleport to XYZ coords specified in a_Split[2, 3, 4]:
|
||||
SetBackCoordinates(a_Player);
|
||||
a_Player:TeleportToCoords(a_Split[2], a_Split[3], a_Split[4]);
|
||||
a_Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "You teleported to [X:" .. a_Split[2] .. " Y:" .. a_Split[3] .. " Z:" .. a_Split[4] .. "]");
|
||||
return true;
|
||||
SetBackCoordinates(a_Player)
|
||||
a_Player:TeleportToCoords( a_Split[2], a_Split[3], a_Split[4] )
|
||||
SendMessageSuccess( a_Player, "You teleported to [X:" .. a_Split[2] .. " Y:" .. a_Split[3] .. " Z:" .. a_Split[4] .. "]" )
|
||||
return true
|
||||
|
||||
else
|
||||
a_Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /tp [PlayerName] (-h) or /tp [X Y Z]" )
|
||||
SendMessage( a_Player, "Usage: /tp [PlayerName] (-h) or /tp [X Y Z]" )
|
||||
return true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function HandleTPACommand( Split, Player )
|
||||
|
||||
if Split[2] == nil then
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /tpa [Player]" )
|
||||
SendMessage( Player, "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() )
|
||||
SendMessage( OtherPlayer, Player:GetName() .. " send a teleport request" )
|
||||
SendMessageSuccess( Player, "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" )
|
||||
SendMessageFailure( Player, "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() )
|
||||
SendMessage( Player, OtherPlayer:GetName() .. " teleported to you" )
|
||||
SendMessageSuccess( OtherPlayer, "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
|
||||
function TeleportToPlayer(a_SrcPlayer, a_DstPlayerName, a_TellDst)
|
||||
function TeleportToPlayer( a_SrcPlayer, a_DstPlayerName, a_TellDst )
|
||||
|
||||
local teleport = function(OtherPlayer)
|
||||
if (OtherPlayer == a_SrcPlayer) then
|
||||
|
||||
if OtherPlayer == a_SrcPlayer then
|
||||
-- Asked to teleport to self?
|
||||
a_SrcPlayer:SendMessage(cChatColor.Rose .. "[INFO] " .. cChatColor.White .. "Y' can't teleport to yerself!");
|
||||
SendMessageFailure( a_SrcPlayer, "Y' can't teleport to yerself!" )
|
||||
else
|
||||
SetBackCoordinates(a_SrcPlayer);
|
||||
a_SrcPlayer:TeleportToEntity(OtherPlayer);
|
||||
a_SrcPlayer:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "You teleported to " .. OtherPlayer:GetName() .. "!");
|
||||
SetBackCoordinates( a_SrcPlayer )
|
||||
a_SrcPlayer:TeleportToEntity( OtherPlayer )
|
||||
SendMessageSuccess( a_SrcPlayer, "You teleported to " .. OtherPlayer:GetName() .. "!" )
|
||||
if (a_TellDst) then
|
||||
OtherPlayer:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. Player:GetName().." teleported to you!");
|
||||
SendMessage( OtherPlayer, Player:GetName().." teleported to you!" )
|
||||
end
|
||||
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
|
||||
SendMessageFailure( a_SrcPlayer, "Can't find player " .. a_DstPlayerName)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
37
MCServer/Plugins/Core/tell.lua
Normal file
37
MCServer/Plugins/Core/tell.lua
Normal file
@ -0,0 +1,37 @@
|
||||
function HandleTellCommand(Split, Player, OtherPlayer)
|
||||
if (Split[2] == nil) or (Split[3] == nil) then
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. "Usage: /tell [playername] [message]")
|
||||
return true
|
||||
end
|
||||
|
||||
local SendMessage = function(OtherPlayer)
|
||||
|
||||
Sender = Player:GetName()
|
||||
Reciever = Split[2]
|
||||
|
||||
if (OtherPlayer:GetName() == Split[2]) then
|
||||
Server = cRoot:Get():GetServer()
|
||||
FullMsg = ""
|
||||
|
||||
for i,v in ipairs(Split) do
|
||||
if(i>2) then
|
||||
if(FullMsg == "") then
|
||||
FullMsg = v
|
||||
else
|
||||
FullMsg = FullMsg .. " " .. v
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. "Message to player " .. Reciever .. " sent!" )
|
||||
OtherPlayer:SendMessage(cChatColor.Orange .. "[MSG: " .. Sender .. " ] " .. FullMsg )
|
||||
else
|
||||
Player:SendMessage(cChatColor.Red .. 'Player "' ..Split[2].. '" not found')
|
||||
end
|
||||
end
|
||||
|
||||
cRoot:Get():ForEachPlayer(SendMessage)
|
||||
return true;
|
||||
end
|
||||
|
||||
|
@ -1,23 +1,26 @@
|
||||
function HandleTimeCommand( Split, Player )
|
||||
if Split[2] == nil then
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /time [Day/Night/Set/Add]" )
|
||||
|
||||
if Split[2] == nil then
|
||||
SendMessage( Player, "Usage: /time [Day/Night/Set/Add]" )
|
||||
return true
|
||||
end
|
||||
|
||||
local Server = cRoot:Get():GetServer()
|
||||
if( string.upper( Split[2] ) == "DAY") then
|
||||
if string.upper( Split[2] ) == "DAY" then
|
||||
Player:GetWorld():SetTimeOfDay( 0 )
|
||||
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 )
|
||||
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
|
||||
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
|
||||
Player:GetWorld():SetTimeOfDay( tonumber(Split[3]) )
|
||||
Server:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Time was set to " .. Split[3] )
|
||||
elseif( string.upper(Split[2]) == "ADD" ) and ( tonumber(Split[3]) ~= nil) then
|
||||
Server:SendMessage( cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Time was set to " .. Split[3] )
|
||||
elseif string.upper( Split[2] ) == "ADD" and tonumber( Split[3] ) ~= nil then
|
||||
Player:GetWorld():SetTimeOfDay( Player:GetWorld():GetTimeOfDay() + Split[3] )
|
||||
Server:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. Split[3] .. "Was added to the time" )
|
||||
Server:SendMessage( cChatColor.Green .. "[INFO] " .. cChatColor.White .. Split[3] .. "Was added to the time" )
|
||||
else
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /time [Day/Night/Set/Add]" )
|
||||
SendMessage( Player, "Usage: /time [Day/Night/Set/Add]" )
|
||||
end
|
||||
return true
|
||||
|
||||
end
|
||||
|
@ -1,11 +1,13 @@
|
||||
function HandleTopCommand( Split, Player )
|
||||
|
||||
local World = Player:GetWorld()
|
||||
|
||||
|
||||
local PlayerPos = Player:GetPosition()
|
||||
local Height = World:GetHeight( math.floor(PlayerPos.x), math.floor(PlayerPos.z) )
|
||||
local Height = World:GetHeight( math.floor( PlayerPos.x ), math.floor( PlayerPos.z ) )
|
||||
SetBackCoordinates( Player )
|
||||
Player:TeleportToCoords( PlayerPos.x, Height+1, PlayerPos.z )
|
||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Teleported to the topmost block")
|
||||
|
||||
SendMessageSuccess( Player, "Teleported to the topmost block" )
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,10 +1,12 @@
|
||||
function HandleViewDistanceCommand( Split, Player )
|
||||
|
||||
if( #Split ~= 2 ) then
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Usage: /viewdistance [".. cClientHandle.MIN_VIEW_DISTANCE .."-".. cClientHandle.MAX_VIEW_DISTANCE .."]" )
|
||||
SendMessage( Player, "Usage: /viewdistance [".. cClientHandle.MIN_VIEW_DISTANCE .."-".. cClientHandle.MAX_VIEW_DISTANCE .."]" )
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
Player:GetClientHandle():SetViewDistance( Split[2] )
|
||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Your view distance has been set to " .. Player:GetClientHandle():GetViewDistance() )
|
||||
SendMessageSuccess( Player, "Your view distance has been set to " .. Player:GetClientHandle():GetViewDistance() )
|
||||
return true
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,10 +1,21 @@
|
||||
function HandleDownfallCommand( Split, Player )
|
||||
World = Player:GetWorld()
|
||||
if World:GetWeather() == 0 then
|
||||
World:SetWeather(1)
|
||||
else
|
||||
World:SetWeather(0)
|
||||
function HandleWeatherCommand(Split, Player)
|
||||
|
||||
if #Split ~= 2 then
|
||||
SendMessage( Player, "Usage: /weather [clear/rain/thunder]" )
|
||||
return true
|
||||
end
|
||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "Downfall toggled")
|
||||
|
||||
if (Split[2] == "clear") then
|
||||
Player:GetWorld():SetWeather(0)
|
||||
SendMessageSuccess( Player, "Downfall stopped" )
|
||||
elseif (Split[2] == "rain") then
|
||||
Player:GetWorld():SetWeather(1)
|
||||
SendMessageSuccess( Player, "Let it rain!" )
|
||||
elseif (Split[2] == "thunder") then
|
||||
Player:GetWorld():SetWeather(2)
|
||||
SendMessageSuccess( Player, "Thundery showers activate!")
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -10,15 +10,15 @@ local function ShowUsersTable()
|
||||
local Content = "<h4>Users</h4>"
|
||||
|
||||
local NumUsers = UsersIni:GetNumKeys()
|
||||
|
||||
|
||||
Content = Content .. "<table>"
|
||||
|
||||
|
||||
if( NumUsers > 0 ) then
|
||||
Content = Content .. "<tr><th></th><th>User</th><th>Groups</th></tr>"
|
||||
|
||||
|
||||
for i=0, NumUsers-1 do
|
||||
local UserName = UsersIni:GetKeyName( i )
|
||||
|
||||
|
||||
Content = Content .. "<tr>"
|
||||
Content = Content .. "<td style='width: 10px;'>" .. i .. ".</td>"
|
||||
Content = Content .. "<td>" .. UserName .. "</td>"
|
||||
@ -31,23 +31,23 @@ local function ShowUsersTable()
|
||||
Content = Content .. "<tr><td>None</td></tr>"
|
||||
end
|
||||
Content = Content .. "</table>"
|
||||
|
||||
|
||||
|
||||
|
||||
return Content
|
||||
end
|
||||
|
||||
local function ShowGroupsTable()
|
||||
local Content = "<h4>Groups</h4>"
|
||||
|
||||
|
||||
local NumGroups = GroupsIni:GetNumKeys()
|
||||
|
||||
|
||||
Content = Content .. "<table>"
|
||||
if( NumGroups > 0 ) then
|
||||
Content = Content .. "<tr><th></th><th>Name</th><th>Permissions</th><th>Color</th></tr>"
|
||||
|
||||
|
||||
for i=0, NumGroups-1 do
|
||||
local GroupName = GroupsIni:GetKeyName( i )
|
||||
|
||||
|
||||
Content = Content .. "<tr>"
|
||||
Content = Content .. "<td style='width: 10px;'>" .. i .. ".</td>"
|
||||
Content = Content .. "<td>" .. GroupName .. "</td>"
|
||||
@ -63,14 +63,14 @@ local function ShowGroupsTable()
|
||||
Content = Content .. "<tr><td>None</td></tr>"
|
||||
end
|
||||
Content = Content .. "</table>"
|
||||
|
||||
|
||||
return Content
|
||||
end
|
||||
|
||||
local function HTML_Select_Group( name, defaultValue )
|
||||
Groups = ""
|
||||
for I=0, GroupsIni:GetNumKeys() - 1 do
|
||||
Groups = Groups ..
|
||||
Groups = Groups ..
|
||||
HTML_Option(GroupsIni:KeyName(I), GroupsIni:KeyName(I), defaultValue == GroupsIni:KeyName(I) )
|
||||
end
|
||||
return [[<select name="]] .. name .. [[">]] .. Groups .. [[</select>]]
|
||||
@ -90,7 +90,7 @@ local function AddPlayers( Request )
|
||||
UsersIni:WriteFile()
|
||||
local loopPlayers = function( Player )
|
||||
if Player:GetName() == Request.PostParams["AddPlayer"] then
|
||||
Player:SendMessage( cChatColor.Green .. "You were moved to group " .. Request.PostParams["AddGroup"] )
|
||||
SendMessageSuccess( Player, "You were moved to group " .. Request.PostParams["AddGroup"] )
|
||||
Player:LoadPermissionsFromDisk()
|
||||
end
|
||||
end
|
||||
@ -110,7 +110,7 @@ local function AddPlayers( Request )
|
||||
<td>]] .. HTML_Select_Group("AddGroup", GroupsIni:KeyName(0) ) .. [[</td></tr>
|
||||
</table>
|
||||
<input type="submit" value="Add Player" name="AddPlayerToGroup">]]
|
||||
|
||||
|
||||
return Content
|
||||
end
|
||||
|
||||
@ -123,12 +123,12 @@ function HandleRequest_Permissions( Request )
|
||||
if( UsersIni:ReadFile() == false ) then
|
||||
return "Could not read users.ini!"
|
||||
end
|
||||
|
||||
|
||||
local Content = ""
|
||||
|
||||
|
||||
Content = Content .. AddPlayers( Request )
|
||||
Content = Content .. ShowGroupsTable()
|
||||
Content = Content .. ShowUsersTable()
|
||||
|
||||
|
||||
return Content
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user