Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MAIN
- package me.mrfajapl.bawionko;
- import org.bukkit.event.Listener;
- import org.bukkit.plugin.java.JavaPlugin;
- public class Main extends JavaPlugin implements Listener{
- @Override
- public void onDisable() {
- System.out.println("Plugin zostal wlaczony");
- }
- @Override
- public void onEnable() {
- this.getServer().getPluginManager().registerEvents(this, this);
- System.out.println("Plugin zostal wylaczony");
- }
- }
- WALENIE
- package me.mrfajapl.bawionko;
- import org.bukkit.entity.Entity;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.entity.EntityDamageByEntityEvent;
- import org.bukkit.potion.PotionEffect;
- import org.bukkit.potion.PotionEffectType;
- public class Walenie implements Listener{
- public static Walenie plugin;
- @EventHandler
- public void onEntityDamageByEntity(EntityDamageByEntityEvent event){
- Entity e = event.getEntity();
- if(e instanceof Player){
- Player player = (Player) e;
- player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 180 ,2));
- event.setDamage(0);
- }
- Player player = (Player) e;
- player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 40 ,1));
- event.setDamage(0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment