36 lines
1.4 KiB
Java
36 lines
1.4 KiB
Java
package me.alvinmeme.weedplugin;
|
|
|
|
import org.bukkit.*;
|
|
import org.bukkit.entity.Player;
|
|
import org.bukkit.event.EventHandler;
|
|
import org.bukkit.event.Listener;
|
|
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
|
import org.bukkit.inventory.ItemStack;
|
|
import org.bukkit.potion.PotionEffect;
|
|
import org.bukkit.potion.PotionEffectType;
|
|
|
|
public class WeedListener implements Listener
|
|
{
|
|
@EventHandler
|
|
public void onPlayerEat(PlayerItemConsumeEvent event)
|
|
{
|
|
ItemStack item = event.getItem();
|
|
if (item.getType().equals(Material.DRIED_KELP))
|
|
{
|
|
if (item.getItemMeta().getDisplayName().equals(ChatColor.GREEN + "Weed"))
|
|
{
|
|
Player player = event.getPlayer();
|
|
player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 400, 1));
|
|
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 400, 4));
|
|
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 400, 19));
|
|
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 400, 1));
|
|
Location location = player.getLocation();
|
|
location.getWorld().playSound(location, Sound.ENTITY_EVOKER_PREPARE_WOLOLO, SoundCategory.PLAYERS, 1f, 1f);
|
|
player.sendMessage(ChatColor.ITALIC + "das sum good weed");
|
|
return;
|
|
}
|
|
} else return;
|
|
}
|
|
}
|
|
|