Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/deploy-development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Latest Commit
uses: actions/checkout@v4.2.2
uses: actions/checkout@v6.0.3
- name: Bump Version
id: bump
uses: Plugily-Projects/version-bump-action@v10
Expand All @@ -23,27 +23,27 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Latest Commit
uses: actions/checkout@v4.2.2
uses: actions/checkout@v6.0.3
with:
ref: 'development'
- name: Set up JDK
uses: actions/setup-java@v4.6.0
uses: actions/setup-java@v5.2.0
with:
distribution: 'temurin'
java-version: '21'
java-package: jdk
- name: Set up Maven
uses: stCarolas/setup-maven@v5
uses: stCarolas/setup-maven@v5.1
with:
maven-version: 3.8.2
- name: Cache
uses: actions/cache@v4.2.2
uses: actions/cache@v5.0.5
with:
path: ~/.m2/repository
key: maven-${{ hashFiles('**/pom.xml') }}
restore-keys: maven-
- name: Publish with Maven
uses: s4u/maven-settings-action@v3.1.0
uses: s4u/maven-settings-action@v4.0.0
with:
servers: |
[{
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/deploy-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Latest Commit
uses: actions/checkout@v4.2.2
uses: actions/checkout@v6.0.3
- name: Bump Version
id: bump
uses: Plugily-Projects/version-bump-action@v10
Expand All @@ -26,27 +26,27 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Latest Commit
uses: actions/checkout@v4.2.2
uses: actions/checkout@v6.0.3
with:
ref: 'master'
- name: Set up JDK
uses: actions/setup-java@v4.6.0
uses: actions/setup-java@v5.2.0
with:
distribution: 'temurin'
java-version: '21'
java-package: jdk
- name: Set up Maven
uses: stCarolas/setup-maven@v5
uses: stCarolas/setup-maven@v5.1
with:
maven-version: 3.8.2
- name: Cache
uses: actions/cache@v4.2.2
uses: actions/cache@v5.0.5
with:
path: ~/.m2/repository
key: maven-${{ hashFiles('**/pom.xml') }}
restore-keys: maven-
- name: Publish with Maven
uses: s4u/maven-settings-action@v3.1.0
uses: s4u/maven-settings-action@v4.0.0
with:
servers: |
[{
Expand Down
2 changes: 1 addition & 1 deletion MiniGamesBox API/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<artifactId>minigamesbox</artifactId>
<groupId>plugily.projects</groupId>
<version>1.4.6</version>
<version>1.4.6-SNAPSHOT1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion MiniGamesBox Classic/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<artifactId>minigamesbox</artifactId>
<groupId>plugily.projects</groupId>
<version>1.4.6</version>
<version>1.4.6-SNAPSHOT1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,57 +105,78 @@
}

@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

Check warning on line 108 in MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/commands/arguments/PluginArgumentsRegistry.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

A "Brain Method" was detected. Refactor it to reduce at least one of the following metrics: LOC from 66 to 64, Complexity from 22 to 14, Nesting Level from 3 to 2, Number of Variables from 12 to 6.

See more on https://sonarcloud.io/project/issues?id=Plugily-Projects_MiniGamesBox&issues=AZ6t08-ptCHXlkmpvlA8&open=AZ6t08-ptCHXlkmpvlA8&pullRequest=77
String commandName = cmd.getName();

List<CommandArgument> arguments = null;
for(Map.Entry<String, List<CommandArgument>> entry : mappedArguments.entrySet()) {
if(!cmd.getName().equalsIgnoreCase(entry.getKey())) {
continue;
if(commandName.equalsIgnoreCase(entry.getKey())) {
arguments = entry.getValue();
break;
}
}
if(arguments == null) {
return false;
}

if(commandName.equalsIgnoreCase(plugin.getPluginNamePrefixLong())) {
if(args.length == 0 || args[0].equalsIgnoreCase("help")) {
sendHelpCommand(sender);
return true;
}
if(cmd.getName().equalsIgnoreCase(plugin.getPluginNamePrefixLong())) {
if(args.length == 0 || args[0].equalsIgnoreCase("help")) {
sendHelpCommand(sender);
if(args.length > 1 && args[0].equalsIgnoreCase("edit")) {
if(!checkSenderIsExecutorType(sender, CommandArgument.ExecutorType.PLAYER)
|| !plugin.getBukkitHelper().hasPermission(sender, plugin.getPluginNamePrefixLong() + ".admin.setup")) {
return true;
}
if(args.length > 1 && args[0].equalsIgnoreCase("edit")) {
if(!checkSenderIsExecutorType(sender, CommandArgument.ExecutorType.PLAYER)
|| !plugin.getBukkitHelper().hasPermission(sender, plugin.getPluginNamePrefixLong() + ".admin.setup")) {
return true;
}
IPluginArena arena = plugin.getArenaRegistry().getArena(args[1]);
if(arena == null) {
new MessageBuilder("COMMANDS_NO_ARENA_LIKE_THAT").asKey().send(sender);
return true;
}
plugin.getSetupInventory((Player) sender, arena.getId()).open();
IPluginArena arena = plugin.getArenaRegistry().getArena(args[1]);
if(arena == null) {
new MessageBuilder("COMMANDS_NO_ARENA_LIKE_THAT").asKey().send(sender);
return true;
}
plugin.getSetupInventory((Player) sender, arena.getId()).open();
return true;
}
if(cmd.getName().equalsIgnoreCase(plugin.getCommandAdminPrefixLong()) && (args.length == 0 || args[0].equalsIgnoreCase("help"))) {
if(!sender.hasPermission(plugin.getPluginNamePrefixLong() + ".admin")) {
return true;
}
sendAdminHelpCommand(sender);
}

if(commandName.equalsIgnoreCase(plugin.getCommandAdminPrefixLong()) && (args.length == 0 || args[0].equalsIgnoreCase("help"))) {
if(!sender.hasPermission(plugin.getPluginNamePrefixLong() + ".admin")) {
return true;
}
for(CommandArgument argument : entry.getValue()) {
if(argument.getArgumentName().equalsIgnoreCase(args[0])) {
for(String perm : argument.getPermissions()) {
if(perm.isEmpty() || plugin.getBukkitHelper().hasPermission(sender, perm)) {
return true;
}
}
if(checkSenderIsExecutorType(sender, argument.getValidExecutors())) {
argument.execute(sender, args);
return true;
}
}
sendAdminHelpCommand(sender);
return true;
}

if(args.length == 0) {
return false;
}

for(CommandArgument argument : arguments) {
if(!argument.getArgumentName().equalsIgnoreCase(args[0])) {
continue;
}
boolean hasPermission = argument.getPermissions().stream()
.anyMatch(perm -> perm.isEmpty() || sender.hasPermission(perm));

//sending did you mean help
List<StringMatcher.Match> matches = StringMatcher.match(args[0], entry.getValue().stream().map(CommandArgument::getArgumentName).collect(Collectors.toList()));
if(!matches.isEmpty()) {
new MessageBuilder("COMMANDS_DID_YOU_MEAN").asKey().value(label + " " + matches.get(0).getMatch()).send(sender);
if(!hasPermission) {
new MessageBuilder("COMMANDS_NO_PERMISSION").asKey().send(sender);
return true;
}

if(checkSenderIsExecutorType(sender, argument.getValidExecutors())) {
argument.execute(sender, args);
}
return true;
}

List<String> argumentNames = arguments.stream()
.map(CommandArgument::getArgumentName)
.collect(Collectors.toList());

List<StringMatcher.Match> matches = StringMatcher.match(args[0], argumentNames);
if(!matches.isEmpty()) {
new MessageBuilder("COMMANDS_DID_YOU_MEAN").asKey().value(label + " " + matches.get(0).getMatch()).send(sender);
return true;
}
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion MiniGamesBox Database/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<artifactId>minigamesbox</artifactId>
<groupId>plugily.projects</groupId>
<version>1.4.6</version>
<version>1.4.6-SNAPSHOT1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion MiniGamesBox Inventory/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<artifactId>minigamesbox</artifactId>
<groupId>plugily.projects</groupId>
<version>1.4.6</version>
<version>1.4.6-SNAPSHOT1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion MiniGamesBox Utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<artifactId>minigamesbox</artifactId>
<groupId>plugily.projects</groupId>
<version>1.4.6</version>
<version>1.4.6-SNAPSHOT1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<groupId>plugily.projects</groupId>
<artifactId>minigamesbox</artifactId>
<version>1.4.6</version>
<version>1.4.6-SNAPSHOT1</version>
<packaging>pom</packaging>

<modules>
Expand Down