Skip to content

Instantly share code, notes, and snippets.

@aadnk
aadnk / DisablePotionParticles.java
Created February 11, 2014 23:08
Disable potion particles. Works in Minecraft 1.7.2 - 1.5.2.
package com.comphenix.example;
import java.util.List;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import com.comphenix.protocol.events.PacketAdapter;
@aadnk
aadnk / CancelReelingIn.java
Created February 12, 2014 09:57
How to cancel reeling in a fish.
package com.comphenix.example;
import java.util.Collections;
import java.util.Set;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerFishEvent;
import org.bukkit.event.player.PlayerFishEvent.State;
@aadnk
aadnk / PlayerPlayback.java
Created February 15, 2014 14:07
Player-specific playback of jukebox records.
package com.comphenix.example;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChangedWorldEvent;
@aadnk
aadnk / pom.xml
Last active August 29, 2015 13:57
POM file for MCore.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.massivecraft</groupId>
<artifactId>mcore</artifactId>
<version>7.0.2</version>
<packaging>jar</packaging>
<description>MCore stands for MassiveCraft Core and is a plugin that contains libraries and features that other plugins make use of.</description>
<properties>
@aadnk
aadnk / OfflinePlayers.java
Created April 1, 2014 21:05
Serialize/deserialize offline player NBT data with ProtocolLib.
package com.comphenix.example;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
@aadnk
aadnk / CancelInventoryClick.java
Last active August 29, 2015 14:00
Cancel inventory clicks with TinyProtocol
package com.comphenix.example;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import com.comphenix.example.Reflection.FieldAccessor;
import com.comphenix.example.Reflection.MethodInvoker;
import net.minecraft.util.io.netty.channel.Channel;
@aadnk
aadnk / AttackingHiddenPlayers.java
Created May 6, 2014 18:53
Attacking hidden players in 1.7.2.
package com.comphenix.example;
/*
* Attack hidden players
*
* Copyright 2014 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 / CustomPingData.java
Created May 30, 2014 20:50
Send custom ping data.
package com.comphenix.example;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
@aadnk
aadnk / CustomPingData.java
Last active August 29, 2015 14:02
Recieve custom data through ping packets. See https://gist.github.com/aadnk/59756145619d076ccd04 in order to test this.
package com.comphenix.example;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.concurrent.ConcurrentMap;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
@aadnk
aadnk / Test.java
Created December 19, 2014 17:30
Test of MagicAccessorImpl to speed up access of private packet fields
package com.comphenix.example;
import java.util.concurrent.ConcurrentMap;
import org.bukkit.plugin.java.JavaPlugin;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.injector.StructureCache;
import com.comphenix.protocol.reflect.FieldUtils;