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


Java PS类代码示例

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


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

示例1: chunkChangeDetect

import com.massivecraft.massivecore.ps.PS; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void chunkChangeDetect(PlayerMoveEvent event)
{
	// If the player is moving from one chunk to another ...
	if (MUtil.isSameChunk(event)) return;
	Player player = event.getPlayer();
	if (this.isntPlayer(player)) return;
	
	// ... gather info on the player and the move ...
	MPlayer mplayer = MPlayer.get(player);
	
	PS chunkFrom = PS.valueOf(event.getFrom()).getChunk(true);
	PS chunkTo = PS.valueOf(event.getTo()).getChunk(true);
			
	Faction factionFrom = BoardColl.get().getFactionAt(chunkFrom);
	Faction factionTo = BoardColl.get().getFactionAt(chunkTo);
			
	if ( ! isChunkCoord(player)) return;
	
	// ... and send info onwards.
	EngineMain.get().chunkChangeTerritoryInfo(mplayer, player, chunkFrom, chunkTo, factionFrom, factionTo);
	EngineMain.get().chunkChangeAutoClaim(mplayer, chunkTo);
	
}
 
开发者ID:markhughes,项目名称:MassiveCoreForgeFixes,代码行数:25,代码来源:FactionsEvents.java

示例2: getInitialRanges

import com.massivecraft.massivecore.ps.PS; //导入依赖的package包/类
@Override
public List<ProtectionRange> getInitialRanges(Player player) {
	ArrayList<ProtectionRange> ranges = new ArrayList<>();
	MPlayer mplayer = MPlayer.get(player);
	
	if (mplayer.hasFaction()) {
		Faction faction = mplayer.getFaction();
		MPerm downloadPerm = plugin.getOrRegisterDownloadPerm();
		if (downloadPerm.has(mplayer, faction, false)) {
			Set<PS> positions = getFactionPositions(player.getWorld(), faction);
			ranges.addAll(convertPSToRanges(player.getWorld(), positions, faction));
		}
	}
	
	return ranges;
}
 
开发者ID:Pokechu22,项目名称:WDLCompanion-Factions,代码行数:17,代码来源:MyFactionRangeProducer.java

示例3: convertPSToRanges

import com.massivecraft.massivecore.ps.PS; //导入依赖的package包/类
/**
 * Converts a Set of MassiveCraft {@link PS}s to {@link ProtectionRange}s.
 */
public List<ProtectionRange> convertPSToRanges(World world, Set<PS> positions, Faction owningFaction) {
	List<ProtectionRange> ranges = new ArrayList<>();
	
	for (PS position : positions) {
		if (!position.getWorld().equals(world.getName())) {
			continue;
		}
		int x = position.getChunkX();
		int z = position.getChunkZ();
		
		ranges.add(new ProtectionRange(owningFaction.getName(), x, z, x, z));
	}
	
	return ranges;
}
 
开发者ID:Pokechu22,项目名称:WDLCompanion-Factions,代码行数:19,代码来源:MyFactionRangeProducer.java

示例4: run

import com.massivecraft.massivecore.ps.PS; //导入依赖的package包/类
/**
 * Called each tick; try to empty out {@link #playersNeedingUpdating}.
 */
@Override
public void run() {
	for (UUID uuid : playersNeedingUpdating) {
		Player player = Bukkit.getPlayer(uuid);
		if (player != null && rangeGroup.isWDLPlayer(player)) {
			Map<PS, Faction> chunkMap = getNearbyChunks(player,
					trackDistance);
			List<ProtectionRange> ranges = convertChunkMapToRanges(player,
					chunkMap);

			rangeGroup.setRanges(player, ranges);
		}
	}
	
	playersNeedingUpdating.clear();
}
 
开发者ID:Pokechu22,项目名称:WDLCompanion-Factions,代码行数:20,代码来源:NearbyFactionsRangeProducer.java

示例5: convertChunkMapToRanges

import com.massivecraft.massivecore.ps.PS; //导入依赖的package包/类
/**
 * Converts a Map (of MassiveCraft {@link PS}s to Factions) to a list of
 * {@link ProtectionRange}s.  Only chunks that the player can download in are
 * given.
 */
public List<ProtectionRange> convertChunkMapToRanges(Player player, Map<PS, Faction> chunkMap) {
	MPlayer mplayer = convertPlayerToMPlayer(player);
	String world = player.getWorld().getName();
	List<ProtectionRange> ranges = new ArrayList<>();
	
	MPerm downloadPerm = plugin.getOrRegisterDownloadPerm();
	
	for (Map.Entry<PS, Faction> entry : chunkMap.entrySet()) {
		if (!entry.getKey().getWorld().equals(world)) {
			continue;
		}
		if (!downloadPerm.has(mplayer, entry.getValue(), false)) {
			continue;
		}
		
		int x = entry.getKey().getChunkX();
		int z = entry.getKey().getChunkZ();
		String tag = entry.getValue().getName();
		
		ranges.add(new ProtectionRange(tag, x, z, x, z));
	}
	
	return ranges;
}
 
开发者ID:Pokechu22,项目名称:WDLCompanion-Factions,代码行数:30,代码来源:NearbyFactionsRangeProducer.java

示例6: process

import com.massivecraft.massivecore.ps.PS; //导入依赖的package包/类
@Override
public void process(World from, World to) {
	System.out.println("Preprocessing: Faction " + f.getName());
	Set<PS> chunks = BoardColl.get().getChunks(f);
	for (PS ps : chunks) {
		if (ps.getWorld().equals(from.getName())) {
			Chunk c = ps.asBukkitChunk();
			int cx = c.getX() * 16;
			int cz = c.getZ() * 16;
			System.out.println("Preprocessing:      FactionBlock x=" + cx + ",z=" + cz);
			for (int x = cx; x < cx + 16; x++) {
				for (int z = cz; z < cz + 16; z++) {
					for (int y = 0; y < 256; y++) {
						WorldRestore.addToProcessQueues(from.getBlockAt(x, y, z));
					}
				}
			}
		}
	}
}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:21,代码来源:FactionsPreprocessTask.java

示例7: getAt

import com.massivecraft.massivecore.ps.PS; //导入依赖的package包/类
@Override
public Faction getAt(Chunk chunk) {
	com.massivecraft.factions.entity.Faction mfaction = BoardColls.get().getFactionAt(PS.valueOf(chunk));
	
	if (mfaction == null) return null;
			
	return get(mfaction.getId());
}
 
开发者ID:markhughes,项目名称:FactionsFramework,代码行数:9,代码来源:Factions_2_6.java

示例8: doSetAt

import com.massivecraft.massivecore.ps.PS; //导入依赖的package包/类
private void doSetAt(Set<PS> chunks, MPlayer player, com.massivecraft.factions.entity.Faction newFaction) {
	String formatOne = "<h>%s<i> %s <h>%d <i>chunk %s<i>.";
	String formatMany = "<h>%s<i> %s <h>%d <i>chunks near %s<i>.";
	
	HashMap<com.massivecraft.factions.entity.Faction, Set<PS>> oldFactionChunks = new HashMap<com.massivecraft.factions.entity.Faction, Set<PS>>();
	
	for (PS chunk : chunks) {
		com.massivecraft.factions.entity.Faction factionHere = BoardColl.get().getFactionAt(chunk);
		Set<PS> claims = new HashSet<PS>();
		
		if (oldFactionChunks.containsKey(factionHere)) {
			claims = oldFactionChunks.get(factionHere);
			claims.add(chunk);
		}
		
		oldFactionChunks.put(factionHere, claims);			
		BoardColl.get().setFactionAt(chunk, newFaction);
	}
	
	// Inform
	for (Entry<com.massivecraft.factions.entity.Faction, Set<PS>> entry : oldFactionChunks.entrySet()) {
		final com.massivecraft.factions.entity.Faction oldFaction = entry.getKey();
		final Set<PS> oldChunks = entry.getValue();
		final PS oldChunk = oldChunks.iterator().next();
		final Set<MPlayer> informees = MPlayer.getClaimInformees(player, oldFaction, newFaction);
		final EventFactionsChunkChangeType type = EventFactionsChunkChangeType.get(oldFaction, newFaction, player.getFaction());
		
		String chunkString = oldChunk.toString(PSFormatHumanSpace.get());
		String typeString = type.past;
		
		for (MPlayer informee : informees) {
			informee.msg((oldChunks.size() == 1 ? formatOne : formatMany), player.describeTo(informee, true), typeString, oldChunks.size(), chunkString);
			informee.msg("  <h>%s<i> --> <h>%s", oldFaction.describeTo(informee, true), newFaction.describeTo(informee, true));
		}
	}
}
 
开发者ID:markhughes,项目名称:FactionsFramework,代码行数:37,代码来源:Events_2_7.java

示例9: tryClaim

import com.massivecraft.massivecore.ps.PS; //导入依赖的package包/类
@Override
public boolean tryClaim(Faction faction, Location location) {
	Collection<PS> locationsCol = new ArrayList<PS>();
	locationsCol.add(PS.valueOf(location));
	
	return this.mplayer.tryClaim(FactionColl.get().get(faction.getId()), locationsCol);
}
 
开发者ID:markhughes,项目名称:FactionsFramework,代码行数:8,代码来源:FPlayer_2_8_6.java

示例10: getAt

import com.massivecraft.massivecore.ps.PS; //导入依赖的package包/类
@Override
public Faction getAt(Chunk chunk) {
	com.massivecraft.factions.entity.Faction mfaction = BoardColl.get().getFactionAt(PS.valueOf(chunk));
	
	if (mfaction == null) return null;
	
	return get(mfaction.getId());
}
 
开发者ID:markhughes,项目名称:FactionsFramework,代码行数:9,代码来源:Factions_2_8_6.java

示例11: factionLandNearby

import com.massivecraft.massivecore.ps.PS; //导入依赖的package包/类
/**
 * Is there faction land within the radius from location
 * @param l
 * @return False if none, True if land found.
 */
public boolean factionLandNearby(Location l) {
    if (Bukkit.getServer().getPluginManager().getPlugin("Factions") == null) {
        return false;
    }
    if(!RandomCoords.getPlugin().getConfig().getString("Factions").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));
            if (!(BoardColl.get().getFactionAt(PS.valueOf(b)).isNone())) {
                return true;
            }

        }
    }

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

示例12: getClaims

import com.massivecraft.massivecore.ps.PS; //导入依赖的package包/类
@Override
public List<ChunkPos> getClaims() {
    List<ChunkPos> target = new LinkedList<>();
    for (Set<PS> ps : BoardColl.get().getFactionToChunks().values()) {
        target.addAll(psToChunkPos(ps));
    }
    return target;
}
 
开发者ID:novucs,项目名称:factions-top,代码行数:9,代码来源:Factions0207.java

示例13: checkSurroundingFactions

import com.massivecraft.massivecore.ps.PS; //导入依赖的package包/类
private boolean checkSurroundingFactions(Location loc) {
    int distance = range / 2;
    Vector top = new Vector(loc.getX() + distance, loc.getY(), loc.getZ() + distance);
    Vector bottom = new Vector(loc.getX() - distance, loc.getY(), loc.getZ() - distance);
    for (int z = bottom.getBlockZ(); z <= top.getBlockZ(); z++) {
        for (int x = bottom.getBlockX(); x <= top.getBlockX(); x++) {
            if (BoardColl.get().getFactionAt(PS.valueOf(new Location(loc.getWorld(), loc.getX() + x, loc.getY(), loc.getZ() + z))).isNone())
                return true;
        }
    }
    return false;
}
 
开发者ID:Qballl,项目名称:WildernessTp,代码行数:13,代码来源:ClaimChecks.java

示例14: isProtected

import com.massivecraft.massivecore.ps.PS; //导入依赖的package包/类
private boolean isProtected(Player player, Block b) {
	Faction faction = BoardColl.get().getFactionAt(PS.valueOf(b));
	MPlayer mp = MPlayer.get(player);
	if (faction != null && !faction.getId().equals("none")) {
		if (!faction.getId().equals(mp.getFactionId())) return true;
	}
	return false;
}
 
开发者ID:TheBusyBiscuit,项目名称:CS-CoreLib,代码行数:9,代码来源:FactionsProtectionModule.java

示例15: onMembershipChange

import com.massivecraft.massivecore.ps.PS; //导入依赖的package包/类
/**
 * Called when someone's membership in a faction changes.
 */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onMembershipChange(EventFactionsMembershipChange e) {
	MPlayer mplayer = e.getMPlayer();
	Player player = convertMPlayerToPlayer(mplayer);
	if (player == null) {
		return;
	}
	
	Set<PS> newPS = getFactionPositions(player.getWorld(), e.getNewFaction());
	List<ProtectionRange> newRanges = convertPSToRanges(player.getWorld(), newPS, e.getNewFaction());
	rangeGroup.setRanges(player, newRanges);
}
 
开发者ID:Pokechu22,项目名称:WDLCompanion-Factions,代码行数:16,代码来源:MyFactionRangeProducer.java


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