Discussion in 'Plugin Development' started by Dubzay, Jun 26, 2015.
I have a plugin but I was wondering how in the world do you update it?
depends, what's broken?
You use an updated bukkit jar in place of the old one. If some of the code seems to have errors or if things are out of date, update you code.
Send me the code of the plugin.
Or if it isn't your's, send me the plugin.
@Dubzay @justin_393 @Epicballzy @xXCapzXx
Could he mean auto-update as soon as a new version is out?
maybe, but I don't think that's the case.
I think it is broken and maybe some code isn't compatible anymore.
And it needs to be updated to 1.8. Maybe that is the case.
Would be nice if we had the OP's input, but yes that makes sense.
This question is just as important. Some plugins don't even need to be updated. I wrote many plugins on the 1.7 API and had no worries of it breaking on 1.8.
What about Bukkit.getOnlinePlayers() returning a Collection<? extends Player> instead of Player in 1.8 ??
It was a couple of errors but this really helped, thanks
I don't worry about that because I only use those in for-each loops which can handle both.
No. When you compile your code it knows the method name it accesses and its return type
Works perfectly fine for me. All I do is access it in a for loop. Never had any issues.
Yes, but the new return type still works in a fit loop, as long as that's the only time you're using it.
Well actually, what do you mean by it knows the return type? Are you saying that somewhere it's stored what the method returns other than in the API code?
Exactly. I tried my 1.7.2 plugin where I accessed Bukkit.getOnlinePlayers() and got a MethodNotFoundException or something like that on a 1.8 Server. https://www.spigotmc.org/threads/get-online-players-count-in-both-1-5-2-and-1-8.54819/ It is possible to avoid that using reflections :|
EDIT: Nested looping over it is ok but .length vs .size() or setting it to a variable can be a huge problem
@FisheyLP Was the Player method removed? I recall using a player array in v1_7_R4 (The one that had both methods, but one was deprecated) and everything worked fine.
in 1.8 the method return type changed to Collection<? extends Player>
@FisheyLP That happened since 1.7.10 (v1_7_R4), but since both methods were kept (the one with Collection and the one with Player) compatibility was not a problem.
in bukkit both methods were kept
Separate names with a comma.