Add description for default and disabled backpack skins

This commit is contained in:
GeorgH93 2021-05-28 21:06:49 +02:00
parent 97e3a90c8f
commit 736e7d5b19
No known key found for this signature in database
GPG Key ID: D1630D37F9E4B3C8
4 changed files with 16 additions and 3 deletions

View File

@ -69,6 +69,10 @@ Language:
GUI: GUI:
# No Json!!! # No Json!!!
Title: "&bSelect your backpack design" Title: "&bSelect your backpack design"
TitleDefault: "&eStandard"
TitleNone: "&eDeaktiviert"
DescriptionDefault: [ "Nutzte das Server standard aussehen für den Rucksack." ]
DescriptionNone: [ "Deaktiviere das Rucksack Item." ]
# No Json!!! # No Json!!!
Items: Items:

View File

@ -70,6 +70,10 @@ Language:
GUI: GUI:
# No Json!!! # No Json!!!
Title: "&bSelect your backpack design" Title: "&bSelect your backpack design"
TitleDefault: "&eDefault"
TitleNone: "&eDisable"
DescriptionDefault: [ "Use the servers default backpack skin." ]
DescriptionNone: [ "Disables the backpack item." ]
# No Json!!! # No Json!!!
Items: Items:

View File

@ -33,7 +33,6 @@
import at.pcgamingfreaks.StringUtils; import at.pcgamingfreaks.StringUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -111,13 +110,13 @@ public ShortcutCommand(final @NotNull Minepacks plugin, final @NotNull ItemShort
//endregion //endregion
//region set default button //region set default button
ItemConfig defaultItem = plugin.getBackpacksConfig().getBackpackStylesMap().get(MagicValues.BACKPACK_STYLE_NAME_DEFAULT); ItemConfig defaultItem = plugin.getBackpacksConfig().getBackpackStylesMap().get(MagicValues.BACKPACK_STYLE_NAME_DEFAULT);
ItemStack item = new ItemConfig(MagicValues.BACKPACK_STYLE_NAME_DEFAULT, defaultItem.getMaterial().name(), defaultItem.getAmount(), MagicValues.BACKPACK_STYLE_NAME_DEFAULT, defaultItem.getLore(), defaultItem.getModel(), defaultItem.getValue()).make(1); ItemStack item = new ItemConfig(defaultItem.getName(), defaultItem.getMaterial().name(), defaultItem.getAmount(), plugin.getLanguage().getTranslated("Ingame.Shortcut.GUI.TitleDefault"), plugin.getLanguage().getTranslatedList("Ingame.Shortcut.GUI.DescriptionDefault"), defaultItem.getModel(), defaultItem.getValue()).make(1);
guiBuilder.addButton(new GuiButton(item, (player, clickType, cursor) -> { player.performCommand(setCommandBase + MagicValues.BACKPACK_STYLE_NAME_DEFAULT); player.closeInventory(); })); guiBuilder.addButton(new GuiButton(item, (player, clickType, cursor) -> { player.performCommand(setCommandBase + MagicValues.BACKPACK_STYLE_NAME_DEFAULT); player.closeInventory(); }));
//endregion //endregion
//region set disable button //region set disable button
if(allowPlayerDisable) if(allowPlayerDisable)
{ {
item = new ItemConfig(MagicValues.BACKPACK_STYLE_NAME_DISABLED, "BARRIER", 1, MagicValues.BACKPACK_STYLE_NAME_DISABLED, null, -1, null).make(1); item = new ItemConfig(MagicValues.BACKPACK_STYLE_NAME_DISABLED, "BARRIER", 1, plugin.getLanguage().getTranslated("Ingame.Shortcut.GUI.TitleNone"), plugin.getLanguage().getTranslatedList("Ingame.Shortcut.GUI.DescriptionNone"), -1, null).make(1);
guiBuilder.addButton(new GuiButton(item, (player, clickType, cursor) -> { player.performCommand(setCommandBase + MagicValues.BACKPACK_STYLE_NAME_DISABLED); player.closeInventory(); })); guiBuilder.addButton(new GuiButton(item, (player, clickType, cursor) -> { player.performCommand(setCommandBase + MagicValues.BACKPACK_STYLE_NAME_DISABLED); player.closeInventory(); }));
} }
//endregion //endregion

View File

@ -25,6 +25,7 @@
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
public class Language extends at.pcgamingfreaks.Bukkit.Language public class Language extends at.pcgamingfreaks.Bukkit.Language
{ {
@ -68,4 +69,9 @@ public String[] getCommandAliases(final String command, final @NotNull String...
if(!switches.contains(defaultSwitch)) switches.add(defaultSwitch); if(!switches.contains(defaultSwitch)) switches.add(defaultSwitch);
return switches.toArray(new String[0]); return switches.toArray(new String[0]);
} }
public @NotNull List<String> getTranslatedList(final @NotNull String key)
{
return getYamlE().getStringList("Language." + key, new ArrayList<>(0)).stream().map(this::translateColorCodes).collect(Collectors.toList());
}
} }