Skip to content

Instantly share code, notes, and snippets.

@riftrsps
riftrsps / Buff.java
Last active August 24, 2019 18:58
Buff Package for MineCraft Server API
public class Buff {
private final String name;
private final int baseRadius;
private int currentRadius;
private boolean global;
public Buff(String name, int radius, boolean global) {
this.name = name;
this.baseRadius = radius;
this.currentRadius = radius;
// each variousSettings index represents the bits for either a varbit or a varp
Client
int[] variousSettings = new int[2000];
// a VarBit's index is used to access variousSettings
// lsb is where to start reading bits
// msb is where to stop reading bits
VarBit
static Varbit[] cache;
int index;
@riftrsps
riftrsps / Launcher.java
Last active August 24, 2019 19:01
Main Package
package main;
import api.YourAPI;
class Launcher extends JavaPlugin {
private YourAPI api;
@Override
public void onEnable() {
api = new YourAPIV1(this);
@riftrsps
riftrsps / Group.java
Last active August 24, 2019 18:56
Util Package for MineCraft server API
package api.util;
class Group<T> implements Iterable<T> {
private final Map<String, T> items;
public Group(Map<String, T> items) {
this.items = items;
}
public Group() {
package api.quest;
public class QuestModule implements Listener {
private final QuestManager manager;
private final YourAPI api;
public QuestModule(YourAPI api) {
this.api = api;
this.manager = new QuestManager(api);
}
@riftrsps
riftrsps / Quest.java
Last active August 24, 2019 18:58
Quest Package for MineCraft server API
package api.quest;
public class Quest {
private final String name;
private int progress;
public Quest(String name) {
this.name = name;
}
import java.util.*;
import java.util.function.*;
import java.io.*;
class Main {
public static void main(String args[]) {
BuffGroup group = new BuffGroup();
group.add(new MobBonusXPBuff(10));
Buff buff = group.get(MobBonusXPBuff.class);
@riftrsps
riftrsps / Item.java
Created September 1, 2019 02:11
Item Price Parser
class Item {
private final int id;
Item(int id) {
this.id = id;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
@riftrsps
riftrsps / Main.java
Created September 1, 2019 18:12
Fixed Parser
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class Main {
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
public class DuplicateRemover {
private final String currentDefinitionFile;
private final String outputFile;