Skip to content

Instantly share code, notes, and snippets.

@aadnk
aadnk / ForceEnd.java
Created February 10, 2013 03:56
Force the end credits on an unsuspecting player.
package com.comphenix.example;
import net.minecraft.server.v1_4_R1.EntityPlayer;
import net.minecraft.server.v1_4_R1.Packet70Bed;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.v1_4_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
@aadnk
aadnk / RandomBiomes.java
Last active December 12, 2015 07:09
Demonstration of how to modify the biome of each chunk.
package com.comphenix.example;
import java.util.Collections;
import java.util.Set;
import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.zip.Deflater;
import org.bukkit.Chunk;
import org.bukkit.World.Environment;
@aadnk
aadnk / ItemSerialization.java
Created January 22, 2013 11:31
Serialization without using CraftBukkit
package com.comphenix.example;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
@aadnk
aadnk / PLGlowWithEnchanting.java
Created January 20, 2013 18:34
Use ProtocolLib to make items glow without enchantments.
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import com.comphenix.protocol.Packets;
import com.comphenix.protocol.ProtocolLibrary;
@aadnk
aadnk / GlowWithEnchanting.java
Created January 20, 2013 18:06
Apply an enchanting glow without actually adding any enchantments.
package com.comphenix.example;
import java.lang.reflect.Field;
import net.minecraft.server.v1_4_R1.ItemStack;
import net.minecraft.server.v1_4_R1.NBTTagCompound;
import net.minecraft.server.v1_4_R1.NBTTagList;
import org.bukkit.Material;
import org.bukkit.command.Command;
@aadnk
aadnk / SignPermission.java
Created January 17, 2013 12:21
Require a permission to see signs, item frames and painting.
package com.comphenix.example;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.ItemFrame;
import org.bukkit.plugin.java.JavaPlugin;
import com.comphenix.protocol.Packets;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
@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();
@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 / 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 / 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.