mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Migrate some more captions
This commit is contained in:
parent
fbf6a3517d
commit
99be181aea
@ -41,7 +41,6 @@ import com.plotsquared.core.plot.flag.InternalFlag;
|
|||||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||||
import com.plotsquared.core.plot.flag.types.IntegerFlag;
|
import com.plotsquared.core.plot.flag.types.IntegerFlag;
|
||||||
import com.plotsquared.core.plot.flag.types.ListFlag;
|
import com.plotsquared.core.plot.flag.types.ListFlag;
|
||||||
import com.plotsquared.core.plot.message.PlotMessage;
|
|
||||||
import com.plotsquared.core.util.MainUtil;
|
import com.plotsquared.core.util.MainUtil;
|
||||||
import com.plotsquared.core.util.MathMan;
|
import com.plotsquared.core.util.MathMan;
|
||||||
import com.plotsquared.core.util.Permissions;
|
import com.plotsquared.core.util.Permissions;
|
||||||
|
@ -29,13 +29,14 @@ import com.plotsquared.core.PlotSquared;
|
|||||||
import com.plotsquared.core.configuration.CaptionUtility;
|
import com.plotsquared.core.configuration.CaptionUtility;
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.Captions;
|
||||||
import com.plotsquared.core.configuration.Settings;
|
import com.plotsquared.core.configuration.Settings;
|
||||||
|
import com.plotsquared.core.configuration.caption.Templates;
|
||||||
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.plot.PlotArea;
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
import com.plotsquared.core.plot.expiration.ExpireManager;
|
import com.plotsquared.core.plot.expiration.ExpireManager;
|
||||||
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.PriceFlag;
|
import com.plotsquared.core.plot.flag.implementations.PriceFlag;
|
||||||
import com.plotsquared.core.plot.message.PlotMessage;
|
|
||||||
import com.plotsquared.core.util.EconHandler;
|
import com.plotsquared.core.util.EconHandler;
|
||||||
import com.plotsquared.core.util.MainUtil;
|
import com.plotsquared.core.util.MainUtil;
|
||||||
import com.plotsquared.core.util.MathMan;
|
import com.plotsquared.core.util.MathMan;
|
||||||
@ -45,7 +46,6 @@ import com.plotsquared.core.util.StringMan;
|
|||||||
import com.plotsquared.core.util.TabCompletions;
|
import com.plotsquared.core.util.TabCompletions;
|
||||||
import com.plotsquared.core.util.query.PlotQuery;
|
import com.plotsquared.core.util.query.PlotQuery;
|
||||||
import com.plotsquared.core.util.query.SortingStrategy;
|
import com.plotsquared.core.util.query.SortingStrategy;
|
||||||
import com.plotsquared.core.util.task.RunnableVal3;
|
|
||||||
import com.plotsquared.core.uuid.UUIDMapping;
|
import com.plotsquared.core.uuid.UUIDMapping;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -111,9 +111,9 @@ public class ListCmd extends SubCommand {
|
|||||||
return args.toArray(new String[args.size()]);
|
return args.toArray(new String[args.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void noArgs(PlotPlayer player) {
|
public void noArgs(PlotPlayer<?> player) {
|
||||||
MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.getTranslated() + Arrays
|
player.sendMessage(TranslatableCaption.of("commandconfig.subcommand_set_options_header"),
|
||||||
.toString(getArgumentList(player)));
|
Templates.of("values", Arrays.toString(getArgumentList(player))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean onCommand(PlotPlayer<?> player, String[] args) {
|
@Override public boolean onCommand(PlotPlayer<?> player, String[] args) {
|
||||||
@ -162,7 +162,7 @@ public class ListCmd extends SubCommand {
|
|||||||
final List<Plot> plots = query.asList();
|
final List<Plot> plots = query.asList();
|
||||||
|
|
||||||
if (plots.isEmpty()) {
|
if (plots.isEmpty()) {
|
||||||
MainUtil.sendMessage(player, Captions.FOUND_NO_PLOTS);
|
player.sendMessage(TranslatableCaption.of("invalid.found_no_plots"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
displayPlots(player, plots, 12, page, args);
|
displayPlots(player, plots, 12, page, args);
|
||||||
@ -171,8 +171,8 @@ public class ListCmd extends SubCommand {
|
|||||||
switch (arg) {
|
switch (arg) {
|
||||||
case "mine":
|
case "mine":
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_MINE)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_MINE)) {
|
||||||
MainUtil
|
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||||
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_MINE);
|
Templates.of("node", "plots.list.mine"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
sort[0] = false;
|
sort[0] = false;
|
||||||
@ -180,31 +180,29 @@ public class ListCmd extends SubCommand {
|
|||||||
break;
|
break;
|
||||||
case "shared":
|
case "shared":
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_SHARED)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_SHARED)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||||
Captions.PERMISSION_LIST_SHARED);
|
Templates.of("node", "plots.list.shared"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plotConsumer.accept(PlotQuery.newQuery().withMember(player.getUUID()).thatPasses(plot -> !plot.isOwnerAbs(player.getUUID())));
|
plotConsumer.accept(PlotQuery.newQuery().withMember(player.getUUID()).thatPasses(plot -> !plot.isOwnerAbs(player.getUUID())));
|
||||||
break;
|
break;
|
||||||
case "world":
|
case "world":
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_WORLD)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_WORLD)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||||
Captions.PERMISSION_LIST_WORLD);
|
Templates.of("node", "plots.list.world"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(player, CaptionUtility
|
if (!Permissions.hasPermission(player, "plots.list.world." + world)) {
|
||||||
.format(player, Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world))) {
|
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility
|
Templates.of("node", "plots.list.world" + world));
|
||||||
.format(player, Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(),
|
|
||||||
world));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plotConsumer.accept(PlotQuery.newQuery().inWorld(world));
|
plotConsumer.accept(PlotQuery.newQuery().inWorld(world));
|
||||||
break;
|
break;
|
||||||
case "expired":
|
case "expired":
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_EXPIRED)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_EXPIRED)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||||
Captions.PERMISSION_LIST_EXPIRED);
|
Templates.of("node", "plots.list.expired"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (ExpireManager.IMP == null) {
|
if (ExpireManager.IMP == null) {
|
||||||
@ -215,15 +213,13 @@ public class ListCmd extends SubCommand {
|
|||||||
break;
|
break;
|
||||||
case "area":
|
case "area":
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_AREA)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_AREA)) {
|
||||||
MainUtil
|
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||||
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_AREA);
|
Templates.of("node", "plots.list.area"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(player, CaptionUtility
|
if (!Permissions.hasPermission(player, "plots.list.world." + world)) {
|
||||||
.format(player, Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world))) {
|
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility
|
Templates.of("node", "plots.list.world" + world));
|
||||||
.format(player, Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(),
|
|
||||||
world));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
@ -234,16 +230,16 @@ public class ListCmd extends SubCommand {
|
|||||||
break;
|
break;
|
||||||
case "all":
|
case "all":
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_ALL)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_ALL)) {
|
||||||
MainUtil
|
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||||
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_ALL);
|
Templates.of("node", "plots.list.all"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plotConsumer.accept(PlotQuery.newQuery().allPlots());
|
plotConsumer.accept(PlotQuery.newQuery().allPlots());
|
||||||
break;
|
break;
|
||||||
case "done":
|
case "done":
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_DONE)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_DONE)) {
|
||||||
MainUtil
|
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||||
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_DONE);
|
Templates.of("node", "plots.list.done"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
sort[0] = false;
|
sort[0] = false;
|
||||||
@ -251,8 +247,8 @@ public class ListCmd extends SubCommand {
|
|||||||
break;
|
break;
|
||||||
case "top":
|
case "top":
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_TOP)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_TOP)) {
|
||||||
MainUtil
|
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||||
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_TOP);
|
Templates.of("node", "plots.list.top"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
sort[0] = false;
|
sort[0] = false;
|
||||||
@ -260,8 +256,8 @@ public class ListCmd extends SubCommand {
|
|||||||
break;
|
break;
|
||||||
case "forsale":
|
case "forsale":
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_FOR_SALE)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_FOR_SALE)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||||
Captions.PERMISSION_LIST_FOR_SALE);
|
Templates.of("node", "plots.list.forsale"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (EconHandler.getEconHandler() == null) {
|
if (EconHandler.getEconHandler() == null) {
|
||||||
@ -271,20 +267,21 @@ public class ListCmd extends SubCommand {
|
|||||||
break;
|
break;
|
||||||
case "unowned":
|
case "unowned":
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_UNOWNED)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_UNOWNED)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||||
Captions.PERMISSION_LIST_UNOWNED);
|
Templates.of("node", "plots.list.unowned"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plotConsumer.accept(PlotQuery.newQuery().allPlots().thatPasses(plot -> plot.getOwner() == null));
|
plotConsumer.accept(PlotQuery.newQuery().allPlots().thatPasses(plot -> plot.getOwner() == null));
|
||||||
break;
|
break;
|
||||||
case "fuzzy":
|
case "fuzzy":
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_FUZZY)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_FUZZY)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||||
Captions.PERMISSION_LIST_FUZZY);
|
Templates.of("node", "plots.list.fuzzy"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length < (page == -1 ? 2 : 3)) {
|
if (args.length < (page == -1 ? 2 : 3)) {
|
||||||
Captions.COMMAND_SYNTAX.send(player, "/plot list fuzzy <search...> [#]");
|
player.sendMessage(TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
|
Templates.of("value", "/plot list fuzzy <search...> [#]"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String term;
|
String term;
|
||||||
@ -299,16 +296,13 @@ public class ListCmd extends SubCommand {
|
|||||||
default:
|
default:
|
||||||
if (PlotSquared.get().hasPlotArea(args[0])) {
|
if (PlotSquared.get().hasPlotArea(args[0])) {
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_WORLD)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_WORLD)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||||
Captions.PERMISSION_LIST_WORLD);
|
Templates.of("node", "plots.list.world"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(player, CaptionUtility
|
if (!Permissions.hasPermission(player, "plots.list.world." + args[0])) {
|
||||||
.format(player, Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(),
|
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||||
args[0]))) {
|
Templates.of("node", "plots.list.world." + args[0]));
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility
|
|
||||||
.format(player, Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(),
|
|
||||||
args[0]));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plotConsumer.accept(PlotQuery.newQuery().inWorld(args[0]));
|
plotConsumer.accept(PlotQuery.newQuery().inWorld(args[0]));
|
||||||
@ -318,7 +312,7 @@ public class ListCmd extends SubCommand {
|
|||||||
PlotSquared.get().getImpromptuUUIDPipeline()
|
PlotSquared.get().getImpromptuUUIDPipeline()
|
||||||
.getSingle(args[0], (uuid, throwable) -> {
|
.getSingle(args[0], (uuid, throwable) -> {
|
||||||
if (throwable instanceof TimeoutException) {
|
if (throwable instanceof TimeoutException) {
|
||||||
MainUtil.sendMessage(player, Captions.FETCHING_PLAYERS_TIMEOUT);
|
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
||||||
} else if (throwable != null) {
|
} else if (throwable != null) {
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
try {
|
try {
|
||||||
@ -328,12 +322,13 @@ public class ListCmd extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
|
player.sendMessage(TranslatableCaption.of("errors.invalid_player"),
|
||||||
|
Templates.of("value", args[0]));
|
||||||
} else {
|
} else {
|
||||||
if (!Permissions
|
if (!Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_LIST_PLAYER)) {
|
.hasPermission(player, Captions.PERMISSION_LIST_PLAYER)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||||
Captions.PERMISSION_LIST_PLAYER);
|
Templates.of("node", "plots.list.player"));
|
||||||
} else {
|
} else {
|
||||||
sort[0] = false;
|
sort[0] = false;
|
||||||
plotConsumer.accept(PlotQuery.newQuery().ownedBy(uuid).withSortingStrategy(SortingStrategy.SORT_BY_TEMP));
|
plotConsumer.accept(PlotQuery.newQuery().ownedBy(uuid).withSortingStrategy(SortingStrategy.SORT_BY_TEMP));
|
||||||
|
@ -27,7 +27,7 @@ package com.plotsquared.core.setup;
|
|||||||
|
|
||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
import com.plotsquared.core.configuration.Caption;
|
import com.plotsquared.core.configuration.Caption;
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.events.TeleportCause;
|
import com.plotsquared.core.events.TeleportCause;
|
||||||
import com.plotsquared.core.generator.GeneratorWrapper;
|
import com.plotsquared.core.generator.GeneratorWrapper;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
@ -35,7 +35,6 @@ import com.plotsquared.core.plot.PlotArea;
|
|||||||
import com.plotsquared.core.plot.PlotAreaTerrainType;
|
import com.plotsquared.core.plot.PlotAreaTerrainType;
|
||||||
import com.plotsquared.core.plot.PlotAreaType;
|
import com.plotsquared.core.plot.PlotAreaType;
|
||||||
import com.plotsquared.core.plot.PlotId;
|
import com.plotsquared.core.plot.PlotId;
|
||||||
import com.plotsquared.core.util.MainUtil;
|
|
||||||
import com.plotsquared.core.util.SetupUtils;
|
import com.plotsquared.core.util.SetupUtils;
|
||||||
import com.plotsquared.core.util.StringMan;
|
import com.plotsquared.core.util.StringMan;
|
||||||
import com.plotsquared.core.util.WorldUtil;
|
import com.plotsquared.core.util.WorldUtil;
|
||||||
@ -49,18 +48,12 @@ import java.util.Collections;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.plotsquared.core.util.MainUtil.sendMessage;
|
|
||||||
|
|
||||||
public enum CommonSetupSteps implements SetupStep {
|
public enum CommonSetupSteps implements SetupStep {
|
||||||
CHOOSE_GENERATOR(Captions.SETUP_INIT) {
|
CHOOSE_GENERATOR(TranslatableCaption.of("setup.setup_init")) {
|
||||||
|
|
||||||
@Override public SetupStep handleInput(PlotPlayer<?> plotPlayer, PlotAreaBuilder builder, String arg) {
|
@Override public SetupStep handleInput(PlotPlayer<?> plotPlayer, PlotAreaBuilder builder, String arg) {
|
||||||
if (!SetupUtils.generators.containsKey(arg)) {
|
if (!SetupUtils.generators.containsKey(arg)) {
|
||||||
String prefix = "\n&8 - &7";
|
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_world_generator_error"));
|
||||||
sendMessage(plotPlayer, Captions.SETUP_WORLD_GENERATOR_ERROR + prefix + StringMan
|
|
||||||
.join(SetupUtils.generators.keySet(), prefix)
|
|
||||||
.replaceAll(PlotSquared.imp().getPluginName(),
|
|
||||||
"&2" + PlotSquared.imp().getPluginName()));
|
|
||||||
return this; // invalid input -> same setup step
|
return this; // invalid input -> same setup step
|
||||||
}
|
}
|
||||||
builder.generatorName(arg);
|
builder.generatorName(arg);
|
||||||
@ -75,21 +68,12 @@ public enum CommonSetupSteps implements SetupStep {
|
|||||||
return PlotSquared.imp().getPluginName();
|
return PlotSquared.imp().getPluginName();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CHOOSE_PLOT_AREA_TYPE(PlotAreaType.class, Captions.SETUP_WORLD_TYPE) {
|
CHOOSE_PLOT_AREA_TYPE(PlotAreaType.class, TranslatableCaption.of("setup.setup_world_type")) {
|
||||||
|
|
||||||
@Override public SetupStep handleInput(PlotPlayer<?> plotPlayer, PlotAreaBuilder builder, String arg) {
|
@Override public SetupStep handleInput(PlotPlayer<?> plotPlayer, PlotAreaBuilder builder, String arg) {
|
||||||
boolean withNormal = SetupUtils.generators.get(builder.generatorName()).isFull();
|
|
||||||
Optional<PlotAreaType> plotAreaType = PlotAreaType.fromString(arg);
|
Optional<PlotAreaType> plotAreaType = PlotAreaType.fromString(arg);
|
||||||
if (!plotAreaType.isPresent()) {
|
if (!plotAreaType.isPresent()) {
|
||||||
MainUtil.sendMessage(plotPlayer, Captions.SETUP_WORLD_TYPE_ERROR);
|
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_world_type_error"));
|
||||||
PlotAreaType.getDescriptionMap().forEach((type, caption) -> {
|
|
||||||
if (!withNormal && type == PlotAreaType.NORMAL) {
|
|
||||||
return; // skip
|
|
||||||
}
|
|
||||||
String color = type == PlotAreaType.NORMAL ? "&2" : "&7";
|
|
||||||
MainUtil.sendMessage(plotPlayer, "&8 - " + color + type
|
|
||||||
+ " &8-&7 " + caption.getTranslated());
|
|
||||||
});
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
builder.plotAreaType(plotAreaType.get());
|
builder.plotAreaType(plotAreaType.get());
|
||||||
@ -111,7 +95,7 @@ public enum CommonSetupSteps implements SetupStep {
|
|||||||
.processAreaSetup(builder);
|
.processAreaSetup(builder);
|
||||||
} else {
|
} else {
|
||||||
builder.plotManager(PlotSquared.imp().getPluginName());
|
builder.plotManager(PlotSquared.imp().getPluginName());
|
||||||
MainUtil.sendMessage(plotPlayer, Captions.SETUP_WRONG_GENERATOR);
|
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_world_generator_error"));
|
||||||
builder.settingsNodesWrapper(CommonSetupSteps.wrap(builder.plotManager()));
|
builder.settingsNodesWrapper(CommonSetupSteps.wrap(builder.plotManager()));
|
||||||
// TODO why is processSetup not called here?
|
// TODO why is processSetup not called here?
|
||||||
}
|
}
|
||||||
@ -127,16 +111,16 @@ public enum CommonSetupSteps implements SetupStep {
|
|||||||
return PlotAreaType.NORMAL.toString();
|
return PlotAreaType.NORMAL.toString();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CHOOSE_AREA_ID(Captions.SETUP_AREA_NAME) {
|
CHOOSE_AREA_ID(TranslatableCaption.of("setup.setup_area_name")) {
|
||||||
|
|
||||||
@Override public SetupStep handleInput(PlotPlayer<?> plotPlayer, PlotAreaBuilder builder, String argument) {
|
@Override public SetupStep handleInput(PlotPlayer<?> plotPlayer, PlotAreaBuilder builder, String argument) {
|
||||||
if (!StringMan.isAlphanumericUnd(argument)) {
|
if (!StringMan.isAlphanumericUnd(argument)) {
|
||||||
MainUtil.sendMessage(plotPlayer, Captions.SETUP_AREA_NON_ALPHANUMERICAL);
|
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_area_non_alphanumerical"));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
for (PlotArea area : PlotSquared.get().getPlotAreas()) {
|
for (PlotArea area : PlotSquared.get().getPlotAreas()) {
|
||||||
if (area.getId() != null && area.getId().equalsIgnoreCase(argument)) {
|
if (area.getId() != null && area.getId().equalsIgnoreCase(argument)) {
|
||||||
MainUtil.sendMessage(plotPlayer, Captions.SETUP_AREA_INVALID_ID);
|
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_area_invalid_id"));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -148,16 +132,16 @@ public enum CommonSetupSteps implements SetupStep {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CHOOSE_MINIMUM_PLOT_ID(Captions.SETUP_AREA_MIN_PLOT_ID) {
|
CHOOSE_MINIMUM_PLOT_ID(TranslatableCaption.of("setup.setup_area_min_plot_id")) {
|
||||||
|
|
||||||
@Override public SetupStep handleInput(PlotPlayer<?> plotPlayer, PlotAreaBuilder builder, String argument) {
|
@Override public SetupStep handleInput(PlotPlayer<?> plotPlayer, PlotAreaBuilder builder, String argument) {
|
||||||
try {
|
try {
|
||||||
builder.minimumId(PlotId.fromString(argument));
|
builder.minimumId(PlotId.fromString(argument));
|
||||||
} catch (IllegalArgumentException ignored) {
|
} catch (IllegalArgumentException ignored) {
|
||||||
MainUtil.sendMessage(plotPlayer, Captions.SETUP_AREA_MIN_PLOT_ID_ERROR);
|
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_area_min_plot_id_error"));
|
||||||
return this;
|
return this;
|
||||||
} catch (IllegalStateException ignored) {
|
} catch (IllegalStateException ignored) {
|
||||||
MainUtil.sendMessage(plotPlayer, Captions.SETUP_AREA_PLOT_ID_GREATER_THAN_MINIMUM);
|
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_area_plot_id_greater_than_minimum"));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
return CHOOSE_MAXIMUM_PLOT_ID;
|
return CHOOSE_MAXIMUM_PLOT_ID;
|
||||||
@ -167,16 +151,16 @@ public enum CommonSetupSteps implements SetupStep {
|
|||||||
return "0;0";
|
return "0;0";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CHOOSE_MAXIMUM_PLOT_ID(Captions.SETUP_AREA_MAX_PLOT_ID) {
|
CHOOSE_MAXIMUM_PLOT_ID(TranslatableCaption.of("setup.setup_area_max_plot_id")) {
|
||||||
|
|
||||||
@Override public SetupStep handleInput(PlotPlayer<?> plotPlayer, PlotAreaBuilder builder, String argument) {
|
@Override public SetupStep handleInput(PlotPlayer<?> plotPlayer, PlotAreaBuilder builder, String argument) {
|
||||||
try {
|
try {
|
||||||
builder.maximumId(PlotId.fromString(argument));
|
builder.maximumId(PlotId.fromString(argument));
|
||||||
} catch (IllegalArgumentException ignored) {
|
} catch (IllegalArgumentException ignored) {
|
||||||
MainUtil.sendMessage(plotPlayer, Captions.SETUP_AREA_MAX_PLOT_ID_ERROR);
|
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_area_max_plot_id_error"));
|
||||||
return this;
|
return this;
|
||||||
} catch (IllegalStateException ignored) {
|
} catch (IllegalStateException ignored) {
|
||||||
MainUtil.sendMessage(plotPlayer, Captions.SETUP_AREA_PLOT_ID_GREATER_THAN_MINIMUM);
|
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_area_plot_id_greater_than_minimum"));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
return CHOOSE_TERRAIN_TYPE;
|
return CHOOSE_TERRAIN_TYPE;
|
||||||
@ -186,13 +170,13 @@ public enum CommonSetupSteps implements SetupStep {
|
|||||||
return "0;0";
|
return "0;0";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CHOOSE_TERRAIN_TYPE(PlotAreaTerrainType.class, Captions.SETUP_PARTIAL_AREA) {
|
CHOOSE_TERRAIN_TYPE(PlotAreaTerrainType.class, TranslatableCaption.of("setup.setup_partial_area")) {
|
||||||
|
|
||||||
@Override public SetupStep handleInput(PlotPlayer<?> plotPlayer, PlotAreaBuilder builder, String argument) {
|
@Override public SetupStep handleInput(PlotPlayer<?> plotPlayer, PlotAreaBuilder builder, String argument) {
|
||||||
Optional<PlotAreaTerrainType> optTerrain;
|
Optional<PlotAreaTerrainType> optTerrain;
|
||||||
if (!(optTerrain = PlotAreaTerrainType.fromString(argument))
|
if (!(optTerrain = PlotAreaTerrainType.fromString(argument))
|
||||||
.isPresent()) {
|
.isPresent()) {
|
||||||
MainUtil.sendMessage(plotPlayer, Captions.SETUP_PARTIAL_AREA_ERROR, Captions.SETUP_PARTIAL_AREA);
|
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_partial_area_error"));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
builder.terrainType(optTerrain.get());
|
builder.terrainType(optTerrain.get());
|
||||||
@ -207,19 +191,19 @@ public enum CommonSetupSteps implements SetupStep {
|
|||||||
return PlotAreaTerrainType.NONE.toString();
|
return PlotAreaTerrainType.NONE.toString();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CHOOSE_WORLD_NAME(Captions.SETUP_WORLD_NAME) {
|
CHOOSE_WORLD_NAME(TranslatableCaption.of("setup.setup_world_name")) {
|
||||||
|
|
||||||
@Override public SetupStep handleInput(PlotPlayer<?> plotPlayer, PlotAreaBuilder builder, String argument) {
|
@Override public SetupStep handleInput(PlotPlayer<?> plotPlayer, PlotAreaBuilder builder, String argument) {
|
||||||
if (!isValidWorldName(argument)) {
|
if (!isValidWorldName(argument)) {
|
||||||
MainUtil.sendMessage(plotPlayer, Captions.SETUP_WORLD_NAME_FORMAT + argument);
|
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_world_name_format"));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
if (WorldUtil.IMP.isWorld(argument)) {
|
if (WorldUtil.IMP.isWorld(argument)) {
|
||||||
if (PlotSquared.get().hasPlotArea(argument)) {
|
if (PlotSquared.get().hasPlotArea(argument)) {
|
||||||
MainUtil.sendMessage(plotPlayer, Captions.SETUP_WORLD_TAKEN, argument);
|
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_world_taken"));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(plotPlayer, Captions.SETUP_WORLD_APPLY_PLOTSQUARED);
|
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_world_apply_plotsquared"));
|
||||||
}
|
}
|
||||||
builder.worldName(argument);
|
builder.worldName(argument);
|
||||||
plotPlayer.deleteMeta("setup");
|
plotPlayer.deleteMeta("setup");
|
||||||
@ -232,10 +216,10 @@ public enum CommonSetupSteps implements SetupStep {
|
|||||||
try {
|
try {
|
||||||
plotPlayer.teleport(WorldUtil.IMP.getSpawn(world), TeleportCause.COMMAND);
|
plotPlayer.teleport(WorldUtil.IMP.getSpawn(world), TeleportCause.COMMAND);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
plotPlayer.sendMessage("&cAn error occurred. See console for more information");
|
plotPlayer.sendMessage(TranslatableCaption.of("errors.error_console"));
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
sendMessage(plotPlayer, Captions.SETUP_FINISHED, builder.worldName());
|
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_finished"));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,7 +251,7 @@ public enum CommonSetupSteps implements SetupStep {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public void announce(PlotPlayer<?> plotPlayer) {
|
@Override public void announce(PlotPlayer<?> plotPlayer) {
|
||||||
MainUtil.sendMessage(plotPlayer, this.description);
|
plotPlayer.sendMessage(this.description);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <E extends Enum<E>> Collection<String> enumToStrings(Class<E> type) {
|
private static <E extends Enum<E>> Collection<String> enumToStrings(Class<E> type) {
|
||||||
|
@ -27,11 +27,11 @@ package com.plotsquared.core.util;
|
|||||||
|
|
||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
import com.plotsquared.core.command.Like;
|
import com.plotsquared.core.command.Like;
|
||||||
import com.plotsquared.core.configuration.Caption;
|
|
||||||
import com.plotsquared.core.configuration.CaptionUtility;
|
import com.plotsquared.core.configuration.CaptionUtility;
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.Captions;
|
||||||
import com.plotsquared.core.configuration.ConfigurationSection;
|
import com.plotsquared.core.configuration.ConfigurationSection;
|
||||||
import com.plotsquared.core.configuration.Settings;
|
import com.plotsquared.core.configuration.Settings;
|
||||||
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.database.DBFunc;
|
import com.plotsquared.core.database.DBFunc;
|
||||||
import com.plotsquared.core.location.Location;
|
import com.plotsquared.core.location.Location;
|
||||||
import com.plotsquared.core.player.ConsolePlayer;
|
import com.plotsquared.core.player.ConsolePlayer;
|
||||||
@ -558,14 +558,14 @@ public class MainUtil {
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (message) {
|
if (message && player != null) {
|
||||||
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID);
|
player.sendMessage(TranslatableCaption.of("invalid.not_valid_plot_id"));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
if (message) {
|
if (message && player != null) {
|
||||||
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD);
|
player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,8 @@ package com.plotsquared.core.util.task;
|
|||||||
|
|
||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
import com.plotsquared.core.command.Auto;
|
import com.plotsquared.core.command.Auto;
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.caption.Templates;
|
||||||
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.events.PlotMergeEvent;
|
import com.plotsquared.core.events.PlotMergeEvent;
|
||||||
import com.plotsquared.core.events.Result;
|
import com.plotsquared.core.events.Result;
|
||||||
import com.plotsquared.core.location.Direction;
|
import com.plotsquared.core.location.Direction;
|
||||||
@ -36,8 +37,6 @@ import com.plotsquared.core.plot.Plot;
|
|||||||
import com.plotsquared.core.plot.PlotArea;
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
import static com.plotsquared.core.util.MainUtil.sendMessage;
|
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public final class AutoClaimFinishTask extends RunnableVal<Object> {
|
public final class AutoClaimFinishTask extends RunnableVal<Object> {
|
||||||
|
|
||||||
@ -49,7 +48,7 @@ public final class AutoClaimFinishTask extends RunnableVal<Object> {
|
|||||||
@Override public void run(Object value) {
|
@Override public void run(Object value) {
|
||||||
player.deleteMeta(Auto.class.getName());
|
player.deleteMeta(Auto.class.getName());
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
sendMessage(player, Captions.NO_FREE_PLOTS);
|
player.sendMessage(TranslatableCaption.of("errors.no_free_plots"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
plot.claim(player, true, schematic, false);
|
plot.claim(player, true, schematic, false);
|
||||||
@ -57,7 +56,8 @@ public final class AutoClaimFinishTask extends RunnableVal<Object> {
|
|||||||
PlotMergeEvent event = PlotSquared.get().getEventDispatcher()
|
PlotMergeEvent event = PlotSquared.get().getEventDispatcher()
|
||||||
.callMerge(plot, Direction.ALL, Integer.MAX_VALUE, player);
|
.callMerge(plot, Direction.ALL, Integer.MAX_VALUE, player);
|
||||||
if (event.getEventResult() == Result.DENY) {
|
if (event.getEventResult() == Result.DENY) {
|
||||||
sendMessage(player, Captions.EVENT_DENIED, "Auto merge");
|
player.sendMessage(TranslatableCaption.of("events.event_denied"),
|
||||||
|
Templates.of("value", "Auto Merge"));
|
||||||
} else {
|
} else {
|
||||||
plot.autoMerge(event.getDir(), event.getMax(), player.getUUID(), true);
|
plot.autoMerge(event.getDir(), event.getMax(), player.getUUID(), true);
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@
|
|||||||
|
|
||||||
"commandconfig.not_valid_subcommand": "<prefix><gray>That is not a valid subcommand.</gray>",
|
"commandconfig.not_valid_subcommand": "<prefix><gray>That is not a valid subcommand.</gray>",
|
||||||
"commandconfig.did_you_mean": "<prefix><gray>Did you mean: <gold><value></gold></gray>",
|
"commandconfig.did_you_mean": "<prefix><gray>Did you mean: <gold><value></gold></gray>",
|
||||||
"commandconfig.subcommand_set_options_header": "<prefix><gray>Possible Values: ",
|
"commandconfig.subcommand_set_options_header": "<prefix><gray>Possible Values: <values>",
|
||||||
"commandconfig.command_syntax": "<prefix><gold>Usage: <gray><value></gray></gold>",
|
"commandconfig.command_syntax": "<prefix><gold>Usage: <gray><value></gray></gold>",
|
||||||
"commandconfig.flag_tutorial_usage": "<prefix><gold>Have an admin set the flag: <gray><flag></gray></gold>",
|
"commandconfig.flag_tutorial_usage": "<prefix><gold>Have an admin set the flag: <gray><flag></gray></gold>",
|
||||||
|
|
||||||
@ -226,6 +226,7 @@
|
|||||||
"errors.invalid_player_offline": "<prefix><red>The player must be online: <gray><player></gray>.</red>",
|
"errors.invalid_player_offline": "<prefix><red>The player must be online: <gray><player></gray>.</red>",
|
||||||
"errors.invalid_command_flag": "<prefix><red>Invalid command flag: </red><value></gray>",
|
"errors.invalid_command_flag": "<prefix><red>Invalid command flag: </red><value></gray>",
|
||||||
"errors.error": "<prefix><red>An error occurred: </gray><value></gray></red>",
|
"errors.error": "<prefix><red>An error occurred: </gray><value></gray></red>",
|
||||||
|
"errors.error_console": "<prefix><red>An error occurred. See the console for more information.</red>",
|
||||||
"errors.command_went_wrong": "<prefix><red>Something went wrong when executing that command...</red>",
|
"errors.command_went_wrong": "<prefix><red>Something went wrong when executing that command...</red>",
|
||||||
"errors.no_free_plots": "<prefix><red>There are no free plots available.</red>",
|
"errors.no_free_plots": "<prefix><red>There are no free plots available.</red>",
|
||||||
"errors.not_in_plot": "<prefix><red>You're not in a plot.</red>",
|
"errors.not_in_plot": "<prefix><red>You're not in a plot.</red>",
|
||||||
|
Loading…
Reference in New Issue
Block a user