From 207a45217115e19d25df5dbadb3ac38b7f6dadf1 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Fri, 2 Aug 2013 07:48:47 +0100 Subject: Pull in the latest core changes. Squashed commit of the following: commit da84f4977522ab48ead4af7a71efd43cdd4e3d0a Merge: cc77056 a631484 Author: bearbin 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 Date: Thu Aug 1 16:47:15 2013 +0100 Changed everything to use the correct system of tabs. commit cc7705645b6b387c618c9448fa6b0d5c789370c6 Author: Tiger Wang 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 Date: Mon Jul 29 14:47:45 2013 +0100 Fix of nil value in SpawnProtect commit 7c33f75e7da7fc104112c17fcb53bc9f06fe09fc Author: Tiger Wang 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 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 Date: Mon Jul 29 11:11:22 2013 +0100 Removed Development LOGINFOs commit 02034bf2d67f2ae62092b0688d81338f7b0788df Author: Tiger Wang 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 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 Date: Sun Jul 28 12:55:50 2013 +0100 Default WorldLimiter = Off commit 141298481f3adef30b68d0c4200204aa264cb3e2 Author: Tiger Wang 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 Date: Sat Jul 27 11:44:18 2013 -0700 Merge pull request #3 from tonibm19/master Added /me command commit bfd6c5f2a47cda4ac98a7225736e2669eaf61849 Author: tonibm19 Date: Sat Jul 27 20:35:22 2013 +0200 Added /me command commit d25abaf44a6f5828b90297ff80003d2cd2a90be5 Author: tonibm19 Date: Sat Jul 27 20:30:31 2013 +0200 Added /me command commit 9047f7778aa1cdd42d22c4dcf925db792b4d684e Author: tonibm19 Date: Sat Jul 27 20:29:24 2013 +0200 added /me command commit 1ca42172391d41ba71c65a3f15d3a96d15a80496 Merge: 52a6f4e 7a40336 Author: Tiger Wang 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 Date: Sat Jul 27 17:00:38 2013 +0100 Fixed /give descriptor & removed webadmin commit 52a6f4e35bdea2ae9f33977928b6693f5800e515 Merge: f5d56ff 2af1da8 Author: Tiger Wang 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 Date: Sat Jul 27 16:38:10 2013 +0100 Added TPA (tonibm9's fork) With code from STR_Warrior. commit f5d56ffeb02fef4735e846661fa71d15622d25b9 Author: Tiger Wang 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 Date: Fri Jul 26 23:14:40 2013 +0100 Update README.md Added info. commit acd7e2849dcd7f3ee7bdc6b0f9b777ee1d9cbb3c Author: Tiger Wang 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 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 Date: Thu Jul 25 19:46:08 2013 +0100 Update README.md Extended 'GUI Redesign' section. commit e0df40bd082bdeb5c6823b485bc5001103a77502 Author: Tiger Wang 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 Date: Thu Jul 25 19:35:27 2013 +0100 Uploaded All Files All Core files, both modified and unmodified. commit 3dd191f6bed71c863ee264856fbc3660e52cf88b Author: Tiger Wang Date: Thu Jul 25 04:59:50 2013 -0700 Initial commit --- MCServer/Plugins/Core/onbreakplaceblock.lua | 184 ++++++++++++++-------------- 1 file changed, 92 insertions(+), 92 deletions(-) (limited to 'MCServer/Plugins/Core/onbreakplaceblock.lua') diff --git a/MCServer/Plugins/Core/onbreakplaceblock.lua b/MCServer/Plugins/Core/onbreakplaceblock.lua index 49b3226c2..5eddc1511 100644 --- a/MCServer/Plugins/Core/onbreakplaceblock.lua +++ b/MCServer/Plugins/Core/onbreakplaceblock.lua @@ -4,116 +4,116 @@ function OnPlayerPlacingBlock(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX return false end - local PROTECTRADIUS = WorldsSpawnProtect[Player:GetWorld():GetName()]; + local PROTECTRADIUS = WorldsSpawnProtect[Player:GetWorld():GetName()]; if not (Player:HasPermission("core.build")) then return true else - if not (Player:HasPermission("core.spawnprotect.bypass")) and not (PROTECTRADIUS == 0) then - local World = Player:GetWorld() - local xcoord = World:GetSpawnX() - local ycoord = World:GetSpawnY() - local zcoord = World:GetSpawnZ() + if not (Player:HasPermission("core.spawnprotect.bypass")) and not (PROTECTRADIUS == 0) then + local World = Player:GetWorld() + local xcoord = World:GetSpawnX() + local ycoord = World:GetSpawnY() + local zcoord = World:GetSpawnZ() - if not ((BlockX <= (xcoord + PROTECTRADIUS)) and (BlockX >= (xcoord - PROTECTRADIUS))) then - return false -- Not in spawn area. - end - if not ((BlockY <= (ycoord + PROTECTRADIUS)) and (BlockY >= (ycoord - PROTECTRADIUS))) then - return false -- Not in spawn area. - end - if not ((BlockZ <= (zcoord + PROTECTRADIUS)) and (BlockZ >= (zcoord - PROTECTRADIUS))) then - return false -- Not in spawn area. - end + if not ((BlockX <= (xcoord + PROTECTRADIUS)) and (BlockX >= (xcoord - PROTECTRADIUS))) then + return false -- Not in spawn area. + end + if not ((BlockY <= (ycoord + PROTECTRADIUS)) and (BlockY >= (ycoord - PROTECTRADIUS))) then + return false -- Not in spawn area. + end + if not ((BlockZ <= (zcoord + PROTECTRADIUS)) and (BlockZ >= (zcoord - PROTECTRADIUS))) then + return false -- Not in spawn area. + end - --WriteLog(1, BlockX, BlockY, BlockZ, Player:GetName(), id, meta) + --WriteLog(1, BlockX, BlockY, BlockZ, Player:GetName(), id, meta) - WarnPlayer(Player) + WarnPlayer(Player) - return true - else - if BlockType == "50" or BlockType == "76" then - local X = BlockX - local Y = BlockY - local Z = BlockZ - X, Y, Z = AddFaceDirection(X, Y, Z, BlockFace) - if (Y >= 256 or Y < 0) then - return true - end - - local CheckCollision = function(Player) - -- drop the decimals, we only care about the full block X,Y,Z - local PlayerX = math.floor(Player:GetPosX(), 0) - local PlayerY = math.floor(Player:GetPosY(), 0) - local PlayerZ = math.floor(Player:GetPosZ(), 0) - - local collision = false - if ((BlockFace == BLOCK_FACE_TOP) and (PlayerY == BlockY - 2) and (PlayerX == BlockX) and (PlayerZ == BlockZ)) then - collision = true - end - - if ((BlockFace == BLOCK_FACE_BOTTOM) and (PlayerY == BlockY + 1) and (PlayerX == BlockX) and (PlayerZ == BlockZ)) then - collision = true - end - - if ((BlockFace == BLOCK_FACE_NORTH) and (PlayerX == BlockX) and (PlayerZ == BlockZ - 1)) then - if ((PlayerY == BlockY) or (PlayerY + 1 == BlockY)) then collision = true end - end - - if ((BlockFace == BLOCK_FACE_SOUTH) and (PlayerX == BlockX) and (PlayerZ == BlockZ + 1)) then - if ((PlayerY == BlockY) or (PlayerY + 1 == BlockY)) then collision = true end - end - - if ((BlockFace == BLOCK_FACE_WEST) and (PlayerX == BlockX - 1) and (PlayerZ == BlockZ)) then - if ((PlayerY == BlockY) or (PlayerY + 1 == BlockY)) then collision = true end - end - - if ((BlockFace == BLOCK_FACE_EAST) and (PlayerX == BlockX + 1) and (PlayerZ == BlockZ)) then - if ((PlayerY == BlockY) or (PlayerY + 1 == BlockY)) then collision = true end - end - return collision - end - if (Player:GetWorld():ForEachPlayer(CheckCollision) == false) then - return true - end - end - end - end - return false + return true + else + if BlockType == "50" or BlockType == "76" then + local X = BlockX + local Y = BlockY + local Z = BlockZ + X, Y, Z = AddFaceDirection(X, Y, Z, BlockFace) + if (Y >= 256 or Y < 0) then + return true + end + + local CheckCollision = function(Player) + -- drop the decimals, we only care about the full block X,Y,Z + local PlayerX = math.floor(Player:GetPosX(), 0) + local PlayerY = math.floor(Player:GetPosY(), 0) + local PlayerZ = math.floor(Player:GetPosZ(), 0) + + local collision = false + if ((BlockFace == BLOCK_FACE_TOP) and (PlayerY == BlockY - 2) and (PlayerX == BlockX) and (PlayerZ == BlockZ)) then + collision = true + end + + if ((BlockFace == BLOCK_FACE_BOTTOM) and (PlayerY == BlockY + 1) and (PlayerX == BlockX) and (PlayerZ == BlockZ)) then + collision = true + end + + if ((BlockFace == BLOCK_FACE_NORTH) and (PlayerX == BlockX) and (PlayerZ == BlockZ - 1)) then + if ((PlayerY == BlockY) or (PlayerY + 1 == BlockY)) then collision = true end + end + + if ((BlockFace == BLOCK_FACE_SOUTH) and (PlayerX == BlockX) and (PlayerZ == BlockZ + 1)) then + if ((PlayerY == BlockY) or (PlayerY + 1 == BlockY)) then collision = true end + end + + if ((BlockFace == BLOCK_FACE_WEST) and (PlayerX == BlockX - 1) and (PlayerZ == BlockZ)) then + if ((PlayerY == BlockY) or (PlayerY + 1 == BlockY)) then collision = true end + end + + if ((BlockFace == BLOCK_FACE_EAST) and (PlayerX == BlockX + 1) and (PlayerZ == BlockZ)) then + if ((PlayerY == BlockY) or (PlayerY + 1 == BlockY)) then collision = true end + end + return collision + end + if (Player:GetWorld():ForEachPlayer(CheckCollision) == false) then + return true + end + end + end + end + return false end function OnPlayerBreakingBlock(Player, BlockX, BlockY, BlockZ, BlockFace, Status, OldBlockType, OldBlockMeta) - -- dont check if the direction is in the air + -- dont check if the direction is in the air if (BlockFace ~= -1) then - local PROTECTRADIUS = WorldsSpawnProtect[Player:GetWorld():GetName()]; + local PROTECTRADIUS = WorldsSpawnProtect[Player:GetWorld():GetName()]; if not (Player:HasPermission("core.build")) then return true else - if not (Player:HasPermission("core.spawnprotect.bypass")) and not (PROTECTRADIUS == 0) then - local World = Player:GetWorld() - local xcoord = World:GetSpawnX() - local ycoord = World:GetSpawnY() - local zcoord = World:GetSpawnZ() - - if not ((BlockX <= (xcoord + PROTECTRADIUS)) and (BlockX >= (xcoord - PROTECTRADIUS))) then - return false -- Not in spawn area. - end - if not ((BlockY <= (ycoord + PROTECTRADIUS)) and (BlockY >= (ycoord - PROTECTRADIUS))) then - return false -- Not in spawn area. - end - if not ((BlockZ <= (zcoord + PROTECTRADIUS)) and (BlockZ >= (zcoord - PROTECTRADIUS))) then - return false -- Not in spawn area. - end - - --WriteLog(0, BlockX, BlockY, BlockZ, Player:GetName(), id, meta) - - WarnPlayer(Player) + if not (Player:HasPermission("core.spawnprotect.bypass")) and not (PROTECTRADIUS == 0) then + local World = Player:GetWorld() + local xcoord = World:GetSpawnX() + local ycoord = World:GetSpawnY() + local zcoord = World:GetSpawnZ() + + if not ((BlockX <= (xcoord + PROTECTRADIUS)) and (BlockX >= (xcoord - PROTECTRADIUS))) then + return false -- Not in spawn area. + end + if not ((BlockY <= (ycoord + PROTECTRADIUS)) and (BlockY >= (ycoord - PROTECTRADIUS))) then + return false -- Not in spawn area. + end + if not ((BlockZ <= (zcoord + PROTECTRADIUS)) and (BlockZ >= (zcoord - PROTECTRADIUS))) then + return false -- Not in spawn area. + end + + --WriteLog(0, BlockX, BlockY, BlockZ, Player:GetName(), id, meta) + + WarnPlayer(Player) - return true - end - end - end + return true + end + end + end return false end \ No newline at end of file -- cgit v1.2.3