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


Java DimensionTypes类代码示例

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


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

示例1: tabCompleter

import org.spongepowered.api.world.DimensionTypes; //导入依赖的package包/类
@Override
public Collection<String> tabCompleter(final CommandSource source, final List<String> args) throws CommandException {
	if (args.size() == 1) {
		return Arrays.asList("day", "night", "dawn", "17:30", "4000");
	} else if (args.size() == 2) {
		List<String> suggests = new ArrayList<String>();
		for (World world : this.plugin.getEServer().getWorlds()) {
			if (this.plugin.getEverAPI().hasPermissionWorld(source, world)) {
				if (world.getProperties().getDimensionType().equals(DimensionTypes.OVERWORLD)) {
					suggests.add(world.getName());
				}
			}
		}
		suggests.add("*");
		return suggests;
	}
	return Arrays.asList();
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:19,代码来源:EETime.java

示例2: commandTimeSetAll

import org.spongepowered.api.world.DimensionTypes; //导入依赖的package包/类
private CompletableFuture<Boolean> commandTimeSetAll(final CommandSource player, final Optional<Long> time) {
	if (!time.isPresent()) {
		EEMessages.TIME_ERROR.sendTo(player);
		return CompletableFuture.completedFuture(false);
	}
	
	for (World world : this.plugin.getEServer().getWorlds()) {
		if (this.plugin.getEverAPI().hasPermissionWorld(player, world)) {
			if (world.getProperties().getDimensionType().equals(DimensionTypes.OVERWORLD)) {
				setWorldTime(world.getProperties(), time.get());
			}
		}
	}
	EEMessages.TIME_SET_ALL_WORLD.sender()
		.replace("{hours}", this.getTime(time.get()))
		.replace("{ticks}", String.valueOf(time.get()))
		.sendTo(player);
	return CompletableFuture.completedFuture(true);
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:20,代码来源:EETime.java

示例3: tabCompleter

import org.spongepowered.api.world.DimensionTypes; //导入依赖的package包/类
@Override
public Collection<String> tabCompleter(final CommandSource source, final List<String> args) throws CommandException {
	if (args.size() == 1) {
		return Arrays.asList("sun", "rain", "storm");
	} else if (args.size() == 2) {
		List<String> suggests = new ArrayList<String>();
		for (World world : this.plugin.getEServer().getWorlds()) {
			if (world.getProperties().getDimensionType().equals(DimensionTypes.OVERWORLD)) {
				if (this.plugin.getEverAPI().hasPermissionWorld(source, world)) {
					suggests.add(world.getName());
				}
			}
		}
		return suggests;
	} else if (args.size() == 3) {
		return Arrays.asList("60");
	}
	return Arrays.asList();
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:20,代码来源:EEWeather.java

示例4: commandWeather

import org.spongepowered.api.world.DimensionTypes; //导入依赖的package包/类
private CompletableFuture<Boolean> commandWeather(final CommandSource player, final Optional<Weather> weather, final World world) {
	if (!this.plugin.getEverAPI().hasPermissionWorld(player, world)) {
		EAMessages.NO_PERMISSION_WORLD.sender()
			.prefix(EEMessages.PREFIX)
			.replace("{world}", world.getName())
			.sendTo(player);
		return CompletableFuture.completedFuture(false);
	}
	
	if (!world.getProperties().getDimensionType().equals(DimensionTypes.OVERWORLD)) {
		EEMessages.WEATHER_ERROR.sendTo(player);
		return CompletableFuture.completedFuture(false);
	}
	
	if (!weather.isPresent()) {
		player.sendMessage(this.help(player));
		return CompletableFuture.completedFuture(false);
	}
	
	world.setWeather(weather.get());
	this.getMessage(weather.get())
		.replace("{world}", world.getName())
		.replace("{weather}", weather.get().getName())
		.sendTo(player);
	return CompletableFuture.completedFuture(true);
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:27,代码来源:EEWeather.java

示例5: removeDumpedFluids

import org.spongepowered.api.world.DimensionTypes; //导入依赖的package包/类
private void removeDumpedFluids() {
    if (this.seaLevel < 1) {
        return;
    }

    // remove any surface water or lava above sea level, presumed to be
    // placed by players
    // sometimes, this is naturally generated. but replacing it is very easy
    // with a bucket, so overall this is a good plan
    if (this.environment.equals(DimensionTypes.NETHER)) {
        return;
    }
    for (int x = 1; x < snapshots.length - 1; x++) {
        for (int z = 1; z < snapshots[0][0].length - 1; z++) {
            for (int y = this.seaLevel - 1; y < snapshots[0].length - 1; y++) {
                BlockSnapshot block = snapshots[x][y][z];
                if (block.getState().getType() == BlockTypes.WATER || block.getState().getType() == BlockTypes.LAVA ||
                        block.getState().getType() == BlockTypes.WATER || block.getState().getType() == BlockTypes.LAVA) {
                    snapshots[x][y][z] = block.withState(BlockTypes.AIR.getDefaultState());
                }
            }
        }
    }
}
 
开发者ID:MinecraftPortCentral,项目名称:GriefPrevention,代码行数:25,代码来源:RestoreNatureProcessingTask.java

示例6: reset

import org.spongepowered.api.world.DimensionTypes; //导入依赖的package包/类
@Override
public WorldCreationSettings.Builder reset() {
    this.dimensionType = DimensionTypes.OVERWORLD;
    this.generatorType = GeneratorTypes.DEFAULT;
    this.gameMode = GameModes.SURVIVAL;
    this.serializationBehavior = SerializationBehaviors.AUTOMATIC;
    this.isEnabled = true;
    this.loadOnStartup = true;
    this.doesKeepSpawnLoaded = true;
    this.generateSpawnOnLoad = true;
    this.usesMapFeatures = true;
    this.isHardcore = false;
    this.commandsAllowed = true;
    this.doesGenerateBonusChest = false;
    this.isPvpEnabled = true;
    this.seed = SpongeGame.instance.getConfiguration().getSeed();
    return this;
}
 
开发者ID:InspireNXE,项目名称:Pulse,代码行数:19,代码来源:ServerWorldCreationSettings.java

示例7: tabCompleter

import org.spongepowered.api.world.DimensionTypes; //导入依赖的package包/类
@Override
public Collection<String> tabCompleter(final CommandSource source, final List<String> args) throws CommandException {
	if (args.size() == 1) {
		List<String> suggests = new ArrayList<String>();
		for (World world : this.plugin.getEServer().getWorlds()) {
			if (world.getProperties().getDimensionType().equals(DimensionTypes.OVERWORLD)) {
				suggests.add(world.getName());
			}
		}
		suggests.add("*");
		return suggests;
	}
	return Arrays.asList();
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:15,代码来源:EETimeNight.java

示例8: tabCompleter

import org.spongepowered.api.world.DimensionTypes; //导入依赖的package包/类
@Override
public Collection<String> tabCompleter(final CommandSource source, final List<String> args) throws CommandException {
	if (args.size() == 1) {
		List<String> suggests = new ArrayList<String>();
		for (World world : this.plugin.getEServer().getWorlds()) {
			if (world.getProperties().getDimensionType().equals(DimensionTypes.OVERWORLD)) {
				suggests.add(world.getName());
			}
		}
		return suggests;
	} else if (args.size() == 3) {
		return Arrays.asList("60");
	}
	return Arrays.asList();
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:16,代码来源:EEWeatherRain.java

示例9: hasSurfaceFluids

import org.spongepowered.api.world.DimensionTypes; //导入依赖的package包/类
boolean hasSurfaceFluids() {
    Location<World> lesser = this.getLesserBoundaryCorner();
    Location<World> greater = this.getGreaterBoundaryCorner();

    // don't bother for very large claims, too expensive
    if (this.getClaimBlocks() > MAX_AREA) {
        return false;
    }

    int seaLevel = 0; // clean up all fluids in the end

    // respect sea level in normal worlds
    if (lesser.getExtent().getDimension().getType().equals(DimensionTypes.OVERWORLD)) {
        seaLevel = GriefPreventionPlugin.instance.getSeaLevel(lesser.getExtent());
    }

    for (int x = lesser.getBlockX(); x <= greater.getBlockX(); x++) {
        for (int z = lesser.getBlockZ(); z <= greater.getBlockZ(); z++) {
            for (int y = seaLevel - 1; y < lesser.getExtent().getDimension().getBuildHeight(); y++) {
                // dodge the exclusion claim
                BlockState block = lesser.getExtent().getBlock(x, y, z);

                if (block.getType() == BlockTypes.WATER || block.getType() == BlockTypes.FLOWING_WATER
                        || block.getType() == BlockTypes.LAVA || block.getType() == BlockTypes.FLOWING_LAVA) {
                    return true;
                }
            }
        }
    }

    return false;
}
 
开发者ID:MinecraftPortCentral,项目名称:GriefPrevention,代码行数:33,代码来源:GPClaim.java

示例10: registerDefaults

import org.spongepowered.api.world.DimensionTypes; //导入依赖的package包/类
@Override
public void registerDefaults() {
    final WorldArchetype overworld = WorldArchetype.builder()
            .enabled(true)
            .loadsOnStartup(true)
            .keepsSpawnLoaded(true)
            .generateSpawnOnLoad(true)
            .commandsAllowed(true)
            .gameMode(GameModes.SURVIVAL)
            .generator(GeneratorTypes.DEFAULT)
            .dimension(DimensionTypes.OVERWORLD)
            .difficulty(Difficulties.NORMAL)
            .usesMapFeatures(true)
            .hardcore(false)
            .pvp(true)
            .generateBonusChest(false)
            .serializationBehavior(SerializationBehaviors.AUTOMATIC)
            .build("minecraft:overworld", "Overworld");
    register(overworld);
    register(WorldArchetype.builder()
            .from(overworld)
            .generator(GeneratorTypes.NETHER)
            .dimension(DimensionTypes.NETHER)
            .build("minecraft:the_nether", "The Nether"));
    register(WorldArchetype.builder()
            .from(overworld)
            .generator(GeneratorTypes.THE_END)
            .dimension(DimensionTypes.THE_END)
            .build("minecraft:the_end", "The End"));
    register(WorldArchetype.builder()
            .from(overworld)
            .generatorModifiers(WorldGeneratorModifiers.VOID)
            .build("sponge:the_void", "The Void"));
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:35,代码来源:WorldArchetypeRegistryModule.java

示例11: removeSurfaceFluids

import org.spongepowered.api.world.DimensionTypes; //导入依赖的package包/类
public void removeSurfaceFluids(GPClaim exclusionClaim) {
    // don't do this for administrative claims
    if (this.isAdminClaim()) {
        return;
    }

    // don't do it for very large claims
    if (this.getClaimBlocks() > MAX_AREA) {
        return;
    }

    // only in creative mode worlds
    if (!GriefPreventionPlugin.instance.claimModeIsActive(this.lesserBoundaryCorner.getExtent().getProperties(), ClaimsMode.Creative)) {
        return;
    }

    Location<World> lesser = this.getLesserBoundaryCorner();
    Location<World> greater = this.getGreaterBoundaryCorner();

    if (lesser.getExtent().getDimension().getType().equals(DimensionTypes.NETHER)) {
        return; // don't clean up lava in the nether
    }

    int seaLevel = 0; // clean up all fluids in the end

    // respect sea level in normal worlds
    if (lesser.getExtent().getDimension().getType().equals(DimensionTypes.OVERWORLD)) {
        seaLevel = GriefPreventionPlugin.instance.getSeaLevel(lesser.getExtent());
    }

    for (int x = lesser.getBlockX(); x <= greater.getBlockX(); x++) {
        for (int z = lesser.getBlockZ(); z <= greater.getBlockZ(); z++) {
            for (int y = seaLevel - 1; y < lesser.getExtent().getDimension().getBuildHeight(); y++) {
                // dodge the exclusion claim
                BlockSnapshot block = lesser.getExtent().createSnapshot(x, y, z);
                if (exclusionClaim != null && exclusionClaim.contains(block.getLocation().get(), false)) {
                    continue;
                }

                if (block.getState().getType() == BlockTypes.LAVA || block.getState().getType() == BlockTypes.FLOWING_WATER
                        || block.getState().getType() == BlockTypes.WATER || block.getState().getType() == BlockTypes.FLOWING_LAVA) {
                    block.withState(BlockTypes.AIR.getDefaultState()).restore(true, BlockChangeFlags.PHYSICS);
                }
            }
        }
    }
}
 
开发者ID:MinecraftPortCentral,项目名称:GriefPrevention,代码行数:48,代码来源:GPClaim.java

示例12: DimensionTypeRegistryModule

import org.spongepowered.api.world.DimensionTypes; //导入依赖的package包/类
public DimensionTypeRegistryModule() {
    super(DimensionTypes.class);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:4,代码来源:DimensionTypeRegistryModule.java

示例13: execute

import org.spongepowered.api.world.DimensionTypes; //导入依赖的package包/类
@Override
public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException
{
	String name = ctx.<String> getOne("name").get();
	Optional<String> dimensionInput = ctx.<String> getOne("dimension");
	Optional<String> generatorInput = ctx.<String> getOne("generator");
	Optional<String> difficultyInput = ctx.<String> getOne("difficulty");
	Optional<GameMode> gamemode = ctx.<GameMode> getOne("gamemode");
	Difficulty difficulty = Difficulties.NORMAL;
	DimensionType dimension = DimensionTypes.OVERWORLD;
	GeneratorType generator = GeneratorTypes.OVERWORLD;

	if (dimensionInput.isPresent() && Sponge.getRegistry().getType(DimensionType.class, dimensionInput.get()).isPresent())
	{
		dimension = Sponge.getRegistry().getType(DimensionType.class, dimensionInput.get()).get();
	}
	else if (dimensionInput.isPresent())
	{
		src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "Dimension type specified not found."));
	}

	if (generatorInput.isPresent() && Sponge.getRegistry().getType(GeneratorType.class, generatorInput.get()).isPresent())
	{
		generator = Sponge.getRegistry().getType(GeneratorType.class, generatorInput.get()).get();
	}
	else if (generatorInput.isPresent())
	{
		src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "Generator type specified not found."));
	}

	if (difficultyInput.isPresent() && Sponge.getRegistry().getType(Difficulty.class, difficultyInput.get()).isPresent())
	{
		difficulty = Sponge.getRegistry().getType(Difficulty.class, difficultyInput.get()).get();
	}
	else if (difficultyInput.isPresent())
	{
		src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "Difficulty specified not found."));
	}

	src.sendMessage(Text.of(TextColors.GREEN, "Success! ", TextColors.YELLOW, "Beginning loading of world."));

	WorldArchetype worldSettings = WorldArchetype.builder()
		.enabled(true)
		.loadsOnStartup(true)
		.keepsSpawnLoaded(true)
		.dimension(dimension)
		.generator(generator)
		.gameMode(gamemode.orElse(GameModes.SURVIVAL))
		.build(name.toLowerCase(), name);

	try
	{
		WorldProperties worldProperties = Sponge.getGame().getServer().createWorldProperties(name, worldSettings);
		Optional<World> world = Sponge.getGame().getServer().loadWorld(worldProperties);

		if (world.isPresent())
		{
			world.get().getProperties().setDifficulty(difficulty);
			src.sendMessage(Text.of(TextColors.GREEN, "Success! ", TextColors.GOLD, "World ", TextColors.GRAY, name, TextColors.GOLD, " has been loaded."));
		}
		else
		{
			src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "The world could not be created."));
		}
	}
	catch (IOException e)
	{
		src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "The world properties could not be created."));
	}

	return CommandResult.success();
}
 
开发者ID:hsyyid,项目名称:EssentialCmds,代码行数:73,代码来源:WorldsBase.java

示例14: loadPerWorlds

import org.spongepowered.api.world.DimensionTypes; //导入依赖的package包/类
public void loadPerWorlds(World w) {		
	if (getNodes("region-settings.claim-types.worlds."+w.getName()).getString("").equals("")) {
   		getNodes("region-settings.claim-types.worlds."+w.getName()).setValue("BLOCK");
   	}
	
	if (getNodes("region-settings.world-colors."+w.getName()).getString("").equals("")) {
		if (w.getDimension().getType().equals(DimensionTypes.OVERWORLD)){
			getNodes("region-settings.world-colors."+w.getName()).setValue("&a&l");			            		
		} else
		if (w.getDimension().getType().equals(DimensionTypes.NETHER)){
			getNodes("region-settings.world-colors."+w.getName()).setValue("&c&l");			            		
		} else
		if (w.getDimension().getType().equals(DimensionTypes.THE_END)){
			getNodes("region-settings.world-colors."+w.getName()).setValue("&5&l");			            		
		}
		RedProtect.get().logger.warning("Added world to color list " + w.getName());
	}
	
	try {
		//RedProtect.get().logger.debug("default","Writing global flags for world "+ w.getName() + "...");
		gflags.getNode(w.getName(),"build").setValue(gflags.getNode(w.getName(),"build").getBoolean(true));
       	gflags.getNode(w.getName(),"if-build-false","break-blocks").setValue(gflags.getNode(w.getName(),"if-build-false","break-blocks").getList(TypeToken.of(String.class)));
       	gflags.getNode(w.getName(),"if-build-false","place-blocks").setValue(gflags.getNode(w.getName(),"if-build-false","place-blocks").getList(TypeToken.of(String.class)));
       	gflags.getNode(w.getName(),"pvp").setValue(gflags.getNode(w.getName(),"pvp").getBoolean(false));
       	gflags.getNode(w.getName(),"interact").setValue(gflags.getNode(w.getName(),"interact").getBoolean(true));
       	gflags.getNode(w.getName(),"use-minecart").setValue(gflags.getNode(w.getName(),"use-minecart").getBoolean(true));
       	gflags.getNode(w.getName(),"entity-block-damage").setValue(gflags.getNode(w.getName(),"entity-block-damage").getBoolean(false));
       	gflags.getNode(w.getName(),"explosion-entity-damage").setValue(gflags.getNode(w.getName(),"explosion-entity-damage").getBoolean(true));
       	gflags.getNode(w.getName(),"fire-block-damage").setValue(gflags.getNode(w.getName(),"fire-block-damage").getBoolean(false));
       	gflags.getNode(w.getName(),"fire-spread").setValue(gflags.getNode(w.getName(),"fire-spread").getBoolean(false));
       	gflags.getNode(w.getName(),"player-hurt-monsters").setValue(gflags.getNode(w.getName(),"player-hurt-monsters").getBoolean(true));
       	gflags.getNode(w.getName(),"player-hurt-passives").setValue(gflags.getNode(w.getName(),"player-hurt-passives").getBoolean(true));
       	gflags.getNode(w.getName(),"spawn-monsters").setValue(gflags.getNode(w.getName(),"spawn-monsters").getBoolean(true));
       	gflags.getNode(w.getName(),"spawn-passives").setValue(gflags.getNode(w.getName(),"spawn-passives").getBoolean(true));
       	gflags.getNode(w.getName(),"remove-entities-not-allowed-to-spawn").setValue(gflags.getNode(w.getName(),"remove-entities-not-allowed-to-spawn").getBoolean(false));
       	gflags.getNode(w.getName(),"allow-weather").setValue(gflags.getNode(w.getName(),"allow-weather").getBoolean(true));        	
       	gflags.getNode(w.getName(),"deny-item-usage","allow-on-claimed-rps").setValue(gflags.getNode(w.getName(),"deny-item-usage","allow-on-claimed-rps").getBoolean(true));
       	gflags.getNode(w.getName(),"deny-item-usage","allow-on-wilderness").setValue(gflags.getNode(w.getName(),"deny-item-usage","allow-on-wilderness").getBoolean(true));
       	gflags.getNode(w.getName(),"deny-item-usage","items").setValue(gflags.getNode(w.getName(),"deny-item-usage","items").getList(TypeToken.of(String.class)));  
       	gflags.getNode(w.getName(),"on-enter-cmds").setValue(gflags.getNode(w.getName(),"on-enter-cmds").getList(TypeToken.of(String.class)));  
       	gflags.getNode(w.getName(),"on-exit-cmds").setValue(gflags.getNode(w.getName(),"on-exit-cmds").getList(TypeToken.of(String.class)));
       	gflags.getNode(w.getName(),"allow-changes-of","water-flow").setValue(gflags.getNode(w.getName(),"allow-changes-of","water-flow").getBoolean(true));  
       	gflags.getNode(w.getName(),"allow-changes-of","lava-flow").setValue(gflags.getNode(w.getName(),"allow-changes-of","lava-flow").getBoolean(true)); 
       	gflags.getNode(w.getName(),"allow-changes-of","leaves-decay").setValue(gflags.getNode(w.getName(),"allow-changes-of","leaves-decay").getBoolean(true)); 
       	gflags.getNode(w.getName(),"allow-changes-of","flow-damage").setValue(gflags.getNode(w.getName(),"allow-changes-of","flow-damage").getBoolean(true));         	
       	gflags.getNode(w.getName(),"spawn-wither").setValue(gflags.getNode(w.getName(),"spawn-wither").getBoolean(true)); 
       	gflags.getNode(w.getName(),"invincible").setValue(gflags.getNode(w.getName(),"invincible").getBoolean(false)); 
       	gflags.getNode(w.getName(),"player-candrop").setValue(gflags.getNode(w.getName(),"player-candrop").getBoolean(true)); 
       	gflags.getNode(w.getName(),"player-canpickup").setValue(gflags.getNode(w.getName(),"player-canpickup").getBoolean(true));  
       	if (!gflags.getNode(w.getName(),"command-ranges").hasMapChildren()){
       		gflags.getNode(w.getName(),"command-ranges","home","min-range").setValue(gflags.getNode(w.getName(),"command-ranges","home","min-range").getDouble(0));  
       		gflags.getNode(w.getName(),"command-ranges","home","max-range").setValue(gflags.getNode(w.getName(),"command-ranges","home","max-range").getDouble(w.getBlockMax().getY()));  
       		gflags.getNode(w.getName(),"command-ranges","home","message").setValue(gflags.getNode(w.getName(),"command-ranges","home","message").getString("&cYou cant use /home when mining or in caves!"));        		
       	}      	
           //write gflags to gflags file
           gFlagsManager.save(gflags);
	} catch (IOException | ObjectMappingException e) {
		e.printStackTrace();
	} 
}
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:61,代码来源:RPConfig.java

