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


Java BukkitUtil类代码示例

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


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

示例1: onNextRoomButtonPress

import com.sk89q.worldedit.bukkit.BukkitUtil; //导入依赖的package包/类
/**Event handler for a player pressing the button of this Passageway. Will callback to DunGen to generate the next DunGen part.
 * Also moves all other players to this Passageway.
 * @param event
 */
@EventHandler(priority = EventPriority.MONITOR)
public void onNextRoomButtonPress(PlayerInteractEvent event) {
    //Player p = event.getPlayer();
    if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
        Block clicked = event.getClickedBlock();
        if (   clicked.getType() == Material.STONE_BUTTON 
        	&& modVolume.contains(BukkitUtil.toVector(clicked.getLocation())) ) {
        	
        	unregister(); // button cannot be pushed twice
        	// If double button push appears more often, then use flag here
        	// Here we need the activePlayers list. This is not present in the entry, so don't teleport during STARTUP phase.
        	// This might be solvable better somehow...
        	
        	// only teleport if the dungeon runs, not during entry startup state
        	if (parent.state == State.RUNNING) 
	        	for (Player p : parent.activePlayers) {
	        		if (!modVolume.contains(BukkitUtil.toVector(p.getLocation()))) {
	        			p.teleport(BukkitUtil.toLocation(parent.world, toGlobal(respawnLoc).add(0.5, 0, 0.5)));
	        		}
	        	}
        	
        	parent.genNextRoom();
        }
    }
}
 
开发者ID:TheRoot89,项目名称:DungeonGen,代码行数:30,代码来源:Passageway.java

示例2: onCrossBoundary

import com.sk89q.worldedit.bukkit.BukkitUtil; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public boolean onCrossBoundary(Player player, Location from, Location to, ApplicableRegionSet toSet, Set<ProtectedRegion> entered, Set<ProtectedRegion> exited, MoveType moveType)
{
	if (!WorldGuardUtils.hasBypass(player))
	{
		if (!player.hasMetadata("WGEFP-TPOEF"))
		{
			com.sk89q.worldedit.Location location = toSet.queryValue(WorldGuardUtils.wrapPlayer(player), FlagUtils.TELEPORT_ON_ENTRY);
			if (location != null)
			{
				player.setMetadata("WGEFP-TPOEF", new FixedMetadataValue(WorldGuardExtraFlagsPlugin.getPlugin(), null));
				player.teleport(BukkitUtil.toLocation(location));
			}
		}
	}
	
	return true;
}
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:20,代码来源:TeleportOnEntryFlag.java

示例3: setBlock

import com.sk89q.worldedit.bukkit.BukkitUtil; //导入依赖的package包/类
@Override
  public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException
  {
  	Player player = WorldGuardExtraFlagsPlugin.getPlugin().getServer().getPlayer(this.actor.getUniqueId());
if (WorldGuardUtils.hasBypass(player))
  	{
  		return super.setBlock(location, block);
  	}
  	else
  	{
  		if (WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getRegionContainer().createQuery().getApplicableRegions(BukkitUtil.toLocation(player.getWorld(), location)).queryValue(WorldGuardUtils.wrapPlayer(player), FlagUtils.WORLDEDIT) != State.DENY)
  		{
  			return super.setBlock(location, block);
  		}
  		else
  		{
  			return false;
  		}
  	}
  }
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:21,代码来源:WorldEditFlag.java

示例4: onCrossBoundary

import com.sk89q.worldedit.bukkit.BukkitUtil; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public boolean onCrossBoundary(Player player, Location from, Location to, ApplicableRegionSet toSet, Set<ProtectedRegion> entered, Set<ProtectedRegion> exited, MoveType moveType)
{
	if (!WorldGuardUtils.hasBypass(player))
	{
		if (!player.hasMetadata("WGEFP-TPOEF"))
		{
			for (ProtectedRegion exitd : exited)
			{
				com.sk89q.worldedit.Location location = exitd.getFlag(FlagUtils.TELEPORT_ON_EXIT);
				if (location != null)
				{
					player.setMetadata("WGEFP-TPOEF", new FixedMetadataValue(WorldGuardExtraFlagsPlugin.getPlugin(), null));
					player.teleport(BukkitUtil.toLocation(location));
					
					break;
				}
			}
		}
	}
	
	return true;
}
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:25,代码来源:TeleportOnExitFlag.java

示例5: doUnloadChunkFlagWorldCheck

import com.sk89q.worldedit.bukkit.BukkitUtil; //导入依赖的package包/类
public static void doUnloadChunkFlagWorldCheck(World world)
{
	for (ProtectedRegion region : WorldGuardExtraFlagsPlugin.worldGuardPlugin.getRegionManager(world).getRegions().values())
	{
		if (region.getFlag(FlagUtils.CHUNK_UNLOAD) == State.DENY)
		{
			WorldGuardExtraFlagsPlugin.getPlugin().getLogger().info("Loading chunks for region " + region.getId() + " located in " + world.getName() + " due to chunk-unload flag being deny");
			
			Location min = BukkitUtil.toLocation(world, region.getMinimumPoint());
			Location max = BukkitUtil.toLocation(world, region.getMaximumPoint());

			for(int x = min.getChunk().getX(); x <= max.getChunk().getX(); x++)
			{
				for(int z = min.getChunk().getZ(); z <= max.getChunk().getZ(); z++)
				{
					world.getChunkAt(x, z).load(true);
				}
			}
		}
	}
}
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:22,代码来源:WorldGuardExtraFlagsPlugin.java

示例6: execute

import com.sk89q.worldedit.bukkit.BukkitUtil; //导入依赖的package包/类
@Override
protected boolean execute() {
    while (!regions.isEmpty()) {
        final Region region = regions.remove(0);
        LocalWorld localWorld = BukkitUtil.getLocalWorld(world);
        final EditSession editSession = WorldEditHandler.createEditSession(localWorld, region.getArea() * 255);
        editSession.enableQueue();
        editSession.setFastMode(true);
        try {
            editSession.setBlocks(region, AIR);
        } catch (MaxChangedBlocksException e) {
            log.log(Level.INFO, "Warning: we got MaxChangedBlocks from WE, please increase it!");
        }
        editSession.flushQueue();
        //editSession.commit();
        if (!tick()) {
            break;
        }
    }
    return regions.isEmpty();
}
 
开发者ID:rlf,项目名称:uSkyBlock,代码行数:22,代码来源:WorldEditClear.java

示例7: clearOldRegions

import com.sk89q.worldedit.bukkit.BukkitUtil; //导入依赖的package包/类
@SuppressWarnings("deprecation")
private void clearOldRegions() {
	for (String planetName : centreCoordinates.keySet()){
		ProtectedRegion wgRegion = rgMgr.getRegion(planetName);
		if(wgRegion == null){
			print("No WG region forund for planet '"+planetName+"', skipping region deletion.");
			continue;
		}
		com.sk89q.worldedit.LocalWorld weWorld = BukkitUtil.getLocalWorld(world);
		EditSession es = WorldEdit.getInstance().getEditSessionFactory().getEditSession(weWorld, -1);
		Region weRegion = new Polygonal2DRegion(weWorld,
				wgRegion.getPoints(), 
				wgRegion.getMinimumPoint().getBlockY(),
				wgRegion.getMaximumPoint().getBlockY());
		try {
			es.setBlocks(weRegion, new BaseBlock(BlockID.AIR));
		} catch (MaxChangedBlocksException e) {
			// should never happen as limit is -1
			print("Error deleting blocks with WE for planet '"+planetName+"', max block limit reached.");
		}
		rgMgr.removeRegion(planetName);
	}	
}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:24,代码来源:SQOrbitsPlanetMover.java

示例8: isInsideDeathzone

import com.sk89q.worldedit.bukkit.BukkitUtil; //导入依赖的package包/类
private boolean isInsideDeathzone(Location location, Game game, boolean useLiquidDeathzone) {
	boolean result = false;
	if (useLiquidDeathzone && FLOWING_MATERIALS.contains(location.getBlock().getType())) {
		result = true;
	} else {
		Vector vec = BukkitUtil.toVector(location);
		
		for (Region deathzone : game.getDeathzones().values()) {
			if (deathzone.contains(vec)) {
				//Location is in deathzone
				result = true;
				break;
			}
		}
	}
	
	return result;
}
 
开发者ID:xaniox,项目名称:HeavySpleef,代码行数:19,代码来源:LoseCheckerTask.java

示例9: calculateSpawnLocations

import com.sk89q.worldedit.bukkit.BukkitUtil; //导入依赖的package包/类
private void calculateSpawnLocations() {
	spawningBarriers.clear();
	
	for (Floor floor : game.getFloors()) {
		Region region = floor.getRegion();
		RegionIterator iterator = new RegionIterator(region);
		
		while (iterator.hasNext()) {
			BlockVector vector = iterator.next();
			Location location = BukkitUtil.toLocation(game.getWorld(), vector);
			Block block = location.getBlock();
			if (block.getType() != Material.BARRIER) {
				continue;
			}
			
			spawningBarriers.add(vector.add(0.5, 0.5, 0.5));
		}
	}
	
	Collections.shuffle(spawningBarriers);
}
 
开发者ID:xaniox,项目名称:HeavySpleef,代码行数:22,代码来源:FlagShowBarriers.java

示例10: editAnimation

import com.sk89q.worldedit.bukkit.BukkitUtil; //导入依赖的package包/类
public static boolean editAnimation(Player p, String animationName) {
    clear();
    MCMEAnimation animation = null;
    for (MCMEAnimation a : MCMEAnimations.animations) {
        if (a.getName().equals(animationName)) {
            animation = a;
        }
    }
    if (null == animation) {
        p.sendMessage(ChatColor.RED + "Cannot find animation\"" + animationName + "\"!");
        return false;
    }

    AnimationFactory.animationName = animationName;
    AnimationFactory.animationDescription = (String) animation.getConfiguration().get("description");
    AnimationFactory.origin = BukkitUtil.toVector(animation.getOrigin());
    AnimationFactory.owner = p;
    AnimationFactory.type = animation.getType();
    ArrayList<MCMEClipboardStore> clipboards = new ArrayList();
    MCMEClipboardStore c = new MCMEClipboardStore();
    for (MCMEAnimationFrame f : animation.getFrames()) {
        f.getFrameName();

    }
    return true;
}
 
开发者ID:MCME,项目名称:Animations-Redux,代码行数:27,代码来源:AnimationFactory.java

示例11: check

import com.sk89q.worldedit.bukkit.BukkitUtil; //导入依赖的package包/类
@Override
    public boolean check(Location location) {

//        SamplePlugin.WEPlugin.getServer().getLogger().info("Checking shape triggering...");
//        SamplePlugin.WEPlugin.getServer().getLogger().info("-=Shape=-");
//        SamplePlugin.WEPlugin.getServer().getLogger().info("Pos1: " + parent.getBounds().getPos1().toString());
//        SamplePlugin.WEPlugin.getServer().getLogger().info("Pos2: " + parent.getBounds().getPos2().toString());
//        SamplePlugin.WEPlugin.getServer().getLogger().info("-=Trigger=-");
//        SamplePlugin.WEPlugin.getServer().getLogger().info("Location: " + location.toString());
//        MCMEAnimations.MCMEAnimationsInstance.getLogger().info("min: "+parent.getBounds().getMinimumPoint());
//        MCMEAnimations.MCMEAnimationsInstance.getLogger().info("max: "+parent.getBounds().getMaximumPoint());
//        MCMEAnimations.MCMEAnimationsInstance.getLogger().info("loc: "+BukkitUtil.toVector(location));
        if ((parent.getCurrentFrame() == frame)
                && parent.getBounds().contains(BukkitUtil.toVector(location))) {
            return true;
        }
        return false;
    }
 
开发者ID:MCME,项目名称:Animations-Redux,代码行数:19,代码来源:ShapeInteractTrigger.java

示例12: BlockSpawnTask

import com.sk89q.worldedit.bukkit.BukkitUtil; //导入依赖的package包/类
/**Constructor, passes arguments to super class and loads special values from config.
 * @param parent	The Room this Task belongs to
 * @param conf		Given config file of this room has entries on tasks.
 * @param taskNr	Task number is needed to load keys correctly.
 */
public BlockSpawnTask(Room parent, FileConfiguration conf, int taskNr) {
	super(parent, conf, taskNr);
	this.type = TaskType.BLOCKSPAWN;
	
	// loading values for this Task type:
	String path = "tasks.task" + this.taskNr + ".";
	blockMaterial = Material.getMaterial(conf.getString(path + "blockType").toUpperCase(Locale.ENGLISH)); // this is a lookup 'string' -> 'enum value'
	incrementVec =   BukkitUtil.toVector(conf.getVector(path + "incrementVector",new org.bukkit.util.Vector())); // default no increment
	
	// The targetRegion is not converted to global here, as it is potentially incremented each cycle with a relative vector.
}
 
开发者ID:TheRoot89,项目名称:DungeonGen,代码行数:17,代码来源:BlockSpawnTask.java

示例13: run

import com.sk89q.worldedit.bukkit.BukkitUtil; //导入依赖的package包/类
@Override
public void run() {
	// do conversion once:
	if (!convertedToGlobal) {
		targetRegion = new CuboidRegion(parent.toGlobal(targetRegion.getPos1()), parent.toGlobal(targetRegion.getPos2()));
		convertedToGlobal = true;
	}
	
	// spawn as many entities as given by count:
	World world = parent.getPlugin().world;
	for (int nr=0; nr<grp.count; nr++) { 
		
		// use an individual random location, defined by the region of this task.
		// try for a given number of times to find a position not blocked. Give warning if not possible
		int tryNr = 1;
		Location spawnL = new Location(world, 0, 0, 0);
		while (tryNr < MAXSPAWNPOSITIONTRIES) {
			spawnL = BukkitUtil.toLocation(world, Helper.getRandVector(targetRegion));
			if (world.getBlockAt(spawnL).isEmpty()) break;
		}
		if (tryNr == MAXSPAWNPOSITIONTRIES) {
			parent.getPlugin().getLogger().warning("Entity could not be spawned: No free blocks within target region!");
			continue;
		}
		
		// Position is free if code reached here, so spawn:
		spawnL = spawnL.add(new org.bukkit.util.Vector(0.5,0,0.5)); // full qualified name again, meh// 0.5 added for world coord!
		Entity thisEnemy = world.spawnEntity(spawnL, grp.type);		// spawn and get pointer to track it
		if (grp.isTarget) parent.addTrackedEntity(thisEnemy); 		// add to List of tracked entities for BattleRooms to monitor
	}
}
 
开发者ID:TheRoot89,项目名称:DungeonGen,代码行数:32,代码来源:EntitySpawnTask.java

示例14: RoomTask

import com.sk89q.worldedit.bukkit.BukkitUtil; //导入依赖的package包/类
/**Constructor takes a back-reference to do actions and loads itself via config and TaskNr.
 * @param parent	The Room this Task belongs to
 * @param conf		Given config file of this room has entries on tasks.
 * @param taskNr	Task number is needed to load keys correctly.
 */
public RoomTask(Room parent, FileConfiguration conf,int taskNr) {
	this.parent = parent;
	this.taskNr = taskNr;
	
	// Load RoomTask values for Task i values from config:
	String path = "tasks.task" + this.taskNr + ".";
	
	type   =   			TaskType.valueOf(conf.getString(path + "type").trim().toUpperCase());
	delay  =  							 conf.getDouble(path + "delay",  0);
	period = 							 conf.getDouble(path + "period", 0);
	targetRegion = new CuboidRegion(BukkitUtil.toVector(conf.getVector(path + "regionCorner1",new org.bukkit.util.Vector())),
			                        BukkitUtil.toVector(conf.getVector(path + "regionCorner2",new org.bukkit.util.Vector())));
}
 
开发者ID:TheRoot89,项目名称:DungeonGen,代码行数:19,代码来源:RoomTask.java

示例15: genEntry

import com.sk89q.worldedit.bukkit.BukkitUtil; //导入依赖的package包/类
/**
 * Starts the dungeon, generating the entry area and setting up listeners for player button press actions.
 * The STARTUP status will lead to the execution of the startup() member as soon as the entry's button is pressed.
 * @param start		Vector where the dungeon entry is generated
 * @param towardsD	Dungeon Entry direction
 */
public void genEntry(Vector start, Direc towardsD) {
	state = State.STARTUP;

	// generate entry:
	String name = getRandomModule(entryModules);
	entry = new Entry(this,name,BukkitUtil.toVector(start),towardsD); //generate the named entry. 'This' is given for attribute access.
	curPassway2 = entry;		// start chain of module tripplets
	entry.place();
	entry.register();			//listener for button now active
	entry.toggleExit(false);
	entry.toggleEntry(true);
	getServer().broadcastMessage("Dungeon started, enter on your own risk."); // ok to broadcast to whole server?
}
 
开发者ID:TheRoot89,项目名称:DungeonGen,代码行数:20,代码来源:DunGen.java


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