Finally finished first wave of bugfixing #35

Merged
alisolarflare merged 11 commits from Bugfix into master 2016-12-19 03:19:49 +00:00
3 changed files with 53 additions and 51 deletions
Showing only changes of commit 812dd89ee0 - Show all commits

View file

@ -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.

View file

@ -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());

View file

@ -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]"
};
}
}