Michael
Donators
Hero Member
Posts: 2166
|
|
« on: July 12, 2013, 03:44:06 PM » |
|
I would like to know if there is any actual information discussing the official API that is going to come for v.ALPHA, such as will it be similar to the current API, and will it be accessible with .jar files?
Also, are we allowed to discuss the upcoming API along with suggestions to it regarding certain things as methods and names for methods?
Thank you.
|
|
|
Logged
|
|
|
|
pspeed
|
|
« Reply #1 on: July 12, 2013, 09:23:14 PM » |
|
Not sure how to answer this one. Yes it will be similar. Yes it will be different. The java code will be in jars. The groovy code will probably also be zipped into the jars.
|
|
|
Logged
|
|
|
|
Michael
Donators
Hero Member
Posts: 2166
|
|
« Reply #2 on: July 12, 2013, 09:49:18 PM » |
|
Okay you got the first question down (sorta). a.) the code will be somewhat the same, but different for the API
will it still use groovy, or will we actually get to use java? ---------- Will we be allowed to discuss the API and suggestions for things that go into the API (what methods are called, how you do this in that in code, put suggestions for names of enumerations, classes, classes that you extend from, classes that you implement from, ect ect.)
|
|
|
Logged
|
|
|
|
pspeed
|
|
« Reply #3 on: July 12, 2013, 10:00:18 PM » |
|
Okay you got the first question down (sorta). a.) the code will be somewhat the same, but different for the API
will it still use groovy, or will we actually get to use java?
You can already use groovy or Java... so I have no idea what you mean here. ---------- Will we be allowed to discuss the API and suggestions for things that go into the API (what methods are called, how you do this in that in code, put suggestions for names of enumerations, classes, classes that you extend from, classes that you implement from, ect ect.)
You can... I don't know how you could have enough information to really make informed suggestions but you are welcome to discuss it.
|
|
|
Logged
|
|
|
|
Michael
Donators
Hero Member
Posts: 2166
|
|
« Reply #4 on: July 13, 2013, 12:08:50 AM » |
|
Mneh, Sorry Paul, I mean from a previous thread I talked about getting the groovy script to run a .jar file, I was asking will it have a simpler method to it when it goes alpha. The whole groovy and java differentiating thing is just really confusing me, like the different syntax from language to language in which groovy does this: on([playerJoined]) { type, event -> I wouldn't know how to do that in java at all.
|
|
|
Logged
|
|
|
|
pspeed
|
|
« Reply #5 on: July 13, 2013, 12:24:54 AM » |
|
Mneh, Sorry Paul, I mean from a previous thread I talked about getting the groovy script to run a .jar file, I was asking will it have a simpler method to it when it goes alpha.
It's not hard. Make a lib directory under the scripts directory where your scripts are. Put the .jar in there. Call your Java code from groovy. The whole groovy and java differentiating thing is just really confusing me, like the different syntax from language to language in which groovy does this: on([playerJoined]) { type, event -> I wouldn't know how to do that in java at all. EventDispatcher.getInstance().addListener( PlayerEvents.playerJoined, new EventListener<PlayerEvent>() { public void newEvent( EventType<PlayerEvent> type, PlayerEvent event ) { // do your event handling } });
...you see why the groovy syntax is preferable. It hides a lot of stuff and gives you more local context. But which is it you want, Java or groovy? Your question was a bit confusing. And anyway, you can do both. In groovy: on([playerJoined]) { type, event -> // call some Java code MyClass.doMyStuff(things, my, stuff, needs); }
|
|
|
Logged
|
|
|
|
pspeed
|
|
« Reply #6 on: July 13, 2013, 12:46:47 AM » |
|
Also, I want to mention that this version: on([playerJoined])
...is really for adding a hook to multiple events at the same time. This is why it takes a list: [playerJoined]
You can also just call: on( playerJoined )
...if you only have one event type your are registering for.
This is one part that I've implemented in the new engine and it's still exactly the same.
|
|
|
Logged
|
|
|
|
Michael
Donators
Hero Member
Posts: 2166
|
|
« Reply #7 on: July 13, 2013, 10:30:17 AM » |
|
Oh thank you Paul, that enlightens me more upon this
|
|
|
Logged
|
|
|
|
Michael
Donators
Hero Member
Posts: 2166
|
|
« Reply #8 on: July 21, 2013, 08:49:26 PM » |
|
Along with the enlightenment, I now know what "type, event ->" is
|
|
|
Logged
|
|
|
|
Michael
Donators
Hero Member
Posts: 2166
|
|
« Reply #9 on: August 04, 2013, 08:16:25 PM » |
|
YES! I finally got a script working in java for a mod!!
|
|
|
Logged
|
|
|
|
Michael
Donators
Hero Member
Posts: 2166
|
|
« Reply #10 on: August 06, 2013, 11:17:30 AM » |
|
I really want to work on this plugin I am going to use as a tool for all server owners, and I will continue to update it once it first gets out, but I am doing testing with it, and with this code, ServerEvent is a raw type, and I didn't know what that is. So of course, did some researching, and since <?> is known as a wildcard I tried using it, but it just tells me to change addListener(EventType, EventListener) to removeListener(EventType, EventListener) and I don't know why: EventDispatcher.getInstance().addListener(ServerEvents.serverStarted, new EventListener<ServerEvent<?>>() { @Override public void newEvent(EventType<ServerEvent<?>> type, ServerEvent<?> event) { System.out.println("\nServer Startup Test\n"); } });
|
|
« Last Edit: August 06, 2013, 11:24:16 AM by Shzylo »
|
Logged
|
|
|
|
pspeed
|
|
« Reply #11 on: August 06, 2013, 12:36:20 PM » |
|
Wildcards were not meant to be used in this way. Just leave the <?> out completely and it should work, I think.
|
|
|
Logged
|
|
|
|
Michael
Donators
Hero Member
Posts: 2166
|
|
« Reply #12 on: August 06, 2013, 05:52:55 PM » |
|
Its working capability is negative..
|
|
|
Logged
|
|
|
|
pspeed
|
|
« Reply #13 on: August 06, 2013, 09:56:41 PM » |
|
Its working capability is negative..
The latest code and error message look fine from here.
|
|
|
Logged
|
|
|
|
Michael
Donators
Hero Member
Posts: 2166
|
|
« Reply #14 on: August 06, 2013, 11:02:47 PM » |
|
Its working capability is negative..
The latest code and error message look fine from here. __ . .| ?-? Paul, I'm reaching out to you Its raw type just doesn't work, I can switch everything over to a playerJoined event, when the player joins I get a message, serverStarted doesn't work, are you running on "latest code" as code that isn't from the 20120627 build?
|
|
|
Logged
|
|
|
|
|