Implementing a Guild System in Atavism Using LearnPress: Part I
Prerequisites:
- Access and familiarity with the AGIS code for Atavism.
- The AGIS project set up in an Integrated Development Environment (IDE) like Eclipse.
- Familiarity with Java programming.
- Setting up AGIS in Eclipse
- Building and Testing Your AGIS
Step 1: Crafting the Plugin.java File
Begin by creating a Plugin.java
file within the AGIS project. This file manages client communications for guild activities (e.g., guild creation or chat messaging).
Key Components:
- GuildPlugin Constructor: Initializes the plugin type for server recognition.
public GuildPlugin() {
super(GUILD_PLUGIN_NAME);
setPluginType("Guild");
}
- Logger: Useful for debugging.
protected static final Logger log = new Logger("Guild");
- onActivate Function: Activates the plugin, setting up message filters and hooks.
public void onActivate() {
Log.debug("GUILD PLUGIN: activated");
registerHooks();
}
- registerHooks Function: Placeholder for future message hooks.
protected void registerHooks() {
}
Step 2: Establishing the Client.java File
The Client.java
file inside the atavism.agis.plugins
package serves as an intermediary for server messaging, defining plugin interactions.
Initial Setup:
package atavism.agis.plugins;
public class GuildClient {
protected GuildClient() {
}
}
Step 3: Implementing the Python Script
This script registers the plugin and can adjust settings without recompiling the AGIS code.
Python Script:
from atavism.server.engine import Engine
Engine.registerPlugin(“atavism.agis.plugins.GuildPlugin”)
Step 4: Integrating the Plugin with the Server Start-Up Script
- Modify
world.sh
: Add-p Guild,1
to thePLUGIN_TYPES
list. - Include the Python Script: Insert the line
"${AO_WORLD_CONFIG}"/guildplugin.py \
in theobjmgr
process code block.
Step 5: Verifying the Plugin Activation
Upon server start-up, check the objmgr.out
log for the “GUILD PLUGIN: activated” message, indicating successful integration.
Advanced Steps for Version 10.8.0+
- Update
ServerStarter.java
: AddstartGuild()
method insrc/atavism/agis/server/ServerStarter.java
. - Modify
AllInOneServer.java
: Incorporate thestartGuild()
call in thepostScript
function.
By following these steps, you’ll have a functional Guild System plugin for Atavism, integrated seamlessly with LearnPress for an effective learning experience. Remember, this guide focuses on the initial setup and integration, with more detailed functionalities to be added as per your project requirements.