master
alvinmeme 4 years ago
commit 90328e6f7e
  1. 12
      WeedPlugin.iml
  2. 18
      src/me/alvinmeme/weedplugin/Main.java
  3. 35
      src/me/alvinmeme/weedplugin/WeedListener.java
  4. 5
      src/plugin.yml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="spigot-1.13.2" level="project" />
</component>
</module>

@ -0,0 +1,18 @@
package me.alvinmeme.weedplugin;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin
{
@Override
public void onEnable()
{
getServer().getPluginManager().registerEvents(new WeedListener(), this);
}
@Override
public void onDisable()
{
}
}

@ -0,0 +1,35 @@
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;
}
}

@ -0,0 +1,5 @@
name: WeedPlugin
version: 1.0.0
author: Alvinmeme
main: me.alvinmeme.weedplugin.Main
api-version: 1.13
Loading…
Cancel
Save