Merge pull request 'Rank-System für die neuen WS und WG' (#155) from ranks into master
Reviewed-by: Jan9103 <jan9103@steamwar.de> Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Commit
c27f8bbd82
@ -62,6 +62,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;
|
||||||
@ -162,6 +163,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");
|
||||||
|
@ -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(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)->{});
|
||||||
@ -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.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) -> {
|
||||||
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,44 @@ public class Fight {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean onlyPublicSchems() {
|
public static int getMaxRank(){
|
||||||
return onlyPublicSchems;
|
/* MaxRank of 0 is Pubonly*/
|
||||||
|
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 = 0;
|
||||||
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() ||
|
if(Config.RanksEnabled)
|
||||||
Schematic.getSchemsOfType(blueTeam.getLeader().getPlayer().getUniqueId(), Config.SchematicType).isEmpty());
|
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){
|
||||||
|
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