Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-25 18:40:05 +01:00
Treat categories as empty when missing
Dieser Commit ist enthalten in:
Ursprung
df5ef52d6c
Commit
5de8e0852c
@ -27,7 +27,6 @@ import com.sk89q.worldedit.function.mask.BlockCategoryMask;
|
|||||||
import com.sk89q.worldedit.function.mask.Mask;
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.internal.registry.InputParser;
|
import com.sk89q.worldedit.internal.registry.InputParser;
|
||||||
import com.sk89q.worldedit.session.request.Request;
|
import com.sk89q.worldedit.session.request.Request;
|
||||||
import com.sk89q.worldedit.world.block.BlockCategories;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockCategory;
|
import com.sk89q.worldedit.world.block.BlockCategory;
|
||||||
|
|
||||||
public class BlockCategoryMaskParser extends InputParser<Mask> {
|
public class BlockCategoryMaskParser extends InputParser<Mask> {
|
||||||
@ -45,7 +44,7 @@ public class BlockCategoryMaskParser extends InputParser<Mask> {
|
|||||||
Extent extent = Request.request().getEditSession();
|
Extent extent = Request.request().getEditSession();
|
||||||
|
|
||||||
// This means it's a tag mask.
|
// This means it's a tag mask.
|
||||||
BlockCategory category = BlockCategories.get(input.substring(2).toLowerCase());
|
BlockCategory category = BlockCategory.REGISTRY.get(input.substring(2).toLowerCase());
|
||||||
if (category == null) {
|
if (category == null) {
|
||||||
throw new InputParseException("Unrecognised tag '" + input.substring(2) + '\'');
|
throw new InputParseException("Unrecognised tag '" + input.substring(2) + '\'');
|
||||||
} else {
|
} else {
|
||||||
|
@ -26,9 +26,7 @@ import com.sk89q.worldedit.function.pattern.BlockPattern;
|
|||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.function.pattern.RandomPattern;
|
import com.sk89q.worldedit.function.pattern.RandomPattern;
|
||||||
import com.sk89q.worldedit.internal.registry.InputParser;
|
import com.sk89q.worldedit.internal.registry.InputParser;
|
||||||
import com.sk89q.worldedit.world.block.BlockCategories;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockCategory;
|
import com.sk89q.worldedit.world.block.BlockCategory;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -58,7 +56,7 @@ public class BlockCategoryPatternParser extends InputParser<Pattern> {
|
|||||||
anyState = true;
|
anyState = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockCategory category = BlockCategories.get(tag);
|
BlockCategory category = BlockCategory.REGISTRY.get(tag);
|
||||||
if (category == null) {
|
if (category == null) {
|
||||||
throw new InputParseException("Unknown block tag: " + tag);
|
throw new InputParseException("Unknown block tag: " + tag);
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.world.block;
|
package com.sk89q.worldedit.world.block;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores a list of categories of Block Types.
|
* Stores a list of categories of Block Types.
|
||||||
*/
|
*/
|
||||||
@ -62,7 +60,11 @@ public final class BlockCategories {
|
|||||||
private BlockCategories() {
|
private BlockCategories() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static @Nullable BlockCategory get(final String id) {
|
private static BlockCategory get(final String id) {
|
||||||
return BlockCategory.REGISTRY.get(id);
|
BlockCategory blockCategory = BlockCategory.REGISTRY.get(id);
|
||||||
|
if (blockCategory == null) {
|
||||||
|
return new BlockCategory(id);
|
||||||
|
}
|
||||||
|
return blockCategory;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.world.item;
|
package com.sk89q.worldedit.world.item;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores a list of categories of Item Types.
|
* Stores a list of categories of Item Types.
|
||||||
*/
|
*/
|
||||||
@ -60,7 +58,11 @@ public final class ItemCategories {
|
|||||||
private ItemCategories() {
|
private ItemCategories() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static @Nullable ItemCategory get(final String id) {
|
private static ItemCategory get(final String id) {
|
||||||
return ItemCategory.REGISTRY.get(id);
|
ItemCategory itemCategory = ItemCategory.REGISTRY.get(id);
|
||||||
|
if (itemCategory == null) {
|
||||||
|
return new ItemCategory(id);
|
||||||
|
}
|
||||||
|
return itemCategory;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren