Skip to content

Instantly share code, notes, and snippets.

@aadnk
aadnk / CountdownMod.java
Created October 29, 2012 22:11
Count down in the MOTD field.
package com.comphenix.example;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
import org.apache.commons.lang.time.DateUtils;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@aadnk
aadnk / Sleepwalking.java
Created October 25, 2012 19:34
Sleepwalking
package com.comphenix.example;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
@aadnk
aadnk / ExampleMod.java
Last active December 6, 2022 18:28
Hide or show players in the player list only (TAB).
package com.comphenix.example;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public class ExampleMod extends JavaPlugin {
private HidePlayerList playerList;
@aadnk
aadnk / LoggedPluginManager.java
Created October 13, 2012 23:58
Simple proxy-classes for adding better error handling in Minecraft.
/*
* Logged-classes - Simple proxy-classes for adding better error handling in Minecraft.
* Copyright (C) 2012 Kristian S. Stangeland
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
@aadnk
aadnk / MonitorListener.java
Created October 12, 2012 05:27
A monitor listener for ProtocolLib
package com.comphenix.example;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.plugin.Plugin;
import com.comphenix.protocol.Packets;
import com.comphenix.protocol.events.ConnectionSide;
import com.comphenix.protocol.events.ListenerPriority;
@aadnk
aadnk / EntityProximityDetector.java
Created October 8, 2012 18:21
Entity proximity detection API
package com.comphenix.proximity;
import java.util.ArrayDeque;
import java.util.Collection;
import java.util.Deque;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@aadnk
aadnk / Test.java
Created October 1, 2012 02:50
ProtocolLib Benchmark
package com.comphenix.testing;
import java.util.concurrent.TimeUnit;
import com.comphenix.protocol.injector.StructureCache;
import com.comphenix.protocol.reflect.FieldAccessException;
import com.comphenix.protocol.reflect.StructureModifier;
import com.comphenix.protocol.reflect.compiler.BackgroundCompiler;
import com.google.common.base.Stopwatch;
@aadnk
aadnk / ExampleListener.java
Created September 26, 2012 15:09
A way of enabling block breaking from far away
package com.comphenix.example;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.server.Packet55BlockBreakAnimation;
import org.bukkit.Server;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.CraftServer;
@aadnk
aadnk / TeleportFixTwo.java
Last active April 19, 2022 09:04
A CraftBukkit-free solution to the invisibility bug
// Released under the BSD License.
// Kristian S. Stangeland 2013.
package com.comphenix.example;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Server;
import org.bukkit.entity.Player;
@aadnk
aadnk / TeleportFix.java
Created September 24, 2012 02:20
Bukkit Teleport Invisibility Fix
package com.comphenix.example;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.server.EntityPlayer;
import net.minecraft.server.EntityTracker;
import net.minecraft.server.EntityTrackerEntry;
import net.minecraft.server.WorldServer;