Add Gui Multi Lang
Signed-off-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
fa1a3ccbdd
Commit
dcf07291d6
@ -165,18 +165,31 @@ HOTBAR_INVENTORY=Standard Hotbar
|
|||||||
GUI_EDITOR_ITEM-NAME=§eGui Editor
|
GUI_EDITOR_ITEM-NAME=§eGui Editor
|
||||||
GUI_EXPORT_CODE=§eDein Gui-Code:
|
GUI_EXPORT_CODE=§eDein Gui-Code:
|
||||||
GUI_EXPORT_CODE-HOVER=§eKopieren
|
GUI_EXPORT_CODE-HOVER=§eKopieren
|
||||||
GUI_IMPORT_INVALID-CODE = §eInvalieder Gui-Code
|
GUI_IMPORT_INVALID-CODE=§eInvalieder Gui-Code
|
||||||
GUI_IMPORT_CODE-SUCCESSFUL = §eGui-Code eingelesen
|
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
|
||||||
TRACE_RECORD = §aan
|
TRACE_RECORD=§aan
|
||||||
TRACE_RECORD-AUTO = §an
|
TRACE_RECORD-AUTO=§an
|
||||||
TRACE_IDLE = §caus
|
TRACE_IDLE=§caus
|
||||||
TRACE_IDLE-AUTO = §eauto
|
TRACE_IDLE-AUTO=§eauto
|
||||||
|
TRACE_MESSAGE-AUTO_RECORD=§cTNT-Tracer muss gestoppt werden
|
||||||
TRACE_MESSAGE-AUTO_RECORD = §cTNT-Tracer muss gestoppt werden
|
TRACE_MESSAGE-AUTO_RECORD-AUTO=§cTNT-Tracer darf nicht aufnehmen
|
||||||
TRACE_MESSAGE-AUTO_RECORD-AUTO = §cTNT-Tracer darf nicht aufnehmen
|
TRACE_MESSAGE-AUTO_IDLE=§cAuto-Tracer gestoppt
|
||||||
TRACE_MESSAGE-AUTO_IDLE = §cAuto-Tracer gestoppt
|
|
||||||
TRACE_MESSAGE-AUTO_IDLE-AUTO = §aAuto-Tracer gestartet
|
TRACE_MESSAGE-AUTO_IDLE-AUTO = §aAuto-Tracer gestartet
|
||||||
|
|
||||||
TRACE_GUI_NAME = Tracer Gui
|
TRACE_GUI_NAME = Tracer Gui
|
||||||
|
@ -44,14 +44,12 @@ public class BauGUI {
|
|||||||
private static final Set<Player> OPEN_INVS = new HashSet<>();
|
private static final Set<Player> OPEN_INVS = new HashSet<>();
|
||||||
private static boolean updating = false;
|
private static boolean updating = false;
|
||||||
|
|
||||||
@Getter
|
public static ItemStack getGUI_ITEM(Player p) {
|
||||||
private static final ItemStack GUI_ITEM;
|
ItemStack GUI_ITEM = new ItemStack(Material.NETHER_STAR);
|
||||||
|
|
||||||
static {
|
|
||||||
GUI_ITEM = new ItemStack(Material.NETHER_STAR);
|
|
||||||
ItemMeta meta = GUI_ITEM.getItemMeta();
|
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);
|
GUI_ITEM.setItemMeta(meta);
|
||||||
|
return GUI_ITEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addItem(BauGuiItem item) {
|
public static void addItem(BauGuiItem item) {
|
||||||
@ -66,7 +64,7 @@ public class BauGUI {
|
|||||||
OPEN_INVS.add(p);
|
OPEN_INVS.add(p);
|
||||||
}
|
}
|
||||||
BauGuiMapping mapping = BauGuiMapping.getGuiMapping(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 -> {
|
ITEMS.values().forEach(item -> {
|
||||||
if (!mapping.isShown(item.getId())) {
|
if (!mapping.isShown(item.getId())) {
|
||||||
return;
|
return;
|
||||||
@ -79,7 +77,7 @@ public class BauGUI {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
p.closeInventory();
|
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) {
|
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) {
|
private static ItemStack permissionLore(ItemStack itemStack, Permission permission, Player p) {
|
||||||
@ -106,9 +104,9 @@ public class BauGUI {
|
|||||||
if (!permission.hasPermission(p)) {
|
if (!permission.hasPermission(p)) {
|
||||||
List<String> lore = meta.getLore();
|
List<String> lore = meta.getLore();
|
||||||
if (lore == null) {
|
if (lore == null) {
|
||||||
lore = Collections.singletonList(ColorConfig.ERROR + permissionString(permission));
|
lore = Collections.singletonList(BauSystem.MESSAGE.parse(permissionString(permission), p));
|
||||||
} else {
|
} else {
|
||||||
lore.add(ColorConfig.ERROR + permissionString(permission));
|
lore.add(BauSystem.MESSAGE.parse(permissionString(permission), p));
|
||||||
}
|
}
|
||||||
meta.setLore(lore);
|
meta.setLore(lore);
|
||||||
}
|
}
|
||||||
@ -119,13 +117,13 @@ public class BauGUI {
|
|||||||
private static String permissionString(Permission permission) {
|
private static String permissionString(Permission permission) {
|
||||||
switch (permission) {
|
switch (permission) {
|
||||||
case OWNER:
|
case OWNER:
|
||||||
return "Das ist nicht deine Bauwelt";
|
return "GUI_NO_OWNER";
|
||||||
case WORLD:
|
case WORLD:
|
||||||
return "Du darfst hier die Welt nicht einstellen";
|
return "GUI_NO_WORLD";
|
||||||
case WORLDEDIT:
|
case WORLDEDIT:
|
||||||
return "Du darfst hier kein Worldedit benutzen";
|
return "GUI_NO_WORLDEDIT";
|
||||||
default:
|
default:
|
||||||
return "Du must ein Member der Bauwelt sein";
|
return "GUI_NO_MEMBER";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,11 +19,12 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.gui;
|
package de.steamwar.bausystem.features.gui;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.config.ColorConfig;
|
import de.steamwar.bausystem.config.ColorConfig;
|
||||||
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
|
||||||
import de.steamwar.bausystem.linkage.LinkageType;
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
import de.steamwar.bausystem.linkage.Linked;
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
|
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -41,7 +42,8 @@ public class BauGuiBauGuiItem extends BauGuiItem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getItem(Player player) {
|
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();
|
}).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.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());
|
BauGUI.openBauGui(event.getPlayer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ public class BauGuiEditor implements Listener {
|
|||||||
|
|
||||||
public static void openGuiEditor(Player p, ItemStack cursor) {
|
public static void openGuiEditor(Player p, ItemStack cursor) {
|
||||||
BauGuiMapping mapping = BauGuiMapping.getGuiMapping(p);
|
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()) {
|
for (Map.Entry<Integer, Integer> e : mapping.getMapping().entrySet()) {
|
||||||
if (e.getValue() >= 0) {
|
if (e.getValue() >= 0) {
|
||||||
if (e.getValue() < mapping.getSize()) {
|
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(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() + 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, 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, 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());
|
}).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.openInventory(inv);
|
||||||
p.getOpenInventory().setCursor(cursor == null ? new SWItem().getItemStack() : cursor);
|
p.getOpenInventory().setCursor(cursor == null ? new SWItem().getItemStack() : cursor);
|
||||||
@ -152,7 +152,7 @@ public class BauGuiEditor implements Listener {
|
|||||||
if (items.isEmpty()) {
|
if (items.isEmpty()) {
|
||||||
return;
|
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()));
|
openGuiEditor(p, addId(item.getItem(p), item.getId()));
|
||||||
});
|
});
|
||||||
inv.open();
|
inv.open();
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren