From 0372a87d7a0616d57cdf0ef20ab3ecddebaa9539 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Wed, 25 Jan 2023 16:51:22 +0100 Subject: [PATCH 01/56] Created locations --- src/main/resources/gameconfig.json | 42 +++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/src/main/resources/gameconfig.json b/src/main/resources/gameconfig.json index cb08775..9d6c929 100644 --- a/src/main/resources/gameconfig.json +++ b/src/main/resources/gameconfig.json @@ -37,18 +37,36 @@ { "name": "Strand", "items": [ - "Holz", - "Stein" - ], - "mobs": [ - { - "name": "Big Foot", - "hp": 50, - "damage": "10-15", - "items": [ - "Fell" - ] - } + "Sand", + "Treibholz" + ] + }, + { + "name": "Winterland", + "items": [ + "Eiszapfen", + "Schnee" + ] + }, + { + "name": "Berge", + "items": [ + "Quellwasser", + "Feuerstein" + ] + }, + { + "name": "Gruenland", + "items": [ + "Lehm", + "Giftblume" + ] + }, + { + "name": "Wueste", + "items": [ + "Sand", + "Kaktus" ] } ] From 015e7fcd205cdc1d6db3f9410d65a96eb6b32f0d Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Wed, 25 Jan 2023 17:13:30 +0100 Subject: [PATCH 02/56] Created items --- src/main/resources/items.json | 132 +++++++++++++++++++++++++++++++++- 1 file changed, 130 insertions(+), 2 deletions(-) diff --git a/src/main/resources/items.json b/src/main/resources/items.json index 85b3f26..da0e7be 100644 --- a/src/main/resources/items.json +++ b/src/main/resources/items.json @@ -3,24 +3,152 @@ "name": "Holz", "damage": "1-3", "crafting": true, - "durability": 1000 + "gold": 10, + "durability": 1000, + "amountShop": 10 }, { "name": "Heiliges Schwert der Engel", "damage": "1000", "crafting": false, + "amountShop": 1, + "gold": 1000, "durability": 1000 }, { "name": "Stein", "damage": "5-10", "crafting": true, - "durability": 1000 + "amountShop": 1500, + "durability": 1000, + "gold": 2 }, { "name": "Fell", "damage": "0", "crafting": true, + "gold": 100, + "durability": 1000, + "amountShop": 500 + }, + { + "name": "Sand", + "gold": 1, + "crafting": true, + "durability": 1000, + "damage": "2", + "amountShop": 1500 + }, + { + "name": "Treibholz", + "amountShop": 1000, + "damage": "1", + "crafting": true, + "gold": 1, + "durability": 1000 + }, + { + "name": "Krabbenschere", + "damage": "4", + "durability": 1000, + "amountShop": 750, + "gold": 1, + "crafting": true + }, + { + "name": "Eiszapfen", + "crafting": true, + "amountShop": 1000, + "gold": 1, + "durability": 1000, + "damage": "5" + }, + { + "name": "Schnee", + "durability": 10, + "damage": "1", + "amountShop": 100, + "gold": 1, + "crafting": true + }, + { + "name": "Yetikralle", + "durability": 1000, + "amountShop": 250, + "crafting": true, + "gold": 5, + "damage": "20" + }, + { + "name": "Löwenkralle", + "durability": 1000, + "amountShop": 400, + "damage": "10", + "crafting": true, + "gold": 3 + }, + { + "name": "Feuerstein", + "damage": "5-10", + "crafting": true, + "durability": 1000, + "gold": 2, + "amountShop": 1500 + }, + { + "name": "Lehm", + "durability": 1000, + "gold": 1, + "damage": "0", + "crafting": true, + "amountShop": 3000 + }, + { + "name": "Giftblume", + "durability": 1000, + "amountShop": 300, + "gold": 1, + "damage": "15-20", + "crafting": true + }, + { + "name": "Drachenzahn", + "amountShop": 300, + "crafting": true, + "damage": "5", + "durability": 1000, + "gold": 3 + }, + { + "name": "Drachenhaut", + "amountShop": 200, + "gold": 3, + "damage": "0", + "crafting": true, + "durability": 1000 + }, + { + "name": "Sand", + "damage": "1", + "amountShop": 1500, + "crafting": true, + "durability": 1000, + "gold": 1 + }, + { + "name": "Knochen", + "durability": 1000, + "amountShop": 450, + "gold": 2, + "damage": "6", + "crafting": true + }, + { + "name": "Kaktus", + "gold": 2, + "amountShop": 700, + "damage": "5", + "crafting": true, "durability": 1000 } ] \ No newline at end of file From 3b3cffbc4ad68796a9702a41e89840a6c1b685ca Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Wed, 25 Jan 2023 21:10:47 +0100 Subject: [PATCH 03/56] Created mobs --- src/main/resources/gameconfig.json | 53 ++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/src/main/resources/gameconfig.json b/src/main/resources/gameconfig.json index 9d6c929..37d2e6d 100644 --- a/src/main/resources/gameconfig.json +++ b/src/main/resources/gameconfig.json @@ -39,6 +39,16 @@ "items": [ "Sand", "Treibholz" + ], + "mobs": [ + { + "name": "Riesenkrabbe", + "damage": "10-15", + "hp": 50, + "items": [ + "Krabbenschere" + ] + } ] }, { @@ -46,6 +56,17 @@ "items": [ "Eiszapfen", "Schnee" + ], + "mobs": [ + { + "name": "Yeti", + "hp": 55, + "items": [ + "Fell", + "Yetikralle" + ], + "damage": "20-25" + } ] }, { @@ -53,6 +74,17 @@ "items": [ "Quellwasser", "Feuerstein" + ], + "mobs": [ + { + "name": "Loewe", + "damage": "10-15", + "items": [ + "Fell", + "Löwenkralle" + ], + "hp": 30 + } ] }, { @@ -60,6 +92,17 @@ "items": [ "Lehm", "Giftblume" + ], + "mobs": [ + { + "name": "Drache", + "hp": 55, + "damage": "15-20", + "items": [ + "Drachenzahn", + "Drachenhaut" + ] + } ] }, { @@ -67,6 +110,16 @@ "items": [ "Sand", "Kaktus" + ], + "mobs": [ + { + "name": "Mumie", + "items": [ + "Knochen" + ], + "hp": 40, + "damage": "10-15" + } ] } ] From 5b12c01271a917ff6839f869e7b16300355948c3 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Wed, 25 Jan 2023 21:58:10 +0100 Subject: [PATCH 04/56] refactoring: reordered properties of items --- src/main/resources/items.json | 92 +++++++++++++++++------------------ 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/src/main/resources/items.json b/src/main/resources/items.json index da0e7be..83d7495 100644 --- a/src/main/resources/items.json +++ b/src/main/resources/items.json @@ -3,88 +3,88 @@ "name": "Holz", "damage": "1-3", "crafting": true, - "gold": 10, "durability": 1000, - "amountShop": 10 + "amountShop": 10, + "gold": 10 }, { "name": "Heiliges Schwert der Engel", "damage": "1000", "crafting": false, + "durability": 1000, "amountShop": 1, - "gold": 1000, - "durability": 1000 + "gold": 1000 }, { "name": "Stein", "damage": "5-10", "crafting": true, - "amountShop": 1500, "durability": 1000, + "amountShop": 1500, "gold": 2 }, { "name": "Fell", "damage": "0", "crafting": true, - "gold": 100, "durability": 1000, - "amountShop": 500 + "amountShop": 500, + "gold": 100 }, { "name": "Sand", - "gold": 1, + "damage": "2", "crafting": true, "durability": 1000, - "damage": "2", - "amountShop": 1500 + "amountShop": 1500, + "gold": 1 }, { "name": "Treibholz", - "amountShop": 1000, "damage": "1", "crafting": true, - "gold": 1, - "durability": 1000 + "durability": 1000, + "amountShop": 1000, + "gold": 1 }, { "name": "Krabbenschere", "damage": "4", + "crafting": true, "durability": 1000, "amountShop": 750, - "gold": 1, - "crafting": true + "gold": 1 }, { "name": "Eiszapfen", + "damage": "5", "crafting": true, - "amountShop": 1000, - "gold": 1, "durability": 1000, - "damage": "5" + "amountShop": 1000, + "gold": 1 }, { "name": "Schnee", - "durability": 10, "damage": "1", + "crafting": true, + "durability": 10, "amountShop": 100, - "gold": 1, - "crafting": true + "gold": 1 }, { "name": "Yetikralle", + "damage": "20", + "crafting": true, "durability": 1000, "amountShop": 250, - "crafting": true, - "gold": 5, - "damage": "20" + "gold": 5 }, { "name": "Löwenkralle", - "durability": 1000, - "amountShop": 400, "damage": "10", "crafting": true, + "durability": 1000, + "amountShop": 400, "gold": 3 }, { @@ -92,63 +92,63 @@ "damage": "5-10", "crafting": true, "durability": 1000, - "gold": 2, - "amountShop": 1500 + "amountShop": 1500, + "gold": 2 }, { "name": "Lehm", - "durability": 1000, - "gold": 1, "damage": "0", "crafting": true, - "amountShop": 3000 + "durability": 1000, + "amountShop": 3000, + "gold": 1 }, { "name": "Giftblume", + "damage": "15-20", + "crafting": true, "durability": 1000, "amountShop": 300, - "gold": 1, - "damage": "15-20", - "crafting": true + "gold": 1 }, { "name": "Drachenzahn", - "amountShop": 300, - "crafting": true, "damage": "5", + "crafting": true, "durability": 1000, + "amountShop": 300, "gold": 3 }, { "name": "Drachenhaut", - "amountShop": 200, - "gold": 3, "damage": "0", "crafting": true, - "durability": 1000 + "durability": 1000, + "amountShop": 200, + "gold": 3 }, { "name": "Sand", "damage": "1", - "amountShop": 1500, "crafting": true, "durability": 1000, + "amountShop": 1500, "gold": 1 }, { "name": "Knochen", + "damage": "6", + "crafting": true, "durability": 1000, "amountShop": 450, - "gold": 2, - "damage": "6", - "crafting": true + "gold": 2 }, { "name": "Kaktus", - "gold": 2, - "amountShop": 700, "damage": "5", "crafting": true, - "durability": 1000 + "durability": 1000, + "amountShop": 700, + "gold": 2 } ] \ No newline at end of file From 1208eda908411acc8cf479ed093a496607f41d8d Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Wed, 1 Feb 2023 10:38:03 +0100 Subject: [PATCH 05/56] refactoring: created mobs.json, outsourced the mobs --- src/main/resources/gameconfig.json | 57 ++++-------------------------- src/main/resources/mobs.json | 53 +++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 51 deletions(-) create mode 100644 src/main/resources/mobs.json diff --git a/src/main/resources/gameconfig.json b/src/main/resources/gameconfig.json index 37d2e6d..13219e9 100644 --- a/src/main/resources/gameconfig.json +++ b/src/main/resources/gameconfig.json @@ -24,14 +24,7 @@ "Stein" ], "mobs": [ - { - "name": "Big Foot", - "hp": 50, - "damage": "10-15", - "items": [ - "Fell" - ] - } + "Big Foot" ] }, { @@ -41,14 +34,7 @@ "Treibholz" ], "mobs": [ - { - "name": "Riesenkrabbe", - "damage": "10-15", - "hp": 50, - "items": [ - "Krabbenschere" - ] - } + "Riesenkrabbe" ] }, { @@ -58,15 +44,7 @@ "Schnee" ], "mobs": [ - { - "name": "Yeti", - "hp": 55, - "items": [ - "Fell", - "Yetikralle" - ], - "damage": "20-25" - } + "Yeti" ] }, { @@ -76,15 +54,7 @@ "Feuerstein" ], "mobs": [ - { - "name": "Loewe", - "damage": "10-15", - "items": [ - "Fell", - "Löwenkralle" - ], - "hp": 30 - } + "Loewe" ] }, { @@ -94,15 +64,7 @@ "Giftblume" ], "mobs": [ - { - "name": "Drache", - "hp": 55, - "damage": "15-20", - "items": [ - "Drachenzahn", - "Drachenhaut" - ] - } + "Drache" ] }, { @@ -112,14 +74,7 @@ "Kaktus" ], "mobs": [ - { - "name": "Mumie", - "items": [ - "Knochen" - ], - "hp": 40, - "damage": "10-15" - } + "Mumie" ] } ] diff --git a/src/main/resources/mobs.json b/src/main/resources/mobs.json new file mode 100644 index 0000000..c227a27 --- /dev/null +++ b/src/main/resources/mobs.json @@ -0,0 +1,53 @@ +[ + { + "name": "Big Foot", + "hp": 50, + "damage": "10-15", + "items": [ + "Fell" + ] + }, + { + "name": "Riesenkrabbe", + "damage": "10-15", + "hp": 50, + "items": [ + "Krabbenschere" + ] + }, + { + "name": "Yeti", + "hp": 55, + "items": [ + "Fell", + "Yetikralle" + ], + "damage": "20-25" + }, + { + "name": "Loewe", + "damage": "10-15", + "items": [ + "Fell", + "Löwenkralle" + ], + "hp": 30 + }, + { + "name": "Drache", + "hp": 55, + "damage": "15-20", + "items": [ + "Drachenzahn", + "Drachenhaut" + ] + }, + { + "name": "Mumie", + "items": [ + "Knochen" + ], + "hp": 40, + "damage": "10-15" + } +] \ No newline at end of file From 45c7767b46bfa432036fe640ee884da1e436aec1 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Wed, 1 Feb 2023 10:42:43 +0100 Subject: [PATCH 06/56] refactoring: reordered properties of mobs --- src/main/resources/mobs.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/resources/mobs.json b/src/main/resources/mobs.json index c227a27..ce14a1a 100644 --- a/src/main/resources/mobs.json +++ b/src/main/resources/mobs.json @@ -9,8 +9,8 @@ }, { "name": "Riesenkrabbe", - "damage": "10-15", "hp": 50, + "damage": "10-15", "items": [ "Krabbenschere" ] @@ -18,20 +18,20 @@ { "name": "Yeti", "hp": 55, + "damage": "20-25", "items": [ "Fell", "Yetikralle" - ], - "damage": "20-25" + ] }, { "name": "Loewe", + "hp": 30, "damage": "10-15", "items": [ "Fell", - "Löwenkralle" - ], - "hp": 30 + "Loewenkralle" + ] }, { "name": "Drache", @@ -44,10 +44,10 @@ }, { "name": "Mumie", + "hp": 40, + "damage": "10-15", "items": [ "Knochen" - ], - "hp": 40, - "damage": "10-15" + ] } ] \ No newline at end of file From 9c5dbc57d7d1ac3825c5e547e12dfc502bdaf465 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Wed, 1 Feb 2023 14:56:46 +0100 Subject: [PATCH 07/56] Unittest: MapCommand --- .../bitbiome/commands/CommandListener.java | 1 + .../org/bitbiome/commands/MapCommand.java | 23 +++++++++++++++++++ .../org/bitbiome/commands/MapCommandTest.java | 18 +++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 src/main/java/org/bitbiome/commands/MapCommand.java create mode 100644 src/test/java/org/bitbiome/commands/MapCommandTest.java diff --git a/src/main/java/org/bitbiome/commands/CommandListener.java b/src/main/java/org/bitbiome/commands/CommandListener.java index d59813c..7d03184 100644 --- a/src/main/java/org/bitbiome/commands/CommandListener.java +++ b/src/main/java/org/bitbiome/commands/CommandListener.java @@ -18,6 +18,7 @@ public class CommandListener { commands.put("quit", new QuitCommand()); commands.put("location", new LocationCommand()); commands.put("travel", new TravelCommand()); + commands.put("map", new MapCommand()); } public HashMap returnCommands() { diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java new file mode 100644 index 0000000..3b1620c --- /dev/null +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -0,0 +1,23 @@ +package org.bitbiome.commands; + +import org.bitbiome.classes.TravelEngine; + +import java.util.Scanner; + +public class MapCommand implements CommandAPI{ + + @Override + public void performCommand(Scanner scanner, boolean isRunning, String message, TravelEngine travelEngine) { + System.out.println(getMapMessage()); + } + public static String getMapMessage() { + StringBuilder outputMessage = new StringBuilder(); + outputMessage + .append("Map:\n") + .append("Wueste Gruendland Winterland\n\n") + .append("Strand Wald Berge\n\n"); + return outputMessage.toString(); + } + + +} diff --git a/src/test/java/org/bitbiome/commands/MapCommandTest.java b/src/test/java/org/bitbiome/commands/MapCommandTest.java new file mode 100644 index 0000000..def2566 --- /dev/null +++ b/src/test/java/org/bitbiome/commands/MapCommandTest.java @@ -0,0 +1,18 @@ +package org.bitbiome.commands; + +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class MapCommandTest { + @Test + public void testMapCommand() { + String mapMessage = MapCommand.getMapMessage(); + StringBuilder outputMessage = new StringBuilder(); + outputMessage + .append("Map:\n") + .append("Wueste Gruendland Winterland\n\n") + .append("Strand Wald Berge\n\n"); + assertEquals(outputMessage.toString(), mapMessage); + } +} From 9166dc2d186fd676e5b2d91803d41e283249d418 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Fri, 3 Feb 2023 20:46:39 +0100 Subject: [PATCH 08/56] Unittest: integrate TravelEngine and Player --- .../java/org/bitbiome/commands/MapCommand.java | 18 ++++++++---------- .../org/bitbiome/commands/MapCommandTest.java | 8 ++++++-- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index 3b1620c..44cdd6a 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -1,23 +1,21 @@ package org.bitbiome.commands; - import org.bitbiome.classes.TravelEngine; - +import org.json.JSONArray; import java.util.Scanner; public class MapCommand implements CommandAPI{ - @Override public void performCommand(Scanner scanner, boolean isRunning, String message, TravelEngine travelEngine) { - System.out.println(getMapMessage()); + System.out.println(getMapMessage(travelEngine)); } - public static String getMapMessage() { + public static String getMapMessage(TravelEngine travelEngine) { StringBuilder outputMessage = new StringBuilder(); - outputMessage - .append("Map:\n") - .append("Wueste Gruendland Winterland\n\n") - .append("Strand Wald Berge\n\n"); + JSONArray locations = travelEngine.getLocationList(); + outputMessage + .append("Map:\n") + .append("Wueste Gruenland Winterland\n\n") + .append("Strand Wald Berge\n\n"); return outputMessage.toString(); } - } diff --git a/src/test/java/org/bitbiome/commands/MapCommandTest.java b/src/test/java/org/bitbiome/commands/MapCommandTest.java index def2566..10f2407 100644 --- a/src/test/java/org/bitbiome/commands/MapCommandTest.java +++ b/src/test/java/org/bitbiome/commands/MapCommandTest.java @@ -1,5 +1,7 @@ package org.bitbiome.commands; +import org.bitbiome.classes.TravelEngine; +import org.bitbiome.entities.Player; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -7,11 +9,13 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class MapCommandTest { @Test public void testMapCommand() { - String mapMessage = MapCommand.getMapMessage(); + Player Test = new Player("name"); + TravelEngine outputtest = new TravelEngine(Test); + String mapMessage = MapCommand.getMapMessage(outputtest); StringBuilder outputMessage = new StringBuilder(); outputMessage .append("Map:\n") - .append("Wueste Gruendland Winterland\n\n") + .append("Wueste Gruenland Winterland\n\n") .append("Strand Wald Berge\n\n"); assertEquals(outputMessage.toString(), mapMessage); } From d4c2fb94964d89ee5d0f85eae5387c390c1dcba2 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Fri, 3 Feb 2023 20:48:49 +0100 Subject: [PATCH 09/56] Integrated Locations --- src/main/java/org/bitbiome/commands/MapCommand.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index 44cdd6a..2c5906a 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -13,8 +13,9 @@ public class MapCommand implements CommandAPI{ JSONArray locations = travelEngine.getLocationList(); outputMessage .append("Map:\n") - .append("Wueste Gruenland Winterland\n\n") - .append("Strand Wald Berge\n\n"); + .append(locations.getJSONObject(5).getString("name") + " " + locations.getJSONObject(4).getString("name") + " " + locations.getJSONObject(2).getString("name") + "\n\n") + .append(locations.getJSONObject(1).getString("name") + " " + locations.getJSONObject(0).getString("name") + " " + locations.getJSONObject(3).getString("name") + "\n\n"); + return outputMessage.toString(); } From b6d57e2cf52903bed845c9ad6aa9c52d3dddac88 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Fri, 3 Feb 2023 21:05:55 +0100 Subject: [PATCH 10/56] Unittest: Coloring --- src/main/java/org/bitbiome/commands/MapCommand.java | 11 ++++++++--- .../java/org/bitbiome/commands/MapCommandTest.java | 9 ++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index 2c5906a..9c77559 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -2,19 +2,24 @@ package org.bitbiome.commands; import org.bitbiome.classes.TravelEngine; import org.json.JSONArray; import java.util.Scanner; +import org.bitbiome.classes.Colors; public class MapCommand implements CommandAPI{ @Override public void performCommand(Scanner scanner, boolean isRunning, String message, TravelEngine travelEngine) { System.out.println(getMapMessage(travelEngine)); } + public static String getLocationMessage(TravelEngine travelEngine) { + return "Du befindest dich gerade hier: " + travelEngine.getPlayer().getLocation().getName(); + } public static String getMapMessage(TravelEngine travelEngine) { StringBuilder outputMessage = new StringBuilder(); JSONArray locations = travelEngine.getLocationList(); outputMessage - .append("Map:\n") - .append(locations.getJSONObject(5).getString("name") + " " + locations.getJSONObject(4).getString("name") + " " + locations.getJSONObject(2).getString("name") + "\n\n") - .append(locations.getJSONObject(1).getString("name") + " " + locations.getJSONObject(0).getString("name") + " " + locations.getJSONObject(3).getString("name") + "\n\n"); + .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + "Deine Karte:\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + locations.getJSONObject(5).getString("name") + " " + locations.getJSONObject(4).getString("name") + " " + locations.getJSONObject(2).getString("name") + "\n\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + locations.getJSONObject(1).getString("name") + " " + locations.getJSONObject(0).getString("name") + " " + locations.getJSONObject(3).getString("name") + "\n\n" + Colors.ANSI_RESET); return outputMessage.toString(); } diff --git a/src/test/java/org/bitbiome/commands/MapCommandTest.java b/src/test/java/org/bitbiome/commands/MapCommandTest.java index 10f2407..02c896e 100644 --- a/src/test/java/org/bitbiome/commands/MapCommandTest.java +++ b/src/test/java/org/bitbiome/commands/MapCommandTest.java @@ -1,5 +1,6 @@ package org.bitbiome.commands; +import org.bitbiome.classes.Colors; import org.bitbiome.classes.TravelEngine; import org.bitbiome.entities.Player; import org.junit.jupiter.api.Test; @@ -14,9 +15,11 @@ public class MapCommandTest { String mapMessage = MapCommand.getMapMessage(outputtest); StringBuilder outputMessage = new StringBuilder(); outputMessage - .append("Map:\n") - .append("Wueste Gruenland Winterland\n\n") - .append("Strand Wald Berge\n\n"); + .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Wald" + "\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + "Deine Karte:\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + "Wueste" + " " + "Gruenland" + " " + "Winterland" + "\n\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + "Strand" + " " + "Wald" + " " + "Berge" + "\n\n" + Colors.ANSI_RESET); + assertEquals(outputMessage.toString(), mapMessage); } } From 65e91f11b8eca36ee04ed3739b2fc5393dd65cb4 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Fri, 3 Feb 2023 22:52:51 +0100 Subject: [PATCH 11/56] refactoring: removed String-separations --- src/test/java/org/bitbiome/commands/MapCommandTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/bitbiome/commands/MapCommandTest.java b/src/test/java/org/bitbiome/commands/MapCommandTest.java index 02c896e..2f28573 100644 --- a/src/test/java/org/bitbiome/commands/MapCommandTest.java +++ b/src/test/java/org/bitbiome/commands/MapCommandTest.java @@ -17,8 +17,8 @@ public class MapCommandTest { outputMessage .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Wald" + "\n" + Colors.ANSI_RESET) .append(Colors.ANSI_BLUE + "Deine Karte:\n" + Colors.ANSI_RESET) - .append(Colors.ANSI_BLUE + "Wueste" + " " + "Gruenland" + " " + "Winterland" + "\n\n" + Colors.ANSI_RESET) - .append(Colors.ANSI_BLUE + "Strand" + " " + "Wald" + " " + "Berge" + "\n\n" + Colors.ANSI_RESET); + .append(Colors.ANSI_BLUE + "Wueste Gruenland Winterland\n\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + "Strand Wald Berge\n\n" + Colors.ANSI_RESET); assertEquals(outputMessage.toString(), mapMessage); } From 1d581ea146ca3b7c614f35a358486f5a70739ebf Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Fri, 3 Feb 2023 23:27:23 +0100 Subject: [PATCH 12/56] Unittest: changed deception map --- .../java/org/bitbiome/commands/MapCommand.java | 15 ++++++++++++--- .../org/bitbiome/commands/MapCommandTest.java | 16 +++++++++++++--- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index 9c77559..633a77d 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -17,9 +17,18 @@ public class MapCommand implements CommandAPI{ JSONArray locations = travelEngine.getLocationList(); outputMessage .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET) - .append(Colors.ANSI_BLUE + "Deine Karte:\n" + Colors.ANSI_RESET) - .append(Colors.ANSI_BLUE + locations.getJSONObject(5).getString("name") + " " + locations.getJSONObject(4).getString("name") + " " + locations.getJSONObject(2).getString("name") + "\n\n" + Colors.ANSI_RESET) - .append(Colors.ANSI_BLUE + locations.getJSONObject(1).getString("name") + " " + locations.getJSONObject(0).getString("name") + " " + locations.getJSONObject(3).getString("name") + "\n\n" + Colors.ANSI_RESET); + .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append(" __________________________________________________________________________________________________\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BLUE + locations.getJSONObject(5).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BLUE + locations.getJSONObject(1).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n"); return outputMessage.toString(); } diff --git a/src/test/java/org/bitbiome/commands/MapCommandTest.java b/src/test/java/org/bitbiome/commands/MapCommandTest.java index 2f28573..515d572 100644 --- a/src/test/java/org/bitbiome/commands/MapCommandTest.java +++ b/src/test/java/org/bitbiome/commands/MapCommandTest.java @@ -16,9 +16,19 @@ public class MapCommandTest { StringBuilder outputMessage = new StringBuilder(); outputMessage .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Wald" + "\n" + Colors.ANSI_RESET) - .append(Colors.ANSI_BLUE + "Deine Karte:\n" + Colors.ANSI_RESET) - .append(Colors.ANSI_BLUE + "Wueste Gruenland Winterland\n\n" + Colors.ANSI_RESET) - .append(Colors.ANSI_BLUE + "Strand Wald Berge\n\n" + Colors.ANSI_RESET); + .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append(" __________________________________________________________________________________________________\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BLUE + "Wueste" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Gruenland" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Winterland" + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BLUE + "Strand" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Wald" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Berge" + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n"); + assertEquals(outputMessage.toString(), mapMessage); } From 3789cfb6ec4a0900a7be50444e154fce8fc1372c Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 13:07:41 +0100 Subject: [PATCH 13/56] Unittest: colored traveloption Waldmap --- .../org/bitbiome/commands/MapCommand.java | 18 +++++++++- .../org/bitbiome/commands/MapCommandTest.java | 35 ++++++++++++++++++- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index 633a77d..0c271de 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -15,6 +15,22 @@ public class MapCommand implements CommandAPI{ public static String getMapMessage(TravelEngine travelEngine) { StringBuilder outputMessage = new StringBuilder(); JSONArray locations = travelEngine.getLocationList(); + if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wald")) { + outputMessage + .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + "Zu den blau markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append(" __________________________________________________________________________________________________\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(5).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BLUE + locations.getJSONObject(1).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n"); + } else { outputMessage .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET) .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) @@ -29,7 +45,7 @@ public class MapCommand implements CommandAPI{ .append("| " + Colors.ANSI_BLUE + locations.getJSONObject(1).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); - + } return outputMessage.toString(); } diff --git a/src/test/java/org/bitbiome/commands/MapCommandTest.java b/src/test/java/org/bitbiome/commands/MapCommandTest.java index 515d572..599dd8b 100644 --- a/src/test/java/org/bitbiome/commands/MapCommandTest.java +++ b/src/test/java/org/bitbiome/commands/MapCommandTest.java @@ -2,20 +2,52 @@ package org.bitbiome.commands; import org.bitbiome.classes.Colors; import org.bitbiome.classes.TravelEngine; +import org.bitbiome.entities.Location; +import org.bitbiome.entities.Mob; import org.bitbiome.entities.Player; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; + + public class MapCommandTest { + @Test + public void testWaldMapCommand() { + Player Test = new Player("name"); + TravelEngine outputtest = new TravelEngine(Test); + Location Wald = outputtest.getLocationByName("Wald"); + outputtest.travelTo(Wald); + String mapMessage = MapCommand.getMapMessage(outputtest); + StringBuilder outputMessage = new StringBuilder(); + outputMessage + .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Wald" + "\n" + "Zu den blau markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append(" __________________________________________________________________________________________________\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + "Wueste" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Gruenland" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Winterland" + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BLUE + "Strand" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Wald" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Berge" + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n"); + + + assertEquals(outputMessage.toString(), mapMessage); + } @Test public void testMapCommand() { Player Test = new Player("name"); TravelEngine outputtest = new TravelEngine(Test); + Location Winter = outputtest.getLocationByName("Winterland"); + outputtest.travelTo(Winter); String mapMessage = MapCommand.getMapMessage(outputtest); StringBuilder outputMessage = new StringBuilder(); outputMessage - .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Wald" + "\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Winterland" + "\n" + Colors.ANSI_RESET) .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") @@ -33,3 +65,4 @@ public class MapCommandTest { assertEquals(outputMessage.toString(), mapMessage); } } + From 35d77a5e5da109291bf4eb4b606601e1e39ab49c Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 13:20:17 +0100 Subject: [PATCH 14/56] Unittest: colored traveloption Strandmap --- .../org/bitbiome/commands/MapCommand.java | 16 ++++++++++++ .../org/bitbiome/commands/MapCommandTest.java | 26 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index 0c271de..3128531 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -30,6 +30,22 @@ public class MapCommand implements CommandAPI{ .append("| " + Colors.ANSI_BLUE + locations.getJSONObject(1).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); + } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Strand")) { + outputMessage + .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + "Zu den blau markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append(" __________________________________________________________________________________________________\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BLUE + locations.getJSONObject(5).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(1).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n"); + } else { outputMessage .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET) diff --git a/src/test/java/org/bitbiome/commands/MapCommandTest.java b/src/test/java/org/bitbiome/commands/MapCommandTest.java index 599dd8b..a4c5acf 100644 --- a/src/test/java/org/bitbiome/commands/MapCommandTest.java +++ b/src/test/java/org/bitbiome/commands/MapCommandTest.java @@ -36,6 +36,32 @@ public class MapCommandTest { .append("|________________________________|________________________________|________________________________|\n"); + assertEquals(outputMessage.toString(), mapMessage); + } + @Test + public void testStrandMapCommand() { + Player Test = new Player("name"); + TravelEngine outputtest = new TravelEngine(Test); + Location Strand = outputtest.getLocationByName("Strand"); + outputtest.travelTo(Strand); + String mapMessage = MapCommand.getMapMessage(outputtest); + StringBuilder outputMessage = new StringBuilder(); + outputMessage + .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Strand" + "\n" + "Zu den blau markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append(" __________________________________________________________________________________________________\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BLUE + "Wueste" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Gruenland" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Winterland" + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + "Strand" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Wald" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Berge" + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n"); + + assertEquals(outputMessage.toString(), mapMessage); } @Test From 38a692f8d69966fc1b53c7ff8e68265b860f8d3b Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 13:30:57 +0100 Subject: [PATCH 15/56] Unittest: colored traveloption Bergemap --- .../org/bitbiome/commands/MapCommand.java | 16 ++++++++++++ .../org/bitbiome/commands/MapCommandTest.java | 26 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index 3128531..0928764 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -46,6 +46,22 @@ public class MapCommand implements CommandAPI{ .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); + } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Berge")) { + outputMessage + .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + "Zu den blau markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append(" __________________________________________________________________________________________________\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(5).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(1).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n"); + } else { outputMessage .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET) diff --git a/src/test/java/org/bitbiome/commands/MapCommandTest.java b/src/test/java/org/bitbiome/commands/MapCommandTest.java index a4c5acf..0b32598 100644 --- a/src/test/java/org/bitbiome/commands/MapCommandTest.java +++ b/src/test/java/org/bitbiome/commands/MapCommandTest.java @@ -62,6 +62,32 @@ public class MapCommandTest { .append("|________________________________|________________________________|________________________________|\n"); + assertEquals(outputMessage.toString(), mapMessage); + } + @Test + public void testBergeMapCommand() { + Player Test = new Player("name"); + TravelEngine outputtest = new TravelEngine(Test); + Location Berge = outputtest.getLocationByName("Berge"); + outputtest.travelTo(Berge); + String mapMessage = MapCommand.getMapMessage(outputtest); + StringBuilder outputMessage = new StringBuilder(); + outputMessage + .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Berge" + "\n" + "Zu den blau markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append(" __________________________________________________________________________________________________\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + "Wueste" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Gruenland" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Winterland" + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + "Strand" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Wald" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Berge" + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n"); + + assertEquals(outputMessage.toString(), mapMessage); } @Test From c1e75850108a9d0466a4b5f29036fd77da17d66b Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 14:38:11 +0100 Subject: [PATCH 16/56] Updated Testlocations --- src/test/java/org/bitbiome/commands/LocationCommandTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/bitbiome/commands/LocationCommandTest.java b/src/test/java/org/bitbiome/commands/LocationCommandTest.java index 23c6541..8ad14dc 100644 --- a/src/test/java/org/bitbiome/commands/LocationCommandTest.java +++ b/src/test/java/org/bitbiome/commands/LocationCommandTest.java @@ -14,7 +14,7 @@ public class LocationCommandTest { public void testLocationCommand() { Player p = new Player("Unit"); TravelEngine tE = new TravelEngine(p); - String[] standorte = {"Wald", "Strand"}; + String[] standorte = {"Wald", "Strand", "Berge", "Wueste", "Winterland", "Gruenland"}; String locationMessage = LocationCommand.getLocationMessage(tE).split(": ")[1]; assertTrue(Arrays.asList(standorte).contains(locationMessage)); } From be80f510e10476749de7ff8ac551227925ed026d Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 14:39:44 +0100 Subject: [PATCH 17/56] Added Item Quellwasser --- src/main/resources/items.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/resources/items.json b/src/main/resources/items.json index 83d7495..5edb067 100644 --- a/src/main/resources/items.json +++ b/src/main/resources/items.json @@ -80,7 +80,7 @@ "gold": 5 }, { - "name": "Löwenkralle", + "name": "Loewenkralle", "damage": "10", "crafting": true, "durability": 1000, @@ -95,6 +95,14 @@ "amountShop": 1500, "gold": 2 }, + { + "name": "Quellwasser", + "damage": "0", + "crafting": true, + "durability": 5, + "amountShop": 1500, + "gold": 1 + }, { "name": "Lehm", "damage": "0", From 05a2fc6e78aa1de2b238794fc158e1883075c39e Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 14:42:43 +0100 Subject: [PATCH 18/56] Unittest: colored traveloption Wuestemap --- .../org/bitbiome/commands/MapCommand.java | 16 ++++++++++++ .../org/bitbiome/commands/MapCommandTest.java | 26 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index 0928764..e9d5cde 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -62,6 +62,22 @@ public class MapCommand implements CommandAPI{ .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); + } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wueste")) { + outputMessage + .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + "Zu den blau markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append(" __________________________________________________________________________________________________\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(5).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BLUE + locations.getJSONObject(1).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n"); + } else { outputMessage .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET) diff --git a/src/test/java/org/bitbiome/commands/MapCommandTest.java b/src/test/java/org/bitbiome/commands/MapCommandTest.java index 0b32598..682197a 100644 --- a/src/test/java/org/bitbiome/commands/MapCommandTest.java +++ b/src/test/java/org/bitbiome/commands/MapCommandTest.java @@ -88,6 +88,32 @@ public class MapCommandTest { .append("|________________________________|________________________________|________________________________|\n"); + assertEquals(outputMessage.toString(), mapMessage); + } + @Test + public void testWuesteMapCommand() { + Player Test = new Player("name"); + TravelEngine outputtest = new TravelEngine(Test); + Location Wueste = outputtest.getLocationByName("Wueste"); + outputtest.travelTo(Wueste); + String mapMessage = MapCommand.getMapMessage(outputtest); + StringBuilder outputMessage = new StringBuilder(); + outputMessage + .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Wueste" + "\n" + "Zu den blau markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append(" __________________________________________________________________________________________________\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + "Wueste" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Gruenland" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Winterland" + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BLUE + "Strand" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Wald" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Berge" + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n"); + + assertEquals(outputMessage.toString(), mapMessage); } @Test From 7589c79f3cb39b9787b86c1ee39f4bca518ec0ae Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 14:49:44 +0100 Subject: [PATCH 19/56] Unittest: colored traveloption Gruenlandmap --- .../org/bitbiome/commands/MapCommand.java | 16 ++++++++++++ .../org/bitbiome/commands/MapCommandTest.java | 25 +++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index e9d5cde..14952ff 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -78,6 +78,22 @@ public class MapCommand implements CommandAPI{ .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); + } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Gruenland")) { + outputMessage + .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + "Zu den blau markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append(" __________________________________________________________________________________________________\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BLUE + locations.getJSONObject(5).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(1).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n"); + } else { outputMessage .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET) diff --git a/src/test/java/org/bitbiome/commands/MapCommandTest.java b/src/test/java/org/bitbiome/commands/MapCommandTest.java index 682197a..1eee876 100644 --- a/src/test/java/org/bitbiome/commands/MapCommandTest.java +++ b/src/test/java/org/bitbiome/commands/MapCommandTest.java @@ -114,6 +114,31 @@ public class MapCommandTest { .append("|________________________________|________________________________|________________________________|\n"); + assertEquals(outputMessage.toString(), mapMessage); + } + public void testGruenlandMapCommand() { + Player Test = new Player("name"); + TravelEngine outputtest = new TravelEngine(Test); + Location Gruenland = outputtest.getLocationByName("Gruenland"); + outputtest.travelTo(Gruenland); + String mapMessage = MapCommand.getMapMessage(outputtest); + StringBuilder outputMessage = new StringBuilder(); + outputMessage + .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Gruenland" + "\n" + "Zu den blau markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append(" __________________________________________________________________________________________________\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BLUE + "Wueste" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Gruenland" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Winterland" + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n") + .append("| | | |\n") + .append("| | | |\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + "Strand" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Wald" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Berge" + Colors.ANSI_RESET + " |" + "\n") + .append("| | | |\n") + .append("|________________________________|________________________________|________________________________|\n"); + + assertEquals(outputMessage.toString(), mapMessage); } @Test From 113d4935945325895ad770902d0d18a590d07b99 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 15:13:53 +0100 Subject: [PATCH 20/56] Unittest: colored traveloption Winterlandmap --- src/main/java/org/bitbiome/commands/MapCommand.java | 4 ++-- .../java/org/bitbiome/commands/MapCommandTest.java | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index 14952ff..27f00ca 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -101,12 +101,12 @@ public class MapCommand implements CommandAPI{ .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BLUE + locations.getJSONObject(5).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(5).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BLUE + locations.getJSONObject(1).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(1).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); } diff --git a/src/test/java/org/bitbiome/commands/MapCommandTest.java b/src/test/java/org/bitbiome/commands/MapCommandTest.java index 1eee876..67eb912 100644 --- a/src/test/java/org/bitbiome/commands/MapCommandTest.java +++ b/src/test/java/org/bitbiome/commands/MapCommandTest.java @@ -142,11 +142,11 @@ public class MapCommandTest { assertEquals(outputMessage.toString(), mapMessage); } @Test - public void testMapCommand() { + public void testWinterlandMapCommand() { Player Test = new Player("name"); TravelEngine outputtest = new TravelEngine(Test); - Location Winter = outputtest.getLocationByName("Winterland"); - outputtest.travelTo(Winter); + Location Winterland = outputtest.getLocationByName("Winterland"); + outputtest.travelTo(Winterland); String mapMessage = MapCommand.getMapMessage(outputtest); StringBuilder outputMessage = new StringBuilder(); outputMessage @@ -155,12 +155,12 @@ public class MapCommandTest { .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BLUE + "Wueste" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Gruenland" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Winterland" + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + "Wueste" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Gruenland" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Winterland" + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BLUE + "Strand" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Wald" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Berge" + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + "Strand" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Wald" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Berge" + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); From 2dbda7b864e27444a4baa4b466a6378bf62b5803 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 16:00:15 +0100 Subject: [PATCH 21/56] Unittest: Changed color description map --- src/main/java/org/bitbiome/commands/MapCommand.java | 12 ++++++------ .../java/org/bitbiome/commands/MapCommandTest.java | 13 +++++++------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index 27f00ca..b686392 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -17,7 +17,7 @@ public class MapCommand implements CommandAPI{ JSONArray locations = travelEngine.getLocationList(); if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wald")) { outputMessage - .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + "Zu den blau markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") @@ -32,7 +32,7 @@ public class MapCommand implements CommandAPI{ .append("|________________________________|________________________________|________________________________|\n"); } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Strand")) { outputMessage - .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + "Zu den blau markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") @@ -48,7 +48,7 @@ public class MapCommand implements CommandAPI{ } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Berge")) { outputMessage - .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + "Zu den blau markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") @@ -64,7 +64,7 @@ public class MapCommand implements CommandAPI{ } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wueste")) { outputMessage - .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + "Zu den blau markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") @@ -80,7 +80,7 @@ public class MapCommand implements CommandAPI{ } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Gruenland")) { outputMessage - .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + "Zu den blau markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") @@ -96,7 +96,7 @@ public class MapCommand implements CommandAPI{ } else { outputMessage - .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") diff --git a/src/test/java/org/bitbiome/commands/MapCommandTest.java b/src/test/java/org/bitbiome/commands/MapCommandTest.java index 67eb912..055c9bc 100644 --- a/src/test/java/org/bitbiome/commands/MapCommandTest.java +++ b/src/test/java/org/bitbiome/commands/MapCommandTest.java @@ -21,7 +21,7 @@ public class MapCommandTest { String mapMessage = MapCommand.getMapMessage(outputtest); StringBuilder outputMessage = new StringBuilder(); outputMessage - .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Wald" + "\n" + "Zu den blau markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Wald" + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") @@ -47,7 +47,7 @@ public class MapCommandTest { String mapMessage = MapCommand.getMapMessage(outputtest); StringBuilder outputMessage = new StringBuilder(); outputMessage - .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Strand" + "\n" + "Zu den blau markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Strand" + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") @@ -73,7 +73,7 @@ public class MapCommandTest { String mapMessage = MapCommand.getMapMessage(outputtest); StringBuilder outputMessage = new StringBuilder(); outputMessage - .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Berge" + "\n" + "Zu den blau markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Berge" + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") @@ -99,7 +99,7 @@ public class MapCommandTest { String mapMessage = MapCommand.getMapMessage(outputtest); StringBuilder outputMessage = new StringBuilder(); outputMessage - .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Wueste" + "\n" + "Zu den blau markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Wueste" + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") @@ -116,6 +116,7 @@ public class MapCommandTest { assertEquals(outputMessage.toString(), mapMessage); } + @Test public void testGruenlandMapCommand() { Player Test = new Player("name"); TravelEngine outputtest = new TravelEngine(Test); @@ -124,7 +125,7 @@ public class MapCommandTest { String mapMessage = MapCommand.getMapMessage(outputtest); StringBuilder outputMessage = new StringBuilder(); outputMessage - .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Gruenland" + "\n" + "Zu den blau markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Gruenland" + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") @@ -150,7 +151,7 @@ public class MapCommandTest { String mapMessage = MapCommand.getMapMessage(outputtest); StringBuilder outputMessage = new StringBuilder(); outputMessage - .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Winterland" + "\n" + Colors.ANSI_RESET) + .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Winterland" + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") From 0b3dc1adc6f05649295a9eff28e831d0f847ccf5 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 16:13:50 +0100 Subject: [PATCH 22/56] Unittest: colored own location Wald --- src/main/java/org/bitbiome/commands/MapCommand.java | 2 +- src/test/java/org/bitbiome/commands/MapCommandTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index b686392..1185b02 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -27,7 +27,7 @@ public class MapCommand implements CommandAPI{ .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BLUE + locations.getJSONObject(1).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BLUE + locations.getJSONObject(1).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Strand")) { diff --git a/src/test/java/org/bitbiome/commands/MapCommandTest.java b/src/test/java/org/bitbiome/commands/MapCommandTest.java index 055c9bc..60136c8 100644 --- a/src/test/java/org/bitbiome/commands/MapCommandTest.java +++ b/src/test/java/org/bitbiome/commands/MapCommandTest.java @@ -31,7 +31,7 @@ public class MapCommandTest { .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BLUE + "Strand" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Wald" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Berge" + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BLUE + "Strand" + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + "Wald" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Berge" + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); From c45d6129929cab3dee8b4e21968947ff90e3dec7 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 16:17:14 +0100 Subject: [PATCH 23/56] Unittest: colored own location Strand --- src/main/java/org/bitbiome/commands/MapCommand.java | 2 +- src/test/java/org/bitbiome/commands/MapCommandTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index 1185b02..7759abd 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -42,7 +42,7 @@ public class MapCommand implements CommandAPI{ .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(1).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_GREEN + locations.getJSONObject(1).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); diff --git a/src/test/java/org/bitbiome/commands/MapCommandTest.java b/src/test/java/org/bitbiome/commands/MapCommandTest.java index 60136c8..d3ae320 100644 --- a/src/test/java/org/bitbiome/commands/MapCommandTest.java +++ b/src/test/java/org/bitbiome/commands/MapCommandTest.java @@ -57,7 +57,7 @@ public class MapCommandTest { .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + "Strand" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Wald" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Berge" + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_GREEN + "Strand" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Wald" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Berge" + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); From e0b136c15d2f0061da14744b09fa82379c2547d7 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 16:18:51 +0100 Subject: [PATCH 24/56] Unittest: colored own location Berge --- src/main/java/org/bitbiome/commands/MapCommand.java | 2 +- src/test/java/org/bitbiome/commands/MapCommandTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index 7759abd..bacf5c3 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -58,7 +58,7 @@ public class MapCommand implements CommandAPI{ .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(1).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(1).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); diff --git a/src/test/java/org/bitbiome/commands/MapCommandTest.java b/src/test/java/org/bitbiome/commands/MapCommandTest.java index d3ae320..1b1595e 100644 --- a/src/test/java/org/bitbiome/commands/MapCommandTest.java +++ b/src/test/java/org/bitbiome/commands/MapCommandTest.java @@ -83,7 +83,7 @@ public class MapCommandTest { .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + "Strand" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Wald" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Berge" + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + "Strand" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Wald" + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + "Berge" + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); From 72c264389966a805c09ac13a6c26cb5b265c1b71 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 16:21:51 +0100 Subject: [PATCH 25/56] Unittest: colored own location Wueste --- src/main/java/org/bitbiome/commands/MapCommand.java | 2 +- src/test/java/org/bitbiome/commands/MapCommandTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index bacf5c3..d8da91c 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -69,7 +69,7 @@ public class MapCommand implements CommandAPI{ .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(5).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_GREEN + locations.getJSONObject(5).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") diff --git a/src/test/java/org/bitbiome/commands/MapCommandTest.java b/src/test/java/org/bitbiome/commands/MapCommandTest.java index 1b1595e..299956a 100644 --- a/src/test/java/org/bitbiome/commands/MapCommandTest.java +++ b/src/test/java/org/bitbiome/commands/MapCommandTest.java @@ -104,7 +104,7 @@ public class MapCommandTest { .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + "Wueste" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Gruenland" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Winterland" + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_GREEN + "Wueste" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Gruenland" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Winterland" + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") From ea386d74617422840b1d353d8ce6e9cb6b5fa798 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 16:27:01 +0100 Subject: [PATCH 26/56] Unittest: colored own location Gruenland --- src/main/java/org/bitbiome/commands/MapCommand.java | 2 +- src/test/java/org/bitbiome/commands/MapCommandTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index d8da91c..095035b 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -85,7 +85,7 @@ public class MapCommand implements CommandAPI{ .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BLUE + locations.getJSONObject(5).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BLUE + locations.getJSONObject(5).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") diff --git a/src/test/java/org/bitbiome/commands/MapCommandTest.java b/src/test/java/org/bitbiome/commands/MapCommandTest.java index 299956a..7e43bdc 100644 --- a/src/test/java/org/bitbiome/commands/MapCommandTest.java +++ b/src/test/java/org/bitbiome/commands/MapCommandTest.java @@ -130,7 +130,7 @@ public class MapCommandTest { .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BLUE + "Wueste" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Gruenland" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Winterland" + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BLUE + "Wueste" + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + "Gruenland" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Winterland" + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") From 8451486e5e9a6270f453edcd148530e7c0ee0edb Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 16:28:37 +0100 Subject: [PATCH 27/56] Unittest: colored own location Winterland --- src/main/java/org/bitbiome/commands/MapCommand.java | 2 +- src/test/java/org/bitbiome/commands/MapCommandTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index 095035b..f65558d 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -101,7 +101,7 @@ public class MapCommand implements CommandAPI{ .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(5).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(5).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") diff --git a/src/test/java/org/bitbiome/commands/MapCommandTest.java b/src/test/java/org/bitbiome/commands/MapCommandTest.java index 7e43bdc..3d8d428 100644 --- a/src/test/java/org/bitbiome/commands/MapCommandTest.java +++ b/src/test/java/org/bitbiome/commands/MapCommandTest.java @@ -156,7 +156,7 @@ public class MapCommandTest { .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + "Wueste" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Gruenland" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Winterland" + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + "Wueste" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Gruenland" + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + "Winterland" + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") From e4abd226fc04939a1e68c4d0d7e7b7d0831fbd21 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 17:47:13 +0100 Subject: [PATCH 28/56] refactoring: created String for integrated Location Wueste --- src/main/java/org/bitbiome/commands/MapCommand.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index f65558d..6ef6e7f 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -15,6 +15,7 @@ public class MapCommand implements CommandAPI{ public static String getMapMessage(TravelEngine travelEngine) { StringBuilder outputMessage = new StringBuilder(); JSONArray locations = travelEngine.getLocationList(); + String locationWueste = locations.getJSONObject(5).getString("name"); if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wald")) { outputMessage .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) @@ -22,7 +23,7 @@ public class MapCommand implements CommandAPI{ .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(5).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") @@ -37,7 +38,7 @@ public class MapCommand implements CommandAPI{ .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BLUE + locations.getJSONObject(5).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BLUE + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") @@ -53,7 +54,7 @@ public class MapCommand implements CommandAPI{ .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(5).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") @@ -69,7 +70,7 @@ public class MapCommand implements CommandAPI{ .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_GREEN + locations.getJSONObject(5).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_GREEN + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") @@ -85,7 +86,7 @@ public class MapCommand implements CommandAPI{ .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BLUE + locations.getJSONObject(5).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BLUE + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") @@ -101,7 +102,7 @@ public class MapCommand implements CommandAPI{ .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(5).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") From 292ff7a9c5d7b5ce7f2de737dcc5d8cd9ca32221 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 17:51:11 +0100 Subject: [PATCH 29/56] refactoring: created String for integrated Location Gruenland --- src/main/java/org/bitbiome/commands/MapCommand.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index 6ef6e7f..559b2e9 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -16,6 +16,7 @@ public class MapCommand implements CommandAPI{ StringBuilder outputMessage = new StringBuilder(); JSONArray locations = travelEngine.getLocationList(); String locationWueste = locations.getJSONObject(5).getString("name"); + String locationGruenland = locations.getJSONObject(4).getString("name"); if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wald")) { outputMessage .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) @@ -23,7 +24,7 @@ public class MapCommand implements CommandAPI{ .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationGruenland + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") @@ -38,7 +39,7 @@ public class MapCommand implements CommandAPI{ .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BLUE + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BLUE + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationGruenland + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") @@ -54,7 +55,7 @@ public class MapCommand implements CommandAPI{ .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationGruenland + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") @@ -70,7 +71,7 @@ public class MapCommand implements CommandAPI{ .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_GREEN + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_GREEN + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationGruenland + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") @@ -86,7 +87,7 @@ public class MapCommand implements CommandAPI{ .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BLUE + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BLUE + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locationGruenland + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") @@ -102,7 +103,7 @@ public class MapCommand implements CommandAPI{ .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(4).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationGruenland + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") From 616bb737a3c7bdda829d4549195d433e8d3f2df1 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 17:55:54 +0100 Subject: [PATCH 30/56] refactoring: created String for integrated Location Winterland --- src/main/java/org/bitbiome/commands/MapCommand.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index 559b2e9..25bd2e9 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -17,6 +17,7 @@ public class MapCommand implements CommandAPI{ JSONArray locations = travelEngine.getLocationList(); String locationWueste = locations.getJSONObject(5).getString("name"); String locationGruenland = locations.getJSONObject(4).getString("name"); + String locationWinterland = locations.getJSONObject(2).getString("name"); if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wald")) { outputMessage .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) @@ -24,7 +25,7 @@ public class MapCommand implements CommandAPI{ .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationGruenland + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationGruenland + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationWinterland + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") @@ -39,7 +40,7 @@ public class MapCommand implements CommandAPI{ .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BLUE + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationGruenland + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BLUE + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationGruenland + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationWinterland + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") @@ -55,7 +56,7 @@ public class MapCommand implements CommandAPI{ .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationGruenland + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationGruenland + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationWinterland + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") @@ -71,7 +72,7 @@ public class MapCommand implements CommandAPI{ .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_GREEN + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationGruenland + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_GREEN + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationGruenland + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationWinterland + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") @@ -87,7 +88,7 @@ public class MapCommand implements CommandAPI{ .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BLUE + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locationGruenland + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BLUE + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locationGruenland + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationWinterland + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") @@ -103,7 +104,7 @@ public class MapCommand implements CommandAPI{ .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationGruenland + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locations.getJSONObject(2).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationGruenland + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locationWinterland + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") From 72da5eeac2830fcd5577b2d2d59de93e8ae8c01b Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 17:58:14 +0100 Subject: [PATCH 31/56] refactoring: created String for integrated Location Strand --- src/main/java/org/bitbiome/commands/MapCommand.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index 25bd2e9..b765d20 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -18,6 +18,7 @@ public class MapCommand implements CommandAPI{ String locationWueste = locations.getJSONObject(5).getString("name"); String locationGruenland = locations.getJSONObject(4).getString("name"); String locationWinterland = locations.getJSONObject(2).getString("name"); + String locationStrand = locations.getJSONObject(1).getString("name"); if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wald")) { outputMessage .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) @@ -30,7 +31,7 @@ public class MapCommand implements CommandAPI{ .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BLUE + locations.getJSONObject(1).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BLUE + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Strand")) { @@ -45,7 +46,7 @@ public class MapCommand implements CommandAPI{ .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_GREEN + locations.getJSONObject(1).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_GREEN + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); @@ -61,7 +62,7 @@ public class MapCommand implements CommandAPI{ .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(1).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); @@ -77,7 +78,7 @@ public class MapCommand implements CommandAPI{ .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BLUE + locations.getJSONObject(1).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BLUE + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); @@ -93,7 +94,7 @@ public class MapCommand implements CommandAPI{ .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(1).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); @@ -109,7 +110,7 @@ public class MapCommand implements CommandAPI{ .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(1).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); } From 48c3dd29a0a7764f6d92be4d0ff7d1e25940fea3 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 18:01:42 +0100 Subject: [PATCH 32/56] refactoring: created String for integrated Location Wald --- src/main/java/org/bitbiome/commands/MapCommand.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index b765d20..3072b53 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -19,6 +19,7 @@ public class MapCommand implements CommandAPI{ String locationGruenland = locations.getJSONObject(4).getString("name"); String locationWinterland = locations.getJSONObject(2).getString("name"); String locationStrand = locations.getJSONObject(1).getString("name"); + String locationWald = locations.getJSONObject(0).getString("name"); if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wald")) { outputMessage .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) @@ -31,7 +32,7 @@ public class MapCommand implements CommandAPI{ .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BLUE + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BLUE + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locationWald + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Strand")) { @@ -46,7 +47,7 @@ public class MapCommand implements CommandAPI{ .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_GREEN + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_GREEN + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationWald + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); @@ -62,7 +63,7 @@ public class MapCommand implements CommandAPI{ .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationWald + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); @@ -78,7 +79,7 @@ public class MapCommand implements CommandAPI{ .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BLUE + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BLUE + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationWald + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); @@ -94,7 +95,7 @@ public class MapCommand implements CommandAPI{ .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationWald + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); @@ -110,7 +111,7 @@ public class MapCommand implements CommandAPI{ .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(0).getString("name") + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationWald + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); } From 76d91a46079d8eb56354206587b9de9fcb094a4f Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 18:04:41 +0100 Subject: [PATCH 33/56] refactoring: created String for integrated Location Berge --- src/main/java/org/bitbiome/commands/MapCommand.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index 3072b53..40730bd 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -20,6 +20,7 @@ public class MapCommand implements CommandAPI{ String locationWinterland = locations.getJSONObject(2).getString("name"); String locationStrand = locations.getJSONObject(1).getString("name"); String locationWald = locations.getJSONObject(0).getString("name"); + String locationBerge = locations.getJSONObject(3).getString("name"); if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wald")) { outputMessage .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) @@ -32,7 +33,7 @@ public class MapCommand implements CommandAPI{ .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BLUE + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locationWald + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BLUE + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locationWald + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationBerge + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Strand")) { @@ -47,7 +48,7 @@ public class MapCommand implements CommandAPI{ .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_GREEN + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationWald + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_GREEN + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationWald + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationBerge + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); @@ -63,7 +64,7 @@ public class MapCommand implements CommandAPI{ .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationWald + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationWald + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locationBerge + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); @@ -79,7 +80,7 @@ public class MapCommand implements CommandAPI{ .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BLUE + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationWald + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BLUE + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationWald + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationBerge + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); @@ -95,7 +96,7 @@ public class MapCommand implements CommandAPI{ .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationWald + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationWald + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationBerge + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); @@ -111,7 +112,7 @@ public class MapCommand implements CommandAPI{ .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationWald + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locations.getJSONObject(3).getString("name") + Colors.ANSI_RESET + " |" + "\n") + .append("| " + Colors.ANSI_BRIGHT_BLACK + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationWald + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationBerge + Colors.ANSI_RESET + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); } From 3862df9f7cc80a66c1b4a56bd08a1c1ac4505286 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 18:51:42 +0100 Subject: [PATCH 34/56] Unittest: Changed Color Map-Message --- .../org/bitbiome/commands/MapCommand.java | 26 +++++++++---------- .../org/bitbiome/commands/MapCommandTest.java | 24 ++++++++--------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index 40730bd..0495820 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -10,7 +10,7 @@ public class MapCommand implements CommandAPI{ System.out.println(getMapMessage(travelEngine)); } public static String getLocationMessage(TravelEngine travelEngine) { - return "Du befindest dich gerade hier: " + travelEngine.getPlayer().getLocation().getName(); + return "Du befindest dich gerade hier: " + Colors.ANSI_GREEN + travelEngine.getPlayer().getLocation().getName(); } public static String getMapMessage(TravelEngine travelEngine) { StringBuilder outputMessage = new StringBuilder(); @@ -23,8 +23,8 @@ public class MapCommand implements CommandAPI{ String locationBerge = locations.getJSONObject(3).getString("name"); if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wald")) { outputMessage - .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) - .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append(getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n\n") + .append("Deine Karte:\n\n") .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") @@ -38,8 +38,8 @@ public class MapCommand implements CommandAPI{ .append("|________________________________|________________________________|________________________________|\n"); } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Strand")) { outputMessage - .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) - .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append(getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n\n") + .append("Deine Karte:\n\n") .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") @@ -54,8 +54,8 @@ public class MapCommand implements CommandAPI{ } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Berge")) { outputMessage - .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) - .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append(getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n\n") + .append("Deine Karte:\n\n") .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") @@ -70,8 +70,8 @@ public class MapCommand implements CommandAPI{ } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wueste")) { outputMessage - .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) - .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append(getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n\n") + .append("Deine Karte:\n\n") .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") @@ -86,8 +86,8 @@ public class MapCommand implements CommandAPI{ } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Gruenland")) { outputMessage - .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) - .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append(getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n\n") + .append("Deine Karte:\n\n") .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") @@ -102,8 +102,8 @@ public class MapCommand implements CommandAPI{ } else { outputMessage - .append(Colors.ANSI_BLUE + getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) - .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append(getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n\n") + .append("Deine Karte:\n\n") .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") diff --git a/src/test/java/org/bitbiome/commands/MapCommandTest.java b/src/test/java/org/bitbiome/commands/MapCommandTest.java index 3d8d428..3a85c7d 100644 --- a/src/test/java/org/bitbiome/commands/MapCommandTest.java +++ b/src/test/java/org/bitbiome/commands/MapCommandTest.java @@ -21,8 +21,8 @@ public class MapCommandTest { String mapMessage = MapCommand.getMapMessage(outputtest); StringBuilder outputMessage = new StringBuilder(); outputMessage - .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Wald" + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) - .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append("Du befindest dich gerade hier: " + Colors.ANSI_GREEN + "Wald" + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n\n") + .append("Deine Karte:\n\n") .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") @@ -47,8 +47,8 @@ public class MapCommandTest { String mapMessage = MapCommand.getMapMessage(outputtest); StringBuilder outputMessage = new StringBuilder(); outputMessage - .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Strand" + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) - .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append("Du befindest dich gerade hier: " + Colors.ANSI_GREEN + "Strand" + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n\n") + .append("Deine Karte:\n\n") .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") @@ -73,8 +73,8 @@ public class MapCommandTest { String mapMessage = MapCommand.getMapMessage(outputtest); StringBuilder outputMessage = new StringBuilder(); outputMessage - .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Berge" + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) - .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append("Du befindest dich gerade hier: " + Colors.ANSI_GREEN + "Berge" + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n\n") + .append("Deine Karte:\n\n") .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") @@ -99,8 +99,8 @@ public class MapCommandTest { String mapMessage = MapCommand.getMapMessage(outputtest); StringBuilder outputMessage = new StringBuilder(); outputMessage - .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Wueste" + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) - .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append("Du befindest dich gerade hier: " + Colors.ANSI_GREEN + "Wueste" + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n\n") + .append("Deine Karte:\n\n") .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") @@ -125,8 +125,8 @@ public class MapCommandTest { String mapMessage = MapCommand.getMapMessage(outputtest); StringBuilder outputMessage = new StringBuilder(); outputMessage - .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Gruenland" + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) - .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append("Du befindest dich gerade hier: " + Colors.ANSI_GREEN + "Gruenland" + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n\n") + .append("Deine Karte:\n\n") .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") @@ -151,8 +151,8 @@ public class MapCommandTest { String mapMessage = MapCommand.getMapMessage(outputtest); StringBuilder outputMessage = new StringBuilder(); outputMessage - .append(Colors.ANSI_BLUE + "Du befindest dich gerade hier: Winterland" + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n" + Colors.ANSI_RESET) - .append(Colors.ANSI_BLUE + "Deine Karte:\n\n" + Colors.ANSI_RESET) + .append("Du befindest dich gerade hier: " + Colors.ANSI_GREEN + "Winterland" + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n\n") + .append("Deine Karte:\n\n") .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") From 1697788809f2e44a5cf82d31fb90fa35d11699d1 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 21:40:02 +0100 Subject: [PATCH 35/56] Changed traveloptions Wald --- .../org/bitbiome/classes/TravelEngine.java | 9 ++++++ .../org/bitbiome/commands/TravelCommand.java | 28 +++++++++++++------ 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/bitbiome/classes/TravelEngine.java b/src/main/java/org/bitbiome/classes/TravelEngine.java index a8d3213..2bc81cb 100644 --- a/src/main/java/org/bitbiome/classes/TravelEngine.java +++ b/src/main/java/org/bitbiome/classes/TravelEngine.java @@ -44,6 +44,15 @@ public class TravelEngine { return found; } + public boolean locationExistsWald(String name) { + boolean found = false; + for (int i = 0; i < locations.length(); i++) + if (locations.getJSONObject(1).getString("name").equals(name) | locations.getJSONObject(4).getString("name").equals(name) | locations.getJSONObject(3).getString("name").equals(name)) { + found = true; + } + return found; + } + public Location getLocationByName(String name) { JsonParser jp = new JsonParser(); JSONObject gameconfig = jp.getJSONObject("gameconfig.json"); diff --git a/src/main/java/org/bitbiome/commands/TravelCommand.java b/src/main/java/org/bitbiome/commands/TravelCommand.java index da5cbe7..eeb452a 100644 --- a/src/main/java/org/bitbiome/commands/TravelCommand.java +++ b/src/main/java/org/bitbiome/commands/TravelCommand.java @@ -18,16 +18,28 @@ public class TravelCommand implements CommandAPI { public void performCommand(Scanner scanner, boolean isRunning, String message, TravelEngine travelEngine) { System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad gezückt. Wohin möchtest du reisen?" + Colors.ANSI_RESET); JSONArray locations = travelEngine.getLocationList(); - for (int i = 0; i < locations.length(); i++) { - System.out.println("- " + locations.getJSONObject(i).getString("name")); - } + if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wald")) { + System.out.println("- " + locations.getJSONObject(1).getString("name") + "\n" + "- " + locations.getJSONObject(4).getString("name") + "\n" + "- " + locations.getJSONObject(3).getString("name")); + + String locationName = scanner.nextLine(); + if (travelEngine.locationExistsWald(locationName)) { + travelEngine.travelTo(new Location(locationName, new ArrayList(), new ArrayList())); + System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); + } else { + System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad weggesteckt." + Colors.ANSI_RESET); + } - String locationName = scanner.nextLine(); - if (travelEngine.locationExists(locationName)) { - travelEngine.travelTo(new Location(locationName, new ArrayList(), new ArrayList())); - System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); } else { - System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad weggesteckt." + Colors.ANSI_RESET); + for (int i = 0; i < locations.length(); i++) { + System.out.println("- " + locations.getJSONObject(i).getString("name")); + } + String locationName = scanner.nextLine(); + if (travelEngine.locationExists(locationName)) { + travelEngine.travelTo(new Location(locationName, new ArrayList(), new ArrayList())); + System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); + } else { + System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad weggesteckt." + Colors.ANSI_RESET); + } } } } From 173b2a03b490d543ba95950f03f655e995392000 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 21:45:47 +0100 Subject: [PATCH 36/56] Changed traveloptions Strand --- src/main/java/org/bitbiome/classes/TravelEngine.java | 8 ++++++++ .../java/org/bitbiome/commands/TravelCommand.java | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/main/java/org/bitbiome/classes/TravelEngine.java b/src/main/java/org/bitbiome/classes/TravelEngine.java index 2bc81cb..06b2140 100644 --- a/src/main/java/org/bitbiome/classes/TravelEngine.java +++ b/src/main/java/org/bitbiome/classes/TravelEngine.java @@ -52,6 +52,14 @@ public class TravelEngine { } return found; } + public boolean locationExistsStrand(String name) { + boolean found = false; + for (int i = 0; i < locations.length(); i++) + if (locations.getJSONObject(5).getString("name").equals(name) | locations.getJSONObject(0).getString("name").equals(name)) { + found = true; + } + return found; + } public Location getLocationByName(String name) { JsonParser jp = new JsonParser(); diff --git a/src/main/java/org/bitbiome/commands/TravelCommand.java b/src/main/java/org/bitbiome/commands/TravelCommand.java index eeb452a..abd132b 100644 --- a/src/main/java/org/bitbiome/commands/TravelCommand.java +++ b/src/main/java/org/bitbiome/commands/TravelCommand.java @@ -29,6 +29,17 @@ public class TravelCommand implements CommandAPI { System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad weggesteckt." + Colors.ANSI_RESET); } + } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Strand")) { + System.out.println("- " + locations.getJSONObject(5).getString("name") + "\n" + "- " + locations.getJSONObject(0).getString("name")); + + String locationName = scanner.nextLine(); + if (travelEngine.locationExistsStrand(locationName)) { + travelEngine.travelTo(new Location(locationName, new ArrayList(), new ArrayList())); + System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); + } else { + System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad weggesteckt." + Colors.ANSI_RESET); + } + } else { for (int i = 0; i < locations.length(); i++) { System.out.println("- " + locations.getJSONObject(i).getString("name")); From 155b139ccb093f184751de162b54e4efa223943f Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 21:56:05 +0100 Subject: [PATCH 37/56] Changed traveloptions Gruenland --- src/main/java/org/bitbiome/classes/TravelEngine.java | 10 ++++++++++ .../java/org/bitbiome/commands/TravelCommand.java | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/main/java/org/bitbiome/classes/TravelEngine.java b/src/main/java/org/bitbiome/classes/TravelEngine.java index 06b2140..d7f39f0 100644 --- a/src/main/java/org/bitbiome/classes/TravelEngine.java +++ b/src/main/java/org/bitbiome/classes/TravelEngine.java @@ -52,6 +52,7 @@ public class TravelEngine { } return found; } + public boolean locationExistsStrand(String name) { boolean found = false; for (int i = 0; i < locations.length(); i++) @@ -61,6 +62,15 @@ public class TravelEngine { return found; } + public boolean locationExistsGruenland(String name) { + boolean found = false; + for (int i = 0; i < locations.length(); i++) + if (locations.getJSONObject(5).getString("name").equals(name) | locations.getJSONObject(0).getString("name").equals(name) | locations.getJSONObject(2).getString("name").equals(name)) { + found = true; + } + return found; + } + public Location getLocationByName(String name) { JsonParser jp = new JsonParser(); JSONObject gameconfig = jp.getJSONObject("gameconfig.json"); diff --git a/src/main/java/org/bitbiome/commands/TravelCommand.java b/src/main/java/org/bitbiome/commands/TravelCommand.java index abd132b..8292286 100644 --- a/src/main/java/org/bitbiome/commands/TravelCommand.java +++ b/src/main/java/org/bitbiome/commands/TravelCommand.java @@ -40,6 +40,17 @@ public class TravelCommand implements CommandAPI { System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad weggesteckt." + Colors.ANSI_RESET); } + } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Gruenland")) { + System.out.println("- " + locations.getJSONObject(5).getString("name") + "\n" + "- " + locations.getJSONObject(0).getString("name") + "\n" + "- " + locations.getJSONObject(2).getString("name")); + + String locationName = scanner.nextLine(); + if (travelEngine.locationExistsGruenland(locationName)) { + travelEngine.travelTo(new Location(locationName, new ArrayList(), new ArrayList())); + System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); + } else { + System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad weggesteckt." + Colors.ANSI_RESET); + } + } else { for (int i = 0; i < locations.length(); i++) { System.out.println("- " + locations.getJSONObject(i).getString("name")); From 04c707fed876ca62b8a71e69ed01e6f97de9fd0c Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 22:03:31 +0100 Subject: [PATCH 38/56] Changed traveloptions Berge --- src/main/java/org/bitbiome/classes/TravelEngine.java | 9 +++++++++ .../java/org/bitbiome/commands/TravelCommand.java | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/main/java/org/bitbiome/classes/TravelEngine.java b/src/main/java/org/bitbiome/classes/TravelEngine.java index d7f39f0..51c5cae 100644 --- a/src/main/java/org/bitbiome/classes/TravelEngine.java +++ b/src/main/java/org/bitbiome/classes/TravelEngine.java @@ -71,6 +71,15 @@ public class TravelEngine { return found; } + public boolean locationExistsBerge(String name) { + boolean found = false; + for (int i = 0; i < locations.length(); i++) + if (locations.getJSONObject(0).getString("name").equals(name) | locations.getJSONObject(2).getString("name").equals(name)) { + found = true; + } + return found; + } + public Location getLocationByName(String name) { JsonParser jp = new JsonParser(); JSONObject gameconfig = jp.getJSONObject("gameconfig.json"); diff --git a/src/main/java/org/bitbiome/commands/TravelCommand.java b/src/main/java/org/bitbiome/commands/TravelCommand.java index 8292286..1135aa4 100644 --- a/src/main/java/org/bitbiome/commands/TravelCommand.java +++ b/src/main/java/org/bitbiome/commands/TravelCommand.java @@ -51,6 +51,17 @@ public class TravelCommand implements CommandAPI { System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad weggesteckt." + Colors.ANSI_RESET); } + } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Berge")) { + System.out.println("- " + locations.getJSONObject(0).getString("name") + "\n" + "- " + locations.getJSONObject(2).getString("name")); + + String locationName = scanner.nextLine(); + if (travelEngine.locationExistsBerge(locationName)) { + travelEngine.travelTo(new Location(locationName, new ArrayList(), new ArrayList())); + System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); + } else { + System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad weggesteckt." + Colors.ANSI_RESET); + } + } else { for (int i = 0; i < locations.length(); i++) { System.out.println("- " + locations.getJSONObject(i).getString("name")); From 626c0c851b446c19f08c5eed982a9d61adcc9ba3 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 22:09:33 +0100 Subject: [PATCH 39/56] Changed traveloptions Winterland --- src/main/java/org/bitbiome/classes/TravelEngine.java | 9 +++++++++ .../java/org/bitbiome/commands/TravelCommand.java | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/main/java/org/bitbiome/classes/TravelEngine.java b/src/main/java/org/bitbiome/classes/TravelEngine.java index 51c5cae..edfc47d 100644 --- a/src/main/java/org/bitbiome/classes/TravelEngine.java +++ b/src/main/java/org/bitbiome/classes/TravelEngine.java @@ -80,6 +80,15 @@ public class TravelEngine { return found; } + public boolean locationExistsWinterland(String name) { + boolean found = false; + for (int i = 0; i < locations.length(); i++) + if (locations.getJSONObject(4).getString("name").equals(name) | locations.getJSONObject(3).getString("name").equals(name)) { + found = true; + } + return found; + } + public Location getLocationByName(String name) { JsonParser jp = new JsonParser(); JSONObject gameconfig = jp.getJSONObject("gameconfig.json"); diff --git a/src/main/java/org/bitbiome/commands/TravelCommand.java b/src/main/java/org/bitbiome/commands/TravelCommand.java index 1135aa4..f4313bf 100644 --- a/src/main/java/org/bitbiome/commands/TravelCommand.java +++ b/src/main/java/org/bitbiome/commands/TravelCommand.java @@ -62,6 +62,17 @@ public class TravelCommand implements CommandAPI { System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad weggesteckt." + Colors.ANSI_RESET); } + } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Winterland")) { + System.out.println("- " + locations.getJSONObject(4).getString("name") + "\n" + "- " + locations.getJSONObject(3).getString("name")); + + String locationName = scanner.nextLine(); + if (travelEngine.locationExistsWinterland(locationName)) { + travelEngine.travelTo(new Location(locationName, new ArrayList(), new ArrayList())); + System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); + } else { + System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad weggesteckt." + Colors.ANSI_RESET); + } + } else { for (int i = 0; i < locations.length(); i++) { System.out.println("- " + locations.getJSONObject(i).getString("name")); From a4bb55f061c4fea32d1b9e859544425c55f16cce Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Sun, 5 Feb 2023 22:18:05 +0100 Subject: [PATCH 40/56] Changed traveloptions Wueste --- src/main/java/org/bitbiome/classes/TravelEngine.java | 9 +++++++++ src/main/java/org/bitbiome/commands/TravelCommand.java | 9 ++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/bitbiome/classes/TravelEngine.java b/src/main/java/org/bitbiome/classes/TravelEngine.java index edfc47d..322fdd6 100644 --- a/src/main/java/org/bitbiome/classes/TravelEngine.java +++ b/src/main/java/org/bitbiome/classes/TravelEngine.java @@ -89,6 +89,15 @@ public class TravelEngine { return found; } + public boolean locationExistsWueste(String name) { + boolean found = false; + for (int i = 0; i < locations.length(); i++) + if (locations.getJSONObject(1).getString("name").equals(name) | locations.getJSONObject(4).getString("name").equals(name)) { + found = true; + } + return found; + } + public Location getLocationByName(String name) { JsonParser jp = new JsonParser(); JSONObject gameconfig = jp.getJSONObject("gameconfig.json"); diff --git a/src/main/java/org/bitbiome/commands/TravelCommand.java b/src/main/java/org/bitbiome/commands/TravelCommand.java index f4313bf..fe414c7 100644 --- a/src/main/java/org/bitbiome/commands/TravelCommand.java +++ b/src/main/java/org/bitbiome/commands/TravelCommand.java @@ -73,12 +73,11 @@ public class TravelCommand implements CommandAPI { System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad weggesteckt." + Colors.ANSI_RESET); } - } else { - for (int i = 0; i < locations.length(); i++) { - System.out.println("- " + locations.getJSONObject(i).getString("name")); - } + } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wueste")) { + System.out.println("- " + locations.getJSONObject(1).getString("name") + "\n" + "- " + locations.getJSONObject(4).getString("name")); + String locationName = scanner.nextLine(); - if (travelEngine.locationExists(locationName)) { + if (travelEngine.locationExistsWueste(locationName)) { travelEngine.travelTo(new Location(locationName, new ArrayList(), new ArrayList())); System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); } else { From d66fce72cc91aab7a7713572bf66d0cc4b58579a Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Mon, 6 Feb 2023 09:32:04 +0100 Subject: [PATCH 41/56] Unittest: added map-Command --- src/main/java/org/bitbiome/commands/HelpCommand.java | 2 ++ src/test/java/org/bitbiome/commands/HelpCommandTest.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/main/java/org/bitbiome/commands/HelpCommand.java b/src/main/java/org/bitbiome/commands/HelpCommand.java index ee4f237..938d236 100644 --- a/src/main/java/org/bitbiome/commands/HelpCommand.java +++ b/src/main/java/org/bitbiome/commands/HelpCommand.java @@ -28,6 +28,8 @@ public class HelpCommand implements CommandAPI { .append("|" + Colors.ANSI_GREEN + " travel" + Colors.ANSI_RESET + " | Startet das Reise System |\n") .append("|--------------|-----------------------------|\n") .append("|" + Colors.ANSI_GREEN + " location" + Colors.ANSI_RESET + " | Gibt deine Location aus |\n") + .append("|--------------|-----------------------------|\n") + .append("|" + Colors.ANSI_GREEN + " map" + Colors.ANSI_RESET + " | Zeigt dir deinen Karte |\n") .append("|______________|_____________________________|\n"); return outputMessage.toString(); diff --git a/src/test/java/org/bitbiome/commands/HelpCommandTest.java b/src/test/java/org/bitbiome/commands/HelpCommandTest.java index 5caac07..151e747 100644 --- a/src/test/java/org/bitbiome/commands/HelpCommandTest.java +++ b/src/test/java/org/bitbiome/commands/HelpCommandTest.java @@ -22,6 +22,8 @@ public class HelpCommandTest { .append("|" + Colors.ANSI_GREEN + " travel" + Colors.ANSI_RESET + " | Startet das Reise System |\n") .append("|--------------|-----------------------------|\n") .append("|" + Colors.ANSI_GREEN + " location" + Colors.ANSI_RESET + " | Gibt deine Location aus |\n") + .append("|--------------|-----------------------------|\n") + .append("|" + Colors.ANSI_GREEN + " map" + Colors.ANSI_RESET + " | Zeigt dir deinen Karte |\n") .append("|______________|_____________________________|\n"); assertEquals(outputMessage.toString(), helpMessage); } From 4fc8a61618ebbfeafef494b82ee4949c85b52939 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Mon, 6 Feb 2023 09:56:40 +0100 Subject: [PATCH 42/56] refactoring: created String for locations --- .../org/bitbiome/commands/TravelCommand.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/TravelCommand.java b/src/main/java/org/bitbiome/commands/TravelCommand.java index fe414c7..91fe7cd 100644 --- a/src/main/java/org/bitbiome/commands/TravelCommand.java +++ b/src/main/java/org/bitbiome/commands/TravelCommand.java @@ -18,8 +18,14 @@ public class TravelCommand implements CommandAPI { public void performCommand(Scanner scanner, boolean isRunning, String message, TravelEngine travelEngine) { System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad gezückt. Wohin möchtest du reisen?" + Colors.ANSI_RESET); JSONArray locations = travelEngine.getLocationList(); + String locationWueste = locations.getJSONObject(5).getString("name"); + String locationGruenland = locations.getJSONObject(4).getString("name"); + String locationWinterland = locations.getJSONObject(2).getString("name"); + String locationStrand = locations.getJSONObject(1).getString("name"); + String locationWald = locations.getJSONObject(0).getString("name"); + String locationBerge = locations.getJSONObject(3).getString("name"); if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wald")) { - System.out.println("- " + locations.getJSONObject(1).getString("name") + "\n" + "- " + locations.getJSONObject(4).getString("name") + "\n" + "- " + locations.getJSONObject(3).getString("name")); + System.out.println("- " + locationStrand + "\n" + "- " + locationGruenland + "\n" + "- " + locationBerge); String locationName = scanner.nextLine(); if (travelEngine.locationExistsWald(locationName)) { @@ -30,7 +36,7 @@ public class TravelCommand implements CommandAPI { } } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Strand")) { - System.out.println("- " + locations.getJSONObject(5).getString("name") + "\n" + "- " + locations.getJSONObject(0).getString("name")); + System.out.println("- " + locationWueste + "\n" + "- " + locationWald); String locationName = scanner.nextLine(); if (travelEngine.locationExistsStrand(locationName)) { @@ -41,7 +47,7 @@ public class TravelCommand implements CommandAPI { } } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Gruenland")) { - System.out.println("- " + locations.getJSONObject(5).getString("name") + "\n" + "- " + locations.getJSONObject(0).getString("name") + "\n" + "- " + locations.getJSONObject(2).getString("name")); + System.out.println("- " + locationWueste + "\n" + "- " + locationWald + "\n" + "- " + locationWinterland); String locationName = scanner.nextLine(); if (travelEngine.locationExistsGruenland(locationName)) { @@ -52,7 +58,7 @@ public class TravelCommand implements CommandAPI { } } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Berge")) { - System.out.println("- " + locations.getJSONObject(0).getString("name") + "\n" + "- " + locations.getJSONObject(2).getString("name")); + System.out.println("- " + locationWald + "\n" + "- " + locationWinterland); String locationName = scanner.nextLine(); if (travelEngine.locationExistsBerge(locationName)) { @@ -63,7 +69,7 @@ public class TravelCommand implements CommandAPI { } } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Winterland")) { - System.out.println("- " + locations.getJSONObject(4).getString("name") + "\n" + "- " + locations.getJSONObject(3).getString("name")); + System.out.println("- " + locationGruenland + "\n" + "- " + locationBerge); String locationName = scanner.nextLine(); if (travelEngine.locationExistsWinterland(locationName)) { @@ -74,7 +80,7 @@ public class TravelCommand implements CommandAPI { } } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wueste")) { - System.out.println("- " + locations.getJSONObject(1).getString("name") + "\n" + "- " + locations.getJSONObject(4).getString("name")); + System.out.println("- " + locationStrand + "\n" + "- " + locationGruenland); String locationName = scanner.nextLine(); if (travelEngine.locationExistsWueste(locationName)) { From 63193fde19277c3e8cf2f9e8b8e9c6b4ef51d420 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Mon, 6 Feb 2023 10:30:55 +0100 Subject: [PATCH 43/56] refactoring: common String locationName --- .../org/bitbiome/commands/TravelCommand.java | 38 +++++++++++++------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/TravelCommand.java b/src/main/java/org/bitbiome/commands/TravelCommand.java index 91fe7cd..7df3aa3 100644 --- a/src/main/java/org/bitbiome/commands/TravelCommand.java +++ b/src/main/java/org/bitbiome/commands/TravelCommand.java @@ -13,11 +13,19 @@ import java.util.Scanner; public class TravelCommand implements CommandAPI { + public void exittravelCommand() { + System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad weggesteckt." + Colors.ANSI_RESET); + } + + public void travelCommand() { + + } @Override public void performCommand(Scanner scanner, boolean isRunning, String message, TravelEngine travelEngine) { System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad gezückt. Wohin möchtest du reisen?" + Colors.ANSI_RESET); JSONArray locations = travelEngine.getLocationList(); + String locationName; String locationWueste = locations.getJSONObject(5).getString("name"); String locationGruenland = locations.getJSONObject(4).getString("name"); String locationWinterland = locations.getJSONObject(2).getString("name"); @@ -27,67 +35,73 @@ public class TravelCommand implements CommandAPI { if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wald")) { System.out.println("- " + locationStrand + "\n" + "- " + locationGruenland + "\n" + "- " + locationBerge); - String locationName = scanner.nextLine(); + locationName = scanner.nextLine(); if (travelEngine.locationExistsWald(locationName)) { travelEngine.travelTo(new Location(locationName, new ArrayList(), new ArrayList())); System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); } else { - System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad weggesteckt." + Colors.ANSI_RESET); + exittravelCommand(); + return; } } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Strand")) { System.out.println("- " + locationWueste + "\n" + "- " + locationWald); - String locationName = scanner.nextLine(); + locationName = scanner.nextLine(); if (travelEngine.locationExistsStrand(locationName)) { travelEngine.travelTo(new Location(locationName, new ArrayList(), new ArrayList())); System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); } else { - System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad weggesteckt." + Colors.ANSI_RESET); + exittravelCommand(); + return; } } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Gruenland")) { System.out.println("- " + locationWueste + "\n" + "- " + locationWald + "\n" + "- " + locationWinterland); - String locationName = scanner.nextLine(); + locationName = scanner.nextLine(); if (travelEngine.locationExistsGruenland(locationName)) { travelEngine.travelTo(new Location(locationName, new ArrayList(), new ArrayList())); System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); } else { - System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad weggesteckt." + Colors.ANSI_RESET); + exittravelCommand(); + return; } } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Berge")) { System.out.println("- " + locationWald + "\n" + "- " + locationWinterland); - String locationName = scanner.nextLine(); + locationName = scanner.nextLine(); if (travelEngine.locationExistsBerge(locationName)) { travelEngine.travelTo(new Location(locationName, new ArrayList(), new ArrayList())); System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); } else { - System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad weggesteckt." + Colors.ANSI_RESET); + exittravelCommand(); + return; } } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Winterland")) { System.out.println("- " + locationGruenland + "\n" + "- " + locationBerge); - String locationName = scanner.nextLine(); + locationName = scanner.nextLine(); if (travelEngine.locationExistsWinterland(locationName)) { travelEngine.travelTo(new Location(locationName, new ArrayList(), new ArrayList())); System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); } else { - System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad weggesteckt." + Colors.ANSI_RESET); + exittravelCommand(); + return; } } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wueste")) { System.out.println("- " + locationStrand + "\n" + "- " + locationGruenland); - String locationName = scanner.nextLine(); + locationName = scanner.nextLine(); if (travelEngine.locationExistsWueste(locationName)) { travelEngine.travelTo(new Location(locationName, new ArrayList(), new ArrayList())); System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); } else { - System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad weggesteckt." + Colors.ANSI_RESET); + exittravelCommand(); + return; } } } From 2fe8517a781d36ab343fc76873c4fdfe14c5700c Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Mon, 6 Feb 2023 10:37:45 +0100 Subject: [PATCH 44/56] refactoring: outsourced if-code --- .../org/bitbiome/commands/TravelCommand.java | 35 +++++-------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/TravelCommand.java b/src/main/java/org/bitbiome/commands/TravelCommand.java index 7df3aa3..0674010 100644 --- a/src/main/java/org/bitbiome/commands/TravelCommand.java +++ b/src/main/java/org/bitbiome/commands/TravelCommand.java @@ -25,7 +25,7 @@ public class TravelCommand implements CommandAPI { public void performCommand(Scanner scanner, boolean isRunning, String message, TravelEngine travelEngine) { System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad gezückt. Wohin möchtest du reisen?" + Colors.ANSI_RESET); JSONArray locations = travelEngine.getLocationList(); - String locationName; + String locationName = ""; String locationWueste = locations.getJSONObject(5).getString("name"); String locationGruenland = locations.getJSONObject(4).getString("name"); String locationWinterland = locations.getJSONObject(2).getString("name"); @@ -36,10 +36,7 @@ public class TravelCommand implements CommandAPI { System.out.println("- " + locationStrand + "\n" + "- " + locationGruenland + "\n" + "- " + locationBerge); locationName = scanner.nextLine(); - if (travelEngine.locationExistsWald(locationName)) { - travelEngine.travelTo(new Location(locationName, new ArrayList(), new ArrayList())); - System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); - } else { + if (!travelEngine.locationExistsWald(locationName)) { exittravelCommand(); return; } @@ -48,10 +45,7 @@ public class TravelCommand implements CommandAPI { System.out.println("- " + locationWueste + "\n" + "- " + locationWald); locationName = scanner.nextLine(); - if (travelEngine.locationExistsStrand(locationName)) { - travelEngine.travelTo(new Location(locationName, new ArrayList(), new ArrayList())); - System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); - } else { + if (!travelEngine.locationExistsStrand(locationName)) { exittravelCommand(); return; } @@ -60,10 +54,7 @@ public class TravelCommand implements CommandAPI { System.out.println("- " + locationWueste + "\n" + "- " + locationWald + "\n" + "- " + locationWinterland); locationName = scanner.nextLine(); - if (travelEngine.locationExistsGruenland(locationName)) { - travelEngine.travelTo(new Location(locationName, new ArrayList(), new ArrayList())); - System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); - } else { + if (!travelEngine.locationExistsGruenland(locationName)) { exittravelCommand(); return; } @@ -72,10 +63,7 @@ public class TravelCommand implements CommandAPI { System.out.println("- " + locationWald + "\n" + "- " + locationWinterland); locationName = scanner.nextLine(); - if (travelEngine.locationExistsBerge(locationName)) { - travelEngine.travelTo(new Location(locationName, new ArrayList(), new ArrayList())); - System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); - } else { + if (!travelEngine.locationExistsBerge(locationName)) { exittravelCommand(); return; } @@ -84,10 +72,7 @@ public class TravelCommand implements CommandAPI { System.out.println("- " + locationGruenland + "\n" + "- " + locationBerge); locationName = scanner.nextLine(); - if (travelEngine.locationExistsWinterland(locationName)) { - travelEngine.travelTo(new Location(locationName, new ArrayList(), new ArrayList())); - System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); - } else { + if (!travelEngine.locationExistsWinterland(locationName)) { exittravelCommand(); return; } @@ -96,13 +81,11 @@ public class TravelCommand implements CommandAPI { System.out.println("- " + locationStrand + "\n" + "- " + locationGruenland); locationName = scanner.nextLine(); - if (travelEngine.locationExistsWueste(locationName)) { - travelEngine.travelTo(new Location(locationName, new ArrayList(), new ArrayList())); - System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); - } else { + if (!travelEngine.locationExistsWueste(locationName)) { exittravelCommand(); return; } - } + } travelEngine.travelTo(new Location(locationName, new ArrayList(), new ArrayList())); + System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET); } } From bb8a153920ac4f1149f05b3193b48ec53a134e3a Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Mon, 6 Feb 2023 11:02:39 +0100 Subject: [PATCH 45/56] refactoring: Removed unused Code --- src/main/java/org/bitbiome/classes/TravelEngine.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/bitbiome/classes/TravelEngine.java b/src/main/java/org/bitbiome/classes/TravelEngine.java index 322fdd6..08c0fcf 100644 --- a/src/main/java/org/bitbiome/classes/TravelEngine.java +++ b/src/main/java/org/bitbiome/classes/TravelEngine.java @@ -1,11 +1,15 @@ package org.bitbiome.classes; +import org.bitbiome.entities.Item; import org.bitbiome.entities.Location; +import org.bitbiome.entities.Mob; import org.bitbiome.entities.Player; import org.json.JSONArray; import org.json.JSONObject; +import org.bitbiome.classes.TravelEngine; import java.util.ArrayList; +import java.util.Scanner; public class TravelEngine { @@ -46,7 +50,6 @@ public class TravelEngine { public boolean locationExistsWald(String name) { boolean found = false; - for (int i = 0; i < locations.length(); i++) if (locations.getJSONObject(1).getString("name").equals(name) | locations.getJSONObject(4).getString("name").equals(name) | locations.getJSONObject(3).getString("name").equals(name)) { found = true; } @@ -55,7 +58,6 @@ public class TravelEngine { public boolean locationExistsStrand(String name) { boolean found = false; - for (int i = 0; i < locations.length(); i++) if (locations.getJSONObject(5).getString("name").equals(name) | locations.getJSONObject(0).getString("name").equals(name)) { found = true; } @@ -64,7 +66,6 @@ public class TravelEngine { public boolean locationExistsGruenland(String name) { boolean found = false; - for (int i = 0; i < locations.length(); i++) if (locations.getJSONObject(5).getString("name").equals(name) | locations.getJSONObject(0).getString("name").equals(name) | locations.getJSONObject(2).getString("name").equals(name)) { found = true; } @@ -73,7 +74,6 @@ public class TravelEngine { public boolean locationExistsBerge(String name) { boolean found = false; - for (int i = 0; i < locations.length(); i++) if (locations.getJSONObject(0).getString("name").equals(name) | locations.getJSONObject(2).getString("name").equals(name)) { found = true; } @@ -82,7 +82,6 @@ public class TravelEngine { public boolean locationExistsWinterland(String name) { boolean found = false; - for (int i = 0; i < locations.length(); i++) if (locations.getJSONObject(4).getString("name").equals(name) | locations.getJSONObject(3).getString("name").equals(name)) { found = true; } @@ -91,7 +90,6 @@ public class TravelEngine { public boolean locationExistsWueste(String name) { boolean found = false; - for (int i = 0; i < locations.length(); i++) if (locations.getJSONObject(1).getString("name").equals(name) | locations.getJSONObject(4).getString("name").equals(name)) { found = true; } From 3afddf67d71a12a2ae4470a56a57f31d62efe10c Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Mon, 6 Feb 2023 11:04:55 +0100 Subject: [PATCH 46/56] refactoring: Removed unused imports --- src/main/java/org/bitbiome/classes/TravelEngine.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/bitbiome/classes/TravelEngine.java b/src/main/java/org/bitbiome/classes/TravelEngine.java index 08c0fcf..5b1d785 100644 --- a/src/main/java/org/bitbiome/classes/TravelEngine.java +++ b/src/main/java/org/bitbiome/classes/TravelEngine.java @@ -1,15 +1,15 @@ package org.bitbiome.classes; -import org.bitbiome.entities.Item; + import org.bitbiome.entities.Location; -import org.bitbiome.entities.Mob; + import org.bitbiome.entities.Player; import org.json.JSONArray; import org.json.JSONObject; -import org.bitbiome.classes.TravelEngine; + import java.util.ArrayList; -import java.util.Scanner; + public class TravelEngine { From ca19d6410378782489bd9fdbdcb72ef7e294c125 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Wed, 8 Feb 2023 00:23:28 +0100 Subject: [PATCH 47/56] created GoldCommand --- .../bitbiome/commands/CommandListener.java | 1 + .../org/bitbiome/commands/GoldCommand.java | 23 +++++++++++++++++++ .../java/org/bitbiome/entities/Player.java | 9 ++++++++ 3 files changed, 33 insertions(+) create mode 100644 src/main/java/org/bitbiome/commands/GoldCommand.java diff --git a/src/main/java/org/bitbiome/commands/CommandListener.java b/src/main/java/org/bitbiome/commands/CommandListener.java index 7d03184..43011db 100644 --- a/src/main/java/org/bitbiome/commands/CommandListener.java +++ b/src/main/java/org/bitbiome/commands/CommandListener.java @@ -19,6 +19,7 @@ public class CommandListener { commands.put("location", new LocationCommand()); commands.put("travel", new TravelCommand()); commands.put("map", new MapCommand()); + commands.put("gold", new GoldCommand()); } public HashMap returnCommands() { diff --git a/src/main/java/org/bitbiome/commands/GoldCommand.java b/src/main/java/org/bitbiome/commands/GoldCommand.java new file mode 100644 index 0000000..4330cf5 --- /dev/null +++ b/src/main/java/org/bitbiome/commands/GoldCommand.java @@ -0,0 +1,23 @@ +package org.bitbiome.commands; + +import java.util.Scanner; + +import org.bitbiome.classes.TravelEngine; +import org.bitbiome.entities.Player; + + + + +public class GoldCommand implements CommandAPI{ + + + public static String getGoldMessage(Player player) { + return "Dein Gold: " + player.getGold(); + } + + @Override + public void performCommand(Scanner scanner, boolean isRunning, String message, TravelEngine travelEngine) { + System.out.println(getGoldMessage(travelEngine.getPlayer())); + return; + } +} diff --git a/src/main/java/org/bitbiome/entities/Player.java b/src/main/java/org/bitbiome/entities/Player.java index ff8dffb..3cb83c5 100644 --- a/src/main/java/org/bitbiome/entities/Player.java +++ b/src/main/java/org/bitbiome/entities/Player.java @@ -8,6 +8,10 @@ import java.util.ArrayList; public class Player { private String name; private float hp; + + + + private float gold; private Location location; private ArrayList inventory; @@ -20,6 +24,7 @@ public class Player { hp = 100.0F; location = new Location(jp.getJSONObject("playerconfig.json").getString("currentLocation"), new ArrayList<>(), new ArrayList<>()); inventory = new ArrayList<>(); + gold = jp.getJSONObject("playerconfig.json").getFloat("gold"); } public String getName() { @@ -58,4 +63,8 @@ public class Player { this.name = name; } + public float getGold() { return gold; } + + public void setGold(float gold) { this.gold = gold; } + } From 923db63efc813b2a9f322a4d72e494e8740087e7 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Wed, 8 Feb 2023 00:25:19 +0100 Subject: [PATCH 48/56] refactoring: created Strings for colored Maptext --- .../org/bitbiome/commands/MapCommand.java | 51 ++++++++++++------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index 0495820..ba9afec 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -10,7 +10,20 @@ public class MapCommand implements CommandAPI{ System.out.println(getMapMessage(travelEngine)); } public static String getLocationMessage(TravelEngine travelEngine) { - return "Du befindest dich gerade hier: " + Colors.ANSI_GREEN + travelEngine.getPlayer().getLocation().getName(); + return "Du befindest dich gerade hier: " + Colors.ANSI_GREEN + travelEngine.getPlayer().getLocation().getName() + "\n" + Colors.ANSI_RESET; + } + private static String textColor(String text, String color) { + return color + text + Colors.ANSI_RESET; + } + + private static String textBlack(String text) { + return textColor(text,Colors.ANSI_BRIGHT_BLACK); + } + private static String textBlue(String text) { + return textColor(text,Colors.ANSI_BLUE); + } + private static String textGreen(String text) { + return textColor(text,Colors.ANSI_GREEN); } public static String getMapMessage(TravelEngine travelEngine) { StringBuilder outputMessage = new StringBuilder(); @@ -23,96 +36,96 @@ public class MapCommand implements CommandAPI{ String locationBerge = locations.getJSONObject(3).getString("name"); if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wald")) { outputMessage - .append(getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n\n") + .append(getLocationMessage(travelEngine) + "Zu den " + textBlue("blau ") + "markierten Standorten kannst du reisen\n\n") .append("Deine Karte:\n\n") .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationGruenland + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationWinterland + Colors.ANSI_RESET + " |" + "\n") + .append("| " + textBlack(locationWueste) + " | " + textBlue(locationGruenland) + " | " + textBlack(locationWinterland) + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BLUE + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locationWald + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationBerge + Colors.ANSI_RESET + " |" + "\n") + .append("| " + textBlue(locationStrand) + " | " + textGreen(locationWald) + " | " + textBlue(locationBerge) + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Strand")) { outputMessage - .append(getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n\n") + .append(getLocationMessage(travelEngine) + "Zu den " + textBlue("blau ") + "markierten Standorten kannst du reisen\n\n") .append("Deine Karte:\n\n") .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BLUE + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationGruenland + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationWinterland + Colors.ANSI_RESET + " |" + "\n") + .append("| " + textBlue(locationWueste) + " | " + textBlack(locationGruenland) + " | " + textBlack(locationWinterland) + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_GREEN + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationWald + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationBerge + Colors.ANSI_RESET + " |" + "\n") + .append("| " + textGreen(locationStrand) + " | " + textBlue(locationWald) + " | " + textBlack(locationBerge) + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Berge")) { outputMessage - .append(getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n\n") + .append(getLocationMessage(travelEngine) + "Zu den " + textBlue("blau ") + "markierten Standorten kannst du reisen\n\n") .append("Deine Karte:\n\n") .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationGruenland + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationWinterland + Colors.ANSI_RESET + " |" + "\n") + .append("| " + textBlack(locationWueste) + " | " + textBlack(locationGruenland) + " | " + textBlue(locationWinterland) + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationWald + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locationBerge + Colors.ANSI_RESET + " |" + "\n") + .append("| " + textBlack(locationStrand) + " | " + textBlue(locationWald) + " | " + textGreen(locationBerge) + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wueste")) { outputMessage - .append(getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n\n") + .append(getLocationMessage(travelEngine) + "Zu den " + textBlue("blau ") + "markierten Standorten kannst du reisen\n\n") .append("Deine Karte:\n\n") .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_GREEN + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationGruenland + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationWinterland + Colors.ANSI_RESET + " |" + "\n") + .append("| " + textGreen(locationWueste) + " | " + textBlue(locationGruenland) + " | " + textBlack(locationWinterland) + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BLUE + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationWald + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationBerge + Colors.ANSI_RESET + " |" + "\n") + .append("| " + textBlue(locationStrand) + " | " + textBlack(locationWald) + " | " + textBlack(locationBerge) + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Gruenland")) { outputMessage - .append(getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n\n") + .append(getLocationMessage(travelEngine) + "Zu den " + textBlue("blau ") + "markierten Standorten kannst du reisen\n\n") .append("Deine Karte:\n\n") .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BLUE + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locationGruenland + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationWinterland + Colors.ANSI_RESET + " |" + "\n") + .append("| " + textBlue(locationWueste) + " | " + textGreen(locationGruenland) + " | " + textBlue(locationWinterland) + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationWald + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationBerge + Colors.ANSI_RESET + " |" + "\n") + .append("| " + textBlack(locationStrand) + " | " + textBlue(locationWald) + " | " + textBlack(locationBerge) + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); } else { outputMessage - .append(getLocationMessage(travelEngine) + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n\n") + .append(getLocationMessage(travelEngine) + "Zu den " + textBlue("blau ") + "markierten Standorten kannst du reisen\n\n") .append("Deine Karte:\n\n") .append(" __________________________________________________________________________________________________\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locationWueste + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationGruenland + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + locationWinterland + Colors.ANSI_RESET + " |" + "\n") + .append("| " + textBlack(locationWueste) + " | " + textBlue(locationGruenland) + " | " + textGreen(locationWinterland) + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n") .append("| | | |\n") .append("| | | |\n") - .append("| " + Colors.ANSI_BRIGHT_BLACK + locationStrand + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + locationWald + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + locationBerge + Colors.ANSI_RESET + " |" + "\n") + .append("| " + textBlack(locationStrand) + " | " + textBlack(locationWald) + " | " + textBlue(locationBerge) + " |" + "\n") .append("| | | |\n") .append("|________________________________|________________________________|________________________________|\n"); } From 32b3a5ecfbf53ae337d00934edebfb785cf1292f Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Wed, 8 Feb 2023 00:31:27 +0100 Subject: [PATCH 49/56] Unittest: added Goldcommand --- src/main/java/org/bitbiome/commands/HelpCommand.java | 2 ++ src/test/java/org/bitbiome/commands/HelpCommandTest.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/main/java/org/bitbiome/commands/HelpCommand.java b/src/main/java/org/bitbiome/commands/HelpCommand.java index 938d236..4b53418 100644 --- a/src/main/java/org/bitbiome/commands/HelpCommand.java +++ b/src/main/java/org/bitbiome/commands/HelpCommand.java @@ -30,6 +30,8 @@ public class HelpCommand implements CommandAPI { .append("|" + Colors.ANSI_GREEN + " location" + Colors.ANSI_RESET + " | Gibt deine Location aus |\n") .append("|--------------|-----------------------------|\n") .append("|" + Colors.ANSI_GREEN + " map" + Colors.ANSI_RESET + " | Zeigt dir deinen Karte |\n") + .append("|--------------|-----------------------------|\n") + .append("|" + Colors.ANSI_GREEN + " gold" + Colors.ANSI_RESET + " | Gibt dein Gold an |\n") .append("|______________|_____________________________|\n"); return outputMessage.toString(); diff --git a/src/test/java/org/bitbiome/commands/HelpCommandTest.java b/src/test/java/org/bitbiome/commands/HelpCommandTest.java index 151e747..3229360 100644 --- a/src/test/java/org/bitbiome/commands/HelpCommandTest.java +++ b/src/test/java/org/bitbiome/commands/HelpCommandTest.java @@ -24,6 +24,8 @@ public class HelpCommandTest { .append("|" + Colors.ANSI_GREEN + " location" + Colors.ANSI_RESET + " | Gibt deine Location aus |\n") .append("|--------------|-----------------------------|\n") .append("|" + Colors.ANSI_GREEN + " map" + Colors.ANSI_RESET + " | Zeigt dir deinen Karte |\n") + .append("|--------------|-----------------------------|\n") + .append("|" + Colors.ANSI_GREEN + " gold" + Colors.ANSI_RESET + " | Gibt dein Gold an |\n") .append("|______________|_____________________________|\n"); assertEquals(outputMessage.toString(), helpMessage); } From 1372639a5fe83cdba01ffa64923410e961f1ce5a Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Wed, 8 Feb 2023 01:21:21 +0100 Subject: [PATCH 50/56] refactoring: created string for mapsign --- .../org/bitbiome/commands/MapCommand.java | 103 +++++++----------- 1 file changed, 37 insertions(+), 66 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index ba9afec..6b3a10b 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -25,6 +25,24 @@ public class MapCommand implements CommandAPI{ private static String textGreen(String text) { return textColor(text,Colors.ANSI_GREEN); } + private static String signup() { + return (" __________________________________________________________________________________________________\n"); + } + private static String signdown() { + return ("|________________________________|________________________________|________________________________|\n"); + } + private static String signmiddle() { + return ("| | | |\n"); + } + private static String mapup(TravelEngine travelEngine) { + return getLocationMessage(travelEngine) + "Zu den " + textBlue("blau ") + "markierten Standorten kannst du reisen\n\nDeine Karte:\n\n" + signup() + signmiddle() + signmiddle(); + } + private static String mapmiddle() { + return signmiddle() + signdown() + signmiddle() + signmiddle(); + } + private static String mapdown() { + return signmiddle() + signdown(); + } public static String getMapMessage(TravelEngine travelEngine) { StringBuilder outputMessage = new StringBuilder(); JSONArray locations = travelEngine.getLocationList(); @@ -34,100 +52,53 @@ public class MapCommand implements CommandAPI{ String locationStrand = locations.getJSONObject(1).getString("name"); String locationWald = locations.getJSONObject(0).getString("name"); String locationBerge = locations.getJSONObject(3).getString("name"); + if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wald")) { outputMessage - .append(getLocationMessage(travelEngine) + "Zu den " + textBlue("blau ") + "markierten Standorten kannst du reisen\n\n") - .append("Deine Karte:\n\n") - .append(" __________________________________________________________________________________________________\n") - .append("| | | |\n") - .append("| | | |\n") + .append(mapup(travelEngine)) .append("| " + textBlack(locationWueste) + " | " + textBlue(locationGruenland) + " | " + textBlack(locationWinterland) + " |" + "\n") - .append("| | | |\n") - .append("|________________________________|________________________________|________________________________|\n") - .append("| | | |\n") - .append("| | | |\n") + .append(mapmiddle()) .append("| " + textBlue(locationStrand) + " | " + textGreen(locationWald) + " | " + textBlue(locationBerge) + " |" + "\n") - .append("| | | |\n") - .append("|________________________________|________________________________|________________________________|\n"); + .append(mapdown()); } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Strand")) { outputMessage - .append(getLocationMessage(travelEngine) + "Zu den " + textBlue("blau ") + "markierten Standorten kannst du reisen\n\n") - .append("Deine Karte:\n\n") - .append(" __________________________________________________________________________________________________\n") - .append("| | | |\n") - .append("| | | |\n") + .append(mapup(travelEngine)) .append("| " + textBlue(locationWueste) + " | " + textBlack(locationGruenland) + " | " + textBlack(locationWinterland) + " |" + "\n") - .append("| | | |\n") - .append("|________________________________|________________________________|________________________________|\n") - .append("| | | |\n") - .append("| | | |\n") + .append(mapmiddle()) .append("| " + textGreen(locationStrand) + " | " + textBlue(locationWald) + " | " + textBlack(locationBerge) + " |" + "\n") - .append("| | | |\n") - .append("|________________________________|________________________________|________________________________|\n"); + .append(mapdown()); } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Berge")) { outputMessage - .append(getLocationMessage(travelEngine) + "Zu den " + textBlue("blau ") + "markierten Standorten kannst du reisen\n\n") - .append("Deine Karte:\n\n") - .append(" __________________________________________________________________________________________________\n") - .append("| | | |\n") - .append("| | | |\n") + .append(mapup(travelEngine)) .append("| " + textBlack(locationWueste) + " | " + textBlack(locationGruenland) + " | " + textBlue(locationWinterland) + " |" + "\n") - .append("| | | |\n") - .append("|________________________________|________________________________|________________________________|\n") - .append("| | | |\n") - .append("| | | |\n") + .append(mapmiddle()) .append("| " + textBlack(locationStrand) + " | " + textBlue(locationWald) + " | " + textGreen(locationBerge) + " |" + "\n") - .append("| | | |\n") - .append("|________________________________|________________________________|________________________________|\n"); + .append(mapdown()); } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wueste")) { outputMessage - .append(getLocationMessage(travelEngine) + "Zu den " + textBlue("blau ") + "markierten Standorten kannst du reisen\n\n") - .append("Deine Karte:\n\n") - .append(" __________________________________________________________________________________________________\n") - .append("| | | |\n") - .append("| | | |\n") + .append(mapup(travelEngine)) .append("| " + textGreen(locationWueste) + " | " + textBlue(locationGruenland) + " | " + textBlack(locationWinterland) + " |" + "\n") - .append("| | | |\n") - .append("|________________________________|________________________________|________________________________|\n") - .append("| | | |\n") - .append("| | | |\n") + .append(mapmiddle()) .append("| " + textBlue(locationStrand) + " | " + textBlack(locationWald) + " | " + textBlack(locationBerge) + " |" + "\n") - .append("| | | |\n") - .append("|________________________________|________________________________|________________________________|\n"); + .append(mapdown()); } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Gruenland")) { outputMessage - .append(getLocationMessage(travelEngine) + "Zu den " + textBlue("blau ") + "markierten Standorten kannst du reisen\n\n") - .append("Deine Karte:\n\n") - .append(" __________________________________________________________________________________________________\n") - .append("| | | |\n") - .append("| | | |\n") + .append(mapup(travelEngine)) .append("| " + textBlue(locationWueste) + " | " + textGreen(locationGruenland) + " | " + textBlue(locationWinterland) + " |" + "\n") - .append("| | | |\n") - .append("|________________________________|________________________________|________________________________|\n") - .append("| | | |\n") - .append("| | | |\n") + .append(mapmiddle()) .append("| " + textBlack(locationStrand) + " | " + textBlue(locationWald) + " | " + textBlack(locationBerge) + " |" + "\n") - .append("| | | |\n") - .append("|________________________________|________________________________|________________________________|\n"); + .append(mapdown()); } else { outputMessage - .append(getLocationMessage(travelEngine) + "Zu den " + textBlue("blau ") + "markierten Standorten kannst du reisen\n\n") - .append("Deine Karte:\n\n") - .append(" __________________________________________________________________________________________________\n") - .append("| | | |\n") - .append("| | | |\n") + .append(mapup(travelEngine)) .append("| " + textBlack(locationWueste) + " | " + textBlue(locationGruenland) + " | " + textGreen(locationWinterland) + " |" + "\n") - .append("| | | |\n") - .append("|________________________________|________________________________|________________________________|\n") - .append("| | | |\n") - .append("| | | |\n") + .append(mapmiddle()) .append("| " + textBlack(locationStrand) + " | " + textBlack(locationWald) + " | " + textBlue(locationBerge) + " |" + "\n") - .append("| | | |\n") - .append("|________________________________|________________________________|________________________________|\n"); + .append(mapdown()); } return outputMessage.toString(); } From 4abf14bb4d85182bc1315f9f9730c69d2ace98a9 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Wed, 8 Feb 2023 01:29:13 +0100 Subject: [PATCH 51/56] refactoring: used append instead of '+' --- .../org/bitbiome/commands/MapCommand.java | 36 +++++++------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/MapCommand.java b/src/main/java/org/bitbiome/commands/MapCommand.java index 6b3a10b..0e6f35c 100644 --- a/src/main/java/org/bitbiome/commands/MapCommand.java +++ b/src/main/java/org/bitbiome/commands/MapCommand.java @@ -55,49 +55,37 @@ public class MapCommand implements CommandAPI{ if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wald")) { outputMessage - .append(mapup(travelEngine)) - .append("| " + textBlack(locationWueste) + " | " + textBlue(locationGruenland) + " | " + textBlack(locationWinterland) + " |" + "\n") - .append(mapmiddle()) - .append("| " + textBlue(locationStrand) + " | " + textGreen(locationWald) + " | " + textBlue(locationBerge) + " |" + "\n") + .append(mapup(travelEngine)).append("| ").append(textBlack(locationWueste)).append(" | ").append(textBlue(locationGruenland)).append(" | ").append(textBlack(locationWinterland)).append(" |").append("\n") + .append(mapmiddle()).append("| ").append(textBlue(locationStrand)).append(" | ").append(textGreen(locationWald)).append(" | ").append(textBlue(locationBerge)).append(" |").append("\n") .append(mapdown()); } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Strand")) { outputMessage - .append(mapup(travelEngine)) - .append("| " + textBlue(locationWueste) + " | " + textBlack(locationGruenland) + " | " + textBlack(locationWinterland) + " |" + "\n") - .append(mapmiddle()) - .append("| " + textGreen(locationStrand) + " | " + textBlue(locationWald) + " | " + textBlack(locationBerge) + " |" + "\n") + .append(mapup(travelEngine)).append("| ").append(textBlue(locationWueste)).append(" | ").append(textBlack(locationGruenland)).append(" | ").append(textBlack(locationWinterland)).append(" |").append("\n") + .append(mapmiddle()).append("| ").append(textGreen(locationStrand)).append(" | ").append(textBlue(locationWald)).append(" | ").append(textBlack(locationBerge)).append(" |").append("\n") .append(mapdown()); } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Berge")) { outputMessage - .append(mapup(travelEngine)) - .append("| " + textBlack(locationWueste) + " | " + textBlack(locationGruenland) + " | " + textBlue(locationWinterland) + " |" + "\n") - .append(mapmiddle()) - .append("| " + textBlack(locationStrand) + " | " + textBlue(locationWald) + " | " + textGreen(locationBerge) + " |" + "\n") + .append(mapup(travelEngine)).append("| ").append(textBlack(locationWueste)).append(" | ").append(textBlack(locationGruenland)).append(" | ").append(textBlue(locationWinterland)).append(" |").append("\n") + .append(mapmiddle()).append("| ").append(textBlack(locationStrand)).append(" | ").append(textBlue(locationWald)).append(" | ").append(textGreen(locationBerge)).append(" |").append("\n") .append(mapdown()); } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wueste")) { outputMessage - .append(mapup(travelEngine)) - .append("| " + textGreen(locationWueste) + " | " + textBlue(locationGruenland) + " | " + textBlack(locationWinterland) + " |" + "\n") - .append(mapmiddle()) - .append("| " + textBlue(locationStrand) + " | " + textBlack(locationWald) + " | " + textBlack(locationBerge) + " |" + "\n") + .append(mapup(travelEngine)).append("| ").append(textGreen(locationWueste)).append(" | ").append(textBlue(locationGruenland)).append(" | ").append(textBlack(locationWinterland)).append(" |").append("\n") + .append(mapmiddle()).append("| ").append(textBlue(locationStrand)).append(" | ").append(textBlack(locationWald)).append(" | ").append(textBlack(locationBerge)).append(" |").append("\n") .append(mapdown()); } else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Gruenland")) { outputMessage - .append(mapup(travelEngine)) - .append("| " + textBlue(locationWueste) + " | " + textGreen(locationGruenland) + " | " + textBlue(locationWinterland) + " |" + "\n") - .append(mapmiddle()) - .append("| " + textBlack(locationStrand) + " | " + textBlue(locationWald) + " | " + textBlack(locationBerge) + " |" + "\n") + .append(mapup(travelEngine)).append("| ").append(textBlue(locationWueste)).append(" | ").append(textGreen(locationGruenland)).append(" | ").append(textBlue(locationWinterland)).append(" |").append("\n") + .append(mapmiddle()).append("| ").append(textBlack(locationStrand)).append(" | ").append(textBlue(locationWald)).append(" | ").append(textBlack(locationBerge)).append(" |").append("\n") .append(mapdown()); } else { outputMessage - .append(mapup(travelEngine)) - .append("| " + textBlack(locationWueste) + " | " + textBlue(locationGruenland) + " | " + textGreen(locationWinterland) + " |" + "\n") - .append(mapmiddle()) - .append("| " + textBlack(locationStrand) + " | " + textBlack(locationWald) + " | " + textBlue(locationBerge) + " |" + "\n") + .append(mapup(travelEngine)).append("| ").append(textBlack(locationWueste)).append(" | ").append(textBlue(locationGruenland)).append(" | ").append(textGreen(locationWinterland)).append(" |").append("\n") + .append(mapmiddle()).append("| ").append(textBlack(locationStrand)).append(" | ").append(textBlack(locationWald)).append(" | ").append(textBlue(locationBerge)).append(" |").append("\n") .append(mapdown()); } return outputMessage.toString(); From b73ea098b6e2b5ca25c6289a67d6c5f57e04d149 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Wed, 8 Feb 2023 10:56:24 +0100 Subject: [PATCH 52/56] added 'doesDamage', changed damage number ranges to static numbers --- src/main/resources/items.json | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/main/resources/items.json b/src/main/resources/items.json index 5edb067..6329a39 100644 --- a/src/main/resources/items.json +++ b/src/main/resources/items.json @@ -1,9 +1,10 @@ [ { "name": "Holz", - "damage": "1-3", + "damage": "2", "crafting": true, "durability": 1000, + "doesDamage": true, "amountShop": 10, "gold": 10 }, @@ -12,14 +13,16 @@ "damage": "1000", "crafting": false, "durability": 1000, + "doesDamage": true, "amountShop": 1, "gold": 1000 }, { "name": "Stein", - "damage": "5-10", + "damage": "7", "crafting": true, "durability": 1000, + "doesDamage": true, "amountShop": 1500, "gold": 2 }, @@ -28,6 +31,7 @@ "damage": "0", "crafting": true, "durability": 1000, + "doesDamage": false, "amountShop": 500, "gold": 100 }, @@ -36,6 +40,7 @@ "damage": "2", "crafting": true, "durability": 1000, + "doesDamage": true, "amountShop": 1500, "gold": 1 }, @@ -44,6 +49,7 @@ "damage": "1", "crafting": true, "durability": 1000, + "doesDamage": true, "amountShop": 1000, "gold": 1 }, @@ -52,6 +58,7 @@ "damage": "4", "crafting": true, "durability": 1000, + "doesDamage": true, "amountShop": 750, "gold": 1 }, @@ -60,6 +67,7 @@ "damage": "5", "crafting": true, "durability": 1000, + "doesDamage": true, "amountShop": 1000, "gold": 1 }, @@ -68,6 +76,7 @@ "damage": "1", "crafting": true, "durability": 10, + "doesDamage": true, "amountShop": 100, "gold": 1 }, @@ -76,6 +85,7 @@ "damage": "20", "crafting": true, "durability": 1000, + "doesDamage": true, "amountShop": 250, "gold": 5 }, @@ -84,14 +94,16 @@ "damage": "10", "crafting": true, "durability": 1000, + "doesDamage": true, "amountShop": 400, "gold": 3 }, { "name": "Feuerstein", - "damage": "5-10", + "damage": "0", "crafting": true, "durability": 1000, + "doesDamage": false, "amountShop": 1500, "gold": 2 }, @@ -100,6 +112,7 @@ "damage": "0", "crafting": true, "durability": 5, + "doesDamage": false, "amountShop": 1500, "gold": 1 }, @@ -108,6 +121,7 @@ "damage": "0", "crafting": true, "durability": 1000, + "doesDamage": false, "amountShop": 3000, "gold": 1 }, @@ -116,6 +130,7 @@ "damage": "15-20", "crafting": true, "durability": 1000, + "doesDamage": true, "amountShop": 300, "gold": 1 }, @@ -124,6 +139,7 @@ "damage": "5", "crafting": true, "durability": 1000, + "doesDamage": true, "amountShop": 300, "gold": 3 }, @@ -132,6 +148,7 @@ "damage": "0", "crafting": true, "durability": 1000, + "doesDamage": false, "amountShop": 200, "gold": 3 }, @@ -140,6 +157,7 @@ "damage": "1", "crafting": true, "durability": 1000, + "doesDamage": true, "amountShop": 1500, "gold": 1 }, @@ -148,6 +166,7 @@ "damage": "6", "crafting": true, "durability": 1000, + "doesDamage": true, "amountShop": 450, "gold": 2 }, @@ -156,6 +175,7 @@ "damage": "5", "crafting": true, "durability": 1000, + "doesDamage": true, "amountShop": 700, "gold": 2 } From b6e5c6b1123e164ce445f24fc24085d702caddfe Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Wed, 8 Feb 2023 10:59:05 +0100 Subject: [PATCH 53/56] added 'isFriendly', changed damage number ranges to static numbers --- src/main/resources/mobs.json | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main/resources/mobs.json b/src/main/resources/mobs.json index ce14a1a..036ec32 100644 --- a/src/main/resources/mobs.json +++ b/src/main/resources/mobs.json @@ -2,7 +2,8 @@ { "name": "Big Foot", "hp": 50, - "damage": "10-15", + "damage": "15", + "isFriendly": true, "items": [ "Fell" ] @@ -10,7 +11,8 @@ { "name": "Riesenkrabbe", "hp": 50, - "damage": "10-15", + "damage": "9", + "isFriendly": false, "items": [ "Krabbenschere" ] @@ -18,7 +20,8 @@ { "name": "Yeti", "hp": 55, - "damage": "20-25", + "damage": "17", + "isFriendly": true, "items": [ "Fell", "Yetikralle" @@ -27,7 +30,8 @@ { "name": "Loewe", "hp": 30, - "damage": "10-15", + "damage": "15", + "isFriendly": false, "items": [ "Fell", "Loewenkralle" @@ -36,7 +40,8 @@ { "name": "Drache", "hp": 55, - "damage": "15-20", + "damage": "20", + "isFriendly": false, "items": [ "Drachenzahn", "Drachenhaut" @@ -45,7 +50,8 @@ { "name": "Mumie", "hp": 40, - "damage": "10-15", + "damage": "12", + "isFriendly": false, "items": [ "Knochen" ] From 7dc1ba1b76f9bde1767b2fe8e89fa81f71775f9f Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Wed, 8 Feb 2023 11:07:48 +0100 Subject: [PATCH 54/56] refactoring: changed float to int --- src/main/java/org/bitbiome/commands/GoldCommand.java | 2 +- src/main/java/org/bitbiome/entities/Player.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/GoldCommand.java b/src/main/java/org/bitbiome/commands/GoldCommand.java index 4330cf5..633ea1b 100644 --- a/src/main/java/org/bitbiome/commands/GoldCommand.java +++ b/src/main/java/org/bitbiome/commands/GoldCommand.java @@ -12,7 +12,7 @@ public class GoldCommand implements CommandAPI{ public static String getGoldMessage(Player player) { - return "Dein Gold: " + player.getGold(); + return "Du hast " + player.getGold() + " Gold"; } @Override diff --git a/src/main/java/org/bitbiome/entities/Player.java b/src/main/java/org/bitbiome/entities/Player.java index 3cb83c5..8223d8c 100644 --- a/src/main/java/org/bitbiome/entities/Player.java +++ b/src/main/java/org/bitbiome/entities/Player.java @@ -24,7 +24,7 @@ public class Player { hp = 100.0F; location = new Location(jp.getJSONObject("playerconfig.json").getString("currentLocation"), new ArrayList<>(), new ArrayList<>()); inventory = new ArrayList<>(); - gold = jp.getJSONObject("playerconfig.json").getFloat("gold"); + gold = jp.getJSONObject("playerconfig.json").getInt("gold"); } public String getName() { @@ -63,8 +63,8 @@ public class Player { this.name = name; } - public float getGold() { return gold; } + public int getGold() { return (int) gold; } - public void setGold(float gold) { this.gold = gold; } + public int setGold(int gold) { this.gold = gold; return gold; } } From c4ac756c1ef8eb14f8b590cb176b8126153c3d18 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Wed, 8 Feb 2023 00:23:28 +0100 Subject: [PATCH 55/56] refactoring: Re-added gold command --- src/main/java/org/bitbiome/entities/Player.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/org/bitbiome/entities/Player.java b/src/main/java/org/bitbiome/entities/Player.java index 8223d8c..ace4c01 100644 --- a/src/main/java/org/bitbiome/entities/Player.java +++ b/src/main/java/org/bitbiome/entities/Player.java @@ -11,7 +11,7 @@ public class Player { - private float gold; + private int gold; private Location location; private ArrayList inventory; @@ -24,7 +24,6 @@ public class Player { hp = 100.0F; location = new Location(jp.getJSONObject("playerconfig.json").getString("currentLocation"), new ArrayList<>(), new ArrayList<>()); inventory = new ArrayList<>(); - gold = jp.getJSONObject("playerconfig.json").getInt("gold"); } public String getName() { From bc849695a67a39306d7a60754c42f214396c13c4 Mon Sep 17 00:00:00 2001 From: Tanja Herche Date: Wed, 8 Feb 2023 12:02:24 +0100 Subject: [PATCH 56/56] Merging --- playerconfig.json | 4 +- .../java/org/bitbiome/entities/Player.java | 14 ++++++ src/main/resources/gameconfig.json | 18 ++++---- src/main/resources/items.json | 44 +------------------ 4 files changed, 26 insertions(+), 54 deletions(-) diff --git a/playerconfig.json b/playerconfig.json index 349a291..a7b104c 100644 --- a/playerconfig.json +++ b/playerconfig.json @@ -1,6 +1,6 @@ { "gold": 0, - "name": "Julia", + "name": "null", "hp": 10, "inventory": [ { @@ -20,5 +20,5 @@ "doesDamage": true } ], - "currentLocation": "Wald" + "currentLocation": "Berge" } \ No newline at end of file diff --git a/src/main/java/org/bitbiome/entities/Player.java b/src/main/java/org/bitbiome/entities/Player.java index 02bf2e6..de0977d 100644 --- a/src/main/java/org/bitbiome/entities/Player.java +++ b/src/main/java/org/bitbiome/entities/Player.java @@ -2,6 +2,9 @@ package org.bitbiome.entities; import org.bitbiome.classes.JsonParser; +import org.json.JSONArray; +import org.json.JSONObject; + import java.util.ArrayList; @@ -23,6 +26,14 @@ public class Player { hp = 100.0F; location = new Location(JsonParser.getJSONObject("src/main/resources/playerconfig.json").getString("currentLocation"), new ArrayList<>(), new ArrayList<>()); inventory = new ArrayList<>(); + JSONArray items = JsonParser.getJSONObject("src/main/resources/playerconfig.json").getJSONArray("inventory"); + for (int i = 0; i < items.length(); i++) { + JSONObject o = items.getJSONObject(i); + inventory.add(new Item(o.getString("name"), o.getBoolean("doesDamage"), o.getString("damage"), o.getInt("amount"), o.getInt("gold"))); + } + + + } public Player() { @@ -69,4 +80,7 @@ public class Player { public int setGold(int gold) { this.gold = gold; return gold; } + public void setInventory(ArrayList inventory) { + this.inventory = inventory; + } } diff --git a/src/main/resources/gameconfig.json b/src/main/resources/gameconfig.json index 058ad2f..c460a98 100644 --- a/src/main/resources/gameconfig.json +++ b/src/main/resources/gameconfig.json @@ -1,19 +1,19 @@ { "shopitems": [ { - "gold": 1000, - "amount": 1, - "name": "Heiliges Schwert der Engel" + "gold": 10, + "amount": 10, + "name": "Holz" }, { - "gold": 2, - "amount": 450, - "name": "Knochen" + "gold": 3, + "amount": 400, + "name": "Loewenkralle" }, { - "gold": 1, - "amount": 100, - "name": "Schnee" + "gold": 3, + "amount": 200, + "name": "Drachenhaut" } ], "locations": [ diff --git a/src/main/resources/items.json b/src/main/resources/items.json index e14b0b2..6329a39 100644 --- a/src/main/resources/items.json +++ b/src/main/resources/items.json @@ -1,4 +1,3 @@ -<<<<<<< HEAD [ { "name": "Holz", @@ -180,45 +179,4 @@ "amountShop": 700, "gold": 2 } -] -======= - - [ - { - "name": "Holz", - "damage": "1-3", - "crafting": true, - "doesDamage": true, - "durability": 1000, - "amountShop": 10, - "gold": 10 - }, - { - "name": "Heiliges Schwert der Engel", - "damage": "1000", - "crafting": false, - "doesDamage": true, - "durability": 1000, - "amountShop": 1, - "gold": 1000 - }, - { - "name": "Stein", - "damage": "5-10", - "crafting": true, - "doesDamage": true, - "durability": 1000, - "amountShop": 1500, - "gold": 2 - }, - { - "name": "Fell", - "damage": "0", - "crafting": true, - "doesDamage": false, - "durability": 1000, - "amountShop": 500, - "gold": 100 - } - ] ->>>>>>> 1ffe7490e8fd33b80231ec4852d6ca37658dcd5f +] \ No newline at end of file