mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-02 20:45:28 +02:00
Fix Hex-Colored names in parties/admin chat
This commit is contained in:
@@ -2,7 +2,9 @@ package com.gmail.nossr50.util.compat;
|
||||
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.compat.layers.attackcooldown.PlayerAttackCooldownExploitPreventionLayer;
|
||||
import com.gmail.nossr50.util.compat.layers.bungee.AbstractBungeeSerializerCompatibilityLayer;
|
||||
import com.gmail.nossr50.util.compat.layers.bungee.BungeeLegacySerializerCompatibilityLayer;
|
||||
import com.gmail.nossr50.util.compat.layers.bungee.BungeeModernSerializerCompatibilityLayer;
|
||||
import com.gmail.nossr50.util.compat.layers.persistentdata.AbstractPersistentDataLayer;
|
||||
import com.gmail.nossr50.util.compat.layers.persistentdata.SpigotPersistentDataLayer_1_13;
|
||||
import com.gmail.nossr50.util.compat.layers.persistentdata.SpigotPersistentDataLayer_1_14;
|
||||
@@ -26,8 +28,9 @@ public class CompatibilityManager {
|
||||
private final NMSVersion nmsVersion;
|
||||
|
||||
/* Compatibility Layers */
|
||||
private PlayerAttackCooldownExploitPreventionLayer playerAttackCooldownExploitPreventionLayer;
|
||||
// private PlayerAttackCooldownExploitPreventionLayer playerAttackCooldownExploitPreventionLayer;
|
||||
private AbstractPersistentDataLayer persistentDataLayer;
|
||||
private AbstractBungeeSerializerCompatibilityLayer bungeeSerializerCompatibilityLayer;
|
||||
|
||||
public CompatibilityManager(MinecraftGameVersion minecraftGameVersion) {
|
||||
mcMMO.p.getLogger().info("Loading compatibility layers...");
|
||||
@@ -60,10 +63,19 @@ public class CompatibilityManager {
|
||||
*/
|
||||
private void initCompatibilityLayers() {
|
||||
initPersistentDataLayer();
|
||||
initBungeeSerializerLayer();
|
||||
|
||||
isFullyCompatibleServerSoftware = true;
|
||||
}
|
||||
|
||||
private void initBungeeSerializerLayer() {
|
||||
if(minecraftGameVersion.getMinorVersion().asInt() >= 16) {
|
||||
bungeeSerializerCompatibilityLayer = new BungeeModernSerializerCompatibilityLayer();
|
||||
} else {
|
||||
bungeeSerializerCompatibilityLayer = new BungeeLegacySerializerCompatibilityLayer();
|
||||
}
|
||||
}
|
||||
|
||||
private void initPersistentDataLayer() {
|
||||
if(minecraftGameVersion.getMinorVersion().asInt() >= 14 || minecraftGameVersion.getMajorVersion().asInt() >= 2) {
|
||||
|
||||
@@ -133,8 +145,13 @@ public class CompatibilityManager {
|
||||
return NMSVersion.UNSUPPORTED;
|
||||
}
|
||||
|
||||
public PlayerAttackCooldownExploitPreventionLayer getPlayerAttackCooldownExploitPreventionLayer() {
|
||||
return playerAttackCooldownExploitPreventionLayer;
|
||||
// public PlayerAttackCooldownExploitPreventionLayer getPlayerAttackCooldownExploitPreventionLayer() {
|
||||
// return playerAttackCooldownExploitPreventionLayer;
|
||||
// }
|
||||
|
||||
|
||||
public AbstractBungeeSerializerCompatibilityLayer getBungeeSerializerCompatibilityLayer() {
|
||||
return bungeeSerializerCompatibilityLayer;
|
||||
}
|
||||
|
||||
public AbstractPersistentDataLayer getPersistentDataLayer() {
|
||||
|
@@ -2,5 +2,6 @@ package com.gmail.nossr50.util.compat;
|
||||
|
||||
public enum CompatibilityType {
|
||||
PLAYER_ATTACK_COOLDOWN_EXPLOIT_PREVENTION,
|
||||
PERSISTENT_DATA
|
||||
PERSISTENT_DATA,
|
||||
BUNGEE_SERIALIZER
|
||||
}
|
||||
|
@@ -0,0 +1,11 @@
|
||||
package com.gmail.nossr50.util.compat.layers.bungee;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public abstract class AbstractBungeeSerializerCompatibilityLayer {
|
||||
|
||||
public abstract @NonNull Component deserialize(final @NonNull BaseComponent @NonNull[] input);
|
||||
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
package com.gmail.nossr50.util.compat.layers.bungee;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.bungeecord.BungeeComponentSerializer;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class BungeeLegacySerializerCompatibilityLayer extends AbstractBungeeSerializerCompatibilityLayer {
|
||||
@Override
|
||||
public @NonNull Component deserialize(@NonNull BaseComponent @NonNull [] input) {
|
||||
return BungeeComponentSerializer.legacy().deserialize(input);
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
package com.gmail.nossr50.util.compat.layers.bungee;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.bungeecord.BungeeComponentSerializer;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class BungeeModernSerializerCompatibilityLayer extends AbstractBungeeSerializerCompatibilityLayer {
|
||||
@Override
|
||||
public @NonNull Component deserialize(@NonNull BaseComponent @NonNull [] input) {
|
||||
return BungeeComponentSerializer.get().deserialize(input);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user