mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-22 02:25:42 +01:00
Always initialize block stacks, fixes #2312
This commit is contained in:
parent
40f5d62eac
commit
54f8f0d68f
@ -51,6 +51,7 @@ import me.pikamug.quests.storage.implementation.file.BukkitQuestYamlStorage;
|
|||||||
import me.pikamug.quests.storage.implementation.jar.BukkitModuleJarStorage;
|
import me.pikamug.quests.storage.implementation.jar.BukkitModuleJarStorage;
|
||||||
import me.pikamug.quests.tasks.BukkitNpcEffectThread;
|
import me.pikamug.quests.tasks.BukkitNpcEffectThread;
|
||||||
import me.pikamug.quests.tasks.BukkitPlayerMoveThread;
|
import me.pikamug.quests.tasks.BukkitPlayerMoveThread;
|
||||||
|
import me.pikamug.quests.util.BukkitMiscUtil;
|
||||||
import me.pikamug.quests.util.BukkitLang;
|
import me.pikamug.quests.util.BukkitLang;
|
||||||
import me.pikamug.quests.util.BukkitUpdateChecker;
|
import me.pikamug.quests.util.BukkitUpdateChecker;
|
||||||
import me.pikamug.quests.util.stack.BlockItemStacks;
|
import me.pikamug.quests.util.stack.BlockItemStacks;
|
||||||
@ -144,11 +145,10 @@ public class BukkitQuestsPlugin extends JavaPlugin implements Quests {
|
|||||||
try {
|
try {
|
||||||
Class.forName("me.pikamug.quests.libs.localelib.LocaleManager");
|
Class.forName("me.pikamug.quests.libs.localelib.LocaleManager");
|
||||||
localeManager = new LocaleManager();
|
localeManager = new LocaleManager();
|
||||||
BlockItemStacks.init(!localeManager.isBelow113());
|
|
||||||
} catch (final Exception ignored) {
|
} catch (final Exception ignored) {
|
||||||
getLogger().warning("LocaleLib not present! Is this a debug environment?");
|
getLogger().warning("LocaleLib not present! Is this a debug environment?");
|
||||||
}
|
}
|
||||||
|
BlockItemStacks.init(!BukkitMiscUtil.isBelow113());
|
||||||
convoListener = new BukkitConvoListener();
|
convoListener = new BukkitConvoListener();
|
||||||
blockListener = new BukkitBlockListener(this);
|
blockListener = new BukkitBlockListener(this);
|
||||||
itemListener = new BukkitItemListener(this);
|
itemListener = new BukkitItemListener(this);
|
||||||
|
@ -1978,7 +1978,7 @@ public class BukkitQuester implements Quester {
|
|||||||
// Blocks are solid so check for durability
|
// Blocks are solid so check for durability
|
||||||
if (broken.getDurability() == toBreak.getDurability()) {
|
if (broken.getDurability() == toBreak.getDurability()) {
|
||||||
goal = toBreak;
|
goal = toBreak;
|
||||||
} else if (!plugin.getLocaleManager().isBelow113()) {
|
} else if (!BukkitMiscUtil.isBelow113()) {
|
||||||
// Ignore durability for 1.13+
|
// Ignore durability for 1.13+
|
||||||
goal = toBreak;
|
goal = toBreak;
|
||||||
}
|
}
|
||||||
@ -2079,7 +2079,7 @@ public class BukkitQuester implements Quester {
|
|||||||
// Blocks are solid so check for durability
|
// Blocks are solid so check for durability
|
||||||
if (damaged.getDurability() == toDamage.getDurability()) {
|
if (damaged.getDurability() == toDamage.getDurability()) {
|
||||||
goal = toDamage;
|
goal = toDamage;
|
||||||
} else if (!plugin.getLocaleManager().isBelow113()) {
|
} else if (!BukkitMiscUtil.isBelow113()) {
|
||||||
// Ignore durability for 1.13+
|
// Ignore durability for 1.13+
|
||||||
goal = toDamage;
|
goal = toDamage;
|
||||||
}
|
}
|
||||||
@ -2157,7 +2157,7 @@ public class BukkitQuester implements Quester {
|
|||||||
// Blocks are solid so check for durability
|
// Blocks are solid so check for durability
|
||||||
if (placed.getDurability() == toPlace.getDurability()) {
|
if (placed.getDurability() == toPlace.getDurability()) {
|
||||||
goal = toPlace;
|
goal = toPlace;
|
||||||
} else if (!plugin.getLocaleManager().isBelow113()) {
|
} else if (!BukkitMiscUtil.isBelow113()) {
|
||||||
// Ignore durability for 1.13+
|
// Ignore durability for 1.13+
|
||||||
goal = toPlace;
|
goal = toPlace;
|
||||||
}
|
}
|
||||||
@ -2235,7 +2235,7 @@ public class BukkitQuester implements Quester {
|
|||||||
// Blocks are solid so check for durability
|
// Blocks are solid so check for durability
|
||||||
if (used.getDurability() == toUse.getDurability()) {
|
if (used.getDurability() == toUse.getDurability()) {
|
||||||
goal = toUse;
|
goal = toUse;
|
||||||
} else if (!plugin.getLocaleManager().isBelow113()) {
|
} else if (!BukkitMiscUtil.isBelow113()) {
|
||||||
// Ignore durability for 1.13+
|
// Ignore durability for 1.13+
|
||||||
goal = toUse;
|
goal = toUse;
|
||||||
}
|
}
|
||||||
@ -2313,7 +2313,7 @@ public class BukkitQuester implements Quester {
|
|||||||
// Blocks are solid so check for durability
|
// Blocks are solid so check for durability
|
||||||
if (cut.getDurability() == toCut.getDurability()) {
|
if (cut.getDurability() == toCut.getDurability()) {
|
||||||
goal = toCut;
|
goal = toCut;
|
||||||
} else if (!plugin.getLocaleManager().isBelow113()) {
|
} else if (!BukkitMiscUtil.isBelow113()) {
|
||||||
// Ignore durability for 1.13+
|
// Ignore durability for 1.13+
|
||||||
goal = toCut;
|
goal = toCut;
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
package me.pikamug.quests.util;
|
package me.pikamug.quests.util;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
@ -305,4 +306,48 @@ public class BukkitMiscUtil {
|
|||||||
input = input.replaceFirst(" ", "");
|
input = input.replaceFirst(" ", "");
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isBelow113() {
|
||||||
|
return _isBelow113(Bukkit.getServer().getBukkitVersion().split("-")[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean _isBelow113(String bukkitVersion) {
|
||||||
|
if (bukkitVersion.matches("^[0-9.]+$")) {
|
||||||
|
switch (bukkitVersion) {
|
||||||
|
case "1.12.2":
|
||||||
|
case "1.12.1":
|
||||||
|
case "1.12":
|
||||||
|
case "1.11.2":
|
||||||
|
case "1.11.1":
|
||||||
|
case "1.11":
|
||||||
|
case "1.10.2":
|
||||||
|
case "1.10.1":
|
||||||
|
case "1.10":
|
||||||
|
case "1.9.4":
|
||||||
|
case "1.9.3":
|
||||||
|
case "1.9.2":
|
||||||
|
case "1.9.1":
|
||||||
|
case "1.9":
|
||||||
|
case "1.8.9":
|
||||||
|
case "1.8.8":
|
||||||
|
case "1.8.7":
|
||||||
|
case "1.8.6":
|
||||||
|
case "1.8.5":
|
||||||
|
case "1.8.4":
|
||||||
|
case "1.8.3":
|
||||||
|
case "1.8.2":
|
||||||
|
case "1.8.1":
|
||||||
|
case "1.8":
|
||||||
|
case "1.7.10":
|
||||||
|
case "1.7.9":
|
||||||
|
case "1.7.2":
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Bukkit.getLogger().severe("[Quests] Received invalid Bukkit version " + bukkitVersion);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user