Skip to content

Commit

Permalink
Scoreboard crash fix 2
Browse files Browse the repository at this point in the history
  • Loading branch information
garnesen committed Jul 16, 2015
1 parent 7851718 commit 74df655
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@

public class WarListener implements Listener {

War warEvent;
Towny plugin;

public WarListener(Towny plugin)
{
warEvent = plugin.getTownyUniverse().getWarEvent();
this.plugin = plugin;
}

@EventHandler
public void onPlayerQuit(PlayerQuitEvent event)
{
War warEvent = plugin.getTownyUniverse().getWarEvent();
//Removes a player from the HUD list on logout
Player p = event.getPlayer();
if (warEvent.isWarTime() && warEvent.getPlayersWithHUD().containsKey(p)){
Expand All @@ -33,6 +34,7 @@ public void onPlayerQuit(PlayerQuitEvent event)
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) throws NotRegisteredException
{
War warEvent = plugin.getTownyUniverse().getWarEvent();
Player p = event.getPlayer();
if (!warEvent.getPlayersWithHUD().containsKey(p))
return;
Expand All @@ -45,6 +47,7 @@ public void onPlayerMove(PlayerMoveEvent event) throws NotRegisteredException
@EventHandler
public void onTownScored (TownScoredEvent event)
{
War warEvent = plugin.getTownyUniverse().getWarEvent();
for (Resident r : event.getTown().getResidents())
{
Player player = BukkitTools.getPlayer(r.getName());
Expand Down

0 comments on commit 74df655

Please sign in to comment.