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


Java WorldUtil类代码示例

本文整理汇总了Java中com.dsh105.echopet.compat.api.util.WorldUtil的典型用法代码示例。如果您正苦于以下问题:Java WorldUtil类的具体用法?Java WorldUtil怎么用?Java WorldUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WorldUtil类属于com.dsh105.echopet.compat.api.util包,在下文中一共展示了WorldUtil类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onPlayerTeleport

import com.dsh105.echopet.compat.api.util.WorldUtil; //导入依赖的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: onPlayerMove

import com.dsh105.echopet.compat.api.util.WorldUtil; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
  public void onPlayerMove(PlayerMoveEvent event) {
      Player p = event.getPlayer();
      IPet pet = EchoPet.getManager().getPet(p);
if(pet != null && pet.isSpawned()){
          if (!WorldUtil.allowRegion(event.getTo())) {
		pet.removePet(true, true);
              Lang.sendTo(p, Lang.ENTER_PET_DISABLED_REGION.toString());
          }
      }
  }
 
开发者ID:Borlea,项目名称:EchoPet,代码行数:12,代码来源:RegionListener.java

示例3: onPetMove

import com.dsh105.echopet.compat.api.util.WorldUtil; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPetMove(PetRideMoveEvent event){
	IPet pet = event.getPet();
	if(pet != null && pet.isSpawned()){
		if(!WorldUtil.allowRegion(pet.getLocation())){
			pet.ownerRidePet(false);
			pet.removePet(true, true);
			Lang.sendTo(pet.getOwner(), Lang.ENTER_PET_DISABLED_REGION.toString());
		}
	}
}
 
开发者ID:Borlea,项目名称:EchoPet,代码行数:12,代码来源:RegionListener.java

示例4: createPet

import com.dsh105.echopet.compat.api.util.WorldUtil; //导入依赖的package包/类
@Override
public IPet createPet(Player owner, PetType petType, PetType riderType) {
    if (ReflectionUtil.BUKKIT_VERSION_NUMERIC == 178 && (petType == PetType.HUMAN) || riderType == PetType.HUMAN) {
        Lang.sendTo(owner, Lang.HUMAN_PET_DISABLED.toString());
        return null;
    }
    removePets(owner, true);
    if (!WorldUtil.allowPets(owner.getLocation())) {
        Lang.sendTo(owner, Lang.PETS_DISABLED_HERE.toString().replace("%world%", WordUtils.capitalizeFully(owner.getWorld().getName())));
        return null;
    }
    if (!EchoPet.getOptions().allowPetType(petType)) {
        Lang.sendTo(owner, Lang.PET_TYPE_DISABLED.toString().replace("%type%", petType.toPrettyString()));
        return null;
    }
    if (!petType.isSupported()) {
        Lang.sendTo(owner, Lang.PET_TYPE_NOT_COMPATIBLE.toString().replace("%type%", petType.toPrettyString()));
        return null;
    }
    IPet pi;
    try {
        pi = petType.getNewPetInstance(owner);
    } catch (CancelledSpawnException e) {
        e.sendMessage();
        return null;
    }
    addPet(pi);
    pi.createRider(riderType, true);
    forceAllValidData(pi);
    return pi;
}
 
开发者ID:TechzoneMC,项目名称:SonarPet,代码行数:32,代码来源:PetManager.java

示例5: onPlayerMove

import com.dsh105.echopet.compat.api.util.WorldUtil; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerMove(PlayerMoveEvent event) {
    Player p = event.getPlayer();
    IPet pet = EchoPet.getManager().getPet(p);
    if (pet != null) {
        if (!WorldUtil.allowRegion(event.getTo())) {
            EchoPet.getManager().removePet(pet, true);
            Lang.sendTo(p, Lang.ENTER_PET_DISABLED_REGION.toString());
        }
    }
}
 
开发者ID:TechzoneMC,项目名称:SonarPet,代码行数:12,代码来源:RegionListener.java


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