java 16 stuff and headaches

This commit is contained in:
Draycia committed 2021-05-12 13:13:51 -07:00
1 parent a273f5896f
commit aec22f12c9
10 files changed
+51 -78

No files matched your search

@@ -14,22 +14,15 @@ public interface SpongeCommander extends Commander, ForwardingAudience.Single {
return new SpongeCommanderImpl(commandCause);
}
final class SpongeCommanderImpl implements SpongeCommander {
private final CommandCause commandCause;
private SpongeCommanderImpl(final @NonNull CommandCause commandCause) {
this.commandCause = commandCause;
}
record SpongeCommanderImpl(
@NonNull CommandCause commandCause) implements SpongeCommander {
@Override
public @NonNull CommandCause commandCause() {
return this.commandCause;
}
@Override
public @NonNull Audience audience() {
public @NonNull
Audience audience() {
return this.commandCause.audience();
}
}
}
@@ -10,34 +10,21 @@ import org.spongepowered.api.entity.living.player.server.ServerPlayer;
import static java.util.Objects.requireNonNull;
public final class SpongePlayerCommander implements PlayerCommander, SpongeCommander {
public record SpongePlayerCommander(CarbonChat carbon,
@NonNull ServerPlayer player,
@NonNull CommandCause commandCause)
implements PlayerCommander, SpongeCommander {
private final CarbonChat carbon;
private final ServerPlayer player;
private final CommandCause commandCause;
public SpongePlayerCommander(final @NonNull CarbonChat carbon, final @NonNull ServerPlayer player, final @NonNull CommandCause commandCause) {
this.carbon = carbon;
this.player = player;
this.commandCause = commandCause;
@Override
public @NonNull
CarbonPlayer carbonPlayer() {
return requireNonNull(this.carbon.userManager().carbonPlayer(this.player.uniqueId()),
"No CarbonPlayer for logged in Player!");
}
@Override
public @NonNull CarbonPlayer carbonPlayer() {
return requireNonNull(this.carbon.userManager().carbonPlayer(this.player.uniqueId()), "No CarbonPlayer for logged in Player!");
}
public @NonNull ServerPlayer player() {
return this.player;
}
@Override
public @NonNull CommandCause commandCause() {
return this.commandCause;
}
@Override
public @NonNull Audience audience() {
public @NonNull
Audience audience() {
return this.commandCause.audience();
}