Skip to content

Commit

Permalink
Merge pull request #589 from JorelAli/release/9.5.2
Browse files Browse the repository at this point in the history
Release/9.5.2
  • Loading branch information
JorelAli authored Aug 11, 2024
2 parents d130bde + ce0eeb6 commit f2207dc
Show file tree
Hide file tree
Showing 1,085 changed files with 59,176 additions and 3,939 deletions.
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ body:
description: What version of Minecraft are you using? _(If using a minor version that isn't specified, such as 1.18.1, just select the latest version below it such as 1.18)_
multiple: false
options:
- "1.21"
- "1.20.6"
- "1.20.5"
- "1.20.4"
- "1.20.3"
Expand Down
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = CommandAPI
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 9.5.1
PROJECT_NUMBER = 9.5.2

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
50 changes: 34 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,23 @@ The list of what version of the CommandAPI you'll need to run on a specific vers
| **1.16.2** | v4.0 - 5.12, 8.3.0 - 9.4.2 | 9.4.2 | 16 |
| **1.16.3** | v4.2 - 5.12, 8.3.0 - 9.4.2 | 9.4.2 | 16 |
| **1.16.4** | v5.2 - 5.12, 8.3.0 - 9.4.2 | 9.4.2 | 16 |
| **1.16.5** | v5.7 - 7.0.0, 8.3.0 - 9.5.1 | 9.5.1 | 16 |
| **1.17** | 6.0.x - 9.5.1 | 9.5.1 | 16 |
| **1.17.1** | 6.1.x - 9.5.1 | 9.5.1 | 16 |
| **1.18, 1.18.1** | 6.5.2 - 9.5.1 | 9.5.1 | 16 |
| **1.18.2** | 6.5.4 - 9.5.1 | 9.5.1 | 16 |
| **1.19** | 8.3.0 - 9.5.1 | 9.5.1 | 16 |
| **1.19.1** | 8.5.0 - 9.5.1 | 9.5.1 | 16 |
| **1.19.2** | 8.5.1 - 9.5.1 | 9.5.1 | 16 |
| **1.19.3** | 8.7.0 - 9.5.1 | 9.5.1 | 16 |
| **1.19.4** | 8.8.0 - 9.5.1 | 9.5.1 | 16 |
| **1.20** | 9.0.2 - 9.5.1 | 9.5.1 | 16 |
| **1.20.1** | 9.0.3 - 9.5.1 | 9.5.1 | 16 |
| **1.20.2** | 9.2.0 - 9.5.1 | 9.5.1 | 16 |
| **1.20.3, 1.20.4** | 9.3.0 - 9.5.1 | 9.5.1 | 16 |
| **1.20.5, 1.20.6** | 9.4.0 - 9.5.1 | 9.5.1 | 16 |
| **1.21** | 9.5.0 - 9.5.1 | 9.5.1 | 16 |
| **1.16.5** | v5.7 - 7.0.0, 8.3.0 - 9.5.2 | 9.5.2 | 16 |
| **1.17** | 6.0.x - 9.5.2 | 9.5.2 | 16 |
| **1.17.1** | 6.1.x - 9.5.2 | 9.5.2 | 16 |
| **1.18, 1.18.1** | 6.5.2 - 9.5.2 | 9.5.2 | 16 |
| **1.18.2** | 6.5.4 - 9.5.2 | 9.5.2 | 16 |
| **1.19** | 8.3.0 - 9.5.2 | 9.5.2 | 16 |
| **1.19.1** | 8.5.0 - 9.5.2 | 9.5.2 | 16 |
| **1.19.2** | 8.5.1 - 9.5.2 | 9.5.2 | 16 |
| **1.19.3** | 8.7.0 - 9.5.2 | 9.5.2 | 16 |
| **1.19.4** | 8.8.0 - 9.5.2 | 9.5.2 | 16 |
| **1.20** | 9.0.2 - 9.5.2 | 9.5.2 | 16 |
| **1.20.1** | 9.0.3 - 9.5.2 | 9.5.2 | 16 |
| **1.20.2** | 9.2.0 - 9.5.2 | 9.5.2 | 16 |
| **1.20.3, 1.20.4** | 9.3.0 - 9.5.2 | 9.5.2 | 16 |
| **1.20.5, 1.20.6** | 9.4.0 - 9.5.2 | 9.5.2 | 16 |
| **1.21** | 9.5.0 - 9.5.2 | 9.5.2 | 16 |
| **1.21.1** | 9.5.2 | 9.5.2 | 16 |

-----

Expand Down Expand Up @@ -408,6 +409,23 @@ This is the current roadmap for the CommandAPI (as of 30th April 2024):
</tr>
</thead>
<tbody>
<tr>
<td valign="top"><b>9.5.2</b></td>
<td valign="top">August 2024</td>
<td valign="top">
<b>Minecraft Version Changes:</b>
<ul>
<li>Adds support for Minecraft 1.21.1</li>
</ul>
<b>CommandAPI Changes:</b>
<ul>
<li>https://github.com/JorelAli/CommandAPI/pull/588 Fix Folia scheduling methods using the wrong scheduler implementation</li>
<li>https://github.com/JorelAli/CommandAPI/issues/577 Adds a <code>CommandAPIBukkit#failWithAdventureComponent(ComponentLike)</code> method</li>
<li>https://github.com/JorelAli/CommandAPI/pull/580 Fix running a non-vanilla command on paper in Minecraft functions with the CommandAPI throwing runtime exceptions</li>
<li>Fix namespaces not being propagated when registering subcommands</li>
</ul>
</td>
</tr>
<tr>
<td valign="top"><b>9.5.1</b></td>
<td valign="top">June 2024</td>
Expand Down
2 changes: 1 addition & 1 deletion commandapi-annotations/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>dev.jorel</groupId>
<artifactId>commandapi</artifactId>
<version>9.5.1</version>
<version>9.5.2</version>
</parent>

<artifactId>commandapi-annotations</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion commandapi-codecov/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>dev.jorel</groupId>
<artifactId>commandapi</artifactId>
<version>9.5.1</version>
<version>9.5.2</version>
</parent>

<artifactId>commandapi-codecov</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion commandapi-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<artifactId>commandapi</artifactId>
<groupId>dev.jorel</groupId>
<version>9.5.1</version>
<version>9.5.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ Impl setConverted(boolean isConverted) {
// shouldn't be accessing/depending on any of the contents of the current class instance)
@SuppressWarnings({ "unchecked", "rawtypes" })
private static <Impl extends AbstractCommandAPICommand<Impl, Argument, CommandSender>, Argument extends AbstractArgument<?, ?, Argument, CommandSender>, CommandSender>
void flatten(Impl rootCommand, List<Argument> prevArguments, Impl subcommand) {
void flatten(Impl rootCommand, List<Argument> prevArguments, Impl subcommand, String namespace) {
// Get the list of literals represented by the current subcommand. This
// includes the subcommand's name and any aliases for this subcommand
String[] literals = new String[subcommand.meta.aliases.length + 1];
Expand Down Expand Up @@ -243,11 +243,11 @@ void flatten(Impl rootCommand, List<Argument> prevArguments, Impl subcommand) {
rootCommand.withArguments(subcommand.arguments);
rootCommand.executor = subcommand.executor;
rootCommand.subcommands = new ArrayList<>();
rootCommand.register();
rootCommand.register(namespace);
}

for (Impl subsubcommand : subcommand.getSubcommands()) {
flatten(rootCommand, new ArrayList<>(prevArguments), subsubcommand);
flatten(rootCommand, new ArrayList<>(prevArguments), subsubcommand, namespace);
}
}

Expand Down Expand Up @@ -310,7 +310,7 @@ public void register(String namespace) {

// Convert subcommands into multiliteral arguments
for (Impl subcommand : this.subcommands) {
flatten(this.copy(), new ArrayList<>(), subcommand);
flatten(this.copy(), new ArrayList<>(), subcommand, namespace);
}
}

Expand Down
17 changes: 17 additions & 0 deletions commandapi-core/src/main/java/dev/jorel/commandapi/CommandAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ private CommandAPI() {
private static boolean loaded;
private static InternalConfig config;
private static CommandAPILogger logger;
private static String loadedStack;

// Accessing static variables

Expand Down Expand Up @@ -96,6 +97,14 @@ public static CommandAPILogger getLogger() {
*/
public static void onLoad(CommandAPIConfig<?> config) {
if (!loaded) {
// Store the current stack trace to help diagnose multi-loading errors
final StringBuilder currentStack = new StringBuilder();
for (StackTraceElement e : Thread.currentThread().getStackTrace()) {
currentStack.append(e.toString());
currentStack.append("\n");
}
CommandAPI.loadedStack = currentStack.toString();

// Setup variables
CommandAPI.config = new InternalConfig(config);

Expand Down Expand Up @@ -124,6 +133,14 @@ public static void onLoad(CommandAPIConfig<?> config) {
loaded = true;
} else {
getLogger().severe("You've tried to call the CommandAPI's onLoad() method more than once!");
final StringBuilder currentStack = new StringBuilder();
for (StackTraceElement e : Thread.currentThread().getStackTrace()) {
currentStack.append(e.toString());
currentStack.append("\n");
}
getLogger().severe("The CommandAPI was first loaded here:\n\n" + CommandAPI.loadedStack +
"\n\nBut it is now being loaded here:\n\n" + currentStack.toString());

}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package dev.jorel.commandapi.executors;

import dev.jorel.commandapi.arguments.AbstractArgument;

import javax.annotation.Nullable;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Supplier;

import javax.annotation.Nullable;

import dev.jorel.commandapi.arguments.AbstractArgument;

/**
* This class stores the arguments for this command
*
Expand Down Expand Up @@ -600,4 +601,28 @@ private String buildExceptionMessage(Object argumentNameOrIndex, String expected
"contact the developers of the CommandAPI, we'd love to know how you managed to get this error!");
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + Arrays.deepHashCode(args);
result = prime * result + Arrays.hashCode(rawArgs);
result = prime * result + Objects.hash(argsMap, fullInput, rawArgsMap);
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
CommandArguments other = (CommandArguments) obj;
return Arrays.deepEquals(args, other.args) && Objects.equals(argsMap, other.argsMap)
&& Objects.equals(fullInput, other.fullInput) && Arrays.equals(rawArgs, other.rawArgs)
&& Objects.equals(rawArgsMap, other.rawArgsMap);
}

}
4 changes: 2 additions & 2 deletions commandapi-documentation-code/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<artifactId>commandapi</artifactId>
<groupId>dev.jorel</groupId>
<version>9.5.1</version>
<version>9.5.2</version>
</parent>

<artifactId>commandapi-documentation-code</artifactId>
Expand All @@ -19,7 +19,7 @@
</repository>
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
<repository>
<id>codemc-repo</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,23 @@ void argument_entities() {
/* ANCHOR_END: argumentEntities1 */

/* ANCHOR: argumentEntities2 */
Argument<?> noSelectorSuggestions = new PlayerArgument("target")
.replaceSafeSuggestions(SafeSuggestions.suggest(info ->
Bukkit.getOnlinePlayers().toArray(new Player[0])
));
/* ANCHOR_END: argumentEntities2 */

/* ANCHOR: argumentEntities3 */
new CommandAPICommand("warp")
.withArguments(noSelectorSuggestions)
.executesPlayer((player, args) -> {
Player target = (Player) args.get("target");
player.teleport(target);
})
.register();
/* ANCHOR_END: argumentEntities3 */

/* ANCHOR: argumentEntities4 */
new CommandAPICommand("spawnmob")
.withArguments(new EntityTypeArgument("entity"))
.withArguments(new IntegerArgument("amount", 1, 100)) // Prevent spawning too many entities
Expand All @@ -469,7 +486,7 @@ void argument_entities() {
}
})
.register();
/* ANCHOR_END: argumentEntities2 */
/* ANCHOR_END: argumentEntities4 */
}

void argument_function() {
Expand Down Expand Up @@ -2685,4 +2702,4 @@ static String getBalance(Player player) {
static void resetBalance(Player target) {
throw new UnsupportedOperationException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,23 @@ CommandAPICommand("remove")
/* ANCHOR_END: argumentEntities1 */

/* ANCHOR: argumentEntities2 */
val noSelectorSuggestions = PlayerArgument("target")
.replaceSafeSuggestions(SafeSuggestions.suggest {
Bukkit.getOnlinePlayers().toTypedArray()
})
/* ANCHOR_END: argumentEntities2 */

/* ANCHOR: argumentEntities3 */
CommandAPICommand("warp")
.withArguments(noSelectorSuggestions)
.executesPlayer(PlayerCommandExecutor { player, args ->
val target = args["target"] as Player
player.teleport(target)
})
.register()
/* ANCHOR_END: argumentEntities3 */

/* ANCHOR: argumentEntities4 */
CommandAPICommand("spawnmob")
.withArguments(EntityTypeArgument("entity"))
.withArguments(IntegerArgument("amount", 1, 100)) // Prevent spawning too many entities
Expand All @@ -420,7 +437,7 @@ CommandAPICommand("spawnmob")
}
})
.register()
/* ANCHOR_END: argumentEntities2 */
/* ANCHOR_END: argumentEntities4 */
}

fun argument_function() {
Expand Down
4 changes: 2 additions & 2 deletions commandapi-documentation-velocity-code/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>dev.jorel</groupId>
<artifactId>commandapi</artifactId>
<version>9.5.1</version>
<version>9.5.2</version>
</parent>

<artifactId>commandapi-documentation-velocity-code</artifactId>
Expand All @@ -18,7 +18,7 @@
</repository>
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
</repositories>

Expand Down
4 changes: 2 additions & 2 deletions commandapi-kotlin/commandapi-bukkit-kotlin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>dev.jorel</groupId>
<artifactId>commandapi-kotlin</artifactId>
<version>9.5.1</version>
<version>9.5.2</version>
</parent>

<artifactId>commandapi-bukkit-kotlin</artifactId>
Expand Down Expand Up @@ -62,7 +62,7 @@
<repositories>
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
<repository>
<id>sonatype</id>
Expand Down
2 changes: 1 addition & 1 deletion commandapi-kotlin/commandapi-core-kotlin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>dev.jorel</groupId>
<artifactId>commandapi-kotlin</artifactId>
<version>9.5.1</version>
<version>9.5.2</version>
</parent>

<artifactId>commandapi-core-kotlin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion commandapi-kotlin/commandapi-velocity-kotlin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>dev.jorel</groupId>
<artifactId>commandapi-kotlin</artifactId>
<version>9.5.1</version>
<version>9.5.2</version>
</parent>

<artifactId>commandapi-velocity-kotlin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion commandapi-kotlin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>dev.jorel</groupId>
<artifactId>commandapi</artifactId>
<version>9.5.1</version>
<version>9.5.2</version>
</parent>

<artifactId>commandapi-kotlin</artifactId>
Expand Down
Loading

0 comments on commit f2207dc

Please sign in to comment.