Register BlockExplodeEvent in another class
This commit is contained in:
parent
1fabc98aff
commit
4394b45743
@ -7,8 +7,12 @@ import com.boydti.fawe.config.Settings;
|
|||||||
import com.boydti.fawe.util.FaweTimer;
|
import com.boydti.fawe.util.FaweTimer;
|
||||||
import com.boydti.fawe.util.MathMan;
|
import com.boydti.fawe.util.MathMan;
|
||||||
import com.boydti.fawe.util.TaskManager;
|
import com.boydti.fawe.util.TaskManager;
|
||||||
|
import com.google.common.io.Files;
|
||||||
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
|
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
|
||||||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -42,11 +46,19 @@ import org.bukkit.event.inventory.FurnaceBurnEvent;
|
|||||||
import org.bukkit.event.inventory.FurnaceSmeltEvent;
|
import org.bukkit.event.inventory.FurnaceSmeltEvent;
|
||||||
import org.bukkit.event.world.ChunkLoadEvent;
|
import org.bukkit.event.world.ChunkLoadEvent;
|
||||||
import org.bukkit.plugin.EventExecutor;
|
import org.bukkit.plugin.EventExecutor;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
import org.bukkit.util.FileUtil;
|
||||||
|
import org.bukkit.util.StringUtil;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Enumeration;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
public abstract class ChunkListener implements Listener {
|
public abstract class ChunkListener implements Listener {
|
||||||
|
|
||||||
@ -56,7 +68,9 @@ public abstract class ChunkListener implements Listener {
|
|||||||
public ChunkListener() {
|
public ChunkListener() {
|
||||||
if (Settings.IMP.TICK_LIMITER.ENABLED) {
|
if (Settings.IMP.TICK_LIMITER.ENABLED) {
|
||||||
PluginManager plm = Bukkit.getPluginManager();
|
PluginManager plm = Bukkit.getPluginManager();
|
||||||
BukkitMain plugin = Fawe.<FaweBukkit>imp().getPlugin();
|
Plugin plugin = Fawe.<FaweBukkit>imp().getPlugin();
|
||||||
|
plm.registerEvents(this, plugin);
|
||||||
|
try { plm.registerEvents(new ChunkListener_8Plus(this), plugin); } catch (Throwable ignore) {}
|
||||||
for (Method method : this.getClass().getMethods()) {
|
for (Method method : this.getClass().getMethods()) {
|
||||||
if (method.isAnnotationPresent(EventHandler.class)) {
|
if (method.isAnnotationPresent(EventHandler.class)) {
|
||||||
try {
|
try {
|
||||||
@ -138,7 +152,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;
|
||||||
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user