use of de.Keyle.MyPet.api.player.MyPetPlayer in project MyPet by xXKeyleXx.
the class MobArenaHook method onJoinPvPArena.
@EventHandler
public void onJoinPvPArena(ArenaPlayerJoinEvent event) {
if (!Configuration.Hooks.MobArena.ALLOW_PETS) {
if (MyPetApi.getPlayerManager().isMyPetPlayer(event.getPlayer())) {
MyPetPlayer player = MyPetApi.getPlayerManager().getMyPetPlayer(event.getPlayer());
if (player.hasMyPet() && player.getMyPet().getStatus() == MyPet.PetState.Here) {
player.getMyPet().removePet();
player.getPlayer().sendMessage(Translation.getString("Message.No.AllowedHere", player.getPlayer()));
}
}
}
}
use of de.Keyle.MyPet.api.player.MyPetPlayer in project MyPet by xXKeyleXx.
the class SkillApiHook method on.
@EventHandler
public void on(PlayerExperienceLostEvent event) {
if (Configuration.Hooks.SkillAPI.GRANT_EXP) {
Player player = event.getPlayerData().getPlayer();
if (MyPetApi.getPlayerManager().isMyPetPlayer(player)) {
MyPetPlayer petPlayer = MyPetApi.getPlayerManager().getMyPetPlayer(player);
if (petPlayer.hasMyPet()) {
MyPet myPet = petPlayer.getMyPet();
if (Configuration.Skilltree.PREVENT_LEVELLING_WITHOUT_SKILLTREE && myPet.getSkilltree() == null) {
if (!myPet.autoAssignSkilltree()) {
return;
}
}
// TODO -> removeExp
myPet.getExperience().removeCurrentExp(event.getExp() * Configuration.Hooks.SkillAPI.EXP_PERCENT / 100);
}
}
}
}
use of de.Keyle.MyPet.api.player.MyPetPlayer in project MyPet by xXKeyleXx.
the class UltimateSurvivalGamesHook method onJoinPvPArena.
@EventHandler
public void onJoinPvPArena(UserLobbyJoinedEvent event) {
if (MyPetApi.getPlayerManager().isMyPetPlayer(event.getUser().getPlayer())) {
MyPetPlayer player = MyPetApi.getPlayerManager().getMyPetPlayer(event.getUser().getPlayer());
if (player.hasMyPet() && player.getMyPet().getStatus() == MyPet.PetState.Here) {
player.getMyPet().removePet();
player.getPlayer().sendMessage(Translation.getString("Message.No.AllowedHere", player.getPlayer()));
}
}
}
use of de.Keyle.MyPet.api.player.MyPetPlayer in project MyPet by xXKeyleXx.
the class WorldGuardHook method on.
@EventHandler
public void on(PlayerMoveEvent event) {
if (customFlags) {
if (event.getFrom().getBlock() != event.getTo().getBlock()) {
if (MyPetApi.getPlayerManager().isMyPetPlayer(event.getPlayer())) {
MyPetPlayer player = MyPetApi.getPlayerManager().getMyPetPlayer(event.getPlayer());
if (player.hasMyPet() && player.getMyPet().getStatus() == MyPet.PetState.Here) {
if (!isPetAllowed(player)) {
player.getMyPet().removePet(true);
player.getPlayer().sendMessage(Translation.getString("Message.No.AllowedHere", player.getPlayer()));
}
}
}
}
}
}
use of de.Keyle.MyPet.api.player.MyPetPlayer in project MyPet by xXKeyleXx.
the class WorldGuardHook method isPetAllowed.
@Override
public boolean isPetAllowed(MyPetPlayer player) {
if (customFlags) {
Player p = player.getPlayer();
RegionManager mgr = wgp.getRegionManager(p.getWorld());
ApplicableRegionSet regions = mgr.getApplicableRegions(p.getLocation());
StateFlag.State s = regions.queryState(null, DENY_FLAG);
return s == null || s == StateFlag.State.ALLOW;
}
return true;
}
Aggregations