mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-18 15:17:36 +01:00
Optimized flags scheduler.
This commit is contained in:
parent
183f48a998
commit
d9136aa407
@ -60,6 +60,12 @@ public void run() {
|
||||
GlobalStateManager config = plugin.getGlobalStateManager();
|
||||
|
||||
for (Player player : players) {
|
||||
WorldStateManager worldConfig = config.get(player.getWorld());
|
||||
|
||||
if (!worldConfig.useRegions) {
|
||||
continue;
|
||||
}
|
||||
|
||||
PlayerFlagState state;
|
||||
|
||||
synchronized (this) {
|
||||
@ -71,17 +77,13 @@ public void run() {
|
||||
}
|
||||
}
|
||||
|
||||
WorldStateManager worldConfig = config.get(player.getWorld());
|
||||
Vector playerLocation = toVector(player.getLocation());
|
||||
RegionManager regionManager = plugin.getGlobalRegionManager()
|
||||
.get(player.getWorld());
|
||||
ApplicableRegionSet applicable = regionManager
|
||||
.getApplicableRegions(playerLocation);
|
||||
|
||||
if (worldConfig.useRegions) {
|
||||
Vector playerLocation = toVector(player.getLocation());
|
||||
RegionManager regionManager = plugin.getGlobalRegionManager()
|
||||
.get(player.getWorld());
|
||||
ApplicableRegionSet applicable = regionManager
|
||||
.getApplicableRegions(playerLocation);
|
||||
|
||||
processHeal(applicable, player, state);
|
||||
}
|
||||
processHeal(applicable, player, state);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,6 +59,7 @@ public class GlobalStateManager {
|
||||
private Set<String> hasAmphibious = new HashSet<String>();
|
||||
|
||||
public boolean suppressTickSyncWarnings;
|
||||
public boolean useRegionsScheduler;
|
||||
|
||||
/**
|
||||
* Construct the object.
|
||||
@ -83,6 +84,8 @@ public void load() {
|
||||
|
||||
suppressTickSyncWarnings = config.getBoolean(
|
||||
"suppress-tick-sync-warnings", false);
|
||||
useRegionsScheduler = config.getBoolean(
|
||||
"regions.use-scheduler", true);
|
||||
|
||||
// Load configurations for each world
|
||||
for (World world : plugin.getServer().getWorlds()) {
|
||||
|
@ -140,8 +140,11 @@ public void onEnable() {
|
||||
(new WorldGuardWeatherListener(this)).registerEvents();
|
||||
|
||||
flagScheduler = new FlagScheduler(this);
|
||||
getServer().getScheduler().scheduleAsyncRepeatingTask(this,
|
||||
flagScheduler, FlagScheduler.RUN_DELAY, FlagScheduler.RUN_DELAY);
|
||||
|
||||
if (configuration.useRegionsScheduler) {
|
||||
getServer().getScheduler().scheduleAsyncRepeatingTask(this,
|
||||
flagScheduler, FlagScheduler.RUN_DELAY, FlagScheduler.RUN_DELAY);
|
||||
}
|
||||
|
||||
if (configuration.suppressTickSyncWarnings) {
|
||||
Logger.getLogger("Minecraft").setFilter(
|
||||
@ -210,6 +213,7 @@ public GlobalRegionManager getGlobalRegionManager() {
|
||||
* @return
|
||||
* @deprecated Use {@link #getGlobalStateManager()} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public GlobalStateManager getGlobalConfiguration() {
|
||||
return getGlobalStateManager();
|
||||
}
|
||||
|
@ -18,7 +18,10 @@
|
||||
# Remember to check the compatibility spreadsheet for WorldGuard to see
|
||||
# if any features are currently broken in your version of Bukkit.
|
||||
#
|
||||
|
||||
suppress-tick-sync-warnings: false
|
||||
regions:
|
||||
use-scheduler: true
|
||||
|
||||
# For permissions, see http://wiki.sk89q.com/wiki/WorldGuard/Permissions/Bukkit
|
||||
permissions:
|
||||
|
Loading…
Reference in New Issue
Block a user