Schemnodes Schematic System #93
@ -39,7 +39,6 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -51,23 +50,24 @@ public class SchematicCommand extends SWCommand {
|
|||||||
super("schematic", "/schematic", "schem", "/schem");
|
super("schematic", "/schematic", "schem", "/schem");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register(help = true)
|
private static List<String> getNodeTabcomplete(SteamwarUser user, String[] strings, String s) {
|
||||||
public void genericHelp(Player player, String... args) {
|
List<String> list = new ArrayList<>();
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "Befehle§8:");
|
boolean sws = s.startsWith("/");
|
||||||
player.sendMessage("§8/§eschem gui §8- §7Öffnet die Schematic-GUI");
|
if (sws) {
|
||||||
player.sendMessage("§8/§eschem list §8- §7Zeigt dir deine Schematics an");
|
s = s.substring(1);
|
||||||
player.sendMessage("§8/§eschem list public §8- §7Zeigt alle Public-Schematics");
|
}
|
||||||
player.sendMessage("§8/§eschem search §8[§7Stichwort§8] - §7Sucht nach passenden Schematics");
|
if (s.contains("/")) {
|
||||||
player.sendMessage("§8/§eschem load §8[§7Schematic§8] - §7Lädt eine Schematic");
|
String preTab = s.substring(0, s.lastIndexOf("/") + 1);
|
||||||
player.sendMessage("§8/§eschem save §8[§7Schematic§8] - §7Speichert dein Clipboard als Schematic");
|
SchematicNode pa = mapNode(user, strings, preTab);
|
||||||
player.sendMessage("§8/§eschem changetype §8[§7Schematic§8] - §7Ändert die Art deiner Schematic");
|
if (pa == null) return Collections.emptyList();
|
||||||
player.sendMessage("§8/§eschem delete §8[§7Schematic§8] - §7Löscht eine Schematic");
|
List<SchematicNode> nodes = SchematicNode.getSchematicNodeInNode(pa);
|
||||||
player.sendMessage("§8/§eschem info §8[§7Schematic§8] - §7Zeigt dir Informationen zur Schematic");
|
nodes.forEach(node -> list.add(node.generateBreadcrumbs(user)));
|
||||||
player.sendMessage("§8/§eschem download §8[§7Schematic§8] - §7Gibt dir einen Downloadlink (1 min gültig)");
|
} else {
|
||||||
player.sendMessage("§8/§eschem addmember §8[§7Schematic§8] §8[§7Spieler§8] - §7Fügt einen Spieler zu einer Schematic hinzu");
|
List<SchematicNode> nodes = SchematicNode.getSchematicsAccessibleByUser(user.getId(), 0);
|
||||||
player.sendMessage("§8/§eschem delmember §8[§7Schematic§8] §8[§7Spieler§8] - §7Entfernt einen Spieler von einer Schematic");
|
nodes.forEach(node -> list.add((sws ? "/" : "") + node.getName() + (node.isDir() ? "/" : "")));
|
||||||
player.sendMessage("§8/§eschem mkdirs §8[§7Ordner§8] - §7Erstelle einen Leeren Ordner");
|
}
|
||||||
player.sendMessage("§8/§eschem move §8[§7Schematic§8] [§7Neuer Pfad§8] - §7Verschiebe eine Schematic");
|
list.remove("//copy");
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register("gui")
|
@Register("gui")
|
||||||
@ -87,24 +87,66 @@ public class SchematicCommand extends SWCommand {
|
|||||||
renderSchemlist(player, SchematicNode.getSchematicsAccessibleByUser(SteamwarUser.get(player.getUniqueId()).getId(), 0), page, "", false);
|
renderSchemlist(player, SchematicNode.getSchematicsAccessibleByUser(SteamwarUser.get(player.getUniqueId()).getId(), 0), page, "", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register("list")
|
private static SchematicNode mapNode(SteamwarUser user, String[] previousArguments, String s) {
|
||||||
public void schemList(Player player, @Mapper("dirMapper") SchematicNode node) {
|
if (s.startsWith("/")) {
|
||||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
s = s.substring(1);
|
||||||
if(!node.isDir()) {
|
}
|
||||||
player.sendMessage("haethate");
|
if (s.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (s.contains("/")) {
|
||||||
|
String[] layers = s.split("/");
|
||||||
|
SchematicNode currentNode = null;
|
||||||
|
for (int i = 0; i < layers.length; i++) {
|
||||||
|
int finalI = i;
|
||||||
|
List<SchematicNode> nodes;
|
||||||
|
if (currentNode == null) {
|
||||||
|
nodes = SchematicNode.getSchematicsAccessibleByUser(user.getId(), 0).stream().filter(node -> node.getName().equals(layers[finalI])).collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
nodes = SchematicNode.getSchematicNodeInNode(currentNode).stream().filter(node -> node.getName().equals(layers[finalI])).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
if (nodes.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
currentNode = nodes.get(0);
|
||||||
|
if (!currentNode.isDir() && i != layers.length - 1) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return currentNode;
|
||||||
} else {
|
} else {
|
||||||
renderSchemlist(player, SchematicNode.getSchematicNodeInNode(node), 0, node.generateBreadcrumbs(user), node.getOwner()==0);
|
String finalS = s;
|
||||||
|
List<SchematicNode> nodes = SchematicNode.getSchematicsAccessibleByUser(user.getId(), 0).stream().filter(node -> node.getName().equals(finalS)).collect(Collectors.toList());
|
||||||
|
if (nodes.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return nodes.get(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register("list")
|
@Register(help = true)
|
||||||
public void schemList(Player player, @Mapper("dirMapper") SchematicNode node, int page) {
|
public void genericHelp(Player player, String... args) {
|
||||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
player.sendMessage(SchematicSystem.PREFIX + "Befehle§8:");
|
||||||
if(!node.isDir()) {
|
player.sendMessage("§8/§eschem gui §8- §7Öffnet die Schematic-GUI");
|
||||||
player.sendMessage("haethate");
|
player.sendMessage("§8/§eschem list §8- §7Zeigt dir deine Schematics an");
|
||||||
} else {
|
player.sendMessage("§8/§eschem list public §8- §7Zeigt alle Public-Schematics");
|
||||||
renderSchemlist(player, SchematicNode.getSchematicNodeInNode(node), page, node.generateBreadcrumbs(user), node.getOwner()==0);
|
player.sendMessage("§8/§eschem search §8[§7Stichwort§8] - §7Sucht nach passenden Schematics");
|
||||||
}
|
player.sendMessage("§8/§eschem load §8[§7Schematic§8] - §7Lädt eine Schematic");
|
||||||
|
player.sendMessage("§8/§eschem save §8[§7Schematic§8] - §7Speichert dein Clipboard als Schematic");
|
||||||
|
player.sendMessage("§8/§eschem changetype §8[§7Schematic§8] - §7Ändert die Art deiner Schematic");
|
||||||
|
player.sendMessage("§8/§eschem delete §8[§7Schematic§8] - §7Löscht eine Schematic");
|
||||||
|
player.sendMessage("§8/§eschem info §8[§7Schematic§8] - §7Zeigt dir Informationen zur Schematic");
|
||||||
|
player.sendMessage("§8/§eschem download §8[§7Schematic§8] - §7Gibt dir einen Downloadlink (1 min gültig)");
|
||||||
|
player.sendMessage("§8/§eschem addmember §8[§7Schematic§8] §8[§7Spieler§8] - §7Fügt einen Spieler zu einer Schematic hinzu");
|
||||||
|
player.sendMessage("§8/§eschem delmember §8[§7Schematic§8] §8[§7Spieler§8] - §7Entfernt einen Spieler von einer Schematic");
|
||||||
|
player.sendMessage("§8/§eschem clearmember §8[§7Schematic§8] - §7Entfernt alle Spieler von der Schematic");
|
||||||
|
player.sendMessage("§8/§eschem mkdir §8[§7Ordner§8] - §7Erstelle einen Leeren Ordner");
|
||||||
|
player.sendMessage("§8/§eschem move §8[§7Schematic§8] [§7Neuer Pfad§8] - §7Verschiebe eine Schematic");
|
||||||
|
player.sendMessage("§8/§eschem rename §8[§7Schematic§8] [§7Neuer Name§8] - §7Gib der Schematic einen neuen Namen");
|
||||||
|
player.sendMessage("§8/§eschem addteam §8[§7Schematic§8] - §7Füge jeden aus deinem Team auf die Schematic hinzu");
|
||||||
|
player.sendMessage("§8/§eschem remteam §8[§7Schematic§8] - §7Entferne jeden aus deinem Team von der Schematic");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register({"list", "public"})
|
@Register({"list", "public"})
|
||||||
@ -135,20 +177,54 @@ public class SchematicCommand extends SWCommand {
|
|||||||
schemInfo(player, node);
|
schemInfo(player, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Register("list")
|
||||||
|
public void schemList(Player player, @Mapper("dirMapper") SchematicNode node) {
|
||||||
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
|
if (!node.isDir()) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "Das ist eine Schematic und kein Ordner");
|
||||||
|
} else {
|
||||||
|
renderSchemlist(player, SchematicNode.getSchematicNodeInNode(node), 0, node.generateBreadcrumbs(user), node.getOwner() == 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Register({"info", "/"})
|
||||||
|
public void schemInfoSecret(Player player) {
|
||||||
|
player.sendMessage("§7--==( §eSteam§8War §eSchematic-System §7)==--");
|
||||||
|
player.sendMessage("§7Anzahl an Schematics: §e" + SchematicNode.countNodes());
|
||||||
|
player.sendMessage("§7Von dir einsehbar: §e" + SchematicNode.getAllSchematicsAccessibleByUser(SteamwarUser.get(player.getUniqueId()).getId()).size());
|
||||||
|
player.sendMessage("§7Autoren: §e" + Arrays.toString(SchematicSystem.INSTANCE.getDescription().getAuthors().toArray()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Register("list")
|
||||||
|
public void schemList(Player player, @Mapper("dirMapper") SchematicNode node, int page) {
|
||||||
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
|
if (!node.isDir()) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "Das ist eine Schematic und kein Ordner");
|
||||||
|
} else {
|
||||||
|
renderSchemlist(player, SchematicNode.getSchematicNodeInNode(node), page, node.generateBreadcrumbs(user), node.getOwner() == 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Register({"l", "public"})
|
||||||
|
@Register({"load", "public"})
|
||||||
|
public void loadSchemPublic(Player player, @Mapper("publicMapper") SchematicNode node) {
|
||||||
|
loadSchem(player, node);
|
||||||
|
}
|
||||||
|
|
||||||
@Register("info")
|
@Register("info")
|
||||||
public void schemInfo(Player player, SchematicNode node) {
|
public void schemInfo(Player player, SchematicNode node) {
|
||||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
player.sendMessage("§7--==( §e" + node.getName() + " §7)==--");
|
player.sendMessage("§7--==( §e" + node.getName() + " §7)==--");
|
||||||
player.sendMessage("§7Name: §e" + node.generateBreadcrumbs(user));
|
player.sendMessage("§7Name: §e" + node.generateBreadcrumbs(user));
|
||||||
player.sendMessage("§7Besitzer: §e" + SteamwarUser.get(node.getOwner()).getUserName());
|
player.sendMessage("§7Besitzer: §e" + SteamwarUser.get(node.getOwner()).getUserName());
|
||||||
player.sendMessage("§7Ordner: §e" + (node.getParent() == null || node.getParent() == 0?"/":node.getParentNode().generateBreadcrumbs(user)));
|
player.sendMessage("§7Ordner: §e" + (node.getParent() == null || node.getParent() == 0 ? "/" : node.getParentNode().generateBreadcrumbs(user)));
|
||||||
player.sendMessage("§7Letzes Update: §e" + node.getLastUpdate().toLocalDateTime().format(DateTimeFormatter.ofPattern("HH:mm dd.MM.yyyy", Locale.GERMAN)));
|
player.sendMessage("§7Letzes Update: §e" + node.getLastUpdate().toLocalDateTime().format(DateTimeFormatter.ofPattern("HH:mm dd.MM.yyyy", Locale.GERMAN)));
|
||||||
player.sendMessage("§7Typ: §e" + (node.isDir()?"§9DIR":node.getSchemtype().name()));
|
player.sendMessage("§7Typ: §e" + (node.isDir() ? "§9DIR" : node.getSchemtype().name()));
|
||||||
if(!node.isDir()) {
|
if (!node.isDir()) {
|
||||||
if(node.getRank() > 0) {
|
if (node.getRank() > 0) {
|
||||||
player.sendMessage("§7Rang: §e" + node.getRank());
|
player.sendMessage("§7Rang: §e" + node.getRank());
|
||||||
}
|
}
|
||||||
player.sendMessage("§7Format: §e" + (node.getSchemFormat()?".schem":".schematic"));
|
player.sendMessage("§7Format: §e" + (node.getSchemFormat() ? ".schem" : ".schematic"));
|
||||||
List<CheckedSchematic> checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId());
|
List<CheckedSchematic> checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId());
|
||||||
for (CheckedSchematic checkedSchematic : checkedSchematics) {
|
for (CheckedSchematic checkedSchematic : checkedSchematics) {
|
||||||
if (checkedSchematic.getSchemName().equals(node.getName()) &&
|
if (checkedSchematic.getSchemName().equals(node.getName()) &&
|
||||||
@ -160,29 +236,35 @@ public class SchematicCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
List<String> schematicMembers = new ArrayList<>();
|
List<String> schematicMembers = new ArrayList<>();
|
||||||
NodeMember.getNodeMembers(node.getId()).forEach(nodeMember -> schematicMembers.add(SteamwarUser.get(nodeMember.getMember()).getUserName()));
|
NodeMember.getNodeMembers(node.getId()).forEach(nodeMember -> schematicMembers.add(SteamwarUser.get(nodeMember.getMember()).getUserName()));
|
||||||
if(!schematicMembers.isEmpty()) {
|
if (!schematicMembers.isEmpty()) {
|
||||||
player.sendMessage("§7Mitglieder: §e" + schematicMembers.toString());
|
player.sendMessage("§7Mitglieder: §e" + schematicMembers);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextComponent base = new TextComponent();
|
TextComponent base = new TextComponent();
|
||||||
|
|
||||||
if(!node.isDir()) {
|
if (!node.isDir()) {
|
||||||
TextComponent load = new TextComponent("[Laden] ");
|
TextComponent load = new TextComponent("[Laden] ");
|
||||||
load.setColor(ChatColor.GREEN);
|
load.setColor(ChatColor.GREEN);
|
||||||
load.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§eSchematic laden")));
|
load.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§eSchematic laden")));
|
||||||
load.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem load " + (node.getOwner()==0?"public ":"") + node.generateBreadcrumbs(user)));
|
load.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem load " + (node.getOwner() == 0 ? "public " : "") + node.generateBreadcrumbs(user)));
|
||||||
base.addExtra(load);
|
base.addExtra(load);
|
||||||
|
|
||||||
if(node.getOwner() == user.getId()) {
|
if (node.getOwner() == user.getId()) {
|
||||||
TextComponent download = new TextComponent("[Download] ");
|
TextComponent download = new TextComponent("[Download] ");
|
||||||
download.setColor(ChatColor.GOLD);
|
download.setColor(ChatColor.GOLD);
|
||||||
download.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§eSchematic downloaden")));
|
download.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§eSchematic downloaden")));
|
||||||
download.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem download " + node.generateBreadcrumbs(user)));
|
download.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem download " + node.generateBreadcrumbs(user)));
|
||||||
base.addExtra(download);
|
base.addExtra(download);
|
||||||
|
|
||||||
|
TextComponent changeTyp = new TextComponent("[Typ ändern] ");
|
||||||
|
changeTyp.setColor(ChatColor.BLUE);
|
||||||
|
changeTyp.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§eSchematic Typ ändern")));
|
||||||
|
changeTyp.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem changetype " + node.generateBreadcrumbs(user)));
|
||||||
|
base.addExtra(changeTyp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(node.getOwner() == user.getId()) {
|
if (node.getOwner() == user.getId()) {
|
||||||
TextComponent addMember = new TextComponent("[Hinzufügen] ");
|
TextComponent addMember = new TextComponent("[Hinzufügen] ");
|
||||||
addMember.setColor(ChatColor.AQUA);
|
addMember.setColor(ChatColor.AQUA);
|
||||||
addMember.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§eMember hinzufügen")));
|
addMember.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§eMember hinzufügen")));
|
||||||
@ -195,30 +277,32 @@ public class SchematicCommand extends SWCommand {
|
|||||||
delMember.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/schem delmember " + node.generateBreadcrumbs(user) + " "));
|
delMember.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/schem delmember " + node.generateBreadcrumbs(user) + " "));
|
||||||
base.addExtra(delMember);
|
base.addExtra(delMember);
|
||||||
|
|
||||||
TextComponent delete = new TextComponent("[Delete] ");
|
TextComponent move = new TextComponent("[Verschieben] ");
|
||||||
|
move.setColor(ChatColor.DARK_PURPLE);
|
||||||
|
move.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§e" + (node.isDir() ? "Ordner" : "Schematic") + " verschieben")));
|
||||||
|
move.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/schem move " + node.generateBreadcrumbs(user) + " " + node.generateBreadcrumbs(user).replace("/" + node.getName(), "")));
|
||||||
|
base.addExtra(move);
|
||||||
|
|
||||||
|
TextComponent rename = new TextComponent("[Umbenennen] ");
|
||||||
|
rename.setColor(ChatColor.LIGHT_PURPLE);
|
||||||
|
rename.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§e" + (node.isDir() ? "Ordner" : "Schematic") + " umbenennen")));
|
||||||
|
rename.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/schem rename " + node.generateBreadcrumbs(user) + " [Neuer Name]"));
|
||||||
|
base.addExtra(rename);
|
||||||
|
|
||||||
|
TextComponent delete = new TextComponent("[Löschen] ");
|
||||||
delete.setColor(ChatColor.DARK_RED);
|
delete.setColor(ChatColor.DARK_RED);
|
||||||
delete.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§e" + (node.isDir()?"Ordner":"Schematic") + " Löschen")));
|
delete.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§e" + (node.isDir() ? "Ordner" : "Schematic") + " Löschen")));
|
||||||
delete.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem delete " + node.generateBreadcrumbs(user)));
|
delete.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem delete " + node.generateBreadcrumbs(user)));
|
||||||
base.addExtra(delete);
|
base.addExtra(delete);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
player.spigot().sendMessage(base);
|
player.spigot().sendMessage(base);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register({"info", "/"})
|
|
||||||
public void schemInfoSecret(Player player) {
|
|
||||||
player.sendMessage("§7--==( §eSteam§8War §eSchematic-System §7)==--");
|
|
||||||
player.sendMessage("§7Anzahl an Schematics: §e" + SchematicNode.countNodes());
|
|
||||||
player.sendMessage("§7Von dir einsehbar: §e" + SchematicNode.getAllSchematicsAccessibleByUser(SteamwarUser.get(player.getUniqueId()).getId()).size());
|
|
||||||
player.sendMessage("§7Autoren: §e" + Arrays.toString(SchematicSystem.INSTANCE.getDescription().getAuthors().toArray()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Register("l")
|
@Register("l")
|
||||||
@Register("load")
|
@Register("load")
|
||||||
public void loadSchem(Player player, SchematicNode node) {
|
public void loadSchem(Player player, SchematicNode node) {
|
||||||
if(node.isDir()) {
|
if (node.isDir()) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst keine Ordner Laden");
|
player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst keine Ordner Laden");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -226,7 +310,7 @@ public class SchematicCommand extends SWCommand {
|
|||||||
try {
|
try {
|
||||||
node.loadToPlayer(player);
|
node.loadToPlayer(player);
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§7Schematic §e" + node.getName() + " §7geladen!");
|
player.sendMessage(SchematicSystem.PREFIX + "§7Schematic §e" + node.getName() + " §7geladen!");
|
||||||
Bukkit.getLogger().log(Level.INFO, "{} has loaded Schematic {} {}", new Object[] {player.getName(), node.getId(), node.getName()});
|
Bukkit.getLogger().log(Level.INFO, "{} has loaded Schematic {} {}", new Object[]{player.getName(), node.getId(), node.getName()});
|
||||||
} catch (NoClipboardException e) {
|
} catch (NoClipboardException e) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cEs konnte keine Daten in der Schematic gefunden werden.");
|
player.sendMessage(SchematicSystem.PREFIX + "§cEs konnte keine Daten in der Schematic gefunden werden.");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -235,78 +319,73 @@ public class SchematicCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register({"l", "public"})
|
|
||||||
@Register({"load", "public"})
|
|
||||||
public void loadSchemPublic(Player player, @Mapper("publicMapper") SchematicNode node) {
|
|
||||||
loadSchem(player, node);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Register("save")
|
@Register("save")
|
||||||
@Register("s")
|
@Register("s")
|
||||||
public void saveSchem(Player player, @Mapper("dirStringMapper") String name) {
|
public void saveSchem(Player player, @Mapper("dirStringMapper") String name) {
|
||||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
if(name.startsWith("/")) name = name.substring(1);
|
if (name.startsWith("/")) name = name.substring(1);
|
||||||
String[] layers = name.split("/");
|
String[] layers = name.split("/");
|
||||||
if(invalidSchemName(player, layers)) return;
|
if (invalidSchemName(player, layers)) return;
|
||||||
SchematicNode currentNode = mkdirs(layers, user, 1);
|
SchematicNode currentNode = mkdirs(layers, user, 1);
|
||||||
|
|
||||||
SchematicNode node = SchematicNode.getSchematicInParent(layers[layers.length-1], currentNode==null?0:currentNode.getId());
|
SchematicNode node = SchematicNode.getSchematicInParent(layers[layers.length - 1], currentNode == null ? 0 : currentNode.getId());
|
||||||
if(node != null && !node.getSchemtype().writeable()) {
|
if (node != null && !node.getSchemtype().writeable()) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDu darfst diese Schematic nicht überschreiben");
|
player.sendMessage(SchematicSystem.PREFIX + "§cDu darfst diese Schematic nicht überschreiben");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean newSchem = false;
|
boolean newSchem = false;
|
||||||
if(node == null) {
|
if (node == null) {
|
||||||
newSchem = true;
|
newSchem = true;
|
||||||
node = SchematicNode.createSchematic(user.getId(), layers[layers.length-1], currentNode==null?0:currentNode.getId());
|
node = SchematicNode.createSchematic(user.getId(), layers[layers.length - 1], currentNode == null ? 0 : currentNode.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
node.saveFromPlayer(player);
|
node.saveFromPlayer(player);
|
||||||
}catch (NoClipboardException e) {
|
} catch (NoClipboardException e) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDein Clipboard ist leer");
|
player.sendMessage(SchematicSystem.PREFIX + "§cDein Clipboard ist leer");
|
||||||
if(newSchem)
|
if (newSchem)
|
||||||
node.delete();
|
node.delete();
|
||||||
return;
|
return;
|
||||||
}catch(Exception ex){
|
} catch (Exception ex) {
|
||||||
Bukkit.getLogger().log(Level.SEVERE, "Could not save schematic", ex);
|
Bukkit.getLogger().log(Level.SEVERE, "Could not save schematic", ex);
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cFehler beim Speichern der Schematic.");
|
player.sendMessage(SchematicSystem.PREFIX + "§cFehler beim Speichern der Schematic.");
|
||||||
if(newSchem)
|
if (newSchem)
|
||||||
node.delete();
|
node.delete();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newSchem)
|
if (newSchem) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "Schematic §e" + node.getName() + " §7gespeichert");
|
player.sendMessage(SchematicSystem.PREFIX + "Schematic §e" + node.getName() + " §7gespeichert");
|
||||||
else
|
} else {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "Schematic §e" + node.getName() + " §7überschrieben");
|
player.sendMessage(SchematicSystem.PREFIX + "Schematic §e" + node.getName() + " §7überschrieben");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register("addmember")
|
@Register("addmember")
|
||||||
public void addMember(Player player, SchematicNode node, SteamwarUser target) {
|
public void addMember(Player player, SchematicNode node, SteamwarUser target) {
|
||||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
if(node.getOwner() != user.getId()) {
|
if (node.getOwner() != user.getId()) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst nur auf deine eigenen Sachen jemanden hinzufügen.");
|
player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst nur auf deine eigenen Sachen jemanden hinzufügen.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(user.getId() == target.getId()) {
|
if (user.getId() == target.getId()) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cAlso bitte: Das ist deine eigene Schematic!");
|
player.sendMessage(SchematicSystem.PREFIX + "§cAlso bitte: Das ist deine eigene Schematic!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeMember member = NodeMember.getNodeMember(node.getId(), target.getId());
|
if (NodeMember.getNodeMember(node.getId(), target.getId()) != null) {
|
||||||
if(member != null) {
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDieser Spieler ist bereits auf diese Schematic geaddet");
|
player.sendMessage(SchematicSystem.PREFIX + "§cDieser Spieler ist bereits auf diese Schematic geaddet");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
member = NodeMember.createNodeMember(node.getId(), target.getId());
|
NodeMember.createNodeMember(node.getId(), target.getId());
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "Der Spieler §e" + target.getUserName() + " §7hat nun Zugriff auf die Schematic §e" + node.generateBreadcrumbs(user));
|
player.sendMessage(SchematicSystem.PREFIX + "Der Spieler §e" + target.getUserName() + " §7hat nun Zugriff auf die Schematic §e" + node.generateBreadcrumbs(user));
|
||||||
|
|
||||||
Player t = Bukkit.getPlayer(target.getUUID());
|
Player t = Bukkit.getPlayer(target.getUUID());
|
||||||
if(t != null)
|
if (t != null) {
|
||||||
t.sendMessage(SchematicSystem.PREFIX + "Du hast nun Zugriff auf die Schematic §e" + node.getName() + " §7von §e" + player.getName());
|
t.sendMessage(SchematicSystem.PREFIX + "Du hast nun Zugriff auf die Schematic §e" + node.getName() + " §7von §e" + player.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register("delmember")
|
@Register("delmember")
|
||||||
@ -314,7 +393,7 @@ public class SchematicCommand extends SWCommand {
|
|||||||
public void delMember(Player player, SchematicNode node, @Mapper("memberMapper") NodeMember member) {
|
public void delMember(Player player, SchematicNode node, @Mapper("memberMapper") NodeMember member) {
|
||||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
|
|
||||||
if(node.getOwner() != user.getId()) {
|
if (node.getOwner() != user.getId()) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst nur auf deine eigenen Sachen jemanden entfernen.");
|
player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst nur auf deine eigenen Sachen jemanden entfernen.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -322,40 +401,15 @@ public class SchematicCommand extends SWCommand {
|
|||||||
member.delete();
|
member.delete();
|
||||||
|
|
||||||
List<SchematicNode> nodes = SchematicNode.deepGet(node.getId(), node1 -> node1.getOwner() != user.getId());
|
List<SchematicNode> nodes = SchematicNode.deepGet(node.getId(), node1 -> node1.getOwner() != user.getId());
|
||||||
if(!nodes.isEmpty()) {
|
if (!nodes.isEmpty()) {
|
||||||
SteamwarUser target = SteamwarUser.get(member.getMember());
|
SteamwarUser target = SteamwarUser.get(member.getMember());
|
||||||
for (SchematicNode schematicNode : nodes) {
|
for (SchematicNode schematicNode : nodes) {
|
||||||
SchematicNode newNode = mkdirs(schematicNode.generateBreadcrumbs(user).split("/"), target, 1);
|
SchematicNode newNode = mkdirs(schematicNode.generateBreadcrumbs(user).split("/"), target, 1);
|
||||||
schematicNode.setParent(newNode==null?0:newNode.getId());
|
schematicNode.setParent(newNode == null ? 0 : newNode.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register("download")
|
|
||||||
public void download(Player player, SchematicNode node) {
|
|
||||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
|
||||||
if(node.getOwner() != user.getId()) {
|
|
||||||
player.sendMessage("§cDu darfst nur deine eigenen Schematics herunterladen!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "Dein Download Link:");
|
|
||||||
player.sendMessage(DownloadSchematic.getLink(node));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Register("dir")
|
|
||||||
@Register("ordner")
|
|
||||||
@Register("mkdir")
|
|
||||||
public void mkdir(Player player, @Mapper("dirStringMapper") String name) {
|
|
||||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
|
||||||
if(name.startsWith("/")) name = name.substring(1);
|
|
||||||
if(name.endsWith("/")) name = name.substring(0, name.length()-1);
|
|
||||||
String[] layers = name.split("/");
|
|
||||||
if(invalidSchemName(player, layers)) return;
|
|
||||||
SchematicNode node = mkdirs(layers, user, 0);
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§7Ordner §e" + node.generateBreadcrumbs(user) + " §7erstellt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Register("search")
|
@Register("search")
|
||||||
public void schemSearch(Player player, String quarry) {
|
public void schemSearch(Player player, String quarry) {
|
||||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
@ -371,13 +425,38 @@ public class SchematicCommand extends SWCommand {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Register("download")
|
||||||
|
public void download(Player player, SchematicNode node) {
|
||||||
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
|
if (node.getOwner() != user.getId()) {
|
||||||
|
player.sendMessage("§cDu darfst nur deine eigenen Schematics herunterladen!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "Dein Download Link:");
|
||||||
|
player.sendMessage(DownloadSchematic.getLink(node));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Register("dir")
|
||||||
|
@Register("ordner")
|
||||||
|
@Register("mkdir")
|
||||||
|
public void mkdir(Player player, @Mapper("dirStringMapper") String name) {
|
||||||
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
|
if (name.startsWith("/")) name = name.substring(1);
|
||||||
|
if (name.endsWith("/")) name = name.substring(0, name.length() - 1);
|
||||||
|
String[] layers = name.split("/");
|
||||||
|
if (invalidSchemName(player, layers)) return;
|
||||||
|
SchematicNode node = mkdirs(layers, user, 0);
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§7Ordner §e" + node.generateBreadcrumbs(user) + " §7erstellt");
|
||||||
|
}
|
||||||
|
|
||||||
@Register("changetype")
|
@Register("changetype")
|
||||||
public void changeType(Player player, SchematicNode node) {
|
public void changeType(Player player, SchematicNode node) {
|
||||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
TextComponent base = new TextComponent();
|
TextComponent base = new TextComponent();
|
||||||
|
|
||||||
SchematicType.values().forEach(type -> {
|
SchematicType.values().forEach(type -> {
|
||||||
if(!type.isAssignable()) return;
|
if (!type.isAssignable()) return;
|
||||||
|
|
||||||
TextComponent component = new TextComponent(type.name() + " ");
|
TextComponent component = new TextComponent(type.name() + " ");
|
||||||
component.setColor(ChatColor.GRAY);
|
component.setColor(ChatColor.GRAY);
|
||||||
@ -392,90 +471,186 @@ public class SchematicCommand extends SWCommand {
|
|||||||
|
|
||||||
@Register("changetype")
|
@Register("changetype")
|
||||||
public void changeType(Player player, SchematicNode node, SchematicType type) {
|
public void changeType(Player player, SchematicNode node, SchematicType type) {
|
||||||
if(node.isDir()) {
|
changeType(player, node, type, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Register("changetype")
|
||||||
|
public void changeType(Player player, SchematicNode node, SchematicType type, Extend extend) {
|
||||||
|
if (node.isDir()) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cOrdner haben keinen Typen.");
|
player.sendMessage(SchematicSystem.PREFIX + "§cOrdner haben keinen Typen.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(node.getType().equals(type.toDB())) {
|
if (node.getType().equals(type.toDB())) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDie Schematic hat schon diesen Typen");
|
player.sendMessage(SchematicSystem.PREFIX + "§cDie Schematic hat schon diesen Typen");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(type.writeable()) {
|
if (type.writeable()) {
|
||||||
node.setType(type.toDB());
|
node.setType(type.toDB());
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§aSchematictyp geändert");
|
player.sendMessage(SchematicSystem.PREFIX + "§aSchematictyp geändert");
|
||||||
} else if(type.fightType()) {
|
} else if (type.fightType()) {
|
||||||
if(node.getSchemtype().check()){
|
if (node.getSchemtype().check()) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDu hast diese Schematic bereits eingesendet");
|
player.sendMessage(SchematicSystem.PREFIX + "§cDu hast diese Schematic bereits eingesendet");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoCheckResult result = CheckSchemType.get(type).autoCheck(node);
|
AutoCheckResult result = CheckSchemType.get(type).autoCheck(node);
|
||||||
Collection<String> errors = result.errors();
|
Collection<String> errors = result.errors();
|
||||||
for(String warning : result.warnings()){
|
for (String warning : result.warnings()) {
|
||||||
player.sendMessage(" §e" + warning);
|
player.sendMessage(" §e" + warning);
|
||||||
}
|
}
|
||||||
for(String error : errors){
|
for (String error : errors) {
|
||||||
player.sendMessage(" §c" + error);
|
player.sendMessage(" §c" + error);
|
||||||
}
|
}
|
||||||
if(!errors.isEmpty()){
|
if (!errors.isEmpty()) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDie Schematic ist nicht regelkonform");
|
player.sendMessage(SchematicSystem.PREFIX + "§cDie Schematic ist nicht regelkonform");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWInventory inv = new SWInventory(player, 9, "Schematic ausfahren");
|
if (extend == null) {
|
||||||
inv.setItem(0, SWItem.getDye(10), (byte)10, "§eSchematic ausfahren", click -> {
|
SWInventory inv = new SWInventory(player, 9, "Schematic ausfahren");
|
||||||
|
inv.setItem(0, SWItem.getDye(10), (byte) 10, "§eSchematic ausfahren", click -> {
|
||||||
|
new PrepareSchemPacket(SteamwarUser.get(player.getUniqueId()), node, type).send(player);
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§aDer Vorbereitungsserver wird gestartet");
|
||||||
|
player.closeInventory();
|
||||||
|
});
|
||||||
|
inv.setItem(8, SWItem.getDye(7), (byte) 7, "§eDirekt einsenden", click -> {
|
||||||
|
node.setType(type.checkType().toDB());
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§aDie Schematic wird zeitnah überprüft");
|
||||||
|
player.closeInventory();
|
||||||
|
});
|
||||||
|
inv.setCallback(-999, click -> player.closeInventory());
|
||||||
|
inv.open();
|
||||||
|
} else if (extend == Extend.AUSFAHREN) {
|
||||||
new PrepareSchemPacket(SteamwarUser.get(player.getUniqueId()), node, type).send(player);
|
new PrepareSchemPacket(SteamwarUser.get(player.getUniqueId()), node, type).send(player);
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§aDer Vorbereitungsserver wird gestartet");
|
player.sendMessage(SchematicSystem.PREFIX + "§aDer Vorbereitungsserver wird gestartet");
|
||||||
player.closeInventory();
|
}
|
||||||
});
|
|
||||||
inv.setItem(8, SWItem.getDye(7), (byte)7, "§eDirekt einsenden", click -> {
|
|
||||||
node.setType(type.checkType().toDB());
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§aDie Schematic wird zeitnah überprüft");
|
|
||||||
player.closeInventory();
|
|
||||||
});
|
|
||||||
inv.setCallback(-999, click -> player.closeInventory());
|
|
||||||
inv.open();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register("move")
|
@Register("move")
|
||||||
public void renameMove(Player player, SchematicNode node, @Mapper("dirStringMapper") String name) {
|
public void move(Player player, SchematicNode node, @Mapper("dirStringMapper") String name) {
|
||||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
if(node.getOwner() != user.getId()) {
|
if (node.getOwner() != user.getId()) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDas kannst du nur bei deinen eigenen Schems machen");
|
player.sendMessage(SchematicSystem.PREFIX + "§cDas kannst du nur bei deinen eigenen Schems machen");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(name.startsWith("/")) name = name.substring(1);
|
if (name.equals("/")) {
|
||||||
if(name.endsWith("/")) name = name.substring(0, name.length()-1);
|
|
||||||
String[] layers = name.split("/");
|
|
||||||
if(invalidSchemName(player, layers)) return;
|
|
||||||
if(name.contains("/")) {
|
|
||||||
SchematicNode newNode = mkdirs(layers, user, 1);
|
|
||||||
node.setParent(newNode.getId());
|
|
||||||
} else {
|
|
||||||
node.setParent(0);
|
node.setParent(0);
|
||||||
|
} else {
|
||||||
|
if (name.startsWith("/")) name = name.substring(1);
|
||||||
|
if (name.endsWith("/")) name = name.substring(0, name.length() - 1);
|
||||||
|
String[] layers = name.split("/");
|
||||||
|
if (invalidSchemName(player, layers)) return;
|
||||||
|
SchematicNode newNode = mkdirs(layers, user, 0);
|
||||||
|
node.setParent(newNode.getId());
|
||||||
}
|
}
|
||||||
String schemName = layers[layers.length-1];
|
player.sendMessage(SchematicSystem.PREFIX + "§7Die Schematic ist nun unter §e" + node.generateBreadcrumbs(user) + " §7zu finden");
|
||||||
node.setName(schemName);
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§7Die Schematic heist nun §7" + node.generateBreadcrumbs(user));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean invalidSchemName(Player player, String[] layers){
|
@Register("rename")
|
||||||
|
public void rename(Player player, SchematicNode node, String name) {
|
||||||
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
|
if (node.getOwner() != user.getId()) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDas kannst du nur bei deinen eigenen Schems machen");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (invalidSchemName(player, new String[]{name})) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
node.setName(name);
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§7Die Schematic heist nun §e" + node.generateBreadcrumbs(user));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Register("addteam")
|
||||||
|
public void addTeam(Player player, SchematicNode node) {
|
||||||
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
|
if (node.getOwner() != user.getId()) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDas kannst du nur bei deinen eigenen Schems machen");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Team team = Team.get(user.getTeam());
|
||||||
|
if (team == null) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDu bist in keinem Team");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> added = new ArrayList<>();
|
||||||
|
for (Integer member : team.getMembers()) {
|
||||||
|
if (user.getId() == member) continue;
|
||||||
|
if (NodeMember.getNodeMember(node.getId(), member) == null) {
|
||||||
|
NodeMember.createNodeMember(node.getId(), member);
|
||||||
|
added.add(SteamwarUser.get(member).getUserName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Optional<String> reduced = added.stream().reduce((s, s2) -> s + ", " + s2);
|
||||||
|
if (reduced.isPresent()) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§7Die Spieler §e" + reduced.get() + " §7wurden auf die Schematic hinzugefügt");
|
||||||
|
} else {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§7Es wurde kein Spieler hinzugefügt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Register("remteam")
|
||||||
|
public void remTeam(Player player, SchematicNode node) {
|
||||||
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
|
if (node.getOwner() != user.getId()) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDas kannst du nur bei deinen eigenen Schems machen");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Team team = Team.get(user.getTeam());
|
||||||
|
if (team == null) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDu bist in keinem Team");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> removed = new ArrayList<>();
|
||||||
|
for (Integer member : team.getMembers()) {
|
||||||
|
if (user.getId() == member) continue;
|
||||||
|
NodeMember nodeMember = NodeMember.getNodeMember(node.getId(), member);
|
||||||
|
if (nodeMember != null) {
|
||||||
|
nodeMember.delete();
|
||||||
|
removed.add(SteamwarUser.get(member).getUserName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Optional<String> reduced = removed.stream().reduce((s, s2) -> s + ", " + s2);
|
||||||
|
if (reduced.isPresent()) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§7Die Spieler §e" + reduced.get() + " §7wurden von der Schematic entfernt");
|
||||||
|
} else {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§7Es wurde kein Spieler entfernt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Register("remallmember")
|
||||||
|
@Register("clearmember")
|
||||||
|
public void clearMember(Player player, SchematicNode node) {
|
||||||
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
|
if (node.getOwner() != user.getId()) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDas kannst du nur bei deinen eigenen Schems machen");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
node.getMembers().forEach(NodeMember::delete);
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§7Alle Spieler wurden von der Schematic entfernt");
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean invalidSchemName(Player player, String[] layers) {
|
||||||
for (String layer : layers) {
|
for (String layer : layers) {
|
||||||
if(layer.isEmpty()) {
|
if (layer.isEmpty()) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDeine Ordner brauchen schon einen Namen!");
|
player.sendMessage(SchematicSystem.PREFIX + "§cDeine Ordner brauchen schon einen Namen!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(layer.contains("/") ||
|
if (layer.contains("/") ||
|
||||||
layer.contains("\\") ||
|
layer.contains("\\") ||
|
||||||
layer.contains("<") ||
|
layer.contains("<") ||
|
||||||
layer.contains(">") ||
|
layer.contains(">") ||
|
||||||
layer.contains("^") ||
|
layer.contains("^") ||
|
||||||
layer.contains("°") ||
|
layer.contains("°") ||
|
||||||
layer.contains("'") ||
|
layer.contains("'") ||
|
||||||
layer.contains("\"")){
|
layer.contains("\"")) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen");
|
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -488,13 +663,13 @@ public class SchematicCommand extends SWCommand {
|
|||||||
for (int i = 0; i < layers.length - minus; i++) {
|
for (int i = 0; i < layers.length - minus; i++) {
|
||||||
int finalI = i;
|
int finalI = i;
|
||||||
List<SchematicNode> nodes;
|
List<SchematicNode> nodes;
|
||||||
if(currentNode == null) {
|
if (currentNode == null) {
|
||||||
nodes = SchematicNode.getSchematicsAccessibleByUser(user.getId(), 0).stream().filter(node -> node.getName().equals(layers[finalI])).collect(Collectors.toList());
|
nodes = SchematicNode.getSchematicsAccessibleByUser(user.getId(), 0).stream().filter(node -> node.getName().equals(layers[finalI])).collect(Collectors.toList());
|
||||||
} else {
|
} else {
|
||||||
nodes = SchematicNode.getSchematicNodeInNode(currentNode).stream().filter(node -> node.getName().equals(layers[finalI])).collect(Collectors.toList());
|
nodes = SchematicNode.getSchematicNodeInNode(currentNode).stream().filter(node -> node.getName().equals(layers[finalI])).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
if(nodes.isEmpty()) {
|
if (nodes.isEmpty()) {
|
||||||
currentNode = SchematicNode.createSchematicDirectory(user.getId(), layers[i], currentNode==null?0:currentNode.getId());
|
currentNode = SchematicNode.createSchematicDirectory(user.getId(), layers[i], currentNode == null ? 0 : currentNode.getId());
|
||||||
} else {
|
} else {
|
||||||
currentNode = nodes.get(0);
|
currentNode = nodes.get(0);
|
||||||
}
|
}
|
||||||
@ -502,18 +677,21 @@ public class SchematicCommand extends SWCommand {
|
|||||||
return currentNode;
|
return currentNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final TypeMapper<SchematicNode> schematicCommandTypeMapper = nodeTypeMapper();
|
||||||
|
private final TypeMapper<SchematicNode> publicCommandTypeMapper = publicNodeTypeMapper();
|
||||||
|
|
||||||
private void renderSchemlist(Player player, List<SchematicNode> nodes, int chunk, String breadcrumbs, boolean isPublic) {
|
private void renderSchemlist(Player player, List<SchematicNode> nodes, int chunk, String breadcrumbs, boolean isPublic) {
|
||||||
nodes.sort(Comparator.comparing(SchematicNode::getName));
|
nodes.sort(Comparator.comparing(SchematicNode::getName));
|
||||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
int pageCount = (int) Math.ceil(nodes.size() / (double) CHUNK_SIZE);
|
int pageCount = (int) Math.ceil(nodes.size() / (double) CHUNK_SIZE);
|
||||||
|
|
||||||
player.sendMessage("§7--==( §eSchematics §8(§e" + nodes.size() + "§8) §7)==--");
|
player.sendMessage("§7--==( §eSchematics §8(§e" + nodes.size() + "§8) §7)==--");
|
||||||
player.sendMessage("§7Aktueller Pfad: §e" + (breadcrumbs.isEmpty()?"/":breadcrumbs));
|
player.sendMessage("§7Aktueller Pfad: §e" + (breadcrumbs.isEmpty() ? "/" : breadcrumbs));
|
||||||
if(!breadcrumbs.isEmpty()) {
|
if (!breadcrumbs.isEmpty()) {
|
||||||
TextComponent back = new TextComponent("§e../");
|
TextComponent back = new TextComponent("§e../");
|
||||||
String str = breadcrumbs.substring(0, Math.max(0, breadcrumbs.substring(0, breadcrumbs.length() - 1).lastIndexOf("/")));
|
String str = breadcrumbs.substring(0, Math.max(0, breadcrumbs.substring(0, breadcrumbs.length() - 1).lastIndexOf("/")));
|
||||||
back.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eZurück gehen" + str).create()));
|
back.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eZurück gehen" + str).create()));
|
||||||
back.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem list " + (isPublic?"public":"") + " " + str));
|
back.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem list " + (isPublic ? "public" : "") + " " + str));
|
||||||
|
|
||||||
player.spigot().sendMessage(back);
|
player.spigot().sendMessage(back);
|
||||||
}
|
}
|
||||||
@ -522,11 +700,11 @@ public class SchematicCommand extends SWCommand {
|
|||||||
|
|
||||||
StringBuilder nodeString = new StringBuilder();
|
StringBuilder nodeString = new StringBuilder();
|
||||||
|
|
||||||
if(node.isDir()) {
|
if (node.isDir()) {
|
||||||
nodeString.append("§9DIR §e");
|
nodeString.append("§9DIR §e");
|
||||||
} else {
|
} else {
|
||||||
SchematicType type = node.getSchemtype();
|
SchematicType type = node.getSchemtype();
|
||||||
if(type != SchematicType.Normal) {
|
if (type != SchematicType.Normal) {
|
||||||
nodeString.append("§8§l")
|
nodeString.append("§8§l")
|
||||||
.append(type.getKuerzel().toUpperCase())
|
.append(type.getKuerzel().toUpperCase())
|
||||||
.append(" ");
|
.append(" ");
|
||||||
@ -536,73 +714,49 @@ public class SchematicCommand extends SWCommand {
|
|||||||
|
|
||||||
nodeString.append(node.getName());
|
nodeString.append(node.getName());
|
||||||
|
|
||||||
if(node.isDir()) {
|
if (node.isDir()) {
|
||||||
nodeString.append("/");
|
nodeString.append("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(node.getOwner() != user.getId()) {
|
if (node.getOwner() != user.getId()) {
|
||||||
nodeString.append(" §8von §7")
|
nodeString.append(" §8von §7")
|
||||||
.append(SteamwarUser.get(node.getOwner()).getUserName());
|
.append(SteamwarUser.get(node.getOwner()).getUserName());
|
||||||
}
|
}
|
||||||
TextComponent schematics = new TextComponent(nodeString.toString());
|
TextComponent schematics = new TextComponent(nodeString.toString());
|
||||||
|
|
||||||
if(node.isDir()) {
|
if (node.isDir()) {
|
||||||
schematics.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eOrdner anzeigen").create()));
|
schematics.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eOrdner anzeigen").create()));
|
||||||
schematics.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem list " + (isPublic?"public":"") + " " + breadcrumbs + node.getName() + "/"));
|
schematics.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem list " + (isPublic ? "public" : "") + " " + breadcrumbs + node.getName() + "/"));
|
||||||
} else {
|
} else {
|
||||||
schematics.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eSchematic verwalten").create()));
|
schematics.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eSchematic verwalten").create()));
|
||||||
schematics.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem info " + (isPublic?"public":"") + " " + breadcrumbs + node.getName()));
|
schematics.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem info " + (isPublic ? "public" : "") + " " + breadcrumbs + node.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
player.spigot().sendMessage(schematics);
|
player.spigot().sendMessage(schematics);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextComponent beforePage = new TextComponent("««");
|
TextComponent beforePage = new TextComponent("««");
|
||||||
if(chunk > 0){
|
if (chunk > 0) {
|
||||||
beforePage.setColor(ChatColor.YELLOW);
|
beforePage.setColor(ChatColor.YELLOW);
|
||||||
beforePage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eVorherige Seite").create()));
|
beforePage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eVorherige Seite").create()));
|
||||||
beforePage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem list " + (isPublic?"public":"") + " " + breadcrumbs + " " + (chunk - 1)));
|
beforePage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem list " + (isPublic ? "public" : "") + " " + breadcrumbs + " " + (chunk - 1)));
|
||||||
}else
|
} else {
|
||||||
beforePage.setColor(ChatColor.RED);
|
beforePage.setColor(ChatColor.RED);
|
||||||
|
}
|
||||||
|
|
||||||
TextComponent nextPage = new TextComponent(" Seite (" + (chunk + 1) + "/" + Math.max(pageCount, 1) + ") »»");
|
TextComponent nextPage = new TextComponent(" Seite (" + (chunk + 1) + "/" + Math.max(pageCount, 1) + ") »»");
|
||||||
if(chunk < pageCount-1){
|
if (chunk < pageCount - 1) {
|
||||||
nextPage.setColor(ChatColor.YELLOW);
|
nextPage.setColor(ChatColor.YELLOW);
|
||||||
nextPage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eNächste Seite").create()));
|
nextPage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eNächste Seite").create()));
|
||||||
nextPage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem list " + (isPublic?"public":"") + " " + breadcrumbs + " " + (chunk + 1)));
|
nextPage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem list " + (isPublic ? "public" : "") + " " + breadcrumbs + " " + (chunk + 1)));
|
||||||
}else
|
} else {
|
||||||
nextPage.setColor(ChatColor.RED);
|
nextPage.setColor(ChatColor.RED);
|
||||||
|
}
|
||||||
|
|
||||||
beforePage.addExtra(nextPage);
|
beforePage.addExtra(nextPage);
|
||||||
player.spigot().sendMessage(beforePage);
|
player.spigot().sendMessage(beforePage);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final TypeMapper<SchematicNode> schematicCommandTypeMapper = nodeTypeMapper();
|
|
||||||
private final TypeMapper<SchematicNode> publicCommandTypeMapper = publicNodeTypeMapper();
|
|
||||||
|
|
||||||
@Mapper("memberMapper")
|
|
||||||
public TypeMapper<NodeMember> nodeMemberTypeMapper() {
|
|
||||||
return new TypeMapper<NodeMember>() {
|
|
||||||
@Override
|
|
||||||
public NodeMember map(CommandSender commandSender, String[] previousArguments, String s) {
|
|
||||||
SchematicNode node = schematicCommandTypeMapper.map(commandSender, previousArguments, previousArguments[previousArguments.length - 1]);
|
|
||||||
SteamwarUser user = SteamwarUser.get(s);
|
|
||||||
return NodeMember.getNodeMember(node.getId(), user.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
|
|
||||||
List<String> list = new ArrayList<>();
|
|
||||||
SchematicNode node = schematicCommandTypeMapper.map(commandSender, strings, strings[strings.length - 1]);
|
|
||||||
if(node == null) {
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
node.getMembers().forEach(nodeMember -> list.add(SteamwarUser.get(nodeMember.getMember()).getUserName()));
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Mapper("publicMapper")
|
@Mapper("publicMapper")
|
||||||
public TypeMapper<SchematicNode> publicNodeTypeMapper() {
|
public TypeMapper<SchematicNode> publicNodeTypeMapper() {
|
||||||
return new TypeMapper<SchematicNode>() {
|
return new TypeMapper<SchematicNode>() {
|
||||||
@ -618,6 +772,29 @@ public class SchematicCommand extends SWCommand {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Mapper("memberMapper")
|
||||||
|
public TypeMapper<NodeMember> nodeMemberTypeMapper() {
|
||||||
|
return new TypeMapper<NodeMember>() {
|
||||||
|
@Override
|
||||||
|
public NodeMember map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||||
|
SchematicNode node = schematicCommandTypeMapper.map(commandSender, previousArguments, previousArguments[previousArguments.length - 1]);
|
||||||
|
SteamwarUser user = SteamwarUser.get(s);
|
||||||
|
return NodeMember.getNodeMember(node.getId(), user.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
|
||||||
|
List<String> list = new ArrayList<>();
|
||||||
|
SchematicNode node = schematicCommandTypeMapper.map(commandSender, strings, strings[strings.length - 1]);
|
||||||
|
if (node == null) {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
node.getMembers().forEach(nodeMember -> list.add(SteamwarUser.get(nodeMember.getMember()).getUserName()));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
@Mapper("dirMapper")
|
@Mapper("dirMapper")
|
||||||
public TypeMapper<SchematicNode> dirNodeTypeMapper() {
|
public TypeMapper<SchematicNode> dirNodeTypeMapper() {
|
||||||
return new TypeMapper<SchematicNode>() {
|
return new TypeMapper<SchematicNode>() {
|
||||||
@ -631,7 +808,7 @@ public class SchematicCommand extends SWCommand {
|
|||||||
@Override
|
@Override
|
||||||
public SchematicNode map(CommandSender commandSender, String[] previousArguments, String s) {
|
public SchematicNode map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||||
SchematicNode result = schematicCommandTypeMapper.map(commandSender, previousArguments, s);
|
SchematicNode result = schematicCommandTypeMapper.map(commandSender, previousArguments, s);
|
||||||
if(result == null || !result.isDir()) {
|
if (result == null || !result.isDir()) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return result;
|
return result;
|
||||||
@ -653,7 +830,7 @@ public class SchematicCommand extends SWCommand {
|
|||||||
@Override
|
@Override
|
||||||
public SchematicNode map(CommandSender commandSender, String[] previousArguments, String s) {
|
public SchematicNode map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||||
SchematicNode result = publicCommandTypeMapper.map(commandSender, previousArguments, s);
|
SchematicNode result = publicCommandTypeMapper.map(commandSender, previousArguments, s);
|
||||||
if(result == null || !result.isDir()) {
|
if (result == null || !result.isDir()) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return result;
|
return result;
|
||||||
@ -662,63 +839,21 @@ public class SchematicCommand extends SWCommand {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<String> getNodeTabcomplete(SteamwarUser user, String[] strings, String s) {
|
@Mapper("dirStringMapper")
|
||||||
List<String> list = new ArrayList<>();
|
public TypeMapper<String> stringTabMapper() {
|
||||||
boolean sws = s.startsWith("/");
|
return new TypeMapper<String>() {
|
||||||
if(sws) {
|
@Override
|
||||||
s = s.substring(1);
|
public List<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
|
||||||
}
|
List<String> list = getNodeTabcomplete(SteamwarUser.get(((Player) commandSender).getUniqueId()), strings, s);
|
||||||
if(s.contains("/")) {
|
list.removeIf(s1 -> !s1.endsWith("/"));
|
||||||
String preTab = s.substring(0, s.lastIndexOf("/") + 1);
|
return list;
|
||||||
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)));
|
|
||||||
} else {
|
|
||||||
List<SchematicNode> nodes = SchematicNode.getSchematicsAccessibleByUser(user.getId(), 0);
|
|
||||||
nodes.forEach(node -> list.add((sws ?"/":"") + node.getName() + (node.isDir()?"/":"")));
|
|
||||||
}
|
|
||||||
list.remove("//copy");
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static SchematicNode mapNode(SteamwarUser user, String[] previousArguments, String s) {
|
@Override
|
||||||
if(s.startsWith("/")) {
|
public String map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||||
s = s.substring(1);
|
return s;
|
||||||
}
|
|
||||||
if(s.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if(s.contains("/")) {
|
|
||||||
String[] layers = s.split("/");
|
|
||||||
SchematicNode currentNode = null;
|
|
||||||
for (int i = 0; i < layers.length; i++) {
|
|
||||||
int finalI = i;
|
|
||||||
List<SchematicNode> nodes;
|
|
||||||
if(currentNode == null) {
|
|
||||||
nodes = SchematicNode.getSchematicsAccessibleByUser(user.getId(), 0).stream().filter(node -> node.getName().equals(layers[finalI])).collect(Collectors.toList());
|
|
||||||
} else {
|
|
||||||
nodes = SchematicNode.getSchematicNodeInNode(currentNode).stream().filter(node -> node.getName().equals(layers[finalI])).collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
if(nodes.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
currentNode = nodes.get(0);
|
|
||||||
if(!currentNode.isDir() && i != layers.length-1) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return currentNode;
|
};
|
||||||
} else {
|
|
||||||
String finalS = s;
|
|
||||||
List<SchematicNode> nodes = SchematicNode.getSchematicsAccessibleByUser(user.getId(), 0).stream().filter(node -> node.getName().equals(finalS)).collect(Collectors.toList());
|
|
||||||
if(nodes.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
return nodes.get(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ClassMapper(SchematicNode.class)
|
@ClassMapper(SchematicNode.class)
|
||||||
@ -751,19 +886,9 @@ public class SchematicCommand extends SWCommand {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mapper("dirStringMapper")
|
enum Extend {
|
||||||
public TypeMapper<String> stringTabMapper() {
|
AUSFAHREN,
|
||||||
return new TypeMapper<String>() {
|
NORMAL
|
||||||
@Override
|
|
||||||
public List<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
|
|
||||||
return getNodeTabcomplete(SteamwarUser.get(((Player) commandSender).getUniqueId()), strings, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String map(CommandSender commandSender, String[] previousArguments, String s) {
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren