World Hopper Helper

BeginnerDisplay

Displays current world number and provides quick world information. Shows how to access world data.

6 min read

What It Does

Displays current world number and provides quick world information. Shows how to access world data.

Source Code

java
1package com.example;
2
3import net.runelite.api.Client;
4import net.runelite.client.ui.overlay.Overlay;
5import net.runelite.client.ui.overlay.OverlayManager;
6import net.runelite.client.plugins.Plugin;
7import net.runelite.client.plugins.PluginDescriptor;
8import javax.inject.Inject;
9import java.awt.*;
10
11@PluginDescriptor(
12    name = "World Hopper Helper",
13    description = "Shows current world"
14)
15public class WorldHopperPlugin extends Plugin {
16    @Inject
17    private Client client;
18
19    @Inject
20    private OverlayManager overlayManager;
21
22    private final Overlay overlay = new Overlay() {
23        @Override
24        public Dimension render(Graphics2D graphics) {
25            int world = client.getWorld();
26            graphics.setColor(Color.WHITE);
27            graphics.drawString("World: " + world, 10, 10);
28            return new Dimension(100, 20);
29        }
30    };
31
32    @Override
33    protected void startUp() {
34        overlayManager.add(overlay);
35    }
36
37    @Override
38    protected void shutDown() {
39        overlayManager.remove(overlay);
40    }
41}

Code Annotations

Line 24

Get current world number

API Classes Used

Key Concepts

  • Get current world number

Next Steps

  • Learn about world API
  • Add world type information
  • Add world hop shortcuts