Added GUI's
Added player settings Added commands
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.alttd.commands;
|
||||
|
||||
import com.alttd.AltitudeParticles;
|
||||
import com.alttd.commands.subcommands.CommandGUI;
|
||||
import com.alttd.commands.subcommands.CommandHelp;
|
||||
import com.alttd.commands.subcommands.CommandReload;
|
||||
import com.alttd.config.Config;
|
||||
@@ -31,20 +32,17 @@ public class CommandManager implements CommandExecutor, TabExecutor {
|
||||
|
||||
subCommands = Arrays.asList(
|
||||
new CommandHelp(this),
|
||||
new CommandReload());
|
||||
new CommandReload(),
|
||||
new CommandGUI());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String cmd, @NotNull String[] args) {
|
||||
if (args.length == 0) {
|
||||
commandSender.sendMiniMessage(Config.HELP_MESSAGE_WRAPPER.replaceAll("<config>", subCommands.stream()
|
||||
.filter(subCommand -> commandSender.hasPermission(subCommand.getPermission()))
|
||||
.map(SubCommand::getHelpMessage)
|
||||
.collect(Collectors.joining("\n"))), null);
|
||||
return true;
|
||||
}
|
||||
|
||||
SubCommand subCommand = getSubCommand(args[0]);
|
||||
SubCommand subCommand;
|
||||
if (args.length == 0)
|
||||
subCommand = getSubCommand("gui");
|
||||
else
|
||||
subCommand = getSubCommand(args[0]);
|
||||
|
||||
if (!commandSender.hasPermission(subCommand.getPermission())) {
|
||||
commandSender.sendMiniMessage(Config.NO_PERMISSION, null);
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.alttd.commands.subcommands;
|
||||
|
||||
import com.alttd.commands.SubCommand;
|
||||
import com.alttd.config.Config;
|
||||
import com.alttd.gui.windows.OpenParticleGUI;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CommandGUI extends SubCommand {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender commandSender, String[] args) {
|
||||
if (!(commandSender instanceof Player player)) {
|
||||
commandSender.sendMiniMessage(Config.NO_CONSOLE, null);
|
||||
return true;
|
||||
}
|
||||
new OpenParticleGUI(player).open(player);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "gui";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabComplete(CommandSender commandSender, String[] args) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelpMessage() {
|
||||
return Config.GUI_HELP_MESSAGE;
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,6 @@ public class CommandReload extends SubCommand {
|
||||
|
||||
@Override
|
||||
public String getHelpMessage() {
|
||||
return Config.RELOAD_MESSAGE;
|
||||
return Config.RELOAD_HELP_MESSAGE;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user