13
0
Signed-off-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Chaoscaot 2021-07-27 12:14:57 +02:00
Ursprung 7c300f366f
Commit b59ff373b1

Datei anzeigen

@ -32,10 +32,12 @@ import org.bukkit.event.inventory.ClickType;
import java.util.*;
import static de.steamwar.schematicsystem.commands.SchematicCommandUtils.getUser;
public class GUI {
public static void open(Player player) {
list(player, SchematicNode.getSchematicsAccessibleByUser(SteamwarUser.get(player.getUniqueId()).getId(), null), false, "/");
list(player, SchematicNode.getSchematicsAccessibleByUser(getUser(player).getId(), null), false, "/");
}
private static void list(Player player, List<SchematicNode> schems, boolean publics, String path) {
@ -48,7 +50,8 @@ public class GUI {
else
m = SWItem.getMaterial(schem.getItem());
SWItem item = new SWItem(m, "§e" + schem.getName(), Collections.singletonList(schem.isDir()?"§9Ordner":"§7" + schem.getSchemtype().name()), schem.isDir()?false:!schem.getSchemtype().writeable(), click -> {});
SWItem item = new SWItem(m, "§e" + schem.getName(), Collections.singletonList(schem.isDir() ? "§9Ordner" : "§7" + schem.getSchemtype().name()), !schem.isDir() && !schem.getSchemtype().writeable(), click -> {
});
if(!schem.isDir()) {
if(schem.getRank() > 0)
item.setLore(Lists.newArrayList("§7" + schem.getSchemtype().name(), "§8Rang " + schem.getRank()));
@ -66,7 +69,7 @@ public class GUI {
}
private static void info(Player player, SchematicNode node) {
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
SteamwarUser user = getUser(player);
if(node.isDir()) {
list(player, SchematicNode.getSchematicNodeInNode(node), node.getOwner() == 0, node.generateBreadcrumbs(user));
} else {
@ -156,7 +159,7 @@ public class GUI {
}
private static void deleteOwn(Player p, SchematicNode schem){
SteamwarUser user = SteamwarUser.get(p.getUniqueId());
SteamwarUser user = getUser(p);
SWInventory inv = new SWInventory(p, 9, schem.generateBreadcrumbs(user) + " löschen");
inv.setItem(0, SWItem.getDye(1), (byte) 1, "§eLöschen", click -> {
schem.delete();
@ -174,7 +177,7 @@ public class GUI {
}
private static void deleteMembership(Player p, SchematicNode schem){
SteamwarUser user = SteamwarUser.get(p.getUniqueId());
SteamwarUser user = getUser(p);
SWInventory inv = new SWInventory(p, 9, schem.generateBreadcrumbs(user) + " entfernen");
inv.setItem(0, SWItem.getDye(1), (byte) 1, "§eZugriff entfernen", click -> {
NodeMember member = NodeMember.getNodeMember(schem.getId(), user.getId());
@ -232,7 +235,7 @@ public class GUI {
SWAnvilInv inv = new SWAnvilInv(player, "Schematics suchen");
inv.setItem(SWItem.getMaterial("CAULDRON_ITEM"));
inv.setCallback(s -> {
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
SteamwarUser user = getUser(player);
list(player, SchematicNode.filterSchems(publics?0:user.getId(), node -> node.getName().contains(s)), publics, "/");
});
inv.open();