Permalink
Browse files

NEEDS LATEST WORLDEDIT - Moved report framework to WorldEdit, and mad…

…e most config values be accessible without the BukkitWorldGuardWorldConfiguration
  • Loading branch information...
me4502 committed Aug 15, 2018
1 parent 44e3f72 commit b4bda6bfaf992df26815802d51ba5eb8ccfbfc3d
Showing with 170 additions and 809 deletions.
  1. +1 −1 worldguard-core/src/main/java/com/sk89q/worldguard/config/ConfigurationManager.java
  2. +99 −1 worldguard-core/src/main/java/com/sk89q/worldguard/config/WorldConfiguration.java
  3. +1 −1 worldguard-core/src/main/java/com/sk89q/worldguard/config/YamlConfigurationManager.java
  4. +1 −1 worldguard-core/src/main/java/com/sk89q/worldguard/config/YamlWorldConfiguration.java
  5. +12 −9 worldguard-core/src/main/java/com/sk89q/worldguard/util/profiler/SamplerBuilder.java
  6. +1 −7 worldguard-core/src/main/java/com/sk89q/worldguard/util/profiler/StackTraceNode.java
  7. +2 −3 worldguard-core/src/main/java/com/sk89q/worldguard/util/profiler/ThreadIdFilter.java
  8. +2 −3 worldguard-core/src/main/java/com/sk89q/worldguard/util/profiler/ThreadNameFilter.java
  9. +10 −14 ...dguard/bukkit → worldguard-core/src/main/java/com/sk89q/worldguard}/util/report/ConfigReport.java
  10. +0 −177 worldguard-core/src/main/java/com/sk89q/worldguard/util/report/DataReport.java
  11. +1 −0 worldguard-core/src/main/java/com/sk89q/worldguard/util/report/RegionReport.java
  12. +0 −26 worldguard-core/src/main/java/com/sk89q/worldguard/util/report/Report.java
  13. +0 −186 worldguard-core/src/main/java/com/sk89q/worldguard/util/report/ReportList.java
  14. +0 −58 worldguard-core/src/main/java/com/sk89q/worldguard/util/report/ShallowObjectReport.java
  15. +0 −64 worldguard-core/src/main/java/com/sk89q/worldguard/util/report/StackTraceReport.java
  16. +0 −91 worldguard-core/src/main/java/com/sk89q/worldguard/util/report/SystemInfoReport.java
  17. +0 −33 worldguard-core/src/main/java/com/sk89q/worldguard/util/report/Unreported.java
  18. +1 −1 worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/BukkitConfigurationManager.java
  19. +6 −107 worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/BukkitWorldConfiguration.java
  20. +20 −10 worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/WorldGuardCommands.java
  21. +1 −1 worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/RegionProtectionListener.java
  22. +2 −2 worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/report/CancelReport.java
  23. +1 −1 worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/report/PerformanceReport.java
  24. +1 −1 worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/report/PluginReport.java
  25. +5 −6 worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/report/SchedulerReport.java
  26. +1 −1 worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/report/ServerReport.java
  27. +1 −3 worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/report/ServicesReport.java
  28. +1 −1 worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/util/report/WorldReport.java
@@ -25,7 +25,7 @@
import com.sk89q.worldguard.protection.managers.storage.DriverType;
import com.sk89q.worldguard.protection.managers.storage.RegionDriver;
import com.sk89q.worldguard.session.handler.WaterBreathing;
import com.sk89q.worldguard.util.report.Unreported;
import com.sk89q.worldedit.util.report.Unreported;
import java.io.File;
import java.util.HashMap;
@@ -19,12 +19,15 @@
package com.sk89q.worldguard.config;
import com.sk89q.worldedit.world.entity.EntityType;
import com.sk89q.worldedit.world.registry.LegacyMapper;
import com.sk89q.worldguard.blacklist.Blacklist;
import com.sk89q.worldguard.util.report.Unreported;
import com.sk89q.worldedit.util.report.Unreported;
import java.io.File;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;
import java.util.stream.Collectors;
@@ -59,6 +62,101 @@
public boolean simulateSponge;
public int spongeRadius;
public boolean redstoneSponges;
public boolean summaryOnStart;
public boolean opPermissions;
public boolean buildPermissions;
public String buildPermissionDenyMessage = "";
public boolean fireSpreadDisableToggle;
public boolean itemDurability;
public boolean disableExpDrops;
public boolean blockPotionsAlways;
public boolean pumpkinScuba;
public boolean noPhysicsGravel;
public boolean noPhysicsSand;
public boolean ropeLadders;
public boolean allowPortalAnywhere;
public Set<String> preventWaterDamage;
public boolean blockLighter;
public boolean disableFireSpread;
public Set<String> disableFireSpreadBlocks;
public boolean preventLavaFire;
public Set<String> allowedLavaSpreadOver;
public boolean blockTNTExplosions;
public boolean blockTNTBlockDamage;
public boolean blockCreeperExplosions;
public boolean blockCreeperBlockDamage;
public boolean blockWitherExplosions;
public boolean blockWitherBlockDamage;
public boolean blockWitherSkullExplosions;
public boolean blockWitherSkullBlockDamage;
public boolean blockEnderDragonBlockDamage;
public boolean blockEnderDragonPortalCreation;
public boolean blockFireballExplosions;
public boolean blockFireballBlockDamage;
public boolean blockOtherExplosions;
public boolean blockEntityPaintingDestroy;
public boolean blockEntityItemFrameDestroy;
public boolean blockEntityArmorStandDestroy;
public boolean blockPluginSpawning;
public boolean blockGroundSlimes;
public boolean blockZombieDoorDestruction;
public boolean disableContactDamage;
public boolean disableFallDamage;
public boolean disableLavaDamage;
public boolean disableFireDamage;
public boolean disableLightningDamage;
public boolean disableDrowningDamage;
public boolean disableSuffocationDamage;
public boolean teleportOnSuffocation;
public boolean disableVoidDamage;
public boolean teleportOnVoid;
public boolean disableExplosionDamage;
public boolean disableMobDamage;
public boolean highFreqFlags;
public boolean checkLiquidFlow;
public String regionWand;
public Set<EntityType> blockCreatureSpawn;
public boolean allowTamedSpawns;
public int maxClaimVolume;
public boolean claimOnlyInsideExistingRegions;
public int maxRegionCountPerPlayer;
public boolean antiWolfDumbness;
public boolean signChestProtection;
public boolean disableSignChestProtectionCheck;
public boolean removeInfiniteStacks;
public boolean disableCreatureCropTrampling;
public boolean disablePlayerCropTrampling;
public boolean preventLightningFire;
public Set<String> disallowedLightningBlocks;
public boolean disableThunder;
public boolean disableWeather;
public boolean alwaysRaining;
public boolean alwaysThundering;
public boolean disablePigZap;
public boolean disableCreeperPower;
public boolean disableHealthRegain;
public boolean disableMushroomSpread;
public boolean disableIceMelting;
public boolean disableSnowMelting;
public boolean disableSnowFormation;
public boolean disableIceFormation;
public boolean disableLeafDecay;
public boolean disableGrassGrowth;
public boolean disableMyceliumSpread;
public boolean disableVineGrowth;
public boolean disableEndermanGriefing;
public boolean disableSnowmanTrails;
public boolean disableSoilDehydration;
public Set<String> allowedSnowFallOver;
public boolean regionInvinciblityRemovesMobs;
public boolean regionNetherPortalProtection;
public boolean fakePlayerBuildOverride;
public boolean explosionFlagCancellation;
public boolean disableDeathMessages;
public boolean disableObsidianGenerators;
public boolean strictEntitySpawn;
public boolean ignoreHopperMoveEvents;
protected Map<String, Integer> maxRegionCounts;
/**
* Load the configuration.
@@ -26,7 +26,7 @@
import com.sk89q.worldguard.protection.managers.storage.RegionDriver;
import com.sk89q.worldguard.protection.managers.storage.file.DirectoryYamlDriver;
import com.sk89q.worldguard.protection.managers.storage.sql.SQLDriver;
import com.sk89q.worldguard.util.report.Unreported;
import com.sk89q.worldedit.util.report.Unreported;
import com.sk89q.worldguard.util.sql.DataSourceConfig;
import java.io.File;
@@ -20,7 +20,7 @@
package com.sk89q.worldguard.config;
import com.sk89q.util.yaml.YAMLProcessor;
import com.sk89q.worldguard.util.report.Unreported;
import com.sk89q.worldedit.util.report.Unreported;
import java.util.ArrayList;
import java.util.List;
@@ -19,26 +19,29 @@
package com.sk89q.worldguard.util.profiler;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;
import java.util.*;
import java.util.Map;
import java.util.SortedMap;
import java.util.Timer;
import java.util.TimerTask;
import java.util.TreeMap;
import java.util.concurrent.TimeUnit;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.function.Predicate;
public class SamplerBuilder {
private static final Timer timer = new Timer("WorldGuard Sampler", true);
private int interval = 100;
private long runTime = TimeUnit.MINUTES.toMillis(5);
private Predicate<ThreadInfo> threadFilter = Predicates.alwaysTrue();
private Predicate<ThreadInfo> threadFilter = thread -> true;
public int getInterval() {
return interval;
@@ -78,7 +81,7 @@ public Sampler start() {
private final Predicate<ThreadInfo> threadFilter;
private final long endTime;
private final SortedMap<String, StackNode> nodes = new TreeMap<String, StackNode>();
private final SortedMap<String, StackNode> nodes = new TreeMap<>();
private final ThreadMXBean threadBean = ManagementFactory.getThreadMXBean();
private final SettableFuture<Sampler> future = SettableFuture.create();
@@ -119,7 +122,7 @@ public synchronized void run() {
String threadName = threadInfo.getThreadName();
StackTraceElement[] stack = threadInfo.getStackTrace();
if (threadName != null && stack != null && threadFilter.apply(threadInfo)) {
if (threadName != null && stack != null && threadFilter.test(threadInfo)) {
StackNode node = getNode(threadName);
node.log(stack, interval);
}
@@ -40,13 +40,7 @@ public String getMethodName() {
@Override
public int compareTo(StackNode o) {
if (getTotalTime() == o.getTotalTime()) {
return 0;
} else if (getTotalTime()> o.getTotalTime()) {
return -1;
} else {
return 1;
}
return Long.compare(o.getTotalTime(), getTotalTime());
}
}
@@ -19,9 +19,8 @@
package com.sk89q.worldguard.util.profiler;
import com.google.common.base.Predicate;
import java.lang.management.ThreadInfo;
import java.util.function.Predicate;
public class ThreadIdFilter implements Predicate<ThreadInfo> {
@@ -32,7 +31,7 @@ public ThreadIdFilter(long id) {
}
@Override
public boolean apply(ThreadInfo threadInfo) {
public boolean test(ThreadInfo threadInfo) {
return threadInfo.getThreadId() == id;
}
}
@@ -19,9 +19,8 @@
package com.sk89q.worldguard.util.profiler;
import com.google.common.base.Predicate;
import java.lang.management.ThreadInfo;
import java.util.function.Predicate;
import static com.google.common.base.Preconditions.checkNotNull;
@@ -35,7 +34,7 @@ public ThreadNameFilter(String name) {
}
@Override
public boolean apply(ThreadInfo threadInfo) {
public boolean test(ThreadInfo threadInfo) {
return threadInfo.getThreadName().equalsIgnoreCase(name);
}
@@ -17,38 +17,34 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit.util.report;
package com.sk89q.worldguard.util.report;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.util.report.DataReport;
import com.sk89q.worldedit.util.report.ShallowObjectReport;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.blacklist.Blacklist;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.config.WorldConfiguration;
import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import com.sk89q.worldguard.util.report.DataReport;
import com.sk89q.worldguard.util.report.RegionReport;
import com.sk89q.worldguard.util.report.ShallowObjectReport;
import org.bukkit.Bukkit;
import org.bukkit.World;
import java.util.List;
public class ConfigReport extends DataReport {
public ConfigReport(WorldGuardPlugin plugin) {
public ConfigReport() {
super("WorldGuard Configuration");
List<World> worlds = Bukkit.getServer().getWorlds();
List<? extends World> worlds = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getWorlds();
append("Configuration", new ShallowObjectReport("Configuration", WorldGuard.getInstance().getPlatform().getGlobalStateManager()));
for (World world : worlds) {
com.sk89q.worldedit.world.World weWorld = BukkitAdapter.adapt(world);
WorldConfiguration config = WorldGuard.getInstance().getPlatform().getGlobalStateManager().get(weWorld);
WorldConfiguration config = WorldGuard.getInstance().getPlatform().getGlobalStateManager().get(world);
DataReport report = new DataReport("World: " + world.getName());
report.append("UUID", world.getUID());
report.append("Configuration", new ShallowObjectReport("Configuration", config));
Blacklist blacklist = config.getBlacklist();
@@ -61,7 +57,7 @@ public ConfigReport(WorldGuardPlugin plugin) {
report.append("Blacklist", "<Disabled>");
}
RegionManager regions = WorldGuard.getInstance().getPlatform().getRegionContainer().get(weWorld);
RegionManager regions = WorldGuard.getInstance().getPlatform().getRegionContainer().get(world);
if (regions != null) {
DataReport section = new DataReport("Regions");
section.append("Region Count", regions.size());
Oops, something went wrong.

0 comments on commit b4bda6b

Please sign in to comment.