mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Removed isNPCPlayer, isNPCEntity is identical
This commit is contained in:
parent
519485f155
commit
ad68f50b14
@ -103,7 +103,7 @@ public class BlockListener implements Listener {
|
|||||||
public void onBlockPlace(BlockPlaceEvent event) {
|
public void onBlockPlace(BlockPlaceEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,7 +252,7 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,7 +318,7 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ public class EntityListener implements Listener {
|
|||||||
if (livingEntity instanceof Player) {
|
if (livingEntity instanceof Player) {
|
||||||
Player player = (Player) entity;
|
Player player = (Player) entity;
|
||||||
|
|
||||||
if (!player.isOnline() || Misc.isNPCPlayer(player)) {
|
if (!player.isOnline() || Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,7 +296,7 @@ public class EntityListener implements Listener {
|
|||||||
if (entity instanceof Player) {
|
if (entity instanceof Player) {
|
||||||
Player player = (Player) entity;
|
Player player = (Player) entity;
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -352,7 +352,7 @@ public class EntityListener implements Listener {
|
|||||||
public void onEntityTame(EntityTameEvent event) {
|
public void onEntityTame(EntityTameEvent event) {
|
||||||
Player player = (Player) event.getOwner();
|
Player player = (Player) event.getOwner();
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
Player player = event.getEntity();
|
Player player = event.getEntity();
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ public class PlayerListener implements Listener {
|
|||||||
public void onPlayerWorldChangeEvent(PlayerChangedWorldEvent event) {
|
public void onPlayerWorldChangeEvent(PlayerChangedWorldEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ public class PlayerListener implements Listener {
|
|||||||
if (event.getResult() == Result.ALLOWED) {
|
if (event.getResult() == Result.ALLOWED) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ public class PlayerListener implements Listener {
|
|||||||
public void onPlayerFish(PlayerFishEvent event) {
|
public void onPlayerFish(PlayerFishEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player) || !Permissions.fishing(player)) {
|
if (Misc.isNPCEntity(player) || !Permissions.fishing(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ public class PlayerListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
Item item = event.getItem();
|
Item item = event.getItem();
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ public class PlayerListener implements Listener {
|
|||||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ public class PlayerListener implements Listener {
|
|||||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ public class PlayerListener implements Listener {
|
|||||||
public void onPlayerInteractLowest(PlayerInteractEvent event) {
|
public void onPlayerInteractLowest(PlayerInteractEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ public class PlayerListener implements Listener {
|
|||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -407,7 +407,7 @@ public class PlayerListener implements Listener {
|
|||||||
public void onPlayerChat(AsyncPlayerChatEvent event) {
|
public void onPlayerChat(AsyncPlayerChatEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ public abstract class AcrobaticsEventHandler {
|
|||||||
protected boolean isFatal(int damage) {
|
protected boolean isFatal(int damage) {
|
||||||
Player player = manager.getMcMMOPlayer().getPlayer();
|
Player player = manager.getMcMMOPlayer().getPlayer();
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player) || player.getHealth() - damage < 1) {
|
if (Misc.isNPCEntity(player) || player.getHealth() - damage < 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public class MiningManager extends SkillManager{
|
|||||||
* @param event Event whose explosion is being processed
|
* @param event Event whose explosion is being processed
|
||||||
*/
|
*/
|
||||||
public void blastMiningDropProcessing(EntityExplodeEvent event) {
|
public void blastMiningDropProcessing(EntityExplodeEvent event) {
|
||||||
if (Misc.isNPCPlayer(mcMMOPlayer.getPlayer())) {
|
if (Misc.isNPCEntity(mcMMOPlayer.getPlayer())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ public class MiningManager extends SkillManager{
|
|||||||
* @param event Event whose explosion radius is being changed
|
* @param event Event whose explosion radius is being changed
|
||||||
*/
|
*/
|
||||||
public void biggerBombs(ExplosionPrimeEvent event) {
|
public void biggerBombs(ExplosionPrimeEvent event) {
|
||||||
if (Misc.isNPCPlayer(mcMMOPlayer.getPlayer())) {
|
if (Misc.isNPCEntity(mcMMOPlayer.getPlayer())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ public class SmeltingManager extends SkillManager {
|
|||||||
public void fuelEfficiency(FurnaceBurnEvent event) {
|
public void fuelEfficiency(FurnaceBurnEvent event) {
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getPlayer();
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player) || !Permissions.fuelEfficiency(player)) {
|
if (Misc.isNPCEntity(player) || !Permissions.fuelEfficiency(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ public class SmeltingManager extends SkillManager {
|
|||||||
public void smeltProcessing(FurnaceSmeltEvent event) {
|
public void smeltProcessing(FurnaceSmeltEvent event) {
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getPlayer();
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public final class CombatTools {
|
|||||||
if (attacker instanceof Player) {
|
if (attacker instanceof Player) {
|
||||||
Player player = (Player) attacker;
|
Player player = (Player) attacker;
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ public final class CombatTools {
|
|||||||
if (wolf.isTamed() && wolf.getOwner() instanceof Player) {
|
if (wolf.isTamed() && wolf.getOwner() instanceof Player) {
|
||||||
Player master = (Player) wolf.getOwner();
|
Player master = (Player) wolf.getOwner();
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(master)) {
|
if (Misc.isNPCEntity(master)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,7 +256,7 @@ public final class CombatTools {
|
|||||||
if (targetIsPlayer) {
|
if (targetIsPlayer) {
|
||||||
Player player = (Player) target;
|
Player player = (Player) target;
|
||||||
|
|
||||||
if (Misc.isNPCPlayer(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +295,7 @@ public final class CombatTools {
|
|||||||
* @param event The event to run the archery checks on.
|
* @param event The event to run the archery checks on.
|
||||||
*/
|
*/
|
||||||
private static void archeryCheck(Player shooter, LivingEntity target, EntityDamageByEntityEvent event) {
|
private static void archeryCheck(Player shooter, LivingEntity target, EntityDamageByEntityEvent event) {
|
||||||
if (Misc.isNPCPlayer(shooter)) {
|
if (Misc.isNPCEntity(shooter)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@ -38,14 +37,6 @@ public final class Misc {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isNPCPlayer(Player player) {
|
|
||||||
if (player == null || player.hasMetadata("NPC")) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the upgrade tier of the item in hand.
|
* Get the upgrade tier of the item in hand.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user