13
0

upload; bugfixes; added new features; extended config

Signed-off-by: yaruma3341 <yaruma3341@gmail.com>
Dieser Commit ist enthalten in:
Yaruma3341 2019-05-27 22:27:06 +02:00 committet von yaruma3341
Ursprung c3704ce6e8
Commit 710c8f5832
6 geänderte Dateien mit 340 neuen und 145 gelöschten Zeilen

Datei anzeigen

@ -15,7 +15,7 @@ import org.bukkit.plugin.java.JavaPlugin;
public class SchematicSystem extends JavaPlugin { public class SchematicSystem extends JavaPlugin {
public static final String SCHEM_DIR = "/home/netuser/schematics/"; public static final String SCHEM_DIR = "/home/minecraft/schematics/";
public static final String PREFIX = "§6Schematic§8» §7"; public static final String PREFIX = "§6Schematic§8» §7";
private static SchematicSystem instance; private static SchematicSystem instance;

Datei anzeigen

@ -3,6 +3,8 @@ package de.warking.schematicsystem.check;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import de.warking.hunjy.MySQL.Schematic; import de.warking.hunjy.MySQL.Schematic;
import de.warking.hunjy.MySQL.SchematicType; import de.warking.hunjy.MySQL.SchematicType;
import de.warking.hunjy.MySQL.WarkingUser;
import de.warking.schematicsystem.utils.CheckedSchematic;
import de.warking.schematicsystem.utils.Config; import de.warking.schematicsystem.utils.Config;
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;
@ -10,6 +12,7 @@ import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.sql.Timestamp;
import java.util.*; import java.util.*;
public class CheckSession { public class CheckSession {
@ -19,10 +22,9 @@ public class CheckSession {
private UUID uuid; //player private UUID uuid; //player
private Schematic schematic; private Schematic schematic;
private int position; //position in checklist private int position; //position in checklist
private HashMap<Integer, Integer> checkTimes = new HashMap<>(); //position, time
private long startTime; private Timestamp startTime;
private long stopTime; private Timestamp stopTime;
EditSession editSession; EditSession editSession;
@ -53,18 +55,6 @@ public class CheckSession {
return null; return null;
} }
public int calculatePositionTime() {
return Math.round((stopTime - startTime) / 1000);
}
public int calculateTotalTime() {
int totalTime = 0;
for(Map.Entry<Integer, Integer> entry : this.checkTimes.entrySet()) {
totalTime += entry.getValue();
}
return totalTime;
}
public void sendNextCheck() { public void sendNextCheck() {
setStopTime(); setStopTime();
this.position++; this.position++;
@ -130,17 +120,15 @@ public class CheckSession {
if(schematic.getSchemType() == SchematicType.Cairship) { if(schematic.getSchemType() == SchematicType.Cairship) {
schematic.setSchemType(SchematicType.airship); schematic.setSchemType(SchematicType.airship);
} }
//TODO: save position times and total time to file CheckedSchematic checkedSchematic = new CheckedSchematic(this.schematic.getSchemName(), this.schematic.getSchemOwner(), WarkingUser.get(this.uuid).getId(), this.startTime, this.stopTime, "freigegeben");
//calculateTotalTime();
removeSchematic(); removeSchematic();
remove(); remove();
} }
public void declineSchematic() { public void declineSchematic(String declineReason) {
this.schematic.setSchemType(SchematicType.normal); this.schematic.setSchemType(SchematicType.normal);
//TODO: save position times and total time to file CheckedSchematic checkedSchematic = new CheckedSchematic(this.schematic.getSchemName(), this.schematic.getSchemOwner(), WarkingUser.get(this.uuid).getId(), this.startTime, this.stopTime, declineReason);
//calculateTotalTime();
removeSchematic(); removeSchematic();
remove(); remove();
} }
@ -177,25 +165,24 @@ public class CheckSession {
this.position = position; this.position = position;
} }
public HashMap<Integer, Integer> getCheckTimes() { public Timestamp getStartTime() {
return checkTimes;
}
public long getStartTime() {
return startTime; return startTime;
} }
public void setStartTime() { public void setStartTime() {
this.startTime = System.currentTimeMillis(); Date date = new Date();
Timestamp timestamp = new Timestamp(date.getTime());
this.startTime = timestamp;
} }
public long getStopTime() { public Timestamp getStopTime() {
return stopTime; return stopTime;
} }
public void setStopTime() { public void setStopTime() {
this.stopTime = System.currentTimeMillis(); Date date = new Date();
checkTimes.put(this.position, calculatePositionTime()); Timestamp timestamp = new Timestamp(date.getTime());
this.stopTime = timestamp;
} }
public EditSession getEditSession() { public EditSession getEditSession() {

Datei anzeigen

@ -1,9 +1,6 @@
package de.warking.schematicsystem.check; package de.warking.schematicsystem.check;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import de.warking.hunjy.MySQL.Schematic; import de.warking.hunjy.MySQL.Schematic;
@ -39,7 +36,7 @@ public class CheckUtils {
return true; return true;
} }
public static boolean checkSchematic(Clipboard clipboard, List<Integer> forbiddenBlocks, boolean obsidianToTnt, boolean slimeToBedrock, String modus) { public static Checkresult checkSchematic(Clipboard clipboard, List<Integer> forbiddenBlocks, boolean obsidianToTnt, boolean slimeToBedrock, String modus) {
Region region = clipboard.getRegion(); Region region = clipboard.getRegion();
Vector min = region.getMinimumPoint(); Vector min = region.getMinimumPoint();
@ -54,71 +51,119 @@ public class CheckUtils {
for (int z = min.getBlockZ(); z <= max.getBlockZ(); z++) { for (int z = min.getBlockZ(); z <= max.getBlockZ(); z++) {
Vector vector = new Vector(x, y, z); Vector vector = new Vector(x, y, z);
try { //obsidian check
if(obsidianToTnt && clipboard.getBlock(vector).getId() == 46) { if(obsidianToTnt) {
clipboard.setBlock(vector, new BaseBlock(49)); if(clipboard.getBlock(vector).getId() == 46) {
Checkresult checkresult = new Checkresult(false, "TNT verbaut");
return checkresult;
}
if(clipboard.getBlock(vector).getId() == 49)
obsidian++; obsidian++;
} }
if(slimeToBedrock && clipboard.getBlock(vector).getId() == 165) { //bedrock check
if(modus.equals("WarShip") || if(clipboard.getBlock(vector).getId() == 165) {
modus.equals("AirShip")) if(slimeToBedrock) {
clipboard.setBlock(vector, new BaseBlock(7)); Checkresult checkresult = new Checkresult(false, "SCHLEIM verbaut");
bedrock++; return checkresult;
} }
if(clipboard.getBlock(vector).getId() == 23)
dispenser++;
} catch (WorldEditException ex) {
return false;
} }
if (forbiddenBlocks.contains(clipboard.getBlock(vector).getId())) if(clipboard.getBlock(vector).getId() == 7) {
return false; if(!modus.equals("WarGear") && !modus.equals("MiniWarGear"))
bedrock++;
else {
Checkresult checkresult = new Checkresult(false, "BEDROCK verbaut");
return checkresult;
}
}
//dispenser check
if(clipboard.getBlock(vector).getId() == 23)
dispenser++;
//forbidden check
if (forbiddenBlocks.contains(clipboard.getBlock(vector).getId())) {
Checkresult checkresult = new Checkresult(false, "VERBOTENE ID", clipboard.getBlock(vector).getId());
return checkresult;
}
} }
} }
} }
int obsidianBedrock = obsidian + bedrock; int obsidianBedrock = obsidian + bedrock;
if(modus.equalsIgnoreCase("WarGear")) { if(modus.equalsIgnoreCase("WarGear")) {
if(Config.WarGearMaxObsidian < obsidian) if(Config.WarGearMaxObsidian < obsidian) {
return false; Checkresult checkresult = new Checkresult(false, "zu viel OBSIDIAN");
if(Config.WarGearMaxBedrock < bedrock) return checkresult;
return false; }
if(Config.WarGearMaxDispenser < dispenser) if(Config.WarGearMaxBedrock < bedrock) {
return false; Checkresult checkresult = new Checkresult(false, "zu viel BEDROCK");
if(Config.WarGearObsidianBedrock < obsidianBedrock) return checkresult;
return false; }
if(Config.WarGearMaxDispenser < dispenser) {
Checkresult checkresult = new Checkresult(false, "zu viele DISPENSER");
return checkresult;
}
if(Config.WarGearObsidianBedrock < obsidianBedrock) {
Checkresult checkresult = new Checkresult(false, "OBSIDIAN und TNT Summe überschritten");
return checkresult;
}
} }
if(modus.equalsIgnoreCase("MiniWarGear")) { if(modus.equalsIgnoreCase("MiniWarGear")) {
if(Config.MiniWarGearMaxObsidian < obsidian) if(Config.MiniWarGearMaxObsidian < obsidian) {
return false; Checkresult checkresult = new Checkresult(false, "zu viel OBSIDIAN");
if(Config.MiniWarGearMaxBedrock < bedrock) return checkresult;
return false; }
if(Config.MiniWarGearMaxDispenser < dispenser) if(Config.MiniWarGearMaxBedrock < bedrock) {
return false; Checkresult checkresult = new Checkresult(false, "zu viel BEDROCK");
if(Config.MiniWarGearObsidianBedrock < obsidianBedrock) return checkresult;
return false; }
if(Config.MiniWarGearMaxDispenser < dispenser) {
Checkresult checkresult = new Checkresult(false, "zu viele DISPENSER");
return checkresult;
}
if(Config.MiniWarGearObsidianBedrock < obsidianBedrock) {
Checkresult checkresult = new Checkresult(false, "OBSIDIAN und TNT Summe überschritten");
return checkresult;
}
} }
if(modus.equalsIgnoreCase("WarShip")) { if(modus.equalsIgnoreCase("WarShip")) {
if(Config.WarShipMaxObsidian < obsidian) if(Config.WarShipMaxObsidian < obsidian) {
return false; Checkresult checkresult = new Checkresult(false, "zu viel OBSIDIAN");
if(Config.WarShipMaxBedrock < bedrock) return checkresult;
return false; }
if(Config.WarShipMaxDispenser < dispenser) if(Config.WarShipMaxBedrock < bedrock) {
return false; Checkresult checkresult = new Checkresult(false, "zu viel BEDROCK");
if(Config.WarShipObsidianBedrock < obsidianBedrock) return checkresult;
return false; }
if(Config.WarShipMaxDispenser < dispenser) {
Checkresult checkresult = new Checkresult(false, "zu viele DISPENSER");
return checkresult;
}
if(Config.WarShipObsidianBedrock < obsidianBedrock) {
Checkresult checkresult = new Checkresult(false, "OBSIDIAN und TNT Summe überschritten");
return checkresult;
}
} }
if(modus.equalsIgnoreCase("AirShip")) { if(modus.equalsIgnoreCase("AirShip")) {
if(Config.AirShipMaxObsidian < obsidian) if(Config.AirShipMaxObsidian < obsidian) {
return false; Checkresult checkresult = new Checkresult(false, "zu viel OBSIDIAN");
if(Config.AirShipMaxBedrock < bedrock) return checkresult;
return false;
if(Config.AirShipMaxDispenser < dispenser)
return false;
if(Config.AirShipObsidianBedrock < obsidianBedrock)
return false;
} }
return true; if(Config.AirShipMaxBedrock < bedrock) {
Checkresult checkresult = new Checkresult(false, "zu viel BEDROCK");
return checkresult;
}
if(Config.AirShipMaxDispenser < dispenser) {
Checkresult checkresult = new Checkresult(false, "zu viele DISPENSER");
return checkresult;
}
if(Config.AirShipObsidianBedrock < obsidianBedrock) {
Checkresult checkresult = new Checkresult(false, "OBSIDIAN und TNT Summe überschritten");
return checkresult;
}
}
Checkresult checkresult = new Checkresult(true);
return checkresult;
} }
public static boolean allowedToCheck(Player player) { public static boolean allowedToCheck(Player player) {

Datei anzeigen

@ -0,0 +1,58 @@
package de.warking.schematicsystem.check;
import java.util.ArrayList;
public class Checkresult {
public static ArrayList<Checkresult> checkresults = new ArrayList<>();
private boolean check; //schematic allowed / declined
private String reason; //general reason
private int blockID = -1; //not allowed block id / must be initialized -1
public Checkresult(boolean check) {
this.check = check;
checkresults.add(this);
}
public Checkresult(boolean check, String reason) {
this.check = check;
this.reason = reason;
checkresults.add(this);
}
public Checkresult(boolean check, String reason, int blockID) {
this.check = check;
this.reason = reason;
this.blockID = blockID;
checkresults.add(this);
}
public void remove() {
checkresults.remove(this);
}
public boolean isCheck() {
return check;
}
public void setCheck(boolean check) {
this.check = check;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public int getBlockID() {
return blockID;
}
public void setBlockID(int blockID) {
this.blockID = blockID;
}
}

Datei anzeigen

@ -1,7 +1,6 @@
package de.warking.schematicsystem.commands; package de.warking.schematicsystem.commands;
import com.boydti.fawe.FaweAPI; import com.boydti.fawe.FaweAPI;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.bukkit.BukkitWorld; import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
@ -11,7 +10,6 @@ import de.warking.hunjy.MySQL.WarkingUser;
import de.warking.schematicsystem.SchematicSystem; import de.warking.schematicsystem.SchematicSystem;
import de.warking.schematicsystem.check.CheckSession; import de.warking.schematicsystem.check.CheckSession;
import de.warking.schematicsystem.check.CheckUtils; import de.warking.schematicsystem.check.CheckUtils;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@ -116,10 +114,15 @@ public class CheckCommand implements CommandExecutor {
} }
WarkingUser warkingUser = WarkingUser.get(owner); WarkingUser warkingUser = WarkingUser.get(owner);
if(warkingUser != null) { if(warkingUser.getUUID() != null) {
Schematic schematic = Schematic.getSchemFromDB(schemName, warkingUser.getUUID()); Schematic schematic = Schematic.getSchemFromDB(schemName, warkingUser.getUUID());
if(schematic != null) { if(schematic != null) {
if(schematic.getSchemType() != SchematicType.normal &&
schematic.getSchemType() != SchematicType.airship &&
schematic.getSchemType() != SchematicType.warship &&
schematic.getSchemType() != SchematicType.wargear &&
schematic.getSchemType() != SchematicType.miniwargear) {
for(CheckSession checkSession : CheckSession.checkSessions) { for(CheckSession checkSession : CheckSession.checkSessions) {
if(checkSession.getSchematic().getSchemName().equals(schematic.getSchemName()) if(checkSession.getSchematic().getSchemName().equals(schematic.getSchemName())
&& checkSession.getSchematic().getSchemOwner() == schematic.getSchemOwner()) { && checkSession.getSchematic().getSchemOwner() == schematic.getSchemOwner()) {
@ -163,17 +166,21 @@ public class CheckCommand implements CommandExecutor {
checkSession.setEditSession(schematicFAWE.paste(weWorld, v)); checkSession.setEditSession(schematicFAWE.paste(weWorld, v));
} catch (IOException ex) { } catch (IOException ex) {
player.sendMessage(SchematicSystem.PREFIX + "§cBeim Laden der Schematic ist ein Fehler aufgetreten! PASTE"); player.sendMessage(SchematicSystem.PREFIX + "§cBeim Laden der Schematic ist ein Fehler aufgetreten! ERROR: PASTE / CHECK_SESSION");
ex.printStackTrace(); ex.printStackTrace();
return false; return false;
} }
} else {
player.sendMessage(SchematicSystem.PREFIX + "§cDiese Schematic ist nicht zum Prüfen eingesendet!");
return false;
}
} else { } else {
player.sendMessage(SchematicSystem.PREFIX + "§cBeim Laden der Schematic ist ein Fehler aufgetreten! NULL"); player.sendMessage(SchematicSystem.PREFIX + "§cBeim Laden der Schematic ist ein Fehler aufgetreten! SCHEMATIC DOES NOT EXIST");
return false; return false;
} }
} else { } else {
player.sendMessage(SchematicSystem.PREFIX + "§cBeim Laden der Schematic ist ein Fehler aufgetreten! USER"); player.sendMessage(SchematicSystem.PREFIX + "§cBeim Laden der Schematic ist ein Fehler aufgetreten! USER DOES NOT EXIST");
return false; return false;
} }
return false; return false;
@ -191,7 +198,7 @@ public class CheckCommand implements CommandExecutor {
message = message + args[i] + " "; message = message + args[i] + " ";
} }
player.sendMessage(SchematicSystem.PREFIX + "§aDie Schematic §6" + checkSession.getSchematic().getSchemName() + " §avon §6" + WarkingUser.get(checkSession.getSchematic().getSchemOwner()).getUserName() + " §awurde aufgrund von §6" + message + " §anicht freigegeben!"); player.sendMessage(SchematicSystem.PREFIX + "§aDie Schematic §6" + checkSession.getSchematic().getSchemName() + " §avon §6" + WarkingUser.get(checkSession.getSchematic().getSchemOwner()).getUserName() + " §awurde aufgrund von §6" + message + " §anicht freigegeben!");
checkSession.declineSchematic(); checkSession.declineSchematic(message);
} else { } else {
player.sendMessage(SchematicSystem.PREFIX + "§cDu prüfst momentan keine Schematic!"); player.sendMessage(SchematicSystem.PREFIX + "§cDu prüfst momentan keine Schematic!");
return false; return false;

Datei anzeigen

@ -10,6 +10,8 @@ import com.sk89q.worldedit.session.ClipboardHolder;
import de.warking.hunjy.MySQL.*; import de.warking.hunjy.MySQL.*;
import de.warking.schematicsystem.SchematicSystem; import de.warking.schematicsystem.SchematicSystem;
import de.warking.schematicsystem.check.CheckUtils; import de.warking.schematicsystem.check.CheckUtils;
import de.warking.schematicsystem.check.Checkresult;
import de.warking.schematicsystem.utils.CheckedSchematic;
import de.warking.schematicsystem.utils.Config; import de.warking.schematicsystem.utils.Config;
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;
@ -168,14 +170,15 @@ public class SchematicCommand implements CommandExecutor {
if(CheckUtils.isSchematicNameAllowed(args[1])) { if(CheckUtils.isSchematicNameAllowed(args[1])) {
try { try {
if(FaweAPI.wrapPlayer(player).getSession().getClipboard().getClipboard() != null) { if(FaweAPI.wrapPlayer(player).getSession().getClipboard().getClipboard() != null) {
if(Schematic.getSchemFromDB(args[1], player.getUniqueId()) != null) { Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
if(Schematic.getSchemFromDB(args[1], player.getUniqueId()).getSchemType() != SchematicType.normal) { if(schematic != null) {
if(schematic.getSchemType() != SchematicType.normal) {
player.sendMessage(SchematicSystem.PREFIX + "§cDu darfst diesen Schematic Typ nicht überschreiben!"); player.sendMessage(SchematicSystem.PREFIX + "§cDu darfst diesen Schematic Typ nicht überschreiben!");
return false; return false;
} }
} }
if(Schematic.getSchemFromDB(args[1], player.getUniqueId()) != null) { if(schematic != null) {
Schematic.getSchemFromDB(args[1], player.getUniqueId()).remove(); schematic.remove();
player.sendMessage(SchematicSystem.PREFIX + "Schematic §6" + args[1] + " §7überschrieben!"); player.sendMessage(SchematicSystem.PREFIX + "Schematic §6" + args[1] + " §7überschrieben!");
} else } else
player.sendMessage(SchematicSystem.PREFIX + "Schematic §6" + args[1] + " §7gespeichert!"); player.sendMessage(SchematicSystem.PREFIX + "Schematic §6" + args[1] + " §7gespeichert!");
@ -207,7 +210,7 @@ public class SchematicCommand implements CommandExecutor {
FaweAPI.wrapPlayer(player).getSession().getClipboard().getClipboard(), FaweAPI.wrapPlayer(player).getSession().getClipboard().getClipboard(),
FaweAPI.wrapPlayer(player).getSession().getClipboard().getWorldData()); FaweAPI.wrapPlayer(player).getSession().getClipboard().getWorldData());
Schematic schematic = new Schematic(args[1], player.getUniqueId(), "", SchematicType.normal); Schematic newSchematic = new Schematic(args[1], player.getUniqueId(), "", SchematicType.normal);
} else { } else {
player.sendMessage(SchematicSystem.PREFIX + "§cDein Clipboard ist leer!"); player.sendMessage(SchematicSystem.PREFIX + "§cDein Clipboard ist leer!");
@ -226,8 +229,29 @@ public class SchematicCommand implements CommandExecutor {
if(schematic != null) { if(schematic != null) {
player.sendMessage("§6Name: §7" + schematic.getSchemName()); player.sendMessage("§6Name: §7" + schematic.getSchemName());
if(schematic.getSchemOwner() == WarkingUser.get(player.getUniqueId()).getId()) {
TextComponent typ = new TextComponent("§6Typ: §7" + schematic.getSchemType().name());
typ.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§7Typ ändern").create()));
typ.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem getschemchangetype " + schematic.getSchemName()));
player.spigot().sendMessage(typ);
} else
player.sendMessage("§6Typ: §7" + schematic.getSchemType().name()); player.sendMessage("§6Typ: §7" + schematic.getSchemType().name());
if(schematic.getSchemType() == SchematicType.normal) {
List<CheckedSchematic> checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId());
for(int i = checkedSchematics.size() -1; i > 0; i--) {
if(checkedSchematics.get(i).getSchemName().equals(schematic.getSchemName()) &&
checkedSchematics.get(i).getSchemOwner() == schematic.getSchemOwner()) {
player.sendMessage("§cStatus: §c" + checkedSchematics.get(i).getStartTime() + " : " + checkedSchematics.get(i).getDeclineReason());
TextComponent mehr = new TextComponent("§9mehr...");
mehr.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem getmoreinfo " + schematic.getSchemName()));
player.spigot().sendMessage(mehr);
break;
}
}
}
if(!WarkingUser.get(schematic.getSchemOwner()).getUUID().equals(player.getUniqueId())) { if(!WarkingUser.get(schematic.getSchemOwner()).getUUID().equals(player.getUniqueId())) {
player.sendMessage("§6Owner: §7" + WarkingUser.get(schematic.getSchemOwner()).getUserName()); player.sendMessage("§6Owner: §7" + WarkingUser.get(schematic.getSchemOwner()).getUserName());
} else { } else {
@ -263,6 +287,64 @@ public class SchematicCommand implements CommandExecutor {
return false; return false;
} }
} }
if(args[0].equalsIgnoreCase("getschemchangetype")) {
if(CheckUtils.isSchematicNameAllowed(args[1])) {
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
if(schematic != null) {
TextComponent normal = new TextComponent("§7[§anormal§7]");
normal.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem changetype " + schematic.getSchemName() + " normal"));
TextComponent wargear = new TextComponent("§7[§awargear§7]");
wargear.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem changetype " + schematic.getSchemName() + " wargear"));
TextComponent miniwargear = new TextComponent("§7[§aminiwargear§7]");
miniwargear.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem changetype " + schematic.getSchemName() + " miniwargear"));
TextComponent airship = new TextComponent("§7[§aairship§7]");
airship.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem changetype " + schematic.getSchemName() + " airship"));
TextComponent warship = new TextComponent("§7[§awarship§7]");
warship.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem changetype " + schematic.getSchemName() + " warship"));
player.spigot().sendMessage(normal);
player.spigot().sendMessage(wargear);
player.spigot().sendMessage(miniwargear);
player.spigot().sendMessage(airship);
player.spigot().sendMessage(warship);
} else {
player.sendMessage(SchematicSystem.PREFIX + "§cDiese Schematic existiert nicht!");
return false;
}
} else {
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematic Name enthält verbotene Zeichen!");
return false;
}
}
if(args[0].equalsIgnoreCase("getmoreinfo")) {
if(CheckUtils.isSchematicNameAllowed(args[1])) {
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
if(schematic != null) {
List<CheckedSchematic> checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId());
for(CheckedSchematic checkedSchematic : checkedSchematics) {
if(checkedSchematic.getSchemName().equals(schematic.getSchemName()) &&
checkedSchematic.getSchemOwner() == schematic.getSchemOwner()) {
player.sendMessage("§bStart: " + checkedSchematic.getStartTime());
player.sendMessage("§bEnde: " + checkedSchematic.getEndTime());
player.sendMessage("§bPrüfer: " + WarkingUser.get(checkedSchematic.getValidator()).getUserName());
player.sendMessage("§bGrund: " + checkedSchematic.getDeclineReason());
}
}
} else {
player.sendMessage(SchematicSystem.PREFIX + "§cDiese Schematic existiert nicht!");
return false;
}
} else {
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematic Name enthält verbotene Zeichen!");
return false;
}
}
return false; return false;
case 3: case 3:
@ -325,53 +407,69 @@ public class SchematicCommand implements CommandExecutor {
if(args[2].equalsIgnoreCase("airship")) { if(args[2].equalsIgnoreCase("airship")) {
if(dimensions.getBlockX() <= Config.AirShipBreite && dimensions.getBlockY() <= Config.AirShipHöhe && dimensions.getBlockZ() <= Config.AirShipTiefe) { if(dimensions.getBlockX() <= Config.AirShipBreite && dimensions.getBlockY() <= Config.AirShipHöhe && dimensions.getBlockZ() <= Config.AirShipTiefe) {
if(!CheckUtils.checkSchematic(clipboard, Config.AirShipForbiddenIds, true, true, "AirShip")) { Checkresult checkresult = CheckUtils.checkSchematic(clipboard, Config.AirShipForbiddenIds, true, true, "AirShip");
player.sendMessage(SchematicSystem.PREFIX + "§cDein AirShip ist nicht regelkonform!"); if(!checkresult.isCheck()) {
player.sendMessage(SchematicSystem.PREFIX + "§cDein AirShip ist nicht regelkonform! §0[§c" + checkresult.getReason() + ((checkresult.getBlockID() != -1) ? ": " + checkresult.getBlockID() : "") + "§0]");
checkresult.remove();
return false; return false;
} }
schematic.setSchemType(SchematicType.Cairship); schematic.setSchemType(SchematicType.Cairship);
player.sendMessage(SchematicSystem.PREFIX + "Schematic Type §6airship §7angefordert!"); player.sendMessage(SchematicSystem.PREFIX + "Schematic Type §6airship §7angefordert!");
CheckUtils.sendTeamMembersCSchematics(SchematicSystem.PREFIX + "§aDer Benutzer §6" + player.getName() + " §ahat eine Schematic eingesendet §8[§6AirShip§8]"); CheckUtils.sendTeamMembersCSchematics(SchematicSystem.PREFIX + "§aDer Benutzer §6" + player.getName() + " §ahat eine Schematic eingesendet §8[§6AirShip§8]");
} checkresult.remove();
} else
player.sendMessage(SchematicSystem.PREFIX + "§cDein Airship überschreitet die Maximalmaße!");
return false; return false;
} }
if(args[2].equalsIgnoreCase("miniwargear")) { if(args[2].equalsIgnoreCase("miniwargear")) {
if(dimensions.getBlockX() <= Config.MiniWarGearBreite && dimensions.getBlockY() <= Config.MiniWarGearHöhe && dimensions.getBlockZ() <= Config.MiniWarGearTiefe) { if(dimensions.getBlockX() <= Config.MiniWarGearBreite && dimensions.getBlockY() <= Config.MiniWarGearHöhe && dimensions.getBlockZ() <= Config.MiniWarGearTiefe) {
if(!CheckUtils.checkSchematic(clipboard, Config.MiniWarGearForbiddenIds, true, false, "MiniWarGear")) { Checkresult checkresult = CheckUtils.checkSchematic(clipboard, Config.MiniWarGearForbiddenIds, true, false, "MiniWarGear");
player.sendMessage(SchematicSystem.PREFIX + "§cDein MiniWarGear ist nicht regelkonform!"); if(!checkresult.isCheck()) {
player.sendMessage(SchematicSystem.PREFIX + "§cDein MiniWarGear ist nicht regelkonform! §0[§c" + checkresult.getReason() + ((checkresult.getBlockID() != -1) ? ": " + checkresult.getBlockID() : "") + "§0]");
checkresult.remove();
return false; return false;
} }
schematic.setSchemType(SchematicType.Cminiwargear); schematic.setSchemType(SchematicType.Cminiwargear);
player.sendMessage(SchematicSystem.PREFIX + "Schematic Type §6miniwargear §7angefordert!"); player.sendMessage(SchematicSystem.PREFIX + "Schematic Type §6miniwargear §7angefordert!");
CheckUtils.sendTeamMembersCSchematics(SchematicSystem.PREFIX + "§aDer Benutzer §6" + player.getName() + " §ahat eine Schematic eingesendet §8[§6MiniWarGear§8]"); CheckUtils.sendTeamMembersCSchematics(SchematicSystem.PREFIX + "§aDer Benutzer §6" + player.getName() + " §ahat eine Schematic eingesendet §8[§6MiniWarGear§8]");
} checkresult.remove();
} else
player.sendMessage(SchematicSystem.PREFIX + "§cDein MiniWarGear überschreitet die Maximalmaße!");
return false; return false;
} }
if(args[2].equalsIgnoreCase("wargear")) { if(args[2].equalsIgnoreCase("wargear")) {
if(dimensions.getBlockX() <= Config.WarGearBreite && dimensions.getBlockY() <= Config.WarGearHöhe && dimensions.getBlockZ() <= Config.WarGearTiefe) { if(dimensions.getBlockX() <= Config.WarGearBreite && dimensions.getBlockY() <= Config.WarGearHöhe && dimensions.getBlockZ() <= Config.WarGearTiefe) {
if(!CheckUtils.checkSchematic(clipboard, Config.WarGearForbiddenIds, true, false, "WarGear")) { Checkresult checkresult = CheckUtils.checkSchematic(clipboard, Config.WarGearForbiddenIds, true, false, "WarGear");
player.sendMessage(SchematicSystem.PREFIX + "§cDein WarGear ist nicht regelkonform!"); if(!checkresult.isCheck()) {
player.sendMessage(SchematicSystem.PREFIX + "§cDein WarGear ist nicht regelkonform! §0[§c" + checkresult.getReason() + ((checkresult.getBlockID() != -1) ? ": " + checkresult.getBlockID() : "") + "§0]");
checkresult.remove();
return false; return false;
} }
schematic.setSchemType(SchematicType.Cwargear); schematic.setSchemType(SchematicType.Cwargear);
player.sendMessage(SchematicSystem.PREFIX + "Schematic Type §6wargear §7angefordert!"); player.sendMessage(SchematicSystem.PREFIX + "Schematic Type §6wargear §7angefordert!");
CheckUtils.sendTeamMembersCSchematics(SchematicSystem.PREFIX + "§aDer Benutzer §6" + player.getName() + " §ahat eine Schematic eingesendet §8[§6WarGear§8]"); CheckUtils.sendTeamMembersCSchematics(SchematicSystem.PREFIX + "§aDer Benutzer §6" + player.getName() + " §ahat eine Schematic eingesendet §8[§6WarGear§8]");
} checkresult.remove();
} else
player.sendMessage(SchematicSystem.PREFIX + "§cDein WarGear überschreitet die Maximalmaße!");
return false; return false;
} }
if(args[2].equalsIgnoreCase("warship")) { if(args[2].equalsIgnoreCase("warship")) {
if(dimensions.getBlockX() <= Config.WarShipBreite && dimensions.getBlockY() <= Config.WarShipHöhe && dimensions.getBlockZ() <= Config.WarShipTiefe) { if(dimensions.getBlockX() <= Config.WarShipBreite && dimensions.getBlockY() <= Config.WarShipHöhe && dimensions.getBlockZ() <= Config.WarShipTiefe) {
if(!CheckUtils.checkSchematic(clipboard, Config.WarShipForbiddenIds, true, true, "WarShip")) { Checkresult checkresult = CheckUtils.checkSchematic(clipboard, Config.WarShipForbiddenIds, true, true, "WarShip");
player.sendMessage(SchematicSystem.PREFIX + "§cDein WarShip ist nicht regelkonform!"); if(!checkresult.isCheck()) {
player.sendMessage(SchematicSystem.PREFIX + "§cDein WarShip ist nicht regelkonform! §0[§c" + checkresult.getReason() + ((checkresult.getBlockID() != -1) ? ": " + checkresult.getBlockID() : "") + "§0]");
checkresult.remove();
return false; return false;
} }
schematic.setSchemType(SchematicType.Cwarship); schematic.setSchemType(SchematicType.Cwarship);
player.sendMessage(SchematicSystem.PREFIX + "Schematic Type §6warship §7angefordert!"); player.sendMessage(SchematicSystem.PREFIX + "Schematic Type §6warship §7angefordert!");
CheckUtils.sendTeamMembersCSchematics(SchematicSystem.PREFIX + "§aDer Benutzer §6" + player.getName() + " §ahat eine Schematic eingesendet §8[§6WarShip§8]"); CheckUtils.sendTeamMembersCSchematics(SchematicSystem.PREFIX + "§aDer Benutzer §6" + player.getName() + " §ahat eine Schematic eingesendet §8[§6WarShip§8]");
} checkresult.remove();
} else
player.sendMessage(SchematicSystem.PREFIX + "§cDein WarShip überschreitet die Maximalmaße!");
return false; return false;
} }
} }