Posted September 3, 201510 yr So, I'm making a powers mod, adding timers to the player for cooldowns, power effects, use times, etc. I found that on death, many of these stats I will want to perserve, such as learned powers. The only problem is that when I copy the data over on a PlayerEvent.CloneEvent, and send the refreshed data back to the client, my message to synchronize arrives before the client receives notice of the clone event, which means my data quickly gets reset. To avoid having to constantly send synchronizing data to the client, I tried to make a central data center that holds this extra NBT data for both sides. My problem is that is works too well, and both sides are sharing the same object, making both sides use the same cooldowns. I tried separating them, but it seems impossible. On integrated server, it's always the client data center that exists, and on dedicated server, it's using the server side one. Either way, it's weird and undesirable. Is there a way I can fix this, or at least get around it? Here's the DataWrapper I made that has the extra data: https://github.com/Himself12794/powersAPI/blob/develop/src/main/java/com/himself12794/powersapi/util/DataWrapper.java Here's my data center: https://github.com/Himself12794/powersAPI/blob/develop/src/main/java/com/himself12794/powersapi/util/DataHandler.java And my proxies: https://github.com/Himself12794/powersAPI/tree/develop/src/main/java/com/himself12794/powersapi/proxy Any advice or help is appreciated, thanks in advance! With all due respect, sir: I do, what I do, the way I do it. ~ MacGyver
September 3, 201510 yr Author Uhm, wat, ohgodwhy and etc. You are reinventing the wheel. IExtendendEntityProperties is a thing, much safer than whatever hackery you aer using at the moment. Your issue is that you are executing all your packet code on the netty thread. Read the warning message here. That bad, huh? When I realized what was happening, I knew I must have been doing something horrific. The inability run things on the netty thread really answers a lot of things for me. Also, I actually did learn about IExtendedEntityProperties, but they don't appear to persist on death, so that's why I have not been using them. Athough the revelation of SimpleImpl use should allow me to now synchronize that information correctly with that interface. On a not completely unrelated note, is there a way to receive a response from message back onto the stack from where it was sent? For me to do that, I've been doing something that I can't help but think is a terrible travesty. I've never stopped looking for a better way, but for me this is all I've been able to come up with. I send a message to the server here: https://github.com/Himself12794/powersAPI/blob/develop/src/main/java/com/himself12794/powersapi/power/PowerInstant.java#L35 And require feedback here: https://github.com/Himself12794/powersAPI/blob/develop/src/main/java/com/himself12794/powersapi/power/PowerInstant.java#L42 To try to send a message I handle this way: https://github.com/Himself12794/powersAPI/blob/develop/src/main/java/com/himself12794/powersapi/network/CastPowerInstantServer.java And then try to not think about what I've just done. Running my responses as a Runnable task will break that little process, I imagine. Is there a simple way to do that, or do I need to restructure my entire way of casting powers? With all due respect, sir: I do, what I do, the way I do it. ~ MacGyver
September 3, 201510 yr Author You can make IEEP persist by the same means you are making yours persist now: PlayerEvent.Clone. In there just copy over the data from the old player to the new. Oh hell yes. I now love the IEEP interface. It makes all of my intricate and complicated code unnecessary. Thanks a lot! Any time I can remove that much code from my project and still have it work the same, even better, is always awesome. With all due respect, sir: I do, what I do, the way I do it. ~ MacGyver
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.