1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00
This commit is contained in:
TheBusyBiscuit 2020-11-19 15:01:47 +01:00
parent c8d60ddc7b
commit 94752a9027
7 changed files with 41 additions and 15 deletions

View File

@ -65,6 +65,7 @@
* Fixed #2446 * Fixed #2446
* Fixed CoreProtect not recognizing Slimefun blocks getting broken * Fixed CoreProtect not recognizing Slimefun blocks getting broken
* Fixed #2447 * Fixed #2447
* Fixed #2558
## Release Candidate 17 (17 Oct 2020) ## Release Candidate 17 (17 Oct 2020)

View File

@ -7,7 +7,6 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import org.apache.commons.lang.Validate; import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Keyed; import org.bukkit.Keyed;
import org.bukkit.Material; import org.bukkit.Material;
@ -20,10 +19,7 @@ import org.bukkit.persistence.PersistentDataHolder;
import org.bukkit.persistence.PersistentDataType; import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.Plugin; 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.PaperLib;
import io.papermc.lib.features.blockstatesnapshot.BlockStateSnapshotResult;
import me.mrCookieSlime.Slimefun.api.Slimefun; 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(b, "The block cannot be null!");
Validate.notNull(value, "The value 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); * 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.
BlockStateSnapshotResult result = PaperLib.getBlockState(b, useSnapshot); */
BlockState state = result.getState(); BlockState state = b.getState();
if (state instanceof TileState) { if (state instanceof TileState) {
try { try {
PersistentDataContainer container = ((TileState) state).getPersistentDataContainer(); PersistentDataContainer container = ((TileState) state).getPersistentDataContainer();
container.set(namespacedKey, PersistentDataType.STRING, value); container.set(namespacedKey, PersistentDataType.STRING, value);
state.update();
if (result.isSnapshot()) {
state.update();
}
} catch (Exception x) { } catch (Exception x) {
Slimefun.getLogger().log(Level.SEVERE, "Please check if your Server Software is up to date!"); 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) { public Optional<String> getBlockData(@Nonnull Block b) {
Validate.notNull(b, "The block cannot be null!"); 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) { if (state instanceof TileState) {
PersistentDataContainer container = ((TileState) state).getPersistentDataContainer(); PersistentDataContainer container = ((TileState) state).getPersistentDataContainer();

View File

@ -23,9 +23,22 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
*/ */
public class CustomTextureService { public class CustomTextureService {
/**
* The {@link Config} object in which the Server Owner can configure the item models.
*/
private final Config config; 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; 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; private boolean modified = false;
/** /**
@ -110,6 +123,7 @@ public class CustomTextureService {
*/ */
public int getModelData(@Nonnull String id) { public int getModelData(@Nonnull String id) {
Validate.notNull(id, "Cannot get the ModelData for 'null'"); Validate.notNull(id, "Cannot get the ModelData for 'null'");
return config.getInt(id); return config.getInt(id);
} }

View File

@ -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. * in use, they will be cleaned up the next GC run.
*/ */
public void cleanUp() { public void cleanUp() {

View File

@ -24,8 +24,20 @@ import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
*/ */
public class UpdaterService { public class UpdaterService {
/**
* Our {@link SlimefunPlugin} instance.
*/
private final SlimefunPlugin plugin; private final SlimefunPlugin plugin;
/**
* Our {@link Updater} implementation.
*/
private final Updater updater; 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; private final SlimefunBranch branch;
/** /**

View File

@ -20,6 +20,7 @@ import me.mrCookieSlime.Slimefun.api.Slimefun;
* The {@link Listener} responsible for a {@link Player} interacting with an {@link Entity}. * The {@link Listener} responsible for a {@link Player} interacting with an {@link Entity}.
* *
* @author Linox * @author Linox
* @author TheBusyBiscuit
* *
* @see EntityInteractHandler * @see EntityInteractHandler
* *

View File

@ -22,6 +22,7 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
* *
* @author VoidAngel * @author VoidAngel
* @author SoSeDiK * @author SoSeDiK
* @author CURVX
* *
*/ */
public class BrewingStandListener implements SlimefunCraftingListener { public class BrewingStandListener implements SlimefunCraftingListener {