Create Plugin Tutorial?

  • Does anybody have a video tutorial regarding scripting new plugins? Nobody seems to show how to make plugins, only how to install plugins they downloaded. I've read both Getting Started and the Create a Plugin threads, and while they may make sense to someone experienced with Java tools, it seems as though I'm doing something wrong. It would help to see somebody set up a project from scratch, so a novice can see how to properly package a plugin. I recreated one of the scripts from the Create a Plugin thread to see if I can even load a plugin, but I'm not sure it's being compiled correctly. I'm using IntelliJ IDEA. My code is as follows:


    When I build the solution, it creates an output folder structured as follows:


    I'm guessing everything in the production is compiled into the loose JAR file, but when I put it in the Plugins folder for the New Version, nothing happens. I don't know it I set the Module up incorrectly or if it has something to do with the fact IntelliJ isn't recognizing the @Override lines. Any thoughts?

  • The code above looks fine (except the "1 usage" and "no usage" in lines 7 and 17, but that doesn't seem to be part of the code?).

    According to the folder structure, you will find the built plugin in the "artifacts" folder. Basically you just need the "TestPlugin.jar" file (unless you're using external assets like images or models, but that's a different story). Just move the "TestPlugin.jar" file into a separate folder in the "Plugins" dir, so it could look like this:

    Code
    Rising World
    |__ Plugins
    |__ TestPlugin
    |__ TestPlugin.jar


    When launching the game and loading a world, you should see the "Server name:" and "World Name:" output in the console/log. If that doesn't work, do you mind uploading the TestPlugin.jar here, so I can take a closer look at it? :)


    I've read both Getting Started and the Create a Plugin threads, and while they may make sense to someone experienced with Java tools, it seems as though I'm doing something wrong. It would help to see somebody set up a project from scratch, so a novice can see how to properly package a plugin

    Unfortunately the "Getting Started" and the "Create a Plugin" threads are a bit outdated... the content is still mostly valid for the new version, but we definitely want to rework them soon. We'll do that after the store page update ^^

  • The code above looks fine (except the "1 usage" and "no usage" in lines 7 and 17, but that doesn't seem to be part of the code?).

    You're correct. The "usage" lines are an internal feature of the IDE. I added it for illustration. I'm not sure why it says that when I can clearly see that there's logic in the method. I don't run into this very often when using C# in VisualStudio.

    When launching the game and loading a world, you should see the "Server name:" and "World Name:" output in the console/log. If that doesn't work, do you mind uploading the TestPlugin.jar here, so I can take a closer look at it? :)

    Absolutely, thank you. I'll attach the file. I added the JAR file with exactly the folder structure you mentioned. Although, when I went into the game and opened the console with the Tilde (~) key, the logs were empty. To make sure I was in the right log, I type in some console commands, looking for things that referenced System, Print, Plugin. The console seemed to be in working order, so I assumed it was my script.

    I converted the JAR to ZIP, inspected the folder structure, and it seemed fine. The yml file, class file, and manifest were all there. I don't know what the issue is. This is the first time I'm using an API, so I'm still figuring out how to hook into the methods and events. This is the reason I tried starting with some simple print strings before tackling more complex stuff like adding "modifiers," or so-called stats, to some of the clothes. I like some of the hats, but at the moment, the mining helmet is reasonably the most functional option. Haha once I understood importing and hooking, I thought I'd try making the chef hat reduce cooking time, the bear mask affecting the bear's aggression, or the camo hat affecting how close I can get to deer before they run off. That sort of thing.

    TestPlugin.jar

  • println will print to the games console not the console with the tilda key.



    begin with something like this


    this will send "test text" to the chat window for the player running the command (/test)


    ive been thinking of puting together a small discord for plugin development. let me know if you would be interested.

  • I've been thinking of putting together a small discord for plugin development. let me know if you would be interested.

    I'm totally interested. I'm super active on Discord, but I'm not in any programming communities. It would be nice to join a server where I can talk about plugins and mods without getting slammed by 50+ gifs shaking their finger at me. :lol:

    println will print to the games console not the console with the tilda key.

    Oh, okay. I suspected that might be the case. Thank you. I couldn't figure out how to bring up any other console besides the Tilda key. I did eventually change the script, thinking maybe I should try something more visible, so I attempted to hook into the PlayerConnectEvent class to just set the current health to 50. lol maybe I need to use the player spawn; I assume I'll figure it out sooner or later. I've worked with C#, but I'm new to Java. It seems I'm failing to understand how to create a functional method. For instance, I registered the EventListener in onEnable(), but the onPlayerConnect() is never used despite it having logic and the import statement is being used.

    Even if I add the method you shared, I get the same warning:
    1. Method 'onPlayerConnect(net.risingworld.api.events.player.PlayerConnectEvent)' is never used
    2. Method 'onCommand(net.risingworld.api.events.player.PlayerCommandEvent)' is never used

    I don't know if I should be checking to see if they're not null or anything, but I'm trying to learn more about Java because I enjoy playing Rising World and I'm grateful that there's an API that allows me to participate.

  • until 3 or 4 years ago i hadnt coded anything besides some html in the 90's. threw red51's help (and few others ) ive made some stuff i think is cool. my code is kinda messy but it does what i want it to do and im always learning. ill set a discord up and maybe make it for beginners lol. i not trying to rewrite java but have fun. tbh i have more fun making plugins than playing lol. as your it saying no uses, i use netbeans but i think with intelij its saying no usages as there is technically no usages until its called by the games event handler? so the overrides according to intelij are not being used. also i would use the onplayerspawnevent to set health as there is no guarantee the playerobject is created yet when it calls the event. for testing purposes you can do something like


  • Right on. Thanks for the feedback. I think you're right. It probably does need to be called by the handler in the game. I'll try these out because I really want to start experimenting with plugins. If you do decide to make that Discord, definitely hit me up. Whether for beginners, intermediate, or expert, it's not a problem; I'm interested in it. Even if you just want to add my handle, that would be awesome too. I have some basic knowledge, but I'm always trying to improve. I've looked through the plugins here and there are many creative people. I think it's cool.

  • Although, when I went into the game and opened the console with the Tilde (~) key, the logs were empty

    Sorry for the confusion :saint: As mentioned by james1bow , I was referring to the debug console (showing all outputs of the game which would end up in the log file, too), not the ingame console that can be opened by pressing tilde ^^

    Unfortunately the debug console isn't enabled by default, but you can enable it by opening the config.properties file (in the "_New Version" folder in the game directory) with a text editor and setting Game_DebugConsole to True. The debug console is a separate window, so it's also useful to run the game in windowed mode then (so the debug console remains visible)

  • Unfortunately the debug console isn't enabled by default, but you can enable it by opening the config.properties file (in the "_New Version" folder in the game directory) with a text editor and setting Game_DebugConsole to True. The debug console is a separate window, so it's also useful to run the game in windowed mode then (so the debug console remains visible)

    Oh, of course. This totally makes sense. Haha I open the Player.log, the Tilda key, chat... it never even dawned on me to open the config file. Thank you very much for the reply; this helps so much. ^^

  • Creating a JAVA plugin project for Rising World in Eclipse ... but in German

    Wiki: Plugin-Erstellung / Eclipse Entwicklungsumgebung

    This is good. Thank you. I don't mind if it's in a different language. I once followed an entire YouTube tutorial in German for creating a construction system in UE4. And then I followed a tutorial in French and combined the two systems in my project. Hahaha there were some bugs, naturally, but it was a decent project overall. :lol:

  • ... I like some of the hats, but at the moment, the mining helmet is reasonably the most functional option. Haha once I understood importing and hooking, I thought I'd try making the chef hat reduce cooking time, the bear mask affecting the bear's aggression, or the camo hat affecting how close I can get to deer before they run off. That sort of thing.
    ...

    What a nice idea ! Looking forward to it :D (and just did learn a few things about plugins)

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!