Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. package my.races;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.entity.Player;
  5. import org.bukkit.event.EventHandler;
  6. import org.bukkit.event.Listener;
  7. import org.bukkit.event.player.PlayerJoinEvent;
  8. import org.bukkit.event.player.PlayerRespawnEvent;
  9. import org.bukkit.plugin.java.JavaPlugin;
  10. import org.bukkit.potion.PotionEffect;
  11. import org.bukkit.potion.PotionEffectType;
  12. import org.bukkit.scheduler.BukkitRunnable;
  13.  
  14. public class Main extends JavaPlugin implements Listener{
  15. public void onEnable(){
  16. Bukkit.getServer().getPluginManager().registerEvents(this, this);
  17. }
  18. public void onDisable(){}
  19. @EventHandler
  20. public void onSpawn(PlayerRespawnEvent e){
  21. Player p = e.getPlayer();
  22. int tick = Integer.MAX_VALUE;
  23. new BukkitRunnable() {
  24. public void run(){
  25. if(p.hasPermission("chongtoc.human")){
  26. p.addPotionEffect(new PotionEffect(PotionEffectType.LUCK, tick, 4), true);
  27. }
  28. if(p.hasPermission("chungtoc.elf")){
  29. p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, tick, 2), true);
  30. p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, tick, 2), true);
  31. }
  32. if(p.hasPermission("chungtoc.orc")){
  33. p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, tick, 1),true);
  34. p.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, tick, 3), true);
  35. }
  36. if(p.hasPermission("chungtoc.dwarf")){
  37. p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, tick, 2),true);
  38.  
  39. }
  40. if(p.hasPermission("chungtoc.wolfman")){
  41. p.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, tick, 2), true);
  42. p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, tick, 2), true);
  43. }
  44. }
  45. }.runTaskLater(this, 1);
  46. }
  47. @SuppressWarnings("deprecation")
  48. @EventHandler
  49. public void onJoin(PlayerJoinEvent e){
  50. Player p = e.getPlayer();
  51. p.setMaxHealth(10);
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement