12.11.2015, 14:49
(
Последний раз редактировалось dusk; 12.11.2015 в 18:53.
)
Quote:
@valych:
@dusk: The SampNativeFunction class is located in shoebill-launcher and should not be used. This is internal code only. |
1.Why doesn't the Player override Equals method? I don't even know what's the default comparator in Java. But I believe it is neccessary, I mean all collections use it, right?
2.What about timers. Are Java timers(util.timer) safe to use? AFAIK they run on their own thread. So if I start something from the main thread(I assume that its also Pawn thread) won't it interrupt it since it's not calling the runOnSampThread method?
I'll probably stick to Shoebill timers, I just find it interesting and would love to hear the answer.
3. What happens if I dispatch an event from a different thread?
Quote:
@dusk, thanks a lot
@mk124, thanks for reply. But what about the first question? The thing is, I have already written gamemode from scratch (by myself) in pawn and I dont have any desire to rewrite it again (also it will take a lot of time). I want to continue the development of the gamemode in java and sometimes will rewrite old pieces of code from pawn to java. How can I start the server with pawn and java gamemode in parallel? |
Instead of using the shoebill gamemode (bare.amx) use your own. Just add the shoebill filterscript(base.amx) to server.cfg. That way, the Java side of your gamemode will still work(I believe both the FS and GM do the same). Just be careful about callbacks such as OnDialogResponse in your Pawn code, if you return something other then 0 there, that means it won't be passed to other scripts, i.e. the shoebill FS and that means you won't be able to use it in you Java code.
In other news, I can't make the Pawn function calling from Java work.
My code:
Код:
AmxCallable getPos = getNativeMethod("AFunction"); int value =(Integer)getPos.call();
Код:
public static AmxCallable getNativeMethod(String name) { AmxCallable nativeMethod = null; for(AmxInstance instance : Shoebill.get().getAmxInstanceManager().getAmxInstances()) { if((nativeMethod = instance.getNative(name)) != null) break; } return nativeMethod; }
Код:
forward AFunction(); public AFunction() { return 1; }
Crash update: seems to be fixed by using AmxInstances getPublic instead of getNative method.