From 8c1a28fd6c674b7b05847a94781fe7d84f46cec4 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Wed, 7 Mar 2012 23:44:09 -0500 Subject: [PATCH 001/133] v2.14 Fixed deprecated creatureSpawn event Fixed set circle permissions, hopefully Fixed null inventory bug completely breaking plugin --- .classpath | 7 +++ .project | 17 ++++++ bin/GeometricMagic.jar | Bin 0 -> 33099 bytes .../GeometricMagic/GeometricMagic.class | Bin 0 -> 5257 bytes .../GeometricMagicDamageListener.class | Bin 0 -> 1995 bytes .../GeometricMagicPlayerDeathListener.class | Bin 0 -> 1884 bytes .../GeometricMagicPlayerListener.class | Bin 0 -> 31912 bytes plugin.yml | 52 +++++++++++++++++- .../GeometricMagicPlayerListener.java | 4 +- 9 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 .classpath create mode 100644 .project create mode 100644 bin/GeometricMagic.jar create mode 100644 bin/me/cakenggt/GeometricMagic/GeometricMagic.class create mode 100644 bin/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.class create mode 100644 bin/me/cakenggt/GeometricMagic/GeometricMagicPlayerDeathListener.class create mode 100644 bin/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.class diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..82a7ec5 --- /dev/null +++ b/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..aa88c57 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + GeometricMagic + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/bin/GeometricMagic.jar b/bin/GeometricMagic.jar new file mode 100644 index 0000000000000000000000000000000000000000..ee5a523796f83bc0ee1e2f8258042be8d57c9be9 GIT binary patch literal 33099 zcmbTdWpEuaw4~`+ge#*hZHTXkZ%0$7)!ph|TYW}n}@-%anw{mecvo~{QGO;ys zacTC2^-*2E`#Y8G(z-)|p9r0bSLrBY8Awv#UdRDnfuNO08Cjel+DJw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7N1C((IUHC#_H~7jG5aOkH%G+pC#mMSi2s?)Ufd_fndC0~7x;wRwNi z6EW!>o|wUlk0Lx)=D z(m-n+4aV~@>pV#A`Xs3x6XQq_t#>)n1=8wD?V(W7CaHyk#(rv>klHK&68=p_i`IP# zX35kWuIcL+=%ZnfSot7{ZUw)crS`dwV`%m?$WN2j=0Izw*OPpv=_>gMD8A7NZ#Sqc zBGBe9ackM;3!#}8QD5s4%C#?q(fSZtkN@h?y!C1>79QkNC%MMRn76xj zrpA{;#OE>Q=8SKy$cYN*8}L?+8_-X#L%BZIM(-ugu|2E`Hqx`r)cz1?pUcwS#@uPENP(;wW5MUop=L=@|wSS0==587A57Fa5AM%L%flvD^Y?h_1WS@=v{j?nN)_*U) NyG@LBG|X%a{(rYUx3vHO literal 0 HcmV?d00001 diff --git a/plugin.yml b/plugin.yml index e72cfec..d325155 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.13 +version: 2.14 author: cakenggt permissions: GeometricMagic.circle.*: @@ -9,7 +9,7 @@ permissions: circle.teleportation: true circle.micro: true circle.transmutation: true - circle.set.*: true + circle.set: true circle.teleportation: description: Allows you to use teleportation circles default: true @@ -19,11 +19,59 @@ permissions: circle.transmutation: description: Allows you to use transmutation circles default: true + circle.set: + description: Allows you to use set circles + default: true + children: + circle.set.*: true circle.set.*: description: Allows you to use all set circles default: true children: + circle.set.1133: true + circle.set.1222: true + circle.set.1233: true circle.set.1234: true + circle.set.2223: true + circle.set.2224: true + circle.set.2244: true + circle.set.2333: true + circle.set.3334: true + circle.set.3344: true + circle.set.3444: true + circle.set.1133: + description: Allows you to use set circle 1133 + default: true + circle.set.1222: + description: Allows you to use set circle 1222 + default: true + circle.set.1233: + description: Allows you to use set circle 1233 + default: true + circle.set.1234: + description: Allows you to use set circle 1234 + default: true + circle.set.2223: + description: Allows you to use set circle 2223 + default: true + circle.set.2224: + description: Allows you to use set circle 2224 + default: true + circle.set.2244: + description: Allows you to use set circle 2244 + default: true + circle.set.2333: + description: Allows you to use set circle 2333 + default: true + circle.set.3334: + description: Allows you to use set circle 3334 + default: true + circle.set.3344: + description: Allows you to use set circle 1133 + default: true + circle.set.3444: + description: Allows you to use set circle 3444 + default: true commands: setcircle: description: This command sets a sacrifice's right-click circle. diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 9ed2d71..598f13e 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -667,7 +667,7 @@ else if (arrayString.equals("[2, 2, 2, 4]") && player.hasPermission("circle.set. player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); Location spawnLoc = effectBlock.getLocation(); spawnLoc.add(0.5, 0, 0.5); - effectBlock.getWorld().spawnCreature(spawnLoc, CreatureType.ENDERMAN); + effectBlock.getWorld().spawn(spawnLoc, Enderman.class); } else return; } @@ -1344,7 +1344,7 @@ public static double philosopherStoneModifier (Player player){ int stackCount = 0; PlayerInventory inventory = player.getInventory(); for (int i = 0; i < inventory.getSize(); i++ ){ - if (inventory.getItem(i).getType() == Material.PORTAL) + if (inventory.getItem(i) != null && inventory.getItem(i).getType() == Material.PORTAL) stackCount += inventory.getItem(i).getAmount(); } modifier = 1/(Math.pow(2, stackCount)); From 7ce58a62cd2c28acdf8f5823c077144c29914c81 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Thu, 8 Mar 2012 00:08:17 -0500 Subject: [PATCH 002/133] Forgot .gitignore --- .gitignore | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..03c5d5c --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +# Compiled source # +################### +*.class +*.jar + +# Eclipse # +########### +*.classpath +*.project + From 1e79694d11a1f5d5e438bf5bf0310bbaeb60d330 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Thu, 8 Mar 2012 00:11:33 -0500 Subject: [PATCH 003/133] I am really bad at git... --- .classpath | 7 ------- .project | 17 ----------------- bin/GeometricMagic.jar | Bin 33099 -> 0 bytes .../GeometricMagic/GeometricMagic.class | Bin 5257 -> 0 bytes .../GeometricMagicDamageListener.class | Bin 1995 -> 0 bytes .../GeometricMagicPlayerDeathListener.class | Bin 1884 -> 0 bytes .../GeometricMagicPlayerListener.class | Bin 31912 -> 0 bytes 7 files changed, 24 deletions(-) delete mode 100644 .classpath delete mode 100644 .project delete mode 100644 bin/GeometricMagic.jar delete mode 100644 bin/me/cakenggt/GeometricMagic/GeometricMagic.class delete mode 100644 bin/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.class delete mode 100644 bin/me/cakenggt/GeometricMagic/GeometricMagicPlayerDeathListener.class delete mode 100644 bin/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.class diff --git a/.classpath b/.classpath deleted file mode 100644 index 82a7ec5..0000000 --- a/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/.project b/.project deleted file mode 100644 index aa88c57..0000000 --- a/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - GeometricMagic - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/bin/GeometricMagic.jar b/bin/GeometricMagic.jar deleted file mode 100644 index ee5a523796f83bc0ee1e2f8258042be8d57c9be9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 33099 zcmbTdWpEuaw4~`+ge#*hZHTXkZ%0$7)!ph|TYW}n}@-%anw{mecvo~{QGO;ys zacTC2^-*2E`#Y8G(z-)|p9r0bSLrBY8Awv#UdRDnfuNO08Cjel+DJwd6=e*IFCD2T z5-aZW^mQ54{d`v~pbS3kKhxfsr7-;LeRC7O#s9p-%kI*{e!A7TdivK3WC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x)=D z(m-n+4aV~@>pV#A`Xs3x6XQq_t#>)n1=8wD?V(W7CaHyk#(rv>klHK&68=p_i`IP# zX35kWuIcL+=%ZnfSot7{ZUw)crS`dwV`%m?$WN2j=0Izw*OPpv=_>gMD8A7NZ#Sqc zBGBe9ackM;3!#}8QD5s4%C#?q(fSZtkN@h?y!C1>79QkNC%MMRn76xj zrpA{;#OE>Q=8SKy$cYN*8}L?+8_-X#L%BZIM(-ugu|2E`Hqx`r)cz1?pUcwS#@uPENP(;wW5MUop=L=@|wSS0==587A57Fa5AM%L%flvD^Y?h_1WS@=v{j?nN)_*U) NyG@LBG|X%a{(rYUx3vHO From 55758a1af15b4d58eea5fef5046102ff4d399ac6 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Thu, 8 Mar 2012 23:58:35 -0500 Subject: [PATCH 004/133] v2.15 Transmutation triggers block break/place events for players using them; meaning it is now loggable by plugins like BigBrother Note: Transmutation logging may be buggy --- plugin.yml | 2 +- .../GeometricMagicPlayerListener.java | 38 ++++++++++++++++--- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/plugin.yml b/plugin.yml index d325155..cc7803f 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.14 +version: 2.15 author: cakenggt permissions: GeometricMagic.circle.*: diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 598f13e..b9f5a4f 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -5,6 +5,7 @@ import java.util.List; import java.util.Scanner; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; @@ -16,6 +17,8 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; @@ -976,8 +979,7 @@ public static void alchemyCheck(Material a, Material b, Location circleStart, Lo return; } - public static void alchemyFiller(Material a, Material b, Location start, - Location end, Player player) { + public static void alchemyFiller(Material a, Material b, Location start, Location end, Player player) { //System.out.println("alchemyFiller"); Block startBlock = start.getBlock(); int xIteration = 0; @@ -1062,13 +1064,39 @@ public static void alchemyFiller(Material a, Material b, Location start, return; } - public static void transmuteBlock(Material a, Material b, Block startBlock, - Player player) { + public static void transmuteBlock(Material a, Material b, Block startBlock, Player player) { + BlockState startBlockState = startBlock.getState(); if (startBlock.getType() == a) { int exp = calculateEXP(a, b); if (-1 * player.getLevel() < (exp * philosopherStoneModifier(player))) { player.setLevel((int) (player.getLevel() + (exp * philosopherStoneModifier(player)))); - startBlock.setType(b); + + //Create fake block break event for compatibility with logging plugins + if (a != Material.AIR && b == Material.AIR){ + BlockBreakEvent break_event = new BlockBreakEvent(startBlock, player); + Bukkit.getServer().getPluginManager().callEvent(break_event); + + startBlock.setType(b); + } + + //Create fake block place event for compatibility with logging plugins + else if (a == Material.AIR && b != Material.AIR){ + startBlock.setType(b); + + BlockPlaceEvent place_event = new BlockPlaceEvent(startBlock, startBlockState, startBlock, new ItemStack(b.getId()), player, true); + Bukkit.getServer().getPluginManager().callEvent(place_event); + } + + //Create fake block break and place events for compatibility with logging plugins + else if (a != Material.AIR && b != Material.AIR){ + BlockBreakEvent break_event = new BlockBreakEvent(startBlock, player); + Bukkit.getServer().getPluginManager().callEvent(break_event); + + startBlock.setType(b); + + BlockPlaceEvent place_event = new BlockPlaceEvent(startBlock, startBlockState, startBlock, new ItemStack(b.getId()), player, true); + Bukkit.getServer().getPluginManager().callEvent(place_event); + } //System.out.println("transmuted block"); //System.out.println(startBlock.getX() + " " + startBlock.getY() + " " + startBlock.getZ()); return; From 170cea9380271ed2ca4160bd7608d0665d7454eb Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Fri, 9 Mar 2012 18:47:14 -0500 Subject: [PATCH 005/133] Added set circles for animal spawning Added set circle 4040: Spawn pig Added set circle 4041: Spawn sheep Added set circle 4042: Spawn cow Added set circle 4043: Spawn chicken --- plugin.yml | 16 ++++++++ .../GeometricMagicPlayerListener.java | 40 +++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/plugin.yml b/plugin.yml index cc7803f..2523652 100644 --- a/plugin.yml +++ b/plugin.yml @@ -39,6 +39,10 @@ permissions: circle.set.3334: true circle.set.3344: true circle.set.3444: true + circle.set.4040: true + circle.set.4041: true + circle.set.4042: true + circle.set.4043: true circle.set.1133: description: Allows you to use set circle 1133 default: true @@ -72,6 +76,18 @@ permissions: circle.set.3444: description: Allows you to use set circle 3444 default: true + circle.set.4040: + description: Allows you to use set circle 4040 + default: true + circle.set.4041: + description: Allows you to use set circle 4041 + default: true + circle.set.4042: + description: Allows you to use set circle 4042 + default: true + circle.set.4043: + description: Allows you to use set circle 4043 + default: true commands: setcircle: description: This command sets a sacrifice's right-click circle. diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index b9f5a4f..4e73fa8 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -800,6 +800,46 @@ else if (arrayString.equals("[3, 4, 4, 4]") && player.hasPermission("circle.set. } else return; } + else if (arrayString.equals("[4, 0, 4, 0]") && player.hasPermission("circle.set.4040")){ + cost = 10; + if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + Location spawnLoc = effectBlock.getLocation(); + spawnLoc.add(0.5, 0, 0.5); + effectBlock.getWorld().spawn(spawnLoc, Pig.class); + } else + return; + } + else if (arrayString.equals("[4, 0, 4, 1]") && player.hasPermission("circle.set.4041")){ + cost = 10; + if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + Location spawnLoc = effectBlock.getLocation(); + spawnLoc.add(0.5, 0, 0.5); + effectBlock.getWorld().spawn(spawnLoc, Sheep.class); + } else + return; + } + else if (arrayString.equals("[4, 0, 4, 2]") && player.hasPermission("circle.set.4042")){ + cost = 10; + if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + Location spawnLoc = effectBlock.getLocation(); + spawnLoc.add(0.5, 0, 0.5); + effectBlock.getWorld().spawn(spawnLoc, Cow.class); + } else + return; + } + else if (arrayString.equals("[4, 0, 4, 3]") && player.hasPermission("circle.set.4043")){ + cost = 10; + if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + Location spawnLoc = effectBlock.getLocation(); + spawnLoc.add(0.5, 0, 0.5); + effectBlock.getWorld().spawn(spawnLoc, Chicken.class); + } else + return; + } else{ player.sendMessage("You do not have permission to use " + arrayString + " or set circle does not exist"); } From 89ec77eea8d61cae55adbd45daf91aaeec0aa6db Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Fri, 9 Mar 2012 18:48:53 -0500 Subject: [PATCH 006/133] v2.16 Read previous commits for changes --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index 2523652..a916f19 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.15 +version: 2.16 author: cakenggt permissions: GeometricMagic.circle.*: From c56aa19f041815356bbabf3d4c72b4157076c5de Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Fri, 9 Mar 2012 19:25:36 -0500 Subject: [PATCH 007/133] Fixed new set circles not working (Wrong order) Set circle 4040 changed to 0044 Set circle 4041 changed to 0144 Set circle 4042 changed to 0244 Set circle 4043 changed to 0344 --- plugin.yml | 24 +++++++++---------- .../GeometricMagicPlayerListener.java | 8 +++---- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/plugin.yml b/plugin.yml index a916f19..c8c03ff 100644 --- a/plugin.yml +++ b/plugin.yml @@ -39,10 +39,10 @@ permissions: circle.set.3334: true circle.set.3344: true circle.set.3444: true - circle.set.4040: true - circle.set.4041: true - circle.set.4042: true - circle.set.4043: true + circle.set.0044: true + circle.set.0144: true + circle.set.0244: true + circle.set.0344: true circle.set.1133: description: Allows you to use set circle 1133 default: true @@ -76,17 +76,17 @@ permissions: circle.set.3444: description: Allows you to use set circle 3444 default: true - circle.set.4040: - description: Allows you to use set circle 4040 + circle.set.0044: + description: Allows you to use set circle 0044 default: true - circle.set.4041: - description: Allows you to use set circle 4041 + circle.set.0144: + description: Allows you to use set circle 0144 default: true - circle.set.4042: - description: Allows you to use set circle 4042 + circle.set.0244: + description: Allows you to use set circle 0244 default: true - circle.set.4043: - description: Allows you to use set circle 4043 + circle.set.0344: + description: Allows you to use set circle 0344 default: true commands: setcircle: diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 4e73fa8..edf814a 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -800,7 +800,7 @@ else if (arrayString.equals("[3, 4, 4, 4]") && player.hasPermission("circle.set. } else return; } - else if (arrayString.equals("[4, 0, 4, 0]") && player.hasPermission("circle.set.4040")){ + else if (arrayString.equals("[0, 0, 4, 4]") && player.hasPermission("circle.set.0044")){ cost = 10; if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); @@ -810,7 +810,7 @@ else if (arrayString.equals("[4, 0, 4, 0]") && player.hasPermission("circle.set. } else return; } - else if (arrayString.equals("[4, 0, 4, 1]") && player.hasPermission("circle.set.4041")){ + else if (arrayString.equals("[0, 1, 4, 4]") && player.hasPermission("circle.set.0144")){ cost = 10; if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); @@ -820,7 +820,7 @@ else if (arrayString.equals("[4, 0, 4, 1]") && player.hasPermission("circle.set. } else return; } - else if (arrayString.equals("[4, 0, 4, 2]") && player.hasPermission("circle.set.4042")){ + else if (arrayString.equals("[0, 2, 4, 4]") && player.hasPermission("circle.set.0244")){ cost = 10; if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); @@ -830,7 +830,7 @@ else if (arrayString.equals("[4, 0, 4, 2]") && player.hasPermission("circle.set. } else return; } - else if (arrayString.equals("[4, 0, 4, 3]") && player.hasPermission("circle.set.4043")){ + else if (arrayString.equals("[0, 3, 4, 4]") && player.hasPermission("circle.set.0344")){ cost = 10; if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); From 2985f5e7f15dfc9c3837b631b45922fab12c1b3d Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Fri, 9 Mar 2012 19:31:49 -0500 Subject: [PATCH 008/133] Fixed not being required to learn the new set circles *not tested yet* --- .../GeometricMagicPlayerListener.java | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index edf814a..2314dd4 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -802,7 +802,11 @@ else if (arrayString.equals("[3, 4, 4, 4]") && player.hasPermission("circle.set. } else if (arrayString.equals("[0, 0, 4, 4]") && player.hasPermission("circle.set.0044")){ cost = 10; - if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + if (!hasLearnedCircle(player, arrayString)){ + player.sendMessage("you have not yet learned circle " + arrayString + "!"); + return; + } + else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); Location spawnLoc = effectBlock.getLocation(); spawnLoc.add(0.5, 0, 0.5); @@ -812,7 +816,11 @@ else if (arrayString.equals("[0, 0, 4, 4]") && player.hasPermission("circle.set. } else if (arrayString.equals("[0, 1, 4, 4]") && player.hasPermission("circle.set.0144")){ cost = 10; - if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + if (!hasLearnedCircle(player, arrayString)){ + player.sendMessage("you have not yet learned circle " + arrayString + "!"); + return; + } + else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); Location spawnLoc = effectBlock.getLocation(); spawnLoc.add(0.5, 0, 0.5); @@ -822,7 +830,11 @@ else if (arrayString.equals("[0, 1, 4, 4]") && player.hasPermission("circle.set. } else if (arrayString.equals("[0, 2, 4, 4]") && player.hasPermission("circle.set.0244")){ cost = 10; - if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + if (!hasLearnedCircle(player, arrayString)){ + player.sendMessage("you have not yet learned circle " + arrayString + "!"); + return; + } + else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); Location spawnLoc = effectBlock.getLocation(); spawnLoc.add(0.5, 0, 0.5); @@ -832,7 +844,11 @@ else if (arrayString.equals("[0, 2, 4, 4]") && player.hasPermission("circle.set. } else if (arrayString.equals("[0, 3, 4, 4]") && player.hasPermission("circle.set.0344")){ cost = 10; - if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + if (!hasLearnedCircle(player, arrayString)){ + player.sendMessage("you have not yet learned circle " + arrayString + "!"); + return; + } + else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); Location spawnLoc = effectBlock.getLocation(); spawnLoc.add(0.5, 0, 0.5); From 45ee5b7c61b992a80607b4bb4382fe92fc9cf3ae Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sun, 11 Mar 2012 16:56:14 -0400 Subject: [PATCH 009/133] v2.17 Note: Everything except transmutation logging seems to work perfectly; using transmutation to replace blocks with other blocks is a bit bugged when viewing the data in logging plugins... but still works somewhat, and should rollback fine (probably) --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index c8c03ff..b598b00 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.16 +version: 2.17 author: cakenggt permissions: GeometricMagic.circle.*: From b479a623ac2132007b38ad85d8f350c16aae792c Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Tue, 13 Mar 2012 20:09:51 -0400 Subject: [PATCH 010/133] Added set circle 0111 (Teleport to your home; costs 16 hunger) --- plugin.yml | 4 ++++ .../GeometricMagicPlayerListener.java | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/plugin.yml b/plugin.yml index b598b00..3f33fc8 100644 --- a/plugin.yml +++ b/plugin.yml @@ -39,6 +39,7 @@ permissions: circle.set.3334: true circle.set.3344: true circle.set.3444: true + circle.set.0111: true circle.set.0044: true circle.set.0144: true circle.set.0244: true @@ -76,6 +77,9 @@ permissions: circle.set.3444: description: Allows you to use set circle 3444 default: true + circle.set.0111: + description: Allows you to use set circle 0111 + default: true circle.set.0044: description: Allows you to use set circle 0044 default: true diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 2314dd4..2e66308 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -800,6 +800,19 @@ else if (arrayString.equals("[3, 4, 4, 4]") && player.hasPermission("circle.set. } else return; } + else if (arrayString.equals("[0, 1, 1, 1]") && player.hasPermission("circle.set.0111")){ + cost = 16; + if (!hasLearnedCircle(player, arrayString)){ + player.sendMessage("you have not yet learned circle " + arrayString + "!"); + return; + } + else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))){ + player.setFoodLevel((int) (player.getFoodLevel() -(cost * philosopherStoneModifier(player)))); + Location playerSpawn = player.getBedSpawnLocation(); + player.teleport(playerSpawn); + } else + return; + } else if (arrayString.equals("[0, 0, 4, 4]") && player.hasPermission("circle.set.0044")){ cost = 10; if (!hasLearnedCircle(player, arrayString)){ From 72e776bfb5ff5ec09a1e9d34cd779babaab5b591 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Wed, 14 Mar 2012 00:06:20 -0400 Subject: [PATCH 011/133] v2.18 Check dev branch for changes from now on --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index 3f33fc8..a683a69 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.17 +version: 2.18 author: cakenggt permissions: GeometricMagic.circle.*: From 84404b70584154fbee2d37677420e5b8c79c86ca Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Fri, 16 Mar 2012 20:19:44 -0400 Subject: [PATCH 012/133] Note: Almost pushed this to the master branch by accident. Phew! Check the commit for the changes Fixed capitalization for the unlearned set circles message Fixed unsafe teleportation (sometimes suffocated) to players homes (The circle will now try to relocate you to 1 of the 4 horizontally adjacent blocks, and if those are unsafe, then you will not be teleported) Quick fix for players getting their hunger depleted if the home teleport failed --- .../GeometricMagicPlayerListener.java | 60 +++++++++++++------ 1 file changed, 43 insertions(+), 17 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 2e66308..081e9f0 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -476,7 +476,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, return; if (arrayString.equals("[1, 1, 3, 3]") && player.hasPermission("circle.set.1133")){ if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("you have not yet learned circle " + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } List repairEntities = player.getNearbyEntities(9, 10, 9); @@ -549,7 +549,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, else if (arrayString.equals("[1, 2, 2, 2]") && player.hasPermission("circle.set.1222")){ cost = 1; if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("you have not yet learned circle " + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { @@ -574,7 +574,7 @@ else if (arrayString.equals("[1, 2, 2, 2]") && player.hasPermission("circle.set. else if (arrayString.equals("[1, 2, 3, 3]") && player.hasPermission("circle.set.1233")){ cost = 20; if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("you have not yet learned circle " + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } ItemStack onePortal = new ItemStack(90, 1); @@ -602,7 +602,7 @@ else if (arrayString.equals("[1, 2, 3, 3]") && player.hasPermission("circle.set. else if (arrayString.equals("[1, 2, 3, 4]") && player.hasPermission("circle.set.1234")){ cost = 1; if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("you have not yet learned circle " + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { @@ -616,7 +616,7 @@ else if (arrayString.equals("[1, 2, 3, 4]") && player.hasPermission("circle.set. else if (arrayString.equals("[2, 2, 2, 3]") && player.hasPermission("circle.set.2223")){ cost = 10; if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("you have not yet learned circle " + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } ItemStack oneRedstone = new ItemStack(331, 1); @@ -676,7 +676,7 @@ else if (arrayString.equals("[2, 2, 2, 4]") && player.hasPermission("circle.set. } else if (arrayString.equals("[2, 2, 4, 4]") && player.hasPermission("circle.set.2244")){ if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("you have not yet learned circle " + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } Location actPoint = effectBlock.getLocation(); @@ -750,7 +750,7 @@ else if (arrayString.equals("[2, 3, 3, 3]") && player.hasPermission("circle.set. int size = setCircleSize(actBlock); cost = 2 + size/2; if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("you have not yet learned circle " + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { @@ -762,7 +762,7 @@ else if (arrayString.equals("[2, 3, 3, 3]") && player.hasPermission("circle.set. else if (arrayString.equals("[3, 3, 3, 4]") && player.hasPermission("circle.set.3334")){ cost = 2; if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("you have not yet learned circle " + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { @@ -775,7 +775,7 @@ else if (arrayString.equals("[3, 3, 4, 4]") && player.hasPermission("circle.set. int size = setCircleSize(actBlock); cost = 4 + size/2; if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("you have not yet learned circle " + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { @@ -787,7 +787,7 @@ else if (arrayString.equals("[3, 3, 4, 4]") && player.hasPermission("circle.set. else if (arrayString.equals("[3, 4, 4, 4]") && player.hasPermission("circle.set.3444")){ cost = 20; if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("you have not yet learned circle " + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { @@ -803,20 +803,46 @@ else if (arrayString.equals("[3, 4, 4, 4]") && player.hasPermission("circle.set. else if (arrayString.equals("[0, 1, 1, 1]") && player.hasPermission("circle.set.0111")){ cost = 16; if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("you have not yet learned circle " + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))){ - player.setFoodLevel((int) (player.getFoodLevel() -(cost * philosopherStoneModifier(player)))); + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); Location playerSpawn = player.getBedSpawnLocation(); - player.teleport(playerSpawn); + if(playerSpawn != null){ + if(playerSpawn.getBlock().getType() == Material.AIR){ + player.teleport(playerSpawn); + } + else{ + if(new Location(player.getWorld(), playerSpawn.getX() + 1, playerSpawn.getY(), playerSpawn.getZ()).getBlock().getType() == Material.AIR){ + player.teleport(new Location(player.getWorld(), playerSpawn.getX() + 1, playerSpawn.getY(), playerSpawn.getZ())); + } + else if(new Location(player.getWorld(), playerSpawn.getX() - 1, playerSpawn.getY(), playerSpawn.getZ()).getBlock().getType() == Material.AIR){ + player.teleport(new Location(player.getWorld(), playerSpawn.getX() - 1, playerSpawn.getY(), playerSpawn.getZ())); + } + else if(new Location(player.getWorld(), playerSpawn.getX(), playerSpawn.getY(), playerSpawn.getZ() + 1).getBlock().getType() == Material.AIR){ + player.teleport(new Location(player.getWorld(), playerSpawn.getX(), playerSpawn.getY(), playerSpawn.getZ() + 1)); + } + else if(new Location(player.getWorld(), playerSpawn.getX(), playerSpawn.getY(), playerSpawn.getZ() - 1).getBlock().getType() == Material.AIR){ + player.teleport(new Location(player.getWorld(), playerSpawn.getX(), playerSpawn.getY(), playerSpawn.getZ() - 1)); + } + else{ + player.sendMessage("Your bed is not safe to teleport to!"); + player.setFoodLevel((int) (player.getFoodLevel() + (cost * philosopherStoneModifier(player)))); + } + } + } + else{ + player.sendMessage("You do not have a spawn set!"); + player.setFoodLevel((int) (player.getFoodLevel() + (cost * philosopherStoneModifier(player)))); + } } else return; } else if (arrayString.equals("[0, 0, 4, 4]") && player.hasPermission("circle.set.0044")){ cost = 10; if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("you have not yet learned circle " + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { @@ -830,7 +856,7 @@ else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { else if (arrayString.equals("[0, 1, 4, 4]") && player.hasPermission("circle.set.0144")){ cost = 10; if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("you have not yet learned circle " + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { @@ -844,7 +870,7 @@ else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { else if (arrayString.equals("[0, 2, 4, 4]") && player.hasPermission("circle.set.0244")){ cost = 10; if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("you have not yet learned circle " + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { @@ -858,7 +884,7 @@ else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { else if (arrayString.equals("[0, 3, 4, 4]") && player.hasPermission("circle.set.0344")){ cost = 10; if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("you have not yet learned circle " + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { From c707105adecfcf0363f5a64a89766fbf0aebc46c Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Fri, 16 Mar 2012 20:21:47 -0400 Subject: [PATCH 013/133] v2.18... again? Git is confusing :/ --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index 3f33fc8..a683a69 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.17 +version: 2.18 author: cakenggt permissions: GeometricMagic.circle.*: From f83190c24e2267f95c3df2fa962162fc123d7178 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Fri, 16 Mar 2012 20:26:20 -0400 Subject: [PATCH 014/133] Now using an additional version number to indicate the dev patch version (Ex: v2.18.1) for simplicity's sake --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index a683a69..3672ea6 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.18 +version: "2.18.1" author: cakenggt permissions: GeometricMagic.circle.*: From e177a29e0b589706796cf4439918358c4dfc646a Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sun, 18 Mar 2012 23:06:12 -0400 Subject: [PATCH 015/133] Blacklist transmuting from chests, signs, furnaces, brewing stands, and doors, as this could have been used for griefing. I plan to make this list configurable soon. --- plugin.yml | 2 +- .../GeometricMagic/GeometricMagicPlayerListener.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/plugin.yml b/plugin.yml index 418d3a0..67be28d 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.19 +version: 2.19.1 author: cakenggt permissions: GeometricMagic.circle.*: diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 081e9f0..e4715c7 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -1167,7 +1167,7 @@ public static void transmuteBlock(Material a, Material b, Block startBlock, Play player.setLevel((int) (player.getLevel() + (exp * philosopherStoneModifier(player)))); //Create fake block break event for compatibility with logging plugins - if (a != Material.AIR && b == Material.AIR){ + if (a != Material.AIR && b == Material.AIR && a != Material.CHEST && a != Material.WALL_SIGN && a!= Material.SIGN_POST && a != Material.FURNACE && a != Material.BURNING_FURNACE && a != Material.BREWING_STAND && a != Material.WOODEN_DOOR && a != Material.IRON_DOOR_BLOCK){ BlockBreakEvent break_event = new BlockBreakEvent(startBlock, player); Bukkit.getServer().getPluginManager().callEvent(break_event); @@ -1183,7 +1183,7 @@ else if (a == Material.AIR && b != Material.AIR){ } //Create fake block break and place events for compatibility with logging plugins - else if (a != Material.AIR && b != Material.AIR){ + else if (a != Material.AIR && b != Material.AIR && a != Material.CHEST && a != Material.WALL_SIGN && a!= Material.SIGN_POST && a != Material.FURNACE && a != Material.BURNING_FURNACE && a != Material.BREWING_STAND && a != Material.WOODEN_DOOR && a != Material.IRON_DOOR_BLOCK){ BlockBreakEvent break_event = new BlockBreakEvent(startBlock, player); Bukkit.getServer().getPluginManager().callEvent(break_event); @@ -1194,6 +1194,9 @@ else if (a != Material.AIR && b != Material.AIR){ } //System.out.println("transmuted block"); //System.out.println(startBlock.getX() + " " + startBlock.getY() + " " + startBlock.getZ()); + else { + System.out.println(player + " tried to transmute a blacklisted material!"); + } return; } else return; From 4fb1104171ec56a93beb4d0278a72958b15f04cb Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Mon, 19 Mar 2012 15:50:47 -0400 Subject: [PATCH 016/133] Fixed players getting XP when trying to transmute blacklisted blocks (Infinite XP Exploit) --- plugin.yml | 2 +- .../GeometricMagic/GeometricMagicPlayerListener.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plugin.yml b/plugin.yml index 67be28d..2dcdf84 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.19.1 +version: 2.19.2 author: cakenggt permissions: GeometricMagic.circle.*: diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index e4715c7..1758668 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -1164,7 +1164,6 @@ public static void transmuteBlock(Material a, Material b, Block startBlock, Play if (startBlock.getType() == a) { int exp = calculateEXP(a, b); if (-1 * player.getLevel() < (exp * philosopherStoneModifier(player))) { - player.setLevel((int) (player.getLevel() + (exp * philosopherStoneModifier(player)))); //Create fake block break event for compatibility with logging plugins if (a != Material.AIR && b == Material.AIR && a != Material.CHEST && a != Material.WALL_SIGN && a!= Material.SIGN_POST && a != Material.FURNACE && a != Material.BURNING_FURNACE && a != Material.BREWING_STAND && a != Material.WOODEN_DOOR && a != Material.IRON_DOOR_BLOCK){ @@ -1172,11 +1171,13 @@ public static void transmuteBlock(Material a, Material b, Block startBlock, Play Bukkit.getServer().getPluginManager().callEvent(break_event); startBlock.setType(b); + player.setLevel((int) (player.getLevel() + (exp * philosopherStoneModifier(player)))); } //Create fake block place event for compatibility with logging plugins else if (a == Material.AIR && b != Material.AIR){ startBlock.setType(b); + player.setLevel((int) (player.getLevel() + (exp * philosopherStoneModifier(player)))); BlockPlaceEvent place_event = new BlockPlaceEvent(startBlock, startBlockState, startBlock, new ItemStack(b.getId()), player, true); Bukkit.getServer().getPluginManager().callEvent(place_event); @@ -1188,6 +1189,7 @@ else if (a != Material.AIR && b != Material.AIR && a != Material.CHEST && a != M Bukkit.getServer().getPluginManager().callEvent(break_event); startBlock.setType(b); + player.setLevel((int) (player.getLevel() + (exp * philosopherStoneModifier(player)))); BlockPlaceEvent place_event = new BlockPlaceEvent(startBlock, startBlockState, startBlock, new ItemStack(b.getId()), player, true); Bukkit.getServer().getPluginManager().callEvent(place_event); @@ -1195,7 +1197,7 @@ else if (a != Material.AIR && b != Material.AIR && a != Material.CHEST && a != M //System.out.println("transmuted block"); //System.out.println(startBlock.getX() + " " + startBlock.getY() + " " + startBlock.getZ()); else { - System.out.println(player + " tried to transmute a blacklisted material!"); + System.out.println(player.getName() + " tried to transmute a blacklisted material!"); } return; } else From 1c5f1acaed6bdc59a4d893cc46fb1e4495bab4bf Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Tue, 20 Mar 2012 17:49:43 -0400 Subject: [PATCH 017/133] Fixed console message for players transmuting blacklisted blocks when they transmute air to air --- plugin.yml | 2 +- .../cakenggt/GeometricMagic/GeometricMagicPlayerListener.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.yml b/plugin.yml index 2dcdf84..eaeac0f 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.19.2 +version: 2.19.3 author: cakenggt permissions: GeometricMagic.circle.*: diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 1758668..b1652f3 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -1196,7 +1196,7 @@ else if (a != Material.AIR && b != Material.AIR && a != Material.CHEST && a != M } //System.out.println("transmuted block"); //System.out.println(startBlock.getX() + " " + startBlock.getY() + " " + startBlock.getZ()); - else { + else if (a != Material.AIR && b != Material.AIR) { System.out.println(player.getName() + " tried to transmute a blacklisted material!"); } return; From 1400a244185b9ac77a0293e1251e85882cbb0aa0 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Tue, 20 Mar 2012 18:39:23 -0400 Subject: [PATCH 018/133] Added the blocks the waplayer was converting from and to into the console blacklist message --- src/me/cakenggt/GeometricMagic/GeometricMagic.java | 1 + .../cakenggt/GeometricMagic/GeometricMagicPlayerListener.java | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagic.java b/src/me/cakenggt/GeometricMagic/GeometricMagic.java index d59b965..a4b9e32 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagic.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagic.java @@ -15,6 +15,7 @@ import org.bukkit.plugin.java.JavaPlugin; public class GeometricMagic extends JavaPlugin { + public static GeometricMagic plugin; private Listener playerListener; private Listener entityListener; private Listener deathListener; diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index b1652f3..df36179 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -1197,7 +1197,8 @@ else if (a != Material.AIR && b != Material.AIR && a != Material.CHEST && a != M //System.out.println("transmuted block"); //System.out.println(startBlock.getX() + " " + startBlock.getY() + " " + startBlock.getZ()); else if (a != Material.AIR && b != Material.AIR) { - System.out.println(player.getName() + " tried to transmute a blacklisted material!"); + System.out.println("[GeometricMagic] " + player.getName() + " tried to transmute a blacklisted material:"); + System.out.println("[GeometricMagic] " + a.name() + " into " + b.name()); } return; } else From 3700cd41f078036ba60021840f8592badbee0804 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Fri, 30 Mar 2012 15:59:09 -0400 Subject: [PATCH 019/133] v2.20 --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index eaeac0f..bf77ec7 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.19.3 +version: 2.20 author: cakenggt permissions: GeometricMagic.circle.*: From 15a6e529963f2485a1c2c74508d67c4a0eef22ad Mon Sep 17 00:00:00 2001 From: ty2u Date: Fri, 8 Jun 2012 11:39:01 -0400 Subject: [PATCH 020/133] Formatting --- .../GeometricMagic/GeometricMagic.java | 219 +- .../GeometricMagicDamageListener.java | 33 +- .../GeometricMagicPlayerDeathListener.java | 27 +- .../GeometricMagicPlayerListener.java | 1961 +++++++++-------- 4 files changed, 1215 insertions(+), 1025 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagic.java b/src/me/cakenggt/GeometricMagic/GeometricMagic.java index a4b9e32..aea35e0 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagic.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagic.java @@ -1,6 +1,5 @@ package me.cakenggt.GeometricMagic; - import java.io.File; import java.io.IOException; import java.io.PrintWriter; @@ -19,121 +18,121 @@ public class GeometricMagic extends JavaPlugin { private Listener playerListener; private Listener entityListener; private Listener deathListener; - public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){ - if(cmd.getName().equalsIgnoreCase("setcircle")){ // If the player typed /set then do the following... - //[1, 1, 3, 3] - Player player = null; - if (sender instanceof Player) { - player = (Player) sender; - } - if (player == null) { - sender.sendMessage("this command can only be run by a player"); - return false; - } - if (args.length == 0){ - ItemStack oneFlint = new ItemStack(318, 1); + + public boolean onCommand(CommandSender sender, Command cmd, + String commandLabel, String[] args) { + // If the player typed /set then do the following... + if (cmd.getName().equalsIgnoreCase("setcircle")) { + // [1, 1, 3, 3] + Player player = null; + if (sender instanceof Player) { + player = (Player) sender; + } + if (player == null) { + sender.sendMessage("this command can only be run by a player"); + return false; + } + if (args.length == 0) { + ItemStack oneFlint = new ItemStack(318, 1); player.getWorld().dropItem(player.getLocation(), oneFlint); - return true; - } - if (args.length != 1){ - sender.sendMessage(cmd.getUsage()); - return false; - } - if (args[0].length() != 4 && args[0].length() != 1){ - sender.sendMessage(cmd.getUsage()); - return false; - } - if (args[0].length() == 1 && args[0].equalsIgnoreCase("0")){ - sender.sendMessage("Casting circles on right click now disabled, set right click to a viable circle to enable"); - String inputString = args[0]; - try { - sacrificeCircle(sender, inputString); - } catch (IOException e) { - e.printStackTrace(); - } - return true; - } - else{ - String inputString = "[" + args[0].charAt(0) + ", " + args[0].charAt(1) + ", " + args[0].charAt(2) + ", " + args[0].charAt(3) + "]"; - try { - sacrificeCircle(sender, inputString); - } catch (IOException e) { - e.printStackTrace(); + return true; + } + if (args.length != 1) { + sender.sendMessage(cmd.getUsage()); + return false; + } + if (args[0].length() != 4 && args[0].length() != 1) { + sender.sendMessage(cmd.getUsage()); + return false; + } + if (args[0].length() == 1 && args[0].equalsIgnoreCase("0")) { + sender.sendMessage("Casting circles on right click now disabled, set right click to a viable circle to enable"); + String inputString = args[0]; + try { + sacrificeCircle(sender, inputString); + } catch (IOException e) { + e.printStackTrace(); + } + return true; + } else { + String inputString = "[" + args[0].charAt(0) + ", " + + args[0].charAt(1) + ", " + args[0].charAt(2) + ", " + + args[0].charAt(3) + "]"; + try { + sacrificeCircle(sender, inputString); + } catch (IOException e) { + e.printStackTrace(); + } + return true; } - return true; - } - } //If this has happened the function will break and return true. if this hasn't happened the a value of false will be returned. - return false; - } - - public void sacrificeCircle (CommandSender sender, String inputString) throws IOException{ - //System.out.println("sacrificeCircle for " + inputString); - File myFile = new File("plugins/GeometricMagic/sacrifices.txt"); - if (myFile.exists()){ - Scanner inputFileCheck = new Scanner(myFile); - int j = 0; - while (inputFileCheck.hasNext()) { - inputFileCheck.nextLine(); - j++; - } - int size = (j + 1) / 2; - //System.out.println("size of sacrifices file " + size); - String[] nameArray = new String[size]; - String[] circleArray = new String[size]; - inputFileCheck.close(); - //System.out.println("inputFileCheck closed"); - Scanner inputFile = new Scanner(myFile); - //System.out.println("inputFile opened"); - for (int i = 0; i < size; i++) { - nameArray[i] = inputFile.nextLine(); - circleArray[i] = inputFile.nextLine(); - } - //System.out.println("nameArray[0] is " + nameArray[0]); - //System.out.println("circleArray[0] is " + circleArray[0]); - for (int i = 0; i < size; i++) { - if (nameArray[i].equalsIgnoreCase(sender.getName())){ - circleArray[i] = inputString; - sender.sendMessage("set-circle " + inputString + " added successfully!"); - } - } - //System.out.println("nameArray[0] is " + nameArray[0]); - //System.out.println("circleArray[0] is " + circleArray[0]); - inputFile.close(); - PrintWriter outputFile = new PrintWriter("plugins/GeometricMagic/sacrifices.txt"); - for (int i = 0; i < size; i++) { - outputFile.println(nameArray[i]); - outputFile.println(circleArray[i]); - } - outputFile.close(); } - else{ + // If this has happened the function will break and return true. if this + // hasn't happened the a value of false will be returned. + return false; + } + + public void sacrificeCircle(CommandSender sender, String inputString) + throws IOException { + // System.out.println("sacrificeCircle for " + inputString); + File myFile = new File("plugins/GeometricMagic/sacrifices.txt"); + if (myFile.exists()) { + Scanner inputFileCheck = new Scanner(myFile); + int j = 0; + while (inputFileCheck.hasNext()) { + inputFileCheck.nextLine(); + j++; + } + int size = (j + 1) / 2; + // System.out.println("size of sacrifices file " + size); + String[] nameArray = new String[size]; + String[] circleArray = new String[size]; + inputFileCheck.close(); + // System.out.println("inputFileCheck closed"); + Scanner inputFile = new Scanner(myFile); + // System.out.println("inputFile opened"); + for (int i = 0; i < size; i++) { + nameArray[i] = inputFile.nextLine(); + circleArray[i] = inputFile.nextLine(); + } + // System.out.println("nameArray[0] is " + nameArray[0]); + // System.out.println("circleArray[0] is " + circleArray[0]); + for (int i = 0; i < size; i++) { + if (nameArray[i].equalsIgnoreCase(sender.getName())) { + circleArray[i] = inputString; + sender.sendMessage("set-circle " + inputString + + " added successfully!"); + } + } + // System.out.println("nameArray[0] is " + nameArray[0]); + // System.out.println("circleArray[0] is " + circleArray[0]); + inputFile.close(); + PrintWriter outputFile = new PrintWriter( + "plugins/GeometricMagic/sacrifices.txt"); + for (int i = 0; i < size; i++) { + outputFile.println(nameArray[i]); + outputFile.println(circleArray[i]); + } + outputFile.close(); + } else { return; } - } - - - public void onDisable() { - // TODO: Place any custom disable code here. - System.out.println(this + " is now disabled!"); - } - - public void onEnable() { - // TODO: Place any custom enable code here, such as registering events - playerListener = new GeometricMagicPlayerListener(); - entityListener = new GeometricMagicDamageListener(); - deathListener = new GeometricMagicPlayerDeathListener(); - getServer().getPluginManager().registerEvents(playerListener, this); - getServer().getPluginManager().registerEvents(entityListener, this); - getServer().getPluginManager().registerEvents(deathListener, this); - ShapelessRecipe portalRecipe = new ShapelessRecipe(new ItemStack(Material.FIRE, 64)).addIngredient(Material.PORTAL); - getServer().addRecipe(portalRecipe); - System.out.println(this + " is now enabled!"); - } - - - - + } + public void onDisable() { + System.out.println(this + " is now disabled!"); + } + public void onEnable() { + playerListener = new GeometricMagicPlayerListener(); + entityListener = new GeometricMagicDamageListener(); + deathListener = new GeometricMagicPlayerDeathListener(); + getServer().getPluginManager().registerEvents(playerListener, this); + getServer().getPluginManager().registerEvents(entityListener, this); + getServer().getPluginManager().registerEvents(deathListener, this); + ShapelessRecipe portalRecipe = new ShapelessRecipe(new ItemStack( + Material.FIRE, 64)).addIngredient(Material.PORTAL); + getServer().addRecipe(portalRecipe); + System.out.println(this + " is now enabled!"); + } } \ No newline at end of file diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java index b2ea50f..5ca3346 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java @@ -1,6 +1,5 @@ package me.cakenggt.GeometricMagic; - import org.bukkit.Material; import org.bukkit.entity.*; //import org.bukkit.event.Event; @@ -9,28 +8,29 @@ import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageEvent; - - public class GeometricMagicDamageListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST) public void onEntityDamage(EntityDamageEvent event) { - //System.out.println("entity damage event"); + // System.out.println("entity damage event"); Entity entity = event.getEntity(); int damage = event.getDamage(); - if (entity instanceof Player){ - //System.out.println("instance of player"); + if (entity instanceof Player) { + // System.out.println("instance of player"); Player player = (Player) entity; int health = player.getHealth(); - while (player.getInventory().contains(Material.FIRE)){ - //System.out.println("contains fire"); - if (health - damage <= 0){ + while (player.getInventory().contains(Material.FIRE)) { + // System.out.println("contains fire"); + if (health - damage <= 0) { boolean removedFire = false; - for (int i = 0; i < player.getInventory().getSize() && !removedFire; i++ ){ - if (player.getInventory().getItem(i).getType() == Material.FIRE){ - //System.out.println("removed a fire"); - int amount = player.getInventory().getItem(i).getAmount(); - player.getInventory().getItem(i).setAmount(amount - 1); - if (amount-1 <= 0){ + for (int i = 0; i < player.getInventory().getSize() + && !removedFire; i++) { + if (player.getInventory().getItem(i).getType() == Material.FIRE) { + // System.out.println("removed a fire"); + int amount = player.getInventory().getItem(i) + .getAmount(); + player.getInventory().getItem(i) + .setAmount(amount - 1); + if (amount - 1 <= 0) { player.getInventory().clear(i); } damage = damage - health; @@ -39,8 +39,7 @@ public void onEntityDamage(EntityDamageEvent event) { removedFire = true; } } - } - else{ + } else { event.setDamage(damage); return; } diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerDeathListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerDeathListener.java index 34f6ac0..14027f4 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerDeathListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerDeathListener.java @@ -1,6 +1,5 @@ package me.cakenggt.GeometricMagic; - import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -10,36 +9,32 @@ //import org.bukkit.event.player.PlayerListener; import org.bukkit.inventory.ItemStack; - - public class GeometricMagicPlayerDeathListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerDeath(EntityDeathEvent event) { - if (event.getEntity() instanceof Player){ + if (event.getEntity() instanceof Player) { Player player = (Player) event.getEntity(); int level = player.getLevel(); - while (level > 5){ - if (level > 13824){ - ItemStack oneDiamondBlock = new ItemStack(Material.DIAMOND_BLOCK, 1); - player.getWorld().dropItem(player.getLocation(), oneDiamondBlock); + while (level > 5) { + if (level > 13824) { + ItemStack oneDiamondBlock = new ItemStack( + Material.DIAMOND_BLOCK, 1); + player.getWorld().dropItem(player.getLocation(), + oneDiamondBlock); level -= 13824; - } - else if (level > 1568){ + } else if (level > 1568) { ItemStack one84 = new ItemStack(84, 1); player.getWorld().dropItem(player.getLocation(), one84); level -= 1568; - } - else if (level > 153){ + } else if (level > 153) { ItemStack one29 = new ItemStack(29, 1); player.getWorld().dropItem(player.getLocation(), one29); level -= 153; - } - else if (level > 12){ + } else if (level > 12) { ItemStack one70 = new ItemStack(70, 1); player.getWorld().dropItem(player.getLocation(), one70); level -= 12; - } - else if (level > 1){ + } else if (level > 1) { ItemStack one2 = new ItemStack(2, 1); player.getWorld().dropItem(player.getLocation(), one2); level -= 1; diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index df36179..c8b82ed 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -23,13 +23,13 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; - public class GeometricMagicPlayerListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerInteract(PlayerInteractEvent event) { - //System.out.println("is playerinteractevent"); - if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.RIGHT_CLICK_AIR){ - //System.out.println("doesn't equal click block or click air"); + // System.out.println("is playerinteractevent"); + if (event.getAction() != Action.RIGHT_CLICK_BLOCK + && event.getAction() != Action.RIGHT_CLICK_AIR) { + // System.out.println("doesn't equal click block or click air"); return; } boolean sacrifices = false; @@ -40,19 +40,21 @@ public void onPlayerInteract(PlayerInteractEvent event) { } catch (IOException e1) { e1.printStackTrace(); } - if (sacrificed){ - //System.out.println("is sacrificed"); + if (sacrificed) { + // System.out.println("is sacrificed"); return; } Block actBlock = event.getPlayer().getLocation().getBlock(); - if (event.getAction() == Action.RIGHT_CLICK_BLOCK){ - //System.out.println("right clicked block"); - if (event.getClickedBlock().getType() == Material.WORKBENCH && sacrifices) + if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { + // System.out.println("right clicked block"); + if (event.getClickedBlock().getType() == Material.WORKBENCH + && sacrifices) event.getClickedBlock().setType(Material.AIR); actBlock = event.getClickedBlock(); } - if (event.getAction() == Action.RIGHT_CLICK_AIR && event.getPlayer().getItemInHand().getType() == Material.FLINT ){ - //System.out.println("is leftclickair"); + if (event.getAction() == Action.RIGHT_CLICK_AIR + && event.getPlayer().getItemInHand().getType() == Material.FLINT) { + // System.out.println("is leftclickair"); actBlock = event.getPlayer().getTargetBlock(null, 120); } Player player = event.getPlayer(); @@ -64,35 +66,38 @@ public void onPlayerInteract(PlayerInteractEvent event) { } } - public static void isCircle (Player player, World world, Block actBlock) throws IOException { - //System.out.println("isCircle?"); - if (actBlock.getType() == Material.REDSTONE_WIRE && player.getItemInHand().getAmount() == 0 && !checkSacrificed(player)){ - //System.out.println("isCircle"); + public static void isCircle(Player player, World world, Block actBlock) + throws IOException { + // System.out.println("isCircle?"); + if (actBlock.getType() == Material.REDSTONE_WIRE + && player.getItemInHand().getAmount() == 0 + && !checkSacrificed(player)) { + // System.out.println("isCircle"); circleChooser(player, world, actBlock); } boolean sacrifices = checkSacrifices(player); - if (player.getItemInHand().getType() == Material.FLINT && sacrifices && !checkSacrificed(player)){ + if (player.getItemInHand().getType() == Material.FLINT && sacrifices + && !checkSacrificed(player)) { File myFile = new File("plugins/GeometricMagic/sacrifices.txt"); Scanner inputFile = new Scanner(myFile); String circle = "[0, 0, 0, 0]"; - while (inputFile.hasNextLine()){ + while (inputFile.hasNextLine()) { String name = inputFile.nextLine(); - if (name.equals(player.getName())){ + if (name.equals(player.getName())) { circle = inputFile.nextLine(); - } - else + } else inputFile.nextLine(); } inputFile.close(); - //System.out.println("isCircle not clicked redstone"); - setCircleEffects(player, player.getWorld(), player.getLocation().getBlock(), actBlock, circle); - } - else + // System.out.println("isCircle not clicked redstone"); + setCircleEffects(player, player.getWorld(), player.getLocation() + .getBlock(), actBlock, circle); + } else return; } - + public static void circleChooser(Player player, World world, Block actBlock) { - //System.out.println("circleChooser"); + // System.out.println("circleChooser"); Block northBlock = actBlock.getRelative(0, 0, -1); Block southBlock = actBlock.getRelative(0, 0, 1); Block eastBlock = actBlock.getRelative(1, 0, 0); @@ -101,29 +106,25 @@ public static void circleChooser(Player player, World world, Block actBlock) { && southBlock.getType() == Material.REDSTONE_WIRE && eastBlock.getType() == Material.REDSTONE_WIRE && westBlock.getType() == Material.REDSTONE_WIRE) { - if(player.hasPermission("circle.teleportation")) { - //System.out.println("teleportation"); + if (player.hasPermission("circle.teleportation")) { + // System.out.println("teleportation"); teleportationCircle(player, world, actBlock); - } - else + } else player.sendMessage("You do not have permission to use this circle"); - } - else if (northBlock.getType() != Material.REDSTONE_WIRE + } else if (northBlock.getType() != Material.REDSTONE_WIRE && southBlock.getType() != Material.REDSTONE_WIRE && eastBlock.getType() != Material.REDSTONE_WIRE - && westBlock.getType() != Material.REDSTONE_WIRE - && actBlock.getRelative(-3, 0, 0).getType() != Material.REDSTONE_WIRE - && actBlock.getRelative(3, 0, 0).getType() != Material.REDSTONE_WIRE - && actBlock.getRelative(0, 0, -3).getType() != Material.REDSTONE_WIRE + && westBlock.getType() != Material.REDSTONE_WIRE + && actBlock.getRelative(-3, 0, 0).getType() != Material.REDSTONE_WIRE + && actBlock.getRelative(3, 0, 0).getType() != Material.REDSTONE_WIRE + && actBlock.getRelative(0, 0, -3).getType() != Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, 3).getType() != Material.REDSTONE_WIRE) { - if(player.hasPermission("circle.micro")){ - //System.out.println("micro"); + if (player.hasPermission("circle.micro")) { + // System.out.println("micro"); microCircle(player, world, actBlock); - } - else + } else player.sendMessage("You do not have permission to use this circle"); - } - else if ((northBlock.getType() == Material.REDSTONE_WIRE + } else if ((northBlock.getType() == Material.REDSTONE_WIRE && southBlock.getType() == Material.REDSTONE_WIRE && eastBlock.getType() != Material.REDSTONE_WIRE && westBlock .getType() != Material.REDSTONE_WIRE) @@ -131,777 +132,867 @@ else if ((northBlock.getType() == Material.REDSTONE_WIRE && southBlock.getType() != Material.REDSTONE_WIRE && eastBlock.getType() == Material.REDSTONE_WIRE && westBlock .getType() == Material.REDSTONE_WIRE)) { - if(player.hasPermission("circle.transmutation")){ - //System.out.println("transmutation"); + if (player.hasPermission("circle.transmutation")) { + // System.out.println("transmutation"); transmutationCircle(player, world, actBlock); - } - else + } else player.sendMessage("You do not have permission to use this circle"); - } - else if (northBlock.getType() != Material.REDSTONE_WIRE + } else if (northBlock.getType() != Material.REDSTONE_WIRE && southBlock.getType() != Material.REDSTONE_WIRE && eastBlock.getType() != Material.REDSTONE_WIRE - && westBlock.getType() != Material.REDSTONE_WIRE - && actBlock.getRelative(-3, 0, 0).getType() == Material.REDSTONE_WIRE - && actBlock.getRelative(3, 0, 0).getType() == Material.REDSTONE_WIRE - && actBlock.getRelative(0, 0, -3).getType() == Material.REDSTONE_WIRE + && westBlock.getType() != Material.REDSTONE_WIRE + && actBlock.getRelative(-3, 0, 0).getType() == Material.REDSTONE_WIRE + && actBlock.getRelative(3, 0, 0).getType() == Material.REDSTONE_WIRE + && actBlock.getRelative(0, 0, -3).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, 3).getType() == Material.REDSTONE_WIRE) { - if(player.hasPermission("circle.set")){ - //System.out.println("set"); + if (player.hasPermission("circle.set")) { + // System.out.println("set"); setCircleRemote(player, world, actBlock); - } - else + } else player.sendMessage("You do not have permission to use this circle"); - } - else + } else return; } - - public static void teleportationCircle(Player player, World world, Block actBlock) { - Location actPoint = actBlock.getLocation(); - int na = 0, nb = 0, ea = 0, eb = 0, sa = 0, sb = 0, wa = 0, wb = 0, nc = 0, ec = 0, sc = 0, wc = 0; - actBlock.setType(Material.AIR); - actBlock.getRelative(1, 0, 0).setType(Material.AIR); - actBlock.getRelative(-1, 0, 0).setType(Material.AIR); - actBlock.getRelative(0, 0, 1).setType(Material.AIR); - actBlock.getRelative(0, 0, -1).setType(Material.AIR); - Block curBlock = actBlock.getRelative(0, 0, -1); + + public static void teleportationCircle(Player player, World world, + Block actBlock) { + Location actPoint = actBlock.getLocation(); + int na = 0, nb = 0, ea = 0, eb = 0, sa = 0, sb = 0, wa = 0, wb = 0, nc = 0, ec = 0, sc = 0, wc = 0; + actBlock.setType(Material.AIR); + actBlock.getRelative(1, 0, 0).setType(Material.AIR); + actBlock.getRelative(-1, 0, 0).setType(Material.AIR); + actBlock.getRelative(0, 0, 1).setType(Material.AIR); + actBlock.getRelative(0, 0, -1).setType(Material.AIR); + Block curBlock = actBlock.getRelative(0, 0, -1); + while (curBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE) { + na++; + curBlock = curBlock.getRelative(0, 0, -1); + curBlock.setType(Material.AIR); + } + Block fineBlock = curBlock; + while (fineBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE) { + nb++; + fineBlock = fineBlock.getRelative(-1, 0, 0); + fineBlock.setType(Material.AIR); + } + fineBlock = curBlock; + while (fineBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE) { + nc++; + fineBlock = fineBlock.getRelative(1, 0, 0); + fineBlock.setType(Material.AIR); + } + curBlock = actBlock.getRelative(1, 0, 0); + while (curBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE) { + ea++; + curBlock = curBlock.getRelative(1, 0, 0); + curBlock.setType(Material.AIR); + } + fineBlock = curBlock; + while (fineBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE) { + eb++; + fineBlock = fineBlock.getRelative(0, 0, -1); + fineBlock.setType(Material.AIR); + } + fineBlock = curBlock; + while (fineBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE) { + ec++; + fineBlock = fineBlock.getRelative(0, 0, 1); + fineBlock.setType(Material.AIR); + } + curBlock = actBlock.getRelative(0, 0, 1); + while (curBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE) { + sa++; + curBlock = curBlock.getRelative(0, 0, 1); + curBlock.setType(Material.AIR); + } + fineBlock = curBlock; + while (fineBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE) { + sb++; + fineBlock = fineBlock.getRelative(1, 0, 0); + fineBlock.setType(Material.AIR); + } + fineBlock = curBlock; + while (fineBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE) { + sc++; + fineBlock = fineBlock.getRelative(-1, 0, 0); + fineBlock.setType(Material.AIR); + } + curBlock = actBlock.getRelative(-1, 0, 0); + while (curBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE) { + wa++; + curBlock = curBlock.getRelative(-1, 0, 0); + curBlock.setType(Material.AIR); + } + fineBlock = curBlock; + while (fineBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE) { + wb++; + fineBlock = fineBlock.getRelative(0, 0, 1); + fineBlock.setType(Material.AIR); + } + fineBlock = curBlock; + while (fineBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE) { + wc++; + fineBlock = fineBlock.getRelative(0, 0, -1); + fineBlock.setType(Material.AIR); + } + // north negative z, south positive z, east positive x, west + // negative x + int z = ((sa * 100 + sb) - (na * 100 + nb)); + int x = ((ea * 100 + eb) - (wa * 100 + wb)); + int y = nc + ec + sc + wc; + double actPointX = actPoint.getX(); + double actPointZ = actPoint.getZ(); + Location teleLoc = actPoint.add(x, y, z); + float yaw = player.getLocation().getYaw(); + float pitch = player.getLocation().getPitch(); + teleLoc.setYaw(yaw); + teleLoc.setPitch(pitch); + double distance = Math.sqrt(Math.pow(teleLoc.getX() - actPointX, 2) + + Math.pow(teleLoc.getZ() - actPointZ, 2)); + double mathRandX = philosopherStoneModifier(player) * distance / 10 + * Math.random(); + double mathRandZ = philosopherStoneModifier(player) * distance / 10 + * Math.random(); + double randX = (teleLoc.getX() - (0.5 * mathRandX)) + (mathRandX); + double randZ = (teleLoc.getZ() - (0.5 * mathRandZ)) + (mathRandZ); + teleLoc.setX(randX); + teleLoc.setZ(randZ); + while (teleLoc.getWorld().getChunkAt(teleLoc).isLoaded() == false) { + teleLoc.getWorld().getChunkAt(teleLoc).load(true); + } + player.teleport(teleLoc); + ItemStack redstonePile = new ItemStack(331, 5 + na + nb + nc + sa + sb + + sc + ea + eb + ec + wa + wb + wc); + teleLoc.getWorld().dropItem(teleLoc, redstonePile); + actBlock.getWorld().strikeLightningEffect(actBlock.getLocation()); + actBlock.getWorld().strikeLightningEffect(teleLoc); + return; + } + + public static void microCircle(Player player, World world, Block actBlock) { + // have it print to console what level is + player.sendMessage("Your experience level is " + player.getLevel()); + List entitiesList = player.getNearbyEntities(100, 10, 100); + for (int i = 0; i < entitiesList.size(); i++) { + if (entitiesList.get(i) instanceof Arrow) { + Arrow shotArrow = (Arrow) entitiesList.get(i); + if (shotArrow.getLocation().getBlock().getType() == Material.REDSTONE_WIRE) { + Block newActPoint = shotArrow.getLocation().getBlock(); + Player newPlayer = (Player) shotArrow.getShooter(); + circleChooser(newPlayer, world, newActPoint); + } + } + } + } + + public static void transmutationCircle(Player player, World world, + Block actBlock) { + int halfWidth = 0; + int fullWidth = 0; + Location startLoc = actBlock.getLocation(); + Location endLoc = actBlock.getLocation(); + Location circleStart = actBlock.getLocation(); + Location circleEnd = actBlock.getLocation(); + Material fromType = actBlock.getType(); + Material toType = actBlock.getType(); + if (actBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE + && actBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE) { + halfWidth = 0; + while (actBlock.getRelative(0, 0, -1 * halfWidth).getType() == Material.REDSTONE_WIRE) { + halfWidth++; + } + fullWidth = (halfWidth * 2) - 1; + int dimensionOfEffect = (fullWidth - 2) * (fullWidth - 2); + if (actBlock.getRelative((fullWidth - 1), 0, 0).getType() == Material.REDSTONE_WIRE) { + // east + fromType = actBlock.getLocation() + .add(halfWidth - 1, 0, -1 * (halfWidth + 1)).getBlock() + .getType(); + toType = actBlock.getLocation() + .add(halfWidth - 1, 0, halfWidth + 1).getBlock() + .getType(); + startLoc = actBlock.getLocation().add(fullWidth, 0, + -1 * dimensionOfEffect / 2 + 1); + endLoc = actBlock.getLocation().add( + fullWidth + dimensionOfEffect - 1, + dimensionOfEffect - 1, dimensionOfEffect / 2 - 1); + circleStart = actBlock.getLocation().add(1, 0, + -1 * (halfWidth - 2)); + circleEnd = actBlock.getLocation().add(fullWidth - 2, + fullWidth - 3, halfWidth - 2); + alchemyCheck(fromType, toType, circleStart, circleEnd, + startLoc, endLoc, player, fullWidth - 2); + } else if (actBlock.getRelative(-1 * (fullWidth - 1), 0, 0) + .getType() == Material.REDSTONE_WIRE) { + // west + fromType = actBlock.getLocation() + .add(-1 * (halfWidth - 1), 0, halfWidth + 1).getBlock() + .getType(); + toType = actBlock.getLocation() + .add((-1) * (halfWidth - 1), 0, (-1) * (halfWidth + 1)) + .getBlock().getType(); + startLoc = actBlock.getLocation().add(-1 * fullWidth, 0, + dimensionOfEffect / 2); + endLoc = actBlock.getLocation().add( + -1 * (fullWidth + dimensionOfEffect) + 1, + dimensionOfEffect - 1, -1 * dimensionOfEffect / 2 + 1); + circleStart = actBlock.getLocation() + .add(-1, 0, (halfWidth - 2)); + circleEnd = actBlock.getLocation().add(-1 * (fullWidth - 2), + fullWidth - 3, -1 * (halfWidth - 2)); + alchemyCheck(fromType, toType, circleStart, circleEnd, + startLoc, endLoc, player, fullWidth - 2); + } + } else if (actBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE + && actBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE) { + halfWidth = 0; + while (actBlock.getRelative(halfWidth, 0, 0).getType() == Material.REDSTONE_WIRE) { + halfWidth++; + } + fullWidth = (halfWidth * 2) - 1; + // System.out.println("half is " + halfWidth + " full is " + + // fullWidth); + int dimensionOfEffect = (fullWidth - 2) * (fullWidth - 2); + if (actBlock.getRelative(0, 0, -1 * (fullWidth - 1)).getType() == Material.REDSTONE_WIRE) { + // north + // System.out.println("transmutationCircle north"); + fromType = actBlock.getLocation() + .add(-1 * (halfWidth + 1), 0, -1 * (halfWidth - 1)) + .getBlock().getType(); + toType = actBlock.getLocation() + .add(halfWidth + 1, 0, -1 * (halfWidth - 1)).getBlock() + .getType(); + startLoc = actBlock.getLocation().add( + -1 * dimensionOfEffect / 2, 0, -1 * fullWidth); + endLoc = actBlock.getLocation().add(dimensionOfEffect / 2 - 1, + dimensionOfEffect - 1, + -1 * (dimensionOfEffect + fullWidth) + 1); + circleStart = actBlock.getLocation().add(-1 * (halfWidth - 2), + 0, -1); + circleEnd = actBlock.getLocation().add((halfWidth - 2), + fullWidth - 3, -1 * (fullWidth - 2)); + alchemyCheck(fromType, toType, circleStart, circleEnd, + startLoc, endLoc, player, fullWidth - 2); + } else if (actBlock.getRelative(0, 0, (fullWidth - 1)).getType() == Material.REDSTONE_WIRE) { + // south + // System.out.println("transmutationCircle south"); + fromType = actBlock.getLocation() + .add(halfWidth + 1, 0, halfWidth - 1).getBlock() + .getType(); + toType = actBlock.getLocation() + .add(-1 * (halfWidth + 1), 0, halfWidth - 1).getBlock() + .getType(); + startLoc = actBlock.getLocation().add(dimensionOfEffect / 2, 0, + fullWidth); + endLoc = actBlock.getLocation().add( + -1 * dimensionOfEffect / 2 + 1, dimensionOfEffect - 1, + fullWidth + dimensionOfEffect - 1); + circleStart = actBlock.getLocation().add(halfWidth - 2, 0, 1); + circleEnd = actBlock.getLocation().add(-1 * (halfWidth - 2), + fullWidth - 3, (fullWidth - 2)); + alchemyCheck(fromType, toType, circleStart, circleEnd, + startLoc, endLoc, player, fullWidth - 2); + } + } + actBlock.getWorld().strikeLightningEffect(actBlock.getLocation()); + } + + public static void setCircleRemote(Player player, World world, + Block actBlock) { + Boolean remote = false; + Block effectBlock = actBlock; + List entitiesList = player.getNearbyEntities(242, 20, 242); + for (int i = 0; i < entitiesList.size(); i++) { + if (entitiesList.get(i) instanceof Arrow) { + Arrow shotArrow = (Arrow) entitiesList.get(i); + if (shotArrow.getLocation().getBlock().getX() == actBlock + .getLocation().getBlock().getX() + && shotArrow.getLocation().getBlock().getZ() == actBlock + .getLocation().getBlock().getZ()) { + remote = true; + entitiesList.remove(i); + } + } + } + if (remote) { + for (int i = 0; i < entitiesList.size(); i++) { + if (entitiesList.get(i) instanceof Arrow) { + Arrow shotArrow = (Arrow) entitiesList.get(i); + effectBlock = shotArrow.getLocation().getBlock(); + setCircle(player, world, actBlock, effectBlock); + } + } + } else + setCircle(player, world, actBlock, effectBlock); + } + + public static void setCircle(Player player, World world, Block actBlock, + Block effectBlock) { + Block northSin = actBlock.getRelative(0, 0, -3); + Block southSin = actBlock.getRelative(0, 0, 3); + Block eastSin = actBlock.getRelative(3, 0, 0); + Block westSin = actBlock.getRelative(-3, 0, 0); + int n = 0; + int s = 0; + int e = 0; + int w = 0; + int[] intArray = new int[4]; + if (northSin.getRelative(BlockFace.NORTH).getType() == Material.REDSTONE_WIRE) + n++; + if (northSin.getRelative(BlockFace.SOUTH).getType() == Material.REDSTONE_WIRE) + n++; + if (northSin.getRelative(BlockFace.EAST).getType() == Material.REDSTONE_WIRE) + n++; + if (northSin.getRelative(BlockFace.WEST).getType() == Material.REDSTONE_WIRE) + n++; + intArray[0] = n; + if (southSin.getRelative(BlockFace.NORTH).getType() == Material.REDSTONE_WIRE) + s++; + if (southSin.getRelative(BlockFace.SOUTH).getType() == Material.REDSTONE_WIRE) + s++; + if (southSin.getRelative(BlockFace.EAST).getType() == Material.REDSTONE_WIRE) + s++; + if (southSin.getRelative(BlockFace.WEST).getType() == Material.REDSTONE_WIRE) + s++; + intArray[1] = s; + if (eastSin.getRelative(BlockFace.NORTH).getType() == Material.REDSTONE_WIRE) + e++; + if (eastSin.getRelative(BlockFace.SOUTH).getType() == Material.REDSTONE_WIRE) + e++; + if (eastSin.getRelative(BlockFace.EAST).getType() == Material.REDSTONE_WIRE) + e++; + if (eastSin.getRelative(BlockFace.WEST).getType() == Material.REDSTONE_WIRE) + e++; + intArray[2] = e; + if (westSin.getRelative(BlockFace.NORTH).getType() == Material.REDSTONE_WIRE) + w++; + if (westSin.getRelative(BlockFace.SOUTH).getType() == Material.REDSTONE_WIRE) + w++; + if (westSin.getRelative(BlockFace.EAST).getType() == Material.REDSTONE_WIRE) + w++; + if (westSin.getRelative(BlockFace.WEST).getType() == Material.REDSTONE_WIRE) + w++; + intArray[3] = w; + Arrays.sort(intArray); + String arrayString = Arrays.toString(intArray); + try { + setCircleEffects(player, world, actBlock, effectBlock, arrayString); + } catch (IOException e1) { + e1.printStackTrace(); + } + } + + public static void setCircleEffects(Player player, World world, + Block actBlock, Block effectBlock, String arrayString) + throws IOException { + int cost = 0; + if (!hasLearnedCircle(player, arrayString)) { + if (learnCircle(player, arrayString, actBlock)) { + player.sendMessage("You have successfully learned the circle " + + arrayString); + return; + } + } + if (arrayString.equals("0")) + return; + if (arrayString.equals("[1, 1, 3, 3]") + && player.hasPermission("circle.set.1133")) { + if (!hasLearnedCircle(player, arrayString)) { + player.sendMessage("You have not yet learned circle " + + arrayString + "!"); + return; + } + List repairEntities = player.getNearbyEntities(9, 10, 9); + for (int i = 0; i < repairEntities.size(); i++) { + if (repairEntities.get(i) instanceof Item) { + Item droppedItem = (Item) repairEntities.get(i); + if ((256 <= droppedItem.getItemStack().getTypeId() && droppedItem + .getItemStack().getTypeId() <= 258) + || (267 <= droppedItem.getItemStack().getTypeId() && droppedItem + .getItemStack().getTypeId() <= 279) + || (283 <= droppedItem.getItemStack().getTypeId() && droppedItem + .getItemStack().getTypeId() <= 286) + || (290 <= droppedItem.getItemStack().getTypeId() && droppedItem + .getItemStack().getTypeId() <= 294) + || (298 <= droppedItem.getItemStack().getTypeId() && droppedItem + .getItemStack().getTypeId() <= 317) + || droppedItem.getItemStack().getTypeId() == 259 + || droppedItem.getItemStack().getTypeId() == 346 + || droppedItem.getItemStack().getTypeId() == 359 + || droppedItem.getItemStack().getTypeId() == 261) { + if ((256 <= droppedItem.getItemStack().getTypeId() && droppedItem + .getItemStack().getTypeId() <= 258) + || droppedItem.getItemStack().getTypeId() == 267 + || droppedItem.getItemStack().getTypeId() == 292) + cost = droppedItem.getItemStack().getDurability(); + if ((268 <= droppedItem.getItemStack().getTypeId() && droppedItem + .getItemStack().getTypeId() <= 271) + || droppedItem.getItemStack().getTypeId() == 290) + cost = droppedItem.getItemStack().getDurability(); + if ((272 <= droppedItem.getItemStack().getTypeId() && droppedItem + .getItemStack().getTypeId() <= 275) + || droppedItem.getItemStack().getTypeId() == 291) + cost = droppedItem.getItemStack().getDurability(); + if ((276 <= droppedItem.getItemStack().getTypeId() && droppedItem + .getItemStack().getTypeId() <= 279) + || droppedItem.getItemStack().getTypeId() == 293) + cost = droppedItem.getItemStack().getDurability(); + if ((283 <= droppedItem.getItemStack().getTypeId() && droppedItem + .getItemStack().getTypeId() <= 286) + || droppedItem.getItemStack().getTypeId() == 294) + cost = droppedItem.getItemStack().getDurability(); + if (droppedItem.getItemStack().getTypeId() == 298) + cost = droppedItem.getItemStack().getDurability(); + if (droppedItem.getItemStack().getTypeId() == 299) + cost = droppedItem.getItemStack().getDurability(); + if (droppedItem.getItemStack().getTypeId() == 300) + cost = droppedItem.getItemStack().getDurability(); + if (droppedItem.getItemStack().getTypeId() == 301) + cost = droppedItem.getItemStack().getDurability(); + if (droppedItem.getItemStack().getTypeId() == 306) + cost = droppedItem.getItemStack().getDurability(); + if (droppedItem.getItemStack().getTypeId() == 307) + cost = droppedItem.getItemStack().getDurability(); + if (droppedItem.getItemStack().getTypeId() == 308) + cost = droppedItem.getItemStack().getDurability(); + if (droppedItem.getItemStack().getTypeId() == 309) + cost = droppedItem.getItemStack().getDurability(); + if (droppedItem.getItemStack().getTypeId() == 310) + cost = droppedItem.getItemStack().getDurability(); + if (droppedItem.getItemStack().getTypeId() == 311) + cost = droppedItem.getItemStack().getDurability(); + if (droppedItem.getItemStack().getTypeId() == 312) + cost = droppedItem.getItemStack().getDurability(); + if (droppedItem.getItemStack().getTypeId() == 313) + cost = droppedItem.getItemStack().getDurability(); + if (droppedItem.getItemStack().getTypeId() == 314) + cost = droppedItem.getItemStack().getDurability(); + if (droppedItem.getItemStack().getTypeId() == 315) + cost = droppedItem.getItemStack().getDurability(); + if (droppedItem.getItemStack().getTypeId() == 316) + cost = droppedItem.getItemStack().getDurability(); + if (droppedItem.getItemStack().getTypeId() == 317) + cost = droppedItem.getItemStack().getDurability(); + if (droppedItem.getItemStack().getTypeId() == 259) + cost = droppedItem.getItemStack().getDurability(); + if (droppedItem.getItemStack().getTypeId() == 346) + cost = droppedItem.getItemStack().getDurability(); + if (droppedItem.getItemStack().getTypeId() == 359) + cost = droppedItem.getItemStack().getDurability(); + if (droppedItem.getItemStack().getTypeId() == 261) + cost = droppedItem.getItemStack().getDurability(); + cost = cost / 50; + if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + ItemStack newItem = new ItemStack(droppedItem + .getItemStack().getTypeId(), 1); + droppedItem.remove(); + effectBlock.getWorld().dropItem( + effectBlock.getLocation(), newItem); + } else + return; + } + } + } + } else if (arrayString.equals("[1, 2, 2, 2]") + && player.hasPermission("circle.set.1222")) { + cost = 1; + if (!hasLearnedCircle(player, arrayString)) { + player.sendMessage("You have not yet learned circle " + + arrayString + "!"); + return; + } + if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + ItemStack oneRedstone = new ItemStack(331, 1); + Item redStack = effectBlock.getWorld().dropItem( + effectBlock.getLocation(), oneRedstone); + List entityList = redStack.getNearbyEntities(5, 10, 5); + for (int i = 0; i < entityList.size(); i++) { + if (entityList.get(i) instanceof Item) { + Item droppedItem = (Item) entityList.get(i); + calculateEXP(Material.AIR, Material.AIR); + int[] valueArray = new int[2266]; + getValueArray(valueArray); + player.setLevel((valueArray[droppedItem.getItemStack() + .getTypeId()] * droppedItem.getItemStack() + .getAmount()) + + player.getLevel()); + droppedItem.remove(); + } + } + redStack.remove(); + } else + return; + } else if (arrayString.equals("[1, 2, 3, 3]") + && player.hasPermission("circle.set.1233")) { + cost = 20; + if (!hasLearnedCircle(player, arrayString)) { + player.sendMessage("You have not yet learned circle " + + arrayString + "!"); + return; + } + ItemStack onePortal = new ItemStack(90, 1); + int fires = 0; + List entityList = player.getNearbyEntities(10, 10, 10); + for (int i = 0; i < entityList.size(); i++) { + if (entityList.get(i) instanceof Item) { + Item sacrifice = (Item) entityList.get(i); + if (sacrifice.getItemStack().getType() == Material.FIRE) { + fires += sacrifice.getItemStack().getAmount(); + sacrifice.remove(); + } + } + } + if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + if (fires >= 64) { + fires -= 64; + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + effectBlock.getWorld().dropItem(effectBlock.getLocation(), + onePortal); + } + } + ItemStack diamondStack = new ItemStack(264, fires); + effectBlock.getWorld().dropItem(effectBlock.getLocation(), + diamondStack); + } else if (arrayString.equals("[1, 2, 3, 4]") + && player.hasPermission("circle.set.1234")) { + cost = 1; + if (!hasLearnedCircle(player, arrayString)) { + player.sendMessage("You have not yet learned circle " + + arrayString + "!"); + return; + } + if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + player.sendMessage(ChatColor.GREEN + + "The four elements, like man alone, are weak. But together they form the strong fifth element: boron -Brother Silence"); + ItemStack oneRedstone = new ItemStack(331, 10); + effectBlock.getWorld().dropItem(effectBlock.getLocation(), + oneRedstone); + } else + return; + } else if (arrayString.equals("[2, 2, 2, 3]") + && player.hasPermission("circle.set.2223")) { + cost = 10; + if (!hasLearnedCircle(player, arrayString)) { + player.sendMessage("You have not yet learned circle " + + arrayString + "!"); + return; + } + ItemStack oneRedstone = new ItemStack(331, 1); + if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + Item redStack = effectBlock.getWorld().dropItem( + effectBlock.getLocation(), oneRedstone); + int size = setCircleSize(actBlock); + List entityList = redStack.getNearbyEntities(size + 5, + 128, size + 5); + for (int i = 0; i < entityList.size(); i++) { + if (entityList.get(i) instanceof Player) { + HumanEntity victim = (HumanEntity) entityList.get(i); + if (!victim.equals(player)) { + victim.getWorld().strikeLightningEffect( + victim.getLocation()); + if (victim.getInventory().contains(Material.FIRE)) { + for (int k = 0; k < player.getInventory() + .getSize(); k++) { + if (player.getInventory().getItem(i) + .getType() == Material.FIRE) { + // System.out.println("removed a fire"); + int amount = player.getInventory() + .getItem(k).getAmount(); + player.getInventory().getItem(k) + .setAmount(amount - 1); + if (amount - 1 <= 0) { + player.getInventory().clear(k); + } + } + } + } else + victim.damage(20); + if (victim.isDead()) { + ItemStack oneFire = new ItemStack(51, 1); + victim.getWorld().dropItem( + actBlock.getLocation(), oneFire); + } + } + } + if (entityList.get(i) instanceof Villager) { + Villager victim = (Villager) entityList.get(i); + victim.getWorld().strikeLightningEffect( + victim.getLocation()); + victim.damage(20); + if (victim.isDead()) { + ItemStack oneFire = new ItemStack(51, 1); + victim.getWorld().dropItem(actBlock.getLocation(), + oneFire); + } + } + } + redStack.remove(); + } else + return; + } else if (arrayString.equals("[2, 2, 2, 4]") + && player.hasPermission("circle.set.2224")) { + cost = 10; + if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + Location spawnLoc = effectBlock.getLocation(); + spawnLoc.add(0.5, 0, 0.5); + effectBlock.getWorld().spawn(spawnLoc, Enderman.class); + } else + return; + } else if (arrayString.equals("[2, 2, 4, 4]") + && player.hasPermission("circle.set.2244")) { + if (!hasLearnedCircle(player, arrayString)) { + player.sendMessage("You have not yet learned circle " + + arrayString + "!"); + return; + } + Location actPoint = effectBlock.getLocation(); + int na = 0, nb = 0, ea = 0, eb = 0, sa = 0, sb = 0, wa = 0, wb = 0; + Block curBlock = effectBlock.getRelative(0, 0, -1); while (curBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE) { na++; curBlock = curBlock.getRelative(0, 0, -1); - curBlock.setType(Material.AIR); } Block fineBlock = curBlock; while (fineBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE) { nb++; fineBlock = fineBlock.getRelative(-1, 0, 0); - fineBlock.setType(Material.AIR); - } - fineBlock = curBlock; - while (fineBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE) { - nc++; - fineBlock = fineBlock.getRelative(1, 0, 0); - fineBlock.setType(Material.AIR); } - curBlock = actBlock.getRelative(1, 0, 0); + curBlock = effectBlock.getRelative(1, 0, 0); while (curBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE) { ea++; curBlock = curBlock.getRelative(1, 0, 0); - curBlock.setType(Material.AIR); } fineBlock = curBlock; while (fineBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE) { eb++; fineBlock = fineBlock.getRelative(0, 0, -1); - fineBlock.setType(Material.AIR); } - fineBlock = curBlock; - while (fineBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE) { - ec++; - fineBlock = fineBlock.getRelative(0, 0, 1); - fineBlock.setType(Material.AIR); - } - curBlock = actBlock.getRelative(0, 0, 1); + curBlock = effectBlock.getRelative(0, 0, 1); while (curBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE) { sa++; curBlock = curBlock.getRelative(0, 0, 1); - curBlock.setType(Material.AIR); } fineBlock = curBlock; while (fineBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE) { sb++; fineBlock = fineBlock.getRelative(1, 0, 0); - fineBlock.setType(Material.AIR); - } - fineBlock = curBlock; - while (fineBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE) { - sc++; - fineBlock = fineBlock.getRelative(-1, 0, 0); - fineBlock.setType(Material.AIR); } - curBlock = actBlock.getRelative(-1, 0, 0); + curBlock = effectBlock.getRelative(-1, 0, 0); while (curBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE) { wa++; curBlock = curBlock.getRelative(-1, 0, 0); - curBlock.setType(Material.AIR); } fineBlock = curBlock; while (fineBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE) { wb++; fineBlock = fineBlock.getRelative(0, 0, 1); - fineBlock.setType(Material.AIR); - } - fineBlock = curBlock; - while (fineBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE) { - wc++; - fineBlock = fineBlock.getRelative(0, 0, -1); - fineBlock.setType(Material.AIR); } // north negative z, south positive z, east positive x, west // negative x int z = ((sa * 100 + sb) - (na * 100 + nb)); int x = ((ea * 100 + eb) - (wa * 100 + wb)); - int y = nc + ec + sc + wc; double actPointX = actPoint.getX(); double actPointZ = actPoint.getZ(); - Location teleLoc = actPoint.add(x, y, z); - float yaw = player.getLocation().getYaw(); - float pitch = player.getLocation().getPitch(); - teleLoc.setYaw(yaw); - teleLoc.setPitch(pitch); - double distance = Math.sqrt(Math.pow(teleLoc.getX() - actPointX, 2) + Math.pow(teleLoc.getZ() - actPointZ, 2)); - double mathRandX = philosopherStoneModifier(player) * distance/10 * Math.random(); - double mathRandZ = philosopherStoneModifier(player) * distance/10 * Math.random(); - double randX = (teleLoc.getX() - (0.5 * mathRandX)) - + (mathRandX); - double randZ = (teleLoc.getZ() - (0.5 * mathRandZ)) - + (mathRandZ); + Location teleLoc = actPoint.add(x, 0, z); + double distance = Math.sqrt(Math.pow(teleLoc.getX() - actPointX, 2) + + Math.pow(teleLoc.getZ() - actPointZ, 2)); + double mathRandX = philosopherStoneModifier(player) * distance / 10 + * Math.random(); + double mathRandZ = philosopherStoneModifier(player) * distance / 10 + * Math.random(); + double randX = (teleLoc.getX() - (0.5 * mathRandX)) + (mathRandX); + double randZ = (teleLoc.getZ() - (0.5 * mathRandZ)) + (mathRandZ); teleLoc.setX(randX); teleLoc.setZ(randZ); - while (teleLoc.getWorld().getChunkAt(teleLoc).isLoaded() == false){ + while (teleLoc.getWorld().getChunkAt(teleLoc).isLoaded() == false) { teleLoc.getWorld().getChunkAt(teleLoc).load(true); - } - player.teleport(teleLoc); - ItemStack redstonePile = new ItemStack(331, 5 + na + nb + nc + sa + sb + sc + ea + eb + ec + wa + wb + wc); - teleLoc.getWorld().dropItem(teleLoc, redstonePile); - actBlock.getWorld().strikeLightningEffect(actBlock.getLocation()); - actBlock.getWorld().strikeLightningEffect(teleLoc); - return; - } - - public static void microCircle (Player player, World world, Block actBlock) { - // have it print to console what level is - player.sendMessage("Your experience level is " + player.getLevel()); - List entitiesList = player.getNearbyEntities(100, 10, 100); - for (int i = 0; i < entitiesList.size(); i++){ - if (entitiesList.get(i) instanceof Arrow){ - Arrow shotArrow = (Arrow) entitiesList.get(i); - if (shotArrow.getLocation().getBlock().getType() == Material.REDSTONE_WIRE){ - Block newActPoint = shotArrow.getLocation().getBlock(); - Player newPlayer = (Player) shotArrow.getShooter(); - circleChooser(newPlayer, world, newActPoint); - } - } - } - } - - public static void transmutationCircle (Player player, World world, Block actBlock){ - int halfWidth = 0; - int fullWidth = 0; - Location startLoc = actBlock.getLocation(); - Location endLoc = actBlock.getLocation(); - Location circleStart = actBlock.getLocation(); - Location circleEnd = actBlock.getLocation(); - Material fromType = actBlock.getType(); - Material toType = actBlock.getType(); - if (actBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE - && actBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE) { - halfWidth = 0; - while (actBlock.getRelative(0, 0, -1 * halfWidth).getType() == Material.REDSTONE_WIRE) { - halfWidth++; - } - fullWidth = (halfWidth * 2) - 1; - int dimensionOfEffect = (fullWidth - 2) * (fullWidth - 2); - if (actBlock.getRelative((fullWidth - 1), 0, 0).getType() == Material.REDSTONE_WIRE) { - //east - fromType = actBlock.getLocation().add( - halfWidth - 1, 0, -1 * (halfWidth + 1)).getBlock() - .getType(); - toType = actBlock.getLocation().add(halfWidth - 1, - 0, halfWidth + 1).getBlock().getType(); - startLoc = actBlock.getLocation().add(fullWidth, - 0, -1 * dimensionOfEffect / 2 + 1); - endLoc = actBlock.getLocation().add( - fullWidth + dimensionOfEffect - 1, dimensionOfEffect -1, - dimensionOfEffect / 2 - 1); - circleStart = actBlock.getLocation().add(1, 0, -1 * (halfWidth - 2)); - circleEnd = actBlock.getLocation().add(fullWidth - 2, fullWidth - 3, halfWidth -2); - alchemyCheck(fromType, toType, circleStart, circleEnd, startLoc, endLoc, player, fullWidth -2); - } else if (actBlock.getRelative(-1 * (fullWidth - 1), 0, 0) - .getType() == Material.REDSTONE_WIRE) { - //west - fromType = actBlock.getLocation().add( - -1 * (halfWidth - 1), 0, halfWidth + 1).getBlock() - .getType(); - toType = actBlock.getLocation().add( - (-1) * (halfWidth - 1), 0, (-1) * (halfWidth + 1)) - .getBlock().getType(); - startLoc = actBlock.getLocation().add( - -1 * fullWidth, 0, dimensionOfEffect / 2); - endLoc = actBlock.getLocation().add( - -1 * (fullWidth + dimensionOfEffect) + 1, - dimensionOfEffect - 1, -1 * dimensionOfEffect / 2 + 1); - circleStart = actBlock.getLocation().add(-1, 0, (halfWidth - 2)); - circleEnd = actBlock.getLocation().add(-1 * (fullWidth - 2), fullWidth - 3, -1 * (halfWidth - 2)); - alchemyCheck(fromType, toType, circleStart, circleEnd, startLoc, endLoc, player, fullWidth -2); - } - } else if (actBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE - && actBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE) { - halfWidth = 0; - while (actBlock.getRelative(halfWidth, 0, 0).getType() == Material.REDSTONE_WIRE) { - halfWidth++; - } - fullWidth = (halfWidth * 2) - 1; - //System.out.println("half is " + halfWidth + " full is " + fullWidth); - int dimensionOfEffect = (fullWidth - 2) * (fullWidth - 2); - if (actBlock.getRelative(0, 0, -1 * (fullWidth - 1)).getType() == Material.REDSTONE_WIRE) { - //north - //System.out.println("transmutationCircle north"); - fromType = actBlock.getLocation().add( - -1 * (halfWidth + 1), 0, -1 * (halfWidth - 1)) - .getBlock().getType(); - toType = actBlock.getLocation().add(halfWidth + 1, - 0, -1 * (halfWidth - 1)).getBlock().getType(); - startLoc = actBlock.getLocation().add( - -1 * dimensionOfEffect / 2, 0, -1 * fullWidth); - endLoc = actBlock.getLocation().add( - dimensionOfEffect / 2 - 1, dimensionOfEffect - 1, - -1 * (dimensionOfEffect + fullWidth) + 1); - circleStart = actBlock.getLocation().add(-1 * (halfWidth - 2), 0, -1); - circleEnd = actBlock.getLocation().add((halfWidth - 2), fullWidth - 3, -1 * (fullWidth - 2)); - alchemyCheck(fromType, toType, circleStart, circleEnd, startLoc, endLoc, player, fullWidth -2); - } else if (actBlock.getRelative(0, 0, (fullWidth - 1)) - .getType() == Material.REDSTONE_WIRE) { - //south - //System.out.println("transmutationCircle south"); - fromType = actBlock.getLocation().add( - halfWidth + 1, 0, halfWidth - 1).getBlock() - .getType(); - toType = actBlock.getLocation().add( - -1 * (halfWidth + 1), 0, halfWidth - 1).getBlock() - .getType(); - startLoc = actBlock.getLocation().add( - dimensionOfEffect / 2, 0, fullWidth); - endLoc = actBlock.getLocation().add( - -1 * dimensionOfEffect / 2 + 1, dimensionOfEffect - 1, - fullWidth + dimensionOfEffect - 1); - circleStart = actBlock.getLocation().add(halfWidth - 2, 0, 1); - circleEnd = actBlock.getLocation().add(-1 * (halfWidth - 2), fullWidth - 3, (fullWidth - 2)); - alchemyCheck(fromType, toType, circleStart, circleEnd, startLoc, endLoc, player, fullWidth -2); - } } - actBlock.getWorld().strikeLightningEffect(actBlock.getLocation()); - } - - public static void setCircleRemote(Player player, World world, Block actBlock){ - Boolean remote = false; - Block effectBlock = actBlock; - List entitiesList = player.getNearbyEntities(242, 20, 242); - for (int i = 0; i < entitiesList.size(); i++){ - if (entitiesList.get(i) instanceof Arrow){ - Arrow shotArrow = (Arrow) entitiesList.get(i); - if (shotArrow.getLocation().getBlock().getX() == actBlock.getLocation().getBlock().getX() && shotArrow.getLocation().getBlock().getZ() == actBlock.getLocation().getBlock().getZ()){ - remote = true; - entitiesList.remove(i); - } - } - } - if (remote){ - for (int i = 0; i < entitiesList.size(); i++){ - if (entitiesList.get(i) instanceof Arrow){ - Arrow shotArrow = (Arrow) entitiesList.get(i); - effectBlock = shotArrow.getLocation().getBlock(); - setCircle(player, world, actBlock, effectBlock); - } - } - } - else - setCircle(player, world, actBlock, effectBlock); - } - - public static void setCircle(Player player, World world, Block actBlock, Block effectBlock){ - Block northSin = actBlock.getRelative(0, 0, -3); - Block southSin = actBlock.getRelative(0, 0, 3); - Block eastSin = actBlock.getRelative(3, 0, 0); - Block westSin = actBlock.getRelative(-3, 0, 0); - int n = 0; - int s = 0; - int e = 0; - int w = 0; - int[] intArray = new int[4]; - if (northSin.getRelative(BlockFace.NORTH).getType() == Material.REDSTONE_WIRE) - n ++; - if (northSin.getRelative(BlockFace.SOUTH).getType() == Material.REDSTONE_WIRE) - n ++; - if (northSin.getRelative(BlockFace.EAST).getType() == Material.REDSTONE_WIRE) - n ++; - if (northSin.getRelative(BlockFace.WEST).getType() == Material.REDSTONE_WIRE) - n ++; - intArray[0] = n; - if (southSin.getRelative(BlockFace.NORTH).getType() == Material.REDSTONE_WIRE) - s ++; - if (southSin.getRelative(BlockFace.SOUTH).getType() == Material.REDSTONE_WIRE) - s ++; - if (southSin.getRelative(BlockFace.EAST).getType() == Material.REDSTONE_WIRE) - s ++; - if (southSin.getRelative(BlockFace.WEST).getType() == Material.REDSTONE_WIRE) - s ++; - intArray[1] = s; - if (eastSin.getRelative(BlockFace.NORTH).getType() == Material.REDSTONE_WIRE) - e ++; - if (eastSin.getRelative(BlockFace.SOUTH).getType() == Material.REDSTONE_WIRE) - e ++; - if (eastSin.getRelative(BlockFace.EAST).getType() == Material.REDSTONE_WIRE) - e ++; - if (eastSin.getRelative(BlockFace.WEST).getType() == Material.REDSTONE_WIRE) - e ++; - intArray[2] = e; - if (westSin.getRelative(BlockFace.NORTH).getType() == Material.REDSTONE_WIRE) - w ++; - if (westSin.getRelative(BlockFace.SOUTH).getType() == Material.REDSTONE_WIRE) - w ++; - if (westSin.getRelative(BlockFace.EAST).getType() == Material.REDSTONE_WIRE) - w ++; - if (westSin.getRelative(BlockFace.WEST).getType() == Material.REDSTONE_WIRE) - w ++; - intArray[3] = w; - Arrays.sort(intArray); - String arrayString = Arrays.toString(intArray); - try { - setCircleEffects(player, world, actBlock, effectBlock, arrayString); - } catch (IOException e1) { - e1.printStackTrace(); - } - } - - public static void setCircleEffects(Player player, World world, Block actBlock, Block effectBlock, String arrayString) throws IOException{ - int cost = 0; - if (!hasLearnedCircle(player, arrayString)){ - if (learnCircle(player, arrayString, actBlock)){ - player.sendMessage("You have successfully learned the circle " + arrayString); - return; - } - } - if (arrayString.equals("0")) + int highestBlock = teleLoc.getWorld().getHighestBlockYAt(teleLoc) + 1; + // System.out.println( mathRandX + " " + mathRandZ ); + player.sendMessage("Safe teleportation altitude is at " + + highestBlock); + return; + } else if (arrayString.equals("[2, 3, 3, 3]") + && player.hasPermission("circle.set.2333")) { + cost = 2; + int size = setCircleSize(actBlock); + cost = 2 + size / 2; + if (!hasLearnedCircle(player, arrayString)) { + player.sendMessage("You have not yet learned circle " + + arrayString + "!"); return; - if (arrayString.equals("[1, 1, 3, 3]") && player.hasPermission("circle.set.1133")){ - if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("You have not yet learned circle " + arrayString + "!"); - return; - } - List repairEntities = player.getNearbyEntities(9, 10, 9); - for (int i = 0; i < repairEntities.size(); i++){ - if (repairEntities.get(i) instanceof Item){ - Item droppedItem = (Item) repairEntities.get(i); - if ( (256 <= droppedItem.getItemStack().getTypeId() && droppedItem.getItemStack().getTypeId() <= 258) || (267 <= droppedItem.getItemStack().getTypeId() && droppedItem.getItemStack().getTypeId() <= 279) || (283 <= droppedItem.getItemStack().getTypeId() && droppedItem.getItemStack().getTypeId() <= 286) || (290 <= droppedItem.getItemStack().getTypeId() && droppedItem.getItemStack().getTypeId() <= 294) || (298 <= droppedItem.getItemStack().getTypeId() && droppedItem.getItemStack().getTypeId() <= 317) || droppedItem.getItemStack().getTypeId() == 259 || droppedItem.getItemStack().getTypeId() == 346 || droppedItem.getItemStack().getTypeId() == 359 || droppedItem.getItemStack().getTypeId() == 261 ){ - if ((256 <= droppedItem.getItemStack().getTypeId() && droppedItem.getItemStack().getTypeId() <= 258) || droppedItem.getItemStack().getTypeId() == 267 || droppedItem.getItemStack().getTypeId() == 292 ) - cost = droppedItem.getItemStack().getDurability(); - if ( (268 <= droppedItem.getItemStack().getTypeId() && droppedItem.getItemStack().getTypeId() <= 271) || droppedItem.getItemStack().getTypeId() == 290) - cost = droppedItem.getItemStack().getDurability(); - if ( (272 <= droppedItem.getItemStack().getTypeId() && droppedItem.getItemStack().getTypeId() <= 275) || droppedItem.getItemStack().getTypeId() == 291) - cost = droppedItem.getItemStack().getDurability(); - if ( (276 <= droppedItem.getItemStack().getTypeId() && droppedItem.getItemStack().getTypeId() <= 279) || droppedItem.getItemStack().getTypeId() == 293) - cost = droppedItem.getItemStack().getDurability(); - if ( (283 <= droppedItem.getItemStack().getTypeId() && droppedItem.getItemStack().getTypeId() <= 286) || droppedItem.getItemStack().getTypeId() == 294) - cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 298) - cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 299) - cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 300) - cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 301) - cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 306) - cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 307) - cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 308) - cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 309) - cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 310) - cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 311) - cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 312) - cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 313) - cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 314) - cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 315) - cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 316) - cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 317) - cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 259) - cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 346) - cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 359) - cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 261) - cost = droppedItem.getItemStack().getDurability(); - cost = cost / 50; - if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); - ItemStack newItem = new ItemStack(droppedItem.getItemStack().getTypeId(), 1); - droppedItem.remove(); - effectBlock.getWorld().dropItem(effectBlock.getLocation(), newItem); - } else - return; - } - } - } - } - else if (arrayString.equals("[1, 2, 2, 2]") && player.hasPermission("circle.set.1222")){ - cost = 1; - if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("You have not yet learned circle " + arrayString + "!"); - return; - } - if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); - ItemStack oneRedstone = new ItemStack(331, 1); - Item redStack = effectBlock.getWorld().dropItem(effectBlock.getLocation(), oneRedstone); - List entityList = redStack.getNearbyEntities(5, 10, 5); - for (int i = 0; i < entityList.size(); i++){ - if (entityList.get(i) instanceof Item){ - Item droppedItem = (Item) entityList.get(i); - calculateEXP(Material.AIR, Material.AIR); - int[] valueArray = new int[2266]; - getValueArray(valueArray); - player.setLevel((valueArray[droppedItem.getItemStack().getTypeId()] * droppedItem.getItemStack().getAmount()) + player.getLevel()); - droppedItem.remove(); - } - } - redStack.remove(); - } else - return; } - else if (arrayString.equals("[1, 2, 3, 3]") && player.hasPermission("circle.set.1233")){ - cost = 20; - if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("You have not yet learned circle " + arrayString + "!"); - return; - } - ItemStack onePortal = new ItemStack(90, 1); - int fires = 0; - List entityList = player.getNearbyEntities(10, 10, 10); - for (int i = 0; i < entityList.size(); i++){ - if (entityList.get(i) instanceof Item){ - Item sacrifice = (Item) entityList.get(i); - if (sacrifice.getItemStack().getType() == Material.FIRE){ - fires += sacrifice.getItemStack().getAmount(); - sacrifice.remove(); - } - } - } - if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - if (fires >= 64){ - fires -= 64; - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); - effectBlock.getWorld().dropItem(effectBlock.getLocation(), onePortal); - } - } - ItemStack diamondStack = new ItemStack(264 , fires); - effectBlock.getWorld().dropItem(effectBlock.getLocation(), diamondStack); - } - else if (arrayString.equals("[1, 2, 3, 4]") && player.hasPermission("circle.set.1234")){ - cost = 1; - if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("You have not yet learned circle " + arrayString + "!"); - return; - } - if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); - player.sendMessage(ChatColor.GREEN + "The four elements, like man alone, are weak. But together they form the strong fifth element: boron -Brother Silence"); - ItemStack oneRedstone = new ItemStack(331, 10); - effectBlock.getWorld().dropItem(effectBlock.getLocation(), oneRedstone); - } else - return; - } - else if (arrayString.equals("[2, 2, 2, 3]") && player.hasPermission("circle.set.2223")){ - cost = 10; - if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("You have not yet learned circle " + arrayString + "!"); - return; - } - ItemStack oneRedstone = new ItemStack(331, 1); - if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); - Item redStack = effectBlock.getWorld().dropItem(effectBlock.getLocation(), oneRedstone); - int size = setCircleSize(actBlock); - List entityList = redStack.getNearbyEntities(size + 5, 128, size + 5); - for (int i = 0; i < entityList.size(); i++){ - if (entityList.get(i) instanceof Player){ - HumanEntity victim = (HumanEntity) entityList.get(i); - if (!victim.equals(player)){ - victim.getWorld().strikeLightningEffect(victim.getLocation()); - if (victim.getInventory().contains(Material.FIRE)){ - for (int k = 0; k < player.getInventory().getSize(); k++ ){ - if (player.getInventory().getItem(i).getType() == Material.FIRE){ - //System.out.println("removed a fire"); - int amount = player.getInventory().getItem(k).getAmount(); - player.getInventory().getItem(k).setAmount(amount - 1); - if (amount-1 <= 0){ - player.getInventory().clear(k); - } - } - } - } - else - victim.damage(20); - if (victim.isDead()){ - ItemStack oneFire = new ItemStack(51, 1); - victim.getWorld().dropItem(actBlock.getLocation(), oneFire); - } - } - } - if (entityList.get(i) instanceof Villager){ - Villager victim = (Villager) entityList.get(i); - victim.getWorld().strikeLightningEffect(victim.getLocation()); - victim.damage(20); - if (victim.isDead()){ - ItemStack oneFire = new ItemStack(51, 1); - victim.getWorld().dropItem(actBlock.getLocation(), oneFire); - } - } - } - redStack.remove(); - } else - return; + if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + effectBlock.getWorld().createExplosion( + effectBlock.getLocation(), (4 + size)); + } else + return; + } else if (arrayString.equals("[3, 3, 3, 4]") + && player.hasPermission("circle.set.3334")) { + cost = 2; + if (!hasLearnedCircle(player, arrayString)) { + player.sendMessage("You have not yet learned circle " + + arrayString + "!"); + return; } - else if (arrayString.equals("[2, 2, 2, 4]") && player.hasPermission("circle.set.2224")){ - cost = 10; - if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); - Location spawnLoc = effectBlock.getLocation(); - spawnLoc.add(0.5, 0, 0.5); - effectBlock.getWorld().spawn(spawnLoc, Enderman.class); - } else - return; + if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + alchemyFiller(Material.AIR, Material.FIRE, effectBlock + .getRelative(-10, 0, -10).getLocation(), effectBlock + .getRelative(10, 20, 10).getLocation(), player); + } else + return; + } else if (arrayString.equals("[3, 3, 4, 4]") + && player.hasPermission("circle.set.3344")) { + cost = 4; + int size = setCircleSize(actBlock); + cost = 4 + size / 2; + if (!hasLearnedCircle(player, arrayString)) { + player.sendMessage("You have not yet learned circle " + + arrayString + "!"); + return; } - else if (arrayString.equals("[2, 2, 4, 4]") && player.hasPermission("circle.set.2244")){ - if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("You have not yet learned circle " + arrayString + "!"); - return; - } - Location actPoint = effectBlock.getLocation(); - int na = 0, nb = 0, ea = 0, eb = 0, sa = 0, sb = 0, wa = 0, wb = 0; - Block curBlock = effectBlock.getRelative(0, 0, -1); - while (curBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE) { - na++; - curBlock = curBlock.getRelative(0, 0, -1); - } - Block fineBlock = curBlock; - while (fineBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE) { - nb++; - fineBlock = fineBlock.getRelative(-1, 0, 0); - } - curBlock = effectBlock.getRelative(1, 0, 0); - while (curBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE) { - ea++; - curBlock = curBlock.getRelative(1, 0, 0); - } - fineBlock = curBlock; - while (fineBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE) { - eb++; - fineBlock = fineBlock.getRelative(0, 0, -1); - } - curBlock = effectBlock.getRelative(0, 0, 1); - while (curBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE) { - sa++; - curBlock = curBlock.getRelative(0, 0, 1); - } - fineBlock = curBlock; - while (fineBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE) { - sb++; - fineBlock = fineBlock.getRelative(1, 0, 0); - } - curBlock = effectBlock.getRelative(-1, 0, 0); - while (curBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE) { - wa++; - curBlock = curBlock.getRelative(-1, 0, 0); - } - fineBlock = curBlock; - while (fineBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE) { - wb++; - fineBlock = fineBlock.getRelative(0, 0, 1); - } - // north negative z, south positive z, east positive x, west - // negative x - int z = ((sa * 100 + sb) - (na * 100 + nb)); - int x = ((ea * 100 + eb) - (wa * 100 + wb)); - double actPointX = actPoint.getX(); - double actPointZ = actPoint.getZ(); - Location teleLoc = actPoint.add(x, 0, z); - double distance = Math.sqrt(Math.pow(teleLoc.getX() - actPointX, 2) + Math.pow(teleLoc.getZ() - actPointZ, 2)); - double mathRandX = philosopherStoneModifier(player) * distance/10 * Math.random(); - double mathRandZ = philosopherStoneModifier(player) * distance/10 * Math.random(); - double randX = (teleLoc.getX() - (0.5 * mathRandX)) - + (mathRandX); - double randZ = (teleLoc.getZ() - (0.5 * mathRandZ)) - + (mathRandZ); - teleLoc.setX(randX); - teleLoc.setZ(randZ); - while (teleLoc.getWorld().getChunkAt(teleLoc).isLoaded() == false){ - teleLoc.getWorld().getChunkAt(teleLoc).load(true); - } - int highestBlock = teleLoc.getWorld().getHighestBlockYAt(teleLoc) + 1; - //System.out.println( mathRandX + " " + mathRandZ ); - player.sendMessage("Safe teleportation altitude is at " + highestBlock); + if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + effectBlock.getWorld().createExplosion( + effectBlock.getLocation(), 8 + size, true); + } else + return; + } else if (arrayString.equals("[3, 4, 4, 4]") + && player.hasPermission("circle.set.3444")) { + cost = 20; + if (!hasLearnedCircle(player, arrayString)) { + player.sendMessage("You have not yet learned circle " + + arrayString + "!"); return; } - else if (arrayString.equals("[2, 3, 3, 3]") && player.hasPermission("circle.set.2333")){ - cost = 2; - int size = setCircleSize(actBlock); - cost = 2 + size/2; - if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("You have not yet learned circle " + arrayString + "!"); - return; - } - if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + try { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); - effectBlock.getWorld().createExplosion(effectBlock.getLocation(), (4 + size)); - } else - return; - } - else if (arrayString.equals("[3, 3, 3, 4]") && player.hasPermission("circle.set.3334")){ - cost = 2; - if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("You have not yet learned circle " + arrayString + "!"); - return; + humanTransmutation(player); + } catch (IOException e1) { + e1.printStackTrace(); } - if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - alchemyFiller(Material.AIR, Material.FIRE, effectBlock.getRelative(-10, 0, -10).getLocation(), effectBlock.getRelative(10, 20, 10).getLocation(), player); - } else - return; - } - else if (arrayString.equals("[3, 3, 4, 4]") && player.hasPermission("circle.set.3344")){ - cost = 4; - int size = setCircleSize(actBlock); - cost = 4 + size/2; - if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("You have not yet learned circle " + arrayString + "!"); - return; - } - if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); - effectBlock.getWorld().createExplosion(effectBlock.getLocation(), 8 + size, true); - } else - return; - } - else if (arrayString.equals("[3, 4, 4, 4]") && player.hasPermission("circle.set.3444")){ - cost = 20; - if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("You have not yet learned circle " + arrayString + "!"); - return; - } - if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - try { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); - humanTransmutation(player); - } catch (IOException e1) { - e1.printStackTrace(); - } - } else - return; - } - else if (arrayString.equals("[0, 1, 1, 1]") && player.hasPermission("circle.set.0111")){ - cost = 16; - if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("You have not yet learned circle " + arrayString + "!"); - return; - } - else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))){ - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); - Location playerSpawn = player.getBedSpawnLocation(); - if(playerSpawn != null){ - if(playerSpawn.getBlock().getType() == Material.AIR){ - player.teleport(playerSpawn); - } - else{ - if(new Location(player.getWorld(), playerSpawn.getX() + 1, playerSpawn.getY(), playerSpawn.getZ()).getBlock().getType() == Material.AIR){ - player.teleport(new Location(player.getWorld(), playerSpawn.getX() + 1, playerSpawn.getY(), playerSpawn.getZ())); - } - else if(new Location(player.getWorld(), playerSpawn.getX() - 1, playerSpawn.getY(), playerSpawn.getZ()).getBlock().getType() == Material.AIR){ - player.teleport(new Location(player.getWorld(), playerSpawn.getX() - 1, playerSpawn.getY(), playerSpawn.getZ())); - } - else if(new Location(player.getWorld(), playerSpawn.getX(), playerSpawn.getY(), playerSpawn.getZ() + 1).getBlock().getType() == Material.AIR){ - player.teleport(new Location(player.getWorld(), playerSpawn.getX(), playerSpawn.getY(), playerSpawn.getZ() + 1)); - } - else if(new Location(player.getWorld(), playerSpawn.getX(), playerSpawn.getY(), playerSpawn.getZ() - 1).getBlock().getType() == Material.AIR){ - player.teleport(new Location(player.getWorld(), playerSpawn.getX(), playerSpawn.getY(), playerSpawn.getZ() - 1)); - } - else{ - player.sendMessage("Your bed is not safe to teleport to!"); - player.setFoodLevel((int) (player.getFoodLevel() + (cost * philosopherStoneModifier(player)))); - } + } else + return; + } else if (arrayString.equals("[0, 1, 1, 1]") + && player.hasPermission("circle.set.0111")) { + cost = 16; + if (!hasLearnedCircle(player, arrayString)) { + player.sendMessage("You have not yet learned circle " + + arrayString + "!"); + return; + } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + Location playerSpawn = player.getBedSpawnLocation(); + if (playerSpawn != null) { + if (playerSpawn.getBlock().getType() == Material.AIR) { + player.teleport(playerSpawn); + } else { + if (new Location(player.getWorld(), + playerSpawn.getX() + 1, playerSpawn.getY(), + playerSpawn.getZ()).getBlock().getType() == Material.AIR) { + player.teleport(new Location(player.getWorld(), + playerSpawn.getX() + 1, playerSpawn.getY(), + playerSpawn.getZ())); + } else if (new Location(player.getWorld(), + playerSpawn.getX() - 1, playerSpawn.getY(), + playerSpawn.getZ()).getBlock().getType() == Material.AIR) { + player.teleport(new Location(player.getWorld(), + playerSpawn.getX() - 1, playerSpawn.getY(), + playerSpawn.getZ())); + } else if (new Location(player.getWorld(), + playerSpawn.getX(), playerSpawn.getY(), + playerSpawn.getZ() + 1).getBlock().getType() == Material.AIR) { + player.teleport(new Location(player.getWorld(), + playerSpawn.getX(), playerSpawn.getY(), + playerSpawn.getZ() + 1)); + } else if (new Location(player.getWorld(), + playerSpawn.getX(), playerSpawn.getY(), + playerSpawn.getZ() - 1).getBlock().getType() == Material.AIR) { + player.teleport(new Location(player.getWorld(), + playerSpawn.getX(), playerSpawn.getY(), + playerSpawn.getZ() - 1)); + } else { + player.sendMessage("Your bed is not safe to teleport to!"); + player.setFoodLevel((int) (player.getFoodLevel() + (cost * philosopherStoneModifier(player)))); } } - else{ - player.sendMessage("You do not have a spawn set!"); - player.setFoodLevel((int) (player.getFoodLevel() + (cost * philosopherStoneModifier(player)))); - } - } else - return; - } - else if (arrayString.equals("[0, 0, 4, 4]") && player.hasPermission("circle.set.0044")){ - cost = 10; - if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("You have not yet learned circle " + arrayString + "!"); - return; - } - else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); - Location spawnLoc = effectBlock.getLocation(); - spawnLoc.add(0.5, 0, 0.5); - effectBlock.getWorld().spawn(spawnLoc, Pig.class); - } else - return; - } - else if (arrayString.equals("[0, 1, 4, 4]") && player.hasPermission("circle.set.0144")){ - cost = 10; - if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("You have not yet learned circle " + arrayString + "!"); - return; + } else { + player.sendMessage("You do not have a spawn set!"); + player.setFoodLevel((int) (player.getFoodLevel() + (cost * philosopherStoneModifier(player)))); } - else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); - Location spawnLoc = effectBlock.getLocation(); - spawnLoc.add(0.5, 0, 0.5); - effectBlock.getWorld().spawn(spawnLoc, Sheep.class); - } else - return; - } - else if (arrayString.equals("[0, 2, 4, 4]") && player.hasPermission("circle.set.0244")){ - cost = 10; - if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("You have not yet learned circle " + arrayString + "!"); - return; - } - else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); - Location spawnLoc = effectBlock.getLocation(); - spawnLoc.add(0.5, 0, 0.5); - effectBlock.getWorld().spawn(spawnLoc, Cow.class); - } else - return; - } - else if (arrayString.equals("[0, 3, 4, 4]") && player.hasPermission("circle.set.0344")){ - cost = 10; - if (!hasLearnedCircle(player, arrayString)){ - player.sendMessage("You have not yet learned circle " + arrayString + "!"); - return; - } - else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); - Location spawnLoc = effectBlock.getLocation(); - spawnLoc.add(0.5, 0, 0.5); - effectBlock.getWorld().spawn(spawnLoc, Chicken.class); - } else - return; - } - else{ - player.sendMessage("You do not have permission to use " + arrayString + " or set circle does not exist"); - } - effectBlock.getWorld().strikeLightningEffect(effectBlock.getLocation()); + } else + return; + } else if (arrayString.equals("[0, 0, 4, 4]") + && player.hasPermission("circle.set.0044")) { + cost = 10; + if (!hasLearnedCircle(player, arrayString)) { + player.sendMessage("You have not yet learned circle " + + arrayString + "!"); + return; + } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + Location spawnLoc = effectBlock.getLocation(); + spawnLoc.add(0.5, 0, 0.5); + effectBlock.getWorld().spawn(spawnLoc, Pig.class); + } else + return; + } else if (arrayString.equals("[0, 1, 4, 4]") + && player.hasPermission("circle.set.0144")) { + cost = 10; + if (!hasLearnedCircle(player, arrayString)) { + player.sendMessage("You have not yet learned circle " + + arrayString + "!"); + return; + } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + Location spawnLoc = effectBlock.getLocation(); + spawnLoc.add(0.5, 0, 0.5); + effectBlock.getWorld().spawn(spawnLoc, Sheep.class); + } else + return; + } else if (arrayString.equals("[0, 2, 4, 4]") + && player.hasPermission("circle.set.0244")) { + cost = 10; + if (!hasLearnedCircle(player, arrayString)) { + player.sendMessage("You have not yet learned circle " + + arrayString + "!"); + return; + } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + Location spawnLoc = effectBlock.getLocation(); + spawnLoc.add(0.5, 0, 0.5); + effectBlock.getWorld().spawn(spawnLoc, Cow.class); + } else + return; + } else if (arrayString.equals("[0, 3, 4, 4]") + && player.hasPermission("circle.set.0344")) { + cost = 10; + if (!hasLearnedCircle(player, arrayString)) { + player.sendMessage("You have not yet learned circle " + + arrayString + "!"); + return; + } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + Location spawnLoc = effectBlock.getLocation(); + spawnLoc.add(0.5, 0, 0.5); + effectBlock.getWorld().spawn(spawnLoc, Chicken.class); + } else + return; + } else { + player.sendMessage("You do not have permission to use " + + arrayString + " or set circle does not exist"); } - - public static int setCircleSize (Block actBlock){ + effectBlock.getWorld().strikeLightningEffect(effectBlock.getLocation()); + } + + public static int setCircleSize(Block actBlock) { int na = 0, nb = 0, ea = 0, eb = 0, sa = 0, sb = 0, wa = 0, wb = 0, nc = 0, ec = 0, sc = 0, wc = 0; Block curBlock = actBlock.getRelative(0, 0, -5); while (curBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE) { @@ -964,13 +1055,15 @@ public static int setCircleSize (Block actBlock){ fineBlock = fineBlock.getRelative(0, 0, -1); } int size = 0; - if (wa == ea && na == sa && wb == eb && nb == sb && wc == ec && nc == sc && wa == na){ + if (wa == ea && na == sa && wb == eb && nb == sb && wc == ec + && nc == sc && wa == na) { size = wa; } return size; } - public static void alchemyCheck(Material a, Material b, Location circleStart, Location circleEnd, Location start, + public static void alchemyCheck(Material a, Material b, + Location circleStart, Location circleEnd, Location start, Location end, Player player, int width) { Block startBlock = circleStart.getBlock(); int xIteration = 0; @@ -978,112 +1071,181 @@ public static void alchemyCheck(Material a, Material b, Location circleStart, Lo int zIteration = 0; if (circleStart.getX() < circleEnd.getX()) { if (circleStart.getZ() < circleEnd.getZ()) { - //east - //System.out.println("alchemyCheck east"); + // east + // System.out.println("alchemyCheck east"); while (startBlock.getY() <= circleEnd.getY()) { while (startBlock.getX() <= circleEnd.getX()) { while (startBlock.getZ() <= circleEnd.getZ()) { - if (startBlock.getType() != Material.AIR){ - alchemyFiller(a, b, start.getBlock().getRelative(xIteration * width, yIteration * width, zIteration * width).getLocation(), start.getBlock().getRelative(xIteration * width + width - 1, yIteration * width + width - 1, (zIteration * width + (width - 1))).getLocation(), player); + if (startBlock.getType() != Material.AIR) { + alchemyFiller( + a, + b, + start.getBlock() + .getRelative( + xIteration * width, + yIteration * width, + zIteration * width) + .getLocation(), + start.getBlock() + .getRelative( + xIteration * width + + width - 1, + yIteration * width + + width - 1, + (zIteration * width + (width - 1))) + .getLocation(), player); } zIteration++; startBlock = startBlock.getRelative(0, 0, 1); } xIteration++; - startBlock = circleStart.getBlock().getRelative(xIteration, - yIteration, 0); + startBlock = circleStart.getBlock().getRelative( + xIteration, yIteration, 0); zIteration = 0; } yIteration++; xIteration = 0; - startBlock = circleStart.getBlock().getRelative(0, yIteration, 0); + startBlock = circleStart.getBlock().getRelative(0, + yIteration, 0); } } else { - //north - //System.out.println("alchemyCheck north"); + // north + // System.out.println("alchemyCheck north"); while (startBlock.getY() <= circleEnd.getY()) { while (startBlock.getZ() >= circleEnd.getZ()) { while (startBlock.getX() <= circleEnd.getX()) { - if (startBlock.getType() != Material.AIR){ - alchemyFiller(a, b, start.getBlock().getRelative(xIteration * width, yIteration * width, zIteration * width).getLocation(), start.getBlock().getRelative(xIteration * width + width - 1, yIteration * width + width - 1, (zIteration * width - (width - 1))).getLocation(), player); + if (startBlock.getType() != Material.AIR) { + alchemyFiller( + a, + b, + start.getBlock() + .getRelative( + xIteration * width, + yIteration * width, + zIteration * width) + .getLocation(), + start.getBlock() + .getRelative( + xIteration * width + + width - 1, + yIteration * width + + width - 1, + (zIteration * width - (width - 1))) + .getLocation(), player); } xIteration++; - //System.out.println("xloop " + xIteration); + // System.out.println("xloop " + xIteration); startBlock = startBlock.getRelative(1, 0, 0); } zIteration--; - //System.out.println("zloop " + zIteration); + // System.out.println("zloop " + zIteration); startBlock = circleStart.getBlock().getRelative(0, yIteration, zIteration); xIteration = 0; } yIteration++; - //System.out.println("yloop " + yIteration); + // System.out.println("yloop " + yIteration); zIteration = 0; - startBlock = circleStart.getBlock().getRelative(0, yIteration, 0); + startBlock = circleStart.getBlock().getRelative(0, + yIteration, 0); } } } else { if (circleStart.getZ() > circleEnd.getZ()) { - //west - //System.out.println("alchemyCheck west"); + // west + // System.out.println("alchemyCheck west"); while (startBlock.getY() <= circleEnd.getY()) { while (startBlock.getX() >= circleEnd.getX()) { while (startBlock.getZ() >= circleEnd.getZ()) { - if (startBlock.getType() != Material.AIR){ - alchemyFiller(a, b, start.getBlock().getRelative(xIteration * width, yIteration * width, zIteration * width).getLocation(), start.getBlock().getRelative(xIteration * width - (width - 1), yIteration * width + width - 1, (zIteration * width - (width - 1))).getLocation(), player); + if (startBlock.getType() != Material.AIR) { + alchemyFiller( + a, + b, + start.getBlock() + .getRelative( + xIteration * width, + yIteration * width, + zIteration * width) + .getLocation(), + start.getBlock() + .getRelative( + xIteration * width + - (width - 1), + yIteration * width + + width - 1, + (zIteration * width - (width - 1))) + .getLocation(), player); } zIteration--; startBlock = startBlock.getRelative(0, 0, -1); } xIteration--; - startBlock = circleStart.getBlock().getRelative(xIteration, - yIteration, 0); + startBlock = circleStart.getBlock().getRelative( + xIteration, yIteration, 0); zIteration = 0; } yIteration++; xIteration = 0; - startBlock = circleStart.getBlock().getRelative(0, yIteration, 0); + startBlock = circleStart.getBlock().getRelative(0, + yIteration, 0); } } else { - //south - //System.out.println("alchemyCheck south"); + // south + // System.out.println("alchemyCheck south"); while (startBlock.getY() <= circleEnd.getY()) { while (startBlock.getZ() <= circleEnd.getZ()) { while (startBlock.getX() >= circleEnd.getX()) { - if (startBlock.getType() != Material.AIR){ - alchemyFiller(a, b, start.getBlock().getRelative(xIteration * width, yIteration * width, zIteration * width).getLocation(), start.getBlock().getRelative(xIteration * width - (width - 1), yIteration * width + width - 1, (zIteration * width + (width - 1))).getLocation(), player); + if (startBlock.getType() != Material.AIR) { + alchemyFiller( + a, + b, + start.getBlock() + .getRelative( + xIteration * width, + yIteration * width, + zIteration * width) + .getLocation(), + start.getBlock() + .getRelative( + xIteration * width + - (width - 1), + yIteration * width + + width - 1, + (zIteration * width + (width - 1))) + .getLocation(), player); } xIteration--; - //System.out.println("xloop"); + // System.out.println("xloop"); startBlock = startBlock.getRelative(-1, 0, 0); } zIteration++; - //System.out.println("zloop"); + // System.out.println("zloop"); startBlock = circleStart.getBlock().getRelative(0, yIteration, zIteration); xIteration = 0; } yIteration++; - //System.out.println("yloop"); + // System.out.println("yloop"); zIteration = 0; - startBlock = circleStart.getBlock().getRelative(0, yIteration, 0); + startBlock = circleStart.getBlock().getRelative(0, + yIteration, 0); } } } return; } - - public static void alchemyFiller(Material a, Material b, Location start, Location end, Player player) { - //System.out.println("alchemyFiller"); + + public static void alchemyFiller(Material a, Material b, Location start, + Location end, Player player) { + // System.out.println("alchemyFiller"); Block startBlock = start.getBlock(); int xIteration = 0; int yIteration = 0; int zIteration = 0; if (start.getX() < end.getX()) { if (start.getZ() < end.getZ()) { - //east - //System.out.println("alchemyFiller east"); + // east + // System.out.println("alchemyFiller east"); while (startBlock.getY() <= end.getY()) { while (startBlock.getX() <= end.getX()) { while (startBlock.getZ() <= end.getZ()) { @@ -1099,8 +1261,8 @@ public static void alchemyFiller(Material a, Material b, Location start, Locatio startBlock = start.getBlock().getRelative(0, yIteration, 0); } } else { - //north - //System.out.println("alchemyFiller north"); + // north + // System.out.println("alchemyFiller north"); while (startBlock.getY() <= end.getY()) { while (startBlock.getZ() >= end.getZ()) { while (startBlock.getX() <= end.getX()) { @@ -1118,8 +1280,8 @@ public static void alchemyFiller(Material a, Material b, Location start, Locatio } } else { if (start.getZ() > end.getZ()) { - //west - //System.out.println("alchemyFiller west"); + // west + // System.out.println("alchemyFiller west"); while (startBlock.getY() <= end.getY()) { while (startBlock.getX() >= end.getX()) { while (startBlock.getZ() >= end.getZ()) { @@ -1135,22 +1297,22 @@ public static void alchemyFiller(Material a, Material b, Location start, Locatio startBlock = start.getBlock().getRelative(0, yIteration, 0); } } else { - //south - //System.out.println("alchemyFiller south"); + // south + // System.out.println("alchemyFiller south"); while (startBlock.getY() <= end.getY()) { while (startBlock.getZ() <= end.getZ()) { while (startBlock.getX() >= end.getX()) { transmuteBlock(a, b, startBlock, player); startBlock = startBlock.getRelative(-1, 0, 0); - //System.out.println("xloopfiller"); + // System.out.println("xloopfiller"); } zIteration++; - //System.out.println("zloopfiller"); + // System.out.println("zloopfiller"); startBlock = start.getBlock().getRelative(0, yIteration, zIteration); } yIteration++; - //System.out.println("yloopfiller"); + // System.out.println("yloopfiller"); zIteration = 0; startBlock = start.getBlock().getRelative(0, yIteration, 0); } @@ -1159,46 +1321,75 @@ public static void alchemyFiller(Material a, Material b, Location start, Locatio return; } - public static void transmuteBlock(Material a, Material b, Block startBlock, Player player) { + public static void transmuteBlock(Material a, Material b, Block startBlock, + Player player) { BlockState startBlockState = startBlock.getState(); if (startBlock.getType() == a) { int exp = calculateEXP(a, b); - if (-1 * player.getLevel() < (exp * philosopherStoneModifier(player))) { - - //Create fake block break event for compatibility with logging plugins - if (a != Material.AIR && b == Material.AIR && a != Material.CHEST && a != Material.WALL_SIGN && a!= Material.SIGN_POST && a != Material.FURNACE && a != Material.BURNING_FURNACE && a != Material.BREWING_STAND && a != Material.WOODEN_DOOR && a != Material.IRON_DOOR_BLOCK){ - BlockBreakEvent break_event = new BlockBreakEvent(startBlock, player); - Bukkit.getServer().getPluginManager().callEvent(break_event); - + if (-1 * player.getLevel() < (exp * philosopherStoneModifier(player))) { + + // Create fake block break event for compatibility with logging + // plugins + if (a != Material.AIR && b == Material.AIR + && a != Material.CHEST && a != Material.WALL_SIGN + && a != Material.SIGN_POST && a != Material.FURNACE + && a != Material.BURNING_FURNACE + && a != Material.BREWING_STAND + && a != Material.WOODEN_DOOR + && a != Material.IRON_DOOR_BLOCK) { + BlockBreakEvent break_event = new BlockBreakEvent( + startBlock, player); + Bukkit.getServer().getPluginManager() + .callEvent(break_event); + startBlock.setType(b); player.setLevel((int) (player.getLevel() + (exp * philosopherStoneModifier(player)))); } - - //Create fake block place event for compatibility with logging plugins - else if (a == Material.AIR && b != Material.AIR){ + + // Create fake block place event for compatibility with logging + // plugins + else if (a == Material.AIR && b != Material.AIR) { startBlock.setType(b); player.setLevel((int) (player.getLevel() + (exp * philosopherStoneModifier(player)))); - - BlockPlaceEvent place_event = new BlockPlaceEvent(startBlock, startBlockState, startBlock, new ItemStack(b.getId()), player, true); - Bukkit.getServer().getPluginManager().callEvent(place_event); + + BlockPlaceEvent place_event = new BlockPlaceEvent( + startBlock, startBlockState, startBlock, + new ItemStack(b.getId()), player, true); + Bukkit.getServer().getPluginManager() + .callEvent(place_event); } - - //Create fake block break and place events for compatibility with logging plugins - else if (a != Material.AIR && b != Material.AIR && a != Material.CHEST && a != Material.WALL_SIGN && a!= Material.SIGN_POST && a != Material.FURNACE && a != Material.BURNING_FURNACE && a != Material.BREWING_STAND && a != Material.WOODEN_DOOR && a != Material.IRON_DOOR_BLOCK){ - BlockBreakEvent break_event = new BlockBreakEvent(startBlock, player); - Bukkit.getServer().getPluginManager().callEvent(break_event); - + + // Create fake block break and place events for compatibility + // with logging plugins + else if (a != Material.AIR && b != Material.AIR + && a != Material.CHEST && a != Material.WALL_SIGN + && a != Material.SIGN_POST && a != Material.FURNACE + && a != Material.BURNING_FURNACE + && a != Material.BREWING_STAND + && a != Material.WOODEN_DOOR + && a != Material.IRON_DOOR_BLOCK) { + BlockBreakEvent break_event = new BlockBreakEvent( + startBlock, player); + Bukkit.getServer().getPluginManager() + .callEvent(break_event); + startBlock.setType(b); player.setLevel((int) (player.getLevel() + (exp * philosopherStoneModifier(player)))); - - BlockPlaceEvent place_event = new BlockPlaceEvent(startBlock, startBlockState, startBlock, new ItemStack(b.getId()), player, true); - Bukkit.getServer().getPluginManager().callEvent(place_event); + + BlockPlaceEvent place_event = new BlockPlaceEvent( + startBlock, startBlockState, startBlock, + new ItemStack(b.getId()), player, true); + Bukkit.getServer().getPluginManager() + .callEvent(place_event); } - //System.out.println("transmuted block"); - //System.out.println(startBlock.getX() + " " + startBlock.getY() + " " + startBlock.getZ()); + // System.out.println("transmuted block"); + // System.out.println(startBlock.getX() + " " + + // startBlock.getY() + " " + startBlock.getZ()); else if (a != Material.AIR && b != Material.AIR) { - System.out.println("[GeometricMagic] " + player.getName() + " tried to transmute a blacklisted material:"); - System.out.println("[GeometricMagic] " + a.name() + " into " + b.name()); + System.out.println("[GeometricMagic] " + player.getName() + + " tried to transmute a blacklisted material:"); + System.out.println("[GeometricMagic] " + a.name() + + " into " + b.name()); } return; } else @@ -1337,9 +1528,9 @@ public static int calculateEXP(Material a, Material b) { int valueDifference = valueArray[a.getId()] - valueArray[b.getId()]; return valueDifference; } - - public static int[] getValueArray (int[] valueArray){ - //int[] valueArray = new int[2266]; + + public static int[] getValueArray(int[] valueArray) { + // int[] valueArray = new int[2266]; // array index is block id, value in array is xp Arrays.fill(valueArray, 0); valueArray[0] = 0; @@ -1467,27 +1658,27 @@ public static int[] getValueArray (int[] valueArray){ valueArray[122] = 0; return valueArray; } - - public static double philosopherStoneModifier (Player player){ + + public static double philosopherStoneModifier(Player player) { double modifier = 1; int stackCount = 0; PlayerInventory inventory = player.getInventory(); - for (int i = 0; i < inventory.getSize(); i++ ){ - if (inventory.getItem(i) != null && inventory.getItem(i).getType() == Material.PORTAL) + for (int i = 0; i < inventory.getSize(); i++) { + if (inventory.getItem(i) != null + && inventory.getItem(i).getType() == Material.PORTAL) stackCount += inventory.getItem(i).getAmount(); } - modifier = 1/(Math.pow(2, stackCount)); + modifier = 1 / (Math.pow(2, stackCount)); return modifier; } - - public static boolean checkSacrifices (Player player) throws IOException{ + + public static boolean checkSacrifices(Player player) throws IOException { File myFile = new File("plugins/GeometricMagic/sacrifices.txt"); - if (!myFile.exists()) - { - return false; + if (!myFile.exists()) { + return false; } Scanner inputFile = new Scanner(myFile); - while (inputFile.hasNextLine()){ + while (inputFile.hasNextLine()) { String name = inputFile.nextLine(); if (name.equals(player.getName())) return true; @@ -1495,21 +1686,21 @@ public static boolean checkSacrifices (Player player) throws IOException{ } inputFile.close(); return false; - //playername - //[1, 1, 1, 2] + // playername + // [1, 1, 1, 2] } - - public static void humanTransmutation (Player player) throws IOException{ + + public static void humanTransmutation(Player player) throws IOException { if (new File("plugins/GeometricMagic/").mkdirs()) System.out.println("sacrifices file created"); File myFile = new File("plugins/GeometricMagic/sacrifices.txt"); - if (myFile.exists()) - { + if (myFile.exists()) { Scanner inputFile = new Scanner(myFile); - while (inputFile.hasNextLine()){ + while (inputFile.hasNextLine()) { String name = inputFile.nextLine(); - if (name.equals(player.getDisplayName())){ - FileWriter dWriter = new FileWriter("plugins/GeometricMagic/sacrificed.txt", true); + if (name.equals(player.getDisplayName())) { + FileWriter dWriter = new FileWriter( + "plugins/GeometricMagic/sacrificed.txt", true); PrintWriter dFile = new PrintWriter(dWriter); dFile.println(player.getDisplayName()); dFile.close(); @@ -1517,45 +1708,46 @@ public static void humanTransmutation (Player player) throws IOException{ } } inputFile.close(); - } - else{ - PrintWriter outputFile = new PrintWriter("plugins/GeometricMagic/sacrifices.txt"); + } else { + PrintWriter outputFile = new PrintWriter( + "plugins/GeometricMagic/sacrifices.txt"); System.out.println("sacrifices file created"); outputFile.close(); } - FileWriter fWriter = new FileWriter("plugins/GeometricMagic/sacrifices.txt", true); + FileWriter fWriter = new FileWriter( + "plugins/GeometricMagic/sacrifices.txt", true); PrintWriter outputFile = new PrintWriter(fWriter); outputFile.println(player.getDisplayName()); outputFile.println(0); player.sendMessage("You have committed the taboo! Crafting is your sacrifice, knowledge your reward."); outputFile.close(); } - - public static boolean checkSacrificed (Player player) throws IOException{ + + public static boolean checkSacrificed(Player player) throws IOException { File myFile = new File("plugins/GeometricMagic/sacrificed.txt"); - if (!myFile.exists()) - { - return false; + if (!myFile.exists()) { + return false; } Scanner inputFile = new Scanner(myFile); - while (inputFile.hasNextLine()){ + while (inputFile.hasNextLine()) { String name = inputFile.nextLine(); if (name.equals(player.getName())) return true; } inputFile.close(); return false; - //playername + // playername } - - public static boolean hasLearnedCircle (Player player, String circle) throws IOException{ - File myFile = new File("plugins/GeometricMagic/" + player.getName() + ".txt"); - if (!myFile.exists()) - { - return false; + + public static boolean hasLearnedCircle(Player player, String circle) + throws IOException { + File myFile = new File("plugins/GeometricMagic/" + player.getName() + + ".txt"); + if (!myFile.exists()) { + return false; } Scanner inputFile = new Scanner(myFile); - while (inputFile.hasNextLine()){ + while (inputFile.hasNextLine()) { String name = inputFile.nextLine(); if (name.equals(circle)) return true; @@ -1563,33 +1755,38 @@ public static boolean hasLearnedCircle (Player player, String circle) throws IOE inputFile.close(); return false; } - - public static boolean learnCircle (Player player, String circle, Block actBlock) throws IOException{ + + public static boolean learnCircle(Player player, String circle, + Block actBlock) throws IOException { boolean status = false; - //System.out.println("learnCircle"); + // System.out.println("learnCircle"); ItemStack oneRedstone = new ItemStack(331, 1); - Item redStack = actBlock.getWorld().dropItem(actBlock.getLocation(), oneRedstone); + Item redStack = actBlock.getWorld().dropItem(actBlock.getLocation(), + oneRedstone); List entityList = redStack.getNearbyEntities(2, 10, 2); - for (int i = 0; i < entityList.size(); i++){ - if (entityList.get(i) instanceof Enderman){ - if (new File("plugins/GeometricMagic/").mkdirs()) - System.out.println("file created for " + player.getName()); - File myFile = new File("plugins/GeometricMagic/" + player.getName() + ".txt"); - if (myFile.exists()) - { - FileWriter fWriter = new FileWriter("plugins/GeometricMagic/" + player.getName() + ".txt", true); - PrintWriter outputFile = new PrintWriter(fWriter); - outputFile.println(circle); - outputFile.close(); - } - else{ - PrintWriter outputFile = new PrintWriter("plugins/GeometricMagic/" + player.getName() + ".txt"); - outputFile.println(circle); - outputFile.close(); - } - status = true; + for (int i = 0; i < entityList.size(); i++) { + if (entityList.get(i) instanceof Enderman) { + if (new File("plugins/GeometricMagic/").mkdirs()) + System.out.println("file created for " + player.getName()); + File myFile = new File("plugins/GeometricMagic/" + + player.getName() + ".txt"); + if (myFile.exists()) { + FileWriter fWriter = new FileWriter( + "plugins/GeometricMagic/" + player.getName() + + ".txt", true); + PrintWriter outputFile = new PrintWriter(fWriter); + outputFile.println(circle); + outputFile.close(); + } else { + PrintWriter outputFile = new PrintWriter( + "plugins/GeometricMagic/" + player.getName() + + ".txt"); + outputFile.println(circle); + outputFile.close(); } + status = true; } + } redStack.remove(); return status; } From 45f6571cd4abb2f6eca1778b4c0fbd90c91be504 Mon Sep 17 00:00:00 2001 From: ty2u Date: Fri, 8 Jun 2012 11:55:12 -0400 Subject: [PATCH 021/133] Remove giving items on death when level is high --- .../GeometricMagic/GeometricMagic.java | 3 -- .../GeometricMagicPlayerDeathListener.java | 45 ------------------- 2 files changed, 48 deletions(-) delete mode 100644 src/me/cakenggt/GeometricMagic/GeometricMagicPlayerDeathListener.java diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagic.java b/src/me/cakenggt/GeometricMagic/GeometricMagic.java index aea35e0..a159a36 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagic.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagic.java @@ -17,7 +17,6 @@ public class GeometricMagic extends JavaPlugin { public static GeometricMagic plugin; private Listener playerListener; private Listener entityListener; - private Listener deathListener; public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { @@ -125,10 +124,8 @@ public void onDisable() { public void onEnable() { playerListener = new GeometricMagicPlayerListener(); entityListener = new GeometricMagicDamageListener(); - deathListener = new GeometricMagicPlayerDeathListener(); getServer().getPluginManager().registerEvents(playerListener, this); getServer().getPluginManager().registerEvents(entityListener, this); - getServer().getPluginManager().registerEvents(deathListener, this); ShapelessRecipe portalRecipe = new ShapelessRecipe(new ItemStack( Material.FIRE, 64)).addIngredient(Material.PORTAL); getServer().addRecipe(portalRecipe); diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerDeathListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerDeathListener.java deleted file mode 100644 index 14027f4..0000000 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerDeathListener.java +++ /dev/null @@ -1,45 +0,0 @@ -package me.cakenggt.GeometricMagic; - -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityDeathEvent; -//import org.bukkit.event.player.PlayerListener; -import org.bukkit.inventory.ItemStack; - -public class GeometricMagicPlayerDeathListener implements Listener { - @EventHandler(priority = EventPriority.HIGHEST) - public void onPlayerDeath(EntityDeathEvent event) { - if (event.getEntity() instanceof Player) { - Player player = (Player) event.getEntity(); - int level = player.getLevel(); - while (level > 5) { - if (level > 13824) { - ItemStack oneDiamondBlock = new ItemStack( - Material.DIAMOND_BLOCK, 1); - player.getWorld().dropItem(player.getLocation(), - oneDiamondBlock); - level -= 13824; - } else if (level > 1568) { - ItemStack one84 = new ItemStack(84, 1); - player.getWorld().dropItem(player.getLocation(), one84); - level -= 1568; - } else if (level > 153) { - ItemStack one29 = new ItemStack(29, 1); - player.getWorld().dropItem(player.getLocation(), one29); - level -= 153; - } else if (level > 12) { - ItemStack one70 = new ItemStack(70, 1); - player.getWorld().dropItem(player.getLocation(), one70); - level -= 12; - } else if (level > 1) { - ItemStack one2 = new ItemStack(2, 1); - player.getWorld().dropItem(player.getLocation(), one2); - level -= 1; - } - } - } - } -} \ No newline at end of file From 174b0d36dadc93f925a60c7bbff4c4ca0437ded5 Mon Sep 17 00:00:00 2001 From: ty2u Date: Fri, 8 Jun 2012 12:11:04 -0400 Subject: [PATCH 022/133] Vault support --- .../GeometricMagic/GeometricMagic.java | 28 +++++++ .../GeometricMagicPlayerListener.java | 77 ++++++++++++++++--- 2 files changed, 93 insertions(+), 12 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagic.java b/src/me/cakenggt/GeometricMagic/GeometricMagic.java index a159a36..baae2ee 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagic.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagic.java @@ -5,18 +5,22 @@ import java.io.PrintWriter; import java.util.Scanner; +import net.milkbowl.vault.economy.Economy; + import org.bukkit.Material; import org.bukkit.command.*; import org.bukkit.entity.Player; import org.bukkit.event.Listener; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ShapelessRecipe; +import org.bukkit.plugin.RegisteredServiceProvider; import org.bukkit.plugin.java.JavaPlugin; public class GeometricMagic extends JavaPlugin { public static GeometricMagic plugin; private Listener playerListener; private Listener entityListener; + private static Economy economy; public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { @@ -122,6 +126,13 @@ public void onDisable() { } public void onEnable() { + + // Vault Support + if (!setupEconomy()) { + System.out + .println("Economy system not found! GeometricMagic uses Vault to plug into economy systems."); + } + playerListener = new GeometricMagicPlayerListener(); entityListener = new GeometricMagicDamageListener(); getServer().getPluginManager().registerEvents(playerListener, this); @@ -132,4 +143,21 @@ public void onEnable() { System.out.println(this + " is now enabled!"); } + // Vault Support + private boolean setupEconomy() { + RegisteredServiceProvider economyProvider = getServer() + .getServicesManager().getRegistration( + net.milkbowl.vault.economy.Economy.class); + if (economyProvider != null) { + economy = economyProvider.getProvider(); + } + + return (economy != null); + } + + // Vault Support + public static Economy getEconomy() { + return economy; + } + } \ No newline at end of file diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index c8b82ed..48444de 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -5,6 +5,8 @@ import java.util.List; import java.util.Scanner; +import net.milkbowl.vault.economy.Economy; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; @@ -24,6 +26,8 @@ import org.bukkit.inventory.PlayerInventory; public class GeometricMagicPlayerListener implements Listener { + public static Economy economy = null; + @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerInteract(PlayerInteractEvent event) { // System.out.println("is playerinteractevent"); @@ -270,8 +274,10 @@ public static void teleportationCircle(Player player, World world, } public static void microCircle(Player player, World world, Block actBlock) { - // have it print to console what level is - player.sendMessage("Your experience level is " + player.getLevel()); + Economy econ = GeometricMagic.getEconomy(); + + player.sendMessage("You have " + econ.format(getBalance(player))); + List entitiesList = player.getNearbyEntities(100, 10, 100); for (int i = 0; i < entitiesList.size(); i++) { if (entitiesList.get(i) instanceof Arrow) { @@ -611,13 +617,25 @@ public static void setCircleEffects(Player player, World world, for (int i = 0; i < entityList.size(); i++) { if (entityList.get(i) instanceof Item) { Item droppedItem = (Item) entityList.get(i); - calculateEXP(Material.AIR, Material.AIR); + calculatePay(Material.AIR, Material.AIR); int[] valueArray = new int[2266]; getValueArray(valueArray); - player.setLevel((valueArray[droppedItem.getItemStack() + + int pay = (valueArray[droppedItem.getItemStack() .getTypeId()] * droppedItem.getItemStack() - .getAmount()) - + player.getLevel()); + .getAmount()); + + Economy econ = GeometricMagic.getEconomy(); + if (pay > 0) { + econ.depositPlayer(player.getName(), pay); + } else if (pay < 0) { + econ.withdrawPlayer(player.getName(), pay * -1); + } + /* + * player.setLevel((valueArray[droppedItem.getItemStack() + * .getTypeId()] * droppedItem.getItemStack() + * .getAmount()) + player.getLevel()); + */ droppedItem.remove(); } } @@ -1321,12 +1339,29 @@ public static void alchemyFiller(Material a, Material b, Location start, return; } + public static double getBalance(Player player) { + + Economy econ = GeometricMagic.getEconomy(); + + double balance = econ.getBalance(player.getName()); + + return balance; + } + public static void transmuteBlock(Material a, Material b, Block startBlock, Player player) { + + Economy econ = GeometricMagic.getEconomy(); + + double balance = getBalance(player); + + int pay = calculatePay(a, b); + pay = (int) (pay * philosopherStoneModifier(player)); + BlockState startBlockState = startBlock.getState(); if (startBlock.getType() == a) { - int exp = calculateEXP(a, b); - if (-1 * player.getLevel() < (exp * philosopherStoneModifier(player))) { + + if (-1 * balance < pay) { // Create fake block break event for compatibility with logging // plugins @@ -1343,14 +1378,26 @@ public static void transmuteBlock(Material a, Material b, Block startBlock, .callEvent(break_event); startBlock.setType(b); - player.setLevel((int) (player.getLevel() + (exp * philosopherStoneModifier(player)))); + + // deposit or withdraw to players Vault account + if (pay > 0) { + econ.depositPlayer(player.getName(), pay); + } else if (pay < 0) { + econ.withdrawPlayer(player.getName(), pay * -1); + } } // Create fake block place event for compatibility with logging // plugins else if (a == Material.AIR && b != Material.AIR) { startBlock.setType(b); - player.setLevel((int) (player.getLevel() + (exp * philosopherStoneModifier(player)))); + + // deposit or withdraw to players Vault account + if (pay > 0) { + econ.depositPlayer(player.getName(), pay); + } else if (pay < 0) { + econ.withdrawPlayer(player.getName(), pay * -1); + } BlockPlaceEvent place_event = new BlockPlaceEvent( startBlock, startBlockState, startBlock, @@ -1374,7 +1421,13 @@ else if (a != Material.AIR && b != Material.AIR .callEvent(break_event); startBlock.setType(b); - player.setLevel((int) (player.getLevel() + (exp * philosopherStoneModifier(player)))); + + // deposit or withdraw to players Vault account + if (pay > 0) { + econ.depositPlayer(player.getName(), pay); + } else if (pay < 0) { + econ.withdrawPlayer(player.getName(), pay * -1); + } BlockPlaceEvent place_event = new BlockPlaceEvent( startBlock, startBlockState, startBlock, @@ -1398,7 +1451,7 @@ else if (a != Material.AIR && b != Material.AIR) { return; } - public static int calculateEXP(Material a, Material b) { + public static int calculatePay(Material a, Material b) { int[] valueArray = new int[2266]; // array index is block id, value in array is xp Arrays.fill(valueArray, 0); From c6e8651e5c2c7f7a59d1f0216c0a310752f014a1 Mon Sep 17 00:00:00 2001 From: ty2u Date: Fri, 8 Jun 2012 12:22:22 -0400 Subject: [PATCH 023/133] Transmutation circle permissions --- plugin.yml | 28 ++++++++++++-- .../GeometricMagicPlayerListener.java | 38 ++++++++++++++++--- 2 files changed, 58 insertions(+), 8 deletions(-) diff --git a/plugin.yml b/plugin.yml index bf77ec7..1af0f52 100644 --- a/plugin.yml +++ b/plugin.yml @@ -2,6 +2,7 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic version: 2.20 author: cakenggt +depend: [Vault] permissions: GeometricMagic.circle.*: description: Gives access to all circles @@ -16,9 +17,30 @@ permissions: circle.micro: description: Allows you to use micro circles default: true - circle.transmutation: - description: Allows you to use transmutation circles - default: true + circle.transmutation.*: + description: Allows you to use all transmutation circles + default: false + children: + circle.transmutation.1: true + circle.transmutation.3: false + circle.transmutation.4: false + circle.transmutation.7: false + circle.transmutation.9: false + circle.transmutation.1: + description: Allows you to use transmutation circle 1 + default: true + circle.transmutation.3: + description: Allows you to use transmutation circle 3 + default: false + circle.transmutation.5: + description: Allows you to use transmutation circle 5 + default: false + circle.transmutation.7: + description: Allows you to use transmutation circle 7 + default: false + circle.transmutation.9: + description: Allows you to use transmutation circle 9 + default: false circle.set: description: Allows you to use set circles default: true diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 48444de..ccfa02d 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -136,11 +136,33 @@ public static void circleChooser(Player player, World world, Block actBlock) { && southBlock.getType() != Material.REDSTONE_WIRE && eastBlock.getType() == Material.REDSTONE_WIRE && westBlock .getType() == Material.REDSTONE_WIRE)) { - if (player.hasPermission("circle.transmutation")) { - // System.out.println("transmutation"); - transmutationCircle(player, world, actBlock); - } else + + // transmutation circle size permissions + // - allows use of all circles smaller than then the max + // size permission node they have + int circleSize = 1; + if (player.hasPermission("circle.transmutation.*") + || player.hasPermission("circle.transmutation.9")) { + circleSize = 9; + } else if (player.hasPermission("circle.transmutation.7")) { + circleSize = 7; + } else if (player.hasPermission("circle.transmutation.5")) { + circleSize = 5; + } else if (player.hasPermission("circle.transmutation.3")) { + circleSize = 3; + } else if (player.hasPermission("circle.transmutation.1")) { + circleSize = 1; + } else { + circleSize = 0; player.sendMessage("You do not have permission to use this circle"); + } + + //System.out.println("circleSize:" + circleSize); + + if (circleSize > 0) { + transmutationCircle(player, world, actBlock, circleSize); + } + } else if (northBlock.getType() != Material.REDSTONE_WIRE && southBlock.getType() != Material.REDSTONE_WIRE && eastBlock.getType() != Material.REDSTONE_WIRE @@ -292,7 +314,7 @@ public static void microCircle(Player player, World world, Block actBlock) { } public static void transmutationCircle(Player player, World world, - Block actBlock) { + Block actBlock, int circleSize) { int halfWidth = 0; int fullWidth = 0; Location startLoc = actBlock.getLocation(); @@ -305,6 +327,9 @@ public static void transmutationCircle(Player player, World world, && actBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE) { halfWidth = 0; while (actBlock.getRelative(0, 0, -1 * halfWidth).getType() == Material.REDSTONE_WIRE) { + if (halfWidth > circleSize) { + break; + } halfWidth++; } fullWidth = (halfWidth * 2) - 1; @@ -353,6 +378,9 @@ public static void transmutationCircle(Player player, World world, && actBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE) { halfWidth = 0; while (actBlock.getRelative(halfWidth, 0, 0).getType() == Material.REDSTONE_WIRE) { + if (halfWidth > circleSize) { + break; + } halfWidth++; } fullWidth = (halfWidth * 2) - 1; From 49e537ba8699adbbeed71cb6d00d8f43fc161652 Mon Sep 17 00:00:00 2001 From: ty2u Date: Fri, 8 Jun 2012 12:32:21 -0400 Subject: [PATCH 024/133] Added support for different block subtypes --- .../GeometricMagicPlayerListener.java | 85 ++++++++++++------- 1 file changed, 55 insertions(+), 30 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index ccfa02d..a2669aa 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -339,29 +339,37 @@ public static void transmutationCircle(Player player, World world, fromType = actBlock.getLocation() .add(halfWidth - 1, 0, -1 * (halfWidth + 1)).getBlock() .getType(); - toType = actBlock.getLocation() - .add(halfWidth - 1, 0, halfWidth + 1).getBlock() - .getType(); + Block toBlock = actBlock.getLocation() + .add(halfWidth - 1, 0, halfWidth + 1).getBlock(); + toType = toBlock.getType(); + byte toData = toBlock.getData(); startLoc = actBlock.getLocation().add(fullWidth, 0, - -1 * dimensionOfEffect / 2 + 1); + -1 * dimensionOfEffect / 2); + // System.out.println(startLoc); endLoc = actBlock.getLocation().add( fullWidth + dimensionOfEffect - 1, dimensionOfEffect - 1, dimensionOfEffect / 2 - 1); + // System.out.println(endLoc); circleStart = actBlock.getLocation().add(1, 0, -1 * (halfWidth - 2)); + // System.out.println(circleStart); circleEnd = actBlock.getLocation().add(fullWidth - 2, fullWidth - 3, halfWidth - 2); - alchemyCheck(fromType, toType, circleStart, circleEnd, + // System.out.println(circleEnd); + alchemyCheck(fromType, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); } else if (actBlock.getRelative(-1 * (fullWidth - 1), 0, 0) .getType() == Material.REDSTONE_WIRE) { // west + // System.out.println("transmutationCircle west"); fromType = actBlock.getLocation() .add(-1 * (halfWidth - 1), 0, halfWidth + 1).getBlock() .getType(); - toType = actBlock.getLocation() + Block toBlock = actBlock.getLocation() .add((-1) * (halfWidth - 1), 0, (-1) * (halfWidth + 1)) - .getBlock().getType(); + .getBlock(); + toType = toBlock.getType(); + byte toData = toBlock.getData(); startLoc = actBlock.getLocation().add(-1 * fullWidth, 0, dimensionOfEffect / 2); endLoc = actBlock.getLocation().add( @@ -371,7 +379,7 @@ public static void transmutationCircle(Player player, World world, .add(-1, 0, (halfWidth - 2)); circleEnd = actBlock.getLocation().add(-1 * (fullWidth - 2), fullWidth - 3, -1 * (halfWidth - 2)); - alchemyCheck(fromType, toType, circleStart, circleEnd, + alchemyCheck(fromType, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); } } else if (actBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE @@ -384,8 +392,8 @@ public static void transmutationCircle(Player player, World world, halfWidth++; } fullWidth = (halfWidth * 2) - 1; - // System.out.println("half is " + halfWidth + " full is " + - // fullWidth); + //System.out + // .println("half is " + halfWidth + " full is " + fullWidth); int dimensionOfEffect = (fullWidth - 2) * (fullWidth - 2); if (actBlock.getRelative(0, 0, -1 * (fullWidth - 1)).getType() == Material.REDSTONE_WIRE) { // north @@ -393,9 +401,10 @@ public static void transmutationCircle(Player player, World world, fromType = actBlock.getLocation() .add(-1 * (halfWidth + 1), 0, -1 * (halfWidth - 1)) .getBlock().getType(); - toType = actBlock.getLocation() - .add(halfWidth + 1, 0, -1 * (halfWidth - 1)).getBlock() - .getType(); + Block toBlock = actBlock.getLocation() + .add(halfWidth + 1, 0, -1 * (halfWidth - 1)).getBlock(); + toType = toBlock.getType(); + byte toData = toBlock.getData(); startLoc = actBlock.getLocation().add( -1 * dimensionOfEffect / 2, 0, -1 * fullWidth); endLoc = actBlock.getLocation().add(dimensionOfEffect / 2 - 1, @@ -405,7 +414,7 @@ public static void transmutationCircle(Player player, World world, 0, -1); circleEnd = actBlock.getLocation().add((halfWidth - 2), fullWidth - 3, -1 * (fullWidth - 2)); - alchemyCheck(fromType, toType, circleStart, circleEnd, + alchemyCheck(fromType, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); } else if (actBlock.getRelative(0, 0, (fullWidth - 1)).getType() == Material.REDSTONE_WIRE) { // south @@ -413,9 +422,10 @@ public static void transmutationCircle(Player player, World world, fromType = actBlock.getLocation() .add(halfWidth + 1, 0, halfWidth - 1).getBlock() .getType(); - toType = actBlock.getLocation() - .add(-1 * (halfWidth + 1), 0, halfWidth - 1).getBlock() - .getType(); + Block toBlock = actBlock.getLocation() + .add(-1 * (halfWidth + 1), 0, halfWidth - 1).getBlock(); + toType = toBlock.getType(); + byte toData = toBlock.getData(); startLoc = actBlock.getLocation().add(dimensionOfEffect / 2, 0, fullWidth); endLoc = actBlock.getLocation().add( @@ -424,7 +434,7 @@ public static void transmutationCircle(Player player, World world, circleStart = actBlock.getLocation().add(halfWidth - 2, 0, 1); circleEnd = actBlock.getLocation().add(-1 * (halfWidth - 2), fullWidth - 3, (fullWidth - 2)); - alchemyCheck(fromType, toType, circleStart, circleEnd, + alchemyCheck(fromType, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); } } @@ -888,9 +898,10 @@ public static void setCircleEffects(Player player, World world, return; } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - alchemyFiller(Material.AIR, Material.FIRE, effectBlock - .getRelative(-10, 0, -10).getLocation(), effectBlock - .getRelative(10, 20, 10).getLocation(), player); + alchemyFiller(Material.AIR, Material.FIRE, (byte) 0, + effectBlock.getRelative(-10, 0, -10).getLocation(), + effectBlock.getRelative(10, 20, 10).getLocation(), + player); } else return; } else if (arrayString.equals("[3, 3, 4, 4]") @@ -1108,7 +1119,7 @@ public static int setCircleSize(Block actBlock) { return size; } - public static void alchemyCheck(Material a, Material b, + public static void alchemyCheck(Material a, Material b, byte toData, Location circleStart, Location circleEnd, Location start, Location end, Player player, int width) { Block startBlock = circleStart.getBlock(); @@ -1126,6 +1137,7 @@ public static void alchemyCheck(Material a, Material b, alchemyFiller( a, b, + toData, start.getBlock() .getRelative( xIteration * width, @@ -1164,6 +1176,7 @@ public static void alchemyCheck(Material a, Material b, alchemyFiller( a, b, + toData, start.getBlock() .getRelative( xIteration * width, @@ -1207,6 +1220,7 @@ public static void alchemyCheck(Material a, Material b, alchemyFiller( a, b, + toData, start.getBlock() .getRelative( xIteration * width, @@ -1245,6 +1259,7 @@ public static void alchemyCheck(Material a, Material b, alchemyFiller( a, b, + toData, start.getBlock() .getRelative( xIteration * width, @@ -1281,8 +1296,8 @@ public static void alchemyCheck(Material a, Material b, return; } - public static void alchemyFiller(Material a, Material b, Location start, - Location end, Player player) { + public static void alchemyFiller(Material a, Material b, byte toData, + Location start, Location end, Player player) { // System.out.println("alchemyFiller"); Block startBlock = start.getBlock(); int xIteration = 0; @@ -1295,7 +1310,7 @@ public static void alchemyFiller(Material a, Material b, Location start, while (startBlock.getY() <= end.getY()) { while (startBlock.getX() <= end.getX()) { while (startBlock.getZ() <= end.getZ()) { - transmuteBlock(a, b, startBlock, player); + transmuteBlock(a, b, toData, startBlock, player); startBlock = startBlock.getRelative(0, 0, 1); } xIteration++; @@ -1312,7 +1327,7 @@ public static void alchemyFiller(Material a, Material b, Location start, while (startBlock.getY() <= end.getY()) { while (startBlock.getZ() >= end.getZ()) { while (startBlock.getX() <= end.getX()) { - transmuteBlock(a, b, startBlock, player); + transmuteBlock(a, b, toData, startBlock, player); startBlock = startBlock.getRelative(1, 0, 0); } zIteration--; @@ -1331,7 +1346,7 @@ public static void alchemyFiller(Material a, Material b, Location start, while (startBlock.getY() <= end.getY()) { while (startBlock.getX() >= end.getX()) { while (startBlock.getZ() >= end.getZ()) { - transmuteBlock(a, b, startBlock, player); + transmuteBlock(a, b, toData, startBlock, player); startBlock = startBlock.getRelative(0, 0, -1); } xIteration--; @@ -1348,7 +1363,7 @@ public static void alchemyFiller(Material a, Material b, Location start, while (startBlock.getY() <= end.getY()) { while (startBlock.getZ() <= end.getZ()) { while (startBlock.getX() >= end.getX()) { - transmuteBlock(a, b, startBlock, player); + transmuteBlock(a, b, toData, startBlock, player); startBlock = startBlock.getRelative(-1, 0, 0); // System.out.println("xloopfiller"); } @@ -1376,8 +1391,8 @@ public static double getBalance(Player player) { return balance; } - public static void transmuteBlock(Material a, Material b, Block startBlock, - Player player) { + public static void transmuteBlock(Material a, Material b, byte toData, + Block startBlock, Player player) { Economy econ = GeometricMagic.getEconomy(); @@ -1405,7 +1420,10 @@ public static void transmuteBlock(Material a, Material b, Block startBlock, Bukkit.getServer().getPluginManager() .callEvent(break_event); + // change block startBlock.setType(b); + if (toData != 0) + startBlock.setData(toData); // deposit or withdraw to players Vault account if (pay > 0) { @@ -1418,7 +1436,11 @@ public static void transmuteBlock(Material a, Material b, Block startBlock, // Create fake block place event for compatibility with logging // plugins else if (a == Material.AIR && b != Material.AIR) { + + // change block startBlock.setType(b); + if (toData != 0) + startBlock.setData(toData); // deposit or withdraw to players Vault account if (pay > 0) { @@ -1448,7 +1470,10 @@ else if (a != Material.AIR && b != Material.AIR Bukkit.getServer().getPluginManager() .callEvent(break_event); + // change block startBlock.setType(b); + if (toData != 0) + startBlock.setData(toData); // deposit or withdraw to players Vault account if (pay > 0) { From feeac9d70868af46d87304946ee61226e38005a4 Mon Sep 17 00:00:00 2001 From: ty2u Date: Fri, 8 Jun 2012 13:01:41 -0400 Subject: [PATCH 025/133] Fixed teleportation circles not working in some directions when using fine tuning on first block --- .../GeometricMagicPlayerListener.java | 112 ++++++++++++++++-- 1 file changed, 99 insertions(+), 13 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index a2669aa..36780f8 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -182,116 +182,202 @@ public static void circleChooser(Player player, World world, Block actBlock) { public static void teleportationCircle(Player player, World world, Block actBlock) { + + // activation block in center Location actPoint = actBlock.getLocation(); + + // init some variables int na = 0, nb = 0, ea = 0, eb = 0, sa = 0, sb = 0, wa = 0, wb = 0, nc = 0, ec = 0, sc = 0, wc = 0; + + // set core blocks to air actBlock.setType(Material.AIR); actBlock.getRelative(1, 0, 0).setType(Material.AIR); actBlock.getRelative(-1, 0, 0).setType(Material.AIR); actBlock.getRelative(0, 0, 1).setType(Material.AIR); actBlock.getRelative(0, 0, -1).setType(Material.AIR); + + // count and track all redstone blocks Block curBlock = actBlock.getRelative(0, 0, -1); while (curBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE) { na++; curBlock = curBlock.getRelative(0, 0, -1); - curBlock.setType(Material.AIR); } Block fineBlock = curBlock; while (fineBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE) { nb++; fineBlock = fineBlock.getRelative(-1, 0, 0); - fineBlock.setType(Material.AIR); } fineBlock = curBlock; while (fineBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE) { nc++; fineBlock = fineBlock.getRelative(1, 0, 0); - fineBlock.setType(Material.AIR); } + curBlock = actBlock.getRelative(1, 0, 0); while (curBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE) { ea++; curBlock = curBlock.getRelative(1, 0, 0); - curBlock.setType(Material.AIR); } fineBlock = curBlock; while (fineBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE) { eb++; fineBlock = fineBlock.getRelative(0, 0, -1); - fineBlock.setType(Material.AIR); } fineBlock = curBlock; while (fineBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE) { ec++; fineBlock = fineBlock.getRelative(0, 0, 1); - fineBlock.setType(Material.AIR); } + curBlock = actBlock.getRelative(0, 0, 1); while (curBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE) { sa++; curBlock = curBlock.getRelative(0, 0, 1); - curBlock.setType(Material.AIR); } fineBlock = curBlock; while (fineBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE) { sb++; fineBlock = fineBlock.getRelative(1, 0, 0); - fineBlock.setType(Material.AIR); } fineBlock = curBlock; while (fineBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE) { sc++; fineBlock = fineBlock.getRelative(-1, 0, 0); - fineBlock.setType(Material.AIR); } + curBlock = actBlock.getRelative(-1, 0, 0); while (curBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE) { wa++; curBlock = curBlock.getRelative(-1, 0, 0); - curBlock.setType(Material.AIR); } fineBlock = curBlock; while (fineBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE) { wb++; fineBlock = fineBlock.getRelative(0, 0, 1); - fineBlock.setType(Material.AIR); } fineBlock = curBlock; while (fineBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE) { wc++; fineBlock = fineBlock.getRelative(0, 0, -1); + } + + // set all redstone to air + curBlock = actBlock.getRelative(0, 0, -1); + for(int c = 0; c < na; c++) { + curBlock = curBlock.getRelative(0, 0, -1); + curBlock.setType(Material.AIR); + } + fineBlock = curBlock; + for(int c = 0; c < nb; c++) { + fineBlock = fineBlock.getRelative(-1, 0, 0); + fineBlock.setType(Material.AIR); + } + fineBlock = curBlock; + for(int c = 0; c < nc; c++) { + fineBlock = fineBlock.getRelative(1, 0, 0); + fineBlock.setType(Material.AIR); + } + + curBlock = actBlock.getRelative(1, 0, 0); + for(int c = 0; c < ea; c++) { + curBlock = curBlock.getRelative(1, 0, 0); + curBlock.setType(Material.AIR); + } + fineBlock = curBlock; + for(int c = 0; c < eb; c++) { + fineBlock = fineBlock.getRelative(0, 0, -1); fineBlock.setType(Material.AIR); } - // north negative z, south positive z, east positive x, west - // negative x + fineBlock = curBlock; + for(int c = 0; c < ec; c++) { + fineBlock = fineBlock.getRelative(0, 0, 1); + fineBlock.setType(Material.AIR); + } + + curBlock = actBlock.getRelative(0, 0, 1); + for(int c = 0; c < sa; c++) { + curBlock = curBlock.getRelative(0, 0, 1); + curBlock.setType(Material.AIR); + } + fineBlock = curBlock; + for(int c = 0; c < sb; c++) { + fineBlock = fineBlock.getRelative(1, 0, 0); + fineBlock.setType(Material.AIR); + } + fineBlock = curBlock; + for(int c = 0; c < sc; c++) { + fineBlock = fineBlock.getRelative(-1, 0, 0); + fineBlock.setType(Material.AIR); + } + + curBlock = actBlock.getRelative(-1, 0, 0); + for(int c = 0; c < wa; c++) { + curBlock = curBlock.getRelative(-1, 0, 0); + curBlock.setType(Material.AIR); + } + fineBlock = curBlock; + for(int c = 0; c < wb; c++) { + fineBlock = fineBlock.getRelative(0, 0, 1); + fineBlock.setType(Material.AIR); + } + fineBlock = curBlock; + for(int c = 0; c < wc; c++) { + fineBlock = fineBlock.getRelative(0, 0, -1); + fineBlock.setType(Material.AIR); + } + + + // find out teleport location and modify it + + // north negative z + // south positive z + // east positive x + // west negative x int z = ((sa * 100 + sb) - (na * 100 + nb)); int x = ((ea * 100 + eb) - (wa * 100 + wb)); int y = nc + ec + sc + wc; + double actPointX = actPoint.getX(); double actPointZ = actPoint.getZ(); + Location teleLoc = actPoint.add(x, y, z); + float yaw = player.getLocation().getYaw(); float pitch = player.getLocation().getPitch(); + teleLoc.setYaw(yaw); teleLoc.setPitch(pitch); + double distance = Math.sqrt(Math.pow(teleLoc.getX() - actPointX, 2) + Math.pow(teleLoc.getZ() - actPointZ, 2)); + double mathRandX = philosopherStoneModifier(player) * distance / 10 * Math.random(); double mathRandZ = philosopherStoneModifier(player) * distance / 10 * Math.random(); + double randX = (teleLoc.getX() - (0.5 * mathRandX)) + (mathRandX); double randZ = (teleLoc.getZ() - (0.5 * mathRandZ)) + (mathRandZ); + teleLoc.setX(randX); teleLoc.setZ(randZ); + + // wait for chunk to be loaded before teleporting player while (teleLoc.getWorld().getChunkAt(teleLoc).isLoaded() == false) { teleLoc.getWorld().getChunkAt(teleLoc).load(true); } + + // teleport player player.teleport(teleLoc); + ItemStack redstonePile = new ItemStack(331, 5 + na + nb + nc + sa + sb + sc + ea + eb + ec + wa + wb + wc); + teleLoc.getWorld().dropItem(teleLoc, redstonePile); + actBlock.getWorld().strikeLightningEffect(actBlock.getLocation()); actBlock.getWorld().strikeLightningEffect(teleLoc); + return; } From a7254c59a630787ffe4d3f8a971b728bfde8374a Mon Sep 17 00:00:00 2001 From: ty2u Date: Fri, 8 Jun 2012 13:03:36 -0400 Subject: [PATCH 026/133] Lightning only activates if you click on the proper block for the transmutation circle --- .../GeometricMagic/GeometricMagicPlayerListener.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 36780f8..ccc8a32 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -409,6 +409,7 @@ public static void transmutationCircle(Player player, World world, Location circleEnd = actBlock.getLocation(); Material fromType = actBlock.getType(); Material toType = actBlock.getType(); + boolean lightning = false; if (actBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE) { halfWidth = 0; @@ -444,6 +445,7 @@ public static void transmutationCircle(Player player, World world, // System.out.println(circleEnd); alchemyCheck(fromType, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); + lightning = true; } else if (actBlock.getRelative(-1 * (fullWidth - 1), 0, 0) .getType() == Material.REDSTONE_WIRE) { // west @@ -467,6 +469,7 @@ public static void transmutationCircle(Player player, World world, fullWidth - 3, -1 * (halfWidth - 2)); alchemyCheck(fromType, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); + lightning = true; } } else if (actBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE) { @@ -502,6 +505,7 @@ public static void transmutationCircle(Player player, World world, fullWidth - 3, -1 * (fullWidth - 2)); alchemyCheck(fromType, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); + lightning = true; } else if (actBlock.getRelative(0, 0, (fullWidth - 1)).getType() == Material.REDSTONE_WIRE) { // south // System.out.println("transmutationCircle south"); @@ -522,9 +526,11 @@ public static void transmutationCircle(Player player, World world, fullWidth - 3, (fullWidth - 2)); alchemyCheck(fromType, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); + lightning = true; } } - actBlock.getWorld().strikeLightningEffect(actBlock.getLocation()); + if (lightning) + actBlock.getWorld().strikeLightningEffect(actBlock.getLocation()); } public static void setCircleRemote(Player player, World world, From 3612e9155aff68148254adf970ac7ac00528d81f Mon Sep 17 00:00:00 2001 From: ty2u Date: Fri, 8 Jun 2012 13:12:54 -0400 Subject: [PATCH 027/133] Disallow transmuting mob spawners --- .../GeometricMagicPlayerListener.java | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index ccc8a32..7471602 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -1498,15 +1498,19 @@ public static void transmuteBlock(Material a, Material b, byte toData, if (-1 * balance < pay) { - // Create fake block break event for compatibility with logging - // plugins + // disallow transmuting of mob spawners completely + // block break if (a != Material.AIR && b == Material.AIR && a != Material.CHEST && a != Material.WALL_SIGN && a != Material.SIGN_POST && a != Material.FURNACE && a != Material.BURNING_FURNACE && a != Material.BREWING_STAND && a != Material.WOODEN_DOOR - && a != Material.IRON_DOOR_BLOCK) { + && a != Material.IRON_DOOR_BLOCK + && a != Material.MOB_SPAWNER + && b != Material.MOB_SPAWNER) { + + // block break event BlockBreakEvent break_event = new BlockBreakEvent( startBlock, player); Bukkit.getServer().getPluginManager() @@ -1525,9 +1529,10 @@ public static void transmuteBlock(Material a, Material b, byte toData, } } - // Create fake block place event for compatibility with logging - // plugins - else if (a == Material.AIR && b != Material.AIR) { + // block place + else if (a == Material.AIR && b != Material.AIR + && a != Material.MOB_SPAWNER + && b != Material.MOB_SPAWNER) { // change block startBlock.setType(b); @@ -1541,6 +1546,7 @@ else if (a == Material.AIR && b != Material.AIR) { econ.withdrawPlayer(player.getName(), pay * -1); } + // block place event BlockPlaceEvent place_event = new BlockPlaceEvent( startBlock, startBlockState, startBlock, new ItemStack(b.getId()), player, true); @@ -1548,15 +1554,18 @@ else if (a == Material.AIR && b != Material.AIR) { .callEvent(place_event); } - // Create fake block break and place events for compatibility - // with logging plugins + // block break and place else if (a != Material.AIR && b != Material.AIR && a != Material.CHEST && a != Material.WALL_SIGN && a != Material.SIGN_POST && a != Material.FURNACE && a != Material.BURNING_FURNACE && a != Material.BREWING_STAND && a != Material.WOODEN_DOOR + && a != Material.MOB_SPAWNER + && b != Material.MOB_SPAWNER && a != Material.IRON_DOOR_BLOCK) { + + // block break event BlockBreakEvent break_event = new BlockBreakEvent( startBlock, player); Bukkit.getServer().getPluginManager() @@ -1574,16 +1583,18 @@ else if (a != Material.AIR && b != Material.AIR econ.withdrawPlayer(player.getName(), pay * -1); } + // block place event BlockPlaceEvent place_event = new BlockPlaceEvent( startBlock, startBlockState, startBlock, new ItemStack(b.getId()), player, true); Bukkit.getServer().getPluginManager() .callEvent(place_event); } - // System.out.println("transmuted block"); - // System.out.println(startBlock.getX() + " " + - // startBlock.getY() + " " + startBlock.getZ()); - else if (a != Material.AIR && b != Material.AIR) { + + // output to console + else if ((a != Material.AIR && b != Material.AIR) + || a == Material.MOB_SPAWNER + || b == Material.MOB_SPAWNER) { System.out.println("[GeometricMagic] " + player.getName() + " tried to transmute a blacklisted material:"); System.out.println("[GeometricMagic] " + a.name() From e9b6dcb86814a195e9b03ec6b8c9c58b4e413e9a Mon Sep 17 00:00:00 2001 From: ty2u Date: Fri, 8 Jun 2012 13:21:18 -0400 Subject: [PATCH 028/133] Added messages when a player is too hungry to use a circle --- .../GeometricMagicPlayerListener.java | 58 ++++++++++++++----- 1 file changed, 44 insertions(+), 14 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 7471602..f0f9a04 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -725,8 +725,10 @@ public static void setCircleEffects(Player player, World world, droppedItem.remove(); effectBlock.getWorld().dropItem( effectBlock.getLocation(), newItem); - } else + } else { + player.sendMessage("You feel so hungry..."); return; + } } } } @@ -770,8 +772,10 @@ public static void setCircleEffects(Player player, World world, } } redStack.remove(); - } else + } else { + player.sendMessage("You feel so hungry..."); return; + } } else if (arrayString.equals("[1, 2, 3, 3]") && player.hasPermission("circle.set.1233")) { cost = 20; @@ -799,6 +803,8 @@ public static void setCircleEffects(Player player, World world, effectBlock.getWorld().dropItem(effectBlock.getLocation(), onePortal); } + } else { + player.sendMessage("You feel so hungry..."); } ItemStack diamondStack = new ItemStack(264, fires); effectBlock.getWorld().dropItem(effectBlock.getLocation(), @@ -818,8 +824,10 @@ public static void setCircleEffects(Player player, World world, ItemStack oneRedstone = new ItemStack(331, 10); effectBlock.getWorld().dropItem(effectBlock.getLocation(), oneRedstone); - } else + } else { + player.sendMessage("You feel so hungry..."); return; + } } else if (arrayString.equals("[2, 2, 2, 3]") && player.hasPermission("circle.set.2223")) { cost = 10; @@ -879,8 +887,10 @@ public static void setCircleEffects(Player player, World world, } } redStack.remove(); - } else + } else { + player.sendMessage("You feel so hungry..."); return; + } } else if (arrayString.equals("[2, 2, 2, 4]") && player.hasPermission("circle.set.2224")) { cost = 10; @@ -889,8 +899,10 @@ public static void setCircleEffects(Player player, World world, Location spawnLoc = effectBlock.getLocation(); spawnLoc.add(0.5, 0, 0.5); effectBlock.getWorld().spawn(spawnLoc, Enderman.class); - } else + } else { + player.sendMessage("You feel so hungry..."); return; + } } else if (arrayString.equals("[2, 2, 4, 4]") && player.hasPermission("circle.set.2244")) { if (!hasLearnedCircle(player, arrayString)) { @@ -979,8 +991,10 @@ public static void setCircleEffects(Player player, World world, player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); effectBlock.getWorld().createExplosion( effectBlock.getLocation(), (4 + size)); - } else + } else { + player.sendMessage("You feel so hungry..."); return; + } } else if (arrayString.equals("[3, 3, 3, 4]") && player.hasPermission("circle.set.3334")) { cost = 2; @@ -994,8 +1008,10 @@ public static void setCircleEffects(Player player, World world, effectBlock.getRelative(-10, 0, -10).getLocation(), effectBlock.getRelative(10, 20, 10).getLocation(), player); - } else + } else { + player.sendMessage("You feel so hungry..."); return; + } } else if (arrayString.equals("[3, 3, 4, 4]") && player.hasPermission("circle.set.3344")) { cost = 4; @@ -1010,8 +1026,10 @@ public static void setCircleEffects(Player player, World world, player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); effectBlock.getWorld().createExplosion( effectBlock.getLocation(), 8 + size, true); - } else + } else { + player.sendMessage("You feel so hungry..."); return; + } } else if (arrayString.equals("[3, 4, 4, 4]") && player.hasPermission("circle.set.3444")) { cost = 20; @@ -1027,8 +1045,10 @@ public static void setCircleEffects(Player player, World world, } catch (IOException e1) { e1.printStackTrace(); } - } else + } else { + player.sendMessage("You feel so hungry..."); return; + } } else if (arrayString.equals("[0, 1, 1, 1]") && player.hasPermission("circle.set.0111")) { cost = 16; @@ -1076,8 +1096,10 @@ public static void setCircleEffects(Player player, World world, player.sendMessage("You do not have a spawn set!"); player.setFoodLevel((int) (player.getFoodLevel() + (cost * philosopherStoneModifier(player)))); } - } else + } else { + player.sendMessage("You feel so hungry..."); return; + } } else if (arrayString.equals("[0, 0, 4, 4]") && player.hasPermission("circle.set.0044")) { cost = 10; @@ -1090,8 +1112,10 @@ public static void setCircleEffects(Player player, World world, Location spawnLoc = effectBlock.getLocation(); spawnLoc.add(0.5, 0, 0.5); effectBlock.getWorld().spawn(spawnLoc, Pig.class); - } else + } else { + player.sendMessage("You feel so hungry..."); return; + } } else if (arrayString.equals("[0, 1, 4, 4]") && player.hasPermission("circle.set.0144")) { cost = 10; @@ -1104,8 +1128,10 @@ public static void setCircleEffects(Player player, World world, Location spawnLoc = effectBlock.getLocation(); spawnLoc.add(0.5, 0, 0.5); effectBlock.getWorld().spawn(spawnLoc, Sheep.class); - } else + } else { + player.sendMessage("You feel so hungry..."); return; + } } else if (arrayString.equals("[0, 2, 4, 4]") && player.hasPermission("circle.set.0244")) { cost = 10; @@ -1118,8 +1144,10 @@ public static void setCircleEffects(Player player, World world, Location spawnLoc = effectBlock.getLocation(); spawnLoc.add(0.5, 0, 0.5); effectBlock.getWorld().spawn(spawnLoc, Cow.class); - } else + } else { + player.sendMessage("You feel so hungry..."); return; + } } else if (arrayString.equals("[0, 3, 4, 4]") && player.hasPermission("circle.set.0344")) { cost = 10; @@ -1132,8 +1160,10 @@ public static void setCircleEffects(Player player, World world, Location spawnLoc = effectBlock.getLocation(); spawnLoc.add(0.5, 0, 0.5); effectBlock.getWorld().spawn(spawnLoc, Chicken.class); - } else + } else { + player.sendMessage("You feel so hungry..."); return; + } } else { player.sendMessage("You do not have permission to use " + arrayString + " or set circle does not exist"); From 21de0dd2c29133499500306abf6f3128565c297d Mon Sep 17 00:00:00 2001 From: ty2u Date: Fri, 8 Jun 2012 13:33:48 -0400 Subject: [PATCH 029/133] Fixed potential resource leak and close sacrifices.txt when done with it --- .../GeometricMagicPlayerListener.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index f0f9a04..5ff188d 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -1919,8 +1919,11 @@ public static boolean checkSacrifices(Player player) throws IOException { Scanner inputFile = new Scanner(myFile); while (inputFile.hasNextLine()) { String name = inputFile.nextLine(); - if (name.equals(player.getName())) + if (name.equals(player.getName())) { + // close this before we return + inputFile.close(); return true; + } inputFile.nextLine(); } inputFile.close(); @@ -1931,7 +1934,7 @@ public static boolean checkSacrifices(Player player) throws IOException { public static void humanTransmutation(Player player) throws IOException { if (new File("plugins/GeometricMagic/").mkdirs()) - System.out.println("sacrifices file created"); + System.out.println("[GeometricMagic] Sacrifices file created."); File myFile = new File("plugins/GeometricMagic/sacrifices.txt"); if (myFile.exists()) { Scanner inputFile = new Scanner(myFile); @@ -1950,7 +1953,7 @@ public static void humanTransmutation(Player player) throws IOException { } else { PrintWriter outputFile = new PrintWriter( "plugins/GeometricMagic/sacrifices.txt"); - System.out.println("sacrifices file created"); + System.out.println("[GeometricMagic] Sacrifices file created."); outputFile.close(); } FileWriter fWriter = new FileWriter( @@ -1970,8 +1973,11 @@ public static boolean checkSacrificed(Player player) throws IOException { Scanner inputFile = new Scanner(myFile); while (inputFile.hasNextLine()) { String name = inputFile.nextLine(); - if (name.equals(player.getName())) + if (name.equals(player.getName())) { + // close this before we return + inputFile.close(); return true; + } } inputFile.close(); return false; @@ -1988,8 +1994,10 @@ public static boolean hasLearnedCircle(Player player, String circle) Scanner inputFile = new Scanner(myFile); while (inputFile.hasNextLine()) { String name = inputFile.nextLine(); - if (name.equals(circle)) + if (name.equals(circle)) { + inputFile.close(); return true; + } } inputFile.close(); return false; @@ -2006,7 +2014,8 @@ public static boolean learnCircle(Player player, String circle, for (int i = 0; i < entityList.size(); i++) { if (entityList.get(i) instanceof Enderman) { if (new File("plugins/GeometricMagic/").mkdirs()) - System.out.println("file created for " + player.getName()); + System.out.println("[GeometricMagic] File created for " + + player.getName()); File myFile = new File("plugins/GeometricMagic/" + player.getName() + ".txt"); if (myFile.exists()) { From dde443e2ae7e11c7f57086490711a8ddf424baa5 Mon Sep 17 00:00:00 2001 From: ty2u Date: Fri, 8 Jun 2012 13:39:09 -0400 Subject: [PATCH 030/133] Some formatting --- .../GeometricMagic/GeometricMagic.java | 9 ++-- .../GeometricMagicPlayerListener.java | 46 +++++++++++-------- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagic.java b/src/me/cakenggt/GeometricMagic/GeometricMagic.java index baae2ee..75b9b63 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagic.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagic.java @@ -24,7 +24,8 @@ public class GeometricMagic extends JavaPlugin { public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { - // If the player typed /set then do the following... + + // If the player typed /setcircle then do the following... if (cmd.getName().equalsIgnoreCase("setcircle")) { // [1, 1, 3, 3] Player player = null; @@ -32,7 +33,7 @@ public boolean onCommand(CommandSender sender, Command cmd, player = (Player) sender; } if (player == null) { - sender.sendMessage("this command can only be run by a player"); + sender.sendMessage("This command can only be run by a player"); return false; } if (args.length == 0) { @@ -126,13 +127,13 @@ public void onDisable() { } public void onEnable() { - + // Vault Support if (!setupEconomy()) { System.out .println("Economy system not found! GeometricMagic uses Vault to plug into economy systems."); } - + playerListener = new GeometricMagicPlayerListener(); entityListener = new GeometricMagicDamageListener(); getServer().getPluginManager().registerEvents(playerListener, this); diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 5ff188d..59f8ff1 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -106,6 +106,8 @@ public static void circleChooser(Player player, World world, Block actBlock) { Block southBlock = actBlock.getRelative(0, 0, 1); Block eastBlock = actBlock.getRelative(1, 0, 0); Block westBlock = actBlock.getRelative(-1, 0, 0); + + // teleportation circle if (northBlock.getType() == Material.REDSTONE_WIRE && southBlock.getType() == Material.REDSTONE_WIRE && eastBlock.getType() == Material.REDSTONE_WIRE @@ -115,6 +117,8 @@ public static void circleChooser(Player player, World world, Block actBlock) { teleportationCircle(player, world, actBlock); } else player.sendMessage("You do not have permission to use this circle"); + + // micro circle } else if (northBlock.getType() != Material.REDSTONE_WIRE && southBlock.getType() != Material.REDSTONE_WIRE && eastBlock.getType() != Material.REDSTONE_WIRE @@ -128,6 +132,8 @@ public static void circleChooser(Player player, World world, Block actBlock) { microCircle(player, world, actBlock); } else player.sendMessage("You do not have permission to use this circle"); + + // transmutation circle } else if ((northBlock.getType() == Material.REDSTONE_WIRE && southBlock.getType() == Material.REDSTONE_WIRE && eastBlock.getType() != Material.REDSTONE_WIRE && westBlock @@ -157,12 +163,13 @@ public static void circleChooser(Player player, World world, Block actBlock) { player.sendMessage("You do not have permission to use this circle"); } - //System.out.println("circleSize:" + circleSize); + // System.out.println("circleSize:" + circleSize); if (circleSize > 0) { transmutationCircle(player, world, actBlock, circleSize); } + // set circle } else if (northBlock.getType() != Material.REDSTONE_WIRE && southBlock.getType() != Material.REDSTONE_WIRE && eastBlock.getType() != Material.REDSTONE_WIRE @@ -172,12 +179,14 @@ public static void circleChooser(Player player, World world, Block actBlock) { && actBlock.getRelative(0, 0, -3).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, 3).getType() == Material.REDSTONE_WIRE) { if (player.hasPermission("circle.set")) { - // System.out.println("set"); setCircleRemote(player, world, actBlock); } else player.sendMessage("You do not have permission to use this circle"); - } else + + // no circle + } else { return; + } } public static void teleportationCircle(Player player, World world, @@ -260,72 +269,71 @@ public static void teleportationCircle(Player player, World world, wc++; fineBlock = fineBlock.getRelative(0, 0, -1); } - + // set all redstone to air curBlock = actBlock.getRelative(0, 0, -1); - for(int c = 0; c < na; c++) { + for (int c = 0; c < na; c++) { curBlock = curBlock.getRelative(0, 0, -1); curBlock.setType(Material.AIR); } fineBlock = curBlock; - for(int c = 0; c < nb; c++) { + for (int c = 0; c < nb; c++) { fineBlock = fineBlock.getRelative(-1, 0, 0); fineBlock.setType(Material.AIR); } fineBlock = curBlock; - for(int c = 0; c < nc; c++) { + for (int c = 0; c < nc; c++) { fineBlock = fineBlock.getRelative(1, 0, 0); fineBlock.setType(Material.AIR); } curBlock = actBlock.getRelative(1, 0, 0); - for(int c = 0; c < ea; c++) { + for (int c = 0; c < ea; c++) { curBlock = curBlock.getRelative(1, 0, 0); curBlock.setType(Material.AIR); } fineBlock = curBlock; - for(int c = 0; c < eb; c++) { + for (int c = 0; c < eb; c++) { fineBlock = fineBlock.getRelative(0, 0, -1); fineBlock.setType(Material.AIR); } fineBlock = curBlock; - for(int c = 0; c < ec; c++) { + for (int c = 0; c < ec; c++) { fineBlock = fineBlock.getRelative(0, 0, 1); fineBlock.setType(Material.AIR); } curBlock = actBlock.getRelative(0, 0, 1); - for(int c = 0; c < sa; c++) { + for (int c = 0; c < sa; c++) { curBlock = curBlock.getRelative(0, 0, 1); curBlock.setType(Material.AIR); } fineBlock = curBlock; - for(int c = 0; c < sb; c++) { + for (int c = 0; c < sb; c++) { fineBlock = fineBlock.getRelative(1, 0, 0); fineBlock.setType(Material.AIR); } fineBlock = curBlock; - for(int c = 0; c < sc; c++) { + for (int c = 0; c < sc; c++) { fineBlock = fineBlock.getRelative(-1, 0, 0); fineBlock.setType(Material.AIR); } curBlock = actBlock.getRelative(-1, 0, 0); - for(int c = 0; c < wa; c++) { + for (int c = 0; c < wa; c++) { curBlock = curBlock.getRelative(-1, 0, 0); curBlock.setType(Material.AIR); } fineBlock = curBlock; - for(int c = 0; c < wb; c++) { + for (int c = 0; c < wb; c++) { fineBlock = fineBlock.getRelative(0, 0, 1); fineBlock.setType(Material.AIR); } fineBlock = curBlock; - for(int c = 0; c < wc; c++) { + for (int c = 0; c < wc; c++) { fineBlock = fineBlock.getRelative(0, 0, -1); fineBlock.setType(Material.AIR); } - // find out teleport location and modify it @@ -481,8 +489,8 @@ public static void transmutationCircle(Player player, World world, halfWidth++; } fullWidth = (halfWidth * 2) - 1; - //System.out - // .println("half is " + halfWidth + " full is " + fullWidth); + // System.out + // .println("half is " + halfWidth + " full is " + fullWidth); int dimensionOfEffect = (fullWidth - 2) * (fullWidth - 2); if (actBlock.getRelative(0, 0, -1 * (fullWidth - 1)).getType() == Material.REDSTONE_WIRE) { // north From 4ffd653b75c7c7d5ac17056ef7fd81fbce5247a6 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Fri, 8 Jun 2012 15:54:52 -0400 Subject: [PATCH 031/133] Quick fix to save me time figuring out how to work git --- plugin.yml | 2 +- src/me/cakenggt/GeometricMagic/GeometricMagic.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.yml b/plugin.yml index bf77ec7..edf7787 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.20 +version: 2.2 author: cakenggt permissions: GeometricMagic.circle.*: diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagic.java b/src/me/cakenggt/GeometricMagic/GeometricMagic.java index a4b9e32..203086d 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagic.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagic.java @@ -27,7 +27,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, player = (Player) sender; } if (player == null) { - sender.sendMessage("this command can only be run by a player"); + sender.sendMessage("This command can only be run by a player"); return false; } if (args.length == 0){ From f609b65701af4bf9276ddc084909123de17b0c05 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Fri, 8 Jun 2012 16:21:16 -0400 Subject: [PATCH 032/133] Legal stuff --- COPYING | 621 ++++++++++++++++++ plugin.yml | 22 +- .../GeometricMagic/GeometricMagic.java | 18 + .../GeometricMagicDamageListener.java | 18 + .../GeometricMagicPlayerListener.java | 18 + 5 files changed, 695 insertions(+), 2 deletions(-) create mode 100644 COPYING diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..e587591 --- /dev/null +++ b/COPYING @@ -0,0 +1,621 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/plugin.yml b/plugin.yml index 1af0f52..2b3e07e 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,7 +1,25 @@ +# +# GeometricMagic allows players to draw redstone circles on the ground to do things such as teleport and transmute blocks. +# Copyright (C) 2012 Alec Cox (cakenggt), Andrew Stevanus (Hoot215) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.20 -author: cakenggt +version: 2.3 +author: cakenggt, Hoot215 depend: [Vault] permissions: GeometricMagic.circle.*: diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagic.java b/src/me/cakenggt/GeometricMagic/GeometricMagic.java index 75b9b63..b2f1173 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagic.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagic.java @@ -1,3 +1,21 @@ +/** + * GeometricMagic allows players to draw redstone circles on the ground to do things such as teleport and transmute blocks. + * Copyright (C) 2012 Alec Cox (cakenggt), Andrew Stevanus (Hoot215) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package me.cakenggt.GeometricMagic; import java.io.File; diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java index 5ca3346..4bb4201 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java @@ -1,3 +1,21 @@ +/** + * GeometricMagic allows players to draw redstone circles on the ground to do things such as teleport and transmute blocks. + * Copyright (C) 2012 Alec Cox (cakenggt), Andrew Stevanus (Hoot215) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package me.cakenggt.GeometricMagic; import org.bukkit.Material; diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 59f8ff1..59f32d2 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -1,3 +1,21 @@ +/** + * GeometricMagic allows players to draw redstone circles on the ground to do things such as teleport and transmute blocks. + * Copyright (C) 2012 Alec Cox (cakenggt), Andrew Stevanus (Hoot215) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package me.cakenggt.GeometricMagic; import java.io.*; From 8d5535b7d783f346f972fca76ab2b2acb7f2c43c Mon Sep 17 00:00:00 2001 From: ty2u Date: Tue, 12 Jun 2012 15:41:48 -0400 Subject: [PATCH 033/133] Added some checks to food cost --- plugin.yml | 121 ------------------ .../GeometricMagicPlayerListener.java | 12 ++ 2 files changed, 12 insertions(+), 121 deletions(-) delete mode 100644 plugin.yml diff --git a/plugin.yml b/plugin.yml deleted file mode 100644 index 1af0f52..0000000 --- a/plugin.yml +++ /dev/null @@ -1,121 +0,0 @@ -name: GeometricMagic -main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.20 -author: cakenggt -depend: [Vault] -permissions: - GeometricMagic.circle.*: - description: Gives access to all circles - children: - circle.teleportation: true - circle.micro: true - circle.transmutation: true - circle.set: true - circle.teleportation: - description: Allows you to use teleportation circles - default: true - circle.micro: - description: Allows you to use micro circles - default: true - circle.transmutation.*: - description: Allows you to use all transmutation circles - default: false - children: - circle.transmutation.1: true - circle.transmutation.3: false - circle.transmutation.4: false - circle.transmutation.7: false - circle.transmutation.9: false - circle.transmutation.1: - description: Allows you to use transmutation circle 1 - default: true - circle.transmutation.3: - description: Allows you to use transmutation circle 3 - default: false - circle.transmutation.5: - description: Allows you to use transmutation circle 5 - default: false - circle.transmutation.7: - description: Allows you to use transmutation circle 7 - default: false - circle.transmutation.9: - description: Allows you to use transmutation circle 9 - default: false - circle.set: - description: Allows you to use set circles - default: true - children: - circle.set.*: true - circle.set.*: - description: Allows you to use all set circles - default: true - children: - circle.set.1133: true - circle.set.1222: true - circle.set.1233: true - circle.set.1234: true - circle.set.2223: true - circle.set.2224: true - circle.set.2244: true - circle.set.2333: true - circle.set.3334: true - circle.set.3344: true - circle.set.3444: true - circle.set.0111: true - circle.set.0044: true - circle.set.0144: true - circle.set.0244: true - circle.set.0344: true - circle.set.1133: - description: Allows you to use set circle 1133 - default: true - circle.set.1222: - description: Allows you to use set circle 1222 - default: true - circle.set.1233: - description: Allows you to use set circle 1233 - default: true - circle.set.1234: - description: Allows you to use set circle 1234 - default: true - circle.set.2223: - description: Allows you to use set circle 2223 - default: true - circle.set.2224: - description: Allows you to use set circle 2224 - default: true - circle.set.2244: - description: Allows you to use set circle 2244 - default: true - circle.set.2333: - description: Allows you to use set circle 2333 - default: true - circle.set.3334: - description: Allows you to use set circle 3334 - default: true - circle.set.3344: - description: Allows you to use set circle 1133 - default: true - circle.set.3444: - description: Allows you to use set circle 3444 - default: true - circle.set.0111: - description: Allows you to use set circle 0111 - default: true - circle.set.0044: - description: Allows you to use set circle 0044 - default: true - circle.set.0144: - description: Allows you to use set circle 0144 - default: true - circle.set.0244: - description: Allows you to use set circle 0244 - default: true - circle.set.0344: - description: Allows you to use set circle 0344 - default: true -commands: - setcircle: - description: This command sets a sacrifice's right-click circle. - permission: GeometricMagic.setcircle - usage: /setcircle 3344 \ No newline at end of file diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 59f8ff1..3c2ec66 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -726,6 +726,10 @@ public static void setCircleEffects(Player player, World world, if (droppedItem.getItemStack().getTypeId() == 261) cost = droppedItem.getItemStack().getDurability(); cost = cost / 50; + + // make sure cost is not more than 20 + if(cost > 20) cost = 20; + if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); ItemStack newItem = new ItemStack(droppedItem @@ -990,6 +994,10 @@ public static void setCircleEffects(Player player, World world, cost = 2; int size = setCircleSize(actBlock); cost = 2 + size / 2; + + // make sure cost is not more than 20 + if(cost > 20) cost = 20; + if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " + arrayString + "!"); @@ -1025,6 +1033,10 @@ public static void setCircleEffects(Player player, World world, cost = 4; int size = setCircleSize(actBlock); cost = 4 + size / 2; + + // make sure cost is not more than 20 + if(cost > 20) cost = 20; + if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " + arrayString + "!"); From eb373dcd906b7532180e81cc121637a06edf1b76 Mon Sep 17 00:00:00 2001 From: ty2u Date: Tue, 12 Jun 2012 15:46:13 -0400 Subject: [PATCH 034/133] Woops I have this file in a different folder --- plugin.yml | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 plugin.yml diff --git a/plugin.yml b/plugin.yml new file mode 100644 index 0000000..1af0f52 --- /dev/null +++ b/plugin.yml @@ -0,0 +1,121 @@ +name: GeometricMagic +main: me.cakenggt.GeometricMagic.GeometricMagic +version: 2.20 +author: cakenggt +depend: [Vault] +permissions: + GeometricMagic.circle.*: + description: Gives access to all circles + children: + circle.teleportation: true + circle.micro: true + circle.transmutation: true + circle.set: true + circle.teleportation: + description: Allows you to use teleportation circles + default: true + circle.micro: + description: Allows you to use micro circles + default: true + circle.transmutation.*: + description: Allows you to use all transmutation circles + default: false + children: + circle.transmutation.1: true + circle.transmutation.3: false + circle.transmutation.4: false + circle.transmutation.7: false + circle.transmutation.9: false + circle.transmutation.1: + description: Allows you to use transmutation circle 1 + default: true + circle.transmutation.3: + description: Allows you to use transmutation circle 3 + default: false + circle.transmutation.5: + description: Allows you to use transmutation circle 5 + default: false + circle.transmutation.7: + description: Allows you to use transmutation circle 7 + default: false + circle.transmutation.9: + description: Allows you to use transmutation circle 9 + default: false + circle.set: + description: Allows you to use set circles + default: true + children: + circle.set.*: true + circle.set.*: + description: Allows you to use all set circles + default: true + children: + circle.set.1133: true + circle.set.1222: true + circle.set.1233: true + circle.set.1234: true + circle.set.2223: true + circle.set.2224: true + circle.set.2244: true + circle.set.2333: true + circle.set.3334: true + circle.set.3344: true + circle.set.3444: true + circle.set.0111: true + circle.set.0044: true + circle.set.0144: true + circle.set.0244: true + circle.set.0344: true + circle.set.1133: + description: Allows you to use set circle 1133 + default: true + circle.set.1222: + description: Allows you to use set circle 1222 + default: true + circle.set.1233: + description: Allows you to use set circle 1233 + default: true + circle.set.1234: + description: Allows you to use set circle 1234 + default: true + circle.set.2223: + description: Allows you to use set circle 2223 + default: true + circle.set.2224: + description: Allows you to use set circle 2224 + default: true + circle.set.2244: + description: Allows you to use set circle 2244 + default: true + circle.set.2333: + description: Allows you to use set circle 2333 + default: true + circle.set.3334: + description: Allows you to use set circle 3334 + default: true + circle.set.3344: + description: Allows you to use set circle 1133 + default: true + circle.set.3444: + description: Allows you to use set circle 3444 + default: true + circle.set.0111: + description: Allows you to use set circle 0111 + default: true + circle.set.0044: + description: Allows you to use set circle 0044 + default: true + circle.set.0144: + description: Allows you to use set circle 0144 + default: true + circle.set.0244: + description: Allows you to use set circle 0244 + default: true + circle.set.0344: + description: Allows you to use set circle 0344 + default: true +commands: + setcircle: + description: This command sets a sacrifice's right-click circle. + permission: GeometricMagic.setcircle + usage: /setcircle 3344 \ No newline at end of file From 3017a8adc9c11d2a1879aee38f3cd224d93ffb7c Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Tue, 12 Jun 2012 18:40:55 -0400 Subject: [PATCH 035/133] Change dependency on Vault to soft dependency --- .../GeometricMagic/GeometricMagic.java.orig | 199 ++++++++++++++++++ plugin.yml | 2 +- 2 files changed, 200 insertions(+), 1 deletion(-) create mode 100644 bin/me/cakenggt/GeometricMagic/GeometricMagic.java.orig diff --git a/bin/me/cakenggt/GeometricMagic/GeometricMagic.java.orig b/bin/me/cakenggt/GeometricMagic/GeometricMagic.java.orig new file mode 100644 index 0000000..da535de --- /dev/null +++ b/bin/me/cakenggt/GeometricMagic/GeometricMagic.java.orig @@ -0,0 +1,199 @@ +/** + * GeometricMagic allows players to draw redstone circles on the ground to do things such as teleport and transmute blocks. + * Copyright (C) 2012 Alec Cox (cakenggt), Andrew Stevanus (Hoot215) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package me.cakenggt.GeometricMagic; + +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Scanner; + +import net.milkbowl.vault.economy.Economy; + +import org.bukkit.Material; +import org.bukkit.command.*; +import org.bukkit.entity.Player; +import org.bukkit.event.Listener; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.ShapelessRecipe; +import org.bukkit.plugin.RegisteredServiceProvider; +import org.bukkit.plugin.java.JavaPlugin; + +public class GeometricMagic extends JavaPlugin { + public static GeometricMagic plugin; + private Listener playerListener; + private Listener entityListener; +<<<<<<< HEAD + private Listener deathListener; + public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){ + if(cmd.getName().equalsIgnoreCase("setcircle")){ // If the player typed /set then do the following... + //[1, 1, 3, 3] + Player player = null; + if (sender instanceof Player) { + player = (Player) sender; + } + if (player == null) { + sender.sendMessage("This command can only be run by a player"); + return false; + } + if (args.length == 0){ + ItemStack oneFlint = new ItemStack(318, 1); +======= + private static Economy economy; + + public boolean onCommand(CommandSender sender, Command cmd, + String commandLabel, String[] args) { + + // If the player typed /setcircle then do the following... + if (cmd.getName().equalsIgnoreCase("setcircle")) { + // [1, 1, 3, 3] + Player player = null; + if (sender instanceof Player) { + player = (Player) sender; + } + if (player == null) { + sender.sendMessage("This command can only be run by a player"); + return false; + } + if (args.length == 0) { + ItemStack oneFlint = new ItemStack(318, 1); +>>>>>>> dev + player.getWorld().dropItem(player.getLocation(), oneFlint); + return true; + } + if (args.length != 1) { + sender.sendMessage(cmd.getUsage()); + return false; + } + if (args[0].length() != 4 && args[0].length() != 1) { + sender.sendMessage(cmd.getUsage()); + return false; + } + if (args[0].length() == 1 && args[0].equalsIgnoreCase("0")) { + sender.sendMessage("Casting circles on right click now disabled, set right click to a viable circle to enable"); + String inputString = args[0]; + try { + sacrificeCircle(sender, inputString); + } catch (IOException e) { + e.printStackTrace(); + } + return true; + } else { + String inputString = "[" + args[0].charAt(0) + ", " + + args[0].charAt(1) + ", " + args[0].charAt(2) + ", " + + args[0].charAt(3) + "]"; + try { + sacrificeCircle(sender, inputString); + } catch (IOException e) { + e.printStackTrace(); + } + return true; + } + } + // If this has happened the function will break and return true. if this + // hasn't happened the a value of false will be returned. + return false; + } + + public void sacrificeCircle(CommandSender sender, String inputString) + throws IOException { + // System.out.println("sacrificeCircle for " + inputString); + File myFile = new File("plugins/GeometricMagic/sacrifices.txt"); + if (myFile.exists()) { + Scanner inputFileCheck = new Scanner(myFile); + int j = 0; + while (inputFileCheck.hasNext()) { + inputFileCheck.nextLine(); + j++; + } + int size = (j + 1) / 2; + // System.out.println("size of sacrifices file " + size); + String[] nameArray = new String[size]; + String[] circleArray = new String[size]; + inputFileCheck.close(); + // System.out.println("inputFileCheck closed"); + Scanner inputFile = new Scanner(myFile); + // System.out.println("inputFile opened"); + for (int i = 0; i < size; i++) { + nameArray[i] = inputFile.nextLine(); + circleArray[i] = inputFile.nextLine(); + } + // System.out.println("nameArray[0] is " + nameArray[0]); + // System.out.println("circleArray[0] is " + circleArray[0]); + for (int i = 0; i < size; i++) { + if (nameArray[i].equalsIgnoreCase(sender.getName())) { + circleArray[i] = inputString; + sender.sendMessage("set-circle " + inputString + + " added successfully!"); + } + } + // System.out.println("nameArray[0] is " + nameArray[0]); + // System.out.println("circleArray[0] is " + circleArray[0]); + inputFile.close(); + PrintWriter outputFile = new PrintWriter( + "plugins/GeometricMagic/sacrifices.txt"); + for (int i = 0; i < size; i++) { + outputFile.println(nameArray[i]); + outputFile.println(circleArray[i]); + } + outputFile.close(); + } else { + return; + } + } + + public void onDisable() { + System.out.println(this + " is now disabled!"); + } + + public void onEnable() { + + // Vault Support + if (!setupEconomy()) { + System.out + .println("Economy system not found! GeometricMagic uses Vault to plug into economy systems."); + } + + playerListener = new GeometricMagicPlayerListener(); + entityListener = new GeometricMagicDamageListener(); + getServer().getPluginManager().registerEvents(playerListener, this); + getServer().getPluginManager().registerEvents(entityListener, this); + ShapelessRecipe portalRecipe = new ShapelessRecipe(new ItemStack( + Material.FIRE, 64)).addIngredient(Material.PORTAL); + getServer().addRecipe(portalRecipe); + System.out.println(this + " is now enabled!"); + } + + // Vault Support + private boolean setupEconomy() { + RegisteredServiceProvider economyProvider = getServer() + .getServicesManager().getRegistration( + net.milkbowl.vault.economy.Economy.class); + if (economyProvider != null) { + economy = economyProvider.getProvider(); + } + + return (economy != null); + } + + // Vault Support + public static Economy getEconomy() { + return economy; + } + +} \ No newline at end of file diff --git a/plugin.yml b/plugin.yml index 2b3e07e..7e3947e 100644 --- a/plugin.yml +++ b/plugin.yml @@ -20,7 +20,7 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic version: 2.3 author: cakenggt, Hoot215 -depend: [Vault] +softdepend: [Vault] permissions: GeometricMagic.circle.*: description: Gives access to all circles From a8a5dae28284a9cc85b9552b28758d426abf3071 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Wed, 13 Jun 2012 20:42:15 -0400 Subject: [PATCH 036/133] IMPORTANT: Breaking changes\! Complete overhaul on permissions\! They have ALL changed Added config file Added back support for XP-based transmutation system (now default) Vault is now optional --- config.yml | 24 +++ plugin.yml | 177 ++++++++++-------- .../GeometricMagic/GeometricMagic.java | 92 +++++++-- .../GeometricMagicPlayerListener.java | 121 ++++++++---- 4 files changed, 281 insertions(+), 133 deletions(-) create mode 100644 config.yml diff --git a/config.yml b/config.yml new file mode 100644 index 0000000..30d71cf --- /dev/null +++ b/config.yml @@ -0,0 +1,24 @@ +# +# GeometricMagic allows players to draw redstone circles on the ground to do things such as teleport and transmute blocks. +# Copyright (C) 2012 Alec Cox (cakenggt), Andrew Stevanus (Hoot215) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# TRANSMUTATION SECTION +transmutation: + + # What system to use for transmutation cost + # Possible values: xp, vault (requires Vault) + cost: xp diff --git a/plugin.yml b/plugin.yml index 2b3e07e..50d0156 100644 --- a/plugin.yml +++ b/plugin.yml @@ -20,120 +20,131 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic version: 2.3 author: cakenggt, Hoot215 -depend: [Vault] +softdepend: [Vault] permissions: - GeometricMagic.circle.*: - description: Gives access to all circles + geometricmagic.*: + description: Gives access to all circles and /setcircle + default: false children: - circle.teleportation: true - circle.micro: true - circle.transmutation: true - circle.set: true - circle.teleportation: - description: Allows you to use teleportation circles + geometricmagic.standard: true + geometricmagic.transmutation.*: true + geometricmagic.standard: + description: Gives access to standard circles and /setcircle default: true - circle.micro: + children: + geometricmagic.teleportation: true + geometricmagic.micro: true + geometricmagic.transmutation.1: true + geometricmagic.set: true + geometricmagic.teleportation: + description: Allows you to use teleportation circles + default: false + geometricmagic.micro: description: Allows you to use micro circles - default: true - circle.transmutation.*: + default: false + geometricmagic.transmutation.*: description: Allows you to use all transmutation circles default: false children: - circle.transmutation.1: true - circle.transmutation.3: false - circle.transmutation.4: false - circle.transmutation.7: false - circle.transmutation.9: false - circle.transmutation.1: - description: Allows you to use transmutation circle 1 - default: true - circle.transmutation.3: - description: Allows you to use transmutation circle 3 + geometricmagic.transmutation.1: true + geometricmagic.transmutation.3: true + geometricmagic.transmutation.4: true + geometricmagic.transmutation.7: true + geometricmagic.transmutation.9: true + geometricmagic.transmutation.1: + description: Allows you to use transmutation circles of size 1 default: false - circle.transmutation.5: - description: Allows you to use transmutation circle 5 + geometricmagic.transmutation.3: + description: Allows you to use transmutation circles of size 3 default: false - circle.transmutation.7: - description: Allows you to use transmutation circle 7 + geometricmagic.transmutation.5: + description: Allows you to use transmutation circles of size 5 default: false - circle.transmutation.9: - description: Allows you to use transmutation circle 9 + geometricmagic.transmutation.7: + description: Allows you to use transmutation circles of size 7 + default: false + geometricmagic.transmutation.9: + description: Allows you to use transmutation circles of size 9 + default: false + geometricmagic.set: + description: Allows you to use all set circles and /setcircle default: false - circle.set: - description: Allows you to use set circles - default: true children: circle.set.*: true - circle.set.*: + circle.setcircle: true + geometricmagic.setcircle: + description: Allows you to use /setcircle + default: false + geometricmagic.set.*: description: Allows you to use all set circles - default: true + default: false children: - circle.set.1133: true - circle.set.1222: true - circle.set.1233: true - circle.set.1234: true - circle.set.2223: true - circle.set.2224: true - circle.set.2244: true - circle.set.2333: true - circle.set.3334: true - circle.set.3344: true - circle.set.3444: true - circle.set.0111: true - circle.set.0044: true - circle.set.0144: true - circle.set.0244: true - circle.set.0344: true - circle.set.1133: + geometricmagic.set.1133: true + geometricmagic.set.1222: true + geometricmagic.set.1233: true + geometricmagic.set.1234: true + geometricmagic.set.2223: true + geometricmagic.set.2224: true + geometricmagic.set.2244: true + geometricmagic.set.2333: true + geometricmagic.set.3334: true + geometricmagic.set.3344: true + geometricmagic.set.3444: true + geometricmagic.set.0111: true + geometricmagic.set.0044: true + geometricmagic.set.0144: true + geometricmagic.set.0244: true + geometricmagic.set.0344: true + geometricmagic.set.1133: description: Allows you to use set circle 1133 - default: true - circle.set.1222: + default: false + geometricmagic.set.1222: description: Allows you to use set circle 1222 - default: true - circle.set.1233: + default: false + geometricmagic.set.1233: description: Allows you to use set circle 1233 - default: true - circle.set.1234: + default: false + geometricmagic.set.1234: description: Allows you to use set circle 1234 - default: true - circle.set.2223: + default: false + geometricmagic.set.2223: description: Allows you to use set circle 2223 - default: true - circle.set.2224: + default: false + geometricmagic.set.2224: description: Allows you to use set circle 2224 - default: true - circle.set.2244: + default: false + geometricmagic.set.2244: description: Allows you to use set circle 2244 - default: true - circle.set.2333: + default: false + geometricmagic.set.2333: description: Allows you to use set circle 2333 - default: true - circle.set.3334: + default: false + geometricmagic.set.3334: description: Allows you to use set circle 3334 - default: true - circle.set.3344: + default: false + geometricmagic.set.3344: description: Allows you to use set circle 1133 - default: true - circle.set.3444: + default: false + geometricmagic.set.3444: description: Allows you to use set circle 3444 - default: true - circle.set.0111: + default: false + geometricmagic.set.0111: description: Allows you to use set circle 0111 - default: true - circle.set.0044: + default: false + geometricmagic.set.0044: description: Allows you to use set circle 0044 - default: true - circle.set.0144: + default: false + geometricmagic.set.0144: description: Allows you to use set circle 0144 - default: true - circle.set.0244: + default: false + geometricmagic.set.0244: description: Allows you to use set circle 0244 - default: true - circle.set.0344: + default: false + geometricmagic.set.0344: description: Allows you to use set circle 0344 - default: true + default: false commands: setcircle: description: This command sets a sacrifice's right-click circle. - permission: GeometricMagic.setcircle - usage: /setcircle 3344 \ No newline at end of file + permission: geometricmagic.setcircle + usage: /setcircle <####> \ No newline at end of file diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagic.java b/src/me/cakenggt/GeometricMagic/GeometricMagic.java index b2f1173..46272bf 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagic.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagic.java @@ -19,7 +19,10 @@ package me.cakenggt.GeometricMagic; import java.io.File; +import java.io.FileOutputStream; import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; import java.io.PrintWriter; import java.util.Scanner; @@ -35,10 +38,10 @@ import org.bukkit.plugin.java.JavaPlugin; public class GeometricMagic extends JavaPlugin { - public static GeometricMagic plugin; private Listener playerListener; private Listener entityListener; private static Economy economy; + File configFile; public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { @@ -140,26 +143,69 @@ public void sacrificeCircle(CommandSender sender, String inputString) } } + @Override public void onDisable() { System.out.println(this + " is now disabled!"); } + @Override public void onEnable() { - - // Vault Support - if (!setupEconomy()) { + + configFile = new File(getDataFolder(), "config.yml"); + + // Copy default config file if it doesn't exist + if (!configFile.exists()) { + configFile.getParentFile().mkdirs(); + copy(this.getResource("config.yml"), configFile); + } + + // Copy config defaults + getConfig().options().copyDefaults(true); + + // Transmutation mode: Vault + if (getConfig().getString("transmutation.cost").toString().equalsIgnoreCase("vault")) { + // Vault Support + if (!setupEconomy()) { + System.out + .println("[" + this + "] ERROR: You have your transmutation system set to Vault, and yet you don't have Vault. Disabling plugin!"); + getServer().getPluginManager().disablePlugin(this); + } + else { + System.out + .println("[" + this + "] Transmutation cost system set to Vault"); + + // Register events + playerListener = new GeometricMagicPlayerListener(this); + entityListener = new GeometricMagicDamageListener(); + getServer().getPluginManager().registerEvents(playerListener, this); + getServer().getPluginManager().registerEvents(entityListener, this); + ShapelessRecipe portalRecipe = new ShapelessRecipe(new ItemStack( + Material.FIRE, 64)).addIngredient(Material.PORTAL); + getServer().addRecipe(portalRecipe); + System.out.println(this + " is now enabled!"); + } + } + // Transmutation mode: XP + else if (getConfig().getString("transmutation.cost").toString().equalsIgnoreCase("xp")) { System.out - .println("Economy system not found! GeometricMagic uses Vault to plug into economy systems."); + .println("[" + this + "] Transmutation cost system set to XP"); + + // Register events + playerListener = new GeometricMagicPlayerListener(this); + entityListener = new GeometricMagicDamageListener(); + getServer().getPluginManager().registerEvents(playerListener, this); + getServer().getPluginManager().registerEvents(entityListener, this); + ShapelessRecipe portalRecipe = new ShapelessRecipe(new ItemStack( + Material.FIRE, 64)).addIngredient(Material.PORTAL); + getServer().addRecipe(portalRecipe); + System.out.println(this + " is now enabled!"); + } + // Transmutation mode: Unknown + else { + System.out + .println("[" + this + "] ERROR: You have your transmutation cost system set to an unknown value. Disabling plugin!"); + getServer().getPluginManager().disablePlugin(this); } - - playerListener = new GeometricMagicPlayerListener(); - entityListener = new GeometricMagicDamageListener(); - getServer().getPluginManager().registerEvents(playerListener, this); - getServer().getPluginManager().registerEvents(entityListener, this); - ShapelessRecipe portalRecipe = new ShapelessRecipe(new ItemStack( - Material.FIRE, 64)).addIngredient(Material.PORTAL); - getServer().addRecipe(portalRecipe); - System.out.println(this + " is now enabled!"); } // Vault Support @@ -178,5 +224,21 @@ private boolean setupEconomy() { public static Economy getEconomy() { return economy; } - + + // Copy method + private void copy(InputStream in, File file) { + try { + OutputStream out = new FileOutputStream(file); + byte[] buf = new byte[1024]; + int len; + while((len=in.read(buf))>0){ + out.write(buf,0,len); + } + out.close(); + in.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } \ No newline at end of file diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 59f32d2..ccabf94 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -44,6 +44,10 @@ import org.bukkit.inventory.PlayerInventory; public class GeometricMagicPlayerListener implements Listener { + static GeometricMagic plugin = new GeometricMagic(); + public GeometricMagicPlayerListener(GeometricMagic instance) { + plugin = instance; + } public static Economy economy = null; @EventHandler(priority = EventPriority.HIGHEST) @@ -408,9 +412,16 @@ public static void teleportationCircle(Player player, World world, } public static void microCircle(Player player, World world, Block actBlock) { - Economy econ = GeometricMagic.getEconomy(); + if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { + Economy econ = GeometricMagic.getEconomy(); - player.sendMessage("You have " + econ.format(getBalance(player))); + // Tell the player how much money they have + player.sendMessage("You have " + econ.format(getBalance(player))); + } + else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + // Tell the player how many levels they have + player.sendMessage("Your experience level is " + player.getLevel()); + } List entitiesList = player.getNearbyEntities(100, 10, 100); for (int i = 0; i < entitiesList.size(); i++) { @@ -783,11 +794,18 @@ public static void setCircleEffects(Player player, World world, .getTypeId()] * droppedItem.getItemStack() .getAmount()); - Economy econ = GeometricMagic.getEconomy(); - if (pay > 0) { - econ.depositPlayer(player.getName(), pay); - } else if (pay < 0) { - econ.withdrawPlayer(player.getName(), pay * -1); + if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { + Economy econ = GeometricMagic.getEconomy(); + if (pay > 0) { + econ.depositPlayer(player.getName(), pay); + } else if (pay < 0) { + econ.withdrawPlayer(player.getName(), pay * -1); + } + } + else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + player.setLevel((valueArray[droppedItem.getItemStack() + .getTypeId()] * droppedItem.getItemStack() + .getAmount())); } /* * player.setLevel((valueArray[droppedItem.getItemStack() @@ -1532,27 +1550,31 @@ public static void alchemyFiller(Material a, Material b, byte toData, public static double getBalance(Player player) { - Economy econ = GeometricMagic.getEconomy(); + if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { + Economy econ = GeometricMagic.getEconomy(); - double balance = econ.getBalance(player.getName()); + double balance = econ.getBalance(player.getName()); - return balance; + return balance; + } + else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + double balance = player.getLevel(); + + return balance; + } + return 0; } public static void transmuteBlock(Material a, Material b, byte toData, Block startBlock, Player player) { - - Economy econ = GeometricMagic.getEconomy(); - - double balance = getBalance(player); - + int pay = calculatePay(a, b); pay = (int) (pay * philosopherStoneModifier(player)); BlockState startBlockState = startBlock.getState(); if (startBlock.getType() == a) { - if (-1 * balance < pay) { + if (-1 * getBalance(player) < pay) { // disallow transmuting of mob spawners completely // block break @@ -1563,8 +1585,7 @@ public static void transmuteBlock(Material a, Material b, byte toData, && a != Material.BREWING_STAND && a != Material.WOODEN_DOOR && a != Material.IRON_DOOR_BLOCK - && a != Material.MOB_SPAWNER - && b != Material.MOB_SPAWNER) { + && a != Material.MOB_SPAWNER) { // block break event BlockBreakEvent break_event = new BlockBreakEvent( @@ -1577,17 +1598,25 @@ public static void transmuteBlock(Material a, Material b, byte toData, if (toData != 0) startBlock.setData(toData); - // deposit or withdraw to players Vault account - if (pay > 0) { - econ.depositPlayer(player.getName(), pay); - } else if (pay < 0) { - econ.withdrawPlayer(player.getName(), pay * -1); + if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { + + Economy econ = GeometricMagic.getEconomy(); + + + // deposit or withdraw to players Vault account + if (pay > 0) { + econ.depositPlayer(player.getName(), pay); + } else if (pay < 0) { + econ.withdrawPlayer(player.getName(), pay * -1); + } + } + else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + player.setLevel((int) (player.getLevel() + (pay * philosopherStoneModifier(player)))); } } // block place else if (a == Material.AIR && b != Material.AIR - && a != Material.MOB_SPAWNER && b != Material.MOB_SPAWNER) { // change block @@ -1595,13 +1624,22 @@ else if (a == Material.AIR && b != Material.AIR if (toData != 0) startBlock.setData(toData); - // deposit or withdraw to players Vault account - if (pay > 0) { - econ.depositPlayer(player.getName(), pay); - } else if (pay < 0) { - econ.withdrawPlayer(player.getName(), pay * -1); - } + if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { + + Economy econ = GeometricMagic.getEconomy(); + + // deposit or withdraw to players Vault account + if (pay > 0) { + econ.depositPlayer(player.getName(), pay); + } else if (pay < 0) { + econ.withdrawPlayer(player.getName(), pay * -1); + } + } + else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + player.setLevel((int) (player.getLevel() + (pay * philosopherStoneModifier(player)))); + } + // block place event BlockPlaceEvent place_event = new BlockPlaceEvent( startBlock, startBlockState, startBlock, @@ -1632,11 +1670,20 @@ else if (a != Material.AIR && b != Material.AIR if (toData != 0) startBlock.setData(toData); - // deposit or withdraw to players Vault account - if (pay > 0) { - econ.depositPlayer(player.getName(), pay); - } else if (pay < 0) { - econ.withdrawPlayer(player.getName(), pay * -1); + if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { + + Economy econ = GeometricMagic.getEconomy(); + + + // deposit or withdraw to players Vault account + if (pay > 0) { + econ.depositPlayer(player.getName(), pay); + } else if (pay < 0) { + econ.withdrawPlayer(player.getName(), pay * -1); + } + } + else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + player.setLevel((int) (player.getLevel() + (pay * philosopherStoneModifier(player)))); } // block place event @@ -2064,4 +2111,8 @@ public static boolean learnCircle(Player player, String circle, redStack.remove(); return status; } + + public static String getTransmutationCostSystem(GeometricMagic plugin) { + return plugin.getConfig().getString("transmutation.cost").toString(); + } } From b4fc9e0001aaf23a322f357fddd3a8f4feaa31d8 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Wed, 13 Jun 2012 20:51:54 -0400 Subject: [PATCH 037/133] Hacky 'pull' from ty2u --- .../GeometricMagic/GeometricMagicPlayerListener.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index ccabf94..1e4df0f 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -755,6 +755,10 @@ public static void setCircleEffects(Player player, World world, if (droppedItem.getItemStack().getTypeId() == 261) cost = droppedItem.getItemStack().getDurability(); cost = cost / 50; + + // Make sure cost is not more than 20 + if (cost > 20) cost = 20; + if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); ItemStack newItem = new ItemStack(droppedItem @@ -1026,6 +1030,10 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { cost = 2; int size = setCircleSize(actBlock); cost = 2 + size / 2; + + // Make sure cost is not more than 20 + if (cost > 20) cost = 20; + if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " + arrayString + "!"); @@ -1061,6 +1069,10 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { cost = 4; int size = setCircleSize(actBlock); cost = 4 + size / 2; + + // Make sure cost is not more than 20 + if (cost > 20) cost = 20; + if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " + arrayString + "!"); From 16311c4a3a8d0685e19f71c41b669c0062dcb3be Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Wed, 13 Jun 2012 20:56:09 -0400 Subject: [PATCH 038/133] v2.4 --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index 7b2cd7e..f8e3b50 100644 --- a/plugin.yml +++ b/plugin.yml @@ -18,7 +18,7 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.3 +version: 2.4 author: cakenggt, Hoot215 softdepend: [Vault] permissions: From 215d45108a91923d5c7d3a535cd6b661e8a7b5db Mon Sep 17 00:00:00 2001 From: ty2u Date: Wed, 13 Jun 2012 21:21:12 -0400 Subject: [PATCH 039/133] Set Circle 1133 now keeps enchants when repairing items. --- .../GeometricMagicPlayerListener.java | 122 +++++++++--------- 1 file changed, 63 insertions(+), 59 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 3c2ec66..c640765 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -3,6 +3,7 @@ import java.io.*; import java.util.Arrays; import java.util.List; +import java.util.Map; import java.util.Scanner; import net.milkbowl.vault.economy.Economy; @@ -13,6 +14,7 @@ import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.*; +import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.*; //import org.bukkit.event.Event; import org.bukkit.event.EventHandler; @@ -646,94 +648,94 @@ public static void setCircleEffects(Player player, World world, + arrayString + "!"); return; } + List repairEntities = player.getNearbyEntities(9, 10, 9); for (int i = 0; i < repairEntities.size(); i++) { if (repairEntities.get(i) instanceof Item) { Item droppedItem = (Item) repairEntities.get(i); - if ((256 <= droppedItem.getItemStack().getTypeId() && droppedItem - .getItemStack().getTypeId() <= 258) - || (267 <= droppedItem.getItemStack().getTypeId() && droppedItem - .getItemStack().getTypeId() <= 279) - || (283 <= droppedItem.getItemStack().getTypeId() && droppedItem - .getItemStack().getTypeId() <= 286) - || (290 <= droppedItem.getItemStack().getTypeId() && droppedItem - .getItemStack().getTypeId() <= 294) - || (298 <= droppedItem.getItemStack().getTypeId() && droppedItem - .getItemStack().getTypeId() <= 317) - || droppedItem.getItemStack().getTypeId() == 259 - || droppedItem.getItemStack().getTypeId() == 346 - || droppedItem.getItemStack().getTypeId() == 359 - || droppedItem.getItemStack().getTypeId() == 261) { - if ((256 <= droppedItem.getItemStack().getTypeId() && droppedItem - .getItemStack().getTypeId() <= 258) - || droppedItem.getItemStack().getTypeId() == 267 - || droppedItem.getItemStack().getTypeId() == 292) + + // item data value + int itemCode = droppedItem.getItemStack().getTypeId(); + + // enchants + Map effects = droppedItem.getItemStack().getEnchantments(); + + // get cost + if ((256 <= itemCode && itemCode <= 258) + || (267 <= itemCode && itemCode <= 279) + || (283 <= itemCode && itemCode <= 286) + || (290 <= itemCode && itemCode <= 294) + || (298 <= itemCode && itemCode <= 317) + || itemCode == 259 || itemCode == 346 + || itemCode == 359 || itemCode == 261) { + if ((256 <= itemCode && itemCode <= 258) + || itemCode == 267 || itemCode == 292) cost = droppedItem.getItemStack().getDurability(); - if ((268 <= droppedItem.getItemStack().getTypeId() && droppedItem - .getItemStack().getTypeId() <= 271) - || droppedItem.getItemStack().getTypeId() == 290) + if ((268 <= itemCode && itemCode <= 271) + || itemCode == 290) cost = droppedItem.getItemStack().getDurability(); - if ((272 <= droppedItem.getItemStack().getTypeId() && droppedItem - .getItemStack().getTypeId() <= 275) - || droppedItem.getItemStack().getTypeId() == 291) + if ((272 <= itemCode && itemCode <= 275) + || itemCode == 291) cost = droppedItem.getItemStack().getDurability(); - if ((276 <= droppedItem.getItemStack().getTypeId() && droppedItem - .getItemStack().getTypeId() <= 279) - || droppedItem.getItemStack().getTypeId() == 293) + if ((276 <= itemCode && itemCode <= 279) + || itemCode == 293) cost = droppedItem.getItemStack().getDurability(); - if ((283 <= droppedItem.getItemStack().getTypeId() && droppedItem - .getItemStack().getTypeId() <= 286) - || droppedItem.getItemStack().getTypeId() == 294) + if ((283 <= itemCode && itemCode <= 286) + || itemCode == 294) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 298) + if (itemCode == 298) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 299) + if (itemCode == 299) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 300) + if (itemCode == 300) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 301) + if (itemCode == 301) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 306) + if (itemCode == 306) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 307) + if (itemCode == 307) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 308) + if (itemCode == 308) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 309) + if (itemCode == 309) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 310) + if (itemCode == 310) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 311) + if (itemCode == 311) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 312) + if (itemCode == 312) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 313) + if (itemCode == 313) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 314) + if (itemCode == 314) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 315) + if (itemCode == 315) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 316) + if (itemCode == 316) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 317) + if (itemCode == 317) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 259) + if (itemCode == 259) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 346) + if (itemCode == 346) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 359) + if (itemCode == 359) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 261) + if (itemCode == 261) cost = droppedItem.getItemStack().getDurability(); cost = cost / 50; - + // make sure cost is not more than 20 - if(cost > 20) cost = 20; - + if (cost > 20) + cost = 20; + if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); - ItemStack newItem = new ItemStack(droppedItem - .getItemStack().getTypeId(), 1); + ItemStack newItem = new ItemStack(itemCode, 1); + + // enchant the item + newItem.addEnchantments(effects); + droppedItem.remove(); effectBlock.getWorld().dropItem( effectBlock.getLocation(), newItem); @@ -994,9 +996,10 @@ public static void setCircleEffects(Player player, World world, cost = 2; int size = setCircleSize(actBlock); cost = 2 + size / 2; - + // make sure cost is not more than 20 - if(cost > 20) cost = 20; + if (cost > 20) + cost = 20; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " @@ -1033,9 +1036,10 @@ public static void setCircleEffects(Player player, World world, cost = 4; int size = setCircleSize(actBlock); cost = 4 + size / 2; - + // make sure cost is not more than 20 - if(cost > 20) cost = 20; + if (cost > 20) + cost = 20; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " From b74d838f4b6f33cb75c78a79ec3955cf57d3ba60 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Thu, 14 Jun 2012 15:57:07 -0400 Subject: [PATCH 040/133] Updated .gitignore --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index a448cea..f847b09 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,7 @@ ########## .directory *~ + +# Unknown # +########### +*.orig From cc6e971c82b6de17b9a031ea90b9cdd56e990a72 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Thu, 14 Jun 2012 15:59:52 -0400 Subject: [PATCH 041/133] Where do these .orig files come from anyway? --- .../GeometricMagic/GeometricMagic.java.orig | 199 ------------------ .../GeometricMagic/GeometricMagic.java.orig | 199 ------------------ 2 files changed, 398 deletions(-) delete mode 100644 bin/me/cakenggt/GeometricMagic/GeometricMagic.java.orig delete mode 100644 src/me/cakenggt/GeometricMagic/GeometricMagic.java.orig diff --git a/bin/me/cakenggt/GeometricMagic/GeometricMagic.java.orig b/bin/me/cakenggt/GeometricMagic/GeometricMagic.java.orig deleted file mode 100644 index da535de..0000000 --- a/bin/me/cakenggt/GeometricMagic/GeometricMagic.java.orig +++ /dev/null @@ -1,199 +0,0 @@ -/** - * GeometricMagic allows players to draw redstone circles on the ground to do things such as teleport and transmute blocks. - * Copyright (C) 2012 Alec Cox (cakenggt), Andrew Stevanus (Hoot215) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package me.cakenggt.GeometricMagic; - -import java.io.File; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Scanner; - -import net.milkbowl.vault.economy.Economy; - -import org.bukkit.Material; -import org.bukkit.command.*; -import org.bukkit.entity.Player; -import org.bukkit.event.Listener; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.ShapelessRecipe; -import org.bukkit.plugin.RegisteredServiceProvider; -import org.bukkit.plugin.java.JavaPlugin; - -public class GeometricMagic extends JavaPlugin { - public static GeometricMagic plugin; - private Listener playerListener; - private Listener entityListener; -<<<<<<< HEAD - private Listener deathListener; - public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){ - if(cmd.getName().equalsIgnoreCase("setcircle")){ // If the player typed /set then do the following... - //[1, 1, 3, 3] - Player player = null; - if (sender instanceof Player) { - player = (Player) sender; - } - if (player == null) { - sender.sendMessage("This command can only be run by a player"); - return false; - } - if (args.length == 0){ - ItemStack oneFlint = new ItemStack(318, 1); -======= - private static Economy economy; - - public boolean onCommand(CommandSender sender, Command cmd, - String commandLabel, String[] args) { - - // If the player typed /setcircle then do the following... - if (cmd.getName().equalsIgnoreCase("setcircle")) { - // [1, 1, 3, 3] - Player player = null; - if (sender instanceof Player) { - player = (Player) sender; - } - if (player == null) { - sender.sendMessage("This command can only be run by a player"); - return false; - } - if (args.length == 0) { - ItemStack oneFlint = new ItemStack(318, 1); ->>>>>>> dev - player.getWorld().dropItem(player.getLocation(), oneFlint); - return true; - } - if (args.length != 1) { - sender.sendMessage(cmd.getUsage()); - return false; - } - if (args[0].length() != 4 && args[0].length() != 1) { - sender.sendMessage(cmd.getUsage()); - return false; - } - if (args[0].length() == 1 && args[0].equalsIgnoreCase("0")) { - sender.sendMessage("Casting circles on right click now disabled, set right click to a viable circle to enable"); - String inputString = args[0]; - try { - sacrificeCircle(sender, inputString); - } catch (IOException e) { - e.printStackTrace(); - } - return true; - } else { - String inputString = "[" + args[0].charAt(0) + ", " - + args[0].charAt(1) + ", " + args[0].charAt(2) + ", " - + args[0].charAt(3) + "]"; - try { - sacrificeCircle(sender, inputString); - } catch (IOException e) { - e.printStackTrace(); - } - return true; - } - } - // If this has happened the function will break and return true. if this - // hasn't happened the a value of false will be returned. - return false; - } - - public void sacrificeCircle(CommandSender sender, String inputString) - throws IOException { - // System.out.println("sacrificeCircle for " + inputString); - File myFile = new File("plugins/GeometricMagic/sacrifices.txt"); - if (myFile.exists()) { - Scanner inputFileCheck = new Scanner(myFile); - int j = 0; - while (inputFileCheck.hasNext()) { - inputFileCheck.nextLine(); - j++; - } - int size = (j + 1) / 2; - // System.out.println("size of sacrifices file " + size); - String[] nameArray = new String[size]; - String[] circleArray = new String[size]; - inputFileCheck.close(); - // System.out.println("inputFileCheck closed"); - Scanner inputFile = new Scanner(myFile); - // System.out.println("inputFile opened"); - for (int i = 0; i < size; i++) { - nameArray[i] = inputFile.nextLine(); - circleArray[i] = inputFile.nextLine(); - } - // System.out.println("nameArray[0] is " + nameArray[0]); - // System.out.println("circleArray[0] is " + circleArray[0]); - for (int i = 0; i < size; i++) { - if (nameArray[i].equalsIgnoreCase(sender.getName())) { - circleArray[i] = inputString; - sender.sendMessage("set-circle " + inputString - + " added successfully!"); - } - } - // System.out.println("nameArray[0] is " + nameArray[0]); - // System.out.println("circleArray[0] is " + circleArray[0]); - inputFile.close(); - PrintWriter outputFile = new PrintWriter( - "plugins/GeometricMagic/sacrifices.txt"); - for (int i = 0; i < size; i++) { - outputFile.println(nameArray[i]); - outputFile.println(circleArray[i]); - } - outputFile.close(); - } else { - return; - } - } - - public void onDisable() { - System.out.println(this + " is now disabled!"); - } - - public void onEnable() { - - // Vault Support - if (!setupEconomy()) { - System.out - .println("Economy system not found! GeometricMagic uses Vault to plug into economy systems."); - } - - playerListener = new GeometricMagicPlayerListener(); - entityListener = new GeometricMagicDamageListener(); - getServer().getPluginManager().registerEvents(playerListener, this); - getServer().getPluginManager().registerEvents(entityListener, this); - ShapelessRecipe portalRecipe = new ShapelessRecipe(new ItemStack( - Material.FIRE, 64)).addIngredient(Material.PORTAL); - getServer().addRecipe(portalRecipe); - System.out.println(this + " is now enabled!"); - } - - // Vault Support - private boolean setupEconomy() { - RegisteredServiceProvider economyProvider = getServer() - .getServicesManager().getRegistration( - net.milkbowl.vault.economy.Economy.class); - if (economyProvider != null) { - economy = economyProvider.getProvider(); - } - - return (economy != null); - } - - // Vault Support - public static Economy getEconomy() { - return economy; - } - -} \ No newline at end of file diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagic.java.orig b/src/me/cakenggt/GeometricMagic/GeometricMagic.java.orig deleted file mode 100644 index da535de..0000000 --- a/src/me/cakenggt/GeometricMagic/GeometricMagic.java.orig +++ /dev/null @@ -1,199 +0,0 @@ -/** - * GeometricMagic allows players to draw redstone circles on the ground to do things such as teleport and transmute blocks. - * Copyright (C) 2012 Alec Cox (cakenggt), Andrew Stevanus (Hoot215) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package me.cakenggt.GeometricMagic; - -import java.io.File; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Scanner; - -import net.milkbowl.vault.economy.Economy; - -import org.bukkit.Material; -import org.bukkit.command.*; -import org.bukkit.entity.Player; -import org.bukkit.event.Listener; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.ShapelessRecipe; -import org.bukkit.plugin.RegisteredServiceProvider; -import org.bukkit.plugin.java.JavaPlugin; - -public class GeometricMagic extends JavaPlugin { - public static GeometricMagic plugin; - private Listener playerListener; - private Listener entityListener; -<<<<<<< HEAD - private Listener deathListener; - public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){ - if(cmd.getName().equalsIgnoreCase("setcircle")){ // If the player typed /set then do the following... - //[1, 1, 3, 3] - Player player = null; - if (sender instanceof Player) { - player = (Player) sender; - } - if (player == null) { - sender.sendMessage("This command can only be run by a player"); - return false; - } - if (args.length == 0){ - ItemStack oneFlint = new ItemStack(318, 1); -======= - private static Economy economy; - - public boolean onCommand(CommandSender sender, Command cmd, - String commandLabel, String[] args) { - - // If the player typed /setcircle then do the following... - if (cmd.getName().equalsIgnoreCase("setcircle")) { - // [1, 1, 3, 3] - Player player = null; - if (sender instanceof Player) { - player = (Player) sender; - } - if (player == null) { - sender.sendMessage("This command can only be run by a player"); - return false; - } - if (args.length == 0) { - ItemStack oneFlint = new ItemStack(318, 1); ->>>>>>> dev - player.getWorld().dropItem(player.getLocation(), oneFlint); - return true; - } - if (args.length != 1) { - sender.sendMessage(cmd.getUsage()); - return false; - } - if (args[0].length() != 4 && args[0].length() != 1) { - sender.sendMessage(cmd.getUsage()); - return false; - } - if (args[0].length() == 1 && args[0].equalsIgnoreCase("0")) { - sender.sendMessage("Casting circles on right click now disabled, set right click to a viable circle to enable"); - String inputString = args[0]; - try { - sacrificeCircle(sender, inputString); - } catch (IOException e) { - e.printStackTrace(); - } - return true; - } else { - String inputString = "[" + args[0].charAt(0) + ", " - + args[0].charAt(1) + ", " + args[0].charAt(2) + ", " - + args[0].charAt(3) + "]"; - try { - sacrificeCircle(sender, inputString); - } catch (IOException e) { - e.printStackTrace(); - } - return true; - } - } - // If this has happened the function will break and return true. if this - // hasn't happened the a value of false will be returned. - return false; - } - - public void sacrificeCircle(CommandSender sender, String inputString) - throws IOException { - // System.out.println("sacrificeCircle for " + inputString); - File myFile = new File("plugins/GeometricMagic/sacrifices.txt"); - if (myFile.exists()) { - Scanner inputFileCheck = new Scanner(myFile); - int j = 0; - while (inputFileCheck.hasNext()) { - inputFileCheck.nextLine(); - j++; - } - int size = (j + 1) / 2; - // System.out.println("size of sacrifices file " + size); - String[] nameArray = new String[size]; - String[] circleArray = new String[size]; - inputFileCheck.close(); - // System.out.println("inputFileCheck closed"); - Scanner inputFile = new Scanner(myFile); - // System.out.println("inputFile opened"); - for (int i = 0; i < size; i++) { - nameArray[i] = inputFile.nextLine(); - circleArray[i] = inputFile.nextLine(); - } - // System.out.println("nameArray[0] is " + nameArray[0]); - // System.out.println("circleArray[0] is " + circleArray[0]); - for (int i = 0; i < size; i++) { - if (nameArray[i].equalsIgnoreCase(sender.getName())) { - circleArray[i] = inputString; - sender.sendMessage("set-circle " + inputString - + " added successfully!"); - } - } - // System.out.println("nameArray[0] is " + nameArray[0]); - // System.out.println("circleArray[0] is " + circleArray[0]); - inputFile.close(); - PrintWriter outputFile = new PrintWriter( - "plugins/GeometricMagic/sacrifices.txt"); - for (int i = 0; i < size; i++) { - outputFile.println(nameArray[i]); - outputFile.println(circleArray[i]); - } - outputFile.close(); - } else { - return; - } - } - - public void onDisable() { - System.out.println(this + " is now disabled!"); - } - - public void onEnable() { - - // Vault Support - if (!setupEconomy()) { - System.out - .println("Economy system not found! GeometricMagic uses Vault to plug into economy systems."); - } - - playerListener = new GeometricMagicPlayerListener(); - entityListener = new GeometricMagicDamageListener(); - getServer().getPluginManager().registerEvents(playerListener, this); - getServer().getPluginManager().registerEvents(entityListener, this); - ShapelessRecipe portalRecipe = new ShapelessRecipe(new ItemStack( - Material.FIRE, 64)).addIngredient(Material.PORTAL); - getServer().addRecipe(portalRecipe); - System.out.println(this + " is now enabled!"); - } - - // Vault Support - private boolean setupEconomy() { - RegisteredServiceProvider economyProvider = getServer() - .getServicesManager().getRegistration( - net.milkbowl.vault.economy.Economy.class); - if (economyProvider != null) { - economy = economyProvider.getProvider(); - } - - return (economy != null); - } - - // Vault Support - public static Economy getEconomy() { - return economy; - } - -} \ No newline at end of file From a61e99f3eede53b32bf5a4ff5d49a1b8e4c6ee92 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Thu, 14 Jun 2012 16:59:42 -0400 Subject: [PATCH 042/133] Another 'fake' merge from ty2u --- .../GeometricMagicPlayerListener.java | 116 +++++++++--------- 1 file changed, 60 insertions(+), 56 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 1e4df0f..e21b6c1 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -21,6 +21,7 @@ import java.io.*; import java.util.Arrays; import java.util.List; +import java.util.Map; import java.util.Scanner; import net.milkbowl.vault.economy.Economy; @@ -31,6 +32,7 @@ import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.*; +import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.*; //import org.bukkit.event.Event; import org.bukkit.event.EventHandler; @@ -675,94 +677,94 @@ public static void setCircleEffects(Player player, World world, + arrayString + "!"); return; } + List repairEntities = player.getNearbyEntities(9, 10, 9); for (int i = 0; i < repairEntities.size(); i++) { if (repairEntities.get(i) instanceof Item) { Item droppedItem = (Item) repairEntities.get(i); - if ((256 <= droppedItem.getItemStack().getTypeId() && droppedItem - .getItemStack().getTypeId() <= 258) - || (267 <= droppedItem.getItemStack().getTypeId() && droppedItem - .getItemStack().getTypeId() <= 279) - || (283 <= droppedItem.getItemStack().getTypeId() && droppedItem - .getItemStack().getTypeId() <= 286) - || (290 <= droppedItem.getItemStack().getTypeId() && droppedItem - .getItemStack().getTypeId() <= 294) - || (298 <= droppedItem.getItemStack().getTypeId() && droppedItem - .getItemStack().getTypeId() <= 317) - || droppedItem.getItemStack().getTypeId() == 259 - || droppedItem.getItemStack().getTypeId() == 346 - || droppedItem.getItemStack().getTypeId() == 359 - || droppedItem.getItemStack().getTypeId() == 261) { - if ((256 <= droppedItem.getItemStack().getTypeId() && droppedItem - .getItemStack().getTypeId() <= 258) - || droppedItem.getItemStack().getTypeId() == 267 - || droppedItem.getItemStack().getTypeId() == 292) + + // Item data value + int itemCode = droppedItem.getItemStack().getTypeId(); + + // Enchantments + Map effects = droppedItem.getItemStack().getEnchantments(); + + // Get cost + if ((256 <= itemCode && itemCode <= 258) + || (267 <= itemCode && itemCode <= 279) + || (283 <= itemCode && itemCode <= 286) + || (290 <= itemCode && itemCode <= 294) + || (298 <= itemCode && itemCode <= 317) + || itemCode == 259 || itemCode == 346 + || itemCode == 359 || itemCode == 261) { + if ((256 <= itemCode && itemCode <= 258) + || itemCode == 267 || itemCode == 292) cost = droppedItem.getItemStack().getDurability(); - if ((268 <= droppedItem.getItemStack().getTypeId() && droppedItem - .getItemStack().getTypeId() <= 271) - || droppedItem.getItemStack().getTypeId() == 290) + if ((268 <= itemCode && itemCode <= 271) + || itemCode == 290) cost = droppedItem.getItemStack().getDurability(); - if ((272 <= droppedItem.getItemStack().getTypeId() && droppedItem - .getItemStack().getTypeId() <= 275) - || droppedItem.getItemStack().getTypeId() == 291) + if ((272 <= itemCode && itemCode <= 275) + || itemCode == 291) cost = droppedItem.getItemStack().getDurability(); - if ((276 <= droppedItem.getItemStack().getTypeId() && droppedItem - .getItemStack().getTypeId() <= 279) - || droppedItem.getItemStack().getTypeId() == 293) + if ((276 <= itemCode && itemCode <= 279) + || itemCode == 293) cost = droppedItem.getItemStack().getDurability(); - if ((283 <= droppedItem.getItemStack().getTypeId() && droppedItem - .getItemStack().getTypeId() <= 286) - || droppedItem.getItemStack().getTypeId() == 294) + if ((283 <= itemCode && itemCode <= 286) + || itemCode == 294) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 298) + if (itemCode == 298) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 299) + if (itemCode == 299) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 300) + if (itemCode == 300) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 301) + if (itemCode == 301) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 306) + if (itemCode == 306) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 307) + if (itemCode == 307) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 308) + if (itemCode == 308) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 309) + if (itemCode == 309) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 310) + if (itemCode == 310) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 311) + if (itemCode == 311) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 312) + if (itemCode == 312) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 313) + if (itemCode == 313) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 314) + if (itemCode == 314) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 315) + if (itemCode == 315) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 316) + if (itemCode == 316) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 317) + if (itemCode == 317) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 259) + if (itemCode == 259) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 346) + if (itemCode == 346) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 359) + if (itemCode == 359) cost = droppedItem.getItemStack().getDurability(); - if (droppedItem.getItemStack().getTypeId() == 261) + if (itemCode == 261) cost = droppedItem.getItemStack().getDurability(); cost = cost / 50; // Make sure cost is not more than 20 - if (cost > 20) cost = 20; + if (cost > 20) + cost = 20; if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); - ItemStack newItem = new ItemStack(droppedItem - .getItemStack().getTypeId(), 1); + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + ItemStack newItem = new ItemStack(itemCode, 1); + + // enchant the item + newItem.addEnchantments(effects); + droppedItem.remove(); effectBlock.getWorld().dropItem( effectBlock.getLocation(), newItem); @@ -1032,7 +1034,8 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { cost = 2 + size / 2; // Make sure cost is not more than 20 - if (cost > 20) cost = 20; + if (cost > 20) + cost = 20; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " @@ -1071,7 +1074,8 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { cost = 4 + size / 2; // Make sure cost is not more than 20 - if (cost > 20) cost = 20; + if (cost > 20) + cost = 20; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " From 1299b4e736b269efe80804d338fab263b344198c Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Thu, 14 Jun 2012 17:00:29 -0400 Subject: [PATCH 043/133] v2.4.1 (Beta) --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index f8e3b50..e1c58c8 100644 --- a/plugin.yml +++ b/plugin.yml @@ -18,7 +18,7 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.4 +version: 2.4.1 author: cakenggt, Hoot215 softdepend: [Vault] permissions: From 9f8bb08c7a367f7d3f095944ecdc30546dae37a2 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Thu, 14 Jun 2012 19:04:51 -0400 Subject: [PATCH 044/133] Plugin Metrics --- .../GeometricMagic/GeometricMagic.java | 11 + src/me/cakenggt/GeometricMagic/Metrics.java | 607 ++++++++++++++++++ 2 files changed, 618 insertions(+) create mode 100644 src/me/cakenggt/GeometricMagic/Metrics.java diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagic.java b/src/me/cakenggt/GeometricMagic/GeometricMagic.java index 46272bf..8c2c739 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagic.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagic.java @@ -206,6 +206,9 @@ else if (getConfig().getString("transmutation.cost").toString().equalsIgnoreCase .println("[" + this + "] ERROR: You have your transmutation cost system set to an unknown value. Disabling plugin!"); getServer().getPluginManager().disablePlugin(this); } + + // Plugin metrics + startPluginMetrics(); } // Vault Support @@ -241,4 +244,12 @@ private void copy(InputStream in, File file) { } } + private void startPluginMetrics() { + try { + Metrics metrics = new Metrics(this); + metrics.start(); + } catch (IOException e) { + // Failed to submit the stats :-( + } + } } \ No newline at end of file diff --git a/src/me/cakenggt/GeometricMagic/Metrics.java b/src/me/cakenggt/GeometricMagic/Metrics.java new file mode 100644 index 0000000..0f10dc1 --- /dev/null +++ b/src/me/cakenggt/GeometricMagic/Metrics.java @@ -0,0 +1,607 @@ +/** + * GeometricMagic allows players to draw redstone circles on the ground to do things such as teleport and transmute blocks. + * Copyright (C) 2012 Alec Cox (cakenggt), Andrew Stevanus (Hoot215) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package me.cakenggt.GeometricMagic; + +import org.bukkit.Bukkit; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.configuration.InvalidConfigurationException; +import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.PluginDescriptionFile; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; +import java.net.Proxy; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.Set; +import java.util.UUID; +import java.util.logging.Level; + +/** + *

+ * The metrics class obtains data about a plugin and submits statistics about it to the metrics backend. + *

+ *

+ * Public methods provided by this class: + *

+ * + * Graph createGraph(String name);
+ * void addCustomData(Metrics.Plotter plotter);
+ * void start();
+ *
+ */ +public class Metrics { + + /** + * The current revision number + */ + private final static int REVISION = 5; + + /** + * The base url of the metrics domain + */ + private static final String BASE_URL = "http://mcstats.org"; + + /** + * The url used to report a server's status + */ + private static final String REPORT_URL = "/report/%s"; + + /** + * The file where guid and opt out is stored in + */ + private static final String CONFIG_FILE = "plugins/PluginMetrics/config.yml"; + + /** + * The separator to use for custom data. This MUST NOT change unless you are hosting your own + * version of metrics and want to change it. + */ + private static final String CUSTOM_DATA_SEPARATOR = "~~"; + + /** + * Interval of time to ping (in minutes) + */ + private static final int PING_INTERVAL = 10; + + /** + * The plugin this metrics submits for + */ + private final Plugin plugin; + + /** + * All of the custom graphs to submit to metrics + */ + private final Set graphs = Collections.synchronizedSet(new HashSet()); + + /** + * The default graph, used for addCustomData when you don't want a specific graph + */ + private final Graph defaultGraph = new Graph("Default"); + + /** + * The plugin configuration file + */ + private final YamlConfiguration configuration; + + /** + * The plugin configuration file + */ + private final File configurationFile; + + /** + * Unique server id + */ + private final String guid; + + /** + * Lock for synchronization + */ + private final Object optOutLock = new Object(); + + /** + * Id of the scheduled task + */ + private volatile int taskId = -1; + + public Metrics(final Plugin plugin) throws IOException { + if (plugin == null) { + throw new IllegalArgumentException("Plugin cannot be null"); + } + + this.plugin = plugin; + + // load the config + configurationFile = new File(CONFIG_FILE); + configuration = YamlConfiguration.loadConfiguration(configurationFile); + + // add some defaults + configuration.addDefault("opt-out", false); + configuration.addDefault("guid", UUID.randomUUID().toString()); + + // Do we need to create the file? + if (configuration.get("guid", null) == null) { + configuration.options().header("http://mcstats.org").copyDefaults(true); + configuration.save(configurationFile); + } + + // Load the guid then + guid = configuration.getString("guid"); + } + + /** + * Construct and create a Graph that can be used to separate specific plotters to their own graphs + * on the metrics website. Plotters can be added to the graph object returned. + * + * @param name + * @return Graph object created. Will never return NULL under normal circumstances unless bad parameters are given + */ + public Graph createGraph(final String name) { + if (name == null) { + throw new IllegalArgumentException("Graph name cannot be null"); + } + + // Construct the graph object + final Graph graph = new Graph(name); + + // Now we can add our graph + graphs.add(graph); + + // and return back + return graph; + } + + /** + * Add a Graph object to Metrics that represents data for the plugin that should be sent to the backend + * + * @param graph + */ + public void addGraph(final Graph graph) { + if (graph == null) { + throw new IllegalArgumentException("Graph cannot be null"); + } + + graphs.add(graph); + } + + /** + * Adds a custom data plotter to the default graph + * + * @param plotter + */ + public void addCustomData(final Plotter plotter) { + if (plotter == null) { + throw new IllegalArgumentException("Plotter cannot be null"); + } + + // Add the plotter to the graph o/ + defaultGraph.addPlotter(plotter); + + // Ensure the default graph is included in the submitted graphs + graphs.add(defaultGraph); + } + + /** + * Start measuring statistics. This will immediately create an async repeating task as the plugin and send + * the initial data to the metrics backend, and then after that it will post in increments of + * PING_INTERVAL * 1200 ticks. + * + * @return True if statistics measuring is running, otherwise false. + */ + public boolean start() { + synchronized (optOutLock) { + // Did we opt out? + if (isOptOut()) { + return false; + } + + // Is metrics already running? + if (taskId >= 0) { + return true; + } + + // Begin hitting the server with glorious data + taskId = plugin.getServer().getScheduler().scheduleAsyncRepeatingTask(plugin, new Runnable() { + + private boolean firstPost = true; + + public void run() { + try { + // This has to be synchronized or it can collide with the disable method. + synchronized (optOutLock) { + // Disable Task, if it is running and the server owner decided to opt-out + if (isOptOut() && taskId > 0) { + plugin.getServer().getScheduler().cancelTask(taskId); + taskId = -1; + // Tell all plotters to stop gathering information. + for (Graph graph : graphs){ + graph.onOptOut(); + } + } + } + + // We use the inverse of firstPost because if it is the first time we are posting, + // it is not a interval ping, so it evaluates to FALSE + // Each time thereafter it will evaluate to TRUE, i.e PING! + postPlugin(!firstPost); + + // After the first post we set firstPost to false + // Each post thereafter will be a ping + firstPost = false; + } catch (IOException e) { + Bukkit.getLogger().log(Level.INFO, "[Metrics] " + e.getMessage()); + } + } + }, 0, PING_INTERVAL * 1200); + + return true; + } + } + + /** + * Has the server owner denied plugin metrics? + * + * @return + */ + public boolean isOptOut() { + synchronized(optOutLock) { + try { + // Reload the metrics file + configuration.load(CONFIG_FILE); + } catch (IOException ex) { + Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); + return true; + } catch (InvalidConfigurationException ex) { + Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); + return true; + } + return configuration.getBoolean("opt-out", false); + } + } + + /** + * Enables metrics for the server by setting "opt-out" to false in the config file and starting the metrics task. + * + * @throws IOException + */ + public void enable() throws IOException { + // This has to be synchronized or it can collide with the check in the task. + synchronized (optOutLock) { + // Check if the server owner has already set opt-out, if not, set it. + if (isOptOut()) { + configuration.set("opt-out", false); + configuration.save(configurationFile); + } + + // Enable Task, if it is not running + if (taskId < 0) { + start(); + } + } + } + + /** + * Disables metrics for the server by setting "opt-out" to true in the config file and canceling the metrics task. + * + * @throws IOException + */ + public void disable() throws IOException { + // This has to be synchronized or it can collide with the check in the task. + synchronized (optOutLock) { + // Check if the server owner has already set opt-out, if not, set it. + if (!isOptOut()) { + configuration.set("opt-out", true); + configuration.save(configurationFile); + } + + // Disable Task, if it is running + if (taskId > 0) { + this.plugin.getServer().getScheduler().cancelTask(taskId); + taskId = -1; + } + } + } + + /** + * Generic method that posts a plugin to the metrics website + */ + private void postPlugin(final boolean isPing) throws IOException { + // The plugin's description file containg all of the plugin data such as name, version, author, etc + final PluginDescriptionFile description = plugin.getDescription(); + + // Construct the post data + final StringBuilder data = new StringBuilder(); + data.append(encode("guid")).append('=').append(encode(guid)); + encodeDataPair(data, "version", description.getVersion()); + encodeDataPair(data, "server", Bukkit.getVersion()); + encodeDataPair(data, "players", Integer.toString(Bukkit.getServer().getOnlinePlayers().length)); + encodeDataPair(data, "revision", String.valueOf(REVISION)); + + // If we're pinging, append it + if (isPing) { + encodeDataPair(data, "ping", "true"); + } + + // Acquire a lock on the graphs, which lets us make the assumption we also lock everything + // inside of the graph (e.g plotters) + synchronized (graphs) { + final Iterator iter = graphs.iterator(); + + while (iter.hasNext()) { + final Graph graph = iter.next(); + + for (Plotter plotter : graph.getPlotters()) { + // The key name to send to the metrics server + // The format is C-GRAPHNAME-PLOTTERNAME where separator - is defined at the top + // Legacy (R4) submitters use the format Custom%s, or CustomPLOTTERNAME + final String key = String.format("C%s%s%s%s", CUSTOM_DATA_SEPARATOR, graph.getName(), CUSTOM_DATA_SEPARATOR, plotter.getColumnName()); + + // The value to send, which for the foreseeable future is just the string + // value of plotter.getValue() + final String value = Integer.toString(plotter.getValue()); + + // Add it to the http post data :) + encodeDataPair(data, key, value); + } + } + } + + // Create the url + URL url = new URL(BASE_URL + String.format(REPORT_URL, encode(plugin.getDescription().getName()))); + + // Connect to the website + URLConnection connection; + + // Mineshafter creates a socks proxy, so we can safely bypass it + // It does not reroute POST requests so we need to go around it + if (isMineshafterPresent()) { + connection = url.openConnection(Proxy.NO_PROXY); + } else { + connection = url.openConnection(); + } + + connection.setDoOutput(true); + + // Write the data + final OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream()); + writer.write(data.toString()); + writer.flush(); + + // Now read the response + final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); + final String response = reader.readLine(); + + // close resources + writer.close(); + reader.close(); + + if (response == null || response.startsWith("ERR")) { + throw new IOException(response); //Throw the exception + } else { + // Is this the first update this hour? + if (response.contains("OK This is your first update this hour")) { + synchronized (graphs) { + final Iterator iter = graphs.iterator(); + + while (iter.hasNext()) { + final Graph graph = iter.next(); + + for (Plotter plotter : graph.getPlotters()) { + plotter.reset(); + } + } + } + } + } + } + + /** + * Check if mineshafter is present. If it is, we need to bypass it to send POST requests + * + * @return + */ + private boolean isMineshafterPresent() { + try { + Class.forName("mineshafter.MineServer"); + return true; + } catch (Exception e) { + return false; + } + } + + /** + *

Encode a key/value data pair to be used in a HTTP post request. This INCLUDES a & so the first + * key/value pair MUST be included manually, e.g:

+ * + * StringBuffer data = new StringBuffer(); + * data.append(encode("guid")).append('=').append(encode(guid)); + * encodeDataPair(data, "version", description.getVersion()); + * + * + * @param buffer + * @param key + * @param value + * @return + */ + private static void encodeDataPair(final StringBuilder buffer, final String key, final String value) throws UnsupportedEncodingException { + buffer.append('&').append(encode(key)).append('=').append(encode(value)); + } + + /** + * Encode text as UTF-8 + * + * @param text + * @return + */ + private static String encode(final String text) throws UnsupportedEncodingException { + return URLEncoder.encode(text, "UTF-8"); + } + + /** + * Represents a custom graph on the website + */ + public static class Graph { + + /** + * The graph's name, alphanumeric and spaces only :) + * If it does not comply to the above when submitted, it is rejected + */ + private final String name; + + /** + * The set of plotters that are contained within this graph + */ + private final Set plotters = new LinkedHashSet(); + + private Graph(final String name) { + this.name = name; + } + + /** + * Gets the graph's name + * + * @return + */ + public String getName() { + return name; + } + + /** + * Add a plotter to the graph, which will be used to plot entries + * + * @param plotter + */ + public void addPlotter(final Plotter plotter) { + plotters.add(plotter); + } + + /** + * Remove a plotter from the graph + * + * @param plotter + */ + public void removePlotter(final Plotter plotter) { + plotters.remove(plotter); + } + + /** + * Gets an unmodifiable set of the plotter objects in the graph + * + * @return + */ + public Set getPlotters() { + return Collections.unmodifiableSet(plotters); + } + + @Override + public int hashCode() { + return name.hashCode(); + } + + @Override + public boolean equals(final Object object) { + if (!(object instanceof Graph)) { + return false; + } + + final Graph graph = (Graph) object; + return graph.name.equals(name); + } + + /** + * Called when the server owner decides to opt-out of Metrics while the server is running. + */ + protected void onOptOut(){} + + } + + /** + * Interface used to collect custom data for a plugin + */ + public static abstract class Plotter { + + /** + * The plot's name + */ + private final String name; + + /** + * Construct a plotter with the default plot name + */ + public Plotter() { + this("Default"); + } + + /** + * Construct a plotter with a specific plot name + * + * @param name + */ + public Plotter(final String name) { + this.name = name; + } + + /** + * Get the current value for the plotted point + * + * @return + */ + public abstract int getValue(); + + /** + * Get the column name for the plotted point + * + * @return the plotted point's column name + */ + public String getColumnName() { + return name; + } + + /** + * Called after the website graphs have been updated + */ + public void reset() { + } + + @Override + public int hashCode() { + return getColumnName().hashCode(); + } + + @Override + public boolean equals(final Object object) { + if (!(object instanceof Plotter)) { + return false; + } + + final Plotter plotter = (Plotter) object; + return plotter.name.equals(name) && plotter.getValue() == getValue(); + } + + } + +} \ No newline at end of file From 63b22440b4751e460cb7724b7aa128bde05ce6ad Mon Sep 17 00:00:00 2001 From: Hoot215 Date: Fri, 15 Jun 2012 11:49:46 -0300 Subject: [PATCH 045/133] Preparing simulation events (thanks to Lyneira's code). Note: There is probably an error in here somewhere; I did this without an IDE. I'll fix it up when I get home. --- .../GeometricMagicPlayerListener.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index e21b6c1..7784b04 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -2131,4 +2131,37 @@ public static boolean learnCircle(Player player, String circle, public static String getTransmutationCostSystem(GeometricMagic plugin) { return plugin.getConfig().getString("transmutation.cost").toString(); } + + // Lyneira's Code Start + public static boolean checkBlockPlaceSimulation(BlockLocation target, int typeId, byte data, BlockLocation placedAgainst, Player player) { + Block placedBlock = target.getBlock(); + Block replacedBlock = placedBlock.getState(); + int oldType = replacedBlockState.getTypeId(); + byte oldData = replacedBlockState.getRawData(); + + // Set the new state without physics. + placedBlock.setTypeIdAndData(typeId, data, false); + BlockPlaceEvent placeEvent = new ArtificialBlockPlaceEvent(placedBlock, replacedBlockState, placedAgainst.getBlock(), null, player, true); + getPluginManager(GeometricMagic).callEvent(placeEvent); + + // Revert to the old state without physics. + placedBlock.setTypeIdAndData(oldType, oldData, false); + if (placeEvent.isCancelled()) + return false; + return true; + } + + public static boolean checkBlockBreakSimulation(BlockLocation target, Player player) { + Block block = target.getBlock(); + BlockBreakEvent breakEvent = new ArtificialBlockBreakEvent(block, player); + getPluginManager.callEvent(breakEvent); + if (breakEvent.isCancelled()) + return false; + return true; + } + // Lyneira's Code End + + public static getPluginManager(GeometricMagic plugin) { + return plugin.getServer().getPluginManger(); + } } From b73e265d3037f217d2399cc8308c034110d400d4 Mon Sep 17 00:00:00 2001 From: Hoot215 Date: Fri, 15 Jun 2012 11:51:56 -0300 Subject: [PATCH 046/133] Quick fix --- .../cakenggt/GeometricMagic/GeometricMagicPlayerListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 7784b04..0f96c5b 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -2154,7 +2154,7 @@ public static boolean checkBlockPlaceSimulation(BlockLocation target, int typeId public static boolean checkBlockBreakSimulation(BlockLocation target, Player player) { Block block = target.getBlock(); BlockBreakEvent breakEvent = new ArtificialBlockBreakEvent(block, player); - getPluginManager.callEvent(breakEvent); + getPluginManager(GeometricMagic).callEvent(breakEvent); if (breakEvent.isCancelled()) return false; return true; From db896985b30bd0c37ab7c532d5e8e91e0ad1ff21 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sun, 17 Jun 2012 12:40:02 -0400 Subject: [PATCH 047/133] Permissions fix (I must have been really tired when I made those permissions changes) Fixed some errors in the block event simulations (Almost ready to implement) --- .../GeometricMagic/GeometricMagic.java | 74 ++++++++++--------- .../GeometricMagicPlayerListener.java | 73 +++++++++--------- 2 files changed, 78 insertions(+), 69 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagic.java b/src/me/cakenggt/GeometricMagic/GeometricMagic.java index 8c2c739..dda6d4d 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagic.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagic.java @@ -48,48 +48,54 @@ public boolean onCommand(CommandSender sender, Command cmd, // If the player typed /setcircle then do the following... if (cmd.getName().equalsIgnoreCase("setcircle")) { - // [1, 1, 3, 3] Player player = null; + if (sender instanceof Player) { player = (Player) sender; + + if (args.length == 0) { + ItemStack oneFlint = new ItemStack(318, 1); + player.getWorld().dropItem(player.getLocation(), oneFlint); + return true; + } + + if (args.length != 1) { + sender.sendMessage(cmd.getUsage()); + return false; + } + + if (args[0].length() != 4 && args[0].length() != 1) { + sender.sendMessage(cmd.getUsage()); + return false; + } + + if (args[0].length() == 1 && args[0].equalsIgnoreCase("0")) { + sender.sendMessage("Casting circles on right click now disabled, set right click to a viable circle to enable"); + String inputString = args[0]; + try { + sacrificeCircle(sender, inputString); + } catch (IOException e) { + e.printStackTrace(); + } + return true; + + } else { + String inputString = "[" + args[0].charAt(0) + ", " + + args[0].charAt(1) + ", " + args[0].charAt(2) + ", " + + args[0].charAt(3) + "]"; + try { + sacrificeCircle(sender, inputString); + } catch (IOException e) { + e.printStackTrace(); + } + return true; + } } + if (player == null) { sender.sendMessage("This command can only be run by a player"); return false; } - if (args.length == 0) { - ItemStack oneFlint = new ItemStack(318, 1); - player.getWorld().dropItem(player.getLocation(), oneFlint); - return true; - } - if (args.length != 1) { - sender.sendMessage(cmd.getUsage()); - return false; - } - if (args[0].length() != 4 && args[0].length() != 1) { - sender.sendMessage(cmd.getUsage()); - return false; - } - if (args[0].length() == 1 && args[0].equalsIgnoreCase("0")) { - sender.sendMessage("Casting circles on right click now disabled, set right click to a viable circle to enable"); - String inputString = args[0]; - try { - sacrificeCircle(sender, inputString); - } catch (IOException e) { - e.printStackTrace(); - } - return true; - } else { - String inputString = "[" + args[0].charAt(0) + ", " - + args[0].charAt(1) + ", " + args[0].charAt(2) + ", " - + args[0].charAt(3) + "]"; - try { - sacrificeCircle(sender, inputString); - } catch (IOException e) { - e.printStackTrace(); - } - return true; - } } // If this has happened the function will break and return true. if this // hasn't happened the a value of false will be returned. diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 0f96c5b..af9ca6b 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -44,6 +44,7 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; +import org.bukkit.plugin.PluginManager; public class GeometricMagicPlayerListener implements Listener { static GeometricMagic plugin = new GeometricMagic(); @@ -136,7 +137,7 @@ public static void circleChooser(Player player, World world, Block actBlock) { && southBlock.getType() == Material.REDSTONE_WIRE && eastBlock.getType() == Material.REDSTONE_WIRE && westBlock.getType() == Material.REDSTONE_WIRE) { - if (player.hasPermission("circle.teleportation")) { + if (player.hasPermission("geometricmagic.teleportation")) { // System.out.println("teleportation"); teleportationCircle(player, world, actBlock); } else @@ -151,7 +152,7 @@ public static void circleChooser(Player player, World world, Block actBlock) { && actBlock.getRelative(3, 0, 0).getType() != Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, -3).getType() != Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, 3).getType() != Material.REDSTONE_WIRE) { - if (player.hasPermission("circle.micro")) { + if (player.hasPermission("geometricmagic.micro")) { // System.out.println("micro"); microCircle(player, world, actBlock); } else @@ -171,16 +172,16 @@ public static void circleChooser(Player player, World world, Block actBlock) { // - allows use of all circles smaller than then the max // size permission node they have int circleSize = 1; - if (player.hasPermission("circle.transmutation.*") - || player.hasPermission("circle.transmutation.9")) { + if (player.hasPermission("geometricmagic.transmutation.*") + || player.hasPermission("geometricmagic.transmutation.9")) { circleSize = 9; - } else if (player.hasPermission("circle.transmutation.7")) { + } else if (player.hasPermission("geometricmagic.transmutation.7")) { circleSize = 7; - } else if (player.hasPermission("circle.transmutation.5")) { + } else if (player.hasPermission("geometricmagic.transmutation.5")) { circleSize = 5; - } else if (player.hasPermission("circle.transmutation.3")) { + } else if (player.hasPermission("geometricmagic.transmutation.3")) { circleSize = 3; - } else if (player.hasPermission("circle.transmutation.1")) { + } else if (player.hasPermission("geometricmagic.transmutation.1")) { circleSize = 1; } else { circleSize = 0; @@ -202,7 +203,7 @@ public static void circleChooser(Player player, World world, Block actBlock) { && actBlock.getRelative(3, 0, 0).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, -3).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, 3).getType() == Material.REDSTONE_WIRE) { - if (player.hasPermission("circle.set")) { + if (player.hasPermission("geometricmagic.set")) { setCircleRemote(player, world, actBlock); } else player.sendMessage("You do not have permission to use this circle"); @@ -671,7 +672,7 @@ public static void setCircleEffects(Player player, World world, if (arrayString.equals("0")) return; if (arrayString.equals("[1, 1, 3, 3]") - && player.hasPermission("circle.set.1133")) { + && player.hasPermission("geometricmagic.set.1133")) { if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " + arrayString + "!"); @@ -776,7 +777,7 @@ public static void setCircleEffects(Player player, World world, } } } else if (arrayString.equals("[1, 2, 2, 2]") - && player.hasPermission("circle.set.1222")) { + && player.hasPermission("geometricmagic.set.1222")) { cost = 1; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " @@ -827,7 +828,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { return; } } else if (arrayString.equals("[1, 2, 3, 3]") - && player.hasPermission("circle.set.1233")) { + && player.hasPermission("geometricmagic.set.1233")) { cost = 20; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " @@ -860,7 +861,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { effectBlock.getWorld().dropItem(effectBlock.getLocation(), diamondStack); } else if (arrayString.equals("[1, 2, 3, 4]") - && player.hasPermission("circle.set.1234")) { + && player.hasPermission("geometricmagic.set.1234")) { cost = 1; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " @@ -879,7 +880,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { return; } } else if (arrayString.equals("[2, 2, 2, 3]") - && player.hasPermission("circle.set.2223")) { + && player.hasPermission("geometricmagic.set.2223")) { cost = 10; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " @@ -942,7 +943,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { return; } } else if (arrayString.equals("[2, 2, 2, 4]") - && player.hasPermission("circle.set.2224")) { + && player.hasPermission("geometricmagic.set.2224")) { cost = 10; if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); @@ -954,7 +955,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { return; } } else if (arrayString.equals("[2, 2, 4, 4]") - && player.hasPermission("circle.set.2244")) { + && player.hasPermission("geometricmagic.set.2244")) { if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " + arrayString + "!"); @@ -1028,7 +1029,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + highestBlock); return; } else if (arrayString.equals("[2, 3, 3, 3]") - && player.hasPermission("circle.set.2333")) { + && player.hasPermission("geometricmagic.set.2333")) { cost = 2; int size = setCircleSize(actBlock); cost = 2 + size / 2; @@ -1051,7 +1052,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { return; } } else if (arrayString.equals("[3, 3, 3, 4]") - && player.hasPermission("circle.set.3334")) { + && player.hasPermission("geometricmagic.set.3334")) { cost = 2; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " @@ -1068,7 +1069,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { return; } } else if (arrayString.equals("[3, 3, 4, 4]") - && player.hasPermission("circle.set.3344")) { + && player.hasPermission("geometricmagic.set.3344")) { cost = 4; int size = setCircleSize(actBlock); cost = 4 + size / 2; @@ -1091,7 +1092,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { return; } } else if (arrayString.equals("[3, 4, 4, 4]") - && player.hasPermission("circle.set.3444")) { + && player.hasPermission("geometricmagic.set.3444")) { cost = 20; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " @@ -1110,7 +1111,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { return; } } else if (arrayString.equals("[0, 1, 1, 1]") - && player.hasPermission("circle.set.0111")) { + && player.hasPermission("geometricmagic.set.0111")) { cost = 16; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " @@ -1161,7 +1162,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { return; } } else if (arrayString.equals("[0, 0, 4, 4]") - && player.hasPermission("circle.set.0044")) { + && player.hasPermission("geometricmagic.set.0044")) { cost = 10; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " @@ -1177,7 +1178,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { return; } } else if (arrayString.equals("[0, 1, 4, 4]") - && player.hasPermission("circle.set.0144")) { + && player.hasPermission("geometricmagic.set.0144")) { cost = 10; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " @@ -1193,7 +1194,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { return; } } else if (arrayString.equals("[0, 2, 4, 4]") - && player.hasPermission("circle.set.0244")) { + && player.hasPermission("geometricmagic.set.0244")) { cost = 10; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " @@ -1209,7 +1210,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { return; } } else if (arrayString.equals("[0, 3, 4, 4]") - && player.hasPermission("circle.set.0344")) { + && player.hasPermission("geometricmagic.set.0344")) { cost = 10; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " @@ -2133,16 +2134,18 @@ public static String getTransmutationCostSystem(GeometricMagic plugin) { } // Lyneira's Code Start - public static boolean checkBlockPlaceSimulation(BlockLocation target, int typeId, byte data, BlockLocation placedAgainst, Player player) { + public static boolean checkBlockPlaceSimulation(Location target, int typeId, byte data, + Location placedAgainst, Player player) { Block placedBlock = target.getBlock(); - Block replacedBlock = placedBlock.getState(); - int oldType = replacedBlockState.getTypeId(); + BlockState replacedBlockState = placedBlock.getState(); + int oldType = replacedBlockState.getTypeId(); byte oldData = replacedBlockState.getRawData(); // Set the new state without physics. placedBlock.setTypeIdAndData(typeId, data, false); - BlockPlaceEvent placeEvent = new ArtificialBlockPlaceEvent(placedBlock, replacedBlockState, placedAgainst.getBlock(), null, player, true); - getPluginManager(GeometricMagic).callEvent(placeEvent); + BlockPlaceEvent placeEvent = new BlockPlaceEvent(placedBlock, replacedBlockState, + placedAgainst.getBlock(), null, player, true); + ((PluginManager) getPluginManager(plugin)).callEvent(placeEvent); // Revert to the old state without physics. placedBlock.setTypeIdAndData(oldType, oldData, false); @@ -2151,17 +2154,17 @@ public static boolean checkBlockPlaceSimulation(BlockLocation target, int typeId return true; } - public static boolean checkBlockBreakSimulation(BlockLocation target, Player player) { + public static boolean checkBlockBreakSimulation(Location target, Player player) { Block block = target.getBlock(); - BlockBreakEvent breakEvent = new ArtificialBlockBreakEvent(block, player); - getPluginManager(GeometricMagic).callEvent(breakEvent); + BlockBreakEvent breakEvent = new BlockBreakEvent(block, player); + ((PluginManager) getPluginManager(plugin)).callEvent(breakEvent); if (breakEvent.isCancelled()) return false; return true; } // Lyneira's Code End - public static getPluginManager(GeometricMagic plugin) { - return plugin.getServer().getPluginManger(); + public static Object getPluginManager(GeometricMagic plugin) { + return plugin.getServer().getPluginManager(); } } From c56ff4088347520f9b18cc81f673fc6ece37b016 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sun, 17 Jun 2012 12:42:43 -0400 Subject: [PATCH 048/133] v2.4.2 (FIX, Beta) --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index e1c58c8..7d348f6 100644 --- a/plugin.yml +++ b/plugin.yml @@ -18,7 +18,7 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.4.1 +version: 2.4.2 author: cakenggt, Hoot215 softdepend: [Vault] permissions: From ffd03c69467129877a834a7c0fdff6d7d51829d5 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sun, 17 Jun 2012 15:55:30 -0400 Subject: [PATCH 049/133] Transmutation block event simulation (Tested and fully functional) --- .../GeometricMagicPlayerListener.java | 151 ++++++++---------- 1 file changed, 69 insertions(+), 82 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index af9ca6b..71071ac 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -26,7 +26,6 @@ import net.milkbowl.vault.economy.Economy; -import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; @@ -1588,13 +1587,11 @@ public static void transmuteBlock(Material a, Material b, byte toData, int pay = calculatePay(a, b); pay = (int) (pay * philosopherStoneModifier(player)); - BlockState startBlockState = startBlock.getState(); if (startBlock.getType() == a) { if (-1 * getBalance(player) < pay) { - // disallow transmuting of mob spawners completely - // block break + // Block break if (a != Material.AIR && b == Material.AIR && a != Material.CHEST && a != Material.WALL_SIGN && a != Material.SIGN_POST && a != Material.FURNACE @@ -1603,69 +1600,66 @@ public static void transmuteBlock(Material a, Material b, byte toData, && a != Material.WOODEN_DOOR && a != Material.IRON_DOOR_BLOCK && a != Material.MOB_SPAWNER) { + + Location blockLocation = startBlock.getLocation(); + + if (checkBlockBreakSimulation(blockLocation, player)) { + // Change block + startBlock.setType(b); + if (toData != 0) + startBlock.setData(toData); - // block break event - BlockBreakEvent break_event = new BlockBreakEvent( - startBlock, player); - Bukkit.getServer().getPluginManager() - .callEvent(break_event); - - // change block - startBlock.setType(b); - if (toData != 0) - startBlock.setData(toData); - - if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { - - Economy econ = GeometricMagic.getEconomy(); + if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { + + Economy econ = GeometricMagic.getEconomy(); - // deposit or withdraw to players Vault account - if (pay > 0) { - econ.depositPlayer(player.getName(), pay); - } else if (pay < 0) { - econ.withdrawPlayer(player.getName(), pay * -1); + // Deposit or withdraw to players Vault account + if (pay > 0) { + econ.depositPlayer(player.getName(), pay); + } else if (pay < 0) { + econ.withdrawPlayer(player.getName(), pay * -1); + } + } + else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + player.setLevel((int) (player.getLevel() + (pay * philosopherStoneModifier(player)))); } - } - else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { - player.setLevel((int) (player.getLevel() + (pay * philosopherStoneModifier(player)))); } } - // block place + // Block place else if (a == Material.AIR && b != Material.AIR && b != Material.MOB_SPAWNER) { + + Location blockLocation = startBlock.getLocation(); + int blockID = b.getId(); + byte blockData = 0; + + if (checkBlockPlaceSimulation(blockLocation, blockID, blockData, blockLocation, player)) { + // Change block + startBlock.setType(b); + if (toData != 0) + startBlock.setData(toData); - // change block - startBlock.setType(b); - if (toData != 0) - startBlock.setData(toData); - - if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { - - Economy econ = GeometricMagic.getEconomy(); + if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { + + Economy econ = GeometricMagic.getEconomy(); - - // deposit or withdraw to players Vault account - if (pay > 0) { - econ.depositPlayer(player.getName(), pay); - } else if (pay < 0) { - econ.withdrawPlayer(player.getName(), pay * -1); + + // Deposit or withdraw to players Vault account + if (pay > 0) { + econ.depositPlayer(player.getName(), pay); + } else if (pay < 0) { + econ.withdrawPlayer(player.getName(), pay * -1); + } + } + else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + player.setLevel((int) (player.getLevel() + (pay * philosopherStoneModifier(player)))); } } - else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { - player.setLevel((int) (player.getLevel() + (pay * philosopherStoneModifier(player)))); - } - - // block place event - BlockPlaceEvent place_event = new BlockPlaceEvent( - startBlock, startBlockState, startBlock, - new ItemStack(b.getId()), player, true); - Bukkit.getServer().getPluginManager() - .callEvent(place_event); } - // block break and place + // Block break and place else if (a != Material.AIR && b != Material.AIR && a != Material.CHEST && a != Material.WALL_SIGN && a != Material.SIGN_POST && a != Material.FURNACE @@ -1675,40 +1669,33 @@ else if (a != Material.AIR && b != Material.AIR && a != Material.MOB_SPAWNER && b != Material.MOB_SPAWNER && a != Material.IRON_DOOR_BLOCK) { + + Location blockLocation = startBlock.getLocation(); + int blockID = b.getId(); + byte blockData = 0; + + if (checkBlockBreakSimulation(blockLocation, player) && checkBlockPlaceSimulation(blockLocation, blockID, blockData, blockLocation, player)) { + // Change block + startBlock.setType(b); + if (toData != 0) + startBlock.setData(toData); - // block break event - BlockBreakEvent break_event = new BlockBreakEvent( - startBlock, player); - Bukkit.getServer().getPluginManager() - .callEvent(break_event); - - // change block - startBlock.setType(b); - if (toData != 0) - startBlock.setData(toData); - - if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { - - Economy econ = GeometricMagic.getEconomy(); + if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { + + Economy econ = GeometricMagic.getEconomy(); - - // deposit or withdraw to players Vault account - if (pay > 0) { - econ.depositPlayer(player.getName(), pay); - } else if (pay < 0) { - econ.withdrawPlayer(player.getName(), pay * -1); + + // Deposit or withdraw to players Vault account + if (pay > 0) { + econ.depositPlayer(player.getName(), pay); + } else if (pay < 0) { + econ.withdrawPlayer(player.getName(), pay * -1); + } + } + else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + player.setLevel((int) (player.getLevel() + (pay * philosopherStoneModifier(player)))); } } - else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { - player.setLevel((int) (player.getLevel() + (pay * philosopherStoneModifier(player)))); - } - - // block place event - BlockPlaceEvent place_event = new BlockPlaceEvent( - startBlock, startBlockState, startBlock, - new ItemStack(b.getId()), player, true); - Bukkit.getServer().getPluginManager() - .callEvent(place_event); } // output to console From 4aab22434d6ceabfd53dee51daf845e3c85d476b Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sun, 17 Jun 2012 17:20:13 -0400 Subject: [PATCH 050/133] Configurable block values Fixed a bug with set circle 1222 and XP mode --- config.yml | 130 ++++++++++++++++ .../GeometricMagicPlayerListener.java | 144 ++---------------- 2 files changed, 139 insertions(+), 135 deletions(-) diff --git a/config.yml b/config.yml index 30d71cf..ae4b01d 100644 --- a/config.yml +++ b/config.yml @@ -22,3 +22,133 @@ transmutation: # What system to use for transmutation cost # Possible values: xp, vault (requires Vault) cost: xp + +# VALUES SECTION (Values of blocks for transmutation) +values: + 0: 0 + 1: 6 + 2: 1 + 3: 1 + 4: 4 + 5: 4 + 6: 8 + 7: 0 + 8: 0 + 9: 1 + 10: 0 + 11: 200 + 12: 1 + 13: 2 + 14: 384 + 15: 96 + 16: 16 + 17: 16 + 18: 1 + 19: 0 + 20: 3 + 21: 144 + 22: 216 + 23: 51 + 24: 4 + 25: 40 + 26: 48 + 27: 384 + 28: 96 + 29: 153 + 30: 24 + 31: 1 + 32: 1 + 33: 132 + 34: 0 + 35: 12 + 36: 0 + 37: 48 + 38: 48 + 39: 32 + 40: 32 + 41: 3456 + 42: 864 + 43: 8 + 44: 4 + 45: 24 + 46: 484 + 47: 96 + 48: 4 + 49: 192 + 50: 4 + 51: 1 + 52: 0 + 53: 6 + 54: 32 + 55: 8 + 56: 1536 + 57: 13824 + 58: 16 + 59: 4 + 60: 1 + 61: 32 + 62: 32 + 63: 0 + 64: 24 + 65: 7 + 66: 36 + 67: 6 + 68: 0 + 69: 6 + 70: 12 + 71: 576 + 72: 8 + 73: 32 + 74: 32 + 75: 10 + 76: 10 + 77: 12 + 78: 1 + 79: 4 + 80: 4 + 81: 8 + 82: 16 + 83: 8 + 84: 1568 + 85: 6 + 86: 64 + 87: 1 + 88: 2 + 89: 128 + 90: 0 + 91: 68 + 92: 163 + 93: 46 + 94: 46 + 95: 0 + 96: 12 + 97: 0 + 98: 6 + 99: 32 + 100: 32 + 101: 36 + 102: 1 + 103: 64 + 104: 16 + 105: 7 + 106: 1 + 107: 16 + 108: 36 + 109: 9 + 110: 1 + 111: 0 + 112: 0 + 113: 0 + 114: 0 + 115: 8 + 116: 0 + 117: 0 + 118: 0 + 119: 0 + 120: 0 + 121: 1 + 122: 0 + 123: 160 + 124: 160 + 125: 8 + 126: 4 diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 71071ac..4fca296 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -792,12 +792,9 @@ public static void setCircleEffects(Player player, World world, for (int i = 0; i < entityList.size(); i++) { if (entityList.get(i) instanceof Item) { Item droppedItem = (Item) entityList.get(i); - calculatePay(Material.AIR, Material.AIR); - int[] valueArray = new int[2266]; - getValueArray(valueArray); + int valueArray = getBlockValue(plugin, droppedItem.getItemStack().getTypeId()); - int pay = (valueArray[droppedItem.getItemStack() - .getTypeId()] * droppedItem.getItemStack() + int pay = (valueArray * droppedItem.getItemStack() .getAmount()); if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { @@ -809,9 +806,8 @@ public static void setCircleEffects(Player player, World world, } } else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { - player.setLevel((valueArray[droppedItem.getItemStack() - .getTypeId()] * droppedItem.getItemStack() - .getAmount())); + player.setLevel((valueArray * droppedItem.getItemStack().getAmount()) + + player.getLevel()); } /* * player.setLevel((valueArray[droppedItem.getItemStack() @@ -1715,133 +1711,7 @@ else if ((a != Material.AIR && b != Material.AIR) } public static int calculatePay(Material a, Material b) { - int[] valueArray = new int[2266]; - // array index is block id, value in array is xp - Arrays.fill(valueArray, 0); - valueArray[0] = 0; - valueArray[1] = 6; - valueArray[2] = 1; - valueArray[3] = 1; - valueArray[4] = 4; - valueArray[5] = 4; - valueArray[6] = 8; - valueArray[7] = 0; - valueArray[8] = 0; - valueArray[9] = 1; - valueArray[10] = 0; - valueArray[11] = 200; - valueArray[12] = 1; - valueArray[13] = 2; - valueArray[14] = 384; - valueArray[15] = 96; - valueArray[16] = 16; - valueArray[17] = 16; - valueArray[18] = 1; - valueArray[19] = 0; - valueArray[20] = 3; - valueArray[21] = 144; - valueArray[22] = 216; - valueArray[23] = 51; - valueArray[24] = 4; - valueArray[25] = 40; - valueArray[26] = 48; - valueArray[27] = 384; - valueArray[28] = 96; - valueArray[29] = 153; - valueArray[30] = 24; - valueArray[31] = 1; - valueArray[32] = 1; - valueArray[33] = 132; - valueArray[34] = 0; - valueArray[35] = 12; - valueArray[36] = 0; - valueArray[37] = 48; - valueArray[38] = 48; - valueArray[39] = 32; - valueArray[40] = 32; - valueArray[41] = 3456; - valueArray[42] = 864; - valueArray[43] = 8; - valueArray[44] = 4; - valueArray[45] = 24; - valueArray[46] = 484; - valueArray[47] = 96; - valueArray[48] = 4; - valueArray[49] = 192; - valueArray[50] = 4; - valueArray[51] = 1; - valueArray[52] = 0; - valueArray[53] = 6; - valueArray[54] = 32; - valueArray[55] = 8; - valueArray[56] = 1536; - valueArray[57] = 13824; - valueArray[58] = 16; - valueArray[59] = 4; - valueArray[60] = 1; - valueArray[61] = 32; - valueArray[62] = 32; - valueArray[63] = 0; - valueArray[64] = 24; - valueArray[65] = 7; - valueArray[66] = 36; - valueArray[67] = 6; - valueArray[68] = 0; - valueArray[69] = 6; - valueArray[70] = 12; - valueArray[71] = 576; - valueArray[72] = 8; - valueArray[73] = 32; - valueArray[74] = 32; - valueArray[75] = 10; - valueArray[76] = 10; - valueArray[77] = 12; - valueArray[78] = 1; - valueArray[79] = 4; - valueArray[80] = 4; - valueArray[81] = 8; - valueArray[82] = 16; - valueArray[83] = 8; - valueArray[84] = 1568; - valueArray[85] = 6; - valueArray[86] = 64; - valueArray[87] = 1; - valueArray[88] = 2; - valueArray[89] = 128; - valueArray[90] = 0; - valueArray[91] = 68; - valueArray[92] = 163; - valueArray[93] = 46; - valueArray[94] = 46; - valueArray[95] = 0; - valueArray[96] = 12; - valueArray[97] = 0; - valueArray[98] = 6; - valueArray[99] = 32; - valueArray[100] = 32; - valueArray[101] = 36; - valueArray[102] = 1; - valueArray[103] = 64; - valueArray[104] = 16; - valueArray[105] = 7; - valueArray[106] = 1; - valueArray[107] = 16; - valueArray[108] = 36; - valueArray[109] = 9; - valueArray[110] = 1; - valueArray[111] = 0; - valueArray[112] = 0; - valueArray[113] = 0; - valueArray[114] = 0; - valueArray[115] = 8; - valueArray[116] = 0; - valueArray[117] = 0; - valueArray[118] = 0; - valueArray[119] = 0; - valueArray[120] = 0; - valueArray[121] = 1; - valueArray[122] = 0; - int valueDifference = valueArray[a.getId()] - valueArray[b.getId()]; + int valueDifference = getBlockValue(plugin, a.getId()) - getBlockValue(plugin, b.getId()); return valueDifference; } @@ -2120,6 +1990,10 @@ public static String getTransmutationCostSystem(GeometricMagic plugin) { return plugin.getConfig().getString("transmutation.cost").toString(); } + public static Integer getBlockValue(GeometricMagic plugin, int i) { + return plugin.getConfig().getInt("values." + i); + } + // Lyneira's Code Start public static boolean checkBlockPlaceSimulation(Location target, int typeId, byte data, Location placedAgainst, Player player) { From f1d3969f2e9d99375bdf3ed5cd19921add1152d1 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sun, 17 Jun 2012 17:22:44 -0400 Subject: [PATCH 051/133] v2.5 --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index 7d348f6..f8e4713 100644 --- a/plugin.yml +++ b/plugin.yml @@ -18,7 +18,7 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.4.2 +version: 2.5 author: cakenggt, Hoot215 softdepend: [Vault] permissions: From 3f2e7156cfbe35c4bec31d650003b1d8adf5bdb2 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sun, 17 Jun 2012 22:37:29 -0400 Subject: [PATCH 052/133] Remove unneeded code --- .../GeometricMagicPlayerListener.java | 130 ------------------ 1 file changed, 130 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 4fca296..a36bb17 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -1715,136 +1715,6 @@ public static int calculatePay(Material a, Material b) { return valueDifference; } - public static int[] getValueArray(int[] valueArray) { - // int[] valueArray = new int[2266]; - // array index is block id, value in array is xp - Arrays.fill(valueArray, 0); - valueArray[0] = 0; - valueArray[1] = 6; - valueArray[2] = 1; - valueArray[3] = 1; - valueArray[4] = 4; - valueArray[5] = 4; - valueArray[6] = 8; - valueArray[7] = 0; - valueArray[8] = 0; - valueArray[9] = 1; - valueArray[10] = 0; - valueArray[11] = 200; - valueArray[12] = 1; - valueArray[13] = 2; - valueArray[14] = 384; - valueArray[15] = 96; - valueArray[16] = 16; - valueArray[17] = 16; - valueArray[18] = 1; - valueArray[19] = 0; - valueArray[20] = 3; - valueArray[21] = 144; - valueArray[22] = 216; - valueArray[23] = 51; - valueArray[24] = 4; - valueArray[25] = 40; - valueArray[26] = 48; - valueArray[27] = 384; - valueArray[28] = 96; - valueArray[29] = 153; - valueArray[30] = 24; - valueArray[31] = 1; - valueArray[32] = 1; - valueArray[33] = 132; - valueArray[34] = 0; - valueArray[35] = 12; - valueArray[36] = 0; - valueArray[37] = 48; - valueArray[38] = 48; - valueArray[39] = 32; - valueArray[40] = 32; - valueArray[41] = 3456; - valueArray[42] = 864; - valueArray[43] = 8; - valueArray[44] = 4; - valueArray[45] = 24; - valueArray[46] = 484; - valueArray[47] = 96; - valueArray[48] = 4; - valueArray[49] = 192; - valueArray[50] = 4; - valueArray[51] = 1; - valueArray[52] = 0; - valueArray[53] = 6; - valueArray[54] = 32; - valueArray[55] = 8; - valueArray[56] = 1536; - valueArray[57] = 13824; - valueArray[58] = 16; - valueArray[59] = 4; - valueArray[60] = 1; - valueArray[61] = 32; - valueArray[62] = 32; - valueArray[63] = 0; - valueArray[64] = 24; - valueArray[65] = 7; - valueArray[66] = 36; - valueArray[67] = 6; - valueArray[68] = 0; - valueArray[69] = 6; - valueArray[70] = 12; - valueArray[71] = 576; - valueArray[72] = 8; - valueArray[73] = 32; - valueArray[74] = 32; - valueArray[75] = 10; - valueArray[76] = 10; - valueArray[77] = 12; - valueArray[78] = 1; - valueArray[79] = 4; - valueArray[80] = 4; - valueArray[81] = 8; - valueArray[82] = 16; - valueArray[83] = 8; - valueArray[84] = 1568; - valueArray[85] = 6; - valueArray[86] = 64; - valueArray[87] = 1; - valueArray[88] = 2; - valueArray[89] = 128; - valueArray[90] = 0; - valueArray[91] = 68; - valueArray[92] = 163; - valueArray[93] = 46; - valueArray[94] = 46; - valueArray[95] = 0; - valueArray[96] = 12; - valueArray[97] = 0; - valueArray[98] = 6; - valueArray[99] = 32; - valueArray[100] = 32; - valueArray[101] = 36; - valueArray[102] = 1; - valueArray[103] = 64; - valueArray[104] = 16; - valueArray[105] = 7; - valueArray[106] = 1; - valueArray[107] = 16; - valueArray[108] = 36; - valueArray[109] = 9; - valueArray[110] = 1; - valueArray[111] = 0; - valueArray[112] = 0; - valueArray[113] = 0; - valueArray[114] = 0; - valueArray[115] = 8; - valueArray[116] = 0; - valueArray[117] = 0; - valueArray[118] = 0; - valueArray[119] = 0; - valueArray[120] = 0; - valueArray[121] = 1; - valueArray[122] = 0; - return valueArray; - } - public static double philosopherStoneModifier(Player player) { double modifier = 1; int stackCount = 0; From e9773027fd9ef78e4406bde5290c21f733526040 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Mon, 18 Jun 2012 16:03:19 -0400 Subject: [PATCH 053/133] Permissions fix (again) --- plugin.yml | 35 ++++------------------------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/plugin.yml b/plugin.yml index 7d348f6..cb6c2ac 100644 --- a/plugin.yml +++ b/plugin.yml @@ -18,13 +18,13 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.4.2 +version: 2.5.1 author: cakenggt, Hoot215 softdepend: [Vault] permissions: geometricmagic.*: description: Gives access to all circles and /setcircle - default: false + default: op children: geometricmagic.standard: true geometricmagic.transmutation.*: true @@ -38,13 +38,10 @@ permissions: geometricmagic.set: true geometricmagic.teleportation: description: Allows you to use teleportation circles - default: false geometricmagic.micro: description: Allows you to use micro circles - default: false geometricmagic.transmutation.*: description: Allows you to use all transmutation circles - default: false children: geometricmagic.transmutation.1: true geometricmagic.transmutation.3: true @@ -53,31 +50,23 @@ permissions: geometricmagic.transmutation.9: true geometricmagic.transmutation.1: description: Allows you to use transmutation circles of size 1 - default: false geometricmagic.transmutation.3: description: Allows you to use transmutation circles of size 3 - default: false geometricmagic.transmutation.5: description: Allows you to use transmutation circles of size 5 - default: false geometricmagic.transmutation.7: description: Allows you to use transmutation circles of size 7 - default: false geometricmagic.transmutation.9: description: Allows you to use transmutation circles of size 9 - default: false geometricmagic.set: description: Allows you to use all set circles and /setcircle - default: false children: - circle.set.*: true - circle.setcircle: true + geometricmagic.set.*: true + geometricmagic.setcircle: true geometricmagic.setcircle: description: Allows you to use /setcircle - default: false geometricmagic.set.*: description: Allows you to use all set circles - default: false children: geometricmagic.set.1133: true geometricmagic.set.1222: true @@ -97,52 +86,36 @@ permissions: geometricmagic.set.0344: true geometricmagic.set.1133: description: Allows you to use set circle 1133 - default: false geometricmagic.set.1222: description: Allows you to use set circle 1222 - default: false geometricmagic.set.1233: description: Allows you to use set circle 1233 - default: false geometricmagic.set.1234: description: Allows you to use set circle 1234 - default: false geometricmagic.set.2223: description: Allows you to use set circle 2223 - default: false geometricmagic.set.2224: description: Allows you to use set circle 2224 - default: false geometricmagic.set.2244: description: Allows you to use set circle 2244 - default: false geometricmagic.set.2333: description: Allows you to use set circle 2333 - default: false geometricmagic.set.3334: description: Allows you to use set circle 3334 - default: false geometricmagic.set.3344: description: Allows you to use set circle 1133 - default: false geometricmagic.set.3444: description: Allows you to use set circle 3444 - default: false geometricmagic.set.0111: description: Allows you to use set circle 0111 - default: false geometricmagic.set.0044: description: Allows you to use set circle 0044 - default: false geometricmagic.set.0144: description: Allows you to use set circle 0144 - default: false geometricmagic.set.0244: description: Allows you to use set circle 0244 - default: false geometricmagic.set.0344: description: Allows you to use set circle 0344 - default: false commands: setcircle: description: This command sets a sacrifice's right-click circle. From aaa5f0581b39a0b8468194092b3a96ae2a9b9db7 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Mon, 18 Jun 2012 16:07:52 -0400 Subject: [PATCH 054/133] v2.6 --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index cb6c2ac..6884282 100644 --- a/plugin.yml +++ b/plugin.yml @@ -18,7 +18,7 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.5.1 +version: 2.6 author: cakenggt, Hoot215 softdepend: [Vault] permissions: From 4ab0ad3e08bc255464c0f7f8bea71179e1c4a461 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Wed, 20 Jun 2012 19:59:55 -0400 Subject: [PATCH 055/133] Fixed crafting table security exploit --- .../cakenggt/GeometricMagic/GeometricMagicPlayerListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index a36bb17..0298a5f 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -76,7 +76,7 @@ public void onPlayerInteract(PlayerInteractEvent event) { if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { // System.out.println("right clicked block"); if (event.getClickedBlock().getType() == Material.WORKBENCH - && sacrifices) + && sacrifices && checkBlockBreakSimulation(event.getClickedBlock().getLocation(), event.getPlayer())) event.getClickedBlock().setType(Material.AIR); actBlock = event.getClickedBlock(); } From 6141344520200efe2f15dd9f1033db5bfac65785 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Wed, 20 Jun 2012 20:00:19 -0400 Subject: [PATCH 056/133] v2.6.1 --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index 6884282..94f243e 100644 --- a/plugin.yml +++ b/plugin.yml @@ -18,7 +18,7 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.6 +version: 2.6.1 author: cakenggt, Hoot215 softdepend: [Vault] permissions: From c0b61ceda126f39a40cb3f276dfe25e857097ec5 Mon Sep 17 00:00:00 2001 From: ty2u Date: Wed, 4 Jul 2012 12:44:06 -0400 Subject: [PATCH 057/133] Merge from upstream and add AntiCheat checks --- COPYING | 621 ++++++++++++++++ build.xml | 6 + config.yml | 154 ++++ plugin.yml | 184 ++--- .../GeometricMagic/GeometricMagic.java | 195 ++++-- .../GeometricMagicDamageListener.java | 18 + .../GeometricMagicPlayerListener.java | 662 +++++++----------- src/me/cakenggt/GeometricMagic/Metrics.java | 607 ++++++++++++++++ 8 files changed, 1916 insertions(+), 531 deletions(-) create mode 100644 COPYING create mode 100644 build.xml create mode 100644 config.yml create mode 100644 src/me/cakenggt/GeometricMagic/Metrics.java diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..e587591 --- /dev/null +++ b/COPYING @@ -0,0 +1,621 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..078b466 --- /dev/null +++ b/build.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/config.yml b/config.yml new file mode 100644 index 0000000..ae4b01d --- /dev/null +++ b/config.yml @@ -0,0 +1,154 @@ +# +# GeometricMagic allows players to draw redstone circles on the ground to do things such as teleport and transmute blocks. +# Copyright (C) 2012 Alec Cox (cakenggt), Andrew Stevanus (Hoot215) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# TRANSMUTATION SECTION +transmutation: + + # What system to use for transmutation cost + # Possible values: xp, vault (requires Vault) + cost: xp + +# VALUES SECTION (Values of blocks for transmutation) +values: + 0: 0 + 1: 6 + 2: 1 + 3: 1 + 4: 4 + 5: 4 + 6: 8 + 7: 0 + 8: 0 + 9: 1 + 10: 0 + 11: 200 + 12: 1 + 13: 2 + 14: 384 + 15: 96 + 16: 16 + 17: 16 + 18: 1 + 19: 0 + 20: 3 + 21: 144 + 22: 216 + 23: 51 + 24: 4 + 25: 40 + 26: 48 + 27: 384 + 28: 96 + 29: 153 + 30: 24 + 31: 1 + 32: 1 + 33: 132 + 34: 0 + 35: 12 + 36: 0 + 37: 48 + 38: 48 + 39: 32 + 40: 32 + 41: 3456 + 42: 864 + 43: 8 + 44: 4 + 45: 24 + 46: 484 + 47: 96 + 48: 4 + 49: 192 + 50: 4 + 51: 1 + 52: 0 + 53: 6 + 54: 32 + 55: 8 + 56: 1536 + 57: 13824 + 58: 16 + 59: 4 + 60: 1 + 61: 32 + 62: 32 + 63: 0 + 64: 24 + 65: 7 + 66: 36 + 67: 6 + 68: 0 + 69: 6 + 70: 12 + 71: 576 + 72: 8 + 73: 32 + 74: 32 + 75: 10 + 76: 10 + 77: 12 + 78: 1 + 79: 4 + 80: 4 + 81: 8 + 82: 16 + 83: 8 + 84: 1568 + 85: 6 + 86: 64 + 87: 1 + 88: 2 + 89: 128 + 90: 0 + 91: 68 + 92: 163 + 93: 46 + 94: 46 + 95: 0 + 96: 12 + 97: 0 + 98: 6 + 99: 32 + 100: 32 + 101: 36 + 102: 1 + 103: 64 + 104: 16 + 105: 7 + 106: 1 + 107: 16 + 108: 36 + 109: 9 + 110: 1 + 111: 0 + 112: 0 + 113: 0 + 114: 0 + 115: 8 + 116: 0 + 117: 0 + 118: 0 + 119: 0 + 120: 0 + 121: 1 + 122: 0 + 123: 160 + 124: 160 + 125: 8 + 126: 4 diff --git a/plugin.yml b/plugin.yml index 1af0f52..20b5848 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,121 +1,123 @@ +# +# GeometricMagic allows players to draw redstone circles on the ground to do things such as teleport and transmute blocks. +# Copyright (C) 2012 Alec Cox (cakenggt), Andrew Stevanus (Hoot215) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.20 -author: cakenggt -depend: [Vault] +version: 2.6.1 +author: cakenggt, Hoot215 +softdepend: [Vault,AntiCheat] permissions: - GeometricMagic.circle.*: - description: Gives access to all circles + geometricmagic.*: + description: Gives access to all circles and /setcircle + default: op children: - circle.teleportation: true - circle.micro: true - circle.transmutation: true - circle.set: true - circle.teleportation: - description: Allows you to use teleportation circles + geometricmagic.standard: true + geometricmagic.transmutation.*: true + geometricmagic.standard: + description: Gives access to standard circles and /setcircle default: true - circle.micro: + children: + geometricmagic.teleportation: true + geometricmagic.micro: true + geometricmagic.transmutation.1: true + geometricmagic.set: true + geometricmagic.teleportation: + description: Allows you to use teleportation circles + geometricmagic.micro: description: Allows you to use micro circles - default: true - circle.transmutation.*: + geometricmagic.transmutation.*: description: Allows you to use all transmutation circles - default: false children: - circle.transmutation.1: true - circle.transmutation.3: false - circle.transmutation.4: false - circle.transmutation.7: false - circle.transmutation.9: false - circle.transmutation.1: - description: Allows you to use transmutation circle 1 - default: true - circle.transmutation.3: - description: Allows you to use transmutation circle 3 - default: false - circle.transmutation.5: - description: Allows you to use transmutation circle 5 - default: false - circle.transmutation.7: - description: Allows you to use transmutation circle 7 - default: false - circle.transmutation.9: - description: Allows you to use transmutation circle 9 - default: false - circle.set: - description: Allows you to use set circles - default: true + geometricmagic.transmutation.1: true + geometricmagic.transmutation.3: true + geometricmagic.transmutation.4: true + geometricmagic.transmutation.7: true + geometricmagic.transmutation.9: true + geometricmagic.transmutation.1: + description: Allows you to use transmutation circles of size 1 + geometricmagic.transmutation.3: + description: Allows you to use transmutation circles of size 3 + geometricmagic.transmutation.5: + description: Allows you to use transmutation circles of size 5 + geometricmagic.transmutation.7: + description: Allows you to use transmutation circles of size 7 + geometricmagic.transmutation.9: + description: Allows you to use transmutation circles of size 9 + geometricmagic.set: + description: Allows you to use all set circles and /setcircle children: - circle.set.*: true - circle.set.*: + geometricmagic.set.*: true + geometricmagic.setcircle: true + geometricmagic.setcircle: + description: Allows you to use /setcircle + geometricmagic.set.*: description: Allows you to use all set circles - default: true children: - circle.set.1133: true - circle.set.1222: true - circle.set.1233: true - circle.set.1234: true - circle.set.2223: true - circle.set.2224: true - circle.set.2244: true - circle.set.2333: true - circle.set.3334: true - circle.set.3344: true - circle.set.3444: true - circle.set.0111: true - circle.set.0044: true - circle.set.0144: true - circle.set.0244: true - circle.set.0344: true - circle.set.1133: + geometricmagic.set.1133: true + geometricmagic.set.1222: true + geometricmagic.set.1233: true + geometricmagic.set.1234: true + geometricmagic.set.2223: true + geometricmagic.set.2224: true + geometricmagic.set.2244: true + geometricmagic.set.2333: true + geometricmagic.set.3334: true + geometricmagic.set.3344: true + geometricmagic.set.3444: true + geometricmagic.set.0111: true + geometricmagic.set.0044: true + geometricmagic.set.0144: true + geometricmagic.set.0244: true + geometricmagic.set.0344: true + geometricmagic.set.1133: description: Allows you to use set circle 1133 - default: true - circle.set.1222: + geometricmagic.set.1222: description: Allows you to use set circle 1222 - default: true - circle.set.1233: + geometricmagic.set.1233: description: Allows you to use set circle 1233 - default: true - circle.set.1234: + geometricmagic.set.1234: description: Allows you to use set circle 1234 - default: true - circle.set.2223: + geometricmagic.set.2223: description: Allows you to use set circle 2223 - default: true - circle.set.2224: + geometricmagic.set.2224: description: Allows you to use set circle 2224 - default: true - circle.set.2244: + geometricmagic.set.2244: description: Allows you to use set circle 2244 - default: true - circle.set.2333: + geometricmagic.set.2333: description: Allows you to use set circle 2333 - default: true - circle.set.3334: + geometricmagic.set.3334: description: Allows you to use set circle 3334 - default: true - circle.set.3344: + geometricmagic.set.3344: description: Allows you to use set circle 1133 - default: true - circle.set.3444: + geometricmagic.set.3444: description: Allows you to use set circle 3444 - default: true - circle.set.0111: + geometricmagic.set.0111: description: Allows you to use set circle 0111 - default: true - circle.set.0044: + geometricmagic.set.0044: description: Allows you to use set circle 0044 - default: true - circle.set.0144: + geometricmagic.set.0144: description: Allows you to use set circle 0144 - default: true - circle.set.0244: + geometricmagic.set.0244: description: Allows you to use set circle 0244 - default: true - circle.set.0344: + geometricmagic.set.0344: description: Allows you to use set circle 0344 - default: true commands: setcircle: description: This command sets a sacrifice's right-click circle. - permission: GeometricMagic.setcircle - usage: /setcircle 3344 \ No newline at end of file + permission: geometricmagic.setcircle + usage: /setcircle <####> diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagic.java b/src/me/cakenggt/GeometricMagic/GeometricMagic.java index 75b9b63..dda6d4d 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagic.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagic.java @@ -1,7 +1,28 @@ +/** + * GeometricMagic allows players to draw redstone circles on the ground to do things such as teleport and transmute blocks. + * Copyright (C) 2012 Alec Cox (cakenggt), Andrew Stevanus (Hoot215) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package me.cakenggt.GeometricMagic; import java.io.File; +import java.io.FileOutputStream; import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; import java.io.PrintWriter; import java.util.Scanner; @@ -17,58 +38,64 @@ import org.bukkit.plugin.java.JavaPlugin; public class GeometricMagic extends JavaPlugin { - public static GeometricMagic plugin; private Listener playerListener; private Listener entityListener; private static Economy economy; + File configFile; public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { // If the player typed /setcircle then do the following... if (cmd.getName().equalsIgnoreCase("setcircle")) { - // [1, 1, 3, 3] Player player = null; + if (sender instanceof Player) { player = (Player) sender; + + if (args.length == 0) { + ItemStack oneFlint = new ItemStack(318, 1); + player.getWorld().dropItem(player.getLocation(), oneFlint); + return true; + } + + if (args.length != 1) { + sender.sendMessage(cmd.getUsage()); + return false; + } + + if (args[0].length() != 4 && args[0].length() != 1) { + sender.sendMessage(cmd.getUsage()); + return false; + } + + if (args[0].length() == 1 && args[0].equalsIgnoreCase("0")) { + sender.sendMessage("Casting circles on right click now disabled, set right click to a viable circle to enable"); + String inputString = args[0]; + try { + sacrificeCircle(sender, inputString); + } catch (IOException e) { + e.printStackTrace(); + } + return true; + + } else { + String inputString = "[" + args[0].charAt(0) + ", " + + args[0].charAt(1) + ", " + args[0].charAt(2) + ", " + + args[0].charAt(3) + "]"; + try { + sacrificeCircle(sender, inputString); + } catch (IOException e) { + e.printStackTrace(); + } + return true; + } } + if (player == null) { sender.sendMessage("This command can only be run by a player"); return false; } - if (args.length == 0) { - ItemStack oneFlint = new ItemStack(318, 1); - player.getWorld().dropItem(player.getLocation(), oneFlint); - return true; - } - if (args.length != 1) { - sender.sendMessage(cmd.getUsage()); - return false; - } - if (args[0].length() != 4 && args[0].length() != 1) { - sender.sendMessage(cmd.getUsage()); - return false; - } - if (args[0].length() == 1 && args[0].equalsIgnoreCase("0")) { - sender.sendMessage("Casting circles on right click now disabled, set right click to a viable circle to enable"); - String inputString = args[0]; - try { - sacrificeCircle(sender, inputString); - } catch (IOException e) { - e.printStackTrace(); - } - return true; - } else { - String inputString = "[" + args[0].charAt(0) + ", " - + args[0].charAt(1) + ", " + args[0].charAt(2) + ", " - + args[0].charAt(3) + "]"; - try { - sacrificeCircle(sender, inputString); - } catch (IOException e) { - e.printStackTrace(); - } - return true; - } } // If this has happened the function will break and return true. if this // hasn't happened the a value of false will be returned. @@ -122,26 +149,72 @@ public void sacrificeCircle(CommandSender sender, String inputString) } } + @Override public void onDisable() { System.out.println(this + " is now disabled!"); } + @Override public void onEnable() { - - // Vault Support - if (!setupEconomy()) { + + configFile = new File(getDataFolder(), "config.yml"); + + // Copy default config file if it doesn't exist + if (!configFile.exists()) { + configFile.getParentFile().mkdirs(); + copy(this.getResource("config.yml"), configFile); + } + + // Copy config defaults + getConfig().options().copyDefaults(true); + + // Transmutation mode: Vault + if (getConfig().getString("transmutation.cost").toString().equalsIgnoreCase("vault")) { + // Vault Support + if (!setupEconomy()) { + System.out + .println("[" + this + "] ERROR: You have your transmutation system set to Vault, and yet you don't have Vault. Disabling plugin!"); + getServer().getPluginManager().disablePlugin(this); + } + else { + System.out + .println("[" + this + "] Transmutation cost system set to Vault"); + + // Register events + playerListener = new GeometricMagicPlayerListener(this); + entityListener = new GeometricMagicDamageListener(); + getServer().getPluginManager().registerEvents(playerListener, this); + getServer().getPluginManager().registerEvents(entityListener, this); + ShapelessRecipe portalRecipe = new ShapelessRecipe(new ItemStack( + Material.FIRE, 64)).addIngredient(Material.PORTAL); + getServer().addRecipe(portalRecipe); + System.out.println(this + " is now enabled!"); + } + } + // Transmutation mode: XP + else if (getConfig().getString("transmutation.cost").toString().equalsIgnoreCase("xp")) { System.out - .println("Economy system not found! GeometricMagic uses Vault to plug into economy systems."); + .println("[" + this + "] Transmutation cost system set to XP"); + + // Register events + playerListener = new GeometricMagicPlayerListener(this); + entityListener = new GeometricMagicDamageListener(); + getServer().getPluginManager().registerEvents(playerListener, this); + getServer().getPluginManager().registerEvents(entityListener, this); + ShapelessRecipe portalRecipe = new ShapelessRecipe(new ItemStack( + Material.FIRE, 64)).addIngredient(Material.PORTAL); + getServer().addRecipe(portalRecipe); + System.out.println(this + " is now enabled!"); } - - playerListener = new GeometricMagicPlayerListener(); - entityListener = new GeometricMagicDamageListener(); - getServer().getPluginManager().registerEvents(playerListener, this); - getServer().getPluginManager().registerEvents(entityListener, this); - ShapelessRecipe portalRecipe = new ShapelessRecipe(new ItemStack( - Material.FIRE, 64)).addIngredient(Material.PORTAL); - getServer().addRecipe(portalRecipe); - System.out.println(this + " is now enabled!"); + // Transmutation mode: Unknown + else { + System.out + .println("[" + this + "] ERROR: You have your transmutation cost system set to an unknown value. Disabling plugin!"); + getServer().getPluginManager().disablePlugin(this); + } + + // Plugin metrics + startPluginMetrics(); } // Vault Support @@ -160,5 +233,29 @@ private boolean setupEconomy() { public static Economy getEconomy() { return economy; } - + + // Copy method + private void copy(InputStream in, File file) { + try { + OutputStream out = new FileOutputStream(file); + byte[] buf = new byte[1024]; + int len; + while((len=in.read(buf))>0){ + out.write(buf,0,len); + } + out.close(); + in.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private void startPluginMetrics() { + try { + Metrics metrics = new Metrics(this); + metrics.start(); + } catch (IOException e) { + // Failed to submit the stats :-( + } + } } \ No newline at end of file diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java index 5ca3346..4bb4201 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java @@ -1,3 +1,21 @@ +/** + * GeometricMagic allows players to draw redstone circles on the ground to do things such as teleport and transmute blocks. + * Copyright (C) 2012 Alec Cox (cakenggt), Andrew Stevanus (Hoot215) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package me.cakenggt.GeometricMagic; import org.bukkit.Material; diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index c640765..12e1637 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -1,3 +1,21 @@ +/** + * GeometricMagic allows players to draw redstone circles on the ground to do things such as teleport and transmute blocks. + * Copyright (C) 2012 Alec Cox (cakenggt), Andrew Stevanus (Hoot215) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package me.cakenggt.GeometricMagic; import java.io.*; @@ -6,6 +24,8 @@ import java.util.Map; import java.util.Scanner; +import net.h31ix.anticheat.api.AnticheatAPI; +import net.h31ix.anticheat.manage.CheckType; import net.milkbowl.vault.economy.Economy; import org.bukkit.Bukkit; @@ -26,8 +46,13 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; +import org.bukkit.plugin.PluginManager; public class GeometricMagicPlayerListener implements Listener { + static GeometricMagic plugin = new GeometricMagic(); + public GeometricMagicPlayerListener(GeometricMagic instance) { + plugin = instance; + } public static Economy economy = null; @EventHandler(priority = EventPriority.HIGHEST) @@ -54,7 +79,7 @@ public void onPlayerInteract(PlayerInteractEvent event) { if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { // System.out.println("right clicked block"); if (event.getClickedBlock().getType() == Material.WORKBENCH - && sacrifices) + && sacrifices && (checkBlockBreakSimulation(event.getClickedBlock().getLocation(), event.getPlayer()))) event.getClickedBlock().setType(Material.AIR); actBlock = event.getClickedBlock(); } @@ -114,7 +139,7 @@ public static void circleChooser(Player player, World world, Block actBlock) { && southBlock.getType() == Material.REDSTONE_WIRE && eastBlock.getType() == Material.REDSTONE_WIRE && westBlock.getType() == Material.REDSTONE_WIRE) { - if (player.hasPermission("circle.teleportation")) { + if (player.hasPermission("geometricmagic.teleportation")) { // System.out.println("teleportation"); teleportationCircle(player, world, actBlock); } else @@ -129,7 +154,7 @@ public static void circleChooser(Player player, World world, Block actBlock) { && actBlock.getRelative(3, 0, 0).getType() != Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, -3).getType() != Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, 3).getType() != Material.REDSTONE_WIRE) { - if (player.hasPermission("circle.micro")) { + if (player.hasPermission("geometricmagic.micro")) { // System.out.println("micro"); microCircle(player, world, actBlock); } else @@ -149,16 +174,16 @@ public static void circleChooser(Player player, World world, Block actBlock) { // - allows use of all circles smaller than then the max // size permission node they have int circleSize = 1; - if (player.hasPermission("circle.transmutation.*") - || player.hasPermission("circle.transmutation.9")) { + if (player.hasPermission("geometricmagic.transmutation.*") + || player.hasPermission("geometricmagic.transmutation.9")) { circleSize = 9; - } else if (player.hasPermission("circle.transmutation.7")) { + } else if (player.hasPermission("geometricmagic.transmutation.7")) { circleSize = 7; - } else if (player.hasPermission("circle.transmutation.5")) { + } else if (player.hasPermission("geometricmagic.transmutation.5")) { circleSize = 5; - } else if (player.hasPermission("circle.transmutation.3")) { + } else if (player.hasPermission("geometricmagic.transmutation.3")) { circleSize = 3; - } else if (player.hasPermission("circle.transmutation.1")) { + } else if (player.hasPermission("geometricmagic.transmutation.1")) { circleSize = 1; } else { circleSize = 0; @@ -180,7 +205,7 @@ public static void circleChooser(Player player, World world, Block actBlock) { && actBlock.getRelative(3, 0, 0).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, -3).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, 3).getType() == Material.REDSTONE_WIRE) { - if (player.hasPermission("circle.set")) { + if (player.hasPermission("geometricmagic.set")) { setCircleRemote(player, world, actBlock); } else player.sendMessage("You do not have permission to use this circle"); @@ -392,9 +417,16 @@ public static void teleportationCircle(Player player, World world, } public static void microCircle(Player player, World world, Block actBlock) { - Economy econ = GeometricMagic.getEconomy(); + if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { + Economy econ = GeometricMagic.getEconomy(); - player.sendMessage("You have " + econ.format(getBalance(player))); + // Tell the player how much money they have + player.sendMessage("You have " + econ.format(getBalance(player))); + } + else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + // Tell the player how many levels they have + player.sendMessage("Your experience level is " + player.getLevel()); + } List entitiesList = player.getNearbyEntities(100, 10, 100); for (int i = 0; i < entitiesList.size(); i++) { @@ -642,37 +674,37 @@ public static void setCircleEffects(Player player, World world, if (arrayString.equals("0")) return; if (arrayString.equals("[1, 1, 3, 3]") - && player.hasPermission("circle.set.1133")) { + && player.hasPermission("geometricmagic.set.1133")) { if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } - + List repairEntities = player.getNearbyEntities(9, 10, 9); for (int i = 0; i < repairEntities.size(); i++) { if (repairEntities.get(i) instanceof Item) { Item droppedItem = (Item) repairEntities.get(i); - - // item data value + + // Item data value int itemCode = droppedItem.getItemStack().getTypeId(); - // enchants + // Enchantments Map effects = droppedItem.getItemStack().getEnchantments(); - // get cost + // Get cost if ((256 <= itemCode && itemCode <= 258) - || (267 <= itemCode && itemCode <= 279) - || (283 <= itemCode && itemCode <= 286) - || (290 <= itemCode && itemCode <= 294) - || (298 <= itemCode && itemCode <= 317) - || itemCode == 259 || itemCode == 346 - || itemCode == 359 || itemCode == 261) { + || (267 <= itemCode && itemCode <= 279) + || (283 <= itemCode && itemCode <= 286) + || (290 <= itemCode && itemCode <= 294) + || (298 <= itemCode && itemCode <= 317) + || itemCode == 259 || itemCode == 346 + || itemCode == 359 || itemCode == 261) { if ((256 <= itemCode && itemCode <= 258) - || itemCode == 267 || itemCode == 292) + || itemCode == 267 || itemCode == 292) cost = droppedItem.getItemStack().getDurability(); if ((268 <= itemCode && itemCode <= 271) - || itemCode == 290) + || itemCode == 290) cost = droppedItem.getItemStack().getDurability(); if ((272 <= itemCode && itemCode <= 275) || itemCode == 291) @@ -724,13 +756,13 @@ public static void setCircleEffects(Player player, World world, if (itemCode == 261) cost = droppedItem.getItemStack().getDurability(); cost = cost / 50; - - // make sure cost is not more than 20 + + // Make sure cost is not more than 20 if (cost > 20) cost = 20; - + if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); ItemStack newItem = new ItemStack(itemCode, 1); // enchant the item @@ -747,7 +779,7 @@ public static void setCircleEffects(Player player, World world, } } } else if (arrayString.equals("[1, 2, 2, 2]") - && player.hasPermission("circle.set.1222")) { + && player.hasPermission("geometricmagic.set.1222")) { cost = 1; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " @@ -763,19 +795,22 @@ public static void setCircleEffects(Player player, World world, for (int i = 0; i < entityList.size(); i++) { if (entityList.get(i) instanceof Item) { Item droppedItem = (Item) entityList.get(i); - calculatePay(Material.AIR, Material.AIR); - int[] valueArray = new int[2266]; - getValueArray(valueArray); + int valueArray = getBlockValue(plugin, droppedItem.getItemStack().getTypeId()); - int pay = (valueArray[droppedItem.getItemStack() - .getTypeId()] * droppedItem.getItemStack() + int pay = (valueArray * droppedItem.getItemStack() .getAmount()); - Economy econ = GeometricMagic.getEconomy(); - if (pay > 0) { - econ.depositPlayer(player.getName(), pay); - } else if (pay < 0) { - econ.withdrawPlayer(player.getName(), pay * -1); + if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { + Economy econ = GeometricMagic.getEconomy(); + if (pay > 0) { + econ.depositPlayer(player.getName(), pay); + } else if (pay < 0) { + econ.withdrawPlayer(player.getName(), pay * -1); + } + } + else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + player.setLevel((valueArray * droppedItem.getItemStack().getAmount()) + + player.getLevel()); } /* * player.setLevel((valueArray[droppedItem.getItemStack() @@ -791,7 +826,7 @@ public static void setCircleEffects(Player player, World world, return; } } else if (arrayString.equals("[1, 2, 3, 3]") - && player.hasPermission("circle.set.1233")) { + && player.hasPermission("geometricmagic.set.1233")) { cost = 20; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " @@ -824,7 +859,7 @@ public static void setCircleEffects(Player player, World world, effectBlock.getWorld().dropItem(effectBlock.getLocation(), diamondStack); } else if (arrayString.equals("[1, 2, 3, 4]") - && player.hasPermission("circle.set.1234")) { + && player.hasPermission("geometricmagic.set.1234")) { cost = 1; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " @@ -843,7 +878,7 @@ public static void setCircleEffects(Player player, World world, return; } } else if (arrayString.equals("[2, 2, 2, 3]") - && player.hasPermission("circle.set.2223")) { + && player.hasPermission("geometricmagic.set.2223")) { cost = 10; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " @@ -858,6 +893,13 @@ public static void setCircleEffects(Player player, World world, int size = setCircleSize(actBlock); List entityList = redStack.getNearbyEntities(size + 5, 128, size + 5); + + // exempt player from AntiCheat check + if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); + } + for (int i = 0; i < entityList.size(); i++) { if (entityList.get(i) instanceof Player) { HumanEntity victim = (HumanEntity) entityList.get(i); @@ -901,12 +943,18 @@ public static void setCircleEffects(Player player, World world, } } redStack.remove(); + + // unexempt player from AntiCheat check + if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); + } } else { player.sendMessage("You feel so hungry..."); return; } } else if (arrayString.equals("[2, 2, 2, 4]") - && player.hasPermission("circle.set.2224")) { + && player.hasPermission("geometricmagic.set.2224")) { cost = 10; if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); @@ -918,7 +966,7 @@ public static void setCircleEffects(Player player, World world, return; } } else if (arrayString.equals("[2, 2, 4, 4]") - && player.hasPermission("circle.set.2244")) { + && player.hasPermission("geometricmagic.set.2244")) { if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " + arrayString + "!"); @@ -992,15 +1040,15 @@ public static void setCircleEffects(Player player, World world, + highestBlock); return; } else if (arrayString.equals("[2, 3, 3, 3]") - && player.hasPermission("circle.set.2333")) { + && player.hasPermission("geometricmagic.set.2333")) { cost = 2; int size = setCircleSize(actBlock); cost = 2 + size / 2; - - // make sure cost is not more than 20 + + // Make sure cost is not more than 20 if (cost > 20) cost = 20; - + if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " + arrayString + "!"); @@ -1015,7 +1063,7 @@ public static void setCircleEffects(Player player, World world, return; } } else if (arrayString.equals("[3, 3, 3, 4]") - && player.hasPermission("circle.set.3334")) { + && player.hasPermission("geometricmagic.set.3334")) { cost = 2; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " @@ -1023,24 +1071,38 @@ public static void setCircleEffects(Player player, World world, return; } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + + // exempt player from AntiCheat check + if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); + } + alchemyFiller(Material.AIR, Material.FIRE, (byte) 0, effectBlock.getRelative(-10, 0, -10).getLocation(), effectBlock.getRelative(10, 20, 10).getLocation(), player); + + // unexempt player from AntiCheat check + if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); + } + } else { player.sendMessage("You feel so hungry..."); return; } } else if (arrayString.equals("[3, 3, 4, 4]") - && player.hasPermission("circle.set.3344")) { + && player.hasPermission("geometricmagic.set.3344")) { cost = 4; int size = setCircleSize(actBlock); cost = 4 + size / 2; - - // make sure cost is not more than 20 + + // Make sure cost is not more than 20 if (cost > 20) cost = 20; - + if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " + arrayString + "!"); @@ -1055,7 +1117,7 @@ public static void setCircleEffects(Player player, World world, return; } } else if (arrayString.equals("[3, 4, 4, 4]") - && player.hasPermission("circle.set.3444")) { + && player.hasPermission("geometricmagic.set.3444")) { cost = 20; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " @@ -1074,7 +1136,7 @@ public static void setCircleEffects(Player player, World world, return; } } else if (arrayString.equals("[0, 1, 1, 1]") - && player.hasPermission("circle.set.0111")) { + && player.hasPermission("geometricmagic.set.0111")) { cost = 16; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " @@ -1125,7 +1187,7 @@ public static void setCircleEffects(Player player, World world, return; } } else if (arrayString.equals("[0, 0, 4, 4]") - && player.hasPermission("circle.set.0044")) { + && player.hasPermission("geometricmagic.set.0044")) { cost = 10; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " @@ -1141,7 +1203,7 @@ public static void setCircleEffects(Player player, World world, return; } } else if (arrayString.equals("[0, 1, 4, 4]") - && player.hasPermission("circle.set.0144")) { + && player.hasPermission("geometricmagic.set.0144")) { cost = 10; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " @@ -1157,7 +1219,7 @@ public static void setCircleEffects(Player player, World world, return; } } else if (arrayString.equals("[0, 2, 4, 4]") - && player.hasPermission("circle.set.0244")) { + && player.hasPermission("geometricmagic.set.0244")) { cost = 10; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " @@ -1173,7 +1235,7 @@ public static void setCircleEffects(Player player, World world, return; } } else if (arrayString.equals("[0, 3, 4, 4]") - && player.hasPermission("circle.set.0344")) { + && player.hasPermission("geometricmagic.set.0344")) { cost = 10; if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " @@ -1449,6 +1511,13 @@ public static void alchemyFiller(Material a, Material b, byte toData, int xIteration = 0; int yIteration = 0; int zIteration = 0; + + // exempt player from AntiCheat check + if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); + } + if (start.getX() < end.getX()) { if (start.getZ() < end.getZ()) { // east @@ -1525,35 +1594,44 @@ public static void alchemyFiller(Material a, Material b, byte toData, } } } + + // unexempt player from AntiCheat check + if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); + } + return; } public static double getBalance(Player player) { - Economy econ = GeometricMagic.getEconomy(); + if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { + Economy econ = GeometricMagic.getEconomy(); - double balance = econ.getBalance(player.getName()); + double balance = econ.getBalance(player.getName()); - return balance; + return balance; + } + else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + double balance = player.getLevel(); + + return balance; + } + return 0; } public static void transmuteBlock(Material a, Material b, byte toData, Block startBlock, Player player) { - - Economy econ = GeometricMagic.getEconomy(); - - double balance = getBalance(player); - + int pay = calculatePay(a, b); pay = (int) (pay * philosopherStoneModifier(player)); - BlockState startBlockState = startBlock.getState(); if (startBlock.getType() == a) { - if (-1 * balance < pay) { + if (-1 * getBalance(player) < pay) { - // disallow transmuting of mob spawners completely - // block break + // Block break if (a != Material.AIR && b == Material.AIR && a != Material.CHEST && a != Material.WALL_SIGN && a != Material.SIGN_POST && a != Material.FURNACE @@ -1561,54 +1639,67 @@ public static void transmuteBlock(Material a, Material b, byte toData, && a != Material.BREWING_STAND && a != Material.WOODEN_DOOR && a != Material.IRON_DOOR_BLOCK - && a != Material.MOB_SPAWNER - && b != Material.MOB_SPAWNER) { + && a != Material.MOB_SPAWNER) { - // block break event - BlockBreakEvent break_event = new BlockBreakEvent( - startBlock, player); - Bukkit.getServer().getPluginManager() - .callEvent(break_event); - - // change block - startBlock.setType(b); - if (toData != 0) - startBlock.setData(toData); - - // deposit or withdraw to players Vault account - if (pay > 0) { - econ.depositPlayer(player.getName(), pay); - } else if (pay < 0) { - econ.withdrawPlayer(player.getName(), pay * -1); + Location blockLocation = startBlock.getLocation(); + + if (checkBlockBreakSimulation(blockLocation, player)) { + // Change block + startBlock.setType(b); + if (toData != 0) + startBlock.setData(toData); + + if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { + + Economy econ = GeometricMagic.getEconomy(); + + + // Deposit or withdraw to players Vault account + if (pay > 0) { + econ.depositPlayer(player.getName(), pay); + } else if (pay < 0) { + econ.withdrawPlayer(player.getName(), pay * -1); + } + } + else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + player.setLevel((int) (player.getLevel() + (pay * philosopherStoneModifier(player)))); + } } } - // block place + // Block place else if (a == Material.AIR && b != Material.AIR - && a != Material.MOB_SPAWNER && b != Material.MOB_SPAWNER) { + + Location blockLocation = startBlock.getLocation(); + int blockID = b.getId(); + byte blockData = 0; + + if (checkBlockPlaceSimulation(blockLocation, blockID, blockData, blockLocation, player)) { + // Change block + startBlock.setType(b); + if (toData != 0) + startBlock.setData(toData); + + if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { + + Economy econ = GeometricMagic.getEconomy(); - // change block - startBlock.setType(b); - if (toData != 0) - startBlock.setData(toData); - - // deposit or withdraw to players Vault account - if (pay > 0) { - econ.depositPlayer(player.getName(), pay); - } else if (pay < 0) { - econ.withdrawPlayer(player.getName(), pay * -1); + + // Deposit or withdraw to players Vault account + if (pay > 0) { + econ.depositPlayer(player.getName(), pay); + } else if (pay < 0) { + econ.withdrawPlayer(player.getName(), pay * -1); + } + } + else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + player.setLevel((int) (player.getLevel() + (pay * philosopherStoneModifier(player)))); + } } - - // block place event - BlockPlaceEvent place_event = new BlockPlaceEvent( - startBlock, startBlockState, startBlock, - new ItemStack(b.getId()), player, true); - Bukkit.getServer().getPluginManager() - .callEvent(place_event); } - // block break and place + // Block break and place else if (a != Material.AIR && b != Material.AIR && a != Material.CHEST && a != Material.WALL_SIGN && a != Material.SIGN_POST && a != Material.FURNACE @@ -1618,31 +1709,33 @@ else if (a != Material.AIR && b != Material.AIR && a != Material.MOB_SPAWNER && b != Material.MOB_SPAWNER && a != Material.IRON_DOOR_BLOCK) { + + Location blockLocation = startBlock.getLocation(); + int blockID = b.getId(); + byte blockData = 0; + + if (checkBlockBreakSimulation(blockLocation, player) && checkBlockPlaceSimulation(blockLocation, blockID, blockData, blockLocation, player)) { + // Change block + startBlock.setType(b); + if (toData != 0) + startBlock.setData(toData); + + if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { + + Economy econ = GeometricMagic.getEconomy(); - // block break event - BlockBreakEvent break_event = new BlockBreakEvent( - startBlock, player); - Bukkit.getServer().getPluginManager() - .callEvent(break_event); - - // change block - startBlock.setType(b); - if (toData != 0) - startBlock.setData(toData); - - // deposit or withdraw to players Vault account - if (pay > 0) { - econ.depositPlayer(player.getName(), pay); - } else if (pay < 0) { - econ.withdrawPlayer(player.getName(), pay * -1); + + // Deposit or withdraw to players Vault account + if (pay > 0) { + econ.depositPlayer(player.getName(), pay); + } else if (pay < 0) { + econ.withdrawPlayer(player.getName(), pay * -1); + } + } + else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + player.setLevel((int) (player.getLevel() + (pay * philosopherStoneModifier(player)))); + } } - - // block place event - BlockPlaceEvent place_event = new BlockPlaceEvent( - startBlock, startBlockState, startBlock, - new ItemStack(b.getId()), player, true); - Bukkit.getServer().getPluginManager() - .callEvent(place_event); } // output to console @@ -1662,266 +1755,10 @@ else if ((a != Material.AIR && b != Material.AIR) } public static int calculatePay(Material a, Material b) { - int[] valueArray = new int[2266]; - // array index is block id, value in array is xp - Arrays.fill(valueArray, 0); - valueArray[0] = 0; - valueArray[1] = 6; - valueArray[2] = 1; - valueArray[3] = 1; - valueArray[4] = 4; - valueArray[5] = 4; - valueArray[6] = 8; - valueArray[7] = 0; - valueArray[8] = 0; - valueArray[9] = 1; - valueArray[10] = 0; - valueArray[11] = 200; - valueArray[12] = 1; - valueArray[13] = 2; - valueArray[14] = 384; - valueArray[15] = 96; - valueArray[16] = 16; - valueArray[17] = 16; - valueArray[18] = 1; - valueArray[19] = 0; - valueArray[20] = 3; - valueArray[21] = 144; - valueArray[22] = 216; - valueArray[23] = 51; - valueArray[24] = 4; - valueArray[25] = 40; - valueArray[26] = 48; - valueArray[27] = 384; - valueArray[28] = 96; - valueArray[29] = 153; - valueArray[30] = 24; - valueArray[31] = 1; - valueArray[32] = 1; - valueArray[33] = 132; - valueArray[34] = 0; - valueArray[35] = 12; - valueArray[36] = 0; - valueArray[37] = 48; - valueArray[38] = 48; - valueArray[39] = 32; - valueArray[40] = 32; - valueArray[41] = 3456; - valueArray[42] = 864; - valueArray[43] = 8; - valueArray[44] = 4; - valueArray[45] = 24; - valueArray[46] = 484; - valueArray[47] = 96; - valueArray[48] = 4; - valueArray[49] = 192; - valueArray[50] = 4; - valueArray[51] = 1; - valueArray[52] = 0; - valueArray[53] = 6; - valueArray[54] = 32; - valueArray[55] = 8; - valueArray[56] = 1536; - valueArray[57] = 13824; - valueArray[58] = 16; - valueArray[59] = 4; - valueArray[60] = 1; - valueArray[61] = 32; - valueArray[62] = 32; - valueArray[63] = 0; - valueArray[64] = 24; - valueArray[65] = 7; - valueArray[66] = 36; - valueArray[67] = 6; - valueArray[68] = 0; - valueArray[69] = 6; - valueArray[70] = 12; - valueArray[71] = 576; - valueArray[72] = 8; - valueArray[73] = 32; - valueArray[74] = 32; - valueArray[75] = 10; - valueArray[76] = 10; - valueArray[77] = 12; - valueArray[78] = 1; - valueArray[79] = 4; - valueArray[80] = 4; - valueArray[81] = 8; - valueArray[82] = 16; - valueArray[83] = 8; - valueArray[84] = 1568; - valueArray[85] = 6; - valueArray[86] = 64; - valueArray[87] = 1; - valueArray[88] = 2; - valueArray[89] = 128; - valueArray[90] = 0; - valueArray[91] = 68; - valueArray[92] = 163; - valueArray[93] = 46; - valueArray[94] = 46; - valueArray[95] = 0; - valueArray[96] = 12; - valueArray[97] = 0; - valueArray[98] = 6; - valueArray[99] = 32; - valueArray[100] = 32; - valueArray[101] = 36; - valueArray[102] = 1; - valueArray[103] = 64; - valueArray[104] = 16; - valueArray[105] = 7; - valueArray[106] = 1; - valueArray[107] = 16; - valueArray[108] = 36; - valueArray[109] = 9; - valueArray[110] = 1; - valueArray[111] = 0; - valueArray[112] = 0; - valueArray[113] = 0; - valueArray[114] = 0; - valueArray[115] = 8; - valueArray[116] = 0; - valueArray[117] = 0; - valueArray[118] = 0; - valueArray[119] = 0; - valueArray[120] = 0; - valueArray[121] = 1; - valueArray[122] = 0; - int valueDifference = valueArray[a.getId()] - valueArray[b.getId()]; + int valueDifference = getBlockValue(plugin, a.getId()) - getBlockValue(plugin, b.getId()); return valueDifference; } - public static int[] getValueArray(int[] valueArray) { - // int[] valueArray = new int[2266]; - // array index is block id, value in array is xp - Arrays.fill(valueArray, 0); - valueArray[0] = 0; - valueArray[1] = 6; - valueArray[2] = 1; - valueArray[3] = 1; - valueArray[4] = 4; - valueArray[5] = 4; - valueArray[6] = 8; - valueArray[7] = 0; - valueArray[8] = 0; - valueArray[9] = 1; - valueArray[10] = 0; - valueArray[11] = 200; - valueArray[12] = 1; - valueArray[13] = 2; - valueArray[14] = 384; - valueArray[15] = 96; - valueArray[16] = 16; - valueArray[17] = 16; - valueArray[18] = 1; - valueArray[19] = 0; - valueArray[20] = 3; - valueArray[21] = 144; - valueArray[22] = 216; - valueArray[23] = 51; - valueArray[24] = 4; - valueArray[25] = 40; - valueArray[26] = 48; - valueArray[27] = 384; - valueArray[28] = 96; - valueArray[29] = 153; - valueArray[30] = 24; - valueArray[31] = 1; - valueArray[32] = 1; - valueArray[33] = 132; - valueArray[34] = 0; - valueArray[35] = 12; - valueArray[36] = 0; - valueArray[37] = 48; - valueArray[38] = 48; - valueArray[39] = 32; - valueArray[40] = 32; - valueArray[41] = 3456; - valueArray[42] = 864; - valueArray[43] = 8; - valueArray[44] = 4; - valueArray[45] = 24; - valueArray[46] = 484; - valueArray[47] = 96; - valueArray[48] = 4; - valueArray[49] = 192; - valueArray[50] = 4; - valueArray[51] = 1; - valueArray[52] = 0; - valueArray[53] = 6; - valueArray[54] = 32; - valueArray[55] = 8; - valueArray[56] = 1536; - valueArray[57] = 13824; - valueArray[58] = 16; - valueArray[59] = 4; - valueArray[60] = 1; - valueArray[61] = 32; - valueArray[62] = 32; - valueArray[63] = 0; - valueArray[64] = 24; - valueArray[65] = 7; - valueArray[66] = 36; - valueArray[67] = 6; - valueArray[68] = 0; - valueArray[69] = 6; - valueArray[70] = 12; - valueArray[71] = 576; - valueArray[72] = 8; - valueArray[73] = 32; - valueArray[74] = 32; - valueArray[75] = 10; - valueArray[76] = 10; - valueArray[77] = 12; - valueArray[78] = 1; - valueArray[79] = 4; - valueArray[80] = 4; - valueArray[81] = 8; - valueArray[82] = 16; - valueArray[83] = 8; - valueArray[84] = 1568; - valueArray[85] = 6; - valueArray[86] = 64; - valueArray[87] = 1; - valueArray[88] = 2; - valueArray[89] = 128; - valueArray[90] = 0; - valueArray[91] = 68; - valueArray[92] = 163; - valueArray[93] = 46; - valueArray[94] = 46; - valueArray[95] = 0; - valueArray[96] = 12; - valueArray[97] = 0; - valueArray[98] = 6; - valueArray[99] = 32; - valueArray[100] = 32; - valueArray[101] = 36; - valueArray[102] = 1; - valueArray[103] = 64; - valueArray[104] = 16; - valueArray[105] = 7; - valueArray[106] = 1; - valueArray[107] = 16; - valueArray[108] = 36; - valueArray[109] = 9; - valueArray[110] = 1; - valueArray[111] = 0; - valueArray[112] = 0; - valueArray[113] = 0; - valueArray[114] = 0; - valueArray[115] = 8; - valueArray[116] = 0; - valueArray[117] = 0; - valueArray[118] = 0; - valueArray[119] = 0; - valueArray[120] = 0; - valueArray[121] = 1; - valueArray[122] = 0; - return valueArray; - } - public static double philosopherStoneModifier(Player player) { double modifier = 1; int stackCount = 0; @@ -2062,4 +1899,47 @@ public static boolean learnCircle(Player player, String circle, redStack.remove(); return status; } + + public static String getTransmutationCostSystem(GeometricMagic plugin) { + return plugin.getConfig().getString("transmutation.cost").toString(); + } + + public static Integer getBlockValue(GeometricMagic plugin, int i) { + return plugin.getConfig().getInt("values." + i); + } + + // Lyneira's Code Start + public static boolean checkBlockPlaceSimulation(Location target, int typeId, byte data, + Location placedAgainst, Player player) { + Block placedBlock = target.getBlock(); + BlockState replacedBlockState = placedBlock.getState(); + int oldType = replacedBlockState.getTypeId(); + byte oldData = replacedBlockState.getRawData(); + + // Set the new state without physics. + placedBlock.setTypeIdAndData(typeId, data, false); + BlockPlaceEvent placeEvent = new BlockPlaceEvent(placedBlock, replacedBlockState, + placedAgainst.getBlock(), null, player, true); + ((PluginManager) getPluginManager(plugin)).callEvent(placeEvent); + + // Revert to the old state without physics. + placedBlock.setTypeIdAndData(oldType, oldData, false); + if (placeEvent.isCancelled()) + return false; + return true; + } + + public static boolean checkBlockBreakSimulation(Location target, Player player) { + Block block = target.getBlock(); + BlockBreakEvent breakEvent = new BlockBreakEvent(block, player); + ((PluginManager) getPluginManager(plugin)).callEvent(breakEvent); + if (breakEvent.isCancelled()) + return false; + return true; + } + // Lyneira's Code End + + public static Object getPluginManager(GeometricMagic plugin) { + return plugin.getServer().getPluginManager(); + } } diff --git a/src/me/cakenggt/GeometricMagic/Metrics.java b/src/me/cakenggt/GeometricMagic/Metrics.java new file mode 100644 index 0000000..0f10dc1 --- /dev/null +++ b/src/me/cakenggt/GeometricMagic/Metrics.java @@ -0,0 +1,607 @@ +/** + * GeometricMagic allows players to draw redstone circles on the ground to do things such as teleport and transmute blocks. + * Copyright (C) 2012 Alec Cox (cakenggt), Andrew Stevanus (Hoot215) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package me.cakenggt.GeometricMagic; + +import org.bukkit.Bukkit; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.configuration.InvalidConfigurationException; +import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.PluginDescriptionFile; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; +import java.net.Proxy; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.Set; +import java.util.UUID; +import java.util.logging.Level; + +/** + *

+ * The metrics class obtains data about a plugin and submits statistics about it to the metrics backend. + *

+ *

+ * Public methods provided by this class: + *

+ * + * Graph createGraph(String name);
+ * void addCustomData(Metrics.Plotter plotter);
+ * void start();
+ *
+ */ +public class Metrics { + + /** + * The current revision number + */ + private final static int REVISION = 5; + + /** + * The base url of the metrics domain + */ + private static final String BASE_URL = "http://mcstats.org"; + + /** + * The url used to report a server's status + */ + private static final String REPORT_URL = "/report/%s"; + + /** + * The file where guid and opt out is stored in + */ + private static final String CONFIG_FILE = "plugins/PluginMetrics/config.yml"; + + /** + * The separator to use for custom data. This MUST NOT change unless you are hosting your own + * version of metrics and want to change it. + */ + private static final String CUSTOM_DATA_SEPARATOR = "~~"; + + /** + * Interval of time to ping (in minutes) + */ + private static final int PING_INTERVAL = 10; + + /** + * The plugin this metrics submits for + */ + private final Plugin plugin; + + /** + * All of the custom graphs to submit to metrics + */ + private final Set graphs = Collections.synchronizedSet(new HashSet()); + + /** + * The default graph, used for addCustomData when you don't want a specific graph + */ + private final Graph defaultGraph = new Graph("Default"); + + /** + * The plugin configuration file + */ + private final YamlConfiguration configuration; + + /** + * The plugin configuration file + */ + private final File configurationFile; + + /** + * Unique server id + */ + private final String guid; + + /** + * Lock for synchronization + */ + private final Object optOutLock = new Object(); + + /** + * Id of the scheduled task + */ + private volatile int taskId = -1; + + public Metrics(final Plugin plugin) throws IOException { + if (plugin == null) { + throw new IllegalArgumentException("Plugin cannot be null"); + } + + this.plugin = plugin; + + // load the config + configurationFile = new File(CONFIG_FILE); + configuration = YamlConfiguration.loadConfiguration(configurationFile); + + // add some defaults + configuration.addDefault("opt-out", false); + configuration.addDefault("guid", UUID.randomUUID().toString()); + + // Do we need to create the file? + if (configuration.get("guid", null) == null) { + configuration.options().header("http://mcstats.org").copyDefaults(true); + configuration.save(configurationFile); + } + + // Load the guid then + guid = configuration.getString("guid"); + } + + /** + * Construct and create a Graph that can be used to separate specific plotters to their own graphs + * on the metrics website. Plotters can be added to the graph object returned. + * + * @param name + * @return Graph object created. Will never return NULL under normal circumstances unless bad parameters are given + */ + public Graph createGraph(final String name) { + if (name == null) { + throw new IllegalArgumentException("Graph name cannot be null"); + } + + // Construct the graph object + final Graph graph = new Graph(name); + + // Now we can add our graph + graphs.add(graph); + + // and return back + return graph; + } + + /** + * Add a Graph object to Metrics that represents data for the plugin that should be sent to the backend + * + * @param graph + */ + public void addGraph(final Graph graph) { + if (graph == null) { + throw new IllegalArgumentException("Graph cannot be null"); + } + + graphs.add(graph); + } + + /** + * Adds a custom data plotter to the default graph + * + * @param plotter + */ + public void addCustomData(final Plotter plotter) { + if (plotter == null) { + throw new IllegalArgumentException("Plotter cannot be null"); + } + + // Add the plotter to the graph o/ + defaultGraph.addPlotter(plotter); + + // Ensure the default graph is included in the submitted graphs + graphs.add(defaultGraph); + } + + /** + * Start measuring statistics. This will immediately create an async repeating task as the plugin and send + * the initial data to the metrics backend, and then after that it will post in increments of + * PING_INTERVAL * 1200 ticks. + * + * @return True if statistics measuring is running, otherwise false. + */ + public boolean start() { + synchronized (optOutLock) { + // Did we opt out? + if (isOptOut()) { + return false; + } + + // Is metrics already running? + if (taskId >= 0) { + return true; + } + + // Begin hitting the server with glorious data + taskId = plugin.getServer().getScheduler().scheduleAsyncRepeatingTask(plugin, new Runnable() { + + private boolean firstPost = true; + + public void run() { + try { + // This has to be synchronized or it can collide with the disable method. + synchronized (optOutLock) { + // Disable Task, if it is running and the server owner decided to opt-out + if (isOptOut() && taskId > 0) { + plugin.getServer().getScheduler().cancelTask(taskId); + taskId = -1; + // Tell all plotters to stop gathering information. + for (Graph graph : graphs){ + graph.onOptOut(); + } + } + } + + // We use the inverse of firstPost because if it is the first time we are posting, + // it is not a interval ping, so it evaluates to FALSE + // Each time thereafter it will evaluate to TRUE, i.e PING! + postPlugin(!firstPost); + + // After the first post we set firstPost to false + // Each post thereafter will be a ping + firstPost = false; + } catch (IOException e) { + Bukkit.getLogger().log(Level.INFO, "[Metrics] " + e.getMessage()); + } + } + }, 0, PING_INTERVAL * 1200); + + return true; + } + } + + /** + * Has the server owner denied plugin metrics? + * + * @return + */ + public boolean isOptOut() { + synchronized(optOutLock) { + try { + // Reload the metrics file + configuration.load(CONFIG_FILE); + } catch (IOException ex) { + Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); + return true; + } catch (InvalidConfigurationException ex) { + Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); + return true; + } + return configuration.getBoolean("opt-out", false); + } + } + + /** + * Enables metrics for the server by setting "opt-out" to false in the config file and starting the metrics task. + * + * @throws IOException + */ + public void enable() throws IOException { + // This has to be synchronized or it can collide with the check in the task. + synchronized (optOutLock) { + // Check if the server owner has already set opt-out, if not, set it. + if (isOptOut()) { + configuration.set("opt-out", false); + configuration.save(configurationFile); + } + + // Enable Task, if it is not running + if (taskId < 0) { + start(); + } + } + } + + /** + * Disables metrics for the server by setting "opt-out" to true in the config file and canceling the metrics task. + * + * @throws IOException + */ + public void disable() throws IOException { + // This has to be synchronized or it can collide with the check in the task. + synchronized (optOutLock) { + // Check if the server owner has already set opt-out, if not, set it. + if (!isOptOut()) { + configuration.set("opt-out", true); + configuration.save(configurationFile); + } + + // Disable Task, if it is running + if (taskId > 0) { + this.plugin.getServer().getScheduler().cancelTask(taskId); + taskId = -1; + } + } + } + + /** + * Generic method that posts a plugin to the metrics website + */ + private void postPlugin(final boolean isPing) throws IOException { + // The plugin's description file containg all of the plugin data such as name, version, author, etc + final PluginDescriptionFile description = plugin.getDescription(); + + // Construct the post data + final StringBuilder data = new StringBuilder(); + data.append(encode("guid")).append('=').append(encode(guid)); + encodeDataPair(data, "version", description.getVersion()); + encodeDataPair(data, "server", Bukkit.getVersion()); + encodeDataPair(data, "players", Integer.toString(Bukkit.getServer().getOnlinePlayers().length)); + encodeDataPair(data, "revision", String.valueOf(REVISION)); + + // If we're pinging, append it + if (isPing) { + encodeDataPair(data, "ping", "true"); + } + + // Acquire a lock on the graphs, which lets us make the assumption we also lock everything + // inside of the graph (e.g plotters) + synchronized (graphs) { + final Iterator iter = graphs.iterator(); + + while (iter.hasNext()) { + final Graph graph = iter.next(); + + for (Plotter plotter : graph.getPlotters()) { + // The key name to send to the metrics server + // The format is C-GRAPHNAME-PLOTTERNAME where separator - is defined at the top + // Legacy (R4) submitters use the format Custom%s, or CustomPLOTTERNAME + final String key = String.format("C%s%s%s%s", CUSTOM_DATA_SEPARATOR, graph.getName(), CUSTOM_DATA_SEPARATOR, plotter.getColumnName()); + + // The value to send, which for the foreseeable future is just the string + // value of plotter.getValue() + final String value = Integer.toString(plotter.getValue()); + + // Add it to the http post data :) + encodeDataPair(data, key, value); + } + } + } + + // Create the url + URL url = new URL(BASE_URL + String.format(REPORT_URL, encode(plugin.getDescription().getName()))); + + // Connect to the website + URLConnection connection; + + // Mineshafter creates a socks proxy, so we can safely bypass it + // It does not reroute POST requests so we need to go around it + if (isMineshafterPresent()) { + connection = url.openConnection(Proxy.NO_PROXY); + } else { + connection = url.openConnection(); + } + + connection.setDoOutput(true); + + // Write the data + final OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream()); + writer.write(data.toString()); + writer.flush(); + + // Now read the response + final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); + final String response = reader.readLine(); + + // close resources + writer.close(); + reader.close(); + + if (response == null || response.startsWith("ERR")) { + throw new IOException(response); //Throw the exception + } else { + // Is this the first update this hour? + if (response.contains("OK This is your first update this hour")) { + synchronized (graphs) { + final Iterator iter = graphs.iterator(); + + while (iter.hasNext()) { + final Graph graph = iter.next(); + + for (Plotter plotter : graph.getPlotters()) { + plotter.reset(); + } + } + } + } + } + } + + /** + * Check if mineshafter is present. If it is, we need to bypass it to send POST requests + * + * @return + */ + private boolean isMineshafterPresent() { + try { + Class.forName("mineshafter.MineServer"); + return true; + } catch (Exception e) { + return false; + } + } + + /** + *

Encode a key/value data pair to be used in a HTTP post request. This INCLUDES a & so the first + * key/value pair MUST be included manually, e.g:

+ * + * StringBuffer data = new StringBuffer(); + * data.append(encode("guid")).append('=').append(encode(guid)); + * encodeDataPair(data, "version", description.getVersion()); + * + * + * @param buffer + * @param key + * @param value + * @return + */ + private static void encodeDataPair(final StringBuilder buffer, final String key, final String value) throws UnsupportedEncodingException { + buffer.append('&').append(encode(key)).append('=').append(encode(value)); + } + + /** + * Encode text as UTF-8 + * + * @param text + * @return + */ + private static String encode(final String text) throws UnsupportedEncodingException { + return URLEncoder.encode(text, "UTF-8"); + } + + /** + * Represents a custom graph on the website + */ + public static class Graph { + + /** + * The graph's name, alphanumeric and spaces only :) + * If it does not comply to the above when submitted, it is rejected + */ + private final String name; + + /** + * The set of plotters that are contained within this graph + */ + private final Set plotters = new LinkedHashSet(); + + private Graph(final String name) { + this.name = name; + } + + /** + * Gets the graph's name + * + * @return + */ + public String getName() { + return name; + } + + /** + * Add a plotter to the graph, which will be used to plot entries + * + * @param plotter + */ + public void addPlotter(final Plotter plotter) { + plotters.add(plotter); + } + + /** + * Remove a plotter from the graph + * + * @param plotter + */ + public void removePlotter(final Plotter plotter) { + plotters.remove(plotter); + } + + /** + * Gets an unmodifiable set of the plotter objects in the graph + * + * @return + */ + public Set getPlotters() { + return Collections.unmodifiableSet(plotters); + } + + @Override + public int hashCode() { + return name.hashCode(); + } + + @Override + public boolean equals(final Object object) { + if (!(object instanceof Graph)) { + return false; + } + + final Graph graph = (Graph) object; + return graph.name.equals(name); + } + + /** + * Called when the server owner decides to opt-out of Metrics while the server is running. + */ + protected void onOptOut(){} + + } + + /** + * Interface used to collect custom data for a plugin + */ + public static abstract class Plotter { + + /** + * The plot's name + */ + private final String name; + + /** + * Construct a plotter with the default plot name + */ + public Plotter() { + this("Default"); + } + + /** + * Construct a plotter with a specific plot name + * + * @param name + */ + public Plotter(final String name) { + this.name = name; + } + + /** + * Get the current value for the plotted point + * + * @return + */ + public abstract int getValue(); + + /** + * Get the column name for the plotted point + * + * @return the plotted point's column name + */ + public String getColumnName() { + return name; + } + + /** + * Called after the website graphs have been updated + */ + public void reset() { + } + + @Override + public int hashCode() { + return getColumnName().hashCode(); + } + + @Override + public boolean equals(final Object object) { + if (!(object instanceof Plotter)) { + return false; + } + + final Plotter plotter = (Plotter) object; + return plotter.name.equals(name) && plotter.getValue() == getValue(); + } + + } + +} \ No newline at end of file From 93bf1b6ca4b7018ee6374e644e8f8e3f809811fb Mon Sep 17 00:00:00 2001 From: ty2u Date: Wed, 4 Jul 2012 14:39:58 -0400 Subject: [PATCH 058/133] Another AntiCheat check --- .../GeometricMagicPlayerListener.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 12e1637..637cb14 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -1110,8 +1110,22 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + + // exempt player from AntiCheat check + if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); + } + effectBlock.getWorld().createExplosion( effectBlock.getLocation(), 8 + size, true); + + // unexempt player from AntiCheat check + if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); + } + } else { player.sendMessage("You feel so hungry..."); return; From 8350589f0d9764ddb8a04636630825a4b741eb15 Mon Sep 17 00:00:00 2001 From: ty2u Date: Wed, 4 Jul 2012 14:46:23 -0400 Subject: [PATCH 059/133] Remove an unneeded AntiCheat check --- .../GeometricMagic/GeometricMagicPlayerListener.java | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 637cb14..8e17f3f 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -1072,23 +1072,11 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - // exempt player from AntiCheat check - if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { - AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); - AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); - } - alchemyFiller(Material.AIR, Material.FIRE, (byte) 0, effectBlock.getRelative(-10, 0, -10).getLocation(), effectBlock.getRelative(10, 20, 10).getLocation(), player); - // unexempt player from AntiCheat check - if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { - AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); - AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); - } - } else { player.sendMessage("You feel so hungry..."); return; From c1292e286051fd6efbc982f0528c60fa510ff93a Mon Sep 17 00:00:00 2001 From: ty2u Date: Wed, 4 Jul 2012 15:01:52 -0400 Subject: [PATCH 060/133] Trying to fix an NPE --- .../GeometricMagic/GeometricMagic.java | 4 ++-- .../GeometricMagicDamageListener.java | 24 ++++++++++++++----- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagic.java b/src/me/cakenggt/GeometricMagic/GeometricMagic.java index dda6d4d..7c4dedf 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagic.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagic.java @@ -182,7 +182,7 @@ public void onEnable() { // Register events playerListener = new GeometricMagicPlayerListener(this); - entityListener = new GeometricMagicDamageListener(); + entityListener = new GeometricMagicDamageListener(this); getServer().getPluginManager().registerEvents(playerListener, this); getServer().getPluginManager().registerEvents(entityListener, this); ShapelessRecipe portalRecipe = new ShapelessRecipe(new ItemStack( @@ -198,7 +198,7 @@ else if (getConfig().getString("transmutation.cost").toString().equalsIgnoreCase // Register events playerListener = new GeometricMagicPlayerListener(this); - entityListener = new GeometricMagicDamageListener(); + entityListener = new GeometricMagicDamageListener(this); getServer().getPluginManager().registerEvents(playerListener, this); getServer().getPluginManager().registerEvents(entityListener, this); ShapelessRecipe portalRecipe = new ShapelessRecipe(new ItemStack( diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java index 4bb4201..09626f4 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java @@ -27,27 +27,38 @@ import org.bukkit.event.entity.EntityDamageEvent; public class GeometricMagicDamageListener implements Listener { + private GeometricMagic plugin; + + public GeometricMagicDamageListener (GeometricMagic plugin) { + this.plugin = plugin; + } + + public GeometricMagic getPlugin() { + return plugin; + } + @EventHandler(priority = EventPriority.HIGHEST) public void onEntityDamage(EntityDamageEvent event) { // System.out.println("entity damage event"); Entity entity = event.getEntity(); int damage = event.getDamage(); + if (entity instanceof Player) { // System.out.println("instance of player"); Player player = (Player) entity; int health = player.getHealth(); + while (player.getInventory().contains(Material.FIRE)) { + // System.out.println("contains fire"); if (health - damage <= 0) { boolean removedFire = false; - for (int i = 0; i < player.getInventory().getSize() - && !removedFire; i++) { + + for (int i = 0; i < player.getInventory().getSize() && !removedFire; i++) { if (player.getInventory().getItem(i).getType() == Material.FIRE) { // System.out.println("removed a fire"); - int amount = player.getInventory().getItem(i) - .getAmount(); - player.getInventory().getItem(i) - .setAmount(amount - 1); + int amount = player.getInventory().getItem(i).getAmount(); + player.getInventory().getItem(i).setAmount(amount - 1); if (amount - 1 <= 0) { player.getInventory().clear(i); } @@ -57,6 +68,7 @@ public void onEntityDamage(EntityDamageEvent event) { removedFire = true; } } + } else { event.setDamage(damage); return; From 4c6cf720a6bd99a090f7cafe75624f2503f82d99 Mon Sep 17 00:00:00 2001 From: ty2u Date: Wed, 4 Jul 2012 15:15:08 -0400 Subject: [PATCH 061/133] Add charge param for fire circle so it doesn't take all our energy --- build.xml | 6 - .../GeometricMagicPlayerListener.java | 105 +++++++++--------- 2 files changed, 54 insertions(+), 57 deletions(-) delete mode 100644 build.xml diff --git a/build.xml b/build.xml deleted file mode 100644 index 078b466..0000000 --- a/build.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 8e17f3f..4b1a027 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -1075,7 +1075,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { alchemyFiller(Material.AIR, Material.FIRE, (byte) 0, effectBlock.getRelative(-10, 0, -10).getLocation(), effectBlock.getRelative(10, 20, 10).getLocation(), - player); + player, false); } else { player.sendMessage("You feel so hungry..."); @@ -1361,7 +1361,7 @@ public static void alchemyCheck(Material a, Material b, byte toData, yIteration * width + width - 1, (zIteration * width + (width - 1))) - .getLocation(), player); + .getLocation(), player, true); } zIteration++; startBlock = startBlock.getRelative(0, 0, 1); @@ -1400,7 +1400,7 @@ public static void alchemyCheck(Material a, Material b, byte toData, yIteration * width + width - 1, (zIteration * width - (width - 1))) - .getLocation(), player); + .getLocation(), player, true); } xIteration++; // System.out.println("xloop " + xIteration); @@ -1444,7 +1444,7 @@ public static void alchemyCheck(Material a, Material b, byte toData, yIteration * width + width - 1, (zIteration * width - (width - 1))) - .getLocation(), player); + .getLocation(), player, true); } zIteration--; startBlock = startBlock.getRelative(0, 0, -1); @@ -1483,7 +1483,7 @@ public static void alchemyCheck(Material a, Material b, byte toData, yIteration * width + width - 1, (zIteration * width + (width - 1))) - .getLocation(), player); + .getLocation(), player, true); } xIteration--; // System.out.println("xloop"); @@ -1507,7 +1507,7 @@ public static void alchemyCheck(Material a, Material b, byte toData, } public static void alchemyFiller(Material a, Material b, byte toData, - Location start, Location end, Player player) { + Location start, Location end, Player player, boolean charge) { // System.out.println("alchemyFiller"); Block startBlock = start.getBlock(); int xIteration = 0; @@ -1527,7 +1527,7 @@ public static void alchemyFiller(Material a, Material b, byte toData, while (startBlock.getY() <= end.getY()) { while (startBlock.getX() <= end.getX()) { while (startBlock.getZ() <= end.getZ()) { - transmuteBlock(a, b, toData, startBlock, player); + transmuteBlock(a, b, toData, startBlock, player, charge); startBlock = startBlock.getRelative(0, 0, 1); } xIteration++; @@ -1544,7 +1544,7 @@ public static void alchemyFiller(Material a, Material b, byte toData, while (startBlock.getY() <= end.getY()) { while (startBlock.getZ() >= end.getZ()) { while (startBlock.getX() <= end.getX()) { - transmuteBlock(a, b, toData, startBlock, player); + transmuteBlock(a, b, toData, startBlock, player, charge); startBlock = startBlock.getRelative(1, 0, 0); } zIteration--; @@ -1563,7 +1563,7 @@ public static void alchemyFiller(Material a, Material b, byte toData, while (startBlock.getY() <= end.getY()) { while (startBlock.getX() >= end.getX()) { while (startBlock.getZ() >= end.getZ()) { - transmuteBlock(a, b, toData, startBlock, player); + transmuteBlock(a, b, toData, startBlock, player, charge); startBlock = startBlock.getRelative(0, 0, -1); } xIteration--; @@ -1580,7 +1580,7 @@ public static void alchemyFiller(Material a, Material b, byte toData, while (startBlock.getY() <= end.getY()) { while (startBlock.getZ() <= end.getZ()) { while (startBlock.getX() >= end.getX()) { - transmuteBlock(a, b, toData, startBlock, player); + transmuteBlock(a, b, toData, startBlock, player, charge); startBlock = startBlock.getRelative(-1, 0, 0); // System.out.println("xloopfiller"); } @@ -1624,14 +1624,14 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } public static void transmuteBlock(Material a, Material b, byte toData, - Block startBlock, Player player) { + Block startBlock, Player player, boolean charge) { int pay = calculatePay(a, b); pay = (int) (pay * philosopherStoneModifier(player)); if (startBlock.getType() == a) { - if (-1 * getBalance(player) < pay) { + if (-1 * getBalance(player) < pay || !charge) { // Block break if (a != Material.AIR && b == Material.AIR @@ -1651,20 +1651,21 @@ public static void transmuteBlock(Material a, Material b, byte toData, if (toData != 0) startBlock.setData(toData); - if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { - - Economy econ = GeometricMagic.getEconomy(); - - - // Deposit or withdraw to players Vault account - if (pay > 0) { - econ.depositPlayer(player.getName(), pay); - } else if (pay < 0) { - econ.withdrawPlayer(player.getName(), pay * -1); + if (charge) { + if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { + + Economy econ = GeometricMagic.getEconomy(); + + // Deposit or withdraw to players Vault account + if (pay > 0) { + econ.depositPlayer(player.getName(), pay); + } else if (pay < 0) { + econ.withdrawPlayer(player.getName(), pay * -1); + } + } + else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + player.setLevel((int) (player.getLevel() + (pay * philosopherStoneModifier(player)))); } - } - else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { - player.setLevel((int) (player.getLevel() + (pay * philosopherStoneModifier(player)))); } } } @@ -1683,20 +1684,21 @@ else if (a == Material.AIR && b != Material.AIR if (toData != 0) startBlock.setData(toData); - if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { - - Economy econ = GeometricMagic.getEconomy(); - - - // Deposit or withdraw to players Vault account - if (pay > 0) { - econ.depositPlayer(player.getName(), pay); - } else if (pay < 0) { - econ.withdrawPlayer(player.getName(), pay * -1); + if (charge) { + if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { + + Economy econ = GeometricMagic.getEconomy(); + + // Deposit or withdraw to players Vault account + if (pay > 0) { + econ.depositPlayer(player.getName(), pay); + } else if (pay < 0) { + econ.withdrawPlayer(player.getName(), pay * -1); + } + } + else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + player.setLevel((int) (player.getLevel() + (pay * philosopherStoneModifier(player)))); } - } - else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { - player.setLevel((int) (player.getLevel() + (pay * philosopherStoneModifier(player)))); } } } @@ -1722,20 +1724,21 @@ else if (a != Material.AIR && b != Material.AIR if (toData != 0) startBlock.setData(toData); - if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { - - Economy econ = GeometricMagic.getEconomy(); - - - // Deposit or withdraw to players Vault account - if (pay > 0) { - econ.depositPlayer(player.getName(), pay); - } else if (pay < 0) { - econ.withdrawPlayer(player.getName(), pay * -1); + if (charge) { + if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { + + Economy econ = GeometricMagic.getEconomy(); + + // Deposit or withdraw to players Vault account + if (pay > 0) { + econ.depositPlayer(player.getName(), pay); + } else if (pay < 0) { + econ.withdrawPlayer(player.getName(), pay * -1); + } + } + else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + player.setLevel((int) (player.getLevel() + (pay * philosopherStoneModifier(player)))); } - } - else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { - player.setLevel((int) (player.getLevel() + (pay * philosopherStoneModifier(player)))); } } } From 347921aa59f51b49c917ae2471824b8513381682 Mon Sep 17 00:00:00 2001 From: ty2u Date: Wed, 4 Jul 2012 15:52:18 -0400 Subject: [PATCH 062/133] Fix AntiCheat checks --- .../GeometricMagicPlayerListener.java | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 4b1a027..6bdd737 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -898,6 +898,8 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.exemptPlayer(player, CheckType.LONG_REACH); + AnticheatAPI.exemptPlayer(player, CheckType.NO_SWING); } for (int i = 0; i < entityList.size(); i++) { @@ -946,8 +948,10 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { // unexempt player from AntiCheat check if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { - AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); - AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.unexemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.unexemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.unexemptPlayer(player, CheckType.LONG_REACH); + AnticheatAPI.unexemptPlayer(player, CheckType.NO_SWING); } } else { player.sendMessage("You feel so hungry..."); @@ -1103,6 +1107,8 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.exemptPlayer(player, CheckType.LONG_REACH); + AnticheatAPI.exemptPlayer(player, CheckType.NO_SWING); } effectBlock.getWorld().createExplosion( @@ -1110,8 +1116,10 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { // unexempt player from AntiCheat check if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { - AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); - AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.unexemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.unexemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.unexemptPlayer(player, CheckType.LONG_REACH); + AnticheatAPI.unexemptPlayer(player, CheckType.NO_SWING); } } else { @@ -1518,6 +1526,8 @@ public static void alchemyFiller(Material a, Material b, byte toData, if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.exemptPlayer(player, CheckType.LONG_REACH); + AnticheatAPI.exemptPlayer(player, CheckType.NO_SWING); } if (start.getX() < end.getX()) { @@ -1599,8 +1609,10 @@ public static void alchemyFiller(Material a, Material b, byte toData, // unexempt player from AntiCheat check if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { - AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); - AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.unexemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.unexemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.unexemptPlayer(player, CheckType.LONG_REACH); + AnticheatAPI.unexemptPlayer(player, CheckType.NO_SWING); } return; From c14de2bd10ea181b68d55cc1cf2b23f7f8f44931 Mon Sep 17 00:00:00 2001 From: ty2u Date: Thu, 5 Jul 2012 15:44:47 -0400 Subject: [PATCH 063/133] Add config option for philosopher stone modifier --- config.yml | 7 +++++++ plugin.yml | 2 +- .../GeometricMagicDamageListener.java | 15 +++++++------ .../GeometricMagicPlayerListener.java | 21 +++++++++++++++---- 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/config.yml b/config.yml index ae4b01d..3ac7300 100644 --- a/config.yml +++ b/config.yml @@ -23,6 +23,13 @@ transmutation: # Possible values: xp, vault (requires Vault) cost: xp +# PHILOSOPHER STONE SECTION +philosopherstone: + + # The multiplier modifier of the philosopher stone + # Possible values: any integer will be multiplied by number of portals in inv + modifier: 0.01 + # VALUES SECTION (Values of blocks for transmutation) values: 0: 0 diff --git a/plugin.yml b/plugin.yml index 20b5848..c174ba4 100644 --- a/plugin.yml +++ b/plugin.yml @@ -30,7 +30,7 @@ permissions: geometricmagic.transmutation.*: true geometricmagic.standard: description: Gives access to standard circles and /setcircle - default: true + default: false children: geometricmagic.teleportation: true geometricmagic.micro: true diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java index 09626f4..e4b62a8 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java @@ -25,6 +25,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.inventory.PlayerInventory; public class GeometricMagicDamageListener implements Listener { private GeometricMagic plugin; @@ -48,19 +49,21 @@ public void onEntityDamage(EntityDamageEvent event) { Player player = (Player) entity; int health = player.getHealth(); - while (player.getInventory().contains(Material.FIRE)) { + PlayerInventory playerInventory = player.getInventory(); + + while (playerInventory.contains(Material.FIRE)) { // System.out.println("contains fire"); if (health - damage <= 0) { boolean removedFire = false; - for (int i = 0; i < player.getInventory().getSize() && !removedFire; i++) { - if (player.getInventory().getItem(i).getType() == Material.FIRE) { + for (int i = 0; i < playerInventory.getSize() && !removedFire; i++) { + if (playerInventory.getItem(i).getType() == Material.FIRE) { // System.out.println("removed a fire"); - int amount = player.getInventory().getItem(i).getAmount(); - player.getInventory().getItem(i).setAmount(amount - 1); + int amount = playerInventory.getItem(i).getAmount(); + playerInventory.getItem(i).setAmount(amount - 1); if (amount - 1 <= 0) { - player.getInventory().clear(i); + playerInventory.clear(i); } damage = damage - health; health = 20; diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 6bdd737..0d00379 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -169,6 +169,9 @@ public static void circleChooser(Player player, World world, Block actBlock) { && southBlock.getType() != Material.REDSTONE_WIRE && eastBlock.getType() == Material.REDSTONE_WIRE && westBlock .getType() == Material.REDSTONE_WIRE)) { + + //TODO: cooldown + // transmutation circle size permissions // - allows use of all circles smaller than then the max @@ -1676,7 +1679,7 @@ public static void transmuteBlock(Material a, Material b, byte toData, } } else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { - player.setLevel((int) (player.getLevel() + (pay * philosopherStoneModifier(player)))); + player.setLevel((int) (player.getLevel() + pay)); } } } @@ -1709,7 +1712,7 @@ else if (a == Material.AIR && b != Material.AIR } } else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { - player.setLevel((int) (player.getLevel() + (pay * philosopherStoneModifier(player)))); + player.setLevel((int) (player.getLevel() + pay)); } } } @@ -1749,7 +1752,7 @@ else if (a != Material.AIR && b != Material.AIR } } else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { - player.setLevel((int) (player.getLevel() + (pay * philosopherStoneModifier(player)))); + player.setLevel((int) (player.getLevel() + pay)); } } } @@ -1785,7 +1788,17 @@ public static double philosopherStoneModifier(Player player) { && inventory.getItem(i).getType() == Material.PORTAL) stackCount += inventory.getItem(i).getAmount(); } - modifier = 1 / (Math.pow(2, stackCount)); + String multiplier = plugin.getConfig().getString("philosopherstone.modifier").toString(); + float multiplierModifier = Float.parseFloat(multiplier); + + //System.out.println("multiplierModifier" + multiplierModifier); + + modifier = multiplierModifier * stackCount; + + //System.out.println("stackCount" + stackCount); + + //System.out.println("modifier" + modifier); + return modifier; } From 32ecf7bb7040bcd2aa41f1ab050059d2253f8b5e Mon Sep 17 00:00:00 2001 From: ty2u Date: Fri, 6 Jul 2012 15:17:29 -0400 Subject: [PATCH 064/133] -No philosopher stone modifier on transmutes -Cancel event on right clicking workbench instead of turning it to air --- .../GeometricMagicPlayerListener.java | 39 +++++++++---------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 0d00379..4576cdd 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -57,12 +57,14 @@ public GeometricMagicPlayerListener(GeometricMagic instance) { @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerInteract(PlayerInteractEvent event) { + // System.out.println("is playerinteractevent"); if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.RIGHT_CLICK_AIR) { // System.out.println("doesn't equal click block or click air"); return; } + boolean sacrifices = false; boolean sacrificed = false; try { @@ -71,23 +73,26 @@ public void onPlayerInteract(PlayerInteractEvent event) { } catch (IOException e1) { e1.printStackTrace(); } + if (sacrificed) { - // System.out.println("is sacrificed"); return; } + Block actBlock = event.getPlayer().getLocation().getBlock(); + if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { - // System.out.println("right clicked block"); - if (event.getClickedBlock().getType() == Material.WORKBENCH - && sacrifices && (checkBlockBreakSimulation(event.getClickedBlock().getLocation(), event.getPlayer()))) - event.getClickedBlock().setType(Material.AIR); + + if (event.getClickedBlock().getType() == Material.WORKBENCH && sacrifices) { + // cancel event instead of turning block into air + event.setCancelled(true); + } actBlock = event.getClickedBlock(); } - if (event.getAction() == Action.RIGHT_CLICK_AIR - && event.getPlayer().getItemInHand().getType() == Material.FLINT) { - // System.out.println("is leftclickair"); + + if (event.getAction() == Action.RIGHT_CLICK_AIR && event.getPlayer().getItemInHand().getType() == Material.FLINT) { actBlock = event.getPlayer().getTargetBlock(null, 120); } + Player player = event.getPlayer(); World world = player.getWorld(); try { @@ -1641,8 +1646,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { public static void transmuteBlock(Material a, Material b, byte toData, Block startBlock, Player player, boolean charge) { - int pay = calculatePay(a, b); - pay = (int) (pay * philosopherStoneModifier(player)); + int pay = calculatePay(a, b, player); if (startBlock.getType() == a) { @@ -1774,9 +1778,9 @@ else if ((a != Material.AIR && b != Material.AIR) return; } - public static int calculatePay(Material a, Material b) { - int valueDifference = getBlockValue(plugin, a.getId()) - getBlockValue(plugin, b.getId()); - return valueDifference; + public static int calculatePay(Material a, Material b, Player player) { + int pay = (int) (getBlockValue(plugin, a.getId()) - getBlockValue(plugin, b.getId())); + return pay; } public static double philosopherStoneModifier(Player player) { @@ -1790,15 +1794,8 @@ public static double philosopherStoneModifier(Player player) { } String multiplier = plugin.getConfig().getString("philosopherstone.modifier").toString(); float multiplierModifier = Float.parseFloat(multiplier); - - //System.out.println("multiplierModifier" + multiplierModifier); - - modifier = multiplierModifier * stackCount; - - //System.out.println("stackCount" + stackCount); - - //System.out.println("modifier" + modifier); + modifier = 1 / (Math.pow(2, stackCount) * multiplierModifier); return modifier; } From 00157352a4a233dcdea150ff5f0aa7c0aaefad89 Mon Sep 17 00:00:00 2001 From: ty2u Date: Fri, 6 Jul 2012 15:18:00 -0400 Subject: [PATCH 065/133] Default philosopher stone modifier set to 1 --- config.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config.yml b/config.yml index 3ac7300..b33ea49 100644 --- a/config.yml +++ b/config.yml @@ -27,8 +27,9 @@ transmutation: philosopherstone: # The multiplier modifier of the philosopher stone - # Possible values: any integer will be multiplied by number of portals in inv - modifier: 0.01 + # Possible values: any integer + # Formula: 1 / (2 to the power of (number of portals philosopher stones in inventory) * modifier) + modifier: 1 # VALUES SECTION (Values of blocks for transmutation) values: From 7d909d9005b044f25f235cd77b44da599760487e Mon Sep 17 00:00:00 2001 From: ty2u Date: Fri, 6 Jul 2012 17:32:33 -0400 Subject: [PATCH 066/133] -Move AntiCheat checks -Add more permission checks --- .../GeometricMagicPlayerListener.java | 153 ++++++++++++------ 1 file changed, 103 insertions(+), 50 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 4576cdd..8e35cca 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -125,9 +125,30 @@ public static void isCircle(Player player, World world, Block actBlock) inputFile.nextLine(); } inputFile.close(); - // System.out.println("isCircle not clicked redstone"); - setCircleEffects(player, player.getWorld(), player.getLocation() - .getBlock(), actBlock, circle); + + try { + // exempt player from AntiCheat check + if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.exemptPlayer(player, CheckType.LONG_REACH); + AnticheatAPI.exemptPlayer(player, CheckType.NO_SWING); + } + + setCircleEffects(player, player.getWorld(), player.getLocation() + .getBlock(), actBlock, circle); + + // unexempt player from AntiCheat check + if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + AnticheatAPI.unexemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.unexemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.unexemptPlayer(player, CheckType.LONG_REACH); + AnticheatAPI.unexemptPlayer(player, CheckType.NO_SWING); + } + } catch (IOException e1) { + e1.printStackTrace(); + } + } else return; } @@ -662,7 +683,23 @@ public static void setCircle(Player player, World world, Block actBlock, Arrays.sort(intArray); String arrayString = Arrays.toString(intArray); try { + // exempt player from AntiCheat check + if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.exemptPlayer(player, CheckType.LONG_REACH); + AnticheatAPI.exemptPlayer(player, CheckType.NO_SWING); + } + setCircleEffects(player, world, actBlock, effectBlock, arrayString); + + // unexempt player from AntiCheat check + if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + AnticheatAPI.unexemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.unexemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.unexemptPlayer(player, CheckType.LONG_REACH); + AnticheatAPI.unexemptPlayer(player, CheckType.NO_SWING); + } } catch (IOException e1) { e1.printStackTrace(); } @@ -803,6 +840,13 @@ public static void setCircleEffects(Player player, World world, for (int i = 0; i < entityList.size(); i++) { if (entityList.get(i) instanceof Item) { Item droppedItem = (Item) entityList.get(i); + + // check if player has permission to break blocks here first + if(!checkBlockBreakSimulation(droppedItem.getLocation(), player)) { + player.sendMessage("You don't have permission to do that there."); + return; + } + int valueArray = getBlockValue(plugin, droppedItem.getItemStack().getTypeId()); int pay = (valueArray * droppedItem.getItemStack() @@ -847,6 +891,13 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { for (int i = 0; i < entityList.size(); i++) { if (entityList.get(i) instanceof Item) { Item sacrifice = (Item) entityList.get(i); + + // check if player has permission to break blocks here first + if(!checkBlockBreakSimulation(sacrifice.getLocation(), player)) { + player.sendMessage("You don't have permission to do that there."); + return; + } + if (sacrifice.getItemStack().getType() == Material.FIRE) { fires += sacrifice.getItemStack().getAmount(); sacrifice.remove(); @@ -879,8 +930,10 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { player.sendMessage(ChatColor.GREEN + "The four elements, like man alone, are weak. But together they form the strong fifth element: boron -Brother Silence"); ItemStack oneRedstone = new ItemStack(331, 10); + effectBlock.getWorld().dropItem(effectBlock.getLocation(), oneRedstone); + } else { player.sendMessage("You feel so hungry..."); return; @@ -901,18 +954,17 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { int size = setCircleSize(actBlock); List entityList = redStack.getNearbyEntities(size + 5, 128, size + 5); - - // exempt player from AntiCheat check - if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { - AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); - AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); - AnticheatAPI.exemptPlayer(player, CheckType.LONG_REACH); - AnticheatAPI.exemptPlayer(player, CheckType.NO_SWING); - } for (int i = 0; i < entityList.size(); i++) { if (entityList.get(i) instanceof Player) { HumanEntity victim = (HumanEntity) entityList.get(i); + + // check if player has permission to break blocks here first + if(!checkBlockBreakSimulation(victim.getLocation(), player)) { + player.sendMessage("You don't have permission to do that there."); + return; + } + if (!victim.equals(player)) { victim.getWorld().strikeLightningEffect( victim.getLocation()); @@ -953,14 +1005,6 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } } redStack.remove(); - - // unexempt player from AntiCheat check - if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { - AnticheatAPI.unexemptPlayer(player, CheckType.FAST_PLACE); - AnticheatAPI.unexemptPlayer(player, CheckType.FAST_BREAK); - AnticheatAPI.unexemptPlayer(player, CheckType.LONG_REACH); - AnticheatAPI.unexemptPlayer(player, CheckType.NO_SWING); - } } else { player.sendMessage("You feel so hungry..."); return; @@ -1068,6 +1112,13 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + + // check if player has permission to break blocks here first + if(!checkBlockBreakSimulation(effectBlock.getLocation(), player)) { + player.sendMessage("You don't have permission to do that there."); + return; + } + effectBlock.getWorld().createExplosion( effectBlock.getLocation(), (4 + size)); } else { @@ -1110,25 +1161,15 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); - - // exempt player from AntiCheat check - if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { - AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); - AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); - AnticheatAPI.exemptPlayer(player, CheckType.LONG_REACH); - AnticheatAPI.exemptPlayer(player, CheckType.NO_SWING); + + // check if player has permission to break blocks here first + if(!checkBlockBreakSimulation(effectBlock.getLocation(), player)) { + player.sendMessage("You don't have permission to do that there."); + return; } effectBlock.getWorld().createExplosion( effectBlock.getLocation(), 8 + size, true); - - // unexempt player from AntiCheat check - if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { - AnticheatAPI.unexemptPlayer(player, CheckType.FAST_PLACE); - AnticheatAPI.unexemptPlayer(player, CheckType.FAST_BREAK); - AnticheatAPI.unexemptPlayer(player, CheckType.LONG_REACH); - AnticheatAPI.unexemptPlayer(player, CheckType.NO_SWING); - } } else { player.sendMessage("You feel so hungry..."); @@ -1214,6 +1255,13 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); Location spawnLoc = effectBlock.getLocation(); + + // check if player has permission to break blocks here first + if(!checkBlockBreakSimulation(spawnLoc, player)) { + player.sendMessage("You don't have permission to do that there."); + return; + } + spawnLoc.add(0.5, 0, 0.5); effectBlock.getWorld().spawn(spawnLoc, Pig.class); } else { @@ -1230,6 +1278,13 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); Location spawnLoc = effectBlock.getLocation(); + + // check if player has permission to break blocks here first + if(!checkBlockBreakSimulation(spawnLoc, player)) { + player.sendMessage("You don't have permission to do that there."); + return; + } + spawnLoc.add(0.5, 0, 0.5); effectBlock.getWorld().spawn(spawnLoc, Sheep.class); } else { @@ -1246,6 +1301,13 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); Location spawnLoc = effectBlock.getLocation(); + + // check if player has permission to break blocks here first + if(!checkBlockBreakSimulation(spawnLoc, player)) { + player.sendMessage("You don't have permission to do that there."); + return; + } + spawnLoc.add(0.5, 0, 0.5); effectBlock.getWorld().spawn(spawnLoc, Cow.class); } else { @@ -1262,6 +1324,13 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); Location spawnLoc = effectBlock.getLocation(); + + // check if player has permission to break blocks here first + if(!checkBlockBreakSimulation(spawnLoc, player)) { + player.sendMessage("You don't have permission to do that there."); + return; + } + spawnLoc.add(0.5, 0, 0.5); effectBlock.getWorld().spawn(spawnLoc, Chicken.class); } else { @@ -1530,14 +1599,6 @@ public static void alchemyFiller(Material a, Material b, byte toData, int yIteration = 0; int zIteration = 0; - // exempt player from AntiCheat check - if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { - AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); - AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); - AnticheatAPI.exemptPlayer(player, CheckType.LONG_REACH); - AnticheatAPI.exemptPlayer(player, CheckType.NO_SWING); - } - if (start.getX() < end.getX()) { if (start.getZ() < end.getZ()) { // east @@ -1615,14 +1676,6 @@ public static void alchemyFiller(Material a, Material b, byte toData, } } - // unexempt player from AntiCheat check - if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { - AnticheatAPI.unexemptPlayer(player, CheckType.FAST_PLACE); - AnticheatAPI.unexemptPlayer(player, CheckType.FAST_BREAK); - AnticheatAPI.unexemptPlayer(player, CheckType.LONG_REACH); - AnticheatAPI.unexemptPlayer(player, CheckType.NO_SWING); - } - return; } From 06a73a91529e31823b3676f392d419d0aba846a1 Mon Sep 17 00:00:00 2001 From: ty2u Date: Fri, 6 Jul 2012 20:21:43 -0400 Subject: [PATCH 067/133] -Send message when already sacrificed -/circles command to show list of circles -Moved checkSacrifices and checkSacrificed to main file -Added hunger costs to config -Added config for amount of redstone given in circle 1234 -Fixed missing setFoodLevel in circle 3334 -Added config for size of circles 3334 and 3344 -Added config to limit size of set circles for augmentation --- config.yml | 81 ++++++- plugin.yml | 14 +- .../GeometricMagic/GeometricMagic.java | 77 +++++- .../GeometricMagicDamageListener.java | 1 - .../GeometricMagicPlayerListener.java | 229 +++++++++++------- 5 files changed, 305 insertions(+), 97 deletions(-) diff --git a/config.yml b/config.yml index b33ea49..317aea5 100644 --- a/config.yml +++ b/config.yml @@ -23,12 +23,87 @@ transmutation: # Possible values: xp, vault (requires Vault) cost: xp -# PHILOSOPHER STONE SECTION +# SET CIRCLES SECTION +setcircles: + # Limit augmentation size for set circles + limitsize: 5 + # Repair Circle + 1133: [] + # Conversion Circle + 1222: + # The cost of this circle in hunger + cost: 1 + # Philosopher's Stone Circle + 1233: + # The cost of this circle in hunger + cost: 20 + # Boron Circle + 1234: + # The cost of this circle in hunger + cost: 1 + # The of redstone to drop + amount: 1 + # Soul Circle + 2223: + # The cost of this circle in hunger + cost: 10 + # Homunculus Circle + 2224: + # The cost of this circle in hunger + cost: 10 + # Safe Teleportation Circle + 2244: + # The cost of this circle in hunger + cost: 1 + # Explosion Circle + 2333: + # The cost of this circle in hunger + # Formula: cost + circle size (can be augmented) / 2 + cost: 2 + # Fire Circle + 3334: + # The cost of this circle in hunger + cost: 5 + # The size of this circle in blocks cubed + size: 3 + # Fire Explosion Circle + 3344: + # The cost of this circle in hunger + # Formula: cost + circle size (can be augmented) / 2 + cost: 10 + # The size of this circle in blocks cubed + size: 3 + # Human Transmutation Circle + 3444: + # The cost of this circle in hunger + cost: 20 + # Bed Circle (0111) + x111: + # The cost of this circle in hunger + cost: 16 + # Pig Circle (0044) + x044: + # The cost of this circle in hunger + cost: 10 + # Sheep Circle (0144) + x144: + # The cost of this circle in hunger + cost: 10 + # Cow Circle (0244) + x244: + # The cost of this circle in hunger + cost: 10 + # Chicken Circle (0344) + x344: + # The cost of this circle in hunger + cost: 10 + +# PHILOSOPHER'S STONE SECTION philosopherstone: - # The multiplier modifier of the philosopher stone + # The multiplier modifier of the philosopher's stone # Possible values: any integer - # Formula: 1 / (2 to the power of (number of portals philosopher stones in inventory) * modifier) + # Formula: 1 / (2 to the power of (number of philosopher's stones in inventory) * modifier) modifier: 1 # VALUES SECTION (Values of blocks for transmutation) diff --git a/plugin.yml b/plugin.yml index c174ba4..18e658d 100644 --- a/plugin.yml +++ b/plugin.yml @@ -23,13 +23,13 @@ author: cakenggt, Hoot215 softdepend: [Vault,AntiCheat] permissions: geometricmagic.*: - description: Gives access to all circles and /setcircle + description: Gives access to all circles /setcircle and /circles default: op children: geometricmagic.standard: true geometricmagic.transmutation.*: true geometricmagic.standard: - description: Gives access to standard circles and /setcircle + description: Gives access to standard circles /setcircle and /circles default: false children: geometricmagic.teleportation: true @@ -59,12 +59,15 @@ permissions: geometricmagic.transmutation.9: description: Allows you to use transmutation circles of size 9 geometricmagic.set: - description: Allows you to use all set circles and /setcircle + description: Allows you to use all set circles and set circle commands children: geometricmagic.set.*: true geometricmagic.setcircle: true + geometricmagic.listcircles: true geometricmagic.setcircle: description: Allows you to use /setcircle + geometricmagic.listcircles: + description: Allows you to use /circles geometricmagic.set.*: description: Allows you to use all set circles children: @@ -121,3 +124,8 @@ commands: description: This command sets a sacrifice's right-click circle. permission: geometricmagic.setcircle usage: /setcircle <####> + circles: + description: This command displays a list of set circles. + permission: geometricmagic.listcircles + usage: /circles + \ No newline at end of file diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagic.java b/src/me/cakenggt/GeometricMagic/GeometricMagic.java index 7c4dedf..6191553 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagic.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagic.java @@ -28,6 +28,7 @@ import net.milkbowl.vault.economy.Economy; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.command.*; import org.bukkit.entity.Player; @@ -53,6 +54,18 @@ public boolean onCommand(CommandSender sender, Command cmd, if (sender instanceof Player) { player = (Player) sender; + boolean sacrificed = false; + try { + sacrificed = checkSacrificed(player); + } catch (IOException e1) { + e1.printStackTrace(); + } + + if (sacrificed) { + player.sendMessage("You have sacrificed your alchemy abilities forever."); + return true; + } + if (args.length == 0) { ItemStack oneFlint = new ItemStack(318, 1); player.getWorld().dropItem(player.getLocation(), oneFlint); @@ -91,11 +104,33 @@ public boolean onCommand(CommandSender sender, Command cmd, return true; } } - + if (player == null) { sender.sendMessage("This command can only be run by a player"); return false; } + } else if (cmd.getName().equalsIgnoreCase("circles")) { + if(sender.hasPermission("geometricmagic.listcircles") || sender.isOp()) { + sender.sendMessage(ChatColor.GREEN + "1133" + ChatColor.RESET + " Repair Circle"); + sender.sendMessage(ChatColor.GREEN + "1222" + ChatColor.RESET + " Conversion Circle"); + sender.sendMessage(ChatColor.GREEN + "1233" + ChatColor.RESET + " Philosopher's Stone Circle"); + sender.sendMessage(ChatColor.GREEN + "1234" + ChatColor.RESET + " Boron Circle"); + sender.sendMessage(ChatColor.GREEN + "2223" + ChatColor.RESET + " Soul Circle"); + sender.sendMessage(ChatColor.GREEN + "2224" + ChatColor.RESET + " Homunculus Circle"); + sender.sendMessage(ChatColor.GREEN + "2244" + ChatColor.RESET + " Safe Teleportation Circle"); + sender.sendMessage(ChatColor.GREEN + "2333" + ChatColor.RESET + " Explosion Circle"); + sender.sendMessage(ChatColor.GREEN + "3334" + ChatColor.RESET + " Fire Circle"); + sender.sendMessage(ChatColor.GREEN + "3344" + ChatColor.RESET + " Fire Explosion Circle"); + sender.sendMessage(ChatColor.GREEN + "3444" + ChatColor.RESET + " Human Transmutation Circle"); + sender.sendMessage(ChatColor.GREEN + "0111" + ChatColor.RESET + " Bed Circle"); + sender.sendMessage(ChatColor.GREEN + "0044" + ChatColor.RESET + " Pig Circle"); + sender.sendMessage(ChatColor.GREEN + "0144" + ChatColor.RESET + " Sheep Circle"); + sender.sendMessage(ChatColor.GREEN + "0244" + ChatColor.RESET + " Cow Circle"); + sender.sendMessage(ChatColor.GREEN + "0344" + ChatColor.RESET + " Chicken Circle"); + } else { + sender.sendMessage(ChatColor.RED + "You don't have permission to use this command!"); + } + return true; } // If this has happened the function will break and return true. if this // hasn't happened the a value of false will be returned. @@ -149,6 +184,46 @@ public void sacrificeCircle(CommandSender sender, String inputString) } } + public static boolean checkSacrifices(Player player) throws IOException { + File myFile = new File("plugins/GeometricMagic/sacrifices.txt"); + if (!myFile.exists()) { + return false; + } + Scanner inputFile = new Scanner(myFile); + while (inputFile.hasNextLine()) { + String name = inputFile.nextLine(); + if (name.equals(player.getName())) { + // close this before we return + inputFile.close(); + return true; + } + inputFile.nextLine(); + } + inputFile.close(); + return false; + // playername + // [1, 1, 1, 2] + } + + public static boolean checkSacrificed(Player player) throws IOException { + File myFile = new File("plugins/GeometricMagic/sacrificed.txt"); + if (!myFile.exists()) { + return false; + } + Scanner inputFile = new Scanner(myFile); + while (inputFile.hasNextLine()) { + String name = inputFile.nextLine(); + if (name.equals(player.getName())) { + // close this before we return + inputFile.close(); + return true; + } + } + inputFile.close(); + return false; + // playername + } + @Override public void onDisable() { System.out.println(this + " is now disabled!"); diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java index e4b62a8..fb8c25e 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java @@ -20,7 +20,6 @@ import org.bukkit.Material; import org.bukkit.entity.*; -//import org.bukkit.event.Event; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 8e35cca..9633797 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -36,7 +36,6 @@ import org.bukkit.block.*; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.*; -//import org.bukkit.event.Event; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -68,13 +67,14 @@ public void onPlayerInteract(PlayerInteractEvent event) { boolean sacrifices = false; boolean sacrificed = false; try { - sacrifices = checkSacrifices(event.getPlayer()); - sacrificed = checkSacrificed(event.getPlayer()); + sacrifices = GeometricMagic.checkSacrifices(event.getPlayer()); + sacrificed = GeometricMagic.checkSacrificed(event.getPlayer()); } catch (IOException e1) { e1.printStackTrace(); } if (sacrificed) { + event.getPlayer().sendMessage("You have sacrificed your alchemy abilities forever."); return; } @@ -107,13 +107,13 @@ public static void isCircle(Player player, World world, Block actBlock) // System.out.println("isCircle?"); if (actBlock.getType() == Material.REDSTONE_WIRE && player.getItemInHand().getAmount() == 0 - && !checkSacrificed(player)) { + && !GeometricMagic.checkSacrificed(player)) { // System.out.println("isCircle"); circleChooser(player, world, actBlock); } - boolean sacrifices = checkSacrifices(player); + boolean sacrifices = GeometricMagic.checkSacrifices(player); if (player.getItemInHand().getType() == Material.FLINT && sacrifices - && !checkSacrificed(player)) { + && !GeometricMagic.checkSacrificed(player)) { File myFile = new File("plugins/GeometricMagic/sacrifices.txt"); Scanner inputFile = new Scanner(myFile); String circle = "[0, 0, 0, 0]"; @@ -196,8 +196,8 @@ public static void circleChooser(Player player, World world, Block actBlock) { && eastBlock.getType() == Material.REDSTONE_WIRE && westBlock .getType() == Material.REDSTONE_WIRE)) { - //TODO: cooldown - + //TODO: cooldown config option + // -store times in files // transmutation circle size permissions // - allows use of all circles smaller than then the max @@ -825,7 +825,12 @@ public static void setCircleEffects(Player player, World world, } } else if (arrayString.equals("[1, 2, 2, 2]") && player.hasPermission("geometricmagic.set.1222")) { - cost = 1; + + String costConfig = plugin.getConfig().getString("setcircles.1222.cost").toString(); + cost = Integer.parseInt(costConfig); + if(cost > 20) + cost = 20; + if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " + arrayString + "!"); @@ -843,7 +848,7 @@ public static void setCircleEffects(Player player, World world, // check if player has permission to break blocks here first if(!checkBlockBreakSimulation(droppedItem.getLocation(), player)) { - player.sendMessage("You don't have permission to do that there."); + //player.sendMessage("You don't have permission to do that there."); return; } @@ -879,7 +884,12 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } } else if (arrayString.equals("[1, 2, 3, 3]") && player.hasPermission("geometricmagic.set.1233")) { - cost = 20; + + String costConfig = plugin.getConfig().getString("setcircles.1233.cost").toString(); + cost = Integer.parseInt(costConfig); + if(cost > 20) + cost = 20; + if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " + arrayString + "!"); @@ -894,7 +904,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { // check if player has permission to break blocks here first if(!checkBlockBreakSimulation(sacrifice.getLocation(), player)) { - player.sendMessage("You don't have permission to do that there."); + //player.sendMessage("You don't have permission to do that there."); return; } @@ -919,7 +929,12 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { diamondStack); } else if (arrayString.equals("[1, 2, 3, 4]") && player.hasPermission("geometricmagic.set.1234")) { - cost = 1; + + String costConfig = plugin.getConfig().getString("setcircles.1234.cost").toString(); + cost = Integer.parseInt(costConfig); + if(cost > 20) + cost = 20; + if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " + arrayString + "!"); @@ -929,7 +944,9 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); player.sendMessage(ChatColor.GREEN + "The four elements, like man alone, are weak. But together they form the strong fifth element: boron -Brother Silence"); - ItemStack oneRedstone = new ItemStack(331, 10); + String amountConfig = plugin.getConfig().getString("setcircles.1234.amount").toString(); + int amount = Integer.parseInt(amountConfig); + ItemStack oneRedstone = new ItemStack(331, amount); effectBlock.getWorld().dropItem(effectBlock.getLocation(), oneRedstone); @@ -940,7 +957,12 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } } else if (arrayString.equals("[2, 2, 2, 3]") && player.hasPermission("geometricmagic.set.2223")) { - cost = 10; + + String costConfig = plugin.getConfig().getString("setcircles.2223.cost").toString(); + cost = Integer.parseInt(costConfig); + if(cost > 20) + cost = 20; + if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " + arrayString + "!"); @@ -961,7 +983,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { // check if player has permission to break blocks here first if(!checkBlockBreakSimulation(victim.getLocation(), player)) { - player.sendMessage("You don't have permission to do that there."); + //player.sendMessage("You don't have permission to do that there."); return; } @@ -1011,7 +1033,12 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } } else if (arrayString.equals("[2, 2, 2, 4]") && player.hasPermission("geometricmagic.set.2224")) { - cost = 10; + + String costConfig = plugin.getConfig().getString("setcircles.2224.cost").toString(); + cost = Integer.parseInt(costConfig); + if(cost > 20) + cost = 20; + if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); Location spawnLoc = effectBlock.getLocation(); @@ -1028,6 +1055,12 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + arrayString + "!"); return; } + + String costConfig = plugin.getConfig().getString("setcircles.2244.cost").toString(); + cost = Integer.parseInt(costConfig); + if(cost > 20) + cost = 20; + Location actPoint = effectBlock.getLocation(); int na = 0, nb = 0, ea = 0, eb = 0, sa = 0, sb = 0, wa = 0, wb = 0; Block curBlock = effectBlock.getRelative(0, 0, -1); @@ -1097,9 +1130,14 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { return; } else if (arrayString.equals("[2, 3, 3, 3]") && player.hasPermission("geometricmagic.set.2333")) { - cost = 2; + + String costConfig = plugin.getConfig().getString("setcircles.2333.cost").toString(); + cost = Integer.parseInt(costConfig); + if(cost > 20) + cost = 20; + int size = setCircleSize(actBlock); - cost = 2 + size / 2; + cost = cost + size / 2; // Make sure cost is not more than 20 if (cost > 20) @@ -1115,7 +1153,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { // check if player has permission to break blocks here first if(!checkBlockBreakSimulation(effectBlock.getLocation(), player)) { - player.sendMessage("You don't have permission to do that there."); + //player.sendMessage("You don't have permission to do that there."); return; } @@ -1127,17 +1165,26 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } } else if (arrayString.equals("[3, 3, 3, 4]") && player.hasPermission("geometricmagic.set.3334")) { - cost = 2; + + String costConfig = plugin.getConfig().getString("setcircles.3334.cost").toString(); + cost = Integer.parseInt(costConfig); + if(cost > 20) + cost = 20; + if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + String configSize = plugin.getConfig().getString("setcircles.3334.size").toString(); + Integer circleSize = Integer.parseInt(configSize); + alchemyFiller(Material.AIR, Material.FIRE, (byte) 0, - effectBlock.getRelative(-10, 0, -10).getLocation(), - effectBlock.getRelative(10, 20, 10).getLocation(), + effectBlock.getRelative((circleSize/2)*-1, 0, (circleSize/2)*-1).getLocation(), + effectBlock.getRelative(circleSize/2, circleSize, circleSize/2).getLocation(), player, false); } else { @@ -1146,9 +1193,14 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } } else if (arrayString.equals("[3, 3, 4, 4]") && player.hasPermission("geometricmagic.set.3344")) { - cost = 4; + + String costConfig = plugin.getConfig().getString("setcircles.3344.cost").toString(); + cost = Integer.parseInt(costConfig); + if(cost > 20) + cost = 20; + int size = setCircleSize(actBlock); - cost = 4 + size / 2; + cost = cost + size / 2; // Make sure cost is not more than 20 if (cost > 20) @@ -1164,12 +1216,12 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { // check if player has permission to break blocks here first if(!checkBlockBreakSimulation(effectBlock.getLocation(), player)) { - player.sendMessage("You don't have permission to do that there."); + //player.sendMessage("You don't have permission to do that there."); return; } effectBlock.getWorld().createExplosion( - effectBlock.getLocation(), 8 + size, true); + effectBlock.getLocation(), size, true); } else { player.sendMessage("You feel so hungry..."); @@ -1177,7 +1229,12 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } } else if (arrayString.equals("[3, 4, 4, 4]") && player.hasPermission("geometricmagic.set.3444")) { - cost = 20; + + String costConfig = plugin.getConfig().getString("setcircles.3444.cost").toString(); + cost = Integer.parseInt(costConfig); + if(cost > 20) + cost = 20; + if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " + arrayString + "!"); @@ -1196,7 +1253,13 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } } else if (arrayString.equals("[0, 1, 1, 1]") && player.hasPermission("geometricmagic.set.0111")) { - cost = 16; + + // using x111 because yml doesn't like 0 as first character + String costConfig = plugin.getConfig().getString("setcircles.x111.cost").toString(); + cost = Integer.parseInt(costConfig); + if(cost > 20) + cost = 20; + if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " + arrayString + "!"); @@ -1247,7 +1310,13 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } } else if (arrayString.equals("[0, 0, 4, 4]") && player.hasPermission("geometricmagic.set.0044")) { - cost = 10; + + // using x044 because yml doesn't like 0 as first character + String costConfig = plugin.getConfig().getString("setcircles.x044.cost").toString(); + cost = Integer.parseInt(costConfig); + if(cost > 20) + cost = 20; + if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " + arrayString + "!"); @@ -1258,7 +1327,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { // check if player has permission to break blocks here first if(!checkBlockBreakSimulation(spawnLoc, player)) { - player.sendMessage("You don't have permission to do that there."); + //player.sendMessage("You don't have permission to do that there."); return; } @@ -1270,7 +1339,13 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } } else if (arrayString.equals("[0, 1, 4, 4]") && player.hasPermission("geometricmagic.set.0144")) { - cost = 10; + + // using x144 because yml doesn't like 0 as first character + String costConfig = plugin.getConfig().getString("setcircles.x144.cost").toString(); + cost = Integer.parseInt(costConfig); + if(cost > 20) + cost = 20; + if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " + arrayString + "!"); @@ -1281,7 +1356,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { // check if player has permission to break blocks here first if(!checkBlockBreakSimulation(spawnLoc, player)) { - player.sendMessage("You don't have permission to do that there."); + //player.sendMessage("You don't have permission to do that there."); return; } @@ -1293,7 +1368,13 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } } else if (arrayString.equals("[0, 2, 4, 4]") && player.hasPermission("geometricmagic.set.0244")) { - cost = 10; + + // using x244 because yml doesn't like 0 as first character + String costConfig = plugin.getConfig().getString("setcircles.x244.cost").toString(); + cost = Integer.parseInt(costConfig); + if(cost > 20) + cost = 20; + if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " + arrayString + "!"); @@ -1304,7 +1385,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { // check if player has permission to break blocks here first if(!checkBlockBreakSimulation(spawnLoc, player)) { - player.sendMessage("You don't have permission to do that there."); + //player.sendMessage("You don't have permission to do that there."); return; } @@ -1316,7 +1397,13 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } } else if (arrayString.equals("[0, 3, 4, 4]") && player.hasPermission("geometricmagic.set.0344")) { - cost = 10; + + // using x344 because yml doesn't like 0 as first character + String costConfig = plugin.getConfig().getString("setcircles.x344.cost").toString(); + cost = Integer.parseInt(costConfig); + if(cost > 20) + cost = 20; + if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " + arrayString + "!"); @@ -1327,7 +1414,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { // check if player has permission to break blocks here first if(!checkBlockBreakSimulation(spawnLoc, player)) { - player.sendMessage("You don't have permission to do that there."); + //player.sendMessage("You don't have permission to do that there."); return; } @@ -1345,64 +1432,68 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } public static int setCircleSize(Block actBlock) { + // limit sizes + String limitSizeConfig = plugin.getConfig().getString("setcircles.limitsize").toString(); + int limitsize = Integer.parseInt(limitSizeConfig); + int na = 0, nb = 0, ea = 0, eb = 0, sa = 0, sb = 0, wa = 0, wb = 0, nc = 0, ec = 0, sc = 0, wc = 0; Block curBlock = actBlock.getRelative(0, 0, -5); - while (curBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE) { + while (curBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE || na == limitsize) { na++; curBlock = curBlock.getRelative(0, 0, -1); } Block fineBlock = curBlock; - while (fineBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE) { + while (fineBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE || nb == limitsize) { nb++; fineBlock = fineBlock.getRelative(-1, 0, 0); } fineBlock = curBlock; - while (fineBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE) { + while (fineBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE || nc == limitsize) { nc++; fineBlock = fineBlock.getRelative(1, 0, 0); } curBlock = actBlock.getRelative(5, 0, 0); - while (curBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE) { + while (curBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE || ea == limitsize) { ea++; curBlock = curBlock.getRelative(1, 0, 0); } fineBlock = curBlock; - while (fineBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE) { + while (fineBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE || eb == limitsize) { eb++; fineBlock = fineBlock.getRelative(0, 0, -1); } fineBlock = curBlock; - while (fineBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE) { + while (fineBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE || ec == limitsize) { ec++; fineBlock = fineBlock.getRelative(0, 0, 1); } curBlock = actBlock.getRelative(0, 0, 5); - while (curBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE) { + while (curBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE || sa == limitsize) { sa++; curBlock = curBlock.getRelative(0, 0, 1); } fineBlock = curBlock; - while (fineBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE) { + while (fineBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE || sb == limitsize) { sb++; fineBlock = fineBlock.getRelative(1, 0, 0); } fineBlock = curBlock; - while (fineBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE) { + while (fineBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE || sc == limitsize) { sc++; fineBlock = fineBlock.getRelative(-1, 0, 0); } curBlock = actBlock.getRelative(-5, 0, 0); - while (curBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE) { + while (curBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE || wa == limitsize) { wa++; curBlock = curBlock.getRelative(-1, 0, 0); } fineBlock = curBlock; - while (fineBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE) { + while (fineBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE || wb == limitsize) { wb++; fineBlock = fineBlock.getRelative(0, 0, 1); } fineBlock = curBlock; - while (fineBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE) { + while (fineBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE || wc == limitsize) { wc++; fineBlock = fineBlock.getRelative(0, 0, -1); } @@ -1852,27 +1943,6 @@ public static double philosopherStoneModifier(Player player) { return modifier; } - public static boolean checkSacrifices(Player player) throws IOException { - File myFile = new File("plugins/GeometricMagic/sacrifices.txt"); - if (!myFile.exists()) { - return false; - } - Scanner inputFile = new Scanner(myFile); - while (inputFile.hasNextLine()) { - String name = inputFile.nextLine(); - if (name.equals(player.getName())) { - // close this before we return - inputFile.close(); - return true; - } - inputFile.nextLine(); - } - inputFile.close(); - return false; - // playername - // [1, 1, 1, 2] - } - public static void humanTransmutation(Player player) throws IOException { if (new File("plugins/GeometricMagic/").mkdirs()) System.out.println("[GeometricMagic] Sacrifices file created."); @@ -1906,25 +1976,6 @@ public static void humanTransmutation(Player player) throws IOException { outputFile.close(); } - public static boolean checkSacrificed(Player player) throws IOException { - File myFile = new File("plugins/GeometricMagic/sacrificed.txt"); - if (!myFile.exists()) { - return false; - } - Scanner inputFile = new Scanner(myFile); - while (inputFile.hasNextLine()) { - String name = inputFile.nextLine(); - if (name.equals(player.getName())) { - // close this before we return - inputFile.close(); - return true; - } - } - inputFile.close(); - return false; - // playername - } - public static boolean hasLearnedCircle(Player player, String circle) throws IOException { File myFile = new File("plugins/GeometricMagic/" + player.getName() From e15ccb98cdbea42f59f2a1611609666298faaafb Mon Sep 17 00:00:00 2001 From: ty2u Date: Fri, 6 Jul 2012 22:17:52 -0400 Subject: [PATCH 068/133] -Add cooldowns to transmute and set circles with config -Fix mob spawn height --- config.yml | 6 ++ .../GeometricMagicPlayerListener.java | 56 ++++++++++++++++--- 2 files changed, 54 insertions(+), 8 deletions(-) diff --git a/config.yml b/config.yml index 317aea5..30b06a4 100644 --- a/config.yml +++ b/config.yml @@ -18,6 +18,8 @@ # TRANSMUTATION SECTION transmutation: + # Cool down time between transmutations in seconds + cooldown: 10 # What system to use for transmutation cost # Possible values: xp, vault (requires Vault) @@ -25,8 +27,12 @@ transmutation: # SET CIRCLES SECTION setcircles: + # Cool down time between using set circles in seconds + cooldown: 10 + # Limit augmentation size for set circles limitsize: 5 + # Repair Circle 1133: [] # Conversion Circle diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 9633797..5f39999 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -20,6 +20,7 @@ import java.io.*; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Scanner; @@ -53,6 +54,7 @@ public GeometricMagicPlayerListener(GeometricMagic instance) { plugin = instance; } public static Economy economy = null; + private static HashMap mapCoolDowns = new HashMap(); @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerInteract(PlayerInteractEvent event) { @@ -114,6 +116,20 @@ public static void isCircle(Player player, World world, Block actBlock) boolean sacrifices = GeometricMagic.checkSacrifices(player); if (player.getItemInHand().getType() == Material.FLINT && sacrifices && !GeometricMagic.checkSacrificed(player)) { + + // set circle cool down + String coolDownConfig = plugin.getConfig().getString("setcircles.cooldown").toString(); + int coolDown = Integer.parseInt(coolDownConfig); + if(mapCoolDowns.containsKey(player.getName() + " set circle")) { + long diff = (System.currentTimeMillis() - mapCoolDowns.get(player.getName() + " set circle"))/1000; + if(diff < coolDown) { + // still cooling down + player.sendMessage("You have to wait before you can do that again."); + return; + } + } + mapCoolDowns.put(player.getName() + " set circle", System.currentTimeMillis()); + File myFile = new File("plugins/GeometricMagic/sacrifices.txt"); Scanner inputFile = new Scanner(myFile); String circle = "[0, 0, 0, 0]"; @@ -195,9 +211,6 @@ public static void circleChooser(Player player, World world, Block actBlock) { && southBlock.getType() != Material.REDSTONE_WIRE && eastBlock.getType() == Material.REDSTONE_WIRE && westBlock .getType() == Material.REDSTONE_WIRE)) { - - //TODO: cooldown config option - // -store times in files // transmutation circle size permissions // - allows use of all circles smaller than then the max @@ -221,6 +234,19 @@ public static void circleChooser(Player player, World world, Block actBlock) { // System.out.println("circleSize:" + circleSize); + // transmute cool down + String coolDownConfig = plugin.getConfig().getString("transmutation.cooldown").toString(); + int coolDown = Integer.parseInt(coolDownConfig); + if(mapCoolDowns.containsKey(player.getName() + " transmute circle")) { + long diff = (System.currentTimeMillis() - mapCoolDowns.get(player.getName() + " transmute circle"))/1000; + if(diff < coolDown) { + // still cooling down + player.sendMessage("You have to wait before you can do that again."); + return; + } + } + mapCoolDowns.put(player.getName() + " transmute circle", System.currentTimeMillis()); + if (circleSize > 0) { transmutationCircle(player, world, actBlock, circleSize); } @@ -234,7 +260,21 @@ public static void circleChooser(Player player, World world, Block actBlock) { && actBlock.getRelative(3, 0, 0).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, -3).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, 3).getType() == Material.REDSTONE_WIRE) { + if (player.hasPermission("geometricmagic.set")) { + // set circle cool down + String coolDownConfig = plugin.getConfig().getString("setcircles.cooldown").toString(); + int coolDown = Integer.parseInt(coolDownConfig); + if(mapCoolDowns.containsKey(player.getName() + " set circle")) { + long diff = (System.currentTimeMillis() - mapCoolDowns.get(player.getName() + " set circle"))/1000; + if(diff < coolDown) { + // still cooling down + player.sendMessage("You have to wait before you can do that again."); + return; + } + } + mapCoolDowns.put(player.getName() + " set circle", System.currentTimeMillis()); + setCircleRemote(player, world, actBlock); } else player.sendMessage("You do not have permission to use this circle"); @@ -1042,7 +1082,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); Location spawnLoc = effectBlock.getLocation(); - spawnLoc.add(0.5, 0, 0.5); + spawnLoc.add(0.5, 1, 0.5); effectBlock.getWorld().spawn(spawnLoc, Enderman.class); } else { player.sendMessage("You feel so hungry..."); @@ -1331,7 +1371,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { return; } - spawnLoc.add(0.5, 0, 0.5); + spawnLoc.add(0.5, 1, 0.5); effectBlock.getWorld().spawn(spawnLoc, Pig.class); } else { player.sendMessage("You feel so hungry..."); @@ -1360,7 +1400,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { return; } - spawnLoc.add(0.5, 0, 0.5); + spawnLoc.add(0.5, 1, 0.5); effectBlock.getWorld().spawn(spawnLoc, Sheep.class); } else { player.sendMessage("You feel so hungry..."); @@ -1389,7 +1429,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { return; } - spawnLoc.add(0.5, 0, 0.5); + spawnLoc.add(0.5, 1, 0.5); effectBlock.getWorld().spawn(spawnLoc, Cow.class); } else { player.sendMessage("You feel so hungry..."); @@ -1418,7 +1458,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { return; } - spawnLoc.add(0.5, 0, 0.5); + spawnLoc.add(0.5, 1, 0.5); effectBlock.getWorld().spawn(spawnLoc, Chicken.class); } else { player.sendMessage("You feel so hungry..."); From 0f0dc348f94c53c618f3b186b2ae6ed35a93fc77 Mon Sep 17 00:00:00 2001 From: ty2u Date: Fri, 6 Jul 2012 22:28:04 -0400 Subject: [PATCH 069/133] Re-formatting to keep things on the same line (auto formatter) --- .../GeometricMagic/GeometricMagic.java | 109 +-- .../GeometricMagicDamageListener.java | 6 +- .../GeometricMagicPlayerListener.java | 850 ++++++------------ 3 files changed, 337 insertions(+), 628 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagic.java b/src/me/cakenggt/GeometricMagic/GeometricMagic.java index 6191553..8d2105e 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagic.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagic.java @@ -44,44 +44,43 @@ public class GeometricMagic extends JavaPlugin { private static Economy economy; File configFile; - public boolean onCommand(CommandSender sender, Command cmd, - String commandLabel, String[] args) { + public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { // If the player typed /setcircle then do the following... if (cmd.getName().equalsIgnoreCase("setcircle")) { Player player = null; - + if (sender instanceof Player) { player = (Player) sender; - + boolean sacrificed = false; try { sacrificed = checkSacrificed(player); } catch (IOException e1) { e1.printStackTrace(); } - + if (sacrificed) { player.sendMessage("You have sacrificed your alchemy abilities forever."); return true; } - + if (args.length == 0) { ItemStack oneFlint = new ItemStack(318, 1); player.getWorld().dropItem(player.getLocation(), oneFlint); return true; } - + if (args.length != 1) { sender.sendMessage(cmd.getUsage()); return false; } - + if (args[0].length() != 4 && args[0].length() != 1) { sender.sendMessage(cmd.getUsage()); return false; } - + if (args[0].length() == 1 && args[0].equalsIgnoreCase("0")) { sender.sendMessage("Casting circles on right click now disabled, set right click to a viable circle to enable"); String inputString = args[0]; @@ -91,11 +90,9 @@ public boolean onCommand(CommandSender sender, Command cmd, e.printStackTrace(); } return true; - + } else { - String inputString = "[" + args[0].charAt(0) + ", " - + args[0].charAt(1) + ", " + args[0].charAt(2) + ", " - + args[0].charAt(3) + "]"; + String inputString = "[" + args[0].charAt(0) + ", " + args[0].charAt(1) + ", " + args[0].charAt(2) + ", " + args[0].charAt(3) + "]"; try { sacrificeCircle(sender, inputString); } catch (IOException e) { @@ -110,7 +107,7 @@ public boolean onCommand(CommandSender sender, Command cmd, return false; } } else if (cmd.getName().equalsIgnoreCase("circles")) { - if(sender.hasPermission("geometricmagic.listcircles") || sender.isOp()) { + if (sender.hasPermission("geometricmagic.listcircles") || sender.isOp()) { sender.sendMessage(ChatColor.GREEN + "1133" + ChatColor.RESET + " Repair Circle"); sender.sendMessage(ChatColor.GREEN + "1222" + ChatColor.RESET + " Conversion Circle"); sender.sendMessage(ChatColor.GREEN + "1233" + ChatColor.RESET + " Philosopher's Stone Circle"); @@ -137,8 +134,7 @@ public boolean onCommand(CommandSender sender, Command cmd, return false; } - public void sacrificeCircle(CommandSender sender, String inputString) - throws IOException { + public void sacrificeCircle(CommandSender sender, String inputString) throws IOException { // System.out.println("sacrificeCircle for " + inputString); File myFile = new File("plugins/GeometricMagic/sacrifices.txt"); if (myFile.exists()) { @@ -165,15 +161,13 @@ public void sacrificeCircle(CommandSender sender, String inputString) for (int i = 0; i < size; i++) { if (nameArray[i].equalsIgnoreCase(sender.getName())) { circleArray[i] = inputString; - sender.sendMessage("set-circle " + inputString - + " added successfully!"); + sender.sendMessage("set-circle " + inputString + " added successfully!"); } } // System.out.println("nameArray[0] is " + nameArray[0]); // System.out.println("circleArray[0] is " + circleArray[0]); inputFile.close(); - PrintWriter outputFile = new PrintWriter( - "plugins/GeometricMagic/sacrifices.txt"); + PrintWriter outputFile = new PrintWriter("plugins/GeometricMagic/sacrifices.txt"); for (int i = 0; i < size; i++) { outputFile.println(nameArray[i]); outputFile.println(circleArray[i]); @@ -231,72 +225,63 @@ public void onDisable() { @Override public void onEnable() { - + configFile = new File(getDataFolder(), "config.yml"); - + // Copy default config file if it doesn't exist if (!configFile.exists()) { configFile.getParentFile().mkdirs(); copy(this.getResource("config.yml"), configFile); } - + // Copy config defaults getConfig().options().copyDefaults(true); - + // Transmutation mode: Vault if (getConfig().getString("transmutation.cost").toString().equalsIgnoreCase("vault")) { // Vault Support if (!setupEconomy()) { - System.out - .println("[" + this + "] ERROR: You have your transmutation system set to Vault, and yet you don't have Vault. Disabling plugin!"); + System.out.println("[" + this + "] ERROR: You have your transmutation system set to Vault, and yet you don't have Vault. Disabling plugin!"); getServer().getPluginManager().disablePlugin(this); - } - else { - System.out - .println("[" + this + "] Transmutation cost system set to Vault"); - + } else { + System.out.println("[" + this + "] Transmutation cost system set to Vault"); + // Register events playerListener = new GeometricMagicPlayerListener(this); entityListener = new GeometricMagicDamageListener(this); getServer().getPluginManager().registerEvents(playerListener, this); getServer().getPluginManager().registerEvents(entityListener, this); - ShapelessRecipe portalRecipe = new ShapelessRecipe(new ItemStack( - Material.FIRE, 64)).addIngredient(Material.PORTAL); + ShapelessRecipe portalRecipe = new ShapelessRecipe(new ItemStack(Material.FIRE, 64)).addIngredient(Material.PORTAL); getServer().addRecipe(portalRecipe); System.out.println(this + " is now enabled!"); } } // Transmutation mode: XP else if (getConfig().getString("transmutation.cost").toString().equalsIgnoreCase("xp")) { - System.out - .println("[" + this + "] Transmutation cost system set to XP"); - + System.out.println("[" + this + "] Transmutation cost system set to XP"); + // Register events playerListener = new GeometricMagicPlayerListener(this); entityListener = new GeometricMagicDamageListener(this); getServer().getPluginManager().registerEvents(playerListener, this); getServer().getPluginManager().registerEvents(entityListener, this); - ShapelessRecipe portalRecipe = new ShapelessRecipe(new ItemStack( - Material.FIRE, 64)).addIngredient(Material.PORTAL); + ShapelessRecipe portalRecipe = new ShapelessRecipe(new ItemStack(Material.FIRE, 64)).addIngredient(Material.PORTAL); getServer().addRecipe(portalRecipe); System.out.println(this + " is now enabled!"); } // Transmutation mode: Unknown else { - System.out - .println("[" + this + "] ERROR: You have your transmutation cost system set to an unknown value. Disabling plugin!"); + System.out.println("[" + this + "] ERROR: You have your transmutation cost system set to an unknown value. Disabling plugin!"); getServer().getPluginManager().disablePlugin(this); } - + // Plugin metrics startPluginMetrics(); } // Vault Support private boolean setupEconomy() { - RegisteredServiceProvider economyProvider = getServer() - .getServicesManager().getRegistration( - net.milkbowl.vault.economy.Economy.class); + RegisteredServiceProvider economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class); if (economyProvider != null) { economy = economyProvider.getProvider(); } @@ -308,29 +293,29 @@ private boolean setupEconomy() { public static Economy getEconomy() { return economy; } - + // Copy method private void copy(InputStream in, File file) { - try { - OutputStream out = new FileOutputStream(file); - byte[] buf = new byte[1024]; - int len; - while((len=in.read(buf))>0){ - out.write(buf,0,len); - } - out.close(); - in.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - + try { + OutputStream out = new FileOutputStream(file); + byte[] buf = new byte[1024]; + int len; + while ((len = in.read(buf)) > 0) { + out.write(buf, 0, len); + } + out.close(); + in.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + private void startPluginMetrics() { try { - Metrics metrics = new Metrics(this); - metrics.start(); + Metrics metrics = new Metrics(this); + metrics.start(); } catch (IOException e) { - // Failed to submit the stats :-( + // Failed to submit the stats :-( } } } \ No newline at end of file diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java index fb8c25e..18c54fd 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java @@ -28,8 +28,8 @@ public class GeometricMagicDamageListener implements Listener { private GeometricMagic plugin; - - public GeometricMagicDamageListener (GeometricMagic plugin) { + + public GeometricMagicDamageListener(GeometricMagic plugin) { this.plugin = plugin; } @@ -49,7 +49,7 @@ public void onEntityDamage(EntityDamageEvent event) { int health = player.getHealth(); PlayerInventory playerInventory = player.getInventory(); - + while (playerInventory.contains(Material.FIRE)) { // System.out.println("contains fire"); diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 5f39999..4d32070 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -50,9 +50,11 @@ public class GeometricMagicPlayerListener implements Listener { static GeometricMagic plugin = new GeometricMagic(); + public GeometricMagicPlayerListener(GeometricMagic instance) { plugin = instance; } + public static Economy economy = null; private static HashMap mapCoolDowns = new HashMap(); @@ -60,8 +62,7 @@ public GeometricMagicPlayerListener(GeometricMagic instance) { public void onPlayerInteract(PlayerInteractEvent event) { // System.out.println("is playerinteractevent"); - if (event.getAction() != Action.RIGHT_CLICK_BLOCK - && event.getAction() != Action.RIGHT_CLICK_AIR) { + if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.RIGHT_CLICK_AIR) { // System.out.println("doesn't equal click block or click air"); return; } @@ -74,7 +75,7 @@ public void onPlayerInteract(PlayerInteractEvent event) { } catch (IOException e1) { e1.printStackTrace(); } - + if (sacrificed) { event.getPlayer().sendMessage("You have sacrificed your alchemy abilities forever."); return; @@ -104,32 +105,28 @@ public void onPlayerInteract(PlayerInteractEvent event) { } } - public static void isCircle(Player player, World world, Block actBlock) - throws IOException { + public static void isCircle(Player player, World world, Block actBlock) throws IOException { // System.out.println("isCircle?"); - if (actBlock.getType() == Material.REDSTONE_WIRE - && player.getItemInHand().getAmount() == 0 - && !GeometricMagic.checkSacrificed(player)) { + if (actBlock.getType() == Material.REDSTONE_WIRE && player.getItemInHand().getAmount() == 0 && !GeometricMagic.checkSacrificed(player)) { // System.out.println("isCircle"); circleChooser(player, world, actBlock); } boolean sacrifices = GeometricMagic.checkSacrifices(player); - if (player.getItemInHand().getType() == Material.FLINT && sacrifices - && !GeometricMagic.checkSacrificed(player)) { - + if (player.getItemInHand().getType() == Material.FLINT && sacrifices && !GeometricMagic.checkSacrificed(player)) { + // set circle cool down String coolDownConfig = plugin.getConfig().getString("setcircles.cooldown").toString(); int coolDown = Integer.parseInt(coolDownConfig); - if(mapCoolDowns.containsKey(player.getName() + " set circle")) { - long diff = (System.currentTimeMillis() - mapCoolDowns.get(player.getName() + " set circle"))/1000; - if(diff < coolDown) { + if (mapCoolDowns.containsKey(player.getName() + " set circle")) { + long diff = (System.currentTimeMillis() - mapCoolDowns.get(player.getName() + " set circle")) / 1000; + if (diff < coolDown) { // still cooling down player.sendMessage("You have to wait before you can do that again."); return; } } mapCoolDowns.put(player.getName() + " set circle", System.currentTimeMillis()); - + File myFile = new File("plugins/GeometricMagic/sacrifices.txt"); Scanner inputFile = new Scanner(myFile); String circle = "[0, 0, 0, 0]"; @@ -144,18 +141,17 @@ public static void isCircle(Player player, World world, Block actBlock) try { // exempt player from AntiCheat check - if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); AnticheatAPI.exemptPlayer(player, CheckType.LONG_REACH); AnticheatAPI.exemptPlayer(player, CheckType.NO_SWING); } - - setCircleEffects(player, player.getWorld(), player.getLocation() - .getBlock(), actBlock, circle); + + setCircleEffects(player, player.getWorld(), player.getLocation().getBlock(), actBlock, circle); // unexempt player from AntiCheat check - if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { AnticheatAPI.unexemptPlayer(player, CheckType.FAST_PLACE); AnticheatAPI.unexemptPlayer(player, CheckType.FAST_BREAK); AnticheatAPI.unexemptPlayer(player, CheckType.LONG_REACH); @@ -164,7 +160,7 @@ public static void isCircle(Player player, World world, Block actBlock) } catch (IOException e1) { e1.printStackTrace(); } - + } else return; } @@ -177,9 +173,7 @@ public static void circleChooser(Player player, World world, Block actBlock) { Block westBlock = actBlock.getRelative(-1, 0, 0); // teleportation circle - if (northBlock.getType() == Material.REDSTONE_WIRE - && southBlock.getType() == Material.REDSTONE_WIRE - && eastBlock.getType() == Material.REDSTONE_WIRE + if (northBlock.getType() == Material.REDSTONE_WIRE && southBlock.getType() == Material.REDSTONE_WIRE && eastBlock.getType() == Material.REDSTONE_WIRE && westBlock.getType() == Material.REDSTONE_WIRE) { if (player.hasPermission("geometricmagic.teleportation")) { // System.out.println("teleportation"); @@ -188,13 +182,9 @@ public static void circleChooser(Player player, World world, Block actBlock) { player.sendMessage("You do not have permission to use this circle"); // micro circle - } else if (northBlock.getType() != Material.REDSTONE_WIRE - && southBlock.getType() != Material.REDSTONE_WIRE - && eastBlock.getType() != Material.REDSTONE_WIRE - && westBlock.getType() != Material.REDSTONE_WIRE - && actBlock.getRelative(-3, 0, 0).getType() != Material.REDSTONE_WIRE - && actBlock.getRelative(3, 0, 0).getType() != Material.REDSTONE_WIRE - && actBlock.getRelative(0, 0, -3).getType() != Material.REDSTONE_WIRE + } else if (northBlock.getType() != Material.REDSTONE_WIRE && southBlock.getType() != Material.REDSTONE_WIRE && eastBlock.getType() != Material.REDSTONE_WIRE + && westBlock.getType() != Material.REDSTONE_WIRE && actBlock.getRelative(-3, 0, 0).getType() != Material.REDSTONE_WIRE + && actBlock.getRelative(3, 0, 0).getType() != Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, -3).getType() != Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, 3).getType() != Material.REDSTONE_WIRE) { if (player.hasPermission("geometricmagic.micro")) { // System.out.println("micro"); @@ -203,21 +193,14 @@ public static void circleChooser(Player player, World world, Block actBlock) { player.sendMessage("You do not have permission to use this circle"); // transmutation circle - } else if ((northBlock.getType() == Material.REDSTONE_WIRE - && southBlock.getType() == Material.REDSTONE_WIRE - && eastBlock.getType() != Material.REDSTONE_WIRE && westBlock - .getType() != Material.REDSTONE_WIRE) - || (northBlock.getType() != Material.REDSTONE_WIRE - && southBlock.getType() != Material.REDSTONE_WIRE - && eastBlock.getType() == Material.REDSTONE_WIRE && westBlock - .getType() == Material.REDSTONE_WIRE)) { + } else if ((northBlock.getType() == Material.REDSTONE_WIRE && southBlock.getType() == Material.REDSTONE_WIRE && eastBlock.getType() != Material.REDSTONE_WIRE && westBlock.getType() != Material.REDSTONE_WIRE) + || (northBlock.getType() != Material.REDSTONE_WIRE && southBlock.getType() != Material.REDSTONE_WIRE && eastBlock.getType() == Material.REDSTONE_WIRE && westBlock.getType() == Material.REDSTONE_WIRE)) { // transmutation circle size permissions // - allows use of all circles smaller than then the max // size permission node they have int circleSize = 1; - if (player.hasPermission("geometricmagic.transmutation.*") - || player.hasPermission("geometricmagic.transmutation.9")) { + if (player.hasPermission("geometricmagic.transmutation.*") || player.hasPermission("geometricmagic.transmutation.9")) { circleSize = 9; } else if (player.hasPermission("geometricmagic.transmutation.7")) { circleSize = 7; @@ -237,44 +220,40 @@ public static void circleChooser(Player player, World world, Block actBlock) { // transmute cool down String coolDownConfig = plugin.getConfig().getString("transmutation.cooldown").toString(); int coolDown = Integer.parseInt(coolDownConfig); - if(mapCoolDowns.containsKey(player.getName() + " transmute circle")) { - long diff = (System.currentTimeMillis() - mapCoolDowns.get(player.getName() + " transmute circle"))/1000; - if(diff < coolDown) { + if (mapCoolDowns.containsKey(player.getName() + " transmute circle")) { + long diff = (System.currentTimeMillis() - mapCoolDowns.get(player.getName() + " transmute circle")) / 1000; + if (diff < coolDown) { // still cooling down player.sendMessage("You have to wait before you can do that again."); return; } } mapCoolDowns.put(player.getName() + " transmute circle", System.currentTimeMillis()); - + if (circleSize > 0) { transmutationCircle(player, world, actBlock, circleSize); } // set circle - } else if (northBlock.getType() != Material.REDSTONE_WIRE - && southBlock.getType() != Material.REDSTONE_WIRE - && eastBlock.getType() != Material.REDSTONE_WIRE - && westBlock.getType() != Material.REDSTONE_WIRE - && actBlock.getRelative(-3, 0, 0).getType() == Material.REDSTONE_WIRE - && actBlock.getRelative(3, 0, 0).getType() == Material.REDSTONE_WIRE - && actBlock.getRelative(0, 0, -3).getType() == Material.REDSTONE_WIRE + } else if (northBlock.getType() != Material.REDSTONE_WIRE && southBlock.getType() != Material.REDSTONE_WIRE && eastBlock.getType() != Material.REDSTONE_WIRE + && westBlock.getType() != Material.REDSTONE_WIRE && actBlock.getRelative(-3, 0, 0).getType() == Material.REDSTONE_WIRE + && actBlock.getRelative(3, 0, 0).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, -3).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, 3).getType() == Material.REDSTONE_WIRE) { if (player.hasPermission("geometricmagic.set")) { // set circle cool down String coolDownConfig = plugin.getConfig().getString("setcircles.cooldown").toString(); int coolDown = Integer.parseInt(coolDownConfig); - if(mapCoolDowns.containsKey(player.getName() + " set circle")) { - long diff = (System.currentTimeMillis() - mapCoolDowns.get(player.getName() + " set circle"))/1000; - if(diff < coolDown) { + if (mapCoolDowns.containsKey(player.getName() + " set circle")) { + long diff = (System.currentTimeMillis() - mapCoolDowns.get(player.getName() + " set circle")) / 1000; + if (diff < coolDown) { // still cooling down player.sendMessage("You have to wait before you can do that again."); return; } } mapCoolDowns.put(player.getName() + " set circle", System.currentTimeMillis()); - + setCircleRemote(player, world, actBlock); } else player.sendMessage("You do not have permission to use this circle"); @@ -285,8 +264,7 @@ public static void circleChooser(Player player, World world, Block actBlock) { } } - public static void teleportationCircle(Player player, World world, - Block actBlock) { + public static void teleportationCircle(Player player, World world, Block actBlock) { // activation block in center Location actPoint = actBlock.getLocation(); @@ -452,13 +430,10 @@ public static void teleportationCircle(Player player, World world, teleLoc.setYaw(yaw); teleLoc.setPitch(pitch); - double distance = Math.sqrt(Math.pow(teleLoc.getX() - actPointX, 2) - + Math.pow(teleLoc.getZ() - actPointZ, 2)); + double distance = Math.sqrt(Math.pow(teleLoc.getX() - actPointX, 2) + Math.pow(teleLoc.getZ() - actPointZ, 2)); - double mathRandX = philosopherStoneModifier(player) * distance / 10 - * Math.random(); - double mathRandZ = philosopherStoneModifier(player) * distance / 10 - * Math.random(); + double mathRandX = philosopherStoneModifier(player) * distance / 10 * Math.random(); + double mathRandZ = philosopherStoneModifier(player) * distance / 10 * Math.random(); double randX = (teleLoc.getX() - (0.5 * mathRandX)) + (mathRandX); double randZ = (teleLoc.getZ() - (0.5 * mathRandZ)) + (mathRandZ); @@ -474,8 +449,7 @@ public static void teleportationCircle(Player player, World world, // teleport player player.teleport(teleLoc); - ItemStack redstonePile = new ItemStack(331, 5 + na + nb + nc + sa + sb - + sc + ea + eb + ec + wa + wb + wc); + ItemStack redstonePile = new ItemStack(331, 5 + na + nb + nc + sa + sb + sc + ea + eb + ec + wa + wb + wc); teleLoc.getWorld().dropItem(teleLoc, redstonePile); @@ -491,8 +465,7 @@ public static void microCircle(Player player, World world, Block actBlock) { // Tell the player how much money they have player.sendMessage("You have " + econ.format(getBalance(player))); - } - else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + } else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { // Tell the player how many levels they have player.sendMessage("Your experience level is " + player.getLevel()); } @@ -510,8 +483,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } } - public static void transmutationCircle(Player player, World world, - Block actBlock, int circleSize) { + public static void transmutationCircle(Player player, World world, Block actBlock, int circleSize) { int halfWidth = 0; int fullWidth = 0; Location startLoc = actBlock.getLocation(); @@ -521,8 +493,7 @@ public static void transmutationCircle(Player player, World world, Material fromType = actBlock.getType(); Material toType = actBlock.getType(); boolean lightning = false; - if (actBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE - && actBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE) { + if (actBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE) { halfWidth = 0; while (actBlock.getRelative(0, 0, -1 * halfWidth).getType() == Material.REDSTONE_WIRE) { if (halfWidth > circleSize) { @@ -534,56 +505,35 @@ public static void transmutationCircle(Player player, World world, int dimensionOfEffect = (fullWidth - 2) * (fullWidth - 2); if (actBlock.getRelative((fullWidth - 1), 0, 0).getType() == Material.REDSTONE_WIRE) { // east - fromType = actBlock.getLocation() - .add(halfWidth - 1, 0, -1 * (halfWidth + 1)).getBlock() - .getType(); - Block toBlock = actBlock.getLocation() - .add(halfWidth - 1, 0, halfWidth + 1).getBlock(); + fromType = actBlock.getLocation().add(halfWidth - 1, 0, -1 * (halfWidth + 1)).getBlock().getType(); + Block toBlock = actBlock.getLocation().add(halfWidth - 1, 0, halfWidth + 1).getBlock(); toType = toBlock.getType(); byte toData = toBlock.getData(); - startLoc = actBlock.getLocation().add(fullWidth, 0, - -1 * dimensionOfEffect / 2); + startLoc = actBlock.getLocation().add(fullWidth, 0, -1 * dimensionOfEffect / 2); // System.out.println(startLoc); - endLoc = actBlock.getLocation().add( - fullWidth + dimensionOfEffect - 1, - dimensionOfEffect - 1, dimensionOfEffect / 2 - 1); + endLoc = actBlock.getLocation().add(fullWidth + dimensionOfEffect - 1, dimensionOfEffect - 1, dimensionOfEffect / 2 - 1); // System.out.println(endLoc); - circleStart = actBlock.getLocation().add(1, 0, - -1 * (halfWidth - 2)); + circleStart = actBlock.getLocation().add(1, 0, -1 * (halfWidth - 2)); // System.out.println(circleStart); - circleEnd = actBlock.getLocation().add(fullWidth - 2, - fullWidth - 3, halfWidth - 2); + circleEnd = actBlock.getLocation().add(fullWidth - 2, fullWidth - 3, halfWidth - 2); // System.out.println(circleEnd); - alchemyCheck(fromType, toType, toData, circleStart, circleEnd, - startLoc, endLoc, player, fullWidth - 2); + alchemyCheck(fromType, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); lightning = true; - } else if (actBlock.getRelative(-1 * (fullWidth - 1), 0, 0) - .getType() == Material.REDSTONE_WIRE) { + } else if (actBlock.getRelative(-1 * (fullWidth - 1), 0, 0).getType() == Material.REDSTONE_WIRE) { // west // System.out.println("transmutationCircle west"); - fromType = actBlock.getLocation() - .add(-1 * (halfWidth - 1), 0, halfWidth + 1).getBlock() - .getType(); - Block toBlock = actBlock.getLocation() - .add((-1) * (halfWidth - 1), 0, (-1) * (halfWidth + 1)) - .getBlock(); + fromType = actBlock.getLocation().add(-1 * (halfWidth - 1), 0, halfWidth + 1).getBlock().getType(); + Block toBlock = actBlock.getLocation().add((-1) * (halfWidth - 1), 0, (-1) * (halfWidth + 1)).getBlock(); toType = toBlock.getType(); byte toData = toBlock.getData(); - startLoc = actBlock.getLocation().add(-1 * fullWidth, 0, - dimensionOfEffect / 2); - endLoc = actBlock.getLocation().add( - -1 * (fullWidth + dimensionOfEffect) + 1, - dimensionOfEffect - 1, -1 * dimensionOfEffect / 2 + 1); - circleStart = actBlock.getLocation() - .add(-1, 0, (halfWidth - 2)); - circleEnd = actBlock.getLocation().add(-1 * (fullWidth - 2), - fullWidth - 3, -1 * (halfWidth - 2)); - alchemyCheck(fromType, toType, toData, circleStart, circleEnd, - startLoc, endLoc, player, fullWidth - 2); + startLoc = actBlock.getLocation().add(-1 * fullWidth, 0, dimensionOfEffect / 2); + endLoc = actBlock.getLocation().add(-1 * (fullWidth + dimensionOfEffect) + 1, dimensionOfEffect - 1, -1 * dimensionOfEffect / 2 + 1); + circleStart = actBlock.getLocation().add(-1, 0, (halfWidth - 2)); + circleEnd = actBlock.getLocation().add(-1 * (fullWidth - 2), fullWidth - 3, -1 * (halfWidth - 2)); + alchemyCheck(fromType, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); lightning = true; } - } else if (actBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE - && actBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE) { + } else if (actBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE) { halfWidth = 0; while (actBlock.getRelative(halfWidth, 0, 0).getType() == Material.REDSTONE_WIRE) { if (halfWidth > circleSize) { @@ -598,45 +548,28 @@ public static void transmutationCircle(Player player, World world, if (actBlock.getRelative(0, 0, -1 * (fullWidth - 1)).getType() == Material.REDSTONE_WIRE) { // north // System.out.println("transmutationCircle north"); - fromType = actBlock.getLocation() - .add(-1 * (halfWidth + 1), 0, -1 * (halfWidth - 1)) - .getBlock().getType(); - Block toBlock = actBlock.getLocation() - .add(halfWidth + 1, 0, -1 * (halfWidth - 1)).getBlock(); + fromType = actBlock.getLocation().add(-1 * (halfWidth + 1), 0, -1 * (halfWidth - 1)).getBlock().getType(); + Block toBlock = actBlock.getLocation().add(halfWidth + 1, 0, -1 * (halfWidth - 1)).getBlock(); toType = toBlock.getType(); byte toData = toBlock.getData(); - startLoc = actBlock.getLocation().add( - -1 * dimensionOfEffect / 2, 0, -1 * fullWidth); - endLoc = actBlock.getLocation().add(dimensionOfEffect / 2 - 1, - dimensionOfEffect - 1, - -1 * (dimensionOfEffect + fullWidth) + 1); - circleStart = actBlock.getLocation().add(-1 * (halfWidth - 2), - 0, -1); - circleEnd = actBlock.getLocation().add((halfWidth - 2), - fullWidth - 3, -1 * (fullWidth - 2)); - alchemyCheck(fromType, toType, toData, circleStart, circleEnd, - startLoc, endLoc, player, fullWidth - 2); + startLoc = actBlock.getLocation().add(-1 * dimensionOfEffect / 2, 0, -1 * fullWidth); + endLoc = actBlock.getLocation().add(dimensionOfEffect / 2 - 1, dimensionOfEffect - 1, -1 * (dimensionOfEffect + fullWidth) + 1); + circleStart = actBlock.getLocation().add(-1 * (halfWidth - 2), 0, -1); + circleEnd = actBlock.getLocation().add((halfWidth - 2), fullWidth - 3, -1 * (fullWidth - 2)); + alchemyCheck(fromType, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); lightning = true; } else if (actBlock.getRelative(0, 0, (fullWidth - 1)).getType() == Material.REDSTONE_WIRE) { // south // System.out.println("transmutationCircle south"); - fromType = actBlock.getLocation() - .add(halfWidth + 1, 0, halfWidth - 1).getBlock() - .getType(); - Block toBlock = actBlock.getLocation() - .add(-1 * (halfWidth + 1), 0, halfWidth - 1).getBlock(); + fromType = actBlock.getLocation().add(halfWidth + 1, 0, halfWidth - 1).getBlock().getType(); + Block toBlock = actBlock.getLocation().add(-1 * (halfWidth + 1), 0, halfWidth - 1).getBlock(); toType = toBlock.getType(); byte toData = toBlock.getData(); - startLoc = actBlock.getLocation().add(dimensionOfEffect / 2, 0, - fullWidth); - endLoc = actBlock.getLocation().add( - -1 * dimensionOfEffect / 2 + 1, dimensionOfEffect - 1, - fullWidth + dimensionOfEffect - 1); + startLoc = actBlock.getLocation().add(dimensionOfEffect / 2, 0, fullWidth); + endLoc = actBlock.getLocation().add(-1 * dimensionOfEffect / 2 + 1, dimensionOfEffect - 1, fullWidth + dimensionOfEffect - 1); circleStart = actBlock.getLocation().add(halfWidth - 2, 0, 1); - circleEnd = actBlock.getLocation().add(-1 * (halfWidth - 2), - fullWidth - 3, (fullWidth - 2)); - alchemyCheck(fromType, toType, toData, circleStart, circleEnd, - startLoc, endLoc, player, fullWidth - 2); + circleEnd = actBlock.getLocation().add(-1 * (halfWidth - 2), fullWidth - 3, (fullWidth - 2)); + alchemyCheck(fromType, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); lightning = true; } } @@ -644,18 +577,14 @@ public static void transmutationCircle(Player player, World world, actBlock.getWorld().strikeLightningEffect(actBlock.getLocation()); } - public static void setCircleRemote(Player player, World world, - Block actBlock) { + public static void setCircleRemote(Player player, World world, Block actBlock) { Boolean remote = false; Block effectBlock = actBlock; List entitiesList = player.getNearbyEntities(242, 20, 242); for (int i = 0; i < entitiesList.size(); i++) { if (entitiesList.get(i) instanceof Arrow) { Arrow shotArrow = (Arrow) entitiesList.get(i); - if (shotArrow.getLocation().getBlock().getX() == actBlock - .getLocation().getBlock().getX() - && shotArrow.getLocation().getBlock().getZ() == actBlock - .getLocation().getBlock().getZ()) { + if (shotArrow.getLocation().getBlock().getX() == actBlock.getLocation().getBlock().getX() && shotArrow.getLocation().getBlock().getZ() == actBlock.getLocation().getBlock().getZ()) { remote = true; entitiesList.remove(i); } @@ -673,8 +602,7 @@ public static void setCircleRemote(Player player, World world, setCircle(player, world, actBlock, effectBlock); } - public static void setCircle(Player player, World world, Block actBlock, - Block effectBlock) { + public static void setCircle(Player player, World world, Block actBlock, Block effectBlock) { Block northSin = actBlock.getRelative(0, 0, -3); Block southSin = actBlock.getRelative(0, 0, 3); Block eastSin = actBlock.getRelative(3, 0, 0); @@ -724,17 +652,17 @@ public static void setCircle(Player player, World world, Block actBlock, String arrayString = Arrays.toString(intArray); try { // exempt player from AntiCheat check - if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); AnticheatAPI.exemptPlayer(player, CheckType.LONG_REACH); AnticheatAPI.exemptPlayer(player, CheckType.NO_SWING); } - + setCircleEffects(player, world, actBlock, effectBlock, arrayString); // unexempt player from AntiCheat check - if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { AnticheatAPI.unexemptPlayer(player, CheckType.FAST_PLACE); AnticheatAPI.unexemptPlayer(player, CheckType.FAST_BREAK); AnticheatAPI.unexemptPlayer(player, CheckType.LONG_REACH); @@ -745,32 +673,27 @@ public static void setCircle(Player player, World world, Block actBlock, } } - public static void setCircleEffects(Player player, World world, - Block actBlock, Block effectBlock, String arrayString) - throws IOException { + public static void setCircleEffects(Player player, World world, Block actBlock, Block effectBlock, String arrayString) throws IOException { int cost = 0; if (!hasLearnedCircle(player, arrayString)) { if (learnCircle(player, arrayString, actBlock)) { - player.sendMessage("You have successfully learned the circle " - + arrayString); + player.sendMessage("You have successfully learned the circle " + arrayString); return; } } if (arrayString.equals("0")) return; - if (arrayString.equals("[1, 1, 3, 3]") - && player.hasPermission("geometricmagic.set.1133")) { + if (arrayString.equals("[1, 1, 3, 3]") && player.hasPermission("geometricmagic.set.1133")) { if (!hasLearnedCircle(player, arrayString)) { - player.sendMessage("You have not yet learned circle " - + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } - + List repairEntities = player.getNearbyEntities(9, 10, 9); for (int i = 0; i < repairEntities.size(); i++) { if (repairEntities.get(i) instanceof Item) { Item droppedItem = (Item) repairEntities.get(i); - + // Item data value int itemCode = droppedItem.getItemStack().getTypeId(); @@ -778,27 +701,17 @@ public static void setCircleEffects(Player player, World world, Map effects = droppedItem.getItemStack().getEnchantments(); // Get cost - if ((256 <= itemCode && itemCode <= 258) - || (267 <= itemCode && itemCode <= 279) - || (283 <= itemCode && itemCode <= 286) - || (290 <= itemCode && itemCode <= 294) - || (298 <= itemCode && itemCode <= 317) - || itemCode == 259 || itemCode == 346 - || itemCode == 359 || itemCode == 261) { - if ((256 <= itemCode && itemCode <= 258) - || itemCode == 267 || itemCode == 292) + if ((256 <= itemCode && itemCode <= 258) || (267 <= itemCode && itemCode <= 279) || (283 <= itemCode && itemCode <= 286) || (290 <= itemCode && itemCode <= 294) + || (298 <= itemCode && itemCode <= 317) || itemCode == 259 || itemCode == 346 || itemCode == 359 || itemCode == 261) { + if ((256 <= itemCode && itemCode <= 258) || itemCode == 267 || itemCode == 292) cost = droppedItem.getItemStack().getDurability(); - if ((268 <= itemCode && itemCode <= 271) - || itemCode == 290) + if ((268 <= itemCode && itemCode <= 271) || itemCode == 290) cost = droppedItem.getItemStack().getDurability(); - if ((272 <= itemCode && itemCode <= 275) - || itemCode == 291) + if ((272 <= itemCode && itemCode <= 275) || itemCode == 291) cost = droppedItem.getItemStack().getDurability(); - if ((276 <= itemCode && itemCode <= 279) - || itemCode == 293) + if ((276 <= itemCode && itemCode <= 279) || itemCode == 293) cost = droppedItem.getItemStack().getDurability(); - if ((283 <= itemCode && itemCode <= 286) - || itemCode == 294) + if ((283 <= itemCode && itemCode <= 286) || itemCode == 294) cost = droppedItem.getItemStack().getDurability(); if (itemCode == 298) cost = droppedItem.getItemStack().getDurability(); @@ -841,21 +754,20 @@ public static void setCircleEffects(Player player, World world, if (itemCode == 261) cost = droppedItem.getItemStack().getDurability(); cost = cost / 50; - + // Make sure cost is not more than 20 if (cost > 20) cost = 20; - + if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); ItemStack newItem = new ItemStack(itemCode, 1); - + // enchant the item newItem.addEnchantments(effects); - + droppedItem.remove(); - effectBlock.getWorld().dropItem( - effectBlock.getLocation(), newItem); + effectBlock.getWorld().dropItem(effectBlock.getLocation(), newItem); } else { player.sendMessage("You feel so hungry..."); return; @@ -863,39 +775,36 @@ public static void setCircleEffects(Player player, World world, } } } - } else if (arrayString.equals("[1, 2, 2, 2]") - && player.hasPermission("geometricmagic.set.1222")) { + } else if (arrayString.equals("[1, 2, 2, 2]") && player.hasPermission("geometricmagic.set.1222")) { String costConfig = plugin.getConfig().getString("setcircles.1222.cost").toString(); cost = Integer.parseInt(costConfig); - if(cost > 20) + if (cost > 20) cost = 20; - + if (!hasLearnedCircle(player, arrayString)) { - player.sendMessage("You have not yet learned circle " - + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); ItemStack oneRedstone = new ItemStack(331, 1); - Item redStack = effectBlock.getWorld().dropItem( - effectBlock.getLocation(), oneRedstone); + Item redStack = effectBlock.getWorld().dropItem(effectBlock.getLocation(), oneRedstone); List entityList = redStack.getNearbyEntities(5, 10, 5); for (int i = 0; i < entityList.size(); i++) { if (entityList.get(i) instanceof Item) { Item droppedItem = (Item) entityList.get(i); - // check if player has permission to break blocks here first - if(!checkBlockBreakSimulation(droppedItem.getLocation(), player)) { - //player.sendMessage("You don't have permission to do that there."); + // check if player has permission to break blocks here + // first + if (!checkBlockBreakSimulation(droppedItem.getLocation(), player)) { + // player.sendMessage("You don't have permission to do that there."); return; } int valueArray = getBlockValue(plugin, droppedItem.getItemStack().getTypeId()); - int pay = (valueArray * droppedItem.getItemStack() - .getAmount()); + int pay = (valueArray * droppedItem.getItemStack().getAmount()); if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { Economy econ = GeometricMagic.getEconomy(); @@ -904,10 +813,8 @@ public static void setCircleEffects(Player player, World world, } else if (pay < 0) { econ.withdrawPlayer(player.getName(), pay * -1); } - } - else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { - player.setLevel((valueArray * droppedItem.getItemStack().getAmount()) - + player.getLevel()); + } else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + player.setLevel((valueArray * droppedItem.getItemStack().getAmount()) + player.getLevel()); } /* * player.setLevel((valueArray[droppedItem.getItemStack() @@ -922,17 +829,15 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { player.sendMessage("You feel so hungry..."); return; } - } else if (arrayString.equals("[1, 2, 3, 3]") - && player.hasPermission("geometricmagic.set.1233")) { + } else if (arrayString.equals("[1, 2, 3, 3]") && player.hasPermission("geometricmagic.set.1233")) { String costConfig = plugin.getConfig().getString("setcircles.1233.cost").toString(); cost = Integer.parseInt(costConfig); - if(cost > 20) + if (cost > 20) cost = 20; if (!hasLearnedCircle(player, arrayString)) { - player.sendMessage("You have not yet learned circle " - + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } ItemStack onePortal = new ItemStack(90, 1); @@ -943,8 +848,8 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { Item sacrifice = (Item) entityList.get(i); // check if player has permission to break blocks here first - if(!checkBlockBreakSimulation(sacrifice.getLocation(), player)) { - //player.sendMessage("You don't have permission to do that there."); + if (!checkBlockBreakSimulation(sacrifice.getLocation(), player)) { + // player.sendMessage("You don't have permission to do that there."); return; } @@ -958,88 +863,74 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { if (fires >= 64) { fires -= 64; player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); - effectBlock.getWorld().dropItem(effectBlock.getLocation(), - onePortal); + effectBlock.getWorld().dropItem(effectBlock.getLocation(), onePortal); } } else { player.sendMessage("You feel so hungry..."); } ItemStack diamondStack = new ItemStack(264, fires); - effectBlock.getWorld().dropItem(effectBlock.getLocation(), - diamondStack); - } else if (arrayString.equals("[1, 2, 3, 4]") - && player.hasPermission("geometricmagic.set.1234")) { + effectBlock.getWorld().dropItem(effectBlock.getLocation(), diamondStack); + } else if (arrayString.equals("[1, 2, 3, 4]") && player.hasPermission("geometricmagic.set.1234")) { String costConfig = plugin.getConfig().getString("setcircles.1234.cost").toString(); cost = Integer.parseInt(costConfig); - if(cost > 20) + if (cost > 20) cost = 20; if (!hasLearnedCircle(player, arrayString)) { - player.sendMessage("You have not yet learned circle " - + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); - player.sendMessage(ChatColor.GREEN - + "The four elements, like man alone, are weak. But together they form the strong fifth element: boron -Brother Silence"); + player.sendMessage(ChatColor.GREEN + "The four elements, like man alone, are weak. But together they form the strong fifth element: boron -Brother Silence"); String amountConfig = plugin.getConfig().getString("setcircles.1234.amount").toString(); int amount = Integer.parseInt(amountConfig); ItemStack oneRedstone = new ItemStack(331, amount); - - effectBlock.getWorld().dropItem(effectBlock.getLocation(), - oneRedstone); + + effectBlock.getWorld().dropItem(effectBlock.getLocation(), oneRedstone); } else { player.sendMessage("You feel so hungry..."); return; } - } else if (arrayString.equals("[2, 2, 2, 3]") - && player.hasPermission("geometricmagic.set.2223")) { + } else if (arrayString.equals("[2, 2, 2, 3]") && player.hasPermission("geometricmagic.set.2223")) { String costConfig = plugin.getConfig().getString("setcircles.2223.cost").toString(); cost = Integer.parseInt(costConfig); - if(cost > 20) + if (cost > 20) cost = 20; if (!hasLearnedCircle(player, arrayString)) { - player.sendMessage("You have not yet learned circle " - + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } ItemStack oneRedstone = new ItemStack(331, 1); if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); - Item redStack = effectBlock.getWorld().dropItem( - effectBlock.getLocation(), oneRedstone); + Item redStack = effectBlock.getWorld().dropItem(effectBlock.getLocation(), oneRedstone); int size = setCircleSize(actBlock); - List entityList = redStack.getNearbyEntities(size + 5, - 128, size + 5); - + List entityList = redStack.getNearbyEntities(size + 5, 128, size + 5); + for (int i = 0; i < entityList.size(); i++) { if (entityList.get(i) instanceof Player) { HumanEntity victim = (HumanEntity) entityList.get(i); - // check if player has permission to break blocks here first - if(!checkBlockBreakSimulation(victim.getLocation(), player)) { - //player.sendMessage("You don't have permission to do that there."); + // check if player has permission to break blocks here + // first + if (!checkBlockBreakSimulation(victim.getLocation(), player)) { + // player.sendMessage("You don't have permission to do that there."); return; } - + if (!victim.equals(player)) { - victim.getWorld().strikeLightningEffect( - victim.getLocation()); + victim.getWorld().strikeLightningEffect(victim.getLocation()); if (victim.getInventory().contains(Material.FIRE)) { - for (int k = 0; k < player.getInventory() - .getSize(); k++) { - if (player.getInventory().getItem(i) - .getType() == Material.FIRE) { + for (int k = 0; k < player.getInventory().getSize(); k++) { + if (player.getInventory().getItem(i).getType() == Material.FIRE) { // System.out.println("removed a fire"); - int amount = player.getInventory() - .getItem(k).getAmount(); - player.getInventory().getItem(k) - .setAmount(amount - 1); + int amount = player.getInventory().getItem(k).getAmount(); + player.getInventory().getItem(k).setAmount(amount - 1); if (amount - 1 <= 0) { player.getInventory().clear(k); } @@ -1049,20 +940,17 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { victim.damage(20); if (victim.isDead()) { ItemStack oneFire = new ItemStack(51, 1); - victim.getWorld().dropItem( - actBlock.getLocation(), oneFire); + victim.getWorld().dropItem(actBlock.getLocation(), oneFire); } } } if (entityList.get(i) instanceof Villager) { Villager victim = (Villager) entityList.get(i); - victim.getWorld().strikeLightningEffect( - victim.getLocation()); + victim.getWorld().strikeLightningEffect(victim.getLocation()); victim.damage(20); if (victim.isDead()) { ItemStack oneFire = new ItemStack(51, 1); - victim.getWorld().dropItem(actBlock.getLocation(), - oneFire); + victim.getWorld().dropItem(actBlock.getLocation(), oneFire); } } } @@ -1071,12 +959,11 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { player.sendMessage("You feel so hungry..."); return; } - } else if (arrayString.equals("[2, 2, 2, 4]") - && player.hasPermission("geometricmagic.set.2224")) { + } else if (arrayString.equals("[2, 2, 2, 4]") && player.hasPermission("geometricmagic.set.2224")) { String costConfig = plugin.getConfig().getString("setcircles.2224.cost").toString(); cost = Integer.parseInt(costConfig); - if(cost > 20) + if (cost > 20) cost = 20; if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { @@ -1088,17 +975,15 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { player.sendMessage("You feel so hungry..."); return; } - } else if (arrayString.equals("[2, 2, 4, 4]") - && player.hasPermission("geometricmagic.set.2244")) { + } else if (arrayString.equals("[2, 2, 4, 4]") && player.hasPermission("geometricmagic.set.2244")) { if (!hasLearnedCircle(player, arrayString)) { - player.sendMessage("You have not yet learned circle " - + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } String costConfig = plugin.getConfig().getString("setcircles.2244.cost").toString(); cost = Integer.parseInt(costConfig); - if(cost > 20) + if (cost > 20) cost = 20; Location actPoint = effectBlock.getLocation(); @@ -1150,12 +1035,9 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { double actPointX = actPoint.getX(); double actPointZ = actPoint.getZ(); Location teleLoc = actPoint.add(x, 0, z); - double distance = Math.sqrt(Math.pow(teleLoc.getX() - actPointX, 2) - + Math.pow(teleLoc.getZ() - actPointZ, 2)); - double mathRandX = philosopherStoneModifier(player) * distance / 10 - * Math.random(); - double mathRandZ = philosopherStoneModifier(player) * distance / 10 - * Math.random(); + double distance = Math.sqrt(Math.pow(teleLoc.getX() - actPointX, 2) + Math.pow(teleLoc.getZ() - actPointZ, 2)); + double mathRandX = philosopherStoneModifier(player) * distance / 10 * Math.random(); + double mathRandZ = philosopherStoneModifier(player) * distance / 10 * Math.random(); double randX = (teleLoc.getX() - (0.5 * mathRandX)) + (mathRandX); double randZ = (teleLoc.getZ() - (0.5 * mathRandZ)) + (mathRandZ); teleLoc.setX(randX); @@ -1165,55 +1047,49 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } int highestBlock = teleLoc.getWorld().getHighestBlockYAt(teleLoc) + 1; // System.out.println( mathRandX + " " + mathRandZ ); - player.sendMessage("Safe teleportation altitude is at " - + highestBlock); + player.sendMessage("Safe teleportation altitude is at " + highestBlock); return; - } else if (arrayString.equals("[2, 3, 3, 3]") - && player.hasPermission("geometricmagic.set.2333")) { + } else if (arrayString.equals("[2, 3, 3, 3]") && player.hasPermission("geometricmagic.set.2333")) { String costConfig = plugin.getConfig().getString("setcircles.2333.cost").toString(); cost = Integer.parseInt(costConfig); - if(cost > 20) + if (cost > 20) cost = 20; int size = setCircleSize(actBlock); cost = cost + size / 2; - + // Make sure cost is not more than 20 if (cost > 20) cost = 20; - + if (!hasLearnedCircle(player, arrayString)) { - player.sendMessage("You have not yet learned circle " - + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); // check if player has permission to break blocks here first - if(!checkBlockBreakSimulation(effectBlock.getLocation(), player)) { - //player.sendMessage("You don't have permission to do that there."); + if (!checkBlockBreakSimulation(effectBlock.getLocation(), player)) { + // player.sendMessage("You don't have permission to do that there."); return; } - - effectBlock.getWorld().createExplosion( - effectBlock.getLocation(), (4 + size)); + + effectBlock.getWorld().createExplosion(effectBlock.getLocation(), (4 + size)); } else { player.sendMessage("You feel so hungry..."); return; } - } else if (arrayString.equals("[3, 3, 3, 4]") - && player.hasPermission("geometricmagic.set.3334")) { + } else if (arrayString.equals("[3, 3, 3, 4]") && player.hasPermission("geometricmagic.set.3334")) { String costConfig = plugin.getConfig().getString("setcircles.3334.cost").toString(); cost = Integer.parseInt(costConfig); - if(cost > 20) + if (cost > 20) cost = 20; if (!hasLearnedCircle(player, arrayString)) { - player.sendMessage("You have not yet learned circle " - + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { @@ -1221,63 +1097,56 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { String configSize = plugin.getConfig().getString("setcircles.3334.size").toString(); Integer circleSize = Integer.parseInt(configSize); - - alchemyFiller(Material.AIR, Material.FIRE, (byte) 0, - effectBlock.getRelative((circleSize/2)*-1, 0, (circleSize/2)*-1).getLocation(), - effectBlock.getRelative(circleSize/2, circleSize, circleSize/2).getLocation(), - player, false); + + alchemyFiller(Material.AIR, Material.FIRE, (byte) 0, effectBlock.getRelative((circleSize / 2) * -1, 0, (circleSize / 2) * -1).getLocation(), + effectBlock.getRelative(circleSize / 2, circleSize, circleSize / 2).getLocation(), player, false); } else { player.sendMessage("You feel so hungry..."); return; } - } else if (arrayString.equals("[3, 3, 4, 4]") - && player.hasPermission("geometricmagic.set.3344")) { + } else if (arrayString.equals("[3, 3, 4, 4]") && player.hasPermission("geometricmagic.set.3344")) { String costConfig = plugin.getConfig().getString("setcircles.3344.cost").toString(); cost = Integer.parseInt(costConfig); - if(cost > 20) + if (cost > 20) cost = 20; int size = setCircleSize(actBlock); cost = cost + size / 2; - + // Make sure cost is not more than 20 if (cost > 20) cost = 20; - + if (!hasLearnedCircle(player, arrayString)) { - player.sendMessage("You have not yet learned circle " - + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); // check if player has permission to break blocks here first - if(!checkBlockBreakSimulation(effectBlock.getLocation(), player)) { - //player.sendMessage("You don't have permission to do that there."); + if (!checkBlockBreakSimulation(effectBlock.getLocation(), player)) { + // player.sendMessage("You don't have permission to do that there."); return; } - - effectBlock.getWorld().createExplosion( - effectBlock.getLocation(), size, true); - + + effectBlock.getWorld().createExplosion(effectBlock.getLocation(), size, true); + } else { player.sendMessage("You feel so hungry..."); return; } - } else if (arrayString.equals("[3, 4, 4, 4]") - && player.hasPermission("geometricmagic.set.3444")) { + } else if (arrayString.equals("[3, 4, 4, 4]") && player.hasPermission("geometricmagic.set.3444")) { String costConfig = plugin.getConfig().getString("setcircles.3444.cost").toString(); cost = Integer.parseInt(costConfig); - if(cost > 20) + if (cost > 20) cost = 20; if (!hasLearnedCircle(player, arrayString)) { - player.sendMessage("You have not yet learned circle " - + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { @@ -1291,18 +1160,16 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { player.sendMessage("You feel so hungry..."); return; } - } else if (arrayString.equals("[0, 1, 1, 1]") - && player.hasPermission("geometricmagic.set.0111")) { + } else if (arrayString.equals("[0, 1, 1, 1]") && player.hasPermission("geometricmagic.set.0111")) { // using x111 because yml doesn't like 0 as first character String costConfig = plugin.getConfig().getString("setcircles.x111.cost").toString(); cost = Integer.parseInt(costConfig); - if(cost > 20) + if (cost > 20) cost = 20; if (!hasLearnedCircle(player, arrayString)) { - player.sendMessage("You have not yet learned circle " - + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); @@ -1311,30 +1178,14 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { if (playerSpawn.getBlock().getType() == Material.AIR) { player.teleport(playerSpawn); } else { - if (new Location(player.getWorld(), - playerSpawn.getX() + 1, playerSpawn.getY(), - playerSpawn.getZ()).getBlock().getType() == Material.AIR) { - player.teleport(new Location(player.getWorld(), - playerSpawn.getX() + 1, playerSpawn.getY(), - playerSpawn.getZ())); - } else if (new Location(player.getWorld(), - playerSpawn.getX() - 1, playerSpawn.getY(), - playerSpawn.getZ()).getBlock().getType() == Material.AIR) { - player.teleport(new Location(player.getWorld(), - playerSpawn.getX() - 1, playerSpawn.getY(), - playerSpawn.getZ())); - } else if (new Location(player.getWorld(), - playerSpawn.getX(), playerSpawn.getY(), - playerSpawn.getZ() + 1).getBlock().getType() == Material.AIR) { - player.teleport(new Location(player.getWorld(), - playerSpawn.getX(), playerSpawn.getY(), - playerSpawn.getZ() + 1)); - } else if (new Location(player.getWorld(), - playerSpawn.getX(), playerSpawn.getY(), - playerSpawn.getZ() - 1).getBlock().getType() == Material.AIR) { - player.teleport(new Location(player.getWorld(), - playerSpawn.getX(), playerSpawn.getY(), - playerSpawn.getZ() - 1)); + if (new Location(player.getWorld(), playerSpawn.getX() + 1, playerSpawn.getY(), playerSpawn.getZ()).getBlock().getType() == Material.AIR) { + player.teleport(new Location(player.getWorld(), playerSpawn.getX() + 1, playerSpawn.getY(), playerSpawn.getZ())); + } else if (new Location(player.getWorld(), playerSpawn.getX() - 1, playerSpawn.getY(), playerSpawn.getZ()).getBlock().getType() == Material.AIR) { + player.teleport(new Location(player.getWorld(), playerSpawn.getX() - 1, playerSpawn.getY(), playerSpawn.getZ())); + } else if (new Location(player.getWorld(), playerSpawn.getX(), playerSpawn.getY(), playerSpawn.getZ() + 1).getBlock().getType() == Material.AIR) { + player.teleport(new Location(player.getWorld(), playerSpawn.getX(), playerSpawn.getY(), playerSpawn.getZ() + 1)); + } else if (new Location(player.getWorld(), playerSpawn.getX(), playerSpawn.getY(), playerSpawn.getZ() - 1).getBlock().getType() == Material.AIR) { + player.teleport(new Location(player.getWorld(), playerSpawn.getX(), playerSpawn.getY(), playerSpawn.getZ() - 1)); } else { player.sendMessage("Your bed is not safe to teleport to!"); player.setFoodLevel((int) (player.getFoodLevel() + (cost * philosopherStoneModifier(player)))); @@ -1348,116 +1199,108 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { player.sendMessage("You feel so hungry..."); return; } - } else if (arrayString.equals("[0, 0, 4, 4]") - && player.hasPermission("geometricmagic.set.0044")) { + } else if (arrayString.equals("[0, 0, 4, 4]") && player.hasPermission("geometricmagic.set.0044")) { // using x044 because yml doesn't like 0 as first character String costConfig = plugin.getConfig().getString("setcircles.x044.cost").toString(); cost = Integer.parseInt(costConfig); - if(cost > 20) + if (cost > 20) cost = 20; if (!hasLearnedCircle(player, arrayString)) { - player.sendMessage("You have not yet learned circle " - + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); Location spawnLoc = effectBlock.getLocation(); // check if player has permission to break blocks here first - if(!checkBlockBreakSimulation(spawnLoc, player)) { - //player.sendMessage("You don't have permission to do that there."); + if (!checkBlockBreakSimulation(spawnLoc, player)) { + // player.sendMessage("You don't have permission to do that there."); return; } - + spawnLoc.add(0.5, 1, 0.5); effectBlock.getWorld().spawn(spawnLoc, Pig.class); } else { player.sendMessage("You feel so hungry..."); return; } - } else if (arrayString.equals("[0, 1, 4, 4]") - && player.hasPermission("geometricmagic.set.0144")) { + } else if (arrayString.equals("[0, 1, 4, 4]") && player.hasPermission("geometricmagic.set.0144")) { // using x144 because yml doesn't like 0 as first character String costConfig = plugin.getConfig().getString("setcircles.x144.cost").toString(); cost = Integer.parseInt(costConfig); - if(cost > 20) + if (cost > 20) cost = 20; if (!hasLearnedCircle(player, arrayString)) { - player.sendMessage("You have not yet learned circle " - + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); Location spawnLoc = effectBlock.getLocation(); // check if player has permission to break blocks here first - if(!checkBlockBreakSimulation(spawnLoc, player)) { - //player.sendMessage("You don't have permission to do that there."); + if (!checkBlockBreakSimulation(spawnLoc, player)) { + // player.sendMessage("You don't have permission to do that there."); return; } - + spawnLoc.add(0.5, 1, 0.5); effectBlock.getWorld().spawn(spawnLoc, Sheep.class); } else { player.sendMessage("You feel so hungry..."); return; } - } else if (arrayString.equals("[0, 2, 4, 4]") - && player.hasPermission("geometricmagic.set.0244")) { + } else if (arrayString.equals("[0, 2, 4, 4]") && player.hasPermission("geometricmagic.set.0244")) { // using x244 because yml doesn't like 0 as first character String costConfig = plugin.getConfig().getString("setcircles.x244.cost").toString(); cost = Integer.parseInt(costConfig); - if(cost > 20) + if (cost > 20) cost = 20; if (!hasLearnedCircle(player, arrayString)) { - player.sendMessage("You have not yet learned circle " - + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); Location spawnLoc = effectBlock.getLocation(); // check if player has permission to break blocks here first - if(!checkBlockBreakSimulation(spawnLoc, player)) { - //player.sendMessage("You don't have permission to do that there."); + if (!checkBlockBreakSimulation(spawnLoc, player)) { + // player.sendMessage("You don't have permission to do that there."); return; } - + spawnLoc.add(0.5, 1, 0.5); effectBlock.getWorld().spawn(spawnLoc, Cow.class); } else { player.sendMessage("You feel so hungry..."); return; } - } else if (arrayString.equals("[0, 3, 4, 4]") - && player.hasPermission("geometricmagic.set.0344")) { + } else if (arrayString.equals("[0, 3, 4, 4]") && player.hasPermission("geometricmagic.set.0344")) { // using x344 because yml doesn't like 0 as first character String costConfig = plugin.getConfig().getString("setcircles.x344.cost").toString(); cost = Integer.parseInt(costConfig); - if(cost > 20) + if (cost > 20) cost = 20; if (!hasLearnedCircle(player, arrayString)) { - player.sendMessage("You have not yet learned circle " - + arrayString + "!"); + player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); Location spawnLoc = effectBlock.getLocation(); // check if player has permission to break blocks here first - if(!checkBlockBreakSimulation(spawnLoc, player)) { - //player.sendMessage("You don't have permission to do that there."); + if (!checkBlockBreakSimulation(spawnLoc, player)) { + // player.sendMessage("You don't have permission to do that there."); return; } - + spawnLoc.add(0.5, 1, 0.5); effectBlock.getWorld().spawn(spawnLoc, Chicken.class); } else { @@ -1465,8 +1308,7 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { return; } } else { - player.sendMessage("You do not have permission to use " - + arrayString + " or set circle does not exist"); + player.sendMessage("You do not have permission to use " + arrayString + " or set circle does not exist"); } effectBlock.getWorld().strikeLightningEffect(effectBlock.getLocation()); } @@ -1475,7 +1317,7 @@ public static int setCircleSize(Block actBlock) { // limit sizes String limitSizeConfig = plugin.getConfig().getString("setcircles.limitsize").toString(); int limitsize = Integer.parseInt(limitSizeConfig); - + int na = 0, nb = 0, ea = 0, eb = 0, sa = 0, sb = 0, wa = 0, wb = 0, nc = 0, ec = 0, sc = 0, wc = 0; Block curBlock = actBlock.getRelative(0, 0, -5); while (curBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE || na == limitsize) { @@ -1538,16 +1380,13 @@ public static int setCircleSize(Block actBlock) { fineBlock = fineBlock.getRelative(0, 0, -1); } int size = 0; - if (wa == ea && na == sa && wb == eb && nb == sb && wc == ec - && nc == sc && wa == na) { + if (wa == ea && na == sa && wb == eb && nb == sb && wc == ec && nc == sc && wa == na) { size = wa; } return size; } - public static void alchemyCheck(Material a, Material b, byte toData, - Location circleStart, Location circleEnd, Location start, - Location end, Player player, int width) { + public static void alchemyCheck(Material a, Material b, byte toData, Location circleStart, Location circleEnd, Location start, Location end, Player player, int width) { Block startBlock = circleStart.getBlock(); int xIteration = 0; int yIteration = 0; @@ -1560,37 +1399,19 @@ public static void alchemyCheck(Material a, Material b, byte toData, while (startBlock.getX() <= circleEnd.getX()) { while (startBlock.getZ() <= circleEnd.getZ()) { if (startBlock.getType() != Material.AIR) { - alchemyFiller( - a, - b, - toData, - start.getBlock() - .getRelative( - xIteration * width, - yIteration * width, - zIteration * width) - .getLocation(), - start.getBlock() - .getRelative( - xIteration * width - + width - 1, - yIteration * width - + width - 1, - (zIteration * width + (width - 1))) - .getLocation(), player, true); + alchemyFiller(a, b, toData, start.getBlock().getRelative(xIteration * width, yIteration * width, zIteration * width).getLocation(), + start.getBlock().getRelative(xIteration * width + width - 1, yIteration * width + width - 1, (zIteration * width + (width - 1))).getLocation(), player, true); } zIteration++; startBlock = startBlock.getRelative(0, 0, 1); } xIteration++; - startBlock = circleStart.getBlock().getRelative( - xIteration, yIteration, 0); + startBlock = circleStart.getBlock().getRelative(xIteration, yIteration, 0); zIteration = 0; } yIteration++; xIteration = 0; - startBlock = circleStart.getBlock().getRelative(0, - yIteration, 0); + startBlock = circleStart.getBlock().getRelative(0, yIteration, 0); } } else { // north @@ -1599,24 +1420,8 @@ public static void alchemyCheck(Material a, Material b, byte toData, while (startBlock.getZ() >= circleEnd.getZ()) { while (startBlock.getX() <= circleEnd.getX()) { if (startBlock.getType() != Material.AIR) { - alchemyFiller( - a, - b, - toData, - start.getBlock() - .getRelative( - xIteration * width, - yIteration * width, - zIteration * width) - .getLocation(), - start.getBlock() - .getRelative( - xIteration * width - + width - 1, - yIteration * width - + width - 1, - (zIteration * width - (width - 1))) - .getLocation(), player, true); + alchemyFiller(a, b, toData, start.getBlock().getRelative(xIteration * width, yIteration * width, zIteration * width).getLocation(), + start.getBlock().getRelative(xIteration * width + width - 1, yIteration * width + width - 1, (zIteration * width - (width - 1))).getLocation(), player, true); } xIteration++; // System.out.println("xloop " + xIteration); @@ -1624,15 +1429,13 @@ public static void alchemyCheck(Material a, Material b, byte toData, } zIteration--; // System.out.println("zloop " + zIteration); - startBlock = circleStart.getBlock().getRelative(0, - yIteration, zIteration); + startBlock = circleStart.getBlock().getRelative(0, yIteration, zIteration); xIteration = 0; } yIteration++; // System.out.println("yloop " + yIteration); zIteration = 0; - startBlock = circleStart.getBlock().getRelative(0, - yIteration, 0); + startBlock = circleStart.getBlock().getRelative(0, yIteration, 0); } } } else { @@ -1643,37 +1446,19 @@ public static void alchemyCheck(Material a, Material b, byte toData, while (startBlock.getX() >= circleEnd.getX()) { while (startBlock.getZ() >= circleEnd.getZ()) { if (startBlock.getType() != Material.AIR) { - alchemyFiller( - a, - b, - toData, - start.getBlock() - .getRelative( - xIteration * width, - yIteration * width, - zIteration * width) - .getLocation(), - start.getBlock() - .getRelative( - xIteration * width - - (width - 1), - yIteration * width - + width - 1, - (zIteration * width - (width - 1))) - .getLocation(), player, true); + alchemyFiller(a, b, toData, start.getBlock().getRelative(xIteration * width, yIteration * width, zIteration * width).getLocation(), + start.getBlock().getRelative(xIteration * width - (width - 1), yIteration * width + width - 1, (zIteration * width - (width - 1))).getLocation(), player, true); } zIteration--; startBlock = startBlock.getRelative(0, 0, -1); } xIteration--; - startBlock = circleStart.getBlock().getRelative( - xIteration, yIteration, 0); + startBlock = circleStart.getBlock().getRelative(xIteration, yIteration, 0); zIteration = 0; } yIteration++; xIteration = 0; - startBlock = circleStart.getBlock().getRelative(0, - yIteration, 0); + startBlock = circleStart.getBlock().getRelative(0, yIteration, 0); } } else { // south @@ -1682,24 +1467,8 @@ public static void alchemyCheck(Material a, Material b, byte toData, while (startBlock.getZ() <= circleEnd.getZ()) { while (startBlock.getX() >= circleEnd.getX()) { if (startBlock.getType() != Material.AIR) { - alchemyFiller( - a, - b, - toData, - start.getBlock() - .getRelative( - xIteration * width, - yIteration * width, - zIteration * width) - .getLocation(), - start.getBlock() - .getRelative( - xIteration * width - - (width - 1), - yIteration * width - + width - 1, - (zIteration * width + (width - 1))) - .getLocation(), player, true); + alchemyFiller(a, b, toData, start.getBlock().getRelative(xIteration * width, yIteration * width, zIteration * width).getLocation(), + start.getBlock().getRelative(xIteration * width - (width - 1), yIteration * width + width - 1, (zIteration * width + (width - 1))).getLocation(), player, true); } xIteration--; // System.out.println("xloop"); @@ -1707,23 +1476,20 @@ public static void alchemyCheck(Material a, Material b, byte toData, } zIteration++; // System.out.println("zloop"); - startBlock = circleStart.getBlock().getRelative(0, - yIteration, zIteration); + startBlock = circleStart.getBlock().getRelative(0, yIteration, zIteration); xIteration = 0; } yIteration++; // System.out.println("yloop"); zIteration = 0; - startBlock = circleStart.getBlock().getRelative(0, - yIteration, 0); + startBlock = circleStart.getBlock().getRelative(0, yIteration, 0); } } } return; } - public static void alchemyFiller(Material a, Material b, byte toData, - Location start, Location end, Player player, boolean charge) { + public static void alchemyFiller(Material a, Material b, byte toData, Location start, Location end, Player player, boolean charge) { // System.out.println("alchemyFiller"); Block startBlock = start.getBlock(); int xIteration = 0; @@ -1741,8 +1507,7 @@ public static void alchemyFiller(Material a, Material b, byte toData, startBlock = startBlock.getRelative(0, 0, 1); } xIteration++; - startBlock = start.getBlock().getRelative(xIteration, - yIteration, 0); + startBlock = start.getBlock().getRelative(xIteration, yIteration, 0); } yIteration++; xIteration = 0; @@ -1758,8 +1523,7 @@ public static void alchemyFiller(Material a, Material b, byte toData, startBlock = startBlock.getRelative(1, 0, 0); } zIteration--; - startBlock = start.getBlock().getRelative(0, - yIteration, zIteration); + startBlock = start.getBlock().getRelative(0, yIteration, zIteration); } yIteration++; zIteration = 0; @@ -1777,8 +1541,7 @@ public static void alchemyFiller(Material a, Material b, byte toData, startBlock = startBlock.getRelative(0, 0, -1); } xIteration--; - startBlock = start.getBlock().getRelative(xIteration, - yIteration, 0); + startBlock = start.getBlock().getRelative(xIteration, yIteration, 0); } yIteration++; xIteration = 0; @@ -1796,8 +1559,7 @@ public static void alchemyFiller(Material a, Material b, byte toData, } zIteration++; // System.out.println("zloopfiller"); - startBlock = start.getBlock().getRelative(0, - yIteration, zIteration); + startBlock = start.getBlock().getRelative(0, yIteration, zIteration); } yIteration++; // System.out.println("yloopfiller"); @@ -1818,18 +1580,16 @@ public static double getBalance(Player player) { double balance = econ.getBalance(player.getName()); return balance; - } - else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + } else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { double balance = player.getLevel(); - + return balance; } return 0; } - public static void transmuteBlock(Material a, Material b, byte toData, - Block startBlock, Player player, boolean charge) { - + public static void transmuteBlock(Material a, Material b, byte toData, Block startBlock, Player player, boolean charge) { + int pay = calculatePay(a, b, player); if (startBlock.getType() == a) { @@ -1837,17 +1597,11 @@ public static void transmuteBlock(Material a, Material b, byte toData, if (-1 * getBalance(player) < pay || !charge) { // Block break - if (a != Material.AIR && b == Material.AIR - && a != Material.CHEST && a != Material.WALL_SIGN - && a != Material.SIGN_POST && a != Material.FURNACE - && a != Material.BURNING_FURNACE - && a != Material.BREWING_STAND - && a != Material.WOODEN_DOOR - && a != Material.IRON_DOOR_BLOCK - && a != Material.MOB_SPAWNER) { + if (a != Material.AIR && b == Material.AIR && a != Material.CHEST && a != Material.WALL_SIGN && a != Material.SIGN_POST && a != Material.FURNACE && a != Material.BURNING_FURNACE + && a != Material.BREWING_STAND && a != Material.WOODEN_DOOR && a != Material.IRON_DOOR_BLOCK && a != Material.MOB_SPAWNER) { Location blockLocation = startBlock.getLocation(); - + if (checkBlockBreakSimulation(blockLocation, player)) { // Change block startBlock.setType(b); @@ -1856,17 +1610,16 @@ public static void transmuteBlock(Material a, Material b, byte toData, if (charge) { if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { - + Economy econ = GeometricMagic.getEconomy(); - + // Deposit or withdraw to players Vault account if (pay > 0) { econ.depositPlayer(player.getName(), pay); } else if (pay < 0) { econ.withdrawPlayer(player.getName(), pay * -1); } - } - else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + } else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { player.setLevel((int) (player.getLevel() + pay)); } } @@ -1874,13 +1627,12 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } // Block place - else if (a == Material.AIR && b != Material.AIR - && b != Material.MOB_SPAWNER) { - + else if (a == Material.AIR && b != Material.AIR && b != Material.MOB_SPAWNER) { + Location blockLocation = startBlock.getLocation(); int blockID = b.getId(); byte blockData = 0; - + if (checkBlockPlaceSimulation(blockLocation, blockID, blockData, blockLocation, player)) { // Change block startBlock.setType(b); @@ -1889,17 +1641,16 @@ else if (a == Material.AIR && b != Material.AIR if (charge) { if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { - + Economy econ = GeometricMagic.getEconomy(); - + // Deposit or withdraw to players Vault account if (pay > 0) { econ.depositPlayer(player.getName(), pay); } else if (pay < 0) { econ.withdrawPlayer(player.getName(), pay * -1); } - } - else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + } else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { player.setLevel((int) (player.getLevel() + pay)); } } @@ -1907,20 +1658,13 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } // Block break and place - else if (a != Material.AIR && b != Material.AIR - && a != Material.CHEST && a != Material.WALL_SIGN - && a != Material.SIGN_POST && a != Material.FURNACE - && a != Material.BURNING_FURNACE - && a != Material.BREWING_STAND - && a != Material.WOODEN_DOOR - && a != Material.MOB_SPAWNER - && b != Material.MOB_SPAWNER - && a != Material.IRON_DOOR_BLOCK) { - + else if (a != Material.AIR && b != Material.AIR && a != Material.CHEST && a != Material.WALL_SIGN && a != Material.SIGN_POST && a != Material.FURNACE && a != Material.BURNING_FURNACE + && a != Material.BREWING_STAND && a != Material.WOODEN_DOOR && a != Material.MOB_SPAWNER && b != Material.MOB_SPAWNER && a != Material.IRON_DOOR_BLOCK) { + Location blockLocation = startBlock.getLocation(); int blockID = b.getId(); byte blockData = 0; - + if (checkBlockBreakSimulation(blockLocation, player) && checkBlockPlaceSimulation(blockLocation, blockID, blockData, blockLocation, player)) { // Change block startBlock.setType(b); @@ -1929,17 +1673,16 @@ else if (a != Material.AIR && b != Material.AIR if (charge) { if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { - + Economy econ = GeometricMagic.getEconomy(); - + // Deposit or withdraw to players Vault account if (pay > 0) { econ.depositPlayer(player.getName(), pay); } else if (pay < 0) { econ.withdrawPlayer(player.getName(), pay * -1); } - } - else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + } else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { player.setLevel((int) (player.getLevel() + pay)); } } @@ -1947,13 +1690,9 @@ else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { } // output to console - else if ((a != Material.AIR && b != Material.AIR) - || a == Material.MOB_SPAWNER - || b == Material.MOB_SPAWNER) { - System.out.println("[GeometricMagic] " + player.getName() - + " tried to transmute a blacklisted material:"); - System.out.println("[GeometricMagic] " + a.name() - + " into " + b.name()); + else if ((a != Material.AIR && b != Material.AIR) || a == Material.MOB_SPAWNER || b == Material.MOB_SPAWNER) { + System.out.println("[GeometricMagic] " + player.getName() + " tried to transmute a blacklisted material:"); + System.out.println("[GeometricMagic] " + a.name() + " into " + b.name()); } return; } else @@ -1972,8 +1711,7 @@ public static double philosopherStoneModifier(Player player) { int stackCount = 0; PlayerInventory inventory = player.getInventory(); for (int i = 0; i < inventory.getSize(); i++) { - if (inventory.getItem(i) != null - && inventory.getItem(i).getType() == Material.PORTAL) + if (inventory.getItem(i) != null && inventory.getItem(i).getType() == Material.PORTAL) stackCount += inventory.getItem(i).getAmount(); } String multiplier = plugin.getConfig().getString("philosopherstone.modifier").toString(); @@ -1992,8 +1730,7 @@ public static void humanTransmutation(Player player) throws IOException { while (inputFile.hasNextLine()) { String name = inputFile.nextLine(); if (name.equals(player.getDisplayName())) { - FileWriter dWriter = new FileWriter( - "plugins/GeometricMagic/sacrificed.txt", true); + FileWriter dWriter = new FileWriter("plugins/GeometricMagic/sacrificed.txt", true); PrintWriter dFile = new PrintWriter(dWriter); dFile.println(player.getDisplayName()); dFile.close(); @@ -2002,13 +1739,11 @@ public static void humanTransmutation(Player player) throws IOException { } inputFile.close(); } else { - PrintWriter outputFile = new PrintWriter( - "plugins/GeometricMagic/sacrifices.txt"); + PrintWriter outputFile = new PrintWriter("plugins/GeometricMagic/sacrifices.txt"); System.out.println("[GeometricMagic] Sacrifices file created."); outputFile.close(); } - FileWriter fWriter = new FileWriter( - "plugins/GeometricMagic/sacrifices.txt", true); + FileWriter fWriter = new FileWriter("plugins/GeometricMagic/sacrifices.txt", true); PrintWriter outputFile = new PrintWriter(fWriter); outputFile.println(player.getDisplayName()); outputFile.println(0); @@ -2016,10 +1751,8 @@ public static void humanTransmutation(Player player) throws IOException { outputFile.close(); } - public static boolean hasLearnedCircle(Player player, String circle) - throws IOException { - File myFile = new File("plugins/GeometricMagic/" + player.getName() - + ".txt"); + public static boolean hasLearnedCircle(Player player, String circle) throws IOException { + File myFile = new File("plugins/GeometricMagic/" + player.getName() + ".txt"); if (!myFile.exists()) { return false; } @@ -2035,32 +1768,24 @@ public static boolean hasLearnedCircle(Player player, String circle) return false; } - public static boolean learnCircle(Player player, String circle, - Block actBlock) throws IOException { + public static boolean learnCircle(Player player, String circle, Block actBlock) throws IOException { boolean status = false; // System.out.println("learnCircle"); ItemStack oneRedstone = new ItemStack(331, 1); - Item redStack = actBlock.getWorld().dropItem(actBlock.getLocation(), - oneRedstone); + Item redStack = actBlock.getWorld().dropItem(actBlock.getLocation(), oneRedstone); List entityList = redStack.getNearbyEntities(2, 10, 2); for (int i = 0; i < entityList.size(); i++) { if (entityList.get(i) instanceof Enderman) { if (new File("plugins/GeometricMagic/").mkdirs()) - System.out.println("[GeometricMagic] File created for " - + player.getName()); - File myFile = new File("plugins/GeometricMagic/" - + player.getName() + ".txt"); + System.out.println("[GeometricMagic] File created for " + player.getName()); + File myFile = new File("plugins/GeometricMagic/" + player.getName() + ".txt"); if (myFile.exists()) { - FileWriter fWriter = new FileWriter( - "plugins/GeometricMagic/" + player.getName() - + ".txt", true); + FileWriter fWriter = new FileWriter("plugins/GeometricMagic/" + player.getName() + ".txt", true); PrintWriter outputFile = new PrintWriter(fWriter); outputFile.println(circle); outputFile.close(); } else { - PrintWriter outputFile = new PrintWriter( - "plugins/GeometricMagic/" + player.getName() - + ".txt"); + PrintWriter outputFile = new PrintWriter("plugins/GeometricMagic/" + player.getName() + ".txt"); outputFile.println(circle); outputFile.close(); } @@ -2070,36 +1795,34 @@ public static boolean learnCircle(Player player, String circle, redStack.remove(); return status; } - + public static String getTransmutationCostSystem(GeometricMagic plugin) { return plugin.getConfig().getString("transmutation.cost").toString(); } - + public static Integer getBlockValue(GeometricMagic plugin, int i) { return plugin.getConfig().getInt("values." + i); } - + // Lyneira's Code Start - public static boolean checkBlockPlaceSimulation(Location target, int typeId, byte data, - Location placedAgainst, Player player) { + public static boolean checkBlockPlaceSimulation(Location target, int typeId, byte data, Location placedAgainst, Player player) { Block placedBlock = target.getBlock(); BlockState replacedBlockState = placedBlock.getState(); - int oldType = replacedBlockState.getTypeId(); + int oldType = replacedBlockState.getTypeId(); byte oldData = replacedBlockState.getRawData(); - + // Set the new state without physics. placedBlock.setTypeIdAndData(typeId, data, false); - BlockPlaceEvent placeEvent = new BlockPlaceEvent(placedBlock, replacedBlockState, - placedAgainst.getBlock(), null, player, true); + BlockPlaceEvent placeEvent = new BlockPlaceEvent(placedBlock, replacedBlockState, placedAgainst.getBlock(), null, player, true); ((PluginManager) getPluginManager(plugin)).callEvent(placeEvent); - + // Revert to the old state without physics. placedBlock.setTypeIdAndData(oldType, oldData, false); if (placeEvent.isCancelled()) return false; return true; } - + public static boolean checkBlockBreakSimulation(Location target, Player player) { Block block = target.getBlock(); BlockBreakEvent breakEvent = new BlockBreakEvent(block, player); @@ -2108,8 +1831,9 @@ public static boolean checkBlockBreakSimulation(Location target, Player player) return false; return true; } + // Lyneira's Code End - + public static Object getPluginManager(GeometricMagic plugin) { return plugin.getServer().getPluginManager(); } From 5711b10a2ce0243bae7a97306386f4e4816f2bf7 Mon Sep 17 00:00:00 2001 From: ty2u Date: Fri, 6 Jul 2012 23:16:31 -0400 Subject: [PATCH 070/133] Show seconds remaining of cooldowns. --- .../GeometricMagic/GeometricMagicPlayerListener.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 4d32070..40ab096 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -121,7 +121,7 @@ public static void isCircle(Player player, World world, Block actBlock) throws I long diff = (System.currentTimeMillis() - mapCoolDowns.get(player.getName() + " set circle")) / 1000; if (diff < coolDown) { // still cooling down - player.sendMessage("You have to wait before you can do that again."); + player.sendMessage(coolDown - diff + " seconds before you can do that again."); return; } } @@ -224,7 +224,7 @@ public static void circleChooser(Player player, World world, Block actBlock) { long diff = (System.currentTimeMillis() - mapCoolDowns.get(player.getName() + " transmute circle")) / 1000; if (diff < coolDown) { // still cooling down - player.sendMessage("You have to wait before you can do that again."); + player.sendMessage(coolDown - diff + " seconds before you can do that again."); return; } } @@ -248,7 +248,7 @@ public static void circleChooser(Player player, World world, Block actBlock) { long diff = (System.currentTimeMillis() - mapCoolDowns.get(player.getName() + " set circle")) / 1000; if (diff < coolDown) { // still cooling down - player.sendMessage("You have to wait before you can do that again."); + player.sendMessage(coolDown - diff + " seconds before you can do that again."); return; } } From 6bb78b2a6834f6098fcd3398c94d1cbb9b0c9c76 Mon Sep 17 00:00:00 2001 From: ty2u Date: Sat, 7 Jul 2012 07:48:19 -0400 Subject: [PATCH 071/133] Add config option for applying philosopher's stone to transmutes --- config.yml | 3 +++ .../GeometricMagic/GeometricMagicPlayerListener.java | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/config.yml b/config.yml index 30b06a4..ef8140e 100644 --- a/config.yml +++ b/config.yml @@ -25,6 +25,9 @@ transmutation: # Possible values: xp, vault (requires Vault) cost: xp + # Apply Philosopher's Stone to transmutes (true or false) + stone: true + # SET CIRCLES SECTION setcircles: # Cool down time between using set circles in seconds diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 40ab096..ed26fae 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -1703,7 +1703,14 @@ else if ((a != Material.AIR && b != Material.AIR) || a == Material.MOB_SPAWNER | public static int calculatePay(Material a, Material b, Player player) { int pay = (int) (getBlockValue(plugin, a.getId()) - getBlockValue(plugin, b.getId())); - return pay; + + // Apply Philosopher's Stone to transmutes config variable + String stoneConfig = plugin.getConfig().getString("transmutation.stone"); + if (stoneConfig == "true") { + return pay * (int) philosopherStoneModifier(player); + } else { + return pay; + } } public static double philosopherStoneModifier(Player player) { From ed3cd028ac2ab1a64dcdcc5c2e60e30c22c41e20 Mon Sep 17 00:00:00 2001 From: ty2u Date: Sat, 7 Jul 2012 09:28:05 -0400 Subject: [PATCH 072/133] -Move AntiCheat stuff to a better spot -Add AntiCheat to transmute circle -Show cooldowns on Micro Circle -Change pay to double instead of int --- .../GeometricMagicPlayerListener.java | 101 ++++++++++++++---- 1 file changed, 80 insertions(+), 21 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index ed26fae..1dd9364 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -159,6 +159,14 @@ public static void isCircle(Player player, World world, Block actBlock) throws I } } catch (IOException e1) { e1.printStackTrace(); + + // unexempt player from AntiCheat check + if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + AnticheatAPI.unexemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.unexemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.unexemptPlayer(player, CheckType.LONG_REACH); + AnticheatAPI.unexemptPlayer(player, CheckType.NO_SWING); + } } } else @@ -231,7 +239,23 @@ public static void circleChooser(Player player, World world, Block actBlock) { mapCoolDowns.put(player.getName() + " transmute circle", System.currentTimeMillis()); if (circleSize > 0) { + // exempt player from AntiCheat check + if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.exemptPlayer(player, CheckType.LONG_REACH); + AnticheatAPI.exemptPlayer(player, CheckType.NO_SWING); + } + transmutationCircle(player, world, actBlock, circleSize); + + // unexempt player from AntiCheat check + if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + AnticheatAPI.unexemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.unexemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.unexemptPlayer(player, CheckType.LONG_REACH); + AnticheatAPI.unexemptPlayer(player, CheckType.NO_SWING); + } } // set circle @@ -254,7 +278,23 @@ public static void circleChooser(Player player, World world, Block actBlock) { } mapCoolDowns.put(player.getName() + " set circle", System.currentTimeMillis()); + // exempt player from AntiCheat check + if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.exemptPlayer(player, CheckType.LONG_REACH); + AnticheatAPI.exemptPlayer(player, CheckType.NO_SWING); + } + setCircleRemote(player, world, actBlock); + + // unexempt player from AntiCheat check + if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + AnticheatAPI.unexemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.unexemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.unexemptPlayer(player, CheckType.LONG_REACH); + AnticheatAPI.unexemptPlayer(player, CheckType.NO_SWING); + } } else player.sendMessage("You do not have permission to use this circle"); @@ -470,6 +510,40 @@ public static void microCircle(Player player, World world, Block actBlock) { player.sendMessage("Your experience level is " + player.getLevel()); } + // Tell player when they can use a set circle + String coolDownConfig = plugin.getConfig().getString("setcircles.cooldown").toString(); + int coolDown = Integer.parseInt(coolDownConfig); + if (mapCoolDowns.containsKey(player.getName() + " set circle")) { + long diff = (System.currentTimeMillis() - mapCoolDowns.get(player.getName() + " set circle")) / 1000; + if (diff < coolDown) { + // still cooling down + player.sendMessage(coolDown - diff + " seconds before you can use a set circle."); + } else { + // off cooldown + player.sendMessage("Your set circle is ready to use."); + } + } else { + // off cooldown + player.sendMessage("Your set circle is ready to use."); + } + + // Tell player when they can use a transmute circle + coolDownConfig = plugin.getConfig().getString("transmutation.cooldown").toString(); + coolDown = Integer.parseInt(coolDownConfig); + if (mapCoolDowns.containsKey(player.getName() + " transmute circle")) { + long diff = (System.currentTimeMillis() - mapCoolDowns.get(player.getName() + " transmute circle")) / 1000; + if (diff < coolDown) { + // still cooling down + player.sendMessage(coolDown - diff + " seconds before you can use a transmutation circle."); + } else { + // off cooldown + player.sendMessage("Your transmutation circle is ready to use."); + } + } else { + // off cooldown + player.sendMessage("Your transmutation circle is ready to use."); + } + List entitiesList = player.getNearbyEntities(100, 10, 100); for (int i = 0; i < entitiesList.size(); i++) { if (entitiesList.get(i) instanceof Arrow) { @@ -590,6 +664,7 @@ public static void setCircleRemote(Player player, World world, Block actBlock) { } } } + if (remote) { for (int i = 0; i < entitiesList.size(); i++) { if (entitiesList.get(i) instanceof Arrow) { @@ -651,23 +726,7 @@ public static void setCircle(Player player, World world, Block actBlock, Block e Arrays.sort(intArray); String arrayString = Arrays.toString(intArray); try { - // exempt player from AntiCheat check - if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { - AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); - AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); - AnticheatAPI.exemptPlayer(player, CheckType.LONG_REACH); - AnticheatAPI.exemptPlayer(player, CheckType.NO_SWING); - } - setCircleEffects(player, world, actBlock, effectBlock, arrayString); - - // unexempt player from AntiCheat check - if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { - AnticheatAPI.unexemptPlayer(player, CheckType.FAST_PLACE); - AnticheatAPI.unexemptPlayer(player, CheckType.FAST_BREAK); - AnticheatAPI.unexemptPlayer(player, CheckType.LONG_REACH); - AnticheatAPI.unexemptPlayer(player, CheckType.NO_SWING); - } } catch (IOException e1) { e1.printStackTrace(); } @@ -1590,7 +1649,7 @@ public static double getBalance(Player player) { public static void transmuteBlock(Material a, Material b, byte toData, Block startBlock, Player player, boolean charge) { - int pay = calculatePay(a, b, player); + double pay = calculatePay(a, b, player); if (startBlock.getType() == a) { @@ -1701,13 +1760,13 @@ else if ((a != Material.AIR && b != Material.AIR) || a == Material.MOB_SPAWNER | return; } - public static int calculatePay(Material a, Material b, Player player) { - int pay = (int) (getBlockValue(plugin, a.getId()) - getBlockValue(plugin, b.getId())); - + public static double calculatePay(Material a, Material b, Player player) { + double pay = (getBlockValue(plugin, a.getId()) - getBlockValue(plugin, b.getId())); + // Apply Philosopher's Stone to transmutes config variable String stoneConfig = plugin.getConfig().getString("transmutation.stone"); if (stoneConfig == "true") { - return pay * (int) philosopherStoneModifier(player); + return (double) (pay * philosopherStoneModifier(player)); } else { return pay; } From 5c37f8b39f2f90651f3329da4a3e03b39d011312 Mon Sep 17 00:00:00 2001 From: ty2u Date: Sat, 7 Jul 2012 09:35:38 -0400 Subject: [PATCH 073/133] Fixed typo --- config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.yml b/config.yml index ef8140e..76e1b8d 100644 --- a/config.yml +++ b/config.yml @@ -50,7 +50,7 @@ setcircles: 1234: # The cost of this circle in hunger cost: 1 - # The of redstone to drop + # The number of redstone to drop amount: 1 # Soul Circle 2223: From b2f2956fd4b978840f630fb0f9e5507aadc321e6 Mon Sep 17 00:00:00 2001 From: ty2u Date: Sun, 8 Jul 2012 11:39:19 -0400 Subject: [PATCH 074/133] Fix geometricmagic.transmutation.5 --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index 18e658d..2259d28 100644 --- a/plugin.yml +++ b/plugin.yml @@ -45,7 +45,7 @@ permissions: children: geometricmagic.transmutation.1: true geometricmagic.transmutation.3: true - geometricmagic.transmutation.4: true + geometricmagic.transmutation.5: true geometricmagic.transmutation.7: true geometricmagic.transmutation.9: true geometricmagic.transmutation.1: From e32dcca386a48c0916d60edd0d638fdcf4b6184d Mon Sep 17 00:00:00 2001 From: ty2u Date: Sun, 8 Jul 2012 11:48:48 -0400 Subject: [PATCH 075/133] Add permission to bypass cooldowns --- plugin.yml | 5 +- .../GeometricMagicPlayerListener.java | 60 ++++++++++--------- 2 files changed, 36 insertions(+), 29 deletions(-) diff --git a/plugin.yml b/plugin.yml index 2259d28..d089de1 100644 --- a/plugin.yml +++ b/plugin.yml @@ -119,6 +119,8 @@ permissions: description: Allows you to use set circle 0244 geometricmagic.set.0344: description: Allows you to use set circle 0344 + geometricmagic.bypasscooldown: + description: Allows you to bypass transmutation and set circle cooldowns commands: setcircle: description: This command sets a sacrifice's right-click circle. @@ -127,5 +129,4 @@ commands: circles: description: This command displays a list of set circles. permission: geometricmagic.listcircles - usage: /circles - \ No newline at end of file + usage: /circles \ No newline at end of file diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 1dd9364..8334e9b 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -115,17 +115,19 @@ public static void isCircle(Player player, World world, Block actBlock) throws I if (player.getItemInHand().getType() == Material.FLINT && sacrifices && !GeometricMagic.checkSacrificed(player)) { // set circle cool down - String coolDownConfig = plugin.getConfig().getString("setcircles.cooldown").toString(); - int coolDown = Integer.parseInt(coolDownConfig); - if (mapCoolDowns.containsKey(player.getName() + " set circle")) { - long diff = (System.currentTimeMillis() - mapCoolDowns.get(player.getName() + " set circle")) / 1000; - if (diff < coolDown) { - // still cooling down - player.sendMessage(coolDown - diff + " seconds before you can do that again."); - return; + if (!player.hasPermission("geometricmagic.bypasscooldown")) { + String coolDownConfig = plugin.getConfig().getString("setcircles.cooldown").toString(); + int coolDown = Integer.parseInt(coolDownConfig); + if (mapCoolDowns.containsKey(player.getName() + " set circle")) { + long diff = (System.currentTimeMillis() - mapCoolDowns.get(player.getName() + " set circle")) / 1000; + if (diff < coolDown) { + // still cooling down + player.sendMessage(coolDown - diff + " seconds before you can do that again."); + return; + } } + mapCoolDowns.put(player.getName() + " set circle", System.currentTimeMillis()); } - mapCoolDowns.put(player.getName() + " set circle", System.currentTimeMillis()); File myFile = new File("plugins/GeometricMagic/sacrifices.txt"); Scanner inputFile = new Scanner(myFile); @@ -226,17 +228,19 @@ public static void circleChooser(Player player, World world, Block actBlock) { // System.out.println("circleSize:" + circleSize); // transmute cool down - String coolDownConfig = plugin.getConfig().getString("transmutation.cooldown").toString(); - int coolDown = Integer.parseInt(coolDownConfig); - if (mapCoolDowns.containsKey(player.getName() + " transmute circle")) { - long diff = (System.currentTimeMillis() - mapCoolDowns.get(player.getName() + " transmute circle")) / 1000; - if (diff < coolDown) { - // still cooling down - player.sendMessage(coolDown - diff + " seconds before you can do that again."); - return; + if (!player.hasPermission("geometricmagic.bypasscooldown")) { + String coolDownConfig = plugin.getConfig().getString("transmutation.cooldown").toString(); + int coolDown = Integer.parseInt(coolDownConfig); + if (mapCoolDowns.containsKey(player.getName() + " transmute circle")) { + long diff = (System.currentTimeMillis() - mapCoolDowns.get(player.getName() + " transmute circle")) / 1000; + if (diff < coolDown) { + // still cooling down + player.sendMessage(coolDown - diff + " seconds before you can do that again."); + return; + } } + mapCoolDowns.put(player.getName() + " transmute circle", System.currentTimeMillis()); } - mapCoolDowns.put(player.getName() + " transmute circle", System.currentTimeMillis()); if (circleSize > 0) { // exempt player from AntiCheat check @@ -266,17 +270,19 @@ public static void circleChooser(Player player, World world, Block actBlock) { if (player.hasPermission("geometricmagic.set")) { // set circle cool down - String coolDownConfig = plugin.getConfig().getString("setcircles.cooldown").toString(); - int coolDown = Integer.parseInt(coolDownConfig); - if (mapCoolDowns.containsKey(player.getName() + " set circle")) { - long diff = (System.currentTimeMillis() - mapCoolDowns.get(player.getName() + " set circle")) / 1000; - if (diff < coolDown) { - // still cooling down - player.sendMessage(coolDown - diff + " seconds before you can do that again."); - return; + if (!player.hasPermission("geometricmagic.bypasscooldown")) { + String coolDownConfig = plugin.getConfig().getString("setcircles.cooldown").toString(); + int coolDown = Integer.parseInt(coolDownConfig); + if (mapCoolDowns.containsKey(player.getName() + " set circle")) { + long diff = (System.currentTimeMillis() - mapCoolDowns.get(player.getName() + " set circle")) / 1000; + if (diff < coolDown) { + // still cooling down + player.sendMessage(coolDown - diff + " seconds before you can do that again."); + return; + } } + mapCoolDowns.put(player.getName() + " set circle", System.currentTimeMillis()); } - mapCoolDowns.put(player.getName() + " set circle", System.currentTimeMillis()); // exempt player from AntiCheat check if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { From 5de9d93961f907ea27b830b20e56f658e0660e4b Mon Sep 17 00:00:00 2001 From: ty2u Date: Sun, 8 Jul 2012 11:53:37 -0400 Subject: [PATCH 076/133] Add permission to bypass hunger being taken away --- plugin.yml | 2 + .../GeometricMagicPlayerListener.java | 64 ++++++++++++++----- 2 files changed, 50 insertions(+), 16 deletions(-) diff --git a/plugin.yml b/plugin.yml index d089de1..336e4bd 100644 --- a/plugin.yml +++ b/plugin.yml @@ -121,6 +121,8 @@ permissions: description: Allows you to use set circle 0344 geometricmagic.bypasscooldown: description: Allows you to bypass transmutation and set circle cooldowns + geometricmagic.bypasshunger: + description: Allows you to bypass hunger being taken away commands: setcircle: description: This command sets a sacrifice's right-click circle. diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 8334e9b..f50e46c 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -825,7 +825,9 @@ public static void setCircleEffects(Player player, World world, Block actBlock, cost = 20; if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + if (!player.hasPermission("geometricmagic.bypasshunger")) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + } ItemStack newItem = new ItemStack(itemCode, 1); // enchant the item @@ -852,7 +854,9 @@ public static void setCircleEffects(Player player, World world, Block actBlock, return; } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + if (!player.hasPermission("geometricmagic.bypasshunger")) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + } ItemStack oneRedstone = new ItemStack(331, 1); Item redStack = effectBlock.getWorld().dropItem(effectBlock.getLocation(), oneRedstone); List entityList = redStack.getNearbyEntities(5, 10, 5); @@ -927,7 +931,9 @@ public static void setCircleEffects(Player player, World world, Block actBlock, if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { if (fires >= 64) { fires -= 64; - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + if (!player.hasPermission("geometricmagic.bypasshunger")) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + } effectBlock.getWorld().dropItem(effectBlock.getLocation(), onePortal); } } else { @@ -947,7 +953,9 @@ public static void setCircleEffects(Player player, World world, Block actBlock, return; } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + if (!player.hasPermission("geometricmagic.bypasshunger")) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + } player.sendMessage(ChatColor.GREEN + "The four elements, like man alone, are weak. But together they form the strong fifth element: boron -Brother Silence"); String amountConfig = plugin.getConfig().getString("setcircles.1234.amount").toString(); int amount = Integer.parseInt(amountConfig); @@ -1032,7 +1040,9 @@ public static void setCircleEffects(Player player, World world, Block actBlock, cost = 20; if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + if (!player.hasPermission("geometricmagic.bypasshunger")) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + } Location spawnLoc = effectBlock.getLocation(); spawnLoc.add(0.5, 1, 0.5); effectBlock.getWorld().spawn(spawnLoc, Enderman.class); @@ -1133,7 +1143,9 @@ public static void setCircleEffects(Player player, World world, Block actBlock, return; } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + if (!player.hasPermission("geometricmagic.bypasshunger")) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + } // check if player has permission to break blocks here first if (!checkBlockBreakSimulation(effectBlock.getLocation(), player)) { @@ -1158,7 +1170,9 @@ public static void setCircleEffects(Player player, World world, Block actBlock, return; } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + if (!player.hasPermission("geometricmagic.bypasshunger")) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + } String configSize = plugin.getConfig().getString("setcircles.3334.size").toString(); Integer circleSize = Integer.parseInt(configSize); @@ -1189,7 +1203,9 @@ public static void setCircleEffects(Player player, World world, Block actBlock, return; } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + if (!player.hasPermission("geometricmagic.bypasshunger")) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + } // check if player has permission to break blocks here first if (!checkBlockBreakSimulation(effectBlock.getLocation(), player)) { @@ -1216,7 +1232,9 @@ public static void setCircleEffects(Player player, World world, Block actBlock, } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { try { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + if (!player.hasPermission("geometricmagic.bypasshunger")) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + } humanTransmutation(player); } catch (IOException e1) { e1.printStackTrace(); @@ -1237,7 +1255,9 @@ public static void setCircleEffects(Player player, World world, Block actBlock, player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + if (!player.hasPermission("geometricmagic.bypasshunger")) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + } Location playerSpawn = player.getBedSpawnLocation(); if (playerSpawn != null) { if (playerSpawn.getBlock().getType() == Material.AIR) { @@ -1253,12 +1273,16 @@ public static void setCircleEffects(Player player, World world, Block actBlock, player.teleport(new Location(player.getWorld(), playerSpawn.getX(), playerSpawn.getY(), playerSpawn.getZ() - 1)); } else { player.sendMessage("Your bed is not safe to teleport to!"); - player.setFoodLevel((int) (player.getFoodLevel() + (cost * philosopherStoneModifier(player)))); + if (!player.hasPermission("geometricmagic.bypasshunger")) { + player.setFoodLevel((int) (player.getFoodLevel() + (cost * philosopherStoneModifier(player)))); + } } } } else { player.sendMessage("You do not have a spawn set!"); - player.setFoodLevel((int) (player.getFoodLevel() + (cost * philosopherStoneModifier(player)))); + if (!player.hasPermission("geometricmagic.bypasshunger")) { + player.setFoodLevel((int) (player.getFoodLevel() + (cost * philosopherStoneModifier(player)))); + } } } else { player.sendMessage("You feel so hungry..."); @@ -1276,7 +1300,9 @@ public static void setCircleEffects(Player player, World world, Block actBlock, player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + if (!player.hasPermission("geometricmagic.bypasshunger")) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + } Location spawnLoc = effectBlock.getLocation(); // check if player has permission to break blocks here first @@ -1303,7 +1329,9 @@ public static void setCircleEffects(Player player, World world, Block actBlock, player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + if (!player.hasPermission("geometricmagic.bypasshunger")) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + } Location spawnLoc = effectBlock.getLocation(); // check if player has permission to break blocks here first @@ -1330,7 +1358,9 @@ public static void setCircleEffects(Player player, World world, Block actBlock, player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + if (!player.hasPermission("geometricmagic.bypasshunger")) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + } Location spawnLoc = effectBlock.getLocation(); // check if player has permission to break blocks here first @@ -1357,7 +1387,9 @@ public static void setCircleEffects(Player player, World world, Block actBlock, player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + if (!player.hasPermission("geometricmagic.bypasshunger")) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + } Location spawnLoc = effectBlock.getLocation(); // check if player has permission to break blocks here first From 6940ad92a13e34c868a8a70a34f246702326508c Mon Sep 17 00:00:00 2001 From: ty2u Date: Sun, 8 Jul 2012 12:25:01 -0400 Subject: [PATCH 077/133] Fix NPE --- .../GeometricMagicDamageListener.java | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java index 18c54fd..1bc69d9 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicDamageListener.java @@ -24,6 +24,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; public class GeometricMagicDamageListener implements Listener { @@ -57,17 +58,20 @@ public void onEntityDamage(EntityDamageEvent event) { boolean removedFire = false; for (int i = 0; i < playerInventory.getSize() && !removedFire; i++) { - if (playerInventory.getItem(i).getType() == Material.FIRE) { - // System.out.println("removed a fire"); - int amount = playerInventory.getItem(i).getAmount(); - playerInventory.getItem(i).setAmount(amount - 1); - if (amount - 1 <= 0) { - playerInventory.clear(i); + ItemStack inventoryItem = playerInventory.getItem(i); + if (inventoryItem != null) { + if (inventoryItem.getType() == Material.FIRE) { + // System.out.println("removed a fire"); + int amount = inventoryItem.getAmount(); + inventoryItem.setAmount(amount - 1); + if (amount - 1 <= 0) { + playerInventory.clear(i); + } + damage = damage - health; + health = 20; + player.setHealth(20); + removedFire = true; } - damage = damage - health; - health = 20; - player.setHealth(20); - removedFire = true; } } From 98888becde6dd7c4bf06d9a07720798e2de30894 Mon Sep 17 00:00:00 2001 From: ty2u Date: Sun, 8 Jul 2012 12:29:40 -0400 Subject: [PATCH 078/133] Fix missing bypasshunger permission check --- .../cakenggt/GeometricMagic/GeometricMagicPlayerListener.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index f50e46c..8972c42 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -980,7 +980,9 @@ public static void setCircleEffects(Player player, World world, Block actBlock, } ItemStack oneRedstone = new ItemStack(331, 1); if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + if (!player.hasPermission("geometricmagic.bypasshunger")) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + } Item redStack = effectBlock.getWorld().dropItem(effectBlock.getLocation(), oneRedstone); int size = setCircleSize(actBlock); List entityList = redStack.getNearbyEntities(size + 5, 128, size + 5); From a4d11c87415a0149ee7171fa90f0eb6451a368c8 Mon Sep 17 00:00:00 2001 From: ty2u Date: Wed, 11 Jul 2012 09:40:45 -0400 Subject: [PATCH 079/133] fix up /setcircle a bit --- plugin.yml | 2 +- .../GeometricMagic/GeometricMagic.java | 23 ++++++++++--------- .../GeometricMagicPlayerListener.java | 9 ++++++-- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/plugin.yml b/plugin.yml index 336e4bd..da5be20 100644 --- a/plugin.yml +++ b/plugin.yml @@ -127,7 +127,7 @@ commands: setcircle: description: This command sets a sacrifice's right-click circle. permission: geometricmagic.setcircle - usage: /setcircle <####> + usage: Hold the flint from your inventory in your hand and right-click to cast a set circle. Use /circles to list all set circles. To bind a set circle to the flint use /setcircle #### circles: description: This command displays a list of set circles. permission: geometricmagic.listcircles diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagic.java b/src/me/cakenggt/GeometricMagic/GeometricMagic.java index 8d2105e..7f1f4b8 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagic.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagic.java @@ -53,6 +53,11 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, if (sender instanceof Player) { player = (Player) sender; + if (!player.hasPermission("geometricmagic.setcircle")) { + player.sendMessage(ChatColor.RED + "You don't have permission to use this command."); + return true; + } + boolean sacrificed = false; try { sacrificed = checkSacrificed(player); @@ -65,22 +70,18 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, return true; } - if (args.length == 0) { + // check if player has flint and is using the proper arguments + boolean hasFlint = player.getInventory().contains(Material.FLINT); + if ((args.length != 1 || (args[0].length() != 4 && args[0].length() != 1)) && hasFlint) { + sender.sendMessage(ChatColor.RED + cmd.getUsage()); + return true; + } else if (args.length == 0 && !hasFlint) { + // they don't have flint so give them one ItemStack oneFlint = new ItemStack(318, 1); player.getWorld().dropItem(player.getLocation(), oneFlint); return true; } - if (args.length != 1) { - sender.sendMessage(cmd.getUsage()); - return false; - } - - if (args[0].length() != 4 && args[0].length() != 1) { - sender.sendMessage(cmd.getUsage()); - return false; - } - if (args[0].length() == 1 && args[0].equalsIgnoreCase("0")) { sender.sendMessage("Casting circles on right click now disabled, set right click to a viable circle to enable"); String inputString = args[0]; diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 8972c42..b7837b7 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -75,8 +75,10 @@ public void onPlayerInteract(PlayerInteractEvent event) { } catch (IOException e1) { e1.printStackTrace(); } + + Material inHand = event.getPlayer().getItemInHand().getType(); - if (sacrificed) { + if (sacrificed && inHand == Material.FLINT) { event.getPlayer().sendMessage("You have sacrificed your alchemy abilities forever."); return; } @@ -92,7 +94,7 @@ public void onPlayerInteract(PlayerInteractEvent event) { actBlock = event.getClickedBlock(); } - if (event.getAction() == Action.RIGHT_CLICK_AIR && event.getPlayer().getItemInHand().getType() == Material.FLINT) { + if (event.getAction() == Action.RIGHT_CLICK_AIR && inHand == Material.FLINT) { actBlock = event.getPlayer().getTargetBlock(null, 120); } @@ -110,6 +112,9 @@ public static void isCircle(Player player, World world, Block actBlock) throws I if (actBlock.getType() == Material.REDSTONE_WIRE && player.getItemInHand().getAmount() == 0 && !GeometricMagic.checkSacrificed(player)) { // System.out.println("isCircle"); circleChooser(player, world, actBlock); + } else if (actBlock.getType() == Material.REDSTONE_WIRE && player.getItemInHand().getAmount() == 0 && GeometricMagic.checkSacrificed(player)) { + player.sendMessage("You have sacrificed your alchemy abilities forever."); + return; } boolean sacrifices = GeometricMagic.checkSacrifices(player); if (player.getItemInHand().getType() == Material.FLINT && sacrifices && !GeometricMagic.checkSacrificed(player)) { From 18243d45d993459ddb842307b13801688fb8b4ee Mon Sep 17 00:00:00 2001 From: ty2u Date: Wed, 11 Jul 2012 12:03:48 -0400 Subject: [PATCH 080/133] -More /setcircle fixes -Added bypass permission for crafting -Added bypass permission for human transmutation -Changed bypass permissions and added a bypass.* permission -Added some more helpful messages -Other minor tweaks and changes --- plugin.yml | 20 +++- .../GeometricMagic/GeometricMagic.java | 25 +++- .../GeometricMagicPlayerListener.java | 110 ++++++++++-------- 3 files changed, 97 insertions(+), 58 deletions(-) diff --git a/plugin.yml b/plugin.yml index da5be20..cbe40bf 100644 --- a/plugin.yml +++ b/plugin.yml @@ -119,10 +119,26 @@ permissions: description: Allows you to use set circle 0244 geometricmagic.set.0344: description: Allows you to use set circle 0344 - geometricmagic.bypasscooldown: + geometricmagic.bypass.*: + description: Grants all bypass permissions + default: false + children: + geometricmagic.bypass.cooldown: true + geometricmagic.bypass.crafting: true + geometricmagic.bypass.hunger: true + geometricmagic.bypass.sacrifice: true + geometricmagic.bypass.cooldown: description: Allows you to bypass transmutation and set circle cooldowns - geometricmagic.bypasshunger: + default: false + geometricmagic.bypass.crafting: + description: Allows you to bypass crafting being taken away by human transmutation + default: false + geometricmagic.bypass.hunger: description: Allows you to bypass hunger being taken away + default: false + geometricmagic.bypass.sacrifice: + description: Allows you to bypass human transmutation sacrificing your alchemy abilities forever + default: false commands: setcircle: description: This command sets a sacrifice's right-click circle. diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagic.java b/src/me/cakenggt/GeometricMagic/GeometricMagic.java index 7f1f4b8..72eded1 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagic.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagic.java @@ -59,10 +59,13 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, } boolean sacrificed = false; - try { - sacrificed = checkSacrificed(player); - } catch (IOException e1) { - e1.printStackTrace(); + + if (!player.hasPermission("geometricmagic.bypass.sacrifice")) { + try { + sacrificed = checkSacrificed(player); + } catch (IOException e1) { + e1.printStackTrace(); + } } if (sacrificed) { @@ -70,16 +73,26 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, return true; } + boolean sacrifices = false; + try { + sacrifices = checkSacrifices(player); + } catch (IOException e1) { + e1.printStackTrace(); + } + // check if player has flint and is using the proper arguments boolean hasFlint = player.getInventory().contains(Material.FLINT); - if ((args.length != 1 || (args[0].length() != 4 && args[0].length() != 1)) && hasFlint) { + if ((args.length != 1 || (args[0].length() != 4 && args[0].length() != 1)) && hasFlint && sacrifices) { sender.sendMessage(ChatColor.RED + cmd.getUsage()); return true; - } else if (args.length == 0 && !hasFlint) { + } else if (args.length == 0 && !hasFlint && sacrifices) { // they don't have flint so give them one ItemStack oneFlint = new ItemStack(318, 1); player.getWorld().dropItem(player.getLocation(), oneFlint); return true; + } else if (!sacrifices) { + player.sendMessage(ChatColor.RED + "You must perform a human sacrifice if you wish to use this command."); + return true; } if (args[0].length() == 1 && args[0].equalsIgnoreCase("0")) { diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index b7837b7..9b9b91b 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -67,38 +67,48 @@ public void onPlayerInteract(PlayerInteractEvent event) { return; } - boolean sacrifices = false; + Player player = event.getPlayer(); + boolean sacrificed = false; + + if (!player.hasPermission("geometricmagic.bypass.sacrifice")) { + try { + sacrificed = GeometricMagic.checkSacrificed(player); + } catch (IOException e1) { + e1.printStackTrace(); + } + } + + boolean sacrifices = false; try { - sacrifices = GeometricMagic.checkSacrifices(event.getPlayer()); - sacrificed = GeometricMagic.checkSacrificed(event.getPlayer()); + sacrifices = GeometricMagic.checkSacrifices(player); } catch (IOException e1) { e1.printStackTrace(); } - - Material inHand = event.getPlayer().getItemInHand().getType(); - - if (sacrificed && inHand == Material.FLINT) { - event.getPlayer().sendMessage("You have sacrificed your alchemy abilities forever."); - return; - } - Block actBlock = event.getPlayer().getLocation().getBlock(); + Block actBlock = player.getLocation().getBlock(); if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { - - if (event.getClickedBlock().getType() == Material.WORKBENCH && sacrifices) { + if (event.getClickedBlock().getType() == Material.WORKBENCH && (sacrifices && !sacrificed) && !player.hasPermission("geometricmagic.bypass.crafting")) { // cancel event instead of turning block into air + player.sendMessage("You have already sacrificed your crafting abilities. You must sacrifice your alchemy forever to get them back by performing another human transmutation."); event.setCancelled(true); } actBlock = event.getClickedBlock(); } - if (event.getAction() == Action.RIGHT_CLICK_AIR && inHand == Material.FLINT) { - actBlock = event.getPlayer().getTargetBlock(null, 120); + ItemStack inHand = event.getPlayer().getItemInHand(); + Material inHandType = inHand.getType(); + + if ((sacrificed && (inHandType == Material.FLINT || (actBlock.getType() == Material.REDSTONE_WIRE && inHand.getAmount() == 0))) && !player.hasPermission("geometricmagic.bypass.sacrifice")) { + player.sendMessage("You have sacrificed your alchemy abilities forever."); + return; + } + + if (event.getAction() == Action.RIGHT_CLICK_AIR && inHandType == Material.FLINT) { + actBlock = player.getTargetBlock(null, 120); } - Player player = event.getPlayer(); World world = player.getWorld(); try { isCircle(player, world, actBlock); @@ -109,18 +119,14 @@ public void onPlayerInteract(PlayerInteractEvent event) { public static void isCircle(Player player, World world, Block actBlock) throws IOException { // System.out.println("isCircle?"); - if (actBlock.getType() == Material.REDSTONE_WIRE && player.getItemInHand().getAmount() == 0 && !GeometricMagic.checkSacrificed(player)) { + if (actBlock.getType() == Material.REDSTONE_WIRE && player.getItemInHand().getAmount() == 0) { // System.out.println("isCircle"); circleChooser(player, world, actBlock); - } else if (actBlock.getType() == Material.REDSTONE_WIRE && player.getItemInHand().getAmount() == 0 && GeometricMagic.checkSacrificed(player)) { - player.sendMessage("You have sacrificed your alchemy abilities forever."); - return; } - boolean sacrifices = GeometricMagic.checkSacrifices(player); - if (player.getItemInHand().getType() == Material.FLINT && sacrifices && !GeometricMagic.checkSacrificed(player)) { + if (player.getItemInHand().getType() == Material.FLINT) { // set circle cool down - if (!player.hasPermission("geometricmagic.bypasscooldown")) { + if (!player.hasPermission("geometricmagic.bypass.cooldown")) { String coolDownConfig = plugin.getConfig().getString("setcircles.cooldown").toString(); int coolDown = Integer.parseInt(coolDownConfig); if (mapCoolDowns.containsKey(player.getName() + " set circle")) { @@ -135,16 +141,20 @@ public static void isCircle(Player player, World world, Block actBlock) throws I } File myFile = new File("plugins/GeometricMagic/sacrifices.txt"); - Scanner inputFile = new Scanner(myFile); String circle = "[0, 0, 0, 0]"; - while (inputFile.hasNextLine()) { - String name = inputFile.nextLine(); - if (name.equals(player.getName())) { - circle = inputFile.nextLine(); - } else - inputFile.nextLine(); + if (myFile.exists()) { + Scanner inputFile = new Scanner(myFile); + while (inputFile.hasNextLine()) { + String name = inputFile.nextLine(); + if (name.equals(player.getName())) { + circle = inputFile.nextLine(); + } else + inputFile.nextLine(); + } + inputFile.close(); + } else { + return; } - inputFile.close(); try { // exempt player from AntiCheat check @@ -233,7 +243,7 @@ public static void circleChooser(Player player, World world, Block actBlock) { // System.out.println("circleSize:" + circleSize); // transmute cool down - if (!player.hasPermission("geometricmagic.bypasscooldown")) { + if (!player.hasPermission("geometricmagic.bypass.cooldown")) { String coolDownConfig = plugin.getConfig().getString("transmutation.cooldown").toString(); int coolDown = Integer.parseInt(coolDownConfig); if (mapCoolDowns.containsKey(player.getName() + " transmute circle")) { @@ -275,7 +285,7 @@ public static void circleChooser(Player player, World world, Block actBlock) { if (player.hasPermission("geometricmagic.set")) { // set circle cool down - if (!player.hasPermission("geometricmagic.bypasscooldown")) { + if (!player.hasPermission("geometricmagic.bypass.cooldown")) { String coolDownConfig = plugin.getConfig().getString("setcircles.cooldown").toString(); int coolDown = Integer.parseInt(coolDownConfig); if (mapCoolDowns.containsKey(player.getName() + " set circle")) { @@ -830,7 +840,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, cost = 20; if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - if (!player.hasPermission("geometricmagic.bypasshunger")) { + if (!player.hasPermission("geometricmagic.bypass.hunger")) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); } ItemStack newItem = new ItemStack(itemCode, 1); @@ -859,7 +869,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, return; } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - if (!player.hasPermission("geometricmagic.bypasshunger")) { + if (!player.hasPermission("geometricmagic.bypass.hunger")) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); } ItemStack oneRedstone = new ItemStack(331, 1); @@ -936,7 +946,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { if (fires >= 64) { fires -= 64; - if (!player.hasPermission("geometricmagic.bypasshunger")) { + if (!player.hasPermission("geometricmagic.bypass.hunger")) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); } effectBlock.getWorld().dropItem(effectBlock.getLocation(), onePortal); @@ -958,7 +968,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, return; } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - if (!player.hasPermission("geometricmagic.bypasshunger")) { + if (!player.hasPermission("geometricmagic.bypass.hunger")) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); } player.sendMessage(ChatColor.GREEN + "The four elements, like man alone, are weak. But together they form the strong fifth element: boron -Brother Silence"); @@ -985,7 +995,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, } ItemStack oneRedstone = new ItemStack(331, 1); if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - if (!player.hasPermission("geometricmagic.bypasshunger")) { + if (!player.hasPermission("geometricmagic.bypass.hunger")) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); } Item redStack = effectBlock.getWorld().dropItem(effectBlock.getLocation(), oneRedstone); @@ -1047,7 +1057,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, cost = 20; if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - if (!player.hasPermission("geometricmagic.bypasshunger")) { + if (!player.hasPermission("geometricmagic.bypass.hunger")) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); } Location spawnLoc = effectBlock.getLocation(); @@ -1150,7 +1160,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, return; } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - if (!player.hasPermission("geometricmagic.bypasshunger")) { + if (!player.hasPermission("geometricmagic.bypass.hunger")) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); } @@ -1177,7 +1187,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, return; } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - if (!player.hasPermission("geometricmagic.bypasshunger")) { + if (!player.hasPermission("geometricmagic.bypass.hunger")) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); } @@ -1210,7 +1220,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, return; } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - if (!player.hasPermission("geometricmagic.bypasshunger")) { + if (!player.hasPermission("geometricmagic.bypass.hunger")) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); } @@ -1239,7 +1249,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, } if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { try { - if (!player.hasPermission("geometricmagic.bypasshunger")) { + if (!player.hasPermission("geometricmagic.bypass.hunger")) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); } humanTransmutation(player); @@ -1262,7 +1272,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - if (!player.hasPermission("geometricmagic.bypasshunger")) { + if (!player.hasPermission("geometricmagic.bypass.hunger")) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); } Location playerSpawn = player.getBedSpawnLocation(); @@ -1280,14 +1290,14 @@ public static void setCircleEffects(Player player, World world, Block actBlock, player.teleport(new Location(player.getWorld(), playerSpawn.getX(), playerSpawn.getY(), playerSpawn.getZ() - 1)); } else { player.sendMessage("Your bed is not safe to teleport to!"); - if (!player.hasPermission("geometricmagic.bypasshunger")) { + if (!player.hasPermission("geometricmagic.bypass.hunger")) { player.setFoodLevel((int) (player.getFoodLevel() + (cost * philosopherStoneModifier(player)))); } } } } else { player.sendMessage("You do not have a spawn set!"); - if (!player.hasPermission("geometricmagic.bypasshunger")) { + if (!player.hasPermission("geometricmagic.bypass.hunger")) { player.setFoodLevel((int) (player.getFoodLevel() + (cost * philosopherStoneModifier(player)))); } } @@ -1307,7 +1317,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - if (!player.hasPermission("geometricmagic.bypasshunger")) { + if (!player.hasPermission("geometricmagic.bypass.hunger")) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); } Location spawnLoc = effectBlock.getLocation(); @@ -1336,7 +1346,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - if (!player.hasPermission("geometricmagic.bypasshunger")) { + if (!player.hasPermission("geometricmagic.bypass.hunger")) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); } Location spawnLoc = effectBlock.getLocation(); @@ -1365,7 +1375,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - if (!player.hasPermission("geometricmagic.bypasshunger")) { + if (!player.hasPermission("geometricmagic.bypass.hunger")) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); } Location spawnLoc = effectBlock.getLocation(); @@ -1394,7 +1404,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } else if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { - if (!player.hasPermission("geometricmagic.bypasshunger")) { + if (!player.hasPermission("geometricmagic.bypass.hunger")) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); } Location spawnLoc = effectBlock.getLocation(); From 5977edf98d474b232c9d342e093da4dd2455798f Mon Sep 17 00:00:00 2001 From: ty2u Date: Tue, 17 Jul 2012 19:11:38 -0400 Subject: [PATCH 081/133] Add limit to number arrows to check --- config.yml | 3 +++ .../GeometricMagicPlayerListener.java | 15 ++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/config.yml b/config.yml index 76e1b8d..c979cb1 100644 --- a/config.yml +++ b/config.yml @@ -36,6 +36,9 @@ setcircles: # Limit augmentation size for set circles limitsize: 5 + # Limit number of nearby arrows to check + limitarrows: 3 + # Repair Circle 1133: [] # Conversion Circle diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 9b9b91b..c38e9b4 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -566,7 +566,11 @@ public static void microCircle(Player player, World world, Block actBlock) { } List entitiesList = player.getNearbyEntities(100, 10, 100); - for (int i = 0; i < entitiesList.size(); i++) { + String limitArrowsConfig = plugin.getConfig().getString("setcircles.limitarrows").toString(); + int limitArrows = Integer.parseInt(limitArrowsConfig); + int limit = (entitiesList.size() > limitArrows) ? limitArrows : entitiesList.size(); + + for (int i = 0; i < limit; i++) { if (entitiesList.get(i) instanceof Arrow) { Arrow shotArrow = (Arrow) entitiesList.get(i); if (shotArrow.getLocation().getBlock().getType() == Material.REDSTONE_WIRE) { @@ -675,8 +679,13 @@ public static void transmutationCircle(Player player, World world, Block actBloc public static void setCircleRemote(Player player, World world, Block actBlock) { Boolean remote = false; Block effectBlock = actBlock; + List entitiesList = player.getNearbyEntities(242, 20, 242); - for (int i = 0; i < entitiesList.size(); i++) { + String limitArrowsConfig = plugin.getConfig().getString("setcircles.limitarrows").toString(); + int limitArrows = Integer.parseInt(limitArrowsConfig); + int limit = (entitiesList.size() > limitArrows) ? limitArrows : entitiesList.size(); + + for (int i = 0; i < limit; i++) { if (entitiesList.get(i) instanceof Arrow) { Arrow shotArrow = (Arrow) entitiesList.get(i); if (shotArrow.getLocation().getBlock().getX() == actBlock.getLocation().getBlock().getX() && shotArrow.getLocation().getBlock().getZ() == actBlock.getLocation().getBlock().getZ()) { @@ -687,7 +696,7 @@ public static void setCircleRemote(Player player, World world, Block actBlock) { } if (remote) { - for (int i = 0; i < entitiesList.size(); i++) { + for (int i = 0; i < limit; i++) { if (entitiesList.get(i) instanceof Arrow) { Arrow shotArrow = (Arrow) entitiesList.get(i); effectBlock = shotArrow.getLocation().getBlock(); From a598a773fcf41aaa8a7dcd64a9750cc937f71c84 Mon Sep 17 00:00:00 2001 From: ty2u Date: Tue, 17 Jul 2012 19:16:46 -0400 Subject: [PATCH 082/133] Strike lightning still if any tools were repaired --- .../GeometricMagic/GeometricMagicPlayerListener.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index c38e9b4..14941b7 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -847,6 +847,8 @@ public static void setCircleEffects(Player player, World world, Block actBlock, // Make sure cost is not more than 20 if (cost > 20) cost = 20; + + int count = 0; if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { if (!player.hasPermission("geometricmagic.bypass.hunger")) { @@ -859,8 +861,11 @@ public static void setCircleEffects(Player player, World world, Block actBlock, droppedItem.remove(); effectBlock.getWorld().dropItem(effectBlock.getLocation(), newItem); + count++; } else { player.sendMessage("You feel so hungry..."); + if (count > 0) + effectBlock.getWorld().strikeLightningEffect(effectBlock.getLocation()); return; } } From b45309f12b31836cd9a05497517eacae0e220590 Mon Sep 17 00:00:00 2001 From: ty2u Date: Wed, 18 Jul 2012 06:16:48 -0400 Subject: [PATCH 083/133] Use fireballs for explosion circles so Towny can regen them --- .../GeometricMagicPlayerListener.java | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 14941b7..975108b 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -763,6 +763,7 @@ public static void setCircle(Player player, World world, Block actBlock, Block e } public static void setCircleEffects(Player player, World world, Block actBlock, Block effectBlock, String arrayString) throws IOException { + Location effectBlockLocation = effectBlock.getLocation(); int cost = 0; if (!hasLearnedCircle(player, arrayString)) { if (learnCircle(player, arrayString, actBlock)) { @@ -860,12 +861,12 @@ public static void setCircleEffects(Player player, World world, Block actBlock, newItem.addEnchantments(effects); droppedItem.remove(); - effectBlock.getWorld().dropItem(effectBlock.getLocation(), newItem); + effectBlock.getWorld().dropItem(effectBlockLocation, newItem); count++; } else { player.sendMessage("You feel so hungry..."); if (count > 0) - effectBlock.getWorld().strikeLightningEffect(effectBlock.getLocation()); + effectBlock.getWorld().strikeLightningEffect(effectBlockLocation); return; } } @@ -887,7 +888,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); } ItemStack oneRedstone = new ItemStack(331, 1); - Item redStack = effectBlock.getWorld().dropItem(effectBlock.getLocation(), oneRedstone); + Item redStack = effectBlock.getWorld().dropItem(effectBlockLocation, oneRedstone); List entityList = redStack.getNearbyEntities(5, 10, 5); for (int i = 0; i < entityList.size(); i++) { if (entityList.get(i) instanceof Item) { @@ -963,13 +964,13 @@ public static void setCircleEffects(Player player, World world, Block actBlock, if (!player.hasPermission("geometricmagic.bypass.hunger")) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); } - effectBlock.getWorld().dropItem(effectBlock.getLocation(), onePortal); + effectBlock.getWorld().dropItem(effectBlockLocation, onePortal); } } else { player.sendMessage("You feel so hungry..."); } ItemStack diamondStack = new ItemStack(264, fires); - effectBlock.getWorld().dropItem(effectBlock.getLocation(), diamondStack); + effectBlock.getWorld().dropItem(effectBlockLocation, diamondStack); } else if (arrayString.equals("[1, 2, 3, 4]") && player.hasPermission("geometricmagic.set.1234")) { String costConfig = plugin.getConfig().getString("setcircles.1234.cost").toString(); @@ -990,7 +991,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, int amount = Integer.parseInt(amountConfig); ItemStack oneRedstone = new ItemStack(331, amount); - effectBlock.getWorld().dropItem(effectBlock.getLocation(), oneRedstone); + effectBlock.getWorld().dropItem(effectBlockLocation, oneRedstone); } else { player.sendMessage("You feel so hungry..."); @@ -1012,7 +1013,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, if (!player.hasPermission("geometricmagic.bypass.hunger")) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); } - Item redStack = effectBlock.getWorld().dropItem(effectBlock.getLocation(), oneRedstone); + Item redStack = effectBlock.getWorld().dropItem(effectBlockLocation, oneRedstone); int size = setCircleSize(actBlock); List entityList = redStack.getNearbyEntities(size + 5, 128, size + 5); @@ -1074,7 +1075,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, if (!player.hasPermission("geometricmagic.bypass.hunger")) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); } - Location spawnLoc = effectBlock.getLocation(); + Location spawnLoc = effectBlockLocation; spawnLoc.add(0.5, 1, 0.5); effectBlock.getWorld().spawn(spawnLoc, Enderman.class); } else { @@ -1092,7 +1093,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, if (cost > 20) cost = 20; - Location actPoint = effectBlock.getLocation(); + Location actPoint = effectBlockLocation; int na = 0, nb = 0, ea = 0, eb = 0, sa = 0, sb = 0, wa = 0, wb = 0; Block curBlock = effectBlock.getRelative(0, 0, -1); while (curBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE) { @@ -1179,12 +1180,14 @@ public static void setCircleEffects(Player player, World world, Block actBlock, } // check if player has permission to break blocks here first - if (!checkBlockBreakSimulation(effectBlock.getLocation(), player)) { + if (!checkBlockBreakSimulation(effectBlockLocation, player)) { // player.sendMessage("You don't have permission to do that there."); return; } - effectBlock.getWorld().createExplosion(effectBlock.getLocation(), (4 + size)); + Fireball fireball = effectBlockLocation.getWorld().spawn(effectBlockLocation, Fireball.class); + fireball.setIsIncendiary(false); + fireball.setYield(4 + size); } else { player.sendMessage("You feel so hungry..."); return; @@ -1239,13 +1242,14 @@ public static void setCircleEffects(Player player, World world, Block actBlock, } // check if player has permission to break blocks here first - if (!checkBlockBreakSimulation(effectBlock.getLocation(), player)) { + if (!checkBlockBreakSimulation(effectBlockLocation, player)) { // player.sendMessage("You don't have permission to do that there."); return; } - effectBlock.getWorld().createExplosion(effectBlock.getLocation(), size, true); - + Fireball fireball = effectBlockLocation.getWorld().spawn(effectBlockLocation, Fireball.class); + fireball.setIsIncendiary(true); + fireball.setYield(4 + size); } else { player.sendMessage("You feel so hungry..."); return; @@ -1334,7 +1338,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, if (!player.hasPermission("geometricmagic.bypass.hunger")) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); } - Location spawnLoc = effectBlock.getLocation(); + Location spawnLoc = effectBlockLocation; // check if player has permission to break blocks here first if (!checkBlockBreakSimulation(spawnLoc, player)) { @@ -1363,7 +1367,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, if (!player.hasPermission("geometricmagic.bypass.hunger")) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); } - Location spawnLoc = effectBlock.getLocation(); + Location spawnLoc = effectBlockLocation; // check if player has permission to break blocks here first if (!checkBlockBreakSimulation(spawnLoc, player)) { @@ -1392,7 +1396,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, if (!player.hasPermission("geometricmagic.bypass.hunger")) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); } - Location spawnLoc = effectBlock.getLocation(); + Location spawnLoc = effectBlockLocation; // check if player has permission to break blocks here first if (!checkBlockBreakSimulation(spawnLoc, player)) { @@ -1421,7 +1425,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, if (!player.hasPermission("geometricmagic.bypass.hunger")) { player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); } - Location spawnLoc = effectBlock.getLocation(); + Location spawnLoc = effectBlockLocation; // check if player has permission to break blocks here first if (!checkBlockBreakSimulation(spawnLoc, player)) { @@ -1438,7 +1442,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, } else { player.sendMessage("You do not have permission to use " + arrayString + " or set circle does not exist"); } - effectBlock.getWorld().strikeLightningEffect(effectBlock.getLocation()); + effectBlock.getWorld().strikeLightningEffect(effectBlockLocation); } public static int setCircleSize(Block actBlock) { From 9992eb2959891eb3f6c65193e67bbc98fb7ad4bd Mon Sep 17 00:00:00 2001 From: ty2u Date: Wed, 18 Jul 2012 06:35:39 -0400 Subject: [PATCH 084/133] Move init variable to proper spot --- .../cakenggt/GeometricMagic/GeometricMagicPlayerListener.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 975108b..14dc4b1 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -779,6 +779,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, return; } + int count = 0; List repairEntities = player.getNearbyEntities(9, 10, 9); for (int i = 0; i < repairEntities.size(); i++) { if (repairEntities.get(i) instanceof Item) { @@ -848,8 +849,6 @@ public static void setCircleEffects(Player player, World world, Block actBlock, // Make sure cost is not more than 20 if (cost > 20) cost = 20; - - int count = 0; if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { if (!player.hasPermission("geometricmagic.bypass.hunger")) { From 9f3114c5f1a189f75f154da918912bde13b4dd3e Mon Sep 17 00:00:00 2001 From: ty2u Date: Wed, 18 Jul 2012 07:05:13 -0400 Subject: [PATCH 085/133] Remove unnecessary checkBlockBreakSimulation --- .../GeometricMagic/GeometricMagicPlayerListener.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 14dc4b1..54f4c41 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -1019,16 +1019,10 @@ public static void setCircleEffects(Player player, World world, Block actBlock, for (int i = 0; i < entityList.size(); i++) { if (entityList.get(i) instanceof Player) { HumanEntity victim = (HumanEntity) entityList.get(i); - - // check if player has permission to break blocks here - // first - if (!checkBlockBreakSimulation(victim.getLocation(), player)) { - // player.sendMessage("You don't have permission to do that there."); - return; - } + Location victimLocation = victim.getLocation(); if (!victim.equals(player)) { - victim.getWorld().strikeLightningEffect(victim.getLocation()); + victim.getWorld().strikeLightningEffect(victimLocation); if (victim.getInventory().contains(Material.FIRE)) { for (int k = 0; k < player.getInventory().getSize(); k++) { if (player.getInventory().getItem(i).getType() == Material.FIRE) { From 4991a8259420f5afad724a3c72555e52de701b62 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sat, 4 Aug 2012 18:14:07 -0400 Subject: [PATCH 086/133] Support for customisable data values in transmutation part 2 (code) --- .../GeometricMagicPlayerListener.java | 51 ++++++++++--------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index abfacf5..4b4ae35 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -595,6 +595,7 @@ public static void transmutationCircle(Player player, World world, Block actBloc Location circleEnd = actBlock.getLocation(); Material fromType = actBlock.getType(); Material toType = actBlock.getType(); + byte fromData = actBlock.getData(); boolean lightning = false; if (actBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE) { halfWidth = 0; @@ -620,7 +621,7 @@ public static void transmutationCircle(Player player, World world, Block actBloc // System.out.println(circleStart); circleEnd = actBlock.getLocation().add(fullWidth - 2, fullWidth - 3, halfWidth - 2); // System.out.println(circleEnd); - alchemyCheck(fromType, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); + alchemyCheck(fromType, fromData, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); lightning = true; } else if (actBlock.getRelative(-1 * (fullWidth - 1), 0, 0).getType() == Material.REDSTONE_WIRE) { // west @@ -633,7 +634,7 @@ public static void transmutationCircle(Player player, World world, Block actBloc endLoc = actBlock.getLocation().add(-1 * (fullWidth + dimensionOfEffect) + 1, dimensionOfEffect - 1, -1 * dimensionOfEffect / 2 + 1); circleStart = actBlock.getLocation().add(-1, 0, (halfWidth - 2)); circleEnd = actBlock.getLocation().add(-1 * (fullWidth - 2), fullWidth - 3, -1 * (halfWidth - 2)); - alchemyCheck(fromType, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); + alchemyCheck(fromType, fromData, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); lightning = true; } } else if (actBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE) { @@ -659,7 +660,7 @@ public static void transmutationCircle(Player player, World world, Block actBloc endLoc = actBlock.getLocation().add(dimensionOfEffect / 2 - 1, dimensionOfEffect - 1, -1 * (dimensionOfEffect + fullWidth) + 1); circleStart = actBlock.getLocation().add(-1 * (halfWidth - 2), 0, -1); circleEnd = actBlock.getLocation().add((halfWidth - 2), fullWidth - 3, -1 * (fullWidth - 2)); - alchemyCheck(fromType, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); + alchemyCheck(fromType, fromData, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); lightning = true; } else if (actBlock.getRelative(0, 0, (fullWidth - 1)).getType() == Material.REDSTONE_WIRE) { // south @@ -672,7 +673,7 @@ public static void transmutationCircle(Player player, World world, Block actBloc endLoc = actBlock.getLocation().add(-1 * dimensionOfEffect / 2 + 1, dimensionOfEffect - 1, fullWidth + dimensionOfEffect - 1); circleStart = actBlock.getLocation().add(halfWidth - 2, 0, 1); circleEnd = actBlock.getLocation().add(-1 * (halfWidth - 2), fullWidth - 3, (fullWidth - 2)); - alchemyCheck(fromType, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); + alchemyCheck(fromType, fromData, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); lightning = true; } } @@ -909,7 +910,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, return; } - int valueArray = getBlockValue(plugin, droppedItem.getItemStack().getTypeId()); + int valueArray = getBlockValue(plugin, droppedItem.getItemStack().getTypeId(), droppedItem.getItemStack().getData().getData()); int pay = (valueArray * droppedItem.getItemStack().getAmount()); @@ -1218,7 +1219,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, String configSize = plugin.getConfig().getString("setcircles.3334.size").toString(); Integer circleSize = Integer.parseInt(configSize); - alchemyFiller(Material.AIR, Material.FIRE, (byte) 0, effectBlock.getRelative((circleSize / 2) * -1, 0, (circleSize / 2) * -1).getLocation(), + alchemyFiller(Material.AIR, (byte) 0, Material.FIRE, (byte) 0, effectBlock.getRelative((circleSize / 2) * -1, 0, (circleSize / 2) * -1).getLocation(), effectBlock.getRelative(circleSize / 2, circleSize, circleSize / 2).getLocation(), player, false); } else { @@ -1525,7 +1526,7 @@ public static int setCircleSize(Block actBlock) { return size; } - public static void alchemyCheck(Material a, Material b, byte toData, Location circleStart, Location circleEnd, Location start, Location end, Player player, int width) { + public static void alchemyCheck(Material a, byte fromData, Material b, byte toData, Location circleStart, Location circleEnd, Location start, Location end, Player player, int width) { Block startBlock = circleStart.getBlock(); int xIteration = 0; int yIteration = 0; @@ -1538,7 +1539,7 @@ public static void alchemyCheck(Material a, Material b, byte toData, Location ci while (startBlock.getX() <= circleEnd.getX()) { while (startBlock.getZ() <= circleEnd.getZ()) { if (startBlock.getType() != Material.AIR) { - alchemyFiller(a, b, toData, start.getBlock().getRelative(xIteration * width, yIteration * width, zIteration * width).getLocation(), + alchemyFiller(a, fromData, b, toData, start.getBlock().getRelative(xIteration * width, yIteration * width, zIteration * width).getLocation(), start.getBlock().getRelative(xIteration * width + width - 1, yIteration * width + width - 1, (zIteration * width + (width - 1))).getLocation(), player, true); } zIteration++; @@ -1559,7 +1560,7 @@ public static void alchemyCheck(Material a, Material b, byte toData, Location ci while (startBlock.getZ() >= circleEnd.getZ()) { while (startBlock.getX() <= circleEnd.getX()) { if (startBlock.getType() != Material.AIR) { - alchemyFiller(a, b, toData, start.getBlock().getRelative(xIteration * width, yIteration * width, zIteration * width).getLocation(), + alchemyFiller(a, fromData, b, toData, start.getBlock().getRelative(xIteration * width, yIteration * width, zIteration * width).getLocation(), start.getBlock().getRelative(xIteration * width + width - 1, yIteration * width + width - 1, (zIteration * width - (width - 1))).getLocation(), player, true); } xIteration++; @@ -1585,7 +1586,7 @@ public static void alchemyCheck(Material a, Material b, byte toData, Location ci while (startBlock.getX() >= circleEnd.getX()) { while (startBlock.getZ() >= circleEnd.getZ()) { if (startBlock.getType() != Material.AIR) { - alchemyFiller(a, b, toData, start.getBlock().getRelative(xIteration * width, yIteration * width, zIteration * width).getLocation(), + alchemyFiller(a, fromData, b, toData, start.getBlock().getRelative(xIteration * width, yIteration * width, zIteration * width).getLocation(), start.getBlock().getRelative(xIteration * width - (width - 1), yIteration * width + width - 1, (zIteration * width - (width - 1))).getLocation(), player, true); } zIteration--; @@ -1606,7 +1607,7 @@ public static void alchemyCheck(Material a, Material b, byte toData, Location ci while (startBlock.getZ() <= circleEnd.getZ()) { while (startBlock.getX() >= circleEnd.getX()) { if (startBlock.getType() != Material.AIR) { - alchemyFiller(a, b, toData, start.getBlock().getRelative(xIteration * width, yIteration * width, zIteration * width).getLocation(), + alchemyFiller(a, fromData, b, toData, start.getBlock().getRelative(xIteration * width, yIteration * width, zIteration * width).getLocation(), start.getBlock().getRelative(xIteration * width - (width - 1), yIteration * width + width - 1, (zIteration * width + (width - 1))).getLocation(), player, true); } xIteration--; @@ -1628,7 +1629,7 @@ public static void alchemyCheck(Material a, Material b, byte toData, Location ci return; } - public static void alchemyFiller(Material a, Material b, byte toData, Location start, Location end, Player player, boolean charge) { + public static void alchemyFiller(Material a, byte fromData, Material b, byte toData, Location start, Location end, Player player, boolean charge) { // System.out.println("alchemyFiller"); Block startBlock = start.getBlock(); int xIteration = 0; @@ -1642,7 +1643,7 @@ public static void alchemyFiller(Material a, Material b, byte toData, Location s while (startBlock.getY() <= end.getY()) { while (startBlock.getX() <= end.getX()) { while (startBlock.getZ() <= end.getZ()) { - transmuteBlock(a, b, toData, startBlock, player, charge); + transmuteBlock(a, fromData, b, toData, startBlock, player, charge); startBlock = startBlock.getRelative(0, 0, 1); } xIteration++; @@ -1658,7 +1659,7 @@ public static void alchemyFiller(Material a, Material b, byte toData, Location s while (startBlock.getY() <= end.getY()) { while (startBlock.getZ() >= end.getZ()) { while (startBlock.getX() <= end.getX()) { - transmuteBlock(a, b, toData, startBlock, player, charge); + transmuteBlock(a, fromData, b, toData, startBlock, player, charge); startBlock = startBlock.getRelative(1, 0, 0); } zIteration--; @@ -1676,7 +1677,7 @@ public static void alchemyFiller(Material a, Material b, byte toData, Location s while (startBlock.getY() <= end.getY()) { while (startBlock.getX() >= end.getX()) { while (startBlock.getZ() >= end.getZ()) { - transmuteBlock(a, b, toData, startBlock, player, charge); + transmuteBlock(a, fromData, b, toData, startBlock, player, charge); startBlock = startBlock.getRelative(0, 0, -1); } xIteration--; @@ -1692,7 +1693,7 @@ public static void alchemyFiller(Material a, Material b, byte toData, Location s while (startBlock.getY() <= end.getY()) { while (startBlock.getZ() <= end.getZ()) { while (startBlock.getX() >= end.getX()) { - transmuteBlock(a, b, toData, startBlock, player, charge); + transmuteBlock(a, fromData, b, toData, startBlock, player, charge); startBlock = startBlock.getRelative(-1, 0, 0); // System.out.println("xloopfiller"); } @@ -1727,11 +1728,11 @@ public static double getBalance(Player player) { return 0; } - public static void transmuteBlock(Material a, Material b, byte toData, Block startBlock, Player player, boolean charge) { + public static void transmuteBlock(Material a, byte fromData, Material b, byte toData, Block startBlock, Player player, boolean charge) { - double pay = calculatePay(a, b, player); + double pay = calculatePay(a, fromData, b, toData, player); - if (startBlock.getType() == a) { + if (startBlock.getType() == a && startBlock.getData() == toData) { if (-1 * getBalance(player) < pay || !charge) { @@ -1770,7 +1771,7 @@ else if (a == Material.AIR && b != Material.AIR && b != Material.MOB_SPAWNER && Location blockLocation = startBlock.getLocation(); int blockID = b.getId(); - byte blockData = 0; + byte blockData = toData; if (checkBlockPlaceSimulation(blockLocation, blockID, blockData, blockLocation, player)) { // Change block @@ -1802,7 +1803,7 @@ else if (a != Material.AIR && b != Material.AIR && a != Material.CHEST && a != M Location blockLocation = startBlock.getLocation(); int blockID = b.getId(); - byte blockData = 0; + byte blockData = toData; if (checkBlockBreakSimulation(blockLocation, player) && checkBlockPlaceSimulation(blockLocation, blockID, blockData, blockLocation, player)) { // Change block @@ -1840,8 +1841,8 @@ else if ((a != Material.AIR && b != Material.AIR) || a == Material.MOB_SPAWNER | return; } - public static double calculatePay(Material a, Material b, Player player) { - double pay = (getBlockValue(plugin, a.getId()) - getBlockValue(plugin, b.getId())); + public static double calculatePay(Material a, byte fromData , Material b, byte toData , Player player) { + double pay = (getBlockValue(plugin, a.getId(), (int) fromData) - getBlockValue(plugin, b.getId(), (int) toData)); // Apply Philosopher's Stone to transmutes config variable String stoneConfig = plugin.getConfig().getString("transmutation.stone"); @@ -1946,8 +1947,8 @@ public static String getTransmutationCostSystem(GeometricMagic plugin) { return plugin.getConfig().getString("transmutation.cost").toString(); } - public static Integer getBlockValue(GeometricMagic plugin, int i) { - return plugin.getConfig().getInt("values." + i); + public static Integer getBlockValue(GeometricMagic plugin, int ID, int Data) { + return plugin.getConfig().getInt("values." + ID + "." + Data); } // Lyneira's Code Start From fffa759a7dc0f953e586ca27a4e8015211adca85 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sat, 4 Aug 2012 18:14:59 -0400 Subject: [PATCH 087/133] v2.6.2 --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index bede8ea..cd15749 100644 --- a/plugin.yml +++ b/plugin.yml @@ -18,7 +18,7 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.6.1 +version: 2.6.2 author: cakenggt, Hoot215 softdepend: [Vault,AntiCheat] permissions: From 1a2b3f9494bffae69cb24db64129ae73c9f836ca Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sat, 4 Aug 2012 18:22:49 -0400 Subject: [PATCH 088/133] Missed a spot --- config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.yml b/config.yml index d80799b..1f5c54a 100644 --- a/config.yml +++ b/config.yml @@ -121,7 +121,7 @@ philosopherstone: # VALUES SECTION (Values of blocks for transmutation) values: # AIR - 0: 0 + 0: 0: 0 # STONE 1: From ac018cca854cc3300b94ed50f6e18e92e59683a4 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sat, 4 Aug 2012 18:25:04 -0400 Subject: [PATCH 089/133] And another one --- config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.yml b/config.yml index 1f5c54a..6b831e8 100644 --- a/config.yml +++ b/config.yml @@ -172,7 +172,7 @@ values: 5: 0 6: 0 7: 0 - 8:0 + 8: 0 # LAVA 10: 0: 64 From 5aa6f17037cdaec0619a4111415025ee63c9d033 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sat, 4 Aug 2012 19:12:33 -0400 Subject: [PATCH 090/133] Fixed using wrong block A data --- .../GeometricMagicPlayerListener.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 4b4ae35..e5065ea 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -595,7 +595,6 @@ public static void transmutationCircle(Player player, World world, Block actBloc Location circleEnd = actBlock.getLocation(); Material fromType = actBlock.getType(); Material toType = actBlock.getType(); - byte fromData = actBlock.getData(); boolean lightning = false; if (actBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE) { halfWidth = 0; @@ -609,9 +608,11 @@ public static void transmutationCircle(Player player, World world, Block actBloc int dimensionOfEffect = (fullWidth - 2) * (fullWidth - 2); if (actBlock.getRelative((fullWidth - 1), 0, 0).getType() == Material.REDSTONE_WIRE) { // east - fromType = actBlock.getLocation().add(halfWidth - 1, 0, -1 * (halfWidth + 1)).getBlock().getType(); + Block fromBlock = actBlock.getLocation().add(halfWidth - 1, 0, -1 * (halfWidth + 1)).getBlock(); Block toBlock = actBlock.getLocation().add(halfWidth - 1, 0, halfWidth + 1).getBlock(); + fromType = fromBlock.getType(); toType = toBlock.getType(); + byte fromData = fromBlock.getData(); byte toData = toBlock.getData(); startLoc = actBlock.getLocation().add(fullWidth, 0, -1 * dimensionOfEffect / 2); // System.out.println(startLoc); @@ -626,9 +627,11 @@ public static void transmutationCircle(Player player, World world, Block actBloc } else if (actBlock.getRelative(-1 * (fullWidth - 1), 0, 0).getType() == Material.REDSTONE_WIRE) { // west // System.out.println("transmutationCircle west"); - fromType = actBlock.getLocation().add(-1 * (halfWidth - 1), 0, halfWidth + 1).getBlock().getType(); + Block fromBlock = actBlock.getLocation().add(-1 * (halfWidth - 1), 0, halfWidth + 1).getBlock(); Block toBlock = actBlock.getLocation().add((-1) * (halfWidth - 1), 0, (-1) * (halfWidth + 1)).getBlock(); + fromType = fromBlock.getType(); toType = toBlock.getType(); + byte fromData = fromBlock.getData(); byte toData = toBlock.getData(); startLoc = actBlock.getLocation().add(-1 * fullWidth, 0, dimensionOfEffect / 2); endLoc = actBlock.getLocation().add(-1 * (fullWidth + dimensionOfEffect) + 1, dimensionOfEffect - 1, -1 * dimensionOfEffect / 2 + 1); @@ -652,9 +655,11 @@ public static void transmutationCircle(Player player, World world, Block actBloc if (actBlock.getRelative(0, 0, -1 * (fullWidth - 1)).getType() == Material.REDSTONE_WIRE) { // north // System.out.println("transmutationCircle north"); - fromType = actBlock.getLocation().add(-1 * (halfWidth + 1), 0, -1 * (halfWidth - 1)).getBlock().getType(); + Block fromBlock = actBlock.getLocation().add(-1 * (halfWidth + 1), 0, -1 * (halfWidth - 1)).getBlock(); Block toBlock = actBlock.getLocation().add(halfWidth + 1, 0, -1 * (halfWidth - 1)).getBlock(); + fromType = fromBlock.getType(); toType = toBlock.getType(); + byte fromData = fromBlock.getData(); byte toData = toBlock.getData(); startLoc = actBlock.getLocation().add(-1 * dimensionOfEffect / 2, 0, -1 * fullWidth); endLoc = actBlock.getLocation().add(dimensionOfEffect / 2 - 1, dimensionOfEffect - 1, -1 * (dimensionOfEffect + fullWidth) + 1); @@ -665,9 +670,11 @@ public static void transmutationCircle(Player player, World world, Block actBloc } else if (actBlock.getRelative(0, 0, (fullWidth - 1)).getType() == Material.REDSTONE_WIRE) { // south // System.out.println("transmutationCircle south"); - fromType = actBlock.getLocation().add(halfWidth + 1, 0, halfWidth - 1).getBlock().getType(); + Block fromBlock = actBlock.getLocation().add(halfWidth + 1, 0, halfWidth - 1).getBlock(); Block toBlock = actBlock.getLocation().add(-1 * (halfWidth + 1), 0, halfWidth - 1).getBlock(); + fromType = fromBlock.getType(); toType = toBlock.getType(); + byte fromData = fromBlock.getData(); byte toData = toBlock.getData(); startLoc = actBlock.getLocation().add(dimensionOfEffect / 2, 0, fullWidth); endLoc = actBlock.getLocation().add(-1 * dimensionOfEffect / 2 + 1, dimensionOfEffect - 1, fullWidth + dimensionOfEffect - 1); From a24d1b964967c218d6253d8ea7b10549181c8e29 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sat, 4 Aug 2012 19:13:30 -0400 Subject: [PATCH 091/133] v2.6.3 --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index cd15749..51a5c90 100644 --- a/plugin.yml +++ b/plugin.yml @@ -18,7 +18,7 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.6.2 +version: 2.6.3 author: cakenggt, Hoot215 softdepend: [Vault,AntiCheat] permissions: From 984e8a179921fe831502301c7649e990494c4a92 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sat, 4 Aug 2012 19:20:46 -0400 Subject: [PATCH 092/133] Fixed comparing wrong data --- .../cakenggt/GeometricMagic/GeometricMagicPlayerListener.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index e5065ea..6c4fc0c 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -1739,7 +1739,7 @@ public static void transmuteBlock(Material a, byte fromData, Material b, byte to double pay = calculatePay(a, fromData, b, toData, player); - if (startBlock.getType() == a && startBlock.getData() == toData) { + if (startBlock.getType() == a && startBlock.getData() == fromData) { if (-1 * getBalance(player) < pay || !charge) { @@ -1845,6 +1845,7 @@ else if ((a != Material.AIR && b != Material.AIR) || a == Material.MOB_SPAWNER | } else return; } else + // System.out.println("[GeometricMagic] DEBUG - Block Data: " + (int) startBlock.getData() + ", A Data: " + (int) fromData + ", B Data: " + (int) toData); return; } From df46719b8e51f35ba7d6c4273b396361dbfc76ad Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sat, 4 Aug 2012 19:21:05 -0400 Subject: [PATCH 093/133] v2.6.4 --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index 51a5c90..e7ea7db 100644 --- a/plugin.yml +++ b/plugin.yml @@ -18,7 +18,7 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.6.3 +version: 2.6.4 author: cakenggt, Hoot215 softdepend: [Vault,AntiCheat] permissions: From e2dae0b8c387d004b0ee569eacde0261c401fa01 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sun, 5 Aug 2012 01:22:11 -0400 Subject: [PATCH 094/133] Proper block blacklisting --- .config.yml.kate-swp | Bin 0 -> 6094 bytes config.yml | 3 + .../GeometricMagicPlayerListener.java | 178 +++++++++++------- 3 files changed, 114 insertions(+), 67 deletions(-) create mode 100644 .config.yml.kate-swp diff --git a/.config.yml.kate-swp b/.config.yml.kate-swp new file mode 100644 index 0000000000000000000000000000000000000000..f1074a295a7787c1ee047b6049ade02eb8a7498d GIT binary patch literal 6094 zcmbuDX^)jf5QXQ$05gCrE`W-76(W~^H$wH_a;PyN;>q@)m`0PUGKRQ#>U20zH<2DOn>^);j{f0Pn?|TPxarNIe+2A znbZ9Z>()=dJT^A=VKl7w#=Zgf;8z>Zg7-9@4e#AIy+8hCJv`o!>9ZRWZC1mev0jTM zJknTupKPqX4>#7{M;nh5?!CryU|T;IKGFR1;0ui>;ERnX;hp=Y55>RSZGPwaD7x6J ze!siQV1OhRjQ7L3wG55pyBrNm-@)jf@1~rK?$WONadhW(-3Oz)pzGch-9_DYSE6fa z1})8?r5VH`%{!ZlV))nH)@5 z-J-|Ds)=$B5RlsS1w?E>sjltzV$pitZzNv5}u4!f)CGU zqfeq?Cg==F(68YLGYz^1M(d>p!LC8DYY^-j1iJ>oI#<>J>>32S2EndDuxk+P8U(ur z!LC8DYY^-j1iJ>ou0gOgC~E?i24xMx(x7-JUcGolL#8ipNVH{L!7|we4t9ZqUEp9B zIM@Xac7cOk;9wUxSORypoo7{ym7w64z-7_F{b(g9umsMMBZ12g7QX~81r1&ktpov< zz~x5(OW;z_Uy0a4Bfam%!QiC2%Pi_$6>DXs`s% z{3USp`0&Q|+DzZjva8j08m+cy8)JG&z_sX09xeNlN6W6{(QYewOgUt|i zl1Ga#c{IP|(Xu0XwAYY4rW_J~7n1X7G|Xg$A<0Ts8Z24Kmxd)Pc@|i*k}nOrtiY0$ z{QLGsa>uI-6p*tO4E@nK81xwv`m0iZSR(e+%|iSX3}%ALD=x;z^I^7@6EMteCc3%+ zxorHITweR3z)Py;bU!k@=n`V{l-NjYhAlQ|u|bOsT5Mi#DY17&!$x8=Y_UO$4O(o_ zVm}`^N$fq*u*?@X9t<4>x_j^SuT#{yL5@^G$>J4&Vqg-&-KQ zw{e7-?+A$RD2_1m9Ru+l#}Q_}lOVoRIKs?#4#amJN0|9O0P$VI5oW&2AigU&!qP_` zKaXbb1KRt5_C8>~58(=XQ=K~1?9yhKV7)EP&tARF-FxAmAkY`lFnv)|scj5u^|r3Y zi=*Ugjoe!sEBK}^IMWsUOCpC21!vG#!&<%le;sXf?~v(35$P894$Wuv*U@zHZ=!<@ zot#0PJbw~ko!nS57ilBfSJ4!Wu-H&E20ah3KM~Qj`rGJWL#r9o>e!1nf$J>n{aG~q z1<6ZeS$MZqJeegzs;Egeb}O+nXT;LEceK~P?buNp`y(!~$x)VVVK1NOyKpJN-$w@< zN-%>;@cJ&na2=H3#rdmH({r!FUR;Zm*X&+I<9T51{X=xHp}iT@-nkmq-tjfF8rJF` zqk|2tX3$r|TAla)DOjcPb969!K8BE)(iIpLDqVpUJ9PzC>?{qf=fc;cVYd=HOJfi_ zOXH?u=W8*y&dqBT=YK3I6jQp_Dg4h{r$jM--VJVfJ$#-)xK2__>UDTa{EGEUbTG>p zLmmrOtjrLsSaEA^S)4^!$m5N;3yBsv;b4Q{`6Dn`ZJX(-vxM=h2!D+ZW(Q};4-R`0 zU>!VT!-^eDQuH8|tzeIR(~p(q{#z{9Ie#Zm*wDwqpiUCMU2F*JB>6)LYxN(|!G=~d z=&NC^j=f27afk%L3wt3@T=UOp3jSAgu%X}#DtM{@tl;?ouvY&a9c*YdgT5Np>eLWe RtN)1(Hnf^SUk&HQ{spi8k#zt7 literal 0 HcmV?d00001 diff --git a/config.yml b/config.yml index 6b831e8..50a41b0 100644 --- a/config.yml +++ b/config.yml @@ -118,6 +118,9 @@ philosopherstone: # Formula: 1 / (2 to the power of (number of philosopher's stones in inventory) * modifier) modifier: 1 +# BLACKLIST SECTION + + # VALUES SECTION (Values of blocks for transmutation) values: # AIR diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 6c4fc0c..075a3c6 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -1744,96 +1744,120 @@ public static void transmuteBlock(Material a, byte fromData, Material b, byte to if (-1 * getBalance(player) < pay || !charge) { // Block break - if (a != Material.AIR && b == Material.AIR && a != Material.CHEST && a != Material.WALL_SIGN && a != Material.SIGN_POST && a != Material.FURNACE && a != Material.BURNING_FURNACE - && a != Material.BREWING_STAND && a != Material.WOODEN_DOOR && a != Material.IRON_DOOR_BLOCK && a != Material.MOB_SPAWNER && a != Material.SPONGE && a != Material.WATER && a != Material.LAVA && a != Material.BEDROCK && a != Material.PISTON_EXTENSION && a != Material.PISTON_MOVING_PIECE && a != Material.PORTAL && a != Material.LOCKED_CHEST && a != Material.MONSTER_EGG) { - - Location blockLocation = startBlock.getLocation(); + if (a != Material.AIR && b == Material.AIR) { + + if (!checkBreakBlacklist(a.getId())) { + + Location blockLocation = startBlock.getLocation(); - if (checkBlockBreakSimulation(blockLocation, player)) { - // Change block - startBlock.setType(b); - if (toData != 0) - startBlock.setData(toData); + if (checkBlockBreakSimulation(blockLocation, player)) { + // Change block + startBlock.setType(b); + if (toData != 0) + startBlock.setData(toData); - if (charge) { - if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { + if (charge) { + if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { - Economy econ = GeometricMagic.getEconomy(); + Economy econ = GeometricMagic.getEconomy(); - // Deposit or withdraw to players Vault account - if (pay > 0) { - econ.depositPlayer(player.getName(), pay); - } else if (pay < 0) { - econ.withdrawPlayer(player.getName(), pay * -1); + // Deposit or withdraw to players Vault account + if (pay > 0) { + econ.depositPlayer(player.getName(), pay); + } else if (pay < 0) { + econ.withdrawPlayer(player.getName(), pay * -1); + } + } else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + player.setLevel((int) (player.getLevel() + pay)); } - } else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { - player.setLevel((int) (player.getLevel() + pay)); } } } + + else { + player.sendMessage(ChatColor.RED + "[GeometricMagic] That block is blacklisted"); + return; + } + } // Block place - else if (a == Material.AIR && b != Material.AIR && b != Material.MOB_SPAWNER && b != Material.SPONGE && b != Material.WATER && b != Material.LAVA && b != Material.BEDROCK && b != Material.PISTON_EXTENSION && b != Material.PISTON_MOVING_PIECE && b != Material.PORTAL && b != Material.LOCKED_CHEST && b != Material.MONSTER_EGG) { - - Location blockLocation = startBlock.getLocation(); - int blockID = b.getId(); - byte blockData = toData; - - if (checkBlockPlaceSimulation(blockLocation, blockID, blockData, blockLocation, player)) { - // Change block - startBlock.setType(b); - if (toData != 0) - startBlock.setData(toData); - - if (charge) { - if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { - - Economy econ = GeometricMagic.getEconomy(); - - // Deposit or withdraw to players Vault account - if (pay > 0) { - econ.depositPlayer(player.getName(), pay); - } else if (pay < 0) { - econ.withdrawPlayer(player.getName(), pay * -1); + else if (a == Material.AIR && b != Material.AIR) { + + if (!checkPlaceBlacklist(b.getId())) { + + Location blockLocation = startBlock.getLocation(); + int blockID = b.getId(); + byte blockData = toData; + + if (checkBlockPlaceSimulation(blockLocation, blockID, blockData, blockLocation, player)) { + // Change block + startBlock.setType(b); + if (toData != 0) + startBlock.setData(toData); + + if (charge) { + if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { + + Economy econ = GeometricMagic.getEconomy(); + + // Deposit or withdraw to players Vault account + if (pay > 0) { + econ.depositPlayer(player.getName(), pay); + } else if (pay < 0) { + econ.withdrawPlayer(player.getName(), pay * -1); + } + } else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + player.setLevel((int) (player.getLevel() + pay)); } - } else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { - player.setLevel((int) (player.getLevel() + pay)); } } } + + else { + player.sendMessage(ChatColor.RED + "[GeometricMagic] That block is blacklisted"); + return; + } } // Block break and place - else if (a != Material.AIR && b != Material.AIR && a != Material.CHEST && a != Material.WALL_SIGN && a != Material.SIGN_POST && a != Material.FURNACE && a != Material.BURNING_FURNACE - && a != Material.BREWING_STAND && a != Material.WOODEN_DOOR && a != Material.MOB_SPAWNER && b != Material.MOB_SPAWNER && a != Material.IRON_DOOR_BLOCK && a != Material.SPONGE && b != Material.SPONGE && a != Material.WATER && b != Material.LAVA && a != Material.BEDROCK && b != Material.BEDROCK && a != Material.PISTON_EXTENSION && b != Material.PISTON_EXTENSION && a != Material.PISTON_MOVING_PIECE && b != Material.PISTON_MOVING_PIECE && a != Material.PORTAL && b != Material.PORTAL && a != Material.LOCKED_CHEST && b != Material.LOCKED_CHEST && a != Material.MONSTER_EGG && b != Material.MONSTER_EGG) { - - Location blockLocation = startBlock.getLocation(); - int blockID = b.getId(); - byte blockData = toData; + else if (a != Material.AIR && b != Material.AIR) { - if (checkBlockBreakSimulation(blockLocation, player) && checkBlockPlaceSimulation(blockLocation, blockID, blockData, blockLocation, player)) { - // Change block - startBlock.setType(b); - if (toData != 0) - startBlock.setData(toData); - - if (charge) { - if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { - - Economy econ = GeometricMagic.getEconomy(); - - // Deposit or withdraw to players Vault account - if (pay > 0) { - econ.depositPlayer(player.getName(), pay); - } else if (pay < 0) { - econ.withdrawPlayer(player.getName(), pay * -1); + if (!checkBreakBlacklist(a.getId()) && !checkPlaceBlacklist(b.getId())) { + + Location blockLocation = startBlock.getLocation(); + int blockID = b.getId(); + byte blockData = toData; + + if (checkBlockBreakSimulation(blockLocation, player) && checkBlockPlaceSimulation(blockLocation, blockID, blockData, blockLocation, player)) { + // Change block + startBlock.setType(b); + if (toData != 0) + startBlock.setData(toData); + + if (charge) { + if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { + + Economy econ = GeometricMagic.getEconomy(); + + // Deposit or withdraw to players Vault account + if (pay > 0) { + econ.depositPlayer(player.getName(), pay); + } else if (pay < 0) { + econ.withdrawPlayer(player.getName(), pay * -1); + } + } else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + player.setLevel((int) (player.getLevel() + pay)); } - } else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { - player.setLevel((int) (player.getLevel() + pay)); } } } + + else { + player.sendMessage(ChatColor.RED + "[GeometricMagic] That block is blacklisted"); + return; + } + } // output to console @@ -1989,6 +2013,26 @@ public static boolean checkBlockBreakSimulation(Location target, Player player) // Lyneira's Code End + public static boolean checkBreakBlacklist(int m) { + @SuppressWarnings("unchecked") + List blacklist = (List) plugin.getConfig().getList("blacklist.break." + m); + for (int n : blacklist) { + if (n == m) + return true; + } + return false; + } + + public static boolean checkPlaceBlacklist(int m) { + @SuppressWarnings("unchecked") + List blacklist = (List) plugin.getConfig().getList("blacklist.place." + m); + for (int n : blacklist) { + if (n == m) + return true; + } + return false; + } + public static Object getPluginManager(GeometricMagic plugin) { return plugin.getServer().getPluginManager(); } From dbb986b7df3921c773c9535834b40f5f5bfdaec6 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sun, 5 Aug 2012 01:23:20 -0400 Subject: [PATCH 095/133] Forgot to save the file --- config.yml | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/config.yml b/config.yml index 50a41b0..404af84 100644 --- a/config.yml +++ b/config.yml @@ -18,6 +18,7 @@ # TRANSMUTATION SECTION transmutation: + # Cool down time between transmutations in seconds cooldown: 10 @@ -30,6 +31,7 @@ transmutation: # SET CIRCLES SECTION setcircles: + # Cool down time between using set circles in seconds cooldown: 10 @@ -41,43 +43,52 @@ setcircles: # Repair Circle 1133: [] + # Conversion Circle 1222: # The cost of this circle in hunger cost: 1 + # Philosopher's Stone Circle 1233: # The cost of this circle in hunger cost: 20 + # Boron Circle 1234: # The cost of this circle in hunger cost: 1 # The number of redstone to drop amount: 1 + # Soul Circle 2223: # The cost of this circle in hunger cost: 10 + # Homunculus Circle 2224: # The cost of this circle in hunger cost: 10 + # Safe Teleportation Circle 2244: # The cost of this circle in hunger cost: 1 + # Explosion Circle 2333: # The cost of this circle in hunger # Formula: cost + circle size (can be augmented) / 2 cost: 2 + # Fire Circle 3334: # The cost of this circle in hunger cost: 5 # The size of this circle in blocks cubed size: 3 + # Fire Explosion Circle 3344: # The cost of this circle in hunger @@ -85,26 +96,32 @@ setcircles: cost: 10 # The size of this circle in blocks cubed size: 3 + # Human Transmutation Circle 3444: # The cost of this circle in hunger cost: 20 + # Bed Circle (0111) x111: # The cost of this circle in hunger cost: 16 + # Pig Circle (0044) x044: # The cost of this circle in hunger cost: 10 + # Sheep Circle (0144) x144: # The cost of this circle in hunger cost: 10 + # Cow Circle (0244) x244: # The cost of this circle in hunger cost: 10 + # Chicken Circle (0344) x344: # The cost of this circle in hunger @@ -119,10 +136,43 @@ philosopherstone: modifier: 1 # BLACKLIST SECTION +blacklist: + # The blacklist used for breaking blocks with transmutation + break: + - 7 + - 19 + - 52 + - 54 + - 61 + - 62 + - 63 + - 64 + - 68 + - 71 + - 90 + - 95 + - 97 + - 117 + + # The blacklist used for placing blocks with transmutation + place: + - 7 + - 8 + - 9 + - 10 + - 11 + - 19 + - 34 + - 36 + - 52 + - 90 + - 95 + - 97 # VALUES SECTION (Values of blocks for transmutation) values: + # AIR 0: 0: 0 From cfdf6a94d4ac5faa53749e42263f7ce400236d4e Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sun, 5 Aug 2012 01:37:45 -0400 Subject: [PATCH 096/133] Attempt fix for NullPointerException via refactor --- .../GeometricMagicPlayerListener.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 075a3c6..e4f508d 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -2003,30 +2003,32 @@ public static boolean checkBlockPlaceSimulation(Location target, int typeId, byt } public static boolean checkBlockBreakSimulation(Location target, Player player) { + boolean ret = false; Block block = target.getBlock(); BlockBreakEvent breakEvent = new BlockBreakEvent(block, player); ((PluginManager) getPluginManager(plugin)).callEvent(breakEvent); if (breakEvent.isCancelled()) - return false; - return true; + ret = true; + return ret; } // Lyneira's Code End public static boolean checkBreakBlacklist(int m) { + boolean ret = false; @SuppressWarnings("unchecked") List blacklist = (List) plugin.getConfig().getList("blacklist.break." + m); - for (int n : blacklist) { + for (Integer n : blacklist) { if (n == m) - return true; + ret = true; } - return false; + return ret; } public static boolean checkPlaceBlacklist(int m) { @SuppressWarnings("unchecked") List blacklist = (List) plugin.getConfig().getList("blacklist.place." + m); - for (int n : blacklist) { + for (Integer n : blacklist) { if (n == m) return true; } From 5c9e706ff88d18b988748b824dc716a0c9cb87ab Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sun, 5 Aug 2012 01:45:37 -0400 Subject: [PATCH 097/133] Another refactor and a correction --- .../GeometricMagicPlayerListener.java | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index e4f508d..86ba496 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -2003,36 +2003,34 @@ public static boolean checkBlockPlaceSimulation(Location target, int typeId, byt } public static boolean checkBlockBreakSimulation(Location target, Player player) { - boolean ret = false; Block block = target.getBlock(); BlockBreakEvent breakEvent = new BlockBreakEvent(block, player); ((PluginManager) getPluginManager(plugin)).callEvent(breakEvent); if (breakEvent.isCancelled()) - ret = true; - return ret; + return false; + return true; } // Lyneira's Code End public static boolean checkBreakBlacklist(int m) { boolean ret = false; - @SuppressWarnings("unchecked") - List blacklist = (List) plugin.getConfig().getList("blacklist.break." + m); - for (Integer n : blacklist) { - if (n == m) + List blacklist = plugin.getConfig().getStringList("blacklist.break." + m); + for (String s : blacklist) { + if (s.equals(m)) ret = true; } return ret; } public static boolean checkPlaceBlacklist(int m) { - @SuppressWarnings("unchecked") - List blacklist = (List) plugin.getConfig().getList("blacklist.place." + m); - for (Integer n : blacklist) { - if (n == m) - return true; + boolean ret = false; + List blacklist = plugin.getConfig().getStringList("blacklist.place." + m); + for (String s : blacklist) { + if (s.equals(m)) + ret = true; } - return false; + return ret; } public static Object getPluginManager(GeometricMagic plugin) { From 8a07b62939448ff8c05e47fd19fd2077df5d971b Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sun, 5 Aug 2012 02:17:30 -0400 Subject: [PATCH 098/133] Can't use String.equals with an integer --- .../GeometricMagic/GeometricMagicPlayerListener.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 86ba496..5c52938 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -2015,9 +2015,9 @@ public static boolean checkBlockBreakSimulation(Location target, Player player) public static boolean checkBreakBlacklist(int m) { boolean ret = false; - List blacklist = plugin.getConfig().getStringList("blacklist.break." + m); + List blacklist = plugin.getConfig().getStringList("blacklist.break"); for (String s : blacklist) { - if (s.equals(m)) + if (s.equals(String.valueOf(m))) ret = true; } return ret; @@ -2025,9 +2025,9 @@ public static boolean checkBreakBlacklist(int m) { public static boolean checkPlaceBlacklist(int m) { boolean ret = false; - List blacklist = plugin.getConfig().getStringList("blacklist.place." + m); + List blacklist = plugin.getConfig().getStringList("blacklist.place"); for (String s : blacklist) { - if (s.equals(m)) + if (s.equals(String.valueOf(m))) ret = true; } return ret; From 809e920336bd0c18089e981efe6d72f2c1b12f09 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sun, 5 Aug 2012 02:17:55 -0400 Subject: [PATCH 099/133] v2.6.5 --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index e7ea7db..db0b74d 100644 --- a/plugin.yml +++ b/plugin.yml @@ -18,7 +18,7 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.6.4 +version: 2.6.5 author: cakenggt, Hoot215 softdepend: [Vault,AntiCheat] permissions: From 45fe2a05de77af253392cf729ba1ff038c421d48 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sun, 5 Aug 2012 02:23:02 -0400 Subject: [PATCH 100/133] v2.7 --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index db0b74d..5743965 100644 --- a/plugin.yml +++ b/plugin.yml @@ -18,7 +18,7 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.6.5 +version: 2.7 author: cakenggt, Hoot215 softdepend: [Vault,AntiCheat] permissions: From 87e402a9a10fd66c7eb0eaa5a197ea472837f971 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sun, 5 Aug 2012 02:34:12 -0400 Subject: [PATCH 101/133] 'geometricmagic.standard' should be true by default --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index db0b74d..ca836af 100644 --- a/plugin.yml +++ b/plugin.yml @@ -31,7 +31,7 @@ permissions: geometricmagic.bypass.*: true geometricmagic.standard: description: Gives access to standard circles /setcircle and /circles - default: false + default: true children: geometricmagic.teleportation: true geometricmagic.micro: true From b59ef4c01608e83249510f44de468dfac8c5433e Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sun, 5 Aug 2012 02:34:54 -0400 Subject: [PATCH 102/133] v2.7.1 --- .config.yml.kate-swp | Bin 6094 -> 0 bytes plugin.yml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 .config.yml.kate-swp diff --git a/.config.yml.kate-swp b/.config.yml.kate-swp deleted file mode 100644 index f1074a295a7787c1ee047b6049ade02eb8a7498d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6094 zcmbuDX^)jf5QXQ$05gCrE`W-76(W~^H$wH_a;PyN;>q@)m`0PUGKRQ#>U20zH<2DOn>^);j{f0Pn?|TPxarNIe+2A znbZ9Z>()=dJT^A=VKl7w#=Zgf;8z>Zg7-9@4e#AIy+8hCJv`o!>9ZRWZC1mev0jTM zJknTupKPqX4>#7{M;nh5?!CryU|T;IKGFR1;0ui>;ERnX;hp=Y55>RSZGPwaD7x6J ze!siQV1OhRjQ7L3wG55pyBrNm-@)jf@1~rK?$WONadhW(-3Oz)pzGch-9_DYSE6fa z1})8?r5VH`%{!ZlV))nH)@5 z-J-|Ds)=$B5RlsS1w?E>sjltzV$pitZzNv5}u4!f)CGU zqfeq?Cg==F(68YLGYz^1M(d>p!LC8DYY^-j1iJ>oI#<>J>>32S2EndDuxk+P8U(ur z!LC8DYY^-j1iJ>ou0gOgC~E?i24xMx(x7-JUcGolL#8ipNVH{L!7|we4t9ZqUEp9B zIM@Xac7cOk;9wUxSORypoo7{ym7w64z-7_F{b(g9umsMMBZ12g7QX~81r1&ktpov< zz~x5(OW;z_Uy0a4Bfam%!QiC2%Pi_$6>DXs`s% z{3USp`0&Q|+DzZjva8j08m+cy8)JG&z_sX09xeNlN6W6{(QYewOgUt|i zl1Ga#c{IP|(Xu0XwAYY4rW_J~7n1X7G|Xg$A<0Ts8Z24Kmxd)Pc@|i*k}nOrtiY0$ z{QLGsa>uI-6p*tO4E@nK81xwv`m0iZSR(e+%|iSX3}%ALD=x;z^I^7@6EMteCc3%+ zxorHITweR3z)Py;bU!k@=n`V{l-NjYhAlQ|u|bOsT5Mi#DY17&!$x8=Y_UO$4O(o_ zVm}`^N$fq*u*?@X9t<4>x_j^SuT#{yL5@^G$>J4&Vqg-&-KQ zw{e7-?+A$RD2_1m9Ru+l#}Q_}lOVoRIKs?#4#amJN0|9O0P$VI5oW&2AigU&!qP_` zKaXbb1KRt5_C8>~58(=XQ=K~1?9yhKV7)EP&tARF-FxAmAkY`lFnv)|scj5u^|r3Y zi=*Ugjoe!sEBK}^IMWsUOCpC21!vG#!&<%le;sXf?~v(35$P894$Wuv*U@zHZ=!<@ zot#0PJbw~ko!nS57ilBfSJ4!Wu-H&E20ah3KM~Qj`rGJWL#r9o>e!1nf$J>n{aG~q z1<6ZeS$MZqJeegzs;Egeb}O+nXT;LEceK~P?buNp`y(!~$x)VVVK1NOyKpJN-$w@< zN-%>;@cJ&na2=H3#rdmH({r!FUR;Zm*X&+I<9T51{X=xHp}iT@-nkmq-tjfF8rJF` zqk|2tX3$r|TAla)DOjcPb969!K8BE)(iIpLDqVpUJ9PzC>?{qf=fc;cVYd=HOJfi_ zOXH?u=W8*y&dqBT=YK3I6jQp_Dg4h{r$jM--VJVfJ$#-)xK2__>UDTa{EGEUbTG>p zLmmrOtjrLsSaEA^S)4^!$m5N;3yBsv;b4Q{`6Dn`ZJX(-vxM=h2!D+ZW(Q};4-R`0 zU>!VT!-^eDQuH8|tzeIR(~p(q{#z{9Ie#Zm*wDwqpiUCMU2F*JB>6)LYxN(|!G=~d z=&NC^j=f27afk%L3wt3@T=UOp3jSAgu%X}#DtM{@tl;?ouvY&a9c*YdgT5Np>eLWe RtN)1(Hnf^SUk&HQ{spi8k#zt7 diff --git a/plugin.yml b/plugin.yml index ca836af..203514d 100644 --- a/plugin.yml +++ b/plugin.yml @@ -18,7 +18,7 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.6.5 +version: 2.7.1 author: cakenggt, Hoot215 softdepend: [Vault,AntiCheat] permissions: From c09f986038750669b07b2527c2b2370046abfa53 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Tue, 14 Aug 2012 22:33:42 -0400 Subject: [PATCH 103/133] That went overlooked for a long time --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index 203514d..98a5e65 100644 --- a/plugin.yml +++ b/plugin.yml @@ -19,7 +19,7 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic version: 2.7.1 -author: cakenggt, Hoot215 +authors: [cakenggt, Hoot215] softdepend: [Vault,AntiCheat] permissions: geometricmagic.*: From f07017f8af7f47677e90d5331eb2bc6938439be0 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Wed, 15 Aug 2012 17:52:10 -0400 Subject: [PATCH 104/133] Minor refactor --- .../cakenggt/GeometricMagic/GeometricMagicPlayerListener.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 5c52938..29187c4 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -693,8 +693,7 @@ public static void setCircleRemote(Player player, World world, Block actBlock) { Block effectBlock = actBlock; List entitiesList = player.getNearbyEntities(242, 20, 242); - String limitArrowsConfig = plugin.getConfig().getString("setcircles.limitarrows").toString(); - int limitArrows = Integer.parseInt(limitArrowsConfig); + int limitArrows = plugin.getConfig().getInt("setcircles.limitarrows"); int limit = (entitiesList.size() > limitArrows) ? limitArrows : entitiesList.size(); for (int i = 0; i < limit; i++) { From c2580514bc9af11f48e977171ddd40f62aa466fe Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Thu, 16 Aug 2012 14:50:57 -0400 Subject: [PATCH 105/133] Forgot this part --- .../cakenggt/GeometricMagic/GeometricMagicPlayerListener.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 29187c4..a0df82b 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -570,8 +570,7 @@ public static void microCircle(Player player, World world, Block actBlock) { } List entitiesList = player.getNearbyEntities(100, 10, 100); - String limitArrowsConfig = plugin.getConfig().getString("setcircles.limitarrows").toString(); - int limitArrows = Integer.parseInt(limitArrowsConfig); + int limitArrows = plugin.getConfig().getInt("setcircles.limitarrows"); int limit = (entitiesList.size() > limitArrows) ? limitArrows : entitiesList.size(); for (int i = 0; i < limit; i++) { From d5e789a87a90551d8ade3bcc8011706763bc3316 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Fri, 17 Aug 2012 21:47:01 -0400 Subject: [PATCH 106/133] Most likely fixed remote set circles (using both flint and micro circles), and possibly some other things that I forget --- .../GeometricMagicPlayerListener.java | 46 ++++++++++++++----- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index a0df82b..e00a6c0 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -125,6 +125,7 @@ public static void isCircle(Player player, World world, Block actBlock) throws I circleChooser(player, world, actBlock); } if (player.getItemInHand().getType() == Material.FLINT) { + System.out.println("[DEBUG] isCircle with flint"); // set circle cool down if (!player.hasPermission("geometricmagic.bypass.cooldown")) { @@ -156,7 +157,8 @@ public static void isCircle(Player player, World world, Block actBlock) throws I } else { return; } - + + System.out.println("[DEBUG] Trying set circle loop"); try { // exempt player from AntiCheat check if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { @@ -166,7 +168,11 @@ public static void isCircle(Player player, World world, Block actBlock) throws I AnticheatAPI.exemptPlayer(player, CheckType.NO_SWING); } - setCircleEffects(player, player.getWorld(), player.getLocation().getBlock(), actBlock, circle); + if (circle.equals("0")) { + circleChooser(player, world, actBlock); + } + else + setCircleEffects(player, player.getWorld(), player.getLocation().getBlock(), actBlock, circle); // unexempt player from AntiCheat check if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { @@ -192,7 +198,7 @@ public static void isCircle(Player player, World world, Block actBlock) throws I } public static void circleChooser(Player player, World world, Block actBlock) { - // System.out.println("circleChooser"); + System.out.println("[DEBUG] circleChooser"); Block northBlock = actBlock.getRelative(0, 0, -1); Block southBlock = actBlock.getRelative(0, 0, 1); Block eastBlock = actBlock.getRelative(1, 0, 0); @@ -283,6 +289,7 @@ public static void circleChooser(Player player, World world, Block actBlock) { && westBlock.getType() != Material.REDSTONE_WIRE && actBlock.getRelative(-3, 0, 0).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(3, 0, 0).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, -3).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, 3).getType() == Material.REDSTONE_WIRE) { + System.out.println("[DEBUG] Set circle"); if (player.hasPermission("geometricmagic.set")) { // set circle cool down @@ -309,6 +316,7 @@ public static void circleChooser(Player player, World world, Block actBlock) { } setCircleRemote(player, world, actBlock); + System.out.println("[DEBUG] Set circle remote void"); // unexempt player from AntiCheat check if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { @@ -322,6 +330,7 @@ public static void circleChooser(Player player, World world, Block actBlock) { // no circle } else { + System.out.println("[DEBUG] No circle"); return; } } @@ -569,17 +578,21 @@ public static void microCircle(Player player, World world, Block actBlock) { player.sendMessage("Your transmutation circle is ready to use."); } - List entitiesList = player.getNearbyEntities(100, 10, 100); - int limitArrows = plugin.getConfig().getInt("setcircles.limitarrows"); - int limit = (entitiesList.size() > limitArrows) ? limitArrows : entitiesList.size(); + List entitiesList = player.getNearbyEntities(100, 32, 100); + int limitCount = plugin.getConfig().getInt("setcircles.limitarrows"); + System.out.println("[DEBUG] limitCount=" + String.valueOf(limitCount)); - for (int i = 0; i < limit; i++) { + for (int i = 0; i < entitiesList.size() && limitCount != 0; i++) { + System.out.println("[DEBUG] i=" + String.valueOf(i) + ", limitCount=" + String.valueOf(limitCount) + ", entityListSize=" + String.valueOf(entitiesList.size())); if (entitiesList.get(i) instanceof Arrow) { + System.out.println("[DEBUG] Entity " + String.valueOf(i) + " is instanceof Arrow"); Arrow shotArrow = (Arrow) entitiesList.get(i); if (shotArrow.getLocation().getBlock().getType() == Material.REDSTONE_WIRE) { + limitCount--; Block newActPoint = shotArrow.getLocation().getBlock(); Player newPlayer = (Player) shotArrow.getShooter(); circleChooser(newPlayer, world, newActPoint); + System.out.println("[DEBUG] Arrow is on redstone, limitCount=" + String.valueOf(limitCount) + ", Shooter: " + newPlayer.getName() + ", blockID=" + newActPoint.getType().getId() + ", blockLoc: '" + newActPoint.getLocation().toString() + "'"); } } } @@ -691,23 +704,31 @@ public static void setCircleRemote(Player player, World world, Block actBlock) { Boolean remote = false; Block effectBlock = actBlock; - List entitiesList = player.getNearbyEntities(242, 20, 242); - int limitArrows = plugin.getConfig().getInt("setcircles.limitarrows"); - int limit = (entitiesList.size() > limitArrows) ? limitArrows : entitiesList.size(); + List entitiesList = player.getNearbyEntities(100, 32, 100); + int limit = plugin.getConfig().getInt("setcircles.limitarrows"); + int limitCount = limit; - for (int i = 0; i < limit; i++) { + for (int i = 0; i < entitiesList.size() && limitCount != 0; i++) { + System.out.println("[DEBUG] i=" + String.valueOf(i) + ", limitCount=" + String.valueOf(limitCount) + ", entityListSize=" + String.valueOf(entitiesList.size())); if (entitiesList.get(i) instanceof Arrow) { + System.out.println("[DEBUG] Entity " + String.valueOf(i) + " is instanceof Arrow"); Arrow shotArrow = (Arrow) entitiesList.get(i); if (shotArrow.getLocation().getBlock().getX() == actBlock.getLocation().getBlock().getX() && shotArrow.getLocation().getBlock().getZ() == actBlock.getLocation().getBlock().getZ()) { + System.out.println("[DEBUG] Arrow is on redstone, remote=true"); + limitCount--; remote = true; entitiesList.remove(i); } } } + limitCount = limit; + if (remote) { - for (int i = 0; i < limit; i++) { + System.out.println("[DEBUG] Remote"); + for (int i = 0; i < entitiesList.size() && limitCount != 0; i++) { if (entitiesList.get(i) instanceof Arrow) { + limitCount--; Arrow shotArrow = (Arrow) entitiesList.get(i); effectBlock = shotArrow.getLocation().getBlock(); setCircle(player, world, actBlock, effectBlock); @@ -718,6 +739,7 @@ public static void setCircleRemote(Player player, World world, Block actBlock) { } public static void setCircle(Player player, World world, Block actBlock, Block effectBlock) { + System.out.println("[DEBUG] Set circle void"); Block northSin = actBlock.getRelative(0, 0, -3); Block southSin = actBlock.getRelative(0, 0, 3); Block eastSin = actBlock.getRelative(3, 0, 0); From 355a334dcfe7c5b5acb63344156e3869f7d54b8b Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Fri, 17 Aug 2012 21:47:27 -0400 Subject: [PATCH 107/133] v2.7.2 --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index 98a5e65..d45043c 100644 --- a/plugin.yml +++ b/plugin.yml @@ -18,7 +18,7 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.7.1 +version: 2.7.2 authors: [cakenggt, Hoot215] softdepend: [Vault,AntiCheat] permissions: From fab21e0d0bdf70e893aecde93a21ed5347a3c2a3 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Fri, 17 Aug 2012 21:49:49 -0400 Subject: [PATCH 108/133] Remove debug code --- .../GeometricMagicPlayerListener.java | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index e00a6c0..9a67403 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -125,7 +125,6 @@ public static void isCircle(Player player, World world, Block actBlock) throws I circleChooser(player, world, actBlock); } if (player.getItemInHand().getType() == Material.FLINT) { - System.out.println("[DEBUG] isCircle with flint"); // set circle cool down if (!player.hasPermission("geometricmagic.bypass.cooldown")) { @@ -158,7 +157,6 @@ public static void isCircle(Player player, World world, Block actBlock) throws I return; } - System.out.println("[DEBUG] Trying set circle loop"); try { // exempt player from AntiCheat check if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { @@ -198,7 +196,6 @@ public static void isCircle(Player player, World world, Block actBlock) throws I } public static void circleChooser(Player player, World world, Block actBlock) { - System.out.println("[DEBUG] circleChooser"); Block northBlock = actBlock.getRelative(0, 0, -1); Block southBlock = actBlock.getRelative(0, 0, 1); Block eastBlock = actBlock.getRelative(1, 0, 0); @@ -289,7 +286,6 @@ public static void circleChooser(Player player, World world, Block actBlock) { && westBlock.getType() != Material.REDSTONE_WIRE && actBlock.getRelative(-3, 0, 0).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(3, 0, 0).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, -3).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, 3).getType() == Material.REDSTONE_WIRE) { - System.out.println("[DEBUG] Set circle"); if (player.hasPermission("geometricmagic.set")) { // set circle cool down @@ -316,7 +312,6 @@ public static void circleChooser(Player player, World world, Block actBlock) { } setCircleRemote(player, world, actBlock); - System.out.println("[DEBUG] Set circle remote void"); // unexempt player from AntiCheat check if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { @@ -330,7 +325,6 @@ public static void circleChooser(Player player, World world, Block actBlock) { // no circle } else { - System.out.println("[DEBUG] No circle"); return; } } @@ -580,19 +574,15 @@ public static void microCircle(Player player, World world, Block actBlock) { List entitiesList = player.getNearbyEntities(100, 32, 100); int limitCount = plugin.getConfig().getInt("setcircles.limitarrows"); - System.out.println("[DEBUG] limitCount=" + String.valueOf(limitCount)); for (int i = 0; i < entitiesList.size() && limitCount != 0; i++) { - System.out.println("[DEBUG] i=" + String.valueOf(i) + ", limitCount=" + String.valueOf(limitCount) + ", entityListSize=" + String.valueOf(entitiesList.size())); if (entitiesList.get(i) instanceof Arrow) { - System.out.println("[DEBUG] Entity " + String.valueOf(i) + " is instanceof Arrow"); Arrow shotArrow = (Arrow) entitiesList.get(i); if (shotArrow.getLocation().getBlock().getType() == Material.REDSTONE_WIRE) { limitCount--; Block newActPoint = shotArrow.getLocation().getBlock(); Player newPlayer = (Player) shotArrow.getShooter(); circleChooser(newPlayer, world, newActPoint); - System.out.println("[DEBUG] Arrow is on redstone, limitCount=" + String.valueOf(limitCount) + ", Shooter: " + newPlayer.getName() + ", blockID=" + newActPoint.getType().getId() + ", blockLoc: '" + newActPoint.getLocation().toString() + "'"); } } } @@ -709,12 +699,9 @@ public static void setCircleRemote(Player player, World world, Block actBlock) { int limitCount = limit; for (int i = 0; i < entitiesList.size() && limitCount != 0; i++) { - System.out.println("[DEBUG] i=" + String.valueOf(i) + ", limitCount=" + String.valueOf(limitCount) + ", entityListSize=" + String.valueOf(entitiesList.size())); if (entitiesList.get(i) instanceof Arrow) { - System.out.println("[DEBUG] Entity " + String.valueOf(i) + " is instanceof Arrow"); Arrow shotArrow = (Arrow) entitiesList.get(i); if (shotArrow.getLocation().getBlock().getX() == actBlock.getLocation().getBlock().getX() && shotArrow.getLocation().getBlock().getZ() == actBlock.getLocation().getBlock().getZ()) { - System.out.println("[DEBUG] Arrow is on redstone, remote=true"); limitCount--; remote = true; entitiesList.remove(i); @@ -725,7 +712,6 @@ public static void setCircleRemote(Player player, World world, Block actBlock) { limitCount = limit; if (remote) { - System.out.println("[DEBUG] Remote"); for (int i = 0; i < entitiesList.size() && limitCount != 0; i++) { if (entitiesList.get(i) instanceof Arrow) { limitCount--; @@ -739,7 +725,6 @@ public static void setCircleRemote(Player player, World world, Block actBlock) { } public static void setCircle(Player player, World world, Block actBlock, Block effectBlock) { - System.out.println("[DEBUG] Set circle void"); Block northSin = actBlock.getRelative(0, 0, -3); Block southSin = actBlock.getRelative(0, 0, 3); Block eastSin = actBlock.getRelative(3, 0, 0); From 94199da81a8dbe7a4620b8027d5cbfe57c82cdc6 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Mon, 20 Aug 2012 20:39:37 -0400 Subject: [PATCH 109/133] No need for that --- src/me/cakenggt/GeometricMagic/GeometricMagic.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagic.java b/src/me/cakenggt/GeometricMagic/GeometricMagic.java index 72eded1..96b0e44 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagic.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagic.java @@ -121,7 +121,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, return false; } } else if (cmd.getName().equalsIgnoreCase("circles")) { - if (sender.hasPermission("geometricmagic.listcircles") || sender.isOp()) { + if (sender.hasPermission("geometricmagic.listcircles")) { sender.sendMessage(ChatColor.GREEN + "1133" + ChatColor.RESET + " Repair Circle"); sender.sendMessage(ChatColor.GREEN + "1222" + ChatColor.RESET + " Conversion Circle"); sender.sendMessage(ChatColor.GREEN + "1233" + ChatColor.RESET + " Philosopher's Stone Circle"); From 887d235c44f5204a88edefe3bdf6ba86effe1f6a Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Mon, 20 Aug 2012 22:10:18 -0400 Subject: [PATCH 110/133] Added '/geometricmagic [reload]' commands Command permission changes --- plugin.yml | 34 ++++++++----- .../GeometricMagic/GeometricMagic.java | 48 +++++++++++++++++-- 2 files changed, 65 insertions(+), 17 deletions(-) diff --git a/plugin.yml b/plugin.yml index d45043c..5cc932d 100644 --- a/plugin.yml +++ b/plugin.yml @@ -29,6 +29,7 @@ permissions: geometricmagic.standard: true geometricmagic.transmutation.*: true geometricmagic.bypass.*: true + geometricmagic.command.geometricmagic.reload: true geometricmagic.standard: description: Gives access to standard circles /setcircle and /circles default: true @@ -37,6 +38,7 @@ permissions: geometricmagic.micro: true geometricmagic.transmutation.1: true geometricmagic.set: true + geometricmagic.command.geometricmagic: true geometricmagic.teleportation: description: Allows you to use teleportation circles geometricmagic.micro: @@ -63,12 +65,16 @@ permissions: description: Allows you to use all set circles and set circle commands children: geometricmagic.set.*: true - geometricmagic.setcircle: true - geometricmagic.listcircles: true - geometricmagic.setcircle: + geometricmagic.command.setcircle: true + geometricmagic.command.circles: true + geometricmagic.command.setcircle: description: Allows you to use /setcircle - geometricmagic.listcircles: + geometricmagic.command.listcircles: description: Allows you to use /circles + geometricmagic.command.geometricmagic: + description: Allows you to use /geometricmagic + geometricmagic.command.geometricmagic.reload: + description: 'Allows you to use "/geometricmagic reload"' geometricmagic.set.*: description: Allows you to use all set circles children: @@ -136,11 +142,15 @@ permissions: geometricmagic.bypass.sacrifice: description: Allows you to bypass human transmutation sacrificing your alchemy abilities forever commands: - setcircle: - description: This command sets a sacrifice's right-click circle. - permission: geometricmagic.setcircle - usage: Hold the flint from your inventory in your hand and right-click to cast a set circle. Use /circles to list all set circles. To bind a set circle to the flint use /setcircle #### - circles: - description: This command displays a list of set circles. - permission: geometricmagic.listcircles - usage: /circles \ No newline at end of file + setcircle: + description: This command sets a sacrifice's right-click circle. + permission: geometricmagic.command.setcircle + usage: "Hold the flint from your inventory in your hand and right-click to cast a set circle. Use /circles to list all set circles. To bind a set circle to the flint use /setcircle ####" + circles: + description: This command displays a list of set circles. + permission: geometricmagic.command.circles + usage: "/circles" + geometricmagic: + description: This command displays general plugin help or executes the given sub-command. + permission: geometricmagic.command.geometricmagic + usage: "/geometricmagic [Sub-Command]" \ No newline at end of file diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagic.java b/src/me/cakenggt/GeometricMagic/GeometricMagic.java index 96b0e44..fa8111c 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagic.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagic.java @@ -53,8 +53,8 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, if (sender instanceof Player) { player = (Player) sender; - if (!player.hasPermission("geometricmagic.setcircle")) { - player.sendMessage(ChatColor.RED + "You don't have permission to use this command."); + if (!player.hasPermission("geometricmagic.command.setcircle")) { + player.sendMessage(ChatColor.RED + "You don't have permission to use this command!"); return true; } @@ -121,7 +121,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, return false; } } else if (cmd.getName().equalsIgnoreCase("circles")) { - if (sender.hasPermission("geometricmagic.listcircles")) { + if (sender.hasPermission("geometricmagic.command.circles")) { sender.sendMessage(ChatColor.GREEN + "1133" + ChatColor.RESET + " Repair Circle"); sender.sendMessage(ChatColor.GREEN + "1222" + ChatColor.RESET + " Conversion Circle"); sender.sendMessage(ChatColor.GREEN + "1233" + ChatColor.RESET + " Philosopher's Stone Circle"); @@ -138,10 +138,48 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, sender.sendMessage(ChatColor.GREEN + "0144" + ChatColor.RESET + " Sheep Circle"); sender.sendMessage(ChatColor.GREEN + "0244" + ChatColor.RESET + " Cow Circle"); sender.sendMessage(ChatColor.GREEN + "0344" + ChatColor.RESET + " Chicken Circle"); - } else { + } else sender.sendMessage(ChatColor.RED + "You don't have permission to use this command!"); - } return true; + } else if (cmd.getName().equalsIgnoreCase("geometricmagic")) { + if (sender.hasPermission("geometricmagic.command.geometricmagic")) { + if (args.length == 0) { + sender.sendMessage(ChatColor.GREEN + "*********** GeometricMagic Help ***********"); + sender.sendMessage(ChatColor.GREEN + "*" + ChatColor.GRAY + "************* User Commands *************"); + sender.sendMessage(ChatColor.GREEN + "*" + ChatColor.GRAY + "*" + ChatColor.YELLOW + " /geometricmagic" + ChatColor.WHITE + " - Display this help dialogue"); + sender.sendMessage(ChatColor.GREEN + "*" + ChatColor.GRAY + "*" + ChatColor.YELLOW + " /setcircle <####>" + ChatColor.WHITE + " - Bind set circle #### to flint. 0 resets"); + sender.sendMessage(ChatColor.GREEN + "*" + ChatColor.GRAY + "*" + ChatColor.YELLOW + " /circles" + ChatColor.WHITE + " - List all set circles"); + sender.sendMessage(ChatColor.GREEN + "*" + ChatColor.GRAY + "*****************************************"); + if (sender.hasPermission("geometricmagic.command.geometricmagic.reload")) { + sender.sendMessage(ChatColor.GREEN + "*" + ChatColor.RED + "************* Admin Commands ************"); + sender.sendMessage(ChatColor.GREEN + "*" + ChatColor.RED + "*" + ChatColor.YELLOW + " /geometricmagic reload" + ChatColor.WHITE + " - Reload config file"); + sender.sendMessage(ChatColor.GREEN + "*" + ChatColor.RED + "*****************************************"); + } + sender.sendMessage(ChatColor.GREEN + "******************************************"); + return true; + } + else if (args.length == 1) { + if (args[0].equalsIgnoreCase("reload")) { + if (sender.hasPermission("geometricmagic.command.geometricmagic.reload")) { + reloadConfig(); + sender.sendMessage(ChatColor.GREEN + "Config reload successfully!"); + return true; + } + else { + sender.sendMessage(ChatColor.RED + "You don't have permission to use this command!"); + return true; + } + } + else + return false; + } + else if (args.length > 1) + return false; + } + else { + sender.sendMessage(ChatColor.RED + "You don't have permission to use this command!"); + return true; + } } // If this has happened the function will break and return true. if this // hasn't happened the a value of false will be returned. From 361450d509bb44a835278091f7a75c091599ebaa Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Wed, 22 Aug 2012 00:26:48 -0400 Subject: [PATCH 111/133] Added auto update notification and auto config updates Other minor tweaks --- config.yml | 9 ++ plugin.yml | 5 +- .../GeometricMagic/GeometricMagic.java | 56 ++++++------ .../GeometricMagicAutoUpdater.java | 59 +++++++++++++ .../GeometricMagicConfigUpdater.java | 87 +++++++++++++++++++ .../GeometricMagicPlayerListener.java | 21 +++++ 6 files changed, 210 insertions(+), 27 deletions(-) create mode 100644 src/me/cakenggt/GeometricMagic/GeometricMagicAutoUpdater.java create mode 100644 src/me/cakenggt/GeometricMagic/GeometricMagicConfigUpdater.java diff --git a/config.yml b/config.yml index 404af84..524315f 100644 --- a/config.yml +++ b/config.yml @@ -16,6 +16,15 @@ # along with this program. If not, see . # +# DO NOT MODIFY THIS VALUE! +version: 2.7.3 + +# GENERAL SECTION +general: + + # Automatic notification of plugin updates + auto-update-notify: true + # TRANSMUTATION SECTION transmutation: diff --git a/plugin.yml b/plugin.yml index 5cc932d..2f5a6dd 100644 --- a/plugin.yml +++ b/plugin.yml @@ -18,7 +18,7 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.7.2 +version: 2.7.3 authors: [cakenggt, Hoot215] softdepend: [Vault,AntiCheat] permissions: @@ -26,10 +26,13 @@ permissions: description: Gives access to all circles /setcircle and /circles default: op children: + geometricmagic.notify: true geometricmagic.standard: true geometricmagic.transmutation.*: true geometricmagic.bypass.*: true geometricmagic.command.geometricmagic.reload: true + geometricmagic.notify: + description: Notifies you if a newer version of GeometricMagic is available geometricmagic.standard: description: Gives access to standard circles /setcircle and /circles default: true diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagic.java b/src/me/cakenggt/GeometricMagic/GeometricMagic.java index fa8111c..9b4e10a 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagic.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagic.java @@ -19,10 +19,7 @@ package me.cakenggt.GeometricMagic; import java.io.File; -import java.io.FileOutputStream; import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; import java.io.PrintWriter; import java.util.Scanner; @@ -43,6 +40,9 @@ public class GeometricMagic extends JavaPlugin { private Listener entityListener; private static Economy economy; File configFile; + public boolean autoUpdate; + public boolean autoUpdateNotify; + public boolean upToDate = true; public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { @@ -281,14 +281,16 @@ public void onEnable() { configFile = new File(getDataFolder(), "config.yml"); // Copy default config file if it doesn't exist - if (!configFile.exists()) { - configFile.getParentFile().mkdirs(); - copy(this.getResource("config.yml"), configFile); + if (!configFile.exists()) + saveDefaultConfig(); + else { + try { + GeometricMagicConfigUpdater.updateConfig(this); + } catch (IOException e) { + e.printStackTrace(); + } } - // Copy config defaults - getConfig().options().copyDefaults(true); - // Transmutation mode: Vault if (getConfig().getString("transmutation.cost").toString().equalsIgnoreCase("vault")) { // Vault Support @@ -326,9 +328,27 @@ else if (getConfig().getString("transmutation.cost").toString().equalsIgnoreCase System.out.println("[" + this + "] ERROR: You have your transmutation cost system set to an unknown value. Disabling plugin!"); getServer().getPluginManager().disablePlugin(this); } - + // Plugin metrics startPluginMetrics(); + + // Check auto-update-notify + if (getConfig().getBoolean("general.auto-update-notify")) { + if (getConfig().getBoolean("general.auto-update")) + autoUpdate = true; + else + autoUpdateNotify = true; + } + // Check auto-update + else if (getConfig().getBoolean("general.auto-update")) { + autoUpdate = true; + } + + // Get plugin version for auto-update + int pluginVersion = Integer.parseInt(this.getDescription().getVersion().replace(".", "")); + + // Start auto-update + new Thread((new GeometricMagicAutoUpdater(this, pluginVersion))).start(); } // Vault Support @@ -346,22 +366,6 @@ public static Economy getEconomy() { return economy; } - // Copy method - private void copy(InputStream in, File file) { - try { - OutputStream out = new FileOutputStream(file); - byte[] buf = new byte[1024]; - int len; - while ((len = in.read(buf)) > 0) { - out.write(buf, 0, len); - } - out.close(); - in.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - private void startPluginMetrics() { try { Metrics metrics = new Metrics(this); diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicAutoUpdater.java b/src/me/cakenggt/GeometricMagic/GeometricMagicAutoUpdater.java new file mode 100644 index 0000000..d34d140 --- /dev/null +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicAutoUpdater.java @@ -0,0 +1,59 @@ +/** + * GeometricMagic allows players to draw redstone circles on the ground to do things such as teleport and transmute blocks. + * Copyright (C) 2012 Alec Cox (cakenggt), Andrew Stevanus (Hoot215) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package me.cakenggt.GeometricMagic; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Scanner; + + + +public class GeometricMagicAutoUpdater implements Runnable { + GeometricMagic plugin; + private int pluginVersion; + + public GeometricMagicAutoUpdater(GeometricMagic instance, int v) { + plugin = instance; + pluginVersion = v; + } + + public void run() { + String rawVersion = null; + + try { + URL url = new URL("http://dl.dropbox.com/u/56151340/BukkitPlugins/GeometricMagic/latest.txt"); + Scanner scanner = new Scanner(url.openStream()); + rawVersion = scanner.next(); + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + int latestVersion = Integer.parseInt(rawVersion.replace(".", "")); + + if (latestVersion > pluginVersion) { + plugin.upToDate = false; + System.out.println("[GeometricMagic] A newer version of GeometricMagic is available!"); + } + else + System.out.println("[GeometricMagic] Plugin is up to date!"); + } +} \ No newline at end of file diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicConfigUpdater.java b/src/me/cakenggt/GeometricMagic/GeometricMagicConfigUpdater.java new file mode 100644 index 0000000..265f862 --- /dev/null +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicConfigUpdater.java @@ -0,0 +1,87 @@ +/** + * GeometricMagic allows players to draw redstone circles on the ground to do things such as teleport and transmute blocks. + * Copyright (C) 2012 Alec Cox (cakenggt), Andrew Stevanus (Hoot215) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package me.cakenggt.GeometricMagic; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; + +// This class is basically intended for use as an automatic config updater, since +// the normal saveConfig() screws up all of the formatting. Unfortunately, this +// method also screws up the formatting a little bit, but it works slightly better. + +public class GeometricMagicConfigUpdater { + static GeometricMagic plugin; + + public static void updateConfig(GeometricMagic instance) throws IOException { + plugin = instance; + + // If the config is not updated + if (!isUpdated()) { + // If the config is not updated to version 2.7.3 + if (!plugin.getConfig().isSet("version")) { + System.out.println("[GeometricMagic] Updating config to v2.7.3..."); + + File myFile = new File("plugins/GeometricMagic/config.yml"); + if (myFile.exists()) { + FileWriter fileWriter = new FileWriter(myFile, true); + PrintWriter file = new PrintWriter(fileWriter); + file.println(); + file.println("# DO NOT MODIFY THIS VALUE!"); + file.println("version: 2.7.3"); + file.println(); + file.println("GENERAL SECTION"); + file.println("general:"); + file.println(); + file.println(" # Automatic notification of plugin updates"); + file.println(" auto-update-notify: true"); + file.close(); + + plugin.reloadConfig(); + } + else + return; + + if (!isUpdated()) { + updateConfig(instance); + return; + } + } + } + // If the config is updated + else { + System.out.println("[GeometricMagic] No config update needed"); + return; + } + + System.out.println("[GeometricMagic] Config updated successfully!"); + } + + public static boolean isUpdated() { + if (plugin.getConfig().isSet("version") + && plugin.getDescription().getVersion() + .equals(plugin.getConfig().getString("version"))) { + return true; + } + else { + return false; + } + } +} \ No newline at end of file diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 9a67403..d587f6d 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -45,6 +45,7 @@ import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import org.bukkit.plugin.PluginManager; @@ -59,6 +60,26 @@ public GeometricMagicPlayerListener(GeometricMagic instance) { public static Economy economy = null; private static HashMap mapCoolDowns = new HashMap(); + @EventHandler(priority = EventPriority.HIGHEST) + public void onPlayLogin(PlayerLoginEvent event) { + final String playerName = event.getPlayer().getName(); + + if (event.getPlayer().hasPermission("geometricmagic.notify")) { + if (!plugin.upToDate) { + plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { + + public void run() { + if (plugin.getServer().getPlayer(playerName) != null) { + plugin.getServer().getPlayer(playerName).sendMessage( + ChatColor.GREEN + + "A newer version of GeometricMagic is available!"); + } + } + }, 60L); + } + } + } + @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerInteract(PlayerInteractEvent event) { From f9e3fd67338f605425f7b756fe370fc3de540425 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Wed, 22 Aug 2012 00:41:29 -0400 Subject: [PATCH 112/133] No point ignoring a perfectly good config value --- .../GeometricMagicAutoUpdater.java | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicAutoUpdater.java b/src/me/cakenggt/GeometricMagic/GeometricMagicAutoUpdater.java index d34d140..a846c29 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicAutoUpdater.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicAutoUpdater.java @@ -35,25 +35,27 @@ public GeometricMagicAutoUpdater(GeometricMagic instance, int v) { } public void run() { - String rawVersion = null; - - try { - URL url = new URL("http://dl.dropbox.com/u/56151340/BukkitPlugins/GeometricMagic/latest.txt"); - Scanner scanner = new Scanner(url.openStream()); - rawVersion = scanner.next(); - } catch (MalformedURLException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); + if (plugin.getConfig().getBoolean("general.auto-update-notify")) { + String rawVersion = null; + + try { + URL url = new URL("http://dl.dropbox.com/u/56151340/BukkitPlugins/GeometricMagic/latest.txt"); + Scanner scanner = new Scanner(url.openStream()); + rawVersion = scanner.next(); + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + int latestVersion = Integer.parseInt(rawVersion.replace(".", "")); + + if (latestVersion > pluginVersion) { + plugin.upToDate = false; + System.out.println("[GeometricMagic] A newer version of GeometricMagic is available!"); + } + else + System.out.println("[GeometricMagic] Plugin is up to date!"); } - - int latestVersion = Integer.parseInt(rawVersion.replace(".", "")); - - if (latestVersion > pluginVersion) { - plugin.upToDate = false; - System.out.println("[GeometricMagic] A newer version of GeometricMagic is available!"); - } - else - System.out.println("[GeometricMagic] Plugin is up to date!"); } } \ No newline at end of file From dc4cc74062eabccc7f59c281797edb6b428dcc3a Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Wed, 22 Aug 2012 12:36:53 -0400 Subject: [PATCH 113/133] Fix permission for /circles --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index 2f5a6dd..667b87a 100644 --- a/plugin.yml +++ b/plugin.yml @@ -72,7 +72,7 @@ permissions: geometricmagic.command.circles: true geometricmagic.command.setcircle: description: Allows you to use /setcircle - geometricmagic.command.listcircles: + geometricmagic.command.circles: description: Allows you to use /circles geometricmagic.command.geometricmagic: description: Allows you to use /geometricmagic From d2699df7300032e6a253f27524b3ba34b9b7d48a Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Wed, 22 Aug 2012 12:37:23 -0400 Subject: [PATCH 114/133] v2.7.4 --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index 667b87a..e2ab789 100644 --- a/plugin.yml +++ b/plugin.yml @@ -18,7 +18,7 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.7.3 +version: 2.7.4 authors: [cakenggt, Hoot215] softdepend: [Vault,AntiCheat] permissions: From d46154cc7074eb7524b855c2832e541ee849c550 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Wed, 22 Aug 2012 19:16:29 -0400 Subject: [PATCH 115/133] Looping update check (1 hour intervals), fixed + improved config updater --- config.yml | 2 +- plugin.yml | 4 +- .../GeometricMagicAutoUpdater.java | 7 +- .../GeometricMagicConfigUpdater.java | 83 ++++++++++++++++++- .../GeometricMagicPlayerListener.java | 2 +- 5 files changed, 92 insertions(+), 6 deletions(-) diff --git a/config.yml b/config.yml index 524315f..42e9774 100644 --- a/config.yml +++ b/config.yml @@ -17,7 +17,7 @@ # # DO NOT MODIFY THIS VALUE! -version: 2.7.3 +version: 2.7.5 # GENERAL SECTION general: diff --git a/plugin.yml b/plugin.yml index e2ab789..6dd9b27 100644 --- a/plugin.yml +++ b/plugin.yml @@ -18,9 +18,9 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.7.4 +version: 2.7.5 authors: [cakenggt, Hoot215] -softdepend: [Vault,AntiCheat] +softdepend: [Vault, AntiCheat] permissions: geometricmagic.*: description: Gives access to all circles /setcircle and /circles diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicAutoUpdater.java b/src/me/cakenggt/GeometricMagic/GeometricMagicAutoUpdater.java index a846c29..45fb0ca 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicAutoUpdater.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicAutoUpdater.java @@ -35,7 +35,7 @@ public GeometricMagicAutoUpdater(GeometricMagic instance, int v) { } public void run() { - if (plugin.getConfig().getBoolean("general.auto-update-notify")) { + while (plugin.getConfig().getBoolean("general.auto-update-notify")) { String rawVersion = null; try { @@ -56,6 +56,11 @@ public void run() { } else System.out.println("[GeometricMagic] Plugin is up to date!"); + try { + Thread.sleep(3600000L); + } catch (InterruptedException e) { + e.printStackTrace(); + } } } } \ No newline at end of file diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicConfigUpdater.java b/src/me/cakenggt/GeometricMagic/GeometricMagicConfigUpdater.java index 265f862..52f6181 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicConfigUpdater.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicConfigUpdater.java @@ -22,6 +22,11 @@ import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import java.util.Scanner; // This class is basically intended for use as an automatic config updater, since // the normal saveConfig() screws up all of the formatting. Unfortunately, this @@ -47,7 +52,7 @@ public static void updateConfig(GeometricMagic instance) throws IOException { file.println("# DO NOT MODIFY THIS VALUE!"); file.println("version: 2.7.3"); file.println(); - file.println("GENERAL SECTION"); + file.println("# GENERAL SECTION"); file.println("general:"); file.println(); file.println(" # Automatic notification of plugin updates"); @@ -64,6 +69,82 @@ public static void updateConfig(GeometricMagic instance) throws IOException { return; } } + else if (plugin.getConfig().getString("version").equals("2.7.3")) { + System.out.println("[GeometricMagic] Updating config to v2.7.4..."); + List strList = new ArrayList(); + + File myFile = new File("plugins/GeometricMagic/config.yml"); + if (myFile.exists()) { + Scanner in = new Scanner(myFile); + while (in.hasNextLine()) { + String nextLine = in.nextLine(); + if (!nextLine.contains("version:") + && !nextLine.contains("# DO NOT MODIFY THIS VALUE!")) + strList.add(nextLine); + else + in.nextLine(); + } + in.close(); + + Files.delete(Paths.get("plugins/GeometricMagic/config.yml")); + PrintWriter out = new PrintWriter(new File("plugins/GeometricMagic/config.yml")); + for (String s : strList) { + out.println(s); + } + + out.println(); + out.println("# DO NOT MODIFY THIS VALUE!"); + out.println("version: 2.7.4"); + out.close(); + + plugin.reloadConfig(); + } + else + return; + + if (!isUpdated()) { + updateConfig(instance); + return; + } + } + else if (plugin.getConfig().getString("version").equals("2.7.4")) { + System.out.println("[GeometricMagic] Updating config to v2.7.5..."); + List strList = new ArrayList(); + + File myFile = new File("plugins/GeometricMagic/config.yml"); + if (myFile.exists()) { + Scanner in = new Scanner(myFile); + while (in.hasNextLine()) { + String nextLine = in.nextLine(); + if (!nextLine.contains("version:") + && !nextLine.contains("# DO NOT MODIFY THIS VALUE!")) + strList.add(nextLine); + else + in.nextLine(); + } + in.close(); + + Files.delete(Paths.get("plugins/GeometricMagic/config.yml")); + PrintWriter out = new PrintWriter(new File("plugins/GeometricMagic/config.yml")); + for (String s : strList) { + out.println(s); + } + + out.println(); + out.println("# DO NOT MODIFY THIS VALUE!"); + out.println("version: 2.7.5"); + out.close(); + + plugin.reloadConfig(); + } + else + return; + + if (!isUpdated()) { + updateConfig(instance); + return; + } + } } // If the config is updated else { diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index d587f6d..c1edd88 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -65,7 +65,7 @@ public void onPlayLogin(PlayerLoginEvent event) { final String playerName = event.getPlayer().getName(); if (event.getPlayer().hasPermission("geometricmagic.notify")) { - if (!plugin.upToDate) { + if (!plugin.upToDate && plugin.getConfig().getBoolean("general.auto-update-notify")) { plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { public void run() { From ff69a270d1b42842a4cf126b4fb05eeddfa50ba4 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Wed, 22 Aug 2012 19:42:42 -0400 Subject: [PATCH 116/133] Improved update notification message --- .../GeometricMagic/GeometricMagicPlayerListener.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index c1edd88..ba4b779 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -72,7 +72,13 @@ public void run() { if (plugin.getServer().getPlayer(playerName) != null) { plugin.getServer().getPlayer(playerName).sendMessage( ChatColor.GREEN - + "A newer version of GeometricMagic is available!"); + + "A newer version of"+ ChatColor.RED + + " GeometricMagic" + ChatColor.GREEN + + " is available!"); + plugin.getServer().getPlayer(playerName).sendMessage( + ChatColor.GREEN + + "If you cannot find a newer version," + + " check in the comments for a Dropbox link"); } } }, 60L); From 79dda14ada14914a609eb88f6aec8011d1128755 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Wed, 22 Aug 2012 19:45:39 -0400 Subject: [PATCH 117/133] Added console output when config first generates --- src/me/cakenggt/GeometricMagic/GeometricMagic.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagic.java b/src/me/cakenggt/GeometricMagic/GeometricMagic.java index 9b4e10a..bf3e901 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagic.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagic.java @@ -281,8 +281,10 @@ public void onEnable() { configFile = new File(getDataFolder(), "config.yml"); // Copy default config file if it doesn't exist - if (!configFile.exists()) + if (!configFile.exists()) { saveDefaultConfig(); + System.out.println("[GeometricMagic] Config file generated!"); + } else { try { GeometricMagicConfigUpdater.updateConfig(this); From 4e4346ffd4d5213973e786d72fff08b00868034e Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Wed, 22 Aug 2012 19:50:23 -0400 Subject: [PATCH 118/133] Replace all output using 'this' (except the enable and disable message) with a pure string instead --- src/me/cakenggt/GeometricMagic/GeometricMagic.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagic.java b/src/me/cakenggt/GeometricMagic/GeometricMagic.java index bf3e901..a0f7746 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagic.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagic.java @@ -297,10 +297,10 @@ public void onEnable() { if (getConfig().getString("transmutation.cost").toString().equalsIgnoreCase("vault")) { // Vault Support if (!setupEconomy()) { - System.out.println("[" + this + "] ERROR: You have your transmutation system set to Vault, and yet you don't have Vault. Disabling plugin!"); + System.out.println("[GeometricMagic] ERROR: You have your transmutation system set to Vault, and yet you don't have Vault. Disabling plugin!"); getServer().getPluginManager().disablePlugin(this); } else { - System.out.println("[" + this + "] Transmutation cost system set to Vault"); + System.out.println("[GeometricMagic] Transmutation cost system set to Vault"); // Register events playerListener = new GeometricMagicPlayerListener(this); @@ -314,7 +314,7 @@ public void onEnable() { } // Transmutation mode: XP else if (getConfig().getString("transmutation.cost").toString().equalsIgnoreCase("xp")) { - System.out.println("[" + this + "] Transmutation cost system set to XP"); + System.out.println("[GeometricMagic] Transmutation cost system set to XP"); // Register events playerListener = new GeometricMagicPlayerListener(this); @@ -327,7 +327,7 @@ else if (getConfig().getString("transmutation.cost").toString().equalsIgnoreCase } // Transmutation mode: Unknown else { - System.out.println("[" + this + "] ERROR: You have your transmutation cost system set to an unknown value. Disabling plugin!"); + System.out.println("[GeometricMagic] ERROR: You have your transmutation cost system set to an unknown value. Disabling plugin!"); getServer().getPluginManager().disablePlugin(this); } From 43a353102cf47f0ab3b75288600c867e9f5557f8 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Wed, 22 Aug 2012 19:57:33 -0400 Subject: [PATCH 119/133] Command aliases --- plugin.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index 6dd9b27..eb80fae 100644 --- a/plugin.yml +++ b/plugin.yml @@ -149,6 +149,7 @@ commands: description: This command sets a sacrifice's right-click circle. permission: geometricmagic.command.setcircle usage: "Hold the flint from your inventory in your hand and right-click to cast a set circle. Use /circles to list all set circles. To bind a set circle to the flint use /setcircle ####" + aliases: sc circles: description: This command displays a list of set circles. permission: geometricmagic.command.circles @@ -156,4 +157,5 @@ commands: geometricmagic: description: This command displays general plugin help or executes the given sub-command. permission: geometricmagic.command.geometricmagic - usage: "/geometricmagic [Sub-Command]" \ No newline at end of file + usage: "/geometricmagic [Sub-Command]" + aliases: [gem, geom, gmagic] \ No newline at end of file From 4078b0b83e72a8d257ade2bb2dcf84d64b7e8f69 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Thu, 23 Aug 2012 13:19:50 -0400 Subject: [PATCH 120/133] Prevent players from using items with set circle 1222 --- .../GeometricMagic/GeometricMagicPlayerListener.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index ba4b779..f38eeec 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -939,8 +939,11 @@ public static void setCircleEffects(Player player, World world, Block actBlock, if (entityList.get(i) instanceof Item) { Item droppedItem = (Item) entityList.get(i); - // if its redstone just skip it - if(droppedItem.getItemStack().getTypeId() == 331) continue; + // Skip items because they don't have values + if(droppedItem.getItemStack().getTypeId() > 255) { + player.sendMessage("You can't use items, only blocks"); + continue; + } // check if player has permission to break blocks here first if (!checkBlockBreakSimulation(droppedItem.getLocation(), player)) { From ec63b0de21074da8b7c48c0b73bb20f2596a6000 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sat, 25 Aug 2012 18:38:25 -0400 Subject: [PATCH 121/133] Refactoring --- .../GeometricMagicPlayerListener.java | 72 +++++++------------ 1 file changed, 24 insertions(+), 48 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index f38eeec..b429336 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -155,8 +155,7 @@ public static void isCircle(Player player, World world, Block actBlock) throws I // set circle cool down if (!player.hasPermission("geometricmagic.bypass.cooldown")) { - String coolDownConfig = plugin.getConfig().getString("setcircles.cooldown").toString(); - int coolDown = Integer.parseInt(coolDownConfig); + int coolDown = plugin.getConfig().getInt("setcircles.cooldown"); if (mapCoolDowns.containsKey(player.getName() + " set circle")) { long diff = (System.currentTimeMillis() - mapCoolDowns.get(player.getName() + " set circle")) / 1000; if (diff < coolDown) { @@ -275,8 +274,7 @@ public static void circleChooser(Player player, World world, Block actBlock) { // transmute cool down if (!player.hasPermission("geometricmagic.bypass.cooldown")) { - String coolDownConfig = plugin.getConfig().getString("transmutation.cooldown").toString(); - int coolDown = Integer.parseInt(coolDownConfig); + int coolDown = plugin.getConfig().getInt("transmutation.cooldown"); if (mapCoolDowns.containsKey(player.getName() + " transmute circle")) { long diff = (System.currentTimeMillis() - mapCoolDowns.get(player.getName() + " transmute circle")) / 1000; if (diff < coolDown) { @@ -317,8 +315,7 @@ public static void circleChooser(Player player, World world, Block actBlock) { if (player.hasPermission("geometricmagic.set")) { // set circle cool down if (!player.hasPermission("geometricmagic.bypass.cooldown")) { - String coolDownConfig = plugin.getConfig().getString("setcircles.cooldown").toString(); - int coolDown = Integer.parseInt(coolDownConfig); + int coolDown = plugin.getConfig().getInt("setcircles.cooldown"); if (mapCoolDowns.containsKey(player.getName() + " set circle")) { long diff = (System.currentTimeMillis() - mapCoolDowns.get(player.getName() + " set circle")) / 1000; if (diff < coolDown) { @@ -566,8 +563,7 @@ public static void microCircle(Player player, World world, Block actBlock) { } // Tell player when they can use a set circle - String coolDownConfig = plugin.getConfig().getString("setcircles.cooldown").toString(); - int coolDown = Integer.parseInt(coolDownConfig); + int coolDown = plugin.getConfig().getInt("setcircles.cooldown"); if (mapCoolDowns.containsKey(player.getName() + " set circle")) { long diff = (System.currentTimeMillis() - mapCoolDowns.get(player.getName() + " set circle")) / 1000; if (diff < coolDown) { @@ -583,8 +579,7 @@ public static void microCircle(Player player, World world, Block actBlock) { } // Tell player when they can use a transmute circle - coolDownConfig = plugin.getConfig().getString("transmutation.cooldown").toString(); - coolDown = Integer.parseInt(coolDownConfig); + coolDown = plugin.getConfig().getInt("transmutation.cooldown"); if (mapCoolDowns.containsKey(player.getName() + " transmute circle")) { long diff = (System.currentTimeMillis() - mapCoolDowns.get(player.getName() + " transmute circle")) / 1000; if (diff < coolDown) { @@ -917,8 +912,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, } } else if (arrayString.equals("[1, 2, 2, 2]") && player.hasPermission("geometricmagic.set.1222")) { - String costConfig = plugin.getConfig().getString("setcircles.1222.cost").toString(); - cost = Integer.parseInt(costConfig); + cost = plugin.getConfig().getInt("setcircles.1222.cost"); if (cost > 20) cost = 20; @@ -986,8 +980,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, } } else if (arrayString.equals("[1, 2, 3, 3]") && player.hasPermission("geometricmagic.set.1233")) { - String costConfig = plugin.getConfig().getString("setcircles.1233.cost").toString(); - cost = Integer.parseInt(costConfig); + cost = plugin.getConfig().getInt("setcircles.1233.cost"); if (cost > 20) cost = 20; @@ -1029,8 +1022,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, effectBlock.getWorld().dropItem(effectBlockLocation, diamondStack); } else if (arrayString.equals("[1, 2, 3, 4]") && player.hasPermission("geometricmagic.set.1234")) { - String costConfig = plugin.getConfig().getString("setcircles.1234.cost").toString(); - cost = Integer.parseInt(costConfig); + cost = plugin.getConfig().getInt("setcircles.1234.cost"); if (cost > 20) cost = 20; @@ -1043,8 +1035,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); } player.sendMessage(ChatColor.GREEN + "The four elements, like man alone, are weak. But together they form the strong fifth element: boron -Brother Silence"); - String amountConfig = plugin.getConfig().getString("setcircles.1234.amount").toString(); - int amount = Integer.parseInt(amountConfig); + int amount = plugin.getConfig().getInt("setcircles.1234.amount"); ItemStack oneRedstone = new ItemStack(331, amount); effectBlock.getWorld().dropItem(effectBlockLocation, oneRedstone); @@ -1055,8 +1046,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, } } else if (arrayString.equals("[2, 2, 2, 3]") && player.hasPermission("geometricmagic.set.2223")) { - String costConfig = plugin.getConfig().getString("setcircles.2223.cost").toString(); - cost = Integer.parseInt(costConfig); + cost = plugin.getConfig().getInt("setcircles.2223.cost"); if (cost > 20) cost = 20; @@ -1116,8 +1106,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, } } else if (arrayString.equals("[2, 2, 2, 4]") && player.hasPermission("geometricmagic.set.2224")) { - String costConfig = plugin.getConfig().getString("setcircles.2224.cost").toString(); - cost = Integer.parseInt(costConfig); + cost = plugin.getConfig().getInt("setcircles.2224.cost"); if (cost > 20) cost = 20; @@ -1138,8 +1127,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, return; } - String costConfig = plugin.getConfig().getString("setcircles.2244.cost").toString(); - cost = Integer.parseInt(costConfig); + cost = plugin.getConfig().getInt("setcircles.2244.cost"); if (cost > 20) cost = 20; @@ -1208,8 +1196,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, return; } else if (arrayString.equals("[2, 3, 3, 3]") && player.hasPermission("geometricmagic.set.2333")) { - String costConfig = plugin.getConfig().getString("setcircles.2333.cost").toString(); - cost = Integer.parseInt(costConfig); + cost = plugin.getConfig().getInt("setcircles.2333.cost"); if (cost > 20) cost = 20; @@ -1244,8 +1231,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, } } else if (arrayString.equals("[3, 3, 3, 4]") && player.hasPermission("geometricmagic.set.3334")) { - String costConfig = plugin.getConfig().getString("setcircles.3334.cost").toString(); - cost = Integer.parseInt(costConfig); + cost = plugin.getConfig().getInt("setcircles.3334.cost"); if (cost > 20) cost = 20; @@ -1258,8 +1244,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); } - String configSize = plugin.getConfig().getString("setcircles.3334.size").toString(); - Integer circleSize = Integer.parseInt(configSize); + Integer circleSize = plugin.getConfig().getInt("setcircles.3334.size"); alchemyFiller(Material.AIR, (byte) 0, Material.FIRE, (byte) 0, effectBlock.getRelative((circleSize / 2) * -1, 0, (circleSize / 2) * -1).getLocation(), effectBlock.getRelative(circleSize / 2, circleSize, circleSize / 2).getLocation(), player, false); @@ -1270,8 +1255,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, } } else if (arrayString.equals("[3, 3, 4, 4]") && player.hasPermission("geometricmagic.set.3344")) { - String costConfig = plugin.getConfig().getString("setcircles.3344.cost").toString(); - cost = Integer.parseInt(costConfig); + cost = plugin.getConfig().getInt("setcircles.3344.cost"); if (cost > 20) cost = 20; @@ -1306,8 +1290,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, } } else if (arrayString.equals("[3, 4, 4, 4]") && player.hasPermission("geometricmagic.set.3444")) { - String costConfig = plugin.getConfig().getString("setcircles.3444.cost").toString(); - cost = Integer.parseInt(costConfig); + cost = plugin.getConfig().getInt("setcircles.3444.cost"); if (cost > 20) cost = 20; @@ -1331,8 +1314,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, } else if (arrayString.equals("[0, 1, 1, 1]") && player.hasPermission("geometricmagic.set.0111")) { // using x111 because yml doesn't like 0 as first character - String costConfig = plugin.getConfig().getString("setcircles.x111.cost").toString(); - cost = Integer.parseInt(costConfig); + cost = plugin.getConfig().getInt("setcircles.x111.cost"); if (cost > 20) cost = 20; @@ -1376,8 +1358,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, } else if (arrayString.equals("[0, 0, 4, 4]") && player.hasPermission("geometricmagic.set.0044")) { // using x044 because yml doesn't like 0 as first character - String costConfig = plugin.getConfig().getString("setcircles.x044.cost").toString(); - cost = Integer.parseInt(costConfig); + cost = plugin.getConfig().getInt("setcircles.x044.cost"); if (cost > 20) cost = 20; @@ -1405,8 +1386,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, } else if (arrayString.equals("[0, 1, 4, 4]") && player.hasPermission("geometricmagic.set.0144")) { // using x144 because yml doesn't like 0 as first character - String costConfig = plugin.getConfig().getString("setcircles.x144.cost").toString(); - cost = Integer.parseInt(costConfig); + cost = plugin.getConfig().getInt("setcircles.x144.cost"); if (cost > 20) cost = 20; @@ -1434,8 +1414,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, } else if (arrayString.equals("[0, 2, 4, 4]") && player.hasPermission("geometricmagic.set.0244")) { // using x244 because yml doesn't like 0 as first character - String costConfig = plugin.getConfig().getString("setcircles.x244.cost").toString(); - cost = Integer.parseInt(costConfig); + cost = plugin.getConfig().getInt("setcircles.x244.cost"); if (cost > 20) cost = 20; @@ -1463,8 +1442,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, } else if (arrayString.equals("[0, 3, 4, 4]") && player.hasPermission("geometricmagic.set.0344")) { // using x344 because yml doesn't like 0 as first character - String costConfig = plugin.getConfig().getString("setcircles.x344.cost").toString(); - cost = Integer.parseInt(costConfig); + cost = plugin.getConfig().getInt("setcircles.x344.cost"); if (cost > 20) cost = 20; @@ -1497,8 +1475,7 @@ public static void setCircleEffects(Player player, World world, Block actBlock, public static int setCircleSize(Block actBlock) { // limit sizes - String limitSizeConfig = plugin.getConfig().getString("setcircles.limitsize").toString(); - int limitsize = Integer.parseInt(limitSizeConfig); + int limitsize = plugin.getConfig().getInt("setcircles.limitsize"); int na = 0, nb = 0, ea = 0, eb = 0, sa = 0, sb = 0, wa = 0, wb = 0, nc = 0, ec = 0, sc = 0, wc = 0; Block curBlock = actBlock.getRelative(0, 0, -5); @@ -1928,8 +1905,7 @@ public static double philosopherStoneModifier(Player player) { if (inventory.getItem(i) != null && inventory.getItem(i).getType() == Material.PORTAL) stackCount += inventory.getItem(i).getAmount(); } - String multiplier = plugin.getConfig().getString("philosopherstone.modifier").toString(); - float multiplierModifier = Float.parseFloat(multiplier); + float multiplierModifier = (float) plugin.getConfig().getDouble("philosopherstone.modifier"); modifier = 1 / (Math.pow(2, stackCount) * multiplierModifier); return modifier; From 15d9b24bc4ccc2dc2f2633b81cf292d48bc89f78 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sat, 25 Aug 2012 18:42:58 -0400 Subject: [PATCH 122/133] Even more refactoring (hopefully resulting in performance improvements) --- .../GeometricMagicPlayerListener.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index b429336..246c965 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -2004,7 +2004,7 @@ public static boolean checkBlockPlaceSimulation(Location target, int typeId, byt // Set the new state without physics. placedBlock.setTypeIdAndData(typeId, data, false); BlockPlaceEvent placeEvent = new BlockPlaceEvent(placedBlock, replacedBlockState, placedAgainst.getBlock(), null, player, true); - ((PluginManager) getPluginManager(plugin)).callEvent(placeEvent); + getPluginManager().callEvent(placeEvent); // Revert to the old state without physics. placedBlock.setTypeIdAndData(oldType, oldData, false); @@ -2016,7 +2016,7 @@ public static boolean checkBlockPlaceSimulation(Location target, int typeId, byt public static boolean checkBlockBreakSimulation(Location target, Player player) { Block block = target.getBlock(); BlockBreakEvent breakEvent = new BlockBreakEvent(block, player); - ((PluginManager) getPluginManager(plugin)).callEvent(breakEvent); + getPluginManager().callEvent(breakEvent); if (breakEvent.isCancelled()) return false; return true; @@ -2025,26 +2025,24 @@ public static boolean checkBlockBreakSimulation(Location target, Player player) // Lyneira's Code End public static boolean checkBreakBlacklist(int m) { - boolean ret = false; List blacklist = plugin.getConfig().getStringList("blacklist.break"); for (String s : blacklist) { if (s.equals(String.valueOf(m))) - ret = true; + return true; } - return ret; + return false; } public static boolean checkPlaceBlacklist(int m) { - boolean ret = false; List blacklist = plugin.getConfig().getStringList("blacklist.place"); for (String s : blacklist) { if (s.equals(String.valueOf(m))) - ret = true; + return true; } - return ret; + return false; } - public static Object getPluginManager(GeometricMagic plugin) { + public static PluginManager getPluginManager() { return plugin.getServer().getPluginManager(); } } From 93ad1b73dfaeb646a4471d98cc8b83ec50a0383a Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sat, 25 Aug 2012 19:30:48 -0400 Subject: [PATCH 123/133] Thread safety Remove unused code Start on transmutation threading --- .../GeometricMagic/GeometricMagic.java | 19 ++++--------------- .../GeometricMagicAutoUpdater.java | 2 +- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagic.java b/src/me/cakenggt/GeometricMagic/GeometricMagic.java index a0f7746..8b7530f 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagic.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagic.java @@ -40,7 +40,6 @@ public class GeometricMagic extends JavaPlugin { private Listener entityListener; private static Economy economy; File configFile; - public boolean autoUpdate; public boolean autoUpdateNotify; public boolean upToDate = true; @@ -334,23 +333,13 @@ else if (getConfig().getString("transmutation.cost").toString().equalsIgnoreCase // Plugin metrics startPluginMetrics(); - // Check auto-update-notify - if (getConfig().getBoolean("general.auto-update-notify")) { - if (getConfig().getBoolean("general.auto-update")) - autoUpdate = true; - else - autoUpdateNotify = true; - } - // Check auto-update - else if (getConfig().getBoolean("general.auto-update")) { - autoUpdate = true; - } - // Get plugin version for auto-update int pluginVersion = Integer.parseInt(this.getDescription().getVersion().replace(".", "")); - // Start auto-update - new Thread((new GeometricMagicAutoUpdater(this, pluginVersion))).start(); + // Start auto-update if applicable + if (getConfig().getBoolean("auto-update-notify")) { + new Thread((new GeometricMagicAutoUpdater(this, pluginVersion))).start(); + } } // Vault Support diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicAutoUpdater.java b/src/me/cakenggt/GeometricMagic/GeometricMagicAutoUpdater.java index 45fb0ca..10f6899 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicAutoUpdater.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicAutoUpdater.java @@ -35,7 +35,7 @@ public GeometricMagicAutoUpdater(GeometricMagic instance, int v) { } public void run() { - while (plugin.getConfig().getBoolean("general.auto-update-notify")) { + while (true) { String rawVersion = null; try { From f31ba00b91251a22080f16a7d25927c0512ad90d Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sat, 25 Aug 2012 23:08:15 -0400 Subject: [PATCH 124/133] Unfinished threading rewrite of transmutation --- config.yml | 3 + .../GeometricMagicPlayerListener.java | 222 +----------------- 2 files changed, 8 insertions(+), 217 deletions(-) diff --git a/config.yml b/config.yml index 42e9774..f824af9 100644 --- a/config.yml +++ b/config.yml @@ -28,6 +28,9 @@ general: # TRANSMUTATION SECTION transmutation: + # Rate (in milliseconds) at which blocks are updated + rate: 10 + # Cool down time between transmutations in seconds cooldown: 10 diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 246c965..88804f2 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -1550,6 +1550,7 @@ public static void alchemyCheck(Material a, byte fromData, Material b, byte toDa int xIteration = 0; int yIteration = 0; int zIteration = 0; + if (circleStart.getX() < circleEnd.getX()) { if (circleStart.getZ() < circleEnd.getZ()) { // east @@ -1650,85 +1651,10 @@ public static void alchemyCheck(Material a, byte fromData, Material b, byte toDa public static void alchemyFiller(Material a, byte fromData, Material b, byte toData, Location start, Location end, Player player, boolean charge) { // System.out.println("alchemyFiller"); - Block startBlock = start.getBlock(); - int xIteration = 0; - int yIteration = 0; - int zIteration = 0; - - if (start.getX() < end.getX()) { - if (start.getZ() < end.getZ()) { - // east - // System.out.println("alchemyFiller east"); - while (startBlock.getY() <= end.getY()) { - while (startBlock.getX() <= end.getX()) { - while (startBlock.getZ() <= end.getZ()) { - transmuteBlock(a, fromData, b, toData, startBlock, player, charge); - startBlock = startBlock.getRelative(0, 0, 1); - } - xIteration++; - startBlock = start.getBlock().getRelative(xIteration, yIteration, 0); - } - yIteration++; - xIteration = 0; - startBlock = start.getBlock().getRelative(0, yIteration, 0); - } - } else { - // north - // System.out.println("alchemyFiller north"); - while (startBlock.getY() <= end.getY()) { - while (startBlock.getZ() >= end.getZ()) { - while (startBlock.getX() <= end.getX()) { - transmuteBlock(a, fromData, b, toData, startBlock, player, charge); - startBlock = startBlock.getRelative(1, 0, 0); - } - zIteration--; - startBlock = start.getBlock().getRelative(0, yIteration, zIteration); - } - yIteration++; - zIteration = 0; - startBlock = start.getBlock().getRelative(0, yIteration, 0); - } - } - } else { - if (start.getZ() > end.getZ()) { - // west - // System.out.println("alchemyFiller west"); - while (startBlock.getY() <= end.getY()) { - while (startBlock.getX() >= end.getX()) { - while (startBlock.getZ() >= end.getZ()) { - transmuteBlock(a, fromData, b, toData, startBlock, player, charge); - startBlock = startBlock.getRelative(0, 0, -1); - } - xIteration--; - startBlock = start.getBlock().getRelative(xIteration, yIteration, 0); - } - yIteration++; - xIteration = 0; - startBlock = start.getBlock().getRelative(0, yIteration, 0); - } - } else { - // south - // System.out.println("alchemyFiller south"); - while (startBlock.getY() <= end.getY()) { - while (startBlock.getZ() <= end.getZ()) { - while (startBlock.getX() >= end.getX()) { - transmuteBlock(a, fromData, b, toData, startBlock, player, charge); - startBlock = startBlock.getRelative(-1, 0, 0); - // System.out.println("xloopfiller"); - } - zIteration++; - // System.out.println("zloopfiller"); - startBlock = start.getBlock().getRelative(0, yIteration, zIteration); - } - yIteration++; - // System.out.println("yloopfiller"); - zIteration = 0; - startBlock = start.getBlock().getRelative(0, yIteration, 0); - } - } - } - - return; + String playerName = player.getName(); + long rate = plugin.getConfig().getLong("transmutation.rate"); + + new Thread(new GeometricMagicTransmutationThread(plugin, rate, a, fromData, b, toData, start, end, playerName, charge)).start(); } public static double getBalance(Player player) { @@ -1747,144 +1673,6 @@ public static double getBalance(Player player) { return 0; } - public static void transmuteBlock(Material a, byte fromData, Material b, byte toData, Block startBlock, Player player, boolean charge) { - - double pay = calculatePay(a, fromData, b, toData, player); - - if (startBlock.getType() == a && startBlock.getData() == fromData) { - - if (-1 * getBalance(player) < pay || !charge) { - - // Block break - if (a != Material.AIR && b == Material.AIR) { - - if (!checkBreakBlacklist(a.getId())) { - - Location blockLocation = startBlock.getLocation(); - - if (checkBlockBreakSimulation(blockLocation, player)) { - // Change block - startBlock.setType(b); - if (toData != 0) - startBlock.setData(toData); - - if (charge) { - if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { - - Economy econ = GeometricMagic.getEconomy(); - - // Deposit or withdraw to players Vault account - if (pay > 0) { - econ.depositPlayer(player.getName(), pay); - } else if (pay < 0) { - econ.withdrawPlayer(player.getName(), pay * -1); - } - } else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { - player.setLevel((int) (player.getLevel() + pay)); - } - } - } - } - - else { - player.sendMessage(ChatColor.RED + "[GeometricMagic] That block is blacklisted"); - return; - } - - } - - // Block place - else if (a == Material.AIR && b != Material.AIR) { - - if (!checkPlaceBlacklist(b.getId())) { - - Location blockLocation = startBlock.getLocation(); - int blockID = b.getId(); - byte blockData = toData; - - if (checkBlockPlaceSimulation(blockLocation, blockID, blockData, blockLocation, player)) { - // Change block - startBlock.setType(b); - if (toData != 0) - startBlock.setData(toData); - - if (charge) { - if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { - - Economy econ = GeometricMagic.getEconomy(); - - // Deposit or withdraw to players Vault account - if (pay > 0) { - econ.depositPlayer(player.getName(), pay); - } else if (pay < 0) { - econ.withdrawPlayer(player.getName(), pay * -1); - } - } else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { - player.setLevel((int) (player.getLevel() + pay)); - } - } - } - } - - else { - player.sendMessage(ChatColor.RED + "[GeometricMagic] That block is blacklisted"); - return; - } - } - - // Block break and place - else if (a != Material.AIR && b != Material.AIR) { - - if (!checkBreakBlacklist(a.getId()) && !checkPlaceBlacklist(b.getId())) { - - Location blockLocation = startBlock.getLocation(); - int blockID = b.getId(); - byte blockData = toData; - - if (checkBlockBreakSimulation(blockLocation, player) && checkBlockPlaceSimulation(blockLocation, blockID, blockData, blockLocation, player)) { - // Change block - startBlock.setType(b); - if (toData != 0) - startBlock.setData(toData); - - if (charge) { - if (getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { - - Economy econ = GeometricMagic.getEconomy(); - - // Deposit or withdraw to players Vault account - if (pay > 0) { - econ.depositPlayer(player.getName(), pay); - } else if (pay < 0) { - econ.withdrawPlayer(player.getName(), pay * -1); - } - } else if (getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { - player.setLevel((int) (player.getLevel() + pay)); - } - } - } - } - - else { - player.sendMessage(ChatColor.RED + "[GeometricMagic] That block is blacklisted"); - return; - } - - } - - // output to console - else if ((a != Material.AIR && b != Material.AIR) || a == Material.MOB_SPAWNER || b == Material.MOB_SPAWNER) { - System.out.println("[GeometricMagic] " + player.getName() + " tried to transmute a blacklisted material:"); - System.out.println("[GeometricMagic] " + a.name() + " into " + b.name()); - } - return; - } else - return; - } else - // System.out.println("[GeometricMagic] DEBUG - Block Data: " + (int) startBlock.getData() + ", A Data: " + (int) fromData + ", B Data: " + (int) toData); - return; - } - public static double calculatePay(Material a, byte fromData , Material b, byte toData , Player player) { double pay = (getBlockValue(plugin, a.getId(), (int) fromData) - getBlockValue(plugin, b.getId(), (int) toData)); From f94a5d9485d6dc025d3b4611eb90d8af7dd22f9a Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sat, 25 Aug 2012 23:08:51 -0400 Subject: [PATCH 125/133] Unfinished threading rewrite of transmutation --- .../GeometricMagicTransmutationThread.java | 339 ++++++++++++++++++ 1 file changed, 339 insertions(+) create mode 100644 src/me/cakenggt/GeometricMagic/GeometricMagicTransmutationThread.java diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicTransmutationThread.java b/src/me/cakenggt/GeometricMagic/GeometricMagicTransmutationThread.java new file mode 100644 index 0000000..b1704d8 --- /dev/null +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicTransmutationThread.java @@ -0,0 +1,339 @@ +/** + * GeometricMagic allows players to draw redstone circles on the ground to do things such as teleport and transmute blocks. + * Copyright (C) 2012 Alec Cox (cakenggt), Andrew Stevanus (Hoot215) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package me.cakenggt.GeometricMagic; + +import net.h31ix.anticheat.api.AnticheatAPI; +import net.h31ix.anticheat.manage.CheckType; +import net.milkbowl.vault.economy.Economy; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +public class GeometricMagicTransmutationThread implements Runnable { + private GeometricMagic plugin; + private long rate; + private Material a; + private byte fromData; + private Material b; + private byte toData; + private Location start; + private Location end; + private String playerName; + private boolean charge; + + public GeometricMagicTransmutationThread(GeometricMagic instance, + long rateLong, + Material aMat, + byte fromDataByte, + Material bMat, + byte toDataByte, + Location startLoc, + Location endLoc, + String playerNameString, + boolean chargeBool) { + plugin = instance; + rate = rateLong; + a = aMat; + fromData = fromDataByte; + b = bMat; + toData = toDataByte; + start = startLoc; + end = endLoc; + playerName = playerNameString; + charge = chargeBool; + } + + public void run() { + int xIteration = 0; + int yIteration = 0; + int zIteration = 0; + final Location startOriginal = start; + + if (startOriginal.getX() < end.getX()) { + if (startOriginal.getZ() < end.getZ()) { + // east + // System.out.println("alchemyFiller east"); + while (start.getY() <= end.getY()) { + while (start.getX() <= end.getX()) { + while (start.getZ() <= end.getZ()) { + transmuteBlock(a, fromData, b, toData, start, playerName, charge); + try { + Thread.sleep(rate); + } catch (InterruptedException e) { + e.printStackTrace(); + } + start = start.add(0, 0, 1); + } + xIteration++; + start = startOriginal.add(xIteration, yIteration, 0); + } + yIteration++; + xIteration = 0; + start = startOriginal.add(0, yIteration, 0); + } + } else { + // north + // System.out.println("alchemyFiller north"); + while (start.getY() <= end.getY()) { + while (start.getZ() >= end.getZ()) { + while (start.getX() <= end.getX()) { + transmuteBlock(a, fromData, b, toData, start, playerName, charge); + try { + Thread.sleep(rate); + } catch (InterruptedException e) { + e.printStackTrace(); + } + start = start.add(1, 0, 0); + } + zIteration--; + start = startOriginal.add(0, yIteration, zIteration); + } + yIteration++; + zIteration = 0; + start = startOriginal.add(0, yIteration, 0); + } + } + } else { + if (startOriginal.getZ() > end.getZ()) { + // west + // System.out.println("alchemyFiller west"); + while (start.getY() <= end.getY()) { + while (start.getX() >= end.getX()) { + while (start.getZ() >= end.getZ()) { + transmuteBlock(a, fromData, b, toData, start, playerName, charge); + try { + Thread.sleep(rate); + } catch (InterruptedException e) { + e.printStackTrace(); + } + start = start.add(0, 0, -1); + } + xIteration--; + start = startOriginal.add(xIteration, yIteration, 0); + } + yIteration++; + xIteration = 0; + start = startOriginal.add(0, yIteration, 0); + } + } else { + // south + // System.out.println("alchemyFiller south"); + while (start.getY() <= end.getY()) { + while (start.getZ() <= end.getZ()) { + while (start.getX() >= end.getX()) { + transmuteBlock(a, fromData, b, toData, start, playerName, charge); + try { + Thread.sleep(rate); + } catch (InterruptedException e) { + e.printStackTrace(); + } + start = start.add(-1, 0, 0); + // System.out.println("xloopfiller"); + } + zIteration++; + // System.out.println("zloopfiller"); + start = startOriginal.add(0, yIteration, zIteration); + } + yIteration++; + // System.out.println("yloopfiller"); + zIteration = 0; + start = startOriginal.add(0, yIteration, 0); + } + } + } + + return; + } + + public void transmuteBlock(final Material a, final byte fromData, final Material b, final byte toData, + final Location startBlockLoc, final String playerName, final boolean charge) { + System.out.println("[DEBUG] transmuteBlock void"); + + plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { + public void run() { + System.out.println("[DEBUG] Scheduled task"); + Player player = plugin.getServer().getPlayer(playerName); + Block startBlock = startBlockLoc.getBlock(); + double pay = GeometricMagicPlayerListener.calculatePay(a, fromData, b, toData, player); + + // exempt player from AntiCheat check + if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.exemptPlayer(player, CheckType.LONG_REACH); + AnticheatAPI.exemptPlayer(player, CheckType.NO_SWING); + } + + if (player != null) { + System.out.println("[DEBUG] Player != null"); + System.out.println("[DEBUG] startBlockType=" + startBlock.getType().toString() + ", a=" + a.toString() + ", startBlockData=" + String.valueOf(startBlock.getData()) + ", fromData=" + String.valueOf(fromData)); + if (startBlock.getType() == a && startBlock.getData() == fromData) { + System.out.println("[DEBUG] startBlock = A"); + + if (-1 * GeometricMagicPlayerListener.getBalance(player) < pay || !charge) { + System.out.println("[DEBUG] -1 * bal < pay || !charge"); + + // Block break + if (a != Material.AIR && b == Material.AIR) { + System.out.println("[DEBUG] Break"); + + if (!GeometricMagicPlayerListener.checkBreakBlacklist(a.getId())) { + + Location blockLocation = startBlock.getLocation(); + + if (GeometricMagicPlayerListener.checkBlockBreakSimulation(blockLocation, player)) { + // Change block + startBlock.setType(b); + if (toData != 0) + startBlock.setData(toData); + + if (charge) { + if (GeometricMagicPlayerListener.getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { + + Economy econ = GeometricMagic.getEconomy(); + + // Deposit or withdraw to players Vault account + if (pay > 0) { + econ.depositPlayer(player.getName(), pay); + } else if (pay < 0) { + econ.withdrawPlayer(player.getName(), pay * -1); + } + } else if (GeometricMagicPlayerListener.getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + player.setLevel((int) (player.getLevel() + pay)); + } + } + } + } + + else { + player.sendMessage(ChatColor.RED + "[GeometricMagic] That block is blacklisted"); + return; + } + } + + // Block place + else if (a == Material.AIR && b != Material.AIR) { + System.out.println("[DEBUG] Place"); + + if (!GeometricMagicPlayerListener.checkPlaceBlacklist(b.getId())) { + + Location blockLocation = startBlock.getLocation(); + int blockID = b.getId(); + byte blockData = toData; + + if (GeometricMagicPlayerListener.checkBlockPlaceSimulation(blockLocation, blockID, blockData, blockLocation, player)) { + // Change block + startBlock.setType(b); + if (toData != 0) + startBlock.setData(toData); + + if (charge) { + if (GeometricMagicPlayerListener.getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { + + Economy econ = GeometricMagic.getEconomy(); + + // Deposit or withdraw to players Vault account + if (pay > 0) { + econ.depositPlayer(player.getName(), pay); + } else if (pay < 0) { + econ.withdrawPlayer(player.getName(), pay * -1); + } + } else if (GeometricMagicPlayerListener.getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + player.setLevel((int) (player.getLevel() + pay)); + } + } + } + } + + else { + player.sendMessage(ChatColor.RED + "[GeometricMagic] That block is blacklisted"); + return; + } + } + + // Block break and place + else if (a != Material.AIR && b != Material.AIR) { + System.out.println("[DEBUG] Break and place"); + + if (!GeometricMagicPlayerListener.checkBreakBlacklist(a.getId()) && !GeometricMagicPlayerListener.checkPlaceBlacklist(b.getId())) { + + Location blockLocation = startBlock.getLocation(); + int blockID = b.getId(); + byte blockData = toData; + + if (GeometricMagicPlayerListener.checkBlockBreakSimulation(blockLocation, player) + && GeometricMagicPlayerListener.checkBlockPlaceSimulation(blockLocation, blockID, blockData, blockLocation, player)) { + // Change block + startBlock.setType(b); + if (toData != 0) + startBlock.setData(toData); + + if (charge) { + if (GeometricMagicPlayerListener.getTransmutationCostSystem(plugin).equalsIgnoreCase("vault")) { + + Economy econ = GeometricMagic.getEconomy(); + + // Deposit or withdraw to players Vault account + if (pay > 0) { + econ.depositPlayer(player.getName(), pay); + } else if (pay < 0) { + econ.withdrawPlayer(player.getName(), pay * -1); + } + } else if (GeometricMagicPlayerListener.getTransmutationCostSystem(plugin).equalsIgnoreCase("xp")) { + player.setLevel((int) (player.getLevel() + pay)); + } + } + } + } + + else { + player.sendMessage(ChatColor.RED + "[GeometricMagic] That block is blacklisted"); + return; + } + + } + + // output to console + else if ((a != Material.AIR && b != Material.AIR) || a == Material.MOB_SPAWNER || b == Material.MOB_SPAWNER) { + System.out.println("[GeometricMagic] " + player.getName() + " tried to transmute a blacklisted material:"); + System.out.println("[GeometricMagic] " + a.name() + " into " + b.name()); + } + return; + } else + return; + } else + // System.out.println("[GeometricMagic] DEBUG - Block Data: " + (int) startBlock.getData() + ", A Data: " + (int) fromData + ", B Data: " + (int) toData); + return; + } + + // unexempt player from AntiCheat check + if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + AnticheatAPI.unexemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.unexemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.unexemptPlayer(player, CheckType.LONG_REACH); + AnticheatAPI.unexemptPlayer(player, CheckType.NO_SWING); + } + } + }, 0L); + } +} \ No newline at end of file From 6306f2f2934b5b762dc95c5a78976e885d7f1bdf Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sun, 26 Aug 2012 01:04:49 -0400 Subject: [PATCH 126/133] Unfinished threading rewrite of transmutation --- .../GeometricMagicPlayerListener.java | 1 - .../GeometricMagicTransmutationThread.java | 96 +++++++------------ 2 files changed, 32 insertions(+), 65 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 88804f2..12c8f3a 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -1550,7 +1550,6 @@ public static void alchemyCheck(Material a, byte fromData, Material b, byte toDa int xIteration = 0; int yIteration = 0; int zIteration = 0; - if (circleStart.getX() < circleEnd.getX()) { if (circleStart.getZ() < circleEnd.getZ()) { // east diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicTransmutationThread.java b/src/me/cakenggt/GeometricMagic/GeometricMagicTransmutationThread.java index b1704d8..bbcc740 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicTransmutationThread.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicTransmutationThread.java @@ -64,105 +64,73 @@ public GeometricMagicTransmutationThread(GeometricMagic instance, } public void run() { - int xIteration = 0; - int yIteration = 0; - int zIteration = 0; - final Location startOriginal = start; - - if (startOriginal.getX() < end.getX()) { - if (startOriginal.getZ() < end.getZ()) { - // east - // System.out.println("alchemyFiller east"); - while (start.getY() <= end.getY()) { - while (start.getX() <= end.getX()) { - while (start.getZ() <= end.getZ()) { - transmuteBlock(a, fromData, b, toData, start, playerName, charge); + System.out.println("[DEBUG] start: " + start.toString()); + System.out.println("[DEBUG] end: " + end.toString()); + + if (start.getX() < end.getX()) { + if (start.getZ() < end.getZ()) { + for (int x = (int) start.getX(); x < end.getX(); x++) { + for (int y = (int) start.getY(); y < end.getY(); y++) { + for (int z = (int) start.getZ(); z < end.getZ(); z++) { + Location loc = new Location(start.getWorld(), (double) x, (double) y, (double) z); + transmuteBlock(a, fromData, b, toData, loc, playerName, charge); try { Thread.sleep(rate); } catch (InterruptedException e) { e.printStackTrace(); } - start = start.add(0, 0, 1); } - xIteration++; - start = startOriginal.add(xIteration, yIteration, 0); } - yIteration++; - xIteration = 0; - start = startOriginal.add(0, yIteration, 0); } - } else { - // north - // System.out.println("alchemyFiller north"); - while (start.getY() <= end.getY()) { - while (start.getZ() >= end.getZ()) { - while (start.getX() <= end.getX()) { - transmuteBlock(a, fromData, b, toData, start, playerName, charge); + } + else { + for (int x = (int) start.getX(); x < end.getX(); x++) { + for (int y = (int) start.getY(); y < end.getY(); y++) { + for (int z = (int) start.getZ(); z > end.getZ(); z--) { + Location loc = new Location(start.getWorld(), (double) x, (double) y, (double) z); + transmuteBlock(a, fromData, b, toData, loc, playerName, charge); try { Thread.sleep(rate); } catch (InterruptedException e) { e.printStackTrace(); } - start = start.add(1, 0, 0); } - zIteration--; - start = startOriginal.add(0, yIteration, zIteration); } - yIteration++; - zIteration = 0; - start = startOriginal.add(0, yIteration, 0); } } - } else { - if (startOriginal.getZ() > end.getZ()) { - // west - // System.out.println("alchemyFiller west"); - while (start.getY() <= end.getY()) { - while (start.getX() >= end.getX()) { - while (start.getZ() >= end.getZ()) { - transmuteBlock(a, fromData, b, toData, start, playerName, charge); + } + else { + if (start.getZ() < end.getZ()) { + for (int x = (int) start.getX(); x > end.getX(); x--) { + for (int y = (int) start.getY(); y < end.getY(); y++) { + for (int z = (int) start.getZ(); z < end.getZ(); z++) { + Location loc = new Location(start.getWorld(), (double) x, (double) y, (double) z); + transmuteBlock(a, fromData, b, toData, loc, playerName, charge); try { Thread.sleep(rate); } catch (InterruptedException e) { e.printStackTrace(); } - start = start.add(0, 0, -1); } - xIteration--; - start = startOriginal.add(xIteration, yIteration, 0); } - yIteration++; - xIteration = 0; - start = startOriginal.add(0, yIteration, 0); } - } else { - // south - // System.out.println("alchemyFiller south"); - while (start.getY() <= end.getY()) { - while (start.getZ() <= end.getZ()) { - while (start.getX() >= end.getX()) { - transmuteBlock(a, fromData, b, toData, start, playerName, charge); + } + else { + for (int x = (int) start.getX(); x > end.getX(); x++) { + for (int y = (int) start.getY(); y < end.getY(); y++) { + for (int z = (int) start.getZ(); z > end.getZ(); z++) { + Location loc = new Location(start.getWorld(), (double) x, (double) y, (double) z); + transmuteBlock(a, fromData, b, toData, loc, playerName, charge); try { Thread.sleep(rate); } catch (InterruptedException e) { e.printStackTrace(); } - start = start.add(-1, 0, 0); - // System.out.println("xloopfiller"); } - zIteration++; - // System.out.println("zloopfiller"); - start = startOriginal.add(0, yIteration, zIteration); } - yIteration++; - // System.out.println("yloopfiller"); - zIteration = 0; - start = startOriginal.add(0, yIteration, 0); } } } - - return; } public void transmuteBlock(final Material a, final byte fromData, final Material b, final byte toData, From c0f25e1258bffa5827237c82dc4becd6fa6f1223 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sun, 26 Aug 2012 15:13:21 -0400 Subject: [PATCH 127/133] Completed transmutation threading overhaul --- .../GeometricMagicTransmutationThread.java | 47 ++++++------------- 1 file changed, 15 insertions(+), 32 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicTransmutationThread.java b/src/me/cakenggt/GeometricMagic/GeometricMagicTransmutationThread.java index bbcc740..19c005f 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicTransmutationThread.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicTransmutationThread.java @@ -64,14 +64,11 @@ public GeometricMagicTransmutationThread(GeometricMagic instance, } public void run() { - System.out.println("[DEBUG] start: " + start.toString()); - System.out.println("[DEBUG] end: " + end.toString()); - if (start.getX() < end.getX()) { if (start.getZ() < end.getZ()) { - for (int x = (int) start.getX(); x < end.getX(); x++) { - for (int y = (int) start.getY(); y < end.getY(); y++) { - for (int z = (int) start.getZ(); z < end.getZ(); z++) { + for (int x = (int) start.getX(); x <= end.getX(); x++) { + for (int y = (int) start.getY(); y <= end.getY(); y++) { + for (int z = (int) start.getZ(); z <= end.getZ(); z++) { Location loc = new Location(start.getWorld(), (double) x, (double) y, (double) z); transmuteBlock(a, fromData, b, toData, loc, playerName, charge); try { @@ -84,9 +81,9 @@ public void run() { } } else { - for (int x = (int) start.getX(); x < end.getX(); x++) { - for (int y = (int) start.getY(); y < end.getY(); y++) { - for (int z = (int) start.getZ(); z > end.getZ(); z--) { + for (int x = (int) start.getX(); x <= end.getX(); x++) { + for (int y = (int) start.getY(); y <= end.getY(); y++) { + for (int z = (int) start.getZ(); z >= end.getZ(); z--) { Location loc = new Location(start.getWorld(), (double) x, (double) y, (double) z); transmuteBlock(a, fromData, b, toData, loc, playerName, charge); try { @@ -101,9 +98,9 @@ public void run() { } else { if (start.getZ() < end.getZ()) { - for (int x = (int) start.getX(); x > end.getX(); x--) { - for (int y = (int) start.getY(); y < end.getY(); y++) { - for (int z = (int) start.getZ(); z < end.getZ(); z++) { + for (int x = (int) start.getX(); x >= end.getX(); x--) { + for (int y = (int) start.getY(); y <= end.getY(); y++) { + for (int z = (int) start.getZ(); z <= end.getZ(); z++) { Location loc = new Location(start.getWorld(), (double) x, (double) y, (double) z); transmuteBlock(a, fromData, b, toData, loc, playerName, charge); try { @@ -116,9 +113,9 @@ public void run() { } } else { - for (int x = (int) start.getX(); x > end.getX(); x++) { - for (int y = (int) start.getY(); y < end.getY(); y++) { - for (int z = (int) start.getZ(); z > end.getZ(); z++) { + for (int x = (int) start.getX(); x >= end.getX(); x--) { + for (int y = (int) start.getY(); y <= end.getY(); y++) { + for (int z = (int) start.getZ(); z >= end.getZ(); z--) { Location loc = new Location(start.getWorld(), (double) x, (double) y, (double) z); transmuteBlock(a, fromData, b, toData, loc, playerName, charge); try { @@ -135,11 +132,9 @@ public void run() { public void transmuteBlock(final Material a, final byte fromData, final Material b, final byte toData, final Location startBlockLoc, final String playerName, final boolean charge) { - System.out.println("[DEBUG] transmuteBlock void"); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { public void run() { - System.out.println("[DEBUG] Scheduled task"); Player player = plugin.getServer().getPlayer(playerName); Block startBlock = startBlockLoc.getBlock(); double pay = GeometricMagicPlayerListener.calculatePay(a, fromData, b, toData, player); @@ -153,17 +148,12 @@ public void run() { } if (player != null) { - System.out.println("[DEBUG] Player != null"); - System.out.println("[DEBUG] startBlockType=" + startBlock.getType().toString() + ", a=" + a.toString() + ", startBlockData=" + String.valueOf(startBlock.getData()) + ", fromData=" + String.valueOf(fromData)); if (startBlock.getType() == a && startBlock.getData() == fromData) { - System.out.println("[DEBUG] startBlock = A"); if (-1 * GeometricMagicPlayerListener.getBalance(player) < pay || !charge) { - System.out.println("[DEBUG] -1 * bal < pay || !charge"); // Block break if (a != Material.AIR && b == Material.AIR) { - System.out.println("[DEBUG] Break"); if (!GeometricMagicPlayerListener.checkBreakBlacklist(a.getId())) { @@ -201,7 +191,6 @@ public void run() { // Block place else if (a == Material.AIR && b != Material.AIR) { - System.out.println("[DEBUG] Place"); if (!GeometricMagicPlayerListener.checkPlaceBlacklist(b.getId())) { @@ -241,7 +230,6 @@ else if (a == Material.AIR && b != Material.AIR) { // Block break and place else if (a != Material.AIR && b != Material.AIR) { - System.out.println("[DEBUG] Break and place"); if (!GeometricMagicPlayerListener.checkBreakBlacklist(a.getId()) && !GeometricMagicPlayerListener.checkPlaceBlacklist(b.getId())) { @@ -280,15 +268,10 @@ else if (a != Material.AIR && b != Material.AIR) { } } - - // output to console - else if ((a != Material.AIR && b != Material.AIR) || a == Material.MOB_SPAWNER || b == Material.MOB_SPAWNER) { - System.out.println("[GeometricMagic] " + player.getName() + " tried to transmute a blacklisted material:"); - System.out.println("[GeometricMagic] " + a.name() + " into " + b.name()); - } - return; - } else + } else { + player.sendMessage(ChatColor.RED + "You do not have enough power to create that block"); return; + } } else // System.out.println("[GeometricMagic] DEBUG - Block Data: " + (int) startBlock.getData() + ", A Data: " + (int) fromData + ", B Data: " + (int) toData); return; From 1d2d157f72880eefb278a13a5d32cb0ecd42da5f Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Sun, 26 Aug 2012 15:27:32 -0400 Subject: [PATCH 128/133] v2.7.6 --- config.yml | 2 +- plugin.yml | 2 +- .../GeometricMagicConfigUpdater.java | 64 +++++++++++++++++++ 3 files changed, 66 insertions(+), 2 deletions(-) diff --git a/config.yml b/config.yml index f824af9..f3f3ab8 100644 --- a/config.yml +++ b/config.yml @@ -17,7 +17,7 @@ # # DO NOT MODIFY THIS VALUE! -version: 2.7.5 +version: 2.7.6 # GENERAL SECTION general: diff --git a/plugin.yml b/plugin.yml index eb80fae..391a75b 100644 --- a/plugin.yml +++ b/plugin.yml @@ -18,7 +18,7 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.7.5 +version: 2.7.6 authors: [cakenggt, Hoot215] softdepend: [Vault, AntiCheat] permissions: diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicConfigUpdater.java b/src/me/cakenggt/GeometricMagic/GeometricMagicConfigUpdater.java index 52f6181..df86698 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicConfigUpdater.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicConfigUpdater.java @@ -145,6 +145,70 @@ else if (plugin.getConfig().getString("version").equals("2.7.4")) { return; } } + else if (plugin.getConfig().getString("version").equals("2.7.5")) { + System.out.println("[GeometricMagic] Updating config to v2.7.6..."); + List strList = new ArrayList(); + + File myFile = new File("plugins/GeometricMagic/config.yml"); + if (myFile.exists()) { + Scanner in = new Scanner(myFile); + while (in.hasNextLine()) { + String nextLine = in.nextLine(); + if (!nextLine.contains("version:") + && !nextLine.contains("# DO NOT MODIFY THIS VALUE!") + && !nextLine.contains("# TRANSMUTATION SECTION") + && !nextLine.contains("transmutation:") + && !nextLine.contains(" # Cool down time between transmutations in seconds") + && !nextLine.contains(" cooldown:") + && !nextLine.contains(" # What system to use for transmutation cost") + && !nextLine.contains(" # Possible values: xp, vault (requires Vault)") + && !nextLine.contains(" cost: xp") + && !nextLine.contains(" # Apply Philosopher's Stone to transmutes (true or false)") + && !nextLine.contains(" stone: true")) + strList.add(nextLine); + else + in.nextLine(); + } + in.close(); + + Files.delete(Paths.get("plugins/GeometricMagic/config.yml")); + PrintWriter out = new PrintWriter(new File("plugins/GeometricMagic/config.yml")); + for (String s : strList) { + out.println(s); + } + + out.println(); + out.println("# DO NOT MODIFY THIS VALUE!"); + out.println("version: 2.7.6"); + out.println(); + out.println("# TRANSMUTATION SECTION"); + out.println("transmutation:"); + out.println(); + out.println(" # Rate (in milliseconds) at which blocks are updated"); + out.println(" rate: 10"); + out.println(); + out.println(" # Cool down time between transmutations in seconds"); + out.println(" cooldown: 10"); + out.println(); + out.println(" # What system to use for transmutation cost"); + out.println(" # Possible values: xp, vault (requires Vault)"); + out.println(" cost: xp"); + out.println(); + out.println(" # Apply Philosopher's Stone to transmutes (true or false)"); + out.println(" stone: true"); + out.println(); + out.close(); + + plugin.reloadConfig(); + } + else + return; + + if (!isUpdated()) { + updateConfig(instance); + return; + } + } } // If the config is updated else { From aa8f682a511d664e784043f428a122c26eead714 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Mon, 27 Aug 2012 21:44:30 -0400 Subject: [PATCH 129/133] Set circle 1111 (Spawn Weapon) --- config.yml | 8 +++++ plugin.yml | 3 ++ .../GeometricMagicPlayerListener.java | 32 ++++++++++++++++++- 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/config.yml b/config.yml index f3f3ab8..93a6ed6 100644 --- a/config.yml +++ b/config.yml @@ -53,6 +53,14 @@ setcircles: # Limit number of nearby arrows to check limitarrows: 3 + # Spawn weapon circle + 1111: + # The cost of this circle in hunger + cost: 5 + # The item ID to be given to the player + # Default: Iron sword + item: 267 + # Repair Circle 1133: [] diff --git a/plugin.yml b/plugin.yml index 391a75b..a635dde 100644 --- a/plugin.yml +++ b/plugin.yml @@ -81,6 +81,7 @@ permissions: geometricmagic.set.*: description: Allows you to use all set circles children: + geometricmagic.set.1111: true geometricmagic.set.1133: true geometricmagic.set.1222: true geometricmagic.set.1233: true @@ -97,6 +98,8 @@ permissions: geometricmagic.set.0144: true geometricmagic.set.0244: true geometricmagic.set.0344: true + geometricmagic.set.1111: + description: Allows you to use set circle 1111 geometricmagic.set.1133: description: Allows you to use set circle 1133 geometricmagic.set.1222: diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 12c8f3a..19aa03d 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -812,11 +812,41 @@ public static void setCircleEffects(Player player, World world, Block actBlock, } if (arrayString.equals("0")) return; - if (arrayString.equals("[1, 1, 3, 3]") && player.hasPermission("geometricmagic.set.1133")) { + if (arrayString.equals("[1, 1, 1, 1]") && player.hasPermission("geometricmagic.set.1111")) { if (!hasLearnedCircle(player, arrayString)) { player.sendMessage("You have not yet learned circle " + arrayString + "!"); return; } + + cost = plugin.getConfig().getInt("setcircles.1222.cost"); + if (cost > 20) + cost = 20; + + if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + if (!player.hasPermission("geometricmagic.bypass.hunger")) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + } + + int itemID = plugin.getConfig().getInt("setcircles.1111.item"); + ItemStack item = new ItemStack(itemID); + effectBlock.getWorld().dropItem(effectBlockLocation, item); + + } else { + player.sendMessage("You feel so hungry..."); + return; + } + } + else if (arrayString.equals("[1, 1, 3, 3]") && player.hasPermission("geometricmagic.set.1133")) { + if (!hasLearnedCircle(player, arrayString)) { + player.sendMessage("You have not yet learned circle " + arrayString + "!"); + return; + } + + if (player.getFoodLevel() >= (cost * philosopherStoneModifier(player))) { + if (!player.hasPermission("geometricmagic.bypass.hunger")) { + player.setFoodLevel((int) (player.getFoodLevel() - (cost * philosopherStoneModifier(player)))); + } + } int count = 0; List repairEntities = player.getNearbyEntities(9, 10, 9); From 27cbd43ed4c9f8bf617280c5a3ad90864677ac09 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Wed, 29 Aug 2012 16:35:51 -0400 Subject: [PATCH 130/133] Remove unneeded AntiCheat exemption --- .../GeometricMagicPlayerListener.java | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index 19aa03d..e1ca430 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -287,23 +287,7 @@ public static void circleChooser(Player player, World world, Block actBlock) { } if (circleSize > 0) { - // exempt player from AntiCheat check - if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { - AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); - AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); - AnticheatAPI.exemptPlayer(player, CheckType.LONG_REACH); - AnticheatAPI.exemptPlayer(player, CheckType.NO_SWING); - } - transmutationCircle(player, world, actBlock, circleSize); - - // unexempt player from AntiCheat check - if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { - AnticheatAPI.unexemptPlayer(player, CheckType.FAST_PLACE); - AnticheatAPI.unexemptPlayer(player, CheckType.FAST_BREAK); - AnticheatAPI.unexemptPlayer(player, CheckType.LONG_REACH); - AnticheatAPI.unexemptPlayer(player, CheckType.NO_SWING); - } } // set circle From 8459a38ee278199d3d22f12d083d18106249953a Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Wed, 29 Aug 2012 17:05:37 -0400 Subject: [PATCH 131/133] Check for the 'prongs' in the transmutation circle --- .../GeometricMagicPlayerListener.java | 116 ++++++++++-------- 1 file changed, 64 insertions(+), 52 deletions(-) diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index e1ca430..b550c3b 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -616,37 +616,43 @@ public static void transmutationCircle(Player player, World world, Block actBloc int dimensionOfEffect = (fullWidth - 2) * (fullWidth - 2); if (actBlock.getRelative((fullWidth - 1), 0, 0).getType() == Material.REDSTONE_WIRE) { // east - Block fromBlock = actBlock.getLocation().add(halfWidth - 1, 0, -1 * (halfWidth + 1)).getBlock(); - Block toBlock = actBlock.getLocation().add(halfWidth - 1, 0, halfWidth + 1).getBlock(); - fromType = fromBlock.getType(); - toType = toBlock.getType(); - byte fromData = fromBlock.getData(); - byte toData = toBlock.getData(); - startLoc = actBlock.getLocation().add(fullWidth, 0, -1 * dimensionOfEffect / 2); - // System.out.println(startLoc); - endLoc = actBlock.getLocation().add(fullWidth + dimensionOfEffect - 1, dimensionOfEffect - 1, dimensionOfEffect / 2 - 1); - // System.out.println(endLoc); - circleStart = actBlock.getLocation().add(1, 0, -1 * (halfWidth - 2)); - // System.out.println(circleStart); - circleEnd = actBlock.getLocation().add(fullWidth - 2, fullWidth - 3, halfWidth - 2); - // System.out.println(circleEnd); - alchemyCheck(fromType, fromData, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); - lightning = true; + if (actBlock.getRelative((halfWidth - 1), 0, halfWidth).getType() == Material.REDSTONE_WIRE + && actBlock.getRelative((halfWidth - 1), 0, (-1 * halfWidth)).getType() == Material.REDSTONE_WIRE) { + Block fromBlock = actBlock.getLocation().add(halfWidth - 1, 0, -1 * (halfWidth + 1)).getBlock(); + Block toBlock = actBlock.getLocation().add(halfWidth - 1, 0, halfWidth + 1).getBlock(); + fromType = fromBlock.getType(); + toType = toBlock.getType(); + byte fromData = fromBlock.getData(); + byte toData = toBlock.getData(); + startLoc = actBlock.getLocation().add(fullWidth, 0, -1 * dimensionOfEffect / 2); + // System.out.println(startLoc); + endLoc = actBlock.getLocation().add(fullWidth + dimensionOfEffect - 1, dimensionOfEffect - 1, dimensionOfEffect / 2 - 1); + // System.out.println(endLoc); + circleStart = actBlock.getLocation().add(1, 0, -1 * (halfWidth - 2)); + // System.out.println(circleStart); + circleEnd = actBlock.getLocation().add(fullWidth - 2, fullWidth - 3, halfWidth - 2); + // System.out.println(circleEnd); + alchemyCheck(fromType, fromData, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); + lightning = true; + } } else if (actBlock.getRelative(-1 * (fullWidth - 1), 0, 0).getType() == Material.REDSTONE_WIRE) { // west // System.out.println("transmutationCircle west"); - Block fromBlock = actBlock.getLocation().add(-1 * (halfWidth - 1), 0, halfWidth + 1).getBlock(); - Block toBlock = actBlock.getLocation().add((-1) * (halfWidth - 1), 0, (-1) * (halfWidth + 1)).getBlock(); - fromType = fromBlock.getType(); - toType = toBlock.getType(); - byte fromData = fromBlock.getData(); - byte toData = toBlock.getData(); - startLoc = actBlock.getLocation().add(-1 * fullWidth, 0, dimensionOfEffect / 2); - endLoc = actBlock.getLocation().add(-1 * (fullWidth + dimensionOfEffect) + 1, dimensionOfEffect - 1, -1 * dimensionOfEffect / 2 + 1); - circleStart = actBlock.getLocation().add(-1, 0, (halfWidth - 2)); - circleEnd = actBlock.getLocation().add(-1 * (fullWidth - 2), fullWidth - 3, -1 * (halfWidth - 2)); - alchemyCheck(fromType, fromData, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); - lightning = true; + if (actBlock.getRelative((-1 * (halfWidth - 1)), 0, halfWidth).getType() == Material.REDSTONE_WIRE + && actBlock.getRelative((-1 * (halfWidth - 1)), 0, (-1 * halfWidth)).getType() == Material.REDSTONE_WIRE) { + Block fromBlock = actBlock.getLocation().add(-1 * (halfWidth - 1), 0, halfWidth + 1).getBlock(); + Block toBlock = actBlock.getLocation().add((-1) * (halfWidth - 1), 0, (-1) * (halfWidth + 1)).getBlock(); + fromType = fromBlock.getType(); + toType = toBlock.getType(); + byte fromData = fromBlock.getData(); + byte toData = toBlock.getData(); + startLoc = actBlock.getLocation().add(-1 * fullWidth, 0, dimensionOfEffect / 2); + endLoc = actBlock.getLocation().add(-1 * (fullWidth + dimensionOfEffect) + 1, dimensionOfEffect - 1, -1 * dimensionOfEffect / 2 + 1); + circleStart = actBlock.getLocation().add(-1, 0, (halfWidth - 2)); + circleEnd = actBlock.getLocation().add(-1 * (fullWidth - 2), fullWidth - 3, -1 * (halfWidth - 2)); + alchemyCheck(fromType, fromData, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); + lightning = true; + } } } else if (actBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE) { halfWidth = 0; @@ -663,33 +669,39 @@ public static void transmutationCircle(Player player, World world, Block actBloc if (actBlock.getRelative(0, 0, -1 * (fullWidth - 1)).getType() == Material.REDSTONE_WIRE) { // north // System.out.println("transmutationCircle north"); - Block fromBlock = actBlock.getLocation().add(-1 * (halfWidth + 1), 0, -1 * (halfWidth - 1)).getBlock(); - Block toBlock = actBlock.getLocation().add(halfWidth + 1, 0, -1 * (halfWidth - 1)).getBlock(); - fromType = fromBlock.getType(); - toType = toBlock.getType(); - byte fromData = fromBlock.getData(); - byte toData = toBlock.getData(); - startLoc = actBlock.getLocation().add(-1 * dimensionOfEffect / 2, 0, -1 * fullWidth); - endLoc = actBlock.getLocation().add(dimensionOfEffect / 2 - 1, dimensionOfEffect - 1, -1 * (dimensionOfEffect + fullWidth) + 1); - circleStart = actBlock.getLocation().add(-1 * (halfWidth - 2), 0, -1); - circleEnd = actBlock.getLocation().add((halfWidth - 2), fullWidth - 3, -1 * (fullWidth - 2)); - alchemyCheck(fromType, fromData, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); - lightning = true; + if (actBlock.getRelative(halfWidth, 0, (-1 * (halfWidth - 1))).getType() == Material.REDSTONE_WIRE + && actBlock.getRelative((-1 * halfWidth), 0, (-1 * (halfWidth - 1))).getType() == Material.REDSTONE_WIRE) { + Block fromBlock = actBlock.getLocation().add(-1 * (halfWidth + 1), 0, -1 * (halfWidth - 1)).getBlock(); + Block toBlock = actBlock.getLocation().add(halfWidth + 1, 0, -1 * (halfWidth - 1)).getBlock(); + fromType = fromBlock.getType(); + toType = toBlock.getType(); + byte fromData = fromBlock.getData(); + byte toData = toBlock.getData(); + startLoc = actBlock.getLocation().add(-1 * dimensionOfEffect / 2, 0, -1 * fullWidth); + endLoc = actBlock.getLocation().add(dimensionOfEffect / 2 - 1, dimensionOfEffect - 1, -1 * (dimensionOfEffect + fullWidth) + 1); + circleStart = actBlock.getLocation().add(-1 * (halfWidth - 2), 0, -1); + circleEnd = actBlock.getLocation().add((halfWidth - 2), fullWidth - 3, -1 * (fullWidth - 2)); + alchemyCheck(fromType, fromData, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); + lightning = true; + } } else if (actBlock.getRelative(0, 0, (fullWidth - 1)).getType() == Material.REDSTONE_WIRE) { // south // System.out.println("transmutationCircle south"); - Block fromBlock = actBlock.getLocation().add(halfWidth + 1, 0, halfWidth - 1).getBlock(); - Block toBlock = actBlock.getLocation().add(-1 * (halfWidth + 1), 0, halfWidth - 1).getBlock(); - fromType = fromBlock.getType(); - toType = toBlock.getType(); - byte fromData = fromBlock.getData(); - byte toData = toBlock.getData(); - startLoc = actBlock.getLocation().add(dimensionOfEffect / 2, 0, fullWidth); - endLoc = actBlock.getLocation().add(-1 * dimensionOfEffect / 2 + 1, dimensionOfEffect - 1, fullWidth + dimensionOfEffect - 1); - circleStart = actBlock.getLocation().add(halfWidth - 2, 0, 1); - circleEnd = actBlock.getLocation().add(-1 * (halfWidth - 2), fullWidth - 3, (fullWidth - 2)); - alchemyCheck(fromType, fromData, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); - lightning = true; + if (actBlock.getRelative(halfWidth, 0, (halfWidth -1)).getType() == Material.REDSTONE_WIRE + && actBlock.getRelative((-1 * halfWidth), 0, (halfWidth -1)).getType() == Material.REDSTONE_WIRE) { + Block fromBlock = actBlock.getLocation().add(halfWidth + 1, 0, halfWidth - 1).getBlock(); + Block toBlock = actBlock.getLocation().add(-1 * (halfWidth + 1), 0, halfWidth - 1).getBlock(); + fromType = fromBlock.getType(); + toType = toBlock.getType(); + byte fromData = fromBlock.getData(); + byte toData = toBlock.getData(); + startLoc = actBlock.getLocation().add(dimensionOfEffect / 2, 0, fullWidth); + endLoc = actBlock.getLocation().add(-1 * dimensionOfEffect / 2 + 1, dimensionOfEffect - 1, fullWidth + dimensionOfEffect - 1); + circleStart = actBlock.getLocation().add(halfWidth - 2, 0, 1); + circleEnd = actBlock.getLocation().add(-1 * (halfWidth - 2), fullWidth - 3, (fullWidth - 2)); + alchemyCheck(fromType, fromData, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); + lightning = true; + } } } if (lightning) From 5662ccd0110aa6f722f865c7cef5745bbceea251 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Wed, 29 Aug 2012 21:34:36 -0400 Subject: [PATCH 132/133] Storage circles --- plugin.yml | 19 + .../GeometricMagicPlayerListener.java | 512 +++++++++++++++++- 2 files changed, 515 insertions(+), 16 deletions(-) diff --git a/plugin.yml b/plugin.yml index a635dde..1b609d2 100644 --- a/plugin.yml +++ b/plugin.yml @@ -40,6 +40,7 @@ permissions: geometricmagic.teleportation: true geometricmagic.micro: true geometricmagic.transmutation.1: true + geometricmagic.storage.*: true geometricmagic.set: true geometricmagic.command.geometricmagic: true geometricmagic.teleportation: @@ -64,6 +65,24 @@ permissions: description: Allows you to use transmutation circles of size 7 geometricmagic.transmutation.9: description: Allows you to use transmutation circles of size 9 + geometricmagic.storage.*: + description: Allows you to use all storage circles + children: + geometricmagic.storage.1: true + geometricmagic.storage.3: true + geometricmagic.storage.5: true + geometricmagic.storage.7: true + geometricmagic.storage.9: true + geometricmagic.storage.1: + description: Allows you to use storage circles of size 1 + geometricmagic.storage.3: + description: Allows you to use storage circles of size 3 + geometricmagic.storage.5: + description: Allows you to use storage circles of size 5 + geometricmagic.storage.7: + description: Allows you to use storage circles of size 7 + geometricmagic.storage.9: + description: Allows you to use storage circles of size 9 geometricmagic.set: description: Allows you to use all set circles and set circle commands children: diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java index b550c3b..046de92 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicPlayerListener.java @@ -254,21 +254,40 @@ public static void circleChooser(Player player, World world, Block actBlock) { // transmutation circle size permissions // - allows use of all circles smaller than then the max // size permission node they have - int circleSize = 1; - if (player.hasPermission("geometricmagic.transmutation.*") || player.hasPermission("geometricmagic.transmutation.9")) { - circleSize = 9; + int transmutationCircleSize = 1; + if (player.hasPermission("geometricmagic.transmutation.9")) { + transmutationCircleSize = 9; } else if (player.hasPermission("geometricmagic.transmutation.7")) { - circleSize = 7; + transmutationCircleSize = 7; } else if (player.hasPermission("geometricmagic.transmutation.5")) { - circleSize = 5; + transmutationCircleSize = 5; } else if (player.hasPermission("geometricmagic.transmutation.3")) { - circleSize = 3; + transmutationCircleSize = 3; } else if (player.hasPermission("geometricmagic.transmutation.1")) { - circleSize = 1; + transmutationCircleSize = 1; } else { - circleSize = 0; + transmutationCircleSize = 0; player.sendMessage("You do not have permission to use this circle"); } + + // Storage circle size permissions + int storageCircleSize = 1; + if (player.hasPermission("geometricmagic.storage.9")) { + storageCircleSize = 9; + } else if (player.hasPermission("geometricmagic.storage.7")) { + storageCircleSize = 7; + } else if (player.hasPermission("geometricmagic.storage.5")) { + storageCircleSize = 5; + } else if (player.hasPermission("geometricmagic.storage.3")) { + storageCircleSize = 3; + } else if (player.hasPermission("geometricmagic.storage.1")) { + storageCircleSize = 1; + } else { + storageCircleSize = 0; + player.sendMessage("You do not have permission to use this circle"); + } + + int circleSize = (transmutationCircleSize > storageCircleSize) ? transmutationCircleSize : storageCircleSize; // System.out.println("circleSize:" + circleSize); @@ -287,7 +306,7 @@ public static void circleChooser(Player player, World world, Block actBlock) { } if (circleSize > 0) { - transmutationCircle(player, world, actBlock, circleSize); + transmutationCircle(player, world, actBlock, transmutationCircleSize, storageCircleSize); } // set circle @@ -594,7 +613,7 @@ public static void microCircle(Player player, World world, Block actBlock) { } } - public static void transmutationCircle(Player player, World world, Block actBlock, int circleSize) { + public static void transmutationCircle(Player player, World world, Block actBlock, int transmutationCircleSize, int storageCircleSize) { int halfWidth = 0; int fullWidth = 0; Location startLoc = actBlock.getLocation(); @@ -607,9 +626,6 @@ public static void transmutationCircle(Player player, World world, Block actBloc if (actBlock.getRelative(0, 0, -1).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(0, 0, 1).getType() == Material.REDSTONE_WIRE) { halfWidth = 0; while (actBlock.getRelative(0, 0, -1 * halfWidth).getType() == Material.REDSTONE_WIRE) { - if (halfWidth > circleSize) { - break; - } halfWidth++; } fullWidth = (halfWidth * 2) - 1; @@ -618,6 +634,9 @@ public static void transmutationCircle(Player player, World world, Block actBloc // east if (actBlock.getRelative((halfWidth - 1), 0, halfWidth).getType() == Material.REDSTONE_WIRE && actBlock.getRelative((halfWidth - 1), 0, (-1 * halfWidth)).getType() == Material.REDSTONE_WIRE) { + if (fullWidth - 2 > transmutationCircleSize) { + return; + } Block fromBlock = actBlock.getLocation().add(halfWidth - 1, 0, -1 * (halfWidth + 1)).getBlock(); Block toBlock = actBlock.getLocation().add(halfWidth - 1, 0, halfWidth + 1).getBlock(); fromType = fromBlock.getType(); @@ -635,11 +654,24 @@ public static void transmutationCircle(Player player, World world, Block actBloc alchemyCheck(fromType, fromData, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); lightning = true; } + // Storage circle + else { + if (fullWidth - 2 > storageCircleSize) { + return; + } + startLoc = actBlock.getLocation().add(1, 0, (-1 * (halfWidth - 2))); + endLoc = actBlock.getLocation().add((fullWidth - 2), (fullWidth - 3), (halfWidth - 2)); + storageCircle(startLoc, endLoc, player, (fullWidth - 2)); + lightning = true; + } } else if (actBlock.getRelative(-1 * (fullWidth - 1), 0, 0).getType() == Material.REDSTONE_WIRE) { // west // System.out.println("transmutationCircle west"); if (actBlock.getRelative((-1 * (halfWidth - 1)), 0, halfWidth).getType() == Material.REDSTONE_WIRE && actBlock.getRelative((-1 * (halfWidth - 1)), 0, (-1 * halfWidth)).getType() == Material.REDSTONE_WIRE) { + if (fullWidth - 2 > transmutationCircleSize) { + return; + } Block fromBlock = actBlock.getLocation().add(-1 * (halfWidth - 1), 0, halfWidth + 1).getBlock(); Block toBlock = actBlock.getLocation().add((-1) * (halfWidth - 1), 0, (-1) * (halfWidth + 1)).getBlock(); fromType = fromBlock.getType(); @@ -653,13 +685,20 @@ public static void transmutationCircle(Player player, World world, Block actBloc alchemyCheck(fromType, fromData, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); lightning = true; } + // Storage circle + else { + if (fullWidth - 2 > storageCircleSize) { + return; + } + startLoc = actBlock.getLocation().add(-1, 0, (halfWidth - 2)); + endLoc = actBlock.getLocation().add((-1 * (fullWidth - 2)), (fullWidth - 3), (-1 * (halfWidth - 2))); + storageCircle(startLoc, endLoc, player, (fullWidth - 2)); + lightning = true; + } } } else if (actBlock.getRelative(1, 0, 0).getType() == Material.REDSTONE_WIRE && actBlock.getRelative(-1, 0, 0).getType() == Material.REDSTONE_WIRE) { halfWidth = 0; while (actBlock.getRelative(halfWidth, 0, 0).getType() == Material.REDSTONE_WIRE) { - if (halfWidth > circleSize) { - break; - } halfWidth++; } fullWidth = (halfWidth * 2) - 1; @@ -671,6 +710,9 @@ public static void transmutationCircle(Player player, World world, Block actBloc // System.out.println("transmutationCircle north"); if (actBlock.getRelative(halfWidth, 0, (-1 * (halfWidth - 1))).getType() == Material.REDSTONE_WIRE && actBlock.getRelative((-1 * halfWidth), 0, (-1 * (halfWidth - 1))).getType() == Material.REDSTONE_WIRE) { + if (fullWidth - 2 > transmutationCircleSize) { + return; + } Block fromBlock = actBlock.getLocation().add(-1 * (halfWidth + 1), 0, -1 * (halfWidth - 1)).getBlock(); Block toBlock = actBlock.getLocation().add(halfWidth + 1, 0, -1 * (halfWidth - 1)).getBlock(); fromType = fromBlock.getType(); @@ -684,11 +726,24 @@ public static void transmutationCircle(Player player, World world, Block actBloc alchemyCheck(fromType, fromData, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); lightning = true; } + // Storage circle + else { + if (fullWidth - 2 > storageCircleSize) { + return; + } + startLoc = actBlock.getLocation().add((halfWidth - 2), 0, -1); + endLoc = actBlock.getLocation().add((halfWidth - 2), (fullWidth - 3), (-1 * (fullWidth - 2))); + storageCircle(startLoc, endLoc, player, (fullWidth - 2)); + lightning = true; + } } else if (actBlock.getRelative(0, 0, (fullWidth - 1)).getType() == Material.REDSTONE_WIRE) { // south // System.out.println("transmutationCircle south"); if (actBlock.getRelative(halfWidth, 0, (halfWidth -1)).getType() == Material.REDSTONE_WIRE && actBlock.getRelative((-1 * halfWidth), 0, (halfWidth -1)).getType() == Material.REDSTONE_WIRE) { + if (fullWidth - 2 > transmutationCircleSize) { + return; + } Block fromBlock = actBlock.getLocation().add(halfWidth + 1, 0, halfWidth - 1).getBlock(); Block toBlock = actBlock.getLocation().add(-1 * (halfWidth + 1), 0, halfWidth - 1).getBlock(); fromType = fromBlock.getType(); @@ -702,6 +757,16 @@ public static void transmutationCircle(Player player, World world, Block actBloc alchemyCheck(fromType, fromData, toType, toData, circleStart, circleEnd, startLoc, endLoc, player, fullWidth - 2); lightning = true; } + // Storage circle + else { + if (fullWidth - 2 > storageCircleSize) { + return; + } + startLoc = actBlock.getLocation().add((halfWidth - 2), 0, 1); + endLoc = actBlock.getLocation().add((-1 * (halfWidth - 2)), (fullWidth - 3), (fullWidth - 2)); + storageCircle(startLoc, endLoc, player, (fullWidth - 2)); + lightning = true; + } } } if (lightning) @@ -1798,7 +1863,422 @@ public static boolean learnCircle(Player player, String circle, Block actBlock) redStack.remove(); return status; } + + public static void storageCircle(Location startLoc, Location endLoc, Player player, int size) { + File folder = new File("plugins/GeometricMagic/storage/"); + File file = new File("plugins/GeometricMagic/storage/" + player.getName() + "." + String.valueOf(size)); + if (folder.exists()) { + // Load blocks + if (file.exists()) { + try { + // exempt player from AntiCheat check + if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.exemptPlayer(player, CheckType.LONG_REACH); + AnticheatAPI.exemptPlayer(player, CheckType.NO_SWING); + } + + storageCircleLoad(startLoc, endLoc, player, size, file); + + // unexempt player from AntiCheat check + if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + AnticheatAPI.unexemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.unexemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.unexemptPlayer(player, CheckType.LONG_REACH); + AnticheatAPI.unexemptPlayer(player, CheckType.NO_SWING); + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + } + // Store blocks + else { + try { + // exempt player from AntiCheat check + if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.exemptPlayer(player, CheckType.LONG_REACH); + AnticheatAPI.exemptPlayer(player, CheckType.NO_SWING); + } + + storageCircleStore(startLoc, endLoc, player, size, file); + + // unexempt player from AntiCheat check + if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + AnticheatAPI.unexemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.unexemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.unexemptPlayer(player, CheckType.LONG_REACH); + AnticheatAPI.unexemptPlayer(player, CheckType.NO_SWING); + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + } + } + else { + // Store blocks + if(folder.mkdirs()) { + try { + // exempt player from AntiCheat check + if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + AnticheatAPI.exemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.exemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.exemptPlayer(player, CheckType.LONG_REACH); + AnticheatAPI.exemptPlayer(player, CheckType.NO_SWING); + } + + storageCircleStore(startLoc, endLoc, player, size, file); + + // unexempt player from AntiCheat check + if (Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null) { + AnticheatAPI.unexemptPlayer(player, CheckType.FAST_PLACE); + AnticheatAPI.unexemptPlayer(player, CheckType.FAST_BREAK); + AnticheatAPI.unexemptPlayer(player, CheckType.LONG_REACH); + AnticheatAPI.unexemptPlayer(player, CheckType.NO_SWING); + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + } + else + System.out.println("[GeometricMagic] Error creating necessary folder(s)!" + + " Check your read/write permissions"); + } + } + public static void storageCircleLoad(Location startLoc, Location endLoc, Player player, int size, File file) throws FileNotFoundException { + World world = player.getWorld(); + Scanner in = new Scanner(file); + + if (startLoc.getBlockX() > endLoc.getBlockX()) { + if (startLoc.getBlockZ() > endLoc.getBlockZ()) { + for (int x = startLoc.getBlockX(); x >= endLoc.getBlockX(); x--) { + for (int y = startLoc.getBlockY(); y <= endLoc.getBlockY(); y++) { + for (int z = startLoc.getBlockZ(); z >= endLoc.getBlockZ(); z--) { + Location loc = new Location(world, x, y, z); + Block block = loc.getBlock(); + String newBlockString = in.next(); + String[] newBlockStringArray = newBlockString.split(","); + int newBlockID = Integer.parseInt(newBlockStringArray[0]); + byte newBlockData = Byte.parseByte(newBlockStringArray[1]); + + // Block break + if (block.getTypeId() != 0 && newBlockID == 0) { + if (!checkBreakBlacklist(block.getTypeId())) { + if (checkBlockBreakSimulation(loc, player)) { + block.setTypeId(newBlockID); + block.setData(newBlockData); + } + } + else { + player.sendMessage(ChatColor.RED + "[GeometricMagic] That block is blacklisted"); + } + } + // Block place + else if (block.getTypeId() == 0 && newBlockID != 0) { + if (!checkPlaceBlacklist(newBlockID)) { + if (checkBlockPlaceSimulation(loc, newBlockID, newBlockData, loc, player)) { + block.setTypeId(newBlockID); + block.setData(newBlockData); + } + } + else { + player.sendMessage(ChatColor.RED + "[GeometricMagic] That block is blacklisted"); + } + } + // Block break and place + else if (block.getTypeId() != 0 && newBlockID != 0) { + if (!checkBreakBlacklist(block.getTypeId()) && !checkPlaceBlacklist(newBlockID)) { + if (checkBlockBreakSimulation(loc, player) && checkBlockPlaceSimulation(loc, newBlockID, newBlockData, loc, player)) { + block.setTypeId(newBlockID); + block.setData(newBlockData); + } + } + else { + player.sendMessage(ChatColor.RED + "[GeometricMagic] That block is blacklisted"); + } + } + } + } + } + } + else { + for (int x = startLoc.getBlockX(); x >= endLoc.getBlockX(); x--) { + for (int y = startLoc.getBlockY(); y <= endLoc.getBlockY(); y++) { + for (int z = startLoc.getBlockZ(); z <= endLoc.getBlockZ(); z++) { + Location loc = new Location(world, x, y, z); + Block block = loc.getBlock(); + String newBlockString = in.next(); + String[] newBlockStringArray = newBlockString.split(","); + int newBlockID = Integer.parseInt(newBlockStringArray[0]); + byte newBlockData = Byte.parseByte(newBlockStringArray[1]); + + // Block break + if (block.getTypeId() != 0 && newBlockID == 0) { + if (!checkBreakBlacklist(block.getTypeId())) { + if (checkBlockBreakSimulation(loc, player)) { + block.setTypeId(newBlockID); + block.setData(newBlockData); + } + } + else { + player.sendMessage(ChatColor.RED + "[GeometricMagic] That block is blacklisted"); + } + } + // Block place + else if (block.getTypeId() == 0 && newBlockID != 0) { + if (!checkPlaceBlacklist(newBlockID)) { + if (checkBlockPlaceSimulation(loc, newBlockID, newBlockData, loc, player)) { + block.setTypeId(newBlockID); + block.setData(newBlockData); + } + } + else { + player.sendMessage(ChatColor.RED + "[GeometricMagic] That block is blacklisted"); + } + } + // Block break and place + else if (block.getTypeId() != 0 && newBlockID != 0) { + if (!checkBreakBlacklist(block.getTypeId()) && !checkPlaceBlacklist(newBlockID)) { + if (checkBlockBreakSimulation(loc, player) && checkBlockPlaceSimulation(loc, newBlockID, newBlockData, loc, player)) { + block.setTypeId(newBlockID); + block.setData(newBlockData); + } + } + else { + player.sendMessage(ChatColor.RED + "[GeometricMagic] That block is blacklisted"); + } + } + } + } + } + } + } + else { + if (startLoc.getBlockZ() > endLoc.getBlockZ()) { + for (int x = startLoc.getBlockX(); x <= endLoc.getBlockX(); x++) { + for (int y = startLoc.getBlockY(); y <= endLoc.getBlockY(); y++) { + for (int z = startLoc.getBlockZ(); z >= endLoc.getBlockZ(); z--) { + Location loc = new Location(world, x, y, z); + Block block = loc.getBlock(); + String newBlockString = in.next(); + String[] newBlockStringArray = newBlockString.split(","); + int newBlockID = Integer.parseInt(newBlockStringArray[0]); + byte newBlockData = Byte.parseByte(newBlockStringArray[1]); + + // Block break + if (block.getTypeId() != 0 && newBlockID == 0) { + if (!checkBreakBlacklist(block.getTypeId())) { + if (checkBlockBreakSimulation(loc, player)) { + block.setTypeId(newBlockID); + block.setData(newBlockData); + } + } + else { + player.sendMessage(ChatColor.RED + "[GeometricMagic] That block is blacklisted"); + } + } + // Block place + else if (block.getTypeId() == 0 && newBlockID != 0) { + if (!checkPlaceBlacklist(newBlockID)) { + if (checkBlockPlaceSimulation(loc, newBlockID, newBlockData, loc, player)) { + block.setTypeId(newBlockID); + block.setData(newBlockData); + } + } + else { + player.sendMessage(ChatColor.RED + "[GeometricMagic] That block is blacklisted"); + } + } + // Block break and place + else if (block.getTypeId() != 0 && newBlockID != 0) { + if (!checkBreakBlacklist(block.getTypeId()) && !checkPlaceBlacklist(newBlockID)) { + if (checkBlockBreakSimulation(loc, player) && checkBlockPlaceSimulation(loc, newBlockID, newBlockData, loc, player)) { + block.setTypeId(newBlockID); + block.setData(newBlockData); + } + } + else { + player.sendMessage(ChatColor.RED + "[GeometricMagic] That block is blacklisted"); + } + } + } + } + } + } + else { + for (int x = startLoc.getBlockX(); x <= endLoc.getBlockX(); x++) { + for (int y = startLoc.getBlockY(); y <= endLoc.getBlockY(); y++) { + for (int z = startLoc.getBlockZ(); z <= endLoc.getBlockZ(); z++) { + Location loc = new Location(world, x, y, z); + Block block = loc.getBlock(); + String newBlockString = in.next(); + String[] newBlockStringArray = newBlockString.split(","); + int newBlockID = Integer.parseInt(newBlockStringArray[0]); + byte newBlockData = Byte.parseByte(newBlockStringArray[1]); + + // Block break + if (block.getTypeId() != 0 && newBlockID == 0) { + if (!checkBreakBlacklist(block.getTypeId())) { + if (checkBlockBreakSimulation(loc, player)) { + block.setTypeId(newBlockID); + block.setData(newBlockData); + } + } + else { + player.sendMessage(ChatColor.RED + "[GeometricMagic] That block is blacklisted"); + } + } + // Block place + else if (block.getTypeId() == 0 && newBlockID != 0) { + if (!checkPlaceBlacklist(newBlockID)) { + if (checkBlockPlaceSimulation(loc, newBlockID, newBlockData, loc, player)) { + block.setTypeId(newBlockID); + block.setData(newBlockData); + } + } + else { + player.sendMessage(ChatColor.RED + "[GeometricMagic] That block is blacklisted"); + } + } + // Block break and place + else if (block.getTypeId() != 0 && newBlockID != 0) { + if (!checkBreakBlacklist(block.getTypeId()) && !checkPlaceBlacklist(newBlockID)) { + if (checkBlockBreakSimulation(loc, player) && checkBlockPlaceSimulation(loc, newBlockID, newBlockData, loc, player)) { + block.setTypeId(newBlockID); + block.setData(newBlockData); + } + } + else { + player.sendMessage(ChatColor.RED + "[GeometricMagic] That block is blacklisted"); + } + } + } + } + } + } + } + in.close(); + file.delete(); + } + + public static void storageCircleStore(Location startLoc, Location endLoc, Player player, int size, File file) throws FileNotFoundException { + World world = player.getWorld(); + PrintWriter out = new PrintWriter(file); + + if (startLoc.getBlockX() > endLoc.getBlockX()) { + if (startLoc.getBlockZ() > endLoc.getBlockZ()) { + for (int x = startLoc.getBlockX(); x >= endLoc.getBlockX(); x--) { + for (int y = startLoc.getBlockY(); y <= endLoc.getBlockY(); y++) { + for (int z = startLoc.getBlockZ(); z >= endLoc.getBlockZ(); z--) { + Location loc = new Location(world, x, y, z); + Block block = loc.getBlock(); + + if (block.getType() != Material.AIR) { + if (!checkBreakBlacklist(block.getTypeId())) { + if (checkBlockBreakSimulation(loc, player)) { + out.println(String.valueOf(block.getTypeId()) + "," + String.valueOf(block.getData())); + block.setType(Material.AIR); + } + } + else { + player.sendMessage(ChatColor.RED + "[GeometricMagic] That block is blacklisted"); + out.println("0,0"); + } + } + else { + out.println("0,0"); + } + } + } + } + } + else { + for (int x = startLoc.getBlockX(); x >= endLoc.getBlockX(); x--) { + for (int y = startLoc.getBlockY(); y <= endLoc.getBlockY(); y++) { + for (int z = startLoc.getBlockZ(); z <= endLoc.getBlockZ(); z++) { + Location loc = new Location(world, x, y, z); + Block block = loc.getBlock(); + + if (block.getType() != Material.AIR) { + if (!checkBreakBlacklist(block.getTypeId())) { + if (checkBlockBreakSimulation(loc, player)) { + out.println(String.valueOf(block.getTypeId()) + "," + String.valueOf(block.getData())); + block.setType(Material.AIR); + } + } + else { + player.sendMessage(ChatColor.RED + "[GeometricMagic] That block is blacklisted"); + out.println("0,0"); + } + } + else { + out.println("0,0"); + } + } + } + } + } + } + else { + if (startLoc.getBlockZ() > endLoc.getBlockZ()) { + for (int x = startLoc.getBlockX(); x <= endLoc.getBlockX(); x++) { + for (int y = startLoc.getBlockY(); y <= endLoc.getBlockY(); y++) { + for (int z = startLoc.getBlockZ(); z >= endLoc.getBlockZ(); z--) { + Location loc = new Location(world, x, y, z); + Block block = loc.getBlock(); + + if (block.getType() != Material.AIR) { + if (!checkBreakBlacklist(block.getTypeId())) { + if (checkBlockBreakSimulation(loc, player)) { + out.println(String.valueOf(block.getTypeId()) + "," + String.valueOf(block.getData())); + block.setType(Material.AIR); + } + } + else { + player.sendMessage(ChatColor.RED + "[GeometricMagic] That block is blacklisted"); + out.println("0,0"); + } + } + else { + out.println("0,0"); + } + } + } + } + } + else { + for (int x = startLoc.getBlockX(); x <= endLoc.getBlockX(); x++) { + for (int y = startLoc.getBlockY(); y <= endLoc.getBlockY(); y++) { + for (int z = startLoc.getBlockZ(); z <= endLoc.getBlockZ(); z++) { + Location loc = new Location(world, x, y, z); + Block block = loc.getBlock(); + + if (block.getType() != Material.AIR) { + if (!checkBreakBlacklist(block.getTypeId())) { + if (checkBlockBreakSimulation(loc, player)) { + out.println(String.valueOf(block.getTypeId()) + "," + String.valueOf(block.getData())); + block.setType(Material.AIR); + } + } + else { + player.sendMessage(ChatColor.RED + "[GeometricMagic] That block is blacklisted"); + out.println("0,0"); + } + } + else { + out.println("0,0"); + } + } + } + } + } + } + out.close(); + } + public static String getTransmutationCostSystem(GeometricMagic plugin) { return plugin.getConfig().getString("transmutation.cost").toString(); } From bbb19759a1907880ac7f13c96dece51342675e36 Mon Sep 17 00:00:00 2001 From: Andrew Stevanus Date: Wed, 29 Aug 2012 21:39:37 -0400 Subject: [PATCH 133/133] v2.8.0 --- plugin.yml | 2 +- .../GeometricMagicConfigUpdater.java | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index 1b609d2..72b4d37 100644 --- a/plugin.yml +++ b/plugin.yml @@ -18,7 +18,7 @@ name: GeometricMagic main: me.cakenggt.GeometricMagic.GeometricMagic -version: 2.7.6 +version: 2.8.0 authors: [cakenggt, Hoot215] softdepend: [Vault, AntiCheat] permissions: diff --git a/src/me/cakenggt/GeometricMagic/GeometricMagicConfigUpdater.java b/src/me/cakenggt/GeometricMagic/GeometricMagicConfigUpdater.java index df86698..585f5aa 100644 --- a/src/me/cakenggt/GeometricMagic/GeometricMagicConfigUpdater.java +++ b/src/me/cakenggt/GeometricMagic/GeometricMagicConfigUpdater.java @@ -209,6 +209,44 @@ else if (plugin.getConfig().getString("version").equals("2.7.5")) { return; } } + else if (plugin.getConfig().getString("version").equals("2.7.6")) { + System.out.println("[GeometricMagic] Updating config to v2.8.0..."); + List strList = new ArrayList(); + + File myFile = new File("plugins/GeometricMagic/config.yml"); + if (myFile.exists()) { + Scanner in = new Scanner(myFile); + while (in.hasNextLine()) { + String nextLine = in.nextLine(); + if (!nextLine.contains("version:") + && !nextLine.contains("# DO NOT MODIFY THIS VALUE!")) + strList.add(nextLine); + else + in.nextLine(); + } + in.close(); + + Files.delete(Paths.get("plugins/GeometricMagic/config.yml")); + PrintWriter out = new PrintWriter(new File("plugins/GeometricMagic/config.yml")); + for (String s : strList) { + out.println(s); + } + + out.println(); + out.println("# DO NOT MODIFY THIS VALUE!"); + out.println("version: 2.8.0"); + out.close(); + + plugin.reloadConfig(); + } + else + return; + + if (!isUpdated()) { + updateConfig(instance); + return; + } + } } // If the config is updated else {