Skip to content
This repository has been archived by the owner on Sep 29, 2019. It is now read-only.

Commit

Permalink
Added offlineplayer support for syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Sharpjaws committed Jul 30, 2017
1 parent fb99e25 commit 91dcdc3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,42 @@

import javax.annotation.Nullable;

import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;

import ch.njol.skript.lang.Effect;
import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.SkriptParser;
import ch.njol.util.Kleenean;
import ru.tehkode.permissions.PermissionUser;
import ru.tehkode.permissions.bukkit.PermissionsEx;

public class EffPexRemoveGroupFromPlayer extends Effect {
private Expression<String> s;
private Expression<Player> player;
private Expression<OfflinePlayer> p;

@SuppressWarnings("unchecked")
@Override
public boolean init(Expression<?>[] expr, int matchedPattern, Kleenean paramKleenean,
SkriptParser.ParseResult paramParseResult) {
s = (Expression<String>) expr[0];
player = (Expression<Player>) expr[1];
p = (Expression<OfflinePlayer>) expr[1];

return true;
}

@Override
public String toString(@Nullable Event paramEvent, boolean paramBoolean) {
return "pex remove group %string% from %player%";
return "pex remove group %string% from %offlineplayers%";
}

@Override
protected void execute(Event e) {
PermissionsEx.getUser(player.getSingle(e)).removeGroup(s.getSingle(e));
for (OfflinePlayer op : p.getAll(e)){
PermissionUser permuser = PermissionsEx.getPermissionManager().getUser(op.getUniqueId());
permuser.removeGroup(s.getSingle(e));
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static void registerPermissionsEx() {
Skript.registerEffect(EffAddPexPerm.class, "pex add perm[ission] %string% to %offlineplayers%");
Skript.registerEffect(EffPexAddgroup.class, "pex add group %string% to %offlineplayers%");
Skript.registerEffect(EffPexRemoveGroupFromPlayer.class,
"pex (remove|delete) group %string% from %players%");
"pex (remove|delete) group %string% from %offlineplayers%");
Skript.registerEffect(EffPexAddPermGroup.class,
"pex add perm[ission] %string% to group %string%");
Skript.registerEffect(EffPexRemovePermGroup.class,
Expand Down

0 comments on commit 91dcdc3

Please sign in to comment.