From d51e6808d06b1fcb1fdd4b92e103b5373ae7db90 Mon Sep 17 00:00:00 2001 From: sleepymalc Date: Mon, 16 Aug 2021 23:43:29 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=8D[main/WorldData]=20private=20all=20?= =?UTF-8?q?attribute?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../minecraft/Manager/LocationManager.java | 5 ++-- .../minecraft/models/PlayerData.java | 2 +- .../minecraft/models/WorldData.java | 23 +++++++++++++++---- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/linyuanlin/minecraft/Manager/LocationManager.java b/src/main/java/com/linyuanlin/minecraft/Manager/LocationManager.java index 98a7377..50c2063 100644 --- a/src/main/java/com/linyuanlin/minecraft/Manager/LocationManager.java +++ b/src/main/java/com/linyuanlin/minecraft/Manager/LocationManager.java @@ -20,8 +20,9 @@ public void loadLocations() { List docList = app.dbClient.findMany("Location", Filters.empty()); for (Document doc : docList) { tagLocationMap.put(doc.getString("tag"), - new Location(this.app.worldManager.getWorldData(WorldManager.world_lobby).world, - doc.getDouble("x"), doc.getDouble("y"), doc.getDouble("z"))); + new Location(this.app.worldManager.getWorldData(WorldManager.world_lobby) + .getWorld(), doc.getDouble("x"), doc.getDouble("y"), + doc.getDouble("z"))); } } diff --git a/src/main/java/com/linyuanlin/minecraft/models/PlayerData.java b/src/main/java/com/linyuanlin/minecraft/models/PlayerData.java index 0215b3f..f8905bc 100644 --- a/src/main/java/com/linyuanlin/minecraft/models/PlayerData.java +++ b/src/main/java/com/linyuanlin/minecraft/models/PlayerData.java @@ -158,7 +158,7 @@ public void sendWorldTitle(String worldName) { WorldData wd = app.worldManager.getWorldData(worldName); if (wd == null) return; - player.sendTitle(ChatColor.YELLOW + wd.worldName, wd.worldDescription, 20, 80, 20); + player.sendTitle(ChatColor.YELLOW + wd.getWorldName(), wd.getWorldDescription(), 20, 80, 20); } /********* diff --git a/src/main/java/com/linyuanlin/minecraft/models/WorldData.java b/src/main/java/com/linyuanlin/minecraft/models/WorldData.java index 3a9e6e5..d2aabbf 100644 --- a/src/main/java/com/linyuanlin/minecraft/models/WorldData.java +++ b/src/main/java/com/linyuanlin/minecraft/models/WorldData.java @@ -4,10 +4,10 @@ public class WorldData { - public String worldId; - public String worldName; - public String worldDescription; - public World world; + private String worldId; + private String worldName; + private String worldDescription; + private World world; public WorldData(String id, String name, String description, World world) { worldId = id; @@ -16,4 +16,19 @@ public WorldData(String id, String name, String description, World world) { this.world = world; } + public String getWoldId() { + return worldId; + } + + public String getWorldName() { + return worldName; + } + + public String getWorldDescription() { + return worldDescription; + } + + public World getWorld() { + return world; + } }