Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main;
- import org.bukkit.Material;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Arrow;
- import org.bukkit.entity.Player;
- import org.bukkit.entity.Snowball;
- 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.plugin.java.JavaPlugin;
- public class PvpGun extends JavaPlugin implements Listener {
- public void onEnable(){
- this.getServer().getPluginManager().registerEvents(this, this);
- }
- public void onDisable(){
- }
- public boolean onCommand(CommandSender sender, Command cmd, String label, String args[]){
- Player p = (Player) sender;
- if(sender instanceof Player){
- if(p.hasPermission("PvpGun")){
- if(cmd.getName().equalsIgnoreCase("gun")){
- p.getInventory().addItem(new ItemStack(275).getItemMeta().setDisplayName("§4§lMinigun"));
- p.getInventory().getItemInHand().getItemMeta();
- }
- }
- }
- return false;
- }
- @EventHandler
- public void onPlayerInteract1(PlayerInteractEvent e){
- Player p = e.getPlayer();
- if(p.getItemInHand().getType() == Material.STONE_AXE){
- if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK){
- p.launchProjectile(Arrow.class);
- }
- }
- }
- @EventHandler
- public void onPlayerInteract2(PlayerInteractEvent e){
- Player p = e.getPlayer();
- if(p.getItemInHand().getType() == Material.BLAZE_ROD){
- if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK){
- p.launchProjectile(Snowball.class);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement