本文整理汇总了Java中org.bukkit.event.player.PlayerExpChangeEvent类的典型用法代码示例。如果您正苦于以下问题:Java PlayerExpChangeEvent类的具体用法?Java PlayerExpChangeEvent怎么用?Java PlayerExpChangeEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PlayerExpChangeEvent类属于org.bukkit.event.player包,在下文中一共展示了PlayerExpChangeEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
示例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()));
}
示例3: onPlayerPickupExp
import org.bukkit.event.player.PlayerExpChangeEvent; //导入依赖的package包/类
@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);
}
}
示例4: 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);
}
}
示例5: 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);
}
}
示例6: onExp
import org.bukkit.event.player.PlayerExpChangeEvent; //导入依赖的package包/类
@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);
}
示例7: onCollectXp
import org.bukkit.event.player.PlayerExpChangeEvent; //导入依赖的package包/类
/**
* 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());
}
}
示例8: onPlayerExpChange
import org.bukkit.event.player.PlayerExpChangeEvent; //导入依赖的package包/类
@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);
}
示例9: onVIPExp
import org.bukkit.event.player.PlayerExpChangeEvent; //导入依赖的package包/类
@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);
}
}
示例10: onExpGain
import org.bukkit.event.player.PlayerExpChangeEvent; //导入依赖的package包/类
@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");
}
}
示例11: onExpPickup
import org.bukkit.event.player.PlayerExpChangeEvent; //导入依赖的package包/类
@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);
}
}
示例12: callEvent
import org.bukkit.event.player.PlayerExpChangeEvent; //导入依赖的package包/类
@EventHandler
public void callEvent(PlayerExpChangeEvent event) {
if (!active) {
event.setAmount(0);
}
}
示例13: 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);
}
}
示例14: 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));
}
}
示例15: 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);
}