Skip to content

Instantly share code, notes, and snippets.

View Swedz's full-sized avatar
🐈
Meow :3

Swedz Swedz

🐈
Meow :3
View GitHub Profile
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
@Swedz
Swedz / BukkitColor.java
Last active June 29, 2020 18:20
Utility for handling colors within Bukkit/Spigot/Paper
import com.google.common.base.Enums;
import com.google.common.base.Preconditions;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.Color;
import org.bukkit.DyeColor;
import org.bukkit.Material;
public class BukkitColor {
public static final BukkitColor RED = fromRGB(11743532);
public static final BukkitColor ORANGE = fromRGB(15435844);
import com.google.common.collect.Lists;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Iterator;
import java.util.List;
public abstract class AbstractEnum<T> {
private final Class<T> clazz;
protected List<T> elements;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import net.minecraft.server.v1_15_R1.EntityPlayer;
import org.bukkit.Material;
import org.bukkit.craftbukkit.libs.org.apache.commons.codec.binary.Base64;
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import net.swedz.tesseract.Assert;
import net.swedz.tesseract.plugin.Tesseract;
import org.bukkit.Bukkit;
import org.bukkit.scheduler.BukkitTask;
import java.util.concurrent.CompletableFuture;
public final class BukkitThreading
{
public static boolean isMainThread()
package net.swedz.lib;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ArgumentReader {
private final String[] args;
private int readIndex;
@Swedz
Swedz / BukkitCommand.java
Last active January 15, 2020 13:45
Much simpler version of registering commands.
package net.swedz.lib.bukkit;
import net.swedz.lib.ArgumentReader;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.event.Listener;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
/*
* You know, it's pretty interesting.
* The most recent spigot update (1.13+) has changed all of the Material values.
* They changed it so that it matches the vanilla display name of the items!
* This makes formatting the item names very easy.
*/
package net.swedz.util.render;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Stroke;
public class Rendering {
public static void rectangle(Graphics2D g, int x, int y, int w, int h, int thickness, Color color) {
Color old = g.getColor();
@Swedz
Swedz / FakePlayer.java
Last active September 21, 2022 13:49
Create Fake Players that are specific for just some players!
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;