Soem New Things
Signed-off-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
1ff74f7ab8
Commit
4f8e527201
@ -33,6 +33,7 @@ import org.bukkit.event.inventory.ClickType;
|
||||
import java.util.*;
|
||||
|
||||
import static de.steamwar.schematicsystem.commands.SchematicCommandUtils.getUser;
|
||||
import static de.steamwar.schematicsystem.commands.SchematicCommandUtils.invalidSchemName;
|
||||
|
||||
public class GUI {
|
||||
|
||||
@ -46,7 +47,7 @@ public class GUI {
|
||||
for(SchematicNode schem : schems) {
|
||||
Material m;
|
||||
if (schem.getItem().isEmpty())
|
||||
m = SWItem.getMaterial("CAULDRON_ITEM");
|
||||
m = schem.isDir()?SWItem.getMaterial("CHEST"):SWItem.getMaterial("CAULDRON_ITEM");
|
||||
else
|
||||
m = SWItem.getMaterial(schem.getItem());
|
||||
|
||||
@ -59,28 +60,38 @@ public class GUI {
|
||||
schemList.add(new SWListInv.SWListEntry<>(item, schem));
|
||||
}
|
||||
|
||||
SWListInv<SchematicNode> inv = new SWListInv<>(player, "§eSchematicliste §8- §r" + path, false, schemList, (clickType, schem) -> info(player, schem));
|
||||
if(publics)
|
||||
SWListInv<SchematicNode> inv = new SWListInv<>(player, "§eSchematicliste §8- §r" + path, false, schemList, (clickType, schem) -> {
|
||||
if(schem.isDir()) {
|
||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||
list(player, SchematicNode.getSchematicNodeInNode(schem), schem.getOwner() == 0, schem.generateBreadcrumbs(user));
|
||||
} else {
|
||||
info(player, schem);
|
||||
}
|
||||
});
|
||||
if(publics) {
|
||||
inv.setItem(48, Material.BUCKET, "§7Eigene Schematics", clickType -> open(player));
|
||||
else
|
||||
} else {
|
||||
inv.setItem(48, Material.GLASS, "§7Public Schematics", clickType -> list(player, SchematicNode.getSchematicsAccessibleByUser(0, null), true, "/"));
|
||||
}
|
||||
if(!publics && !path.equals("/")) {
|
||||
inv.setItem(49, Material.ANVIL, "§7Ordner-Info", clickType -> info(player, SchematicSystem.SCHEMATIC_COMMAND.nodeTypeMapper().map(player, new String[0], path)));
|
||||
}
|
||||
inv.setItem(50, Material.NAME_TAG, "§7Suche", clickType -> search(player, publics));
|
||||
inv.open();
|
||||
}
|
||||
|
||||
private static void info(Player player, SchematicNode node) {
|
||||
SteamwarUser user = getUser(player);
|
||||
if(node.isDir()) {
|
||||
list(player, SchematicNode.getSchematicNodeInNode(node), node.getOwner() == 0, node.generateBreadcrumbs(user));
|
||||
} else {
|
||||
SWInventory inv = new SWInventory(player, 9, node.generateBreadcrumbs(user));
|
||||
if(!node.isDir()) {
|
||||
inv.setItem(0, SWItem.getMaterial("WOOD_AXE"), "§eLaden", click -> {
|
||||
player.closeInventory();
|
||||
SchematicSystem.SCHEMATIC_COMMAND.loadSchem(player, node);
|
||||
});
|
||||
}
|
||||
|
||||
if(node.getOwner() == user.getId()){
|
||||
if(node.getSchemtype().writeable()){
|
||||
if(!node.isDir() && node.getSchemtype().writeable()){
|
||||
List<CheckedSchematic> checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId());
|
||||
ListIterator<CheckedSchematic> i = checkedSchematics.listIterator(checkedSchematics.size());
|
||||
while(i.hasPrevious()) {
|
||||
@ -91,7 +102,7 @@ public class GUI {
|
||||
}
|
||||
}
|
||||
}
|
||||
Material mat = SWItem.getMaterial("CAULDRON_ITEM");
|
||||
Material mat = node.isDir()?SWItem.getMaterial("CHEST"):SWItem.getMaterial("CAULDRON_ITEM");
|
||||
if(node.getItem() != null && !node.getItem().equals(""))
|
||||
mat = SWItem.getMaterial(node.getItem());
|
||||
|
||||
@ -99,6 +110,7 @@ public class GUI {
|
||||
player.closeInventory();
|
||||
changeItem(player, node);
|
||||
});
|
||||
if(!node.isDir()) {
|
||||
inv.setItem(4, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + node.getSchemtype().name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), false, click -> {
|
||||
player.closeInventory();
|
||||
changeType(player, node);
|
||||
@ -107,6 +119,7 @@ public class GUI {
|
||||
player.closeInventory();
|
||||
SchematicSystem.SCHEMATIC_COMMAND.download(player, node);
|
||||
});
|
||||
}
|
||||
SWItem skull = SWItem.getPlayerSkull("MHF_STEVE");
|
||||
skull.setCallback(click -> {
|
||||
player.closeInventory();
|
||||
@ -114,12 +127,26 @@ public class GUI {
|
||||
});
|
||||
skull.setName("§eMitglieder");
|
||||
inv.setItem(6, skull);
|
||||
Material finalMat = mat;
|
||||
inv.setItem(7, Material.NAME_TAG, "§eUmbenennen", clickType -> {
|
||||
SWAnvilInv anvilInv = new SWAnvilInv(player, node.getName() + " umbenennen");
|
||||
anvilInv.setItem(finalMat);
|
||||
anvilInv.setCallback(s -> {
|
||||
if (!invalidSchemName(player, new String[]{s})) {
|
||||
node.setName(s);
|
||||
}
|
||||
info(player, node);
|
||||
});
|
||||
anvilInv.open();
|
||||
});
|
||||
inv.setItem(8, SWItem.getDye(1), (byte) 1, "§cLöschen", click -> {
|
||||
player.closeInventory();
|
||||
delete(player, node);
|
||||
});
|
||||
}else{
|
||||
if(!node.isDir()) {
|
||||
inv.setItem(4, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + node.getSchemtype().name(), click -> {});
|
||||
}
|
||||
|
||||
SteamwarUser owneruser = SteamwarUser.get(node.getOwner());
|
||||
SWItem skull = SWItem.getPlayerSkull(owneruser.getUserName());
|
||||
@ -135,7 +162,6 @@ public class GUI {
|
||||
inv.setCallback(-999, click -> player.closeInventory());
|
||||
inv.open();
|
||||
}
|
||||
}
|
||||
|
||||
static void changeType(Player p, SchematicNode schem){
|
||||
List<SWListInv.SWListEntry<SchematicType>> types = new LinkedList<>();
|
||||
@ -164,10 +190,6 @@ public class GUI {
|
||||
inv.setItem(0, SWItem.getDye(1), (byte) 1, "§eLöschen", click -> {
|
||||
schem.delete();
|
||||
|
||||
List<CheckedSchematic> checkedSchematics = CheckedSchematic.getLastDeclined(schem);
|
||||
for(CheckedSchematic checkedSchematic : checkedSchematics) {
|
||||
checkedSchematic.remove();
|
||||
}
|
||||
p.sendMessage(SchematicSystem.PREFIX + "Schematic §e" + schem.generateBreadcrumbs(user) + " §7gelöscht");
|
||||
p.closeInventory();
|
||||
});
|
||||
|
@ -174,7 +174,7 @@ public class SchematicCommand extends SWCommand {
|
||||
if (invalidSchemName(player, layers)) return;
|
||||
SchematicNode currentNode = mkdirs(layers, user, 1);
|
||||
|
||||
SchematicNode node = SchematicNode.getSchematicInParent(layers[layers.length - 1], currentNode == null ? 0 : currentNode.getId());
|
||||
SchematicNode node = SchematicNode.getSchematicNode(layers[layers.length - 1], currentNode == null ? 0 : currentNode.getId());
|
||||
if (node != null && !node.getSchemtype().writeable()) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDu darfst diese Schematic nicht überschreiben");
|
||||
return;
|
||||
@ -285,7 +285,7 @@ public class SchematicCommand extends SWCommand {
|
||||
}
|
||||
|
||||
player.sendMessage(SchematicSystem.PREFIX + "Dein Download Link:");
|
||||
player.sendMessage(DownloadSchematic.getLink(node));
|
||||
player.sendMessage(NodeDownload.getLink(node));
|
||||
}
|
||||
|
||||
@Register("dir")
|
||||
@ -397,6 +397,12 @@ public class SchematicCommand extends SWCommand {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDas kannst du nur bei deinen eigenen Schems machen");
|
||||
return;
|
||||
}
|
||||
|
||||
if(SchematicNode.getAllParentsOfNode(node).contains(node)) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDas kann nur Fehler machen, vertrau mir!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (name.equals("/")) {
|
||||
node.setParent(0);
|
||||
} else {
|
||||
|
@ -90,7 +90,7 @@ public class SchematicCommandUtils {
|
||||
SchematicNode pa = mapNode(user, strings, preTab);
|
||||
if (pa == null) return Collections.emptyList();
|
||||
List<SchematicNode> nodes = SchematicNode.getSchematicNodeInNode(pa);
|
||||
nodes.forEach(node -> list.add(node.generateBreadcrumbs(user)));
|
||||
nodes.forEach(node -> list.add((sws ? "/" : "") + node.generateBreadcrumbs(user)));
|
||||
} else {
|
||||
List<SchematicNode> nodes = SchematicNode.getSchematicsAccessibleByUser(user.getId(), 0);
|
||||
nodes.forEach(node -> list.add((sws ? "/" : "") + node.getName() + (node.isDir() ? "/" : "")));
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren