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


Java Location.setX方法代码示例

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


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

示例1: onPearlClip

import org.bukkit.Location; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
public void onPearlClip(PlayerTeleportEvent event) {
	if (event.getCause() == PlayerTeleportEvent.TeleportCause.ENDER_PEARL) {
		Location to = event.getTo();
		if (blockedPearlTypes.contains(to.getBlock().getType())) {
			Player player = event.getPlayer();
			player.sendMessage(ChatColor.RED + "You cannot pearl there.");
			removeCooldown(player);
			event.setCancelled(true);

			return;
		}
		to.setX(to.getBlockX() + 0.5D);
		to.setZ(to.getBlockZ() + 0.5D);
		event.setTo(to);

	}
}
 
开发者ID:HuliPvP,项目名称:Chambers,代码行数:19,代码来源:EnderpearlListener.java

示例2: onPearlClip

import org.bukkit.Location; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
public void onPearlClip(PlayerTeleportEvent event) {
    if (event.getCause() == PlayerTeleportEvent.TeleportCause.ENDER_PEARL) {
        Location to = event.getTo();
        if (blockedPearlTypes.contains(to.getBlock().getType())) {
            Player player = event.getPlayer();
            player.sendMessage(ChatColor.YELLOW + "You have been detected trying to pearl glitch, your pearl has been refunded and cooldown wiped.");
            plugin.getTimerManager().getEnderPearlTimer().refund(player);

            event.setCancelled(true);
            return;
        }

        to.setX(to.getBlockX() + 0.5);
        to.setZ(to.getBlockZ() + 0.5);
        event.setTo(to);
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:19,代码来源:PearlGlitchListener.java

示例3: 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

示例4: onPlayerDamage

import org.bukkit.Location; //导入方法依赖的package包/类
@EventHandler
public void onPlayerDamage(EntityDamageEvent event) {
	if (!(event.getEntity() instanceof Player))
		return;
	event.setCancelled(true);
	
	if (event.getCause()==DamageCause.VOID) {
		Location l = event.getEntity().getWorld().getSpawnLocation();
		l.setX(14.5);
		l.setY(10.5);
		l.setZ(-795.5);
		l.setPitch(0.5F);
		l.setYaw(90 * RandomUtil.between(1, 4));
		event.getEntity().teleport(l);
	}
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:17,代码来源:Events.java

示例5: tirarhuevo

import org.bukkit.Location; //导入方法依赖的package包/类
/** @EVENTS **/

    @EventHandler

    public void tirarhuevo(PlayerEggThrowEvent e){

        if (e.isHatching()){
            Location loc = e.getPlayer().getLocation();

            for(int i = 0; i <360; i+=5) {
                Location particleloc = loc;
                particleloc.setZ(particleloc.getZ() + Math.cos(i) * 0.6);
                particleloc.setX(particleloc.getX() + Math.sin(i) * 0.5);
                particleloc.setY(particleloc.getY() + 0.05);
                loc.getWorld().playEffect(particleloc, Effect.valueOf(plugin.particle), 51);
            }

            Location location = e.getPlayer().getLocation();
            e.getPlayer().playSound(location, Sound.valueOf(plugin.sound), 1, 1);
        }
    }
 
开发者ID:clonalejandro,项目名称:AmazingEgss,代码行数:22,代码来源:l.java

示例6: getLocation

import org.bukkit.Location; //导入方法依赖的package包/类
public Location getLocation(Location loc) {
    if (loc != null) {
        loc.setWorld(world);
        loc.setX(x);
        loc.setY(y);
        loc.setZ(z);
        loc.setYaw(0);
        loc.setPitch(0);
    }

    return loc;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:13,代码来源:CraftBlockState.java

示例7: getLocation

import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public Location getLocation( Location location ) {
    location.setX( getX() );
    location.setY( getY() );
    location.setZ( getZ() );
    return location;
}
 
开发者ID:lukas81298,项目名称:FlexMC,代码行数:8,代码来源:FlexBlock.java

示例8: nextGridLocation

import org.bukkit.Location; //导入方法依赖的package包/类
/**
 * Finds the next free island spot based off the last known island Uses
 * island_distance setting from the config file Builds up in a grid fashion
 *
 * @param lastIsland
 * @return Location of next free island
 */
private Location nextGridLocation(final Location lastIsland) {
    int x = lastIsland.getBlockX();
    int z = lastIsland.getBlockZ();
    Location nextPos = lastIsland;
    if (x < z) {
        if (-1 * x < z) {
            nextPos.setX(nextPos.getX() + Settings.islandDistance*2);
            return nextPos;
        }
        nextPos.setZ(nextPos.getZ() + Settings.islandDistance*2);
        return nextPos;
    }
    if (x > z) {
        if (-1 * x >= z) {
            nextPos.setX(nextPos.getX() - Settings.islandDistance*2);
            return nextPos;
        }
        nextPos.setZ(nextPos.getZ() - Settings.islandDistance*2);
        return nextPos;
    }
    if (x <= 0) {
        nextPos.setZ(nextPos.getZ() + Settings.islandDistance*2);
        return nextPos;
    }
    nextPos.setZ(nextPos.getZ() - Settings.islandDistance*2);
    return nextPos;
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:35,代码来源:NewIsland.java

示例9: roundToBlock

import org.bukkit.Location; //导入方法依赖的package包/类
private Location roundToBlock(Location loc) {
    Location newLoc = loc.clone();

    newLoc.setX(Math.floor(loc.getX()) + 0.5);
    newLoc.setY(Math.floor(loc.getY()));
    newLoc.setZ(Math.floor(loc.getZ()) + 0.5);

    return newLoc;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:10,代码来源:Post.java

示例10: getLocation

import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public Location getLocation( Location location ) {
    location.setX( this.location.getX() );
    location.setY( this.location.getY() );
    location.setZ( this.location.getZ() );
    location.setYaw( this.location.getYaw() );
    location.setPitch( this.location.getPitch() );
    return location;
}
 
开发者ID:lukas81298,项目名称:FlexMC,代码行数:10,代码来源:FlexEntity.java

示例11: onTeleport

import org.bukkit.Location; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled=true, priority=EventPriority.NORMAL)
public void onTeleport(PlayerTeleportEvent event) {
    if (event.getCause() == PlayerTeleportEvent.TeleportCause.ENDER_PEARL) {
        Location to = event.getTo();

        if (this.blockedTypes.contains(to.getBlock().getType())) {
            event.setCancelled(true);
            return;
        }

        to.setX(to.getBlockX() + 0.5D);
        to.setZ(to.getBlockZ() + 0.5D);
        event.setTo(to);
    }
}
 
开发者ID:ijoeleoli,项目名称:ZorahPractice,代码行数:16,代码来源:PearlFix.java

示例12: spawnEntity

import org.bukkit.Location; //导入方法依赖的package包/类
public static void spawnEntity(String player, int challenge, String str, int amount) {
	EntityType entity = EntityType.valueOf(str);
	Location loc1 = plugin.getChallengesFile().getFirstLocation(challenge);
	Location loc2 = plugin.getChallengesFile().getSecondLocation(challenge);
	Location spawnLoc = loc1;
	for(int i = 0; i < amount; i++) {
		spawnLoc.setX(getRandom(loc1.getBlockX(), loc2.getBlockX()));
		spawnLoc.setY(getRandom(loc1.getBlockY(), loc2.getBlockY()));
		spawnLoc.setZ(getRandom(loc1.getBlockZ(), loc2.getBlockZ()));
		Entity e = loc1.getWorld().spawnEntity(spawnLoc, entity);
		e.setMetadata("challenge", new FixedMetadataValue(plugin, String.valueOf(challenge) + ", " + player));
	}
}
 
开发者ID:benNek,项目名称:AsgardAscension,代码行数:14,代码来源:Convert.java

示例13: getCenterLocation

import org.bukkit.Location; //导入方法依赖的package包/类
public Location getCenterLocation(Location loc1, Location loc2){
	Location loc = new Location(loc1.getWorld(), 0, 0, 0);
	double x = (loc1.getX() + loc2.getX()) / 2;
	double z = (loc1.getZ() + loc2.getZ()) / 2;
	loc.setX(x);
	loc.setY(loc1.getY());
	loc.setZ(z);
	return loc;
}
 
开发者ID:benNek,项目名称:AsgardAscension,代码行数:10,代码来源:TribeUtils.java

示例14: movePlayer

import org.bukkit.Location; //导入方法依赖的package包/类
public void movePlayer(Entity p, int dx, int dy, int dz) {
	NavyCraft.instance.DebugMessage("Moving player", 4);
	int mccraftspeed = craft.speed;
	if (mccraftspeed > 2) {
		mccraftspeed = 2;
	}

	Vector pVel = p.getVelocity();

	if (dx > 0) {
		dx = craft.speed;
	} else {
		dx = craft.speed * -1;
	}
	if (dy > 0) {
		dy = craft.speed;
	} else {
		dy = craft.speed * -1;
	}
	if (dz > 0) {
		dz = craft.speed;
	} else {
		dz = craft.speed * -1;
	}
	pVel = pVel.add(new Vector(dx, dy, dz));


	if ((pVel.getX() > 10) || (pVel.getZ() > 10) || (pVel.getY() > 10)) {

		System.out.println("Velocity is too high, have to teleport " + p.getEntityId());
		Location pLoc = p.getLocation();
		pLoc.setX(pLoc.getX() + pVel.getX());
		pLoc.setY(pLoc.getY() + pVel.getY() + .05);
		pLoc.setZ(pLoc.getZ() + pVel.getZ());
		p.teleport(pLoc);
	} else {
		p.setVelocity(pVel);
	}
}
 
开发者ID:Maximuspayne,项目名称:NavyCraft2-Lite,代码行数:40,代码来源:CraftMover.java

示例15: getLocation

import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public Location getLocation(Location loc)
{
	loc.setWorld(location.getWorld());
	loc.setDirection(location.getDirection());
	loc.setX(location.getX());
	loc.setY(location.getY());
	loc.setZ(location.getZ());
	return loc;
}
 
开发者ID:seeseemelk,项目名称:MockBukkit,代码行数:11,代码来源:PlayerMock.java


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