Removes the temporary ignoreEntrances option and replaces it with proper snowman blocking. Fixes #3
Allows new gates to contain water as underwater gates are a thing now Adds a check to prevent snowmen from placing snow inside a portal's entrance Removes the ignoreEntrances option everywhere
This commit is contained in:
parent
f87ffc906c
commit
051a6b8f98
@ -255,7 +255,6 @@ gates:
|
|||||||
destroyedByExplosion - Whether to destroy a stargate with explosions, or stop an explosion if it contains a gates controls.
|
destroyedByExplosion - Whether to destroy a stargate with explosions, or stop an explosion if it contains a gates controls.
|
||||||
verifyPortals - Whether or not all the non-sign blocks are checked to match the gate layout when an old stargate is loaded at startup.
|
verifyPortals - Whether or not all the non-sign blocks are checked to match the gate layout when an old stargate is loaded at startup.
|
||||||
protectEntrance - If true, will protect from users breaking gate entrance blocks (This is more resource intensive than the usual check, and should only be enabled for servers that use solid open/close blocks)
|
protectEntrance - If true, will protect from users breaking gate entrance blocks (This is more resource intensive than the usual check, and should only be enabled for servers that use solid open/close blocks)
|
||||||
ignoreEntranceSet this option to true to not check the entrance of a gate on startup. This is a workaround for snowmen breaking gates.
|
|
||||||
functionality:
|
functionality:
|
||||||
enableBungee - Enable this for BungeeCord support. This allows portals across Bungee servers.
|
enableBungee - Enable this for BungeeCord support. This allows portals across Bungee servers.
|
||||||
handleVehicles - Whether or not to handle vehicles going through gates. Set to false to disallow vehicles (Manned or not) going through gates.
|
handleVehicles - Whether or not to handle vehicles going through gates. Set to false to disallow vehicles (Manned or not) going through gates.
|
||||||
@ -349,6 +348,7 @@ bungeeSign=Teleport to
|
|||||||
- Comments all the code
|
- Comments all the code
|
||||||
- Extracts portal options and portal-related locations to try and reduce size
|
- Extracts portal options and portal-related locations to try and reduce size
|
||||||
- Rewrites tons of code to make it more readable and manageable
|
- Rewrites tons of code to make it more readable and manageable
|
||||||
|
- Implements proper snowman snow blocking, and removes the "temporary" ignoreEntrances option
|
||||||
|
|
||||||
#### \[Version 0.8.0.3] PseudoKnight fork
|
#### \[Version 0.8.0.3] PseudoKnight fork
|
||||||
|
|
||||||
|
@ -68,8 +68,6 @@ public class Stargate extends JavaPlugin {
|
|||||||
public static boolean enableBungee = true;
|
public static boolean enableBungee = true;
|
||||||
public static boolean verifyPortals = true;
|
public static boolean verifyPortals = true;
|
||||||
private static boolean destroyExplosion = false;
|
private static boolean destroyExplosion = false;
|
||||||
//Temp workaround for snowmen, don't check gate entrance
|
|
||||||
public static boolean ignoreEntrance = false;
|
|
||||||
private String dataFolderPath;
|
private String dataFolderPath;
|
||||||
|
|
||||||
public static ChatColor signColor;
|
public static ChatColor signColor;
|
||||||
@ -453,7 +451,6 @@ public class Stargate extends JavaPlugin {
|
|||||||
//Integrity
|
//Integrity
|
||||||
protectEntrance = newConfig.getBoolean("gates.integrity.protectEntrance");
|
protectEntrance = newConfig.getBoolean("gates.integrity.protectEntrance");
|
||||||
verifyPortals = newConfig.getBoolean("gates.integrity.verifyPortals");
|
verifyPortals = newConfig.getBoolean("gates.integrity.verifyPortals");
|
||||||
ignoreEntrance = newConfig.getBoolean("gates.integrity.ignoreEntrance");
|
|
||||||
destroyExplosion = newConfig.getBoolean("gates.integrity.destroyedByExplosion");
|
destroyExplosion = newConfig.getBoolean("gates.integrity.destroyedByExplosion");
|
||||||
|
|
||||||
//Cosmetic
|
//Cosmetic
|
||||||
|
@ -12,6 +12,7 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.data.type.WallSign;
|
import org.bukkit.block.data.type.WallSign;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Snowman;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -21,6 +22,7 @@ import org.bukkit.event.block.BlockPhysicsEvent;
|
|||||||
import org.bukkit.event.block.BlockPistonEvent;
|
import org.bukkit.event.block.BlockPistonEvent;
|
||||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||||
|
import org.bukkit.event.block.EntityBlockFormEvent;
|
||||||
import org.bukkit.event.block.SignChangeEvent;
|
import org.bukkit.event.block.SignChangeEvent;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -31,6 +33,26 @@ import java.util.List;
|
|||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class BlockEventListener implements Listener {
|
public class BlockEventListener implements Listener {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detects snowmen ruining portals
|
||||||
|
*
|
||||||
|
* @param event <p>The triggered event</p>
|
||||||
|
*/
|
||||||
|
@EventHandler
|
||||||
|
public void onBlockFormedByEntity(EntityBlockFormEvent event) {
|
||||||
|
if (event.isCancelled() || (!Stargate.protectEntrance && !Stargate.verifyPortals)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//We are only interested in snowman events
|
||||||
|
if (!(event.getEntity() instanceof Snowman)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//Cancel the event if a snowman is trying to place snow in the portal's entrance
|
||||||
|
if (PortalHandler.getByEntrance(event.getBlock()) != null) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detects sign changes to detect if the user is creating a new gate
|
* Detects sign changes to detect if the user is creating a new gate
|
||||||
*
|
*
|
||||||
@ -66,7 +88,7 @@ public class BlockEventListener implements Listener {
|
|||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onBlockBreak(BlockBreakEvent event) {
|
public void onBlockBreak(BlockBreakEvent event) {
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled() || !Stargate.protectEntrance) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
@ -74,7 +96,7 @@ public class BlockEventListener implements Listener {
|
|||||||
|
|
||||||
//Decide if a portal is broken
|
//Decide if a portal is broken
|
||||||
Portal portal = PortalHandler.getByBlock(block);
|
Portal portal = PortalHandler.getByBlock(block);
|
||||||
if (portal == null && Stargate.protectEntrance) {
|
if (portal == null) {
|
||||||
portal = PortalHandler.getByEntrance(block);
|
portal = PortalHandler.getByEntrance(block);
|
||||||
}
|
}
|
||||||
if (portal == null) {
|
if (portal == null) {
|
||||||
|
@ -214,16 +214,13 @@ public class Gate {
|
|||||||
* @return <p>Whether this is used in the context of creating a new gate</p>
|
* @return <p>Whether this is used in the context of creating a new gate</p>
|
||||||
*/
|
*/
|
||||||
private boolean verifyGateEntrancesMatch(BlockLocation topLeft, double yaw, boolean onCreate) {
|
private boolean verifyGateEntrancesMatch(BlockLocation topLeft, double yaw, boolean onCreate) {
|
||||||
if (Stargate.ignoreEntrance) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
Stargate.debug("verifyGateEntrancesMatch", String.valueOf(topLeft));
|
Stargate.debug("verifyGateEntrancesMatch", String.valueOf(topLeft));
|
||||||
for (RelativeBlockVector entranceVector : layout.getEntrances()) {
|
for (RelativeBlockVector entranceVector : layout.getEntrances()) {
|
||||||
Stargate.debug("verifyGateEntrancesMatch", String.valueOf(entranceVector));
|
Stargate.debug("verifyGateEntrancesMatch", String.valueOf(entranceVector));
|
||||||
Material type = getBlockAt(topLeft, entranceVector, yaw).getType();
|
Material type = getBlockAt(topLeft, entranceVector, yaw).getType();
|
||||||
|
|
||||||
//Ignore entrance if it's air, and we're creating a new gate
|
//Ignore entrance if it's air or water, and we're creating a new gate
|
||||||
if (onCreate && type == Material.AIR) {
|
if (onCreate && (type == Material.AIR || type == Material.WATER)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,6 +52,12 @@ public class PortalHandler {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets names of all portals within a network
|
||||||
|
*
|
||||||
|
* @param network <p>The network to get portals from</p>
|
||||||
|
* @return <p>A list of portal names</p>
|
||||||
|
*/
|
||||||
public static List<String> getNetwork(String network) {
|
public static List<String> getNetwork(String network) {
|
||||||
return allPortalNetworks.get(network.toLowerCase());
|
return allPortalNetworks.get(network.toLowerCase());
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,8 @@ default-gate-network=gates.defaultGateNetwork
|
|||||||
destroyexplosion=gates.integrity.destroyedByExplosion
|
destroyexplosion=gates.integrity.destroyedByExplosion
|
||||||
maxgates=gates.maxGatesEachNetwork
|
maxgates=gates.maxGatesEachNetwork
|
||||||
destMemory=gates.cosmetic.rememberDestination
|
destMemory=gates.cosmetic.rememberDestination
|
||||||
ignoreEntrance=gates.integrity.ignoreEntrance
|
ignoreEntrance=
|
||||||
|
gates.integrity.ignoreEntrance=
|
||||||
handleVehicles=gates.functionality.handleVehicles
|
handleVehicles=gates.functionality.handleVehicles
|
||||||
sortLists=gates.cosmetic.sortNetworkDestinations
|
sortLists=gates.cosmetic.sortNetworkDestinations
|
||||||
protectEntrance=gates.integrity.protectEntrance
|
protectEntrance=gates.integrity.protectEntrance
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
# maxGatesEachNetwork - The maximum number of gates allowed on a network - 0 for unlimited
|
# maxGatesEachNetwork - The maximum number of gates allowed on a network - 0 for unlimited
|
||||||
# language - The language file to load for messages
|
# language - The language file to load for messages
|
||||||
# rememberDestination - Whether to remember the cursor location between uses
|
# rememberDestination - Whether to remember the cursor location between uses
|
||||||
# ignoreEntrance - Ignore the entrance blocks of a gate when checking. Used to work around snowmen
|
|
||||||
# handleVehicles - Whether to allow vehicles through gates
|
# handleVehicles - Whether to allow vehicles through gates
|
||||||
# sortNetworkDestinations - Whether to sort network lists alphabetically
|
# sortNetworkDestinations - Whether to sort network lists alphabetically
|
||||||
# protectEntrance - Whether to protect gate entrance material (More resource intensive. Only enable if using destroyable open/closed material)
|
# protectEntrance - Whether to protect gate entrance material (More resource intensive. Only enable if using destroyable open/closed material)
|
||||||
@ -45,7 +44,6 @@ gates:
|
|||||||
destroyedByExplosion: false
|
destroyedByExplosion: false
|
||||||
verifyPortals: false
|
verifyPortals: false
|
||||||
protectEntrance: false
|
protectEntrance: false
|
||||||
ignoreEntrance: false
|
|
||||||
functionality:
|
functionality:
|
||||||
enableBungee: false
|
enableBungee: false
|
||||||
handleVehicles: true
|
handleVehicles: true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user