Skip to content

Commit

Permalink
Scoreboard 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
garnesen committed Jul 19, 2015
1 parent ac6dd27 commit 4a3afac
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,20 @@ public class TownScoredEvent extends Event {

@Override
public HandlerList getHandlers() {

return handlers;
}

public static HandlerList getHandlerList() {

return handlers;
}

private Town town;

public TownScoredEvent (Town town)
{
super();
this.town = town;
}

Expand Down
20 changes: 11 additions & 9 deletions src/com/palmergames/bukkit/towny/war/eventwar/WarListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import org.bukkit.event.player.PlayerQuitEvent;

import com.palmergames.bukkit.towny.Towny;
import com.palmergames.bukkit.towny.TownyMessaging;
import com.palmergames.bukkit.towny.event.PlayerChangePlotEvent;
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
import com.palmergames.bukkit.towny.object.Resident;
import com.palmergames.bukkit.towny.object.Town;
Expand All @@ -19,39 +21,39 @@
public class WarListener implements Listener {

Towny plugin;

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

@EventHandler
public void onPlayerQuit(PlayerQuitEvent event)
{
TownyMessaging.sendDebugMsg("[HUD] player quit game");
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)){
warEvent.togglePlayerHud(p);
}
}

@EventHandler
public void onPlayerMoveDuringWar(PlayerMoveEvent event) throws NotRegisteredException
public void onPlayerMoveDuringWar(PlayerChangePlotEvent event) throws NotRegisteredException
{
TownyMessaging.sendDebugMsg("[HUD] player change plot");
War warEvent = plugin.getTownyUniverse().getWarEvent();
Player p = event.getPlayer();
if (!warEvent.getPlayersWithHUD().containsKey(p))
return;
if (!event.getFrom().getChunk().equals(event.getTo().getChunk()))
{
warEvent.getPlayersWithHUD().get(p).updateLocation();
}
warEvent.getPlayersWithHUD().get(p).updateLocation();
}

@EventHandler
public void onTownScored (TownScoredEvent event)
{
TownyMessaging.sendDebugMsg("[HUD] town scored event caught");
//Update town score
War warEvent = plugin.getTownyUniverse().getWarEvent();
for (Resident r : event.getTown().getResidents())
Expand Down

0 comments on commit 4a3afac

Please sign in to comment.