SteamWar/FightSystem
Archiviert
13
1

Merge branch 'master' into record_extension

Dieser Commit ist enthalten in:
Lixfel 2021-04-23 18:23:07 +02:00
Commit f2dca15953
6 geänderte Dateien mit 56 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -48,4 +48,5 @@ public enum ArenaMode {
public static final Set<ArenaMode> Restartable = Collections.unmodifiableSet(EnumSet.of(NORMAL, RANKED)); public static final Set<ArenaMode> Restartable = Collections.unmodifiableSet(EnumSet.of(NORMAL, RANKED));
public static final Set<ArenaMode> Fight = Collections.unmodifiableSet(EnumSet.of(NORMAL, RANKED, EVENT)); public static final Set<ArenaMode> Fight = Collections.unmodifiableSet(EnumSet.of(NORMAL, RANKED, EVENT));
public static final Set<ArenaMode> SoloLeader = Collections.unmodifiableSet(EnumSet.of(TEST, CHECK, PREPARE)); public static final Set<ArenaMode> SoloLeader = Collections.unmodifiableSet(EnumSet.of(TEST, CHECK, PREPARE));
public static final Set<ArenaMode> NotOnBau = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(TEST, CHECK, PREPARE)));
} }

Datei anzeigen

@ -125,6 +125,7 @@ public class FightSystem extends JavaPlugin {
new LockschemCommand(); new LockschemCommand();
new StateCommand(); new StateCommand();
new SkipCommand(); new SkipCommand();
new WinCommand();
new OneShotStateDependent(ArenaMode.All, FightState.PreRunning, () -> Bukkit.broadcastMessage(PREFIX + "§aDer Kampf beginnt!")); new OneShotStateDependent(ArenaMode.All, FightState.PreRunning, () -> Bukkit.broadcastMessage(PREFIX + "§aDer Kampf beginnt!"));
new OneShotStateDependent(ArenaMode.All, FightState.Running, () -> Bukkit.broadcastMessage(PREFIX + "§aArena freigegeben!")); new OneShotStateDependent(ArenaMode.All, FightState.Running, () -> Bukkit.broadcastMessage(PREFIX + "§aArena freigegeben!"));

Datei anzeigen

@ -0,0 +1,49 @@
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.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;
public class WinCommand implements CommandExecutor {
public WinCommand() {
new StateDependentCommand(ArenaMode.Event, FightState.Ingame, "win", this);
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(!(sender instanceof Player)) {
return false;
}
Player p = (Player) sender;
if (p != FightSystem.getEventLeiter()) {
p.sendMessage(FightSystem.PREFIX + "§cDu bist kein Kampfleiter!");
return false;
}
if(args.length == 0){
p.sendMessage(FightSystem.PREFIX + "/win [Team or Tie]");
return false;
}
if(args[0].equalsIgnoreCase(Fight.getBlueTeam().getName())){
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Kampfleiter hat den Kampf entschieden!");
FightSystem.setSpectateState(Fight.getBlueTeam(), "Referee");
}else if(args[0].equalsIgnoreCase(Fight.getRedTeam().getName())){
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Kampfleiter hat den Kampf entschieden!");
FightSystem.setSpectateState(Fight.getRedTeam(), "Referee");
}else if(args[0].equalsIgnoreCase("tie")){
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Kampfleiter hat den Kampf entschieden!");
FightSystem.setSpectateState(null, "Referee");
}
return false;
}
}

Datei anzeigen

@ -192,7 +192,7 @@ public class FightTeam implements IFightTeam{
if(Kit.getAvailableKits(false).size() > 1 || Config.PersonalKits) if(Kit.getAvailableKits(false).size() > 1 || Config.PersonalKits)
player.getInventory().setItem(1, new ItemBuilder(Material.LEATHER_CHESTPLATE).removeAllAttributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName("§eKit wählen").build()); player.getInventory().setItem(1, new ItemBuilder(Material.LEATHER_CHESTPLATE).removeAllAttributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName("§eKit wählen").build());
player.getInventory().setItem(7, new ItemBuilder(Material.BEACON).removeAllAttributs().setDisplayName("§eRespawn").build()); player.getInventory().setItem(7, new ItemBuilder(Material.BEACON).removeAllAttributs().setDisplayName("§eRespawn").build());
if(!Config.test()) if(ArenaMode.NotOnBau.contains(Config.mode))
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> new TablistNamePacket(SteamwarUser.get(player.getUniqueId()).getId(), prefix + player.getName()).send(player), 5); Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> new TablistNamePacket(SteamwarUser.get(player.getUniqueId()).getId(), prefix + player.getName()).send(player), 5);
RecordSystem.playerJoins(player); RecordSystem.playerJoins(player);
TechHider.reloadChunks(player, chunksToReload, false); TechHider.reloadChunks(player, chunksToReload, false);
@ -217,7 +217,7 @@ public class FightTeam implements IFightTeam{
player.getInventory().clear(); player.getInventory().clear();
if(player.isOnline()){ if(player.isOnline()){
if(!ArenaMode.Test.contains(Config.mode)) if(ArenaMode.NotOnBau.contains(Config.mode))
new TablistNamePacket(SteamwarUser.get(player.getUniqueId()).getId(), "§7" + player.getName()).send(player); new TablistNamePacket(SteamwarUser.get(player.getUniqueId()).getId(), "§7" + player.getName()).send(player);
TechHider.reloadChunks(player, chunksToReload, true); TechHider.reloadChunks(player, chunksToReload, true);
} }

Datei anzeigen

@ -78,7 +78,7 @@ public class Permanent implements Listener {
if (fightTeam == null) { if (fightTeam == null) {
Fight.setPlayerGamemode(player, GameMode.SPECTATOR); Fight.setPlayerGamemode(player, GameMode.SPECTATOR);
player.teleport(Config.SpecSpawn); player.teleport(Config.SpecSpawn);
if(!ArenaMode.Test.contains(Config.mode)) if(ArenaMode.NotOnBau.contains(Config.mode))
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> new TablistNamePacket(SteamwarUser.get(player.getUniqueId()).getId(), "§7" + player.getName()).send(player), 5); Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> new TablistNamePacket(SteamwarUser.get(player.getUniqueId()).getId(), "§7" + player.getName()).send(player), 5);
} }
} }

Datei anzeigen

@ -20,3 +20,4 @@ commands:
lockschem: lockschem:
state: state:
skip: skip:
win: