Skip to content

Commit

Permalink
Support for Minecraft 1.21.1 and updated Command Framework
Browse files Browse the repository at this point in the history
  • Loading branch information
Despical committed Aug 11, 2024
1 parent 5b98eaa commit 9d47bb4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>me.despical</groupId>
<artifactId>king-of-the-ladder</artifactId>
<version>3.0.1</version>
<version>3.0.2</version>

<name>King of the Ladder</name>
<inceptionYear>2020</inceptionYear>
Expand Down Expand Up @@ -70,12 +70,12 @@
<dependency>
<groupId>com.github.Despical</groupId>
<artifactId>InventoryFramework</artifactId>
<version>2.3.1</version>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>com.github.Despical</groupId>
<artifactId>CommandFramework</artifactId>
<version>1.4.7</version>
<version>1.4.9</version>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/me/despical/kotl/commands/AdminCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
package me.despical.kotl.commands;

import me.despical.commandframework.*;
import me.despical.commandframework.annotations.Command;
import me.despical.commandframework.annotations.Completer;
import me.despical.commandframework.annotations.Cooldown;
import me.despical.commons.configuration.ConfigUtils;
import me.despical.commons.miscellaneous.AttributeUtils;
import me.despical.commons.miscellaneous.MiscUtils;
Expand All @@ -41,8 +44,6 @@
import java.util.List;
import java.util.stream.Collectors;

import static me.despical.commandframework.Command.SenderType.PLAYER;

/**
* @author Despical
* <p>
Expand Down Expand Up @@ -173,7 +174,7 @@ public void deleteCommand(CommandArguments arguments) {
usage = "/kotl edit <arena>",
desc = "Opens the arena editor",
min = 1,
senderType = PLAYER
senderType = Command.SenderType.PLAYER
)
public void editCommand(CommandArguments arguments) {
final var arena = plugin.getArenaRegistry().getArena(arguments.getArgument(0));
Expand Down
14 changes: 6 additions & 8 deletions src/main/java/me/despical/kotl/commands/PlayerCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

package me.despical.kotl.commands;

import me.despical.commandframework.Command;
import me.despical.commandframework.CommandArguments;
import me.despical.commandframework.CommandFramework;
import me.despical.commandframework.Message;
import me.despical.commandframework.annotations.Command;
import me.despical.commons.string.StringMatcher;
import me.despical.kotl.Main;
import me.despical.kotl.api.StatsStorage;
Expand All @@ -35,8 +35,8 @@
import java.sql.SQLException;
import java.sql.Statement;
import java.util.*;
import java.util.function.BiFunction;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
* @author Despical
Expand All @@ -48,17 +48,15 @@ public class PlayerCommands extends AbstractCommand {
public PlayerCommands(Main plugin) {
super(plugin);

BiFunction<Command, CommandArguments, Boolean> sendUsage = (command, arguments) -> {
Stream.of(Message.SHORT_ARG_SIZE, Message.LONG_ARG_SIZE).forEach(message -> message.setMessage((command, arguments) -> {
arguments.sendMessage(chatManager.prefixedMessage("commands.correct_usage").replace("%usage%", command.usage()));
return true;
};

CommandFramework.SHORT_ARG_SIZE = CommandFramework.LONG_ARG_SIZE = sendUsage;
}));
}

@Command(
name = "kotl",
desc = "Main command of King of the Ladder plugin.",
desc = "Main command of the plugin.",
usage = "/kotl help"
)
public void mainCommand(CommandArguments arguments) {
Expand Down

0 comments on commit 9d47bb4

Please sign in to comment.