Search in sources :

Example 31 with GameProfile

use of com.mojang.authlib.GameProfile in project Pearcel-Mod by MiningMark48.

the class BlockPearcelSpike method onEntityWalk.

@Override
public void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn) {
    if (entityIn instanceof EntityLivingBase) {
        if (fakePlayer == null) {
            if (!worldIn.isRemote) {
                fakePlayer = FakePlayerFactory.get((WorldServer) worldIn, new GameProfile(UUID.randomUUID(), ModBlocks.pearcel_spike.getLocalizedName()));
            }
        }
        if (!(entityIn instanceof EntityPlayer)) {
            ((EntityLivingBase) entityIn).addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 20, 1));
            entityIn.attackEntityFrom(DamageSource.causePlayerDamage(fakePlayer), spike_damage);
        }
    }
    super.onEntityWalk(worldIn, pos, entityIn);
}
Also used : GameProfile(com.mojang.authlib.GameProfile) PotionEffect(net.minecraft.potion.PotionEffect) EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayer(net.minecraft.entity.player.EntityPlayer) WorldServer(net.minecraft.world.WorldServer)

Example 32 with GameProfile

use of com.mojang.authlib.GameProfile in project acidisland by tastybento.

the class SkullBlock method getPlayerProfile.

// Credits: dori99xd
public static GameProfile getPlayerProfile(String textureValue, String textureSignature, String ownerUUID, String ownerName) {
    // Create a new GameProfile with .schematic informations or with fake informations
    GameProfile newSkinProfile = new GameProfile(ownerUUID == null ? UUID.randomUUID() : UUID.fromString(ownerUUID), ownerName == null ? getRandomString(16) : null);
    // Insert textures properties
    newSkinProfile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
    return newSkinProfile;
}
Also used : GameProfile(com.mojang.authlib.GameProfile) Property(com.mojang.authlib.properties.Property)

Example 33 with GameProfile

use of com.mojang.authlib.GameProfile in project PneumaticCraft by MineMaarten.

the class GuiSecurityStationInventory method getAccessText.

private List<String> getAccessText() {
    List<String> textList = new ArrayList<String>();
    textList.add("                                      ");
    textList.add("");
    for (GameProfile user : te.sharedUsers) {
        textList.add(EnumChatFormatting.BLACK + "-" + user.getName());
    }
    return textList;
}
Also used : GameProfile(com.mojang.authlib.GameProfile) ArrayList(java.util.ArrayList)

Example 34 with GameProfile

use of com.mojang.authlib.GameProfile in project PneumaticCraft by MineMaarten.

the class TileEntitySecurityStation method hasPlayerHacked.

public boolean hasPlayerHacked(EntityPlayer player) {
    for (int i = 0; i < hackedUsers.size(); i++) {
        GameProfile user = hackedUsers.get(i);
        if (gameProfileEquals(user, player.getGameProfile())) {
            if (user.getId() == null && player.getGameProfile().getId() != null) {
                hackedUsers.set(i, player.getGameProfile());
                Log.info("Legacy conversion: Security Station hacked username '" + player.getCommandSenderName() + "' is now using UUID '" + player.getGameProfile().getId() + "'.");
            }
            return true;
        }
    }
    return false;
}
Also used : GameProfile(com.mojang.authlib.GameProfile)

Example 35 with GameProfile

use of com.mojang.authlib.GameProfile in project PneumaticCraft by MineMaarten.

the class TileEntitySecurityStation method readFromPacket.

@Override
public void readFromPacket(NBTTagCompound tag) {
    super.readFromPacket(tag);
    sharedUsers.clear();
    NBTTagList sharedList = tag.getTagList("SharedUsers", 10);
    for (int i = 0; i < sharedList.tagCount(); ++i) {
        NBTTagCompound tagCompound = sharedList.getCompoundTagAt(i);
        sharedUsers.add(new GameProfile(tagCompound.hasKey("uuid") ? UUID.fromString(tagCompound.getString("uuid")) : null, tagCompound.getString("name")));
    }
    hackedUsers.clear();
    NBTTagList hackedList = tag.getTagList("HackedUsers", 10);
    for (int i = 0; i < hackedList.tagCount(); ++i) {
        NBTTagCompound tagCompound = hackedList.getCompoundTagAt(i);
        hackedUsers.add(new GameProfile(tagCompound.hasKey("uuid") ? UUID.fromString(tagCompound.getString("uuid")) : null, tagCompound.getString("name")));
    }
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) GameProfile(com.mojang.authlib.GameProfile) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Aggregations

GameProfile (com.mojang.authlib.GameProfile)60 Property (com.mojang.authlib.properties.Property)30 PlayerProfile (net.aufdemrand.denizen.nms.util.PlayerProfile)16 UUID (java.util.UUID)11 EntityPlayer (net.minecraft.entity.player.EntityPlayer)6 BigInteger (java.math.BigInteger)4 MessageDigest (java.security.MessageDigest)4 Player (com.minecolonies.api.colony.permissions.Player)3 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)3 WorldServer (net.minecraft.world.WorldServer)3 Scoreboard (org.bukkit.scoreboard.Scoreboard)3 Team (org.bukkit.scoreboard.Team)3 FakeDedicatedServer (com.builtbroken.mc.testing.junit.server.FakeDedicatedServer)2 TestPlayer (com.builtbroken.mc.testing.junit.testers.TestPlayer)2 File (java.io.File)2 NBTTagList (net.minecraft.nbt.NBTTagList)2 NBTTagString (net.minecraft.nbt.NBTTagString)2 NetHandlerPlayServer (net.minecraft.network.NetHandlerPlayServer)2 NetworkManager (net.minecraft.network.NetworkManager)2 PotionEffect (net.minecraft.potion.PotionEffect)2