fabric-1.18: get rid of all Eclipse warnings

This commit is contained in:
Kosma Moczek 2021-11-26 14:52:50 +01:00
parent 3d95f9250a
commit 038f9c7085
4 changed files with 10 additions and 45 deletions

View File

@ -130,6 +130,7 @@ public class ChunkSnapshot {
}
public static class StateListException extends Exception {
private static final long serialVersionUID = 1L;
private static boolean loggedOnce = false;
public StateListException(int x, int z, int actualLength, int expectedLength, int expectedLegacyLength) {

View File

@ -21,6 +21,7 @@ import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayNetworkHandler;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ChunkHolder;
import net.minecraft.server.world.ServerChunkManager;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.Identifier;
import net.minecraft.util.collection.IdList;
@ -39,7 +40,6 @@ import org.dynmap.common.BiomeMap;
import org.dynmap.common.DynmapCommandSender;
import org.dynmap.common.DynmapListenerManager;
import org.dynmap.common.DynmapPlayer;
import org.dynmap.fabric_1_18.DynmapPlugin.ChatMessage;
import org.dynmap.fabric_1_18.command.DmapCommand;
import org.dynmap.fabric_1_18.command.DmarkerCommand;
import org.dynmap.fabric_1_18.command.DynmapCommand;
@ -76,14 +76,10 @@ public class DynmapPlugin {
public static DynmapPlugin plugin;
ChatHandler chathandler;
private HashMap<String, Integer> sortWeights = new HashMap<String, Integer>();
// Drop world load ticket after 30 seconds
private long worldIdleTimeoutNS = 30 * 1000000000L;
private HashMap<String, FabricWorld> worlds = new HashMap<String, FabricWorld>();
private WorldAccess last_world;
private FabricWorld last_fworld;
private Map<String, FabricPlayer> players = new HashMap<String, FabricPlayer>();
//TODO private ForgeMetrics metrics;
private HashSet<String> modsused = new HashSet<String>();
private FabricServer fserver;
private boolean tickregistered = false;
// TPS calculator
@ -94,9 +90,6 @@ public class DynmapPlugin {
long perTickLimit = (50000000); // 50 ms
private boolean useSaveFolder = true;
private static final int SIGNPOST_ID = 63;
private static final int WALLSIGN_ID = 68;
private static final String[] TRIGGER_DEFAULTS = {"blockupdate", "chunkpopulate", "chunkgenerate"};
static final Pattern patternControlCode = Pattern.compile("(?i)\\u00A7[0-9A-FK-OR]");
@ -133,7 +126,6 @@ public class DynmapPlugin {
public static DynmapBlockState[] stateByID;
private Map<String, LongOpenHashSet> knownloadedchunks = new HashMap<String, LongOpenHashSet>();
private boolean didInitialKnownChunks = false;
private void addKnownChunk(FabricWorld fw, ChunkPos pos) {
LongOpenHashSet cset = knownloadedchunks.get(fw.getName());
@ -227,10 +219,10 @@ public class DynmapPlugin {
}
}
}
for (int gidx = 0; gidx < DynmapBlockState.getGlobalIndexMax(); gidx++) {
DynmapBlockState bs = DynmapBlockState.getStateByGlobalIndex(gidx);
//Log.info(gidx + ":" + bs.toString() + ", gidx=" + bs.globalStateIndex + ", sidx=" + bs.stateIndex);
}
// for (int gidx = 0; gidx < DynmapBlockState.getGlobalIndexMax(); gidx++) {
// DynmapBlockState bs = DynmapBlockState.getStateByGlobalIndex(gidx);
// Log.info(gidx + ":" + bs.toString() + ", gidx=" + bs.globalStateIndex + ", sidx=" + bs.stateIndex);
// }
}
public static final Item getItemByID(int id) {
@ -512,17 +504,6 @@ public class DynmapPlugin {
/* Load saved world definitions */
loadWorlds();
/* Initialized the currently loaded worlds */
if (server.getWorlds() != null) {
for (ServerWorld world : server.getWorlds()) {
FabricWorld w = this.getWorld(world);
/*NOTYET - need rest of forge
if(DimensionManager.getWorld(world.provider.getDimensionId()) == null) { // If not loaded
w.setWorldUnloaded();
}
*/
}
}
for (FabricWorld w : worlds.values()) {
if (core.processWorldLoad(w)) { /* Have core process load first - fire event listeners if good load after */
if (w.isLoaded()) {
@ -779,9 +760,9 @@ public class DynmapPlugin {
for (ServerWorld world : server.getWorlds()) {
FabricWorld fw = getWorld(world);
if (fw == null) continue;
Long2ObjectLinkedOpenHashMap<ChunkHolder> chunks = ((ThreadedAnvilChunkStorageAccessor) world.getChunkManager().threadedAnvilChunkStorage).getChunkHolders();
ServerChunkManager chunkManager = world.getChunkManager();
Long2ObjectLinkedOpenHashMap<ChunkHolder> chunks = ((ThreadedAnvilChunkStorageAccessor) chunkManager.threadedAnvilChunkStorage).getChunkHolders();
for (Map.Entry<Long, ChunkHolder> k : chunks.long2ObjectEntrySet()) {
long key = k.getKey();
ChunkHolder ch = k.getValue();
Chunk c = null;
try {

View File

@ -28,17 +28,11 @@ import java.util.*;
* Container for managing chunks - dependent upon using chunk snapshots, since rendering is off server thread
*/
public class FabricMapChunkCache extends MapChunkCache {
private final DynmapPlugin plugin;
private static boolean init = false;
private static Field updateEntityTick = null;
/* ChunkManager fields */
private static Field chunksToRemove = null; // Map
/* ChunjManager Pending fields */
private static Field chunkCoord = null;
private static Field nbtTag = null;
private World w;
private DynmapWorld dw;
private ServerChunkManager cps;
@ -74,8 +68,6 @@ public class FabricMapChunkCache extends MapChunkCache {
* Construct empty cache
*/
public FabricMapChunkCache(DynmapPlugin plugin) {
this.plugin = plugin;
Registry<Biome> biomeRegistry = plugin.getFabricServer().getBiomeRegistry();
Biome b[] = plugin.getFabricServer().getBiomeList(biomeRegistry);
BiomeMap[] bm = BiomeMap.values();
@ -881,8 +873,6 @@ public class FabricMapChunkCache extends MapChunkCache {
}
private static boolean didError = false;
public NbtCompound readChunk(int x, int z) {
try {
ThreadedAnvilChunkStorage acl = cps.threadedAnvilChunkStorage;

View File

@ -38,8 +38,6 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
/**
@ -203,7 +201,7 @@ public class FabricServer extends DynmapServerInterface {
@Override
public String stripChatColor(String s) {
return plugin.patternControlCode.matcher(s).replaceAll("");
return DynmapPlugin.patternControlCode.matcher(s).replaceAll("");
}
private Set<DynmapListenerManager.EventType> registered = new HashSet<DynmapListenerManager.EventType>();
@ -416,7 +414,7 @@ public class FabricServer extends DynmapServerInterface {
Future<Boolean> f = this.callSyncMethod(new Callable<Boolean>() {
public Boolean call() throws Exception {
// Update busy state on world
FabricWorld fw = (FabricWorld) cc.getWorld();
//FabricWorld fw = (FabricWorld) cc.getWorld();
//TODO
//setBusy(fw.getWorld());
cc.getLoadedChunks();
@ -521,11 +519,6 @@ public class FabricServer extends DynmapServerInterface {
}
}
private <T> Predicate<T> distinctByKeyAndNonNull(Function<? super T, ?> keyExtractor) {
Set<Object> seen = ConcurrentHashMap.newKeySet();
return t -> t != null && seen.add(keyExtractor.apply(t));
}
private Optional<ModContainer> getModContainerById(String id) {
return FabricLoader.getInstance().getModContainer(id);
}