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
+
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/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 4b531ed..44dc38e 100644
--- a/src/buttondevteam/alipresents/components/alilinks/commands/Press.java
+++ b/src/buttondevteam/alipresents/components/alilinks/commands/Press.java
@@ -1,21 +1,31 @@
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) {
+ public String[] GetHelpText(String alias){
+ return new String[] {
+ "Usage: type /"+this.GetCommandPath()+" activate a wireless redstone block listening",
+ "to your frequency of choice"
+ };
+ }
+
+ @Override
+ public boolean OnCommand(CommandSender sender, String alias, String[] args) {
if (args.length < 1)
return false;
- return AliLinkAPI.sendPressEvent(player, args, AliLinkComponent.getPlugin());
+ return AliLinkAPI.sendPressEvent(sender, args, AliLinkComponent.getPlugin());
}
+
+
}
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 2d026df..9e8e2b7 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) {
@@ -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 aa78055..1f3769d 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) {
@@ -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/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/letterdyes/GetLetterDye.java b/src/buttondevteam/alipresents/components/flaircolour/letterdyes/GetLetterDye.java
index 95597ff..bd30317 100644
--- a/src/buttondevteam/alipresents/components/flaircolour/letterdyes/GetLetterDye.java
+++ b/src/buttondevteam/alipresents/components/flaircolour/letterdyes/GetLetterDye.java
@@ -12,6 +12,12 @@ 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){
+ 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/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);
-
+
}
}
-
+
}
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());
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/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..f529833 100644
--- a/src/buttondevteam/alipresents/components/gpower/commands/GPower.java
+++ b/src/buttondevteam/alipresents/components/gpower/commands/Test.java
@@ -1,48 +1,52 @@
-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: /"+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/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/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..b6cdc42 100644
--- a/src/buttondevteam/alipresents/components/insurance/getInsurance.java
+++ b/src/buttondevteam/alipresents/components/insurance/getInsurance.java
@@ -8,16 +8,16 @@ 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;
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,26 @@ 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[1]);
+ break;
+ }else if (StringUtils.isNumeric(args[1]) && Insurance.isInsuranceType(args[0])){
+ amount = Integer.parseInt(args[1]);
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;
}
}
@@ -43,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 f671c12..919d5ef 100644
--- a/src/buttondevteam/alipresents/components/insurance/getInsuranceBlock.java
+++ b/src/buttondevteam/alipresents/components/insurance/getInsuranceBlock.java
@@ -11,15 +11,24 @@ 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 false;
+ return true;
}
@Override
public String GetCommandPath() {
return "insurance getblock";
}
+ @Override
+ public String[] GetHelpText(String alias){
+ return new String[]{
+ "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/getInsuranceBar.java b/src/buttondevteam/alipresents/components/insurance/getInsuranceIngot.java
similarity index 62%
rename from src/buttondevteam/alipresents/components/insurance/getInsuranceBar.java
rename to src/buttondevteam/alipresents/components/insurance/getInsuranceIngot.java
index 13f3339..b161227 100644
--- a/src/buttondevteam/alipresents/components/insurance/getInsuranceBar.java
+++ b/src/buttondevteam/alipresents/components/insurance/getInsuranceIngot.java
@@ -6,20 +6,28 @@ 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) {
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;
}
@Override
public String GetCommandPath() {
- return "insurance getBar";
+ return "insurance getingot";
+ }
+ @Override
+ public String[] GetHelpText(String alias){
+ return new String[]{
+ "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 5ccaa03..50978f7 100644
--- a/src/buttondevteam/alipresents/components/insurance/getInsuranceNugget.java
+++ b/src/buttondevteam/alipresents/components/insurance/getInsuranceNugget.java
@@ -11,15 +11,23 @@ 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 false;
+ return true;
}
@Override
public String GetCommandPath() {
return "insurance getnugget";
}
+ @Override
+ public String[] GetHelpText(String alias){
+ return new String[]{
+ "Usage: /"+this.GetCommandPath()+" [amount]",
+ "This command returns an insurance nugget, which on death,",
+ "saves one itemslot in the inventory"
+ };
+ }
}