mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Remove deprecated method from Captions.java
This commit is contained in:
parent
05d6d557b8
commit
7760631751
@ -317,7 +317,8 @@ import java.util.zip.ZipInputStream;
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
PlotSquared.log(Captions.PREFIX + Captions.ENABLED.f(IMP.getPluginName()));
|
||||
PlotSquared.log(Captions.PREFIX + Captions
|
||||
.format(Captions.ENABLED.getTranslated(), IMP.getPluginName()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -218,11 +218,12 @@ public class Auto extends SubCommand {
|
||||
sendMessage(player, Captions.SCHEMATIC_INVALID, "non-existent: " + schematic);
|
||||
return true;
|
||||
}
|
||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLAIM_SCHEMATIC.f(schematic))
|
||||
if (!Permissions.hasPermission(player,
|
||||
Captions.format(Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic))
|
||||
&& !Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_CLAIM_SCHEMATIC.f(schematic));
|
||||
Captions.format(Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ByteArrayUtilities;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
@ -59,7 +58,8 @@ public class Claim extends SubCommand {
|
||||
"non-existent: " + schematic);
|
||||
}
|
||||
if (!Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_CLAIM_SCHEMATIC.f(schematic))
|
||||
.hasPermission(player, Captions
|
||||
.format(Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic))
|
||||
&& !Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) {
|
||||
return sendMessage(player, Captions.NO_SCHEMATIC_PERMISSION, schematic);
|
||||
|
@ -40,8 +40,9 @@ public class FlagCmd extends SubCommand {
|
||||
private boolean checkPermValue(PlotPlayer player, Flag flag, String key, String value) {
|
||||
key = key.toLowerCase();
|
||||
value = value.toLowerCase();
|
||||
String perm =
|
||||
Captions.PERMISSION_SET_FLAG_KEY_VALUE.f(key.toLowerCase(), value.toLowerCase());
|
||||
String perm = Captions
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), key.toLowerCase(),
|
||||
value.toLowerCase());
|
||||
if (flag instanceof IntegerFlag && MathMan.isInteger(value)) {
|
||||
try {
|
||||
int numeric = Integer.parseInt(value);
|
||||
@ -52,9 +53,9 @@ public class FlagCmd extends SubCommand {
|
||||
Settings.Limit.MAX_PLOTS;
|
||||
final boolean result = player.hasPermissionRange(perm, checkRange) >= numeric;
|
||||
if (!result) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_SET_FLAG_KEY_VALUE
|
||||
.f(key.toLowerCase(), value.toLowerCase()));
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(),
|
||||
key.toLowerCase(), value.toLowerCase()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -65,13 +66,14 @@ public class FlagCmd extends SubCommand {
|
||||
final BlockStateListFlag blockListFlag = (BlockStateListFlag) flag;
|
||||
Set<BlockType> parsedBlocks = blockListFlag.parseValue(value);
|
||||
for (final BlockType block : parsedBlocks) {
|
||||
final String permission = Captions.PERMISSION_SET_FLAG_KEY_VALUE
|
||||
.f(key.toLowerCase(), block.toString().toLowerCase());
|
||||
final String permission = Captions
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(),
|
||||
key.toLowerCase(), block.toString().toLowerCase());
|
||||
final boolean result = Permissions.hasPermission(player, permission);
|
||||
if (!result) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_SET_FLAG_KEY_VALUE
|
||||
.f(key.toLowerCase(), value.toLowerCase()));
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(),
|
||||
key.toLowerCase(), value.toLowerCase()));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -79,8 +81,9 @@ public class FlagCmd extends SubCommand {
|
||||
}
|
||||
final boolean result = Permissions.hasPermission(player, perm);
|
||||
if (!result) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_SET_FLAG_KEY_VALUE.f(key.toLowerCase(), value.toLowerCase()));
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), key.toLowerCase(),
|
||||
value.toLowerCase()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -196,11 +199,13 @@ public class FlagCmd extends SubCommand {
|
||||
"/plot flag remove <flag> [values]");
|
||||
return false;
|
||||
}
|
||||
if (!Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_SET_FLAG_KEY.f(args[1].toLowerCase()))) {
|
||||
if (!Permissions.hasPermission(player, Captions
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY.getTranslated(),
|
||||
args[1].toLowerCase()))) {
|
||||
if (args.length != 3) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_SET_FLAG_KEY.f(args[1].toLowerCase()));
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY.getTranslated(),
|
||||
args[1].toLowerCase()));
|
||||
return false;
|
||||
}
|
||||
for (String entry : args[2].split(",")) {
|
||||
|
@ -32,8 +32,10 @@ import java.util.concurrent.CompletableFuture;
|
||||
switch (arg0) {
|
||||
case "add":
|
||||
case "check":
|
||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_GRANT.f(arg0))) {
|
||||
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_GRANT.f(arg0));
|
||||
if (!Permissions.hasPermission(player,
|
||||
Captions.format(Captions.PERMISSION_GRANT.getTranslated(), arg0))) {
|
||||
Captions.NO_PERMISSION.send(player,
|
||||
Captions.format(Captions.PERMISSION_GRANT.getTranslated(), arg0));
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
if (args.length > 2) {
|
||||
|
@ -137,9 +137,10 @@ public class ListCmd extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
if (!Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_LIST_WORLD_NAME.f(world))) {
|
||||
.hasPermission(player,
|
||||
Captions.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_LIST_WORLD_NAME.f(world));
|
||||
Captions.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world));
|
||||
return false;
|
||||
}
|
||||
plots = new ArrayList<>(PlotSquared.get().getPlots(world));
|
||||
@ -161,9 +162,10 @@ public class ListCmd extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
if (!Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_LIST_WORLD_NAME.f(world))) {
|
||||
.hasPermission(player,
|
||||
Captions.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_LIST_WORLD_NAME.f(world));
|
||||
Captions.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world));
|
||||
return false;
|
||||
}
|
||||
plots = area == null ? new ArrayList<Plot>() : new ArrayList<>(area.getPlots());
|
||||
@ -308,9 +310,10 @@ public class ListCmd extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
if (!Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_LIST_WORLD_NAME.f(args[0]))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_LIST_WORLD_NAME.f(args[0]));
|
||||
.hasPermission(player, Captions
|
||||
.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), args[0]))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions
|
||||
.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), args[0]));
|
||||
return false;
|
||||
}
|
||||
plots = new ArrayList<>(PlotSquared.get().getPlots(args[0]));
|
||||
|
@ -50,10 +50,11 @@ import java.util.stream.IntStream;
|
||||
|
||||
for (String component : components) {
|
||||
if (component.equalsIgnoreCase(args[0])) {
|
||||
if (!Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_SET_COMPONENT.f(component))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_SET_COMPONENT.f(component));
|
||||
if (!Permissions.hasPermission(player, Captions
|
||||
.format(Captions.PERMISSION_SET_COMPONENT.getTranslated(), component))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions
|
||||
.format(Captions.PERMISSION_SET_COMPONENT.getTranslated(),
|
||||
component));
|
||||
return false;
|
||||
}
|
||||
if (args.length < 2) {
|
||||
|
@ -18,18 +18,20 @@ public abstract class SetCommand extends SubCommand {
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
if (!Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND.f(getFullId()))) {
|
||||
.hasPermission(player,
|
||||
Captions.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId()))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_ADMIN_COMMAND.f(getFullId()));
|
||||
Captions.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId()));
|
||||
MainUtil.sendMessage(player, Captions.PLOT_NOT_CLAIMED);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!plot.isOwner(player.getUUID())) {
|
||||
if (!Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND.f(getFullId()))) {
|
||||
.hasPermission(player,
|
||||
Captions.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId()))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_ADMIN_COMMAND.f(getFullId()));
|
||||
Captions.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId()));
|
||||
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||
return false;
|
||||
}
|
||||
|
@ -774,10 +774,6 @@ public enum Captions {
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated public String f(final Object... args) {
|
||||
return format(getTranslated(), args);
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
return this.translatedString;
|
||||
}
|
||||
|
@ -612,7 +612,8 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
||||
if (getMeta("teleportOnLogin", true)) {
|
||||
teleport(location);
|
||||
sendMessage(
|
||||
Captions.TELEPORTED_TO_PLOT.f() + " (quitLoc) (" + plotX
|
||||
Captions.format(Captions.TELEPORTED_TO_PLOT.getTranslated())
|
||||
+ " (quitLoc) (" + plotX
|
||||
+ "," + plotZ + ")");
|
||||
}
|
||||
});
|
||||
@ -623,7 +624,8 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
||||
if (getMeta("teleportOnLogin", true)) {
|
||||
if (plot.isLoaded()) {
|
||||
teleport(location);
|
||||
sendMessage(Captions.TELEPORTED_TO_PLOT.f()
|
||||
sendMessage(Captions.format(
|
||||
Captions.TELEPORTED_TO_PLOT.getTranslated())
|
||||
+ " (quitLoc-unloaded) (" + plotX + "," + plotZ
|
||||
+ ")");
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ public abstract class EventUtil {
|
||||
.getArea() instanceof SinglePlotArea)) {
|
||||
TaskManager.runTask(() -> plot.teleportPlayer(player));
|
||||
MainUtil.sendMessage(player,
|
||||
Captions.TELEPORTED_TO_ROAD.f() + " (on-login) " + "(" + plot.getId().x + ";" + plot
|
||||
Captions.format(Captions.TELEPORTED_TO_ROAD.getTranslated()) + " (on-login) " + "(" + plot.getId().x + ";" + plot
|
||||
.getId().y + ")");
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,8 @@ import java.util.Map;
|
||||
@NonNull final String key, @NonNull final String block) {
|
||||
final BlockBucket bucket = this.blockToBucket(block);
|
||||
this.setString(section, key, bucket);
|
||||
PlotSquared.log(Captions.LEGACY_CONFIG_REPLACED.f(block, bucket.toString()));
|
||||
PlotSquared.log(Captions
|
||||
.format(Captions.LEGACY_CONFIG_REPLACED.getTranslated(), block, bucket.toString()));
|
||||
}
|
||||
|
||||
private void convertBlockList(@NonNull final ConfigurationSection section,
|
||||
@ -89,8 +90,9 @@ import java.util.Map;
|
||||
final BlockState[] blocks = this.splitBlockList(blockList);
|
||||
final BlockBucket bucket = this.blockListToBucket(blocks);
|
||||
this.setString(section, key, bucket);
|
||||
PlotSquared.log(
|
||||
Captions.LEGACY_CONFIG_REPLACED.f(plotBlockArrayString(blocks), bucket.toString()));
|
||||
PlotSquared.log(Captions
|
||||
.format(Captions.LEGACY_CONFIG_REPLACED.getTranslated(), plotBlockArrayString(blocks),
|
||||
bucket.toString()));
|
||||
}
|
||||
|
||||
private String plotBlockArrayString(@NonNull final BlockState[] blocks) {
|
||||
|
@ -789,7 +789,9 @@ public class MainUtil {
|
||||
value = df.format(value);
|
||||
}
|
||||
flags.append(prefix)
|
||||
.append(Captions.PLOT_FLAG_LIST.f(entry.getKey().getName(), value));
|
||||
.append(Captions
|
||||
.format(Captions.PLOT_FLAG_LIST.getTranslated(), entry.getKey().getName(),
|
||||
value));
|
||||
prefix = ", ";
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user