Skip to content

Instantly share code, notes, and snippets.

View masecla22's full-sized avatar
💭
chaotically proportional

masecla22 masecla22

💭
chaotically proportional
View GitHub Profile
@itIsMaku
itIsMaku / DiscordWebhook.java
Last active October 19, 2023 01:47 — forked from k3kdude/DiscordWebhook.java
Java DiscordWebhook class to easily execute Discord Webhooks - Lombok and Code Cleanup
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import javax.net.ssl.HttpsURLConnection;
import java.awt.*;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.Array;
@masecla22
masecla22 / ItemStackSerializer.java
Created August 15, 2018 06:02
A class for converting bukkit ItemStack and ItemStacksArrays to Strings and back
package masecla.practicepvp.serializers;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import org.bukkit.inventory.ItemStack;
public class ItemStackSerializer {
@vemacs
vemacs / NoAI.java
Last active January 15, 2023 16:48
private static String serverVersion;
private static Method getHandle;
private static Method getNBTTag;
private static Class<?> nmsEntityClass;
private static Class<?> nbtTagClass;
private static Method c;
private static Method setInt;
private static Method f;
public static void setAiEnabled(Entity entity, boolean enabled) {
@graywolf336
graywolf336 / BukkitSerialization.java
Last active April 18, 2024 07:21
Serialize and deserialize the player's inventory, including armor and content.
/**
* Converts the player inventory to a String array of Base64 strings. First string is the content and second string is the armor.
*
* @param playerInventory to turn into an array of strings.
* @return Array of strings: [ main content, armor content ]
* @throws IllegalStateException
*/
public static String[] playerInventoryToBase64(PlayerInventory playerInventory) throws IllegalStateException {
//get the main content part, this doesn't return the armor
String content = toBase64(playerInventory);