MinecraftDev icon indicating copy to clipboard operation
MinecraftDev copied to clipboard

Added Kotlin support for Bukkit, Spigot and PaperMC projects.

Open Lasslos opened this issue 4 years ago • 20 comments

I added Kotlin support for Bukkit, Spigot and PaperMC projects.

Plus, Kotlin support is easily extendable on any other platform. Just declare in your module that you support Kotlin override val supportedLanguages: List<LanguageType> = listOf(LanguageType.JAVA, LanguageType.KOTLIN) and your ready to go. In your builder, you will be provided a LanguageType instance that can be used to acctually support multiple languages.

Lasslos avatar Jul 25 '21 20:07 Lasslos

Thanks for your detailed feedback, I'll soon edit my fork. Sorry that I changed so many unnecessary things like imports etc, that's because I've chosen optimise imports when I committed in Intellij.

Lasslos avatar Aug 20 '21 11:08 Lasslos

Your last commit doesn't look right. You should drop it and do a rebase against dev instead of a merge.

RedNesto avatar Aug 24 '21 11:08 RedNesto

I hope this is better now. This is the first time me contributing to an open source project so I'm not very experienced... Sorry about that.

Lasslos avatar Aug 24 '21 12:08 Lasslos

Ah not quite there, but don't worry I messed up many of my PRs with that ^^

I can probably do it for you when I get enough time.

RedNesto avatar Aug 24 '21 13:08 RedNesto

That would be great.

Lasslos avatar Aug 24 '21 14:08 Lasslos

Done, I also fixed the various formatting problems.

The simplest way for you to get the new commits is to pull your origin/dev branch, or reset against it after a fetch.

RedNesto avatar Aug 24 '21 15:08 RedNesto

Thank you, I will focus on changing the actual code. And btw, I am using GitHub Desktop, so pulling and pushing is no problem at all.

Lasslos avatar Aug 24 '21 19:08 Lasslos

You broke it again...

RedNesto avatar Aug 24 '21 19:08 RedNesto

I changed a lot of things now. But, there are still a lot of files changed that I didn't want to change. Could it be that something went wrong when rebasing the project?

Lasslos avatar Aug 24 '21 20:08 Lasslos

The reason it got bad again is because you did not reset/recreate the branch like I told you, so you pulled my changes on top of the previous broken commits. I'll fix it once more and this time you delete you local branch and pull the remote fresh.

RedNesto avatar Aug 24 '21 20:08 RedNesto

Oh, now I understand. Sorry about that. When I read your message "the best way to get the new commits" I thought oh nice at least I know how to do that :/. Apparently I didn't. But thank you that you fix it for me!

Lasslos avatar Aug 24 '21 21:08 Lasslos

Here it is, with little improvements to fix one of my comment, and to fix the default language checkbox selection.

Also remember to properly format the files before committing, see https://github.com/minecraft-dev/MinecraftDev#ide-setup

Do you plan to add templates for other platforms and/or Gradle's Kotlin DSL ?

RedNesto avatar Aug 24 '21 22:08 RedNesto

I was planning to do this, but I'm not an expert in these platforms, so I have to see which buildsscripts are easy to change. Is every platform JVM-Only?

Lasslos avatar Aug 25 '21 07:08 Lasslos

Yes all supported platforms run on the JVM. If you don't feel like doing it don't worry, I can handle most of the other platforms without much trouble (except fabric)

As it is right now this PR could be merged soon-ish (but it will sit in nightly for what I expect to be a long time) so we have a lot of time to smooth things out if needed.

RedNesto avatar Aug 25 '21 07:08 RedNesto

What's the status on this PR?

kanpov avatar Nov 05 '21 14:11 kanpov

Idk, I fixed everything requested. I guess everyone (including me) kinnda forgot about it ¯_(ツ)_/¯

Lasslos avatar Nov 05 '21 15:11 Lasslos

Hi, its 2022 now and I just wanted to ask how this PR is doing. I will (hopefully) have a lot of time to work on my projects in a couple weeks. Is there anything that needs to be done?

Lasslos avatar Jan 13 '22 03:01 Lasslos

What is needed is kotlin templates for all the other platforms, and maybe figure out what's the best way to have kotlin in the runtime (plugin/mod dependency probably, unsure yet but this can wait)

I wanted to do the other templates in september but I got unexpectedly busy. Will try to get some time to at least add the Sponge and Forge templates.

And please stop making useless merge commits, they're unnecessary noise ^^

RedNesto avatar Jan 13 '22 08:01 RedNesto

Hi, I tried to work on the templates+integration today and realized, that somehow, my fork is broken.

I cant get anything to work, everything says unresolved reference. Screenshot from 2022-03-09 19-11-33

I double checked that everything is working on this version. I don't wanna bother you with this issue and will hopefully find a solution but if anyone had a similar problem and knows something about that any help would be appreciated.

Lasslos avatar Mar 10 '22 02:03 Lasslos

For some reason it is fixed now, i dont really understand Gradle so cant tell you why

Lasslos avatar Mar 10 '22 04:03 Lasslos

For some reason it is fixed now, i dont really understand Gradle so cant tell you why

Any update on this mate? You would be doing the world a huge favour 🙏

sttephen avatar Jun 19 '23 02:06 sttephen

Hi there, sorry for the delay.

State/History

I changed some code that added Kotlin support for Bukkit, Spigot and PaperMC two years ago. Admittedly, it wasn't good code by any means (I was quite unexperienced and still am, but I think I've learned :smile: ), but it works. Now after some changes, we have reached an acceptable state for Bukkit, Spigot and Paper (as far as I can remember, however I didn't look at the code again as I am writing this)

Open things

  • Review Old Code - I (or anyone) should definitely review all the code that's been added
  • Check if the way Kotlin is implemented makes sense - I just remember not really knowing what I am doing, so maybe we should review if what I have added back then makes sense where it is, or if it should follow a different design pattern
  • Test - The code needs to be tested extensively, especially with newer versions of Minecraft as I don't know if everything still works the same
  • (most important) Add Kotlin templates for all the other Project Types

To generate these Templates or to get an idea of how they should look like, you can create a Java Project and then use IntelliJs "Convert to Kotlin Project" function, as that usually outputs a working gradle build script. This is also the workaround that can be used to code plugins in Kotlin, doesnt work great tho.

I have not had huge interest in this project recently, but I am happy to pick it up again with a few contributes, which would especially help with adding Kotlin for the other project types.

Is there any interest in this being actively worked on again? I'd appreciate your feedback as well as your points that have to be done in your opinion.

Lasslos avatar Jul 06 '23 05:07 Lasslos

I just looked into the code and saw that there were massive improvements all over the plugin, making it less work to redo the work I did earlier. I've created the branch kotlin, which is up to date with this project's dev branch, and moved the old code to olddev.

Because there are no more commits in dev, this pull request automatically closed, but we can continue any discussion here. I would suggest creating a new PR and merging it immediately as soon as we are all convinced the feature is ready, but I am open to any other suggestions as well doing some git magic to reopen this PR and renaming some branches, but I don't think that's worth the trouble.

Lasslos avatar Jul 12 '23 18:07 Lasslos