mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 17:18:37 +01:00
Fix LocationUtil#getSafeDestination NSME on older versions (#4708)
Fixes a NoSuchMethodError from old guava versions in old MC versions. Fixes #4703
This commit is contained in:
parent
685084219e
commit
84326cf13e
@ -1,7 +1,6 @@
|
|||||||
package com.earth2me.essentials.utils;
|
package com.earth2me.essentials.utils;
|
||||||
|
|
||||||
import com.earth2me.essentials.IEssentials;
|
import com.earth2me.essentials.IEssentials;
|
||||||
import com.google.common.primitives.Ints;
|
|
||||||
import net.ess3.api.IUser;
|
import net.ess3.api.IUser;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -232,12 +231,12 @@ public final class LocationUtil {
|
|||||||
i++;
|
i++;
|
||||||
if (i >= VOLUME.length) {
|
if (i >= VOLUME.length) {
|
||||||
x = origX;
|
x = origX;
|
||||||
y = Ints.constrainToRange(origY + RADIUS, worldMinY, worldMaxY);
|
y = NumberUtil.constrainToRange(origY + RADIUS, worldMinY, worldMaxY);
|
||||||
z = origZ;
|
z = origZ;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
x = origX + VOLUME[i].x;
|
x = origX + VOLUME[i].x;
|
||||||
y = Ints.constrainToRange(origY + VOLUME[i].y, worldMinY, worldMaxY);
|
y = NumberUtil.constrainToRange(origY + VOLUME[i].y, worldMinY, worldMaxY);
|
||||||
z = origZ + VOLUME[i].z;
|
z = origZ + VOLUME[i].z;
|
||||||
}
|
}
|
||||||
while (isBlockUnsafe(ess, world, x, y, z)) {
|
while (isBlockUnsafe(ess, world, x, y, z)) {
|
||||||
|
@ -119,4 +119,11 @@ public final class NumberUtil {
|
|||||||
}
|
}
|
||||||
return Integer.parseInt(sInt) > 0;
|
return Integer.parseInt(sInt) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Backport from Guava.
|
||||||
|
*/
|
||||||
|
public static int constrainToRange(int value, int min, int max) {
|
||||||
|
return Math.min(Math.max(value, min), max);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user