What's new

Welcome to RetroTools.XYZ - We Make It Easier To Manage Your Habbo Retro By Yourself!

Join us now to get access to all our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, and so, so much more. It's also quick and totally free, so what are you waiting for?

Free Nitro Websocket Proxy

Tired of paying to avoid random disconnections and want better protection on your Habbo Retro? Please click the icon on the top right.

Answer

Answer Questions and Become an Expert on Your Topic

Contact Staff

Our Experts are Ready to Answer your Questions

[Arcturus] Plugin Tutorial: How to add custom commands

RetroPlug

Member
Staff member
Management Team
Joined
Nov 12, 2020
Messages
37
Reaction score
13
Points
8
How to add custom commands to Arcturus

This tutorial assumes you've set up the Arcturus plugin environment as described here.

In this tutorial, we will be creating a new command and registering it. The command will only send an alert to the triggering Habbo.

Step 1: Creating a new java file.
First of creating a new file and name it CustomCommand. This is the code file in which we will be writing our code to handle our command.

Step 2: Extending the Command class.
Have the CustomCommand class extend the Command class.

Because Arcturus must know that we are dealing with a command we have to extend the Command class.

Step 3: Implementing the super constructor.
If you have enabled error reporting IntelliJ will tell you that you must implement the constructor. This will create a constructor with the same arguments as the super constructor. Ignore the error for now.

Now as we have to create a new instance we must implement a constructor as the superclass also implements a constructor and must call the super constructor. We can do that like this:

To add the constructor add:

Code:
Please, Log in or Register to view codes content!

The first argument is the permission node that will be checked to make sure the Habbo that runs the command is actually allowed to do so. You can put null ("Without quotes") to disable this check.
The second argument is of the type String[] which contains all the keys that will trigger this command. This is without the : part. In our case, we will be running the command via :customcommand so we specify customcommand. You can add more keys as you wish.

Step 5: Adding our command handling.
Override the
Please, Log in or Register to view URLs content!


IntelliJ will tell you that you must implement the handle() function. Press alt+enter and choose to Implement Methods

Step 6: Handling commands.

The handle function will be called whenever a Habbo runs our command. This is the function in which you can implement your logic.

For now, we will just send an alert to the Habbo by sending the alert packet which is as follows:

Code:
Please, Log in or Register to view codes content!

The function must return whether the command was successfully executed either with true or false

Your CommandClass.java file will look something like this:

Code:
Please, Log in or Register to view codes content!

Step 7: Registering our command.
To register our command go to your plugin class and in the constructor add:

Code:
Please, Log in or Register to view codes content!
 
shape1
shape2
shape3
shape4
shape7
shape8
Top