diff --git a/src/de/warking/schematicsystem/commands/CheckCommand.java b/src/de/warking/schematicsystem/commands/CheckCommand.java index 7fc0f77..146510a 100644 --- a/src/de/warking/schematicsystem/commands/CheckCommand.java +++ b/src/de/warking/schematicsystem/commands/CheckCommand.java @@ -123,6 +123,15 @@ public class CheckCommand implements CommandExecutor { schematic.getSchemType() != SchematicType.warship && schematic.getSchemType() != SchematicType.wargear && schematic.getSchemType() != SchematicType.miniwargear) { + + if(schematic.getSchemOwner() == WarkingUser.get(player.getUniqueId()).getId()) { + player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst nicht deine eigenen Schematics prüfen!"); + return false; + } + if(!player.getWorld().getName().equals(player.getUniqueId().toString())) { + player.sendMessage(SchematicSystem.PREFIX + "§cZum Prüfen musst du dich auf deinem Bauserver befinden!"); + return false; + } for(CheckSession checkSession : CheckSession.checkSessions) { if(checkSession.getSchematic().getSchemName().equals(schematic.getSchemName()) && checkSession.getSchematic().getSchemOwner() == schematic.getSchemOwner()) { diff --git a/src/de/warking/schematicsystem/listener/PlayerCommandPreProcessListener.java b/src/de/warking/schematicsystem/listener/PlayerCommandPreProcessListener.java index a82a5ea..aa67c35 100644 --- a/src/de/warking/schematicsystem/listener/PlayerCommandPreProcessListener.java +++ b/src/de/warking/schematicsystem/listener/PlayerCommandPreProcessListener.java @@ -12,12 +12,12 @@ public class PlayerCommandPreProcessListener implements Listener { @EventHandler public void handlePlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { Player player = event.getPlayer(); - if(!event.getMessage().contains("copy")) + if(!event.getMessage().contains("copy") && !event.getMessage().contains("cut")) return; if(CheckSession.doesPlayerCheck(player)) { event.setCancelled(true); - player.sendMessage(SchematicSystem.PREFIX + "§cDu darfst nichts kopieren während du eine Schematic prüfst!"); + player.sendMessage(SchematicSystem.PREFIX + "§cDieser Befehl ist beim Prüfen gesperrt!"); //eventuell Admin Benachrichtigen } } diff --git a/src/de/warking/schematicsystem/listener/PlayerJoinListener.java b/src/de/warking/schematicsystem/listener/PlayerJoinListener.java index 7bf1738..e02975e 100644 --- a/src/de/warking/schematicsystem/listener/PlayerJoinListener.java +++ b/src/de/warking/schematicsystem/listener/PlayerJoinListener.java @@ -5,6 +5,7 @@ import de.warking.hunjy.MySQL.SchematicType; import de.warking.hunjy.MySQL.WarkingUser; import de.warking.schematicsystem.SchematicSystem; import de.warking.schematicsystem.check.CheckUtils; +import de.warking.schematicsystem.utils.CheckedSchematic; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -22,25 +23,37 @@ public class PlayerJoinListener implements Listener { File file = new File(SchematicSystem.SCHEM_DIR + player.getUniqueId() + "/"); File[] files = file.listFiles(); - if(files == null || files.length == 0) return; - List schematics = Schematic.getSchemsAccessibleByUser(player.getUniqueId()); - List schematicNames = new ArrayList<>(); + if(files != null && files.length > 0) { + List schematics = Schematic.getSchemsAccessibleByUser(player.getUniqueId()); + List schematicNames = new ArrayList<>(); - for(Schematic schematic : schematics) { - if(schematic.getSchemOwner() == WarkingUser.get(player.getUniqueId()).getId()) { - schematicNames.add(schematic.getSchemName()); + for(Schematic schematic : schematics) { + if(schematic.getSchemOwner() == WarkingUser.get(player.getUniqueId()).getId()) { + schematicNames.add(schematic.getSchemName()); + } } - } - for(int i = 0; i < files.length; i++) { - if(!schematicNames.contains(files[i].getName().substring(0, files[i].getName().lastIndexOf('.')))) { - String fileName = files[i].getName(); - new Schematic(fileName.substring(0, fileName.lastIndexOf('.')), player.getUniqueId(), "", SchematicType.normal); + for(int i = 0; i < files.length; i++) { + if(!schematicNames.contains(files[i].getName().substring(0, files[i].getName().lastIndexOf('.')))) { + String fileName = files[i].getName(); + new Schematic(fileName.substring(0, fileName.lastIndexOf('.')), player.getUniqueId(), "", SchematicType.normal); + } } } if(CheckUtils.allowedToCheck(player)) player.sendMessage(CheckUtils.sendTeamMembersCSchematicsInfo()); + + WarkingUser warkingUser = WarkingUser.get(player.getUniqueId()); + List uncheckedSchematics = new ArrayList<>(); + + uncheckedSchematics.addAll(Schematic.getSchemsOfType(warkingUser.getId(), SchematicType.Cairship)); + uncheckedSchematics.addAll(Schematic.getSchemsOfType(warkingUser.getId(), SchematicType.Cwarship)); + uncheckedSchematics.addAll(Schematic.getSchemsOfType(warkingUser.getId(), SchematicType.Cwargear)); + uncheckedSchematics.addAll(Schematic.getSchemsOfType(warkingUser.getId(), SchematicType.Cminiwargear)); + + if(!uncheckedSchematics.isEmpty()) + player.sendMessage(SchematicSystem.PREFIX + "§7Du hast noch §6" + uncheckedSchematics.size() + " §7ungeprüfte Schematic(s)!"); }