SteamWar/BungeeCore
Archiviert
13
2

Remove BauweltMember.build #193

Manuell gemergt
YoyoNow hat 2 Commits von Permission nach master 2021-04-04 18:03:58 +02:00 zusammengeführt
2 geänderte Dateien mit 13 neuen und 36 gelöschten Zeilen
Nur Änderungen aus Commit 56b6e9d94b werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -79,11 +79,10 @@ public class BauCommand {
case "teleport":
teleport(p, command);
break;
case "togglebuild":
if(ownBau && command.length > 2)
case "info":
if (bau != null) {
e.setCancelled(false);
else
togglebuild(p, command);
}
break;
case "togglewe":
if(ownBau && command.length > 2)
@ -131,7 +130,7 @@ public class BauCommand {
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");
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){
BauweltMember target = toggle(p, command, "togglewe");
if(target == null)

Datei anzeigen

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