From 30122d23d8f7d8a9ede7854a758a458e3da30c30 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Sun, 6 Nov 2016 18:52:59 -0500 Subject: [PATCH] Revert "Revert "Comit to Uncommit"" This reverts commit fc862a670ef33bfe353d5f289b0cf093ecaadfee. --- .../FlairMe.java => Command_FlairMe.java} | 77 +++-- .../components/flairdoor/FlairDoorModule.java | 15 - ...rtalListener.java => Listener_Portal.java} | 276 ++++++++--------- .../flairdoor/Module_FlairDoor.java | 13 + .../GPower.java => Command_GPower.java} | 151 +++++----- .../PowerDown.java => Command_PowerDown.java} | 97 +++--- .../PowerUp.java => Command_PowerUp.java} | 97 +++--- .../components/gpowers/GPowerModule.java | 23 -- .../gpowers/Listener_PowerLooper.java | 11 + .../{GPowerMemory.java => Memory_GPower.java} | 104 +++---- .../components/gpowers/Module_GPower.java | 19 ++ ...plyingTask.java => Task_PowerApplier.java} | 132 ++++----- .../gpowers/listeners/gPowerListener.java | 13 - .../components/links/AliLinkModule.java | 33 --- ...AliLink.java => Command_PressAliLink.java} | 119 ++++---- ...etAliLink.java => Command_SetAliLink.java} | 278 +++++++++--------- .../{entities/Link.java => Memory_Link.java} | 80 +++-- .../components/links/Module_AliLink.java | 30 ++ ...UnpressTask.java => Task_UnpressTask.java} | 42 +-- .../links/serializer/Deserializer.java | 42 --- .../links/serializer/Serializer.java | 38 --- .../Cbgm0.java => Command_Cbgm0.java} | 97 +++--- .../Cbgm1.java => Command_Cbgm1.java} | 163 +++++----- ...Dickmode.java => Command_SetDickmode.java} | 107 ++++--- .../CreativeBoundariesModule.java | 30 -- ...ner.java => Listener_ItemRestriction.java} | 50 ++-- ...Listener.java => Listener_PlotChange.java} | 136 +++++---- .../Module_CreativeBoundaries.java | 25 ++ ...owers.java => Command_ActivatePowers.java} | 4 +- ...rs.java => Command_SetupWorldBorders.java} | 4 +- ...s.java => Command_ShrinkWorldBorders.java} | 4 +- ...layers.java => Command_SpreadPlayers.java} | 4 +- ...tartTimer.java => Command_StartTimer.java} | 4 +- .../StartUHC.java => Command_StartUHC.java} | 4 +- ...tToUHC.java => Command_TeleportToUHC.java} | 4 +- src/alisolarflare/easyuhc/EasyUHCModule.java | 24 -- src/alisolarflare/easyuhc/Module_EasyUHC.java | 18 ++ .../magic/{tricks => }/AliArrowListener.java | 76 ++--- .../magic/{tricks => }/AliArrowTask.java | 80 ++--- .../{tricks => }/BoomBowDeathListener.java | 36 +-- .../magic/{tricks => }/BoomBowListener.java | 214 +++++++------- .../magic/{tricks => }/BoomBowRule.java | 168 +++++------ .../magic/{tricks => }/BoomDecayTask.java | 50 ++-- src/alisolarflare/magic/MagicModule.java | 3 - 44 files changed, 1437 insertions(+), 1558 deletions(-) rename src/alisolarflare/components/flairdoor/{commands/FlairMe.java => Command_FlairMe.java} (69%) delete mode 100644 src/alisolarflare/components/flairdoor/FlairDoorModule.java rename src/alisolarflare/components/flairdoor/{listeners/PortalListener.java => Listener_Portal.java} (92%) create mode 100644 src/alisolarflare/components/flairdoor/Module_FlairDoor.java rename src/alisolarflare/components/gpowers/{commands/GPower.java => Command_GPower.java} (86%) rename src/alisolarflare/components/gpowers/{commands/PowerDown.java => Command_PowerDown.java} (75%) rename src/alisolarflare/components/gpowers/{commands/PowerUp.java => Command_PowerUp.java} (75%) delete mode 100644 src/alisolarflare/components/gpowers/GPowerModule.java create mode 100644 src/alisolarflare/components/gpowers/Listener_PowerLooper.java rename src/alisolarflare/components/gpowers/{GPowerMemory.java => Memory_GPower.java} (95%) create mode 100644 src/alisolarflare/components/gpowers/Module_GPower.java rename src/alisolarflare/components/gpowers/{listeners/gPowerApplyingTask.java => Task_PowerApplier.java} (88%) delete mode 100644 src/alisolarflare/components/gpowers/listeners/gPowerListener.java delete mode 100644 src/alisolarflare/components/links/AliLinkModule.java rename src/alisolarflare/components/links/{commands/PressAliLink.java => Command_PressAliLink.java} (75%) rename src/alisolarflare/components/links/{commands/SetAliLink.java => Command_SetAliLink.java} (80%) rename src/alisolarflare/components/links/{entities/Link.java => Memory_Link.java} (74%) create mode 100644 src/alisolarflare/components/links/Module_AliLink.java rename src/alisolarflare/components/links/{tasks/UnpressTask.java => Task_UnpressTask.java} (68%) delete mode 100644 src/alisolarflare/components/links/serializer/Deserializer.java delete mode 100644 src/alisolarflare/components/links/serializer/Serializer.java rename src/alisolarflare/creativeboundaries/{commands/Cbgm0.java => Command_Cbgm0.java} (73%) rename src/alisolarflare/creativeboundaries/{commands/Cbgm1.java => Command_Cbgm1.java} (85%) rename src/alisolarflare/creativeboundaries/{commands/SetDickmode.java => Command_SetDickmode.java} (78%) delete mode 100644 src/alisolarflare/creativeboundaries/CreativeBoundariesModule.java rename src/alisolarflare/creativeboundaries/{listeners/ItemRestrictionListener.java => Listener_ItemRestriction.java} (52%) rename src/alisolarflare/creativeboundaries/{listeners/PlotChangeListener.java => Listener_PlotChange.java} (84%) create mode 100644 src/alisolarflare/creativeboundaries/Module_CreativeBoundaries.java rename src/alisolarflare/easyuhc/{commands/ActivatePowers.java => Command_ActivatePowers.java} (85%) rename src/alisolarflare/easyuhc/{commands/SetupWorldBorders.java => Command_SetupWorldBorders.java} (85%) rename src/alisolarflare/easyuhc/{commands/ShrinkWorldBorders.java => Command_ShrinkWorldBorders.java} (85%) rename src/alisolarflare/easyuhc/{commands/SpreadPlayers.java => Command_SpreadPlayers.java} (85%) rename src/alisolarflare/easyuhc/{commands/StartTimer.java => Command_StartTimer.java} (86%) rename src/alisolarflare/easyuhc/{commands/StartUHC.java => Command_StartUHC.java} (86%) rename src/alisolarflare/easyuhc/{commands/TeleportToUHC.java => Command_TeleportToUHC.java} (85%) delete mode 100644 src/alisolarflare/easyuhc/EasyUHCModule.java create mode 100644 src/alisolarflare/easyuhc/Module_EasyUHC.java rename src/alisolarflare/magic/{tricks => }/AliArrowListener.java (92%) rename src/alisolarflare/magic/{tricks => }/AliArrowTask.java (92%) rename src/alisolarflare/magic/{tricks => }/BoomBowDeathListener.java (90%) rename src/alisolarflare/magic/{tricks => }/BoomBowListener.java (95%) rename src/alisolarflare/magic/{tricks => }/BoomBowRule.java (95%) rename src/alisolarflare/magic/{tricks => }/BoomDecayTask.java (88%) diff --git a/src/alisolarflare/components/flairdoor/commands/FlairMe.java b/src/alisolarflare/components/flairdoor/Command_FlairMe.java similarity index 69% rename from src/alisolarflare/components/flairdoor/commands/FlairMe.java rename to src/alisolarflare/components/flairdoor/Command_FlairMe.java index 963da82..819ed54 100644 --- a/src/alisolarflare/components/flairdoor/commands/FlairMe.java +++ b/src/alisolarflare/components/flairdoor/Command_FlairMe.java @@ -1,39 +1,38 @@ -package alisolarflare.components.flairdoor.commands; - -import org.bukkit.command.CommandSender; - -import alisolarflare.components.flairdoor.listeners.PortalListener; -import buttondevteam.lib.chat.TBMCCommandBase; - -public class FlairMe extends TBMCCommandBase { - - @Override - public boolean OnCommand(CommandSender sender, String label, String[] args) { - PortalListener.playersToBeFlaired.add(sender.getName()); - sender.sendMessage("Setup Successful! Walk through a portal to get your flair"); - - 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; - } - -} +package alisolarflare.components.flairdoor; + +import org.bukkit.command.CommandSender; + +import buttondevteam.lib.chat.TBMCCommandBase; + +public class Command_FlairMe extends TBMCCommandBase { + + @Override + public boolean OnCommand(CommandSender sender, String label, String[] args) { + Listener_Portal.playersToBeFlaired.add(sender.getName()); + sender.sendMessage("Setup Successful! Walk through a portal to get your flair"); + + 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; + } + +} diff --git a/src/alisolarflare/components/flairdoor/FlairDoorModule.java b/src/alisolarflare/components/flairdoor/FlairDoorModule.java deleted file mode 100644 index 1c5cddb..0000000 --- a/src/alisolarflare/components/flairdoor/FlairDoorModule.java +++ /dev/null @@ -1,15 +0,0 @@ -package alisolarflare.components.flairdoor; - -import org.bukkit.plugin.java.JavaPlugin; - -import alisolarflare.Module; -import alisolarflare.components.flairdoor.commands.FlairMe; -import alisolarflare.components.flairdoor.listeners.PortalListener; - -public class FlairDoorModule extends Module { - @Override - public void register(JavaPlugin plugin) { - registerCommand(plugin, new FlairMe()); - registerListener(plugin, new PortalListener(plugin)); - } -} diff --git a/src/alisolarflare/components/flairdoor/listeners/PortalListener.java b/src/alisolarflare/components/flairdoor/Listener_Portal.java similarity index 92% rename from src/alisolarflare/components/flairdoor/listeners/PortalListener.java rename to src/alisolarflare/components/flairdoor/Listener_Portal.java index 4ce684a..59791d4 100644 --- a/src/alisolarflare/components/flairdoor/listeners/PortalListener.java +++ b/src/alisolarflare/components/flairdoor/Listener_Portal.java @@ -1,138 +1,138 @@ -package alisolarflare.components.flairdoor.listeners; - -import java.util.ArrayList; -import java.util.List; - -import org.bukkit.Bukkit; -import org.bukkit.DyeColor; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerPortalEvent; -import org.bukkit.material.MaterialData; -import org.bukkit.material.Wool; -import org.bukkit.plugin.java.JavaPlugin; - -import com.earth2me.essentials.Essentials; -import com.earth2me.essentials.User; - -public class PortalListener implements Listener{ - public static List playersToBeFlaired = new ArrayList(); - public JavaPlugin plugin; - - Essentials essentials; - - public PortalListener(JavaPlugin plugin) { - this.plugin = plugin; - this.essentials = ((Essentials) Bukkit.getPluginManager().getPlugin("Essentials")); - } - @EventHandler - public void onPortalEnter(PlayerPortalEvent event){ - //SANITATION - Player - if(!(event.getPlayer() instanceof Player)){ - return; - } - - //INIT - Player - Player player = event.getPlayer(); - - //SANITATION - PlayersToBeFlaired - if(!(playersToBeFlaired.contains(player.getName()))){ - return; - } - player.sendMessage("-MAY THE FLAIRING COMMENCE-"); - event.setTo(player.getLocation()); - - //INIT - x,y,z - int x = player.getLocation().getBlockX(); - int y = player.getLocation().getBlockY(); - int z = player.getLocation().getBlockZ(); - - //INIT - Blocks Under Portal - Block HigherBlock = player.getWorld().getBlockAt(x,y-2,z); - Block MiddleBlock = player.getWorld().getBlockAt(x,y-3,z); - Block BottomBlock = player.getWorld().getBlockAt(x,y-4,z); - - //RECOLOUR PLAYER - if(HigherBlock.getType() == Material.STONE){ - recolourPlayer(player, DyeColor.GRAY); - - //TOP BLOCK IS WOOL? - }else if(HigherBlock.getType() == Material.WOOL){ - Wool wool = (Wool) HigherBlock.getState().getData(); - recolourPlayer(player, wool.getColor()); - - //MIDDLE BLOCK IS WOOL? - }else if(MiddleBlock.getType() == Material.WOOL){ - MaterialData mData = MiddleBlock.getState().getData(); - Wool wool = (Wool) mData; - - recolourPlayer(player, wool.getColor()); - - //BOTTOM BLOCK IS WOOL? - }else if (BottomBlock.getType() == Material.WOOL){ - Wool wool = (Wool) BottomBlock.getState().getData(); - recolourPlayer(player, wool.getColor()); - } - - } - public void recolourPlayer(Player player, DyeColor dyecolour){ - User user = essentials.getUser(player); - - String name = user._getNickname(); - String tempName = ""; - for(int i = 0; i < name.length(); i++){ - if (name.charAt(i) != '§'){ - tempName += name.charAt(i); - }else{ - i++; - } - } - name = tempName; - - switch(dyecolour){ - case GRAY: - player.sendMessage("Adding §7GRAY!§f"); - name = "§7" + name; - break; - case RED: - player.sendMessage("Adding §4RED!§f"); - name = "§4" + name; - break; - case ORANGE: - player.sendMessage("Adding §6ORANGE!§f"); - name = "§6" + name; - break; - case YELLOW: - player.sendMessage("Adding §eYELLOW!§f"); - name = "§e" + name; - break; - case LIME: - case GREEN: - player.sendMessage("Adding §aGREEN!§f"); - name = "§a" + name; - break; - case CYAN: - case LIGHT_BLUE: - case BLUE: - player.sendMessage("Adding §9BLUE!§f"); - name = "§9" + name; - break; - case PURPLE: - player.sendMessage("Adding §5PURPLE!§f"); - name = "§5" + name; - break; - case WHITE: - player.sendMessage("Adding §fWHITE!§f"); - name = "§f" + name; - default: - player.sendMessage("ERROR, PORTAL HAS INVALID UNDER-BLOCK"); - break; - } - user.setNickname(name); - player.sendMessage("Your name is now: " + user.getNickname() +"!"); - playersToBeFlaired.remove(player.getName()); - } -} +package alisolarflare.components.flairdoor; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerPortalEvent; +import org.bukkit.material.MaterialData; +import org.bukkit.material.Wool; +import org.bukkit.plugin.java.JavaPlugin; + +import com.earth2me.essentials.Essentials; +import com.earth2me.essentials.User; + +public class Listener_Portal implements Listener{ + public static List playersToBeFlaired = new ArrayList(); + public JavaPlugin plugin; + + Essentials essentials; + + public Listener_Portal(JavaPlugin plugin) { + this.plugin = plugin; + this.essentials = ((Essentials) Bukkit.getPluginManager().getPlugin("Essentials")); + } + @EventHandler + public void onPortalEnter(PlayerPortalEvent event){ + //SANITATION - Player + if(!(event.getPlayer() instanceof Player)){ + return; + } + + //INIT - Player + Player player = event.getPlayer(); + + //SANITATION - PlayersToBeFlaired + if(!(playersToBeFlaired.contains(player.getName()))){ + return; + } + player.sendMessage("-MAY THE FLAIRING COMMENCE-"); + event.setTo(player.getLocation()); + + //INIT - x,y,z + int x = player.getLocation().getBlockX(); + int y = player.getLocation().getBlockY(); + int z = player.getLocation().getBlockZ(); + + //INIT - Blocks Under Portal + Block HigherBlock = player.getWorld().getBlockAt(x,y-2,z); + Block MiddleBlock = player.getWorld().getBlockAt(x,y-3,z); + Block BottomBlock = player.getWorld().getBlockAt(x,y-4,z); + + //RECOLOUR PLAYER + if(HigherBlock.getType() == Material.STONE){ + recolourPlayer(player, DyeColor.GRAY); + + //TOP BLOCK IS WOOL? + }else if(HigherBlock.getType() == Material.WOOL){ + Wool wool = (Wool) HigherBlock.getState().getData(); + recolourPlayer(player, wool.getColor()); + + //MIDDLE BLOCK IS WOOL? + }else if(MiddleBlock.getType() == Material.WOOL){ + MaterialData mData = MiddleBlock.getState().getData(); + Wool wool = (Wool) mData; + + recolourPlayer(player, wool.getColor()); + + //BOTTOM BLOCK IS WOOL? + }else if (BottomBlock.getType() == Material.WOOL){ + Wool wool = (Wool) BottomBlock.getState().getData(); + recolourPlayer(player, wool.getColor()); + } + + } + public void recolourPlayer(Player player, DyeColor dyecolour){ + User user = essentials.getUser(player); + + String name = user._getNickname(); + String tempName = ""; + for(int i = 0; i < name.length(); i++){ + if (name.charAt(i) != '§'){ + tempName += name.charAt(i); + }else{ + i++; + } + } + name = tempName; + + switch(dyecolour){ + case GRAY: + player.sendMessage("Adding §7GRAY!§f"); + name = "§7" + name; + break; + case RED: + player.sendMessage("Adding §4RED!§f"); + name = "§4" + name; + break; + case ORANGE: + player.sendMessage("Adding §6ORANGE!§f"); + name = "§6" + name; + break; + case YELLOW: + player.sendMessage("Adding §eYELLOW!§f"); + name = "§e" + name; + break; + case LIME: + case GREEN: + player.sendMessage("Adding §aGREEN!§f"); + name = "§a" + name; + break; + case CYAN: + case LIGHT_BLUE: + case BLUE: + player.sendMessage("Adding §9BLUE!§f"); + name = "§9" + name; + break; + case PURPLE: + player.sendMessage("Adding §5PURPLE!§f"); + name = "§5" + name; + break; + case WHITE: + player.sendMessage("Adding §fWHITE!§f"); + name = "§f" + name; + default: + player.sendMessage("ERROR, PORTAL HAS INVALID UNDER-BLOCK"); + break; + } + user.setNickname(name); + player.sendMessage("Your name is now: " + user.getNickname() +"!"); + playersToBeFlaired.remove(player.getName()); + } +} diff --git a/src/alisolarflare/components/flairdoor/Module_FlairDoor.java b/src/alisolarflare/components/flairdoor/Module_FlairDoor.java new file mode 100644 index 0000000..ca893a7 --- /dev/null +++ b/src/alisolarflare/components/flairdoor/Module_FlairDoor.java @@ -0,0 +1,13 @@ +package alisolarflare.components.flairdoor; + +import org.bukkit.plugin.java.JavaPlugin; + +import alisolarflare.Module; + +public class Module_FlairDoor extends Module { + @Override + public void register(JavaPlugin plugin) { + registerCommand(plugin, new Command_FlairMe()); + registerListener(plugin, new Listener_Portal(plugin)); + } +} diff --git a/src/alisolarflare/components/gpowers/commands/GPower.java b/src/alisolarflare/components/gpowers/Command_GPower.java similarity index 86% rename from src/alisolarflare/components/gpowers/commands/GPower.java rename to src/alisolarflare/components/gpowers/Command_GPower.java index 4a90d21..a244e8c 100644 --- a/src/alisolarflare/components/gpowers/commands/GPower.java +++ b/src/alisolarflare/components/gpowers/Command_GPower.java @@ -1,76 +1,75 @@ -package alisolarflare.components.gpowers.commands; - -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import alisolarflare.components.gpowers.GPowerMemory; -import buttondevteam.lib.chat.TBMCCommandBase; - -public class GPower extends TBMCCommandBase { - - private GPowerMemory gPowerMemory; - - public GPower(GPowerMemory gPowerMemory) { - this.gPowerMemory = gPowerMemory; - } - - @Override - 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! Talk to a dev/ali if you think this is wrong"); - } - Player player = (Player) sender; - 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:"); - player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple,grey] [active=true/false]"); - 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:"); - player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/false]"); - return false; - } - player.sendMessage("Terms Vaild!"); - player.sendMessage("Saving Data: "+ player.getName() + "|" + colour + "|" + isActive); - gPowerMemory.configurePlayer(player, colour, isActive); - - 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; - } - -} +package alisolarflare.components.gpowers; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import buttondevteam.lib.chat.TBMCCommandBase; + +public class Command_GPower extends TBMCCommandBase { + + private Memory_GPower gPowerMemory; + + public Command_GPower(Memory_GPower gPowerMemory) { + this.gPowerMemory = gPowerMemory; + } + + @Override + 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! Talk to a dev/ali if you think this is wrong"); + } + Player player = (Player) sender; + 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:"); + player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple,grey] [active=true/false]"); + 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:"); + player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/false]"); + return false; + } + player.sendMessage("Terms Vaild!"); + player.sendMessage("Saving Data: "+ player.getName() + "|" + colour + "|" + isActive); + gPowerMemory.configurePlayer(player, colour, isActive); + + 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; + } + +} diff --git a/src/alisolarflare/components/gpowers/commands/PowerDown.java b/src/alisolarflare/components/gpowers/Command_PowerDown.java similarity index 75% rename from src/alisolarflare/components/gpowers/commands/PowerDown.java rename to src/alisolarflare/components/gpowers/Command_PowerDown.java index 8f3467b..9204c29 100644 --- a/src/alisolarflare/components/gpowers/commands/PowerDown.java +++ b/src/alisolarflare/components/gpowers/Command_PowerDown.java @@ -1,49 +1,48 @@ -package alisolarflare.components.gpowers.commands; - -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import alisolarflare.components.gpowers.GPowerMemory; -import buttondevteam.lib.chat.TBMCCommandBase; - -public class PowerDown extends TBMCCommandBase { - - private GPowerMemory gPowerMemory; - - public PowerDown(GPowerMemory gPowerMemory) { - this.gPowerMemory = gPowerMemory; - } - - @Override - public boolean OnCommand(CommandSender sender, String label, String[] args) { - if (!(sender instanceof Player)) - sender.sendMessage("You must be a player to use this command! Contact dev/ali if you think this is wrong"); - Player player = (Player) sender; - gPowerMemory.PowerDownPlayer(player); - 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; - } - -} +package alisolarflare.components.gpowers; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import buttondevteam.lib.chat.TBMCCommandBase; + +public class Command_PowerDown extends TBMCCommandBase { + + private Memory_GPower gPowerMemory; + + public Command_PowerDown(Memory_GPower gPowerMemory) { + this.gPowerMemory = gPowerMemory; + } + + @Override + public boolean OnCommand(CommandSender sender, String label, String[] args) { + if (!(sender instanceof Player)) + sender.sendMessage("You must be a player to use this command! Contact dev/ali if you think this is wrong"); + Player player = (Player) sender; + gPowerMemory.PowerDownPlayer(player); + 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; + } + +} diff --git a/src/alisolarflare/components/gpowers/commands/PowerUp.java b/src/alisolarflare/components/gpowers/Command_PowerUp.java similarity index 75% rename from src/alisolarflare/components/gpowers/commands/PowerUp.java rename to src/alisolarflare/components/gpowers/Command_PowerUp.java index 84670f3..171961c 100644 --- a/src/alisolarflare/components/gpowers/commands/PowerUp.java +++ b/src/alisolarflare/components/gpowers/Command_PowerUp.java @@ -1,49 +1,48 @@ -package alisolarflare.components.gpowers.commands; - -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import alisolarflare.components.gpowers.GPowerMemory; -import buttondevteam.lib.chat.TBMCCommandBase; - -public class PowerUp extends TBMCCommandBase { - - private GPowerMemory gPowerMemory; - - public PowerUp(GPowerMemory gPowerMemory) { - this.gPowerMemory = gPowerMemory; - } - - @Override - public boolean OnCommand(CommandSender sender, String label, String[] args) { - if (!(sender instanceof Player)) - sender.sendMessage("You must be a player to use this command! Contact a dev/ali if you think this is wrong"); - - Player player = (Player) sender; - gPowerMemory.PowerUpPlayer(player); - 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; - } - -} +package alisolarflare.components.gpowers; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import buttondevteam.lib.chat.TBMCCommandBase; + +public class Command_PowerUp extends TBMCCommandBase { + + private Memory_GPower gPowerMemory; + + public Command_PowerUp(Memory_GPower gPowerMemory) { + this.gPowerMemory = gPowerMemory; + } + + @Override + public boolean OnCommand(CommandSender sender, String label, String[] args) { + if (!(sender instanceof Player)) + sender.sendMessage("You must be a player to use this command! Contact a dev/ali if you think this is wrong"); + + Player player = (Player) sender; + gPowerMemory.PowerUpPlayer(player); + 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; + } + +} diff --git a/src/alisolarflare/components/gpowers/GPowerModule.java b/src/alisolarflare/components/gpowers/GPowerModule.java deleted file mode 100644 index 3148ee0..0000000 --- a/src/alisolarflare/components/gpowers/GPowerModule.java +++ /dev/null @@ -1,23 +0,0 @@ -package alisolarflare.components.gpowers; - -import org.bukkit.plugin.java.JavaPlugin; - -import alisolarflare.Module; -import alisolarflare.components.gpowers.commands.GPower; -import alisolarflare.components.gpowers.commands.PowerDown; -import alisolarflare.components.gpowers.commands.PowerUp; -import alisolarflare.components.gpowers.listeners.gPowerListener; - -public class GPowerModule extends Module { - - @Override - public void register(JavaPlugin plugin) { - GPowerMemory gPowerMemory = new GPowerMemory(); - registerCommand(plugin, new GPower(gPowerMemory)); - registerCommand(plugin, new PowerUp(gPowerMemory)); - registerCommand(plugin, new PowerDown(gPowerMemory)); - - registerListener(plugin, new gPowerListener(plugin, gPowerMemory)); - } - -} diff --git a/src/alisolarflare/components/gpowers/Listener_PowerLooper.java b/src/alisolarflare/components/gpowers/Listener_PowerLooper.java new file mode 100644 index 0000000..8b9c299 --- /dev/null +++ b/src/alisolarflare/components/gpowers/Listener_PowerLooper.java @@ -0,0 +1,11 @@ +package alisolarflare.components.gpowers; + +import org.bukkit.event.Listener; +import org.bukkit.plugin.java.JavaPlugin; + +public class Listener_PowerLooper implements Listener{ + + public Listener_PowerLooper(JavaPlugin plugin, Memory_GPower gPowerMemory){ + new Task_PowerApplier(plugin.getServer(), gPowerMemory.poweredPlayerList).runTaskTimer(plugin, 190, 190); + } +} \ No newline at end of file diff --git a/src/alisolarflare/components/gpowers/GPowerMemory.java b/src/alisolarflare/components/gpowers/Memory_GPower.java similarity index 95% rename from src/alisolarflare/components/gpowers/GPowerMemory.java rename to src/alisolarflare/components/gpowers/Memory_GPower.java index 44e0089..b1ef0fc 100644 --- a/src/alisolarflare/components/gpowers/GPowerMemory.java +++ b/src/alisolarflare/components/gpowers/Memory_GPower.java @@ -1,52 +1,52 @@ -package alisolarflare.components.gpowers; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.bukkit.entity.Player; - -public class GPowerMemory{ - public Map poweredPlayerList = new HashMap(); - - public void configurePlayer(Player player, String colour, boolean powerIsActive){ - poweredPlayerList.put(player.getUniqueId(), new poweredPlayer(player.getUniqueId(), colour, true)); - } - public void PowerUpPlayer(Player player){ - player.sendMessage("Powering up!"); - if(poweredPlayerList.containsKey(player.getUniqueId())){ - poweredPlayerList.get(player.getUniqueId()).isPowersActive = true; - player.sendMessage("Powered up!"); - }else{ - player.sendMessage("You must instantiate your power settings using /GPower"); - } - } - - public void PowerDownPlayer(Player player){ - player.sendMessage("Powering down!"); - if (poweredPlayerList.containsKey(player.getUniqueId())){ - player.sendMessage("Powered down!"); - poweredPlayerList.get(player.getUniqueId()).isPowersActive = false; - }else{ - player.sendMessage("P down!"); - return; - } - - } - - public class poweredPlayer{ - public UUID uuid; - public String colour; - public Boolean isPowersActive; - - public poweredPlayer(UUID uuid, String colour, Boolean activated){ - this.uuid = (uuid); - this.colour = (colour); - this.isPowersActive = (activated); - } - public String toString(){ - return "[UUID: "+ uuid.toString() + ", Colour: "+ colour+", IsActivated: "+isPowersActive + "]"; - } - } -} - +package alisolarflare.components.gpowers; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.entity.Player; + +public class Memory_GPower{ + public Map poweredPlayerList = new HashMap(); + + public void configurePlayer(Player player, String colour, boolean powerIsActive){ + poweredPlayerList.put(player.getUniqueId(), new poweredPlayer(player.getUniqueId(), colour, true)); + } + public void PowerUpPlayer(Player player){ + player.sendMessage("Powering up!"); + if(poweredPlayerList.containsKey(player.getUniqueId())){ + poweredPlayerList.get(player.getUniqueId()).isPowersActive = true; + player.sendMessage("Powered up!"); + }else{ + player.sendMessage("You must instantiate your power settings using /GPower"); + } + } + + public void PowerDownPlayer(Player player){ + player.sendMessage("Powering down!"); + if (poweredPlayerList.containsKey(player.getUniqueId())){ + player.sendMessage("Powered down!"); + poweredPlayerList.get(player.getUniqueId()).isPowersActive = false; + }else{ + player.sendMessage("P down!"); + return; + } + + } + + public class poweredPlayer{ + public UUID uuid; + public String colour; + public Boolean isPowersActive; + + public poweredPlayer(UUID uuid, String colour, Boolean activated){ + this.uuid = (uuid); + this.colour = (colour); + this.isPowersActive = (activated); + } + public String toString(){ + return "[UUID: "+ uuid.toString() + ", Colour: "+ colour+", IsActivated: "+isPowersActive + "]"; + } + } +} + diff --git a/src/alisolarflare/components/gpowers/Module_GPower.java b/src/alisolarflare/components/gpowers/Module_GPower.java new file mode 100644 index 0000000..814d9bd --- /dev/null +++ b/src/alisolarflare/components/gpowers/Module_GPower.java @@ -0,0 +1,19 @@ +package alisolarflare.components.gpowers; + +import org.bukkit.plugin.java.JavaPlugin; + +import alisolarflare.Module; + +public class Module_GPower extends Module { + + @Override + public void register(JavaPlugin plugin) { + Memory_GPower gPowerMemory = new Memory_GPower(); + registerCommand(plugin, new Command_GPower(gPowerMemory)); + registerCommand(plugin, new Command_PowerUp(gPowerMemory)); + registerCommand(plugin, new Command_PowerDown(gPowerMemory)); + + registerListener(plugin, new Listener_PowerLooper(plugin, gPowerMemory)); + } + +} diff --git a/src/alisolarflare/components/gpowers/listeners/gPowerApplyingTask.java b/src/alisolarflare/components/gpowers/Task_PowerApplier.java similarity index 88% rename from src/alisolarflare/components/gpowers/listeners/gPowerApplyingTask.java rename to src/alisolarflare/components/gpowers/Task_PowerApplier.java index d966e63..f9d82e3 100644 --- a/src/alisolarflare/components/gpowers/listeners/gPowerApplyingTask.java +++ b/src/alisolarflare/components/gpowers/Task_PowerApplier.java @@ -1,66 +1,66 @@ -package alisolarflare.components.gpowers.listeners; - -import java.util.Map; -import java.util.UUID; - -import org.bukkit.Color; -import org.bukkit.Server; -import org.bukkit.entity.Player; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.scheduler.BukkitRunnable; - -import alisolarflare.components.gpowers.GPowerMemory.poweredPlayer; - -public class gPowerApplyingTask extends BukkitRunnable{ - - private Server server; - private Map poweredPlayerList; - - public gPowerApplyingTask(Server server, Map poweredPlayerList) { - this.server = server; - this.poweredPlayerList = poweredPlayerList; - } - - //REPEATS EVERY 5 SECONDS - @Override - public void run() { - for (Player player : server.getOnlinePlayers()){ - if(poweredPlayerList.containsKey(player.getUniqueId())){ - activatePower(player, poweredPlayerList.get(player.getUniqueId()).colour); - } - } - } - - private void activatePower(Player player, String colour) { - //GREY - if ((colour.startsWith("grey") || colour.startsWith("gra")) && (player.getWorld().getTime() > 12575 && player.getWorld().getTime() < 22925)){ - player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 200, 0, true, false, Color.GRAY)); - player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 300, 0, true, false, Color.GRAY)); - //RED - }else if (colour.startsWith("r")){ - player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 200, 0, true, false, Color.RED)); - //ORANGE - }else if (colour.startsWith("o")){ - player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 200, 0, true, false, Color.ORANGE)); - player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 200, 0, true, false, Color.ORANGE)); - //YELLOW - }else if (colour.startsWith("y") && player.getLocation().getBlock().getLightFromSky() == 15 && player.getLocation().getBlock().getLightFromBlocks() == 15){ - player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 200, 0, true, false, Color.YELLOW)); - //GREEN - }else if (colour.startsWith("g") && !colour.startsWith("gra") && !colour.startsWith("grey")){ - player.addPotionEffect(new PotionEffect(PotionEffectType.LUCK, 200, 1, true, false, Color.GREEN)); - player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 200, 0, true, false, Color.GREEN)); - //BLUE - }else if (colour.startsWith("b")){ - player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 200, 1, true, false, Color.BLUE)); - player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 200, 0, true, false, Color.BLUE)); - //PURPLE - }else if (colour.startsWith("p")){ - player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 200, 0, true, false, Color.PURPLE)); - //NULL - }else{ - } - } - -} +package alisolarflare.components.gpowers; + +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Color; +import org.bukkit.Server; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitRunnable; + +import alisolarflare.components.gpowers.Memory_GPower.poweredPlayer; + +public class Task_PowerApplier extends BukkitRunnable{ + + private Server server; + private Map poweredPlayerList; + + public Task_PowerApplier(Server server, Map poweredPlayerList) { + this.server = server; + this.poweredPlayerList = poweredPlayerList; + } + + //REPEATS EVERY 5 SECONDS + @Override + public void run() { + for (Player player : server.getOnlinePlayers()){ + if(poweredPlayerList.containsKey(player.getUniqueId())){ + activatePower(player, poweredPlayerList.get(player.getUniqueId()).colour); + } + } + } + + private void activatePower(Player player, String colour) { + //GREY + if ((colour.startsWith("grey") || colour.startsWith("gra")) && (player.getWorld().getTime() > 12575 && player.getWorld().getTime() < 22925)){ + player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 200, 0, true, false, Color.GRAY)); + player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 300, 0, true, false, Color.GRAY)); + //RED + }else if (colour.startsWith("r")){ + player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 200, 0, true, false, Color.RED)); + //ORANGE + }else if (colour.startsWith("o")){ + player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 200, 0, true, false, Color.ORANGE)); + player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 200, 0, true, false, Color.ORANGE)); + //YELLOW + }else if (colour.startsWith("y") && player.getLocation().getBlock().getLightFromSky() == 15 && player.getLocation().getBlock().getLightFromBlocks() == 15){ + player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 200, 0, true, false, Color.YELLOW)); + //GREEN + }else if (colour.startsWith("g") && !colour.startsWith("gra") && !colour.startsWith("grey")){ + player.addPotionEffect(new PotionEffect(PotionEffectType.LUCK, 200, 1, true, false, Color.GREEN)); + player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 200, 0, true, false, Color.GREEN)); + //BLUE + }else if (colour.startsWith("b")){ + player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 200, 1, true, false, Color.BLUE)); + player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 200, 0, true, false, Color.BLUE)); + //PURPLE + }else if (colour.startsWith("p")){ + player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 200, 0, true, false, Color.PURPLE)); + //NULL + }else{ + } + } + +} diff --git a/src/alisolarflare/components/gpowers/listeners/gPowerListener.java b/src/alisolarflare/components/gpowers/listeners/gPowerListener.java deleted file mode 100644 index 1b71481..0000000 --- a/src/alisolarflare/components/gpowers/listeners/gPowerListener.java +++ /dev/null @@ -1,13 +0,0 @@ -package alisolarflare.components.gpowers.listeners; - -import org.bukkit.event.Listener; -import org.bukkit.plugin.java.JavaPlugin; - -import alisolarflare.components.gpowers.GPowerMemory; - -public class gPowerListener implements Listener{ - - public gPowerListener(JavaPlugin plugin, GPowerMemory gPowerMemory){ - new gPowerApplyingTask(plugin.getServer(), gPowerMemory.poweredPlayerList).runTaskTimer(plugin, 190, 190); - } -} \ No newline at end of file diff --git a/src/alisolarflare/components/links/AliLinkModule.java b/src/alisolarflare/components/links/AliLinkModule.java deleted file mode 100644 index a6d44a9..0000000 --- a/src/alisolarflare/components/links/AliLinkModule.java +++ /dev/null @@ -1,33 +0,0 @@ -package alisolarflare.components.links; - -import java.util.List; - -import org.bukkit.plugin.java.JavaPlugin; - -import alisolarflare.Module; -import alisolarflare.components.links.commands.PressAliLink; -import alisolarflare.components.links.commands.SetAliLink; -import alisolarflare.components.links.entities.Link; - -public class AliLinkModule extends Module { - private SetAliLink setAliLink; - - @Override - public void register(JavaPlugin plugin) { - setAliLink = new SetAliLink(plugin); - - registerCommand(plugin, new PressAliLink(plugin, setAliLink)); - registerCommand(plugin, setAliLink); - - } - - public void saveLinkList(JavaPlugin plugin) { - plugin.getConfig().set("aliLinkList", setAliLink.linkList); - } - - @SuppressWarnings("unchecked") - public List loadLinkList(JavaPlugin plugin) { - return (List) plugin.getConfig().getList("aliLinkList"); - } - -} diff --git a/src/alisolarflare/components/links/commands/PressAliLink.java b/src/alisolarflare/components/links/Command_PressAliLink.java similarity index 75% rename from src/alisolarflare/components/links/commands/PressAliLink.java rename to src/alisolarflare/components/links/Command_PressAliLink.java index da21f6d..9619449 100644 --- a/src/alisolarflare/components/links/commands/PressAliLink.java +++ b/src/alisolarflare/components/links/Command_PressAliLink.java @@ -1,60 +1,59 @@ -package alisolarflare.components.links.commands; - -import org.bukkit.command.CommandSender; -import org.bukkit.plugin.java.JavaPlugin; - -import alisolarflare.components.links.entities.Link; -import buttondevteam.lib.chat.TBMCCommandBase; - -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, String label, String[] args) { - - sender.getServer().broadcastMessage(setAliLink.linkList.toString() + "over."); - - if (args.length < 1) { - sender.sendMessage("You must specify a link frequency"); - sender.sendMessage("/pressalilink [frequency]"); - } - for (Link link : setAliLink.linkList) { - for (String inputlink : args) { - if (inputlink.equals(link.frequency)) { - link.press(plugin); - } - } - } - 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; - } - -} +package alisolarflare.components.links; + +import org.bukkit.command.CommandSender; +import org.bukkit.plugin.java.JavaPlugin; + +import buttondevteam.lib.chat.TBMCCommandBase; + +public class Command_PressAliLink extends TBMCCommandBase { + private JavaPlugin plugin; + private Command_SetAliLink setAliLink; + + public Command_PressAliLink(JavaPlugin plugin, Command_SetAliLink setAliLink) { + this.plugin = plugin; + this.setAliLink = setAliLink; + } + + @Override + public boolean OnCommand(CommandSender sender, String label, String[] args) { + + sender.getServer().broadcastMessage(setAliLink.linkList.toString() + "over."); + + if (args.length < 1) { + sender.sendMessage("You must specify a link frequency"); + sender.sendMessage("/pressalilink [frequency]"); + } + for (Memory_Link link : setAliLink.linkList) { + for (String inputlink : args) { + if (inputlink.equals(link.frequency)) { + link.press(plugin); + } + } + } + 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; + } + +} diff --git a/src/alisolarflare/components/links/commands/SetAliLink.java b/src/alisolarflare/components/links/Command_SetAliLink.java similarity index 80% rename from src/alisolarflare/components/links/commands/SetAliLink.java rename to src/alisolarflare/components/links/Command_SetAliLink.java index 03c4e57..2b78235 100644 --- a/src/alisolarflare/components/links/commands/SetAliLink.java +++ b/src/alisolarflare/components/links/Command_SetAliLink.java @@ -1,140 +1,138 @@ -package alisolarflare.components.links.commands; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; -import org.bukkit.Location; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; - -import alisolarflare.components.links.AliLinkModule; -import alisolarflare.components.links.entities.Link; -import buttondevteam.lib.chat.TBMCCommandBase; - -/** - * This class manages the command /SetAliLink [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 PressAliLink - * @author Alisolarflare - * - */ -public class SetAliLink extends TBMCCommandBase { - public List linkList = new ArrayList(); - AliLinkModule subplugin; - private JavaPlugin plugin; - - /** - * Constructs the SetAliLink class - * - * @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. - * - * @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 - */ - @Override - 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; - } - Player player = (Player) sender; - if (args.length < 4) { - player.sendMessage("short"); - linkList.add(new Link(args[0], player.getLocation())); - save(player); - player.sendMessage("end"); - return false; - } - 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])))); - save(player); - player.sendMessage("FINISHED"); - } else { - player.sendMessage("UNCUSTOOM"); - linkList.add(new Link(args[0], player.getLocation())); - save(player); - player.sendMessage("UNFINISHED"); - return false; - } - return false; - } - - /** - * 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) { - player.sendMessage("SAAAVING"); - player.sendMessage("SAVE FAILED: TELL ALI TO FIX THE SAVE AND UN-COMMENT THE PARAGRAPH SHE COMMENTED"); - 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(); } - */ - } - - /** - * Attempts to load the previous saved state of AliLinks, from the plugin configuration file - */ - @SuppressWarnings("unchecked") - private void load() { - try { - linkList = (List) plugin.getConfig().getList("aliLinkList"); - if (linkList == null || linkList.isEmpty()) { - linkList = new ArrayList(); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - @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; - } - -} +package alisolarflare.components.links; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.StringUtils; +import org.bukkit.Location; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import buttondevteam.lib.chat.TBMCCommandBase; + +/** + * This class manages the command /SetAliLink [x] [y] [z]. This command creates an Ali-Link, a location in a world that when called on by {@link Command_PressAliLink}, creates a temporary redstone + * block, enabling wireless redstone + * + * @see Command_PressAliLink + * @author Alisolarflare + * + */ +public class Command_SetAliLink extends TBMCCommandBase { + public List linkList = new ArrayList(); + Module_AliLink subplugin; + private JavaPlugin plugin; + + /** + * Constructs the SetAliLink class + * + * @param plugin + * The plugin that contains the configuration file of SetAliLink + */ + public Command_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. + * + * @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 + */ + @Override + 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; + } + Player player = (Player) sender; + if (args.length < 4) { + player.sendMessage("short"); + linkList.add(new Memory_Link(args[0], player.getLocation())); + save(player); + player.sendMessage("end"); + return false; + } + if (StringUtils.isNumericSpace(args[1]) && StringUtils.isNumericSpace(args[2]) + && StringUtils.isNumericSpace(args[3])) { + player.sendMessage("CUUUSTOM"); + linkList.add(new Memory_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 { + player.sendMessage("UNCUSTOOM"); + linkList.add(new Memory_Link(args[0], player.getLocation())); + save(player); + player.sendMessage("UNFINISHED"); + return false; + } + return false; + } + + /** + * 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) { + player.sendMessage("SAAAVING"); + player.sendMessage("SAVE FAILED: TELL ALI TO FIX THE SAVE AND UN-COMMENT THE PARAGRAPH SHE COMMENTED"); + 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(); } + */ + } + + /** + * Attempts to load the previous saved state of AliLinks, from the plugin configuration file + */ + @SuppressWarnings("unchecked") + private void load() { + try { + linkList = (List) plugin.getConfig().getList("aliLinkList"); + if (linkList == null || linkList.isEmpty()) { + linkList = new ArrayList(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + @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; + } + +} diff --git a/src/alisolarflare/components/links/entities/Link.java b/src/alisolarflare/components/links/Memory_Link.java similarity index 74% rename from src/alisolarflare/components/links/entities/Link.java rename to src/alisolarflare/components/links/Memory_Link.java index f55bfc8..2043b7a 100644 --- a/src/alisolarflare/components/links/entities/Link.java +++ b/src/alisolarflare/components/links/Memory_Link.java @@ -1,41 +1,39 @@ -package alisolarflare.components.links.entities; - -import java.io.Serializable; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.plugin.java.JavaPlugin; - -import alisolarflare.components.links.tasks.UnpressTask; - -public class Link implements Serializable{ - /** - * - */ - private static final long serialVersionUID = 1L; - public String frequency; - public String world; - public String x; - public String y; - public String z; - - - public Link(String frequency, Location location){ - this.frequency = frequency; - this.world = location.getWorld().getName(); - this.x = "" + location.getBlockX(); - this.y = "" + location.getBlockY(); - this.z = "" + location.getBlockZ(); - //plugin.plugin.getConfig().set("frequency", 10); - } - /** - * Activates the Ali-Link - * @param plugin - */ - public void press(JavaPlugin plugin) { - Location location = new Location(plugin.getServer().getWorld(world), Integer.parseInt(x), Integer.parseInt(y), Integer.parseInt(z)); - location.getBlock().setType(Material.REDSTONE_BLOCK); - UnpressTask unPressTask = new UnpressTask(location); - unPressTask.runTaskTimer(plugin, 2, 1); - } -} +package alisolarflare.components.links; + +import java.io.Serializable; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.plugin.java.JavaPlugin; + +public class Memory_Link implements Serializable{ + /** + * + */ + private static final long serialVersionUID = 1L; + public String frequency; + public String world; + public String x; + public String y; + public String z; + + + public Memory_Link(String frequency, Location location){ + this.frequency = frequency; + this.world = location.getWorld().getName(); + this.x = "" + location.getBlockX(); + this.y = "" + location.getBlockY(); + this.z = "" + location.getBlockZ(); + //plugin.plugin.getConfig().set("frequency", 10); + } + /** + * Activates the Ali-Link + * @param plugin + */ + public void press(JavaPlugin plugin) { + Location location = new Location(plugin.getServer().getWorld(world), Integer.parseInt(x), Integer.parseInt(y), Integer.parseInt(z)); + location.getBlock().setType(Material.REDSTONE_BLOCK); + Task_UnpressTask unPressTask = new Task_UnpressTask(location); + unPressTask.runTaskTimer(plugin, 2, 1); + } +} diff --git a/src/alisolarflare/components/links/Module_AliLink.java b/src/alisolarflare/components/links/Module_AliLink.java new file mode 100644 index 0000000..a16b47b --- /dev/null +++ b/src/alisolarflare/components/links/Module_AliLink.java @@ -0,0 +1,30 @@ +package alisolarflare.components.links; + +import java.util.List; + +import org.bukkit.plugin.java.JavaPlugin; + +import alisolarflare.Module; + +public class Module_AliLink extends Module { + private Command_SetAliLink setAliLink; + + @Override + public void register(JavaPlugin plugin) { + setAliLink = new Command_SetAliLink(plugin); + + registerCommand(plugin, new Command_PressAliLink(plugin, setAliLink)); + registerCommand(plugin, setAliLink); + + } + + public void saveLinkList(JavaPlugin plugin) { + plugin.getConfig().set("aliLinkList", setAliLink.linkList); + } + + @SuppressWarnings("unchecked") + public List loadLinkList(JavaPlugin plugin) { + return (List) plugin.getConfig().getList("aliLinkList"); + } + +} diff --git a/src/alisolarflare/components/links/tasks/UnpressTask.java b/src/alisolarflare/components/links/Task_UnpressTask.java similarity index 68% rename from src/alisolarflare/components/links/tasks/UnpressTask.java rename to src/alisolarflare/components/links/Task_UnpressTask.java index 769f4f1..17c59c8 100644 --- a/src/alisolarflare/components/links/tasks/UnpressTask.java +++ b/src/alisolarflare/components/links/Task_UnpressTask.java @@ -1,21 +1,21 @@ -package alisolarflare.components.links.tasks; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.scheduler.BukkitRunnable; - -public class UnpressTask extends BukkitRunnable { - private Location location; - public UnpressTask(Location location){ - this.location = location; - } - - @SuppressWarnings("deprecation") - @Override - public void run() { - location.getBlock().setType(Material.STAINED_CLAY); - location.getBlock().setData((byte) 14); - this.cancel(); - } - -} +package alisolarflare.components.links; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.scheduler.BukkitRunnable; + +public class Task_UnpressTask extends BukkitRunnable { + private Location location; + public Task_UnpressTask(Location location){ + this.location = location; + } + + @SuppressWarnings("deprecation") + @Override + public void run() { + location.getBlock().setType(Material.STAINED_CLAY); + location.getBlock().setData((byte) 14); + this.cancel(); + } + +} diff --git a/src/alisolarflare/components/links/serializer/Deserializer.java b/src/alisolarflare/components/links/serializer/Deserializer.java deleted file mode 100644 index cfc1786..0000000 --- a/src/alisolarflare/components/links/serializer/Deserializer.java +++ /dev/null @@ -1,42 +0,0 @@ -package alisolarflare.components.links.serializer; - - -import java.io.FileInputStream; -import java.io.ObjectInputStream; -import java.util.List; - -import alisolarflare.components.links.entities.Link; - -/** - * @deprecated - * @author Alisolarflare - * - */ -public class Deserializer{ - - public static void main (String args[]) { - - //Deserializer deserializer = new Deserializer(); - //List aliLink = deserializer.loadLink(aliLink); - //System.out.println(aliLink); - } - - /**@deprecated*/ - @SuppressWarnings("unchecked") - public List loadLinkList(){ - List aliLinkList; - try{ - - FileInputStream fin = new FileInputStream("AliLinkList.ser"); - ObjectInputStream ois = new ObjectInputStream(fin); - aliLinkList = (List) ois.readObject(); - ois.close(); - - return aliLinkList; - - }catch(Exception ex){ - ex.printStackTrace(); - return null; - } - } -} diff --git a/src/alisolarflare/components/links/serializer/Serializer.java b/src/alisolarflare/components/links/serializer/Serializer.java deleted file mode 100644 index fe4efef..0000000 --- a/src/alisolarflare/components/links/serializer/Serializer.java +++ /dev/null @@ -1,38 +0,0 @@ -package alisolarflare.components.links.serializer; - - -import java.io.FileOutputStream; -import java.io.ObjectOutputStream; -import java.util.List; - -import alisolarflare.components.links.entities.Link; - -/** - * @deprecated - * @author Alisolarflare - * - */ -public class Serializer { - - public static void main (String args[]) { - - //Serializer serializer = new Serializer(); - //serializer.saveLink(plugin, frequency, location) - } - /**@deprecated*/ - public void saveLinkList(List aliLinkList){ - //saves link - - try{ - - FileOutputStream fout = new FileOutputStream("AliLinkList.ser"); - ObjectOutputStream oos = new ObjectOutputStream(fout); - oos.writeObject(aliLinkList); - oos.close(); - System.out.println("Done"); - - }catch(Exception ex){ - ex.printStackTrace(); - } - } -} \ No newline at end of file diff --git a/src/alisolarflare/creativeboundaries/commands/Cbgm0.java b/src/alisolarflare/creativeboundaries/Command_Cbgm0.java similarity index 73% rename from src/alisolarflare/creativeboundaries/commands/Cbgm0.java rename to src/alisolarflare/creativeboundaries/Command_Cbgm0.java index 6e5fd2a..afa0aa9 100644 --- a/src/alisolarflare/creativeboundaries/commands/Cbgm0.java +++ b/src/alisolarflare/creativeboundaries/Command_Cbgm0.java @@ -1,49 +1,48 @@ -package alisolarflare.creativeboundaries.commands; - -import org.bukkit.GameMode; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import alisolarflare.creativeboundaries.CreativeBoundariesModule; -import buttondevteam.lib.chat.TBMCCommandBase; - -public class Cbgm0 extends TBMCCommandBase{ - - private CreativeBoundariesModule module; - - public Cbgm0(CreativeBoundariesModule module) { - this.module = module; - } - - @Override - public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) { - if (!(sender instanceof Player)){ - sender.sendMessage("You must be a player to use this command!"); - return false; - } - - Player player = (Player) sender; - player.setGameMode(GameMode.SURVIVAL); - module.cbCreatives.remove(player); - return false; - } - - @Override - public String[] GetHelpText(String alias) { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean GetPlayerOnly() { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean GetModOnly() { - // TODO Auto-generated method stub - return false; - } - -} +package alisolarflare.creativeboundaries; + +import org.bukkit.GameMode; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import buttondevteam.lib.chat.TBMCCommandBase; + +public class Command_Cbgm0 extends TBMCCommandBase{ + + private Module_CreativeBoundaries module; + + public Command_Cbgm0(Module_CreativeBoundaries module) { + this.module = module; + } + + @Override + public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) { + if (!(sender instanceof Player)){ + sender.sendMessage("You must be a player to use this command!"); + return false; + } + + Player player = (Player) sender; + player.setGameMode(GameMode.SURVIVAL); + module.cbCreatives.remove(player); + return false; + } + + @Override + public String[] GetHelpText(String alias) { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean GetPlayerOnly() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean GetModOnly() { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/src/alisolarflare/creativeboundaries/commands/Cbgm1.java b/src/alisolarflare/creativeboundaries/Command_Cbgm1.java similarity index 85% rename from src/alisolarflare/creativeboundaries/commands/Cbgm1.java rename to src/alisolarflare/creativeboundaries/Command_Cbgm1.java index 04fba33..c63e430 100644 --- a/src/alisolarflare/creativeboundaries/commands/Cbgm1.java +++ b/src/alisolarflare/creativeboundaries/Command_Cbgm1.java @@ -1,82 +1,81 @@ -package alisolarflare.creativeboundaries.commands; - -import org.bukkit.GameMode; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import com.palmergames.bukkit.towny.exceptions.NotRegisteredException; -import com.palmergames.bukkit.towny.object.Resident; -import com.palmergames.bukkit.towny.object.Town; -import com.palmergames.bukkit.towny.object.TownBlock; -import com.palmergames.bukkit.towny.object.TownyUniverse; - -import alisolarflare.creativeboundaries.CreativeBoundariesModule; -import buttondevteam.lib.chat.TBMCCommandBase; - -public class Cbgm1 extends TBMCCommandBase { - - private CreativeBoundariesModule module; - - public Cbgm1(CreativeBoundariesModule module) { - this.module = module; - } - - @Override - public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) { - - if (!(sender instanceof Player)) { - sender.sendMessage("You must be a player to use this command!"); - return false; - } - - Player player = (Player) sender; - - TownBlock tb = TownyUniverse.getTownBlock(player.getLocation()); - if (tb == null) { - player.sendMessage("You aren't standing in a town or some other error occured."); - player.sendMessage("TownBlock is null."); - return false; - } - Town town; - try { - town = tb.getTown(); - } catch (NotRegisteredException e) { - player.sendMessage("You aren't standing in a town or some other error occured."); - player.sendMessage("TownBlock's town is not registered."); - return false; - } - if (town == null) { - player.sendMessage("ERROR: The town you're standing in is Null."); - return false; - } - - for(Resident res : town.getResidents()){ - if (res.getName().toString().equals(player.getName().toString())){ - player.setGameMode(GameMode.CREATIVE); - module.cbCreatives.add(player); - return true; - } - } - player.sendMessage("Sorry, you're not part of this town"); - return false; - } - - @Override - public String[] GetHelpText(String alias) { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean GetPlayerOnly() { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean GetModOnly() { - // TODO Auto-generated method stub - return false; - } - -} +package alisolarflare.creativeboundaries; + +import org.bukkit.GameMode; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.palmergames.bukkit.towny.exceptions.NotRegisteredException; +import com.palmergames.bukkit.towny.object.Resident; +import com.palmergames.bukkit.towny.object.Town; +import com.palmergames.bukkit.towny.object.TownBlock; +import com.palmergames.bukkit.towny.object.TownyUniverse; + +import buttondevteam.lib.chat.TBMCCommandBase; + +public class Command_Cbgm1 extends TBMCCommandBase { + + private Module_CreativeBoundaries module; + + public Command_Cbgm1(Module_CreativeBoundaries module) { + this.module = module; + } + + @Override + public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) { + + if (!(sender instanceof Player)) { + sender.sendMessage("You must be a player to use this command!"); + return false; + } + + Player player = (Player) sender; + + TownBlock tb = TownyUniverse.getTownBlock(player.getLocation()); + if (tb == null) { + player.sendMessage("You aren't standing in a town or some other error occured."); + player.sendMessage("TownBlock is null."); + return false; + } + Town town; + try { + town = tb.getTown(); + } catch (NotRegisteredException e) { + player.sendMessage("You aren't standing in a town or some other error occured."); + player.sendMessage("TownBlock's town is not registered."); + return false; + } + if (town == null) { + player.sendMessage("ERROR: The town you're standing in is Null."); + return false; + } + + for(Resident res : town.getResidents()){ + if (res.getName().toString().equals(player.getName().toString())){ + player.setGameMode(GameMode.CREATIVE); + module.cbCreatives.add(player); + return true; + } + } + player.sendMessage("Sorry, you're not part of this town"); + return false; + } + + @Override + public String[] GetHelpText(String alias) { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean GetPlayerOnly() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean GetModOnly() { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/src/alisolarflare/creativeboundaries/commands/SetDickmode.java b/src/alisolarflare/creativeboundaries/Command_SetDickmode.java similarity index 78% rename from src/alisolarflare/creativeboundaries/commands/SetDickmode.java rename to src/alisolarflare/creativeboundaries/Command_SetDickmode.java index 3b1654b..fb0aa8d 100644 --- a/src/alisolarflare/creativeboundaries/commands/SetDickmode.java +++ b/src/alisolarflare/creativeboundaries/Command_SetDickmode.java @@ -1,54 +1,53 @@ -package alisolarflare.creativeboundaries.commands; - -import org.bukkit.command.CommandSender; - -import alisolarflare.creativeboundaries.CreativeBoundariesModule; -import buttondevteam.lib.chat.TBMCCommandBase; - -public class SetDickmode extends TBMCCommandBase{ - private CreativeBoundariesModule module; - - public SetDickmode(CreativeBoundariesModule module){ - this.module = module; - } - - @Override - public boolean OnCommand(CommandSender sender, String label, String[] args) { - if (sender.getName().equals("Alisolarflare") || sender.getName().equals("iie")){ - if(args[0] == null){ - sender.sendMessage("You must use True, False, 1, or 0 as arguments!"); - return false; - } - if(args[0].equalsIgnoreCase("TRUE") || args[0].equalsIgnoreCase("1")){ - sender.sendMessage("Dickmode has been turned on!"); - module.dickmode=(true); - return true; - } - if(args[0].equalsIgnoreCase("FALSE") || args[0].equalsIgnoreCase("0")){ - sender.sendMessage("Dickmode has been turned off!"); - module.dickmode=(false); - return true; - } - return false; - } - return false; - } - - @Override - public String[] GetHelpText(String alias) { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean GetPlayerOnly() { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean GetModOnly() { - // TODO Auto-generated method stub - return false; - } -} +package alisolarflare.creativeboundaries; + +import org.bukkit.command.CommandSender; + +import buttondevteam.lib.chat.TBMCCommandBase; + +public class Command_SetDickmode extends TBMCCommandBase{ + private Module_CreativeBoundaries module; + + public Command_SetDickmode(Module_CreativeBoundaries module){ + this.module = module; + } + + @Override + public boolean OnCommand(CommandSender sender, String label, String[] args) { + if (sender.getName().equals("Alisolarflare") || sender.getName().equals("iie")){ + if(args[0] == null){ + sender.sendMessage("You must use True, False, 1, or 0 as arguments!"); + return false; + } + if(args[0].equalsIgnoreCase("TRUE") || args[0].equalsIgnoreCase("1")){ + sender.sendMessage("Dickmode has been turned on!"); + module.dickmode=(true); + return true; + } + if(args[0].equalsIgnoreCase("FALSE") || args[0].equalsIgnoreCase("0")){ + sender.sendMessage("Dickmode has been turned off!"); + module.dickmode=(false); + return true; + } + return false; + } + return false; + } + + @Override + public String[] GetHelpText(String alias) { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean GetPlayerOnly() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean GetModOnly() { + // TODO Auto-generated method stub + return false; + } +} diff --git a/src/alisolarflare/creativeboundaries/CreativeBoundariesModule.java b/src/alisolarflare/creativeboundaries/CreativeBoundariesModule.java deleted file mode 100644 index 39dac19..0000000 --- a/src/alisolarflare/creativeboundaries/CreativeBoundariesModule.java +++ /dev/null @@ -1,30 +0,0 @@ -package alisolarflare.creativeboundaries; - -import java.util.ArrayList; -import java.util.List; - -import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; - -import alisolarflare.Module; -import alisolarflare.creativeboundaries.commands.Cbgm0; -import alisolarflare.creativeboundaries.commands.Cbgm1; -import alisolarflare.creativeboundaries.commands.SetDickmode; -import alisolarflare.creativeboundaries.listeners.ItemRestrictionListener; -import alisolarflare.creativeboundaries.listeners.PlotChangeListener; - - -public class CreativeBoundariesModule extends Module{ - public boolean dickmode; - public List cbCreatives = new ArrayList(); - @Override - public void register(JavaPlugin plugin) { - registerCommand(plugin, new Cbgm1(this)); - registerCommand(plugin, new Cbgm0(this)); - registerCommand(plugin, new SetDickmode(this)); - - registerListener(plugin, new PlotChangeListener(this)); - //registerListener(plugin, new ItemRestrictionListener(this)); - } - -} diff --git a/src/alisolarflare/creativeboundaries/listeners/ItemRestrictionListener.java b/src/alisolarflare/creativeboundaries/Listener_ItemRestriction.java similarity index 52% rename from src/alisolarflare/creativeboundaries/listeners/ItemRestrictionListener.java rename to src/alisolarflare/creativeboundaries/Listener_ItemRestriction.java index 9023755..37d5ac7 100644 --- a/src/alisolarflare/creativeboundaries/listeners/ItemRestrictionListener.java +++ b/src/alisolarflare/creativeboundaries/Listener_ItemRestriction.java @@ -1,26 +1,24 @@ -package alisolarflare.creativeboundaries.listeners; - -import java.util.List; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.inventory.InventoryCreativeEvent; - -import alisolarflare.creativeboundaries.CreativeBoundariesModule; - -public class ItemRestrictionListener implements Listener { - - private CreativeBoundariesModule module; - - public ItemRestrictionListener(CreativeBoundariesModule module) { - this.module = module; - } - - @EventHandler - public void onItemTake(InventoryCreativeEvent event){ - List cbCreatives = module.cbCreatives; - - } - -} +package alisolarflare.creativeboundaries; + +import java.util.List; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.InventoryCreativeEvent; + +public class Listener_ItemRestriction implements Listener { + + private Module_CreativeBoundaries module; + + public Listener_ItemRestriction(Module_CreativeBoundaries module) { + this.module = module; + } + + @EventHandler + public void onItemTake(InventoryCreativeEvent event){ + List cbCreatives = module.cbCreatives; + + } + +} diff --git a/src/alisolarflare/creativeboundaries/listeners/PlotChangeListener.java b/src/alisolarflare/creativeboundaries/Listener_PlotChange.java similarity index 84% rename from src/alisolarflare/creativeboundaries/listeners/PlotChangeListener.java rename to src/alisolarflare/creativeboundaries/Listener_PlotChange.java index e911b98..980bdb6 100644 --- a/src/alisolarflare/creativeboundaries/listeners/PlotChangeListener.java +++ b/src/alisolarflare/creativeboundaries/Listener_PlotChange.java @@ -1,69 +1,67 @@ -package alisolarflare.creativeboundaries.listeners; - -import org.bukkit.GameMode; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; - -import com.palmergames.bukkit.towny.event.PlayerChangePlotEvent; -import com.palmergames.bukkit.towny.exceptions.NotRegisteredException; -import com.palmergames.bukkit.towny.object.Resident; -import com.palmergames.bukkit.towny.object.Town; -import com.palmergames.bukkit.towny.object.TownBlock; -import com.palmergames.bukkit.towny.object.TownyUniverse; - -import alisolarflare.creativeboundaries.CreativeBoundariesModule; - -public class PlotChangeListener implements Listener{ - public CreativeBoundariesModule module; - public PlotChangeListener(CreativeBoundariesModule module){ - this.module = module; - } - @EventHandler - public void onPlayerPlotChange(PlayerChangePlotEvent plotEvent){ - Player player = plotEvent.getPlayer(); - if (module.dickmode == false){ - return; - } - if (plotEvent.getPlayer().getGameMode() != GameMode.CREATIVE){ - return; - } - if (!(module.cbCreatives.contains(plotEvent.getPlayer()))){ - return; - } - TownBlock tb = TownyUniverse.getTownBlock(player.getLocation()); - if (tb == null) { - player.setGameMode(GameMode.SURVIVAL); - player.sendMessage("You have left your town boundaries!"); - module.cbCreatives.remove(player); - return; - } - Town town; - try { - town = tb.getTown(); - } catch (NotRegisteredException e) { - player.setGameMode(GameMode.SURVIVAL); - player.sendMessage("You have left your town boundaries!!"); - module.cbCreatives.remove(player); - return; - } - - if (town == null) { - player.setGameMode(GameMode.SURVIVAL); - player.sendMessage("You have left your town boundaries!!!"); - module.cbCreatives.remove(player); - return; - } - boolean townHasRes = false; - for(Resident res : town.getResidents()){ - if (res.getName().toString().equals(player.getName().toString())){ - townHasRes = true; - } - } - if (!townHasRes){ - player.setGameMode(GameMode.SURVIVAL); - player.sendMessage("You have left your town boundaries!!!!"); - module.cbCreatives.remove(player); - } - } -} +package alisolarflare.creativeboundaries; + +import org.bukkit.GameMode; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; + +import com.palmergames.bukkit.towny.event.PlayerChangePlotEvent; +import com.palmergames.bukkit.towny.exceptions.NotRegisteredException; +import com.palmergames.bukkit.towny.object.Resident; +import com.palmergames.bukkit.towny.object.Town; +import com.palmergames.bukkit.towny.object.TownBlock; +import com.palmergames.bukkit.towny.object.TownyUniverse; + +public class Listener_PlotChange implements Listener{ + public Module_CreativeBoundaries module; + public Listener_PlotChange(Module_CreativeBoundaries module){ + this.module = module; + } + @EventHandler + public void onPlayerPlotChange(PlayerChangePlotEvent plotEvent){ + Player player = plotEvent.getPlayer(); + if (module.dickmode == false){ + return; + } + if (plotEvent.getPlayer().getGameMode() != GameMode.CREATIVE){ + return; + } + if (!(module.cbCreatives.contains(plotEvent.getPlayer()))){ + return; + } + TownBlock tb = TownyUniverse.getTownBlock(player.getLocation()); + if (tb == null) { + player.setGameMode(GameMode.SURVIVAL); + player.sendMessage("You have left your town boundaries!"); + module.cbCreatives.remove(player); + return; + } + Town town; + try { + town = tb.getTown(); + } catch (NotRegisteredException e) { + player.setGameMode(GameMode.SURVIVAL); + player.sendMessage("You have left your town boundaries!!"); + module.cbCreatives.remove(player); + return; + } + + if (town == null) { + player.setGameMode(GameMode.SURVIVAL); + player.sendMessage("You have left your town boundaries!!!"); + module.cbCreatives.remove(player); + return; + } + boolean townHasRes = false; + for(Resident res : town.getResidents()){ + if (res.getName().toString().equals(player.getName().toString())){ + townHasRes = true; + } + } + if (!townHasRes){ + player.setGameMode(GameMode.SURVIVAL); + player.sendMessage("You have left your town boundaries!!!!"); + module.cbCreatives.remove(player); + } + } +} diff --git a/src/alisolarflare/creativeboundaries/Module_CreativeBoundaries.java b/src/alisolarflare/creativeboundaries/Module_CreativeBoundaries.java new file mode 100644 index 0000000..fcd58da --- /dev/null +++ b/src/alisolarflare/creativeboundaries/Module_CreativeBoundaries.java @@ -0,0 +1,25 @@ +package alisolarflare.creativeboundaries; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import alisolarflare.Module; + + +public class Module_CreativeBoundaries extends Module{ + public boolean dickmode; + public List cbCreatives = new ArrayList(); + @Override + public void register(JavaPlugin plugin) { + registerCommand(plugin, new Command_Cbgm1(this)); + registerCommand(plugin, new Command_Cbgm0(this)); + registerCommand(plugin, new Command_SetDickmode(this)); + + registerListener(plugin, new Listener_PlotChange(this)); + //registerListener(plugin, new ItemRestrictionListener(this)); + } + +} diff --git a/src/alisolarflare/easyuhc/commands/ActivatePowers.java b/src/alisolarflare/easyuhc/Command_ActivatePowers.java similarity index 85% rename from src/alisolarflare/easyuhc/commands/ActivatePowers.java rename to src/alisolarflare/easyuhc/Command_ActivatePowers.java index 737ac72..26789ce 100644 --- a/src/alisolarflare/easyuhc/commands/ActivatePowers.java +++ b/src/alisolarflare/easyuhc/Command_ActivatePowers.java @@ -1,10 +1,10 @@ -package alisolarflare.easyuhc.commands; +package alisolarflare.easyuhc; import org.bukkit.command.CommandSender; import buttondevteam.lib.chat.TBMCCommandBase; -public class ActivatePowers extends TBMCCommandBase{ +public class Command_ActivatePowers extends TBMCCommandBase{ @Override public boolean OnCommand(CommandSender sender, String alias, String[] args) { diff --git a/src/alisolarflare/easyuhc/commands/SetupWorldBorders.java b/src/alisolarflare/easyuhc/Command_SetupWorldBorders.java similarity index 85% rename from src/alisolarflare/easyuhc/commands/SetupWorldBorders.java rename to src/alisolarflare/easyuhc/Command_SetupWorldBorders.java index ef90ae8..db45dc0 100644 --- a/src/alisolarflare/easyuhc/commands/SetupWorldBorders.java +++ b/src/alisolarflare/easyuhc/Command_SetupWorldBorders.java @@ -1,10 +1,10 @@ -package alisolarflare.easyuhc.commands; +package alisolarflare.easyuhc; import org.bukkit.command.CommandSender; import buttondevteam.lib.chat.TBMCCommandBase; -public class SetupWorldBorders extends TBMCCommandBase { +public class Command_SetupWorldBorders extends TBMCCommandBase { @Override public boolean OnCommand(CommandSender sender, String alias, String[] args) { diff --git a/src/alisolarflare/easyuhc/commands/ShrinkWorldBorders.java b/src/alisolarflare/easyuhc/Command_ShrinkWorldBorders.java similarity index 85% rename from src/alisolarflare/easyuhc/commands/ShrinkWorldBorders.java rename to src/alisolarflare/easyuhc/Command_ShrinkWorldBorders.java index bd083a6..b25bf11 100644 --- a/src/alisolarflare/easyuhc/commands/ShrinkWorldBorders.java +++ b/src/alisolarflare/easyuhc/Command_ShrinkWorldBorders.java @@ -1,10 +1,10 @@ -package alisolarflare.easyuhc.commands; +package alisolarflare.easyuhc; import org.bukkit.command.CommandSender; import buttondevteam.lib.chat.TBMCCommandBase; -public class ShrinkWorldBorders extends TBMCCommandBase { +public class Command_ShrinkWorldBorders extends TBMCCommandBase { @Override public boolean OnCommand(CommandSender sender, String alias, String[] args) { diff --git a/src/alisolarflare/easyuhc/commands/SpreadPlayers.java b/src/alisolarflare/easyuhc/Command_SpreadPlayers.java similarity index 85% rename from src/alisolarflare/easyuhc/commands/SpreadPlayers.java rename to src/alisolarflare/easyuhc/Command_SpreadPlayers.java index a5798ac..f83e70a 100644 --- a/src/alisolarflare/easyuhc/commands/SpreadPlayers.java +++ b/src/alisolarflare/easyuhc/Command_SpreadPlayers.java @@ -1,10 +1,10 @@ -package alisolarflare.easyuhc.commands; +package alisolarflare.easyuhc; import org.bukkit.command.CommandSender; import buttondevteam.lib.chat.TBMCCommandBase; -public class SpreadPlayers extends TBMCCommandBase{ +public class Command_SpreadPlayers extends TBMCCommandBase{ @Override public boolean OnCommand(CommandSender sender, String alias, String[] args) { diff --git a/src/alisolarflare/easyuhc/commands/StartTimer.java b/src/alisolarflare/easyuhc/Command_StartTimer.java similarity index 86% rename from src/alisolarflare/easyuhc/commands/StartTimer.java rename to src/alisolarflare/easyuhc/Command_StartTimer.java index 927344e..96dad6f 100644 --- a/src/alisolarflare/easyuhc/commands/StartTimer.java +++ b/src/alisolarflare/easyuhc/Command_StartTimer.java @@ -1,10 +1,10 @@ -package alisolarflare.easyuhc.commands; +package alisolarflare.easyuhc; import org.bukkit.command.CommandSender; import buttondevteam.lib.chat.TBMCCommandBase; -public class StartTimer extends TBMCCommandBase{ +public class Command_StartTimer extends TBMCCommandBase{ @Override public boolean OnCommand(CommandSender sender, String alias, String[] args) { diff --git a/src/alisolarflare/easyuhc/commands/StartUHC.java b/src/alisolarflare/easyuhc/Command_StartUHC.java similarity index 86% rename from src/alisolarflare/easyuhc/commands/StartUHC.java rename to src/alisolarflare/easyuhc/Command_StartUHC.java index 2a06889..7cc116d 100644 --- a/src/alisolarflare/easyuhc/commands/StartUHC.java +++ b/src/alisolarflare/easyuhc/Command_StartUHC.java @@ -1,10 +1,10 @@ -package alisolarflare.easyuhc.commands; +package alisolarflare.easyuhc; import org.bukkit.command.CommandSender; import buttondevteam.lib.chat.TBMCCommandBase; -public class StartUHC extends TBMCCommandBase{ +public class Command_StartUHC extends TBMCCommandBase{ @Override public boolean OnCommand(CommandSender sender, String alias, String[] args) { diff --git a/src/alisolarflare/easyuhc/commands/TeleportToUHC.java b/src/alisolarflare/easyuhc/Command_TeleportToUHC.java similarity index 85% rename from src/alisolarflare/easyuhc/commands/TeleportToUHC.java rename to src/alisolarflare/easyuhc/Command_TeleportToUHC.java index 5a5c6d0..3f46306 100644 --- a/src/alisolarflare/easyuhc/commands/TeleportToUHC.java +++ b/src/alisolarflare/easyuhc/Command_TeleportToUHC.java @@ -1,10 +1,10 @@ -package alisolarflare.easyuhc.commands; +package alisolarflare.easyuhc; import org.bukkit.command.CommandSender; import buttondevteam.lib.chat.TBMCCommandBase; -public class TeleportToUHC extends TBMCCommandBase{ +public class Command_TeleportToUHC extends TBMCCommandBase{ @Override public boolean OnCommand(CommandSender sender, String alias, String[] args) { diff --git a/src/alisolarflare/easyuhc/EasyUHCModule.java b/src/alisolarflare/easyuhc/EasyUHCModule.java deleted file mode 100644 index 408e909..0000000 --- a/src/alisolarflare/easyuhc/EasyUHCModule.java +++ /dev/null @@ -1,24 +0,0 @@ -package alisolarflare.easyuhc; - -import org.bukkit.plugin.java.JavaPlugin; - -import alisolarflare.Module; -import alisolarflare.easyuhc.commands.ActivatePowers; -import alisolarflare.easyuhc.commands.SetupWorldBorders; -import alisolarflare.easyuhc.commands.SpreadPlayers; -import alisolarflare.easyuhc.commands.StartTimer; -import alisolarflare.easyuhc.commands.StartUHC; -import alisolarflare.easyuhc.commands.TeleportToUHC; - -public class EasyUHCModule extends Module{ - @Override - public void register(JavaPlugin plugin) { - registerCommand(plugin, new ActivatePowers()); - registerCommand(plugin, new SetupWorldBorders()); - registerCommand(plugin, new SetupWorldBorders()); - registerCommand(plugin, new SpreadPlayers()); - registerCommand(plugin, new StartTimer()); - registerCommand(plugin, new StartUHC()); - registerCommand(plugin, new TeleportToUHC()); - } -} diff --git a/src/alisolarflare/easyuhc/Module_EasyUHC.java b/src/alisolarflare/easyuhc/Module_EasyUHC.java new file mode 100644 index 0000000..4ad1b1a --- /dev/null +++ b/src/alisolarflare/easyuhc/Module_EasyUHC.java @@ -0,0 +1,18 @@ +package alisolarflare.easyuhc; + +import org.bukkit.plugin.java.JavaPlugin; + +import alisolarflare.Module; + +public class Module_EasyUHC extends Module{ + @Override + public void register(JavaPlugin plugin) { + registerCommand(plugin, new Command_ActivatePowers()); + registerCommand(plugin, new Command_SetupWorldBorders()); + registerCommand(plugin, new Command_SetupWorldBorders()); + registerCommand(plugin, new Command_SpreadPlayers()); + registerCommand(plugin, new Command_StartTimer()); + registerCommand(plugin, new Command_StartUHC()); + registerCommand(plugin, new Command_TeleportToUHC()); + } +} diff --git a/src/alisolarflare/magic/tricks/AliArrowListener.java b/src/alisolarflare/magic/AliArrowListener.java similarity index 92% rename from src/alisolarflare/magic/tricks/AliArrowListener.java rename to src/alisolarflare/magic/AliArrowListener.java index 36b8e12..ecd79e6 100644 --- a/src/alisolarflare/magic/tricks/AliArrowListener.java +++ b/src/alisolarflare/magic/AliArrowListener.java @@ -1,39 +1,39 @@ -package alisolarflare.magic.tricks; - -import org.bukkit.entity.Arrow; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.ProjectileLaunchEvent; -import org.bukkit.plugin.java.JavaPlugin; - -public class AliArrowListener implements Listener { - private final JavaPlugin plugin; - - public AliArrowListener(JavaPlugin plugin){ - this.plugin = plugin; - } - - @EventHandler - public void onProjectileLaunch(ProjectileLaunchEvent event){ - if(event.getEntity().getType() != EntityType.ARROW){ - return; - } - Arrow arrow = (Arrow) event.getEntity(); - if (!(arrow.isCritical()) || !(arrow.getShooter() instanceof Player)){ - return; - } - - String user = ((Player) arrow.getShooter()).getName(); - - for (String permittedUser : AliArrowTask.permittedUsers){ - if(permittedUser.equalsIgnoreCase(user)){ - new AliArrowTask(arrow,user).runTaskTimer(plugin, 2, 1); - break; - } - } - return; - - } +package alisolarflare.magic; + +import org.bukkit.entity.Arrow; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.ProjectileLaunchEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class AliArrowListener implements Listener { + private final JavaPlugin plugin; + + public AliArrowListener(JavaPlugin plugin){ + this.plugin = plugin; + } + + @EventHandler + public void onProjectileLaunch(ProjectileLaunchEvent event){ + if(event.getEntity().getType() != EntityType.ARROW){ + return; + } + Arrow arrow = (Arrow) event.getEntity(); + if (!(arrow.isCritical()) || !(arrow.getShooter() instanceof Player)){ + return; + } + + String user = ((Player) arrow.getShooter()).getName(); + + for (String permittedUser : AliArrowTask.permittedUsers){ + if(permittedUser.equalsIgnoreCase(user)){ + new AliArrowTask(arrow,user).runTaskTimer(plugin, 2, 1); + break; + } + } + return; + + } } \ No newline at end of file diff --git a/src/alisolarflare/magic/tricks/AliArrowTask.java b/src/alisolarflare/magic/AliArrowTask.java similarity index 92% rename from src/alisolarflare/magic/tricks/AliArrowTask.java rename to src/alisolarflare/magic/AliArrowTask.java index 10252b8..055a4fd 100644 --- a/src/alisolarflare/magic/tricks/AliArrowTask.java +++ b/src/alisolarflare/magic/AliArrowTask.java @@ -1,40 +1,40 @@ -package alisolarflare.magic.tricks; - -import org.bukkit.Particle; -import org.bukkit.entity.Arrow; -import org.bukkit.scheduler.BukkitRunnable; - -public class AliArrowTask extends BukkitRunnable { - static String[] permittedUsers = {"alisolarflare", "Zanthr", "NorbiPeti"}; - String name; - Arrow arrow; - - public AliArrowTask(Arrow arrow, String name) { - this.name = name; - this.arrow = arrow; - } - - @Override - public void run() { - if (arrow.isOnGround() || arrow.isDead()) { - this.cancel(); - } - - switch(name.toLowerCase()){ - case "alisolarflare": - arrow.getWorld().spawnParticle(Particle.VILLAGER_HAPPY, arrow.getLocation(), 1); - break; - - case "zanthr": - arrow.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, arrow.getLocation(), 1); - arrow.getWorld().spawnParticle(Particle.FLAME, arrow.getLocation(), 1); - break; - - case "norbipeti": - arrow.getWorld().spawnParticle(Particle.LAVA, arrow.getLocation(), 1); - break; - } - - } - -} +package alisolarflare.magic; + +import org.bukkit.Particle; +import org.bukkit.entity.Arrow; +import org.bukkit.scheduler.BukkitRunnable; + +public class AliArrowTask extends BukkitRunnable { + static String[] permittedUsers = {"alisolarflare", "Zanthr", "NorbiPeti"}; + String name; + Arrow arrow; + + public AliArrowTask(Arrow arrow, String name) { + this.name = name; + this.arrow = arrow; + } + + @Override + public void run() { + if (arrow.isOnGround() || arrow.isDead()) { + this.cancel(); + } + + switch(name.toLowerCase()){ + case "alisolarflare": + arrow.getWorld().spawnParticle(Particle.VILLAGER_HAPPY, arrow.getLocation(), 1); + break; + + case "zanthr": + arrow.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, arrow.getLocation(), 1); + arrow.getWorld().spawnParticle(Particle.FLAME, arrow.getLocation(), 1); + break; + + case "norbipeti": + arrow.getWorld().spawnParticle(Particle.LAVA, arrow.getLocation(), 1); + break; + } + + } + +} diff --git a/src/alisolarflare/magic/tricks/BoomBowDeathListener.java b/src/alisolarflare/magic/BoomBowDeathListener.java similarity index 90% rename from src/alisolarflare/magic/tricks/BoomBowDeathListener.java rename to src/alisolarflare/magic/BoomBowDeathListener.java index 427537e..f16d3c1 100644 --- a/src/alisolarflare/magic/tricks/BoomBowDeathListener.java +++ b/src/alisolarflare/magic/BoomBowDeathListener.java @@ -1,18 +1,18 @@ -package alisolarflare.magic.tricks; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.PlayerDeathEvent; - -public class BoomBowDeathListener implements Listener{ - @EventHandler - public void onBoomBowDeath(PlayerDeathEvent event){ - Player player = event.getEntity(); - - if (player.getLastDamage() > 7.42420 && player.getLastDamage() < 7.42429){ - player.sendMessage("42!"); - event.setDeathMessage(player.getName() + " got trigger happy with the [Boom Bow]"); - } - } -} +package alisolarflare.magic; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.PlayerDeathEvent; + +public class BoomBowDeathListener implements Listener{ + @EventHandler + public void onBoomBowDeath(PlayerDeathEvent event){ + Player player = event.getEntity(); + + if (player.getLastDamage() > 7.42420 && player.getLastDamage() < 7.42429){ + player.sendMessage("42!"); + event.setDeathMessage(player.getName() + " got trigger happy with the [Boom Bow]"); + } + } +} diff --git a/src/alisolarflare/magic/tricks/BoomBowListener.java b/src/alisolarflare/magic/BoomBowListener.java similarity index 95% rename from src/alisolarflare/magic/tricks/BoomBowListener.java rename to src/alisolarflare/magic/BoomBowListener.java index 5e74bd8..8381927 100644 --- a/src/alisolarflare/magic/tricks/BoomBowListener.java +++ b/src/alisolarflare/magic/BoomBowListener.java @@ -1,107 +1,107 @@ -package alisolarflare.magic.tricks; - -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Particle; -import org.bukkit.Sound; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.block.Action; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; - -public class BoomBowListener implements Listener { - JavaPlugin plugin; - public BoomBowListener(JavaPlugin plugin){ - this.plugin = plugin; - } - @EventHandler - public void ClickEvent(PlayerInteractEvent event){ - FlyBowBoost(event); - - } - public void FlyBowBoost(PlayerInteractEvent event){ - - //ACTION SANITATION - if(!(event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK)) return; - if(!(event.getPlayer().isGliding())) return; - if(!(event.getMaterial() == Material.BOW)) return; - - //BOW SANITATION - ItemStack bow = event.getItem(); - if(!(bow.containsEnchantment(Enchantment.ARROW_KNOCKBACK))) return; - if(!(bow.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK) == 3)) return; - if(!(bow.getItemMeta().getDisplayName().contains("BOOM BOW"))) return; - - //PLAYER SANITATION - Player player = event.getPlayer(); - if(player.getGameMode().equals(GameMode.CREATIVE))return; - - if(bow.containsEnchantment(Enchantment.ARROW_INFINITE)){ - //HAS INIFINITY - Activate(event); - - }else if((player.getInventory().contains(Material.TNT))){ - //HAS TNT - Activate(event); - - //Reduce tnt by 1 - int tntSlot = player.getInventory().first(Material.TNT); - ItemStack tntStack = player.getInventory().getItem(tntSlot); - if(tntStack.getAmount() > 3){ - tntStack.setAmount(tntStack.getAmount()-3); - }else{ - player.getInventory().remove(tntStack); - } - - }else{ - return; - } - } - - - - public void Activate(PlayerInteractEvent event){ - //INIT - Player variables - Player player = event.getPlayer(); - Location playerLocation = player.getLocation(); - ItemStack boomBow = player.getInventory().getItemInMainHand(); - - //TODO: NERF - boomDecay - //TODO: NERF - endCrystal - //TODO: NERF - healthReduction - //TODO: NERF - localized - - if(BoomBowRule.boomDecay) - new BoomDecayTask(player).runTaskTimer(plugin, 1, 1); - if(BoomBowRule.endCrystal){ - //BoomBowCyrstalSpawn - } - if(BoomBowRule.healthReduction){ - player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 400, -1)); - } - if(BoomBowRule.localized); - - - //SET - Player Velocity - player.setVelocity(playerLocation.getDirection().normalize().multiply(3.0)); - - //CREATE - Explosion + damage - player.getWorld().playSound(playerLocation, Sound.ENTITY_GENERIC_EXPLODE, 10, -20); - player.getWorld().spawnParticle(Particle.EXPLOSION_HUGE, playerLocation, 2); - player.damage(7.42425, player); - player.sendMessage(player.getLastDamage() + ""); - boomBow.setDurability((short) (boomBow.getDurability() + 3)); - if(boomBow.getDurability() < 0){ - player.getInventory().setItemInMainHand(null); - player.getWorld().playSound(playerLocation, Sound.ENTITY_ITEM_BREAK, 0, 0); - } - - } -} +package alisolarflare.magic; + +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Particle; +import org.bukkit.Sound; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class BoomBowListener implements Listener { + JavaPlugin plugin; + public BoomBowListener(JavaPlugin plugin){ + this.plugin = plugin; + } + @EventHandler + public void ClickEvent(PlayerInteractEvent event){ + FlyBowBoost(event); + + } + public void FlyBowBoost(PlayerInteractEvent event){ + + //ACTION SANITATION + if(!(event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK)) return; + if(!(event.getPlayer().isGliding())) return; + if(!(event.getMaterial() == Material.BOW)) return; + + //BOW SANITATION + ItemStack bow = event.getItem(); + if(!(bow.containsEnchantment(Enchantment.ARROW_KNOCKBACK))) return; + if(!(bow.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK) == 3)) return; + if(!(bow.getItemMeta().getDisplayName().contains("BOOM BOW"))) return; + + //PLAYER SANITATION + Player player = event.getPlayer(); + if(player.getGameMode().equals(GameMode.CREATIVE))return; + + if(bow.containsEnchantment(Enchantment.ARROW_INFINITE)){ + //HAS INIFINITY + Activate(event); + + }else if((player.getInventory().contains(Material.TNT))){ + //HAS TNT + Activate(event); + + //Reduce tnt by 1 + int tntSlot = player.getInventory().first(Material.TNT); + ItemStack tntStack = player.getInventory().getItem(tntSlot); + if(tntStack.getAmount() > 3){ + tntStack.setAmount(tntStack.getAmount()-3); + }else{ + player.getInventory().remove(tntStack); + } + + }else{ + return; + } + } + + + + public void Activate(PlayerInteractEvent event){ + //INIT - Player variables + Player player = event.getPlayer(); + Location playerLocation = player.getLocation(); + ItemStack boomBow = player.getInventory().getItemInMainHand(); + + //TODO: NERF - boomDecay + //TODO: NERF - endCrystal + //TODO: NERF - healthReduction + //TODO: NERF - localized + + if(BoomBowRule.boomDecay) + new BoomDecayTask(player).runTaskTimer(plugin, 1, 1); + if(BoomBowRule.endCrystal){ + //BoomBowCyrstalSpawn + } + if(BoomBowRule.healthReduction){ + player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 400, -1)); + } + if(BoomBowRule.localized); + + + //SET - Player Velocity + player.setVelocity(playerLocation.getDirection().normalize().multiply(3.0)); + + //CREATE - Explosion + damage + player.getWorld().playSound(playerLocation, Sound.ENTITY_GENERIC_EXPLODE, 10, -20); + player.getWorld().spawnParticle(Particle.EXPLOSION_HUGE, playerLocation, 2); + player.damage(7.42425, player); + player.sendMessage(player.getLastDamage() + ""); + boomBow.setDurability((short) (boomBow.getDurability() + 3)); + if(boomBow.getDurability() < 0){ + player.getInventory().setItemInMainHand(null); + player.getWorld().playSound(playerLocation, Sound.ENTITY_ITEM_BREAK, 0, 0); + } + + } +} diff --git a/src/alisolarflare/magic/tricks/BoomBowRule.java b/src/alisolarflare/magic/BoomBowRule.java similarity index 95% rename from src/alisolarflare/magic/tricks/BoomBowRule.java rename to src/alisolarflare/magic/BoomBowRule.java index bbfbf8f..caa0256 100644 --- a/src/alisolarflare/magic/tricks/BoomBowRule.java +++ b/src/alisolarflare/magic/BoomBowRule.java @@ -1,84 +1,84 @@ -package alisolarflare.magic.tricks; - -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import buttondevteam.lib.chat.TBMCCommandBase; -//HEHEHHEHEH EAASSSTER EGGS -public class BoomBowRule extends TBMCCommandBase{ - public static boolean boomDecay; - public static boolean healthReduction; - public static boolean endCrystal; - public static boolean localized;; - @Override - public boolean OnCommand(CommandSender sender, String label, String[] args) { - if (sender instanceof Player == false){ - sender.sendMessage("You must be a player to use this command"); - return false; - } - Player player = (Player) sender; - if (player.getName().equals("alisolarflare") == false){ - player.sendMessage("You must be alisolarflare to use this command"); - return false; - } - if (args.length < 2){ - player.sendMessage("Usage: /boomBowRule [rulename] [true/false]"); - player.sendMessage("Rules:"); - player.sendMessage("boomDecay" + boomDecay); - player.sendMessage("healthReduction" + healthReduction); - player.sendMessage("endCrystal" + endCrystal); - player.sendMessage("localized" + localized); - return false; - } - if(!(args[1].startsWith("t")|| args[1].startsWith("f"))){ - player.sendMessage("Usage: /boomBowRule [rulename] [true/false]"); - return false; - } - boolean gameRule = false; - if(args[1].startsWith("t") || args[1].startsWith("T")){ - gameRule = true; - } - switch(args[0]){ - case "boomDecay": - boomDecay = gameRule; - break; - case "healthReduction": - healthReduction = gameRule; - break; - case "endCrystal": - endCrystal = gameRule; - break; - case "localized": - localized = gameRule; - break; - default: - player.sendMessage("Error: "+args[0]+" not defined as a rule"); - player.sendMessage("Usage: /boomBowRule [rulename] [true/false]"); - player.sendMessage("Rule settings: boomDecay, healthReduction, endCrystal, localized"); - break; - } - - return false; - } - @Override - public String GetCommandPath() { - // TODO Auto-generated method stub - return null; - } - @Override - public String[] GetHelpText(String arg0) { - // TODO Auto-generated method stub - return null; - } - @Override - public boolean GetModOnly() { - // TODO Auto-generated method stub - return false; - } - @Override - public boolean GetPlayerOnly() { - // TODO Auto-generated method stub - return false; - } - -} +package alisolarflare.magic; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import buttondevteam.lib.chat.TBMCCommandBase; +//HEHEHHEHEH EAASSSTER EGGS +public class BoomBowRule extends TBMCCommandBase{ + public static boolean boomDecay; + public static boolean healthReduction; + public static boolean endCrystal; + public static boolean localized;; + @Override + public boolean OnCommand(CommandSender sender, String label, String[] args) { + if (sender instanceof Player == false){ + sender.sendMessage("You must be a player to use this command"); + return false; + } + Player player = (Player) sender; + if (player.getName().equals("alisolarflare") == false){ + player.sendMessage("You must be alisolarflare to use this command"); + return false; + } + if (args.length < 2){ + player.sendMessage("Usage: /boomBowRule [rulename] [true/false]"); + player.sendMessage("Rules:"); + player.sendMessage("boomDecay" + boomDecay); + player.sendMessage("healthReduction" + healthReduction); + player.sendMessage("endCrystal" + endCrystal); + player.sendMessage("localized" + localized); + return false; + } + if(!(args[1].startsWith("t")|| args[1].startsWith("f"))){ + player.sendMessage("Usage: /boomBowRule [rulename] [true/false]"); + return false; + } + boolean gameRule = false; + if(args[1].startsWith("t") || args[1].startsWith("T")){ + gameRule = true; + } + switch(args[0]){ + case "boomDecay": + boomDecay = gameRule; + break; + case "healthReduction": + healthReduction = gameRule; + break; + case "endCrystal": + endCrystal = gameRule; + break; + case "localized": + localized = gameRule; + break; + default: + player.sendMessage("Error: "+args[0]+" not defined as a rule"); + player.sendMessage("Usage: /boomBowRule [rulename] [true/false]"); + player.sendMessage("Rule settings: boomDecay, healthReduction, endCrystal, localized"); + break; + } + + return false; + } + @Override + public String GetCommandPath() { + // TODO Auto-generated method stub + return null; + } + @Override + public String[] GetHelpText(String arg0) { + // TODO Auto-generated method stub + return null; + } + @Override + public boolean GetModOnly() { + // TODO Auto-generated method stub + return false; + } + @Override + public boolean GetPlayerOnly() { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/src/alisolarflare/magic/tricks/BoomDecayTask.java b/src/alisolarflare/magic/BoomDecayTask.java similarity index 88% rename from src/alisolarflare/magic/tricks/BoomDecayTask.java rename to src/alisolarflare/magic/BoomDecayTask.java index 5f1875c..2d128f9 100644 --- a/src/alisolarflare/magic/tricks/BoomDecayTask.java +++ b/src/alisolarflare/magic/BoomDecayTask.java @@ -1,25 +1,25 @@ -package alisolarflare.magic.tricks; - -import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; - -public class BoomDecayTask extends BukkitRunnable{ - Player player; - private int ticksSinceStart = 0; - private final int effectLength = 20; - public BoomDecayTask(Player player){ - this.player = player; - } - //runs every tick - @Override - public void run() { - if (ticksSinceStart > effectLength){ - this.cancel(); - } - player.sendMessage(player.getVelocity().toString()); - - ticksSinceStart++; - - } - -} +package alisolarflare.magic; + +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitRunnable; + +public class BoomDecayTask extends BukkitRunnable{ + Player player; + private int ticksSinceStart = 0; + private final int effectLength = 20; + public BoomDecayTask(Player player){ + this.player = player; + } + //runs every tick + @Override + public void run() { + if (ticksSinceStart > effectLength){ + this.cancel(); + } + player.sendMessage(player.getVelocity().toString()); + + ticksSinceStart++; + + } + +} diff --git a/src/alisolarflare/magic/MagicModule.java b/src/alisolarflare/magic/MagicModule.java index 616b179..9a83bd0 100644 --- a/src/alisolarflare/magic/MagicModule.java +++ b/src/alisolarflare/magic/MagicModule.java @@ -3,9 +3,6 @@ package alisolarflare.magic; import org.bukkit.plugin.java.JavaPlugin; import alisolarflare.Module; -import alisolarflare.magic.tricks.AliArrowListener; -import alisolarflare.magic.tricks.BoomBowDeathListener; -import alisolarflare.magic.tricks.BoomBowListener; public class MagicModule extends Module{