Skip to content

Instantly share code, notes, and snippets.

public override System.Collections.Generic.IEnumerable<FigurePosition> GetPossibleTargets(BoardState state)
{
for (FigurePosition pos = Position; pos.IsValid() && !state.IsPositionOccupied(pos, false); pos += new Vector(1, 1))
yield return pos;
for (FigurePosition pos = Position; pos.IsValid() && !state.IsPositionOccupied(pos, false); pos += new Vector(-1, 1))
yield return pos;
for (FigurePosition pos = Position; pos.IsValid() && !state.IsPositionOccupied(pos, false); pos += new Vector(1, -1))
yield return pos;
for (FigurePosition pos = Position; pos.IsValid() && !state.IsPositionOccupied(pos, false); pos += new Vector(-1, -1))
yield return pos;
@main--
main-- / CraftBukkitHelper.java
Created December 26, 2012 21:17
Hell yeah.
package me.main__.nanotech.dirty;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtMethod;
import me.main__.nanotech.NanoTech;
import org.bukkit.Bukkit;
import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
@main--
main-- / EMF.java
Created December 12, 2012 20:22
MV autoupdates Appengine API
package com.onarandombox.mvapi;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
public final class EMF {
private static final EntityManagerFactory emfInstance =
Persistence.createEntityManagerFactory("transactions-optional");
private EMF() {}
@main--
main-- / gist:4251302
Created December 10, 2012 15:36
Bukkit plugins vs CraftBukkit plugins

Before the change

Bukkit plugin

  • accesses only the bukkit API
  • doesn't care about the implementation/doesn't touch it
  • limited possibilities because things like packet manipulation can't go into Bukkit
  • (almost) fully downwards compatible