SteamWar/SpigotCore
Archiviert
13
0

Merge pull request 'Remove BauweltMember.build' (#97) from Permission into master

Reviewed-on: #97
Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
YoyoNow 2021-04-04 18:54:08 +02:00
Commit 3ee0ac2bf1

Datei anzeigen

@ -29,16 +29,14 @@ import java.util.UUID;
public class BauweltMember{ public class BauweltMember{
private final int bauweltID; private final int bauweltID;
private final int memberID; private final int memberID;
private boolean build;
private boolean worldEdit; private boolean worldEdit;
private boolean world; private boolean world;
private static final List<BauweltMember> members = new ArrayList<>(); private static final List<BauweltMember> members = new ArrayList<>();
private BauweltMember(int ownerID, int memberID, boolean build, boolean worldEdit, boolean world, boolean updateDB){ private BauweltMember(int ownerID, int memberID, boolean worldEdit, boolean world, boolean updateDB){
bauweltID = ownerID; bauweltID = ownerID;
this.memberID = memberID; this.memberID = memberID;
this.build = build;
this.worldEdit = worldEdit; this.worldEdit = worldEdit;
this.world = world; this.world = world;
if(updateDB) if(updateDB)
@ -46,12 +44,12 @@ public class BauweltMember{
members.add(this); members.add(this);
} }
public BauweltMember(int ownerID, int memberID, boolean build, boolean worldEdit, boolean world){ public BauweltMember(int ownerID, int memberID, boolean worldEdit, boolean world){
this(ownerID, memberID, build, worldEdit, world, true); this(ownerID, memberID, worldEdit, world, true);
} }
public BauweltMember(UUID ownerID, UUID memberID, boolean build, boolean worldEdit, boolean world){ public BauweltMember(UUID ownerID, UUID memberID, boolean worldEdit, boolean world){
this(SteamwarUser.get(ownerID).getId(), SteamwarUser.get(memberID).getId(), build, worldEdit, world, true); this(SteamwarUser.get(ownerID).getId(), SteamwarUser.get(memberID).getId(), worldEdit, world, true);
} }
public void remove(){ public void remove(){
@ -60,8 +58,8 @@ public class BauweltMember{
} }
private void updateDB(){ private void updateDB(){
SQL.update("INSERT INTO BauweltMember (BauweltID, MemberID, Build, WorldEdit, World) VALUES (?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE Build = VALUES(Build), WorldEdit = VALUES(WorldEdit), World = VALUES(World)", SQL.update("INSERT INTO BauweltMember (BauweltID, MemberID, WorldEdit, World) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE WorldEdit = VALUES(WorldEdit), World = VALUES(World)",
bauweltID, memberID, build, worldEdit, world); bauweltID, memberID, worldEdit, world);
} }
public static BauweltMember getBauMember(UUID ownerID, UUID memberID){ public static BauweltMember getBauMember(UUID ownerID, UUID memberID){
@ -77,10 +75,9 @@ public class BauweltMember{
if(member == null || !member.next()){ if(member == null || !member.next()){
return null; return null;
} }
boolean build = member.getBoolean("Build");
boolean worldEdit = member.getBoolean("WorldEdit"); boolean worldEdit = member.getBoolean("WorldEdit");
boolean testblock = member.getBoolean("World"); boolean testblock = member.getBoolean("World");
return new BauweltMember(ownerID, memberID, build, worldEdit, testblock, false); return new BauweltMember(ownerID, memberID, worldEdit, testblock, false);
} catch (SQLException e) { } catch (SQLException e) {
throw new SecurityException("Did not get member", e); throw new SecurityException("Did not get member", e);
} }
@ -96,10 +93,9 @@ public class BauweltMember{
List<BauweltMember> members = new LinkedList<>(); List<BauweltMember> members = new LinkedList<>();
while(memberlist.next()){ while(memberlist.next()){
int memberID = memberlist.getInt("MemberID"); int memberID = memberlist.getInt("MemberID");
boolean build = memberlist.getBoolean("Build");
boolean worldEdit = memberlist.getBoolean("WorldEdit"); boolean worldEdit = memberlist.getBoolean("WorldEdit");
boolean testblock = memberlist.getBoolean("World"); boolean testblock = memberlist.getBoolean("World");
members.add(new BauweltMember(bauweltID, memberID, build, worldEdit, testblock, false)); members.add(new BauweltMember(bauweltID, memberID, worldEdit, testblock, false));
} }
return members; return members;
}catch(SQLException e){ }catch(SQLException e){
@ -115,15 +111,6 @@ public class BauweltMember{
return memberID; return memberID;
} }
public boolean isBuild() {
return build;
}
public void setBuild(boolean build) {
this.build = build;
updateDB();
}
public boolean isWorldEdit() { public boolean isWorldEdit() {
return worldEdit; return worldEdit;
} }