3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-27 03:12:37 +01:00

Remove usages of JoinedCharSequence (#2062)

Dieser Commit ist enthalten in:
Hannes Greule 2023-01-11 00:07:24 +01:00 committet von GitHub
Ursprung 452f968f07
Commit bb0e201c52
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
3 geänderte Dateien mit 6 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -1,5 +1,9 @@
package com.fastasyncworldedit.core.util; package com.fastasyncworldedit.core.util;
/**
* @deprecated Unused, will be removed in the future. Use String concatenation instead.
*/
@Deprecated(forRemoval = true, since = "TODO")
public class JoinedCharSequence implements CharSequence { public class JoinedCharSequence implements CharSequence {
private char join; private char join;

Datei anzeigen

@ -20,7 +20,6 @@
package com.sk89q.worldedit.world.block; package com.sk89q.worldedit.world.block;
import com.fastasyncworldedit.core.command.SuggestInputParseException; import com.fastasyncworldedit.core.command.SuggestInputParseException;
import com.fastasyncworldedit.core.util.JoinedCharSequence;
import com.fastasyncworldedit.core.util.StringMan; import com.fastasyncworldedit.core.util.StringMan;
import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.input.ParserContext;
@ -1923,23 +1922,19 @@ public final class BlockTypes {
public static final BlockType ZOMBIE_WALL_HEAD = init(); public static final BlockType ZOMBIE_WALL_HEAD = init();
private static Field[] fieldsTmp; private static Field[] fieldsTmp;
private static JoinedCharSequence joined;
private static int initIndex = 0; private static int initIndex = 0;
public static BlockType init() { public static BlockType init() {
if (fieldsTmp == null) { if (fieldsTmp == null) {
fieldsTmp = BlockTypes.class.getDeclaredFields(); fieldsTmp = BlockTypes.class.getDeclaredFields();
BlockTypesCache.$NAMESPACES.isEmpty(); // initialize cache BlockTypesCache.$NAMESPACES.isEmpty(); // initialize cache
joined = new JoinedCharSequence();
} }
String name = fieldsTmp[initIndex++].getName().toLowerCase(Locale.ROOT); String name = fieldsTmp[initIndex++].getName().toLowerCase(Locale.ROOT);
CharSequence fullName = joined.init(BlockType.REGISTRY.getDefaultNamespace(), ':', name); return BlockType.REGISTRY.get(name);
return BlockType.REGISTRY.getMap().get(fullName);
} }
static { static {
fieldsTmp = null; fieldsTmp = null;
joined = null;
} }
/* /*

Datei anzeigen

@ -19,7 +19,6 @@
package com.sk89q.worldedit.world.item; package com.sk89q.worldedit.world.item;
import com.fastasyncworldedit.core.util.JoinedCharSequence;
import com.fastasyncworldedit.core.world.block.ItemTypesCache; import com.fastasyncworldedit.core.world.block.ItemTypesCache;
import com.sk89q.worldedit.world.registry.LegacyMapper; import com.sk89q.worldedit.world.registry.LegacyMapper;
@ -2362,7 +2361,6 @@ public final class ItemTypes {
} }
private static Field[] fieldsTmp; private static Field[] fieldsTmp;
private static JoinedCharSequence joined;
private static int initIndex = 0; private static int initIndex = 0;
private static ItemType init() { private static ItemType init() {
@ -2370,11 +2368,9 @@ public final class ItemTypes {
if (fieldsTmp == null) { if (fieldsTmp == null) {
fieldsTmp = ItemTypes.class.getDeclaredFields(); fieldsTmp = ItemTypes.class.getDeclaredFields();
ItemTypesCache.init(); // force class to load ItemTypesCache.init(); // force class to load
joined = new JoinedCharSequence();
} }
String name = fieldsTmp[initIndex++].getName().toLowerCase(Locale.ROOT); String name = fieldsTmp[initIndex++].getName().toLowerCase(Locale.ROOT);
CharSequence fullName = joined.init(ItemType.REGISTRY.getDefaultNamespace(), ':', name); return ItemType.REGISTRY.get(name);
return ItemType.REGISTRY.getMap().get(fullName);
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();
throw e; throw e;
@ -2383,7 +2379,6 @@ public final class ItemTypes {
static { static {
fieldsTmp = null; fieldsTmp = null;
joined = null;
} }
@Nullable @Nullable