Skip to content

Commit 51b5d1e

Browse files
committed
Adds Mojang-mapped 1.20.5 test profile. Fix chat colour argument test for 1.20.5. Attempt to get item predicate tests working on 1.20.5
1 parent 6c7d7cb commit 51b5d1e

File tree

3 files changed

+62
-6
lines changed

3 files changed

+62
-6
lines changed

commandapi-platforms/commandapi-bukkit/commandapi-bukkit-test/commandapi-bukkit-test-tests/pom.xml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,53 @@
205205
</dependency> -->
206206
</dependencies>
207207
</profile>
208+
<profile>
209+
<id>Minecraft_1_20_5_Mojang</id>
210+
<dependencies>
211+
<dependency>
212+
<!-- Needed for 1.19.4 Brigadier logging. This is also present in
213+
commandapi-core, but isn't inherited here automatically, so we add
214+
it here -->
215+
<groupId>org.apache.logging.log4j</groupId>
216+
<artifactId>log4j-api</artifactId>
217+
<version>2.23.1</version>
218+
<scope>provided</scope>
219+
</dependency>
220+
<dependency>
221+
<groupId>dev.jorel</groupId>
222+
<artifactId>commandapi-bukkit-nms-dependency-mojang-mapped</artifactId>
223+
<version>${project.version}</version>
224+
<type>pom</type>
225+
</dependency>
226+
<dependency>
227+
<groupId>dev.jorel</groupId>
228+
<artifactId>commandapi-bukkit-shade</artifactId>
229+
<version>${project.version}</version>
230+
</dependency>
231+
<dependency>
232+
<groupId>dev.jorel</groupId>
233+
<artifactId>commandapi-bukkit-test-impl-1.20.5</artifactId>
234+
<version>${project.version}</version>
235+
<classifier>mojang-mapped</classifier>
236+
<scope>test</scope>
237+
</dependency>
238+
<dependency>
239+
<groupId>org.spigotmc</groupId>
240+
<artifactId>spigot</artifactId>
241+
<classifier>remapped-mojang</classifier>
242+
<version>1.20.5-R0.1-SNAPSHOT</version>
243+
</dependency>
244+
<!-- Ideally we'd include paper here, but this
245+
causes MockBukkit to fall apart because it then
246+
tries to register potion effects when the server
247+
is null and I CBA to sort that out right now -->
248+
<!-- <dependency>
249+
<groupId>io.papermc.paper</groupId>
250+
<artifactId>paper-api</artifactId>
251+
<version>1.20.2-R0.1-SNAPSHOT</version>
252+
</dependency> -->
253+
</dependencies>
254+
</profile>
208255
<profile>
209256
<id>Minecraft_1_20_3</id>
210257
<dependencies>

commandapi-platforms/commandapi-bukkit/commandapi-bukkit-test/commandapi-bukkit-test-tests/src/test/java/dev/jorel/commandapi/test/arguments/ArgumentChatColorTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ void executionTestWithChatColorArgument() {
7878
if(color.isFormat() && !color.equals(ChatColor.RESET)) {
7979
String colorName = color.name().toLowerCase();
8080
if (version.greaterThanOrEqualTo(MCVersion.V1_20_5)) {
81-
assertCommandFailsWith(player, "test " + colorName, "Unknown color '" + colorName + "'");
82-
} else {
8381
assertCommandFailsWith(player, "test " + colorName, "Unknown color '" + colorName + "' at position 10: test magic<--[HERE]");
82+
} else {
83+
assertCommandFailsWith(player, "test " + colorName, "Unknown color '" + colorName + "'");
8484
}
8585
}
8686
}

commandapi-platforms/commandapi-bukkit/commandapi-bukkit-test/commandapi-bukkit-test-tests/src/test/java/dev/jorel/commandapi/test/arguments/ArgumentItemStackPredicateTests.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import be.seeseemelk.mockbukkit.entity.PlayerMock;
1616
import dev.jorel.commandapi.CommandAPICommand;
17+
import dev.jorel.commandapi.MCVersion;
1718
import dev.jorel.commandapi.arguments.ItemStackPredicateArgument;
1819
import dev.jorel.commandapi.test.MockPlatform;
1920
import dev.jorel.commandapi.test.Mut;
@@ -55,10 +56,18 @@ void executionTestWithItemStackPredicateArgument() {
5556

5657
PlayerMock player = server.addPlayer();
5758

58-
// /test dirt
59-
server.dispatchCommand(player, "test dirt");
60-
assertTrue(results.get().test(new ItemStack(Material.DIRT)));
61-
59+
// I don't know why, but for some reason, in 1.20.5 you can't have
60+
// an item predicate that doesn't contain a # character?
61+
if (version.lessThan(MCVersion.V1_20_5)) {
62+
// /test dirt
63+
server.dispatchCommand(player, "test dirt");
64+
assertTrue(results.get().test(new ItemStack(Material.DIRT)));
65+
} else {
66+
// /test #axes
67+
server.dispatchCommand(player, "test #axes");
68+
assertTrue(results.get().test(new ItemStack(Material.DIAMOND_AXE)));
69+
}
70+
6271
// TODO: Not sure why this fails, but it does!
6372
// /test dirt
6473
// server.dispatchCommand(player, "test dirt{Count:3b}");

0 commit comments

Comments
 (0)