java类org.bukkit.event.player.PlayerExpChangeEvent的实例源码

PVPAsWantedManager.java 文件源码 项目:PVPAsWantedManager 阅读 26 收藏 0 点赞 0 评论 0
@EventHandler
public void onPlayerExpChange(PlayerExpChangeEvent event){
    Player player = event.getPlayer();
    YamlConfiguration PlayerData = onLoadData(player.getName());
    if(PlayerData ==null)return;
    PlayerData.set("attribute.level", player.getLevel());
    onSaveData(player.getName(), PlayerData);
    if(Config.getConfig("extraExp.enabled").equals("true")){
        int playerWantedPoints = PlayerData.getInt("wanted.points");
        if(playerWantedPoints > 0){
            int exp = event.getAmount();
            int value = Integer.valueOf(Config.getConfig("extraExp.pointsValue").replaceAll("%", ""));
            PlayerData.set("attribute.level", player.getLevel());
            int addExp = Integer.valueOf(String.valueOf(exp*playerWantedPoints*value/100));
            event.setAmount(addExp + exp);
            if(getConfig().getBoolean("extraExp.message") == true)
            player.sendMessage(Message.getMsg("player.expMessage", String.valueOf(addExp), String.valueOf(exp), String.valueOf(exp+addExp)));
            onSaveData(player.getName(), PlayerData);
        }
    }
}
XPGainedListener.java 文件源码 项目:Statz 阅读 26 收藏 0 点赞 0 评论 0
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onXPGain(final PlayerExpChangeEvent event) {

    final PlayerStat stat = PlayerStat.XP_GAINED;

    // Get player
    final Player player = (Player) event.getPlayer();

    // Do general check
    if (!plugin.doGeneralCheck(player, stat))
        return;

    // Update value to new stat.
    plugin.getDataManager().setPlayerInfo(player.getUniqueId(), stat, StatzUtil.makeQuery("uuid",
            player.getUniqueId().toString(), "value", event.getAmount(), "world", player.getWorld().getName()));

}
ExpMultiplierListener.java 文件源码 项目:HCFCore 阅读 30 收藏 0 点赞 0 评论 0
@EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
public void onPlayerPickupExp(PlayerExpChangeEvent event) {
    double amount = event.getAmount();
    if (amount > 0) {
        int result = (int) Math.ceil(amount * SettingsYML.EXP_MULTIPLIER_GENERAL);
        event.setAmount(result);
    }
}
ExpMultiplierListener.java 文件源码 项目:HCFCore 阅读 31 收藏 0 点赞 0 评论 0
@EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
public void onPlayerPickupExp(PlayerExpChangeEvent event) {
    double amount = event.getAmount();
    if (amount > 0) {
        int result = (int) Math.ceil(amount * SettingsYML.EXP_MULTIPLIER_GENERAL);
        event.setAmount(result);
    }
}
PlayerLifercycleListener.java 文件源码 项目:BasicSurvivalPlus 阅读 34 收藏 0 点赞 0 评论 0
@EventHandler
public void onPlayerGainExp(PlayerExpChangeEvent event){
    Player player = event.getPlayer();
    Server server = player.getServer();
    int expNum = event.getAmount();
    if (expNum > 0){
        expNum = (int) (expNum * plugin.getConfig().getInt("EXP_RATE"));

        player.sendMessage("§d[状态]§e获得 §b"+expNum+" §e点经验!");
        event.setAmount(expNum);
    }
}
ExpChangeListener.java 文件源码 项目:SharpSK 阅读 28 收藏 0 点赞 0 评论 0
@EventHandler
public final void onExpChange(PlayerExpChangeEvent e) {

    EvtExpChange ExpChangeEvent = new EvtExpChange(e.getPlayer(), e.getAmount());
    Bukkit.getServer().getPluginManager().callEvent(ExpChangeEvent);
    if (ExpChangeEvent.isCancelled()) {
        ExpChangeEvent.setCancelled(true);
        e.setAmount(0);
    }
}
QuestPlayer.java 文件源码 项目:QuestManager 阅读 34 收藏 0 点赞 0 评论 0
@EventHandler
public void onExp(PlayerExpChangeEvent e) {
    if (!QuestManagerPlugin.questManagerPlugin.getPluginConfiguration().getXPMoney()) {
        return;
    }
    if (!getPlayer().isOnline()) {
        return;
    }

    Player p = getPlayer().getPlayer();

    if (!p.getUniqueId().equals(e.getPlayer().getUniqueId())) {
        return;
    }

    if (!QuestManagerPlugin.questManagerPlugin.getPluginConfiguration()
            .getWorlds().contains(p.getWorld().getName())) {
        return;
    }

    money += e.getAmount();
    p.setLevel(money);

    if (QuestManagerPlugin.questManagerPlugin.getPluginConfiguration().getMagicEnabled()
             && QuestManagerPlugin.questManagerPlugin.getPluginConfiguration().getMagicRegenXP() != 0) {
        double amt = QuestManagerPlugin.questManagerPlugin.getPluginConfiguration().getMagicRegenXP();
        regenMP(amt);
    }

    e.setAmount(0);
}
ExileListener.java 文件源码 项目:ExilePearl 阅读 29 收藏 0 点赞 0 评论 0
/**
 * Prevents exiled players from collecting xp
 * @param e The event
 */
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onCollectXp(PlayerExpChangeEvent e) {
    if (isRuleActive(ExileRule.COLLECT_XP, e.getPlayer().getUniqueId())) {
        e.setAmount(0);
        msg(e.getPlayer(), Lang.ruleCantDoThat, ExileRule.COLLECT_XP.getActionString());
    }
}
DisableXPListener.java 文件源码 项目:civcraft 阅读 22 收藏 0 点赞 0 评论 0
@EventHandler(priority = EventPriority.LOW)
public void onPlayerExpChange(PlayerExpChangeEvent event) {
    Resident resident = CivGlobal.getResident(event.getPlayer());
    CivMessage.send(resident, CivColor.LightGreen+"Picked up "+CivColor.Yellow+event.getAmount()+CivColor.LightGreen+" coins.");
    resident.getTreasury().deposit(event.getAmount());


    event.setAmount(0);
}
DEListener.java 文件源码 项目:DoubleExp 阅读 25 收藏 0 点赞 0 评论 0
@EventHandler (priority = EventPriority.LOW)
public void onVIPExp(PlayerExpChangeEvent event) {
    if (event.getPlayer().hasPermission("dexp.vip")) {
        int expBefore = event.getAmount();
        double expMulti = getConfig.getDouble("config.vip.multi");
        int extAfter = (int) (expBefore * expMulti);
        event.setAmount(extAfter);
    }
}
IndicatorListener.java 文件源码 项目:HoloAPI 阅读 27 收藏 0 点赞 0 评论 0
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onExpGain(PlayerExpChangeEvent event) {
    if (Settings.INDICATOR_ENABLE.getValue("exp")) {
        Location l = event.getPlayer().getLocation().clone();
        l.setY(l.getY() + Settings.INDICATOR_Y_OFFSET.getValue("exp"));
        HoloAPI.getManager().createSimpleHologram(l, Settings.INDICATOR_TIME_VISIBLE.getValue("exp"), true, Settings.INDICATOR_FORMAT.getValue("exp", "default") + "+" + event.getAmount() + " exp");
    }
}
PlayerActionListener.java 文件源码 项目:modules-extra 阅读 29 收藏 0 点赞 0 评论 0
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onExpPickup(PlayerExpChangeEvent event)
{
    PlayerXp action = this.newAction(PlayerXp.class, event.getPlayer().getWorld());
    if (action != null)
    {
        this.setPlayerAndLocation(event.getPlayer(), action);
        action.setExp(event.getAmount());
        this.logAction(action);
    }
}
DisableXP.java 文件源码 项目:TerraCraftTools 阅读 24 收藏 0 点赞 0 评论 0
@EventHandler
public void callEvent(PlayerExpChangeEvent event) {
    if (!active) {
        event.setAmount(0);
    }

}
SSGPlayerListener.java 文件源码 项目:simple-survival-games 阅读 25 收藏 0 点赞 0 评论 0
@EventHandler
public void onPlayerExpPickup(PlayerExpChangeEvent event) {
    Player p = event.getPlayer();
    ArenaManager am = SimpleSurvivalGames.instance.getArenaManager();

    // Is the current player playing
    if(am.isInArena(p)) {
        ArenaPlayer ap = am.getPlayer(p);

        // The player may not pickup any Exp as spectator
        if(ap.isSpectator())
            event.setAmount(0);
    }
}
FaultyBootsOfHermes.java 文件源码 项目:Demigods3 阅读 25 收藏 0 点赞 0 评论 0
@EventHandler
public void onPlayerExpChange(PlayerExpChangeEvent event) {
    if (Zones.inNoDemigodsZone(event.getPlayer().getLocation())) return;

    // Define variables
    Player player = event.getPlayer();

    if (player.getInventory().getBoots() != null && Items.areEqualIgnoreEnchantments(ITEM, player.getInventory().getBoots())) {
        event.getPlayer().setVelocity(new Vector(0.1F, 3, 0));
    }
}
PlayerListener.java 文件源码 项目:Merlin 阅读 25 收藏 0 点赞 0 评论 0
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerExpChange (PlayerExpChangeEvent event)
  {
    Player player = event.getPlayer();
    Sorcerer sorcerer = sorcererManager.getSorcerer(player);
    sorcerer.addMana(event.getAmount() * 10);
    event.setAmount(0);
  }
SurvivorsListener.java 文件源码 项目:RoyalSurvivors 阅读 41 收藏 0 点赞 0 评论 0
@EventHandler
public void minimizeXP(PlayerExpChangeEvent e) {
    if (!RUtils.isInInfectedWorld(e.getPlayer())) return;
    Player p = e.getPlayer();
    PConfManager pcm = PConfManager.getPConfManager(p);
    float thirst = pcm.getFloat("thirst");
    if (!pcm.isSet("thirst")) {
        thirst = 1F;
        pcm.set("thirst", thirst);
    }
    p.setExp(thirst);
}
EnvironmentManager.java 文件源码 项目:ZentrelaRPG 阅读 27 收藏 0 点赞 0 评论 0
@EventHandler
public void onExpGain(PlayerExpChangeEvent event) {
    event.setAmount(0);
}
ChallengeListener.java 文件源码 项目:AsgardAscension 阅读 23 收藏 0 点赞 0 评论 0
@EventHandler
public void onEXP(PlayerExpChangeEvent event) {
    if(plugin.getChallenges().getChallenge(event.getPlayer()) == 0)
        return;
    event.setAmount(0);
}
Events.java 文件源码 项目:NeoHG 阅读 26 收藏 0 点赞 0 评论 0
@EventHandler
private void onEXP(PlayerExpChangeEvent event) {
    event.setAmount(Game.getState() == State.STARTING ? 0 : event.getAmount());
    if (Spectator.contains(event.getPlayer()))
        event.setAmount(0);
}
PlayerExpListener.java 文件源码 项目:DoubleYourExperience 阅读 22 收藏 0 点赞 0 评论 0
@EventHandler
public void onExpChange(PlayerExpChangeEvent event) {
    if(!plugin.getConfig().getBoolean("Enable")) return; // Don't waste computation power if we're not even enabled

    // Gather config variables
    List<String> enabledDays = plugin.getConfig().getStringList("DaysToEnable");
    int radius = plugin.getConfig().getInt("CheckRadius");

    // Get today's day string (US locale) and check if it's enabled in the config, return if it's not
    String currentDay = Calendar.getInstance().getDisplayName(Calendar.DAY_OF_WEEK, Calendar.SHORT, Locale.US);
    boolean enabled = false;
    for(String day : enabledDays) {
        if(day.toLowerCase().contains(currentDay.toLowerCase())) {
            enabled = true;
            break;
        }
    }
    if(!enabled) return; // Not enabled for today

    // Check for spawners nearby and return if we find one
    if(plugin.getConfig().getBoolean("CheckForSpawner")
            && plugin.isLocationNearBlock(event.getPlayer().getLocation(), Material.MOB_SPAWNER, radius)) return;

    // Multiply the experience gain
    Player player = event.getPlayer();
    int originalAmount = event.getAmount();
    int newAmount = originalAmount;
    boolean found = false;
    if (plugin.getConfig().getBoolean("EnablePermMultiplier")) {
        /* TODO:
         * Consider making this go backwards so a permission with a higher multiplier
         * will be caught before a permission with a lower multiplier. This is useful
         * for servers which use inherited permissions.
         */
        for (float temp = 0.0F; temp <= 10.0F; temp += 0.1F) {
            if (!player.isOp() && player.hasPermission(Perm.MULTIPLIER + temp)) {
                newAmount = (int) (originalAmount * temp);
                found = true;
                break;
            }
        }
    }
    if (!found && player.hasPermission(Perm.ALLOW)) {
        newAmount = (int) (originalAmount * plugin.getConfig().getDouble("Multiplier"));
    }

    event.setAmount(newAmount);
 }
SpectatorListener.java 文件源码 项目:UltimateSurvivalGames 阅读 26 收藏 0 点赞 0 评论 0
@EventHandler
public void onExpChangeEvent(PlayerExpChangeEvent event) {
    if(um.isSpectator(event.getPlayer().getName()))
        event.setAmount(0);
}
Running.java 文件源码 项目:Scapegoat 阅读 27 收藏 0 点赞 0 评论 0
/**
 * Triggered each time a player gets xp orbs. This DOES NOT handles "xp attraction".
 * @param e
 */
@EventHandler
public void onPlayerExpChange(PlayerExpChangeEvent e)
{
    e.setAmount((int) (e.getAmount() * 1.5f));
}
PlayerExpChangeListener.java 文件源码 项目:Wayward 阅读 48 收藏 0 点赞 0 评论 0
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerExpChange(PlayerExpChangeEvent event) {
    event.setAmount(0);
}
NerfXP.java 文件源码 项目:TerraCraftTools 阅读 30 收藏 0 点赞 0 评论 0
@EventHandler
public void onXPAccumulate(PlayerExpChangeEvent event) {
    event.setAmount((int) (event.getAmount() * multiple));
}
LoggedOutUserHandler.java 文件源码 项目:NPlugins 阅读 25 收藏 0 点赞 0 评论 0
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerExpChange(final PlayerExpChangeEvent event) {
    if (this.loggedOutPlayers.containsKey(event.getPlayer().getUniqueId())) {
        event.setAmount(0);
    }
}
GuiUpdatesListener.java 文件源码 项目:SpectatorPlus 阅读 31 收藏 0 点赞 0 评论 0
@EventHandler (priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerXPChange(PlayerExpChangeEvent ev)
{
    updatePlayerInventoryGUI();
}


问题


面经


文章

微信
公众号

扫码关注公众号