Archiviert
1
0

Remove BauweltMember.build

Dieser Commit ist enthalten in:
yoyosource 2021-04-04 17:52:13 +02:00
Ursprung 9b6b880efb
Commit 56b6e9d94b
2 geänderte Dateien mit 13 neuen und 36 gelöschten Zeilen

Datei anzeigen

@ -79,11 +79,10 @@ public class BauCommand {
case "teleport": case "teleport":
teleport(p, command); teleport(p, command);
break; break;
case "togglebuild": case "info":
if(ownBau && command.length > 2) if (bau != null) {
e.setCancelled(false); e.setCancelled(false);
else }
togglebuild(p, command);
break; break;
case "togglewe": case "togglewe":
if(ownBau && command.length > 2) if(ownBau && command.length > 2)
@ -131,7 +130,7 @@ public class BauCommand {
return; return;
} }
new BauweltMember(p.getUniqueId(), target.getUuid(), true, false, false); new BauweltMember(p.getUniqueId(), target.getUuid(), true, false);
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§aDer Spieler wurde zu deiner Welt hinzugefügt"); BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§aDer Spieler wurde zu deiner Welt hinzugefügt");
ProxiedPlayer z = ProxyServer.getInstance().getPlayer(target.getUuid()); ProxiedPlayer z = ProxyServer.getInstance().getPlayer(target.getUuid());
@ -185,15 +184,6 @@ public class BauCommand {
} }
} }
private static void togglebuild(ProxiedPlayer p, String[] command){
BauweltMember target = toggle(p, command, "togglebuild");
if(target == null)
return;
target.setBuild(!target.isBuild());
isAllowedTo(target.isBuild(), p, target, "bauen");
}
private static void togglewe(ProxiedPlayer p, String[] command){ private static void togglewe(ProxiedPlayer p, String[] command){
BauweltMember target = toggle(p, command, "togglewe"); BauweltMember target = toggle(p, command, "togglewe");
if(target == null) if(target == null)

Datei anzeigen

@ -30,27 +30,25 @@ 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 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)
updateDB(); updateDB();
} }
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); this(SteamwarUser.get(ownerID).getId(), SteamwarUser.get(memberID).getId(), worldEdit, world);
} }
public void remove(){ public void remove(){
@ -58,8 +56,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){
@ -72,10 +70,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 world = member.getBoolean("World"); boolean world = member.getBoolean("World");
return new BauweltMember(ownerID, memberID, build, worldEdit, world, false); return new BauweltMember(ownerID, memberID, worldEdit, world, false);
} catch (SQLException e) { } catch (SQLException e) {
BungeeCore.log("Could not load BauweltMember", e); BungeeCore.log("Could not load BauweltMember", e);
} }
@ -92,10 +89,9 @@ public class BauweltMember{
List<BauweltMember> members = new ArrayList<>(); List<BauweltMember> members = new ArrayList<>();
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 world = memberlist.getBoolean("World"); boolean world = memberlist.getBoolean("World");
members.add(new BauweltMember(bauweltID, memberID, build, worldEdit, world, false)); members.add(new BauweltMember(bauweltID, memberID, worldEdit, world, false));
} }
return members; return members;
}catch(SQLException e){ }catch(SQLException e){
@ -112,15 +108,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;
} }