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) public final void switchSession(AccountSession session)
{ {
// Ensure existing config is saved
sendConfig();
if (session == null) if (session == null)
{ {
this.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(); propertiesFile.getParentFile().mkdirs();
@@ -392,19 +395,6 @@ public class ConfigManager
pendingChanges.put(groupName + "." + key, value); 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 configChanged = new ConfigChanged();
configChanged.setGroup(groupName); configChanged.setGroup(groupName);
configChanged.setKey(key); configChanged.setKey(key);
@@ -435,19 +425,6 @@ public class ConfigManager
pendingChanges.put(groupName + "." + key, null); 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 configChanged = new ConfigChanged();
configChanged.setGroup(groupName); configChanged.setGroup(groupName);
configChanged.setKey(key); configChanged.setKey(key);
@@ -653,6 +630,7 @@ public class ConfigManager
public void sendConfig() public void sendConfig()
{ {
boolean changed;
synchronized (pendingChanges) synchronized (pendingChanges)
{ {
if (client != null) if (client != null)
@@ -672,7 +650,20 @@ public class ConfigManager
} }
} }
} }
changed = !pendingChanges.isEmpty();
pendingChanges.clear(); 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; return;
} }
if (message.length() <= KILLCOUNT_COMMAND_STRING.length())
{
return;
}
ChatMessageType type = chatMessage.getType(); ChatMessageType type = chatMessage.getType();
String search = message.substring(KILLCOUNT_COMMAND_STRING.length() + 1); String search = message.substring(KILLCOUNT_COMMAND_STRING.length() + 1);
@@ -483,6 +488,11 @@ public class ChatCommandsPlugin extends Plugin
return; return;
} }
if (message.length() <= PB_COMMAND.length())
{
return;
}
ChatMessageType type = chatMessage.getType(); ChatMessageType type = chatMessage.getType();
String search = message.substring(PB_COMMAND.length() + 1); String search = message.substring(PB_COMMAND.length() + 1);
@@ -574,6 +584,11 @@ public class ChatCommandsPlugin extends Plugin
return; return;
} }
if (message.length() <= PRICE_COMMAND_STRING.length())
{
return;
}
MessageNode messageNode = chatMessage.getMessageNode(); MessageNode messageNode = chatMessage.getMessageNode();
String search = message.substring(PRICE_COMMAND_STRING.length() + 1); String search = message.substring(PRICE_COMMAND_STRING.length() + 1);
@@ -637,6 +652,11 @@ public class ChatCommandsPlugin extends Plugin
} }
else else
{ {
if (message.length() <= LEVEL_COMMAND_STRING.length())
{
return;
}
search = message.substring(LEVEL_COMMAND_STRING.length() + 1); 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")) if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() && event.getOption().equals("Message"))
{ {
// Friends have color tags // Friends have color tags
setHoveredFriend(Text.removeTags(event.getTarget())); setHoveredFriend(Text.toJagexName(Text.removeTags(event.getTarget())));
// Build "Add Note" or "Edit Note" menu entry // Build "Add Note" or "Edit Note" menu entry
final MenuEntry addNote = new MenuEntry(); final MenuEntry addNote = new MenuEntry();
@@ -197,13 +197,13 @@ public class FriendNotesPlugin extends Plugin
return; return;
} }
//Friends have color tags
final String sanitizedTarget = Text.removeTags(event.getMenuTarget());
// Handle clicks on "Add Note" or "Edit Note" // Handle clicks on "Add Note" or "Edit Note"
if (event.getMenuOption().equals(ADD_NOTE) || event.getMenuOption().equals(EDIT_NOTE)) if (event.getMenuOption().equals(ADD_NOTE) || event.getMenuOption().equals(EDIT_NOTE))
{ {
event.consume(); event.consume();
//Friends have color tags
final String sanitizedTarget = Text.toJagexName(Text.removeTags(event.getMenuTarget()));
final String note = getFriendNote(sanitizedTarget); final String note = getFriendNote(sanitizedTarget);
// Open the new chatbox input dialog // 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 // Migrate a friend's note to their new display name
final Friend friend = (Friend) nameable; 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) public void onRemovedFriend(RemovedFriend event)
{ {
// Delete a friend's note if they are removed // 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); log.debug("Remove friend: '{}'", displayName);
setFriendNote(displayName, null); setFriendNote(displayName, null);
} }

View File

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