mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-26 20:45:43 +01:00
NEEDS LATEST WORLDEDIT - Moved report framework to WorldEdit, and made most config values be accessible without the BukkitWorldGuardWorldConfiguration
This commit is contained in:
parent
44e3f720de
commit
b4bda6bfaf
@ -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 abstract class WorldConfiguration {
|
||||
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 static class Sampler extends TimerTask {
|
||||
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());
|
@ -1,177 +0,0 @@
|
||||
/*
|
||||
* WorldGuard, a suite of tools for Minecraft
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldGuard team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.util.report;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class DataReport implements Report {
|
||||
|
||||
private final String title;
|
||||
private final List<Line> lines = Lists.newArrayList();
|
||||
|
||||
public DataReport(String title) {
|
||||
checkNotNull(title, "title");
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public void append(String key, String message) {
|
||||
checkNotNull(key, "key");
|
||||
lines.add(new Line(key, message));
|
||||
}
|
||||
|
||||
public void append(String key, String message, Object... values) {
|
||||
checkNotNull(message, "values");
|
||||
checkNotNull(values, "values");
|
||||
append(key, String.format(message, values));
|
||||
}
|
||||
|
||||
public void append(String key, byte value) {
|
||||
append(key, String.valueOf(value));
|
||||
}
|
||||
|
||||
public void append(String key, short value) {
|
||||
append(key, String.valueOf(value));
|
||||
}
|
||||
|
||||
public void append(String key, int value) {
|
||||
append(key, String.valueOf(value));
|
||||
}
|
||||
|
||||
public void append(String key, long value) {
|
||||
append(key, String.valueOf(value));
|
||||
}
|
||||
|
||||
public void append(String key, float value) {
|
||||
append(key, String.valueOf(value));
|
||||
}
|
||||
|
||||
public void append(String key, double value) {
|
||||
append(key, String.valueOf(value));
|
||||
}
|
||||
|
||||
public void append(String key, boolean value) {
|
||||
append(key, String.valueOf(value));
|
||||
}
|
||||
|
||||
public void append(String key, char value) {
|
||||
append(key, String.valueOf(value));
|
||||
}
|
||||
|
||||
public void append(String key, Object value) {
|
||||
append(key, getStringValue(value, Sets.newHashSet()));
|
||||
}
|
||||
|
||||
private static String getStringValue(Object value, Set<Object> seen) {
|
||||
if (seen.contains(value)) {
|
||||
return "<Recursive>";
|
||||
} else {
|
||||
seen.add(value);
|
||||
}
|
||||
|
||||
if (value instanceof Object[]) {
|
||||
value = Arrays.asList(value);
|
||||
}
|
||||
|
||||
if (value instanceof Collection<?>) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
boolean first = true;
|
||||
for (Object entry : (Collection<?>) value) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
builder.append("\n");
|
||||
}
|
||||
builder.append(getStringValue(entry, Sets.newHashSet(seen)));
|
||||
}
|
||||
return builder.toString();
|
||||
} else if (value instanceof Map<?, ?>) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
boolean first = true;
|
||||
for (Map.Entry<?, ?> entry : ((Map<?, ?>) value).entrySet()) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
builder.append("\n");
|
||||
}
|
||||
|
||||
String key = getStringValue(entry.getKey(), Sets.newHashSet(seen)).replaceAll("[\r\n]", "");
|
||||
if (key.length() > 60) {
|
||||
key = key.substring(0, 60) + "...";
|
||||
}
|
||||
|
||||
builder
|
||||
.append(key)
|
||||
.append(": ")
|
||||
.append(getStringValue(entry.getValue(), Sets.newHashSet(seen)));
|
||||
}
|
||||
return builder.toString();
|
||||
} else {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (!lines.isEmpty()) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
boolean first = true;
|
||||
for (Line line : lines) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
builder.append("\n");
|
||||
}
|
||||
builder.append(line.key).append(": ");
|
||||
if (line.value == null) {
|
||||
builder.append("null");
|
||||
} else if (line.value.contains("\n")) {
|
||||
builder.append("\n");
|
||||
builder.append(line.value.replaceAll("(?m)^", "\t"));
|
||||
} else {
|
||||
builder.append(line.value);
|
||||
}
|
||||
}
|
||||
return builder.toString();
|
||||
} else {
|
||||
return "No data.";
|
||||
}
|
||||
}
|
||||
|
||||
private static class Line {
|
||||
private final String key;
|
||||
private final String value;
|
||||
|
||||
public Line(String key, String value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldguard.util.report;
|
||||
|
||||
import com.sk89q.worldedit.util.report.DataReport;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
|
||||
/**
|
||||
|
@ -1,26 +0,0 @@
|
||||
/*
|
||||
* WorldGuard, a suite of tools for Minecraft
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldGuard team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.util.report;
|
||||
|
||||
public interface Report {
|
||||
|
||||
String getTitle();
|
||||
|
||||
}
|
@ -1,186 +0,0 @@
|
||||
/*
|
||||
* WorldGuard, a suite of tools for Minecraft
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldGuard team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.util.report;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
public class ReportList implements Report, List<Report> {
|
||||
|
||||
private final String title;
|
||||
private final List<Report> reports = Lists.newArrayList();
|
||||
|
||||
public ReportList(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return reports.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return reports.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
return reports.contains(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Report> iterator() {
|
||||
return reports.iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
return reports.toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T[] toArray(T[] a) {
|
||||
return reports.toArray(a);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(Report report) {
|
||||
return reports.add(report);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
return reports.remove(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsAll(Collection<?> c) {
|
||||
return reports.containsAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(Collection<? extends Report> c) {
|
||||
return reports.addAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(int index, Collection<? extends Report> c) {
|
||||
return reports.addAll(index, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAll(Collection<?> c) {
|
||||
return reports.removeAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean retainAll(Collection<?> c) {
|
||||
return reports.retainAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
reports.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return reports.equals(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return reports.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Report get(int index) {
|
||||
return reports.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Report set(int index, Report element) {
|
||||
return reports.set(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(int index, Report element) {
|
||||
reports.add(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Report remove(int index) {
|
||||
return reports.remove(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int indexOf(Object o) {
|
||||
return reports.indexOf(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int lastIndexOf(Object o) {
|
||||
return reports.lastIndexOf(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListIterator<Report> listIterator() {
|
||||
return reports.listIterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListIterator<Report> listIterator(int index) {
|
||||
return reports.listIterator(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Report> subList(int fromIndex, int toIndex) {
|
||||
return reports.subList(fromIndex, toIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (!reports.isEmpty()) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (Report report : reports) {
|
||||
builder.append("================================\n")
|
||||
.append(report.getTitle())
|
||||
.append("\n================================")
|
||||
.append("\n\n")
|
||||
.append(report.toString())
|
||||
.append("\n\n");
|
||||
}
|
||||
return builder.toString();
|
||||
} else {
|
||||
return "No reports.";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* WorldGuard, a suite of tools for Minecraft
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldGuard team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.util.report;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class ShallowObjectReport extends DataReport {
|
||||
|
||||
private static final Logger log = Logger.getLogger(ShallowObjectReport.class.getCanonicalName());
|
||||
|
||||
public ShallowObjectReport(String title, Object object) {
|
||||
super(title);
|
||||
checkNotNull(object, "object");
|
||||
|
||||
Class<?> type = object.getClass();
|
||||
|
||||
for (Field field : type.getDeclaredFields()) {
|
||||
if (Modifier.isStatic(field.getModifiers())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (field.getAnnotation(Unreported.class) != null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
field.setAccessible(true);
|
||||
try {
|
||||
Object value = field.get(object);
|
||||
append(field.getName(), String.valueOf(value));
|
||||
} catch (IllegalAccessException e) {
|
||||
log.log(Level.WARNING, "Failed to get value of '" + field.getName() + "' on " + type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
/*
|
||||
* WorldGuard, a suite of tools for Minecraft
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldGuard team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.util.report;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class StackTraceReport implements Report {
|
||||
|
||||
private final StackTraceElement[] stackTrace;
|
||||
|
||||
public StackTraceReport(StackTraceElement[] stackTrace) {
|
||||
checkNotNull(stackTrace, "stackTrace");
|
||||
this.stackTrace = stackTrace;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return "Stack Trace";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (stackTrace.length > 0) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
boolean first = true;
|
||||
for (StackTraceElement element : stackTrace) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
builder.append("\n");
|
||||
}
|
||||
builder.append(element.getClassName())
|
||||
.append(".")
|
||||
.append(element.getMethodName())
|
||||
.append("() (")
|
||||
.append(element.getFileName())
|
||||
.append(":")
|
||||
.append(element.getLineNumber())
|
||||
.append(")");
|
||||
}
|
||||
return builder.toString();
|
||||
} else {
|
||||
return "No stack trace available.";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
/*
|
||||
* WorldGuard, a suite of tools for Minecraft
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldGuard team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.util.report;
|
||||
|
||||
import java.lang.management.*;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class SystemInfoReport extends DataReport {
|
||||
|
||||
public SystemInfoReport() {
|
||||
super("System Information");
|
||||
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
RuntimeMXBean runtimeBean = ManagementFactory.getRuntimeMXBean();
|
||||
ClassLoadingMXBean classLoadingBean = ManagementFactory.getClassLoadingMXBean();
|
||||
List<GarbageCollectorMXBean> gcBeans = ManagementFactory.getGarbageCollectorMXBeans();
|
||||
OperatingSystemMXBean osBean = ManagementFactory.getOperatingSystemMXBean();
|
||||
ThreadMXBean threadBean = ManagementFactory.getThreadMXBean();
|
||||
|
||||
append("Java", "%s %s (%s)",
|
||||
System.getProperty("java.vendor"),
|
||||
System.getProperty("java.version"),
|
||||
System.getProperty("java.vendor.url"));
|
||||
append("Operating System", "%s %s (%s)",
|
||||
System.getProperty("os.name"),
|
||||
System.getProperty("os.version"),
|
||||
System.getProperty("os.arch"));
|
||||
append("Available Processors", runtime.availableProcessors());
|
||||
append("Free Memory", runtime.freeMemory() / 1024 / 1024 + " MB");
|
||||
append("Max Memory", runtime.maxMemory() / 1024 / 1024 + " MB");
|
||||
append("Total Memory", runtime.totalMemory() / 1024 / 1024 + " MB");
|
||||
append("System Load Average", osBean.getSystemLoadAverage());
|
||||
append("Java Uptime", TimeUnit.MINUTES.convert(runtimeBean.getUptime(), TimeUnit.MILLISECONDS) + " minutes");
|
||||
|
||||
DataReport startup = new DataReport("Startup");
|
||||
startup.append("Input Arguments", runtimeBean.getInputArguments());
|
||||
append(startup.getTitle(), startup);
|
||||
|
||||
DataReport vm = new DataReport("Virtual Machine");
|
||||
vm.append("Name", runtimeBean.getVmName());
|
||||
vm.append("Vendor", runtimeBean.getVmVendor());
|
||||
vm.append("Version", runtimeBean.getVmVendor());
|
||||
append(vm.getTitle(), vm);
|
||||
|
||||
DataReport spec = new DataReport("Specification");
|
||||
spec.append("Name", runtimeBean.getSpecName());
|
||||
spec.append("Vendor", runtimeBean.getSpecVendor());
|
||||
spec.append("Version", runtimeBean.getSpecVersion());
|
||||
append(spec.getTitle(), spec);
|
||||
|
||||
DataReport classLoader = new DataReport("Class Loader");
|
||||
classLoader.append("Loaded Class Count", classLoadingBean.getLoadedClassCount());
|
||||
classLoader.append("Total Loaded Class Count", classLoadingBean.getTotalLoadedClassCount());
|
||||
classLoader.append("Unloaded Class Count", classLoadingBean.getUnloadedClassCount());
|
||||
append(classLoader.getTitle(), classLoader);
|
||||
|
||||
DataReport gc = new DataReport("Garbage Collectors");
|
||||
for (GarbageCollectorMXBean bean : gcBeans) {
|
||||
DataReport thisGC = new DataReport(bean.getName());
|
||||
thisGC.append("Collection Count", bean.getCollectionCount());
|
||||
thisGC.append("Collection Time", bean.getCollectionTime() + "ms");
|
||||
gc.append(thisGC.getTitle(), thisGC);
|
||||
}
|
||||
append(gc.getTitle(), gc);
|
||||
|
||||
DataReport threads = new DataReport("Threads");
|
||||
for (ThreadInfo threadInfo : threadBean.dumpAllThreads(false, false)) {
|
||||
threads.append("#" + threadInfo.getThreadId() + " " + threadInfo.getThreadName(), threadInfo.getThreadState());
|
||||
}
|
||||
append(threads.getTitle(), threads);
|
||||
}
|
||||
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* WorldGuard, a suite of tools for Minecraft
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldGuard team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.util.report;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Annotates properties that should not be exposed in the report.
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface Unreported {
|
||||
}
|
@ -23,7 +23,7 @@
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldguard.config.YamlConfigurationManager;
|
||||
import com.sk89q.worldguard.util.report.Unreported;
|
||||
import com.sk89q.worldedit.util.report.Unreported;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
@ -22,6 +22,9 @@
|
||||
import com.sk89q.util.yaml.YAMLFormat;
|
||||
import com.sk89q.util.yaml.YAMLProcessor;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.report.Unreported;
|
||||
import com.sk89q.worldedit.world.entity.EntityType;
|
||||
import com.sk89q.worldedit.world.entity.EntityTypes;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.blacklist.Blacklist;
|
||||
@ -31,13 +34,11 @@
|
||||
import com.sk89q.worldguard.blacklist.logger.FileHandler;
|
||||
import com.sk89q.worldguard.blacklist.target.TargetMatcherParseException;
|
||||
import com.sk89q.worldguard.blacklist.target.TargetMatcherParser;
|
||||
import com.sk89q.worldguard.chest.ChestProtection;
|
||||
import com.sk89q.worldguard.bukkit.chest.BukkitSignChestProtection;
|
||||
import com.sk89q.worldguard.bukkit.commands.CommandUtils;
|
||||
import com.sk89q.worldguard.bukkit.internal.TargetMatcherSet;
|
||||
import com.sk89q.worldguard.chest.ChestProtection;
|
||||
import com.sk89q.worldguard.config.YamlWorldConfiguration;
|
||||
import com.sk89q.worldguard.util.report.Unreported;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.yaml.snakeyaml.parser.ParserException;
|
||||
@ -49,7 +50,6 @@
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@ -70,108 +70,9 @@ public class BukkitWorldConfiguration extends YamlWorldConfiguration {
|
||||
@Unreported private ChestProtection chestProtection = new BukkitSignChestProtection();
|
||||
|
||||
/* Configuration data start */
|
||||
public boolean summaryOnStart;
|
||||
public boolean opPermissions;
|
||||
public boolean buildPermissions;
|
||||
public String buildPermissionDenyMessage = "";
|
||||
public boolean fireSpreadDisableToggle;
|
||||
public boolean itemDurability;
|
||||
public boolean disableExpDrops;
|
||||
public Set<PotionEffectType> blockPotions;
|
||||
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 boolean useiConomy;
|
||||
// public boolean buyOnClaim;
|
||||
// public double buyOnClaimPrice;
|
||||
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 TargetMatcherSet allowAllInteract;
|
||||
public boolean ignoreHopperMoveEvents;
|
||||
public TargetMatcherSet blockUseAtFeet;
|
||||
private Map<String, Integer> maxRegionCounts;
|
||||
|
||||
/* Configuration data end */
|
||||
|
||||
/**
|
||||
@ -381,12 +282,10 @@ public void loadConfiguration() {
|
||||
|
||||
blockCreatureSpawn = new HashSet<>();
|
||||
for (String creatureName : getStringList("mobs.block-creature-spawn", null)) {
|
||||
EntityType creature = EntityType.fromName(creatureName);
|
||||
EntityType creature = EntityTypes.get(creatureName.toLowerCase());
|
||||
|
||||
if (creature == null) {
|
||||
log.warning("Unknown mob type '" + creatureName + "'");
|
||||
} else if (!creature.isAlive()) {
|
||||
log.warning("Entity type '" + creatureName + "' is not a creature");
|
||||
log.warning("Unknown entity type '" + creatureName + "'");
|
||||
} else {
|
||||
blockCreatureSpawn.add(creature);
|
||||
}
|
||||
|
@ -19,35 +19,42 @@
|
||||
|
||||
package com.sk89q.worldguard.bukkit.commands;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.io.Files;
|
||||
import com.google.common.util.concurrent.FutureCallback;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import com.sk89q.minecraft.util.commands.*;
|
||||
import com.sk89q.minecraft.util.commands.Command;
|
||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||
import com.sk89q.minecraft.util.commands.CommandException;
|
||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||
import com.sk89q.minecraft.util.commands.NestedCommand;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.util.report.ReportList;
|
||||
import com.sk89q.worldedit.util.report.SystemInfoReport;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.config.ConfigurationManager;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.bukkit.util.logging.LoggerToChatHandler;
|
||||
import com.sk89q.worldguard.bukkit.util.report.*;
|
||||
import com.sk89q.worldguard.bukkit.util.report.PerformanceReport;
|
||||
import com.sk89q.worldguard.bukkit.util.report.PluginReport;
|
||||
import com.sk89q.worldguard.bukkit.util.report.SchedulerReport;
|
||||
import com.sk89q.worldguard.bukkit.util.report.ServerReport;
|
||||
import com.sk89q.worldguard.bukkit.util.report.ServicesReport;
|
||||
import com.sk89q.worldguard.bukkit.util.report.WorldReport;
|
||||
import com.sk89q.worldguard.config.ConfigurationManager;
|
||||
import com.sk89q.worldguard.util.profiler.SamplerBuilder;
|
||||
import com.sk89q.worldguard.util.profiler.SamplerBuilder.Sampler;
|
||||
import com.sk89q.worldguard.util.profiler.ThreadIdFilter;
|
||||
import com.sk89q.worldguard.util.profiler.ThreadNameFilter;
|
||||
import com.sk89q.worldguard.util.report.ReportList;
|
||||
import com.sk89q.worldguard.util.report.SystemInfoReport;
|
||||
import com.sk89q.worldguard.util.report.ConfigReport;
|
||||
import com.sk89q.worldguard.util.task.Task;
|
||||
import com.sk89q.worldguard.util.task.TaskStateComparator;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.management.ThreadInfo;
|
||||
@ -55,9 +62,12 @@
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class WorldGuardCommands {
|
||||
|
||||
private static final Logger log = Logger.getLogger(WorldGuardCommands.class.getCanonicalName());
|
||||
@ -128,7 +138,7 @@ public void report(CommandContext args, final CommandSender sender) throws Comma
|
||||
report.add(new ServicesReport());
|
||||
report.add(new WorldReport());
|
||||
report.add(new PerformanceReport());
|
||||
report.add(new ConfigReport(plugin));
|
||||
report.add(new ConfigReport());
|
||||
String result = report.toString();
|
||||
|
||||
try {
|
||||
@ -164,7 +174,7 @@ public void profile(final CommandContext args, final CommandSender sender) throw
|
||||
if (threadName == null) {
|
||||
threadFilter = new ThreadIdFilter(Thread.currentThread().getId());
|
||||
} else if (threadName.equals("*")) {
|
||||
threadFilter = Predicates.alwaysTrue();
|
||||
threadFilter = thread -> true;
|
||||
} else {
|
||||
threadFilter = new ThreadNameFilter(threadName);
|
||||
}
|
||||
|
@ -477,7 +477,7 @@ public void onDamageEntity(DamageEntityEvent event) {
|
||||
Player defender = (Player) event.getEntity();
|
||||
|
||||
// if defender is an NPC
|
||||
if (defender.hasMetadata("NPC")) {
|
||||
if (Entities.isNPC(defender)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
||||
|
||||
import com.sk89q.worldguard.bukkit.event.debug.CancelAttempt;
|
||||
import com.sk89q.worldguard.bukkit.util.HandlerTracer;
|
||||
import com.sk89q.worldguard.util.report.Report;
|
||||
import com.sk89q.worldguard.util.report.StackTraceReport;
|
||||
import com.sk89q.worldedit.util.report.Report;
|
||||
import com.sk89q.worldedit.util.report.StackTraceReport;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
@ -20,7 +20,7 @@
|
||||
package com.sk89q.worldguard.bukkit.util.report;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.sk89q.worldguard.util.report.DataReport;
|
||||
import com.sk89q.worldedit.util.report.DataReport;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
package com.sk89q.worldguard.bukkit.util.report;
|
||||
|
||||
import com.sk89q.worldguard.util.report.DataReport;
|
||||
import com.sk89q.worldedit.util.report.DataReport;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
|
@ -19,18 +19,18 @@
|
||||
|
||||
package com.sk89q.worldguard.bukkit.util.report;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.sk89q.worldguard.util.report.DataReport;
|
||||
import com.sk89q.worldedit.util.report.DataReport;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
public class SchedulerReport extends DataReport {
|
||||
@ -42,9 +42,9 @@ public Optional<Field> load(Class<?> clazz) throws Exception {
|
||||
try {
|
||||
Field field = clazz.getDeclaredField("task");
|
||||
field.setAccessible(true);
|
||||
return Optional.fromNullable(field);
|
||||
return Optional.ofNullable(field);
|
||||
} catch (NoSuchFieldException ignored) {
|
||||
return Optional.absent();
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -81,8 +81,7 @@ private Class<?> getTaskClass(BukkitTask task) {
|
||||
return res == null ? null : res.getClass();
|
||||
}
|
||||
}
|
||||
} catch (IllegalAccessException ignored) {
|
||||
} catch (NoClassDefFoundError ignored) {
|
||||
} catch (IllegalAccessException | NoClassDefFoundError ignored) {
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
package com.sk89q.worldguard.bukkit.util.report;
|
||||
|
||||
import com.sk89q.worldguard.util.report.DataReport;
|
||||
import com.sk89q.worldedit.util.report.DataReport;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Server;
|
||||
|
||||
|
@ -19,13 +19,11 @@
|
||||
|
||||
package com.sk89q.worldguard.bukkit.util.report;
|
||||
|
||||
import com.sk89q.worldguard.util.report.DataReport;
|
||||
import com.sk89q.worldedit.util.report.DataReport;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.ServicesManager;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class ServicesReport extends DataReport {
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
package com.sk89q.worldguard.bukkit.util.report;
|
||||
|
||||
import com.sk89q.worldguard.util.report.DataReport;
|
||||
import com.sk89q.worldedit.util.report.DataReport;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
|
Loading…
Reference in New Issue
Block a user