Skip to content

Commit

Permalink
fixed dimension string
Browse files Browse the repository at this point in the history
  • Loading branch information
yurisuika committed Aug 28, 2023
1 parent 320fb37 commit 100e319
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.minecraft.text.*;
import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import org.apache.commons.lang3.ArrayUtils;

import java.util.*;
Expand Down Expand Up @@ -192,7 +193,7 @@ public static void register(CommandDispatcher<ServerCommandSource> dispatcher, R
.then(literal("add")
.then(argument("dimension", DimensionArgumentType.dimension())
.executes(context -> {
String dimension = DimensionArgumentType.getDimensionArgument(context, "dimension").toString();
String dimension = context.getSource().getRegistryManager().get(Registry.DIMENSION_TYPE_KEY).getId(DimensionArgumentType.getDimensionArgument(context, "dimension").getDimension()).toString();
if (Arrays.stream(config.filter.dimension.whitelist).anyMatch(dimension::equalsIgnoreCase)) {
context.getSource().sendError(new TranslatableText("commands.blossom.filter.dimension.whitelist.add.failed", dimension));
return 0;
Expand All @@ -210,7 +211,7 @@ public static void register(CommandDispatcher<ServerCommandSource> dispatcher, R
.then(literal("remove")
.then(argument("dimension", DimensionArgumentType.dimension())
.executes(context -> {
String dimension = DimensionArgumentType.getDimensionArgument(context, "dimension").toString();
String dimension = context.getSource().getRegistryManager().get(Registry.DIMENSION_TYPE_KEY).getId(DimensionArgumentType.getDimensionArgument(context, "dimension").getDimension()).toString();
if (Arrays.stream(config.filter.dimension.whitelist).noneMatch(dimension::equalsIgnoreCase)) {
context.getSource().sendError(new TranslatableText("commands.blossom.filter.dimension.whitelist.remove.failed", dimension));
return 0;
Expand Down Expand Up @@ -240,7 +241,7 @@ public static void register(CommandDispatcher<ServerCommandSource> dispatcher, R
.then(literal("add")
.then(argument("dimension", DimensionArgumentType.dimension())
.executes(context -> {
String dimension = DimensionArgumentType.getDimensionArgument(context, "dimension").toString();
String dimension = context.getSource().getRegistryManager().get(Registry.DIMENSION_TYPE_KEY).getId(DimensionArgumentType.getDimensionArgument(context, "dimension").getDimension()).toString();
if (Arrays.stream(config.filter.dimension.blacklist).anyMatch(dimension::equalsIgnoreCase)) {
context.getSource().sendError(new TranslatableText("commands.blossom.filter.biome.blacklist.add.failed", dimension));
return 0;
Expand All @@ -258,7 +259,7 @@ public static void register(CommandDispatcher<ServerCommandSource> dispatcher, R
.then(literal("remove")
.then(argument("dimension", DimensionArgumentType.dimension())
.executes(context -> {
String dimension = DimensionArgumentType.getDimensionArgument(context, "dimension").toString();
String dimension = context.getSource().getRegistryManager().get(Registry.DIMENSION_TYPE_KEY).getId(DimensionArgumentType.getDimensionArgument(context, "dimension").getDimension()).toString();
if (Arrays.stream(config.filter.dimension.blacklist).noneMatch(dimension::equalsIgnoreCase)) {
context.getSource().sendError(new TranslatableText("commands.blossom.filter.dimension.blacklist.remove.failed", dimension));
return 0;
Expand Down

0 comments on commit 100e319

Please sign in to comment.