Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package my.races;
- import org.bukkit.Bukkit;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.player.PlayerJoinEvent;
- import org.bukkit.event.player.PlayerRespawnEvent;
- import org.bukkit.plugin.java.JavaPlugin;
- import org.bukkit.potion.PotionEffect;
- import org.bukkit.potion.PotionEffectType;
- import org.bukkit.scheduler.BukkitRunnable;
- public class Main extends JavaPlugin implements Listener{
- public void onEnable(){
- Bukkit.getServer().getPluginManager().registerEvents(this, this);
- }
- public void onDisable(){}
- @EventHandler
- public void onSpawn(PlayerRespawnEvent e){
- Player p = e.getPlayer();
- int tick = Integer.MAX_VALUE;
- new BukkitRunnable() {
- public void run(){
- if(p.hasPermission("chongtoc.human")){
- p.addPotionEffect(new PotionEffect(PotionEffectType.LUCK, tick, 4), true);
- }
- if(p.hasPermission("chungtoc.elf")){
- p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, tick, 2), true);
- p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, tick, 2), true);
- }
- if(p.hasPermission("chungtoc.orc")){
- p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, tick, 1),true);
- p.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, tick, 3), true);
- }
- if(p.hasPermission("chungtoc.dwarf")){
- p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, tick, 2),true);
- }
- if(p.hasPermission("chungtoc.wolfman")){
- p.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, tick, 2), true);
- p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, tick, 2), true);
- }
- }
- }.runTaskLater(this, 1);
- }
- @SuppressWarnings("deprecation")
- @EventHandler
- public void onJoin(PlayerJoinEvent e){
- Player p = e.getPlayer();
- p.setMaxHealth(10);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement