Java Code Examples for net.minecraft.entity.player.EntityPlayer.getTeam()

The following are Jave code examples for showing how to use getTeam() of the net.minecraft.entity.player.EntityPlayer class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: DecompiledMinecraft   File: ServerConfigurationManager.java   View Source Code Vote up 6 votes
public void sendMessageToAllTeamMembers(EntityPlayer player, IChatComponent message)
{
    Team team = player.getTeam();

    if (team != null)
    {
        for (String s : team.getMembershipCollection())
        {
            EntityPlayerMP entityplayermp = this.getPlayerByUsername(s);

            if (entityplayermp != null && entityplayermp != player)
            {
                entityplayermp.addChatMessage(message);
            }
        }
    }
}
 
Example 2
Project: DecompiledMinecraft   File: ServerConfigurationManager.java   View Source Code Vote up 6 votes
public void sendMessageToTeamOrEvryPlayer(EntityPlayer player, IChatComponent message)
{
    Team team = player.getTeam();

    if (team == null)
    {
        this.sendChatMsg(message);
    }
    else
    {
        for (int i = 0; i < this.playerEntityList.size(); ++i)
        {
            EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntityList.get(i);

            if (entityplayermp.getTeam() != team)
            {
                entityplayermp.addChatMessage(message);
            }
        }
    }
}
 
Example 3
Project: DecompiledMinecraft   File: ServerConfigurationManager.java   View Source Code Vote up 6 votes
public void sendMessageToAllTeamMembers(EntityPlayer player, IChatComponent message)
{
    Team team = player.getTeam();

    if (team != null)
    {
        for (String s : team.getMembershipCollection())
        {
            EntityPlayerMP entityplayermp = this.getPlayerByUsername(s);

            if (entityplayermp != null && entityplayermp != player)
            {
                entityplayermp.addChatMessage(message);
            }
        }
    }
}
 
Example 4
Project: DecompiledMinecraft   File: ServerConfigurationManager.java   View Source Code Vote up 6 votes
public void sendMessageToTeamOrEvryPlayer(EntityPlayer player, IChatComponent message)
{
    Team team = player.getTeam();

    if (team == null)
    {
        this.sendChatMsg(message);
    }
    else
    {
        for (int i = 0; i < this.playerEntityList.size(); ++i)
        {
            EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntityList.get(i);

            if (entityplayermp.getTeam() != team)
            {
                entityplayermp.addChatMessage(message);
            }
        }
    }
}
 
Example 5
Project: BaseClient   File: ServerConfigurationManager.java   View Source Code Vote up 6 votes
public void sendMessageToAllTeamMembers(EntityPlayer player, IChatComponent message)
{
    Team team = player.getTeam();

    if (team != null)
    {
        for (String s : team.getMembershipCollection())
        {
            EntityPlayerMP entityplayermp = this.getPlayerByUsername(s);

            if (entityplayermp != null && entityplayermp != player)
            {
                entityplayermp.addChatMessage(message);
            }
        }
    }
}
 
Example 6
Project: BaseClient   File: ServerConfigurationManager.java   View Source Code Vote up 6 votes
public void sendMessageToTeamOrEvryPlayer(EntityPlayer player, IChatComponent message)
{
    Team team = player.getTeam();

    if (team == null)
    {
        this.sendChatMsg(message);
    }
    else
    {
        for (int i = 0; i < this.playerEntityList.size(); ++i)
        {
            EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntityList.get(i);

            if (entityplayermp.getTeam() != team)
            {
                entityplayermp.addChatMessage(message);
            }
        }
    }
}
 
Example 7
Project: BaseClient   File: ServerConfigurationManager.java   View Source Code Vote up 6 votes
public void sendMessageToTeamOrEvryPlayer(EntityPlayer player, IChatComponent message)
{
    Team team = player.getTeam();

    if (team == null)
    {
        this.sendChatMsg(message);
    }
    else
    {
        for (int i = 0; i < this.playerEntityList.size(); ++i)
        {
            EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntityList.get(i);

            if (entityplayermp.getTeam() != team)
            {
                entityplayermp.addChatMessage(message);
            }
        }
    }
}
 
Example 8
Project: Backmemed   File: PlayerList.java   View Source Code Vote up 6 votes
public void sendMessageToAllTeamMembers(EntityPlayer player, ITextComponent message)
{
    Team team = player.getTeam();

    if (team != null)
    {
        for (String s : team.getMembershipCollection())
        {
            EntityPlayerMP entityplayermp = this.getPlayerByUsername(s);

            if (entityplayermp != null && entityplayermp != player)
            {
                entityplayermp.addChatMessage(message);
            }
        }
    }
}
 
Example 9
Project: Backmemed   File: PlayerList.java   View Source Code Vote up 6 votes
public void sendMessageToTeamOrAllPlayers(EntityPlayer player, ITextComponent message)
{
    Team team = player.getTeam();

    if (team == null)
    {
        this.sendChatMsg(message);
    }
    else
    {
        for (int i = 0; i < this.playerEntityList.size(); ++i)
        {
            EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntityList.get(i);

            if (entityplayermp.getTeam() != team)
            {
                entityplayermp.addChatMessage(message);
            }
        }
    }
}
 
Example 10
Project: Mods   File: EntityTF2Character.java   View Source Code Vote up 6 votes
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand) {
	if (!(player.getHeldItemMainhand() != null
			&& player.getHeldItemMainhand().getItem() instanceof ItemMonsterPlacerPlus)
			&& (this.getOwner() == player || this.getAttackTarget() == null || this.friendly) && this.isEntityAlive() && !this.isTrading()
			&& !this.isChild() && !player.isSneaking()) {
		if (this.world.isRemote && player.getTeam() == null
				&& ((this.getCapability(TF2weapons.WEAPONS_CAP, null).state & 1) == 0 || this.friendly)
				&& !player.isCreative())
			ClientProxy.displayScreenConfirm("Choose a team to interact",
					"Visit the Mann Co. Store located in a village");
		if (!this.world.isRemote && (TF2Util.isOnSameTeam(this, player) || player.isCreative())
				&& (this.tradeOffers == null || !this.tradeOffers.isEmpty())) {
			this.setCustomer(player);
			FMLNetworkHandler.openGui(player, TF2weapons.instance, 4, world, this.getEntityId(), 0, 0);
		}

		player.addStat(StatList.TALKED_TO_VILLAGER);
		return true;
	} else
		return super.processInteract(player, hand);
}
 
Example 11
Project: Mods   File: EntitySaxtonHale.java   View Source Code Vote up 6 votes
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand) {
	if (!(player.getHeldItemMainhand() != null
			&& player.getHeldItemMainhand().getItem() instanceof ItemMonsterPlacerPlus)
			&& this.getAttackTarget() == null && this.isEntityAlive() && !this.isTrading() && !this.isChild()
			&& !player.isSneaking()) {
		if (this.world.isRemote && player.getTeam() == null && !player.isCreative())
			ClientProxy.displayScreenJoinTeam();
		else if (!this.world.isRemote && (player.getTeam() != null || player.isCreative())
				&& (this.tradeOffers == null || !this.tradeOffers.isEmpty())) {
			this.setCustomer(player);
			player.displayVillagerTradeGui(this);
		}

		player.addStat(StatList.TALKED_TO_VILLAGER);
		return true;
	} else
		return super.processInteract(player, hand);
}
 
Example 12
Project: CustomWorldGen   File: PlayerList.java   View Source Code Vote up 6 votes
public void sendMessageToAllTeamMembers(EntityPlayer player, ITextComponent message)
{
    Team team = player.getTeam();

    if (team != null)
    {
        for (String s : team.getMembershipCollection())
        {
            EntityPlayerMP entityplayermp = this.getPlayerByUsername(s);

            if (entityplayermp != null && entityplayermp != player)
            {
                entityplayermp.addChatMessage(message);
            }
        }
    }
}
 
Example 13
Project: CustomWorldGen   File: PlayerList.java   View Source Code Vote up 6 votes
public void sendMessageToTeamOrAllPlayers(EntityPlayer player, ITextComponent message)
{
    Team team = player.getTeam();

    if (team == null)
    {
        this.sendChatMsg(message);
    }
    else
    {
        for (int i = 0; i < this.playerEntityList.size(); ++i)
        {
            EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntityList.get(i);

            if (entityplayermp.getTeam() != team)
            {
                entityplayermp.addChatMessage(message);
            }
        }
    }
}
 
Example 14
Project: BaseClient   File: ServerConfigurationManager.java   View Source Code Vote up 5 votes
public void sendMessageToAllTeamMembers(EntityPlayer player, IChatComponent message)
{
    Team team = player.getTeam();

    if (team != null)
    {
        for (String s : team.getMembershipCollection())
        {
            EntityPlayerMP entityplayermp = this.getPlayerByUsername(s);

            if (entityplayermp != null && entityplayermp != player)
            {
                entityplayermp.addChatMessage(message);
            }
        }
    }
}
 
Example 15
Project: Backmemed   File: Entity.java   View Source Code Vote up 5 votes
/**
 * Only used by renderer in EntityLivingBase subclasses.
 * Determines if an entity is visible or not to a specfic player, if the entity is normally invisible.
 * For EntityLivingBase subclasses, returning false when invisible will render the entity semitransparent.
 */
public boolean isInvisibleToPlayer(EntityPlayer player)
{
    if (player.isSpectator())
    {
        return false;
    }
    else
    {
        Team team = this.getTeam();
        return team != null && player != null && player.getTeam() == team && team.getSeeFriendlyInvisiblesEnabled() ? false : this.isInvisible();
    }
}
 
Example 16
Project: Mods   File: ContainerTF2Workbench.java   View Source Code Vote up 5 votes
public static ItemStack getReplacement(EntityPlayer player, ItemStack stack) {
	if (!stack.isEmpty() && stack.getItem() instanceof ItemBuildingBox
			&& player.getTeam() == player.world.getScoreboard().getTeam("BLU"))
		stack.setItemDamage(stack.getItemDamage() + 1);
	if (!stack.isEmpty() && stack.getItem() instanceof ItemBanner){
		NBTTagCompound pattern=new NBTTagCompound();
		if(player.getTeam() == player.world.getScoreboard().getTeam("BLU")){
			stack.setItemDamage(EnumDyeColor.BLUE.getDyeDamage());
			pattern.setString("Pattern", "bb");
			pattern.setInteger("Color", 15);
		}
		else{
			pattern.setString("Pattern", "rb");
			pattern.setInteger("Color", 15);
		}
		
		stack.getSubCompound("BlockEntityTag").getTagList("Patterns", 10).appendTag(pattern);
	}
	if (!stack.isEmpty() && stack.getItem() instanceof ItemBuildingBox && stack.getItemDamage()/2 == 11) {
		ItemStack wrench=TF2Util.getFirstItem(player.inventory, stackL ->{
			return TF2Attribute.getModifier("Teleporter Cost", stackL, 1, player) != 1;
		});
		if(!wrench.isEmpty()) {
			stack.setCount((int) TF2Attribute.getModifier("Teleporter Cost", wrench, 1, player));
		}
	}
	return stack;
}
 
Example 17
Project: CustomWorldGen   File: Entity.java   View Source Code Vote up 5 votes
/**
 * Only used by renderer in EntityLivingBase subclasses.
 * Determines if an entity is visible or not to a specfic player, if the entity is normally invisible.
 * For EntityLivingBase subclasses, returning false when invisible will render the entity semitransparent.
 */
@SideOnly(Side.CLIENT)
public boolean isInvisibleToPlayer(EntityPlayer player)
{
    if (player.isSpectator())
    {
        return false;
    }
    else
    {
        Team team = this.getTeam();
        return team != null && player != null && player.getTeam() == team && team.getSeeFriendlyInvisiblesEnabled() ? false : this.isInvisible();
    }
}
 
Example 18
Project: HardcoreRevival   File: DeathHandler.java   View Source Code Vote up 4 votes
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onPlayerDeath(LivingDeathEvent event) {
	if (event.getEntityLiving() instanceof EntityPlayerMP) {
		EntityPlayer player = (EntityPlayer) event.getEntityLiving();

		// If the player fell into the void, there's no rescuing
		if (event.getSource() == DamageSource.OUT_OF_WORLD) {
			player.getEntityData().setBoolean(IGNORE_REVIVAL_DEATH, true);
			NetworkHandler.instance.sendTo(new MessageDie(), (EntityPlayerMP) player);
			return;
		}

		// If IGNORE_REVIVAL_DEATH is set, this should be treated as a normal death
		if (event.getSource() == HardcoreRevival.notRescuedInTime || player.getEntityData().getBoolean(IGNORE_REVIVAL_DEATH)) {
			return;
		}

		// Fire event for compatibility addons
		MinecraftForge.EVENT_BUS.post(new PlayerKnockedOutEvent(player, event.getSource()));

		// Dead players glow
		if (ModConfig.glowOnDeath) {
			player.setGlowing(true);
		}

		// Cancel event - we're taking over from here
		event.setCanceled(true);

		// If enabled, show a death message
		if (player.world.getGameRules().getBoolean("showDeathMessages")) {
			MinecraftServer server = player.world.getMinecraftServer();
			if (server != null) {
				Team team = player.getTeam();
				if (team != null && team.getDeathMessageVisibility() != Team.EnumVisible.ALWAYS) {
					if (team.getDeathMessageVisibility() == Team.EnumVisible.HIDE_FOR_OTHER_TEAMS) {
						server.getPlayerList().sendMessageToAllTeamMembers(player, player.getCombatTracker().getDeathMessage());
					} else if (team.getDeathMessageVisibility() == Team.EnumVisible.HIDE_FOR_OWN_TEAM) {
						server.getPlayerList().sendMessageToTeamOrAllPlayers(player, player.getCombatTracker().getDeathMessage());
					}
				} else {
					server.getPlayerList().sendMessage(player.getCombatTracker().getDeathMessage());
				}
			}
		}
	}
}