Skip to content

Instantly share code, notes, and snippets.

class EventManager {
private static final ReentrantLock mutex = new ReentrantLock();
//Oh the abuse!!!
private static Object currentEvent = null;
//If this is called from within the subscription to an event... than no matter how much mapping you have done...
//This should still be the event you are listening to... which you can promptly cancel
//or get more data from for more complex maps.
public static <Event> event() {
return (Event) currentEvent;
public interface Scoreboard {
/**
* @param line - The text to display on the new line, 64 characters max.
* @param score - The score value to give the new line.
*/
void set(Object line, int score);
/**
* Removes the line with the given score.
interface Builder {
interface Buffer<Return> extends Output<Return> {
Return __build(OutputStream err,
OutputStream out,
boolean redirect,
Number buffer) throws IOException;
@Override
default Return __build(OutputStream err,
OutputStream out,
interface Builder {
interface Buffer<Return> extends Output<Return> {
Return __build(OutputStream err,
OutputStream out,
boolean redirect,
Number buffer) throws IOException;
@Override
default Return __build(OutputStream err,
OutputStream out,
interface Builder {
interface Buffer<Return> extends Output<Return> {
Return __build(OutputStream err,
OutputStream out,
boolean redirect,
Number buffer) throws IOException;
@Override
default Return __build(OutputStream err,
OutputStream out,
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
package com.penzzly.engine.core.mini.worlds;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.world.WorldLoadEvent;
import org.bukkit.plugin.Plugin;
private CommandLine(String command,
OutputStream err,
OutputStream out,
boolean redirect,
int buffer) throws IOException {
this.buffer = buffer;
executor = newFixedThreadPool(redirect ? 1 : 2);
process = new ProcessBuilder(command)
public class CommandLine implements Closeable {
private static final String RETURN = "\n";
private static final byte[] RETURN_DATA = RETURN.getBytes();
private final ExecutorService executor;
private final int buffer;
private final Process process;
private Closeable out, err;
interface Builder {
interface Buffer<Return> extends Output<Return> {
public class TeamsTabList implements TabList {
private static final String BLANK = repeat("s", 16);
private static final String BLANK_P = repeat("p", 16);
//TODO the whole updates vs tablist thing seems ugly... maybe best to do it another way.
private final Set<PlayerInfoData> tabList = new HashSet<>(80);
private final Set<PlayerInfoData> updates = new HashSet<>();
private final Set<Player> players = new HashSet<>();
private final TeamEntry[] entries;
//TODO this certainly doesn't seem ideal... maybe use updates instead somehow?
private final boolean[] set = new boolean[80];