mirror of
https://github.com/MilkBowl/Vault.git
synced 2024-11-14 14:45:37 +01:00
Merge pull request #610 from OverCaste/master
Updated OverPermissions support to v2.0.0
This commit is contained in:
commit
603ce07f05
@ -108,6 +108,7 @@ Github and we'll get to it at our convenience.
|
||||
- bPermissions 2 (http://dev.bukkit.org/server-mods/bpermissions/)
|
||||
- DroxPerms
|
||||
- Group Manager (Essentials) (http://forums.bukkit.org/threads/15312/)
|
||||
- OverPermissions (http://dev.bukkit.org/bukkit-plugins/overpermissions/)
|
||||
- Permissions 3 (http://forums.bukkit.org/threads/18430/)
|
||||
- PermissionsBukkit
|
||||
- Permissions Ex (http://forums.bukkit.org/threads/18140/)
|
||||
@ -125,6 +126,7 @@ Github and we'll get to it at our convenience.
|
||||
- iChat
|
||||
- mChat
|
||||
- mChatSuite
|
||||
- OverPermissions
|
||||
- Permissions3
|
||||
- PEX
|
||||
- rscPermissions
|
||||
|
Binary file not shown.
BIN
lib/overpermissions-2.0.0.jar
Normal file
BIN
lib/overpermissions-2.0.0.jar
Normal file
Binary file not shown.
6
pom.xml
6
pom.xml
@ -17,7 +17,7 @@
|
||||
<url>http://dev.bukkit.org/server-mods/vault/</url>
|
||||
<description>Vault is a Permissions & Economy API to allow plugins to more easily hook into these systems without needing to hook each individual system themselves.
|
||||
|
||||
Vault currently supports the following: Permissions 3, PEX, GroupManager, bPerms, bPerms2, SimplyPerms, DroxPerms, zPermissions, rscPermissions, KPerms, Starburst, iConomy (4/5/6) BOSEconomy *6/7), EssentialsEcon, 3Co, MultiConomy, MineConomy, EconXP, eWallet, CurrencyCore, XPBank, CraftConomy, AEco, SDFEconomy, TAEcon</description>
|
||||
Vault currently supports the following: Permissions 3, PEX, GroupManager, bPerms, bPerms2, SimplyPerms, DroxPerms, zPermissions, rscPermissions, KPerms, Starburst, iConomy (4/5/6) BOSEconomy *6/7), EssentialsEcon, 3Co, MultiConomy, MineConomy, EconXP, eWallet, CurrencyCore, XPBank, CraftConomy, AEco, SDFEconomy, TAEcon, and OverPermissions</description>
|
||||
|
||||
|
||||
|
||||
@ -407,10 +407,10 @@ Vault currently supports the following: Permissions 3, PEX, GroupManager, bPerms
|
||||
<dependency>
|
||||
<groupId>com.overmc</groupId>
|
||||
<artifactId>overpermissions</artifactId>
|
||||
<version>1.0.5</version>
|
||||
<version>2.0.0</version>
|
||||
<optional>true</optional>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/overpermissions-1.0.5.jar</systemPath>
|
||||
<systemPath>${project.basedir}/lib/overpermissions-2.0.0.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@ -208,7 +208,7 @@ public class Vault extends JavaPlugin {
|
||||
hookChat("mChat", Chat_mChat.class, ServicePriority.Highest, "net.D3GN.MiracleM4n.mChat");
|
||||
|
||||
// Try to load OverPermissions
|
||||
hookChat("OverPermissions", Chat_OverPermissions.class, ServicePriority.Highest, "com.overmc.overpermissions.OverPermissions");
|
||||
hookChat("OverPermissions", Chat_OverPermissions.class, ServicePriority.Highest, "com.overmc.overpermissions.internal.OverPermissions");
|
||||
|
||||
// Try to load DroxPerms Chat
|
||||
hookChat("DroxPerms", Chat_DroxPerms.class, ServicePriority.Lowest, "de.hydrox.bukkit.DroxPerms.DroxPerms");
|
||||
@ -317,7 +317,7 @@ public class Vault extends JavaPlugin {
|
||||
hookPermission("PermissionsEx", Permission_PermissionsEx.class, ServicePriority.Highest, "ru.tehkode.permissions.bukkit.PermissionsEx");
|
||||
|
||||
// Try to load OverPermissions
|
||||
hookPermission("OverPermissions", Permission_OverPermissions.class, ServicePriority.Highest, "com.overmc.overpermissions.OverPermissions");
|
||||
hookPermission("OverPermissions", Permission_OverPermissions.class, ServicePriority.Highest, "com.overmc.overpermissions.internal.OverPermissions");
|
||||
|
||||
// Try to load PermissionsBukkit
|
||||
hookPermission("PermissionsBukkit", Permission_PermissionsBukkit.class, ServicePriority.Normal, "com.platymuus.bukkit.permissions.PermissionsPlugin");
|
||||
|
@ -1,25 +1,20 @@
|
||||
/* This file is part of Vault.
|
||||
|
||||
Vault is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Vault is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with Vault. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
*/
|
||||
package net.milkbowl.vault.chat.plugins;
|
||||
|
||||
import net.milkbowl.vault.chat.Chat;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -27,17 +22,17 @@ import org.bukkit.event.server.PluginDisableEvent;
|
||||
import org.bukkit.event.server.PluginEnableEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.overmc.overpermissions.Group;
|
||||
import com.overmc.overpermissions.OverPermissions;
|
||||
import com.overmc.overpermissions.OverPermissionsAPI;
|
||||
|
||||
import com.overmc.overpermissions.api.GroupManager;
|
||||
import com.overmc.overpermissions.api.PermissionGroup;
|
||||
import com.overmc.overpermissions.api.PermissionUser;
|
||||
import com.overmc.overpermissions.api.UserManager;
|
||||
import com.overmc.overpermissions.internal.OverPermissions;
|
||||
|
||||
public class Chat_OverPermissions extends Chat {
|
||||
|
||||
private static final String name = "OverPermissions_Chat";
|
||||
private Plugin plugin;
|
||||
protected final Plugin plugin;
|
||||
private OverPermissions overPerms;
|
||||
private OverPermissionsAPI api;
|
||||
private UserManager userManager;
|
||||
private GroupManager groupManager;
|
||||
|
||||
public Chat_OverPermissions(Plugin plugin, Permission perms) {
|
||||
super(perms);
|
||||
@ -49,21 +44,20 @@ public class Chat_OverPermissions extends Chat {
|
||||
Plugin p = plugin.getServer().getPluginManager().getPlugin("OverPermissions");
|
||||
if (p != null) {
|
||||
overPerms = (OverPermissions) p;
|
||||
userManager = overPerms.getUserManager();
|
||||
groupManager = overPerms.getGroupManager();
|
||||
plugin.getLogger().info(String.format("[%s][Chat] %s hooked.", new Object[] {plugin.getDescription().getName(), "OverPermissions"}));
|
||||
}
|
||||
}
|
||||
if ((api == null) && (overPerms != null)) {
|
||||
api = overPerms.getAPI();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
public String getName( ) {
|
||||
return "OverPermissions_Chat";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
public boolean isEnabled( ) {
|
||||
return overPerms != null;
|
||||
}
|
||||
|
||||
@ -113,7 +107,8 @@ public class Chat_OverPermissions extends Chat {
|
||||
if (s == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
try {
|
||||
try
|
||||
{
|
||||
return Integer.valueOf(s).intValue();
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
@ -131,7 +126,8 @@ public class Chat_OverPermissions extends Chat {
|
||||
if (s == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
try {
|
||||
try
|
||||
{
|
||||
return Integer.valueOf(s).intValue();
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
@ -149,7 +145,8 @@ public class Chat_OverPermissions extends Chat {
|
||||
if (s == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
try {
|
||||
try
|
||||
{
|
||||
return Double.valueOf(s).doubleValue();
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
@ -167,7 +164,8 @@ public class Chat_OverPermissions extends Chat {
|
||||
if (s == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
try {
|
||||
try
|
||||
{
|
||||
return Double.valueOf(s).doubleValue();
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
@ -200,7 +198,8 @@ public class Chat_OverPermissions extends Chat {
|
||||
if (s == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
return Boolean.valueOf(s);
|
||||
Boolean val = Boolean.valueOf(s);
|
||||
return val != null ? val.booleanValue() : defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -210,57 +209,82 @@ public class Chat_OverPermissions extends Chat {
|
||||
|
||||
@Override
|
||||
public String getPlayerInfoString(String world, String playerName, String node, String defaultValue) {
|
||||
Player p = Bukkit.getPlayerExact(playerName);
|
||||
String ret = null;
|
||||
if (p != null) {
|
||||
ret = overPerms.getPlayerPermissions(p).getStringMeta(node, defaultValue);
|
||||
} else {
|
||||
int playerId = overPerms.getSQLManager().getPlayerId(playerName);
|
||||
int worldId = overPerms.getSQLManager().getWorldId(world);
|
||||
ret = overPerms.getSQLManager().getPlayerMetaValue(playerId, worldId, node);
|
||||
}
|
||||
if (ret == null) {
|
||||
if (!userManager.doesUserExist(playerName)) {
|
||||
return defaultValue;
|
||||
}
|
||||
return ret;
|
||||
PermissionUser user = userManager.getPermissionUser(playerName);
|
||||
if (world == null) { // Retrieve meta from the global store.
|
||||
if (!user.hasGlobalMeta(node)) {
|
||||
return defaultValue;
|
||||
}
|
||||
return user.getGlobalMeta(node);
|
||||
} else {
|
||||
if (!user.hasMeta(node, world)) {
|
||||
return defaultValue;
|
||||
}
|
||||
return user.getMeta(node, world);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoString(String world, String player, String node, String value) {
|
||||
Player p = Bukkit.getPlayerExact(player);
|
||||
int playerId = overPerms.getSQLManager().getPlayerId(player, true);
|
||||
int worldId = overPerms.getSQLManager().getWorldId(player, false);
|
||||
if (worldId < 0) {
|
||||
overPerms.getSQLManager().setGlobalPlayerMeta(playerId, node, value);
|
||||
} else {
|
||||
overPerms.getSQLManager().setPlayerMeta(playerId, worldId, node, value);
|
||||
public void setPlayerInfoString(String world, String playerName, String node, String value) {
|
||||
if (!userManager.canUserExist(playerName)) {
|
||||
return;
|
||||
}
|
||||
if (p != null) {
|
||||
overPerms.getPlayerPermissions(p).recalculateMeta();
|
||||
PermissionUser user = userManager.getPermissionUser(playerName);
|
||||
if (world != null) {
|
||||
if (value == null) {
|
||||
user.removeMeta(node, world);
|
||||
} else {
|
||||
user.setMeta(node, value, world);
|
||||
}
|
||||
} else {
|
||||
if (value == null) {
|
||||
user.removeGlobalMeta(node);
|
||||
} else {
|
||||
user.setGlobalMeta(node, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupInfoString(String world, String groupName, String node, String defaultValue) {
|
||||
Group group = overPerms.getGroupManager().getGroup(groupName);
|
||||
if (group == null) {
|
||||
if (!groupManager.doesGroupExist(groupName)) {
|
||||
return defaultValue;
|
||||
}
|
||||
String value = group.getMeta(node);
|
||||
if (value == null) {
|
||||
return defaultValue;
|
||||
PermissionGroup group = overPerms.getGroupManager().getGroup(groupName);
|
||||
if (world == null) { // Retrieve from the global store.
|
||||
if (!group.hasGlobalMeta(node)) {
|
||||
return defaultValue;
|
||||
}
|
||||
return group.getGlobalMeta(node);
|
||||
} else {
|
||||
if (!group.hasMeta(node, world)) {
|
||||
return defaultValue;
|
||||
}
|
||||
return group.getMeta(node, world);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoString(String world, String groupName, String node, String value) {
|
||||
Group group = overPerms.getGroupManager().getGroup(groupName);
|
||||
if (group == null) {
|
||||
if (!overPerms.getGroupManager().doesGroupExist(groupName)) {
|
||||
return;
|
||||
}
|
||||
group.setMeta(node, value);
|
||||
group.recalculatePermissions();
|
||||
PermissionGroup group = overPerms.getGroupManager().getGroup(groupName);
|
||||
if (world != null) {
|
||||
if (value == null) {
|
||||
group.removeMeta(node, world);
|
||||
} else {
|
||||
group.setMeta(node, value, world);
|
||||
}
|
||||
} else {
|
||||
if (value == null) {
|
||||
group.removeGlobalMeta(node);
|
||||
} else {
|
||||
group.setGlobalMeta(node, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class PermissionServerListener implements Listener {
|
||||
@ -276,7 +300,7 @@ public class Chat_OverPermissions extends Chat {
|
||||
Plugin chat = plugin.getServer().getPluginManager().getPlugin("OverPermissions");
|
||||
if (chat != null) {
|
||||
this.chat.overPerms = (OverPermissions) chat;
|
||||
plugin.getLogger().info(String.format("[%s][Chat] %s hooked.", plugin.getDescription().getName(), getName()));
|
||||
plugin.getLogger().info(String.format("[%s][Chat] %s hooked.", new Object[] {plugin.getDescription().getName(), getName()}));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -286,7 +310,7 @@ public class Chat_OverPermissions extends Chat {
|
||||
if ((chat.overPerms != null) &&
|
||||
(event.getPlugin().getDescription().getName().equals("OverPermissions"))) {
|
||||
chat.overPerms = null;
|
||||
plugin.getLogger().info(String.format("[%s][Chat] %s un-hooked.", plugin.getDescription().getName(), getName()));
|
||||
plugin.getLogger().info(String.format("[%s][Chat] %s un-hooked.", new Object[] {plugin.getDescription().getName(), getName()}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,19 @@
|
||||
/* This file is part of Vault.
|
||||
|
||||
Vault is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Vault is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with Vault. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package net.milkbowl.vault.permission.plugins;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -25,90 +24,142 @@ import org.bukkit.event.server.PluginDisableEvent;
|
||||
import org.bukkit.event.server.PluginEnableEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.overmc.overpermissions.OverPermissions;
|
||||
import com.overmc.overpermissions.OverPermissionsAPI;
|
||||
import com.overmc.overpermissions.api.GroupManager;
|
||||
import com.overmc.overpermissions.api.PermissionGroup;
|
||||
import com.overmc.overpermissions.api.PermissionUser;
|
||||
import com.overmc.overpermissions.api.UserManager;
|
||||
import com.overmc.overpermissions.internal.OverPermissions;
|
||||
|
||||
public class Permission_OverPermissions extends Permission {
|
||||
|
||||
private final String name = "OverPermissions";
|
||||
private OverPermissions overPerms;
|
||||
private OverPermissionsAPI api;
|
||||
private UserManager userManager;
|
||||
private GroupManager groupManager;
|
||||
|
||||
public Permission_OverPermissions(Plugin plugin) {
|
||||
this.plugin = plugin;
|
||||
super.plugin = plugin;
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(this), plugin);
|
||||
|
||||
if (overPerms == null) {
|
||||
Plugin perms = plugin.getServer().getPluginManager().getPlugin("OverPermissions");
|
||||
if ((perms != null) && (perms.isEnabled())) {
|
||||
overPerms = ((OverPermissions) perms);
|
||||
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), "OverPermissions"));
|
||||
userManager = overPerms.getUserManager();
|
||||
groupManager = overPerms.getGroupManager();
|
||||
log.info(String.format("[%s][Permission] %s hooked.", new Object[] {plugin.getDescription().getName(), "OverPermissions"}));
|
||||
}
|
||||
}
|
||||
|
||||
if ((api == null) && (overPerms != null)) {
|
||||
api = overPerms.getAPI();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
public String getName( ) {
|
||||
return "OverPermissions";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
public boolean isEnabled( ) {
|
||||
return (overPerms != null) && (overPerms.isEnabled());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerHas(String worldName, String playerName, String permission) {
|
||||
return api.playerHas(worldName, playerName, permission);
|
||||
if (!userManager.doesUserExist(playerName)) {
|
||||
return false;
|
||||
}
|
||||
return userManager.getPermissionUser(playerName).getPermission(permission, worldName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAdd(String worldName, String playerName, String permission) {
|
||||
return api.playerAdd(worldName, playerName, permission);
|
||||
if (!userManager.canUserExist(playerName)) {
|
||||
return false;
|
||||
}
|
||||
return userManager.getPermissionUser(playerName).addPermissionNode(permission, worldName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemove(String worldName, String playerName, String permission) {
|
||||
return api.playerRemove(worldName, playerName, permission);
|
||||
if (!userManager.canUserExist(playerName)) {
|
||||
return false;
|
||||
}
|
||||
return userManager.getPermissionUser(playerName).removePermissionNode(permission, worldName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupHas(String worldName, String groupName, String permission) {
|
||||
return api.groupHas(groupName, permission);
|
||||
if (!groupManager.doesGroupExist(groupName)) {
|
||||
return false;
|
||||
}
|
||||
return groupManager.getGroup(groupName).getPermission(permission, worldName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupAdd(String worldName, String groupName, String permission) {
|
||||
return api.groupAdd(groupName, permission);
|
||||
if (!groupManager.doesGroupExist(groupName)) {
|
||||
return false;
|
||||
}
|
||||
if (worldName == null) {
|
||||
return groupManager.getGroup(groupName).addGlobalPermissionNode(permission);
|
||||
} else {
|
||||
return groupManager.getGroup(groupName).addPermissionNode(permission, worldName);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupRemove(String worldName, String groupName, String permission) {
|
||||
return api.groupRemove(groupName, permission);
|
||||
if (!groupManager.doesGroupExist(groupName)) {
|
||||
return false;
|
||||
}
|
||||
if (worldName == null) {
|
||||
return groupManager.getGroup(groupName).removeGlobalPermissionNode(permission);
|
||||
} else {
|
||||
return groupManager.getGroup(groupName).removePermissionNode(permission, worldName);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerInGroup(String worldName, String playerName, String groupName) {
|
||||
return api.groupHasPlayer(playerName, groupName);
|
||||
if (!groupManager.doesGroupExist(groupName)) {
|
||||
return false;
|
||||
}
|
||||
if (!userManager.doesUserExist(playerName)) {
|
||||
return false;
|
||||
}
|
||||
return userManager.getPermissionUser(playerName).getAllParents().contains(groupManager.getGroup(groupName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAddGroup(String worldName, String playerName, String groupName) {
|
||||
return api.playerAddGroup(playerName, groupName);
|
||||
if (!groupManager.doesGroupExist(groupName)) {
|
||||
return false;
|
||||
}
|
||||
if (!userManager.canUserExist(playerName)) {
|
||||
return false;
|
||||
}
|
||||
return userManager.getPermissionUser(playerName).addParent(groupManager.getGroup(groupName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemoveGroup(String worldName, String playerName, String groupName) {
|
||||
return api.playerRemoveGroup(playerName, groupName);
|
||||
if (!groupManager.doesGroupExist(groupName)) {
|
||||
return false;
|
||||
}
|
||||
if (!userManager.canUserExist(playerName)) {
|
||||
return false;
|
||||
}
|
||||
return userManager.getPermissionUser(playerName).removeParent(groupManager.getGroup(groupName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPlayerGroups(String worldName, String playerName) {
|
||||
return api.getPlayerGroups(worldName, playerName);
|
||||
ArrayList<String> ret = new ArrayList<String>();
|
||||
if (!userManager.doesUserExist(playerName)) {
|
||||
return new String[0];
|
||||
}
|
||||
PermissionUser user = userManager.getPermissionUser(playerName);
|
||||
for (PermissionGroup parent : user.getAllParents()) {
|
||||
ret.add(parent.getName());
|
||||
}
|
||||
return ret.toArray(new String[ret.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -121,31 +172,44 @@ public class Permission_OverPermissions extends Permission {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAddTransient(String world, String player, String permission) {
|
||||
return api.playerAddTransient(world, player, permission);
|
||||
public boolean playerAddTransient(String world, String playerName, String permission) {
|
||||
if (!userManager.doesUserExist(playerName)) { // Can't add transient permissions to an offline player.
|
||||
return false;
|
||||
}
|
||||
PermissionUser user = userManager.getPermissionUser(playerName);
|
||||
return (world == null) ? user.addGlobalTransientPermissionNode(permission) : user.addTransientPermissionNode(permission, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemoveTransient(String world, String player, String permission) {
|
||||
return api.playerRemoveTransient(world, player, permission);
|
||||
public boolean playerRemoveTransient(String world, String playerName, String permission) {
|
||||
if (!userManager.doesUserExist(playerName)) {
|
||||
return false;
|
||||
}
|
||||
PermissionUser user = userManager.getPermissionUser(playerName);
|
||||
return (world == null) ? user.removeGlobalTransientPermissionNode(permission) : user.removeTransientPermissionNode(permission, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getGroups() {
|
||||
return api.getGroupsArray();
|
||||
public String[] getGroups( ) {
|
||||
ArrayList<String> groupNames = new ArrayList<String>();
|
||||
for (PermissionGroup s : groupManager.getGroups()) {
|
||||
groupNames.add(s.getName());
|
||||
}
|
||||
return groupNames.toArray(new String[groupNames.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSuperPermsCompat() {
|
||||
public boolean hasSuperPermsCompat( ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGroupSupport() {
|
||||
public boolean hasGroupSupport( ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public class PermissionServerListener implements Listener {
|
||||
public class PermissionServerListener
|
||||
implements Listener {
|
||||
Permission_OverPermissions permission = null;
|
||||
|
||||
public PermissionServerListener(Permission_OverPermissions permission) {
|
||||
@ -158,18 +222,21 @@ public class Permission_OverPermissions extends Permission {
|
||||
Plugin perms = Permission_OverPermissions.this.plugin.getServer().getPluginManager().getPlugin("OverPermissions");
|
||||
if (perms != null) {
|
||||
permission.overPerms = ((OverPermissions) perms);
|
||||
Permission_OverPermissions.log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), "OverPermissions"));
|
||||
Permission_OverPermissions.log.info(String
|
||||
.format("[%s][Permission] %s hooked.", new Object[] {Permission_OverPermissions.this.plugin.getDescription().getName(), "OverPermissions"}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPluginDisable(PluginDisableEvent event) {
|
||||
public void onPluginDisable(PluginDisableEvent event)
|
||||
{
|
||||
if ((permission.overPerms != null) &&
|
||||
(event.getPlugin().getDescription().getName().equals("OverPermissions"))) {
|
||||
permission.overPerms = null;
|
||||
Permission_OverPermissions.log.info(String.format("[%s][Permission] %s un-hooked.", plugin.getDescription().getName(), "OverPermissions"));
|
||||
Permission_OverPermissions.log.info(String
|
||||
.format("[%s][Permission] %s un-hooked.", new Object[] {Permission_OverPermissions.this.plugin.getDescription().getName(), "OverPermissions"}));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user