Ejemplo n.º 1
0
  public EntityPlayer(
      MinecraftServer minecraftserver,
      World world,
      String s,
      PlayerInteractManager playerinteractmanager) {
    super(world);
    playerinteractmanager.player = this;
    this.playerInteractManager = playerinteractmanager;
    this.cq = minecraftserver.getPlayerList().o();
    ChunkCoordinates chunkcoordinates = world.getSpawn();
    int i = chunkcoordinates.x;
    int j = chunkcoordinates.z;
    int k = chunkcoordinates.y;

    if (!world.worldProvider.f && world.getWorldData().getGameType() != EnumGamemode.ADVENTURE) {
      int l = Math.max(5, minecraftserver.getSpawnProtection() - 6);

      i += this.random.nextInt(l * 2) - l;
      j += this.random.nextInt(l * 2) - l;
      k = world.i(i, j);
    }

    this.setPositionRotation((double) i + 0.5D, (double) k, (double) j + 0.5D, 0.0F, 0.0F);
    this.server = minecraftserver;
    this.X = 0.0F;
    this.name = s;
    this.height = 0.0F;
    this.displayName = this.name; // CraftBukkit
    this.listName = this.name; // CraftBukkit
    this.canPickUpLoot = true; // CraftBukkit
  }
Ejemplo n.º 2
0
  @Override
  public void execute(
      @Nonnull MinecraftServer server, @Nonnull ICommandSender sender, @Nonnull String[] args) {
    String json = I18n.translateToLocal("botaniamisc.shareMsg");
    json = json.replaceAll("%name%", sender.getName());
    json = json.replaceAll("%entry%", args[0]);
    json = json.replaceAll("%entryname%", I18n.translateToLocal(args[0]));

    ITextComponent component = ITextComponent.Serializer.jsonToComponent(json);
    server.getPlayerList().sendChatMsg(component);
  }
Ejemplo n.º 3
0
  public WorldServer(
      MinecraftServer minecraftserver,
      IDataManager idatamanager,
      String s,
      int i,
      WorldSettings worldsettings,
      MethodProfiler methodprofiler,
      IConsoleLogManager iconsolelogmanager,
      org.bukkit.World.Environment env,
      org.bukkit.generator.ChunkGenerator gen) {
    super(
        idatamanager,
        s,
        worldsettings,
        WorldProvider.byDimension(env.getId()),
        methodprofiler,
        iconsolelogmanager,
        gen,
        env);
    this.dimension = i;
    this.pvpMode = minecraftserver.getPvP();
    // CraftBukkit end
    this.server = minecraftserver;
    this.tracker = new EntityTracker(this);
    this.manager = new PlayerChunkMap(this, minecraftserver.getPlayerList().o());
    if (this.entitiesById == null) {
      this.entitiesById = new IntHashMap();
    }

    if (this.L == null) {
      this.L = new HashSet();
    }

    if (this.M == null) {
      this.M = new TreeSet();
    }

    this.P = new org.bukkit.craftbukkit.CraftTravelAgent(this); // CraftBukkit
    this.scoreboard = new ScoreboardServer(minecraftserver);
    ScoreboardSaveData scoreboardsavedata =
        (ScoreboardSaveData) this.worldMaps.get(ScoreboardSaveData.class, "scoreboard");

    if (scoreboardsavedata == null) {
      scoreboardsavedata = new ScoreboardSaveData();
      this.worldMaps.a("scoreboard", scoreboardsavedata);
    }

    scoreboardsavedata.a(this.scoreboard);
    ((ScoreboardServer) this.scoreboard).a(scoreboardsavedata);
  }
Ejemplo n.º 4
0
  public void c(int i) {
    if (!this.world.isStatic && !this.dead) {
      this.world.methodProfiler.a("changeDimension");
      MinecraftServer minecraftserver = MinecraftServer.getServer();
      int j = this.dimension;
      WorldServer worldserver = minecraftserver.getWorldServer(j);
      WorldServer worldserver1 = minecraftserver.getWorldServer(i);

      this.dimension = i;
      if (j == 1 && i == 1) {
        worldserver1 = minecraftserver.getWorldServer(0);
        this.dimension = 0;
      }

      this.world.kill(this);
      this.dead = false;
      this.world.methodProfiler.a("reposition");
      minecraftserver.getPlayerList().changeWorld(this, j, worldserver, worldserver1);
      this.world.methodProfiler.c("reloading");
      Entity entity = EntityTypes.createEntityByName(EntityTypes.b(this), worldserver1);

      if (entity != null) {
        entity.n(this);
        if (j == 1 && i == 1) {
          BlockPosition blockposition = this.world.r(worldserver1.getSpawn());

          entity.setPositionRotation(blockposition, entity.yaw, entity.pitch);
        }

        worldserver1.addEntity(entity);
      }

      this.dead = true;
      this.world.methodProfiler.b();
      worldserver.j();
      worldserver1.j();
      this.world.methodProfiler.b();
    }
  }
 private void getServerStats(ICommandSender sender) {
   MinecraftServer tmp = ServerUtil.getServerInstance();
   ChatHelper.sendMessage(
       sender, TextFormatting.GOLD + "==================================================");
   ChatHelper.sendMessage(sender, TextFormatting.BLUE + "                    Server Status");
   ChatHelper.sendMessage(
       sender, TextFormatting.GOLD + "==================================================");
   ChatHelper.sendMessage(
       sender, TextFormatting.GOLD + "Server: " + TextFormatting.AQUA + tmp.getServerModName());
   ChatHelper.sendMessage(
       sender,
       TextFormatting.GOLD + "Server Version: " + TextFormatting.AQUA + tmp.getMinecraftVersion());
   ChatHelper.sendMessage(
       sender,
       TextFormatting.GOLD
           + "Server Online Mode: "
           + TextFormatting.AQUA
           + tmp.isServerInOnlineMode());
   ChatHelper.sendMessage(
       sender,
       TextFormatting.GOLD + "Server Owner: " + TextFormatting.AQUA + tmp.getServerOwner());
   ChatHelper.sendMessage(
       sender, TextFormatting.GOLD + "Server MOTD: " + TextFormatting.AQUA + tmp.getMOTD());
   ChatHelper.sendMessage(
       sender,
       TextFormatting.GOLD
           + "Server IP: "
           + TextFormatting.AQUA
           + tmp.getServerHostname()
           + ":"
           + tmp.getServerPort());
   ChatHelper.sendMessage(
       sender,
       TextFormatting.GOLD
           + "Server Max Allowed Players: "
           + TextFormatting.AQUA
           + tmp.getMaxPlayers());
   ChatHelper.sendMessage(
       sender,
       TextFormatting.GOLD
           + "Server Spawn Protection Size: "
           + TextFormatting.AQUA
           + tmp.getSpawnProtectionSize());
   ChatHelper.sendMessage(
       sender,
       TextFormatting.GOLD
           + "Server View Distance: "
           + TextFormatting.AQUA
           + tmp.getPlayerList().getViewDistance());
   ChatHelper.sendMessage(
       sender,
       TextFormatting.GOLD
           + "Server World: "
           + TextFormatting.AQUA
           + tmp.getEntityWorld().getWorldInfo().getWorldName());
   ChatHelper.sendMessage(
       sender,
       TextFormatting.GOLD + "Server Allow Nether: " + TextFormatting.AQUA + tmp.getAllowNether());
   ChatHelper.sendMessage(
       sender,
       TextFormatting.GOLD
           + "Server Allow Flight: "
           + TextFormatting.AQUA
           + tmp.isFlightAllowed());
   ChatHelper.sendMessage(
       sender,
       TextFormatting.GOLD
           + "Server Default Gamemode: "
           + TextFormatting.AQUA
           + tmp.getGameType().getName());
   ChatHelper.sendMessage(
       sender,
       TextFormatting.GOLD
           + "Server Generate Structure: "
           + TextFormatting.AQUA
           + tmp.canStructuresSpawn());
   ChatHelper.sendMessage(
       sender,
       TextFormatting.GOLD
           + "Server Whitelist: "
           + TextFormatting.AQUA
           + tmp.getPlayerList().isWhiteListEnabled());
   ChatHelper.sendMessage(
       sender, TextFormatting.GOLD + "Hardcore Mode: " + TextFormatting.AQUA + tmp.isHardcore());
   ChatHelper.sendMessage(
       sender, TextFormatting.GOLD + "==================================================");
 }