Examples of Difficulty


Examples of org.bukkit.Difficulty

                    world.setSpawnLocation(spawnLoc);
                }

                // migrate difficulty
                if (section.isString("difficulty")) {
                    final Difficulty difficulty = Difficulty.valueOf(section.getString("difficulty").toUpperCase());
                    if (difficulty != null) {
                        world.setDifficulty(difficulty);
                    }
                }
View Full Code Here

Examples of org.bukkit.Difficulty

    setupScoreboardObjectives();
  }

  private static Difficulty getDifficulty(String d)
  {
    Difficulty diff = Difficulty.valueOf(d.toUpperCase());
    try { diff = Difficulty.getByValue(Integer.parseInt(d)); }
    catch (NumberFormatException ignored) {  }

    return diff;
  }
View Full Code Here

Examples of org.bukkit.Difficulty

    // allow or disallow friendly fire
    if (gameplay.getChild("friendlyfire") != null)
      setFriendlyFire(Boolean.parseBoolean(gameplay.getChildText("friendlyfire")));

    // attempt to set world difficulty as best as possible
    Difficulty diff = Difficulty.HARD;
    if (gameplay.getChild("difficulty") != null)
      diff = getDifficulty(gameplay.getChildText("difficulty"));
    primaryWorld.setDifficulty(diff);

    if (gameplay.getChild("maxtime") != null)
View Full Code Here

Examples of org.spout.vanilla.data.Difficulty

  @EventHandler
  public void onDeath(PlayerDeathEvent event) {
    if (Spout.getPlatform() != Platform.SERVER) {
      return;
    }
    Difficulty difficulty = event.getPlayer().getData().get(VanillaData.DIFFICULTY);
    if (difficulty == Difficulty.HARDCORE) {
      ((Server) Spout.getEngine()).getAccessManager().ban(BanType.PLAYER, event.getPlayer().getName(), true, "Banned from server. Reason: Death on hardcore.");
    }
  }
View Full Code Here

Examples of org.spout.vanilla.data.Difficulty

    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()));
    getSession().send(new PlayerRespawnMessage(1, difficulty.getId(), gamemode.getId(), 256, worldType.toString()));
    getSession().send(new PlayerRespawnMessage(dimension.getId(), difficulty.getId(), gamemode.getId(), 256, worldType.toString()));

    if (human != null) {
      human.updateAbilities();
    }
View Full Code Here

Examples of org.spout.vanilla.data.Difficulty

      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
        human.setGamemode(gamemode, false);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.