Add Standalone build profile

This commit is contained in:
GeorgH93 2019-05-30 02:36:25 +02:00
parent fe43ec7ca3
commit 580b7b1347
No known key found for this signature in database
GPG Key ID: D1630D37F9E4B3C8
11 changed files with 237 additions and 72 deletions

View File

@ -1,43 +1,89 @@
<!-- Variables (this block will not be visible in the readme -->
[banner]: https://pcgamingfreaks.at/images/minepacks.png
[spigot]: https://www.spigotmc.org/resources/minepacks.19286/
<!--[spigotRatingImg]: https://img.shields.io/spiget/stars/19286.svg
[spigotDownloadsImg]: https://img.shields.io/spiget/downloads/19286.svg?label=downloads%20%28spigotmc.org%29-->
[spigotRatingImg]: https://img.shields.io/badge/dynamic/json.svg?color=brightgreen&label=rating&query=%24.rating.average&suffix=%20%2F%205&url=https%3A%2F%2Fapi.spiget.org%2Fv2%2Fresources%2F19286
[spigotDownloadsImg]: https://img.shields.io/badge/dynamic/json.svg?color=brightgreen&label=downloads%20%28spigotmc.org%29&query=%24.downloads&url=https%3A%2F%2Fapi.spiget.org%2Fv2%2Fresources%2F19286
[bukkit]: http://dev.bukkit.org/bukkit-plugins/minepacks/
[issues]: https://github.com/GeorgH93/Minepacks/issues
[wiki]: https://github.com/GeorgH93/Minepacks/wiki
[faq]: https://github.com/GeorgH93/Minepacks/wiki/faq
[wikiFAQ]: https://github.com/GeorgH93/Minepacks/wiki/faq
[wikiPermissions]: https://github.com/GeorgH93/Minepacks/wiki/permissions
[release]: https://github.com/GeorgH93/Minepacks/releases/latest
[releaseImg]: https://img.shields.io/github/release/GeorgH93/Minepacks.svg?label=github%20release
[license]: https://github.com/GeorgH93/Minepacks/blob/master/LICENSE
[licenseImg]: https://img.shields.io/github/license/GeorgH93/Minepacks.svg
[ci]: https://ci.pcgamingfreaks.at/job/Minepacks%20V2/
[ciImg]: https://ci.pcgamingfreaks.at/job/Minepacks%20V2/badge/icon
[apiVersionImg]: https://img.shields.io/badge/dynamic/xml.svg?label=api-version&query=%2F%2Frelease[1]&url=https%3A%2F%2Frepo.pcgamingfreaks.at%2Frepository%2Fmaven-releases%2Fat%2Fpcgamingfreaks%2FMinepacks-API%2Fmaven-metadata.xml
[api]: https://github.com/GeorgH93/Minepacks/tree/API
[apiJavaDoc]: https://ci.pcgamingfreaks.at/job/Minepacks%20API/javadoc/
[apiBuilds]: https://ci.pcgamingfreaks.at/job/Minepacks%20API/
[bugReports]: https://github.com/GeorgH93/Minepacks/issues?q=is%3Aissue+is%3Aopen+label%3Abug
[bugReportsImg]: https://img.shields.io/github/issues/GeorgH93/Minepacks/bug.svg?label=bug%20reports
[reportBug]: https://github.com/GeorgH93/Minepacks/issues/new?labels=bug&template=bug.md
[featureRequests]: https://github.com/GeorgH93/Minepacks/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement
[featureRequestsImg]: https://img.shields.io/github/issues/GeorgH93/Minepacks/enhancement.svg?label=feature%20requests&color=informational
[requestFeature]: https://github.com/GeorgH93/Minepacks/issues/new?labels=enhancement&template=feature.md
[config]: https://github.com/GeorgH93/Minepacks/blob/master/resources/config.yml
<!-- End of variables block -->
[![Logo][banner]][spigot]
Minepacks is a backpack plugin for minecraft server running bukkit or spigot.
[![ciImg]][ci] [![releaseImg]][release] [![licenseImg]][license]
[![ciImg]][ci] [![releaseImg]][release]
[![apiVersionImg]][api] [![licenseImg]][license]
[![featureRequestsImg]][featureRequests] [![bugReportsImg]][bugReports]
[![spigotRatingImg]][spigot] [![spigotDownloadsImg]][spigot]
## Features:
* Configuration
* Permissions
* Backpack size controlled by permissions
* [Configuration][config]
* Backpack size controlled by [permissions][wikiPermissions]
* Auto item-collect on full inventory (can be enabled in the config)
* SQLite/MySQL database
* Multi Language (English and German Language File included)
* Preserves the NBT data of items (everything that can be stored in a chest can be stored in the backpack)
* Support for name changing / UUIDs
* Auto-updater
* [API][api] for developers
## Build from source:
### Normal version:
```
git clone https://github.com/GeorgH93/Minepacks.git
cd Minepacks
mvn package
```
The final file will be in the target folder
### Standalone version:
This version works without the PCGF-PluginLib, however some API features are not available.
```
git clone https://github.com/GeorgH93/Minepacks.git
cd Minepacks
mvn package -P Standalone
```
The final file will be in the target folder
## API:
Minepacks V2 comes with an API that allows you to interact with this plugin.
If you think there is something missing in the API feel free to open a [feature request][requestFeature].
Please do not access the data of the plugin over other ways than the provided API, the inner workings will change and I won't keep track of what you are using in your plugin.
For more details about the API please check the following links:
[Source Code & Details][api] ⚫ [JavaDoc][apiJavaDoc] ⚫ [Build Server][apiBuilds]
## Support
* [Wiki][wiki]
* [Issue tracker][issues]
<!-- * Feature request
* Bug report
* [Faq][faq]-->
* [new feature request][requestFeature]
* [new bug report][reportBug]
* [Faq][wikiFAQ]
## Links
* [Spigot][spigot]
* [Dev Bukkit][bukkit]
* [Build Server][ci]
* [Build Server][ci]

78
pom.xml
View File

@ -32,6 +32,9 @@
<properties>
<author>GeorgH93</author>
<website>https://www.spigotmc.org/resources/19286/</website>
<version>${project.version}</version>
<dependencies>PCGF_PluginLib</dependencies>
<mainClass>${project.groupId}.${project.artifactId}.Bukkit.${project.artifactId}</mainClass>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
@ -75,8 +78,7 @@
<dependency>
<groupId>at.pcgamingfreaks</groupId>
<artifactId>PluginLib</artifactId>
<version>1.0.10-SNAPSHOT</version>
<scope>provided</scope>
<version>1.0.11-SNAPSHOT</version>
</dependency>
</dependencies>
@ -133,6 +135,78 @@
</plugins>
</build>
<profiles>
<profile>
<id>Standalone</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<version>${project.version}-Standalone</version>
<dependencies/>
<mainClass>${project.groupId}.${project.artifactId}Standalone.Bukkit.${project.artifactId}</mainClass>
</properties>
<build>
<finalName>${project.artifactId}Standalone-${project.version}</finalName>
<plugins>
<!-- Shades some required libs into the final jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<minimizeJar>true</minimizeJar>
<artifactSet>
<includes>
<include>at.pcgamingfreaks:Minepacks-API</include>
<include>at.pcgamingfreaks:PluginLib</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>at.pcgf.libs</pattern>
<shadedPattern>at.pcgamingfreaks.MinepacksStandalone.libs</shadedPattern>
</relocation>
<relocation>
<pattern>at.pcgamingfreaks.Minepacks</pattern>
<shadedPattern>at.pcgamingfreaks.MinepacksStandalone</shadedPattern>
<excludes>
<exclude>at.pcgamingfreaks.Minepacks.Bukkit.API.*</exclude>
</excludes>
</relocation>
<relocation>
<pattern>at.pcgamingfreaks</pattern>
<shadedPattern>at.pcgamingfreaks.MinepacksStandalone.libs.at.pcgamingfreaks</shadedPattern>
<excludes>
<exclude>at.pcgamingfreaks.Minepacks.Bukkit.API.*</exclude>
</excludes>
</relocation>
</relocations>
<filters>
<filter>
<artifact>at.pcgamingfreaks:PluginLib</artifact>
<excludes>
<exclude>*.yml</exclude>
<exclude>META-INF/*.txt</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<distributionManagement>
<repository>
<id>releases</id>

View File

@ -2,7 +2,7 @@
# Language Settings
Language:
# Defines the used language and the corresponding file used. The corresponding language file will be placed next to the config.yml named: <Language>.yml
# Defines the used language and the corresponding file used. The corresponding language file will be placed in the lang folder next to the config.yml named: <Language>.yml
Language: en
# Options:
# Overwrite (deletes all changes from the file and extracts a new language file)

View File

@ -1,11 +1,11 @@
name: ${project.name}
author: ${author}
website: ${website}
main: ${project.groupId}.${project.artifactId}.Bukkit.${project.artifactId}
description: ${project.description}
version: ${project.version}
depend: [PCGF_PluginLib]
api-version: 1.13
name: "${project.name}"
author: "${author}"
website: "${website}"
main: "${mainClass}"
description: "${project.description}"
version: "${version}"
depend: [ ${dependencies} ]
api-version: "1.13"
permissions:
backpack.*:

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 GeorgH93
* Copyright (C) 2019 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
@ -46,7 +46,7 @@ public UpdateCommand(Minepacks plugin)
public void execute(@NotNull final CommandSender sender, @NotNull String mainCommandAlias, @NotNull String alias, @NotNull String[] args)
{
messageCheckingForUpdates.send(sender);
((PluginLib) PluginLib.getInstance()).update(null); // Make the PluginLib to check for updates too
if(!Minepacks.getInstance().isRunningInStandaloneMode()) ((PluginLib) PluginLib.getInstance()).update(null); // Make the PluginLib check for updates too
((Minepacks) plugin).update(result -> {
switch(result)
{

View File

@ -38,7 +38,9 @@ public void execute(@NotNull CommandSender sender, @NotNull String mainCommandAl
{
sender.sendMessage("##### Start Minepacks version info #####");
sender.sendMessage("Marriage Master: " + plugin.getDescription().getVersion());
sender.sendMessage("PCGF PluginLib: " + PluginLib.getInstance().getVersion());
String pluginLibVersion = "Standalone";
if(!Minepacks.getInstance().isRunningInStandaloneMode()) pluginLibVersion = PluginLib.getInstance().getVersion().toString();
sender.sendMessage("PCGF PluginLib: " + pluginLibVersion);
sender.sendMessage("Server: " + plugin.getServer().getVersion());
sender.sendMessage("##### End Minepacks version info #####");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2016-2018 GeorgH93
* Copyright (C) 2019 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
@ -18,6 +18,7 @@
package at.pcgamingfreaks.Minepacks.Bukkit.Database;
import at.pcgamingfreaks.Bukkit.Configuration;
import at.pcgamingfreaks.Bukkit.MCVersion;
import at.pcgamingfreaks.Bukkit.MinecraftMaterial;
import at.pcgamingfreaks.ConsoleColor;
import at.pcgamingfreaks.Database.DatabaseConnectionConfiguration;
@ -301,13 +302,13 @@ public double getFullInvRadius()
//region Shulkerboxes
public boolean isShulkerboxesPreventInBackpackEnabled()
{
return getConfig().getBoolean("Shulkerboxes.PreventInBackpack", true);
{ // Shulkerboxes are only available in MC 1.11 and newer
return MCVersion.isNewerOrEqualThan(MCVersion.MC_1_11) && getConfig().getBoolean("Shulkerboxes.PreventInBackpack", true);
}
public boolean isShulkerboxesDisable()
{
return getConfig().getBoolean("Shulkerboxes.DisableShulkerboxes", false);
{ // Shulkerboxes are only available in MC 1.11 and newer
return MCVersion.isNewerOrEqualThan(MCVersion.MC_1_11) && getConfig().getBoolean("Shulkerboxes.DisableShulkerboxes", false);
}
public boolean isShulkerboxesExistingDropEnabled()

View File

@ -84,18 +84,30 @@ public void close()
unCacheStrategie.close();
}
public static DatabaseConnectionPool getSharedDatabaseConnectionPool(Minepacks plugin)
{
if(plugin.isRunningInStandaloneMode())
{
plugin.getLogger().warning(ConsoleColor.RED + "The shared database connection option is not available in standalone mode!" + ConsoleColor.RESET);
return null;
}
DatabaseConnectionPool pool = PluginLib.getInstance().getDatabaseConnectionPool();
if(pool == null)
{
plugin.getLogger().warning(ConsoleColor.RED + "The shared connection pool is not initialized correctly!" + ConsoleColor.RESET);
return null;
}
return pool;
}
public static Database getDatabase(Minepacks plugin)
{
String dbType = plugin.getConfiguration().getDatabaseType().toLowerCase();
ConnectionProvider connectionProvider = null;
if(dbType.equals("shared") || dbType.equals("external") || dbType.equals("global"))
{
DatabaseConnectionPool pool = PluginLib.getInstance().getDatabaseConnectionPool();
if(pool == null)
{
plugin.getLogger().warning(ConsoleColor.RED + "The shared connection pool is not initialized correctly!" + ConsoleColor.RESET);
return null;
}
DatabaseConnectionPool pool = getSharedDatabaseConnectionPool(plugin);
if(pool == null) return null;
dbType = pool.getDatabaseType().toLowerCase();
connectionProvider = pool.getConnectionProvider();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 GeorgH93
* Copyright (C) 2019 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
@ -20,7 +20,6 @@
import at.pcgamingfreaks.ConsoleColor;
import at.pcgamingfreaks.Minepacks.Bukkit.Database.*;
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
import at.pcgamingfreaks.PluginLib.Bukkit.PluginLib;
import at.pcgamingfreaks.PluginLib.Database.DatabaseConnectionPool;
import at.pcgamingfreaks.Reflection;
@ -110,12 +109,8 @@ public Migration getMigrationPerformer(String targetDatabaseType)
boolean global = false;
if(targetDatabaseType.toLowerCase().equals("external") ||targetDatabaseType.toLowerCase().equals("global") || targetDatabaseType.toLowerCase().equals("shared"))
{
DatabaseConnectionPool pool = PluginLib.getInstance().getDatabaseConnectionPool();
if(pool == null)
{
plugin.getLogger().warning(ConsoleColor.RED + "The shared connection pool is not initialized correctly!" + ConsoleColor.RESET);
return null;
}
DatabaseConnectionPool pool = Database.getSharedDatabaseConnectionPool(plugin);
if(pool == null) return null;
targetDatabaseType = pool.getDatabaseType().toLowerCase();
global = true;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2016-2018 GeorgH93
* Copyright (C) 2019 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
@ -17,12 +17,14 @@
package at.pcgamingfreaks.Minepacks.Bukkit.Listener;
import at.pcgamingfreaks.Bukkit.ItemNameResolver;
import at.pcgamingfreaks.Bukkit.Language;
import at.pcgamingfreaks.Bukkit.MCVersion;
import at.pcgamingfreaks.Bukkit.Message.Message;
import at.pcgamingfreaks.Bukkit.MinecraftMaterial;
import at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack;
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
import at.pcgamingfreaks.PluginLib.Bukkit.ItemNameResolver;
import at.pcgamingfreaks.YamlFileUpdateMethod;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -32,6 +34,7 @@
import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.inventory.InventoryMoveItemEvent;
import java.io.File;
import java.util.Collection;
import java.util.HashSet;
@ -39,12 +42,13 @@ public class ItemFilter extends MinepacksListener
{
private final Message messageNotAllowedInBackpack;
private final Collection<MinecraftMaterial> blockedMaterials = new HashSet<>();
private final ItemNameResolver itemNameResolver;
public ItemFilter(final Minepacks plugin)
{
super(plugin);
if(MCVersion.isNewerOrEqualThan(MCVersion.MC_1_11) && plugin.getConfiguration().isShulkerboxesPreventInBackpackEnabled())
if(plugin.getConfiguration().isShulkerboxesPreventInBackpackEnabled())
{
for(Material mat : DisableShulkerboxes.SHULKER_BOX_MATERIALS)
{
@ -54,6 +58,26 @@ public ItemFilter(final Minepacks plugin)
blockedMaterials.addAll(plugin.getConfiguration().getItemFilterBlacklist());
messageNotAllowedInBackpack = plugin.getLanguage().getMessage("Ingame.NotAllowedInBackpack").replaceAll("\\{ItemName}", "%s");
if(plugin.isRunningInStandaloneMode())
{
itemNameResolver = new ItemNameResolver();
if (MCVersion.isOlderThan(MCVersion.MC_1_13)) {
Language itemNameLanguage = new Language(plugin, 1, 1, File.separator + "lang", "items_", "legacy_items_");
itemNameLanguage.setFileDescription("item name language");
itemNameLanguage.load(plugin.getConfiguration().getLanguage(), YamlFileUpdateMethod.OVERWRITE);
itemNameResolver.loadLegacy(itemNameLanguage, plugin.getLogger());
} else {
Language itemNameLanguage = new Language(plugin, 2, File.separator + "lang", "items_");
itemNameLanguage.setFileDescription("item name language");
itemNameLanguage.load(plugin.getConfiguration().getLanguage(), YamlFileUpdateMethod.OVERWRITE);
itemNameResolver.load(itemNameLanguage, plugin.getLogger());
}
}
else
{
itemNameResolver = at.pcgamingfreaks.PluginLib.Bukkit.ItemNameResolver.getInstance();
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
@ -63,7 +87,7 @@ public void onItemMove(InventoryMoveItemEvent event)
{
if(event.getSource().getHolder() instanceof Player)
{
messageNotAllowedInBackpack.send((Player) event.getSource().getHolder(), ItemNameResolver.getInstance().getName(event.getItem()));
messageNotAllowedInBackpack.send((Player) event.getSource().getHolder(), itemNameResolver.getName(event.getItem()));
}
event.setCancelled(true);
}
@ -74,7 +98,7 @@ public void onItemMove(InventoryClickEvent event)
{
if(event.getInventory().getHolder() instanceof Backpack && event.getCurrentItem() != null && blockedMaterials.contains(new MinecraftMaterial(event.getCurrentItem())))
{
messageNotAllowedInBackpack.send(event.getView().getPlayer(), ItemNameResolver.getInstance().getName(event.getCurrentItem()));
messageNotAllowedInBackpack.send(event.getView().getPlayer(), itemNameResolver.getName(event.getCurrentItem()));
event.setCancelled(true);
}
}
@ -84,7 +108,7 @@ public void onItemMove(InventoryDragEvent event)
{
if(event.getInventory().getHolder() instanceof Backpack && event.getOldCursor() != null && blockedMaterials.contains(new MinecraftMaterial(event.getOldCursor())))
{
messageNotAllowedInBackpack.send(event.getView().getPlayer(), ItemNameResolver.getInstance().getName(event.getOldCursor()));
messageNotAllowedInBackpack.send(event.getView().getPlayer(), itemNameResolver.getName(event.getOldCursor()));
event.setCancelled(true);
}
}

View File

@ -58,8 +58,9 @@
public class Minepacks extends JavaPlugin implements MinepacksPlugin
{
private static final int BUKKIT_PROJECT_ID = 83445;
private static final String JENKINS_URL = "https://ci.pcgamingfreaks.at", JENKINS_JOB = "Minepacks V2";
private static final String JENKINS_URL = "https://ci.pcgamingfreaks.at", JENKINS_JOB = "Minepacks V2", MIN_PCGF_PLUGIN_LIB_VERSION = "1.0.11-SNAPSHOT";
private static Minepacks instance = null;
private static boolean standalone = false;
private Config config;
private Language lang;
@ -80,24 +81,40 @@ public static Minepacks getInstance()
return instance;
}
@Override
public boolean isRunningInStandaloneMode()
{
return standalone;
}
@Override
public void onEnable()
{
Utils.warnOnJava_1_7(getLogger());
if(PluginLib.getInstance().getVersion().olderThan(new Version("1.0.8-SNAPSHOT")))
// Check if running as standalone edition
if(getDescription().getVersion().contains("Standalone"))
{
getLogger().warning("You are using an outdated version of the PCGF PluginLib! Please update it!");
setEnabled(false);
return;
standalone = true;
if(getServer().getPluginManager().isPluginEnabled("PCGF_PluginLib"))
{
getLogger().info("You do have the PCGF_PluginLib installed. You may consider switching to the default version of the plugin to reduce memory load and unlock additional features.");
}
}
else
{
// Not standalone so we should check the version of the PluginLib
if(PluginLib.getInstance().getVersion().olderThan(new Version(MIN_PCGF_PLUGIN_LIB_VERSION)))
{
getLogger().warning("You are using an outdated version of the PCGF PluginLib! Please update it!");
setEnabled(false);
return;
}
}
//region Check compatibility with used minecraft version
if(MCVersion.is(MCVersion.UNKNOWN) || MCVersion.isNewerThan(MCVersion.MC_NMS_1_14_R1))
{
String name = Bukkit.getServer().getClass().getPackage().getName();
String[] version = name.substring(name.lastIndexOf('.') + 2).split("_");
this.warnOnVersionIncompatibility(version[0] + "." + version[1]);
this.warnOnVersionIncompatibility();
this.setEnabled(false);
return;
}
@ -117,7 +134,6 @@ public void onEnable()
instance = this;
config = new Config(this);
lang = new Language(this);
load();
if(config.getAutoUpdate()) update(null);
@ -131,12 +147,12 @@ public void onDisable()
Updater updater = null;
if(config.getAutoUpdate()) updater = update(null);
unload();
if(updater != null) updater.waitForAsyncOperation();
if(updater != null) updater.waitForAsyncOperation(); // Wait for updater to finish
getLogger().info(StringUtils.getPluginDisabledMessage(getDescription().getName()));
instance = null;
}
public Updater update(@Nullable at.pcgamingfreaks.Updater.Updater.UpdaterResponse output)
public @NotNull Updater update(@Nullable at.pcgamingfreaks.Updater.Updater.UpdaterResponse output)
{
UpdateProvider updateProvider;
if(config.useUpdaterDevBuilds())
@ -171,18 +187,11 @@ private void load()
pluginManager.registerEvents(new BackpackEventListener(this), this);
if(config.getDropOnDeath()) pluginManager.registerEvents(new DropOnDeath(this), this);
if(config.isItemFilterEnabled()) pluginManager.registerEvents(new ItemFilter(this), this);
if(MCVersion.isNewerOrEqualThan(MCVersion.MC_1_11) && config.isShulkerboxesDisable()) pluginManager.registerEvents(new DisableShulkerboxes(this), this);
if(config.isShulkerboxesDisable()) pluginManager.registerEvents(new DisableShulkerboxes(this), this);
//endregion
if(config.getFullInvCollect()) collector = new ItemsCollector(this);
worldBlacklist = config.getWorldBlacklist();
if(worldBlacklist.size() == 0)
{
worldBlacklistMode = WorldBlacklistMode.None;
}
else
{
worldBlacklistMode = config.getWorldBlacklistMode();
}
worldBlacklistMode = (worldBlacklist.size() == 0) ? WorldBlacklistMode.None : config.getWorldBlacklistMode();
gameModes = config.getAllowedGameModes();
if(config.getCommandCooldown() > 0) cooldownManager = new CooldownManager(this);
@ -206,11 +215,13 @@ public void reload()
load();
}
public void warnOnVersionIncompatibility(String version)
public void warnOnVersionIncompatibility()
{
String name = Bukkit.getServer().getClass().getPackage().getName();
String[] version = name.substring(name.lastIndexOf('.') + 2).split("_");
getLogger().warning(ConsoleColor.RED + "################################" + ConsoleColor.RESET);
getLogger().warning(ConsoleColor.RED + String.format("Your minecraft version (MC %1$s) is currently not compatible with this plugins version (%2$s). " +
"Please check for updates!", version, getDescription().getVersion()) + ConsoleColor.RESET);
"Please check for updates!", version[0] + "." + version[1], getDescription().getVersion()) + ConsoleColor.RESET);
getLogger().warning(ConsoleColor.RED + "################################" + ConsoleColor.RESET);
Utils.blockThread(5);
}