net.minecraft.server.dedicated.DedicatedServer Java Examples
The following examples show how to use
net.minecraft.server.dedicated.DedicatedServer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CarpetSettings.java From fabric-carpet with MIT License | 6 votes |
@Override public Integer validate(ServerCommandSource source, ParsedRule<Integer> currentRule, Integer newValue, String string) { if (currentRule.get().equals(newValue) || source == null) { return newValue; } if (newValue < 0 || newValue > 32) { Messenger.m(source, "r view distance has to be between 0 and 32"); return null; } MinecraftServer server = source.getMinecraftServer(); if (server.isDedicated()) { int vd = (newValue >= 2)?newValue:((DedicatedServer) server).getProperties().viewDistance; if (vd != server.getPlayerManager().getViewDistance()) server.getPlayerManager().setViewDistance(vd); return newValue; } else { Messenger.m(source, "r view distance can only be changed on a server"); return 0; } }
Example #2
Source File: VanillaCommandWrapper.java From Kettle with GNU General Public License v3.0 | 6 votes |
private ICommandSender getListener(CommandSender sender) { if (sender instanceof Player) { return ((CraftPlayer) sender).getHandle(); } if (sender instanceof BlockCommandSender) { return ((CraftBlockCommandSender) sender).getTileEntity(); } if (sender instanceof CommandMinecart) { return ((EntityMinecartCommandBlock) ((CraftMinecartCommand) sender).getHandle()).getCommandBlockLogic(); } if (sender instanceof RemoteConsoleCommandSender) { return ((DedicatedServer) MinecraftServer.getServerCB()).rconConsoleSource; } if (sender instanceof ConsoleCommandSender) { return ((CraftServer) sender.getServer()).getServer(); } if (sender instanceof ProxiedCommandSender) { return ((ProxiedNativeCommandSender) sender).getHandle(); } if (sender instanceof CraftFunctionCommandSender) { return ((CraftFunctionCommandSender) sender).getHandle(); } throw new IllegalArgumentException("Cannot make " + sender + " a vanilla command listener"); }
Example #3
Source File: FabricCommandSender.java From spark with GNU General Public License v3.0 | 5 votes |
@Override public String getName() { if (super.delegate instanceof PlayerEntity) { return ((PlayerEntity) super.delegate).getGameProfile().getName(); } else if (super.delegate instanceof DedicatedServer) { return "Console"; } else { return "unknown:" + super.delegate.getClass().getSimpleName(); } }
Example #4
Source File: FMLDedicatedServerSetupEvent.java From patchwork-api with GNU Lesser General Public License v2.1 | 4 votes |
public FMLDedicatedServerSetupEvent(Supplier<DedicatedServer> server, ModContainer container) { super(container); this.server = server; }
Example #5
Source File: FMLDedicatedServerSetupEvent.java From patchwork-api with GNU Lesser General Public License v2.1 | 4 votes |
public Supplier<DedicatedServer> getServerSupplier() { return server; }
Example #6
Source File: SandboxServer.java From Sandbox with GNU Lesser General Public License v3.0 | 4 votes |
private SandboxServer(MinecraftServer server) { this.isIntegrated = !(server instanceof DedicatedServer); this.server = server; INSTANCE = this; }
Example #7
Source File: CraftServer.java From Kettle with GNU General Public License v3.0 | 4 votes |
@Override public int getSpawnRadius() { return ((DedicatedServer) console).settings.getIntProperty("spawn-protection", 16); }
Example #8
Source File: MixinRCON_RconClient.java From Galaxy with GNU Affero General Public License v3.0 | 4 votes |
@Inject(method = "<init>", at = @At("RETURN")) private void checkLocal(DedicatedServer server, String password, Socket socket, CallbackInfo ci) { if (socket.getInetAddress().isLoopbackAddress()) isLocal = true; }