First rank prototype
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
ac6b441815
Commit
9f3e658636
@ -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 || Fight.onlyPublicSchems()){
|
||||
if(Config.OnlyPublicSchematics){
|
||||
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)->{});
|
||||
@ -119,8 +119,10 @@ public class GUI {
|
||||
schems = SWListInv.getSchemList(Config.SchematicType, 0);
|
||||
else if(Config.test())
|
||||
schems = SWListInv.getSchemList(null, SteamwarUser.get(p.getUniqueId()).getId());
|
||||
else
|
||||
else{
|
||||
schems = SWListInv.getSchemList(Config.SchematicType, SteamwarUser.get(p.getUniqueId()).getId());
|
||||
schems.removeIf(schem -> schem.getRank() > Fight.getMaxRank());
|
||||
}
|
||||
|
||||
SWListInv<Schematic> inv = new SWListInv<>(p, Config.GameName + "-Auswahl", schems, (ClickType click, Schematic s) -> {
|
||||
FightTeam fightTeam = Fight.getPlayerTeam(p);
|
||||
|
@ -8,12 +8,14 @@ import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Fight {
|
||||
private Fight(){}
|
||||
|
||||
public static final FightTeam redTeam = new FightTeam(Config.TeamRedName, Config.TeamRedPrefix, Config.TeamRedSpawn, Config.TeamRedCornerX, Config.TeamRedCornerY, Config.TeamRedCornerZ, Config.TeamRedRotate, false, Config.RedLeader);
|
||||
public static final FightTeam blueTeam = new FightTeam(Config.TeamBlueName, Config.TeamBluePrefix, Config.TeamBlueSpawn, Config.TeamBlueCornerX, Config.TeamBlueCornerY, Config.TeamBlueCornerZ, Config.TeamBlueRotate, true, Config.BlueLeader);
|
||||
private static boolean onlyPublicSchems;
|
||||
private static int schemRank;
|
||||
|
||||
public static void init(){
|
||||
IFight.init(redTeam, blueTeam);
|
||||
@ -109,33 +111,38 @@ public class Fight {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean onlyPublicSchems() {
|
||||
return onlyPublicSchems;
|
||||
public static int getMaxRank(){
|
||||
return schemRank;
|
||||
}
|
||||
|
||||
public static void calcAvailibleSchemTypes() {
|
||||
if(Config.IgnorePublicOnly){
|
||||
onlyPublicSchems = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if(Config.OnlyPublicSchematics){
|
||||
onlyPublicSchems = true;
|
||||
schemRank = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if(Config.event()){
|
||||
onlyPublicSchems = false;
|
||||
if(Config.IgnorePublicOnly || Config.event()){
|
||||
schemRank = 1000;
|
||||
return;
|
||||
}
|
||||
|
||||
if(redTeam.getLeader() == null || redTeam.getLeader().getPlayer() == null ||
|
||||
blueTeam.getLeader() == null || blueTeam.getLeader().getPlayer() == null){
|
||||
onlyPublicSchems = false;
|
||||
schemRank = 1000;
|
||||
return;
|
||||
}
|
||||
|
||||
onlyPublicSchems = (Schematic.getSchemsOfType(redTeam.getLeader().getPlayer().getUniqueId(), Config.SchematicType).isEmpty() ||
|
||||
Schematic.getSchemsOfType(blueTeam.getLeader().getPlayer().getUniqueId(), Config.SchematicType).isEmpty());
|
||||
schemRank = Math.max(Math.min(schemRank(redTeam.getLeader()), schemRank(blueTeam.getLeader())), 1);
|
||||
//TODO: Unranked pubonly
|
||||
}
|
||||
|
||||
private static int schemRank(FightPlayer fightPlayer){
|
||||
int rank = 1;
|
||||
List<Schematic> schematics = Schematic.getSchemsOfType(fightPlayer.getPlayer().getUniqueId(), Config.SchematicType);
|
||||
for(Schematic schem : schematics){
|
||||
if(schem.getRank() > rank)
|
||||
rank = schem.getRank();
|
||||
}
|
||||
return rank;
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren