Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-09 13:00:05 +01:00
Register BlockExplodeEvent in separate class
Dieser Commit ist enthalten in:
Ursprung
74ec39d67b
Commit
f72977e69a
@ -24,7 +24,6 @@ import org.bukkit.event.block.BlockCanBuildEvent;
|
|||||||
import org.bukkit.event.block.BlockDamageEvent;
|
import org.bukkit.event.block.BlockDamageEvent;
|
||||||
import org.bukkit.event.block.BlockDispenseEvent;
|
import org.bukkit.event.block.BlockDispenseEvent;
|
||||||
import org.bukkit.event.block.BlockExpEvent;
|
import org.bukkit.event.block.BlockExpEvent;
|
||||||
import org.bukkit.event.block.BlockExplodeEvent;
|
|
||||||
import org.bukkit.event.block.BlockFadeEvent;
|
import org.bukkit.event.block.BlockFadeEvent;
|
||||||
import org.bukkit.event.block.BlockFromToEvent;
|
import org.bukkit.event.block.BlockFromToEvent;
|
||||||
import org.bukkit.event.block.BlockGrowEvent;
|
import org.bukkit.event.block.BlockGrowEvent;
|
||||||
@ -57,22 +56,8 @@ public abstract class ChunkListener implements Listener {
|
|||||||
if (Settings.IMP.TICK_LIMITER.ENABLED) {
|
if (Settings.IMP.TICK_LIMITER.ENABLED) {
|
||||||
PluginManager plm = Bukkit.getPluginManager();
|
PluginManager plm = Bukkit.getPluginManager();
|
||||||
Plugin plugin = Fawe.<FaweBukkit>imp().getPlugin();
|
Plugin plugin = Fawe.<FaweBukkit>imp().getPlugin();
|
||||||
for (Method method : this.getClass().getMethods()) {
|
plm.registerEvents(this, plugin);
|
||||||
if (method.isAnnotationPresent(EventHandler.class)) {
|
try { plm.registerEvents(new ChunkListener_8Plus(this), plugin); } catch (Throwable ignore) {}
|
||||||
try {
|
|
||||||
EventHandler annotation = method.getAnnotation(EventHandler.class);
|
|
||||||
EventPriority priority = annotation.priority();
|
|
||||||
boolean ignoreC = annotation.ignoreCancelled();
|
|
||||||
Class<? extends Event> event = (Class<? extends Event>) method.getParameterTypes()[0];
|
|
||||||
EventExecutor executor = EventExecutor.create(method, event);
|
|
||||||
plm.registerEvent(event, this, priority, executor, plugin, ignoreC);
|
|
||||||
System.out.println("Registered " + method);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Fawe.debug("Failed to register " + method + " | " + e.getMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
TaskManager.IMP.repeat(new Runnable() {
|
TaskManager.IMP.repeat(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -139,7 +124,7 @@ public abstract class ChunkListener implements Listener {
|
|||||||
protected long physStart;
|
protected long physStart;
|
||||||
protected long physTick;
|
protected long physTick;
|
||||||
|
|
||||||
private void reset() {
|
public final void reset() {
|
||||||
physSkip = 0;
|
physSkip = 0;
|
||||||
physStart = System.currentTimeMillis();
|
physStart = System.currentTimeMillis();
|
||||||
physCancel = false;
|
physCancel = false;
|
||||||
@ -160,9 +145,6 @@ public abstract class ChunkListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void event(BlockExpEvent event) { reset(); }
|
public void event(BlockExpEvent event) { reset(); }
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
|
||||||
public void event(BlockExplodeEvent event) { reset(); }
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void event(BlockFadeEvent event) { reset(); }
|
public void event(BlockFadeEvent event) { reset(); }
|
||||||
|
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.boydti.fawe.bukkit.v0;
|
||||||
|
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.block.BlockExplodeEvent;
|
||||||
|
|
||||||
|
public class ChunkListener_8Plus implements Listener{
|
||||||
|
private final ChunkListener listener;
|
||||||
|
|
||||||
|
public ChunkListener_8Plus(ChunkListener listener) {
|
||||||
|
this.listener = listener;
|
||||||
|
}
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
public void event(BlockExplodeEvent event) {
|
||||||
|
listener.reset();
|
||||||
|
}
|
||||||
|
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren