From a3722db6333cb3c667241529d9f44ff0e807ce33 Mon Sep 17 00:00:00 2001 From: David Hermann Date: Wed, 18 Jan 2023 18:28:10 +0100 Subject: [PATCH] refactoring: outsourced the entities in the entities package --- .../java/org/bitbiome/classes/CreateLocations.java | 4 ++++ src/main/java/org/bitbiome/classes/TravelEngine.java | 10 +++++++--- .../java/org/bitbiome/{classes => entities}/Item.java | 2 +- .../org/bitbiome/{classes => entities}/Location.java | 2 +- .../java/org/bitbiome/{classes => entities}/Mob.java | 2 +- .../org/bitbiome/{classes => entities}/Player.java | 4 +++- 6 files changed, 17 insertions(+), 7 deletions(-) rename src/main/java/org/bitbiome/{classes => entities}/Item.java (95%) rename src/main/java/org/bitbiome/{classes => entities}/Location.java (94%) rename src/main/java/org/bitbiome/{classes => entities}/Mob.java (96%) rename src/main/java/org/bitbiome/{classes => entities}/Player.java (92%) diff --git a/src/main/java/org/bitbiome/classes/CreateLocations.java b/src/main/java/org/bitbiome/classes/CreateLocations.java index 7899f48..5223fdf 100644 --- a/src/main/java/org/bitbiome/classes/CreateLocations.java +++ b/src/main/java/org/bitbiome/classes/CreateLocations.java @@ -1,5 +1,9 @@ package org.bitbiome.classes; +import org.bitbiome.entities.Item; +import org.bitbiome.entities.Location; +import org.bitbiome.entities.Mob; + import java.util.ArrayList; public class CreateLocations { diff --git a/src/main/java/org/bitbiome/classes/TravelEngine.java b/src/main/java/org/bitbiome/classes/TravelEngine.java index f02fa63..25fbc62 100644 --- a/src/main/java/org/bitbiome/classes/TravelEngine.java +++ b/src/main/java/org/bitbiome/classes/TravelEngine.java @@ -1,15 +1,19 @@ package org.bitbiome.classes; +import org.bitbiome.entities.Location; +import org.bitbiome.entities.Player; + public class TravelEngine { private Location location; + private Player player; - public TravelEngine() { - + public TravelEngine(Player player) { + this.player = player; } public void travelTo(Location location) { - this.location = location; + player.setLocation(location); } } diff --git a/src/main/java/org/bitbiome/classes/Item.java b/src/main/java/org/bitbiome/entities/Item.java similarity index 95% rename from src/main/java/org/bitbiome/classes/Item.java rename to src/main/java/org/bitbiome/entities/Item.java index 4230728..2817cd5 100644 --- a/src/main/java/org/bitbiome/classes/Item.java +++ b/src/main/java/org/bitbiome/entities/Item.java @@ -1,4 +1,4 @@ -package org.bitbiome.classes; +package org.bitbiome.entities; public class Item { diff --git a/src/main/java/org/bitbiome/classes/Location.java b/src/main/java/org/bitbiome/entities/Location.java similarity index 94% rename from src/main/java/org/bitbiome/classes/Location.java rename to src/main/java/org/bitbiome/entities/Location.java index 8d608cf..98c04d1 100644 --- a/src/main/java/org/bitbiome/classes/Location.java +++ b/src/main/java/org/bitbiome/entities/Location.java @@ -1,4 +1,4 @@ -package org.bitbiome.classes; +package org.bitbiome.entities; import java.util.ArrayList; diff --git a/src/main/java/org/bitbiome/classes/Mob.java b/src/main/java/org/bitbiome/entities/Mob.java similarity index 96% rename from src/main/java/org/bitbiome/classes/Mob.java rename to src/main/java/org/bitbiome/entities/Mob.java index f214d90..af479ce 100644 --- a/src/main/java/org/bitbiome/classes/Mob.java +++ b/src/main/java/org/bitbiome/entities/Mob.java @@ -1,4 +1,4 @@ -package org.bitbiome.classes; +package org.bitbiome.entities; public class Mob { diff --git a/src/main/java/org/bitbiome/classes/Player.java b/src/main/java/org/bitbiome/entities/Player.java similarity index 92% rename from src/main/java/org/bitbiome/classes/Player.java rename to src/main/java/org/bitbiome/entities/Player.java index 1090d7e..8f07072 100644 --- a/src/main/java/org/bitbiome/classes/Player.java +++ b/src/main/java/org/bitbiome/entities/Player.java @@ -1,4 +1,6 @@ -package org.bitbiome.classes; +package org.bitbiome.entities; + +import org.bitbiome.classes.CreateLocations; import java.util.ArrayList;