Mineplex2018-withcommit/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/SoupAddon.java

67 lines
1.7 KiB
Java
Raw Normal View History

2013-08-27 17:14:08 +02:00
package nautilus.game.arcade.addons;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import nautilus.game.arcade.ArcadeManager;
public class SoupAddon extends MiniPlugin
{
public ArcadeManager Manager;
public SoupAddon(JavaPlugin plugin, ArcadeManager manager)
{
super("Soup Addon", plugin);
Manager = manager;
}
@EventHandler
public void EatSoup(PlayerInteractEvent event)
{
if (Manager.GetGame() == null)
return;
if (!Manager.GetGame().IsLive())
return;
if (!Manager.GetGame().SoupEnabled)
return;
Player player = event.getPlayer();
2015-07-23 05:31:07 +02:00
if (!Manager.GetGame().IsAlive(player))
return;
2013-08-27 17:14:08 +02:00
if (!UtilGear.isMat(player.getItemInHand(), Material.MUSHROOM_SOUP))
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
//Effect
player.getWorld().playSound(player.getLocation(), Sound.EAT, 2f, 1f);
player.getWorld().playEffect(player.getEyeLocation(), Effect.STEP_SOUND, 39);
player.getWorld().playEffect(player.getEyeLocation(), Effect.STEP_SOUND, 40);
//Healing
2014-04-13 09:20:49 +02:00
Manager.GetCondition().Factory().Custom("Mushroom Soup", player, player, ConditionType.REGENERATION, 4, 1, false, Material.MUSHROOM_SOUP, (byte)0, true);
2013-08-27 17:14:08 +02:00
//Food
UtilPlayer.hunger(player, 3);
event.setCancelled(true);
player.setItemInHand(null);
}
}