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-08-02 21:45:58 +02:00
parent b26f2a1ca8
commit d20650855c
3 changed files with 17 additions and 11 deletions

View File

@ -35,6 +35,7 @@
* Fixed #2176
* Fixed #2164
* Fixed #2147
* Fixed #2179
## Release Candidate 15 (01 Aug 2020)

View File

@ -501,6 +501,12 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
}
}
/**
* This returns the global instance of {@link SlimefunPlugin}.
* This may return null if the {@link Plugin} was disabled.
*
* @return The {@link SlimefunPlugin} instance
*/
public static SlimefunPlugin instance() {
return instance;
}
@ -650,6 +656,12 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
return instance.command;
}
/**
* This returns our instance of the {@link SlimefunProfiler}, a tool that is used
* to analyse performance and lag.
*
* @return The {@link SlimefunProfiler}
*/
public static SlimefunProfiler getProfiler() {
return instance.profiler;
}

View File

@ -11,8 +11,8 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.slimefun4.core.attributes.Rechargeable;
import io.github.thebusybiscuit.slimefun4.core.handlers.BlockBreakHandler;
import io.github.thebusybiscuit.slimefun4.core.handlers.ItemUseHandler;
import io.github.thebusybiscuit.slimefun4.core.handlers.ToolUseHandler;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
@ -85,15 +85,8 @@ public class MultiTool extends SlimefunItem implements Rechargeable {
return index;
}
private BlockBreakHandler getBlockBreakHandler() {
return (e, item, fortune, drops) -> {
if (isItem(item)) {
e.setCancelled(true);
return true;
}
return false;
};
private ToolUseHandler getToolUseHandler() {
return (e, tool, fortune, drops) -> e.setCancelled(true);
}
@Override
@ -101,7 +94,7 @@ public class MultiTool extends SlimefunItem implements Rechargeable {
super.preRegister();
addItemHandler(getItemUseHandler());
addItemHandler(getBlockBreakHandler());
addItemHandler(getToolUseHandler());
}
}