• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MPlayer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getRelationTo

import com.massivecraft.factions.entity.MPlayer; //导入依赖的package包/类
@Override
public Rel getRelationTo(Object comparing) {
	// Convert our FactionsFramework Factions object to their object
	if (comparing instanceof Faction) {
		Faction faction = (Faction) comparing;
		
		comparing = this.faction.getColl().get(faction.getId());
	}
	
	// Convert our FactionsFramework FPlayer object to their object
	if (comparing instanceof FPlayer) {
		FPlayer fplayer = (FPlayer) comparing;
		
		comparing = MPlayer.get(fplayer.getId());
	}
	
	if (comparing instanceof RelationParticipator) {
		Rel rel = Factions_2_8_6.convertRelationship(this.faction.getRelationTo((RelationParticipator) comparing));
		
		return rel;
	}
	
	return null;
}
 
开发者ID:markhughes,项目名称:FactionsFramework,代码行数:25,代码来源:Faction_2_8_6.java


示例2: getRelationTo

import com.massivecraft.factions.entity.MPlayer; //导入依赖的package包/类
@Override
public Rel getRelationTo(Object object) {
	if (this.id == "@console") return Rel.NEUTRAL;
	
	if (object instanceof Faction) {
		object = FactionColl.get().get(((Faction) object).getId());
	}
	
	if (object instanceof FPlayer) {
		object = MPlayer.get(((FPlayer) object).getId());
	}
	
	if (object instanceof Player) {
		object = MPlayer.get((Player) object);
	}
	
	return Factions_2_8_6.convertRelationship(this.mplayer.getRelationTo((RelationParticipator) object));
}
 
开发者ID:markhughes,项目名称:FactionsFramework,代码行数:19,代码来源:FPlayer_2_8_6.java


示例3: chunkChangeDetect

import com.massivecraft.factions.entity.MPlayer; //导入依赖的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


示例4: formatFac

import com.massivecraft.factions.entity.MPlayer; //导入依赖的package包/类
public static String formatFac(String text, Player sender, Object receiver){
	MPlayer mp = MPlayer.get(sender.getUniqueId());
	if (!mp.getFaction().isNone()){
		Faction fac = mp.getFaction();
		text = text
				.replace("{fac-id}", fac.getId())
				.replace("{fac-name}", fac.getName());
		if (fac.hasMotd()){
			text = text
					.replace("{fac-motd}", fac.getMotd());		
		}	
		if (fac.hasDescription()){
			text = text
					.replace("{fac-description}", fac.getDescription());		
		}
		if (receiver instanceof Player){
			MPlayer recmp = MPlayer.get(((Player)receiver).getUniqueId());
			text = text
					.replace("{fac-relation-name}", fac.getName(recmp))
					.replace("{fac-relation-color}", fac.getColorTo(recmp).toString());
		}
	}
	return text;
}
 
开发者ID:FabioZumbi12,项目名称:UltimateChat,代码行数:25,代码来源:UCFactionsHook.java


示例5: getInitialRanges

import com.massivecraft.factions.entity.MPlayer; //导入依赖的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


示例6: convertMPlayerToPlayer

import com.massivecraft.factions.entity.MPlayer; //导入依赖的package包/类
/**
 * Converts an {@link MPlayer} to a {@link Player}.
 *
 * @return The player, or <code>null</code> if they aren't a player, or do
 *         not have WDL installed.
 */
private Player convertMPlayerToPlayer(MPlayer mplayer) {
	if (mplayer == null) {
		return null;
	}
	if (!mplayer.isPlayer()) {
		return null;
	}
	
	Player player = mplayer.getPlayer();
	if (!MUtil.isPlayer(player)) {
		// If they aren't a player (IE, they are an NPC?)
		return null;
	}
	
	if (!rangeGroup.isWDLPlayer(player)) {
		return null;
	}
	
	return player;
}
 
开发者ID:Pokechu22,项目名称:WDLCompanion-Factions,代码行数:27,代码来源:MyFactionRangeProducer.java


示例7: convertChunkMapToRanges

import com.massivecraft.factions.entity.MPlayer; //导入依赖的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


示例8: registerNewFactions

import com.massivecraft.factions.entity.MPlayer; //导入依赖的package包/类
private void registerNewFactions() {
    register("power")
            .scoreSupply(player -> getMPlayer(player)
                    .map(MPlayer::getPowerRounded)
                    .orElse(-1));

    register("f_power")
            .scoreSupply(player -> getNewFaction(player)
                    .map(com.massivecraft.factions.entity.Faction::getPowerRounded)
                    .orElse(-1));

    register("members")
            .scoreSupply(player -> getNewFaction(player)
                    .map(com.massivecraft.factions.entity.Faction::getMPlayers)
                    .map(Collection::size)
                    .orElse(-1));

    register("members_online")
            .scoreSupply(player -> getNewFaction(player)
                    .map(com.massivecraft.factions.entity.Faction::getMPlayers)
                    .map(Collection::size)
                    .orElse(-1));
}
 
开发者ID:games647,项目名称:ScoreboardStats,代码行数:24,代码来源:FactionsVariables.java


示例9: getPlayerRank

import com.massivecraft.factions.entity.MPlayer; //导入依赖的package包/类
@Override
public MyRel getPlayerRank(Object player) {
    Rel role = MPlayer.get(player).getRole();
    switch (role) {
        case LEADER:
            return MyRel.LEADER;
        case OFFICER:
            return MyRel.OFFICER;
        case MEMBER:
            return MyRel.MEMBER;
        case RECRUIT:
            return MyRel.RECRUIT;
        default:
            return MyRel.NEUTRAL;
    }
}
 
开发者ID:James137137,项目名称:FactionChat,代码行数:17,代码来源:FactionsAPI_2_9_0.java


示例10: doSetAt

import com.massivecraft.factions.entity.MPlayer; //导入依赖的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


示例11: getMembers

import com.massivecraft.factions.entity.MPlayer; //导入依赖的package包/类
@Override
public Set<FPlayer> getMembers() {
	Set<FPlayer> fplayers = new TreeSet<FPlayer>();
	
	for (MPlayer mplayer : this.faction.getMPlayers()) {
		fplayers.add(FPlayers.getById(mplayer.getId()));
	}
	
	return fplayers;
}
 
开发者ID:markhughes,项目名称:FactionsFramework,代码行数:11,代码来源:Faction_2_8_6.java


示例12: getMembersExcept

import com.massivecraft.factions.entity.MPlayer; //导入依赖的package包/类
@Override
public Set<FPlayer> getMembersExcept(Rel... rels) {
	Set<FPlayer> members = new TreeSet<FPlayer>();
	
	ArrayList<Rel> relsList = new ArrayList<Rel>();
	for (Rel rel : rels) relsList.add(rel);
	
	for (MPlayer mplayer : this.faction.getMPlayers()) {
		FPlayer fplayer = FPlayers.getById(mplayer.getId());
		
		if (relsList.contains(fplayer.getRole())) members.add(fplayer);
	}
	
	return members;
}
 
开发者ID:markhughes,项目名称:FactionsFramework,代码行数:16,代码来源:Faction_2_8_6.java


示例13: getOfficers

import com.massivecraft.factions.entity.MPlayer; //导入依赖的package包/类
@Override
public Set<FPlayer> getOfficers() {
	Set<FPlayer> officers = new TreeSet<FPlayer>();
	
	for (MPlayer mplayer: this.faction.getMPlayersWhereRole(com.massivecraft.factions.Rel.OFFICER)) {
		officers.add(FPlayers.getById(mplayer.getId()));
	}
	
	return officers;
}
 
开发者ID:markhughes,项目名称:FactionsFramework,代码行数:11,代码来源:Faction_2_8_6.java


示例14: FPlayer_2_8_6

import com.massivecraft.factions.entity.MPlayer; //导入依赖的package包/类
public FPlayer_2_8_6(String id) {
	this.id = id;
	
	if (this.id == "@console") {
		this.mplayer = MPlayer.get(Bukkit.getConsoleSender());
	} else {
		this.mplayer = MPlayer.get(id);
	}
}
 
开发者ID:markhughes,项目名称:FactionsFramework,代码行数:10,代码来源:FPlayer_2_8_6.java


示例15: isProtected

import com.massivecraft.factions.entity.MPlayer; //导入依赖的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


示例16: onMembershipChange

import com.massivecraft.factions.entity.MPlayer; //导入依赖的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


示例17: onPermChange

import com.massivecraft.factions.entity.MPlayer; //导入依赖的package包/类
/**
 * Called when the permission for a certain relation within a faction
 * changes.  Updates the permissions for the affected players.
 */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPermChange(EventFactionsPermChange e) {
	if (e.getPerm() == plugin.getOrRegisterDownloadPerm()) {
		List<MPlayer> players = e.getFaction().getMPlayersWhereRole(
				e.getRel());
		
		for (MPlayer mplayer : players) {
			Player player = convertMPlayerToPlayer(mplayer);
			
			if (player == null) {
				continue;
			}
			if (e.getNewValue() == true) {
				Set<PS> newPS = getFactionPositions(player.getWorld(),
						e.getFaction());
				List<ProtectionRange> newRanges = convertPSToRanges(
						player.getWorld(), newPS, e.getFaction());
				// Give the player their new ranges
				rangeGroup.setRanges(player, newRanges);
			} else {
				// Remove the old ranges
				rangeGroup.setRanges(player, new ProtectionRange[0]);
			}
		}
	}
}
 
开发者ID:Pokechu22,项目名称:WDLCompanion-Factions,代码行数:31,代码来源:MyFactionRangeProducer.java


示例18: convertPlayerToMPlayer

import com.massivecraft.factions.entity.MPlayer; //导入依赖的package包/类
/**
 * Converts a {@link Player} to an {@link MPlayer}.
 *
 * @return The mplayer.
 */
private MPlayer convertPlayerToMPlayer(Player player) {
	if (player == null) {
		return null;
	}
	if (!MUtil.isPlayer(player)) {
		// If they aren't a player (IE, they are an NPC?)
		return null;
	}
	
	return MPlayer.get(player);
}
 
开发者ID:Pokechu22,项目名称:WDLCompanion-Factions,代码行数:17,代码来源:MyFactionRangeProducer.java


示例19: onMembershipChange

import com.massivecraft.factions.entity.MPlayer; //导入依赖的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;
	}
	
	playersNeedingUpdating.add(player.getUniqueId());
}
 
开发者ID:Pokechu22,项目名称:WDLCompanion-Factions,代码行数:14,代码来源:NearbyFactionsRangeProducer.java


示例20: isAvailable

import com.massivecraft.factions.entity.MPlayer; //导入依赖的package包/类
/**
 * Tests if the Factions plugin is installed.
 * 
 * @return True if the factions plugin is installed, false otherwise.
 */
public static boolean isAvailable() {
    try {
        JavaPlugin.getProvidingPlugin(MPlayer.class);
        return true;
    } catch (NoClassDefFoundError e) {
        return false;
    }
}
 
开发者ID:rutgerkok,项目名称:BlockLocker,代码行数:14,代码来源:FactionsGroupSystem.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SpNegoCredElement类代码示例发布时间:2022-05-21
下一篇:
Java StrokeChooserPanel类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap