0.9.0.2 Fixes a bug in the code to prevent nether portals from generating in the nether

This commit is contained in:
Kristian Knarvik 2021-11-01 00:38:36 +01:00
parent 89956cf359
commit b98aec4a20
4 changed files with 14 additions and 7 deletions

View File

@ -367,6 +367,10 @@ bungeeSign=Teleport to
# Changes # Changes
#### \[Version 0.9.0.2] EpicKnarvik97 fork
- Fixes a bug causing Stargates using NETHER_PORTAL blocks to generate nether portals in the nether.
#### \[Version 0.9.0.1] EpicKnarvik97 fork #### \[Version 0.9.0.1] EpicKnarvik97 fork
- Adds the highlightSignColor option and renames the signColor option to mainSignColor - Adds the highlightSignColor option and renames the signColor option to mainSignColor

View File

@ -4,7 +4,7 @@
<groupId>net.knarcraft</groupId> <groupId>net.knarcraft</groupId>
<artifactId>Stargate</artifactId> <artifactId>Stargate</artifactId>
<version>0.9.0.1</version> <version>0.9.0.2</version>
<licenses> <licenses>
<license> <license>

View File

@ -1,5 +1,6 @@
package net.knarcraft.stargate.listener; package net.knarcraft.stargate.listener;
import net.knarcraft.stargate.Stargate;
import net.knarcraft.stargate.container.FromTheEndTeleportation; import net.knarcraft.stargate.container.FromTheEndTeleportation;
import net.knarcraft.stargate.portal.PlayerTeleporter; import net.knarcraft.stargate.portal.PlayerTeleporter;
import net.knarcraft.stargate.portal.Portal; import net.knarcraft.stargate.portal.Portal;
@ -8,7 +9,6 @@ import net.knarcraft.stargate.utility.PermissionHelper;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.BlockState;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -37,11 +37,14 @@ public class PortalEventListener implements Listener {
if (event.isCancelled()) { if (event.isCancelled()) {
return; return;
} }
//Cancel nether portal creation when the portal is a StarGate portal //Unnecessary nether portal creation is only triggered by nether pairing
for (BlockState block : event.getBlocks()) { if (event.getReason() == PortalCreateEvent.CreateReason.NETHER_PAIR) {
if (PortalHandler.getByBlock(block.getBlock()) != null) { //If an entity is standing in a Stargate entrance, it can be assumed that the creation is a mistake
Entity entity = event.getEntity();
if (entity != null && PortalHandler.getByAdjacentEntrance(entity.getLocation()) != null) {
Stargate.debug("PortalEventListener::onPortalCreation",
"Cancelled nether portal create event");
event.setCancelled(true); event.setCancelled(true);
return;
} }
} }
} }

View File

@ -1,6 +1,6 @@
name: Stargate name: Stargate
main: net.knarcraft.stargate.Stargate main: net.knarcraft.stargate.Stargate
version: 0.9.0.1 version: 0.9.0.2
description: Stargate mod for Bukkit Revived description: Stargate mod for Bukkit Revived
author: EpicKnarvik97 author: EpicKnarvik97
authors: [ Drakia, PseudoKnight, EpicKnarvik97 ] authors: [ Drakia, PseudoKnight, EpicKnarvik97 ]