From 4cb0df024edc6c7c3719fcd45e080bdddb103e9c Mon Sep 17 00:00:00 2001 From: Alastair Date: Tue, 7 Mar 2017 12:06:17 +0000 Subject: [PATCH] Fix desti permission error --- Resources/plugin.yml | 3 +++ src/com/sekwah/advancedportals/destinations/Destination.java | 3 ++- src/com/sekwah/advancedportals/listeners/Listeners.java | 2 +- src/com/sekwah/advancedportals/portals/Portal.java | 3 +++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Resources/plugin.yml b/Resources/plugin.yml index 82d6770..ba3d3f6 100644 --- a/Resources/plugin.yml +++ b/Resources/plugin.yml @@ -33,6 +33,9 @@ permissions: advancedportals.desti: description: Gives access to all desti commands default: op + advancedportals.desti.default: + description: Gives access to all destinations (really need to make proper desti warp permission setup) + default: true advancedportals.warp.*: description: Access to all warps default: op diff --git a/src/com/sekwah/advancedportals/destinations/Destination.java b/src/com/sekwah/advancedportals/destinations/Destination.java index 2d3bdfb..d54fdc5 100644 --- a/src/com/sekwah/advancedportals/destinations/Destination.java +++ b/src/com/sekwah/advancedportals/destinations/Destination.java @@ -108,7 +108,8 @@ public class Destination { } public static boolean warp(Player player, String name) { - if (!player.hasPermission("advancedportals.warp.*") && !player.hasPermission("advancedportals.warp." + name)) { + if (!player.hasPermission("advancedportals.warp.*") && !player.hasPermission("advancedportals.desti." + name) + && !player.hasPermission("advancedportals.warp.default")) { player.sendMessage(PluginMessages.customPrefixFail + " You don't have permission to warp to " + name + "!"); return false; } diff --git a/src/com/sekwah/advancedportals/listeners/Listeners.java b/src/com/sekwah/advancedportals/listeners/Listeners.java index f2b3755..ef12e79 100644 --- a/src/com/sekwah/advancedportals/listeners/Listeners.java +++ b/src/com/sekwah/advancedportals/listeners/Listeners.java @@ -166,7 +166,7 @@ public class Listeners implements Listener { if (player.hasMetadata("selectingPortal") && (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK)) { for (AdvancedPortal portal : Portal.Portals) { if (Portal.locationInPortal(portal, event.getClickedBlock().getLocation(), 0)) { - player.sendMessage(PluginMessages.customPrefixFail + "\u00A7a You have selected: \u00A7e" + portal.portalName); + player.sendMessage(PluginMessages.customPrefix + "\u00A7a You have selected: \u00A7e" + portal.portalName); player.setMetadata("selectedPortal", new FixedMetadataValue(plugin, portal.portalName)); // adds the name to the metadata of the character event.setCancelled(true); player.removeMetadata("selectingPortal", plugin); diff --git a/src/com/sekwah/advancedportals/portals/Portal.java b/src/com/sekwah/advancedportals/portals/Portal.java index cc5ee57..9bb1c1d 100644 --- a/src/com/sekwah/advancedportals/portals/Portal.java +++ b/src/com/sekwah/advancedportals/portals/Portal.java @@ -401,6 +401,9 @@ public class Portal { ConfigAccessor configDesti = new ConfigAccessor(plugin, "destinations.yml"); if (configDesti.getConfig().getString(portal.destiation + ".world") != null) { warped = Destination.warp(player, portal.destiation); + if(!warped){ + throwPlayerBack(player); + } } } else { if (showFailMessage) {