mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-05 12:02:53 +00:00
Avoid using ServerListPingEvent workaround on fixed Paper builds (#1925)
Fixes #1924 PaperMC/Paper#884 has been fixed in recent Paper builds (1368+), which means the workaround is no longer necessary. Disable it when running a fixed build.
This commit is contained in:
parent
61c1485083
commit
ecd6c5f81a
1 changed files with 13 additions and 8 deletions
|
@ -25,15 +25,20 @@ public class EssentialsServerListener implements Listener {
|
||||||
|
|
||||||
public EssentialsServerListener(final IEssentials ess) {
|
public EssentialsServerListener(final IEssentials ess) {
|
||||||
this.ess = ess;
|
this.ess = ess;
|
||||||
setSampleText = ReflUtil.getMethodCached(ServerListPingEvent.class, "setSampleText", List.class);
|
|
||||||
getSampleText = ReflUtil.getMethodCached(ServerListPingEvent.class, "getSampleText");
|
if (ReflUtil.getClassCached("com.destroystokyo.paper.event.server.PaperServerListPingEvent") == null) {
|
||||||
if (setSampleText != null && getSampleText != null) {
|
// This workaround is only necessary for older Paper builds
|
||||||
ess.getLogger().info("Using Paper 1.12+ ServerListPingEvent methods");
|
setSampleText = ReflUtil.getMethodCached(ServerListPingEvent.class, "setSampleText", List.class);
|
||||||
isPaperSample = true;
|
getSampleText = ReflUtil.getMethodCached(ServerListPingEvent.class, "getSampleText");
|
||||||
} else {
|
if (setSampleText != null && getSampleText != null) {
|
||||||
ess.getLogger().info("Using Spigot 1.7.10+ ServerListPingEvent iterator");
|
ess.getLogger().info("Using Paper 1.12+ ServerListPingEvent methods");
|
||||||
isPaperSample = false;
|
isPaperSample = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ess.getLogger().info("Using Spigot 1.7.10+ ServerListPingEvent iterator");
|
||||||
|
isPaperSample = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue