Rework SchemInfo #111
@ -47,18 +47,19 @@ public class GUI {
|
||||
inv.setItem(49, Material.AIR, "", clickType -> {});
|
||||
} else {
|
||||
inv.setItem(49, Material.ANVIL, "§7Ordnereigenschaften", clickType -> {
|
||||
info(selector.getPlayer(), parent);
|
||||
info(selector.getPlayer(), parent, selector);
|
||||
});
|
||||
}
|
||||
}
|
||||
}, node -> info(player, node));
|
||||
}, node -> {});
|
||||
selector.setCallback(node -> info(player, node, selector));
|
||||
selector.setSingleDirOpen(false);
|
||||
selector.open();
|
||||
}
|
||||
|
||||
private static void info(Player player, SchematicNode node) {
|
||||
private static void info(Player player, SchematicNode node, SchematicSelector back) {
|
||||
SteamwarUser user = getUser(player);
|
||||
SWInventory inv = new SWInventory(player, 9, node.generateBreadcrumbs(user));
|
||||
SWInventory inv = new SWInventory(player, 9 * 2, node.generateBreadcrumbs(user));
|
||||
if(!node.isDir()) {
|
||||
inv.setItem(0, SWItem.getMaterial("WOOD_AXE"), "§eLaden", click -> {
|
||||
player.closeInventory();
|
||||
@ -66,6 +67,14 @@ public class GUI {
|
||||
});
|
||||
}
|
||||
|
||||
inv.setItem(9, SWItem.getMaterial("LEASH"), "§eZurück", clickType -> {
|
||||
if(back != null) {
|
||||
back.reOpen();
|
||||
} else {
|
||||
list(player);
|
||||
}
|
||||
});
|
||||
|
||||
if(node.getOwner() == user.getId()){
|
||||
if(!node.isDir() && node.getSchemtype().writeable()){
|
||||
List<CheckedSchematic> checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId());
|
||||
@ -80,16 +89,14 @@ public class GUI {
|
||||
}
|
||||
Material mat = SWItem.getMaterial(node.getItem());
|
||||
|
||||
inv.setItem(2, mat, "§e" + mat.name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), false, click -> {
|
||||
player.closeInventory();
|
||||
changeItem(player, node);
|
||||
inv.setItem(5, mat, "§e" + mat.name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), false, click -> {
|
||||
changeItem(player, node, back);
|
||||
});
|
||||
if(!node.isDir()) {
|
||||
inv.setItem(3, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + node.getSchemtype().name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), false, click -> {
|
||||
player.closeInventory();
|
||||
changeType(player, node);
|
||||
inv.setItem(6, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + node.getSchemtype().name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), node.getSchemtype().fightType(), click -> {
|
||||
changeType(player, node, back);
|
||||
});
|
||||
inv.setItem(4, SWItem.getMaterial("MAGENTA_GLAZED_TERRACOTTA"), "§eDownload", click -> {
|
||||
inv.setItem(7, SWItem.getMaterial("MAGENTA_GLAZED_TERRACOTTA"), "§eDownload", click -> {
|
||||
player.closeInventory();
|
||||
SchematicCommandUtils.download(player, node);
|
||||
});
|
||||
@ -100,12 +107,12 @@ public class GUI {
|
||||
delmembers(player, node);
|
||||
});
|
||||
skull.setName("§eMitglieder");
|
||||
inv.setItem(5, skull);
|
||||
inv.setItem(6, Material.ARROW, "§eVerschieben", clickType -> {
|
||||
inv.setItem(8, skull);
|
||||
inv.setItem(15, Material.ARROW, "§eVerschieben", clickType -> {
|
||||
SchematicSelector selector = new SchematicSelector(player, SchematicSelector.selectDirectory(), npar -> {
|
||||
SafeSchematicNode.Result result = SafeSchematicNode.setParent(user, node, npar);
|
||||
if(result.isSuccessful()) {
|
||||
info(player, SchematicNode.getSchematicNode(node.getId()));
|
||||
info(player, SchematicNode.getSchematicNode(node.getId()), back);
|
||||
} else {
|
||||
result.sendError(player);
|
||||
}
|
||||
@ -113,44 +120,44 @@ public class GUI {
|
||||
selector.open();
|
||||
});
|
||||
Material finalMat = mat;
|
||||
inv.setItem(7, Material.NAME_TAG, "§eUmbenennen", clickType -> {
|
||||
inv.setItem(16, Material.NAME_TAG, "§eUmbenennen", clickType -> {
|
||||
SWAnvilInv anvilInv = new SWAnvilInv(player, node.getName() + " umbenennen", node.getName());
|
||||
anvilInv.setItem(finalMat);
|
||||
anvilInv.setCallback(s -> {
|
||||
SafeSchematicNode.Result result = SafeSchematicNode.setName(user, node, s);
|
||||
if(result.isSuccessful()) {
|
||||
info(player, node);
|
||||
info(player, node, back);
|
||||
} else {
|
||||
result.sendError(player);
|
||||
}
|
||||
});
|
||||
anvilInv.open();
|
||||
});
|
||||
inv.setItem(8, SWItem.getDye(1), (byte) 1, "§cLöschen", click -> {
|
||||
player.closeInventory();
|
||||
delete(player, node);
|
||||
inv.setItem(17, SWItem.getDye(1), (byte) 1, "§cLöschen", click -> {
|
||||
delete(player, node, back);
|
||||
});
|
||||
}else{
|
||||
if(!node.isDir()) {
|
||||
inv.setItem(4, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + node.getSchemtype().name(), click -> {});
|
||||
inv.setItem(4, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + node.getSchemtype().name(), Collections.emptyList(), node.getSchemtype().fightType(), click -> {});
|
||||
}
|
||||
|
||||
SteamwarUser owneruser = SteamwarUser.get(node.getOwner());
|
||||
SWItem skull = SWItem.getPlayerSkull(owneruser.getUserName());
|
||||
skull.setName("§7von §e" + owneruser.getUserName());
|
||||
inv.setItem(6, skull.getItemStack(), clickType -> {});
|
||||
inv.setItem(8, skull.getItemStack(), clickType -> {});
|
||||
|
||||
inv.setItem(8, SWItem.getDye(1), (byte) 1, "§cZugriff entfernen", click -> {
|
||||
player.closeInventory();
|
||||
delete(player, node);
|
||||
if(NodeMember.getNodeMember(node.getId(), user.getId()) != null) {
|
||||
inv.setItem(17, SWItem.getDye(1), (byte) 1, "§cZugriff entfernen", click -> {
|
||||
delete(player, node, back);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
inv.setCallback(-999, click -> player.closeInventory());
|
||||
inv.open();
|
||||
}
|
||||
|
||||
static void changeType(Player p, SchematicNode schem){
|
||||
static void changeType(Player p, SchematicNode schem, SchematicSelector back){
|
||||
List<SWListInv.SWListEntry<SchematicType>> types = new LinkedList<>();
|
||||
for(SchematicType type : SchematicType.values()){
|
||||
if(!type.isAssignable())
|
||||
@ -164,28 +171,34 @@ public class GUI {
|
||||
}
|
||||
|
||||
SWListInv<SchematicType> inv = new SWListInv<>(p, "Typ ändern", types, (clickType, schematicType) -> {
|
||||
p.closeInventory();
|
||||
SchematicCommandUtils.changeType(p, schem, schematicType, null);
|
||||
info(p, schem, back);
|
||||
});
|
||||
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
|
||||
inv.open();
|
||||
}
|
||||
|
||||
private static void deleteOwn(Player p, SchematicNode schem){
|
||||
private static void deleteOwn(Player p, SchematicNode schem, SchematicSelector back){
|
||||
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();
|
||||
|
||||
p.sendMessage(SchematicSystem.PREFIX + "Schematic §e" + schem.generateBreadcrumbs(user) + " §7gelöscht");
|
||||
p.closeInventory();
|
||||
if(back != null) {
|
||||
if(schem.isDir()) {
|
||||
back.reOpenDirUp();
|
||||
} else {
|
||||
back.reOpen();
|
||||
}
|
||||
}
|
||||
});
|
||||
inv.setItem(8, SWItem.getDye(14), (byte) 14, "§cAbbruch", click -> p.closeInventory());
|
||||
inv.setCallback(-999, click -> p.closeInventory());
|
||||
inv.open();
|
||||
}
|
||||
|
||||
private static void deleteMembership(Player p, SchematicNode schem){
|
||||
private static void deleteMembership(Player p, SchematicNode schem, SchematicSelector back){
|
||||
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 -> {
|
||||
@ -193,18 +206,24 @@ public class GUI {
|
||||
if(member != null)
|
||||
member.delete();
|
||||
p.sendMessage(SchematicSystem.PREFIX + "Zugriff zu Schematic §e" + schem.generateBreadcrumbs(user) + " §7entfernt");
|
||||
p.closeInventory();
|
||||
if(back != null) {
|
||||
if(schem.isDir()) {
|
||||
back.reOpenDirUp();
|
||||
} else {
|
||||
back.reOpen();
|
||||
}
|
||||
}
|
||||
});
|
||||
inv.setItem(8, SWItem.getDye(14), (byte) 14, "§cAbbruch", click -> p.closeInventory());
|
||||
inv.setCallback(-999, click -> p.closeInventory());
|
||||
inv.open();
|
||||
}
|
||||
|
||||
static void delete(Player p, SchematicNode schem){
|
||||
static void delete(Player p, SchematicNode schem, SchematicSelector back){
|
||||
if(SteamwarUser.get(p.getUniqueId()).getId() == schem.getOwner())
|
||||
deleteOwn(p, schem);
|
||||
deleteOwn(p, schem, back);
|
||||
else
|
||||
deleteMembership(p, schem);
|
||||
deleteMembership(p, schem, back);
|
||||
}
|
||||
|
||||
static void delmembers(Player p, SchematicNode schem){
|
||||
@ -223,11 +242,11 @@ public class GUI {
|
||||
inv.open();
|
||||
}
|
||||
|
||||
private static void changeItem(Player p, SchematicNode schem){
|
||||
private static void changeItem(Player p, SchematicNode schem, SchematicSelector back){
|
||||
UtilGui.openMaterialSelector(p, "Item ändern", material -> {
|
||||
schem.setItem(material.name());
|
||||
p.closeInventory();
|
||||
info(p, schem);
|
||||
info(p, schem, back);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren