Package org.spout.vanilla.component.entity.misc

Examples of org.spout.vanilla.component.entity.misc.Level


  }

  @EventHandler
  public void onExperienceChange(PlayerExperienceChangeEvent event) {
    Player player = event.getPlayer();
    Level level = player.add(Level.class);
    event.getMessages().add(new PlayerExperienceMessage(level.getProgress(), level.getLevel(), event.getNewExp()));
  }
View Full Code Here


  public void xp(CommandSource source, CommandArguments args) throws CommandException {
    Player player = args.popPlayerOrMe("player", source);
    int amount = args.popInteger("amount");
    args.assertCompletelyParsed();

    Level level = player.get(Level.class);
    if (level == null) {
      throw new CommandException(player.getDisplayName() + " does not have experience.");
    }

    level.addExperience(amount);
    player.sendMessage(plugin.getPrefix() + ChatStyle.GREEN + "Your experience has been set to " + ChatStyle.WHITE + amount + ChatStyle.GREEN + ".");
  }
View Full Code Here

    EnchantmentTableInventory inv = (EnchantmentTableInventory) window.getInventoryConverters().get(2).getInventory();
    int enchantSlot = message.getEnchantment();
    int enchantLevel = window.getEnchantmentLevel(enchantSlot);

    Human human = player.get(Human.class);
    Level level = player.get(Level.class);

    if (human == null || level == null) {
      return;
    }
    if (human.getGameMode() != GameMode.CREATIVE && level.getLevel() < enchantLevel) {
      return;
    }
    if (!Enchantment.addRandomEnchantments(inv.get(), enchantLevel)) {
      return;
    }
    inv.update(EnchantmentTableInventory.SLOT, inv.get());
    if (human.getGameMode() != GameMode.CREATIVE) {
      level.removeLevels(enchantLevel);
    }
  }
View Full Code Here

TOP

Related Classes of org.spout.vanilla.component.entity.misc.Level

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.