Schemnodes Schematic System #93
@ -22,6 +22,7 @@ package de.steamwar.schematicsystem.commands;
|
|||||||
import de.steamwar.inventory.*;
|
import de.steamwar.inventory.*;
|
||||||
import de.steamwar.schematicsystem.SchematicSystem;
|
import de.steamwar.schematicsystem.SchematicSystem;
|
||||||
import de.steamwar.sql.*;
|
import de.steamwar.sql.*;
|
||||||
|
import lombok.experimental.UtilityClass;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
import org.bukkit.event.inventory.ClickType;
|
||||||
@ -31,16 +32,13 @@ import java.util.*;
|
|||||||
import static de.steamwar.schematicsystem.commands.SchematicCommandUtils.*;
|
import static de.steamwar.schematicsystem.commands.SchematicCommandUtils.*;
|
||||||
|
|
||||||
public class GUI {
|
public class GUI {
|
||||||
|
private GUI() {}
|
||||||
|
|
||||||
public static void open(Player player) {
|
public static void list(Player player) {
|
||||||
list(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void list(Player player) {
|
|
||||||
SchematicSelector selector = new SchematicSelector(player, SchematicSelector.selectSchematic(), new SchematicSelectorInjectable() {
|
SchematicSelector selector = new SchematicSelector(player, SchematicSelector.selectSchematic(), new SchematicSelectorInjectable() {
|
||||||
@Override
|
@Override
|
||||||
public String createTitle(Player player) {
|
public String createTitle(Player player) {
|
||||||
return "Schematic GUI: {1}";
|
return "Schematics {1}";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -48,7 +46,7 @@ public class GUI {
|
|||||||
if(parent == null) {
|
if(parent == null) {
|
||||||
inv.setItem(49, Material.AIR, "", clickType -> {});
|
inv.setItem(49, Material.AIR, "", clickType -> {});
|
||||||
} else {
|
} else {
|
||||||
inv.setItem(49, Material.ANVIL, "§7Ordner Eigenschaften", clickType -> {
|
inv.setItem(49, Material.ANVIL, "§7Ordnereigenschaften", clickType -> {
|
||||||
info(selector.getPlayer(), parent);
|
info(selector.getPlayer(), parent);
|
||||||
});
|
});
|
||||||
Chaoscaot markierte diese Unterhaltung als gelöst
|
|||||||
}
|
}
|
||||||
@ -64,7 +62,7 @@ public class GUI {
|
|||||||
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();
|
||||||
SchematicSystem.getInstance().SCHEMATIC_COMMAND.loadSchem(player, node);
|
SchematicCommandUtils.loadSchem(player, node);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,9 +78,7 @@ public class GUI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Material mat = node.isDir()?SWItem.getMaterial("CHEST"):SWItem.getMaterial("CAULDRON_ITEM");
|
Material mat = SWItem.getMaterial(node.getItem());
|
||||||
if(node.getItem() != null && !node.getItem().equals(""))
|
|
||||||
mat = SWItem.getMaterial(node.getItem());
|
|
||||||
|
|
||||||
inv.setItem(2, mat, "§e" + mat.name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), false, click -> {
|
inv.setItem(2, mat, "§e" + mat.name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), false, click -> {
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
@ -95,7 +91,7 @@ public class GUI {
|
|||||||
});
|
});
|
||||||
inv.setItem(4, SWItem.getMaterial("MAGENTA_GLAZED_TERRACOTTA"), "§eDownload", click -> {
|
inv.setItem(4, SWItem.getMaterial("MAGENTA_GLAZED_TERRACOTTA"), "§eDownload", click -> {
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
SchematicSystem.getInstance().SCHEMATIC_COMMAND.download(player, node);
|
SchematicCommandUtils.download(player, node);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
SWItem skull = SWItem.getPlayerSkull("MHF_STEVE");
|
SWItem skull = SWItem.getPlayerSkull("MHF_STEVE");
|
||||||
@ -163,7 +159,7 @@ 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();
|
p.closeInventory();
|
||||||
SchematicSystem.getInstance().SCHEMATIC_COMMAND.changeType(p, schem, schematicType);
|
SchematicCommandUtils.changeType(p, schem, schematicType, null);
|
||||||
});
|
});
|
||||||
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
|
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
|
||||||
inv.open();
|
inv.open();
|
||||||
|
@ -66,7 +66,7 @@ public class SchematicCommand extends SWCommand {
|
|||||||
|
|
||||||
@Register("gui")
|
@Register("gui")
|
||||||
public void gui(Player player) {
|
public void gui(Player player) {
|
||||||
GUI.open(player);
|
GUI.list(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register("list")
|
@Register("list")
|
||||||
@ -121,7 +121,7 @@ public class SchematicCommand extends SWCommand {
|
|||||||
|
|
||||||
@Register({"info", "/"})
|
@Register({"info", "/"})
|
||||||
public void schemInfoSecret(Player player) {
|
public void schemInfoSecret(Player player) {
|
||||||
player.sendMessage("§7--==( §eSteam§8War §eSchematic-System §7)==--");
|
player.sendMessage("§eSteam§8War §eSchematic-System");
|
||||||
player.sendMessage("§7Anzahl an Schematics: §e" + SchematicNode.countNodes());
|
player.sendMessage("§7Anzahl an Schematics: §e" + SchematicNode.countNodes());
|
||||||
player.sendMessage("§7Von dir einsehbar: §e" + SchematicNode.getAllSchematicsAccessibleByUser(getUser(player).getId()).size());
|
player.sendMessage("§7Von dir einsehbar: §e" + SchematicNode.getAllSchematicsAccessibleByUser(getUser(player).getId()).size());
|
||||||
player.sendMessage("§7Autoren: §e" + Arrays.toString(SchematicSystem.getInstance().getDescription().getAuthors().toArray()));
|
player.sendMessage("§7Autoren: §e" + Arrays.toString(SchematicSystem.getInstance().getDescription().getAuthors().toArray()));
|
||||||
@ -151,21 +151,7 @@ public class SchematicCommand extends SWCommand {
|
|||||||
@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()) {
|
SchematicCommandUtils.loadSchem(player, node);
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst keine Ordner Laden");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
node.loadToPlayer(player);
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§7Schematic §e" + node.getName() + " §7geladen!");
|
|
||||||
Bukkit.getLogger().log(Level.INFO, "{0} has loaded Schematic {1} {2}", new Object[]{player.getName(), node.getId(), node.getName()});
|
|
||||||
} catch (NoClipboardException e) {
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cEs konnte keine Daten in der Schematic gefunden werden.");
|
|
||||||
} catch (Exception e) {
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDie Schematic konnte nicht geladen werden.");
|
|
||||||
throw new SecurityException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register("save")
|
@Register("save")
|
||||||
@ -306,14 +292,7 @@ public class SchematicCommand extends SWCommand {
|
|||||||
|
|
||||||
@Register("download")
|
@Register("download")
|
||||||
public void download(Player player, SchematicNode node) {
|
public void download(Player player, SchematicNode node) {
|
||||||
SteamwarUser user = getUser(player);
|
SchematicCommandUtils.download(player, node);
|
||||||
if (node.getOwner() != user.getId()) {
|
|
||||||
player.sendMessage("§cDu darfst nur deine eigenen Schematics herunterladen!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "Dein Download Link:");
|
|
||||||
player.sendMessage(NodeDownload.getLink(node));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register("dir")
|
@Register("dir")
|
||||||
@ -359,63 +338,7 @@ public class SchematicCommand extends SWCommand {
|
|||||||
|
|
||||||
@Register("changetype")
|
@Register("changetype")
|
||||||
public void changeType(Player player, SchematicNode node, SchematicType type, Extend extend) {
|
public void changeType(Player player, SchematicNode node, SchematicType type, Extend extend) {
|
||||||
SteamwarUser user = getUser(player);
|
SchematicCommandUtils.changeType(player, node, type, extend);
|
||||||
if (node.getOwner() != user.getId()) {
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst nur deine eigenen Schematics einsenden.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node.isDir()) {
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cOrdner haben keinen Typen.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node.getType().equals(type.toDB())) {
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDie Schematic hat schon diesen Typen");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type.writeable()) {
|
|
||||||
node.setSchemtype(type);
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§aSchematictyp geändert");
|
|
||||||
} else if (type.fightType()) {
|
|
||||||
if (node.getSchemtype().check()) {
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDu hast diese Schematic bereits eingesendet");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
AutoCheckResult result = CheckSchemType.get(type).autoCheck(node);
|
|
||||||
Collection<String> errors = result.errors();
|
|
||||||
for (String warning : result.warnings()) {
|
|
||||||
player.sendMessage(" §e" + warning);
|
|
||||||
}
|
|
||||||
for (String error : errors) {
|
|
||||||
player.sendMessage(" §c" + error);
|
|
||||||
}
|
|
||||||
if (!errors.isEmpty()) {
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDie Schematic ist nicht regelkonform");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (extend == null) {
|
|
||||||
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.setSchemtype(type.checkType());
|
|
||||||
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);
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§aDer Vorbereitungsserver wird gestartet");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register("move")
|
@Register("move")
|
||||||
|
@ -31,8 +31,8 @@ public class SchematicCommandHelp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void printHelpMainPage(Player player) {
|
public static void printHelpMainPage(Player player) {
|
||||||
player.sendMessage("§7---===( §eSchematicSystem Hilfe §7)===---");
|
player.sendMessage("§e§lSchematicSystem §8§lHilfe");
|
||||||
player.sendMessage("§eKategorien: ");
|
player.sendMessage("§7Kategorien§8:");
|
||||||
for (HelpPage page : HelpPage.values()) {
|
for (HelpPage page : HelpPage.values()) {
|
||||||
TextComponent pageComp = new TextComponent(page.mainText);
|
TextComponent pageComp = new TextComponent(page.mainText);
|
||||||
pageComp.setColor(ChatColor.GRAY);
|
pageComp.setColor(ChatColor.GRAY);
|
||||||
@ -43,7 +43,7 @@ public class SchematicCommandHelp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void printHelpPage(Player player, HelpPage page) {
|
public static void printHelpPage(Player player, HelpPage page) {
|
||||||
player.sendMessage("§7---===( §eSchematicSystem Hilfe §7)===---");
|
player.sendMessage("§e§lSchematicSystem §8§lHilfe");
|
||||||
for (String s : page.content) {
|
for (String s : page.content) {
|
||||||
player.sendMessage(s);
|
player.sendMessage(s);
|
||||||
}
|
}
|
||||||
@ -51,28 +51,28 @@ public class SchematicCommandHelp {
|
|||||||
|
|
||||||
public enum HelpPage {
|
public enum HelpPage {
|
||||||
|
|
||||||
ANSICHT("Ansichtbefehle", "Schaue dir deine oder dir Freigegebene Schematics an", new String[]{
|
ANSICHT("Ansichtbefehle", "Suche oder lade Schematics", new String[]{
|
||||||
"§8/§eschem info §8[§7Schematic§8] - §7Zeigt dir Informationen zur Schematic",
|
"§8/§7schem §einfo §8[§7Schematic§8] - §7Zeigt dir Informationen zur Schematic",
|
||||||
"§8/§eschem list §8- §7Zeigt dir deine Schematics an",
|
"§8/§7schem §elist §8- §7Zeigt dir deine Schematics an",
|
||||||
"§8/§eschem list public §8- §7Zeigt alle Public-Schematics",
|
"§8/§7schem §elist public §8- §7Zeigt alle Public-Schematics",
|
||||||
"§8/§eschem search §8[§7Stichwort§8] - §7Sucht nach passenden Schematics",
|
"§8/§7schem §esearch §8[§7Stichwort§8] - §7Sucht nach passenden Schematics",
|
||||||
"§8/§eschem load §8[§7Schematic§8] - §7Lädt eine Schematic",
|
"§8/§7schem §eload §8[§7Schematic§8] - §7Lädt eine Schematic",
|
||||||
"§8/§eschem download §8[§7Schematic§8] - §7Gibt dir einen Downloadlink (1 min gültig)"
|
"§8/§7schem §edownload §8[§7Schematic§8] - §7Gibt dir einen Downloadlink (1 min gültig)"
|
||||||
}),
|
}),
|
||||||
BEARBEITUNG("Bearbeitungsbefehle", "Modifizierung von Schematics und Ordnern", new String[]{
|
BEARBEITUNG("Bearbeitungsbefehle", "Modifizierung von Schematics und Ordnern", new String[]{
|
||||||
"§8/§eschem save §8[§7Schematic§8] - §7Speichert dein Clipboard als Schematic",
|
"§8/§7schem §esave §8[§7Schematic§8] - §7Speichert dein Clipboard als Schematic",
|
||||||
"§8/§eschem ordner §8[§7Ordner§8] - §7Erstelle einen Leeren Ordner",
|
"§8/§7schem §eordner §8[§7Ordner§8] - §7Erstelle einen leeren Ordner",
|
||||||
"§8/§eschem move §8[§7Schematic§8] [§7Neuer Pfad§8] - §7Verschiebe eine Schematic",
|
"§8/§7schem §emove §8[§7Schematic§8] [§7Neuer Pfad§8] - §7Verschiebe eine Schematic",
|
||||||
"§8/§eschem rename §8[§7Schematic§8] [§7Neuer Name§8] - §7Gib der Schematic einen neuen Namen",
|
"§8/§7schem §erename §8[§7Schematic§8] [§7Neuer Name§8] - §7Gib der Schematic einen neuen Namen",
|
||||||
"§8/§eschem changetype §8[§7Schematic§8] - §7Ändert die Art deiner Schematic",
|
"§8/§7schem §echangetype §8[§7Schematic§8] - §7Ändert die Art deiner Schematic",
|
||||||
"§8/§eschem delete §8[§7Schematic§8] - §7Löscht eine Schematic"
|
"§8/§7schem §edelete §8[§7Schematic§8] - §7Löscht eine Schematic"
|
||||||
}),
|
}),
|
||||||
MEMBER("Memberbefehle", "Schematics mit anderen teilen", new String[]{
|
MEMBER("Memberbefehle", "Schematics mit anderen teilen", new String[]{
|
||||||
"§8/§eschem addmember §8[§7Schematic§8] §8[§7Spieler§8] - §7Fügt einen Spieler zu einer Schematic hinzu",
|
"§8/§7schem §eaddmember §8[§7Schematic§8] §8[§7Spieler§8] - §7Fügt einen Spieler zu einer Schematic hinzu",
|
||||||
"§8/§eschem delmember §8[§7Schematic§8] §8[§7Spieler§8] - §7Entfernt einen Spieler von einer Schematic",
|
"§8/§7schem §edelmember §8[§7Schematic§8] §8[§7Spieler§8] - §7Entfernt einen Spieler von einer Schematic",
|
||||||
"§8/§eschem clearmember §8[§7Schematic§8] - §7Entfernt alle Spieler von der Schematic",
|
"§8/§7schem §eclearmember §8[§7Schematic§8] - §7Entfernt alle Spieler von der Schematic",
|
||||||
"§8/§eschem addteam §8[§7Schematic§8] - §7Füge jeden aus deinem Team auf die Schematic hinzu",
|
"§8/§7schem §eaddteam §8[§7Schematic§8] - §7Füge jeden aus deinem Team auf die Schematic hinzu",
|
||||||
"§8/§eschem remteam §8[§7Schematic§8] - §7Entferne jeden aus deinem Team von der Schematic"
|
"§8/§7schem §eremteam §8[§7Schematic§8] - §7Entferne jeden aus deinem Team von der Schematic"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,6 +19,11 @@
|
|||||||
|
|
||||||
package de.steamwar.schematicsystem.commands;
|
package de.steamwar.schematicsystem.commands;
|
||||||
|
|
||||||
|
import de.steamwar.comms.packets.PrepareSchemPacket;
|
||||||
|
import de.steamwar.inventory.SWInventory;
|
||||||
|
import de.steamwar.inventory.SWItem;
|
||||||
|
import de.steamwar.schematicsystem.AutoCheckResult;
|
||||||
|
import de.steamwar.schematicsystem.CheckSchemType;
|
||||||
import de.steamwar.schematicsystem.SchematicSystem;
|
import de.steamwar.schematicsystem.SchematicSystem;
|
||||||
import de.steamwar.sql.*;
|
import de.steamwar.sql.*;
|
||||||
import net.md_5.bungee.api.ChatColor;
|
import net.md_5.bungee.api.ChatColor;
|
||||||
@ -26,10 +31,12 @@ import net.md_5.bungee.api.chat.ClickEvent;
|
|||||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||||
import net.md_5.bungee.api.chat.HoverEvent;
|
import net.md_5.bungee.api.chat.HoverEvent;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class SchematicCommandUtils {
|
public class SchematicCommandUtils {
|
||||||
@ -66,7 +73,7 @@ public class SchematicCommandUtils {
|
|||||||
SteamwarUser user = getUser(player);
|
SteamwarUser user = getUser(player);
|
||||||
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("§eSchematics §8(§e" + nodes.size() + "§8)");
|
||||||
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../");
|
||||||
@ -82,7 +89,7 @@ public class SchematicCommandUtils {
|
|||||||
StringBuilder nodeString = new StringBuilder();
|
StringBuilder nodeString = new StringBuilder();
|
||||||
|
|
||||||
if (node.isDir()) {
|
if (node.isDir()) {
|
||||||
nodeString.append("§9DIR §e");
|
nodeString.append("§7§lDIR §e");
|
||||||
} else {
|
} else {
|
||||||
SchematicType type = node.getSchemtype();
|
SchematicType type = node.getSchemtype();
|
||||||
if (type != SchematicType.Normal) {
|
if (type != SchematicType.Normal) {
|
||||||
@ -148,12 +155,12 @@ public class SchematicCommandUtils {
|
|||||||
|
|
||||||
public static void printSchemInfo(Player player, SchematicNode node) {
|
public static void printSchemInfo(Player player, SchematicNode node) {
|
||||||
SteamwarUser user = getUser(player);
|
SteamwarUser user = getUser(player);
|
||||||
player.sendMessage("§7--==( §e" + node.getName() + " §7)==--");
|
player.sendMessage("§7Schematic: §e" + node.getName());
|
||||||
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() ? "§7DIR" : 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());
|
||||||
@ -278,4 +285,93 @@ public class SchematicCommandUtils {
|
|||||||
public static void turnOffPublic(Player player) {
|
public static void turnOffPublic(Player player) {
|
||||||
PUBLIC_TOGGLED.remove(player);
|
PUBLIC_TOGGLED.remove(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void loadSchem(Player player, SchematicNode node) {
|
||||||
|
if (node.isDir()) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst keine Ordner Laden");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
node.loadToPlayer(player);
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§7Schematic §e" + node.getName() + " §7geladen!");
|
||||||
|
Bukkit.getLogger().log(Level.INFO, "{0} has loaded Schematic {1} {2}", new Object[]{player.getName(), node.getId(), node.getName()});
|
||||||
|
} catch (NoClipboardException e) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cEs konnte keine Daten in der Schematic gefunden werden.");
|
||||||
|
} catch (Exception e) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDie Schematic konnte nicht geladen werden.");
|
||||||
|
throw new SecurityException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void download(Player player, SchematicNode node) {
|
||||||
|
SteamwarUser user = getUser(player);
|
||||||
|
if (node.getOwner() != user.getId()) {
|
||||||
|
player.sendMessage("§cDu darfst nur deine eigenen Schematics herunterladen!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "Dein Download Link:");
|
||||||
|
player.sendMessage(NodeDownload.getLink(node));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void changeType(Player player, SchematicNode node, SchematicType type, SchematicCommand.Extend extend) {
|
||||||
|
SteamwarUser user = getUser(player);
|
||||||
|
if (node.getOwner() != user.getId()) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst nur deine eigenen Schematics einsenden.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (node.isDir()) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cOrdner haben keinen Typen.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (node.getType().equals(type.toDB())) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDie Schematic hat schon diesen Typen");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type.writeable()) {
|
||||||
|
node.setSchemtype(type);
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§aSchematictyp geändert");
|
||||||
|
} else if (type.fightType()) {
|
||||||
|
if (node.getSchemtype().check()) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDu hast diese Schematic bereits eingesendet");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
AutoCheckResult result = CheckSchemType.get(type).autoCheck(node);
|
||||||
|
Collection<String> errors = result.errors();
|
||||||
|
for (String warning : result.warnings()) {
|
||||||
|
player.sendMessage(" §e" + warning);
|
||||||
|
}
|
||||||
|
for (String error : errors) {
|
||||||
|
player.sendMessage(" §c" + error);
|
||||||
|
}
|
||||||
|
if (!errors.isEmpty()) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDie Schematic ist nicht regelkonform");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (extend == null) {
|
||||||
|
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.setSchemtype(type.checkType());
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§aDie Schematic wird zeitnah überprüft");
|
||||||
|
player.closeInventory();
|
||||||
|
});
|
||||||
|
inv.setCallback(-999, click -> player.closeInventory());
|
||||||
|
inv.open();
|
||||||
|
} else if (extend == SchematicCommand.Extend.AUSFAHREN) {
|
||||||
|
new PrepareSchemPacket(SteamwarUser.get(player.getUniqueId()), node, type).send(player);
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§aDer Vorbereitungsserver wird gestartet");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
59
SchematicSystem_Main/pom.xml
Normale Datei
59
SchematicSystem_Main/pom.xml
Normale Datei
@ -0,0 +1,59 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>steamwar</groupId>
|
||||||
|
<artifactId>SchematicSystem</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<main.basedir>${project.basedir}/..</main.basedir>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<artifactId>SchematicSystem_Main</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.2.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
<finalName>schematicsystem</finalName>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>steamwar</groupId>
|
||||||
|
<artifactId>SchematicSystem_15</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>steamwar</groupId>
|
||||||
|
<artifactId>SchematicSystem_8</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>steamwar</groupId>
|
||||||
|
<artifactId>SchematicSystem_Core</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
2
pom.xml
2
pom.xml
@ -16,6 +16,7 @@
|
|||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<defaultGoal>clean package</defaultGoal>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
@ -32,6 +33,7 @@
|
|||||||
<modules>
|
<modules>
|
||||||
<module>SchematicSystem_8</module>
|
<module>SchematicSystem_8</module>
|
||||||
<module>SchematicSystem_15</module>
|
<module>SchematicSystem_15</module>
|
||||||
|
<module>SchematicSystem_Main</module>
|
||||||
<module>SchematicSystem_Core</module>
|
<module>SchematicSystem_Core</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
§7Ordnereigenschaften