Merge pull request #3172 from open-osrs/upstream-2504

This commit is contained in:
Owain van Brakel
2022-04-25 11:06:01 +02:00
committed by GitHub
33 changed files with 147 additions and 93 deletions

View File

@@ -420,7 +420,6 @@ public interface Client extends OAuthApi, GameEngine
* <p>
* (getLocalPlayerIndex returns the local index, useful for menus/interacting)
*/
@Nullable
Player getLocalPlayer();
int getLocalPlayerIndex();

View File

@@ -452,4 +452,10 @@ public final class ScriptID
@ScriptArguments(integer = 6)
public static final int INVENTORY_DRAWITEM = 6011;
/**
* Initializes the trade interface
*/
@ScriptArguments(integer = 6)
public static final int TRADE_MAIN_INIT = 755;
}

View File

@@ -188,6 +188,7 @@ public final class WidgetID
public static final int GROUP_STORAGE_INVENTORY_GROUP_ID = 725;
public static final int GROUP_STORAGE_GROUP_ID = 724;
public static final int WILDERNESS_LOOT_CHEST = 742;
public static final int TRADE_WINDOW_GROUP_ID = 335;
static class WorldMap
{
@@ -1367,4 +1368,9 @@ public final class WidgetID
static final int HEADER = 1;
static final int MEMBERS = 6;
}
static class Trade
{
static final int HEADER = 31;
}
}

View File

@@ -930,6 +930,8 @@ public enum WidgetInfo
SHOP_ITEMS_CONTAINER(WidgetID.SHOP_GROUP_ID, WidgetID.Shop.ITEMS_CONTAINER),
POH_TREASURE_CHEST_INVENTORY_CONTAINER(WidgetID.POH_TREASURE_CHEST_INVENTORY_GROUP_ID, 0),
TRADE_WINDOW_HEADER(WidgetID.TRADE_WINDOW_GROUP_ID, WidgetID.Trade.HEADER),
;
private final int groupId;

View File

@@ -53,13 +53,14 @@
<!-- code style -->
<rule ref="category/java/codestyle.xml/AvoidProtectedFieldInFinalClass"/>
<rule ref="category/java/codestyle.xml/AvoidProtectedMethodInFinalClassNotExtending"/>
<rule ref="category/java/codestyle.xml/DontImportJavaLang"/>
<rule ref="category/java/codestyle.xml/ExtendsObject"/>
<rule ref="category/java/codestyle.xml/ForLoopShouldBeWhileLoop"/>
<rule ref="category/java/codestyle.xml/IdenticalCatchBranches"/>
<rule ref="category/java/codestyle.xml/PackageCase"/>
<rule ref="category/java/codestyle.xml/UnnecessaryCast"/>
<rule ref="category/java/codestyle.xml/UnnecessaryConstructor"/>
<rule ref="category/java/codestyle.xml/UnnecessaryFullyQualifiedName" />
<rule ref="category/java/codestyle.xml/UnnecessaryImport" />
<rule ref="category/java/codestyle.xml/UnnecessaryModifier"/>
<rule ref="category/java/codestyle.xml/UseDiamondOperator"/>
<rule ref="category/java/codestyle.xml/UseShortArrayInitializer"/>
@@ -84,18 +85,20 @@
<rule ref="category/java/errorprone.xml/EmptyIfStmt"/>
<rule ref="category/java/errorprone.xml/EmptyInitializer"/>
<rule ref="category/java/errorprone.xml/EmptyStatementBlock"/>
<rule ref="category/java/errorprone.xml/ImportFromSamePackage"/>
<rule ref="category/java/errorprone.xml/InstantiationToGetClass"/>
<rule ref="category/java/errorprone.xml/InvalidLogMessageFormat"/>
<rule ref="category/java/errorprone.xml/JumbledIncrementer"/>
<rule ref="category/java/errorprone.xml/MisplacedNullCheck"/>
<rule ref="category/java/errorprone.xml/OverrideBothEqualsAndHashcode"/>
<rule ref="category/java/errorprone.xml/UnconditionalIfStatement"/>
<rule ref="category/java/errorprone.xml/UseEqualsToCompareStrings"/>
<!-- performance -->
<rule ref="category/java/performance.xml/AppendCharacterWithChar"/>
<rule ref="category/java/performance.xml/ConsecutiveLiteralAppends"/>
<rule ref="category/java/performance.xml/ConsecutiveLiteralAppends">
<properties>
<property name="threshold" value="2"/>
</properties>
</rule>
<rule ref="category/java/performance.xml/InefficientStringBuffering"/>
<rule ref="category/java/performance.xml/UnnecessaryWrapperObjectCreation"/>
</ruleset>

View File

@@ -34,7 +34,7 @@ public class ChatMessageBuilder
public ChatMessageBuilder append(final ChatColorType type)
{
builder.append("<col").append(type.name()).append(">");
builder.append("<col").append(type.name()).append('>');
return this;
}

View File

@@ -447,7 +447,7 @@ class WidgetInspector extends DevToolsFrame
picker = parent.createChild(-1, WidgetType.GRAPHIC);
log.info("Picker is {}.{} [{}]", WidgetInfo.TO_GROUP(picker.getId()), WidgetInfo.TO_CHILD(picker.getId()), picker.getIndex());
log.info("Picker is {}.{} [{}]", TO_GROUP(picker.getId()), TO_CHILD(picker.getId()), picker.getIndex());
picker.setSpriteId(SpriteID.MOBILE_FINGER_ON_INTERFACE);
picker.setOriginalWidth(15);
@@ -521,7 +521,7 @@ class WidgetInspector extends DevToolsFrame
{
continue;
}
String name = WidgetInfo.TO_GROUP(entry.getParam1()) + "." + WidgetInfo.TO_CHILD(entry.getParam1());
String name = TO_GROUP(entry.getParam1()) + "." + TO_CHILD(entry.getParam1());
if (entry.getParam0() != -1)
{

View File

@@ -445,7 +445,7 @@ public class FishingPlugin extends Plugin
if (seconds < 10)
{
trawlerText.append("0");
trawlerText.append('0');
}
trawlerText.append(seconds);

View File

@@ -41,7 +41,6 @@ import jogamp.opengl.x11.glx.X11GLXContext;
import lombok.extern.slf4j.Slf4j;
import net.runelite.client.plugins.gpu.template.Template;
import net.runelite.client.util.OSType;
import org.jocl.CL;
import static org.jocl.CL.*;
import org.jocl.CLException;
import org.jocl.Pointer;
@@ -96,7 +95,7 @@ class OpenCLManager
void init(GL4 gl)
{
CL.setExceptionsEnabled(true);
setExceptionsEnabled(true);
switch (OSType.getOSType())
{
@@ -121,55 +120,55 @@ class OpenCLManager
{
if (programUnordered != null)
{
CL.clReleaseProgram(programUnordered);
clReleaseProgram(programUnordered);
programUnordered = null;
}
if (programSmall != null)
{
CL.clReleaseProgram(programSmall);
clReleaseProgram(programSmall);
programSmall = null;
}
if (programLarge != null)
{
CL.clReleaseProgram(programLarge);
clReleaseProgram(programLarge);
programLarge = null;
}
if (kernelUnordered != null)
{
CL.clReleaseKernel(kernelUnordered);
clReleaseKernel(kernelUnordered);
kernelUnordered = null;
}
if (kernelSmall != null)
{
CL.clReleaseKernel(kernelSmall);
clReleaseKernel(kernelSmall);
kernelSmall = null;
}
if (kernelLarge != null)
{
CL.clReleaseKernel(kernelLarge);
clReleaseKernel(kernelLarge);
kernelLarge = null;
}
if (commandQueue != null)
{
CL.clReleaseCommandQueue(commandQueue);
clReleaseCommandQueue(commandQueue);
commandQueue = null;
}
if (context != null)
{
CL.clReleaseContext(context);
clReleaseContext(context);
context = null;
}
if (device != null)
{
CL.clReleaseDevice(device);
clReleaseDevice(device);
device = null;
}
}

View File

@@ -829,7 +829,7 @@ public class GrandExchangePlugin extends Plugin
if (resetTime != null)
{
Duration remaining = Duration.between(Instant.now(), resetTime);
sb.append(" (").append(DurationFormatUtils.formatDuration(remaining.toMillis(), "H:mm")).append(")");
sb.append(" (").append(DurationFormatUtils.formatDuration(remaining.toMillis(), "H:mm")).append(')');
}
}

View File

@@ -246,7 +246,7 @@ public class GroundItemsOverlay extends Overlay
{
itemStringBuilder.append(" (")
.append(QuantityFormatter.quantityToStackSize(item.getQuantity()))
.append(")");
.append(')');
}
}

View File

@@ -663,7 +663,7 @@ public class GroundItemsPlugin extends Plugin
{
notificationStringBuilder.append(" (")
.append(QuantityFormatter.quantityToStackSize(item.getQuantity()))
.append(")");
.append(')');
}
}

View File

@@ -173,7 +173,7 @@ public class ItemStatOverlay extends Overlay
Duration highestDuration = durationRange.getHighestDuration();
if (lowestDuration != highestDuration)
{
sb.append("~");
sb.append('~');
sb.append(DurationFormatUtils.formatDuration(highestDuration.toMillis(), "m:ss"));
}
}
@@ -381,7 +381,7 @@ public class ItemStatOverlay extends Overlay
{
if (config.relative())
{
b.append("/");
b.append('/');
}
b.append(c.getFormattedTheoretical());
}
@@ -397,9 +397,9 @@ public class ItemStatOverlay extends Overlay
if (config.absolute() && (config.relative() || config.theoretical()))
{
b.append(")");
b.append(')');
}
b.append(" ").append(c.getStat().getName());
b.append(' ').append(c.getStat().getName());
b.append("</br>");
return b.toString();

View File

@@ -106,7 +106,7 @@ class Bookcase
b.append("Center");
}
b.append(" ");
b.append(' ');
switch (location.getPlane())
{
@@ -123,7 +123,7 @@ class Bookcase
if (KourendLibraryPlugin.debug)
{
b.append(" ").append(index.stream().map(Object::toString).collect(Collectors.joining(", ")));
b.append(' ').append(index.stream().map(Object::toString).collect(Collectors.joining(", ")));
}
return b.toString();
}

View File

@@ -79,7 +79,7 @@ class Library
Library()
{
populateBooks();
step = byIndex.size() / Book.values().length;
step = byIndex.size() / values().length;
reset();
}

View File

@@ -29,22 +29,17 @@ import java.awt.image.BufferedImage;
import java.time.Duration;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import lombok.Getter;
import lombok.Setter;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.ui.overlay.infobox.Timer;
class AggressionTimer extends Timer
{
@Getter
@Setter
private boolean visible;
private final NpcAggroAreaPlugin plugin;
AggressionTimer(Duration duration, BufferedImage image, Plugin plugin, boolean visible)
AggressionTimer(Duration duration, BufferedImage image, NpcAggroAreaPlugin plugin)
{
super(duration.toMillis(), ChronoUnit.MILLIS, image, plugin);
setTooltip("Time until NPCs become unaggressive");
this.visible = visible;
this.plugin = plugin;
}
@Override
@@ -63,6 +58,6 @@ class AggressionTimer extends Timer
@Override
public boolean render()
{
return visible && super.render();
return plugin.shouldDisplayTimer() && super.render();
}
}

View File

@@ -84,8 +84,7 @@ class NpcAggroAreaOverlay extends Overlay
}
Color outlineColor = config.unaggroAreaColor();
AggressionTimer timer = plugin.getCurrentTimer();
if (outlineColor == null || timer == null || Instant.now().compareTo(timer.getEndTime()) < 0)
if (outlineColor == null || (plugin.getEndTime() != null && Instant.now().isBefore(plugin.getEndTime())))
{
outlineColor = config.aggroAreaColor();
}

View File

@@ -82,7 +82,7 @@ public class NpcAggroAreaPlugin extends Plugin
private static final int SAFE_AREA_RADIUS = 10;
private static final int UNKNOWN_AREA_RADIUS = SAFE_AREA_RADIUS * 2;
private static final int AGGRESSIVE_TIME_SECONDS = 600;
private static final Duration AGGRESSIVE_TIME_DURATION = Duration.ofSeconds(600);
private static final Splitter NAME_SPLITTER = Splitter.on(',').omitEmptyStrings().trimResults();
private static final WorldArea WILDERNESS_ABOVE_GROUND = new WorldArea(2944, 3523, 448, 448, 0);
private static final WorldArea WILDERNESS_UNDERGROUND = new WorldArea(2944, 9918, 320, 442, 0);
@@ -124,7 +124,7 @@ public class NpcAggroAreaPlugin extends Plugin
private boolean active;
@Getter
private AggressionTimer currentTimer;
private Instant endTime;
private WorldPoint lastPlayerLocation;
private WorldPoint previousUnknownCenter;
@@ -156,7 +156,7 @@ public class NpcAggroAreaPlugin extends Plugin
overlayManager.remove(notWorkingOverlay);
Arrays.fill(safeCenters, null);
lastPlayerLocation = null;
currentTimer = null;
endTime = null;
loggingIn = false;
npcNamePatterns = null;
active = false;
@@ -193,16 +193,6 @@ public class NpcAggroAreaPlugin extends Plugin
coords[1] = lp.getY() - Perspective.LOCAL_TILE_SIZE / 2f;
}
private void reevaluateActive()
{
if (currentTimer != null)
{
currentTimer.setVisible(active && config.showTimer());
}
calculateLinesToDisplay();
}
private void calculateLinesToDisplay()
{
if (!active || !config.showAreaLines())
@@ -227,23 +217,29 @@ public class NpcAggroAreaPlugin extends Plugin
private void removeTimer()
{
infoBoxManager.removeInfoBox(currentTimer);
currentTimer = null;
infoBoxManager.removeIf(t -> t instanceof AggressionTimer);
endTime = null;
notifyOnce = false;
}
private void createTimer(Duration duration)
{
removeTimer();
BufferedImage image = itemManager.getImage(ItemID.ENSOULED_DEMON_HEAD);
currentTimer = new AggressionTimer(duration, image, this, active && config.showTimer());
infoBoxManager.addInfoBox(currentTimer);
endTime = Instant.now().plus(duration);
notifyOnce = true;
if (duration.isNegative())
{
return;
}
BufferedImage image = itemManager.getImage(ItemID.ENSOULED_DEMON_HEAD);
infoBoxManager.addInfoBox(new AggressionTimer(duration, image, this));
}
private void resetTimer()
{
createTimer(Duration.ofSeconds(AGGRESSIVE_TIME_SECONDS));
createTimer(AGGRESSIVE_TIME_DURATION);
}
private static boolean isInWilderness(WorldPoint location)
@@ -301,7 +297,7 @@ public class NpcAggroAreaPlugin extends Plugin
}
}
reevaluateActive();
calculateLinesToDisplay();
}
private void recheckActive()
@@ -326,7 +322,7 @@ public class NpcAggroAreaPlugin extends Plugin
{
WorldPoint newLocation = client.getLocalPlayer().getWorldLocation();
if (active && currentTimer != null && currentTimer.cull() && notifyOnce)
if (active && notifyOnce && Instant.now().isAfter(endTime))
{
if (config.notifyExpire())
{
@@ -387,12 +383,6 @@ public class NpcAggroAreaPlugin extends Plugin
case "npcUnaggroAlwaysActive":
recheckActive();
break;
case "npcUnaggroShowTimer":
if (currentTimer != null)
{
currentTimer.setVisible(active && config.showTimer());
}
break;
case "npcUnaggroCollisionDetection":
case "npcUnaggroShowAreaLines":
calculateLinesToDisplay();
@@ -404,6 +394,11 @@ public class NpcAggroAreaPlugin extends Plugin
}
}
boolean shouldDisplayTimer()
{
return active && config.showTimer();
}
private void loadConfig()
{
safeCenters[0] = configManager.getConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_CENTER1, WorldPoint.class);
@@ -411,7 +406,7 @@ public class NpcAggroAreaPlugin extends Plugin
lastPlayerLocation = configManager.getConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_LOCATION, WorldPoint.class);
Duration timeLeft = configManager.getConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_DURATION, Duration.class);
if (timeLeft != null && !timeLeft.isNegative())
if (timeLeft != null)
{
createTimer(timeLeft);
}
@@ -427,7 +422,7 @@ public class NpcAggroAreaPlugin extends Plugin
private void saveConfig()
{
if (safeCenters[0] == null || safeCenters[1] == null || lastPlayerLocation == null || currentTimer == null)
if (safeCenters[0] == null || safeCenters[1] == null || lastPlayerLocation == null || endTime == null)
{
resetConfig();
}
@@ -436,7 +431,7 @@ public class NpcAggroAreaPlugin extends Plugin
configManager.setConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_CENTER1, safeCenters[0]);
configManager.setConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_CENTER2, safeCenters[1]);
configManager.setConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_LOCATION, lastPlayerLocation);
configManager.setConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_DURATION, Duration.between(Instant.now(), currentTimer.getEndTime()));
configManager.setConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_DURATION, Duration.between(Instant.now(), endTime));
}
}
@@ -486,6 +481,7 @@ public class NpcAggroAreaPlugin extends Plugin
safeCenters[0] = null;
safeCenters[1] = null;
lastPlayerLocation = null;
endTime = null;
break;
}
}

View File

@@ -42,12 +42,17 @@ import static net.runelite.api.MenuAction.PLAYER_SEVENTH_OPTION;
import static net.runelite.api.MenuAction.PLAYER_SIXTH_OPTION;
import static net.runelite.api.MenuAction.PLAYER_THIRD_OPTION;
import static net.runelite.api.MenuAction.RUNELITE_PLAYER;
import static net.runelite.api.MenuAction.WIDGET_TARGET_ON_PLAYER;
import static net.runelite.api.MenuAction.WALK;
import static net.runelite.api.MenuAction.WIDGET_TARGET_ON_PLAYER;
import net.runelite.api.MenuEntry;
import net.runelite.api.Player;
import net.runelite.api.ScriptID;
import net.runelite.api.clan.ClanTitle;
import net.runelite.api.events.ClientTick;
import net.runelite.api.events.ScriptPostFired;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.ChatIconManager;
@@ -63,6 +68,8 @@ import net.runelite.client.util.ColorUtil;
)
public class PlayerIndicatorsPlugin extends Plugin
{
private static final String TRADING_WITH_TEXT = "Trading with: ";
@Inject
private OverlayManager overlayManager;
@@ -87,6 +94,9 @@ public class PlayerIndicatorsPlugin extends Plugin
@Inject
private ChatIconManager chatIconManager;
@Inject
private ClientThread clientThread;
@Provides
PlayerIndicatorsConfig provideConfig(ConfigManager configManager)
{
@@ -249,6 +259,44 @@ public class PlayerIndicatorsPlugin extends Plugin
return newTarget;
}
@Subscribe
public void onScriptPostFired(ScriptPostFired event)
{
if (event.getScriptId() == ScriptID.TRADE_MAIN_INIT)
{
clientThread.invokeLater(() ->
{
Widget tradeTitle = client.getWidget(WidgetInfo.TRADE_WINDOW_HEADER);
String header = tradeTitle.getText();
String playerName = header.substring(TRADING_WITH_TEXT.length());
Player targetPlayer = findPlayer(playerName);
if (targetPlayer == null)
{
return;
}
Decorations playerColor = getDecorations(targetPlayer);
if (playerColor != null)
{
tradeTitle.setText(TRADING_WITH_TEXT + ColorUtil.wrapWithColorTag(playerName, playerColor.color));
}
});
}
}
private Player findPlayer(String name)
{
for (Player player : client.getPlayers())
{
if (player.getName().equals(name))
{
return player;
}
}
return null;
}
@Value
private static class Decorations
{

View File

@@ -144,7 +144,7 @@ public class Raid
}
else
{
builder.append(" ");
builder.append(' ');
}
}

View File

@@ -83,7 +83,7 @@ class RunEnergyOverlay extends Overlay
if (config.replaceOrbText())
{
sb.append("Run Energy: ").append(client.getEnergy()).append("%");
sb.append("Run Energy: ").append(client.getEnergy()).append('%');
}
else
{

View File

@@ -106,7 +106,7 @@ public class RunepouchOverlay extends WidgetItemOverlay
tooltipBuilder
.append(amount)
.append(" ")
.append(' ')
.append(ColorUtil.wrapWithColorTag(rune.getName(), Color.YELLOW))
.append("</br>");

View File

@@ -855,7 +855,7 @@ public class SlayerPlugin extends Plugin
sb.append(task.getTask());
if (!Strings.isNullOrEmpty(task.getLocation()))
{
sb.append(" (").append(task.getLocation()).append(")");
sb.append(" (").append(task.getLocation()).append(')');
}
sb.append(": ");
if (killed < 0)

View File

@@ -82,7 +82,7 @@ public abstract class TabContentPanel extends JPanel
LocalDateTime currentTime = LocalDateTime.now();
if (endTime.getDayOfWeek() != currentTime.getDayOfWeek())
{
sb.append(endTime.getDayOfWeek().getDisplayName(TextStyle.SHORT, Locale.getDefault())).append(" ");
sb.append(endTime.getDayOfWeek().getDisplayName(TextStyle.SHORT, Locale.getDefault())).append(' ');
}
sb.append("at ");
sb.append(formatter.format(endTime));

View File

@@ -187,8 +187,8 @@ public class TimeTrackingPlugin extends Plugin
{
if (commandExecuted.getCommand().equals("resetfarmtick"))
{
configManager.unsetRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.FARM_TICK_OFFSET_PRECISION);
configManager.unsetRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.FARM_TICK_OFFSET);
configManager.unsetRSProfileConfiguration(CONFIG_GROUP, TimeTrackingConfig.FARM_TICK_OFFSET_PRECISION);
configManager.unsetRSProfileConfiguration(CONFIG_GROUP, TimeTrackingConfig.FARM_TICK_OFFSET);
}
}

View File

@@ -550,7 +550,7 @@ public class FarmingTracker
// Same RS account but different profile type
if (profileType != RuneScapeProfileType.getCurrent(client))
{
stringBuilder.append("(")
stringBuilder.append('(')
.append(Text.titleCase(profile.getType()))
.append(") ");
}
@@ -564,13 +564,13 @@ public class FarmingTracker
//Don't print profile type when logged out if is STANDARD
if (client.getGameState() == GameState.LOGIN_SCREEN && profileType == RuneScapeProfileType.STANDARD)
{
stringBuilder.append("(")
stringBuilder.append('(')
.append(profile.getDisplayName())
.append(") ");
}
else
{
stringBuilder.append("(")
stringBuilder.append('(')
.append(profile.getDisplayName())
.append(" - ")
.append(Text.titleCase(profile.getType()))
@@ -580,7 +580,7 @@ public class FarmingTracker
// Different RS account but same profile type
else
{
stringBuilder.append("(")
stringBuilder.append('(')
.append(profile.getDisplayName())
.append(") ");
}
@@ -616,7 +616,7 @@ public class FarmingTracker
stringBuilder.append(patch.getRegion().isDefinite() ? "the " : "")
.append(patch.getRegion().getName())
.append(".");
.append('.');
notifier.notify(stringBuilder.toString());
}

View File

@@ -100,7 +100,7 @@ public class TwitchIRCClient extends Thread implements AutoCloseable
return;
}
try
try // NOPMD: UseTryWithResources
{
register(username, password);
join(channel);

View File

@@ -105,7 +105,7 @@ public class OverlayUtil
public static void renderImageLocation(Client client, Graphics2D graphics, LocalPoint localPoint, BufferedImage image, int zOffset)
{
net.runelite.api.Point imageLocation = Perspective.getCanvasImageLocation(client, localPoint, image, zOffset);
Point imageLocation = Perspective.getCanvasImageLocation(client, localPoint, image, zOffset);
if (imageLocation != null)
{
renderImageLocation(graphics, imageLocation, image);
@@ -182,7 +182,7 @@ public class OverlayUtil
renderImageLocation(client, graphics, localLocation, image, 0);
}
public static void renderHoverableArea(Graphics2D graphics, Shape area, net.runelite.api.Point mousePosition, Color fillColor, Color borderColor, Color borderHoverColor)
public static void renderHoverableArea(Graphics2D graphics, Shape area, Point mousePosition, Color fillColor, Color borderColor, Color borderHoverColor)
{
if (area != null)
{

View File

@@ -182,12 +182,12 @@ public class LineComponent implements LayoutableRenderableEntity
if (wordLen + spaceWidth > spaceLeft)
{
wrapped.append("\n").append(word);
wrapped.append('\n').append(word);
spaceLeft = maxWidth - wordLen;
}
else
{
wrapped.append(" ").append(word);
wrapped.append(' ').append(word);
spaceLeft -= spaceWidth + wordLen;
}
}

View File

@@ -96,6 +96,7 @@ public class Timer extends InfoBox
public void setDuration(Duration duration)
{
Preconditions.checkArgument(!duration.isNegative(), "negative duration");
this.duration = duration;
endTime = startTime.plus(duration);
}

View File

@@ -43,7 +43,7 @@ public class CallableExceptionLogger<V> implements Callable<V>
}
catch (Throwable ex)
{
log.warn("Uncaught exception in callable {}", callable, ex);
log.error("Uncaught exception in callable {}", callable, ex);
throw ex;
}
}

View File

@@ -42,7 +42,7 @@ public class RunnableExceptionLogger implements Runnable
}
catch (Throwable ex)
{
log.warn("Uncaught exception in runnable {}", runnable, ex);
log.error("Uncaught exception in runnable {}", runnable, ex);
throw ex;
}
}

View File

@@ -40,11 +40,11 @@ public class WorldUtil
*/
public static EnumSet<WorldType> toWorldTypes(final EnumSet<net.runelite.http.api.worlds.WorldType> apiTypes)
{
final EnumSet<net.runelite.api.WorldType> types = EnumSet.noneOf(net.runelite.api.WorldType.class);
final EnumSet<WorldType> types = EnumSet.noneOf(WorldType.class);
for (net.runelite.http.api.worlds.WorldType apiType : apiTypes)
{
types.add(net.runelite.api.WorldType.valueOf(apiType.name()));
types.add(WorldType.valueOf(apiType.name()));
}
return types;