security update, more userfriendly
Signed-off-by: yaruma3341 <yaruma3341@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
70958fac9a
Commit
22e9ea71e1
@ -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()) {
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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<Schematic> schematics = Schematic.getSchemsAccessibleByUser(player.getUniqueId());
|
||||
List<String> schematicNames = new ArrayList<>();
|
||||
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() == 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<Schematic> 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)!");
|
||||
}
|
||||
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren