geforkt von SteamWar/BungeeCore
Rework two commands
Dieser Commit ist enthalten in:
Ursprung
b4ad223831
Commit
24456458de
@ -136,7 +136,7 @@ public class BungeeCore extends Plugin {
|
||||
new KickCommand();
|
||||
new JoinmeCommand();
|
||||
new TpCommand();
|
||||
new HelpCommand();
|
||||
HelpCommand helpCommand = new HelpCommand();
|
||||
new TeamCommand();
|
||||
new ServerTeamchatCommand();
|
||||
new DevCommand();
|
||||
@ -176,7 +176,7 @@ public class BungeeCore extends Plugin {
|
||||
new PunishmentCommand("note", Punishment.PunishmentType.Note);
|
||||
|
||||
if(!EVENT_MODE){
|
||||
new BauCommand();
|
||||
new BauCommand(helpCommand);
|
||||
new WebpasswordCommand();
|
||||
new FightCommand();
|
||||
new ChallengeCommand();
|
||||
|
@ -41,13 +41,16 @@ import java.util.Map;
|
||||
|
||||
public class BauCommand extends SWCommand {
|
||||
|
||||
public BauCommand(){
|
||||
private final HelpCommand command;
|
||||
|
||||
public BauCommand(HelpCommand command){
|
||||
super("bau", null, "b", "build", "gs");
|
||||
this.command = command;
|
||||
}
|
||||
|
||||
@Register(help = true)
|
||||
public void genericHelp(ProxiedPlayer p, String... args) {
|
||||
HelpCommand.sendBauHelp(ChatSender.of(p));
|
||||
this.command.sendBauHelp(p);
|
||||
}
|
||||
|
||||
@Register
|
||||
|
@ -20,72 +20,61 @@
|
||||
package de.steamwar.bungeecore.commands;
|
||||
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.messages.ChatSender;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.protocol.packet.Chat;
|
||||
|
||||
public class HelpCommand extends BasicCommand {
|
||||
public class HelpCommand extends SWCommand {
|
||||
|
||||
public HelpCommand() {
|
||||
super("help", "", "?");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender s, String[] args) {
|
||||
ChatSender sender = ChatSender.of(s);
|
||||
if (args.length < 1) {
|
||||
printPage(sender, ClickEvent.Action.RUN_COMMAND,
|
||||
"HELP_LOBBY", "/l",
|
||||
"HELP_BAU", "/build",
|
||||
"HELP_BAUSERVER", "/help build",
|
||||
"HELP_FIGHT", "/fight",
|
||||
"HELP_CHALLENGE", "/challenge",
|
||||
"HELP_HISTORIC", "/historic",
|
||||
"HELP_TEAM", "/team",
|
||||
"HELP_JOIN", "/join",
|
||||
"HELP_LOCAL", "/local");
|
||||
}else if (args[0].equalsIgnoreCase("buildserver")) {
|
||||
sendBauHelp(sender);
|
||||
}else if (args[0].equalsIgnoreCase("build")) {
|
||||
bauHelpGroup(sender, args);
|
||||
}
|
||||
}
|
||||
@Register
|
||||
public void genericCommand(ProxiedPlayer player) {
|
||||
ChatSender sender = ChatSender.of(player);
|
||||
|
||||
private static void bauHelpGroup(ChatSender sender, String[] args) {
|
||||
if (args.length < 2) {
|
||||
sendBauHelpGroup(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (args[1].toLowerCase()) {
|
||||
case "admin":
|
||||
case "owner":
|
||||
case "bauwelt":
|
||||
sender.system("HELP_BAU_GROUP_ADMIN_TITLE");
|
||||
sendBauHelp(sender);
|
||||
return;
|
||||
case "world":
|
||||
printPage(sender, "HELP_BAU_GROUP_WORLD_TITLE", "HELP_TNT", "HELP_FIRE", "HELP_FREEZE", "HELP_TPSLIMIT", "HELP_PROTECT", "HELP_RESET");
|
||||
return;
|
||||
case "player":
|
||||
printPage(sender, "HELP_BAU_GROUP_PLAYER_TITLE", "HELP_SPEED", "HELP_NV", "HELP_WV", "HELP_DEBUGSTICK", "HELP_TRACE", "HELP_LOADER");
|
||||
return;
|
||||
case "worldedit":
|
||||
case "we":
|
||||
case "world-edit":
|
||||
case "edit":
|
||||
printPage(sender, "HELP_BAU_GROUP_WE_TITLE", "HELP_WE_POS1", "HELP_WE_POS2", "HELP_WE_COPY", "HELP_WE_PASTE", "HELP_WE_FLOPY", "HELP_WE_FLOPYP", "HELP_WE_ROTATE_90", "HELP_WE_ROTATE_180", "HELP_WE_ROTATE_N90");
|
||||
return;
|
||||
case "other":
|
||||
printPage(sender, "HELP_BAU_GROUP_OTHER_TITLE", "HELP_TESTBLOCK", "HELP_SKULL", "HELP_BAUINFO");
|
||||
return;
|
||||
default:
|
||||
sendBauHelpGroup(sender);
|
||||
}
|
||||
}
|
||||
|
||||
private static void sendBauHelpGroup(ChatSender sender) {
|
||||
printPage(sender, ClickEvent.Action.RUN_COMMAND,
|
||||
"HELP_LOBBY", "/l",
|
||||
"HELP_BAU", "/build",
|
||||
"HELP_BAUSERVER", "/help build",
|
||||
"HELP_FIGHT", "/fight",
|
||||
"HELP_CHALLENGE", "/challenge",
|
||||
"HELP_HISTORIC", "/historic",
|
||||
"HELP_TEAM", "/team",
|
||||
"HELP_JOIN", "/join",
|
||||
"HELP_LOCAL", "/local");
|
||||
}
|
||||
|
||||
@Register({"build","world"})
|
||||
public void buildWorld(ProxiedPlayer player) {
|
||||
printPage(ChatSender.of(player), "HELP_BAU_GROUP_WORLD_TITLE", "HELP_TNT", "HELP_FIRE", "HELP_FREEZE", "HELP_TPSLIMIT", "HELP_PROTECT", "HELP_RESET");
|
||||
}
|
||||
|
||||
@Register({"build","player"})
|
||||
public void buildPlayer(ProxiedPlayer player) {
|
||||
printPage(ChatSender.of(player), "HELP_BAU_GROUP_PLAYER_TITLE", "HELP_SPEED", "HELP_NV", "HELP_WV", "HELP_DEBUGSTICK", "HELP_TRACE", "HELP_LOADER");
|
||||
}
|
||||
|
||||
@Register({"build","worldedit"})
|
||||
@Register({"build","we"})
|
||||
@Register({"build","world-edit"})
|
||||
@Register({"build","edit"})
|
||||
public void buildWorldedit(ProxiedPlayer player) {
|
||||
printPage(ChatSender.of(player), "HELP_BAU_GROUP_WE_TITLE", "HELP_WE_POS1", "HELP_WE_POS2", "HELP_WE_COPY", "HELP_WE_PASTE", "HELP_WE_FLOPY", "HELP_WE_FLOPYP", "HELP_WE_ROTATE_90", "HELP_WE_ROTATE_180", "HELP_WE_ROTATE_N90");
|
||||
}
|
||||
|
||||
@Register({"build","other"})
|
||||
public void buildOther(ProxiedPlayer player) {
|
||||
printPage(ChatSender.of(player), "HELP_BAU_GROUP_OTHER_TITLE", "HELP_TESTBLOCK", "HELP_SKULL", "HELP_BAUINFO");
|
||||
}
|
||||
|
||||
@Register("build")
|
||||
public void sendBauHelpGroup(ProxiedPlayer player) {
|
||||
printPage(ChatSender.of(player), ClickEvent.Action.RUN_COMMAND,
|
||||
"HELP_BAU_GROUP_ADMIN", "/help build admin",
|
||||
"HELP_BAU_GROUP_WORLD", "/help build world",
|
||||
"HELP_BAU_GROUP_PLAYER", "/help build player",
|
||||
@ -93,8 +82,12 @@ public class HelpCommand extends BasicCommand {
|
||||
"HELP_BAU_GROUP_OTHER", "/help build other");
|
||||
}
|
||||
|
||||
static void sendBauHelp(ChatSender sender) {
|
||||
printPage(sender, ClickEvent.Action.SUGGEST_COMMAND,
|
||||
@Register("buildserver")
|
||||
@Register({"build","admin"})
|
||||
@Register({"build","owner"})
|
||||
@Register({"build","bauwelt"})
|
||||
public void sendBauHelp(ProxiedPlayer player) {
|
||||
printPage(ChatSender.of(player), ClickEvent.Action.SUGGEST_COMMAND,
|
||||
"HELP_BAU_TP", "/build tp ",
|
||||
"HELP_BAU_ADDMEMBER", "/build addmember ",
|
||||
"HELP_BAU_DELMEMBER", "/build delmember ",
|
||||
|
@ -21,29 +21,27 @@ package de.steamwar.bungeecore.commands;
|
||||
|
||||
import de.steamwar.bungeecore.listeners.ChatListener;
|
||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.messages.ChatSender;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
public class TeamchatCommand extends BasicCommand {
|
||||
public class TeamchatCommand extends SWCommand {
|
||||
|
||||
public TeamchatCommand() {
|
||||
super("tc", "","teamchat");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender s, String[] args) {
|
||||
ChatSender sender = ChatSender.of(s);
|
||||
if(args.length == 0){
|
||||
sender.system("TC_USAGE");
|
||||
return;
|
||||
}
|
||||
|
||||
@Register
|
||||
public void genericCommand(ProxiedPlayer player, @ErrorMessage(value = "TC_USAGE", allowEAs = false) String... args) {
|
||||
ChatSender sender = ChatSender.of(player);
|
||||
SteamwarUser user = sender.user();
|
||||
|
||||
if(user.getTeam() == 0){
|
||||
sender.system("TC_NO_TEAM");
|
||||
return;
|
||||
}
|
||||
|
||||
ChatListener.sendChat(sender, ChatSender.allReceivers().filter(player -> player.user().getTeam() == user.getTeam()), "CHAT_TEAM", null, String.join(" ", args));
|
||||
ChatListener.sendChat(sender, ChatSender.allReceivers().filter(p -> p.user().getTeam() == user.getTeam()), "CHAT_TEAM", null, String.join(" ", args));
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren