Add Gui Multi Lang
Signed-off-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
fa1a3ccbdd
Commit
dcf07291d6
@ -167,13 +167,26 @@ GUI_EXPORT_CODE=§eDein Gui-Code:
|
||||
GUI_EXPORT_CODE-HOVER=§eKopieren
|
||||
GUI_IMPORT_INVALID-CODE=§eInvalieder Gui-Code
|
||||
GUI_IMPORT_CODE-SUCCESSFUL=§eGui-Code eingelesen
|
||||
|
||||
GUI_NAME=Bau GUI
|
||||
GUI_NO_PERMISSION=§cDu hast nicht genug rechte um dies zu tun
|
||||
GUI_NO_OWNER=§cDas ist nicht deine Bauwelt
|
||||
GUI_NO_WORLD=§cDu darfst hier die Welt nicht einstellen
|
||||
GUI_NO_WORLDEDIT=§cDu darfst hier kein Worldedit benutzen
|
||||
GUI_NO_MEMBER=§cDu must ein Member der Bauwelt sein
|
||||
GUI_ITEM_LORE1=§cDu kannst dieses Item zum Öffnen der BauGUI nutzen
|
||||
GUI_ITEM_LORE2=oder Doppel F (Swap hands) drücken.
|
||||
GUI_EDITOR_TITLE=Bau GUI Editor
|
||||
GUI_EDITOR_ITEM_ROW_P=§e+1 Zeile
|
||||
GUI_EDITOR_ITEM_ROW_M=§e-1 Zeile
|
||||
GUI_EDITOR_ITEM_TRASH=§cTrashcan
|
||||
GUI_EDITOR_ITEM_TRASH_LORE=§7Item hier rein Legen
|
||||
GUI_EDITOR_ITEM_MORE=§eMehr Items
|
||||
GUI_EDITOR_TITLE_MORE=Item auswählen
|
||||
# Trace
|
||||
TRACE_RECORD=§aan
|
||||
TRACE_RECORD-AUTO=§an
|
||||
TRACE_IDLE=§caus
|
||||
TRACE_IDLE-AUTO=§eauto
|
||||
|
||||
TRACE_MESSAGE-AUTO_RECORD=§cTNT-Tracer muss gestoppt werden
|
||||
TRACE_MESSAGE-AUTO_RECORD-AUTO=§cTNT-Tracer darf nicht aufnehmen
|
||||
TRACE_MESSAGE-AUTO_IDLE=§cAuto-Tracer gestoppt
|
||||
|
@ -44,14 +44,12 @@ public class BauGUI {
|
||||
private static final Set<Player> OPEN_INVS = new HashSet<>();
|
||||
private static boolean updating = false;
|
||||
|
||||
@Getter
|
||||
private static final ItemStack GUI_ITEM;
|
||||
|
||||
static {
|
||||
GUI_ITEM = new ItemStack(Material.NETHER_STAR);
|
||||
public static ItemStack getGUI_ITEM(Player p) {
|
||||
ItemStack GUI_ITEM = new ItemStack(Material.NETHER_STAR);
|
||||
ItemMeta meta = GUI_ITEM.getItemMeta();
|
||||
meta.setDisplayName(ColorConfig.HIGHLIGHT + "Bau GUI");
|
||||
meta.setDisplayName(ColorConfig.HIGHLIGHT + BauSystem.MESSAGE.parse("GUI_NAME", p));
|
||||
GUI_ITEM.setItemMeta(meta);
|
||||
return GUI_ITEM;
|
||||
}
|
||||
|
||||
public static void addItem(BauGuiItem item) {
|
||||
@ -66,7 +64,7 @@ public class BauGUI {
|
||||
OPEN_INVS.add(p);
|
||||
}
|
||||
BauGuiMapping mapping = BauGuiMapping.getGuiMapping(p);
|
||||
SWInventory inv = new SWInventory(p, mapping.getSize(), "Bau GUI");
|
||||
SWInventory inv = new SWInventory(p, mapping.getSize(), BauSystem.MESSAGE.parse("GUI_NAME", p));
|
||||
ITEMS.values().forEach(item -> {
|
||||
if (!mapping.isShown(item.getId())) {
|
||||
return;
|
||||
@ -79,7 +77,7 @@ public class BauGUI {
|
||||
}
|
||||
} else {
|
||||
p.closeInventory();
|
||||
p.sendMessage(BauSystem.PREFIX + ColorConfig.ERROR + "Du hast nicht genug rechte um dies zu tun");
|
||||
BauSystem.MESSAGE.send("GUI_NO_PERMISSION", p);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -98,7 +96,7 @@ public class BauGUI {
|
||||
}
|
||||
|
||||
public static void giveItem(Player p) {
|
||||
SWUtils.giveItemToPlayer(p, GUI_ITEM);
|
||||
SWUtils.giveItemToPlayer(p, getGUI_ITEM(p));
|
||||
}
|
||||
|
||||
private static ItemStack permissionLore(ItemStack itemStack, Permission permission, Player p) {
|
||||
@ -106,9 +104,9 @@ public class BauGUI {
|
||||
if (!permission.hasPermission(p)) {
|
||||
List<String> lore = meta.getLore();
|
||||
if (lore == null) {
|
||||
lore = Collections.singletonList(ColorConfig.ERROR + permissionString(permission));
|
||||
lore = Collections.singletonList(BauSystem.MESSAGE.parse(permissionString(permission), p));
|
||||
} else {
|
||||
lore.add(ColorConfig.ERROR + permissionString(permission));
|
||||
lore.add(BauSystem.MESSAGE.parse(permissionString(permission), p));
|
||||
}
|
||||
meta.setLore(lore);
|
||||
}
|
||||
@ -119,13 +117,13 @@ public class BauGUI {
|
||||
private static String permissionString(Permission permission) {
|
||||
switch (permission) {
|
||||
case OWNER:
|
||||
return "Das ist nicht deine Bauwelt";
|
||||
return "GUI_NO_OWNER";
|
||||
case WORLD:
|
||||
return "Du darfst hier die Welt nicht einstellen";
|
||||
return "GUI_NO_WORLD";
|
||||
case WORLDEDIT:
|
||||
return "Du darfst hier kein Worldedit benutzen";
|
||||
return "GUI_NO_WORLDEDIT";
|
||||
default:
|
||||
return "Du must ein Member der Bauwelt sein";
|
||||
return "GUI_NO_MEMBER";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,11 +19,12 @@
|
||||
|
||||
package de.steamwar.bausystem.features.gui;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -41,7 +42,8 @@ public class BauGuiBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public ItemStack getItem(Player player) {
|
||||
return new SWItem(Material.NETHER_STAR, ColorConfig.HIGHLIGHT + "Bau GUI", Arrays.asList(ColorConfig.BASE + "Du kannst dieses Item zum Öffnen der BauGUI nutzen", ColorConfig.BASE + "oder Doppel F (Swap hands) drücken."), false, clickType -> {
|
||||
return new SWItem(Material.NETHER_STAR, ColorConfig.HIGHLIGHT + BauSystem.MESSAGE.parse("GUI_NAME", player),
|
||||
Arrays.asList(BauSystem.MESSAGE.parse("GUI_ITEM_LORE1", player), BauSystem.MESSAGE.parse("GUI_ITEM_LORE2", player)), false, clickType -> {
|
||||
}).getItemStack();
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class BauGuiListener implements Listener {
|
||||
}
|
||||
|
||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) {
|
||||
if (event.getItem().isSimilar(BauGUI.getGUI_ITEM())) {
|
||||
if (event.getItem().isSimilar(BauGUI.getGUI_ITEM(event.getPlayer()))) {
|
||||
BauGUI.openBauGui(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public class BauGuiEditor implements Listener {
|
||||
|
||||
public static void openGuiEditor(Player p, ItemStack cursor) {
|
||||
BauGuiMapping mapping = BauGuiMapping.getGuiMapping(p);
|
||||
Inventory inv = Bukkit.createInventory(null, mapping.getSize() + 9, "Bau Gui Editor");
|
||||
Inventory inv = Bukkit.createInventory(null, mapping.getSize() + 9, BauSystem.MESSAGE.parse("GUI_EDITOR_TITLE", p));
|
||||
for (Map.Entry<Integer, Integer> e : mapping.getMapping().entrySet()) {
|
||||
if (e.getValue() >= 0) {
|
||||
if (e.getValue() < mapping.getSize()) {
|
||||
@ -68,12 +68,12 @@ public class BauGuiEditor implements Listener {
|
||||
inv.setItem(j, new SWItem(Material.WHITE_STAINED_GLASS_PANE, ColorConfig.HIGHLIGHT + "").getItemStack());
|
||||
}
|
||||
|
||||
inv.setItem(mapping.getSize() + 3, new SWItem(mapping.getSize() == 9 * 5 ? Material.GRAY_STAINED_GLASS_PANE : Material.LIME_STAINED_GLASS_PANE, ColorConfig.HIGHLIGHT + "+1 Zeile").getItemStack());
|
||||
inv.setItem(mapping.getSize() + 2, new SWItem(mapping.getSize() == 9 ? Material.GRAY_STAINED_GLASS_PANE : Material.RED_STAINED_GLASS_PANE, ColorConfig.HIGHLIGHT + "-1 Zeile").getItemStack());
|
||||
inv.setItem(mapping.getSize() + 3, new SWItem(mapping.getSize() == 9 * 5 ? Material.GRAY_STAINED_GLASS_PANE : Material.LIME_STAINED_GLASS_PANE, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_ROW_P", p)).getItemStack());
|
||||
inv.setItem(mapping.getSize() + 2, new SWItem(mapping.getSize() == 9 ? Material.GRAY_STAINED_GLASS_PANE : Material.RED_STAINED_GLASS_PANE, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_ROW_M", p)).getItemStack());
|
||||
|
||||
inv.setItem(mapping.getSize() + 5, new SWItem(Material.BARRIER, ColorConfig.ERROR + "Trashcan", Arrays.asList(ColorConfig.BASE + "Item hier rein Legen"), false, clickType -> {
|
||||
inv.setItem(mapping.getSize() + 5, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH", p), Arrays.asList(BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH_LORE", p)), false, clickType -> {
|
||||
}).getItemStack());
|
||||
inv.setItem(mapping.getSize() + 6, new SWItem(Material.SCUTE, ColorConfig.HIGHLIGHT + "Mehr Items").getItemStack());
|
||||
inv.setItem(mapping.getSize() + 6, new SWItem(Material.SCUTE, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_MORE", p)).getItemStack());
|
||||
|
||||
p.openInventory(inv);
|
||||
p.getOpenInventory().setCursor(cursor == null ? new SWItem().getItemStack() : cursor);
|
||||
@ -152,7 +152,7 @@ public class BauGuiEditor implements Listener {
|
||||
if (items.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
SWListInv<BauGuiItem> inv = new SWListInv<>(p, "Item auswählen", items, (clickType, item) -> {
|
||||
SWListInv<BauGuiItem> inv = new SWListInv<>(p, BauSystem.MESSAGE.parse("GUI_EDITOR_TITLE_MORE", p), items, (clickType, item) -> {
|
||||
openGuiEditor(p, addId(item.getItem(p), item.getId()));
|
||||
});
|
||||
inv.open();
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren