SteamWar/FightSystem
Archiviert
13
1

Implementing Rank-System

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2020-05-22 10:09:34 +02:00
Ursprung c1bb646579
Commit 4d192ab35d
3 geänderte Dateien mit 13 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -61,6 +61,7 @@ public class Config {
public static final boolean GroundWalkable; public static final boolean GroundWalkable;
//schematic parameter //schematic parameter
public static final boolean RanksEnabled;
public static final boolean OnlyPublicSchematics; public static final boolean OnlyPublicSchematics;
public static final boolean IgnorePublicOnly; public static final boolean IgnorePublicOnly;
public static final de.steamwar.sql.SchematicType SchematicType; public static final de.steamwar.sql.SchematicType SchematicType;
@ -160,6 +161,7 @@ public class Config {
double teamBlueSpawnOffsetY = worldconfig.getDouble("Arena.SpawnOffset.y"); double teamBlueSpawnOffsetY = worldconfig.getDouble("Arena.SpawnOffset.y");
double teamBlueSpawnOffsetZ = worldconfig.getDouble("Arena.SpawnOffset.z"); double teamBlueSpawnOffsetZ = worldconfig.getDouble("Arena.SpawnOffset.z");
RanksEnabled = config.getBoolean("Schematic.RanksEnabled");
SchematicType = de.steamwar.sql.SchematicType.fromDB(config.getString("Schematic.SchematicType")); SchematicType = de.steamwar.sql.SchematicType.fromDB(config.getString("Schematic.SchematicType"));
IgnorePublicOnly = config.getBoolean("Schematic.IgnorePublicOnly"); IgnorePublicOnly = config.getBoolean("Schematic.IgnorePublicOnly");
boolean rotate = config.getBoolean("Schematic.Rotate"); boolean rotate = config.getBoolean("Schematic.Rotate");

Datei anzeigen

@ -102,7 +102,7 @@ public class GUI {
SWInventory inv = new SWInventory(p, 9, Config.GameName + "-Auswahl"); SWInventory inv = new SWInventory(p, 9, Config.GameName + "-Auswahl");
inv.setItem(8, Material.REDSTONE, "§eÖffentliches " + Config.GameName, (ClickType click) -> schemDialog(p, true)); 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)->{}); 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()){ }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)->{}); 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()); schems = SWListInv.getSchemList(null, SteamwarUser.get(p.getUniqueId()).getId());
else{ else{
schems = SWListInv.getSchemList(Config.SchematicType, SteamwarUser.get(p.getUniqueId()).getId()); 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<Schematic> inv = new SWListInv<>(p, Config.GameName + "-Auswahl", schems, (ClickType click, Schematic s) -> { SWListInv<Schematic> inv = new SWListInv<>(p, Config.GameName + "-Auswahl", schems, (ClickType click, Schematic s) -> {

Datei anzeigen

@ -112,12 +112,13 @@ public class Fight {
} }
public static int getMaxRank(){ public static int getMaxRank(){
/* MaxRank of 0 is Pubonly*/
return schemRank; return schemRank;
} }
public static void calcAvailibleSchemTypes() { public static void calcAvailibleSchemTypes() {
if(Config.OnlyPublicSchematics){ if(Config.OnlyPublicSchematics){
schemRank = 1; schemRank = 0;
return; return;
} }
@ -132,8 +133,13 @@ public class Fight {
return; return;
} }
schemRank = Math.max(Math.min(schemRank(redTeam.getLeader()), schemRank(blueTeam.getLeader())), 1); if(Config.RanksEnabled)
//TODO: Unranked pubonly 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){ private static int schemRank(FightPlayer fightPlayer){