mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2024-11-14 10:45:23 +01:00
Fix typo
This commit is contained in:
parent
6d6482374c
commit
b2fd938c00
@ -123,12 +123,12 @@ Database:
|
|||||||
# Settings controlling the cache behavior of the plugin. You may optimize it a little depending on your player count, ram or cpu bottlenecks.
|
# Settings controlling the cache behavior of the plugin. You may optimize it a little depending on your player count, ram or cpu bottlenecks.
|
||||||
Cache:
|
Cache:
|
||||||
UnCache:
|
UnCache:
|
||||||
# The strategie used to uncache offline players. Options
|
# The strategy used to uncache offline players. Options
|
||||||
# interval (offline players get uncached every x seconds)
|
# interval (offline players get uncached every x seconds)
|
||||||
# intervalChecked (like interval, but also ensures that the player is already offline for at least the interval time, adds a cpu overhead)
|
# intervalChecked (like interval, but also ensures that the player is already offline for at least the interval time, adds a cpu overhead)
|
||||||
# ondisconnect (player instantly gets uncached as soon as he disconnects, may adds overhead if other plugins try to access the player data when they go offline, also it may be problematic for players with unstable connections)
|
# ondisconnect (player instantly gets uncached as soon as he disconnects, may adds overhead if other plugins try to access the player data when they go offline, also it may be problematic for players with unstable connections)
|
||||||
# ondisconnectdelayed (player gets uncached x seconds after he went offline, adds overhead on disconnect, you shouldn't use this with a lot of players joining and leaving.)
|
# ondisconnectdelayed (player gets uncached x seconds after he went offline, adds overhead on disconnect, you shouldn't use this with a lot of players joining and leaving.)
|
||||||
Strategie: interval
|
Strategy: interval
|
||||||
# Used for the interval based uncaching algorithms, and is also used as delay for ondisconnectdelayed. Value in seconds. Default: 600 = 10 minutes
|
# Used for the interval based uncaching algorithms, and is also used as delay for ondisconnectdelayed. Value in seconds. Default: 600 = 10 minutes
|
||||||
Interval: 600
|
Interval: 600
|
||||||
Delay: 600
|
Delay: 600
|
||||||
|
@ -70,6 +70,7 @@ protected void doUpgrade(@NotNull YamlFileManager oldConfig)
|
|||||||
remappedKeys.put("WorldSettings.FilteredWorlds", "WorldSettings.Blacklist");
|
remappedKeys.put("WorldSettings.FilteredWorlds", "WorldSettings.Blacklist");
|
||||||
remappedKeys.put("WorldSettings.BockMode", "WorldSettings.BlacklistMode");
|
remappedKeys.put("WorldSettings.BockMode", "WorldSettings.BlacklistMode");
|
||||||
}
|
}
|
||||||
|
if(oldConfig.getVersion().olderOrEqualThan(new Version(33))) remappedKeys.put("Database.Cache.UnCache.Strategy", "Database.Cache.UnCache.Strategie");
|
||||||
Collection<String> keysToKeep = oldConfig.getYamlE().getKeysFiltered("Database\\.SQL\\.(MaxLifetime|IdleTimeout)");
|
Collection<String> keysToKeep = oldConfig.getYamlE().getKeysFiltered("Database\\.SQL\\.(MaxLifetime|IdleTimeout)");
|
||||||
keysToKeep.addAll(oldConfig.getYamlE().getKeysFiltered("Database\\.Tables\\.Fields\\..+"));
|
keysToKeep.addAll(oldConfig.getYamlE().getKeysFiltered("Database\\.Tables\\.Fields\\..+"));
|
||||||
doUpgrade(oldConfig, remappedKeys, keysToKeep);
|
doUpgrade(oldConfig, remappedKeys, keysToKeep);
|
||||||
@ -151,9 +152,9 @@ public boolean isForceSaveOnUnloadEnabled()
|
|||||||
return getConfigE().getBoolean("Database.ForceSaveOnUnload", false);
|
return getConfigE().getBoolean("Database.ForceSaveOnUnload", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUnCacheStrategie()
|
public String getUnCacheStrategy()
|
||||||
{
|
{
|
||||||
return getConfigE().getString("Database.Cache.UnCache.Strategie", "interval").toLowerCase(Locale.ENGLISH);
|
return getConfigE().getString("Database.Cache.UnCache.Strategy", "interval").toLowerCase(Locale.ENGLISH);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getUnCacheInterval()
|
public long getUnCacheInterval()
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.Callback;
|
import at.pcgamingfreaks.Minepacks.Bukkit.API.Callback;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Backpack;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Backpack;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Database.UnCacheStrategies.OnDisconnect;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Database.UnCacheStrategies.OnDisconnect;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Database.UnCacheStrategies.UnCacheStrategie;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Database.UnCacheStrategies.UnCacheStrategy;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
||||||
|
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
@ -54,7 +54,7 @@ public abstract class Database implements Listener
|
|||||||
protected boolean useUUIDSeparators, asyncSave = true;
|
protected boolean useUUIDSeparators, asyncSave = true;
|
||||||
protected long maxAge;
|
protected long maxAge;
|
||||||
private final Map<OfflinePlayer, Backpack> backpacks = new ConcurrentHashMap<>();
|
private final Map<OfflinePlayer, Backpack> backpacks = new ConcurrentHashMap<>();
|
||||||
private final UnCacheStrategie unCacheStrategie;
|
private final UnCacheStrategy unCacheStrategie;
|
||||||
private final File backupFolder;
|
private final File backupFolder;
|
||||||
|
|
||||||
public Database(Minepacks mp)
|
public Database(Minepacks mp)
|
||||||
@ -66,7 +66,7 @@ public Database(Minepacks mp)
|
|||||||
bungeeCordMode = plugin.getConfiguration().isBungeeCordModeEnabled();
|
bungeeCordMode = plugin.getConfiguration().isBungeeCordModeEnabled();
|
||||||
forceSaveOnUnload = plugin.getConfiguration().isForceSaveOnUnloadEnabled();
|
forceSaveOnUnload = plugin.getConfiguration().isForceSaveOnUnloadEnabled();
|
||||||
maxAge = plugin.getConfiguration().getAutoCleanupMaxInactiveDays();
|
maxAge = plugin.getConfiguration().getAutoCleanupMaxInactiveDays();
|
||||||
unCacheStrategie = bungeeCordMode ? new OnDisconnect(this) : UnCacheStrategie.getUnCacheStrategie(this);
|
unCacheStrategie = bungeeCordMode ? new OnDisconnect(this) : UnCacheStrategy.getUnCacheStrategie(this);
|
||||||
backupFolder = new File(this.plugin.getDataFolder(), "backups");
|
backupFolder = new File(this.plugin.getDataFolder(), "backups");
|
||||||
if(!backupFolder.exists() && !backupFolder.mkdirs()) mp.getLogger().info("Failed to create backups folder.");
|
if(!backupFolder.exists() && !backupFolder.mkdirs()) mp.getLogger().info("Failed to create backups folder.");
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2016 GeorgH93
|
* Copyright (C) 2023 GeorgH93
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
public class Interval extends UnCacheStrategie implements Runnable
|
public class Interval extends UnCacheStrategy implements Runnable
|
||||||
{
|
{
|
||||||
private final int taskID;
|
private final int taskID;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
public class IntervalChecked extends UnCacheStrategie implements Runnable
|
public class IntervalChecked extends UnCacheStrategy implements Runnable
|
||||||
{
|
{
|
||||||
private final long delay;
|
private final long delay;
|
||||||
private final int taskID;
|
private final int taskID;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2016 GeorgH93
|
* Copyright (C) 2023 GeorgH93
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -28,7 +28,7 @@
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
public class OnDisconnect extends UnCacheStrategie implements Listener
|
public class OnDisconnect extends UnCacheStrategy implements Listener
|
||||||
{
|
{
|
||||||
public OnDisconnect(Database cache)
|
public OnDisconnect(Database cache)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2016 GeorgH93
|
* Copyright (C) 2023 GeorgH93
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -29,7 +29,7 @@
|
|||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
public class OnDisconnectDelayed extends UnCacheStrategie implements Listener
|
public class OnDisconnectDelayed extends UnCacheStrategy implements Listener
|
||||||
{
|
{
|
||||||
private final long delay;
|
private final long delay;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2016 GeorgH93
|
* Copyright (C) 2023 GeorgH93
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -20,18 +20,18 @@
|
|||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Database;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Database;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
||||||
|
|
||||||
public abstract class UnCacheStrategie
|
public abstract class UnCacheStrategy
|
||||||
{
|
{
|
||||||
protected Database cache;
|
protected Database cache;
|
||||||
|
|
||||||
public UnCacheStrategie(Database cache)
|
public UnCacheStrategy(Database cache)
|
||||||
{
|
{
|
||||||
this.cache = cache;
|
this.cache = cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UnCacheStrategie getUnCacheStrategie(Database cache)
|
public static UnCacheStrategy getUnCacheStrategie(Database cache)
|
||||||
{
|
{
|
||||||
switch(Minepacks.getInstance().getConfiguration().getUnCacheStrategie())
|
switch(Minepacks.getInstance().getConfiguration().getUnCacheStrategy())
|
||||||
{
|
{
|
||||||
case "ondisconnect": return new OnDisconnect(cache);
|
case "ondisconnect": return new OnDisconnect(cache);
|
||||||
case "ondisconnectdelayed": return new OnDisconnectDelayed(cache);
|
case "ondisconnectdelayed": return new OnDisconnectDelayed(cache);
|
2
pom.xml
2
pom.xml
@ -7,7 +7,7 @@
|
|||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<revision>2.4.19</revision>
|
<revision>2.4.20-SNAPSHOT</revision>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user