Skip to content

Instantly share code, notes, and snippets.

@aadnk
aadnk / ChangingUnknownCommand.java
Created September 11, 2014 02:17
Change the "unknown command message" with TinyProtocol.
package com.comphenix.example;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import org.json.simple.JSONObject;
public class ChangingUnknownCommand extends JavaPlugin implements Listener {
private MessageTransformer transformer;
@aadnk
aadnk / GlowInCreativeMode.java
Created August 11, 2014 23:13
Add enchantment glow to items in creative mode. Requires AttributeStorage and TinyProtocol (can be added directly to your plugin).
package com.comphenix.example;
import java.sql.Ref;
import java.util.Collections;
import java.util.UUID;
import net.minecraft.util.io.netty.channel.Channel;
import org.bukkit.Material;
import org.bukkit.command.Command;
@aadnk
aadnk / ItemSerialization.java
Created July 8, 2014 17:07
AttributeStorage example (required) - store the content of a chest directly in its item stack.
package com.comphenix.example;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import org.bukkit.Material;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
@aadnk
aadnk / SimpleMinecraftClient.java
Created May 30, 2014 23:39
Testing sending custom data through ping packets.
package com.comphenix.test;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
@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 / 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 / PlayerDisplayModifier.java
Last active April 18, 2024 08:43
Change the display name and skin of any player. Credit to @bigteddy98, @ferrybig and @lenis0012 for writing the original version.
package com.comphenix.example;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.TimeUnit;
@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 / ItemSerialization.java
Last active November 30, 2015 18:35
ItemSerialization for Minecraft 1.7.9 that supports player inventories.
package com.comphenix.example;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.lang.reflect.Method;
import java.util.Arrays;
@aadnk
aadnk / FakeEquipment.java
Last active January 7, 2024 15:37
Modify the displayed armor and held item depending on the observing player.
/* The MIT License (MIT)
*
* Copyright (c) 2014 Kristian S. Stangeland
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions: