Fixed async and action system error
This commit is contained in:
parent
945c73981c
commit
e2d7f9c307
|
@ -1,6 +1,7 @@
|
||||||
name: ActionHealth
|
name: ActionHealth
|
||||||
main: com.zeshanaslam.actionhealth.Main
|
main: com.zeshanaslam.actionhealth.Main
|
||||||
version: 3.4.0
|
version: 3.4.1
|
||||||
|
api-version: 1.14
|
||||||
softdepend: [PlaceholderAPI, MVdWPlaceholderAPI, WorldGuard, mcMMO, MythicMobs, LangUtils]
|
softdepend: [PlaceholderAPI, MVdWPlaceholderAPI, WorldGuard, mcMMO, MythicMobs, LangUtils]
|
||||||
commands:
|
commands:
|
||||||
Actionhealth:
|
Actionhealth:
|
||||||
|
|
|
@ -46,12 +46,7 @@ public class LookThread extends BukkitRunnable {
|
||||||
String name = plugin.healthUtil.getName(livingEntity, player);
|
String name = plugin.healthUtil.getName(livingEntity, player);
|
||||||
|
|
||||||
if (TargetHelper.canSee(player, livingEntity.getLocation(), transparentTypeIds) && !plugin.healthUtil.isBlacklisted(livingEntity, name)) {
|
if (TargetHelper.canSee(player, livingEntity.getLocation(), transparentTypeIds) && !plugin.healthUtil.isBlacklisted(livingEntity, name)) {
|
||||||
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
plugin.healthUtil.sendHealth(player, livingEntity, livingEntity.getHealth());
|
plugin.healthUtil.sendHealth(player, livingEntity, livingEntity.getHealth());
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,11 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||||
import org.bukkit.event.player.PlayerItemHeldEvent;
|
import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.bukkit.inventory.meta.PotionMeta;
|
||||||
import org.bukkit.potion.Potion;
|
import org.bukkit.potion.Potion;
|
||||||
|
import org.bukkit.potion.PotionData;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -91,8 +95,20 @@ public class ActionListener implements Listener {
|
||||||
String name = itemStack.getType().name();
|
String name = itemStack.getType().name();
|
||||||
possibleMaterials.add(name);
|
possibleMaterials.add(name);
|
||||||
|
|
||||||
if (name.contains("POTION")) {
|
if (itemStack.hasItemMeta()) {
|
||||||
possibleMaterials.add(Potion.fromItemStack(itemStack).getType().getEffectType().getName() + "_" + name);
|
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||||
|
if (itemMeta instanceof PotionMeta) {
|
||||||
|
PotionMeta potionMeta = (PotionMeta) itemStack.getItemMeta();
|
||||||
|
|
||||||
|
PotionData potionData = potionMeta.getBasePotionData();
|
||||||
|
possibleMaterials.add(potionData.getType().getEffectType().getName() + "_" + name);
|
||||||
|
|
||||||
|
if (potionMeta.hasCustomEffects()) {
|
||||||
|
for (PotionEffect potionEffect : potionMeta.getCustomEffects()) {
|
||||||
|
possibleMaterials.add(potionEffect.getType().getName() + "_" + name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return possibleMaterials;
|
return possibleMaterials;
|
||||||
|
|
|
@ -123,7 +123,7 @@ public class ConfigStore {
|
||||||
lookDistance = plugin.getConfig().getDouble("Look Distance");
|
lookDistance = plugin.getConfig().getDouble("Look Distance");
|
||||||
|
|
||||||
if (showOnLook) {
|
if (showOnLook) {
|
||||||
BukkitTask bukkitTask = new LookThread(plugin).runTaskTimerAsynchronously(plugin, 0, 20);
|
BukkitTask bukkitTask = new LookThread(plugin).runTaskTimer(plugin, 0, 20);
|
||||||
plugin.taskID = bukkitTask.getTaskId();
|
plugin.taskID = bukkitTask.getTaskId();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue