Plugin category: Fun/Mechanics Minecraft version: Spigot 1.8.8 Suggested name: SpecialSkills What I would like : When a player gets damaged by another player and the player that got damaged has a Leather Chestplate that has a lore "&7Dodge Skill", the damaged player has a 10% chance to 'dodge' the attack which means the damaged player will take no damage and get the message "&eDodge Skill Active" If it's possible: you can edit the lore, the message and the percent chance to dodge. Ideas for commands: No commands needed No permissions needed,
Let me know if something needs to be changed! I added the command /specialskills so you can give yourself the armor easily (as set by color in the config) Also, if this solved it for you, please mark the thread as filled, thank you.
@Allek @JustNoHacks I made it similar. No command though and mainly to learn a bit: Main: Code:java package me.ialistannen.dogearmor import me.ialistannen.dogearmor.listener.HitListenerimport org.bukkit.Bukkitimport org.bukkit.plugin.java.JavaPlugin /*** `This is code` **and I am bold***/class DogeArmor : JavaPlugin() { companion object { lateinit var instance: DogeArmor private set } override fun onEnable() { instance = this saveDefaultConfig() Bukkit.getPluginManager().registerEvents(HitListener(), this) logger.info("Kotlin Test Plugin has been enabled!") }} Listener: Code:java package me.ialistannen.dogearmor.listener import me.ialistannen.dogearmor.DogeArmorimport org.bukkit.ChatColorimport org.bukkit.Materialimport org.bukkit.entity.Playerimport org.bukkit.event.EventHandlerimport org.bukkit.event.Listenerimport org.bukkit.event.entity.EntityDamageByEntityEventimport java.util.concurrent.ThreadLocalRandom class HitListener : Listener { /** * Colors a String * * **Only works on non-null strings.** * * Uses `ChatColor.translateAlternateColorCodes('&', String)` internally */ fun String.color(): String { return ChatColor.translateAlternateColorCodes('&', this) } @EventHandler fun onHit(event: EntityDamageByEntityEvent) { if (event.damager !is Player || event.entity !is Player) { return } // if he has no chestplate if ((event.entity as Player).inventory?.chestplate?.type != Material.LEATHER_CHESTPLATE) { return } // get the name of the chestplate and the name from the config, return if null val name: String? = (event.entity as Player).inventory.chestplate?.itemMeta?.displayName?.color() val desiredName = DogeArmor.instance.config.getString("doge.chestplate.name")?.color() ?: return // allow a blank desiredName to act as a wildcard if (!desiredName.isBlank() && name != desiredName) { return } val dogeChance = DogeArmor.instance.config.getDouble("doge.percentage") val random = ThreadLocalRandom.current().nextDouble(1.0) if (random > dogeChance) { return } event.isCancelled = true event.entity.sendMessage(DogeArmor.instance.config.getString("doge.message").replace("{0}", event.damager.name).color()) }} Link: Dropbox.