Java tutorial
/** * This file is part of SpigotPatcher. * * SpigotPatcher is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SpigotPatcher is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with SpigotPatcher. If not, see <http://www.gnu.org/licenses/>. */ package com.foxelbox.spigotpatcher.patchers; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; public class GetOnlinePlayersPatcher extends ClassVisitor { public GetOnlinePlayersPatcher(ClassVisitor classVisitor) { super(Opcodes.ASM5, classVisitor); } @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { if (name.equals("_INVALID_getOnlinePlayers")) { System.out.println("Patching GOPP: " + name); name = "getOnlinePlayers"; } return super.visitMethod(access, name, desc, signature, exceptions); } }