From 76be4a4d68a691566debd61c8d225a1a0bc442fb Mon Sep 17 00:00:00 2001 From: FlorianMichael <60033407+FlorianMichael@users.noreply.github.com> Date: Sun, 8 Oct 2023 10:59:19 +0200 Subject: [PATCH] Changed "Protocol Hack" -> "ViaLegacy" --- .../api/remapper/LegacyItemRewriter.java | 38 +++++++++---------- .../providers/GameProfileFetcher.java | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/main/java/net/raphimc/vialegacy/api/remapper/LegacyItemRewriter.java b/src/main/java/net/raphimc/vialegacy/api/remapper/LegacyItemRewriter.java index cbbd5fa..08769be 100644 --- a/src/main/java/net/raphimc/vialegacy/api/remapper/LegacyItemRewriter.java +++ b/src/main/java/net/raphimc/vialegacy/api/remapper/LegacyItemRewriter.java @@ -40,7 +40,7 @@ public abstract class LegacyItemRewriter

extends RewriterBas public LegacyItemRewriter(final P protocol, final String protocolName) { super(protocol); - this.tagName = protocolName.replace(".", "_") + "_ProtocolHack_" + System.currentTimeMillis(); + this.tagName = protocolName.replace(".", "_") + "_ViaLegacy_" + System.currentTimeMillis(); this.protocolName = protocolName; } @@ -134,11 +134,11 @@ public abstract class LegacyItemRewriter

extends RewriterBas } private void setRemappedNameRead(final Item item, final String name) { - //Set protocol hack tag for later remapping - final CompoundTag protocolHackTag = (item.tag() != null && item.tag().contains(tagName) ? item.tag().get(tagName) : new CompoundTag()); + //Set ViaLegacy tag for later remapping + final CompoundTag viaLegacyTag = (item.tag() != null && item.tag().contains(tagName) ? item.tag().get(tagName) : new CompoundTag()); if (item.tag() == null || !item.tag().contains(tagName)) { - protocolHackTag.put("Id", new IntTag(item.identifier())); - protocolHackTag.put("Meta", new ShortTag(item.data())); + viaLegacyTag.put("Id", new IntTag(item.identifier())); + viaLegacyTag.put("Meta", new ShortTag(item.data())); } //Get Item tag @@ -146,29 +146,29 @@ public abstract class LegacyItemRewriter

extends RewriterBas if (tag == null) { tag = new CompoundTag(); item.setTag(tag); - protocolHackTag.put("RemoveTag", new IntTag(0)); + viaLegacyTag.put("RemoveTag", new IntTag(0)); } - tag.put(tagName, protocolHackTag); + tag.put(tagName, viaLegacyTag); //Set name/lore of item CompoundTag display = tag.get("display"); if (display == null) { display = new CompoundTag(); tag.put("display", display); - protocolHackTag.put("RemoveDisplayTag", new IntTag(0)); + viaLegacyTag.put("RemoveDisplayTag", new IntTag(0)); } if (display.contains("Name")) { ListTag lore = display.get("Lore"); if (lore == null) { lore = new ListTag(); display.put("Lore", lore); - protocolHackTag.put("RemoveLore", new IntTag(0)); + viaLegacyTag.put("RemoveLore", new IntTag(0)); } lore.add(new StringTag("§r " + this.protocolName + " Item ID: " + item.identifier() + " (" + name + ")")); - protocolHackTag.put("RemoveLastLore", new IntTag(0)); + viaLegacyTag.put("RemoveLastLore", new IntTag(0)); } else { display.put("Name", new StringTag("§r" + this.protocolName + " " + name)); - protocolHackTag.put("RemoveDisplayName", new IntTag(0)); + viaLegacyTag.put("RemoveDisplayName", new IntTag(0)); } } @@ -177,27 +177,27 @@ public abstract class LegacyItemRewriter

extends RewriterBas if (!item.tag().contains(tagName)) return; final CompoundTag tag = item.tag(); - final CompoundTag protocolHackTag = tag.get(tagName); + final CompoundTag viaLegacyTag = tag.get(tagName); tag.remove(tagName); - item.setIdentifier(((IntTag) protocolHackTag.get("Id")).asInt()); - item.setData(((ShortTag) protocolHackTag.get("Meta")).asShort()); - if (protocolHackTag.contains("RemoveLastLore")) { + item.setIdentifier(((IntTag) viaLegacyTag.get("Id")).asInt()); + item.setData(((ShortTag) viaLegacyTag.get("Meta")).asShort()); + if (viaLegacyTag.contains("RemoveLastLore")) { ListTag lore = ((CompoundTag) tag.get("display")).get("Lore"); List tags = lore.getValue(); tags.remove(lore.size() - 1); lore.setValue(tags); } - if (protocolHackTag.contains("RemoveLore")) { + if (viaLegacyTag.contains("RemoveLore")) { ((CompoundTag) tag.get("display")).remove("Lore"); } - if (protocolHackTag.contains("RemoveDisplayName")) { + if (viaLegacyTag.contains("RemoveDisplayName")) { ((CompoundTag) tag.get("display")).remove("Name"); } - if (protocolHackTag.contains("RemoveDisplayTag")) { + if (viaLegacyTag.contains("RemoveDisplayTag")) { tag.remove("display"); } - if (protocolHackTag.contains("RemoveTag")) { + if (viaLegacyTag.contains("RemoveTag")) { item.setTag(null); } } diff --git a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_8to1_7_6_10/providers/GameProfileFetcher.java b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_8to1_7_6_10/providers/GameProfileFetcher.java index b776925..141c061 100644 --- a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_8to1_7_6_10/providers/GameProfileFetcher.java +++ b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_8to1_7_6_10/providers/GameProfileFetcher.java @@ -36,7 +36,7 @@ public abstract class GameProfileFetcher implements Provider { protected static final Pattern PATTERN_CONTROL_CODE = Pattern.compile("(?i)\\u00A7[0-9A-FK-OR]"); - private static final ThreadPoolExecutor LOADING_POOL = (ThreadPoolExecutor) Executors.newFixedThreadPool(2, new ThreadFactoryBuilder().setNameFormat("ProtocolHack GameProfile Loader #%d").setDaemon(true).build()); + private static final ThreadPoolExecutor LOADING_POOL = (ThreadPoolExecutor) Executors.newFixedThreadPool(2, new ThreadFactoryBuilder().setNameFormat("ViaLegacy GameProfile Loader #%d").setDaemon(true).build()); private final LoadingCache UUID_CACHE = CacheBuilder.newBuilder().expireAfterWrite(6, TimeUnit.HOURS).build(new CacheLoader() { @Override