Skip to content

Commit

Permalink
fix errors from wrong mapping usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Gegy committed Jul 16, 2021
1 parent 5d88ae0 commit cc5342a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/main/java/xyz/nucleoid/leukocyte/command/ProtectCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ private static int addAuthority(CommandContext<ServerCommandSource> context, Una
var key = StringArgumentType.getString(context, "authority");

var source = context.getSource();
var leukocyte = Leukocyte.get(source.getMinecraftServer());
var leukocyte = Leukocyte.get(source.getServer());
var authority = operator.apply(Authority.create(key));

if (leukocyte.addAuthority(authority)) {
Expand Down Expand Up @@ -174,7 +174,7 @@ private static int addAuthority(CommandContext<ServerCommandSource> context, Una
private static int remove(CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
var authority = AuthorityArgument.get(context, "authority");

var leukocyte = Leukocyte.get(context.getSource().getMinecraftServer());
var leukocyte = Leukocyte.get(context.getSource().getServer());
leukocyte.removeAuthority(authority.getKey());

context.getSource().sendFeedback(new LiteralText("Removed authority " + authority.getKey()), true);
Expand All @@ -183,7 +183,7 @@ private static int remove(CommandContext<ServerCommandSource> context) throws Co
}

private static int setRule(CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
var leukocyte = Leukocyte.get(context.getSource().getMinecraftServer());
var leukocyte = Leukocyte.get(context.getSource().getServer());
var authority = AuthorityArgument.get(context, "authority");

var rule = ProtectionRuleArgument.get(context, "rule");
Expand All @@ -201,7 +201,7 @@ private static int setLevel(CommandContext<ServerCommandSource> context) throws
var authority = AuthorityArgument.get(context, "authority");
int level = IntegerArgumentType.getInteger(context, "level");

var leukocyte = Leukocyte.get(context.getSource().getMinecraftServer());
var leukocyte = Leukocyte.get(context.getSource().getServer());

var newAuthority = authority.withLevel(level);
leukocyte.replaceAuthority(authority, newAuthority);
Expand Down Expand Up @@ -270,7 +270,7 @@ private static int removeRoleExclusion(CommandContext<ServerCommandSource> conte
}

private static int listAuthorities(CommandContext<ServerCommandSource> context) {
var leukocyte = Leukocyte.get(context.getSource().getMinecraftServer());
var leukocyte = Leukocyte.get(context.getSource().getServer());

var authorities = leukocyte.getAuthorities();
if (authorities.isEmpty()) {
Expand All @@ -294,7 +294,7 @@ private static int testRulesHere(CommandContext<ServerCommandSource> context) th
var source = context.getSource();
var player = source.getPlayer();

var leukocyte = Leukocyte.get(source.getMinecraftServer());
var leukocyte = Leukocyte.get(source.getServer());

var authorities = new ArrayList<Authority>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private static int addShapeToAuthority(CommandContext<ServerCommandSource> conte
if (builder != null) {
var shape = builder.finish();

var leukocyte = Leukocyte.get(source.getMinecraftServer());
var leukocyte = Leukocyte.get(source.getServer());
leukocyte.replaceAuthority(authority, authority.addShape(name, shape));

source.sendFeedback(new LiteralText("Added shape as '" + name + "' to '" + authority.getKey() + "'!"), true);
Expand All @@ -176,7 +176,7 @@ private static int removeShapeFromAuthority(CommandContext<ServerCommandSource>
throw SHAPE_NOT_FOUND.create();
}

var leukocyte = Leukocyte.get(source.getMinecraftServer());
var leukocyte = Leukocyte.get(source.getServer());
leukocyte.replaceAuthority(authority, newAuthority);

source.sendFeedback(new LiteralText("Removed shape '" + name + "' from '" + authority.getKey() + "'!"), true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static RequiredArgumentBuilder<ServerCommandSource, String> argument(Stri
return CommandManager.argument(name, StringArgumentType.string())
.suggests((context, builder) -> {
var source = context.getSource();
var leukocyte = Leukocyte.get(source.getMinecraftServer());
var leukocyte = Leukocyte.get(source.getServer());

return CommandSource.suggestMatching(
leukocyte.getAuthorities().stream().map(Authority::getKey),
Expand All @@ -34,7 +34,7 @@ public static Authority get(CommandContext<ServerCommandSource> context, String
var key = StringArgumentType.getString(context, name);

var source = context.getSource();
var leukocyte = Leukocyte.get(source.getMinecraftServer());
var leukocyte = Leukocyte.get(source.getServer());

var authority = leukocyte.getAuthorityByKey(key);
if (authority == null) {
Expand Down

0 comments on commit cc5342a

Please sign in to comment.