13
0

AutoChecker #136

Zusammengeführt
Chaoscaot hat 6 Commits von autocheck_rework nach master 2022-11-30 20:19:40 +01:00 zusammengeführt
5 geänderte Dateien mit 11 neuen und 16 gelöschten Zeilen
Nur Änderungen aus Commit 315a59bc91 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -19,8 +19,6 @@
package de.steamwar.schematicsystem; package de.steamwar.schematicsystem;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import de.steamwar.core.VersionDependent;
import de.steamwar.sql.SchematicType; import de.steamwar.sql.SchematicType;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;

Datei anzeigen

@ -21,10 +21,7 @@ package de.steamwar.schematicsystem.commands;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.schematicsystem.SchematicSystem; import de.steamwar.schematicsystem.SchematicSystem;
import de.steamwar.sql.NoClipboardException; import de.steamwar.sql.*;
import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SchematicType;
import de.steamwar.sql.SteamwarUser;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.io.IOException; import java.io.IOException;
@ -36,7 +33,7 @@ public class DownloadCommand extends SWCommand {
@Register(help = true) @Register(help = true)
public void genericCommand(Player player, String... args) { public void genericCommand(Player player, String... args) {
SteamwarUser user = SteamwarUser.get(player); SteamwarUser user = SteamwarUser.get(player.getUniqueId());
SchematicNode copyNode = SchematicNode.getSchematicNode(user.getId(), "//copy", 0); SchematicNode copyNode = SchematicNode.getSchematicNode(user.getId(), "//copy", 0);
boolean newSchem = false; boolean newSchem = false;
if(copyNode == null) { if(copyNode == null) {
@ -45,7 +42,7 @@ public class DownloadCommand extends SWCommand {
} }
try { try {
copyNode.saveFromPlayer(player); new SchematicData(copyNode).saveFromPlayer(player);
} catch (IOException e) { } catch (IOException e) {
SchematicSystem.MESSAGE.send("DOWNLOAD_ERROR", player); SchematicSystem.MESSAGE.send("DOWNLOAD_ERROR", player);
if(newSchem) { if(newSchem) {

Datei anzeigen

@ -106,7 +106,7 @@ public class GUI {
if(node.getOwner() == user.getId()){ if(node.getOwner() == user.getId()){
if(!node.isDir() && node.getSchemtype().writeable()){ if(!node.isDir() && node.getSchemtype().writeable()){
CheckedSchematic.getLastDeclinedOfNode(node).stream().findFirst().ifPresent(checkedSchematic -> CheckedSchematic.getLastDeclinedOfNode(node.getId()).stream().findFirst().ifPresent(checkedSchematic ->
inv.setItem(1, SWItem.getDye(10), (byte) 10, SchematicSystem.MESSAGE.parse("GUI_INFO_STATUS", player, node.getSchemtype().name()), Collections.singletonList(SchematicSystem.MESSAGE.parse("GUI_INFO_STATUS_LORE", player, checkedSchematic.getDeclineReason().replaceAll("&", "§"))), false, click -> {})); inv.setItem(1, SWItem.getDye(10), (byte) 10, SchematicSystem.MESSAGE.parse("GUI_INFO_STATUS", player, node.getSchemtype().name()), Collections.singletonList(SchematicSystem.MESSAGE.parse("GUI_INFO_STATUS_LORE", player, checkedSchematic.getDeclineReason().replaceAll("&", "§"))), false, click -> {}));
} }
Material mat = SWItem.getMaterial(node.getItem()); Material mat = SWItem.getMaterial(node.getItem());
@ -120,7 +120,7 @@ public class GUI {
} }
}); });
if(!node.isDir()) { if(!node.isDir()) {
inv.setItem(6, node.getSchemtype().getMaterial(), SchematicSystem.MESSAGE.parse("GUI_INFO_TYPE", player, node.getSchemtype().name()), Arrays.asList(SchematicSystem.MESSAGE.parse("CHANGE", player), SchematicSystem.MESSAGE.parse("CLICK", player)), node.getSchemtype().fightType(), click -> { inv.setItem(6, SWItem.getMaterial(node.getSchemtype().getMaterial()), SchematicSystem.MESSAGE.parse("GUI_INFO_TYPE", player, node.getSchemtype().name()), Arrays.asList(SchematicSystem.MESSAGE.parse("CHANGE", player), SchematicSystem.MESSAGE.parse("CLICK", player)), node.getSchemtype().fightType(), click -> {
changeType(player, node); changeType(player, node);
}); });
inv.setItem(7, SWItem.getMaterial("MAGENTA_GLAZED_TERRACOTTA"), SchematicSystem.MESSAGE.parse("GUI_INFO_DOWNLOAD", player), click -> { inv.setItem(7, SWItem.getMaterial("MAGENTA_GLAZED_TERRACOTTA"), SchematicSystem.MESSAGE.parse("GUI_INFO_DOWNLOAD", player), click -> {
@ -213,7 +213,7 @@ public class GUI {
List<SWListInv.SWListEntry<SchematicType>> types = SchematicType.values().parallelStream() List<SWListInv.SWListEntry<SchematicType>> types = SchematicType.values().parallelStream()
.filter(SchematicType::isAssignable) .filter(SchematicType::isAssignable)
.filter(type -> finalClipboard == null || CheckSchemType.get(type) == null || AutoChecker.sizeCheck(finalClipboard, CheckSchemType.get(type)).fastOk()) .filter(type -> finalClipboard == null || CheckSchemType.get(type) == null || AutoChecker.sizeCheck(finalClipboard, CheckSchemType.get(type)).fastOk())
.map(type -> new SWListInv.SWListEntry<>(new SWItem(type.getMaterial(), type.name(), Collections.emptyList(), type.fightType(), null), type)) .map(type -> new SWListInv.SWListEntry<>(new SWItem(SWItem.getMaterial(type.getMaterial()), type.name(), Collections.emptyList(), type.fightType(), null), type))
.collect(Collectors.toList()); .collect(Collectors.toList());
SWListInv<SchematicType> inv = new SWListInv<>(p, SchematicSystem.MESSAGE.parse("GUI_CHANGE_TYPE", p), types, (clickType, schematicType) -> { SWListInv<SchematicType> inv = new SWListInv<>(p, SchematicSystem.MESSAGE.parse("GUI_CHANGE_TYPE", p), types, (clickType, schematicType) -> {

Datei anzeigen

@ -187,7 +187,7 @@ public class SchematicCommand extends SWCommand {
} }
try { try {
node.saveFromPlayer(player); new SchematicData(node).saveFromPlayer(player);
} catch (NoClipboardException e) { } catch (NoClipboardException e) {
SchematicSystem.MESSAGE.send("COMMAND_SAVE_CLIPBOARD_EMPTY", player); SchematicSystem.MESSAGE.send("COMMAND_SAVE_CLIPBOARD_EMPTY", player);
if (newSchem) if (newSchem)
@ -762,7 +762,7 @@ public class SchematicCommand extends SWCommand {
if(!nodeNullCheck(messageSender, schematicNode)) { if(!nodeNullCheck(messageSender, schematicNode)) {
return false; return false;
} }
if(schematicNode.getOwner() != SteamwarUser.get((Player) commandSender).getId()) { if(schematicNode.getOwner() != SteamwarUser.get(((Player) commandSender).getUniqueId()).getId()) {
messageSender.send("COMMAND_NOT_OWN"); messageSender.send("COMMAND_NOT_OWN");
return false; return false;
} }
@ -776,7 +776,7 @@ public class SchematicCommand extends SWCommand {
if(!nodeNullCheck(messageSender, schematicNode)) { if(!nodeNullCheck(messageSender, schematicNode)) {
return false; return false;
} }
if(schematicNode.getOwner() != SteamwarUser.get((Player) commandSender).getId()) { if(schematicNode.getOwner() != SteamwarUser.get(((Player) commandSender).getUniqueId()).getId()) {
messageSender.send("COMMAND_NOT_OWN"); messageSender.send("COMMAND_NOT_OWN");
return false; return false;
} }

Datei anzeigen

@ -244,7 +244,7 @@ public class SchematicCommandUtils {
} }
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_FORMAT", player, node.getSchemFormat() ? ".schem" : ".schematic"); SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_FORMAT", player, node.getSchemFormat() ? ".schem" : ".schematic");
CheckedSchematic.getLastDeclinedOfNode(node).stream().findFirst().ifPresent(checkedSchematic -> SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_STATUS", player, checkedSchematic.getEndTime(), checkedSchematic.getDeclineReason())); CheckedSchematic.getLastDeclinedOfNode(node.getId()).stream().findFirst().ifPresent(checkedSchematic -> SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_STATUS", player, checkedSchematic.getEndTime(), checkedSchematic.getDeclineReason()));
} else { } else {
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_TYPE", player, SchematicSystem.MESSAGE.parse("UTIL_INFO_TYPE_DIR", player)); SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_TYPE", player, SchematicSystem.MESSAGE.parse("UTIL_INFO_TYPE_DIR", player));
} }
@ -363,7 +363,7 @@ public class SchematicCommandUtils {
} }
try { try {
node.loadToPlayer(player); new SchematicData(node).loadToPlayer(player);
SchematicSystem.MESSAGE.send("UTIL_LOAD_DONE", player, node.getName()); SchematicSystem.MESSAGE.send("UTIL_LOAD_DONE", player, node.getName());
Bukkit.getLogger().log(Level.INFO, "{0} has loaded Schematic {1} {2}", new Object[]{player.getName(), node.getId(), node.getName()}); Bukkit.getLogger().log(Level.INFO, "{0} has loaded Schematic {1} {2}", new Object[]{player.getName(), node.getId(), node.getName()});
} catch (NoClipboardException e) { } catch (NoClipboardException e) {