mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +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.types.IntegerFlag;
|
||||
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.MathMan;
|
||||
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.Captions;
|
||||
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.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.expiration.ExpireManager;
|
||||
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||
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.MainUtil;
|
||||
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.query.PlotQuery;
|
||||
import com.plotsquared.core.util.query.SortingStrategy;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import com.plotsquared.core.uuid.UUIDMapping;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -111,9 +111,9 @@ public class ListCmd extends SubCommand {
|
||||
return args.toArray(new String[args.size()]);
|
||||
}
|
||||
|
||||
public void noArgs(PlotPlayer player) {
|
||||
MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.getTranslated() + Arrays
|
||||
.toString(getArgumentList(player)));
|
||||
public void noArgs(PlotPlayer<?> player) {
|
||||
player.sendMessage(TranslatableCaption.of("commandconfig.subcommand_set_options_header"),
|
||||
Templates.of("values", Arrays.toString(getArgumentList(player))));
|
||||
}
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer<?> player, String[] args) {
|
||||
@ -162,7 +162,7 @@ public class ListCmd extends SubCommand {
|
||||
final List<Plot> plots = query.asList();
|
||||
|
||||
if (plots.isEmpty()) {
|
||||
MainUtil.sendMessage(player, Captions.FOUND_NO_PLOTS);
|
||||
player.sendMessage(TranslatableCaption.of("invalid.found_no_plots"));
|
||||
return;
|
||||
}
|
||||
displayPlots(player, plots, 12, page, args);
|
||||
@ -171,8 +171,8 @@ public class ListCmd extends SubCommand {
|
||||
switch (arg) {
|
||||
case "mine":
|
||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_MINE)) {
|
||||
MainUtil
|
||||
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_MINE);
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.mine"));
|
||||
return false;
|
||||
}
|
||||
sort[0] = false;
|
||||
@ -180,31 +180,29 @@ public class ListCmd extends SubCommand {
|
||||
break;
|
||||
case "shared":
|
||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_SHARED)) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_LIST_SHARED);
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.shared"));
|
||||
return false;
|
||||
}
|
||||
plotConsumer.accept(PlotQuery.newQuery().withMember(player.getUUID()).thatPasses(plot -> !plot.isOwnerAbs(player.getUUID())));
|
||||
break;
|
||||
case "world":
|
||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_WORLD)) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_LIST_WORLD);
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.world"));
|
||||
return false;
|
||||
}
|
||||
if (!Permissions.hasPermission(player, CaptionUtility
|
||||
.format(player, Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility
|
||||
.format(player, Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(),
|
||||
world));
|
||||
if (!Permissions.hasPermission(player, "plots.list.world." + world)) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.world" + world));
|
||||
return false;
|
||||
}
|
||||
plotConsumer.accept(PlotQuery.newQuery().inWorld(world));
|
||||
break;
|
||||
case "expired":
|
||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_EXPIRED)) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_LIST_EXPIRED);
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.expired"));
|
||||
return false;
|
||||
}
|
||||
if (ExpireManager.IMP == null) {
|
||||
@ -215,15 +213,13 @@ public class ListCmd extends SubCommand {
|
||||
break;
|
||||
case "area":
|
||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_AREA)) {
|
||||
MainUtil
|
||||
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_AREA);
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.area"));
|
||||
return false;
|
||||
}
|
||||
if (!Permissions.hasPermission(player, CaptionUtility
|
||||
.format(player, Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility
|
||||
.format(player, Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(),
|
||||
world));
|
||||
if (!Permissions.hasPermission(player, "plots.list.world." + world)) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.world" + world));
|
||||
return false;
|
||||
}
|
||||
if (area == null) {
|
||||
@ -234,16 +230,16 @@ public class ListCmd extends SubCommand {
|
||||
break;
|
||||
case "all":
|
||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_ALL)) {
|
||||
MainUtil
|
||||
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_ALL);
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.all"));
|
||||
return false;
|
||||
}
|
||||
plotConsumer.accept(PlotQuery.newQuery().allPlots());
|
||||
break;
|
||||
case "done":
|
||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_DONE)) {
|
||||
MainUtil
|
||||
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_DONE);
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.done"));
|
||||
return false;
|
||||
}
|
||||
sort[0] = false;
|
||||
@ -251,8 +247,8 @@ public class ListCmd extends SubCommand {
|
||||
break;
|
||||
case "top":
|
||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_TOP)) {
|
||||
MainUtil
|
||||
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_TOP);
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.top"));
|
||||
return false;
|
||||
}
|
||||
sort[0] = false;
|
||||
@ -260,8 +256,8 @@ public class ListCmd extends SubCommand {
|
||||
break;
|
||||
case "forsale":
|
||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_FOR_SALE)) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_LIST_FOR_SALE);
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.forsale"));
|
||||
return false;
|
||||
}
|
||||
if (EconHandler.getEconHandler() == null) {
|
||||
@ -271,20 +267,21 @@ public class ListCmd extends SubCommand {
|
||||
break;
|
||||
case "unowned":
|
||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_UNOWNED)) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_LIST_UNOWNED);
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.unowned"));
|
||||
return false;
|
||||
}
|
||||
plotConsumer.accept(PlotQuery.newQuery().allPlots().thatPasses(plot -> plot.getOwner() == null));
|
||||
break;
|
||||
case "fuzzy":
|
||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_FUZZY)) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_LIST_FUZZY);
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.fuzzy"));
|
||||
return false;
|
||||
}
|
||||
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;
|
||||
}
|
||||
String term;
|
||||
@ -299,16 +296,13 @@ public class ListCmd extends SubCommand {
|
||||
default:
|
||||
if (PlotSquared.get().hasPlotArea(args[0])) {
|
||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_WORLD)) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_LIST_WORLD);
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.world"));
|
||||
return false;
|
||||
}
|
||||
if (!Permissions.hasPermission(player, CaptionUtility
|
||||
.format(player, Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(),
|
||||
args[0]))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility
|
||||
.format(player, Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(),
|
||||
args[0]));
|
||||
if (!Permissions.hasPermission(player, "plots.list.world." + args[0])) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.world." + args[0]));
|
||||
return false;
|
||||
}
|
||||
plotConsumer.accept(PlotQuery.newQuery().inWorld(args[0]));
|
||||
@ -318,7 +312,7 @@ public class ListCmd extends SubCommand {
|
||||
PlotSquared.get().getImpromptuUUIDPipeline()
|
||||
.getSingle(args[0], (uuid, throwable) -> {
|
||||
if (throwable instanceof TimeoutException) {
|
||||
MainUtil.sendMessage(player, Captions.FETCHING_PLAYERS_TIMEOUT);
|
||||
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
||||
} else if (throwable != null) {
|
||||
if (uuid == null) {
|
||||
try {
|
||||
@ -328,12 +322,13 @@ public class ListCmd extends SubCommand {
|
||||
}
|
||||
}
|
||||
if (uuid == null) {
|
||||
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
|
||||
player.sendMessage(TranslatableCaption.of("errors.invalid_player"),
|
||||
Templates.of("value", args[0]));
|
||||
} else {
|
||||
if (!Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_LIST_PLAYER)) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_LIST_PLAYER);
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.player"));
|
||||
} else {
|
||||
sort[0] = false;
|
||||
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.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.generator.GeneratorWrapper;
|
||||
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.PlotAreaType;
|
||||
import com.plotsquared.core.plot.PlotId;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.SetupUtils;
|
||||
import com.plotsquared.core.util.StringMan;
|
||||
import com.plotsquared.core.util.WorldUtil;
|
||||
@ -49,18 +48,12 @@ import java.util.Collections;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.plotsquared.core.util.MainUtil.sendMessage;
|
||||
|
||||
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) {
|
||||
if (!SetupUtils.generators.containsKey(arg)) {
|
||||
String prefix = "\n&8 - &7";
|
||||
sendMessage(plotPlayer, Captions.SETUP_WORLD_GENERATOR_ERROR + prefix + StringMan
|
||||
.join(SetupUtils.generators.keySet(), prefix)
|
||||
.replaceAll(PlotSquared.imp().getPluginName(),
|
||||
"&2" + PlotSquared.imp().getPluginName()));
|
||||
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_world_generator_error"));
|
||||
return this; // invalid input -> same setup step
|
||||
}
|
||||
builder.generatorName(arg);
|
||||
@ -75,21 +68,12 @@ public enum CommonSetupSteps implements SetupStep {
|
||||
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) {
|
||||
boolean withNormal = SetupUtils.generators.get(builder.generatorName()).isFull();
|
||||
Optional<PlotAreaType> plotAreaType = PlotAreaType.fromString(arg);
|
||||
if (!plotAreaType.isPresent()) {
|
||||
MainUtil.sendMessage(plotPlayer, Captions.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());
|
||||
});
|
||||
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_world_type_error"));
|
||||
return this;
|
||||
}
|
||||
builder.plotAreaType(plotAreaType.get());
|
||||
@ -111,7 +95,7 @@ public enum CommonSetupSteps implements SetupStep {
|
||||
.processAreaSetup(builder);
|
||||
} else {
|
||||
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()));
|
||||
// TODO why is processSetup not called here?
|
||||
}
|
||||
@ -127,16 +111,16 @@ public enum CommonSetupSteps implements SetupStep {
|
||||
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) {
|
||||
if (!StringMan.isAlphanumericUnd(argument)) {
|
||||
MainUtil.sendMessage(plotPlayer, Captions.SETUP_AREA_NON_ALPHANUMERICAL);
|
||||
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_area_non_alphanumerical"));
|
||||
return this;
|
||||
}
|
||||
for (PlotArea area : PlotSquared.get().getPlotAreas()) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -148,16 +132,16 @@ public enum CommonSetupSteps implements SetupStep {
|
||||
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) {
|
||||
try {
|
||||
builder.minimumId(PlotId.fromString(argument));
|
||||
} 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;
|
||||
} 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 CHOOSE_MAXIMUM_PLOT_ID;
|
||||
@ -167,16 +151,16 @@ public enum CommonSetupSteps implements SetupStep {
|
||||
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) {
|
||||
try {
|
||||
builder.maximumId(PlotId.fromString(argument));
|
||||
} 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;
|
||||
} 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 CHOOSE_TERRAIN_TYPE;
|
||||
@ -186,13 +170,13 @@ public enum CommonSetupSteps implements SetupStep {
|
||||
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) {
|
||||
Optional<PlotAreaTerrainType> optTerrain;
|
||||
if (!(optTerrain = PlotAreaTerrainType.fromString(argument))
|
||||
.isPresent()) {
|
||||
MainUtil.sendMessage(plotPlayer, Captions.SETUP_PARTIAL_AREA_ERROR, Captions.SETUP_PARTIAL_AREA);
|
||||
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_partial_area_error"));
|
||||
return this;
|
||||
}
|
||||
builder.terrainType(optTerrain.get());
|
||||
@ -207,19 +191,19 @@ public enum CommonSetupSteps implements SetupStep {
|
||||
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) {
|
||||
if (!isValidWorldName(argument)) {
|
||||
MainUtil.sendMessage(plotPlayer, Captions.SETUP_WORLD_NAME_FORMAT + argument);
|
||||
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_world_name_format"));
|
||||
return this;
|
||||
}
|
||||
if (WorldUtil.IMP.isWorld(argument)) {
|
||||
if (PlotSquared.get().hasPlotArea(argument)) {
|
||||
MainUtil.sendMessage(plotPlayer, Captions.SETUP_WORLD_TAKEN, argument);
|
||||
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_world_taken"));
|
||||
return this;
|
||||
}
|
||||
MainUtil.sendMessage(plotPlayer, Captions.SETUP_WORLD_APPLY_PLOTSQUARED);
|
||||
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_world_apply_plotsquared"));
|
||||
}
|
||||
builder.worldName(argument);
|
||||
plotPlayer.deleteMeta("setup");
|
||||
@ -232,10 +216,10 @@ public enum CommonSetupSteps implements SetupStep {
|
||||
try {
|
||||
plotPlayer.teleport(WorldUtil.IMP.getSpawn(world), TeleportCause.COMMAND);
|
||||
} catch (Exception e) {
|
||||
plotPlayer.sendMessage("&cAn error occurred. See console for more information");
|
||||
plotPlayer.sendMessage(TranslatableCaption.of("errors.error_console"));
|
||||
e.printStackTrace();
|
||||
}
|
||||
sendMessage(plotPlayer, Captions.SETUP_FINISHED, builder.worldName());
|
||||
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_finished"));
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -267,7 +251,7 @@ public enum CommonSetupSteps implements SetupStep {
|
||||
}
|
||||
|
||||
@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) {
|
||||
|
@ -27,11 +27,11 @@ package com.plotsquared.core.util;
|
||||
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.command.Like;
|
||||
import com.plotsquared.core.configuration.Caption;
|
||||
import com.plotsquared.core.configuration.CaptionUtility;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.ConfigurationSection;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.database.DBFunc;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.player.ConsolePlayer;
|
||||
@ -558,14 +558,14 @@ public class MainUtil {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
if (message) {
|
||||
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID);
|
||||
if (message && player != null) {
|
||||
player.sendMessage(TranslatableCaption.of("invalid.not_valid_plot_id"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (area == null) {
|
||||
if (message) {
|
||||
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD);
|
||||
if (message && player != null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -27,7 +27,8 @@ package com.plotsquared.core.util.task;
|
||||
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
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.Result;
|
||||
import com.plotsquared.core.location.Direction;
|
||||
@ -36,8 +37,6 @@ import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import static com.plotsquared.core.util.MainUtil.sendMessage;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public final class AutoClaimFinishTask extends RunnableVal<Object> {
|
||||
|
||||
@ -49,7 +48,7 @@ public final class AutoClaimFinishTask extends RunnableVal<Object> {
|
||||
@Override public void run(Object value) {
|
||||
player.deleteMeta(Auto.class.getName());
|
||||
if (plot == null) {
|
||||
sendMessage(player, Captions.NO_FREE_PLOTS);
|
||||
player.sendMessage(TranslatableCaption.of("errors.no_free_plots"));
|
||||
return;
|
||||
}
|
||||
plot.claim(player, true, schematic, false);
|
||||
@ -57,7 +56,8 @@ public final class AutoClaimFinishTask extends RunnableVal<Object> {
|
||||
PlotMergeEvent event = PlotSquared.get().getEventDispatcher()
|
||||
.callMerge(plot, Direction.ALL, Integer.MAX_VALUE, player);
|
||||
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 {
|
||||
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.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.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_command_flag": "<prefix><red>Invalid command flag: </red><value></gray>",
|
||||
"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.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>",
|
||||
|
Loading…
Reference in New Issue
Block a user