Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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 / ImportChunksTask.java
Last active December 14, 2015 13:38
Import chunks on the main thread.
package com.comphenix.example;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import org.bukkit.Location;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitScheduler;
/**
@aadnk
aadnk / TestChunkLoadEvent.java
Last active December 15, 2015 01:59
Determine whether or not ChunkLoadEvent is reliable or not.
package com.comphenix.example;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import net.minecraft.server.v1_7_R1.ChunkCoordIntPair;
import static com.comphenix.protocol.PacketType.Play.Server.*;
@aadnk
aadnk / FlipMobs.java
Last active December 4, 2018 17:03
April fools. Flip zombies and chickens.
package com.comphenix.flipmobs;
import java.util.List;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.plugin.java.JavaPlugin;
import com.comphenix.protocol.Packets;
@aadnk
aadnk / ExampleMod.java
Created April 5, 2013 16:42
Hide enchantments on worn inventory, but keep them enabled otherwise.
package com.comphenix.example;
import java.util.Arrays;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;