Wired up modules to AliPresents, SHIT's DOOONE

This commit is contained in:
alisolarflare 2016-10-31 01:02:58 -04:00
parent 4c8ffa5a9e
commit 86bc063718
8 changed files with 40 additions and 53 deletions

View file

@ -6,7 +6,11 @@ import org.bukkit.plugin.PluginDescriptionFile;
//import alisolarflare.links.AliLinkSubPlug; //import alisolarflare.links.AliLinkSubPlug;
import org.bukkit.plugin.java.JavaPlugin; 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; import alisolarflare.modules.magictrick.aliarrow.AliArrowModule;
public class AliPresents extends JavaPlugin{ public class AliPresents extends JavaPlugin{
@ -18,15 +22,17 @@ public class AliPresents extends JavaPlugin{
logger.info(pdfFile.getName() + " has been started (V." + pdfFile.getVersion()+ ")."); logger.info(pdfFile.getName() + " has been started (V." + pdfFile.getVersion()+ ").");
registerModules(); registerModules();
registerEvents();
logger.info(pdfFile.getName() + " has fully registered (V." + pdfFile.getVersion()+ ")."); logger.info(pdfFile.getName() + " has fully registered (V." + pdfFile.getVersion()+ ").");
}
private void registerEvents() {
} }
public void registerModules(){ 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);
} }
} }

View file

@ -8,11 +8,6 @@ import alisolarflare.modules.components.flairdoor.commands.SetFlairDoorColour;
import alisolarflare.modules.components.flairdoor.listeners.PortalListener; import alisolarflare.modules.components.flairdoor.listeners.PortalListener;
public class FlairDoorModule extends Module{ public class FlairDoorModule extends Module{
@SuppressWarnings("unused")
private JavaPlugin plugin;
public FlairDoorModule(JavaPlugin plugin){
this.plugin = plugin;
}
@Override @Override
public void register(JavaPlugin plugin) { public void register(JavaPlugin plugin) {
plugin.getCommand("flairme").setExecutor(new FlairMe()); plugin.getCommand("flairme").setExecutor(new FlairMe());

View file

@ -9,26 +9,21 @@ import alisolarflare.modules.components.links.commands.SetAliLink;
import alisolarflare.modules.components.links.entities.Link; import alisolarflare.modules.components.links.entities.Link;
public class AliLinkModule extends Module{ public class AliLinkModule extends Module{
public JavaPlugin plugin;
private SetAliLink setAliLink; private SetAliLink setAliLink;
public AliLinkModule(JavaPlugin plugin){
this.plugin = plugin;
}
@Override @Override
public void register(JavaPlugin plugin){ public void register(JavaPlugin plugin){
setAliLink = new SetAliLink(plugin); setAliLink = new SetAliLink(plugin);
plugin.getCommand("setalilink").setExecutor(setAliLink); 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); plugin.getConfig().set("aliLinkList", setAliLink.linkList);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public List<Link> loadLinkList(){ public List<Link> loadLinkList(JavaPlugin plugin){
return (List<Link>) plugin.getConfig().getList("aliLinkList"); return (List<Link>) plugin.getConfig().getList("aliLinkList");
} }

View file

@ -3,21 +3,21 @@ package alisolarflare.modules.components.links.commands;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.modules.components.links.AliLinkModule;
import alisolarflare.modules.components.links.entities.Link; import alisolarflare.modules.components.links.entities.Link;
public class PressAliLink implements CommandExecutor{ public class PressAliLink implements CommandExecutor{
private AliLinkModule module; private JavaPlugin plugin;
private SetAliLink setAliLink; private SetAliLink setAliLink;
public PressAliLink(AliLinkModule subplugin, SetAliLink setAliLink){ public PressAliLink(JavaPlugin plugin, SetAliLink setAliLink){
this.module = subplugin; this.plugin = plugin;
this.setAliLink = setAliLink; this.setAliLink = setAliLink;
} }
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { 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){ if (args.length < 1){
sender.sendMessage("You must specify a link frequency"); sender.sendMessage("You must specify a link frequency");
@ -26,7 +26,7 @@ public class PressAliLink implements CommandExecutor{
for (Link link: setAliLink.linkList){ for (Link link: setAliLink.linkList){
for (String inputlink: args){ for (String inputlink: args){
if(inputlink.equals(link.frequency)){ if(inputlink.equals(link.frequency)){
link.press(module); link.press(plugin);
} }
} }
} }

View file

@ -4,8 +4,8 @@ import java.io.Serializable;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.modules.components.links.AliLinkModule;
import alisolarflare.modules.components.links.tasks.UnpressTask; import alisolarflare.modules.components.links.tasks.UnpressTask;
public class Link implements Serializable{ public class Link implements Serializable{
@ -28,10 +28,14 @@ public class Link implements Serializable{
this.z = "" + location.getBlockZ(); this.z = "" + location.getBlockZ();
//plugin.plugin.getConfig().set("frequency", 10); //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); location.getBlock().setType(Material.REDSTONE_BLOCK);
UnpressTask unPressTask = new UnpressTask(location); UnpressTask unPressTask = new UnpressTask(location);
unPressTask.runTaskTimer(plugin.plugin, 2, 1); unPressTask.runTaskTimer(plugin, 2, 1);
} }
} }

View file

@ -6,13 +6,12 @@ import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.AliPresents;
public class AliArrowListener implements Listener { public class AliArrowListener implements Listener {
private final AliPresents plugin; private final JavaPlugin plugin;
public AliArrowListener(AliPresents plugin){ public AliArrowListener(JavaPlugin plugin){
this.plugin = plugin; this.plugin = plugin;
} }

View file

@ -1,27 +1,16 @@
package alisolarflare.modules.magictrick.aliarrow; package alisolarflare.modules.magictrick.aliarrow;
import java.util.logging.Level;
import alisolarflare.AliPresents;
public class AliArrowModule { import org.bukkit.plugin.java.JavaPlugin;
private AliPresents plugin; import alisolarflare.modules.Module;
public AliArrowModule(AliPresents plugin){ public class AliArrowModule extends Module{
this.plugin = plugin;
}
/** /**
* Registers the plugin, activating listeners, commands, and events * Registers the plugin, activating listeners, commands, and events
*/ */
public void register(){ @Override
registerEvents(); public void register(JavaPlugin plugin) {
registerCommands();
plugin.getLogger().log(Level.INFO, "Discord Sub Plugin Registered!");
}
private void registerEvents(){
plugin.getServer().getPluginManager().registerEvents(new AliArrowListener(plugin), plugin); plugin.getServer().getPluginManager().registerEvents(new AliArrowListener(plugin), plugin);
}
private void registerCommands(){
} }
} }

View file

@ -2,18 +2,17 @@ package alisolarflare.modules.magictrick.aliarrow;
import org.bukkit.Particle; import org.bukkit.Particle;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import alisolarflare.AliPresents;
public class AliArrowTask extends BukkitRunnable{ public class AliArrowTask extends BukkitRunnable{
AliPresents plugin; JavaPlugin plugin;
String name; String name;
Arrow arrow; Arrow arrow;
public AliArrowTask(AliPresents plugin, Arrow arrow, String name){ public AliArrowTask(JavaPlugin plugin, Arrow arrow, String name){
this.name = name; this.name = name;
this.plugin = plugin; this.plugin = plugin;
this.arrow = arrow; this.arrow = arrow;