Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
77e1444dba | ||
|
|
915b43d897 | ||
|
|
adc06e3486 | ||
|
|
cc7f5c2d11 | ||
|
|
0bb54ffc5d | ||
|
|
15ee2e6074 | ||
|
|
89abab36f8 | ||
|
|
e0bb1336b0 | ||
|
|
888ffd301a | ||
|
|
3a55dd3280 | ||
|
|
61c47ba2fa | ||
|
|
b97e69a71f | ||
|
|
75c940d089 | ||
|
|
849fa2a720 | ||
|
|
7e249faa99 | ||
|
|
c8272b39d5 | ||
|
|
b3c561ae26 | ||
|
|
af24c5a331 |
No files matched your search
@@ -1,7 +1,15 @@
|
||||
# Maintenance Changelog
|
||||
This file contains update logs for this project. The top may contain a `Unreleased` section, gathering update logs for a future update during development.
|
||||
|
||||
## Unreleased
|
||||
## 3.0.2 - May 17th 2019
|
||||
### Changed
|
||||
* Added config option `timerspecific-pingmessages` to have specific pingmessages shown when endtimers are run
|
||||
* You can also set them ingame by using `/maintenance setmotd timer <index> ...` instead of `/maintenance setmotd <index> ...`, along with `/maintenance removemotd timer <index>` and `/maintenance motd timer`
|
||||
* Made dumps a little prettier
|
||||
* Support Sponge 8.0.0-SNAPSHOT
|
||||
* Support latest text/Velocity (now only supports Velocity builds from May 7th upwards)
|
||||
---
|
||||
## 3.0.1 - April 17th 2019
|
||||
### Changed
|
||||
* Created an addon to have PlaceholderAPI placeholders on Spigot when running the Maintenance plugin on Bungee (see [**here**](https://github.com/KennyTV/Maintenance/wiki/MaintenanceAddon))
|
||||
* Spigot version: If running on Paper 1.12.2 or higher, ProtocolLib will not be needed anymore
|
||||
|
||||
Binary file not shown.
@@ -1,7 +1,8 @@
|
||||
# Maintenance
|
||||
[](https://github.com/KennyTV/Maintenance/releases)
|
||||
[](https://travis-ci.org/KennyTV/Maintenance)
|
||||
[](https://discord.gg/vGCUzHq)
|
||||
[](https://discord.gg/vGCUzHq)
|
||||
[](https://twitter.com/KennyTVN)
|
||||
|
||||
Maintenance is probably the most customizable free maintenance plugin for your Minecraft server you can find. It runs on Bukkit/Spigot, BungeeCord, Sponge as well as Velocity.
|
||||
|
||||
@@ -14,6 +15,7 @@ Its features include:
|
||||
* Features specifically for Bungee/Velocity
|
||||
* Only want to enable maintenance on a single server? You can also do so by using the `/maintenance <on/off> <servername>` command
|
||||
* Link multiple proxy instances through a MySQL database connection, so you don't have to change maintenance on each proxy by hand
|
||||
* Use PlaceholderAPI placeholders with the [**MaintenanceAddon**](https://github.com/KennyTV/Maintenance/wiki/MaintenanceAddon) (only for Bungee)
|
||||
|
||||
A full list of commands, permissions and configuration options can be found in the wiki listed below.
|
||||
* [Wiki](https://github.com/KennyTV/Maintenance/wiki)
|
||||
@@ -25,12 +27,11 @@ A full list of commands, permissions and configuration options can be found in t
|
||||
|
||||
Other forum threads
|
||||
* [Spigot forums](https://www.spigotmc.org/resources/maintenance.40699/)
|
||||
* [Sponge forums](https://forums.spongepowered.org/t/maintenance/27421) (replacey by Ore)
|
||||
* [Ore Forums](https://ore.spongepowered.org/KennyTV/Maintenance)
|
||||
* [Ore/Sponge Forums](https://ore.spongepowered.org/KennyTV/Maintenance)
|
||||
* [Velocity forums](https://forums.velocitypowered.com/t/maintenance/129)
|
||||
|
||||
## Compiling
|
||||
To create a working jar yourself, simply clone the project and compile it with maven (by using `mvn clean package` in your IDE console).
|
||||
|
||||
## Licence
|
||||
You may only copy the code on a public repository while also keeping it under the same license (see [GNU General Public License](http://www.gnu.org/licenses/gpl-3.0)).
|
||||
When modifying the project's code, do that on a public repository while also keeping it under the same license (see [GNU General Public License](http://www.gnu.org/licenses/gpl-3.0)).
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.kennytv.maintenance</groupId>
|
||||
<artifactId>maintenance-parent</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<version>3.0.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>maintenance-api</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.kennytv.maintenance</groupId>
|
||||
<artifactId>maintenance-parent</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<version>3.0.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>maintenance-build</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.kennytv.maintenance</groupId>
|
||||
<artifactId>maintenance-parent</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<version>3.0.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>maintenance-bungee</artifactId>
|
||||
@@ -29,7 +29,7 @@
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.13-SNAPSHOT</version>
|
||||
<version>1.14-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.kennytv.maintenance</groupId>
|
||||
<artifactId>maintenance-parent</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<version>3.0.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>maintenance-core-proxy</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.kennytv.maintenance</groupId>
|
||||
<artifactId>maintenance-parent</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<version>3.0.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>maintenance-core</artifactId>
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package eu.kennytv.maintenance.core;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.io.CharStreams;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
@@ -165,7 +166,8 @@ public abstract class MaintenancePlugin implements IMaintenance {
|
||||
// Ore sad :(
|
||||
Preconditions.checkArgument(serverType != ServerType.SPONGE);
|
||||
try {
|
||||
final URLConnection conn = new URL("https://github.com/KennyTV/Maintenance/releases/download/" + newestVersion + "/Maintenance.jar").openConnection();
|
||||
final String fileSuffix = serverType == ServerType.VELOCITY ? "Velocity" : "";
|
||||
final URLConnection conn = new URL("https://github.com/KennyTV/Maintenance/releases/download/" + newestVersion + "/Maintenance" + fileSuffix + ".jar").openConnection();
|
||||
writeFile(new BufferedInputStream(conn.getInputStream()), new BufferedOutputStream(new FileOutputStream(getPluginFolder() + "Maintenance.tmp")));
|
||||
final File file = new File(getPluginFolder() + "Maintenance.tmp");
|
||||
final long newlength = file.length();
|
||||
@@ -216,11 +218,8 @@ public abstract class MaintenancePlugin implements IMaintenance {
|
||||
connection.setRequestProperty("Content-Type", "text/plain");
|
||||
|
||||
final GsonBuilder gsonBuilder = new GsonBuilder();
|
||||
final byte[] bytes = gsonBuilder.setPrettyPrinting().create().toJson(dump).getBytes(StandardCharsets.UTF_8);
|
||||
connection.setRequestProperty("Content-Length", Integer.toString(bytes.length));
|
||||
|
||||
final OutputStream out = connection.getOutputStream();
|
||||
out.write(bytes);
|
||||
out.write(gsonBuilder.disableHtmlEscaping().setPrettyPrinting().create().toJson(dump).getBytes(StandardCharsets.UTF_8));
|
||||
out.close();
|
||||
|
||||
if (connection.getResponseCode() == 503) {
|
||||
@@ -279,6 +278,12 @@ public abstract class MaintenancePlugin implements IMaintenance {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public String[] removeArrayIndex(final String[] args, final int index) {
|
||||
final List<String> argsList = Lists.newArrayList(args);
|
||||
argsList.remove(index);
|
||||
return argsList.toArray(new String[0]);
|
||||
}
|
||||
|
||||
public boolean isNumeric(final String string) {
|
||||
return string.matches("[0-9]+");
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class Settings implements ISettings {
|
||||
private static final int CURRENT_CONFIG_VERSION = 1;
|
||||
private static final int CURRENT_CONFIG_VERSION = 2;
|
||||
private static final Random RANDOM = new Random();
|
||||
protected final MaintenancePlugin plugin;
|
||||
private final Map<UUID, String> whitelistedPlayers = new HashMap<>();
|
||||
@@ -39,6 +39,7 @@ public class Settings implements ISettings {
|
||||
protected boolean maintenance;
|
||||
private Set<Integer> broadcastIntervals;
|
||||
private List<String> pingMessages;
|
||||
private List<String> timerSpecificPingMessages;
|
||||
private String playerCountMessage;
|
||||
private String playerCountHoverMessage;
|
||||
private String languageName;
|
||||
@@ -147,6 +148,8 @@ public class Settings implements ISettings {
|
||||
updateConfig();
|
||||
|
||||
pingMessages = config.getStringList("pingmessages");
|
||||
if (config.getBoolean("enable-timerspecific-messages"))
|
||||
timerSpecificPingMessages = config.getStringList("timerspecific-pingmessages");
|
||||
maintenance = config.getBoolean("maintenance-enabled");
|
||||
customPlayerCountMessage = config.getBoolean("enable-playercountmessage");
|
||||
customMaintenanceIcon = config.getBoolean("custom-maintenance-icon");
|
||||
@@ -323,8 +326,15 @@ public class Settings implements ISettings {
|
||||
}
|
||||
|
||||
public String getRandomPingMessage() {
|
||||
if (pingMessages.isEmpty()) return "";
|
||||
final String s = pingMessages.size() == 1 ? pingMessages.get(0) : pingMessages.get(RANDOM.nextInt(pingMessages.size()));
|
||||
if (plugin.isTaskRunning() && !plugin.getRunnable().shouldEnable()
|
||||
&& hasTimerSpecificPingMessages() && !timerSpecificPingMessages.isEmpty()) {
|
||||
return getPingMessage(timerSpecificPingMessages);
|
||||
}
|
||||
return pingMessages.isEmpty() ? "" : getPingMessage(pingMessages);
|
||||
}
|
||||
|
||||
private String getPingMessage(final List<String> list) {
|
||||
final String s = list.size() == 1 ? list.get(0) : list.get(RANDOM.nextInt(list.size()));
|
||||
return getColoredString(plugin.formatedTimer(s).replace("%NEWLINE%", "\n"));
|
||||
}
|
||||
|
||||
@@ -396,6 +406,10 @@ public class Settings implements ISettings {
|
||||
return saveEndtimerOnStop;
|
||||
}
|
||||
|
||||
public boolean hasTimerSpecificPingMessages() {
|
||||
return timerSpecificPingMessages != null;
|
||||
}
|
||||
|
||||
public long getSavedEndtimer() {
|
||||
return savedEndtimer;
|
||||
}
|
||||
@@ -415,6 +429,13 @@ public class Settings implements ISettings {
|
||||
return pingMessages;
|
||||
}
|
||||
|
||||
/**
|
||||
* May be null
|
||||
*/
|
||||
public List<String> getTimerSpecificPingMessages() {
|
||||
return timerSpecificPingMessages;
|
||||
}
|
||||
|
||||
public Set<Integer> getBroadcastIntervals() {
|
||||
return broadcastIntervals;
|
||||
}
|
||||
|
||||
+31
-4
@@ -22,22 +22,49 @@ import eu.kennytv.maintenance.core.MaintenancePlugin;
|
||||
import eu.kennytv.maintenance.core.command.CommandInfo;
|
||||
import eu.kennytv.maintenance.core.util.SenderInfo;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public final class MotdCommand extends CommandInfo {
|
||||
|
||||
public MotdCommand(final MaintenancePlugin plugin) {
|
||||
super(plugin, "motd", "§6/maintenance motd §7(Lists the currently set maintenance motds)");
|
||||
super(plugin, "motd", "§6/maintenance motd [timer] §7(Lists the currently set maintenance motds. If specifying 'timer', the timer motds are shown)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(final SenderInfo sender, final String[] args) {
|
||||
if (checkArgs(sender, args, 1)) return;
|
||||
if (args.length == 1) {
|
||||
sendList(sender, getSettings().getPingMessages());
|
||||
} else if (args.length == 2 && args[1].equalsIgnoreCase("timer")) {
|
||||
if (!getSettings().hasTimerSpecificPingMessages()) {
|
||||
sender.sendMessage(getMessage("timerMotdDisabled"));
|
||||
return;
|
||||
}
|
||||
|
||||
sendList(sender, getSettings().getTimerSpecificPingMessages());
|
||||
} else
|
||||
sender.sendMessage(helpMessage);
|
||||
}
|
||||
|
||||
private void sendList(final SenderInfo sender, final List<String> list) {
|
||||
if (list == null || list.isEmpty()) {
|
||||
sender.sendMessage(getMessage("motdListEmpty"));
|
||||
return;
|
||||
}
|
||||
|
||||
sender.sendMessage(getMessage("motdList"));
|
||||
for (int i = 0; i < getSettings().getPingMessages().size(); i++) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
sender.sendMessage("§b" + (i + 1) + "§8§m---------");
|
||||
for (final String motd : getSettings().getColoredString(getSettings().getPingMessages().get(i)).split("%NEWLINE%")) {
|
||||
for (final String motd : getSettings().getColoredString(list.get(i)).split("%NEWLINE%")) {
|
||||
sender.sendMessage(motd);
|
||||
}
|
||||
}
|
||||
sender.sendMessage("§8§m----------");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompletion(final SenderInfo sender, final String[] args) {
|
||||
if (args.length != 2 || !getSettings().hasTimerSpecificPingMessages()) return Collections.emptyList();
|
||||
return Collections.singletonList("timer");
|
||||
}
|
||||
}
|
||||
+27
-14
@@ -30,11 +30,21 @@ import java.util.List;
|
||||
public final class RemoveMotdCommand extends CommandInfo {
|
||||
|
||||
public RemoveMotdCommand(final MaintenancePlugin plugin) {
|
||||
super(plugin, "setmotd", "§6/maintenance removemotd <index> §7(Removes a maintenance motd)");
|
||||
super(plugin, "setmotd", "§6/maintenance removemotd [timer] <index> §7(Removes a maintenance motd. If using \"timer\" as an argument, a timerspecific pingmessage will be removed)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(final SenderInfo sender, final String[] args) {
|
||||
public void execute(final SenderInfo sender, String[] args) {
|
||||
boolean timerPingMessages = false;
|
||||
if (args.length == 3 && args[1].equalsIgnoreCase("timer")) {
|
||||
if (!getSettings().hasTimerSpecificPingMessages()) {
|
||||
sender.sendMessage(getMessage("timerMotdDisabled"));
|
||||
return;
|
||||
}
|
||||
|
||||
args = plugin.removeArrayIndex(args, 1);
|
||||
timerPingMessages = true;
|
||||
}
|
||||
if (checkArgs(sender, args, 2)) return;
|
||||
if (!plugin.isNumeric(args[1])) {
|
||||
sender.sendMessage(helpMessage);
|
||||
@@ -42,32 +52,35 @@ public final class RemoveMotdCommand extends CommandInfo {
|
||||
}
|
||||
|
||||
final Settings settings = getSettings();
|
||||
if (settings.getPingMessages().size() < 2) {
|
||||
final List<String> pingMessages = timerPingMessages ? settings.getTimerSpecificPingMessages() : settings.getPingMessages();
|
||||
if (pingMessages.size() < 2) {
|
||||
sender.sendMessage(getMessage("removeMotdError"));
|
||||
return;
|
||||
}
|
||||
|
||||
final int index = Integer.parseInt(args[1]);
|
||||
if (index == 0 || index > settings.getPingMessages().size()) {
|
||||
sender.sendMessage(getMessage("setMotdIndexError").replace("%MOTDS%", Integer.toString(settings.getPingMessages().size()))
|
||||
.replace("%NEWAMOUNT%", Integer.toString(settings.getPingMessages().size())));
|
||||
if (index == 0 || index > pingMessages.size()) {
|
||||
sender.sendMessage(getMessage("setMotdIndexError").replace("%MOTDS%", Integer.toString(pingMessages.size()))
|
||||
.replace("%NEWAMOUNT%", Integer.toString(pingMessages.size())));
|
||||
return;
|
||||
}
|
||||
|
||||
settings.getPingMessages().remove(index - 1);
|
||||
settings.getConfig().set("pingmessages", settings.getPingMessages());
|
||||
pingMessages.remove(index - 1);
|
||||
settings.getConfig().set(timerPingMessages ? "timerspecific-pingmessages" : "pingmessages", pingMessages);
|
||||
settings.saveConfig();
|
||||
sender.sendMessage(getMessage("removedMotd").replace("%INDEX%", args[1]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompletion(final SenderInfo sender, final String[] args) {
|
||||
if (args.length != 2) return Collections.emptyList();
|
||||
final int size = plugin.getSettings().getPingMessages().size();
|
||||
final List<String> list = new ArrayList<>(size);
|
||||
for (int i = 1; i <= size; i++) {
|
||||
list.add(String.valueOf(i));
|
||||
if (args.length == 2 || (args.length == 3 && args[1].equalsIgnoreCase("timer"))) {
|
||||
final int size = (args.length == 3 ? plugin.getSettings().getTimerSpecificPingMessages() : plugin.getSettings().getPingMessages()).size();
|
||||
final List<String> list = new ArrayList<>(size);
|
||||
for (int i = 1; i <= size; i++) {
|
||||
list.add(String.valueOf(i));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
+32
-14
@@ -31,21 +31,33 @@ import java.util.List;
|
||||
public final class SetMotdCommand extends CommandInfo {
|
||||
|
||||
public SetMotdCommand(final MaintenancePlugin plugin) {
|
||||
super(plugin, "setmotd", "§6/maintenance setmotd <index> <1/2> <message> §7(Sets a motd for maintenance mode)");
|
||||
super(plugin, "setmotd", "§6/maintenance setmotd [timer] <index> <1/2> <message> §7(Sets a motd for maintenance mode. If using \"timer\" as an argument, a timerspecific pingmessage will be set)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(final SenderInfo sender, final String[] args) {
|
||||
public void execute(final SenderInfo sender, String[] args) {
|
||||
boolean timerPingMessages = false;
|
||||
if (args.length > 1 && args[1].equalsIgnoreCase("timer")) {
|
||||
if (!getSettings().hasTimerSpecificPingMessages()) {
|
||||
sender.sendMessage(getMessage("timerMotdDisabled"));
|
||||
return;
|
||||
}
|
||||
|
||||
// remove the "timer" off the args to keep the rest the code cleaner
|
||||
args = plugin.removeArrayIndex(args, 1);
|
||||
timerPingMessages = true;
|
||||
}
|
||||
if (args.length < 4 || !plugin.isNumeric(args[1])) {
|
||||
sender.sendMessage(helpMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
final Settings settings = getSettings();
|
||||
final List<String> pingMessages = timerPingMessages ? settings.getTimerSpecificPingMessages() : settings.getPingMessages();
|
||||
final int index = Integer.parseInt(args[1]);
|
||||
if (index == 0 || index > settings.getPingMessages().size() + 1) {
|
||||
sender.sendMessage(getMessage("setMotdIndexError").replace("%MOTDS%", Integer.toString(settings.getPingMessages().size()))
|
||||
.replace("%NEWAMOUNT%", Integer.toString(settings.getPingMessages().size() + 1)));
|
||||
if (index == 0 || index > pingMessages.size() + 1) {
|
||||
sender.sendMessage(getMessage("setMotdIndexError").replace("%MOTDS%", Integer.toString(pingMessages.size()))
|
||||
.replace("%NEWAMOUNT%", Integer.toString(pingMessages.size() + 1)));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -61,31 +73,37 @@ public final class SetMotdCommand extends CommandInfo {
|
||||
}
|
||||
|
||||
final String message = String.join(" ", Arrays.copyOfRange(args, 3, args.length));
|
||||
final String oldMessage = index > settings.getPingMessages().size() ? "" : settings.getPingMessages().get(index - 1);
|
||||
final String oldMessage = index > pingMessages.size() ? "" : pingMessages.get(index - 1);
|
||||
final String newMessage;
|
||||
if (line == 1)
|
||||
if (line == 1) {
|
||||
newMessage = oldMessage.contains("%NEWLINE%") ?
|
||||
message + "%NEWLINE%" + oldMessage.split("%NEWLINE%", 2)[1] : message;
|
||||
else
|
||||
} else {
|
||||
newMessage = oldMessage.contains("%NEWLINE%") ?
|
||||
oldMessage.split("%NEWLINE%", 2)[0] + "%NEWLINE%" + message : oldMessage + "%NEWLINE%" + message;
|
||||
}
|
||||
|
||||
if (index > settings.getPingMessages().size())
|
||||
settings.getPingMessages().add(newMessage);
|
||||
if (index > pingMessages.size())
|
||||
pingMessages.add(newMessage);
|
||||
else
|
||||
settings.getPingMessages().set(index - 1, newMessage);
|
||||
settings.getConfig().set("pingmessages", settings.getPingMessages());
|
||||
pingMessages.set(index - 1, newMessage);
|
||||
settings.getConfig().set(timerPingMessages ? "timerspecific-pingmessages" : "pingmessages", pingMessages);
|
||||
settings.saveConfig();
|
||||
sender.sendMessage(settings.getMessage("setMotd").replace("%LINE%", args[2]).replace("%INDEX%", args[1])
|
||||
.replace("%MOTD%", "§f" + settings.getColoredString(message)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompletion(final SenderInfo sender, final String[] args) {
|
||||
public List<String> getTabCompletion(final SenderInfo sender, String[] args) {
|
||||
boolean timer = false;
|
||||
if (args.length > 1 && args[1].equalsIgnoreCase("timer")) {
|
||||
args = plugin.removeArrayIndex(args, 1);
|
||||
timer = true;
|
||||
}
|
||||
if (args.length == 3) return Arrays.asList("1", "2");
|
||||
if (args.length == 2) {
|
||||
final List<String> list = new ArrayList<>();
|
||||
for (int i = 1; i <= getSettings().getPingMessages().size() + 1; i++) {
|
||||
for (int i = 1; i <= (timer ? getSettings().getTimerSpecificPingMessages() : getSettings().getPingMessages()).size() + 1; i++) {
|
||||
list.add(String.valueOf(i));
|
||||
}
|
||||
return list;
|
||||
|
||||
@@ -9,9 +9,6 @@
|
||||
# You can report bugs here: https://github.com/KennyTV/Maintenance/issues
|
||||
# If you need any other help/support, you can also join my Discord server: https://discord.gg/vGCUzHq
|
||||
|
||||
# Used for autoupdating the config, do not change this value.
|
||||
config-version: 1
|
||||
|
||||
# Enables maintenance mode.
|
||||
maintenance-enabled: false
|
||||
|
||||
@@ -32,6 +29,13 @@ pingmessages:
|
||||
- "&cMaintenance mode!%NEWLINE%&6We will be back soon!"
|
||||
# - "Other entry"
|
||||
|
||||
# If set to true and an endtimer is currently running, a pingmessage from this pool will be chosen
|
||||
# instead of the ones above, so you can have different messages for when an endtimer is running/not running.
|
||||
enable-timerspecific-messages: false
|
||||
timerspecific-pingmessages:
|
||||
- "&cMaintenance mode!%NEWLINE%&6We will be back in %TIMER%!"
|
||||
# - "Other entry"
|
||||
|
||||
# If set to true, the message below will be shown at the top right corner of the server in the serverlist, where the playercount would normally be displayed.
|
||||
# If set to false, the normal playercount will be shown.
|
||||
#
|
||||
@@ -70,9 +74,6 @@ mysql:
|
||||
# (0 is not recommended if having more than a hundred concurrent players, then I'd recommend keeping it from 10-60).
|
||||
update-interval: 15
|
||||
|
||||
# If using the timer command: In what intervalls before enabling/disabling maintenance there will be a broadcast.
|
||||
timer-broadcast-for-seconds: [1200, 900, 600, 300, 120, 60, 30, 20, 10, 5, 4, 3, 2, 1]
|
||||
|
||||
# If enabled and the server is restarted while running an endtimer, the timer will be continued after the restart.
|
||||
# If the timer ends while the server is offline, maintenance will be disabled as soon as the server starts again.
|
||||
continue-endtimer-after-restart:
|
||||
@@ -81,7 +82,13 @@ continue-endtimer-after-restart:
|
||||
# Do not manually change this value.
|
||||
end: 0
|
||||
|
||||
# If using the timer command: In what intervalls before enabling/disabling maintenance there will be a broadcast.
|
||||
timer-broadcast-for-seconds: [1200, 900, 600, 300, 120, 60, 30, 20, 10, 5, 4, 3, 2, 1]
|
||||
|
||||
# If disabled, you will no longer receive any messages if there is an update.
|
||||
# Not recommended to disable, as new versions generally tend to run better and with less bugs.
|
||||
# However, you can always check for updates manually using the '/maintenance update' command.
|
||||
update-checks: true
|
||||
update-checks: true
|
||||
|
||||
# Used for autoupdating the config, do not change this value.
|
||||
config-version: 2
|
||||
@@ -16,10 +16,12 @@ timerAlreadyRunning: "&8[&eMaintenance&8] &cMomentan läuft bereits ein Timer!"
|
||||
timerNotRunning: "&8[&eMaintenance&8] &cMomentan läuft kein Timer."
|
||||
timerCancelled: "&8[&eMaintenance&8] &cDer laufende Timer wurde beendet."
|
||||
timerTooLong: "&8[&eMaintenance&8] &cDie angegebene Nummer muss kleiner als 40320 sein (= 28 Tage)!"
|
||||
timerMotdDisabled: "&8[&eMaintenance&8] &cDu musst 'enable-timerspecific-messages' in der Config auf 'true' stellen, wenn du timerspezifische Motds benutzen/editieren möchtest."
|
||||
motdTimer: "%HOURS%:%MINUTES%:%SECONDS%"
|
||||
motdTimerNotRunning: "-"
|
||||
joinNotification: "&8[&eMaintenance&8] &e%PLAYER% &chat versucht den Server beizutreten."
|
||||
motdList: "&8[&eMaintenance&8] &7Liste der Maintenance MOTDs:"
|
||||
motdListEmpty: "8[&eMaintenance&8] &cDu hast keine Maintenance MOTDs gesetzt!"
|
||||
reload: "&8[&eMaintenance&8] &aConfig, WhitelistedPlayers, Language Datei und Maintenance Icon wurden neugeladen."
|
||||
removedMotd: "&8[&eMaintenance&8] &aDie %INDEX%. Maintenance MOTD wurde entfernt."
|
||||
removeMotdError: "&8[&eMaintenance&8] &cDu hast nur eine Maintenance MOTD, daher kannst du auch keine entfernen!"
|
||||
|
||||
@@ -16,10 +16,12 @@ timerAlreadyRunning: "&8[&eMaintenance&8] &cThere is already a timer scheduled!"
|
||||
timerNotRunning: "&8[&eMaintenance&8] &cThere is currently no running timer."
|
||||
timerCancelled: "&8[&eMaintenance&8] &cThe current timer has been disabled."
|
||||
timerTooLong: "&8[&eMaintenance&8] &cThe number has to be less than 40320 (28 days)!"
|
||||
timerMotdDisabled: "&8[&eMaintenance&8] &cYou have to set 'enable-timerspecific-messages' in the config to 'true', if you want to use/edit timerspecific motds."
|
||||
motdTimer: "%HOURS%:%MINUTES%:%SECONDS%"
|
||||
motdTimerNotRunning: "-"
|
||||
joinNotification: "&8[&eMaintenance&8] &e%PLAYER% &ctried to join the server."
|
||||
motdList: "&8[&eMaintenance&8] &7List of your maintenance motds:"
|
||||
motdListEmpty: "8[&eMaintenance&8] &cYou don't have any maintenance motds set!"
|
||||
reload: "&8[&eMaintenance&8] &aReloaded config, whitelistedplayers, language file and the maintenance icon."
|
||||
removedMotd: "&8[&eMaintenance&8] &aRemoved motd number %INDEX%."
|
||||
removeMotdError: "&8[&eMaintenance&8] &cYou only have one motd, so you cannot remove any!"
|
||||
|
||||
@@ -16,10 +16,12 @@ timerAlreadyRunning: "&8[&eMaintenance&8] &7Ya hay un temporizador programado!"
|
||||
timerNotRunning: "&8[&eMaintenance&8] &7Actualmente no hay temporizador."
|
||||
timerCancelled: "&8[&eMaintenance&8] &cEl Temporizador actual ha sido deshabilitado."
|
||||
timerTooLong: "&8[&eMaintenance&8] &7El numero debe ser menor a 40320 &6(28 dias)"
|
||||
timerMotdDisabled: "&8[&eMaintenance&8] &cYou have to set 'enable-timerspecific-messages' in the config to 'true', if you want to use/edit timerspecific motds."
|
||||
motdTimer: "%HOURS%:%MINUTES%:%SECONDS%"
|
||||
motdTimerNotRunning: "-"
|
||||
joinNotification: "&8[&eMaintenance&8] &c%PLAYER% &7Intenta unirse al servidor."
|
||||
motdList: "&8[&eMaintenance&8] &7Lista de motds de &6Mantenimiento&7:"
|
||||
motdListEmpty: "8[&eMaintenance&8] &cYou don't have any maintenance motds set!"
|
||||
reload: "&8[&eMaintenance&8] &aConfiguracion Recargada"
|
||||
removedMotd: "&8[&eMaintenance&8] &aNumero de Motd eliminado &6%INDEX%."
|
||||
removeMotdError: "&8[&eMaintenance&8] &Solo tienes un Motd, por lo que no puedes eliminar ninguno!"
|
||||
|
||||
@@ -16,10 +16,12 @@ timerAlreadyRunning: "&8[&eMaintenance&8] &cIl y a déjà un horaire prévu!"
|
||||
timerNotRunning: "&8[&eMaintenance&8] &cIl n'y a actuellement aucune maintenance prévue."
|
||||
timerCancelled: "&8[&eMaintenance&8] &cLa minuterie actuelle a été désactivée."
|
||||
timerTooLong: "&8[&eMaintenance&8] &cLe nombre doit être inférieur à 40320 (28 jours)!"
|
||||
timerMotdDisabled: "&8[&eMaintenance&8] &c'enable-timerspecific-messages' dans la config doit être 'true' si vous voulez des motd minuterie spéficique."
|
||||
motdTimer: "%HOURS%:%MINUTES%:%SECONDS%"
|
||||
motdTimerNotRunning: "-"
|
||||
joinNotification: "&8[&eMaintenance&8] &e%PLAYER% &ca essayé de rejoindre le serveur."
|
||||
motdList: "&8[&eMaintenance&8] &7Liste de vos motd pour la maintenance:"
|
||||
motdListEmpty: "8[&eMaintenance&8] &cVous n'avez pas ajoutéz de motd pour la maintenance!"
|
||||
reload: "&8[&eMaintenance&8] &afichier config, liste blanche (whitelist) joueurs, fichier de langue et l'icône de maintenance, recharger."
|
||||
removedMotd: "&8[&eMaintenance&8] &aNuméro de motd supprimé %INDEX%."
|
||||
removeMotdError: "&8[&eMaintenance&8] &cVous n’avez qu’un motd, vous ne pouvez donc en supprimer!"
|
||||
|
||||
@@ -16,10 +16,12 @@ timerAlreadyRunning: "&8[&cManutencao&8] &cO Timer ja esta a decorrer!"
|
||||
timerNotRunning: "&8[&cManutencao&8] &cO Timer nao esta a decorrer!"
|
||||
timerCancelled: "&8[&cManutencao&8] &cO Timer foi cancelado!"
|
||||
timerTooLong: "&8[&cManutencao&8] &cO numero tem de ser menor que 40320 (28 dias)!"
|
||||
timerMotdDisabled: "&8[&eMaintenance&8] &cYou have to set 'enable-timerspecific-messages' in the config to 'true', if you want to use/edit timerspecific motds."
|
||||
motdTimer: "%HOURS%:%MINUTES%:%SECONDS%"
|
||||
motdTimerNotRunning: "-"
|
||||
joinNotification: "&8[&cManutencao&8] &e%PLAYER% &ctentou entrar no servidor."
|
||||
motdList: "&8[&cManutencao&8] &7Lista de motds de manutencao:"
|
||||
motdListEmpty: "8[&eMaintenance&8] &cYou don't have any maintenance motds set!"
|
||||
reload: "&8[&cManutencao&8] &aReloaded config, whitelistedplayers, linguagem e icon de manutencao."
|
||||
removedMotd: "&8[&cManutencao&8] &aRemovida motd numero %INDEX%."
|
||||
removeMotdError: "&8[&cManutencao&8] &cSo tens uma motd, entao nao podes remover esta!"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.kennytv.maintenance</groupId>
|
||||
<artifactId>maintenance-parent</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<version>3.0.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>maintenance-spigot</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.kennytv.maintenance</groupId>
|
||||
<artifactId>maintenance-parent</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<version>3.0.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>maintenance-sponge</artifactId>
|
||||
|
||||
+2
-1
@@ -37,6 +37,7 @@ import eu.kennytv.maintenance.sponge.util.SpongeOfflinePlayerInfo;
|
||||
import eu.kennytv.maintenance.sponge.util.SpongeSenderInfo;
|
||||
import eu.kennytv.maintenance.sponge.util.SpongeTask;
|
||||
import org.spongepowered.api.Game;
|
||||
import org.spongepowered.api.Platform;
|
||||
import org.spongepowered.api.Server;
|
||||
import org.spongepowered.api.command.CommandSource;
|
||||
import org.spongepowered.api.config.ConfigDir;
|
||||
@@ -208,7 +209,7 @@ public final class MaintenanceSpongePlugin extends MaintenancePlugin {
|
||||
|
||||
@Override
|
||||
public String getServerVersion() {
|
||||
return game.getPlatform().getImplementation().getName();
|
||||
return game.getPlatform().getContainer(Platform.Component.IMPLEMENTATION).getVersion().orElse("woop wooop");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.kennytv.maintenance</groupId>
|
||||
<artifactId>maintenance-parent</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<version>3.0.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>maintenance-velocity</artifactId>
|
||||
@@ -29,7 +29,7 @@
|
||||
<dependency>
|
||||
<groupId>com.velocitypowered</groupId>
|
||||
<artifactId>velocity-api</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
+6
-5
@@ -55,7 +55,7 @@ import eu.kennytv.maintenance.velocity.util.VelocityTask;
|
||||
import net.kyori.text.TextComponent;
|
||||
import net.kyori.text.event.ClickEvent;
|
||||
import net.kyori.text.event.HoverEvent;
|
||||
import net.kyori.text.serializer.ComponentSerializers;
|
||||
import net.kyori.text.serializer.legacy.LegacyComponentSerializer;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.io.File;
|
||||
@@ -131,8 +131,8 @@ public final class MaintenanceVelocityPlugin extends MaintenanceProxyPlugin {
|
||||
final TextComponent tc1 = translate(getPrefix());
|
||||
final TextComponent tc2 = translate("§cDownload it at: §6https://www.spigotmc.org/resources/maintenance.40699/");
|
||||
final TextComponent click = translate(" §7§l§o(CLICK ME)");
|
||||
click.clickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://www.spigotmc.org/resources/maintenance.40699/"));
|
||||
click.hoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.of("§aDownload the latest version")));
|
||||
click.clickEvent(ClickEvent.openUrl("https://www.spigotmc.org/resources/maintenance.40699/"));
|
||||
click.hoverEvent(HoverEvent.showText(TextComponent.of("§aDownload the latest version")));
|
||||
tc1.append(tc2);
|
||||
tc1.append(click);
|
||||
((VelocitySenderInfo) sender).sendMessage(tc1);
|
||||
@@ -195,7 +195,8 @@ public final class MaintenanceVelocityPlugin extends MaintenanceProxyPlugin {
|
||||
@Override
|
||||
public String getServer(final SenderInfo sender) {
|
||||
final Optional<Player> player = server.getPlayer(sender.getUuid());
|
||||
return player.map(p -> p.getCurrentServer().get().getServerInfo().getName()).orElse("");
|
||||
if (!player.isPresent() || player.get().getCurrentServer().isPresent()) return "";
|
||||
return player.get().getCurrentServer().get().getServerInfo().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -261,6 +262,6 @@ public final class MaintenanceVelocityPlugin extends MaintenanceProxyPlugin {
|
||||
}
|
||||
|
||||
public TextComponent translate(final String s) {
|
||||
return ComponentSerializers.LEGACY.deserialize(s);
|
||||
return LegacyComponentSerializer.INSTANCE.deserialize(s);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -61,8 +61,8 @@ public final class MaintenanceVelocityCommand extends MaintenanceProxyCommand im
|
||||
@Override
|
||||
protected void sendUpdateMessage(final SenderInfo sender) {
|
||||
final TextComponent tc = TextComponent.builder("").append(plugin.translate("§6× §8[§aUpdate§8]"))
|
||||
.clickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/maintenance forceupdate"))
|
||||
.hoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, plugin.translate("§aClick here to update the plugin")))
|
||||
.clickEvent(ClickEvent.runCommand("/maintenance forceupdate"))
|
||||
.hoverEvent(HoverEvent.showText(plugin.translate("§aClick here to update the plugin")))
|
||||
.append(plugin.translate(" §8(§7Or use the command §c/maintenance forceupdate§8)")).build();
|
||||
((VelocitySenderInfo) sender).sendMessage(tc);
|
||||
}
|
||||
@@ -70,8 +70,8 @@ public final class MaintenanceVelocityCommand extends MaintenanceProxyCommand im
|
||||
@Override
|
||||
public void sendDumpMessage(final SenderInfo sender, final String url) {
|
||||
final TextComponent clickText = TextComponent.builder("").append(plugin.translate(plugin.getPrefix() + "§7Click here to copy the link."))
|
||||
.clickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, url))
|
||||
.hoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, plugin.translate("§aClick here to copy the link"))).build();
|
||||
.clickEvent(ClickEvent.suggestCommand(url))
|
||||
.hoverEvent(HoverEvent.showText(plugin.translate("§aClick here to copy the link"))).build();
|
||||
((VelocitySenderInfo) sender).sendMessage(clickText);
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -43,6 +43,8 @@ public final class ServerConnectListener implements EventHandler<ServerPreConnec
|
||||
if (!event.getResult().isAllowed()) return;
|
||||
|
||||
final Player player = event.getPlayer();
|
||||
if (!event.getResult().getServer().isPresent()) return;
|
||||
|
||||
final RegisteredServer target = event.getResult().getServer().get();
|
||||
if (!plugin.isMaintenance(target)) return;
|
||||
if (plugin.hasPermission(player, "bypass") || settings.getWhitelistedPlayers().containsKey(player.getUniqueId())) return;
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import eu.kennytv.maintenance.core.util.SenderInfo;
|
||||
import net.kyori.text.TextComponent;
|
||||
import net.kyori.text.serializer.ComponentSerializers;
|
||||
import net.kyori.text.serializer.legacy.LegacyComponentSerializer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -50,7 +50,7 @@ public final class VelocitySenderInfo implements SenderInfo {
|
||||
|
||||
@Override
|
||||
public void sendMessage(final String message) {
|
||||
sender.sendMessage(ComponentSerializers.LEGACY.deserialize(message));
|
||||
sender.sendMessage(LegacyComponentSerializer.INSTANCE.deserialize(message));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@ package eu.kennytv.maintenance.velocity.util;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import eu.kennytv.maintenance.api.proxy.Server;
|
||||
import net.kyori.text.TextComponent;
|
||||
import net.kyori.text.serializer.ComponentSerializers;
|
||||
import net.kyori.text.serializer.legacy.LegacyComponentSerializer;
|
||||
|
||||
public final class VelocityServer implements Server {
|
||||
private final RegisteredServer server;
|
||||
@@ -42,7 +42,7 @@ public final class VelocityServer implements Server {
|
||||
|
||||
@Override
|
||||
public void broadcast(final String message) {
|
||||
final TextComponent s = ComponentSerializers.LEGACY.deserialize(message);
|
||||
final TextComponent s = LegacyComponentSerializer.INSTANCE.deserialize(message);
|
||||
server.getPlayersConnected().forEach(p -> p.sendMessage(s));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user