Giter Site home page Giter Site logo

atom's Introduction

Atom

Simplifies Bungeecord's plugin messaging API.

Get Started

To get started receiving messages, you'll need to start by creating a new instance of the Atom class. You should only ever do this once.
Here's an example:

import com.seailz.atom.Atom;
...

@Override
public void onEnable() {
    Atom atom = new Atom(this);
}

Receiving Messages

You can now start registering listeners. Like Bukkit's listener system, you'll first want to start by creating a new class that extends AtomListener.

import com.seailz.atom.events.AtomListener;

public class ExampleClass extends AtomListener {

}

From there, you can override the onMessageReceived method.

@Override
public void onMessageReceived(ChannelMessageEvent event) {

}

You'll also need to add the AtomMethod annotation to the method. That annotation also has a utility that allows you to require a specific sub-channel name for the method to run. For example:

@Override
@AtomMethod(channel = "testSubChannel")
public void onMessageReceived(ChannelMessageEvent event) {

}

This onMessageReceived method will only run when the sub-channel is "testSubChannel". One other thing you'll need to do is register your listeners. This can be done using the Atom class instance that you created earlier. Here's an example:

@Override
public void onEnable() {
    Atom atom = new Atom(this);
    atom.registerListener(new ExampleClass());
}

Sending Messages

You can send messages using the Atom instance that you created earlier. The Atom class has a couple sendMessage methods that you can use. Here's a couple examples:

// Send a message that isn't linked to a player.
atom.sendMessage("exampleSubChannel", "Hello! This is an example message");

// Send a message that is linked to a player.
Player player = ...;
atom.sendMessage("exampleSubChannel", "Hello! This is an example message", player);

Project License

License info can be found here. This project is licensed under GNU General Public License V3.

Support me :)

Ghsponsors Singular badge

atom's People

Contributors

dependabot[bot] avatar seailz avatar skylar11d avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

skylar11d

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.