LogBlock Compatibility

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Mr_Simba

King of the Pridelands
Supporter
Dec 9, 2016
256
56
0
28
In case this seems familiar, yes I suggested this once before, but it was a long time ago and on the old forums so it has been lost. I'm not sure who would be most fitting for this, @Sharpjaws you have CoreProtect and a lot of other plugin compatibilities so it may fit into SharpSK. I'm not picky though about who adds support for it of course, anyone who can get to it would make me super happy!

The main thing any dev would need for this is LogBlock's consumer. An example of an external plugin logging stuff with LogBlock can be found here. You get LogBlock from the server and call getConsumer on it, then use the consumer to queue block changes. If you don't want to have it as a harder dependency by needing to include its Actor class, you can use the lower down functions which instead accept a string playerName in place of an actor.

Examples of main potential syntax:

code_language.skript:
queue logblock block (break|place|replace) from %player% at %location% [with [previous block %itemstack% and new] block %itemstack%][/CODE=SKRIPT]

The optional part would be ignored for breaks, but would be used in the "place" and "replace" options. The "previous block %itemstack% and new..." would be used for replaces, since replace takes an old block and new block. So e.g. if we want right clicking on dirt to turn it into a pumpkin and LogBlock to recognize that they did that, we could so:

[CODE=SKRIPT]on right click on dirt:
    set clicked block to pumpkin
    queue logbock replace from player at clicked block's location with previous block dirt and new block pumpkin

Which for example could be running this queueBlockReplace overload behind the scenes:
code_language.skript:
queueBlockReplace(String playerName, Location loc, int typeBefore, byte dataBefore, int typeAfter, byte dataAfter)

Hopefully that explains it pretty well. There are even more options in the consumer, but we can already log kills by using 'make damage', so it's mainly just blocks that need support.
 
@Mr_Simba It has been noted. :emoji_grin: I will be looking into it as soon as i can.
As always all my progress can be followed on my github if you want to see my development on the logblock implementation when I'm on it.