Merge remote-tracking branch 'upstream/master' into vijfeuroopjemuil

This commit is contained in:
sdburns1998
2019-07-07 22:45:08 +02:00
291 changed files with 13732 additions and 13410 deletions

View File

@@ -438,7 +438,7 @@ public class MenuManager
@Subscribe
public void onMenuOptionClicked(MenuOptionClicked event)
{
if (!client.isMenuOpen())
if (!client.isMenuOpen() && event.isAuthentic())
{
rebuildLeftClickMenu();

View File

@@ -445,7 +445,7 @@ public class BoostsPlugin extends Plugin
this.displayInfoboxes = config.displayInfoboxes();
this.displayIcons = config.displayIcons();
this.boldIconFont = config.boldIconFont();
this.displayNextBuffChange = config.displayNextDebuffChange();
this.displayNextBuffChange = config.displayNextBuffChange();
this.displayNextDebuffChange = config.displayNextDebuffChange();
this.boostThreshold = config.boostThreshold();
this.groupNotifications = config.groupNotifications();

View File

@@ -36,6 +36,7 @@ import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.FocusChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
@@ -93,6 +94,10 @@ public class FpsPlugin extends Plugin
private final ScheduledExecutorService pingExecutorService = new ExecutorServiceExceptionLogger(Executors.newSingleThreadScheduledExecutor());
private boolean loaded = false;
private boolean shutdown;
@Getter(AccessLevel.PACKAGE)
private FpsLimitMode limitMode;
@@ -128,6 +133,12 @@ public class FpsPlugin extends Plugin
overlay.onFocusChanged(event);
}
@Subscribe
public void onGameStateChanged(GameStateChanged event)
{
shutdown = event.getGameState() != GameState.LOGGED_IN;
}
@Override
protected void startUp() throws Exception
{
@@ -137,7 +148,13 @@ public class FpsPlugin extends Plugin
overlayManager.add(overlay);
drawManager.registerEveryFrameListener(drawListener);
drawListener.reloadConfig();
pingExecutorService.scheduleAtFixedRate(this::getPingToCurrentWorld, 5, 5, TimeUnit.SECONDS);
shutdown = client.getGameState() != GameState.LOGGED_IN;
if (!loaded)
{
pingExecutorService.scheduleAtFixedRate(this::getPingToCurrentWorld, 5, 5, TimeUnit.SECONDS);
loaded = true;
}
}
@Override
@@ -145,12 +162,12 @@ public class FpsPlugin extends Plugin
{
overlayManager.remove(overlay);
drawManager.unregisterEveryFrameListener(drawListener);
pingExecutorService.shutdown();
shutdown = true;
}
private void getPingToCurrentWorld()
{
if (client.getGameState().equals(GameState.LOGGED_IN) && drawPing)
if (!shutdown && drawPing)
{
ping = Ping.ping(String.format("oldschool%d.runescape.com", client.getWorld() - 300));
}

View File

@@ -115,4 +115,15 @@ public interface NpcAggroAreaConfig extends Config
{
return false;
}
@ConfigItem(
keyName = "sendNotification",
name = "Send notification",
description = "Send a notification when the timer runs out",
position = 7
)
default boolean sendNotification()
{
return false;
}
}

View File

@@ -86,6 +86,10 @@ class NpcAggroAreaOverlay extends Overlay
outlineColor.getBlue(),
100);
}
else
{
plugin.doNotification();
}
renderPath(graphics, lines, outlineColor);
return null;

View File

@@ -48,6 +48,7 @@ import net.runelite.api.ItemID;
import net.runelite.api.NPC;
import net.runelite.api.NPCDefinition;
import net.runelite.api.Perspective;
import net.runelite.api.Player;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldArea;
import net.runelite.api.coords.WorldPoint;
@@ -56,6 +57,7 @@ import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.NpcSpawned;
import net.runelite.api.geometry.Geometry;
import net.runelite.client.Notifier;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.ItemManager;
@@ -116,6 +118,9 @@ public class NpcAggroAreaPlugin extends Plugin
@Inject
private ConfigManager configManager;
@Inject
private Notifier notifier;
@Getter(AccessLevel.PACKAGE)
private final WorldPoint[] safeCenters = new WorldPoint[2];
@@ -137,12 +142,15 @@ public class NpcAggroAreaPlugin extends Plugin
private boolean showNotWorkingOverlay;
@Getter(AccessLevel.PACKAGE)
private boolean hideOverlayHint;
@Getter(AccessLevel.PACKAGE)
private boolean sendNotification;
private WorldPoint lastPlayerLocation;
private WorldPoint previousUnknownCenter;
private boolean loggingIn;
private List<String> npcNamePatterns;
private boolean notWorkingOverlayShown = false;
private boolean hasSentNotification = false;
@Provides
NpcAggroAreaConfig provideConfig(ConfigManager configManager)
@@ -259,6 +267,7 @@ public class NpcAggroAreaPlugin extends Plugin
BufferedImage image = itemManager.getImage(ItemID.ENSOULED_DEMON_HEAD);
currentTimer = new AggressionTimer(duration, image, this, active && this.showTimer);
infoBoxManager.addInfoBox(currentTimer);
hasSentNotification = false;
}
private void resetTimer()
@@ -411,6 +420,9 @@ public class NpcAggroAreaPlugin extends Plugin
npcNamePatterns = NAME_SPLITTER.splitToList(this.configNpcNamePatterns);
recheckActive();
break;
case "sendNotification":
hasSentNotification = false;
break;
}
}
@@ -501,6 +513,17 @@ public class NpcAggroAreaPlugin extends Plugin
}
}
void doNotification()
{
if (hasSentNotification)
{
return;
}
final Player local = client.getLocalPlayer();
hasSentNotification = true;
notifier.notify("[" + local.getName() + "]'s aggression timer has run out!");
}
private void updateConfig()
{
this.alwaysActive = config.alwaysActive();
@@ -510,5 +533,6 @@ public class NpcAggroAreaPlugin extends Plugin
this.aggroAreaColor = config.aggroAreaColor();
this.showNotWorkingOverlay = config.showNotWorkingOverlay();
this.hideOverlayHint = config.hideOverlayHint();
this.sendNotification = config.sendNotification();
}
}

View File

@@ -66,7 +66,7 @@ public enum ItemType
{
return ItemType.AMMO;
}
if (item.getName().contains("rune"))
if (item.getName().toLowerCase().contains("rune"))
{
return ItemType.RUNE;
}

View File

@@ -299,7 +299,13 @@ public class SuppliesTrackerPlugin extends Plugin
{
quantity -= newItem.getQuantity();
}
buildEntries(oldItem.getId(), quantity);
// ensure that only positive quantities are added since it is reported
// that sometimes checkUsedRunes is called on the same tick that a player
// gains runes in their inventory
if (quantity > 0)
{
buildEntries(oldItem.getId(), quantity);
}
}
}
}