expanding the abstraction (this is going to happen a lot)

This commit is contained in:
nossr50
2019-02-13 09:02:30 -08:00
parent 4461cfacd2
commit 261d571be1
69 changed files with 158 additions and 106 deletions

View File

@ -4,7 +4,7 @@ import com.gmail.nossr50.core.data.UserManager;
import com.gmail.nossr50.core.datatypes.party.Party;
import com.gmail.nossr50.core.locale.LocaleLoader;
import com.gmail.nossr50.core.party.PartyManager;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.core.events.party.McMMOPartyChangeEvent.EventReason;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

View File

@ -5,7 +5,7 @@ import com.gmail.nossr50.core.datatypes.party.Party;
import com.gmail.nossr50.core.locale.LocaleLoader;
import com.gmail.nossr50.core.party.PartyManager;
import com.gmail.nossr50.core.util.commands.CommandUtils;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.core.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.mcMMO;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;

View File

@ -5,7 +5,7 @@ import com.gmail.nossr50.core.datatypes.party.Party;
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.core.locale.LocaleLoader;
import com.gmail.nossr50.core.party.PartyManager;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.core.events.party.McMMOPartyChangeEvent.EventReason;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

View File

@ -5,7 +5,7 @@ import com.gmail.nossr50.core.datatypes.party.Party;
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.core.locale.LocaleLoader;
import com.gmail.nossr50.core.party.PartyManager;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.core.events.party.McMMOPartyChangeEvent.EventReason;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

View File

@ -1,16 +0,0 @@
package com.gmail.nossr50.events.chat;
import org.bukkit.plugin.Plugin;
/**
* Called when a chat is sent to the admin chat channel
*/
public class McMMOAdminChatEvent extends McMMOChatEvent {
public McMMOAdminChatEvent(Plugin plugin, String sender, String displayName, String message) {
super(plugin, sender, displayName, message);
}
public McMMOAdminChatEvent(Plugin plugin, String sender, String displayName, String message, boolean isAsync) {
super(plugin, sender, displayName, message, isAsync);
}
}

View File

@ -1,97 +0,0 @@
package com.gmail.nossr50.events.chat;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.Plugin;
public abstract class McMMOChatEvent extends Event implements Cancellable {
/**
* Rest of file is required boilerplate for custom events
**/
private static final HandlerList handlers = new HandlerList();
private boolean cancelled;
private Plugin plugin;
private String sender;
private String displayName;
private String message;
protected McMMOChatEvent(Plugin plugin, String sender, String displayName, String message) {
this.plugin = plugin;
this.sender = sender;
this.displayName = displayName;
this.message = message;
}
protected McMMOChatEvent(Plugin plugin, String sender, String displayName, String message, boolean isAsync) {
super(isAsync);
this.plugin = plugin;
this.sender = sender;
this.displayName = displayName;
this.message = message;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* @return The plugin responsible for this event, note this can be null
*/
public Plugin getPlugin() {
return plugin;
}
/**
* @return String name of the player who sent the chat, or "Console"
*/
public String getSender() {
return sender;
}
/**
* @return String display name of the player who sent the chat, or "Console"
*/
public String getDisplayName() {
return displayName;
}
/**
* @param displayName String display name of the player who sent the chat
*/
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
/**
* @return String message that will be sent
*/
public String getMessage() {
return message;
}
/**
* @param message String message to be sent in chat
*/
public void setMessage(String message) {
this.message = message;
}
/**
* Following are required for Cancellable
**/
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
}

View File

@ -1,27 +0,0 @@
package com.gmail.nossr50.events.chat;
import org.bukkit.plugin.Plugin;
/**
* Called when a chat is sent to a party channel
*/
public class McMMOPartyChatEvent extends McMMOChatEvent {
private String party;
public McMMOPartyChatEvent(Plugin plugin, String sender, String displayName, String party, String message) {
super(plugin, sender, displayName, message);
this.party = party;
}
public McMMOPartyChatEvent(Plugin plugin, String sender, String displayName, String party, String message, boolean isAsync) {
super(plugin, sender, displayName, message, isAsync);
this.party = party;
}
/**
* @return String name of the party the message will be sent to
*/
public String getParty() {
return party;
}
}

View File

@ -1,78 +0,0 @@
package com.gmail.nossr50.events.experience;
import com.gmail.nossr50.core.data.UserManager;
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
import com.gmail.nossr50.core.skills.PrimarySkillType;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
/**
* Generic event for mcMMO experience events.
*/
public abstract class McMMOPlayerExperienceEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
protected PrimarySkillType skill;
protected int skillLevel;
protected XPGainReason xpGainReason;
private boolean cancelled;
@Deprecated
protected McMMOPlayerExperienceEvent(Player player, PrimarySkillType skill) {
super(player);
this.skill = skill;
this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill);
this.xpGainReason = XPGainReason.UNKNOWN;
}
protected McMMOPlayerExperienceEvent(Player player, PrimarySkillType skill, XPGainReason xpGainReason) {
super(player);
this.skill = skill;
this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill);
this.xpGainReason = xpGainReason;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* @return The skill involved in this event
*/
public PrimarySkillType getSkill() {
return skill;
}
/**
* @return The skill level of the skill involved in this event
*/
public int getSkillLevel() {
return skillLevel;
}
/**
* @return The combat type involved in this event
*/
public XPGainReason getXpGainReason() {
return xpGainReason;
}
/**
* Following are required for Cancellable
**/
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
}

View File

@ -1,19 +0,0 @@
package com.gmail.nossr50.events.experience;
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
import com.gmail.nossr50.core.skills.PrimarySkillType;
import org.bukkit.entity.Player;
/**
* Called when a user levels change
*/
public abstract class McMMOPlayerLevelChangeEvent extends McMMOPlayerExperienceEvent {
@Deprecated
public McMMOPlayerLevelChangeEvent(Player player, PrimarySkillType skill) {
super(player, skill, XPGainReason.UNKNOWN);
}
public McMMOPlayerLevelChangeEvent(Player player, PrimarySkillType skill, XPGainReason xpGainReason) {
super(player, skill, xpGainReason);
}
}

