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


Java TownBlock类代码示例

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


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

示例1: process

import com.palmergames.bukkit.towny.object.TownBlock; //导入依赖的package包/类
@Override
public void process(World from, World to) {
	System.out.println("Preprocessing: Town " + t.getName());
	for (TownBlock tb : t.getTownBlocks()) {
		if (tb.getWorld().getName().equals(from.getName())) {
			int tbx = tb.getX() * 16;
			int tbz = tb.getZ() * 16;
			System.out.println("Preprocessing:      TownBlock x=" + tbx + ",z=" + tbz);
			for (int x = tbx; x < tbx + 16; x++) {
				for (int z = tbz; z < tbz + 16; z++) {
					for (int y = 0; y < 256; y++) {
						WorldRestore.addToProcessQueues(from.getBlockAt(x, y, z));
					}
				}
			}
		}
	}
}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:19,代码来源:TownyPreprocessTask.java

示例2: townyClaimNearby

import com.palmergames.bukkit.towny.object.TownBlock; //导入依赖的package包/类
/**
 * Is there a towny claim nearby
 * @param l
 * @return True if yes, False if no
 */
public boolean townyClaimNearby(Location l) {
    if (Bukkit.getServer().getPluginManager().getPlugin("Towny") == null) {
        return false;
    }
    if(!RandomCoords.getPlugin().getConfig().getString("Towny").equalsIgnoreCase("true")) {
        return false;
    }


    int radius = RandomCoords.getPlugin().getConfig().getInt("CheckingRadius");
    int chunkRadius = radius < 16 ? 1 : (radius - (radius % 16)) / 16;
    int x;
    int y;
    int z;


    for (int chX = 0 - chunkRadius; chX <= chunkRadius; chX++) {
        for (int chZ = 0 - chunkRadius; chZ <= chunkRadius; chZ++) {
            x = l.getBlockX();
            y = l.getBlockY();
            z = l.getBlockZ();
            Block b = l.getWorld().getBlockAt(x + (chX * 16), y, z + (chZ * 16));
            final TownBlock tb = TownyUniverse.getTownBlock(b.getLocation());
            if (tb != null) {
                return true;
            }

        }
    }

    return false;
}
 
开发者ID:jolbol1,项目名称:RandomCoordinatesV2,代码行数:38,代码来源:TownyChecker.java

示例3: canBuild

import com.palmergames.bukkit.towny.object.TownBlock; //导入依赖的package包/类
@Override
public boolean canBuild(Player player, Location loc) {
	TownBlock tblock = TownyUniverse.getTownBlock(loc);
	if (tblock != null) {
		if (tblock.getType() == TownBlockType.WILDS) {
			return true;
		}
		Language.sendError("user.target.block.town", player);
		return false;
	}
	return true;
}
 
开发者ID:mcardy,项目名称:Zephyrus-II,代码行数:13,代码来源:TownyHook.java

示例4: canCast

import com.palmergames.bukkit.towny.object.TownBlock; //导入依赖的package包/类
@Override
public boolean canCast(Player player, Spell spell) {
	TownBlock tblock = TownyUniverse.getTownBlock(player.getLocation());
	if (tblock != null) {
		if (ConfigOptions.TOWNY_CASTING) {
			if (tblock.getType() == TownBlockType.ARENA || tblock.getType() == TownBlockType.WILDS) {
				return true;
			}
		}
		Language.sendError("spell.cast.town", player);
		return false;
	}
	return true;
}
 
开发者ID:mcardy,项目名称:Zephyrus-II,代码行数:15,代码来源:TownyHook.java

示例5: CanDamage

import com.palmergames.bukkit.towny.object.TownBlock; //导入依赖的package包/类
@Override
public boolean CanDamage(Player player) {
    try{
        TownyWorld world = (TownyWorld)this.towny.getTownyUniverse().getWorldMap().get(player.getWorld().getName());
        TownBlock block = world.getTownBlock(Coord.parseCoord(player.getLocation()));
        return !CombatUtil.preventPvP(world, block);
    }catch (Exception e){
        ForgePermittor.log(Util.stackTraceToString(e), true);
    }
    return true;

}
 
开发者ID:TheFantasyCraft,项目名称:Forge-Permittor,代码行数:13,代码来源:TownyPlugin.java

示例6: isCommercialArea

import com.palmergames.bukkit.towny.object.TownBlock; //导入依赖的package包/类
public static boolean isCommercialArea(Location loc) {
	Plugin plugin = Bukkit.getPluginManager().getPlugin("Towny");
	if (plugin != null) {
		TownBlock townBlock = TownyUniverse.getTownBlock(loc);
		return townBlock.getType() == TownBlockType.COMMERCIAL;
	} else {
		return false;
	}
}
 
开发者ID:nisovin,项目名称:Shopkeepers,代码行数:10,代码来源:TownyHandler.java

示例7: TownyCheck

import com.palmergames.bukkit.towny.object.TownBlock; //导入依赖的package包/类
/**
 * Checks if the player is near a Towny town, or within the checking radius.
 * @param l The location to check.
 * @return True or False, Is the location in a Town?
 */
public boolean TownyCheck(final Location l) {
    if (!(Bukkit.getServer().getPluginManager().getPlugin("Towny") == null)) {
        if (RandomCoords.getPlugin().config.getString("Towny").equals("true")) {
            final int X = l.getBlockX();
            final int Y = l.getBlockY();
            final int Z = l.getBlockZ();

            final int r = RandomCoords.getPlugin().config.getInt("CheckingRadius");

            int x = X - r;
            int y = Y - r;
            int z = Z - r;

            final int bx = x;
            final int bz = z;


         //   for (int i = 0; i < r * 2 + 1; i++) {
                for (int j = 0; j < r * 2 + 1; j++) {
                    for (int k = 0; k < r * 2 + 1; k++) {
                        final Block b = l.getWorld().getBlockAt(x, y, z);
                        final TownBlock tb = TownyUniverse.getTownBlock(b.getLocation());
                        if (tb != null) {
                            return false;
                        }


                        //x++;
                        x = x + 16;
                    }
                   // z++;
                    z = z + 16;
                    x = bx;
                }
          /*      z = bz;
                x = bx;
                y++;
            }*/
        }

        return true;
    } else {

        return true;

    }
}
 
开发者ID:jolbol1,项目名称:RandomCoordinatesV2,代码行数:53,代码来源:TownyChecker.java

示例8: execute

import com.palmergames.bukkit.towny.object.TownBlock; //导入依赖的package包/类
@Override
protected void execute(Event e) {
	main core = (main) Bukkit.getPluginManager().getPlugin("SharpSK");

	// Town Generator

	try {

		TownyWorld world = TownyUniverse.getDataSource().getWorld(homespawn.getSingle(e).getWorld().getName());
		Coord loc = Coord.parseCoord(homespawn.getSingle(e));

		world.newTownBlock(loc);
		TownyUniverse.getDataSource().newTown(s.getSingle(e));
		Town town = TownyUniverse.getDataSource().getTown(s.getSingle(e));
		if (owner != null) {
			Resident resident = TownyUniverse.getDataSource().getResident(owner.getSingle(e).getName());
			town.addResident(resident);
			town.setMayor(resident);
			TownyUniverse.getDataSource().saveResident(resident);
		}
		if (members != null) {

			for (OfflinePlayer member : members.getAll(e)) {
				Resident loopresident = TownyUniverse.getDataSource().getResident(member.getName());
				town.addResident(loopresident);
				TownyUniverse.getDataSource().saveResident(loopresident);
			}

		}

		TownBlock TB = world.getTownBlock(loc);
		TB.setTown(town);
		town.setHomeBlock(TB);

		TB.setType(TB.getType());
		town.setSpawn(homespawn.getSingle(e));
		if (sb != null) {
			town.setBalance(sb.getSingle(e).doubleValue(), "Town Creation");
		} else {
			town.setBalance(0, "Town Creation");
		}

		TownyUniverse.getDataSource().saveTownBlock(TB);
		TownyUniverse.getDataSource().saveTown(town);
		TownyUniverse.getDataSource().saveWorld(world);

		TownyUniverse.getDataSource().saveTownList();
		TownyUniverse.getDataSource().saveTownBlockList();

	} catch (NotRegisteredException ex1) {
		core.getLogger().warning("Could not register town: " + "\"" + s.getSingle(e) + "\"");
	} catch (AlreadyRegisteredException ex2) {
		core.getLogger()
				.warning("Could not register town: " + "\"" + s.getSingle(e) + "\"" + ". Town already exists");
	} catch (TownyException ex3) {
		core.getLogger().warning("Could not register town: " + "\"" + s.getSingle(e) + "\"");
	} catch (EconomyException ex4) {
		core.getLogger().warning("Could not register town: " + "\"" + s.getSingle(e) + "\"");
	}

}
 
开发者ID:Sharpjaws,项目名称:SharpSK,代码行数:62,代码来源:EffTownyCreateTown.java

示例9: CanUseItem

import com.palmergames.bukkit.towny.object.TownBlock; //导入依赖的package包/类
public boolean CanUseItem(Player player, Location location, ItemType type){
    TownBlock localTownBlock = towny.getTownyUniverse().getTownBlock(location);
    if (type == ItemType.Food || type ==  ItemType.Block || type == ItemType.Container || type == ItemType.Weapon)
        return true;
    return PlayerCacheUtil.getCachePermission(player, location, Material.ENDER_PEARL.getId(), (byte) 0, TownyPermission.ActionType.ITEM_USE);
}
 
开发者ID:TheFantasyCraft,项目名称:Forge-Permittor,代码行数:7,代码来源:TownyPlugin.java


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