From 7b621b20fbd89f6c5850e6aedf403075af86b550 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Mon, 3 Aug 2015 21:06:20 +1000 Subject: [PATCH] Fix PlotSquared hook + add fallback --- src/com/gmail/St3venAU/plugins/ArmorStandTools/Config.java | 7 ++++++- .../St3venAU/plugins/ArmorStandTools/PlotSquaredHook.java | 7 +++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/com/gmail/St3venAU/plugins/ArmorStandTools/Config.java b/src/com/gmail/St3venAU/plugins/ArmorStandTools/Config.java index d7ea5fc..63d6634 100644 --- a/src/com/gmail/St3venAU/plugins/ArmorStandTools/Config.java +++ b/src/com/gmail/St3venAU/plugins/ArmorStandTools/Config.java @@ -115,7 +115,12 @@ class Config { Plugin plotSquared = plugin.getServer().getPluginManager().getPlugin("PlotSquared"); if (plotSquared != null && plotSquared.isEnabled()) { - new PlotSquaredHook(plugin); + try { + new PlotSquaredHook(plugin); + } + catch (Throwable e) { + e.printStackTrace(); + } } Plugin worldGuard = plugin.getServer().getPluginManager().getPlugin("WorldGuard"); diff --git a/src/com/gmail/St3venAU/plugins/ArmorStandTools/PlotSquaredHook.java b/src/com/gmail/St3venAU/plugins/ArmorStandTools/PlotSquaredHook.java index 892edd7..404be45 100644 --- a/src/com/gmail/St3venAU/plugins/ArmorStandTools/PlotSquaredHook.java +++ b/src/com/gmail/St3venAU/plugins/ArmorStandTools/PlotSquaredHook.java @@ -10,7 +10,6 @@ import com.intellectualcrafters.plot.api.PlotAPI; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.Permissions; -import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; @SuppressWarnings("deprecation") class PlotSquaredHook { @@ -28,11 +27,11 @@ class PlotSquaredHook { public static boolean checkPermission(Player player, Location loc) { Plot plot = api.getPlot(loc); + PlotPlayer pp = PlotPlayer.wrap(player); if (plot == null) { - return Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.admin.build.road"); + return pp.hasPermission("plots.admin.build.road"); } - PlotPlayer pp = BukkitUtil.getPlayer(player); UUID uuid = pp.getUUID(); - return plot.isAdded(uuid) || Permissions.hasPermission(pp, "plots.admin.build.other"); + return plot.isAdded(uuid) || pp.hasPermission("plots.admin.build.other"); } }