Advertisement
Guest User

Wie geht das???

a guest
May 27th, 2013
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. package main;
  2.  
  3. import org.bukkit.Material;
  4. import org.bukkit.command.Command;
  5. import org.bukkit.command.CommandSender;
  6. import org.bukkit.entity.Arrow;
  7. import org.bukkit.entity.Player;
  8. import org.bukkit.entity.Snowball;
  9. import org.bukkit.event.EventHandler;
  10. import org.bukkit.event.Listener;
  11. import org.bukkit.event.block.Action;
  12. import org.bukkit.event.player.PlayerInteractEvent;
  13. import org.bukkit.inventory.ItemStack;
  14. import org.bukkit.plugin.java.JavaPlugin;
  15.  
  16. public class PvpGun extends JavaPlugin implements Listener {
  17.  
  18. public void onEnable(){
  19. this.getServer().getPluginManager().registerEvents(this, this);
  20. }
  21.  
  22. public void onDisable(){
  23.  
  24. }
  25.  
  26. public boolean onCommand(CommandSender sender, Command cmd, String label, String args[]){
  27. Player p = (Player) sender;
  28.  
  29. if(sender instanceof Player){
  30. if(p.hasPermission("PvpGun")){
  31.  
  32. if(cmd.getName().equalsIgnoreCase("gun")){
  33. p.getInventory().addItem(new ItemStack(275).getItemMeta().setDisplayName("§4§lMinigun"));
  34. p.getInventory().getItemInHand().getItemMeta();
  35. }
  36.  
  37. }
  38. }
  39. return false;
  40. }
  41.  
  42. @EventHandler
  43. public void onPlayerInteract1(PlayerInteractEvent e){
  44. Player p = e.getPlayer();
  45. if(p.getItemInHand().getType() == Material.STONE_AXE){
  46. if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK){
  47. p.launchProjectile(Arrow.class);
  48. }
  49. }
  50. }
  51.  
  52. @EventHandler
  53. public void onPlayerInteract2(PlayerInteractEvent e){
  54. Player p = e.getPlayer();
  55. if(p.getItemInHand().getType() == Material.BLAZE_ROD){
  56. if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK){
  57. p.launchProjectile(Snowball.class);
  58. }
  59. }
  60. }
  61.  
  62.  
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement