diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Config.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Config.java
index 3fd4880..9119048 100644
--- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Config.java
+++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Config.java
@@ -38,13 +38,17 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import lombok.Getter;
+
import java.io.FileNotFoundException;
import java.util.*;
import java.util.stream.Collectors;
public class Config extends Configuration implements DatabaseConnectionConfiguration, IUnCacheStrategyConfig, ILanguageConfiguration
{
- private static final int CONFIG_VERSION = 36, PRE_V2_VERSION = 20;
+ private static final int CONFIG_VERSION = 36, PRE_V2_VERSION = 20, PRE_V3_VERSION = 40;
+
+ @Getter private boolean updatedToV3 = false;
public Config(final @NotNull JavaPlugin plugin)
{
@@ -101,6 +105,7 @@ protected void doUpgrade(@NotNull YamlFileManager oldConfig)
//keysToKeep.addAll(oldConfig.getYamlE().getKeysFiltered("Database\\.Tables\\.Fields\\..+"));
doUpgrade(oldConfig, remappedKeys, keysToKeep);
}
+ if(oldConfig.version().olderThan(new Version(PRE_V3_VERSION))) updatedToV3 = true;
}
//region getter
diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java
index 4f0c2f4..a5ccdd5 100644
--- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java
+++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java
@@ -38,6 +38,7 @@
import at.pcgamingfreaks.Minepacks.Bukkit.Listener.*;
import at.pcgamingfreaks.Minepacks.Bukkit.SpecialInfoWorker.NoDatabaseWorker;
import at.pcgamingfreaks.Minepacks.Bukkit.SpecialInfoWorker.NoUpgradesFromV1;
+import at.pcgamingfreaks.Minepacks.Bukkit.SpecialInfoWorker.WelcomeToV3;
import at.pcgamingfreaks.StringUtils;
import at.pcgamingfreaks.Updater.UpdateResponseCallback;
import at.pcgamingfreaks.Version;
@@ -231,6 +232,7 @@ private void load()
cooldownManager = new CooldownHandler(this);
if(configuration.isCommandCooldownSyncEnabled()) pluginManager.registerEvents(cooldownManager, this);
}
+ if(configuration.isUpdatedToV3()) pluginManager.registerEvents(new WelcomeToV3(this), this);
//endregion
if(configuration.isItemCollectorEnabled()) collector = new ItemsCollector(this);
worldBlacklist = configuration.getWorldBlacklist();
diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/SpecialInfoWorker/WelcomeToV3.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/SpecialInfoWorker/WelcomeToV3.java
new file mode 100644
index 0000000..580b781
--- /dev/null
+++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/SpecialInfoWorker/WelcomeToV3.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2021 GeorgH93
+ *
+ * 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package at.pcgamingfreaks.Minepacks.Bukkit.SpecialInfoWorker;
+
+import at.pcgamingfreaks.Bukkit.Message.Message;
+import at.pcgamingfreaks.Bukkit.Message.MessageBuilder;
+import at.pcgamingfreaks.Message.MessageColor;
+import at.pcgamingfreaks.Message.MessageFormat;
+import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
+import at.pcgamingfreaks.Minepacks.Bukkit.Permissions;
+
+import org.bukkit.entity.Player;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class WelcomeToV3 extends SpecialInfoBase
+{
+ private List messages = new ArrayList<>();
+
+ public WelcomeToV3(final Minepacks plugin)
+ {
+ super(plugin, Permissions.RELOAD);
+ messages.add(new MessageBuilder().append(" ", MessageColor.AQUA, MessageFormat.UNDERLINE)
+ .append("[", MessageColor.DARK_GRAY).append("Minepacks v3." + plugin.getVersion().getMinor(), MessageColor.YELLOW).append("]", MessageColor.DARK_GRAY)
+ .append(" ", MessageColor.AQUA, MessageFormat.UNDERLINE).getMessage());
+ messages.add(new MessageBuilder("Minepacks has been updated to " + plugin.getVersion() + "!").appendNewLine()
+ .append("This update brings a lot of changes, so make sure to check the config file and update your language file.")
+ .getMessage());
+ }
+
+ @Override
+ protected void sendMessage(Player player)
+ {
+ messages.forEach(message -> message.send(player));
+ }
+}
\ No newline at end of file