Fixed major permission issue

This commit is contained in:
Alastair 2016-03-29 14:15:22 +01:00
parent 4f33a22f0f
commit c7690bafad
2 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,6 @@
main: com.sekwah.advancedportals.AdvancedPortalsPlugin main: com.sekwah.advancedportals.AdvancedPortalsPlugin
name: AdvancedPortals name: AdvancedPortals
version: 0.0.15 version: 0.0.16
author: sekwah41 author: sekwah41
description: An advanced portals plugin for bukkit. description: An advanced portals plugin for bukkit.
commands: commands:

View File

@ -353,9 +353,15 @@ public class Portal {
// add other variables or filter code here, or somehow have a way to register them // add other variables or filter code here, or somehow have a way to register them
// TODO on load and unload recode the permissions to try to register themselves
// https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/plugin/PluginManager.html#addPermission(org.bukkit.permissions.Permission)
// check they havent been registered before too and store a list of ones made by this plugin to remove when portals are unloaded.
// When a portal is added or removed it reloads all portals(i think) so add code for unloading too.
String permission = portal.getArg("permission"); String permission = portal.getArg("permission");
/*if((permission == null || (permission != null && player.hasPermission(permission)) || player.isOp())){*/ /*if((permission == null || (permission != null && player.hasPermission(permission)) || player.isOp())){*/
if (!((permission != null && player.hasPermission(permission)) || player.isOp())) { // 3 checks, 1st is if it doesnt need perms. 2nd is if it does do they have it. And third is are they op.
if (!(permission == null || (permission != null && player.hasPermission(permission)) || player.isOp())) {
player.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You do not have permission to use this portal!"); player.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] You do not have permission to use this portal!");
return false; return false;
} }