Skip to content

Commit

Permalink
Fixed filtering issues, misc visual changes to help command
Browse files Browse the repository at this point in the history
  • Loading branch information
Karanum committed Jun 9, 2017
1 parent b9418e4 commit c02c99b
Show file tree
Hide file tree
Showing 17 changed files with 25 additions and 24 deletions.
Binary file modified .gradle/2.6/taskArtifacts/cache.properties.lock
Binary file not shown.
Binary file modified .gradle/2.6/taskArtifacts/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/2.6/taskArtifacts/fileSnapshots.bin
Binary file not shown.
Binary file modified .gradle/2.6/taskArtifacts/outputFileStates.bin
Binary file not shown.
Binary file modified .gradle/2.6/taskArtifacts/taskArtifacts.bin
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,37 @@ public class CommandMain implements CommandExecutor {
@Override
public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
boolean hasAnyPermission = false;
Text text = Text.of(TextColors.DARK_AQUA, "[AS] ", TextColors.YELLOW, "Available commands: ", Text.NEW_LINE);
Text text = Text.of(TextColors.DARK_AQUA, "[AS] ", TextColors.YELLOW, "Available commands: ");
if (src.hasPermission(Permissions.LOOKUP.get())) {
hasAnyPermission = true;
text = Text.of(text, CommandInspect.getHelpEntry(), Text.NEW_LINE, CommandLookup.getHelpEntry(), Text.NEW_LINE);
text = Text.of(text, Text.NEW_LINE, CommandInspect.getHelpEntry(), Text.NEW_LINE, CommandLookup.getHelpEntry());
}
if (src.hasPermission(Permissions.FILTER.get())) {
hasAnyPermission = true;
text = Text.of(text, CommandFilter.getHelpEntry(), Text.NEW_LINE);
text = Text.of(text, Text.NEW_LINE, CommandFilter.getHelpEntry());
}
if (src.hasPermission(Permissions.LOOKUP.get())) {
text = Text.of(text, CommandPage.getHelpEntry(), Text.NEW_LINE, CommandNextPage.getHelpEntry(), Text.NEW_LINE,
CommandPrevPage.getHelpEntry(), Text.NEW_LINE);
text = Text.of(text, Text.NEW_LINE, CommandPage.getHelpEntry(), Text.NEW_LINE, CommandNextPage.getHelpEntry(), Text.NEW_LINE,
CommandPrevPage.getHelpEntry());
}
if (src.hasPermission(Permissions.PURGE.get())) {
hasAnyPermission = true;
text = Text.of(text, CommandPurge.getHelpEntry(), Text.NEW_LINE);
text = Text.of(text, Text.NEW_LINE, CommandPurge.getHelpEntry());
}

if (hasAnyPermission) {
text = Text.of(text, getHelpEntry(), Text.NEW_LINE);
text = Text.of(text, Text.NEW_LINE, getHelpEntry());
} else {
text = Text.of(TextColors.DARK_AQUA, "[AS] ", TextColors.YELLOW, "AdmantineShield v",
Sponge.getPluginManager().getPlugin("adamantineshield").get().getVersion(), " by Karanum");
text = Text.of(TextColors.DARK_AQUA, "[AS] ", TextColors.YELLOW, "AdamantineShield v",
Sponge.getPluginManager().getPlugin("adamantineshield").get().getVersion().get());
}

src.sendMessage(text);
return CommandResult.success();
}

public static Text getHelpEntry() {
return Text.of(TextColors.YELLOW, "/ashield help", TextColors.AQUA, " - Shows command help");
return Text.of(TextColors.AQUA, "/ashield help", TextColors.WHITE, " - Shows command help");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void doPurge(CommandSource src, long before) {
}

public static Text getHelpEntry() {
return Text.of(TextColors.YELLOW, "/ashield purge <time>", TextColors.AQUA, " - Purges old log entries");
return Text.of(TextColors.AQUA, "/ashield purge <time>", TextColors.WHITE, " - Purges old log entries");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm
}

public static Text getHelpEntry() {
return Text.of(TextColors.YELLOW, "/ashield reload", TextColors.AQUA, " - Reloads this plugin");
return Text.of(TextColors.AQUA, "/ashield reload", TextColors.WHITE, " - Reloads this plugin");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm

FilterSet filterSet = new FilterSet(plugin, p, false);
filterSet.forceLookupType(lookup.getLookupType());
FilterParser.parse(filters, filterSet);
FilterParser.parse(filters, filterSet, p);
lookup.filterResult(filterSet);

lookup.showPage(p, 1);
return CommandResult.success();
}

public static Text getHelpEntry() {
return Text.of(TextColors.YELLOW, "/ashield filter [filters]", TextColors.AQUA, " - Filters your last result");
return Text.of(TextColors.AQUA, "/ashield filter [filters]", TextColors.WHITE, " - Filters your last result");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm
}

public static Text getHelpEntry() {
return Text.of(TextColors.YELLOW, "/ashield inspect", TextColors.AQUA, " - Toggles the inspector");
return Text.of(TextColors.AQUA, "/ashield inspect", TextColors.WHITE, " - Toggles the inspector");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm
Collection<String> filters = args.getAll("filter");

FilterSet filterSet = new FilterSet(plugin, p, true);
FilterParser.parse(filters, filterSet);
FilterParser.parse(filters, filterSet, p);
String targetTable = filterSet.getLookupType().getTable();

Sponge.getScheduler().createAsyncExecutor(plugin).execute(() -> {
Expand Down Expand Up @@ -81,7 +81,7 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm
}

public static Text getHelpEntry() {
return Text.of(TextColors.YELLOW, "/ashield lookup [filters]", TextColors.AQUA, " - Performs a lookup");
return Text.of(TextColors.AQUA, "/ashield lookup [filters]", TextColors.WHITE, " - Performs a lookup");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm
}

public static Text getHelpEntry() {
return Text.of(TextColors.YELLOW, "/ashield nextpage", TextColors.AQUA, " - Switches to next result page");
return Text.of(TextColors.AQUA, "/ashield nextpage", TextColors.WHITE, " - Switches to next result page");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm
}

public static Text getHelpEntry() {
return Text.of(TextColors.YELLOW, "/ashield page <page>", TextColors.AQUA, " - Switches lookup result page");
return Text.of(TextColors.AQUA, "/ashield page <page>", TextColors.WHITE, " - Switches lookup result page");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm
}

public static Text getHelpEntry() {
return Text.of(TextColors.YELLOW, "/ashield prevpage", TextColors.AQUA, " - Switches to previous result page");
return Text.of(TextColors.AQUA, "/ashield prevpage", TextColors.WHITE, " - Switches to previous result page");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm
}

public static Text getHelpEntry() {
return Text.of(TextColors.YELLOW, "/ashield rollback [filters]", TextColors.AQUA, " - Performs a rollback");
return Text.of(TextColors.AQUA, "/ashield rollback [filters]", TextColors.WHITE, " - Performs a rollback");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm
}

public static Text getHelpEntry() {
return Text.of(TextColors.YELLOW, "/ashield undo [filters]", TextColors.AQUA, " - Undoes rollback results");
return Text.of(TextColors.AQUA, "/ashield undo [filters]", TextColors.WHITE, " - Undoes rollback results");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.spongepowered.api.Sponge;
import org.spongepowered.api.block.BlockType;
import org.spongepowered.api.command.CommandException;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.item.ItemType;
import org.spongepowered.api.profile.GameProfile;
import org.spongepowered.api.text.Text;
Expand All @@ -34,7 +35,7 @@ public static void setConfig(ConfigHandler config) {
FilterParser.config = config;
}

public static void parse(Collection<String> filters, FilterSet container) throws CommandException {
public static void parse(Collection<String> filters, FilterSet container, Player p) throws CommandException {
if (container == null || filters.isEmpty())
return;

Expand Down Expand Up @@ -98,7 +99,7 @@ public static void parse(Collection<String> filters, FilterSet container) throws
}
if (radius < 0 || radius > config.getInt("lookup", "max-radius"))
throw new CommandException(Text.of(TextColors.RED, "Radius is either negative or too large!"));
((PositionFilter) container.getFilter(PositionFilter.class).get()).setRadius(radius);
container.getOrCreate(new PositionFilter(p.getLocation().getBlockPosition(), 0)).setRadius(radius);
break;
}
}
Expand Down

0 comments on commit c02c99b

Please sign in to comment.