forked from Slimefun/Slimefun4
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'Slimefun/master'
DEV - 1097
- Loading branch information
Showing
4 changed files
with
275 additions
and
273 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Automatically normalize line endings (to LF) for all text-based files. | ||
* text=auto eol=lf |
208 changes: 104 additions & 104 deletions
208
src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunGuideOpenEvent.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 |
---|---|---|
@@ -1,104 +1,104 @@ | ||
package io.github.thebusybiscuit.slimefun4.api.events; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
import org.apache.commons.lang.Validate; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Cancellable; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.HandlerList; | ||
import org.bukkit.inventory.ItemStack; | ||
|
||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideMode; | ||
|
||
/** | ||
* This {@link Event} is called whenever a {@link Player} tries to open the Slimefun Guide book. | ||
* | ||
* @author Linox | ||
* | ||
* @see SlimefunGuideMode | ||
*/ | ||
public class SlimefunGuideOpenEvent extends Event implements Cancellable { | ||
|
||
private static final HandlerList handlers = new HandlerList(); | ||
|
||
private final Player player; | ||
private final ItemStack guide; | ||
private SlimefunGuideMode layout; | ||
private boolean cancelled; | ||
|
||
public SlimefunGuideOpenEvent(@Nonnull Player p, @Nonnull ItemStack guide, @Nonnull SlimefunGuideMode layout) { | ||
Validate.notNull(p, "The Player cannot be null"); | ||
Validate.notNull(guide, "Guide cannot be null"); | ||
Validate.notNull(layout, "Layout cannot be null"); | ||
this.player = p; | ||
this.guide = guide; | ||
this.layout = layout; | ||
} | ||
|
||
/** | ||
* This returns the {@link Player} that tries to open | ||
* the Slimefun Guide. | ||
* | ||
* @return The {@link Player} | ||
*/ | ||
@Nonnull | ||
public Player getPlayer() { | ||
return player; | ||
} | ||
|
||
/** | ||
* This returns the {@link ItemStack} that {@link Player} | ||
* tries to open the Slimefun Guide with. | ||
* | ||
* @return The {@link ItemStack} | ||
*/ | ||
@Nonnull | ||
public ItemStack getGuide() { | ||
return guide; | ||
} | ||
|
||
/** | ||
* This returns the {@link SlimefunGuideMode} of the Slimefun Guide | ||
* that {@link Player} tries to open. | ||
* | ||
* @return The {@link SlimefunGuideMode} | ||
*/ | ||
@Nonnull | ||
public SlimefunGuideMode getGuideLayout() { | ||
return layout; | ||
} | ||
|
||
/** | ||
* Changes the {@link SlimefunGuideMode} that was tried to be opened with. | ||
* | ||
* @param layout | ||
* The new {@link SlimefunGuideMode} | ||
*/ | ||
public void setGuideLayout(@Nonnull SlimefunGuideMode layout) { | ||
Validate.notNull(layout, "You must specify a layout that is not-null!"); | ||
this.layout = layout; | ||
} | ||
|
||
@Override | ||
public boolean isCancelled() { | ||
return cancelled; | ||
} | ||
|
||
@Override | ||
public void setCancelled(boolean cancel) { | ||
this.cancelled = cancel; | ||
} | ||
|
||
@Nonnull | ||
public static HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public HandlerList getHandlers() { | ||
return getHandlerList(); | ||
} | ||
|
||
} | ||
package io.github.thebusybiscuit.slimefun4.api.events; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
import org.apache.commons.lang.Validate; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Cancellable; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.HandlerList; | ||
import org.bukkit.inventory.ItemStack; | ||
|
||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideMode; | ||
|
||
/** | ||
* This {@link Event} is called whenever a {@link Player} tries to open the Slimefun Guide book. | ||
* | ||
* @author Linox | ||
* | ||
* @see SlimefunGuideMode | ||
*/ | ||
public class SlimefunGuideOpenEvent extends Event implements Cancellable { | ||
|
||
private static final HandlerList handlers = new HandlerList(); | ||
|
||
private final Player player; | ||
private final ItemStack guide; | ||
private SlimefunGuideMode layout; | ||
private boolean cancelled; | ||
|
||
public SlimefunGuideOpenEvent(@Nonnull Player p, @Nonnull ItemStack guide, @Nonnull SlimefunGuideMode layout) { | ||
Validate.notNull(p, "The Player cannot be null"); | ||
Validate.notNull(guide, "Guide cannot be null"); | ||
Validate.notNull(layout, "Layout cannot be null"); | ||
this.player = p; | ||
this.guide = guide; | ||
this.layout = layout; | ||
} | ||
|
||
/** | ||
* This returns the {@link Player} that tries to open | ||
* the Slimefun Guide. | ||
* | ||
* @return The {@link Player} | ||
*/ | ||
@Nonnull | ||
public Player getPlayer() { | ||
return player; | ||
} | ||
|
||
/** | ||
* This returns the {@link ItemStack} that {@link Player} | ||
* tries to open the Slimefun Guide with. | ||
* | ||
* @return The {@link ItemStack} | ||
*/ | ||
@Nonnull | ||
public ItemStack getGuide() { | ||
return guide; | ||
} | ||
|
||
/** | ||
* This returns the {@link SlimefunGuideMode} of the Slimefun Guide | ||
* that {@link Player} tries to open. | ||
* | ||
* @return The {@link SlimefunGuideMode} | ||
*/ | ||
@Nonnull | ||
public SlimefunGuideMode getGuideLayout() { | ||
return layout; | ||
} | ||
|
||
/** | ||
* Changes the {@link SlimefunGuideMode} that was tried to be opened with. | ||
* | ||
* @param layout | ||
* The new {@link SlimefunGuideMode} | ||
*/ | ||
public void setGuideLayout(@Nonnull SlimefunGuideMode layout) { | ||
Validate.notNull(layout, "You must specify a layout that is not-null!"); | ||
this.layout = layout; | ||
} | ||
|
||
@Override | ||
public boolean isCancelled() { | ||
return cancelled; | ||
} | ||
|
||
@Override | ||
public void setCancelled(boolean cancel) { | ||
this.cancelled = cancel; | ||
} | ||
|
||
@Nonnull | ||
public static HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public HandlerList getHandlers() { | ||
return getHandlerList(); | ||
} | ||
|
||
} |
70 changes: 35 additions & 35 deletions
70
src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/RandomMobDrop.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 |
---|---|---|
@@ -1,35 +1,35 @@ | ||
package io.github.thebusybiscuit.slimefun4.core.attributes; | ||
|
||
import org.bukkit.entity.EntityType; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.entity.EntityDeathEvent; | ||
|
||
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem; | ||
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType; | ||
import io.github.thebusybiscuit.slimefun4.implementation.items.misc.BasicCircuitBoard; | ||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.entity.MobDropListener; | ||
|
||
/** | ||
* This interface, when attached to a {@link SlimefunItem}, provides an easy method for adding | ||
* a % chance to drop for an {@link SlimefunItem} on {@link EntityDeathEvent}, this chance is 0-100 | ||
* and used in conjunction with the {@link RecipeType#MOB_DROP}. | ||
* | ||
* @author dNiym | ||
* | ||
* @see BasicCircuitBoard | ||
* @see MobDropListener | ||
* @see PiglinBarterDrop | ||
* | ||
*/ | ||
public interface RandomMobDrop extends ItemAttribute { | ||
|
||
/** | ||
* Implement this method to make the object have a variable chance of being | ||
* added to the dropList when {@link EntityType} specified in | ||
* the {@link RecipeType#MOB_DROP} is killed by the {@link Player}. | ||
* | ||
* @return The integer chance (0-100%) {@link SlimefunItem} has to drop. | ||
*/ | ||
int getMobDropChance(); | ||
|
||
} | ||
package io.github.thebusybiscuit.slimefun4.core.attributes; | ||
|
||
import org.bukkit.entity.EntityType; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.entity.EntityDeathEvent; | ||
|
||
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem; | ||
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType; | ||
import io.github.thebusybiscuit.slimefun4.implementation.items.misc.BasicCircuitBoard; | ||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.entity.MobDropListener; | ||
|
||
/** | ||
* This interface, when attached to a {@link SlimefunItem}, provides an easy method for adding | ||
* a % chance to drop for an {@link SlimefunItem} on {@link EntityDeathEvent}, this chance is 0-100 | ||
* and used in conjunction with the {@link RecipeType#MOB_DROP}. | ||
* | ||
* @author dNiym | ||
* | ||
* @see BasicCircuitBoard | ||
* @see MobDropListener | ||
* @see PiglinBarterDrop | ||
* | ||
*/ | ||
public interface RandomMobDrop extends ItemAttribute { | ||
|
||
/** | ||
* Implement this method to make the object have a variable chance of being | ||
* added to the dropList when {@link EntityType} specified in | ||
* the {@link RecipeType#MOB_DROP} is killed by the {@link Player}. | ||
* | ||
* @return The integer chance (0-100%) {@link SlimefunItem} has to drop. | ||
*/ | ||
int getMobDropChance(); | ||
|
||
} |
Oops, something went wrong.