Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.CraftCreeper6.zeartool;
- import java.util.ArrayList;
- import java.util.List;
- import org.bukkit.ChatColor;
- import org.bukkit.Material;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.block.Action;
- import org.bukkit.event.player.PlayerInteractEvent;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.meta.ItemMeta;
- import org.bukkit.potion.PotionEffect;
- import org.bukkit.potion.PotionEffectType;
- import org.bukkit.util.Vector;
- public class MainListener implements Listener {
- @EventHandler
- public void onClick(PlayerInteractEvent event) {
- Player p = event.getPlayer();
- ItemStack stick = new ItemStack(Material.STICK);
- ItemMeta smeta = stick.getItemMeta();
- smeta.setDisplayName("§c§nInvisibilty");
- List<String> lorename = new ArrayList<String>();
- lorename
- .add(ChatColor.DARK_PURPLE
- + "Right click to turn invisible for 10 seconds.");
- smeta.setLore(lorename);
- stick.setItemMeta(smeta);
- if (event.getAction() == Action.RIGHT_CLICK_BLOCK
- || event.getAction() == Action.RIGHT_CLICK_AIR) {
- if (event.getItem().getType().equals(stick)) {
- if (p.hasPotionEffect(PotionEffectType.INVISIBILITY)) {
- return;
- }
- p.addPotionEffect(new PotionEffect(
- PotionEffectType.INVISIBILITY, 200, 1));
- return;
- }ItemStack ironaxe = new ItemStack(Material.IRON_AXE);
- ItemMeta iameta = ironaxe.getItemMeta();
- iameta.setDisplayName("§c§nHigh Jump");
- List<String> lorename1 = new ArrayList<String>();
- lorename1
- .add(ChatColor.DARK_PURPLE
- + "Right click to jump high in the sky and deal AOE damage when you hit the ground!");
- iameta.setLore(lorename1);
- ironaxe.setItemMeta(iameta);
- if (event.getAction() == Action.RIGHT_CLICK_BLOCK
- || event.getAction() == Action.RIGHT_CLICK_AIR) {
- if (event.getItem().hasItemMeta()) {
- if (event.getItem().getItemMeta().getDisplayName().equalsIgnoreCase("§c§nHigh Jump")){ // Check this line, might not be right. If it works, remove the new ItemStack code
- p.setFlying(false);
- Vector jump = p.getLocation().getDirection().multiply(0.2).setY(1.1);
- p.setVelocity(p.getVelocity().add(jump));
- }
- if (event.getItem().getType().equals(Material.COOKED_BEEF));
- p.addPotionEffect(new PotionEffect(
- PotionEffectType.SPEED, 100, 1));
- return;
- }
- return;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement