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:
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

View File

@ -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;
}

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)) {
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);

View File

@ -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) {