Skip to content

Instantly share code, notes, and snippets.

@SpaceManiac
SpaceManiac / bytebuf-leaks.log
Created January 31, 2014 07:47
Trace of ByteBuf leaks in flow-networking in Glowstone usage.
"C:\Program Files\Java\jdk1.7.0_25\bin\java" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:52963,suspend=y,server=n -Dio.netty.leakDetectionLevel=advanced -javaagent:C:\Users\Tad\.IdeaIC13\system\groovyHotSwap\gragent.jar -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.7.0_25\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\jce.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\jfxrt.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\resources.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\rt.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\ext\jaccess
@SpaceManiac
SpaceManiac / ParticleTestPlugin.java
Created February 6, 2014 03:26
Testing materials for Bukkit Particles PR
package particletest;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.material.MaterialData;
@SpaceManiac
SpaceManiac / BlockPlacementHandler.java
Created February 28, 2014 00:29
Comment on BlockPlacementHandler regarding double-packet behavior
/**
* The client sends this packet for the following cases:
* Right click air:
* - Send direction=-1 packet for any non-null item
* Right click block:
* - Send packet with all values filled
* - If client DOES NOT expect a block placement to result:
* - Send direction=-1 packet (unless item is null)
*
* Client will expect a block placement to result from blocks and from
@SpaceManiac
SpaceManiac / InvSerialize.java
Last active August 29, 2015 14:01
Serialization/deserialization of entire inventories
// Usage:
inv.setContents(deserializeAll(config.getMapList("xyz")));
config.set("xyz", serializeAll(inv.getContents()));
// Methods:
private ArrayList<Map<String, Object>> serializeAll(ItemStack[] contents) {
ArrayList<Map<String, Object>> items = new ArrayList<Map<String, Object>>();
if (contents == null) return items;
@SpaceManiac
SpaceManiac / CONTRIBUTING.md
Last active August 29, 2015 14:06
Draft of Glowstone contributing & PR handling guidelines

Contributing to Glowstone

Glowstone is a lightweight, open source Minecraft server written in Java. For those who wish to contribute, we encourage you to fork the repository and submit pull requests. Below you will find guidelines that will explain this process in further detail.

Quick Guide

  1. Create or find an issue on the issue tracker.
  2. Fork Glowstone if you haven't done so already.
  3. Create a branch dedicated to your change.
  4. Write code addressing your feature or bug.
# ---
# name: ParticleTest
# version: 1.0
# author: SpaceManiac
# commands:
# part:
# description: Particle testing
# ---
import quick
package spongetest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spongepowered.api.Game;
import org.spongepowered.api.util.event.Subscribe;
import org.spongepowered.api.event.state.PreInitializationEvent;
import org.spongepowered.api.plugin.Plugin;
import org.spongepowered.api.plugin.PluginContainer;
@SpaceManiac
SpaceManiac / docs.rs
Created August 22, 2015 22:31
Demonstration of #[doc(inline)] not working as expected
mod ffi {
mod inner {
/// A Docs
pub type A = i32;
}
/// A Use Docs
#[doc(inline)]
pub use self::inner::A;
}
Bytes 0 to 7 are 'SUPREME!' -> Or, probably, other game name abbreviations
Bytes 8 to 39 are the builder name
Bytes 40 to 71 are the world name
Byte 72 is the number of levels in the world
===== Level Segment =====
2 bytes, for level dimensions?
32 bytes for name
Null-teminated string for song
cd [file dirname [info script]]
set file1 aaa.dlw
set file2 aaa2.dlw
set f1 [open $file1]
fconfigure $f1 -translation binary
set f2 [open $file2]
fconfigure $f2 -translation binary