This is an alternative command system, written and tested for MoopleDEV rev 90.
It's main feature is that commands will auto update (WITHOUT having to restart
the server). The only draw back to this system is that it may prove to be a little
difficult to set up for inexperienced programmers. If you follow my instructions
step-by-step you shouldn't run into any troubles.
-----------------------------------------------
Step 1:
Install MoopleDEV. Make sure it actually RUNS and there are no errors that you caused.
If you can't install MoopleDEV then I'm afraid I can't help you.
-----------------------------------------------
Step 2:
Close NetBeans/Eclipse and anything else you happen to have open.
If you do not do this step, you may accidently over-write files.
-----------------------------------------------
Step 3:
Open your MoopleDEV folder.
Inside your MoopleDEV folder should be another folder called "src"
Open this folder and navigate to the following location:
MoopleDEV/src/client/
(I.E. double click on "src" then on "client")
-----------------------------------------------
Step 4:
You should see another folder called "command"
DELETE this folder (or move it, in the event you want a backup)
-----------------------------------------------
Step 5:
Copy the "commands" folder (found in this .zip file) into your "client" folder.
In other words, you're replacing your "command" folder with my "commands" folder.
-----------------------------------------------
Step 6:
Go back to your "MoopleDEV" folder.
Click on "src"
Click on "net"
Click on "channel"
Click on "handler"
Find "GeneralChatHandler.java"
Replace this file with my "GeneralChatHandler.java" (found in this .zip file)
To replace:
Drag my GeneralChatHandler.java file into the folder
In other words, replace the following file:
MoopleDEV/src/net/channel/handler/GeneralChatHandler.java
with my GeneralChatHandler.java file.
-----------------------------------------------
Step 7:
Open up NetBeans (or Eclipse, or whatever you use to edit files)
-----------------------------------------------
This is where it starts getting harder, but you can do it!
The following instructionst are specifically for NetBeans! If you would rather
use Eclipse or some differnt IDE, you must be smart about what you need to change.
Step 8:
Open up the file "ServerConstants.java" which is in the "constants" folder
-----------------------------------------------
Step 9:
In that file, find the following line:
public static final String HOST = "...";
Directly UNDER that file, paste the following lines:
/**
* How long (in milliseconds) the server should wait before re-checking files.
*
* Increase to improve performance.
*/
public static final int COMMAND_CHECK_INTERVAL = 3000; // 3 seconds
/**
* The directory where your IDE stores .class files.
* NOTE: Must point to the client.commands.impl location
*/
public static final String CLASS_DIR = "<PATH_TO_MOOPLE>/build/classes/client/commands/impl";
-----------------------------------------------
Step 10:
Replace the <PATH_TO_MOOPLE> with your actual path!
For example, my path would be:
C:/Users/<MY_NAME>/Desktop/MoopleDEV
which means my CLASS_DIR looks like:
public static final String CLASS_DIR = "C:/Users/<MY_NAME>/Desktop/MoopleDEV/build/classes/client/commands/impl";
BE SURE TO USE FORWARD SLASHES (/)... NOT BACK SLASHES (\)! I don't care if you're using windows, use forward slashes :P
-----------------------------------------------
Step 11:
Build your Project by pressing F11 (Or by going to Run > Build Main Project)
-----------------------------------------------
Step 12:
Enjoy!
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
In order for the commands to update you MUST re-build every time.
E.x. if you want to change the command !ap then you should:
A) Change everything you're gonna change
B) "Build" your project (F11)
C) Wait for NetBeans to finish building...
D) Enjoy, your command has automatically updated
Few things you should be aware of:
1) There is a command called "listcommands" which will list all of the commands
you can USE. This DOES NOT auto-update (waste of resources). In order to update
it, simply login and use the command "!listcommands update" exactly like that.
--> Of course, you only need to update if you DELETE or CREATE new commands.
2) Continiously checking if the command changed would be a waste of resources so it
only checks once every 3 seconds (at max). Please note that if you "build" again,
there is a good chance the program will be lead to believe you changed every command
even if you didn't. Don't worry too much about this as loading new commands does
not take all that long.
3) Your bats will display information when commands are loaded (so you can tell if
something is going screwy and it's constantly reloading commands). Don't worry,
those are NOT error messages. There will be an influx of loading when the first
command is used (as all commands will be loaded at once).