Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Me.waysfx;
- import org.bukkit.Location;
- 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.EntityDamageEvent;
- import org.bukkit.plugin.java.JavaPlugin;
- public final class ir3 extends JavaPlugin implements Listener {
- @Override
- public void onEnable() {
- // Plugin startup logic
- getServer().getPluginManager().registerEvents(this, this);
- }
- @EventHandler
- public void Damage (EntityDamageEvent e) {
- if (e.getEntity() instanceof Player) {
- Entity play = e.getEntity();
- if (play instanceof Player) {
- ((Player) play).getHealth();
- if (((Player) play).getHealth() <= e.getDamage()) {
- e.setCancelled(true);
- double hp = ((Player) play).getMaxHealth();
- ((Player) play).setHealth(hp);
- Location spawn = play.getWorld().getSpawnLocation();
- play.teleport(spawn);
- play.sendMessage("§cYou died!");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement