added jedis stuff

This commit is contained in:
mohammed jasem alaajel 2021-03-16 18:05:20 +04:00
parent 141357b353
commit bae2d970bb
2 changed files with 79 additions and 0 deletions

View File

@ -0,0 +1,46 @@
package net.limework.rediskript.skript.elements;
import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.SkriptParser;
import ch.njol.skript.lang.util.SimpleExpression;
import ch.njol.util.Kleenean;
import org.bukkit.event.Event;
import org.eclipse.jdt.annotation.Nullable;
import redis.clients.jedis.Jedis;
@SuppressWarnings("unchecked")
public class ExprJedis extends SimpleExpression<Jedis> {
static {
}
private Jedis jedis;
@Nullable
@Override
protected Jedis[] get(Event event) {
return new Jedis[]{jedis};
}
@Override
public boolean isSingle() {
return true;
}
@Override
public Class<? extends Jedis> getReturnType() {
return Jedis.class;
}
@Override
public String toString(@Nullable Event event, boolean b) {
return null;
}
@Override
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
return false;
}
}

View File

@ -0,0 +1,33 @@
package net.limework.rediskript.skript.elements;
import ch.njol.skript.classes.ClassInfo;
import ch.njol.skript.classes.Parser;
import ch.njol.skript.registrations.Classes;
import redis.clients.jedis.Jedis;
public class Types {
static {
Classes.registerClass(
new ClassInfo<>(Jedis.class, "jedis")
.user("JedisInstances?")
.parser(new Parser<Jedis>() {
@Override
public String toString(Jedis t, int i) {
return t.toString();
}
@Override
public String toVariableNameString(Jedis t) {
return t.toString();
}
@Override
public String getVariableNamePattern() {
return "jedis:+";
}
}));
}
}