mirror of
https://github.com/runelite/plugin-hub.git
synced 2026-01-28 16:21:46 -05:00
Initial commit
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
|
||||
package ${package};
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup("${plugin_config_group}")
|
||||
public interface ${plugin_prefix}Config extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "greeting",
|
||||
name = "Welcome Greeting",
|
||||
description = "The message to show to the user when they login"
|
||||
)
|
||||
default String greeting()
|
||||
{
|
||||
return "Hello";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package ${package};
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@PluginDescriptor(
|
||||
name = "${name}"
|
||||
)
|
||||
public class ${plugin_prefix}Plugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private ${plugin_prefix}Config config;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
log.info("${name} started!");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
log.info("${name} stopped!");
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged gameStateChanged)
|
||||
{
|
||||
if (gameStateChanged.getGameState() == GameState.LOGGED_IN)
|
||||
{
|
||||
client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "${name} says " + config.greeting(), null);
|
||||
}
|
||||
}
|
||||
|
||||
@Provides
|
||||
${plugin_prefix}Config provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(${plugin_prefix}Config.class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user