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


Java Location.setY方法代码示例

本文整理汇总了Java中org.bukkit.Location.setY方法的典型用法代码示例。如果您正苦于以下问题:Java Location.setY方法的具体用法?Java Location.setY怎么用?Java Location.setY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.Location的用法示例。


在下文中一共展示了Location.setY方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getKingdomTerritory

import org.bukkit.Location; //导入方法依赖的package包/类
public KingdomType getKingdomTerritory(KingdomFactionsPlayer p) {
	KingdomType type = KingdomType.GEEN;
	if(p.getLocation().getWorld() == Utils.getInstance().getMiningWorld()) {
		return type;
	}
	Location loc = Utils.getInstance().getNewLocation(p.getLocation());
	loc.setY(0);
	   for(Kingdom k : KingdomModule.getInstance().getKingdoms()) {
		   Location spawn = Utils.getInstance().getNewLocation(k.getNexus().getLocation());
		   spawn.setY(0);
		   if(spawn.distance(loc) < ConfigModule.getInstance().getFile(ConfigModule.CONFIG).getConfig().getInt("kingdom.total.protected_region")) {
				   type = k.getType();
		   }
	   }
	return type;


}
 
开发者ID:ThEWiZ76,项目名称:KingdomFactions,代码行数:19,代码来源:ProtectionModule.java

示例2: onRun

import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public void onRun()
{
    // Prevents an excess of particles
    if (last != null && last.getX() == getEntity().getLocation().getX() && last.getZ() == getEntity().getLocation().getZ())
        return;
    last = getEntity().getLocation();

    Block block = this.getEntity().getLocation().add(0, -0.4, 0).getBlock();
    Material type = block.getType();

    // If the step should be displayed or not
    if (type.isBlock() && type.isSolid() && !type.isTransparent()) {
        Location loc = getEntity().getLocation();
        loc.setY(block.getY());
        loc = loc.add(0, 1 + Math.random() / 100, 0);
        Vector dir = VectorUtils.rotateAroundAxisY(getEntity().getLocation().getDirection().setY(0).normalize(), p ? 90 : -90).multiply(0.25);
        display(ParticleEffect.FOOTSTEP, loc.add(dir.getX(), 0, dir.getZ()), 7, 0);

        p = !p;
    }
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:23,代码来源:StepEffect.java

示例3: castSpell

import org.bukkit.Location; //导入方法依赖的package包/类
public void castSpell(final LivingEntity caster, final MobData md, Player target) {
    md.shout((String) RMath.randObject(PHRASES), 20);
    final ArrayList<Entity> hit = new ArrayList<Entity>();
    final Location start = md.entity.getLocation();
    start.setY(start.getY() + 1.3);
    for (Vector v : getVectors(md.entity)) {
        ArrayList<Location> locs = RMath.calculateVectorPath(start.clone(), v, 15, 4);
        int count = 0;
        for (int k = 0; k < locs.size(); k++) {
            final Location loc = locs.get(k);
            RScheduler.schedule(Spell.plugin, new Runnable() {
                public void run() {
                    RParticles.showWithOffset(ParticleEffect.SLIME, loc, 0.2, 1);
                    int damage = md.getDamage() * 3;
                    ArrayList<Entity> damaged = Spell.damageNearby(damage, md.entity, loc, 1.0, hit, true, false, true);
                    hit.addAll(damaged);
                }
            }, 1 * count);
            if (k % 2 == 0)
                count++;
        }
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:24,代码来源:SlimeKingBurstSpell.java

示例4: pullEntityToLocation

import org.bukkit.Location; //导入方法依赖的package包/类
public void pullEntityToLocation(Entity e, Location loc) {
    Location entityLoc = e.getLocation();
    entityLoc.setY(entityLoc.getY() + 0.5D);
    e.teleport(entityLoc);
    double g = -0.08D;
    if (loc.getWorld() != entityLoc.getWorld())
        return;
    double d = loc.distance(entityLoc);
    double t = d;
    double v_x = (1.0D + 0.07000000000000001D * t) * (loc.getX() - entityLoc.getX()) / t;
    double v_y = (1.0D + 0.03D * t) * (loc.getY() - entityLoc.getY()) / t - 0.5D * g * t;
    double v_z = (1.0D + 0.07000000000000001D * t) * (loc.getZ() - entityLoc.getZ()) / t;
    Vector v = e.getVelocity();
    v.setX(v_x);
    v.setY(v_y);
    v.setZ(v_z);
    e.setVelocity(v);
    e.setFallDistance(0f);
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:20,代码来源:GrappleManager.java

示例5: onPlayerMoveWhenNotLoaded

import org.bukkit.Location; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
public void onPlayerMoveWhenNotLoaded(PlayerMoveEvent event) {
    Player player = event.getPlayer();

    if (!InventoryManager.isAllowedWorld(player.getWorld()) || InventoryManager.playerIsLoaded(player)) {
        return;
    }

    if (PlayerLoader.isPreparedPlayer(player)) {
        PlayerLoader.removePlayer(player);
        player.kickPlayer(RPGInventory.getLanguage().getMessage("error.rp.denied"));
        event.setCancelled(true);
    } else {
        Location toLocation = event.getTo();
        Location newLocation = event.getFrom().clone();
        //noinspection deprecation
        if (!player.isOnGround()) {
            newLocation.setY(toLocation.getY());
        }

        newLocation.setPitch(toLocation.getPitch());
        newLocation.setYaw(toLocation.getYaw());
        event.setTo(newLocation);
    }
}
 
开发者ID:EndlessCodeGroup,项目名称:RPGInventory,代码行数:26,代码来源:PlayerListener.java

示例6: onPlayerMove

import org.bukkit.Location; //导入方法依赖的package包/类
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
    if(!event.getTo().getWorld().getName().equalsIgnoreCase(event.getFrom().getWorld().getName())) return;
    if(event.getTo().getWorld().getName().equalsIgnoreCase("world")) return;
    ArcadiaAPI api = Arcadia.getPlugin(Arcadia.class).getAPI();
    if(!api.getGameManager().isAlive(event.getPlayer())) {
        double yLevel = Utils.parseLocation((String) api.getGameManager().getCurrentGame()
            .getGameMap().fetchSetting("spectatorLocation")).getY();
        double yDif = Math.abs(event.getTo().getY() - yLevel);
        Location newLocation = event.getTo();
        newLocation.setY(yLevel);
        if(yDif >= 0.5) event.setTo(newLocation);
    }
    if(api.getMapRegistry().getMapBounds() != null) {
        if(!api.getMapRegistry().getMapBounds().contains(event.getTo())) {
            if(api.getGameManager().isAlive(event.getPlayer())
                    && api.getGameManager().getCurrentGame().killOnMapExit) {
                api.getGameManager().setAlive(event.getPlayer(), false);
            } else {
                event.setTo(event.getFrom());
            }
        }
    }
}
 
开发者ID:ArcadiaPlugins,项目名称:Arcadia-Spigot,代码行数:25,代码来源:SpectatorListener.java

示例7: Woodcutter

import org.bukkit.Location; //导入方法依赖的package包/类
@EventHandler
public void Woodcutter(BlockBreakEvent event) {
	if (State.PRE)
		return;

	Player p = event.getPlayer();
	if (Kit.getKit(p).getName().equalsIgnoreCase("woodcutter")
			&& event.getBlock().getType().equals(Material.LOG)
			&& (p.getItemInHand().getType().toString().contains("AXE"))) {
		for (int i = 0; i <= 50; i++) {
			Location loc = event.getBlock().getLocation();
			loc.setY(loc.getY() + i);
			if (loc.getBlock().getType().equals(Material.LOG))
				loc.getBlock().breakNaturally();
			else
				break;
		}
	}
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:20,代码来源:KitEvents.java

示例8: Region

import org.bukkit.Location; //导入方法依赖的package包/类
public Region(Location pointA, Location pointB) {
    Validate.isTrue(pointA.getWorld().equals(pointB.getWorld()), "Two worlds are different.");

    double minX = Math.min(pointA.getBlockX(), pointB.getBlockX());
    double maxX = Math.max(pointA.getBlockX(), pointB.getBlockX()) + 1;
    double minY = Math.min(pointA.getBlockY(), pointB.getBlockY());
    double maxY = Math.max(pointA.getBlockY(), pointB.getBlockY());
    double minZ = Math.min(pointA.getBlockZ(), pointB.getBlockZ());
    double maxZ = Math.max(pointA.getBlockZ(), pointB.getBlockZ()) + 1;

    pointA.setX(minX);
    pointA.setY(minY);
    pointA.setZ(minZ);
    pointB.setX(maxX);
    pointB.setY(maxY);
    pointB.setZ(maxZ);

    this.world = pointA.getWorld().getName();
    this.min = pointA.toVector();
    this.max = pointB.toVector();
}
 
开发者ID:EntryPointKR,项目名称:MCLibrary,代码行数:22,代码来源:Region.java

示例9: teleportPlayer

import org.bukkit.Location; //导入方法依赖的package包/类
public void teleportPlayer(Entity p, int dx, int dy, int dz) {

		NavyCraft.instance.DebugMessage("Teleporting entity " + p.getEntityId(), 4);
		Location pLoc = p.getLocation();
		pLoc.setWorld(craft.world);
		pLoc.setX(pLoc.getX() + dx);
		pLoc.setY(pLoc.getY() + dy + .05);
		pLoc.setZ(pLoc.getZ() + dz);

		if (p instanceof Player) {
			playerTeleports.put((Player) p, pLoc);
		} else {
			p.teleport(pLoc);
		}

	}
 
开发者ID:Maximuspayne,项目名称:NavyCraft2-Lite,代码行数:17,代码来源:CraftMover.java

示例10: onPlace

import org.bukkit.Location; //导入方法依赖的package包/类
@EventHandler
public void onPlace(BlockPlaceEvent e) {
	if (e.isCancelled()) {
		return;
	}
	if (!e.getBlock().getType().equals(Material.CAULDRON)) {
		return;
	}
	Block b = e.getBlock();
	Location loc = b.getLocation();
	loc.setY(loc.getY() + 1);
	Block upon = loc.getBlock();
	if (upon.getType().equals(Material.AIR)) {
		return;
	}
	e.setCancelled(true);
	e.getPlayer().sendMessage(Messages.getMessages().getNoPlace().replace("&", "§"));
}
 
开发者ID:Soldier233,项目名称:SlimefunBugFixer,代码行数:19,代码来源:Listeners.java

示例11: getRandomLocation

import org.bukkit.Location; //导入方法依赖的package包/类
public static Location getRandomLocation(Location player, int Xminimum, int Xmaximum, int Zminimum, int Zmaximum) {
    try {
        World world = player.getWorld();
        double x = Double.parseDouble(
                Integer.toString(Xminimum + ((int) (Math.random() * ((Xmaximum - Xminimum) + 1))))) + 0.5d;
        double z = Double.parseDouble(
                Integer.toString(Zminimum + ((int) (Math.random() * ((Zmaximum - Zminimum) + 1))))) + 0.5d;
        player.setY(200);
        return new Location(world, x, player.getY(), z);
    } catch (NullPointerException e) {
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:AlphaHelixDev,项目名称:AlphaLibary,代码行数:15,代码来源:LocationUtil.java

示例12: dropItemNaturally

import org.bukkit.Location; //导入方法依赖的package包/类
public org.bukkit.entity.Item dropItemNaturally(Location loc, ItemStack item) {
    double xs = world.rand.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D;
    double ys = world.rand.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D;
    double zs = world.rand.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D;
    loc = loc.clone();
    loc.setX(loc.getX() + xs);
    loc.setY(loc.getY() + ys);
    loc.setZ(loc.getZ() + zs);
    return dropItem(loc, item);
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:11,代码来源:CraftWorld.java

示例13: setClaim

import org.bukkit.Location; //导入方法依赖的package包/类
/**
 * Sets the {@link Cuboid} area of this {@link KothFaction}.
 *
 * @param cuboid
 *            the {@link Cuboid} to set
 * @param sender
 *            the {@link CommandSender} setting the claim
 */
public void setClaim(Cuboid cuboid, CommandSender sender) {
    removeClaims(getClaims(), sender);

    // Now add the new claim.
    Location min = cuboid.getMinimumPoint();
    min.setY(ClaimHandler.MIN_CLAIM_HEIGHT);

    Location max = cuboid.getMaximumPoint();
    max.setY(ClaimHandler.MAX_CLAIM_HEIGHT);

    addClaim(new Claim(this, min, max), sender);
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:21,代码来源:EventFaction.java

示例14: getExplosivePickaxeBreakLocations

import org.bukkit.Location; //导入方法依赖的package包/类
public static Location[][] getExplosivePickaxeBreakLocations(Location location) {
	Location[][] allLocation = new Location[3][9];

	double loactionY = location.getY();
	location.setY(loactionY - 1.0D);
	allLocation[0] = getPlotAllLocations(location);
	location.setY(loactionY);
	allLocation[1] = getPlotAllLocations(location);
	location.setY(loactionY + 1.0D);
	allLocation[2] = getPlotAllLocations(location);
	return allLocation;
}
 
开发者ID:Soldier233,项目名称:SlimefunBugFixer,代码行数:13,代码来源:ListenersRes4.java

示例15: getDistance

import org.bukkit.Location; //导入方法依赖的package包/类
public double getDistance(Location location) {
	Location loc = Utils.getInstance().getNewLocation(location);
	Location nexus = Utils.getInstance().getNewLocation(this.getLocation());
	loc.setY(0);
	nexus.setY(0);
	return nexus.distance(loc);
}
 
开发者ID:ThEWiZ76,项目名称:KingdomFactions,代码行数:8,代码来源:Building.java


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