changes towards enabling the hide feature
This commit is contained in:
		@@ -28,6 +28,7 @@ public class Gate
 | 
				
			|||||||
	private transient String id;
 | 
						private transient String id;
 | 
				
			||||||
	private Location from;
 | 
						private Location from;
 | 
				
			||||||
	private Location to;
 | 
						private Location to;
 | 
				
			||||||
 | 
						private boolean isHidden = false;
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
    private Integer[][] gateBlocks;
 | 
					    private Integer[][] gateBlocks;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -110,12 +111,11 @@ public class Gate
 | 
				
			|||||||
	public boolean open() 
 | 
						public boolean open() 
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		Set<Block> blocks = FloodUtil.getGateFrameBlocks(from.getBlock());
 | 
							Set<Block> blocks = FloodUtil.getGateFrameBlocks(from.getBlock());
 | 
				
			||||||
 | 
							setGateBlocks(blocks);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if (blocks == null)
 | 
							if (blocks == null)
 | 
				
			||||||
			return false;
 | 
								return false;
 | 
				
			||||||
                
 | 
					                
 | 
				
			||||||
        // Uncomment lines below to have the old Portal open functionality back.
 | 
					 | 
				
			||||||
                
 | 
					 | 
				
			||||||
		// This is not to do an effect
 | 
							// This is not to do an effect
 | 
				
			||||||
		// It is to stop portal blocks from destroying themself as they cant rely on non created blocks :P
 | 
							// It is to stop portal blocks from destroying themself as they cant rely on non created blocks :P
 | 
				
			||||||
		for (Block block : blocks)
 | 
							for (Block block : blocks)
 | 
				
			||||||
@@ -124,6 +124,7 @@ public class Gate
 | 
				
			|||||||
		for (Block block : blocks)
 | 
							for (Block block : blocks)
 | 
				
			||||||
			block.setType(Material.PORTAL);
 | 
								block.setType(Material.PORTAL);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
							
 | 
				
			||||||
		return true;
 | 
							return true;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
@@ -143,6 +144,22 @@ public class Gate
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
						//----------------------------------------------//
 | 
				
			||||||
 | 
						// isHidden Setter and Getter
 | 
				
			||||||
 | 
						//----------------------------------------------//
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						public void setHidden(boolean isHidden)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							this.isHidden = isHidden;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						public boolean isHidden()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return this.isHidden;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	//----------------------------------------------//
 | 
						//----------------------------------------------//
 | 
				
			||||||
	// Persistance and entity management
 | 
						// Persistance and entity management
 | 
				
			||||||
	//----------------------------------------------//
 | 
						//----------------------------------------------//
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,13 +32,6 @@ public class PluginPlayerListener implements Listener
 | 
				
			|||||||
		Block blockTo = event.getTo().getBlock();
 | 
							Block blockTo = event.getTo().getBlock();
 | 
				
			||||||
		Block blockToUp = blockTo.getRelative(BlockFace.UP);
 | 
							Block blockToUp = blockTo.getRelative(BlockFace.UP);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
					 | 
				
			||||||
		// Check if player is standing inside a portal
 | 
					 | 
				
			||||||
		if (blockTo.getType() != Material.PORTAL && blockToUp.getType() != Material.PORTAL)         
 | 
					 | 
				
			||||||
			return;
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		// Ok so a player walks into a portal block
 | 
					 | 
				
			||||||
		// Find the nearest gate!
 | 
							// Find the nearest gate!
 | 
				
			||||||
		Gate nearestGate = null;
 | 
							Gate nearestGate = null;
 | 
				
			||||||
		Location playerLocation = event.getPlayer().getLocation();
 | 
							Location playerLocation = event.getPlayer().getLocation();
 | 
				
			||||||
@@ -65,8 +58,7 @@ public class PluginPlayerListener implements Listener
 | 
				
			|||||||
            {
 | 
					            {
 | 
				
			||||||
                if ((blockTo.getX() == blockXYZ[0] || blockToUp.getX() == blockXYZ[0]) &&
 | 
					                if ((blockTo.getX() == blockXYZ[0] || blockToUp.getX() == blockXYZ[0]) &&
 | 
				
			||||||
                    (blockTo.getY() == blockXYZ[1] || blockToUp.getY() == blockXYZ[1]) &&
 | 
					                    (blockTo.getY() == blockXYZ[1] || blockToUp.getY() == blockXYZ[1]) &&
 | 
				
			||||||
                     (blockTo.getZ() == blockXYZ[2] || blockToUp.getZ() == blockXYZ[2])
 | 
					                    (blockTo.getZ() == blockXYZ[2] || blockToUp.getZ() == blockXYZ[2])) 
 | 
				
			||||||
                   ) 
 | 
					 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    nearestGate = gate;
 | 
					                    nearestGate = gate;
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
@@ -81,10 +73,15 @@ public class PluginPlayerListener implements Listener
 | 
				
			|||||||
		
 | 
							
 | 
				
			||||||
		if (nearestGate != null) 
 | 
							if (nearestGate != null) 
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 | 
								if (nearestGate.isHidden() == false)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									// Check if player is standing inside portal blocks
 | 
				
			||||||
 | 
									if (blockTo.getType() != Material.PORTAL && blockToUp.getType() != Material.PORTAL)         
 | 
				
			||||||
 | 
										return;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								
 | 
				
			||||||
			checkChunkLoad(nearestGate.getTo().getBlock());
 | 
								checkChunkLoad(nearestGate.getTo().getBlock());
 | 
				
			||||||
			
 | 
					 | 
				
			||||||
            Float newYaw = nearestGate.getFrom().getYaw() - nearestGate.getTo().getYaw() + playerLocation.getYaw();
 | 
					            Float newYaw = nearestGate.getFrom().getYaw() - nearestGate.getTo().getYaw() + playerLocation.getYaw();
 | 
				
			||||||
            
 | 
					 | 
				
			||||||
            Location teleportToLocation = new Location( nearestGate.getTo().getWorld(),
 | 
					            Location teleportToLocation = new Location( nearestGate.getTo().getWorld(),
 | 
				
			||||||
                                						nearestGate.getTo().getX(),
 | 
					                                						nearestGate.getTo().getX(),
 | 
				
			||||||
						                                nearestGate.getTo().getY(),
 | 
											                                nearestGate.getTo().getY(),
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user