This commit is contained in:
kento2 2026-08-29 16:35:54 +02:00
parent 35a0784e40
commit 0cf84f5419
19 changed files with 66 additions and 47 deletions

View file

@ -30,9 +30,9 @@ maven.install(
"org.postgresql:postgresql:42.7.12", "org.postgresql:postgresql:42.7.12",
"org.mongodb:bson:5.8.0", "org.mongodb:bson:5.8.0",
"io.nats:jnats:2.25.2", "io.nats:jnats:2.25.2",
"site.lab0x13.scrow:commands-common:1.2.0", "site.lab0x13.scrow:commands-common:1.3.3",
"site.lab0x13.scrow:commands-bukkit:1.2.0", "site.lab0x13.scrow:commands-bukkit:1.3.3",
"site.lab0x13.scrow:commands-velocity:1.2.0", "site.lab0x13.scrow:commands-velocity:1.3.3",
"io.papermc.paper:paper-api:[26.2.build,)", "io.papermc.paper:paper-api:[26.2.build,)",
"net.luckperms:api:5.5", "net.luckperms:api:5.5",
"com.google.code.gson:gson:2.14.0", "com.google.code.gson:gson:2.14.0",

View file

@ -4,6 +4,7 @@ import de.kentoj.scrow.bukkit.command.ScrowBukkitCC;
import de.kentoj.scrowlib.convention.ScrowMessageStyle; import de.kentoj.scrowlib.convention.ScrowMessageStyle;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import site.lab0x13.scrow.commands.model.literal.Literal; import site.lab0x13.scrow.commands.model.literal.Literal;
import site.lab0x13.scrow.commands.model.literal.LiteralMeta;
import site.lab0x13.scrow.configurator.ConfigApi; import site.lab0x13.scrow.configurator.ConfigApi;
import site.lab0x13.scrow.configurator.action.ConfigAction; import site.lab0x13.scrow.configurator.action.ConfigAction;
import site.lab0x13.scrow.configurator.node.ConfigNode; import site.lab0x13.scrow.configurator.node.ConfigNode;
@ -18,7 +19,7 @@ class KeyLiteral {
KeyLiteral(ConfigApi api) { KeyLiteral(ConfigApi api) {
this.api = api; this.api = api;
literal = Literal.<ScrowBukkitCC>dynamic("key") literal = Literal.<ScrowBukkitCC>dynamic("key")
.withSubLiteralNames(() -> new ArrayList<>(api.allNodes().keySet())) .withSubLiteralMetas(() -> api.allNodes().keySet().stream().map(LiteralMeta::of).toList())
.withSubLiteralProvider(this::keyLiteral) .withSubLiteralProvider(this::keyLiteral)
.build(); .build();
} }

View file

@ -1,9 +1,10 @@
package de.kentoj.scrow.bukkit; package de.kentoj.scrow.bukkit;
import de.kentoj.scrow.bukkit.command.economy.CoinsCommand; import de.kentoj.scrow.bukkit.command.ReloadCommand;
import de.kentoj.scrow.bukkit.command.coins.CoinsCommand;
import de.kentoj.scrow.bukkit.command.friends.FriendCommand; import de.kentoj.scrow.bukkit.command.friends.FriendCommand;
import de.kentoj.scrow.bukkit.internal.player.prefix.CachedPrefixProvider; import de.kentoj.scrow.bukkit.player.prefix.CachedPrefixProvider;
import de.kentoj.scrow.bukkit.internal.player.prefix.LuckPermsPrefixSetter; import de.kentoj.scrow.bukkit.player.prefix.LuckPermsPrefixSetter;
import de.kentoj.scrow.bukkit.style.ChatStyleListener; import de.kentoj.scrow.bukkit.style.ChatStyleListener;
import de.kentoj.scrow.bukkit.style.TabStyleListener; import de.kentoj.scrow.bukkit.style.TabStyleListener;
import net.luckperms.api.LuckPermsProvider; import net.luckperms.api.LuckPermsProvider;
@ -23,13 +24,12 @@ public final class CoreImplPlugin extends JavaPlugin {
ScrowAPI.commands().register(new CoinsCommand().rootLiteral()); ScrowAPI.commands().register(new CoinsCommand().rootLiteral());
ScrowAPI.commands().register(new FriendCommand().rootLiteral()); ScrowAPI.commands().register(new FriendCommand().rootLiteral());
ScrowAPI.commands().register(new ReloadCommand().rootLiteral());
var luckperms = LuckPermsProvider.get(); var luckperms = LuckPermsProvider.get();
new LuckPermsPrefixSetter(luckperms, cachedPrefixProvider).init(this); new LuckPermsPrefixSetter(luckperms, cachedPrefixProvider).init(this);
getServer().getPluginManager().registerEvents(new ChatStyleListener(cachedPrefixProvider), this); getServer().getPluginManager().registerEvents(new ChatStyleListener(cachedPrefixProvider), this);
getServer().getPluginManager().registerEvents(new TabStyleListener(cachedPrefixProvider), this); getServer().getPluginManager().registerEvents(new TabStyleListener(cachedPrefixProvider), this);
// TODO/FIXME
//registerServer();
} }
@Override @Override

View file

@ -1,10 +1,10 @@
package de.kentoj.scrow.bukkit; package de.kentoj.scrow.bukkit;
import de.kentoj.scrow.bukkit.command.ScrowBukkitCC; import de.kentoj.scrow.bukkit.command.ScrowBukkitCC;
import de.kentoj.scrow.bukkit.internal.player.NetworkPlayerWatchdog; import de.kentoj.scrow.bukkit.player.NetworkPlayerWatchdog;
import de.kentoj.scrow.bukkit.internal.region.RegionManagerImpl; import de.kentoj.scrow.bukkit.api.region.RegionManagerImpl;
import de.kentoj.scrow.bukkit.internal.region.RegionPlayerTracker; import de.kentoj.scrow.bukkit.api.region.RegionPlayerTracker;
import de.kentoj.scrow.bukkit.internal.region.RegionTask; import de.kentoj.scrow.bukkit.api.region.RegionTask;
import de.kentoj.scrowlib.convention.ScrowMessageStyle; import de.kentoj.scrowlib.convention.ScrowMessageStyle;
import de.kentoj.scrowlib.economy.InMemoryEconomyService; import de.kentoj.scrowlib.economy.InMemoryEconomyService;
import de.kentoj.scrowlib.economy.PostgresEconomyService; import de.kentoj.scrowlib.economy.PostgresEconomyService;

View file

@ -1,4 +1,4 @@
package de.kentoj.scrow.bukkit.internal.region; package de.kentoj.scrow.bukkit.api.region;
import de.kentoj.scrow.bukkit.region.ChunkPos; import de.kentoj.scrow.bukkit.region.ChunkPos;
import de.kentoj.scrow.bukkit.region.Region; import de.kentoj.scrow.bukkit.region.Region;

View file

@ -1,4 +1,4 @@
package de.kentoj.scrow.bukkit.internal.region; package de.kentoj.scrow.bukkit.api.region;
import de.kentoj.scrow.bukkit.ScrowAPI; import de.kentoj.scrow.bukkit.ScrowAPI;
import de.kentoj.scrow.bukkit.region.Region; import de.kentoj.scrow.bukkit.region.Region;

View file

@ -1,4 +1,4 @@
package de.kentoj.scrow.bukkit.internal.region; package de.kentoj.scrow.bukkit.api.region;
import de.kentoj.scrow.bukkit.ScrowAPI; import de.kentoj.scrow.bukkit.ScrowAPI;
import de.kentoj.scrow.bukkit.region.ChunkPos; import de.kentoj.scrow.bukkit.region.ChunkPos;

View file

@ -0,0 +1,22 @@
package de.kentoj.scrow.bukkit.command;
import de.kentoj.scrowlib.convention.ScrowMessageStyle;
import org.bukkit.Bukkit;
import site.lab0x13.scrow.commands.model.literal.Literal;
import site.lab0x13.scrow.commands.model.literal.RootLiteral;
public final class ReloadCommand {
private final RootLiteral<ScrowBukkitCC> rootLiteral;
public ReloadCommand() {
rootLiteral = Literal.<ScrowBukkitCC>builder("reload", "rl")
.withPermission("bukkit.command.reload")
.withSyncExecutor(ctx -> Bukkit.dispatchCommand(ctx.sender(), "bukkit:reload confirm"))
.asRootLiteral(ScrowMessageStyle.GENERIC);
}
public RootLiteral<ScrowBukkitCC> rootLiteral() {
return rootLiteral;
}
}

View file

@ -1,4 +1,4 @@
package de.kentoj.scrow.bukkit.command.economy; package de.kentoj.scrow.bukkit.command.coins;
import de.kentoj.scrow.bukkit.ScrowAPI; import de.kentoj.scrow.bukkit.ScrowAPI;
import de.kentoj.scrow.bukkit.command.ScrowBukkitCC; import de.kentoj.scrow.bukkit.command.ScrowBukkitCC;

View file

@ -1,4 +1,4 @@
package de.kentoj.scrow.bukkit.command.economy; package de.kentoj.scrow.bukkit.command.coins;
import de.kentoj.scrow.bukkit.ScrowAPI; import de.kentoj.scrow.bukkit.ScrowAPI;
import de.kentoj.scrow.bukkit.command.ScrowBukkitCC; import de.kentoj.scrow.bukkit.command.ScrowBukkitCC;

View file

@ -1,4 +1,4 @@
package de.kentoj.scrow.bukkit.command.economy; package de.kentoj.scrow.bukkit.command.coins;
import de.kentoj.scrow.bukkit.command.ScrowBukkitCC; import de.kentoj.scrow.bukkit.command.ScrowBukkitCC;
import site.lab0x13.scrow.commands.model.argument.Argument; import site.lab0x13.scrow.commands.model.argument.Argument;
@ -8,7 +8,6 @@ import site.lab0x13.scrow.commands.bukkit.type.OfflinePlayerArgumentType;
import de.kentoj.scrow.bukkit.ScrowAPI; import de.kentoj.scrow.bukkit.ScrowAPI;
import de.kentoj.scrow.bukkit.scheduler.Tasks; import de.kentoj.scrow.bukkit.scheduler.Tasks;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;

View file

@ -2,11 +2,8 @@ package de.kentoj.scrow.bukkit.command.friends;
import com.leakyabstractions.result.api.Result; import com.leakyabstractions.result.api.Result;
import com.leakyabstractions.result.core.Results; import com.leakyabstractions.result.core.Results;
import site.lab0x13.scrow.commands.model.argument.Argument;
import de.kentoj.scrow.bukkit.command.ScrowBukkitCC;
import site.lab0x13.scrow.commands.model.literal.Literal;
import site.lab0x13.scrow.commands.bukkit.type.OfflinePlayerArgumentType;
import de.kentoj.scrow.bukkit.ScrowAPI; import de.kentoj.scrow.bukkit.ScrowAPI;
import de.kentoj.scrow.bukkit.command.ScrowBukkitCC;
import de.kentoj.scrow.bukkit.scheduler.Task; import de.kentoj.scrow.bukkit.scheduler.Task;
import de.kentoj.scrow.bukkit.scheduler.Tasks; import de.kentoj.scrow.bukkit.scheduler.Tasks;
import de.kentoj.scrowlib.friends.FriendRequestService; import de.kentoj.scrowlib.friends.FriendRequestService;
@ -16,6 +13,9 @@ import de.kentoj.scrowlib.friends.request.FriendRequestImpl;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import site.lab0x13.scrow.commands.bukkit.type.OfflinePlayerArgumentType;
import site.lab0x13.scrow.commands.model.argument.Argument;
import site.lab0x13.scrow.commands.model.literal.Literal;
import site.lab0x13.scrow.commands.model.literal.MessageStyle; import site.lab0x13.scrow.commands.model.literal.MessageStyle;
import java.time.Instant; import java.time.Instant;
@ -32,6 +32,8 @@ public final class FriendAddLiteral {
FriendAddLiteral() { FriendAddLiteral() {
playerArg = Argument.builder("player", new OfflinePlayerArgumentType<ScrowBukkitCC>()) playerArg = Argument.builder("player", new OfflinePlayerArgumentType<ScrowBukkitCC>())
.withRequirement((ctx, value) -> !ctx.player().getUniqueId().equals(value.getUniqueId()),
"You cannot add yourself.")
.build(); .build();
literal = Literal.<ScrowBukkitCC>builder("add") literal = Literal.<ScrowBukkitCC>builder("add")
.withArgument(playerArg) .withArgument(playerArg)
@ -52,10 +54,6 @@ public final class FriendAddLiteral {
} }
private void sendRequest(MessageStyle style, Player self, OfflinePlayer other) { private void sendRequest(MessageStyle style, Player self, OfflinePlayer other) {
if (other.equals(self)) {
self.sendMessage(style.ok("You can't send yourself a friend request."));
return;
}
Tasks.runAsync(() -> Tasks.runAsync(() ->
requestService.saveFriendRequest(new FriendRequestImpl(self.getUniqueId(), other.getUniqueId()))) requestService.saveFriendRequest(new FriendRequestImpl(self.getUniqueId(), other.getUniqueId())))
.runSync(() -> { .runSync(() -> {

View file

@ -1,4 +1,4 @@
package de.kentoj.scrow.bukkit.internal.player; package de.kentoj.scrow.bukkit.player;
import de.kentoj.scrow.bukkit.ScrowAPI; import de.kentoj.scrow.bukkit.ScrowAPI;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;

View file

@ -1,4 +1,4 @@
package de.kentoj.scrow.bukkit.internal.player.prefix; package de.kentoj.scrow.bukkit.player.prefix;
import de.kentoj.scrowlib.player.PlayerPrefixProvider; import de.kentoj.scrowlib.player.PlayerPrefixProvider;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;

View file

@ -1,6 +1,5 @@
package de.kentoj.scrow.bukkit.internal.player.prefix; package de.kentoj.scrow.bukkit.player.prefix;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.MiniMessage;
import net.luckperms.api.LuckPerms; import net.luckperms.api.LuckPerms;
import net.luckperms.api.event.user.UserDataRecalculateEvent; import net.luckperms.api.event.user.UserDataRecalculateEvent;

View file

@ -18,7 +18,6 @@ import de.kentoj.scrow.velocity.ScrowAPI;
import de.kentoj.scrowlib.convention.ScrowMessageStyle; import de.kentoj.scrowlib.convention.ScrowMessageStyle;
import de.kentoj.scrowlib.utils.EnvUtils; import de.kentoj.scrowlib.utils.EnvUtils;
import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.NamedTextColor;
import site.lab0x13.scrow.commands.model.literal.MessageStyle;
@Plugin( @Plugin(
id = "corevelocity", id = "corevelocity",

View file

@ -34,7 +34,7 @@ public class MsgCommand {
} }
private void executeSync(ScrowVelocityCC ctx) { private void executeSync(ScrowVelocityCC ctx) {
var target = ctx.getarg(targetArg); var target = ctx.getArg(targetArg);
var msg = ctx.getArg(msgArg); var msg = ctx.getArg(msgArg);
var isMessagingSelf = target.getUniqueId().equals(ctx.player().getUniqueId()); var isMessagingSelf = target.getUniqueId().equals(ctx.player().getUniqueId());

View file

@ -1,6 +1,7 @@
package de.kentoj.scrow.corevelocity.privmsg; package de.kentoj.scrow.corevelocity.privmsg;
import com.leakyabstractions.result.core.Results; import com.leakyabstractions.result.core.Results;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.proxy.ProxyServer;
import de.kentoj.scrow.velocity.commands.ScrowVelocityCC; import de.kentoj.scrow.velocity.commands.ScrowVelocityCC;
import de.kentoj.scrowlib.convention.ScrowMessageStyle; import de.kentoj.scrowlib.convention.ScrowMessageStyle;
@ -42,7 +43,7 @@ public class ReplyCommand {
ctx.player().sendMessage(ctx.style().err("The player you last messaged is no longer online.")); ctx.player().sendMessage(ctx.style().err("The player you last messaged is no longer online."));
return; return;
} }
privMsgHandler.handle(ctx.sender(), target, msg); privMsgHandler.handle(ctx.player(), target, msg);
} }
public RootLiteral<ScrowVelocityCC> rootLiteral() { public RootLiteral<ScrowVelocityCC> rootLiteral() {

View file

@ -22,9 +22,9 @@
"org.slf4j:slf4j-api": -2005163028, "org.slf4j:slf4j-api": -2005163028,
"org.slf4j:slf4j-simple": 1999565066, "org.slf4j:slf4j-simple": 1999565066,
"repositories": 1947988996, "repositories": 1947988996,
"site.lab0x13.scrow:commands-bukkit": -62834474, "site.lab0x13.scrow:commands-bukkit": 1307785370,
"site.lab0x13.scrow:commands-common": -2092194647, "site.lab0x13.scrow:commands-common": -721574803,
"site.lab0x13.scrow:commands-velocity": 576878071 "site.lab0x13.scrow:commands-velocity": 1947497915
}, },
"__RESOLVED_ARTIFACTS_HASH": { "__RESOLVED_ARTIFACTS_HASH": {
"aopalliance:aopalliance": 1434507571, "aopalliance:aopalliance": 1434507571,
@ -102,9 +102,9 @@
"org.spongepowered:configurate-hocon": -1372729557, "org.spongepowered:configurate-hocon": -1372729557,
"org.spongepowered:configurate-yaml": -1304688999, "org.spongepowered:configurate-yaml": -1304688999,
"org.yaml:snakeyaml": -1320689696, "org.yaml:snakeyaml": -1320689696,
"site.lab0x13.scrow:commands-bukkit": 1630649671, "site.lab0x13.scrow:commands-bukkit": -1697064734,
"site.lab0x13.scrow:commands-common": 716919454, "site.lab0x13.scrow:commands-common": -1958371554,
"site.lab0x13.scrow:commands-velocity": -238206298 "site.lab0x13.scrow:commands-velocity": -1504816576
}, },
"artifacts": { "artifacts": {
"aopalliance:aopalliance": { "aopalliance:aopalliance": {
@ -559,21 +559,21 @@
}, },
"site.lab0x13.scrow:commands-bukkit": { "site.lab0x13.scrow:commands-bukkit": {
"shasums": { "shasums": {
"jar": "88d8f281f3e00a94111268bce29d0e3df62376d2cbd72563ea2312874a2ac087" "jar": "19fdf6daa971172fcd010bcb2d11f29d5ef17225144bf780205011d5ef80419e"
}, },
"version": "1.2.0" "version": "1.3.3"
}, },
"site.lab0x13.scrow:commands-common": { "site.lab0x13.scrow:commands-common": {
"shasums": { "shasums": {
"jar": "19c1c025e77ed9c9e44a20540041caab7c402568af94c7f8aec768586d4b41b3" "jar": "21a9bdb29cb60bb424f1e3f8f69c11782c38a240dd18d41ba32a24534a0e50aa"
}, },
"version": "1.2.0" "version": "1.3.3"
}, },
"site.lab0x13.scrow:commands-velocity": { "site.lab0x13.scrow:commands-velocity": {
"shasums": { "shasums": {
"jar": "02a0a1eff84f1757f5c42f58fda6851c807d95801af8623ffab9e5e482392489" "jar": "362fd98a011c78aad2ffecb24135aada3a72a03d77db090a914b6aa4b0997715"
}, },
"version": "1.2.0" "version": "1.3.3"
} }
}, },
"conflict_resolution": { "conflict_resolution": {