Remove affinitylock + fix enderpearl error

This commit is contained in:
Beaness 2022-08-03 16:44:32 +02:00
parent fbdfac6a23
commit 06a2975376
3 changed files with 2 additions and 17 deletions

View File

@ -49,7 +49,6 @@ dependencies {
implementation("com.velocitypowered:velocity-native:1.1.0-SNAPSHOT") implementation("com.velocitypowered:velocity-native:1.1.0-SNAPSHOT")
implementation("org.lz4:lz4-java:1.8.0") implementation("org.lz4:lz4-java:1.8.0")
implementation("com.github.luben:zstd-jni:1.5.2-3") implementation("com.github.luben:zstd-jni:1.5.2-3")
implementation("net.openhft:affinity:3.20.0")
implementation("net.jafama:jafama:2.3.2") implementation("net.jafama:jafama:2.3.2")
implementation("com.eatthepath:fast-uuid:0.2.0") implementation("com.eatthepath:fast-uuid:0.2.0")

View File

@ -114,7 +114,7 @@ public class EntityEnderPearl extends EntityProjectile {
if (entityliving instanceof EntityPlayer) { if (entityliving instanceof EntityPlayer) {
final EntityPlayer entityplayer = (EntityPlayer)entityliving; final EntityPlayer entityplayer = (EntityPlayer)entityliving;
if (entityplayer.playerConnection.a().g() && entityplayer.world == this.world && !entityplayer.isSleeping()) { if (entityplayer.playerConnection.a().g() && entityplayer.world == this.world && !entityplayer.isSleeping() && entityplayer.getBukkitEntity() != null && entityplayer.getBukkitEntity().isOnline()) {
if (teleportLocation != null) { if (teleportLocation != null) {
CraftPlayer player = entityplayer.getBukkitEntity(); CraftPlayer player = entityplayer.getBukkitEntity();
Location previousLocation = player.getLocation(); Location previousLocation = player.getLocation();

View File

@ -22,7 +22,6 @@ import io.netty.util.ResourceLeakDetector;
import joptsimple.OptionSet; import joptsimple.OptionSet;
import com.elevatemc.spigot.eSpigot; import com.elevatemc.spigot.eSpigot;
import net.minecrell.terminalconsole.TerminalConsoleAppender; import net.minecrell.terminalconsole.TerminalConsoleAppender;
import net.openhft.affinity.AffinityLock;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -714,14 +713,9 @@ public abstract class MinecraftServer extends ReentrantIAsyncHandler<TasksPerTic
} }
// PandaSpigot end // PandaSpigot end
public void run() { public void run() {
AffinityLock affinityLock = null; try {
try (final AffinityLock lock = AffinityLock.acquireLock()) {
this.serverStartTime = getNanos(); this.serverStartTime = getNanos();
if (this.init()) { if (this.init()) {
// eSpigot start - Thread affinity
MinecraftServer.LOGGER.info("[eSpigot] Locked main thread. CPU: " + lock.cpuId());
affinityLock = lock;
// eSpigot end // eSpigot end
this.ab = az(); this.ab = az();
@ -805,14 +799,6 @@ public abstract class MinecraftServer extends ReentrantIAsyncHandler<TasksPerTic
this.a(crashreport); this.a(crashreport);
} finally { } finally {
// eSpigot start - Thread affinity
MinecraftServer.LOGGER.info("[eSpigot] " + (affinityLock == null ?
"Didn't release affinity lock since it does not exist." : "Released affinity lock."));
if (affinityLock != null)
affinityLock.release();
// eSpigot end
try { try {
org.spigotmc.WatchdogThread.doStop(); org.spigotmc.WatchdogThread.doStop();
this.isStopped = true; this.isStopped = true;