Initial commit

This commit is contained in:
Alex Matheson
2022-06-09 00:40:58 +10:00
commit 10ff406a1a
12 changed files with 464 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
package com.example;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup("example")
public interface ExampleConfig extends Config
{
@ConfigItem(
keyName = "greeting",
name = "Welcome Greeting",
description = "The message to show to the user when they login"
)
default String greeting()
{
return "Hello";
}
}

View File

@@ -0,0 +1,53 @@
package com.example;
import com.google.inject.Provides;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
import net.runelite.api.GameState;
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;
@Slf4j
@PluginDescriptor(
name = "Example"
)
public class ExamplePlugin extends Plugin
{
@Inject
private Client client;
@Inject
private ExampleConfig config;
@Override
protected void startUp() throws Exception
{
log.info("Example started!");
}
@Override
protected void shutDown() throws Exception
{
log.info("Example stopped!");
}
@Subscribe
public void onGameStateChanged(GameStateChanged gameStateChanged)
{
if (gameStateChanged.getGameState() == GameState.LOGGED_IN)
{
client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Example says " + config.greeting(), null);
}
}
@Provides
ExampleConfig provideConfig(ConfigManager configManager)
{
return configManager.getConfig(ExampleConfig.class);
}
}

View File

@@ -0,0 +1,13 @@
package com.example;
import net.runelite.client.RuneLite;
import net.runelite.client.externalplugins.ExternalPluginManager;
public class ExamplePluginTest
{
public static void main(String[] args) throws Exception
{
ExternalPluginManager.loadBuiltin(ExamplePlugin.class);
RuneLite.main(args);
}
}