add support for Minecraft 1.7+
This commit is contained in:
@@ -4,7 +4,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = 'io.github.Jack1424'
|
group = 'io.github.Jack1424'
|
||||||
version = '1.1.2'
|
version = '1.2.0'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@@ -20,14 +20,14 @@ repositories {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("org.bstats:bstats-bukkit:3.0.0")
|
implementation("org.bstats:bstats-bukkit:3.0.0")
|
||||||
compileOnly 'io.papermc.paper:paper-api:1.19.2-R0.1-SNAPSHOT'
|
implementation("org.bukkit:bukkit:1.13-R0.1-SNAPSHOT")
|
||||||
}
|
}
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
relocate('org.bstats', 'io.github.jack1424.realtimeweather')
|
relocate('org.bstats', 'io.github.jack1424.realtimeweather')
|
||||||
}
|
}
|
||||||
|
|
||||||
def targetJavaVersion = 17
|
def targetJavaVersion = 11
|
||||||
java {
|
java {
|
||||||
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
|
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
|
||||||
sourceCompatibility = javaVersion
|
sourceCompatibility = javaVersion
|
||||||
|
@@ -2,7 +2,6 @@ package io.github.jack1424.realtimeweather;
|
|||||||
|
|
||||||
import org.bstats.bukkit.Metrics;
|
import org.bstats.bukkit.Metrics;
|
||||||
import org.bstats.charts.SimplePie;
|
import org.bstats.charts.SimplePie;
|
||||||
import org.bukkit.GameRule;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@@ -62,9 +61,9 @@ public final class RealTimeWeather extends JavaPlugin implements Listener {
|
|||||||
debug("Re-enabling normal daylight and weather cycles...");
|
debug("Re-enabling normal daylight and weather cycles...");
|
||||||
|
|
||||||
if (timeEnabled)
|
if (timeEnabled)
|
||||||
world.setGameRule(GameRule.DO_DAYLIGHT_CYCLE, true);
|
world.setGameRuleValue("doDaylightCycle", "true");
|
||||||
if (weatherEnabled)
|
if (weatherEnabled)
|
||||||
world.setGameRule(GameRule.DO_WEATHER_CYCLE, true);
|
world.setGameRuleValue("doWeatherCycle", "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("Stopping...");
|
logger.info("Stopping...");
|
||||||
@@ -103,7 +102,7 @@ public final class RealTimeWeather extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
for (World world : getServer().getWorlds())
|
for (World world : getServer().getWorlds())
|
||||||
if (world.getEnvironment().equals(World.Environment.NORMAL))
|
if (world.getEnvironment().equals(World.Environment.NORMAL))
|
||||||
world.setGameRule(GameRule.DO_DAYLIGHT_CYCLE, false);
|
world.setGameRuleValue("doDaylightCycle", "false");
|
||||||
|
|
||||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, () -> {
|
getServer().getScheduler().scheduleSyncRepeatingTask(this, () -> {
|
||||||
if (timeEnabled) {
|
if (timeEnabled) {
|
||||||
@@ -129,15 +128,18 @@ public final class RealTimeWeather extends JavaPlugin implements Listener {
|
|||||||
int response = con.getResponseCode();
|
int response = con.getResponseCode();
|
||||||
if (response > 499) {
|
if (response > 499) {
|
||||||
logger.severe("There was a server error when requesting weather information. Please try again later");
|
logger.severe("There was a server error when requesting weather information. Please try again later");
|
||||||
throw new Exception("Server error");
|
throw new Exception("Server/client error");
|
||||||
}
|
}
|
||||||
else if (response > 399) {
|
else if (response > 399) {
|
||||||
String message = "Error when getting weather information: ";
|
String message = "Error when getting weather information: ";
|
||||||
switch (response) {
|
|
||||||
case 401 -> logger.severe(message + "API key incorrect");
|
if (response == 401)
|
||||||
case 404 -> logger.severe(message + "Zip/Country code incorrect");
|
logger.severe(message + "API key incorrect");
|
||||||
default -> logger.severe("Unknown error");
|
else if (response == 404)
|
||||||
}
|
logger.severe(message + "Zip/Country code incorrect");
|
||||||
|
else
|
||||||
|
logger.severe("Unknown error");
|
||||||
|
|
||||||
logger.severe("Please check that the values set in the config file are correct");
|
logger.severe("Please check that the values set in the config file are correct");
|
||||||
|
|
||||||
throw new Exception("Configuration error");
|
throw new Exception("Configuration error");
|
||||||
@@ -156,7 +158,7 @@ public final class RealTimeWeather extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
for (World world : getServer().getWorlds())
|
for (World world : getServer().getWorlds())
|
||||||
if (world.getEnvironment().equals(World.Environment.NORMAL))
|
if (world.getEnvironment().equals(World.Environment.NORMAL))
|
||||||
world.setGameRule(GameRule.DO_WEATHER_CYCLE, false);
|
world.setGameRuleValue("doWeatherCycle", "false");
|
||||||
|
|
||||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, () -> {
|
getServer().getScheduler().scheduleSyncRepeatingTask(this, () -> {
|
||||||
debug("Syncing weather...");
|
debug("Syncing weather...");
|
||||||
|
@@ -2,6 +2,5 @@ name: RealTimeWeather
|
|||||||
version: '${version}'
|
version: '${version}'
|
||||||
description: Sync your server time and weather with the real world
|
description: Sync your server time and weather with the real world
|
||||||
main: io.github.jack1424.realtimeweather.RealTimeWeather
|
main: io.github.jack1424.realtimeweather.RealTimeWeather
|
||||||
api-version: 1.19
|
|
||||||
authors: [ Jack1424 ]
|
authors: [ Jack1424 ]
|
||||||
website: https://github.com/Jack1424/RealTimeWeather
|
website: https://github.com/Jack1424/RealTimeWeather
|
||||||
|
Reference in New Issue
Block a user