Skip to content

Instantly share code, notes, and snippets.

@aadnk
aadnk / NbtFactory.java
Last active December 29, 2020 04:29
A compact library for editing or creating NBT tags, ready to be inserted into your project. It doesn't directly depend on CraftBukkit, but uses reflection to access it dynamically. Use this version for 1.7.2: http://tinyurl.com/attributestorage
package com.comphenix.example;
import java.io.BufferedInputStream;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@aadnk
aadnk / ItemRenamerHideLore.java
Created September 25, 2013 02:05
Using the new ItemRenamer API to hide lore.
package com.comphenix.example;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin;
import org.shininet.bukkit.itemrenamer.api.RenamerAPI;
@aadnk
aadnk / SoundlessTeethlessExplosion.java
Created August 29, 2013 21:44
Create a soundless explosion that does no damage.
package com.comphenix.example;
import org.bukkit.Location;
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.entity.EntityDamageByBlockEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
@aadnk
aadnk / PressurePlate.java
Created August 11, 2013 04:34
Suppress pressure plate sounds.
package com.comphenix.example;
import java.util.logging.Filter;
import java.util.logging.LogRecord;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.plugin.java.JavaPlugin;
@aadnk
aadnk / OrcishMod.java
Created August 3, 2013 18:46
Transform text into orcish
package com.comphenix.example;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.bukkit.ChatColor;
import org.bukkit.plugin.java.JavaPlugin;
@aadnk
aadnk / UpdateAttributes.java
Created July 28, 2013 03:32
How to intercept and modify Packet44UpdateAttributes in ProtocolLib 2.5.1. This example modifies the sprint speed to be 200% faster.
package com.comphenix.example;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import org.bukkit.plugin.java.JavaPlugin;
import com.comphenix.protocol.Packets;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.events.ConnectionSide;
@aadnk
aadnk / pom.xml
Created July 27, 2013 15:15
The Maven POM file used to compile MCore without changing its folder structure or updating the version.
<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.mcore</groupId>
<artifactId>MCore</artifactId>
<version>${yaml.plugin.version}</version>
<name>${yaml.plugin.name}</name>
<packaging>jar</packaging>
<description>
MCore stands for MassiveCraft Core and is a plugin that contains libraries and features that other plugins make use of.
Cayorion from the Minecraft Server MassiveCraft is the lead programmer.
@aadnk
aadnk / NoEnderDragonSound.java
Created July 24, 2013 03:25
No ender dragon sound in different worlds.
package com.comphenix.example;
import org.bukkit.plugin.java.JavaPlugin;
import com.comphenix.protocol.Packets;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.events.ConnectionSide;
import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketEvent;
@aadnk
aadnk / SilentWalkers.java
Created July 19, 2013 22:12
Silence a player's walking.
package com.comphenix.example;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import com.comphenix.protocol.Packets;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.events.ConnectionSide;
@aadnk
aadnk / AttributesExample.java
Created July 17, 2013 23:47
Make attributes work in creative mode.
package com.comphenix.example;
import java.io.DataInputStream;
import java.io.IOException;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;