mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Replace some common messages
This commit is contained in:
parent
4d24112ec7
commit
7e0cdb12d7
@ -239,7 +239,9 @@ public class Auto extends SubCommand {
|
|||||||
PlayerAutoPlotEvent event = this.eventDispatcher
|
PlayerAutoPlotEvent event = this.eventDispatcher
|
||||||
.callAuto(player, plotarea, schematic, size_x, size_z);
|
.callAuto(player, plotarea, schematic, size_x, size_z);
|
||||||
if (event.getEventResult() == Result.DENY) {
|
if (event.getEventResult() == Result.DENY) {
|
||||||
sendMessage(player, Captions.EVENT_DENIED, "Auto claim");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("events.event_denied"),
|
||||||
|
Template.of("value", "Auto claim"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
boolean force = event.getEventResult() == Result.FORCE;
|
boolean force = event.getEventResult() == Result.FORCE;
|
||||||
@ -320,7 +322,9 @@ public class Auto extends SubCommand {
|
|||||||
final PlotAutoMergeEvent mergeEvent = this.eventDispatcher
|
final PlotAutoMergeEvent mergeEvent = this.eventDispatcher
|
||||||
.callAutoMerge(plotarea.getPlotAbs(pos1), plotIds);
|
.callAutoMerge(plotarea.getPlotAbs(pos1), plotIds);
|
||||||
if (!force && mergeEvent.getEventResult() == Result.DENY) {
|
if (!force && mergeEvent.getEventResult() == Result.DENY) {
|
||||||
sendMessage(player, Captions.EVENT_DENIED, "Auto merge");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("events.event_denied"),
|
||||||
|
Template.of("value", "Auto merge"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plotarea.mergePlots(mergeEvent.getPlots(), true)) {
|
if (!plotarea.mergePlots(mergeEvent.getPlots(), true)) {
|
||||||
|
@ -31,6 +31,7 @@ import com.plotsquared.core.backup.BackupProfile;
|
|||||||
import com.plotsquared.core.backup.NullBackupProfile;
|
import com.plotsquared.core.backup.NullBackupProfile;
|
||||||
import com.plotsquared.core.backup.PlayerBackupProfile;
|
import com.plotsquared.core.backup.PlayerBackupProfile;
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.Captions;
|
||||||
|
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.util.Permissions;
|
import com.plotsquared.core.util.Permissions;
|
||||||
@ -128,7 +129,7 @@ public final class Backup extends Command {
|
|||||||
final RunnableVal2<Command, CommandResult> whenDone) {
|
final RunnableVal2<Command, CommandResult> whenDone) {
|
||||||
final Plot plot = player.getCurrentPlot();
|
final Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
sendMessage(player, Captions.BACKUP_IMPOSSIBLE,
|
sendMessage(player, Captions.BACKUP_IMPOSSIBLE,
|
||||||
Captions.GENERIC_UNOWNED.getTranslated());
|
Captions.GENERIC_UNOWNED.getTranslated());
|
||||||
@ -167,7 +168,7 @@ public final class Backup extends Command {
|
|||||||
final RunnableVal2<Command, CommandResult> whenDone) {
|
final RunnableVal2<Command, CommandResult> whenDone) {
|
||||||
final Plot plot = player.getCurrentPlot();
|
final Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
sendMessage(player, Captions.BACKUP_IMPOSSIBLE,
|
sendMessage(player, Captions.BACKUP_IMPOSSIBLE,
|
||||||
Captions.GENERIC_UNOWNED.getTranslated());
|
Captions.GENERIC_UNOWNED.getTranslated());
|
||||||
@ -218,7 +219,7 @@ public final class Backup extends Command {
|
|||||||
final RunnableVal2<Command, CommandResult> whenDone) {
|
final RunnableVal2<Command, CommandResult> whenDone) {
|
||||||
final Plot plot = player.getCurrentPlot();
|
final Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
sendMessage(player, Captions.BACKUP_IMPOSSIBLE,
|
sendMessage(player, Captions.BACKUP_IMPOSSIBLE,
|
||||||
Captions.GENERIC_UNOWNED.getTranslated());
|
Captions.GENERIC_UNOWNED.getTranslated());
|
||||||
|
@ -26,13 +26,14 @@
|
|||||||
package com.plotsquared.core.command;
|
package com.plotsquared.core.command;
|
||||||
|
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.Captions;
|
||||||
|
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.util.MainUtil;
|
|
||||||
import com.plotsquared.core.util.StringMan;
|
import com.plotsquared.core.util.StringMan;
|
||||||
import com.sk89q.worldedit.command.util.SuggestionHelper;
|
import com.sk89q.worldedit.command.util.SuggestionHelper;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@ -56,20 +57,22 @@ public class Biome extends SetCommand {
|
|||||||
if (biome == null) {
|
if (biome == null) {
|
||||||
String biomes = StringMan
|
String biomes = StringMan
|
||||||
.join(BiomeType.REGISTRY.values(), Captions.BLOCK_LIST_SEPARATOR.getTranslated());
|
.join(BiomeType.REGISTRY.values(), Captions.BLOCK_LIST_SEPARATOR.getTranslated());
|
||||||
Captions.NEED_BIOME.send(player);
|
player.sendMessage(TranslatableCaption.of("biome.need_biome"));
|
||||||
MainUtil.sendMessage(player,
|
player.sendMessage(
|
||||||
Captions.SUBCOMMAND_SET_OPTIONS_HEADER.getTranslated() + biomes);
|
TranslatableCaption.of("commandconfig.subcommand_set_options_header"),
|
||||||
|
Template.of("values", biomes));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot.getRunning() > 0) {
|
if (plot.getRunning() > 0) {
|
||||||
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
|
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plot.addRunning();
|
plot.addRunning();
|
||||||
plot.setBiome(biome, () -> {
|
plot.setBiome(biome, () -> {
|
||||||
plot.removeRunning();
|
plot.removeRunning();
|
||||||
MainUtil
|
player.sendMessage(
|
||||||
.sendMessage(player, Captions.BIOME_SET_TO.getTranslated() + value.toLowerCase());
|
TranslatableCaption.of("biome.biome_set_to"),
|
||||||
|
Template.of("value", value.toLowerCase()));
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ package com.plotsquared.core.command;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.Captions;
|
||||||
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
||||||
import com.plotsquared.core.events.Result;
|
import com.plotsquared.core.events.Result;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
@ -39,6 +40,7 @@ import com.plotsquared.core.util.EventDispatcher;
|
|||||||
import com.plotsquared.core.util.MainUtil;
|
import com.plotsquared.core.util.MainUtil;
|
||||||
import com.plotsquared.core.util.task.RunnableVal2;
|
import com.plotsquared.core.util.task.RunnableVal2;
|
||||||
import com.plotsquared.core.util.task.RunnableVal3;
|
import com.plotsquared.core.util.task.RunnableVal3;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@ -71,7 +73,10 @@ public class Buy extends Command {
|
|||||||
check(this.econHandler, Captions.ECON_DISABLED);
|
check(this.econHandler, Captions.ECON_DISABLED);
|
||||||
final Plot plot;
|
final Plot plot;
|
||||||
if (args.length != 0) {
|
if (args.length != 0) {
|
||||||
checkTrue(args.length == 1, Captions.COMMAND_SYNTAX, getUsage());
|
if (args.length != 1) {
|
||||||
|
sendUsage(player);
|
||||||
|
return CompletableFuture.completedFuture(false);
|
||||||
|
}
|
||||||
plot = check(MainUtil.getPlotFromString(player, args[0], true), null);
|
plot = check(MainUtil.getPlotFromString(player, args[0], true), null);
|
||||||
} else {
|
} else {
|
||||||
plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT);
|
plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT);
|
||||||
@ -90,13 +95,20 @@ public class Buy extends Command {
|
|||||||
// Failure
|
// Failure
|
||||||
// Success
|
// Success
|
||||||
confirm.run(this, () -> {
|
confirm.run(this, () -> {
|
||||||
Captions.REMOVED_BALANCE.send(player, price);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("economy.removed_balance"),
|
||||||
|
Template.of("money", String.valueOf(price)));
|
||||||
|
|
||||||
this.econHandler.depositMoney(PlotSquared.platform().getPlayerManager().getOfflinePlayer(plot.getOwnerAbs()), price);
|
this.econHandler.depositMoney(PlotSquared.platform().getPlayerManager().getOfflinePlayer(plot.getOwnerAbs()), price);
|
||||||
|
|
||||||
PlotPlayer owner = PlotSquared.platform().getPlayerManager().getPlayerIfExists(plot.getOwnerAbs());
|
PlotPlayer owner = PlotSquared.platform().getPlayerManager().getPlayerIfExists(plot.getOwnerAbs());
|
||||||
if (owner != null) {
|
if (owner != null) {
|
||||||
Captions.PLOT_SOLD.send(owner, plot.getId(), player.getName(), price);
|
owner.sendMessage(
|
||||||
|
TranslatableCaption.of("economy.plot_sold"),
|
||||||
|
Template.of("plot", plot.getId().toString()),
|
||||||
|
Template.of("player", player.getName()),
|
||||||
|
Template.of("price", String.valueOf(price))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(PriceFlag.class);
|
PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(PriceFlag.class);
|
||||||
PlotFlagRemoveEvent event = this.eventDispatcher.callFlagRemove(plotFlag, plot);
|
PlotFlagRemoveEvent event = this.eventDispatcher.callFlagRemove(plotFlag, plot);
|
||||||
@ -104,7 +116,7 @@ public class Buy extends Command {
|
|||||||
plot.removeFlag(event.getFlag());
|
plot.removeFlag(event.getFlag());
|
||||||
}
|
}
|
||||||
plot.setOwner(player.getUUID());
|
plot.setOwner(player.getUUID());
|
||||||
Captions.CLAIMED.send(player);
|
player.sendMessage(TranslatableCaption.of("working.claimed"));
|
||||||
whenDone.run(Buy.this, CommandResult.SUCCESS);
|
whenDone.run(Buy.this, CommandResult.SUCCESS);
|
||||||
}, () -> {
|
}, () -> {
|
||||||
player.deposit(price);
|
player.deposit(price);
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
package com.plotsquared.core.command;
|
package com.plotsquared.core.command;
|
||||||
|
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.Captions;
|
||||||
|
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.flag.PlotFlag;
|
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||||
@ -36,6 +37,7 @@ import com.plotsquared.core.plot.flag.implementations.MiscCapFlag;
|
|||||||
import com.plotsquared.core.plot.flag.implementations.MobCapFlag;
|
import com.plotsquared.core.plot.flag.implementations.MobCapFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.VehicleCapFlag;
|
import com.plotsquared.core.plot.flag.implementations.VehicleCapFlag;
|
||||||
import com.plotsquared.core.util.Permissions;
|
import com.plotsquared.core.util.Permissions;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
|
||||||
import static com.plotsquared.core.util.entity.EntityCategories.CAP_ANIMAL;
|
import static com.plotsquared.core.util.entity.EntityCategories.CAP_ANIMAL;
|
||||||
import static com.plotsquared.core.util.entity.EntityCategories.CAP_ENTITY;
|
import static com.plotsquared.core.util.entity.EntityCategories.CAP_ENTITY;
|
||||||
@ -53,13 +55,17 @@ public class Caps extends SubCommand {
|
|||||||
@Override public boolean onCommand(final PlotPlayer<?> player, final String[] args) {
|
@Override public boolean onCommand(final PlotPlayer<?> player, final String[] args) {
|
||||||
final Plot plot = player.getCurrentPlot();
|
final Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return Captions.NOT_IN_PLOT.send(player);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.isAdded(player.getUUID()) && !Permissions
|
if (!plot.isAdded(player.getUUID()) && !Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_ADMIN_CAPS_OTHER)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_CAPS_OTHER)) {
|
||||||
return Captions.NO_PERMISSION.send(player, Captions.PERMISSION_ADMIN_CAPS_OTHER);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.PERMISSION_ADMIN_CAPS_OTHER.getTranslated()));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
Captions.PLOT_CAPS_HEADER.send(player);
|
player.sendMessage(TranslatableCaption.of("info.plot_caps_header"));
|
||||||
final int[] countedEntities = plot.countEntities();
|
final int[] countedEntities = plot.countEntities();
|
||||||
sendFormatted(plot, player, MobCapFlag.class, countedEntities, "mobs", CAP_MOB);
|
sendFormatted(plot, player, MobCapFlag.class, countedEntities, "mobs", CAP_MOB);
|
||||||
sendFormatted(plot, player, HostileCapFlag.class, countedEntities, "hostile", CAP_MONSTER);
|
sendFormatted(plot, player, HostileCapFlag.class, countedEntities, "hostile", CAP_MONSTER);
|
||||||
@ -76,8 +82,10 @@ public class Caps extends SubCommand {
|
|||||||
final int current = countedEntities[type];
|
final int current = countedEntities[type];
|
||||||
final int max = plot.getFlag(capFlag);
|
final int max = plot.getFlag(capFlag);
|
||||||
final String percentage = String.format("%.1f", 100 * ((float) current / max));
|
final String percentage = String.format("%.1f", 100 * ((float) current / max));
|
||||||
player.sendMessage(Captions.PLOT_CAPS_FORMAT.getTranslated().replace("%cap%", name)
|
player.sendMessage(TranslatableCaption.of("info.plot_caps_format"),
|
||||||
.replace("%current%", Integer.toString(current))
|
Template.of("cap", name),
|
||||||
.replace("%limit%", Integer.toString(max)).replace("%percentage%", percentage));
|
Template.of("current", String.valueOf(current)),
|
||||||
|
Template.of("limit", String.valueOf(max)),
|
||||||
|
Template.of("percentage", percentage));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ import com.google.inject.Inject;
|
|||||||
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.TranslatableCaption;
|
||||||
import com.plotsquared.core.database.DBFunc;
|
import com.plotsquared.core.database.DBFunc;
|
||||||
import com.plotsquared.core.events.PlayerClaimPlotEvent;
|
import com.plotsquared.core.events.PlayerClaimPlotEvent;
|
||||||
import com.plotsquared.core.events.PlotMergeEvent;
|
import com.plotsquared.core.events.PlotMergeEvent;
|
||||||
@ -44,8 +45,7 @@ import com.plotsquared.core.util.EventDispatcher;
|
|||||||
import com.plotsquared.core.util.Expression;
|
import com.plotsquared.core.util.Expression;
|
||||||
import com.plotsquared.core.util.Permissions;
|
import com.plotsquared.core.util.Permissions;
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
import org.slf4j.Logger;
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -75,12 +75,15 @@ public class Claim extends SubCommand {
|
|||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
Plot plot = location.getPlotAbs();
|
Plot plot = location.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
final PlayerClaimPlotEvent event = this.eventDispatcher.callClaim(player, plot, schematic);
|
final PlayerClaimPlotEvent event = this.eventDispatcher.callClaim(player, plot, schematic);
|
||||||
schematic = event.getSchematic();
|
schematic = event.getSchematic();
|
||||||
if (event.getEventResult() == Result.DENY) {
|
if (event.getEventResult() == Result.DENY) {
|
||||||
sendMessage(player, Captions.EVENT_DENIED, "Claim");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("events.event_denied"),
|
||||||
|
Template.of("value", "Claim"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
boolean force = event.getEventResult() == Result.FORCE;
|
boolean force = event.getEventResult() == Result.FORCE;
|
||||||
@ -154,7 +157,9 @@ public class Claim extends SubCommand {
|
|||||||
PlotMergeEvent mergeEvent = Claim.this.eventDispatcher
|
PlotMergeEvent mergeEvent = Claim.this.eventDispatcher
|
||||||
.callMerge(plot, Direction.ALL, Integer.MAX_VALUE, player);
|
.callMerge(plot, Direction.ALL, Integer.MAX_VALUE, player);
|
||||||
if (mergeEvent.getEventResult() == Result.DENY) {
|
if (mergeEvent.getEventResult() == Result.DENY) {
|
||||||
sendMessage(player, Captions.EVENT_DENIED, "Auto merge on claim");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("events.event_denied"),
|
||||||
|
Template.of("value", "Auto merge on claim"));
|
||||||
} else {
|
} else {
|
||||||
plot.autoMerge(mergeEvent.getDir(), mergeEvent.getMax(), player.getUUID(), true);
|
plot.autoMerge(mergeEvent.getDir(), mergeEvent.getMax(), player.getUUID(), true);
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import com.google.inject.Inject;
|
|||||||
import com.plotsquared.core.backup.BackupManager;
|
import com.plotsquared.core.backup.BackupManager;
|
||||||
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.TranslatableCaption;
|
||||||
import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
||||||
import com.plotsquared.core.events.Result;
|
import com.plotsquared.core.events.Result;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
@ -38,16 +39,14 @@ import com.plotsquared.core.plot.flag.implementations.AnalysisFlag;
|
|||||||
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||||
import com.plotsquared.core.queue.GlobalBlockQueue;
|
import com.plotsquared.core.queue.GlobalBlockQueue;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.MainUtil;
|
|
||||||
import com.plotsquared.core.util.Permissions;
|
import com.plotsquared.core.util.Permissions;
|
||||||
import com.plotsquared.core.util.task.RunnableVal2;
|
import com.plotsquared.core.util.task.RunnableVal2;
|
||||||
import com.plotsquared.core.util.task.RunnableVal3;
|
import com.plotsquared.core.util.task.RunnableVal3;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
import static com.plotsquared.core.command.SubCommand.sendMessage;
|
|
||||||
|
|
||||||
@CommandDeclaration(command = "clear",
|
@CommandDeclaration(command = "clear",
|
||||||
description = "Clear the plot you stand on",
|
description = "Clear the plot you stand on",
|
||||||
requiredType = RequiredType.NONE,
|
requiredType = RequiredType.NONE,
|
||||||
@ -72,11 +71,16 @@ public class Clear extends Command {
|
|||||||
public CompletableFuture<Boolean> execute(final PlotPlayer<?> player, String[] args,
|
public CompletableFuture<Boolean> execute(final PlotPlayer<?> player, String[] args,
|
||||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||||
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
|
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
|
||||||
checkTrue(args.length == 0, Captions.COMMAND_SYNTAX, getUsage());
|
if (args.length != 0) {
|
||||||
|
sendUsage(player);
|
||||||
|
return CompletableFuture.completedFuture(false);
|
||||||
|
}
|
||||||
final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT);
|
final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT);
|
||||||
Result eventResult = this.eventDispatcher.callClear(plot).getEventResult();
|
Result eventResult = this.eventDispatcher.callClear(plot).getEventResult();
|
||||||
if (eventResult == Result.DENY) {
|
if (eventResult == Result.DENY) {
|
||||||
sendMessage(player, Captions.EVENT_DENIED, "Clear");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("events.event_denied"),
|
||||||
|
Template.of("value", "Clear"));
|
||||||
return CompletableFuture.completedFuture(true);
|
return CompletableFuture.completedFuture(true);
|
||||||
}
|
}
|
||||||
boolean force = eventResult == Result.FORCE;
|
boolean force = eventResult == Result.FORCE;
|
||||||
@ -112,12 +116,14 @@ public class Clear extends Command {
|
|||||||
plot.removeFlag(event.getFlag());
|
plot.removeFlag(event.getFlag());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, Captions.CLEARING_DONE,
|
player.sendMessage(
|
||||||
"" + (System.currentTimeMillis() - start));
|
TranslatableCaption.of("working.clearing_done"),
|
||||||
|
Template.of("amount", String.valueOf(System.currentTimeMillis() - start))
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
if (!result) {
|
if (!result) {
|
||||||
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
|
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
|
||||||
} else {
|
} else {
|
||||||
plot.addRunning();
|
plot.addRunning();
|
||||||
}
|
}
|
||||||
|
@ -25,11 +25,11 @@
|
|||||||
*/
|
*/
|
||||||
package com.plotsquared.core.command;
|
package com.plotsquared.core.command;
|
||||||
|
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.util.MainUtil;
|
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
import com.plotsquared.core.util.task.TaskTime;
|
import com.plotsquared.core.util.task.TaskTime;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
|
||||||
public class CmdConfirm {
|
public class CmdConfirm {
|
||||||
|
|
||||||
@ -45,7 +45,10 @@ public class CmdConfirm {
|
|||||||
final Runnable runnable) {
|
final Runnable runnable) {
|
||||||
removePending(player);
|
removePending(player);
|
||||||
if (commandStr != null) {
|
if (commandStr != null) {
|
||||||
MainUtil.sendMessage(player, Captions.REQUIRES_CONFIRM, commandStr);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("confirm.requires_confirm"),
|
||||||
|
Template.of("command", commandStr)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
TaskManager.runTaskLater(() -> {
|
TaskManager.runTaskLater(() -> {
|
||||||
CmdInstance cmd = new CmdInstance(runnable);
|
CmdInstance cmd = new CmdInstance(runnable);
|
||||||
|
@ -25,12 +25,16 @@
|
|||||||
*/
|
*/
|
||||||
package com.plotsquared.core.command;
|
package com.plotsquared.core.command;
|
||||||
|
|
||||||
|
import com.plotsquared.core.configuration.Caption;
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.Captions;
|
||||||
|
import com.plotsquared.core.configuration.caption.LocaleHolder;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CommandCategory.
|
* CommandCategory.
|
||||||
*/
|
*/
|
||||||
public enum CommandCategory {
|
public enum CommandCategory implements Caption {
|
||||||
/**
|
/**
|
||||||
* Claiming CommandConfig.
|
* Claiming CommandConfig.
|
||||||
* Such as: /plot claim
|
* Such as: /plot claim
|
||||||
@ -74,13 +78,20 @@ public enum CommandCategory {
|
|||||||
/**
|
/**
|
||||||
* The category name (Readable).
|
* The category name (Readable).
|
||||||
*/
|
*/
|
||||||
private final Captions caption;
|
private final Caption caption;
|
||||||
|
|
||||||
CommandCategory(final Captions caption) {
|
CommandCategory(final Caption caption) {
|
||||||
this.caption = caption;
|
this.caption = caption;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String toString() {
|
// TODO this method shouldn't be invoked
|
||||||
return this.caption.getTranslated();
|
@Deprecated @Override public String toString() {
|
||||||
|
return this.caption.getComponent(LocaleHolder.console());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
@Override
|
||||||
|
public String getComponent(@Nonnull LocaleHolder localeHolder) {
|
||||||
|
return this.caption.getComponent(localeHolder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ public class Condense extends SubCommand {
|
|||||||
|
|
||||||
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||||
if (args.length != 2 && args.length != 3) {
|
if (args.length != 2 && args.length != 3) {
|
||||||
MainUtil.sendMessage(player, getUsage());
|
sendUsage(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[0]);
|
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[0]);
|
||||||
|
@ -28,6 +28,7 @@ package com.plotsquared.core.command;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
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.TranslatableCaption;
|
||||||
import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
||||||
import com.plotsquared.core.events.Result;
|
import com.plotsquared.core.events.Result;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
@ -37,6 +38,7 @@ import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
|||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.MainUtil;
|
import com.plotsquared.core.util.MainUtil;
|
||||||
import com.plotsquared.core.util.Permissions;
|
import com.plotsquared.core.util.Permissions;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
@ -56,7 +58,8 @@ public class Continue extends SubCommand {
|
|||||||
@Override public boolean onCommand(PlotPlayer<?> player, String[] args) {
|
@Override public boolean onCommand(PlotPlayer<?> player, String[] args) {
|
||||||
Plot plot = player.getCurrentPlot();
|
Plot plot = player.getCurrentPlot();
|
||||||
if ((plot == null) || !plot.hasOwner()) {
|
if ((plot == null) || !plot.hasOwner()) {
|
||||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_CONTINUE)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_CONTINUE)) {
|
||||||
@ -82,7 +85,9 @@ public class Continue extends SubCommand {
|
|||||||
PlotFlagRemoveEvent event =
|
PlotFlagRemoveEvent event =
|
||||||
this.eventDispatcher.callFlagRemove(plotFlag, plot);
|
this.eventDispatcher.callFlagRemove(plotFlag, plot);
|
||||||
if (event.getEventResult() == Result.DENY) {
|
if (event.getEventResult() == Result.DENY) {
|
||||||
sendMessage(player, Captions.EVENT_DENIED, "Done flag removal");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("events.event_denied"),
|
||||||
|
Template.of("value", "Done flag removal"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
plot.removeFlag(event.getFlag());
|
plot.removeFlag(event.getFlag());
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
package com.plotsquared.core.command;
|
package com.plotsquared.core.command;
|
||||||
|
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.Captions;
|
||||||
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.location.Location;
|
import com.plotsquared.core.location.Location;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
@ -45,7 +46,8 @@ public class Copy extends SubCommand {
|
|||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
Plot plot1 = location.getPlotAbs();
|
Plot plot1 = location.getPlotAbs();
|
||||||
if (plot1 == null) {
|
if (plot1 == null) {
|
||||||
return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot1.isOwner(player.getUUID()) && !Permissions
|
if (!plot1.isOwner(player.getUUID()) && !Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) {
|
||||||
@ -53,7 +55,7 @@ public class Copy extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
sendUsage(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Plot plot2 = MainUtil.getPlotFromString(player, args[0], true);
|
Plot plot2 = MainUtil.getPlotFromString(player, args[0], true);
|
||||||
@ -62,7 +64,7 @@ public class Copy extends SubCommand {
|
|||||||
}
|
}
|
||||||
if (plot1.equals(plot2)) {
|
if (plot1.equals(plot2)) {
|
||||||
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID);
|
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID);
|
||||||
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
sendUsage(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot1.getArea().isCompatible(plot2.getArea())) {
|
if (!plot1.getArea().isCompatible(plot2.getArea())) {
|
||||||
|
@ -27,6 +27,7 @@ package com.plotsquared.core.command;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.Captions;
|
||||||
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.generator.HybridPlotWorld;
|
import com.plotsquared.core.generator.HybridPlotWorld;
|
||||||
import com.plotsquared.core.generator.HybridUtils;
|
import com.plotsquared.core.generator.HybridUtils;
|
||||||
import com.plotsquared.core.location.Location;
|
import com.plotsquared.core.location.Location;
|
||||||
@ -55,7 +56,8 @@ public class CreateRoadSchematic extends SubCommand {
|
|||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
Plot plot = location.getPlotAbs();
|
Plot plot = location.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (!(location.getPlotArea() instanceof HybridPlotWorld)) {
|
if (!(location.getPlotArea() instanceof HybridPlotWorld)) {
|
||||||
return sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
|
return sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
|
||||||
|
@ -99,7 +99,7 @@ public class DatabaseCommand extends SubCommand {
|
|||||||
|
|
||||||
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
MainUtil.sendMessage(player, getUsage());
|
sendUsage(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
List<Plot> plots;
|
List<Plot> plots;
|
||||||
@ -111,7 +111,7 @@ public class DatabaseCommand extends SubCommand {
|
|||||||
plots = PlotSquared.get().sortPlotsByTemp(PlotQuery.newQuery().allPlots().asList());
|
plots = PlotSquared.get().sortPlotsByTemp(PlotQuery.newQuery().allPlots().asList());
|
||||||
}
|
}
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
MainUtil.sendMessage(player, getUsage());
|
sendUsage(player);
|
||||||
MainUtil.sendMessage(player, "[arg] indicates an optional argument");
|
MainUtil.sendMessage(player, "[arg] indicates an optional argument");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ import com.google.inject.Inject;
|
|||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
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.TranslatableCaption;
|
||||||
import com.plotsquared.core.database.DBFunc;
|
import com.plotsquared.core.database.DBFunc;
|
||||||
import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
||||||
import com.plotsquared.core.events.Result;
|
import com.plotsquared.core.events.Result;
|
||||||
@ -213,7 +214,7 @@ public class DebugExec extends SubCommand {
|
|||||||
case "analyze": {
|
case "analyze": {
|
||||||
Plot plot = player.getCurrentPlot();
|
Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
MainUtil.sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotAnalysis analysis = plot.getComplexity(null);
|
PlotAnalysis analysis = plot.getComplexity(null);
|
||||||
|
@ -28,6 +28,7 @@ package com.plotsquared.core.command;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
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.TranslatableCaption;
|
||||||
import com.plotsquared.core.events.Result;
|
import com.plotsquared.core.events.Result;
|
||||||
import com.plotsquared.core.location.Location;
|
import com.plotsquared.core.location.Location;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
@ -39,6 +40,7 @@ import com.plotsquared.core.util.Expression;
|
|||||||
import com.plotsquared.core.util.MainUtil;
|
import com.plotsquared.core.util.MainUtil;
|
||||||
import com.plotsquared.core.util.Permissions;
|
import com.plotsquared.core.util.Permissions;
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@ -67,14 +69,18 @@ public class Delete extends SubCommand {
|
|||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
final Plot plot = location.getPlotAbs();
|
final Plot plot = location.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return !sendMessage(player, Captions.PLOT_UNOWNED);
|
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
Result eventResult = this.eventDispatcher.callDelete(plot).getEventResult();
|
Result eventResult = this.eventDispatcher.callDelete(plot).getEventResult();
|
||||||
if (eventResult == Result.DENY) {
|
if (eventResult == Result.DENY) {
|
||||||
sendMessage(player, Captions.EVENT_DENIED, "Delete");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("events.event_denied"),
|
||||||
|
Template.of("value", "Delete"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
boolean force = eventResult == Result.FORCE;
|
boolean force = eventResult == Result.FORCE;
|
||||||
|
@ -28,6 +28,7 @@ package com.plotsquared.core.command;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.Captions;
|
||||||
|
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.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
@ -72,7 +73,8 @@ public class Deny extends SubCommand {
|
|||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
Plot plot = location.getPlotAbs();
|
Plot plot = location.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
||||||
|
@ -27,6 +27,7 @@ package com.plotsquared.core.command;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.Captions;
|
||||||
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.events.PlotFlagAddEvent;
|
import com.plotsquared.core.events.PlotFlagAddEvent;
|
||||||
import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
||||||
import com.plotsquared.core.events.Result;
|
import com.plotsquared.core.events.Result;
|
||||||
@ -35,6 +36,7 @@ import com.plotsquared.core.plot.Plot;
|
|||||||
import com.plotsquared.core.plot.flag.implementations.DescriptionFlag;
|
import com.plotsquared.core.plot.flag.implementations.DescriptionFlag;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.MainUtil;
|
import com.plotsquared.core.util.MainUtil;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
@ -57,7 +59,9 @@ public class Desc extends SetCommand {
|
|||||||
if (desc.isEmpty()) {
|
if (desc.isEmpty()) {
|
||||||
PlotFlagRemoveEvent event = this.eventDispatcher.callFlagRemove(plot.getFlagContainer().getFlag(DescriptionFlag.class), plot);
|
PlotFlagRemoveEvent event = this.eventDispatcher.callFlagRemove(plot.getFlagContainer().getFlag(DescriptionFlag.class), plot);
|
||||||
if (event.getEventResult() == Result.DENY) {
|
if (event.getEventResult() == Result.DENY) {
|
||||||
sendMessage(player, Captions.EVENT_DENIED, "Description removal");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("events.event_denied"),
|
||||||
|
Template.of("value", "Description removal"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plot.removeFlag(event.getFlag());
|
plot.removeFlag(event.getFlag());
|
||||||
@ -66,7 +70,9 @@ public class Desc extends SetCommand {
|
|||||||
}
|
}
|
||||||
PlotFlagAddEvent event = this.eventDispatcher.callFlagAdd(plot.getFlagContainer().getFlag(DescriptionFlag.class).createFlagInstance(desc), plot);
|
PlotFlagAddEvent event = this.eventDispatcher.callFlagAdd(plot.getFlagContainer().getFlag(DescriptionFlag.class).createFlagInstance(desc), plot);
|
||||||
if (event.getEventResult() == Result.DENY) {
|
if (event.getEventResult() == Result.DENY) {
|
||||||
sendMessage(player, Captions.EVENT_DENIED, "Description set");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("events.event_denied"),
|
||||||
|
Template.of("value", "Description set"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
boolean result = plot.setFlag(event.getFlag());
|
boolean result = plot.setFlag(event.getFlag());
|
||||||
|
@ -28,6 +28,7 @@ package com.plotsquared.core.command;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
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.TranslatableCaption;
|
||||||
import com.plotsquared.core.events.PlotDoneEvent;
|
import com.plotsquared.core.events.PlotDoneEvent;
|
||||||
import com.plotsquared.core.events.PlotFlagAddEvent;
|
import com.plotsquared.core.events.PlotFlagAddEvent;
|
||||||
import com.plotsquared.core.events.Result;
|
import com.plotsquared.core.events.Result;
|
||||||
@ -43,6 +44,7 @@ import com.plotsquared.core.util.EventDispatcher;
|
|||||||
import com.plotsquared.core.util.MainUtil;
|
import com.plotsquared.core.util.MainUtil;
|
||||||
import com.plotsquared.core.util.Permissions;
|
import com.plotsquared.core.util.Permissions;
|
||||||
import com.plotsquared.core.util.task.RunnableVal;
|
import com.plotsquared.core.util.task.RunnableVal;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
@ -67,11 +69,14 @@ public class Done extends SubCommand {
|
|||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
final Plot plot = location.getPlotAbs();
|
final Plot plot = location.getPlotAbs();
|
||||||
if ((plot == null) || !plot.hasOwner()) {
|
if ((plot == null) || !plot.hasOwner()) {
|
||||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
PlotDoneEvent event = this.eventDispatcher.callDone(plot);
|
PlotDoneEvent event = this.eventDispatcher.callDone(plot);
|
||||||
if (event.getEventResult() == Result.DENY) {
|
if (event.getEventResult() == Result.DENY) {
|
||||||
sendMessage(player, Captions.EVENT_DENIED, "Done");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("events.event_denied"),
|
||||||
|
Template.of("value", "Done"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
boolean force = event.getEventResult() == Result.FORCE;
|
boolean force = event.getEventResult() == Result.FORCE;
|
||||||
|
@ -28,6 +28,7 @@ package com.plotsquared.core.command;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
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.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.flag.implementations.DoneFlag;
|
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||||
@ -71,7 +72,8 @@ public class Download extends SubCommand {
|
|||||||
}
|
}
|
||||||
final Plot plot = player.getCurrentPlot();
|
final Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
||||||
@ -132,7 +134,7 @@ public class Download extends SubCommand {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
sendUsage(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, Captions.GENERATING_LINK);
|
MainUtil.sendMessage(player, Captions.GENERATING_LINK);
|
||||||
|
@ -29,6 +29,7 @@ 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.TranslatableCaption;
|
||||||
import com.plotsquared.core.events.PlotFlagAddEvent;
|
import com.plotsquared.core.events.PlotFlagAddEvent;
|
||||||
import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
||||||
import com.plotsquared.core.events.Result;
|
import com.plotsquared.core.events.Result;
|
||||||
@ -154,7 +155,7 @@ public final class FlagCommand extends Command {
|
|||||||
final Location location = player.getLocation();
|
final Location location = player.getLocation();
|
||||||
final Plot plot = location.getPlotAbs();
|
final Plot plot = location.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
MainUtil.sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
@ -299,7 +300,9 @@ public final class FlagCommand extends Command {
|
|||||||
Plot plot = player.getLocation().getPlotAbs();
|
Plot plot = player.getLocation().getPlotAbs();
|
||||||
PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, plot);
|
PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, plot);
|
||||||
if (event.getEventResult() == Result.DENY) {
|
if (event.getEventResult() == Result.DENY) {
|
||||||
sendMessage(player, Captions.EVENT_DENIED, "Flag set");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("events.event_denied"),
|
||||||
|
Template.of("value", "Flag set"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean force = event.getEventResult() == Result.FORCE;
|
boolean force = event.getEventResult() == Result.FORCE;
|
||||||
@ -344,7 +347,9 @@ public final class FlagCommand extends Command {
|
|||||||
Plot plot = player.getLocation().getPlotAbs();
|
Plot plot = player.getLocation().getPlotAbs();
|
||||||
PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, plot);
|
PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, plot);
|
||||||
if (event.getEventResult() == Result.DENY) {
|
if (event.getEventResult() == Result.DENY) {
|
||||||
sendMessage(player, Captions.EVENT_DENIED, "Flag add");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("events.event_denied"),
|
||||||
|
Template.of("value", "Flag add"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean force = event.getEventResult() == Result.FORCE;
|
boolean force = event.getEventResult() == Result.FORCE;
|
||||||
@ -401,7 +406,9 @@ public final class FlagCommand extends Command {
|
|||||||
final Plot plot = player.getLocation().getPlotAbs();
|
final Plot plot = player.getLocation().getPlotAbs();
|
||||||
PlotFlagRemoveEvent event = new PlotFlagRemoveEvent(flag, plot);
|
PlotFlagRemoveEvent event = new PlotFlagRemoveEvent(flag, plot);
|
||||||
if (event.getEventResult() == Result.DENY) {
|
if (event.getEventResult() == Result.DENY) {
|
||||||
sendMessage(player, Captions.EVENT_DENIED, "Flag remove");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("events.event_denied"),
|
||||||
|
Template.of("value", "Flag remove"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean force = event.getEventResult() == Result.FORCE;
|
boolean force = event.getEventResult() == Result.FORCE;
|
||||||
|
@ -112,7 +112,7 @@ public class Grant extends Command {
|
|||||||
});
|
});
|
||||||
return CompletableFuture.completedFuture(true);
|
return CompletableFuture.completedFuture(true);
|
||||||
}
|
}
|
||||||
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
sendUsage(player);
|
||||||
return CompletableFuture.completedFuture(true);
|
return CompletableFuture.completedFuture(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ public class Help extends Command {
|
|||||||
}
|
}
|
||||||
return CompletableFuture.completedFuture(false);
|
return CompletableFuture.completedFuture(false);
|
||||||
default:
|
default:
|
||||||
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
sendUsage(player);
|
||||||
}
|
}
|
||||||
return CompletableFuture.completedFuture(true);
|
return CompletableFuture.completedFuture(true);
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ public class HomeCommand extends Command {
|
|||||||
return CompletableFuture.completedFuture(false);
|
return CompletableFuture.completedFuture(false);
|
||||||
}
|
}
|
||||||
if (args.length > 2) {
|
if (args.length > 2) {
|
||||||
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
sendUsage(player);
|
||||||
return CompletableFuture.completedFuture(false);
|
return CompletableFuture.completedFuture(false);
|
||||||
}
|
}
|
||||||
PlotQuery query = query(player);
|
PlotQuery query = query(player);
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
package com.plotsquared.core.command;
|
package com.plotsquared.core.command;
|
||||||
|
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.Captions;
|
||||||
|
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.comment.CommentInbox;
|
import com.plotsquared.core.plot.comment.CommentInbox;
|
||||||
@ -89,7 +90,7 @@ public class Inbox extends SubCommand {
|
|||||||
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||||
final Plot plot = player.getCurrentPlot();
|
final Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
@ -97,7 +98,7 @@ public class Inbox extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
sendMessage(player, Captions.COMMAND_SYNTAX, getUsage());
|
sendUsage(player);
|
||||||
for (final CommentInbox inbox : CommentManager.inboxes.values()) {
|
for (final CommentInbox inbox : CommentManager.inboxes.values()) {
|
||||||
if (inbox.canRead(plot, player)) {
|
if (inbox.canRead(plot, player)) {
|
||||||
if (!inbox.getComments(plot, new RunnableVal<List<PlotComment>>() {
|
if (!inbox.getComments(plot, new RunnableVal<List<PlotComment>>() {
|
||||||
@ -185,7 +186,7 @@ public class Inbox extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})) {
|
})) {
|
||||||
sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -204,7 +205,7 @@ public class Inbox extends SubCommand {
|
|||||||
try {
|
try {
|
||||||
page = Integer.parseInt(args[1]);
|
page = Integer.parseInt(args[1]);
|
||||||
} catch (NumberFormatException ignored) {
|
} catch (NumberFormatException ignored) {
|
||||||
sendMessage(player, Captions.COMMAND_SYNTAX, getUsage());
|
sendUsage(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ package com.plotsquared.core.command;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.Captions;
|
||||||
|
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.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
@ -69,7 +70,8 @@ public class Kick extends SubCommand {
|
|||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
Plot plot = location.getPlot();
|
Plot plot = location.getPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if ((!plot.hasOwner() || !plot.isOwner(player.getUUID())) && !Permissions
|
if ((!plot.hasOwner() || !plot.isOwner(player.getUUID())) && !Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_KICK)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_KICK)) {
|
||||||
|
@ -29,6 +29,7 @@ import com.google.inject.Inject;
|
|||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
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.TranslatableCaption;
|
||||||
import com.plotsquared.core.database.DBFunc;
|
import com.plotsquared.core.database.DBFunc;
|
||||||
import com.plotsquared.core.events.PlotRateEvent;
|
import com.plotsquared.core.events.PlotRateEvent;
|
||||||
import com.plotsquared.core.events.TeleportCause;
|
import com.plotsquared.core.events.TeleportCause;
|
||||||
@ -92,7 +93,8 @@ public class Like extends SubCommand {
|
|||||||
case "purge": {
|
case "purge": {
|
||||||
final Plot plot = player.getCurrentPlot();
|
final Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (!Permissions
|
if (!Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_RATE, true)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_RATE, true)) {
|
||||||
@ -106,7 +108,8 @@ public class Like extends SubCommand {
|
|||||||
}
|
}
|
||||||
final Plot plot = player.getCurrentPlot();
|
final Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
sendMessage(player, Captions.RATING_NOT_OWNED);
|
sendMessage(player, Captions.RATING_NOT_OWNED);
|
||||||
|
@ -28,6 +28,7 @@ package com.plotsquared.core.command;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
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.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;
|
||||||
@ -70,7 +71,8 @@ public class Load extends SubCommand {
|
|||||||
}
|
}
|
||||||
final Plot plot = player.getCurrentPlot();
|
final Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
||||||
|
@ -29,6 +29,7 @@ import com.google.inject.Inject;
|
|||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
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.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;
|
||||||
@ -42,6 +43,7 @@ import com.plotsquared.core.util.Expression;
|
|||||||
import com.plotsquared.core.util.MainUtil;
|
import com.plotsquared.core.util.MainUtil;
|
||||||
import com.plotsquared.core.util.Permissions;
|
import com.plotsquared.core.util.Permissions;
|
||||||
import com.plotsquared.core.util.StringMan;
|
import com.plotsquared.core.util.StringMan;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@ -95,7 +97,8 @@ public class Merge extends SubCommand {
|
|||||||
Location location = player.getLocationFull();
|
Location location = player.getLocationFull();
|
||||||
final Plot plot = location.getPlotAbs();
|
final Plot plot = location.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
||||||
@ -141,7 +144,9 @@ public class Merge extends SubCommand {
|
|||||||
PlotMergeEvent event =
|
PlotMergeEvent event =
|
||||||
this.eventDispatcher.callMerge(plot, direction, max, player);
|
this.eventDispatcher.callMerge(plot, direction, max, player);
|
||||||
if (event.getEventResult() == Result.DENY) {
|
if (event.getEventResult() == Result.DENY) {
|
||||||
sendMessage(player, Captions.EVENT_DENIED, "Merge");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("events.event_denied"),
|
||||||
|
Template.of("value", "Merge"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
boolean force = event.getEventResult() == Result.FORCE;
|
boolean force = event.getEventResult() == Result.FORCE;
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.plotsquared.core.command;
|
package com.plotsquared.core.command;
|
||||||
|
|
||||||
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.location.Location;
|
import com.plotsquared.core.location.Location;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
@ -46,7 +46,8 @@ public class Middle extends SubCommand {
|
|||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
Plot plot = location.getPlot();
|
Plot plot = location.getPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
plot.getCenter(center -> player.teleport(center, TeleportCause.COMMAND));
|
plot.getCenter(center -> player.teleport(center, TeleportCause.COMMAND));
|
||||||
return true;
|
return true;
|
||||||
|
@ -27,6 +27,7 @@ package com.plotsquared.core.command;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.Captions;
|
||||||
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.location.Location;
|
import com.plotsquared.core.location.Location;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
@ -61,8 +62,8 @@ public class Move extends SubCommand {
|
|||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
Plot plot1 = location.getPlotAbs();
|
Plot plot1 = location.getPlotAbs();
|
||||||
if (plot1 == null) {
|
if (plot1 == null) {
|
||||||
return CompletableFuture
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
.completedFuture(!MainUtil.sendMessage(player, Captions.NOT_IN_PLOT));
|
return CompletableFuture.completedFuture(false);
|
||||||
}
|
}
|
||||||
if (!plot1.isOwner(player.getUUID()) && !Permissions
|
if (!plot1.isOwner(player.getUUID()) && !Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) {
|
||||||
@ -75,7 +76,7 @@ public class Move extends SubCommand {
|
|||||||
override = true;
|
override = true;
|
||||||
}
|
}
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
sendUsage(player);
|
||||||
return CompletableFuture.completedFuture(false);
|
return CompletableFuture.completedFuture(false);
|
||||||
}
|
}
|
||||||
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[0]);
|
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[0]);
|
||||||
|
@ -27,6 +27,7 @@ package com.plotsquared.core.command;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.Captions;
|
||||||
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.events.PlotFlagAddEvent;
|
import com.plotsquared.core.events.PlotFlagAddEvent;
|
||||||
import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
||||||
import com.plotsquared.core.events.Result;
|
import com.plotsquared.core.events.Result;
|
||||||
@ -39,6 +40,7 @@ import com.plotsquared.core.plot.flag.PlotFlag;
|
|||||||
import com.plotsquared.core.plot.flag.implementations.MusicFlag;
|
import com.plotsquared.core.plot.flag.implementations.MusicFlag;
|
||||||
import com.plotsquared.core.util.InventoryUtil;
|
import com.plotsquared.core.util.InventoryUtil;
|
||||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -68,7 +70,8 @@ public class Music extends SubCommand {
|
|||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
final Plot plot = location.getPlotAbs();
|
final Plot plot = location.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.isAdded(player.getUUID())) {
|
if (!plot.isAdded(player.getUUID())) {
|
||||||
sendMessage(player, Captions.NO_PLOT_PERMS);
|
sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||||
@ -85,7 +88,9 @@ public class Music extends SubCommand {
|
|||||||
.createFlagInstance(item.getType());
|
.createFlagInstance(item.getType());
|
||||||
PlotFlagRemoveEvent event = new PlotFlagRemoveEvent(plotFlag, plot);
|
PlotFlagRemoveEvent event = new PlotFlagRemoveEvent(plotFlag, plot);
|
||||||
if (event.getEventResult() == Result.DENY) {
|
if (event.getEventResult() == Result.DENY) {
|
||||||
sendMessage(player, Captions.EVENT_DENIED, "Music removal");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("events.event_denied"),
|
||||||
|
Template.of("value", "Music removal"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
plot.removeFlag(event.getFlag());
|
plot.removeFlag(event.getFlag());
|
||||||
@ -95,7 +100,9 @@ public class Music extends SubCommand {
|
|||||||
.createFlagInstance(item.getType());
|
.createFlagInstance(item.getType());
|
||||||
PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, plot);
|
PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, plot);
|
||||||
if (event.getEventResult() == Result.DENY) {
|
if (event.getEventResult() == Result.DENY) {
|
||||||
sendMessage(player, Captions.EVENT_DENIED, "Music addition");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("events.event_denied"),
|
||||||
|
Template.of("value", "Music addition"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
plot.setFlag(event.getFlag());
|
plot.setFlag(event.getFlag());
|
||||||
|
@ -29,6 +29,7 @@ import com.google.inject.Inject;
|
|||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
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.TranslatableCaption;
|
||||||
import com.plotsquared.core.events.PlotChangeOwnerEvent;
|
import com.plotsquared.core.events.PlotChangeOwnerEvent;
|
||||||
import com.plotsquared.core.events.PlotUnlinkEvent;
|
import com.plotsquared.core.events.PlotUnlinkEvent;
|
||||||
import com.plotsquared.core.events.Result;
|
import com.plotsquared.core.events.Result;
|
||||||
@ -38,6 +39,7 @@ import com.plotsquared.core.util.EventDispatcher;
|
|||||||
import com.plotsquared.core.util.MainUtil;
|
import com.plotsquared.core.util.MainUtil;
|
||||||
import com.plotsquared.core.util.Permissions;
|
import com.plotsquared.core.util.Permissions;
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -77,7 +79,9 @@ public class Owner extends SetCommand {
|
|||||||
PlotChangeOwnerEvent event = this.eventDispatcher.callOwnerChange(player, plot, plot.hasOwner() ? plot.getOwnerAbs() : null, uuid,
|
PlotChangeOwnerEvent event = this.eventDispatcher.callOwnerChange(player, plot, plot.hasOwner() ? plot.getOwnerAbs() : null, uuid,
|
||||||
plot.hasOwner());
|
plot.hasOwner());
|
||||||
if (event.getEventResult() == Result.DENY) {
|
if (event.getEventResult() == Result.DENY) {
|
||||||
sendMessage(player, Captions.EVENT_DENIED, "Owner change");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("events.event_denied"),
|
||||||
|
Template.of("value", "Owner change"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uuid = event.getNewOwner();
|
uuid = event.getNewOwner();
|
||||||
@ -90,7 +94,9 @@ public class Owner extends SetCommand {
|
|||||||
}
|
}
|
||||||
PlotUnlinkEvent unlinkEvent = this.eventDispatcher.callUnlink(plot.getArea(), plot, false, false, PlotUnlinkEvent.REASON.NEW_OWNER);
|
PlotUnlinkEvent unlinkEvent = this.eventDispatcher.callUnlink(plot.getArea(), plot, false, false, PlotUnlinkEvent.REASON.NEW_OWNER);
|
||||||
if (unlinkEvent.getEventResult() == Result.DENY) {
|
if (unlinkEvent.getEventResult() == Result.DENY) {
|
||||||
sendMessage(player, Captions.EVENT_DENIED, "Unlink on owner change");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("events.event_denied"),
|
||||||
|
Template.of("value", "Unlink on owner change"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
plot.unlinkPlot(unlinkEvent.isCreateRoad(), unlinkEvent.isCreateRoad());
|
plot.unlinkPlot(unlinkEvent.isCreateRoad(), unlinkEvent.isCreateRoad());
|
||||||
|
@ -71,7 +71,7 @@ public class Purge extends SubCommand {
|
|||||||
|
|
||||||
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
sendUsage(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ public class Purge extends SubCommand {
|
|||||||
for (String arg : args) {
|
for (String arg : args) {
|
||||||
String[] split = arg.split(":");
|
String[] split = arg.split(":");
|
||||||
if (split.length != 2) {
|
if (split.length != 2) {
|
||||||
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
sendUsage(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch (split[0].toLowerCase()) {
|
switch (split[0].toLowerCase()) {
|
||||||
@ -133,7 +133,7 @@ public class Purge extends SubCommand {
|
|||||||
clear = Boolean.parseBoolean(split[1]);
|
clear = Boolean.parseBoolean(split[1]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
sendUsage(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import com.google.inject.Inject;
|
|||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
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.TranslatableCaption;
|
||||||
import com.plotsquared.core.database.DBFunc;
|
import com.plotsquared.core.database.DBFunc;
|
||||||
import com.plotsquared.core.events.PlotRateEvent;
|
import com.plotsquared.core.events.PlotRateEvent;
|
||||||
import com.plotsquared.core.events.TeleportCause;
|
import com.plotsquared.core.events.TeleportCause;
|
||||||
@ -109,7 +110,8 @@ public class Rate extends SubCommand {
|
|||||||
case "purge": {
|
case "purge": {
|
||||||
final Plot plot = player.getCurrentPlot();
|
final Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (!Permissions
|
if (!Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_RATE, true)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_RATE, true)) {
|
||||||
@ -123,7 +125,8 @@ public class Rate extends SubCommand {
|
|||||||
}
|
}
|
||||||
final Plot plot = player.getCurrentPlot();
|
final Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
sendMessage(player, Captions.RATING_NOT_OWNED);
|
sendMessage(player, Captions.RATING_NOT_OWNED);
|
||||||
|
@ -27,6 +27,7 @@ package com.plotsquared.core.command;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.Captions;
|
||||||
|
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.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
@ -62,7 +63,8 @@ public class Remove extends SubCommand {
|
|||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
Plot plot = location.getPlotAbs();
|
Plot plot = location.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
||||||
|
@ -27,6 +27,7 @@ package com.plotsquared.core.command;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.Captions;
|
||||||
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.location.Location;
|
import com.plotsquared.core.location.Location;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
@ -67,7 +68,8 @@ public class Save extends SubCommand {
|
|||||||
}
|
}
|
||||||
final Plot plot = player.getCurrentPlot();
|
final Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
||||||
|
@ -29,6 +29,7 @@ import com.google.common.collect.Lists;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
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.TranslatableCaption;
|
||||||
import com.plotsquared.core.location.Location;
|
import com.plotsquared.core.location.Location;
|
||||||
import com.plotsquared.core.player.ConsolePlayer;
|
import com.plotsquared.core.player.ConsolePlayer;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
@ -87,7 +88,8 @@ public class SchematicCmd extends SubCommand {
|
|||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
final Plot plot = loc.getPlotAbs();
|
final Plot plot = loc.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
||||||
@ -195,7 +197,8 @@ public class SchematicCmd extends SubCommand {
|
|||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
Plot plot = location.getPlotAbs();
|
Plot plot = location.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
||||||
|
@ -30,6 +30,7 @@ import com.plotsquared.core.backup.BackupManager;
|
|||||||
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.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;
|
||||||
@ -204,7 +205,7 @@ public class Set extends SubCommand {
|
|||||||
// Additional checks
|
// Additional checks
|
||||||
Plot plot = player.getCurrentPlot();
|
Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
MainUtil.sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// components
|
// components
|
||||||
|
@ -27,6 +27,7 @@ package com.plotsquared.core.command;
|
|||||||
|
|
||||||
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.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.location.Location;
|
import com.plotsquared.core.location.Location;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
@ -40,7 +41,8 @@ public abstract class SetCommand extends SubCommand {
|
|||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
Plot plot = location.getPlotAbs();
|
Plot plot = location.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(player, CaptionUtility
|
if (!Permissions.hasPermission(player, CaptionUtility
|
||||||
|
@ -60,7 +60,7 @@ public class Swap extends SubCommand {
|
|||||||
return CompletableFuture.completedFuture(false);
|
return CompletableFuture.completedFuture(false);
|
||||||
}
|
}
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
sendUsage(player);
|
||||||
return CompletableFuture.completedFuture(false);
|
return CompletableFuture.completedFuture(false);
|
||||||
}
|
}
|
||||||
Plot plot2 = MainUtil.getPlotFromString(player, args[0], true);
|
Plot plot2 = MainUtil.getPlotFromString(player, args[0], true);
|
||||||
|
@ -173,7 +173,7 @@ public class Template extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, getUsage());
|
sendUsage(player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final String world = args[1];
|
final String world = args[1];
|
||||||
@ -246,7 +246,7 @@ public class Template extends SubCommand {
|
|||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
sendUsage(player);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ public class Trim extends SubCommand {
|
|||||||
|
|
||||||
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
sendUsage(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final String world = args[0];
|
final String world = args[0];
|
||||||
|
@ -27,6 +27,7 @@ package com.plotsquared.core.command;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.Captions;
|
||||||
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.events.PlotUnlinkEvent;
|
import com.plotsquared.core.events.PlotUnlinkEvent;
|
||||||
import com.plotsquared.core.events.Result;
|
import com.plotsquared.core.events.Result;
|
||||||
import com.plotsquared.core.location.Location;
|
import com.plotsquared.core.location.Location;
|
||||||
@ -37,6 +38,7 @@ import com.plotsquared.core.util.MainUtil;
|
|||||||
import com.plotsquared.core.util.Permissions;
|
import com.plotsquared.core.util.Permissions;
|
||||||
import com.plotsquared.core.util.StringMan;
|
import com.plotsquared.core.util.StringMan;
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
@ -59,7 +61,8 @@ public class Unlink extends SubCommand {
|
|||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
final Plot plot = location.getPlotAbs();
|
final Plot plot = location.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, Captions.NOT_IN_PLOT);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return !sendMessage(player, Captions.PLOT_UNOWNED);
|
return !sendMessage(player, Captions.PLOT_UNOWNED);
|
||||||
@ -70,7 +73,7 @@ public class Unlink extends SubCommand {
|
|||||||
final boolean createRoad;
|
final boolean createRoad;
|
||||||
if (args.length != 0) {
|
if (args.length != 0) {
|
||||||
if (args.length != 1 || !StringMan.isEqualIgnoreCaseToAny(args[0], "true", "false")) {
|
if (args.length != 1 || !StringMan.isEqualIgnoreCaseToAny(args[0], "true", "false")) {
|
||||||
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
sendUsage(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
createRoad = Boolean.parseBoolean(args[0]);
|
createRoad = Boolean.parseBoolean(args[0]);
|
||||||
@ -82,7 +85,9 @@ public class Unlink extends SubCommand {
|
|||||||
.callUnlink(plot.getArea(), plot, createRoad, createRoad,
|
.callUnlink(plot.getArea(), plot, createRoad, createRoad,
|
||||||
PlotUnlinkEvent.REASON.PLAYER_COMMAND);
|
PlotUnlinkEvent.REASON.PLAYER_COMMAND);
|
||||||
if (event.getEventResult() == Result.DENY) {
|
if (event.getEventResult() == Result.DENY) {
|
||||||
sendMessage(player, Captions.EVENT_DENIED, "Unlink");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("events.event_denied"),
|
||||||
|
Template.of("value", "Unlink"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
boolean force = event.getEventResult() == Result.FORCE;
|
boolean force = event.getEventResult() == Result.FORCE;
|
||||||
|
@ -32,6 +32,7 @@ import com.plotsquared.core.PlotSquared;
|
|||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.Captions;
|
||||||
import com.plotsquared.core.configuration.ConfigurationUtil;
|
import com.plotsquared.core.configuration.ConfigurationUtil;
|
||||||
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.events.PlotComponentSetEvent;
|
import com.plotsquared.core.events.PlotComponentSetEvent;
|
||||||
import com.plotsquared.core.events.PlotMergeEvent;
|
import com.plotsquared.core.events.PlotMergeEvent;
|
||||||
@ -75,6 +76,7 @@ import com.sk89q.worldedit.math.BlockVector3;
|
|||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -1828,7 +1830,9 @@ public class Plot {
|
|||||||
PlotMergeEvent event = this.eventDispatcher
|
PlotMergeEvent event = this.eventDispatcher
|
||||||
.callMerge(this, Direction.ALL, Integer.MAX_VALUE, player);
|
.callMerge(this, Direction.ALL, Integer.MAX_VALUE, player);
|
||||||
if (event.getEventResult() == Result.DENY) {
|
if (event.getEventResult() == Result.DENY) {
|
||||||
sendMessage(player, Captions.EVENT_DENIED, "Auto merge on claim");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("events.event_denied"),
|
||||||
|
Template.of("value", "Auto merge on claim"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Plot.this.autoMerge(event.getDir(), event.getMax(), uuid, true);
|
Plot.this.autoMerge(event.getDir(), event.getMax(), uuid, true);
|
||||||
@ -2978,7 +2982,9 @@ public class Plot {
|
|||||||
this.eventDispatcher.callTeleport(player, player.getLocation(), plot)
|
this.eventDispatcher.callTeleport(player, player.getLocation(), plot)
|
||||||
.getEventResult();
|
.getEventResult();
|
||||||
if (result == Result.DENY) {
|
if (result == Result.DENY) {
|
||||||
sendMessage(player, Captions.EVENT_DENIED, "Teleport");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("events.event_denied"),
|
||||||
|
Template.of("value", "Teleport"));
|
||||||
resultConsumer.accept(false);
|
resultConsumer.accept(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@
|
|||||||
"blocklist.block_list_separator": "<gold>,</gold><gray> ",
|
"blocklist.block_list_separator": "<gold>,</gold><gray> ",
|
||||||
|
|
||||||
"biome.need_biome": "<prefix><red>You need to specify a valid biome.</red>",
|
"biome.need_biome": "<prefix><red>You need to specify a valid biome.</red>",
|
||||||
"biome.biome_set_to": "<prefix><gold>Plot biome set to </gold><gray>",
|
"biome.biome_set_to": "<prefix><gold>Plot biome set to <gray><value></gray></gold>",
|
||||||
|
|
||||||
"teleport.teleported_to_plot": "<prefix><gold>You have been teleported.</gold>",
|
"teleport.teleported_to_plot": "<prefix><gold>You have been teleported.</gold>",
|
||||||
"teleport.teleported_to_road": "<prefix><gold>You got teleported to the road.</gold>",
|
"teleport.teleported_to_road": "<prefix><gold>You got teleported to the road.</gold>",
|
||||||
@ -300,8 +300,7 @@
|
|||||||
"info.plot_no_description": "<prefix><gray>No description set.</gray>",
|
"info.plot_no_description": "<prefix><gray>No description set.</gray>",
|
||||||
"info.info_syntax_console": "<prefix><gray>/plot info X;Z</gray>",
|
"info.info_syntax_console": "<prefix><gray>/plot info X;Z</gray>",
|
||||||
"info.plot_caps_header": "<dark_gray><strikethrough>---------<reset> <gold>CAPS </gold><dark_gray><strikethrough>---------<reset>",
|
"info.plot_caps_header": "<dark_gray><strikethrough>---------<reset> <gold>CAPS </gold><dark_gray><strikethrough>---------<reset>",
|
||||||
|
"info.plot_caps_format": "<prefix><gray>- Cap Type: </gray><gold><cap> </gold><gray>| Status: </gray><gold><current></gold><gray>/</gray><gold><limit> </gold><gray>(</gray><gold><percentage>%</gold><gray>)</gray>",
|
||||||
"infoplot_caps_format": "<prefix><gray>- Cap Type: </gray><gold><cap> </gold><gray>| Status: </gray><gold><current></gold><gray>/</gray><gold><limit> </gold><gray>(</gray><gold><percentage>%</gold><gray>)</gray>",
|
|
||||||
|
|
||||||
"working.generating_component": "<prefix><gold>Started generating component from your settings.</gold>",
|
"working.generating_component": "<prefix><gold>Started generating component from your settings.</gold>",
|
||||||
"working.clearing_done": "<prefix><dark_aqua>Clear completed! Took <amount>ms.</dark_aqua>",
|
"working.clearing_done": "<prefix><dark_aqua>Clear completed! Took <amount>ms.</dark_aqua>",
|
||||||
|
Loading…
Reference in New Issue
Block a user