Add permission for online/offline opening (Resolves #129)
This commit is contained in:
		@@ -104,10 +104,20 @@ public class OpenInvCommand implements TabExecutor {
 | 
			
		||||
        boolean online = target.isOnline();
 | 
			
		||||
 | 
			
		||||
        if (!online) {
 | 
			
		||||
            // Try loading the player's data
 | 
			
		||||
            onlineTarget = this.plugin.loadPlayer(target);
 | 
			
		||||
            if (Permissions.OPENOFFLINE.hasPermission(player)) {
 | 
			
		||||
                // Try loading the player's data
 | 
			
		||||
                onlineTarget = this.plugin.loadPlayer(target);
 | 
			
		||||
            } else {
 | 
			
		||||
                plugin.sendMessage(player, "messages.error.permissionPlayerOffline");
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            onlineTarget = target.getPlayer();
 | 
			
		||||
            if (Permissions.OPENONLINE.hasPermission(player)) {
 | 
			
		||||
                onlineTarget = target.getPlayer();
 | 
			
		||||
            } else {
 | 
			
		||||
                plugin.sendMessage(player, "messages.error.permissionPlayerOnline");
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (onlineTarget == null) {
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,9 @@ public enum Permissions {
 | 
			
		||||
    SEARCH("search"),
 | 
			
		||||
    EDITINV("editinv"),
 | 
			
		||||
    EDITENDER("editender"),
 | 
			
		||||
    OPENSELF("openself");
 | 
			
		||||
    OPENSELF("openself"),
 | 
			
		||||
    OPENONLINE("openonline"),
 | 
			
		||||
    OPENOFFLINE("openoffline");
 | 
			
		||||
 | 
			
		||||
    private final String permission;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user