SteamWar/FightSystem
Archiviert
13
1

Merge branch 'schematiclessPublicOnly' of SteamWar/FightSystem into master

Dieser Commit ist enthalten in:
Lixfel 2020-01-18 14:43:37 +01:00 committet von Gitea
Commit 11da798b4e
3 geänderte Dateien mit 20 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -108,6 +108,7 @@ public class FightSystem extends JavaPlugin {
throw new SecurityException(fightState.name());
setFightState(FightState.PRE_SCHEM_SETUP);
Fight.calcAvailibleSchemTypes();
mainCountdown = new PreSchemPasteCountdown();
}

Datei anzeigen

@ -7,6 +7,7 @@ import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.kit.Kit;
import de.steamwar.fightsystem.kit.KitManager;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.inventory.SWInventory;
import de.steamwar.inventory.SWItem;
import de.steamwar.inventory.SWListInv;
@ -75,6 +76,7 @@ public class GUI {
FightPlayer fightPlayer = Fight.getFightPlayer(p);
if(fightPlayer == null)
return;
List<Pair<SWItem, Kit>> iconList = new ArrayList<>();
List<Kit> kitList = KitManager.getKits(fightPlayer.isLeader());
@ -88,9 +90,14 @@ public class GUI {
}
public static void preSchemDialog(Player p){
if(!Config.test() && FightSystem.getFightState() != FightState.PRE_SCHEM_SETUP){
p.sendMessage(FightSystem.PREFIX + "§cDu kannst ohne Gegner keine Schematic wählen");
return;
}
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(Config.OnlyPublicSchematics || Fight.onlyPublicSchems()){
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)->{});

Datei anzeigen

@ -1,8 +1,7 @@
package de.steamwar.fightsystem.fight;
import de.steamwar.core.Core;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.sql.Schematic;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Material;
@ -14,6 +13,7 @@ public class 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;
public static void init(){
IFight.init(redTeam, blueTeam);
@ -108,4 +108,13 @@ public class Fight {
}
}
}
public static boolean onlyPublicSchems() {
return onlyPublicSchems;
}
public static void calcAvailibleSchemTypes() {
onlyPublicSchems = (Schematic.getSchemsOfType(redTeam.getLeader().getPlayer().getUniqueId(), Config.SchematicType).isEmpty() ||
Schematic.getSchemsOfType(blueTeam.getLeader().getPlayer().getUniqueId(), Config.SchematicType).isEmpty());
}
}