Move AbilityLoadEvent to event package

This commit is contained in:
Jack Lin 2015-10-03 16:47:09 +13:00
parent 88b699bd8c
commit d20ec88055
3 changed files with 72 additions and 66 deletions

View file

@ -1,66 +1,70 @@
package com.projectkorra.projectkorra.util;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.Plugin;
import java.util.jar.JarFile;
/**
* Called when an ability is successfully loaded.
*
* @author kingbirdy
*/
public class AbilityLoadEvent<T> extends Event {
private static final HandlerList handlers = new HandlerList();
private final Plugin plugin;
private final T loadable;
private final JarFile jarFile;
/**
* Creates a new AbilityLoadEvent.
* @param plugin The instance of ProjectKorra
* @param loadable The class that was loaded
* @param jarFile The JarFile the class was loaded from
*/
public AbilityLoadEvent(Plugin plugin, T loadable, JarFile jarFile) {
this.plugin = plugin;
this.loadable = loadable;
this.jarFile = jarFile;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* Gets the JarFile the ability was loaded from.
* @return The JarFile from the event
*/
public JarFile getJarFile() {
return jarFile;
}
/**
* Gets the ability's class that was loaded
* @return The loaded class
*/
public T getLoadable() {
return loadable;
}
/**
* Gets the ProjectKorra instance the ability was loaded into.
* @return The ProjectKorra instance
*/
public Plugin getPlugin() {
return plugin;
}
}
package com.projectkorra.projectkorra.event;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.Plugin;
import java.util.jar.JarFile;
/**
* Called when an ability is successfully loaded.
*
* @author kingbirdy
*/
public class AbilityLoadEvent<T> extends Event {
private static final HandlerList handlers = new HandlerList();
private final Plugin plugin;
private final T loadable;
private final JarFile jarFile;
/**
* Creates a new AbilityLoadEvent.
*
* @param plugin The instance of ProjectKorra
* @param loadable The class that was loaded
* @param jarFile The JarFile the class was loaded from
*/
public AbilityLoadEvent(Plugin plugin, T loadable, JarFile jarFile) {
this.plugin = plugin;
this.loadable = loadable;
this.jarFile = jarFile;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* Gets the JarFile the ability was loaded from.
*
* @return The JarFile from the event
*/
public JarFile getJarFile() {
return jarFile;
}
/**
* Gets the ability's class that was loaded.
*
* @return The loaded class
*/
public T getLoadable() {
return loadable;
}
/**
* Gets the ProjectKorra instance the ability was loaded into.
*
* @return The ProjectKorra instance
*/
public Plugin getPlugin() {
return plugin;
}
}

View file

@ -1,5 +1,6 @@
package com.projectkorra.projectkorra.util;
import com.projectkorra.projectkorra.event.AbilityLoadEvent;
import com.projectkorra.projectkorra.util.AbilityLoadable.LoadResult;
import com.projectkorra.projectkorra.util.AbilityLoadable.LoadResult.Result;

View file

@ -15,6 +15,7 @@ public final class FileExtensionFilter implements FileFilter {
/**
* Creates a new FileExtensionFilter.
*
* @param extension the extension to filter for
*/
public FileExtensionFilter(String extension) {