1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

[CI skip] Updated language files

This commit is contained in:
TheBusyBiscuit 2020-03-10 22:09:19 +01:00
parent eb6140c7ed
commit 952d2592b7
6 changed files with 44 additions and 28 deletions

View File

@ -6,6 +6,7 @@ import java.util.Set;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Particle; import org.bukkit.Particle;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -51,7 +52,7 @@ public final class TeleportationManager {
menu.addItem(slot, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler()); menu.addItem(slot, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
} }
menu.addItem(4, new CustomItem(SkullItem.fromBase64("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzljODg4MWU0MjkxNWE5ZDI5YmI2MWExNmZiMjZkMDU5OTEzMjA0ZDI2NWRmNWI0MzliM2Q3OTJhY2Q1NiJ9fX0="), "&7Waypoint Overview &e(Select a Destination)")); menu.addItem(4, new CustomItem(SkullItem.fromHash("c9c8881e42915a9d29bb61a16fb26d059913204d265df5b439b3d792acd56"), ChatColor.YELLOW + SlimefunPlugin.getLocal().getMessage(p, "machines.TELEPORTER.gui.title")));
menu.addMenuClickHandler(4, ChestMenuUtils.getEmptyClickHandler()); menu.addMenuClickHandler(4, ChestMenuUtils.getEmptyClickHandler());
Location source = new Location(b.getWorld(), b.getX() + 0.5D, b.getY() + 2D, b.getZ() + 0.5D); Location source = new Location(b.getWorld(), b.getX() + 0.5D, b.getY() + 2D, b.getZ() + 0.5D);
@ -64,10 +65,10 @@ public final class TeleportationManager {
Location l = entry.getValue(); Location l = entry.getValue();
ItemStack globe = network.getIcon(entry); ItemStack globe = network.getIcon(entry);
menu.addItem(slot, new CustomItem(globe, entry.getKey(), "&8\u21E8 &7World: &r" + l.getWorld().getName(), "&8\u21E8 &7X: &r" + l.getX(), "&8\u21E8 &7Y: &r" + l.getY(), "&8\u21E8 &7Z: &r" + l.getZ(), "&8\u21E8 &7Estimated Teleportation Time: &r" + DoubleHandler.fixDouble(0.5 * getTeleportationTime(complexity, source, l)) + "s", "", "&8\u21E8 &cClick to select")); menu.addItem(slot, new CustomItem(globe, entry.getKey(), "", "&8\u21E8 &7" + SlimefunPlugin.getLocal().getResourceString(p, "tooltips.world") + ": &r" + l.getWorld().getName(), "&8\u21E8 &7X: &r" + l.getX(), "&8\u21E8 &7Y: &r" + l.getY(), "&8\u21E8 &7Z: &r" + l.getZ(), "&8\u21E8 &7" + SlimefunPlugin.getLocal().getMessage(p, "machines.TELEPORTER.gui.time") + ": &r" + DoubleHandler.fixDouble(0.5 * getTeleportationTime(complexity, source, l)) + "s", "", "&8\u21E8 &c" + SlimefunPlugin.getLocal().getMessage(p, "machines.TELEPORTER.gui.tooltip")));
menu.addMenuClickHandler(slot, (pl, s, item, action) -> { menu.addMenuClickHandler(slot, (pl, s, item, action) -> {
pl.closeInventory(); pl.closeInventory();
start(pl.getUniqueId(), complexity, source, l, false); teleport(pl.getUniqueId(), complexity, source, l, false);
return false; return false;
}); });
@ -77,7 +78,7 @@ public final class TeleportationManager {
menu.open(p); menu.open(p);
} }
public void start(UUID uuid, int complexity, Location source, Location destination, boolean resistance) { public void teleport(UUID uuid, int complexity, Location source, Location destination, boolean resistance) {
teleporterUsers.add(uuid); teleporterUsers.add(uuid);
int time = getTeleportationTime(complexity, source, destination); int time = getTeleportationTime(complexity, source, destination);

View File

@ -31,11 +31,7 @@ public class PermissionsService {
public void load() { public void load() {
config = new Config(plugin, "permissions.yml"); config = new Config(plugin, "permissions.yml");
config.getConfiguration().options().header( config.getConfiguration().options().header("This file is used to assign permission nodes to items from Slimefun or any of its addons.\n" + "To assign an item a certain permission node you simply have to set the 'permission' attribute\n" + "to your desired permission node. You can also customize the text that is displayed when a Player does not have that permission.");
"This file is used to assign permission nodes to items from Slimefun or any of its addons.\n" +
"To assign an item a certain permission node you simply have to set the 'permission' attribute\n" +
"to your desired permission node. You can also customize the text that is displayed when a Player does not have that permission."
);
config.getConfiguration().options().copyHeader(true); config.getConfiguration().options().copyHeader(true);
} }
@ -56,18 +52,23 @@ public class PermissionsService {
String permission = SlimefunPlugin.getItemCfg().getString(item.getID() + ".required-permission"); String permission = SlimefunPlugin.getItemCfg().getString(item.getID() + ".required-permission");
if (permission != null) { if (permission != null) {
config.setDefaultValue(item.getID() + ".permission", permission.length() == 0 ? "none": permission); config.setDefaultValue(item.getID() + ".permission", permission.length() == 0 ? "none" : permission);
config.setDefaultValue(item.getID() + ".lore", SlimefunPlugin.getItemCfg().getString(item.getID() + ".no-permission-tooltip")); config.setDefaultValue(item.getID() + ".lore", SlimefunPlugin.getItemCfg().getString(item.getID() + ".no-permission-tooltip"));
SlimefunPlugin.getItemCfg().setValue(item.getID() + ".required-permission", null); SlimefunPlugin.getItemCfg().setValue(item.getID() + ".required-permission", null);
SlimefunPlugin.getItemCfg().setValue(item.getID() + ".no-permission-tooltip", null); SlimefunPlugin.getItemCfg().setValue(item.getID() + ".no-permission-tooltip", null);
return true; return true;
} }
return false; return false;
} }
public boolean hasPermission(Player p, SlimefunItem item) { public boolean hasPermission(Player p, SlimefunItem item) {
if (item == null) {
// Failsafe
return true;
}
String permission = config.getString(item.getID() + ".permission"); String permission = config.getString(item.getID() + ".permission");
return permission == null || permission.equals("none") || p.hasPermission(permission); return permission == null || permission.equals("none") || p.hasPermission(permission);
@ -75,7 +76,7 @@ public class PermissionsService {
public List<String> getLore(SlimefunItem item) { public List<String> getLore(SlimefunItem item) {
List<String> lore = config.getStringList(item.getID() + ".lore"); List<String> lore = config.getStringList(item.getID() + ".lore");
return lore == null ? Arrays.asList("LORE NOT FOUND"): lore; return lore == null ? Arrays.asList("LORE NOT FOUND") : lore;
} }
} }

View File

@ -145,17 +145,20 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
return true; return true;
} }
else { else {
List<String> parents = new ArrayList<>(); List<String> lore = new ArrayList<>();
parents.add(""); lore.add("");
parents.add(ChatColor.translateAlternateColorCodes('&', "&rYou need to unlock all Items"));
parents.add(ChatColor.translateAlternateColorCodes('&', "&rfrom the following Categories first:")); for (String line : SlimefunPlugin.getLocal().getMessages(p, "guide.locked-category")) {
parents.add(""); lore.add(ChatColor.RESET + line);
}
lore.add("");
for (Category parent : ((LockedCategory) category).getParents()) { for (Category parent : ((LockedCategory) category).getParents()) {
parents.add(parent.getItem(p).getItemMeta().getDisplayName()); lore.add(parent.getItem(p).getItemMeta().getDisplayName());
} }
menu.addItem(index, new CustomItem(Material.BARRIER, "&4LOCKED &7- &r" + category.getItem(p).getItemMeta().getDisplayName(), parents.toArray(new String[0]))); menu.addItem(index, new CustomItem(Material.BARRIER, "&4" + SlimefunPlugin.getLocal().getMessage(p, "guide.locked") + " &7- &r" + category.getItem(p).getItemMeta().getDisplayName(), lore.toArray(new String[0])));
menu.addMenuClickHandler(index, ChestMenuUtils.getEmptyClickHandler()); menu.addMenuClickHandler(index, ChestMenuUtils.getEmptyClickHandler());
return true; return true;
} }
@ -209,7 +212,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
if (survival && research != null && !profile.hasUnlocked(research)) { if (survival && research != null && !profile.hasUnlocked(research)) {
if (Slimefun.hasPermission(p, sfitem, false)) { if (Slimefun.hasPermission(p, sfitem, false)) {
menu.addItem(index, new CustomItem(Material.BARRIER, "&r" + ItemUtils.getItemName(sfitem.getItem()), "&4&lLOCKED", "", "&a> Click to unlock", "", "&7Cost: &b" + research.getCost() + " Level")); menu.addItem(index, new CustomItem(Material.BARRIER, "&r" + ItemUtils.getItemName(sfitem.getItem()), "&4&l" + SlimefunPlugin.getLocal().getMessage(p, "guide.locked"), "", "&a> Click to unlock", "", "&7Cost: &b" + research.getCost() + " Level"));
menu.addMenuClickHandler(index, (pl, slot, item, action) -> { menu.addMenuClickHandler(index, (pl, slot, item, action) -> {
if (!SlimefunPlugin.getRegistry().getCurrentlyResearchingPlayers().contains(pl.getUniqueId())) { if (!SlimefunPlugin.getRegistry().getCurrentlyResearchingPlayers().contains(pl.getUniqueId())) {
if (research.canUnlock(pl)) { if (research.canUnlock(pl)) {
@ -223,7 +226,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
if (pl.getGameMode() == GameMode.CREATIVE) { if (pl.getGameMode() == GameMode.CREATIVE) {
research.unlock(pl, SlimefunPlugin.getSettings().researchesFreeInCreative); research.unlock(pl, SlimefunPlugin.getSettings().researchesFreeInCreative);
openCategory(profile, category, survival, page); Slimefun.runSync(() -> openCategory(profile, category, survival, page), 5L);
} }
else { else {
research.unlock(pl, false); research.unlock(pl, false);
@ -277,7 +280,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
Player p = profile.getPlayer(); Player p = profile.getPlayer();
if (p == null) return; if (p == null) return;
ChestMenu menu = new ChestMenu("Searching for: " + ChatUtils.crop(ChatColor.RESET, input)); ChestMenu menu = new ChestMenu(SlimefunPlugin.getLocal().getMessage(p, "guide.search.inventory").replace("%item%", ChatUtils.crop(ChatColor.RESET, input)));
String searchTerm = input.toLowerCase(); String searchTerm = input.toLowerCase();
if (addToHistory) { if (addToHistory) {
@ -542,7 +545,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
if (slimefunItem == null) return item; if (slimefunItem == null) return item;
String lore = Slimefun.hasPermission(p, slimefunItem, false) ? "&rNeeds to be unlocked elsewhere" : "&rNo Permission"; String lore = Slimefun.hasPermission(p, slimefunItem, false) ? "&rNeeds to be unlocked elsewhere" : "&rNo Permission";
return Slimefun.hasUnlocked(p, slimefunItem, false) ? item : new CustomItem(Material.BARRIER, ItemUtils.getItemName(item), "&4&lLOCKED", "", lore); return Slimefun.hasUnlocked(p, slimefunItem, false) ? item : new CustomItem(Material.BARRIER, ItemUtils.getItemName(item), "&4&l" + SlimefunPlugin.getLocal().getMessage(p, "guide.locked"), "", lore);
} }
else { else {
return item; return item;

View File

@ -55,7 +55,7 @@ public final class ChestMenuUtils {
return new CustomItem(SEARCH_BUTTON, meta -> { return new CustomItem(SEARCH_BUTTON, meta -> {
meta.setDisplayName(ChatColors.color(SlimefunPlugin.getLocal().getMessage(p, "guide.search.name"))); meta.setDisplayName(ChatColors.color(SlimefunPlugin.getLocal().getMessage(p, "guide.search.name")));
List<String> lore = SlimefunPlugin.getLocal().getMessages(p, "guide.search.lore"); List<String> lore = Arrays.asList("", ChatColor.GRAY + "\u21E6 " + SlimefunPlugin.getLocal().getMessage(p, "guide.search.tooltip"));
lore.replaceAll(ChatColors::color); lore.replaceAll(ChatColors::color);
meta.setLore(lore); meta.setLore(lore);
}); });

View File

@ -173,7 +173,7 @@ public class Research implements Keyed {
* @param instant * @param instant
* Whether to unlock the research instantly * Whether to unlock the research instantly
*/ */
public void unlock(final Player p, boolean instant) { public void unlock(Player p, boolean instant) {
if (!instant) { if (!instant) {
Slimefun.runSync(() -> { Slimefun.runSync(() -> {
p.playSound(p.getLocation(), Sound.ENTITY_BAT_TAKEOFF, 0.7F, 1F); p.playSound(p.getLocation(), Sound.ENTITY_BAT_TAKEOFF, 0.7F, 1F);

View File

@ -16,12 +16,18 @@ commands:
reset-target: '&cYour Knowledge has been reset' reset-target: '&cYour Knowledge has been reset'
guide: guide:
locked: 'LOCKED'
locked-category:
- 'To unlock this category you will'
- 'need to unlock all items from the'
- 'following categories'
search: search:
message: '&bWhat would you like to search for?' message: '&bWhat would you like to search for?'
name: '&7Search...' name: '&7Search...'
lore: tooltip: '&bClick to search for an item'
- '&bWhat would you like to search for?' inventory: 'Searching for: %item%'
- '&7Type your search term into chat'
tooltips: tooltips:
open-category: 'Click to open' open-category: 'Click to open'
@ -176,6 +182,11 @@ machines:
teleported: '&3Teleported!' teleported: '&3Teleported!'
cancelled: '&4Teleportation cancelled!' cancelled: '&4Teleportation cancelled!'
invulnerability: '&b&lYou have been given 30 seconds of Invulnerability!' invulnerability: '&b&lYou have been given 30 seconds of Invulnerability!'
gui:
title: 'Your waypoints'
tooltip: 'Click to teleport'
time: 'Estimated time'
GPS_CONTROL_PANEL: GPS_CONTROL_PANEL:
title: 'GPS - Control Panel' title: 'GPS - Control Panel'