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"));
}
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"));
}
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;
}
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;
}
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);
}
Aggregations