Mirror von
https://github.com/TheSilentPro/HeadDB.git
synchronisiert 2024-12-28 03:40:06 +01:00
Merge pull request #25 from Altruiis/localization-improvements
Localization & reload command improvements
Dieser Commit ist enthalten in:
Commit
6008217367
@ -46,8 +46,12 @@ public class CommandHeadDB implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sub.equalsIgnoreCase("reload") || sub.equalsIgnoreCase("r")) {
|
if (sub.equalsIgnoreCase("reload") || sub.equalsIgnoreCase("r")) {
|
||||||
|
if (!sender.hasPermission("headdb.reload")) {
|
||||||
|
Utils.sendMessage(sender, localization.getMessage("noPermission"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
HeadDB.getInstance().getLocalization().load();
|
HeadDB.getInstance().getLocalization().load();
|
||||||
Utils.sendMessage(sender, "&aReloaded messages file!");
|
Utils.sendMessage(sender, localization.getMessage("reloadMessages"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,9 +181,9 @@ public class InventoryUtils {
|
|||||||
for (Category category : Category.cache) {
|
for (Category category : Category.cache) {
|
||||||
ItemStack item = getUIItem(category.getName(), category.getItem());
|
ItemStack item = getUIItem(category.getName(), category.getItem());
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
meta.setDisplayName(Utils.colorize(category.getColor() + "&l" + category.getName().toUpperCase()));
|
meta.setDisplayName(Utils.colorize(localization.getMessage("menu.heads." + category.getName())));
|
||||||
List<String> lore = new ArrayList<>();
|
List<String> lore = new ArrayList<>();
|
||||||
lore.add(Utils.colorize("&e" + HeadAPI.getHeads(category).size() + " heads"));
|
lore.add(Utils.colorize(replace(localization.getMessage("menu.lore"), HeadAPI.getHeads(category).size(), "Main", "None", player)));
|
||||||
meta.setLore(lore);
|
meta.setLore(lore);
|
||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
inventory.setItem(getUILocation(category.getName(), category.getLocation()), item);
|
inventory.setItem(getUILocation(category.getName(), category.getLocation()), item);
|
||||||
@ -312,7 +312,7 @@ public class InventoryUtils {
|
|||||||
// If economy is disabled or no plugin is present, the item is free.
|
// If economy is disabled or no plugin is present, the item is free.
|
||||||
// Don't mention receiving it for free in this case, since it is always free.
|
// Don't mention receiving it for free in this case, since it is always free.
|
||||||
if (economy == null) {
|
if (economy == null) {
|
||||||
Utils.sendMessage(player, String.format("&7You received &e%d &7x &e%s&7!", amount, description));
|
Utils.sendMessage(player, String.format(localization.getMessage("noEconomy"), amount, description));
|
||||||
Utils.playSound(player, "noEconomy");
|
Utils.playSound(player, "noEconomy");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -323,17 +323,17 @@ public class InventoryUtils {
|
|||||||
if (cost > 0) {
|
if (cost > 0) {
|
||||||
if (economy.has(player, cost)) {
|
if (economy.has(player, cost)) {
|
||||||
economy.withdrawPlayer(player, cost);
|
economy.withdrawPlayer(player, cost);
|
||||||
Utils.sendMessage(player, String.format("&7You purchased &e%d &7x &e%s &7for &e%.2f&7!", amount, description, cost));
|
Utils.sendMessage(player, String.format(localization.getMessage("purchasedHead"), amount, description, cost));
|
||||||
Utils.playSound(player, "paid");
|
Utils.playSound(player, "paid");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Utils.sendMessage(player, String.format("&cYou do not have enough to purchase &e%d &cx &e%s&7.", amount, description));
|
Utils.sendMessage(player, String.format(localization.getMessage("notEnoughMoney"), amount, description));
|
||||||
Utils.playSound(player, "unavailable");
|
Utils.playSound(player, "unavailable");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, the item is free.
|
// Otherwise, the item is free.
|
||||||
Utils.sendMessage(player, String.format("&7You received &e%d &7x &e%s &7for &efree&7!", amount, description));
|
Utils.sendMessage(player, String.format(localization.getMessage("free"), amount, description));
|
||||||
Utils.playSound(player, "free");
|
Utils.playSound(player, "free");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,9 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void sendMessage(CommandSender sender, String message) {
|
public static void sendMessage(CommandSender sender, String message) {
|
||||||
sender.sendMessage(colorize(message));
|
if (!message.isEmpty()) {
|
||||||
|
sender.sendMessage(colorize(message));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String colorize(String string) {
|
public static String colorize(String string) {
|
||||||
|
@ -3,6 +3,11 @@ onlyPlayers: "&cOnly players may open the database."
|
|||||||
databaseOpen: "&7Opening &cHead Database"
|
databaseOpen: "&7Opening &cHead Database"
|
||||||
invalidPlayer: "&cPlayer is not online!"
|
invalidPlayer: "&cPlayer is not online!"
|
||||||
localFavorites: "&cLocal heads can not be added to favorites!"
|
localFavorites: "&cLocal heads can not be added to favorites!"
|
||||||
|
noEconomy: "&7You received &e%d &7x &e%s&7!"
|
||||||
|
purchasedHead: "&7You purchased &e%d &7x &e%s &7for &e%.2f&7!"
|
||||||
|
notEnoughMoney: "&cYou do not have enough to purchase &e%d &cx &e%s&7."
|
||||||
|
free: "&7You received &e%d &7x &e%s &7for &efree&7!"
|
||||||
|
reloadMessages: "&aReloaded messages file!"
|
||||||
|
|
||||||
menu:
|
menu:
|
||||||
main: "&c&lHeadDB &7(%size%)"
|
main: "&c&lHeadDB &7(%size%)"
|
||||||
@ -10,4 +15,16 @@ menu:
|
|||||||
tagSearch: "&c&lHeadDB &8- &eTag Search: %search%"
|
tagSearch: "&c&lHeadDB &8- &eTag Search: %search%"
|
||||||
search: "&c&lHeadDB &8- &eSearch: %search%"
|
search: "&c&lHeadDB &8- &eSearch: %search%"
|
||||||
favorites: "&c&lHeadDB &8- &eFavorites: %player%"
|
favorites: "&c&lHeadDB &8- &eFavorites: %player%"
|
||||||
local: "&c&lHeadDB &8- &aLocal Heads &7(%size%)"
|
local: "&c&lHeadDB &8- &aLocal Heads &7(%size%)"
|
||||||
|
lore: "&e%size% heads"
|
||||||
|
heads:
|
||||||
|
alphabet: "&e&lALPHABET"
|
||||||
|
animals: "&3&lANIMALS"
|
||||||
|
blocks: "&8&lBLOCKS"
|
||||||
|
decoration: "&6&lDECORATION"
|
||||||
|
food-drinks: "&6&lFOOD-DRINKS"
|
||||||
|
humans: "&1&lHUMANS"
|
||||||
|
humanoid: "&b&lHUMANOID"
|
||||||
|
miscellaneous: "&2&lMISCELLANEOUS"
|
||||||
|
monsters: "&c&lMONSTERS"
|
||||||
|
plants: "&a&lPLANTS"
|
@ -24,6 +24,7 @@ permissions:
|
|||||||
headdb.local: true
|
headdb.local: true
|
||||||
headdb.tagsearch: true
|
headdb.tagsearch: true
|
||||||
headdb.update: true
|
headdb.update: true
|
||||||
|
headdb.reload: true
|
||||||
headdb.open:
|
headdb.open:
|
||||||
default: op
|
default: op
|
||||||
headdb.search:
|
headdb.search:
|
||||||
@ -37,4 +38,6 @@ permissions:
|
|||||||
headdb.tagsearch:
|
headdb.tagsearch:
|
||||||
default: op
|
default: op
|
||||||
headdb.update:
|
headdb.update:
|
||||||
|
default: op
|
||||||
|
headdb.reload:
|
||||||
default: op
|
default: op
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren