From 76118a768703e569890c4f53fb4fa1d405e2b3de Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Sun, 6 Nov 2016 18:53:38 -0500 Subject: [PATCH] Revert "Revert "Revert "Comit to Uncommit""" This reverts commit 30122d23d8f7d8a9ede7854a758a458e3da30c30. --- .../components/flairdoor/FlairDoorModule.java | 15 + .../flairdoor/Module_FlairDoor.java | 13 - .../FlairMe.java} | 77 ++--- .../PortalListener.java} | 276 ++++++++--------- .../{Memory_GPower.java => GPowerMemory.java} | 104 +++---- .../components/gpowers/GPowerModule.java | 23 ++ .../gpowers/Listener_PowerLooper.java | 11 - .../components/gpowers/Module_GPower.java | 19 -- .../GPower.java} | 151 +++++----- .../PowerDown.java} | 97 +++--- .../PowerUp.java} | 97 +++--- .../gPowerApplyingTask.java} | 132 ++++----- .../gpowers/listeners/gPowerListener.java | 13 + .../components/links/AliLinkModule.java | 33 +++ .../components/links/Module_AliLink.java | 30 -- .../PressAliLink.java} | 119 ++++---- .../SetAliLink.java} | 278 +++++++++--------- .../{Memory_Link.java => entities/Link.java} | 80 ++--- .../links/serializer/Deserializer.java | 42 +++ .../links/serializer/Serializer.java | 38 +++ .../UnpressTask.java} | 42 +-- .../CreativeBoundariesModule.java | 30 ++ .../Module_CreativeBoundaries.java | 25 -- .../Cbgm0.java} | 97 +++--- .../Cbgm1.java} | 163 +++++----- .../SetDickmode.java} | 107 +++---- .../ItemRestrictionListener.java} | 50 ++-- .../PlotChangeListener.java} | 136 ++++----- src/alisolarflare/easyuhc/EasyUHCModule.java | 24 ++ src/alisolarflare/easyuhc/Module_EasyUHC.java | 18 -- .../ActivatePowers.java} | 4 +- .../SetupWorldBorders.java} | 4 +- .../ShrinkWorldBorders.java} | 4 +- .../SpreadPlayers.java} | 4 +- .../StartTimer.java} | 4 +- .../StartUHC.java} | 4 +- .../TeleportToUHC.java} | 4 +- src/alisolarflare/magic/MagicModule.java | 3 + .../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 ++-- 44 files changed, 1558 insertions(+), 1437 deletions(-) create mode 100644 src/alisolarflare/components/flairdoor/FlairDoorModule.java delete mode 100644 src/alisolarflare/components/flairdoor/Module_FlairDoor.java rename src/alisolarflare/components/flairdoor/{Command_FlairMe.java => commands/FlairMe.java} (69%) rename src/alisolarflare/components/flairdoor/{Listener_Portal.java => listeners/PortalListener.java} (92%) rename src/alisolarflare/components/gpowers/{Memory_GPower.java => GPowerMemory.java} (95%) create mode 100644 src/alisolarflare/components/gpowers/GPowerModule.java delete mode 100644 src/alisolarflare/components/gpowers/Listener_PowerLooper.java delete mode 100644 src/alisolarflare/components/gpowers/Module_GPower.java rename src/alisolarflare/components/gpowers/{Command_GPower.java => commands/GPower.java} (86%) rename src/alisolarflare/components/gpowers/{Command_PowerDown.java => commands/PowerDown.java} (75%) rename src/alisolarflare/components/gpowers/{Command_PowerUp.java => commands/PowerUp.java} (75%) rename src/alisolarflare/components/gpowers/{Task_PowerApplier.java => listeners/gPowerApplyingTask.java} (88%) create mode 100644 src/alisolarflare/components/gpowers/listeners/gPowerListener.java create mode 100644 src/alisolarflare/components/links/AliLinkModule.java delete mode 100644 src/alisolarflare/components/links/Module_AliLink.java rename src/alisolarflare/components/links/{Command_PressAliLink.java => commands/PressAliLink.java} (75%) rename src/alisolarflare/components/links/{Command_SetAliLink.java => commands/SetAliLink.java} (80%) rename src/alisolarflare/components/links/{Memory_Link.java => entities/Link.java} (74%) create mode 100644 src/alisolarflare/components/links/serializer/Deserializer.java create mode 100644 src/alisolarflare/components/links/serializer/Serializer.java rename src/alisolarflare/components/links/{Task_UnpressTask.java => tasks/UnpressTask.java} (68%) create mode 100644 src/alisolarflare/creativeboundaries/CreativeBoundariesModule.java delete mode 100644 src/alisolarflare/creativeboundaries/Module_CreativeBoundaries.java rename src/alisolarflare/creativeboundaries/{Command_Cbgm0.java => commands/Cbgm0.java} (73%) rename src/alisolarflare/creativeboundaries/{Command_Cbgm1.java => commands/Cbgm1.java} (85%) rename src/alisolarflare/creativeboundaries/{Command_SetDickmode.java => commands/SetDickmode.java} (78%) rename src/alisolarflare/creativeboundaries/{Listener_ItemRestriction.java => listeners/ItemRestrictionListener.java} (52%) rename src/alisolarflare/creativeboundaries/{Listener_PlotChange.java => listeners/PlotChangeListener.java} (84%) create mode 100644 src/alisolarflare/easyuhc/EasyUHCModule.java delete mode 100644 src/alisolarflare/easyuhc/Module_EasyUHC.java rename src/alisolarflare/easyuhc/{Command_ActivatePowers.java => commands/ActivatePowers.java} (85%) rename src/alisolarflare/easyuhc/{Command_SetupWorldBorders.java => commands/SetupWorldBorders.java} (85%) rename src/alisolarflare/easyuhc/{Command_ShrinkWorldBorders.java => commands/ShrinkWorldBorders.java} (85%) rename src/alisolarflare/easyuhc/{Command_SpreadPlayers.java => commands/SpreadPlayers.java} (85%) rename src/alisolarflare/easyuhc/{Command_StartTimer.java => commands/StartTimer.java} (86%) rename src/alisolarflare/easyuhc/{Command_StartUHC.java => commands/StartUHC.java} (86%) rename src/alisolarflare/easyuhc/{Command_TeleportToUHC.java => commands/TeleportToUHC.java} (85%) 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/FlairDoorModule.java b/src/alisolarflare/components/flairdoor/FlairDoorModule.java new file mode 100644 index 0000000..1c5cddb --- /dev/null +++ b/src/alisolarflare/components/flairdoor/FlairDoorModule.java @@ -0,0 +1,15 @@ +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/Module_FlairDoor.java b/src/alisolarflare/components/flairdoor/Module_FlairDoor.java deleted file mode 100644 index ca893a7..0000000 --- a/src/alisolarflare/components/flairdoor/Module_FlairDoor.java +++ /dev/null @@ -1,13 +0,0 @@ -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/flairdoor/Command_FlairMe.java b/src/alisolarflare/components/flairdoor/commands/FlairMe.java similarity index 69% rename from src/alisolarflare/components/flairdoor/Command_FlairMe.java rename to src/alisolarflare/components/flairdoor/commands/FlairMe.java index 819ed54..963da82 100644 --- a/src/alisolarflare/components/flairdoor/Command_FlairMe.java +++ b/src/alisolarflare/components/flairdoor/commands/FlairMe.java @@ -1,38 +1,39 @@ -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; - } - -} +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; + } + +} diff --git a/src/alisolarflare/components/flairdoor/Listener_Portal.java b/src/alisolarflare/components/flairdoor/listeners/PortalListener.java similarity index 92% rename from src/alisolarflare/components/flairdoor/Listener_Portal.java rename to src/alisolarflare/components/flairdoor/listeners/PortalListener.java index 59791d4..4ce684a 100644 --- a/src/alisolarflare/components/flairdoor/Listener_Portal.java +++ b/src/alisolarflare/components/flairdoor/listeners/PortalListener.java @@ -1,138 +1,138 @@ -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()); - } -} +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()); + } +} diff --git a/src/alisolarflare/components/gpowers/Memory_GPower.java b/src/alisolarflare/components/gpowers/GPowerMemory.java similarity index 95% rename from src/alisolarflare/components/gpowers/Memory_GPower.java rename to src/alisolarflare/components/gpowers/GPowerMemory.java index b1ef0fc..44e0089 100644 --- a/src/alisolarflare/components/gpowers/Memory_GPower.java +++ b/src/alisolarflare/components/gpowers/GPowerMemory.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 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 + "]"; - } - } -} - +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 + "]"; + } + } +} + diff --git a/src/alisolarflare/components/gpowers/GPowerModule.java b/src/alisolarflare/components/gpowers/GPowerModule.java new file mode 100644 index 0000000..3148ee0 --- /dev/null +++ b/src/alisolarflare/components/gpowers/GPowerModule.java @@ -0,0 +1,23 @@ +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 deleted file mode 100644 index 8b9c299..0000000 --- a/src/alisolarflare/components/gpowers/Listener_PowerLooper.java +++ /dev/null @@ -1,11 +0,0 @@ -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/Module_GPower.java b/src/alisolarflare/components/gpowers/Module_GPower.java deleted file mode 100644 index 814d9bd..0000000 --- a/src/alisolarflare/components/gpowers/Module_GPower.java +++ /dev/null @@ -1,19 +0,0 @@ -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/Command_GPower.java b/src/alisolarflare/components/gpowers/commands/GPower.java similarity index 86% rename from src/alisolarflare/components/gpowers/Command_GPower.java rename to src/alisolarflare/components/gpowers/commands/GPower.java index a244e8c..4a90d21 100644 --- a/src/alisolarflare/components/gpowers/Command_GPower.java +++ b/src/alisolarflare/components/gpowers/commands/GPower.java @@ -1,75 +1,76 @@ -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; - } - -} +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; + } + +} diff --git a/src/alisolarflare/components/gpowers/Command_PowerDown.java b/src/alisolarflare/components/gpowers/commands/PowerDown.java similarity index 75% rename from src/alisolarflare/components/gpowers/Command_PowerDown.java rename to src/alisolarflare/components/gpowers/commands/PowerDown.java index 9204c29..8f3467b 100644 --- a/src/alisolarflare/components/gpowers/Command_PowerDown.java +++ b/src/alisolarflare/components/gpowers/commands/PowerDown.java @@ -1,48 +1,49 @@ -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; - } - -} +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; + } + +} diff --git a/src/alisolarflare/components/gpowers/Command_PowerUp.java b/src/alisolarflare/components/gpowers/commands/PowerUp.java similarity index 75% rename from src/alisolarflare/components/gpowers/Command_PowerUp.java rename to src/alisolarflare/components/gpowers/commands/PowerUp.java index 171961c..84670f3 100644 --- a/src/alisolarflare/components/gpowers/Command_PowerUp.java +++ b/src/alisolarflare/components/gpowers/commands/PowerUp.java @@ -1,48 +1,49 @@ -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; - } - -} +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; + } + +} diff --git a/src/alisolarflare/components/gpowers/Task_PowerApplier.java b/src/alisolarflare/components/gpowers/listeners/gPowerApplyingTask.java similarity index 88% rename from src/alisolarflare/components/gpowers/Task_PowerApplier.java rename to src/alisolarflare/components/gpowers/listeners/gPowerApplyingTask.java index f9d82e3..d966e63 100644 --- a/src/alisolarflare/components/gpowers/Task_PowerApplier.java +++ b/src/alisolarflare/components/gpowers/listeners/gPowerApplyingTask.java @@ -1,66 +1,66 @@ -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{ - } - } - -} +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{ + } + } + +} diff --git a/src/alisolarflare/components/gpowers/listeners/gPowerListener.java b/src/alisolarflare/components/gpowers/listeners/gPowerListener.java new file mode 100644 index 0000000..1b71481 --- /dev/null +++ b/src/alisolarflare/components/gpowers/listeners/gPowerListener.java @@ -0,0 +1,13 @@ +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 new file mode 100644 index 0000000..a6d44a9 --- /dev/null +++ b/src/alisolarflare/components/links/AliLinkModule.java @@ -0,0 +1,33 @@ +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/Module_AliLink.java b/src/alisolarflare/components/links/Module_AliLink.java deleted file mode 100644 index a16b47b..0000000 --- a/src/alisolarflare/components/links/Module_AliLink.java +++ /dev/null @@ -1,30 +0,0 @@ -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/Command_PressAliLink.java b/src/alisolarflare/components/links/commands/PressAliLink.java similarity index 75% rename from src/alisolarflare/components/links/Command_PressAliLink.java rename to src/alisolarflare/components/links/commands/PressAliLink.java index 9619449..da21f6d 100644 --- a/src/alisolarflare/components/links/Command_PressAliLink.java +++ b/src/alisolarflare/components/links/commands/PressAliLink.java @@ -1,59 +1,60 @@ -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; - } - -} +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; + } + +} diff --git a/src/alisolarflare/components/links/Command_SetAliLink.java b/src/alisolarflare/components/links/commands/SetAliLink.java similarity index 80% rename from src/alisolarflare/components/links/Command_SetAliLink.java rename to src/alisolarflare/components/links/commands/SetAliLink.java index 2b78235..03c4e57 100644 --- a/src/alisolarflare/components/links/Command_SetAliLink.java +++ b/src/alisolarflare/components/links/commands/SetAliLink.java @@ -1,138 +1,140 @@ -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; - } - -} +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; + } + +} diff --git a/src/alisolarflare/components/links/Memory_Link.java b/src/alisolarflare/components/links/entities/Link.java similarity index 74% rename from src/alisolarflare/components/links/Memory_Link.java rename to src/alisolarflare/components/links/entities/Link.java index 2043b7a..f55bfc8 100644 --- a/src/alisolarflare/components/links/Memory_Link.java +++ b/src/alisolarflare/components/links/entities/Link.java @@ -1,39 +1,41 @@ -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); - } -} +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); + } +} diff --git a/src/alisolarflare/components/links/serializer/Deserializer.java b/src/alisolarflare/components/links/serializer/Deserializer.java new file mode 100644 index 0000000..cfc1786 --- /dev/null +++ b/src/alisolarflare/components/links/serializer/Deserializer.java @@ -0,0 +1,42 @@ +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 new file mode 100644 index 0000000..fe4efef --- /dev/null +++ b/src/alisolarflare/components/links/serializer/Serializer.java @@ -0,0 +1,38 @@ +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/components/links/Task_UnpressTask.java b/src/alisolarflare/components/links/tasks/UnpressTask.java similarity index 68% rename from src/alisolarflare/components/links/Task_UnpressTask.java rename to src/alisolarflare/components/links/tasks/UnpressTask.java index 17c59c8..769f4f1 100644 --- a/src/alisolarflare/components/links/Task_UnpressTask.java +++ b/src/alisolarflare/components/links/tasks/UnpressTask.java @@ -1,21 +1,21 @@ -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(); - } - -} +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(); + } + +} diff --git a/src/alisolarflare/creativeboundaries/CreativeBoundariesModule.java b/src/alisolarflare/creativeboundaries/CreativeBoundariesModule.java new file mode 100644 index 0000000..39dac19 --- /dev/null +++ b/src/alisolarflare/creativeboundaries/CreativeBoundariesModule.java @@ -0,0 +1,30 @@ +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/Module_CreativeBoundaries.java b/src/alisolarflare/creativeboundaries/Module_CreativeBoundaries.java deleted file mode 100644 index fcd58da..0000000 --- a/src/alisolarflare/creativeboundaries/Module_CreativeBoundaries.java +++ /dev/null @@ -1,25 +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; - - -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/creativeboundaries/Command_Cbgm0.java b/src/alisolarflare/creativeboundaries/commands/Cbgm0.java similarity index 73% rename from src/alisolarflare/creativeboundaries/Command_Cbgm0.java rename to src/alisolarflare/creativeboundaries/commands/Cbgm0.java index afa0aa9..6e5fd2a 100644 --- a/src/alisolarflare/creativeboundaries/Command_Cbgm0.java +++ b/src/alisolarflare/creativeboundaries/commands/Cbgm0.java @@ -1,48 +1,49 @@ -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; - } - -} +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; + } + +} diff --git a/src/alisolarflare/creativeboundaries/Command_Cbgm1.java b/src/alisolarflare/creativeboundaries/commands/Cbgm1.java similarity index 85% rename from src/alisolarflare/creativeboundaries/Command_Cbgm1.java rename to src/alisolarflare/creativeboundaries/commands/Cbgm1.java index c63e430..04fba33 100644 --- a/src/alisolarflare/creativeboundaries/Command_Cbgm1.java +++ b/src/alisolarflare/creativeboundaries/commands/Cbgm1.java @@ -1,81 +1,82 @@ -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; - } - -} +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; + } + +} diff --git a/src/alisolarflare/creativeboundaries/Command_SetDickmode.java b/src/alisolarflare/creativeboundaries/commands/SetDickmode.java similarity index 78% rename from src/alisolarflare/creativeboundaries/Command_SetDickmode.java rename to src/alisolarflare/creativeboundaries/commands/SetDickmode.java index fb0aa8d..3b1654b 100644 --- a/src/alisolarflare/creativeboundaries/Command_SetDickmode.java +++ b/src/alisolarflare/creativeboundaries/commands/SetDickmode.java @@ -1,53 +1,54 @@ -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; - } -} +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; + } +} diff --git a/src/alisolarflare/creativeboundaries/Listener_ItemRestriction.java b/src/alisolarflare/creativeboundaries/listeners/ItemRestrictionListener.java similarity index 52% rename from src/alisolarflare/creativeboundaries/Listener_ItemRestriction.java rename to src/alisolarflare/creativeboundaries/listeners/ItemRestrictionListener.java index 37d5ac7..9023755 100644 --- a/src/alisolarflare/creativeboundaries/Listener_ItemRestriction.java +++ b/src/alisolarflare/creativeboundaries/listeners/ItemRestrictionListener.java @@ -1,24 +1,26 @@ -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; - - } - -} +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; + + } + +} diff --git a/src/alisolarflare/creativeboundaries/Listener_PlotChange.java b/src/alisolarflare/creativeboundaries/listeners/PlotChangeListener.java similarity index 84% rename from src/alisolarflare/creativeboundaries/Listener_PlotChange.java rename to src/alisolarflare/creativeboundaries/listeners/PlotChangeListener.java index 980bdb6..e911b98 100644 --- a/src/alisolarflare/creativeboundaries/Listener_PlotChange.java +++ b/src/alisolarflare/creativeboundaries/listeners/PlotChangeListener.java @@ -1,67 +1,69 @@ -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); - } - } -} +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); + } + } +} diff --git a/src/alisolarflare/easyuhc/EasyUHCModule.java b/src/alisolarflare/easyuhc/EasyUHCModule.java new file mode 100644 index 0000000..408e909 --- /dev/null +++ b/src/alisolarflare/easyuhc/EasyUHCModule.java @@ -0,0 +1,24 @@ +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 deleted file mode 100644 index 4ad1b1a..0000000 --- a/src/alisolarflare/easyuhc/Module_EasyUHC.java +++ /dev/null @@ -1,18 +0,0 @@ -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/easyuhc/Command_ActivatePowers.java b/src/alisolarflare/easyuhc/commands/ActivatePowers.java similarity index 85% rename from src/alisolarflare/easyuhc/Command_ActivatePowers.java rename to src/alisolarflare/easyuhc/commands/ActivatePowers.java index 26789ce..737ac72 100644 --- a/src/alisolarflare/easyuhc/Command_ActivatePowers.java +++ b/src/alisolarflare/easyuhc/commands/ActivatePowers.java @@ -1,10 +1,10 @@ -package alisolarflare.easyuhc; +package alisolarflare.easyuhc.commands; import org.bukkit.command.CommandSender; import buttondevteam.lib.chat.TBMCCommandBase; -public class Command_ActivatePowers extends TBMCCommandBase{ +public class ActivatePowers extends TBMCCommandBase{ @Override public boolean OnCommand(CommandSender sender, String alias, String[] args) { diff --git a/src/alisolarflare/easyuhc/Command_SetupWorldBorders.java b/src/alisolarflare/easyuhc/commands/SetupWorldBorders.java similarity index 85% rename from src/alisolarflare/easyuhc/Command_SetupWorldBorders.java rename to src/alisolarflare/easyuhc/commands/SetupWorldBorders.java index db45dc0..ef90ae8 100644 --- a/src/alisolarflare/easyuhc/Command_SetupWorldBorders.java +++ b/src/alisolarflare/easyuhc/commands/SetupWorldBorders.java @@ -1,10 +1,10 @@ -package alisolarflare.easyuhc; +package alisolarflare.easyuhc.commands; import org.bukkit.command.CommandSender; import buttondevteam.lib.chat.TBMCCommandBase; -public class Command_SetupWorldBorders extends TBMCCommandBase { +public class SetupWorldBorders extends TBMCCommandBase { @Override public boolean OnCommand(CommandSender sender, String alias, String[] args) { diff --git a/src/alisolarflare/easyuhc/Command_ShrinkWorldBorders.java b/src/alisolarflare/easyuhc/commands/ShrinkWorldBorders.java similarity index 85% rename from src/alisolarflare/easyuhc/Command_ShrinkWorldBorders.java rename to src/alisolarflare/easyuhc/commands/ShrinkWorldBorders.java index b25bf11..bd083a6 100644 --- a/src/alisolarflare/easyuhc/Command_ShrinkWorldBorders.java +++ b/src/alisolarflare/easyuhc/commands/ShrinkWorldBorders.java @@ -1,10 +1,10 @@ -package alisolarflare.easyuhc; +package alisolarflare.easyuhc.commands; import org.bukkit.command.CommandSender; import buttondevteam.lib.chat.TBMCCommandBase; -public class Command_ShrinkWorldBorders extends TBMCCommandBase { +public class ShrinkWorldBorders extends TBMCCommandBase { @Override public boolean OnCommand(CommandSender sender, String alias, String[] args) { diff --git a/src/alisolarflare/easyuhc/Command_SpreadPlayers.java b/src/alisolarflare/easyuhc/commands/SpreadPlayers.java similarity index 85% rename from src/alisolarflare/easyuhc/Command_SpreadPlayers.java rename to src/alisolarflare/easyuhc/commands/SpreadPlayers.java index f83e70a..a5798ac 100644 --- a/src/alisolarflare/easyuhc/Command_SpreadPlayers.java +++ b/src/alisolarflare/easyuhc/commands/SpreadPlayers.java @@ -1,10 +1,10 @@ -package alisolarflare.easyuhc; +package alisolarflare.easyuhc.commands; import org.bukkit.command.CommandSender; import buttondevteam.lib.chat.TBMCCommandBase; -public class Command_SpreadPlayers extends TBMCCommandBase{ +public class SpreadPlayers extends TBMCCommandBase{ @Override public boolean OnCommand(CommandSender sender, String alias, String[] args) { diff --git a/src/alisolarflare/easyuhc/Command_StartTimer.java b/src/alisolarflare/easyuhc/commands/StartTimer.java similarity index 86% rename from src/alisolarflare/easyuhc/Command_StartTimer.java rename to src/alisolarflare/easyuhc/commands/StartTimer.java index 96dad6f..927344e 100644 --- a/src/alisolarflare/easyuhc/Command_StartTimer.java +++ b/src/alisolarflare/easyuhc/commands/StartTimer.java @@ -1,10 +1,10 @@ -package alisolarflare.easyuhc; +package alisolarflare.easyuhc.commands; import org.bukkit.command.CommandSender; import buttondevteam.lib.chat.TBMCCommandBase; -public class Command_StartTimer extends TBMCCommandBase{ +public class StartTimer extends TBMCCommandBase{ @Override public boolean OnCommand(CommandSender sender, String alias, String[] args) { diff --git a/src/alisolarflare/easyuhc/Command_StartUHC.java b/src/alisolarflare/easyuhc/commands/StartUHC.java similarity index 86% rename from src/alisolarflare/easyuhc/Command_StartUHC.java rename to src/alisolarflare/easyuhc/commands/StartUHC.java index 7cc116d..2a06889 100644 --- a/src/alisolarflare/easyuhc/Command_StartUHC.java +++ b/src/alisolarflare/easyuhc/commands/StartUHC.java @@ -1,10 +1,10 @@ -package alisolarflare.easyuhc; +package alisolarflare.easyuhc.commands; import org.bukkit.command.CommandSender; import buttondevteam.lib.chat.TBMCCommandBase; -public class Command_StartUHC extends TBMCCommandBase{ +public class StartUHC extends TBMCCommandBase{ @Override public boolean OnCommand(CommandSender sender, String alias, String[] args) { diff --git a/src/alisolarflare/easyuhc/Command_TeleportToUHC.java b/src/alisolarflare/easyuhc/commands/TeleportToUHC.java similarity index 85% rename from src/alisolarflare/easyuhc/Command_TeleportToUHC.java rename to src/alisolarflare/easyuhc/commands/TeleportToUHC.java index 3f46306..5a5c6d0 100644 --- a/src/alisolarflare/easyuhc/Command_TeleportToUHC.java +++ b/src/alisolarflare/easyuhc/commands/TeleportToUHC.java @@ -1,10 +1,10 @@ -package alisolarflare.easyuhc; +package alisolarflare.easyuhc.commands; import org.bukkit.command.CommandSender; import buttondevteam.lib.chat.TBMCCommandBase; -public class Command_TeleportToUHC extends TBMCCommandBase{ +public class TeleportToUHC extends TBMCCommandBase{ @Override public boolean OnCommand(CommandSender sender, String alias, String[] args) { diff --git a/src/alisolarflare/magic/MagicModule.java b/src/alisolarflare/magic/MagicModule.java index 9a83bd0..616b179 100644 --- a/src/alisolarflare/magic/MagicModule.java +++ b/src/alisolarflare/magic/MagicModule.java @@ -3,6 +3,9 @@ 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{ diff --git a/src/alisolarflare/magic/AliArrowListener.java b/src/alisolarflare/magic/tricks/AliArrowListener.java similarity index 92% rename from src/alisolarflare/magic/AliArrowListener.java rename to src/alisolarflare/magic/tricks/AliArrowListener.java index ecd79e6..36b8e12 100644 --- a/src/alisolarflare/magic/AliArrowListener.java +++ b/src/alisolarflare/magic/tricks/AliArrowListener.java @@ -1,39 +1,39 @@ -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; - - } +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; + + } } \ No newline at end of file diff --git a/src/alisolarflare/magic/AliArrowTask.java b/src/alisolarflare/magic/tricks/AliArrowTask.java similarity index 92% rename from src/alisolarflare/magic/AliArrowTask.java rename to src/alisolarflare/magic/tricks/AliArrowTask.java index 055a4fd..10252b8 100644 --- a/src/alisolarflare/magic/AliArrowTask.java +++ b/src/alisolarflare/magic/tricks/AliArrowTask.java @@ -1,40 +1,40 @@ -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; - } - - } - -} +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; + } + + } + +} diff --git a/src/alisolarflare/magic/BoomBowDeathListener.java b/src/alisolarflare/magic/tricks/BoomBowDeathListener.java similarity index 90% rename from src/alisolarflare/magic/BoomBowDeathListener.java rename to src/alisolarflare/magic/tricks/BoomBowDeathListener.java index f16d3c1..427537e 100644 --- a/src/alisolarflare/magic/BoomBowDeathListener.java +++ b/src/alisolarflare/magic/tricks/BoomBowDeathListener.java @@ -1,18 +1,18 @@ -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]"); - } - } -} +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]"); + } + } +} diff --git a/src/alisolarflare/magic/BoomBowListener.java b/src/alisolarflare/magic/tricks/BoomBowListener.java similarity index 95% rename from src/alisolarflare/magic/BoomBowListener.java rename to src/alisolarflare/magic/tricks/BoomBowListener.java index 8381927..5e74bd8 100644 --- a/src/alisolarflare/magic/BoomBowListener.java +++ b/src/alisolarflare/magic/tricks/BoomBowListener.java @@ -1,107 +1,107 @@ -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); - } - - } -} +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); + } + + } +} diff --git a/src/alisolarflare/magic/BoomBowRule.java b/src/alisolarflare/magic/tricks/BoomBowRule.java similarity index 95% rename from src/alisolarflare/magic/BoomBowRule.java rename to src/alisolarflare/magic/tricks/BoomBowRule.java index caa0256..bbfbf8f 100644 --- a/src/alisolarflare/magic/BoomBowRule.java +++ b/src/alisolarflare/magic/tricks/BoomBowRule.java @@ -1,84 +1,84 @@ -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; - } - -} +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; + } + +} diff --git a/src/alisolarflare/magic/BoomDecayTask.java b/src/alisolarflare/magic/tricks/BoomDecayTask.java similarity index 88% rename from src/alisolarflare/magic/BoomDecayTask.java rename to src/alisolarflare/magic/tricks/BoomDecayTask.java index 2d128f9..5f1875c 100644 --- a/src/alisolarflare/magic/BoomDecayTask.java +++ b/src/alisolarflare/magic/tricks/BoomDecayTask.java @@ -1,25 +1,25 @@ -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++; - - } - -} +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++; + + } + +}