Merge branch 'master' of github.com:runelite/runelite

This commit is contained in:
BuildTools
2019-03-12 12:50:43 +00:00
4 changed files with 60 additions and 34 deletions

View File

@@ -99,6 +99,9 @@ public class ConfigManager
public final void switchSession(AccountSession session)
{
// Ensure existing config is saved
sendConfig();
if (session == null)
{
this.session = null;
@@ -315,7 +318,7 @@ public class ConfigManager
}
}
private synchronized void saveToFile(final File propertiesFile) throws IOException
private void saveToFile(final File propertiesFile) throws IOException
{
propertiesFile.getParentFile().mkdirs();
@@ -392,19 +395,6 @@ public class ConfigManager
pendingChanges.put(groupName + "." + key, value);
}
Runnable task = () ->
{
try
{
saveToFile(propertiesFile);
}
catch (IOException ex)
{
log.warn("unable to save configuration file", ex);
}
};
executor.execute(task);
ConfigChanged configChanged = new ConfigChanged();
configChanged.setGroup(groupName);
configChanged.setKey(key);
@@ -435,19 +425,6 @@ public class ConfigManager
pendingChanges.put(groupName + "." + key, null);
}
Runnable task = () ->
{
try
{
saveToFile(propertiesFile);
}
catch (IOException ex)
{
log.warn("unable to save configuration file", ex);
}
};
executor.execute(task);
ConfigChanged configChanged = new ConfigChanged();
configChanged.setGroup(groupName);
configChanged.setKey(key);
@@ -653,6 +630,7 @@ public class ConfigManager
public void sendConfig()
{
boolean changed;
synchronized (pendingChanges)
{
if (client != null)
@@ -672,7 +650,20 @@ public class ConfigManager
}
}
}
changed = !pendingChanges.isEmpty();
pendingChanges.clear();
}
if (changed)
{
try
{
saveToFile(propertiesFile);
}
catch (IOException ex)
{
log.warn("unable to save configuration file", ex);
}
}
}
}

View File

@@ -366,6 +366,11 @@ public class ChatCommandsPlugin extends Plugin
return;
}
if (message.length() <= KILLCOUNT_COMMAND_STRING.length())
{
return;
}
ChatMessageType type = chatMessage.getType();
String search = message.substring(KILLCOUNT_COMMAND_STRING.length() + 1);
@@ -483,6 +488,11 @@ public class ChatCommandsPlugin extends Plugin
return;
}
if (message.length() <= PB_COMMAND.length())
{
return;
}
ChatMessageType type = chatMessage.getType();
String search = message.substring(PB_COMMAND.length() + 1);
@@ -574,6 +584,11 @@ public class ChatCommandsPlugin extends Plugin
return;
}
if (message.length() <= PRICE_COMMAND_STRING.length())
{
return;
}
MessageNode messageNode = chatMessage.getMessageNode();
String search = message.substring(PRICE_COMMAND_STRING.length() + 1);
@@ -637,6 +652,11 @@ public class ChatCommandsPlugin extends Plugin
}
else
{
if (message.length() <= LEVEL_COMMAND_STRING.length())
{
return;
}
search = message.substring(LEVEL_COMMAND_STRING.length() + 1);
}

View File

@@ -167,7 +167,7 @@ public class FriendNotesPlugin extends Plugin
if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() && event.getOption().equals("Message"))
{
// Friends have color tags
setHoveredFriend(Text.removeTags(event.getTarget()));
setHoveredFriend(Text.toJagexName(Text.removeTags(event.getTarget())));
// Build "Add Note" or "Edit Note" menu entry
final MenuEntry addNote = new MenuEntry();
@@ -197,13 +197,13 @@ public class FriendNotesPlugin extends Plugin
return;
}
//Friends have color tags
final String sanitizedTarget = Text.removeTags(event.getMenuTarget());
// Handle clicks on "Add Note" or "Edit Note"
if (event.getMenuOption().equals(ADD_NOTE) || event.getMenuOption().equals(EDIT_NOTE))
{
event.consume();
//Friends have color tags
final String sanitizedTarget = Text.toJagexName(Text.removeTags(event.getMenuTarget()));
final String note = getFriendNote(sanitizedTarget);
// Open the new chatbox input dialog
@@ -234,7 +234,16 @@ public class FriendNotesPlugin extends Plugin
{
// Migrate a friend's note to their new display name
final Friend friend = (Friend) nameable;
migrateFriendNote(friend.getName(), friend.getPrevName());
String name = friend.getName();
String prevName = friend.getPrevName();
if (prevName != null)
{
migrateFriendNote(
Text.toJagexName(name),
Text.toJagexName(prevName)
);
}
}
}
@@ -242,7 +251,7 @@ public class FriendNotesPlugin extends Plugin
public void onRemovedFriend(RemovedFriend event)
{
// Delete a friend's note if they are removed
final String displayName = event.getName();
final String displayName = Text.toJagexName(event.getName());
log.debug("Remove friend: '{}'", displayName);
setFriendNote(displayName, null);
}

View File

@@ -131,6 +131,9 @@ public class WikiPlugin extends Plugin
return;
}
children[0] = null;
onDeselect();
client.setSpellSelected(false);
});
}
@@ -186,7 +189,10 @@ public class WikiPlugin extends Plugin
private void onDeselect()
{
wikiSelected = false;
icon.setSpriteId(WikiSprite.WIKI_ICON.getSpriteId());
if (icon != null)
{
icon.setSpriteId(WikiSprite.WIKI_ICON.getSpriteId());
}
}
@Subscribe