Minor changes to npe detection and denied commands
This commit is contained in:
		
							parent
							
								
									7626aed06a
								
							
						
					
					
						commit
						7ce0100e73
					
				@ -101,7 +101,6 @@ public class BoardColls extends XColls<BoardColl, Board> implements BoardInterfa
 | 
				
			|||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public TerritoryAccess getTerritoryAccessAt(PS ps)
 | 
						public TerritoryAccess getTerritoryAccessAt(PS ps)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if (ps == null) return null;
 | 
					 | 
				
			||||||
		BoardColl coll = this.getForWorld(ps.getWorld());
 | 
							BoardColl coll = this.getForWorld(ps.getWorld());
 | 
				
			||||||
		if (coll == null) return null;
 | 
							if (coll == null) return null;
 | 
				
			||||||
		return coll.getTerritoryAccessAt(ps);
 | 
							return coll.getTerritoryAccessAt(ps);
 | 
				
			||||||
@ -110,7 +109,6 @@ public class BoardColls extends XColls<BoardColl, Board> implements BoardInterfa
 | 
				
			|||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public Faction getFactionAt(PS ps)
 | 
						public Faction getFactionAt(PS ps)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if (ps == null) return null;
 | 
					 | 
				
			||||||
		BoardColl coll = this.getForWorld(ps.getWorld());
 | 
							BoardColl coll = this.getForWorld(ps.getWorld());
 | 
				
			||||||
		if (coll == null) return null;
 | 
							if (coll == null) return null;
 | 
				
			||||||
		return coll.getFactionAt(ps);
 | 
							return coll.getFactionAt(ps);
 | 
				
			||||||
@ -121,7 +119,6 @@ public class BoardColls extends XColls<BoardColl, Board> implements BoardInterfa
 | 
				
			|||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public void setTerritoryAccessAt(PS ps, TerritoryAccess territoryAccess)
 | 
						public void setTerritoryAccessAt(PS ps, TerritoryAccess territoryAccess)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if (ps == null) return;
 | 
					 | 
				
			||||||
		BoardColl coll = this.getForWorld(ps.getWorld());
 | 
							BoardColl coll = this.getForWorld(ps.getWorld());
 | 
				
			||||||
		if (coll == null) return;
 | 
							if (coll == null) return;
 | 
				
			||||||
		coll.setTerritoryAccessAt(ps, territoryAccess);
 | 
							coll.setTerritoryAccessAt(ps, territoryAccess);
 | 
				
			||||||
@ -130,7 +127,6 @@ public class BoardColls extends XColls<BoardColl, Board> implements BoardInterfa
 | 
				
			|||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public void setFactionAt(PS ps, Faction faction)
 | 
						public void setFactionAt(PS ps, Faction faction)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if (ps == null) return;
 | 
					 | 
				
			||||||
		BoardColl coll = this.getForWorld(ps.getWorld());
 | 
							BoardColl coll = this.getForWorld(ps.getWorld());
 | 
				
			||||||
		if (coll == null) return;
 | 
							if (coll == null) return;
 | 
				
			||||||
		coll.setFactionAt(ps, faction);
 | 
							coll.setFactionAt(ps, faction);
 | 
				
			||||||
@ -141,7 +137,6 @@ public class BoardColls extends XColls<BoardColl, Board> implements BoardInterfa
 | 
				
			|||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public void removeAt(PS ps)
 | 
						public void removeAt(PS ps)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if (ps == null) return;
 | 
					 | 
				
			||||||
		BoardColl coll = this.getForWorld(ps.getWorld());
 | 
							BoardColl coll = this.getForWorld(ps.getWorld());
 | 
				
			||||||
		if (coll == null) return;
 | 
							if (coll == null) return;
 | 
				
			||||||
		coll.removeAt(ps);
 | 
							coll.removeAt(ps);
 | 
				
			||||||
@ -194,7 +189,6 @@ public class BoardColls extends XColls<BoardColl, Board> implements BoardInterfa
 | 
				
			|||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public boolean isBorderPs(PS ps)
 | 
						public boolean isBorderPs(PS ps)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if (ps == null) return false;
 | 
					 | 
				
			||||||
		BoardColl coll = this.getForWorld(ps.getWorld());
 | 
							BoardColl coll = this.getForWorld(ps.getWorld());
 | 
				
			||||||
		if (coll == null) return false;
 | 
							if (coll == null) return false;
 | 
				
			||||||
		return coll.isBorderPs(ps);
 | 
							return coll.isBorderPs(ps);
 | 
				
			||||||
@ -203,7 +197,6 @@ public class BoardColls extends XColls<BoardColl, Board> implements BoardInterfa
 | 
				
			|||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public boolean isConnectedPs(PS ps, Faction faction)
 | 
						public boolean isConnectedPs(PS ps, Faction faction)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if (ps == null) return false;
 | 
					 | 
				
			||||||
		BoardColl coll = this.getForWorld(ps.getWorld());
 | 
							BoardColl coll = this.getForWorld(ps.getWorld());
 | 
				
			||||||
		if (coll == null) return false;
 | 
							if (coll == null) return false;
 | 
				
			||||||
		return coll.isConnectedPs(ps, faction);
 | 
							return coll.isConnectedPs(ps, faction);
 | 
				
			||||||
@ -214,7 +207,6 @@ public class BoardColls extends XColls<BoardColl, Board> implements BoardInterfa
 | 
				
			|||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public ArrayList<String> getMap(RelationParticipator observer, PS centerPs, double inDegrees)
 | 
						public ArrayList<String> getMap(RelationParticipator observer, PS centerPs, double inDegrees)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if (centerPs == null) return null;
 | 
					 | 
				
			||||||
		BoardColl coll = this.getForWorld(centerPs.getWorld());
 | 
							BoardColl coll = this.getForWorld(centerPs.getWorld());
 | 
				
			||||||
		if (coll == null) return null;
 | 
							if (coll == null) return null;
 | 
				
			||||||
		return coll.getMap(observer, centerPs, inDegrees);
 | 
							return coll.getMap(observer, centerPs, inDegrees);
 | 
				
			||||||
 | 
				
			|||||||
@ -515,12 +515,6 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
 | 
				
			|||||||
		return RelationUtil.getRelationOfThatToMe(this, observer, ignorePeaceful);
 | 
							return RelationUtil.getRelationOfThatToMe(this, observer, ignorePeaceful);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public Rel getRelationToLocation()
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		// TODO: Use some built in system to get sender
 | 
					 | 
				
			||||||
		return BoardColls.get().getFactionAt(PS.valueOf(this.getPlayer())).getRelationTo(this);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public ChatColor getColorTo(RelationParticipator observer)
 | 
						public ChatColor getColorTo(RelationParticipator observer)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
				
			|||||||
@ -454,10 +454,13 @@ public class FactionsListenerMain implements Listener
 | 
				
			|||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// ... the command may be denied in the territory of this relation type ...
 | 
							// ... if there is a faction at the players location ...
 | 
				
			||||||
		Rel rel = uplayer.getRelationToLocation();
 | 
					 | 
				
			||||||
		PS ps = PS.valueOf(player).getChunk(true);
 | 
							PS ps = PS.valueOf(player).getChunk(true);
 | 
				
			||||||
		if (BoardColls.get().getFactionAt(ps).isNone()) return;
 | 
							Faction factionAtPs = BoardColls.get().getFactionAt(ps);
 | 
				
			||||||
 | 
							if (factionAtPs.isNone()) return;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							// ... the command may be denied in the territory of this relation type ...
 | 
				
			||||||
 | 
							Rel rel = factionAtPs.getRelationTo(uplayer);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		List<String> deniedCommands = UConf.get(player).denyCommandsTerritoryRelation.get(rel);
 | 
							List<String> deniedCommands = UConf.get(player).denyCommandsTerritoryRelation.get(rel);
 | 
				
			||||||
		if (deniedCommands == null) return;
 | 
							if (deniedCommands == null) return;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user