Skip to content

Instantly share code, notes, and snippets.

View volgar1x's full-sized avatar

Antoine Chauvin volgar1x

View GitHub Profile
class Tree<TKey, TValue>
{
protected readonly Tree<TKey, TValue> parent;
protected readonly IDictionary<TKey, Tree<TKey, TValue>> children = new Dictionary<TKey, Tree<TKey, TValue>>();
public Tree(Tree<TKey, TValue> parent) {
this.parent = parent;
}
public Tree() {
package org.shivas.server;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineFactory;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import junit.framework.TestCase;
public class ScriptingTest extends TestCase {
URLClassLoader loader;
try {
loader = new URLClassLoader(new URL[] {
file.toURI().toURL()
}, ClassLoader.getSystemClassLoader());
} catch (Exception e) {
log.error("can't load {} because : {}", file.getPath(), e.getMessage());
return null;
}
import org.shivas.server.core.plugins.Plugin
import org.shivas.server.core.plugins.Startable
import com.google.common.collect.Lists
import javax.swing.Timer
class PubManagerPlugin extends Plugin {
final String author = "Blackrush"
final String version = "alpha1"
final String help = "Sends pub message in global channel"
<npcs>
<npc id="1" template="615" map="7411" cell="370" orientation="SOUTH_WEST" start="1936">
<question id="1936">
<answer id="1937">
<action type="5" question="5452" />
</answer>
</question>
<question id="5452">
<answer id="2627">
<action type="4" />
package hello
import java.util.Scanner
import java.util.Random
import com.sun.javaws.exceptions.InvalidArgumentException
import java.util.HashMap
/**
* Created with IntelliJ IDEA.
* User: Blackrush
#ifndef ABUSE_REASON_HPP
#define ABUSE_REASON_HPP
namespace Data
{
class AbuseReason : public DataObject
{
int _abuseReasonId() const
{ return this["_abuseReasonId"].Cast<int>(); }
package org.shivas.data.converter;
import com.google.common.collect.Sets;
import junit.framework.TestCase;
import org.shivas.data.converter.loaders.AncestraLoader;
import org.shivas.data.converter.loaders.DataLoader;
import org.shivas.data.entity.SpellEffect;
import org.shivas.data.entity.SpellLevel;
import org.shivas.data.entity.SpellTemplate;
package org.shivas.core.core.castables.effects;
import org.shivas.common.random.Dice;
import org.shivas.common.statistics.CharacteristicType;
import org.shivas.common.statistics.Statistics;
import org.shivas.core.core.fights.Fight;
import org.shivas.core.core.fights.FightCell;
import org.shivas.core.core.fights.FightException;
import org.shivas.core.core.fights.Fighter;
import org.shivas.core.core.fights.events.FighterLifeUpdateEvent;
@volgar1x
volgar1x / gist:3996976
Created November 1, 2012 22:06
get all loaded classes from a ClassLoader
private List<Class<?>> getClasses(ClassLoader classLoader) throws ReflectiveOperationException {
Class<?> clazz = classLoader.getClass();
while (clazz != ClassLoader.class) {
clazz = clazz.getSuperclass();
}
Field field = clazz.getDeclaredField("classes");
field.setAccessible(true);
return new ArrayList<Class<?>>((Collection<Class<?>>) field.get(classLoader));
}