geforkt von Mirrors/FastAsyncWorldEdit
Upstream is better than downstream
Dieser Commit ist enthalten in:
Ursprung
86539c1758
Commit
647665c3b0
@ -37,7 +37,7 @@ public class BrushListener implements Listener {
|
|||||||
final int slot = event.getNewSlot();
|
final int slot = event.getNewSlot();
|
||||||
final int oldSlot = event.getPreviousSlot();
|
final int oldSlot = event.getPreviousSlot();
|
||||||
final int ri;
|
final int ri;
|
||||||
if ((((slot - oldSlot) <= 4) && ((slot - oldSlot) > 0)) || (((slot - oldSlot) < -4))) {
|
if ((((slot - oldSlot) <= 4) && ((slot - oldSlot) > 0)) || ((slot - oldSlot) < -4)) {
|
||||||
ri = 1;
|
ri = 1;
|
||||||
} else {
|
} else {
|
||||||
ri = -1;
|
ri = -1;
|
||||||
|
@ -43,9 +43,11 @@ import org.bukkit.event.world.ChunkLoadEvent;
|
|||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
public abstract class ChunkListener implements Listener {
|
public abstract class ChunkListener implements Listener {
|
||||||
|
|
||||||
|
private final Logger logger = getLogger(ChunkListener.class);
|
||||||
protected int rateLimit = 0;
|
protected int rateLimit = 0;
|
||||||
protected Location lastCancelPos;
|
protected Location lastCancelPos;
|
||||||
private int[] badLimit = new int[]{Settings.IMP.TICK_LIMITER.PHYSICS_MS,
|
private int[] badLimit = new int[]{Settings.IMP.TICK_LIMITER.PHYSICS_MS,
|
||||||
@ -63,7 +65,7 @@ public abstract class ChunkListener implements Listener {
|
|||||||
TaskManager.IMP.repeat(() -> {
|
TaskManager.IMP.repeat(() -> {
|
||||||
Location tmpLoc = lastCancelPos;
|
Location tmpLoc = lastCancelPos;
|
||||||
if (tmpLoc != null) {
|
if (tmpLoc != null) {
|
||||||
getLogger(ChunkListener.class).debug("[FAWE `tick-limiter`] Detected and cancelled physics lag source at "
|
logger.debug("[FAWE Tick Limiter] Detected and cancelled physics lag source at "
|
||||||
+ tmpLoc);
|
+ tmpLoc);
|
||||||
}
|
}
|
||||||
rateLimit--;
|
rateLimit--;
|
||||||
@ -186,15 +188,6 @@ public abstract class ChunkListener implements Listener {
|
|||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
// @EventHandler(priority = EventPriority.LOWEST)
|
|
||||||
// public void event(BrewEvent event) { reset(); }
|
|
||||||
//
|
|
||||||
// @EventHandler(priority = EventPriority.LOWEST)
|
|
||||||
// public void event(BrewingStandFuelEvent event) { reset(); }
|
|
||||||
//
|
|
||||||
// @EventHandler(priority = EventPriority.LOWEST)
|
|
||||||
// public void event(CauldronLevelChangeEvent event ) { reset(); }
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void event(FurnaceBurnEvent event) {
|
public void event(FurnaceBurnEvent event) {
|
||||||
reset();
|
reset();
|
||||||
@ -392,7 +385,7 @@ public abstract class ChunkListener implements Listener {
|
|||||||
double vertical = Math.abs(velocity.getY());
|
double vertical = Math.abs(velocity.getY());
|
||||||
if (Math.abs(velocity.getX()) > vertical
|
if (Math.abs(velocity.getX()) > vertical
|
||||||
|| Math.abs(velocity.getZ()) > vertical) {
|
|| Math.abs(velocity.getZ()) > vertical) {
|
||||||
getLogger(ChunkListener.class).warn(
|
logger.warn(
|
||||||
"[FAWE `tick-limiter`] Detected and cancelled rogue FireWork at "
|
"[FAWE `tick-limiter`] Detected and cancelled rogue FireWork at "
|
||||||
+ ent.getLocation());
|
+ ent.getLocation());
|
||||||
ent.remove();
|
ent.remove();
|
||||||
@ -423,7 +416,7 @@ public abstract class ChunkListener implements Listener {
|
|||||||
cancelNearby(cx, cz);
|
cancelNearby(cx, cz);
|
||||||
if (rateLimit <= 0) {
|
if (rateLimit <= 0) {
|
||||||
rateLimit = 20;
|
rateLimit = 20;
|
||||||
getLogger(ChunkListener.class).warn(
|
logger.warn(
|
||||||
"[FAWE `tick-limiter`] Detected and cancelled item lag source at " + loc);
|
"[FAWE `tick-limiter`] Detected and cancelled item lag source at " + loc);
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -1,71 +0,0 @@
|
|||||||
package com.sk89q.worldedit.math;
|
|
||||||
|
|
||||||
public class MutableVector2 extends Vector2 {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Construct an instance.
|
|
||||||
*
|
|
||||||
* @param x the X coordinate
|
|
||||||
* @param z the Z coordinate
|
|
||||||
*/
|
|
||||||
public MutableVector2(double x, double z) {
|
|
||||||
super(x, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Construct an instance.
|
|
||||||
*
|
|
||||||
* @param x the X coordinate
|
|
||||||
* @param z the Z coordinate
|
|
||||||
*/
|
|
||||||
public MutableVector2(float x, float z) {
|
|
||||||
super(x, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy another vector.
|
|
||||||
*
|
|
||||||
* @param other the other vector
|
|
||||||
*/
|
|
||||||
public MutableVector2(Vector2 other) {
|
|
||||||
super(other);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MutableVector2 setComponents(int x, int z) {
|
|
||||||
this.x = x;
|
|
||||||
this.z = z;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MutableVector2 setComponents(double x, double z) {
|
|
||||||
this.x = x;
|
|
||||||
this.z = z;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MutableVector2 mutX(int x) {
|
|
||||||
this.x = x;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MutableVector2 mutZ(int z) {
|
|
||||||
this.z = z;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MutableVector2 mutX(double x) {
|
|
||||||
this.x = x;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MutableVector2 mutZ(double z) {
|
|
||||||
this.z = z;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
@ -19,13 +19,12 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.math;
|
package com.sk89q.worldedit.math;
|
||||||
|
|
||||||
import com.boydti.fawe.util.MathMan;
|
|
||||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An immutable 2-dimensional vector.
|
* An immutable 2-dimensional vector.
|
||||||
*/
|
*/
|
||||||
public class Vector2 {
|
public final class Vector2 {
|
||||||
|
|
||||||
public static final Vector2 ZERO = new Vector2(0, 0);
|
public static final Vector2 ZERO = new Vector2(0, 0);
|
||||||
public static final Vector2 UNIT_X = new Vector2(1, 0);
|
public static final Vector2 UNIT_X = new Vector2(1, 0);
|
||||||
@ -33,7 +32,6 @@ public class Vector2 {
|
|||||||
public static final Vector2 ONE = new Vector2(1, 1);
|
public static final Vector2 ONE = new Vector2(1, 1);
|
||||||
|
|
||||||
public static Vector2 at(double x, double z) {
|
public static Vector2 at(double x, double z) {
|
||||||
/* Unnecessary
|
|
||||||
int xTrunc = (int) x;
|
int xTrunc = (int) x;
|
||||||
switch (xTrunc) {
|
switch (xTrunc) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -47,11 +45,10 @@ public class Vector2 {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
return new Vector2(x, z);
|
return new Vector2(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected double x, z;
|
private final double x, z;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct an instance.
|
* Construct an instance.
|
||||||
@ -59,48 +56,11 @@ public class Vector2 {
|
|||||||
* @param x the X coordinate
|
* @param x the X coordinate
|
||||||
* @param z the Z coordinate
|
* @param z the Z coordinate
|
||||||
*/
|
*/
|
||||||
protected Vector2(double x, double z) {
|
private Vector2(double x, double z) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.z = z;
|
this.z = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Vector2(Vector2 other) {
|
|
||||||
this.x = other.x;
|
|
||||||
this.z = other.z;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getBlockX() {
|
|
||||||
return MathMan.roundInt(getX());
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getBlockZ() {
|
|
||||||
return MathMan.roundInt(getZ());
|
|
||||||
}
|
|
||||||
|
|
||||||
public MutableVector2 setComponents(int x, int z) {
|
|
||||||
return new MutableVector2(x, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MutableVector2 setComponents(double x, double z) {
|
|
||||||
return new MutableVector2(x, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MutableVector2 mutX(int x) {
|
|
||||||
return new MutableVector2(x, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MutableVector2 mutZ(int z) {
|
|
||||||
return new MutableVector2(x, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MutableVector2 mutX(double x) {
|
|
||||||
return new MutableVector2(x, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MutableVector2 mutZ(double z) {
|
|
||||||
return new MutableVector2(x, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the X coordinate.
|
* Get the X coordinate.
|
||||||
*
|
*
|
||||||
@ -458,7 +418,7 @@ public class Vector2 {
|
|||||||
Math.max(z, v2.z)
|
Math.max(z, v2.z)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockVector2 toBlockPoint(double x, double z) {
|
public static BlockVector2 toBlockPoint(double x, double z) {
|
||||||
return BlockVector2.at(x, z);
|
return BlockVector2.at(x, z);
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren