chore: remove firework-chunk-loading prevention and default tick limiter to false (#2234)

- It's very resource-intensive and probably doesn't work anyway
 - Tick limiter should not be enabled by default, it confuses a lot of people with the console logs
Dieser Commit ist enthalten in:
Jordan 2023-05-20 15:25:24 +01:00 committet von GitHub
Ursprung e9b781d127
Commit 3a13c4aaa7
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 1 neuen und 49 gelöschten Zeilen

Datei anzeigen

@ -371,48 +371,6 @@ public abstract class ChunkListener implements Listener {
} }
} }
/**
* Prevent firework from loading chunks.
*/
@EventHandler(priority = EventPriority.LOWEST)
public void onChunkLoad(ChunkLoadEvent event) {
if (!Settings.settings().TICK_LIMITER.FIREWORKS_LOAD_CHUNKS) {
Chunk chunk = event.getChunk();
Entity[] entities = chunk.getEntities();
World world = chunk.getWorld();
Exception e = new Exception();
int start = 14;
int end = 22;
int depth = Math.min(end, getDepth(e));
for (int frame = start; frame < depth; frame++) {
StackTraceElement elem = getElement(e, frame);
if (elem == null) {
return;
}
String className = elem.getClassName();
int len = className.length();
if (len > 15 && className.charAt(len - 15) == 'E' && className
.endsWith("EntityFireworks")) {
for (Entity ent : world.getEntities()) {
if (ent.getType() == EntityType.FIREWORK) {
Vector velocity = ent.getVelocity();
double vertical = Math.abs(velocity.getY());
if (Math.abs(velocity.getX()) > vertical
|| Math.abs(velocity.getZ()) > vertical) {
LOGGER.warn(
"[FAWE `tick-limiter`] Detected and cancelled rogue FireWork at {}",
ent.getLocation());
ent.remove();
}
}
}
}
}
}
}
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
public void onItemSpawn(ItemSpawnEvent event) { public void onItemSpawn(ItemSpawnEvent event) {
if (physicsFreeze) { if (physicsFreeze) {

Datei anzeigen

@ -695,7 +695,7 @@ public class Settings extends Config {
public static class TICK_LIMITER { public static class TICK_LIMITER {
@Comment("Enable the limiter") @Comment("Enable the limiter")
public boolean ENABLED = true; public boolean ENABLED = false;
@Comment("The interval in ticks") @Comment("The interval in ticks")
public int INTERVAL = 20; public int INTERVAL = 20;
@Comment("Max falling blocks per interval (per chunk)") @Comment("Max falling blocks per interval (per chunk)")
@ -704,12 +704,6 @@ public class Settings extends Config {
public int PHYSICS_MS = 10; public int PHYSICS_MS = 10;
@Comment("Max item spawns per interval (per chunk)") @Comment("Max item spawns per interval (per chunk)")
public int ITEMS = 256; public int ITEMS = 256;
@Comment({
"Whether fireworks can load chunks",
" - Fireworks usually travel vertically so do not load any chunks",
" - Horizontal fireworks can be hacked in to crash a server"
})
public boolean FIREWORKS_LOAD_CHUNKS = false;
} }