Update2.0 #22
@ -19,8 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.misslewars;
|
package de.steamwar.misslewars;
|
||||||
|
|
||||||
import de.steamwar.misslewars.commands.CommandAccept;
|
import de.steamwar.misslewars.commands.CommandInviteHandler;
|
||||||
import de.steamwar.misslewars.commands.CommandDecline;
|
|
||||||
import de.steamwar.misslewars.commands.CommandInvite;
|
import de.steamwar.misslewars.commands.CommandInvite;
|
||||||
import de.steamwar.misslewars.commands.CommandSpectate;
|
import de.steamwar.misslewars.commands.CommandSpectate;
|
||||||
import de.steamwar.misslewars.countdowns.EndCountdown;
|
import de.steamwar.misslewars.countdowns.EndCountdown;
|
||||||
@ -32,7 +31,6 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
@ -72,8 +70,8 @@ public class MissileWars extends JavaPlugin {
|
|||||||
getCommand("invite").setExecutor(commandInvite);
|
getCommand("invite").setExecutor(commandInvite);
|
||||||
getCommand("invite").setTabCompleter(commandInvite);
|
getCommand("invite").setTabCompleter(commandInvite);
|
||||||
|
|
||||||
getCommand("accept").setExecutor(new CommandAccept());
|
getCommand("accept").setExecutor(new CommandInviteHandler());
|
||||||
getCommand("decline").setExecutor(new CommandDecline());
|
getCommand("decline").setExecutor(new CommandInviteHandler());
|
||||||
|
|
||||||
new WaitingCountdown();
|
new WaitingCountdown();
|
||||||
new ItemCountdown();
|
new ItemCountdown();
|
||||||
|
@ -1,54 +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.misslewars.commands;
|
|
||||||
|
|
||||||
import de.steamwar.misslewars.Config;
|
|
||||||
import de.steamwar.misslewars.MWTeam;
|
|
||||||
import de.steamwar.misslewars.MissileWars;
|
|
||||||
import de.steamwar.misslewars.items.Missile;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class CommandDecline 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 (!Config.isChallenge()) {
|
|
||||||
player.sendMessage("§cDieser Command ist deaktiviert.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
MWTeam teamInvitation = MissileWars.getInvitation(player);
|
|
||||||
if (teamInvitation == null) {
|
|
||||||
player.sendMessage("§cDu wurdest nicht eingeladen.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
MWTeam.removeInvitations(player);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -22,7 +22,9 @@
|
|||||||
package de.steamwar.misslewars.commands;
|
package de.steamwar.misslewars.commands;
|
||||||
|
|
||||||
import de.steamwar.misslewars.Config;
|
import de.steamwar.misslewars.Config;
|
||||||
|
import de.steamwar.misslewars.MWTeam;
|
||||||
import de.steamwar.misslewars.MissileWars;
|
import de.steamwar.misslewars.MissileWars;
|
||||||
|
import de.steamwar.misslewars.items.Missile;
|
||||||
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@ -45,11 +47,8 @@ public class CommandInvite implements CommandExecutor, TabCompleter {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Config.RedLeader.equals(player.getUniqueId()) && !Config.BlueLeader.equals(player.getUniqueId())) {
|
MWTeam team = MissileWars.getTeam(player);
|
||||||
player.sendMessage("§cDu kannst keine Spieler einladen.");
|
if (!Config.RedLeader.equals(player.getUniqueId()) && !Config.BlueLeader.equals(player.getUniqueId()) || team == null) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (MissileWars.getTeam(player) == null) {
|
|
||||||
player.sendMessage("§cDu kannst keine Spieler einladen.");
|
player.sendMessage("§cDu kannst keine Spieler einladen.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -60,6 +59,10 @@ public class CommandInvite implements CommandExecutor, TabCompleter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Player invitedPlayer = Bukkit.getPlayer(args[0]);
|
Player invitedPlayer = Bukkit.getPlayer(args[0]);
|
||||||
|
if (invitedPlayer == null) {
|
||||||
|
player.sendMessage("§cDieser Spieler ist nicht online.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (MissileWars.getTeam(invitedPlayer) != null) {
|
if (MissileWars.getTeam(invitedPlayer) != null) {
|
||||||
player.sendMessage("§cDieser Spieler ist bereits in einem Team.");
|
player.sendMessage("§cDieser Spieler ist bereits in einem Team.");
|
||||||
return false;
|
return false;
|
||||||
@ -69,7 +72,7 @@ public class CommandInvite implements CommandExecutor, TabCompleter {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
MissileWars.getTeam(player).invitePlayer(invitedPlayer);
|
team.invitePlayer(invitedPlayer);
|
||||||
invitedPlayer.sendMessage("§7Du wurdest von §6" + player.getName() + "§7 in das Team §6" + MissileWars.getTeam(player).getColoredName() + "§7 eingeladen.");
|
invitedPlayer.sendMessage("§7Du wurdest von §6" + player.getName() + "§7 in das Team §6" + MissileWars.getTeam(player).getColoredName() + "§7 eingeladen.");
|
||||||
invitedPlayer.sendMessage("§8/§6accept §8- §7Zum akzeptieren.");
|
invitedPlayer.sendMessage("§8/§6accept §8- §7Zum akzeptieren.");
|
||||||
invitedPlayer.sendMessage("§8/§6decline §8- §7Zum ablehnen.");
|
invitedPlayer.sendMessage("§8/§6decline §8- §7Zum ablehnen.");
|
||||||
|
@ -29,7 +29,7 @@ import org.bukkit.command.CommandExecutor;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class CommandAccept implements CommandExecutor {
|
public class CommandInviteHandler implements CommandExecutor {
|
||||||
Chaoscaot
hat
Unpassender Name für /accept und /decline Unpassender Name für /accept und /decline
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
@ -46,7 +46,11 @@ public class CommandAccept implements CommandExecutor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (command.getName().equals("accept")) {
|
||||||
teamInvitation.acceptInvite(player);
|
teamInvitation.acceptInvite(player);
|
||||||
|
} else {
|
||||||
|
MWTeam.removeInvitations(player);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
In neuem Issue referenzieren
Einen Benutzer sperren
Unused Import