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