Package net.minecraft.server

Examples of net.minecraft.server.MinecraftServer


    @SuppressWarnings("unused")
    private WorldSaver worldSaver;

    public static void msg(String msg)
    {
        MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
        if (!BackupConfig.enableMsg)
        {
            return;
        }
        try
        {
            if (FMLCommonHandler.instance().getEffectiveSide().isClient())
            {
                OutputHandler.felog.info(msg);
            }
            else
            {
                OutputHandler.sendMessage(server, "[ForgeEssentials] " + msg);
            }
            ServerConfigurationManager manager = server.getConfigurationManager();
            for (String username : manager.getAllUsernames())
            {
                EntityPlayerMP player = manager.func_152612_a(username);
                if (PermissionsManager.checkPermission(player, "ForgeEssentials.backup.msg"))
                {
View Full Code Here


  public static boolean removeDuplicateCommands;

  public static void remove()
  {
    OutputHandler.felog.finest("Running duplicate command removal process!");
    MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();

    if (server.getCommandManager() instanceof CommandHandler)
    {
      try
      {
        HashMap<String, ICommand> initials = new HashMap<String, ICommand>();
        HashMultimap<String, ICommand> duplicates = HashMultimap.create();

        Set<ICommand> cmdList = ReflectionHelper.getPrivateValue(CommandHandler.class, (CommandHandler) server.getCommandManager(), FIELDNAME);
        OutputHandler.felog.finer("commandSet size: " + cmdList.size());

        ICommand keep;
        for (ICommand cmd : cmdList)
        {
          keep = initials.put(cmd.getCommandName(), cmd);
          if (keep != null)
          {
            OutputHandler.felog.finer("Duplicate command found! Name:" + keep.getCommandName());
            duplicates.put(cmd.getCommandName(), cmd);
            duplicates.put(cmd.getCommandName(), keep);
            continue;
          }
          CommandHandlerForge.doPermissionReg(cmd);
        }

        Set<ICommand> toRemove = new HashSet<ICommand>();
        keep = null;
        Class<? extends ICommand> cmdClass;
        int kept = -1, other = -1;
        for (String name : duplicates.keySet())
        {
          keep = null;
          kept = -1;
          other = -1;
          cmdClass = null;

          for (ICommand cmd : duplicates.get(name))
          {
            other = getCommandPriority(cmd);

            if (keep == null)
            {
              kept = other;

              if (kept == -1)
              {
                keep = null;
                duplicates.remove(name, cmd);
              }
              else
              {
                keep = cmd;
              }

              continue;
            }

            if (kept > other)
            {
              toRemove.add(cmd);
              cmdClass = cmd.getClass();
              OutputHandler.felog.finer("Removing command '" + cmd.getCommandName() + "' from class: " + cmdClass.getName());
            }
            else
            {
              toRemove.add(keep);
              cmdClass = keep.getClass();
              OutputHandler.felog.finer("Removing command '" + keep.getCommandName() + "' from class: " + cmdClass.getName());

              keep = cmd;
              kept = other;
            }

          }
        }

        cmdList.removeAll(toRemove);
        OutputHandler.felog.finer("commandSet size: " + cmdList.size());
        ReflectionHelper.setPrivateValue(CommandHandler.class, (CommandHandler) server.getCommandManager(), cmdList, FIELDNAME);
      }
      catch (Exception e)
      {
        OutputHandler.felog.finer("Something broke: " + e.getLocalizedMessage());
        e.printStackTrace();
View Full Code Here

  @SuppressWarnings("unused")
    private static double getTPS(int dimID)
  {
    try
    {
      MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();

      long sum = 0L;
      long[] ticks = server.worldTickTimes.get(dimID);
      for (int i = 0; i < ticks.length; ++i)
      {
View Full Code Here

   */
  public static double getTPS()
  {
    try
    {
      MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();

      long tickSum = 0L;
      long[] ticks = server.tickTimeArray;
      for (int i = 0; i < ticks.length; ++i)
      {
View Full Code Here

        catch (Exception e)
        {
            System.err.println("Cannot Hotload Dim: " + e.getMessage());
            return; // If a provider hasn't been registered then we can't hotload the dim
        }
        MinecraftServer mcServer = overworld.func_73046_m();
        ISaveHandler savehandler = overworld.getSaveHandler();
        WorldSettings worldSettings = new WorldSettings(overworld.getWorldInfo());

        WorldServer world = (dim == 0 ? overworld : new WorldServerMulti(mcServer, savehandler, overworld.getWorldInfo().getWorldName(), dim, worldSettings, overworld, mcServer.theProfiler));
        world.addWorldAccess(new WorldManager(mcServer, world));
        MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world));
        if (!mcServer.isSinglePlayer())
        {
            world.getWorldInfo().setGameType(mcServer.getGameType());
        }

        mcServer.func_147139_a(mcServer.func_147135_j());
    }
View Full Code Here

        {
            return ((SaveHandler)DimensionManager.getWorld(0).getSaveHandler()).getWorldDirectory();
        }
        else if (MinecraftServer.getServer() != null)
        {
            MinecraftServer srv = MinecraftServer.getServer();
            SaveHandler saveHandler = (SaveHandler) srv.getActiveAnvilConverter().getSaveLoader(srv.getFolderName(), false);
            return saveHandler.getWorldDirectory();
        }
        else
        {
            return null;
View Full Code Here

  public int getByBlockModelId() {
    return 0;
  }

  public boolean isOp(EntityPlayer player) {
    MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
    return server.getConfigurationManager().func_152596_g(player.getGameProfile());
  }
View Full Code Here

  }

  @Override
  @SuppressWarnings("rawtypes")
  public void sendBroadCast(String message) {
    MinecraftServer server = FMLServerHandler.instance().getServer();
    if(server != null && server.getConfigurationManager() != null) {
      List list = server.getConfigurationManager().playerEntityList;
      if(list != null && !list.isEmpty()) {
        for(Object obj:list) {
          if(obj instanceof EntityPlayerMP) {
            ((EntityPlayerMP)obj).addChatMessage(new ChatComponentText("[LP] Server: " + message));
          }
View Full Code Here

  @Override
  public List<EntityPlayer> getPlayers()
  {
    if ( !Platform.isClient() )
    {
      MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();

      if ( server != null )
        return server.getConfigurationManager().playerEntityList;
    }

    return new ArrayList<EntityPlayer>();
  }
View Full Code Here

    ct = ForgeChunkManager.requestTicket( AppEng.instance, worldObj, Type.NORMAL );

    if ( ct == null )
    {
      MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
      if ( server != null )
      {
        List<EntityPlayerMP> pl = server.getConfigurationManager().playerEntityList;
        for (EntityPlayerMP p : pl)
        {
          p.addChatMessage( new ChatComponentText( "Can't chunk load.." ) );
        }
      }
View Full Code Here

TOP

Related Classes of net.minecraft.server.MinecraftServer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.