mirror of https://github.com/GeyserMC/Geyser.git
hnnnng
This commit is contained in:
parent
956d60721c
commit
37807a5115
|
@ -293,7 +293,7 @@ public class CommandRegistry {
|
|||
|
||||
// See GeyserCommand#baseBuilder()
|
||||
if (meta.getOrDefault(GeyserCommand.BEDROCK_ONLY, false)) {
|
||||
if (source.connection().isEmpty()) {
|
||||
if (source.connection() == null) {
|
||||
source.sendMessage(ChatColor.RED + GeyserLocale.getPlayerLocaleString("geyser.command.bedrock_only", source.locale()));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ public abstract class GeyserCommand implements org.geysermc.geyser.api.command.C
|
|||
.literal(name, aliases.toArray(new String[0]))
|
||||
.permission(source -> {
|
||||
if (bedrockOnly) {
|
||||
if (source.connection().isEmpty()) {
|
||||
if (source.connection() == null) {
|
||||
return false;
|
||||
}
|
||||
// connection is present -> it is a player -> executableOnConsole is irrelevant
|
||||
|
|
|
@ -33,6 +33,8 @@ import org.geysermc.geyser.session.GeyserSession;
|
|||
import org.geysermc.geyser.text.ChatColor;
|
||||
import org.geysermc.geyser.text.MinecraftLocale;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class AdvancedTooltipsCommand extends GeyserCommand {
|
||||
|
||||
public AdvancedTooltipsCommand(String name, String description, String permission) {
|
||||
|
@ -41,7 +43,7 @@ public class AdvancedTooltipsCommand extends GeyserCommand {
|
|||
|
||||
@Override
|
||||
public void execute(CommandContext<GeyserCommandSource> context) {
|
||||
GeyserSession session = context.getSender().connection().orElseThrow();
|
||||
GeyserSession session = Objects.requireNonNull(context.getSender().connection());
|
||||
|
||||
String onOrOff = session.isAdvancedTooltips() ? "off" : "on";
|
||||
session.setAdvancedTooltips(!session.isAdvancedTooltips());
|
||||
|
|
|
@ -31,6 +31,8 @@ import org.geysermc.geyser.command.GeyserCommand;
|
|||
import org.geysermc.geyser.command.GeyserCommandSource;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class AdvancementsCommand extends GeyserCommand {
|
||||
|
||||
public AdvancementsCommand(String name, String description, String permission) {
|
||||
|
@ -39,7 +41,7 @@ public class AdvancementsCommand extends GeyserCommand {
|
|||
|
||||
@Override
|
||||
public void execute(CommandContext<GeyserCommandSource> context) {
|
||||
GeyserSession session = context.getSender().connection().orElseThrow();
|
||||
GeyserSession session = Objects.requireNonNull(context.getSender().connection());
|
||||
session.getAdvancementsCache().buildAndShowMenuForm();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,24 +25,18 @@
|
|||
|
||||
package org.geysermc.geyser.command.defaults;
|
||||
|
||||
import cloud.commandframework.Command;
|
||||
import cloud.commandframework.CommandManager;
|
||||
import cloud.commandframework.arguments.standard.IntegerArgument;
|
||||
import cloud.commandframework.arguments.standard.StringArgument;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import cloud.commandframework.CommandManager;
|
||||
import cloud.commandframework.arguments.standard.IntegerArgument;
|
||||
import cloud.commandframework.arguments.standard.StringArgument;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.api.util.TriState;
|
||||
import org.geysermc.geyser.api.util.PlatformType;
|
||||
import org.geysermc.geyser.command.GeyserCommand;
|
||||
import org.geysermc.geyser.command.GeyserCommandSource;
|
||||
import org.geysermc.geyser.util.LoopbackUtil;
|
||||
import org.geysermc.geyser.util.WebUtils;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ public class HelpCommand extends GeyserCommand {
|
|||
@Override
|
||||
public void execute(CommandContext<GeyserCommandSource> context) {
|
||||
GeyserCommandSource source = context.getSender();
|
||||
boolean bedrockPlayer = source.connection().isPresent();
|
||||
boolean bedrockPlayer = source.connection() != null;
|
||||
|
||||
// todo: pagination
|
||||
int page = 1;
|
||||
|
|
|
@ -32,6 +32,8 @@ import org.geysermc.geyser.command.GeyserCommand;
|
|||
import org.geysermc.geyser.command.GeyserCommandSource;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class OffhandCommand extends GeyserCommand {
|
||||
|
||||
public OffhandCommand(GeyserImpl geyser, String name, String description, String permission) {
|
||||
|
@ -40,7 +42,7 @@ public class OffhandCommand extends GeyserCommand {
|
|||
|
||||
@Override
|
||||
public void execute(CommandContext<GeyserCommandSource> context) {
|
||||
GeyserSession session = context.getSender().connection().orElseThrow();
|
||||
GeyserSession session = Objects.requireNonNull(context.getSender().connection());
|
||||
session.requestOffhandSwap();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,8 @@ import org.geysermc.geyser.command.GeyserCommandSource;
|
|||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.util.SettingsUtils;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class SettingsCommand extends GeyserCommand {
|
||||
|
||||
public SettingsCommand(GeyserImpl geyser, String name, String description, String permission) {
|
||||
|
@ -41,7 +43,7 @@ public class SettingsCommand extends GeyserCommand {
|
|||
|
||||
@Override
|
||||
public void execute(CommandContext<GeyserCommandSource> context) {
|
||||
GeyserSession session = context.getSender().connection().orElseThrow();
|
||||
GeyserSession session = Objects.requireNonNull(context.getSender().connection());
|
||||
session.sendForm(SettingsUtils.buildForm(session));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@ import org.geysermc.geyser.command.GeyserCommand;
|
|||
import org.geysermc.geyser.command.GeyserCommandSource;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class StatisticsCommand extends GeyserCommand {
|
||||
|
||||
public StatisticsCommand(GeyserImpl geyser, String name, String description, String permission) {
|
||||
|
@ -42,7 +44,7 @@ public class StatisticsCommand extends GeyserCommand {
|
|||
|
||||
@Override
|
||||
public void execute(CommandContext<GeyserCommandSource> context) {
|
||||
GeyserSession session = context.getSender().connection().orElseThrow();
|
||||
GeyserSession session = Objects.requireNonNull(context.getSender().connection());
|
||||
|
||||
session.setWaitingForStatistics(true);
|
||||
ServerboundClientCommandPacket packet = new ServerboundClientCommandPacket(ClientCommand.STATS);
|
||||
|
|
|
@ -198,7 +198,7 @@ public abstract class GeyserExtensionCommand extends GeyserCommand {
|
|||
return;
|
||||
}
|
||||
|
||||
GeyserSession session = source.connection().orElse(null);
|
||||
@Nullable GeyserSession session = source.connection();
|
||||
if (sourceType.isInstance(session)) {
|
||||
executor.execute((T) session, this, args);
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue