mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
No reason to have our scoreboard stuff in a different listener.
This commit is contained in:
parent
abfedf381d
commit
734815c58d
@ -1,5 +1,6 @@
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
@ -353,6 +354,7 @@ public class PlayerListener implements Listener {
|
||||
BleedTimerTask.bleedOut(player);
|
||||
mcMMOPlayer.getProfile().save();
|
||||
UserManager.remove(player.getName());
|
||||
ScoreboardManager.teardownPlayer(player);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -373,6 +375,7 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
|
||||
UserManager.addUser(player).actualizeRespawnATS();
|
||||
ScoreboardManager.setupPlayer(player);
|
||||
|
||||
if (Config.getInstance().getMOTDEnabled() && Permissions.motd(player)) {
|
||||
Motd.displayAll(player);
|
||||
|
@ -1,39 +0,0 @@
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent;
|
||||
import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
|
||||
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
|
||||
public class ScoreboardsListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
ScoreboardManager.setupPlayer(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
ScoreboardManager.teardownPlayer(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerLevelUp(McMMOPlayerLevelUpEvent event) {
|
||||
ScoreboardManager.handleLevelUp(event.getPlayer(), event.getSkill());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerXp(McMMOPlayerXpGainEvent event) {
|
||||
ScoreboardManager.handleXp(event.getPlayer(), event.getSkill());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onAbility(McMMOPlayerAbilityActivateEvent event) {
|
||||
ScoreboardManager.cooldownUpdate(event.getPlayer(), event.getSkill());
|
||||
}
|
||||
}
|
@ -1,5 +1,10 @@
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
|
||||
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -10,12 +15,27 @@ import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent;
|
||||
public class SelfListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerLevelUp(McMMOPlayerLevelUpEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
SkillType skill = event.getSkill();
|
||||
|
||||
ScoreboardManager.handleLevelUp(player, skill);
|
||||
|
||||
if (!Config.getInstance().getLevelUpEffectsEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((event.getSkillLevel() % Config.getInstance().getLevelUpEffectsTier()) == 0) {
|
||||
event.getSkill().celebrateLevelUp(event.getPlayer());
|
||||
skill.celebrateLevelUp(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerXp(McMMOPlayerXpGainEvent event) {
|
||||
ScoreboardManager.handleXp(event.getPlayer(), event.getSkill());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onAbility(McMMOPlayerAbilityActivateEvent event) {
|
||||
ScoreboardManager.cooldownUpdate(event.getPlayer(), event.getSkill());
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ import com.gmail.nossr50.listeners.BlockListener;
|
||||
import com.gmail.nossr50.listeners.EntityListener;
|
||||
import com.gmail.nossr50.listeners.InventoryListener;
|
||||
import com.gmail.nossr50.listeners.PlayerListener;
|
||||
import com.gmail.nossr50.listeners.ScoreboardsListener;
|
||||
import com.gmail.nossr50.listeners.SelfListener;
|
||||
import com.gmail.nossr50.listeners.WorldListener;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
@ -441,7 +440,6 @@ public class mcMMO extends JavaPlugin {
|
||||
pluginManager.registerEvents(new EntityListener(this), this);
|
||||
pluginManager.registerEvents(new InventoryListener(this), this);
|
||||
pluginManager.registerEvents(new SelfListener(), this);
|
||||
pluginManager.registerEvents(new ScoreboardsListener(), this);
|
||||
pluginManager.registerEvents(new WorldListener(this), this);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user