Skip to content

Instantly share code, notes, and snippets.

@aadnk
aadnk / SynchronousCensor.java
Created November 21, 2012 05:43
Using the new synchronous client packet listeners
package com.comphenix.example;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import com.comphenix.protocol.Packets;
@aadnk
aadnk / PathFinderExample.jar
Created November 26, 2012 06:28
Path-find to a nearby block lit by sunlight
package com.comphenix.example;
import net.minecraft.server.EntityPlayer;
import net.minecraft.server.PathEntity;
import net.minecraft.server.PathPoint;
import net.minecraft.server.WorldServer;
import org.bukkit.ChatColor;
import org.bukkit.DyeColor;
import org.bukkit.Location;
package com.comphenix.example;
/*
* Attack hidden players
*
* Copyright 2012 Kristian S. Stangeland (Comphenix)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@aadnk
aadnk / MobSpawner.java
Created December 14, 2012 14:57
Spawn a fake mob using ProtocolLib
package com.comphenix.example;
import java.lang.reflect.InvocationTargetException;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
@aadnk
aadnk / ItemSerialization.java
Last active December 9, 2015 23:08
Enable serialization of CraftBukkit inventories. Compatible with version 1.4.7 only.
package com.comphenix.example;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
import net.minecraft.server.v1_4_R1.NBTBase;
@aadnk
aadnk / BukkitUnwrapper.java
Created December 22, 2012 17:59
Get the underlying net.minecraft.server-object of any Entity or ItemStack.
package com.comphenix.example;
/*
* ProtocolLib - Bukkit server library that allows access to the Minecraft protocol.
* Copyright (C) 2012 Kristian S. Stangeland
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
@aadnk
aadnk / TestMod.java
Last active November 6, 2016 10:59
Anti-wall jumping protection. Just a test, though.
/*
* TestMod - A simple attempt at preventing laggy wall jumping.
* Copyright (C) 2012 Kristian S. Stangeland
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@aadnk
aadnk / ExampleMod.java
Created January 13, 2013 00:17
Set a different armor color per observer.
package com.comphenix.example;
import org.bukkit.Color;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.plugin.java.JavaPlugin;
import com.comphenix.protocol.Packets;
import com.comphenix.protocol.ProtocolLibrary;
@aadnk
aadnk / Test.java
Created January 14, 2013 12:38
Generate the experience tables on Minecraft Wiki
package com.comphenix.testing;
class Test {
private static int[] xpRequiredForNextLevel;
private static int[] xpTotalToReachLevel;
public static void main(String[] args) {
initLookupTables(50);
for (int i = 1; i < 41; i++) {
@aadnk
aadnk / Test.java
Created January 16, 2013 10:10
Correct Experience Test
package com.comphenix.testing;
class Test {
private int expTotal;
private int expLevel;
private float exp;
public static void main(String[] args) {
Test test = new Test();
test.test();