Skip to content

Instantly share code, notes, and snippets.

View molenzwiebel's full-sized avatar
😎
Hackerman

Thijs Molendijk molenzwiebel

😎
Hackerman
View GitHub Profile
@molenzwiebel
molenzwiebel / generate.rb
Last active December 9, 2019 12:34
Screensaver Images as of 15-4-17
require "open-uri"
require "json"
contents = JSON.parse open("http://screensaver.riotgames.com/latest/content/data.json").read
names = contents["locale"]["translations"]["en_US"]
def get_type(asset)
return "Illustration" if !asset.nil? && asset["tags"].include?("illustrations")
return "Animation" if !asset.nil? && asset["tags"].include?("animated-art")
return "Video Still" if !asset.nil? && asset["tags"].include?("video-stills")
@molenzwiebel
molenzwiebel / ReflectionExecutor.java
Last active December 29, 2015 04:09
Helper class that can "execute" strings and helps general NSM and OBC calls.
package nl.thijsmolendijk.util.reflect;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Arrays;
import org.bukkit.Bukkit;
@molenzwiebel
molenzwiebel / NestedCommandDemo.java
Last active January 2, 2016 12:41
Nested commands. This example allows for /hello if you register Commands.class and allows for /myplugin hello if you register ParentCommand.class
public class Commands {
public static class ParentCommand {
@Command(aliases = { "myplugin"}, desc = "All MyPlugin commands", min = 0, max = -1)
@NestedCommand(Command.class) //All commands will get passed on to Commands.class
public static void myplugin(final CommandContext args, CommandSender sender) throws CommandException {
}
}
@Command(aliases = { "hello", "hey" }, desc = "Says hello", usage = "[player] - The player to say hello to", min = 1, max = 1)
public static void hello(final CommandContext args, CommandSender sender) throws CommandException {
Player target = Bukkit.getPlayer(args.getString(0)); //0 is the index
@molenzwiebel
molenzwiebel / gist:6018889
Created July 17, 2013 08:43
A way to sort the items known in Minecraft.
package nl.thijsmolendijk.LoopThruTest;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
@molenzwiebel
molenzwiebel / Minecraft Server Poller
Created May 7, 2013 12:57
Code to poll a minecraft server
private String MOTD;
private String gameVersion; //Currently 1.5.2
private int onlinePlayers;
private int maxPlayers;
public static String readString(DataInputStream par0DataInputStream, int par1) throws IOException
{
short short1 = par0DataInputStream.readShort();
if (short1 > par1)