diff --git a/api/src/main/java/net/luckperms/api/node/metadata/types/InheritanceOriginMetadata.java b/api/src/main/java/net/luckperms/api/node/metadata/types/InheritanceOriginMetadata.java
index 89983cbca..a25b223f6 100644
--- a/api/src/main/java/net/luckperms/api/node/metadata/types/InheritanceOriginMetadata.java
+++ b/api/src/main/java/net/luckperms/api/node/metadata/types/InheritanceOriginMetadata.java
@@ -54,4 +54,17 @@ public interface InheritanceOriginMetadata {
*/
PermissionHolder.@NonNull Identifier getOrigin();
+ /**
+ * Gets whether the associated node was inherited from another holder.
+ *
+ *
In other terms, it returns whether the origin is not equal to the given holder.
+ *
+ * @param holder the holder defining the node
+ * @return if true the node was inherited, false if it was defined by the same holder
+ * @since 5.3
+ */
+ default boolean wasInherited(PermissionHolder.@NonNull Identifier holder) {
+ return !holder.equals(getOrigin());
+ }
+
}
diff --git a/bukkit/build.gradle b/bukkit/build.gradle
index 4f7c630a9..617c47a76 100644
--- a/bukkit/build.gradle
+++ b/bukkit/build.gradle
@@ -11,7 +11,7 @@ dependencies {
compile project(':common')
compileOnly 'com.destroystokyo.paper:paper-api:1.15.2-R0.1-SNAPSHOT'
- compileOnly 'net.kyori:text-adapter-bukkit:3.0.5'
+ compileOnly 'me.lucko:adventure-platform-bukkit:4.0.0'
compileOnly 'me.lucko:commodore:1.7'
compileOnly('net.milkbowl.vault:VaultAPI:1.6') {
exclude(module: 'bukkit')
@@ -50,7 +50,7 @@ shadowJar {
include(dependency('me.lucko.luckperms:.*'))
}
- relocate 'net.kyori.text', 'me.lucko.luckperms.lib.text'
+ relocate 'net.kyori.adventure', 'me.lucko.luckperms.lib.adventure'
relocate 'net.kyori.event', 'me.lucko.luckperms.lib.eventbus'
relocate 'com.github.benmanes.caffeine', 'me.lucko.luckperms.lib.caffeine'
relocate 'okio', 'me.lucko.luckperms.lib.okio'
diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/BukkitSenderFactory.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/BukkitSenderFactory.java
index 65612dbbb..42fa90ee3 100644
--- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/BukkitSenderFactory.java
+++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/BukkitSenderFactory.java
@@ -27,10 +27,9 @@ package me.lucko.luckperms.bukkit;
import me.lucko.luckperms.common.sender.Sender;
import me.lucko.luckperms.common.sender.SenderFactory;
-import me.lucko.luckperms.common.util.TextUtils;
-import net.kyori.text.Component;
-import net.kyori.text.adapter.bukkit.TextAdapter;
+import net.kyori.adventure.platform.bukkit.BukkitAudiences;
+import net.kyori.adventure.text.Component;
import net.luckperms.api.util.Tristate;
import org.bukkit.command.CommandSender;
@@ -41,8 +40,11 @@ import org.bukkit.entity.Player;
import java.util.UUID;
public class BukkitSenderFactory extends SenderFactory {
+ private final BukkitAudiences audiences;
+
public BukkitSenderFactory(LPBukkitPlugin plugin) {
super(plugin);
+ this.audiences = BukkitAudiences.create(plugin.getBootstrap());
}
@Override
@@ -61,27 +63,14 @@ public class BukkitSenderFactory extends SenderFactory sendMessage(sender, message));
}
-
- // Fallback to legacy format
- sendMessage(sender, TextUtils.toLegacy(message));
}
@Override
@@ -105,19 +94,9 @@ public class BukkitSenderFactory extends SenderFactory getGlobalDependencies() {
Set dependencies = super.getGlobalDependencies();
- dependencies.add(Dependency.TEXT_ADAPTER_BUKKIT);
+ dependencies.add(Dependency.ADVENTURE_PLATFORM);
+ dependencies.add(Dependency.ADVENTURE_PLATFORM_BUKKIT);
if (isBrigadierSupported()) {
dependencies.add(Dependency.COMMODORE);
}
diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/listeners/BukkitConnectionListener.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/listeners/BukkitConnectionListener.java
index 287d41f0f..4e67fa927 100644
--- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/listeners/BukkitConnectionListener.java
+++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/listeners/BukkitConnectionListener.java
@@ -29,10 +29,15 @@ import me.lucko.luckperms.bukkit.LPBukkitPlugin;
import me.lucko.luckperms.bukkit.inject.permissible.LuckPermsPermissible;
import me.lucko.luckperms.bukkit.inject.permissible.PermissibleInjector;
import me.lucko.luckperms.common.config.ConfigKeys;
-import me.lucko.luckperms.common.locale.message.Message;
+import me.lucko.luckperms.common.locale.Message;
+import me.lucko.luckperms.common.locale.TranslationManager;
import me.lucko.luckperms.common.model.User;
import me.lucko.luckperms.common.plugin.util.AbstractConnectionListener;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
+import net.kyori.adventure.translation.GlobalTranslator;
+
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -122,7 +127,9 @@ public class BukkitConnectionListener extends AbstractConnectionListener impleme
// deny the connection
this.deniedAsyncLogin.add(e.getUniqueId());
- e.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, Message.LOADING_DATABASE_ERROR.asString(this.plugin.getLocaleManager()));
+
+ Component reason = GlobalTranslator.render(Message.LOADING_DATABASE_ERROR.build(), TranslationManager.DEFAULT_LOCALE);
+ e.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, LegacyComponentSerializer.legacySection().serialize(reason));
this.plugin.getEventDispatcher().dispatchPlayerLoginProcess(e.getUniqueId(), e.getName(), null);
}
}
@@ -169,7 +176,9 @@ public class BukkitConnectionListener extends AbstractConnectionListener impleme
if (this.detectedCraftBukkitOfflineMode) {
printCraftBukkitOfflineModeError();
- e.disallow(PlayerLoginEvent.Result.KICK_OTHER, Message.LOADING_STATE_ERROR_CB_OFFLINE_MODE.asString(this.plugin.getLocaleManager()));
+
+ Component reason = GlobalTranslator.render(Message.LOADING_STATE_ERROR_CB_OFFLINE_MODE.build(), TranslationManager.parseLocale(player.getLocale(), TranslationManager.DEFAULT_LOCALE));
+ e.disallow(PlayerLoginEvent.Result.KICK_OTHER, LegacyComponentSerializer.legacySection().serialize(reason));
return;
}
@@ -179,7 +188,8 @@ public class BukkitConnectionListener extends AbstractConnectionListener impleme
" - denying login.");
}
- e.disallow(PlayerLoginEvent.Result.KICK_OTHER, Message.LOADING_STATE_ERROR.asString(this.plugin.getLocaleManager()));
+ Component reason = GlobalTranslator.render(Message.LOADING_STATE_ERROR.build(), TranslationManager.parseLocale(player.getLocale(), TranslationManager.DEFAULT_LOCALE));
+ e.disallow(PlayerLoginEvent.Result.KICK_OTHER, LegacyComponentSerializer.legacySection().serialize(reason));
return;
}
@@ -197,7 +207,8 @@ public class BukkitConnectionListener extends AbstractConnectionListener impleme
player.getUniqueId() + " - " + player.getName() + " - denying login.");
t.printStackTrace();
- e.disallow(PlayerLoginEvent.Result.KICK_OTHER, Message.LOADING_SETUP_ERROR.asString(this.plugin.getLocaleManager()));
+ Component reason = GlobalTranslator.render(Message.LOADING_SETUP_ERROR.build(), TranslationManager.parseLocale(player.getLocale(), TranslationManager.DEFAULT_LOCALE));
+ e.disallow(PlayerLoginEvent.Result.KICK_OTHER, LegacyComponentSerializer.legacySection().serialize(reason));
return;
}
diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/listeners/BukkitPlatformListener.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/listeners/BukkitPlatformListener.java
index 932229b66..94a7501cf 100644
--- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/listeners/BukkitPlatformListener.java
+++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/listeners/BukkitPlatformListener.java
@@ -27,7 +27,7 @@ package me.lucko.luckperms.bukkit.listeners;
import me.lucko.luckperms.bukkit.LPBukkitPlugin;
import me.lucko.luckperms.common.config.ConfigKeys;
-import me.lucko.luckperms.common.locale.message.Message;
+import me.lucko.luckperms.common.locale.Message;
import org.bukkit.command.CommandSender;
import org.bukkit.event.Cancellable;
@@ -75,7 +75,7 @@ public class BukkitPlatformListener implements Listener {
if (OP_COMMAND_PATTERN.matcher(cmdLine).matches()) {
event.setCancelled(true);
- sender.sendMessage(Message.OP_DISABLED.asString(this.plugin.getLocaleManager()));
+ Message.OP_DISABLED.send(this.plugin.getSenderFactory().wrap(sender));
}
}
diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationBPermissions.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationBPermissions.java
index 936781948..1188e3179 100644
--- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationBPermissions.java
+++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationBPermissions.java
@@ -34,11 +34,10 @@ import de.bananaco.bpermissions.api.WorldManager;
import me.lucko.luckperms.common.command.CommandResult;
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
import me.lucko.luckperms.common.command.access.CommandPermission;
+import me.lucko.luckperms.common.command.spec.CommandSpec;
import me.lucko.luckperms.common.command.utils.ArgumentList;
import me.lucko.luckperms.common.commands.migration.MigrationUtils;
-import me.lucko.luckperms.common.locale.LocaleManager;
-import me.lucko.luckperms.common.locale.command.CommandSpec;
-import me.lucko.luckperms.common.locale.message.Message;
+import me.lucko.luckperms.common.locale.Message;
import me.lucko.luckperms.common.model.Group;
import me.lucko.luckperms.common.model.PermissionHolder;
import me.lucko.luckperms.common.model.User;
@@ -78,8 +77,8 @@ public class MigrationBPermissions extends ChildCommand