Easier variable syncing #3

Closed
opened 2020-11-15 12:56:38 +00:00 by GovindasOM · 2 comments
GovindasOM commented 2020-11-15 12:56:38 +00:00 (Migrated from github.com)

Convert this skript-reflect code to Java:

#
#SERIALIZE/DESERIALIZE
#
import:
    java.util.Base64
    ch.njol.skript.registrations.Classes

function getSerialized(o: object) :: string:
    set {_s} to Classes.serialize({_o})
    set {_b} to Base64.getEncoder().encodeToString({_s}.data)
    set {_out} to "%{_s}.type%-|-%{_b}%"
    return {_out}

function getDeserialized(i: string) :: object:
    set {_parse::*} to {_i} parsed as "%string%-\|-%string%"
    {_parse::*} is set
    return Classes.deserialize({_parse::1},Base64.getDecoder().decode({_parse::2}))

and make syntax out of it:

send variable "variablename" with data {anythinghere} to channel "server1"

make on redis message event to not trigger for this and the variable to be simply just set on that server

Convert this skript-reflect code to Java: ``` # #SERIALIZE/DESERIALIZE # import: java.util.Base64 ch.njol.skript.registrations.Classes function getSerialized(o: object) :: string: set {_s} to Classes.serialize({_o}) set {_b} to Base64.getEncoder().encodeToString({_s}.data) set {_out} to "%{_s}.type%-|-%{_b}%" return {_out} function getDeserialized(i: string) :: object: set {_parse::*} to {_i} parsed as "%string%-\|-%string%" {_parse::*} is set return Classes.deserialize({_parse::1},Base64.getDecoder().decode({_parse::2})) ``` and make syntax out of it: send variable "variablename" with data {anythinghere} to channel "server1" make on redis message event to not trigger for this and the variable to be simply just set on that server
GovindasOM commented 2020-11-25 15:08:17 +00:00 (Migrated from github.com)

almost finished, I just want to make it use {variablename} first instead of "variablename" before release

almost finished, I just want to make it use {variablename} first instead of "variablename" before release
GovindasOM commented 2020-11-28 08:42:40 +00:00 (Migrated from github.com)

done

done
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Limework/RediSkript#3
No description provided.