Switched to cosmos (1.21.6)
This commit is contained in:
parent
95bb1e90fe
commit
c163885345
|
|
@ -36,8 +36,8 @@ tasks {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// Galaxy
|
// Cosmos
|
||||||
compileOnly("com.alttd:Galaxy-API:1.21-R0.1-SNAPSHOT") {
|
compileOnly("com.alttd.cosmos:cosmos-api:1.21.6-R0.1-SNAPSHOT") {
|
||||||
isChanging = true
|
isChanging = true
|
||||||
}
|
}
|
||||||
// Lombok
|
// Lombok
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import com.alttd.commands.subcommands.CommandHelp;
|
||||||
import com.alttd.commands.subcommands.CommandReload;
|
import com.alttd.commands.subcommands.CommandReload;
|
||||||
import com.alttd.config.Config;
|
import com.alttd.config.Config;
|
||||||
import com.alttd.util.Logger;
|
import com.alttd.util.Logger;
|
||||||
|
import lombok.Getter;
|
||||||
import org.bukkit.command.*;
|
import org.bukkit.command.*;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
@ -15,6 +16,7 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Getter
|
||||||
public class CommandManager implements CommandExecutor, TabExecutor {
|
public class CommandManager implements CommandExecutor, TabExecutor {
|
||||||
private final List<SubCommand> subCommands;
|
private final List<SubCommand> subCommands;
|
||||||
|
|
||||||
|
|
@ -45,7 +47,7 @@ public class CommandManager implements CommandExecutor, TabExecutor {
|
||||||
subCommand = getSubCommand(args[0]);
|
subCommand = getSubCommand(args[0]);
|
||||||
|
|
||||||
if (!commandSender.hasPermission(subCommand.getPermission())) {
|
if (!commandSender.hasPermission(subCommand.getPermission())) {
|
||||||
commandSender.sendMiniMessage(Config.NO_PERMISSION, null);
|
commandSender.sendRichMessage(Config.NO_PERMISSION);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -61,7 +63,7 @@ public class CommandManager implements CommandExecutor, TabExecutor {
|
||||||
.filter(subCommand -> commandSender.hasPermission(subCommand.getPermission()))
|
.filter(subCommand -> commandSender.hasPermission(subCommand.getPermission()))
|
||||||
.map(SubCommand::getName)
|
.map(SubCommand::getName)
|
||||||
.filter(name -> args.length == 0 || name.startsWith(args[0]))
|
.filter(name -> args.length == 0 || name.startsWith(args[0]))
|
||||||
.collect(Collectors.toList())
|
.toList()
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
SubCommand subCommand = getSubCommand(args[0]);
|
SubCommand subCommand = getSubCommand(args[0]);
|
||||||
|
|
@ -71,10 +73,6 @@ public class CommandManager implements CommandExecutor, TabExecutor {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SubCommand> getSubCommands() {
|
|
||||||
return subCommands;
|
|
||||||
}
|
|
||||||
|
|
||||||
private SubCommand getSubCommand(String cmdName) {
|
private SubCommand getSubCommand(String cmdName) {
|
||||||
return subCommands.stream()
|
return subCommands.stream()
|
||||||
.filter(subCommand -> subCommand.getName().equals(cmdName))
|
.filter(subCommand -> subCommand.getName().equals(cmdName))
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ public class CommandGUI extends SubCommand {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender commandSender, String[] args) {
|
public boolean onCommand(CommandSender commandSender, String[] args) {
|
||||||
if (!(commandSender instanceof Player player)) {
|
if (!(commandSender instanceof Player player)) {
|
||||||
commandSender.sendMiniMessage(Config.NO_CONSOLE, null);
|
commandSender.sendRichMessage(Config.NO_CONSOLE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
new OpenParticleGUI(player).open(player);
|
new OpenParticleGUI(player).open(player);
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,11 @@ public class CommandHelp extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender commandSender, String[] args) {
|
public boolean onCommand(CommandSender commandSender, String[] args) {
|
||||||
commandSender.sendMiniMessage(Config.HELP_MESSAGE_WRAPPER.replaceAll("<commands>", commandManager
|
commandSender.sendRichMessage(Config.HELP_MESSAGE_WRAPPER.replaceAll("<commands>", commandManager
|
||||||
.getSubCommands().stream()
|
.getSubCommands().stream()
|
||||||
.filter(subCommand -> commandSender.hasPermission(subCommand.getPermission()))
|
.filter(subCommand -> commandSender.hasPermission(subCommand.getPermission()))
|
||||||
.map(SubCommand::getHelpMessage)
|
.map(SubCommand::getHelpMessage)
|
||||||
.collect(Collectors.joining("\n"))), null);
|
.collect(Collectors.joining("\n"))));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ public class CommandReload extends SubCommand {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender commandSender, String[] args) {
|
public boolean onCommand(CommandSender commandSender, String[] args) {
|
||||||
AltitudeParticles.getInstance().reload();
|
AltitudeParticles.getInstance().reload();
|
||||||
commandSender.sendMiniMessage("<green>Reloaded AltitudeParticles config.</green>", null);
|
commandSender.sendRichMessage("<green>Reloaded AltitudeParticles config.</green>");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user