Merge pull request #35 from TBMCPlugins/Bugfix
Finally finished first wave of bugfixing
This commit is contained in:
commit
fcaac38783
29 changed files with 241 additions and 95 deletions
5
pom.xml
5
pom.xml
|
@ -109,5 +109,10 @@
|
|||
<artifactId>citizens-v1_11_R1</artifactId>
|
||||
<version>2.0.21-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.TBMCPlugins.ButtonCore</groupId>
|
||||
<artifactId>Towny</artifactId>
|
||||
<version>master-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -15,7 +15,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||
import buttondevteam.alipresents.components.alilinks.entities.Link;
|
||||
|
||||
public class AliLinkAPI {
|
||||
private static List<Link> linkList;
|
||||
public static List<Link> linkList = new ArrayList<Link>();
|
||||
/**"Usage: /pressalilink <frequency>"*/
|
||||
public static boolean sendPressEvent(CommandSender sender, String[] inputFrequencies, JavaPlugin plugin) {
|
||||
if (inputFrequencies.length == 0) {
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
|
@ -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()+" <frequency> 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());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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()+" <frequency> set a wireless redstone block that listens",
|
||||
"for signals from the players pressing the frequency of your choice"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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()+""};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,6 @@ public class SetForceBoundaries extends ModCommand{
|
|||
}
|
||||
@Override
|
||||
public String[] GetHelpText(String alias){
|
||||
return new String[]{"Usage: /SetForceBoundaries <True/False/0/1>"};
|
||||
return new String[]{"Usage: /"+this.GetCommandPath()+" <True/False/0/1>"};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) == '§'){
|
||||
|
|
|
@ -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!"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -30,7 +30,7 @@ public class SetProximityLocation extends ModCommand{
|
|||
}
|
||||
public String[] GetHelpText(String alias){
|
||||
return new String[] {
|
||||
"Usage: /SetProximityLocation <start/end/0/1>",
|
||||
"Usage: /"+this.GetCommandPath()+" <start/end/0/1>",
|
||||
"Use this command to set a proximity space: all players",
|
||||
"within this space will become flair-able, and portals will",
|
||||
"change their colour state."
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
|
@ -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]"
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -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"
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<String> 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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: // <amount> or <type> 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:
|
||||
// <amount> <type> 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()
|
||||
+ " <amount>"
|
||||
+ " <" + 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",
|
||||
|
|
|
@ -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"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
};
|
||||
}
|
||||
}
|
|
@ -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"
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue