Get rid of PermHandler

This commit is contained in:
Alexander Söderberg
2020-07-22 12:35:48 +02:00
parent b302bb9379
commit 5fda3e9765
22 changed files with 152 additions and 240 deletions

View File

@ -25,31 +25,21 @@
*/
package com.plotsquared.bukkit.util;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.plotsquared.bukkit.player.BukkitOfflinePlayer;
import com.plotsquared.bukkit.player.BukkitPlayer;
import com.plotsquared.core.player.OfflinePlotPlayer;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.EconHandler;
import com.plotsquared.core.util.PermHandler;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
import org.bukkit.plugin.RegisteredServiceProvider;
import javax.annotation.Nullable;
@Singleton public class BukkitEconHandler extends EconHandler {
private Economy econ;
private final PermHandler permHandler;
@Inject public BukkitEconHandler(@Nullable final PermHandler permHandler) {
this.permHandler = permHandler;
}
@Override
public boolean init() {
@Override public boolean init() {
if (this.econ == null) {
setupEconomy();
}
@ -87,17 +77,6 @@ import javax.annotation.Nullable;
this.econ.depositPlayer(((BukkitOfflinePlayer) player).player, amount);
}
/**
* @deprecated Use {@link PermHandler#hasPermission(String, String, String)} instead
*/
@Deprecated @Override public boolean hasPermission(String world, String player, String perm) {
if (this.permHandler != null) {
return this.permHandler.hasPermission(world, player, perm);
} else {
return false;
}
}
@Override public double getBalance(PlotPlayer<?> player) {
return this.econ.getBalance(player.getName());
}