From 56b6e9d94b44eac7cdcc19d1abd3ccca3b84940c Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 4 Apr 2021 17:52:13 +0200 Subject: [PATCH] Remove BauweltMember.build --- .../bungeecore/commands/BauCommand.java | 18 +++-------- .../bungeecore/sql/BauweltMember.java | 31 ++++++------------- 2 files changed, 13 insertions(+), 36 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index 8f39327..bb891ae 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -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) diff --git a/src/de/steamwar/bungeecore/sql/BauweltMember.java b/src/de/steamwar/bungeecore/sql/BauweltMember.java index e35f0e5..f05cab2 100644 --- a/src/de/steamwar/bungeecore/sql/BauweltMember.java +++ b/src/de/steamwar/bungeecore/sql/BauweltMember.java @@ -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 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; } -- 2.39.5