Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.Pvpuiwill.Pguns;
- import org.bukkit.ChatColor;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.event.player.*;
- import org.bukkit.Material;
- import org.bukkit.Sound;
- import org.bukkit.World;
- import org.bukkit.entity.Snowball;
- 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.entity.EntityDamageByEntityEvent;
- import org.bukkit.event.player.PlayerInteractEvent;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.PlayerInventory;
- import org.bukkit.inventory.meta.ItemMeta;
- import org.bukkit.potion.PotionEffect;
- import org.bukkit.potion.PotionEffectType;
- import org.bukkit.Bukkit;
- /**
- * Made By Pvpuiwill /*
- */
- //ak47
- public class GunListener implements Listener {
- @EventHandler
- public void onPlayerInteract(PlayerInteractEvent e) {
- Player p = e.getPlayer();
- if (!(p.hasPermission("ak47.use"))) { return; }
- if (!(e.getAction() == Action.RIGHT_CLICK_AIR)) { return; }
- if (!(e.getItem().getType() == Material.DIAMOND_PICKAXE)) { return; }
- Snowball snowball = p.launchProjectile(Snowball.class);
- snowball.setVelocity(e.getPlayer().getLocation().getDirection().normalize().multiply(5));
- World w = p.getWorld();
- w.playSound(p.getLocation(), Sound.DOOR_OPEN, 10, 1);
- return;
- }
- //deagle
- @EventHandler
- public void onPlayerInteract1(PlayerInteractEvent e1) {
- Player p1 = e1.getPlayer();
- if (!(p1.hasPermission("deagle.use"))) { return; }
- if (!(e1.getAction() == Action.RIGHT_CLICK_AIR)) { return; }
- if (!(e1.getItem().getType() == Material.IRON_AXE)) { return; }
- Snowball snowball = p1.launchProjectile(Snowball.class);
- snowball.setVelocity(e1.getPlayer().getLocation().getDirection().normalize().multiply(5));
- World w1 = p1.getWorld();
- w1.playSound(p1.getLocation(), Sound.DOOR_CLOSE, 6, 1);
- return;
- }
- //glock
- @EventHandler
- public void onPlayerInteract2(PlayerInteractEvent e2) {
- Player p2 = e2.getPlayer();
- if (!(p2.hasPermission("glock.use"))) { return; }
- if (!(e2.getAction() == Action.RIGHT_CLICK_AIR)) { return; }
- if (!(e2.getItem().getType() == Material.IRON_SPADE)) { return; }
- Snowball snowball = p2.launchProjectile(Snowball.class);
- snowball.setVelocity(e2.getPlayer().getLocation().getDirection().normalize().multiply(5));
- World w2 = p2.getWorld();
- w2.playSound(p2.getLocation(), Sound.CHEST_OPEN, 4, 1);
- return;
- }
- //awp
- @EventHandler
- public void onPlayerInteract3(PlayerInteractEvent e3) {
- Player p3 = e3.getPlayer();
- if (!(p3.hasPermission("a.use"))) { return; }
- if (!(e3.getAction() == Action.RIGHT_CLICK_AIR)) { return; }
- if (!(e3.getItem().getType() == Material.GOLD_AXE)) { return; }
- Snowball snowball = p3.launchProjectile(Snowball.class);
- snowball.setVelocity(e3.getPlayer().getLocation().getDirection().normalize().multiply(5));
- World w3 = p3.getWorld();
- w3.playSound(p3.getLocation(), Sound.CHEST_CLOSE, 10, 1);
- return;
- }
- //ZOOM HANDLER
- @EventHandler
- public void onPlayerInteract4(PlayerInteractEvent e4) {
- Player p4 = e4.getPlayer();
- if (!(p4.hasPermission("zoom.use"))) { return; }
- if (!(e4.getAction() == Action.LEFT_CLICK_AIR)) { return; }
- p4.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,100, 50));
- return;
- }
- //remove zoom
- @EventHandler
- public void onPlayerInteract5(PlayerInteractEvent e5) {
- Player p5 = e5.getPlayer();
- if (!(p5.hasPermission("removezoom.use"))) { return; }
- if (!(e5.getAction() == Action.LEFT_CLICK_AIR)) { return; }
- for (PotionEffect effect : p5.getActivePotionEffects())
- p5.removePotionEffect(effect.getType());
- return;
- //ak47
- if ((args.length == 1) &&
- (args[0].equalsIgnoreCase("ak47")) &&
- (p.hasPermission("guns.ak47comm"))) {
- ItemStack ak47 = new ItemStack(Material.DIAMOND_PICKAXE);
- ItemMeta sim = ak47.getItemMeta();
- sim.setDisplayName(ChatColor.WHITE + "AK47");
- ak47.setItemMeta(sim);
- pi.addItem(new ItemStack[] { ak47 });
- }
- //awp
- if ((args.length == 1) &&
- (args[0].equalsIgnoreCase("awp")) &&
- (p.hasPermission("guns.awp"))) {
- ItemStack awp = new ItemStack(Material.GOLD_AXE);
- ItemMeta sim = awp.getItemMeta();
- sim.setDisplayName(ChatColor.WHITE + "AWP");
- awp.setItemMeta(sim);
- pi.addItem(new ItemStack[] { awp });
- }
- //glock
- if ((args.length == 1) &&
- (args[0].equalsIgnoreCase("glock")) &&
- (p.hasPermission("guns.glock"))) {
- ItemStack glock = new ItemStack(Material.IRON_SPADE);
- ItemMeta sim = glock.getItemMeta();
- sim.setDisplayName(ChatColor.WHITE + "glock");
- glock.setItemMeta(sim);
- pi.addItem(new ItemStack[] { glock });
- }
- //desert eagle
- if ((args.length == 1) &&
- (args[0].equalsIgnoreCase("desert eagle")) &&
- (p.hasPermission("guns.deagle"))) {
- ItemStack deagle = new ItemStack(Material.IRON_SPADE);
- ItemMeta sim = deagle.getItemMeta();
- sim.setDisplayName(ChatColor.WHITE + "deagle");
- deagle.setItemMeta(sim);
- pi.addItem(new ItemStack[] { deagle });
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement