mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 06:06:45 +01:00
7d83dd8283
It's basically a wrapper for anything related to players, as a consequence Users.getProfile() is now depreciated. Also removed SkillTools.xpProcessing() because of some redundancy with McMMOPlayer.addXp(). + some cleanup for consistency sake.
36 lines
986 B
Java
36 lines
986 B
Java
package com.gmail.nossr50.skills.taming;
|
|
|
|
import org.bukkit.entity.Player;
|
|
import org.bukkit.entity.Wolf;
|
|
import org.bukkit.event.entity.EntityDamageEvent;
|
|
|
|
import com.gmail.nossr50.locale.LocaleLoader;
|
|
|
|
public class EnvironmentallyAwareEventHandler {
|
|
private Player player;
|
|
private EntityDamageEvent event;
|
|
private Wolf wolf;
|
|
|
|
protected EnvironmentallyAwareEventHandler(TamingManager manager, EntityDamageEvent event) {
|
|
this.player = manager.getMcMMOPlayer().getPlayer();
|
|
this.event = event;
|
|
this.wolf = (Wolf) event.getEntity();
|
|
}
|
|
|
|
protected void teleportWolf() {
|
|
if (event.getDamage() > wolf.getHealth()) {
|
|
return;
|
|
}
|
|
|
|
wolf.teleport(player.getLocation());
|
|
}
|
|
|
|
protected void sendAbilityMessage() {
|
|
player.sendMessage(LocaleLoader.getString("Taming.Listener.Wolf"));
|
|
}
|
|
|
|
protected void cancelEvent() {
|
|
event.setCancelled(true);
|
|
}
|
|
}
|