mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 05:36:46 +01:00
Cleaning out some crap from our PlayerListener.
This commit is contained in:
parent
4fc6349824
commit
1aff2cf9eb
@ -66,7 +66,6 @@ public class PlayerListener implements Listener {
|
|||||||
String deathMessage = event.getDeathMessage();
|
String deathMessage = event.getDeathMessage();
|
||||||
|
|
||||||
if (deathMessage == null) {
|
if (deathMessage == null) {
|
||||||
mcMMO.p.getLogger().severe("You have another plugin causing null death messages. mcMMO cannot process this death message.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,19 +85,17 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
Player player = event.getEntity();
|
Player player = event.getEntity();
|
||||||
|
|
||||||
if (Misc.isNPCEntity(player)) {
|
if (Misc.isNPCEntity(player) || Permissions.hardcoreBypass(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Permissions.hardcoreBypass(player)) {
|
Player killer = player.getKiller();
|
||||||
Player killer = player.getKiller();
|
|
||||||
|
|
||||||
if (killer != null && Config.getInstance().getHardcoreVampirismEnabled()) {
|
if (killer != null && Config.getInstance().getHardcoreVampirismEnabled()) {
|
||||||
HardcoreManager.invokeVampirism(killer, player);
|
HardcoreManager.invokeVampirism(killer, player);
|
||||||
}
|
|
||||||
|
|
||||||
HardcoreManager.invokeStatPenalty(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HardcoreManager.invokeStatPenalty(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,7 +104,7 @@ public class PlayerListener implements Listener {
|
|||||||
* @param event The event to watch
|
* @param event The event to watch
|
||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerWorldChangeEvent(PlayerChangedWorldEvent event) {
|
public void onPlayerWorldChange(PlayerChangedWorldEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (Misc.isNPCEntity(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
@ -137,16 +134,18 @@ public class PlayerListener implements Listener {
|
|||||||
* @param event The event to watch
|
* @param event The event to watch
|
||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerLoginEvent(PlayerLoginEvent event) {
|
public void onPlayerLogin(PlayerLoginEvent event) {
|
||||||
if (event.getResult() == Result.ALLOWED) {
|
if (event.getResult() != Result.ALLOWED) {
|
||||||
Player player = event.getPlayer();
|
return;
|
||||||
|
|
||||||
if (Misc.isNPCEntity(player)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
UserManager.addUser(player).actualizeRespawnATS();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
if (Misc.isNPCEntity(player)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UserManager.addUser(player).actualizeRespawnATS();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -155,19 +154,11 @@ public class PlayerListener implements Listener {
|
|||||||
* @param event The event to modify
|
* @param event The event to modify
|
||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onPlayerDropItemEvent(PlayerDropItemEvent event) {
|
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
||||||
Player player = event.getPlayer();
|
|
||||||
Item drop = event.getItemDrop();
|
Item drop = event.getItemDrop();
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
|
||||||
|
|
||||||
if (mcMMOPlayer.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) || mcMMOPlayer.getAbilityMode(AbilityType.SUPER_BREAKER)) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
drop.setMetadata(mcMMO.droppedItemKey, mcMMO.metadataValue);
|
drop.setMetadata(mcMMO.droppedItemKey, mcMMO.metadataValue);
|
||||||
|
SkillUtils.removeAbilityBuff(drop.getItemStack());
|
||||||
SkillUtils.removeAbilityBuff(event.getItemDrop().getItemStack());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -221,14 +212,14 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onPlayerPickupItem(PlayerPickupItemEvent event) {
|
public void onPlayerPickupItem(PlayerPickupItemEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
Item drop = event.getItem();
|
|
||||||
ItemStack dropStack = drop.getItemStack();
|
|
||||||
|
|
||||||
if (Misc.isNPCEntity(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
Item drop = event.getItem();
|
||||||
|
ItemStack dropStack = drop.getItemStack();
|
||||||
|
|
||||||
if (!drop.hasMetadata(mcMMO.droppedItemKey) && mcMMOPlayer.inParty() && ItemUtils.isShareable(dropStack)) {
|
if (!drop.hasMetadata(mcMMO.droppedItemKey) && mcMMOPlayer.inParty() && ItemUtils.isShareable(dropStack)) {
|
||||||
event.setCancelled(ShareHandler.handleItemShare(drop, mcMMOPlayer));
|
event.setCancelled(ShareHandler.handleItemShare(drop, mcMMOPlayer));
|
||||||
@ -319,14 +310,13 @@ public class PlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Block block = event.getClickedBlock();
|
MiningManager miningManager = UserManager.getPlayer(player).getMiningManager();
|
||||||
ItemStack heldItem = player.getItemInHand();
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
|
||||||
MiningManager miningManager = mcMMOPlayer.getMiningManager();
|
|
||||||
|
|
||||||
switch (event.getAction()) {
|
switch (event.getAction()) {
|
||||||
case RIGHT_CLICK_BLOCK:
|
case RIGHT_CLICK_BLOCK:
|
||||||
|
Block block = event.getClickedBlock();
|
||||||
int blockID = block.getTypeId();
|
int blockID = block.getTypeId();
|
||||||
|
ItemStack heldItem = player.getItemInHand();
|
||||||
|
|
||||||
/* REPAIR CHECKS */
|
/* REPAIR CHECKS */
|
||||||
if (blockID == Repair.repairAnvilId && Permissions.skillEnabled(player, SkillType.REPAIR) && mcMMO.repairableManager.isRepairable(heldItem)) {
|
if (blockID == Repair.repairAnvilId && Permissions.skillEnabled(player, SkillType.REPAIR) && mcMMO.repairableManager.isRepairable(heldItem)) {
|
||||||
@ -477,7 +467,6 @@ public class PlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isAsync = event.isAsynchronous();
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if (mcMMOPlayer.getPartyChatMode()) {
|
if (mcMMOPlayer.getPartyChatMode()) {
|
||||||
@ -488,11 +477,11 @@ public class PlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatManager.handlePartyChat(plugin, party, player.getName(), player.getDisplayName(), event.getMessage(), isAsync);
|
ChatManager.handlePartyChat(plugin, party, player.getName(), player.getDisplayName(), event.getMessage(), event.isAsynchronous());
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
else if (mcMMOPlayer.getAdminChatMode()) {
|
else if (mcMMOPlayer.getAdminChatMode()) {
|
||||||
ChatManager.handleAdminChat(plugin, player.getName(), player.getDisplayName(), event.getMessage(), isAsync);
|
ChatManager.handleAdminChat(plugin, player.getName(), player.getDisplayName(), event.getMessage(), event.isAsynchronous());
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user