当前位置: 首页>>代码示例>>Java>>正文


Java PlayerExpChangeEvent.getPlayer方法代码示例

本文整理汇总了Java中org.bukkit.event.player.PlayerExpChangeEvent.getPlayer方法的典型用法代码示例。如果您正苦于以下问题:Java PlayerExpChangeEvent.getPlayer方法的具体用法?Java PlayerExpChangeEvent.getPlayer怎么用?Java PlayerExpChangeEvent.getPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.event.player.PlayerExpChangeEvent的用法示例。


在下文中一共展示了PlayerExpChangeEvent.getPlayer方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onPlayerExpChange

import org.bukkit.event.player.PlayerExpChangeEvent; //导入方法依赖的package包/类
@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);
		}
	}
}
 
开发者ID:Saukiya,项目名称:PVPAsWantedManager,代码行数:22,代码来源:PVPAsWantedManager.java

示例2: onXPGain

import org.bukkit.event.player.PlayerExpChangeEvent; //导入方法依赖的package包/类
@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()));

}
 
开发者ID:Staartvin,项目名称:Statz,代码行数:18,代码来源:XPGainedListener.java

示例3: onPlayerGainExp

import org.bukkit.event.player.PlayerExpChangeEvent; //导入方法依赖的package包/类
@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);
    }
}
 
开发者ID:kncxstudio,项目名称:BasicSurvivalPlus,代码行数:13,代码来源:PlayerLifercycleListener.java

示例4: onExpChange

import org.bukkit.event.player.PlayerExpChangeEvent; //导入方法依赖的package包/类
@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);
	}
}
 
开发者ID:Sharpjaws,项目名称:SharpSK,代码行数:11,代码来源:ExpChangeListener.java

示例5: onPlayerExpPickup

import org.bukkit.event.player.PlayerExpChangeEvent; //导入方法依赖的package包/类
@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);
	}
}
 
开发者ID:timvisee,项目名称:simple-survival-games,代码行数:15,代码来源:SSGPlayerListener.java

示例6: onPlayerExpChange

import org.bukkit.event.player.PlayerExpChangeEvent; //导入方法依赖的package包/类
@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));
    }
}
 
开发者ID:DemigodsRPG,项目名称:Demigods3,代码行数:12,代码来源:FaultyBootsOfHermes.java

示例7: onPlayerExpChange

import org.bukkit.event.player.PlayerExpChangeEvent; //导入方法依赖的package包/类
@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);
  }
 
开发者ID:DiGitHubCap,项目名称:Merlin,代码行数:9,代码来源:PlayerListener.java

示例8: minimizeXP

import org.bukkit.event.player.PlayerExpChangeEvent; //导入方法依赖的package包/类
@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);
}
 
开发者ID:RoyalDev,项目名称:RoyalSurvivors,代码行数:13,代码来源:SurvivorsListener.java

示例9: onExpChange

import org.bukkit.event.player.PlayerExpChangeEvent; //导入方法依赖的package包/类
@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);
 }
 
开发者ID:Vidsify,项目名称:DoubleYourExperience,代码行数:49,代码来源:PlayerExpListener.java


注:本文中的org.bukkit.event.player.PlayerExpChangeEvent.getPlayer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。