Skip to content

Instantly share code, notes, and snippets.

@Joedobo27
Joedobo27 / BytecodeTools.java
Last active October 6, 2017 14:51
Extend Title Enum
package com.joedobo27.bulkoptions;
import javassist.bytecode.*;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Objects;
package com.joedobo27.mcl;
import com.joedobo27.libs.bytecode.BytecodeTools;
import javassist.CannotCompileException;
import javassist.CtClass;
import javassist.CtPrimitiveType;
import javassist.NotFoundException;
import javassist.bytecode.*;
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
import org.gotti.wurmunlimited.modloader.interfaces.Configurable;
package com.joedobo27.sgi;
import com.wurmonline.server.Players;
import com.wurmonline.server.players.Player;
import com.wurmonline.server.skills.Skill;
import javassist.*;
import javassist.bytecode.*;
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
import org.gotti.wurmunlimited.modloader.interfaces.Initable;
import org.gotti.wurmunlimited.modloader.interfaces.WurmServerMod;
@Joedobo27
Joedobo27 / ActionTime.java
Created May 26, 2018 22:16
TimeUnitTickedTriggerMod
package com.joedobo27.tuttm;
import com.wurmonline.server.behaviours.Action;
import java.util.WeakHashMap;
@SuppressWarnings("unused")
public class ActionTime {
private int lastWholeUnitTime;
@Joedobo27
Joedobo27 / byteArrayToLineNumber.java
Created July 2, 2018 16:46
Find table-line-number from an array of bytes.
private static int byteArrayToLineNumber(byte[] bytesSeek, CtMethod ctMethod, int byteArraySize)
throws BadBytecode, RuntimeException {
// Using bytesSeek iterate through the ctMethod's bytecode looking for a matching byte array sized to byteArraySize
int bytecodeIndex = -1;
CodeIterator codeIterator = ctMethod.getMethodInfo().getCodeAttribute().iterator();
codeIterator.begin();
long find = byteArrayToLong(bytesSeek);
while (codeIterator.hasNext() && codeIterator.lookAhead() + byteArraySize < codeIterator.getCodeLength()) {
int index = codeIterator.next();
apply plugin: 'java'
apply plugin: 'distribution'
group = 'com.joedobo27'
version = '1.0.3'
sourceCompatibility = 1.8
def WUServerPath = "C:\\Users\\Jason\\Documents\\WU\\WU-Server\\"
apply plugin: 'java'
sourceCompatibility = 1.8
def WurmServerPath ="C:\\Users\\Jason\\Documents\\WU\\WU-Server\\"
def WurmServerDecompiledPath = "C:\\Users\\Jason\\IdeaProjects\\WurmServerDecompiled\\"
def procyon = "C:\\Users\\Jason\\Documents\\Java\\procyon-decompiler-0.5.30.jar"
repositories {
mavenCentral()
package com.joedobo27.libs.creature;
import com.wurmonline.server.MiscConstants;
import java.util.ArrayList;
import java.util.Objects;
public class Title implements MiscConstants
{
apply plugin: 'java'
group = "com.joedobo27"
version = "1.0.0"
sourceCompatibility = JavaVersion.VERSION_1_8
def WUServerPath = "C:\\Users\\Jason\\Documents\\WU\\WU-Server\\"
repositories {
mavenCentral()
}
apply plugin: 'java'
sourceCompatibility = 1.8
def WurmServerPath ="C:\\Users\\Jason\\Documents\\WU\\WU-Server\\"
def WurmServerDecompiledPath = "C:\\Users\\Jason\\IdeaProjects\\WurmServerDecompiled\\"
def procyon = "C:\\Users\\Jason\\Documents\\Java\\procyon-decompiler-0.5.30.jar"
repositories {
mavenCentral()