Search in sources :

Example 6 with GameProfile

use of com.mojang.authlib.GameProfile in project Engine by VoltzEngine-Project.

the class TestAbstractLocation method setUpForEntireClass.

@Override
public void setUpForEntireClass() {
    super.setUpForEntireClass();
    server = new FakeDedicatedServer(new File(FakeWorldServer.baseFolder, "TestAbstractLocation"));
    world = FakeWorldServer.newWorld(server, "TestAbstractLocation");
    player = new TestPlayer(server, world, new GameProfile(null, "TileTester"));
}
Also used : TestPlayer(com.builtbroken.mc.testing.junit.testers.TestPlayer) GameProfile(com.mojang.authlib.GameProfile) File(java.io.File) FakeDedicatedServer(com.builtbroken.mc.testing.junit.server.FakeDedicatedServer)

Example 7 with GameProfile

use of com.mojang.authlib.GameProfile in project Railcraft by Railcraft.

the class ItemTicket method addInformation.

//    @Override
//    public String getItemDisplayName(ItemStack stack) {
//        String dest = getDestination(stack);
//
//        if (!dest.equals("")) {
//            return super.getItemDisplayName(stack) + " - " + dest.substring(dest.lastIndexOf("/") + 1);
//        }
//
//        return super.getItemDisplayName(stack);
//    }
/**
     * allows items to add custom lines of information to the mouse over
     * description
     */
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List<String> list, boolean par4) {
    if (stack.hasTagCompound()) {
        GameProfile owner = getOwner(stack);
        if (owner.getId() != null) {
            list.add(TextFormatting.WHITE + LocalizationPlugin.translate("gui.railcraft.routing.ticket.tips.issuer"));
            list.add(TextFormatting.GRAY + PlayerPlugin.getUsername(player.worldObj, owner));
        }
        String dest = getDestination(stack);
        if (!dest.equals("")) {
            list.add(TextFormatting.WHITE + LocalizationPlugin.translate("gui.railcraft.routing.ticket.tips.dest"));
            list.add(TextFormatting.GRAY + dest);
        }
    } else
        list.add(LocalizationPlugin.translate("gui.railcraft.routing.ticket.tips.blank"));
}
Also used : GameProfile(com.mojang.authlib.GameProfile) NBTTagString(net.minecraft.nbt.NBTTagString) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 8 with GameProfile

use of com.mojang.authlib.GameProfile in project Railcraft by Railcraft.

the class ItemTicketGold method canPlayerEdit.

@Override
public boolean canPlayerEdit(EntityPlayer player, ItemStack stack) {
    boolean canEdit = PlayerPlugin.isPlayerOp(player.getGameProfile());
    if (!canEdit && !RailcraftConfig.isRoutingOpsOnly()) {
        GameProfile owner = getOwner(stack);
        canEdit = owner.getId() == null || PlayerPlugin.isOwnerOrOp(owner, player);
    }
    return canEdit;
}
Also used : GameProfile(com.mojang.authlib.GameProfile)

Example 9 with GameProfile

use of com.mojang.authlib.GameProfile in project Railcraft by Railcraft.

the class CartTools method getCartOwnerEntity.

public static EntityPlayer getCartOwnerEntity(EntityMinecart cart) {
    GameProfile owner = CartToolsAPI.getCartOwner(cart);
    EntityPlayer player = null;
    if (!RailcraftConstantsAPI.UNKNOWN_PLAYER.equals(owner.getName()))
        player = PlayerPlugin.getPlayer(cart.worldObj, owner);
    if (player == null)
        player = RailcraftFakePlayer.get((WorldServer) cart.worldObj, cart.posX, cart.posY, cart.posZ);
    return player;
}
Also used : GameProfile(com.mojang.authlib.GameProfile) EntityPlayer(net.minecraft.entity.player.EntityPlayer)

Example 10 with GameProfile

use of com.mojang.authlib.GameProfile in project Railcraft by Railcraft.

the class PlayerPlugin method readOwnerFromNBT.

@Nonnull
public static GameProfile readOwnerFromNBT(@Nonnull NBTTagCompound nbt) {
    String ownerName = UNKNOWN_PLAYER_NAME;
    if (nbt.hasKey("owner"))
        ownerName = nbt.getString("owner");
    UUID ownerUUID = null;
    if (nbt.hasKey("ownerId"))
        ownerUUID = UUID.fromString(nbt.getString("ownerId"));
    return new GameProfile(ownerUUID, ownerName);
}
Also used : GameProfile(com.mojang.authlib.GameProfile) UUID(java.util.UUID) Nonnull(javax.annotation.Nonnull)

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