Aprilon http://aprilon.org/forum/ |
|
A bit of HALP. http://aprilon.org/forum/viewtopic.php?f=6&t=2336 |
Page 1 of 1 |
Author: | |LorD| Kiraly [ 14 Aug 2012, 22:38 ] |
Post subject: | A bit of HALP. |
Hi, i know it's been a while, but i started making bukkit plugins, and i have a list of things i cannot figure out. So, i thought this would be the best place to ask. First of all: How can i make player-independent classes? Like, if i set them ALL in the main class, if one users toggles something, it toggles for ALL users, but i want them independent. An example with toggleing would be nice. Second: I cannot get player listeners to work, i mean onPlayerMove() or onPlayerJoin() simply does not react. I implemented the Listener thing, as well as @EventHandler. Still does not do the job. Third: Run methods from args. What i mean, i have a command. Like /hello. If i add if(args[0]==command){SOMETHINGHERE(args[0]; return true;)}} it skips this part and goes straight to the next thing Any help is appriciated. Thank you. |
Author: | ManIAc [ 16 Aug 2012, 16:05 ] |
Post subject: | Re: A bit of HALP. |
As far as I know, the way to solve problem 1, is to have an array that keeps track of which player has enabled what. So make a Map or something, and then every time a player tries to do something, you can test if he's "allowed" to do that. I'm by far not the most experienced in this, but that would be how I would do it. As for 2, might want to post some source code, unless someone else has an idea. 3, I don't think I understand what your problem is? Could you explain it in more detail? |
Author: | |LorD| Kiraly [ 18 Aug 2012, 19:06 ] |
Post subject: | Re: A bit of HALP. |
Well, thanks for the replies, but now i pretty much solved all of those things. Now, the other issue i encounter is a plugin which repeats every single event twice, for some reason. Here is my source code:
|
Author: | Bloody [ 18 Aug 2012, 19:24 ] |
Post subject: | Re: A bit of HALP. |
You mean the weather events onRainStart and onRainStop both fire at the same time? You'r not checking if the weather actually changed to thunderstorm or changed to sunny. They are both WeatherChangeEvent's so they both get called. If you just wan't to check if something is in an (Array)List<T> use .contains. Code: boolean weather=false;//<- FALSE = storm Dat codingstyle.
|
Author: | ManIAc [ 18 Aug 2012, 21:23 ] |
Post subject: | Re: A bit of HALP. |
Blood, stop being an arse and let him use whatever syntax he wants. There are certain "rules", but it's funny that every programmer still does it however he wants. |
Author: | Bloody [ 18 Aug 2012, 21:34 ] |
Post subject: | Re: A bit of HALP. |
ManIAc wrote: There are certain "rules", but it's funny that every programmer still does it however he wants. Of course but once you start using distributed SCMs and collaborate with other developers you need to decide on a coding style everyone uses, in which case readability (C-Style) usually beats speed/lazyness. It's easier to 'weed it out' now than to be booted off a project because "suddenly" your code is unreadable by others. Take it as a "heads up". |
Author: | ManIAc [ 19 Aug 2012, 09:52 ] |
Post subject: | Re: A bit of HALP. |
Of course, but usually when you do projects, you agree on a standard rather than use best practice, since they might be doing stuff differently from the standard, because it fits them better, and then you need to adapt to them, not the other way around. But of course I agree with you, I just like to be cross. |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |