Skip to content

Commit

Permalink
Refactored another method.
Browse files Browse the repository at this point in the history
Modified Aliases.
  • Loading branch information
gravityfox committed Nov 28, 2015
1 parent b2a6190 commit dd78828
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public boolean modify(String arguments, InternalCommandState state, CommandSourc
}

@Override
public Tristate isAllowed(User user, Flags flag, Event event) {
public Tristate handle(User user, Flags flag, Event event) {
return Tristate.TRUE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*/
public interface IHandler extends IFGObject, Comparable<IHandler> {

Tristate isAllowed(@Nullable User user, Flags flag, Event event);
Tristate handle(@Nullable User user, Flags flag, Event event);

boolean isEnabled();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public PassiveHandler(String name, int priority, CallbackHashMap<Flags, Tristate
}

@Override
public Tristate isAllowed(@Nullable User user, Flags flag, Event event) {
public Tristate handle(@Nullable User user, Flags flag, Event event) {
if (!isEnabled) return Tristate.UNDEFINED;
if (user != null) return Tristate.UNDEFINED;
if (FGHelper.contains(availableFlags, flag)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public PermissionHandler(String name, int priority) {
}

@Override
public Tristate isAllowed(@Nullable User user, Flags flag, Event event) {
public Tristate handle(@Nullable User user, Flags flag, Event event) {
if (user == null) return Tristate.UNDEFINED;
if (user.hasPermission("foxguard.flags." + this.name + "." + flag.flagName() + ".allow"))
return Tristate.TRUE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public boolean modify(String arguments, InternalCommandState state, CommandSourc
}

@Override
public Tristate isAllowed(User user, Flags flag, Event event) {
public Tristate handle(User user, Flags flag, Event event) {
if (!isEnabled) return Tristate.UNDEFINED;
if (user == null) {
switch (this.passiveOption) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void handle(ChangeBlockEvent event) throws Exception {
if (handler.getPriority() < currPriority && flagState != Tristate.UNDEFINED) {
break;
}
flagState = flagState.and(handler.isAllowed(user, typeFlag, event));
flagState = flagState.and(handler.handle(user, typeFlag, event));
currPriority = handler.getPriority();
}
if (flagState == Tristate.FALSE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void handle(SpawnEntityEvent event) throws Exception {
if (handler.getPriority() < currPriority && flagState != Tristate.UNDEFINED) {
break;
}
flagState = flagState.and(handler.isAllowed(user, typeFlag, event));
flagState = flagState.and(handler.handle(user, typeFlag, event));
currPriority = handler.getPriority();
}
if (flagState == Tristate.FALSE) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/gravityfox/foxguard/util/Aliases.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
public class Aliases {

public static final String[] REGIONS_ALIASES = {"regions", "region", "reg", "r"};
public static final String[] HANDLERS_ALIASES = {"handlers", "handler", "flagsets", "flagset", "flags", "flag", "f"};
public static final String[] HANDLERS_ALIASES = {"handlers", "handler", "handles", "handle", "hands", "hand", "h", "flagsets", "flagset", "flags", "flag", "f"};
public static final String[] POSITIONS_ALIASES = {"positions", "position", "points", "point", "locations", "location", "pos", "loc", "locs", "p"};
public static final String[] OWNER_GROUP_ALIASES = {"owners", "owner", "master", "masters", "creator", "creators",
"admin", "admins", "administrator", "administrators", "mod", "mods"};
Expand Down

0 comments on commit dd78828

Please sign in to comment.