Split and move settings.json for each map

This commit is contained in:
Lukas Rieger (Blue) 2022-06-06 22:51:26 +02:00
parent a4ce85b9f8
commit 8e8934a8c4
No known key found for this signature in database
GPG Key ID: 2D09EC5ED2687FF2
89 changed files with 448 additions and 243 deletions

@ -1 +1 @@
Subproject commit be1c4b4939d88d8a8da166219c1968ec290e40ac
Subproject commit e2af667e5e81ffdb3fec4e7278a87a5d746926fc

View File

@ -0,0 +1,21 @@
package de.bluecolored.bluemap.common;
import de.bluecolored.bluemap.common.config.*;
import de.bluecolored.bluemap.common.config.storage.StorageConfig;
import java.util.Map;
public interface BlueMapConfigProvider {
CoreConfig getCoreConfig();
WebappConfig getWebappConfig();
WebserverConfig getWebserverConfig();
PluginConfig getPluginConfig();
Map<String, MapConfig> getMapConfigs();
Map<String, StorageConfig> getStorageConfigs();
}

View File

@ -24,13 +24,12 @@
*/
package de.bluecolored.bluemap.common;
import de.bluecolored.bluemap.common.config.BlueMapConfigs;
import de.bluecolored.bluemap.common.config.ConfigurationException;
import de.bluecolored.bluemap.common.config.MapConfig;
import de.bluecolored.bluemap.common.config.storage.StorageConfig;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import de.bluecolored.bluemap.core.MinecraftVersion;
import de.bluecolored.bluemap.core.debug.DebugDump;
import de.bluecolored.bluemap.core.debug.StateDumper;
@ -58,7 +57,7 @@
@DebugDump
public class BlueMapService {
private final ServerInterface serverInterface;
private final BlueMapConfigs configs;
private final BlueMapConfigProvider configs;
private final Map<Path, String> worldIds;
private final Map<String, Storage> storages;
@ -68,9 +67,9 @@ public class BlueMapService {
private ResourcePack resourcePack;
public BlueMapService(ServerInterface serverInterface) throws ConfigurationException {
public BlueMapService(ServerInterface serverInterface, BlueMapConfigProvider configProvider) {
this.serverInterface = serverInterface;
this.configs = new BlueMapConfigs(serverInterface);
this.configs = configProvider;
this.worldIds = new HashMap<>();
this.storages = new HashMap<>();
@ -122,35 +121,27 @@ public synchronized String getWorldId(Path worldFolder) throws IOException {
}
public synchronized void createOrUpdateWebApp(boolean force) throws ConfigurationException {
WebFilesManager webFilesManager = new WebFilesManager(configs.getWebappConfig().getWebroot());
if (force || webFilesManager.needsUpdate()) {
try {
webFilesManager.updateFiles();
} catch (IOException ex) {
throw new ConfigurationException("Failed to update web-app files!", ex);
}
}
}
public synchronized void updateWebAppSettings() throws ConfigurationException, InterruptedException {
try {
WebSettings webSettings = new WebSettings(configs.getWebappConfig().getWebroot().resolve("data").resolve("settings.json"));
WebFilesManager webFilesManager = new WebFilesManager(configs.getWebappConfig().getWebroot());
webSettings.set(configs.getWebappConfig().isUseCookies(), "useCookies");
webSettings.set(configs.getWebappConfig().isEnableFreeFlight(), "freeFlightEnabled");
webSettings.setAllMapsEnabled(false);
for (BmMap map : getMaps().values()) {
webSettings.setMapEnabled(true, map.getId());
webSettings.setFrom(map);
// update web-app files
if (force || webFilesManager.filesNeedUpdate()) {
webFilesManager.updateFiles();
}
int ordinal = 0;
for (var entry : configs.getMapConfigs().entrySet()) {
webSettings.setOrdinal(ordinal++, entry.getKey());
webSettings.setFrom(entry.getValue(), entry.getKey());
// update settings.json
if (!configs.getWebappConfig().isUpdateSettingsFile()) {
webFilesManager.loadSettings();
} else {
webFilesManager.setFrom(configs.getWebappConfig());
}
webSettings.save();
for (String mapId : configs.getMapConfigs().keySet()) {
webFilesManager.addMap(mapId);
}
webFilesManager.saveSettings();
} catch (IOException ex) {
throw new ConfigurationException("Failed to update web-app settings!", ex);
throw new ConfigurationException("Failed to update web-app files!", ex);
}
}
@ -385,7 +376,7 @@ private Collection<Path> getWorldFolders() {
return folders;
}
public BlueMapConfigs getConfigs() {
public BlueMapConfigProvider getConfigs() {
return configs;
}

View File

@ -24,27 +24,68 @@
*/
package de.bluecolored.bluemap.common;
import de.bluecolored.bluemap.common.config.WebappConfig;
import de.bluecolored.bluemap.core.logger.Logger;
import de.bluecolored.bluemap.core.resources.adapter.ResourcesGson;
import org.apache.commons.io.FileUtils;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Enumeration;
import java.nio.file.StandardOpenOption;
import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
public class WebFilesManager {
private final Path webRoot;
private Settings settings;
public WebFilesManager(Path webRoot) {
this.webRoot = webRoot;
this.settings = new Settings();
}
public boolean needsUpdate() {
public Path getSettingsFile() {
return webRoot.resolve("data").resolve("settings.json");
}
public void loadSettings() throws IOException {
try (BufferedReader reader = Files.newBufferedReader(getSettingsFile())) {
this.settings = ResourcesGson.INSTANCE.fromJson(reader, Settings.class);
}
}
public void saveSettings() throws IOException {
Files.createDirectories(getSettingsFile().getParent());
try (BufferedWriter writer = Files.newBufferedWriter(getSettingsFile(),
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) {
ResourcesGson.INSTANCE.toJson(this.settings, writer);
}
}
public void resetSettings() {
this.settings = new Settings();
}
public void addMap(String mapId) {
this.settings.maps.add(mapId);
}
public void removeMap(String mapId) {
this.settings.maps.remove(mapId);
}
public void setFrom(WebappConfig webappConfig) {
this.settings.setFrom(webappConfig);
}
public boolean filesNeedUpdate() {
return !Files.exists(webRoot.resolve("index.html"));
}
@ -77,4 +118,42 @@ public void updateFiles() throws IOException {
}
}
@SuppressWarnings("all")
private static class Settings {
private boolean useCookies = true;
private boolean enableFreeFlight = true;
private String startLocation = null;
private float resolutionDefault = 1;
private int hiresSliderMax = 500;
private int hiresSliderDefault = 200;
private int hiresSliderMin = 50;
private int lowresSliderMax = 10000;
private int lowresSliderDefault = 2000;
private int lowresSliderMin = 500;
private Set<String> maps = new HashSet<>();
public void setFrom(WebappConfig config) {
this.useCookies = config.isUseCookies();
this.enableFreeFlight = config.isEnableFreeFlight();
this.startLocation = config.getStartLocation().orElse(null);
this.resolutionDefault = config.getResolutionDefault();
this.hiresSliderMax = config.getHiresSliderMax();
this.hiresSliderDefault = config.getLowresSliderDefault();
this.hiresSliderMin = config.getHiresSliderMin();
this.lowresSliderMax = config.getLowresSliderMax();
this.lowresSliderDefault = config.getLowresSliderDefault();
this.lowresSliderMin = config.getLowresSliderMin();
}
}
}

View File

@ -1,7 +1,8 @@
package de.bluecolored.bluemap.common.config;
import de.bluecolored.bluemap.common.BlueMapConfigProvider;
import de.bluecolored.bluemap.common.config.storage.StorageConfig;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.serverinterface.ServerInterface;
import de.bluecolored.bluemap.core.BlueMap;
import de.bluecolored.bluemap.core.debug.DebugDump;
import de.bluecolored.bluemap.core.logger.Logger;
@ -20,7 +21,7 @@
import java.util.stream.Stream;
@DebugDump
public class BlueMapConfigs {
public class BlueMapConfigs implements BlueMapConfigProvider {
private final ServerInterface serverInterface;
private final ConfigManager configManager;
@ -33,14 +34,18 @@ public class BlueMapConfigs {
private final Map<String, StorageConfig> storageConfigs;
public BlueMapConfigs(ServerInterface serverInterface) throws ConfigurationException {
this(serverInterface, Path.of("bluemap"), Path.of("bluemap", "web"), true);
}
public BlueMapConfigs(ServerInterface serverInterface, Path defaultDataFolder, Path defaultWebroot, boolean usePluginConf) throws ConfigurationException {
this.serverInterface = serverInterface;
this.configManager = new ConfigManager(serverInterface.getConfigFolder());
this.coreConfig = loadCoreConfig();
this.webserverConfig = loadWebserverConfig();
this.webappConfig = loadWebappConfig();
this.pluginConfig = serverInterface.isPluginConfigEnabled() ? loadPluginConfig() : new PluginConfig();
this.storageConfigs = Collections.unmodifiableMap(loadStorageConfigs());
this.coreConfig = loadCoreConfig(defaultDataFolder);
this.webappConfig = loadWebappConfig(defaultWebroot);
this.webserverConfig = loadWebserverConfig(webappConfig.getWebroot());
this.pluginConfig = usePluginConf ? loadPluginConfig() : new PluginConfig();
this.storageConfigs = Collections.unmodifiableMap(loadStorageConfigs(webappConfig.getWebroot()));
this.mapConfigs = Collections.unmodifiableMap(loadMapConfigs());
}
@ -48,31 +53,37 @@ public ConfigManager getConfigManager() {
return configManager;
}
@Override
public CoreConfig getCoreConfig() {
return coreConfig;
}
@Override
public WebappConfig getWebappConfig() {
return webappConfig;
}
@Override
public WebserverConfig getWebserverConfig() {
return webserverConfig;
}
@Override
public PluginConfig getPluginConfig() {
return pluginConfig;
}
@Override
public Map<String, MapConfig> getMapConfigs() {
return mapConfigs;
}
@Override
public Map<String, StorageConfig> getStorageConfigs() {
return storageConfigs;
}
private synchronized CoreConfig loadCoreConfig() throws ConfigurationException {
private synchronized CoreConfig loadCoreConfig(Path defaultDataFolder) throws ConfigurationException {
Path configFileRaw = Path.of("core");
Path configFile = configManager.findConfigPath(configFileRaw);
Path configFolder = configFile.getParent();
@ -97,6 +108,7 @@ private synchronized CoreConfig loadCoreConfig() throws ConfigurationException {
.setConditional("metrics", serverInterface.isMetricsEnabled() == Tristate.UNDEFINED)
.setVariable("timestamp", LocalDateTime.now().withNano(0).toString())
.setVariable("version", BlueMap.VERSION)
.setVariable("data", formatPath(defaultDataFolder))
.setVariable("implementation", "bukkit")
.setVariable("render-thread-count", Integer.toString(presetRenderThreadCount))
.build(),
@ -110,7 +122,7 @@ private synchronized CoreConfig loadCoreConfig() throws ConfigurationException {
return configManager.loadConfig(configFileRaw, CoreConfig.class);
}
private synchronized WebserverConfig loadWebserverConfig() throws ConfigurationException {
private synchronized WebserverConfig loadWebserverConfig(Path defaultWebroot) throws ConfigurationException {
Path configFileRaw = Path.of("webserver");
Path configFile = configManager.findConfigPath(configFileRaw);
Path configFolder = configFile.getParent();
@ -121,6 +133,7 @@ private synchronized WebserverConfig loadWebserverConfig() throws ConfigurationE
Files.writeString(
configFolder.resolve("webserver.conf"),
configManager.loadConfigTemplate("/de/bluecolored/bluemap/config/webserver.conf")
.setVariable("webroot", formatPath(defaultWebroot))
.build(),
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING
);
@ -132,7 +145,7 @@ private synchronized WebserverConfig loadWebserverConfig() throws ConfigurationE
return configManager.loadConfig(configFileRaw, WebserverConfig.class);
}
private synchronized WebappConfig loadWebappConfig() throws ConfigurationException {
private synchronized WebappConfig loadWebappConfig(Path defaultWebroot) throws ConfigurationException {
Path configFileRaw = Path.of("webapp");
Path configFile = configManager.findConfigPath(configFileRaw);
Path configFolder = configFile.getParent();
@ -143,6 +156,7 @@ private synchronized WebappConfig loadWebappConfig() throws ConfigurationExcepti
Files.writeString(
configFolder.resolve("webapp.conf"),
configManager.loadConfigTemplate("/de/bluecolored/bluemap/config/webapp.conf")
.setVariable("webroot", formatPath(defaultWebroot))
.build(),
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING
);
@ -259,7 +273,7 @@ private synchronized Map<String, MapConfig> loadMapConfigs() throws Configuratio
return mapConfigs;
}
private synchronized Map<String, StorageConfig> loadStorageConfigs() throws ConfigurationException {
private synchronized Map<String, StorageConfig> loadStorageConfigs(Path defaultWebroot) throws ConfigurationException {
Map<String, StorageConfig> storageConfigs = new HashMap<>();
Path storageFolder = Paths.get("storages");
@ -270,7 +284,9 @@ private synchronized Map<String, StorageConfig> loadStorageConfigs() throws Conf
Files.createDirectories(storageConfigFolder);
Files.writeString(
storageConfigFolder.resolve("file.conf"),
configManager.loadConfigTemplate("/de/bluecolored/bluemap/config/storages/file.conf").build(),
configManager.loadConfigTemplate("/de/bluecolored/bluemap/config/storages/file.conf")
.setVariable("root", formatPath(defaultWebroot.resolve("data")))
.build(),
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING
);
Files.writeString(
@ -315,6 +331,7 @@ private String sanitiseMapId(String id) {
private ConfigTemplate createOverworldMapTemplate(String name, Path worldFolder) throws IOException {
return configManager.loadConfigTemplate("/de/bluecolored/bluemap/config/maps/map.conf")
.setVariable("name", name)
.setVariable("sorting", "0")
.setVariable("world", formatPath(worldFolder))
.setVariable("sky-color", "#7dabff")
.setVariable("ambient-light", "0.1")
@ -327,6 +344,7 @@ private ConfigTemplate createOverworldMapTemplate(String name, Path worldFolder)
private ConfigTemplate createNetherMapTemplate(String name, Path worldFolder) throws IOException {
return configManager.loadConfigTemplate("/de/bluecolored/bluemap/config/maps/map.conf")
.setVariable("name", name)
.setVariable("sorting", "100")
.setVariable("world", formatPath(worldFolder))
.setVariable("sky-color", "#290000")
.setVariable("ambient-light", "0.6")
@ -339,6 +357,7 @@ private ConfigTemplate createNetherMapTemplate(String name, Path worldFolder) th
private ConfigTemplate createEndMapTemplate(String name, Path worldFolder) throws IOException {
return configManager.loadConfigTemplate("/de/bluecolored/bluemap/config/maps/map.conf")
.setVariable("name", name)
.setVariable("sorting", "200")
.setVariable("world", formatPath(worldFolder))
.setVariable("sky-color", "#080010")
.setVariable("ambient-light", "0.6")

View File

@ -68,7 +68,7 @@ public int getSorting() {
}
public Optional<Vector2i> getStartPos() {
return Optional.of(startPos);
return Optional.ofNullable(startPos);
}
public String getSkyColor() {

View File

@ -3,10 +3,8 @@
import de.bluecolored.bluemap.core.debug.DebugDump;
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.nio.file.Path;
import java.util.Optional;
@SuppressWarnings({"FieldMayBeFinal", "FieldCanBeLocal"})
@DebugDump
@ -14,6 +12,7 @@
public class WebappConfig {
private boolean enabled = true;
private boolean updateSettingsFile = true;
private Path webroot = Path.of("bluemap", "web");
@ -21,6 +20,18 @@ public class WebappConfig {
private boolean enableFreeFlight = true;
private String startLocation = null;
private float resolutionDefault = 1;
private int hiresSliderMax = 500;
private int hiresSliderDefault = 200;
private int hiresSliderMin = 50;
private int lowresSliderMax = 10000;
private int lowresSliderDefault = 2000;
private int lowresSliderMin = 500;
public boolean isEnabled() {
return enabled;
}
@ -29,6 +40,10 @@ public Path getWebroot() {
return webroot;
}
public boolean isUpdateSettingsFile() {
return updateSettingsFile;
}
public boolean isUseCookies() {
return useCookies;
}
@ -37,4 +52,36 @@ public boolean isEnableFreeFlight() {
return enableFreeFlight;
}
public Optional<String> getStartLocation() {
return Optional.ofNullable(startLocation);
}
public float getResolutionDefault() {
return resolutionDefault;
}
public int getHiresSliderMax() {
return hiresSliderMax;
}
public int getHiresSliderDefault() {
return hiresSliderDefault;
}
public int getHiresSliderMin() {
return hiresSliderMin;
}
public int getLowresSliderMax() {
return lowresSliderMax;
}
public int getLowresSliderDefault() {
return lowresSliderDefault;
}
public int getLowresSliderMin() {
return lowresSliderMin;
}
}

View File

@ -26,8 +26,8 @@
import com.google.gson.stream.JsonWriter;
import de.bluecolored.bluemap.common.config.PluginConfig;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.webserver.HttpRequest;
import de.bluecolored.bluemap.common.webserver.HttpRequestHandler;
import de.bluecolored.bluemap.common.webserver.HttpResponse;
@ -102,6 +102,7 @@ public HttpResponse handlePlayersRequest(HttpRequest request) {
if (!player.isOnline()) continue;
if (config.isHideInvisible() && player.isInvisible()) continue;
if (config.isHideVanished() && player.isVanished()) continue;
if (config.isHideSneaking() && player.isSneaking()) continue;
if (config.getHiddenGameModes().contains(player.getGamemode().getId())) continue;

View File

@ -24,13 +24,14 @@
*/
package de.bluecolored.bluemap.common.plugin;
import de.bluecolored.bluemap.common.BlueMapConfigProvider;
import de.bluecolored.bluemap.common.BlueMapService;
import de.bluecolored.bluemap.common.InterruptableReentrantLock;
import de.bluecolored.bluemap.common.MissingResourcesException;
import de.bluecolored.bluemap.common.config.*;
import de.bluecolored.bluemap.common.live.LiveAPIRequestHandler;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.plugin.skins.PlayerSkinUpdater;
import de.bluecolored.bluemap.common.rendermanager.MapUpdateTask;
import de.bluecolored.bluemap.common.rendermanager.RenderManager;
@ -100,7 +101,7 @@ public void load() throws IOException {
unload(); //ensure nothing is left running (from a failed load or something)
//load configs
blueMap = new BlueMapService(serverInterface);
blueMap = new BlueMapService(serverInterface, new BlueMapConfigs(serverInterface));
CoreConfig coreConfig = getConfigs().getCoreConfig();
WebserverConfig webserverConfig = getConfigs().getWebserverConfig();
WebappConfig webappConfig = getConfigs().getWebappConfig();
@ -123,7 +124,12 @@ public void load() throws IOException {
} catch (MissingResourcesException ex) {
Logger.global.logWarning("BlueMap is missing important resources!");
Logger.global.logWarning("You must accept the required file download in order for BlueMap to work!");
Logger.global.logWarning("Please check: " + blueMap.getConfigs().getConfigManager().findConfigPath(Path.of("core")).toAbsolutePath().normalize());
BlueMapConfigProvider configProvider = blueMap.getConfigs();
if (configProvider instanceof BlueMapConfigs) {
Logger.global.logWarning("Please check: " + ((BlueMapConfigs) configProvider).getConfigManager().findConfigPath(Path.of("core")).toAbsolutePath().normalize());
}
Logger.global.logInfo("If you have changed the config you can simply reload the plugin using: /bluemap reload");
unload();
@ -193,7 +199,6 @@ public void load() throws IOException {
//update webapp and settings
blueMap.createOrUpdateWebApp(false);
blueMap.updateWebAppSettings();
//start skin updater
if (pluginConfig.isLivePlayerMarkers()) {
@ -428,7 +433,7 @@ public BlueMapService getBlueMap() {
return blueMap;
}
public BlueMapConfigs getConfigs() {
public BlueMapConfigProvider getConfigs() {
return blueMap.getConfigs();
}

View File

@ -45,7 +45,7 @@
import de.bluecolored.bluemap.api.marker.POIMarker;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.PluginState;
import de.bluecolored.bluemap.common.plugin.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.plugin.text.Text;
import de.bluecolored.bluemap.common.plugin.text.TextColor;
import de.bluecolored.bluemap.common.plugin.text.TextFormat;

View File

@ -24,7 +24,7 @@
*/
package de.bluecolored.bluemap.common.plugin.skins;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.core.debug.DebugDump;
import org.apache.commons.io.FileUtils;

View File

@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.bluecolored.bluemap.common.plugin.serverinterface;
package de.bluecolored.bluemap.common.serverinterface;
import java.util.Optional;

View File

@ -1,4 +1,4 @@
package de.bluecolored.bluemap.common.plugin.serverinterface;
package de.bluecolored.bluemap.common.serverinterface;
import java.nio.file.Path;

View File

@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.bluecolored.bluemap.common.plugin.serverinterface;
package de.bluecolored.bluemap.common.serverinterface;
public enum Gamemode {

View File

@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.bluecolored.bluemap.common.plugin.serverinterface;
package de.bluecolored.bluemap.common.serverinterface;
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.plugin.text.Text;
@ -44,7 +44,6 @@ public interface Player {
/**
* Return <code>true</code> if the player is sneaking.
* <p><i>If the player is offline the value of this method is undetermined.</i></p>
* @return
*/
boolean isSneaking();
@ -54,6 +53,14 @@ public interface Player {
*/
boolean isInvisible();
/**
* Returns <code>true</code> if the player is vanished
* <p><i>If the player is offline the value of this method is undetermined.</i></p>
*/
default boolean isVanished() {
return false;
}
/**
* Returns the {@link Gamemode} this player is in
* <p><i>If the player is offline the value of this method is undetermined.</i></p>

View File

@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.bluecolored.bluemap.common.plugin.serverinterface;
package de.bluecolored.bluemap.common.serverinterface;
import de.bluecolored.bluemap.common.plugin.text.Text;

View File

@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.bluecolored.bluemap.common.plugin.serverinterface;
package de.bluecolored.bluemap.common.serverinterface;
import de.bluecolored.bluemap.core.MinecraftVersion;
import de.bluecolored.bluemap.core.util.Tristate;
@ -83,8 +83,4 @@ default Tristate isMetricsEnabled() {
*/
Optional<Player> getPlayer(UUID uuid);
default boolean isPluginConfigEnabled() {
return true;
}
}

View File

@ -1,4 +1,4 @@
package de.bluecolored.bluemap.common.plugin.serverinterface;
package de.bluecolored.bluemap.common.serverinterface;
import java.io.IOException;
import java.nio.file.Path;

View File

@ -70,7 +70,6 @@ public HttpResponse handle(HttpRequest request) {
return response;
}
@SuppressWarnings ("resource")
private HttpResponse generateResponse(HttpRequest request) {
String path = request.getPath();
@ -101,7 +100,7 @@ private HttpResponse generateResponse(HttpRequest request) {
// default to index.html
if (!file.exists() || file.isDirectory()){
file = new File(filePath.toString() + "/index.html");
file = new File(filePath + "/index.html");
}
// send empty tile-file if tile not exists
@ -172,7 +171,6 @@ private static long stringToTimestamp(String timeString) throws IllegalArgumentE
int month = Calendar.JANUARY;
switch (timeString.substring(8, 11)){
case "Jan" : month = Calendar.JANUARY; break;
case "Feb" : month = Calendar.FEBRUARY; break;
case "Mar" : month = Calendar.MARCH; break;
case "Apr" : month = Calendar.APRIL; break;

View File

@ -13,7 +13,7 @@ accept-download: false
# The folder where bluemap saves data-files it needs during runtime or to save e.g. the render-progress to resume it later.
# Default is "bluemap"
data: "bluemap"
data: "${data}"
# This changes the amount of threads that BlueMap will use to render the maps.
# A higher value can improve render-speed but could impact performance on the host machine.

View File

@ -11,9 +11,10 @@ name: "${name}"
# The path to the save-folder of the world to render.
world: "${world}"
# A higher value makes the map sorted first (in lists and menus), a lower value makes it sorted later.
# A lower value makes the map sorted first (in lists and menus), a higher value makes it sorted later.
# The value needs to be an integer but it can be negative.
# Default is 0
sorting: 0
sorting: ${sorting}
# The position on the world where the map will be centered if you open it.
# You can change this at any time.

View File

@ -15,6 +15,7 @@ hidden-gamemodes: [
]
# If this is true, players that are vanished (by a plugin) will be hidden on the map.
# (This only works with Spigot and Sponge based vanish-plugins)
# Default is true
hide-vanished: true

View File

@ -10,7 +10,7 @@ storage-type: FILE
# The path to the folder on your file-system where bluemap will save the rendered map
# The default is: "bluemap/web/data"
root: "bluemap/web/data"
root: "${root}"
# The compression-type that bluemap will use to compress generated map-data.
# Available compression-types are:

View File

@ -10,7 +10,13 @@ enabled: true
# The webroot where the web-application files will be created.
# Usually this should be set to the same directory like in the webserver.conf!
# Default is "bluemap/web"
webroot: "bluemap/web"
webroot: "${webroot}"
# Whether the settings.json of the webapp should be updated/synchronized with the current bluemap settings.
# If this is set to "false", bluemap will only add maps to the settings.json but never remove unknown ones or update other settings.
# Disabling this is for example useful if you are running multiple bluemap instances on the same webroot and don't want them to overwrite each others maps.
# Default is true
update-settings-file: true
# If the web-application should use cookies to save the configurations of a user.
# Default is true
@ -19,3 +25,27 @@ use-cookies: true
# If the free-flight-mode in the web-application is enabled or not.
# Default is true
enable-free-flight: true
# The default map and camera-location where a user will start after opening the webapp.
# This is in form of the url-anchor: Open your map in a browser and look at the url, everything after the '#' is the value for this setting.
# Default is "no anchor" -> The camera will start with the topmost map and at that map's starting point.
#start-location: "overworld:0:16:-32:390:0.1:0.19:0:0:perspective"
# The default value of the resolution (settings-menu)
# Possible values are: 0.5, 1, 2
# Default is 1
resolution-default: 1
# The min, max and default values of the hires render-distance slider (settings-menu)
# The values are in blocks.
# Default is max:500 default:200 and min:50
hires-slider-max: 500
hires-slider-default: 200
hires-slider-min: 50
# The min, max and default values of the lowres render-distance slider (settings-menu)
# The values are in blocks.
# Default is max:10000 default:2000 and min:500
lowres-slider-max: 10000
lowres-slider-default: 2000
lowres-slider-min: 500

View File

@ -11,7 +11,7 @@ enabled: true
# The webroot that the server will host to the web.
# Usually this should be set to the same directory like in the webapp.conf!
# Default is "bluemap/web"
webroot: "bluemap/web"
webroot: "${webroot}"
# The port that the webserver listens to.
# Default is 8100

View File

@ -72,9 +72,8 @@ public BmMap(String id, String name, String worldId, World world, Storage storag
this.worldId = Objects.requireNonNull(worldId);
this.world = Objects.requireNonNull(world);
this.storage = Objects.requireNonNull(storage);
this.mapSettings = Objects.requireNonNull(settings);
this.resourcePack = Objects.requireNonNull(resourcePack);
this.mapSettings = Objects.requireNonNull(settings);
this.renderState = new MapRenderState();
loadRenderState();
@ -83,8 +82,6 @@ public BmMap(String id, String name, String worldId, World world, Storage storag
this.textureGallery.put(resourcePack);
saveTextureGallery();
saveMapSettings();
this.hiresModelManager = new HiresModelManager(
storage.tileStorage(id, TileType.HIRES),
this.resourcePack,
@ -103,6 +100,8 @@ public BmMap(String id, String name, String worldId, World world, Storage storag
this.renderTimeSumNanos = 0;
this.tilesRendered = 0;
saveMapSettings();
}
public void renderTile(Vector2i tile) {

View File

@ -20,6 +20,9 @@ public JsonElement serialize(BmMap map, Type typeOfSrc, JsonSerializationContext
// name
root.addProperty("name", map.getName());
// sorting
root.addProperty("sorting", map.getMapSettings().getSorting());
// hires
Vector2i hiresTileSize = map.getHiresModelManager().getTileGrid().getGridSize();
Vector2i gridOrigin = map.getHiresModelManager().getTileGrid().getOffset();

View File

@ -1,9 +1,6 @@
package de.bluecolored.bluemap.core.resources.adapter;
import com.flowpowered.math.vector.Vector3d;
import com.flowpowered.math.vector.Vector3f;
import com.flowpowered.math.vector.Vector4d;
import com.flowpowered.math.vector.Vector4f;
import com.flowpowered.math.vector.*;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
@ -29,6 +26,7 @@ private static Gson createGson() {
.registerTypeAdapter(Axis.class, new AxisAdapter())
.registerTypeAdapter(Color.class, new ColorAdapter())
.registerTypeAdapter(Direction.class, new DirectionAdapter())
.registerTypeAdapter(Vector2i.class, new Vector2iAdapter())
.registerTypeAdapter(Vector3d.class, new Vector3dAdapter())
.registerTypeAdapter(Vector3f.class, new Vector3fAdapter())
.registerTypeAdapter(Vector4d.class, new Vector4dAdapter())

View File

@ -24,16 +24,18 @@
*/
package de.bluecolored.bluemap.cli;
import de.bluecolored.bluemap.common.BlueMapConfigProvider;
import de.bluecolored.bluemap.common.BlueMapService;
import de.bluecolored.bluemap.common.MissingResourcesException;
import de.bluecolored.bluemap.common.config.BlueMapConfigs;
import de.bluecolored.bluemap.common.config.ConfigurationException;
import de.bluecolored.bluemap.common.config.MapConfig;
import de.bluecolored.bluemap.common.config.WebserverConfig;
import de.bluecolored.bluemap.common.plugin.RegionFileWatchService;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.rendermanager.MapUpdateTask;
import de.bluecolored.bluemap.common.rendermanager.RenderManager;
import de.bluecolored.bluemap.common.rendermanager.RenderTask;
@ -69,7 +71,6 @@ public void renderMaps(BlueMapService blueMap, boolean watch, boolean forceRende
if (blueMap.getConfigs().getCoreConfig().isMetrics()) Metrics.sendReportAsync("cli");
blueMap.createOrUpdateWebApp(forceGenerateWebapp);
blueMap.updateWebAppSettings();
//try load resources
blueMap.getResourcePack();
@ -254,11 +255,6 @@ public Optional<Player> getPlayer(UUID uuid) {
return Optional.empty();
}
@Override
public boolean isPluginConfigEnabled() {
return false;
}
public static void main(String[] args) {
CommandLineParser parser = new DefaultParser();
@ -280,7 +276,7 @@ public static void main(String[] args) {
}
//config folder
cli.configFolder = Path.of(".");
cli.configFolder = Path.of("config");
if (cmd.hasOption("c")) {
cli.configFolder = Path.of(cmd.getOptionValue("c"));
Files.createDirectories(cli.configFolder);
@ -298,7 +294,8 @@ public static void main(String[] args) {
}
}
blueMap = new BlueMapService(cli);
BlueMapConfigs configs = new BlueMapConfigs(cli, Path.of("data"), Path.of("web"), false);
blueMap = new BlueMapService(cli, configs);
boolean noActions = true;
if (cmd.hasOption("w")) {
@ -322,15 +319,13 @@ public static void main(String[] args) {
}
if (cmd.hasOption("s")) {
noActions = false;
blueMap.updateWebAppSettings();
blueMap.createOrUpdateWebApp(false);
}
}
// if nothing has been defined to do
if (noActions) {
if (!Files.exists(blueMap.getConfigs().getConfigManager().findConfigPath(Path.of("core")))) {
Logger.global.logInfo("Generating default config files for you, here: " + cli.configFolder.toAbsolutePath().normalize() + "\n");
}
Logger.global.logInfo("Generated default config files for you, here: " + cli.configFolder.toAbsolutePath().normalize() + "\n");
//create resourcepacks folder
Files.createDirectories(cli.configFolder.resolve( "resourcepacks"));
@ -343,7 +338,12 @@ public static void main(String[] args) {
} catch (MissingResourcesException e) {
Logger.global.logWarning("BlueMap is missing important resources!");
Logger.global.logWarning("You must accept the required file download in order for BlueMap to work!");
if (blueMap != null) Logger.global.logWarning("Please check: " + blueMap.getConfigs().getConfigManager().findConfigPath(Path.of("core")).toAbsolutePath().normalize());
if (blueMap != null) {
BlueMapConfigProvider configProvider = blueMap.getConfigs();
if (configProvider instanceof BlueMapConfigs) {
Logger.global.logWarning("Please check: " + ((BlueMapConfigs) configProvider).getConfigManager().findConfigPath(Path.of("core")).toAbsolutePath().normalize());
}
}
System.exit(2);
} catch (ParseException e) {
Logger.global.logError("Failed to parse provided arguments!", e);
@ -402,8 +402,8 @@ private static Options createOptions() {
options.addOption("w", "webserver", false, "Starts the web-server, configured in the 'webserver.conf' file");
options.addOption("b", "verbose", false, "Causes the web-server to log requests to the console");
options.addOption("g", "generate-webapp", false, "Generates the files for the web-app to the folder, configured in the 'render.conf' file (this is done automatically when rendering if the 'index.html' file in the webroot can't be found)");
options.addOption("s", "generate-websettings", false, "Generates the settings for the web-app, using the settings from the 'render.conf' file (this is done automatically when rendering)");
options.addOption("g", "generate-webapp", false, "Generates the files for the web-app to the folder configured in the 'webapp.conf' file");
options.addOption("s", "generate-websettings", false, "Updates the settings.json for the web-app");
options.addOption("r", "render", false, "Renders the maps configured in the 'render.conf' file");
options.addOption("f", "force-render", false, "Forces rendering everything, instead of only rendering chunks that have been modified since the last render");
@ -443,8 +443,8 @@ private static void printHelp() {
footer.append("Render the configured maps\n\n");
footer.append(command).append(" -w\n");
footer.append("Start only the webserver without doing anything else\n\n");
footer.append(command).append(" -gs\n");
footer.append("Generate the web-app and settings without starting a render\n\n");
footer.append(command).append(" -ru\n");
footer.append("Render the configured maps and then keeps watching the world-files and updates the map once something changed.\n\n");
formatter.printHelp(command + " [options]", "\nOptions:", createOptions(), "\n" + footer);
}

View File

@ -26,12 +26,11 @@
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.plugin.text.Text;
import de.bluecolored.bluemap.core.world.World;
import me.lucko.fabric.api.permissions.v0.Permissions;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.Vec3d;
import java.io.IOException;

View File

@ -24,7 +24,7 @@
*/
package de.bluecolored.bluemap.fabric;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.fabric.events.PlayerJoinCallback;
import de.bluecolored.bluemap.fabric.events.PlayerLeaveCallback;
import net.minecraft.server.MinecraftServer;

View File

@ -28,10 +28,10 @@
import com.github.benmanes.caffeine.cache.LoadingCache;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.commands.Commands;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import de.bluecolored.bluemap.core.BlueMap;
import de.bluecolored.bluemap.core.MinecraftVersion;
import de.bluecolored.bluemap.core.logger.Logger;

View File

@ -26,8 +26,8 @@
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.BlueMapService;
import de.bluecolored.bluemap.common.plugin.serverinterface.Gamemode;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.Gamemode;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.text.Text;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;

View File

@ -24,8 +24,8 @@
*/
package de.bluecolored.bluemap.fabric;
import de.bluecolored.bluemap.common.plugin.serverinterface.Dimension;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.Dimension;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import net.minecraft.world.dimension.DimensionType;
import java.io.IOException;

View File

@ -26,12 +26,11 @@
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.plugin.text.Text;
import de.bluecolored.bluemap.core.world.World;
import me.lucko.fabric.api.permissions.v0.Permissions;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.Vec3d;
import java.io.IOException;

View File

@ -24,7 +24,7 @@
*/
package de.bluecolored.bluemap.fabric;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.fabric.events.PlayerJoinCallback;
import de.bluecolored.bluemap.fabric.events.PlayerLeaveCallback;
import net.minecraft.server.MinecraftServer;

View File

@ -28,10 +28,10 @@
import com.github.benmanes.caffeine.cache.LoadingCache;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.commands.Commands;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import de.bluecolored.bluemap.core.BlueMap;
import de.bluecolored.bluemap.core.MinecraftVersion;
import de.bluecolored.bluemap.core.logger.Logger;

View File

@ -26,8 +26,8 @@
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.BlueMapService;
import de.bluecolored.bluemap.common.plugin.serverinterface.Gamemode;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.Gamemode;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.text.Text;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;

View File

@ -24,8 +24,8 @@
*/
package de.bluecolored.bluemap.fabric;
import de.bluecolored.bluemap.common.plugin.serverinterface.Dimension;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.Dimension;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.WorldSavePath;
import net.minecraft.world.dimension.DimensionType;

View File

@ -26,7 +26,7 @@
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.plugin.text.Text;
import de.bluecolored.bluemap.core.world.World;
import me.lucko.fabric.api.permissions.v0.Permissions;

View File

@ -24,7 +24,7 @@
*/
package de.bluecolored.bluemap.fabric;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.fabric.events.PlayerJoinCallback;
import de.bluecolored.bluemap.fabric.events.PlayerLeaveCallback;
import net.minecraft.server.MinecraftServer;

View File

@ -28,10 +28,10 @@
import com.github.benmanes.caffeine.cache.LoadingCache;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.commands.Commands;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import de.bluecolored.bluemap.core.BlueMap;
import de.bluecolored.bluemap.core.MinecraftVersion;
import de.bluecolored.bluemap.core.logger.Logger;

View File

@ -26,8 +26,8 @@
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.BlueMapService;
import de.bluecolored.bluemap.common.plugin.serverinterface.Gamemode;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.Gamemode;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.text.Text;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;

View File

@ -24,8 +24,8 @@
*/
package de.bluecolored.bluemap.fabric;
import de.bluecolored.bluemap.common.plugin.serverinterface.Dimension;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.Dimension;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.WorldSavePath;
import net.minecraft.world.World;

View File

@ -26,7 +26,7 @@
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.plugin.text.Text;
import de.bluecolored.bluemap.core.world.World;
import me.lucko.fabric.api.permissions.v0.Permissions;

View File

@ -24,7 +24,7 @@
*/
package de.bluecolored.bluemap.fabric;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.fabric.events.PlayerJoinCallback;
import de.bluecolored.bluemap.fabric.events.PlayerLeaveCallback;
import net.minecraft.server.MinecraftServer;

View File

@ -28,10 +28,10 @@
import com.github.benmanes.caffeine.cache.LoadingCache;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.commands.Commands;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import de.bluecolored.bluemap.core.BlueMap;
import de.bluecolored.bluemap.core.MinecraftVersion;
import de.bluecolored.bluemap.core.logger.Logger;

View File

@ -26,8 +26,8 @@
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.BlueMapService;
import de.bluecolored.bluemap.common.plugin.serverinterface.Gamemode;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.Gamemode;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.text.Text;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;

View File

@ -24,8 +24,8 @@
*/
package de.bluecolored.bluemap.fabric;
import de.bluecolored.bluemap.common.plugin.serverinterface.Dimension;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.Dimension;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.WorldSavePath;
import net.minecraft.world.World;

View File

@ -26,7 +26,7 @@
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.plugin.text.Text;
import de.bluecolored.bluemap.core.world.World;
import me.lucko.fabric.api.permissions.v0.Permissions;

View File

@ -24,7 +24,7 @@
*/
package de.bluecolored.bluemap.fabric;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.fabric.events.PlayerJoinCallback;
import de.bluecolored.bluemap.fabric.events.PlayerLeaveCallback;
import net.minecraft.server.MinecraftServer;

View File

@ -28,10 +28,10 @@
import com.github.benmanes.caffeine.cache.LoadingCache;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.commands.Commands;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import de.bluecolored.bluemap.core.BlueMap;
import de.bluecolored.bluemap.core.MinecraftVersion;
import de.bluecolored.bluemap.core.logger.Logger;

View File

@ -26,8 +26,8 @@
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.BlueMapService;
import de.bluecolored.bluemap.common.plugin.serverinterface.Gamemode;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.Gamemode;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.text.Text;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;

View File

@ -24,8 +24,8 @@
*/
package de.bluecolored.bluemap.fabric;
import de.bluecolored.bluemap.common.plugin.serverinterface.Dimension;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.Dimension;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.WorldSavePath;
import net.minecraft.world.World;

View File

@ -30,12 +30,11 @@
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.plugin.text.Text;
import de.bluecolored.bluemap.core.world.World;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.server.ServerWorld;
public class ForgeCommandSource implements CommandSource {

View File

@ -24,7 +24,7 @@
*/
package de.bluecolored.bluemap.forge;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedInEvent;
import net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedOutEvent;

View File

@ -28,10 +28,10 @@
import com.github.benmanes.caffeine.cache.LoadingCache;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.commands.Commands;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import de.bluecolored.bluemap.core.BlueMap;
import de.bluecolored.bluemap.core.MinecraftVersion;
import de.bluecolored.bluemap.core.logger.Logger;

View File

@ -26,8 +26,8 @@
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.BlueMapService;
import de.bluecolored.bluemap.common.plugin.serverinterface.Gamemode;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.Gamemode;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.text.Text;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.potion.EffectInstance;

View File

@ -24,8 +24,8 @@
*/
package de.bluecolored.bluemap.forge;
import de.bluecolored.bluemap.common.plugin.serverinterface.Dimension;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.Dimension;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import net.minecraft.world.dimension.DimensionType;
import java.io.IOException;

View File

@ -26,7 +26,7 @@
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.plugin.text.Text;
import de.bluecolored.bluemap.core.world.World;
import net.minecraft.util.math.Vec3d;

View File

@ -24,7 +24,7 @@
*/
package de.bluecolored.bluemap.forge;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedInEvent;
import net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedOutEvent;

View File

@ -28,10 +28,10 @@
import com.github.benmanes.caffeine.cache.LoadingCache;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.commands.Commands;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import de.bluecolored.bluemap.core.BlueMap;
import de.bluecolored.bluemap.core.MinecraftVersion;
import de.bluecolored.bluemap.core.logger.Logger;

View File

@ -26,8 +26,8 @@
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.BlueMapService;
import de.bluecolored.bluemap.common.plugin.serverinterface.Gamemode;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.Gamemode;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.text.Text;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.potion.EffectInstance;

View File

@ -24,8 +24,8 @@
*/
package de.bluecolored.bluemap.forge;
import de.bluecolored.bluemap.common.plugin.serverinterface.Dimension;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.Dimension;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import net.minecraft.world.dimension.DimensionType;
import java.io.IOException;

View File

@ -26,7 +26,7 @@
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.plugin.text.Text;
import de.bluecolored.bluemap.core.world.World;
import net.minecraft.util.text.ITextComponent;

View File

@ -24,7 +24,7 @@
*/
package de.bluecolored.bluemap.forge;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedInEvent;
import net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedOutEvent;

View File

@ -28,10 +28,10 @@
import com.github.benmanes.caffeine.cache.LoadingCache;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.commands.Commands;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import de.bluecolored.bluemap.core.BlueMap;
import de.bluecolored.bluemap.core.MinecraftVersion;
import de.bluecolored.bluemap.core.logger.Logger;

View File

@ -26,8 +26,8 @@
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.BlueMapService;
import de.bluecolored.bluemap.common.plugin.serverinterface.Gamemode;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.Gamemode;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.text.Text;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.potion.EffectInstance;

View File

@ -24,8 +24,8 @@
*/
package de.bluecolored.bluemap.forge;
import de.bluecolored.bluemap.common.plugin.serverinterface.Dimension;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.Dimension;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.DimensionType;
import net.minecraft.world.World;

View File

@ -26,7 +26,7 @@
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.plugin.text.Text;
import de.bluecolored.bluemap.core.world.World;
import net.minecraft.commands.CommandSourceStack;

View File

@ -24,7 +24,7 @@
*/
package de.bluecolored.bluemap.forge;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedInEvent;
import net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedOutEvent;

View File

@ -28,10 +28,10 @@
import com.github.benmanes.caffeine.cache.LoadingCache;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.commands.Commands;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import de.bluecolored.bluemap.core.BlueMap;
import de.bluecolored.bluemap.core.MinecraftVersion;
import de.bluecolored.bluemap.core.logger.Logger;

View File

@ -26,8 +26,8 @@
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.BlueMapService;
import de.bluecolored.bluemap.common.plugin.serverinterface.Gamemode;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.Gamemode;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.text.Text;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerPlayer;

View File

@ -1,7 +1,7 @@
package de.bluecolored.bluemap.forge;
import de.bluecolored.bluemap.common.plugin.serverinterface.Dimension;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.Dimension;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.Level;

View File

@ -26,7 +26,7 @@
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.plugin.text.Text;
import de.bluecolored.bluemap.core.world.World;
import net.minecraft.commands.CommandSourceStack;

View File

@ -24,7 +24,7 @@
*/
package de.bluecolored.bluemap.forge;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedInEvent;
import net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedOutEvent;

View File

@ -28,10 +28,10 @@
import com.github.benmanes.caffeine.cache.LoadingCache;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.commands.Commands;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import de.bluecolored.bluemap.core.BlueMap;
import de.bluecolored.bluemap.core.MinecraftVersion;
import de.bluecolored.bluemap.core.logger.Logger;

View File

@ -26,8 +26,8 @@
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.BlueMapService;
import de.bluecolored.bluemap.common.plugin.serverinterface.Gamemode;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.Gamemode;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.text.Text;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerPlayer;

View File

@ -24,8 +24,8 @@
*/
package de.bluecolored.bluemap.forge;
import de.bluecolored.bluemap.common.plugin.serverinterface.Dimension;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.Dimension;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.Level;

View File

@ -26,7 +26,7 @@
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.plugin.text.Text;
import de.bluecolored.bluemap.core.world.World;
import org.bukkit.Bukkit;

View File

@ -25,8 +25,8 @@
package de.bluecolored.bluemap.bukkit;
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.plugin.serverinterface.Gamemode;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.Gamemode;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.text.Text;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
@ -56,6 +56,7 @@ public class BukkitPlayer implements Player {
private boolean online;
private boolean sneaking;
private boolean invisible;
private boolean vanished;
private Gamemode gamemode;
public BukkitPlayer(UUID playerUUID) {
@ -98,6 +99,11 @@ public boolean isInvisible() {
return this.invisible;
}
@Override
public boolean isVanished() {
return vanished;
}
@Override
public Gamemode getGamemode() {
return this.gamemode;
@ -119,9 +125,11 @@ public void update() {
this.invisible = player.hasPotionEffect(PotionEffectType.INVISIBILITY);
//also check for "vanished" players
boolean vanished = false;
for (MetadataValue meta : player.getMetadata("vanished")) {
if (meta.asBoolean()) this.invisible = true;
if (meta.asBoolean()) vanished = true;
}
this.vanished = vanished;
this.name = Text.of(player.getName());
this.online = player.isOnline();

View File

@ -27,10 +27,10 @@
import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.LoadingCache;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import de.bluecolored.bluemap.core.BlueMap;
import de.bluecolored.bluemap.core.MinecraftVersion;
import de.bluecolored.bluemap.core.logger.Logger;

View File

@ -24,8 +24,8 @@
*/
package de.bluecolored.bluemap.bukkit;
import de.bluecolored.bluemap.common.plugin.serverinterface.Dimension;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.Dimension;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import org.bukkit.Bukkit;
import org.bukkit.World;

View File

@ -24,7 +24,7 @@
*/
package de.bluecolored.bluemap.bukkit;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.plugin.text.Text;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;

View File

@ -24,7 +24,7 @@
*/
package de.bluecolored.bluemap.sponge;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.plugin.text.Text;
import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer;
import org.spongepowered.api.event.Listener;

View File

@ -26,7 +26,7 @@
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.serverinterface.CommandSource;
import de.bluecolored.bluemap.common.plugin.text.Text;
import de.bluecolored.bluemap.core.world.World;
import net.kyori.adventure.audience.Audience;

View File

@ -25,8 +25,8 @@
package de.bluecolored.bluemap.sponge;
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.plugin.serverinterface.Gamemode;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.Gamemode;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.text.Text;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.data.Keys;
@ -58,6 +58,7 @@ public class SpongePlayer implements Player {
private boolean online;
private boolean sneaking;
private boolean invisible;
private boolean vanished;
private Gamemode gamemode;
public SpongePlayer(UUID playerUUID) {
@ -100,6 +101,11 @@ public boolean isInvisible() {
return this.invisible;
}
@Override
public boolean isVanished() {
return vanished;
}
@Override
public Gamemode getGamemode() {
return this.gamemode;
@ -118,18 +124,17 @@ public void update() {
this.gamemode = GAMEMODE_MAP.get(player.get(Keys.GAME_MODE).orElse(GameModes.NOT_SET.get()));
if (this.gamemode == null) this.gamemode = Gamemode.SURVIVAL;
boolean invis = player.get(Keys.VANISH_STATE).orElse(VanishState.unvanished()).invisible();
if (!invis && player.get(Keys.IS_INVISIBLE).orElse(false)) invis = true;
if (!invis) {
Optional<List<PotionEffect>> effects = player.get(Keys.POTION_EFFECTS);
if (effects.isPresent()) {
for (PotionEffect effect : effects.get()) {
if (effect.type().equals(PotionEffectTypes.INVISIBILITY.get()) && effect.duration().ticks() > 0) invis = true;
}
boolean invis = false;
Optional<List<PotionEffect>> effects = player.get(Keys.POTION_EFFECTS);
if (effects.isPresent()) {
for (PotionEffect effect : effects.get()) {
if (effect.type().equals(PotionEffectTypes.INVISIBILITY.get()) && effect.duration().ticks() > 0) invis = true;
}
}
this.invisible = invis;
this.vanished = player.get(Keys.VANISH_STATE).orElse(VanishState.unvanished()).invisible();
this.name = Text.of(player.name());
this.online = player.isOnline();
this.position = SpongePlugin.fromSpongePoweredVector(player.position());

View File

@ -31,10 +31,10 @@
import com.github.benmanes.caffeine.cache.LoadingCache;
import com.google.inject.Inject;
import de.bluecolored.bluemap.common.plugin.Plugin;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.Player;
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
import de.bluecolored.bluemap.common.serverinterface.ServerInterface;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import de.bluecolored.bluemap.core.BlueMap;
import de.bluecolored.bluemap.core.MinecraftVersion;
import de.bluecolored.bluemap.core.logger.Logger;

View File

@ -24,10 +24,9 @@
*/
package de.bluecolored.bluemap.sponge;
import de.bluecolored.bluemap.common.plugin.serverinterface.Dimension;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerWorld;
import de.bluecolored.bluemap.common.serverinterface.Dimension;
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
import org.spongepowered.api.world.WorldType;
import org.spongepowered.api.world.WorldTypes;
import java.io.IOException;