mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Fixes #2558
This commit is contained in:
parent
c8d60ddc7b
commit
94752a9027
@ -65,6 +65,7 @@
|
||||
* Fixed #2446
|
||||
* Fixed CoreProtect not recognizing Slimefun blocks getting broken
|
||||
* Fixed #2447
|
||||
* Fixed #2558
|
||||
|
||||
## Release Candidate 17 (17 Oct 2020)
|
||||
|
||||
|
@ -7,7 +7,6 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Keyed;
|
||||
import org.bukkit.Material;
|
||||
@ -20,10 +19,7 @@ import org.bukkit.persistence.PersistentDataHolder;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import io.papermc.lib.features.blockstatesnapshot.BlockStateSnapshotResult;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
/**
|
||||
@ -70,20 +66,17 @@ public class BlockDataService implements Keyed {
|
||||
Validate.notNull(b, "The block cannot be null!");
|
||||
Validate.notNull(value, "The value cannot be null!");
|
||||
|
||||
// Due to a bug on older versions, Persistent Data is nullable for non-snapshots
|
||||
boolean useSnapshot = SlimefunPlugin.getMinecraftVersion().isBefore(MinecraftVersion.MINECRAFT_1_16);
|
||||
|
||||
BlockStateSnapshotResult result = PaperLib.getBlockState(b, useSnapshot);
|
||||
BlockState state = result.getState();
|
||||
/**
|
||||
* Don't use PaperLib here, it seems to be quite buggy in block-placing scenarios
|
||||
* and it would be too tedious to check for individual build versions to circumvent this.
|
||||
*/
|
||||
BlockState state = b.getState();
|
||||
|
||||
if (state instanceof TileState) {
|
||||
try {
|
||||
PersistentDataContainer container = ((TileState) state).getPersistentDataContainer();
|
||||
container.set(namespacedKey, PersistentDataType.STRING, value);
|
||||
|
||||
if (result.isSnapshot()) {
|
||||
state.update();
|
||||
}
|
||||
state.update();
|
||||
} catch (Exception x) {
|
||||
Slimefun.getLogger().log(Level.SEVERE, "Please check if your Server Software is up to date!");
|
||||
|
||||
@ -105,7 +98,11 @@ public class BlockDataService implements Keyed {
|
||||
public Optional<String> getBlockData(@Nonnull Block b) {
|
||||
Validate.notNull(b, "The block cannot be null!");
|
||||
|
||||
BlockState state = PaperLib.getBlockState(b, false).getState();
|
||||
/**
|
||||
* Don't use PaperLib here, it seems to be quite buggy in block-placing scenarios
|
||||
* and it would be too tedious to check for individual build versions to circumvent this.
|
||||
*/
|
||||
BlockState state = b.getState();
|
||||
|
||||
if (state instanceof TileState) {
|
||||
PersistentDataContainer container = ((TileState) state).getPersistentDataContainer();
|
||||
|
@ -23,9 +23,22 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
*/
|
||||
public class CustomTextureService {
|
||||
|
||||
/**
|
||||
* The {@link Config} object in which the Server Owner can configure the item models.
|
||||
*/
|
||||
private final Config config;
|
||||
|
||||
/**
|
||||
* This nullable {@link StringBuffer} represents the "version" of the used item-models file.
|
||||
* This version is served with our resource pack.
|
||||
*/
|
||||
private String version = null;
|
||||
|
||||
/**
|
||||
* This boolean represents whether the file was modified anyway.
|
||||
* This is equivalent to at least one value being set to a number which
|
||||
* is not zero!
|
||||
*/
|
||||
private boolean modified = false;
|
||||
|
||||
/**
|
||||
@ -110,6 +123,7 @@ public class CustomTextureService {
|
||||
*/
|
||||
public int getModelData(@Nonnull String id) {
|
||||
Validate.notNull(id, "Cannot get the ModelData for 'null'");
|
||||
|
||||
return config.getInt(id);
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ public class MetricsService {
|
||||
}
|
||||
|
||||
/**
|
||||
* This will close the child classloader and mark all the resources held under this no longer
|
||||
* This will close the child {@link ClassLoader} and mark all the resources held under this no longer
|
||||
* in use, they will be cleaned up the next GC run.
|
||||
*/
|
||||
public void cleanUp() {
|
||||
|
@ -24,8 +24,20 @@ import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
|
||||
*/
|
||||
public class UpdaterService {
|
||||
|
||||
/**
|
||||
* Our {@link SlimefunPlugin} instance.
|
||||
*/
|
||||
private final SlimefunPlugin plugin;
|
||||
|
||||
/**
|
||||
* Our {@link Updater} implementation.
|
||||
*/
|
||||
private final Updater updater;
|
||||
|
||||
/**
|
||||
* The {@link SlimefunBranch} we are currently on.
|
||||
* If this is an official {@link SlimefunBranch}, auto updates will be enabled.
|
||||
*/
|
||||
private final SlimefunBranch branch;
|
||||
|
||||
/**
|
||||
|
@ -20,6 +20,7 @@ import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
* The {@link Listener} responsible for a {@link Player} interacting with an {@link Entity}.
|
||||
*
|
||||
* @author Linox
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
* @see EntityInteractHandler
|
||||
*
|
||||
|
@ -22,6 +22,7 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
*
|
||||
* @author VoidAngel
|
||||
* @author SoSeDiK
|
||||
* @author CURVX
|
||||
*
|
||||
*/
|
||||
public class BrewingStandListener implements SlimefunCraftingListener {
|
||||
|
Loading…
Reference in New Issue
Block a user