SteamWar/SpigotCore
Archiviert
13
0

Schematic Nodes #90

Zusammengeführt
Lixfel hat 48 Commits von schematic-node nach master 2021-11-20 13:12:32 +01:00 zusammengeführt
2 geänderte Dateien mit 24 neuen und 13 gelöschten Zeilen
Nur Änderungen aus Commit 6310c9f921 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -29,16 +29,20 @@ public class SchematicMember {
private NodeMember member;
private SchematicMember(NodeMember member){
this.member = member;
private SchematicMember(SchematicNode node, int user, boolean updateDB){
if(updateDB) {
member = NodeMember.createNodeMember(node.getId(), user);
}else {
member = NodeMember.getNodeMember(node.getId(), user);
}
}
public SchematicMember(String schemName, int schemOwner, int schemMember){
this(NodeMember.getNodeMember(SchematicNode.getSchematicNode(schemOwner, schemName, 0).getId(), schemMember));
public SchematicMember(String schemName, int schemOwner, int schemMember, boolean updateDb){
this(SchematicNode.getSchematicNode(schemOwner, schemName, 0), schemMember, updateDb);
}
public SchematicMember(String schemName, UUID schemOwner, UUID schemMember){
this(schemName, SteamwarUser.get(schemOwner).getId(), SteamwarUser.get(schemMember).getId());
this(schemName, SteamwarUser.get(schemOwner).getId(), SteamwarUser.get(schemMember).getId(), true);
}
public static SchematicMember getSchemMemberFromDB(String schemName, UUID schemOwner, UUID schemMember){
@ -46,11 +50,17 @@ public class SchematicMember {
}
public static SchematicMember getSchemMemberFromDB(String schemName, int schemOwner, int schemMember) {
return new SchematicMember(NodeMember.getNodeMember(SchematicNode.getSchematicNode(schemOwner, schemName, 0).getOwner(), schemMember));
return getSchemMemberFromDB(schemName, schemOwner, schemMember, 0);
}
public static SchematicMember getSchemMemberFromDB(String schemName, int schemOwner, int schemMember, int parent) {
SchematicNode node = SchematicNode.getSchematicNode(schemOwner, schemName, parent);
NodeMember member = NodeMember.getNodeMember(node.getId(), schemMember);
return member == null?null:new SchematicMember(node, schemMember, false);
}
public static SchematicMember getMemberBySchematic(String schemName, int schemMember){
return new SchematicMember(NodeMember.getSchematics(schemMember).stream().filter(member1 -> SchematicNode.getSchematicNode(member1.getNode()).getName().equals(schemName)).limit(1).collect(Collectors.toList()).get(0));
return new SchematicMember(SchematicNode.getSchematicNode(NodeMember.getSchematics(schemMember).stream().filter(member1 -> SchematicNode.getSchematicNode(member1.getNode()).getName().equals(schemName)).limit(1).collect(Collectors.toList()).get(0).node), schemMember, false);
}
public static List<SchematicMember> getSchemMembers(String schemName, UUID schemOwner){
@ -58,9 +68,10 @@ public class SchematicMember {
}
public static List<SchematicMember> getSchemMembers(String schemName, int schemOwner){
Set<NodeMember> members = NodeMember.getNodeMembers(SchematicNode.getSchematicNode(schemOwner, schemName, 0).getId());
SchematicNode node = SchematicNode.getSchematicNode(schemOwner, schemName, 0);
Set<NodeMember> members = NodeMember.getNodeMembers(node.getId());
List<SchematicMember> retMembers = new ArrayList<>();
members.forEach(member1 -> retMembers.add(new SchematicMember(member1)));
members.forEach(member1 -> retMembers.add(new SchematicMember(node, member1.member, false)));
return retMembers;
}
@ -70,7 +81,7 @@ public class SchematicMember {
public static List<SchematicMember> getAccessibleSchems(int schemMember){
List<SchematicMember> members = new ArrayList<>();
NodeMember.getSchematics(schemMember).forEach(member1 -> members.add(new SchematicMember(member1)));
NodeMember.getSchematics(schemMember).forEach(member1 -> members.add(new SchematicMember(SchematicNode.getSchematicNode(member1.node), member1.member, false)));
return members;
}

Datei anzeigen

@ -371,9 +371,9 @@ public class SchematicNode {
ResultSet rs = SQL.select("SELECT NodeData FROM SchematicNode WHERE NodeId = ?", id);
try {
rs.next();
Blob schemData = rs.getBlob("SchemData");
Blob schemData = rs.getBlob("NodeData");
if(schemData == null)
throw new IOException("SchemData is null");
throw new IOException("NodeData is null");
InputStream is = schemData.getBinaryStream();
return VersionedCallable.call(new VersionedCallable<>(() -> Schematic_8.getClipboard(is, schemFormat), 8),
new VersionedCallable<>(() -> Schematic_14.getClipboard(is, schemFormat), 14));
@ -388,7 +388,7 @@ public class SchematicNode {
ResultSet rs = SQL.select("SELECT NodeData FROM SchematicNode WHERE NodeId = ?", id);
try {
rs.next();
Blob blob = rs.getBlob("SchemData");
Blob blob = rs.getBlob("NodeData");
if(blob == null)
throw new NoClipboardException();
InputStream is = blob.getBinaryStream();