Various code simplification/fixes and a lot of typo/grammar fixes (may brake some stuff)
This commit is contained in:
@@ -6,10 +6,11 @@ import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@SuppressWarnings("CanBeFinal")
|
||||
public class BungeeBackupConfig {
|
||||
public boolean workdirBackupEnabled = true;
|
||||
public boolean logsBackupEnabled = true;
|
||||
public String scheduling = "0 2 * * *"; // cron format, here is everyday at 2am
|
||||
public String scheduling = "0 2 * * *"; // cron format, here is every day at 2am
|
||||
public File backupDirectory = null;
|
||||
public BackupCleaner workdirBackupCleaner = BackupCleaner.KEEPING_1_EVERY_N_MONTH(3).merge(BackupCleaner.KEEPING_N_LAST(5));
|
||||
public List<String> workdirIgnoreList = new ArrayList<>();
|
||||
|
@@ -18,15 +18,12 @@ public class BungeeWorkdirProcess extends BackupProcess {
|
||||
|
||||
|
||||
public BiPredicate<File, String> getFilenameFilter() {
|
||||
return new BiPredicate<>() {
|
||||
@Override
|
||||
public boolean test(File file, String path) {
|
||||
if (new File(getSourceDir(), "logs").equals(file))
|
||||
return false;
|
||||
if (file.isFile() && file.getName().endsWith(".lck"))
|
||||
return false;
|
||||
return BungeeWorkdirProcess.super.getFilenameFilter().test(file, path);
|
||||
}
|
||||
return (file, path) -> {
|
||||
if (new File(getSourceDir(), "logs").equals(file))
|
||||
return false;
|
||||
if (file.isFile() && file.getName().endsWith(".lck"))
|
||||
return false;
|
||||
return BungeeWorkdirProcess.super.getFilenameFilter().test(file, path);
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -28,10 +28,10 @@ public abstract class BungeeBrigadierCommand extends BrigadierCommand<CommandSen
|
||||
/**
|
||||
* The command dispatcher.
|
||||
*/
|
||||
protected BungeeBrigadierDispatcher dispatcher = BungeeBrigadierDispatcher.getInstance();
|
||||
protected final BungeeBrigadierDispatcher dispatcher = BungeeBrigadierDispatcher.getInstance();
|
||||
|
||||
/**
|
||||
* Instanciate this command instance.
|
||||
* Instantiate this command instance.
|
||||
*/
|
||||
public BungeeBrigadierCommand() {
|
||||
LiteralCommandNode<CommandSender> commandNode;
|
||||
|
@@ -39,7 +39,7 @@ public class BungeeBrigadierDispatcher extends BrigadierDispatcher<CommandSender
|
||||
*/
|
||||
public BungeeBrigadierDispatcher(Plugin pl) {
|
||||
if (instance != null)
|
||||
throw new IllegalStateException("Cannot instanciante more than one BungeeBrigadierDispatcher");
|
||||
throw new IllegalStateException("Cannot instantiate more than one BungeeBrigadierDispatcher");
|
||||
instance = this;
|
||||
plugin = pl;
|
||||
ProxyServer.getInstance().getPluginManager().registerListener(plugin, this);
|
||||
@@ -47,7 +47,7 @@ public class BungeeBrigadierDispatcher extends BrigadierDispatcher<CommandSender
|
||||
|
||||
|
||||
/**
|
||||
* Called when a player sends a chat message. Used to gets the typed command and execute it.
|
||||
* Called when a player sends a chat message. Used to get the typed command and execute it.
|
||||
* @param event the event.
|
||||
*/
|
||||
@EventHandler
|
||||
|
@@ -4,7 +4,6 @@ import fr.pandacube.lib.chat.Chat;
|
||||
import fr.pandacube.lib.core.mc_version.ProtocolVersion;
|
||||
import fr.pandacube.lib.players.standalone.AbstractOnlinePlayer;
|
||||
import fr.pandacube.lib.reflect.Reflect;
|
||||
import fr.pandacube.lib.util.MinecraftVersion;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.ByteBufAllocator;
|
||||
import net.kyori.adventure.text.Component;
|
||||
@@ -49,16 +48,6 @@ public interface BungeeOnlinePlayer extends BungeeOffPlayer, AbstractOnlinePlaye
|
||||
return getBungeeProxiedPlayer().getServer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the minecraft version of this player’s client.
|
||||
* @return the minecraft version of this player’s client.
|
||||
* @deprecated use {@link #getProtocolVersion()} instead.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
default MinecraftVersion getMinecraftVersion() {
|
||||
return MinecraftVersion.getVersion(getBungeeProxiedPlayer().getPendingConnection().getVersion());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the protocol version of this player’s client.
|
||||
* @return the protocol version of this player’s client.
|
||||
|
@@ -9,7 +9,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.LogRecord;
|
||||
|
||||
/**
|
||||
* A log rotate that extends the functionnalities of {@link DailyLogRotateFileHandler}
|
||||
* A log rotate that extends the functionalities of {@link DailyLogRotateFileHandler}
|
||||
* to adapt with bungee specificities.
|
||||
*/
|
||||
public class BungeeDailyLogRotateFileHandler extends DailyLogRotateFileHandler {
|
||||
@@ -35,9 +35,10 @@ public class BungeeDailyLogRotateFileHandler extends DailyLogRotateFileHandler {
|
||||
@Override
|
||||
public boolean isLoggable(LogRecord record) {
|
||||
String formattedRecord = getFormatter().format(record);
|
||||
if (formattedRecord.contains("<-> InitialHandler has connected")) return false;
|
||||
if (formattedRecord.contains("<-> InitialHandler has pinged")) return false;
|
||||
return true;
|
||||
return !(
|
||||
formattedRecord.contains("<-> InitialHandler has connected")
|
||||
|| formattedRecord.contains("<-> InitialHandler has pinged")
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user