Guice progress

This commit is contained in:
Alexander Söderberg
2020-07-10 22:12:37 +02:00
parent 55bf41d2da
commit c0f69f321d
90 changed files with 1026 additions and 830 deletions

View File

@ -25,9 +25,10 @@
*/
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.PlotSquared;
import com.plotsquared.core.player.OfflinePlotPlayer;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.EconHandler;
@ -35,11 +36,18 @@ import com.plotsquared.core.util.PermHandler;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.jetbrains.annotations.Nullable;
public class BukkitEconHandler extends EconHandler {
@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() {
if (this.econ == null) {
@ -83,8 +91,8 @@ public class BukkitEconHandler extends EconHandler {
* @deprecated Use {@link PermHandler#hasPermission(String, String, String)} instead
*/
@Deprecated @Override public boolean hasPermission(String world, String player, String perm) {
if (PlotSquared.platform().getPermissionHandler() != null) {
return PlotSquared.platform().getPermissionHandler().hasPermission(world, player, perm);
if (this.permHandler != null) {
return this.permHandler.hasPermission(world, player, perm);
} else {
return false;
}