diff --git a/FightSystem_API/src/de/steamwar/fightsystem/Config.java b/FightSystem_API/src/de/steamwar/fightsystem/Config.java index 308d85c..3cdde53 100644 --- a/FightSystem_API/src/de/steamwar/fightsystem/Config.java +++ b/FightSystem_API/src/de/steamwar/fightsystem/Config.java @@ -61,6 +61,7 @@ public class Config { public static final boolean GroundWalkable; //schematic parameter + public static final boolean RanksEnabled; public static final boolean OnlyPublicSchematics; public static final boolean IgnorePublicOnly; public static final de.steamwar.sql.SchematicType SchematicType; @@ -160,6 +161,7 @@ public class Config { double teamBlueSpawnOffsetY = worldconfig.getDouble("Arena.SpawnOffset.y"); double teamBlueSpawnOffsetZ = worldconfig.getDouble("Arena.SpawnOffset.z"); + RanksEnabled = config.getBoolean("Schematic.RanksEnabled"); SchematicType = de.steamwar.sql.SchematicType.fromDB(config.getString("Schematic.SchematicType")); IgnorePublicOnly = config.getBoolean("Schematic.IgnorePublicOnly"); boolean rotate = config.getBoolean("Schematic.Rotate"); diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/commands/GUI.java b/FightSystem_Main/src/de/steamwar/fightsystem/commands/GUI.java index 3b22394..f4e4cc9 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/commands/GUI.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/commands/GUI.java @@ -102,7 +102,7 @@ public class GUI { SWInventory inv = new SWInventory(p, 9, Config.GameName + "-Auswahl"); inv.setItem(8, Material.REDSTONE, "§eÖffentliches " + Config.GameName, (ClickType click) -> schemDialog(p, true)); - if(Config.OnlyPublicSchematics){ + if(Fight.getMaxRank() == 0){ inv.setItem(0, SWItem.getDye(8), (byte)8, "§7Keine privaten Schematics erlaubt", (ClickType click)->{}); }else if(Schematic.getSchemsOfType(p.getUniqueId(), Config.SchematicType).isEmpty() && !Config.test()){ inv.setItem(0, SWItem.getDye(8), (byte)8, "§7Kein privates " + Config.GameName + " vorhanden", (ClickType click)->{}); @@ -121,7 +121,7 @@ public class GUI { schems = SWListInv.getSchemList(null, SteamwarUser.get(p.getUniqueId()).getId()); else{ schems = SWListInv.getSchemList(Config.SchematicType, SteamwarUser.get(p.getUniqueId()).getId()); - schems.removeIf(schem -> schem.getRank() > Fight.getMaxRank()); + schems.removeIf(schem -> schem.getObject().getRank() > Fight.getMaxRank()); } SWListInv inv = new SWListInv<>(p, Config.GameName + "-Auswahl", schems, (ClickType click, Schematic s) -> { diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/fight/Fight.java b/FightSystem_Main/src/de/steamwar/fightsystem/fight/Fight.java index 16c3378..9053ae2 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/fight/Fight.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/fight/Fight.java @@ -112,12 +112,13 @@ public class Fight { } public static int getMaxRank(){ + /* MaxRank of 0 is Pubonly*/ return schemRank; } public static void calcAvailibleSchemTypes() { if(Config.OnlyPublicSchematics){ - schemRank = 1; + schemRank = 0; return; } @@ -132,8 +133,13 @@ public class Fight { return; } - schemRank = Math.max(Math.min(schemRank(redTeam.getLeader()), schemRank(blueTeam.getLeader())), 1); - //TODO: Unranked pubonly + if(Config.RanksEnabled) + schemRank = Math.min(schemRank(redTeam.getLeader()), schemRank(blueTeam.getLeader())); + else if(Schematic.getSchemsOfType(redTeam.getLeader().getPlayer().getUniqueId(), Config.SchematicType).isEmpty() || + Schematic.getSchemsOfType(blueTeam.getLeader().getPlayer().getUniqueId(), Config.SchematicType).isEmpty()) + schemRank = 0; + else + schemRank = 1; } private static int schemRank(FightPlayer fightPlayer){