Add toString to messages & fix incorrect call
This commit is contained in:
@@ -204,12 +204,6 @@ public class DhClientLevel extends AbstractDhLevel implements IDhClientLevel
|
||||
|
||||
if (this.worldGenModule.isWorldGenRunning())
|
||||
{
|
||||
ClientLevelModule.ClientRenderState renderState = this.clientside.ClientRenderStateRef.get();
|
||||
if (renderState != null && renderState.quadtree != null)
|
||||
{
|
||||
this.dataFileHandler.removeRetrievalRequestIf(p -> !renderState.quadtree.isSectionPosInBounds(p));
|
||||
}
|
||||
|
||||
this.worldGenModule.worldGenTick(
|
||||
new DhBlockPos2D(MC_CLIENT.getPlayerBlockPos())
|
||||
.scale(MC_CLIENT.getWrappedClientLevel().getDimensionType().getTeleportationScale(this.getLevelWrapper().getDimensionType()))
|
||||
|
||||
+8
-15
@@ -56,8 +56,6 @@ public abstract class AbstractFullDataRequestQueue implements IDebugRenderable,
|
||||
private final AtomicInteger failedRequests = new AtomicInteger();
|
||||
private final ConfigEntry<Boolean> showDebugWireframeConfig;
|
||||
|
||||
private final Set<Long> alreadyRequestedPositions = ConcurrentHashMap.newKeySet();
|
||||
|
||||
private final SupplierBasedRateLimiter<Void> rateLimiter = new SupplierBasedRateLimiter<>(this::getRequestConcurrencyLimit);
|
||||
|
||||
private final ScheduledExecutorService taskFinishScheduler = Executors.newScheduledThreadPool(1);
|
||||
@@ -90,15 +88,6 @@ public abstract class AbstractFullDataRequestQueue implements IDebugRenderable,
|
||||
{
|
||||
LodUtil.assertTrue(DhSectionPos.getDetailLevel(sectionPos) == DhSectionPos.SECTION_MINIMUM_DETAIL_LEVEL, "Only highest-detail sections are allowed.");
|
||||
|
||||
// check if this is a duplicate task
|
||||
if (this.alreadyRequestedPositions.contains(sectionPos))
|
||||
{
|
||||
// temporary solution to prevent requesting the same section multiple times
|
||||
LOGGER.debug("Duplicate section " + sectionPos + ". Skipping...");
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
this.alreadyRequestedPositions.add(sectionPos);
|
||||
|
||||
RequestQueueEntry entry = new RequestQueueEntry(chunkDataConsumer, clientTimestamp);
|
||||
this.waitingTasks.put(sectionPos, entry);
|
||||
return entry.future;
|
||||
@@ -141,12 +130,13 @@ public abstract class AbstractFullDataRequestQueue implements IDebugRenderable,
|
||||
|
||||
if (removeIf.accept(pos))
|
||||
{
|
||||
LOGGER.debug("Removing request " + mapEntry.getKey() + "...");
|
||||
|
||||
entry.future.cancel(false);
|
||||
if (entry.request != null)
|
||||
{
|
||||
entry.request.cancel(false);
|
||||
}
|
||||
this.alreadyRequestedPositions.remove(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -183,7 +173,10 @@ public abstract class AbstractFullDataRequestQueue implements IDebugRenderable,
|
||||
long sectionPos = mapEntry.getKey();
|
||||
RequestQueueEntry entry = mapEntry.getValue();
|
||||
|
||||
CompletableFuture<FullDataSourceResponseMessage> request = this.networkState.getSession().sendRequest(new FullDataSourceRequestMessage(this.level.getLevelWrapper(), sectionPos, entry.updateTimestamp), FullDataSourceResponseMessage.class);
|
||||
CompletableFuture<FullDataSourceResponseMessage> request = this.networkState.getSession().sendRequest(
|
||||
new FullDataSourceRequestMessage(this.level.getLevelWrapper(), sectionPos, entry.updateTimestamp),
|
||||
FullDataSourceResponseMessage.class
|
||||
);
|
||||
entry.request = request;
|
||||
request.handleAsync((response, throwable) ->
|
||||
{
|
||||
@@ -192,13 +185,13 @@ public abstract class AbstractFullDataRequestQueue implements IDebugRenderable,
|
||||
|
||||
try
|
||||
{
|
||||
this.waitingTasks.remove(sectionPos);
|
||||
|
||||
if (throwable != null)
|
||||
{
|
||||
throw throwable;
|
||||
}
|
||||
|
||||
this.waitingTasks.remove(sectionPos);
|
||||
|
||||
if (response.dataSourceDto != null)
|
||||
{
|
||||
FullDataSourceV2 fullDataSource = response.dataSourceDto.createPooledDataSource(this.level.getLevelWrapper());
|
||||
|
||||
+16
@@ -1,5 +1,6 @@
|
||||
package com.seibel.distanthorizons.core.multiplayer.config;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.seibel.distanthorizons.core.network.protocol.INetworkObject;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
@@ -25,4 +26,19 @@ public abstract class AbstractMultiplayerConfig implements INetworkObject
|
||||
out.writeInt(this.getLoginDataSyncRCLimit());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return MoreObjects.toStringHelper(this)
|
||||
.add("renderDistanceRadius", this.getRenderDistanceRadius())
|
||||
.add("distantGenerationEnabled", this.isDistantGenerationEnabled())
|
||||
.add("fullDataRequestConcurrencyLimit", this.getFullDataRequestConcurrencyLimit())
|
||||
.add("genTaskPriorityRequestRateLimit", this.getGenTaskPriorityRequestRateLimit())
|
||||
.add("realTimeUpdatesEnabled", this.isRealTimeUpdatesEnabled())
|
||||
.add("loginDataSyncEnabled", this.isLoginDataSyncEnabled())
|
||||
.add("loginDataSyncRCLimit", this.getLoginDataSyncRCLimit())
|
||||
.toString();
|
||||
}
|
||||
|
||||
}
|
||||
-14
@@ -41,18 +41,4 @@ public class MultiplayerConfig extends AbstractMultiplayerConfig
|
||||
this.loginDataSyncRCLimit = in.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "MultiplayerConfig{" +
|
||||
"renderDistanceRadius=" + this.renderDistanceRadius +
|
||||
", distantGenerationEnabled=" + this.distantGenerationEnabled +
|
||||
", fullDataRequestConcurrencyLimit=" + this.fullDataRequestConcurrencyLimit +
|
||||
", genTaskPriorityRequestRateLimit=" + this.genTaskPriorityRequestRateLimit +
|
||||
", realTimeUpdatesEnabled=" + this.realTimeUpdatesEnabled +
|
||||
", loginDataSyncEnabled=" + this.loginDataSyncEnabled +
|
||||
", loginDataSyncRCLimit=" + this.loginDataSyncRCLimit +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
||||
+11
-1
@@ -1,5 +1,6 @@
|
||||
package com.seibel.distanthorizons.core.network.messages.plugin;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.seibel.distanthorizons.core.network.plugin.PluginChannelMessage;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
@@ -29,4 +30,13 @@ public class CurrentLevelKeyMessage extends PluginChannelMessage
|
||||
this.deleteExistingData = in.readBoolean();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public MoreObjects.ToStringHelper toStringHelper()
|
||||
{
|
||||
return super.toStringHelper()
|
||||
.add("levelKey", this.levelKey)
|
||||
.add("deleteExistingData", this.deleteExistingData);
|
||||
}
|
||||
|
||||
}
|
||||
+9
@@ -19,6 +19,7 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.network.messages.plugin.base;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.seibel.distanthorizons.core.network.plugin.PluginChannelMessage;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
@@ -38,4 +39,12 @@ public class CloseReasonMessage extends PluginChannelMessage
|
||||
@Override
|
||||
public void decode(ByteBuf in) { this.reason = this.readString(in); }
|
||||
|
||||
|
||||
@Override
|
||||
public MoreObjects.ToStringHelper toStringHelper()
|
||||
{
|
||||
return super.toStringHelper()
|
||||
.add("reason", this.reason);
|
||||
}
|
||||
|
||||
}
|
||||
+9
@@ -19,6 +19,7 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.network.messages.plugin.base;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.seibel.distanthorizons.core.network.exceptions.InvalidLevelException;
|
||||
import com.seibel.distanthorizons.core.network.exceptions.InvalidSectionPosException;
|
||||
import com.seibel.distanthorizons.core.network.exceptions.RateLimitedException;
|
||||
@@ -62,4 +63,12 @@ public class ExceptionMessage extends TrackableMessage
|
||||
this.exception = exceptionMap.get(id).getDeclaredConstructor(String.class).newInstance(message);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MoreObjects.ToStringHelper toStringHelper()
|
||||
{
|
||||
return super.toStringHelper()
|
||||
.add("exception", this.exception);
|
||||
}
|
||||
|
||||
}
|
||||
+10
@@ -19,6 +19,7 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.network.messages.plugin.fullData;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.seibel.distanthorizons.api.enums.config.EDhApiDataCompressionMode;
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
@@ -74,4 +75,13 @@ public class FullDataPartialUpdateMessage extends PluginChannelMessage implement
|
||||
this.dataSourceDto = INetworkObject.decodeToInstance(new FullDataSourceV2DTO(), in);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MoreObjects.ToStringHelper toStringHelper()
|
||||
{
|
||||
return super.toStringHelper()
|
||||
.add("levelName", this.levelName)
|
||||
.add("dataSourceDto", this.dataSourceDto);
|
||||
}
|
||||
|
||||
}
|
||||
+11
@@ -19,6 +19,7 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.network.messages.plugin.fullData;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.seibel.distanthorizons.core.network.messages.plugin.ILevelRelatedMessage;
|
||||
import com.seibel.distanthorizons.core.network.plugin.TrackableMessage;
|
||||
import com.seibel.distanthorizons.core.network.protocol.INetworkObject;
|
||||
@@ -68,4 +69,14 @@ public class FullDataSourceRequestMessage extends TrackableMessage implements IL
|
||||
this.clientTimestamp = this.readOptional(in, in::readLong);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MoreObjects.ToStringHelper toStringHelper()
|
||||
{
|
||||
return super.toStringHelper()
|
||||
.add("levelName", this.levelName)
|
||||
.add("sectionPos", this.sectionPos)
|
||||
.add("clientTimestamp", this.clientTimestamp);
|
||||
}
|
||||
|
||||
}
|
||||
+9
@@ -19,6 +19,7 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.network.messages.plugin.fullData;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.seibel.distanthorizons.api.enums.config.EDhApiDataCompressionMode;
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
@@ -71,4 +72,12 @@ public class FullDataSourceResponseMessage extends TrackableMessage
|
||||
this.dataSourceDto = this.readOptional(in, () -> INetworkObject.decodeToInstance(new FullDataSourceV2DTO(), in));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MoreObjects.ToStringHelper toStringHelper()
|
||||
{
|
||||
return super.toStringHelper()
|
||||
.add("dataSourceDto", this.dataSourceDto);
|
||||
}
|
||||
|
||||
}
|
||||
+9
@@ -19,6 +19,7 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.network.messages.plugin.session;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.seibel.distanthorizons.core.multiplayer.config.AbstractMultiplayerConfig;
|
||||
import com.seibel.distanthorizons.core.multiplayer.config.MultiplayerConfig;
|
||||
import com.seibel.distanthorizons.core.network.plugin.PluginChannelMessage;
|
||||
@@ -38,4 +39,12 @@ public class RemotePlayerConfigMessage extends PluginChannelMessage
|
||||
@Override
|
||||
public void decode(ByteBuf in) { this.payload = INetworkObject.decodeToInstance(new MultiplayerConfig(), in); }
|
||||
|
||||
|
||||
@Override
|
||||
public MoreObjects.ToStringHelper toStringHelper()
|
||||
{
|
||||
return super.toStringHelper()
|
||||
.add("payload", this.payload);
|
||||
}
|
||||
|
||||
}
|
||||
+14
@@ -1,5 +1,6 @@
|
||||
package com.seibel.distanthorizons.core.network.plugin;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.seibel.distanthorizons.core.network.protocol.INetworkObject;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.IServerPlayerWrapper;
|
||||
|
||||
@@ -23,4 +24,17 @@ public abstract class PluginChannelMessage implements INetworkObject
|
||||
}
|
||||
this.session = connection;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return this.toStringHelper().toString();
|
||||
}
|
||||
|
||||
public MoreObjects.ToStringHelper toStringHelper()
|
||||
{
|
||||
return MoreObjects.toStringHelper(this);
|
||||
}
|
||||
|
||||
}
|
||||
+1
@@ -51,6 +51,7 @@ public class PluginChannelSession extends NetworkEventSource
|
||||
|
||||
try
|
||||
{
|
||||
LOGGER.debug("Received message: " + message);
|
||||
this.handleMessage(message);
|
||||
}
|
||||
catch (Throwable e)
|
||||
|
||||
+8
@@ -19,6 +19,7 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.network.plugin;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.common.collect.MapMaker;
|
||||
import com.seibel.distanthorizons.core.api.internal.SharedApi;
|
||||
import com.seibel.distanthorizons.core.network.messages.plugin.base.ExceptionMessage;
|
||||
@@ -80,4 +81,11 @@ public abstract class TrackableMessage extends PluginChannelMessage
|
||||
protected abstract void encode0(ByteBuf out) throws Exception;
|
||||
protected abstract void decode0(ByteBuf in) throws Exception;
|
||||
|
||||
|
||||
@Override public MoreObjects.ToStringHelper toStringHelper()
|
||||
{
|
||||
return super.toStringHelper()
|
||||
.add("futureId", this.futureId);
|
||||
}
|
||||
|
||||
}
|
||||
+19
-1
@@ -19,6 +19,7 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.sql.dto;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.seibel.distanthorizons.api.enums.config.EDhApiDataCompressionMode;
|
||||
import com.seibel.distanthorizons.api.enums.config.EDhApiWorldCompressionMode;
|
||||
import com.seibel.distanthorizons.api.enums.worldGeneration.EDhApiWorldGenerationStep;
|
||||
@@ -416,7 +417,24 @@ public class FullDataSourceV2DTO implements IBaseDTO<Long>, INetworkObject
|
||||
@Override
|
||||
public Long getKey() { return this.pos; }
|
||||
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return MoreObjects.toStringHelper(this)
|
||||
.add("levelMinY", this.levelMinY)
|
||||
.add("pos", this.pos)
|
||||
.add("dataChecksum", this.dataChecksum)
|
||||
.add("compressedDataByteArray", this.compressedDataByteArray)
|
||||
.add("compressedColumnGenStepByteArray", this.compressedColumnGenStepByteArray)
|
||||
.add("compressedWorldCompressionModeByteArray", this.compressedWorldCompressionModeByteArray)
|
||||
.add("compressedMappingByteArray", this.compressedMappingByteArray)
|
||||
.add("dataFormatVersion", this.dataFormatVersion)
|
||||
.add("compressionModeValue", this.compressionModeValue)
|
||||
.add("applyToParent", this.applyToParent)
|
||||
.add("lastModifiedUnixDateTime", this.lastModifiedUnixDateTime)
|
||||
.add("createdUnixDateTime", this.createdUnixDateTime)
|
||||
.toString();
|
||||
}
|
||||
|
||||
//================//
|
||||
// helper methods //
|
||||
|
||||
Reference in New Issue
Block a user