good weed

This commit is contained in:
alvinmeme 2018-12-20 06:13:18 +01:00
commit 90328e6f7e
4 changed files with 70 additions and 0 deletions

12
WeedPlugin.iml Normal file
View File

@ -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>

View File

@ -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()
{
}
}

View File

@ -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;
}
}

5
src/plugin.yml Normal file
View File

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