Advertisement
Guest User

Untitled

a guest
Jun 17th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.53 KB | None | 0 0
  1. public class Pets extends JavaPlugin implements Listener {
  2.  
  3.     @SuppressWarnings("unused")
  4.     private static final String LivingEntity = null;
  5.     private HashMap<UUID, Guardian> G = new HashMap<UUID,Guardian>();
  6.    
  7.    
  8.     @EventHandler
  9.     public void OnLeave(PlayerQuitEvent event){
  10.         Player player = (Player) event.getPlayer();
  11.         player.chat("/wh kill");
  12.         }
  13.    
  14.     @EventHandler
  15.     public void OnKick(PlayerKickEvent event){
  16.         Player player = (Player) event.getPlayer();
  17.         player.chat("/wh kill");
  18.         }
  19.    
  20.  
  21.     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  22.        
  23.         Player player = (Player) sender;
  24.  
  25.         if (cmd.getName().equalsIgnoreCase("pet") && sender instanceof Player) {
  26.                
  27.                
  28.             }
  29.        
  30.  
  31.            
  32.                 if (args.length == 0) {
  33.                    
  34.                     //insert wut ever here
  35.                 }
  36.                
  37.                
  38.                 if(args[0].equalsIgnoreCase("guardiansummon")) {
  39.                    
  40.                     Guardian guard = player.getLocation().getWorld().spawn(player.getLocation().add(2, 0, 0), Guardian.class);
  41.                     G.put(player.getUniqueId(),guard);
  42.                     G.get(player.getUniqueId()).addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 1000000000 , 1000000000));
  43.                     G.get(player.getUniqueId()).addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 1000000000 , 1000000000));
  44.                     G.get(player.getUniqueId()).addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 1000000000 , 1000000000));
  45.                     G.get(player.getUniqueId()).addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 1000000000 , 1000000000));
  46.  
  47.                     Bukkit.getScheduler().scheduleSyncRepeatingTask(this , new Runnable()
  48.                
  49.                     {
  50.                          public void run()
  51.                               {
  52.                              
  53.                              G.get(player.getUniqueId()).teleport(player.getLocation().add(1, 0, 0));
  54.                                      
  55.                               }
  56.                     }, 0, 1);
  57.                    
  58.            
  59.                 }
  60.  
  61.                 if(args[0].equalsIgnoreCase("guardiankill")) {
  62.                     G.get(player.getUniqueId()).remove();
  63.                 }
  64.  
  65.          return true;
  66.        
  67.          }
  68.  
  69.          
  70.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement