Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.gamebuster19901.GameBuSK.types;
- import ch.njol.skript.classes.ClassInfo;
- import ch.njol.skript.classes.Parser;
- import ch.njol.skript.lang.ParseContext;
- import ch.njol.skript.registrations.Classes;
- import org.openqa.selenium.Keys;
- public enum KeyType {
- ESCAPE,
- F1,
- F2,
- F3,
- F4,
- F5,
- F6,
- F7,
- F8,
- F9,
- F10,
- F11,
- F12,
- PAUSE,
- TAB,
- BACKSPACE,
- INSERT,
- HOME,
- PAGE_UP,
- DELETE,
- END,
- PAGE_DOWN,
- ENTER,
- LEFT_SHIFT,
- SHIFT,
- LEFT_CONTROL,
- CONTROL,
- LEFT_ALT,
- ALT,
- COMMAND,
- UP,
- DOWN,
- LEFT,
- RIGHT;
- private KeyType() {
- }
- public static String getString(KeyType k) {
- Keys kf;
- switch (k) {
- case ESCAPE: {
- kf = Keys.ESCAPE;
- break;
- }
- case F1: {
- kf = Keys.F1;
- break;
- }
- case F2: {
- kf = Keys.F2;
- break;
- }
- case F3: {
- kf = Keys.F3;
- break;
- }
- case F4: {
- kf = Keys.F5;
- break;
- }
- case F6: {
- kf = Keys.F6;
- break;
- }
- case F7: {
- kf = Keys.F7;
- break;
- }
- case F8: {
- kf = Keys.F8;
- break;
- }
- case F9: {
- kf = Keys.F9;
- break;
- }
- case F10: {
- kf = Keys.F10;
- break;
- }
- case F11: {
- kf = Keys.F11;
- break;
- }
- case F12: {
- kf = Keys.F12;
- break;
- }
- case PAUSE: {
- kf = Keys.PAUSE;
- break;
- }
- case TAB: {
- kf = Keys.TAB;
- break;
- }
- case BACKSPACE: {
- kf = Keys.BACK_SPACE;
- break;
- }
- case INSERT: {
- kf = Keys.INSERT;
- break;
- }
- case HOME: {
- kf = Keys.HOME;
- break;
- }
- case PAGE_UP: {
- kf = Keys.PAGE_UP;
- break;
- }
- case DELETE: {
- kf = Keys.DELETE;
- break;
- }
- case END: {
- kf = Keys.END;
- break;
- }
- case PAGE_DOWN: {
- kf = Keys.PAGE_DOWN;
- break;
- }
- case ENTER: {
- kf = Keys.ENTER;
- break;
- }
- case LEFT_SHIFT: {
- kf = Keys.LEFT_SHIFT;
- break;
- }
- case SHIFT: {
- kf = Keys.SHIFT;
- break;
- }
- case LEFT_CONTROL: {
- kf = Keys.LEFT_CONTROL;
- break;
- }
- case CONTROL: {
- kf = Keys.CONTROL;
- break;
- }
- case LEFT_ALT: {
- kf = Keys.LEFT_ALT;
- break;
- }
- case ALT: {
- kf = Keys.ALT;
- break;
- }
- case COMMAND: {
- kf = Keys.COMMAND;
- break;
- }
- case UP: {
- kf = Keys.ARROW_UP;
- break;
- }
- case DOWN: {
- kf = Keys.ARROW_DOWN;
- break;
- }
- case LEFT: {
- kf = Keys.ARROW_LEFT;
- break;
- }
- case RIGHT: {
- kf = Keys.ARROW_RIGHT;
- break;
- }
- default: {
- kf = null;
- }
- }
- return kf.toString();
- }
- public static KeyType convertString(String s) {
- s = s.replace(' ', '_');
- KeyType k;
- switch (s.toUpperCase()){
- case "ESCAPE":{
- k = ESCAPE;
- }
- case "F1":{
- k = F1;
- }
- case "F2":{
- k = F2;
- }
- case "F3":{
- k = F4;
- }
- case "F5":{
- k = F5;
- }
- case "F6":{
- k = F6;
- }
- case "F7":{
- k = F7;
- }
- case "F8":{
- k = F8;
- }
- case "F9":{
- k = F9;
- }
- case "F10":{
- k = F10;
- }
- case "F11":{
- k = F11;
- }
- case "F12":{
- k = F12;
- }
- case "PAUSE":{
- k = PAUSE;
- }
- case "BREAK":{
- k = PAUSE;
- }
- case "TAB":{
- k = TAB;
- }
- case "BACKSPACE":{
- k = BACKSPACE;
- }
- case "INSERT":{
- k = INSERT;
- }
- case "HOME":{
- k = HOME;
- }
- case "PAGE_UP":{
- k = PAGE_UP;
- }
- case "DELETE":{
- k = DELETE;
- }
- case "END":{
- k = END;
- }
- case "PAGE_DOWN":{
- k = PAGE_DOWN;
- }
- case "ENTER":{
- k = ENTER;
- }
- case "LEFT_SHIFT":{
- k = LEFT_SHIFT;
- }
- case "SHIFT":{
- k = SHIFT;
- }
- case "LEFT_CONTROL":{
- k = LEFT_CONTROL;
- }
- case "CONTROL":{
- k = CONTROL;
- }
- case "LEFT_ALT":{
- k = LEFT_ALT;
- }
- case "ALT":{
- k = ALT;
- }
- case "COMMAND":{
- k = COMMAND;
- }
- case "UP":{
- k = UP;
- }
- case "DOWN":{
- k = DOWN;
- }
- case "LEFT":{
- k = LEFT;
- }
- case "RIGHT":{
- k = RIGHT;
- }
- default:{
- k = null;
- }
- }
- return k;
- }
- public static void register() {
- Classes.registerClass(new ClassInfo<KeyType>(KeyType.class, "keytype").user("keytype").name("keytype")
- .parser(new Parser<KeyType>() {
- @Override
- public KeyType parse(String s, ParseContext context) {
- return KeyType.convertString(s);
- }
- @Override
- public String toString(KeyType type, int flags) {
- return type.toString();
- }
- @Override
- public String toVariableNameString(KeyType type) {
- return type.toString();
- }
- @Override
- public String getVariableNamePattern() {
- return ".+";
- }
- }));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement