001 package org.bukkit.event.player; 002 003 import org.bukkit.Achievement; 004 import org.bukkit.entity.Player; 005 import org.bukkit.event.Cancellable; 006 import org.bukkit.event.HandlerList; 007 008 /** 009 * Called when a player earns an achievement. 010 */ 011 public class PlayerAchievementAwardedEvent extends PlayerEvent implements Cancellable { 012 private static final HandlerList handlers = new HandlerList(); 013 private final Achievement achievement; 014 private boolean isCancelled = false; 015 016 public PlayerAchievementAwardedEvent(Player player, Achievement achievement) { 017 super(player); 018 this.achievement = achievement; 019 } 020 021 /** 022 * Gets the Achievement being awarded. 023 * 024 * @return the achievement being awarded 025 */ 026 public Achievement getAchievement() { 027 return achievement; 028 } 029 030 public boolean isCancelled() { 031 return isCancelled; 032 } 033 034 public void setCancelled(boolean cancel) { 035 this.isCancelled = cancel; 036 } 037 038 @Override 039 public HandlerList getHandlers() { 040 return handlers; 041 } 042 043 public static HandlerList getHandlerList() { 044 return handlers; 045 } 046 }