Subcommanded all the commands

This commit is contained in:
alisolarflare 2016-12-17 02:40:25 -05:00
parent 872e1c8ac7
commit 27f73ae61f
15 changed files with 58 additions and 38 deletions

View file

@ -11,7 +11,7 @@ commands:
description: creates creative boundaries description: creates creative boundaries
debug: debug:
description: debug commands description: debug commands
flaircolouring: flaircolour:
description: flaaairs description: flaaairs
fruit: fruit:
description: fruits description: fruits

View file

@ -9,7 +9,7 @@ import org.bukkit.plugin.java.JavaPlugin;
import buttondevteam.alipresents.components.alilinks.AliLinkComponent; import buttondevteam.alipresents.components.alilinks.AliLinkComponent;
import buttondevteam.alipresents.components.cashmob.CashMobComponent; import buttondevteam.alipresents.components.cashmob.CashMobComponent;
import buttondevteam.alipresents.components.creativeboundaries.CreativeBoundariesComponent; import buttondevteam.alipresents.components.creativeboundaries.CreativeBoundariesComponent;
import buttondevteam.alipresents.components.flaircolouring.FlairColouringComponent; import buttondevteam.alipresents.components.flaircolour.FlairColourComponent;
import buttondevteam.alipresents.components.fruit.FruitComponent; import buttondevteam.alipresents.components.fruit.FruitComponent;
import buttondevteam.alipresents.components.gpower.GPowerComponent; import buttondevteam.alipresents.components.gpower.GPowerComponent;
import buttondevteam.alipresents.components.insurance.InsuranceComponent; import buttondevteam.alipresents.components.insurance.InsuranceComponent;
@ -27,7 +27,7 @@ public class AliPresents extends JavaPlugin{
new AliLinkComponent().register(this); new AliLinkComponent().register(this);
new CashMobComponent().register(this); new CashMobComponent().register(this);
new CreativeBoundariesComponent().register(this); new CreativeBoundariesComponent().register(this);
new FlairColouringComponent().register(this); new FlairColourComponent().register(this);
new FruitComponent().register(this); new FruitComponent().register(this);
new GPowerComponent().register(this); new GPowerComponent().register(this);
new InsuranceComponent().register(this); new InsuranceComponent().register(this);

View file

@ -7,12 +7,14 @@ import org.bukkit.entity.Player;
public abstract class PlayerCommand extends BaseCommand{ public abstract class PlayerCommand extends BaseCommand{
/**replaces CommandExecutor functionality*/ /**replaces CommandExecutor functionality*/
@Override @Override
public boolean onCommand(CommandSender commandSender, Command command, String string, String[] args){ public boolean onCommand(CommandSender sender, Command command, String string, String[] args){
return OnCommand(commandSender, string, args); sender.sendMessage("activating" + string.toString());
return OnCommand(sender, string, args);
} }
/**replaces TBMCCommandBase functionality*/ /**replaces TBMCCommandBase functionality*/
@Override @Override
public boolean OnCommand(CommandSender sender, String alias, String[] args){ public boolean OnCommand(CommandSender sender, String alias, String[] args){
sender.sendMessage("activating" + alias.toString());
return OnCommand((Player) sender, alias, args); return OnCommand((Player) sender, alias, args);
} }
public abstract boolean OnCommand(Player player, String alias, String[] args); public abstract boolean OnCommand(Player player, String alias, String[] args);

View file

@ -1,10 +1,10 @@
package buttondevteam.alipresents.components.flaircolouring; package buttondevteam.alipresents.components.flaircolour;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
public class FlairColouringAPI { public class FlairColourAPI {
public static void recolourPlayer(User user, DyeColor dyecolour){ public static void recolourPlayer(User user, DyeColor dyecolour){
String name = user._getNickname(); String name = user._getNickname();
String sanitizedName = ""; String sanitizedName = "";

View file

@ -1,4 +1,4 @@
package buttondevteam.alipresents.components.flaircolouring; package buttondevteam.alipresents.components.flaircolour;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -13,15 +13,15 @@ import org.bukkit.plugin.java.JavaPlugin;
import com.earth2me.essentials.Essentials; import com.earth2me.essentials.Essentials;
import buttondevteam.alipresents.architecture.Component; import buttondevteam.alipresents.architecture.Component;
import buttondevteam.alipresents.components.flaircolouring.letterdyes.GetLetterDye; import buttondevteam.alipresents.components.flaircolour.letterdyes.GetLetterDye;
import buttondevteam.alipresents.components.flaircolouring.letterdyes.LetterDye; import buttondevteam.alipresents.components.flaircolour.letterdyes.LetterDye;
import buttondevteam.alipresents.components.flaircolouring.letterdyes.LetterDyeListener; import buttondevteam.alipresents.components.flaircolour.letterdyes.LetterDyeListener;
import buttondevteam.alipresents.components.flaircolouring.portals.FlairMe; import buttondevteam.alipresents.components.flaircolour.portals.FlairMe;
import buttondevteam.alipresents.components.flaircolouring.portals.PlayerProximityLoop; import buttondevteam.alipresents.components.flaircolour.portals.PlayerProximityLoop;
import buttondevteam.alipresents.components.flaircolouring.portals.PortalListener; import buttondevteam.alipresents.components.flaircolour.portals.PortalListener;
import buttondevteam.alipresents.components.flaircolouring.portals.SetProximityLocation; import buttondevteam.alipresents.components.flaircolour.portals.SetProximityLocation;
public class FlairColouringComponent extends Component { public class FlairColourComponent extends Component {
public List<Player> playersToBeFlaired = new ArrayList<Player>(); public List<Player> playersToBeFlaired = new ArrayList<Player>();
@Override @Override
public void register(JavaPlugin plugin) { public void register(JavaPlugin plugin) {

View file

@ -1,4 +1,4 @@
package buttondevteam.alipresents.components.flaircolouring.letterdyes; package buttondevteam.alipresents.components.flaircolour.letterdyes;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View file

@ -1,4 +1,4 @@
package buttondevteam.alipresents.components.flaircolouring.letterdyes; package buttondevteam.alipresents.components.flaircolour.letterdyes;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;

View file

@ -1,4 +1,4 @@
package buttondevteam.alipresents.components.flaircolouring.letterdyes; package buttondevteam.alipresents.components.flaircolour.letterdyes;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
@ -12,7 +12,7 @@ import org.bukkit.material.Dye;
import com.earth2me.essentials.Essentials; import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import buttondevteam.alipresents.components.flaircolouring.FlairColouringAPI; import buttondevteam.alipresents.components.flaircolour.FlairColourAPI;
public class LetterDyeListener implements Listener{ public class LetterDyeListener implements Listener{
private Essentials essentials; private Essentials essentials;
@ -32,7 +32,7 @@ public class LetterDyeListener implements Listener{
Dye dye = (Dye) event.getItem().getData(); Dye dye = (Dye) event.getItem().getData();
User user = essentials.getUser(event.getPlayer()); User user = essentials.getUser(event.getPlayer());
user.setNickname(FlairColouringAPI.colourShiftRight(user._getNickname(), dye.getColor())); user.setNickname(FlairColourAPI.colourShiftRight(user._getNickname(), dye.getColor()));
}catch(Exception e){ }catch(Exception e){
event.getPlayer().sendMessage(e.getStackTrace().toString()); event.getPlayer().sendMessage(e.getStackTrace().toString());
} }

View file

@ -1,18 +1,18 @@
package buttondevteam.alipresents.components.flaircolouring.portals; package buttondevteam.alipresents.components.flaircolour.portals;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import buttondevteam.alipresents.architecture.commands.PlayerCommand; import buttondevteam.alipresents.architecture.commands.PlayerCommand;
import buttondevteam.alipresents.components.flaircolouring.FlairColouringComponent; import buttondevteam.alipresents.components.flaircolour.FlairColourComponent;
public class FlairMe extends PlayerCommand { public class FlairMe extends PlayerCommand {
@Override @Override
public String GetCommandPath() { public String GetCommandPath() {
return "flaircolouring flairme"; return "flaircolour flairme";
} }
private FlairColouringComponent component; private FlairColourComponent component;
public FlairMe(FlairColouringComponent flairDoorComponent) { public FlairMe(FlairColourComponent flairDoorComponent) {
this.component = flairDoorComponent; this.component = flairDoorComponent;
} }
@Override @Override

View file

@ -1,4 +1,4 @@
package buttondevteam.alipresents.components.flaircolouring.portals; package buttondevteam.alipresents.components.flaircolour.portals;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -6,11 +6,11 @@ import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import buttondevteam.alipresents.components.flaircolouring.FlairColouringComponent; import buttondevteam.alipresents.components.flaircolour.FlairColourComponent;
public class PlayerProximityLoop extends BukkitRunnable implements Listener{ public class PlayerProximityLoop extends BukkitRunnable implements Listener{
private static JavaPlugin plugin; private static JavaPlugin plugin;
private static FlairColouringComponent component; private static FlairColourComponent component;
private static Location startLocation; private static Location startLocation;
private static Location endLocation; private static Location endLocation;
@ -21,7 +21,7 @@ public class PlayerProximityLoop extends BukkitRunnable implements Listener{
private static int eY; private static int eY;
private static int eZ; private static int eZ;
public PlayerProximityLoop(JavaPlugin plugin, FlairColouringComponent component) { public PlayerProximityLoop(JavaPlugin plugin, FlairColourComponent component) {
PlayerProximityLoop.plugin = plugin; PlayerProximityLoop.plugin = plugin;
PlayerProximityLoop.component = component; PlayerProximityLoop.component = component;
this.runTaskTimer(plugin, 0, 20); this.runTaskTimer(plugin, 0, 20);

View file

@ -1,4 +1,4 @@
package buttondevteam.alipresents.components.flaircolouring.portals; package buttondevteam.alipresents.components.flaircolour.portals;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
@ -13,17 +13,17 @@ import org.bukkit.plugin.java.JavaPlugin;
import com.earth2me.essentials.Essentials; import com.earth2me.essentials.Essentials;
import buttondevteam.alipresents.components.flaircolouring.FlairColouringAPI; import buttondevteam.alipresents.components.flaircolour.FlairColourAPI;
import buttondevteam.alipresents.components.flaircolouring.FlairColouringComponent; import buttondevteam.alipresents.components.flaircolour.FlairColourComponent;
public class PortalListener implements Listener{ public class PortalListener implements Listener{
public JavaPlugin plugin; public JavaPlugin plugin;
Essentials essentials; Essentials essentials;
private FlairColouringComponent component; private FlairColourComponent component;
public PortalListener(JavaPlugin plugin, FlairColouringComponent component) { public PortalListener(JavaPlugin plugin, FlairColourComponent component) {
this.plugin = plugin; this.plugin = plugin;
this.component = component; this.component = component;
this.essentials = ((Essentials) Bukkit.getPluginManager().getPlugin("Essentials")); this.essentials = ((Essentials) Bukkit.getPluginManager().getPlugin("Essentials"));
@ -51,7 +51,7 @@ public class PortalListener implements Listener{
Block BottomBlock = player.getWorld().getBlockAt(x,y-4,z); //Block under middle block Block BottomBlock = player.getWorld().getBlockAt(x,y-4,z); //Block under middle block
if(HigherBlock.getType() == Material.STONE){ if(HigherBlock.getType() == Material.STONE){
FlairColouringAPI.recolourPlayer(essentials.getUser(player), DyeColor.GRAY); FlairColourAPI.recolourPlayer(essentials.getUser(player), DyeColor.GRAY);
component.playersToBeFlaired.remove(player.getName()); component.playersToBeFlaired.remove(player.getName());
return; return;
} }
@ -67,7 +67,7 @@ public class PortalListener implements Listener{
return; return;
} }
FlairColouringAPI.recolourPlayer(essentials.getUser(player), woolColour); FlairColourAPI.recolourPlayer(essentials.getUser(player), woolColour);
component.playersToBeFlaired.remove(player.getName()); component.playersToBeFlaired.remove(player.getName());
} }

View file

@ -1,4 +1,4 @@
package buttondevteam.alipresents.components.flaircolouring.portals; package buttondevteam.alipresents.components.flaircolour.portals;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -36,4 +36,9 @@ public class SetProximityLocation extends ModCommand{
"change their colour state." "change their colour state."
}; };
} }
@Override
public String GetCommandPath() {
return "flaircolour setproximitylocation";
}
} }

View file

@ -16,4 +16,8 @@ public class PowerAll extends ModCommand{
"Usage: Type /PowerAll to activate all powers for all players with gpowers" "Usage: Type /PowerAll to activate all powers for all players with gpowers"
}; };
} }
@Override
public String GetCommandPath() {
return "gpower powerall";
}
} }

View file

@ -17,4 +17,9 @@ public class PowerDown extends PlayerCommand {
"Usage: Type /PowerDown to disable your g-power" "Usage: Type /PowerDown to disable your g-power"
}; };
} }
@Override
public String GetCommandPath() {
return "gpower powerdown";
}
} }

View file

@ -17,4 +17,8 @@ public class PowerUp extends PlayerCommand {
"Usage: Type /PowerUp to activate your registered G-Power" "Usage: Type /PowerUp to activate your registered G-Power"
}; };
} }
@Override
public String GetCommandPath() {
return "gpower powerup";
}
} }