Interactive book [Minecraft 1.8.8 Spigot] - plugins

This question is about Spigot 1.8.8 (Minecraft).
Hello! I want to create an interactive book (click and hover events) and don't know how. I searched many hours but found nothing that worked for me.
I tried this code:
ItemStack book = new ItemStack(Material.WRITTEN_BOOK);
BookMeta bookMeta = (BookMeta) book.getItemMeta();
BaseComponent[] page = new ComponentBuilder("Click")
.event(new ClickEvent(ClickEvent.Action.OPEN_URL, "http://spigotmc.org"))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Thanks for hovering").create()))
.create();
bookMeta.spigot().addPage(page);
bookMeta.setTitle("test");
bookMeta.setAuthor("test");
book.setItemMeta(bookMeta);
But bookMeta.spigot().addPage() does not exists.
Please help! I have to use 1.8.8

To my knowledge, there is no fix for this without using NMS. I see that you've read the documentation on the spigot website, but that only applies to newer versions. However, someone has already described how to do it with NMS in this post: https://bukkit.org/threads/creating-book-guis.380796/

Related

OrientDB: is OCommandFunction usable in 3.0.0m1?

In version 2 OCommandFuction would be used more or less like this:
OCommandFunction command = new OCommandFunction(function);
ODocument doc = db.command(command).execute(args);
or
OResultSet<ODocument> rs = db.command(command).execute(args);
In 3.0 db.command is deprecated and the 3.0 idiomatic alternatives are documented in most use cases, except, to the best of my knowledge, for the one I described.
Any suggestions?
Thanks
The following should work fine:
db.execute("sql", "RETURN yourFunctin()", params);
3.0M1 is still an early beta, so if you find any problems please report them on the official issue tracker. Thanks!

trying to access Thunderbird-tabmail does not work

I want to open a new tab with a gloda conversation from inside calendar code.
I receive an error from error console:
window not defined (or document not defined), depending on which of the two I use to Access tabmail:
let tabmail = window.document.getElementById("tabmail");
let tabmail = document.getElementById("tabmail");
The code works fine if the js file is included in an overlay xul-file.
But I want to use it outside of xul in my code.
Somewhere in my calendar code (in my 'addevent'), the same code throws the error.
This code is originally called from a rightclick on an email, but several layers deep into calendar code.
In MDN, I read that window is global? So what do I Need to do to add an tab?
This part works if tabmail is properly referenced:
tabmail.openTab("glodaList", {
collection: queryCollection,
message: aCollection.items[0],
title: tabTitle,
background: false
});
So how do I get a reference for tabmail?
Any help is appreciated.
after trying and looking through code for really some time before posting, it took only ca. 20 minutes to accidentally find the solution after submitting the question..
While browsing mailutils on mxr for something else, I found the solution in some function:
mail3PaneWindow = Services.wm.getMostRecentWindow("mail:3pane");
if (mail3PaneWindow) var tabmail = mail3PaneWindow.document.getElementById("tabmail");

getStructureId returns the real ID minus 1?

this is the code I am using :
JournalArticle article = null;
article = JournalArticleLocalServiceUtil.getLatestArticle(classPk);
String structureId = article.getStructureId();
When I debugged I found that structureId is always the real structureId but minus 1 !!!
Why ?? I need to know if it's Liferay bug ...
thank you,
I am Liferay 6.2 ce ga2.
JournalArticle's field structureId is equivalent not to DDMStructure.structureId, but to DDMStructure.structureKey. I admit, that can be really confusing.
This is due to the DDMStructure's object generation mechanism. When you add new structure using Control Panel, the structureKey is generated automatically using counterLocalService (check this code). As it happens just before the structureId is generated, it is always smaller by one.
See following Jira tickets, where it is explained the structureId vs structureKey issue:
- https://issues.liferay.com/browse/LPS-50671
- https://issues.liferay.com/browse/LPS-31163

How to retrieve youtube comments from a specific video using Eclipse

I have set up everything according from the guide here : https://developers.google.com/gdata/articles/eclipse
From there on, how do I start to retrieve the comments?
I'm sort of a beginner so it would be great if anyone could provide some codes to start off.
Firstly, you should download libraries and install required libraries shown in the page your link has.
To get comments from a youtube video you should send this URL : http://gdata.youtube.com/feeds/api/videos/VIDEO_ID/comments
YouTubeService service = new YouTubeService(
YOUR_CLIENT_ID);
String url="http://gdata.youtube.com/feeds/api/videos/VIDEO_ID/comments";
VideoEntry videoEntry = service.getEntry(new URL(url),
VideoEntry.class);
String commentUrl = videoEntry.getComments().getFeedLink().getHref();
CommentFeed commentFeed = service.getFeed(new URL(commentUrl),
CommentFeed.class);
for (CommentEntry comment : commentFeed.getEntries()) {
System.out.println(comment.getPlainTextContent());
}
You can get last 25 comments via this code. If you want to get more than 25 comments, you should read about pagination, max-results, start-index parameters.

Autofac parameter passing

I've been trying to integrate the latest version of autofac (1.3.3.54), and I'm running into the following problem.
The recommended way of consuming parameters in the Register callback, per the Google code wiki for the project is as follows:
builder.Register((c, p) => new Foo(p.Get("arg1")));
However this won't compile with the mentioned version of the autofac code. I looked through the source and I see that p is an IEnumerable (ComponentActivatorWithParameters). Is the code out of date with respect to the documentation?
It appears that the code has changed and the documentation on the Wiki has not been updated. The "Get" method is now "Named" and the "Parameter" class is now "NamedParameter". See the following example:
var builder = new ContainerBuilder();
builder.Register((c, p) => new Person(p.Named<string>("name")));
using (var container = builder.Build())
{
var person = container.Resolve<Person>(new NamedParameter("name", "Fred"));
}
Hopefully someone can update the documentation soon.
I've attached freshly built documentation for AutoFac 1.3 to AutoFac issue #121. I hope they'll resume posting official 1.3 documentation at least until they retire the 1.3 branch and, with it, support for .NET 2.0.