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");
|
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 || Fight.onlyPublicSchems()){
|
if(Config.OnlyPublicSchematics){
|
||||||
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)->{});
|
||||||
@ -119,8 +119,10 @@ public class GUI {
|
|||||||
schems = SWListInv.getSchemList(Config.SchematicType, 0);
|
schems = SWListInv.getSchemList(Config.SchematicType, 0);
|
||||||
else if(Config.test())
|
else if(Config.test())
|
||||||
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());
|
||||||
|
}
|
||||||
|
|
||||||
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) -> {
|
||||||
FightTeam fightTeam = Fight.getPlayerTeam(p);
|
FightTeam fightTeam = Fight.getPlayerTeam(p);
|
||||||
|
@ -8,12 +8,14 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class Fight {
|
public class Fight {
|
||||||
private 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 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);
|
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(){
|
public static void init(){
|
||||||
IFight.init(redTeam, blueTeam);
|
IFight.init(redTeam, blueTeam);
|
||||||
@ -109,33 +111,38 @@ public class Fight {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean onlyPublicSchems() {
|
public static int getMaxRank(){
|
||||||
return onlyPublicSchems;
|
return schemRank;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void calcAvailibleSchemTypes() {
|
public static void calcAvailibleSchemTypes() {
|
||||||
if(Config.IgnorePublicOnly){
|
|
||||||
onlyPublicSchems = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Config.OnlyPublicSchematics){
|
if(Config.OnlyPublicSchematics){
|
||||||
onlyPublicSchems = true;
|
schemRank = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Config.event()){
|
if(Config.IgnorePublicOnly || Config.event()){
|
||||||
onlyPublicSchems = false;
|
schemRank = 1000;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(redTeam.getLeader() == null || redTeam.getLeader().getPlayer() == null ||
|
if(redTeam.getLeader() == null || redTeam.getLeader().getPlayer() == null ||
|
||||||
blueTeam.getLeader() == null || blueTeam.getLeader().getPlayer() == null){
|
blueTeam.getLeader() == null || blueTeam.getLeader().getPlayer() == null){
|
||||||
onlyPublicSchems = false;
|
schemRank = 1000;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
onlyPublicSchems = (Schematic.getSchemsOfType(redTeam.getLeader().getPlayer().getUniqueId(), Config.SchematicType).isEmpty() ||
|
schemRank = Math.max(Math.min(schemRank(redTeam.getLeader()), schemRank(blueTeam.getLeader())), 1);
|
||||||
Schematic.getSchemsOfType(blueTeam.getLeader().getPlayer().getUniqueId(), Config.SchematicType).isEmpty());
|
//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