mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2025-01-27 02:31:55 +01:00
Return a dummy value instead of throwing an exception when an offline player is queried via Vault (#806)
This commit is contained in:
parent
8f82ef7eb4
commit
7549b3eb9e
@ -33,6 +33,7 @@ import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Function;
|
||||
|
||||
@ -73,18 +74,18 @@ public abstract class AbstractVaultChat extends Chat {
|
||||
}
|
||||
|
||||
// methods subclasses are expected to implement
|
||||
public abstract String getPlayerPrefix(String world, UUID uuid);
|
||||
public abstract String getPlayerSuffix(String world, UUID uuid);
|
||||
public abstract void setPlayerPrefix(String world, UUID uuid, String prefix);
|
||||
public abstract void setPlayerSuffix(String world, UUID uuid, String suffix);
|
||||
public abstract String getPlayerInfo(String world, UUID uuid, String key);
|
||||
public abstract void setPlayerInfo(String world, UUID uuid, String key, Object value);
|
||||
public abstract String getGroupsPrefix(String world, String name); // note "groups" not "group"
|
||||
public abstract String getGroupsSuffix(String world, String name); // note "groups" not "group"
|
||||
public abstract void setGroupsPrefix(String world, String name, String prefix); // note "groups" not "group"
|
||||
public abstract void setGroupsSuffix(String world, String name, String suffix); // note "groups" not "group"
|
||||
public abstract String getGroupInfo(String world, String name, String key);
|
||||
public abstract void setGroupInfo(String world, String name, String key, Object value);
|
||||
public abstract String getUserChatPrefix(String world, UUID uuid);
|
||||
public abstract String getUserChatSuffix(String world, UUID uuid);
|
||||
public abstract void setUserChatPrefix(String world, UUID uuid, String prefix);
|
||||
public abstract void setUserChatSuffix(String world, UUID uuid, String suffix);
|
||||
public abstract String getUserMeta(String world, UUID uuid, String key);
|
||||
public abstract void setUserMeta(String world, UUID uuid, String key, Object value);
|
||||
public abstract String getGroupChatPrefix(String world, String name);
|
||||
public abstract String getGroupChatSuffix(String world, String name);
|
||||
public abstract void setGroupChatPrefix(String world, String name, String prefix);
|
||||
public abstract void setGroupChatSuffix(String world, String name, String suffix);
|
||||
public abstract String getGroupMeta(String world, String name, String key);
|
||||
public abstract void setGroupMeta(String world, String name, String key, Object value);
|
||||
|
||||
// utility methods for parsing metadata values from strings
|
||||
|
||||
@ -165,362 +166,482 @@ public abstract class AbstractVaultChat extends Chat {
|
||||
|
||||
@Override
|
||||
public String getPlayerPrefix(String world, String player) {
|
||||
return getPlayerPrefix(world(world), player(player));
|
||||
Objects.requireNonNull(player, "player");
|
||||
return getUserChatPrefix(world(world), player(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerPrefix(String world, OfflinePlayer player) {
|
||||
return getPlayerPrefix(world(world), player(player));
|
||||
Objects.requireNonNull(player, "player");
|
||||
return getUserChatPrefix(world(world), player(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerPrefix(World world, String player) {
|
||||
return getPlayerPrefix(world(world), player(player));
|
||||
Objects.requireNonNull(player, "player");
|
||||
return getUserChatPrefix(world(world), player(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerPrefix(Player player) {
|
||||
return getPlayerPrefix(world(player), player(player));
|
||||
Objects.requireNonNull(player, "player");
|
||||
return getUserChatPrefix(world(player), player(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerPrefix(String world, String player, String prefix) {
|
||||
setPlayerPrefix(world(world), player(player), prefix);
|
||||
Objects.requireNonNull(player, "player");
|
||||
setUserChatPrefix(world(world), player(player), prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerPrefix(String world, OfflinePlayer player, String prefix) {
|
||||
setPlayerPrefix(world(world), player(player), prefix);
|
||||
Objects.requireNonNull(player, "player");
|
||||
setUserChatPrefix(world(world), player(player), prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerPrefix(World world, String player, String prefix) {
|
||||
setPlayerPrefix(world(world), player(player), prefix);
|
||||
Objects.requireNonNull(player, "player");
|
||||
setUserChatPrefix(world(world), player(player), prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerPrefix(Player player, String prefix) {
|
||||
setPlayerPrefix(world(player), player(player), prefix);
|
||||
Objects.requireNonNull(player, "player");
|
||||
setUserChatPrefix(world(player), player(player), prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerSuffix(String world, String player) {
|
||||
return getPlayerSuffix(world(world), player(player));
|
||||
Objects.requireNonNull(player, "player");
|
||||
return getUserChatSuffix(world(world), player(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerSuffix(String world, OfflinePlayer player) {
|
||||
return getPlayerSuffix(world(world), player(player));
|
||||
Objects.requireNonNull(player, "player");
|
||||
return getUserChatSuffix(world(world), player(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerSuffix(World world, String player) {
|
||||
return getPlayerSuffix(world(world), player(player));
|
||||
Objects.requireNonNull(player, "player");
|
||||
return getUserChatSuffix(world(world), player(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerSuffix(Player player) {
|
||||
return getPlayerSuffix(world(player), player(player));
|
||||
Objects.requireNonNull(player, "player");
|
||||
return getUserChatSuffix(world(player), player(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerSuffix(String world, String player, String suffix) {
|
||||
setPlayerSuffix(world(world), player(player), suffix);
|
||||
Objects.requireNonNull(player, "player");
|
||||
setUserChatSuffix(world(world), player(player), suffix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerSuffix(String world, OfflinePlayer player, String suffix) {
|
||||
setPlayerSuffix(world(world), player(player), suffix);
|
||||
Objects.requireNonNull(player, "player");
|
||||
setUserChatSuffix(world(world), player(player), suffix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerSuffix(World world, String player, String suffix) {
|
||||
setPlayerSuffix(world(world), player(player), suffix);
|
||||
Objects.requireNonNull(player, "player");
|
||||
setUserChatSuffix(world(world), player(player), suffix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerSuffix(Player player, String suffix) {
|
||||
setPlayerSuffix(world(player), player(player), suffix);
|
||||
Objects.requireNonNull(player, "player");
|
||||
setUserChatSuffix(world(player), player(player), suffix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupPrefix(String world, String group) {
|
||||
return getGroupsPrefix(world(world), group);
|
||||
Objects.requireNonNull(group, "group");
|
||||
return getGroupChatPrefix(world(world), group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupPrefix(World world, String group) {
|
||||
return getGroupsPrefix(world(world), group);
|
||||
Objects.requireNonNull(group, "group");
|
||||
return getGroupChatPrefix(world(world), group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupPrefix(String world, String group, String prefix) {
|
||||
setGroupsPrefix(world(world), group, prefix);
|
||||
Objects.requireNonNull(group, "group");
|
||||
setGroupChatPrefix(world(world), group, prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupPrefix(World world, String group, String prefix) {
|
||||
setGroupsPrefix(world(world), group, prefix);
|
||||
Objects.requireNonNull(group, "group");
|
||||
setGroupChatPrefix(world(world), group, prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupSuffix(String world, String group) {
|
||||
return getGroupsSuffix(world(world), group);
|
||||
Objects.requireNonNull(group, "group");
|
||||
return getGroupChatSuffix(world(world), group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupSuffix(World world, String group) {
|
||||
return getGroupsSuffix(world(world), group);
|
||||
Objects.requireNonNull(group, "group");
|
||||
return getGroupChatSuffix(world(world), group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupSuffix(String world, String group, String suffix) {
|
||||
setGroupsSuffix(world(world), group, suffix);
|
||||
Objects.requireNonNull(group, "group");
|
||||
setGroupChatSuffix(world(world), group, suffix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupSuffix(World world, String group, String suffix) {
|
||||
setGroupsSuffix(world(world), group, suffix);
|
||||
Objects.requireNonNull(group, "group");
|
||||
setGroupChatSuffix(world(world), group, suffix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlayerInfoInteger(String world, OfflinePlayer player, String node, int defaultValue) {
|
||||
return intConvert(getPlayerInfo(world(world), player(player), node), defaultValue);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
return intConvert(getUserMeta(world(world), player(player), node), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlayerInfoInteger(String world, String player, String node, int defaultValue) {
|
||||
return intConvert(getPlayerInfo(world(world), player(player), node), defaultValue);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
return intConvert(getUserMeta(world(world), player(player), node), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlayerInfoInteger(World world, String player, String node, int defaultValue) {
|
||||
return intConvert(getPlayerInfo(world(world), player(player), node), defaultValue);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
return intConvert(getUserMeta(world(world), player(player), node), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlayerInfoInteger(Player player, String node, int defaultValue) {
|
||||
return intConvert(getPlayerInfo(world(player), player(player), node), defaultValue);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
return intConvert(getUserMeta(world(player), player(player), node), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoInteger(String world, OfflinePlayer player, String node, int value) {
|
||||
setPlayerInfo(world(world), player(player), node, value);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
setUserMeta(world(world), player(player), node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoInteger(String world, String player, String node, int value) {
|
||||
setPlayerInfo(world(world), player(player), node, value);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
setUserMeta(world(world), player(player), node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoInteger(World world, String player, String node, int value) {
|
||||
setPlayerInfo(world(world), player(player), node, value);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
setUserMeta(world(world), player(player), node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoInteger(Player player, String node, int value) {
|
||||
setPlayerInfo(world(player), player(player), node, value);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
setUserMeta(world(player), player(player), node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGroupInfoInteger(String world, String group, String node, int defaultValue) {
|
||||
return intConvert(getGroupInfo(world(world), group, node), defaultValue);
|
||||
Objects.requireNonNull(group, "group");
|
||||
Objects.requireNonNull(node, "node");
|
||||
return intConvert(getGroupMeta(world(world), group, node), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGroupInfoInteger(World world, String group, String node, int defaultValue) {
|
||||
return intConvert(getGroupInfo(world(world), group, node), defaultValue);
|
||||
Objects.requireNonNull(group, "group");
|
||||
Objects.requireNonNull(node, "node");
|
||||
return intConvert(getGroupMeta(world(world), group, node), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoInteger(String world, String group, String node, int value) {
|
||||
setGroupInfo(world(world), group, node, value);
|
||||
Objects.requireNonNull(group, "group");
|
||||
Objects.requireNonNull(node, "node");
|
||||
setGroupMeta(world(world), group, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoInteger(World world, String group, String node, int value) {
|
||||
setGroupInfo(world(world), group, node, value);
|
||||
Objects.requireNonNull(group, "group");
|
||||
Objects.requireNonNull(node, "node");
|
||||
setGroupMeta(world(world), group, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getPlayerInfoDouble(String world, OfflinePlayer player, String node, double defaultValue) {
|
||||
return doubleConvert(getPlayerInfo(world(world), player(player), node), defaultValue);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
return doubleConvert(getUserMeta(world(world), player(player), node), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getPlayerInfoDouble(String world, String player, String node, double defaultValue) {
|
||||
return doubleConvert(getPlayerInfo(world(world), player(player), node), defaultValue);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
return doubleConvert(getUserMeta(world(world), player(player), node), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getPlayerInfoDouble(World world, String player, String node, double defaultValue) {
|
||||
return doubleConvert(getPlayerInfo(world(world), player(player), node), defaultValue);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
return doubleConvert(getUserMeta(world(world), player(player), node), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getPlayerInfoDouble(Player player, String node, double defaultValue) {
|
||||
return doubleConvert(getPlayerInfo(world(player), player(player), node), defaultValue);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
return doubleConvert(getUserMeta(world(player), player(player), node), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoDouble(String world, OfflinePlayer player, String node, double value) {
|
||||
setPlayerInfo(world(world), player(player), node, value);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
setUserMeta(world(world), player(player), node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoDouble(String world, String player, String node, double value) {
|
||||
setPlayerInfo(world(world), player(player), node, value);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
setUserMeta(world(world), player(player), node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoDouble(World world, String player, String node, double value) {
|
||||
setPlayerInfo(world(world), player(player), node, value);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
setUserMeta(world(world), player(player), node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoDouble(Player player, String node, double value) {
|
||||
setPlayerInfo(world(player), player(player), node, value);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
setUserMeta(world(player), player(player), node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getGroupInfoDouble(String world, String group, String node, double defaultValue) {
|
||||
return doubleConvert(getGroupInfo(world(world), group, node), defaultValue);
|
||||
Objects.requireNonNull(group, "group");
|
||||
Objects.requireNonNull(node, "node");
|
||||
return doubleConvert(getGroupMeta(world(world), group, node), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getGroupInfoDouble(World world, String group, String node, double defaultValue) {
|
||||
return doubleConvert(getGroupInfo(world(world), group, node), defaultValue);
|
||||
Objects.requireNonNull(group, "group");
|
||||
Objects.requireNonNull(node, "node");
|
||||
return doubleConvert(getGroupMeta(world(world), group, node), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoDouble(String world, String group, String node, double value) {
|
||||
setGroupInfo(world(world), group, node, value);
|
||||
Objects.requireNonNull(group, "group");
|
||||
Objects.requireNonNull(node, "node");
|
||||
setGroupMeta(world(world), group, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoDouble(World world, String group, String node, double value) {
|
||||
setGroupInfo(world(world), group, node, value);
|
||||
Objects.requireNonNull(group, "group");
|
||||
Objects.requireNonNull(node, "node");
|
||||
setGroupMeta(world(world), group, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getPlayerInfoBoolean(String world, OfflinePlayer player, String node, boolean defaultValue) {
|
||||
return booleanConvert(getPlayerInfo(world(world), player(player), node), defaultValue);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
return booleanConvert(getUserMeta(world(world), player(player), node), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getPlayerInfoBoolean(String world, String player, String node, boolean defaultValue) {
|
||||
return booleanConvert(getPlayerInfo(world(world), player(player), node), defaultValue);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
return booleanConvert(getUserMeta(world(world), player(player), node), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getPlayerInfoBoolean(World world, String player, String node, boolean defaultValue) {
|
||||
return booleanConvert(getPlayerInfo(world(world), player(player), node), defaultValue);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
return booleanConvert(getUserMeta(world(world), player(player), node), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getPlayerInfoBoolean(Player player, String node, boolean defaultValue) {
|
||||
return booleanConvert(getPlayerInfo(world(player), player(player), node), defaultValue);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
return booleanConvert(getUserMeta(world(player), player(player), node), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoBoolean(String world, OfflinePlayer player, String node, boolean value) {
|
||||
setPlayerInfo(world(world), player(player), node, value);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
setUserMeta(world(world), player(player), node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoBoolean(String world, String player, String node, boolean value) {
|
||||
setPlayerInfo(world(world), player(player), node, value);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
setUserMeta(world(world), player(player), node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoBoolean(World world, String player, String node, boolean value) {
|
||||
setPlayerInfo(world(world), player(player), node, value);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
setUserMeta(world(world), player(player), node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoBoolean(Player player, String node, boolean value) {
|
||||
setPlayerInfo(world(player), player(player), node, value);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
setUserMeta(world(player), player(player), node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getGroupInfoBoolean(String world, String group, String node, boolean defaultValue) {
|
||||
return booleanConvert(getGroupInfo(world(world), group, node), defaultValue);
|
||||
Objects.requireNonNull(group, "group");
|
||||
Objects.requireNonNull(node, "node");
|
||||
return booleanConvert(getGroupMeta(world(world), group, node), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getGroupInfoBoolean(World world, String group, String node, boolean defaultValue) {
|
||||
return booleanConvert(getGroupInfo(world(world), group, node), defaultValue);
|
||||
Objects.requireNonNull(group, "group");
|
||||
Objects.requireNonNull(node, "node");
|
||||
return booleanConvert(getGroupMeta(world(world), group, node), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoBoolean(String world, String group, String node, boolean value) {
|
||||
setGroupInfo(world(world), group, node, value);
|
||||
Objects.requireNonNull(group, "group");
|
||||
Objects.requireNonNull(node, "node");
|
||||
setGroupMeta(world(world), group, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoBoolean(World world, String group, String node, boolean value) {
|
||||
setGroupInfo(world(world), group, node, value);
|
||||
Objects.requireNonNull(group, "group");
|
||||
Objects.requireNonNull(node, "node");
|
||||
setGroupMeta(world(world), group, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerInfoString(String world, OfflinePlayer player, String node, String defaultValue) {
|
||||
return strConvert(getPlayerInfo(world(world), player(player), node), defaultValue);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
return strConvert(getUserMeta(world(world), player(player), node), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerInfoString(String world, String player, String node, String defaultValue) {
|
||||
return strConvert(getPlayerInfo(world(world), player(player), node), defaultValue);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
return strConvert(getUserMeta(world(world), player(player), node), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerInfoString(World world, String player, String node, String defaultValue) {
|
||||
return strConvert(getPlayerInfo(world(world), player(player), node), defaultValue);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
return strConvert(getUserMeta(world(world), player(player), node), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerInfoString(Player player, String node, String defaultValue) {
|
||||
return strConvert(getPlayerInfo(world(player), player(player), node), defaultValue);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
return strConvert(getUserMeta(world(player), player(player), node), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoString(String world, OfflinePlayer player, String node, String value) {
|
||||
setPlayerInfo(world(world), player(player), node, value);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
setUserMeta(world(world), player(player), node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoString(String world, String player, String node, String value) {
|
||||
setPlayerInfo(world(world), player(player), node, value);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
setUserMeta(world(world), player(player), node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoString(World world, String player, String node, String value) {
|
||||
setPlayerInfo(world(world), player(player), node, value);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
setUserMeta(world(world), player(player), node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoString(Player player, String node, String value) {
|
||||
setPlayerInfo(world(player), player(player), node, value);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(node, "node");
|
||||
setUserMeta(world(player), player(player), node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupInfoString(String world, String group, String node, String defaultValue) {
|
||||
return strConvert(getGroupInfo(world(world), group, node), defaultValue);
|
||||
Objects.requireNonNull(group, "group");
|
||||
Objects.requireNonNull(node, "node");
|
||||
return strConvert(getGroupMeta(world(world), group, node), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupInfoString(World world, String group, String node, String defaultValue) {
|
||||
return strConvert(getGroupInfo(world(world), group, node), defaultValue);
|
||||
Objects.requireNonNull(group, "group");
|
||||
Objects.requireNonNull(node, "node");
|
||||
return strConvert(getGroupMeta(world(world), group, node), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoString(String world, String group, String node, String value) {
|
||||
setGroupInfo(world(world), group, node, value);
|
||||
Objects.requireNonNull(group, "group");
|
||||
Objects.requireNonNull(node, "node");
|
||||
setGroupMeta(world(world), group, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoString(World world, String group, String node, String value) {
|
||||
setGroupInfo(world(world), group, node, value);
|
||||
Objects.requireNonNull(group, "group");
|
||||
Objects.requireNonNull(node, "node");
|
||||
setGroupMeta(world(world), group, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -33,6 +33,7 @@ import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Function;
|
||||
|
||||
@ -81,14 +82,14 @@ public abstract class AbstractVaultPermission extends Permission {
|
||||
}
|
||||
|
||||
// methods subclasses are expected to implement
|
||||
public abstract boolean hasPermission(String world, UUID uuid, String permission);
|
||||
public abstract boolean playerAddPermission(String world, UUID uuid, String permission);
|
||||
public abstract boolean playerRemovePermission(String world, UUID uuid, String permission);
|
||||
public abstract boolean playerInGroup(String world, UUID uuid, String group);
|
||||
public abstract boolean playerAddGroup(String world, UUID uuid, String group);
|
||||
public abstract boolean playerRemoveGroup(String world, UUID uuid, String group);
|
||||
public abstract String[] playerGetGroups(String world, UUID uuid);
|
||||
public abstract String playerPrimaryGroup(String world, UUID uuid);
|
||||
public abstract boolean userHasPermission(String world, UUID uuid, String permission);
|
||||
public abstract boolean userAddPermission(String world, UUID uuid, String permission);
|
||||
public abstract boolean userRemovePermission(String world, UUID uuid, String permission);
|
||||
public abstract boolean userInGroup(String world, UUID uuid, String group);
|
||||
public abstract boolean userAddGroup(String world, UUID uuid, String group);
|
||||
public abstract boolean userRemoveGroup(String world, UUID uuid, String group);
|
||||
public abstract String[] userGetGroups(String world, UUID uuid);
|
||||
public abstract String userGetPrimaryGroup(String world, UUID uuid);
|
||||
public abstract boolean groupHasPermission(String world, String name, String permission);
|
||||
public abstract boolean groupAddPermission(String world, String name, String permission);
|
||||
public abstract boolean groupRemovePermission(String world, String name, String permission);
|
||||
@ -129,207 +130,280 @@ public abstract class AbstractVaultPermission extends Permission {
|
||||
|
||||
@Override
|
||||
public boolean has(String world, String player, String permission) {
|
||||
return hasPermission(world(world), player(player), permission);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
return userHasPermission(world(world), player(player), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(World world, String player, String permission) {
|
||||
return hasPermission(world(world), player(player), permission);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
return userHasPermission(world(world), player(player), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(Player player, String permission) {
|
||||
return hasPermission(world(player), player(player), permission);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
return userHasPermission(world(player), player(player), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerHas(String world, String player, String permission) {
|
||||
return hasPermission(world(world), player(player), permission);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
return userHasPermission(world(world), player(player), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerHas(World world, String player, String permission) {
|
||||
return hasPermission(world(world), player(player), permission);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
return userHasPermission(world(world), player(player), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerHas(String world, OfflinePlayer player, String permission) {
|
||||
return hasPermission(world(world), player(player), permission);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
return userHasPermission(world(world), player(player), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerHas(Player player, String permission) {
|
||||
return hasPermission(world(player), player(player), permission);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
return userHasPermission(world(player), player(player), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAdd(String world, String player, String permission) {
|
||||
return playerAddPermission(world(world), player(player), permission);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
return userAddPermission(world(world), player(player), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAdd(World world, String player, String permission) {
|
||||
return playerAddPermission(world(world), player(player), permission);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
return userAddPermission(world(world), player(player), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAdd(String world, OfflinePlayer player, String permission) {
|
||||
return playerAddPermission(world(world), player(player), permission);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
return userAddPermission(world(world), player(player), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAdd(Player player, String permission) {
|
||||
return playerAddPermission(world(player), player(player), permission);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
return userAddPermission(world(player), player(player), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemove(String world, String player, String permission) {
|
||||
return playerRemovePermission(world(world), player(player), permission);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
return userRemovePermission(world(world), player(player), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemove(String world, OfflinePlayer player, String permission) {
|
||||
return playerRemovePermission(world(world), player(player), permission);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
return userRemovePermission(world(world), player(player), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemove(World world, String player, String permission) {
|
||||
return playerRemovePermission(world(world), player(player), permission);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
return userRemovePermission(world(world), player(player), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemove(Player player, String permission) {
|
||||
return playerRemovePermission(world(player), player(player), permission);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
return userRemovePermission(world(player), player(player), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupHas(String world, String group, String permission) {
|
||||
Objects.requireNonNull(group, "group");
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
return groupHasPermission(world(world), group, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupHas(World world, String group, String permission) {
|
||||
Objects.requireNonNull(group, "group");
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
return groupHasPermission(world(world), group, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupAdd(String world, String group, String permission) {
|
||||
Objects.requireNonNull(group, "group");
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
return groupAddPermission(world(world), group, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupAdd(World world, String group, String permission) {
|
||||
Objects.requireNonNull(group, "group");
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
return groupAddPermission(world(world), group, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupRemove(String world, String group, String permission) {
|
||||
Objects.requireNonNull(group, "group");
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
return groupRemovePermission(world(world), group, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupRemove(World world, String group, String permission) {
|
||||
Objects.requireNonNull(group, "group");
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
return groupRemovePermission(world(world), group, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerInGroup(String world, String player, String group) {
|
||||
return playerInGroup(world(world), player(player), group);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(group, "group");
|
||||
return userInGroup(world(world), player(player), group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerInGroup(World world, String player, String group) {
|
||||
return playerInGroup(world(world), player(player), group);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(group, "group");
|
||||
return userInGroup(world(world), player(player), group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerInGroup(String world, OfflinePlayer player, String group) {
|
||||
return playerInGroup(world(world), player(player), group);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(group, "group");
|
||||
return userInGroup(world(world), player(player), group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerInGroup(Player player, String group) {
|
||||
return playerInGroup(world(player), player(player), group);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(group, "group");
|
||||
return userInGroup(world(player), player(player), group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAddGroup(String world, String player, String group) {
|
||||
return playerAddGroup(world(world), player(player), group);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(group, "group");
|
||||
return userAddGroup(world(world), player(player), group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAddGroup(World world, String player, String group) {
|
||||
return playerAddGroup(world(world), player(player), group);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(group, "group");
|
||||
return userAddGroup(world(world), player(player), group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAddGroup(String world, OfflinePlayer player, String group) {
|
||||
return playerAddGroup(world(world), player(player), group);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(group, "group");
|
||||
return userAddGroup(world(world), player(player), group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAddGroup(Player player, String group) {
|
||||
return playerAddGroup(world(player), player(player), group);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(group, "group");
|
||||
return userAddGroup(world(player), player(player), group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemoveGroup(String world, String player, String group) {
|
||||
return playerRemoveGroup(world(world), player(player), group);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(group, "group");
|
||||
return userRemoveGroup(world(world), player(player), group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemoveGroup(World world, String player, String group) {
|
||||
return playerRemoveGroup(world(world), player(player), group);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(group, "group");
|
||||
return userRemoveGroup(world(world), player(player), group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemoveGroup(String world, OfflinePlayer player, String group) {
|
||||
return playerRemoveGroup(world(world), player(player), group);
|
||||
Objects.requireNonNull(player, "player");
|
||||
Objects.requireNonNull(group, "group");
|
||||
return userRemoveGroup(world(world), player(player), group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemoveGroup(Player player, String group) {
|
||||
return playerRemoveGroup(world(player), player(player), group);
|
||||
Objects.requireNonNull(player, "player");
|
||||
return userRemoveGroup(world(player), player(player), group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPlayerGroups(String world, String player) {
|
||||
return playerGetGroups(world(world), player(player));
|
||||
Objects.requireNonNull(player, "player");
|
||||
return userGetGroups(world(world), player(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPlayerGroups(World world, String player) {
|
||||
return playerGetGroups(world(world), player(player));
|
||||
Objects.requireNonNull(player, "player");
|
||||
return userGetGroups(world(world), player(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPlayerGroups(String world, OfflinePlayer player) {
|
||||
return playerGetGroups(world(world), player(player));
|
||||
Objects.requireNonNull(player, "player");
|
||||
return userGetGroups(world(world), player(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPlayerGroups(Player player) {
|
||||
return playerGetGroups(world(player), player(player));
|
||||
Objects.requireNonNull(player, "player");
|
||||
return userGetGroups(world(player), player(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrimaryGroup(String world, String player) {
|
||||
return playerPrimaryGroup(world(world), player(player));
|
||||
Objects.requireNonNull(player, "player");
|
||||
return userGetPrimaryGroup(world(world), player(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrimaryGroup(World world, String player) {
|
||||
return playerPrimaryGroup(world(world), player(player));
|
||||
Objects.requireNonNull(player, "player");
|
||||
return userGetPrimaryGroup(world(world), player(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrimaryGroup(String world, OfflinePlayer player) {
|
||||
return playerPrimaryGroup(world(world), player(player));
|
||||
Objects.requireNonNull(player, "player");
|
||||
return userGetPrimaryGroup(world(world), player(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrimaryGroup(Player player) {
|
||||
return playerPrimaryGroup(world(player), player(player));
|
||||
Objects.requireNonNull(player, "player");
|
||||
return userGetPrimaryGroup(world(player), player(player));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -84,8 +84,10 @@ public class VaultChatHook extends AbstractVaultChat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerPrefix(String world, UUID uuid) {
|
||||
Objects.requireNonNull(uuid, "uuid");
|
||||
public String getUserChatPrefix(String world, UUID uuid) {
|
||||
if (uuid == null) {
|
||||
return null;
|
||||
}
|
||||
User user = getUser(uuid);
|
||||
if (user == null) {
|
||||
return null;
|
||||
@ -94,14 +96,16 @@ public class VaultChatHook extends AbstractVaultChat {
|
||||
MetaCache metaData = user.getCachedData().getMetaData(contexts);
|
||||
String ret = metaData.getPrefix();
|
||||
if (log()) {
|
||||
logMsg("#getPlayerPrefix: %s - %s - %s", user.getFriendlyName(), contexts.getContexts().toMultimap(), ret);
|
||||
logMsg("#getUserChatPrefix: %s - %s - %s", user.getFriendlyName(), contexts.getContexts().toMultimap(), ret);
|
||||
}
|
||||
return Strings.nullToEmpty(ret);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerSuffix(String world, UUID uuid) {
|
||||
Objects.requireNonNull(uuid, "uuid");
|
||||
public String getUserChatSuffix(String world, UUID uuid) {
|
||||
if (uuid == null) {
|
||||
return null;
|
||||
}
|
||||
User user = getUser(uuid);
|
||||
if (user == null) {
|
||||
return null;
|
||||
@ -110,14 +114,16 @@ public class VaultChatHook extends AbstractVaultChat {
|
||||
MetaCache metaData = user.getCachedData().getMetaData(contexts);
|
||||
String ret = metaData.getSuffix();
|
||||
if (log()) {
|
||||
logMsg("#getPlayerSuffix: %s - %s - %s", user.getFriendlyName(), contexts.getContexts().toMultimap(), ret);
|
||||
logMsg("#getUserChatSuffix: %s - %s - %s", user.getFriendlyName(), contexts.getContexts().toMultimap(), ret);
|
||||
}
|
||||
return Strings.nullToEmpty(ret);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerPrefix(String world, UUID uuid, String prefix) {
|
||||
Objects.requireNonNull(uuid, "uuid");
|
||||
public void setUserChatPrefix(String world, UUID uuid, String prefix) {
|
||||
if (uuid == null) {
|
||||
return;
|
||||
}
|
||||
User user = getUser(uuid);
|
||||
if (user == null) {
|
||||
return;
|
||||
@ -126,8 +132,10 @@ public class VaultChatHook extends AbstractVaultChat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerSuffix(String world, UUID uuid, String suffix) {
|
||||
Objects.requireNonNull(uuid, "uuid");
|
||||
public void setUserChatSuffix(String world, UUID uuid, String suffix) {
|
||||
if (uuid == null) {
|
||||
return;
|
||||
}
|
||||
User user = getUser(uuid);
|
||||
if (user == null) {
|
||||
return;
|
||||
@ -136,8 +144,10 @@ public class VaultChatHook extends AbstractVaultChat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerInfo(String world, UUID uuid, String key) {
|
||||
Objects.requireNonNull(uuid, "uuid");
|
||||
public String getUserMeta(String world, UUID uuid, String key) {
|
||||
if (uuid == null) {
|
||||
return null;
|
||||
}
|
||||
Objects.requireNonNull(key, "key");
|
||||
User user = getUser(uuid);
|
||||
if (user == null) {
|
||||
@ -147,14 +157,16 @@ public class VaultChatHook extends AbstractVaultChat {
|
||||
MetaCache metaData = user.getCachedData().getMetaData(contexts);
|
||||
String ret = metaData.getMeta().get(key);
|
||||
if (log()) {
|
||||
logMsg("#getPlayerInfo: %s - %s - %s - %s", user.getFriendlyName(), contexts.getContexts().toMultimap(), key, ret);
|
||||
logMsg("#getUserMeta: %s - %s - %s - %s", user.getFriendlyName(), contexts.getContexts().toMultimap(), key, ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfo(String world, UUID uuid, String key, Object value) {
|
||||
Objects.requireNonNull(uuid, "uuid");
|
||||
public void setUserMeta(String world, UUID uuid, String key, Object value) {
|
||||
if (uuid == null) {
|
||||
return;
|
||||
}
|
||||
Objects.requireNonNull(key, "key");
|
||||
User user = getUser(uuid);
|
||||
if (user == null) {
|
||||
@ -164,7 +176,7 @@ public class VaultChatHook extends AbstractVaultChat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupsPrefix(String world, String name) {
|
||||
public String getGroupChatPrefix(String world, String name) {
|
||||
Objects.requireNonNull(name, "name");
|
||||
Group group = getGroup(name);
|
||||
if (group == null) {
|
||||
@ -180,7 +192,7 @@ public class VaultChatHook extends AbstractVaultChat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupsSuffix(String world, String name) {
|
||||
public String getGroupChatSuffix(String world, String name) {
|
||||
Objects.requireNonNull(name, "name");
|
||||
Group group = getGroup(name);
|
||||
if (group == null) {
|
||||
@ -196,7 +208,7 @@ public class VaultChatHook extends AbstractVaultChat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupsPrefix(String world, String name, String prefix) {
|
||||
public void setGroupChatPrefix(String world, String name, String prefix) {
|
||||
Objects.requireNonNull(name, "name");
|
||||
Group group = getGroup(name);
|
||||
if (group == null) {
|
||||
@ -206,7 +218,7 @@ public class VaultChatHook extends AbstractVaultChat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupsSuffix(String world, String name, String suffix) {
|
||||
public void setGroupChatSuffix(String world, String name, String suffix) {
|
||||
Objects.requireNonNull(name, "name");
|
||||
Group group = getGroup(name);
|
||||
if (group == null) {
|
||||
@ -216,7 +228,7 @@ public class VaultChatHook extends AbstractVaultChat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupInfo(String world, String name, String key) {
|
||||
public String getGroupMeta(String world, String name, String key) {
|
||||
Objects.requireNonNull(name, "name");
|
||||
Objects.requireNonNull(key, "key");
|
||||
Group group = getGroup(name);
|
||||
@ -227,13 +239,13 @@ public class VaultChatHook extends AbstractVaultChat {
|
||||
MetaCache metaData = group.getCachedData().getMetaData(contexts);
|
||||
String ret = metaData.getMeta().get(key);
|
||||
if (log()) {
|
||||
logMsg("#getGroupInfo: %s - %s - %s - %s", group.getName(), contexts.getContexts().toMultimap(), key, ret);
|
||||
logMsg("#getGroupMeta: %s - %s - %s - %s", group.getName(), contexts.getContexts().toMultimap(), key, ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfo(String world, String name, String key, Object value) {
|
||||
public void setGroupMeta(String world, String name, String key, Object value) {
|
||||
Objects.requireNonNull(name, "name");
|
||||
Objects.requireNonNull(key, "key");
|
||||
Group group = getGroup(name);
|
||||
|
@ -116,8 +116,10 @@ public class VaultPermissionHook extends AbstractVaultPermission {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(String world, UUID uuid, String permission) {
|
||||
Objects.requireNonNull(uuid, "uuid");
|
||||
public boolean userHasPermission(String world, UUID uuid, String permission) {
|
||||
if (uuid == null) {
|
||||
return false;
|
||||
}
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
|
||||
User user = getUser(uuid);
|
||||
@ -130,14 +132,16 @@ public class VaultPermissionHook extends AbstractVaultPermission {
|
||||
|
||||
Tristate result = permissionData.getPermissionValue(permission, CheckOrigin.INTERNAL);
|
||||
if (log()) {
|
||||
logMsg("#hasPermission: %s - %s - %s - %s", user.getFriendlyName(), contexts.getContexts().toMultimap(), permission, result);
|
||||
logMsg("#userHasPermission: %s - %s - %s - %s", user.getFriendlyName(), contexts.getContexts().toMultimap(), permission, result);
|
||||
}
|
||||
return result.asBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAddPermission(String world, UUID uuid, String permission) {
|
||||
Objects.requireNonNull(uuid, "uuid");
|
||||
public boolean userAddPermission(String world, UUID uuid, String permission) {
|
||||
if (uuid == null) {
|
||||
return false;
|
||||
}
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
|
||||
User user = getUser(uuid);
|
||||
@ -150,8 +154,10 @@ public class VaultPermissionHook extends AbstractVaultPermission {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemovePermission(String world, UUID uuid, String permission) {
|
||||
Objects.requireNonNull(uuid, "uuid");
|
||||
public boolean userRemovePermission(String world, UUID uuid, String permission) {
|
||||
if (uuid == null) {
|
||||
return false;
|
||||
}
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
|
||||
User user = getUser(uuid);
|
||||
@ -164,29 +170,37 @@ public class VaultPermissionHook extends AbstractVaultPermission {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerInGroup(String world, UUID uuid, String group) {
|
||||
Objects.requireNonNull(uuid, "uuid");
|
||||
public boolean userInGroup(String world, UUID uuid, String group) {
|
||||
if (uuid == null) {
|
||||
return false;
|
||||
}
|
||||
Objects.requireNonNull(group, "group");
|
||||
return hasPermission(world, uuid, NodeFactory.groupNode(rewriteGroupName(group)));
|
||||
return userHasPermission(world, uuid, NodeFactory.groupNode(rewriteGroupName(group)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAddGroup(String world, UUID uuid, String group) {
|
||||
Objects.requireNonNull(uuid, "uuid");
|
||||
public boolean userAddGroup(String world, UUID uuid, String group) {
|
||||
if (uuid == null) {
|
||||
return false;
|
||||
}
|
||||
Objects.requireNonNull(group, "group");
|
||||
return checkGroupExists(group) && playerAddPermission(world, uuid, NodeFactory.groupNode(rewriteGroupName(group)));
|
||||
return checkGroupExists(group) && userAddPermission(world, uuid, NodeFactory.groupNode(rewriteGroupName(group)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemoveGroup(String world, UUID uuid, String group) {
|
||||
Objects.requireNonNull(uuid, "uuid");
|
||||
public boolean userRemoveGroup(String world, UUID uuid, String group) {
|
||||
if (uuid == null) {
|
||||
return false;
|
||||
}
|
||||
Objects.requireNonNull(group, "group");
|
||||
return checkGroupExists(group) && playerRemovePermission(world, uuid, NodeFactory.groupNode(rewriteGroupName(group)));
|
||||
return checkGroupExists(group) && userRemovePermission(world, uuid, NodeFactory.groupNode(rewriteGroupName(group)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] playerGetGroups(String world, UUID uuid) {
|
||||
Objects.requireNonNull(uuid, "uuid");
|
||||
public String[] userGetGroups(String world, UUID uuid) {
|
||||
if (uuid == null) {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
User user = getUser(uuid);
|
||||
if (user == null) {
|
||||
@ -208,15 +222,17 @@ public class VaultPermissionHook extends AbstractVaultPermission {
|
||||
.toArray(String[]::new);
|
||||
|
||||
if (log()) {
|
||||
logMsg("#playerGetGroups: %s - %s - %s", user.getFriendlyName(), contexts, Arrays.toString(ret));
|
||||
logMsg("#userGetGroups: %s - %s - %s", user.getFriendlyName(), contexts, Arrays.toString(ret));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String playerPrimaryGroup(String world, UUID uuid) {
|
||||
Objects.requireNonNull(uuid, "uuid");
|
||||
public String userGetPrimaryGroup(String world, UUID uuid) {
|
||||
if (uuid == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
User user = getUser(uuid);
|
||||
if (user == null) {
|
||||
@ -230,7 +246,7 @@ public class VaultPermissionHook extends AbstractVaultPermission {
|
||||
}
|
||||
|
||||
if (log()) {
|
||||
logMsg("#playerPrimaryGroup: %s - %s - %s", user.getFriendlyName(), world, value);
|
||||
logMsg("#userGetPrimaryGroup: %s - %s - %s", user.getFriendlyName(), world, value);
|
||||
}
|
||||
|
||||
return value;
|
||||
|
Loading…
Reference in New Issue
Block a user