Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ private void setupPreWorldData() {
loadAdapter();
initializeRegistries(); // this creates the objects matching Bukkit's enums - but doesn't fill them with data yet
config.load();
WorldEdit.getInstance().loadMappings();
}

private void setupWorldData() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ public void onStarted() {
setupPlatform();

setupRegistries();
WorldEdit.getInstance().loadMappings();

config.load();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.registry.LegacyMapper;
import org.apache.logging.log4j.Logger;

import java.io.DataInputStream;
Expand Down Expand Up @@ -411,9 +410,11 @@ private boolean checkFilename(String filename) {

/**
* Load the bundled mappings.
*
* @deprecated This is no longer necessary as all mappings are loaded lazily.
*/
@Deprecated(forRemoval = true)
public void loadMappings() {
LegacyMapper.getInstance(); // Load legacy mappings
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,12 @@ private BaseBlock parseLogic(String input, ParserContext context) throws InputPa
if (split.length == 0) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.invalid-colon"));
} else if (split.length == 1) {
state = LegacyMapper.getInstance().getBlockFromLegacy(Integer.parseInt(split[0]));
var legacyTypeId = Integer.parseInt(split[0]);
state = LegacyMapper.getInstance().getBlockFromLegacy(legacyTypeId);
} else {
state = LegacyMapper.getInstance().getBlockFromLegacy(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
var legacyTypeId = Integer.parseInt(split[0]);
var legacyDataValue = Integer.parseInt(split[1]);
state = LegacyMapper.getInstance().getBlockFromLegacy(legacyTypeId, legacyDataValue);
}
if (state != null) {
blockType = state.getBlockType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,12 @@ public BaseItem parseFromInput(String input, ParserContext context) throws Input
if (split.length == 0) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.invalid-colon"));
} else if (split.length == 1) {
itemType = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(split[0]));
var legacyItemId = Integer.parseInt(split[0]);
itemType = LegacyMapper.getInstance().getItemFromLegacy(legacyItemId);
} else {
itemType = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
var legacyItemId = Integer.parseInt(split[0]);
var legacyDataValue = Integer.parseInt(split[1]);
itemType = LegacyMapper.getInstance().getItemFromLegacy(legacyItemId, legacyDataValue);
}
if (itemType != null) {
item = new BaseItem(itemType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.util.report.Unreported;
import com.sk89q.worldedit.world.registry.LegacyMapper;
import org.apache.logging.log4j.Logger;

import java.io.File;
Expand Down Expand Up @@ -108,23 +107,13 @@ public void load() {
logFile = getString("log-file", logFile);
logFormat = getString("log-format", logFormat);
registerHelp = getBool("register-help", registerHelp);
wandItem = getString("wand-item", wandItem).toLowerCase(Locale.ROOT);
try {
wandItem = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(wandItem)).id();
} catch (Throwable ignored) {
// This is just for compatibility with old configs, ignore errors
}
wandItem = convertLegacyItem(getString("wand-item", wandItem)).toLowerCase(Locale.ROOT);
superPickaxeDrop = getBool("super-pickaxe-drop-items", superPickaxeDrop);
superPickaxeManyDrop = getBool("super-pickaxe-many-drop-items", superPickaxeManyDrop);
useInventory = getBool("use-inventory", useInventory);
useInventoryOverride = getBool("use-inventory-override", useInventoryOverride);
useInventoryCreativeOverride = getBool("use-inventory-creative-override", useInventoryCreativeOverride);
navigationWand = getString("nav-wand-item", navigationWand).toLowerCase(Locale.ROOT);
try {
navigationWand = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(navigationWand)).id();
} catch (Throwable ignored) {
// This is just for compatibility with old configs, ignore errors
}
navigationWand = convertLegacyItem(getString("nav-wand-item", navigationWand)).toLowerCase(Locale.ROOT);
navigationWandMaxDistance = getInt("nav-wand-distance", navigationWandMaxDistance);
navigationUseGlass = getBool("nav-use-glass", navigationUseGlass);
scriptTimeout = getInt("scripting-timeout", scriptTimeout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.session.SessionManager;
import com.sk89q.worldedit.util.report.Unreported;
import com.sk89q.worldedit.world.registry.LegacyMapper;
import org.apache.logging.log4j.Logger;
import org.spongepowered.configurate.CommentedConfigurationNode;
import org.spongepowered.configurate.ConfigurationOptions;
Expand Down Expand Up @@ -63,12 +62,7 @@ public void load() {

profile = node.node("debug").getBoolean(profile);
traceUnflushedSessions = node.node("debugging", "trace-unflushed-sessions").getBoolean(traceUnflushedSessions);
wandItem = node.node("wand-item").getString(wandItem).toLowerCase(Locale.ROOT);
try {
wandItem = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(wandItem)).id();
} catch (Throwable ignored) {
// This is just for old configs, so ignore errors
}
wandItem = convertLegacyItem(node.node("wand-item").getString(wandItem)).toLowerCase(Locale.ROOT);

defaultChangeLimit = Math.max(-1, node.node("limits", "max-blocks-changed", "default").getInt(defaultChangeLimit));
maxChangeLimit = Math.max(-1, node.node("limits", "max-blocks-changed", "maximum").getInt(maxChangeLimit));
Expand Down Expand Up @@ -115,12 +109,8 @@ public void load() {
useInventoryOverride = node.node("use-inventory", "allow-override").getBoolean(useInventoryOverride);
useInventoryCreativeOverride = node.node("use-inventory", "creative-mode-overrides").getBoolean(useInventoryCreativeOverride);

navigationWand = node.node("navigation-wand", "item").getString(navigationWand).toLowerCase(Locale.ROOT);
try {
navigationWand = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(navigationWand)).id();
} catch (Throwable ignored) {
// This is just for old configs, so ignore errors
}
navigationWand = convertLegacyItem(node.node("navigation-wand", "item").getString(navigationWand)).toLowerCase(Locale.ROOT);

navigationWandMaxDistance = node.node("navigation-wand", "max-distance").getInt(navigationWandMaxDistance);
navigationUseGlass = node.node("navigation", "use-glass").getBoolean(navigationUseGlass);

Expand Down