Compare commits

...

4 Commits

Author SHA1 Message Date
Matvei Slotvinskiy 550b33c65b
Merge 94de2e79cd into 563df95561 2024-01-27 13:17:37 +01:00
filoghost 563df95561 Attempt to fix packet injector issues 2024-01-27 11:15:30 +01:00
Spongecade 3f067145b7 Update Minecraft wiki link to new domain 2024-01-26 22:48:48 +01:00
Matvei Slotvinskiy 94de2e79cd Fixed the display of holograms when View-distance is 1 2023-12-16 01:16:13 +05:00
20 changed files with 236 additions and 38 deletions

View File

@ -93,7 +93,7 @@ public class TickingTask implements Runnable {
}
// Holograms need to disappear before chunks (code taken from Bukkit)
int maxViewRange = (Bukkit.getViewDistance() - 1) * 16;
int maxViewRange = Math.max((Bukkit.getViewDistance() - 1),1) * 16;
if (maxViewRange > CoreGlobalConfig.maxViewRange) {
maxViewRange = CoreGlobalConfig.maxViewRange;
}

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_10_R1;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField;
@ -115,8 +116,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection;
NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.channel;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> {
Runnable safeModifierTask = () -> {
if (!player.isOnline()) {
return;
}
@ -125,7 +130,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
}
});
};
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
}
}

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_11_R1;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField;
@ -115,8 +116,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection;
NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.channel;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> {
Runnable safeModifierTask = () -> {
if (!player.isOnline()) {
return;
}
@ -125,7 +130,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
}
});
};
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
}
}

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_12_R1;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField;
@ -115,8 +116,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection;
NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.channel;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> {
Runnable safeModifierTask = () -> {
if (!player.isOnline()) {
return;
}
@ -125,7 +130,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
}
});
};
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
}
}

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_13_R2;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField;
@ -115,8 +116,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection;
NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.channel;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> {
Runnable safeModifierTask = () -> {
if (!player.isOnline()) {
return;
}
@ -125,7 +130,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
}
});
};
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
}
}

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_14_R1;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField;
@ -100,8 +101,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection;
NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.channel;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> {
Runnable safeModifierTask = () -> {
if (!player.isOnline()) {
return;
}
@ -110,7 +115,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
}
});
};
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
}
}

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_15_R1;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField;
@ -100,8 +101,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection;
NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.channel;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> {
Runnable safeModifierTask = () -> {
if (!player.isOnline()) {
return;
}
@ -110,7 +115,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
}
});
};
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
}
}

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_16_R3;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField;
@ -100,8 +101,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection;
NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.channel;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> {
Runnable safeModifierTask = () -> {
if (!player.isOnline()) {
return;
}
@ -110,7 +115,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
}
});
};
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
}
}

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_17_R1;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField;
@ -99,8 +100,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().b;
NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.k;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> {
Runnable safeModifierTask = () -> {
if (!player.isOnline()) {
return;
}
@ -109,7 +114,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
}
});
};
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
}
}

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_18_R1;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField;
@ -99,8 +100,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().b;
NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.k;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> {
Runnable safeModifierTask = () -> {
if (!player.isOnline()) {
return;
}
@ -109,7 +114,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
}
});
};
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
}
}

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_18_R2;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField;
@ -99,8 +100,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().b;
NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.m;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> {
Runnable safeModifierTask = () -> {
if (!player.isOnline()) {
return;
}
@ -109,7 +114,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
}
});
};
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
}
}

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_19_R1;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField;
@ -99,8 +100,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().b;
NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.m;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> {
Runnable safeModifierTask = () -> {
if (!player.isOnline()) {
return;
}
@ -109,7 +114,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
}
});
};
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
}
}

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_19_R2;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField;
@ -99,8 +100,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().b;
NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.m;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> {
Runnable safeModifierTask = () -> {
if (!player.isOnline()) {
return;
}
@ -109,7 +114,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
}
});
};
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
}
}

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_19_R3;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField;
@ -106,8 +107,12 @@ public class VersionNMSManager implements NMSManager {
return;
}
Channel channel = networkManager.m;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> {
Runnable safeModifierTask = () -> {
if (!player.isOnline()) {
return;
}
@ -116,7 +121,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
}
});
};
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
}
}

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_20_R1;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField;
@ -106,8 +107,12 @@ public class VersionNMSManager implements NMSManager {
return;
}
Channel channel = networkManager.m;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> {
Runnable safeModifierTask = () -> {
if (!player.isOnline()) {
return;
}
@ -116,7 +121,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
}
});
};
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
}
}

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_20_R2;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField;
@ -107,8 +108,12 @@ public class VersionNMSManager implements NMSManager {
return;
}
Channel channel = networkManager.n;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> {
Runnable safeModifierTask = () -> {
if (!player.isOnline()) {
return;
}
@ -117,7 +122,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
}
});
};
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
}
}

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_20_R3;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField;
@ -107,8 +108,12 @@ public class VersionNMSManager implements NMSManager {
return;
}
Channel channel = networkManager.n;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> {
Runnable safeModifierTask = () -> {
if (!player.isOnline()) {
return;
}
@ -117,7 +122,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
}
});
};
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
}
}

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_8_R3;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField;
@ -112,8 +113,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection;
NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.channel;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> {
Runnable safeModifierTask = () -> {
if (!player.isOnline()) {
return;
}
@ -122,7 +127,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
}
});
};
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
}
}

View File

@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.nms.v1_9_R2;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import me.filoghost.fcommons.logging.ErrorCollector;
import me.filoghost.fcommons.logging.Log;
import me.filoghost.fcommons.reflection.ReflectField;
@ -115,8 +116,12 @@ public class VersionNMSManager implements NMSManager {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection;
NetworkManager networkManager = playerConnection.a();
Channel channel = networkManager.channel;
if (channel == null) {
return;
}
EventLoop eventLoop = channel.eventLoop();
channel.eventLoop().execute(() -> {
Runnable safeModifierTask = () -> {
if (!player.isOnline()) {
return;
}
@ -125,7 +130,13 @@ public class VersionNMSManager implements NMSManager {
} catch (Exception e) {
Log.warning(NMSErrors.EXCEPTION_MODIFYING_CHANNEL_PIPELINE, e);
}
});
};
if (eventLoop.inEventLoop()) {
safeModifierTask.run();
} else {
eventLoop.execute(safeModifierTask);
}
}
}

View File

@ -15,7 +15,7 @@ package me.filoghost.holographicdisplays.plugin.lib.nbt;
* </p>
* <p>
* For a community maintained documentation of the NBT format and its types, visit the
* <a href=https://minecraft.gamepedia.com/NBT_format>Minecraft Wiki</a>
* <a href=https://minecraft.wiki/w/NBT_format>Minecraft Wiki</a>
* </p>
*/
public enum NBTType {