示例15: handletp

import org.spongepowered.api.world.DimensionTypes; //导入依赖的package包/类
private static void handletp(Player p, String rname, String wname, Player play){

		World w = null;
		if (RedProtect.get().serv.getWorld(wname).isPresent()){
			w = RedProtect.get().serv.getWorld(wname).get();
		}

		if (w == null) {
            RPLang.sendMessage(p, "cmdmanager.region.invalidworld");
            return;
        }
    	Region region = RedProtect.get().rm.getRegion(rname, w);
    	if (region == null) {
    		RPLang.sendMessage(p, RPLang.get("cmdmanager.region.doesntexist") + ": " + rname);
            return;
        }

    	if (play == null) {
    		if (!RedProtect.get().ph.hasRegionPermMember(p, "teleport", region)){
    			RPLang.sendMessage(p, "no.permission");
                return;
    		}
    	} else {
    		if (!RedProtect.get().ph.hasPerm(p, "redprotect.teleport.other")) {
        		RPLang.sendMessage(p, "no.permission");
                return;
            }
        }

    	Location<World> loc = null;
    	if (region.getTPPoint() != null){
    		loc = new Location<>(w, region.getTPPoint().getBlockX() + 0.500, region.getTPPoint().getBlockY(), region.getTPPoint().getBlockZ() + 0.500);
    	} else {
    		int limit = w.getBlockMax().getY();
        	if (w.getDimension().equals(DimensionTypes.NETHER)){
        		limit = 124;
        	}
        	for (int i = limit; i > 0; i--){
        		BlockType mat = w.createSnapshot(region.getCenterX(), i, region.getCenterZ()).getState().getType();
        		BlockType mat1 = w.createSnapshot(region.getCenterX(), i+1, region.getCenterZ()).getState().getType();
        		BlockType mat2 = w.createSnapshot(region.getCenterX(), i+2, region.getCenterZ()).getState().getType();
        		if (!mat.equals(BlockTypes.LAVA) && !mat.equals(BlockTypes.AIR) && mat1.equals(BlockTypes.AIR) && mat2.equals(BlockTypes.AIR)){
        			loc = new Location<>(w, region.getCenterX() + 0.500, i + 1, region.getCenterZ() + 0.500);
        			break;
        		}
        	}
    	}

    	if (loc != null){
    		if (play != null){
    			play.setLocation(loc);
    			RPLang.sendMessage(play, RPLang.get("cmdmanager.region.teleport") + " " + rname);
    			RPLang.sendMessage(p, RPLang.get("cmdmanager.region.tpother") + " " + rname);
    		} else {
    			tpWait(p, loc, rname);
    		}
		}
    }
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:59,代码来源:RPCommands.java


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