Separate the Vault Permission Handling from the Economy Handling

This commit is contained in:
MeFisto94
2020-06-25 00:19:58 +02:00
committed by Alexander Söderberg
parent e139550949
commit bd9bdc9e03
6 changed files with 149 additions and 26 deletions

View File

@ -35,6 +35,7 @@ import com.plotsquared.core.util.ChatManager;
import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.EconHandler;
import com.plotsquared.core.util.InventoryUtil;
import com.plotsquared.core.util.PermHandler;
import com.plotsquared.core.util.PlatformWorldManager;
import com.plotsquared.core.util.PlayerManager;
import com.plotsquared.core.util.RegionManager;
@ -180,6 +181,13 @@ public interface IPlotMain<P> extends ILogger {
*/
@Nullable EconHandler getEconomyHandler();
/**
* Gets the permission provider, if there is one
*
* @return the PlotSquared permission manager
*/
@Nullable PermHandler getPermissionHandler();
/**
* Gets the {@link QueueProvider} class.
*/

View File

@ -77,9 +77,15 @@ public abstract class EconHandler {
public abstract void depositMoney(OfflinePlotPlayer player, double amount);
public abstract boolean hasPermission(String world, String player, String perm);
/**
* @deprecated Use {@link PermHandler#hasPermission(String, String, String)} instead
*/
@Deprecated public abstract boolean hasPermission(String world, String player, String perm);
public boolean hasPermission(String player, String perm) {
/**
* @deprecated Use {@link PermHandler#hasPermission(String, String)} instead
*/
@Deprecated public boolean hasPermission(String player, String perm) {
return hasPermission(null, player, perm);
}
}

View File

@ -0,0 +1,37 @@
/*
* _____ _ _ _____ _
* | __ \| | | | / ____| | |
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2020 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.plotsquared.core.util;
public abstract class PermHandler {
public abstract boolean init();
public abstract boolean hasPermission(String world, String player, String perm);
public boolean hasPermission(String player, String perm) {
return hasPermission(null, player, perm);
}
}