Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private Canvas canvas;
- public Mouse(Client c) throws Exception {
- this.client = c;
- this.canvas = null;
- for (Method m : Bot.class.getMethods()) {
- if (Canvas.class.isAssignableFrom(m.getReturnType())) {
- canvas = (Canvas) m.invoke(this.client.getBot());
- }
- }
- if (canvas == null) {
- throw new Exception("Couldn't find canvas component!");
- }
- }
- private void setXY(int x, int y) {
- MouseEvent me = new MouseEvent(this.canvas,
- MouseEvent.MOUSE_MOVED,
- System.currentTimeMillis(),
- MouseEvent.NOBUTTON,
- x, y,
- 0,
- false);
- this.dispatchEvent(me);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement