Adapt to commonDB #131
@ -22,6 +22,7 @@ package de.steamwar.schematicsystem;
|
|||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import de.steamwar.core.VersionDependent;
|
import de.steamwar.core.VersionDependent;
|
||||||
import de.steamwar.sql.NoClipboardException;
|
import de.steamwar.sql.NoClipboardException;
|
||||||
|
import de.steamwar.sql.SchematicData;
|
||||||
import de.steamwar.sql.SchematicNode;
|
import de.steamwar.sql.SchematicNode;
|
||||||
import de.steamwar.sql.SchematicType;
|
import de.steamwar.sql.SchematicType;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -109,7 +110,7 @@ public class CheckSchemType {
|
|||||||
AutoCheckResult result = new AutoCheckResult(this);
|
AutoCheckResult result = new AutoCheckResult(this);
|
||||||
Clipboard clipboard;
|
Clipboard clipboard;
|
||||||
try {
|
try {
|
||||||
clipboard = schematic.load();
|
clipboard = new SchematicData(schematic).load();
|
||||||
} catch (IOException | NoClipboardException e) {
|
} catch (IOException | NoClipboardException e) {
|
||||||
Bukkit.getLogger().log(Level.SEVERE, "Schematic could not be loaded", e);
|
Bukkit.getLogger().log(Level.SEVERE, "Schematic could not be loaded", e);
|
||||||
result.setErrorLoadingSchematic();
|
result.setErrorLoadingSchematic();
|
||||||
|
@ -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) {
|
||||||
|
@ -73,7 +73,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());
|
||||||
@ -82,7 +82,7 @@ public class GUI {
|
|||||||
changeItem(player, node, back);
|
changeItem(player, node, back);
|
||||||
});
|
});
|
||||||
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 -> {
|
||||||
@ -170,7 +170,7 @@ public class GUI {
|
|||||||
if(!type.isAssignable())
|
if(!type.isAssignable())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SWItem item = new SWItem(type.getMaterial(), type.name());
|
SWItem item = new SWItem(SWItem.getMaterial(type.getMaterial()), type.name());
|
||||||
if(type.fightType())
|
if(type.fightType())
|
||||||
item.setEnchanted(true);
|
item.setEnchanted(true);
|
||||||
|
|
||||||
|
@ -183,7 +183,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)
|
||||||
@ -748,7 +748,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;
|
||||||
}
|
}
|
||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,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));
|
||||||
}
|
}
|
||||||
@ -361,7 +361,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) {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren