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;
/**
* @deprecated Unused, will be removed in the future. Use String concatenation instead.
*/
@Deprecated(forRemoval = true, since = "TODO")
public class JoinedCharSequence implements CharSequence {
private char join;

Datei anzeigen

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

Datei anzeigen

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