mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Making progress on messages
This commit is contained in:
parent
4fb590889a
commit
3fd3baaa47
@ -58,12 +58,15 @@ public class Leave extends Command {
|
||||
public CompletableFuture<Boolean> execute(PlotPlayer<?> player, String[] args,
|
||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
|
||||
final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT);
|
||||
checkTrue(plot.hasOwner(), Captions.PLOT_UNOWNED);
|
||||
checkTrue(plot.isAdded(player.getUUID()), Captions.NOT_ADDED_TRUSTED);
|
||||
checkTrue(args.length == 0, Captions.COMMAND_SYNTAX, getUsage());
|
||||
final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot"));
|
||||
checkTrue(plot.hasOwner(), TranslatableCaption.of("info.plot_unowned"));
|
||||
checkTrue(plot.isAdded(player.getUUID()), TranslatableCaption.of("member.not_added_trusted"));
|
||||
if (args.length == 0) {
|
||||
sendUsage(player);
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
if (plot.isOwner(player.getUUID())) {
|
||||
checkTrue(plot.hasOwner(), Captions.ALREADY_OWNER);
|
||||
checkTrue(plot.hasOwner(), TranslatableCaption.of("member.already_owner"));
|
||||
// TODO setowner, other
|
||||
} else {
|
||||
UUID uuid = player.getUUID();
|
||||
|
@ -71,7 +71,8 @@ public class Load extends SubCommand {
|
||||
@Override public boolean onCommand(final PlotPlayer<?> player, final String[] args) {
|
||||
final String world = player.getLocation().getWorldName();
|
||||
if (!this.plotAreaManager.hasPlotArea(world)) {
|
||||
return !sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
return false;
|
||||
}
|
||||
final Plot plot = player.getCurrentPlot();
|
||||
if (plot == null) {
|
||||
|
@ -66,7 +66,7 @@ public class Move extends SubCommand {
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
if (!plot1.isOwner(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) {
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN)) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
@ -98,7 +98,7 @@ public class Move extends SubCommand {
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
if (!plot1.getArea().isCompatible(plot2.getArea()) && (!override || !Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated()))) {
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN))) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.plotworld_incompatible"));
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class Near extends Command {
|
||||
public CompletableFuture<Boolean> execute(PlotPlayer<?> player, String[] args,
|
||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
|
||||
final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT);
|
||||
final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("near.plot_near"),
|
||||
Template.of("list", StringMan.join(plot.getPlayersInPlot(), ", "))
|
||||
|
@ -95,7 +95,7 @@ public class Owner extends SetCommand {
|
||||
boolean force = event.getEventResult() == Result.FORCE;
|
||||
if (uuid == null) {
|
||||
if (!force && !Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SET_OWNER.getTranslated(),
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SET_OWNER,
|
||||
true)) {
|
||||
return;
|
||||
}
|
||||
|
@ -65,7 +65,8 @@ public class Save extends SubCommand {
|
||||
@Override public boolean onCommand(final PlotPlayer<?> player, final String[] args) {
|
||||
final String world = player.getLocation().getWorldName();
|
||||
if (!this.plotAreaManager.hasPlotArea(world)) {
|
||||
return !sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
return false;
|
||||
}
|
||||
final Plot plot = player.getCurrentPlot();
|
||||
if (plot == null) {
|
||||
|
@ -52,11 +52,11 @@ public class Swap extends SubCommand {
|
||||
Location location = player.getLocation();
|
||||
Plot plot1 = location.getPlotAbs();
|
||||
if (plot1 == null) {
|
||||
return CompletableFuture
|
||||
.completedFuture(!MainUtil.sendMessage(player, Captions.NOT_IN_PLOT));
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
if (!plot1.isOwner(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) {
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN)) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
*/
|
||||
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.util.task.RunnableVal2;
|
||||
|
@ -69,12 +69,12 @@ public class Trust extends Command {
|
||||
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
|
||||
final Plot currentPlot = player.getCurrentPlot();
|
||||
if (currentPlot == null) {
|
||||
throw new CommandException(Captions.NOT_IN_PLOT);
|
||||
throw new CommandException(TranslatableCaption.of("errors.not_in_plot"));
|
||||
}
|
||||
checkTrue(currentPlot.hasOwner(), Captions.PLOT_UNOWNED);
|
||||
checkTrue(currentPlot.hasOwner(), TranslatableCaption.of("info.plot_unowned"));
|
||||
checkTrue(currentPlot.isOwner(player.getUUID()) || Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST),
|
||||
Captions.NO_PLOT_PERMS);
|
||||
TranslatableCaption.of("permission.no_plot_perms"));
|
||||
|
||||
checkTrue(args.length == 1, TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Templates.of("value", getUsage()));
|
||||
@ -131,7 +131,7 @@ public class Trust extends Command {
|
||||
checkTrue(!uuids.isEmpty(), null);
|
||||
checkTrue(size <= currentPlot.getArea().getMaxPlotMembers() || Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST),
|
||||
Captions.PLOT_MAX_MEMBERS);
|
||||
TranslatableCaption.of("member.plot_max_members"));
|
||||
// Success
|
||||
confirm.run(this, () -> {
|
||||
for (UUID uuid : uuids) {
|
||||
|
@ -64,7 +64,8 @@ public class Unlink extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
return !sendMessage(player, Captions.PLOT_UNOWNED);
|
||||
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.isMerged()) {
|
||||
player.sendMessage(TranslatableCaption.of("merge.unlink_impossible"));
|
||||
|
Loading…
Reference in New Issue
Block a user