Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.gamebuster19901.GameBuSK.effects;
- import org.bukkit.event.Event;
- import ch.njol.skript.lang.Effect;
- import ch.njol.skript.lang.Expression;
- import ch.njol.skript.lang.SkriptParser.ParseResult;
- import ch.njol.util.Kleenean;
- import com.gamebuster19901.GameBuSK.exceptions.AlreadyExistsException;
- import com.gamebuster19901.GameBuSK.types.BrowserType;
- public class EffOpenBrowser extends Effect{
- private Expression<BrowserType> type;
- private Expression<String> name;
- private BrowserType finalType;
- @SuppressWarnings("unchecked")
- @Override
- public boolean init(Expression<?>[] expr, int matchedPattern, Kleenean paramKleenean,
- ParseResult paramParseResult) {
- // TODO Auto-generated method stub
- type = (Expression<BrowserType>) expr[0];
- name = (Expression<String>) expr[1];
- if (BrowserType.convertString(type.toString()) == BrowserType.CHROME){
- finalType = BrowserType.CHROME;
- }
- else if (BrowserType.convertString(type.toString()) == BrowserType.FIREFOX){
- finalType = BrowserType.FIREFOX;
- }
- else if (BrowserType.convertString(type.toString()) == BrowserType.GHOST){
- finalType = BrowserType.GHOST;
- }
- else{
- finalType = null;
- }
- return true;
- }
- @Override
- public String toString(Event paramEvent, boolean paramBoolean) {
- // TODO Auto-generated method stub
- return "open window";
- }
- @Override
- protected void execute(Event paramEvent) {
- // TODO Auto-generated method stub
- try {
- GWebDriver.create(finalType, name.getSingle(paramEvent));
- } catch (AlreadyExistsException e) {
- // TODO Auto-generated catch block
- System.out.println("Window that is named this is already open");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement