Merge remote-tracking branch 'runelite/master'
This commit is contained in:
@@ -125,7 +125,7 @@ public class HotColdSolver
|
||||
* @see WorldPoint#distanceTo2D
|
||||
*/
|
||||
@VisibleForTesting
|
||||
private static boolean isFirstPointCloserRect(final WorldPoint firstPoint, final WorldPoint secondPoint, final Rectangle rect)
|
||||
static boolean isFirstPointCloserRect(final WorldPoint firstPoint, final WorldPoint secondPoint, final Rectangle rect)
|
||||
{
|
||||
final WorldPoint nePoint = new WorldPoint((rect.x + rect.width), (rect.y + rect.height), 0);
|
||||
|
||||
@@ -163,7 +163,7 @@ public class HotColdSolver
|
||||
* @see WorldPoint#distanceTo2D
|
||||
*/
|
||||
@VisibleForTesting
|
||||
private static boolean isFirstPointCloser(final WorldPoint firstPoint, final WorldPoint secondPoint, final WorldPoint worldPoint)
|
||||
static boolean isFirstPointCloser(final WorldPoint firstPoint, final WorldPoint secondPoint, final WorldPoint worldPoint)
|
||||
{
|
||||
return firstPoint.distanceTo2D(worldPoint) < secondPoint.distanceTo2D(worldPoint);
|
||||
}
|
||||
|
||||
@@ -25,10 +25,12 @@
|
||||
package net.runelite.client.plugins.customcursor;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import javax.annotation.Nullable;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
|
||||
@Getter(AccessLevel.PUBLIC)
|
||||
public enum CustomCursor
|
||||
{
|
||||
RS3_GOLD("RS3 Gold", "cursor-rs3-gold.png"),
|
||||
@@ -42,12 +44,19 @@ public enum CustomCursor
|
||||
MOUSE("Mouse", "cursor-mouse.png"),
|
||||
SARADOMIN_GODSWORD("Saradomin Godsword", "cursor-saradomin-godsword.png"),
|
||||
ZAMORAK_GODSWORD("Zamorak Godsword", "cursor-zamorak-godsword.png"),
|
||||
SKILL_SPECS("Skill Specs", "cursor-skill-specs.png");
|
||||
SKILL_SPECS("Skill Specs", "cursor-skill-specs.png"),
|
||||
CUSTOM_IMAGE("Custom Image");
|
||||
|
||||
private final String name;
|
||||
@Getter(AccessLevel.PUBLIC)
|
||||
@Nullable
|
||||
private final BufferedImage cursorImage;
|
||||
|
||||
CustomCursor(String name)
|
||||
{
|
||||
this.name = name;
|
||||
this.cursorImage = null;
|
||||
}
|
||||
|
||||
CustomCursor(final String name, final String icon)
|
||||
{
|
||||
this.name = name;
|
||||
|
||||
@@ -25,7 +25,10 @@
|
||||
package net.runelite.client.plugins.customcursor;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import javax.sound.sampled.AudioInputStream;
|
||||
@@ -35,6 +38,7 @@ import javax.sound.sampled.FloatControl;
|
||||
import javax.sound.sampled.LineUnavailableException;
|
||||
import javax.sound.sampled.UnsupportedAudioFileException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
@@ -53,6 +57,8 @@ import net.runelite.client.ui.ClientUI;
|
||||
@Singleton
|
||||
public class CustomCursorPlugin extends Plugin
|
||||
{
|
||||
private static final File CUSTOM_IMAGE_FILE = new File(RuneLite.RUNELITE_DIR, "cursor.png");
|
||||
|
||||
@Inject
|
||||
private ClientUI clientUI;
|
||||
|
||||
@@ -125,6 +131,34 @@ public class CustomCursorPlugin extends Plugin
|
||||
skillSpecsRage.start();
|
||||
}
|
||||
}
|
||||
else if (selectedCursor == CustomCursor.CUSTOM_IMAGE)
|
||||
{
|
||||
if (CUSTOM_IMAGE_FILE.exists())
|
||||
{
|
||||
try
|
||||
{
|
||||
BufferedImage image;
|
||||
synchronized (ImageIO.class)
|
||||
{
|
||||
image = ImageIO.read(CUSTOM_IMAGE_FILE);
|
||||
}
|
||||
clientUI.setCursor(image, selectedCursor.getName());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("error setting custom cursor", e);
|
||||
clientUI.resetCursor();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
clientUI.resetCursor();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
assert selectedCursor.getCursorImage() != null;
|
||||
clientUI.setCursor(selectedCursor.getCursorImage(), selectedCursor.getName());
|
||||
|
||||
clientUI.setCursor(selectedCursor.getCursorImage(), selectedCursor.toString());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user