BitsAPI  | SQL icon

BitsAPI | SQL -----

A minecraft currency system via sql



Gradle
Code (Text):
repositories {
    maven { url('https://byncing.eu/repository/') }
}

dependencies {
    implementation('eu.byncing.minecraft:bits-api:1.0.0-SNAPSHOT')
}

Unbenannt.png


Code (Java):
@EventHandler
public void handle (PlayerJoinEvent event ) {
    Player player = event. getPlayer ( ) ;

    BitsAPI instance = BitsAPI. getInstance ( ) ;
    if (instance. existsUser (player. getUniqueId ( ) ) ) return ;
    IBitsUser user = instance. getUser (player. getUniqueId ( ) ) ;

    user. addBits ( 50 ) ;
    //Update bits in a pool
    user. update ( true ) ;

    player. sendMessage ( "Your bits: " + user. getBits ( ) ) ;
}

You can also use the api for the proxy the plugin does not have to be in the plugins folder but in the project.
Code (Java):
@Override
public void onEnable ( ) {
    BitsAPI. getInstance ( ). connect ( 3, new Profile ( "127.0.0.1", 3306, "root", "byncing", null ) ) ;
}
@Override
public void onDisable ( ) {
    BitsAPI. getInstance ( ). disconnect ( ) ;
}

The player is registered in the database because it does not exist, but the spigot does it automatically!
Code (Java):
@EventHandler
public void handle (PostLoginEvent event ) {
    ProxiedPlayer player = event. getPlayer ( ) ;
    BitsAPI instance = BitsAPI. getInstance ( ) ;
    if ( !instance. existsUser (player. getUniqueId ( ) ) ) {
        instance. addUser (player. getUniqueId ( ), player. getName ( ) ) ;
    }
}
Resource Information
Author:
----------
Total Downloads: 77
First Release: Nov 23, 2021
Last Update: Nov 23, 2021
Category: ---------------
All-Time Rating:
0 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings