Mythruna
March 28, 2024, 12:12:34 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome to the new forums. See "Announcements" for a note for new users.
 
   Home   Help Search Login Register  
Pages: 1 [2] 3 4 5
  Print  
Author Topic: Paul, API: Info/Allow Suggestions?  (Read 49359 times)
Michael
Donators
Hero Member
***
Posts: 2166



View Profile
« Reply #15 on: August 06, 2013, 11:46:00 PM »

Also, I was thinking for quite some time, have you implemented configuration files? If you haven't, will you please do to provide users with easily creating a default configuration file and stuff, or at least part-way? I'm not sure if you are spiffy (not sure if that was the best word to use) or not about it because I am not sure how you are exactly going about plugin configurations..

if you are thinking about implementing configuration files, I would like to see some YAML (YAML Ain't Markup Language) put into it. If you aren't sure about how you would process it at all, or if you are too lazy to create your own version, visit the parser that Bukkit made for reference https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/configuration

if you don't plan on adding a default configuration, someone (gara or I, hencing the idea of anyone else Tongue) will probably make a library for it, or if you already have, GREAT!

@MythrunaGame please respond.

EDIT: I have been looking over that Bukkit YAML thing because I want to make my own parser because I want a config Tongue
« Last Edit: August 07, 2013, 12:11:25 AM by Shzylo » Logged
pspeed
Administrator
Hero Member
*****
Posts: 5612



View Profile
« Reply #16 on: August 07, 2013, 12:47:23 AM »

Its working capability is negative..

The latest code and error message look fine from here. Wink
__
. .|
?-?   Paul, I'm reaching out to you Tongue
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?

You totally missed what I was saying.  I cannot possibly ever even hope to debug code that I cannot see.  You've done something wrong with my advice and I can't see what.
Logged
pspeed
Administrator
Hero Member
*****
Posts: 5612



View Profile
« Reply #17 on: August 07, 2013, 12:48:22 AM »

Also, I was thinking for quite some time, have you implemented configuration files? If you haven't, will you please do to provide users with easily creating a default configuration file and stuff, or at least part-way? I'm not sure if you are spiffy (not sure if that was the best word to use) or not about it because I am not sure how you are exactly going about plugin configurations..

if you are thinking about implementing configuration files, I would like to see some YAML (YAML Ain't Markup Language) put into it. If you aren't sure about how you would process it at all, or if you are too lazy to create your own version, visit the parser that Bukkit made for reference https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/configuration

if you don't plan on adding a default configuration, someone (gara or I, hencing the idea of anyone else Tongue) will probably make a library for it, or if you already have, GREAT!

@MythrunaGame please respond.

EDIT: I have been looking over that Bukkit YAML thing because I want to make my own parser because I want a config Tongue

Scripts are configuration files.  So I have no idea what you mean.
Logged
Michael
Donators
Hero Member
***
Posts: 2166



View Profile
« Reply #18 on: August 07, 2013, 09:13:43 AM »

You totally missed what I was saying.  I cannot possibly ever even hope to debug code that I cannot see.  You've done something wrong with my advice and I can't see what.

This is code that I try to call when the server starts, but doesn't work.
Code:
public static void onServerStart() {
EventDispatcher.getInstance().addListener(ServerEvents.serverStarted, new EventListener<ServerEvent>() {
@Override
public void newEvent(EventType<ServerEvent> type, ServerEvent event) {
System.out.println("SERVER HAS STARTED");
}
});
}

Here is code that I call when a player joins, it works.

Code:
public static void onPlayerJoin() {
EventDispatcher.getInstance().addListener(PlayerEvents.playerJoined, new EventListener<PlayerEvent>() {
@Override
public void newEvent(EventType<PlayerEvent> type, PlayerEvent event) {
System.out.println("A PLAYER HAS JOINED");
}
});
}

I make sure that I am calling the correct method from my groovy runnable script.
Logged
Michael
Donators
Hero Member
***
Posts: 2166



View Profile
« Reply #19 on: August 07, 2013, 09:15:44 AM »

Scripts are configuration files.  So I have no idea what you mean.
I mean, when you have a plugin and it comes with MANY features, and people don't want all of the features of that plugin enabled, you will give them a configuration file to turn on/off certain features of that plugin, will you have that default for us, or will we have to make it ourselves?
Logged
pspeed
Administrator
Hero Member
*****
Posts: 5612



View Profile
« Reply #20 on: August 07, 2013, 09:34:50 AM »

Scripts are configuration files.  So I have no idea what you mean.
I mean, when you have a plugin and it comes with MANY features, and people don't want all of the features of that plugin enabled, you will give them a configuration file to turn on/off certain features of that plugin, will you have that default for us, or will we have to make it ourselves?

There will be a user interface for this so that you don't have to teach your "customers" configuration file tweaking.
Logged
pspeed
Administrator
Hero Member
*****
Posts: 5612



View Profile
« Reply #21 on: August 07, 2013, 09:35:54 AM »

This is code that I try to call when the server starts, but doesn't work.
Code:
public static void onServerStart() {
EventDispatcher.getInstance().addListener(ServerEvents.serverStarted, new EventListener<ServerEvent>() {
@Override
public void newEvent(EventType<ServerEvent> type, ServerEvent event) {
System.out.println("SERVER HAS STARTED");
}
});
}

"doesn't work" as in:
-nothing happens?
-crashes your computer?
-crashes the app?
-gives an error message?

...if it's the last one then I need the error message.

Helpful information is helpful. Smiley
Logged
Michael
Donators
Hero Member
***
Posts: 2166



View Profile
« Reply #22 on: August 07, 2013, 09:58:50 AM »

Heh, sorry, its this:
problem[0] = "Nothing Happens";
Logged
pspeed
Administrator
Hero Member
*****
Posts: 5612



View Profile
« Reply #23 on: August 07, 2013, 10:07:58 AM »

Heh, sorry, its this:
problem[0] = "Nothing Happens";

Then put some printlns in to see if any of the code is even being run.... on the groovy side, on your code that works, on your code that doesn't work, etc... put them all over the place.  But especially in your onServerStart().
Logged
Michael
Donators
Hero Member
***
Posts: 2166



View Profile
« Reply #24 on: August 07, 2013, 10:16:48 AM »

This is my groovy class that runs it (Runnable.init.groovy):
Code:
import me.shzylo.<not for you to see>.*

println "<description : NOT FOR YOU TO SEE>"
println "v0.1 @author Shzylo"

on([serverStarted]) {
println "gTest"
<Not for you to see>.onServerStart()
}

and here is my java code:
Code:
@SuppressWarnings("rawtypes")
public static void onServerStart() {
System.out.println("jTest 1");
EventDispatcher.getInstance().addListener(ServerEvents.serverStarted, new EventListener<ServerEvent>() {
@Override
public void newEvent(EventType<ServerEvent> t, ServerEvent e) {
System.out.println("jTest 2");
}
});
}

This is the console:
Quote from: SERVER_CONSOLE
gTest
jTest 1

it stops somewhere within the EventDispatcher, and I put Sysout where ever I was able to.
Logged
pspeed
Administrator
Hero Member
*****
Posts: 5612



View Profile
« Reply #25 on: August 07, 2013, 12:09:22 PM »

Well, you aren't even registering your custom server started listener until the server is already started.

-Server starts.
-your on(serverStarted) code is called
-it calls your java code
-instead of actually doing the server started stuff it registers an event for server started which has already happened
Logged
Michael
Donators
Hero Member
***
Posts: 2166



View Profile
« Reply #26 on: August 07, 2013, 12:21:13 PM »

Well, you aren't even registering your custom server started listener until the server is already started.

-Server starts.
-your on(serverStarted) code is called
-it calls your java code
-instead of actually doing the server started stuff it registers an event for server started which has already happened
That's quite strange, because it works in groovy, it should continue to pass it on, no? There are a bunch of things that I am trying to do in java when it will be much easier/possible just to do it in groovy, but I am very arrogant at times Tongue
Logged
pspeed
Administrator
Hero Member
*****
Posts: 5612



View Profile
« Reply #27 on: August 07, 2013, 12:34:55 PM »

Well, you aren't even registering your custom server started listener until the server is already started.

-Server starts.
-your on(serverStarted) code is called
-it calls your java code
-instead of actually doing the server started stuff it registers an event for server started which has already happened
That's quite strange, because it works in groovy, it should continue to pass it on, no? There are a bunch of things that I am trying to do in java when it will be much easier/possible just to do it in groovy, but I am very arrogant at times Tongue

I think you have completely misunderstood what I'm saying and/or your own code.

on( [serverStarted] ) registers a section of code that runs WHEN AN EVENT IS FIRED.  Not during startup.  Not when that script is run.  But when that event happens.  In this case, when the server starts.

EventDispatcher.getInstance().addListener(ServerEvents.serverStarted...) does exactly the same thing.  The code you register as a listener won't be run until the serverStarted event has fired.

So, if you don't register your listener until DURING the server started event then there will never be a serverStarted event after that to cause it to fire.  Plus, it's redundant since you are ALREADY RUNNING in a serverStarted event.

So just do this:
Code:
public static void onServerStart() {
System.out.println("jTest 1");
        System.out.println("jTest 2");
}

Where System.out.println("jTest 2") is the code you actually want to run when the server starts.

Alternately, if you really have your heart set on registering a callback the hard way, you can just stop registering the event on the groovy side and run your code directly.

Code:
import me.shzylo.<not for you to see>.*

println "<description : NOT FOR YOU TO SEE>"
println "v0.1 @author Shzylo"

println "gTest"
<Not for you to see>.onServerStart()

The first way is easier and less boilerplate code for you to write.
Logged
pspeed
Administrator
Hero Member
*****
Posts: 5612



View Profile
« Reply #28 on: August 07, 2013, 12:37:27 PM »

Put another way, you've called the front desk for a wakeup call at 6:30 AM on Wednesday... and then when they call you at 6:30 AM on Wednesday you then call them again for another wakeup call at 6:30 AM on the same Wednesday.

...not very effective.
Logged
Michael
Donators
Hero Member
***
Posts: 2166



View Profile
« Reply #29 on: August 07, 2013, 01:06:19 PM »

Enlightenment's and more enlightenment's.. thank you for the lessons Smiley
Logged
Pages: 1 [2] 3 4 5
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!