This commit is contained in:
Jesse Boyd 2018-01-07 23:47:47 +11:00
parent e1e31beff0
commit bb7b1cb736
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F

View File

@ -31,14 +31,6 @@ public class ChunkListener implements Listener {
public ChunkListener() { public ChunkListener() {
if (Settings.IMP.TICK_LIMITER.ENABLED) { if (Settings.IMP.TICK_LIMITER.ENABLED) {
Bukkit.getPluginManager().registerEvents(ChunkListener.this, Fawe.<FaweBukkit>imp().getPlugin()); Bukkit.getPluginManager().registerEvents(ChunkListener.this, Fawe.<FaweBukkit>imp().getPlugin());
TaskManager.IMP.repeat(new Runnable() {
@Override
public void run() {
physSkip = 0;
physCancelPair = Long.MIN_VALUE;
physCancel = false;
}
}, 1);
TaskManager.IMP.repeat(new Runnable() { TaskManager.IMP.repeat(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -46,6 +38,9 @@ public class ChunkListener implements Listener {
physicsFreeze = false; physicsFreeze = false;
itemFreeze = false; itemFreeze = false;
lastZ = Integer.MIN_VALUE; lastZ = Integer.MIN_VALUE;
physSkip = 0;
physCancelPair = Long.MIN_VALUE;
physCancel = false;
counter.clear(); counter.clear();
for (Long2ObjectMap.Entry<Boolean> entry : badChunks.long2ObjectEntrySet()) { for (Long2ObjectMap.Entry<Boolean> entry : badChunks.long2ObjectEntrySet()) {
@ -211,21 +206,24 @@ public class ChunkListener implements Listener {
for (int frame = start; frame < depth; frame++) { for (int frame = start; frame < depth; frame++) {
StackTraceElement elem = SharedSecrets.getJavaLangAccess().getStackTraceElement(e, frame); StackTraceElement elem = SharedSecrets.getJavaLangAccess().getStackTraceElement(e, frame);
String fileName = elem.getFileName(); String className = elem.getClassName();
if (fileName.charAt(0) == 'E' && fileName.equals("EntityFireworks.java")) { int len = className.length();
int chunkRange = 2; if (className != null) {
for (int ocx = -chunkRange; ocx <= chunkRange; ocx++) { if (className.charAt(len - 15) == 'E' && className.endsWith("EntityFireworks")) {
for (int ocz = -chunkRange; ocz <= chunkRange; ocz++) { int chunkRange = 2;
int cx = chunk.getX() + ocx; for (int ocx = -chunkRange; ocx <= chunkRange; ocx++) {
int cz = chunk.getZ() + ocz; for (int ocz = -chunkRange; ocz <= chunkRange; ocz++) {
if (world.isChunkLoaded(cx, cz)) { int cx = chunk.getX() + ocx;
Chunk relativeChunk = world.getChunkAt(cx, cz); int cz = chunk.getZ() + ocz;
Entity[] ents = relativeChunk.getEntities(); if (world.isChunkLoaded(cx, cz)) {
for (Entity ent : ents) { Chunk relativeChunk = world.getChunkAt(cx, cz);
switch (ent.getType()) { Entity[] ents = relativeChunk.getEntities();
case FIREWORK: for (Entity ent : ents) {
Fawe.debug("[FAWE `tick-limiter`] Detected and cancelled rogue FireWork at " + ent.getLocation()); switch (ent.getType()) {
ent.remove(); case FIREWORK:
Fawe.debug("[FAWE `tick-limiter`] Detected and cancelled rogue FireWork at " + ent.getLocation());
ent.remove();
}
} }
} }
} }