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.PermissionModeNested classes/interfaces inherited from interface com.vk2gpz.mc.api.enchantment.ICEHandler
com.vk2gpz.mc.api.enchantment.ICEHandler.Cost -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected booleanprotected Set<CEHandler.Availability> protected intprotected org.bukkit.Soundprotected floatprotected floatprotected Map<Integer, List<CEHandler.CECommand>> protected final intprotected org.bukkit.configuration.file.FileConfigurationprotected intprotected Stringprotected Stringcooldown relatedprotected Stringprotected double[]protected static final Stringprotected Stringprotected intprotected intprotected org.bukkit.Soundprotected floatprotected floatprotected booleanprotected doubleprotected org.bukkit.enchantments.Enchantmentprotected com.vk2gpz.mc.api.enchantment.EnchantmentSlotTypeprotected org.bukkit.enchantments.EnchantmentTargetprotected com.vk2gpz.mc.api.enchantment.EnumItemSlot[]protected intprotected booleanprotected booleanprotected booleanprotected intprotected Stringprotected intprotected intprotected CEHandler.MergeModeprotected Stringprotected doubleprotected doubleprotected Stringprotected CEHandler.PermissionModeprotected Stringprotected booleanprotected org.bukkit.plugin.Pluginprotected org.bukkit.potion.PotionEffectTypeprotected doubleprotected com.vk2gpz.mc.enchantment.Rarityprotected doubleprotected booleanprotected Set<org.bukkit.Material> protected ITokenEnchantRepresents actual TokenEnchat plugin.protected booleanprotected booleanFields 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 TypeMethodDescriptionvoidaddAllowed(String allowed) This method will registerAddonClass the specified material to the list of allowable items for this CE;voidaddConflict(String enchantName) This method will registerAddonClass the specified enchant name to the list of conflicting enchant of this CE;booleanapplyState(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.booleancanApply(org.bukkit.entity.Player player) booleancanEnchantItem(org.bukkit.inventory.ItemStack item) This method checks whether this CE can be applied to the specified item or not.booleancheckCooldown(org.bukkit.entity.Player p, int currentlevel) voidcleanup()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.booleanconflictsWith(CEHandler cdh) booleanconflictsWith(@NotNull org.bukkit.enchantments.Enchantment enchantment) voiddoHelp(org.bukkit.command.CommandSender sender) If this custom enchantment/potion has a command, you can provide its help description in this method.booleanbooleanexecCommands(org.bukkit.entity.Player p, org.bukkit.inventory.ItemStack item, int level, org.bukkit.Location loc, Object... somedata) protected intfindTheLevelEntry(int lvl) booleangetAlias()Reads the alias name of this custom enchantment from config.yml if it's specified under "alias:", null otherwise.protected org.bukkit.ChatColorgetAllowed(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.ChatColorgetAllowed(org.bukkit.entity.Player p, String perm) Deprecated.intgetBase()It returns the base enchant level.org.bukkit.SoundfloatfloatintgetCELevel(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.intgetCELevel(org.bukkit.entity.Player p, org.bukkit.inventory.ItemStack itemStack) It returns the level of this enchantment on the specified item.intgetCELevel(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.intgetCELevelOnAllArmor(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.intgetCELevelOnArmor(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.FileConfigurationintIt 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[]intgetCustomModelData(org.bukkit.Material material) It returns the description of this effect.intReturns the duration of this potion effect.intThis method returns the duration multiplier of a potion effect if any.org.bukkit.SoundfloatfloatdoubleIt returns the enchantment chance for this effect.org.bukkit.enchantments.Enchantmentcom.vk2gpz.mc.api.enchantment.EnchantmentSlotTypecom.vk2gpz.mc.api.enchantment.EnumItemSlot[]intgetETMax()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.intIt returns the interval of effect increase.org.bukkit.enchantments.EnchantmentTargetgetKey()intThis method checks the given string and determine whehterh it starts its this enchant's name or alias, and returns the indicated level of enchantment.intIt returns the max enchant level.intIt returns the max merged enchant level.It returns the merge mode.doubleIt returns the minimum chance of occurrence.getName()Returns the name of this custom enchantment/potion.doubleIt 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.Pluginorg.bukkit.potion.PotionEffectTypedoublegetPrice()It returns the base price.com.vk2gpz.mc.enchantment.RaritydoubleIt returns whether this enchant is refundable or norintgetScale()/** It returns the scale of the encahntment level.protected org.bukkit.MaterialgetSourceType(org.bukkit.entity.Projectile projectile) Set<org.bukkit.Material> getTE()protected org.bukkit.entity.EntitygetThrower(org.bukkit.entity.Entity projectile) protected org.bukkit.inventory.ItemStackgetThrownItemStack(org.bukkit.entity.Entity entity) Returns the version of this custom enchantmentbooleanhasConflictWith(String enchantName) This method checks whether this CE conflicts with the specified enchant.inthashCode()booleanisAvailable(CEHandler.Availability availability) booleanbooleanisHidden()booleanisOldAlias(String oldAlias) booleanprotected booleanisThrownTool(org.bukkit.entity.Entity entity) booleanDeprecated.booleanisValid(org.bukkit.Location location) Returns true if the specified player is allowed to use the specified enchantment at the specified location.voidIf the custom enchantment/potion needs to load any configuration informaiton from config.yml, config loading process should be written in this method.protected voidbooleanonCommand(@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 StringbooleanRegister event name and process priority pair.voidremove(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.voidremoveAllowed(String allowed) This method will remove the specified material from the list of allowable items for this CE;voidremoveConflict(String enchantName) This method will remove the specified enchant name from the list of conflict.booleanremoveState(org.bukkit.entity.Player player, int level) protected StringThis method returns the version string of the required TokenEnchant plugin.booleanvoidresetCooldown(org.bukkit.entity.Player p) Register event name and process priority pair.protected voidvoidsetCustomModelDataMap(Map<org.bukkit.Material, Integer> cmd_map) voidsetEnchantment(org.bukkit.enchantments.Enchantment enchantment) voidsetForceCustomModelData(boolean force) voidsetMaxLevel(int max) Sets the max enchantment level.voidvoidsetPotionEffectType(org.bukkit.potion.PotionEffectType potionEffectType) voidsetUseRomanNumeral(boolean use) booleanbooleanThis method returns true if this CE is to use the action bar for messaging.booleanMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods 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:
useRomanNumeralin interfaceCEHandler
-
setName
-
getName
Description copied from interface:CEHandlerReturns the name of this custom enchantment/potion. -
isHidden
public boolean isHidden() -
getEnchantment
public org.bukkit.enchantments.Enchantment getEnchantment()- Specified by:
getEnchantmentin interfacecom.vk2gpz.mc.api.enchantment.ICEHandler
-
setEnchantment
public void setEnchantment(org.bukkit.enchantments.Enchantment enchantment) - Specified by:
setEnchantmentin interfacecom.vk2gpz.mc.api.enchantment.ICEHandler
-
getPotionEffectType
public org.bukkit.potion.PotionEffectType getPotionEffectType()- Specified by:
getPotionEffectTypein interfaceCEHandler
-
setPotionEffectType
public void setPotionEffectType(org.bukkit.potion.PotionEffectType potionEffectType) - Specified by:
setPotionEffectTypein interfaceCEHandler
-
setConfig
protected void setConfig() -
equals
-
hashCode
public int hashCode() -
isRegistered
public boolean isRegistered()- Specified by:
isRegisteredin 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:
getVersionin 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:
onCommandin 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:
onTabCompletein 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:CEHandlerIf 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:
applyStatein 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:
removeStatein 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:
loadConfigin 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:
getItemTargetin interfaceCEHandler
-
conflictsWith
public boolean conflictsWith(@NotNull @NotNull org.bukkit.enchantments.Enchantment enchantment) - Specified by:
conflictsWithin interfaceCEHandler- Specified by:
conflictsWithin interfacecom.vk2gpz.mc.api.enchantment.ICEHandler
-
conflictsWith
- Specified by:
conflictsWithin interfaceCEHandler
-
getAlias
Reads the alias name of this custom enchantment from config.yml if it's specified under "alias:", null otherwise. -
getOldAliases
- Specified by:
getOldAliasesin interfaceCEHandler
-
isOldAlias
-
getDurationMultiplier
public int getDurationMultiplier()Description copied from interface:CEHandlerThis method returns the duration multiplier of a potion effect if any.- Specified by:
getDurationMultiplierin interfaceCEHandler- Returns:
- the duration multiplier of a potion effect if any.
-
getDuration
public int getDuration()Returns the duration of this potion effect.- Specified by:
getDurationin 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:
getPermissionNodein 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:
getPermissionModein interfaceCEHandler- Returns:
- the permission mode.
-
getEnchantChance
public double getEnchantChance()It returns the enchantment chance for this effect.- Specified by:
getEnchantChancein interfaceCEHandler- Returns:
- the enchantment chance.
-
showDescription
public boolean showDescription()- Specified by:
showDescriptionin interfaceCEHandler
-
getDescription
It returns the description of this effect.- Specified by:
getDescriptionin interfaceCEHandler- Returns:
- the description.
-
getMergeMode
It returns the merge mode.- Specified by:
getMergeModein interfaceCEHandler- Returns:
- the merge node.
-
getMaxLevel
public int getMaxLevel()It returns the max enchant level.- Specified by:
getMaxLevelin interfaceCEHandler- Specified by:
getMaxLevelin 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:
getMergeMaxin 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:
getIntervalin 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:
getCostFormulain interfaceCEHandler- Returns:
- the id for cost function, which is defined in CostFormulae.js
-
getCostParams
public double[] getCostParams()- Specified by:
getCostParamsin interfaceCEHandler
-
getOccurrenceFormula
It returns the id for a function, which is defined in OccurrenceFormulae.js- Specified by:
getOccurrenceFormulain 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:
getCooldownFormulain 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:
getRefundRatein interfaceCEHandler- Returns:
- the refunding rate.
-
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:
getCELevelin 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:
getCELevelin 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:
getCELevelin 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:
getCELevelOnArmorin 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:
getCELevelOnAllArmorin 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:
getOccurrencein interfaceCEHandler- Returns:
- the occurrence at the max level.
-
getMinimumOccurrence
public double getMinimumOccurrence()Description copied from interface:CEHandlerIt returns the minimum chance of occurrence.- Specified by:
getMinimumOccurrencein interfaceCEHandler- Returns:
- the minimum occurrence.
-
isEnabled
public boolean isEnabled() -
getCooldown
public int getCooldown()Description copied from interface:CEHandlerIt returns the maximum cooldown.- Specified by:
getCooldownin interfaceCEHandler- Returns:
- the maximum cooldown.
-
resetCooldown
public void resetCooldown(org.bukkit.entity.Player p) - Specified by:
resetCooldownin interfaceCEHandler
-
checkCooldown
public boolean checkCooldown(org.bukkit.entity.Player p, int currentlevel) - Specified by:
checkCooldownin 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:
addAllowedin 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:
removeAllowedin 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:
canEnchantItemin interfaceCEHandler- Specified by:
canEnchantItemin 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:
addConflictin interfaceCEHandler- Parameters:
enchantName- enchant name to be registered
-
removeConflict
This method will remove the specified enchant name from the list of conflict.- Specified by:
removeConflictin interfaceCEHandler- Parameters:
enchantName- enchant name to be removed.
-
hasConflictWith
This method checks whether this CE conflicts with the specified enchant.- Specified by:
hasConflictWithin interfaceCEHandler- Parameters:
enchantName- The item to be examined.- Returns:
- true if this CE conflicts with the specified enchant.
-
getConflicts
- Specified by:
getConflictsin interfaceCEHandler
-
getEventPriorityMap
This method returns the pair of evnet name and its process priority for this CE.- Specified by:
getEventPriorityMapin 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:
setin 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:
removein 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:
isAvailablein interfaceCEHandler
-
getEnchantmentSlotType
public com.vk2gpz.mc.api.enchantment.EnchantmentSlotType getEnchantmentSlotType()- Specified by:
getEnchantmentSlotTypein interfaceCEHandler- Specified by:
getEnchantmentSlotTypein interfacecom.vk2gpz.mc.api.enchantment.ICEHandler- Returns:
- the EnchantmentSlotType
-
getEnumItemSlots
public com.vk2gpz.mc.api.enchantment.EnumItemSlot[] getEnumItemSlots()- Specified by:
getEnumItemSlotsin interfaceCEHandler- Returns:
- the array of EnumItemSlot
-
getLevel
Description copied from interface:CEHandlerThis 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:CEHandlerThis method returns true if this CE is to use the action bar for messaging.- Specified by:
useActionBarin 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:
forceCustomModelDatain interfaceCEHandler
-
setForceCustomModelData
public void setForceCustomModelData(boolean force) - Specified by:
setForceCustomModelDatain interfaceCEHandler
-
getCustomModelData
public int getCustomModelData(org.bukkit.Material material) - Specified by:
getCustomModelDatain interfaceCEHandler
-
setCustomModelDataMap
- Specified by:
setCustomModelDataMapin interfaceCEHandler
-
loadEffectSound
protected void loadEffectSound() -
getEffectSound
public org.bukkit.Sound getEffectSound()- Specified by:
getEffectSoundin interfaceCEHandler
-
getEffectSoundVolume
public float getEffectSoundVolume()- Specified by:
getEffectSoundVolumein interfaceCEHandler
-
getEffectSoundPitch
public float getEffectSoundPitch()- Specified by:
getEffectSoundPitchin interfaceCEHandler
-
playEffectSoundPlayerOnly
public boolean playEffectSoundPlayerOnly()- Specified by:
playEffectSoundPlayerOnlyin interfaceCEHandler
-
getCastingSound
public org.bukkit.Sound getCastingSound()- Specified by:
getCastingSoundin interfaceCEHandler
-
getCastingSoundVolume
public float getCastingSoundVolume()- Specified by:
getCastingSoundVolumein interfaceCEHandler
-
getCastingSoundPitch
public float getCastingSoundPitch()- Specified by:
getCastingSoundPitchin 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:
execCommandsin interfaceCEHandler
-
papi
-
applyOffHand
public boolean applyOffHand()- Specified by:
applyOffHandin interfaceCEHandler
-
requirFullArmor
public boolean requirFullArmor()- Specified by:
requirFullArmorin interfaceCEHandler
-
getSupportedItems
- Specified by:
getSupportedItemsin interfacecom.vk2gpz.mc.api.enchantment.ICEHandler
-