Added Module Class, for extra portability
This commit is contained in:
parent
34c0bc432b
commit
4c8ffa5a9e
29 changed files with 133 additions and 110 deletions
|
@ -6,15 +6,8 @@ import org.bukkit.plugin.PluginDescriptionFile;
|
|||
//import alisolarflare.links.AliLinkSubPlug;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import alisolarflare.magictrick.aliarrow.AliArrowSubPlugin;
|
||||
import alisolarflare.tools.flairdoors.FlairMe;
|
||||
import alisolarflare.tools.flairdoors.PortalListener;
|
||||
import alisolarflare.tools.flairdoors.SetFlairDoorColour;
|
||||
import alisolarflare.tools.gpowers.gPowerCommand;
|
||||
import alisolarflare.tools.gpowers.commands.PowerDown;
|
||||
import alisolarflare.tools.gpowers.commands.PowerUp;
|
||||
import alisolarflare.tools.gpowers.listeners.gPowerListener;
|
||||
import alisolarflare.tools.shulker.AliShulker;
|
||||
import alisolarflare.modules.components.flairdoor.listeners.PortalListener;
|
||||
import alisolarflare.modules.magictrick.aliarrow.AliArrowModule;
|
||||
|
||||
public class AliPresents extends JavaPlugin{
|
||||
public void onEnable(){
|
||||
|
@ -25,7 +18,6 @@ public class AliPresents extends JavaPlugin{
|
|||
logger.info(pdfFile.getName() + " has been started (V." + pdfFile.getVersion()+ ").");
|
||||
|
||||
registerModules();
|
||||
registerCommands();
|
||||
registerEvents();
|
||||
|
||||
logger.info(pdfFile.getName() + " has fully registered (V." + pdfFile.getVersion()+ ").");
|
||||
|
@ -33,23 +25,8 @@ public class AliPresents extends JavaPlugin{
|
|||
|
||||
}
|
||||
private void registerEvents() {
|
||||
getServer().getPluginManager().registerEvents(new PortalListener(this), this);
|
||||
getServer().getPluginManager().registerEvents(new gPowerListener(this), this);
|
||||
}
|
||||
public void registerModules(){
|
||||
new AliArrowSubPlugin(this).register();
|
||||
|
||||
|
||||
//AliLinkSubPlug alilinksubplugin = new AliLinkSubPlug(this);
|
||||
//alilinksubplugin.register();
|
||||
}
|
||||
public void registerCommands(){
|
||||
getCommand("powerup").setExecutor(new PowerUp());
|
||||
getCommand("powerdown").setExecutor(new PowerDown());
|
||||
getCommand("gpowercommand").setExecutor(new gPowerCommand());
|
||||
getCommand("flairme").setExecutor(new FlairMe());
|
||||
getCommand("alishulker").setExecutor(new AliShulker());
|
||||
getCommand("setflairdoorcolour").setExecutor(new SetFlairDoorColour());
|
||||
|
||||
new AliArrowModule(this).register();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
package alisolarflare;
|
||||
package alisolarflare.modules;
|
||||
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import alisolarflare.magictrick.aliarrow.AliArrowListener;
|
||||
|
||||
/**
|
||||
* A Module class is a helper class that allows the compacting of projects into one single package.
|
||||
* Each feature, whether game, arrow trail listener, or command tool, can have its command and listener
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package alisolarflare;
|
||||
package alisolarflare.modules;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
|
|
|
@ -1,22 +1,23 @@
|
|||
package alisolarflare.tools.flairdoors;
|
||||
package alisolarflare.modules.components.flairdoor;
|
||||
|
||||
import alisolarflare.AliPresents;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class FlairDoorsSubPlug{
|
||||
import alisolarflare.modules.Module;
|
||||
import alisolarflare.modules.components.flairdoor.commands.FlairMe;
|
||||
import alisolarflare.modules.components.flairdoor.commands.SetFlairDoorColour;
|
||||
import alisolarflare.modules.components.flairdoor.listeners.PortalListener;
|
||||
|
||||
public class FlairDoorModule extends Module{
|
||||
@SuppressWarnings("unused")
|
||||
private AliPresents plugin;
|
||||
public FlairDoorsSubPlug(AliPresents plugin){
|
||||
private JavaPlugin plugin;
|
||||
public FlairDoorModule(JavaPlugin plugin){
|
||||
this.plugin = plugin;
|
||||
}
|
||||
public void register(){
|
||||
registerCommands();
|
||||
registerEvents();
|
||||
}
|
||||
private void registerCommands() {
|
||||
//plugin.getCommand("FlairMe").setExecutor(new FlairMe());
|
||||
}
|
||||
private void registerEvents() {
|
||||
// TODO Auto-generated method stub
|
||||
@Override
|
||||
public void register(JavaPlugin plugin) {
|
||||
plugin.getCommand("flairme").setExecutor(new FlairMe());
|
||||
plugin.getCommand("setflairdoorcolour").setExecutor(new SetFlairDoorColour());
|
||||
|
||||
plugin.getServer().getPluginManager().registerEvents(new PortalListener(plugin), plugin);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package alisolarflare.tools.flairdoors;
|
||||
package alisolarflare.modules.components.flairdoor.commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import alisolarflare.modules.components.flairdoor.listeners.PortalListener;
|
||||
|
||||
public class FlairMe implements CommandExecutor{
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package alisolarflare.tools.flairdoors;
|
||||
package alisolarflare.modules.components.flairdoor.commands;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package alisolarflare.tools.flairdoors;
|
||||
package alisolarflare.modules.components.flairdoor.listeners;
|
||||
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
|
@ -15,18 +15,17 @@ import org.bukkit.event.Listener;
|
|||
import org.bukkit.event.player.PlayerPortalEvent;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.material.Wool;
|
||||
|
||||
import alisolarflare.AliPresents;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class PortalListener implements Listener{
|
||||
AbstractMap<String,Location> portalMap = new HashMap<String,Location>();
|
||||
public static List<String> playersToBeFlaired = new ArrayList<String>();
|
||||
public AliPresents plugin;
|
||||
public JavaPlugin plugin;
|
||||
|
||||
//TODO: CREATE - LIST OF PORTALS (only x-z values)
|
||||
|
||||
|
||||
public PortalListener(AliPresents plugin) {
|
||||
public PortalListener(JavaPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
@EventHandler
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package alisolarflare.modules.components.gpowers;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import alisolarflare.modules.Module;
|
||||
import alisolarflare.modules.components.gpowers.commands.PowerDown;
|
||||
import alisolarflare.modules.components.gpowers.commands.PowerUp;
|
||||
import alisolarflare.modules.components.gpowers.commands.gPowerCommand;
|
||||
import alisolarflare.modules.components.gpowers.listeners.gPowerListener;
|
||||
|
||||
public class GPowerModule extends Module{
|
||||
|
||||
@Override
|
||||
public void register(JavaPlugin plugin) {
|
||||
plugin.getCommand("powerup").setExecutor(new PowerUp());
|
||||
plugin.getCommand("powerdown").setExecutor(new PowerDown());
|
||||
plugin.getCommand("gpowercommand").setExecutor(new gPowerCommand());
|
||||
|
||||
plugin.getServer().getPluginManager().registerEvents(new gPowerListener(plugin), plugin);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package alisolarflare.tools.gpowers.commands;
|
||||
package alisolarflare.modules.components.gpowers.commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package alisolarflare.tools.gpowers.commands;
|
||||
package alisolarflare.modules.components.gpowers.commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package alisolarflare.tools.gpowers;
|
||||
package alisolarflare.modules.components.gpowers.commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import alisolarflare.modules.components.gpowers.gPowerMemory;
|
||||
|
||||
public class gPowerCommand implements CommandExecutor{
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package alisolarflare.tools.gpowers;
|
||||
package alisolarflare.modules.components.gpowers;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
package alisolarflare.tools.gpowers.listeners;
|
||||
package alisolarflare.modules.components.gpowers.listeners;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import alisolarflare.AliPresents;
|
||||
import alisolarflare.tools.gpowers.gPowerMemory;
|
||||
import alisolarflare.modules.components.gpowers.gPowerMemory;
|
||||
|
||||
public class gPowerApplyingTask extends BukkitRunnable{
|
||||
|
||||
private AliPresents plugin;
|
||||
private JavaPlugin plugin;
|
||||
|
||||
public gPowerApplyingTask(AliPresents plugin) {
|
||||
public gPowerApplyingTask(JavaPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package alisolarflare.tools.gpowers.listeners;
|
||||
package alisolarflare.modules.components.gpowers.listeners;
|
||||
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import alisolarflare.AliPresents;
|
||||
|
||||
public class gPowerListener implements Listener{
|
||||
private AliPresents plugin;
|
||||
private JavaPlugin plugin;
|
||||
public gPowerApplyingTask powerApplyingTask;
|
||||
public BukkitTask bukkitTask;
|
||||
public gPowerListener(AliPresents plugin){
|
||||
|
||||
public gPowerListener(JavaPlugin plugin){
|
||||
this.plugin = plugin;
|
||||
this.powerApplyingTask = new gPowerApplyingTask(this.plugin);
|
||||
bukkitTask = powerApplyingTask.runTaskTimer(plugin, 190, 190);
|
||||
|
|
|
@ -1,22 +1,25 @@
|
|||
package alisolarflare.tools.links;
|
||||
package alisolarflare.modules.components.links;
|
||||
import java.util.List;
|
||||
|
||||
import alisolarflare.AliPresents;
|
||||
import alisolarflare.tools.links.commands.PressAliLink;
|
||||
import alisolarflare.tools.links.commands.SetAliLink;
|
||||
import alisolarflare.tools.links.entities.Link;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class AliLinkSubPlug{
|
||||
public AliPresents plugin;
|
||||
import alisolarflare.modules.Module;
|
||||
import alisolarflare.modules.components.links.commands.PressAliLink;
|
||||
import alisolarflare.modules.components.links.commands.SetAliLink;
|
||||
import alisolarflare.modules.components.links.entities.Link;
|
||||
|
||||
public class AliLinkModule extends Module{
|
||||
public JavaPlugin plugin;
|
||||
private SetAliLink setAliLink;
|
||||
|
||||
public AliLinkSubPlug(AliPresents plugin){
|
||||
public AliLinkModule(JavaPlugin plugin){
|
||||
this.plugin = plugin;
|
||||
|
||||
|
||||
}
|
||||
public void register(){
|
||||
setAliLink = new SetAliLink(this.plugin);
|
||||
@Override
|
||||
public void register(JavaPlugin plugin){
|
||||
setAliLink = new SetAliLink(plugin);
|
||||
plugin.getCommand("setalilink").setExecutor(setAliLink);
|
||||
plugin.getCommand("pressalilink").setExecutor(new PressAliLink(this, setAliLink));
|
||||
|
||||
|
@ -29,4 +32,5 @@ public class AliLinkSubPlug{
|
|||
return (List<Link>) plugin.getConfig().getList("aliLinkList");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
package alisolarflare.tools.links.commands;
|
||||
package alisolarflare.modules.components.links.commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import alisolarflare.tools.links.AliLinkSubPlug;
|
||||
import alisolarflare.tools.links.entities.Link;
|
||||
import alisolarflare.modules.components.links.AliLinkModule;
|
||||
import alisolarflare.modules.components.links.entities.Link;
|
||||
|
||||
public class PressAliLink implements CommandExecutor{
|
||||
private AliLinkSubPlug subplugin;
|
||||
private AliLinkModule module;
|
||||
private SetAliLink setAliLink;
|
||||
public PressAliLink(AliLinkSubPlug subplugin, SetAliLink setAliLink){
|
||||
this.subplugin = subplugin;
|
||||
public PressAliLink(AliLinkModule subplugin, SetAliLink setAliLink){
|
||||
this.module = subplugin;
|
||||
this.setAliLink = setAliLink;
|
||||
}
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
subplugin.plugin.getServer().broadcastMessage(setAliLink.linkList.toString() + "over.");
|
||||
module.plugin.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(subplugin);
|
||||
link.press(module);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package alisolarflare.tools.links.commands;
|
||||
package alisolarflare.modules.components.links.commands;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -10,10 +10,10 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import alisolarflare.AliPresents;
|
||||
import alisolarflare.tools.links.AliLinkSubPlug;
|
||||
import alisolarflare.tools.links.entities.Link;
|
||||
import alisolarflare.modules.components.links.AliLinkModule;
|
||||
import alisolarflare.modules.components.links.entities.Link;
|
||||
|
||||
/**
|
||||
* This class manages the command /SetAliLink <frequency> [x] [y] [z]. This command creates an Ali-Link,
|
||||
|
@ -26,14 +26,14 @@ import alisolarflare.tools.links.entities.Link;
|
|||
*/
|
||||
public class SetAliLink implements CommandExecutor{
|
||||
public List<Link> linkList = new ArrayList<Link>();
|
||||
AliLinkSubPlug subplugin;
|
||||
private AliPresents plugin;
|
||||
AliLinkModule subplugin;
|
||||
private JavaPlugin plugin;
|
||||
|
||||
/**
|
||||
* Constructs the SetAliLink class
|
||||
* @param plugin The plugin that contains the configuration file of AliPresents
|
||||
* @param plugin The plugin that contains the configuration file of SetAliLink
|
||||
*/
|
||||
public SetAliLink(AliPresents plugin){
|
||||
public SetAliLink(JavaPlugin plugin){
|
||||
this.plugin = plugin;
|
||||
load();
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package alisolarflare.tools.links.entities;
|
||||
package alisolarflare.modules.components.links.entities;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import alisolarflare.tools.links.AliLinkSubPlug;
|
||||
import alisolarflare.tools.links.tasks.UnpressTask;
|
||||
import alisolarflare.modules.components.links.AliLinkModule;
|
||||
import alisolarflare.modules.components.links.tasks.UnpressTask;
|
||||
|
||||
public class Link implements Serializable{
|
||||
/**
|
||||
|
@ -28,7 +28,7 @@ public class Link implements Serializable{
|
|||
this.z = "" + location.getBlockZ();
|
||||
//plugin.plugin.getConfig().set("frequency", 10);
|
||||
}
|
||||
public void press(AliLinkSubPlug plugin) {
|
||||
public void press(AliLinkModule plugin) {
|
||||
Location location = new Location(plugin.plugin.getServer().getWorld(world), Integer.parseInt(x), Integer.parseInt(y), Integer.parseInt(z));
|
||||
location.getBlock().setType(Material.REDSTONE_BLOCK);
|
||||
UnpressTask unPressTask = new UnpressTask(location);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package alisolarflare.tools.links.serializer;
|
||||
package alisolarflare.modules.components.links.serializer;
|
||||
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.util.List;
|
||||
|
||||
import alisolarflare.tools.links.entities.Link;
|
||||
import alisolarflare.modules.components.links.entities.Link;
|
||||
|
||||
public class Deserializer{
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package alisolarflare.tools.links.serializer;
|
||||
package alisolarflare.modules.components.links.serializer;
|
||||
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.util.List;
|
||||
|
||||
import alisolarflare.tools.links.entities.Link;
|
||||
import alisolarflare.modules.components.links.entities.Link;
|
||||
|
||||
public class Serializer {
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package alisolarflare.tools.links.tasks;
|
||||
package alisolarflare.modules.components.links.tasks;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package alisolarflare.modules.components.shulker;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import alisolarflare.modules.Module;
|
||||
import alisolarflare.modules.components.shulker.commands.AliShulker;
|
||||
|
||||
public class AliShulkerModule extends Module{
|
||||
|
||||
@Override
|
||||
public void register(JavaPlugin plugin) {
|
||||
plugin.getCommand("alishulker").setExecutor(new AliShulker());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package alisolarflare.tools.shulker;
|
||||
package alisolarflare.modules.components.shulker.commands;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package alisolarflare.events.uhc;
|
||||
package alisolarflare.modules.events.uhc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package alisolarflare.events.uhc;
|
||||
package alisolarflare.modules.events.uhc;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import alisolarflare.Module;
|
||||
import alisolarflare.modules.Module;
|
||||
import alisolarflare.modules.events.uhc.commands.AddToUHC;
|
||||
|
||||
public class UHCModule extends Module {
|
||||
public UHCMatch generalMemory;
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package alisolarflare.events.uhc;
|
||||
package alisolarflare.modules.events.uhc.commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import alisolarflare.modules.events.uhc.UHCMatch;
|
||||
|
||||
/**
|
||||
* This class handles the specific command /addToUHC which, in-game,
|
||||
* adds a player to a specific UltraHardcore match, that is defined
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package alisolarflare.magictrick.aliarrow;
|
||||
package alisolarflare.modules.magictrick.aliarrow;
|
||||
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package alisolarflare.magictrick.aliarrow;
|
||||
package alisolarflare.modules.magictrick.aliarrow;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import alisolarflare.AliPresents;
|
||||
|
||||
public class AliArrowSubPlugin {
|
||||
public class AliArrowModule {
|
||||
private AliPresents plugin;
|
||||
|
||||
public AliArrowSubPlugin(AliPresents plugin){
|
||||
public AliArrowModule(AliPresents plugin){
|
||||
this.plugin = plugin;
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package alisolarflare.magictrick.aliarrow;
|
||||
package alisolarflare.modules.magictrick.aliarrow;
|
||||
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Arrow;
|
||||
|
|
Loading…
Reference in a new issue