Fixed versioning issue.

This commit is contained in:
Brianna 2019-08-15 18:10:48 -04:00
parent 110cb6aa80
commit 2b5a87a45c
4 changed files with 6 additions and 10 deletions

View File

@ -4,7 +4,7 @@ stages:
variables:
name: "EpicEnchants"
path: "/builds/$CI_PROJECT_PATH"
version: "1.0.6"
version: "1.0.7"
build:
stage: build

View File

@ -56,7 +56,6 @@ public class EpicEnchants extends JavaPlugin {
private Economy economy;
private EnchantUtils enchantUtils;
private ItemGroup itemGroup;
private int version;
public static EpicEnchants getInstance() {
return INSTANCE;
@ -130,7 +129,6 @@ public class EpicEnchants extends JavaPlugin {
private void preload() {
FastInv.init(this);
this.version = Integer.parseInt(Bukkit.getServer().getBukkitVersion().split("\\.")[1]);
this.fileManager = new FileManager(this);
fileManager.loadFiles();
}
@ -214,10 +212,6 @@ public class EpicEnchants extends JavaPlugin {
return this.itemGroup;
}
public int getVersion() {
return this.version;
}
public Locale getLocale() {
return locale;
}

View File

@ -1,6 +1,7 @@
package com.songoda.epicenchants.managers;
import com.songoda.epicenchants.EpicEnchants;
import com.songoda.epicenchants.utils.ServerVersion;
import com.songoda.epicenchants.utils.objects.FileLocation;
import com.songoda.epicenchants.utils.settings.Setting;
import org.bukkit.Bukkit;
@ -80,8 +81,8 @@ public class FileManager extends Manager<String, FileConfiguration> {
public FileManager(EpicEnchants instance) {
super(instance);
directory = instance.getVersion() > 12 ? "master" : "legacy";
Bukkit.getConsoleSender().sendMessage("Using the " + directory + " configurations because version is 1." + instance.getVersion());
directory = instance.isServerVersionAtLeast(ServerVersion.V1_12) ? "master" : "legacy";
Bukkit.getConsoleSender().sendMessage("Using the " + directory + " configurations because version is " + instance.getServerVersion().name());
}
public void loadFiles() {

View File

@ -3,6 +3,7 @@ package com.songoda.epicenchants.utils.single;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import com.songoda.epicenchants.EpicEnchants;
import com.songoda.epicenchants.utils.ServerVersion;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Material;
@ -18,7 +19,7 @@ public class ItemGroup {
public ItemGroup(EpicEnchants instance) {
groupMap = HashMultimap.create();
if (instance.getVersion() > 12) setupMaster();
if (instance.isServerVersionAtLeast(ServerVersion.V1_12)) setupMaster();
else setupLegacy();
}