Skip to content

Commit

Permalink
Disabled inline log object in TimeHandlers
Browse files Browse the repository at this point in the history
  • Loading branch information
OldSerpskiStalker committed Sep 30, 2024
1 parent 9f07fb8 commit c8a89a2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import org.imesense.dynamicspawncontrol.gameplay.gameworld.WorldTime;
import org.imesense.dynamicspawncontrol.technical.config.gameworldtime.DataPluginWorldTime;
import org.imesense.dynamicspawncontrol.technical.customlibrary.Log;

/**
*
Expand All @@ -28,11 +29,6 @@ public final class TimeHandlerClient implements ITimeHandler
*/
private double multiplier = 0.0;

/**
*
*/
private static final Logger log = LogManager.getLogger(TimeHandlerClient.class.getSimpleName());

/**
*
* @param world
Expand All @@ -46,7 +42,7 @@ public void tick(World world)

if (this.multiplier == 0.0D && this.debugLogDelay % 20 == 0)
{
log.info("Waiting for server time packet...");
Log.writeDataToLogFile(0, "Waiting for server time packet...");
return;
}

Expand All @@ -58,7 +54,7 @@ public void tick(World world)
{
long worldTime = world.getWorldTime();

log.info(String.format("Client time: %s | multiplier: %s | game_rules: %s, %s",
Log.writeDataToLogFile(0, String.format("Client time: %s | multiplier: %s | game_rules: %s, %s",
worldTime, this.multiplier, world.getGameRules().getBoolean("doDaylightCycle"),
world.getGameRules().getBoolean("doDaylightCycle_tc")));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import org.imesense.dynamicspawncontrol.gameplay.gameworld.WorldTime;
import org.imesense.dynamicspawncontrol.technical.config.gameworldtime.DataPluginWorldTime;
import org.imesense.dynamicspawncontrol.technical.customlibrary.Log;
import org.imesense.dynamicspawncontrol.technical.network.MessageHandler;
import org.imesense.dynamicspawncontrol.technical.network.PacketTime;

Expand All @@ -24,12 +25,12 @@ public final class TimeHandlerServer implements ITimeHandler
/**
*
*/
private long customTime;
private long customTime = 0L;

/**
*
*/
private double multiplier;
private double multiplier = 0.0;

/**
*
Expand All @@ -44,12 +45,8 @@ public final class TimeHandlerServer implements ITimeHandler
/**
*
*/
private static final Logger LOG = LogManager.getLogger(TimeHandlerServer.class.getSimpleName());

/**
*
*/
private static final Method WAKE_ALL_PLAYERS = ReflectionHelper.findMethod(WorldServer.class, "wakeAllPlayers", "func_73053_d", new Class[0]);
private static final Method WAKE_ALL_PLAYERS =
ReflectionHelper.findMethod(WorldServer.class, "wakeAllPlayers", "func_73053_d", new Class[0]);

/**
*
Expand Down Expand Up @@ -95,7 +92,8 @@ public void tick(World world)
}
catch (InvocationTargetException | IllegalAccessException exception)
{
LOG.error("Unable to wake players!", exception);
Log.writeDataToLogFile(2, "Unable to wake players!");
Log.writeDataToLogFile(2, "exception: " + exception);
}

++this.customTime;
Expand All @@ -110,8 +108,9 @@ public void tick(World world)
{
updatedWorldTime = world.getWorldTime();

LOG.info(WorldTime.progressString(updatedWorldTime, ""));
LOG.info(String.format("Server time update: %s -> %s (%s -> %s) (day %s) | multiplier: %s",
Log.writeDataToLogFile(0, WorldTime.progressString(updatedWorldTime, ""));

Log.writeDataToLogFile(0, String.format("Server time update: %s -> %s (%s -> %s) (day %s) | multiplier: %s",
worldTime, updatedWorldTime, this.customTime - 1L, this.customTime, WorldTime.day(updatedWorldTime), this.multiplier));
}
}
Expand Down Expand Up @@ -162,7 +161,7 @@ private void syncTimeWithSystem(World world)

if (DataPluginWorldTime.worldTime.instance.getTimeControlDebug())
{
LOG.info(String.format("System time update: %d -> %d | day %s, %s:%s", worldTime, time, calendar.get(Calendar.DAY_OF_YEAR), hour, minute));
Log.writeDataToLogFile(0, String.format("System time update: %d -> %d | day %s, %s:%s", worldTime, time, calendar.get(Calendar.DAY_OF_YEAR), hour, minute));
}
}
}
Expand Down

0 comments on commit c8a89a2

Please sign in to comment.