Git Product home page Git Product logo

skcoapi's Introduction

SkCoAPI

Overview

SkCoAPI is an adapter of CoreProtect API v9 for Skript.

Refer CoreProtect API v9 Documentation for information of each Java method.

Minimum Supported Versions

  • Java: 11
  • Spigot: 1.15 R0.1
  • Skript: 2.6.4
  • CoreProtect: 22.1

Documentation

SkriptHubViewTheDocs Get on skUnity

Examples

  • Get the last 24 hours of block data for endermans.
lookup action logs in 24 hours for "##enderman":
    set {_lookup::*} to results
send {_lookup::*}

  • Get the last 24 hours of block data for endermans excluding dirt and grass blocks.
set {_exclude::*} to grass and dirt
lookup action logs in 24 hours for "##enderman" except on {_exclude::*}:
    set {_lookup::*} to results        

  • Add "'s hand" to usernames when logging.
on CoreProtect logging:
    set user name to "%user name%'s hand"

  • When a player executes the command /lookup, the player sees the last 30 days of block data within 5 blocks of their location.
command /lookup:
executable by: players
trigger:
    lookup logs in a month in radius 5 at location of player:
        set {_lookup::*} to results
    send "Lookup results:" to player
    send {_lookup::*} to player

  • When a player executes the command /inspect, the player sees the 30 days of block data on the block they are looking at.
command /inspect:
    executable by: players
    trigger:
        set {_logs::*} to lookup logs on target block of player in a month
        loop {_logs::*}:
            set {_log} to loop-value
            set {_user} to player name of {_log}
            set {_action_id} to action id of {_log}
            if {_action_id} is 0:
                set {_action} to "broke"
            else if {_action_id} is 1:
                set {_action} to "placed"
            else if {_action_id} is 2:
                set {_action} to "interacted with"
            set {_type} to block type of {_log}
            set {_age} to difference between now and date of {_log}
            if {_log} is rolled back:
                send "&m%{_user}% %{_action}% %{_type}% %{_age}% ago" to player
            else:
                send "%{_user}% %{_action}% %{_type}% %{_age}% ago" to player

  • When executing the command /sessions, get the last 1-day session data for the specified user.
command /sessions <text>:
    trigger:
        set {_lookup::*} to lookup sessions for arg-1 in a day
        send {_lookup::*} to sender

  • When a player executes the command /extinguishedcampfire, place a block with a block data minecraft:campfire[lit=false] to the location of the player, and log the placement of the block.
command /extinguishedcampfire:
    executable by: players
    trigger:
        set {_block} to campfire[lit=false]
        set block at player to {_block}
        log that player's name placed {_block} at location of player

  • When a player executes the command /takeall, move items from a container block to the inventory of the player, and log that they removed items from the container.
command /takeall:
    executable by: players
    trigger:
        set {_block} to target block of player
        send "&aTaking items from %{_block}%" to player
        loop all items in the inventory of {_block}:
            if player cannot hold loop-item:
                send "&cStopped taking items because your inventory is full!" to player
                stop
            give loop-item to player
            remove loop-item from the inventory of {_block}
            log that player's name made a transaction to a container at location of {_block}

  • A function which returns true if the user has already placed the block within the specified time.
function has_placed(p: string, b: block, t: timespan) :: boolean:
    if {_p} has placed {_b} in {_t}:
        return true
    else:
        set {_lookup::*} to lookup queue on {_b}
        loop {_lookup::*}:
            set {_action} to action id of loop-value
            if {_action} is 1:
                set {_name} to player name of loop-value
                if {_name} is {_p}:
                    return true
    return false

License

The source files are distributed under Apache 2.0. Detail information is in LICENSE.

skcoapi's People

Contributors

takejohn avatar

Stargazers

ringoXD avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.