This commit is contained in:
RayzsYT committed 2024-05-19 17:33:41 +02:00
1 parent 714b1f22aa
commit 68df73ff36
2 files changed
+6 -9

No files matched your search

@@ -24,13 +24,13 @@ public class BukkitServerBrand implements ServerBrand {
private static final Server SERVER = Bukkit.getServer();
private static String BRAND = "";
private static int TASK = -1;
private static boolean INITIALIZED = false, WEIRD = Reflection.getMinor() == 20 && Reflection.getRelease() >= 6 || Reflection.getMinor() >= 20;;
private static boolean INITIALIZED = false;
private static Class<?> brandPayloadClass, clientBoundCustomPacketPayloadPacketClass, customPacketPayloadPacketClass;
@Override
public void initializeTask() {
if(WEIRD) {
if(Reflection.isWeird()) {
if (brandPayloadClass == null)
brandPayloadClass = Reflection.getClass("net.minecraft.network.protocol.common.custom.BrandPayload");
@@ -90,7 +90,7 @@ public class BukkitServerBrand implements ServerBrand {
String playerName = player.getName(), displayName = player.getDisplayName(), worldName = player.getWorld().getName(),
customBrand = BRAND.replace("%player%", playerName).replace("%displayname%", displayName).replace("%world%", worldName);
if(!WEIRD) {
if(!Reflection.isWeird()) {
PacketUtils.BrandManipulate serverBrand = new PacketUtils.BrandManipulate(MessageTranslator.replaceMessage(player, customBrand));
player.sendPluginMessage(BukkitLoader.getPlugin(), CustomServerBrand.CHANNEL_NAME, serverBrand.getBytes());
return;
@@ -34,10 +34,7 @@ public class ModernPacketHandler implements PacketHandler {
return false;
}
boolean cancelsBeforeHand = false,
// 1.20.6 support coming soon bcs it's to annoying to work with on packet-base rn
weird = Reflection.getMinor() == 20 && Reflection.getRelease() >= 6 || Reflection.getMinor() >= 20;
boolean cancelsBeforeHand = false;
if(input.startsWith("/")) {
input = input.replace("/", "");
String[] split = input.split(" ");
@@ -48,12 +45,12 @@ public class ModernPacketHandler implements PacketHandler {
}
Suggestions suggestions = (Suggestions) suggestionsMethod.invoke(packetObj);
if(input.length() < 1 && weird || cancelsBeforeHand && weird)
if(input.length() < 1 && Reflection.isWeird() || cancelsBeforeHand && Reflection.isWeird())
return false;
else if(cancelsBeforeHand)
suggestions.getList().clear();
else {
if(weird) return true;
if(Reflection.isWeird()) return true;
suggestions.getList().removeIf(suggestion -> {
String command = suggestion.getText();