Package com.vk2gpz.tokenenchant.api
Class EnchantHandler
java.lang.Object
com.vk2gpz.tokenenchant.api.EnchantHandler
- All Implemented Interfaces:
com.vk2gpz.mc.api.enchantment.ICEHandler
,com.vk2gpz.mc.event.EventMapper
,CEHandler
,org.bukkit.command.CommandExecutor
,org.bukkit.command.TabCompleter
,org.bukkit.command.TabExecutor
,org.bukkit.event.Listener
- Direct Known Subclasses:
PotionHandler
public abstract class EnchantHandler
extends Object
implements org.bukkit.command.TabExecutor, CEHandler, com.vk2gpz.mc.event.EventMapper
EnchantHandler is used to implement a custom enchant which will be registered with
Minecraft's Enchantment system.
If you create your custom enchantment class by extending this class, TokenEnchant will automatically create and register an appropriate Enchantment class.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.vk2gpz.tokenenchant.api.CEHandler
CEHandler.Availability, CEHandler.CECommand, CEHandler.CEMinMax, CEHandler.MergeMode, CEHandler.PermissionMode
Nested classes/interfaces inherited from interface com.vk2gpz.mc.api.enchantment.ICEHandler
com.vk2gpz.mc.api.enchantment.ICEHandler.Cost
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
protected boolean
protected Set
<CEHandler.Availability> protected int
protected org.bukkit.Sound
protected float
protected float
protected Map
<Integer, List<CEHandler.CECommand>> protected final int
protected org.bukkit.configuration.file.FileConfiguration
protected int
protected String
protected String
cooldown relatedprotected String
protected double[]
protected static final String
protected String
protected int
protected int
protected org.bukkit.Sound
protected float
protected float
protected boolean
protected double
protected org.bukkit.enchantments.Enchantment
protected com.vk2gpz.mc.api.enchantment.EnchantmentSlotType
protected org.bukkit.enchantments.EnchantmentTarget
protected com.vk2gpz.mc.api.enchantment.EnumItemSlot[]
protected int
protected boolean
protected boolean
protected boolean
protected int
protected String
protected int
protected int
protected CEHandler.MergeMode
protected String
protected double
protected double
protected String
protected CEHandler.PermissionMode
protected String
protected boolean
protected org.bukkit.plugin.Plugin
protected org.bukkit.potion.PotionEffectType
protected double
protected com.vk2gpz.mc.enchantment.Rarity
protected double
protected boolean
protected Set
<org.bukkit.Material> protected ITokenEnchant
Represents actual TokenEnchat plugin.protected boolean
protected boolean
Fields inherited from interface com.vk2gpz.tokenenchant.api.CEHandler
ENCHANT_KEY, POTION_KEY, rand, WILDCARD
-
Constructor Summary
ConstructorsConstructorDescriptionEnchantHandler
(ITokenEnchant plugin) Constructor.EnchantHandler
(ITokenEnchant plugin, String name, org.bukkit.configuration.file.FileConfiguration config) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAllowed
(String allowed) This method will registerAddonClass the specified material to the list of allowable items for this CE;void
addConflict
(String enchantName) This method will registerAddonClass the specified enchant name to the list of conflicting enchant of this CE;boolean
applyState
(org.bukkit.entity.Player player, int duration, int amplifier) If the custom enchantment/potion behave like a regular potion effect, you should describe what sort of effect to be applied to a player in this method.boolean
canApply
(org.bukkit.entity.Player player) boolean
canEnchantItem
(org.bukkit.inventory.ItemStack item) This method checks whether this CE can be applied to the specified item or not.boolean
checkCooldown
(org.bukkit.entity.Player p, int currentlevel) void
cleanup()
If the custom enchantment/potion needs to carry out any data clearning up upon unloading, you should do so in here after invoking super.cleanup()
This method will automatically be called when TokenEnchant plugin is disabled/reloaded.boolean
conflictsWith
(CEHandler cdh) boolean
conflictsWith
(@NotNull org.bukkit.enchantments.Enchantment enchantment) void
doHelp
(org.bukkit.command.CommandSender sender) If this custom enchantment/potion has a command, you can provide its help description in this method.boolean
boolean
execCommands
(org.bukkit.entity.Player p, org.bukkit.inventory.ItemStack item, int level, org.bukkit.Location loc, Object... somedata) protected int
findTheLevelEntry
(int lvl) boolean
getAlias()
Reads the alias name of this custom enchantment from config.yml if it's specified under "alias:", null otherwise.protected org.bukkit.ChatColor
getAllowed
(org.bukkit.entity.Player p) A utility method to return a chat color based on whether the specified player has the permission or not.protected org.bukkit.ChatColor
getAllowed
(org.bukkit.entity.Player p, String perm) Deprecated.int
getBase()
It returns the base enchant level.org.bukkit.Sound
float
float
int
getCELevel
(org.bukkit.entity.Player p) If a player is holding an item with the effect represented by the specified CEHandler, it returns the level of this enchantment.int
getCELevel
(org.bukkit.entity.Player p, org.bukkit.inventory.ItemStack itemStack) It returns the level of this enchantment on the specified item.int
getCELevel
(org.bukkit.inventory.ItemStack item) If a player is holding an item with the effect represented by the specified CEHandler, it returns the level of this enchantment.int
getCELevelOnAllArmor
(org.bukkit.entity.Player p) If a player is wearing an item with the effect represented by the specified CEHandler, it returns the level of this enchantment.int
getCELevelOnArmor
(org.bukkit.entity.Player p) If a player is wearing an item with the effect represented by the specified CEHandler, it returns the level of this enchantment.org.bukkit.configuration.file.FileConfiguration
int
It returns the maximum cooldown.It returns the id for a function, which is defined in OccurrenceFormulae.jsIt returns the id for cost function, which is defined in CostFormulae.jsdouble[]
int
getCustomModelData
(org.bukkit.Material material) It returns the description of this effect.int
Returns the duration of this potion effect.int
This method returns the duration multiplier of a potion effect if any.org.bukkit.Sound
float
float
double
It returns the enchantment chance for this effect.org.bukkit.enchantments.Enchantment
com.vk2gpz.mc.api.enchantment.EnchantmentSlotType
com.vk2gpz.mc.api.enchantment.EnumItemSlot[]
int
getETMax()
It returns the max enchant level for using the Enchantment Table.This method returns the pair of evnet name and its process priority for this CE.int
It returns the interval of effect increase.org.bukkit.enchantments.EnchantmentTarget
getKey()
int
This method checks the given string and determine whehterh it starts its this enchant's name or alias, and returns the indicated level of enchantment.int
It returns the max enchant level.int
It returns the max merged enchant level.It returns the merge mode.double
It returns the minimum chance of occurrence.getName()
Returns the name of this custom enchantment/potion.double
It returns the chance of occurrence at the max level.It returns the id for a function, which is defined in OccurrenceFormulae.jsThe use of permission node.Given a common/alias name or official name of an enchantment, it returns the permission node of the specified PotionEffectType object.getPermissionNode
(String enchantname) Deprecated.org.bukkit.plugin.Plugin
org.bukkit.potion.PotionEffectType
double
getPrice()
It returns the base price.com.vk2gpz.mc.enchantment.Rarity
double
It returns whether this enchant is refundable or norint
getScale()
/** It returns the scale of the encahntment level.protected org.bukkit.Material
getSourceType
(org.bukkit.entity.Projectile projectile) Set
<org.bukkit.Material> getTE()
protected org.bukkit.entity.Entity
getThrower
(org.bukkit.entity.Entity projectile) protected org.bukkit.inventory.ItemStack
getThrownItemStack
(org.bukkit.entity.Entity entity) Returns the version of this custom enchantmentboolean
hasConflictWith
(String enchantName) This method checks whether this CE conflicts with the specified enchant.int
hashCode()
boolean
isAvailable
(CEHandler.Availability availability) boolean
boolean
isHidden()
boolean
isOldAlias
(String oldAlias) boolean
protected boolean
isThrownTool
(org.bukkit.entity.Entity entity) boolean
Deprecated.boolean
isValid
(org.bukkit.Location location) Returns true if the specified player is allowed to use the specified enchantment at the specified location.void
If the custom enchantment/potion needs to load any configuration informaiton from config.yml, config loading process should be written in this method.protected void
boolean
onCommand
(@NotNull org.bukkit.command.CommandSender sender, @NotNull org.bukkit.command.Command command, @NotNull String label, String[] args) if your custom enchantment provides any special command, you can write your command process here.onTabComplete
(@NotNull org.bukkit.command.CommandSender sender, @NotNull org.bukkit.command.Command cmd, @NotNull String label, String[] args) if your custom enchantment provides any special command, you can write your tab completion process here.protected static String
boolean
Register event name and process priority pair.void
remove
(org.bukkit.entity.Player player) If the custom enchantment/potion behave like a regular potion effect, you should describe how the custom potion effects should be disabled in this method.void
removeAllowed
(String allowed) This method will remove the specified material from the list of allowable items for this CE;void
removeConflict
(String enchantName) This method will remove the specified enchant name from the list of conflict.boolean
removeState
(org.bukkit.entity.Player player, int level) protected String
This method returns the version string of the required TokenEnchant plugin.boolean
void
resetCooldown
(org.bukkit.entity.Player p) Register event name and process priority pair.protected void
void
setCustomModelDataMap
(Map<org.bukkit.Material, Integer> cmd_map) void
setEnchantment
(org.bukkit.enchantments.Enchantment enchantment) void
setForceCustomModelData
(boolean force) void
setMaxLevel
(int max) Sets the max enchantment level.void
void
setPotionEffectType
(org.bukkit.potion.PotionEffectType potionEffectType) void
setUseRomanNumeral
(boolean use) boolean
boolean
This method returns true if this CE is to use the action bar for messaging.boolean
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.vk2gpz.tokenenchant.api.CEHandler
applyPostDisEnchant, applyPostEnchant, applyPotion, canApplyPotion, canBreak, canBreak, canExecute, checkCooldown, finalizeProcess, finalizeProcess, getConfigInstance, getDisplayName, getEnchantable, getFriendlyName, getLFDescription, getLoreEntry, getLoreEntry, getMaxCostRange, getMinCostRange, getPermittedMaxLevel, getRealName, getRegisteredName, getStartLevel, isAlias, isAllowed, isCursed, isEnchantTabled, isFishing, isInstant, isLoot, isRefundable, isTreasure, isVanilla, isVillagerTrade, playCastingSound, playSound, playSound, registerAlias, removePotion, removePotion, sendMessage, shouldProceed
-
Field Details
-
DEFAULT
- See Also:
-
KEY
-
te
Represents actual TokenEnchat plugin. -
plugin
protected org.bukkit.plugin.Plugin plugin -
enabled
protected boolean enabled -
cooldowns
cooldown related -
cooldown
protected int cooldown -
cooldownMsg
-
allowedItems
-
supportedItems
-
conflicts
-
eventPriorityMap
-
config
protected org.bukkit.configuration.file.FileConfiguration config -
permNode
-
permMode
-
enchantChance
protected double enchantChance -
description
-
showDescription
protected boolean showDescription -
mergeMode
-
mergeMax
protected int mergeMax -
etMax
protected int etMax -
max
protected int max -
interval
protected int interval -
base
protected int base -
price
protected double price -
invalidInWorld
-
enabledWorld
-
invalidInRegion
-
enabledRegion
-
occurrence
protected double occurrence -
occurrence_min
protected double occurrence_min -
alias
-
refundRate
protected double refundRate -
duration
protected int duration -
duration_multiplier
protected int duration_multiplier -
costFormula
-
costParams
protected double[] costParams -
cooldownFormula
-
occurrenceFormula
-
rarity
protected com.vk2gpz.mc.enchantment.Rarity rarity -
availabilities
-
enchantmentSlotType
protected com.vk2gpz.mc.api.enchantment.EnchantmentSlotType enchantmentSlotType -
enumItemSlots
protected com.vk2gpz.mc.api.enchantment.EnumItemSlot[] enumItemSlots -
applyOffHand
protected boolean applyOffHand -
useActionBar
protected boolean useActionBar -
name
-
forceCMD
protected boolean forceCMD -
useRomanNumeral
protected boolean useRomanNumeral -
enchantment
protected org.bukkit.enchantments.Enchantment enchantment -
enchantTarget
protected org.bukkit.enchantments.EnchantmentTarget enchantTarget -
potionEffectType
protected org.bukkit.potion.PotionEffectType potionEffectType -
cmd_map
-
effectSound
protected org.bukkit.Sound effectSound -
effectSoundVolume
protected float effectSoundVolume -
effectSoundPitch
protected float effectSoundPitch -
playEffectSoundPlayerOnly
protected boolean playEffectSoundPlayerOnly -
castingSound
protected org.bukkit.Sound castingSound -
castingSoundVolume
protected float castingSoundVolume -
castingSoundPitch
protected float castingSoundPitch -
ceCommands
-
COMMON_CMD_LEVEL
protected final int COMMON_CMD_LEVEL- See Also:
-
fullArmor
protected boolean fullArmor
-
-
Constructor Details
-
EnchantHandler
Constructor.- Parameters:
plugin
- actual TokenEnchant plugin object.- Throws:
InvalidTokenEnchantException
- is thrown if the requied verison does not match or configuration is missing.
-
EnchantHandler
public EnchantHandler(ITokenEnchant plugin, String name, org.bukkit.configuration.file.FileConfiguration config) throws InvalidTokenEnchantException Constructor.- Parameters:
plugin
- actual TokenEnchant plugin object.- Throws:
InvalidTokenEnchantException
- is thrown if the requied verison does not match or configuration is missing.
-
-
Method Details
-
getKey
-
getPlugin
public org.bukkit.plugin.Plugin getPlugin() -
getTE
-
setUseRomanNumeral
public void setUseRomanNumeral(boolean use) -
useRomanNumeral
public boolean useRomanNumeral()- Specified by:
useRomanNumeral
in interfaceCEHandler
-
setName
-
getName
Description copied from interface:CEHandler
Returns the name of this custom enchantment/potion. -
isHidden
public boolean isHidden() -
getEnchantment
public org.bukkit.enchantments.Enchantment getEnchantment()- Specified by:
getEnchantment
in interfacecom.vk2gpz.mc.api.enchantment.ICEHandler
-
setEnchantment
public void setEnchantment(org.bukkit.enchantments.Enchantment enchantment) - Specified by:
setEnchantment
in interfacecom.vk2gpz.mc.api.enchantment.ICEHandler
-
getPotionEffectType
public org.bukkit.potion.PotionEffectType getPotionEffectType()- Specified by:
getPotionEffectType
in interfaceCEHandler
-
setPotionEffectType
public void setPotionEffectType(org.bukkit.potion.PotionEffectType potionEffectType) - Specified by:
setPotionEffectType
in interfaceCEHandler
-
setConfig
protected void setConfig() -
equals
-
hashCode
public int hashCode() -
isRegistered
public boolean isRegistered()- Specified by:
isRegistered
in interfaceCEHandler
-
getConfig
public org.bukkit.configuration.file.FileConfiguration getConfig() -
requiredTokenEnchantVersion
This method returns the version string of the required TokenEnchant plugin.- Returns:
- the version string of the required TokenEnchant plugin. ('*' represents any version)
-
getVersion
Returns the version of this custom enchantment- Specified by:
getVersion
in interfaceCEHandler
- Returns:
- the version of this custom enchantment
-
getAllowed
Deprecated.A utility method to return a chat color based on whether the specified player has the specified permission or not.- Parameters:
p
- a plaer to be checked.perm
- a permission node to be checked.- Returns:
- ChatColor.AQUA if the player has the permission, ChatColor.GRAY otherwise.
-
getAllowed
protected org.bukkit.ChatColor getAllowed(org.bukkit.entity.Player p) A utility method to return a chat color based on whether the specified player has the permission or not.- Parameters:
p
- a plaer to be checked.- Returns:
- ChatColor.AQUA if the player has the permission, ChatColor.GRAY otherwise.
-
onCommand
public boolean onCommand(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull org.bukkit.command.Command command, @NotNull @NotNull String label, String[] args) if your custom enchantment provides any special command, you can write your command process here. The command will be "/te yourcommand arguments..."If your enchant actually responds to this method call, you should return "true" If your enchant does not need to respond to onCommand, you should not override this, or simply return false.
- Specified by:
onCommand
in interfaceorg.bukkit.command.CommandExecutor
-
onTabComplete
public List<String> onTabComplete(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull org.bukkit.command.Command cmd, @NotNull @NotNull String label, String[] args) if your custom enchantment provides any special command, you can write your tab completion process here. The command will be "/te yourcommand arguments..."- Specified by:
onTabComplete
in interfaceorg.bukkit.command.TabCompleter
-
doHelp
public void doHelp(org.bukkit.command.CommandSender sender) If this custom enchantment/potion has a command, you can provide its help description in this method. This method will automatically be called from TokenEnchant and the help will be included in TokenEnchant's /te help menu.if (isAllowed(sender, "myenchant.mycommand")) sender.sendMessage("- " + getAllowed(sender, "myenchant.mycommandd") + "/tokenenchant mycommand arguments : mycommand does xxxxx.");
- Parameters:
sender
- CommandSender object which issued the /te help command
-
applyState
Description copied from interface:CEHandler
If the custom enchantment/potion behave like a regular potion effect, you should describe what sort of effect to be applied to a player in this method. This method will automatically be called when a player hold an item with this enchantment.- Specified by:
applyState
in interfaceCEHandler
- Parameters:
player
- A player whom this potion will be applied toduration
- A duration of this potion effect being applied toamplifier
- An amplifier of this potion effect being applied to- Returns:
- this CEHandler, if this CEHandler did apply a PotionEffectType.
-
canApply
public boolean canApply(org.bukkit.entity.Player player) -
remove
public void remove(org.bukkit.entity.Player player) If the custom enchantment/potion behave like a regular potion effect, you should describe how the custom potion effects should be disabled in this method. This method will automatically be called when a player no longer hold an item with this enchantment. -
removeState
public boolean removeState(org.bukkit.entity.Player player, int level) - Specified by:
removeState
in interfaceCEHandler
-
loadConfig
public void loadConfig()If the custom enchantment/potion needs to load any configuration informaiton from config.yml, config loading process should be written in this method.
This method will automatically be called when TokenEnchant plugin is loaded.- Specified by:
loadConfig
in interfaceCEHandler
-
cleanup
public void cleanup()If the custom enchantment/potion needs to carry out any data clearning up upon unloading, you should do so in here after invoking super.cleanup()
This method will automatically be called when TokenEnchant plugin is disabled/reloaded. -
getItemTarget
public org.bukkit.enchantments.EnchantmentTarget getItemTarget()- Specified by:
getItemTarget
in interfaceCEHandler
-
conflictsWith
public boolean conflictsWith(@NotNull @NotNull org.bukkit.enchantments.Enchantment enchantment) - Specified by:
conflictsWith
in interfaceCEHandler
- Specified by:
conflictsWith
in interfacecom.vk2gpz.mc.api.enchantment.ICEHandler
-
conflictsWith
- Specified by:
conflictsWith
in interfaceCEHandler
-
getAlias
Reads the alias name of this custom enchantment from config.yml if it's specified under "alias:", null otherwise. -
getOldAliases
- Specified by:
getOldAliases
in interfaceCEHandler
-
isOldAlias
-
getDurationMultiplier
public int getDurationMultiplier()Description copied from interface:CEHandler
This method returns the duration multiplier of a potion effect if any.- Specified by:
getDurationMultiplier
in interfaceCEHandler
- Returns:
- the duration multiplier of a potion effect if any.
-
getDuration
public int getDuration()Returns the duration of this potion effect.- Specified by:
getDuration
in interfaceCEHandler
- Returns:
- the duration of this potion effect.
-
isValid
public boolean isValid(org.bukkit.Location location) Returns true if the specified player is allowed to use the specified enchantment at the specified location. This method checks "world" names where the enchantment is allowed or not. -
isValid
Deprecated. -
getPermissionNode
Given a common/alias name or official name of an enchantment, it returns the permission node of the specified PotionEffectType object.- Specified by:
getPermissionNode
in interfaceCEHandler
- Returns:
- the permission node.
-
getPermissionNode
Deprecated. -
getPermissionMode
The use of permission node. ENCHANT : a user with a permission can enchant and use an item. USE : a user with a permission can use the enchant but not apply the enchant..- Specified by:
getPermissionMode
in interfaceCEHandler
- Returns:
- the permission mode.
-
getEnchantChance
public double getEnchantChance()It returns the enchantment chance for this effect.- Specified by:
getEnchantChance
in interfaceCEHandler
- Returns:
- the enchantment chance.
-
showDescription
public boolean showDescription()- Specified by:
showDescription
in interfaceCEHandler
-
getDescription
It returns the description of this effect.- Specified by:
getDescription
in interfaceCEHandler
- Returns:
- the description.
-
getMergeMode
It returns the merge mode.- Specified by:
getMergeMode
in interfaceCEHandler
- Returns:
- the merge node.
-
getMaxLevel
public int getMaxLevel()It returns the max enchant level.- Specified by:
getMaxLevel
in interfaceCEHandler
- Specified by:
getMaxLevel
in interfacecom.vk2gpz.mc.api.enchantment.ICEHandler
- Returns:
- the max enchant level.
-
setMaxLevel
public void setMaxLevel(int max) Sets the max enchantment level. It also automatically computes its scale.- Parameters:
max
- the max enchant level.
-
getScale
public int getScale()/** It returns the scale of the encahntment level. -
getMergeMax
public int getMergeMax()It returns the max merged enchant level.- Specified by:
getMergeMax
in interfaceCEHandler
- Returns:
- the max merged enchant level.
-
getETMax
public int getETMax()It returns the max enchant level for using the Enchantment Table. -
getInterval
public int getInterval()It returns the interval of effect increase.- Specified by:
getInterval
in interfaceCEHandler
- Returns:
- the interval value.
-
getBase
public int getBase()It returns the base enchant level. -
getPrice
public double getPrice()It returns the base price. -
getCostFormula
It returns the id for cost function, which is defined in CostFormulae.js- Specified by:
getCostFormula
in interfaceCEHandler
- Returns:
- the id for cost function, which is defined in CostFormulae.js
-
getCostParams
public double[] getCostParams()- Specified by:
getCostParams
in interfaceCEHandler
-
getOccurrenceFormula
It returns the id for a function, which is defined in OccurrenceFormulae.js- Specified by:
getOccurrenceFormula
in interfaceCEHandler
- Returns:
- the id for a function, which is defined in OccurrenceFormulae.js
-
getCooldownFormula
It returns the id for a function, which is defined in OccurrenceFormulae.js- Specified by:
getCooldownFormula
in interfaceCEHandler
- Returns:
- the id for a function, which is defined in OccurrenceFormulae.js
-
getRefundRate
public double getRefundRate()It returns whether this enchant is refundable or nor- Specified by:
getRefundRate
in interfaceCEHandler
- Returns:
- true if it is refundable
-
getCELevel
public int getCELevel(org.bukkit.inventory.ItemStack item) If a player is holding an item with the effect represented by the specified CEHandler, it returns the level of this enchantment.- Specified by:
getCELevel
in interfaceCEHandler
- Parameters:
item
- An ItemStack object the player has.- Returns:
- return the level of enchantment.
-
getCELevel
public int getCELevel(org.bukkit.entity.Player p, org.bukkit.inventory.ItemStack itemStack) It returns the level of this enchantment on the specified item. If a player has a permission node indicating the encant ment level, the returned level will be capped at that value.- Specified by:
getCELevel
in interfaceCEHandler
- Parameters:
p
- Player whose item is examined for the specified enchant.itemStack
- an item, to be examined.- Returns:
- return the level of this enchantment on the item with palyer's permisison level.
-
getCELevel
public int getCELevel(org.bukkit.entity.Player p) If a player is holding an item with the effect represented by the specified CEHandler, it returns the level of this enchantment.- Specified by:
getCELevel
in interfaceCEHandler
- Parameters:
p
- Player whose item is examined for the specified enchant.- Returns:
- return the level of this enchantment.
-
getCELevelOnArmor
public int getCELevelOnArmor(org.bukkit.entity.Player p) If a player is wearing an item with the effect represented by the specified CEHandler, it returns the level of this enchantment.- Specified by:
getCELevelOnArmor
in interfaceCEHandler
- Parameters:
p
- Player whose armor is examined for the specified enchant.- Returns:
- return the level of this enchantment.
-
getCELevelOnAllArmor
public int getCELevelOnAllArmor(org.bukkit.entity.Player p) If a player is wearing an item with the effect represented by the specified CEHandler, it returns the level of this enchantment.- Specified by:
getCELevelOnAllArmor
in interfaceCEHandler
- Parameters:
p
- Player whose armor is examined for the specified enchant.- Returns:
- return the level of this enchantment.
-
getOccurrence
public double getOccurrence()It returns the chance of occurrence at the max level.- Specified by:
getOccurrence
in interfaceCEHandler
- Returns:
- the occurrence at the max level.
-
getMinimumOccurrence
public double getMinimumOccurrence()Description copied from interface:CEHandler
It returns the minimum chance of occurrence.- Specified by:
getMinimumOccurrence
in interfaceCEHandler
- Returns:
- the minimum occurrence.
-
isEnabled
public boolean isEnabled() -
getCooldown
public int getCooldown()Description copied from interface:CEHandler
It returns the maximum cooldown.- Specified by:
getCooldown
in interfaceCEHandler
- Returns:
- the maximum cooldown.
-
resetCooldown
public void resetCooldown(org.bukkit.entity.Player p) - Specified by:
resetCooldown
in interfaceCEHandler
-
checkCooldown
public boolean checkCooldown(org.bukkit.entity.Player p, int currentlevel) - Specified by:
checkCooldown
in interfaceCEHandler
-
getSourceType
protected org.bukkit.Material getSourceType(org.bukkit.entity.Projectile projectile) -
addAllowed
This method will registerAddonClass the specified material to the list of allowable items for this CE;- Specified by:
addAllowed
in interfaceCEHandler
- Parameters:
allowed
- allowed material name
-
removeAllowed
This method will remove the specified material from the list of allowable items for this CE;- Specified by:
removeAllowed
in interfaceCEHandler
- Parameters:
allowed
- allowed material name
-
canEnchantItem
public boolean canEnchantItem(org.bukkit.inventory.ItemStack item) This method checks whether this CE can be applied to the specified item or not.- Specified by:
canEnchantItem
in interfaceCEHandler
- Specified by:
canEnchantItem
in interfacecom.vk2gpz.mc.api.enchantment.ICEHandler
- Parameters:
item
- The item to be examined.- Returns:
- true if this CE can be applied to thhe specified item
-
addConflict
This method will registerAddonClass the specified enchant name to the list of conflicting enchant of this CE;- Specified by:
addConflict
in interfaceCEHandler
- Parameters:
enchantName
- enchant name to be registered
-
removeConflict
This method will remove the specified enchant name from the list of conflict.- Specified by:
removeConflict
in interfaceCEHandler
- Parameters:
enchantName
- enchant name to be removed.
-
hasConflictWith
This method checks whether this CE conflicts with the specified enchant.- Specified by:
hasConflictWith
in interfaceCEHandler
- Parameters:
enchantName
- The item to be examined.- Returns:
- true if this CE conflicts with the specified enchant.
-
getConflicts
- Specified by:
getConflicts
in interfaceCEHandler
-
getEventPriorityMap
This method returns the pair of evnet name and its process priority for this CE.- Specified by:
getEventPriorityMap
in interfacecom.vk2gpz.mc.event.EventMapper
- Returns:
- the pair of evnet name and its process priority for this CE.
-
set
public Map<String,org.bukkit.event.EventPriority> set(String eventName, org.bukkit.event.EventPriority priority) Register event name and process priority pair.- Specified by:
set
in interfacecom.vk2gpz.mc.event.EventMapper
- Parameters:
eventName
- the name of the event class (e.g. BlockBreakEvent.class.getSimpleName())- Returns:
- the pair of evnet name and its process priority for this CE.
-
remove
Register event name and process priority pair.- Specified by:
remove
in interfacecom.vk2gpz.mc.event.EventMapper
- Parameters:
eventName
- the name of the event class (e.g. BlockBreakEvent.class.getSimpleName())- Returns:
- the pair of evnet name and its process priority for this CE.
-
getRarity
public com.vk2gpz.mc.enchantment.Rarity getRarity() -
isAvailable
- Specified by:
isAvailable
in interfaceCEHandler
-
getEnchantmentSlotType
public com.vk2gpz.mc.api.enchantment.EnchantmentSlotType getEnchantmentSlotType()- Specified by:
getEnchantmentSlotType
in interfaceCEHandler
- Specified by:
getEnchantmentSlotType
in interfacecom.vk2gpz.mc.api.enchantment.ICEHandler
- Returns:
- the EnchantmentSlotType
-
getEnumItemSlots
public com.vk2gpz.mc.api.enchantment.EnumItemSlot[] getEnumItemSlots()- Specified by:
getEnumItemSlots
in interfaceCEHandler
- Returns:
- the array of EnumItemSlot
-
getLevel
Description copied from interface:CEHandler
This method checks the given string and determine whehterh it starts its this enchant's name or alias, and returns the indicated level of enchantment. -
useActionBar
public boolean useActionBar()Description copied from interface:CEHandler
This method returns true if this CE is to use the action bar for messaging.- Specified by:
useActionBar
in interfaceCEHandler
- Returns:
- true if this CE is to use the action bar for messaging.
-
isThrownTool
protected boolean isThrownTool(org.bukkit.entity.Entity entity) -
getThrownItemStack
protected org.bukkit.inventory.ItemStack getThrownItemStack(org.bukkit.entity.Entity entity) -
getThrower
protected org.bukkit.entity.Entity getThrower(org.bukkit.entity.Entity projectile) -
forceCustomModelData
public boolean forceCustomModelData()- Specified by:
forceCustomModelData
in interfaceCEHandler
-
setForceCustomModelData
public void setForceCustomModelData(boolean force) - Specified by:
setForceCustomModelData
in interfaceCEHandler
-
getCustomModelData
public int getCustomModelData(org.bukkit.Material material) - Specified by:
getCustomModelData
in interfaceCEHandler
-
setCustomModelDataMap
- Specified by:
setCustomModelDataMap
in interfaceCEHandler
-
loadEffectSound
protected void loadEffectSound() -
getEffectSound
public org.bukkit.Sound getEffectSound()- Specified by:
getEffectSound
in interfaceCEHandler
-
getEffectSoundVolume
public float getEffectSoundVolume()- Specified by:
getEffectSoundVolume
in interfaceCEHandler
-
getEffectSoundPitch
public float getEffectSoundPitch()- Specified by:
getEffectSoundPitch
in interfaceCEHandler
-
playEffectSoundPlayerOnly
public boolean playEffectSoundPlayerOnly()- Specified by:
playEffectSoundPlayerOnly
in interfaceCEHandler
-
getCastingSound
public org.bukkit.Sound getCastingSound()- Specified by:
getCastingSound
in interfaceCEHandler
-
getCastingSoundVolume
public float getCastingSoundVolume()- Specified by:
getCastingSoundVolume
in interfaceCEHandler
-
getCastingSoundPitch
public float getCastingSoundPitch()- Specified by:
getCastingSoundPitch
in interfaceCEHandler
-
findTheLevelEntry
protected int findTheLevelEntry(int lvl) -
execCommands
public boolean execCommands(org.bukkit.entity.Player p, org.bukkit.inventory.ItemStack item, int level, org.bukkit.Location loc, Object... somedata) - Specified by:
execCommands
in interfaceCEHandler
-
papi
-
applyOffHand
public boolean applyOffHand()- Specified by:
applyOffHand
in interfaceCEHandler
-
requirFullArmor
public boolean requirFullArmor()- Specified by:
requirFullArmor
in interfaceCEHandler
-
getSupportedItems
- Specified by:
getSupportedItems
in interfacecom.vk2gpz.mc.api.enchantment.ICEHandler
-