use of com.palmergames.bukkit.towny.ChunkNotification 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));
}
}
Aggregations