Remove internal ShopGUI+ support. This is the last of the reflection.

If you wan't the support added back in just contact the ShopGUI+ developer and I'm more then positive they can just copy and paste the code removed here to fix it.
This commit is contained in:
Brianna 2021-06-01 12:10:31 -05:00
parent a02c11efb2
commit b3c1f10d35
3 changed files with 0 additions and 68 deletions

View File

@ -164,17 +164,6 @@ public class EpicSpawners extends SongodaPlugin {
this.spawnerCustomSpawnTask = SpawnerSpawnTask.startTask(this);
this.appearanceTask = AppearanceTask.startTask(this);
// ShopGUI+ support
if (Bukkit.getPluginManager().isPluginEnabled("ShopGUIPlus")) {
try {
// For some reason simply creating a new instance of the class without ShopGUIPlus being installed was giving a NoClassDefFoundError.
// We're using reflection to get around this problem.
Object provider = Class.forName("com.songoda.epicspawners.utils.EpicSpawnerProvider").newInstance();
net.brcdev.shopgui.ShopGuiPlusApi.registerSpawnerProvider((net.brcdev.shopgui.spawner.external.provider.ExternalSpawnerProvider) provider);
} catch (Exception ignored) {
}
}
// Database stuff, go!
this.databaseConnector = new SQLiteConnector(this);
this.getLogger().info("Data handler connected using SQLite.");

View File

@ -1,41 +0,0 @@
package com.songoda.epicspawners.utils;
import com.songoda.epicspawners.EpicSpawners;
import com.songoda.epicspawners.spawners.spawner.SpawnerTier;
import net.brcdev.shopgui.spawner.external.provider.ExternalSpawnerProvider;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
public class EpicSpawnerProvider implements ExternalSpawnerProvider {
private final EpicSpawners instance;
public EpicSpawnerProvider() {
this.instance = EpicSpawners.getInstance();
}
@Override
public String getName() {
return this.instance.getDescription().getName();
}
@Override
public ItemStack getSpawnerItem(EntityType entityType) {
SpawnerTier data = this.instance.getSpawnerManager().getSpawnerData(entityType).getFirstTier();
if (data != null)
return data.toItemStack();
return new ItemStack(Material.AIR); // This shouldn't ever happen unless the plugin is out of date
}
@Override
public EntityType getSpawnerEntityType(ItemStack itemStack) {
SpawnerTier data = this.instance.getSpawnerManager().getSpawnerTier(itemStack);
if (data != null && !data.getEntities().isEmpty())
return data.getEntities().get(0);
return EntityType.UNKNOWN;
}
}

View File

@ -1,16 +0,0 @@
package com.songoda.epicspawners.utils;
public class PaperUtils {
private static boolean paper = false;
static {
try {
Class.forName("com.destroystokyo.paper.PaperConfig");
paper = true;
} catch (ClassNotFoundException e) {}
}
public static boolean isPaper() {
return paper;
}
}