View File

@ -1,59 +0,0 @@
package com.gmail.nossr50.events.experience;
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
import com.gmail.nossr50.core.skills.PrimarySkillType;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
/**
* Called when a user loses levels in a skill
*/
public class McMMOPlayerLevelDownEvent extends McMMOPlayerLevelChangeEvent {
private static final HandlerList handlers = new HandlerList();
private int levelsLost;
@Deprecated
public McMMOPlayerLevelDownEvent(Player player, PrimarySkillType skill) {
super(player, skill, XPGainReason.UNKNOWN);
this.levelsLost = 1;
}
@Deprecated
public McMMOPlayerLevelDownEvent(Player player, PrimarySkillType skill, int levelsLost) {
super(player, skill, XPGainReason.UNKNOWN);
this.levelsLost = levelsLost;
}
public McMMOPlayerLevelDownEvent(Player player, PrimarySkillType skill, XPGainReason xpGainReason) {
super(player, skill, xpGainReason);
this.levelsLost = 1;
}
public McMMOPlayerLevelDownEvent(Player player, PrimarySkillType skill, int levelsLost, XPGainReason xpGainReason) {
super(player, skill, xpGainReason);
this.levelsLost = levelsLost;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* @return The number of levels lost in this event
*/
public int getLevelsLost() {
return levelsLost;
}
/**
* @param levelsLost Set the number of levels lost in this event
*/
public void setLevelsLost(int levelsLost) {
this.levelsLost = levelsLost;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
}

View File

@ -1,59 +0,0 @@
package com.gmail.nossr50.events.experience;
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
import com.gmail.nossr50.core.skills.PrimarySkillType;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
/**
* Called when a user levels up in a skill
*/
public class McMMOPlayerLevelUpEvent extends McMMOPlayerLevelChangeEvent {
private static final HandlerList handlers = new HandlerList();
private int levelsGained;
@Deprecated
public McMMOPlayerLevelUpEvent(Player player, PrimarySkillType skill) {
super(player, skill, XPGainReason.UNKNOWN);
this.levelsGained = 1;
}
@Deprecated
public McMMOPlayerLevelUpEvent(Player player, PrimarySkillType skill, int levelsGained) {
super(player, skill, XPGainReason.UNKNOWN);
this.levelsGained = levelsGained;
}
public McMMOPlayerLevelUpEvent(Player player, PrimarySkillType skill, XPGainReason xpGainReason) {
super(player, skill, xpGainReason);
this.levelsGained = 1;
}
public McMMOPlayerLevelUpEvent(Player player, PrimarySkillType skill, int levelsGained, XPGainReason xpGainReason) {
super(player, skill, xpGainReason);
this.levelsGained = levelsGained;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* @return The number of levels gained in this event
*/
public int getLevelsGained() {
return levelsGained;
}
/**
* @param levelsGained Set the number of levels gained in this event
*/
public void setLevelsGained(int levelsGained) {
this.levelsGained = levelsGained;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
}

View File

@ -1,64 +0,0 @@
package com.gmail.nossr50.events.experience;
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
import com.gmail.nossr50.core.skills.PrimarySkillType;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
/**
* Called when a player gains XP in a skill
*/
public class McMMOPlayerXpGainEvent extends McMMOPlayerExperienceEvent {
private static final HandlerList handlers = new HandlerList();
private float xpGained;
@Deprecated
public McMMOPlayerXpGainEvent(Player player, PrimarySkillType skill, float xpGained) {
super(player, skill, XPGainReason.UNKNOWN);
this.xpGained = xpGained;
}
public McMMOPlayerXpGainEvent(Player player, PrimarySkillType skill, float xpGained, XPGainReason xpGainReason) {
super(player, skill, xpGainReason);
this.xpGained = xpGained;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* @return The amount of experience gained in this event
*/
public float getRawXpGained() {
return xpGained;
}
/**
* @param xpGained int amount of experience gained in this event
*/
public void setRawXpGained(float xpGained) {
this.xpGained = xpGained;
}
/**
* @return int amount of experience gained in this event
*/
@Deprecated
public int getXpGained() {
return (int) xpGained;
}
/**
* @param xpGained int amount of experience gained in this event
*/
@Deprecated
public void setXpGained(int xpGained) {
this.xpGained = xpGained;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
}

View File

@ -1,14 +0,0 @@
package com.gmail.nossr50.events.fake;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockBreakEvent;
/**
* Called when mcMMO breaks a block due to a special ability.
*/
public class FakeBlockBreakEvent extends BlockBreakEvent {
public FakeBlockBreakEvent(Block theBlock, Player player) {
super(theBlock, player);
}
}

View File

@ -1,15 +0,0 @@
package com.gmail.nossr50.events.fake;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.inventory.ItemStack;
/**
* Called when mcMMO damages a block due to a special ability.
*/
public class FakeBlockDamageEvent extends BlockDamageEvent {
public FakeBlockDamageEvent(Player player, Block block, ItemStack itemInHand, boolean instaBreak) {
super(player, block, itemInHand, instaBreak);
}
}

View File

@ -1,11 +0,0 @@
package com.gmail.nossr50.events.fake;
import org.bukkit.block.Block;
import org.bukkit.event.inventory.BrewEvent;
import org.bukkit.inventory.BrewerInventory;
public class FakeBrewEvent extends BrewEvent {
public FakeBrewEvent(Block brewer, BrewerInventory contents, int fuelLevel) {
super(brewer, contents, fuelLevel);
}
}

View File

@ -1,35 +0,0 @@
package com.gmail.nossr50.events.fake;
import com.google.common.base.Function;
import com.google.common.base.Functions;
import org.bukkit.entity.Entity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import java.util.EnumMap;
import java.util.Map;
/**
* Called when mcMMO applies damage from an entity due to special abilities.
*/
public class FakeEntityDamageByEntityEvent extends EntityDamageByEntityEvent {
public FakeEntityDamageByEntityEvent(Entity damager, Entity damagee, DamageCause cause, final Map<DamageModifier, Double> modifiers) {
super(damager, damagee, cause, modifiers, getFunctionModifiers(modifiers));
}
@Deprecated
public FakeEntityDamageByEntityEvent(Entity damager, Entity damagee, DamageCause cause, double damage) {
super(damager, damagee, cause, damage);
}
public static EnumMap<DamageModifier, Function<? super Double, Double>> getFunctionModifiers(Map<DamageModifier, Double> modifiers) {
EnumMap<DamageModifier, Function<? super Double, Double>> modifierFunctions = new EnumMap<DamageModifier, Function<? super Double, Double>>(DamageModifier.class);
Function<? super Double, Double> ZERO = Functions.constant(-0.0);
for (DamageModifier modifier : modifiers.keySet()) {
modifierFunctions.put(modifier, ZERO);
}
return modifierFunctions;
}
}

View File

@ -1,35 +0,0 @@
package com.gmail.nossr50.events.fake;
import com.google.common.base.Function;
import com.google.common.base.Functions;
import org.bukkit.entity.Entity;
import org.bukkit.event.entity.EntityDamageEvent;
import java.util.EnumMap;
import java.util.Map;
/**
* Called when mcMMO applies damage due to special abilities.
*/
public class FakeEntityDamageEvent extends EntityDamageEvent {
public FakeEntityDamageEvent(Entity damagee, DamageCause cause, final Map<DamageModifier, Double> modifiers) {
super(damagee, cause, modifiers, getFunctionModifiers(modifiers));
}
@Deprecated
public FakeEntityDamageEvent(Entity damagee, DamageCause cause, double damage) {
super(damagee, cause, damage);
}
public static EnumMap<DamageModifier, Function<? super Double, Double>> getFunctionModifiers(Map<DamageModifier, Double> modifiers) {
EnumMap<DamageModifier, Function<? super Double, Double>> modifierFunctions = new EnumMap<DamageModifier, Function<? super Double, Double>>(DamageModifier.class);
Function<? super Double, Double> ZERO = Functions.constant(-0.0);
for (DamageModifier modifier : modifiers.keySet()) {
modifierFunctions.put(modifier, ZERO);
}
return modifierFunctions;
}
}

View File

@ -1,14 +0,0 @@
package com.gmail.nossr50.events.fake;
import org.bukkit.entity.AnimalTamer;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityTameEvent;
/**
* Called when mcMMO tames an animal via Call of the Wild
*/
public class FakeEntityTameEvent extends EntityTameEvent {
public FakeEntityTameEvent(LivingEntity entity, AnimalTamer owner) {
super(entity, owner);
}
}

View File

@ -1,13 +0,0 @@
package com.gmail.nossr50.events.fake;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerAnimationEvent;
/**
* Called when handling extra drops to avoid issues with NoCheat.
*/
public class FakePlayerAnimationEvent extends PlayerAnimationEvent {
public FakePlayerAnimationEvent(Player player) {
super(player);
}
}

View File

@ -1,12 +0,0 @@
package com.gmail.nossr50.events.fake;
import org.bukkit.entity.Entity;
import org.bukkit.entity.FishHook;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerFishEvent;
public class FakePlayerFishEvent extends PlayerFishEvent {
public FakePlayerFishEvent(Player player, Entity entity, FishHook hookEntity, State state) {
super(player, entity, hookEntity, state);
}
}

View File

@ -1,69 +0,0 @@
package com.gmail.nossr50.events.hardcore;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
import java.util.HashMap;
public class McMMOPlayerDeathPenaltyEvent extends PlayerEvent implements Cancellable {
/**
* Rest of file is required boilerplate for custom events
**/
private static final HandlerList handlers = new HandlerList();
private HashMap<String, Integer> levelChanged;
private HashMap<String, Float> experienceChanged;
private boolean cancelled;
public McMMOPlayerDeathPenaltyEvent(Player player, HashMap<String, Integer> levelChanged, HashMap<String, Float> experienceChanged) {
super(player);
this.levelChanged = levelChanged;
this.experienceChanged = experienceChanged;
this.cancelled = false;
}
@Deprecated
public McMMOPlayerDeathPenaltyEvent(Player player) {
super(player);
this.cancelled = false;
}
public static HandlerList getHandlerList() {
return handlers;
}
public HashMap<String, Integer> getLevelChanged() {
return levelChanged;
}
public void setLevelChanged(HashMap<String, Integer> levelChanged) {
this.levelChanged = levelChanged;
}
public HashMap<String, Float> getExperienceChanged() {
return experienceChanged;
}
public void setExperienceChanged(HashMap<String, Float> experienceChanged) {
this.experienceChanged = experienceChanged;
}
/**
* Following are required for Cancellable
**/
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
}

View File

@ -1,41 +0,0 @@
package com.gmail.nossr50.events.hardcore;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
public class McMMOPlayerPreDeathPenaltyEvent extends PlayerEvent implements Cancellable {
/**
* Rest of file is required boilerplate for custom events
**/
private static final HandlerList handlers = new HandlerList();
private boolean cancelled;
public McMMOPlayerPreDeathPenaltyEvent(Player player) {
super(player);
this.cancelled = false;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* Following are required for Cancellable
**/
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
}

View File

@ -1,12 +0,0 @@
package com.gmail.nossr50.events.hardcore;
import org.bukkit.entity.Player;
import java.util.HashMap;
public class McMMOPlayerStatLossEvent extends McMMOPlayerDeathPenaltyEvent {
public McMMOPlayerStatLossEvent(Player player, HashMap<String, Integer> levelChanged, HashMap<String, Float> experienceChanged) {
super(player, levelChanged, experienceChanged);
}
}

View File

@ -1,18 +0,0 @@
package com.gmail.nossr50.events.hardcore;
import org.bukkit.entity.Player;
import java.util.HashMap;
public class McMMOPlayerVampirismEvent extends McMMOPlayerDeathPenaltyEvent {
private boolean isVictim;
public McMMOPlayerVampirismEvent(Player player, boolean isVictim, HashMap<String, Integer> levelChanged, HashMap<String, Float> experienceChanged) {
super(player, levelChanged, experienceChanged);
this.isVictim = isVictim;
}
public boolean isVictim() {
return isVictim;
}
}

View File

@ -1,76 +0,0 @@
package com.gmail.nossr50.events.items;
import org.bukkit.Location;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack;
/**
* Called when mcMMO is preparing to drop an item.
*/
public class McMMOItemSpawnEvent extends Event implements Cancellable {
/**
* Rest of file is required boilerplate for custom events
**/
private static final HandlerList handlers = new HandlerList();
private Location location;
private ItemStack itemStack;
private boolean cancelled;
public McMMOItemSpawnEvent(Location location, ItemStack itemStack) {
this.location = location;
this.itemStack = itemStack;
this.cancelled = false;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* @return Location where the item will be dropped
*/
public Location getLocation() {
return location;
}
/**
* @param location Location where to drop the item
*/
public void setLocation(Location location) {
this.location = location;
}
/**
* @return ItemStack that will be dropped
*/
public ItemStack getItemStack() {
return itemStack;
}
/**
* @param itemStack ItemStack to drop
*/
public void setItemStack(ItemStack itemStack) {
this.itemStack = itemStack;
}
/**
* Following are required for Cancellable
**/
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
}

View File

@ -1,93 +0,0 @@
package com.gmail.nossr50.events.party;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
public class McMMOPartyAllianceChangeEvent extends PlayerEvent implements Cancellable {
/**
* Rest of file is required boilerplate for custom events
**/
private static final HandlerList handlers = new HandlerList();
private String oldAlly;
private String newAlly;
private EventReason reason;
private boolean cancelled;
public McMMOPartyAllianceChangeEvent(Player player, String oldAlly, String newAlly, EventReason reason) {
super(player);
if (newAlly != null) {
newAlly = newAlly.replace(":", ".");
}
this.oldAlly = oldAlly;
this.newAlly = newAlly;
this.reason = reason;
this.cancelled = false;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* @return The party being left, or null if the player was not in a party
*/
public String getOldAlly() {
return oldAlly;
}
/**
* @return The party being joined, or null if the player is not joining a new party
*/
public String getNewAlly() {
return newAlly;
}
/**
* @return The reason for the event being fired
*/
public EventReason getReason() {
return reason;
}
/**
* Following are required for Cancellable
**/
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
/**
* A list of reasons why the event may have been fired
*/
public enum EventReason {
/**
* Formed an alliance for the first time.
*/
FORMED_ALLIANCE,
/**
* Left a party and did not join a new one.
*/
DISBAND_ALLIANCE,
/**
* Any reason that doesn't fit elsewhere.
*/
CUSTOM;
}
}

View File

@ -1,106 +0,0 @@
package com.gmail.nossr50.events.party;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
/**
* Called when a player attempts to join, leave, or change parties.
*/
public class McMMOPartyChangeEvent extends PlayerEvent implements Cancellable {
/**
* Rest of file is required boilerplate for custom events
**/
private static final HandlerList handlers = new HandlerList();
private String oldParty;
private String newParty;
private EventReason reason;
private boolean cancelled;
public McMMOPartyChangeEvent(Player player, String oldParty, String newParty, EventReason reason) {
super(player);
if (newParty != null) {
newParty = newParty.replace(":", ".");
}
this.oldParty = oldParty;
this.newParty = newParty;
this.reason = reason;
this.cancelled = false;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* @return The party being left, or null if the player was not in a party
*/
public String getOldParty() {
return oldParty;
}
/**
* @return The party being joined, or null if the player is not joining a new party
*/
public String getNewParty() {
return newParty;
}
/**
* @return The reason for the event being fired
*/
public EventReason getReason() {
return reason;
}
/**
* Following are required for Cancellable
**/
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
/**
* A list of reasons why the event may have been fired
*/
public enum EventReason {
/**
* Joined a party for the first time.
*/
JOINED_PARTY,
/**
* Left a party and did not join a new one.
*/
LEFT_PARTY,
/**
* Was kicked from a party.
*/
KICKED_FROM_PARTY,
/**
* Left one party to join another.
*/
CHANGED_PARTIES,
/**
* Any reason that doesn't fit elsewhere.
*/
CUSTOM;
}
}

View File

@ -1,56 +0,0 @@
package com.gmail.nossr50.events.party;
import com.gmail.nossr50.core.datatypes.party.Party;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class McMMOPartyLevelUpEvent extends Event implements Cancellable {
/**
* Rest of file is required boilerplate for custom events
**/
private static final HandlerList handlers = new HandlerList();
private Party party;
private int levelsChanged;
private boolean cancelled;
public McMMOPartyLevelUpEvent(Party party, int levelsChanged) {
this.party = party;
this.levelsChanged = levelsChanged;
this.cancelled = false;
}
public static HandlerList getHandlerList() {
return handlers;
}
public Party getParty() {
return party;
}
public int getLevelsChanged() {
return levelsChanged;
}
public void setLevelsChanged(int levelsChanged) {
this.levelsChanged = levelsChanged;
}
/**
* Following are required for Cancellable
**/
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
}

View File

@ -1,46 +0,0 @@
package com.gmail.nossr50.events.party;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerTeleportEvent;
/**
* Called just before a player teleports using the /ptp command.
*/
public class McMMOPartyTeleportEvent extends PlayerTeleportEvent {
/**
* Rest of file is required boilerplate for custom events
**/
private static final HandlerList handlers = new HandlerList();
private String party;
private Player target;
public McMMOPartyTeleportEvent(Player player, Player target, String party) {
super(player, player.getLocation(), target.getLocation(), TeleportCause.COMMAND);
this.party = party;
this.target = target;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* @return The party the teleporting player is in
*/
public String getParty() {
return party;
}
/**
* @return The player being teleported to
*/
public Player getTarget() {
return target;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
}

View File

@ -1,78 +0,0 @@
package com.gmail.nossr50.events.party;
import com.gmail.nossr50.core.datatypes.party.Party;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class McMMOPartyXpGainEvent extends Event implements Cancellable {
/**
* Rest of file is required boilerplate for custom events
**/
private static final HandlerList handlers = new HandlerList();
private Party party;
private float xpGained;
private boolean cancelled;
public McMMOPartyXpGainEvent(Party party, float xpGained) {
this.party = party;
this.xpGained = xpGained;
this.cancelled = false;
}
public static HandlerList getHandlerList() {
return handlers;
}
public Party getParty() {
return party;
}
/**
* @return The amount of experience gained in this event
*/
public float getRawXpGained() {
return xpGained;
}
/**
* @param xpGained set amount of experience gained in this event
*/
public void setRawXpGained(float xpGained) {
this.xpGained = xpGained;
}
/**
* @return int amount of experience gained in this event
*/
@Deprecated
public int getXpGained() {
return (int) xpGained;
}
/**
* @param xpGained set int amount of experience gained in this event
*/
@Deprecated
public void setXpGained(int xpGained) {
this.xpGained = xpGained;
}
/**
* Following are required for Cancellable
**/
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
}

View File

@ -1,95 +0,0 @@
package com.gmail.nossr50.events.scoreboard;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.scoreboard.Scoreboard;
/**
* The parent class of all mcMMO scoreboard events
* All scoreboard events will extend from this
*/
abstract public class McMMOScoreboardEvent extends Event {
/**
* Rest of file is required boilerplate for custom events
**/
private static final HandlerList handlers = new HandlerList();
final Scoreboard currentBoard; //Can be null
private final ScoreboardEventReason scoreboardEventReason;
protected Scoreboard targetBoard; //Scoreboard involved in this event
protected Player targetPlayer;
/** GETTER & SETTER BOILERPLATE **/
public McMMOScoreboardEvent(Scoreboard targetBoard, Scoreboard currentBoard, Player targetPlayer, ScoreboardEventReason scoreboardEventReason) {
this.scoreboardEventReason = scoreboardEventReason;
this.targetBoard = targetBoard;
this.currentBoard = currentBoard;
this.targetPlayer = targetPlayer;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* This is the scoreboard the player will be assigned to after this event
*
* @return the target board to assign the player after this event fires
*/
public Scoreboard getTargetBoard() {
return targetBoard;
}
/**
* Change the scoreboard that the player will be assigned to after this event fires
*
* @param targetBoard the new board to assign the player to
*/
public void setTargetBoard(Scoreboard targetBoard) {
this.targetBoard = targetBoard;
}
/**
* The player involved in this event (this can be changed)
*
* @return the player involved in this event
*/
public Player getTargetPlayer() {
return targetPlayer;
}
/**
* Change the target player for this event
*
* @param targetPlayer the new target for this event
*/
public void setTargetPlayer(Player targetPlayer) {
this.targetPlayer = targetPlayer;
}
/**
* This is the scoreboard the player is currently assigned to at the time the event was fired
* Grabbed via player.getScoreboard()
*
* @return players current scoreboard
*/
public Scoreboard getCurrentBoard() {
return currentBoard;
}
/**
* The ENUM defining the reason for this event
*
* @return the reason for this event
*/
public ScoreboardEventReason getScoreboardEventReason() {
return scoreboardEventReason;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
}

View File

@ -1,15 +0,0 @@
package com.gmail.nossr50.events.scoreboard;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.Scoreboard;
/**
* This event is called when mcMMO creates its custom boards
* You should not interfere with this event unless you understand our board code thoroughly
* mcMMO relies on using new scoreboards to show players individually catered boards with stats specific to them
*/
public class McMMOScoreboardMakeboardEvent extends McMMOScoreboardEvent {
public McMMOScoreboardMakeboardEvent(Scoreboard targetBoard, Scoreboard currentBoard, Player targetPlayer, ScoreboardEventReason scoreboardEventReason) {
super(targetBoard, currentBoard, targetPlayer, scoreboardEventReason);
}
}

View File

@ -1,53 +0,0 @@
package com.gmail.nossr50.events.scoreboard;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Scoreboard;
public class McMMOScoreboardObjectiveEvent extends McMMOScoreboardEvent implements Cancellable {
protected final ScoreboardObjectiveEventReason objectiveEventReason;
protected boolean cancelled;
protected Objective targetObjective;
public McMMOScoreboardObjectiveEvent(Objective targetObjective, ScoreboardObjectiveEventReason objectiveEventReason, Scoreboard scoreboard, Scoreboard oldboard, Player targetPlayer, ScoreboardEventReason scoreboardEventReason) {
super(scoreboard, oldboard, targetPlayer, scoreboardEventReason);
this.objectiveEventReason = objectiveEventReason;
this.targetObjective = targetObjective;
cancelled = false;
}
/**
* The objective that will be modified by this event
*
* @return
*/
public Objective getTargetObjective() {
return targetObjective;
}
/**
* Change the target objective for this event
*
* @param newObjective new target objective
*/
public void setTargetObjective(Objective newObjective) {
this.targetObjective = newObjective;
}
public ScoreboardObjectiveEventReason getObjectiveEventReason() {
return objectiveEventReason;
}
/* BOILERPLATE FROM INTERFACES */
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean b) {
cancelled = b;
}
}

View File

@ -1,14 +0,0 @@
package com.gmail.nossr50.events.scoreboard;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.Scoreboard;
/**
* This event is called when mcMMO is attempting to change a players targetBoard back to their previous board
* This is used when an mcMMO board is cleared (removed from the screen), changing back from a temporary board (usually from a delayed scheduled task or our mcscoreboard time command)
*/
public class McMMOScoreboardRevertEvent extends McMMOScoreboardEvent {
public McMMOScoreboardRevertEvent(Scoreboard targetBoard, Scoreboard currentBoard, Player targetPlayer, ScoreboardEventReason scoreboardEventReason) {
super(targetBoard, currentBoard, targetPlayer, scoreboardEventReason);
}
}

View File

@ -1,7 +0,0 @@
package com.gmail.nossr50.events.scoreboard;
public enum ScoreboardEventReason {
CREATING_NEW_SCOREBOARD,
OBJECTIVE,
REVERTING_BOARD,
}

View File

@ -1,6 +0,0 @@
package com.gmail.nossr50.events.scoreboard;
public enum ScoreboardObjectiveEventReason {
UNREGISTER_THIS_OBJECTIVE,
REGISTER_NEW_OBJECTIVE,
}

View File

@ -1,99 +0,0 @@
package com.gmail.nossr50.events.skills;
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
/**
* This event is sent for when mcMMO informs a player about various important information
*/
public class McMMOPlayerNotificationEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
protected final NotificationType notificationType;
protected ChatMessageType chatMessageType;
protected TextComponent notificationTextComponent;
private boolean isCancelled;
/*
* Messages can be sent to both places, as configured in advanced.yml
* If isBeingSentToActionBar is false, then messages will ALWAYS be sent to the chat bar
* isMessageAlsoBeingSentToChat just indicates a copy of that message will be sent to chat
*/
private boolean isMessageAlsoBeingSentToChat;
public McMMOPlayerNotificationEvent(Player who, NotificationType notificationType, TextComponent notificationTextComponent, ChatMessageType chatMessageType, boolean isMessageAlsoBeingSentToChat) {
super(who);
this.notificationType = notificationType;
this.notificationTextComponent = notificationTextComponent;
this.chatMessageType = chatMessageType;
this.isMessageAlsoBeingSentToChat = isMessageAlsoBeingSentToChat;
isCancelled = false;
}
/*
* Getters & Setters
*/
public static HandlerList getHandlerList() {
return handlers;
}
public boolean isMessageAlsoBeingSentToChat() {
return isMessageAlsoBeingSentToChat;
}
public void setMessageAlsoBeingSentToChat(boolean messageAlsoBeingSentToChat) {
isMessageAlsoBeingSentToChat = messageAlsoBeingSentToChat;
}
public TextComponent getNotificationTextComponent() {
return notificationTextComponent;
}
public void setNotificationTextComponent(TextComponent notificationTextComponent) {
this.notificationTextComponent = notificationTextComponent;
}
public ChatMessageType getChatMessageType() {
return chatMessageType;
}
public void setChatMessageType(ChatMessageType chatMessageType) {
this.chatMessageType = chatMessageType;
}
/*
* Custom Event Boilerplate
*/
/**
* The notification type for this event
*
* @return this event's notification type
*/
public NotificationType getEventNotificationType() {
return notificationType;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
/*
* Cancellable Interface Boilerplate
*/
@Override
public boolean isCancelled() {
return isCancelled;
}
@Override
public void setCancelled(boolean b) {
isCancelled = b;
}
}

View File

@ -1,48 +0,0 @@
package com.gmail.nossr50.events.skills;
import com.gmail.nossr50.core.data.UserManager;
import com.gmail.nossr50.core.skills.PrimarySkillType;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
/**
* Generic event for mcMMO skill handling.
*/
public abstract class McMMOPlayerSkillEvent extends PlayerEvent {
/**
* Rest of file is required boilerplate for custom events
**/
private static final HandlerList handlers = new HandlerList();
protected PrimarySkillType skill;
protected int skillLevel;
protected McMMOPlayerSkillEvent(Player player, PrimarySkillType skill) {
super(player);
this.skill = skill;
this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill);
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* @return The skill involved in this event
*/
public PrimarySkillType getSkill() {
return skill;
}
/**
* @return The level of the skill involved in this event
*/
public int getSkillLevel() {
return skillLevel;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
}

View File

@ -1,22 +0,0 @@
package com.gmail.nossr50.events.skills.abilities;
import com.gmail.nossr50.core.skills.PrimarySkillType;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
public class McMMOPlayerAbilityActivateEvent extends McMMOPlayerAbilityEvent implements Cancellable {
private boolean cancelled;
public McMMOPlayerAbilityActivateEvent(Player player, PrimarySkillType skill) {
super(player, skill);
cancelled = false;
}
public boolean isCancelled() {
return cancelled;
}
public void setCancelled(boolean value) {
this.cancelled = value;
}
}

View File

@ -1,10 +0,0 @@
package com.gmail.nossr50.events.skills.abilities;
import com.gmail.nossr50.core.skills.PrimarySkillType;
import org.bukkit.entity.Player;
public class McMMOPlayerAbilityDeactivateEvent extends McMMOPlayerAbilityEvent {
public McMMOPlayerAbilityDeactivateEvent(Player player, PrimarySkillType skill) {
super(player, skill);
}
}

View File

@ -1,19 +0,0 @@
package com.gmail.nossr50.events.skills.abilities;
import com.gmail.nossr50.core.skills.PrimarySkillType;
import com.gmail.nossr50.core.skills.SuperAbilityType;
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
import org.bukkit.entity.Player;
public class McMMOPlayerAbilityEvent extends McMMOPlayerSkillEvent {
private SuperAbilityType ability;
protected McMMOPlayerAbilityEvent(Player player, PrimarySkillType skill) {
super(player, skill);
ability = skill.getAbility();
}
public SuperAbilityType getAbility() {
return ability;
}
}

View File

@ -1,37 +0,0 @@
package com.gmail.nossr50.events.skills.alchemy;
import com.gmail.nossr50.core.skills.PrimarySkillType;
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.BrewingStand;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
public class McMMOPlayerBrewEvent extends McMMOPlayerSkillEvent implements Cancellable {
private BlockState brewingStand;
private boolean cancelled;
public McMMOPlayerBrewEvent(Player player, BlockState brewingStand) {
super(player, PrimarySkillType.ALCHEMY);
this.brewingStand = brewingStand;
cancelled = false;
}
public boolean isCancelled() {
return cancelled;
}
public void setCancelled(boolean newValue) {
this.cancelled = newValue;
}
public Block getBrewingStandBlock() {
return brewingStand.getBlock();
}
public BrewingStand getBrewingStand() {
return (BrewingStand) brewingStand;
}
}

View File

@ -1,34 +0,0 @@
package com.gmail.nossr50.events.skills.alchemy;
import com.gmail.nossr50.core.skills.PrimarySkillType;
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
public class McMMOPlayerCatalysisEvent extends McMMOPlayerSkillEvent implements Cancellable {
private double speed;
private boolean cancelled;
public McMMOPlayerCatalysisEvent(Player player, double speed) {
super(player, PrimarySkillType.ALCHEMY);
this.speed = speed;
cancelled = false;
}
public boolean isCancelled() {
return cancelled;
}
public void setCancelled(boolean newValue) {
this.cancelled = newValue;
}
public double getSpeed() {
return speed;
}
public void setSpeed(double speed) {
this.speed = speed;
}
}

View File

@ -1,23 +0,0 @@
package com.gmail.nossr50.events.skills.fishing;
import com.gmail.nossr50.core.skills.PrimarySkillType;
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
public class McMMOPlayerFishingEvent extends McMMOPlayerSkillEvent implements Cancellable {
private boolean cancelled;
protected McMMOPlayerFishingEvent(Player player) {
super(player, PrimarySkillType.FISHING);
cancelled = false;
}
public boolean isCancelled() {
return cancelled;
}
public void setCancelled(boolean newValue) {
this.cancelled = newValue;
}
}

View File

@ -1,31 +0,0 @@
package com.gmail.nossr50.events.skills.fishing;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class McMMOPlayerFishingTreasureEvent extends McMMOPlayerFishingEvent {
private ItemStack treasure;
private int xp;
public McMMOPlayerFishingTreasureEvent(Player player, ItemStack treasure, int xp) {
super(player);
this.treasure = treasure;
this.xp = xp;
}
public ItemStack getTreasure() {
return treasure;
}
public void setTreasure(ItemStack item) {
this.treasure = item;
}
public int getXp() {
return xp;
}
public void setXp(int xp) {
this.xp = xp;
}
}

View File

@ -1,20 +0,0 @@
package com.gmail.nossr50.events.skills.fishing;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.util.Map;
public class McMMOPlayerMagicHunterEvent extends McMMOPlayerFishingTreasureEvent {
private Map<Enchantment, Integer> enchants;
public McMMOPlayerMagicHunterEvent(Player player, ItemStack treasure, int xp, Map<Enchantment, Integer> enchants) {
super(player, treasure, xp);
this.enchants = enchants;
}
public Map<Enchantment, Integer> getEnchantments() {
return enchants;
}
}

View File

@ -1,21 +0,0 @@
package com.gmail.nossr50.events.skills.fishing;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class McMMOPlayerShakeEvent extends McMMOPlayerFishingEvent {
private ItemStack drop;
public McMMOPlayerShakeEvent(Player player, ItemStack drop) {
super(player);
this.drop = drop;
}
public ItemStack getDrop() {
return drop;
}
public void setDrop(ItemStack drop) {
this.drop = drop;
}
}

View File

@ -1,59 +0,0 @@
package com.gmail.nossr50.events.skills.repair;
import com.gmail.nossr50.core.skills.PrimarySkillType;
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.inventory.ItemStack;
/**
* Called just before a player repairs an object with mcMMO.
*/
public class McMMOPlayerRepairCheckEvent extends McMMOPlayerSkillEvent implements Cancellable {
private short repairAmount;
private ItemStack repairMaterial;
private ItemStack repairedObject;
private boolean cancelled;
public McMMOPlayerRepairCheckEvent(Player player, short repairAmount, ItemStack repairMaterial, ItemStack repairedObject) {
super(player, PrimarySkillType.REPAIR);
this.repairAmount = repairAmount;
this.repairMaterial = repairMaterial;
this.repairedObject = repairedObject;
this.cancelled = false;
}
/**
* @return The amount this item will be repaired.
*/
public short getRepairAmount() {
return repairAmount;
}
/**
* @return The material used to repair this item
*/
public ItemStack getRepairMaterial() {
return repairMaterial;
}
/**
* @return The item that was repaired
*/
public ItemStack getRepairedObject() {
return repairedObject;
}
/**
* Following are required for Cancellable
**/
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
}

View File

@ -1,59 +0,0 @@
package com.gmail.nossr50.events.skills.salvage;
import com.gmail.nossr50.core.skills.PrimarySkillType;
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.inventory.ItemStack;
/**
* Called just before a player salvages an item with mcMMO.
*/
public class McMMOPlayerSalvageCheckEvent extends McMMOPlayerSkillEvent implements Cancellable {
private ItemStack salvageItem;
private ItemStack salvageResults;
private ItemStack enchantedBook;
private boolean cancelled;
public McMMOPlayerSalvageCheckEvent(Player player, ItemStack salvageItem, ItemStack salvageResults, ItemStack enchantedBook) {
super(player, PrimarySkillType.SALVAGE);
this.salvageItem = salvageItem;
this.salvageResults = salvageResults;
this.enchantedBook = enchantedBook;
this.cancelled = false;
}
/**
* @return The item that should get salvaged.
*/
public ItemStack getSalvageItem() {
return salvageItem;
}
/**
* @return The results that should be dropped after salvaging.
*/
public ItemStack getSalvageResults() {
return salvageResults;
}
/**
* @return The enchanted book that should drop after salvaging or null if no book should be dropped.
*/
public ItemStack getEnchantedBook() {
return enchantedBook;
}
/**
* Following are required for Cancellable
**/
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancel) {
this.cancelled = cancel;
}
}

View File

@ -1,47 +0,0 @@
package com.gmail.nossr50.events.skills.secondaryabilities;
import com.gmail.nossr50.core.skills.PrimarySkillType;
import com.gmail.nossr50.core.skills.SubSkillType;
import com.gmail.nossr50.core.skills.subskills.AbstractSubSkill;
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
public class SubSkillEvent extends McMMOPlayerSkillEvent implements Cancellable {
private SubSkillType subSkillType;
private boolean cancelled = false;
/**
* Only skills using the old system will fire this event
*
* @param player target player
* @param subSkillType target subskill
* @Deprecated Skills will be using a new system stemming from the AbstractSubSkill class so make sure you check for both events, this event will be removed eventually.
*/
@Deprecated
public SubSkillEvent(Player player, SubSkillType subSkillType) {
super(player, PrimarySkillType.bySecondaryAbility(subSkillType));
this.subSkillType = subSkillType;
}
public SubSkillEvent(Player player, AbstractSubSkill abstractSubSkill) {
super(player, abstractSubSkill.getPrimarySkill());
}
/**
* Gets the SubSkillType involved in the event
*
* @return the SubSkillType
*/
public SubSkillType getSubSkillType() {
return subSkillType;
}
public boolean isCancelled() {
return cancelled;
}
public void setCancelled(boolean newValue) {
this.cancelled = newValue;
}
}

View File

@ -1,46 +0,0 @@
package com.gmail.nossr50.events.skills.secondaryabilities;
import com.gmail.nossr50.core.skills.SubSkillType;
import com.gmail.nossr50.core.skills.subskills.AbstractSubSkill;
import org.bukkit.entity.Player;
public class SubSkillRandomCheckEvent extends SubSkillEvent {
private double chance;
public SubSkillRandomCheckEvent(Player player, SubSkillType ability, double chance) {
super(player, ability);
this.chance = chance;
}
public SubSkillRandomCheckEvent(Player player, AbstractSubSkill abstractSubSkill, double chance) {
super(player, abstractSubSkill);
this.chance = chance;
}
/**
* Gets the activation chance of the ability 0D being no chance, 100.0D being 100% chance
*
* @return The activation chance of the ability
*/
public double getChance() {
return chance;
}
/**
* Sets the activation chance of the ability [0D-100.0D]
*
* @param chance The activation chance of the ability
*/
public void setChance(double chance) {
this.chance = chance;
}
/**
* Sets the activation chance of the ability to 100% or 0%
*
* @param success whether it should be successful or not
*/
public void setSuccessful(boolean success) {
this.chance = success ? 100.0D : 0D;
}
}

View File

@ -1,33 +0,0 @@
package com.gmail.nossr50.events.skills.unarmed;
import com.gmail.nossr50.core.skills.PrimarySkillType;
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
public class McMMOPlayerDisarmEvent extends McMMOPlayerSkillEvent implements Cancellable {
private boolean cancelled;
private Player defender;
public McMMOPlayerDisarmEvent(Player defender) {
super(defender, PrimarySkillType.UNARMED);
this.defender = defender;
}
public Player getDefender() {
return defender;
}
/**
* Following are required for Cancellable
**/
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
}

View File

@ -26,8 +26,8 @@ import com.gmail.nossr50.core.util.sounds.SoundManager;
import com.gmail.nossr50.core.util.sounds.SoundType;
import com.gmail.nossr50.core.worldguard.WorldGuardManager;
import com.gmail.nossr50.core.worldguard.WorldGuardUtils;
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
import com.gmail.nossr50.events.fake.FakeBlockDamageEvent;
import com.gmail.nossr50.core.events.fake.FakeBlockBreakEvent;
import com.gmail.nossr50.core.events.fake.FakeBlockDamageEvent;
import com.gmail.nossr50.mcMMO;
import org.bukkit.GameMode;
import org.bukkit.Location;

View File

@ -22,9 +22,9 @@ import com.gmail.nossr50.core.util.Permissions;
import com.gmail.nossr50.core.util.skills.CombatUtils;
import com.gmail.nossr50.core.worldguard.WorldGuardManager;
import com.gmail.nossr50.core.worldguard.WorldGuardUtils;
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
import com.gmail.nossr50.events.fake.FakeEntityTameEvent;
import com.gmail.nossr50.core.events.fake.FakeEntityDamageByEntityEvent;
import com.gmail.nossr50.core.events.fake.FakeEntityDamageEvent;
import com.gmail.nossr50.core.events.fake.FakeEntityTameEvent;
import com.gmail.nossr50.mcMMO;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;

View File

@ -13,7 +13,7 @@ import com.gmail.nossr50.core.util.Permissions;
import com.gmail.nossr50.core.util.skills.SkillUtils;
import com.gmail.nossr50.core.worldguard.WorldGuardManager;
import com.gmail.nossr50.core.worldguard.WorldGuardUtils;
import com.gmail.nossr50.events.fake.FakeBrewEvent;
import com.gmail.nossr50.core.events.fake.FakeBrewEvent;
import com.gmail.nossr50.mcMMO;
import org.bukkit.Location;
import org.bukkit.Material;

View File

@ -9,9 +9,9 @@ import com.gmail.nossr50.core.skills.PrimarySkillType;
import com.gmail.nossr50.core.util.scoreboards.ScoreboardManager;
import com.gmail.nossr50.core.worldguard.WorldGuardManager;
import com.gmail.nossr50.core.worldguard.WorldGuardUtils;
import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent;
import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
import com.gmail.nossr50.core.events.experience.McMMOPlayerLevelUpEvent;
import com.gmail.nossr50.core.events.experience.McMMOPlayerXpGainEvent;
import com.gmail.nossr50.core.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
import com.gmail.nossr50.mcMMO;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;