mirror of https://github.com/MilkBowl/Vault.git
remove deprecated method calls from older permission systems.
This commit is contained in:
parent
94d0a45218
commit
e05bdf17da
|
@ -1,403 +1,363 @@
|
||||||
/* This file is part of Vault.
|
/* This file is part of Vault.
|
||||||
|
|
||||||
Vault is free software: you can redistribute it and/or modify
|
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
|
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
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Vault is distributed in the hope that it will be useful,
|
Vault is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with Vault. If not, see <http://www.gnu.org/licenses/>.
|
along with Vault. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package net.milkbowl.vault.permission.plugins;
|
package net.milkbowl.vault.permission.plugins;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import net.milkbowl.vault.permission.Permission;
|
import net.milkbowl.vault.permission.Permission;
|
||||||
|
|
||||||
import org.anjocaido.groupmanager.GroupManager;
|
import org.anjocaido.groupmanager.GroupManager;
|
||||||
import org.anjocaido.groupmanager.data.Group;
|
import org.anjocaido.groupmanager.data.Group;
|
||||||
import org.anjocaido.groupmanager.data.User;
|
import org.anjocaido.groupmanager.data.User;
|
||||||
import org.anjocaido.groupmanager.dataholder.OverloadedWorldHolder;
|
import org.anjocaido.groupmanager.dataholder.OverloadedWorldHolder;
|
||||||
import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler;
|
import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.server.PluginDisableEvent;
|
import org.bukkit.event.server.PluginDisableEvent;
|
||||||
import org.bukkit.event.server.PluginEnableEvent;
|
import org.bukkit.event.server.PluginEnableEvent;
|
||||||
import org.bukkit.permissions.PermissionAttachment;
|
import org.bukkit.permissions.PermissionAttachment;
|
||||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
public class Permission_GroupManager extends Permission {
|
public class Permission_GroupManager extends Permission {
|
||||||
|
|
||||||
private final String name = "GroupManager";
|
private final String name = "GroupManager";
|
||||||
private GroupManager groupManager;
|
private GroupManager groupManager;
|
||||||
|
|
||||||
public Permission_GroupManager(Plugin plugin) {
|
public Permission_GroupManager(Plugin plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(this), plugin);
|
Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(this), plugin);
|
||||||
|
|
||||||
// Load Plugin in case it was loaded before
|
// Load Plugin in case it was loaded before
|
||||||
if (groupManager == null) {
|
if (groupManager == null) {
|
||||||
Plugin perms = plugin.getServer().getPluginManager().getPlugin("GroupManager");
|
Plugin perms = plugin.getServer().getPluginManager().getPlugin("GroupManager");
|
||||||
if (perms != null && perms.isEnabled()) {
|
if (perms != null && perms.isEnabled()) {
|
||||||
groupManager = (GroupManager) perms;
|
groupManager = (GroupManager) perms;
|
||||||
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name));
|
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PermissionServerListener implements Listener {
|
public class PermissionServerListener implements Listener {
|
||||||
Permission_GroupManager permission = null;
|
Permission_GroupManager permission = null;
|
||||||
|
|
||||||
public PermissionServerListener(Permission_GroupManager permission) {
|
public PermissionServerListener(Permission_GroupManager permission) {
|
||||||
this.permission = permission;
|
this.permission = permission;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPluginEnable(PluginEnableEvent event) {
|
public void onPluginEnable(PluginEnableEvent event) {
|
||||||
if (permission.groupManager == null) {
|
if (permission.groupManager == null) {
|
||||||
Plugin p = event.getPlugin();
|
Plugin p = event.getPlugin();
|
||||||
if (p.getDescription().getName().equals("GroupManager")) {
|
if (p.getDescription().getName().equals("GroupManager")) {
|
||||||
permission.groupManager = (GroupManager) p;
|
permission.groupManager = (GroupManager) p;
|
||||||
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), permission.name));
|
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), permission.name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPluginDisable(PluginDisableEvent event) {
|
public void onPluginDisable(PluginDisableEvent event) {
|
||||||
if (permission.groupManager != null) {
|
if (permission.groupManager != null) {
|
||||||
if (event.getPlugin().getDescription().getName().equals("GroupManager")) {
|
if (event.getPlugin().getDescription().getName().equals("GroupManager")) {
|
||||||
permission.groupManager = null;
|
permission.groupManager = null;
|
||||||
log.info(String.format("[%s][Permission] %s un-hooked.", plugin.getDescription().getName(), permission.name));
|
log.info(String.format("[%s][Permission] %s un-hooked.", plugin.getDescription().getName(), permission.name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
return groupManager != null && groupManager.isEnabled();
|
return groupManager != null && groupManager.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerHas(String worldName, String playerName, String permission) {
|
public boolean playerHas(String worldName, String playerName, String permission) {
|
||||||
AnjoPermissionsHandler handler;
|
AnjoPermissionsHandler handler;
|
||||||
if (worldName == null) {
|
if (worldName == null) {
|
||||||
handler = groupManager.getWorldsHolder().getWorldPermissionsByPlayerName(playerName);
|
handler = groupManager.getWorldsHolder().getWorldPermissionsByPlayerName(playerName);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
handler = groupManager.getWorldsHolder().getWorldPermissions(worldName);
|
handler = groupManager.getWorldsHolder().getWorldPermissions(worldName);
|
||||||
}
|
}
|
||||||
if (handler == null) {
|
if (handler == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return handler.permission(playerName, permission);
|
return handler.permission(playerName, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerAdd(String worldName, String playerName, String permission) {
|
public boolean playerAdd(String worldName, String playerName, String permission) {
|
||||||
OverloadedWorldHolder owh;
|
OverloadedWorldHolder owh;
|
||||||
if (worldName == null) {
|
if (worldName == null) {
|
||||||
owh = groupManager.getWorldsHolder().getWorldDataByPlayerName(playerName);
|
owh = groupManager.getWorldsHolder().getWorldDataByPlayerName(playerName);
|
||||||
} else {
|
} else {
|
||||||
owh = groupManager.getWorldsHolder().getWorldData(worldName);
|
owh = groupManager.getWorldsHolder().getWorldData(worldName);
|
||||||
}
|
}
|
||||||
if (owh == null) {
|
if (owh == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
User user = owh.getUser(playerName);
|
User user = owh.getUser(playerName);
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
user.addPermission(permission);
|
user.addPermission(permission);
|
||||||
Player p = Bukkit.getPlayer(playerName);
|
Player p = Bukkit.getPlayer(playerName);
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
GroupManager.BukkitPermissions.updatePermissions(p);
|
GroupManager.BukkitPermissions.updatePermissions(p);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerRemove(String worldName, String playerName, String permission) {
|
public boolean playerRemove(String worldName, String playerName, String permission) {
|
||||||
OverloadedWorldHolder owh;
|
OverloadedWorldHolder owh;
|
||||||
if (worldName == null) {
|
if (worldName == null) {
|
||||||
owh = groupManager.getWorldsHolder().getWorldDataByPlayerName(playerName);
|
owh = groupManager.getWorldsHolder().getWorldDataByPlayerName(playerName);
|
||||||
} else {
|
} else {
|
||||||
owh = groupManager.getWorldsHolder().getWorldData(worldName);
|
owh = groupManager.getWorldsHolder().getWorldData(worldName);
|
||||||
}
|
}
|
||||||
if (owh == null) {
|
if (owh == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
User user = owh.getUser(playerName);
|
User user = owh.getUser(playerName);
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
user.removePermission(permission);
|
user.removePermission(permission);
|
||||||
Player p = Bukkit.getPlayer(playerName);
|
Player p = Bukkit.getPlayer(playerName);
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
GroupManager.BukkitPermissions.updatePermissions(p);
|
GroupManager.BukkitPermissions.updatePermissions(p);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean groupHas(String worldName, String groupName, String permission) {
|
public boolean groupHas(String worldName, String groupName, String permission) {
|
||||||
OverloadedWorldHolder owh;
|
OverloadedWorldHolder owh;
|
||||||
if (worldName == null) {
|
if (worldName == null) {
|
||||||
owh = groupManager.getWorldsHolder().getDefaultWorld();
|
owh = groupManager.getWorldsHolder().getDefaultWorld();
|
||||||
} else {
|
} else {
|
||||||
owh = groupManager.getWorldsHolder().getWorldData(worldName);
|
owh = groupManager.getWorldsHolder().getWorldData(worldName);
|
||||||
}
|
}
|
||||||
if (owh == null) {
|
if (owh == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Group group = owh.getGroup(groupName);
|
Group group = owh.getGroup(groupName);
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return group.hasSamePermissionNode(permission);
|
return group.hasSamePermissionNode(permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean groupAdd(String worldName, String groupName, String permission) {
|
public boolean groupAdd(String worldName, String groupName, String permission) {
|
||||||
OverloadedWorldHolder owh;
|
OverloadedWorldHolder owh;
|
||||||
if (worldName == null) {
|
if (worldName == null) {
|
||||||
owh = groupManager.getWorldsHolder().getDefaultWorld();
|
owh = groupManager.getWorldsHolder().getDefaultWorld();
|
||||||
} else {
|
} else {
|
||||||
owh = groupManager.getWorldsHolder().getWorldData(worldName);
|
owh = groupManager.getWorldsHolder().getWorldData(worldName);
|
||||||
}
|
}
|
||||||
if (owh == null) {
|
if (owh == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Group group = owh.getGroup(groupName);
|
Group group = owh.getGroup(groupName);
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
group.addPermission(permission);
|
group.addPermission(permission);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean groupRemove(String worldName, String groupName, String permission) {
|
public boolean groupRemove(String worldName, String groupName, String permission) {
|
||||||
OverloadedWorldHolder owh;
|
OverloadedWorldHolder owh;
|
||||||
if (worldName == null) {
|
if (worldName == null) {
|
||||||
owh = groupManager.getWorldsHolder().getDefaultWorld();
|
owh = groupManager.getWorldsHolder().getDefaultWorld();
|
||||||
} else {
|
} else {
|
||||||
owh = groupManager.getWorldsHolder().getWorldData(worldName);
|
owh = groupManager.getWorldsHolder().getWorldData(worldName);
|
||||||
}
|
}
|
||||||
if (owh == null) {
|
if (owh == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Group group = owh.getGroup(groupName);
|
Group group = owh.getGroup(groupName);
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
group.removePermission(permission);
|
group.removePermission(permission);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerInGroup(String worldName, String playerName, String groupName) {
|
public boolean playerInGroup(String worldName, String playerName, String groupName) {
|
||||||
AnjoPermissionsHandler handler;
|
AnjoPermissionsHandler handler;
|
||||||
if (worldName == null) {
|
if (worldName == null) {
|
||||||
handler = groupManager.getWorldsHolder().getWorldPermissionsByPlayerName(playerName);
|
handler = groupManager.getWorldsHolder().getWorldPermissionsByPlayerName(playerName);
|
||||||
} else {
|
} else {
|
||||||
handler = groupManager.getWorldsHolder().getWorldPermissions(worldName);
|
handler = groupManager.getWorldsHolder().getWorldPermissions(worldName);
|
||||||
}
|
}
|
||||||
if (handler == null) {
|
if (handler == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return handler.inGroup(playerName, groupName);
|
return handler.inGroup(playerName, groupName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerAddGroup(String worldName, String playerName, String groupName) {
|
public boolean playerAddGroup(String worldName, String playerName, String groupName) {
|
||||||
OverloadedWorldHolder owh;
|
OverloadedWorldHolder owh;
|
||||||
if (worldName == null) {
|
if (worldName == null) {
|
||||||
owh = groupManager.getWorldsHolder().getWorldDataByPlayerName(playerName);
|
owh = groupManager.getWorldsHolder().getWorldDataByPlayerName(playerName);
|
||||||
} else {
|
} else {
|
||||||
owh = groupManager.getWorldsHolder().getWorldData(worldName);
|
owh = groupManager.getWorldsHolder().getWorldData(worldName);
|
||||||
}
|
}
|
||||||
if (owh == null) {
|
if (owh == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
User user = owh.getUser(playerName);
|
User user = owh.getUser(playerName);
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Group group = owh.getGroup(groupName);
|
Group group = owh.getGroup(groupName);
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (user.getGroup().equals(owh.getDefaultGroup())) {
|
if (user.getGroup().equals(owh.getDefaultGroup())) {
|
||||||
user.setGroup(group);
|
user.setGroup(group);
|
||||||
} else if (group.getInherits().contains(user.getGroup().getName().toLowerCase())) {
|
} else if (group.getInherits().contains(user.getGroup().getName().toLowerCase())) {
|
||||||
user.setGroup(group);
|
user.setGroup(group);
|
||||||
} else {
|
} else {
|
||||||
user.addSubGroup(group);
|
user.addSubGroup(group);
|
||||||
}
|
}
|
||||||
Player p = Bukkit.getPlayer(playerName);
|
Player p = Bukkit.getPlayer(playerName);
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
GroupManager.BukkitPermissions.updatePermissions(p);
|
GroupManager.BukkitPermissions.updatePermissions(p);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerRemoveGroup(String worldName, String playerName, String groupName) {
|
public boolean playerRemoveGroup(String worldName, String playerName, String groupName) {
|
||||||
OverloadedWorldHolder owh;
|
OverloadedWorldHolder owh;
|
||||||
if (worldName == null) {
|
if (worldName == null) {
|
||||||
owh = groupManager.getWorldsHolder().getWorldDataByPlayerName(playerName);
|
owh = groupManager.getWorldsHolder().getWorldDataByPlayerName(playerName);
|
||||||
} else {
|
} else {
|
||||||
owh = groupManager.getWorldsHolder().getWorldData(worldName);
|
owh = groupManager.getWorldsHolder().getWorldData(worldName);
|
||||||
}
|
}
|
||||||
if (owh == null) {
|
if (owh == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
User user = owh.getUser(playerName);
|
User user = owh.getUser(playerName);
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
if (user.getGroup().getName().equalsIgnoreCase(groupName)) {
|
if (user.getGroup().getName().equalsIgnoreCase(groupName)) {
|
||||||
user.setGroup(owh.getDefaultGroup());
|
user.setGroup(owh.getDefaultGroup());
|
||||||
success = true;
|
success = true;
|
||||||
} else {
|
} else {
|
||||||
Group group = owh.getGroup(groupName);
|
Group group = owh.getGroup(groupName);
|
||||||
if (group != null) {
|
if (group != null) {
|
||||||
success = user.removeSubGroup(group);
|
success = user.removeSubGroup(group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (success) {
|
if (success) {
|
||||||
Player p = Bukkit.getPlayer(playerName);
|
Player p = Bukkit.getPlayer(playerName);
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
GroupManager.BukkitPermissions.updatePermissions(p);
|
GroupManager.BukkitPermissions.updatePermissions(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getPlayerGroups(String worldName, String playerName) {
|
public String[] getPlayerGroups(String worldName, String playerName) {
|
||||||
AnjoPermissionsHandler handler;
|
AnjoPermissionsHandler handler;
|
||||||
if (worldName == null) {
|
if (worldName == null) {
|
||||||
handler = groupManager.getWorldsHolder().getWorldPermissionsByPlayerName(playerName);
|
handler = groupManager.getWorldsHolder().getWorldPermissionsByPlayerName(playerName);
|
||||||
} else {
|
} else {
|
||||||
handler = groupManager.getWorldsHolder().getWorldPermissions(worldName);
|
handler = groupManager.getWorldsHolder().getWorldPermissions(worldName);
|
||||||
}
|
}
|
||||||
if (handler == null) {
|
if (handler == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return handler.getGroups(playerName);
|
return handler.getGroups(playerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPrimaryGroup(String worldName, String playerName) {
|
public String getPrimaryGroup(String worldName, String playerName) {
|
||||||
AnjoPermissionsHandler handler;
|
AnjoPermissionsHandler handler;
|
||||||
if (worldName == null) {
|
if (worldName == null) {
|
||||||
handler = groupManager.getWorldsHolder().getWorldPermissionsByPlayerName(playerName);
|
handler = groupManager.getWorldsHolder().getWorldPermissionsByPlayerName(playerName);
|
||||||
} else {
|
} else {
|
||||||
handler = groupManager.getWorldsHolder().getWorldPermissions(worldName);
|
handler = groupManager.getWorldsHolder().getWorldPermissions(worldName);
|
||||||
}
|
}
|
||||||
if (handler == null) {
|
if (handler == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return handler.getGroup(playerName);
|
return handler.getGroup(playerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerAddTransient(String world, String player, String permission) {
|
public String[] getGroups() {
|
||||||
if (world != null) {
|
Set<String> groupNames = new HashSet<String>();
|
||||||
throw new UnsupportedOperationException(getName() + " does not support World based transient permissions!");
|
for (World world : Bukkit.getServer().getWorlds()) {
|
||||||
}
|
OverloadedWorldHolder owh = groupManager.getWorldsHolder().getWorldData(world.getName());
|
||||||
Player p = plugin.getServer().getPlayer(player);
|
if (owh == null) {
|
||||||
if (p == null) {
|
continue;
|
||||||
throw new UnsupportedOperationException(getName() + " does not support offline player transient permissions!");
|
}
|
||||||
}
|
Collection<Group> groups = owh.getGroupList();
|
||||||
|
if (groups == null) {
|
||||||
for (PermissionAttachmentInfo paInfo : p.getEffectivePermissions()) {
|
continue;
|
||||||
if (paInfo.getAttachment().getPlugin().equals(plugin)) {
|
}
|
||||||
paInfo.getAttachment().setPermission(permission, true);
|
for (Group group : groups) {
|
||||||
return true;
|
groupNames.add(group.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return groupNames.toArray(new String[0]);
|
||||||
PermissionAttachment attach = p.addAttachment(plugin);
|
}
|
||||||
attach.setPermission(permission, true);
|
|
||||||
|
@Override
|
||||||
return true;
|
public boolean hasSuperPermsCompat() {
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public boolean playerRemoveTransient(String world, String player, String permission) {
|
@Override
|
||||||
if (world != null) {
|
public boolean hasGroupSupport() {
|
||||||
throw new UnsupportedOperationException(getName() + " does not support World based transient permissions!");
|
return true;
|
||||||
}
|
}
|
||||||
Player p = plugin.getServer().getPlayer(player);
|
}
|
||||||
if (p == null) {
|
|
||||||
throw new UnsupportedOperationException(getName() + " does not support offline player transient permissions!");
|
|
||||||
}
|
|
||||||
for (PermissionAttachmentInfo paInfo : p.getEffectivePermissions()) {
|
|
||||||
if (paInfo.getAttachment().getPlugin().equals(plugin)) {
|
|
||||||
return paInfo.getAttachment().getPermissions().remove(permission);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String[] getGroups() {
|
|
||||||
Set<String> groupNames = new HashSet<String>();
|
|
||||||
for (World world : Bukkit.getServer().getWorlds()) {
|
|
||||||
OverloadedWorldHolder owh = groupManager.getWorldsHolder().getWorldData(world.getName());
|
|
||||||
if (owh == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Collection<Group> groups = owh.getGroupList();
|
|
||||||
if (groups == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (Group group : groups) {
|
|
||||||
groupNames.add(group.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return groupNames.toArray(new String[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasSuperPermsCompat() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasGroupSupport() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,242 +1,224 @@
|
||||||
/* This file is part of Vault.
|
/* This file is part of Vault.
|
||||||
Vault is free software: you can redistribute it and/or modify
|
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
|
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
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
Vault is distributed in the hope that it will be useful,
|
Vault is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with Vault. If not, see <http://www.gnu.org/licenses/>.
|
along with Vault. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package net.milkbowl.vault.permission.plugins;
|
package net.milkbowl.vault.permission.plugins;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import net.milkbowl.vault.permission.Permission;
|
import net.milkbowl.vault.permission.Permission;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.server.PluginDisableEvent;
|
import org.bukkit.event.server.PluginDisableEvent;
|
||||||
import org.bukkit.event.server.PluginEnableEvent;
|
import org.bukkit.event.server.PluginEnableEvent;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import com.overmc.overpermissions.api.GroupManager;
|
import com.overmc.overpermissions.api.GroupManager;
|
||||||
import com.overmc.overpermissions.api.PermissionGroup;
|
import com.overmc.overpermissions.api.PermissionGroup;
|
||||||
import com.overmc.overpermissions.api.PermissionUser;
|
import com.overmc.overpermissions.api.PermissionUser;
|
||||||
import com.overmc.overpermissions.api.UserManager;
|
import com.overmc.overpermissions.api.UserManager;
|
||||||
import com.overmc.overpermissions.internal.OverPermissions;
|
import com.overmc.overpermissions.internal.OverPermissions;
|
||||||
|
|
||||||
public class Permission_OverPermissions extends Permission {
|
public class Permission_OverPermissions extends Permission {
|
||||||
private OverPermissions overPerms;
|
private OverPermissions overPerms;
|
||||||
private UserManager userManager;
|
private UserManager userManager;
|
||||||
private GroupManager groupManager;
|
private GroupManager groupManager;
|
||||||
|
|
||||||
public Permission_OverPermissions(Plugin plugin) {
|
public Permission_OverPermissions(Plugin plugin) {
|
||||||
super.plugin = plugin;
|
super.plugin = plugin;
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(this), plugin);
|
Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(this), plugin);
|
||||||
|
|
||||||
if (overPerms == null) {
|
if (overPerms == null) {
|
||||||
Plugin perms = plugin.getServer().getPluginManager().getPlugin("OverPermissions");
|
Plugin perms = plugin.getServer().getPluginManager().getPlugin("OverPermissions");
|
||||||
if ((perms != null) && (perms.isEnabled())) {
|
if ((perms != null) && (perms.isEnabled())) {
|
||||||
overPerms = ((OverPermissions) perms);
|
overPerms = ((OverPermissions) perms);
|
||||||
userManager = overPerms.getUserManager();
|
userManager = overPerms.getUserManager();
|
||||||
groupManager = overPerms.getGroupManager();
|
groupManager = overPerms.getGroupManager();
|
||||||
log.info(String.format("[%s][Permission] %s hooked.", new Object[] {plugin.getDescription().getName(), "OverPermissions"}));
|
log.info(String.format("[%s][Permission] %s hooked.", new Object[] {plugin.getDescription().getName(), "OverPermissions"}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName( ) {
|
public String getName( ) {
|
||||||
return "OverPermissions";
|
return "OverPermissions";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnabled( ) {
|
public boolean isEnabled( ) {
|
||||||
return (overPerms != null) && (overPerms.isEnabled());
|
return (overPerms != null) && (overPerms.isEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerHas(String worldName, String playerName, String permission) {
|
public boolean playerHas(String worldName, String playerName, String permission) {
|
||||||
if (!userManager.doesUserExist(playerName)) {
|
if (!userManager.doesUserExist(playerName)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return userManager.getPermissionUser(playerName).getPermission(permission, worldName);
|
return userManager.getPermissionUser(playerName).getPermission(permission, worldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerAdd(String worldName, String playerName, String permission) {
|
public boolean playerAdd(String worldName, String playerName, String permission) {
|
||||||
if (!userManager.canUserExist(playerName)) {
|
if (!userManager.canUserExist(playerName)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return userManager.getPermissionUser(playerName).addPermissionNode(permission, worldName);
|
return userManager.getPermissionUser(playerName).addPermissionNode(permission, worldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerRemove(String worldName, String playerName, String permission) {
|
public boolean playerRemove(String worldName, String playerName, String permission) {
|
||||||
if (!userManager.canUserExist(playerName)) {
|
if (!userManager.canUserExist(playerName)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return userManager.getPermissionUser(playerName).removePermissionNode(permission, worldName);
|
return userManager.getPermissionUser(playerName).removePermissionNode(permission, worldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean groupHas(String worldName, String groupName, String permission) {
|
public boolean groupHas(String worldName, String groupName, String permission) {
|
||||||
if (!groupManager.doesGroupExist(groupName)) {
|
if (!groupManager.doesGroupExist(groupName)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return groupManager.getGroup(groupName).getPermission(permission, worldName);
|
return groupManager.getGroup(groupName).getPermission(permission, worldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean groupAdd(String worldName, String groupName, String permission) {
|
public boolean groupAdd(String worldName, String groupName, String permission) {
|
||||||
if (!groupManager.doesGroupExist(groupName)) {
|
if (!groupManager.doesGroupExist(groupName)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (worldName == null) {
|
if (worldName == null) {
|
||||||
return groupManager.getGroup(groupName).addGlobalPermissionNode(permission);
|
return groupManager.getGroup(groupName).addGlobalPermissionNode(permission);
|
||||||
} else {
|
} else {
|
||||||
return groupManager.getGroup(groupName).addPermissionNode(permission, worldName);
|
return groupManager.getGroup(groupName).addPermissionNode(permission, worldName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean groupRemove(String worldName, String groupName, String permission) {
|
public boolean groupRemove(String worldName, String groupName, String permission) {
|
||||||
if (!groupManager.doesGroupExist(groupName)) {
|
if (!groupManager.doesGroupExist(groupName)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (worldName == null) {
|
if (worldName == null) {
|
||||||
return groupManager.getGroup(groupName).removeGlobalPermissionNode(permission);
|
return groupManager.getGroup(groupName).removeGlobalPermissionNode(permission);
|
||||||
} else {
|
} else {
|
||||||
return groupManager.getGroup(groupName).removePermissionNode(permission, worldName);
|
return groupManager.getGroup(groupName).removePermissionNode(permission, worldName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerInGroup(String worldName, String playerName, String groupName) {
|
public boolean playerInGroup(String worldName, String playerName, String groupName) {
|
||||||
if (!groupManager.doesGroupExist(groupName)) {
|
if (!groupManager.doesGroupExist(groupName)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!userManager.doesUserExist(playerName)) {
|
if (!userManager.doesUserExist(playerName)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return userManager.getPermissionUser(playerName).getAllParents().contains(groupManager.getGroup(groupName));
|
return userManager.getPermissionUser(playerName).getAllParents().contains(groupManager.getGroup(groupName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerAddGroup(String worldName, String playerName, String groupName) {
|
public boolean playerAddGroup(String worldName, String playerName, String groupName) {
|
||||||
if (!groupManager.doesGroupExist(groupName)) {
|
if (!groupManager.doesGroupExist(groupName)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!userManager.canUserExist(playerName)) {
|
if (!userManager.canUserExist(playerName)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return userManager.getPermissionUser(playerName).addParent(groupManager.getGroup(groupName));
|
return userManager.getPermissionUser(playerName).addParent(groupManager.getGroup(groupName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerRemoveGroup(String worldName, String playerName, String groupName) {
|
public boolean playerRemoveGroup(String worldName, String playerName, String groupName) {
|
||||||
if (!groupManager.doesGroupExist(groupName)) {
|
if (!groupManager.doesGroupExist(groupName)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!userManager.canUserExist(playerName)) {
|
if (!userManager.canUserExist(playerName)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return userManager.getPermissionUser(playerName).removeParent(groupManager.getGroup(groupName));
|
return userManager.getPermissionUser(playerName).removeParent(groupManager.getGroup(groupName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getPlayerGroups(String worldName, String playerName) {
|
public String[] getPlayerGroups(String worldName, String playerName) {
|
||||||
ArrayList<String> ret = new ArrayList<String>();
|
ArrayList<String> ret = new ArrayList<String>();
|
||||||
if (!userManager.doesUserExist(playerName)) {
|
if (!userManager.doesUserExist(playerName)) {
|
||||||
return new String[0];
|
return new String[0];
|
||||||
}
|
}
|
||||||
PermissionUser user = userManager.getPermissionUser(playerName);
|
PermissionUser user = userManager.getPermissionUser(playerName);
|
||||||
for (PermissionGroup parent : user.getAllParents()) {
|
for (PermissionGroup parent : user.getAllParents()) {
|
||||||
ret.add(parent.getName());
|
ret.add(parent.getName());
|
||||||
}
|
}
|
||||||
return ret.toArray(new String[ret.size()]);
|
return ret.toArray(new String[ret.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPrimaryGroup(String worldName, String playerName) {
|
public String getPrimaryGroup(String worldName, String playerName) {
|
||||||
String[] playerGroups = getPlayerGroups(worldName, playerName);
|
String[] playerGroups = getPlayerGroups(worldName, playerName);
|
||||||
if (playerGroups.length == 0) {
|
if (playerGroups.length == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return playerGroups[0];
|
return playerGroups[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerAddTransient(String world, String playerName, String permission) {
|
public String[] getGroups( ) {
|
||||||
if (!userManager.doesUserExist(playerName)) { // Can't add transient permissions to an offline player.
|
ArrayList<String> groupNames = new ArrayList<String>();
|
||||||
return false;
|
for (PermissionGroup s : groupManager.getGroups()) {
|
||||||
}
|
groupNames.add(s.getName());
|
||||||
PermissionUser user = userManager.getPermissionUser(playerName);
|
}
|
||||||
return (world == null) ? user.addGlobalTransientPermissionNode(permission) : user.addTransientPermissionNode(permission, world);
|
return groupNames.toArray(new String[groupNames.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerRemoveTransient(String world, String playerName, String permission) {
|
public boolean hasSuperPermsCompat( ) {
|
||||||
if (!userManager.doesUserExist(playerName)) {
|
return true;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
PermissionUser user = userManager.getPermissionUser(playerName);
|
@Override
|
||||||
return (world == null) ? user.removeGlobalTransientPermissionNode(permission) : user.removeTransientPermissionNode(permission, world);
|
public boolean hasGroupSupport( ) {
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public String[] getGroups( ) {
|
public class PermissionServerListener
|
||||||
ArrayList<String> groupNames = new ArrayList<String>();
|
implements Listener {
|
||||||
for (PermissionGroup s : groupManager.getGroups()) {
|
Permission_OverPermissions permission = null;
|
||||||
groupNames.add(s.getName());
|
|
||||||
}
|
public PermissionServerListener(Permission_OverPermissions permission) {
|
||||||
return groupNames.toArray(new String[groupNames.size()]);
|
this.permission = permission;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public boolean hasSuperPermsCompat( ) {
|
public void onPluginEnable(PluginEnableEvent event) {
|
||||||
return true;
|
if (permission.overPerms == null) {
|
||||||
}
|
Plugin perms = Permission_OverPermissions.this.plugin.getServer().getPluginManager().getPlugin("OverPermissions");
|
||||||
|
if (perms != null) {
|
||||||
@Override
|
permission.overPerms = ((OverPermissions) perms);
|
||||||
public boolean hasGroupSupport( ) {
|
Permission_OverPermissions.log.info(String
|
||||||
return true;
|
.format("[%s][Permission] %s hooked.", new Object[] {Permission_OverPermissions.this.plugin.getDescription().getName(), "OverPermissions"}));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public class PermissionServerListener
|
}
|
||||||
implements Listener {
|
|
||||||
Permission_OverPermissions permission = null;
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
|
public void onPluginDisable(PluginDisableEvent event)
|
||||||
public PermissionServerListener(Permission_OverPermissions permission) {
|
{
|
||||||
this.permission = permission;
|
if ((permission.overPerms != null) &&
|
||||||
}
|
(event.getPlugin().getDescription().getName().equals("OverPermissions"))) {
|
||||||
|
permission.overPerms = null;
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
Permission_OverPermissions.log.info(String
|
||||||
public void onPluginEnable(PluginEnableEvent event) {
|
.format("[%s][Permission] %s un-hooked.", new Object[] {Permission_OverPermissions.this.plugin.getDescription().getName(), "OverPermissions"}));
|
||||||
if (permission.overPerms == null) {
|
}
|
||||||
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.", new Object[] {Permission_OverPermissions.this.plugin.getDescription().getName(), "OverPermissions"}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
|
||||||
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.", new Object[] {Permission_OverPermissions.this.plugin.getDescription().getName(), "OverPermissions"}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -224,12 +224,6 @@ public class Permission_Permissions3 extends Permission {
|
||||||
return this.perms.has(worldName, playerName, permission);
|
return this.perms.has(worldName, playerName, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean playerAddTransient(String player, String permission) {
|
|
||||||
return playerAddTransient(null, player, permission);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerAddTransient(Player player, String permission) {
|
public boolean playerAddTransient(Player player, String permission) {
|
||||||
return playerAddTransient(null, player.getName(), permission);
|
return playerAddTransient(null, player.getName(), permission);
|
||||||
|
@ -240,8 +234,7 @@ public class Permission_Permissions3 extends Permission {
|
||||||
return playerAddTransient(worldName, player.getName(), permission);
|
return playerAddTransient(worldName, player.getName(), permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private boolean playerAddTransient(String worldName, String player, String permission) {
|
||||||
public boolean playerAddTransient(String worldName, String player, String permission) {
|
|
||||||
if (worldName == null) {
|
if (worldName == null) {
|
||||||
worldName = "*";
|
worldName = "*";
|
||||||
}
|
}
|
||||||
|
@ -253,10 +246,6 @@ public class Permission_Permissions3 extends Permission {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean playerRemoveTransient(String player, String permission) {
|
|
||||||
return playerRemoveTransient(null, player, permission);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerRemoveTransient(Player player, String permission) {
|
public boolean playerRemoveTransient(Player player, String permission) {
|
||||||
|
@ -268,8 +257,7 @@ public class Permission_Permissions3 extends Permission {
|
||||||
return playerRemoveTransient(worldName, player.getName(), permission);
|
return playerRemoveTransient(worldName, player.getName(), permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private boolean playerRemoveTransient(String worldName, String player, String permission) {
|
||||||
public boolean playerRemoveTransient(String worldName, String player, String permission) {
|
|
||||||
if (worldName == null) {
|
if (worldName == null) {
|
||||||
worldName = "*";
|
worldName = "*";
|
||||||
}
|
}
|
||||||
|
|
|
@ -303,16 +303,6 @@ public class Permission_PermissionsEx extends Permission {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean playerAddTransient(String worldName, String player, String permission) {
|
|
||||||
PermissionUser pPlayer = getUser(player);
|
|
||||||
if (pPlayer != null) {
|
|
||||||
pPlayer.addTimedPermission(permission, worldName, 0);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerAddTransient(String worldName, Player player, String permission) {
|
public boolean playerAddTransient(String worldName, Player player, String permission) {
|
||||||
|
@ -325,26 +315,11 @@ public class Permission_PermissionsEx extends Permission {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean playerAddTransient(String player, String permission) {
|
|
||||||
return playerAddTransient(null, player, permission);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerAddTransient(Player player, String permission) {
|
public boolean playerAddTransient(Player player, String permission) {
|
||||||
return playerAddTransient(null, player, permission);
|
return playerAddTransient(null, player, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean playerRemoveTransient(String worldName, String player, String permission) {
|
|
||||||
PermissionUser pPlayer = getUser(player);
|
|
||||||
if (pPlayer != null) {
|
|
||||||
pPlayer.removeTimedPermission(permission, worldName);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerRemoveTransient(Player player, String permission) {
|
public boolean playerRemoveTransient(Player player, String permission) {
|
||||||
|
@ -362,11 +337,6 @@ public class Permission_PermissionsEx extends Permission {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean playerRemoveTransient(String player, String permission) {
|
|
||||||
return playerRemoveTransient(null, player, permission);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getGroups() {
|
public String[] getGroups() {
|
||||||
List<PermissionGroup> groups = PermissionsEx.getPermissionManager().getGroupList();
|
List<PermissionGroup> groups = PermissionsEx.getPermissionManager().getGroupList();
|
||||||
|
|
Loading…
Reference in New Issue