Skip to content

Instantly share code, notes, and snippets.

View Scarsz's full-sized avatar
🐒
Programming Primate

Austin Shapiro Scarsz

🐒
Programming Primate
View GitHub Profile

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@aadnk
aadnk / CancellationDetector.java
Last active April 23, 2025 02:06
A class that allows you to detect which plugin cancelled a given event.
package com.comphenix.example;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.Iterator;
import java.util.List;
import org.bukkit.event.Cancellable;
@larrybolt
larrybolt / cf-ddns.sh
Last active March 14, 2025 14:12
Automatically update your CloudFlare DNS record to the IP, Dynamic DNS for Cloudflare
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
# Automatically update your CloudFlare DNS record to the IP, Dynamic DNS
# Can retrieve cloudflare Domain id and list zone's, because, lazy
# Place at:
# /usr/local/bin/cf-ddns.sh
@graywolf336
graywolf336 / BukkitSerialization.java
Last active May 15, 2025 11:29
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);
@aadnk
aadnk / BootstrapList.java
Created February 20, 2014 21:47
Handling HTTP requests to port 25556 in Minecraft. This requires ProtocolLib (for now), but could be rewritten to avoid it.
package com.comphenix.example;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.concurrent.Callable;
import com.google.common.collect.Lists;
@aadnk
aadnk / DisplayFloatingText.java
Created February 21, 2014 21:38
Display floating text. Thanks to http://www.youtube.com/watch?v=q1B19JvX5TE for the amazing trick. Uses PacketWrapper and ProtocolLib, but could be rewritten to avoid them.
package com.comphenix.example;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
@aadnk
aadnk / DisplayFloatingImage.java
Created February 21, 2014 22:27
Display a floating image with name tags. Screenshot: http://imgur.com/gF0qyzj
package com.comphenix.example;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@aadnk
aadnk / PlayerDisplayModifier.java
Last active November 6, 2024 14:27
Change the display name and skin of any player. Credit to @bigteddy98, @ferrybig and @lenis0012 for writing the original version.
package com.comphenix.example;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.TimeUnit;
@aadnk
aadnk / SimpleMinecraftClient.java
Created May 30, 2014 23:39
Testing sending custom data through ping packets.
package com.comphenix.test;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
@RichardB122
RichardB122 / ExperienceManager.java
Created June 20, 2015 06:28
A simple and easy to use class that can get and set a player's total experience points in Minecraft. This is based off the Bukkit API. The determines this with a mathematical formula based off the player's current level and their progress towards the next one.
/*
AUTHOR: Dev_Richard (https://www.spigotmc.org/members/dev_richard.38792/)
DESC: A simple and easy to use class that can get and set a player's total experience points.
Feel free to use this class in both public and private plugins, however if you release your
plugin please link to this gist publicly so that others can contribute and benefit from it.
*/
import java.math.BigDecimal;
import java.util.List;