-
-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delete slimefun chunks/blocks when island is deleted.
- Loading branch information
1 parent
b260cf1
commit b7c7883
Showing
5 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/main/java/world/bentobox/bentobox/hooks/SlimefunHook.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* | ||
*/ | ||
package world.bentobox.bentobox.hooks; | ||
|
||
import org.bukkit.Bukkit; | ||
import org.bukkit.Material; | ||
import org.bukkit.World; | ||
import org.bukkit.block.Block; | ||
|
||
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; | ||
import me.mrCookieSlime.Slimefun.api.BlockStorage; | ||
import world.bentobox.bentobox.api.hooks.Hook; | ||
|
||
/** | ||
* Hook to enable slimefun blocks to be deleted when islands are deleted. | ||
*/ | ||
public class SlimefunHook extends Hook { | ||
|
||
private Slimefun sfPlugin; | ||
|
||
public SlimefunHook() { | ||
super("SlimeFun", Material.SLIME_BLOCK); | ||
} | ||
|
||
@Override | ||
public boolean hook() { | ||
// See if Slimefun is around | ||
sfPlugin = (Slimefun) Bukkit.getPluginManager().getPlugin("SlimeFun"); | ||
return sfPlugin != null; | ||
} | ||
|
||
@Override | ||
public String getFailureCause() { | ||
return ""; // No errors | ||
} | ||
|
||
public void clearAllBlockInfoAtChunk(World world, int x, int z, boolean destroy) { | ||
if (!BlockStorage.isWorldLoaded(world)) { | ||
return; // Not sure if this is needed. | ||
} | ||
BlockStorage.clearAllBlockInfoAtChunk(world, x, z, destroy); | ||
} | ||
|
||
public void clearBlockInfo(Block b, boolean destroy) { | ||
BlockStorage.clearBlockInfo(b, destroy); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters