Java Code Examples for org.bukkit.entity.Player#getTotalExperience()

The following examples show how to use org.bukkit.entity.Player#getTotalExperience() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CivilianManager.java    From Civs with GNU General Public License v3.0 6 votes vote down vote up
Civilian createDefaultCivilian(UUID uuid) {
    ConfigManager configManager = ConfigManager.getInstance();
    CivClass defaultClass = ClassManager.getInstance().createDefaultClass(uuid);
    Set<CivClass> classes = new HashSet<>();
    classes.add(defaultClass);
    int expOrbs = -1;
    if (Civs.getInstance() != null) {
        Player player = Bukkit.getPlayer(uuid);
        if (player != null) {
            expOrbs = player.getTotalExperience();
        }
    }
    Civilian civilian = new Civilian(uuid,
            configManager.getDefaultLanguage(),
            new HashMap<>(),
            classes,
            new HashMap<>(), 0, 0, 0, 0, 0, 0, expOrbs);
    civilian.getStashItems().putAll(ItemManager.getInstance().getNewItems(civilian));
    civilian.setTutorialPath("default");
    civilian.setTutorialIndex(0);
    civilian.setUseAnnouncements(true);
    civilian.setTutorialProgress(0);
    return civilian;
}
 
Example 2
Source File: ClearXPAction.java    From UHC with MIT License 5 votes vote down vote up
@Override
protected void run(Player player) {
    exp = player.getExp();
    level = player.getLevel();
    total = player.getTotalExperience();

    player.setExp(0F);
    player.setLevel(0);
    player.setTotalExperience(0);
}