LuckPerms dependency
This commit is contained in:
parent
2774ac7ab1
commit
1653ceb5fe
@ -12,7 +12,7 @@
|
|||||||
<classpathentry kind="var" path="M2_REPO/com/google/guava/guava/21.0/guava-21.0.jar" sourcepath="M2_REPO/com/google/guava/guava/21.0/guava-21.0-sources.jar"/>
|
<classpathentry kind="var" path="M2_REPO/com/google/guava/guava/21.0/guava-21.0.jar" sourcepath="M2_REPO/com/google/guava/guava/21.0/guava-21.0-sources.jar"/>
|
||||||
<classpathentry kind="var" path="M2_REPO/com/google/code/gson/gson/2.8.0/gson-2.8.0.jar" sourcepath="M2_REPO/com/google/code/gson/gson/2.8.0/gson-2.8.0-sources.jar"/>
|
<classpathentry kind="var" path="M2_REPO/com/google/code/gson/gson/2.8.0/gson-2.8.0.jar" sourcepath="M2_REPO/com/google/code/gson/gson/2.8.0/gson-2.8.0-sources.jar"/>
|
||||||
<classpathentry kind="var" path="M2_REPO/org/yaml/snakeyaml/1.18/snakeyaml-1.18.jar" sourcepath="M2_REPO/org/yaml/snakeyaml/1.18/snakeyaml-1.18-sources.jar"/>
|
<classpathentry kind="var" path="M2_REPO/org/yaml/snakeyaml/1.18/snakeyaml-1.18.jar" sourcepath="M2_REPO/org/yaml/snakeyaml/1.18/snakeyaml-1.18-sources.jar"/>
|
||||||
<classpathentry kind="var" path="M2_REPO/net/md-5/bungeecord-chat/1.12-SNAPSHOT/bungeecord-chat-1.12-SNAPSHOT.jar"/>
|
<classpathentry kind="var" path="M2_REPO/net/md-5/bungeecord-chat/1.12-SNAPSHOT/bungeecord-chat-1.12-SNAPSHOT.jar" sourcepath="M2_REPO/net/md-5/bungeecord-chat/1.12-SNAPSHOT/bungeecord-chat-1.12-SNAPSHOT-sources.jar"/>
|
||||||
<classpathentry kind="var" path="M2_REPO/me/lucko/luckperms/luckperms-api/4.2/luckperms-api-4.2.jar" sourcepath="M2_REPO/me/lucko/luckperms/luckperms-api/4.2/luckperms-api-4.2-sources.jar"/>
|
<classpathentry kind="var" path="M2_REPO/me/lucko/luckperms/luckperms-api/4.2/luckperms-api-4.2.jar" sourcepath="M2_REPO/me/lucko/luckperms/luckperms-api/4.2/luckperms-api-4.2-sources.jar"/>
|
||||||
<classpathentry kind="src" path="/BountifulAPI"/>
|
<classpathentry kind="src" path="/BountifulAPI"/>
|
||||||
<classpathentry kind="var" path="M2_REPO/commons-io/commons-io/1.3.2/commons-io-1.3.2.jar" sourcepath="M2_REPO/commons-io/commons-io/1.3.2/commons-io-1.3.2-sources.jar"/>
|
<classpathentry kind="var" path="M2_REPO/commons-io/commons-io/1.3.2/commons-io-1.3.2.jar" sourcepath="M2_REPO/commons-io/commons-io/1.3.2/commons-io-1.3.2-sources.jar"/>
|
||||||
@ -25,4 +25,6 @@
|
|||||||
<classpathentry kind="var" path="M2_REPO/com/sk89q/lib/jlibnoise/1.0.0/jlibnoise-1.0.0.jar"/>
|
<classpathentry kind="var" path="M2_REPO/com/sk89q/lib/jlibnoise/1.0.0/jlibnoise-1.0.0.jar"/>
|
||||||
<classpathentry kind="var" path="M2_REPO/com/sk89q/jchronic/0.2.4a/jchronic-0.2.4a.jar"/>
|
<classpathentry kind="var" path="M2_REPO/com/sk89q/jchronic/0.2.4a/jchronic-0.2.4a.jar"/>
|
||||||
<classpathentry kind="var" path="M2_REPO/com/sk89q/worldguard/worldguard-legacy/6.2/worldguard-legacy-6.2.jar"/>
|
<classpathentry kind="var" path="M2_REPO/com/sk89q/worldguard/worldguard-legacy/6.2/worldguard-legacy-6.2.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/erik/Dokumenty/Java/marwland/res/MassiveCore.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/erik/Dokumenty/Java/marwland/res/Factions.jar"/>
|
||||||
</classpath>
|
</classpath>
|
14
pom.xml
14
pom.xml
@ -83,6 +83,20 @@
|
|||||||
<version>6.2</version>
|
<version>6.2</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.massivecraft.massivecore</groupId>
|
||||||
|
<artifactId>MassiveCore</artifactId>
|
||||||
|
<version>2.14.1-SNAPSHOT</version>
|
||||||
|
<scope>system</scope>
|
||||||
|
<systemPath>/home/erik/Dokumenty/Java/marwland/res/MassiveCore.jar</systemPath>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.massivecraft.factions</groupId>
|
||||||
|
<artifactId>Factions</artifactId>
|
||||||
|
<version>2.14.1-SNAPSHOT</version>
|
||||||
|
<scope>system</scope>
|
||||||
|
<systemPath>/home/erik/Dokumenty/Java/marwland/res/Factions.jar</systemPath>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,8 +4,5 @@ version: 0.0.1
|
|||||||
api-version: 1.12
|
api-version: 1.12
|
||||||
author: ericek111
|
author: ericek111
|
||||||
website: https://git.lixko.eu/MarwLand/MarwCore
|
website: https://git.lixko.eu/MarwLand/MarwCore
|
||||||
softdepend: [WorldGuard]
|
depend: [LuckPerms]
|
||||||
commands:
|
softdepend: [WorldGuard, Factions]
|
||||||
first:
|
|
||||||
description: First command.
|
|
||||||
usage: /first
|
|
||||||
|
40
src/cz/marwland/mc/core/util/UserUtil.java
Normal file
40
src/cz/marwland/mc/core/util/UserUtil.java
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package cz.marwland.mc.core.util;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import me.lucko.luckperms.LuckPerms;
|
||||||
|
import me.lucko.luckperms.api.Contexts;
|
||||||
|
import me.lucko.luckperms.api.LuckPermsApi;
|
||||||
|
import me.lucko.luckperms.api.User;
|
||||||
|
import me.lucko.luckperms.api.caching.MetaData;
|
||||||
|
import me.lucko.luckperms.api.caching.PermissionData;
|
||||||
|
import me.lucko.luckperms.api.context.ImmutableContextSet;
|
||||||
|
|
||||||
|
public class UserUtil {
|
||||||
|
|
||||||
|
private static final LuckPermsApi api = LuckPerms.getApi();
|
||||||
|
|
||||||
|
public static User getOnlineUser(Player p) {
|
||||||
|
if (!p.isOnline()) {
|
||||||
|
throw new IllegalStateException("Player is offline");
|
||||||
|
}
|
||||||
|
return api.getUserManager().getUser(p.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Contexts getPlayersContexts(Player p) {
|
||||||
|
//ImmutableContextSet contextSet = api.getContextManager().getApplicableContext(p);
|
||||||
|
Contexts contexts = api.getContextManager().getApplicableContexts(p);
|
||||||
|
return contexts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getPlayersMeta(Player player, String key, String defaultValue) {
|
||||||
|
User user = getOnlineUser(player);
|
||||||
|
MetaData metaData = user.getCachedData().getMetaData(getPlayersContexts(player));
|
||||||
|
return metaData.getMeta().getOrDefault(key, defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getPlayersMeta(Player player, String key) {
|
||||||
|
return getPlayersMeta(player, key, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user