mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-09-18 21:45:12 +00:00
Merge branch 'refs/heads/master' into enums-to-registers
This commit is contained in:
commit
9c64758494
5 changed files with 143 additions and 0 deletions
|
@ -6,6 +6,7 @@ import org.bukkit.block.Block;
|
|||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.generator.structure.GeneratedStructure;
|
||||
import org.bukkit.generator.structure.Structure;
|
||||
import org.bukkit.persistence.PersistentDataHolder;
|
||||
|
@ -285,6 +286,17 @@ public interface Chunk extends PersistentDataHolder {
|
|||
@NotNull
|
||||
Collection<GeneratedStructure> getStructures(@NotNull Structure structure);
|
||||
|
||||
/**
|
||||
* Get a list of all players who are can view the chunk from their client
|
||||
* <p>
|
||||
* This list will be empty if no players are viewing the chunk, or the chunk
|
||||
* is unloaded.
|
||||
*
|
||||
* @return collection of players who can see the chunk
|
||||
*/
|
||||
@NotNull
|
||||
public Collection<Player> getPlayersSeeingChunk();
|
||||
|
||||
/**
|
||||
* An enum to specify the load level of a chunk.
|
||||
*/
|
||||
|
|
|
@ -5524,6 +5524,37 @@ public enum Material implements Keyed, Translatable {
|
|||
return Bukkit.getDataPackManager().isEnabledByFeature(asBlockType(), world);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this material is compostable (can be inserted into a
|
||||
* composter).
|
||||
*
|
||||
* @return true if this material is compostable
|
||||
* @see #getCompostChance()
|
||||
*/
|
||||
public boolean isCompostable() {
|
||||
return isItem() && asItemType().isCompostable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the chance that this material will successfully compost. The returned
|
||||
* value is between 0 and 1 (inclusive).
|
||||
*
|
||||
* Materials with a compost chance of 1 will always raise the composter's
|
||||
* level, while materials with a compost chance of 0 will never raise it.
|
||||
*
|
||||
* Plugins should check that {@link #isCompostable} returns true before
|
||||
* calling this method.
|
||||
*
|
||||
* @return the chance that this material will successfully compost
|
||||
* @throws IllegalArgumentException if the material is not compostable
|
||||
* @see #isCompostable()
|
||||
*/
|
||||
public float getCompostChance() {
|
||||
ItemType type = asItemType();
|
||||
Preconditions.checkArgument(type != null, "The Material is not an item!");
|
||||
return type.getCompostChance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to convert this Material to an item type
|
||||
*
|
||||
|
|
|
@ -314,6 +314,33 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
|||
@Deprecated
|
||||
public boolean refreshChunk(int x, int z);
|
||||
|
||||
/**
|
||||
* Get a list of all players who are can view the specified chunk from their
|
||||
* client
|
||||
* <p>
|
||||
* This list will be empty if no players are viewing the chunk, or the chunk
|
||||
* is unloaded.
|
||||
*
|
||||
* @param chunk the chunk to check
|
||||
* @return collection of players who can see the chunk
|
||||
*/
|
||||
@NotNull
|
||||
public Collection<Player> getPlayersSeeingChunk(@NotNull Chunk chunk);
|
||||
|
||||
/**
|
||||
* Get a list of all players who are can view the specified chunk from their
|
||||
* client
|
||||
* <p>
|
||||
* This list will be empty if no players are viewing the chunk, or the chunk
|
||||
* is unloaded.
|
||||
*
|
||||
* @param x X-coordinate of the chunk
|
||||
* @param z Z-coordinate of the chunk
|
||||
* @return collection of players who can see the chunk
|
||||
*/
|
||||
@NotNull
|
||||
public Collection<Player> getPlayersSeeingChunk(int x, int z);
|
||||
|
||||
/**
|
||||
* Gets whether the chunk at the specified chunk coordinates is force
|
||||
* loaded.
|
||||
|
|
|
@ -2086,6 +2086,54 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
|||
*/
|
||||
public <T> void spawnParticle(@NotNull Particle.Typed<T> particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data);
|
||||
|
||||
/**
|
||||
* Spawns the particle (the number of times specified by count)
|
||||
* at the target location. The position of each particle will be
|
||||
* randomized positively and negatively by the offset parameters
|
||||
* on each axis.
|
||||
*
|
||||
* @param <T> type of particle data (see {@link Particle#getDataType()}
|
||||
* @param particle the particle to spawn
|
||||
* @param location the location to spawn at
|
||||
* @param count the number of particles
|
||||
* @param offsetX the maximum random offset on the X axis
|
||||
* @param offsetY the maximum random offset on the Y axis
|
||||
* @param offsetZ the maximum random offset on the Z axis
|
||||
* @param extra the extra data for this particle, depends on the
|
||||
* particle used (normally speed)
|
||||
* @param data the data to use for the particle or null,
|
||||
* the type of this depends on {@link Particle#getDataType()}
|
||||
* @param force whether to send the particle to the player in an extended
|
||||
* range and encourage their client to render it regardless of
|
||||
* settings
|
||||
*/
|
||||
public <T> void spawnParticle(@NotNull Particle.Typed<T> particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data, boolean force);
|
||||
|
||||
/**
|
||||
* Spawns the particle (the number of times specified by count)
|
||||
* at the target location. The position of each particle will be
|
||||
* randomized positively and negatively by the offset parameters
|
||||
* on each axis.
|
||||
*
|
||||
* @param <T> type of particle data (see {@link Particle#getDataType()}
|
||||
* @param particle the particle to spawn
|
||||
* @param x the position on the x axis to spawn at
|
||||
* @param y the position on the y axis to spawn at
|
||||
* @param z the position on the z axis to spawn at
|
||||
* @param count the number of particles
|
||||
* @param offsetX the maximum random offset on the X axis
|
||||
* @param offsetY the maximum random offset on the Y axis
|
||||
* @param offsetZ the maximum random offset on the Z axis
|
||||
* @param extra the extra data for this particle, depends on the
|
||||
* particle used (normally speed)
|
||||
* @param data the data to use for the particle or null,
|
||||
* the type of this depends on {@link Particle#getDataType()}
|
||||
* @param force whether to send the particle to the player in an extended
|
||||
* range and encourage their client to render it regardless of
|
||||
* settings
|
||||
*/
|
||||
public <T> void spawnParticle(@NotNull Particle.Typed<T> particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data, boolean force);
|
||||
|
||||
/**
|
||||
* Return the player's progression on the specified advancement.
|
||||
*
|
||||
|
|
|
@ -2360,6 +2360,31 @@ public interface ItemType extends Keyed, Translatable {
|
|||
*/
|
||||
boolean isFuel();
|
||||
|
||||
/**
|
||||
* Checks whether this item type is compostable (can be inserted into a
|
||||
* composter).
|
||||
*
|
||||
* @return true if this item type is compostable
|
||||
* @see #getCompostChance()
|
||||
*/
|
||||
boolean isCompostable();
|
||||
|
||||
/**
|
||||
* Get the chance that this item type will successfully compost. The
|
||||
* returned value is between 0 and 1 (inclusive).
|
||||
*
|
||||
* Items with a compost chance of 1 will always raise the composter's level,
|
||||
* while items with a compost chance of 0 will never raise it.
|
||||
*
|
||||
* Plugins should check that {@link #isCompostable} returns true before
|
||||
* calling this method.
|
||||
*
|
||||
* @return the chance that this item type will successfully compost
|
||||
* @throws IllegalArgumentException if this item type is not compostable
|
||||
* @see #isCompostable()
|
||||
*/
|
||||
float getCompostChance();
|
||||
|
||||
/**
|
||||
* Determines the remaining item in a crafting grid after crafting with this
|
||||
* ingredient.
|
||||
|
|
Loading…
Add table
Reference in a new issue