Skip to content

Commit

Permalink
Changes, bug fixes, and visual improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
gravityfox committed Jan 10, 2016
1 parent 4d03c6c commit 93da82a
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ public void populateWorld(World world) {
addRegion(world, gr);
}

public void unloadWorld(World world){
this.regions.remove(world);
}

public GlobalHandler getGlobalHandler() {
return globalHandler;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ public void serverStopped(GameStoppedServerEvent event) {
public void worldUnload(UnloadWorldEvent event) {
logger.info("Saving data for World: \"" + event.getTargetWorld().getName() + "\"");
FGStorageManager.getInstance().writeWorld(event.getTargetWorld());
FGManager.getInstance().unloadWorld(event.getTargetWorld());
}

@Listener
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ else if (parse.current.type.equals(AdvCmdParse.CurrentElement.ElementType.LONGFL
@Override
public boolean testPermission(CommandSource source) {

return source.hasPermission("foxguard.command.info.objects.detail");
return source.hasPermission("foxguard.command.info.detail");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public CommandResult process(CommandSource source, String arguments) throws Comm
}
if (handlers.isEmpty()) throw new CommandException(Text.of("Must specify at least one Handler!"));
for (IHandler handler : handlers) {
if (handler instanceof GlobalRegion || handler.isEnabled() == this.enableState) failures++;
if (handler instanceof GlobalHandler || handler.isEnabled() == this.enableState) failures++;
else {
handler.setIsEnabled(this.enableState);
successes++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ else if (parse.current.type.equals(AdvCmdParse.CurrentElement.ElementType.LONGFL

@Override
public boolean testPermission(CommandSource source) {
return source.hasPermission("foxguard.command.info.objects.list");
return source.hasPermission("foxguard.command.info.list");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public List<String> modifySuggestions(CommandSource source, String arguments) th
.map(args -> parse.current.prefix + args)
.collect(GuavaCollectors.toImmutableList());
} else if (parse.current.index == 2) {
return ImmutableList.of("true", "false", "passthrough").stream()
return ImmutableList.of("true", "false", "passthrough", "clear").stream()
.filter(new StartsWithPredicate(parse.current.token))
.map(args -> parse.current.prefix + args)
.collect(GuavaCollectors.toImmutableList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public List<String> modifySuggestions(CommandSource source, String arguments) th
.collect(GuavaCollectors.toImmutableList());
}
} else if (isIn(SET_ALIASES, parse.args[0])) {
return ImmutableList.of("true", "false", "passthrough").stream()
return ImmutableList.of("true", "false", "passthrough", "clear").stream()
.filter(new StartsWithPredicate(parse.current.token))
.map(args -> parse.current.prefix + args)
.collect(GuavaCollectors.toImmutableList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public List<String> modifySuggestions(CommandSource source, String arguments) th
.collect(GuavaCollectors.toImmutableList());
}
} else if (isIn(SET_ALIASES, parse.args[0])) {
return ImmutableList.of("true", "false", "passthrough").stream()
return ImmutableList.of("true", "false", "passthrough", "clear").stream()
.filter(new StartsWithPredicate(parse.current.token))
.map(args -> parse.current.prefix + args)
.collect(GuavaCollectors.toImmutableList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,23 @@ public void handle(ChangeBlockEvent event) throws Exception {
}
flagState = typeFlag.resolve(flagState);
if (user instanceof Player && CommandDebug.instance().getDebug().get(user)) {
((Player) user).sendMessage(Text.of());
Vector3i vec = event.getTransactions().get(0).getOriginal().getPosition();
((Player) user).sendMessage(Text.of("Block action denied at (" + vec.getX() + ", " + vec.getY() + ", " + vec.getZ() + ")"
+ (event.getTransactions().size() > 1 ? " and " + (event.getTransactions().size() - 1) + " other positions" : "") + "!"));
} else {
if (flagState == Tristate.FALSE) {
if (user instanceof Player)
((Player) user).sendMessage(Text.of("You don't have permission!"));
if (user instanceof Player) {
Player player = (Player) user;
Vector3i pos = player.getLocation().getPosition().toInt();
boolean flag = false;
for (Transaction<BlockSnapshot> trans : event.getTransactions()) {
if (trans.getOriginal().getPosition().distanceSquared(pos) < 4096) {
flag = true;
break;
}
}
if (flag) player.sendMessage(Text.of("You don't have permission!"));
}
} else {

}
Expand Down

0 comments on commit 93da82a

Please sign in to comment.