Moving Schematics to DB
Dieser Commit ist enthalten in:
Ursprung
0999ec7499
Commit
68d3a707db
@ -1,64 +1,34 @@
|
||||
package de.steamwar.schematicsystem;
|
||||
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.object.schematic.Schematic;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.EmptyClipboardException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import org.bukkit.Bukkit;
|
||||
import de.steamwar.sql.NoClipboardException;
|
||||
import de.steamwar.sql.Schematic;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
|
||||
class WorldEdit_12 {
|
||||
private WorldEdit_12(){}
|
||||
|
||||
static void saveSchematic(Player player, String name) throws IOException, EmptyClipboardException {
|
||||
ClipboardHolder clipboardHolder = FaweAPI.wrapPlayer(player).getSession().getClipboard();
|
||||
Clipboard clipboard = clipboardHolder.getClipboard();
|
||||
if(clipboard == null)
|
||||
throw new EmptyClipboardException();
|
||||
|
||||
File folder = new File(Constants.SCHEM_DIR + player.getUniqueId().toString());
|
||||
if(!folder.exists()){
|
||||
folder.mkdir();
|
||||
Files.setPosixFilePermissions(folder.toPath(), Constants.FOLDER_PERMS);
|
||||
}
|
||||
|
||||
File file = new File(folder, name + ".schematic");
|
||||
file.createNewFile();
|
||||
Files.setPosixFilePermissions(file.toPath(), Constants.FILE_PERMS);
|
||||
|
||||
ClipboardFormat.SCHEMATIC.getWriter(new FileOutputStream(file)).write(clipboard, clipboardHolder.getWorldData());
|
||||
|
||||
}
|
||||
|
||||
static void loadClipboardToPlayer(Player player, Clipboard clipboard){
|
||||
Actor actor = getWorldEditPlugin().wrapCommandSender(player);
|
||||
getWorldEditPlugin().getWorldEdit().getSessionManager().get(actor).setClipboard(new ClipboardHolder(clipboard, FaweAPI.getWorld(player.getWorld().getName()).getWorldData()));
|
||||
}
|
||||
|
||||
static EditSession pasteSchematic(Player player, Schematic schematic){
|
||||
static EditSession pasteSchematic(Player player, Schematic schematic) throws Schematic.WrongVersionException, NoClipboardException, IOException {
|
||||
World weWorld = new BukkitWorld(player.getWorld());
|
||||
Location playerLocation = player.getLocation();
|
||||
Vector vector = new Vector(playerLocation.getBlockX(), playerLocation.getBlockY(), playerLocation.getBlockZ());
|
||||
Vector offset = new Vector(schematic.getClipboard().getRegion().getMinimumPoint()).subtract(schematic.getClipboard().getOrigin());
|
||||
Vector dimensions = schematic.getClipboard().getDimensions();
|
||||
Clipboard clipboard = schematic.load();
|
||||
Vector offset = new Vector(clipboard.getRegion().getMinimumPoint()).subtract(clipboard.getOrigin());
|
||||
Vector dimensions = clipboard.getDimensions();
|
||||
Vector v = vector.subtract(dimensions.getX()/2 - dimensions.getX()%2, 0, dimensions.getZ()).subtract(offset);
|
||||
return schematic.paste(weWorld, v);
|
||||
EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(weWorld, -1);
|
||||
try {
|
||||
((CuboidClipboard)clipboard).paste(e, v, false, true);
|
||||
} catch (MaxChangedBlocksException ex) {
|
||||
throw new IOException(ex);
|
||||
}
|
||||
|
||||
private static WorldEditPlugin getWorldEditPlugin() {
|
||||
return (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit");
|
||||
e.flushQueue();
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
@ -1,66 +1,38 @@
|
||||
package de.steamwar.schematicsystem;
|
||||
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.object.schematic.Schematic;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.EmptyClipboardException;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import org.bukkit.Bukkit;
|
||||
import de.steamwar.sql.NoClipboardException;
|
||||
import de.steamwar.sql.Schematic;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
|
||||
class WorldEdit_14 {
|
||||
private WorldEdit_14(){}
|
||||
|
||||
static void saveSchematic(Player player, String name) throws IOException, EmptyClipboardException {
|
||||
ClipboardHolder clipboardHolder = FaweAPI.wrapPlayer(player).getSession().getClipboard();
|
||||
Clipboard clipboard = clipboardHolder.getClipboard();
|
||||
if(clipboard == null)
|
||||
throw new EmptyClipboardException();
|
||||
|
||||
File folder = new File(Constants.SCHEM_DIR + player.getUniqueId().toString());
|
||||
if(!folder.exists()){
|
||||
folder.mkdir();
|
||||
Files.setPosixFilePermissions(folder.toPath(), Constants.FOLDER_PERMS);
|
||||
}
|
||||
|
||||
File file = new File(folder, name + ".schematic");
|
||||
file.createNewFile();
|
||||
Files.setPosixFilePermissions(file.toPath(), Constants.FILE_PERMS);
|
||||
|
||||
Region region = clipboard.getRegion();
|
||||
Schematic schem = new Schematic(region);
|
||||
schem.save(file, ClipboardFormats.findByExtension("schem"));
|
||||
}
|
||||
|
||||
static void loadClipboardToPlayer(Player player, Clipboard clipboard){
|
||||
Actor actor = getWorldEditPlugin().wrapCommandSender(player);
|
||||
getWorldEditPlugin().getWorldEdit().getSessionManager().get(actor).setClipboard(new ClipboardHolder(clipboard));
|
||||
}
|
||||
|
||||
static EditSession pasteSchematic(Player player, Schematic schematic){
|
||||
static EditSession pasteSchematic(Player player, Schematic schematic) throws Schematic.WrongVersionException, IOException, NoClipboardException {
|
||||
World weWorld = new BukkitWorld(player.getWorld());
|
||||
Location playerLocation = player.getLocation();
|
||||
Clipboard clipboard = schematic.load();
|
||||
BlockVector3 vector = BlockVector3.at(playerLocation.getBlockX(), playerLocation.getBlockY(), playerLocation.getBlockZ());
|
||||
BlockVector3 offset = schematic.getClipboard().getRegion().getMinimumPoint().subtract(schematic.getClipboard().getOrigin());
|
||||
BlockVector3 dimensions = schematic.getClipboard().getDimensions();
|
||||
BlockVector3 offset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
||||
BlockVector3 dimensions = clipboard.getDimensions();
|
||||
BlockVector3 v = vector.subtract(dimensions.getX()/2 - dimensions.getX()%2, 0, dimensions.getZ()).subtract(offset);
|
||||
return schematic.paste(weWorld, v);
|
||||
EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(weWorld, -1);
|
||||
try {
|
||||
new ClipboardHolder(clipboard).createPaste(e).to(v).build();
|
||||
} catch (MaxChangedBlocksException ex) {
|
||||
throw new IOException(ex);
|
||||
}
|
||||
|
||||
private static WorldEditPlugin getWorldEditPlugin() {
|
||||
return (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit");
|
||||
e.flushQueue();
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
package de.steamwar.schematicsystem;
|
||||
|
||||
import com.boydti.fawe.object.schematic.Schematic;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.EmptyClipboardException;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.sql.NoClipboardException;
|
||||
import de.steamwar.sql.Schematic;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -12,27 +11,7 @@ import java.io.IOException;
|
||||
public class WorldEdit {
|
||||
private WorldEdit(){}
|
||||
|
||||
public static void saveSchematic(Player player, String name) throws IOException, EmptyClipboardException {
|
||||
switch(Core.getVersion()){
|
||||
case 14:
|
||||
WorldEdit_14.saveSchematic(player, name);
|
||||
break;
|
||||
default:
|
||||
WorldEdit_12.saveSchematic(player, name);
|
||||
}
|
||||
}
|
||||
|
||||
public static void loadClipboardToPlayer(Player player, Clipboard clipboard){
|
||||
switch(Core.getVersion()){
|
||||
case 14:
|
||||
WorldEdit_14.loadClipboardToPlayer(player, clipboard);
|
||||
break;
|
||||
default:
|
||||
WorldEdit_12.loadClipboardToPlayer(player, clipboard);
|
||||
}
|
||||
}
|
||||
|
||||
public static EditSession pasteSchematic(Player player, Schematic schematic){
|
||||
public static EditSession pasteSchematic(Player player, Schematic schematic) throws Schematic.WrongVersionException, IOException, NoClipboardException {
|
||||
switch(Core.getVersion()){
|
||||
case 14:
|
||||
return WorldEdit_14.pasteSchematic(player, schematic);
|
||||
|
@ -1,11 +1,10 @@
|
||||
package de.steamwar.schematicsystem.commands;
|
||||
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import de.steamwar.schematicsystem.Constants;
|
||||
import de.steamwar.schematicsystem.SchematicSystem;
|
||||
import de.steamwar.schematicsystem.WorldEdit;
|
||||
import de.steamwar.schematicsystem.check.CheckSession;
|
||||
import de.steamwar.schematicsystem.check.CheckUtils;
|
||||
import de.steamwar.sql.NoClipboardException;
|
||||
import de.steamwar.sql.Schematic;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -14,7 +13,6 @@ import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
@ -94,22 +92,17 @@ public class CheckCommand implements CommandExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
File file = new File(Constants.SCHEM_DIR + user.getUUID().toString(),schematic.getSchemName() + ".schematic");
|
||||
if(!file.exists()) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDie Schematic gibts nicht?!?!");
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
com.boydti.fawe.object.schematic.Schematic schematicFAWE = FaweAPI.load(file);
|
||||
|
||||
checkSession = new CheckSession(player.getUniqueId(), schematic);
|
||||
checkSession.sendNextCheck();
|
||||
checkSession.setEditSession(WorldEdit.pasteSchematic(player, schematicFAWE));
|
||||
} catch (IOException ex) {
|
||||
checkSession.setEditSession(WorldEdit.pasteSchematic(player, schematic));
|
||||
} catch (IOException | NoClipboardException ex) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cSchematic konnte nicht geladen/gepastet werden");
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Failed to load schematic", ex);
|
||||
return false;
|
||||
} catch (Schematic.WrongVersionException e) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDiese Schematic kann nicht in dieser Minecraft-Version geladen werden");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case "decline":
|
||||
|
@ -3,7 +3,6 @@ package de.steamwar.schematicsystem.commands;
|
||||
import de.steamwar.inventory.SWInventory;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.inventory.SWListInv;
|
||||
import de.steamwar.schematicsystem.Constants;
|
||||
import de.steamwar.schematicsystem.SchematicSystem;
|
||||
import de.steamwar.sql.*;
|
||||
import javafx.util.Pair;
|
||||
@ -14,7 +13,6 @@ import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
@ -47,8 +45,6 @@ class GUI {
|
||||
static void delete(Player p, Schematic schem){
|
||||
SWInventory inv = new SWInventory(p, 9, schem.getSchemName() + " löschen");
|
||||
inv.setItem(0, SWItem.getDye(1), (byte) 1, "§eLöschen", click -> {
|
||||
File file = new File(Constants.SCHEM_DIR + p.getUniqueId(), schem.getSchemName() + ".schematic");
|
||||
file.delete();
|
||||
schem.remove();
|
||||
|
||||
List<CheckedSchematic> checkedSchematics = CheckedSchematic.getLastDeclined(p.getUniqueId());
|
||||
@ -100,6 +96,7 @@ class GUI {
|
||||
|
||||
private static void info(Player p, Schematic schem){
|
||||
SWInventory inv = new SWInventory(p, 9, schem.getSchemName());
|
||||
if(schem.availible())
|
||||
inv.setItem(0, SWItem.getMaterial("WOOD_AXE"), "§eLaden", click -> {
|
||||
SchematicCommand.load(p, schem);
|
||||
p.closeInventory();
|
||||
@ -124,6 +121,7 @@ class GUI {
|
||||
p.closeInventory();
|
||||
changeItem(p, schem);
|
||||
});
|
||||
if(schem.availible())
|
||||
inv.setItem(4, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + schem.getSchemType().name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), false, click -> {
|
||||
p.closeInventory();
|
||||
changeType(p, schem);
|
||||
|
@ -1,12 +1,7 @@
|
||||
package de.steamwar.schematicsystem.commands;
|
||||
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.sk89q.worldedit.EmptyClipboardException;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import de.steamwar.schematicsystem.CheckSchemType;
|
||||
import de.steamwar.schematicsystem.Constants;
|
||||
import de.steamwar.schematicsystem.SchematicSystem;
|
||||
import de.steamwar.schematicsystem.WorldEdit;
|
||||
import de.steamwar.schematicsystem.check.CheckUtils;
|
||||
import de.steamwar.sql.*;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
@ -20,7 +15,6 @@ import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
@ -133,21 +127,13 @@ public class SchematicCommand implements CommandExecutor {
|
||||
|
||||
static void load(Player player, Schematic schematic){
|
||||
try {
|
||||
File file = new File(Constants.SCHEM_DIR + SteamwarUser.get(schematic.getSchemOwner()).getUUID(), schematic.getSchemName() + ".schematic");
|
||||
|
||||
if (!file.exists()) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDie angegebene Schematic existiert nicht");
|
||||
return;
|
||||
}
|
||||
Clipboard clipboard = FaweAPI.load(file).getClipboard();
|
||||
if (clipboard == null)
|
||||
throw new IOException("File not a schematic");
|
||||
|
||||
WorldEdit.loadClipboardToPlayer(player, clipboard);
|
||||
schematic.loadToPlayer(player);
|
||||
player.sendMessage(SchematicSystem.PREFIX + "Schematic §e" + schematic.getSchemName() + " §7geladen");
|
||||
}catch (IOException ex){
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Schematic konnte nicht geladen werden", ex);
|
||||
}catch (IOException | NoClipboardException e){
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Schematic konnte nicht geladen werden", e);
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cFehler beim Laden der Schematic. Bitte wende dich an einen Developer");
|
||||
}catch (Schematic.WrongVersionException e) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDiese Schematic lässt sich nicht in dieser Minecraft-Version laden");
|
||||
}
|
||||
}
|
||||
|
||||
@ -184,23 +170,32 @@ public class SchematicCommand implements CommandExecutor {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean newSchem = false;
|
||||
if(schematic == null || schematic.getSchemOwner() == SteamwarUser.get(player.getUniqueId()).getId()){
|
||||
newSchem = true;
|
||||
Schematic.createSchem(args[1], player.getUniqueId(), "", SchematicType.Normal);
|
||||
schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
||||
}
|
||||
|
||||
try {
|
||||
WorldEdit.saveSchematic(player, args[1]);
|
||||
}catch(EmptyClipboardException e){
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDein Clipboard ist leer");
|
||||
return;
|
||||
schematic.saveFromPlayer(player);
|
||||
}catch(IOException ex){
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Could not save schematic", ex);
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cFehler beim Speichern der Schematic. Bitte wende dich an einen Developer");
|
||||
if(newSchem)
|
||||
schematic.remove();
|
||||
return;
|
||||
}catch (NoClipboardException e) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDein Clipboard ist leer");
|
||||
if(newSchem)
|
||||
schematic.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if (schematic != null && schematic.getSchemOwner() == SteamwarUser.get(player.getUniqueId()).getId()) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "Schematic §e" + args[1] + " §7überschrieben");
|
||||
} else {
|
||||
new Schematic(args[1], player.getUniqueId(), "", SchematicType.Normal);
|
||||
if (newSchem)
|
||||
player.sendMessage(SchematicSystem.PREFIX + "Schematic §e" + args[1] + " §7gespeichert");
|
||||
}
|
||||
else
|
||||
player.sendMessage(SchematicSystem.PREFIX + "Schematic §e" + args[1] + " §7überschrieben");
|
||||
}
|
||||
|
||||
private void changetype(Player player, String[] args){
|
||||
@ -275,7 +270,7 @@ public class SchematicCommand implements CommandExecutor {
|
||||
player.sendMessage("§eName: §7" + schematic.getSchemName());
|
||||
|
||||
TextComponent type = new TextComponent("§eTyp: §7" + schematic.getSchemType().name());
|
||||
if(SteamwarUser.get(schematic.getSchemOwner()).getUUID().equals(player.getUniqueId())){
|
||||
if(SteamwarUser.get(schematic.getSchemOwner()).getUUID().equals(player.getUniqueId()) && schematic.availible()){
|
||||
type.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§eTyp ändern")));
|
||||
type.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem changetype " + schematic.getSchemName()));
|
||||
}
|
||||
@ -300,11 +295,13 @@ public class SchematicCommand implements CommandExecutor {
|
||||
player.sendMessage("§eMitglieder: §7" + schematicMembers.toString());
|
||||
}
|
||||
|
||||
if(schematic.availible()){
|
||||
TextComponent loadSchematic = new TextComponent("LADEN");
|
||||
loadSchematic.setColor(ChatColor.DARK_GREEN);
|
||||
loadSchematic.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem load " + schematic.getSchemName()));
|
||||
player.spigot().sendMessage(loadSchematic);
|
||||
}
|
||||
}
|
||||
|
||||
private void addmember(Player player, String[] args){
|
||||
if(args.length < 3){
|
||||
|
@ -1,6 +1,5 @@
|
||||
package de.steamwar.schematicsystem.listener;
|
||||
|
||||
import de.steamwar.schematicsystem.Constants;
|
||||
import de.steamwar.schematicsystem.SchematicSystem;
|
||||
import de.steamwar.schematicsystem.check.CheckSession;
|
||||
import de.steamwar.schematicsystem.check.CheckUtils;
|
||||
@ -12,8 +11,6 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@ -25,6 +22,7 @@ public class PlayerJoinListener implements Listener {
|
||||
|
||||
if(CheckSession.currentChecking()){
|
||||
CheckSession current = CheckSession.getCheckSession();
|
||||
assert current != null;
|
||||
if(!CheckUtils.allowedToCheck(player) && !SteamwarUser.get(current.getSchematic().getSchemOwner()).getUUID().equals(player.getUniqueId())){
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cAuf diesem Server wird momentan eine Schematic geprüft!");
|
||||
player.kickPlayer("");
|
||||
@ -32,8 +30,6 @@ public class PlayerJoinListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
addNewSchems(player);
|
||||
|
||||
if(CheckUtils.allowedToCheck(player))
|
||||
player.sendMessage(CheckUtils.sendTeamMembersCSchematicsInfo());
|
||||
|
||||
@ -47,27 +43,4 @@ public class PlayerJoinListener implements Listener {
|
||||
if(!uncheckedSchematics.isEmpty())
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§7Du hast noch §e" + uncheckedSchematics.size() + " §7ungeprüfte Schematic(s)!");
|
||||
}
|
||||
|
||||
private void addNewSchems(Player player){
|
||||
File file = new File(Constants.SCHEM_DIR + player.getUniqueId());
|
||||
File[] files = file.listFiles();
|
||||
|
||||
if(files != null && files.length > 0) {
|
||||
List<Schematic> schematics = Schematic.getSchemsAccessibleByUser(player.getUniqueId());
|
||||
List<String> schematicNames = new ArrayList<>();
|
||||
|
||||
for(Schematic schematic : schematics) {
|
||||
if(schematic.getSchemOwner() == SteamwarUser.get(player.getUniqueId()).getId()) {
|
||||
schematicNames.add(schematic.getSchemName());
|
||||
}
|
||||
}
|
||||
|
||||
for (File value : files) {
|
||||
if (!schematicNames.contains(value.getName().substring(0, value.getName().lastIndexOf('.')))) {
|
||||
String fileName = value.getName();
|
||||
new Schematic(fileName.substring(0, fileName.lastIndexOf('.')), player.getUniqueId(), "", SchematicType.Normal);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren