Package org.spout.api.datatable

Examples of org.spout.api.datatable.ManagedMap


   * Shakes this Minecart back and forth
   *
   * @param amount to shake (more)
   */
  public void shake(int amount) {
    ManagedMap data = getOwner().getData();
    data.put(VanillaData.MINECART_SHAKE_DIR, -data.get(VanillaData.MINECART_SHAKE_DIR));
    setShakingForce(getShakingForce() + amount);
  }
View Full Code Here


          throw new IllegalArgumentException("Invalid generator name for world '" + worldNode.getWorldName() + "': " + generatorName);
        }
        World world = ((Server) getEngine()).loadWorld(worldNode.getWorldName(), generator);

        // Apply general settings
        final ManagedMap data = world.getData();
        data.put(VanillaData.GAMEMODE, GameMode.get(worldNode.GAMEMODE.getString()));
        data.put(VanillaData.DIFFICULTY, Difficulty.get(worldNode.DIFFICULTY.getString()));
        data.put(VanillaData.DIMENSION, Dimension.get(worldNode.SKY_TYPE.getString()));

        world.addLightingManager(VanillaLighting.BLOCK_LIGHT);
        world.addLightingManager(VanillaLighting.SKY_LIGHT);

        // Add to worlds
View Full Code Here

    maxY = node.MAX_Y.getInt() & (~Chunk.BLOCKS.MASK);
    minY = node.MIN_Y.getInt() & (~Chunk.BLOCKS.MASK);
    stepY = node.STEP_Y.getInt() & (~Chunk.BLOCKS.MASK);
    lastY = Integer.MAX_VALUE;

    final ManagedMap data = world.getData();
    final Human human = getOwner().add(Human.class);
    GameMode gamemode = null;
    Difficulty difficulty = data.get(VanillaData.DIFFICULTY);
    Dimension dimension = data.get(VanillaData.DIMENSION);
    WorldType worldType = data.get(VanillaData.WORLD_TYPE);

    if (human != null) {
      gamemode = human.getGameMode();
    }
    getSession().send(new PlayerRespawnMessage(0, difficulty.getId(), gamemode.getId(), 256, worldType.toString()));
View Full Code Here

    if (message.getStatus() == PlayerStatusMessage.INITIAL_SPAWN) {
      server.getEventManager().callEvent(new PlayerConnectEvent(session, (String) session.getDataMap().get("username"), 10));
      if (server.debugMode()) {
        server.getLogger().info("Login took " + (System.currentTimeMillis() - session.getDataMap().get(VanillaProtocol.LOGIN_TIME)) + " ms");
      }
      final ManagedMap data = session.getPlayer().getWorld().getData();
      final Human human = session.getPlayer().add(Human.class);
      final Difficulty difficulty = data.get(VanillaData.DIFFICULTY);
      final Dimension dimension = data.get(VanillaData.DIMENSION);
      final WorldType worldType = data.get(VanillaData.WORLD_TYPE);

      GameMode gamemode;

      int entityId = session.getPlayer().getId();

      //  MC Packet Order: 0x01 Login, 0xFA Custom (ServerTypeName), 0x06 SpawnPos, 0xCA PlayerAbilities, 0x10 BlockSwitch
      gamemode = data.get(VanillaData.GAMEMODE);
      final PlayerLoginRequestMessage idMsg = new PlayerLoginRequestMessage(entityId, worldType.toString(), gamemode.getId(), (byte) dimension.getId(), difficulty.getId(), (byte) server.getMaxPlayers());
      session.send(Session.SendType.FORCE, idMsg);
      session.setState(Session.State.GAME);
      if (human.getAttachedCount() <= 1) {
        // If we haven't logged in before, we want to set all abilities to the default gamemode
View Full Code Here

TOP

Related Classes of org.spout.api.datatable.ManagedMap

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.