Fixing some NPE and similar small issues.

This commit is contained in:
Olof Larsson 2013-04-18 20:28:12 +02:00
parent 5ddfb19861
commit f70cc283db
6 changed files with 13 additions and 9 deletions

View File

@ -226,6 +226,7 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
// Next we must be attached and inited // Next we must be attached and inited
if (!this.attached()) return; if (!this.attached()) return;
if (!this.getColl().inited()) return; if (!this.getColl().inited()) return;
if (!FactionColl.get().inited()) return;
// Spout Derp // Spout Derp
SpoutFeatures.updateTitle(this, null); SpoutFeatures.updateTitle(this, null);
@ -375,12 +376,12 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
public double getPowerMax() public double getPowerMax()
{ {
return ConfServer.powerMax + this.powerBoost; return ConfServer.powerMax + this.getPowerBoost();
} }
public double getPowerMin() public double getPowerMin()
{ {
return ConfServer.powerMin + this.powerBoost; return ConfServer.powerMin + this.getPowerBoost();
} }
public void recalculatePower() public void recalculatePower()

View File

@ -71,6 +71,7 @@ public class FPlayerColl extends SenderColl<FPlayer>
// If inited ... // If inited ...
if (!this.inited()) return ret; if (!this.inited()) return ret;
if (!FactionColl.get().inited()) return ret;
// ... update the index. // ... update the index.
Faction faction = entity.getFaction(); Faction faction = entity.getFaction();

View File

@ -74,6 +74,7 @@ public class LWCFeatures
for (BlockState blockState : chunk.getTileEntities()) for (BlockState blockState : chunk.getTileEntities())
{ {
// TODO: Can something else be protected by LWC? Or is it really only chests? // TODO: Can something else be protected by LWC? Or is it really only chests?
// TODO: How about we run through each block in the chunk just to be on the safe side?
if (blockState.getType() != Material.CHEST) continue; if (blockState.getType() != Material.CHEST) continue;
Block block = blockState.getBlock(); Block block = blockState.getBlock();

View File

@ -10,7 +10,7 @@ import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.ApplicableRegionSet; import com.sk89q.worldguard.protection.ApplicableRegionSet;
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion; import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
import com.sk89q.worldguard.protection.regions.ProtectedRegion; import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import static com.sk89q.worldguard.bukkit.BukkitUtil.*; import static com.sk89q.worldguard.bukkit.BukkitUtil.toVector;
import com.sk89q.worldguard.protection.flags.DefaultFlag; import com.sk89q.worldguard.protection.flags.DefaultFlag;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
@ -60,7 +60,7 @@ public class Worldguard
// False: PVP is disallowed // False: PVP is disallowed
public static boolean isPVP(Player player) public static boolean isPVP(Player player)
{ {
if( ! enabled) if ( ! enabled)
{ {
// No WG hooks so we'll always bypass this check. // No WG hooks so we'll always bypass this check.
return true; return true;
@ -81,7 +81,7 @@ public class Worldguard
// False: No regions found within chunk // False: No regions found within chunk
public static boolean checkForRegionsInChunk(Location loc) public static boolean checkForRegionsInChunk(Location loc)
{ {
if( ! enabled) if ( ! enabled)
{ {
// No WG hooks so we'll always bypass this check. // No WG hooks so we'll always bypass this check.
return false; return false;
@ -109,7 +109,7 @@ public class Worldguard
try try
{ {
overlaps = region.getIntersectingRegions(allregionslist); overlaps = region.getIntersectingRegions(allregionslist);
if(overlaps == null || overlaps.isEmpty()) if (overlaps == null || overlaps.isEmpty())
{ {
foundregions = false; foundregions = false;
} }

View File

@ -1,6 +1,5 @@
package com.massivecraft.factions.integration.herochat; package com.massivecraft.factions.integration.herochat;
import com.dthielke.herochat.Herochat;
import com.massivecraft.mcore.integration.IntegrationFeaturesAbstract; import com.massivecraft.mcore.integration.IntegrationFeaturesAbstract;
public class HerochatFeatures extends IntegrationFeaturesAbstract public class HerochatFeatures extends IntegrationFeaturesAbstract
@ -20,8 +19,6 @@ public class HerochatFeatures extends IntegrationFeaturesAbstract
@Override @Override
public void activate() public void activate()
{ {
Herochat.getChannelManager().addChannel(new FactionChannel());
Herochat.getChannelManager().addChannel(new AlliesChannel());
HerochatListener.get().activate(); HerochatListener.get().activate();
} }

View File

@ -7,6 +7,7 @@ import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import com.dthielke.herochat.ChannelChatEvent; import com.dthielke.herochat.ChannelChatEvent;
import com.dthielke.herochat.Herochat;
import com.massivecraft.factions.ConfServer; import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.chat.ChatFormatter; import com.massivecraft.factions.chat.ChatFormatter;
@ -28,6 +29,9 @@ public class HerochatListener implements Listener
public void activate() public void activate()
{ {
Herochat.getChannelManager().addChannel(new FactionChannel());
Herochat.getChannelManager().addChannel(new AlliesChannel());
Bukkit.getPluginManager().registerEvents(this, Factions.get()); Bukkit.getPluginManager().registerEvents(this, Factions.get());
} }