Compare commits
10 commits
f596dad07f
...
7cdec756b8
Author | SHA1 | Date | |
---|---|---|---|
7cdec756b8 | |||
4239aba5b4 | |||
8f019b8cf5 | |||
c10119233f | |||
28c59a768a | |||
c645d56085 | |||
88df6c5781 | |||
35f8c5f882 | |||
7eac4a399f | |||
664eca4f3b |
12 changed files with 90 additions and 59 deletions
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/realweather.iml" filepath="$PROJECT_DIR$/realweather.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
41
pom.xml
41
pom.xml
|
@ -11,23 +11,7 @@
|
|||
<jarsigner.alias>testkey</jarsigner.alias>
|
||||
<jarsigner.storepass>123456</jarsigner.storepass>
|
||||
</properties>
|
||||
|
||||
<scm>
|
||||
<developerConnection>scm:git:git@git.m724.eu:Minecon724/realweather.git</developerConnection>
|
||||
<tag>HEAD</tag>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>m724</id>
|
||||
<url>https://git.m724.eu/api/packages/Minecon724/maven</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>m724</id>
|
||||
<url>https://git.m724.eu/api/packages/Minecon724/maven</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
|
@ -43,7 +27,7 @@
|
|||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.21-R0.1-SNAPSHOT</version>
|
||||
<version>1.21.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -69,7 +53,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-release-plugin</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<version>3.1.1</version>
|
||||
<configuration>
|
||||
<allowTimestampedSnapshots>true</allowTimestampedSnapshots>
|
||||
</configuration>
|
||||
|
@ -109,7 +93,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jarsigner-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<version>3.1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign</id>
|
||||
|
@ -132,5 +116,20 @@
|
|||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>m724</id>
|
||||
<url>https://git.m724.eu/api/packages/Minecon724/maven</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>m724</id>
|
||||
<url>https://git.m724.eu/api/packages/Minecon724/maven</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
<scm>
|
||||
<developerConnection>scm:git:git@git.m724.eu:Minecon724/realweather.git</developerConnection>
|
||||
<tag>HEAD</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
|
13
realweather.iml
Normal file
13
realweather.iml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="minecraft" name="Minecraft">
|
||||
<configuration>
|
||||
<autoDetectTypes>
|
||||
<platformType>SPIGOT</platformType>
|
||||
</autoDetectTypes>
|
||||
<projectReimportVersion>1</projectReimportVersion>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
</module>
|
|
@ -11,6 +11,7 @@ import eu.m724.realweather.updater.UpdaterConfig;
|
|||
import eu.m724.realweather.weather.PlayerWeatherDirectory;
|
||||
import eu.m724.realweather.weather.WeatherConfig;
|
||||
|
||||
// TODO perhaps replace with a singleton
|
||||
public class GlobalConstants {
|
||||
static WeatherConfig weatherConfig;
|
||||
static TimeConfig timeConfig;
|
||||
|
|
|
@ -51,15 +51,8 @@ public class RealWeatherPlugin extends JavaPlugin {
|
|||
thunderConfiguration, timeConfiguration;
|
||||
|
||||
DebugLogger.info("loading configurations", 1);
|
||||
|
||||
if (!new File(dataFolder, "config.yml").exists()) {
|
||||
logger.info("This is the first run of this plugin.");
|
||||
logger.info("Please shutdown the server and input your API keys and settings");
|
||||
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
boolean firstRun = !new File(dataFolder, "config.yml").exists();
|
||||
|
||||
try {
|
||||
configuration = getConfig("config.yml");
|
||||
mapConfiguration = getConfig("map.yml");
|
||||
|
@ -73,12 +66,20 @@ public class RealWeatherPlugin extends JavaPlugin {
|
|||
getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (firstRun) {
|
||||
logger.warning("This is the first time running this plugin.");
|
||||
logger.warning("Please shut down the server, review the config files, and enter your API keys.");
|
||||
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
DebugLogger.baseLogger = logger;
|
||||
DebugLogger.debugLevel = configuration.getInt("debug");
|
||||
|
||||
if (!configuration.getBoolean("enabled")) {
|
||||
logger.info("plugin disabled by admin");
|
||||
logger.info("Plugin disabled by configuration!");
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package eu.m724.realweather.commands;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -13,17 +15,16 @@ import eu.m724.realweather.weather.PlayerWeatherDirectory;
|
|||
import eu.m724.wtapi.object.Weather;
|
||||
|
||||
public class LocalWeatherCommand implements CommandExecutor {
|
||||
private PlayerWeatherDirectory playerWeatherDirectory = GlobalConstants.getPlayerWeatherDirectory();
|
||||
private final PlayerWeatherDirectory playerWeatherDirectory = GlobalConstants.getPlayerWeatherDirectory();
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
if (!(sender instanceof Player player)) {
|
||||
sender.sendMessage("You must be a player to use this command");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
Weather weather = playerWeatherDirectory.getWeather(player);
|
||||
|
||||
Weather weather = playerWeatherDirectory.getWeather(player);
|
||||
long lastUpdate = playerWeatherDirectory.getLastUpdate(player);
|
||||
|
||||
if (weather != null) {
|
||||
|
@ -42,10 +43,10 @@ public class LocalWeatherCommand implements CommandExecutor {
|
|||
if (weather.shower)
|
||||
player.sendMessage("Shower: yes");
|
||||
|
||||
player.sendMessage("Cloudiness: %d%%".formatted(weather.cloudiness * 100));
|
||||
player.sendMessage("Humidity: %d%%".formatted(weather.humidity * 100));
|
||||
player.sendMessage("Temperature: %f (feels like %f) K".formatted(weather.temperature - 273.15, weather.temperatureApparent - 273.15));
|
||||
player.sendMessage("Wind: %f (gust %f) m/s".formatted(weather.windSpeed, weather.windGust));
|
||||
player.sendMessage("Cloudiness: %f%%".formatted(weather.cloudiness * 100));
|
||||
player.sendMessage("Humidity: %f%%".formatted(weather.humidity * 100));
|
||||
player.sendMessage("Temperature: %fC (feels like %fC)".formatted(weather.temperature - 273.15, weather.temperatureApparent - 273.15));
|
||||
player.sendMessage("Wind: %fm/s (gust %fm/s) ".formatted(weather.windSpeed, weather.windGust));
|
||||
player.sendMessage("Last update: %s UTC".formatted(formatTime(lastUpdate)));
|
||||
|
||||
} else {
|
||||
|
@ -56,7 +57,7 @@ public class LocalWeatherCommand implements CommandExecutor {
|
|||
}
|
||||
|
||||
private String formatTime(long timestamp) { // TODO move this
|
||||
return DateTimeFormatter.ofPattern("HH:mm:ss").format(Instant.ofEpochSecond(timestamp));
|
||||
return DateTimeFormatter.ofPattern("HH:mm:ss").format(Instant.ofEpochMilli(timestamp).atZone(ZoneOffset.UTC));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,14 +9,15 @@ updater:
|
|||
# Notify players and console about plugin updates
|
||||
# This also controls automatic checking
|
||||
# You can still update with /rwadmin update
|
||||
# Revelant permission node: realweather.update.notify
|
||||
# Relevant permission node: realweather.update.notify
|
||||
notify: true
|
||||
# stable for stable releases
|
||||
# testing for latest builds (untested hence the name)
|
||||
# As there's no release yet, stable will just error
|
||||
channel: testing
|
||||
|
||||
# 0 - no debug
|
||||
# 1 - debug loading modules
|
||||
# 2 - also debug processing conditions
|
||||
# 3 - also log tasks running, this will spam
|
||||
debug: 3
|
||||
debug: 0
|
|
@ -8,16 +8,16 @@ worlds:
|
|||
- world
|
||||
|
||||
dimensions:
|
||||
# blocks per 1 deg, can't be decimal
|
||||
# the default (111000) assumes 1 block = 1 meter
|
||||
# Blocks per 1 deg, can't be decimal
|
||||
# The default (111000) assumes 1 block = 1 meter
|
||||
latitude: 111000
|
||||
longitude: 111000
|
||||
|
||||
# if you want the globe to cover the whole world use:
|
||||
# If you want the globe to cover the whole (Minecraft) world use:
|
||||
# latitude: 333333
|
||||
# longitude: 166666
|
||||
|
||||
# if you use `static` mode
|
||||
# For `static` mode
|
||||
point:
|
||||
latitude: 0
|
||||
longitude: 0
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
enabled: false
|
||||
|
||||
# currently only blitzortung
|
||||
# Currently only blitzortung
|
||||
provider: blitzortung
|
||||
|
||||
# how often should we poll for updates and spawn lightning
|
||||
# this is a synchronous task
|
||||
# if you put it too low you'll have constant lag
|
||||
# but if you put it too high it will process a lot of data at once so you'll have lag spikes
|
||||
# How often should we poll for updates and spawn lightning
|
||||
# This is a synchronous task
|
||||
# If you put it too low you'll have constant lag,
|
||||
# But if you put it too high it will process a lot of data at once so you'll have lag spikes
|
||||
refresh: 100 # ticks
|
||||
|
|
|
@ -2,16 +2,19 @@
|
|||
### TIME SETTINGS ###
|
||||
############################
|
||||
|
||||
# warning: this removes sleep
|
||||
# Warning: this removes sleep
|
||||
# No, it's not a bug. It would de-synchronize, and can you skip time IRL?
|
||||
# Can you believe that I actually used to consider this a bug?
|
||||
|
||||
enabled: false
|
||||
|
||||
# How this plugin affects your world:
|
||||
# - static (false): time is the same across the world
|
||||
# - dynamic (true): static + local time for each player, however it's only cosmetical so it will not match mobs spawning etc
|
||||
# settings for both are in map.yml
|
||||
# - dynamic (true): static + local time for each player, however it's only cosmetic so it will not match mobs spawning etc
|
||||
# Settings for both are in map.yml
|
||||
dynamic: true
|
||||
|
||||
# x in game day cycles in 1 irl day cycle
|
||||
# time will no longer be in sync
|
||||
# can be decimal
|
||||
# Time will no longer be in sync
|
||||
# Can be decimal
|
||||
scale: 1.0
|
|
@ -2,6 +2,10 @@
|
|||
### WEATHER SETTINGS ###
|
||||
############################
|
||||
|
||||
# Weather in Minecraft is limited, it can only rain or not rain, thunder or not thunder.
|
||||
# In real life, there is a scale, and many more weather conditions in general, like blizzard.
|
||||
# This plugin tries hard to do something about it, but it's not perfect, because it's just impossible.
|
||||
|
||||
enabled: false
|
||||
|
||||
# Currently only OpenWeatherMap
|
||||
|
@ -11,6 +15,6 @@ apiKey: REPLACE ME
|
|||
|
||||
# How this plugin affects your world:
|
||||
# - static (false): weather is the same across the world
|
||||
# - dynamic (true): weather is per player, however it's only cosmetical so it will not match mobs spawning etc
|
||||
# - dynamic (true): weather is per player, however it's only cosmetic so it will not match mobs spawning etc
|
||||
# settings for both are in map.yml
|
||||
dynamic: true
|
|
@ -2,7 +2,7 @@ name: RealWeather
|
|||
version: ${project.version}
|
||||
|
||||
author: Minecon724
|
||||
website: https://forum.m724.eu/topic/3/realweather-1-0
|
||||
website: https://www.spigotmc.org/resources/realweather-realtime.101599/
|
||||
|
||||
api-version: 1.21
|
||||
load: STARTUP
|
||||
|
|
Loading…
Reference in a new issue