Merge pull request 'Fight info command' (#395) from infoCommand into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #395 Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Commit
adeb4e1d32
@ -138,6 +138,7 @@ public class FightSystem extends JavaPlugin {
|
|||||||
new KitCommand();
|
new KitCommand();
|
||||||
new RemoveCommand();
|
new RemoveCommand();
|
||||||
new RequestsCommand();
|
new RequestsCommand();
|
||||||
|
new InfoCommand();
|
||||||
new WGCommand();
|
new WGCommand();
|
||||||
new TBCommand();
|
new TBCommand();
|
||||||
new GamemodeCommand();
|
new GamemodeCommand();
|
||||||
|
@ -47,6 +47,10 @@ REMOVE_HELP=§8/§eremove §8[§eplayer§8]
|
|||||||
NOT_FIGHTLEADER=§cYou are not the fight leader
|
NOT_FIGHTLEADER=§cYou are not the fight leader
|
||||||
WIN_HELP=§8/§7win §8[§eteam §8or §etie§8]
|
WIN_HELP=§8/§7win §8[§eteam §8or §etie§8]
|
||||||
|
|
||||||
|
INFO_RANKED=§7Ranked§8: §e{0}
|
||||||
|
INFO_LEADER=§7Leader {0}§8: {1}
|
||||||
|
INFO_SCHEMATIC=§7Schematic {0}§8: §e{1} §7from {2}, Rank: {3}
|
||||||
|
|
||||||
|
|
||||||
# GUI
|
# GUI
|
||||||
STATE_TITLE=Fight state
|
STATE_TITLE=Fight state
|
||||||
|
@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2023 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.fight.Fight;
|
||||||
|
import de.steamwar.fightsystem.fight.FightTeam;
|
||||||
|
import de.steamwar.fightsystem.states.FightState;
|
||||||
|
import de.steamwar.fightsystem.states.StateDependentCommand;
|
||||||
|
import de.steamwar.fightsystem.utils.FightStatistics;
|
||||||
|
import de.steamwar.sql.SchematicNode;
|
||||||
|
import de.steamwar.sql.SteamwarUser;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class InfoCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
public InfoCommand() {
|
||||||
|
new StateDependentCommand(ArenaMode.All, FightState.All, "info", this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
|
if(!(sender instanceof Player))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Player player = (Player) sender;
|
||||||
|
if(!SteamwarUser.get(player.getUniqueId()).getUserGroup().isTeamGroup())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
FightSystem.getMessage().send("INFO_RANKED", player, !FightStatistics.isUnranked());
|
||||||
|
for(FightTeam team : Fight.teams()) {
|
||||||
|
if(!team.isLeaderless())
|
||||||
|
FightSystem.getMessage().send("INFO_LEADER", player, team.getColoredName(), team.getLeader().getPlayer().getName());
|
||||||
|
|
||||||
|
if(team.getSchematic() != 0) {
|
||||||
|
SchematicNode schematic = SchematicNode.getSchematicNode(team.getSchematic());
|
||||||
|
FightSystem.getMessage().send("INFO_SCHEMATIC", player, team.getColoredName(), schematic.getName(), SteamwarUser.get(schematic.getOwner()).getUserName(), schematic.getRank());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -53,6 +53,10 @@ public class FightStatistics {
|
|||||||
FightUI.addSubtitle("UI_UNRANKED");
|
FightUI.addSubtitle("UI_UNRANKED");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isUnranked() {
|
||||||
|
return unranked;
|
||||||
|
}
|
||||||
|
|
||||||
private Timestamp starttime = Timestamp.from(Instant.now());
|
private Timestamp starttime = Timestamp.from(Instant.now());
|
||||||
|
|
||||||
public FightStatistics() {
|
public FightStatistics() {
|
||||||
|
@ -14,6 +14,7 @@ commands:
|
|||||||
ak:
|
ak:
|
||||||
request:
|
request:
|
||||||
requests:
|
requests:
|
||||||
|
info:
|
||||||
leave:
|
leave:
|
||||||
ready:
|
ready:
|
||||||
kit:
|
kit:
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren