Fix desti permission error

This commit is contained in:
Alastair 2017-03-07 12:06:17 +00:00
parent ee10d17cbb
commit 4cb0df024e
4 changed files with 9 additions and 2 deletions

View File

@ -33,6 +33,9 @@ permissions:
advancedportals.desti: advancedportals.desti:
description: Gives access to all desti commands description: Gives access to all desti commands
default: op default: op
advancedportals.desti.default:
description: Gives access to all destinations (really need to make proper desti warp permission setup)
default: true
advancedportals.warp.*: advancedportals.warp.*:
description: Access to all warps description: Access to all warps
default: op default: op

View File

@ -108,7 +108,8 @@ public class Destination {
} }
public static boolean warp(Player player, String name) { 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 + "!"); player.sendMessage(PluginMessages.customPrefixFail + " You don't have permission to warp to " + name + "!");
return false; return false;
} }

View File

@ -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)) { if (player.hasMetadata("selectingPortal") && (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK)) {
for (AdvancedPortal portal : Portal.Portals) { for (AdvancedPortal portal : Portal.Portals) {
if (Portal.locationInPortal(portal, event.getClickedBlock().getLocation(), 0)) { 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 player.setMetadata("selectedPortal", new FixedMetadataValue(plugin, portal.portalName)); // adds the name to the metadata of the character
event.setCancelled(true); event.setCancelled(true);
player.removeMetadata("selectingPortal", plugin); player.removeMetadata("selectingPortal", plugin);

View File

@ -401,6 +401,9 @@ public class Portal {
ConfigAccessor configDesti = new ConfigAccessor(plugin, "destinations.yml"); ConfigAccessor configDesti = new ConfigAccessor(plugin, "destinations.yml");
if (configDesti.getConfig().getString(portal.destiation + ".world") != null) { if (configDesti.getConfig().getString(portal.destiation + ".world") != null) {
warped = Destination.warp(player, portal.destiation); warped = Destination.warp(player, portal.destiation);
if(!warped){
throwPlayerBack(player);
}
} }
} else { } else {
if (showFailMessage) { if (showFailMessage) {