From b45891c868b433da46af885084b47aa992973a9f Mon Sep 17 00:00:00 2001 From: DThielke Date: Thu, 19 Jan 2012 19:47:04 -0500 Subject: [PATCH] Starburst: use bukkit permission check for online players. --- .../plugins/Permission_Starburst.java | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) mode change 100644 => 100755 src/net/milkbowl/vault/permission/plugins/Permission_Starburst.java diff --git a/src/net/milkbowl/vault/permission/plugins/Permission_Starburst.java b/src/net/milkbowl/vault/permission/plugins/Permission_Starburst.java old mode 100644 new mode 100755 index 92bd655..362befb --- a/src/net/milkbowl/vault/permission/plugins/Permission_Starburst.java +++ b/src/net/milkbowl/vault/permission/plugins/Permission_Starburst.java @@ -1,14 +1,11 @@ package net.milkbowl.vault.permission.plugins; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - +import com.dthielke.starburst.*; import net.milkbowl.vault.Vault; import net.milkbowl.vault.permission.Permission; - import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; +import org.bukkit.entity.Player; import org.bukkit.event.Event.Priority; import org.bukkit.event.Event.Type; import org.bukkit.event.server.PluginDisableEvent; @@ -16,11 +13,9 @@ import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.event.server.ServerListener; import org.bukkit.plugin.Plugin; -import com.dthielke.starburst.Group; -import com.dthielke.starburst.GroupManager; -import com.dthielke.starburst.GroupSet; -import com.dthielke.starburst.StarburstPlugin; -import com.dthielke.starburst.User; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; public class Permission_Starburst extends Permission { private StarburstPlugin perms; @@ -87,7 +82,7 @@ public class Permission_Starburst extends Permission { OfflinePlayer op = Bukkit.getOfflinePlayer(player); GroupSet set = perms.getGroupManager().getWorldSet(Bukkit.getWorld(world)); User user = set.getUser(op); - + Set children = user.getChildren(true); List groups = new ArrayList(); for (Group child : children) { @@ -218,6 +213,14 @@ public class Permission_Starburst extends Permission { @Override public boolean playerHas(String world, String player, String permission) { OfflinePlayer op = Bukkit.getOfflinePlayer(player); + + if (op.isOnline()) { + Player p = (Player) op; + if (p.getWorld().getName().equalsIgnoreCase(world)) { + return p.hasPermission(permission); + } + } + GroupSet set = perms.getGroupManager().getWorldSet(Bukkit.getWorld(world)); Group user = set.getUser(op); return user.hasPermission(permission, true);