geforkt von Mirrors/Paper
Implemented PluginEnabled and PluginDisabled
By: Dinnerbone <dinnerbone@dinnerbone.com>
Dieser Commit ist enthalten in:
Ursprung
501c5ca60d
Commit
91e76c3c32
26
paper-api/src/main/java/org/bukkit/event/server/PluginEvent.java
Normale Datei
26
paper-api/src/main/java/org/bukkit/event/server/PluginEvent.java
Normale Datei
@ -0,0 +1,26 @@
|
||||
|
||||
package org.bukkit.event.server;
|
||||
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Used for plugin loaded and unloaded events
|
||||
*/
|
||||
public class PluginEvent extends ServerEvent {
|
||||
private final Plugin plugin;
|
||||
|
||||
public PluginEvent(final Type type, final Plugin plugin) {
|
||||
super(type);
|
||||
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the plugin involved in this event
|
||||
*
|
||||
* @return Plugin for this event
|
||||
*/
|
||||
public Plugin getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
}
|
13
paper-api/src/main/java/org/bukkit/event/server/ServerEvent.java
Normale Datei
13
paper-api/src/main/java/org/bukkit/event/server/ServerEvent.java
Normale Datei
@ -0,0 +1,13 @@
|
||||
|
||||
package org.bukkit.event.server;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
|
||||
/**
|
||||
* Miscellaneous server events
|
||||
*/
|
||||
public class ServerEvent extends Event {
|
||||
public ServerEvent(final Type type) {
|
||||
super(type);
|
||||
}
|
||||
}
|
25
paper-api/src/main/java/org/bukkit/event/server/ServerListener.java
Normale Datei
25
paper-api/src/main/java/org/bukkit/event/server/ServerListener.java
Normale Datei
@ -0,0 +1,25 @@
|
||||
|
||||
package org.bukkit.event.server;
|
||||
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
/**
|
||||
* Handles all miscellaneous server events
|
||||
*/
|
||||
public class ServerListener implements Listener {
|
||||
/**
|
||||
* Called when a plugin is enabled
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPluginEnabled(PluginEvent event) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a plugin is disabled
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPluginDisabled(PluginEvent event) {
|
||||
}
|
||||
}
|
@ -17,6 +17,8 @@ import org.bukkit.event.Event;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.*;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.event.server.PluginEvent;
|
||||
import org.bukkit.event.server.ServerListener;
|
||||
import org.bukkit.plugin.*;
|
||||
|
||||
/**
|
||||
@ -83,45 +85,57 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
PlayerListener trueListener = (PlayerListener)listener;
|
||||
|
||||
switch (event.getType()) {
|
||||
case PLAYER_JOIN:
|
||||
trueListener.onPlayerJoin((PlayerEvent)event);
|
||||
break;
|
||||
case PLAYER_QUIT:
|
||||
trueListener.onPlayerQuit((PlayerEvent)event);
|
||||
break;
|
||||
case PLAYER_COMMAND:
|
||||
trueListener.onPlayerCommand((PlayerChatEvent)event);
|
||||
break;
|
||||
case PLAYER_CHAT:
|
||||
trueListener.onPlayerChat((PlayerChatEvent)event);
|
||||
break;
|
||||
case PLAYER_MOVE:
|
||||
trueListener.onPlayerMove((PlayerMoveEvent)event);
|
||||
break;
|
||||
case PLAYER_TELEPORT:
|
||||
trueListener.onPlayerTeleport((PlayerMoveEvent)event);
|
||||
break;
|
||||
case PLAYER_LOGIN:
|
||||
trueListener.onPlayerLogin((PlayerLoginEvent)event);
|
||||
break;
|
||||
case PLAYER_JOIN:
|
||||
trueListener.onPlayerJoin((PlayerEvent)event);
|
||||
break;
|
||||
case PLAYER_QUIT:
|
||||
trueListener.onPlayerQuit((PlayerEvent)event);
|
||||
break;
|
||||
case PLAYER_COMMAND:
|
||||
trueListener.onPlayerCommand((PlayerChatEvent)event);
|
||||
break;
|
||||
case PLAYER_CHAT:
|
||||
trueListener.onPlayerChat((PlayerChatEvent)event);
|
||||
break;
|
||||
case PLAYER_MOVE:
|
||||
trueListener.onPlayerMove((PlayerMoveEvent)event);
|
||||
break;
|
||||
case PLAYER_TELEPORT:
|
||||
trueListener.onPlayerTeleport((PlayerMoveEvent)event);
|
||||
break;
|
||||
case PLAYER_LOGIN:
|
||||
trueListener.onPlayerLogin((PlayerLoginEvent)event);
|
||||
break;
|
||||
}
|
||||
} else if (listener instanceof BlockListener) {
|
||||
BlockListener trueListener = (BlockListener)listener;
|
||||
|
||||
switch (event.getType()) {
|
||||
case BLOCK_PHYSICS:
|
||||
trueListener.onBlockPhysics((BlockPhysicsEvent)event);
|
||||
break;
|
||||
case BLOCK_CANBUILD:
|
||||
trueListener.onBlockCanBuild((BlockCanBuildEvent)event);
|
||||
break;
|
||||
case BLOCK_FLOW:
|
||||
trueListener.onBlockFlow((BlockFromToEvent)event);
|
||||
break;
|
||||
case BLOCK_PHYSICS:
|
||||
trueListener.onBlockPhysics((BlockPhysicsEvent)event);
|
||||
break;
|
||||
case BLOCK_CANBUILD:
|
||||
trueListener.onBlockCanBuild((BlockCanBuildEvent)event);
|
||||
break;
|
||||
case BLOCK_FLOW:
|
||||
trueListener.onBlockFlow((BlockFromToEvent)event);
|
||||
break;
|
||||
}
|
||||
} else if(listener instanceof ServerListener) {
|
||||
ServerListener trueListener = (ServerListener)listener;
|
||||
|
||||
switch (event.getType()) {
|
||||
case PLUGIN_ENABLE:
|
||||
trueListener.onPluginEnabled((PluginEvent)event);
|
||||
break;
|
||||
case PLUGIN_DISABLE:
|
||||
trueListener.onPluginDisabled((PluginEvent)event);
|
||||
break;
|
||||
}
|
||||
} else if(listener instanceof CustomEventListener) {
|
||||
if(event.getType()==Event.Type.CUSTOM_EVENT)
|
||||
if(event.getType()==Event.Type.CUSTOM_EVENT) {
|
||||
((CustomEventListener)listener).onCustomEvent(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren