Added ability to modify player looking check timer
This commit is contained in:
parent
12ef53662c
commit
17a2fb9b49
|
@ -77,6 +77,8 @@ Show On Look: true
|
|||
Look Distance: 10
|
||||
|
||||
LookValues:
|
||||
# How often (in ticks) to check if player is looking at an entity. Increase if lagging, maybe to 10 or 20.
|
||||
CheckTicks: 0
|
||||
# If the dot product is positive, the target is in front
|
||||
Dot: 0
|
||||
# Tolerance of the line calculation
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: ActionHealth
|
||||
main: com.zeshanaslam.actionhealth.Main
|
||||
version: 3.4.3
|
||||
version: 3.4.4
|
||||
softdepend: [PlaceholderAPI, MVdWPlaceholderAPI, WorldGuard, mcMMO, MythicMobs, LangUtils]
|
||||
commands:
|
||||
Actionhealth:
|
||||
|
|
|
@ -69,7 +69,7 @@ public class Main extends JavaPlugin {
|
|||
langUtilsEnabled = true;
|
||||
}
|
||||
|
||||
actionTask = new ActionTask(this).runTaskTimer(this, 0, 20);
|
||||
actionTask = new ActionTask(this).runTaskTimer(this, 0, configStore.checkTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -49,6 +49,7 @@ public class ConfigStore {
|
|||
public boolean showMiniaturePets;
|
||||
public double lookDot;
|
||||
public double lookTolerance;
|
||||
public long checkTicks;
|
||||
public ActionStore actionStore;
|
||||
|
||||
public ConfigStore(Main plugin) {
|
||||
|
@ -58,8 +59,6 @@ public class ConfigStore {
|
|||
blacklist.clear();
|
||||
translate.clear();
|
||||
|
||||
if (plugin.taskID != -1) Bukkit.getScheduler().cancelTask(plugin.taskID);
|
||||
|
||||
// Check if using MVdWPlaceholderAPI
|
||||
hasMVdWPlaceholderAPI = Bukkit.getPluginManager().isPluginEnabled("MVdWPlaceholderAPI");
|
||||
|
||||
|
@ -120,19 +119,6 @@ public class ConfigStore {
|
|||
blacklist.addAll(plugin.getConfig().getStringList("Blacklist").stream().map(s -> ChatColor.translateAlternateColorCodes('&', s)).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
if (plugin.getConfig().contains("Show On Look")) {
|
||||
showOnLook = plugin.getConfig().getBoolean("Show On Look");
|
||||
lookDistance = plugin.getConfig().getDouble("Look Distance");
|
||||
|
||||
if (showOnLook) {
|
||||
BukkitTask bukkitTask = new LookThread(plugin).runTaskTimer(plugin, 0, 20);
|
||||
plugin.taskID = bukkitTask.getTaskId();
|
||||
}
|
||||
} else {
|
||||
plugin.taskID = -1;
|
||||
showOnLook = false;
|
||||
}
|
||||
|
||||
if (plugin.getConfig().contains("Toggle Message")) {
|
||||
toggleMessage = plugin.getConfig().getString("Toggle Message");
|
||||
}
|
||||
|
@ -184,5 +170,26 @@ public class ConfigStore {
|
|||
lookDot = 0;
|
||||
lookTolerance = 4;
|
||||
}
|
||||
|
||||
if (plugin.getConfig().contains("LookValues.CheckTicks")) {
|
||||
checkTicks = plugin.getConfig().getLong("LookValues.CheckTicks");
|
||||
} else {
|
||||
checkTicks = 0;
|
||||
}
|
||||
|
||||
if (plugin.taskID != -1) Bukkit.getScheduler().cancelTask(plugin.taskID);
|
||||
|
||||
if (plugin.getConfig().contains("Show On Look")) {
|
||||
showOnLook = plugin.getConfig().getBoolean("Show On Look");
|
||||
lookDistance = plugin.getConfig().getDouble("Look Distance");
|
||||
|
||||
if (showOnLook) {
|
||||
BukkitTask bukkitTask = new LookThread(plugin).runTaskTimer(plugin, 0, checkTicks);
|
||||
plugin.taskID = bukkitTask.getTaskId();
|
||||
}
|
||||
} else {
|
||||
plugin.taskID = -1;
|
||||
showOnLook = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue