Merge pull request 'Adapt to commonDB' (#131) from commonDB into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #131
Dieser Commit ist enthalten in:
Commit
fd575dffe2
@ -22,6 +22,7 @@ package de.steamwar.schematicsystem;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import de.steamwar.core.VersionDependent;
|
||||
import de.steamwar.sql.NoClipboardException;
|
||||
import de.steamwar.sql.SchematicData;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import de.steamwar.sql.SchematicType;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -109,7 +110,7 @@ public class CheckSchemType {
|
||||
AutoCheckResult result = new AutoCheckResult(this);
|
||||
Clipboard clipboard;
|
||||
try {
|
||||
clipboard = schematic.load();
|
||||
clipboard = new SchematicData(schematic).load();
|
||||
} catch (IOException | NoClipboardException e) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Schematic could not be loaded", e);
|
||||
result.setErrorLoadingSchematic();
|
||||
|
@ -21,10 +21,7 @@ package de.steamwar.schematicsystem.commands;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.schematicsystem.SchematicSystem;
|
||||
import de.steamwar.sql.NoClipboardException;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import de.steamwar.sql.SchematicType;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.sql.*;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -36,7 +33,7 @@ public class DownloadCommand extends SWCommand {
|
||||
|
||||
@Register(help = true)
|
||||
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);
|
||||
boolean newSchem = false;
|
||||
if(copyNode == null) {
|
||||
@ -45,7 +42,7 @@ public class DownloadCommand extends SWCommand {
|
||||
}
|
||||
|
||||
try {
|
||||
copyNode.saveFromPlayer(player);
|
||||
new SchematicData(copyNode).saveFromPlayer(player);
|
||||
} catch (IOException e) {
|
||||
SchematicSystem.MESSAGE.send("DOWNLOAD_ERROR", player);
|
||||
if(newSchem) {
|
||||
|
@ -101,7 +101,7 @@ public class GUI {
|
||||
|
||||
if(node.getOwner() == user.getId()){
|
||||
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 -> {}));
|
||||
}
|
||||
Material mat = SWItem.getMaterial(node.getItem());
|
||||
@ -115,7 +115,7 @@ public class GUI {
|
||||
}
|
||||
});
|
||||
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);
|
||||
});
|
||||
inv.setItem(7, SWItem.getMaterial("MAGENTA_GLAZED_TERRACOTTA"), SchematicSystem.MESSAGE.parse("GUI_INFO_DOWNLOAD", player), click -> {
|
||||
@ -204,7 +204,7 @@ public class GUI {
|
||||
if(!type.isAssignable())
|
||||
continue;
|
||||
|
||||
SWItem item = new SWItem(type.getMaterial(), type.name());
|
||||
SWItem item = new SWItem(SWItem.getMaterial(type.getMaterial()), type.name());
|
||||
if(type.fightType())
|
||||
item.setEnchanted(true);
|
||||
|
||||
|
@ -183,7 +183,7 @@ public class SchematicCommand extends SWCommand {
|
||||
}
|
||||
|
||||
try {
|
||||
node.saveFromPlayer(player);
|
||||
new SchematicData(node).saveFromPlayer(player);
|
||||
} catch (NoClipboardException e) {
|
||||
SchematicSystem.MESSAGE.send("COMMAND_SAVE_CLIPBOARD_EMPTY", player);
|
||||
if (newSchem)
|
||||
@ -748,7 +748,7 @@ public class SchematicCommand extends SWCommand {
|
||||
if(!nodeNullCheck(messageSender, schematicNode)) {
|
||||
return false;
|
||||
}
|
||||
if(schematicNode.getOwner() != SteamwarUser.get((Player) commandSender).getId()) {
|
||||
if(schematicNode.getOwner() != SteamwarUser.get(((Player) commandSender).getUniqueId()).getId()) {
|
||||
messageSender.send("COMMAND_NOT_OWN");
|
||||
return false;
|
||||
}
|
||||
@ -762,7 +762,7 @@ public class SchematicCommand extends SWCommand {
|
||||
if(!nodeNullCheck(messageSender, schematicNode)) {
|
||||
return false;
|
||||
}
|
||||
if(schematicNode.getOwner() != SteamwarUser.get((Player) commandSender).getId()) {
|
||||
if(schematicNode.getOwner() != SteamwarUser.get(((Player) commandSender).getUniqueId()).getId()) {
|
||||
messageSender.send("COMMAND_NOT_OWN");
|
||||
return false;
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ public class SchematicCommandUtils {
|
||||
}
|
||||
|
||||
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 {
|
||||
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_TYPE", player, SchematicSystem.MESSAGE.parse("UTIL_INFO_TYPE_DIR", player));
|
||||
}
|
||||
@ -361,7 +361,7 @@ public class SchematicCommandUtils {
|
||||
}
|
||||
|
||||
try {
|
||||
node.loadToPlayer(player);
|
||||
new SchematicData(node).loadToPlayer(player);
|
||||
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()});
|
||||
} catch (NoClipboardException e) {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren