Skip to content

seailz/Atom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Simplifies Bungeecord's plugin messaging API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages