Commits vergleichen
1 Commits
Autor | SHA1 | Datum | |
---|---|---|---|
2f0da48707 |
@ -19,8 +19,6 @@
|
|||||||
|
|
||||||
package de.steamwar.schematicsystem;
|
package de.steamwar.schematicsystem;
|
||||||
|
|
||||||
import de.steamwar.core.Core;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class AutoCheckResult {
|
public class AutoCheckResult {
|
||||||
@ -28,7 +26,6 @@ public class AutoCheckResult {
|
|||||||
private final ICheckSchemType type;
|
private final ICheckSchemType type;
|
||||||
|
|
||||||
private final boolean noChecksInThisVersion;
|
private final boolean noChecksInThisVersion;
|
||||||
private boolean wrongVersionException = false; // Schematic nicht in der Version ladbar
|
|
||||||
private boolean errorLoadingSchematic = false; // Schematic irgendwie invalide
|
private boolean errorLoadingSchematic = false; // Schematic irgendwie invalide
|
||||||
|
|
||||||
private int width = 0;
|
private int width = 0;
|
||||||
@ -40,12 +37,12 @@ public class AutoCheckResult {
|
|||||||
private int dispenser = 0;
|
private int dispenser = 0;
|
||||||
private int blocks = 0;
|
private int blocks = 0;
|
||||||
|
|
||||||
private Map<String, Integer> forbiddenMaterials = new HashMap<>(); // Anzahl verbotener Blöcke nach Material
|
private final Map<String, Integer> forbiddenMaterials = new HashMap<>(); // Anzahl verbotener Blöcke nach Material
|
||||||
|
|
||||||
private Map<String, Integer> defunctNbt = new HashMap<>(); // Anzahl an defekten NBT-Blöcken nach Materialname
|
private final Map<String, Integer> defunctNbt = new HashMap<>(); // Anzahl an defekten NBT-Blöcken nach Materialname
|
||||||
private int records = 0; // Gefundene Schallplatten
|
private int records = 0; // Gefundene Schallplatten
|
||||||
private Map<String, Map<String, Integer>> forbiddenItems = new HashMap<>(); // Anzahl verbotener Items nach Inventartyp
|
private final Map<String, Map<String, Integer>> forbiddenItems = new HashMap<>(); // Anzahl verbotener Items nach Inventartyp
|
||||||
private Map<String, Map<String, Integer>> itemsWithTag = new HashMap<>(); // Anzahl an Items mit Tag nach Inventartyp
|
private final Map<String, Map<String, Integer>> itemsWithTag = new HashMap<>(); // Anzahl an Items mit Tag nach Inventartyp
|
||||||
private int tooManyDispenserItems = 0; // Gefundene Überschreitungen von DispenserItems
|
private int tooManyDispenserItems = 0; // Gefundene Überschreitungen von DispenserItems
|
||||||
|
|
||||||
AutoCheckResult(ICheckSchemType type){
|
AutoCheckResult(ICheckSchemType type){
|
||||||
@ -58,71 +55,6 @@ public class AutoCheckResult {
|
|||||||
noChecksInThisVersion = true;
|
noChecksInThisVersion = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<String> errors(){
|
|
||||||
List<String> errors = new LinkedList<>();
|
|
||||||
|
|
||||||
if(noChecksInThisVersion){
|
|
||||||
errors.add("In der 1." + Core.getVersion() + " können keine Schematics eingesendet werden");
|
|
||||||
return errors;
|
|
||||||
}
|
|
||||||
if(wrongVersionException)
|
|
||||||
errors.add("Diese Schematic kann nicht in dieser Version geändert werden");
|
|
||||||
if(errorLoadingSchematic)
|
|
||||||
errors.add("Die Schematic konnte nicht geladen werden");
|
|
||||||
|
|
||||||
assert type != null;
|
|
||||||
if(width > type.getDepth())
|
|
||||||
errors.add("Die Schematic ist zu breit (" + width + " > " + type.getDepth() + ")");
|
|
||||||
if(length > type.getWidth())
|
|
||||||
errors.add("Die Schematic ist zu lang (" + length + " > " + type.getWidth() + ")");
|
|
||||||
if(height > type.getHeight())
|
|
||||||
errors.add("Die Schematic ist zu hoch (" + height + " > " + type.getHeight() + ")");
|
|
||||||
|
|
||||||
int errorTNTSlime = slime + tnt;
|
|
||||||
if(type.getMaxTNT() != 0 && tnt > type.getMaxTNT())
|
|
||||||
errors.add("Zu viele TNT-Blöcke (" + tnt + " > " + type.getMaxTNT() + ")");
|
|
||||||
if(type.getMaxSlime() != 0 && slime > type.getMaxSlime())
|
|
||||||
errors.add("Zu viele Schleim/Honig-Blöcke (" + slime + " > " + type.getMaxSlime() + ")");
|
|
||||||
if(type.getMaxDispenser() != 0 && dispenser > type.getMaxDispenser())
|
|
||||||
errors.add("Zu viele Werfer (" + dispenser + " > " + type.getMaxDispenser() + ")");
|
|
||||||
if(type.getMaxTNTSlime() != 0 && errorTNTSlime > type.getMaxTNTSlime())
|
|
||||||
errors.add("Zu viel Schleim+TNT" + errorTNTSlime + " > " + type.getMaxTNTSlime() + ")");
|
|
||||||
if(type.getMaxBlocks() != 0 && blocks > type.getMaxBlocks()) {
|
|
||||||
errors.add("Zu viele Blöcke (" + blocks + " > " + type.getMaxBlocks() + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
for(Map.Entry<String, Integer> block : forbiddenMaterials.entrySet())
|
|
||||||
errors.add("Der Block " + block.getKey() + " ist verboten (" + block.getValue() + " verbaut)");
|
|
||||||
|
|
||||||
if(records > 0)
|
|
||||||
errors.add("Keine Schallplatten erlaubt (" + records + " gefunden)");
|
|
||||||
for(Map.Entry<String, Map<String, Integer>> block : forbiddenItems.entrySet())
|
|
||||||
for(Map.Entry<String, Integer> item : block.getValue().entrySet())
|
|
||||||
errors.add("In " + block.getKey() + "s wurde das verbotene Item " + item.getKey() + " " + item.getValue() + " mal gefunden");
|
|
||||||
for(Map.Entry<String, Map<String, Integer>> block : itemsWithTag.entrySet())
|
|
||||||
for(Map.Entry<String, Integer> item : block.getValue().entrySet())
|
|
||||||
errors.add("In " + block.getKey() + "s wurde das Item " + item.getKey() + " " + item.getValue() + " mal mit Custom-Tag gefunden");
|
|
||||||
if(tooManyDispenserItems == 1)
|
|
||||||
errors.add("Ein Werfer enthält mehr als " + type.getMaxDispenserItems() + " Pfeile und Feuerbälle");
|
|
||||||
else if(tooManyDispenserItems > 1)
|
|
||||||
errors.add(tooManyDispenserItems + " Werfer enthalten mehr als " + type.getMaxDispenserItems() + " Pfeile und Feuerbälle");
|
|
||||||
|
|
||||||
return errors;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<String> warnings(){
|
|
||||||
List<String> warnings = new LinkedList<>();
|
|
||||||
|
|
||||||
for(Map.Entry<String, Integer> nbtBlock : defunctNbt.entrySet()){
|
|
||||||
if(nbtBlock.getValue() > 1)
|
|
||||||
warnings.add(nbtBlock.getValue() + " " + nbtBlock.getKey() + "s enthalten keine oder inkorrekte NBT-Daten");
|
|
||||||
else
|
|
||||||
warnings.add("Ein(e) " + nbtBlock.getKey() + " enthält keine oder inkorrekte NBT-Daten");
|
|
||||||
}
|
|
||||||
|
|
||||||
return warnings;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setErrorLoadingSchematic(){
|
void setErrorLoadingSchematic(){
|
||||||
errorLoadingSchematic = true;
|
errorLoadingSchematic = true;
|
||||||
}
|
}
|
||||||
@ -183,4 +115,68 @@ public class AutoCheckResult {
|
|||||||
if(counter > type.getMaxDispenserItems())
|
if(counter > type.getMaxDispenserItems())
|
||||||
tooManyDispenserItems++;
|
tooManyDispenserItems++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean noChecksInThisVersion() {
|
||||||
|
return noChecksInThisVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean errorLoadingSchematic() {
|
||||||
|
return errorLoadingSchematic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWidth() {
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHeight() {
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLength() {
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTnt() {
|
||||||
|
return tnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSlime() {
|
||||||
|
return slime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTntSlime() {
|
||||||
|
return slime + tnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDispenser() {
|
||||||
|
return dispenser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBlocks() {
|
||||||
|
return blocks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Integer> getForbiddenMaterials() {
|
||||||
|
return forbiddenMaterials;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Integer> getDefunctNbt() {
|
||||||
|
return defunctNbt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRecords() {
|
||||||
|
return records;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Map<String, Integer>> getForbiddenItems() {
|
||||||
|
return forbiddenItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Map<String, Integer>> getItemsWithTag() {
|
||||||
|
return itemsWithTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTooManyDispenserItems() {
|
||||||
|
return tooManyDispenserItems;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.schematicsystem;
|
package de.steamwar.schematicsystem;
|
||||||
|
|
||||||
|
import de.steamwar.message.Message;
|
||||||
import de.steamwar.schematicsystem.commands.SchematicCommand;
|
import de.steamwar.schematicsystem.commands.SchematicCommand;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
@ -27,7 +28,7 @@ import java.io.File;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class SchematicSystem extends JavaPlugin {
|
public class SchematicSystem extends JavaPlugin {
|
||||||
public static final String PREFIX = "§eSchematic§8» §7";
|
public static Message MESSAGE;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
@ -36,6 +37,7 @@ public class SchematicSystem extends JavaPlugin {
|
|||||||
Bukkit.getLogger().log(Level.SEVERE, "config.yml erstellt und geladen!");
|
Bukkit.getLogger().log(Level.SEVERE, "config.yml erstellt und geladen!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MESSAGE = new Message("de.steamwar.SchematicSystem", getClassLoader());
|
||||||
CheckSchemType.init(getConfig());
|
CheckSchemType.init(getConfig());
|
||||||
getCommand("schem").setExecutor(new SchematicCommand());
|
getCommand("schem").setExecutor(new SchematicCommand());
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,107 @@
|
|||||||
|
PREFIX=§eSchematic§8»
|
||||||
|
|
||||||
|
HELP=§8/§eschem gui §8- §7Öffnet die Schematic-GUI\
|
||||||
|
§8/§eschem list §8- §7Zeigt dir deine Schematics an\
|
||||||
|
§8/§eschem list public §8- §7Zeigt alle Public-Schematics\
|
||||||
|
§8/§eschem search §8[§7Stichwort§8] - §7Sucht nach passenden Schematics\
|
||||||
|
§8/§eschem load §8[§7Schematic§8] - §7Lädt eine Schematic\
|
||||||
|
§8/§eschem save §8[§7Schematic§8] - §7Speichert dein Clipboard als Schematic\
|
||||||
|
§8/§eschem changetype §8[§7Schematic§8] - §7Ändert die Art deiner Schematic\
|
||||||
|
§8/§eschem delete §8[§7Schematic§8] - §7Löscht eine Schematic\
|
||||||
|
§8/§eschem info §8[§7Schematic§8] - §7Zeigt dir Informationen zur Schematic\
|
||||||
|
§8/§eschem download §8[§7Schematic§8] - §7Gibt dir einen Downloadlink (1 min gültig)\
|
||||||
|
§8/§eschem addmember §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
|
||||||
|
|
||||||
|
INVALID_PAGE=§cUngültige Seitenzahl
|
||||||
|
INVALID_SCHEMNAME=§cDer angegebene Schematicname enthält verbotene Zeichen
|
||||||
|
UNKNOWN_SCHEM=§cDie angegebene Schematic existiert nicht
|
||||||
|
UNKNOWN_USER=§cUnbekannter Spieler
|
||||||
|
|
||||||
|
CHANGETYPE_INVALID_TYPE=§cDiesen Schematictypen gibt es nicht
|
||||||
|
CHANGETYPE_ALREADY=§cDie Schematic hat bereits diesen Typen
|
||||||
|
CHANGETYPE_CHANGED=§aSchematictyp geändert
|
||||||
|
CHANGETYPE_PENDING=§cDu hast diese Schematic bereits eingesendet
|
||||||
|
CHANGETYPE_REJECT=§cDie Schematic ist nicht regelkonform
|
||||||
|
CHANGETYPE_ACCEPT=§aDie Schematic wird zeitnah überprüft
|
||||||
|
|
||||||
|
LOAD_LOADED=§7Schematic §e{0} §7geladen
|
||||||
|
LOAD_FAILED=§cFehler beim Laden der Schematic. Dies liegt wahrscheinlich an einer defekten Schematic.
|
||||||
|
|
||||||
|
SAVE_NAME_TOO_LONG=§cDer Name der Schematic ist zu lang
|
||||||
|
SAVE_NO_OVERRIDE=§cDu darfst diese Schematic nicht überschreiben
|
||||||
|
SAVE_EMPTY=§cDein Clipboard ist leer
|
||||||
|
SAVE_FAILED=§cFehler beim Speichern der Schematic
|
||||||
|
SAVE_SAVED=§7Schematic §e{0} §7gespeichert
|
||||||
|
SAVE_OVERRIDE=§7Schematic §e{0} §7überschrieben
|
||||||
|
|
||||||
|
INFO_NAME=§7Name§8: §e{0}
|
||||||
|
INFO_TYPE=§7Typ§8: §e{0}
|
||||||
|
INFO_TYPE_HOVER=§eTyp ändern
|
||||||
|
INFO_RANK=§7Rang§8: §7{0}
|
||||||
|
INFO_DOWNLOAD=§7Download Schematic
|
||||||
|
INFO_DOWNLOAD_HOVER=§eGeneriere Downloadlink
|
||||||
|
INFO_STATUS=§7Status§8: §7{0} §e{1}
|
||||||
|
INFO_OWNER=§7Besitzer§8: §e{0}
|
||||||
|
INFO_MEMBER=§7Mitglieder§8: §e{0}
|
||||||
|
|
||||||
|
DOWNLOAD_ONLY_OWN=§cDu darfst nur deine eigenen Schematics herunterladen!
|
||||||
|
|
||||||
|
MEMBER_ON_OWN=§cAlso bitte: Das ist deine eigene Schematic!
|
||||||
|
ADDMEMBER_ONLY_OWN=§cDu darfst nur auf deine eigene Schematic Mitglieder hinzufügen
|
||||||
|
ADDMEMBER_ALREADY=§cDieser Spieler ist bereits auf diese Schematic geaddet
|
||||||
|
ADDMEMBER_ADDED=§7Der Spieler §e{0} §7hat nun Zugriff auf die Schematic §e{1}
|
||||||
|
ADDMEMBER_ACCESS=§7Du hast nun Zugriff auf die Schematic §e{0} §7von §e{1}
|
||||||
|
|
||||||
|
DELMEMBER_ONLY_OWN=§cDu darfst nur von deinen eigenen Schematics Mitglieder entfernen
|
||||||
|
DELMEMBER_NOT_ADDED=§cDieser Spieler ist nicht auf die Schematic hinzugefügt
|
||||||
|
DELMEMBER_REMOVED=§7Der Spieler §e{0} §7hat keinen Zugriff mehr auf die Schematic §e{1}
|
||||||
|
DELMEMBER_REVOKED=§7Du hast keinen Zugriff mehr auf die Schematic §e{0} §7von §e{1}
|
||||||
|
|
||||||
|
LIST_NO_SCHEMS=§cKeine Schematics gefunden
|
||||||
|
LIST_HEADER=§eSeite {0}§8/{1} §8| §e{2} Schematics
|
||||||
|
LIST_INFO=§e{0} §7§l{1}{2}
|
||||||
|
LIST_INFO_BY=§8von §7{0}
|
||||||
|
LIST_INFO_HOVER=§eSchematic verwalten
|
||||||
|
LIST_PREVIOUS=««
|
||||||
|
LIST_PREVIOUS_HOVER=§eVorherige Seite
|
||||||
|
LIST_NEXT= Seite »»
|
||||||
|
LIST_NEXT_HOVER=§eNächste Seite
|
||||||
|
|
||||||
|
GUI_CHANGETYPE=Typ ändern
|
||||||
|
|
||||||
|
GUI_ABORT=§cAbbruch
|
||||||
|
GUI_DELETEOWN={0} löschen
|
||||||
|
GUI_DELETEOWN_DELETE=§eLöschen
|
||||||
|
GUI_DELETEOWN_DELETED=§7Schematic §e{0} §7gelöscht
|
||||||
|
|
||||||
|
GUI_DELETEMEMBER={0} entfernen
|
||||||
|
GUI_DELETEMEMBER_DELETE=§eZugriff entfernen
|
||||||
|
GUI_DELETEMEMBER_REMOVED=§7Zugriff zu Schematic §e{0} §7entfernt
|
||||||
|
|
||||||
|
GUI_DELMEMBER=Mitglieder entfernen
|
||||||
|
|
||||||
|
GUI_CHANGEITEM=Item ändern
|
||||||
|
|
||||||
|
GUI_INFO_LOAD=§eLaden
|
||||||
|
|
||||||
|
#Autochecker
|
||||||
|
AUTO_ERR_VERSION= §cIn der 1.{0} können keine Schematics eingesendet werden
|
||||||
|
AUTO_ERR_LOADING= §cDie Schematic konnte nicht geladen werden
|
||||||
|
AUTO_ERR_WIDTH= §cDie Schematic ist zu breit ({0} > {1})
|
||||||
|
AUTO_ERR_LENGTH= §cDie Schematic ist zu lang ({0} > {1})
|
||||||
|
AUTO_ERR_HEIGHT= §cDie Schematic ist zu hoch ({0} > {1})
|
||||||
|
AUTO_ERR_TNT= §cZu viele TNT-Blöcke ({0} > {1})
|
||||||
|
AUTO_ERR_SLIME= §cZu viele Schleim+Honig-Blöcke ({0} > {1})
|
||||||
|
AUTO_ERR_DISPENSER= §cZu viele Werfer ({0} > {1})
|
||||||
|
AUTO_ERR_TNTSLIME= §cZu viel Schleim+Honig+TNT ({0} > {1})
|
||||||
|
AUTO_ERR_MAXBLOCKS= §cZu viele Blöcke ({0} > {1})
|
||||||
|
AUTO_ERR_BLOCK= §cDer Block {0} ist verboten ({1} verbaut)
|
||||||
|
AUTO_ERR_RECORDS= §cKeine Schallplatten erlaubt ({0} gefunden)
|
||||||
|
AUTO_ERR_SING_DISPENSER_ITEMS= §cEin Werfer enthält mehr als {0} Pfeile und Feuerbälle
|
||||||
|
AUTO_ERR_PLUR_DISPENSER_ITEMS= §c{0} Werfer enthalten mehr als {1} Pfeile und Feuerbälle
|
||||||
|
AUTO_ERR_ITEMS= §cIn {0}s wurde das verbotene Item {1} {2} mal gefunden
|
||||||
|
AUTO_ERR_TAG= §cIn {0}s wurde das Item {1} {2} mal mit Custom-Tag gefunden
|
||||||
|
|
||||||
|
AUTO_WARN_SING_NBT= §eEin(e) {0} enthält keine oder möglicherweise inkorrekte NBT-Daten
|
||||||
|
AUTO_WARN_PLUR_NBT= §e{0} {1}s enthalten keine oder möglicherweise inkorrekte NBT-Daten
|
@ -48,7 +48,7 @@ class GUI {
|
|||||||
types.add(new SWListInv.SWListEntry<>(item, type));
|
types.add(new SWListInv.SWListEntry<>(item, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
SWListInv<SchematicType> inv = new SWListInv<>(p, "Typ ändern", types, (clickType, schematicType) -> {
|
SWListInv<SchematicType> inv = new SWListInv<>(p, SchematicSystem.MESSAGE.parse("GUI_CHANGETYPE", p), types, (clickType, schematicType) -> {
|
||||||
SchematicCommand.changetype(p, schem, schematicType);
|
SchematicCommand.changetype(p, schem, schematicType);
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
});
|
});
|
||||||
@ -57,8 +57,8 @@ class GUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void deleteOwn(Player p, Schematic schem){
|
private static void deleteOwn(Player p, Schematic schem){
|
||||||
SWInventory inv = new SWInventory(p, 9, schem.getSchemName() + " löschen");
|
SWInventory inv = new SWInventory(p, 9, SchematicSystem.MESSAGE.parse("GUI_DELETEOWN", p, schem.getSchemName()));
|
||||||
inv.setItem(0, SWItem.getDye(1), (byte) 1, "§eLöschen", click -> {
|
inv.setItem(0, SWItem.getDye(1), (byte) 1, SchematicSystem.MESSAGE.parse("GUI_DELETEOWN_DELETE", p), click -> {
|
||||||
schem.remove();
|
schem.remove();
|
||||||
|
|
||||||
List<CheckedSchematic> checkedSchematics = CheckedSchematic.getLastDeclined(p.getUniqueId());
|
List<CheckedSchematic> checkedSchematics = CheckedSchematic.getLastDeclined(p.getUniqueId());
|
||||||
@ -67,24 +67,24 @@ class GUI {
|
|||||||
checkedSchematic.getSchemName().equals(schem.getSchemName()))
|
checkedSchematic.getSchemName().equals(schem.getSchemName()))
|
||||||
checkedSchematic.remove();
|
checkedSchematic.remove();
|
||||||
}
|
}
|
||||||
p.sendMessage(SchematicSystem.PREFIX + "Schematic §e" + schem.getSchemName() + " §7gelöscht");
|
SchematicSystem.MESSAGE.send("GUI_DELETEOWN_DELETED", p, schem.getSchemName());
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
});
|
});
|
||||||
inv.setItem(8, SWItem.getDye(14), (byte) 14, "§cAbbruch", click -> p.closeInventory());
|
inv.setItem(8, SWItem.getDye(14), (byte) 14, SchematicSystem.MESSAGE.parse("GUI_ABORT", p), click -> p.closeInventory());
|
||||||
inv.setCallback(-999, click -> p.closeInventory());
|
inv.setCallback(-999, click -> p.closeInventory());
|
||||||
inv.open();
|
inv.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void deleteMembership(Player p, Schematic schem){
|
private static void deleteMembership(Player p, Schematic schem){
|
||||||
SWInventory inv = new SWInventory(p, 9, schem.getSchemName() + " entfernen");
|
SWInventory inv = new SWInventory(p, 9, SchematicSystem.MESSAGE.parse("GUI_DELETEMEMBER", p, schem.getSchemName()));
|
||||||
inv.setItem(0, SWItem.getDye(1), (byte) 1, "§eZugriff entfernen", click -> {
|
inv.setItem(0, SWItem.getDye(1), (byte) 1, SchematicSystem.MESSAGE.parse("GUI_DELETEMEMBER_DELETE", p), click -> {
|
||||||
SchematicMember member = SchematicMember.getSchemMemberFromDB(schem.getSchemName(), schem.getSchemOwner(), SteamwarUser.get(p.getUniqueId()).getId());
|
SchematicMember member = SchematicMember.getSchemMemberFromDB(schem.getSchemName(), schem.getSchemOwner(), SteamwarUser.get(p.getUniqueId()).getId());
|
||||||
if(member != null)
|
if(member != null)
|
||||||
member.remove();
|
member.remove();
|
||||||
p.sendMessage(SchematicSystem.PREFIX + "Zugriff zu Schematic §e" + schem.getSchemName() + " §7entfernt");
|
SchematicSystem.MESSAGE.send("GUI_DELETEMEMBER_REMOVED", p, schem.getSchemName());
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
});
|
});
|
||||||
inv.setItem(8, SWItem.getDye(14), (byte) 14, "§cAbbruch", click -> p.closeInventory());
|
inv.setItem(8, SWItem.getDye(14), (byte) 14, SchematicSystem.MESSAGE.parse("GUI_ABORT", p), click -> p.closeInventory());
|
||||||
inv.setCallback(-999, click -> p.closeInventory());
|
inv.setCallback(-999, click -> p.closeInventory());
|
||||||
inv.open();
|
inv.open();
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ class GUI {
|
|||||||
members.add(new SWListInv.SWListEntry<>(SWItem.getPlayerSkull(user.getUserName()), member));
|
members.add(new SWListInv.SWListEntry<>(SWItem.getPlayerSkull(user.getUserName()), member));
|
||||||
}
|
}
|
||||||
|
|
||||||
SWListInv<SchematicMember> inv = new SWListInv<>(p, "Mitglieder entfernen", members, (clickType, member) -> {
|
SWListInv<SchematicMember> inv = new SWListInv<>(p, SchematicSystem.MESSAGE.parse("GUI_DELMEMBER", p), members, (clickType, member) -> {
|
||||||
member.remove();
|
member.remove();
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
delmembers(p, schem);
|
delmembers(p, schem);
|
||||||
@ -120,7 +120,7 @@ class GUI {
|
|||||||
materials.add(new SWListInv.SWListEntry<>(item, material));
|
materials.add(new SWListInv.SWListEntry<>(item, material));
|
||||||
}
|
}
|
||||||
|
|
||||||
SWListInv<Material> inv = new SWListInv<>(p, "Item ändern", materials, (clickType, material) -> {
|
SWListInv<Material> inv = new SWListInv<>(p, SchematicSystem.MESSAGE.parse("GUI_CHANGEITEM", p), materials, (clickType, material) -> {
|
||||||
schem.setItem(material.name());
|
schem.setItem(material.name());
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
info(p, schem);
|
info(p, schem);
|
||||||
|
@ -19,13 +19,13 @@
|
|||||||
|
|
||||||
package de.steamwar.schematicsystem.commands;
|
package de.steamwar.schematicsystem.commands;
|
||||||
|
|
||||||
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.schematicsystem.AutoCheckResult;
|
import de.steamwar.schematicsystem.AutoCheckResult;
|
||||||
import de.steamwar.schematicsystem.CheckSchemType;
|
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;
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
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.Bukkit;
|
||||||
@ -35,8 +35,8 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class SchematicCommand implements CommandExecutor {
|
public class SchematicCommand implements CommandExecutor {
|
||||||
@ -109,7 +109,7 @@ public class SchematicCommand implements CommandExecutor {
|
|||||||
try {
|
try {
|
||||||
sendPlayerSchematicList(Integer.parseInt(args[2]), player, "/schem list public ", Schematic.getSchemsAccessibleByUser(0));
|
sendPlayerSchematicList(Integer.parseInt(args[2]), player, "/schem list public ", Schematic.getSchemsAccessibleByUser(0));
|
||||||
} catch (NumberFormatException ex) {
|
} catch (NumberFormatException ex) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cUngültige Seitenzahl");
|
SchematicSystem.MESSAGE.send("INVALID_PAGE", player);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -117,7 +117,7 @@ public class SchematicCommand implements CommandExecutor {
|
|||||||
try {
|
try {
|
||||||
sendPlayerSchematicList(Integer.parseInt(args[1]), player, "/schem list ", Schematic.getSchemsAccessibleByUser(SteamwarUser.get(player.getUniqueId()).getId()));
|
sendPlayerSchematicList(Integer.parseInt(args[1]), player, "/schem list ", Schematic.getSchemsAccessibleByUser(SteamwarUser.get(player.getUniqueId()).getId()));
|
||||||
} catch (NumberFormatException ex) {
|
} catch (NumberFormatException ex) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cUngültige Seitenzahl");
|
SchematicSystem.MESSAGE.send("INVALID_PAGE", player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ public class SchematicCommand implements CommandExecutor {
|
|||||||
name.contains("°") ||
|
name.contains("°") ||
|
||||||
name.contains("'") ||
|
name.contains("'") ||
|
||||||
name.contains("\"")){
|
name.contains("\"")){
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen");
|
SchematicSystem.MESSAGE.send("INVALID_SCHEMNAME", player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -145,7 +145,7 @@ public class SchematicCommand implements CommandExecutor {
|
|||||||
schematic = Schematic.getSchemFromDB(name, 0); //public schematic
|
schematic = Schematic.getSchemFromDB(name, 0); //public schematic
|
||||||
|
|
||||||
if (schematic == null) {
|
if (schematic == null) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDie angegebene Schematic existiert nicht");
|
SchematicSystem.MESSAGE.send("UNKNOWN_SCHEM", player);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,10 +168,10 @@ public class SchematicCommand implements CommandExecutor {
|
|||||||
static void load(Player player, Schematic schematic){
|
static void load(Player player, Schematic schematic){
|
||||||
try {
|
try {
|
||||||
schematic.loadToPlayer(player);
|
schematic.loadToPlayer(player);
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "Schematic §e" + schematic.getSchemName() + " §7geladen");
|
SchematicSystem.MESSAGE.send("LOAD_LOADED", player, schematic.getSchemName());
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
Bukkit.getLogger().log(Level.SEVERE, "Schematic konnte nicht geladen werden", e);
|
Bukkit.getLogger().log(Level.SEVERE, "Could not load schematic", e);
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cFehler beim Laden der Schematic. Dies liegt wahrscheinlich an einer defekten Schematic.");
|
SchematicSystem.MESSAGE.send("LOAD_FAILED", player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,13 +198,13 @@ public class SchematicCommand implements CommandExecutor {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(args[1].length() > 64){
|
if(args[1].length() > 64){
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDer Name der Schematic ist zu lang");
|
SchematicSystem.MESSAGE.send("SAVE_NAME_TOO_LONG", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
||||||
if(schematic != null && !schematic.getSchemType().writeable()) {
|
if(schematic != null && !schematic.getSchemType().writeable()) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDu darfst diese Schematic nicht überschreiben");
|
SchematicSystem.MESSAGE.send("SAVE_NO_OVERRIDE", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,22 +218,23 @@ public class SchematicCommand implements CommandExecutor {
|
|||||||
try {
|
try {
|
||||||
schematic.saveFromPlayer(player);
|
schematic.saveFromPlayer(player);
|
||||||
}catch (NoClipboardException e) {
|
}catch (NoClipboardException e) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDein Clipboard ist leer");
|
SchematicSystem.MESSAGE.send("SAVE_EMPTY", player);
|
||||||
if(newSchem)
|
if(newSchem)
|
||||||
schematic.remove();
|
schematic.remove();
|
||||||
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.");
|
SchematicSystem.MESSAGE.send("SAVE_FAILED", player);
|
||||||
if(newSchem)
|
if(newSchem)
|
||||||
schematic.remove();
|
schematic.remove();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newSchem)
|
if(newSchem){
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "Schematic §e" + args[1] + " §7gespeichert");
|
SchematicSystem.MESSAGE.send("SAVE_SAVED", player, args[1]);
|
||||||
else
|
}else{
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "Schematic §e" + args[1] + " §7überschrieben");
|
SchematicSystem.MESSAGE.send("SAVE_OVERRIDE", player, args[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changetype(Player player, String[] args){
|
private void changetype(Player player, String[] args){
|
||||||
@ -253,7 +254,7 @@ public class SchematicCommand implements CommandExecutor {
|
|||||||
|
|
||||||
SchematicType type = SchematicType.fromDB(args[2]);
|
SchematicType type = SchematicType.fromDB(args[2]);
|
||||||
if(type == null || !type.isAssignable()){
|
if(type == null || !type.isAssignable()){
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDiesen Schematictypen gibt es nicht");
|
SchematicSystem.MESSAGE.send("CHANGETYPE_INVALID_TYPE", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,37 +263,118 @@ public class SchematicCommand implements CommandExecutor {
|
|||||||
|
|
||||||
static void changetype(Player player, Schematic schematic, SchematicType type){
|
static void changetype(Player player, Schematic schematic, SchematicType type){
|
||||||
if(schematic.getSchemType() == type){
|
if(schematic.getSchemType() == type){
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDie Schematic hat bereits diesen Typen");
|
SchematicSystem.MESSAGE.send("CHANGETYPE_ALREADY", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(type.writeable()){
|
if(type.writeable()){
|
||||||
schematic.setSchemType(type);
|
schematic.setSchemType(type);
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§aSchematictyp geändert");
|
SchematicSystem.MESSAGE.send("CHANGETYPE_CHANGED", player);
|
||||||
}else if(type.fightType()){
|
}else if(type.fightType()){
|
||||||
if(schematic.getSchemType().check()){
|
if(schematic.getSchemType().check()){
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDu hast diese Schematic bereits eingesendet");
|
SchematicSystem.MESSAGE.send("CHANGETYPE_PENDING", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoCheckResult result = CheckSchemType.get(type).autoCheck(schematic);
|
CheckSchemType checkType = CheckSchemType.get(type);
|
||||||
Collection<String> errors = result.errors();
|
AutoCheckResult result = checkType.autoCheck(schematic);
|
||||||
for(String warning : result.warnings()){
|
autoCheckWarnings(player, result);
|
||||||
player.sendMessage(" §e" + warning);
|
if(autoCheckErrors(player, checkType, result)){
|
||||||
}
|
SchematicSystem.MESSAGE.send("CHANGETYPE_REJECT", player);
|
||||||
for(String error : errors){
|
|
||||||
player.sendMessage(" §c" + error);
|
|
||||||
}
|
|
||||||
if(!errors.isEmpty()){
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDie Schematic ist nicht regelkonform");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
schematic.setSchemType(type.checkType());
|
schematic.setSchemType(type.checkType());
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§aDie Schematic wird zeitnah überprüft");
|
SchematicSystem.MESSAGE.send("CHANGETYPE_ACCEPT", player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void autoCheckWarnings(Player player, AutoCheckResult result){
|
||||||
|
for(Map.Entry<String, Integer> nbtBlock : result.getDefunctNbt().entrySet()){
|
||||||
|
if(nbtBlock.getValue() > 1){
|
||||||
|
SchematicSystem.MESSAGE.sendPrefixless("AUTO_WARN_PLUR_NBT", player, nbtBlock.getValue(), nbtBlock.getKey());
|
||||||
|
}else{
|
||||||
|
SchematicSystem.MESSAGE.sendPrefixless("AUTO_WARN_SING_NBT", player, nbtBlock.getKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean autoCheckErrors(Player player, CheckSchemType type, AutoCheckResult result){
|
||||||
|
if(result.noChecksInThisVersion()){
|
||||||
|
SchematicSystem.MESSAGE.sendPrefixless("AUTO_ERR_VERSION", player, Core.getVersion());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(result.errorLoadingSchematic()){
|
||||||
|
SchematicSystem.MESSAGE.sendPrefixless("AUTO_ERR_LOADING", player);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean error = false;
|
||||||
|
if(result.getWidth() > type.getDepth()){
|
||||||
|
SchematicSystem.MESSAGE.sendPrefixless("AUTO_ERR_WIDTH", player, result.getWidth(), type.getDepth());
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
if(result.getLength() > type.getWidth()){
|
||||||
|
SchematicSystem.MESSAGE.sendPrefixless("AUTO_ERR_LENGTH", player, result.getLength(), type.getWidth());
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
if(result.getHeight() > type.getHeight()){
|
||||||
|
SchematicSystem.MESSAGE.sendPrefixless("AUTO_ERR_HEIGHT", player, result.getHeight(), type.getHeight());
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(type.getMaxTNT() != 0 && result.getTnt() > type.getMaxTNT()){
|
||||||
|
SchematicSystem.MESSAGE.sendPrefixless("AUTO_ERR_TNT", player, result.getTnt(), type.getMaxTNT());
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
if(type.getMaxSlime() != 0 && result.getSlime() > type.getMaxSlime()){
|
||||||
|
SchematicSystem.MESSAGE.sendPrefixless("AUTO_ERR_SLIME", player, result.getSlime(), type.getMaxSlime());
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
if(type.getMaxDispenser() != 0 && result.getDispenser() > type.getMaxDispenser()){
|
||||||
|
SchematicSystem.MESSAGE.sendPrefixless("AUTO_ERR_DISPENSER", player, result.getDispenser(), type.getMaxDispenser());
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
if(type.getMaxTNTSlime() != 0 && result.getTntSlime() > type.getMaxTNTSlime()){
|
||||||
|
SchematicSystem.MESSAGE.sendPrefixless("AUTO_ERR_TNTSLIME", player, result.getTntSlime(), type.getMaxTNTSlime());
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
if(type.getMaxBlocks() != 0 && result.getBlocks() > type.getMaxBlocks()) {
|
||||||
|
SchematicSystem.MESSAGE.sendPrefixless("AUTO_ERR_MAXBLOCKS", player, result.getBlocks(), type.getMaxBlocks());
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(Map.Entry<String, Integer> block : result.getForbiddenMaterials().entrySet()){
|
||||||
|
SchematicSystem.MESSAGE.sendPrefixless("AUTO_ERR_BLOCK", player, block.getKey(), block.getValue());
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(result.getRecords() > 0){
|
||||||
|
SchematicSystem.MESSAGE.sendPrefixless("AUTO_ERR_RECORDS", player, result.getRecords());
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
if(result.getTooManyDispenserItems() == 1) {
|
||||||
|
SchematicSystem.MESSAGE.sendPrefixless("AUTO_ERR_SING_DISPENSER_ITEMS", player, type.getMaxDispenserItems());
|
||||||
|
error = true;
|
||||||
|
}else if(result.getTooManyDispenserItems() > 1){
|
||||||
|
SchematicSystem.MESSAGE.sendPrefixless("AUTO_ERR_PLUR_DISPENSER_ITEMS", player, result.getTooManyDispenserItems(), type.getMaxDispenserItems());
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
for(Map.Entry<String, Map<String, Integer>> block : result.getForbiddenItems().entrySet()){
|
||||||
|
for(Map.Entry<String, Integer> item : block.getValue().entrySet()){
|
||||||
|
SchematicSystem.MESSAGE.sendPrefixless("AUTO_ERR_ITEMS", player, block.getKey(), item.getKey(), item.getValue());
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(Map.Entry<String, Map<String, Integer>> block : result.getItemsWithTag().entrySet()){
|
||||||
|
for(Map.Entry<String, Integer> item : block.getValue().entrySet()){
|
||||||
|
SchematicSystem.MESSAGE.sendPrefixless("AUTO_ERR_TAG", player, block.getKey(), item.getKey(), item.getValue());
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
private void info(Player player, String[] args){
|
private void info(Player player, String[] args){
|
||||||
if(args.length < 2){
|
if(args.length < 2){
|
||||||
help(player);
|
help(player);
|
||||||
@ -303,42 +385,39 @@ public class SchematicCommand implements CommandExecutor {
|
|||||||
if(schematic == null)
|
if(schematic == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player.sendMessage("§eName: §7" + schematic.getSchemName());
|
SchematicSystem.MESSAGE.sendPrefixless("INFO_NAME", player, schematic.getSchemName());
|
||||||
|
|
||||||
TextComponent type = new TextComponent("§eTyp: §7" + schematic.getSchemType().name());
|
|
||||||
if(SteamwarUser.get(schematic.getSchemOwner()).getUUID().equals(player.getUniqueId()) && schematic.availible()){
|
if(SteamwarUser.get(schematic.getSchemOwner()).getUUID().equals(player.getUniqueId()) && schematic.availible()){
|
||||||
type.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§eTyp ändern")));
|
SchematicSystem.MESSAGE.sendPrefixless("INFO_TYPE", player, "INFO_TYPE_HOVER", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem changetype " + schematic.getSchemName()));
|
||||||
type.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem changetype " + schematic.getSchemName()));
|
}else{
|
||||||
|
SchematicSystem.MESSAGE.sendPrefixless("INFO_TYPE", player);
|
||||||
}
|
}
|
||||||
if(schematic.getRank() > 0){
|
if(schematic.getRank() > 0){
|
||||||
type.addExtra("§8Rang " + schematic.getRank());
|
SchematicSystem.MESSAGE.sendPrefixless("INFO_RANK", player);
|
||||||
}
|
}
|
||||||
player.spigot().sendMessage(type);
|
|
||||||
|
|
||||||
if(SteamwarUser.get(schematic.getSchemOwner()).getUUID().equals(player.getUniqueId())){
|
if(SteamwarUser.get(schematic.getSchemOwner()).getUUID().equals(player.getUniqueId())){
|
||||||
TextComponent download = new TextComponent("§eDownload Schematic");
|
SchematicSystem.MESSAGE.sendPrefixless("INFO_DOWNLOAD", player, "INFO_DOWNLOAD_HOVER", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem download " + schematic.getSchemName()));
|
||||||
download.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§eGeneriere Downloadlink")));
|
|
||||||
download.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem download " + schematic.getSchemName()));
|
|
||||||
player.spigot().sendMessage(download);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<CheckedSchematic> checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId());
|
List<CheckedSchematic> checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId());
|
||||||
for(int i = checkedSchematics.size() -1; i >= 0; i--) {
|
for(int i = checkedSchematics.size() -1; i >= 0; i--) {
|
||||||
if(checkedSchematics.get(i).getSchemName().equals(schematic.getSchemName()) &&
|
CheckedSchematic check = checkedSchematics.get(i);
|
||||||
checkedSchematics.get(i).getSchemOwner() == schematic.getSchemOwner()) {
|
if(check.getSchemName().equals(schematic.getSchemName()) &&
|
||||||
player.sendMessage("§cStatus: §c" + checkedSchematics.get(i).getStartTime() + " : " + checkedSchematics.get(i).getDeclineReason());
|
check.getSchemOwner() == schematic.getSchemOwner()) {
|
||||||
|
SchematicSystem.MESSAGE.sendPrefixless("INFO_STATUS", player, check.getStartTime(), check.getDeclineReason());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!SteamwarUser.get(schematic.getSchemOwner()).getUUID().equals(player.getUniqueId())) {
|
if(!SteamwarUser.get(schematic.getSchemOwner()).getUUID().equals(player.getUniqueId())) {
|
||||||
player.sendMessage("§eBesitzer: §7" + SteamwarUser.get(schematic.getSchemOwner()).getUserName());
|
SchematicSystem.MESSAGE.sendPrefixless("INFO_OWNER", player, SteamwarUser.get(schematic.getSchemOwner()).getUserName());
|
||||||
} else {
|
} else {
|
||||||
List<String> schematicMembers = new ArrayList<>();
|
List<String> schematicMembers = new ArrayList<>();
|
||||||
for(SchematicMember schematicMember : SchematicMember.getSchemMembers(schematic.getSchemName(), schematic.getSchemOwner())) {
|
for(SchematicMember schematicMember : SchematicMember.getSchemMembers(schematic.getSchemName(), schematic.getSchemOwner())) {
|
||||||
schematicMembers.add(SteamwarUser.get(schematicMember.getMember()).getUserName());
|
schematicMembers.add(SteamwarUser.get(schematicMember.getMember()).getUserName());
|
||||||
}
|
}
|
||||||
player.sendMessage("§eMitglieder: §7" + schematicMembers.toString());
|
SchematicSystem.MESSAGE.sendPrefixless("INFO_MEMBER", player, schematicMembers.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(schematic.availible()){
|
if(schematic.availible()){
|
||||||
@ -379,13 +458,13 @@ public class SchematicCommand implements CommandExecutor {
|
|||||||
try {
|
try {
|
||||||
sendPlayerSchematicList(Integer.parseInt(args[2]), player, "/schem search " + args[1] + " ", schems);
|
sendPlayerSchematicList(Integer.parseInt(args[2]), player, "/schem search " + args[1] + " ", schems);
|
||||||
} catch (NumberFormatException ex) {
|
} catch (NumberFormatException ex) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cUngültige Seitenzahl");
|
SchematicSystem.MESSAGE.send("INVALID_PAGE", player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void download(Player player, Schematic schematic){
|
static void download(Player player, Schematic schematic){
|
||||||
if(schematic.getSchemOwner() != SteamwarUser.get(player.getUniqueId()).getId()){
|
if(schematic.getSchemOwner() != SteamwarUser.get(player.getUniqueId()).getId()){
|
||||||
player.sendMessage("§cDu darfst nur deine eigenen Schematics herunterladen!");
|
SchematicSystem.MESSAGE.send("DOWNLOAD_ONLY_OWN", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,31 +482,32 @@ public class SchematicCommand implements CommandExecutor {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(schematic.getSchemOwner() != SteamwarUser.get(player.getUniqueId()).getId()) {
|
if(schematic.getSchemOwner() != SteamwarUser.get(player.getUniqueId()).getId()) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDu darfst nur auf deine eigene Schematic Mitglieder hinzufügen");
|
SchematicSystem.MESSAGE.send("ADDMEMBER_ONLY_OWN", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SteamwarUser warkingUser = SteamwarUser.get(args[2]);
|
SteamwarUser user = SteamwarUser.get(args[2]);
|
||||||
if(warkingUser == null){
|
if(user == null){
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDieser Spieler existiert nicht");
|
SchematicSystem.MESSAGE.send("UNKNOWN_USER", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(schematic.getSchemOwner() == warkingUser.getId()){
|
if(schematic.getSchemOwner() == user.getId()){
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cAlso bitte: Das ist deine eigene Schematic!");
|
SchematicSystem.MESSAGE.send("MEMBER_ON_OWN", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SchematicMember.getSchemMemberFromDB(schematic.getSchemName(), SteamwarUser.get(schematic.getSchemOwner()).getUUID(), warkingUser.getUUID()) != null){
|
if(SchematicMember.getSchemMemberFromDB(schematic.getSchemName(), SteamwarUser.get(schematic.getSchemOwner()).getUUID(), user.getUUID()) != null){
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDieser Spieler ist bereits auf diese Schematic geaddet");
|
SchematicSystem.MESSAGE.send("ADDMEMBER_ALREADY", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
new SchematicMember(schematic.getSchemName(), SteamwarUser.get(schematic.getSchemOwner()).getUUID(), warkingUser.getUUID());
|
new SchematicMember(schematic.getSchemName(), SteamwarUser.get(schematic.getSchemOwner()).getUUID(), user.getUUID());
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "Der Spieler §e" + warkingUser.getUserName() + " §7hat nun Zugriff auf die Schematic §e" + schematic.getSchemName());
|
SchematicSystem.MESSAGE.send("ADDMEMBER_ADDED", player, user.getUserName(), schematic.getSchemName());
|
||||||
|
|
||||||
Player target = Bukkit.getPlayer(warkingUser.getUUID());
|
Player target = Bukkit.getPlayer(user.getUUID());
|
||||||
if(target != null)
|
if(target != null){
|
||||||
target.sendMessage(SchematicSystem.PREFIX + "Du hast nun Zugriff auf die Schematic §e" + schematic.getSchemName() + " §7von §e" + SteamwarUser.get(schematic.getSchemOwner()).getUserName());
|
SchematicSystem.MESSAGE.send("ADDMEMBER_ACCESS", target, schematic.getSchemName(), player.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void delmember(Player player, String[] args){
|
private void delmember(Player player, String[] args){
|
||||||
@ -441,7 +521,7 @@ public class SchematicCommand implements CommandExecutor {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(schematic.getSchemOwner() != SteamwarUser.get(player.getUniqueId()).getId()) {
|
if(schematic.getSchemOwner() != SteamwarUser.get(player.getUniqueId()).getId()) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDu darfst nur von deinen eigenen Schematics Mitglieder entfernen");
|
SchematicSystem.MESSAGE.send("DELMEMBER_ONLY_OWN", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -452,49 +532,38 @@ public class SchematicCommand implements CommandExecutor {
|
|||||||
|
|
||||||
SteamwarUser user = SteamwarUser.get(args[2]);
|
SteamwarUser user = SteamwarUser.get(args[2]);
|
||||||
if(user == null){
|
if(user == null){
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDieser Spieler existiert nicht");
|
SchematicSystem.MESSAGE.send("UNKNOWN_USER", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(schematic.getSchemOwner() == user.getId()){
|
if(schematic.getSchemOwner() == user.getId()){
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cAlso bitte: Das ist deine eigene Schematic!");
|
SchematicSystem.MESSAGE.send("MEMBER_ON_OWN", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SchematicMember schematicMember = SchematicMember.getSchemMemberFromDB(schematic.getSchemName(), SteamwarUser.get(schematic.getSchemOwner()).getUUID(), user.getUUID());
|
SchematicMember schematicMember = SchematicMember.getSchemMemberFromDB(schematic.getSchemName(), SteamwarUser.get(schematic.getSchemOwner()).getUUID(), user.getUUID());
|
||||||
if(schematicMember == null) {
|
if(schematicMember == null) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDieser Spieler ist nicht auf die Schematic hinzugefügt");
|
SchematicSystem.MESSAGE.send("DELMEMBER_NOT_ADDED", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
schematicMember.remove();
|
schematicMember.remove();
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "Der Spieler §e" + user.getUserName() + " §7hat keinen Zugriff mehr auf die Schematic §e" + schematic.getSchemName());
|
SchematicSystem.MESSAGE.send("DELMEMBER_REMOVED", player, user.getUserName(), schematic.getSchemName());
|
||||||
|
|
||||||
Player target = Bukkit.getPlayer(user.getUUID());
|
Player target = Bukkit.getPlayer(user.getUUID());
|
||||||
if(target != null)
|
if(target != null){
|
||||||
target.sendMessage(SchematicSystem.PREFIX + "Du hast keinen Zugriff mehr auf die Schematic §e" + schematic.getSchemName() + "§7von §e" + SteamwarUser.get(schematic.getSchemOwner()).getUserName());
|
SchematicSystem.MESSAGE.send("DELMEMBER_REVOKED", player, schematic.getSchemName(), player.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void help(Player player) {
|
private void help(Player player) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "Befehle§8:");
|
SchematicSystem.MESSAGE.sendPrefixless("HELP", player);
|
||||||
player.sendMessage("§8/§eschem gui §8- §7Öffnet die Schematic-GUI");
|
|
||||||
player.sendMessage("§8/§eschem list §8- §7Zeigt dir deine Schematics an");
|
|
||||||
player.sendMessage("§8/§eschem list public §8- §7Zeigt alle Public-Schematics");
|
|
||||||
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");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendPlayerSchematicList(int currentPage, Player player, String precommand, List<Schematic> schematicList) {
|
private void sendPlayerSchematicList(int currentPage, Player player, String precommand, List<Schematic> schematicList) {
|
||||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
|
|
||||||
if(schematicList.isEmpty()) {
|
if(schematicList.isEmpty()) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cKeine Schematics gefunden");
|
SchematicSystem.MESSAGE.send("LIST_NO_SCHEMS", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -512,40 +581,31 @@ public class SchematicCommand implements CommandExecutor {
|
|||||||
|
|
||||||
if(currentPage >= pages || currentPage < 0) return;
|
if(currentPage >= pages || currentPage < 0) return;
|
||||||
|
|
||||||
player.sendMessage("§eSeite " + (currentPage + 1) + " §8/ " + pages + " §8| §e" + schematicList.size() + " Schematics");
|
SchematicSystem.MESSAGE.send("LIST_HEADER", player, currentPage + 1, pages, schematicList.size());
|
||||||
|
|
||||||
for(int i = currentPage * FILES_PER_PAGE; i < (currentPage * FILES_PER_PAGE) + FILES_PER_PAGE; i++) {
|
for(int i = currentPage * FILES_PER_PAGE; i < (currentPage * FILES_PER_PAGE) + FILES_PER_PAGE; i++) {
|
||||||
if(schematicList.size() <= i) break;
|
if(schematicList.size() <= i) break;
|
||||||
|
|
||||||
Schematic schematic = schematicList.get(i);
|
Schematic schematic = schematicList.get(i);
|
||||||
|
SchematicSystem.MESSAGE.send("LIST_INFO", player, "LIST_INFO_HOVER", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem info " + schematic.getSchemName()),
|
||||||
String schematicPlayer = "";
|
schematic.getSchemType().getKuerzel(), schematic.getSchemName(),
|
||||||
if(schematic.getSchemOwner() != user.getId())
|
schematic.getSchemOwner() != user.getId() ? SchematicSystem.MESSAGE.parse("LIST_INFO_BY", player, SteamwarUser.get(schematic.getSchemOwner()).getUserName()) : "");
|
||||||
schematicPlayer = " §8von §7" + SteamwarUser.get(schematic.getSchemOwner()).getUserName();
|
|
||||||
|
|
||||||
TextComponent schematics = new TextComponent("§e" + schematic.getSchemType().getKuerzel() + " §7" + schematic.getSchemName() + schematicPlayer);
|
|
||||||
schematics.setBold(true);
|
|
||||||
|
|
||||||
schematics.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eSchematic verwalten").create()));
|
|
||||||
schematics.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem info " + schematic.getSchemName()));
|
|
||||||
|
|
||||||
player.spigot().sendMessage(schematics);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pages <= 1) return;
|
if(pages <= 1) return;
|
||||||
|
|
||||||
TextComponent beforePage = new TextComponent("««");
|
TextComponent beforePage = SchematicSystem.MESSAGE.parseToComponent("LIST_PREVIOUS", false, player);
|
||||||
if(currentPage > 0){
|
if(currentPage > 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, TextComponent.fromLegacyText(SchematicSystem.MESSAGE.parse("LIST_PREVIOUS_HOVER", player))));
|
||||||
beforePage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, precommand + (currentPage - 1)));
|
beforePage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, precommand + (currentPage - 1)));
|
||||||
}else
|
}else
|
||||||
beforePage.setColor(ChatColor.RED);
|
beforePage.setColor(ChatColor.RED);
|
||||||
|
|
||||||
TextComponent nextPage = new TextComponent(" Seite »»");
|
TextComponent nextPage = SchematicSystem.MESSAGE.parseToComponent("LIST_NEXT", false, player);
|
||||||
if(currentPage < pages-1){
|
if(currentPage < pages-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, TextComponent.fromLegacyText(SchematicSystem.MESSAGE.parse("LIST_NEXT_HOVER", player))));
|
||||||
nextPage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, precommand + (currentPage + 1)));
|
nextPage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, precommand + (currentPage + 1)));
|
||||||
}else
|
}else
|
||||||
nextPage.setColor(ChatColor.RED);
|
nextPage.setColor(ChatColor.RED);
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren