Advertisement
Gamebuster

EffGoToURL.class

Dec 26th, 2015
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.19 KB | None | 0 0
  1. package com.gamebuster19901.GameBuSK.effects;
  2.  
  3. import org.bukkit.event.Event;
  4.  
  5. import com.google.common.collect.Iterables;
  6.  
  7. import ch.njol.skript.lang.Effect;
  8. import ch.njol.skript.lang.Expression;
  9. import ch.njol.skript.lang.SkriptParser.ParseResult;
  10. import ch.njol.util.Kleenean;
  11.  
  12. public class EffGoToURL extends Effect {
  13.     private Expression<GWebDriver> browser;
  14.     private Expression<String> URL;
  15.  
  16.     @SuppressWarnings("unchecked")
  17.     @Override
  18.     public boolean init(Expression<?>[] expr, int matchedPattern, Kleenean paramKleenean,
  19.             ParseResult paramParseResult) {
  20.         // TODO Auto-generated method stub
  21.         browser = (Expression<GWebDriver>) expr[0];
  22.         URL = (Expression<String>) expr[1];
  23.         return true;
  24.     }
  25.  
  26.     @Override
  27.     public String toString(Event paramEvent, boolean paramBoolean) {
  28.         // TODO Auto-generated method stub
  29.         return "close window";
  30.     }
  31.  
  32.     @Override
  33.     protected void execute(Event paramEvent) {
  34.         // TODO Auto-generated method stub
  35.         GWebDriver locBrowser = browser.getSingle(paramEvent); //This does not work, getSingle attempts to cast my GWebBrowser as a string, and that is currently not possible
  36.         String locUrl = URL.getSingle(paramEvent);
  37.         locBrowser.goTo(locUrl);
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement