Skip to content

Commit

Permalink
Update a few things. Bump to 0.8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
gravityfox committed Nov 27, 2015
1 parent 8c85a27 commit cd9c80a
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 61 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import java.nio.file.Files
import java.nio.file.StandardCopyOption

group 'tk.elektrofuchse.fox.foxguard'
version '0.8.6-SNAPSHOT'
version '0.8.7-SNAPSHOT'

apply plugin: 'java'

Expand Down
7 changes: 4 additions & 3 deletions src/main/java/net/gravityfox/foxguard/FoxGuardMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
import java.io.File;
import java.sql.SQLException;

import static net.gravityfox.foxguard.util.Aliases.flagSetsAliases;
import static net.gravityfox.foxguard.util.Aliases.FLAG_SETS_ALIASES;

/**
* Created by Fox on 8/16/2015.
Expand All @@ -65,7 +65,7 @@
@Plugin(id = "foxguard", name = "FoxGuard", version = FoxGuardMain.PLUGIN_VERSION)
public class FoxGuardMain {

public static final String PLUGIN_VERSION = "0.8.6";
public static final String PLUGIN_VERSION = "0.8.7";

private static FoxGuardMain instance;

Expand Down Expand Up @@ -181,7 +181,7 @@ private void registerCommands() {

fgFlagSetDispatcher.register(new CommandPriority(), "priority", "prio", "level", "rank");

fgDispatcher.register(fgFlagSetDispatcher, flagSetsAliases);
fgDispatcher.register(fgFlagSetDispatcher, FLAG_SETS_ALIASES);

game.getCommandDispatcher().register(this, fgDispatcher, "foxguard", "foxg", "fguard", "fg");
}
Expand All @@ -195,6 +195,7 @@ private void registerListeners() {

private void configurePermissions() {
getPermissionService().getDefaultData().setPermission(SubjectData.GLOBAL_CONTEXT, "foxguard.command.info", Tristate.TRUE);
getPermissionService().getDefaultData().setPermission(SubjectData.GLOBAL_CONTEXT, "foxguard.override", Tristate.FALSE);
}

public Logger getLogger() {
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/net/gravityfox/foxguard/commands/CommandAdd.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public CommandResult process(CommandSource source, String arguments) throws Comm
.append(getUsage(source))
.build());
return CommandResult.empty();
} else if (isAlias(regionsAliases, args[0])) {
} else if (isAlias(REGIONS_ALIASES, args[0])) {
if (args.length < 2) throw new CommandException(Texts.of("Must specify a name!"));
int flag = 0;
Optional<World> optWorld = FGHelper.parseWorld(args[1], FoxGuardMain.getInstance().getGame().getServer());
Expand All @@ -90,7 +90,7 @@ public CommandResult process(CommandSource source, String arguments) throws Comm

source.sendMessage(Texts.of(TextColors.GREEN, "Successfully added Region to your state buffer!"));
return CommandResult.success();
} else if (isAlias(flagSetsAliases, args[0])) {
} else if (isAlias(FLAG_SETS_ALIASES, args[0])) {
if (args.length < 2) throw new CommandException(Texts.of("Must specify a name!"));
IFlagSet flagSet = FGManager.getInstance().getFlagSet(args[1]);
if (flagSet == null)
Expand All @@ -101,7 +101,7 @@ public CommandResult process(CommandSource source, String arguments) throws Comm

source.sendMessage(Texts.of(TextColors.GREEN, "Successfully added FlagSet to your state buffer!"));
return CommandResult.success();
} else if (isAlias(positionsAliases, args[0])) {
} else if (isAlias(POSITIONS_ALIASES, args[0])) {
int x, y, z;
Vector3i pPos = player.getLocation().getBlockPosition();
if (args.length == 1) {
Expand Down Expand Up @@ -162,7 +162,7 @@ public Optional<? extends Text> getHelp(CommandSource source) {
@Override
public Text getUsage(CommandSource source) {
if (source instanceof Player)
return Texts.of("detail <region [w:<worldname>] | flagset> <name>");
else return Texts.of("detail <region <worldname> | flagset> <name>");
return Texts.of("add <region [w:<worldname>] | flagset> <name>");
else return Texts.of("add <region <worldname> | flagset> <name>");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public CommandResult process(CommandSource source, String arguments) throws Comm
.build());
return CommandResult.empty();
//----------------------------------------------------------------------------------------------------------------------
} else if (isAlias(regionsAliases, args[0])) {
} else if (isAlias(REGIONS_ALIASES, args[0])) {
if (args.length < 2) throw new CommandException(Texts.of("Must specify a name!"));
int flag = 0;
Optional<World> optWorld = FGHelper.parseWorld(args[1], FoxGuardMain.getInstance().getGame().getServer());
Expand Down Expand Up @@ -103,7 +103,7 @@ public CommandResult process(CommandSource source, String arguments) throws Comm
player.sendMessage(Texts.of(TextColors.GREEN, "Region created successfully"));
return CommandResult.success();
//----------------------------------------------------------------------------------------------------------------------
} else if (isAlias(flagSetsAliases, args[0])) {
} else if (isAlias(FLAG_SETS_ALIASES, args[0])) {
if (args.length < 2) throw new CommandException(Texts.of("Must specify a name!"));
if (args[1].matches("^.*[^0-9a-zA-Z_$].*$"))
throw new ArgumentParseException(Texts.of("Name must be alphanumeric!"), args[1], 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public CommandResult process(CommandSource source, String arguments) throws Comm
.append(getUsage(source))
.build());
return CommandResult.empty();
} else if (isAlias(regionsAliases, args[0])) {
} else if (isAlias(REGIONS_ALIASES, args[0])) {
if (args.length < 2) throw new CommandException(Texts.of("Must specify a name!"));
int flag = 0;
Optional<World> optWorld = FGHelper.parseWorld(args[1], FoxGuardMain.getInstance().getGame().getServer());
Expand All @@ -88,7 +88,7 @@ public CommandResult process(CommandSource source, String arguments) throws Comm
throw new ArgumentParseException(Texts.of("No Region exists with that name!"), args[1 + flag], 1 + flag);

player.sendMessage(Texts.of(TextColors.GREEN, "Region deleted successfully!"));
} else if (isAlias(flagSetsAliases, args[0])) {
} else if (isAlias(FLAG_SETS_ALIASES, args[0])) {
if (args.length < 2) throw new CommandException(Texts.of("Must specify a name!"));
if (args[1].equalsIgnoreCase(GlobalFlagSet.NAME))
throw new CommandException(Texts.of("You may not delete the global FlagSet!"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public CommandResult process(CommandSource source, String arguments) throws Comm
.append(getUsage(source))
.build());
return CommandResult.empty();
} else if (isAlias(regionsAliases, args[0])) {
} else if (isAlias(REGIONS_ALIASES, args[0])) {
if (args.length < 2) throw new CommandException(Texts.of("Must specify a name!"));
int flag = 0;
Optional<World> optWorld = FGHelper.parseWorld(args[1], FoxGuardMain.getInstance().getGame().getServer());
Expand Down Expand Up @@ -100,7 +100,7 @@ public CommandResult process(CommandSource source, String arguments) throws Comm
"\n" + flagSet.getShortTypeName() + " : " + flagSet.getName())));
player.sendMessage(builder.build());

} else if (isAlias(flagSetsAliases, args[0])) {
} else if (isAlias(FLAG_SETS_ALIASES, args[0])) {
if (args.length < 2) throw new CommandException(Texts.of("Must specify a name!"));

IFlagSet flagSet = FGManager.getInstance().getFlagSet(args[1]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ public CommandResult process(CommandSource source, String arguments) throws Comm
}

public InternalCommandState.StateField getType(String input) {
if (contains(regionsAliases, input)) return InternalCommandState.StateField.REGIONS;
else if (contains(flagSetsAliases, input)) return InternalCommandState.StateField.FLAGSETS;
else if (contains(positionsAliases, input)) return InternalCommandState.StateField.POSITIONS;
if (contains(REGIONS_ALIASES, input)) return InternalCommandState.StateField.REGIONS;
else if (contains(FLAG_SETS_ALIASES, input)) return InternalCommandState.StateField.FLAGSETS;
else if (contains(POSITIONS_ALIASES, input)) return InternalCommandState.StateField.POSITIONS;
else return null;
}

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/net/gravityfox/foxguard/commands/CommandList.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
import java.util.ListIterator;
import java.util.Optional;

import static net.gravityfox.foxguard.util.Aliases.flagSetsAliases;
import static net.gravityfox.foxguard.util.Aliases.regionsAliases;
import static net.gravityfox.foxguard.util.Aliases.FLAG_SETS_ALIASES;
import static net.gravityfox.foxguard.util.Aliases.REGIONS_ALIASES;

/**
* Created by Fox on 8/18/2015.
Expand All @@ -73,7 +73,7 @@ public CommandResult process(CommandSource source, String arguments) throws Comm
.append(getUsage(source))
.build());
return CommandResult.empty();
} else if (contains(regionsAliases, args[0])) {
} else if (contains(REGIONS_ALIASES, args[0])) {
List<IRegion> regionList = new LinkedList<>();
boolean allFlag = true;
int worldOffset = 0;
Expand Down Expand Up @@ -104,7 +104,7 @@ public CommandResult process(CommandSource source, String arguments) throws Comm
if (regionListIterator.hasNext()) output.append(Texts.of("\n"));
}
source.sendMessage(output.build());
} else if (contains(flagSetsAliases, args[0])) {
} else if (contains(FLAG_SETS_ALIASES, args[0])) {
List<IFlagSet> flagSetList = FGManager.getInstance().getFlagSetsListCopy();

/*try {
Expand Down Expand Up @@ -166,6 +166,6 @@ public Optional<? extends Text> getHelp(CommandSource source) {

@Override
public Text getUsage(CommandSource source) {
return Texts.of("list <regions [w:<world>] | flagsets> [page]");
return Texts.of("list <regions [w:<world>] | flagsets>");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public CommandResult process(CommandSource source, String arguments) throws Comm
.append(getUsage(source))
.build());
return CommandResult.empty();
} else if (isAlias(regionsAliases, args[0])) {
} else if (isAlias(REGIONS_ALIASES, args[0])) {
if (args.length < 2) throw new CommandException(Texts.of("Must specify a name!"));
int flag = 0;
Optional<World> optWorld = FGHelper.parseWorld(args[1], FoxGuardMain.getInstance().getGame().getServer());
Expand All @@ -88,7 +88,7 @@ public CommandResult process(CommandSource source, String arguments) throws Comm
FGCommandMainDispatcher.getInstance().getStateMap().get(player), player);
if (success) source.sendMessage(Texts.of(TextColors.GREEN, "Successfully modified!"));
else source.sendMessage(Texts.of(TextColors.RED, "Modification Failed!"));
} else if (isAlias(flagSetsAliases, args[0])) {
} else if (isAlias(FLAG_SETS_ALIASES, args[0])) {
if (args.length < 2) throw new CommandException(Texts.of("Must specify a name!"));
IFlagSet flagSet = FGManager.getInstance().getFlagSet(args[1]);
if (flagSet == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public CommandResult process(CommandSource source, String arguments) throws Comm
.append(getUsage(source))
.build());
return CommandResult.empty();
} else if (isAlias(regionsAliases, args[0])) {
} else if (isAlias(REGIONS_ALIASES, args[0])) {
if (args.length < 2) throw new CommandException(Texts.of("Must specify a name!"));
int flag = 0;
Optional<World> optWorld = FGHelper.parseWorld(args[1], FoxGuardMain.getInstance().getGame().getServer());
Expand Down Expand Up @@ -97,7 +97,7 @@ public CommandResult process(CommandSource source, String arguments) throws Comm
FGCommandMainDispatcher.getInstance().getStateMap().get(player).selectedRegions.remove(region);
source.sendMessage(Texts.of(TextColors.GREEN, "Successfully removed Region from your state buffer!"));
return CommandResult.success();
} else if (isAlias(flagSetsAliases, args[0])) {
} else if (isAlias(FLAG_SETS_ALIASES, args[0])) {
if (args.length < 2) throw new CommandException(Texts.of("Must specify a name or a number!"));
IFlagSet flagSet;
try {
Expand All @@ -116,7 +116,7 @@ public CommandResult process(CommandSource source, String arguments) throws Comm
FGCommandMainDispatcher.getInstance().getStateMap().get(player).selectedFlagSets.remove(flagSet);
source.sendMessage(Texts.of(TextColors.GREEN, "Successfully removed FlagSet from your state buffer!"));
return CommandResult.success();
} else if (isAlias(positionsAliases, args[0])) {
} else if (isAlias(POSITIONS_ALIASES, args[0])) {
int index = FGCommandMainDispatcher.getInstance().getStateMap().get(player).positions.size();
if (args.length > 1) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public PassiveFlagSet(String name, int priority, CallbackHashMap<Flags, Tristate
@Override
public Tristate isAllowed(@Nullable User user, Flags flag, Event event) {
if (!isEnabled) return Tristate.UNDEFINED;
if (user != null) return Tristate.UNDEFINED;
if (FGHelper.contains(availableFlags, flag)) {
return passiveMap.get(flag);
}
Expand All @@ -88,7 +89,7 @@ public boolean modify(String arguments, InternalCommandState state, CommandSourc
String[] args = {};
if (!arguments.isEmpty()) args = arguments.split(" +");
if (args.length > 0) {
if (isAlias(ownerAliases, args[1])) {
if (isAlias(OWNER_ALIASES, args[1])) {
if (args.length > 1) {
UserOperations op;
if (args[2].equalsIgnoreCase("add")) {
Expand Down Expand Up @@ -149,7 +150,7 @@ public boolean modify(String arguments, InternalCommandState state, CommandSourc
return false;
}

} else if (isAlias(setAliases, args[0])) {
} else if (isAlias(SET_ALIASES, args[0])) {
if (args.length > 1) {
Flags flag = flagFrom(args[1]);
if (flag == null) {
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/net/gravityfox/foxguard/flagsets/SimpleFlagSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ public boolean modify(String arguments, InternalCommandState state, CommandSourc
String[] args = {};
if (!arguments.isEmpty()) args = arguments.split(" +");
if (args.length > 0) {
if (isAlias(groupsAliases, args[0])) {
if (isAlias(GROUPS_ALIASES, args[0])) {
if (args.length > 1) {
List<User> list;
if (isAlias(ownerAliases, args[1])) {
if (isAlias(OWNER_ALIASES, args[1])) {
list = this.ownerList;
} else if (isAlias(memberAliases, args[1])) {
} else if (isAlias(MEMBER_ALIASES, args[1])) {
list = this.memberList;
} else {
source.sendMessage(Texts.of(TextColors.RED, "Not a valid group!"));
Expand Down Expand Up @@ -157,26 +157,26 @@ public boolean modify(String arguments, InternalCommandState state, CommandSourc
source.sendMessage(Texts.of(TextColors.RED, "Must specify a group!"));
return false;
}
} else if (isAlias(permissionAliases, args[0])) {
} else if (isAlias(PERMISSION_ALIASES, args[0])) {
return true;
} else if (isAlias(passiveAliases, args[0])) {
} else if (isAlias(PASSIVE_ALIASES, args[0])) {
if (args.length > 1) {
if (isAlias(trueAliases, args[1])) {
if (isAlias(TRUE_ALIASES, args[1])) {
this.passiveOption = PassiveOptions.ALLOW;
return true;
} else if (isAlias(falseAliases, args[1])) {
} else if (isAlias(FALSE_ALIASES, args[1])) {
this.passiveOption = PassiveOptions.DENY;
return true;
} else if (isAlias(passthroughAliases, args[1])) {
} else if (isAlias(PASSTHROUGH_ALIASES, args[1])) {
this.passiveOption = PassiveOptions.PASSTHROUGH;
return true;
} else if (isAlias(ownerAliases, args[1])) {
} else if (isAlias(OWNER_ALIASES, args[1])) {
this.passiveOption = PassiveOptions.OWNER;
return true;
} else if (isAlias(memberAliases, args[1])) {
} else if (isAlias(MEMBER_ALIASES, args[1])) {
this.passiveOption = PassiveOptions.MEMBER;
return true;
} else if (isAlias(defaultAliases, args[1])) {
} else if (isAlias(DEFAULT_ALIASES, args[1])) {
this.passiveOption = PassiveOptions.DEFAULT;
return true;
} else {
Expand Down
Loading

0 comments on commit cd9c80a

Please sign in to comment.