Merge pull request 'Rework SchemInfo' (#111) from schem_info into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #111 Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Commit
5ebe8c2ce3
@ -47,18 +47,19 @@ public class GUI {
|
|||||||
inv.setItem(49, Material.AIR, "", clickType -> {});
|
inv.setItem(49, Material.AIR, "", clickType -> {});
|
||||||
} else {
|
} else {
|
||||||
inv.setItem(49, Material.ANVIL, "§7Ordnereigenschaften", clickType -> {
|
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.setSingleDirOpen(false);
|
||||||
selector.open();
|
selector.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void info(Player player, SchematicNode node) {
|
private static void info(Player player, SchematicNode node, SchematicSelector back) {
|
||||||
SteamwarUser user = getUser(player);
|
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()) {
|
if(!node.isDir()) {
|
||||||
inv.setItem(0, SWItem.getMaterial("WOOD_AXE"), "§eLaden", click -> {
|
inv.setItem(0, SWItem.getMaterial("WOOD_AXE"), "§eLaden", click -> {
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
@ -66,6 +67,10 @@ public class GUI {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inv.setItem(9, SWItem.getMaterial("LEASH"), "§eZurück", clickType -> {
|
||||||
|
back.reOpen();
|
||||||
|
});
|
||||||
|
|
||||||
if(node.getOwner() == user.getId()){
|
if(node.getOwner() == user.getId()){
|
||||||
if(!node.isDir() && node.getSchemtype().writeable()){
|
if(!node.isDir() && node.getSchemtype().writeable()){
|
||||||
List<CheckedSchematic> checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId());
|
List<CheckedSchematic> checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId());
|
||||||
@ -80,16 +85,14 @@ public class GUI {
|
|||||||
}
|
}
|
||||||
Material mat = SWItem.getMaterial(node.getItem());
|
Material mat = SWItem.getMaterial(node.getItem());
|
||||||
|
|
||||||
inv.setItem(2, mat, "§e" + mat.name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), false, click -> {
|
inv.setItem(5, mat, "§e" + mat.name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), false, click -> {
|
||||||
player.closeInventory();
|
changeItem(player, node, back);
|
||||||
changeItem(player, node);
|
|
||||||
});
|
});
|
||||||
if(!node.isDir()) {
|
if(!node.isDir()) {
|
||||||
inv.setItem(3, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + node.getSchemtype().name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), false, click -> {
|
inv.setItem(6, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + node.getSchemtype().name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), node.getSchemtype().fightType(), click -> {
|
||||||
player.closeInventory();
|
changeType(player, node, back);
|
||||||
changeType(player, node);
|
|
||||||
});
|
});
|
||||||
inv.setItem(4, SWItem.getMaterial("MAGENTA_GLAZED_TERRACOTTA"), "§eDownload", click -> {
|
inv.setItem(7, SWItem.getMaterial("MAGENTA_GLAZED_TERRACOTTA"), "§eDownload", click -> {
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
SchematicCommandUtils.download(player, node);
|
SchematicCommandUtils.download(player, node);
|
||||||
});
|
});
|
||||||
@ -100,57 +103,56 @@ public class GUI {
|
|||||||
delmembers(player, node);
|
delmembers(player, node);
|
||||||
});
|
});
|
||||||
skull.setName("§eMitglieder");
|
skull.setName("§eMitglieder");
|
||||||
inv.setItem(5, skull);
|
inv.setItem(8, skull);
|
||||||
inv.setItem(6, Material.ARROW, "§eVerschieben", clickType -> {
|
inv.setItem(15, Material.ARROW, "§eVerschieben", clickType -> {
|
||||||
SchematicSelector selector = new SchematicSelector(player, SchematicSelector.selectDirectory(), npar -> {
|
SchematicSelector selector = new SchematicSelector(player, SchematicSelector.selectDirectory(), npar -> {
|
||||||
SafeSchematicNode.Result result = SafeSchematicNode.setParent(user, node, npar);
|
SafeSchematicNode.Result result = SafeSchematicNode.setParent(user, node, npar);
|
||||||
if(result.isSuccessful()) {
|
if(result.isSuccessful()) {
|
||||||
info(player, SchematicNode.getSchematicNode(node.getId()));
|
info(player, SchematicNode.getSchematicNode(node.getId()), back);
|
||||||
} else {
|
} else {
|
||||||
result.sendError(player);
|
result.sendError(player);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
selector.open();
|
selector.open();
|
||||||
});
|
});
|
||||||
Material finalMat = mat;
|
inv.setItem(16, Material.NAME_TAG, "§eUmbenennen", clickType -> {
|
||||||
inv.setItem(7, Material.NAME_TAG, "§eUmbenennen", clickType -> {
|
|
||||||
SWAnvilInv anvilInv = new SWAnvilInv(player, node.getName() + " umbenennen", node.getName());
|
SWAnvilInv anvilInv = new SWAnvilInv(player, node.getName() + " umbenennen", node.getName());
|
||||||
anvilInv.setItem(finalMat);
|
anvilInv.setItem(mat);
|
||||||
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()) {
|
||||||
info(player, node);
|
info(player, node, back);
|
||||||
} else {
|
} else {
|
||||||
result.sendError(player);
|
result.sendError(player);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
anvilInv.open();
|
anvilInv.open();
|
||||||
});
|
});
|
||||||
inv.setItem(8, SWItem.getDye(1), (byte) 1, "§cLöschen", click -> {
|
inv.setItem(17, SWItem.getDye(1), (byte) 1, "§cLöschen", click -> {
|
||||||
player.closeInventory();
|
delete(player, node, back);
|
||||||
delete(player, node);
|
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
if(!node.isDir()) {
|
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());
|
SteamwarUser owneruser = SteamwarUser.get(node.getOwner());
|
||||||
SWItem skull = SWItem.getPlayerSkull(owneruser.getUserName());
|
SWItem skull = SWItem.getPlayerSkull(owneruser.getUserName());
|
||||||
skull.setName("§7von §e" + 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 -> {
|
if(NodeMember.getNodeMember(node.getId(), user.getId()) != null) {
|
||||||
player.closeInventory();
|
inv.setItem(17, SWItem.getDye(1), (byte) 1, "§cZugriff entfernen", click -> {
|
||||||
delete(player, node);
|
delete(player, node, back);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inv.setCallback(-999, click -> player.closeInventory());
|
inv.setCallback(-999, click -> player.closeInventory());
|
||||||
inv.open();
|
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<>();
|
List<SWListInv.SWListEntry<SchematicType>> types = new LinkedList<>();
|
||||||
for(SchematicType type : SchematicType.values()){
|
for(SchematicType type : SchematicType.values()){
|
||||||
if(!type.isAssignable())
|
if(!type.isAssignable())
|
||||||
@ -164,28 +166,34 @@ public class GUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SWListInv<SchematicType> inv = new SWListInv<>(p, "Typ ändern", types, (clickType, schematicType) -> {
|
SWListInv<SchematicType> inv = new SWListInv<>(p, "Typ ändern", types, (clickType, schematicType) -> {
|
||||||
p.closeInventory();
|
|
||||||
SchematicCommandUtils.changeType(p, schem, schematicType, null);
|
SchematicCommandUtils.changeType(p, schem, schematicType, null);
|
||||||
|
info(p, schem, back);
|
||||||
});
|
});
|
||||||
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
|
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
|
||||||
inv.open();
|
inv.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void deleteOwn(Player p, SchematicNode schem){
|
private static void deleteOwn(Player p, SchematicNode schem, SchematicSelector back){
|
||||||
SteamwarUser user = getUser(p);
|
SteamwarUser user = getUser(p);
|
||||||
SWInventory inv = new SWInventory(p, 9, schem.generateBreadcrumbs(user) + " löschen");
|
SWInventory inv = new SWInventory(p, 9, schem.generateBreadcrumbs(user) + " löschen");
|
||||||
inv.setItem(0, SWItem.getDye(1), (byte) 1, "§eLöschen", click -> {
|
inv.setItem(0, SWItem.getDye(1), (byte) 1, "§eLöschen", click -> {
|
||||||
schem.delete();
|
schem.delete();
|
||||||
|
|
||||||
p.sendMessage(SchematicSystem.PREFIX + "Schematic §e" + schem.generateBreadcrumbs(user) + " §7gelöscht");
|
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.setItem(8, SWItem.getDye(14), (byte) 14, "§cAbbruch", click -> p.closeInventory());
|
||||||
inv.setCallback(-999, click -> p.closeInventory());
|
inv.setCallback(-999, click -> p.closeInventory());
|
||||||
inv.open();
|
inv.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void deleteMembership(Player p, SchematicNode schem){
|
private static void deleteMembership(Player p, SchematicNode schem, SchematicSelector back){
|
||||||
SteamwarUser user = getUser(p);
|
SteamwarUser user = getUser(p);
|
||||||
SWInventory inv = new SWInventory(p, 9, schem.generateBreadcrumbs(user) + " entfernen");
|
SWInventory inv = new SWInventory(p, 9, schem.generateBreadcrumbs(user) + " entfernen");
|
||||||
inv.setItem(0, SWItem.getDye(1), (byte) 1, "§eZugriff entfernen", click -> {
|
inv.setItem(0, SWItem.getDye(1), (byte) 1, "§eZugriff entfernen", click -> {
|
||||||
@ -193,18 +201,24 @@ public class GUI {
|
|||||||
if(member != null)
|
if(member != null)
|
||||||
member.delete();
|
member.delete();
|
||||||
p.sendMessage(SchematicSystem.PREFIX + "Zugriff zu Schematic §e" + schem.generateBreadcrumbs(user) + " §7entfernt");
|
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.setItem(8, SWItem.getDye(14), (byte) 14, "§cAbbruch", click -> p.closeInventory());
|
||||||
inv.setCallback(-999, click -> p.closeInventory());
|
inv.setCallback(-999, click -> p.closeInventory());
|
||||||
inv.open();
|
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())
|
if(SteamwarUser.get(p.getUniqueId()).getId() == schem.getOwner())
|
||||||
deleteOwn(p, schem);
|
deleteOwn(p, schem, back);
|
||||||
else
|
else
|
||||||
deleteMembership(p, schem);
|
deleteMembership(p, schem, back);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void delmembers(Player p, SchematicNode schem){
|
static void delmembers(Player p, SchematicNode schem){
|
||||||
@ -223,11 +237,11 @@ public class GUI {
|
|||||||
inv.open();
|
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 -> {
|
UtilGui.openMaterialSelector(p, "Item ändern", material -> {
|
||||||
schem.setItem(material.name());
|
schem.setItem(material.name());
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
info(p, schem);
|
info(p, schem, back);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,6 @@ import net.md_5.bungee.api.chat.TextComponent;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class SchematicCommandHelp {
|
public class SchematicCommandHelp {
|
||||||
|
|
||||||
private SchematicCommandHelp() {
|
private SchematicCommandHelp() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,5 +5,6 @@ depend: [SpigotCore, WorldEdit]
|
|||||||
main: de.steamwar.schematicsystem.SchematicSystem
|
main: de.steamwar.schematicsystem.SchematicSystem
|
||||||
website: steamwar.de
|
website: steamwar.de
|
||||||
api-version: "1.13"
|
api-version: "1.13"
|
||||||
|
description: Schematic-Frontend
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren