From 86bc0637188940047e296ceb6b78b1f1a92e2766 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Mon, 31 Oct 2016 01:02:58 -0400 Subject: [PATCH] Wired up modules to AliPresents, SHIT's DOOONE --- src/alisolarflare/AliPresents.java | 16 +++++++++----- .../components/flairdoor/FlairDoorModule.java | 5 ----- .../components/links/AliLinkModule.java | 13 ++++-------- .../links/commands/PressAliLink.java | 12 +++++------ .../components/links/entities/Link.java | 12 +++++++---- .../magictrick/aliarrow/AliArrowListener.java | 7 +++---- .../magictrick/aliarrow/AliArrowModule.java | 21 +++++-------------- .../magictrick/aliarrow/AliArrowTask.java | 7 +++---- 8 files changed, 40 insertions(+), 53 deletions(-) diff --git a/src/alisolarflare/AliPresents.java b/src/alisolarflare/AliPresents.java index 6384f76..64f614a 100644 --- a/src/alisolarflare/AliPresents.java +++ b/src/alisolarflare/AliPresents.java @@ -6,7 +6,11 @@ import org.bukkit.plugin.PluginDescriptionFile; //import alisolarflare.links.AliLinkSubPlug; import org.bukkit.plugin.java.JavaPlugin; -import alisolarflare.modules.components.flairdoor.listeners.PortalListener; +import alisolarflare.modules.components.flairdoor.FlairDoorModule; +import alisolarflare.modules.components.gpowers.GPowerModule; +import alisolarflare.modules.components.links.AliLinkModule; +import alisolarflare.modules.components.shulker.AliShulkerModule; +import alisolarflare.modules.events.uhc.UHCModule; import alisolarflare.modules.magictrick.aliarrow.AliArrowModule; public class AliPresents extends JavaPlugin{ @@ -18,15 +22,17 @@ public class AliPresents extends JavaPlugin{ logger.info(pdfFile.getName() + " has been started (V." + pdfFile.getVersion()+ ")."); registerModules(); - registerEvents(); logger.info(pdfFile.getName() + " has fully registered (V." + pdfFile.getVersion()+ ")."); - } - private void registerEvents() { } public void registerModules(){ - new AliArrowModule(this).register(); + new FlairDoorModule().register(this); + new GPowerModule().register(this); + new AliLinkModule().register(this); + new AliShulkerModule().register(this); + new UHCModule().register(this); + new AliArrowModule().register(this); } } diff --git a/src/alisolarflare/modules/components/flairdoor/FlairDoorModule.java b/src/alisolarflare/modules/components/flairdoor/FlairDoorModule.java index a7de4c9..2563a3c 100644 --- a/src/alisolarflare/modules/components/flairdoor/FlairDoorModule.java +++ b/src/alisolarflare/modules/components/flairdoor/FlairDoorModule.java @@ -8,11 +8,6 @@ import alisolarflare.modules.components.flairdoor.commands.SetFlairDoorColour; import alisolarflare.modules.components.flairdoor.listeners.PortalListener; public class FlairDoorModule extends Module{ - @SuppressWarnings("unused") - private JavaPlugin plugin; - public FlairDoorModule(JavaPlugin plugin){ - this.plugin = plugin; - } @Override public void register(JavaPlugin plugin) { plugin.getCommand("flairme").setExecutor(new FlairMe()); diff --git a/src/alisolarflare/modules/components/links/AliLinkModule.java b/src/alisolarflare/modules/components/links/AliLinkModule.java index 23ce869..4861f3a 100644 --- a/src/alisolarflare/modules/components/links/AliLinkModule.java +++ b/src/alisolarflare/modules/components/links/AliLinkModule.java @@ -9,26 +9,21 @@ import alisolarflare.modules.components.links.commands.SetAliLink; import alisolarflare.modules.components.links.entities.Link; public class AliLinkModule extends Module{ - public JavaPlugin plugin; private SetAliLink setAliLink; - public AliLinkModule(JavaPlugin plugin){ - this.plugin = plugin; - - - } @Override public void register(JavaPlugin plugin){ setAliLink = new SetAliLink(plugin); plugin.getCommand("setalilink").setExecutor(setAliLink); - plugin.getCommand("pressalilink").setExecutor(new PressAliLink(this, setAliLink)); + plugin.getCommand("pressalilink").setExecutor(new PressAliLink(plugin, setAliLink)); } - public void saveLinkList(){ + public void saveLinkList(JavaPlugin plugin){ plugin.getConfig().set("aliLinkList", setAliLink.linkList); } + @SuppressWarnings("unchecked") - public List loadLinkList(){ + public List loadLinkList(JavaPlugin plugin){ return (List) plugin.getConfig().getList("aliLinkList"); } diff --git a/src/alisolarflare/modules/components/links/commands/PressAliLink.java b/src/alisolarflare/modules/components/links/commands/PressAliLink.java index b062149..7c277fd 100644 --- a/src/alisolarflare/modules/components/links/commands/PressAliLink.java +++ b/src/alisolarflare/modules/components/links/commands/PressAliLink.java @@ -3,21 +3,21 @@ package alisolarflare.modules.components.links.commands; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; +import org.bukkit.plugin.java.JavaPlugin; -import alisolarflare.modules.components.links.AliLinkModule; import alisolarflare.modules.components.links.entities.Link; public class PressAliLink implements CommandExecutor{ - private AliLinkModule module; + private JavaPlugin plugin; private SetAliLink setAliLink; - public PressAliLink(AliLinkModule subplugin, SetAliLink setAliLink){ - this.module = subplugin; + public PressAliLink(JavaPlugin plugin, SetAliLink setAliLink){ + this.plugin = plugin; this.setAliLink = setAliLink; } @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - module.plugin.getServer().broadcastMessage(setAliLink.linkList.toString() + "over."); + sender.getServer().broadcastMessage(setAliLink.linkList.toString() + "over."); if (args.length < 1){ sender.sendMessage("You must specify a link frequency"); @@ -26,7 +26,7 @@ public class PressAliLink implements CommandExecutor{ for (Link link: setAliLink.linkList){ for (String inputlink: args){ if(inputlink.equals(link.frequency)){ - link.press(module); + link.press(plugin); } } } diff --git a/src/alisolarflare/modules/components/links/entities/Link.java b/src/alisolarflare/modules/components/links/entities/Link.java index a5bd186..cd8b075 100644 --- a/src/alisolarflare/modules/components/links/entities/Link.java +++ b/src/alisolarflare/modules/components/links/entities/Link.java @@ -4,8 +4,8 @@ import java.io.Serializable; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.plugin.java.JavaPlugin; -import alisolarflare.modules.components.links.AliLinkModule; import alisolarflare.modules.components.links.tasks.UnpressTask; public class Link implements Serializable{ @@ -28,10 +28,14 @@ public class Link implements Serializable{ this.z = "" + location.getBlockZ(); //plugin.plugin.getConfig().set("frequency", 10); } - public void press(AliLinkModule plugin) { - Location location = new Location(plugin.plugin.getServer().getWorld(world), Integer.parseInt(x), Integer.parseInt(y), Integer.parseInt(z)); + /** + * 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.plugin, 2, 1); + unPressTask.runTaskTimer(plugin, 2, 1); } } diff --git a/src/alisolarflare/modules/magictrick/aliarrow/AliArrowListener.java b/src/alisolarflare/modules/magictrick/aliarrow/AliArrowListener.java index 2d009b4..bcdc62f 100644 --- a/src/alisolarflare/modules/magictrick/aliarrow/AliArrowListener.java +++ b/src/alisolarflare/modules/magictrick/aliarrow/AliArrowListener.java @@ -6,13 +6,12 @@ import org.bukkit.entity.Projectile; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.ProjectileLaunchEvent; - -import alisolarflare.AliPresents; +import org.bukkit.plugin.java.JavaPlugin; public class AliArrowListener implements Listener { - private final AliPresents plugin; + private final JavaPlugin plugin; - public AliArrowListener(AliPresents plugin){ + public AliArrowListener(JavaPlugin plugin){ this.plugin = plugin; } diff --git a/src/alisolarflare/modules/magictrick/aliarrow/AliArrowModule.java b/src/alisolarflare/modules/magictrick/aliarrow/AliArrowModule.java index 2de4069..42f02dd 100644 --- a/src/alisolarflare/modules/magictrick/aliarrow/AliArrowModule.java +++ b/src/alisolarflare/modules/magictrick/aliarrow/AliArrowModule.java @@ -1,27 +1,16 @@ package alisolarflare.modules.magictrick.aliarrow; -import java.util.logging.Level; -import alisolarflare.AliPresents; -public class AliArrowModule { - private AliPresents plugin; +import org.bukkit.plugin.java.JavaPlugin; +import alisolarflare.modules.Module; - public AliArrowModule(AliPresents plugin){ - this.plugin = plugin; - } +public class AliArrowModule extends Module{ /** * Registers the plugin, activating listeners, commands, and events */ - public void register(){ - registerEvents(); - registerCommands(); - plugin.getLogger().log(Level.INFO, "Discord Sub Plugin Registered!"); - } - private void registerEvents(){ + @Override + public void register(JavaPlugin plugin) { plugin.getServer().getPluginManager().registerEvents(new AliArrowListener(plugin), plugin); - } - private void registerCommands(){ - } } diff --git a/src/alisolarflare/modules/magictrick/aliarrow/AliArrowTask.java b/src/alisolarflare/modules/magictrick/aliarrow/AliArrowTask.java index b032db1..0a8cdf8 100644 --- a/src/alisolarflare/modules/magictrick/aliarrow/AliArrowTask.java +++ b/src/alisolarflare/modules/magictrick/aliarrow/AliArrowTask.java @@ -2,18 +2,17 @@ package alisolarflare.modules.magictrick.aliarrow; import org.bukkit.Particle; import org.bukkit.entity.Arrow; +import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitRunnable; -import alisolarflare.AliPresents; - public class AliArrowTask extends BukkitRunnable{ - AliPresents plugin; + JavaPlugin plugin; String name; Arrow arrow; - public AliArrowTask(AliPresents plugin, Arrow arrow, String name){ + public AliArrowTask(JavaPlugin plugin, Arrow arrow, String name){ this.name = name; this.plugin = plugin; this.arrow = arrow;