Giter VIP home page Giter VIP logo

spijetapi's Introduction

logo

SpiJetAPI - (1.8.8 - 1.18)

An API Which contains all the small things I use in my Projects. It adds lots of abstraction to the plain Spigot API resulting in rappid development.

Examples:

SQL

//SQL connections
DataSourceBuilder dsb = new DataSourceBuilder();
dsb.setUsername("Simpsons")
        .setJdbcUrl("jdbc:mysql://127.0.0.1:3306/simpsons")
        .setPassword("S1mp50ns!");

HikariDataSource hds = dsb.build();

//Query Something
SQLQueryBuilder sqb = new SQLQueryBuilder("SELECT * FROM simpsons WHERE name=? AND age=?;");
sqb.setParameters("Homer", 42);

//Query sync
CachedRowSet crs = sqb.executeQuery(hds);
//Query async
CompletableFuture<CachedRowSet> future = sqb.executeQueryAsync(hds);

Particles

Particles are supported in multiple versions where the particle is either Particle. or Effect..

//Gets you the right wrapper for your version
ParticleWrapper particleWrapper = ParticleUtils.getWrapper();

//Create 100 particles at the location of the player in the shape of a sphere with the radius of 2 for all players
particleWrapper.createSpherical(Particle.REDSTONE, player.getLocation, 100, 2, 2, 2);

GUI-API

The "normal" ways to create GUIs is often based on slot and/or string comparison of the item used as a button and the InventoryClickEvent. This GUI-API aims to connect the events and the creation of the API to create GUIs easier.

InventoryGui gui = Gui.inventory();
gui
 .setSize(Gui.rowsToSlots(3))
 .setGUITitle("My First GUI!");
Button button = new Button(this::action); //This function (this::action) is called on click
button
 .setSlot(13) //Define the position of the button
 .setMaterial(Material.PAPER) //Define the material
 .setTitle("Click me!"); //Set the name
gui.addWidget(button); //Add the button to the gui
gui.open(player); //open the gui as inventory

That's all no need to check stuff. No need to register listeners.

Configurations

The configuration utility of this plugin support JSON and YAML configs

File ymlConfig = new File(getDataFolder(), "config.yml");
File jsonConfig = new File(getDataFolder(), "config.json");

//load data
//Get yml config write default if not exist (can be any java bean class)
MyOptionClass myOptionClass = ConfigUtils.load(ymlConfig, MyOptionClass.class, new MyOptionClass());

//Get json config write default if not exist (Can be any kind of data class) 
MyOptionClass myOptionClass = ConfigUtils.loadJson(jsonConfig, MyOptionClass.class, new MyOptionClass());

//Save data
//Save yml data
yamlConfiguration.save(ymlConfig, myOptionClass);

//Save json data
ConfigUtils.saveJson(jsonConfig, myOptionClass);

spijetapi's People

Contributors

worldoneo 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.