Search in sources :

Example 1 with CellBorder

use of com.palmergames.bukkit.towny.object.CellBorder in project Towny by ElgarL.

the class BorderUtil method getPlotBorder.

public static List<CellBorder> getPlotBorder(List<WorldCoord> worldCoords) {
    List<CellBorder> borderCoords = new ArrayList<CellBorder>();
    for (WorldCoord worldCoord : worldCoords) {
        CellBorder border = getPlotBorder(worldCoord);
        borderCoords.add(border);
    }
    return borderCoords;
}
Also used : WorldCoord(com.palmergames.bukkit.towny.object.WorldCoord) CellBorder(com.palmergames.bukkit.towny.object.CellBorder) ArrayList(java.util.ArrayList)

Example 2 with CellBorder

use of com.palmergames.bukkit.towny.object.CellBorder in project Towny by ElgarL.

the class TownyCustomListener method onPlayerChangePlotEvent.

@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerChangePlotEvent(PlayerChangePlotEvent event) {
    Player player = event.getPlayer();
    WorldCoord from = event.getFrom();
    WorldCoord to = event.getTo();
    // TODO: Player mode
    if (plugin.hasPlayerMode(player, "townclaim"))
        TownCommand.parseTownClaimCommand(player, new String[] {});
    if (plugin.hasPlayerMode(player, "townunclaim"))
        TownCommand.parseTownUnclaimCommand(player, new String[] {});
    if (plugin.hasPlayerMode(player, "map"))
        TownyCommand.showMap(player);
    // Check if player has entered a new town/wilderness
    try {
        if (to.getTownyWorld().isUsingTowny() && TownySettings.getShowTownNotifications()) {
            ChunkNotification chunkNotifier = new ChunkNotification(from, to);
            String msg = chunkNotifier.getNotificationString();
            if (msg != null)
                player.sendMessage(msg);
        }
    } catch (NotRegisteredException e) {
        e.printStackTrace();
    }
    if (plugin.hasPlayerMode(player, "plotborder")) {
        CellBorder cellBorder = BorderUtil.getPlotBorder(to);
        cellBorder.runBorderedOnSurface(1, 2, DrawSmokeTaskFactory.sendToPlayer(player));
    }
}
Also used : Player(org.bukkit.entity.Player) WorldCoord(com.palmergames.bukkit.towny.object.WorldCoord) NotRegisteredException(com.palmergames.bukkit.towny.exceptions.NotRegisteredException) CellBorder(com.palmergames.bukkit.towny.object.CellBorder) ChunkNotification(com.palmergames.bukkit.towny.ChunkNotification) EventHandler(org.bukkit.event.EventHandler)

Aggregations

CellBorder (com.palmergames.bukkit.towny.object.CellBorder)2 WorldCoord (com.palmergames.bukkit.towny.object.WorldCoord)2 ChunkNotification (com.palmergames.bukkit.towny.ChunkNotification)1 NotRegisteredException (com.palmergames.bukkit.towny.exceptions.NotRegisteredException)1 ArrayList (java.util.ArrayList)1 Player (org.bukkit.entity.Player)1 EventHandler (org.bukkit.event.EventHandler)1