mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Using UUID is safer.
This commit is contained in:
parent
56bd782625
commit
3aec0e5ef4
@ -75,7 +75,7 @@ public class Archery {
|
|||||||
for (Iterator<TrackedEntity> entityIterator = trackedEntities.iterator(); entityIterator.hasNext(); ) {
|
for (Iterator<TrackedEntity> entityIterator = trackedEntities.iterator(); entityIterator.hasNext(); ) {
|
||||||
TrackedEntity trackedEntity = entityIterator.next();
|
TrackedEntity trackedEntity = entityIterator.next();
|
||||||
|
|
||||||
if (trackedEntity.getLivingEntity().getEntityId() == livingEntity.getEntityId()) {
|
if (trackedEntity.getID() == livingEntity.getUniqueId()) {
|
||||||
Misc.dropItems(livingEntity.getLocation(), new ItemStack(Material.ARROW), trackedEntity.getArrowCount());
|
Misc.dropItems(livingEntity.getLocation(), new ItemStack(Material.ARROW), trackedEntity.getArrowCount());
|
||||||
entityIterator.remove();
|
entityIterator.remove();
|
||||||
return;
|
return;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.gmail.nossr50.skills.archery;
|
package com.gmail.nossr50.skills.archery;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.scheduler.BukkitScheduler;
|
import org.bukkit.scheduler.BukkitScheduler;
|
||||||
|
|
||||||
@ -7,12 +9,14 @@ import com.gmail.nossr50.mcMMO;
|
|||||||
|
|
||||||
public class TrackedEntity implements Runnable {
|
public class TrackedEntity implements Runnable {
|
||||||
private LivingEntity livingEntity;
|
private LivingEntity livingEntity;
|
||||||
|
private UUID id;
|
||||||
private int arrowCount;
|
private int arrowCount;
|
||||||
private int taskId;
|
private int taskId;
|
||||||
private BukkitScheduler scheduler;
|
private BukkitScheduler scheduler;
|
||||||
|
|
||||||
protected TrackedEntity(LivingEntity livingEntity) {
|
protected TrackedEntity(LivingEntity livingEntity) {
|
||||||
this.livingEntity = livingEntity;
|
this.livingEntity = livingEntity;
|
||||||
|
this.id = livingEntity.getUniqueId();
|
||||||
this.scheduler = mcMMO.p.getServer().getScheduler();
|
this.scheduler = mcMMO.p.getServer().getScheduler();
|
||||||
this.taskId = scheduler.scheduleSyncRepeatingTask(mcMMO.p, this, 12000, 12000);
|
this.taskId = scheduler.scheduleSyncRepeatingTask(mcMMO.p, this, 12000, 12000);
|
||||||
}
|
}
|
||||||
@ -21,6 +25,10 @@ public class TrackedEntity implements Runnable {
|
|||||||
return livingEntity;
|
return livingEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected UUID getID() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
protected int getArrowCount() {
|
protected int getArrowCount() {
|
||||||
return arrowCount;
|
return arrowCount;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user