本文整理汇总了Java中net.minecraft.server.dedicated.DedicatedServer类的典型用法代码示例。如果您正苦于以下问题:Java DedicatedServer类的具体用法?Java DedicatedServer怎么用?Java DedicatedServer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DedicatedServer类属于net.minecraft.server.dedicated包,在下文中一共展示了DedicatedServer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MinecraftServerGui
import net.minecraft.server.dedicated.DedicatedServer; //导入依赖的package包/类
public MinecraftServerGui(DedicatedServer serverIn)
{
this.server = serverIn;
this.setPreferredSize(new Dimension(854, 480));
this.setLayout(new BorderLayout());
try
{
this.add(this.getLogComponent(), "Center");
this.add(this.getStatsComponent(), "West");
}
catch (Exception exception)
{
LOGGER.error((String)"Couldn\'t build server GUI", (Throwable)exception);
}
}
示例2: checkPermission
import net.minecraft.server.dedicated.DedicatedServer; //导入依赖的package包/类
@Override
public boolean checkPermission(MinecraftServer server, ICommandSender sender) {
if (sender instanceof DedicatedServer)
return true;
EntityPlayerMP player = (EntityPlayerMP) sender;
GameProfile profile = player.getGameProfile();
UserListOpsEntry opEntry = (UserListOpsEntry) WorldBorder.SERVER
.getPlayerList()
.getOppedPlayers()
.getEntry(profile);
// Level 2 (out of 4) have general access to game-changing commands
// TODO: Make this a configuration option
return opEntry != null && opEntry.getPermissionLevel() > 2;
}
示例3: canCommandSenderUseCommand
import net.minecraft.server.dedicated.DedicatedServer; //导入依赖的package包/类
@Override
public boolean canCommandSenderUseCommand(ICommandSender sender)
{
if (sender instanceof DedicatedServer)
return true;
EntityPlayerMP player = (EntityPlayerMP) sender;
GameProfile profile = player.getGameProfile();
UserListOpsEntry opEntry = (UserListOpsEntry) WorldBorder.SERVER
.getConfigurationManager()
.func_152603_m()
.func_152683_b(profile);
// Level 2 (out of 4) have general access to game-changing commands
// TODO: Make this a configuration option
return opEntry != null && opEntry.func_152644_a() > 2;
}
示例4: MinecraftServerGui
import net.minecraft.server.dedicated.DedicatedServer; //导入依赖的package包/类
public MinecraftServerGui(DedicatedServer p_i2362_1_)
{
this.field_120021_b = p_i2362_1_;
this.setPreferredSize(new Dimension(854, 480));
this.setLayout(new BorderLayout());
try
{
this.add(this.getLogComponent(), "Center");
this.add(this.getStatsComponent(), "West");
}
catch (Exception exception)
{
field_164248_b.error("Couldn\'t build server GUI", exception);
}
}
示例5: DedicatedPlayerList
import net.minecraft.server.dedicated.DedicatedServer; //导入依赖的package包/类
public DedicatedPlayerList(DedicatedServer p_i1503_1_) {
super(p_i1503_1_);
this.field_72423_e = p_i1503_1_.func_71209_f("ops.txt");
this.field_72422_f = p_i1503_1_.func_71209_f("white-list.txt");
this.field_72402_d = p_i1503_1_.func_71327_a("view-distance", 10);
this.field_72405_c = p_i1503_1_.func_71327_a("max-players", 20);
this.func_72371_a(p_i1503_1_.func_71332_a("white-list", false));
if(!p_i1503_1_.func_71264_H()) {
this.func_72390_e().func_73708_a(true);
this.func_72363_f().func_73708_a(true);
}
this.func_72390_e().func_73707_e();
this.func_72390_e().func_73711_f();
this.func_72363_f().func_73707_e();
this.func_72363_f().func_73711_f();
this.func_72417_t();
this.func_72418_v();
this.func_72419_u();
if(!this.field_72422_f.exists()) {
this.func_72421_w();
}
}
示例6: func_120016_a
import net.minecraft.server.dedicated.DedicatedServer; //导入依赖的package包/类
public static void func_120016_a(DedicatedServer p_120016_0_) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception var3) {
;
}
MinecraftServerGui var1 = new MinecraftServerGui(p_120016_0_);
field_120022_a = true;
JFrame var2 = new JFrame("Minecraft server");
var2.add(var1);
var2.pack();
var2.setLocationRelativeTo((Component)null);
var2.setVisible(true);
var2.addWindowListener(new MinecraftServerGuiINNER1(p_120016_0_));
}
示例7: func_120016_a
import net.minecraft.server.dedicated.DedicatedServer; //导入依赖的package包/类
public static void func_120016_a(DedicatedServer par0DedicatedServer)
{
try
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (Exception exception)
{
;
}
MinecraftServerGui minecraftservergui = new MinecraftServerGui(par0DedicatedServer);
field_120022_a = true;
JFrame jframe = new JFrame("Minecraft server");
jframe.add(minecraftservergui);
jframe.pack();
jframe.setLocationRelativeTo((Component)null);
jframe.setVisible(true);
jframe.addWindowListener(new MinecraftServerGuiINNER1(par0DedicatedServer));
}
示例8: MinecraftServerGui
import net.minecraft.server.dedicated.DedicatedServer; //导入依赖的package包/类
public MinecraftServerGui(DedicatedServer par1DedicatedServer)
{
this.field_120021_b = par1DedicatedServer;
this.setPreferredSize(new Dimension(854, 480));
this.setLayout(new BorderLayout());
try
{
this.add(this.func_120018_d(), "Center");
this.add(this.func_120019_b(), "West");
}
catch (Exception exception)
{
exception.printStackTrace();
}
}
示例9: resuscitateWatchdog
import net.minecraft.server.dedicated.DedicatedServer; //导入依赖的package包/类
@Override
public void resuscitateWatchdog()
{
DedicatedServer server = (DedicatedServer) instance().getMinecraftServerInstance();
if (server.getMaxTickTime() > 0L)
{
Thread thread1 = new Thread(new ServerHangWatchdog(server));
thread1.setName("Server Watchdog");
thread1.setDaemon(true);
thread1.start();
CreeperHostServer.logger.info("Performing CPR. Server Watchdog is alive again!");
}
}
示例10: createServerGui
import net.minecraft.server.dedicated.DedicatedServer; //导入依赖的package包/类
/**
* Creates the server GUI and sets it visible for the user.
*/
public static void createServerGui(final DedicatedServer serverIn)
{
try
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (Exception var3)
{
;
}
MinecraftServerGui minecraftservergui = new MinecraftServerGui(serverIn);
JFrame jframe = new JFrame("Minecraft server");
jframe.add(minecraftservergui);
jframe.pack();
jframe.setLocationRelativeTo((Component)null);
jframe.setVisible(true);
jframe.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent p_windowClosing_1_)
{
serverIn.initiateShutdown();
while (!serverIn.isServerStopped())
{
try
{
Thread.sleep(100L);
}
catch (InterruptedException interruptedexception)
{
interruptedexception.printStackTrace();
}
}
System.exit(0);
}
});
}
示例11: chat
import net.minecraft.server.dedicated.DedicatedServer; //导入依赖的package包/类
/**
* Sends an automatically translated and formatted message to a command sender
* @param sender Target to send message to
* @param msg String or language key to broadcast
*/
public static void chat(ICommandSender sender, String msg, Object... parts)
{
String translated = translate(msg);
// Consoles require ANSI coloring for formatting
if (sender instanceof DedicatedServer)
Log.info( removeFormatting(translated), parts );
else
{
translated = String.format(translated, parts);
sender.addChatMessage( new TextComponentString(translated) );
}
}
示例12: queryUser
import net.minecraft.server.dedicated.DedicatedServer; //导入依赖的package包/类
@Override
public void queryUser(StartupQuery query) throws InterruptedException
{
if (query.getResult() == null)
{
FMLLog.warning("%s", query.getText());
query.finish();
}
else
{
String text = query.getText() +
"\n\nRun the command /fml confirm or or /fml cancel to proceed." +
"\nAlternatively start the server with -Dfml.queryResult=confirm or -Dfml.queryResult=cancel to preselect the answer.";
FMLLog.warning("%s", text);
if (!query.isSynchronous()) return; // no-op until mc does commands in another thread (if ever)
boolean done = false;
while (!done && server.isServerRunning())
{
if (Thread.interrupted()) throw new InterruptedException();
DedicatedServer dedServer = (DedicatedServer) server;
// rudimentary command processing, check for fml confirm/cancel and stop commands
synchronized (dedServer.pendingCommandList)
{
for (Iterator<PendingCommand> it = GenericIterableFactory.newCastingIterable(dedServer.pendingCommandList, PendingCommand.class).iterator(); it.hasNext(); )
{
String cmd = it.next().command.trim().toLowerCase();
if (cmd.equals("/fml confirm"))
{
FMLLog.info("confirmed");
query.setResult(true);
done = true;
it.remove();
}
else if (cmd.equals("/fml cancel"))
{
FMLLog.info("cancelled");
query.setResult(false);
done = true;
it.remove();
}
else if (cmd.equals("/stop"))
{
StartupQuery.abort();
}
}
}
Thread.sleep(10L);
}
query.finish();
}
}
示例13: constructServerInstance
import net.minecraft.server.dedicated.DedicatedServer; //导入依赖的package包/类
@Nonnull
private DedicatedServer constructServerInstance(@Nonnull BundleContext ctx) {
logger.info("Initializing Minecraft %s", FaucetVersion.API_VERSION);
Bootstrap.register(); // apparently this is how the registries work ... don't question it
// log some environment information
logger.info("Running on Java v%s supplied by %s", System.getProperty("java.version", "Unknown"),
System.getProperty("java.vendor"));
// TODO: Integrate with plugins here?
YggdrasilAuthenticationService var15 = new YggdrasilAuthenticationService(Proxy.NO_PROXY,
UUID.randomUUID().toString());
MinecraftSessionService var16 = var15.createMinecraftSessionService();
GameProfileRepository var17 = var15.createProfileRepository();
PlayerProfileCache var18 = new PlayerProfileCache(var17, new File(".", "usercache.json"));
DedicatedServer server = new DedicatedServer(new File("."), DataFixesManager.createFixer(),
var15, var16, var17, var18);
// TODO: Re-introduce configuration
if (!GraphicsEnvironment.isHeadless()) {
logger.info("Server GUI has been disabled or is unavailable in this environment");
// TODO: Custom GUI
} else {
logger
.info("Server GUI has been disabled or is not available within the current environment");
}
return server;
}
示例14: SinkServer
import net.minecraft.server.dedicated.DedicatedServer; //导入依赖的package包/类
@SuppressWarnings("ThisEscapedInObjectConstruction")
SinkServer(@Nonnull BundleContext ctx, @Nonnull DedicatedServer server) {
this.ctx = ctx;
this.server = server;
this.injector = Guice.createInjector(Peaberry.osgiModule(ctx), this);
this.injector.injectMembers(this);
logger.debug("Faucet services are ready for consumption");
}
示例15: chat
import net.minecraft.server.dedicated.DedicatedServer; //导入依赖的package包/类
/**
* Sends an automatically translated and formatted message to a command sender
* @param sender Target to send message to
* @param msg String or language key to broadcast
*/
public static void chat(ICommandSender sender, String msg, Object... parts)
{
String translated = translate(msg);
// Consoles require ANSI coloring for formatting
if (sender instanceof DedicatedServer)
Log.info( removeFormatting(translated), parts );
else
{
translated = String.format(translated, parts);
sender.addChatMessage( new ChatComponentText(translated) );
}
}