Remove portal listener on 1.8

This commit is contained in:
Brianna 2020-03-25 15:46:43 -04:00
parent d56469269b
commit a91e92c001
3 changed files with 25 additions and 7 deletions

View File

@ -4,6 +4,7 @@ import com.songoda.core.SongodaCore;
import com.songoda.core.SongodaPlugin;
import com.songoda.core.commands.CommandManager;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.core.configuration.Config;
import com.songoda.core.gui.GuiManager;
import com.songoda.core.hooks.EconomyManager;
@ -14,6 +15,7 @@ import com.songoda.epicanchors.anchor.AnchorManager;
import com.songoda.epicanchors.commands.*;
import com.songoda.epicanchors.listeners.BlockListeners;
import com.songoda.epicanchors.listeners.InteractListeners;
import com.songoda.epicanchors.listeners.PortalListeners;
import com.songoda.epicanchors.settings.Settings;
import com.songoda.epicanchors.tasks.AnchorTask;
import com.songoda.epicanchors.tasks.VisualizeTask;
@ -91,6 +93,8 @@ public class EpicAnchors extends SongodaPlugin {
PluginManager pluginManager = Bukkit.getPluginManager();
pluginManager.registerEvents(new BlockListeners(this), this);
pluginManager.registerEvents(new InteractListeners(this), this);
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9))
pluginManager.registerEvents(new PortalListeners(this), this);
// Register Hologram Plugin
HologramManager.load(this);

View File

@ -7,7 +7,6 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.world.PortalCreateEvent;
import org.bukkit.inventory.ItemStack;
public class BlockListeners implements Listener {
@ -38,10 +37,4 @@ public class BlockListeners implements Listener {
plugin.updateHologram(anchor);
}
@EventHandler
public void onPortalCreation(PortalCreateEvent e) {
if (e.getBlocks().size() < 1) return;
if (plugin.getAnchorManager().isAnchor(e.getBlocks().get(0).getLocation())) e.setCancelled(true);
}
}

View File

@ -0,0 +1,21 @@
package com.songoda.epicanchors.listeners;
import com.songoda.epicanchors.EpicAnchors;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.world.PortalCreateEvent;
public class PortalListeners implements Listener {
private EpicAnchors plugin;
public PortalListeners(EpicAnchors instance) {
this.plugin = instance;
}
@EventHandler
public void onPortalCreation(PortalCreateEvent e) {
if (e.getBlocks().size() < 1) return;
if (plugin.getAnchorManager().isAnchor(e.getBlocks().get(0).getLocation())) e.setCancelled(true);
}
}