misc changes.

This commit is contained in:
MattBDev
2019-11-11 16:02:28 -05:00
parent 7aa0d9c122
commit a23a4e5496
71 changed files with 676 additions and 673 deletions

View File

@ -2,9 +2,9 @@ package com.boydti.fawe.bukkit;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.IFawe;
import com.boydti.fawe.beta.implementation.queue.QueueHandler;
import com.boydti.fawe.beta.implementation.cache.preloader.AsyncPreloader;
import com.boydti.fawe.beta.implementation.cache.preloader.Preloader;
import com.boydti.fawe.beta.implementation.queue.QueueHandler;
import com.boydti.fawe.bukkit.adapter.BukkitQueueHandler;
import com.boydti.fawe.bukkit.listener.BrushListener;
import com.boydti.fawe.bukkit.listener.BukkitImageListener;
@ -54,9 +54,13 @@ import org.bukkit.event.world.WorldLoadEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class FaweBukkit implements IFawe, Listener {
private static final Logger log = LoggerFactory.getLogger(FaweBukkit.class);
private final Plugin plugin;
private VaultUtil vault;
private ItemUtil itemUtil;
@ -78,9 +82,7 @@ public class FaweBukkit implements IFawe, Listener {
try {
new BrushListener(plugin);
} catch (Throwable e) {
debug("====== BRUSH LISTENER FAILED ======");
e.printStackTrace();
debug("===================================");
log.debug("Brush Listener Failed", e);
}
if (PaperLib.isPaper() && Settings.IMP.EXPERIMENTAL.DYNAMIC_CHUNK_RENDERING > 1) {
new RenderListener(plugin);
@ -220,9 +222,7 @@ public class FaweBukkit implements IFawe, Listener {
this.itemUtil = tmp = new ItemUtil();
} catch (Throwable e) {
Settings.IMP.EXPERIMENTAL.PERSISTENT_BRUSHES = false;
debug("===== PERSISTENT BRUSH FAILED =====");
e.printStackTrace();
debug("===================================");
log.debug("Persistent Brushes Failed", e);
}
}
return tmp;
@ -230,13 +230,12 @@ public class FaweBukkit implements IFawe, Listener {
/**
* Vault isn't required, but used for setting player permissions (WorldEdit bypass)
* @return
*/
@Override
public void setupVault() {
try {
this.vault = new VaultUtil();
} catch (final Throwable e) {
} catch (final Throwable ignored) {
}
}
@ -270,7 +269,7 @@ public class FaweBukkit implements IFawe, Listener {
}
/**
* A mask manager handles region restrictions e.g. PlotSquared plots / WorldGuard regions
* A mask manager handles region restrictions e.g., PlotSquared plots / WorldGuard regions
*/
@Override
public Collection<FaweMaskManager> getMaskManagers() {
@ -280,7 +279,7 @@ public class FaweBukkit implements IFawe, Listener {
try {
managers.add(new Worldguard(worldguardPlugin));
managers.add(new WorldguardFlag(worldguardPlugin));
Fawe.debug("Attempting to use plugin 'WorldGuard'");
log.debug("Attempting to use plugin 'WorldGuard'");
} catch (Throwable ignored) {
}
}
@ -288,7 +287,7 @@ public class FaweBukkit implements IFawe, Listener {
if (townyPlugin != null && townyPlugin.isEnabled()) {
try {
managers.add(new TownyFeature(townyPlugin));
Fawe.debug("Attempting to use plugin 'Towny'");
log.debug("Attempting to use plugin 'Towny'");
} catch (Throwable ignored) {
}
}
@ -296,11 +295,11 @@ public class FaweBukkit implements IFawe, Listener {
if (factionsPlugin != null && factionsPlugin.isEnabled()) {
try {
managers.add(new FactionsFeature(factionsPlugin));
Fawe.debug("Attempting to use plugin 'Factions'");
log.debug("Attempting to use plugin 'Factions'");
} catch (Throwable e) {
try {
managers.add(new FactionsUUIDFeature(factionsPlugin, this));
Fawe.debug("Attempting to use plugin 'FactionsUUID'");
log.debug("Attempting to use plugin 'FactionsUUID'");
} catch (Throwable ignored) {
}
}
@ -309,7 +308,7 @@ public class FaweBukkit implements IFawe, Listener {
if (residencePlugin != null && residencePlugin.isEnabled()) {
try {
managers.add(new ResidenceFeature(residencePlugin, this));
Fawe.debug("Attempting to use plugin 'Residence'");
log.debug("Attempting to use plugin 'Residence'");
} catch (Throwable ignored) {
}
}
@ -317,7 +316,7 @@ public class FaweBukkit implements IFawe, Listener {
if (griefpreventionPlugin != null && griefpreventionPlugin.isEnabled()) {
try {
managers.add(new GriefPreventionFeature(griefpreventionPlugin));
Fawe.debug("Attempting to use plugin 'GriefPrevention'");
log.debug("Attempting to use plugin 'GriefPrevention'");
} catch (Throwable ignored) {
}
}
@ -326,7 +325,7 @@ public class FaweBukkit implements IFawe, Listener {
if (aSkyBlock != null && aSkyBlock.isEnabled()) {
try {
managers.add(new ASkyBlockHook(aSkyBlock));
Fawe.debug("Attempting to use plugin 'ASkyBlock' found. Using it now.");
log.debug("Attempting to use plugin 'ASkyBlock' found. Using it now.");
} catch (Throwable e) {
e.printStackTrace();
}
@ -334,7 +333,7 @@ public class FaweBukkit implements IFawe, Listener {
if (Settings.IMP.EXPERIMENTAL.FREEBUILD) {
try {
managers.add(new FreeBuildRegion());
Fawe.debug("Attempting to use plugin '<internal.freebuild>'");
log.debug("Attempting to use plugin '<internal.freebuild>'");
} catch (Throwable ignored) {
}
}

View File

@ -1,9 +1,9 @@
package com.boydti.fawe.bukkit.adapter;
import com.boydti.fawe.Fawe;
import static org.slf4j.LoggerFactory.getLogger;
import com.boydti.fawe.beta.implementation.queue.QueueHandler;
import com.boydti.fawe.bukkit.listener.ChunkListener;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
@ -40,7 +40,7 @@ public class BukkitQueueHandler extends QueueHandler {
if (timingsEnabled) {
if (alertTimingsChange) {
alertTimingsChange = false;
Fawe.debug("Having `parallel-threads` > 1 interferes with the timings.");
getLogger(BukkitQueueHandler.class).debug("Having `parallel-threads` > 1 interferes with the timings.");
}
fieldTimingsEnabled.set(null, false);
methodCheck.invoke(null);
@ -69,4 +69,4 @@ public class BukkitQueueHandler extends QueueHandler {
}
}
}
}
}

View File

@ -1,10 +1,12 @@
package com.boydti.fawe.bukkit.adapter.mc1_14;
import static org.slf4j.LoggerFactory.getLogger;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.IChunkSet;
import com.boydti.fawe.beta.implementation.queue.QueueHandler;
import com.boydti.fawe.beta.implementation.blocks.CharGetBlocks;
import com.boydti.fawe.beta.implementation.queue.QueueHandler;
import com.boydti.fawe.bukkit.adapter.DelegateLock;
import com.boydti.fawe.object.collection.AdaptedMap;
import com.boydti.fawe.object.collection.BitArray4096;
@ -22,6 +24,19 @@ import com.sk89q.worldedit.internal.Constants;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockTypes;
import java.util.AbstractSet;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.function.Function;
import javax.annotation.Nullable;
import net.minecraft.server.v1_14_R1.BiomeBase;
import net.minecraft.server.v1_14_R1.BlockPosition;
import net.minecraft.server.v1_14_R1.Chunk;
@ -45,12 +60,6 @@ import org.bukkit.craftbukkit.v1_14_R1.block.CraftBlock;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable;
import java.util.*;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.function.Function;
public class BukkitGetBlocks_1_14 extends CharGetBlocks {
public ChunkSection[] sections;
public Chunk nmsChunk;
@ -363,7 +372,7 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
final ListTag posTag = (ListTag) entityTagMap.get("Pos");
final ListTag rotTag = (ListTag) entityTagMap.get("Rotation");
if (idTag == null || posTag == null || rotTag == null) {
Fawe.debug("Unknown entity tag: " + nativeTag);
getLogger(BukkitGetBlocks_1_14.class).debug("Unknown entity tag: " + nativeTag);
continue;
}
final double x = posTag.getDouble(0);

View File

@ -19,7 +19,8 @@
package com.boydti.fawe.bukkit.adapter.mc1_14;
import com.boydti.fawe.Fawe;
import static com.google.common.base.Preconditions.checkNotNull;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
import com.google.common.cache.CacheBuilder;
@ -67,6 +68,20 @@ import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.block.BlockTypesCache;
import com.sk89q.worldedit.world.entity.EntityType;
import com.sk89q.worldedit.world.registry.BlockMaterial;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.OptionalInt;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import net.minecraft.server.v1_14_R1.Block;
import net.minecraft.server.v1_14_R1.BlockPosition;
import net.minecraft.server.v1_14_R1.BlockStateBoolean;
@ -130,23 +145,6 @@ import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.OptionalInt;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.google.common.base.Preconditions.checkNotNull;
public final class Spigot_v1_14_R4 extends CachedBukkitAdapter implements BukkitImplAdapter<NBTBase>{
private final Logger logger = LoggerFactory.getLogger(getClass());
@ -197,7 +195,7 @@ public final class Spigot_v1_14_R4 extends CachedBukkitAdapter implements Bukkit
try {
tileEntity.load(tag);
} catch (Throwable e) {
Fawe.debug("Invalid tag " + tag + " | " + tileEntity);
//Fawe.debug("Invalid tag " + tag + " | " + tileEntity);
}
}
@ -419,7 +417,7 @@ public final class Spigot_v1_14_R4 extends CachedBukkitAdapter implements Bukkit
worldServer.addEntity(createdEntity, SpawnReason.CUSTOM);
return createdEntity.getBukkitEntity();
} else {
Fawe.debug("Invalid entity " + state.getType().getId());
logger.debug("Invalid entity " + state.getType().getId());
return null;
}
}

View File

@ -1,8 +1,8 @@
package com.boydti.fawe.bukkit.filter;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.slf4j.LoggerFactory.getLogger;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.object.RunnableVal;
import com.boydti.fawe.regions.general.CuboidRegionFilter;
@ -34,7 +34,7 @@ public class WorldGuardFilter extends CuboidRegionFilter {
BlockVector3 min = region.getMinimumPoint();
BlockVector3 max = region.getMaximumPoint();
if (max.getBlockX() - min.getBlockX() > 1024 || max.getBlockZ() - min.getBlockZ() > 1024) {
Fawe.debug("Large or complex region shapes cannot be optimized. Filtering will be slower");
getLogger(WorldGuardFilter.class).debug("Large or complex region shapes cannot be optimized. Filtering will be slower");
large = true;
break;
}

View File

@ -1,5 +1,7 @@
package com.boydti.fawe.bukkit.listener;
import static org.slf4j.LoggerFactory.getLogger;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.bukkit.FaweBukkit;
import com.boydti.fawe.config.Settings;
@ -61,7 +63,7 @@ public abstract class ChunkListener implements Listener {
TaskManager.IMP.repeat(() -> {
Location tmpLoc = lastCancelPos;
if (tmpLoc != null) {
Fawe.debug("[FAWE `tick-limiter`] Detected and cancelled physics lag source at "
getLogger(ChunkListener.class).debug("[FAWE `tick-limiter`] Detected and cancelled physics lag source at "
+ tmpLoc);
}
rateLimit--;
@ -351,7 +353,6 @@ public abstract class ChunkListener implements Listener {
lastCancelPos = block.getLocation();
}
event.setCancelled(true);
return;
} else {
count[1] = 0;
}
@ -391,7 +392,7 @@ public abstract class ChunkListener implements Listener {
double vertical = Math.abs(velocity.getY());
if (Math.abs(velocity.getX()) > vertical
|| Math.abs(velocity.getZ()) > vertical) {
Fawe.debug(
getLogger(ChunkListener.class).warn(
"[FAWE `tick-limiter`] Detected and cancelled rogue FireWork at "
+ ent.getLocation());
ent.remove();
@ -422,11 +423,10 @@ public abstract class ChunkListener implements Listener {
cancelNearby(cx, cz);
if (rateLimit <= 0) {
rateLimit = 20;
Fawe.debug(
getLogger(ChunkListener.class).warn(
"[FAWE `tick-limiter`] Detected and cancelled item lag source at " + loc);
}
event.setCancelled(true);
return;
}
}
}

View File

@ -125,9 +125,9 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
@Override
public boolean add(Plugin plugin) {
if (plugin.getName().startsWith("AsyncWorldEdit")) {
Fawe.debug("Disabling `" + plugin.getName() + "` as it is incompatible");
log.debug("Disabling `" + plugin.getName() + "` as it is incompatible");
} else if (plugin.getName().startsWith("BetterShutdown")) {
Fawe.debug("Disabling `" + plugin.getName() + "` as it is incompatible (Improperly shaded classes from com.sk89q.minecraft.util.commands)");
log.debug("Disabling `" + plugin.getName() + "` as it is incompatible (Improperly shaded classes from com.sk89q.minecraft.util.commands)");
} else {
return super.add(plugin);
}