From baf804ddc0f665b7d1a433618f0772a7baa53bec Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Sat, 17 Dec 2016 03:31:17 -0500 Subject: [PATCH 01/11] #27 fixed gm swap --- .../components/creativeboundaries/commands/Cbgm0.java | 2 +- .../components/creativeboundaries/commands/Cbgm1.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/buttondevteam/alipresents/components/creativeboundaries/commands/Cbgm0.java b/src/buttondevteam/alipresents/components/creativeboundaries/commands/Cbgm0.java index 2d026df..d5dd890 100644 --- a/src/buttondevteam/alipresents/components/creativeboundaries/commands/Cbgm0.java +++ b/src/buttondevteam/alipresents/components/creativeboundaries/commands/Cbgm0.java @@ -8,7 +8,7 @@ import buttondevteam.alipresents.components.creativeboundaries.CreativeBoundarie public class Cbgm0 extends PlayerCommand{ @Override public String GetCommandPath() { - return "cb gm1"; + return "cb gm0"; } @Override public boolean OnCommand(Player player, String arg2, String[] arg3) { diff --git a/src/buttondevteam/alipresents/components/creativeboundaries/commands/Cbgm1.java b/src/buttondevteam/alipresents/components/creativeboundaries/commands/Cbgm1.java index aa78055..b0ea0e2 100644 --- a/src/buttondevteam/alipresents/components/creativeboundaries/commands/Cbgm1.java +++ b/src/buttondevteam/alipresents/components/creativeboundaries/commands/Cbgm1.java @@ -8,7 +8,7 @@ import buttondevteam.alipresents.components.creativeboundaries.CreativeBoundarie public class Cbgm1 extends PlayerCommand { @Override public String GetCommandPath() { - return "cb gm0"; + return "cb gm1"; } @Override public boolean OnCommand(Player player, String arg2, String[] arg3) { From 248f54e3ec6e8b64b4d653612ad80d5969b21185 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Sat, 17 Dec 2016 03:59:22 -0500 Subject: [PATCH 02/11] Fixed all bugs except implementation --- .../components/insurance/InsuranceComponent.java | 2 +- .../components/insurance/getInsurance.java | 14 +++++++++++--- .../components/insurance/getInsuranceBlock.java | 11 ++++++++++- ...getInsuranceBar.java => getInsuranceIngot.java} | 12 ++++++++++-- .../components/insurance/getInsuranceNugget.java | 10 +++++++++- 5 files changed, 41 insertions(+), 8 deletions(-) rename src/buttondevteam/alipresents/components/insurance/{getInsuranceBar.java => getInsuranceIngot.java} (69%) diff --git a/src/buttondevteam/alipresents/components/insurance/InsuranceComponent.java b/src/buttondevteam/alipresents/components/insurance/InsuranceComponent.java index 1099605..ee053f6 100644 --- a/src/buttondevteam/alipresents/components/insurance/InsuranceComponent.java +++ b/src/buttondevteam/alipresents/components/insurance/InsuranceComponent.java @@ -10,7 +10,7 @@ public class InsuranceComponent extends Component { public void register(JavaPlugin plugin) { registerCommand(plugin, new getInsurance()); registerCommand(plugin, new getInsuranceNugget()); - registerCommand(plugin, new getInsuranceBar()); + registerCommand(plugin, new getInsuranceIngot()); registerCommand(plugin, new getInsuranceBlock()); } diff --git a/src/buttondevteam/alipresents/components/insurance/getInsurance.java b/src/buttondevteam/alipresents/components/insurance/getInsurance.java index 6a687ea..aba87bb 100644 --- a/src/buttondevteam/alipresents/components/insurance/getInsurance.java +++ b/src/buttondevteam/alipresents/components/insurance/getInsurance.java @@ -15,9 +15,9 @@ public class getInsurance extends ModCommand { InsuranceType insuranceType = defaultInsuranceType; switch(args.length){ - case 0: + case 0: // no arguments break; - case 1: + case 1: // or argument if (StringUtils.isNumeric(args[0])){ amount = Integer.parseInt(args[0]); break; @@ -25,14 +25,22 @@ public class getInsurance extends ModCommand { insuranceType = InsuranceType.valueOf(args[0]); break; }else{ + player.sendMessage("Invalid Argument " + args[0]); + player.sendMessage("Enter a type of insurance or a number as an argument"); + player.sendMessage(Insurance.InsuranceType.values().toString()); return false; } - default: + default: + // argument if (StringUtils.isNumeric(args[0]) && Insurance.isInsuranceType(args[1])){ amount = Integer.parseInt(args[0]); insuranceType = InsuranceType.valueOf(args[0]); break; }else{ + player.sendMessage("Invalid Argument " + args[0] + "|" + args[1]); + player.sendMessage("Usage /" + this.GetCommandPath() + + " " + + " <" + Insurance.InsuranceType.values().toString() + ">"); return false; } } diff --git a/src/buttondevteam/alipresents/components/insurance/getInsuranceBlock.java b/src/buttondevteam/alipresents/components/insurance/getInsuranceBlock.java index f671c12..cfbc15d 100644 --- a/src/buttondevteam/alipresents/components/insurance/getInsuranceBlock.java +++ b/src/buttondevteam/alipresents/components/insurance/getInsuranceBlock.java @@ -15,11 +15,20 @@ public class getInsuranceBlock extends ModCommand { }else{ player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Block)); } - return false; + return true; } @Override public String GetCommandPath() { return "insurance getblock"; } + @Override + public String[] GetHelpText(String alias){ + return new String[]{ + "Usage: /insurance getblock [amount]", + "This command returns an insurance block, which on death,", + "splits into 9 insurance ingot which each saves 1 row of", + "inventory per ingot" + }; + } } diff --git a/src/buttondevteam/alipresents/components/insurance/getInsuranceBar.java b/src/buttondevteam/alipresents/components/insurance/getInsuranceIngot.java similarity index 69% rename from src/buttondevteam/alipresents/components/insurance/getInsuranceBar.java rename to src/buttondevteam/alipresents/components/insurance/getInsuranceIngot.java index 13f3339..bfd71dc 100644 --- a/src/buttondevteam/alipresents/components/insurance/getInsuranceBar.java +++ b/src/buttondevteam/alipresents/components/insurance/getInsuranceIngot.java @@ -6,7 +6,7 @@ import org.bukkit.entity.Player; import buttondevteam.alipresents.architecture.commands.ModCommand; import buttondevteam.alipresents.components.insurance.Insurance.InsuranceType; -public class getInsuranceBar extends ModCommand { +public class getInsuranceIngot extends ModCommand { @Override public boolean OnCommand(Player player, String alias, String[] args) { @@ -20,6 +20,14 @@ public class getInsuranceBar extends ModCommand { @Override public String GetCommandPath() { - return "insurance getBar"; + return "insurance getingot"; + } + @Override + public String[] GetHelpText(String alias){ + return new String[]{ + "Usage: /insurance getingot [amount]", + "This command returns an insurance ingot, which on death,", + "saves one row of inventory" + }; } } diff --git a/src/buttondevteam/alipresents/components/insurance/getInsuranceNugget.java b/src/buttondevteam/alipresents/components/insurance/getInsuranceNugget.java index 5ccaa03..42e2c62 100644 --- a/src/buttondevteam/alipresents/components/insurance/getInsuranceNugget.java +++ b/src/buttondevteam/alipresents/components/insurance/getInsuranceNugget.java @@ -15,11 +15,19 @@ public class getInsuranceNugget extends ModCommand { }else{ player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Nugget)); } - return false; + return true; } @Override public String GetCommandPath() { return "insurance getnugget"; } + @Override + public String[] GetHelpText(String alias){ + return new String[]{ + "Usage: /insurance getnugget [amount]", + "This command returns an insurance nugget, which on death,", + "saves one itemslot in the inventory" + }; + } } From 812dd89ee0f2e2cb335d81ee6301f8c5d4694e7e Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Sat, 17 Dec 2016 04:23:57 -0500 Subject: [PATCH 03/11] #27 Actually fixed the thing --- .../alipresents/architecture/Component.java | 1 - .../components/gpower/GPowerComponent.java | 4 +- .../commands/{GPower.java => Test.java} | 99 ++++++++++--------- 3 files changed, 53 insertions(+), 51 deletions(-) rename src/buttondevteam/alipresents/components/gpower/commands/{GPower.java => Test.java} (78%) diff --git a/src/buttondevteam/alipresents/architecture/Component.java b/src/buttondevteam/alipresents/architecture/Component.java index a08bee6..af43424 100644 --- a/src/buttondevteam/alipresents/architecture/Component.java +++ b/src/buttondevteam/alipresents/architecture/Component.java @@ -21,7 +21,6 @@ import buttondevteam.lib.chat.TBMCChatAPI; * */ public abstract class Component{ - /** * Registers the module, when called by the JavaPlugin class. Call * registerCommand() and registerListener() within this method. diff --git a/src/buttondevteam/alipresents/components/gpower/GPowerComponent.java b/src/buttondevteam/alipresents/components/gpower/GPowerComponent.java index 295cc6b..1d85e84 100644 --- a/src/buttondevteam/alipresents/components/gpower/GPowerComponent.java +++ b/src/buttondevteam/alipresents/components/gpower/GPowerComponent.java @@ -3,7 +3,7 @@ package buttondevteam.alipresents.components.gpower; import org.bukkit.plugin.java.JavaPlugin; import buttondevteam.alipresents.architecture.Component; -import buttondevteam.alipresents.components.gpower.commands.GPower; +import buttondevteam.alipresents.components.gpower.commands.Test; import buttondevteam.alipresents.components.gpower.enchant.EnchantingLoop; import buttondevteam.alipresents.components.gpower.powerstate.PowerDown; import buttondevteam.alipresents.components.gpower.powerstate.PowerUp; @@ -12,7 +12,7 @@ public class GPowerComponent extends Component { @Override public void register(JavaPlugin plugin) { - registerCommand(plugin, new GPower()); + registerCommand(plugin, new Test()); registerCommand(plugin, new PowerUp()); registerCommand(plugin, new PowerDown()); diff --git a/src/buttondevteam/alipresents/components/gpower/commands/GPower.java b/src/buttondevteam/alipresents/components/gpower/commands/Test.java similarity index 78% rename from src/buttondevteam/alipresents/components/gpower/commands/GPower.java rename to src/buttondevteam/alipresents/components/gpower/commands/Test.java index 9c95f31..07dc669 100644 --- a/src/buttondevteam/alipresents/components/gpower/commands/GPower.java +++ b/src/buttondevteam/alipresents/components/gpower/commands/Test.java @@ -1,48 +1,51 @@ -package buttondevteam.alipresents.components.gpower.commands; - -import org.bukkit.entity.Player; - -import buttondevteam.alipresents.architecture.commands.PlayerCommand; -import buttondevteam.alipresents.components.gpower.api.GPowerAPI; - -public class GPower extends PlayerCommand { - @Override - public String GetCommandPath() { - return "gpower"; - } - @Override - public boolean OnCommand(Player player, String label, String[] args) { - if (args.length < 2) { - player.sendMessage("Proper Usage to test G-Powers:"); - player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/false]"); - return false; - } - String colour; - if (args[0].startsWith("r") || args[0].startsWith("o") || args[0].startsWith("y") || args[0].startsWith("g") - || args[0].startsWith("b") || args[0].startsWith("p")) { - colour = args[0]; - } else { - player.sendMessage("error: colour. Proper Usage to configure G-Powers:"); - return false; - } - boolean isActive; - if (args[1].startsWith("t")) { - isActive = true; - } else if (args[1].startsWith("f")) { - isActive = false; - } else { - player.sendMessage("error: active. Proper Usage to configure G-Powers:"); - return false; - } - player.sendMessage("Terms Vaild!"); - player.sendMessage("Saving Data: "+ player.getName() + "|" + colour + "|" + isActive); - GPowerAPI.addPlayer(player, colour, isActive); - - return true; - } - public String[] GetHelpText(String alias){ - return new String[]{ - "Usage: /gpowertest [colour=red,orange,yellow,green,blue,purple,grey] [active=true/false]" - }; - } -} +package buttondevteam.alipresents.components.gpower.commands; + +import org.bukkit.entity.Player; + +import buttondevteam.alipresents.architecture.commands.ModCommand; +import buttondevteam.alipresents.components.gpower.api.GPowerAPI; + +public class Test extends ModCommand{ + + @Override + public boolean OnCommand(Player player, String alias, String[] args) { + if (args.length < 2) { + player.sendMessage("Proper Usage to test G-Powers:"); + player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/false]"); + return false; + } + String colour; + if (args[0].startsWith("r") || args[0].startsWith("o") || args[0].startsWith("y") || args[0].startsWith("g") + || args[0].startsWith("b") || args[0].startsWith("p")) { + colour = args[0]; + } else { + player.sendMessage("error: colour. Proper Usage to configure G-Powers:"); + return false; + } + boolean isActive; + if (args[1].startsWith("t")) { + isActive = true; + } else if (args[1].startsWith("f")) { + isActive = false; + } else { + player.sendMessage("error: active. Proper Usage to configure G-Powers:"); + return false; + } + player.sendMessage("Terms Vaild!"); + player.sendMessage("Saving Data: "+ player.getName() + "|" + colour + "|" + isActive); + GPowerAPI.addPlayer(player, colour, isActive); + + return true; + } + @Override + public String GetCommandPath() { + return "gpower test"; + } + @Override + public String[] GetHelpText(String alias){ + return new String[]{ + "Usage: /gpowertest [colour=red,orange,yellow,green,blue,purple,grey] [active=true/false]" + }; + } + +} From 5801eaaddd648c92caa767f35c1507f738abb65a Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Sat, 17 Dec 2016 07:22:56 -0500 Subject: [PATCH 04/11] Probably fixed Insurance IllegalArgumentException --- .../alipresents/components/insurance/Insurance.java | 10 +++++----- .../alipresents/components/insurance/getInsurance.java | 2 +- .../components/insurance/getInsuranceBlock.java | 4 ++-- .../components/insurance/getInsuranceIngot.java | 4 ++-- .../components/insurance/getInsuranceNugget.java | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/buttondevteam/alipresents/components/insurance/Insurance.java b/src/buttondevteam/alipresents/components/insurance/Insurance.java index 15a012a..86a1535 100644 --- a/src/buttondevteam/alipresents/components/insurance/Insurance.java +++ b/src/buttondevteam/alipresents/components/insurance/Insurance.java @@ -12,13 +12,13 @@ import buttondevteam.lib.DebugPotato; public abstract class Insurance { public static enum InsuranceType{ - Nugget, Ingot, Block + nugget, ingot, block }; public static ItemStack getInsurance(InsuranceType insuranceType){ ItemStack insuranceItem; List lore; switch(insuranceType){ - case Nugget: + case nugget: insuranceItem = new ItemStack(Material.GOLD_NUGGET); lore = Arrays.asList( "This insurance nugget will protect ", @@ -28,7 +28,7 @@ public abstract class Insurance { "one nugget." ); break; - case Ingot: + case ingot: insuranceItem = new ItemStack(Material.GOLD_INGOT); lore = Arrays.asList( "This insurance ingot will protect ", @@ -38,7 +38,7 @@ public abstract class Insurance { "row costing one ingot." ); break; - case Block: + case block: insuranceItem = new ItemStack(Material.GOLD_BLOCK); lore = Arrays.asList( "This insurance block will give your ", @@ -74,7 +74,7 @@ public abstract class Insurance { } public static boolean isInsuranceType(String string){ for (InsuranceType insuranceType : Insurance.InsuranceType.values()){ - if (string.equalsIgnoreCase(insuranceType.toString())){ + if (string.equals(insuranceType.toString())){ return true; } } diff --git a/src/buttondevteam/alipresents/components/insurance/getInsurance.java b/src/buttondevteam/alipresents/components/insurance/getInsurance.java index aba87bb..4ad5af7 100644 --- a/src/buttondevteam/alipresents/components/insurance/getInsurance.java +++ b/src/buttondevteam/alipresents/components/insurance/getInsurance.java @@ -8,7 +8,7 @@ import buttondevteam.alipresents.components.insurance.Insurance.InsuranceType; public class getInsurance extends ModCommand { private final int defaultAmount = 1; - private final InsuranceType defaultInsuranceType = InsuranceType.Block; + private final InsuranceType defaultInsuranceType = InsuranceType.block; @Override public boolean OnCommand(Player player, String alias, String[] args) { int amount = defaultAmount; diff --git a/src/buttondevteam/alipresents/components/insurance/getInsuranceBlock.java b/src/buttondevteam/alipresents/components/insurance/getInsuranceBlock.java index cfbc15d..b59f73a 100644 --- a/src/buttondevteam/alipresents/components/insurance/getInsuranceBlock.java +++ b/src/buttondevteam/alipresents/components/insurance/getInsuranceBlock.java @@ -11,9 +11,9 @@ public class getInsuranceBlock extends ModCommand { @Override public boolean OnCommand(Player player, String alias, String[] args) { if (args.length > 0 && StringUtils.isNumeric(args[0])){ - player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Block, Integer.parseInt(args[0]))); + player.getInventory().addItem(Insurance.getInsurance(InsuranceType.block, Integer.parseInt(args[0]))); }else{ - player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Block)); + player.getInventory().addItem(Insurance.getInsurance(InsuranceType.block)); } return true; } diff --git a/src/buttondevteam/alipresents/components/insurance/getInsuranceIngot.java b/src/buttondevteam/alipresents/components/insurance/getInsuranceIngot.java index bfd71dc..e3fdae6 100644 --- a/src/buttondevteam/alipresents/components/insurance/getInsuranceIngot.java +++ b/src/buttondevteam/alipresents/components/insurance/getInsuranceIngot.java @@ -11,9 +11,9 @@ public class getInsuranceIngot extends ModCommand { @Override public boolean OnCommand(Player player, String alias, String[] args) { if (args.length > 0 && StringUtils.isNumeric(args[0])){ - player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Ingot, Integer.parseInt(args[0]))); + player.getInventory().addItem(Insurance.getInsurance(InsuranceType.ingot, Integer.parseInt(args[0]))); }else{ - player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Ingot)); + player.getInventory().addItem(Insurance.getInsurance(InsuranceType.ingot)); } return true; } diff --git a/src/buttondevteam/alipresents/components/insurance/getInsuranceNugget.java b/src/buttondevteam/alipresents/components/insurance/getInsuranceNugget.java index 42e2c62..616ee78 100644 --- a/src/buttondevteam/alipresents/components/insurance/getInsuranceNugget.java +++ b/src/buttondevteam/alipresents/components/insurance/getInsuranceNugget.java @@ -11,9 +11,9 @@ public class getInsuranceNugget extends ModCommand { @Override public boolean OnCommand(Player player, String alias, String[] args) { if (args.length > 0 && StringUtils.isNumeric(args[0])){ - player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Nugget, Integer.parseInt(args[0]))); + player.getInventory().addItem(Insurance.getInsurance(InsuranceType.nugget, Integer.parseInt(args[0]))); }else{ - player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Nugget)); + player.getInventory().addItem(Insurance.getInsurance(InsuranceType.nugget)); } return true; } From 7def561103865c412e222fd190e82292b8dd5aca Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Sat, 17 Dec 2016 07:24:42 -0500 Subject: [PATCH 05/11] Towny'd up --- pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pom.xml b/pom.xml index 8a031d8..fe6a070 100644 --- a/pom.xml +++ b/pom.xml @@ -109,5 +109,10 @@ citizens-v1_11_R1 2.0.21-SNAPSHOT + + com.github.TBMCPlugins.ButtonCore + Towny + master-SNAPSHOT + From 4ee38f92cf2d028d9f3a16a9558eedea65060317 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Sat, 17 Dec 2016 07:36:00 -0500 Subject: [PATCH 06/11] Fixed #29 and its friends --- .../alipresents/components/insurance/getInsurance.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/buttondevteam/alipresents/components/insurance/getInsurance.java b/src/buttondevteam/alipresents/components/insurance/getInsurance.java index 4ad5af7..d8aa925 100644 --- a/src/buttondevteam/alipresents/components/insurance/getInsurance.java +++ b/src/buttondevteam/alipresents/components/insurance/getInsurance.java @@ -34,6 +34,10 @@ public class getInsurance extends ModCommand { // argument if (StringUtils.isNumeric(args[0]) && Insurance.isInsuranceType(args[1])){ amount = Integer.parseInt(args[0]); + insuranceType = InsuranceType.valueOf(args[1]); + break; + }else if (StringUtils.isNumeric(args[1]) && Insurance.isInsuranceType(args[0])){ + amount = Integer.parseInt(args[1]); insuranceType = InsuranceType.valueOf(args[0]); break; }else{ From ba528112d5ec78b533bd53f619e89720e980d966 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Sat, 17 Dec 2016 08:06:57 -0500 Subject: [PATCH 07/11] Fixed NPE at #26 after /flairme --- .../components/flaircolour/FlairColourAPI.java | 5 ++++- .../components/flaircolour/portals/PortalListener.java | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/buttondevteam/alipresents/components/flaircolour/FlairColourAPI.java b/src/buttondevteam/alipresents/components/flaircolour/FlairColourAPI.java index 24dcd6f..c216136 100644 --- a/src/buttondevteam/alipresents/components/flaircolour/FlairColourAPI.java +++ b/src/buttondevteam/alipresents/components/flaircolour/FlairColourAPI.java @@ -6,7 +6,10 @@ import com.earth2me.essentials.User; public class FlairColourAPI { public static void recolourPlayer(User user, DyeColor dyecolour){ - String name = user._getNickname(); + String name = ""; + if ((name = user._getNickname()) == null && (name = user.getDisplayName()) == null){ + name = user.getName(); + } String sanitizedName = ""; for(int i = 0; i < name.length(); i++){ if (name.charAt(i) == 'ยง'){ diff --git a/src/buttondevteam/alipresents/components/flaircolour/portals/PortalListener.java b/src/buttondevteam/alipresents/components/flaircolour/portals/PortalListener.java index 0e5b2c1..7163daa 100644 --- a/src/buttondevteam/alipresents/components/flaircolour/portals/PortalListener.java +++ b/src/buttondevteam/alipresents/components/flaircolour/portals/PortalListener.java @@ -66,6 +66,14 @@ public class PortalListener implements Listener{ }else{ return; } + if (essentials.getUser(player) == null){ + player.sendMessage("Error! essentials.getUser() returns null!"); + throw new NullPointerException(); + } + if (woolColour == null){ + player.sendMessage("Error! Wool colour returns null!"); + throw new NullPointerException(); + } FlairColourAPI.recolourPlayer(essentials.getUser(player), woolColour); component.playersToBeFlaired.remove(player.getName()); From 4bc40f6aebaeae81b95f19d5d03e9c027c78b7d0 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Sat, 17 Dec 2016 08:16:57 -0500 Subject: [PATCH 08/11] Fixed and future-proofed help texts #26 yo --- .../alipresents/components/alilinks/commands/Press.java | 7 +++++++ .../alipresents/components/alilinks/commands/Set.java | 7 +++++++ .../creativeboundaries/CreativeBoundariesComponent.java | 1 + .../components/creativeboundaries/commands/Cbgm0.java | 2 +- .../components/creativeboundaries/commands/Cbgm1.java | 2 +- .../creativeboundaries/commands/SetForceBoundaries.java | 2 +- .../components/flaircolour/letterdyes/GetLetterDye.java | 6 ++++++ .../components/flaircolour/portals/FlairMe.java | 2 +- .../flaircolour/portals/SetProximityLocation.java | 2 +- .../alipresents/components/gpower/commands/Test.java | 3 ++- .../components/gpower/powerstate/PowerDown.java | 2 +- .../alipresents/components/gpower/powerstate/PowerUp.java | 2 +- .../alipresents/components/insurance/getInsurance.java | 2 +- .../components/insurance/getInsuranceBlock.java | 2 +- .../components/insurance/getInsuranceIngot.java | 2 +- .../components/insurance/getInsuranceNugget.java | 2 +- 16 files changed, 34 insertions(+), 12 deletions(-) diff --git a/src/buttondevteam/alipresents/components/alilinks/commands/Press.java b/src/buttondevteam/alipresents/components/alilinks/commands/Press.java index 4b531ed..ac8d642 100644 --- a/src/buttondevteam/alipresents/components/alilinks/commands/Press.java +++ b/src/buttondevteam/alipresents/components/alilinks/commands/Press.java @@ -18,4 +18,11 @@ public class Press extends PlayerCommand { return false; return AliLinkAPI.sendPressEvent(player, args, AliLinkComponent.getPlugin()); } + @Override + public String[] GetHelpText(String alias){ + return new String[] { + "Usage: type /"+this.GetCommandPath()+" activate a wireless redstone block listening", + "to your frequency of choice" + }; + } } diff --git a/src/buttondevteam/alipresents/components/alilinks/commands/Set.java b/src/buttondevteam/alipresents/components/alilinks/commands/Set.java index 23385a6..80f650a 100644 --- a/src/buttondevteam/alipresents/components/alilinks/commands/Set.java +++ b/src/buttondevteam/alipresents/components/alilinks/commands/Set.java @@ -17,4 +17,11 @@ public class Set extends ModCommand { return false; return AliLinkAPI.createAliLink(player, args); } + @Override + public String[] GetHelpText(String alias){ + return new String[] { + "Usage: type /"+this.GetCommandPath()+" set a wireless redstone block that listens", + "for signals from the players pressing the frequency of your choice" + }; + } } diff --git a/src/buttondevteam/alipresents/components/creativeboundaries/CreativeBoundariesComponent.java b/src/buttondevteam/alipresents/components/creativeboundaries/CreativeBoundariesComponent.java index 1435c91..182f5b7 100644 --- a/src/buttondevteam/alipresents/components/creativeboundaries/CreativeBoundariesComponent.java +++ b/src/buttondevteam/alipresents/components/creativeboundaries/CreativeBoundariesComponent.java @@ -15,6 +15,7 @@ public class CreativeBoundariesComponent extends Component{ registerCommand(plugin, new Cbgm1()); registerCommand(plugin, new Cbgm0()); registerCommand(plugin, new SetForceBoundaries()); + registerListener(plugin, new PlotChangeListener()); //registerListener(plugin, new ItemRestrictionListener(this)); } diff --git a/src/buttondevteam/alipresents/components/creativeboundaries/commands/Cbgm0.java b/src/buttondevteam/alipresents/components/creativeboundaries/commands/Cbgm0.java index d5dd890..9e8e2b7 100644 --- a/src/buttondevteam/alipresents/components/creativeboundaries/commands/Cbgm0.java +++ b/src/buttondevteam/alipresents/components/creativeboundaries/commands/Cbgm0.java @@ -16,6 +16,6 @@ public class Cbgm0 extends PlayerCommand{ return true; } public String[] GetHelpText(String alias){ - return new String[]{"Creative Boundaries Usage: /cbgm0"}; + return new String[]{"Creative Boundaries Usage: /"+this.GetCommandPath()+""}; } } diff --git a/src/buttondevteam/alipresents/components/creativeboundaries/commands/Cbgm1.java b/src/buttondevteam/alipresents/components/creativeboundaries/commands/Cbgm1.java index b0ea0e2..1f3769d 100644 --- a/src/buttondevteam/alipresents/components/creativeboundaries/commands/Cbgm1.java +++ b/src/buttondevteam/alipresents/components/creativeboundaries/commands/Cbgm1.java @@ -17,7 +17,7 @@ public class Cbgm1 extends PlayerCommand { @Override public String[] GetHelpText(String alias){ return new String[] { - "Usage: When in a town that you either own or are a resident of, type /cbgm1 to gain creative" + "Usage: When in a town that you either own or are a resident of, type /"+this.GetCommandPath()+" to gain creative" }; } } diff --git a/src/buttondevteam/alipresents/components/creativeboundaries/commands/SetForceBoundaries.java b/src/buttondevteam/alipresents/components/creativeboundaries/commands/SetForceBoundaries.java index ebc527f..1df8cc0 100644 --- a/src/buttondevteam/alipresents/components/creativeboundaries/commands/SetForceBoundaries.java +++ b/src/buttondevteam/alipresents/components/creativeboundaries/commands/SetForceBoundaries.java @@ -17,6 +17,6 @@ public class SetForceBoundaries extends ModCommand{ } @Override public String[] GetHelpText(String alias){ - return new String[]{"Usage: /SetForceBoundaries "}; + return new String[]{"Usage: /"+this.GetCommandPath()+" "}; } } diff --git a/src/buttondevteam/alipresents/components/flaircolour/letterdyes/GetLetterDye.java b/src/buttondevteam/alipresents/components/flaircolour/letterdyes/GetLetterDye.java index 95597ff..08db228 100644 --- a/src/buttondevteam/alipresents/components/flaircolour/letterdyes/GetLetterDye.java +++ b/src/buttondevteam/alipresents/components/flaircolour/letterdyes/GetLetterDye.java @@ -14,4 +14,10 @@ public class GetLetterDye extends PlayerCommand{ player.getInventory().addItem(LetterDye.getLetterDye()); return false; } + @Override + public String[] GetHelpText(String alias){ + return new String[]{ + "Usage: Type /"+this.GetCommandPath()+" to get letter dyes that can change your username!" + }; + } } diff --git a/src/buttondevteam/alipresents/components/flaircolour/portals/FlairMe.java b/src/buttondevteam/alipresents/components/flaircolour/portals/FlairMe.java index b72ff55..373fcbf 100644 --- a/src/buttondevteam/alipresents/components/flaircolour/portals/FlairMe.java +++ b/src/buttondevteam/alipresents/components/flaircolour/portals/FlairMe.java @@ -24,7 +24,7 @@ public class FlairMe extends PlayerCommand { @Override public String[] GetHelpText(String alias){ return new String[]{ - "Usage: Type /flairme and enter a portal with coloured", + "Usage: Type /"+this.GetCommandPath()+" and enter a portal with coloured", "wool underneath to change your flair" }; } diff --git a/src/buttondevteam/alipresents/components/flaircolour/portals/SetProximityLocation.java b/src/buttondevteam/alipresents/components/flaircolour/portals/SetProximityLocation.java index 2f6b910..9a68574 100644 --- a/src/buttondevteam/alipresents/components/flaircolour/portals/SetProximityLocation.java +++ b/src/buttondevteam/alipresents/components/flaircolour/portals/SetProximityLocation.java @@ -30,7 +30,7 @@ public class SetProximityLocation extends ModCommand{ } public String[] GetHelpText(String alias){ return new String[] { - "Usage: /SetProximityLocation ", + "Usage: /"+this.GetCommandPath()+" ", "Use this command to set a proximity space: all players", "within this space will become flair-able, and portals will", "change their colour state." diff --git a/src/buttondevteam/alipresents/components/gpower/commands/Test.java b/src/buttondevteam/alipresents/components/gpower/commands/Test.java index 07dc669..f529833 100644 --- a/src/buttondevteam/alipresents/components/gpower/commands/Test.java +++ b/src/buttondevteam/alipresents/components/gpower/commands/Test.java @@ -44,8 +44,9 @@ public class Test extends ModCommand{ @Override public String[] GetHelpText(String alias){ return new String[]{ - "Usage: /gpowertest [colour=red,orange,yellow,green,blue,purple,grey] [active=true/false]" + "Usage: /"+this.GetCommandPath()+" [colour=red,orange,yellow,green,blue,purple,grey] [active=true/false]" }; } + } diff --git a/src/buttondevteam/alipresents/components/gpower/powerstate/PowerDown.java b/src/buttondevteam/alipresents/components/gpower/powerstate/PowerDown.java index a1404f5..da402e6 100644 --- a/src/buttondevteam/alipresents/components/gpower/powerstate/PowerDown.java +++ b/src/buttondevteam/alipresents/components/gpower/powerstate/PowerDown.java @@ -14,7 +14,7 @@ public class PowerDown extends PlayerCommand { @Override public String[] GetHelpText(String alias){ return new String[]{ - "Usage: Type /PowerDown to disable your g-power" + "Usage: Type /"+this.GetCommandPath()+" to disable your g-power" }; } diff --git a/src/buttondevteam/alipresents/components/gpower/powerstate/PowerUp.java b/src/buttondevteam/alipresents/components/gpower/powerstate/PowerUp.java index 46baa89..1fec205 100644 --- a/src/buttondevteam/alipresents/components/gpower/powerstate/PowerUp.java +++ b/src/buttondevteam/alipresents/components/gpower/powerstate/PowerUp.java @@ -14,7 +14,7 @@ public class PowerUp extends PlayerCommand { @Override public String[] GetHelpText(String alias){ return new String[]{ - "Usage: Type /PowerUp to activate your registered G-Power" + "Usage: Type /"+this.GetCommandPath()+" to activate your registered G-Power" }; } @Override diff --git a/src/buttondevteam/alipresents/components/insurance/getInsurance.java b/src/buttondevteam/alipresents/components/insurance/getInsurance.java index d8aa925..b6cdc42 100644 --- a/src/buttondevteam/alipresents/components/insurance/getInsurance.java +++ b/src/buttondevteam/alipresents/components/insurance/getInsurance.java @@ -55,7 +55,7 @@ public class getInsurance extends ModCommand { @Override public String[] GetHelpText(String alias){ return new String[]{ - "Usage: /getInsurance [amount] [type:nugget/bar/block/compound]", + "Usage: /"+this.GetCommandPath()+" [amount] [type:nugget/bar/block/compound]", "Use this command to get gold-standard inventory insurance, that saves ", "items in an inventory upon death. One nugget saves one ItemStack, a bar", "saves nine, a block saves 54. Compound converts amount (in nuggets) to a", diff --git a/src/buttondevteam/alipresents/components/insurance/getInsuranceBlock.java b/src/buttondevteam/alipresents/components/insurance/getInsuranceBlock.java index b59f73a..919d5ef 100644 --- a/src/buttondevteam/alipresents/components/insurance/getInsuranceBlock.java +++ b/src/buttondevteam/alipresents/components/insurance/getInsuranceBlock.java @@ -25,7 +25,7 @@ public class getInsuranceBlock extends ModCommand { @Override public String[] GetHelpText(String alias){ return new String[]{ - "Usage: /insurance getblock [amount]", + "Usage: /"+this.GetCommandPath()+" [amount]", "This command returns an insurance block, which on death,", "splits into 9 insurance ingot which each saves 1 row of", "inventory per ingot" diff --git a/src/buttondevteam/alipresents/components/insurance/getInsuranceIngot.java b/src/buttondevteam/alipresents/components/insurance/getInsuranceIngot.java index e3fdae6..b161227 100644 --- a/src/buttondevteam/alipresents/components/insurance/getInsuranceIngot.java +++ b/src/buttondevteam/alipresents/components/insurance/getInsuranceIngot.java @@ -25,7 +25,7 @@ public class getInsuranceIngot extends ModCommand { @Override public String[] GetHelpText(String alias){ return new String[]{ - "Usage: /insurance getingot [amount]", + "Usage: /"+this.GetCommandPath()+" [amount]", "This command returns an insurance ingot, which on death,", "saves one row of inventory" }; diff --git a/src/buttondevteam/alipresents/components/insurance/getInsuranceNugget.java b/src/buttondevteam/alipresents/components/insurance/getInsuranceNugget.java index 616ee78..50978f7 100644 --- a/src/buttondevteam/alipresents/components/insurance/getInsuranceNugget.java +++ b/src/buttondevteam/alipresents/components/insurance/getInsuranceNugget.java @@ -24,7 +24,7 @@ public class getInsuranceNugget extends ModCommand { @Override public String[] GetHelpText(String alias){ return new String[]{ - "Usage: /insurance getnugget [amount]", + "Usage: /"+this.GetCommandPath()+" [amount]", "This command returns an insurance nugget, which on death,", "saves one itemslot in the inventory" }; From 8e805745b5306380a33bc5e16b0b02731a7a845d Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Sat, 17 Dec 2016 08:29:40 -0500 Subject: [PATCH 09/11] Fixed NPE for Setproximitylocation --- .../portals/PlayerProximityLoop.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/buttondevteam/alipresents/components/flaircolour/portals/PlayerProximityLoop.java b/src/buttondevteam/alipresents/components/flaircolour/portals/PlayerProximityLoop.java index f21ffe9..4a3db5b 100644 --- a/src/buttondevteam/alipresents/components/flaircolour/portals/PlayerProximityLoop.java +++ b/src/buttondevteam/alipresents/components/flaircolour/portals/PlayerProximityLoop.java @@ -13,14 +13,14 @@ public class PlayerProximityLoop extends BukkitRunnable implements Listener{ private static FlairColourComponent component; private static Location startLocation; private static Location endLocation; - + private static int sX; private static int sY; private static int sZ; private static int eX; private static int eY; private static int eZ; - + public PlayerProximityLoop(JavaPlugin plugin, FlairColourComponent component) { PlayerProximityLoop.plugin = plugin; PlayerProximityLoop.component = component; @@ -31,14 +31,21 @@ public class PlayerProximityLoop extends BukkitRunnable implements Listener{ PlayerProximityLoop.sY = location.getBlockY(); PlayerProximityLoop.sZ = location.getBlockZ(); PlayerProximityLoop.startLocation = location; - PlayerProximityLoop.endLocation.setWorld(location.getWorld()); + + if (endLocation == null) + PlayerProximityLoop.endLocation = location; + else + PlayerProximityLoop.endLocation.setWorld(location.getWorld()); } public static void setEndLocation(Location location){ PlayerProximityLoop.eX = location.getBlockX(); PlayerProximityLoop.eY = location.getBlockY(); PlayerProximityLoop.eZ = location.getBlockZ(); PlayerProximityLoop.startLocation.setWorld(location.getWorld()); - PlayerProximityLoop.endLocation = location; + if (endLocation == null) + PlayerProximityLoop.endLocation = location; + else + PlayerProximityLoop.endLocation.setWorld(location.getWorld()); } @Override @@ -65,8 +72,8 @@ public class PlayerProximityLoop extends BukkitRunnable implements Listener{ if((playerZ < sZ && playerZ < eZ) || (playerZ > sZ && playerZ > eZ)) continue; component.playersToBeFlaired.add(player); - + } } - + } From 871d32027bc1db9874bb0b81255e1ff22d206f8d Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Sat, 17 Dec 2016 08:36:21 -0500 Subject: [PATCH 10/11] Fix'd --- .../components/flaircolour/letterdyes/GetLetterDye.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/buttondevteam/alipresents/components/flaircolour/letterdyes/GetLetterDye.java b/src/buttondevteam/alipresents/components/flaircolour/letterdyes/GetLetterDye.java index 08db228..bd30317 100644 --- a/src/buttondevteam/alipresents/components/flaircolour/letterdyes/GetLetterDye.java +++ b/src/buttondevteam/alipresents/components/flaircolour/letterdyes/GetLetterDye.java @@ -12,7 +12,7 @@ public class GetLetterDye extends PlayerCommand{ @Override public boolean OnCommand(Player player, String alias, String[] args) { player.getInventory().addItem(LetterDye.getLetterDye()); - return false; + return true; } @Override public String[] GetHelpText(String alias){ From 880d03fba93c2c64ace1f951199dbb441d3ddd19 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Sun, 18 Dec 2016 22:18:11 -0500 Subject: [PATCH 11/11] Links now work with command blocks --- .../architecture/commands/BaseCommand.java | 14 ++++++++++++ .../commands/CommandBlockCommand.java | 21 ++++++++++++++++++ .../components/alilinks/AliLinkAPI.java | 2 +- .../components/alilinks/AliLinkComponent.java | 2 ++ .../alilinks/commands/ListLinks.java | 22 +++++++++++++++++++ .../components/alilinks/commands/Press.java | 21 ++++++++++-------- 6 files changed, 72 insertions(+), 10 deletions(-) create mode 100644 src/buttondevteam/alipresents/architecture/commands/CommandBlockCommand.java create mode 100644 src/buttondevteam/alipresents/components/alilinks/commands/ListLinks.java diff --git a/src/buttondevteam/alipresents/architecture/commands/BaseCommand.java b/src/buttondevteam/alipresents/architecture/commands/BaseCommand.java index 6233d3a..16d6127 100644 --- a/src/buttondevteam/alipresents/architecture/commands/BaseCommand.java +++ b/src/buttondevteam/alipresents/architecture/commands/BaseCommand.java @@ -1,8 +1,22 @@ package buttondevteam.alipresents.architecture.commands; +import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; import buttondevteam.lib.chat.TBMCCommandBase; public abstract class BaseCommand extends TBMCCommandBase implements CommandExecutor{ + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + // TODO Auto-generated method stub + return OnCommand(sender, label, args); + } + @Override + public String[] GetHelpText(String alias){ + return new String[] { + "This command doesn't have help text ask a dev to write one", + "If you're a dev, write the help text you lazy bastard. -Ali" + }; + } } diff --git a/src/buttondevteam/alipresents/architecture/commands/CommandBlockCommand.java b/src/buttondevteam/alipresents/architecture/commands/CommandBlockCommand.java new file mode 100644 index 0000000..57775e4 --- /dev/null +++ b/src/buttondevteam/alipresents/architecture/commands/CommandBlockCommand.java @@ -0,0 +1,21 @@ +package buttondevteam.alipresents.architecture.commands; + +public abstract class CommandBlockCommand extends BaseCommand{ + @Override + public String[] GetHelpText(String alias){ + return new String[] { + "This command doesn't have help text. ", + }; + } + + public boolean GetPlayerOnly() { + // TODO Auto-generated method stub + return false; + } + + public boolean GetModOnly() { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/src/buttondevteam/alipresents/components/alilinks/AliLinkAPI.java b/src/buttondevteam/alipresents/components/alilinks/AliLinkAPI.java index 8115268..919ec34 100644 --- a/src/buttondevteam/alipresents/components/alilinks/AliLinkAPI.java +++ b/src/buttondevteam/alipresents/components/alilinks/AliLinkAPI.java @@ -15,7 +15,7 @@ import org.bukkit.plugin.java.JavaPlugin; import buttondevteam.alipresents.components.alilinks.entities.Link; public class AliLinkAPI { - private static List linkList; + public static List linkList = new ArrayList(); /**"Usage: /pressalilink "*/ public static boolean sendPressEvent(CommandSender sender, String[] inputFrequencies, JavaPlugin plugin) { if (inputFrequencies.length == 0) { diff --git a/src/buttondevteam/alipresents/components/alilinks/AliLinkComponent.java b/src/buttondevteam/alipresents/components/alilinks/AliLinkComponent.java index c36f5cc..d1d59b6 100644 --- a/src/buttondevteam/alipresents/components/alilinks/AliLinkComponent.java +++ b/src/buttondevteam/alipresents/components/alilinks/AliLinkComponent.java @@ -3,6 +3,7 @@ package buttondevteam.alipresents.components.alilinks; import org.bukkit.plugin.java.JavaPlugin; import buttondevteam.alipresents.architecture.Component; +import buttondevteam.alipresents.components.alilinks.commands.ListLinks; import buttondevteam.alipresents.components.alilinks.commands.Press; import buttondevteam.alipresents.components.alilinks.commands.Set; @@ -18,5 +19,6 @@ public class AliLinkComponent extends Component { p = plugin; registerCommand(plugin, new Press()); registerCommand(plugin, new Set()); + registerCommand(plugin, new ListLinks()); } } diff --git a/src/buttondevteam/alipresents/components/alilinks/commands/ListLinks.java b/src/buttondevteam/alipresents/components/alilinks/commands/ListLinks.java new file mode 100644 index 0000000..1806166 --- /dev/null +++ b/src/buttondevteam/alipresents/components/alilinks/commands/ListLinks.java @@ -0,0 +1,22 @@ +package buttondevteam.alipresents.components.alilinks.commands; + +import org.bukkit.entity.Player; + +import buttondevteam.alipresents.architecture.commands.PlayerCommand; +import buttondevteam.alipresents.components.alilinks.AliLinkAPI; +import buttondevteam.alipresents.components.alilinks.entities.Link; + +public class ListLinks extends PlayerCommand { + @Override + public boolean OnCommand(Player player, String alias, String[] args) { + for (Link link : AliLinkAPI.linkList){ + player.sendMessage(link.toString()); + } + return false; + } + @Override + public String GetCommandPath() { + return "alilink listlinks"; + } + +} diff --git a/src/buttondevteam/alipresents/components/alilinks/commands/Press.java b/src/buttondevteam/alipresents/components/alilinks/commands/Press.java index ac8d642..44dc38e 100644 --- a/src/buttondevteam/alipresents/components/alilinks/commands/Press.java +++ b/src/buttondevteam/alipresents/components/alilinks/commands/Press.java @@ -1,23 +1,17 @@ package buttondevteam.alipresents.components.alilinks.commands; -import org.bukkit.entity.Player; +import org.bukkit.command.CommandSender; -import buttondevteam.alipresents.architecture.commands.PlayerCommand; +import buttondevteam.alipresents.architecture.commands.CommandBlockCommand; import buttondevteam.alipresents.components.alilinks.AliLinkAPI; import buttondevteam.alipresents.components.alilinks.AliLinkComponent; -public class Press extends PlayerCommand { +public class Press extends CommandBlockCommand { @Override public String GetCommandPath() { return "alilink press"; } - @Override - public boolean OnCommand(Player player, String alias, String[] args) { - if (args.length < 1) - return false; - return AliLinkAPI.sendPressEvent(player, args, AliLinkComponent.getPlugin()); - } @Override public String[] GetHelpText(String alias){ return new String[] { @@ -25,4 +19,13 @@ public class Press extends PlayerCommand { "to your frequency of choice" }; } + + @Override + public boolean OnCommand(CommandSender sender, String alias, String[] args) { + if (args.length < 1) + return false; + return AliLinkAPI.sendPressEvent(sender, args, AliLinkComponent.getPlugin()); + } + + }