GUI, New Commands + Begin of AkCommand refactoring
Dieser Commit ist enthalten in:
Ursprung
5f5eba4a4d
Commit
60edef1c80
@ -1,7 +1,7 @@
|
|||||||
package me.yaruma.fightsystem;
|
package me.yaruma.fightsystem;
|
||||||
|
|
||||||
import de.warking.hunjy.CoinSystem.CoinSystem;
|
import de.warking.hunjy.CoinSystem.CoinSystem;
|
||||||
import me.yaruma.fightsystem.commands.AkCommand;
|
import me.yaruma.fightsystem.commands.*;
|
||||||
import me.yaruma.fightsystem.fight.*;
|
import me.yaruma.fightsystem.fight.*;
|
||||||
import me.yaruma.fightsystem.kit.KitManager;
|
import me.yaruma.fightsystem.kit.KitManager;
|
||||||
import me.yaruma.fightsystem.listener.*;
|
import me.yaruma.fightsystem.listener.*;
|
||||||
@ -98,6 +98,11 @@ public class FightSystem extends JavaPlugin {
|
|||||||
if(Config.PercentSystem) pm.registerEvents(new WinconditionPercentSystem(), plugin);
|
if(Config.PercentSystem) pm.registerEvents(new WinconditionPercentSystem(), plugin);
|
||||||
|
|
||||||
getCommand("ak").setExecutor(new AkCommand());
|
getCommand("ak").setExecutor(new AkCommand());
|
||||||
|
getCommand("invite").setExecutor(new InviteCommand());
|
||||||
|
getCommand("leave").setExecutor(new LeaveCommand());
|
||||||
|
getCommand("accept").setExecutor(new AcceptCommand());
|
||||||
|
getCommand("decline").setExecutor(new DeclineCommand());
|
||||||
|
getCommand("ready").setExecutor(new ReadyCommand());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadConfig() {
|
private void loadConfig() {
|
||||||
|
19
src/me/yaruma/fightsystem/commands/AcceptCommand.java
Normale Datei
19
src/me/yaruma/fightsystem/commands/AcceptCommand.java
Normale Datei
@ -0,0 +1,19 @@
|
|||||||
|
package me.yaruma.fightsystem.commands;
|
||||||
|
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
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);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -12,7 +12,6 @@ import me.yaruma.fightsystem.kit.Kit;
|
|||||||
import me.yaruma.fightsystem.kit.KitManager;
|
import me.yaruma.fightsystem.kit.KitManager;
|
||||||
import me.yaruma.fightsystem.utils.Config;
|
import me.yaruma.fightsystem.utils.Config;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -28,44 +27,17 @@ public class AkCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if(FightSystem.getPlugin().getFightState() == FightState.SETUP) {
|
switch(args.length){
|
||||||
|
case 1:
|
||||||
if(args.length == 1) {
|
if(args[0].equalsIgnoreCase("ready"))
|
||||||
|
Commands.toggleReady(player);
|
||||||
if(args[0].equalsIgnoreCase("help")) {
|
else if(args[0].equalsIgnoreCase("accept"))
|
||||||
sendHelp(player);
|
Commands.acceptInvitation(player);
|
||||||
|
else if(args[0].equalsIgnoreCase("decline"))
|
||||||
}else if(args[0].equalsIgnoreCase("ready") && FightSystem.getPlugin().getFightState() == FightState.SETUP){
|
Commands.declineInvitation(player);
|
||||||
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
else if(args[0].equalsIgnoreCase("leave"))
|
||||||
if(fightTeam != null) {
|
Commands.leaveTeam(player);
|
||||||
fightTeam.setReady(!fightTeam.isReady());
|
else if(args[0].equalsIgnoreCase("leader")){
|
||||||
}
|
|
||||||
|
|
||||||
}else if(args[0].equalsIgnoreCase("accept") && FightSystem.getPlugin().getFightState() == FightState.SETUP){
|
|
||||||
FightTeam team = Fight.getInvitedTeam(player);
|
|
||||||
if(team != null){
|
|
||||||
FightPlayer leader = team.getLeader();
|
|
||||||
team.addMember(player);
|
|
||||||
player.setGameMode(GameMode.ADVENTURE);
|
|
||||||
if(team == Fight.getRedTeam())
|
|
||||||
player.teleport(Config.TeamRedSpawn);
|
|
||||||
else
|
|
||||||
player.teleport(Config.TeamBlueSpawn);
|
|
||||||
player.sendMessage(FightSystem.PREFIX + "§aDu bist dem Team von §6" + leader.getPlayer().getName() + " §abeigetreten!");
|
|
||||||
leader.sendMessage(FightSystem.PREFIX + "§aDer Spieler §6" + player.getName() + " §aist deinem Team beigetreten");
|
|
||||||
}
|
|
||||||
|
|
||||||
}else if(args[0].equalsIgnoreCase("decline") && FightSystem.getPlugin().getFightState() == FightState.SETUP){
|
|
||||||
FightTeam team = Fight.getInvitedTeam(player);
|
|
||||||
if(team != null){
|
|
||||||
FightPlayer leader = team.getLeader();
|
|
||||||
team.getInvited().remove(player);
|
|
||||||
player.sendMessage(FightSystem.PREFIX + "§aDu hast die Einladung von §6" + leader.getPlayer().getName() + " §aabgelehnt!");
|
|
||||||
leader.sendMessage(FightSystem.PREFIX + "§cDer Spieler §6" + player.getName() + " §chat deine Einladung abgelehnt!");
|
|
||||||
}
|
|
||||||
|
|
||||||
}else if(args[0].equalsIgnoreCase("leader")){
|
|
||||||
|
|
||||||
if(!Fight.getBlueTeam().hasTeamLeader()){
|
if(!Fight.getBlueTeam().hasTeamLeader()){
|
||||||
FightPlayer fightPlayer = new FightPlayer(player, false);
|
FightPlayer fightPlayer = new FightPlayer(player, false);
|
||||||
Fight.getBlueTeam().setLeader(fightPlayer);
|
Fight.getBlueTeam().setLeader(fightPlayer);
|
||||||
@ -78,44 +50,15 @@ public class AkCommand implements CommandExecutor {
|
|||||||
|
|
||||||
} else
|
} else
|
||||||
player.sendMessage(FightSystem.PREFIX + "§cEs sind bereits zwei Leader vorhanden!");
|
player.sendMessage(FightSystem.PREFIX + "§cEs sind bereits zwei Leader vorhanden!");
|
||||||
} else if(args[0].equalsIgnoreCase("leave")) {
|
|
||||||
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
|
||||||
if(fightTeam != null) {
|
|
||||||
fightTeam.removePlayer(player);
|
|
||||||
player.setGameMode(GameMode.SPECTATOR);
|
|
||||||
player.teleport(Config.SpecSpawn);
|
|
||||||
player.sendMessage(FightSystem.PREFIX + "§aDu hast das Team verlassen!");
|
|
||||||
} else
|
|
||||||
player.sendMessage(FightSystem.PREFIX + "§cDu befindest dich in keinem Team!");
|
|
||||||
}
|
|
||||||
|
|
||||||
}else if(args.length == 2) {
|
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("invite") && FightSystem.getPlugin().getFightState() == FightState.SETUP){
|
|
||||||
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
|
||||||
if(fightTeam != null) {
|
|
||||||
FightPlayer fightPlayer = fightTeam.getFightPlayer(player);
|
|
||||||
if(fightPlayer.isLeader()){
|
|
||||||
|
|
||||||
Player target = Bukkit.getPlayer(args[1]);
|
|
||||||
if(target != null) {
|
|
||||||
if(Fight.getPlayerTeam(target) != null) {
|
|
||||||
player.sendMessage(FightSystem.PREFIX + "§cDer Spieler §6" + target.getName() + " §cist bereits in einem Team!");
|
|
||||||
} else if(!(Fight.getOpposite(fightTeam).getInvited().contains(target) && fightTeam.getInvited().contains(target))) {
|
|
||||||
fightTeam.getInvited().add(target);
|
|
||||||
target.sendMessage(FightSystem.PREFIX + "§aDu wurdest von §6" + player.getName() + " §ain sein Team eingeladen!");
|
|
||||||
player.sendMessage(FightSystem.PREFIX + "§aDu hast den Spieler §6" + target.getName() + " §ain dein Team eingeladen!");
|
|
||||||
} else
|
|
||||||
player.sendMessage(FightSystem.PREFIX + "§cDieser Spieler wurde bereits eingeladen!");
|
|
||||||
} else
|
|
||||||
player.sendMessage(FightSystem.PREFIX + "§cDieser Spieler ist nicht online!");
|
|
||||||
} else
|
|
||||||
player.sendMessage(FightSystem.PREFIX + "§cDu bist nicht der Leader des Teams!");
|
|
||||||
} else
|
|
||||||
player.sendMessage(FightSystem.PREFIX + "§cDu befindest dich in keinem Team!");
|
|
||||||
|
|
||||||
|
}else
|
||||||
|
Commands.sendHelp(player);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(args[0].equalsIgnoreCase("invite")){
|
||||||
|
Commands.invite(player, args[1]);
|
||||||
}else if(args[0].equalsIgnoreCase("remove")){
|
}else if(args[0].equalsIgnoreCase("remove")){
|
||||||
if(FightSystem.getPlugin().getFightState() == FightState.SETUP) {
|
if(FightSystem.getFightState() == FightState.SETUP) {
|
||||||
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
||||||
if(fightTeam != null) {
|
if(fightTeam != null) {
|
||||||
Player target = Bukkit.getPlayer(args[1]);
|
Player target = Bukkit.getPlayer(args[1]);
|
||||||
@ -130,7 +73,7 @@ public class AkCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else if(args[0].equalsIgnoreCase("kit")) {
|
}else if(args[0].equalsIgnoreCase("kit")) {
|
||||||
if(FightSystem.getPlugin().getFightState() != FightState.SETUP) {
|
if(FightSystem.getFightState() != FightState.SETUP) {
|
||||||
player.sendMessage(FightSystem.PREFIX + "§cDu kannst dein Kit nicht mehr wechseln!");
|
player.sendMessage(FightSystem.PREFIX + "§cDu kannst dein Kit nicht mehr wechseln!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -163,15 +106,14 @@ public class AkCommand implements CommandExecutor {
|
|||||||
|
|
||||||
} else if(args[0].equalsIgnoreCase("addkit")){
|
} else if(args[0].equalsIgnoreCase("addkit")){
|
||||||
if(WarkingUser.get(player.getUniqueId()).getUserGroup() != UserGroup.Developer){
|
if(WarkingUser.get(player.getUniqueId()).getUserGroup() != UserGroup.Developer){
|
||||||
sendHelp(player);
|
Commands.sendHelp(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
KitManager.saveInventory(args[1], player);
|
KitManager.saveInventory(args[1], player);
|
||||||
} else if(args[0].equalsIgnoreCase("schemlist") && FightSystem.getPlugin().getFightState() == FightState.SETUP) {
|
} else if(args[0].equalsIgnoreCase("schemlist") && FightSystem.getFightState() == FightState.SETUP) {
|
||||||
try {
|
try {
|
||||||
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
||||||
if(fightTeam != null) {
|
if(fightTeam != null && fightTeam.getFightPlayer(player).isLeader()) {
|
||||||
if(fightTeam.getFightPlayer(player).isLeader()) {
|
|
||||||
if(args[1].equalsIgnoreCase("public")) {
|
if(args[1].equalsIgnoreCase("public")) {
|
||||||
Fight.getPlayerTeam(player).sendPlayerSchematicList(true, 0, 15, player, Config.SchematicType);
|
Fight.getPlayerTeam(player).sendPlayerSchematicList(true, 0, 15, player, Config.SchematicType);
|
||||||
return false;
|
return false;
|
||||||
@ -185,13 +127,14 @@ public class AkCommand implements CommandExecutor {
|
|||||||
Fight.getPlayerTeam(player).sendPlayerSchematicList(false, page, 15, player, Config.SchematicType);
|
Fight.getPlayerTeam(player).sendPlayerSchematicList(false, page, 15, player, Config.SchematicType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (NumberFormatException ex) {
|
} catch (NumberFormatException ex) {
|
||||||
player.sendMessage(FightSystem.PREFIX + "§cDu musst eine Seitenzahl angeben!");
|
player.sendMessage(FightSystem.PREFIX + "§cDu musst eine Seitenzahl angeben!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}else
|
||||||
}else if(args.length == 3) {
|
Commands.sendHelp(player);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
if(args[0].equalsIgnoreCase("schem")) {
|
if(args[0].equalsIgnoreCase("schem")) {
|
||||||
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
||||||
if(fightTeam == null) {
|
if(fightTeam == null) {
|
||||||
@ -225,25 +168,14 @@ public class AkCommand implements CommandExecutor {
|
|||||||
|
|
||||||
fightTeam.setSchematic(schem);
|
fightTeam.setSchematic(schem);
|
||||||
Fight.getPlayerTeam(player).broadcast(FightSystem.PREFIX + "Schematic §6" + args[1] + " §8wird für den Kampf verwendet!");
|
Fight.getPlayerTeam(player).broadcast(FightSystem.PREFIX + "Schematic §6" + args[1] + " §8wird für den Kampf verwendet!");
|
||||||
}
|
}else
|
||||||
} else {
|
Commands.sendHelp(player);
|
||||||
sendHelp(player);
|
break;
|
||||||
}
|
default:
|
||||||
} else
|
Commands.sendHelp(player);
|
||||||
player.sendMessage(FightSystem.PREFIX + "§cDer Fight hat bereits begonnen!");
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendHelp(Player p) {
|
|
||||||
p.sendMessage(FightSystem.PREFIX + "§7Hilfe für den §6/ak§7-Befehl");
|
|
||||||
p.sendMessage("§8/§6ak help §8- §7Zeigt diese Hilfeseite");
|
|
||||||
p.sendMessage("§8/§6ak ready §8- §7Setzt das eigene Team auf bereit");
|
|
||||||
p.sendMessage("§8/§6ak leader §8- §7Tritt einem Team als Leader bei");
|
|
||||||
p.sendMessage("§8/§6ak invite [Spieler] §8- §7Lade den Spieler in dein Team bei");
|
|
||||||
p.sendMessage("§8/§6ak accept §8- §7Einladung annehmen");
|
|
||||||
p.sendMessage("§8/§6ak decline §8- §7Einladung ablehnen");
|
|
||||||
p.sendMessage("§8/ak leave §8- §7Team verlassen");
|
|
||||||
p.sendMessage("§8/§6ak kit <Kit> §8- §7Wähle ein Kit");
|
|
||||||
p.sendMessage("§8/§6ak schem <Schematic> §8- §7Setze deine Schematic");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
168
src/me/yaruma/fightsystem/commands/Commands.java
Normale Datei
168
src/me/yaruma/fightsystem/commands/Commands.java
Normale Datei
@ -0,0 +1,168 @@
|
|||||||
|
package me.yaruma.fightsystem.commands;
|
||||||
|
|
||||||
|
import me.yaruma.fightsystem.FightSystem;
|
||||||
|
import me.yaruma.fightsystem.fight.Fight;
|
||||||
|
import me.yaruma.fightsystem.fight.FightPlayer;
|
||||||
|
import me.yaruma.fightsystem.fight.FightState;
|
||||||
|
import me.yaruma.fightsystem.fight.FightTeam;
|
||||||
|
import me.yaruma.fightsystem.utils.Config;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class Commands {
|
||||||
|
|
||||||
|
private static void errNoTeam(Player p){
|
||||||
|
p.sendMessage(FightSystem.PREFIX + "§cDu bist in keinem Team!");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean checkSetupOver(Player p){
|
||||||
|
if(FightSystem.getFightState() != FightState.SETUP){
|
||||||
|
p.sendMessage(FightSystem.PREFIX + "§cDer Kampf hat bereits begonnen!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static FightTeam checkGetInvitedTeam(Player p){
|
||||||
|
FightTeam fightTeam = Fight.getInvitedTeam(p);
|
||||||
|
if(fightTeam == null){
|
||||||
|
p.sendMessage(FightSystem.PREFIX + "§cDu wurdest von keinem Team eingeladen!");
|
||||||
|
}
|
||||||
|
return fightTeam;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static FightPlayer checkGetPlayer(Player p){
|
||||||
|
FightPlayer fightPlayer = Fight.getFightPlayer(p);
|
||||||
|
if(fightPlayer == null){
|
||||||
|
errNoTeam(p);
|
||||||
|
}
|
||||||
|
return fightPlayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static FightPlayer checkGetLeader(Player p){
|
||||||
|
FightPlayer fightPlayer = checkGetPlayer(p);
|
||||||
|
if(fightPlayer != null && !fightPlayer.isLeader()){
|
||||||
|
p.sendMessage(FightSystem.PREFIX + "§cDu bist kein Leader!");
|
||||||
|
fightPlayer = null;
|
||||||
|
}
|
||||||
|
return fightPlayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static FightTeam checkGetTeam(Player p){
|
||||||
|
FightTeam fightTeam = Fight.getPlayerTeam(p);
|
||||||
|
if(fightTeam == null){
|
||||||
|
errNoTeam(p);
|
||||||
|
}
|
||||||
|
return fightTeam;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Player checkGetPlayer(Player p, String t){
|
||||||
|
Player target = Bukkit.getPlayer(t);
|
||||||
|
if(target == null) {
|
||||||
|
p.sendMessage(FightSystem.PREFIX + "§cDer Spieler ist nicht online!");
|
||||||
|
}
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void toggleReady(Player p){
|
||||||
|
if(!checkSetupOver(p))
|
||||||
|
return;
|
||||||
|
|
||||||
|
FightTeam fightTeam = checkGetTeam(p);
|
||||||
|
if(fightTeam == null || checkGetLeader(p) == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fightTeam.setReady(!fightTeam.isReady());
|
||||||
|
}
|
||||||
|
|
||||||
|
static void acceptInvitation(Player p){
|
||||||
|
if(!checkSetupOver(p))
|
||||||
|
return;
|
||||||
|
|
||||||
|
FightTeam team = checkGetInvitedTeam(p);
|
||||||
|
if(team == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
FightPlayer leader = team.getLeader();
|
||||||
|
team.addMember(p);
|
||||||
|
p.setGameMode(GameMode.ADVENTURE);
|
||||||
|
p.teleport(team.getSpawn());
|
||||||
|
p.sendMessage(FightSystem.PREFIX + "§aDu bist Team " + team.getName() + " §abeigetreten!");
|
||||||
|
leader.sendMessage(FightSystem.PREFIX + "§aDer Spieler §6" + p.getName() + " §aist deinem Team beigetreten!");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void declineInvitation(Player p){
|
||||||
|
if(!checkSetupOver(p))
|
||||||
|
return;
|
||||||
|
|
||||||
|
FightTeam team = checkGetInvitedTeam(p);
|
||||||
|
if(team == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
FightPlayer leader = team.getLeader();
|
||||||
|
team.getInvited().remove(p);
|
||||||
|
p.sendMessage(FightSystem.PREFIX + "§aDu hast die Einladung von " + team.getName() + " §aabgelehnt!");
|
||||||
|
leader.sendMessage(FightSystem.PREFIX + "§cDer Spieler §6" + p.getName() + " §chat deine Einladung abgelehnt!");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void leaveTeam(Player p){
|
||||||
|
if(!checkSetupOver(p))
|
||||||
|
return;
|
||||||
|
|
||||||
|
FightTeam fightTeam = checkGetTeam(p);
|
||||||
|
if(fightTeam == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fightTeam.removePlayer(p);
|
||||||
|
p.setGameMode(GameMode.SPECTATOR);
|
||||||
|
p.teleport(Config.SpecSpawn);
|
||||||
|
p.sendMessage(FightSystem.PREFIX + "§aDu hast das Team " + fightTeam.getName() + " §averlassen!");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void invite(Player p, String invited){
|
||||||
|
if(!checkSetupOver(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) {
|
||||||
|
p.sendMessage(FightSystem.PREFIX + "§cDer Spieler §6" + target.getName() + " §cist bereits in einem Team!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Fight.getOpposite(fightTeam).getInvited().contains(target) || fightTeam.getInvited().contains(target)) {
|
||||||
|
p.sendMessage(FightSystem.PREFIX + "§cDieser Spieler wurde bereits eingeladen!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fightTeam.getInvited().add(target);
|
||||||
|
target.sendMessage(FightSystem.PREFIX + "§aDu wurdest in das Team von §6" + p.getName() + " §aeingeladen!");
|
||||||
|
p.sendMessage(FightSystem.PREFIX + "§aDu hast den Spieler §6" + target.getName() + " §ain dein Team eingeladen!");
|
||||||
|
GUI.invitation(p, target);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void sendHelp(Player p) {
|
||||||
|
p.sendMessage(FightSystem.PREFIX + "§7Hilfe für das Kampfsystem");
|
||||||
|
p.sendMessage("§8/§6ak help §8- §7Zeigt diese Hilfeseite");
|
||||||
|
p.sendMessage("§8/§6ak leader §8- §7Tritt einem Team als Leader bei");
|
||||||
|
p.sendMessage("§8/§6ak kit <Kit> §8- §7Wähle ein Kit");
|
||||||
|
p.sendMessage("§8/§6ak schem <Schematic> §8- §7Setze deine Schematic");
|
||||||
|
p.sendMessage("§8/§6ready §8- §7Setzt das eigene Team auf bereit");
|
||||||
|
p.sendMessage("§8/§6invite [Spieler] §8- §7Lade den Spieler in dein Team bei");
|
||||||
|
p.sendMessage("§8/§6accept §8- §7Einladung annehmen");
|
||||||
|
p.sendMessage("§8/§6decline §8- §7Einladung ablehnen");
|
||||||
|
p.sendMessage("§8/§6leave §8- §7Team verlassen");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
19
src/me/yaruma/fightsystem/commands/DeclineCommand.java
Normale Datei
19
src/me/yaruma/fightsystem/commands/DeclineCommand.java
Normale Datei
@ -0,0 +1,19 @@
|
|||||||
|
package me.yaruma.fightsystem.commands;
|
||||||
|
|
||||||
|
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 {
|
||||||
|
@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);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
30
src/me/yaruma/fightsystem/commands/GUI.java
Normale Datei
30
src/me/yaruma/fightsystem/commands/GUI.java
Normale Datei
@ -0,0 +1,30 @@
|
|||||||
|
package me.yaruma.fightsystem.commands;
|
||||||
|
|
||||||
|
import de.steamwar.inventory.SWInventory;
|
||||||
|
import me.yaruma.fightsystem.FightSystem;
|
||||||
|
import me.yaruma.fightsystem.fight.Fight;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class GUI {
|
||||||
|
|
||||||
|
public static void invitation(Player p, Player target){
|
||||||
|
SWInventory inv = new SWInventory(target, 9, "Einladung von " + p.getName());
|
||||||
|
inv.setItem(0, Material.INK_SACK, (byte)10, "§aAnnehmen", () ->{
|
||||||
|
target.performCommand("ak accept");
|
||||||
|
target.closeInventory();
|
||||||
|
});
|
||||||
|
inv.setItem(8, Material.INK_SACK, (byte)1, "§cAblehnen", () ->{
|
||||||
|
target.performCommand("ak decline");
|
||||||
|
target.closeInventory();
|
||||||
|
});
|
||||||
|
inv.addCloseCallback(() ->{
|
||||||
|
if(Fight.getInvitedTeam(target) != null){
|
||||||
|
target.sendMessage(FightSystem.PREFIX + "§7Tippe §8/§aaccept§7, um die Einladung §aanzunehmen");
|
||||||
|
target.sendMessage(FightSystem.PREFIX + "§7Tippe §8/§cdecline§7, um die Einladung §cabzulehnen");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
inv.setCallback(-999, target::closeInventory);
|
||||||
|
inv.open();
|
||||||
|
}
|
||||||
|
}
|
24
src/me/yaruma/fightsystem/commands/InviteCommand.java
Normale Datei
24
src/me/yaruma/fightsystem/commands/InviteCommand.java
Normale Datei
@ -0,0 +1,24 @@
|
|||||||
|
package me.yaruma.fightsystem.commands;
|
||||||
|
|
||||||
|
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 {
|
||||||
|
@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){
|
||||||
|
Commands.sendHelp(player);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Commands.invite(player, args[0]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
19
src/me/yaruma/fightsystem/commands/LeaveCommand.java
Normale Datei
19
src/me/yaruma/fightsystem/commands/LeaveCommand.java
Normale Datei
@ -0,0 +1,19 @@
|
|||||||
|
package me.yaruma.fightsystem.commands;
|
||||||
|
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class LeaveCommand 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.leaveTeam(player);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
19
src/me/yaruma/fightsystem/commands/ReadyCommand.java
Normale Datei
19
src/me/yaruma/fightsystem/commands/ReadyCommand.java
Normale Datei
@ -0,0 +1,19 @@
|
|||||||
|
package me.yaruma.fightsystem.commands;
|
||||||
|
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class ReadyCommand 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.toggleReady(player);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -38,6 +38,7 @@ public class FightTeam {
|
|||||||
private final String name;
|
private final String name;
|
||||||
private final String prefix;
|
private final String prefix;
|
||||||
private Schematic schematic;
|
private Schematic schematic;
|
||||||
|
|
||||||
private final Location spawn;
|
private final Location spawn;
|
||||||
private final Vector paste;
|
private final Vector paste;
|
||||||
private final boolean rotate;
|
private final boolean rotate;
|
||||||
@ -207,6 +208,9 @@ public class FightTeam {
|
|||||||
return prefix;
|
return prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Location getSpawn() {
|
||||||
|
return spawn;
|
||||||
|
}
|
||||||
|
|
||||||
public void sendPlayerSchematicList(boolean publicSchematics, int currentPage, int filesPerPage, Player player, SchematicType schematicType) {
|
public void sendPlayerSchematicList(boolean publicSchematics, int currentPage, int filesPerPage, Player player, SchematicType schematicType) {
|
||||||
|
|
||||||
|
@ -6,3 +6,8 @@ depend: [CoreSystem, WorldEdit, FastAsyncWorldEdit, ProtocolLib]
|
|||||||
|
|
||||||
commands:
|
commands:
|
||||||
ak:
|
ak:
|
||||||
|
accept:
|
||||||
|
decline:
|
||||||
|
leave:
|
||||||
|
invite:
|
||||||
|
ready:
|
In neuem Issue referenzieren
Einen Benutzer sperren