当前位置: 首页>>代码示例>>Java>>正文


Java IEntityPacketPet类代码示例

本文整理汇总了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);
        }
    }
}
 
开发者ID:TechzoneMC,项目名称:SonarPet,代码行数:23,代码来源:PetOwnerListener.java

示例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
		}
	}
}
  }
 
开发者ID:Borlea,项目名称:EchoPet,代码行数:38,代码来源:PetOwnerListener.java

示例3: getEntityPet

import com.dsh105.echopet.compat.api.entity.IEntityPacketPet; //导入依赖的package包/类
@Override
public IEntityPacketPet getEntityPet() {
    return (IEntityPacketPet) super.getEntityPet();
}
 
开发者ID:Borlea,项目名称:EchoPet,代码行数:5,代码来源:PacketPet.java

示例4: getEntityPet

import com.dsh105.echopet.compat.api.entity.IEntityPacketPet; //导入依赖的package包/类
@Override
@Nonnull
public IEntityPacketPet getEntityPet() {
    return (IEntityPacketPet) super.getEntityPet();
}
 
开发者ID:TechzoneMC,项目名称:SonarPet,代码行数:6,代码来源:PacketPet.java


注:本文中的com.dsh105.echopet.compat.api.entity.IEntityPacketPet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。