Fix onLoad, restore WG support

This commit is contained in:
Shane Freeder 2020-03-05 01:12:02 +00:00
parent f96ba1b4b5
commit 21b4bcc21f
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C
3 changed files with 19 additions and 7 deletions

View File

@ -13,7 +13,7 @@ import co.aikar.commands.CommandIssuer;
import co.aikar.commands.CommandManager;
import co.aikar.commands.CommandOperationContext;
public interface PlatformProvider {
public interface PlatformProvider<E> {
Logger getLogger();
@ -57,6 +57,9 @@ public interface PlatformProvider {
@Deprecated
MMOEntity<?> getEntity(UUID uniqueId);
@Deprecated
MMOEntity<?> getEntity(E uniqueId);
@Deprecated
Object getChimaeraWing();
}

View File

@ -41,7 +41,7 @@ import java.util.logging.Logger;
import co.aikar.commands.CommandManager;
import co.aikar.commands.PaperCommandManager;
public class BukkitBootstrap extends JavaPlugin implements PlatformProvider {
public class BukkitBootstrap extends JavaPlugin implements PlatformProvider<Entity> {
private mcMMO core = new mcMMO(this);
private final BukkitPlatformScheduler scheduler = new BukkitPlatformScheduler(this);
@ -173,7 +173,11 @@ public class BukkitBootstrap extends JavaPlugin implements PlatformProvider {
@Override
@Deprecated // TODO: This needs proper registration...
public MMOEntity<?> getEntity(UUID uniqueId) {
final Entity entity = Bukkit.getEntity(uniqueId);
return getEntity(Bukkit.getEntity(uniqueId));
}
@Override
public MMOEntity<?> getEntity(Entity entity) {
if (entity instanceof Player) {
core.getUserManager().getPlayer((Player) entity);
} else if (entity instanceof LivingEntity) {
@ -234,6 +238,12 @@ public class BukkitBootstrap extends JavaPlugin implements PlatformProvider {
pluginManager.registerEvents(new WorldListener(core), this);
}
@Override
public void onLoad() {
core.onLoad();
}
@Override
public void onEnable() {
core.onEnable();

View File

@ -46,6 +46,8 @@ import com.gmail.nossr50.util.sounds.SoundManager;
import com.gmail.nossr50.worldguard.WorldGuardManager;
import com.gmail.nossr50.worldguard.WorldGuardUtils;
import net.shatteredlands.shatt.backup.ZipLibrary;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
@ -276,12 +278,10 @@ public class mcMMO implements McMMOApi {
public void onLoad()
{
platformProvider.onLoad();
worldGuardUtils = new WorldGuardUtils(this); //Init WGU
// TODO: 2.2 - MIGRATE
/*
if(getServer().getPluginManager().getPlugin("WorldGuard") != null) {
if(Bukkit.getServer().getPluginManager().getPlugin("WorldGuard") != null) {
if(worldGuardUtils.isWorldGuardLoaded()) {
//Register flags
@ -290,7 +290,6 @@ public class mcMMO implements McMMOApi {
worldGuardManager.registerFlags();
}
}
*/
}
/**