Java 9 introduced a few bugs in the ancient client engine most people use, the most noticeable one is right mouse clicking.
Go to the class where you handle your mouse clicking, usually in RSApplet.java.
Search for this:
Code:
if (type == 2) {
mouseWheelDown = true;
mouseWheelX = i;
mouseWheelY = j;
return;
}
replace the if statement with:
Code:
if (SwingUtilities.isMiddleMouseButton(e)) {
Note that the argument of the method (e) is the MouseEvent object reference, this might be named differently in your client.
Then search for:
Code:
if (mouseevent.isMetaDown()) {
clickMode1 = 2;
clickMode2 = 2;
}
Replace the first if statement with:
Code:
if(SwingUtilities.isRightMouseButton(e)) {
Then also in the following else block:
Code:
} else {
clickMode1 = 1;
clickMode2 = 1;
}
replace the else line with:
Code:
} else if(SwingUtilities.isLeftMouseButton(e)){
As pointed out by Jire, it is better to do it this way:
Originally Posted by
Jire
An issue with using the
isRightMouseButton static method is that it includes a check for the down mask of the button, which means it will return true so long as the right mouse button is down.
Code:
/**
* Returns true if the mouse event specifies the right mouse button.
*
* @param anEvent a MouseEvent object
* @return true if the right mouse button was active
*/
public static boolean isRightMouseButton(MouseEvent anEvent) {
return ((anEvent.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK);
}
This introduces a problem because players will not be able to hold right click and then left click without letting go of right click, which is a common habit for many people, especially those familiar with Mac and certain GNU/Linux desktop environments.
Instead, you should check if the event's button (
event.getButton()) equals the constants from
MouseEvent, i.e.:
Code:
event.getButton() == MouseEvent.BUTTON3
This will properly support all Java versions, per the AWT event contract.