Skip to content

Commit 257c10e

Browse files
committed
Update to 1.21.9
1 parent c85b82a commit 257c10e

7 files changed

Lines changed: 39 additions & 33 deletions

File tree

build.gradle.kts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ dependencies {
3737

3838
compileOnlyApi(libs.cloudcore)
3939
compileOnly(libs.launchplates)
40-
compileOnly(libs.commandapi.bukkit.core)
40+
compileOnly(libs.commandapi.paper.core)
4141

4242
// testserver dependency plugins (maven)
4343
plugin(variantOf(libs.cloudcore) { classifier("all") })
4444
plugin(variantOf(libs.launchplates) { classifier("all") })
45-
plugin(libs.commandapi.bukkit.plugin)
45+
plugin(libs.commandapi.paper.plugin)
4646
}
4747

4848
java {
@@ -62,7 +62,7 @@ publishing {
6262

6363
bukkit {
6464
main = "$group.craftattack.CaMain"
65-
apiVersion = "1.20"
65+
apiVersion = "1.21.9"
6666
authors = listOf("booky10")
6767
depend = listOf("CommandAPI", "CloudCore")
6868
softDepend = listOf("LuckPerms", "LaunchPlates")
@@ -71,7 +71,7 @@ bukkit {
7171

7272
tasks {
7373
runServer {
74-
minecraftVersion("1.21.1")
74+
minecraftVersion("1.21.9")
7575

7676
pluginJars.from(plugin.resolve())
7777
downloadPlugins {
@@ -82,7 +82,7 @@ tasks {
8282
)
8383

8484
// not available on modrinth, github or hangar
85-
url("https://download.luckperms.net/1556/bukkit/loader/LuckPerms-Bukkit-5.4.141.jar")
85+
url("https://download.luckperms.net/1605/bukkit/loader/LuckPerms-Bukkit-5.5.16.jar")
8686
}
8787
}
8888

gradle/libs.versions.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
[versions]
22
pluginyml = "0.6.0"
3-
runtask = "2.3.1"
4-
shadow = "8.3.0"
3+
runtask = "3.0.0"
4+
shadow = "8.3.9"
55
publishing = "0.7.4"
66

7-
paper = "1.21.1-R0.1-SNAPSHOT"
7+
paper = "1.21.9-R0.1-SNAPSHOT"
88
luckperms-api = "5.4"
99
bstats = "3.0.2"
1010

1111
cloudcore = "1.1.0-SNAPSHOT"
12-
launchplates = "1.0.1-SNAPSHOT"
12+
launchplates = "1.0.2"
1313

1414
caffeine = "3.1.8"
1515

16-
commandapi = "9.5.3"
16+
commandapi = "11.0.0"
1717
debuggery = "1.5.1"
1818

1919
[plugins]
@@ -30,7 +30,7 @@ bstats-bukkit = { module = "org.bstats:bstats-bukkit", version.ref = "bstats" }
3030
cloudcore = { module = "dev.booky:cloudcore", version.ref = "cloudcore" }
3131
launchplates = { module = "dev.booky:launchplates", version.ref = "launchplates" }
3232

33-
commandapi-bukkit-core = { module = "dev.jorel:commandapi-bukkit-core", version.ref = "commandapi" }
34-
commandapi-bukkit-plugin = { module = "dev.jorel:commandapi-bukkit-plugin", version.ref = "commandapi" }
33+
commandapi-paper-core = { module = "dev.jorel:commandapi-paper-core", version.ref = "commandapi" }
34+
commandapi-paper-plugin = { module = "dev.jorel:commandapi-paper-plugin", version.ref = "commandapi" }
3535

3636
caffeine = { module = "com.github.ben-manes.caffeine:caffeine", version.ref = "caffeine" }

src/main/java/dev/booky/craftattack/CaManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public CompletableFuture<TpResult> teleportRequest(Player player, Location targe
101101
finalTarget.setYaw(player.getLocation().getYaw());
102102
finalTarget.setPitch(player.getLocation().getPitch());
103103
player.teleport(finalTarget, PlayerTeleportEvent.TeleportCause.COMMAND,
104-
TeleportFlag.Relative.YAW, TeleportFlag.Relative.PITCH);
104+
TeleportFlag.Relative.VELOCITY_ROTATION);
105105
return TpResult.SUCCESSFUL;
106106
});
107107
}
@@ -122,7 +122,7 @@ public CompletableFuture<TpResult> teleportRequest(Player player, Location targe
122122
finalTarget.setYaw(player.getLocation().getYaw());
123123
finalTarget.setPitch(player.getLocation().getPitch());
124124
player.teleport(finalTarget, PlayerTeleportEvent.TeleportCause.COMMAND,
125-
TeleportFlag.Relative.YAW, TeleportFlag.Relative.PITCH);
125+
TeleportFlag.Relative.VELOCITY_ROTATION);
126126
future.complete(TpResult.SUCCESSFUL);
127127
});
128128
}, 5 * 20);

src/main/java/dev/booky/craftattack/commands/CaCommand.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ public CaCommand(CaManager manager) {
3030
this.withSubcommand(new MineStatsCommand(entry));
3131
}
3232

33-
CommandAPI.unregister(this.getName(), true);
34-
for (String alias : this.getAliases()) {
35-
CommandAPI.unregister(alias, true);
36-
}
33+
// TODO commandapi unregistration is broken
34+
// CommandAPI.unregister(this.getName(), true);
35+
// for (String alias : this.getAliases()) {
36+
// CommandAPI.unregister(alias, true);
37+
// }
3738

3839
this.register();
3940
}

src/main/java/dev/booky/craftattack/commands/MineStatsCommand.java

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package dev.booky.craftattack.commands;
22
// Created by booky10 in CraftAttack (15:36 29.10.23)
33

4+
import com.destroystokyo.paper.profile.PlayerProfile;
45
import dev.booky.craftattack.CaManager;
56
import dev.booky.craftattack.utils.CaConfig;
67
import dev.jorel.commandapi.CommandAPICommand;
7-
import dev.jorel.commandapi.arguments.OfflinePlayerArgument;
8+
import dev.jorel.commandapi.arguments.PlayerProfileArgument;
89
import dev.jorel.commandapi.exceptions.WrapperCommandSyntaxException;
910
import dev.jorel.commandapi.executors.CommandArguments;
1011
import dev.jorel.commandapi.executors.PlayerCommandExecutor;
@@ -23,6 +24,7 @@
2324
import java.util.ArrayList;
2425
import java.util.Comparator;
2526
import java.util.List;
27+
import java.util.Objects;
2628
import java.util.Optional;
2729
import java.util.Set;
2830
import java.util.UUID;
@@ -44,7 +46,7 @@ public MineStatsCommand(String objectiveName) {
4446
super(objectiveName);
4547
this.objectiveName = objectiveName;
4648

47-
this.withOptionalArguments(new OfflinePlayerArgument("target"));
49+
this.withOptionalArguments(new PlayerProfileArgument("target"));
4850

4951
this.withPermission("craftattack.command.minestats." + objectiveName);
5052
this.executesPlayer(this);
@@ -76,13 +78,16 @@ public void run(Player sender, CommandArguments args) throws WrapperCommandSynta
7678
}
7779

7880
// if there was an explicit target specified, look up only itself
79-
Optional<Integer> targetScore = args.<OfflinePlayer>getOptionalUnchecked("target")
80-
.map(objective::getScore)
81-
.map(Score::getScore);
82-
if (targetScore.isPresent()) {
83-
sender.sendMessage(CaManager.getPrefix().append(translatable(
84-
"ca.command.mine-stats.value", NamedTextColor.GREEN,
85-
text(this.objectiveName), text(targetScore.get()))));
81+
Optional<List<PlayerProfile>> targets = args.<List<PlayerProfile>>getOptionalUnchecked("target")
82+
.filter(list -> !list.isEmpty());
83+
if (targets.isPresent()) {
84+
for (PlayerProfile target : targets.get()) {
85+
String name = Objects.requireNonNull(target.getName());
86+
int score = objective.getScore(name).getScore();
87+
sender.sendMessage(CaManager.getPrefix().append(translatable(
88+
"ca.command.mine-stats.value", NamedTextColor.GREEN,
89+
text(this.objectiveName), text(score))));
90+
}
8691
return;
8792
}
8893

src/main/java/dev/booky/craftattack/listener/SitListener.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public void onInteract(PlayerInteractEvent event) {
124124

125125
// Yes, this actually works for hiding the vehicle health bar
126126
// Additionally, I didn't notice any side effects!
127-
AttributeInstance maxHealth = stand.getAttribute(Attribute.GENERIC_MAX_HEALTH);
127+
AttributeInstance maxHealth = stand.getAttribute(Attribute.MAX_HEALTH);
128128
Objects.requireNonNull(maxHealth).setBaseValue(0d);
129129
});
130130
} else {
@@ -178,7 +178,7 @@ public void onDismount(EntityDismountEvent event) {
178178
unmountLoc.setYaw(player.getLocation().getYaw());
179179
unmountLoc.setPitch(player.getLocation().getPitch());
180180

181-
player.teleport(unmountLoc, TeleportFlag.Relative.YAW, TeleportFlag.Relative.PITCH);
181+
player.teleport(unmountLoc, TeleportFlag.Relative.VELOCITY_ROTATION);
182182
event.getDismounted().remove();
183183
return;
184184
}
@@ -196,7 +196,7 @@ public void onDismount(EntityDismountEvent event) {
196196
unmountLoc.setYaw(player.getLocation().getYaw());
197197
unmountLoc.setPitch(player.getLocation().getPitch());
198198

199-
player.teleport(unmountLoc, TeleportFlag.Relative.YAW, TeleportFlag.Relative.PITCH);
199+
player.teleport(unmountLoc, TeleportFlag.Relative.VELOCITY_ROTATION);
200200
event.getDismounted().remove();
201201
}
202202
}

src/main/java/dev/booky/craftattack/listener/SpawnListener.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
// Created by booky10 in CraftAttack (14:50 05.10.22)
33

44
import dev.booky.craftattack.CaManager;
5+
import io.papermc.paper.event.player.AsyncPlayerSpawnLocationEvent;
56
import org.bukkit.Location;
67
import org.bukkit.event.EventHandler;
78
import org.bukkit.event.Listener;
89
import org.bukkit.event.player.PlayerRespawnEvent;
9-
import org.spigotmc.event.player.PlayerSpawnLocationEvent;
1010

1111
public final class SpawnListener implements Listener {
1212

@@ -17,8 +17,8 @@ public SpawnListener(CaManager manager) {
1717
}
1818

1919
@EventHandler
20-
public void onSpawn(PlayerSpawnLocationEvent event) {
21-
if (event.getPlayer().hasPlayedBefore()) {
20+
public void onSpawn(AsyncPlayerSpawnLocationEvent event) {
21+
if (!event.isNewPlayer()) {
2222
return;
2323
}
2424

0 commit comments

Comments
 (0)