Added code for exception handling

And other stuff :P
This commit is contained in:
Norbi Peti 2016-11-03 01:22:51 +01:00
parent 0d3c83b65f
commit 20e8ce27b8
20 changed files with 483 additions and 268 deletions

View file

@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.tbmcplugins</groupId>
<artifactId>AliPresents</artifactId>
@ -63,5 +64,10 @@
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<dependency>
<groupId>com.github.TBMCPlugins.ButtonCore</groupId>
<artifactId>ButtonCore</artifactId>
<version>master-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View file

@ -1,9 +1,11 @@
package alisolarflare.modules;
import org.bukkit.command.CommandExecutor;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import buttondevteam.lib.chat.TBMCChatAPI;
import buttondevteam.lib.chat.TBMCCommandBase;
/**
* A Module class is a helper class that allows the compacting of projects into one single package.
* Each feature, whether game, arrow trail listener, or command tool, can have its command and listener
@ -35,9 +37,8 @@ public abstract class Module implements Registerable{
* @param label Name of the command in plugin.yml
* @param commandExecutor Custom coded CommandExecutor class
*/
protected CommandExecutor registerCommand(JavaPlugin plugin, String label, CommandExecutor commandExecutor){
plugin.getCommand(label).setExecutor(commandExecutor);
return commandExecutor;
protected <T extends TBMCCommandBase> void registerCommand(JavaPlugin plugin, String label, Class<T> commandExecutor){
TBMCChatAPI.AddCommands(plugin, commandExecutor);
}
protected Listener registerListener(JavaPlugin plugin, Listener listener){
plugin.getServer().getPluginManager().registerEvents(listener, plugin);

View file

@ -6,13 +6,14 @@ import alisolarflare.modules.Module;
import alisolarflare.modules.components.flairdoor.commands.FlairMe;
import alisolarflare.modules.components.flairdoor.commands.SetFlairDoorColour;
import alisolarflare.modules.components.flairdoor.listeners.PortalListener;
import buttondevteam.lib.TBMCCoreAPI;
import buttondevteam.lib.chat.TBMCChatAPI;
public class FlairDoorModule extends Module {
@Override
public void register(JavaPlugin plugin) {
plugin.getCommand("flairme").setExecutor(new FlairMe());
plugin.getCommand("setflairdoorcolour").setExecutor(new SetFlairDoorColour());
TBMCChatAPI.AddCommands(plugin, FlairMe.class);
plugin.getServer().getPluginManager().registerEvents(new PortalListener(plugin), plugin);
TBMCCoreAPI.RegisterEventsForExceptions(new PortalListener(plugin), plugin);
}
}

View file

@ -1,15 +1,14 @@
package alisolarflare.modules.components.flairdoor.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import alisolarflare.modules.components.flairdoor.listeners.PortalListener;
import buttondevteam.lib.chat.TBMCCommandBase;
public class FlairMe implements CommandExecutor{
public class FlairMe extends TBMCCommandBase {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean OnCommand(CommandSender sender, String label, String[] args) {
sender.sendMessage("Flairing..." + sender.getName());
PortalListener.playersToBeFlaired.add(sender.getName());
sender.sendMessage("Finished Preparation! Walk through a portal to get your flair");
@ -17,4 +16,25 @@ public class FlairMe implements CommandExecutor{
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return new String[] { "" };
}
@Override
public String GetCommandPath() {
return "flairme";
}
@Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
return false;
}
}

View file

@ -3,15 +3,17 @@ package alisolarflare.modules.components.flairdoor.commands;
import java.util.Arrays;
import java.util.List;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
public class SetFlairDoorColour implements CommandExecutor {
import buttondevteam.lib.chat.TBMCCommandBase;
public class SetFlairDoorColour extends TBMCCommandBase {
public static String FlairDoorColorMode = "null";
public static final List<String> COLOURMODES = Arrays.asList("red", "orange", "yellow", "green", "blue", "purple", "gray");
public static final List<String> COLOURMODES = Arrays.asList("red", "orange", "yellow", "green", "blue", "purple",
"gray");
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean OnCommand(CommandSender sender, String label, String[] args) {
if (args.length > 1) {
sender.sendMessage("You must specify and argument, Red-Purple or Null.HHAHHAHAHAHHAHAHAHHA");
}
@ -45,4 +47,24 @@ public class SetFlairDoorColour implements CommandExecutor {
}
return false;
}
@Override
public String[] GetHelpText(String alias) { // TODO
return new String[] { "" };
}
@Override
public String GetCommandPath() {
return "setflairdoorcolour";
}
@Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
return false;
}
}

View file

@ -7,16 +7,16 @@ import alisolarflare.modules.components.gpowers.commands.PowerDown;
import alisolarflare.modules.components.gpowers.commands.PowerUp;
import alisolarflare.modules.components.gpowers.commands.gPowerCommand;
import alisolarflare.modules.components.gpowers.listeners.gPowerListener;
import buttondevteam.lib.TBMCCoreAPI;
import buttondevteam.lib.chat.TBMCChatAPI;
public class GPowerModule extends Module {
@Override
public void register(JavaPlugin plugin) {
plugin.getCommand("powerup").setExecutor(new PowerUp());
plugin.getCommand("powerdown").setExecutor(new PowerDown());
plugin.getCommand("gpowercommand").setExecutor(new gPowerCommand());
TBMCChatAPI.AddCommands(plugin, gPowerCommand.class);
plugin.getServer().getPluginManager().registerEvents(new gPowerListener(plugin), plugin);
TBMCCoreAPI.RegisterEventsForExceptions(new gPowerListener(plugin), plugin);
}
}

View file

@ -4,10 +4,35 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
public class PowerDown implements CommandExecutor {
import buttondevteam.lib.chat.TBMCCommandBase;
public class PowerDown extends TBMCCommandBase {
@Override
public boolean onCommand(CommandSender arg0, Command arg1, String arg2, String[] arg3) {
public boolean OnCommand(CommandSender arg0, String arg2, String[] arg3) {
// TODO Auto-generated method stub
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public String GetCommandPath() {
return "powerdown";
}
@Override
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}

View file

@ -5,16 +5,36 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import buttondevteam.lib.chat.TBMCCommandBase;
public class PowerUp implements CommandExecutor{
public class PowerUp extends TBMCCommandBase {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)){
sender.sendMessage("You must be a player to use this command!");
}
public boolean OnCommand(CommandSender sender, String label, String[] args) {
// gPowerMemory.PowerUpPlayer(player, colour);
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public String GetCommandPath() {
return "powerup";
}
@Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -6,16 +6,13 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import alisolarflare.modules.components.gpowers.gPowerMemory;
import buttondevteam.lib.chat.TBMCCommandBase;
public class gPowerCommand implements CommandExecutor{
public class gPowerCommand extends TBMCCommandBase {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean OnCommand(CommandSender sender, String label, String[] args) {
sender.sendMessage("G power activate!");
if (!(sender instanceof Player)){
sender.sendMessage("You must be a player to use this command!");
return false;
}
Player player = (Player) sender;
if (args.length < 2) {
player.sendMessage("Proper Usage to test G-Powers:");
@ -24,12 +21,8 @@ public class gPowerCommand implements CommandExecutor{
}
String colour;
player.sendMessage("Checking terms...");
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")){
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("Term Fail: COLOUR. Proper Usage to test G-Powers:");
@ -55,4 +48,25 @@ public class gPowerCommand implements CommandExecutor{
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return new String[] { "" };
}
@Override
public String GetCommandPath() {
return "gpower";
}
@Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
return false;
}
}

View file

@ -1,4 +1,5 @@
package alisolarflare.modules.components.links;
import java.util.List;
import org.bukkit.plugin.java.JavaPlugin;
@ -7,6 +8,7 @@ import alisolarflare.modules.Module;
import alisolarflare.modules.components.links.commands.PressAliLink;
import alisolarflare.modules.components.links.commands.SetAliLink;
import alisolarflare.modules.components.links.entities.Link;
import buttondevteam.lib.chat.TBMCChatAPI;
public class AliLinkModule extends Module {
private SetAliLink setAliLink;
@ -14,10 +16,10 @@ public class AliLinkModule extends Module{
@Override
public void register(JavaPlugin plugin) {
setAliLink = new SetAliLink(plugin);
plugin.getCommand("setalilink").setExecutor(setAliLink);
plugin.getCommand("pressalilink").setExecutor(new PressAliLink(plugin, setAliLink));
TBMCChatAPI.AddCommands(plugin, PressAliLink.class);
}
public void saveLinkList(JavaPlugin plugin) {
plugin.getConfig().set("aliLinkList", setAliLink.linkList);
}
@ -27,5 +29,4 @@ public class AliLinkModule extends Module{
return (List<Link>) plugin.getConfig().getList("aliLinkList");
}
}

View file

@ -6,16 +6,19 @@ import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.modules.components.links.entities.Link;
import buttondevteam.lib.chat.TBMCCommandBase;
public class PressAliLink implements CommandExecutor{
public class PressAliLink extends TBMCCommandBase {
private JavaPlugin plugin;
private SetAliLink setAliLink;
public PressAliLink(JavaPlugin plugin, SetAliLink setAliLink) {
this.plugin = plugin;
this.setAliLink = setAliLink;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean OnCommand(CommandSender sender, String label, String[] args) {
sender.getServer().broadcastMessage(setAliLink.linkList.toString() + "over.");
@ -33,4 +36,27 @@ public class PressAliLink implements CommandExecutor{
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public String GetCommandPath() {
return "pressalilink";
}
@Override
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -1,6 +1,5 @@
package alisolarflare.modules.components.links.commands;
import java.util.ArrayList;
import java.util.List;
@ -14,52 +13,54 @@ import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.modules.components.links.AliLinkModule;
import alisolarflare.modules.components.links.entities.Link;
import buttondevteam.lib.chat.TBMCCommandBase;
/**
* This class manages the command /SetAliLink <frequency> [x] [y] [z]. This command creates an Ali-Link,
* a location in a world that when called on by {@link Class#PressAliLink}, creates a temporary redstone block,
* enabling wireless redstone
* This class manages the command /SetAliLink <frequency> [x] [y] [z]. This command creates an Ali-Link, a location in a world that when called on by {@link PressAliLink}, creates a temporary redstone
* block, enabling wireless redstone
*
* @see Class#PressAliLink
* @see PressAliLink
* @author Alisolarflare
*
*/
public class SetAliLink implements CommandExecutor{
public class SetAliLink extends TBMCCommandBase {
public List<Link> linkList = new ArrayList<Link>();
AliLinkModule subplugin;
private JavaPlugin plugin;
/**
* Constructs the SetAliLink class
* @param plugin The plugin that contains the configuration file of SetAliLink
*
* @param plugin
* The plugin that contains the configuration file of SetAliLink
*/
public SetAliLink(JavaPlugin plugin) {
this.plugin = plugin;
load();
}
/**
* This command creates an Ali-Link which, when activated by the command /PressAliLink,
* creates a temporary redstone block if and only if /PressAliLink [frequency] matches the frequency
* saved when /SetAliLink [frequency] is called.
* This command creates an Ali-Link which, when activated by the command /PressAliLink, creates a temporary redstone block if and only if /PressAliLink [frequency] matches the frequency saved when
* /SetAliLink [frequency] is called.
*
* @see Class#PressAliLink
* @param sender Player who sent the command
* @param command Command Object created
* @param label Name of the command
* @param args Arguments: [frequency] [x-coordinate] [y-coordinate] [z-coordinate], where the coordinates point
* to the intended location of the Ali-Link
* @param sender
* Player who sent the command
* @param command
* Command Object created
* @param label
* Name of the command
* @param args
* Arguments: [frequency] [x-coordinate] [y-coordinate] [z-coordinate], where the coordinates point to the intended location of the Ali-Link
*/
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean OnCommand(CommandSender sender, String label, String[] args) {
sender.sendMessage("you pressed shit");
if (args == null || args.length < 1) {
sender.sendMessage("You must specify a link frequency");
sender.sendMessage("/pressalilink [name]");
return false;
}
if (!(sender instanceof Player)){
sender.sendMessage("You must be a player to use this command!");
}
Player player = (Player) sender;
if (args.length < 4) {
player.sendMessage("short");
@ -68,9 +69,11 @@ public class SetAliLink implements CommandExecutor{
player.sendMessage("end");
return false;
}
if (StringUtils.isNumericSpace(args[1]) && StringUtils.isNumericSpace(args[2]) && StringUtils.isNumericSpace(args[3])){
if (StringUtils.isNumericSpace(args[1]) && StringUtils.isNumericSpace(args[2])
&& StringUtils.isNumericSpace(args[3])) {
player.sendMessage("CUUUSTOM");
linkList.add(new Link(args[0],new Location(player.getWorld(), Double.parseDouble(args[1]), Double.parseDouble(args[2]), Double.parseDouble(args[3]))));
linkList.add(new Link(args[0], new Location(player.getWorld(), Double.parseDouble(args[1]),
Double.parseDouble(args[2]), Double.parseDouble(args[3]))));
save(player);
player.sendMessage("FINISHED");
} else {
@ -82,9 +85,10 @@ public class SetAliLink implements CommandExecutor{
}
return false;
}
/**
* Tries to save the entire SetAliLink class into memory, which includes
* all of the current Ali-links saved and in use.
* Tries to save the entire SetAliLink class into memory, which includes all of the current Ali-links saved and in use.
*
* @param player
*/
private void save(Player player) {
@ -93,21 +97,13 @@ public class SetAliLink implements CommandExecutor{
player.sendMessage("Link will only last until next server restart");
return;
/*
subplugin.plugin.getConfig().set("aliLinkList", subplugin.linkList);
try {
player.sendMessage("SAVIN");
subplugin.plugin.saveConfig();
player.sendMessage("GOOD SAVE");
} catch (Exception e) {
player.sendMessage("YOU FUCKED STUFF UP");
// TODO Auto-generated catch block
e.printStackTrace();
}
* subplugin.plugin.getConfig().set("aliLinkList", subplugin.linkList); try { player.sendMessage("SAVIN"); subplugin.plugin.saveConfig(); player.sendMessage("GOOD SAVE"); } catch (Exception e)
* { player.sendMessage("YOU FUCKED STUFF UP"); // TODO Auto-generated catch block e.printStackTrace(); }
*/
}
/**
* Attempts to load the previous saved state of AliLinks, from the plugin
* configuration file
* Attempts to load the previous saved state of AliLinks, from the plugin configuration file
*/
@SuppressWarnings("unchecked")
private void load() {
@ -121,4 +117,26 @@ public class SetAliLink implements CommandExecutor{
}
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public String GetCommandPath() {
return "setalilink";
}
@Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -4,12 +4,13 @@ import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.modules.Module;
import alisolarflare.modules.components.shulker.commands.AliShulker;
import buttondevteam.lib.chat.TBMCChatAPI;
public class AliShulkerModule extends Module {
@Override
public void register(JavaPlugin plugin) {
plugin.getCommand("alishulker").setExecutor(new AliShulker());
TBMCChatAPI.AddCommands(plugin, AliShulker.class);
}
}

View file

@ -10,23 +10,17 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Shulker;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import buttondevteam.lib.chat.TBMCCommandBase;
/**
* @author Alisolarflare
* This class is responsible for the command /aliShulker, which in-game spawns
* a shulker that:
* Has a health of 10
* Has a wither and invisibility effect present
* Has noAI
* And is Glowing
* @author Alisolarflare This class is responsible for the command /aliShulker, which in-game spawns a shulker that: Has a health of 10 Has a wither and invisibility effect present Has noAI And is
* Glowing
*/
public class AliShulker implements CommandExecutor {
public class AliShulker extends TBMCCommandBase {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)){
sender.sendMessage("You must be a player to use this command!");
return false;
}
public boolean OnCommand(CommandSender sender, String label, String[] args) {
Player player = (Player) sender;
if (!(player.getName().equals("iie") || player.getName().equals("alisolarflare"))) {
return false;
@ -44,4 +38,26 @@ public class AliShulker implements CommandExecutor {
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public String GetCommandPath() {
return "alishulker";
}
@Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -6,6 +6,7 @@ import alisolarflare.modules.Module;
import alisolarflare.modules.events.uhc.commands.AddToUHC;
import alisolarflare.modules.events.uhc.commands.StartMatch;
import alisolarflare.modules.events.uhc.memory.UHCMatch;
import buttondevteam.lib.chat.TBMCChatAPI;
public class UHCModule extends Module {
public UHCMatch match;
@ -15,12 +16,14 @@ public class UHCModule extends Module {
registerListeners(plugin);
registerMemoryUnits(plugin);
}
private void registerListeners(JavaPlugin plugin) {
}
private void registerCommands(JavaPlugin plugin) {
registerCommand(plugin, "addToUHC", new AddToUHC(this.match));
registerCommand(plugin, "startMatch", new StartMatch(this.match));
TBMCChatAPI.AddCommands(plugin, AddToUHC.class);
}
private void registerMemoryUnits(JavaPlugin plugin) {
match = new UHCMatch(plugin.getConfig(), plugin.getConfig().getString("UHCMatchState"));
}

View file

@ -1,25 +1,24 @@
package alisolarflare.modules.events.uhc.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import alisolarflare.modules.events.uhc.memory.UHCMatch;
import buttondevteam.lib.chat.TBMCCommandBase;
/**
* This class handles the specific command /addToUHC which, in-game,
* adds a player to a specific UltraHardcore match, that is defined
* by the constructor: {@linkplain #AddToUHC(UHCMatch)}
* This class handles the specific command /addToUHC which, in-game, adds a player to a specific UltraHardcore match, that is defined by the constructor: {@linkplain #AddToUHC(UHCMatch)}
*
* @author Alisolarflare
*/
public class AddToUHC implements CommandExecutor{
public class AddToUHC extends TBMCCommandBase {
private UHCMatch generalMemory;
/**
* Constructor for this AddToUHC
* @param generalMemory The Memory Unit for the current match
*
* @param generalMemory
* The Memory Unit for the current match
*/
public AddToUHC(UHCMatch generalMemory) {
this.generalMemory = generalMemory;
@ -27,18 +26,19 @@ public class AddToUHC implements CommandExecutor{
/**
* Activated function when /addtoUHC <> is typed in-game
* @param sender CommandSender which sent the command /addToUHC
* @param command Command object created when /addToUHC is called in-game
* @param label Name of the command called
* @param args Arguments passed onto /addToUHC by the player
*
* @param sender
* CommandSender which sent the command /addToUHC
* @param command
* Command object created when /addToUHC is called in-game
* @param label
* Name of the command called
* @param args
* Arguments passed onto /addToUHC by the player
*/
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean OnCommand(CommandSender sender, String label, String[] args) {
// INPUT SANITATION
if (!(sender instanceof Player)){
sender.sendMessage("You must be a player to use this command!");
return false;
}
Player player = (Player) sender;
if (player.getName() != "alisolarflare") {
sender.sendMessage("You must be Ali to use this command, send her a message to change the permissions");
@ -55,4 +55,26 @@ public class AddToUHC implements CommandExecutor{
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public String GetCommandPath() {
return "addtouhc";
}
@Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -7,17 +7,17 @@ import org.bukkit.entity.Player;
import alisolarflare.modules.events.uhc.memory.MatchState;
import alisolarflare.modules.events.uhc.memory.UHCMatch;
import buttondevteam.lib.chat.TBMCCommandBase;
public class StartMatch implements CommandExecutor {
public class StartMatch extends TBMCCommandBase {
private UHCMatch match;
public StartMatch(UHCMatch match) {
this.match = match;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)){
sender.sendMessage("You must be a player to use this command! Contact a dev if you think this is wrong");
}
public boolean OnCommand(CommandSender sender, String label, String[] args) {
if (match.getMatchState() == MatchState.NULL)
sender.sendMessage("There is no match to begin.");
else if (match.getMatchState() == MatchState.IDLE)
@ -32,4 +32,26 @@ public class StartMatch implements CommandExecutor {
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public String GetCommandPath() {
return "startmatch";
}
@Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -15,7 +15,6 @@ public class AliArrowListener implements Listener {
this.plugin = plugin;
}
@SuppressWarnings("deprecation")
@EventHandler
public void onProjectileLaunch(ProjectileLaunchEvent event){
try{

View file

@ -1,8 +1,8 @@
package alisolarflare.modules.magictrick.aliarrow;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.modules.Module;
import buttondevteam.lib.TBMCCoreAPI;
public class AliArrowModule extends Module {
/**
@ -10,7 +10,7 @@ public class AliArrowModule extends Module{
*/
@Override
public void register(JavaPlugin plugin) {
plugin.getServer().getPluginManager().registerEvents(new AliArrowListener(plugin), plugin);
TBMCCoreAPI.RegisterEventsForExceptions(new AliArrowListener(plugin), plugin);
}
}

View file

@ -10,8 +10,6 @@ public class AliArrowTask extends BukkitRunnable{
String name;
Arrow arrow;
public AliArrowTask(JavaPlugin plugin, Arrow arrow, String name) {
this.name = name;
this.plugin = plugin;
@ -31,8 +29,8 @@ public class AliArrowTask extends BukkitRunnable{
arrow.getWorld().spawnParticle(Particle.FLAME, arrow.getLocation(), 1);
}
if (name.equals("NorbiPeti"))
arrow.getWorld().spawnParticle(Particle.LAVA, arrow.getLocation(), 1);
}