mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2025-03-01 15:51:06 +01:00
fixed an issue with citizens NPC targeting
This commit is contained in:
parent
1ce89703a7
commit
f4551be1db
@ -882,6 +882,17 @@ public class PlayerData extends OfflinePlayerData {
|
||||
return MMOCore.plugin.dataProvider.getDataManager().get(uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is being used to easily check if an online player corresponds to
|
||||
* a real player or a Citizens NPC. Citizens NPCs do not have any player
|
||||
* data associated to them
|
||||
*
|
||||
* @return Checks if plater data is loaded for a specific player UID
|
||||
*/
|
||||
public static boolean has(UUID uuid) {
|
||||
return MMOCore.plugin.dataProvider.getDataManager().isLoaded(uuid);
|
||||
}
|
||||
|
||||
public static Collection<PlayerData> getAll() {
|
||||
return MMOCore.plugin.dataProvider.getDataManager().getLoaded();
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ public class MMOCoreTargetRestriction implements TargetRestriction {
|
||||
@Override
|
||||
public boolean canTarget(Player player, LivingEntity target, InteractionType interaction) {
|
||||
|
||||
if (interaction.isOffense() && target instanceof Player) {
|
||||
if (interaction.isOffense() && target instanceof Player && PlayerData.has(target.getUniqueId())) {
|
||||
PlayerData targetData = PlayerData.get(target.getUniqueId());
|
||||
|
||||
// Check for the same party
|
||||
|
Loading…
Reference in New Issue
Block a user