Created
July 22, 2012 16:27
-
-
Save HelBorn/3160194 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.powerbot.game.bot.Context; | |
import java.awt.event.MouseListener; | |
/** | |
* @author HelBorn | |
*/ | |
public class MouseBlock { | |
private static MouseListener mouseListener; | |
private static boolean enabled; | |
public static synchronized void enable() { | |
if(!enabled) { | |
mouseListener = Context.client().getCanvas().getMouseListeners()[0]; | |
Context.client().getCanvas().removeMouseListener(mouseListener); | |
enabled = true; | |
} | |
} | |
public static synchronized void disable() { | |
if(enabled) { | |
Context.client().getCanvas().addMouseListener(mouseListener); | |
enabled = false; | |
} | |
} | |
public static synchronized boolean isEnabled() { | |
return enabled; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.powerbot.concurrent.Task; | |
import org.powerbot.game.api.ActiveScript; | |
import org.powerbot.game.api.Manifest; | |
import java.awt.event.MouseEvent; | |
import java.awt.event.MouseListener; | |
@Manifest(name = "Mouse Block Script", authors = {"HelBorn"}) | |
public class MouseBlockScript extends ActiveScript implements MouseListener { | |
@Override | |
protected void setup() { | |
submit(new Task() { | |
@Override | |
public void run() { | |
MouseBlock.enable(); | |
} | |
}); | |
} | |
@Override | |
public void onStop() { | |
MouseBlock.disable(); | |
} | |
@Override | |
public void mouseClicked(MouseEvent e) { | |
System.out.println("Mouse event registers for the script, but not the client."); | |
} | |
public void mousePressed(MouseEvent e) {} | |
public void mouseReleased(MouseEvent e) {} | |
public void mouseEntered(MouseEvent e) {} | |
public void mouseExited(MouseEvent e) {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment