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

@ -1,9 +1,10 @@
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.internal.player.prefix.CachedPrefixProvider;
import de.kentoj.scrow.bukkit.internal.player.prefix.LuckPermsPrefixSetter;
import de.kentoj.scrow.bukkit.player.prefix.CachedPrefixProvider;
import de.kentoj.scrow.bukkit.player.prefix.LuckPermsPrefixSetter;
import de.kentoj.scrow.bukkit.style.ChatStyleListener;
import de.kentoj.scrow.bukkit.style.TabStyleListener;
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 FriendCommand().rootLiteral());
ScrowAPI.commands().register(new ReloadCommand().rootLiteral());
var luckperms = LuckPermsProvider.get();
new LuckPermsPrefixSetter(luckperms, cachedPrefixProvider).init(this);
getServer().getPluginManager().registerEvents(new ChatStyleListener(cachedPrefixProvider), this);
getServer().getPluginManager().registerEvents(new TabStyleListener(cachedPrefixProvider), this);
// TODO/FIXME
//registerServer();
}
@Override

View file

@ -1,10 +1,10 @@
package de.kentoj.scrow.bukkit;
import de.kentoj.scrow.bukkit.command.ScrowBukkitCC;
import de.kentoj.scrow.bukkit.internal.player.NetworkPlayerWatchdog;
import de.kentoj.scrow.bukkit.internal.region.RegionManagerImpl;
import de.kentoj.scrow.bukkit.internal.region.RegionPlayerTracker;
import de.kentoj.scrow.bukkit.internal.region.RegionTask;
import de.kentoj.scrow.bukkit.player.NetworkPlayerWatchdog;
import de.kentoj.scrow.bukkit.api.region.RegionManagerImpl;
import de.kentoj.scrow.bukkit.api.region.RegionPlayerTracker;
import de.kentoj.scrow.bukkit.api.region.RegionTask;
import de.kentoj.scrowlib.convention.ScrowMessageStyle;
import de.kentoj.scrowlib.economy.InMemoryEconomyService;
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.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.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.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.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.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 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.scheduler.Tasks;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
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.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.command.ScrowBukkitCC;
import de.kentoj.scrow.bukkit.scheduler.Task;
import de.kentoj.scrow.bukkit.scheduler.Tasks;
import de.kentoj.scrowlib.friends.FriendRequestService;
@ -16,6 +13,9 @@ import de.kentoj.scrowlib.friends.request.FriendRequestImpl;
import net.kyori.adventure.text.Component;
import org.bukkit.OfflinePlayer;
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 java.time.Instant;
@ -32,6 +32,8 @@ public final class FriendAddLiteral {
FriendAddLiteral() {
playerArg = Argument.builder("player", new OfflinePlayerArgumentType<ScrowBukkitCC>())
.withRequirement((ctx, value) -> !ctx.player().getUniqueId().equals(value.getUniqueId()),
"You cannot add yourself.")
.build();
literal = Literal.<ScrowBukkitCC>builder("add")
.withArgument(playerArg)
@ -52,10 +54,6 @@ public final class FriendAddLiteral {
}
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(() ->
requestService.saveFriendRequest(new FriendRequestImpl(self.getUniqueId(), other.getUniqueId())))
.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 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 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.luckperms.api.LuckPerms;
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.utils.EnvUtils;
import net.kyori.adventure.text.format.NamedTextColor;
import site.lab0x13.scrow.commands.model.literal.MessageStyle;
@Plugin(
id = "corevelocity",

View file

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

View file

@ -1,6 +1,7 @@
package de.kentoj.scrow.corevelocity.privmsg;
import com.leakyabstractions.result.core.Results;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ProxyServer;
import de.kentoj.scrow.velocity.commands.ScrowVelocityCC;
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."));
return;
}
privMsgHandler.handle(ctx.sender(), target, msg);
privMsgHandler.handle(ctx.player(), target, msg);
}
public RootLiteral<ScrowVelocityCC> rootLiteral() {