Remove debug calls when teleporting

This commit is contained in:
KingRainbow44 2023-05-10 21:32:40 -04:00
parent c0381d3795
commit 1719c08eb0
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE

View File

@ -301,37 +301,29 @@ public final class World implements Iterable<Player> {
// Call event & check if it was canceled. // Call event & check if it was canceled.
event.call(); event.call();
if (event.isCanceled()) { if (event.isCanceled()) {
System.out.println("Teleport was canceled");
return false; // Teleport was canceled. return false; // Teleport was canceled.
} }
if (GameData.getSceneDataMap().get(teleportProperties.getSceneId()) == null) { if (GameData.getSceneDataMap().get(teleportProperties.getSceneId()) == null) {
System.out.println("Scene data is null");
return false; return false;
} }
Scene oldScene = null; Scene oldScene = null;
if (player.getScene() != null) { if (player.getScene() != null) {
oldScene = player.getScene(); oldScene = player.getScene();
System.out.println("Old scene is not null");
// Don't deregister scenes if the player is going to tp back into them // Don't deregister scenes if the player is going to tp back into them
if (oldScene.getId() == teleportProperties.getSceneId()) { if (oldScene.getId() == teleportProperties.getSceneId()) {
oldScene.setDontDestroyWhenEmpty(true); oldScene.setDontDestroyWhenEmpty(true);
System.out.println("don't destroy when empty is set");
} }
oldScene.removePlayer(player); oldScene.removePlayer(player);
System.out.println("remove player was called");
} }
var newScene = this.getSceneById(teleportProperties.getSceneId()); var newScene = this.getSceneById(teleportProperties.getSceneId());
System.out.printf("new scene is %s%n", newScene.getId());
newScene.addPlayer(player); newScene.addPlayer(player);
System.out.println("player was added to new scene");
player.getTeamManager().applyAbilities(newScene); player.getTeamManager().applyAbilities(newScene);
System.out.println("new abilities applied");
// Dungeon // Dungeon
// Dungeon system is handling this already // Dungeon system is handling this already
@ -344,39 +336,31 @@ public final class World implements Iterable<Player> {
if (teleportProperties.getTeleportTo() == null && config != null) { if (teleportProperties.getTeleportTo() == null && config != null) {
if (config.born_pos != null) { if (config.born_pos != null) {
teleportProperties.setTeleportTo(config.born_pos); teleportProperties.setTeleportTo(config.born_pos);
System.out.printf("setting pos to %s%n", config.born_pos);
} }
if (config.born_rot != null) { if (config.born_rot != null) {
teleportProperties.setTeleportRot(config.born_rot); teleportProperties.setTeleportRot(config.born_rot);
System.out.printf("setting rot to %s%n", config.born_rot);
} }
} }
// Set player position and rotation // Set player position and rotation
if (teleportProperties.getTeleportTo() != null) { if (teleportProperties.getTeleportTo() != null) {
player.getPosition().set(teleportProperties.getTeleportTo()); player.getPosition().set(teleportProperties.getTeleportTo());
System.out.printf("moving player to %s%n", teleportProperties.getTeleportTo());
} }
if (teleportProperties.getTeleportRot() != null) { if (teleportProperties.getTeleportRot() != null) {
player.getRotation().set(teleportProperties.getTeleportRot()); player.getRotation().set(teleportProperties.getTeleportRot());
System.out.printf("rotating player to %s%n", teleportProperties.getTeleportRot());
} }
if (oldScene != null && newScene != oldScene) { if (oldScene != null && newScene != oldScene) {
newScene.setPrevScene(oldScene.getId()); newScene.setPrevScene(oldScene.getId());
System.out.printf("new scene's prev is %s%n", newScene.getPrevScene());
oldScene.setDontDestroyWhenEmpty(false); oldScene.setDontDestroyWhenEmpty(false);
System.out.println("old scene's dont destroy when empty is false");
} }
// Teleport packet // Teleport packet
player.sendPacket(new PacketPlayerEnterSceneNotify(player, teleportProperties)); player.sendPacket(new PacketPlayerEnterSceneNotify(player, teleportProperties));
System.out.println("packet was sent to player");
if (teleportProperties.getTeleportType() != TeleportType.INTERNAL if (teleportProperties.getTeleportType() != TeleportType.INTERNAL
&& teleportProperties.getTeleportType() != SCRIPT) { && teleportProperties.getTeleportType() != SCRIPT) {
player.getQuestManager().queueEvent(QuestContent.QUEST_CONTENT_ANY_MANUAL_TRANSPORT); player.getQuestManager().queueEvent(QuestContent.QUEST_CONTENT_ANY_MANUAL_TRANSPORT);
System.out.println("transport event called");
} }
return true; return true;