本文整理汇总了Java中com.dsh105.echopet.compat.api.entity.IEntityPacketPet类的典型用法代码示例。如果您正苦于以下问题:Java IEntityPacketPet类的具体用法?Java IEntityPacketPet怎么用?Java IEntityPacketPet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IEntityPacketPet类属于com.dsh105.echopet.compat.api.entity包,在下文中一共展示了IEntityPacketPet类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPlayerTeleport
import com.dsh105.echopet.compat.api.entity.IEntityPacketPet; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerTeleport(final PlayerTeleportEvent event) {
final Player p = event.getPlayer();
final IPet pi = EchoPet.getManager().getPet(p);
Iterator<IPet> i = EchoPet.getManager().getPets().iterator();
while (i.hasNext()) {
IPet pet = i.next();
if (pet.getEntityPet() instanceof IEntityPacketPet && ((IEntityPacketPet) pet.getEntityPet()).hasInititiated()) {
if (GeometryUtil.getNearbyEntities(event.getTo(), 50).contains(pet)) {
((IEntityPacketPet) pet.getEntityPet()).updatePosition();
}
}
}
if (pi != null) {
if (!WorldUtil.allowPets(event.getTo())) {
Lang.sendTo(p, Lang.PETS_DISABLED_HERE.toString().replace("%world%", WordUtils.capitalizeFully(event.getTo().getWorld().getName())));
EchoPet.getManager().saveFileData("autosave", pi);
EchoPet.getSqlManager().saveToDatabase(pi, false);
EchoPet.getManager().removePet(pi, false);
}
}
}
示例2: onPlayerTeleport
import com.dsh105.echopet.compat.api.entity.IEntityPacketPet; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerTeleport(final PlayerTeleportEvent event) {
final Player p = event.getPlayer();
final IPet pi = EchoPet.getManager().getPet(p);
Iterator<IPet> i = EchoPet.getManager().getPets().iterator();
while(i.hasNext()){
IPet pet = i.next();
if(pet.getEntityPet() instanceof IEntityPacketPet && ((IEntityPacketPet) pet.getEntityPet()).hasInititiated()){
if(GeometryUtil.getNearbyEntities(event.getTo(), 50).contains(pet)){
((IEntityPacketPet) pet.getEntityPet()).updatePosition();
}
}
}
if(pi != null && pi.isSpawned()){
if(!WorldUtil.allowPets(event.getTo())){
Lang.sendTo(p, Lang.PETS_DISABLED_HERE.toString().replace("%world%", StringUtil.capitalise(event.getTo().getWorld().getName())));
pi.removePet(false, false);
}else{
pi.setAsHat(false);
if(event.getCause() != TeleportCause.UNKNOWN){// This will probably cause issues.. I don't know why more causes don't exist.
pi.ownerRidePet(false);
pi.removePet(false, false);
new BukkitRunnable(){
@Override
public void run(){
if(pi != null){
if(WorldUtil.allowPets(event.getTo())){
pi.spawnPet(p, false);
}
}
}
}.runTaskLater(EchoPet.getPlugin(), 20L);// could be reduced
}
}
}
}
示例3: getEntityPet
import com.dsh105.echopet.compat.api.entity.IEntityPacketPet; //导入依赖的package包/类
@Override
public IEntityPacketPet getEntityPet() {
return (IEntityPacketPet) super.getEntityPet();
}
示例4: getEntityPet
import com.dsh105.echopet.compat.api.entity.IEntityPacketPet; //导入依赖的package包/类
@Override
@Nonnull
public IEntityPacketPet getEntityPet() {
return (IEntityPacketPet) super.getEntityPet();
}