mirror of
https://github.com/zeshan321/ActionHealth.git
synced 2024-09-27 22:57:42 +02:00
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
|
Look Distance: 10
|
||||||
|
|
||||||
LookValues:
|
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
|
# If the dot product is positive, the target is in front
|
||||||
Dot: 0
|
Dot: 0
|
||||||
# Tolerance of the line calculation
|
# Tolerance of the line calculation
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: ActionHealth
|
name: ActionHealth
|
||||||
main: com.zeshanaslam.actionhealth.Main
|
main: com.zeshanaslam.actionhealth.Main
|
||||||
version: 3.4.3
|
version: 3.4.4
|
||||||
softdepend: [PlaceholderAPI, MVdWPlaceholderAPI, WorldGuard, mcMMO, MythicMobs, LangUtils]
|
softdepend: [PlaceholderAPI, MVdWPlaceholderAPI, WorldGuard, mcMMO, MythicMobs, LangUtils]
|
||||||
commands:
|
commands:
|
||||||
Actionhealth:
|
Actionhealth:
|
||||||
|
@ -69,7 +69,7 @@ public class Main extends JavaPlugin {
|
|||||||
langUtilsEnabled = true;
|
langUtilsEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
actionTask = new ActionTask(this).runTaskTimer(this, 0, 20);
|
actionTask = new ActionTask(this).runTaskTimer(this, 0, configStore.checkTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -49,6 +49,7 @@ public class ConfigStore {
|
|||||||
public boolean showMiniaturePets;
|
public boolean showMiniaturePets;
|
||||||
public double lookDot;
|
public double lookDot;
|
||||||
public double lookTolerance;
|
public double lookTolerance;
|
||||||
|
public long checkTicks;
|
||||||
public ActionStore actionStore;
|
public ActionStore actionStore;
|
||||||
|
|
||||||
public ConfigStore(Main plugin) {
|
public ConfigStore(Main plugin) {
|
||||||
@ -58,8 +59,6 @@ public class ConfigStore {
|
|||||||
blacklist.clear();
|
blacklist.clear();
|
||||||
translate.clear();
|
translate.clear();
|
||||||
|
|
||||||
if (plugin.taskID != -1) Bukkit.getScheduler().cancelTask(plugin.taskID);
|
|
||||||
|
|
||||||
// Check if using MVdWPlaceholderAPI
|
// Check if using MVdWPlaceholderAPI
|
||||||
hasMVdWPlaceholderAPI = Bukkit.getPluginManager().isPluginEnabled("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()));
|
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")) {
|
if (plugin.getConfig().contains("Toggle Message")) {
|
||||||
toggleMessage = plugin.getConfig().getString("Toggle Message");
|
toggleMessage = plugin.getConfig().getString("Toggle Message");
|
||||||
}
|
}
|
||||||
@ -184,5 +170,26 @@ public class ConfigStore {
|
|||||||
lookDot = 0;
|
lookDot = 0;
|
||||||
lookTolerance = 4;
|
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
Block a user