From 752c8e2da401b21b57c5f1653b93975ca35b7f65 Mon Sep 17 00:00:00 2001 From: Govindas Date: Mon, 18 Nov 2019 12:21:32 +0200 Subject: [PATCH] Delete ExprEditSessionLimit.java --- .../expressions/ExprEditSessionLimit.java | 76 ------------------- 1 file changed, 76 deletions(-) delete mode 100644 src/me/TheBukor/SkStuff/expressions/ExprEditSessionLimit.java diff --git a/src/me/TheBukor/SkStuff/expressions/ExprEditSessionLimit.java b/src/me/TheBukor/SkStuff/expressions/ExprEditSessionLimit.java deleted file mode 100644 index 095d5b8..0000000 --- a/src/me/TheBukor/SkStuff/expressions/ExprEditSessionLimit.java +++ /dev/null @@ -1,76 +0,0 @@ -package me.TheBukor.SkStuff.expressions; - -import javax.annotation.Nullable; - -import org.bukkit.Bukkit; -import org.bukkit.event.Event; - -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.bukkit.WorldEditPlugin; - -import ch.njol.skript.classes.Changer.ChangeMode; -import ch.njol.skript.lang.Expression; -import ch.njol.skript.lang.SkriptParser.ParseResult; -import ch.njol.skript.lang.util.SimpleExpression; -import ch.njol.util.Kleenean; -import ch.njol.util.coll.CollectionUtils; - -public class ExprEditSessionLimit extends SimpleExpression { - private Expression editSession; - private WorldEditPlugin we = (WorldEditPlugin) Bukkit.getServer().getPluginManager().getPlugin("WorldEdit"); - - - @Override - public Class getReturnType() { - return Integer.class; - } - - @Override - public boolean isSingle() { - return true; - } - - @SuppressWarnings("unchecked") - @Override - public boolean init(Expression[] expr, int matchedPattern, Kleenean arg2, ParseResult arg3) { - editSession = (Expression) expr[0]; - return true; - } - - @Override - public String toString(@Nullable Event e, boolean debug) { - return "the block change limit of an edit session"; - } - - @Override - @Nullable - protected Integer[] get(Event e) { - EditSession session = editSession.getSingle(e); - if (session == null) - return null; - return new Integer[] { session.getBlockChangeLimit() }; - } - - @Override - public void change(Event e, @Nullable Object[] delta, ChangeMode mode) { - EditSession session = editSession.getSingle(e); - if (session == null) - return; - if (mode == ChangeMode.SET) { - Integer newLimit = (Integer) delta[0]; - session.setBlockChangeLimit(Integer.valueOf(newLimit)); - } else if (mode == ChangeMode.RESET) { - session.setBlockChangeLimit(Integer.valueOf(we.getLocalConfiguration().defaultChangeLimit)); - } - } - - @SuppressWarnings("unchecked") - @Override - @Nullable - public Class[] acceptChange(ChangeMode mode) { - if (mode == ChangeMode.SET || mode == ChangeMode.RESET || mode == ChangeMode.DELETE) { - return CollectionUtils.array(Integer.class); - } - return null; - } -} \ No newline at end of file