Created TextVariables class that contains common text placeholders

This commit is contained in:
Florian CUNY 2018-06-03 10:07:58 +02:00
parent b87b00d887
commit f5b5426327
24 changed files with 89 additions and 55 deletions

View File

@ -36,7 +36,7 @@ general:
unknown-command: "&cUnknown command. Do &b/[label] help &cfor help."
warp-not-safe: "&cThat warp is not safe right now!"
wrong-world: "&cYou are not in the right world to do that!"
you-must-wait: "&cYou must wait [seconds]s before you can do that command again"
you-must-wait: "&cYou must wait [number]s before you can do that command again"
you-need: "&cYou need [permission]"
tips:
changing-obsidian-to-lava: "Changing obsidian back into lava. Be careful!"
@ -147,18 +147,18 @@ commands:
must-remove-members: "You must remove all members from your island before you can restart it (/island kick <player>)."
none-left: "&cYou have no more resets left!"
resets-left: "&cYou have [number] resets left"
confirm: "&cType &b/[label] reset confirm&c within [seconds]s to confirm reset"
confirm: "&cType &b/[label] reset confirm&c within [number]s to confirm reset"
cancelled: "&bReset cancelled"
sethome:
description: "set your teleport point for /island"
must-be-on-your-island: "You must be on your island to set home!"
num-homes: "Homes can be 1 to [max]."
num-homes: "Homes can be 1 to [number]."
home-set: "Your island home has been set to your current location."
parameters: "[home number]"
setname:
description: "set a name for your island"
name-too-short: "&cToo short. Minimum size is [length] characters."
name-too-long: "&cToo long. Maximum size is [length] characters."
name-too-short: "&cToo short. Minimum size is [number] characters."
name-too-long: "&cToo long. Maximum size is [number] characters."
parameters: "<name>"
resetname:
description: "reset your island name"
@ -175,7 +175,7 @@ commands:
you-will-lose-your-island: "&cWARNING! You will lose your island if you accept!"
errors:
cannot-invite-self: "&cYou cannot invite yourself!"
cooldown: "&cYou cannot invite that person for another [time] seconds"
cooldown: "&cYou cannot invite that person for another [number] seconds"
island-is-full: "&cYour island is full, you can't invite anyone else."
none-invited-you: "&cNo one invited you :c."
you-already-are-in-team: "&cYou are already on a team!"
@ -197,7 +197,7 @@ commands:
cannot-leave: "&cTeamleaders cannot leave! Become a member first, or kick all members."
description: "leave your island"
type-again: "&cEnter the leave command again to confirm"
left-your-island: "&c[player] left your island"
left-your-island: "&c[name] left your island"
kick:
description: "remove a member from your island"
parameters: "<player>"
@ -229,14 +229,14 @@ commands:
cannot-ban: "&cThat player cannot be banned."
cannot-ban-member: "&cKick the team member first, then ban."
player-already-banned: "&cPlayer is already banned"
owner-banned-you: "&b[owner]&c banned you from their island!"
owner-banned-you: "&b[name]&c banned you from their island!"
you-are-banned: "&bYou are banned from this island!"
unban:
description: "unban a player from your island"
parameters: "<player>"
cannot-unban-yourself: "&cYou cannot unban yourself!"
player-not-banned: "&cPlayer is not banned"
you-are-unbanned: "&b[owner]&a unbanned you from their island!"
you-are-unbanned: "&b[name]&a unbanned you from their island!"
banlist:
description: "list banned players"
noone: "&aNo one is banned on this island"
@ -357,6 +357,6 @@ language:
new-island:
sign:
line0: "&1%bsb_plugin_name%"
line1: "[player]"
line1: "[name]"
line2: "Don't fall!"
line3: "Have fun! &c<3"

View File

@ -21,6 +21,7 @@ import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.Settings;
import us.tastybento.bskyblock.api.addons.Addon;
import us.tastybento.bskyblock.api.events.command.CommandEvent;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.managers.IslandWorldManager;
import us.tastybento.bskyblock.managers.IslandsManager;
@ -211,7 +212,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
// Check perms, but only if this isn't the console
if ((sender instanceof Player) && !sender.isOp() && !cmd.getPermission().isEmpty() && !sender.hasPermission(cmd.getPermission())) {
user.sendMessage("general.errors.no-permission");
user.sendMessage("general.errors.you-need", "[permission]", cmd.getPermission());
user.sendMessage("general.errors.you-need", TextVariables.PERMISSION, cmd.getPermission());
return true;
}
// Fire an event to see if this command should be cancelled

View File

@ -6,6 +6,7 @@ import java.util.Optional;
import org.apache.commons.lang.math.NumberUtils;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
/**
@ -51,7 +52,7 @@ public class DefaultHelpCommand extends CompositeCommand {
}
}
if (depth == 0) {
user.sendMessage("commands.help.header", "[label]", getIWM().getFriendlyName(getWorld()));
user.sendMessage("commands.help.header", TextVariables.LABEL, getIWM().getFriendlyName(getWorld()));
}
if (depth < MAX_DEPTH) {
if (!parent.getLabel().equals(HELP)) {

View File

@ -7,12 +7,15 @@ import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.panels.PanelItem;
import us.tastybento.bskyblock.api.panels.builders.PanelItemBuilder;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.database.objects.Island;
import us.tastybento.bskyblock.managers.RanksManager;
import javax.xml.soap.Text;
public class Flag implements Comparable<Flag> {
public enum Type {
@ -127,7 +130,7 @@ public class Flag implements Comparable<Flag> {
// Start the flag conversion
PanelItemBuilder pib = new PanelItemBuilder()
.icon(new ItemStack(icon))
.name(user.getTranslation("protection.panel.flag-item.name-layout", "[name]", user.getTranslation("protection.flags." + id + ".name")))
.name(user.getTranslation("protection.panel.flag-item.name-layout", TextVariables.NAME, user.getTranslation("protection.flags." + id + ".name")))
.clickHandler(clickHandler);
pib.description(user.getTranslation("protection.panel.flag-item.description-layout", "[description]", user.getTranslation("protection.flags." + id + ".description")));

View File

@ -0,0 +1,14 @@
package us.tastybento.bskyblock.api.localization;
/**
* Contains the common variables that can be used in texts.
* @author Poslovitch
*/
public class TextVariables {
public static final String NAME = "[name]";
public static final String NUMBER = "[number]";
public static final String RANK = "[rank]";
public static final String LABEL = "[label]";
public static final String PERMISSION = "[permission]";
}

View File

@ -3,6 +3,7 @@ package us.tastybento.bskyblock.commands;
import java.util.List;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.commands.admin.AdminGetRankCommand;
import us.tastybento.bskyblock.commands.admin.AdminInfoCommand;
@ -50,7 +51,7 @@ public class AdminCommand extends CompositeCommand {
@Override
public boolean execute(User user, List<String> args) {
if (!args.isEmpty()) {
user.sendMessage("general.errors.unknown-command", "[label]", getTopLabel());
user.sendMessage("general.errors.unknown-command", TextVariables.LABEL, getTopLabel());
return false;
}
// By default run the attached help command, if it exists (it should)

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.commands.island.IslandAboutCommand;
import us.tastybento.bskyblock.commands.island.IslandBanCommand;
@ -69,7 +70,7 @@ public class IslandCommand extends CompositeCommand {
// No islands currently
return getSubCommand("create").map(createCmd -> createCmd.execute(user, new ArrayList<>())).orElse(false);
}
user.sendMessage("general.errors.unknown-command", "[label]", getTopLabel());
user.sendMessage("general.errors.unknown-command", TextVariables.LABEL, getTopLabel());
return false;
}

View File

@ -9,6 +9,7 @@ import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.database.objects.Island;
import us.tastybento.bskyblock.managers.RanksManager;
@ -59,7 +60,7 @@ public class AdminGetRankCommand extends CompositeCommand {
User target = User.getInstance(targetUUID);
Island island = getPlugin().getIslands().getIsland(getWorld(), targetUUID);
int currentRank = island.getRank(target);
user.sendMessage("commands.admin.getrank.rank-is", "[rank]", user.getTranslation(rm.getRank(currentRank)));
user.sendMessage("commands.admin.getrank.rank-is", TextVariables.RANK, user.getTranslation(rm.getRank(currentRank)));
return true;
}

View File

@ -4,6 +4,7 @@ import java.util.List;
import java.util.UUID;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
public class AdminTeamAddCommand extends CompositeCommand {
@ -30,12 +31,12 @@ public class AdminTeamAddCommand extends CompositeCommand {
// Get leader and target
UUID leaderUUID = getPlayers().getUUID(args.get(0));
if (leaderUUID == null) {
user.sendMessage("general.errors.unknown-player-name", "[name]", args.get(0));
user.sendMessage("general.errors.unknown-player-name", TextVariables.NAME, args.get(0));
return false;
}
UUID targetUUID = getPlayers().getUUID(args.get(1));
if (targetUUID == null) {
user.sendMessage("general.errors.unknown-player-name", "[name]", args.get(1));
user.sendMessage("general.errors.unknown-player-name", TextVariables.NAME, args.get(1));
return false;
}
if (!getIslands().hasIsland(getWorld(), leaderUUID)) {
@ -43,7 +44,7 @@ public class AdminTeamAddCommand extends CompositeCommand {
return false;
}
if (getIslands().inTeam(getWorld(), leaderUUID) && !getIslands().getTeamLeader(getWorld(), leaderUUID).equals(leaderUUID)) {
user.sendMessage("commands.admin.team.add.name-not-leader", "[name]", args.get(0));
user.sendMessage("commands.admin.team.add.name-not-leader", TextVariables.NAME, args.get(0));
getIslands().getIsland(getWorld(), leaderUUID).showMembers(getPlugin(), user);
return false;
}
@ -52,14 +53,14 @@ public class AdminTeamAddCommand extends CompositeCommand {
return false;
}
if (getIslands().hasIsland(getWorld(), targetUUID)) {
user.sendMessage("commands.admin.team.add.name-has-island", "[name]", args.get(1));
user.sendMessage("commands.admin.team.add.name-has-island", TextVariables.NAME, args.get(1));
return false;
}
// Success
User target = User.getInstance(targetUUID);
User leader = User.getInstance(leaderUUID);
leader.sendMessage("commands.island.team.invite.accept.name-joined-your-island", "[name]", getPlugin().getPlayers().getName(targetUUID));
target.sendMessage("commands.island.team.invite.accept.you-joined-island", "[label]", getTopLabel());
leader.sendMessage("commands.island.team.invite.accept.name-joined-your-island", TextVariables.NAME, getPlugin().getPlayers().getName(targetUUID));
target.sendMessage("commands.island.team.invite.accept.you-joined-island", TextVariables.LABEL, getTopLabel());
getIslands().getIsland(getWorld(), leaderUUID).addMember(targetUUID);
user.sendMessage("general.success");
return true;

View File

@ -10,6 +10,7 @@ import org.bukkit.Sound;
import org.bukkit.entity.Player;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.database.objects.Island;
import us.tastybento.bskyblock.util.Util;
@ -78,7 +79,7 @@ public class IslandBanCommand extends CompositeCommand {
Island island = getIslands().getIsland(getWorld(), user.getUniqueId());
if (island.addToBanList(targetUser.getUniqueId())) {
user.sendMessage("general.success");
targetUser.sendMessage("commands.island.ban.owner-banned-you", "[owner]", user.getName());
targetUser.sendMessage("commands.island.ban.owner-banned-you", TextVariables.NAME, user.getName());
// If the player is online, has an island and on the banned island, move them home immediately
if (targetUser.isOnline() && getIslands().hasIsland(getWorld(), targetUser.getUniqueId()) && island.onIsland(targetUser.getLocation())) {
getIslands().homeTeleport(getWorld(), targetUser.getPlayer());

View File

@ -6,6 +6,7 @@ import org.apache.commons.lang.math.NumberUtils;
import org.bukkit.ChatColor;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.util.Util;
@ -44,7 +45,7 @@ public class IslandGoCommand extends CompositeCommand {
int maxHomes = Util.getPermValue(user.getPlayer(), "island.maxhomes", getIWM().getMaxHomes(getWorld()));
if (homeValue > 1 && homeValue <= maxHomes) {
getIslands().homeTeleport(getWorld(), user.getPlayer(), homeValue);
user.sendMessage("commands.island.go.tip", "[label]", getTopLabel());
user.sendMessage("commands.island.go.tip", TextVariables.LABEL, getTopLabel());
return true;
}
}

View File

@ -12,13 +12,13 @@ import org.bukkit.entity.Player;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.events.island.IslandEvent.Reason;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.database.objects.Island;
import us.tastybento.bskyblock.managers.island.NewIsland;
public class IslandResetCommand extends CompositeCommand {
private static final String SECONDS_PLACEHOLDER = "[seconds]";
private Map<UUID, Long> cooldown;
private Map<UUID, Long> confirm;
@ -39,7 +39,7 @@ public class IslandResetCommand extends CompositeCommand {
public boolean execute(User user, List<String> args) {
// Check cooldown
if (getSettings().getResetWait() > 0 && onRestartWaitTime(user) > 0 && !user.isOp()) {
user.sendMessage("general.errors.you-must-wait", SECONDS_PLACEHOLDER, String.valueOf(onRestartWaitTime(user)));
user.sendMessage("general.errors.you-must-wait", TextVariables.NUMBER, String.valueOf(onRestartWaitTime(user)));
return false;
}
if (!getIslands().hasIsland(getWorld(), user.getUniqueId())) {
@ -60,7 +60,7 @@ public class IslandResetCommand extends CompositeCommand {
return false;
} else {
// Notify how many resets are left
user.sendMessage("commands.island.reset.resets-left", "[number]", String.valueOf(getPlayers().getResetsLeft(user.getUniqueId())));
user.sendMessage("commands.island.reset.resets-left", TextVariables.NUMBER, String.valueOf(getPlayers().getResetsLeft(user.getUniqueId())));
}
}
// Check for non-confirm command
@ -80,13 +80,13 @@ public class IslandResetCommand extends CompositeCommand {
} else {
// Show how many seconds left to confirm
int time = (int)((confirm.get(user.getUniqueId()) - System.currentTimeMillis()) / 1000D);
user.sendMessage("commands.island.reset.confirm", "[label]", getTopLabel(), SECONDS_PLACEHOLDER, String.valueOf(time));
user.sendMessage("commands.island.reset.confirm", TextVariables.LABEL, getTopLabel(), TextVariables.NUMBER, String.valueOf(time));
}
return true;
}
private void requestConfirmation(User user) {
user.sendMessage("commands.island.reset.confirm", "[label]", getTopLabel(), SECONDS_PLACEHOLDER, String.valueOf(getSettings().getConfirmationTime()));
user.sendMessage("commands.island.reset.confirm", TextVariables.LABEL, getTopLabel(), TextVariables.NUMBER, String.valueOf(getSettings().getConfirmationTime()));
// Require confirmation
confirm.put(user.getUniqueId(), System.currentTimeMillis() + getSettings().getConfirmationTime() * 1000L);
Bukkit.getScheduler().runTaskLater(getPlugin(), () -> {

View File

@ -21,7 +21,6 @@ public class IslandResetnameCommand extends CompositeCommand {
setPermission("island.name");
setOnlyPlayer(true);
setDescription("commands.island.resetname.description");
}
/* (non-Javadoc)

View File

@ -4,6 +4,7 @@ import java.util.List;
import java.util.UUID;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.util.Util;
@ -46,14 +47,14 @@ public class IslandSethomeCommand extends CompositeCommand {
try {
number = Integer.valueOf(args.get(0));
if (number < 1 || number > maxHomes) {
user.sendMessage("commands.island.sethome.num-homes", "[max]", String.valueOf(maxHomes));
user.sendMessage("commands.island.sethome.num-homes", TextVariables.NUMBER, String.valueOf(maxHomes));
return false;
} else {
getPlugin().getPlayers().setHomeLocation(user, user.getLocation(), number);
user.sendMessage("commands.island.sethome.home-set");
}
} catch (Exception e) {
user.sendMessage("commands.island.sethome.num-homes", "[max]", String.valueOf(maxHomes));
user.sendMessage("commands.island.sethome.num-homes", TextVariables.NUMBER, String.valueOf(maxHomes));
return false;
}
} else {

View File

@ -8,6 +8,7 @@ import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
/**
@ -56,11 +57,11 @@ public class IslandSetnameCommand extends CompositeCommand {
// Check if the name isn't too short or too long
if (name.length() < getSettings().getNameMinLength()) {
user.sendMessage("commands.island.setname.too-short", "[length]", String.valueOf(getSettings().getNameMinLength()));
user.sendMessage("commands.island.setname.too-short", TextVariables.NUMBER, String.valueOf(getSettings().getNameMinLength()));
return false;
}
if (name.length() > getSettings().getNameMaxLength()) {
user.sendMessage("commands.island.setname.too-long", "[length]", String.valueOf(getSettings().getNameMaxLength()));
user.sendMessage("commands.island.setname.too-long", TextVariables.NUMBER, String.valueOf(getSettings().getNameMaxLength()));
return false;
}

View File

@ -6,6 +6,7 @@ import java.util.UUID;
import java.util.stream.Collectors;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.database.objects.Island;
import us.tastybento.bskyblock.util.Util;
@ -64,7 +65,7 @@ public class IslandUnbanCommand extends CompositeCommand {
private boolean unban(User user, User targetUser) {
if (getIslands().getIsland(getWorld(), user.getUniqueId()).removeFromBanList(targetUser.getUniqueId())) {
user.sendMessage("general.success");
targetUser.sendMessage("commands.island.unban.you-are-unbanned", "[owner]", user.getName());
targetUser.sendMessage("commands.island.unban.you-are-unbanned", TextVariables.NAME, user.getName());
return true;
}
// Unbanning was blocked, maybe due to an event cancellation. Fail silently.

View File

@ -7,8 +7,11 @@ import java.util.UUID;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
import us.tastybento.bskyblock.api.events.team.TeamEvent;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
import javax.xml.soap.Text;
public class IslandTeamCommand extends CompositeCommand {
private IslandTeamInviteCommand inviteCommand;
@ -50,7 +53,7 @@ public class IslandTeamCommand extends CompositeCommand {
if (teamLeaderUUID.equals(playerUUID)) {
int maxSize = inviteCommand.getMaxTeamSize(user);
if (teamMembers.size() < maxSize) {
user.sendMessage("commands.island.team.invite.you-can-invite", "[number]", String.valueOf(maxSize - teamMembers.size()));
user.sendMessage("commands.island.team.invite.you-can-invite", TextVariables.NUMBER, String.valueOf(maxSize - teamMembers.size()));
} else {
user.sendMessage("commands.island.team.invite.errors.island-is-full");
}

View File

@ -9,6 +9,7 @@ import org.bukkit.Location;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
import us.tastybento.bskyblock.api.events.team.TeamEvent;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.database.objects.Island;
@ -90,10 +91,10 @@ public class IslandTeamInviteAcceptCommand extends CompositeCommand {
// Put player back into normal mode
user.setGameMode(GameMode.SURVIVAL);
user.sendMessage("commands.island.team.invite.accept.you-joined-island", "[label]", getTopLabel());
user.sendMessage("commands.island.team.invite.accept.you-joined-island", TextVariables.LABEL, getTopLabel());
User inviter = User.getInstance(itc.getInviteCommand().getInviteList().get(playerUUID));
if (inviter != null) {
inviter.sendMessage("commands.island.team.invite.accept.name-joined-your-island", "[name]", user.getName());
inviter.sendMessage("commands.island.team.invite.accept.name-joined-your-island", TextVariables.NAME, user.getName());
}
getIslands().save(false);
return true;

View File

@ -14,12 +14,12 @@ import com.google.common.collect.HashBiMap;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
import us.tastybento.bskyblock.api.events.team.TeamEvent;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.util.Util;
public class IslandTeamInviteCommand extends CompositeCommand {
private static final String NAME_PLACEHOLDER = "[name]";
private BiMap<UUID, UUID> inviteList;
public IslandTeamInviteCommand(CompositeCommand islandCommand) {
@ -51,7 +51,7 @@ public class IslandTeamInviteCommand extends CompositeCommand {
// Invite label with no name, i.e., /island invite - tells the player who has invited them so far
if (inviteList.containsKey(playerUUID)) {
OfflinePlayer inviter = getPlugin().getServer().getOfflinePlayer(inviteList.get(playerUUID));
user.sendMessage("commands.island.team.invite.name-has-invited-you", NAME_PLACEHOLDER, inviter.getName());
user.sendMessage("commands.island.team.invite.name-has-invited-you", TextVariables.NAME, inviter.getName());
return true;
}
// Show help
@ -78,7 +78,7 @@ public class IslandTeamInviteCommand extends CompositeCommand {
// whether they are still on cooldown
long time = getPlayers().getInviteCoolDownTime(invitedPlayerUUID, getIslands().getIslandLocation(getWorld(), playerUUID));
if (time > 0 && !user.isOp()) {
user.sendMessage("commands.island.team.invite.cooldown", "[time]", String.valueOf(time));
user.sendMessage("commands.island.team.invite.cooldown", TextVariables.NUMBER, String.valueOf(time));
return false;
}
// Player cannot invite someone already on a team
@ -114,10 +114,10 @@ public class IslandTeamInviteCommand extends CompositeCommand {
// Put the invited player (key) onto the list with inviter (value)
// If someone else has invited a player, then this invite will overwrite the previous invite!
inviteList.put(invitedPlayer.getUniqueId(), user.getUniqueId());
user.sendMessage("commands.island.team.invite.invitation-sent", NAME_PLACEHOLDER, invitedPlayer.getName());
user.sendMessage("commands.island.team.invite.invitation-sent", TextVariables.NAME, invitedPlayer.getName());
// Send message to online player
invitedPlayer.sendMessage("commands.island.team.invite.name-has-invited-you", NAME_PLACEHOLDER, user.getName());
invitedPlayer.sendMessage("commands.island.team.invite.to-accept-or-reject", "[label]", getLabel());
invitedPlayer.sendMessage("commands.island.team.invite.name-has-invited-you", TextVariables.NAME, user.getName());
invitedPlayer.sendMessage("commands.island.team.invite.to-accept-or-reject", TextVariables.LABEL, getLabel());
if (getIslands().hasIsland(getWorld(), invitedPlayer.getUniqueId())) {
invitedPlayer.sendMessage("commands.island.team.invite.you-will-lose-your-island");
}

View File

@ -6,6 +6,7 @@ import java.util.UUID;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
import us.tastybento.bskyblock.api.events.team.TeamEvent;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
public class IslandTeamInviteRejectCommand extends CompositeCommand {
@ -46,7 +47,7 @@ public class IslandTeamInviteRejectCommand extends CompositeCommand {
user.sendMessage("commands.island.team.invite.reject.you-rejected-invite");
User inviter = User.getInstance(itc.getInviteCommand().getInviteList().get(playerUUID));
inviter.sendMessage("commands.island.team.invite.reject.name-rejected-your-invite", "[name]", user.getName());
inviter.sendMessage("commands.island.team.invite.reject.name-rejected-your-invite", TextVariables.NAME, user.getName());
} else {
// Someone typed /island reject and had not been invited
// TODO: make the error nicer if there are invites in other worlds

View File

@ -8,6 +8,7 @@ import java.util.UUID;
import org.bukkit.scheduler.BukkitRunnable;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
public class IslandTeamLeaveCommand extends CompositeCommand {
@ -40,7 +41,7 @@ public class IslandTeamLeaveCommand extends CompositeCommand {
leaveSet.remove(user.getUniqueId());
UUID leaderUUID = getIslands().getTeamLeader(getWorld(), user.getUniqueId());
if (leaderUUID != null) {
User.getInstance(leaderUUID).sendMessage("commands.island.team.leave.left-your-island", "[player]", user.getName());
User.getInstance(leaderUUID).sendMessage("commands.island.team.leave.left-your-island", TextVariables.NAME, user.getName());
}
getIslands().removePlayer(getWorld(), user.getUniqueId());
user.sendMessage("general.success");

View File

@ -3,6 +3,7 @@ package us.tastybento.bskyblock.commands.island.teams;
import java.util.List;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
public class IslandTeamPromoteCommand extends CompositeCommand {
@ -60,7 +61,7 @@ public class IslandTeamPromoteCommand extends CompositeCommand {
if (nextRank > currentRank) {
getIslands().getIsland(getWorld(), user.getUniqueId()).setRank(target, nextRank);
String rankName = user.getTranslation(getPlugin().getRanksManager().getRank(nextRank));
user.sendMessage("commands.island.team.promote.success", "[name]", target.getName(), "[rank]", rankName);
user.sendMessage("commands.island.team.promote.success", TextVariables.NAME, target.getName(), TextVariables.RANK, rankName);
return true;
} else {
user.sendMessage("commands.island.team.promote.failure");
@ -72,7 +73,7 @@ public class IslandTeamPromoteCommand extends CompositeCommand {
if (prevRank < currentRank) {
getIslands().getIsland(getWorld(), user.getUniqueId()).setRank(target, prevRank);
String rankName = user.getTranslation(getPlugin().getRanksManager().getRank(prevRank));
user.sendMessage("commands.island.team.demote.success", "[name]", target.getName(), "[rank]", rankName);
user.sendMessage("commands.island.team.demote.success", TextVariables.NAME, target.getName(), TextVariables.RANK, rankName);
return true;
} else {
user.sendMessage("commands.island.team.demote.failure");

View File

@ -40,6 +40,7 @@ import org.bukkit.material.Openable;
import org.bukkit.material.Redstone;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
public class Clipboard {
@ -109,7 +110,7 @@ public class Clipboard {
}
}
}
user.sendMessage("commands.admin.schem.copied-blocks", "[number]", String.valueOf(count));
user.sendMessage("commands.admin.schem.copied-blocks", TextVariables.NUMBER, String.valueOf(count));
copied = true;
return true;
}

View File

@ -20,6 +20,7 @@ import org.bukkit.material.Chest;
import us.tastybento.bskyblock.Constants;
import us.tastybento.bskyblock.Constants.GameType;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.database.objects.Island;
@ -37,8 +38,6 @@ public class IslandBuilder {
END
}
private static final String PLAYER_PLACEHOLDER = "[player]";
private Island island;
private World world;
private IslandType type = IslandType.ISLAND;
@ -458,10 +457,10 @@ public class IslandBuilder {
User user = User.getInstance(playerUUID);
// Sets the lines of the sign
sign.setLine(0, user.getTranslation("new-island.sign.line0", PLAYER_PLACEHOLDER, playerName));
sign.setLine(1, user.getTranslation("new-island.sign.line1", PLAYER_PLACEHOLDER, playerName));
sign.setLine(2, user.getTranslation("new-island.sign.line2", PLAYER_PLACEHOLDER, playerName));
sign.setLine(3, user.getTranslation("new-island.sign.line3", PLAYER_PLACEHOLDER, playerName));
sign.setLine(0, user.getTranslation("new-island.sign.line0", TextVariables.NAME, playerName));
sign.setLine(1, user.getTranslation("new-island.sign.line1", TextVariables.NAME, playerName));
sign.setLine(2, user.getTranslation("new-island.sign.line2", TextVariables.NAME, playerName));
sign.setLine(3, user.getTranslation("new-island.sign.line3", TextVariables.NAME, playerName));
((org.bukkit.material.Sign) sign.getData()).setFacingDirection(BlockFace.NORTH);
sign.update();