Package studio.magemonkey.codex.compat
Interface NMS
public interface NMS
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidaddSkullTexture(org.bukkit.inventory.ItemStack item, String value, UUID uuid) voidchangeSkull(org.bukkit.block.Block block, String hash) default org.bukkit.event.entity.EntityDamageByEntityEventcreateEntityDamageEvent(org.bukkit.entity.Entity entity, org.bukkit.entity.Entity attacker, org.bukkit.event.entity.EntityDamageEvent.DamageCause cause, double damage) Attempts to parse/reparse the colors of a string to ensure consistent formattingdefault org.bukkit.attribute.AttributegetAttribute(String name) default doublegetAttributeValue(org.bukkit.inventory.ItemStack item, org.bukkit.attribute.Attribute attribute) io.netty.channel.ChannelgetChannel(org.bukkit.entity.Player player) Gets the channel for the playergetConnection(org.bukkit.entity.Player player) Gets the connection for the player.doublegetDefaultArmor(org.bukkit.inventory.ItemStack itemStack) Gets the default armor of the given item.doublegetDefaultDamage(org.bukkit.inventory.ItemStack itemStack) Gets the default attack damage for the given item.doublegetDefaultSpeed(org.bukkit.inventory.ItemStack itemStack) Gets the default attack speed of the given item.doublegetDefaultToughness(org.bukkit.inventory.ItemStack itemStack) Gets the default armor toughness of the given item.default Fielddefault net.md_5.bungee.api.chat.HoverEventgetHoverEvent(org.bukkit.inventory.ItemStack itemStack) org.bukkit.MaterialgetMaterial(org.bukkit.entity.Boat boat) getNMSCopy(org.bukkit.inventory.ItemStack itemStack) default com.mojang.authlib.GameProfilegetNonPlayerProfile(String hash) default net.md_5.bungee.api.chat.BaseComponentgetTranslatedComponent(org.bukkit.inventory.ItemStack itemStack) Gets the version of the NMS implementationbooleanisArmor(org.bukkit.inventory.ItemStack itemStack) Determines if the given item is armor.booleanisTool(org.bukkit.inventory.ItemStack itemStack) Determines if the given item is a tool.booleanisWeapon(org.bukkit.inventory.ItemStack itemStack) Determines if the given item is a weapon.voidopenChestAnimation(org.bukkit.block.Block chest, boolean open) Plays the chest animation for the given blockdefault org.bukkit.scoreboard.ObjectiveregisterNewObjective(org.bukkit.scoreboard.Scoreboard scoreboard, org.bukkit.scoreboard.Objective objective) voidsendAttackPacket(org.bukkit.entity.Player player, int i) Simulates the player attackingvoidsendPacket(org.bukkit.entity.Player player, Object packet) Sends a packet to the playervoidsetKiller(org.bukkit.entity.LivingEntity entity, org.bukkit.entity.Player killer) toJson(org.bukkit.inventory.ItemStack itemStack) Gets the NBT string of the given item in JSON.
-
Method Details
-
getVersion
String getVersion()Gets the version of the NMS implementation- Returns:
- the version of the NMS implementation
-
getConnection
Gets the connection for the player. This is a PlayerConnection object.- Parameters:
player- the player to get the connection for- Returns:
- the connection for the player
-
getChannel
@NotNull io.netty.channel.Channel getChannel(@NotNull org.bukkit.entity.Player player) Gets the channel for the player- Parameters:
player- the player to get the channel for- Returns:
- the channel for the player
-
sendPacket
Sends a packet to the player- Parameters:
player- the player to send the packet topacket- the packet to send
-
openChestAnimation
void openChestAnimation(@NotNull org.bukkit.block.Block chest, boolean open) Plays the chest animation for the given block- Parameters:
chest- the chest block to play the animation foropen- true if the chest should be opened, false if it should be closed
-
sendAttackPacket
void sendAttackPacket(@NotNull org.bukkit.entity.Player player, int i) Simulates the player attacking- Parameters:
player- the player to simulate the attack fori- the type of attack
-
fixColors
Attempts to parse/reparse the colors of a string to ensure consistent formatting- Parameters:
str- the string to fix- Returns:
- the fixed string
-
getDefaultDamage
double getDefaultDamage(@NotNull org.bukkit.inventory.ItemStack itemStack) Gets the default attack damage for the given item.- Parameters:
itemStack- the item to get the default damage for- Returns:
- the default attack damage for the item
-
getDefaultSpeed
double getDefaultSpeed(@NotNull org.bukkit.inventory.ItemStack itemStack) Gets the default attack speed of the given item.- Parameters:
itemStack- the item to get the default speed of- Returns:
- the default attack speed of the item
-
getDefaultArmor
double getDefaultArmor(@NotNull org.bukkit.inventory.ItemStack itemStack) Gets the default armor of the given item.- Parameters:
itemStack- the item to get the default armor of- Returns:
- the default armor of the item
-
getDefaultToughness
double getDefaultToughness(@NotNull org.bukkit.inventory.ItemStack itemStack) Gets the default armor toughness of the given item.- Parameters:
itemStack- the item to get the default toughness of- Returns:
- the default armor toughness of the item
-
isWeapon
boolean isWeapon(@NotNull org.bukkit.inventory.ItemStack itemStack) Determines if the given item is a weapon. Weapons include swords, bows, crossbows, tridents, and axes.- Parameters:
itemStack- the item to check- Returns:
- true if the item is a weapon, false otherwise
-
isArmor
boolean isArmor(@NotNull org.bukkit.inventory.ItemStack itemStack) Determines if the given item is armor. Armor includes helmets, chestplates, leggings, and boots.- Parameters:
itemStack- the item to check- Returns:
- true if the item is armor, false otherwise
-
isTool
boolean isTool(@NotNull org.bukkit.inventory.ItemStack itemStack) Determines if the given item is a tool. Tools include pickaxes, axes, shovels, hoes, and shears.- Parameters:
itemStack- the item to check- Returns:
- true if the item is a tool, false otherwise
-
toJson
Gets the NBT string of the given item in JSON.- Parameters:
itemStack- the item to get the NBT string of- Returns:
- the NBT string of the item
-
setKiller
void setKiller(@NotNull org.bukkit.entity.LivingEntity entity, @NotNull org.bukkit.entity.Player killer) -
changeSkull
-
addSkullTexture
-
getNonPlayerProfile
-
getAttributeValue
default double getAttributeValue(@NotNull org.bukkit.inventory.ItemStack item, @NotNull org.bukkit.attribute.Attribute attribute) -
getAttribute
-
getNMSCopy
-
getMaterial
org.bukkit.Material getMaterial(org.bukkit.entity.Boat boat) -
getHoverEvent
default net.md_5.bungee.api.chat.HoverEvent getHoverEvent(@NotNull org.bukkit.inventory.ItemStack itemStack) -
registerNewObjective
default org.bukkit.scoreboard.Objective registerNewObjective(org.bukkit.scoreboard.Scoreboard scoreboard, org.bukkit.scoreboard.Objective objective) -
getTranslatedComponent
default net.md_5.bungee.api.chat.BaseComponent getTranslatedComponent(@NotNull org.bukkit.inventory.ItemStack itemStack) -
createEntityDamageEvent
default org.bukkit.event.entity.EntityDamageByEntityEvent createEntityDamageEvent(@NotNull org.bukkit.entity.Entity entity, @NotNull org.bukkit.entity.Entity attacker, @NotNull org.bukkit.event.entity.EntityDamageEvent.DamageCause cause, double damage) -
getField
@NotNull default Field getField(@NotNull Class<?> clazz, @NotNull String fieldName) throws NoSuchFieldException - Throws:
NoSuchFieldException
-