Refactor WildernessLocations
This commit is contained in:
@@ -28,14 +28,13 @@ public class WildernessLocationsOverlay extends Overlay
|
||||
private WildernessLocationsConfig wildyConfig;
|
||||
|
||||
@Inject
|
||||
public WildernessLocationsOverlay(Client client, WildernessLocationsPlugin plugin)
|
||||
public WildernessLocationsOverlay(WildernessLocationsPlugin plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||
setPriority(OverlayPriority.HIGH);
|
||||
setPosition(OverlayPosition.BOTTOM_RIGHT);
|
||||
textComponent = new TextComponent();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,13 +10,12 @@
|
||||
package net.runelite.client.plugins.wildernesslocations;
|
||||
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
@@ -34,7 +33,6 @@ import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.input.KeyManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginManager;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import net.runelite.client.util.HotkeyListener;
|
||||
@@ -42,10 +40,10 @@ import net.runelite.client.util.WildernessLocation;
|
||||
|
||||
@Slf4j
|
||||
@PluginDescriptor(
|
||||
name = "Wild Locations",
|
||||
description = "Indicates the players current location in the wild",
|
||||
tags = {"Wildy", "Wilderness Location", "location", "loc", "pvp", "pklite"},
|
||||
type = PluginType.PVP
|
||||
name = "Wild Locations",
|
||||
description = "Indicates the players current location in the wild",
|
||||
tags = {"Wildy", "Wilderness Location", "location", "loc", "pvp", "pklite"},
|
||||
type = PluginType.PVP
|
||||
)
|
||||
public class WildernessLocationsPlugin extends Plugin
|
||||
{
|
||||
@@ -76,7 +74,6 @@ public class WildernessLocationsPlugin extends Plugin
|
||||
|
||||
private String oldChat = "";
|
||||
private int currentCooldown = 0;
|
||||
private final int COOLDOWN_TICKS = 30;
|
||||
private WorldPoint worldPoint = null;
|
||||
private final HashMap<WorldArea, String> wildLocs = getLocationMap();
|
||||
|
||||
@@ -154,7 +151,7 @@ public class WildernessLocationsPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
if (client.getLocalPlayer().getWorldLocation().getY() >
|
||||
(Objects.requireNonNull(closestArea).toWorldPoint().getY() + closestArea.getHeight()))
|
||||
(Objects.requireNonNull(closestArea).toWorldPoint().getY() + closestArea.getHeight()))
|
||||
{
|
||||
s = s + "N";
|
||||
}
|
||||
@@ -167,7 +164,7 @@ public class WildernessLocationsPlugin extends Plugin
|
||||
s = s + "W";
|
||||
}
|
||||
if (client.getLocalPlayer().getWorldLocation().getX() >
|
||||
(closestArea.toWorldPoint().getX() + closestArea.getWidth()))
|
||||
(closestArea.toWorldPoint().getX() + closestArea.getWidth()))
|
||||
{
|
||||
s = s + "E";
|
||||
}
|
||||
@@ -184,7 +181,7 @@ public class WildernessLocationsPlugin extends Plugin
|
||||
{
|
||||
HashMap<WorldArea, String> hashMap = new HashMap<>();
|
||||
Arrays.stream(WildernessLocation.values()).forEach(wildernessLocation ->
|
||||
hashMap.put(wildernessLocation.getWorldArea(), wildernessLocation.getName()));
|
||||
hashMap.put(wildernessLocation.getWorldArea(), wildernessLocation.getName()));
|
||||
return hashMap;
|
||||
}
|
||||
|
||||
@@ -234,6 +231,6 @@ public class WildernessLocationsPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
sendMessage("/World: " + client.getWorld() + " Location: " + location);
|
||||
currentCooldown = COOLDOWN_TICKS;
|
||||
currentCooldown = 30;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user