Modify Vanilla Ender Pearl Cooldown

U

/u/Dark_Gladiator

Guest
Member
Hi! I am trying to make a plugin that changes the cooldown time of an ender pearl! The problem is I want to have the normal white overlay on the ender pearl that lasts as long as I set it to in the config. Right now I can set the pearl cooldown to work but the white overlay does not last as long as the cooldown lasts. Please lmk if you know how to fix this. I believe it is because the ender pearl already has a vanilla cooldown because any item without a cooldown works!

Below is my code:

package org.gladiator.pearlcooldown; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.plugin.java.JavaPlugin; public class PearlCooldown extends JavaPlugin implements Listener { private int pearlCooldown; // in seconds @Override public void onEnable() { saveDefaultConfig(); // Register events getServer().getPluginManager().registerEvents(this, this); // Load configuration pearlCooldown = getConfig().getInt("pearlCooldown"); } @EventHandler public void onProjectileLaunch(ProjectileLaunchEvent event) { if (event.getEntity().getShooter() instanceof Player) { Player player = (Player) event.getEntity().getShooter(); // Check if the projectile is an ender pearl if (event.getEntityType() == EntityType.ENDER_PEARL) { // Start cooldown setPearlCooldown(player, pearlCooldown); } } } private void setPearlCooldown(Player player, int seconds) { // Set the cooldown, overriding the default cooldown player.setCooldown(Material.ENDER_PEARL, seconds * 20); // Convert seconds to ticks } }



submitted by /u/Dark_Gladiator
[link] [comments]

Continue reading...

free plugins
minecraft paid for free
spigotmc
SpigotMC
free minecraft paid plugins
free minecraft plugins
aac free
ewg free
Minecraft Premium Plugins
ewg free download
litebans free
epicworldgenerator free
free schematics
leaked schematics minecraft
schematics
schematics leaked
schematics free
minecraft schematics free
paid minecraft schematics free
paid minecraft schematics for free
free cracked plugins
free cracked minecraft plugins
plugins
featherboard download
featherboard plugin download
antiaura download
minecraft plugins
xenforo leaked
xenforo for free
xenforo addons
 
BlackSpigot General Chat
Rules Help Users
    S @ superme0s: This
    Top