3
0
Mirror von https://github.com/St3venAU/ArmorStandTools.git synchronisiert 2024-12-29 04:50:09 +01:00

Merge pull request #4 from boy0001/branch

Fix PlotSquared hook + add fallback
Dieser Commit ist enthalten in:
St3venAU 2015-08-03 19:12:26 +08:00
Commit 576d07e1ea
2 geänderte Dateien mit 9 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -115,8 +115,13 @@ class Config {
Plugin plotSquared = plugin.getServer().getPluginManager().getPlugin("PlotSquared"); Plugin plotSquared = plugin.getServer().getPluginManager().getPlugin("PlotSquared");
if (plotSquared != null && plotSquared.isEnabled()) { if (plotSquared != null && plotSquared.isEnabled()) {
try {
new PlotSquaredHook(plugin); new PlotSquaredHook(plugin);
} }
catch (Throwable e) {
e.printStackTrace();
}
}
Plugin worldGuard = plugin.getServer().getPluginManager().getPlugin("WorldGuard"); Plugin worldGuard = plugin.getServer().getPluginManager().getPlugin("WorldGuard");
worldGuardPlugin = worldGuard == null || !(worldGuard instanceof WorldGuardPlugin) ? null : (WorldGuardPlugin) worldGuard; worldGuardPlugin = worldGuard == null || !(worldGuard instanceof WorldGuardPlugin) ? null : (WorldGuardPlugin) worldGuard;

Datei anzeigen

@ -10,7 +10,6 @@ import com.intellectualcrafters.plot.api.PlotAPI;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
class PlotSquaredHook { class PlotSquaredHook {
@ -28,11 +27,11 @@ class PlotSquaredHook {
public static boolean checkPermission(Player player, Location loc) { public static boolean checkPermission(Player player, Location loc) {
Plot plot = api.getPlot(loc); Plot plot = api.getPlot(loc);
PlotPlayer pp = PlotPlayer.wrap(player);
if (plot == null) { 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(); 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");
} }
} }