diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..731eb43 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target/ +/.settings/ diff --git a/README.md b/README.md index efb6c91..2bebbf8 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ differences compared to v0: - weather levels \ it's not like there's strong rain or there's no rain \ I'm not sure how yet +- sunrise sunset - snow - more api providers, multiple api keys - extensible: api diff --git a/pom.xml b/pom.xml index 46ffdff..c5030e3 100644 --- a/pom.xml +++ b/pom.xml @@ -1,6 +1,69 @@ - 4.0.0 - eu.m724 - realweather - 0.9-SNAPSHOT + 4.0.0 + eu.m724 + realweather + 0.9-SNAPSHOT + + + 17 + 17 + + + + + spigot-repo + https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + + + 724rocks + https://git.724.rocks/api/packages/Minecon724/maven + + + + + + org.spigotmc + spigot-api + 1.20.6-R0.1-SNAPSHOT + provided + + + eu.m724 + wtapi + 0.2 + + + + + + + src/main/resources + true + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.6.0 + + + package + + shade + + + true + + + eu.m724:wtapi + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/eu/m724/realweather/DebugLogger.java b/src/main/java/eu/m724/realweather/DebugLogger.java new file mode 100644 index 0000000..5d2253f --- /dev/null +++ b/src/main/java/eu/m724/realweather/DebugLogger.java @@ -0,0 +1,18 @@ +package eu.m724.realweather; + +import java.util.logging.Logger; + +public class DebugLogger { + static Logger baseLogger; + static int debugLevel; + + public static int getDebugLevel() { + return debugLevel; + } + + + public static void info(String message, int minDebugLevel, Object... format) { + if (debugLevel >= minDebugLevel) + baseLogger.info(String.format(message, format)); + } +} diff --git a/src/main/java/eu/m724/realweather/RealWeatherPlugin.java b/src/main/java/eu/m724/realweather/RealWeatherPlugin.java new file mode 100644 index 0000000..4299f62 --- /dev/null +++ b/src/main/java/eu/m724/realweather/RealWeatherPlugin.java @@ -0,0 +1,124 @@ +package eu.m724.realweather; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.logging.Logger; + +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.plugin.java.JavaPlugin; + +import com.google.common.base.Charsets; + +import eu.m724.realweather.mapper.Mapper; +import eu.m724.realweather.mapper.MapperConfig; +import eu.m724.realweather.object.UserException; +import eu.m724.realweather.thunder.ThunderConfig; +import eu.m724.realweather.thunder.ThunderMaster; +import eu.m724.realweather.time.TimeConfig; +import eu.m724.realweather.time.TimeMaster; +import eu.m724.realweather.weather.WeatherConfig; +import eu.m724.realweather.weather.WeatherMaster; +import eu.m724.wtapi.provider.exception.ProviderException; + +public class RealWeatherPlugin extends JavaPlugin { + private Mapper mapper; + private WeatherMaster weatherMaster; + private ThunderMaster thunderMaster; + private TimeMaster timeMaster; + + private YamlConfiguration config; + private Logger logger; + + private YamlConfiguration mapConfig; + + @Override + public void onEnable() { + logger = getLogger(); + + File dataFolder = getDataFolder(); + File modulesFolder = new File(dataFolder, "modules"); + modulesFolder.mkdir(); + + YamlConfiguration configuration, + mapConfiguration, weatherConfiguration, + thunderConfiguration, timeConfiguration; + + DebugLogger.info("loading configurations", 1); + + try { + configuration = getConfig(new File(dataFolder, "config.yml")); + mapConfiguration = getConfig(new File(dataFolder, "map.yml")); + weatherConfiguration = getConfig(new File(modulesFolder, "weather.yml")); + thunderConfiguration = getConfig(new File(modulesFolder, "thunder.yml")); + timeConfiguration = getConfig(new File(modulesFolder, "time.yml")); + } catch (IOException e) { + logger.severe("Failed to load config!"); + e.printStackTrace(); + + getServer().getPluginManager().disablePlugin(this); + return; + } + + DebugLogger.baseLogger = logger; + DebugLogger.debugLevel = configuration.getInt("debug"); + + if (configuration.getBoolean("enabled")) { + logger.info("plugin disabled by admin"); + getServer().getPluginManager().disablePlugin(this); + } + + DebugLogger.info("loading mapper", 1); + mapper = new Mapper( + MapperConfig.fromConfiguration(mapConfiguration)); + + try { + DebugLogger.info("loading weather", 1); + weatherMaster = new WeatherMaster( + WeatherConfig.fromConfiguration(weatherConfiguration), mapper); + weatherMaster.init(); + + DebugLogger.info("loading thunder", 1); + thunderMaster = new ThunderMaster( + ThunderConfig.fromConfiguration(thunderConfiguration), mapper, this); + thunderMaster.init(); + + DebugLogger.info("loading time", 1); + timeMaster = new TimeMaster( + TimeConfig.fromConfiguration(timeConfiguration), mapper); + timeMaster.init(); + } catch (UserException e) { + logger.severe("There are errors in your config:"); + logger.severe(e.getMessage()); + + getServer().getPluginManager().disablePlugin(this); + } catch (ProviderException e) { + logger.severe("Couldn't initialize provider!"); + logger.severe("Possible causes:"); + logger.severe("1. Your API key is invalid"); + logger.severe("2. The provider or your internet is down"); + e.printStackTrace(); + + getServer().getPluginManager().disablePlugin(this); + } + + DebugLogger.info("ended loading", 1); + } + + public YamlConfiguration getConfig(File configFile) throws IOException { + YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile); + + if (!configFile.exists()) { + final InputStream defConfigStream = getResource("config.yml"); + + if (defConfigStream == null) + return null; + + config = YamlConfiguration.loadConfiguration(new InputStreamReader(defConfigStream, Charsets.UTF_8)); + config.save(configFile); + } + + return config; + } +} diff --git a/src/main/java/eu/m724/realweather/mapper/Mapper.java b/src/main/java/eu/m724/realweather/mapper/Mapper.java new file mode 100644 index 0000000..27c843f --- /dev/null +++ b/src/main/java/eu/m724/realweather/mapper/Mapper.java @@ -0,0 +1,54 @@ +package eu.m724.realweather.mapper; + +import java.util.List; + +import org.bukkit.Location; +import org.bukkit.World; + +import eu.m724.wtapi.object.Coordinates; + +public class Mapper { + private MapperConfig config; + private List worlds; + + public Mapper(MapperConfig config) { + this.config = config; + } + + public Coordinates locationToCoordinates(Location location) { + double latitude = -location.getZ() / config.scaleLatitude; + double longitude = location.getX() / config.scaleLongitude; + + return new Coordinates(latitude, longitude); + } + + public Location coordinatesToLocation(World world, Coordinates coordinates) { + double x = -coordinates.latitude * config.scaleLatitude; + double z = coordinates.longitude * config.scaleLongitude; + + return new Location(world, x, 0, z); + + } + + public Coordinates getPoint() { + return config.point; + } + + public List getWorlds() { + return this.worlds; + } + + boolean loadWorld(World world) { + boolean loaded = config.worlds.contains(world.getName()) ^ config.worldBlacklist; + + if (loaded) + worlds.add(world); + + return loaded; + } + + void unloadWorld(World world) { + worlds.remove(world); + } + +} diff --git a/src/main/java/eu/m724/realweather/mapper/MapperConfig.java b/src/main/java/eu/m724/realweather/mapper/MapperConfig.java new file mode 100644 index 0000000..bbe33cb --- /dev/null +++ b/src/main/java/eu/m724/realweather/mapper/MapperConfig.java @@ -0,0 +1,37 @@ +package eu.m724.realweather.mapper; + +import java.util.List; + +import org.bukkit.configuration.ConfigurationSection; + +import eu.m724.wtapi.object.Coordinates; + +public class MapperConfig { + public boolean enabled; + + public boolean worldBlacklist; + public List worlds; + + public int scaleLatitude; + public int scaleLongitude; + + public Coordinates point; + + public static MapperConfig fromConfiguration(ConfigurationSection configuration) { + MapperConfig mapperConfig = new MapperConfig(); + + mapperConfig.enabled = configuration.getBoolean("enabled"); + + mapperConfig.worldBlacklist = configuration.getBoolean("worldBlacklist"); + mapperConfig.worlds = configuration.getStringList("worlds"); + + mapperConfig.scaleLatitude = configuration.getInt("dimensions.latitude"); + mapperConfig.scaleLongitude = configuration.getInt("dimensions.longitude"); + + mapperConfig.point = new Coordinates( + configuration.getDouble("point.latitude"), + configuration.getDouble("point.longitude")); + + return mapperConfig; + } +} diff --git a/src/main/java/eu/m724/realweather/mapper/MapperEventHandler.java b/src/main/java/eu/m724/realweather/mapper/MapperEventHandler.java new file mode 100644 index 0000000..499420c --- /dev/null +++ b/src/main/java/eu/m724/realweather/mapper/MapperEventHandler.java @@ -0,0 +1,24 @@ +package eu.m724.realweather.mapper; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.world.WorldLoadEvent; +import org.bukkit.event.world.WorldUnloadEvent; + +public class MapperEventHandler implements Listener { + private Mapper mapper; + + public MapperEventHandler(Mapper mapper) { + this.mapper = mapper; + } + + @EventHandler + public void onWorldLoad(WorldLoadEvent e) { + mapper.loadWorld(e.getWorld()); + } + + @EventHandler + public void onWorldUnload(WorldUnloadEvent e) { + mapper.unloadWorld(e.getWorld()); + } +} diff --git a/src/main/java/eu/m724/realweather/object/UserException.java b/src/main/java/eu/m724/realweather/object/UserException.java new file mode 100644 index 0000000..af04a19 --- /dev/null +++ b/src/main/java/eu/m724/realweather/object/UserException.java @@ -0,0 +1,11 @@ +package eu.m724.realweather.object; + +public class UserException extends Exception { + + private static final long serialVersionUID = 6850666306511891275L; + + public UserException(String message) { + super(message); + } + +} diff --git a/src/main/java/eu/m724/realweather/thunder/ThunderConfig.java b/src/main/java/eu/m724/realweather/thunder/ThunderConfig.java new file mode 100644 index 0000000..24be3c1 --- /dev/null +++ b/src/main/java/eu/m724/realweather/thunder/ThunderConfig.java @@ -0,0 +1,25 @@ +package eu.m724.realweather.thunder; + +import org.bukkit.configuration.ConfigurationSection; + +import eu.m724.realweather.time.TimeConfig; + +public class ThunderConfig { + public boolean enabled; + + public String provider; + + // how often refresh in ms + public int refresh; + + public static ThunderConfig fromConfiguration(ConfigurationSection configuration) { + ThunderConfig thunderConfig = new ThunderConfig(); + + thunderConfig.enabled = configuration.getBoolean("enabled"); + thunderConfig.provider = configuration.getString("provider"); + + thunderConfig.refresh = configuration.getInt("refresh"); + + return thunderConfig; + } +} diff --git a/src/main/java/eu/m724/realweather/thunder/ThunderMaster.java b/src/main/java/eu/m724/realweather/thunder/ThunderMaster.java new file mode 100644 index 0000000..d484d98 --- /dev/null +++ b/src/main/java/eu/m724/realweather/thunder/ThunderMaster.java @@ -0,0 +1,67 @@ +package eu.m724.realweather.thunder; + +import java.util.ArrayList; + +import org.bukkit.Bukkit; +import org.bukkit.plugin.Plugin; + +import eu.m724.realweather.DebugLogger; +import eu.m724.realweather.mapper.Mapper; +import eu.m724.realweather.object.UserException; +import eu.m724.wtapi.provider.WeatherProvider; +import eu.m724.wtapi.provider.exception.ProviderException; +import eu.m724.wtapi.provider.impl.openweathermap.OpenWeatherMapProvider; +import eu.m724.wtapi.thunder.ThunderProvider; +import eu.m724.wtapi.thunder.impl.lightningmaps.LightningMapsProvider; +import eu.m724.wtapi.thunder.impl.lightningmaps.TimedStrike; + +public class ThunderMaster { + private ThunderConfig config; + private Mapper mapper; + private ThunderProvider provider; + private Plugin plugin; + private ThunderTask thunderTask; + + ArrayList strikes = new ArrayList<>(); + + public ThunderMaster(ThunderConfig config, Mapper mapper, Plugin plugin) { + this.config = config; + this.mapper = mapper; + this.plugin = plugin; + } + + /** + * initializes, tests and starts + * @throws UserException config issue + * @throws ProviderException if provider initialization failed + */ + public void init() throws UserException, ProviderException { + if (!config.enabled) + return; + + provider = createProvider(); + + if (provider == null) + throw new UserException("Invalid provider: " + config.provider); + + provider.init(); + + provider.registerStrikeHandler(coords -> { + strikes.add(new TimedStrike(System.currentTimeMillis() + provider.getDelay(), coords)); + }); + + thunderTask = new ThunderTask(this, mapper); + thunderTask.runTaskTimer(plugin, 0, config.refresh); + + DebugLogger.info("thunder loaded", 1); + } + + private ThunderProvider createProvider() { + switch (config.provider) { + case "lightningmaps": + return new LightningMapsProvider(); + } + + return null; + } +} diff --git a/src/main/java/eu/m724/realweather/thunder/ThunderTask.java b/src/main/java/eu/m724/realweather/thunder/ThunderTask.java new file mode 100644 index 0000000..2da03e1 --- /dev/null +++ b/src/main/java/eu/m724/realweather/thunder/ThunderTask.java @@ -0,0 +1,44 @@ +package eu.m724.realweather.thunder; + +import org.bukkit.Location; +import org.bukkit.entity.EntityType; +import org.bukkit.scheduler.BukkitRunnable; + +import eu.m724.realweather.DebugLogger; +import eu.m724.realweather.mapper.Mapper; +import eu.m724.wtapi.thunder.impl.lightningmaps.TimedStrike; + +class ThunderTask extends BukkitRunnable { + private ThunderMaster thunderMaster; + private Mapper mapper; + + public ThunderTask(ThunderMaster thunderMaster, Mapper mapper) { + this.thunderMaster = thunderMaster; + this.mapper = mapper; + } + + @Override + public void run() { + DebugLogger.info("thundertask running", 3); + while (thunderMaster.strikes.size() > 0) { + TimedStrike strike = thunderMaster.strikes.get(0); + thunderMaster.strikes.remove(0); + + DebugLogger.info("strike: %f %f", 2, strike.coordinates.latitude, strike.coordinates.longitude); + + mapper.getWorlds().forEach(w -> { + Location location = mapper.coordinatesToLocation(w, strike.coordinates); + DebugLogger.info("in %s that converts to: %d %d %d", 2, w.getName(), location.getBlockX(), location.getBlockY(), location.getBlockZ()); + + if (w.getChunkAt(location).isLoaded()) { + location.setY(w.getHighestBlockYAt(location)); + w.spawnEntity(location, EntityType.LIGHTNING_BOLT); + DebugLogger.info("spawnd lightning in %s on y level %d", 2, w.getName(), location.getBlockY()); + } + + }); + } + + } + +} diff --git a/src/main/java/eu/m724/realweather/time/TimeConfig.java b/src/main/java/eu/m724/realweather/time/TimeConfig.java new file mode 100644 index 0000000..a1ec56b --- /dev/null +++ b/src/main/java/eu/m724/realweather/time/TimeConfig.java @@ -0,0 +1,23 @@ +package eu.m724.realweather.time; + +import org.bukkit.configuration.ConfigurationSection; + +public class TimeConfig { + public boolean enabled; + + // state is per player + public boolean dynamic; + // x day cycles in 1 irl day + public double modifier; + + public static TimeConfig fromConfiguration(ConfigurationSection configuration) { + TimeConfig timeConfig = new TimeConfig(); + + timeConfig.enabled = configuration.getBoolean("enabled"); + + timeConfig.dynamic = configuration.getBoolean("dynamic"); + timeConfig.modifier = configuration.getDouble("modifier"); + + return timeConfig; + } +} diff --git a/src/main/java/eu/m724/realweather/time/TimeMaster.java b/src/main/java/eu/m724/realweather/time/TimeMaster.java new file mode 100644 index 0000000..5008fd8 --- /dev/null +++ b/src/main/java/eu/m724/realweather/time/TimeMaster.java @@ -0,0 +1,34 @@ +package eu.m724.realweather.time; + +import java.util.ArrayList; + +import eu.m724.realweather.DebugLogger; +import eu.m724.realweather.mapper.Mapper; +import eu.m724.realweather.object.UserException; +import eu.m724.realweather.thunder.ThunderConfig; +import eu.m724.wtapi.provider.exception.ProviderException; +import eu.m724.wtapi.thunder.ThunderProvider; +import eu.m724.wtapi.thunder.impl.lightningmaps.LightningMapsProvider; +import eu.m724.wtapi.thunder.impl.lightningmaps.TimedStrike; + +public class TimeMaster { + private TimeConfig config; + private Mapper mapper; + + public TimeMaster(TimeConfig config, Mapper mapper) { + this.config = config; + this.mapper = mapper; + } + + /** + * initializes, tests and starts + * @throws UserException config issue + */ + public void init() throws UserException { + if (!config.enabled) + return; + + // TODO start task, actually create that task, account for data from weather like sunrise sunset timezone + DebugLogger.info("time loaded", 1); + } +} diff --git a/src/main/java/eu/m724/realweather/weather/WeatherConfig.java b/src/main/java/eu/m724/realweather/weather/WeatherConfig.java new file mode 100644 index 0000000..ea82d53 --- /dev/null +++ b/src/main/java/eu/m724/realweather/weather/WeatherConfig.java @@ -0,0 +1,29 @@ +package eu.m724.realweather.weather; + +import org.bukkit.configuration.ConfigurationSection; + +public class WeatherConfig { + public boolean enabled; + + public String provider; + public String apiKey; + + // state is per player + public boolean dynamic; + // prevent other stuff from changing weather + public boolean lock; + + public static WeatherConfig fromConfiguration(ConfigurationSection configuration) { + WeatherConfig weatherConfig = new WeatherConfig(); + + weatherConfig.enabled = configuration.getBoolean("enabled"); + + weatherConfig.provider = configuration.getString("provider"); + weatherConfig.apiKey = configuration.getString("apiKey"); + + weatherConfig.dynamic = configuration.getBoolean("dynamic"); + weatherConfig.lock = configuration.getBoolean("lock"); + + return weatherConfig; + } +} diff --git a/src/main/java/eu/m724/realweather/weather/WeatherMaster.java b/src/main/java/eu/m724/realweather/weather/WeatherMaster.java new file mode 100644 index 0000000..99251dc --- /dev/null +++ b/src/main/java/eu/m724/realweather/weather/WeatherMaster.java @@ -0,0 +1,48 @@ +package eu.m724.realweather.weather; + +import eu.m724.realweather.DebugLogger; +import eu.m724.realweather.mapper.Mapper; +import eu.m724.realweather.object.UserException; +import eu.m724.wtapi.provider.WeatherProvider; +import eu.m724.wtapi.provider.exception.ProviderException; +import eu.m724.wtapi.provider.impl.openweathermap.OpenWeatherMapProvider; + +public class WeatherMaster { + private WeatherConfig config; + private Mapper mapper; + private WeatherProvider provider; + + public WeatherMaster(WeatherConfig config, Mapper mapper) { + this.config = config; + this.mapper = mapper; + } + + /** + * initializes, tests and starts + * @throws UserException config issue + * @throws ProviderException if provider initialization failed + */ + public void init() throws UserException, ProviderException { + if (!config.enabled) + return; + + provider = createProvider(); + + if (provider == null) + throw new UserException("Invalid provider: " + config.provider); + + provider.init(); + + // TODO start task + DebugLogger.info("weather loaded", 1); + } + + private WeatherProvider createProvider() { + switch (config.provider) { + case "openweathermap": + return new OpenWeatherMapProvider(config.apiKey); + } + + return null; + } +} diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml new file mode 100644 index 0000000..f6e8b69 --- /dev/null +++ b/src/main/resources/config.yml @@ -0,0 +1,17 @@ +############################ +### GENERAL SETTINGS ### +############################ + +# Master switch +enabled: true + +updater: + # notify players about plugin updates + # revelant permission node: realweather.update.notify + notify: true + +# 0 - no debug +# 1 - debug loading modules +# 2 - also debug processing conditions +# 3 - also log tasks running, this will spam +debug: 0 \ No newline at end of file diff --git a/src/main/resources/map.yml b/src/main/resources/map.yml new file mode 100644 index 0000000..03f61ef --- /dev/null +++ b/src/main/resources/map.yml @@ -0,0 +1,24 @@ +############################ +### MAP SETTINGS ### +############################ + +# true if the list below is a blacklist, false otherwise +worldBlacklist: true +worlds: +- disabled_world +- something + +dimensions: + # 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: + # latitude: 333333 + # longitude: 166666 + +# if you use `static` mode +point: + latitude: 0 + longitude: 0 \ No newline at end of file diff --git a/src/main/resources/modules/thunder.yml b/src/main/resources/modules/thunder.yml new file mode 100644 index 0000000..20c3e4b --- /dev/null +++ b/src/main/resources/modules/thunder.yml @@ -0,0 +1,12 @@ +############################ +### THUNDER SETTINGS ### +############################ + +enabled: false + +# currently only lightningmaps +provider: lightningmaps + +# how often should we poll for updates and spawn lightning +# note that this runs synchronously so increase if lag +refresh: 50 # millis diff --git a/src/main/resources/modules/time.yml b/src/main/resources/modules/time.yml new file mode 100644 index 0000000..b95c34e --- /dev/null +++ b/src/main/resources/modules/time.yml @@ -0,0 +1,17 @@ +############################ +### TIME SETTINGS ### +############################ + +# warning: this removes sleep +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 + +# x day cycles in 1 irl day cycle +# time will no longer be in sync +# can be decimal +modifier: 1.0 \ No newline at end of file diff --git a/src/main/resources/modules/weather.yml b/src/main/resources/modules/weather.yml new file mode 100644 index 0000000..18969d6 --- /dev/null +++ b/src/main/resources/modules/weather.yml @@ -0,0 +1,19 @@ +############################ +### WEATHER SETTINGS ### +############################ + +enabled: false + +# Currently only OpenWeatherMap +provider: openweathermap +# put your OpenWeatherMap api key +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 +# settings for both are in map.yml +dynamic: true + +# prevent the game, players or other plugins from changing the weather +lock: true \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml new file mode 100644 index 0000000..d0f3bb5 --- /dev/null +++ b/src/main/resources/plugin.yml @@ -0,0 +1,43 @@ +name: RealWeather +version: ${project.version} + +author: Minecon724 +website: https://www.spigotmc.org/resources/101599 + +api-version: 1.20 +load: STARTUP +main: eu.m724.realweather.RealWeatherPlugin + +commands: + realweather: + description: AIO RealWeather command + aliases: rw + permission: realweather.command + permission-message: You do not have permission to use this command. + # usage is processed in code + geo: + description: Convert lat,lon to x,y,z and vice versa + permission: realweather.geo + permission-message: You do not have permission to use this command. + # usage is processed in code + +permissions: + realweather.command: + description: Allows /realweather (individual nodes are still necessary for subcommands) + realweather.command.status: + description: /realweather status + + realweather.command.*: + description: All /realweather commands + children: + realweather.command: true + realweather.command.status: true + + realweather.geo: + description: Allows /geo + default: true + realweather.geo.tp: + description: Allows teleportation using /geo + + realweather.update.notify: + description: Receive notifications for RealWeather updates \ No newline at end of file diff --git a/target/classes/META-INF/maven/eu.m724/realweather/pom.properties b/target/classes/META-INF/maven/eu.m724/realweather/pom.properties index e825c42..1c65891 100644 --- a/target/classes/META-INF/maven/eu.m724/realweather/pom.properties +++ b/target/classes/META-INF/maven/eu.m724/realweather/pom.properties @@ -1,5 +1,5 @@ #Generated by Maven Integration for Eclipse -#Sat Jun 01 13:23:15 CEST 2024 +#Sat Jun 01 19:33:58 CEST 2024 artifactId=realweather groupId=eu.m724 m2e.projectLocation=/home/user/eclipse-workspace/realweather diff --git a/target/classes/META-INF/maven/eu.m724/realweather/pom.xml b/target/classes/META-INF/maven/eu.m724/realweather/pom.xml index 46ffdff..c5030e3 100644 --- a/target/classes/META-INF/maven/eu.m724/realweather/pom.xml +++ b/target/classes/META-INF/maven/eu.m724/realweather/pom.xml @@ -1,6 +1,69 @@ - 4.0.0 - eu.m724 - realweather - 0.9-SNAPSHOT + 4.0.0 + eu.m724 + realweather + 0.9-SNAPSHOT + + + 17 + 17 + + + + + spigot-repo + https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + + + 724rocks + https://git.724.rocks/api/packages/Minecon724/maven + + + + + + org.spigotmc + spigot-api + 1.20.6-R0.1-SNAPSHOT + provided + + + eu.m724 + wtapi + 0.2 + + + + + + + src/main/resources + true + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.6.0 + + + package + + shade + + + true + + + eu.m724:wtapi + + + + + + + + + \ No newline at end of file diff --git a/target/classes/config.yml b/target/classes/config.yml new file mode 100644 index 0000000..f6e8b69 --- /dev/null +++ b/target/classes/config.yml @@ -0,0 +1,17 @@ +############################ +### GENERAL SETTINGS ### +############################ + +# Master switch +enabled: true + +updater: + # notify players about plugin updates + # revelant permission node: realweather.update.notify + notify: true + +# 0 - no debug +# 1 - debug loading modules +# 2 - also debug processing conditions +# 3 - also log tasks running, this will spam +debug: 0 \ No newline at end of file diff --git a/target/classes/eu/m724/realweather/DebugLogger.class b/target/classes/eu/m724/realweather/DebugLogger.class new file mode 100644 index 0000000..4f02b8f Binary files /dev/null and b/target/classes/eu/m724/realweather/DebugLogger.class differ diff --git a/target/classes/eu/m724/realweather/RealWeatherPlugin.class b/target/classes/eu/m724/realweather/RealWeatherPlugin.class new file mode 100644 index 0000000..70ea509 Binary files /dev/null and b/target/classes/eu/m724/realweather/RealWeatherPlugin.class differ diff --git a/target/classes/eu/m724/realweather/mapper/Mapper.class b/target/classes/eu/m724/realweather/mapper/Mapper.class new file mode 100644 index 0000000..fda6ee7 Binary files /dev/null and b/target/classes/eu/m724/realweather/mapper/Mapper.class differ diff --git a/target/classes/eu/m724/realweather/mapper/MapperConfig.class b/target/classes/eu/m724/realweather/mapper/MapperConfig.class new file mode 100644 index 0000000..6241165 Binary files /dev/null and b/target/classes/eu/m724/realweather/mapper/MapperConfig.class differ diff --git a/target/classes/eu/m724/realweather/mapper/MapperEventHandler.class b/target/classes/eu/m724/realweather/mapper/MapperEventHandler.class new file mode 100644 index 0000000..95a842a Binary files /dev/null and b/target/classes/eu/m724/realweather/mapper/MapperEventHandler.class differ diff --git a/target/classes/eu/m724/realweather/object/UserException.class b/target/classes/eu/m724/realweather/object/UserException.class new file mode 100644 index 0000000..7118d2a Binary files /dev/null and b/target/classes/eu/m724/realweather/object/UserException.class differ diff --git a/target/classes/eu/m724/realweather/thunder/ThunderConfig.class b/target/classes/eu/m724/realweather/thunder/ThunderConfig.class new file mode 100644 index 0000000..4809d6a Binary files /dev/null and b/target/classes/eu/m724/realweather/thunder/ThunderConfig.class differ diff --git a/target/classes/eu/m724/realweather/thunder/ThunderMaster.class b/target/classes/eu/m724/realweather/thunder/ThunderMaster.class new file mode 100644 index 0000000..f2f673a Binary files /dev/null and b/target/classes/eu/m724/realweather/thunder/ThunderMaster.class differ diff --git a/target/classes/eu/m724/realweather/thunder/ThunderTask.class b/target/classes/eu/m724/realweather/thunder/ThunderTask.class new file mode 100644 index 0000000..ac8997c Binary files /dev/null and b/target/classes/eu/m724/realweather/thunder/ThunderTask.class differ diff --git a/target/classes/eu/m724/realweather/time/TimeConfig.class b/target/classes/eu/m724/realweather/time/TimeConfig.class new file mode 100644 index 0000000..c65f5c7 Binary files /dev/null and b/target/classes/eu/m724/realweather/time/TimeConfig.class differ diff --git a/target/classes/eu/m724/realweather/time/TimeMaster.class b/target/classes/eu/m724/realweather/time/TimeMaster.class new file mode 100644 index 0000000..d212360 Binary files /dev/null and b/target/classes/eu/m724/realweather/time/TimeMaster.class differ diff --git a/target/classes/eu/m724/realweather/weather/WeatherConfig.class b/target/classes/eu/m724/realweather/weather/WeatherConfig.class new file mode 100644 index 0000000..9bad6fb Binary files /dev/null and b/target/classes/eu/m724/realweather/weather/WeatherConfig.class differ diff --git a/target/classes/eu/m724/realweather/weather/WeatherMaster.class b/target/classes/eu/m724/realweather/weather/WeatherMaster.class new file mode 100644 index 0000000..dbe2945 Binary files /dev/null and b/target/classes/eu/m724/realweather/weather/WeatherMaster.class differ diff --git a/target/classes/map.yml b/target/classes/map.yml new file mode 100644 index 0000000..03f61ef --- /dev/null +++ b/target/classes/map.yml @@ -0,0 +1,24 @@ +############################ +### MAP SETTINGS ### +############################ + +# true if the list below is a blacklist, false otherwise +worldBlacklist: true +worlds: +- disabled_world +- something + +dimensions: + # 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: + # latitude: 333333 + # longitude: 166666 + +# if you use `static` mode +point: + latitude: 0 + longitude: 0 \ No newline at end of file diff --git a/target/classes/modules/thunder.yml b/target/classes/modules/thunder.yml new file mode 100644 index 0000000..20c3e4b --- /dev/null +++ b/target/classes/modules/thunder.yml @@ -0,0 +1,12 @@ +############################ +### THUNDER SETTINGS ### +############################ + +enabled: false + +# currently only lightningmaps +provider: lightningmaps + +# how often should we poll for updates and spawn lightning +# note that this runs synchronously so increase if lag +refresh: 50 # millis diff --git a/target/classes/modules/time.yml b/target/classes/modules/time.yml new file mode 100644 index 0000000..b95c34e --- /dev/null +++ b/target/classes/modules/time.yml @@ -0,0 +1,17 @@ +############################ +### TIME SETTINGS ### +############################ + +# warning: this removes sleep +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 + +# x day cycles in 1 irl day cycle +# time will no longer be in sync +# can be decimal +modifier: 1.0 \ No newline at end of file diff --git a/target/classes/modules/weather.yml b/target/classes/modules/weather.yml new file mode 100644 index 0000000..18969d6 --- /dev/null +++ b/target/classes/modules/weather.yml @@ -0,0 +1,19 @@ +############################ +### WEATHER SETTINGS ### +############################ + +enabled: false + +# Currently only OpenWeatherMap +provider: openweathermap +# put your OpenWeatherMap api key +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 +# settings for both are in map.yml +dynamic: true + +# prevent the game, players or other plugins from changing the weather +lock: true \ No newline at end of file diff --git a/target/classes/plugin.yml b/target/classes/plugin.yml new file mode 100644 index 0000000..adacbad --- /dev/null +++ b/target/classes/plugin.yml @@ -0,0 +1,43 @@ +name: RealWeather +version: 0.9-SNAPSHOT + +author: Minecon724 +website: https://www.spigotmc.org/resources/101599 + +api-version: 1.20 +load: STARTUP +main: eu.m724.realweather.RealWeatherPlugin + +commands: + realweather: + description: AIO RealWeather command + aliases: rw + permission: realweather.command + permission-message: You do not have permission to use this command. + # usage is processed in code + geo: + description: Convert lat,lon to x,y,z and vice versa + permission: realweather.geo + permission-message: You do not have permission to use this command. + # usage is processed in code + +permissions: + realweather.command: + description: Allows /realweather (individual nodes are still necessary for subcommands) + realweather.command.status: + description: /realweather status + + realweather.command.*: + description: All /realweather commands + children: + realweather.command: true + realweather.command.status: true + + realweather.geo: + description: Allows /geo + default: true + realweather.geo.tp: + description: Allows teleportation using /geo + + realweather.update.notify: + description: Receive notifications for RealWeather updates \ No newline at end of file