1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Changed android getter & updated javadocs

This commit is contained in:
poma123 2019-12-02 16:21:55 +01:00
parent 426dd64a2b
commit 1ddd46768e
2 changed files with 15 additions and 8 deletions

View File

@ -1,6 +1,5 @@
package me.mrCookieSlime.Slimefun.Events;
import me.mrCookieSlime.Slimefun.androids.ProgrammableAndroid;
import org.bukkit.block.Block;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
@ -15,14 +14,14 @@ public class AndroidMineEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final Block block;
private final ProgrammableAndroid android;
private final Block android;
private boolean cancelled;
/**
* @param block - mined block
* @param android - android
* @param android - the block of the android
*/
public AndroidMineEvent(Block block, ProgrammableAndroid android) {
public AndroidMineEvent(Block block, Block android) {
this.block = block;
this.android = android;
}
@ -36,6 +35,8 @@ public class AndroidMineEvent extends Event implements Cancellable {
}
/**
* This method returns the mined block
*
* @return the mined block
*/
public Block getBlock() {
@ -43,9 +44,15 @@ public class AndroidMineEvent extends Event implements Cancellable {
}
/**
* @return the android
* This method returns the block of the
* android who wants to mine a block.
*
* @return the block of the android
*/
public ProgrammableAndroid getAndroid() { return this.android;}
public Block getAndroid() {
return this.android;
}
@Override
public boolean isCancelled() {
return this.cancelled;

View File

@ -500,7 +500,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
Collection<ItemStack> drops = block.getDrops();
if (!blockblacklist.contains(block.getType()) && !drops.isEmpty() && SlimefunPlugin.getProtectionManager().hasPermission(Bukkit.getOfflinePlayer(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner"))), block.getLocation(), ProtectableAction.BREAK_BLOCK)) {
String item = BlockStorage.checkID(block);
AndroidMineEvent event = new AndroidMineEvent(block, this);
AndroidMineEvent event = new AndroidMineEvent(block, b);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
@ -533,7 +533,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
Collection<ItemStack> drops = block.getDrops();
if (!blockblacklist.contains(block.getType()) && !drops.isEmpty() && SlimefunPlugin.getProtectionManager().hasPermission(Bukkit.getOfflinePlayer(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner"))), block.getLocation(), ProtectableAction.BREAK_BLOCK)) {
SlimefunItem item = BlockStorage.check(block);
AndroidMineEvent event = new AndroidMineEvent(block, this);
AndroidMineEvent event = new AndroidMineEvent(block, b);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;