SteamWar/FightSystem
Archiviert
13
1

WIP join anytime
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2022-08-04 17:33:53 +02:00
Ursprung 4a59c93042
Commit d82fa59ed4
17 geänderte Dateien mit 295 neuen und 183 gelöschten Zeilen

Datei anzeigen

@ -91,6 +91,7 @@ public class FightSystem extends JavaPlugin {
new BlockFadeListener();
new LeaveableArena();
new HotbarKit.HotbarKitListener();
new JoinRequestListener();
new OneShotStateDependent(ArenaMode.All, FightState.PreSchemSetup, () -> Fight.playSound(SWSound.BLOCK_NOTE_PLING.getSound(), 100.0f, 2.0f));
new EnterHandler();
@ -133,7 +134,6 @@ public class FightSystem extends JavaPlugin {
new TBCommand();
new DeclineCommand();
new GamemodeCommand();
new InviteCommand();
new ReadyCommand();
new AkCommand();
new LeaderCommand();

Datei anzeigen

@ -239,3 +239,10 @@ WIN_LESS_DAMAGE={0} §7less damaged
WIN_POINTS={0} has more points
WIN_POINTS_EQUAL=§7Equal points
WIN_TECHKO={0} §7is tech K.O.
# Invites
JOIN_REQUEST=§7Request participation
JOIN_REQUEST_TITLE=Request participation
JOIN_REQUEST_ALREADY=§cYou have already sent a participation request
JOIN_REQUEST_TEAM=§eJoin {0}

Datei anzeigen

@ -224,3 +224,21 @@ WIN_LESS_DAMAGE={0} §7weniger beschädigt
WIN_POINTS={0} hat mehr Punkte
WIN_POINTS_EQUAL=§7Gleicher Punktestand
WIN_TECHKO={0} §7ist Tech K.O.
# Invites
JOIN_REQUEST=§7Teambeitritt anfragen
JOIN_REQUEST_TITLE=Teambeitritt anfragen
JOIN_REQUEST_ALREADY=§cDu hast bereits ein Team um Beitritt angefragt
JOIN_REQUEST_TEAM={0} §ebeitreten
REQUESTS=§7Offene Beitrittsanfragen
REQUESTS_TITLE=Offene Beitrittsanfragen
REQUEST_DECLINED=§cBeitritt von {0} abgelehnt
YOUR_REQUEST_DECLINED=§cDeine Betrittsanfrage wurde abgelehnt
UNKNOWN_PLAYER=§cUnbekannter Spieler
NO_JOIN_REQUEST=§cDer Spieler hat noch keinen Beitritt angefragt
NO_CONFIRMATION=§cKeine Zustimmung nötig
ACCEPT_USAGE=§8/§7accept §8[§eSpieler§8]
DECLINE_USAGE=§8/§7decline §8[§eSpieler§8]

Datei anzeigen

@ -20,13 +20,20 @@
package de.steamwar.fightsystem.commands;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.fight.JoinRequest;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCommand;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.function.BiConsumer;
public class AcceptCommand implements CommandExecutor {
public AcceptCommand() {
@ -35,12 +42,45 @@ public class AcceptCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(!(sender instanceof Player)) {
return false;
}
Player player = (Player) sender;
Commands.acceptInvitation(player);
onJoinRequest(sender, args, "ACCEPT_USAGE", JoinRequest::accept);
return false;
}
public static void onJoinRequest(CommandSender sender, String[] args, String usage, BiConsumer<JoinRequest, FightTeam> handleJoinRequest) {
if(!(sender instanceof Player)) {
return;
}
Player player = (Player) sender;
if(Commands.checkGetLeader(player) == null)
return;
if(args.length == 0) {
FightSystem.getMessage().send(usage, sender);
return;
}
Player target = Bukkit.getPlayer(args[0]);
if(target == null) {
FightSystem.getMessage().send("UNKNOWN_PLAYER", player);
return;
}
onJoinRequest(player, target, handleJoinRequest);
}
public static void onJoinRequest(Player player, Player target, BiConsumer<JoinRequest, FightTeam> handleJoinRequest) {
JoinRequest request = JoinRequest.get(target);
if(request == null) {
FightSystem.getMessage().send("NO_JOIN_REQUEST", player);
return;
}
FightTeam team = Fight.getPlayerTeam(player);
if(!request.required(team)) {
FightSystem.getMessage().send("NO_CONFIRMATION", player);
return;
}
handleJoinRequest.accept(request, team);
}
}

Datei anzeigen

@ -47,14 +47,6 @@ public class Commands {
return false;
}
private static FightTeam checkGetInvitedTeam(Player p){
FightTeam fightTeam = Fight.getInvitedTeam(p);
if(fightTeam == null){
FightSystem.getMessage().sendPrefixless("NO_INVITATION", p, ChatMessageType.ACTION_BAR);
}
return fightTeam;
}
private static FightPlayer checkGetPlayer(Player p){
FightPlayer fightPlayer = Fight.getFightPlayer(p);
if(fightPlayer == null){
@ -104,30 +96,6 @@ public class Commands {
fightTeam.skip();
}
static void acceptInvitation(Player p){
if(checkSetup(p))
return;
FightTeam team = checkGetInvitedTeam(p);
if(team == null)
return;
team.addMember(p);
}
static void declineInvitation(Player p){
if(checkSetup(p))
return;
FightTeam team = checkGetInvitedTeam(p);
if(team == null)
return;
FightSystem.getMessage().sendPrefixless("INVITATION_DECLINED", p, ChatMessageType.ACTION_BAR);
team.broadcast("INVITATION_DECLINED_TEAM", p.getName());
team.getInvited().remove(p);
}
static void leaveTeam(Player p){
if(checkSetup(p))
return;
@ -139,37 +107,6 @@ public class Commands {
fightTeam.removePlayer(p);
}
static void invite(Player p, String invited){
if(checkSetup(p))
return;
FightTeam fightTeam = checkGetTeam(p);
if(fightTeam == null)
return;
FightPlayer fightPlayer = checkGetLeader(p);
if(fightPlayer == null)
return;
Player target = checkGetPlayer(p, invited);
if(target == null)
return;
if(Fight.getPlayerTeam(target) != null) {
FightSystem.getMessage().sendPrefixless("PLAYER_IN_TEAM", p, ChatMessageType.ACTION_BAR, target.getName());
return;
}
if(Fight.getOpposite(fightTeam).getInvited().contains(target) || fightTeam.getInvited().contains(target)) {
FightSystem.getMessage().sendPrefixless("ALREADY_INVITED", p, ChatMessageType.ACTION_BAR, target.getName());
return;
}
FightSystem.getMessage().sendPrefixless("INVITATION_SENT", p, ChatMessageType.ACTION_BAR, target.getName());
fightTeam.getInvited().add(target);
GUI.invitation(p, target);
}
static void kick(Player p, String kicked){
if(checkSetup(p))
return;

Datei anzeigen

@ -20,12 +20,12 @@
package de.steamwar.fightsystem.commands;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.fight.JoinRequest;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCommand;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class DeclineCommand implements CommandExecutor {
@ -35,12 +35,7 @@ public class DeclineCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(!(sender instanceof Player)) {
return false;
}
Player player = (Player) sender;
Commands.declineInvitation(player);
AcceptCommand.onJoinRequest(sender, args, "DECLINE_USAGE", JoinRequest::decline);
return false;
}
}

Datei anzeigen

@ -21,10 +21,7 @@ package de.steamwar.fightsystem.commands;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.fight.Kit;
import de.steamwar.fightsystem.fight.*;
import de.steamwar.fightsystem.listener.PersonalKitCreator;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.inventory.*;
@ -47,23 +44,23 @@ public class GUI {
private static final Message msg = FightSystem.getMessage();
static void invitation(Player p, Player target){
SWInventory inv = new SWInventory(target, 9, msg.parse("INVITATION_TITLE", target, p.getName()));
inv.setItem(0, SWItem.getDye(10), (byte)10, msg.parse("INVITATION_ACCEPT", target), (ClickType click) ->{
Commands.acceptInvitation(target);
target.closeInventory();
private static void addTeamRequest(Player p, SWInventory inv, int pos, FightTeam team) {
int colorCode = team.getColor().ordinal();
inv.setItem(pos, SWItem.getDye(colorCode), (byte)colorCode, msg.parse("JOIN_REQUEST_TEAM", p, team.getColoredName()), click -> {
p.closeInventory();
new JoinRequest(p, team);
});
inv.setItem(8, SWItem.getDye(1), (byte)1, msg.parse("INVITATION_DECLINE", target), (ClickType click) ->{
Commands.declineInvitation(target);
target.closeInventory();
});
inv.addCloseCallback((ClickType click) ->{
if(Fight.getInvitedTeam(target) != null){
msg.sendPrefixless("INVITATION_CHAT_ACCEPT", target);
msg.sendPrefixless("INVITATION_CHAT_DECLINE", target);
}
});
inv.setCallback(-999, (ClickType click) -> target.closeInventory());
}
public static void joinRequest(Player p) {
if(JoinRequest.get(p) != null) {
msg.sendPrefixless("JOIN_REQUEST_ALREADY", p, ChatMessageType.ACTION_BAR);
return;
}
SWInventory inv = new SWInventory(p, 9, msg.parse("JOIN_REQUEST_TITLE", p));
addTeamRequest(p, inv, 0, Fight.getBlueTeam());
addTeamRequest(p, inv, 8, Fight.getRedTeam());
inv.open();
}
@ -84,12 +81,11 @@ public class GUI {
inv.open();
}
public static void chooseInvitation(Player p){
List<SWListInv.SWListEntry<UUID>> players = SWListInv.createPlayerList(p.getUniqueId());
players.removeIf(swItemUUIDPair -> Fight.getFightPlayer(Bukkit.getPlayer(swItemUUIDPair.getObject())) != null);
SWListInv<UUID> inv = new SWListInv<>(p, msg.parse("INVITE_TITLE", p), players, (ClickType click, UUID player) -> {
Commands.invite(p, SteamwarUser.get(player).getUserName());
public static void chooseJoinRequests(Player p){
List<SWListInv.SWListEntry<Player>> players = JoinRequest.openRequests(Fight.getPlayerTeam(p));
SWListInv<Player> inv = new SWListInv<>(p, msg.parse("REQUESTS_TITLE", p), players, (ClickType click, Player player) -> {
p.closeInventory();
AcceptCommand.onJoinRequest(p, player, click.isLeftClick() ? JoinRequest::accept : JoinRequest::decline);
});
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
inv.open();

Datei anzeigen

@ -1,52 +0,0 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.commands;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCommand;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class InviteCommand implements CommandExecutor {
public InviteCommand() {
new StateDependentCommand(ArenaMode.VariableTeams, FightState.Setup, "invite", this);
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(!(sender instanceof Player)) {
return false;
}
Player player = (Player) sender;
if(args.length != 1){
FightSystem.getMessage().sendPrefixless("INVITE_HELP", player);
return false;
}
Commands.invite(player, args[0]);
return false;
}
}

Datei anzeigen

@ -25,17 +25,32 @@ import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.SWSound;
import de.steamwar.fightsystem.utils.TechHider;
import de.steamwar.fightsystem.winconditions.Wincondition;
import net.md_5.bungee.api.ChatMessageType;
import java.util.List;
public class EnternCountdown extends Countdown {
private static int calcTime(FightPlayer fp) {
int time = Config.EnterStages.get(fp.getKit().getEnterStage());
Countdown countdown = Wincondition.getTimeOverCountdown();
if(countdown != null) {
time -= Config.TimeoutTime - countdown.getTimeLeft();
if(time < 0)
time = 0;
}
return time;
}
private final FightPlayer fightPlayer;
private List<TechHider.ChunkPos> chunkPos;
public EnternCountdown(FightPlayer fp) {
super(Config.EnterStages.get(fp.getKit().getEnterStage()), new Message("ENTERN_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false);
super(calcTime(fp), new Message("ENTERN_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false);
fightPlayer = fp;
enable();
}

Datei anzeigen

@ -63,14 +63,6 @@ public class Fight {
throw new IllegalArgumentException();
}
public static FightTeam getInvitedTeam(Player player){
if(redTeam.getInvited().contains(player))
return redTeam;
else if(blueTeam.getInvited().contains(player))
return blueTeam;
return null;
}
public static FightPlayer getFightPlayer(Player player) {
if(redTeam.isPlayerInTeam(player))
return redTeam.getFightPlayer(player);

Datei anzeigen

@ -48,13 +48,18 @@ public class FightPlayer {
kills = 0;
}
public void revive() {
isOut = false;
}
public void setOut() {
isOut = true;
stopEnternCountdown();
}
public void setEnternCountdown(EnternCountdown countdown){
enternCountdown = countdown;
public void startEnternCountdown() {
if(Config.EnterStages.size() > kit.getEnterStage() && kit.getEnterStage() >= 0)
enternCountdown = new EnternCountdown(this);
}
public void stopEnternCountdown(){

Datei anzeigen

@ -64,7 +64,7 @@ public class FightTeam {
setKitButton(notReadyKit, true);
if(!ArenaMode.RankedEvent.contains(Config.mode)){
notReadyKit.setItem(2, "INVITE_PLAYERS", new ItemBuilder(Material.PAPER).removeAllAttributes().build(), GUI::chooseInvitation);
notReadyKit.setItem(2, "REQUESTS", new ItemBuilder(Material.PAPER).removeAllAttributes().build(), GUI::chooseJoinRequests);
notReadyKit.setItem(3, "REMOVE_PLAYERS", new ItemBuilder(SWItem.getMaterial("FIREWORK_CHARGE")).removeAllAttributes().build(), GUI::chooseRemove);
}
@ -88,7 +88,6 @@ public class FightTeam {
private int schemRank;
private final Map<Player, FightPlayer> players = new HashMap<>();
private final Set<Player> invited = new HashSet<>();
private String name;
private String prefix;
@ -198,7 +197,6 @@ public class FightTeam {
skip = false;
ready = false;
schematic.reset();
invited.clear();
Set<Player> playerSet = new HashSet<>(players.keySet());
for(Player player : playerSet){
@ -243,20 +241,28 @@ public class FightTeam {
addMember(player, false);
}
public void addMember(Player player, boolean silent) {
private void addMember(Player player, boolean silent) {
final List<TechHider.ChunkPos> chunksToReload = TechHider.prepareChunkReload(player, false);
FightPlayer fightPlayer = new FightPlayer(player, this);
FightPlayer fightPlayer = getFightPlayer(player) != null ? getFightPlayer(player) : new FightPlayer(player, this);
fightPlayer.revive();
players.put(player, fightPlayer);
invited.remove(player);
team.addEntry(player.getName());
Fight.setPlayerGamemode(player, GameMode.SURVIVAL);
player.setHealth(20);
player.setFoodLevel(20);
player.getInventory().clear();
BountifulWrapper.impl.setAttackSpeed(player);
player.teleport(spawn);
memberKit.loadToPlayer(player);
if(FightState.Spectate.contains(FightState.getFightState())) {
Fight.setPlayerGamemode(player, GameMode.SPECTATOR);
} else {
Fight.setPlayerGamemode(player, GameMode.SURVIVAL);
(FightState.ingame() ? fightPlayer.getKit() : memberKit).loadToPlayer(player);
}
if(FightState.Running.contains(FightState.getFightState()))
fightPlayer.startEnternCountdown();
GlobalRecorder.getInstance().playerJoins(player);
TechHider.reloadChunks(player, chunksToReload, false);
@ -286,6 +292,7 @@ public class FightTeam {
if(player.isOnline()){
TechHider.reloadChunks(player, chunksToReload, true);
HotbarKit.spectatorKit.loadToPlayer(player);
}
}
@ -414,10 +421,6 @@ public class FightTeam {
}
}
public Set<Player> getInvited() {
return invited;
}
public String getName() {
return name;
}

Datei anzeigen

@ -23,9 +23,12 @@ import de.steamwar.core.Core;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.commands.GUI;
import de.steamwar.fightsystem.listener.PersonalKitCreator;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.ItemBuilder;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -42,6 +45,12 @@ import java.util.function.Consumer;
public class HotbarKit extends Kit {
public static final HotbarKit spectatorKit = new HotbarKit();
static {
for(int i = 0; i < 9; i++)
spectatorKit.setItem(i, "JOIN_REQUEST", new ItemBuilder(Material.PAPER).removeAllAttributes().build(), GUI::joinRequest);
}
private static final int HOTBAR_SIZE = 9;
private final String[] nameTags;
@ -82,7 +91,7 @@ public class HotbarKit extends Kit {
public static class HotbarKitListener implements Listener {
public HotbarKitListener() {
new StateDependentListener(ArenaMode.AntiReplay, FightState.Setup, this);
new StateDependentListener(ArenaMode.AntiReplay, FightState.All, this);
}
@EventHandler

Datei anzeigen

@ -0,0 +1,88 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2022 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.fight;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.inventory.SWItem;
import de.steamwar.inventory.SWListInv;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.entity.Player;
import java.util.*;
import java.util.stream.Collectors;
public class JoinRequest {
private static final Map<Player, JoinRequest> activeRequests = new HashMap<>();
public static List<SWListInv.SWListEntry<Player>> openRequests(FightTeam team) {
//TODO set lore
return activeRequests.values().stream().filter(request -> request.waitOnApproval.contains(team)).map(request -> new SWListInv.SWListEntry<>(SWItem.getPlayerSkull(request.player), request.player)).collect(Collectors.toList());
}
public static void clearRequests() {
//TODO notify players
activeRequests.forEach((player, joinRequest) -> {
});
activeRequests.clear();
}
public static JoinRequest get(Player player) {
return activeRequests.get(player);
}
private final Player player;
private final FightTeam team;
private final Set<FightTeam> waitOnApproval;
public JoinRequest(Player player, FightTeam team) {
this.player = player;
this.team = team;
this.waitOnApproval = new HashSet<>(FightState.ingame() ? Fight.teams() : Collections.singleton(team));
//TODO send request out
activeRequests.put(player, new JoinRequest(player, team));
}
public boolean required(FightTeam decider) {
return waitOnApproval.contains(decider);
}
public void accept(FightTeam acceptor) {
waitOnApproval.remove(acceptor);
if(waitOnApproval.isEmpty()) {
team.addMember(player);
activeRequests.remove(player);
}
}
public void decline() {
FightSystem.getMessage().sendPrefixless("YOUR_REQUEST_DECLINED", player, ChatMessageType.ACTION_BAR);
waitOnApproval.forEach(t -> t.broadcast("REQUEST_DECLINED", player.getName()));
silentDecline();
}
public void silentDecline() {
activeRequests.remove(player);
}
}

Datei anzeigen

@ -0,0 +1,63 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2022 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.HotbarKit;
import de.steamwar.fightsystem.fight.JoinRequest;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.OneShotStateDependent;
import de.steamwar.fightsystem.states.StateDependentListener;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
public class JoinRequestListener implements Listener {
public JoinRequestListener() {
new OneShotStateDependent(ArenaMode.VariableTeams, FightState.PreLeaderSetup, () -> Bukkit.getScheduler().runTask(FightSystem.getPlugin(), JoinRequest::clearRequests));
new OneShotStateDependent(ArenaMode.VariableTeams, FightState.PreRunning, () -> Bukkit.getScheduler().runTask(FightSystem.getPlugin(), JoinRequest::clearRequests));
new StateDependentListener(ArenaMode.VariableTeams, FightState.All, this);
}
@EventHandler(priority = EventPriority.HIGH)
public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
if (!Config.ArenaLeaveable && !Fight.fighting(player)) {
HotbarKit.spectatorKit.loadToPlayer(player);
}
}
@EventHandler
public void onLeave(PlayerQuitEvent event) {
JoinRequest request = JoinRequest.get(event.getPlayer());
if(request != null)
request.silentDecline();
}
}

Datei anzeigen

@ -19,8 +19,6 @@
package de.steamwar.fightsystem.utils;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.countdown.EnternCountdown;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.fight.FightTeam;
@ -53,8 +51,7 @@ public class EnterHandler implements IStateDependent {
private void registerTeam(FightTeam team){
for(FightPlayer fp : team.getPlayers()){
if(Config.EnterStages.size() > fp.getKit().getEnterStage() && fp.getKit().getEnterStage() >= 0)
fp.setEnternCountdown(new EnternCountdown(fp));
fp.startEnternCountdown();
}
}

Datei anzeigen

@ -15,7 +15,6 @@ commands:
accept:
decline:
leave:
invite:
ready:
kit:
remove: