SteamWar/FightSystem
Archiviert
13
1

hotfixes; split up public and private list;

Signed-off-by: Yaruma3341 <yaruma3341@gmail.com>
Dieser Commit ist enthalten in:
Yaruma3341 2019-04-13 22:01:56 +02:00
Ursprung d9b6c124eb
Commit fac373b5be
3 geänderte Dateien mit 46 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -173,8 +173,18 @@ public class AkCommand implements CommandExecutor {
FightTeam fightTeam = Fight.getPlayerTeam(player); FightTeam fightTeam = Fight.getPlayerTeam(player);
if(fightTeam != null) { if(fightTeam != null) {
if(fightTeam.getFightPlayer(player).isLeader()) { if(fightTeam.getFightPlayer(player).isLeader()) {
Fight.getPlayerTeam(player).sendPlayerSchematicList(Integer.parseInt(args[1]), 15, player, Config.SchematicType); if(args[0].equalsIgnoreCase("public")) {
Fight.getPlayerTeam(player).sendPlayerSchematicList(false, Integer.parseInt(args[1]), 15, player, Config.SchematicType);
return false; return false;
} else {
int page;
try {
page = Integer.parseInt(args[1]);
} catch (NumberFormatException ex) {
return false;
}
Fight.getPlayerTeam(player).sendPlayerSchematicList(false, page, 15, player, Config.SchematicType);
}
} }
} }
} catch (NumberFormatException ex) { } catch (NumberFormatException ex) {

Datei anzeigen

@ -205,9 +205,16 @@ public class FightTeam {
} }
public void sendPlayerSchematicList(int currentPage, int filesPerPage, Player player, SchematicType schematicType) { public void sendPlayerSchematicList(boolean publicSchematics, int currentPage, int filesPerPage, Player player, SchematicType schematicType) {
List<Schematic> preSchematicList = Schematic.getSchemsAccessibleByUser(player.getUniqueId());
List<Schematic> preSchematicList;
List<Schematic> schematicList = new ArrayList<>(); List<Schematic> schematicList = new ArrayList<>();
if(publicSchematics) {
preSchematicList = Schematic.getSchemsOfType(0, schematicType);
} else {
preSchematicList = Schematic.getSchemsAccessibleByUser(player.getUniqueId());
}
for(Schematic s : preSchematicList) { for(Schematic s : preSchematicList) {
if(s.getSchemType() == schematicType) if(s.getSchemType() == schematicType)
schematicList.add(s); schematicList.add(s);

Datei anzeigen

@ -10,6 +10,11 @@ import me.yaruma.fightsystem.utils.countdown.Countdown;
import me.yaruma.fightsystem.utils.countdown.CountdownType; import me.yaruma.fightsystem.utils.countdown.CountdownType;
import me.yaruma.fightsystem.utils.countdown.FinishSetupOver; import me.yaruma.fightsystem.utils.countdown.FinishSetupOver;
import me.yaruma.fightsystem.utils.inventory.SetupItems; import me.yaruma.fightsystem.utils.inventory.SetupItems;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -32,14 +37,32 @@ public class PlayerJoinListener implements Listener {
player.getInventory().clear(); player.getInventory().clear();
if (Fight.getPlayerTeam(player) == null) { if (Fight.getPlayerTeam(player) == null) {
//TEXT COMPONENTS
TextComponent publicList = new TextComponent("public");
publicList.setColor(ChatColor.GOLD);
publicList.setBold(true);
publicList.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§ePublic Liste...").create()));
publicList.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ak schemlist public"));
TextComponent privateList = new TextComponent("private");
publicList.setColor(ChatColor.GOLD);
publicList.setBold(true);
publicList.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§ePrivate Liste...").create()));
publicList.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ak schemlist 0"));
publicList.addExtra(privateList);
player.spigot().sendMessage(publicList);
//TEXT COMPONENTS
if(!Fight.getRedTeam().hasTeamLeader()) { if(!Fight.getRedTeam().hasTeamLeader()) {
Fight.getRedTeam().setLeader(new FightPlayer(player, false)); Fight.getRedTeam().setLeader(new FightPlayer(player, false));
Fight.getRedTeam().sendPlayerSchematicList(0, 15, player, Config.SchematicType);
player.setGameMode(GameMode.ADVENTURE); player.setGameMode(GameMode.ADVENTURE);
player.spigot().sendMessage(publicList);
} else if(!Fight.getBlueTeam().hasTeamLeader()) { } else if(!Fight.getBlueTeam().hasTeamLeader()) {
Fight.getBlueTeam().setLeader(new FightPlayer(player, false)); Fight.getBlueTeam().setLeader(new FightPlayer(player, false));
Fight.getBlueTeam().sendPlayerSchematicList(0, 15, player, Config.SchematicType);
player.setGameMode(GameMode.ADVENTURE); player.setGameMode(GameMode.ADVENTURE);
player.spigot().sendMessage(publicList);
} else { } else {
player.setGameMode(GameMode.SPECTATOR); player.setGameMode(GameMode.SPECTATOR);
player.teleport(Config.SpecSpawn); player.teleport(Config.SpecSpawn);