#[IN DEV] CVN (Cross-Version-NMS)

1 messages ยท Page 2 of 1

fallow sky
#

see you later ๐Ÿ‘‹

rigid saffron
#

that we will feed to spigot

#

it just does the same things a JavaPlugin does usually

#

apparently there is something called a PluginBase

rigid saffron
#

Actually, JavaPlugin has a protected contructor that lets us give it a PluginFileDescriptor, meaning we can just call that using reflection without any extra classes

rigid saffron
#

Once I finish the gradle plugin

fallow sky
#

okok

#

and after that, we would have finished CVN?

rigid saffron
#

Yeah

fallow sky
#

incredible

#

it was so fast

rigid saffron
#

Just that we will also need a maven plugin

fallow sky
rigid saffron
#

Yeah

#

But that all is a secondary problem

fallow sky
#

yeah x)

#

this is incredible

#

I'll make a youtube tutorial to teach how to use CVN as soon as we'll have finished

rigid saffron
#

Actually, wait, we are overcomplicating things even more, since we end up creating a remapped jar, we can just change the cvn-plugin.yml to be a plugin.yml and load it like usual

rigid saffron
#

This makes everything so much easier

fallow sky
#

but there was a problem but I can't remember which one

#

also, we shouldn't forget to make the plugins remapped using CVN as dependency to make sure we can update them before loading them (if the original not remapped file is changed, basically)

rigid saffron
#

There shouldn't be one. We remap the plugin, change the cvn-plugin.yml to be a plugin.yml and put it in some directory + we add its hash so we know when to update the remapped jar
Then we load them through PluginManager#loadPlugin(File) and enjoy life

fallow sky
#

perfect then

#

I re-go eat x) If we can finish today, it's perfect ๐Ÿ˜„

rigid saffron
#

I doubt I can finish today

#

Likely only tomorrow

fallow sky
#

I'll work too

#

focus on the gradle/maven plugin, and push on github too

#

I'll do my best for CVN if I have time later

#

see you later

fallow sky
rigid saffron
fallow sky
#

oh yeah

#

I forgot you said that x)

fallow sky
rigid saffron
#

Unsure whether the JarFile or whatever it was called has a method for that

fallow sky
#

google says that it's like a zip, hmm

rigid saffron
#

But you could unarchive it, as it is a zip, change the yml file name and rearchive it

fallow sky
#

yeah

fallow sky
#

and still no hash

rigid saffron
#

okay

#

Nice

woven arrow
#

why is this comment here

rigid saffron
#

Lol

fallow sky
rigid saffron
#

Rad, why are you inspecting all the code

fallow sky
rigid saffron
#

I still have no idea what is causing my issue

fallow sky
#

oh really

rigid saffron
#

I have asked on a few forums, waiting

fallow sky
#

I think you should work on the plugin loader while waiting :)

woven arrow
rigid saffron
fallow sky
fallow sky
#

what is this ?

woven arrow
#

i'm not necessarily seeing anything bad there

fallow sky
woven arrow
#

but i also dk anything about reflection and that typa thing

fallow sky
#

but not perfectly

fallow sky
#

just modifying a jar file without extracting his content

woven arrow
#

then like jar modding

#

never done that, never needed

fallow sky
rigid saffron
fallow sky
#

basically those lines :```java
InputStream stream = jar.getInputStream(jar.getJarEntry("cvn-plugin.yml"));

ZipFile zipFile = new ZipFile(plugin);
zipFile.removeFile("cvn-plugin.yml");

ZipParameters parameters = new ZipParameters();
parameters.setFileNameInZip("plugin.yml");

zipFile.addStream(stream, parameters);```

#

I should close the jar file too x)

#

idk if it's good ๐Ÿคท

#

@rigid saffron is there a way I can use intermediary mappings directly?

#

even, is it necessary to have intermediary mappings to pass the plugin into CVN?

#

just some basic bukkit code will works?

rigid saffron
#

Wdym

#

You want a plugin with intermediary mappings for testing?

#

You can use the tiny-remapper by fabricmc and remap it

rigid saffron
fallow sky
fallow sky
#

so, wait, it's already closed?

#

I must remake a try with resource?

rigid saffron
#

try with resource closes things automatically

fallow sky
#

okok

#

so I must remake one

#

bruh, almost 1 Mb ๐Ÿ’€

rigid saffron
#

The whole plugin?

fallow sky
#

yeah

rigid saffron
#

Damn

fallow sky
#

tinyremapper is the heaviest

rigid saffron
#

Yeah, I'll refactor it a bit so it has less useless classes

fallow sky
#

perfect

#

let's test our system

#

seems to be a very good test plugin

rigid saffron
#

Great plugin

fallow sky
rigid saffron
#

Lol

fallow sky
rigid saffron
#

That's weird

#

It shouldn't do that in theory

fallow sky
#

and it is not loaded by CVN ๐Ÿ‘

rigid saffron
#

Amazing

fallow sky
#

let's do a good debugging

rigid saffron
#

Lol

#

Ig we'll have to make a cvn-plugins folder or something, but that is cringe

fallow sky
#

yeah

#

okay, the problem was a dot

#

.jar -> jar

rigid saffron
#

Lol

fallow sky
rigid saffron
#

That is even more cringe

fallow sky
#

x)

#

and, if we fake the server?

#

by creating a fake plugin.yml redirecting to an empty class?

rigid saffron
#

well, thought of thaz

#

Kinda cringe

fallow sky
#

huh, it will be loaded...

#

so we won't be able to edit him

#

hmmm

rigid saffron
#

We need a spigot expert

fallow sky
#

yeah

#

md5

#

x)

rigid saffron
#

Lol

fallow sky
#

what the hell is that

rigid saffron
#

Or maybe somebody else, frostalf or something

rigid saffron
#

Looks like your FilenameUtils is doing a linux format

fallow sky
#

the / at the beginning is the problem?

fallow sky
#

but this will works on linux then?

rigid saffron
#

Just do .endsWith(".jar")

fallow sky
#

okay

#

where?

rigid saffron
fallow sky
#

@rigid saffron this is the problem

#
Paths.get(cvn.getServer().getClass().getProtectionDomain().getCodeSource().getLocation().getPath()),```
rigid saffron
#

Interesting

fallow sky
#

let's try by adding .replaceFirst("/", "") ๐Ÿค“

#

what I have done

rigid saffron
fallow sky
#

yeah, sure

#

file:/C:/Users/paule/Documents/Serveurs/test-plugin-1.9.4/cache/patched_1.9.4.jar

#

@rigid saffron

rigid saffron
#

try .replace("file:/", "") and then turn it into a Path

fallow sky
#

the code disappeared, and cvn-plugin.yml hasn't been replaced :/

rigid saffron
#

Lol

#

Amazing

fallow sky
#

still illegal char

#

the first one was working

rigid saffron
#

Show outout

fallow sky
#

/C:/Users/paule/Documents/Serveurs/test-plugin-1.9.4/cache/patched_1.9.4.jar

#

.replaceFirst("/", "") works "perfectly"

rigid saffron
#

Show code

fallow sky
#

Paths.get(cvn.getServer().getClass().getProtectionDomain().getCodeSource().getLocation().getPath().replaceFirst("/", ""))

rigid saffron
#

Does it actually work

fallow sky
#

and if I put both maybe?

rigid saffron
#

Doubt it

fallow sky
#

so it "works"

rigid saffron
#

Weird

#

Let's continue tomorrow

fallow sky
#

the problem is this

fallow sky
#

see you tomorrow

rigid saffron
#

Ok

#

Bye bye

fallow sky
#

๐Ÿ‘‹

#

the problem comes from when remapping

#

this path doesn't exist

#

that's why it doesn't work ?

#

(I'm asking myself)

#

oh

#

it's not the server

#

but wait

#

wtf

#

it's getting the patched file, so it should works?

#

bump

#

LOL

#

PAPER IS THE PROBLEM

#

I'll need to use paper as dependency to make some checks if the server is paper based

#

hope it will works, or I'll use reflection

#

basically, getServer#getClass#... is in cache/patched-version.jar

#

but we wants it as server.jar

#

I'll need to do some tricks

#

apache.commons >>>

#

a bit working

#

NO WAY

#

remapped, but not launched?

#

@rigid saffron @woven arrow @inland spoke ๐Ÿ˜Ž

#

yeah, many pings

#

but I'm happy ๐Ÿ˜„

woven arrow
#

yoooo

#

that's rlly cool

#

wait is that mc 1.9.4 o_O

fallow sky
#

yeah

#

it works on any version

woven arrow
#

great!

fallow sky
#

(logically)

fallow sky
#

Actual system - theorically working versions (because test plugin is not using mappings in his code) :

  • 1.20.6 โœ… (detected getServer class : versions\1.20.6\paper-1.20.6.jar) ASM : 9.3
  • 1.20.4 โœ… (detected getServer class : versions\1.20.4\paper-1.20.4.jar) ASM : 9.3
  • 1.16.5 โœ… (detected getServer class : cache\patched_1.16.5.jar) ASM : ??
  • 1.14.4 โœ… (detected getServer class : cache\patched_1.14.4.jar) ASM : ??
  • 1.13.2 โœ… (detected getServer class : cache\patched_1.13.2.jar) ASM : present
  • 1.12.2 โœ… (detected getServer class : cache\patched_1.12.2.jar)
  • 1.11.2 โœ… (detected getServer class : cache\patched_1.11.2.jar)
  • 1.10.2 โœ… (detected getServer class : cache\patched_1.10.2.jar)
  • 1.9.4 โœ… (detected getServer class : cache\patched_1.9.4.jar)
  • 1.8.8 โœ… (detected getServer class : cache\patched_1.8.8.jar)
fallow sky
#

we need to know what is different in this version

#

gn

woven arrow
rigid saffron
#

(inside of the tiny remapper)

#

I'll inspect further

#
     ClassVisitor cv = new ClassVisitor(Opcodes.ASM9) {
            @Override
            public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
                ret.init(name, version, mrjVersion, signature, superName, access, interfaces);
                super.visit(version, access, name, signature, superName, interfaces);
            }

            @Override
            public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
                MemberInstance prev = ret.addMember(new MemberInstance(TrMember.MemberType.METHOD, ret, name, desc, access, ret.getMembers().size()));
                if (prev != null) throw new RuntimeException(String.format("duplicate method %s/%s%s in inputs", ret.getName(), name, desc));

                return super.visitMethod(access, name, desc, signature, exceptions);
            }

            @Override
            public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
                MemberInstance prev = ret.addMember(new MemberInstance(TrMember.MemberType.FIELD, ret, name, desc, access, ret.getMembers().size()));
                if (prev != null) throw new RuntimeException(String.format("duplicate field %s/%s;;%s in inputs", ret.getName(), name, desc));

                return super.visitField(access, name, desc, signature, value);
            }
        };```
rigid saffron
#

I found an issue my googling the exception and this is the answer I found (two times on github and one time on stackoverflow)

rigid saffron
#

Girls and boys, I found our issue

woven arrow
#

what's the issue

rigid saffron
#

Most likely asm version shit

woven arrow
#

why did you do that on your phone

rigid saffron
#

Can't test it, but who knows

rigid saffron
#

If I can do something without standing up, I will do it without standing up

woven arrow
#

skull

rigid saffron
#

That's how the dependency tree looks

#

I wonder if just setting asm level to 8 instead of 9 would change anything

#

Actually, lemme build a 1.9.4 jar and see the asm version for that

#

Why is there no java 8 for termux

woven arrow
rigid saffron
#

In a hour

rigid saffron
#

Damn, I have posted about my question on two forums and I did not get a single answer or even a question overnight, like, literally nothing

rigid saffron
#

IT WORKED

#

all the jars are here

#

it worked

#

this is amazing

#

who could've thought that Files.newOutputStream could be the imposter

#

huh it did not?

#

why are the jars empty

#

interesting

rigid saffron
#

I'm confused to death

spiral onyx
rigid saffron
#

please help me

spiral onyx
#

Tell me what the issue is and I might be able to give you some intel but probably not

rigid saffron
#

I wonder if my issue comes from the fact I'm doing some funky shits directly in the libs folder instead of doing stuff in the tmp folder and then moving to libs

#

lemme try

inland spoke
#

Oh, an ASM issue? If you give me reproduction steps I can find the cause and a solution rather easily

rigid saffron
#

the asm issue is @fallow sky's issue, I'm currently fighting gradle

inland spoke
#

okay I personally can't reproduce anything so I'll just assume that there is no issue.

rigid saffron
# fallow sky What do you mean ?

I suspect your issue could come from ASM version mismatch (it might be possible that minecraft has one version of ASM and tiny-remapper has another inside)

inland spoke
#

ASM is being shaded into the plugin jar. Depending on the classloader that is a non-issue

fallow sky
#

So we just need to change the ASM version of tinyremapper

#

I'll see that later

rigid saffron
#

my current issue is that class files suddenly go poof for no good reason

inland spoke
#

Instead, you might try to relocate ASM

rigid saffron
fallow sky
rigid saffron
#

haven't had to deal with relocation in gradle yet

fallow sky
#

We should see that, not very difficult shading or relocating

rigid saffron
inland spoke
fallow sky
rigid saffron
#

tr isn't a library by itself, that's why we turn it into one

fallow sky
#

Instead, can any of you see the version of ASM between 1.8, 1.9, 1.13 and 1.14 ?

#

To see if the problem is the version

inland spoke
#

TR is meant to be used as a library.
If you have performance concerns caused by additional I/O overhead, you might want to use something like my stianloader-remapper but really there is no need to refractor TR

rigid saffron
inland spoke
#

It's a library

rigid saffron
#

do all libraries have a Main class

inland spoke
#

It can also be used as a standalone application. Quite a few libs have a main class in fact

inland spoke
# inland spoke It's a library

I know that as I've used it for a very long time in gslStarplane (until I switched to stianloader-remapper + micromixin-remapper)

rigid saffron
#

but well, I will definitely just clean up the everything in the fork I made (configure gradle for it to relocate asm and remove a few unused by us classes)

inland spoke
fallow sky
#

okay let's work on that

#

let's clone the plugin and tiny remapper

rigid saffron
#

I haven't pushed the plugin yet

fallow sky
#

huh

rigid saffron
#

Kinda forgor

fallow sky
#

x) I see that

fallow sky
rigid saffron
#

oh wait no I can't rn

fallow sky
#

okay np

#

where is asm located in server.jar ?

rigid saffron
#

In the same place where it is located in any jar

fallow sky
#

oh

rigid saffron
#

But well, you don't even need to find it

fallow sky
#

in 1.20.4 I've got it

fallow sky
rigid saffron
#

Just install it into a gradle project and run gradlew dependencies

#

It'll show you all dependencies

fallow sky
#

hm I could

rigid saffron
#

The best idea would be to just simply relocate asm in tr and not struggle with random shit

fallow sky
rigid saffron
#

Nah, just change the package and enjoy

#

There should be some gradle relocation plugin I'm sure

fallow sky
#

yeah

rigid saffron
#

shadowJar even got a relocate feature apparently?

#

shadowJar {
relocate 'com.myCompany.project.event', 'com.myCompany.relocated.project.event'
}

fallow sky
#

I think so

fallow sky
#

I just want to finish that

#

when thinking of it, no

#

let's do relocating directly

spiral onyx
#

paulem this is quite random but your english is really good

#

i just wanted to point it out

#

lol

fallow sky
#

thank you ๐Ÿ˜„

#

I really like english

#

Github Desktop is so cool wow

#

it worked ๐Ÿ˜Ž

#

who can test me ๐Ÿ˜Ž

#

so, now it should works on any version?

rigid saffron
#

ยฏ_(ใƒ„)_/ยฏ

#

We should make some software that would casually build and then run all versions of minecraft

fallow sky
#

yeah

#

but not enough time for now

#

x)

#

oh, maybe I was using the wrong dependency...

rigid saffron
#

Wdym

fallow sky
#

not using the local-fat

#

let me cook...

#

perfect

#

here I go

#

LET'S FUCKING GOOOOOO

#

@rigid saffron @inland spoke @woven arrow
YAHOUUUUU

#

perfect

#

working on 1.13.2 too

rigid saffron
fallow sky
#

yeah

rigid saffron
#

If you don't want to, I can write it later

fallow sky
#

fetching from jenkins, hummm

#

I'll try to do that, focus on the plugin x)

#

I'm pushing the patch on github too

#

CVN and tiny remapper have been updated

rigid saffron
#

๐Ÿ‘

fallow sky
#

there was an error with commons io in certain versions, but I fixed it by implementing apache commons, I think I'll made something more optimized than that later

woven arrow
fallow sky
#

we still have the problem with those "huh, invalid plugin.yml"

rigid saffron
#

Oh, and well

#

Use a different plugins directory

#

The best is either 1 or 2

fallow sky
rigid saffron
#

Everything here is bad

fallow sky
#

so the solution 2, I make it now

rigid saffron
fallow sky
#

I forgot about that x)

rigid saffron
#

I wonder if plugins can set their main class to be a class from another plugin

#

Can you try it?

fallow sky
#

huh

#

this would be so wtf

#

I can do that

rigid saffron
#

Make some class in cvn called DummyPlugin, extend JavaPlugin, make it just disable itself, then make another plugin and set the main class to io.github.cvn.DummyPlugin

fallow sky
#

hmm

#

I don't know if I can edit the content on a file in a zip with my actual system

rigid saffron
#

I'm pretty sure that's the way even WinRAR does it

fallow sky
#

yeah

#

7zip too

#

best plugin in my entire life

rigid saffron
#

Lol

fallow sky
#

I'm here in a few minutes

rigid saffron
#

getServer().getPluginManager().disablePlugin(this);

fallow sky
#

yeah

rigid saffron
#

Did it work tho

fallow sky
#

the plugin.yml main class changer?

rigid saffron
#

Ye

fallow sky
#

I'm actually copying some methods of apache commons io to lightweight the plugin

rigid saffron
#

Also, we need to talk about the plugins license

fallow sky
#

yeah ?

rigid saffron
#

I say LGPL because we have a LGPL dependency

#

You okay with that?

fallow sky
#

why not

#

idk I'm not really familiar with licenses

#

LGPL looks good for me

#

x)

rigid saffron
#

๐Ÿ‘

fallow sky
#

one of my plugin is LGPL

#

so it's good for me ๐Ÿ‘

#

april fool

rigid saffron
#

Lol

#

We don't even shade spigot

fallow sky
#

no x)

#

bruh there is nothing in org.spigotmc

#

the biggest thing is bukkit, I forgot about that x)

rigid saffron
#

Lol

inland spoke
#

setting the shadow jar archiveClassifier to empty only makes sense if the regular jar has a non-empty archiveClassifier

#

otherwise performance bye-bye

inland spoke
#

I mean that is how caching works

fallow sky
#

well, it generates me plugin.jar and plugin-all.jar so I wanted to "fix" that

inland spoke
#

You could of course dunk the regular ("slim") jar in some random dir, but that is more non-standard

fallow sky
#

and for tiny remapper, we don't really have choice because it doesn't choose tinyremapper-fat by default

inland spoke
#

the flat classifier shouldn't be used as a dependency either way

fallow sky
inland spoke
#

why would you need to? Doing so completely kills the purpose of using dependency management tools in the first place

fallow sky
#

so I need asm

#

or should I shade asm directly from CVN ?

inland spoke
#

yeah, you shade dependencies as late in the build pipeline as possible

fallow sky
#

okay

inland spoke
#

doing it earlier would result in severe issues with dependency management tools - leading to duplicate classes, transitive dependencies that shouldn't exist but do (or vice-versa), and more

fallow sky
#

looks like it's better

#

should I relocate everything we shade ?

rigid saffron
#

Only the things that want relocation

fallow sky
#

okay

#

so only the thing that might be already present : ASM

inland spoke
fallow sky
#

we poorly write ๐Ÿ˜ข

#

x)

#

okay it's on github

inland spoke
#

we don't have control over the classloader (the classloader being bukkit).
And I haven't been doing bukkit in a long while and thus don't know how good it's classloader is.

fallow sky
#

hum

fallow sky
rigid saffron
#

I've seen it do weird shit before

fallow sky
#

"huh you don't have plugin.yml"

#

"hello I'm bukkit I'm dumb"

rigid saffron
#

Lol

fallow sky
#

@woven arrow there is a comment dedicated to you in CVN ๐Ÿ˜Ž

inland spoke
#

I mean writing classloaders is really hard - even my classloaders has serious faults at times. It's pretty much a pain to debug edge cases and when you encounter them you often tend to just work around them instead of fixing them outright

rigid saffron
fallow sky
#

yeah x)

#

let's do the tricky thing about plugin.yml

rigid saffron
#

Yeah, I'm very curious on whether the main class thing works or not

fallow sky
#

it may not work

#

if the plugin is loaded before CVN

rigid saffron
#

Bukkit when it has to load 7 plugins with the exact same main class be like: ???

fallow sky
#

oh yeah maybe that too

rigid saffron
fallow sky
rigid saffron
#

We will just inject a dummy plugin.yml into the plugin anyways and maybe even let the user write their stuff in the normak plugin.yml and just rename it on compilation

fallow sky
#

"Make some class in cvn called DummyPlugin, extend JavaPlugin, make it just disable itself, then make another plugin and set the main class to io.github.cvn.DummyPlugin"
"Unarchive to some temp folder, do changes, archive, replace old zip with new, delete temp folder"

#

(bump)

fallow sky
woven arrow
#

oh god

#

what's the org name

fallow sky
#

the comment is in this x)

#

it's YOUR line ๐Ÿซก

#

not OUR

woven arrow
#

๐Ÿ˜ญ

fallow sky
#

:)

rigid saffron
#

Lol

fallow sky
#

doc talks about facts

rigid saffron
#

Yes

fallow sky
#

wait

#

I'm lost in what I should make

rigid saffron
#

A plugin with a plugin.yml that leads to the class of another plugin?

fallow sky
#

yeah

#

thanks x)

#

it's time to

#

?tryandsee

distant plankBOT
rigid saffron
#

Lol

#

?tias

#

?tas

distant plankBOT
rigid saffron
#

shorter

fallow sky
#

yeah

#

shorter = better

#

let's rename CVN to C

rigid saffron
#

Lol

fallow sky
#

huh, looks like it already exists

rigid saffron
fallow sky
#

it depends of context ๐Ÿค“

rigid saffron
#

Another case is ZBLL vs ะ—ัะฑะปะธะบ

fallow sky
#

hummmm

rigid saffron
#

@spiral onyx right ะ—ัะฑะปะธะบ?

fallow sky
#

one is more readable for the west world

rigid saffron
#

West world doesn't matter fr

fallow sky
#

my grand father says the same for the east world...

#

strange ๐Ÿค”

fallow sky
#

@rigid saffron looks like it doesn't work

rigid saffron
#

Then we need to include it in all plugins, oh what a pain in the ass

fallow sky
#

yeah

#

I thought of that, so let's do that?

rigid saffron
#

Another addition to the gradle plugin

fallow sky
#

we'll make it smoother with the gradle plugin so not really a problem, right?

fallow sky
rigid saffron
#

it's like a drive-in, just a pain-in

fallow sky
#

x)

woven arrow
#

why paper 1.20.6

#

paper remaps to mojmapped

fallow sky
fallow sky
#

I know

woven arrow
#

that will break stuff

fallow sky
#

that can be another little problem

rigid saffron
#

LEGENDARY

fallow sky
#

x)

#

on spigot***

#

my bad

woven arrow
#

!!

woven arrow
fallow sky
#

incredible

fallow sky
rigid saffron
fallow sky
#

but @rigid saffron we can easily make intermediary -> mojmaps ?

#

oh damn

rigid saffron
#

I'm thinking we'll rename all the plugins in the plugin.yml to CVNDummyPlugin-{uuid} so it doesn't get confusing why a plugin is loading, unloading and loading again

rigid saffron
#

Idk where to get the mojmaps from tbh

woven arrow
#

you're not allowed to publish mojmaps iirc

rigid saffron
fallow sky
#

it doesn't remap anymore :/

rigid saffron
#

Lol

#

Amazing /s

woven arrow
#

mojank

fallow sky
#

I'M DUMB

#

or maybe not ?

#

no I'm dumb

#

see by yourself

#

so it's a PluginType.NONE

#

I need to put a condition if both are true

#

perfectly

#

not working

fallow sky
#
UUID pluginUuid = UUID.randomUUID();

String folderPath = plugin.getDataFolder().getAbsolutePath() + "/temp";
Files.createDirectories(Paths.get(folderPath));

// Edit from cvn-plugin.yml to plugin.yml
ZipFile zipFile = new ZipFile(remappedPlugin);
zipFile.removeFile("plugin.yml");
zipFile.renameFile("cvn-plugin.yml", "plugin.yml");

File tempPlugin = new File(folderPath + "/cvn-" + pluginUuid +".yml");

zipFile.extractFile("plugin.yml", tempPlugin.getAbsolutePath());

YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(tempPlugin);

yamlConfiguration.set("name", "CVNDummyPlugin-" + pluginUuid);```
#

lol

#

I forgot to apply to the remapped jar

#

and to call my method too x)

rigid saffron
#

Did something go wrong

fallow sky
#

yeah, because I don't know how to write code

#

and to write in english too lol

#

partially working

#

I need to go

rigid saffron
#

I'll have to leave in half a hour

#

So ngl, we all are fucked

woven arrow
#

i might be able to help with sth

#

idk

#

i have the next two days off as well

rigid saffron
#

holy fuck I just fixed the gradle plugin somehow

#
Finished remapping jars. Jar:
Intermediary mapped (to be used with CVN): NMSTestProject-1.0.jar
Official/Obfuscated (to be used like normal): NMSTestProject-1.0-official.jar
Original (Unmapped): NMSTestProject-1.0-original.jar
fallow sky
#

perfect

fallow sky
#

I'll work on CVN this afternoon

#

just, please, @rigid saffron PUSH ON GITHUUUUUUB

#

๐Ÿ™

rigid saffron
#

yes

#

sec

fallow sky
#

okay ๐Ÿ‘

rigid saffron
fallow sky
#

wat

rigid saffron
#

I'm unable to push

fallow sky
#

use github desktop

fallow sky
rigid saffron
#

sec

fallow sky
#

okay

rigid saffron
fallow sky
#

thanks

rigid saffron
#

the thing is a bit messy, I've written everything in one class, but it works

fallow sky
#

okay

#

I'm pushing for you

rigid saffron
fallow sky
#

okay

#

thanks

#

I'll push everything

#

you'll just have to clone the repo and you'll be able to push

rigid saffron
#

but make a seperate repo for the test plugin

fallow sky
#

yeah for sure

rigid saffron
#

interesting

#

well, I gtg

#

bye

fallow sky
#

bye

woven arrow
fallow sky
rigid saffron
#

I got a few mins more

fallow sky
#

oh perfect

woven arrow
rigid saffron
woven arrow
#

should work then ๐Ÿคท

rigid saffron
#

It denied access

#

Might add a token later

#

I used to have one added but it vanished

woven arrow
#

yeah that's the issue then

#

i just use the gh cli to log in git

fallow sky
woven arrow
#

and then i can also just git clnoe

fallow sky
fallow sky
woven arrow
#

do you need help with anything

#

i'm free rn

fallow sky
#

humm I don't think so

#

for now I'm just pushing and testing

#

if you want to make the mass server tester, maybe ๐Ÿคท

#

downloading all versions of spigot, and testing if the plugin works, and getting the result

rigid saffron
#

Damn this is great

#

We only started 2 days ago and we already have an usable result

fallow sky
#

yeah x)

rigid saffron
#

Definitely not the final result, but usable

fallow sky
#

yeah for sure

#

partially usable, idk if my code now works

#

not working

rigid saffron
#

The next thing I'll do will most likely be either the maven plugin or the mass tester

rigid saffron
woven arrow
#

question

#

why are we logging to stdout and not bukkit logger

#

ohh that was gradle nvm

rigid saffron
#

Lol

woven arrow
#

bukkit logger in gradle, ah yes

rigid saffron
#

Ideal

#

getting the bukkit logger when there is no bukkit is a 200 iq move

woven arrow
#

i might be the thinker

rigid saffron
#

Also, why are you inspecting code again

woven arrow
#

i cloned everything

rigid saffron
#

why

woven arrow
#

i was hoping i could help with something later today

#

bc bored

rigid saffron
#

Ah

#

Either make the thing that downloads buildtools, gets all versions from https://hub.spigotmc.org/versions/ (that are actual mc versions), takes all files from a folder and setups servers for all versions to test whether things work

#

Or

#

Clean up our already existing code

woven arrow
rigid saffron
woven arrow
#

can i do it in kotlin

rigid saffron
#

I thought of giving it a folder where you put stuff like the plugins folder, eula.txt, server.properties and it would copy it to all servers

rigid saffron
woven arrow
#

yay

#

i'll start later

rigid saffron
#

They are kinda like experimental builds or something

woven arrow
#

so 1.8.3-latest?

rigid saffron
#

You can check whether it's an actual version by just checking whether it has more than one dot in the name

rigid saffron
woven arrow
#

๐Ÿ‘

#

okay but does it download it from jenkins or sth

rigid saffron
#

Nah, it just runs buildtools

woven arrow
#

bc it says there's a jenkins id

#

oh god

#

that will take a while but sure

rigid saffron
#

yeah lol

#

A bit resource intensive but worth it

#

You'll also have to make it give all servers a different port because concurrency

woven arrow
#

time to make it in bend

rigid saffron
#

in what

woven arrow
#

bend

#

that concurrent gpu lang thing

rigid saffron
#

Never heard of it

#

I am very deep in java, can't get out this comfort zone, alright

fallow sky
#

just it was more efficient using System.out.println for debugging instead of instancing my main class and getting logger...

#

@rigid saffron don't forget to fetch the github branch before remodifying your code !!

#

because I renamed the gradle plugin to CVN

#

perfect remapping

#

it didn't remapped

#

it's almost working

#

basically, remapping using tinyremapper in CVN isn't working...

#

we're almost there

fallow sky
#
/**
 * Takes in an intermediary mapped jar and remaps it to an official mapped jar (an obfuscated one).
 * @param jarFile       The jar file to remap
 * @param resultJarFile The file to save the remapped jar to
 */
public void remapJarFromIntermediary(Path classpath, File jarFile, File resultJarFile) {
    File mappingFile = plugin.getMappingFile();

    if(mappingFile == null) throw new IllegalStateException("Could not find mapping file !");

    TinyRemapper remapper = TinyRemapper.newRemapper()
            .withMappings(
                    TinyUtils.createTinyMappingProvider(
                            mappingFile.toPath(),
                            Namespace.INTERMEDIARY.getNamespaceName(), // "intermediary"
                            Namespace.OBFUSCATED.getNamespaceName() // "official"
                    )
            ).build();

    try (OutputConsumerPath outputConsumer = new OutputConsumerPath.Builder(resultJarFile.toPath()).build()) {
        outputConsumer.addNonClassFiles(jarFile.toPath(), NonClassCopyMode.FIX_META_INF, remapper);

        remapper.readInputs(jarFile.toPath());
        remapper.readClassPath(classpath);

        remapper.apply(outputConsumer);
    } catch (IOException e) {
        throw new RuntimeException(e);
    } finally {
        remapper.finish();
    }
}```
rigid saffron
#

I think I might have a free minute

rigid saffron
#

To see

fallow sky
fallow sky
#

it's still in intermediary..

rigid saffron
#

Ah

#

Any exceptions?

#

Tried debugging?

fallow sky
#

well, the server saying that he doesn't know MinecraftServer

#

java.lang.RuntimeException: org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: net/minecraft/server/MinecraftServer

fallow sky
rigid saffron
#

The remapping

fallow sky
#

well no

#

idk how to debug TwT

#

only with println

rigid saffron
#

Just add sysouts

fallow sky
#

yeah

#

oh I'm dumb

#

wait I forgot inverting

#

oh no

#

it was already switched

#

so if I re-switch ?

#

not working too

#

@rigid saffron any idea ?

#

wait

#

that is no sense

#

you told me to use the method to remap from intermediary, instead of using the one to remap to obfuscate

#

but we need obfuscate here

rigid saffron
#

No

fallow sky
#

no ?

rigid saffron
#

The one to obfuscate goes from mojang to obfuscated

#

The one from intermediary goes from intermediary to obfuscated

fallow sky
#

oh

fallow sky
#

right ?

#

so 2 remappings for paper 1.20.6 and higher

rigid saffron
fallow sky
#

idk how to revert it

rigid saffron
#

But I think paper goes from obfuscated to mojang by itself

fallow sky
#

but first, we need to know why intermediary to obfuscate don't work

fallow sky
rigid saffron
fallow sky
#

:/

#

so close to the goal x)

rigid saffron
#

@woven arrow you wanted to help

#

Ye okay I'll go

#

A bit busy today

fallow sky
#

okay goodbye

rigid saffron
#

Got a few free mins rn

CLASS   net/minecraft/server/MinecraftServer$a  net/minecraft/server/MinecraftServer$class_6897
CLASS   net/minecraft/server/MinecraftServer$b  net/minecraft/server/MinecraftServer$class_7460
CLASS   net/minecraft/server/MinecraftServer$c  net/minecraft/server/MinecraftServer$class_6414
CLASS   net/minecraft/server/MinecraftServer$c$1       net/minecraft/server/MinecraftServer$class_6414$1```
MinecraftServer doesn't seem to be renamed. I wonder if NMS gets relocated
rigid saffron
#

ยฏ_(ใƒ„)_/ยฏ

#

Oh wait

#

We could modify the mappings

fallow sky
#

huh

#

this is wild

#

but let's test that

#

@rigid saffron did you really choose the only class that isn't remapped x)

fallow sky
#

All of them uses MinecraftServer as name

#

interesting

#

in 1.20.4, the error is

#

what the hell

#

ama is the obfuscated name for DedicatedServer, who extends MinecraftServer

#

@rigid saffron we forgot about craftbukkit

#

we need to "remap" the imported package too

fallow sky
#

I always get a ClassNotFoundException

rigid saffron
#

I think we can use a ClassLoader

fallow sky
fallow sky
fallow sky
# fallow sky

using nms 1.17.1, with craftbukkit 1.17.1, on a 1.17.1 server

rigid saffron
#

if(className.startsWith("org.bukkit.craftbukkit")) super.findClass(replace the version with the right one)

fallow sky
fallow sky
# fallow sky

the problem is that the name for MinecraftServer is... MinecraftServer and not "aas"

#

but here is what I see when decompiling

#

so idk why it's searching for aas if the namespace in the remapped code is MinecraftServer

woven arrow
fallow sky
#

perfect

#

I push everything on github for you rad

woven arrow
#

what do you need halp with

fallow sky
# fallow sky

I need to know why it's searching for "aas" (obfuscated 1.17.1's name for MinecraftServer) instead of MinecraftServer, even more strange because in the remapped code, the namespace is named "MinecraftServer" so it should search for MinecraftServer

woven arrow
#

ok i can help in like 15mins

fallow sky
#

ok

#

I'll soon go

fallow sky
#

@woven arrow use a 1.17.1 server for testing

rigid saffron
#

We should ask the mapper himself (md_5) to help us

fallow sky
#

yeah

#

how tf do we use ClassLoader for this especially ?

rigid saffron
#

I doubt we can, finally, we don't load the plugin

fallow sky
#

hm

rigid saffron
#

Our best idea would be to do more asm

fallow sky
#

I need to go

#

sorry goodbye

rigid saffron
#

And here I doubt there is a lib to do that

#

bye

woven arrow
#

okay i'm just tryna set up the project atm

#

i tried to run 1.19.4 remapped buildtools

rigid saffron
#

Lmao

woven arrow
rigid saffron
#

I wonder if spigot does any extra remapping

#

It might be possible that spigot does a few things which will make us die

fallow sky
fallow sky
#

And does spigot makes extra remapping ?

rigid saffron
#

How do pings in threads work

#

When you're not in one

woven arrow
rigid saffron
#

Yeah I noticed

#

Just tested it with a friend

#

Australian md is prob sleeping, right?

woven arrow
#

yea probs

fallow sky
#

He'll see that this night then x)

inland spoke
#

So can this issue be reproduced by simply building all plugins from source and using them on a paper 1.17 server, or?

fallow sky
#

But we will soon fix that

#

So actually, a CVN plugin using craftbukkit as dependency can only work for one version

#

But everything is on GitHub to reproduce the issue

inland spoke
#

so you found the solution now or?

fallow sky
#

It's some strange cases of trying to use obfuscated namespace instead of Spigot one...

#

Yeah wait @rigid saffron, we should remap to Spigot, not obfuscated?

inland spoke
#

well I suppose that narrows it down

fallow sky
#

In the days comings

#

And when CVN will be working, I'll do some libs based on it, because it's not at his full potential

#

We can make much better

rigid saffron
fallow sky
#

I'll explain that later, but we are actually grouping similar nms versions, not all versions

fallow sky
rigid saffron
#

It's kinda like mcp or yarn afaik

fallow sky
rigid saffron
#

Spigot mappings

fallow sky
#

I think that's why it's not working, we should do spigot remapping

#

Not obfuscated remapping

#

It's theory, but that could be a lib to do intra-remappings really easily

rigid saffron
#

No, wtf are you saying

fallow sky
rigid saffron
#

No

#

Spigot before mojmaps used spigot mappings

#

Mappings are just a way to make the games code more readable

#

On runtime the game is always obfuscated

#

Besides paper 1.20.6

#

And one quintillion other situations

#

But we are in spigot

fallow sky
#

Yeah

#

We are in spigot

#

But whyyyyy it's not working ๐Ÿ˜ญ๐Ÿ˜ญ

rigid saffron
#

Because spigot does funky stuff

#

We'll have to look into specialsource maven plugin ig

fallow sky
fallow sky
#

Not shading it, it's +5 Mb ๐Ÿ’€

rigid saffron
#

Would be nice if md 5 himself could tell us

fallow sky
rigid saffron
#

Yeah

#

Sleepy md

inland spoke
#

I have my doubts that it is because spigot uses a special type of mappings

rigid saffron
#

I doubt that too

inland spoke
#

It is unlikely that md knows what it is

rigid saffron
#

But I don't understand why MinecraftServer stays unmapped

rigid saffron
inland spoke
#

I'm taking a look at it

rigid saffron
#

Finally, he has written all of this spigot and spigot mapping ecosystem

inland spoke
#

What are the steps of reproducing the issue - just building all the plugins and the issue appears or is it more involved?

rigid saffron
#

yeah, just building should do it

#

Build and run, should show the issue

#

But you might have to install a few things to your maven local

inland spoke
#

Well, first I need to run bt heh

#

seriously, I need to have 2FA enabled for this?
gah

rigid saffron
#

Lol

fallow sky
#

Don't forget the logs I'd sent before

rigid saffron
#

Probably because it does not exist or something

fallow sky
#

yeah

#

but if it's obfuscated, why ?

rigid saffron
#

I can't test rn but can you make a plugin (just a plugin, not a CVN one) that just calls Class.forName("net.minecraft.server.MinecraftServer") and Class.forName("net.minecraft.server.v1_19_R01.MinecraftServer") or whatever your version is and wraps both of them in a try catch to know which one failed and which did not

inland spoke
#

so - which jar am I supposed to use?

fallow sky
#

I searched a bit too

fallow sky
fallow sky
#

(it's said on build)

inland spoke
#

that one fails on a random exception

fallow sky
#

is that the latest commit?

#

you're not using the latest

inland spoke
#

well time to nuke the build directory then

fallow sky
#

I'd fixed that

fallow sky
inland spoke
#

oh right - I completely forgot that build doesn't invoke the shadowJar task (you should change that)

fallow sky
#

'cause well actually

rigid saffron
fallow sky
#

(in 1.17.1)

rigid saffron
#

What class was missing then

rigid saffron
fallow sky
#

class name isn't obfuscated, method, field etc. yes therefore

fallow sky
inland spoke
rigid saffron
#

I don't think it makes much of a difference

fallow sky
#

google says that too

rigid saffron
fallow sky
rigid saffron
#

The MinecraftServer class

fallow sky
#

oh okay

rigid saffron
#

I wanna see it

fallow sky
#

wait

inland spoke
#

donno, even more random exception now

fallow sky
fallow sky
#

I was a bit afraid of that x)

inland spoke
#

From the looks of it you are stripping the leading slash of the path

rigid saffron
fallow sky
inland spoke
#

well at least linux paths a much more sane than how it works under windows

fallow sky
#

in windows, we have sometimes /, sometimes \, sometimes there is a / at the end, or even a \

#

everything is perfect ๐Ÿ‘

#

and both can be present, like C:\Users/me/Documents\Hey Is That A Folder/hello\

#

oh, I messed up

#

then there is spaces, so you need to put " at the beginning and the end

#

I very like paths :/

fallow sky
fallow sky
inland spoke
#

I don't quite see where the error sneaks in though

fallow sky
rigid saffron
fallow sky
inland spoke
fallow sky
#

for 1.17.1

fallow sky
inland spoke
#

okay I think I got it now too

fallow sky
#

the / ?

#

@inland spoke see by yourself my "wonderful code"

rigid saffron
#

Here my favourite method (setUsesAuthentication)

inland spoke
#

well not exactly the workaround I would have gone with though

fallow sky
fallow sky
rigid saffron
rigid saffron
#

Awful

fallow sky
#

but I do my best x)

inland spoke
#

why is it even needed to strip the leading slash on windows?

fallow sky
#

I don't know why

#

Windows is shit ๐Ÿค“โ˜๏ธ

inland spoke
#

does it work anyways?

fallow sky
inland spoke
#

Might be a valid UNC path for what I know

fallow sky
#

not on linux

rigid saffron
#

Without reformatting anything

fallow sky
rigid saffron
#

And then toPath()

inland spoke
fallow sky
#

I was doing that before

rigid saffron
fallow sky
fallow sky
rigid saffron
#
import java.io.File;
import java.net.URISyntaxException;

public class JarPathFinder {
    public static void main(String[] args) {
        try {
            // Get the location of the class file of the main class
            String path = JarPathFinder.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath();

            // Convert the path to a file to get a normalized version
            File jarFile = new File(path);

            // Get the absolute path of the JAR file
            String jarFilePath = jarFile.getAbsolutePath();

            // Print the path to the JAR file
            System.out.println("Path to the JAR file: " + jarFilePath);
        } catch (URISyntaxException e) {
            e.printStackTrace();
        }
    }
}
``` chatgpt suggested me this
fallow sky
#

looks like I'm not doing this anymore

fallow sky
#

but let's listen to chatgpt a bit

rigid saffron
fallow sky
rigid saffron
#

Instead of jar path finder use the (bukkit) Server class

fallow sky
#

for sure

#

I'm not that dumb x)

rigid saffron
#

Who knows, who knows

fallow sky
rigid saffron
#

We need to make sure everything is ideal

fallow sky
#

there is still a lot of works to make everything ideal :/

rigid saffron
#

But eventually

#

It will be ideal

rigid saffron
#

Just that with every new mc version we will need to upload the mappings

fallow sky
#

but โœจ still the same error โœจ

rigid saffron
fallow sky
#

โœจ

rigid saffron
#

"aas"?

fallow sky
#

see by yourself

#

DedicatedServer, so the extend of MinecraftServer

#

the real form of CraftServer.getServer

rigid saffron