Fixed a bug where you could create portals using anchors

This commit is contained in:
Niels Vergucht 2018-12-20 19:54:45 +01:00 committed by Brianna O'Keefe
parent a5bae8a204
commit 129127ea87
2 changed files with 9 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import com.songoda.epicanchors.anchor.EAnchor;
import com.songoda.epicanchors.EpicAnchorsPlugin;
import com.songoda.epicanchors.api.anchor.Anchor;
import org.bukkit.Material;
import org.bukkit.PortalType;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
@ -11,6 +12,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityCreatePortalEvent;
import org.bukkit.inventory.ItemStack;
public class BlockListeners implements Listener {
@ -38,4 +40,10 @@ public class BlockListeners implements Listener {
instance.getAnchorManager().addAnchor(event.getBlock().getLocation(), new EAnchor(event.getBlock().getLocation(), instance.getTicksFromItem(item)));
}
@EventHandler
public void onPortalCreation(EntityCreatePortalEvent e) {
if (e.getBlocks().size() < 1) return;
if (instance.getAnchorManager().isAnchor(e.getBlocks().get(0).getLocation())) e.setCancelled(true);
}
}

View File

@ -2,7 +2,7 @@
<groupId>com.songoda</groupId>
<artifactId>EpicAnchors</artifactId>
<modelVersion>4.0.0</modelVersion>
<version>1.1.7</version>
<version>1.1.8</version>
<build>
<defaultGoal>clean package</defaultGoal>
<plugins>