From 6ea310af5d2d1e0f23e3516f149e3132b5789af2 Mon Sep 17 00:00:00 2001 From: Jesse Donkervliet Date: Thu, 7 Jan 2021 23:39:53 +0100 Subject: [PATCH 1/4] update version number --- yardstick/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yardstick/pom.xml b/yardstick/pom.xml index 60e0cd46..563f307d 100644 --- a/yardstick/pom.xml +++ b/yardstick/pom.xml @@ -22,7 +22,7 @@ 4.0.0 nl.tudelft yardstick - 1.0.3-SNAPSHOT + 1.0.3-library-SNAPSHOT UTF-8 From 26ce7b65e101eaf862398bc0a844b9e1df79b970 Mon Sep 17 00:00:00 2001 From: Jesse Donkervliet Date: Thu, 7 Jan 2021 23:46:35 +0100 Subject: [PATCH 2/4] Revert back to using Steveice's libraries To make Yardstick usable in other projects that use these networking libraries. --- yardstick/pom.xml | 12 +- .../tudelft/opencraft/yardstick/bot/Bot.java | 14 +- .../yardstick/bot/BotController.java | 24 +-- .../opencraft/yardstick/bot/BotListener.java | 184 +++++++++--------- .../opencraft/yardstick/bot/Server.java | 2 +- .../yardstick/bot/entity/BotPlayer.java | 4 +- .../opencraft/yardstick/bot/entity/Mob.java | 2 +- .../yardstick/bot/entity/ObjectEntity.java | 2 +- .../opencraft/yardstick/bot/world/Block.java | 10 +- .../yardstick/bot/world/BlockFace.java | 4 +- .../opencraft/yardstick/bot/world/Chunk.java | 2 +- .../opencraft/yardstick/bot/world/World.java | 4 +- .../yardstick/experiment/Experiment.java | 15 +- .../experiment/Experiment1SimpleJoin.java | 2 +- .../experiment/Experiment2ScheduledJoin.java | 2 +- .../experiment/LoggerSessionListener.java | 8 +- .../model/BoundingBoxMovementModel.java | 4 +- .../yardstick/model/SimpleMovementModel.java | 2 +- .../yardstick/statistic/Statistics.java | 20 +- .../opencraft/yardstick/util/PacketUtil.java | 8 +- .../yardstick/workload/PacketEntry.java | 2 +- .../yardstick/workload/WorkloadDumper.java | 6 +- .../workload/WorkloadSessionListener.java | 6 +- .../model/SimpleMovementModelTest.java | 2 +- 24 files changed, 171 insertions(+), 170 deletions(-) diff --git a/yardstick/pom.xml b/yardstick/pom.xml index 563f307d..d7e8ddd8 100644 --- a/yardstick/pom.xml +++ b/yardstick/pom.xml @@ -76,16 +76,16 @@ - science.atlarge.opencraft - packetlib - 1.2.1-SNAPSHOT + com.github.Steveice10 + PacketLib + 1.2 - science.atlarge.opencraft - mcprotocollib - 1.12.2-3-SNAPSHOT + com.github.Steveice10 + MCProtocolLib + 1.12.2-2 diff --git a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/Bot.java b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/Bot.java index c8562f50..40be739f 100644 --- a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/Bot.java +++ b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/Bot.java @@ -19,6 +19,12 @@ package nl.tudelft.opencraft.yardstick.bot; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.github.steveice10.mc.protocol.MinecraftProtocol; +import com.github.steveice10.packetlib.Client; +import com.github.steveice10.packetlib.event.session.DisconnectedEvent; +import com.github.steveice10.packetlib.event.session.SessionAdapter; +import com.github.steveice10.packetlib.event.session.SessionListener; +import com.github.steveice10.packetlib.tcp.TcpSessionFactory; import nl.tudelft.opencraft.yardstick.bot.ai.pathfinding.astar.SimpleAStar; import nl.tudelft.opencraft.yardstick.bot.ai.pathfinding.astar.heuristic.EuclideanHeuristic; import nl.tudelft.opencraft.yardstick.bot.ai.task.TaskExecutor; @@ -27,12 +33,6 @@ import nl.tudelft.opencraft.yardstick.bot.world.World; import nl.tudelft.opencraft.yardstick.logging.GlobalLogger; import nl.tudelft.opencraft.yardstick.logging.SubLogger; -import science.atlarge.opencraft.mcprotocollib.MinecraftProtocol; -import science.atlarge.opencraft.packetlib.Client; -import science.atlarge.opencraft.packetlib.event.session.DisconnectedEvent; -import science.atlarge.opencraft.packetlib.event.session.SessionAdapter; -import science.atlarge.opencraft.packetlib.event.session.SessionListener; -import science.atlarge.opencraft.packetlib.tcp.TcpSessionFactory; /** * Represents a Minecraft simulated bot. @@ -69,7 +69,7 @@ public class Bot { * @param port the port of the Minecraft server. */ public Bot(MinecraftProtocol protocol, String host, int port) { - this(protocol, new Client(host, port, protocol, new TcpSessionFactory(true))); + this(protocol, new Client(host, port, protocol, new TcpSessionFactory())); } /** diff --git a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/BotController.java b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/BotController.java index 6751fec8..e37d19ca 100644 --- a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/BotController.java +++ b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/BotController.java @@ -18,18 +18,18 @@ package nl.tudelft.opencraft.yardstick.bot; -import science.atlarge.opencraft.mcprotocollib.data.game.entity.metadata.ItemStack; -import science.atlarge.opencraft.mcprotocollib.data.game.entity.metadata.Position; -import science.atlarge.opencraft.mcprotocollib.data.game.entity.player.Hand; -import science.atlarge.opencraft.mcprotocollib.data.game.entity.player.PlayerAction; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.client.player.ClientPlayerActionPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.client.player.ClientPlayerPlaceBlockPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.client.player.ClientPlayerPositionPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.client.player.ClientPlayerRotationPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.client.player.ClientPlayerSwingArmPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.client.window.ClientCreativeInventoryActionPacket; -import science.atlarge.opencraft.packetlib.Session; -import science.atlarge.opencraft.packetlib.packet.Packet; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; +import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; +import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction; +import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerActionPacket; +import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPlaceBlockPacket; +import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPositionPacket; +import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerRotationPacket; +import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerSwingArmPacket; +import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientCreativeInventoryActionPacket; +import com.github.steveice10.packetlib.Session; +import com.github.steveice10.packetlib.packet.Packet; import nl.tudelft.opencraft.yardstick.bot.entity.BotPlayer; import nl.tudelft.opencraft.yardstick.bot.world.Block; import nl.tudelft.opencraft.yardstick.bot.world.BlockFace; diff --git a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/BotListener.java b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/BotListener.java index ecae32ea..eff7c102 100644 --- a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/BotListener.java +++ b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/BotListener.java @@ -18,98 +18,98 @@ package nl.tudelft.opencraft.yardstick.bot; -import science.atlarge.opencraft.mcprotocollib.MinecraftProtocol; -import science.atlarge.opencraft.mcprotocollib.data.SubProtocol; -import science.atlarge.opencraft.mcprotocollib.data.game.chunk.Column; -import science.atlarge.opencraft.mcprotocollib.data.game.entity.metadata.Position; -import science.atlarge.opencraft.mcprotocollib.data.game.entity.type.GlobalEntityType; -import science.atlarge.opencraft.mcprotocollib.data.game.world.block.BlockChangeRecord; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.client.world.ClientTeleportConfirmPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.ServerBossBarPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.ServerChatPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.ServerCombatPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.ServerDifficultyPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.ServerDisconnectPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.ServerJoinGamePacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.ServerKeepAlivePacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.ServerPlayerListDataPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.ServerPlayerListEntryPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.ServerPluginMessagePacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.ServerResourcePackSendPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.ServerRespawnPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.ServerSetCooldownPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.ServerStatisticsPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.ServerSwitchCameraPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.ServerTabCompletePacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.ServerTitlePacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.ServerEntityAnimationPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.ServerEntityAttachPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.ServerEntityCollectItemPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.ServerEntityDestroyPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.ServerEntityEffectPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.ServerEntityEquipmentPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.ServerEntityHeadLookPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.ServerEntityMetadataPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.ServerEntityMovementPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.ServerEntityPositionPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.ServerEntityPositionRotationPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.ServerEntityPropertiesPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.ServerEntityRemoveEffectPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.ServerEntityRotationPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.ServerEntitySetPassengersPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.ServerEntityStatusPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.ServerEntityTeleportPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.ServerEntityVelocityPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.ServerVehicleMovePacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.player.ServerPlayerAbilitiesPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.player.ServerPlayerChangeHeldItemPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.player.ServerPlayerHealthPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.player.ServerPlayerSetExperiencePacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.player.ServerPlayerUseBedPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.spawn.ServerSpawnExpOrbPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.spawn.ServerSpawnGlobalEntityPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.spawn.ServerSpawnMobPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.spawn.ServerSpawnObjectPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.spawn.ServerSpawnPaintingPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.spawn.ServerSpawnPlayerPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.scoreboard.ServerDisplayScoreboardPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.scoreboard.ServerScoreboardObjectivePacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.scoreboard.ServerTeamPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.scoreboard.ServerUpdateScorePacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.window.ServerCloseWindowPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.window.ServerConfirmTransactionPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.window.ServerOpenWindowPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.window.ServerSetSlotPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.window.ServerWindowItemsPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.window.ServerWindowPropertyPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.world.ServerBlockBreakAnimPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.world.ServerBlockChangePacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.world.ServerBlockValuePacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.world.ServerChunkDataPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.world.ServerExplosionPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.world.ServerMapDataPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.world.ServerMultiBlockChangePacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.world.ServerNotifyClientPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.world.ServerOpenTileEntityEditorPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.world.ServerPlayBuiltinSoundPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.world.ServerPlayEffectPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.world.ServerPlaySoundPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.world.ServerSpawnParticlePacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.world.ServerSpawnPositionPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.world.ServerUnloadChunkPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.world.ServerUpdateTileEntityPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.world.ServerUpdateTimePacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.world.ServerWorldBorderPacket; -import science.atlarge.opencraft.packetlib.Session; -import science.atlarge.opencraft.packetlib.event.session.ConnectedEvent; -import science.atlarge.opencraft.packetlib.event.session.DisconnectedEvent; -import science.atlarge.opencraft.packetlib.event.session.DisconnectingEvent; -import science.atlarge.opencraft.packetlib.event.session.PacketReceivedEvent; -import science.atlarge.opencraft.packetlib.event.session.PacketSendingEvent; -import science.atlarge.opencraft.packetlib.event.session.PacketSentEvent; -import science.atlarge.opencraft.packetlib.event.session.SessionListener; -import science.atlarge.opencraft.packetlib.packet.Packet; +import com.github.steveice10.mc.protocol.MinecraftProtocol; +import com.github.steveice10.mc.protocol.data.SubProtocol; +import com.github.steveice10.mc.protocol.data.game.chunk.Column; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; +import com.github.steveice10.mc.protocol.data.game.entity.type.GlobalEntityType; +import com.github.steveice10.mc.protocol.data.game.world.block.BlockChangeRecord; +import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientTeleportConfirmPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.ServerBossBarPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.ServerChatPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.ServerCombatPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDifficultyPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDisconnectPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.ServerKeepAlivePacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPlayerListDataPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPlayerListEntryPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPluginMessagePacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.ServerResourcePackSendPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.ServerRespawnPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.ServerSetCooldownPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.ServerStatisticsPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.ServerSwitchCameraPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.ServerTabCompletePacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.ServerTitlePacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityAnimationPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityAttachPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityCollectItemPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityDestroyPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityEffectPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityEquipmentPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityHeadLookPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityMetadataPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityMovementPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityPositionPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityPositionRotationPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityPropertiesPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityRemoveEffectPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityRotationPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntitySetPassengersPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityStatusPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityTeleportPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityVelocityPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerVehicleMovePacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerAbilitiesPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerChangeHeldItemPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerHealthPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerSetExperiencePacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerUseBedPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnExpOrbPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnGlobalEntityPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnMobPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnObjectPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnPaintingPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnPlayerPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerDisplayScoreboardPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerScoreboardObjectivePacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerTeamPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerUpdateScorePacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerCloseWindowPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerConfirmTransactionPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerOpenWindowPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerSetSlotPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerWindowItemsPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerWindowPropertyPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerBlockBreakAnimPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerBlockChangePacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerBlockValuePacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerChunkDataPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerExplosionPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerMapDataPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerMultiBlockChangePacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerNotifyClientPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerOpenTileEntityEditorPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerPlayBuiltinSoundPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerPlayEffectPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerPlaySoundPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerSpawnParticlePacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerSpawnPositionPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUnloadChunkPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdateTileEntityPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdateTimePacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerWorldBorderPacket; +import com.github.steveice10.packetlib.Session; +import com.github.steveice10.packetlib.event.session.ConnectedEvent; +import com.github.steveice10.packetlib.event.session.DisconnectedEvent; +import com.github.steveice10.packetlib.event.session.DisconnectingEvent; +import com.github.steveice10.packetlib.event.session.PacketReceivedEvent; +import com.github.steveice10.packetlib.event.session.PacketSendingEvent; +import com.github.steveice10.packetlib.event.session.PacketSentEvent; +import com.github.steveice10.packetlib.event.session.SessionListener; +import com.github.steveice10.packetlib.packet.Packet; import java.util.UUID; import java.util.logging.Level; import java.util.logging.Logger; diff --git a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/Server.java b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/Server.java index afadd237..55283306 100644 --- a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/Server.java +++ b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/Server.java @@ -18,7 +18,7 @@ package nl.tudelft.opencraft.yardstick.bot; -import science.atlarge.opencraft.mcprotocollib.data.game.setting.Difficulty; +import com.github.steveice10.mc.protocol.data.game.setting.Difficulty; /** * Represents server-related data visible to the Bot. diff --git a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/entity/BotPlayer.java b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/entity/BotPlayer.java index efc30bf3..4e6d9b9a 100644 --- a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/entity/BotPlayer.java +++ b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/entity/BotPlayer.java @@ -22,8 +22,8 @@ import java.util.UUID; import com.fasterxml.jackson.annotation.JsonIgnore; -import science.atlarge.opencraft.mcprotocollib.data.game.entity.player.GameMode; -import science.atlarge.opencraft.packetlib.Session; +import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; +import com.github.steveice10.packetlib.Session; import nl.tudelft.opencraft.yardstick.bot.Bot; /** diff --git a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/entity/Mob.java b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/entity/Mob.java index 575ca05f..deb80782 100644 --- a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/entity/Mob.java +++ b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/entity/Mob.java @@ -19,7 +19,7 @@ package nl.tudelft.opencraft.yardstick.bot.entity; import java.util.UUID; -import science.atlarge.opencraft.mcprotocollib.data.game.entity.type.MobType; +import com.github.steveice10.mc.protocol.data.game.entity.type.MobType; public class Mob extends Entity { diff --git a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/entity/ObjectEntity.java b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/entity/ObjectEntity.java index d3891ff2..a755981c 100644 --- a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/entity/ObjectEntity.java +++ b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/entity/ObjectEntity.java @@ -19,7 +19,7 @@ package nl.tudelft.opencraft.yardstick.bot.entity; import java.util.UUID; -import science.atlarge.opencraft.mcprotocollib.data.game.entity.type.object.ObjectType; +import com.github.steveice10.mc.protocol.data.game.entity.type.object.ObjectType; /** * Represents an Object. diff --git a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/world/Block.java b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/world/Block.java index 6cfb6d9d..24adf5e7 100644 --- a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/world/Block.java +++ b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/world/Block.java @@ -18,9 +18,9 @@ package nl.tudelft.opencraft.yardstick.bot.world; -import science.atlarge.opencraft.mcprotocollib.data.game.chunk.BlockStorage; -import science.atlarge.opencraft.mcprotocollib.data.game.chunk.Column; -import science.atlarge.opencraft.mcprotocollib.data.game.world.block.BlockState; +import com.github.steveice10.mc.protocol.data.game.chunk.BlockStorage; +import com.github.steveice10.mc.protocol.data.game.chunk.Column; +import com.github.steveice10.mc.protocol.data.game.world.block.BlockState; import com.google.common.base.Preconditions; import java.util.Objects; import nl.tudelft.opencraft.yardstick.logging.GlobalLogger; @@ -124,11 +124,11 @@ private BlockStorage getInternalStorage() { GlobalLogger.getLogger().warning("How did this happen: (" + x + "," + y + "," + z + ")"); } - science.atlarge.opencraft.mcprotocollib.data.game.chunk.Chunk[] sections = handle.getChunks(); + com.github.steveice10.mc.protocol.data.game.chunk.Chunk[] sections = handle.getChunks(); if (sections[index] == null) { //GlobalLogger.getLogger().info("Making new chunk section for air chunk section: (" + handle.getX() + "," + index + "," + handle.getZ() + ")"); - sections[index] = new science.atlarge.opencraft.mcprotocollib.data.game.chunk.Chunk(handle.hasSkylight()); + sections[index] = new com.github.steveice10.mc.protocol.data.game.chunk.Chunk(handle.hasSkylight()); } return sections[index].getBlocks(); diff --git a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/world/BlockFace.java b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/world/BlockFace.java index da435926..003c508f 100644 --- a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/world/BlockFace.java +++ b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/world/BlockFace.java @@ -66,8 +66,8 @@ public static BlockFace forUnitVector(Vector3i vec) { return VECTOR3I_TO_BLOCKFACE.get(vec); } - public science.atlarge.opencraft.mcprotocollib.data.game.world.block.BlockFace getInternalFace() { + public com.github.steveice10.mc.protocol.data.game.world.block.BlockFace getInternalFace() { // RIP clean code - return science.atlarge.opencraft.mcprotocollib.data.game.world.block.BlockFace.values()[ordinal()]; + return com.github.steveice10.mc.protocol.data.game.world.block.BlockFace.values()[ordinal()]; } } diff --git a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/world/Chunk.java b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/world/Chunk.java index dd2e494f..1be309b4 100644 --- a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/world/Chunk.java +++ b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/world/Chunk.java @@ -18,7 +18,7 @@ package nl.tudelft.opencraft.yardstick.bot.world; -import science.atlarge.opencraft.mcprotocollib.data.game.chunk.Column; +import com.github.steveice10.mc.protocol.data.game.chunk.Column; /** * Represents a vertical column of 16x16x16 chunks. diff --git a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/world/World.java b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/world/World.java index cc5ab047..f2f1d74b 100644 --- a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/world/World.java +++ b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/world/World.java @@ -18,8 +18,8 @@ package nl.tudelft.opencraft.yardstick.bot.world; -import science.atlarge.opencraft.mcprotocollib.data.game.entity.metadata.Position; -import science.atlarge.opencraft.mcprotocollib.data.game.world.WorldType; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; +import com.github.steveice10.mc.protocol.data.game.world.WorldType; import java.util.Collection; import java.util.HashMap; import java.util.Map; diff --git a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/experiment/Experiment.java b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/experiment/Experiment.java index 1f05b425..1f34f6b9 100644 --- a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/experiment/Experiment.java +++ b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/experiment/Experiment.java @@ -18,11 +18,10 @@ package nl.tudelft.opencraft.yardstick.experiment; -import science.atlarge.opencraft.mcprotocollib.MinecraftProtocol; -import science.atlarge.opencraft.packetlib.Client; -import science.atlarge.opencraft.packetlib.Session; -import science.atlarge.opencraft.packetlib.tcp.TcpSessionFactory; -import java.util.UUID; +import com.github.steveice10.mc.protocol.MinecraftProtocol; +import com.github.steveice10.packetlib.Client; +import com.github.steveice10.packetlib.Session; +import com.github.steveice10.packetlib.tcp.TcpSessionFactory; import nl.tudelft.opencraft.yardstick.Options; import nl.tudelft.opencraft.yardstick.Yardstick; import nl.tudelft.opencraft.yardstick.bot.Bot; @@ -34,6 +33,8 @@ import nl.tudelft.opencraft.yardstick.workload.WorkloadDumper; import nl.tudelft.opencraft.yardstick.workload.WorkloadSessionListener; +import java.util.UUID; + /** * A runnable Yardstick experiment. */ @@ -54,7 +55,7 @@ public abstract class Experiment implements Runnable { * Creates a new experiment. * * @param number The experiment number. Must be unique globally. - * @param desc A human-friendly description of the experiment. + * @param desc A human-friendly description of the experiment. */ public Experiment(int number, String desc) { this.number = number; @@ -151,7 +152,7 @@ public void setWorkloadDumper(WorkloadDumper dumper) { * @return the client. */ protected Client newClient(String name) { - Client client = new Client(options.host, options.port, new MinecraftProtocol(name), new TcpSessionFactory(true)); + Client client = new Client(options.host, options.port, new MinecraftProtocol(name), new TcpSessionFactory()); setupClient(client, name); return client; } diff --git a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/experiment/Experiment1SimpleJoin.java b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/experiment/Experiment1SimpleJoin.java index 8c036030..2769f110 100644 --- a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/experiment/Experiment1SimpleJoin.java +++ b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/experiment/Experiment1SimpleJoin.java @@ -18,7 +18,7 @@ package nl.tudelft.opencraft.yardstick.experiment; -import science.atlarge.opencraft.packetlib.Client; +import com.github.steveice10.packetlib.Client; public class Experiment1SimpleJoin extends Experiment { diff --git a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/experiment/Experiment2ScheduledJoin.java b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/experiment/Experiment2ScheduledJoin.java index b65558b2..4b427e11 100644 --- a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/experiment/Experiment2ScheduledJoin.java +++ b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/experiment/Experiment2ScheduledJoin.java @@ -18,7 +18,7 @@ package nl.tudelft.opencraft.yardstick.experiment; -import science.atlarge.opencraft.packetlib.Client; +import com.github.steveice10.packetlib.Client; import java.time.Instant; import java.util.ArrayList; import java.util.List; diff --git a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/experiment/LoggerSessionListener.java b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/experiment/LoggerSessionListener.java index ba49b959..960379f4 100644 --- a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/experiment/LoggerSessionListener.java +++ b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/experiment/LoggerSessionListener.java @@ -20,10 +20,10 @@ import java.util.logging.Level; import java.util.logging.Logger; -import science.atlarge.opencraft.packetlib.event.session.ConnectedEvent; -import science.atlarge.opencraft.packetlib.event.session.DisconnectedEvent; -import science.atlarge.opencraft.packetlib.event.session.DisconnectingEvent; -import science.atlarge.opencraft.packetlib.event.session.SessionAdapter; +import com.github.steveice10.packetlib.event.session.ConnectedEvent; +import com.github.steveice10.packetlib.event.session.DisconnectedEvent; +import com.github.steveice10.packetlib.event.session.DisconnectingEvent; +import com.github.steveice10.packetlib.event.session.SessionAdapter; /** * A {@link SessionAdapter} for logging bot events to a {@link Logger}. diff --git a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/model/BoundingBoxMovementModel.java b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/model/BoundingBoxMovementModel.java index f6ec8a4b..7199ce85 100644 --- a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/model/BoundingBoxMovementModel.java +++ b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/model/BoundingBoxMovementModel.java @@ -18,6 +18,7 @@ package nl.tudelft.opencraft.yardstick.model; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import java.util.Random; import nl.tudelft.opencraft.yardstick.bot.Bot; import nl.tudelft.opencraft.yardstick.bot.ai.task.TaskExecutor; @@ -28,7 +29,6 @@ import nl.tudelft.opencraft.yardstick.util.Vector3d; import nl.tudelft.opencraft.yardstick.util.Vector3i; import nl.tudelft.opencraft.yardstick.util.ZigZagRange; -import science.atlarge.opencraft.mcprotocollib.data.game.entity.metadata.Position; /** * Represents a model which moves the bot randomly to short and long distance @@ -103,7 +103,7 @@ private Vector3i getTargetAt(Bot bot, int x, int z) { y = it.next(); Block test = bot.getWorld().getBlockAt(x, y, z); if (test.getMaterial().isTraversable() - && !test.getRelative(BlockFace.BOTTOM).getMaterial().isTraversable()) { + && !test.getRelative(BlockFace.BOTTOM).getMaterial().isTraversable()) { break; } } diff --git a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/model/SimpleMovementModel.java b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/model/SimpleMovementModel.java index 7afc128a..419656f2 100644 --- a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/model/SimpleMovementModel.java +++ b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/model/SimpleMovementModel.java @@ -18,7 +18,7 @@ package nl.tudelft.opencraft.yardstick.model; -import science.atlarge.opencraft.mcprotocollib.data.game.entity.metadata.Position; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import java.util.Random; import nl.tudelft.opencraft.yardstick.bot.Bot; import nl.tudelft.opencraft.yardstick.bot.ai.task.TaskExecutor; diff --git a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/statistic/Statistics.java b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/statistic/Statistics.java index fd8ece00..5c67c2d8 100644 --- a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/statistic/Statistics.java +++ b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/statistic/Statistics.java @@ -21,16 +21,16 @@ import java.io.IOException; import java.util.HashSet; import java.util.logging.Level; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.ServerJoinGamePacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.ServerKeepAlivePacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.ServerEntityHeadLookPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.ServerEntityMovementPacket; -import science.atlarge.opencraft.mcprotocollib.packet.ingame.server.entity.ServerEntityTeleportPacket; -import science.atlarge.opencraft.packetlib.Session; -import science.atlarge.opencraft.packetlib.event.session.*; -import science.atlarge.opencraft.packetlib.io.NetOutput; -import science.atlarge.opencraft.packetlib.io.stream.StreamNetOutput; -import science.atlarge.opencraft.packetlib.packet.Packet; +import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.ServerKeepAlivePacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityHeadLookPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityMovementPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityTeleportPacket; +import com.github.steveice10.packetlib.Session; +import com.github.steveice10.packetlib.event.session.*; +import com.github.steveice10.packetlib.io.NetOutput; +import com.github.steveice10.packetlib.io.stream.StreamNetOutput; +import com.github.steveice10.packetlib.packet.Packet; import io.prometheus.client.CollectorRegistry; import io.prometheus.client.Counter; import io.prometheus.client.Gauge; diff --git a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/util/PacketUtil.java b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/util/PacketUtil.java index 50279a0e..f5b1a91e 100644 --- a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/util/PacketUtil.java +++ b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/util/PacketUtil.java @@ -22,10 +22,10 @@ import java.lang.reflect.Field; import java.util.Map; import java.util.Map.Entry; -import science.atlarge.opencraft.packetlib.io.NetOutput; -import science.atlarge.opencraft.packetlib.io.stream.StreamNetOutput; -import science.atlarge.opencraft.packetlib.packet.Packet; -import science.atlarge.opencraft.packetlib.packet.PacketProtocol; +import com.github.steveice10.packetlib.io.NetOutput; +import com.github.steveice10.packetlib.io.stream.StreamNetOutput; +import com.github.steveice10.packetlib.packet.Packet; +import com.github.steveice10.packetlib.packet.PacketProtocol; /** * Represents packet-related utilities. diff --git a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/workload/PacketEntry.java b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/workload/PacketEntry.java index 7ba553fe..b56963cd 100644 --- a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/workload/PacketEntry.java +++ b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/workload/PacketEntry.java @@ -21,7 +21,7 @@ import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; -import science.atlarge.opencraft.packetlib.packet.Packet; +import com.github.steveice10.packetlib.packet.Packet; import nl.tudelft.opencraft.yardstick.util.PacketUtil; /** diff --git a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/workload/WorkloadDumper.java b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/workload/WorkloadDumper.java index fb45646b..45f88097 100644 --- a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/workload/WorkloadDumper.java +++ b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/workload/WorkloadDumper.java @@ -24,9 +24,9 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicBoolean; import java.util.logging.Level; -import science.atlarge.opencraft.packetlib.event.session.PacketReceivedEvent; -import science.atlarge.opencraft.packetlib.event.session.PacketSentEvent; -import science.atlarge.opencraft.packetlib.packet.Packet; +import com.github.steveice10.packetlib.event.session.PacketReceivedEvent; +import com.github.steveice10.packetlib.event.session.PacketSentEvent; +import com.github.steveice10.packetlib.packet.Packet; import nl.tudelft.opencraft.yardstick.logging.GlobalLogger; import nl.tudelft.opencraft.yardstick.logging.SubLogger; diff --git a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/workload/WorkloadSessionListener.java b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/workload/WorkloadSessionListener.java index a126008b..1acf2b02 100644 --- a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/workload/WorkloadSessionListener.java +++ b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/workload/WorkloadSessionListener.java @@ -18,9 +18,9 @@ package nl.tudelft.opencraft.yardstick.workload; -import science.atlarge.opencraft.packetlib.event.session.PacketReceivedEvent; -import science.atlarge.opencraft.packetlib.event.session.PacketSentEvent; -import science.atlarge.opencraft.packetlib.event.session.SessionAdapter; +import com.github.steveice10.packetlib.event.session.PacketReceivedEvent; +import com.github.steveice10.packetlib.event.session.PacketSentEvent; +import com.github.steveice10.packetlib.event.session.SessionAdapter; /** * A {@link SessionAdapter} which writes packets to a {@link WorkloadDumper}. diff --git a/yardstick/src/test/java/nl/tudelft/opencraft/yardstick/model/SimpleMovementModelTest.java b/yardstick/src/test/java/nl/tudelft/opencraft/yardstick/model/SimpleMovementModelTest.java index 4d1f4513..875d8275 100644 --- a/yardstick/src/test/java/nl/tudelft/opencraft/yardstick/model/SimpleMovementModelTest.java +++ b/yardstick/src/test/java/nl/tudelft/opencraft/yardstick/model/SimpleMovementModelTest.java @@ -18,6 +18,7 @@ package nl.tudelft.opencraft.yardstick.model; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import nl.tudelft.opencraft.yardstick.bot.Bot; import nl.tudelft.opencraft.yardstick.bot.entity.BotPlayer; import nl.tudelft.opencraft.yardstick.bot.world.Block; @@ -35,7 +36,6 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import science.atlarge.opencraft.mcprotocollib.data.game.entity.metadata.Position; @TestInstance(TestInstance.Lifecycle.PER_CLASS) class SimpleMovementModelTest { From 15ab33bae9ea9180d4efd82254f6267b2efd1a21 Mon Sep 17 00:00:00 2001 From: Jesse Donkervliet Date: Fri, 8 Jan 2021 01:52:33 +0100 Subject: [PATCH 3/4] Lazily initialize logger Prevents crash when getLogger is called without first creating a Yardstick object. --- .../main/java/nl/tudelft/opencraft/yardstick/Yardstick.java | 2 +- .../nl/tudelft/opencraft/yardstick/logging/GlobalLogger.java | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/Yardstick.java b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/Yardstick.java index 570bb5ac..3f1f9fee 100644 --- a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/Yardstick.java +++ b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/Yardstick.java @@ -56,7 +56,7 @@ */ public class Yardstick { - public static final GlobalLogger LOGGER = GlobalLogger.setupGlobalLogger("Yardstick"); + public static final GlobalLogger LOGGER = GlobalLogger.getLogger(); public static final Options OPTIONS = new Options(); public static final StatisticsPusher PROMETHEUS = new StatisticsPusher(); diff --git a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/logging/GlobalLogger.java b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/logging/GlobalLogger.java index 6e30b40c..0b1f7c7a 100644 --- a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/logging/GlobalLogger.java +++ b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/logging/GlobalLogger.java @@ -75,9 +75,8 @@ public static GlobalLogger setupGlobalLogger(String name) { public static GlobalLogger getLogger() { if (logger == null) { - throw new IllegalStateException("Global logger has not be set up"); + logger = setupGlobalLogger("Yardstick"); } - return logger; } } From 82b8a67fc9ab0ce00b55014ecd9dd94159f5ba7d Mon Sep 17 00:00:00 2001 From: Jesse Donkervliet Date: Fri, 8 Jan 2021 03:50:36 +0100 Subject: [PATCH 4/4] Start bot ticker automatically if possible --- .../main/java/nl/tudelft/opencraft/yardstick/bot/Bot.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/Bot.java b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/Bot.java index 40be739f..ac7d6d93 100644 --- a/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/Bot.java +++ b/yardstick/src/main/java/nl/tudelft/opencraft/yardstick/bot/Bot.java @@ -94,6 +94,11 @@ public void disconnected(DisconnectedEvent event) { disconnected = true; } }); + + // If the provided client is already connected, start the ticker right away. + if (client.getSession().isConnected()) { + ticker.start(); + } } /**