13
0

Adapt to commonDB #131

Zusammengeführt
Lixfel hat 3 Commits von commonDB nach master 2022-11-22 11:36:53 +01:00 zusammengeführt
4 geänderte Dateien mit 35 neuen und 7 gelöschten Zeilen
Nur Änderungen aus Commit aeb0d36696 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -3,6 +3,7 @@ ON=§aon
OFF=§coff OFF=§coff
CHANGE=§7To change CHANGE=§7To change
CLICK=§7Click CLICK=§7Click
CLICK_DRAG_ITEM=§7Click or drag item here
CURRENT=§7Current: {0} CURRENT=§7Current: {0}
CONFIRM=§aConfirm CONFIRM=§aConfirm
CANCEL=§cCancel CANCEL=§cCancel
@ -18,7 +19,7 @@ UTIL_LIST_BACK_HOVER=§eBack {0}
UTIL_LIST_DIR=§7§lDIR UTIL_LIST_DIR=§7§lDIR
UTIL_LIST_TYPE=§8§l{0} UTIL_LIST_TYPE=§8§l{0}
UTIL_LIST_BASE=§e UTIL_LIST_BASE=§e
UTIL_LIST_FROM=§8Owner §7{0} UTIL_LIST_FROM=§8from §7{0}
UTIL_LIST_OPEN_DIR=§eShow directory UTIL_LIST_OPEN_DIR=§eShow directory
UTIL_LIST_OPEN_SCHEM=§eManage schematics UTIL_LIST_OPEN_SCHEM=§eManage schematics
UTIL_LIST_REMOVE=[Remove] UTIL_LIST_REMOVE=[Remove]

Datei anzeigen

@ -2,6 +2,7 @@ ON=§aAn
OFF=§cAus OFF=§cAus
CHANGE=§7Zum Ändern CHANGE=§7Zum Ändern
CLICK=§7anklicken CLICK=§7anklicken
CLICK_DRAG_ITEM=§7anklicken oder hier Item hineinlegen
CURRENT=§7Aktuell: {0} CURRENT=§7Aktuell: {0}
CONFIRM=§aBestätigen CONFIRM=§aBestätigen
CANCEL=§cAbbrechen CANCEL=§cAbbrechen

Datei anzeigen

@ -19,15 +19,18 @@
package de.steamwar.schematicsystem.commands; package de.steamwar.schematicsystem.commands;
import de.steamwar.core.Core;
import de.steamwar.inventory.*; import de.steamwar.inventory.*;
import de.steamwar.schematicsystem.SafeSchematicNode; import de.steamwar.schematicsystem.SafeSchematicNode;
import de.steamwar.schematicsystem.SchematicSystem; import de.steamwar.schematicsystem.SchematicSystem;
import de.steamwar.sql.*; import de.steamwar.sql.*;
import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import static de.steamwar.schematicsystem.commands.SchematicCommandUtils.*; import static de.steamwar.schematicsystem.commands.SchematicCommandUtils.*;
@ -51,12 +54,30 @@ public class GUI {
}); });
} }
} }
@Override
public AnvilInvCloseAction onAnvilInvCloseAction(SchematicSelector selector) {
return AnvilInvCloseAction.REOPEN;
}
}, node -> {}); }, node -> {});
selector.setCallback(node -> info(player, node, selector)); selector.setCallback(node -> info(player, node, selector));
selector.setSingleDirOpen(false); selector.setSingleDirOpen(false);
selector.open(); selector.open();
} }
private static void setCloseLeftCallback(SWAnvilInv inv, Runnable action) {
AtomicBoolean left = new AtomicBoolean(false);
inv.addCloseCallback(() -> {
if(!left.get()) {
Bukkit.getScheduler().runTaskLater(SchematicSystem.getInstance(), action, 1);
}
});
inv.addLeftCallback(() -> {
left.set(true);
action.run();
});
}
private static void info(Player player, SchematicNode node, SchematicSelector back) { private static void info(Player player, SchematicNode node, SchematicSelector back) {
SteamwarUser user = getUser(player); SteamwarUser user = getUser(player);
SWInventory inv = new SWInventory(player, 9 * 2, node.generateBreadcrumbs(user)); SWInventory inv = new SWInventory(player, 9 * 2, node.generateBreadcrumbs(user));
@ -78,8 +99,13 @@ public class GUI {
} }
Material mat = SWItem.getMaterial(node.getItem()); Material mat = SWItem.getMaterial(node.getItem());
inv.setItem(node.isDir()?7:5, mat, SchematicSystem.MESSAGE.parse("GUI_INFO_MAT", player, mat.name()), Arrays.asList(SchematicSystem.MESSAGE.parse("CHANGE", player), SchematicSystem.MESSAGE.parse("CLICK", player)), false, click -> { inv.setItemEvent(node.isDir()?7:5, mat, SchematicSystem.MESSAGE.parse("GUI_INFO_MAT", player, mat.name()), Arrays.asList(SchematicSystem.MESSAGE.parse("CHANGE", player), SchematicSystem.MESSAGE.parse("CLICK_DRAG_ITEM", player)), false, event -> {
changeItem(player, node, back); if(event.getCursor() != null && event.getCursor().getType() != Material.AIR) {
node.setItem(event.getCursor().getType().name());
info(player, node, back);
} else {
changeItem(player, node, back);
}
}); });
if(!node.isDir()) { if(!node.isDir()) {
inv.setItem(6, SWItem.getMaterial(node.getSchemtype().getMaterial()), SchematicSystem.MESSAGE.parse("GUI_INFO_TYPE", player, node.getSchemtype().name()), Arrays.asList(SchematicSystem.MESSAGE.parse("CHANGE", player), SchematicSystem.MESSAGE.parse("CLICK", player)), node.getSchemtype().fightType(), click -> { inv.setItem(6, SWItem.getMaterial(node.getSchemtype().getMaterial()), SchematicSystem.MESSAGE.parse("GUI_INFO_TYPE", player, node.getSchemtype().name()), Arrays.asList(SchematicSystem.MESSAGE.parse("CHANGE", player), SchematicSystem.MESSAGE.parse("CLICK", player)), node.getSchemtype().fightType(), click -> {
@ -129,7 +155,7 @@ public class GUI {
}); });
inv.setItem(16, Material.NAME_TAG, SchematicSystem.MESSAGE.parse("GUI_INFO_RENAME", player), clickType -> { inv.setItem(16, Material.NAME_TAG, SchematicSystem.MESSAGE.parse("GUI_INFO_RENAME", player), clickType -> {
SWAnvilInv anvilInv = new SWAnvilInv(player, SchematicSystem.MESSAGE.parse("GUI_INFO_RENAME_TITLE", player, node.getName()), node.getName()); SWAnvilInv anvilInv = new SWAnvilInv(player, SchematicSystem.MESSAGE.parse("GUI_INFO_RENAME_TITLE", player, node.getName()), node.getName());
anvilInv.setItem(mat); anvilInv.setItem(mat, Collections.singletonList(Core.MESSAGE.parse("SCHEM_SELECTOR_CLICK_BACK", player)), false);
anvilInv.setCallback(s -> { anvilInv.setCallback(s -> {
SafeSchematicNode.Result result = SafeSchematicNode.setName(user, node, s); SafeSchematicNode.Result result = SafeSchematicNode.setName(user, node, s);
if(result.isSuccessful()) { if(result.isSuccessful()) {
@ -138,6 +164,7 @@ public class GUI {
result.sendError(player); result.sendError(player);
} }
}); });
setCloseLeftCallback(anvilInv, () -> info(player, node, back));
anvilInv.open(); anvilInv.open();
}); });
inv.setItem(17, SWItem.getDye(1), (byte) 1, SchematicSystem.MESSAGE.parse("GUI_INFO_DELETE", player), click -> { inv.setItem(17, SWItem.getDye(1), (byte) 1, SchematicSystem.MESSAGE.parse("GUI_INFO_DELETE", player), click -> {
@ -189,9 +216,8 @@ public class GUI {
SteamwarUser user = getUser(p); SteamwarUser user = getUser(p);
SWInventory inv = new SWInventory(p, 9, SchematicSystem.MESSAGE.parse("GUI_DELETE_OWN_TITLE", p, schem.generateBreadcrumbs(user))); SWInventory inv = new SWInventory(p, 9, SchematicSystem.MESSAGE.parse("GUI_DELETE_OWN_TITLE", p, schem.generateBreadcrumbs(user)));
inv.setItem(0, SWItem.getDye(1), (byte) 1, SchematicSystem.MESSAGE.parse("CONFIRM", p), click -> { inv.setItem(0, SWItem.getDye(1), (byte) 1, SchematicSystem.MESSAGE.parse("CONFIRM", p), click -> {
schem.delete(); p.performCommand("schematic delete " + schem.generateBreadcrumbs(user));
SchematicSystem.MESSAGE.send("GUI_DELETE_OWN_DELETED", p, schem.generateBreadcrumbs(user));
if(back != null) { if(back != null) {
if(schem.isDir()) { if(schem.isDir()) {
back.reOpenDirUp(); back.reOpenDirUp();

Datei anzeigen

@ -125,7 +125,7 @@ public class SchematicCommandUtils {
} else { } else {
SchematicType type = node.getSchemtype(); SchematicType type = node.getSchemtype();
if (type != SchematicType.Normal) { if (type != SchematicType.Normal) {
nodeString.append(SchematicSystem.MESSAGE.parse("UTIL_LIST_TYPE", player, type.name())).append(" "); nodeString.append(SchematicSystem.MESSAGE.parse("UTIL_LIST_TYPE", player, type.getKuerzel())).append(" ");
} }
} }
nodeString.append(SchematicSystem.MESSAGE.parse("UTIL_LIST_BASE", player)); nodeString.append(SchematicSystem.MESSAGE.parse("UTIL_LIST_BASE", player));