mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Fixed CoreProtect not recognizing Slimefun blocks getting broken
This commit is contained in:
parent
64fd5a54c3
commit
86715cd3d0
@ -63,6 +63,7 @@
|
||||
* Fixed network visualizers spawning particles for other player heads
|
||||
* Fixed #2418
|
||||
* Fixed #2446
|
||||
* Fixed CoreProtect not recognizing Slimefun blocks getting broken
|
||||
|
||||
## Release Candidate 17 (17 Oct 2020)
|
||||
|
||||
|
@ -113,6 +113,7 @@ public class ItemSetting<T> {
|
||||
*
|
||||
* @param c
|
||||
* The class of data type you want to compare
|
||||
*
|
||||
* @return Whether this {@link ItemSetting} stores the given type
|
||||
*/
|
||||
public boolean isType(@Nonnull Class<?> c) {
|
||||
@ -137,14 +138,19 @@ public class ItemSetting<T> {
|
||||
* @param item
|
||||
* The {@link SlimefunItem} who called this method
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void load(@Nonnull SlimefunItem item) {
|
||||
Validate.notNull(item, "Cannot apply settings for a non-existing SlimefunItem");
|
||||
|
||||
SlimefunPlugin.getItemCfg().setDefaultValue(item.getId() + '.' + getKey(), getDefaultValue());
|
||||
Object configuredValue = SlimefunPlugin.getItemCfg().getValue(item.getId() + '.' + getKey());
|
||||
|
||||
if (defaultValue.getClass().isInstance(configuredValue)) {
|
||||
if (validateInput((T) configuredValue)) {
|
||||
this.value = (T) configuredValue;
|
||||
// We can suppress the warning here, we did an isInstance(...) check before!
|
||||
@SuppressWarnings("unchecked")
|
||||
T newValue = (T) configuredValue;
|
||||
|
||||
if (validateInput(newValue)) {
|
||||
this.value = newValue;
|
||||
} else {
|
||||
Slimefun.getLogger().log(Level.WARNING, "Slimefun has found an invalid config setting in your Items.yml!");
|
||||
Slimefun.getLogger().log(Level.WARNING, " at \"{0}.{1}\"", new Object[] { item.getId(), getKey() });
|
||||
|
@ -22,6 +22,7 @@ import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.NotPlaceable;
|
||||
import io.github.thebusybiscuit.slimefun4.core.handlers.BlockBreakHandler;
|
||||
import io.github.thebusybiscuit.slimefun4.core.handlers.BlockPlaceHandler;
|
||||
@ -152,6 +153,9 @@ public class BlockListener implements Listener {
|
||||
if (!drops.isEmpty()) {
|
||||
e.getBlock().setType(Material.AIR);
|
||||
|
||||
// Notify plugins like CoreProtect
|
||||
SlimefunPlugin.getProtectionManager().logAction(e.getPlayer(), e.getBlock(), ProtectableAction.BREAK_BLOCK);
|
||||
|
||||
if (e.isDropItems()) {
|
||||
for (ItemStack drop : drops) {
|
||||
if (drop != null && drop.getType() != Material.AIR) {
|
||||
|
Loading…
Reference in New Issue
Block a user