mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-23 03:05:16 +01:00
The color update!
Added colors to help text.
This commit is contained in:
parent
30fb087777
commit
5aa3594f42
@ -12,21 +12,25 @@
|
||||
general:
|
||||
deaths: "Deaths"
|
||||
unlimited: "Unlimited"
|
||||
success: "Success!"
|
||||
success: "&aSuccess!"
|
||||
errors:
|
||||
no-permission: "You don't have permission to execute this command."
|
||||
use-in-game: "This command is only available in game."
|
||||
no-team: "You do not have a team!"
|
||||
no-island: "You do not have an island!"
|
||||
already-have-island: "You already have an island!"
|
||||
no-safe-location: "No safe location found on island!"
|
||||
not-leader: "You are not the leader of your island!"
|
||||
offline-player: "That player is offline or doesn't exist."
|
||||
unknown-player: "Unknown player!"
|
||||
general: "That command is not ready yet - contact admin"
|
||||
no-permission: "&cYou don't have permission to execute this command."
|
||||
use-in-game: "&cThis command is only available in game."
|
||||
no-team: "&cYou do not have a team!"
|
||||
no-island: "&cYou do not have an island!"
|
||||
already-have-island: "&cYou already have an island!"
|
||||
no-safe-location: "&cNo safe location found on island!"
|
||||
not-leader: "&cYou are not the leader of your island!"
|
||||
offline-player: "&cThat player is offline or doesn't exist."
|
||||
unknown-player: "&cUnknown player!"
|
||||
general: "&cThat command is not ready yet - contact admin"
|
||||
|
||||
commands:
|
||||
help:
|
||||
color:
|
||||
usage: "&E"
|
||||
parameters: "&B"
|
||||
description: "&2"
|
||||
header: "&7=========== &c%bsb_plugin_name% &7==========="
|
||||
syntax: " &7/&b[label] &c[command] &a[args] &7: &e[info]"
|
||||
syntax-alias-separator: "/"
|
||||
@ -65,8 +69,8 @@ commands:
|
||||
parameters: "<home number>"
|
||||
setname:
|
||||
description: "set a name for your island"
|
||||
name-too-short: "Too short. Minimum size is [length] characters."
|
||||
name-too-long: "Too long. Maximum size is [length] characters."
|
||||
name-too-short: "&cToo short. Minimum size is [length] characters."
|
||||
name-too-long: "&cToo long. Maximum size is [length] characters."
|
||||
parameters: "<name>"
|
||||
resetname:
|
||||
description: "reset your island name"
|
||||
@ -77,20 +81,20 @@ commands:
|
||||
invite:
|
||||
description: "invite a player to join your island"
|
||||
errors:
|
||||
island-is-full: "Your island is full, you can't invite anyone else."
|
||||
none-invited-you: "No one invited you :c."
|
||||
you-already-are-in-team: "You are already on a team!"
|
||||
invalid-invite: "That invite is no longer valid, sorry."
|
||||
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!"
|
||||
invalid-invite: "&cThat invite is no longer valid, sorry."
|
||||
parameters: "<player>"
|
||||
you-can-invite: "You can invite [number] more players."
|
||||
accept:
|
||||
description: "accept an invitation"
|
||||
you-joined-island: "You have joined an island! Use /[label] team info to see the other members."
|
||||
name-joined-your-island: "[name] has joined your island!"
|
||||
you-joined-island: "&aYou joined an island! Use /[label] team info to see the other members."
|
||||
name-joined-your-island: "&a[name] joined your island!"
|
||||
reject:
|
||||
description: "reject an invitation"
|
||||
you-rejected-invite: "You have rejected the invitation to join an island."
|
||||
name-rejected-your-invite: "[name] has rejected your island invite!"
|
||||
you-rejected-invite: "&aYou rejected the invitation to join an island."
|
||||
name-rejected-your-invite: "&c[name] rejected your island invite!"
|
||||
cancel:
|
||||
description: "cancel the pending invite to join your island"
|
||||
leave:
|
||||
@ -104,11 +108,11 @@ commands:
|
||||
setowner:
|
||||
description: "transfer your island ownership to a member"
|
||||
errors:
|
||||
cant-transfer-to-yourself: "You can't transfer ownership to yourself! Well, in facts, you could have been able to do so... But we don't want you to do so. 'Cause it's bad."
|
||||
target-is-not-member: "That player is not part of your island team!"
|
||||
name-is-the-owner: "[name] is now the island owner!"
|
||||
cant-transfer-to-yourself: "&cYou can't transfer ownership to yourself! Well, infact, you could... But we don't want you to. 'Cause it's bad."
|
||||
target-is-not-member: "&cThat player is not part of your island team!"
|
||||
name-is-the-owner: "&a[name] is now the island owner!"
|
||||
parameters: "<player>"
|
||||
you-are-the-owner: "You are now the island owner!"
|
||||
you-are-the-owner: "&aYou are now the island owner!"
|
||||
ban:
|
||||
description: "ban a player from your island"
|
||||
parameters: "<player>"
|
||||
@ -196,11 +200,11 @@ protection:
|
||||
TNT_BLOW_UP_CHESTS: "TNT_BLOW_UP_CHESTS"
|
||||
VILLAGER_TRADING: "VILLAGER_TRADING"
|
||||
state:
|
||||
allowed: "allowed"
|
||||
disallowed: "disallowed"
|
||||
allowed: "&aallowed"
|
||||
disallowed: "&cdisallowed"
|
||||
|
||||
island:
|
||||
locked: "This island is locked!"
|
||||
locked: "&cThis island is locked!"
|
||||
|
||||
new-island:
|
||||
sign:
|
||||
|
@ -2,6 +2,8 @@ package us.tastybento.bskyblock.api.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
/**
|
||||
* Adds a default help to every command that will show the usage of the command
|
||||
* and the usage of any subcommands that the command has.
|
||||
@ -26,20 +28,21 @@ public class DefaultHelpCommand extends CompositeCommand {
|
||||
if (args.isEmpty()) {
|
||||
if (!parent.getLabel().equals("help")) {
|
||||
// Get elements
|
||||
String params = getParameters().isEmpty() ? "" : user.getTranslation(getParameters()) + " ";
|
||||
String desc = getDescription().isEmpty() ? "" : user.getTranslation(getDescription());
|
||||
String usage = parent.getUsage().isEmpty() ? "" : user.getTranslationOrNothing("commands.help.color.usage") + user.getTranslation(parent.getUsage());
|
||||
String params = getParameters().isEmpty() ? "" : ChatColor.RESET + " " + user.getTranslationOrNothing("commands.help.color.parameters") + user.getTranslation(getParameters());
|
||||
String desc = getDescription().isEmpty() ? "" : ChatColor.RESET + user.getTranslationOrNothing("commands.help.color.description") + " " + user.getTranslation(getDescription());
|
||||
// Show the help
|
||||
if (user.isPlayer()) {
|
||||
// Player. Check perms
|
||||
if (user.hasPermission(parent.getPermission())) {
|
||||
user.sendLegacyMessage(parent.getUsage() + " " + params + desc);
|
||||
user.sendRawMessage(usage + params + desc);
|
||||
} else {
|
||||
// No permission, nothing to see here. If you don't have permission, you cannot see any sub commands
|
||||
return true;
|
||||
}
|
||||
} else if (!parent.isOnlyPlayer()) {
|
||||
// Console. Only show if it is a console command
|
||||
user.sendLegacyMessage(parent.getUsage() + " " + params + desc);
|
||||
user.sendRawMessage(usage + params + desc);
|
||||
}
|
||||
}
|
||||
// Run through any subcommands and get their help
|
||||
|
@ -154,7 +154,7 @@ public class User {
|
||||
* Gets a translation for this user
|
||||
* @param reference
|
||||
* @param variables
|
||||
* @return
|
||||
* @return Translated string with colors converted
|
||||
*/
|
||||
public String getTranslation(String reference, String... variables) {
|
||||
String translation = plugin.getLocalesManager().get(this, reference);
|
||||
@ -163,7 +163,19 @@ public class User {
|
||||
translation.replace(variables[i], variables[i+1]);
|
||||
}
|
||||
}
|
||||
return translation;
|
||||
|
||||
return translation == null ? reference : ChatColor.translateAlternateColorCodes('&', translation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns blank string if reference is not available
|
||||
* @param reference
|
||||
* @param variables
|
||||
* @return
|
||||
*/
|
||||
public String getTranslationOrNothing(String reference, String... variables) {
|
||||
String translation = getTranslation(reference, variables);
|
||||
return translation == null ? "" : translation;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -188,7 +200,7 @@ public class User {
|
||||
* Should only be used for debug purposes.
|
||||
* @param message - the message to send
|
||||
*/
|
||||
public void sendLegacyMessage(String message) {
|
||||
public void sendRawMessage(String message) {
|
||||
if (sender != null) {
|
||||
sender.sendMessage(message);
|
||||
} else {
|
||||
|
@ -24,35 +24,35 @@ public class IslandAboutCommand extends CompositeCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(User user, List<String> args) {
|
||||
user.sendLegacyMessage("About " + BSkyBlock.getInstance().getDescription().getName() + " v" + BSkyBlock.getInstance().getDescription().getVersion() + ":");
|
||||
user.sendLegacyMessage("Copyright (c) 2017 - 2018 tastybento, Poslovitch");
|
||||
user.sendLegacyMessage("All rights reserved.");
|
||||
user.sendLegacyMessage("");
|
||||
user.sendLegacyMessage("Redistribution and use in source and binary forms, with or without");
|
||||
user.sendLegacyMessage("modification, are permitted provided that the following conditions are met:");
|
||||
user.sendRawMessage("About " + BSkyBlock.getInstance().getDescription().getName() + " v" + BSkyBlock.getInstance().getDescription().getVersion() + ":");
|
||||
user.sendRawMessage("Copyright (c) 2017 - 2018 tastybento, Poslovitch");
|
||||
user.sendRawMessage("All rights reserved.");
|
||||
user.sendRawMessage("");
|
||||
user.sendRawMessage("Redistribution and use in source and binary forms, with or without");
|
||||
user.sendRawMessage("modification, are permitted provided that the following conditions are met:");
|
||||
|
||||
user.sendLegacyMessage(" * Redistributions of source code must retain the above copyright notice,");
|
||||
user.sendLegacyMessage(" this list of conditions and the following disclaimer.");
|
||||
user.sendRawMessage(" * Redistributions of source code must retain the above copyright notice,");
|
||||
user.sendRawMessage(" this list of conditions and the following disclaimer.");
|
||||
|
||||
user.sendLegacyMessage(" * Redistributions in binary form must reproduce the above copyright");
|
||||
user.sendLegacyMessage(" notice, this list of conditions and the following disclaimer in the");
|
||||
user.sendLegacyMessage(" documentation and/or other materials provided with the distribution.");
|
||||
user.sendRawMessage(" * Redistributions in binary form must reproduce the above copyright");
|
||||
user.sendRawMessage(" notice, this list of conditions and the following disclaimer in the");
|
||||
user.sendRawMessage(" documentation and/or other materials provided with the distribution.");
|
||||
|
||||
user.sendLegacyMessage(" * Neither the name of the BSkyBlock team nor the names of its");
|
||||
user.sendLegacyMessage(" contributors may be used to endorse or promote products derived from");
|
||||
user.sendLegacyMessage(" this software without specific prior written permission.");
|
||||
user.sendRawMessage(" * Neither the name of the BSkyBlock team nor the names of its");
|
||||
user.sendRawMessage(" contributors may be used to endorse or promote products derived from");
|
||||
user.sendRawMessage(" this software without specific prior written permission.");
|
||||
|
||||
user.sendLegacyMessage("THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"");
|
||||
user.sendLegacyMessage("AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE");
|
||||
user.sendLegacyMessage("IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE");
|
||||
user.sendLegacyMessage("ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE");
|
||||
user.sendLegacyMessage("LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR");
|
||||
user.sendLegacyMessage("CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF");
|
||||
user.sendLegacyMessage("SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS");
|
||||
user.sendLegacyMessage("INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN");
|
||||
user.sendLegacyMessage("CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)");
|
||||
user.sendLegacyMessage("ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE");
|
||||
user.sendLegacyMessage("POSSIBILITY OF SUCH DAMAGE. ");
|
||||
user.sendRawMessage("THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"");
|
||||
user.sendRawMessage("AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE");
|
||||
user.sendRawMessage("IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE");
|
||||
user.sendRawMessage("ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE");
|
||||
user.sendRawMessage("LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR");
|
||||
user.sendRawMessage("CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF");
|
||||
user.sendRawMessage("SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS");
|
||||
user.sendRawMessage("INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN");
|
||||
user.sendRawMessage("CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)");
|
||||
user.sendRawMessage("ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE");
|
||||
user.sendRawMessage("POSSIBILITY OF SUCH DAMAGE. ");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class IslandCreateCommand extends CompositeCommand {
|
||||
if (getPlayers().inTeam(user.getUniqueId())) {
|
||||
return false;
|
||||
}
|
||||
user.sendLegacyMessage("Creating island...");
|
||||
user.sendRawMessage("Creating island...");
|
||||
createIsland(user);
|
||||
return true;
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ package us.tastybento.bskyblock.commands.island;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
@ -33,16 +35,17 @@ public class IslandMultiHomeHelp extends CompositeCommand {
|
||||
// This will only be shown if it is for a player
|
||||
if (user.isPlayer()) {
|
||||
// Get elements
|
||||
String params = getParameters().isEmpty() ? "" : user.getTranslation(getParameters()) + " ";
|
||||
String desc = getDescription().isEmpty() ? "" : user.getTranslation(getDescription());
|
||||
String usage = parent.getUsage().isEmpty() ? "" : user.getTranslationOrNothing("commands.help.color.usage") + user.getTranslation(parent.getUsage());
|
||||
String params = getParameters().isEmpty() ? "" : ChatColor.RESET + " " + user.getTranslationOrNothing("commands.help.color.parameters") + user.getTranslation(getParameters());
|
||||
String desc = getDescription().isEmpty() ? "" : ChatColor.RESET + user.getTranslationOrNothing("commands.help.color.description") + " " + user.getTranslation(getDescription());
|
||||
// Player. Check perms
|
||||
if (user.hasPermission(getPermission())) {
|
||||
int maxHomes = Util.getPermValue(user.getPlayer(), Settings.PERMPREFIX + "island.maxhomes", Settings.maxHomes);
|
||||
if (maxHomes > 1) {
|
||||
user.sendLegacyMessage(parent.getUsage() + " " + params + desc);
|
||||
user.sendRawMessage(usage + params + desc);
|
||||
} else {
|
||||
// No params
|
||||
user.sendLegacyMessage(parent.getUsage() + " " + desc);
|
||||
user.sendRawMessage(usage + desc);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
|
@ -15,7 +15,6 @@ public class IslandTeamLeaveCommand extends AbstractIslandTeamCommand {
|
||||
public void setup() {
|
||||
this.setPermission(Settings.PERMPREFIX + "island.team");
|
||||
this.setOnlyPlayer(true);
|
||||
this.setParameters("command.island.team.leave.parameters");
|
||||
this.setDescription("commands.island.team.leave.description");
|
||||
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ public class IslandTeamPromoteCommand extends AbstractIslandTeamCommand {
|
||||
public void setup() {
|
||||
this.setPermission(Settings.PERMPREFIX + "island.team");
|
||||
this.setOnlyPlayer(true);
|
||||
this.setParameters("island.team.promote.parameters");
|
||||
this.setParameters("commands.island.team.promote.parameters");
|
||||
this.setDescription("commands.island.team.promote.description");
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,12 @@ public class LocalesManager {
|
||||
this.loadLocales("BSB"); // Default
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the reference from the locale file for this user
|
||||
* @param user
|
||||
* @param reference
|
||||
* @return translated string, or if the translation does not exist, the default language version, or if that does not exist null
|
||||
*/
|
||||
public String get(User user, String reference) {
|
||||
BSBLocale locale = languages.get(user.getLocale());
|
||||
if (locale != null && locale.contains(reference))
|
||||
@ -30,7 +36,7 @@ public class LocalesManager {
|
||||
if (languages.get(Locale.forLanguageTag(Settings.defaultLanguage)).contains(reference)) {
|
||||
return languages.get(Locale.forLanguageTag(Settings.defaultLanguage)).get(reference);
|
||||
}
|
||||
return reference;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user