Signed-off-by: Yaruma3341 <yaruma3341@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
02792c325f
Commit
4303f9a5ea
@ -4,6 +4,7 @@ import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
|||||||
import me.yaruma.fightsystem.commands.AkCommand;
|
import me.yaruma.fightsystem.commands.AkCommand;
|
||||||
import me.yaruma.fightsystem.fight.FightManager;
|
import me.yaruma.fightsystem.fight.FightManager;
|
||||||
import me.yaruma.fightsystem.fight.FightState;
|
import me.yaruma.fightsystem.fight.FightState;
|
||||||
|
import me.yaruma.fightsystem.fight.FightTeam;
|
||||||
import me.yaruma.fightsystem.listener.*;
|
import me.yaruma.fightsystem.listener.*;
|
||||||
import me.yaruma.fightsystem.manager.FileManager;
|
import me.yaruma.fightsystem.manager.FileManager;
|
||||||
import me.yaruma.fightsystem.utils.Coordinates;
|
import me.yaruma.fightsystem.utils.Coordinates;
|
||||||
@ -160,9 +161,13 @@ public class FightSystem extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSpectateState() {
|
public void setSpectateState(FightTeam winFightTeam) {
|
||||||
if(this.fightState == FightState.RUNNING) {
|
if(this.fightState == FightState.RUNNING) {
|
||||||
this.fightState = FightState.SPECTATE;
|
this.fightState = FightState.SPECTATE;
|
||||||
|
|
||||||
|
Bukkit.broadcastMessage(" ");
|
||||||
|
Bukkit.broadcastMessage(FightSystem.PREFIX + "§aDas Team von §6" + winFightTeam.getLeader().getPlayer().getName() + " §ahat gewonnen!");
|
||||||
|
plugin.getFightManager().teleportAllToFightSpawn();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ public class AkCommand implements CommandExecutor {
|
|||||||
|
|
||||||
Player target = Bukkit.getPlayer(args[1]);
|
Player target = Bukkit.getPlayer(args[1]);
|
||||||
if(target != null) {
|
if(target != null) {
|
||||||
if(!(Fight.getOpposite(fightTeam).getInvited().contains(player) && fightTeam.getInvited().contains(target))) {
|
if(!(Fight.getOpposite(fightTeam).getInvited().contains(target) && fightTeam.getInvited().contains(target))) {
|
||||||
fightTeam.getInvited().add(target);
|
fightTeam.getInvited().add(target);
|
||||||
player.sendMessage(FightSystem.PREFIX + "§aDu hast den Spieler §6" + target.getName() + " §ain dein Team eingeladen!");
|
player.sendMessage(FightSystem.PREFIX + "§aDu hast den Spieler §6" + target.getName() + " §ain dein Team eingeladen!");
|
||||||
} else
|
} else
|
||||||
@ -94,7 +94,8 @@ public class AkCommand implements CommandExecutor {
|
|||||||
player.sendMessage(FightSystem.PREFIX + "§cDieser Spieler ist nicht online!");
|
player.sendMessage(FightSystem.PREFIX + "§cDieser Spieler ist nicht online!");
|
||||||
} else
|
} else
|
||||||
player.sendMessage(FightSystem.PREFIX + "§cDu bist nicht der Leader des Teams!");
|
player.sendMessage(FightSystem.PREFIX + "§cDu bist nicht der Leader des Teams!");
|
||||||
}
|
} else
|
||||||
|
player.sendMessage(FightSystem.PREFIX + "§cDu befindest dich in keinem Team!");
|
||||||
|
|
||||||
}else if(args[0].equalsIgnoreCase("remove")){
|
}else if(args[0].equalsIgnoreCase("remove")){
|
||||||
if(FightSystem.getPlugin().getFightState() == FightState.SETUP) {
|
if(FightSystem.getPlugin().getFightState() == FightState.SETUP) {
|
||||||
|
@ -2,6 +2,7 @@ package me.yaruma.fightsystem.fight;
|
|||||||
|
|
||||||
import me.yaruma.fightsystem.FightSystem;
|
import me.yaruma.fightsystem.FightSystem;
|
||||||
import me.yaruma.fightsystem.manager.FileManager;
|
import me.yaruma.fightsystem.manager.FileManager;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -18,6 +19,11 @@ public class FightManager {
|
|||||||
fightPlayer.getPlayer().teleport(getRedTeleportLocation());
|
fightPlayer.getPlayer().teleport(getRedTeleportLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||||
|
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
||||||
|
if(fightTeam == null) player.teleport(FightSystem.getPlugin().getSpecSpawnLoc());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getBlueTeleportLocation() {
|
public Location getBlueTeleportLocation() {
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
package me.yaruma.fightsystem.fight;
|
package me.yaruma.fightsystem.fight;
|
||||||
|
|
||||||
import me.yaruma.fightsystem.FightSystem;
|
import me.yaruma.fightsystem.FightSystem;
|
||||||
|
import me.yaruma.fightsystem.utils.ItemBuilder;
|
||||||
|
import me.yaruma.fightsystem.utils.WorldEdit;
|
||||||
|
import me.yaruma.fightsystem.utils.countdown.Countdown;
|
||||||
|
import me.yaruma.fightsystem.utils.countdown.FinishPreRunning;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -128,6 +134,31 @@ public class FightTeam {
|
|||||||
|
|
||||||
public void setReady(boolean ready) {
|
public void setReady(boolean ready) {
|
||||||
this.ready = ready;
|
this.ready = ready;
|
||||||
|
|
||||||
|
FightTeam fightTeam = Fight.getPlayerTeam(this.leader.getPlayer());
|
||||||
|
|
||||||
|
if(this.ready == true) {
|
||||||
|
|
||||||
|
fightTeam.getLeader().getPlayer().getInventory().setItem(3, new ItemBuilder(Material.INK_SACK, (short) 8).removeAllAtributs().addEnchantment(Enchantment.DURABILITY,1 ).setDisplayName("§aBereit").build());
|
||||||
|
broadcast(FightSystem.PREFIX + "§aEuer Team ist nun bereit!");
|
||||||
|
if(Fight.getOpposite(fightTeam).isReady()) {
|
||||||
|
FightSystem.getPlugin().setPreRunningState();
|
||||||
|
int time = FightSystem.getPlugin().getFileManager().getIntegerFromConfig("Times.PreFightDuration");
|
||||||
|
Countdown countdown = new Countdown(time, new FinishPreRunning());
|
||||||
|
countdown.startTimer(FightSystem.getPlugin());
|
||||||
|
for(FightPlayer allFightPlayers : fightTeam.getPlayers()) {
|
||||||
|
allFightPlayers.getPlayer().getInventory().clear();
|
||||||
|
}
|
||||||
|
for(FightPlayer allFightPlayers : Fight.getOpposite(fightTeam).getPlayers()) {
|
||||||
|
allFightPlayers.getPlayer().getInventory().clear();
|
||||||
|
}
|
||||||
|
FightSystem.getPlugin().getFightManager().teleportAllToFightSpawn();
|
||||||
|
WorldEdit.replace(fightTeam.getLeader().getPlayer(), FightSystem.getPlugin().getTeam1cornerX(), FightSystem.getPlugin().getTeam1cornerY(), FightSystem.getPlugin().getTeam1cornerZ(), FightSystem.getPlugin().getSchemsizeX(), FightSystem.getPlugin().getSchemsizeY(), FightSystem.getPlugin().getSchemsizeZ());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fightTeam.getLeader().getPlayer().getInventory().setItem(3, new ItemBuilder(Material.INK_SACK, (short) 10).removeAllAtributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName("§cNicht bereit").build());
|
||||||
|
fightTeam.broadcast(FightSystem.PREFIX + "§cEuer Team ist nicht mehr bereit!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Player> getInvited() {
|
public ArrayList<Player> getInvited() {
|
||||||
|
@ -20,7 +20,7 @@ public class BlockPlaceListener implements Listener {
|
|||||||
}
|
}
|
||||||
if(FightSystem.getPlugin().getFightState() != FightState.RUNNING) {
|
if(FightSystem.getPlugin().getFightState() != FightState.RUNNING) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if(FightSystem.getPlugin().getFightState() == FightState.RUNNING || FightSystem.getPlugin().getFightState() == FightState.PRE_RUNNING) {
|
if(FightSystem.getPlugin().getFightState() == FightState.PRE_RUNNING) {
|
||||||
player.sendMessage(FightSystem.PREFIX + "§cDu darfst erst nach Fightbeginn Blöcke setzen!");
|
player.sendMessage(FightSystem.PREFIX + "§cDu darfst erst nach Fightbeginn Blöcke setzen!");
|
||||||
} else
|
} else
|
||||||
player.sendMessage(FightSystem.PREFIX + "§cDu darfst keine Blöcke mehr setzen!");
|
player.sendMessage(FightSystem.PREFIX + "§cDu darfst keine Blöcke mehr setzen!");
|
||||||
|
@ -21,23 +21,22 @@ public class PlayerChatListener implements Listener {
|
|||||||
|
|
||||||
String teamChatDetection = fileManager.getStringFromConfig("Output.TeamChatDetection");
|
String teamChatDetection = fileManager.getStringFromConfig("Output.TeamChatDetection");
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
|
||||||
if(message.startsWith(teamChatDetection)) {
|
if(message.startsWith(teamChatDetection)) {
|
||||||
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
||||||
if(fightTeam != null) {
|
if(fightTeam != null) fightTeam.broadcast("§5" + player.getName() + "§e--> §2" + message);
|
||||||
event.setCancelled(true);
|
|
||||||
fightTeam.broadcast("§5" + player.getName() + "§e--> §2" + message);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
||||||
if(fightTeam == Fight.redTeam) {
|
if(fightTeam == Fight.redTeam) {
|
||||||
String prefixColorCode = fileManager.getStringFromConfig("Output.TeamRedColor");
|
String prefixColorCode = fileManager.getStringFromConfig("Output.TeamRedColor");
|
||||||
String teamName = fileManager.getStringFromConfig("Output.TeamRedName");
|
String teamName = fileManager.getStringFromConfig("Output.TeamRedName");
|
||||||
Bukkit.broadcastMessage(prefixColorCode + teamName + " " + player.getName() + " §8>> " + message);
|
Bukkit.broadcastMessage(prefixColorCode + teamName + " " + player.getName() + " §8>> " + prefixColorCode + message);
|
||||||
}
|
}
|
||||||
if(fightTeam == Fight.blueTeam) {
|
if(fightTeam == Fight.blueTeam) {
|
||||||
String prefixColorCode = fileManager.getStringFromConfig("Output.TeamBlueColor");
|
String prefixColorCode = fileManager.getStringFromConfig("Output.TeamBlueColor");
|
||||||
String teamName = fileManager.getStringFromConfig("Output.TeamBlueName");
|
String teamName = fileManager.getStringFromConfig("Output.TeamBlueName");
|
||||||
Bukkit.broadcastMessage(prefixColorCode + teamName + " " + player.getName() + " §8>> " + message);
|
Bukkit.broadcastMessage(prefixColorCode + teamName + " " + player.getName() + " §8>> " + prefixColorCode + message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,11 +22,8 @@ public class PlayerDeathListener implements Listener {
|
|||||||
fightTeam.getFightPlayer(player).setOut(true);
|
fightTeam.getFightPlayer(player).setOut(true);
|
||||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Spieler §6" + player.getName() + " §cist gestorben!");
|
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Spieler §6" + player.getName() + " §cist gestorben!");
|
||||||
if(fightTeam.allPlayersOut()) {
|
if(fightTeam.allPlayersOut()) {
|
||||||
instance.setSpectateState();
|
|
||||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cAlle Spieler aus dem Team von " + fightTeam.getLeader().getPlayer().getName() + " §csind gestorben!");
|
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cAlle Spieler aus dem Team von " + fightTeam.getLeader().getPlayer().getName() + " §csind gestorben!");
|
||||||
Bukkit.broadcastMessage(" ");
|
instance.setSpectateState(oppositeFightTeam);
|
||||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§aDas Team von §6" + oppositeFightTeam.getLeader().getPlayer().getName() + " §ahat gewonnen!");
|
|
||||||
instance.getFightManager().teleportAllToFightSpawn();
|
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if(Fight.getPlayerTeam(player) == Fight.redTeam) {
|
if(Fight.getPlayerTeam(player) == Fight.redTeam) {
|
||||||
|
@ -45,27 +45,9 @@ public class PlayerInteractListener implements Listener {
|
|||||||
switch (displayName) {
|
switch (displayName) {
|
||||||
case "§cNicht bereit":
|
case "§cNicht bereit":
|
||||||
fightTeam.setReady(true);
|
fightTeam.setReady(true);
|
||||||
fightPlayer.getPlayer().getInventory().setItem(3, new ItemBuilder(Material.INK_SACK, (short) 8).removeAllAtributs().addEnchantment(Enchantment.DURABILITY,1 ).setDisplayName("§aBereit").build());
|
|
||||||
fightTeam.broadcast(FightSystem.PREFIX + "§aEuer Team ist nun bereit!");
|
|
||||||
if(Fight.getOpposite(fightTeam).isReady()) {
|
|
||||||
FightSystem.getPlugin().setPreRunningState();
|
|
||||||
int time = fileManager.getIntegerFromConfig("Times.PreFightDuration");
|
|
||||||
Countdown countdown = new Countdown(time, new FinishPreRunning());
|
|
||||||
countdown.startTimer(FightSystem.getPlugin());
|
|
||||||
for(FightPlayer allFightPlayers : fightTeam.getPlayers()) {
|
|
||||||
allFightPlayers.getPlayer().getInventory().clear();
|
|
||||||
}
|
|
||||||
for(FightPlayer allFightPlayers : Fight.getOpposite(fightTeam).getPlayers()) {
|
|
||||||
allFightPlayers.getPlayer().getInventory().clear();
|
|
||||||
}
|
|
||||||
FightSystem.getPlugin().getFightManager().teleportAllToFightSpawn();
|
|
||||||
WorldEdit.replace(player, instance.getTeam1cornerX(), instance.getTeam1cornerY(), instance.getTeam1cornerZ(), instance.getSchemsizeX(), instance.getSchemsizeY(), instance.getSchemsizeZ());
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case "§aBereit":
|
case "§aBereit":
|
||||||
fightTeam.setReady(false);
|
fightTeam.setReady(false);
|
||||||
fightPlayer.getPlayer().getInventory().setItem(3, new ItemBuilder(Material.INK_SACK, (short) 10).removeAllAtributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName("§cNicht bereit").build());
|
|
||||||
fightTeam.broadcast(FightSystem.PREFIX + "§cEuer Team ist nicht mehr bereit!");
|
|
||||||
break;
|
break;
|
||||||
case "§4Abbrechen":
|
case "§4Abbrechen":
|
||||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§6Das Team von §a" + fightTeam.getLeader().getPlayer().getName() + " §6hat den Kampf abgebrochen! \n Server stoppt in 30 Sekunden...");
|
Bukkit.broadcastMessage(FightSystem.PREFIX + "§6Das Team von §a" + fightTeam.getLeader().getPlayer().getName() + " §6hat den Kampf abgebrochen! \n Server stoppt in 30 Sekunden...");
|
||||||
|
@ -18,8 +18,14 @@ public class PlayerJoinListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void handlePlayerJoin(PlayerJoinEvent event) {
|
public void handlePlayerJoin(PlayerJoinEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
player.setHealth(20);
|
||||||
|
player.setFoodLevel(20);
|
||||||
|
player.getInventory().clear();
|
||||||
|
|
||||||
if (Fight.getPlayerTeam(player) == null) {
|
if (Fight.getPlayerTeam(player) == null) {
|
||||||
player.setGameMode(GameMode.SPECTATOR);
|
player.setGameMode(GameMode.SPECTATOR);
|
||||||
|
player.teleport(FightSystem.getPlugin().getSpecSpawnLoc());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,32 +35,30 @@ public class PlayerJoinListener implements Listener {
|
|||||||
if (FightSystem.getPlugin().getFightState() == FightState.SETUP) {
|
if (FightSystem.getPlugin().getFightState() == FightState.SETUP) {
|
||||||
player.teleport(FightSystem.getPlugin().getFightManager().getBlueTeleportLocation());
|
player.teleport(FightSystem.getPlugin().getFightManager().getBlueTeleportLocation());
|
||||||
player.setGameMode(GameMode.SURVIVAL);
|
player.setGameMode(GameMode.SURVIVAL);
|
||||||
player.setHealth(20);
|
|
||||||
player.setFoodLevel(20);
|
|
||||||
player.getInventory().clear();
|
|
||||||
if(fightPlayer.isLeader()) SetupItems.giveSetupItems(player);
|
if(fightPlayer.isLeader()) SetupItems.giveSetupItems(player);
|
||||||
if(fightPlayer.isOut()) {
|
if(fightPlayer.isOut()) {
|
||||||
fightPlayer.setOut(false);
|
fightPlayer.setOut(false);
|
||||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§aDer Spieler §6" + fightPlayer.getPlayer().getName() + " §aist dem Kampf wieder beigetreten!");
|
Bukkit.broadcastMessage(FightSystem.PREFIX + "§aDer Spieler §6" + fightPlayer.getPlayer().getName() + " §aist dem Kampf wieder beigetreten!");
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
player.setGameMode(GameMode.SPECTATOR);
|
player.setGameMode(GameMode.SPECTATOR);
|
||||||
|
player.teleport(FightSystem.getPlugin().getTeam2SpawnLoc());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fightTeam == Fight.redTeam) {
|
if (fightTeam == Fight.redTeam) {
|
||||||
if (FightSystem.getPlugin().getFightState() == FightState.SETUP) {
|
if (FightSystem.getPlugin().getFightState() == FightState.SETUP) {
|
||||||
player.teleport(FightSystem.getPlugin().getFightManager().getRedTeleportLocation());
|
player.teleport(FightSystem.getPlugin().getFightManager().getRedTeleportLocation());
|
||||||
player.setGameMode(GameMode.SURVIVAL);
|
player.setGameMode(GameMode.SURVIVAL);
|
||||||
player.setHealth(20);
|
|
||||||
player.setFoodLevel(20);
|
|
||||||
player.getInventory().clear();
|
|
||||||
if(fightPlayer.isLeader()) SetupItems.giveSetupItems(player);
|
if(fightPlayer.isLeader()) SetupItems.giveSetupItems(player);
|
||||||
if(fightPlayer.isOut()) {
|
if(fightPlayer.isOut()) {
|
||||||
fightPlayer.setOut(false);
|
fightPlayer.setOut(false);
|
||||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§aDer Spieler §6" + fightPlayer.getPlayer().getName() + " §aist dem Kampf wieder beigetreten!");
|
Bukkit.broadcastMessage(FightSystem.PREFIX + "§aDer Spieler §6" + fightPlayer.getPlayer().getName() + " §aist dem Kampf wieder beigetreten!");
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
player.setGameMode(GameMode.SPECTATOR);
|
player.setGameMode(GameMode.SPECTATOR);
|
||||||
|
player.teleport(FightSystem.getPlugin().getTeam1SpawnLoc());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren