mirror of
https://github.com/kennytv/Maintenance.git
synced 2026-11-04 16:50:07 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
420412978e | ||
|
|
25e2f4dae2 | ||
|
|
d767be96b5 | ||
|
|
6d73acca9b | ||
|
|
1f116374ad | ||
|
|
d0b7d96208 | ||
|
|
16285d7064 | ||
|
|
1f27084fe1 | ||
|
|
261aace0db | ||
|
|
344b910214 | ||
|
|
fbaa4896e1 | ||
|
|
2f93064f60 | ||
|
|
65b47c5e07 | ||
|
|
d70d01f2d3 | ||
|
|
769d7d3bcd | ||
|
|
a5f47688e0 | ||
|
|
7d2e6a25a4 | ||
|
|
69999b3b7a | ||
|
|
94d1bd4eb9 | ||
|
|
c18e8b7ab7 | ||
|
|
9f45187300 | ||
|
|
0c6ba8a9b7 | ||
|
|
1af69f2e8b |
No files matched your search
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<artifactId>maintenance-base</artifactId>
|
||||
<groupId>eu.kennytv</groupId>
|
||||
<version>2.3</version>
|
||||
<version>2.3.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>maintenance-api</artifactId>
|
||||
@@ -16,7 +16,7 @@
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.12-SNAPSHOT</version>
|
||||
<version>1.13-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -24,7 +24,7 @@ public interface IMaintenance {
|
||||
boolean isMaintenance();
|
||||
|
||||
/**
|
||||
* @return true if a timer task is currently running
|
||||
* @return true if a start- or endtimer task is currently running
|
||||
*/
|
||||
boolean isTaskRunning();
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ import java.util.UUID;
|
||||
public interface ISettings {
|
||||
|
||||
/**
|
||||
* Note that the value might need a few seconds to update, if you're on BungeeCord with MySQL enabled
|
||||
*
|
||||
* @return true if maintenance is currently enabled
|
||||
*/
|
||||
boolean isMaintenance();
|
||||
@@ -40,10 +42,10 @@ public interface ISettings {
|
||||
/**
|
||||
* Removes a player from the maintenance whitelist.
|
||||
*
|
||||
* @param name name of the player to remove in lowercase letters
|
||||
* @param name name of the player to remove with original lower-/uppercase letters
|
||||
* @return true if removing the player was successful
|
||||
* @deprecated if a player changes their name, the list will still contain the old one
|
||||
* @see #removeWhitelistedPlayer(UUID)
|
||||
* @deprecated if a player changes their name, the list will still contain the old one and thus this might not work
|
||||
*/
|
||||
@Deprecated
|
||||
boolean removeWhitelistedPlayer(String name);
|
||||
|
||||
@@ -6,7 +6,7 @@ import net.md_5.bungee.api.plugin.Plugin;
|
||||
/**
|
||||
* Utility class to get the {@link IMaintenance} instance for the BungeeCord version of the plugin.
|
||||
* <p>
|
||||
* This class is NOT available for the Spigot version!
|
||||
* Only access this class if you're running the plugin on a BungeeCord server!
|
||||
* </p>
|
||||
*
|
||||
* @author KennyTV
|
||||
|
||||
@@ -4,9 +4,9 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Utility class to get the {@link IMaintenance} instance for the Spigot/Bukkit version of the plugin.
|
||||
* Utility class to get the {@link IMaintenance} instance for the Spigot version of the plugin.
|
||||
* <p>
|
||||
* This class is NOT available for the BungeeCord version!
|
||||
* Only access this class if you're running the plugin on a Spigot server!
|
||||
* </p>
|
||||
*
|
||||
* @author KennyTV
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<artifactId>maintenance-base</artifactId>
|
||||
<groupId>eu.kennytv</groupId>
|
||||
<version>2.3</version>
|
||||
<version>2.3.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>maintenance-bungee</artifactId>
|
||||
@@ -29,7 +29,7 @@
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.12-SNAPSHOT</version>
|
||||
<version>1.13-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -41,7 +41,7 @@
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<version>3.2.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
+37
-14
@@ -1,6 +1,5 @@
|
||||
package eu.kennytv.maintenance.bungee;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import eu.kennytv.maintenance.bungee.listener.ProxyPingListener;
|
||||
import eu.kennytv.maintenance.bungee.mysql.MySQL;
|
||||
import eu.kennytv.maintenance.core.Settings;
|
||||
@@ -11,6 +10,7 @@ import net.md_5.bungee.config.Configuration;
|
||||
import net.md_5.bungee.config.YamlConfiguration;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
@@ -26,6 +26,9 @@ public final class SettingsBungee extends Settings {
|
||||
private Configuration config;
|
||||
private Configuration whitelist;
|
||||
|
||||
private long millisecondsToCheck;
|
||||
private long lastMySQLCheck;
|
||||
|
||||
SettingsBungee(final MaintenanceBungeeBase plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
@@ -58,6 +61,16 @@ public final class SettingsBungee extends Settings {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateExtraConfig() {
|
||||
// 2.3.1 mysql.update-interval
|
||||
if (!configContains("mysql.update-interval")) {
|
||||
setToConfig("mysql.update-interval", 15);
|
||||
saveConfig();
|
||||
reloadConfigs();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadConfigs() {
|
||||
reloadConfigs(false);
|
||||
@@ -67,20 +80,12 @@ public final class SettingsBungee extends Settings {
|
||||
public void saveConfig() {
|
||||
final File file = new File(plugin.getDataFolder(), "bungee-config.yml");
|
||||
try {
|
||||
YamlConfiguration.getProvider(YamlConfiguration.class).save(config, new OutputStreamWriter(new FileOutputStream(file), "UTF8"));
|
||||
YamlConfiguration.getProvider(YamlConfiguration.class).save(config, new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8));
|
||||
} catch (final IOException e) {
|
||||
throw new RuntimeException("Unable to save bungee-config.yml!", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateConfig() {
|
||||
if (!config.contains("pingmessage")) return;
|
||||
config.set("pingmessages", Lists.newArrayList(getConfigString("pingmessage")));
|
||||
config.set("pingmessage", null);
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveWhitelistedPlayers() {
|
||||
final File file = new File(plugin.getDataFolder(), "WhitelistedPlayers.yml");
|
||||
@@ -94,7 +99,7 @@ public final class SettingsBungee extends Settings {
|
||||
private void reloadConfigs(final boolean createdNewWhitelist) {
|
||||
final File file = new File(plugin.getDataFolder(), "bungee-config.yml");
|
||||
try {
|
||||
config = YamlConfiguration.getProvider(YamlConfiguration.class).load(new InputStreamReader(new FileInputStream(file), "UTF8"));
|
||||
config = YamlConfiguration.getProvider(YamlConfiguration.class).load(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8));
|
||||
whitelist = YamlConfiguration.getProvider(YamlConfiguration.class).load(new File(plugin.getDataFolder(), "WhitelistedPlayers.yml"));
|
||||
} catch (final IOException e) {
|
||||
throw new RuntimeException("Unable to load bungee-config.yml!", e);
|
||||
@@ -112,6 +117,11 @@ public final class SettingsBungee extends Settings {
|
||||
public void loadExtraSettings() {
|
||||
whitelistedPlayers.clear();
|
||||
whitelist.getKeys().forEach(key -> whitelistedPlayers.put(UUID.fromString(key), whitelist.getString(key)));
|
||||
if (mySQL != null) {
|
||||
final long configValue = config.getInt("mysql.update-interval");
|
||||
millisecondsToCheck = configValue > 0 ? configValue * 1000 : -1;
|
||||
lastMySQLCheck = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -149,7 +159,12 @@ public final class SettingsBungee extends Settings {
|
||||
|
||||
@Override
|
||||
public String getConfigString(final String path) {
|
||||
return ChatColor.translateAlternateColorCodes('&', config.getString(path));
|
||||
final String s = config.getString(path);
|
||||
if (s == null) {
|
||||
plugin.getLogger().warning("The config is missing the following string: " + path);
|
||||
return "null";
|
||||
}
|
||||
return ChatColor.translateAlternateColorCodes('&', s);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -172,6 +187,11 @@ public final class SettingsBungee extends Settings {
|
||||
config.set(path, var);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean configContains(final String path) {
|
||||
return config.contains(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColoredString(final String message) {
|
||||
return ChatColor.translateAlternateColorCodes('&', message);
|
||||
@@ -179,16 +199,17 @@ public final class SettingsBungee extends Settings {
|
||||
|
||||
@Override
|
||||
public boolean isMaintenance() {
|
||||
if (mySQL != null) {
|
||||
if (mySQL != null && (millisecondsToCheck == -1 || System.currentTimeMillis() - lastMySQLCheck > millisecondsToCheck)) {
|
||||
mySQL.executeQuery(maintenanceQuery, rs -> {
|
||||
try {
|
||||
if (rs.next())
|
||||
maintenance = Boolean.parseBoolean(rs.getString("value"));
|
||||
rs.close();
|
||||
} catch (final SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}, "maintenance");
|
||||
if (millisecondsToCheck != -1)
|
||||
lastMySQLCheck = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
return maintenance;
|
||||
@@ -203,6 +224,8 @@ public final class SettingsBungee extends Settings {
|
||||
plugin.getProxy().getScheduler().runAsync(plugin, () -> {
|
||||
final String s = String.valueOf(maintenance);
|
||||
mySQL.executeUpdate(updateQuery, "maintenance", s, s);
|
||||
if (millisecondsToCheck != -1)
|
||||
lastMySQLCheck = System.currentTimeMillis();
|
||||
});
|
||||
this.maintenance = maintenance;
|
||||
}
|
||||
|
||||
@@ -65,9 +65,4 @@ public final class MySQL {
|
||||
executeUpdate(query, res -> {
|
||||
}, objects);
|
||||
}
|
||||
|
||||
public void close() {
|
||||
if (hikariDataSource != null && !hikariDataSource.isClosed())
|
||||
hikariDataSource.close();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
# MaintenanceBungee Plugin by KennyTV
|
||||
# MaintenanceBungee Plugin by KennyTV
|
||||
# Version ${project.version}
|
||||
|
||||
# Enables maintenance-mode.
|
||||
@@ -50,3 +50,7 @@ mysql:
|
||||
password: password
|
||||
# A new table with this name will be created on first startup when 'use-mysql' is set to true.
|
||||
table: maintenance_settings
|
||||
# Requests to the database will only be made at least x seconds after the last request,
|
||||
# so there won't be a request on every single ping on a server with many players.
|
||||
# Set to 0 to make a database request on every single ping.
|
||||
update-interval: 15
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<artifactId>maintenance-base</artifactId>
|
||||
<groupId>eu.kennytv</groupId>
|
||||
<version>2.3</version>
|
||||
<version>2.3.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>maintenance-core</artifactId>
|
||||
|
||||
@@ -39,14 +39,28 @@ public abstract class Settings implements ISettings {
|
||||
broadcastIntervalls = new HashSet<>(getConfigIntList("timer-broadcasts-for-minutes"));
|
||||
playerCountMessage = getConfigString("playercountmessage");
|
||||
playerCountHoverMessage = getConfigString("playercounthovermessage");
|
||||
if (hasCustomIcon())
|
||||
if (customMaintenanceIcon)
|
||||
reloadMaintenanceIcon();
|
||||
|
||||
loadExtraSettings();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public abstract void updateConfig();
|
||||
private void updateConfig() {
|
||||
// 2.3 pingmessage -> pingmessages
|
||||
if (configContains("pingmessage")) {
|
||||
final List<Object> list = new ArrayList<>();
|
||||
list.add(getConfigString("pingmessage"));
|
||||
setToConfig("pingmessages", list);
|
||||
setToConfig("pingmessage", null);
|
||||
saveConfig();
|
||||
reloadConfigs();
|
||||
}
|
||||
|
||||
updateExtraConfig();
|
||||
}
|
||||
|
||||
public void updateExtraConfig() {
|
||||
}
|
||||
|
||||
public abstract void saveWhitelistedPlayers();
|
||||
|
||||
@@ -70,6 +84,8 @@ public abstract class Settings implements ISettings {
|
||||
|
||||
public abstract void setToConfig(String path, Object var);
|
||||
|
||||
public abstract boolean configContains(String path);
|
||||
|
||||
public abstract String getColoredString(String s);
|
||||
|
||||
public List<String> getPingMessages() {
|
||||
@@ -121,6 +137,7 @@ public abstract class Settings implements ISettings {
|
||||
}
|
||||
|
||||
public String getRandomPingMessage() {
|
||||
if (pingMessages.isEmpty()) return "";
|
||||
final String s = pingMessages.size() > 1 ? pingMessages.get(RANDOM.nextInt(pingMessages.size())) : pingMessages.get(0);
|
||||
return getColoredString(s.replace("%NEWLINE%", "\n"));
|
||||
}
|
||||
@@ -158,7 +175,7 @@ public abstract class Settings implements ISettings {
|
||||
@Override
|
||||
public boolean removeWhitelistedPlayer(final String name) {
|
||||
if (!whitelistedPlayers.containsValue(name)) return false;
|
||||
final UUID uuid = whitelistedPlayers.entrySet().stream().filter(entry -> entry.getValue().equals(name)).findFirst().get().getKey();
|
||||
final UUID uuid = whitelistedPlayers.entrySet().stream().filter(entry -> entry.getValue().equals(name)).findAny().get().getKey();
|
||||
whitelistedPlayers.remove(uuid);
|
||||
setWhitelist(uuid.toString(), null);
|
||||
saveWhitelistedPlayers();
|
||||
|
||||
+24
-13
@@ -186,19 +186,30 @@ public abstract class MaintenanceCommand {
|
||||
private void sendUsage(final SenderInfo sender) {
|
||||
sender.sendMessage("");
|
||||
sender.sendMessage("§8===========[ §e" + name + " §8| §eVersion: §e" + plugin.getVersion() + " §8]===========");
|
||||
sender.sendMessage("§6/maintenance reload §7(Reloads the config file, whitelist file and the server-icon)");
|
||||
sender.sendMessage("§6/maintenance on §7(Enables maintenance mode");
|
||||
sender.sendMessage("§6/maintenance off §7(Disables maintenance mode)");
|
||||
sender.sendMessage("§6/maintenance starttimer <minutes> §7(After the given time in minutes, maintenance mode will be enabled. Broadcast settings for the timer can be found in the config)");
|
||||
sender.sendMessage("§6/maintenance endtimer <minutes> §7(Enables maintenance mode. After the given time in minutes, maintenance mode will be disabled)");
|
||||
sender.sendMessage("§6/maintenance timer abort §7(If running, the current timer will be aborted)");
|
||||
sender.sendMessage("§6/maintenance whitelist §7(Shows all whitelisted players for the maintenance mode)");
|
||||
sender.sendMessage("§6/maintenance add <player> §7(Adds the player to the maintenance whitelist, so they can join the server even though maintenance is enabled)");
|
||||
sender.sendMessage("§6/maintenance remove <player> §7(Removes the player from the maintenance whitelist)");
|
||||
sender.sendMessage("§6/maintenance setmotd <index> <1/2> <message> §7(Sets a motd for maintenance mode)");
|
||||
sender.sendMessage("§6/maintenance motd §7(Lists the currently set maintenance motds)");
|
||||
sender.sendMessage("§6/maintenance update §7(Remotely downloads the newest version of the plugin onto your server)");
|
||||
sender.sendMessage("§9Created by: KennyTV");
|
||||
if (sender.hasPermission("maintenance.reload"))
|
||||
sender.sendMessage("§6/maintenance reload §7(Reloads the config file, whitelist file and the server-icon)");
|
||||
if (sender.hasPermission("maintenance.toggle")) {
|
||||
sender.sendMessage("§6/maintenance on §7(Enables maintenance mode");
|
||||
sender.sendMessage("§6/maintenance off §7(Disables maintenance mode)");
|
||||
}
|
||||
if (sender.hasPermission("maintenance.timer")) {
|
||||
sender.sendMessage("§6/maintenance starttimer <minutes> §7(After the given time in minutes, maintenance mode will be enabled. Broadcast settings for the timer can be found in the config)");
|
||||
sender.sendMessage("§6/maintenance endtimer <minutes> §7(Enables maintenance mode. After the given time in minutes, maintenance mode will be disabled)");
|
||||
sender.sendMessage("§6/maintenance timer abort §7(If running, the current timer will be aborted)");
|
||||
}
|
||||
if (sender.hasPermission("maintenance.whitelist.list"))
|
||||
sender.sendMessage("§6/maintenance whitelist §7(Shows all whitelisted players for the maintenance mode)");
|
||||
if (sender.hasPermission("maintenance.whitelist.add"))
|
||||
sender.sendMessage("§6/maintenance add <player> §7(Adds the player to the maintenance whitelist, so they can join the server even though maintenance is enabled)");
|
||||
if (sender.hasPermission("maintenance.whitelist.remove"))
|
||||
sender.sendMessage("§6/maintenance remove <player> §7(Removes the player from the maintenance whitelist)");
|
||||
if (sender.hasPermission("maintenance.setmotd"))
|
||||
sender.sendMessage("§6/maintenance setmotd <index> <1/2> <message> §7(Sets a motd for maintenance mode)");
|
||||
if (sender.hasPermission("maintenance.motd"))
|
||||
sender.sendMessage("§6/maintenance motd §7(Lists the currently set maintenance motds)");
|
||||
if (sender.hasPermission("maintenance.update"))
|
||||
sender.sendMessage("§6/maintenance update §7(Remotely downloads the newest version of the plugin onto your server)");
|
||||
sender.sendMessage("§7Created by §bKennyTV");
|
||||
sender.sendMessage("§8===========[ §e" + name + " §8| §eVersion: §e" + plugin.getVersion() + " §8]===========");
|
||||
sender.sendMessage("");
|
||||
}
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<artifactId>maintenance-base</artifactId>
|
||||
<groupId>eu.kennytv</groupId>
|
||||
<version>2.3</version>
|
||||
<version>2.3.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>maintenance-parent</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<artifactId>maintenance-base</artifactId>
|
||||
<groupId>eu.kennytv</groupId>
|
||||
<version>2.3</version>
|
||||
<version>2.3.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>maintenance-spigot</artifactId>
|
||||
|
||||
+13
-11
@@ -1,6 +1,5 @@
|
||||
package eu.kennytv.maintenance.spigot;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import eu.kennytv.maintenance.core.Settings;
|
||||
import eu.kennytv.maintenance.core.listener.IPingListener;
|
||||
import eu.kennytv.maintenance.spigot.listener.PacketListener;
|
||||
@@ -11,6 +10,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
@@ -46,14 +46,6 @@ public final class SettingsSpigot extends Settings {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateConfig() {
|
||||
if (!config.contains("pingmessage")) return;
|
||||
config.set("pingmessages", Lists.newArrayList(getConfigString("pingmessage")));
|
||||
config.set("pingmessage", null);
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveWhitelistedPlayers() {
|
||||
try {
|
||||
@@ -67,7 +59,7 @@ public final class SettingsSpigot extends Settings {
|
||||
public void reloadConfigs() {
|
||||
final File file = new File(plugin.getDataFolder(), "spigot-config.yml");
|
||||
try {
|
||||
config = YamlConfiguration.loadConfiguration(new InputStreamReader(new FileInputStream(file), "UTF8"));
|
||||
config = YamlConfiguration.loadConfiguration(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8));
|
||||
whitelist = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), "WhitelistedPlayers.yml"));
|
||||
} catch (final IOException e) {
|
||||
throw new RuntimeException("Unable to load spigot-config.yml!", e);
|
||||
@@ -114,7 +106,12 @@ public final class SettingsSpigot extends Settings {
|
||||
|
||||
@Override
|
||||
public String getConfigString(final String path) {
|
||||
return ChatColor.translateAlternateColorCodes('&', config.getString(path));
|
||||
final String s = config.getString(path);
|
||||
if (s == null) {
|
||||
plugin.getLogger().warning("The config is missing the following string: " + path);
|
||||
return "null";
|
||||
}
|
||||
return ChatColor.translateAlternateColorCodes('&', s);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -137,6 +134,11 @@ public final class SettingsSpigot extends Settings {
|
||||
config.set(path, var);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean configContains(final String path) {
|
||||
return config.contains(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColoredString(final String message) {
|
||||
return ChatColor.translateAlternateColorCodes('&', message);
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ public final class PacketListener implements IPingListener {
|
||||
public PacketListener(final MaintenanceSpigotBase base, final SettingsSpigot settings) {
|
||||
this.pl = base;
|
||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(base, ListenerPriority.HIGHEST,
|
||||
PacketType.Status.Server.OUT_SERVER_INFO) {
|
||||
PacketType.Status.Server.SERVER_INFO) {
|
||||
@Override
|
||||
public void onPacketSending(final PacketEvent event) {
|
||||
if (!settings.isMaintenance()) return;
|
||||
|
||||
+2
-1
@@ -17,6 +17,7 @@ import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collection;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
@@ -227,7 +228,7 @@ public final class MetricsLite {
|
||||
}
|
||||
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
final GZIPOutputStream gzip = new GZIPOutputStream(outputStream);
|
||||
gzip.write(str.getBytes("UTF-8"));
|
||||
gzip.write(str.getBytes(StandardCharsets.UTF_8));
|
||||
gzip.close();
|
||||
return outputStream.toByteArray();
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>eu.kennytv</groupId>
|
||||
<artifactId>maintenance-base</artifactId>
|
||||
<version>2.3</version>
|
||||
<version>2.3.1</version>
|
||||
<name>Maintenance</name>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<version>3.1.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
|
||||
Reference in new issue
Block a user