Osiris-Team / AutoPlug-Plugin

Enables AutoPlug-Client command execution from inside Minecraft.
https://autoplug.one/
Other
6 stars 1 forks source link

Add ``.k(b)``/``.kill (both)`` command (Or ``.t(b)``/``.terminate (both)``) for Plugin #9

Open Minionguyjpro opened 2 months ago

Minionguyjpro commented 2 months ago

Importance: 6/10

Problem: I've had a moment where my friend accidentally killed all mobs in my server. In that case, it would be nice to have a kill option to immediately stop the server to prevent it from autosaving and make it return to the latest autosave for example. I miss this functionality right now in AutoPlug itself and the AutoPlug plugin for Spigot (am using Purpur, a fork of Paper and yet Paper is a fork of Spigot) and it'd be nice to have so I don't for example need to restore a 15 minute old backup so we can keep progress lose to max. 5 minutes. This is good to have for more things, in case things in the launch of the server may get glitched but the client would still respond.

Solution: Add a command to kill the Minecraft Java instance itself and to kill the final Java instance for the server + AutoPlug itself. (So like you'd have .st and stop (both) you could do the exact same for killing the processes by force).

Minionguyjpro commented 2 months ago

Oops, @Osiris-Team. I see that this already exists, but not in the plugin yet! Then it's a feature request for the in-game plugin.

Osiris-Team commented 2 months ago

@Minionguyjpro feel free to implement it yourself, it should be pretty similar to how .stop both is implemented. Looking forward to your PR. (Should be doable even if you never coded before and are new to Java, get started: https://youtu.be/RRubcjpTkks?si=nZagXXx4rrNztf7u and https://github.com/Osiris-Team/AutoPlug-Plugin?tab=readme-ov-file#autoplug-plugin--contribute)

Minionguyjpro commented 2 months ago

@Minionguyjpro feel free to implement it yourself, it should be pretty similar to how .stop both is implemented. Looking forward to your PR. (Should be doable even if you never coded before and are new to Java, get started: https://youtu.be/RRubcjpTkks?si=nZagXXx4rrNztf7u and https://github.com/Osiris-Team/AutoPlug-Plugin?tab=readme-ov-file#autoplug-plugin--contribute)

Thank you! I've made a fork with the chances. I am going to test it right now on a Purpur 1.20.4 server I run at home. If it works, I will create the PR and wait for you to get it merged!

Minionguyjpro commented 2 months ago

Okay @Osiris-Team, the GUI works! But the command doesn't. It just outputs the command that has been ran itself after typing it and doesn't execute. Any idea?

Minionguyjpro commented 2 months ago

Nevermind, I think I found the problem in the Startup.java file! Forgot to add them there. Will try again and tell how it goes.

Minionguyjpro commented 2 months ago

@Osiris-Team Done! See PR #10.

Minionguyjpro commented 2 months ago

Are you already ready to release version 1.2? Or maybe someone should also add all the other AutoPlug commands to the plugin?

Osiris-Team commented 2 months ago

@Minionguyjpro do you want to add the other commands too? If so yeah I can wait for your PR before releasing.

Minionguyjpro commented 2 months ago

@Minionguyjpro do you want to add the other commands too? If so yeah I can wait for your PR before releasing.

I can do so. I noticed though that the .install plugin spigot does a bit weird and noever finds one. Or gives an error. I can show off later.

Osiris-Team commented 2 months ago

It expects a spigot id in that case.

Osiris-Team commented 2 months ago

@Minionguyjpro another thing that would be great: I think is that currently if you have the autoplug.plugin.gui permission you can just open the GUI and execute everything in there by clicking on the items, instead this should actually execute the command as the player which then would check if you have the permission to execute that command.

Minionguyjpro commented 2 months ago

For this command, I already added it to the GUI.