mirror of
https://github.com/Minestom/Minestom.git
synced 2024-09-27 22:17:45 +02:00
English fix
This commit is contained in:
parent
59b03bf9ec
commit
660a67e53e
@ -205,7 +205,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current server brand name
|
* Gets the current server brand name.
|
||||||
*
|
*
|
||||||
* @return the server brand name
|
* @return the server brand name
|
||||||
*/
|
*/
|
||||||
@ -214,7 +214,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the server brand name, update the name to all connected players
|
* Changes the server brand name, update the name to all connected players.
|
||||||
*
|
*
|
||||||
* @param brandName the server brand name
|
* @param brandName the server brand name
|
||||||
*/
|
*/
|
||||||
@ -227,7 +227,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the max number of packets a client can send over 1 second
|
* Gets the max number of packets a client can send over 1 second.
|
||||||
*
|
*
|
||||||
* @return the packet count limit over 1 second
|
* @return the packet count limit over 1 second
|
||||||
*/
|
*/
|
||||||
@ -236,7 +236,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the number of packet a client can send over 1 second without being disconnected
|
* Changes the number of packet a client can send over 1 second without being disconnected.
|
||||||
*
|
*
|
||||||
* @param rateLimit the number of packet, 0 to disable
|
* @param rateLimit the number of packet, 0 to disable
|
||||||
*/
|
*/
|
||||||
@ -245,7 +245,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the server difficulty showed in game option
|
* Gets the server difficulty showed in game option.
|
||||||
*
|
*
|
||||||
* @return the server difficulty
|
* @return the server difficulty
|
||||||
*/
|
*/
|
||||||
@ -254,7 +254,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the server difficulty and send the appropriate packet to all connected clients
|
* Changes the server difficulty and send the appropriate packet to all connected clients.
|
||||||
*
|
*
|
||||||
* @param difficulty the new server difficulty
|
* @param difficulty the new server difficulty
|
||||||
*/
|
*/
|
||||||
@ -270,7 +270,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the manager handling all incoming packets
|
* Gets the manager handling all incoming packets
|
||||||
*
|
*
|
||||||
* @return the packet listener manager
|
* @return the packet listener manager
|
||||||
*/
|
*/
|
||||||
@ -279,7 +279,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the netty server
|
* Gets the netty server.
|
||||||
*
|
*
|
||||||
* @return the netty server
|
* @return the netty server
|
||||||
*/
|
*/
|
||||||
@ -288,7 +288,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the manager handling all registered instances
|
* Gets the manager handling all registered instances.
|
||||||
*
|
*
|
||||||
* @return the instance manager
|
* @return the instance manager
|
||||||
*/
|
*/
|
||||||
@ -297,7 +297,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the manager handling {@link CustomBlock} and {@link BlockPlacementRule}
|
* Gets the manager handling {@link CustomBlock} and {@link BlockPlacementRule}.
|
||||||
*
|
*
|
||||||
* @return the block manager
|
* @return the block manager
|
||||||
*/
|
*/
|
||||||
@ -306,7 +306,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the manager handling waiting players
|
* Gets the manager handling waiting players.
|
||||||
*
|
*
|
||||||
* @return the entity manager
|
* @return the entity manager
|
||||||
*/
|
*/
|
||||||
@ -315,7 +315,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the manager handling commands
|
* Gets the manager handling commands.
|
||||||
*
|
*
|
||||||
* @return the command manager
|
* @return the command manager
|
||||||
*/
|
*/
|
||||||
@ -324,7 +324,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the manager handling recipes show to the clients
|
* Gets the manager handling recipes show to the clients.
|
||||||
*
|
*
|
||||||
* @return the recipe manager
|
* @return the recipe manager
|
||||||
*/
|
*/
|
||||||
@ -333,7 +333,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the manager handling storage
|
* Gets the manager handling storage.
|
||||||
*
|
*
|
||||||
* @return the storage manager
|
* @return the storage manager
|
||||||
*/
|
*/
|
||||||
@ -342,7 +342,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the manager handling {@link DataType} used by {@link SerializableData}
|
* Gets the manager handling {@link DataType} used by {@link SerializableData}.
|
||||||
*
|
*
|
||||||
* @return the data manager
|
* @return the data manager
|
||||||
*/
|
*/
|
||||||
@ -351,7 +351,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the manager handling teams
|
* Gets the manager handling teams.
|
||||||
*
|
*
|
||||||
* @return the team manager
|
* @return the team manager
|
||||||
*/
|
*/
|
||||||
@ -360,7 +360,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the manager handling scheduled tasks
|
* Gets the manager handling scheduled tasks.
|
||||||
*
|
*
|
||||||
* @return the scheduler manager
|
* @return the scheduler manager
|
||||||
*/
|
*/
|
||||||
@ -369,7 +369,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the manager handling server monitoring
|
* Gets the manager handling server monitoring.
|
||||||
*
|
*
|
||||||
* @return the benchmark manager
|
* @return the benchmark manager
|
||||||
*/
|
*/
|
||||||
@ -378,7 +378,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the manager handling server connections
|
* Gets the manager handling server connections.
|
||||||
*
|
*
|
||||||
* @return the connection manager
|
* @return the connection manager
|
||||||
*/
|
*/
|
||||||
@ -387,7 +387,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the consumer executed to show server-list data
|
* Gets the consumer executed to show server-list data.
|
||||||
*
|
*
|
||||||
* @return the response data consumer
|
* @return the response data consumer
|
||||||
*/
|
*/
|
||||||
@ -396,7 +396,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the manager handling loot tables
|
* Gets the manager handling loot tables.
|
||||||
*
|
*
|
||||||
* @return the loot table manager
|
* @return the loot table manager
|
||||||
*/
|
*/
|
||||||
@ -405,7 +405,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the manager handling dimensions
|
* Gets the manager handling dimensions.
|
||||||
*
|
*
|
||||||
* @return the dimension manager
|
* @return the dimension manager
|
||||||
*/
|
*/
|
||||||
@ -418,7 +418,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the manager handling advancements
|
* Gets the manager handling advancements.
|
||||||
*
|
*
|
||||||
* @return the advancement manager
|
* @return the advancement manager
|
||||||
*/
|
*/
|
||||||
@ -427,7 +427,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the manager handling tags
|
* Gets the manager handling tags.
|
||||||
*
|
*
|
||||||
* @return the tag manager
|
* @return the tag manager
|
||||||
*/
|
*/
|
||||||
@ -436,7 +436,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the manager handling the server ticks
|
* Gets the manager handling the server ticks.
|
||||||
*
|
*
|
||||||
* @return the update manager
|
* @return the update manager
|
||||||
*/
|
*/
|
||||||
@ -445,7 +445,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start the server
|
* Starts the server.
|
||||||
*
|
*
|
||||||
* @param address the server address
|
* @param address the server address
|
||||||
* @param port the server port
|
* @param port the server port
|
||||||
@ -468,7 +468,7 @@ public class MinecraftServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start the server
|
* Starts the server.
|
||||||
*
|
*
|
||||||
* @param address the server address
|
* @param address the server address
|
||||||
* @param port the server port
|
* @param port the server port
|
||||||
|
@ -52,7 +52,7 @@ public final class UpdateManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start the server loop in the update thread
|
* Starts the server loop in the update thread
|
||||||
*/
|
*/
|
||||||
protected void start() {
|
protected void start() {
|
||||||
mainUpdate.execute(() -> {
|
mainUpdate.execute(() -> {
|
||||||
@ -120,7 +120,7 @@ public final class UpdateManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current thread provider
|
* Gets the current {@link ThreadProvider}.
|
||||||
*
|
*
|
||||||
* @return the current thread provider
|
* @return the current thread provider
|
||||||
*/
|
*/
|
||||||
@ -129,7 +129,7 @@ public final class UpdateManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the server thread provider
|
* Changes the server {@link ThreadProvider}.
|
||||||
*
|
*
|
||||||
* @param threadProvider the new thread provider
|
* @param threadProvider the new thread provider
|
||||||
* @throws NullPointerException if <code>threadProvider</code> is null
|
* @throws NullPointerException if <code>threadProvider</code> is null
|
||||||
@ -140,7 +140,7 @@ public final class UpdateManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signal the {@link ThreadProvider} that an instance has been created.
|
* Signals the {@link ThreadProvider} that an instance has been created.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: should be automatically done by the {@link InstanceManager}.
|
* WARNING: should be automatically done by the {@link InstanceManager}.
|
||||||
*
|
*
|
||||||
@ -153,7 +153,7 @@ public final class UpdateManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signal the {@link ThreadProvider} that an instance has been deleted.
|
* Signals the {@link ThreadProvider} that an instance has been deleted.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: should be automatically done by the {@link InstanceManager}.
|
* WARNING: should be automatically done by the {@link InstanceManager}.
|
||||||
*
|
*
|
||||||
@ -166,7 +166,7 @@ public final class UpdateManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signal the {@link ThreadProvider} that a chunk has been loaded.
|
* Signals the {@link ThreadProvider} that a chunk has been loaded.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: should be automatically done by the {@link Instance} implementation.
|
* WARNING: should be automatically done by the {@link Instance} implementation.
|
||||||
*
|
*
|
||||||
@ -181,7 +181,7 @@ public final class UpdateManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signal the {@link ThreadProvider} that a chunk has been unloaded.
|
* Signals the {@link ThreadProvider} that a chunk has been unloaded.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: should be automatically done by the {@link Instance} implementation.
|
* WARNING: should be automatically done by the {@link Instance} implementation.
|
||||||
*
|
*
|
||||||
@ -212,7 +212,7 @@ public final class UpdateManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop the server loop
|
* Stops the server loop
|
||||||
*/
|
*/
|
||||||
public void stop() {
|
public void stop() {
|
||||||
stopRequested = true;
|
stopRequested = true;
|
||||||
|
@ -8,12 +8,12 @@ import java.util.HashSet;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represent something which can be displayed or hidden to players
|
* Represents something which can be displayed or hidden to players.
|
||||||
*/
|
*/
|
||||||
public interface Viewable {
|
public interface Viewable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a viewer
|
* Adds a viewer.
|
||||||
*
|
*
|
||||||
* @param player the viewer to add
|
* @param player the viewer to add
|
||||||
* @return true if the player has been added, false otherwise (could be because he is already a viewer)
|
* @return true if the player has been added, false otherwise (could be because he is already a viewer)
|
||||||
@ -21,7 +21,7 @@ public interface Viewable {
|
|||||||
boolean addViewer(Player player);
|
boolean addViewer(Player player);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a viewer
|
* Removes a viewer.
|
||||||
*
|
*
|
||||||
* @param player the viewer to remove
|
* @param player the viewer to remove
|
||||||
* @return true if the player has been removed, false otherwise (could be because he was not a viewer)
|
* @return true if the player has been removed, false otherwise (could be because he was not a viewer)
|
||||||
@ -29,14 +29,14 @@ public interface Viewable {
|
|||||||
boolean removeViewer(Player player);
|
boolean removeViewer(Player player);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the viewers of this viewable element
|
* Gets all the viewers of this viewable element.
|
||||||
*
|
*
|
||||||
* @return A Set containing all the element's viewers
|
* @return A Set containing all the element's viewers
|
||||||
*/
|
*/
|
||||||
Set<Player> getViewers();
|
Set<Player> getViewers();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if a player is seeing this viewable object
|
* Gets if a player is seeing this viewable object
|
||||||
*
|
*
|
||||||
* @param player the player to check
|
* @param player the player to check
|
||||||
* @return true if {@code player} is a viewer, false otherwise
|
* @return true if {@code player} is a viewer, false otherwise
|
||||||
@ -46,7 +46,7 @@ public interface Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a packet to all viewers
|
* Sends a packet to all viewers
|
||||||
* <p>
|
* <p>
|
||||||
* It is better than looping through the viewers
|
* It is better than looping through the viewers
|
||||||
* to send a packet since it is here only serialized once
|
* to send a packet since it is here only serialized once
|
||||||
@ -58,7 +58,7 @@ public interface Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send multiple packets to all viewers
|
* Sends multiple packets to all viewers
|
||||||
* <p>
|
* <p>
|
||||||
* It is better than looping through the viewers
|
* It is better than looping through the viewers
|
||||||
* to send a packet since it is here only serialized once
|
* to send a packet since it is here only serialized once
|
||||||
@ -72,7 +72,7 @@ public interface Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a packet to all viewers and the viewable element if it is a player
|
* Sends a packet to all viewers and the viewable element if it is a player
|
||||||
* <p>
|
* <p>
|
||||||
* If 'this' isn't a player, then {@link #sendPacketToViewers(ServerPacket)} is called instead
|
* If 'this' isn't a player, then {@link #sendPacketToViewers(ServerPacket)} is called instead
|
||||||
*
|
*
|
||||||
@ -91,7 +91,7 @@ public interface Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a packet to all the viewers and 'this'
|
* Sends a packet to all the viewers and 'this'
|
||||||
* <p>
|
* <p>
|
||||||
* Unsafe because of a cast to {@link Player} without any check beforehand
|
* Unsafe because of a cast to {@link Player} without any check beforehand
|
||||||
*
|
*
|
||||||
|
@ -10,9 +10,9 @@ import net.minestom.server.network.player.PlayerConnection;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an advancement located in an {@link AdvancementTab}
|
* Represents an advancement located in an {@link AdvancementTab}.
|
||||||
* <p>
|
* <p>
|
||||||
* All fields are dynamic, changing one will update the advancement in the specific {@link AdvancementTab}
|
* All fields are dynamic, changing one will update the advancement in the specific {@link AdvancementTab}.
|
||||||
*/
|
*/
|
||||||
public class Advancement {
|
public class Advancement {
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ public class Advancement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the advancement is achieved
|
* Gets if the advancement is achieved.
|
||||||
*
|
*
|
||||||
* @return true if the advancement is achieved
|
* @return true if the advancement is achieved
|
||||||
*/
|
*/
|
||||||
@ -66,7 +66,7 @@ public class Advancement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make the advancement achieved
|
* Makes the advancement achieved.
|
||||||
*
|
*
|
||||||
* @param achieved true to make it achieved
|
* @param achieved true to make it achieved
|
||||||
* @return this advancement
|
* @return this advancement
|
||||||
@ -78,7 +78,7 @@ public class Advancement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the advancement tab linked to this advancement
|
* Gets the advancement tab linked to this advancement.
|
||||||
*
|
*
|
||||||
* @return the {@link AdvancementTab} linked to this advancement
|
* @return the {@link AdvancementTab} linked to this advancement
|
||||||
*/
|
*/
|
||||||
@ -91,7 +91,7 @@ public class Advancement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the title of the advancement
|
* Gets the title of the advancement.
|
||||||
*
|
*
|
||||||
* @return the advancement title
|
* @return the advancement title
|
||||||
*/
|
*/
|
||||||
@ -100,7 +100,7 @@ public class Advancement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the advancement title
|
* Changes the advancement title.
|
||||||
*
|
*
|
||||||
* @param title the new title
|
* @param title the new title
|
||||||
*/
|
*/
|
||||||
@ -110,7 +110,7 @@ public class Advancement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the description of the advancement
|
* Gets the description of the advancement.
|
||||||
*
|
*
|
||||||
* @return the description title
|
* @return the description title
|
||||||
*/
|
*/
|
||||||
@ -119,7 +119,7 @@ public class Advancement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the description title
|
* Changes the description title.
|
||||||
*
|
*
|
||||||
* @param description the new description
|
* @param description the new description
|
||||||
*/
|
*/
|
||||||
@ -129,7 +129,7 @@ public class Advancement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the advancement icon
|
* Gets the advancement icon.
|
||||||
*
|
*
|
||||||
* @return the advancement icon
|
* @return the advancement icon
|
||||||
*/
|
*/
|
||||||
@ -138,7 +138,7 @@ public class Advancement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the advancement icon
|
* Changes the advancement icon.
|
||||||
*
|
*
|
||||||
* @param icon the new advancement icon
|
* @param icon the new advancement icon
|
||||||
*/
|
*/
|
||||||
@ -148,7 +148,7 @@ public class Advancement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if this advancement has a toast
|
* Gets if this advancement has a toast.
|
||||||
*
|
*
|
||||||
* @return true if the advancement has a toast
|
* @return true if the advancement has a toast
|
||||||
*/
|
*/
|
||||||
@ -157,7 +157,7 @@ public class Advancement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make this argument a toast
|
* Makes this argument a toast.
|
||||||
*
|
*
|
||||||
* @param toast true to make this advancement a toast
|
* @param toast true to make this advancement a toast
|
||||||
* @return this advancement
|
* @return this advancement
|
||||||
@ -178,7 +178,7 @@ public class Advancement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the advancement frame type
|
* Gets the advancement frame type.
|
||||||
*
|
*
|
||||||
* @return this advancement frame type
|
* @return this advancement frame type
|
||||||
*/
|
*/
|
||||||
@ -187,7 +187,7 @@ public class Advancement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the advancement frame type
|
* Changes the advancement frame type.
|
||||||
*
|
*
|
||||||
* @param frameType the new frame type
|
* @param frameType the new frame type
|
||||||
*/
|
*/
|
||||||
@ -197,7 +197,7 @@ public class Advancement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the X position of this advancement
|
* Gets the X position of this advancement.
|
||||||
*
|
*
|
||||||
* @return this advancement X
|
* @return this advancement X
|
||||||
*/
|
*/
|
||||||
@ -206,7 +206,7 @@ public class Advancement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change this advancement X coordinate
|
* Changes this advancement X coordinate.
|
||||||
*
|
*
|
||||||
* @param x the new X coordinate
|
* @param x the new X coordinate
|
||||||
*/
|
*/
|
||||||
@ -216,7 +216,7 @@ public class Advancement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Y position of this advancement
|
* Gets the Y position of this advancement.
|
||||||
*
|
*
|
||||||
* @return this advancement Y
|
* @return this advancement Y
|
||||||
*/
|
*/
|
||||||
@ -225,7 +225,7 @@ public class Advancement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change this advancement Y coordinate
|
* Changes this advancement Y coordinate.
|
||||||
*
|
*
|
||||||
* @param y the new Y coordinate
|
* @param y the new Y coordinate
|
||||||
*/
|
*/
|
||||||
@ -235,9 +235,9 @@ public class Advancement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the background
|
* Sets the background.
|
||||||
* <p>
|
* <p>
|
||||||
* Only available for {@link AdvancementRoot}
|
* Only available for {@link AdvancementRoot}.
|
||||||
*
|
*
|
||||||
* @param background the new background
|
* @param background the new background
|
||||||
*/
|
*/
|
||||||
@ -246,8 +246,8 @@ public class Advancement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the identifier of this advancement, used to register the advancement, use it as a parent and to retrieve it later
|
* Gets the identifier of this advancement, used to register the advancement, use it as a parent and to retrieve it later
|
||||||
* in the {@link AdvancementTab}
|
* in the {@link AdvancementTab}.
|
||||||
*
|
*
|
||||||
* @return the advancement identifier
|
* @return the advancement identifier
|
||||||
*/
|
*/
|
||||||
@ -256,9 +256,9 @@ public class Advancement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the advancement identifier
|
* Changes the advancement identifier.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: unsafe, only used by {@link AdvancementTab} to intialize the advancement
|
* WARNING: unsafe, only used by {@link AdvancementTab} to initialize the advancement.
|
||||||
*
|
*
|
||||||
* @param identifier the new advancement identifier
|
* @param identifier the new advancement identifier
|
||||||
*/
|
*/
|
||||||
@ -267,7 +267,7 @@ public class Advancement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the advancement parent
|
* Gets the advancement parent.
|
||||||
*
|
*
|
||||||
* @return the advancement parent, null for {@link AdvancementRoot}
|
* @return the advancement parent, null for {@link AdvancementRoot}
|
||||||
*/
|
*/
|
||||||
@ -307,7 +307,7 @@ public class Advancement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert this advancement to an {@link AdvancementsPacket.AdvancementMapping}
|
* Converts this advancement to an {@link AdvancementsPacket.AdvancementMapping}.
|
||||||
*
|
*
|
||||||
* @return the mapping of this advancement
|
* @return the mapping of this advancement
|
||||||
*/
|
*/
|
||||||
@ -338,7 +338,7 @@ public class Advancement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the packet used to add this advancement to the already existing tab
|
* Gets the packet used to add this advancement to the already existing tab.
|
||||||
*
|
*
|
||||||
* @return the packet to add this advancement
|
* @return the packet to add this advancement
|
||||||
*/
|
*/
|
||||||
@ -356,7 +356,7 @@ public class Advancement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send update to all tab viewers if one of the advancement value changes
|
* Sends update to all tab viewers if one of the advancement value changes.
|
||||||
*/
|
*/
|
||||||
protected void update() {
|
protected void update() {
|
||||||
updateCriteria();
|
updateCriteria();
|
||||||
|
@ -7,16 +7,16 @@ import java.util.Map;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to manage all the registered {@link AdvancementTab}
|
* Used to manage all the registered {@link AdvancementTab}.
|
||||||
* <p>
|
* <p>
|
||||||
* Use {@link #createTab(String, AdvancementRoot)} to create a tab with the appropriate {@link AdvancementRoot}
|
* Use {@link #createTab(String, AdvancementRoot)} to create a tab with the appropriate {@link AdvancementRoot}.
|
||||||
*/
|
*/
|
||||||
public class AdvancementManager {
|
public class AdvancementManager {
|
||||||
|
|
||||||
private final Map<String, AdvancementTab> advancementTabMap = new ConcurrentHashMap<>();
|
private final Map<String, AdvancementTab> advancementTabMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new {@link AdvancementTab} with a single {@link AdvancementRoot}
|
* Creates a new {@link AdvancementTab} with a single {@link AdvancementRoot}.
|
||||||
*
|
*
|
||||||
* @param rootIdentifier the root identifier
|
* @param rootIdentifier the root identifier
|
||||||
* @param root the root advancement
|
* @param root the root advancement
|
||||||
@ -32,17 +32,17 @@ public class AdvancementManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an advancement tab by its root identifier
|
* Gets an advancement tab by its root identifier.
|
||||||
*
|
*
|
||||||
* @param rootIdentifier the root identifier of the tab
|
* @param rootIdentifier the root identifier of the tab
|
||||||
* @return the {@link AdvancementTab} associated with the identifer, null if not any
|
* @return the {@link AdvancementTab} associated with the identifier, null if not any
|
||||||
*/
|
*/
|
||||||
public AdvancementTab getTab(String rootIdentifier) {
|
public AdvancementTab getTab(String rootIdentifier) {
|
||||||
return advancementTabMap.get(rootIdentifier);
|
return advancementTabMap.get(rootIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the created {@link AdvancementTab}
|
* Gets all the created {@link AdvancementTab}.
|
||||||
*
|
*
|
||||||
* @return the collection containing all created {@link AdvancementTab}
|
* @return the collection containing all created {@link AdvancementTab}
|
||||||
*/
|
*/
|
||||||
|
@ -12,13 +12,13 @@ import net.minestom.server.utils.validate.Check;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a tab which can be shared between multiple players
|
* Represents a tab which can be shared between multiple players.
|
||||||
* <p>
|
* <p>
|
||||||
* Each tab requires a root advancement and all succeeding advancements need to have a parent in the tab.
|
* Each tab requires a root advancement and all succeeding advancements need to have a parent in the tab.
|
||||||
* You can create a new advancement using {@link #createAdvancement(String, Advancement, Advancement)}
|
* You can create a new advancement using {@link #createAdvancement(String, Advancement, Advancement)}.
|
||||||
* <p>
|
* <p>
|
||||||
* Be sure to use {@link #addViewer(Player)} and {@link #removeViewer(Player)} to control which players can see this tab.
|
* Be sure to use {@link #addViewer(Player)} and {@link #removeViewer(Player)} to control which players can see this tab.
|
||||||
* (all viewers will see the same tab, with the same amount of validated advancements etc... so shared)
|
* (all viewers will see the same tab, with the same amount of validated advancements etc... so shared).
|
||||||
*/
|
*/
|
||||||
public class AdvancementTab implements Viewable {
|
public class AdvancementTab implements Viewable {
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ public class AdvancementTab implements Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the tabs of a viewer
|
* Gets all the tabs of a viewer.
|
||||||
*
|
*
|
||||||
* @param player the player to get the tabs from
|
* @param player the player to get the tabs from
|
||||||
* @return all the advancement tabs that the player sees
|
* @return all the advancement tabs that the player sees
|
||||||
@ -57,7 +57,7 @@ public class AdvancementTab implements Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the root advancement of this tab
|
* Gets the root advancement of this tab.
|
||||||
*
|
*
|
||||||
* @return the root advancement
|
* @return the root advancement
|
||||||
*/
|
*/
|
||||||
@ -66,7 +66,7 @@ public class AdvancementTab implements Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and add an advancement into this tab
|
* Creates and add an advancement into this tab.
|
||||||
*
|
*
|
||||||
* @param identifier the unique identifier
|
* @param identifier the unique identifier
|
||||||
* @param advancement the advancement to add
|
* @param advancement the advancement to add
|
||||||
@ -84,14 +84,14 @@ public class AdvancementTab implements Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the packet buffer
|
* Updates the packet buffer.
|
||||||
*/
|
*/
|
||||||
protected void updatePacket() {
|
protected void updatePacket() {
|
||||||
this.createBuffer = PacketUtils.writePacket(createPacket());
|
this.createBuffer = PacketUtils.writePacket(createPacket());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the packet which build the whole advancement tab
|
* Builds the packet which build the whole advancement tab.
|
||||||
*
|
*
|
||||||
* @return the packet adding this advancement tab and all its advancements
|
* @return the packet adding this advancement tab and all its advancements
|
||||||
*/
|
*/
|
||||||
@ -172,7 +172,7 @@ public class AdvancementTab implements Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the tab to the player set
|
* Adds the tab to the player set.
|
||||||
*
|
*
|
||||||
* @param player the player
|
* @param player the player
|
||||||
*/
|
*/
|
||||||
@ -182,7 +182,7 @@ public class AdvancementTab implements Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the tab from the player set
|
* Removes the tab from the player set.
|
||||||
*
|
*
|
||||||
* @param player the player
|
* @param player the player
|
||||||
*/
|
*/
|
||||||
|
@ -7,7 +7,7 @@ import net.minestom.server.item.Material;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represent a message which can be send using the {@link NotificationCenter}
|
* Represents a message which can be send using the {@link NotificationCenter}.
|
||||||
*/
|
*/
|
||||||
public class Notification {
|
public class Notification {
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ public class Notification {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the title of the notification
|
* Gets the title of the notification.
|
||||||
*
|
*
|
||||||
* @return the notification title
|
* @return the notification title
|
||||||
*/
|
*/
|
||||||
@ -38,7 +38,7 @@ public class Notification {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link FrameType} of the notification
|
* Gets the {@link FrameType} of the notification.
|
||||||
*
|
*
|
||||||
* @return the notification frame type
|
* @return the notification frame type
|
||||||
*/
|
*/
|
||||||
@ -48,7 +48,7 @@ public class Notification {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the icon of the notification
|
* Gets the icon of the notification.
|
||||||
*
|
*
|
||||||
* @return the notification icon
|
* @return the notification icon
|
||||||
*/
|
*/
|
||||||
|
@ -89,7 +89,7 @@ public final class BenchmarkManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the memory used by the server in bytes
|
* Gets the memory used by the server in bytes.
|
||||||
*
|
*
|
||||||
* @return the memory used by the server
|
* @return the memory used by the server
|
||||||
*/
|
*/
|
||||||
|
@ -32,7 +32,7 @@ public class BossBar implements Viewable {
|
|||||||
private byte flags;
|
private byte flags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new {@link BossBar}
|
* Creates a new {@link BossBar}.
|
||||||
*
|
*
|
||||||
* @param title the boss bar title
|
* @param title the boss bar title
|
||||||
* @param color the boss bar color
|
* @param color the boss bar color
|
||||||
@ -45,7 +45,7 @@ public class BossBar implements Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the visible boss bars of a {@link Player}
|
* Gets all the visible boss bars of a {@link Player}.
|
||||||
*
|
*
|
||||||
* @param player the player to check the boss bars
|
* @param player the player to check the boss bars
|
||||||
* @return all the visible boss bars of the player, null if not any
|
* @return all the visible boss bars of the player, null if not any
|
||||||
@ -88,7 +88,7 @@ public class BossBar implements Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the bossbar title
|
* Gets the bossbar title.
|
||||||
*
|
*
|
||||||
* @return the current title of the bossbar
|
* @return the current title of the bossbar
|
||||||
*/
|
*/
|
||||||
@ -97,7 +97,7 @@ public class BossBar implements Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the bossbar title
|
* Changes the bossbar title.
|
||||||
*
|
*
|
||||||
* @param title the new title of the bossbar
|
* @param title the new title of the bossbar
|
||||||
*/
|
*/
|
||||||
@ -106,7 +106,7 @@ public class BossBar implements Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the bossbar progress
|
* Gets the bossbar progress.
|
||||||
*
|
*
|
||||||
* @return the current progress of the bossbar
|
* @return the current progress of the bossbar
|
||||||
*/
|
*/
|
||||||
@ -115,7 +115,7 @@ public class BossBar implements Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the bossbar progress
|
* Changes the bossbar progress.
|
||||||
*
|
*
|
||||||
* @param progress the new progress bar percentage
|
* @param progress the new progress bar percentage
|
||||||
* @throws IllegalArgumentException if {@code progress} is not between 0 and 1
|
* @throws IllegalArgumentException if {@code progress} is not between 0 and 1
|
||||||
@ -128,7 +128,7 @@ public class BossBar implements Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the bossbar color
|
* Gets the bossbar color.
|
||||||
*
|
*
|
||||||
* @return the current bossbar color
|
* @return the current bossbar color
|
||||||
*/
|
*/
|
||||||
@ -137,7 +137,7 @@ public class BossBar implements Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the bossbar color
|
* Changes the bossbar color.
|
||||||
*
|
*
|
||||||
* @param color the new color of the bossbar
|
* @param color the new color of the bossbar
|
||||||
*/
|
*/
|
||||||
@ -147,7 +147,7 @@ public class BossBar implements Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the bossbar division
|
* Gets the bossbar division.
|
||||||
*
|
*
|
||||||
* @return the current bossbar division
|
* @return the current bossbar division
|
||||||
*/
|
*/
|
||||||
@ -156,7 +156,7 @@ public class BossBar implements Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the bossbar division
|
* Changes the bossbar division.
|
||||||
*
|
*
|
||||||
* @param division the new bossbar division count
|
* @param division the new bossbar division count
|
||||||
*/
|
*/
|
||||||
@ -166,7 +166,7 @@ public class BossBar implements Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the bossbar flags
|
* Gets the bossbar flags.
|
||||||
*
|
*
|
||||||
* @return the flags
|
* @return the flags
|
||||||
*/
|
*/
|
||||||
@ -175,7 +175,7 @@ public class BossBar implements Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the bossbar flags
|
* Sets the bossbar flags.
|
||||||
*
|
*
|
||||||
* @param flags the bossbar flags
|
* @param flags the bossbar flags
|
||||||
* @see <a href="https://wiki.vg/Protocol#Boss_Bar">Boss bar packet</a>
|
* @see <a href="https://wiki.vg/Protocol#Boss_Bar">Boss bar packet</a>
|
||||||
@ -185,7 +185,7 @@ public class BossBar implements Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the boss bar and remove all of its viewers
|
* Deletes the boss bar and remove all of its viewers.
|
||||||
*/
|
*/
|
||||||
public void delete() {
|
public void delete() {
|
||||||
BossBarPacket bossBarPacket = new BossBarPacket();
|
BossBarPacket bossBarPacket = new BossBarPacket();
|
||||||
|
@ -10,7 +10,7 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represent a color in a text
|
* Represents a color in a text.
|
||||||
*/
|
*/
|
||||||
public class ChatColor {
|
public class ChatColor {
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ public class ChatColor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an RGB color
|
* Creates an RGB color.
|
||||||
*
|
*
|
||||||
* @param r the red component
|
* @param r the red component
|
||||||
* @param g the green component
|
* @param g the green component
|
||||||
@ -157,7 +157,7 @@ public class ChatColor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a color based on its name (eg: white, black, aqua, etc...)
|
* Gets a color based on its name (eg: white, black, aqua, etc...).
|
||||||
*
|
*
|
||||||
* @param name the color name
|
* @param name the color name
|
||||||
* @return the color associated with the name, {@link #NO_COLOR} if not found
|
* @return the color associated with the name, {@link #NO_COLOR} if not found
|
||||||
@ -167,7 +167,7 @@ public class ChatColor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a color based on its numerical id (0;15)
|
* Gets a color based on its numerical id (0;15).
|
||||||
*
|
*
|
||||||
* @param id the id of the color
|
* @param id the id of the color
|
||||||
* @return the color associated with the id, {@link #NO_COLOR} if not found
|
* @return the color associated with the id, {@link #NO_COLOR} if not found
|
||||||
@ -177,7 +177,7 @@ public class ChatColor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a color based on its legacy color code (eg: 1, 2, 3,... f)
|
* Gets a color based on its legacy color code (eg: 1, 2, 3,... f).
|
||||||
*
|
*
|
||||||
* @param colorCode the color legacy code
|
* @param colorCode the color legacy code
|
||||||
* @return the color associated with the code
|
* @return the color associated with the code
|
||||||
@ -191,7 +191,7 @@ public class ChatColor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the red component of the color
|
* Gets the red component of the color.
|
||||||
*
|
*
|
||||||
* @return the red component of the color
|
* @return the red component of the color
|
||||||
*/
|
*/
|
||||||
@ -200,7 +200,7 @@ public class ChatColor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the green component of the color
|
* Gets the green component of the color.
|
||||||
*
|
*
|
||||||
* @return the green component of the color
|
* @return the green component of the color
|
||||||
*/
|
*/
|
||||||
@ -209,7 +209,7 @@ public class ChatColor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the blue component of the color
|
* Gets the blue component of the color.
|
||||||
*
|
*
|
||||||
* @return the blue component of the color
|
* @return the blue component of the color
|
||||||
*/
|
*/
|
||||||
@ -218,7 +218,7 @@ public class ChatColor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the color is special (eg: no color, bold, reset, etc...)
|
* Gets if the color is special (eg: no color, bold, reset, etc...).
|
||||||
*
|
*
|
||||||
* @return true if the color is special, false otherwise
|
* @return true if the color is special, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -227,7 +227,7 @@ public class ChatColor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the code name is the color is "special"
|
* Gets the code name is the color is "special".
|
||||||
*
|
*
|
||||||
* @return the special code name
|
* @return the special code name
|
||||||
*/
|
*/
|
||||||
|
@ -7,14 +7,14 @@ import com.google.gson.JsonObject;
|
|||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class used to convert JSON string to proper chat message representation
|
* Class used to convert JSON string to proper chat message representation.
|
||||||
*/
|
*/
|
||||||
public final class ChatParser {
|
public final class ChatParser {
|
||||||
|
|
||||||
public static final char COLOR_CHAR = (char) 0xA7; // Represent the character '§'
|
public static final char COLOR_CHAR = (char) 0xA7; // Represent the character '§'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a simple colored message json (text/color) to a {@link ColoredText}
|
* Converts a simple colored message json (text/color) to a {@link ColoredText}.
|
||||||
*
|
*
|
||||||
* @param json the json containing the text and color
|
* @param json the json containing the text and color
|
||||||
* @return a {@link ColoredText} representing the text
|
* @return a {@link ColoredText} representing the text
|
||||||
@ -39,7 +39,7 @@ public final class ChatParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the format representing of a single text component (text + color key)
|
* Gets the format representing of a single text component (text + color key).
|
||||||
*
|
*
|
||||||
* @param textObject the text component to parse
|
* @param textObject the text component to parse
|
||||||
* @return the colored text format of the text component
|
* @return the colored text format of the text component
|
||||||
|
@ -9,9 +9,9 @@ import java.util.List;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represent a text with one or multiple colors
|
* Represents a text with one or multiple colors.
|
||||||
* <p>
|
* <p>
|
||||||
* Used when the message can contain colors but not events like in {@link RichMessage}
|
* Used when the message can contain colors but not events like in {@link RichMessage}.
|
||||||
*/
|
*/
|
||||||
public class ColoredText extends JsonMessage {
|
public class ColoredText extends JsonMessage {
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ public class ColoredText extends JsonMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a {@link ColoredText}
|
* Creates a {@link ColoredText}.
|
||||||
*
|
*
|
||||||
* @param color the text color
|
* @param color the text color
|
||||||
* @param message the text message
|
* @param message the text message
|
||||||
@ -35,7 +35,7 @@ public class ColoredText extends JsonMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a {@link ColoredText}
|
* Creates a {@link ColoredText}.
|
||||||
*
|
*
|
||||||
* @param message the text message
|
* @param message the text message
|
||||||
* @return the created {@link ColoredText}
|
* @return the created {@link ColoredText}
|
||||||
@ -45,7 +45,7 @@ public class ColoredText extends JsonMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a {@link ColoredText} with a legacy text
|
* Creates a {@link ColoredText} with a legacy text.
|
||||||
*
|
*
|
||||||
* @param message the text message
|
* @param message the text message
|
||||||
* @param colorChar the char used before the color code
|
* @param colorChar the char used before the color code
|
||||||
@ -58,7 +58,7 @@ public class ColoredText extends JsonMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append the text
|
* Appends the text.
|
||||||
*
|
*
|
||||||
* @param color the text color
|
* @param color the text color
|
||||||
* @param message the text message
|
* @param message the text message
|
||||||
@ -71,7 +71,7 @@ public class ColoredText extends JsonMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append the text
|
* Appends the text.
|
||||||
*
|
*
|
||||||
* @param message the text message
|
* @param message the text message
|
||||||
* @return this {@link ColoredText}
|
* @return this {@link ColoredText}
|
||||||
@ -81,7 +81,7 @@ public class ColoredText extends JsonMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add legacy text
|
* Adds legacy text.
|
||||||
*
|
*
|
||||||
* @param message the legacy text
|
* @param message the legacy text
|
||||||
* @param colorChar the char used before the color code
|
* @param colorChar the char used before the color code
|
||||||
@ -93,7 +93,7 @@ public class ColoredText extends JsonMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the raw text
|
* Gets the raw text.
|
||||||
*
|
*
|
||||||
* @return the raw text
|
* @return the raw text
|
||||||
*/
|
*/
|
||||||
@ -102,9 +102,9 @@ public class ColoredText extends JsonMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Json representation of this colored text
|
* Gets the Json representation of this colored text.
|
||||||
* <p>
|
* <p>
|
||||||
* Used to send a message
|
* Used to send a message.
|
||||||
*
|
*
|
||||||
* @return the Json representation of the text
|
* @return the Json representation of the text
|
||||||
*/
|
*/
|
||||||
@ -134,7 +134,7 @@ public class ColoredText extends JsonMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the list of objects composing the message
|
* Gets the list of objects composing the message.
|
||||||
*
|
*
|
||||||
* @return the list of objects composing the message
|
* @return the list of objects composing the message
|
||||||
*/
|
*/
|
||||||
@ -255,7 +255,7 @@ public class ColoredText extends JsonMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the object representing a message (raw/keybind/translatable)
|
* Gets the object representing a message (raw/keybind/translatable).
|
||||||
*
|
*
|
||||||
* @param messageType the message type
|
* @param messageType the message type
|
||||||
* @param message the message
|
* @param message the message
|
||||||
@ -295,7 +295,7 @@ public class ColoredText extends JsonMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a legacy text to our format which can be used by {@link #of(String)} etc...
|
* Converts a legacy text to our format which can be used by {@link #of(String)} etc...
|
||||||
* <p>
|
* <p>
|
||||||
* eg: "&fHey" -> "{#white}Hey"
|
* eg: "&fHey" -> "{#white}Hey"
|
||||||
*
|
*
|
||||||
@ -327,14 +327,14 @@ public class ColoredText extends JsonMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an element which can change based on the client which receive the text
|
* Represents an element which can change based on the client which receive the text.
|
||||||
*/
|
*/
|
||||||
private enum MessageType {
|
private enum MessageType {
|
||||||
RAW, KEYBIND, TRANSLATABLE
|
RAW, KEYBIND, TRANSLATABLE
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to keep a "color" state in the text
|
* Used to keep a "color" state in the text.
|
||||||
*/
|
*/
|
||||||
private static class SpecialComponentContainer {
|
private static class SpecialComponentContainer {
|
||||||
boolean bold = false;
|
boolean bold = false;
|
||||||
|
@ -3,9 +3,9 @@ package net.minestom.server.chat;
|
|||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represent a json message which can be send to a player
|
* Represents a json message which can be send to a player.
|
||||||
* <p>
|
* <p>
|
||||||
* Examples are {@link ColoredText} and {@link RichMessage}
|
* Examples are {@link ColoredText} and {@link RichMessage}.
|
||||||
*
|
*
|
||||||
* @see <a href="https://wiki.vg/Chat">Chat Format</a>
|
* @see <a href="https://wiki.vg/Chat">Chat Format</a>
|
||||||
*/
|
*/
|
||||||
@ -17,23 +17,23 @@ public abstract class JsonMessage {
|
|||||||
private String compiledJson;
|
private String compiledJson;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the json representation of this message
|
* Gets the json representation of this message.
|
||||||
* <p>
|
* <p>
|
||||||
* Sent directly to the client
|
* Sent directly to the client.
|
||||||
*
|
*
|
||||||
* @return the json representation of the message
|
* @return the json representation of the message
|
||||||
*/
|
*/
|
||||||
public abstract JsonObject getJsonObject();
|
public abstract JsonObject getJsonObject();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signal that the final json string changed and that it will need to be updated
|
* Signals that the final json string changed and that it will need to be updated.
|
||||||
*/
|
*/
|
||||||
protected void refreshUpdate() {
|
protected void refreshUpdate() {
|
||||||
this.updated = false;
|
this.updated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the string json representation
|
* Gets the string json representation.
|
||||||
*
|
*
|
||||||
* @return the string json representation
|
* @return the string json representation
|
||||||
*/
|
*/
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.minestom.server.chat;
|
package net.minestom.server.chat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represent a translatable component which can be used in {@link ColoredText}
|
* Represents a translatable component which can be used in {@link ColoredText}.
|
||||||
*/
|
*/
|
||||||
public class TranslatableText {
|
public class TranslatableText {
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ public class TranslatableText {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the translatable component of the specific code
|
* Gets the translatable component of the specific code.
|
||||||
*
|
*
|
||||||
* @param code the translatable code
|
* @param code the translatable code
|
||||||
* @return the translatable component linked to the code
|
* @return the translatable component linked to the code
|
||||||
@ -24,7 +24,7 @@ public class TranslatableText {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the translatable component and the specific code with arguments
|
* Gets the translatable component and the specific code with arguments.
|
||||||
*
|
*
|
||||||
* @param code the translatable code
|
* @param code the translatable code
|
||||||
* @param arguments the translatable component arguments in order
|
* @param arguments the translatable component arguments in order
|
||||||
|
@ -14,7 +14,7 @@ public class BoundingBox {
|
|||||||
private float x, y, z;
|
private float x, y, z;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a {@link BoundingBox} linked to an {@link Entity} and with a specific size
|
* Creates a {@link BoundingBox} linked to an {@link Entity} and with a specific size.
|
||||||
*
|
*
|
||||||
* @param entity the linked entity
|
* @param entity the linked entity
|
||||||
* @param x the width size
|
* @param x the width size
|
||||||
@ -29,7 +29,7 @@ public class BoundingBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to know if two {@link BoundingBox} intersect with each other
|
* Used to know if two {@link BoundingBox} intersect with each other.
|
||||||
*
|
*
|
||||||
* @param boundingBox the {@link BoundingBox} to check
|
* @param boundingBox the {@link BoundingBox} to check
|
||||||
* @return true if the two {@link BoundingBox} intersect with each other, false otherwise
|
* @return true if the two {@link BoundingBox} intersect with each other, false otherwise
|
||||||
@ -41,7 +41,7 @@ public class BoundingBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to know if this {@link BoundingBox} intersects with the bounding box of an entity
|
* Used to know if this {@link BoundingBox} intersects with the bounding box of an entity.
|
||||||
*
|
*
|
||||||
* @param entity the entity to check the bounding box
|
* @param entity the entity to check the bounding box
|
||||||
* @return true if this bounding box intersects with the entity, false otherwise
|
* @return true if this bounding box intersects with the entity, false otherwise
|
||||||
@ -51,7 +51,7 @@ public class BoundingBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to know if the bounding box intersects at a {@link BlockPosition}
|
* Used to know if the bounding box intersects at a {@link BlockPosition}.
|
||||||
*
|
*
|
||||||
* @param blockPosition the position to check
|
* @param blockPosition the position to check
|
||||||
* @return true if the bounding box intersects with the position, false otherwise
|
* @return true if the bounding box intersects with the position, false otherwise
|
||||||
@ -95,7 +95,7 @@ public class BoundingBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new {@link BoundingBox} linked to the same {@link Entity} with expanded size
|
* Creates a new {@link BoundingBox} linked to the same {@link Entity} with expanded size.
|
||||||
*
|
*
|
||||||
* @param x the X offset
|
* @param x the X offset
|
||||||
* @param y the Y offset
|
* @param y the Y offset
|
||||||
@ -107,7 +107,7 @@ public class BoundingBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new {@link BoundingBox} linked to the same {@link Entity} with contracted size
|
* Creates a new {@link BoundingBox} linked to the same {@link Entity} with contracted size.
|
||||||
*
|
*
|
||||||
* @param x the X offset
|
* @param x the X offset
|
||||||
* @param y the Y offset
|
* @param y the Y offset
|
||||||
@ -119,7 +119,7 @@ public class BoundingBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the width of the {@link BoundingBox}
|
* Gets the width of the {@link BoundingBox}.
|
||||||
*
|
*
|
||||||
* @return the width
|
* @return the width
|
||||||
*/
|
*/
|
||||||
@ -128,7 +128,7 @@ public class BoundingBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the height of the {@link BoundingBox}
|
* Gets the height of the {@link BoundingBox}.
|
||||||
*
|
*
|
||||||
* @return the height
|
* @return the height
|
||||||
*/
|
*/
|
||||||
@ -137,7 +137,7 @@ public class BoundingBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the depth of the {@link BoundingBox}
|
* Gets the depth of the {@link BoundingBox}.
|
||||||
*
|
*
|
||||||
* @return the depth
|
* @return the depth
|
||||||
*/
|
*/
|
||||||
@ -146,7 +146,7 @@ public class BoundingBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the min X based on {@link #getWidth()} and the {@link Entity} position
|
* Gets the min X based on {@link #getWidth()} and the {@link Entity} position.
|
||||||
*
|
*
|
||||||
* @return the min X
|
* @return the min X
|
||||||
*/
|
*/
|
||||||
@ -155,7 +155,7 @@ public class BoundingBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the max X based on {@link #getWidth()} and the {@link Entity} position
|
* Gets the max X based on {@link #getWidth()} and the {@link Entity} position.
|
||||||
*
|
*
|
||||||
* @return the max X
|
* @return the max X
|
||||||
*/
|
*/
|
||||||
@ -164,7 +164,7 @@ public class BoundingBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the min Y based on the {@link Entity} position
|
* Gets the min Y based on the {@link Entity} position.
|
||||||
*
|
*
|
||||||
* @return the min Y
|
* @return the min Y
|
||||||
*/
|
*/
|
||||||
@ -173,7 +173,7 @@ public class BoundingBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the max Y based on {@link #getHeight()} and the {@link Entity} position
|
* Gets the max Y based on {@link #getHeight()} and the {@link Entity} position.
|
||||||
*
|
*
|
||||||
* @return the max Y
|
* @return the max Y
|
||||||
*/
|
*/
|
||||||
@ -182,7 +182,7 @@ public class BoundingBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the min Z based on {@link #getDepth()} and the {@link Entity} position
|
* Gets the min Z based on {@link #getDepth()} and the {@link Entity} position.
|
||||||
*
|
*
|
||||||
* @return the min Z
|
* @return the min Z
|
||||||
*/
|
*/
|
||||||
@ -191,7 +191,7 @@ public class BoundingBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the max Z based on {@link #getDepth()} and the {@link Entity} position
|
* Gets the max Z based on {@link #getDepth()} and the {@link Entity} position.
|
||||||
*
|
*
|
||||||
* @return the max Z
|
* @return the max Z
|
||||||
*/
|
*/
|
||||||
@ -200,7 +200,7 @@ public class BoundingBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an array of {@link Vector} representing the points at the bottom of the {@link BoundingBox}
|
* Gets an array of {@link Vector} representing the points at the bottom of the {@link BoundingBox}.
|
||||||
*
|
*
|
||||||
* @return the points at the bottom of the {@link BoundingBox}
|
* @return the points at the bottom of the {@link BoundingBox}
|
||||||
*/
|
*/
|
||||||
@ -214,7 +214,7 @@ public class BoundingBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an array of {@link Vector} representing the points at the top of the {@link BoundingBox}
|
* Gets an array of {@link Vector} representing the points at the top of the {@link BoundingBox}.
|
||||||
*
|
*
|
||||||
* @return the points at the top of the {@link BoundingBox}
|
* @return the points at the top of the {@link BoundingBox}
|
||||||
*/
|
*/
|
||||||
@ -228,7 +228,7 @@ public class BoundingBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an array of {@link Vector} representing the points on the left face of the {@link BoundingBox}
|
* Gets an array of {@link Vector} representing the points on the left face of the {@link BoundingBox}.
|
||||||
*
|
*
|
||||||
* @return the points on the left face of the {@link BoundingBox}
|
* @return the points on the left face of the {@link BoundingBox}
|
||||||
*/
|
*/
|
||||||
@ -242,7 +242,7 @@ public class BoundingBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an array of {@link Vector} representing the points on the right face of the {@link BoundingBox}
|
* Gets an array of {@link Vector} representing the points on the right face of the {@link BoundingBox}.
|
||||||
*
|
*
|
||||||
* @return the points on the right face of the {@link BoundingBox}
|
* @return the points on the right face of the {@link BoundingBox}
|
||||||
*/
|
*/
|
||||||
@ -256,7 +256,7 @@ public class BoundingBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an array of {@link Vector} representing the points at the front of the {@link BoundingBox}
|
* Gets an array of {@link Vector} representing the points at the front of the {@link BoundingBox}.
|
||||||
*
|
*
|
||||||
* @return the points at the front of the {@link BoundingBox}
|
* @return the points at the front of the {@link BoundingBox}
|
||||||
*/
|
*/
|
||||||
@ -270,7 +270,7 @@ public class BoundingBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an array of {@link Vector} representing the points at the back of the {@link BoundingBox}
|
* Gets an array of {@link Vector} representing the points at the back of the {@link BoundingBox}.
|
||||||
*
|
*
|
||||||
* @return the points at the back of the {@link BoundingBox}
|
* @return the points at the back of the {@link BoundingBox}
|
||||||
*/
|
*/
|
||||||
|
@ -62,16 +62,16 @@ public final class CommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop the console responsible for the console commands processing
|
* Stops the console responsible for the console commands processing.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: it cannot be re-run later
|
* WARNING: it cannot be re-run later.
|
||||||
*/
|
*/
|
||||||
public void stopConsoleThread() {
|
public void stopConsoleThread() {
|
||||||
running = false;
|
running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a {@link Command}
|
* Registers a {@link Command}.
|
||||||
*
|
*
|
||||||
* @param command the command to register
|
* @param command the command to register
|
||||||
*/
|
*/
|
||||||
@ -80,7 +80,7 @@ public final class CommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link Command} registered by {@link #register(Command)}
|
* Gets the {@link Command} registered by {@link #register(Command)}.
|
||||||
*
|
*
|
||||||
* @param commandName the command name
|
* @param commandName the command name
|
||||||
* @return the command associated with the name, null if not any
|
* @return the command associated with the name, null if not any
|
||||||
@ -90,7 +90,7 @@ public final class CommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a {@link CommandProcessor}
|
* Registers a {@link CommandProcessor}.
|
||||||
*
|
*
|
||||||
* @param commandProcessor the command to register
|
* @param commandProcessor the command to register
|
||||||
*/
|
*/
|
||||||
@ -106,7 +106,7 @@ public final class CommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link CommandProcessor} registered by {@link #register(CommandProcessor)}
|
* Gets the {@link CommandProcessor} registered by {@link #register(CommandProcessor)}.
|
||||||
*
|
*
|
||||||
* @param commandName the command name
|
* @param commandName the command name
|
||||||
* @return the command associated with the name, null if not any
|
* @return the command associated with the name, null if not any
|
||||||
@ -116,7 +116,7 @@ public final class CommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute a command for a {@link ConsoleSender}
|
* Executes a command for a {@link ConsoleSender}.
|
||||||
*
|
*
|
||||||
* @param sender the sender of the command
|
* @param sender the sender of the command
|
||||||
* @param command the raw command string (without the command prefix)
|
* @param command the raw command string (without the command prefix)
|
||||||
@ -161,7 +161,7 @@ public final class CommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link ConsoleSender} (which is used as a {@link CommandSender})
|
* Gets the {@link ConsoleSender} (which is used as a {@link CommandSender}).
|
||||||
*
|
*
|
||||||
* @return the {@link ConsoleSender}
|
* @return the {@link ConsoleSender}
|
||||||
*/
|
*/
|
||||||
@ -170,9 +170,9 @@ public final class CommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link DeclareCommandsPacket} for a specific player
|
* Gets the {@link DeclareCommandsPacket} for a specific player.
|
||||||
* <p>
|
* <p>
|
||||||
* Can be used to update the {@link Player} auto-completion list
|
* Can be used to update the {@link Player} auto-completion list.
|
||||||
*
|
*
|
||||||
* @param player the player to get the commands packet
|
* @param player the player to get the commands packet
|
||||||
* @return the {@link DeclareCommandsPacket} for {@code player}
|
* @return the {@link DeclareCommandsPacket} for {@code player}
|
||||||
@ -182,7 +182,7 @@ public final class CommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the {@link DeclareCommandsPacket} for a {@link Player}
|
* Builds the {@link DeclareCommandsPacket} for a {@link Player}.
|
||||||
*
|
*
|
||||||
* @param player the player to build the packet for
|
* @param player the player to build the packet for
|
||||||
* @return the commands packet for the specific player
|
* @return the commands packet for the specific player
|
||||||
@ -274,7 +274,7 @@ public final class CommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a command's syntaxes to the nodes list
|
* Adds a command's syntaxes to the nodes list.
|
||||||
*
|
*
|
||||||
* @param nodes the nodes of the packet
|
* @param nodes the nodes of the packet
|
||||||
* @param cmdChildren the main root of this command
|
* @param cmdChildren the main root of this command
|
||||||
@ -356,7 +356,7 @@ public final class CommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert an argument to a node with the correct brigadier parser
|
* Converts an argument to a node with the correct brigadier parser.
|
||||||
*
|
*
|
||||||
* @param argument the argument to convert
|
* @param argument the argument to convert
|
||||||
* @param executable true if this is the last argument, false otherwise
|
* @param executable true if this is the last argument, false otherwise
|
||||||
@ -527,7 +527,7 @@ public final class CommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build an argument nod and add it to the nodes list
|
* Builds an argument nod and add it to the nodes list.
|
||||||
*
|
*
|
||||||
* @param nodes the current nodes list
|
* @param nodes the current nodes list
|
||||||
* @param argument the argument
|
* @param argument the argument
|
||||||
|
@ -14,14 +14,14 @@ import net.minestom.server.entity.Player;
|
|||||||
public interface CommandProcessor {
|
public interface CommandProcessor {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the main command's name.
|
* Gets the main command's name.
|
||||||
*
|
*
|
||||||
* @return the main command's name
|
* @return the main command's name
|
||||||
*/
|
*/
|
||||||
String getCommandName();
|
String getCommandName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the command's aliases.
|
* Gets the command's aliases.
|
||||||
* <p>
|
* <p>
|
||||||
* Can be null or empty.
|
* Can be null or empty.
|
||||||
*
|
*
|
||||||
@ -43,7 +43,7 @@ public interface CommandProcessor {
|
|||||||
* Called to know if a player has access to the command.
|
* Called to know if a player has access to the command.
|
||||||
* <p>
|
* <p>
|
||||||
* Right now it is only used to know if the player should see the command in auto-completion
|
* Right now it is only used to know if the player should see the command in auto-completion
|
||||||
* Conditions still need to be checked in {@link #process(CommandSender, String, String[])}
|
* Conditions still need to be checked in {@link #process(CommandSender, String, String[])}.
|
||||||
*
|
*
|
||||||
* @param player the player to check the access
|
* @param player the player to check the access
|
||||||
* @return true if the player has access to the command, false otherwise
|
* @return true if the player has access to the command, false otherwise
|
||||||
@ -51,7 +51,7 @@ public interface CommandProcessor {
|
|||||||
boolean hasAccess(Player player);
|
boolean hasAccess(Player player);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Needed to enable {@link #onWrite(String)} callback
|
* Needed to enable {@link #onWrite(String)} callback.
|
||||||
* <p>
|
* <p>
|
||||||
* Be aware that enabling it can cost some performance because of how often it will be called.
|
* Be aware that enabling it can cost some performance because of how often it will be called.
|
||||||
*
|
*
|
||||||
@ -63,7 +63,7 @@ public interface CommandProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow for tab auto completion, this is called everytime the player press a key in the chat.
|
* Allows for tab auto completion, this is called everytime the player press a key in the chat.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: {@link #enableWritingTracking()} needs to return true, you need to override it by default.
|
* WARNING: {@link #enableWritingTracking()} needs to return true, you need to override it by default.
|
||||||
*
|
*
|
||||||
|
@ -13,14 +13,14 @@ import java.util.Collection;
|
|||||||
public interface CommandSender {
|
public interface CommandSender {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a raw string message
|
* Sends a raw string message.
|
||||||
*
|
*
|
||||||
* @param message the message to send
|
* @param message the message to send
|
||||||
*/
|
*/
|
||||||
void sendMessage(String message);
|
void sendMessage(String message);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send multiple raw string messages
|
* Sends multiple raw string messages.
|
||||||
*
|
*
|
||||||
* @param messages the messages to send
|
* @param messages the messages to send
|
||||||
*/
|
*/
|
||||||
@ -31,8 +31,8 @@ public interface CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return all permissions associated to this command sender.
|
* Returns all permissions associated to this command sender.
|
||||||
* The returned collection should be modified only by subclasses
|
* The returned collection should be modified only by subclasses.
|
||||||
*
|
*
|
||||||
* @return the permissions of this command sender.
|
* @return the permissions of this command sender.
|
||||||
*/
|
*/
|
||||||
@ -91,7 +91,7 @@ public interface CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the sender is a {@link Player}.
|
* Gets if the sender is a {@link Player}.
|
||||||
*
|
*
|
||||||
* @return true if 'this' is a player, false otherwise
|
* @return true if 'this' is a player, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -100,7 +100,7 @@ public interface CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the sender is a {@link ConsoleSender}.
|
* Gets if the sender is a {@link ConsoleSender}.
|
||||||
*
|
*
|
||||||
* @return true if 'this' is the console, false otherwise
|
* @return true if 'this' is the console, false otherwise
|
||||||
*/
|
*/
|
||||||
|
@ -42,7 +42,7 @@ public class Command {
|
|||||||
private final List<CommandSyntax> syntaxes;
|
private final List<CommandSyntax> syntaxes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a {@link Command} with a name and one or multiple aliases
|
* Creates a {@link Command} with a name and one or multiple aliases.
|
||||||
*
|
*
|
||||||
* @param name the name of the command
|
* @param name the name of the command
|
||||||
* @param aliases the command aliases
|
* @param aliases the command aliases
|
||||||
@ -56,7 +56,7 @@ public class Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a {@link Command} with a name without any aliases
|
* Creates a {@link Command} with a name without any aliases.
|
||||||
*
|
*
|
||||||
* @param name the name of the command
|
* @param name the name of the command
|
||||||
* @see #Command(String, String...)
|
* @see #Command(String, String...)
|
||||||
@ -66,10 +66,10 @@ public class Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link CommandCondition}
|
* Gets the {@link CommandCondition}.
|
||||||
* <p>
|
* <p>
|
||||||
* It is called no matter the syntax used and can be used to check permissions or
|
* It is called no matter the syntax used and can be used to check permissions or
|
||||||
* the {@link CommandSender} type
|
* the {@link CommandSender} type.
|
||||||
*
|
*
|
||||||
* @return the command condition
|
* @return the command condition
|
||||||
*/
|
*/
|
||||||
@ -78,7 +78,7 @@ public class Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the {@link CommandCondition}
|
* Sets the {@link CommandCondition}.
|
||||||
*
|
*
|
||||||
* @param commandCondition the new command condition
|
* @param commandCondition the new command condition
|
||||||
*/
|
*/
|
||||||
@ -87,9 +87,9 @@ public class Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set an {@link ArgumentCallback}
|
* Sets an {@link ArgumentCallback}.
|
||||||
* <p>
|
* <p>
|
||||||
* The argument callback is called when there's an error in the argument
|
* The argument callback is called when there's an error in the argument.
|
||||||
*
|
*
|
||||||
* @param callback the callback for the argument
|
* @param callback the callback for the argument
|
||||||
* @param argument the argument which get the callback
|
* @param argument the argument which get the callback
|
||||||
@ -99,7 +99,7 @@ public class Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new syntax in the command
|
* Adds a new syntax in the command.
|
||||||
* <p>
|
* <p>
|
||||||
* A syntax is simply a list of arguments
|
* A syntax is simply a list of arguments
|
||||||
*
|
*
|
||||||
@ -113,7 +113,7 @@ public class Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the main command's name
|
* Gets the main command's name.
|
||||||
*
|
*
|
||||||
* @return the main command's name
|
* @return the main command's name
|
||||||
*/
|
*/
|
||||||
@ -122,9 +122,9 @@ public class Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the command's aliases
|
* Gets the command's aliases.
|
||||||
* <p>
|
* <p>
|
||||||
* Can be null or empty
|
* Can be null or empty.
|
||||||
*
|
*
|
||||||
* @return the command aliases
|
* @return the command aliases
|
||||||
*/
|
*/
|
||||||
@ -133,8 +133,8 @@ public class Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the default {@link CommandExecutor} (which is called when there is no argument)
|
* Gets the default {@link CommandExecutor} (which is called when there is no argument)
|
||||||
* or if no corresponding syntax has been found
|
* or if no corresponding syntax has been found.
|
||||||
*
|
*
|
||||||
* @return the default executor
|
* @return the default executor
|
||||||
*/
|
*/
|
||||||
@ -143,7 +143,7 @@ public class Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the default {@link CommandExecutor} (which is called when there is no argument)
|
* Sets the default {@link CommandExecutor} (which is called when there is no argument).
|
||||||
*
|
*
|
||||||
* @param executor the new default executor
|
* @param executor the new default executor
|
||||||
*/
|
*/
|
||||||
@ -152,7 +152,7 @@ public class Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the syntaxes of this command
|
* Gets all the syntaxes of this command.
|
||||||
*
|
*
|
||||||
* @return a collection containing all this command syntaxes
|
* @return a collection containing all this command syntaxes
|
||||||
*/
|
*/
|
||||||
@ -161,8 +161,8 @@ public class Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow for tab auto completion, this is called everytime the player press a key in the chat
|
* Allows for tab auto completion, this is called everytime the player press a key in the chat
|
||||||
* when in a dynamic argument ({@link ArgumentDynamicWord} and {@link ArgumentDynamicStringArray})
|
* when in a dynamic argument ({@link ArgumentDynamicWord} and {@link ArgumentDynamicStringArray}).
|
||||||
*
|
*
|
||||||
* @param text the whole player's text
|
* @param text the whole player's text
|
||||||
* @return the array containing all the suggestion for the current arg (split " ")
|
* @return the array containing all the suggestion for the current arg (split " ")
|
||||||
|
@ -58,7 +58,7 @@ public class CommandDispatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the command class associated with its name
|
* GetS the command class associated with the name;
|
||||||
*
|
*
|
||||||
* @param commandName the command name
|
* @param commandName the command name
|
||||||
* @return the {@link Command} associated with the name, null if not any
|
* @return the {@link Command} associated with the name, null if not any
|
||||||
|
@ -15,7 +15,7 @@ public class CommandSyntax {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the required {@link Argument} for this sytnax
|
* Gets all the required {@link Argument} for this syntax.
|
||||||
*
|
*
|
||||||
* @return the required arguments
|
* @return the required arguments
|
||||||
*/
|
*/
|
||||||
@ -24,7 +24,7 @@ public class CommandSyntax {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link CommandExecutor} of this syntax, executed once the syntax is properly wrote.
|
* Gets the {@link CommandExecutor} of this syntax, executed once the syntax is properly written.
|
||||||
*
|
*
|
||||||
* @return the executor of this syntax
|
* @return the executor of this syntax
|
||||||
*/
|
*/
|
||||||
@ -33,7 +33,7 @@ public class CommandSyntax {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the {@link CommandExecutor} of this syntax
|
* Changes the {@link CommandExecutor} of this syntax.
|
||||||
*
|
*
|
||||||
* @param executor the new executor
|
* @param executor the new executor
|
||||||
*/
|
*/
|
||||||
|
@ -66,8 +66,8 @@ public abstract class Argument<T> {
|
|||||||
public abstract int getConditionResult(T value);
|
public abstract int getConditionResult(T value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the ID of the argument, showed in-game above the chat bar
|
* Gets the ID of the argument, showed in-game above the chat bar
|
||||||
* and used to retrieve the data when the command is parsed
|
* and used to retrieve the data when the command is parsed.
|
||||||
*
|
*
|
||||||
* @return the argument id
|
* @return the argument id
|
||||||
*/
|
*/
|
||||||
@ -76,7 +76,7 @@ public abstract class Argument<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the argument can contain space
|
* Gets if the argument can contain space.
|
||||||
*
|
*
|
||||||
* @return true if the argument allows space, false otherwise
|
* @return true if the argument allows space, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -85,10 +85,10 @@ public abstract class Argument<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the argument always use all the remaining characters
|
* Gets if the argument always use all the remaining characters.
|
||||||
* <p>
|
* <p>
|
||||||
* ex: /help I am a test - would get you "I am a test"
|
* ex: /help I am a test - would get you "I am a test"
|
||||||
* if the sole argument does use the remaining
|
* if the sole argument does use the remaining.
|
||||||
*
|
*
|
||||||
* @return true if the argument use all the remaining characters, false otherwise
|
* @return true if the argument use all the remaining characters, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -97,7 +97,7 @@ public abstract class Argument<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link ArgumentCallback} to check if the argument-specific conditions are validated or not.
|
* Gets the {@link ArgumentCallback} to check if the argument-specific conditions are validated or not.
|
||||||
*
|
*
|
||||||
* @return the argument callback
|
* @return the argument callback
|
||||||
*/
|
*/
|
||||||
@ -106,7 +106,7 @@ public abstract class Argument<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the {@link ArgumentCallback}.
|
* Sets the {@link ArgumentCallback}.
|
||||||
*
|
*
|
||||||
* @param callback the argument callback
|
* @param callback the argument callback
|
||||||
*/
|
*/
|
||||||
@ -115,7 +115,7 @@ public abstract class Argument<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the argument has any error callback
|
* Gets if the argument has any error callback.
|
||||||
*
|
*
|
||||||
* @return true if the argument has an error callback, false otherwise
|
* @return true if the argument has an error callback, false otherwise
|
||||||
*/
|
*/
|
||||||
|
@ -39,7 +39,7 @@ public abstract class ArgumentNumber<T extends Number> extends Argument<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the argument has a minimum
|
* Gets if the argument has a minimum.
|
||||||
*
|
*
|
||||||
* @return true if the argument has a minimum
|
* @return true if the argument has a minimum
|
||||||
*/
|
*/
|
||||||
@ -48,7 +48,7 @@ public abstract class ArgumentNumber<T extends Number> extends Argument<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the minimum value for this argument
|
* Gets the minimum value for this argument.
|
||||||
*
|
*
|
||||||
* @return the minimum of this argument
|
* @return the minimum of this argument
|
||||||
*/
|
*/
|
||||||
@ -57,7 +57,7 @@ public abstract class ArgumentNumber<T extends Number> extends Argument<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the argument has a maximum
|
* Gets if the argument has a maximum.
|
||||||
*
|
*
|
||||||
* @return true if the argument has a maximum
|
* @return true if the argument has a maximum
|
||||||
*/
|
*/
|
||||||
@ -66,7 +66,7 @@ public abstract class ArgumentNumber<T extends Number> extends Argument<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the maximum value for this argument
|
* Gets the maximum value for this argument.
|
||||||
*
|
*
|
||||||
* @return the maximum of this argument
|
* @return the maximum of this argument
|
||||||
*/
|
*/
|
||||||
|
@ -47,7 +47,7 @@ public interface Data {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a value to a specific key.
|
* Sets a value to a specific key.
|
||||||
*
|
*
|
||||||
* @param key the key
|
* @param key the key
|
||||||
* @param value the value object
|
* @param value the value object
|
||||||
@ -57,7 +57,7 @@ public interface Data {
|
|||||||
<T> void set(String key, T value, Class<T> type);
|
<T> void set(String key, T value, Class<T> type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve a value based on its key.
|
* Retrieves a value based on its key.
|
||||||
*
|
*
|
||||||
* @param key the key
|
* @param key the key
|
||||||
* @param <T> the value type
|
* @param <T> the value type
|
||||||
@ -66,7 +66,7 @@ public interface Data {
|
|||||||
<T> T get(String key);
|
<T> T get(String key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve a value based on its key, give a default value if not found.
|
* Retrieves a value based on its key, give a default value if not found.
|
||||||
*
|
*
|
||||||
* @param key the key
|
* @param key the key
|
||||||
* @param defaultValue the value to return if the key is not found
|
* @param defaultValue the value to return if the key is not found
|
||||||
@ -76,7 +76,7 @@ public interface Data {
|
|||||||
<T> T getOrDefault(String key, T defaultValue);
|
<T> T getOrDefault(String key, T defaultValue);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the data has a key.
|
* Gets if the data has a key.
|
||||||
*
|
*
|
||||||
* @param key the key to check
|
* @param key the key to check
|
||||||
* @return true if the data contains the key
|
* @return true if the data contains the key
|
||||||
@ -84,21 +84,21 @@ public interface Data {
|
|||||||
boolean hasKey(String key);
|
boolean hasKey(String key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the list of data keys.
|
* Gets the list of data keys.
|
||||||
*
|
*
|
||||||
* @return an unmodifiable {@link Set} containing all keys
|
* @return an unmodifiable {@link Set} containing all keys
|
||||||
*/
|
*/
|
||||||
Set<String> getKeys();
|
Set<String> getKeys();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the data is empty or not.
|
* Gets if the data is empty or not.
|
||||||
*
|
*
|
||||||
* @return true if the data does not contain anything, false otherwise
|
* @return true if the data does not contain anything, false otherwise
|
||||||
*/
|
*/
|
||||||
boolean isEmpty();
|
boolean isEmpty();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clone this data.
|
* Clones this data.
|
||||||
*
|
*
|
||||||
* @return a cloned data object
|
* @return a cloned data object
|
||||||
*/
|
*/
|
||||||
|
@ -8,7 +8,7 @@ package net.minestom.server.data;
|
|||||||
public interface DataContainer {
|
public interface DataContainer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link Data} of this container.
|
* Gets the {@link Data} of this container.
|
||||||
* <p>
|
* <p>
|
||||||
* A {@link DataContainer} data is always optional,
|
* A {@link DataContainer} data is always optional,
|
||||||
* meaning that this will be null if no data has been defined.
|
* meaning that this will be null if no data has been defined.
|
||||||
@ -18,7 +18,7 @@ public interface DataContainer {
|
|||||||
Data getData();
|
Data getData();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the {@link Data} of this container.
|
* Sets the {@link Data} of this container.
|
||||||
*
|
*
|
||||||
* @param data the {@link Data} of this container, null to remove it
|
* @param data the {@link Data} of this container, null to remove it
|
||||||
*/
|
*/
|
||||||
|
@ -55,7 +55,7 @@ public final class DataManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a new data type
|
* Registers a new data type.
|
||||||
*
|
*
|
||||||
* @param clazz the data class
|
* @param clazz the data class
|
||||||
* @param dataType the data type associated
|
* @param dataType the data type associated
|
||||||
@ -71,7 +71,7 @@ public final class DataManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the data type associated with a class
|
* Gets the data type associated with a class.
|
||||||
*
|
*
|
||||||
* @param clazz the data class
|
* @param clazz the data class
|
||||||
* @param <T> the data type
|
* @param <T> the data type
|
||||||
|
@ -138,8 +138,8 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedule a task to be run during the next entity tick
|
* Schedules a task to be run during the next entity tick.
|
||||||
* It ensures that the task will be executed in the same thread as the entity (depending of the {@link ThreadProvider})
|
* It ensures that the task will be executed in the same thread as the entity (depending of the {@link ThreadProvider}).
|
||||||
*
|
*
|
||||||
* @param callback the task to execute during the next entity tick
|
* @param callback the task to execute during the next entity tick
|
||||||
*/
|
*/
|
||||||
@ -164,14 +164,14 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called each tick
|
* Called each tick.
|
||||||
*
|
*
|
||||||
* @param time the time of update in milliseconds
|
* @param time the time of update in milliseconds
|
||||||
*/
|
*/
|
||||||
public abstract void update(long time);
|
public abstract void update(long time);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a new instance is set
|
* Called when a new instance is set.
|
||||||
*/
|
*/
|
||||||
public abstract void spawn();
|
public abstract void spawn();
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if now is a good time to send a velocity update packet
|
* Checks if now is a good time to send a velocity update packet.
|
||||||
*
|
*
|
||||||
* @param time the current time in milliseconds
|
* @param time the current time in milliseconds
|
||||||
* @return true if the velocity update packet should be send
|
* @return true if the velocity update packet should be send
|
||||||
@ -190,7 +190,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the period, in ms, between two velocity update packets
|
* Gets the period, in ms, between two velocity update packets.
|
||||||
*
|
*
|
||||||
* @return period, in ms, between two velocity update packets
|
* @return period, in ms, between two velocity update packets
|
||||||
*/
|
*/
|
||||||
@ -199,7 +199,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the period, in ms, between two velocity update packets
|
* Sets the period, in ms, between two velocity update packets.
|
||||||
*
|
*
|
||||||
* @param velocityUpdatePeriod period, in ms, between two velocity update packets
|
* @param velocityUpdatePeriod period, in ms, between two velocity update packets
|
||||||
*/
|
*/
|
||||||
@ -208,8 +208,8 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Teleport the entity only if the chunk at {@code position} is loaded or if
|
* Teleports the entity only if the chunk at {@code position} is loaded or if
|
||||||
* {@link Instance#hasEnabledAutoChunkLoad()} returns true
|
* {@link Instance#hasEnabledAutoChunkLoad()} returns true.
|
||||||
*
|
*
|
||||||
* @param position the teleport position
|
* @param position the teleport position
|
||||||
* @param callback the callback executed, even if auto chunk is not enabled
|
* @param callback the callback executed, even if auto chunk is not enabled
|
||||||
@ -242,7 +242,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the view of the entity
|
* Changes the view of the entity.
|
||||||
*
|
*
|
||||||
* @param yaw the new yaw
|
* @param yaw the new yaw
|
||||||
* @param pitch the new pitch
|
* @param pitch the new pitch
|
||||||
@ -265,8 +265,8 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the view of the entity
|
* Changes the view of the entity.
|
||||||
* Only the yaw and pitch is used
|
* Only the yaw and pitch are used.
|
||||||
*
|
*
|
||||||
* @param position the new view
|
* @param position the new view
|
||||||
*/
|
*/
|
||||||
@ -277,11 +277,11 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
/**
|
/**
|
||||||
* When set to true, the entity will automatically get new viewers when they come too close
|
* When set to true, the entity will automatically get new viewers when they come too close
|
||||||
* This can be use to complete control over which player can see it, without having to deal with
|
* This can be use to complete control over which player can see it, without having to deal with
|
||||||
* raw packets
|
* raw packets.
|
||||||
* <p>
|
* <p>
|
||||||
* True by default for all entities
|
* True by default for all entities.
|
||||||
* When set to false, it is important to mention that the players will not be removed automatically from its viewers
|
* When set to false, it is important to mention that the players will not be removed automatically from its viewers
|
||||||
* list, you would have to do that manually when being too far
|
* list, you would have to do that manually when being too far.
|
||||||
*
|
*
|
||||||
* @return true if the entity is automatically viewable for close players, false otherwise
|
* @return true if the entity is automatically viewable for close players, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -335,7 +335,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the entity, called every tick
|
* Updates the entity, called every tick.
|
||||||
*
|
*
|
||||||
* @param time the update time in milliseconds
|
* @param time the update time in milliseconds
|
||||||
*/
|
*/
|
||||||
@ -525,14 +525,14 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Equivalent to <code>sendPacketsToViewers(getVelocityPacket());</code>
|
* Equivalent to <code>sendPacketsToViewers(getVelocityPacket());</code>.
|
||||||
*/
|
*/
|
||||||
public void sendVelocityPacket() {
|
public void sendVelocityPacket() {
|
||||||
sendPacketsToViewers(getVelocityPacket());
|
sendPacketsToViewers(getVelocityPacket());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of ticks this entity has been active for
|
* Gets the number of ticks this entity has been active for.
|
||||||
*
|
*
|
||||||
* @return the number of ticks this entity has been active for
|
* @return the number of ticks this entity has been active for
|
||||||
*/
|
*/
|
||||||
@ -566,8 +566,8 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Each entity has an unique id which will change after a restart
|
* Each entity has an unique id which will change after a restart.
|
||||||
* All entities can be retrieved by calling {@link Entity#getEntity(int)}
|
* All entities can be retrieved by calling {@link Entity#getEntity(int)}.
|
||||||
*
|
*
|
||||||
* @return the unique entity id
|
* @return the unique entity id
|
||||||
*/
|
*/
|
||||||
@ -576,7 +576,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the entity type id, can convert using {@link EntityType#fromId(int)}
|
* Returns the entity type id, can convert using {@link EntityType#fromId(int)}.
|
||||||
*
|
*
|
||||||
* @return the entity type id
|
* @return the entity type id
|
||||||
*/
|
*/
|
||||||
@ -585,7 +585,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the entity UUID
|
* Gets the entity UUID.
|
||||||
*
|
*
|
||||||
* @return the entity UUID
|
* @return the entity UUID
|
||||||
*/
|
*/
|
||||||
@ -594,7 +594,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the internal entity UUID, mostly unsafe
|
* Changes the internal entity UUID, mostly unsafe.
|
||||||
*
|
*
|
||||||
* @param uuid the new entity uuid
|
* @param uuid the new entity uuid
|
||||||
*/
|
*/
|
||||||
@ -603,7 +603,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return false just after instantiation, set to true after calling {@link #setInstance(Instance)}
|
* Returns false just after instantiation, set to true after calling {@link #setInstance(Instance)}.
|
||||||
*
|
*
|
||||||
* @return true if the entity has been linked to an instance, false otherwise
|
* @return true if the entity has been linked to an instance, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -612,7 +612,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is used to check collision with coordinates or other blocks/entities
|
* Is used to check collision with coordinates or other blocks/entities.
|
||||||
*
|
*
|
||||||
* @return the entity bounding box
|
* @return the entity bounding box
|
||||||
*/
|
*/
|
||||||
@ -621,9 +621,9 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the internal entity bounding box
|
* Changes the internal entity bounding box.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: this does not change the entity hit-box which is client-side
|
* WARNING: this does not change the entity hit-box which is client-side.
|
||||||
*
|
*
|
||||||
* @param x the bounding box X size
|
* @param x the bounding box X size
|
||||||
* @param y the bounding box Y size
|
* @param y the bounding box Y size
|
||||||
@ -643,7 +643,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the entity current instance
|
* Gets the entity current instance.
|
||||||
*
|
*
|
||||||
* @return the entity instance
|
* @return the entity instance
|
||||||
*/
|
*/
|
||||||
@ -652,7 +652,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the entity instance
|
* Changes the entity instance.
|
||||||
*
|
*
|
||||||
* @param instance the new instance of the entity
|
* @param instance the new instance of the entity
|
||||||
* @throws NullPointerException if {@code instance} is null
|
* @throws NullPointerException if {@code instance} is null
|
||||||
@ -676,7 +676,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the entity current velocity
|
* Gets the entity current velocity.
|
||||||
*
|
*
|
||||||
* @return the entity current velocity
|
* @return the entity current velocity
|
||||||
*/
|
*/
|
||||||
@ -685,9 +685,9 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the entity velocity and calls {@link EntityVelocityEvent}.
|
* Changes the entity velocity and calls {@link EntityVelocityEvent}.
|
||||||
* <p>
|
* <p>
|
||||||
* The final velocity can be cancelled or modified by the event
|
* The final velocity can be cancelled or modified by the event.
|
||||||
*
|
*
|
||||||
* @param velocity the new entity velocity
|
* @param velocity the new entity velocity
|
||||||
*/
|
*/
|
||||||
@ -700,7 +700,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the entity currently has a velocity applied
|
* Gets if the entity currently has a velocity applied.
|
||||||
*
|
*
|
||||||
* @return true if velocity is not set to 0
|
* @return true if velocity is not set to 0
|
||||||
*/
|
*/
|
||||||
@ -711,7 +711,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the gravity of the entity
|
* Change the gravity of the entity.
|
||||||
*
|
*
|
||||||
* @param gravityDragPerTick the gravity drag per tick
|
* @param gravityDragPerTick the gravity drag per tick
|
||||||
*/
|
*/
|
||||||
@ -720,7 +720,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the distance between two entities
|
* Gets the distance between two entities.
|
||||||
*
|
*
|
||||||
* @param entity the entity to get the distance from
|
* @param entity the entity to get the distance from
|
||||||
* @return the distance between this and {@code entity}
|
* @return the distance between this and {@code entity}
|
||||||
@ -731,7 +731,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the entity vehicle or null
|
* Gets the entity vehicle or null.
|
||||||
*
|
*
|
||||||
* @return the entity vehicle, or null if there is not any
|
* @return the entity vehicle, or null if there is not any
|
||||||
*/
|
*/
|
||||||
@ -740,7 +740,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new passenger to this entity
|
* Adds a new passenger to this entity.
|
||||||
*
|
*
|
||||||
* @param entity the new passenger
|
* @param entity the new passenger
|
||||||
* @throws NullPointerException if {@code entity} is null
|
* @throws NullPointerException if {@code entity} is null
|
||||||
@ -761,7 +761,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a passenger to this entity
|
* Removes a passenger to this entity.
|
||||||
*
|
*
|
||||||
* @param entity the passenger to remove
|
* @param entity the passenger to remove
|
||||||
* @throws NullPointerException if {@code entity} is null
|
* @throws NullPointerException if {@code entity} is null
|
||||||
@ -778,7 +778,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the entity has any passenger
|
* Gets if the entity has any passenger.
|
||||||
*
|
*
|
||||||
* @return true if the entity has any passenger, false otherwise
|
* @return true if the entity has any passenger, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -787,7 +787,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the entity passengers
|
* Gets the entity passengers.
|
||||||
*
|
*
|
||||||
* @return an unmodifiable list containing all the entity passengers
|
* @return an unmodifiable list containing all the entity passengers
|
||||||
*/
|
*/
|
||||||
@ -810,7 +810,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entity statuses can be find <a href="https://wiki.vg/Entity_statuses">here</a>
|
* Entity statuses can be find <a href="https://wiki.vg/Entity_statuses">here</a>.
|
||||||
*
|
*
|
||||||
* @param status the status to trigger
|
* @param status the status to trigger
|
||||||
*/
|
*/
|
||||||
@ -822,7 +822,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the entity is on fire
|
* Gets if the entity is on fire.
|
||||||
*
|
*
|
||||||
* @return true if the entity is in fire, false otherwise
|
* @return true if the entity is in fire, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -831,10 +831,10 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the entity in fire visually
|
* Sets the entity in fire visually.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: if you want to apply damage or specify a duration,
|
* WARNING: if you want to apply damage or specify a duration,
|
||||||
* see {@link LivingEntity#setFireForDuration(int, TimeUnit)}
|
* see {@link LivingEntity#setFireForDuration(int, TimeUnit)}.
|
||||||
*
|
*
|
||||||
* @param fire should the entity be set in fire
|
* @param fire should the entity be set in fire
|
||||||
*/
|
*/
|
||||||
@ -844,7 +844,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the entity is invisible or not
|
* Gets if the entity is invisible or not.
|
||||||
*
|
*
|
||||||
* @return true if the entity is invisible, false otherwise
|
* @return true if the entity is invisible, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -853,8 +853,8 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the internal invisible value and send a {@link EntityMetaDataPacket}
|
* Changes the internal invisible value and send a {@link EntityMetaDataPacket}
|
||||||
* to make visible or invisible the entity to its viewers
|
* to make visible or invisible the entity to its viewers.
|
||||||
*
|
*
|
||||||
* @param invisible true to set the entity invisible, false otherwise
|
* @param invisible true to set the entity invisible, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -864,7 +864,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the entity is glowing or not
|
* Gets if the entity is glowing or not.
|
||||||
*
|
*
|
||||||
* @return true if the entity is glowing, false otherwise
|
* @return true if the entity is glowing, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -873,7 +873,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set or remove the entity glowing effect
|
* Sets or remove the entity glowing effect.
|
||||||
*
|
*
|
||||||
* @param glowing true to make the entity glows, false otherwise
|
* @param glowing true to make the entity glows, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -883,7 +883,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the entity custom name
|
* Gets the entity custom name.
|
||||||
*
|
*
|
||||||
* @return the custom name of the entity, null if there is not
|
* @return the custom name of the entity, null if there is not
|
||||||
*/
|
*/
|
||||||
@ -892,7 +892,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the entity custom name
|
* Changes the entity custom name.
|
||||||
*
|
*
|
||||||
* @param customName the custom name of the entity, null to remove it
|
* @param customName the custom name of the entity, null to remove it
|
||||||
*/
|
*/
|
||||||
@ -902,7 +902,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the custom name visible metadata field
|
* Gets the custom name visible metadata field.
|
||||||
*
|
*
|
||||||
* @return true if the custom name is visible, false otherwise
|
* @return true if the custom name is visible, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -911,8 +911,8 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the internal custom name visible field and send a {@link EntityMetaDataPacket}
|
* Changes the internal custom name visible field and send a {@link EntityMetaDataPacket}
|
||||||
* to update the entity state to its viewers
|
* to update the entity state to its viewers.
|
||||||
*
|
*
|
||||||
* @param customNameVisible true to make the custom name visible, false otherwise
|
* @param customNameVisible true to make the custom name visible, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -931,7 +931,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the noGravity metadata field and change the gravity behaviour accordingly
|
* Changes the noGravity metadata field and change the gravity behaviour accordingly.
|
||||||
*
|
*
|
||||||
* @param noGravity should the entity ignore gravity
|
* @param noGravity should the entity ignore gravity
|
||||||
*/
|
*/
|
||||||
@ -941,7 +941,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the noGravity metadata field
|
* Gets the noGravity metadata field.
|
||||||
*
|
*
|
||||||
* @return true if the entity ignore gravity, false otherwise
|
* @return true if the entity ignore gravity, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -1001,7 +1001,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manage viewable entities automatically if {@link #isAutoViewable()} is enabled.
|
* Manages viewable entities automatically if {@link #isAutoViewable()} is enabled.
|
||||||
* <p>
|
* <p>
|
||||||
* Called by {@link #refreshPosition(float, float, float)} when the new position is in a different {@link Chunk}.
|
* Called by {@link #refreshPosition(float, float, float)} when the new position is in a different {@link Chunk}.
|
||||||
*
|
*
|
||||||
@ -1066,9 +1066,9 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the entity view internally
|
* Updates the entity view internally.
|
||||||
* <p>
|
* <p>
|
||||||
* Warning: you probably want to use {@link #setView(float, float)}
|
* Warning: you probably want to use {@link #setView(float, float)}.
|
||||||
*
|
*
|
||||||
* @param yaw the yaw
|
* @param yaw the yaw
|
||||||
* @param pitch the pitch
|
* @param pitch the pitch
|
||||||
@ -1083,7 +1083,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make the entity sneak.
|
* Makes the entity sneak.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: this will not work for the client itself.
|
* WARNING: this will not work for the client itself.
|
||||||
*
|
*
|
||||||
@ -1097,7 +1097,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make the entity sprint.
|
* Makes the entity sprint.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: this will not work on the client itself.
|
* WARNING: this will not work on the client itself.
|
||||||
*
|
*
|
||||||
@ -1109,7 +1109,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the entity position
|
* Gets the entity position.
|
||||||
*
|
*
|
||||||
* @return the current position of the entity
|
* @return the current position of the entity
|
||||||
*/
|
*/
|
||||||
@ -1118,7 +1118,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the entity eye height
|
* Gets the entity eye height.
|
||||||
*
|
*
|
||||||
* @return the entity eye height
|
* @return the entity eye height
|
||||||
*/
|
*/
|
||||||
@ -1127,7 +1127,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the entity eye height
|
* Changes the entity eye height.
|
||||||
*
|
*
|
||||||
* @param eyeHeight the entity eye height
|
* @param eyeHeight the entity eye height
|
||||||
*/
|
*/
|
||||||
@ -1136,7 +1136,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if this entity is in the same chunk as the specified position
|
* Gets if this entity is in the same chunk as the specified position.
|
||||||
*
|
*
|
||||||
* @param position the checked position chunk
|
* @param position the checked position chunk
|
||||||
* @return true if the entity is in the same chunk as {@code position}
|
* @return true if the entity is in the same chunk as {@code position}
|
||||||
@ -1154,7 +1154,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the entity is in the same chunk as another
|
* Gets if the entity is in the same chunk as another.
|
||||||
*
|
*
|
||||||
* @param entity the entity to check
|
* @param entity the entity to check
|
||||||
* @return true if both entities are in the same chunk, false otherwise
|
* @return true if both entities are in the same chunk, false otherwise
|
||||||
@ -1164,7 +1164,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the entity from the server immediately.
|
* Removes the entity from the server immediately.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: this do not trigger the {@link EntityDeathEvent} event.
|
* WARNING: this do not trigger the {@link EntityDeathEvent} event.
|
||||||
*/
|
*/
|
||||||
@ -1177,7 +1177,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if this entity has been removed
|
* Gets if this entity has been removed.
|
||||||
*
|
*
|
||||||
* @return true if this entity is removed
|
* @return true if this entity is removed
|
||||||
*/
|
*/
|
||||||
@ -1186,7 +1186,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trigger {@link #remove()} after the specified time
|
* Triggers {@link #remove()} after the specified time.
|
||||||
*
|
*
|
||||||
* @param delay the time before removing the entity
|
* @param delay the time before removing the entity
|
||||||
* @param timeUnit the unit of the delay
|
* @param timeUnit the unit of the delay
|
||||||
@ -1202,7 +1202,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the entity removal has been scheduled with {@link #scheduleRemove(long, TimeUnit)}.
|
* Gets if the entity removal has been scheduled with {@link #scheduleRemove(long, TimeUnit)}.
|
||||||
*
|
*
|
||||||
* @return true if the entity removal has been scheduled
|
* @return true if the entity removal has been scheduled
|
||||||
*/
|
*/
|
||||||
@ -1221,7 +1221,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an {@link EntityMetaDataPacket} sent when adding viewers. Used for synchronization.
|
* Gets an {@link EntityMetaDataPacket} sent when adding viewers. Used for synchronization.
|
||||||
*
|
*
|
||||||
* @return The {@link EntityMetaDataPacket} related to this entity
|
* @return The {@link EntityMetaDataPacket} related to this entity
|
||||||
*/
|
*/
|
||||||
@ -1250,8 +1250,8 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a {@link EntityMetaDataPacket} containing only the specified index
|
* Sends a {@link EntityMetaDataPacket} containing only the specified index
|
||||||
* The index is wrote using {@link #fillMetadataIndex(BinaryWriter, int)}
|
* The index is wrote using {@link #fillMetadataIndex(BinaryWriter, int)}.
|
||||||
*
|
*
|
||||||
* @param index the metadata index
|
* @param index the metadata index
|
||||||
*/
|
*/
|
||||||
@ -1264,9 +1264,9 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to fill/write a specific metadata index
|
* Used to fill/write a specific metadata index.
|
||||||
* The proper use to add a new metadata index is to override this and add your case
|
* The proper use to add a new metadata index is to override this and add your case.
|
||||||
* Then you can also override {@link #getMetadataConsumer()} and fill your newly added index
|
* Then you can also override {@link #getMetadataConsumer()} and fill your newly added index.
|
||||||
*
|
*
|
||||||
* @param packet the packet writer
|
* @param packet the packet writer
|
||||||
* @param index the index to fill/write
|
* @param index the index to fill/write
|
||||||
@ -1370,7 +1370,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ask for a synchronization (position) to happen during next entity tick
|
* Asks for a synchronization (position) to happen during next entity tick.
|
||||||
*/
|
*/
|
||||||
public void askSynchronization() {
|
public void askSynchronization() {
|
||||||
this.lastSynchronizationTime = 0;
|
this.lastSynchronizationTime = 0;
|
||||||
|
@ -193,7 +193,7 @@ public abstract class EntityCreature extends LivingEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the goal selectors of this entity
|
* Gets the goal selectors of this entity.
|
||||||
*
|
*
|
||||||
* @return a modifiable list containing the entity goal selectors
|
* @return a modifiable list containing the entity goal selectors
|
||||||
*/
|
*/
|
||||||
@ -202,7 +202,7 @@ public abstract class EntityCreature extends LivingEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the target selectors of this entity
|
* Gets the target selectors of this entity.
|
||||||
*
|
*
|
||||||
* @return a modifiable list containing the entity target selectors
|
* @return a modifiable list containing the entity target selectors
|
||||||
*/
|
*/
|
||||||
@ -211,7 +211,7 @@ public abstract class EntityCreature extends LivingEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the entity target
|
* Gets the entity target.
|
||||||
*
|
*
|
||||||
* @return the entity target
|
* @return the entity target
|
||||||
*/
|
*/
|
||||||
@ -295,7 +295,7 @@ public abstract class EntityCreature extends LivingEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call a {@link EntityAttackEvent} with this entity as the source and {@code target} as the target.
|
* Calls a {@link EntityAttackEvent} with this entity as the source and {@code target} as the target.
|
||||||
*
|
*
|
||||||
* @param target the entity target
|
* @param target the entity target
|
||||||
* @param swingHand true to swing the entity main hand, false otherwise
|
* @param swingHand true to swing the entity main hand, false otherwise
|
||||||
@ -308,9 +308,9 @@ public abstract class EntityCreature extends LivingEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call a {@link EntityAttackEvent} with this entity as the source and {@code target} as the target.
|
* Calls a {@link EntityAttackEvent} with this entity as the source and {@code target} as the target.
|
||||||
* <p>
|
* <p>
|
||||||
* This does not trigger the hand animation
|
* This does not trigger the hand animation.
|
||||||
*
|
*
|
||||||
* @param target the entity target
|
* @param target the entity target
|
||||||
*/
|
*/
|
||||||
@ -325,12 +325,12 @@ public abstract class EntityCreature extends LivingEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the path to {@code position} and ask the entity to follow the path
|
* Retrieves the path to {@code position} and ask the entity to follow the path.
|
||||||
* <p>
|
* <p>
|
||||||
* Can be set to null to reset the pathfinder
|
* Can be set to null to reset the pathfinder.
|
||||||
* <p>
|
* <p>
|
||||||
* The position is cloned, if you want the entity to continually follow this position object
|
* The position is cloned, if you want the entity to continually follow this position object
|
||||||
* you need to call this when you want the path to update
|
* you need to call this when you want the path to update.
|
||||||
*
|
*
|
||||||
* @param position the position to find the path to, null to reset the pathfinder
|
* @param position the position to find the path to, null to reset the pathfinder
|
||||||
* @return true if a path has been found
|
* @return true if a path has been found
|
||||||
@ -379,7 +379,7 @@ public abstract class EntityCreature extends LivingEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the target pathfinder position
|
* Gets the target pathfinder position.
|
||||||
*
|
*
|
||||||
* @return the target pathfinder position, null if there is no one
|
* @return the target pathfinder position, null if there is no one
|
||||||
*/
|
*/
|
||||||
@ -423,9 +423,9 @@ public abstract class EntityCreature extends LivingEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the pathing entity
|
* Gets the pathing entity.
|
||||||
* <p>
|
* <p>
|
||||||
* Used by the pathfinder
|
* Used by the pathfinder.
|
||||||
*
|
*
|
||||||
* @return the pathing entity
|
* @return the pathing entity
|
||||||
*/
|
*/
|
||||||
|
@ -44,7 +44,7 @@ public class ExperienceOrb extends Entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the experience count
|
* Gets the experience count.
|
||||||
*
|
*
|
||||||
* @return the experience count
|
* @return the experience count
|
||||||
*/
|
*/
|
||||||
@ -53,7 +53,7 @@ public class ExperienceOrb extends Entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the experience count
|
* Changes the experience count.
|
||||||
*
|
*
|
||||||
* @param experienceCount the new experience count
|
* @param experienceCount the new experience count
|
||||||
*/
|
*/
|
||||||
|
@ -14,7 +14,7 @@ import java.util.Set;
|
|||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represent an item on the ground
|
* Represents an item on the ground.
|
||||||
*/
|
*/
|
||||||
public class ItemEntity extends ObjectEntity {
|
public class ItemEntity extends ObjectEntity {
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ public class ItemEntity extends ObjectEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the update option for the merging feature
|
* Gets the update option for the merging feature.
|
||||||
*
|
*
|
||||||
* @return the merge update option
|
* @return the merge update option
|
||||||
*/
|
*/
|
||||||
@ -53,8 +53,8 @@ public class ItemEntity extends ObjectEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the merge update option.
|
* Changes the merge update option.
|
||||||
* Can be set to null to entirely remove the delay
|
* Can be set to null to entirely remove the delay.
|
||||||
*
|
*
|
||||||
* @param mergeUpdateOption the new merge update option
|
* @param mergeUpdateOption the new merge update option
|
||||||
*/
|
*/
|
||||||
@ -142,7 +142,7 @@ public class ItemEntity extends ObjectEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the item stack on ground
|
* Gets the item stack on ground.
|
||||||
*
|
*
|
||||||
* @return the item stack
|
* @return the item stack
|
||||||
*/
|
*/
|
||||||
@ -151,7 +151,7 @@ public class ItemEntity extends ObjectEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the item stack on ground
|
* Changes the item stack on ground.
|
||||||
*
|
*
|
||||||
* @param itemStack the item stack
|
* @param itemStack the item stack
|
||||||
*/
|
*/
|
||||||
@ -161,10 +161,10 @@ public class ItemEntity extends ObjectEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the item is currently pickable
|
* Gets if the item is currently pickable.
|
||||||
* <p>
|
* <p>
|
||||||
* {@link #setPickable(boolean)} needs to be true and the delay {@link #getPickupDelay()}
|
* {@link #setPickable(boolean)} needs to be true and the delay {@link #getPickupDelay()}
|
||||||
* to be long gone
|
* to be long gone.
|
||||||
*
|
*
|
||||||
* @return true if the item is pickable, false otherwise
|
* @return true if the item is pickable, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -173,7 +173,7 @@ public class ItemEntity extends ObjectEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make the item pickable
|
* Makes the item pickable.
|
||||||
*
|
*
|
||||||
* @param pickable true to make the item pickable, false otherwise
|
* @param pickable true to make the item pickable, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -182,7 +182,7 @@ public class ItemEntity extends ObjectEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the item is mergeable
|
* Gets if the item is mergeable.
|
||||||
*
|
*
|
||||||
* @return true if the entity is mergeable, false otherwise
|
* @return true if the entity is mergeable, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -192,7 +192,7 @@ public class ItemEntity extends ObjectEntity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* When set to true, close {@link ItemEntity} will try to merge together as a single entity
|
* When set to true, close {@link ItemEntity} will try to merge together as a single entity
|
||||||
* when their {@link #getItemStack()} is similar and allowed to stack together
|
* when their {@link #getItemStack()} is similar and allowed to stack together.
|
||||||
*
|
*
|
||||||
* @param mergeable should the entity merge with other {@link ItemEntity}
|
* @param mergeable should the entity merge with other {@link ItemEntity}
|
||||||
*/
|
*/
|
||||||
@ -201,7 +201,7 @@ public class ItemEntity extends ObjectEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the merge range
|
* Gets the merge range.
|
||||||
*
|
*
|
||||||
* @return the merge range
|
* @return the merge range
|
||||||
*/
|
*/
|
||||||
@ -210,7 +210,7 @@ public class ItemEntity extends ObjectEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the merge range
|
* Changes the merge range.
|
||||||
*
|
*
|
||||||
* @param mergeRange the merge range
|
* @param mergeRange the merge range
|
||||||
*/
|
*/
|
||||||
@ -219,7 +219,7 @@ public class ItemEntity extends ObjectEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the pickup delay in milliseconds, defined by {@link #setPickupDelay(long, TimeUnit)}
|
* Gets the pickup delay in milliseconds, defined by {@link #setPickupDelay(long, TimeUnit)}.
|
||||||
*
|
*
|
||||||
* @return the pickup delay
|
* @return the pickup delay
|
||||||
*/
|
*/
|
||||||
@ -228,7 +228,7 @@ public class ItemEntity extends ObjectEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the pickup delay of the ItemEntity
|
* Sets the pickup delay of the ItemEntity.
|
||||||
*
|
*
|
||||||
* @param delay the pickup delay
|
* @param delay the pickup delay
|
||||||
* @param timeUnit the unit of the delay
|
* @param timeUnit the unit of the delay
|
||||||
@ -238,7 +238,7 @@ public class ItemEntity extends ObjectEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to know if the ItemEntity can be pickup
|
* Used to know if the ItemEntity can be pickup.
|
||||||
*
|
*
|
||||||
* @return the time in milliseconds since this entity has spawn
|
* @return the time in milliseconds since this entity has spawn
|
||||||
*/
|
*/
|
||||||
|
@ -158,7 +158,7 @@ public abstract class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the amount of arrows in the entity
|
* Gets the amount of arrows in the entity.
|
||||||
*
|
*
|
||||||
* @return the arrow count
|
* @return the arrow count
|
||||||
*/
|
*/
|
||||||
@ -167,7 +167,7 @@ public abstract class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the amount of arrow stuck in the entity
|
* Changes the amount of arrow stuck in the entity.
|
||||||
*
|
*
|
||||||
* @param arrowCount the arrow count
|
* @param arrowCount the arrow count
|
||||||
*/
|
*/
|
||||||
@ -177,7 +177,7 @@ public abstract class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the entity is invulnerable
|
* Gets if the entity is invulnerable.
|
||||||
*
|
*
|
||||||
* @return true if the entity is invulnerable
|
* @return true if the entity is invulnerable
|
||||||
*/
|
*/
|
||||||
@ -186,7 +186,7 @@ public abstract class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make the entity vulnerable or invulnerable
|
* Makes the entity vulnerable or invulnerable.
|
||||||
*
|
*
|
||||||
* @param invulnerable should the entity be invulnerable
|
* @param invulnerable should the entity be invulnerable
|
||||||
*/
|
*/
|
||||||
@ -195,7 +195,7 @@ public abstract class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kill the entity, trigger the {@link EntityDeathEvent} event
|
* Kills the entity, trigger the {@link EntityDeathEvent} event.
|
||||||
*/
|
*/
|
||||||
public void kill() {
|
public void kill() {
|
||||||
refreshIsDead(true); // So the entity isn't killed over and over again
|
refreshIsDead(true); // So the entity isn't killed over and over again
|
||||||
@ -215,7 +215,7 @@ public abstract class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets fire to this entity for a given duration
|
* Sets fire to this entity for a given duration.
|
||||||
*
|
*
|
||||||
* @param duration duration in ticks of the effect
|
* @param duration duration in ticks of the effect
|
||||||
*/
|
*/
|
||||||
@ -224,7 +224,7 @@ public abstract class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets fire to this entity for a given duration
|
* Sets fire to this entity for a given duration.
|
||||||
*
|
*
|
||||||
* @param duration duration of the effect
|
* @param duration duration of the effect
|
||||||
* @param unit unit used to express the duration
|
* @param unit unit used to express the duration
|
||||||
@ -318,7 +318,7 @@ public abstract class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the entity health
|
* Gets the entity health.
|
||||||
*
|
*
|
||||||
* @return the entity health
|
* @return the entity health
|
||||||
*/
|
*/
|
||||||
@ -327,7 +327,7 @@ public abstract class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the entity health, kill it if {@code health} is >= 0 and is not dead yet
|
* Changes the entity health, kill it if {@code health} is >= 0 and is not dead yet.
|
||||||
*
|
*
|
||||||
* @param health the new entity health
|
* @param health the new entity health
|
||||||
*/
|
*/
|
||||||
@ -342,7 +342,7 @@ public abstract class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the last damage source which damaged of this entity
|
* Gets the last damage source which damaged of this entity.
|
||||||
*
|
*
|
||||||
* @return the last damage source, null if not any
|
* @return the last damage source, null if not any
|
||||||
*/
|
*/
|
||||||
@ -351,7 +351,7 @@ public abstract class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the entity max health from {@link #getAttributeValue(Attribute)} {@link Attribute#MAX_HEALTH}
|
* Gets the entity max health from {@link #getAttributeValue(Attribute)} {@link Attribute#MAX_HEALTH}.
|
||||||
*
|
*
|
||||||
* @return the entity max health
|
* @return the entity max health
|
||||||
*/
|
*/
|
||||||
@ -360,15 +360,16 @@ public abstract class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the heal of the entity as its max health
|
* Sets the heal of the entity as its max health.
|
||||||
* retrieved from {@link #getAttributeValue(Attribute)} with the attribute {@link Attribute#MAX_HEALTH}
|
* <p>
|
||||||
|
* Retrieved from {@link #getAttributeValue(Attribute)} with the attribute {@link Attribute#MAX_HEALTH}.
|
||||||
*/
|
*/
|
||||||
public void heal() {
|
public void heal() {
|
||||||
setHealth(getAttributeValue(Attribute.MAX_HEALTH));
|
setHealth(getAttributeValue(Attribute.MAX_HEALTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the specified attribute value to {@code value}
|
* Changes the specified attribute value to {@code value}.
|
||||||
*
|
*
|
||||||
* @param attribute The attribute to change
|
* @param attribute The attribute to change
|
||||||
* @param value the new value of the attribute
|
* @param value the new value of the attribute
|
||||||
@ -378,7 +379,7 @@ public abstract class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the attribute value set by {@link #setAttribute(Attribute, float)}
|
* Retrieves the attribute value set by {@link #setAttribute(Attribute, float)}.
|
||||||
*
|
*
|
||||||
* @param attribute the attribute value to get
|
* @param attribute the attribute value to get
|
||||||
* @return the attribute value
|
* @return the attribute value
|
||||||
@ -388,7 +389,7 @@ public abstract class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the entity is dead or not
|
* Gets if the entity is dead or not.
|
||||||
*
|
*
|
||||||
* @return true if the entity is dead
|
* @return true if the entity is dead
|
||||||
*/
|
*/
|
||||||
@ -397,7 +398,7 @@ public abstract class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the entity is able to pickup items
|
* Gets if the entity is able to pickup items.
|
||||||
*
|
*
|
||||||
* @return true if the entity is able to pickup items
|
* @return true if the entity is able to pickup items
|
||||||
*/
|
*/
|
||||||
@ -406,7 +407,7 @@ public abstract class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When set to false, the entity will not be able to pick {@link ItemEntity} on the ground
|
* When set to false, the entity will not be able to pick {@link ItemEntity} on the ground.
|
||||||
*
|
*
|
||||||
* @param canPickupItem can the entity pickup item
|
* @param canPickupItem can the entity pickup item
|
||||||
*/
|
*/
|
||||||
@ -421,8 +422,8 @@ public abstract class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a {@link EntityAnimationPacket} to swing the main hand
|
* Sends a {@link EntityAnimationPacket} to swing the main hand
|
||||||
* (can be used for attack animation)
|
* (can be used for attack animation).
|
||||||
*/
|
*/
|
||||||
public void swingMainHand() {
|
public void swingMainHand() {
|
||||||
EntityAnimationPacket animationPacket = new EntityAnimationPacket();
|
EntityAnimationPacket animationPacket = new EntityAnimationPacket();
|
||||||
@ -432,8 +433,8 @@ public abstract class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a {@link EntityAnimationPacket} to swing the off hand
|
* Sends a {@link EntityAnimationPacket} to swing the off hand
|
||||||
* (can be used for attack animation)
|
* (can be used for attack animation).
|
||||||
*/
|
*/
|
||||||
public void swingOffHand() {
|
public void swingOffHand() {
|
||||||
EntityAnimationPacket animationPacket = new EntityAnimationPacket();
|
EntityAnimationPacket animationPacket = new EntityAnimationPacket();
|
||||||
@ -460,7 +461,7 @@ public abstract class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an {@link EntityPropertiesPacket} for this entity with all of its attributes values.
|
* Gets an {@link EntityPropertiesPacket} for this entity with all of its attributes values.
|
||||||
*
|
*
|
||||||
* @return an {@link EntityPropertiesPacket} linked to this entity
|
* @return an {@link EntityPropertiesPacket} linked to this entity
|
||||||
*/
|
*/
|
||||||
@ -504,7 +505,7 @@ public abstract class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the time in ms between two fire damage applications
|
* Gets the time in ms between two fire damage applications.
|
||||||
*
|
*
|
||||||
* @return the time in ms
|
* @return the time in ms
|
||||||
*/
|
*/
|
||||||
@ -513,7 +514,7 @@ public abstract class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the delay between two fire damage applications
|
* Changes the delay between two fire damage applications.
|
||||||
*
|
*
|
||||||
* @param fireDamagePeriod the delay
|
* @param fireDamagePeriod the delay
|
||||||
* @param timeUnit the time unit
|
* @param timeUnit the time unit
|
||||||
@ -524,7 +525,7 @@ public abstract class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the {@link Team} for the entity
|
* Changes the {@link Team} for the entity.
|
||||||
*
|
*
|
||||||
* @param team The new team
|
* @param team The new team
|
||||||
*/
|
*/
|
||||||
@ -551,7 +552,7 @@ public abstract class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the {@link Team} of the entity
|
* Gets the {@link Team} of the entity.¬
|
||||||
*
|
*
|
||||||
* @return the {@link Team}
|
* @return the {@link Team}
|
||||||
*/
|
*/
|
||||||
|
@ -12,7 +12,7 @@ public abstract class ObjectEntity extends Entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the data of this object entity
|
* Gets the data of this object entity.
|
||||||
*
|
*
|
||||||
* @return an object data
|
* @return an object data
|
||||||
* @see <a href="https://wiki.vg/Object_Data">here</a>
|
* @see <a href="https://wiki.vg/Object_Data">here</a>
|
||||||
|
@ -817,7 +817,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player additional hearts
|
* Gets the player additional hearts.
|
||||||
*
|
*
|
||||||
* @return the player additional hearts
|
* @return the player additional hearts
|
||||||
*/
|
*/
|
||||||
@ -826,7 +826,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the internal field and send the appropriate {@link EntityMetaDataPacket}
|
* Updates the internal field and send the appropriate {@link EntityMetaDataPacket}.
|
||||||
*
|
*
|
||||||
* @param additionalHearts the count of additional hearts
|
* @param additionalHearts the count of additional hearts
|
||||||
*/
|
*/
|
||||||
@ -836,7 +836,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player food
|
* Gets the player food.
|
||||||
*
|
*
|
||||||
* @return the player food
|
* @return the player food
|
||||||
*/
|
*/
|
||||||
@ -845,7 +845,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set and refresh client food bar
|
* Sets and refresh client food bar.
|
||||||
*
|
*
|
||||||
* @param food the new food value
|
* @param food the new food value
|
||||||
*/
|
*/
|
||||||
@ -860,7 +860,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set and refresh client food saturation
|
* Sets and refresh client food saturation.
|
||||||
*
|
*
|
||||||
* @param foodSaturation the food saturation
|
* @param foodSaturation the food saturation
|
||||||
*/
|
*/
|
||||||
@ -871,7 +871,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the player is eating
|
* Gets if the player is eating.
|
||||||
*
|
*
|
||||||
* @return true if the player is eating, false otherwise
|
* @return true if the player is eating, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -880,7 +880,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player default eating time
|
* Gets the player default eating time.
|
||||||
*
|
*
|
||||||
* @return the player default eating time
|
* @return the player default eating time
|
||||||
*/
|
*/
|
||||||
@ -889,7 +889,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to change the default eating time animation
|
* Used to change the default eating time animation.
|
||||||
*
|
*
|
||||||
* @param defaultEatingTime the default eating time in milliseconds
|
* @param defaultEatingTime the default eating time in milliseconds
|
||||||
*/
|
*/
|
||||||
@ -898,7 +898,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player display name in the tab-list
|
* Gets the player display name in the tab-list.
|
||||||
*
|
*
|
||||||
* @return the player display name,
|
* @return the player display name,
|
||||||
* null means that {@link #getUsername()} is displayed
|
* null means that {@link #getUsername()} is displayed
|
||||||
@ -908,9 +908,9 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the player display name in the tab-list
|
* Changes the player display name in the tab-list.
|
||||||
* <p>
|
* <p>
|
||||||
* Set to null to show the player username
|
* Sets to null to show the player username.
|
||||||
*
|
*
|
||||||
* @param displayName the display name
|
* @param displayName the display name
|
||||||
*/
|
*/
|
||||||
@ -923,7 +923,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player skin
|
* Gets the player skin.
|
||||||
*
|
*
|
||||||
* @return the player skin object,
|
* @return the player skin object,
|
||||||
* null means that the player has his {@link #getUuid()} default skin
|
* null means that the player has his {@link #getUuid()} default skin
|
||||||
@ -933,9 +933,9 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the player skin
|
* Changes the player skin.
|
||||||
* <p>
|
* <p>
|
||||||
* This does remove the player for all viewers to spawn it again with the correct new skin
|
* This does remove the player for all viewers to spawn it again with the correct new skin.
|
||||||
*
|
*
|
||||||
* @param skin the player skin, null to reset it to his {@link #getUuid()} default skin
|
* @param skin the player skin, null to reset it to his {@link #getUuid()} default skin
|
||||||
*/
|
*/
|
||||||
@ -972,7 +972,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the player has the respawn screen enabled or disabled
|
* Gets if the player has the respawn screen enabled or disabled.
|
||||||
*
|
*
|
||||||
* @return true if the player has the respawn screen, false if he didn't
|
* @return true if the player has the respawn screen, false if he didn't
|
||||||
*/
|
*/
|
||||||
@ -981,7 +981,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable or disable the respawn screen
|
* Enables or disable the respawn screen.
|
||||||
*
|
*
|
||||||
* @param enableRespawnScreen true to enable the respawn screen, false to disable it
|
* @param enableRespawnScreen true to enable the respawn screen, false to disable it
|
||||||
*/
|
*/
|
||||||
@ -991,7 +991,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player username
|
* Gets the player username.
|
||||||
*
|
*
|
||||||
* @return the player username
|
* @return the player username
|
||||||
*/
|
*/
|
||||||
@ -1000,8 +1000,8 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the internal player name, used for the {@link PlayerPreLoginEvent}
|
* Changes the internal player name, used for the {@link PlayerPreLoginEvent}
|
||||||
* mostly unsafe outside of it
|
* mostly unsafe outside of it.
|
||||||
*
|
*
|
||||||
* @param username the new player name
|
* @param username the new player name
|
||||||
*/
|
*/
|
||||||
@ -1027,7 +1027,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the player resource pack
|
* Sets the player resource pack.
|
||||||
*
|
*
|
||||||
* @param resourcePack the resource pack
|
* @param resourcePack the resource pack
|
||||||
*/
|
*/
|
||||||
@ -1043,7 +1043,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rotate the player to face {@code targetPosition}
|
* Rotates the player to face {@code targetPosition}.
|
||||||
*
|
*
|
||||||
* @param facePoint the point from where the player should aim
|
* @param facePoint the point from where the player should aim
|
||||||
* @param targetPosition the target position to face
|
* @param targetPosition the target position to face
|
||||||
@ -1053,7 +1053,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rotate the player to face {@code entity}
|
* Rotates the player to face {@code entity}.
|
||||||
*
|
*
|
||||||
* @param facePoint the point from where the player should aim
|
* @param facePoint the point from where the player should aim
|
||||||
* @param entity the entity to face
|
* @param entity the entity to face
|
||||||
@ -1079,7 +1079,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the camera at {@code entity} eyes
|
* Sets the camera at {@code entity} eyes.
|
||||||
*
|
*
|
||||||
* @param entity the entity to spectate
|
* @param entity the entity to spectate
|
||||||
*/
|
*/
|
||||||
@ -1090,7 +1090,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset the camera at the player
|
* Resets the camera at the player.
|
||||||
*/
|
*/
|
||||||
public void stopSpectating() {
|
public void stopSpectating() {
|
||||||
spectate(this);
|
spectate(this);
|
||||||
@ -1098,7 +1098,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to retrieve the default spawn point
|
* Used to retrieve the default spawn point
|
||||||
* can be altered by the {@link PlayerRespawnEvent#setRespawnPosition(Position)}
|
* can be altered by the {@link PlayerRespawnEvent#setRespawnPosition(Position)}.
|
||||||
*
|
*
|
||||||
* @return the default respawn point
|
* @return the default respawn point
|
||||||
*/
|
*/
|
||||||
@ -1107,7 +1107,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the default spawn point
|
* Changes the default spawn point.
|
||||||
*
|
*
|
||||||
* @param respawnPoint the player respawn point
|
* @param respawnPoint the player respawn point
|
||||||
*/
|
*/
|
||||||
@ -1117,7 +1117,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called after the player teleportation to refresh his position
|
* Called after the player teleportation to refresh his position
|
||||||
* and send data to his new viewers
|
* and send data to his new viewers.
|
||||||
*/
|
*/
|
||||||
protected void refreshAfterTeleport() {
|
protected void refreshAfterTeleport() {
|
||||||
getInventory().update();
|
getInventory().update();
|
||||||
@ -1157,7 +1157,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the percentage displayed in the experience bar
|
* Gets the percentage displayed in the experience bar.
|
||||||
*
|
*
|
||||||
* @return the exp percentage 0-1
|
* @return the exp percentage 0-1
|
||||||
*/
|
*/
|
||||||
@ -1166,8 +1166,8 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to change the percentage experience bar
|
* Used to change the percentage experience bar.
|
||||||
* This cannot change the displayed level, see {@link #setLevel(int)}
|
* This cannot change the displayed level, see {@link #setLevel(int)}.
|
||||||
*
|
*
|
||||||
* @param exp a percentage between 0 and 1
|
* @param exp a percentage between 0 and 1
|
||||||
*/
|
*/
|
||||||
@ -1179,7 +1179,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the level of the player displayed in the experience bar
|
* Gets the level of the player displayed in the experience bar.
|
||||||
*
|
*
|
||||||
* @return the player level
|
* @return the player level
|
||||||
*/
|
*/
|
||||||
@ -1206,10 +1206,10 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the player changes chunk (move from one to another)
|
* Called when the player changes chunk (move from one to another).
|
||||||
* <p>
|
* <p>
|
||||||
* It does remove and add the player from the chunks viewers list when removed or added
|
* It does remove and add the player from the chunks viewers list when removed or added.
|
||||||
* It also calls the events {@link PlayerChunkUnloadEvent} and {@link PlayerChunkLoadEvent}
|
* It also calls the events {@link PlayerChunkUnloadEvent} and {@link PlayerChunkLoadEvent}.
|
||||||
*
|
*
|
||||||
* @param newChunk the current/new player chunk
|
* @param newChunk the current/new player chunk
|
||||||
*/
|
*/
|
||||||
@ -1275,9 +1275,9 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player connection
|
* Gets the player connection.
|
||||||
* <p>
|
* <p>
|
||||||
* Used to send packets and get relatives stuff to the connection
|
* Used to send packets and get relatives stuff to the connection.
|
||||||
*
|
*
|
||||||
* @return the player connection
|
* @return the player connection
|
||||||
*/
|
*/
|
||||||
@ -1286,7 +1286,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the player is online or not
|
* Gets if the player is online or not.
|
||||||
*
|
*
|
||||||
* @return true if the player is online, false otherwise
|
* @return true if the player is online, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -1295,7 +1295,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player settings
|
* Gets the player settings.
|
||||||
*
|
*
|
||||||
* @return the player settings
|
* @return the player settings
|
||||||
*/
|
*/
|
||||||
@ -1304,7 +1304,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player dimension
|
* Gets the player dimension.
|
||||||
*
|
*
|
||||||
* @return the player current dimension
|
* @return the player current dimension
|
||||||
*/
|
*/
|
||||||
@ -1318,7 +1318,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to get the player latency,
|
* Used to get the player latency,
|
||||||
* computed by seeing how long it takes the client to answer the {@link KeepAlivePacket} packet
|
* computed by seeing how long it takes the client to answer the {@link KeepAlivePacket} packet.
|
||||||
*
|
*
|
||||||
* @return the player latency
|
* @return the player latency
|
||||||
*/
|
*/
|
||||||
@ -1327,7 +1327,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player GameMode
|
* Gets the player GameMode.
|
||||||
*
|
*
|
||||||
* @return the player current gamemode
|
* @return the player current gamemode
|
||||||
*/
|
*/
|
||||||
@ -1336,7 +1336,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the player GameMode
|
* Changes the player {@link GameMode}.
|
||||||
*
|
*
|
||||||
* @param gameMode the new player GameMode
|
* @param gameMode the new player GameMode
|
||||||
*/
|
*/
|
||||||
@ -1351,7 +1351,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if this player is in creative. Used for code readability
|
* Gets if this player is in creative. Used for code readability.
|
||||||
*
|
*
|
||||||
* @return true if the player is in creative mode
|
* @return true if the player is in creative mode
|
||||||
*/
|
*/
|
||||||
@ -1360,8 +1360,8 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the dimension of the player
|
* Changes the dimension of the player.
|
||||||
* Mostly unsafe since it requires sending chunks after
|
* Mostly unsafe since it requires sending chunks after.
|
||||||
*
|
*
|
||||||
* @param dimensionType the new player dimension
|
* @param dimensionType the new player dimension
|
||||||
*/
|
*/
|
||||||
@ -1378,7 +1378,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kick the player with a reason
|
* Kick the player with a reason.
|
||||||
*
|
*
|
||||||
* @param text the kick reason
|
* @param text the kick reason
|
||||||
*/
|
*/
|
||||||
@ -1391,7 +1391,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kick the player with a reason
|
* Kick the player with a reason.
|
||||||
*
|
*
|
||||||
* @param message the kick reason
|
* @param message the kick reason
|
||||||
*/
|
*/
|
||||||
@ -1404,7 +1404,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the current held slot for the player
|
* Changes the current held slot for the player.
|
||||||
*
|
*
|
||||||
* @param slot the slot that the player has to held
|
* @param slot the slot that the player has to held
|
||||||
* @throws IllegalArgumentException if {@code slot} is not between 0 and 8
|
* @throws IllegalArgumentException if {@code slot} is not between 0 and 8
|
||||||
@ -1419,7 +1419,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player held slot (0-8)
|
* Gets the player held slot (0-8).
|
||||||
*
|
*
|
||||||
* @return the current held slot for the player
|
* @return the current held slot for the player
|
||||||
*/
|
*/
|
||||||
@ -1434,7 +1434,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the tag below the name
|
* Changes the tag below the name.
|
||||||
*
|
*
|
||||||
* @param belowNameTag The new below name tag
|
* @param belowNameTag The new below name tag
|
||||||
*/
|
*/
|
||||||
@ -1449,9 +1449,9 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the player is sneaking
|
* Gets if the player is sneaking.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: this can be bypassed by hacked client, this is only what the client told the server
|
* WARNING: this can be bypassed by hacked client, this is only what the client told the server.
|
||||||
*
|
*
|
||||||
* @return true if the player is sneaking
|
* @return true if the player is sneaking
|
||||||
*/
|
*/
|
||||||
@ -1460,9 +1460,9 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the player is sprinting
|
* Gets if the player is sprinting.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: this can be bypassed by hacked client, this is only what the client told the server
|
* WARNING: this can be bypassed by hacked client, this is only what the client told the server.
|
||||||
*
|
*
|
||||||
* @return true if the player is sprinting
|
* @return true if the player is sprinting
|
||||||
*/
|
*/
|
||||||
@ -1471,7 +1471,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to get the {@link CustomBlock} that the player is currently mining
|
* Used to get the {@link CustomBlock} that the player is currently mining.
|
||||||
*
|
*
|
||||||
* @return the currently mined {@link CustomBlock} by the player, null if there is not
|
* @return the currently mined {@link CustomBlock} by the player, null if there is not
|
||||||
*/
|
*/
|
||||||
@ -1480,7 +1480,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player open inventory
|
* Gets the player open inventory.
|
||||||
*
|
*
|
||||||
* @return the currently open inventory, null if there is not (player inventory is not detected)
|
* @return the currently open inventory, null if there is not (player inventory is not detected)
|
||||||
*/
|
*/
|
||||||
@ -1489,7 +1489,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open the specified Inventory, close the previous inventory if existing
|
* Opens the specified Inventory, close the previous inventory if existing.
|
||||||
*
|
*
|
||||||
* @param inventory the inventory to open
|
* @param inventory the inventory to open
|
||||||
* @return true if the inventory has been opened/sent to the player, false otherwise (cancelled by event)
|
* @return true if the inventory has been opened/sent to the player, false otherwise (cancelled by event)
|
||||||
@ -1521,8 +1521,8 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close the current inventory if there is any
|
* Closes the current inventory if there is any.
|
||||||
* It closes the player inventory (when opened) if {@link #getOpenInventory()} returns null
|
* It closes the player inventory (when opened) if {@link #getOpenInventory()} returns null.
|
||||||
*/
|
*/
|
||||||
public void closeInventory() {
|
public void closeInventory() {
|
||||||
Inventory openInventory = getOpenInventory();
|
Inventory openInventory = getOpenInventory();
|
||||||
@ -1558,9 +1558,9 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Used internally to prevent an inventory click to be processed
|
* Used internally to prevent an inventory click to be processed
|
||||||
* when the inventory listeners closed the inventory
|
* when the inventory listeners closed the inventory.
|
||||||
* <p>
|
* <p>
|
||||||
* Should only be used within an inventory listener (event or condition)
|
* Should only be used within an inventory listener (event or condition).
|
||||||
*
|
*
|
||||||
* @return true if the inventory has been closed, false otherwise
|
* @return true if the inventory has been closed, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -1569,9 +1569,9 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used internally to reset the didCloseInventory field
|
* Used internally to reset the didCloseInventory field.
|
||||||
* <p>
|
* <p>
|
||||||
* Shouldn't be used externally without proper understanding of its consequence
|
* Shouldn't be used externally without proper understanding of its consequence.
|
||||||
*
|
*
|
||||||
* @param didCloseInventory the new didCloseInventory field
|
* @param didCloseInventory the new didCloseInventory field
|
||||||
*/
|
*/
|
||||||
@ -1580,10 +1580,10 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player viewable chunks
|
* Gets the player viewable chunks.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: adding or removing a chunk there will not load/unload it,
|
* WARNING: adding or removing a chunk there will not load/unload it,
|
||||||
* use {@link Chunk#addViewer(Player)} or {@link Chunk#removeViewer(Player)}
|
* use {@link Chunk#addViewer(Player)} or {@link Chunk#removeViewer(Player)}.
|
||||||
*
|
*
|
||||||
* @return a {@link Set} containing all the chunks that the player sees
|
* @return a {@link Set} containing all the chunks that the player sees
|
||||||
*/
|
*/
|
||||||
@ -1592,7 +1592,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a {@link UpdateViewPositionPacket} to the player
|
* Sends a {@link UpdateViewPositionPacket} to the player.
|
||||||
*
|
*
|
||||||
* @param chunk the chunk to update the view
|
* @param chunk the chunk to update the view
|
||||||
*/
|
*/
|
||||||
@ -1615,7 +1615,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player permission level
|
* Gets the player permission level.
|
||||||
*
|
*
|
||||||
* @return the player permission level
|
* @return the player permission level
|
||||||
*/
|
*/
|
||||||
@ -1624,7 +1624,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the player permission level
|
* Changes the player permission level.
|
||||||
*
|
*
|
||||||
* @param permissionLevel the new player permission level
|
* @param permissionLevel the new player permission level
|
||||||
*/
|
*/
|
||||||
@ -1640,7 +1640,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set or remove the reduced debug screen
|
* Sets or remove the reduced debug screen.
|
||||||
*
|
*
|
||||||
* @param reduced should the player has the reduced debug screen
|
* @param reduced should the player has the reduced debug screen
|
||||||
*/
|
*/
|
||||||
@ -1654,7 +1654,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the player has the reduced debug screen
|
* Gets if the player has the reduced debug screen.
|
||||||
*
|
*
|
||||||
* @return true if the player has the reduced debug screen, false otherwise
|
* @return true if the player has the reduced debug screen, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -1663,7 +1663,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The invulnerable field appear in the {@link PlayerAbilitiesPacket} packet
|
* The invulnerable field appear in the {@link PlayerAbilitiesPacket} packet.
|
||||||
*
|
*
|
||||||
* @return true if the player is invulnerable, false otherwise
|
* @return true if the player is invulnerable, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -1673,7 +1673,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This do update the {@code invulnerable} field in the packet {@link PlayerAbilitiesPacket}
|
* This do update the {@code invulnerable} field in the packet {@link PlayerAbilitiesPacket}
|
||||||
* and prevent the player from receiving damage
|
* and prevent the player from receiving damage.
|
||||||
*
|
*
|
||||||
* @param invulnerable should the player be invulnerable
|
* @param invulnerable should the player be invulnerable
|
||||||
*/
|
*/
|
||||||
@ -1683,7 +1683,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the player is currently flying
|
* Gets if the player is currently flying.
|
||||||
*
|
*
|
||||||
* @return true if the player if flying, false otherwise
|
* @return true if the player if flying, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -1692,7 +1692,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the player flying
|
* Sets the player flying.
|
||||||
*
|
*
|
||||||
* @param flying should the player fly
|
* @param flying should the player fly
|
||||||
*/
|
*/
|
||||||
@ -1702,9 +1702,9 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the internal flying field
|
* Updates the internal flying field.
|
||||||
* <p>
|
* <p>
|
||||||
* Mostly unsafe since there is nothing to backup the value, used internally for creative players
|
* Mostly unsafe since there is nothing to backup the value, used internally for creative players.
|
||||||
*
|
*
|
||||||
* @param flying the new flying field
|
* @param flying the new flying field
|
||||||
* @see #setFlying(boolean) instead
|
* @see #setFlying(boolean) instead
|
||||||
@ -1714,7 +1714,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the player is allowed to fly
|
* Gets if the player is allowed to fly.
|
||||||
*
|
*
|
||||||
* @return true if the player if allowed to fly, false otherwise
|
* @return true if the player if allowed to fly, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -1723,7 +1723,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow or forbid the player to fly
|
* Allows or forbid the player to fly.
|
||||||
*
|
*
|
||||||
* @param allowFlying should the player be allowed to fly
|
* @param allowFlying should the player be allowed to fly
|
||||||
*/
|
*/
|
||||||
@ -1737,10 +1737,10 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the player ability "Creative Mode"
|
* Changes the player ability "Creative Mode".
|
||||||
* <a href="https://wiki.vg/Protocol#Player_Abilities_.28clientbound.29">see</a>
|
* <a href="https://wiki.vg/Protocol#Player_Abilities_.28clientbound.29">see</a>
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: this has nothing to do with {@link CustomBlock#getBreakDelay(Player, BlockPosition, byte, Set)}
|
* WARNING: this has nothing to do with {@link CustomBlock#getBreakDelay(Player, BlockPosition, byte, Set)}.
|
||||||
*
|
*
|
||||||
* @param instantBreak true to allow instant break
|
* @param instantBreak true to allow instant break
|
||||||
*/
|
*/
|
||||||
@ -1750,7 +1750,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player flying speed
|
* Gets the player flying speed.
|
||||||
*
|
*
|
||||||
* @return the flying speed of the player
|
* @return the flying speed of the player
|
||||||
*/
|
*/
|
||||||
@ -1759,7 +1759,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the internal field and send a {@link PlayerAbilitiesPacket} with the new flying speed
|
* Updates the internal field and send a {@link PlayerAbilitiesPacket} with the new flying speed.
|
||||||
*
|
*
|
||||||
* @param flyingSpeed the new flying speed of the player
|
* @param flyingSpeed the new flying speed of the player
|
||||||
*/
|
*/
|
||||||
@ -1778,8 +1778,8 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the map used to send the statistic packet
|
* This is the map used to send the statistic packet.
|
||||||
* It is possible to add/remove/change statistic value directly into it
|
* It is possible to add/remove/change statistic value directly into it.
|
||||||
*
|
*
|
||||||
* @return the modifiable statistic map
|
* @return the modifiable statistic map
|
||||||
*/
|
*/
|
||||||
@ -1788,7 +1788,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player vehicle information
|
* Gets the player vehicle information.
|
||||||
*
|
*
|
||||||
* @return the player vehicle information
|
* @return the player vehicle information
|
||||||
*/
|
*/
|
||||||
@ -1797,8 +1797,8 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send to the player a {@link PlayerAbilitiesPacket} with all the updated fields
|
* Sends to the player a {@link PlayerAbilitiesPacket} with all the updated fields
|
||||||
* (walkingSpeed set to 0.1)
|
* (walkingSpeed set to 0.1).
|
||||||
*/
|
*/
|
||||||
protected void refreshAbilities() {
|
protected void refreshAbilities() {
|
||||||
PlayerAbilitiesPacket playerAbilitiesPacket = new PlayerAbilitiesPacket();
|
PlayerAbilitiesPacket playerAbilitiesPacket = new PlayerAbilitiesPacket();
|
||||||
@ -1814,8 +1814,8 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* All packets in the queue are executed in the {@link #update(long)} method
|
* All packets in the queue are executed in the {@link #update(long)} method
|
||||||
* It is used internally to add all received packet from the client
|
* It is used internally to add all received packet from the client.
|
||||||
* Could be used to "simulate" a received packet, but to use at your own risk
|
* Could be used to "simulate" a received packet, but to use at your own risk.
|
||||||
*
|
*
|
||||||
* @param packet the packet to add in the queue
|
* @param packet the packet to add in the queue
|
||||||
*/
|
*/
|
||||||
@ -1824,7 +1824,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the storage player latency and update its tab value
|
* Changes the storage player latency and update its tab value.
|
||||||
*
|
*
|
||||||
* @param latency the new player latency
|
* @param latency the new player latency
|
||||||
*/
|
*/
|
||||||
@ -1840,9 +1840,9 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to change internally the last sent last keep alive id
|
* Used to change internally the last sent last keep alive id.
|
||||||
* <p>
|
* <p>
|
||||||
* Warning: could lead to have the player kicked because of a wrong keep alive packet
|
* Warning: could lead to have the player kicked because of a wrong keep alive packet.
|
||||||
*
|
*
|
||||||
* @param lastKeepAlive the new lastKeepAlive id
|
* @param lastKeepAlive the new lastKeepAlive id
|
||||||
*/
|
*/
|
||||||
@ -1860,11 +1860,11 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the held item for the player viewers
|
* Changes the held item for the player viewers
|
||||||
* Also cancel eating if {@link #isEating()} was true
|
* Also cancel eating if {@link #isEating()} was true.
|
||||||
* <p>
|
* <p>
|
||||||
* Warning: the player will not be noticed by this chance, only his viewers,
|
* Warning: the player will not be noticed by this chance, only his viewers,
|
||||||
* see instead: {@link #setHeldItemSlot(byte)}
|
* see instead: {@link #setHeldItemSlot(byte)}.
|
||||||
*
|
*
|
||||||
* @param slot the new held slot
|
* @param slot the new held slot
|
||||||
*/
|
*/
|
||||||
@ -1891,7 +1891,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to call {@link ItemUpdateStateEvent} with the proper item
|
* Used to call {@link ItemUpdateStateEvent} with the proper item
|
||||||
* It does check which hand to get the item to update
|
* It does check which hand to get the item to update.
|
||||||
*
|
*
|
||||||
* @param allowFood true if food should be updated, false otherwise
|
* @param allowFood true if food should be updated, false otherwise
|
||||||
* @return the called {@link ItemUpdateStateEvent},
|
* @return the called {@link ItemUpdateStateEvent},
|
||||||
@ -1920,7 +1920,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make the player digging a custom block, see {@link #resetTargetBlock()} to rewind
|
* Makes the player digging a custom block, see {@link #resetTargetBlock()} to rewind.
|
||||||
*
|
*
|
||||||
* @param targetCustomBlock the custom block to dig
|
* @param targetCustomBlock the custom block to dig
|
||||||
* @param targetBlockPosition the custom block position
|
* @param targetBlockPosition the custom block position
|
||||||
@ -1934,7 +1934,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh the break delay for the next block break stage
|
* Refreshes the break delay for the next block break stage.
|
||||||
*
|
*
|
||||||
* @param breakers the list of breakers, can be null if {@code this} is the only breaker
|
* @param breakers the list of breakers, can be null if {@code this} is the only breaker
|
||||||
*/
|
*/
|
||||||
@ -1953,8 +1953,8 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset data from the current block the player is mining.
|
* Resets data from the current block the player is mining.
|
||||||
* If the currently mined block (or if there isn't any) is not a {@link CustomBlock}, nothing happen
|
* If the currently mined block (or if there isn't any) is not a {@link CustomBlock}, nothing happen.
|
||||||
*/
|
*/
|
||||||
public void resetTargetBlock() {
|
public void resetTargetBlock() {
|
||||||
// Remove effect
|
// Remove effect
|
||||||
@ -1990,7 +1990,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the last sent keep alive id
|
* Gets the last sent keep alive id.
|
||||||
*
|
*
|
||||||
* @return the last keep alive id sent to the player
|
* @return the last keep alive id sent to the player
|
||||||
*/
|
*/
|
||||||
@ -1999,7 +1999,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the packet to add the player from the tab-list
|
* Gets the packet to add the player from the tab-list.
|
||||||
*
|
*
|
||||||
* @return a {@link PlayerInfoPacket} to add the player
|
* @return a {@link PlayerInfoPacket} to add the player
|
||||||
*/
|
*/
|
||||||
@ -2025,7 +2025,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the packet to remove the player from the tab-list
|
* Gets the packet to remove the player from the tab-list.
|
||||||
*
|
*
|
||||||
* @return a {@link PlayerInfoPacket} to remove the player
|
* @return a {@link PlayerInfoPacket} to remove the player
|
||||||
*/
|
*/
|
||||||
@ -2040,10 +2040,10 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send all the related packet to have the player sent to another with related data
|
* Sends all the related packet to have the player sent to another with related data
|
||||||
* (create player, spawn position, velocity, metadata, equipments, passengers, team)
|
* (create player, spawn position, velocity, metadata, equipments, passengers, team).
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: this alone does not sync the player, please use {@link #addViewer(Player)}
|
* WARNING: this alone does not sync the player, please use {@link #addViewer(Player)}.
|
||||||
*
|
*
|
||||||
* @param connection the connection to show the player to
|
* @param connection the connection to show the player to
|
||||||
*/
|
*/
|
||||||
@ -2137,7 +2137,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represent the main or off hand of the player
|
* Represents the main or off hand of the player.
|
||||||
*/
|
*/
|
||||||
public enum Hand {
|
public enum Hand {
|
||||||
MAIN,
|
MAIN,
|
||||||
@ -2152,7 +2152,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
// Settings enum
|
// Settings enum
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represent where is located the main hand of the player (can be changed in Minecraft option)
|
* Represents where is located the main hand of the player (can be changed in Minecraft option).
|
||||||
*/
|
*/
|
||||||
public enum MainHand {
|
public enum MainHand {
|
||||||
LEFT,
|
LEFT,
|
||||||
@ -2175,7 +2175,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
private MainHand mainHand;
|
private MainHand mainHand;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The player game language
|
* The player game language.
|
||||||
*
|
*
|
||||||
* @return the player locale
|
* @return the player locale
|
||||||
*/
|
*/
|
||||||
@ -2184,7 +2184,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player view distance
|
* Gets the player view distance.
|
||||||
*
|
*
|
||||||
* @return the player view distance
|
* @return the player view distance
|
||||||
*/
|
*/
|
||||||
@ -2193,7 +2193,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player chat mode
|
* Gets the player chat mode.
|
||||||
*
|
*
|
||||||
* @return the player chat mode
|
* @return the player chat mode
|
||||||
*/
|
*/
|
||||||
@ -2202,7 +2202,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the player has chat colors enabled
|
* Gets if the player has chat colors enabled.
|
||||||
*
|
*
|
||||||
* @return true if chat colors are enabled, false otherwise
|
* @return true if chat colors are enabled, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -2215,7 +2215,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player main hand
|
* Gets the player main hand.
|
||||||
*
|
*
|
||||||
* @return the player main hand
|
* @return the player main hand
|
||||||
*/
|
*/
|
||||||
@ -2224,9 +2224,9 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the player settings internally
|
* Changes the player settings internally.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: the player will not be noticed by this change, probably unsafe
|
* WARNING: the player will not be noticed by this change, probably unsafe.
|
||||||
*
|
*
|
||||||
* @param locale the player locale
|
* @param locale the player locale
|
||||||
* @param viewDistance the player view distance
|
* @param viewDistance the player view distance
|
||||||
|
@ -25,7 +25,7 @@ public class PlayerSkin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the skin textures value.
|
* Gets the skin textures value.
|
||||||
*
|
*
|
||||||
* @return the textures value
|
* @return the textures value
|
||||||
*/
|
*/
|
||||||
@ -34,7 +34,7 @@ public class PlayerSkin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the skin signature.
|
* Gets the skin signature.
|
||||||
*
|
*
|
||||||
* @return the skin signature
|
* @return the skin signature
|
||||||
*/
|
*/
|
||||||
@ -43,7 +43,7 @@ public class PlayerSkin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a skin from a Mojang UUID.
|
* Gets a skin from a Mojang UUID.
|
||||||
*
|
*
|
||||||
* @param uuid Mojang UUID
|
* @param uuid Mojang UUID
|
||||||
* @return a player skin based on the UUID, null if not found
|
* @return a player skin based on the UUID, null if not found
|
||||||
@ -73,7 +73,7 @@ public class PlayerSkin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a skin from a Minecraft username.
|
* Gets a skin from a Minecraft username.
|
||||||
*
|
*
|
||||||
* @param username the Minecraft username
|
* @param username the Minecraft username
|
||||||
* @return a skin based on a Minecraft username, null if not found
|
* @return a skin based on a Minecraft username, null if not found
|
||||||
|
@ -5,7 +5,7 @@ import net.minestom.server.entity.EntityCreature;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The target selector is called each time the entity receives an "attack" instruction
|
* The target selector is called each time the entity receives an "attack" instruction
|
||||||
* without having a target
|
* without having a target.
|
||||||
*/
|
*/
|
||||||
public abstract class TargetSelector {
|
public abstract class TargetSelector {
|
||||||
|
|
||||||
@ -16,17 +16,17 @@ public abstract class TargetSelector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the target
|
* Finds the target.
|
||||||
* <p>
|
* <p>
|
||||||
* returning null means that this target selector didn't find any entity,
|
* Returning null means that this target selector didn't find any entity,
|
||||||
* the next {@link TargetSelector} will be called until the end of the list or an entity is found
|
* the next {@link TargetSelector} will be called until the end of the list or an entity is found.
|
||||||
*
|
*
|
||||||
* @return the target, null if not any
|
* @return the target, null if not any
|
||||||
*/
|
*/
|
||||||
public abstract Entity findTarget();
|
public abstract Entity findTarget();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the entity linked to this target selector
|
* Gets the entity linked to this target selector.
|
||||||
*
|
*
|
||||||
* @return the entity
|
* @return the entity
|
||||||
*/
|
*/
|
||||||
|
@ -3,7 +3,7 @@ package net.minestom.server.entity.damage;
|
|||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents damage inflicted by an entity
|
* Represents damage inflicted by an entity.
|
||||||
*/
|
*/
|
||||||
public class EntityDamage extends DamageType {
|
public class EntityDamage extends DamageType {
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ public class EntityDamage extends DamageType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the source of the damage
|
* Gets the source of the damage.
|
||||||
*
|
*
|
||||||
* @return the source
|
* @return the source
|
||||||
*/
|
*/
|
||||||
|
@ -17,7 +17,7 @@ public class EntityProjectileDamage extends DamageType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the projectile responsible for the damage.
|
* Gets the projectile responsible for the damage.
|
||||||
*
|
*
|
||||||
* @return the projectile
|
* @return the projectile
|
||||||
*/
|
*/
|
||||||
@ -26,7 +26,7 @@ public class EntityProjectileDamage extends DamageType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the shooter of the projectile.
|
* Gets the shooter of the projectile.
|
||||||
*
|
*
|
||||||
* @return the shooter of the projectile, null if not any
|
* @return the shooter of the projectile, null if not any
|
||||||
*/
|
*/
|
||||||
|
@ -28,7 +28,7 @@ public class FakePlayer extends Player {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init a new FakePlayer
|
* Init a new {@link FakePlayer}.
|
||||||
*
|
*
|
||||||
* @param uuid the FakePlayer uuid
|
* @param uuid the FakePlayer uuid
|
||||||
* @param username the FakePlayer username
|
* @param username the FakePlayer username
|
||||||
@ -46,7 +46,7 @@ public class FakePlayer extends Player {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init a new FakePlayer without adding him in cache
|
* Init a new {@link FakePlayer} without adding him in cache.
|
||||||
*
|
*
|
||||||
* @param uuid the FakePlayer uuid
|
* @param uuid the FakePlayer uuid
|
||||||
* @param username the FakePlayer username
|
* @param username the FakePlayer username
|
||||||
@ -59,7 +59,7 @@ public class FakePlayer extends Player {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the fake player option container
|
* Gets the fake player option container.
|
||||||
*
|
*
|
||||||
* @return the fake player option
|
* @return the fake player option
|
||||||
*/
|
*/
|
||||||
|
@ -8,7 +8,7 @@ public class FakePlayerOption {
|
|||||||
private boolean inTabList = false;
|
private boolean inTabList = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the player is registered internally as a Player
|
* Gets if the player is registered internally as a Player.
|
||||||
*
|
*
|
||||||
* @return true if the player is registered in {@link ConnectionManager}, false otherwise
|
* @return true if the player is registered in {@link ConnectionManager}, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -17,9 +17,9 @@ public class FakePlayerOption {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the FakePlayer as registered or not
|
* Sets the FakePlayer as registered or not.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: this can't be changed halfway
|
* WARNING: this can't be changed halfway.
|
||||||
*
|
*
|
||||||
* @param registered should the fake player be registered internally
|
* @param registered should the fake player be registered internally
|
||||||
*/
|
*/
|
||||||
@ -28,7 +28,7 @@ public class FakePlayerOption {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the player is visible in the tab-list or not
|
* Gets if the player is visible in the tab-list or not.
|
||||||
*
|
*
|
||||||
* @return true if the player is in the tab-list, false otherwise
|
* @return true if the player is in the tab-list, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -37,9 +37,9 @@ public class FakePlayerOption {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the player in the tab-list or not
|
* Sets the player in the tab-list or not.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: this can't be changed halfway
|
* WARNING: this can't be changed halfway.
|
||||||
*
|
*
|
||||||
* @param inTabList should the player be in the tab-list
|
* @param inTabList should the player be in the tab-list
|
||||||
*/
|
*/
|
||||||
|
@ -11,7 +11,7 @@ import net.minestom.server.utils.validate.Check;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represent an invisible armor stand showing a colored text
|
* Represents an invisible armor stand showing a {@link ColoredText}.
|
||||||
*/
|
*/
|
||||||
public class Hologram implements Viewable {
|
public class Hologram implements Viewable {
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ public class Hologram implements Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the position of the hologram
|
* Gets the position of the hologram.
|
||||||
*
|
*
|
||||||
* @return the hologram's position
|
* @return the hologram's position
|
||||||
*/
|
*/
|
||||||
@ -47,7 +47,7 @@ public class Hologram implements Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the position of the hologram
|
* Changes the position of the hologram.
|
||||||
*
|
*
|
||||||
* @param position the new hologram's position
|
* @param position the new hologram's position
|
||||||
*/
|
*/
|
||||||
@ -59,7 +59,7 @@ public class Hologram implements Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the hologram text
|
* Gets the hologram text.
|
||||||
*
|
*
|
||||||
* @return the hologram text
|
* @return the hologram text
|
||||||
*/
|
*/
|
||||||
@ -68,7 +68,7 @@ public class Hologram implements Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the hologram text
|
* Changes the hologram text.
|
||||||
*
|
*
|
||||||
* @param text the new hologram text
|
* @param text the new hologram text
|
||||||
*/
|
*/
|
||||||
@ -79,7 +79,7 @@ public class Hologram implements Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the hologram
|
* Removes the hologram.
|
||||||
*/
|
*/
|
||||||
public void remove() {
|
public void remove() {
|
||||||
this.removed = true;
|
this.removed = true;
|
||||||
@ -87,7 +87,7 @@ public class Hologram implements Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the hologram is still present
|
* Checks if the hologram is still present.
|
||||||
*
|
*
|
||||||
* @return true if the hologram is present, false otherwise
|
* @return true if the hologram is present, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -96,7 +96,7 @@ public class Hologram implements Viewable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the hologram entity (armor stand)
|
* Gets the hologram entity (armor stand).
|
||||||
*
|
*
|
||||||
* @return the hologram entity
|
* @return the hologram entity
|
||||||
*/
|
*/
|
||||||
|
@ -7,27 +7,27 @@ import net.minestom.server.instance.block.Block;
|
|||||||
|
|
||||||
public class PFBlockDescription implements IBlockDescription {
|
public class PFBlockDescription implements IBlockDescription {
|
||||||
|
|
||||||
private static final Short2ObjectMap<PFBlockDescription> BLOCK_DESCRITION_MAP = new Short2ObjectOpenHashMap<>();
|
private static final Short2ObjectMap<PFBlockDescription> BLOCK_DESCRIPTION_MAP = new Short2ObjectOpenHashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link PFBlockDescription} linked to the block state id
|
* Gets the {@link PFBlockDescription} linked to the block state id.
|
||||||
* <p>
|
* <p>
|
||||||
* Cache the result if it is not already
|
* Cache the result if it is not already.
|
||||||
*
|
*
|
||||||
* @param blockStateId the block state id
|
* @param blockStateId the block state id
|
||||||
* @return the {@link PFBlockDescription} linked to {@code blockStateId}
|
* @return the {@link PFBlockDescription} linked to {@code blockStateId}
|
||||||
*/
|
*/
|
||||||
public static PFBlockDescription getBlockDescription(short blockStateId) {
|
public static PFBlockDescription getBlockDescription(short blockStateId) {
|
||||||
if (!BLOCK_DESCRITION_MAP.containsKey(blockStateId)) {
|
if (!BLOCK_DESCRIPTION_MAP.containsKey(blockStateId)) {
|
||||||
synchronized (BLOCK_DESCRITION_MAP) {
|
synchronized (BLOCK_DESCRIPTION_MAP) {
|
||||||
final Block block = Block.fromStateId(blockStateId);
|
final Block block = Block.fromStateId(blockStateId);
|
||||||
final PFBlockDescription blockDescription = new PFBlockDescription(block);
|
final PFBlockDescription blockDescription = new PFBlockDescription(block);
|
||||||
BLOCK_DESCRITION_MAP.put(blockStateId, blockDescription);
|
BLOCK_DESCRIPTION_MAP.put(blockStateId, blockDescription);
|
||||||
return blockDescription;
|
return blockDescription;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return BLOCK_DESCRITION_MAP.get(blockStateId);
|
return BLOCK_DESCRIPTION_MAP.get(blockStateId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Block block;
|
private final Block block;
|
||||||
|
@ -11,9 +11,9 @@ public class PFBlockObject implements IBlockObject {
|
|||||||
private static final Short2ObjectMap<PFBlockObject> BLOCK_OBJECT_MAP = new Short2ObjectOpenHashMap<>();
|
private static final Short2ObjectMap<PFBlockObject> BLOCK_OBJECT_MAP = new Short2ObjectOpenHashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link PFBlockObject} linked to the block state id
|
* Gets the {@link PFBlockObject} linked to the block state id.
|
||||||
* <p>
|
* <p>
|
||||||
* Cache the result if it is not already
|
* Cache the result if it is not already.
|
||||||
*
|
*
|
||||||
* @param blockStateId the block state id
|
* @param blockStateId the block state id
|
||||||
* @return the {@link PFBlockObject} linked to {@code blockStateId}
|
* @return the {@link PFBlockObject} linked to {@code blockStateId}
|
||||||
|
@ -36,7 +36,7 @@ public class EntityBat extends EntityCreature implements Animal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the bat is hanging
|
* Gets if the bat is hanging.
|
||||||
*
|
*
|
||||||
* @return true if the bat is hanging, false otherwise
|
* @return true if the bat is hanging, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -45,7 +45,7 @@ public class EntityBat extends EntityCreature implements Animal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make the bat hanging or cancel
|
* Makes the bat hanging or cancel.
|
||||||
*
|
*
|
||||||
* @param hanging true to make the bat hanging, false otherwise
|
* @param hanging true to make the bat hanging, false otherwise
|
||||||
*/
|
*/
|
||||||
|
@ -36,7 +36,7 @@ public class EntityPig extends EntityCreature implements Animal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the pig has a saddle
|
* Gets if the pig has a saddle.
|
||||||
*
|
*
|
||||||
* @return true if the pig has a saddle, false otherwise
|
* @return true if the pig has a saddle, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -45,7 +45,7 @@ public class EntityPig extends EntityCreature implements Animal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a saddle to the pig
|
* Sets a saddle to the pig.
|
||||||
*
|
*
|
||||||
* @param saddle true to add a saddle, false to remove it
|
* @param saddle true to add a saddle, false to remove it
|
||||||
*/
|
*/
|
||||||
|
@ -55,7 +55,7 @@ public class EntityItemFrame extends ObjectEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the item stack in the frame
|
* Gets the item stack in the frame.
|
||||||
*
|
*
|
||||||
* @return the item stack in the frame
|
* @return the item stack in the frame
|
||||||
*/
|
*/
|
||||||
@ -64,7 +64,7 @@ public class EntityItemFrame extends ObjectEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the item stack in the frame
|
* Changes the item stack in the frame.
|
||||||
*
|
*
|
||||||
* @param itemStack the new item stack in the frame
|
* @param itemStack the new item stack in the frame
|
||||||
*/
|
*/
|
||||||
@ -74,7 +74,7 @@ public class EntityItemFrame extends ObjectEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the item rotation
|
* Gets the item rotation.
|
||||||
*
|
*
|
||||||
* @return the item rotation
|
* @return the item rotation
|
||||||
*/
|
*/
|
||||||
@ -83,7 +83,7 @@ public class EntityItemFrame extends ObjectEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the item rotation
|
* Changes the item rotation.
|
||||||
*
|
*
|
||||||
* @param rotation the new item rotation
|
* @param rotation the new item rotation
|
||||||
*/
|
*/
|
||||||
@ -93,7 +93,7 @@ public class EntityItemFrame extends ObjectEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represent the orientation of the frame
|
* Represents the orientation of the frame.
|
||||||
*/
|
*/
|
||||||
public enum ItemFrameOrientation {
|
public enum ItemFrameOrientation {
|
||||||
DOWN, UP, NORTH, SOUTH, WEST, EAST
|
DOWN, UP, NORTH, SOUTH, WEST, EAST
|
||||||
|
@ -37,7 +37,7 @@ public class EntitySpider extends EntityCreature implements Monster {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the spider is climbing
|
* Gets if the spider is climbing.
|
||||||
*
|
*
|
||||||
* @return true if the spider is climbing, false otherwise
|
* @return true if the spider is climbing, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -46,7 +46,7 @@ public class EntitySpider extends EntityCreature implements Monster {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make the spider climbs
|
* Makes the spider climbs.
|
||||||
*
|
*
|
||||||
* @param climbing true to make the spider climbs, false otherwise
|
* @param climbing true to make the spider climbs, false otherwise
|
||||||
*/
|
*/
|
||||||
|
@ -42,7 +42,7 @@ public class EntityZombifiedPiglin extends EntityCreature implements Monster {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the pig zombie is a baby
|
* Gets if the pig zombie is a baby.
|
||||||
*
|
*
|
||||||
* @return true if it is a baby, false otherwise
|
* @return true if it is a baby, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -51,7 +51,7 @@ public class EntityZombifiedPiglin extends EntityCreature implements Monster {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the pig zombie a baby or adult
|
* Sets the pig zombie a baby or adult.
|
||||||
*
|
*
|
||||||
* @param baby true to make it a baby, false otherwise
|
* @param baby true to make it a baby, false otherwise
|
||||||
*/
|
*/
|
||||||
|
@ -38,7 +38,7 @@ public class EntityEyeOfEnder extends ObjectEntity implements Projectile {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the eye of ender item
|
* Gets the eye of ender item.
|
||||||
*
|
*
|
||||||
* @return the item
|
* @return the item
|
||||||
*/
|
*/
|
||||||
@ -47,9 +47,9 @@ public class EntityEyeOfEnder extends ObjectEntity implements Projectile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the eye of ender item
|
* Changes the eye of ender item.
|
||||||
* <p>
|
* <p>
|
||||||
* Can be null to make it like {@link Material#ENDER_EYE}
|
* Can be null to make it like {@link Material#ENDER_EYE}.
|
||||||
*
|
*
|
||||||
* @param itemStack the new item stack
|
* @param itemStack the new item stack
|
||||||
*/
|
*/
|
||||||
|
@ -57,7 +57,7 @@ public class EntityBoat extends ObjectEntity implements Vehicle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the boat type
|
* Gets the boat type.
|
||||||
*
|
*
|
||||||
* @return the boat type
|
* @return the boat type
|
||||||
*/
|
*/
|
||||||
@ -66,7 +66,7 @@ public class EntityBoat extends ObjectEntity implements Vehicle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the boat type
|
* Changes the boat type.
|
||||||
*
|
*
|
||||||
* @param boatType the new boat type
|
* @param boatType the new boat type
|
||||||
*/
|
*/
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package net.minestom.server.event;
|
package net.minestom.server.event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represent an {@link Event} which can be cancelled
|
* Represents an {@link Event} which can be cancelled.
|
||||||
*/
|
*/
|
||||||
public class CancellableEvent extends Event {
|
public class CancellableEvent extends Event {
|
||||||
|
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the {@link Event} should be cancelled or not
|
* Gets if the {@link Event} should be cancelled or not.
|
||||||
*
|
*
|
||||||
* @return true if the {@link Event} should be cancelled
|
* @return true if the {@link Event} should be cancelled
|
||||||
*/
|
*/
|
||||||
@ -17,7 +17,7 @@ public class CancellableEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark the {@link Event} as cancelled or not
|
* Marks the {@link Event} as cancelled or not.
|
||||||
*
|
*
|
||||||
* @param cancel true if the {@link Event} should be cancelled, false otherwise
|
* @param cancel true if the {@link Event} should be cancelled, false otherwise
|
||||||
*/
|
*/
|
||||||
|
@ -5,7 +5,7 @@ import net.minestom.server.entity.damage.DamageType;
|
|||||||
import net.minestom.server.event.CancellableEvent;
|
import net.minestom.server.event.CancellableEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called with {@link net.minestom.server.entity.LivingEntity#damage(DamageType, float)}
|
* Called with {@link LivingEntity#damage(DamageType, float)}.
|
||||||
*/
|
*/
|
||||||
public class EntityDamageEvent extends CancellableEvent {
|
public class EntityDamageEvent extends CancellableEvent {
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ public class EntityDamageEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the damaged entity
|
* Gets the damaged entity.
|
||||||
*
|
*
|
||||||
* @return the damaged entity
|
* @return the damaged entity
|
||||||
*/
|
*/
|
||||||
@ -29,7 +29,7 @@ public class EntityDamageEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the damage type
|
* Gets the damage type.
|
||||||
*
|
*
|
||||||
* @return the damage type
|
* @return the damage type
|
||||||
*/
|
*/
|
||||||
@ -38,7 +38,7 @@ public class EntityDamageEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the damage amount
|
* Gets the damage amount.
|
||||||
*
|
*
|
||||||
* @return the damage amount
|
* @return the damage amount
|
||||||
*/
|
*/
|
||||||
@ -47,7 +47,7 @@ public class EntityDamageEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the damage amount
|
* Changes the damage amount.
|
||||||
*
|
*
|
||||||
* @param damage the new damage amount
|
* @param damage the new damage amount
|
||||||
*/
|
*/
|
||||||
|
@ -5,7 +5,7 @@ import net.minestom.server.event.CancellableEvent;
|
|||||||
import net.minestom.server.item.ItemStack;
|
import net.minestom.server.item.ItemStack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when two {@link ItemEntity} are merging their ItemStack together to form a sole entity
|
* Called when two {@link ItemEntity} are merging their {@link ItemStack} together to form a sole entity.
|
||||||
*/
|
*/
|
||||||
public class EntityItemMergeEvent extends CancellableEvent {
|
public class EntityItemMergeEvent extends CancellableEvent {
|
||||||
|
|
||||||
@ -21,9 +21,9 @@ public class EntityItemMergeEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the entity who is receiving {@link #getMerged()} ItemStack
|
* Gets the {@link ItemEntity} who is receiving {@link #getMerged()}.
|
||||||
* <p>
|
* <p>
|
||||||
* This can be used to get the final ItemEntity position
|
* This can be used to get the final ItemEntity position.
|
||||||
*
|
*
|
||||||
* @return the source ItemEntity
|
* @return the source ItemEntity
|
||||||
*/
|
*/
|
||||||
@ -32,9 +32,9 @@ public class EntityItemMergeEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the entity who will be merged
|
* Gets the entity who will be merged.
|
||||||
* <p>
|
* <p>
|
||||||
* This entity will be removed after the event
|
* This entity will be removed after the event.
|
||||||
*
|
*
|
||||||
* @return the merged ItemEntity
|
* @return the merged ItemEntity
|
||||||
*/
|
*/
|
||||||
@ -43,7 +43,7 @@ public class EntityItemMergeEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the final item stack on the ground
|
* Gets the final item stack on the ground.
|
||||||
*
|
*
|
||||||
* @return the item stack
|
* @return the item stack
|
||||||
*/
|
*/
|
||||||
@ -52,7 +52,7 @@ public class EntityItemMergeEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the item stack which will appear on the ground
|
* Changes the item stack which will appear on the ground.
|
||||||
*
|
*
|
||||||
* @param result the new item stack
|
* @param result the new item stack
|
||||||
*/
|
*/
|
||||||
|
@ -5,7 +5,7 @@ import net.minestom.server.event.Event;
|
|||||||
import net.minestom.server.instance.Instance;
|
import net.minestom.server.instance.Instance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a new instance is set for an entity
|
* Called when a new instance is set for an entity.
|
||||||
*/
|
*/
|
||||||
public class EntitySpawnEvent extends Event {
|
public class EntitySpawnEvent extends Event {
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ public class EntitySpawnEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the entity who spawned in the instance
|
* Gets the entity who spawned in the instance.
|
||||||
*
|
*
|
||||||
* @return the entity
|
* @return the entity
|
||||||
*/
|
*/
|
||||||
@ -27,7 +27,7 @@ public class EntitySpawnEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the entity new instance
|
* Gets the entity new instance.
|
||||||
*
|
*
|
||||||
* @return the instance
|
* @return the instance
|
||||||
*/
|
*/
|
||||||
|
@ -11,19 +11,19 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
|||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an element which can have {@link Event} listeners assigned to it
|
* Represents an element which can have {@link Event} listeners assigned to it.
|
||||||
*/
|
*/
|
||||||
public interface EventHandler {
|
public interface EventHandler {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a {@link Map} containing all the listeners assigned to a specific {@link Event} type
|
* Gets a {@link Map} containing all the listeners assigned to a specific {@link Event} type.
|
||||||
*
|
*
|
||||||
* @return a {@link Map} with all the listeners
|
* @return a {@link Map} with all the listeners
|
||||||
*/
|
*/
|
||||||
Map<Class<? extends Event>, Collection<EventCallback>> getEventCallbacksMap();
|
Map<Class<? extends Event>, Collection<EventCallback>> getEventCallbacksMap();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new event callback for the specified type {@code eventClass}
|
* Adds a new event callback for the specified type {@code eventClass}.
|
||||||
*
|
*
|
||||||
* @param eventClass the event class
|
* @param eventClass the event class
|
||||||
* @param eventCallback the event callback
|
* @param eventCallback the event callback
|
||||||
@ -37,7 +37,7 @@ public interface EventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove an event callback
|
* Removes an event callback.
|
||||||
*
|
*
|
||||||
* @param eventClass the event class
|
* @param eventClass the event class
|
||||||
* @param eventCallback the event callback
|
* @param eventCallback the event callback
|
||||||
@ -51,7 +51,7 @@ public interface EventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the event callbacks of a specific event type
|
* Gets the event callbacks of a specific event type.
|
||||||
*
|
*
|
||||||
* @param eventClass the event class
|
* @param eventClass the event class
|
||||||
* @param <E> the event type
|
* @param <E> the event type
|
||||||
@ -63,7 +63,7 @@ public interface EventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a {@link Stream} containing all the {@link EventCallback}, no matter to which {@link Event} they are linked
|
* Gets a {@link Stream} containing all the {@link EventCallback}, no matter to which {@link Event} they are linked.
|
||||||
*
|
*
|
||||||
* @return a {@link Stream} containing all the callbacks
|
* @return a {@link Stream} containing all the callbacks
|
||||||
*/
|
*/
|
||||||
@ -72,7 +72,7 @@ public interface EventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call the specified {@link Event} with all the assigned {@link EventCallback}
|
* Calls the specified {@link Event} with all the assigned {@link EventCallback}.
|
||||||
*
|
*
|
||||||
* @param eventClass the event class
|
* @param eventClass the event class
|
||||||
* @param event the event object
|
* @param event the event object
|
||||||
@ -87,9 +87,9 @@ public interface EventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call a {@link CancellableEvent} and execute {@code successCallback} if the {@link Event} is not cancelled
|
* Calls a {@link CancellableEvent} and execute {@code successCallback} if the {@link Event} is not cancelled.
|
||||||
* <p>
|
* <p>
|
||||||
* Does call {@link #callEvent(Class, Event)} internally
|
* Does call {@link #callEvent(Class, Event)} internally.
|
||||||
*
|
*
|
||||||
* @param eventClass the event class
|
* @param eventClass the event class
|
||||||
* @param event the event object
|
* @param event the event object
|
||||||
|
@ -4,7 +4,7 @@ import net.minestom.server.event.Event;
|
|||||||
import net.minestom.server.instance.Instance;
|
import net.minestom.server.instance.Instance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a chunk in an instance is loaded
|
* Called when a chunk in an instance is loaded.
|
||||||
*/
|
*/
|
||||||
public class InstanceChunkLoadEvent extends Event {
|
public class InstanceChunkLoadEvent extends Event {
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ public class InstanceChunkLoadEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the instance where the chunk has been loaded
|
* Gets the instance where the chunk has been loaded.
|
||||||
*
|
*
|
||||||
* @return the instance
|
* @return the instance
|
||||||
*/
|
*/
|
||||||
@ -27,7 +27,7 @@ public class InstanceChunkLoadEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the chunk X
|
* Gets the chunk X.
|
||||||
*
|
*
|
||||||
* @return the chunk X
|
* @return the chunk X
|
||||||
*/
|
*/
|
||||||
@ -36,7 +36,7 @@ public class InstanceChunkLoadEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the chunk Z
|
* Gets the chunk Z.
|
||||||
*
|
*
|
||||||
* @return the chunk Z
|
* @return the chunk Z
|
||||||
*/
|
*/
|
||||||
|
@ -4,7 +4,7 @@ import net.minestom.server.event.Event;
|
|||||||
import net.minestom.server.instance.Instance;
|
import net.minestom.server.instance.Instance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a chunk in an instance is unloaded
|
* Called when a chunk in an instance is unloaded.
|
||||||
*/
|
*/
|
||||||
public class InstanceChunkUnloadEvent extends Event {
|
public class InstanceChunkUnloadEvent extends Event {
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ public class InstanceChunkUnloadEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the instance where the chunk has been unloaded
|
* Gets the instance where the chunk has been unloaded.
|
||||||
*
|
*
|
||||||
* @return the instance
|
* @return the instance
|
||||||
*/
|
*/
|
||||||
@ -27,7 +27,7 @@ public class InstanceChunkUnloadEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the chunk X
|
* Gets the chunk X.
|
||||||
*
|
*
|
||||||
* @return the chunk X
|
* @return the chunk X
|
||||||
*/
|
*/
|
||||||
@ -36,7 +36,7 @@ public class InstanceChunkUnloadEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the chunk Z
|
* Gets the chunk Z.
|
||||||
*
|
*
|
||||||
* @return the chunk Z
|
* @return the chunk Z
|
||||||
*/
|
*/
|
||||||
|
@ -6,6 +6,10 @@ import net.minestom.server.inventory.Inventory;
|
|||||||
import net.minestom.server.inventory.click.ClickType;
|
import net.minestom.server.inventory.click.ClickType;
|
||||||
import net.minestom.server.item.ItemStack;
|
import net.minestom.server.item.ItemStack;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called after {@link InventoryPreClickEvent}, this event cannot be cancelled and items related to the click
|
||||||
|
* are already moved.
|
||||||
|
*/
|
||||||
public class InventoryClickEvent extends Event {
|
public class InventoryClickEvent extends Event {
|
||||||
|
|
||||||
private final Player player;
|
private final Player player;
|
||||||
@ -25,7 +29,7 @@ public class InventoryClickEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player who clicked in the inventory
|
* Gets the player who clicked in the inventory.
|
||||||
*
|
*
|
||||||
* @return the player who clicked in the inventory
|
* @return the player who clicked in the inventory
|
||||||
*/
|
*/
|
||||||
@ -34,7 +38,7 @@ public class InventoryClickEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can be null if the clicked inventory is the player one
|
* Can be null if the clicked inventory is the player one.
|
||||||
*
|
*
|
||||||
* @return the inventory where the click happened, null if this is the player's inventory
|
* @return the inventory where the click happened, null if this is the player's inventory
|
||||||
*/
|
*/
|
||||||
@ -43,7 +47,7 @@ public class InventoryClickEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the clicked slot number
|
* Gets the clicked slot number.
|
||||||
*
|
*
|
||||||
* @return the clicked slot number
|
* @return the clicked slot number
|
||||||
*/
|
*/
|
||||||
@ -52,7 +56,7 @@ public class InventoryClickEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the click type
|
* Gets the click type.
|
||||||
*
|
*
|
||||||
* @return the click type
|
* @return the click type
|
||||||
*/
|
*/
|
||||||
@ -61,7 +65,7 @@ public class InventoryClickEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the clicked item
|
* Gets the clicked item.
|
||||||
*
|
*
|
||||||
* @return the clicked item
|
* @return the clicked item
|
||||||
*/
|
*/
|
||||||
@ -70,7 +74,7 @@ public class InventoryClickEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the item in the player cursor
|
* Gets the item in the player cursor.
|
||||||
*
|
*
|
||||||
* @return the cursor item
|
* @return the cursor item
|
||||||
*/
|
*/
|
||||||
|
@ -4,6 +4,9 @@ import net.minestom.server.entity.Player;
|
|||||||
import net.minestom.server.event.Event;
|
import net.minestom.server.event.Event;
|
||||||
import net.minestom.server.inventory.Inventory;
|
import net.minestom.server.inventory.Inventory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when an {@link Inventory} is closed by a player.
|
||||||
|
*/
|
||||||
public class InventoryCloseEvent extends Event {
|
public class InventoryCloseEvent extends Event {
|
||||||
|
|
||||||
private final Player player;
|
private final Player player;
|
||||||
@ -16,7 +19,7 @@ public class InventoryCloseEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player who closed the inventory
|
* Gets the player who closed the inventory.
|
||||||
*
|
*
|
||||||
* @return the player who closed the inventory
|
* @return the player who closed the inventory
|
||||||
*/
|
*/
|
||||||
@ -25,7 +28,7 @@ public class InventoryCloseEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the closed inventory
|
* Gets the closed inventory.
|
||||||
*
|
*
|
||||||
* @return the closed inventory, null if this is the player inventory
|
* @return the closed inventory, null if this is the player inventory
|
||||||
*/
|
*/
|
||||||
@ -34,7 +37,7 @@ public class InventoryCloseEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the new inventory to open
|
* Gets the new inventory to open.
|
||||||
*
|
*
|
||||||
* @return the new inventory to open, null if there isn't any
|
* @return the new inventory to open, null if there isn't any
|
||||||
*/
|
*/
|
||||||
@ -43,7 +46,7 @@ public class InventoryCloseEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can be used to open a new inventory after closing the previous one
|
* Can be used to open a new inventory after closing the previous one.
|
||||||
*
|
*
|
||||||
* @param newInventory the inventory to open, null to do not open any
|
* @param newInventory the inventory to open, null to do not open any
|
||||||
*/
|
*/
|
||||||
|
@ -4,6 +4,11 @@ import net.minestom.server.entity.Player;
|
|||||||
import net.minestom.server.event.CancellableEvent;
|
import net.minestom.server.event.CancellableEvent;
|
||||||
import net.minestom.server.inventory.Inventory;
|
import net.minestom.server.inventory.Inventory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a player open an {@link Inventory}.
|
||||||
|
* <p>
|
||||||
|
* Executed by {@link Player#openInventory(Inventory)}.
|
||||||
|
*/
|
||||||
public class InventoryOpenEvent extends CancellableEvent {
|
public class InventoryOpenEvent extends CancellableEvent {
|
||||||
|
|
||||||
private final Player player;
|
private final Player player;
|
||||||
@ -15,7 +20,7 @@ public class InventoryOpenEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player who opens the inventory
|
* Gets the player who opens the inventory.
|
||||||
*
|
*
|
||||||
* @return the player who opens the inventory
|
* @return the player who opens the inventory
|
||||||
*/
|
*/
|
||||||
@ -24,7 +29,7 @@ public class InventoryOpenEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the inventory to open, this could have been change by the {@link #setInventory(Inventory)}
|
* Gets the inventory to open, this could have been change by the {@link #setInventory(Inventory)}.
|
||||||
*
|
*
|
||||||
* @return the inventory to open
|
* @return the inventory to open
|
||||||
*/
|
*/
|
||||||
@ -33,8 +38,9 @@ public class InventoryOpenEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the inventory to open.
|
* Changes the inventory to open.
|
||||||
* to do not open any inventory see {@link #setCancelled(boolean)}
|
* <p>
|
||||||
|
* To do not open any inventory see {@link #setCancelled(boolean)}.
|
||||||
*
|
*
|
||||||
* @param inventory the inventory to open
|
* @param inventory the inventory to open
|
||||||
* @throws NullPointerException if {@code inventory} is null
|
* @throws NullPointerException if {@code inventory} is null
|
||||||
|
@ -7,6 +7,9 @@ import net.minestom.server.inventory.click.ClickType;
|
|||||||
import net.minestom.server.item.ItemStack;
|
import net.minestom.server.item.ItemStack;
|
||||||
import net.minestom.server.utils.item.ItemStackUtils;
|
import net.minestom.server.utils.item.ItemStackUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called before {@link InventoryClickEvent}, used to potentially cancel the click.
|
||||||
|
*/
|
||||||
public class InventoryPreClickEvent extends CancellableEvent {
|
public class InventoryPreClickEvent extends CancellableEvent {
|
||||||
|
|
||||||
private final Player player;
|
private final Player player;
|
||||||
@ -26,7 +29,7 @@ public class InventoryPreClickEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player who is trying to click on the inventory
|
* Gets the player who is trying to click on the inventory.
|
||||||
*
|
*
|
||||||
* @return the player who clicked
|
* @return the player who clicked
|
||||||
*/
|
*/
|
||||||
@ -35,7 +38,7 @@ public class InventoryPreClickEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can be null if the clicked inventory is the player one
|
* Can be null if the clicked inventory is the player one.
|
||||||
*
|
*
|
||||||
* @return the inventory where the click happened, null if this is the player's inventory
|
* @return the inventory where the click happened, null if this is the player's inventory
|
||||||
*/
|
*/
|
||||||
@ -44,7 +47,7 @@ public class InventoryPreClickEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the clicked slot number
|
* Gets the clicked slot number.
|
||||||
*
|
*
|
||||||
* @return the clicked slot number
|
* @return the clicked slot number
|
||||||
*/
|
*/
|
||||||
@ -53,7 +56,7 @@ public class InventoryPreClickEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the click type
|
* Gets the click type.
|
||||||
*
|
*
|
||||||
* @return the click type
|
* @return the click type
|
||||||
*/
|
*/
|
||||||
@ -62,7 +65,7 @@ public class InventoryPreClickEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the item who have been clicked
|
* Gets the item who have been clicked.
|
||||||
*
|
*
|
||||||
* @return the clicked item
|
* @return the clicked item
|
||||||
*/
|
*/
|
||||||
@ -71,7 +74,7 @@ public class InventoryPreClickEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the clicked item
|
* Changes the clicked item.
|
||||||
*
|
*
|
||||||
* @param clickedItem the clicked item
|
* @param clickedItem the clicked item
|
||||||
*/
|
*/
|
||||||
@ -80,7 +83,7 @@ public class InventoryPreClickEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the item who was in the player cursor
|
* Gets the item who was in the player cursor.
|
||||||
*
|
*
|
||||||
* @return the cursor item
|
* @return the cursor item
|
||||||
*/
|
*/
|
||||||
@ -89,7 +92,7 @@ public class InventoryPreClickEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the cursor item
|
* Changes the cursor item.
|
||||||
*
|
*
|
||||||
* @param cursorItem the cursor item
|
* @param cursorItem the cursor item
|
||||||
*/
|
*/
|
||||||
|
@ -21,7 +21,7 @@ public class AdvancementTabEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link Player} responsible for the event
|
* Gets the {@link Player} responsible for the event.
|
||||||
*
|
*
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
@ -30,7 +30,7 @@ public class AdvancementTabEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the action
|
* Gets the action.
|
||||||
*
|
*
|
||||||
* @return the action
|
* @return the action
|
||||||
*/
|
*/
|
||||||
@ -39,9 +39,9 @@ public class AdvancementTabEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the tab id
|
* Gets the tab id.
|
||||||
* <p>
|
* <p>
|
||||||
* Not null ony if {@link #getAction()} is equal to {@link AdvancementAction#OPENED_TAB}
|
* Not null ony if {@link #getAction()} is equal to {@link AdvancementAction#OPENED_TAB}.
|
||||||
*
|
*
|
||||||
* @return the tab id
|
* @return the tab id
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@ import net.minestom.server.item.ItemStack;
|
|||||||
import net.minestom.server.utils.item.ItemStackUtils;
|
import net.minestom.server.utils.item.ItemStackUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called as a result of {@link net.minestom.server.inventory.PlayerInventory#addItemStack(ItemStack)}
|
* Called as a result of {@link net.minestom.server.inventory.PlayerInventory#addItemStack(ItemStack)}.
|
||||||
*/
|
*/
|
||||||
public class PlayerAddItemStackEvent extends CancellableEvent {
|
public class PlayerAddItemStackEvent extends CancellableEvent {
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ public class PlayerAddItemStackEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player who has an item stack added to his inventory
|
* Gets the player who has an item stack added to his inventory.
|
||||||
*
|
*
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
@ -28,7 +28,7 @@ public class PlayerAddItemStackEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the item stack which will be added
|
* Gets the item stack which will be added.
|
||||||
*
|
*
|
||||||
* @return the item stack
|
* @return the item stack
|
||||||
*/
|
*/
|
||||||
@ -37,7 +37,7 @@ public class PlayerAddItemStackEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the item stack which will be added
|
* Changes the item stack which will be added.
|
||||||
*
|
*
|
||||||
* @param itemStack the new item stack
|
* @param itemStack the new item stack
|
||||||
*/
|
*/
|
||||||
|
@ -32,7 +32,7 @@ public class PlayerBlockBreakEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player who breaks the block
|
* Gets the player who breaks the block.
|
||||||
*
|
*
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
@ -41,7 +41,7 @@ public class PlayerBlockBreakEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the block position
|
* Gets the block position.
|
||||||
*
|
*
|
||||||
* @return the block position
|
* @return the block position
|
||||||
*/
|
*/
|
||||||
@ -50,7 +50,7 @@ public class PlayerBlockBreakEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the broken block state id
|
* Gets the broken block state id.
|
||||||
*
|
*
|
||||||
* @return the block id
|
* @return the block id
|
||||||
*/
|
*/
|
||||||
@ -59,7 +59,7 @@ public class PlayerBlockBreakEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the broken custom block
|
* Gets the broken custom block.
|
||||||
*
|
*
|
||||||
* @return the custom block,
|
* @return the custom block,
|
||||||
* null if not any
|
* null if not any
|
||||||
@ -69,7 +69,7 @@ public class PlayerBlockBreakEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the visual block id result, which will be placed after the event
|
* Gets the visual block id result, which will be placed after the event.
|
||||||
*
|
*
|
||||||
* @return the block id that will be set at {@link #getBlockPosition()}
|
* @return the block id that will be set at {@link #getBlockPosition()}
|
||||||
* set to 0 to remove
|
* set to 0 to remove
|
||||||
@ -79,7 +79,7 @@ public class PlayerBlockBreakEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the visual block id result
|
* Changes the visual block id result.
|
||||||
*
|
*
|
||||||
* @param resultBlockStateId the result block id
|
* @param resultBlockStateId the result block id
|
||||||
*/
|
*/
|
||||||
@ -88,10 +88,10 @@ public class PlayerBlockBreakEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the custom block id result, which will be placed after the event
|
* Gets the custom block id result, which will be placed after the event.
|
||||||
* <p>
|
* <p>
|
||||||
* Warning: the visual block will not be changed, be sure to call {@link #setResultBlockId(short)}
|
* Warning: the visual block will not be changed, be sure to call {@link #setResultBlockId(short)}
|
||||||
* if you want the visual to be the same as {@link CustomBlock#getDefaultBlockStateId()} ()} ()}
|
* if you want the visual to be the same as {@link CustomBlock#getDefaultBlockStateId()}.
|
||||||
*
|
*
|
||||||
* @return the custom block id that will be set at {@link #getBlockPosition()}
|
* @return the custom block id that will be set at {@link #getBlockPosition()}
|
||||||
* set to 0 to remove
|
* set to 0 to remove
|
||||||
@ -101,7 +101,7 @@ public class PlayerBlockBreakEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the custom block id result, which will be placed after the event
|
* Changes the custom block id result, which will be placed after the event;
|
||||||
*
|
*
|
||||||
* @param resultCustomBlockId the custom block id result
|
* @param resultCustomBlockId the custom block id result
|
||||||
*/
|
*/
|
||||||
|
@ -6,8 +6,8 @@ import net.minestom.server.instance.block.BlockFace;
|
|||||||
import net.minestom.server.utils.BlockPosition;
|
import net.minestom.server.utils.BlockPosition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player interacts with a block (right-click)
|
* Called when a player interacts with a block (right-click).
|
||||||
* This is also called when a block is placed
|
* This is also called when a block is placed.
|
||||||
*/
|
*/
|
||||||
public class PlayerBlockInteractEvent extends CancellableEvent {
|
public class PlayerBlockInteractEvent extends CancellableEvent {
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ public class PlayerBlockInteractEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player who interacted with the block
|
* Gets the player who interacted with the block.
|
||||||
*
|
*
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
@ -40,7 +40,7 @@ public class PlayerBlockInteractEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the event should block the item use
|
* Gets if the event should block the item use.
|
||||||
*
|
*
|
||||||
* @return true if the item use is blocked, false otherwise
|
* @return true if the item use is blocked, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -53,7 +53,7 @@ public class PlayerBlockInteractEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the position of the interacted block
|
* Gets the position of the interacted block.
|
||||||
*
|
*
|
||||||
* @return the block position
|
* @return the block position
|
||||||
*/
|
*/
|
||||||
@ -62,7 +62,7 @@ public class PlayerBlockInteractEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the hand used for the interaction
|
* Gets the hand used for the interaction.
|
||||||
*
|
*
|
||||||
* @return the hand used
|
* @return the hand used
|
||||||
*/
|
*/
|
||||||
@ -71,7 +71,7 @@ public class PlayerBlockInteractEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the block face
|
* Gets the block face.
|
||||||
*
|
*
|
||||||
* @return the block face
|
* @return the block face
|
||||||
*/
|
*/
|
||||||
|
@ -8,7 +8,7 @@ import net.minestom.server.instance.block.CustomBlock;
|
|||||||
import net.minestom.server.utils.BlockPosition;
|
import net.minestom.server.utils.BlockPosition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player tries placing a block
|
* Called when a player tries placing a block.
|
||||||
*/
|
*/
|
||||||
public class PlayerBlockPlaceEvent extends CancellableEvent {
|
public class PlayerBlockPlaceEvent extends CancellableEvent {
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ public class PlayerBlockPlaceEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set both the blockId and customBlockId
|
* Sets both the blockId and customBlockId.
|
||||||
*
|
*
|
||||||
* @param customBlock the custom block to place
|
* @param customBlock the custom block to place
|
||||||
*/
|
*/
|
||||||
@ -42,7 +42,7 @@ public class PlayerBlockPlaceEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set both the blockStateId and customBlockId
|
* Sets both the blockStateId and customBlockId.
|
||||||
*
|
*
|
||||||
* @param customBlockId the custom block id to place
|
* @param customBlockId the custom block id to place
|
||||||
*/
|
*/
|
||||||
@ -52,7 +52,7 @@ public class PlayerBlockPlaceEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set both the blockId and customBlockId
|
* Sets both the blockId and customBlockId.
|
||||||
*
|
*
|
||||||
* @param customBlockId the custom block id to place
|
* @param customBlockId the custom block id to place
|
||||||
*/
|
*/
|
||||||
@ -62,7 +62,7 @@ public class PlayerBlockPlaceEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the custom block id
|
* Gets the custom block id.
|
||||||
*
|
*
|
||||||
* @return the custom block id
|
* @return the custom block id
|
||||||
*/
|
*/
|
||||||
@ -71,10 +71,10 @@ public class PlayerBlockPlaceEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the custom block id to place
|
* Sets the custom block id to place.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: this does not change the visual block id, see {@link #setBlockStateId(short)}
|
* WARNING: this does not change the visual block id, see {@link #setBlockStateId(short)}
|
||||||
* or {@link #setCustomBlock(short)}
|
* or {@link #setCustomBlock(short)}.
|
||||||
*
|
*
|
||||||
* @param customBlockId the custom block id
|
* @param customBlockId the custom block id
|
||||||
*/
|
*/
|
||||||
@ -83,7 +83,7 @@ public class PlayerBlockPlaceEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the block state id
|
* Gets the block state id.
|
||||||
*
|
*
|
||||||
* @return the block state id
|
* @return the block state id
|
||||||
*/
|
*/
|
||||||
@ -92,7 +92,7 @@ public class PlayerBlockPlaceEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the visual block id
|
* Changes the visual block id.
|
||||||
*
|
*
|
||||||
* @param blockStateId the new block state id
|
* @param blockStateId the new block state id
|
||||||
*/
|
*/
|
||||||
@ -101,7 +101,7 @@ public class PlayerBlockPlaceEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player who is placing the block
|
* Gets the player who is placing the block.
|
||||||
*
|
*
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
@ -110,7 +110,7 @@ public class PlayerBlockPlaceEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the block position
|
* Gets the block position.
|
||||||
*
|
*
|
||||||
* @return the block position
|
* @return the block position
|
||||||
*/
|
*/
|
||||||
@ -119,7 +119,7 @@ public class PlayerBlockPlaceEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the hand with which the player is trying to place
|
* Gets the hand with which the player is trying to place.
|
||||||
*
|
*
|
||||||
* @return the hand used
|
* @return the hand used
|
||||||
*/
|
*/
|
||||||
@ -128,7 +128,7 @@ public class PlayerBlockPlaceEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should the block be consumed if not cancelled
|
* Should the block be consumed if not cancelled.
|
||||||
*
|
*
|
||||||
* @param consumeBlock true if the block should be consumer (-1 amount), false otherwise
|
* @param consumeBlock true if the block should be consumer (-1 amount), false otherwise
|
||||||
*/
|
*/
|
||||||
@ -137,7 +137,7 @@ public class PlayerBlockPlaceEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should the block be consumed if not cancelled
|
* Should the block be consumed if not cancelled.
|
||||||
*
|
*
|
||||||
* @return true if the block will be consumed, false otherwise
|
* @return true if the block will be consumed, false otherwise
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@ import net.minestom.server.utils.MathUtils;
|
|||||||
import net.minestom.server.utils.validate.Check;
|
import net.minestom.server.utils.validate.Check;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player change his held slot (by pressing 1-9 keys)
|
* Called when a player change his held slot (by pressing 1-9 keys).
|
||||||
*/
|
*/
|
||||||
public class PlayerChangeHeldSlotEvent extends CancellableEvent {
|
public class PlayerChangeHeldSlotEvent extends CancellableEvent {
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ public class PlayerChangeHeldSlotEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player who changed his held slot
|
* Gets the player who changed his held slot.
|
||||||
*
|
*
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
@ -28,7 +28,7 @@ public class PlayerChangeHeldSlotEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the slot which the player will held
|
* Gets the slot which the player will held.
|
||||||
*
|
*
|
||||||
* @return the held slot
|
* @return the held slot
|
||||||
*/
|
*/
|
||||||
@ -37,7 +37,7 @@ public class PlayerChangeHeldSlotEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the final held slot of the player
|
* Changes the final held slot of the player.
|
||||||
*
|
*
|
||||||
* @param slot the new held slot
|
* @param slot the new held slot
|
||||||
* @throws IllegalArgumentException if <code>slot</code> is not between 0 and 8
|
* @throws IllegalArgumentException if <code>slot</code> is not between 0 and 8
|
||||||
|
@ -26,7 +26,7 @@ public class PlayerChatEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the chat format
|
* Changes the chat format.
|
||||||
*
|
*
|
||||||
* @param chatFormat the custom chat format
|
* @param chatFormat the custom chat format
|
||||||
*/
|
*/
|
||||||
@ -35,7 +35,7 @@ public class PlayerChatEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the message sender
|
* Gets the message sender.
|
||||||
*
|
*
|
||||||
* @return the sender
|
* @return the sender
|
||||||
*/
|
*/
|
||||||
@ -44,8 +44,9 @@ public class PlayerChatEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is all the {@link Player} who will receive the message
|
* Those are the players who will receive the message.
|
||||||
* It can be modified to add or remove recipient
|
* <p>
|
||||||
|
* It can be modified to add or remove recipient.
|
||||||
*
|
*
|
||||||
* @return a modifiable list of message targets
|
* @return a modifiable list of message targets
|
||||||
*/
|
*/
|
||||||
@ -54,7 +55,7 @@ public class PlayerChatEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the message sent
|
* Gets the message sent.
|
||||||
*
|
*
|
||||||
* @return the sender's message
|
* @return the sender's message
|
||||||
*/
|
*/
|
||||||
@ -63,7 +64,7 @@ public class PlayerChatEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to change the message
|
* Used to change the message.
|
||||||
*
|
*
|
||||||
* @param message the new message
|
* @param message the new message
|
||||||
*/
|
*/
|
||||||
@ -73,7 +74,8 @@ public class PlayerChatEvent extends CancellableEvent {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to retrieve the chat format for this message.
|
* Used to retrieve the chat format for this message.
|
||||||
* If null, the default format will be used
|
* <p>
|
||||||
|
* If null, the default format will be used.
|
||||||
*
|
*
|
||||||
* @return the chat format which will be used
|
* @return the chat format which will be used
|
||||||
*/
|
*/
|
||||||
|
@ -4,7 +4,7 @@ import net.minestom.server.entity.Player;
|
|||||||
import net.minestom.server.event.Event;
|
import net.minestom.server.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player receive a new chunk data
|
* Called when a player receive a new chunk data.
|
||||||
*/
|
*/
|
||||||
public class PlayerChunkLoadEvent extends Event {
|
public class PlayerChunkLoadEvent extends Event {
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ public class PlayerChunkLoadEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player
|
* Gets the player.
|
||||||
*
|
*
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
@ -27,7 +27,7 @@ public class PlayerChunkLoadEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the chunk X
|
* Gets the chunk X.
|
||||||
*
|
*
|
||||||
* @return the chunk X
|
* @return the chunk X
|
||||||
*/
|
*/
|
||||||
@ -36,7 +36,7 @@ public class PlayerChunkLoadEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the chunk Z
|
* Gets the chunk Z.
|
||||||
*
|
*
|
||||||
* @return the chunk Z
|
* @return the chunk Z
|
||||||
*/
|
*/
|
||||||
|
@ -4,8 +4,8 @@ import net.minestom.server.entity.Player;
|
|||||||
import net.minestom.server.event.Event;
|
import net.minestom.server.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called after a chunk being unload to a certain player
|
* Called after a chunk being unload to a certain player.
|
||||||
* could be used to unload the chunk internally in order to save memory
|
* Could be used to unload the chunk internally in order to save memory.
|
||||||
*/
|
*/
|
||||||
public class PlayerChunkUnloadEvent extends Event {
|
public class PlayerChunkUnloadEvent extends Event {
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ public class PlayerChunkUnloadEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player
|
* Gets the player.
|
||||||
*
|
*
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
@ -28,7 +28,7 @@ public class PlayerChunkUnloadEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the chunk X
|
* Gets the chunk X.
|
||||||
*
|
*
|
||||||
* @return the chunk X
|
* @return the chunk X
|
||||||
*/
|
*/
|
||||||
@ -37,7 +37,7 @@ public class PlayerChunkUnloadEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the chunk Z
|
* Gets the chunk Z.
|
||||||
*
|
*
|
||||||
* @return the chunk Z
|
* @return the chunk Z
|
||||||
*/
|
*/
|
||||||
|
@ -4,7 +4,7 @@ import net.minestom.server.entity.Player;
|
|||||||
import net.minestom.server.event.CancellableEvent;
|
import net.minestom.server.event.CancellableEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called every time a player send a message starting by '/'
|
* Called every time a player send a message starting by '/'.
|
||||||
*/
|
*/
|
||||||
public class PlayerCommandEvent extends CancellableEvent {
|
public class PlayerCommandEvent extends CancellableEvent {
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ public class PlayerCommandEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player who sent the command
|
* Gets the player who sent the command.
|
||||||
*
|
*
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
@ -26,7 +26,7 @@ public class PlayerCommandEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the command used (command name + arguments)
|
* Gets the command used (command name + arguments).
|
||||||
*
|
*
|
||||||
* @return the command that the player wants to execute
|
* @return the command that the player wants to execute
|
||||||
*/
|
*/
|
||||||
@ -35,7 +35,7 @@ public class PlayerCommandEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the command to execute
|
* Changes the command to execute.
|
||||||
*
|
*
|
||||||
* @param command the new command
|
* @param command the new command
|
||||||
*/
|
*/
|
||||||
|
@ -4,7 +4,7 @@ import net.minestom.server.entity.Player;
|
|||||||
import net.minestom.server.event.Event;
|
import net.minestom.server.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player disconnect
|
* Called when a player disconnect.
|
||||||
*/
|
*/
|
||||||
public class PlayerDisconnectEvent extends Event {
|
public class PlayerDisconnectEvent extends Event {
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ public class PlayerDisconnectEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player who is disconnecting
|
* Gets the player who is disconnecting.
|
||||||
*
|
*
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
|
@ -5,7 +5,7 @@ import net.minestom.server.event.Event;
|
|||||||
import net.minestom.server.item.ItemStack;
|
import net.minestom.server.item.ItemStack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player is finished eating
|
* Called when a player is finished eating.
|
||||||
*/
|
*/
|
||||||
public class PlayerEatEvent extends Event {
|
public class PlayerEatEvent extends Event {
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ public class PlayerEatEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player who is finished eating
|
* Gets the player who is finished eating.
|
||||||
*
|
*
|
||||||
* @return the concerned player
|
* @return the concerned player
|
||||||
*/
|
*/
|
||||||
@ -27,7 +27,7 @@ public class PlayerEatEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the food item that has been eaten
|
* Gets the food item that has been eaten.
|
||||||
*
|
*
|
||||||
* @return the food item
|
* @return the food item
|
||||||
*/
|
*/
|
||||||
|
@ -5,7 +5,7 @@ import net.minestom.server.entity.Player;
|
|||||||
import net.minestom.server.event.Event;
|
import net.minestom.server.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a {@link Player} interacts (right-click) with an {@link Entity}
|
* Called when a {@link Player} interacts (right-click) with an {@link Entity}.
|
||||||
*/
|
*/
|
||||||
public class PlayerEntityInteractEvent extends Event {
|
public class PlayerEntityInteractEvent extends Event {
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ public class PlayerEntityInteractEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link Player} who is interacting
|
* Gets the {@link Player} who is interacting.
|
||||||
*
|
*
|
||||||
* @return the {@link Player}
|
* @return the {@link Player}
|
||||||
*/
|
*/
|
||||||
@ -29,7 +29,7 @@ public class PlayerEntityInteractEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link Entity} with who {@link #getPlayer()} is interacting
|
* Gets the {@link Entity} with who {@link #getPlayer()} is interacting.
|
||||||
*
|
*
|
||||||
* @return the {@link Entity}
|
* @return the {@link Entity}
|
||||||
*/
|
*/
|
||||||
@ -38,7 +38,7 @@ public class PlayerEntityInteractEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get with which hand the player interacted with the entity
|
* Gets with which hand the player interacted with the entity.
|
||||||
*
|
*
|
||||||
* @return the hand
|
* @return the hand
|
||||||
*/
|
*/
|
||||||
|
@ -4,7 +4,7 @@ import net.minestom.server.entity.Player;
|
|||||||
import net.minestom.server.event.CancellableEvent;
|
import net.minestom.server.event.CancellableEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the player swings his hand
|
* Called when the player swings his hand.
|
||||||
*/
|
*/
|
||||||
public class PlayerHandAnimationEvent extends CancellableEvent {
|
public class PlayerHandAnimationEvent extends CancellableEvent {
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ public class PlayerHandAnimationEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The player who is swinging his arm
|
* The player who is swinging his arm.
|
||||||
*
|
*
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
@ -26,7 +26,7 @@ public class PlayerHandAnimationEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the hand used
|
* Gets the hand used.
|
||||||
*
|
*
|
||||||
* @return the hand
|
* @return the hand
|
||||||
*/
|
*/
|
||||||
|
@ -4,7 +4,7 @@ import net.minestom.server.entity.Player;
|
|||||||
import net.minestom.server.event.CancellableEvent;
|
import net.minestom.server.event.CancellableEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used when a {@link Player} finish the animation of an item
|
* Used when a {@link Player} finish the animation of an item.
|
||||||
*
|
*
|
||||||
* @see ItemAnimationType
|
* @see ItemAnimationType
|
||||||
*/
|
*/
|
||||||
@ -19,7 +19,7 @@ public class PlayerItemAnimationEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link Player} who is responsible for the animation.
|
* Gets the {@link Player} who is responsible for the animation.
|
||||||
*
|
*
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
@ -28,7 +28,7 @@ public class PlayerItemAnimationEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the animation
|
* Gets the animation.
|
||||||
*
|
*
|
||||||
* @return the animation
|
* @return the animation
|
||||||
*/
|
*/
|
||||||
|
@ -5,9 +5,9 @@ import net.minestom.server.event.Event;
|
|||||||
import net.minestom.server.instance.Instance;
|
import net.minestom.server.instance.Instance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called at player login, used to define his spawn instance
|
* Called at player login, used to define his spawn instance.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: defining the spawning instance is MANDATORY
|
* WARNING: defining the spawning instance is MANDATORY.
|
||||||
*/
|
*/
|
||||||
public class PlayerLoginEvent extends Event {
|
public class PlayerLoginEvent extends Event {
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ public class PlayerLoginEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player who is logging
|
* Gets the player who is logging.
|
||||||
*
|
*
|
||||||
* @return the player who is logging
|
* @return the player who is logging
|
||||||
*/
|
*/
|
||||||
@ -28,9 +28,9 @@ public class PlayerLoginEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the spawning instance of the player
|
* Gets the spawning instance of the player.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: this must NOT be null, otherwise the player cannot spawn
|
* WARNING: this must NOT be null, otherwise the player cannot spawn.
|
||||||
*
|
*
|
||||||
* @return the spawning instance
|
* @return the spawning instance
|
||||||
*/
|
*/
|
||||||
@ -39,7 +39,7 @@ public class PlayerLoginEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the spawning instance
|
* Changes the spawning instance.
|
||||||
*
|
*
|
||||||
* @param instance the new spawning instance
|
* @param instance the new spawning instance
|
||||||
*/
|
*/
|
||||||
|
@ -5,7 +5,7 @@ import net.minestom.server.event.CancellableEvent;
|
|||||||
import net.minestom.server.utils.Position;
|
import net.minestom.server.utils.Position;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player is modifying his position
|
* Called when a player is modifying his position.
|
||||||
*/
|
*/
|
||||||
public class PlayerMoveEvent extends CancellableEvent {
|
public class PlayerMoveEvent extends CancellableEvent {
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ public class PlayerMoveEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player who is moving
|
* Gets the player who is moving.
|
||||||
*
|
*
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
@ -27,7 +27,7 @@ public class PlayerMoveEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the target position
|
* Gets the target position.
|
||||||
*
|
*
|
||||||
* @return the new position
|
* @return the new position
|
||||||
*/
|
*/
|
||||||
@ -36,7 +36,7 @@ public class PlayerMoveEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the target position
|
* Changes the target position.
|
||||||
*
|
*
|
||||||
* @param newPosition the new target position
|
* @param newPosition the new target position
|
||||||
*/
|
*/
|
||||||
|
@ -4,7 +4,7 @@ import net.minestom.server.entity.Player;
|
|||||||
import net.minestom.server.event.Event;
|
import net.minestom.server.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player send {@link net.minestom.server.network.packet.client.play.ClientPluginMessagePacket}
|
* Called when a player send {@link net.minestom.server.network.packet.client.play.ClientPluginMessagePacket}.
|
||||||
*/
|
*/
|
||||||
public class PlayerPluginMessageEvent extends Event {
|
public class PlayerPluginMessageEvent extends Event {
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ public class PlayerPluginMessageEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player who sent the message
|
* Gets the player who sent the message.
|
||||||
*
|
*
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
@ -28,7 +28,7 @@ public class PlayerPluginMessageEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the message identifier
|
* Gets the message identifier.
|
||||||
*
|
*
|
||||||
* @return the identifier
|
* @return the identifier
|
||||||
*/
|
*/
|
||||||
@ -37,7 +37,7 @@ public class PlayerPluginMessageEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the message data as a byte array
|
* Gets the message data as a byte array.
|
||||||
*
|
*
|
||||||
* @return the message
|
* @return the message
|
||||||
*/
|
*/
|
||||||
@ -46,7 +46,7 @@ public class PlayerPluginMessageEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the message data as a String
|
* Gets the message data as a String.
|
||||||
*
|
*
|
||||||
* @return the message
|
* @return the message
|
||||||
*/
|
*/
|
||||||
|
@ -7,7 +7,7 @@ import net.minestom.server.item.ItemStack;
|
|||||||
/**
|
/**
|
||||||
* Called before the PlayerEatEvent and can be used to change the eating time
|
* Called before the PlayerEatEvent and can be used to change the eating time
|
||||||
* or to cancel its processing, cancelling the event means that the player will
|
* or to cancel its processing, cancelling the event means that the player will
|
||||||
* continue the animation indefinitely
|
* continue the animation indefinitely.
|
||||||
*/
|
*/
|
||||||
public class PlayerPreEatEvent extends CancellableEvent {
|
public class PlayerPreEatEvent extends CancellableEvent {
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ public class PlayerPreEatEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The player who is trying to eat
|
* The player who is trying to eat.
|
||||||
*
|
*
|
||||||
* @return the concerned player
|
* @return the concerned player
|
||||||
*/
|
*/
|
||||||
@ -31,7 +31,7 @@ public class PlayerPreEatEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The food item which will be eaten
|
* The food item which will be eaten.
|
||||||
*
|
*
|
||||||
* @return the food item
|
* @return the food item
|
||||||
*/
|
*/
|
||||||
@ -40,9 +40,9 @@ public class PlayerPreEatEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the food eating time
|
* Gets the food eating time.
|
||||||
* <p>
|
* <p>
|
||||||
* This is by default {@link Player#getDefaultEatingTime()}
|
* This is by default {@link Player#getDefaultEatingTime()}.
|
||||||
*
|
*
|
||||||
* @return the eating time
|
* @return the eating time
|
||||||
*/
|
*/
|
||||||
@ -51,7 +51,7 @@ public class PlayerPreEatEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the food eating time
|
* Changes the food eating time.
|
||||||
*
|
*
|
||||||
* @param eatingTime the new eating time
|
* @param eatingTime the new eating time
|
||||||
*/
|
*/
|
||||||
|
@ -8,7 +8,7 @@ import java.util.UUID;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called before the player initialization, it can be used to kick the player before any connection
|
* Called before the player initialization, it can be used to kick the player before any connection
|
||||||
* or to change his final username/uuid
|
* or to change his final username/uuid.
|
||||||
*/
|
*/
|
||||||
public class PlayerPreLoginEvent extends Event {
|
public class PlayerPreLoginEvent extends Event {
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ public class PlayerPreLoginEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player who is trying to connect
|
* Gets the player who is trying to connect.
|
||||||
*
|
*
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
@ -32,7 +32,7 @@ public class PlayerPreLoginEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player username
|
* Gets the player username.
|
||||||
*
|
*
|
||||||
* @return the player username
|
* @return the player username
|
||||||
*/
|
*/
|
||||||
@ -41,7 +41,7 @@ public class PlayerPreLoginEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the player username
|
* Changes the player username.
|
||||||
*
|
*
|
||||||
* @param username the new player username
|
* @param username the new player username
|
||||||
*/
|
*/
|
||||||
@ -51,7 +51,7 @@ public class PlayerPreLoginEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player uuid
|
* Gets the player uuid.
|
||||||
*
|
*
|
||||||
* @return the player uuid
|
* @return the player uuid
|
||||||
*/
|
*/
|
||||||
@ -60,7 +60,7 @@ public class PlayerPreLoginEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the player uuid
|
* Changes the player uuid.
|
||||||
*
|
*
|
||||||
* @param playerUuid the new player uuid
|
* @param playerUuid the new player uuid
|
||||||
*/
|
*/
|
||||||
|
@ -5,7 +5,7 @@ import net.minestom.server.event.Event;
|
|||||||
import net.minestom.server.resourcepack.ResourcePackStatus;
|
import net.minestom.server.resourcepack.ResourcePackStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player warns the server of a resource pack status
|
* Called when a player warns the server of a resource pack status.
|
||||||
*/
|
*/
|
||||||
public class PlayerResourcePackStatusEvent extends Event {
|
public class PlayerResourcePackStatusEvent extends Event {
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ public class PlayerResourcePackStatusEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player who send a resource pack status
|
* Gets the player who send a resource pack status.
|
||||||
*
|
*
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
@ -27,7 +27,7 @@ public class PlayerResourcePackStatusEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the resource pack status
|
* Gets the resource pack status.
|
||||||
*
|
*
|
||||||
* @return the resource pack status
|
* @return the resource pack status
|
||||||
*/
|
*/
|
||||||
|
@ -19,7 +19,7 @@ public class PlayerRespawnEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player who is respawning
|
* Gets the player who is respawning.
|
||||||
*
|
*
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
@ -28,7 +28,7 @@ public class PlayerRespawnEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the respawn position
|
* Gets the respawn position.
|
||||||
* <p>
|
* <p>
|
||||||
* Is by default {@link Player#getRespawnPoint()}
|
* Is by default {@link Player#getRespawnPoint()}
|
||||||
*
|
*
|
||||||
@ -39,7 +39,7 @@ public class PlayerRespawnEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the respawn position
|
* Changes the respawn position.
|
||||||
*
|
*
|
||||||
* @param respawnPosition the new respawn position
|
* @param respawnPosition the new respawn position
|
||||||
*/
|
*/
|
||||||
|
@ -7,7 +7,7 @@ import net.minestom.server.utils.item.ItemStackUtils;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called as a result of {@link net.minestom.server.inventory.PlayerInventory#setItemStack(int, ItemStack)}
|
* Called as a result of {@link net.minestom.server.inventory.PlayerInventory#setItemStack(int, ItemStack)}
|
||||||
* and player click in his inventory
|
* and player click in his inventory.
|
||||||
*/
|
*/
|
||||||
public class PlayerSetItemStackEvent extends CancellableEvent {
|
public class PlayerSetItemStackEvent extends CancellableEvent {
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ public class PlayerSetItemStackEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player who has an item stack set to his inventory
|
* Gets the player who has an item stack set to his inventory.
|
||||||
*
|
*
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
@ -31,7 +31,7 @@ public class PlayerSetItemStackEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the slot where the item will be set
|
* Gets the slot where the item will be set.
|
||||||
*
|
*
|
||||||
* @return the slot
|
* @return the slot
|
||||||
*/
|
*/
|
||||||
@ -40,7 +40,7 @@ public class PlayerSetItemStackEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the slot where the item will be set
|
* Changes the slot where the item will be set.
|
||||||
*
|
*
|
||||||
* @param slot the new slot
|
* @param slot the new slot
|
||||||
*/
|
*/
|
||||||
@ -49,7 +49,7 @@ public class PlayerSetItemStackEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the item stack which will be set
|
* Gets the item stack which will be set.
|
||||||
*
|
*
|
||||||
* @return the item stack
|
* @return the item stack
|
||||||
*/
|
*/
|
||||||
@ -58,7 +58,7 @@ public class PlayerSetItemStackEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the item stack which will be set
|
* Changes the item stack which will be set.
|
||||||
*
|
*
|
||||||
* @param itemStack the new item stack
|
* @param itemStack the new item stack
|
||||||
*/
|
*/
|
||||||
|
@ -5,7 +5,7 @@ import net.minestom.server.entity.PlayerSkin;
|
|||||||
import net.minestom.server.event.Event;
|
import net.minestom.server.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called at the player connection to initialize his skin
|
* Called at the player connection to initialize his skin.
|
||||||
*/
|
*/
|
||||||
public class PlayerSkinInitEvent extends Event {
|
public class PlayerSkinInitEvent extends Event {
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ public class PlayerSkinInitEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player whose the skin is getting initialized
|
* Gets the player whose the skin is getting initialized.
|
||||||
*
|
*
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
@ -26,7 +26,7 @@ public class PlayerSkinInitEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the spawning skin of the player
|
* Gets the spawning skin of the player.
|
||||||
*
|
*
|
||||||
* @return the player skin, or null if not any
|
* @return the player skin, or null if not any
|
||||||
*/
|
*/
|
||||||
@ -35,7 +35,7 @@ public class PlayerSkinInitEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the spawning skin of the player
|
* Sets the spawning skin of the player.
|
||||||
*
|
*
|
||||||
* @param skin the new player skin
|
* @param skin the new player skin
|
||||||
*/
|
*/
|
||||||
|
@ -23,7 +23,7 @@ public class PlayerStartDiggingEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link Player} who started digging the block
|
* Gets the {@link Player} who started digging the block.
|
||||||
*
|
*
|
||||||
* @return the {@link Player}
|
* @return the {@link Player}
|
||||||
*/
|
*/
|
||||||
@ -32,7 +32,7 @@ public class PlayerStartDiggingEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link BlockPosition}
|
* Gets the {@link BlockPosition}.
|
||||||
*
|
*
|
||||||
* @return the {@link BlockPosition}
|
* @return the {@link BlockPosition}
|
||||||
*/
|
*/
|
||||||
@ -41,7 +41,7 @@ public class PlayerStartDiggingEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the block state id
|
* Gets the block state id.
|
||||||
*
|
*
|
||||||
* @return the block state id
|
* @return the block state id
|
||||||
*/
|
*/
|
||||||
@ -50,7 +50,7 @@ public class PlayerStartDiggingEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the custom block id
|
* Gets the custom block id.
|
||||||
*
|
*
|
||||||
* @return the custom block id
|
* @return the custom block id
|
||||||
*/
|
*/
|
||||||
|
@ -4,7 +4,7 @@ import net.minestom.server.entity.Player;
|
|||||||
import net.minestom.server.event.Event;
|
import net.minestom.server.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player start flying
|
* Called when a player start flying.
|
||||||
*/
|
*/
|
||||||
public class PlayerStartFlyingEvent extends Event {
|
public class PlayerStartFlyingEvent extends Event {
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ public class PlayerStartFlyingEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player who started flying
|
* Gets the player who started flying.
|
||||||
*
|
*
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
|
@ -4,7 +4,7 @@ import net.minestom.server.entity.Player;
|
|||||||
import net.minestom.server.event.Event;
|
import net.minestom.server.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player stop flying
|
* Called when a player stop flying.
|
||||||
*/
|
*/
|
||||||
public class PlayerStopFlyingEvent extends Event {
|
public class PlayerStopFlyingEvent extends Event {
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ public class PlayerStopFlyingEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player who stopped flying
|
* Gets the player who stopped flying.
|
||||||
*
|
*
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
|
@ -5,7 +5,7 @@ import net.minestom.server.event.CancellableEvent;
|
|||||||
import net.minestom.server.item.ItemStack;
|
import net.minestom.server.item.ItemStack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player is trying to swap his main and off hand item
|
* Called when a player is trying to swap his main and off hand item.
|
||||||
*/
|
*/
|
||||||
public class PlayerSwapItemEvent extends CancellableEvent {
|
public class PlayerSwapItemEvent extends CancellableEvent {
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ public class PlayerSwapItemEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player who is trying to swap his hands item
|
* Gets the player who is trying to swap his hands item.
|
||||||
*
|
*
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
@ -29,7 +29,7 @@ public class PlayerSwapItemEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the item which will be in player main hand after the event
|
* Gets the item which will be in player main hand after the event.
|
||||||
*
|
*
|
||||||
* @return the item in main hand
|
* @return the item in main hand
|
||||||
*/
|
*/
|
||||||
@ -38,7 +38,7 @@ public class PlayerSwapItemEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the item which will be in the player main hand
|
* Changes the item which will be in the player main hand.
|
||||||
*
|
*
|
||||||
* @param mainHandItem the main hand item
|
* @param mainHandItem the main hand item
|
||||||
*/
|
*/
|
||||||
@ -47,7 +47,7 @@ public class PlayerSwapItemEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the item which will be in player off hand after the event
|
* Gets the item which will be in player off hand after the event.
|
||||||
*
|
*
|
||||||
* @return the item in off hand
|
* @return the item in off hand
|
||||||
*/
|
*/
|
||||||
@ -56,7 +56,7 @@ public class PlayerSwapItemEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the item which will be in the player off hand
|
* Changes the item which will be in the player off hand.
|
||||||
*
|
*
|
||||||
* @param offHandItem the off hand item
|
* @param offHandItem the off hand item
|
||||||
*/
|
*/
|
||||||
|
@ -4,7 +4,7 @@ import net.minestom.server.entity.Player;
|
|||||||
import net.minestom.server.event.Event;
|
import net.minestom.server.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called at each player tick
|
* Called at each player tick.
|
||||||
*/
|
*/
|
||||||
public class PlayerTickEvent extends Event {
|
public class PlayerTickEvent extends Event {
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ public class PlayerTickEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player
|
* Gets the player.
|
||||||
*
|
*
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
|
@ -5,7 +5,7 @@ import net.minestom.server.event.CancellableEvent;
|
|||||||
import net.minestom.server.item.ItemStack;
|
import net.minestom.server.item.ItemStack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event when an item is used without clicking a block
|
* Event when an item is used without clicking a block.
|
||||||
*/
|
*/
|
||||||
public class PlayerUseItemEvent extends CancellableEvent {
|
public class PlayerUseItemEvent extends CancellableEvent {
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ public class PlayerUseItemEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player who used an item
|
* Gets the player who used an item.
|
||||||
*
|
*
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
@ -29,7 +29,7 @@ public class PlayerUseItemEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get which hand the player used
|
* Gets which hand the player used.
|
||||||
*
|
*
|
||||||
* @return the hand used
|
* @return the hand used
|
||||||
*/
|
*/
|
||||||
@ -38,7 +38,7 @@ public class PlayerUseItemEvent extends CancellableEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the item which have been used
|
* Gets the item which have been used.
|
||||||
*
|
*
|
||||||
* @return the item
|
* @return the item
|
||||||
*/
|
*/
|
||||||
|
@ -7,7 +7,7 @@ import net.minestom.server.utils.BlockPosition;
|
|||||||
import net.minestom.server.utils.Direction;
|
import net.minestom.server.utils.Direction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used when a player is clicking a block with an item (but is not a block in item form)
|
* Used when a player is clicking a block with an item (but is not a block in item form).
|
||||||
*/
|
*/
|
||||||
public class PlayerUseItemOnBlockEvent extends Event {
|
public class PlayerUseItemOnBlockEvent extends Event {
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ public class PlayerUseItemOnBlockEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player who used an item while clicking on a block
|
* Gets the player who used an item while clicking on a block.
|
||||||
*
|
*
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
@ -35,7 +35,7 @@ public class PlayerUseItemOnBlockEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the position of the interacted block
|
* Gets the position of the interacted block.
|
||||||
*
|
*
|
||||||
* @return the block position
|
* @return the block position
|
||||||
*/
|
*/
|
||||||
@ -44,7 +44,7 @@ public class PlayerUseItemOnBlockEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get which face the player has interacted with
|
* Gets which face the player has interacted with.
|
||||||
*
|
*
|
||||||
* @return the block face
|
* @return the block face
|
||||||
*/
|
*/
|
||||||
@ -53,7 +53,7 @@ public class PlayerUseItemOnBlockEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get which hand the player used to interact with the block
|
* Gets which hand the player used to interact with the block.
|
||||||
*
|
*
|
||||||
* @return the hand
|
* @return the hand
|
||||||
*/
|
*/
|
||||||
@ -62,7 +62,7 @@ public class PlayerUseItemOnBlockEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get with which item the player has interacted with the block
|
* Gets with which item the player has interacted with the block.
|
||||||
*
|
*
|
||||||
* @return the item
|
* @return the item
|
||||||
*/
|
*/
|
||||||
|
@ -116,7 +116,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
public abstract void UNSAFE_setBlock(int x, int y, int z, short blockStateId, short customBlockId, Data data, boolean updatable);
|
public abstract void UNSAFE_setBlock(int x, int y, int z, short blockStateId, short customBlockId, Data data, boolean updatable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute a chunk tick.
|
* Executes a chunk tick.
|
||||||
* <p>
|
* <p>
|
||||||
* Should be used to update all the blocks in the chunk.
|
* Should be used to update all the blocks in the chunk.
|
||||||
* <p>
|
* <p>
|
||||||
@ -128,7 +128,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
public abstract void tick(long time, Instance instance);
|
public abstract void tick(long time, Instance instance);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the block state id at a position.
|
* Gets the block state id at a position.
|
||||||
*
|
*
|
||||||
* @param x the block X
|
* @param x the block X
|
||||||
* @param y the block Y
|
* @param y the block Y
|
||||||
@ -138,7 +138,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
public abstract short getBlockStateId(int x, int y, int z);
|
public abstract short getBlockStateId(int x, int y, int z);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the custom block id at a position.
|
* Gets the custom block id at a position.
|
||||||
*
|
*
|
||||||
* @param x the block X
|
* @param x the block X
|
||||||
* @param y the block Y
|
* @param y the block Y
|
||||||
@ -148,7 +148,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
public abstract short getCustomBlockId(int x, int y, int z);
|
public abstract short getCustomBlockId(int x, int y, int z);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the block state id and the custom block id at a position.
|
* Changes the block state id and the custom block id at a position.
|
||||||
*
|
*
|
||||||
* @param x the block X
|
* @param x the block X
|
||||||
* @param y the block Y
|
* @param y the block Y
|
||||||
@ -159,7 +159,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
protected abstract void refreshBlockValue(int x, int y, int z, short blockStateId, short customBlockId);
|
protected abstract void refreshBlockValue(int x, int y, int z, short blockStateId, short customBlockId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the block state id at a position (the custom block id stays the same).
|
* Changes the block state id at a position (the custom block id stays the same).
|
||||||
*
|
*
|
||||||
* @param x the block X
|
* @param x the block X
|
||||||
* @param y the block Y
|
* @param y the block Y
|
||||||
@ -169,7 +169,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
protected abstract void refreshBlockStateId(int x, int y, int z, short blockStateId);
|
protected abstract void refreshBlockStateId(int x, int y, int z, short blockStateId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link Data} at a block index.
|
* Gets the {@link Data} at a block index.
|
||||||
*
|
*
|
||||||
* @param index the block index
|
* @param index the block index
|
||||||
* @return the {@link Data} at the block index, null if none
|
* @return the {@link Data} at the block index, null if none
|
||||||
@ -177,7 +177,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
public abstract Data getBlockData(int index);
|
public abstract Data getBlockData(int index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the {@link Data} at a position.
|
* Sets the {@link Data} at a position.
|
||||||
*
|
*
|
||||||
* @param x the block X
|
* @param x the block X
|
||||||
* @param y the block Y
|
* @param y the block Y
|
||||||
@ -187,14 +187,14 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
public abstract void setBlockData(int x, int y, int z, Data data);
|
public abstract void setBlockData(int x, int y, int z, Data data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the block entities in this chunk.
|
* Gets all the block entities in this chunk.
|
||||||
*
|
*
|
||||||
* @return the block entities in this chunk
|
* @return the block entities in this chunk
|
||||||
*/
|
*/
|
||||||
public abstract Set<Integer> getBlockEntities();
|
public abstract Set<Integer> getBlockEntities();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serialize the chunk into bytes.
|
* Serializes the chunk into bytes.
|
||||||
*
|
*
|
||||||
* @return the serialized chunk, can be null if this chunk cannot be serialized
|
* @return the serialized chunk, can be null if this chunk cannot be serialized
|
||||||
* @see #readChunk(BinaryReader, ChunkCallback) which should be able to read what is written in this method
|
* @see #readChunk(BinaryReader, ChunkCallback) which should be able to read what is written in this method
|
||||||
@ -202,7 +202,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
public abstract byte[] getSerializedData();
|
public abstract byte[] getSerializedData();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the chunk from binary.
|
* Reads the chunk from binary.
|
||||||
* <p>
|
* <p>
|
||||||
* Used if the chunk is loaded from file.
|
* Used if the chunk is loaded from file.
|
||||||
*
|
*
|
||||||
@ -221,7 +221,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
protected abstract ChunkDataPacket getFreshPacket();
|
protected abstract ChunkDataPacket getFreshPacket();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link CustomBlock} at a position.
|
* Gets the {@link CustomBlock} at a position.
|
||||||
*
|
*
|
||||||
* @param x the block X
|
* @param x the block X
|
||||||
* @param y the block Y
|
* @param y the block Y
|
||||||
@ -234,7 +234,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link CustomBlock} at a block index.
|
* Gets the {@link CustomBlock} at a block index.
|
||||||
*
|
*
|
||||||
* @param index the block index
|
* @param index the block index
|
||||||
* @return the {@link CustomBlock} at the block index
|
* @return the {@link CustomBlock} at the block index
|
||||||
@ -251,7 +251,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the chunk X.
|
* Gets the chunk X.
|
||||||
*
|
*
|
||||||
* @return the chunk X
|
* @return the chunk X
|
||||||
*/
|
*/
|
||||||
@ -260,7 +260,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the chunk Z.
|
* Gets the chunk Z.
|
||||||
*
|
*
|
||||||
* @return the chunk Z
|
* @return the chunk Z
|
||||||
*/
|
*/
|
||||||
@ -269,7 +269,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if this chunk will or had been loaded with a {@link ChunkGenerator}
|
* Gets if this chunk will or had been loaded with a {@link ChunkGenerator}
|
||||||
*
|
*
|
||||||
* @return true if this chunk is affected by a {@link ChunkGenerator}
|
* @return true if this chunk is affected by a {@link ChunkGenerator}
|
||||||
*/
|
*/
|
||||||
@ -278,7 +278,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if this chunk automatically cache the latest {@link ChunkDataPacket} version.
|
* Gets if this chunk automatically cache the latest {@link ChunkDataPacket} version.
|
||||||
* <p>
|
* <p>
|
||||||
* Retrieved with {@link #retrieveDataBuffer(Consumer)}.
|
* Retrieved with {@link #retrieveDataBuffer(Consumer)}.
|
||||||
*
|
*
|
||||||
@ -289,7 +289,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable or disable the automatic {@link ChunkDataPacket} caching.
|
* Enables or disable the automatic {@link ChunkDataPacket} caching.
|
||||||
*
|
*
|
||||||
* @param enableCachePacket true to enable to chunk packet caching
|
* @param enableCachePacket true to enable to chunk packet caching
|
||||||
*/
|
*/
|
||||||
@ -302,9 +302,9 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the cached data packet
|
* Gets the cached data packet.
|
||||||
* <p>
|
* <p>
|
||||||
* Use {@link #retrieveDataBuffer(Consumer)} to be sure to get the updated version
|
* Use {@link #retrieveDataBuffer(Consumer)} to be sure to get the updated version.
|
||||||
*
|
*
|
||||||
* @return the last cached data packet, can be null or outdated
|
* @return the last cached data packet, can be null or outdated
|
||||||
*/
|
*/
|
||||||
@ -313,7 +313,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the cached {@link ChunkDataPacket} of this chunk.
|
* Sets the cached {@link ChunkDataPacket} of this chunk.
|
||||||
*
|
*
|
||||||
* @param fullDataPacket the new cached chunk packet
|
* @param fullDataPacket the new cached chunk packet
|
||||||
*/
|
*/
|
||||||
@ -323,7 +323,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change this chunk columnar space
|
* Changes this chunk columnar space.
|
||||||
*
|
*
|
||||||
* @param columnarSpace the new columnar space
|
* @param columnarSpace the new columnar space
|
||||||
*/
|
*/
|
||||||
@ -332,7 +332,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve (and save if needed) the updated data packet.
|
* Retrieves (and save if needed) the updated data packet.
|
||||||
*
|
*
|
||||||
* @param consumer the consumer called once the packet is sure to be up-to-date
|
* @param consumer the consumer called once the packet is sure to be up-to-date
|
||||||
*/
|
*/
|
||||||
@ -353,7 +353,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a {@link ChunkDataPacket} which should contain the full chunk.
|
* Gets a {@link ChunkDataPacket} which should contain the full chunk.
|
||||||
*
|
*
|
||||||
* @return a fresh full chunk data packet
|
* @return a fresh full chunk data packet
|
||||||
*/
|
*/
|
||||||
@ -364,7 +364,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a {@link ChunkDataPacket} which should contain the non-full chunk.
|
* Gets a {@link ChunkDataPacket} which should contain the non-full chunk.
|
||||||
*
|
*
|
||||||
* @return a fresh non-full chunk data packet
|
* @return a fresh non-full chunk data packet
|
||||||
*/
|
*/
|
||||||
@ -389,8 +389,8 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send the chunk to {@code player} and add it to the player viewing chunks collection
|
* Sends the chunk to {@code player} and add it to the player viewing chunks collection
|
||||||
* and send a {@link PlayerChunkLoadEvent}
|
* and send a {@link PlayerChunkLoadEvent}.
|
||||||
*
|
*
|
||||||
* @param player the viewer to add
|
* @param player the viewer to add
|
||||||
* @return true if the player has just been added to the viewer collection
|
* @return true if the player has just been added to the viewer collection
|
||||||
@ -410,8 +410,8 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the chunk to the player viewing chunks collection
|
* Removes the chunk to the player viewing chunks collection
|
||||||
* and send a {@link PlayerChunkUnloadEvent}
|
* and send a {@link PlayerChunkUnloadEvent}.
|
||||||
*
|
*
|
||||||
* @param player the viewer to remove
|
* @param player the viewer to remove
|
||||||
* @return true if the player has just been removed to the viewer collection
|
* @return true if the player has just been removed to the viewer collection
|
||||||
@ -444,7 +444,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send the chunk data to {@code player}
|
* Sends the chunk data to {@code player}.
|
||||||
*
|
*
|
||||||
* @param player the player
|
* @param player the player
|
||||||
*/
|
*/
|
||||||
@ -487,7 +487,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a full {@link ChunkDataPacket} to {@code player}
|
* Sends a full {@link ChunkDataPacket} to {@code player}.
|
||||||
*
|
*
|
||||||
* @param player the player to update the chunk to
|
* @param player the player to update the chunk to
|
||||||
*/
|
*/
|
||||||
@ -499,7 +499,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a full {@link ChunkDataPacket} to all chunk viewers
|
* Sends a full {@link ChunkDataPacket} to all chunk viewers.
|
||||||
*/
|
*/
|
||||||
public void sendChunkUpdate() {
|
public void sendChunkUpdate() {
|
||||||
final Set<Player> chunkViewers = getViewers();
|
final Set<Player> chunkViewers = getViewers();
|
||||||
@ -516,7 +516,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a chunk section update packet to {@code player}
|
* Sends a chunk section update packet to {@code player}.
|
||||||
*
|
*
|
||||||
* @param section the section to update
|
* @param section the section to update
|
||||||
* @param player the player to send the packet to
|
* @param player the player to send the packet to
|
||||||
@ -531,7 +531,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link ChunkDataPacket} to update a single chunk section
|
* Gets the {@link ChunkDataPacket} to update a single chunk section.
|
||||||
*
|
*
|
||||||
* @param section the chunk section to update
|
* @param section the chunk section to update
|
||||||
* @return the {@link ChunkDataPacket} to update a single chunk section
|
* @return the {@link ChunkDataPacket} to update a single chunk section
|
||||||
@ -546,14 +546,14 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the chunk as "unloaded".
|
* Sets the chunk as "unloaded".
|
||||||
*/
|
*/
|
||||||
protected void unload() {
|
protected void unload() {
|
||||||
this.loaded = false;
|
this.loaded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if a block state id represents a block entity.
|
* Gets if a block state id represents a block entity.
|
||||||
*
|
*
|
||||||
* @param blockStateId the block state id to check
|
* @param blockStateId the block state id to check
|
||||||
* @return true if {@code blockStateId} represents a block entity
|
* @return true if {@code blockStateId} represents a block entity
|
||||||
@ -564,7 +564,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the index of a position, used to store blocks.
|
* Gets the index of a position, used to store blocks.
|
||||||
*
|
*
|
||||||
* @param x the block X
|
* @param x the block X
|
||||||
* @param y the block Y
|
* @param y the block Y
|
||||||
|
@ -26,7 +26,7 @@ public interface ChunkGenerator {
|
|||||||
void generateChunkData(ChunkBatch batch, int chunkX, int chunkZ);
|
void generateChunkData(ChunkBatch batch, int chunkX, int chunkZ);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define all the {@link Biome} in the {@link Chunk}.
|
* Defines all the {@link Biome} in the {@link Chunk}.
|
||||||
*
|
*
|
||||||
* @param biomes the array of {@link Biome}
|
* @param biomes the array of {@link Biome}
|
||||||
* @param chunkX the chunk X
|
* @param chunkX the chunk X
|
||||||
@ -35,7 +35,7 @@ public interface ChunkGenerator {
|
|||||||
void fillBiomes(Biome[] biomes, int chunkX, int chunkZ);
|
void fillBiomes(Biome[] biomes, int chunkX, int chunkZ);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the {@link ChunkPopulator} of this generator.
|
* Gets all the {@link ChunkPopulator} of this generator.
|
||||||
*
|
*
|
||||||
* @return a {@link List} of {@link ChunkPopulator}
|
* @return a {@link List} of {@link ChunkPopulator}
|
||||||
*/
|
*/
|
||||||
|
@ -95,7 +95,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
private final PFInstanceSpace instanceSpace = new PFInstanceSpace(this);
|
private final PFInstanceSpace instanceSpace = new PFInstanceSpace(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance
|
* Creates a new instance
|
||||||
*
|
*
|
||||||
* @param uniqueId the {@link UUID} of the instance
|
* @param uniqueId the {@link UUID} of the instance
|
||||||
* @param dimensionType the {@link DimensionType} of the instance
|
* @param dimensionType the {@link DimensionType} of the instance
|
||||||
@ -108,7 +108,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedule a task to be run during the next instance tick
|
* Schedules a task to be run during the next instance tick
|
||||||
* It ensures that the task will be executed in the same thread as the instance and its chunks/entities (depending of the {@link ThreadProvider})
|
* It ensures that the task will be executed in the same thread as the instance and its chunks/entities (depending of the {@link ThreadProvider})
|
||||||
*
|
*
|
||||||
* @param callback the task to execute during the next instance tick
|
* @param callback the task to execute during the next instance tick
|
||||||
@ -138,7 +138,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
public abstract boolean breakBlock(Player player, BlockPosition blockPosition);
|
public abstract boolean breakBlock(Player player, BlockPosition blockPosition);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Force the generation of a {@link Chunk}, even if no file and {@link ChunkGenerator} are defined.
|
* Forces the generation of a {@link Chunk}, even if no file and {@link ChunkGenerator} are defined.
|
||||||
*
|
*
|
||||||
* @param chunkX the chunk X
|
* @param chunkX the chunk X
|
||||||
* @param chunkZ the chunk Z
|
* @param chunkZ the chunk Z
|
||||||
@ -148,7 +148,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
public abstract void loadChunk(int chunkX, int chunkZ, ChunkCallback callback);
|
public abstract void loadChunk(int chunkX, int chunkZ, ChunkCallback callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the chunk if the chunk is already loaded or if
|
* Loads the chunk if the chunk is already loaded or if
|
||||||
* {@link #hasEnabledAutoChunkLoad()} returns true.
|
* {@link #hasEnabledAutoChunkLoad()} returns true.
|
||||||
*
|
*
|
||||||
* @param chunkX the chunk X
|
* @param chunkX the chunk X
|
||||||
@ -159,7 +159,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
public abstract void loadOptionalChunk(int chunkX, int chunkZ, ChunkCallback callback);
|
public abstract void loadOptionalChunk(int chunkX, int chunkZ, ChunkCallback callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedule the removal of a {@link Chunk}, this method does not promise when it will be done.
|
* Schedules the removal of a {@link Chunk}, this method does not promise when it will be done.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: during unloading, all entities other than {@link Player} will be removed.
|
* WARNING: during unloading, all entities other than {@link Player} will be removed.
|
||||||
* <p>
|
* <p>
|
||||||
@ -170,7 +170,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
public abstract void unloadChunk(Chunk chunk);
|
public abstract void unloadChunk(Chunk chunk);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the loaded {@link Chunk} at a position.
|
* Gets the loaded {@link Chunk} at a position.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: this should only return already-loaded chunk, use {@link #loadChunk(int, int)} or similar to load one instead.
|
* WARNING: this should only return already-loaded chunk, use {@link #loadChunk(int, int)} or similar to load one instead.
|
||||||
*
|
*
|
||||||
@ -181,7 +181,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
public abstract Chunk getChunk(int chunkX, int chunkZ);
|
public abstract Chunk getChunk(int chunkX, int chunkZ);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save a {@link Chunk} to permanent storage.
|
* Saves a {@link Chunk} to permanent storage.
|
||||||
*
|
*
|
||||||
* @param chunk the {@link Chunk} to save
|
* @param chunk the {@link Chunk} to save
|
||||||
* @param callback called when the {@link Chunk} is done saving
|
* @param callback called when the {@link Chunk} is done saving
|
||||||
@ -189,21 +189,21 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
public abstract void saveChunkToStorage(Chunk chunk, Runnable callback);
|
public abstract void saveChunkToStorage(Chunk chunk, Runnable callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save multiple chunks to permanent storage
|
* Saves multiple chunks to permanent storage.
|
||||||
*
|
*
|
||||||
* @param callback called when the chunks are done saving
|
* @param callback called when the chunks are done saving
|
||||||
*/
|
*/
|
||||||
public abstract void saveChunksToStorage(Runnable callback);
|
public abstract void saveChunksToStorage(Runnable callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new {@link BlockBatch} linked to this instance
|
* Creates a new {@link BlockBatch} linked to this instance.
|
||||||
*
|
*
|
||||||
* @return a {@link BlockBatch} linked to the instance
|
* @return a {@link BlockBatch} linked to the instance
|
||||||
*/
|
*/
|
||||||
public abstract BlockBatch createBlockBatch();
|
public abstract BlockBatch createBlockBatch();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new {@link Chunk} batch linked to this instance and the specified chunk
|
* Creates a new {@link Chunk} batch linked to this instance and the specified chunk.
|
||||||
*
|
*
|
||||||
* @param chunk the chunk to modify
|
* @param chunk the chunk to modify
|
||||||
* @return a ChunkBatch linked to {@code chunk}
|
* @return a ChunkBatch linked to {@code chunk}
|
||||||
@ -212,35 +212,35 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
public abstract ChunkBatch createChunkBatch(Chunk chunk);
|
public abstract ChunkBatch createChunkBatch(Chunk chunk);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the instance {@link ChunkGenerator}
|
* Gets the instance {@link ChunkGenerator}.
|
||||||
*
|
*
|
||||||
* @return the {@link ChunkGenerator} of the instance
|
* @return the {@link ChunkGenerator} of the instance
|
||||||
*/
|
*/
|
||||||
public abstract ChunkGenerator getChunkGenerator();
|
public abstract ChunkGenerator getChunkGenerator();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the instance {@link ChunkGenerator}
|
* Changes the instance {@link ChunkGenerator}.
|
||||||
*
|
*
|
||||||
* @param chunkGenerator the new {@link ChunkGenerator} of the instance
|
* @param chunkGenerator the new {@link ChunkGenerator} of the instance
|
||||||
*/
|
*/
|
||||||
public abstract void setChunkGenerator(ChunkGenerator chunkGenerator);
|
public abstract void setChunkGenerator(ChunkGenerator chunkGenerator);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the instance's chunks
|
* Gets all the instance's chunks.
|
||||||
*
|
*
|
||||||
* @return an unmodifiable containing all the loaded chunks of the instance
|
* @return an unmodifiable containing all the loaded chunks of the instance
|
||||||
*/
|
*/
|
||||||
public abstract Collection<Chunk> getChunks();
|
public abstract Collection<Chunk> getChunks();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the instance {@link StorageLocation}
|
* Gets the instance {@link StorageLocation}.
|
||||||
*
|
*
|
||||||
* @return the {@link StorageLocation} of the instance
|
* @return the {@link StorageLocation} of the instance
|
||||||
*/
|
*/
|
||||||
public abstract StorageLocation getStorageLocation();
|
public abstract StorageLocation getStorageLocation();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the instance {@link StorageLocation}
|
* Changes the instance {@link StorageLocation}.
|
||||||
*
|
*
|
||||||
* @param storageLocation the new {@link StorageLocation} of the instance
|
* @param storageLocation the new {@link StorageLocation} of the instance
|
||||||
*/
|
*/
|
||||||
@ -248,7 +248,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Used when a {@link Chunk} is not currently loaded in memory and need to be retrieved from somewhere else.
|
* Used when a {@link Chunk} is not currently loaded in memory and need to be retrieved from somewhere else.
|
||||||
* Could be read from disk, or generated from scratch
|
* Could be read from disk, or generated from scratch.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: it has to retrieve a chunk, this is not optional.
|
* WARNING: it has to retrieve a chunk, this is not optional.
|
||||||
*
|
*
|
||||||
@ -278,7 +278,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
public abstract void enableAutoChunkLoad(boolean enable);
|
public abstract void enableAutoChunkLoad(boolean enable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the instance should auto load chunks.
|
* Gets if the instance should auto load chunks.
|
||||||
*
|
*
|
||||||
* @return true if auto chunk load is enabled, false otherwise
|
* @return true if auto chunk load is enabled, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -286,7 +286,8 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether a position in the void. If true, entities should take damage and die.
|
* Determines whether a position in the void. If true, entities should take damage and die.
|
||||||
* Always returning false allow entities to survive in the void
|
* <p>
|
||||||
|
* Always returning false allow entities to survive in the void.
|
||||||
*
|
*
|
||||||
* @param position the position in the world
|
* @param position the position in the world
|
||||||
* @return true iif position is inside the void
|
* @return true iif position is inside the void
|
||||||
@ -294,7 +295,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
public abstract boolean isInVoid(Position position);
|
public abstract boolean isInVoid(Position position);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the instance has been registered in {@link InstanceManager}
|
* Gets if the instance has been registered in {@link InstanceManager}.
|
||||||
*
|
*
|
||||||
* @return true if the instance has been registered
|
* @return true if the instance has been registered
|
||||||
*/
|
*/
|
||||||
@ -303,9 +304,9 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the registered field
|
* Changes the registered field.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: should only be used by {@link InstanceManager}
|
* WARNING: should only be used by {@link InstanceManager}.
|
||||||
*
|
*
|
||||||
* @param registered true to mark the instance as registered
|
* @param registered true to mark the instance as registered
|
||||||
*/
|
*/
|
||||||
@ -314,7 +315,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the instance {@link DimensionType}
|
* Gets the instance {@link DimensionType}.
|
||||||
*
|
*
|
||||||
* @return the dimension of the instance
|
* @return the dimension of the instance
|
||||||
*/
|
*/
|
||||||
@ -323,7 +324,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the age of this instance in tick
|
* Gets the age of this instance in tick.
|
||||||
*
|
*
|
||||||
* @return the age of this instance in tick
|
* @return the age of this instance in tick
|
||||||
*/
|
*/
|
||||||
@ -332,7 +333,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current time in the instance (sun/moon)
|
* Gets the current time in the instance (sun/moon).
|
||||||
*
|
*
|
||||||
* @return the time in the instance
|
* @return the time in the instance
|
||||||
*/
|
*/
|
||||||
@ -341,7 +342,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the current time in the instance, from 0 to 24000
|
* Changes the current time in the instance, from 0 to 24000.
|
||||||
* <p>
|
* <p>
|
||||||
* 0 = sunrise
|
* 0 = sunrise
|
||||||
* 6000 = noon
|
* 6000 = noon
|
||||||
@ -360,7 +361,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the rate of the time passing, it is 1 by default
|
* Gets the rate of the time passing, it is 1 by default
|
||||||
*
|
*
|
||||||
* @return the time rate of the instance
|
* @return the time rate of the instance
|
||||||
*/
|
*/
|
||||||
@ -382,7 +383,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the rate at which the client is updated with the current instance time
|
* Gets the rate at which the client is updated with the current instance time
|
||||||
*
|
*
|
||||||
* @return the client update rate for time related packet
|
* @return the client update rate for time related packet
|
||||||
*/
|
*/
|
||||||
@ -403,7 +404,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a {@link TimeUpdatePacket} with the current age and time of this instance
|
* Gets a {@link TimeUpdatePacket} with the current age and time of this instance
|
||||||
*
|
*
|
||||||
* @return the {@link TimeUpdatePacket} with this instance data
|
* @return the {@link TimeUpdatePacket} with this instance data
|
||||||
*/
|
*/
|
||||||
@ -415,7 +416,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the instance {@link WorldBorder}
|
* Gets the instance {@link WorldBorder};
|
||||||
*
|
*
|
||||||
* @return the {@link WorldBorder} linked to the instance
|
* @return the {@link WorldBorder} linked to the instance
|
||||||
*/
|
*/
|
||||||
@ -424,7 +425,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the entities in the instance
|
* Gets the entities in the instance;
|
||||||
*
|
*
|
||||||
* @return an unmodifiable {@link Set} containing all the entities in the instance
|
* @return an unmodifiable {@link Set} containing all the entities in the instance
|
||||||
*/
|
*/
|
||||||
@ -433,7 +434,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the players in the instance
|
* Gets the players in the instance;
|
||||||
*
|
*
|
||||||
* @return an unmodifiable {@link Set} containing all the players in the instance
|
* @return an unmodifiable {@link Set} containing all the players in the instance
|
||||||
*/
|
*/
|
||||||
@ -442,7 +443,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the creatures in the instance
|
* Gets the creatures in the instance;
|
||||||
*
|
*
|
||||||
* @return an unmodifiable {@link Set} containing all the creatures in the instance
|
* @return an unmodifiable {@link Set} containing all the creatures in the instance
|
||||||
*/
|
*/
|
||||||
@ -451,7 +452,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the object entities in the instance
|
* Gets the object entities in the instance;
|
||||||
*
|
*
|
||||||
* @return an unmodifiable {@link Set} containing all the object entities in the instance
|
* @return an unmodifiable {@link Set} containing all the object entities in the instance
|
||||||
*/
|
*/
|
||||||
@ -460,7 +461,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the experience orbs in the instance
|
* Gets the experience orbs in the instance.
|
||||||
*
|
*
|
||||||
* @return an unmodifiable {@link Set} containing all the experience orbs in the instance
|
* @return an unmodifiable {@link Set} containing all the experience orbs in the instance
|
||||||
*/
|
*/
|
||||||
@ -469,7 +470,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the entities located in the chunk
|
* Gets the entities located in the chunk.
|
||||||
*
|
*
|
||||||
* @param chunk the chunk to get the entities from
|
* @param chunk the chunk to get the entities from
|
||||||
* @return an unmodifiable {@link Set} containing all the entities in a chunk,
|
* @return an unmodifiable {@link Set} containing all the entities in a chunk,
|
||||||
@ -485,9 +486,9 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh the visual block id at the position
|
* Refreshes the visual block id at the position.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: the custom block id at the position will not change
|
* WARNING: the custom block id at the position will not change.
|
||||||
*
|
*
|
||||||
* @param x the X position
|
* @param x the X position
|
||||||
* @param y the Y position
|
* @param y the Y position
|
||||||
@ -499,9 +500,9 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh the visual block id at the position
|
* Refreshes the visual block id at the position.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: the custom block id at the position will not change
|
* WARNING: the custom block id at the position will not change.
|
||||||
*
|
*
|
||||||
* @param x the X position
|
* @param x the X position
|
||||||
* @param y the Y position
|
* @param y the Y position
|
||||||
@ -513,9 +514,9 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh the visual block id at the {@link BlockPosition}
|
* Refreshes the visual block id at the {@link BlockPosition}.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: the custom block id at the position will not change
|
* WARNING: the custom block id at the position will not change.
|
||||||
*
|
*
|
||||||
* @param blockPosition the block position
|
* @param blockPosition the block position
|
||||||
* @param block the new visual block
|
* @param block the new visual block
|
||||||
@ -525,7 +526,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the {@link Chunk} at the given position without any callback.
|
* Loads the {@link Chunk} at the given position without any callback.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: this is a non-blocking task.
|
* WARNING: this is a non-blocking task.
|
||||||
*
|
*
|
||||||
@ -537,7 +538,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the chunk at the given {@link Position} with a callback
|
* Loads the chunk at the given {@link Position} with a callback.
|
||||||
*
|
*
|
||||||
* @param position the chunk position
|
* @param position the chunk position
|
||||||
* @param callback the callback to run when the chunk is loaded
|
* @param callback the callback to run when the chunk is loaded
|
||||||
@ -549,7 +550,8 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a {@link Chunk} (if {@link #hasEnabledAutoChunkLoad()} returns true) at the given {@link Position} with a callback
|
* Loads a {@link Chunk} (if {@link #hasEnabledAutoChunkLoad()} returns true)
|
||||||
|
* at the given {@link Position} with a callback.
|
||||||
*
|
*
|
||||||
* @param position the chunk position
|
* @param position the chunk position
|
||||||
* @param callback the callback executed when the chunk is loaded (or with a null chunk if not)
|
* @param callback the callback executed when the chunk is loaded (or with a null chunk if not)
|
||||||
@ -561,7 +563,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unload the chunk at the given position
|
* Unloads the chunk at the given position.
|
||||||
*
|
*
|
||||||
* @param chunkX the chunk X
|
* @param chunkX the chunk X
|
||||||
* @param chunkZ the chunk Z
|
* @param chunkZ the chunk Z
|
||||||
@ -573,7 +575,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Give the block state id at the given position
|
* Gives the block state id at the given position.
|
||||||
*
|
*
|
||||||
* @param x the X position
|
* @param x the X position
|
||||||
* @param y the Y position
|
* @param y the Y position
|
||||||
@ -587,7 +589,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Give the block state id at the given position
|
* Gives the block state id at the given position.
|
||||||
*
|
*
|
||||||
* @param x the X position
|
* @param x the X position
|
||||||
* @param y the Y position
|
* @param y the Y position
|
||||||
@ -599,7 +601,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Give the block state id at the given {@link BlockPosition}
|
* Gives the block state id at the given {@link BlockPosition}.
|
||||||
*
|
*
|
||||||
* @param blockPosition the block position
|
* @param blockPosition the block position
|
||||||
* @return the block state id at the position
|
* @return the block state id at the position
|
||||||
@ -609,7 +611,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the custom block object at the given position, or null if not any
|
* Gets the custom block object at the given position.
|
||||||
*
|
*
|
||||||
* @param x the X position
|
* @param x the X position
|
||||||
* @param y the Y position
|
* @param y the Y position
|
||||||
@ -623,7 +625,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the custom block object at the given {@link BlockPosition}, or null if not any.
|
* Gets the custom block object at the given {@link BlockPosition}.
|
||||||
*
|
*
|
||||||
* @param blockPosition the block position
|
* @param blockPosition the block position
|
||||||
* @return the custom block object at the position, null if not any
|
* @return the custom block object at the position, null if not any
|
||||||
@ -633,7 +635,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a {@link BlockActionPacket} for all the viewers of the specific position
|
* Sends a {@link BlockActionPacket} for all the viewers of the specific position.
|
||||||
*
|
*
|
||||||
* @param blockPosition the block position
|
* @param blockPosition the block position
|
||||||
* @param actionId
|
* @param actionId
|
||||||
@ -655,7 +657,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the block data at the given position, or null if not any
|
* Gets the block data at the given position.
|
||||||
*
|
*
|
||||||
* @param x the X position
|
* @param x the X position
|
||||||
* @param y the Y position
|
* @param y the Y position
|
||||||
@ -670,7 +672,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the block {@link Data} at the given {@link BlockPosition}, or null if not any
|
* Gets the block {@link Data} at the given {@link BlockPosition}.
|
||||||
*
|
*
|
||||||
* @param blockPosition the block position
|
* @param blockPosition the block position
|
||||||
* @return the block data at the position, null if not any
|
* @return the block data at the position, null if not any
|
||||||
@ -680,7 +682,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the block {@link Data} at the given {@link BlockPosition}
|
* Sets the block {@link Data} at the given {@link BlockPosition}.
|
||||||
*
|
*
|
||||||
* @param x the X position
|
* @param x the X position
|
||||||
* @param y the Y position
|
* @param y the Y position
|
||||||
@ -696,7 +698,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the block {@link Data} at the given {@link BlockPosition}
|
* Sets the block {@link Data} at the given {@link BlockPosition}.
|
||||||
*
|
*
|
||||||
* @param blockPosition the block position
|
* @param blockPosition the block position
|
||||||
* @param data the data to be set, can be null
|
* @param data the data to be set, can be null
|
||||||
@ -706,7 +708,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link Chunk} at the given {@link BlockPosition}, null if not loaded.
|
* Gets the {@link Chunk} at the given {@link BlockPosition}, null if not loaded.
|
||||||
*
|
*
|
||||||
* @param x the X position
|
* @param x the X position
|
||||||
* @param z the Z position
|
* @param z the Z position
|
||||||
@ -719,7 +721,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the {@link Chunk} at the position is loaded
|
* Checks if the {@link Chunk} at the position is loaded.
|
||||||
*
|
*
|
||||||
* @param chunkX the chunk X
|
* @param chunkX the chunk X
|
||||||
* @param chunkZ the chunk Z
|
* @param chunkZ the chunk Z
|
||||||
@ -730,7 +732,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link Chunk} at the given {@link BlockPosition}, null if not loaded.
|
* Gets the {@link Chunk} at the given {@link BlockPosition}, null if not loaded.
|
||||||
*
|
*
|
||||||
* @param blockPosition the chunk position
|
* @param blockPosition the chunk position
|
||||||
* @return the chunk at the given position, null if not loaded
|
* @return the chunk at the given position, null if not loaded
|
||||||
@ -740,7 +742,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link Chunk} at the given {@link Position}, null if not loaded.
|
* Gets the {@link Chunk} at the given {@link Position}, null if not loaded.
|
||||||
*
|
*
|
||||||
* @param position the chunk position
|
* @param position the chunk position
|
||||||
* @return the chunk at the given position, null if not loaded
|
* @return the chunk at the given position, null if not loaded
|
||||||
@ -750,7 +752,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save a chunk without any callback
|
* Saves a {@link Chunk} without any callback.
|
||||||
*
|
*
|
||||||
* @param chunk the chunk to save
|
* @param chunk the chunk to save
|
||||||
*/
|
*/
|
||||||
@ -759,14 +761,14 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save all {@link Chunk} without any callback.
|
* Saves all {@link Chunk} without any callback.
|
||||||
*/
|
*/
|
||||||
public void saveChunksToStorage() {
|
public void saveChunksToStorage() {
|
||||||
saveChunksToStorage(null);
|
saveChunksToStorage(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the instance unique id
|
* Gets the instance unique id.
|
||||||
*
|
*
|
||||||
* @return the instance unique id
|
* @return the instance unique id
|
||||||
*/
|
*/
|
||||||
@ -859,7 +861,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the specified {@link Entity} to the instance entities cache.
|
* Adds the specified {@link Entity} to the instance entities cache.
|
||||||
* <p>
|
* <p>
|
||||||
* Warning: this is done automatically when the entity move out of his chunk.
|
* Warning: this is done automatically when the entity move out of his chunk.
|
||||||
*
|
*
|
||||||
@ -890,7 +892,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the specified {@link Entity} to the instance entities cache.
|
* Removes the specified {@link Entity} to the instance entities cache.
|
||||||
* <p>
|
* <p>
|
||||||
* Warning: this is done automatically when the entity move out of his chunk.
|
* Warning: this is done automatically when the entity move out of his chunk.
|
||||||
*
|
*
|
||||||
@ -928,7 +930,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedule a block update at a given {@link BlockPosition}.
|
* Schedules a block update at a given {@link BlockPosition}.
|
||||||
* Does nothing if no {@link CustomBlock} is present at 'position'.
|
* Does nothing if no {@link CustomBlock} is present at 'position'.
|
||||||
* <p>
|
* <p>
|
||||||
* Cancelled if the block changes between this call and the actual update
|
* Cancelled if the block changes between this call and the actual update
|
||||||
@ -1005,7 +1007,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the registered {@link ExplosionSupplier}, or null if none was provided
|
* Gets the registered {@link ExplosionSupplier}, or null if none was provided
|
||||||
*
|
*
|
||||||
* @return the instance explosion supplier, null if none was provided
|
* @return the instance explosion supplier, null if none was provided
|
||||||
*/
|
*/
|
||||||
@ -1023,7 +1025,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the instance space
|
* Gets the instance space
|
||||||
* <p>
|
* <p>
|
||||||
* Used by the pathfinder for entities
|
* Used by the pathfinder for entities
|
||||||
*
|
*
|
||||||
|
@ -216,7 +216,7 @@ public class InstanceContainer extends Instance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Has this block already changed since last update? Prevents StackOverflow with blocks trying to modify their position in onDestroy or onPlace
|
* Has this block already changed since last update? Prevents StackOverflow with blocks trying to modify their position in onDestroy or onPlace.
|
||||||
*
|
*
|
||||||
* @param blockPosition the block position
|
* @param blockPosition the block position
|
||||||
* @param blockStateId the block state id
|
* @param blockStateId the block state id
|
||||||
@ -241,7 +241,7 @@ public class InstanceContainer extends Instance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call {@link CustomBlock#onDestroy(Instance, BlockPosition, Data)} for {@code previousBlock}
|
* Calls {@link CustomBlock#onDestroy(Instance, BlockPosition, Data)} for {@code previousBlock}.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING {@code chunk} needs to be synchronized
|
* WARNING {@code chunk} needs to be synchronized
|
||||||
*
|
*
|
||||||
@ -256,7 +256,7 @@ public class InstanceContainer extends Instance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call {@link CustomBlock#onPlace(Instance, BlockPosition, Data)} for the current custom block at the position
|
* Calls {@link CustomBlock#onPlace(Instance, BlockPosition, Data)} for the current custom block at the position.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING {@code chunk} needs to be synchronized
|
* WARNING {@code chunk} needs to be synchronized
|
||||||
*
|
*
|
||||||
@ -273,7 +273,7 @@ public class InstanceContainer extends Instance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call the {@link BlockPlacementRule} for the specified block state id
|
* Calls the {@link BlockPlacementRule} for the specified block state id.
|
||||||
*
|
*
|
||||||
* @param blockStateId the block state id to modify
|
* @param blockStateId the block state id to modify
|
||||||
* @param blockPosition the block position
|
* @param blockPosition the block position
|
||||||
@ -288,9 +288,9 @@ public class InstanceContainer extends Instance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executed when a block is modified, this is used to modify the states of neighbours blocks
|
* Executed when a block is modified, this is used to modify the states of neighbours blocks.
|
||||||
* <p>
|
* <p>
|
||||||
* For example, this can be used for redstone wires which need an understanding of its neighborhoods to take the right shape
|
* For example, this can be used for redstone wires which need an understanding of its neighborhoods to take the right shape.
|
||||||
*
|
*
|
||||||
* @param blockPosition the position of the modified block
|
* @param blockPosition the position of the modified block
|
||||||
*/
|
*/
|
||||||
@ -435,7 +435,7 @@ public class InstanceContainer extends Instance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the instance ({@link #getUniqueId()} {@link #getData()}) and call {@link #saveChunksToStorage(Runnable)}
|
* Saves the instance ({@link #getUniqueId()} {@link #getData()}) and call {@link #saveChunksToStorage(Runnable)}.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: {@link #getData()} needs to be a {@link SerializableData} in order to be saved
|
* WARNING: {@link #getData()} needs to be a {@link SerializableData} in order to be saved
|
||||||
*
|
*
|
||||||
@ -569,7 +569,7 @@ public class InstanceContainer extends Instance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change which type of {@link Chunk} implementation to use once one needs to be loaded.
|
* Changes which type of {@link Chunk} implementation to use once one needs to be loaded.
|
||||||
* <p>
|
* <p>
|
||||||
* Uses {@link DynamicChunk} by default.
|
* Uses {@link DynamicChunk} by default.
|
||||||
* <p>
|
* <p>
|
||||||
@ -586,7 +586,7 @@ public class InstanceContainer extends Instance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current {@link ChunkSupplier}.
|
* Gets the current {@link ChunkSupplier}.
|
||||||
* <p>
|
* <p>
|
||||||
* You shouldn't use it to generate a new chunk, but as a way to view which one is currently in use.
|
* You shouldn't use it to generate a new chunk, but as a way to view which one is currently in use.
|
||||||
*
|
*
|
||||||
@ -597,7 +597,7 @@ public class InstanceContainer extends Instance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the {@link SharedInstance} linked to this container
|
* Gets all the {@link SharedInstance} linked to this container.
|
||||||
*
|
*
|
||||||
* @return an unmodifiable {@link List} containing all the {@link SharedInstance} linked to this container
|
* @return an unmodifiable {@link List} containing all the {@link SharedInstance} linked to this container
|
||||||
*/
|
*/
|
||||||
@ -606,7 +606,7 @@ public class InstanceContainer extends Instance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assign a {@link SharedInstance} to this container.
|
* Assigns a {@link SharedInstance} to this container.
|
||||||
* <p>
|
* <p>
|
||||||
* Only used by {@link InstanceManager}, mostly unsafe.
|
* Only used by {@link InstanceManager}, mostly unsafe.
|
||||||
*
|
*
|
||||||
@ -617,7 +617,7 @@ public class InstanceContainer extends Instance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a {@link Chunk} to the internal instance map
|
* Adds a {@link Chunk} to the internal instance map.
|
||||||
*
|
*
|
||||||
* @param chunk the chunk to cache
|
* @param chunk the chunk to cache
|
||||||
*/
|
*/
|
||||||
@ -637,7 +637,7 @@ public class InstanceContainer extends Instance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the instance chunks
|
* Gets all the instance chunks.
|
||||||
*
|
*
|
||||||
* @return the chunks of this instance
|
* @return the chunks of this instance
|
||||||
*/
|
*/
|
||||||
@ -656,7 +656,7 @@ public class InstanceContainer extends Instance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link IChunkLoader} of this instance
|
* Gets the {@link IChunkLoader} of this instance.
|
||||||
*
|
*
|
||||||
* @return the {@link IChunkLoader} of this instance
|
* @return the {@link IChunkLoader} of this instance
|
||||||
*/
|
*/
|
||||||
@ -665,7 +665,7 @@ public class InstanceContainer extends Instance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the {@link IChunkLoader} of this instance (to change how chunks are retrieved when not already loaded)
|
* Changes the {@link IChunkLoader} of this instance (to change how chunks are retrieved when not already loaded).
|
||||||
*
|
*
|
||||||
* @param chunkLoader the new {@link IChunkLoader}
|
* @param chunkLoader the new {@link IChunkLoader}
|
||||||
*/
|
*/
|
||||||
@ -674,9 +674,9 @@ public class InstanceContainer extends Instance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a {@link BlockChangePacket} at the specified {@link BlockPosition} to set the block as {@code blockStateId}
|
* Sends a {@link BlockChangePacket} at the specified {@link BlockPosition} to set the block as {@code blockStateId}.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: this does not change the internal block data, this is strictly visual for the players
|
* WARNING: this does not change the internal block data, this is strictly visual for the players.
|
||||||
*
|
*
|
||||||
* @param chunk the chunk where the block is
|
* @param chunk the chunk where the block is
|
||||||
* @param blockPosition the block position
|
* @param blockPosition the block position
|
||||||
@ -722,9 +722,9 @@ public class InstanceContainer extends Instance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unload all waiting chunks
|
* Unloads all waiting chunks.
|
||||||
* <p>
|
* <p>
|
||||||
* Unsafe because it has to be done on the same thread as the instance/chunks tick update
|
* Unsafe because it has to be done on the same thread as the instance/chunks tick update.
|
||||||
*/
|
*/
|
||||||
protected void UNSAFE_unloadChunks() {
|
protected void UNSAFE_unloadChunks() {
|
||||||
synchronized (this.scheduledChunksToRemove) {
|
synchronized (this.scheduledChunksToRemove) {
|
||||||
|
@ -11,14 +11,14 @@ import java.util.UUID;
|
|||||||
import java.util.concurrent.CopyOnWriteArraySet;
|
import java.util.concurrent.CopyOnWriteArraySet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to register {@link Instance}
|
* Used to register {@link Instance}.
|
||||||
*/
|
*/
|
||||||
public final class InstanceManager {
|
public final class InstanceManager {
|
||||||
|
|
||||||
private final Set<Instance> instances = new CopyOnWriteArraySet<>();
|
private final Set<Instance> instances = new CopyOnWriteArraySet<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register an {@link Instance} internally
|
* Registers an {@link Instance} internally.
|
||||||
* <p>
|
* <p>
|
||||||
* Note: not necessary if you created your instance using {@link #createInstanceContainer()} or {@link #createSharedInstance(InstanceContainer)}
|
* Note: not necessary if you created your instance using {@link #createInstanceContainer()} or {@link #createSharedInstance(InstanceContainer)}
|
||||||
* but only if you instantiated your instance object manually
|
* but only if you instantiated your instance object manually
|
||||||
@ -32,7 +32,8 @@ public final class InstanceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and register an {@link InstanceContainer} with the specified {@link DimensionType} and {@link StorageLocation}
|
* Creates and register an {@link InstanceContainer}
|
||||||
|
* with the specified {@link DimensionType} and {@link StorageLocation}.
|
||||||
*
|
*
|
||||||
* @param dimensionType the {@link DimensionType} of the instance
|
* @param dimensionType the {@link DimensionType} of the instance
|
||||||
* @param storageLocation the {@link StorageLocation} of the instance, can be null
|
* @param storageLocation the {@link StorageLocation} of the instance, can be null
|
||||||
@ -45,7 +46,7 @@ public final class InstanceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and register an {@link InstanceContainer} with the specified {@link StorageLocation}
|
* Creates and register an {@link InstanceContainer} with the specified {@link StorageLocation}.
|
||||||
*
|
*
|
||||||
* @param storageLocation the {@link StorageLocation} of the instance, can be null
|
* @param storageLocation the {@link StorageLocation} of the instance, can be null
|
||||||
* @return the created {@link InstanceContainer}
|
* @return the created {@link InstanceContainer}
|
||||||
@ -55,7 +56,7 @@ public final class InstanceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and register an {@link InstanceContainer} with the specified {@link DimensionType}
|
* Creates and register an {@link InstanceContainer} with the specified {@link DimensionType}.
|
||||||
*
|
*
|
||||||
* @param dimensionType the {@link DimensionType} of the instance
|
* @param dimensionType the {@link DimensionType} of the instance
|
||||||
* @return the created {@link InstanceContainer}
|
* @return the created {@link InstanceContainer}
|
||||||
@ -65,7 +66,7 @@ public final class InstanceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and register an {@link InstanceContainer}
|
* Creates and register an {@link InstanceContainer}.
|
||||||
*
|
*
|
||||||
* @return the created {@link InstanceContainer}
|
* @return the created {@link InstanceContainer}
|
||||||
*/
|
*/
|
||||||
@ -74,9 +75,9 @@ public final class InstanceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a {@link SharedInstance}
|
* Registers a {@link SharedInstance}.
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: the {@link SharedInstance} needs to have an {@link InstanceContainer} assigned to it
|
* WARNING: the {@link SharedInstance} needs to have an {@link InstanceContainer} assigned to it.
|
||||||
*
|
*
|
||||||
* @param sharedInstance the {@link SharedInstance} to register
|
* @param sharedInstance the {@link SharedInstance} to register
|
||||||
* @return the registered {@link SharedInstance}
|
* @return the registered {@link SharedInstance}
|
||||||
@ -92,7 +93,7 @@ public final class InstanceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and register a {@link SharedInstance}
|
* Creates and register a {@link SharedInstance}.
|
||||||
*
|
*
|
||||||
* @param instanceContainer the container assigned to the shared instance
|
* @param instanceContainer the container assigned to the shared instance
|
||||||
* @return the created {@link SharedInstance}
|
* @return the created {@link SharedInstance}
|
||||||
@ -107,9 +108,9 @@ public final class InstanceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unregister the {@link Instance} internally
|
* Unregisters the {@link Instance} internally.
|
||||||
* <p>
|
* <p>
|
||||||
* If {@code instance} is an {@link InstanceContainer} all chunks are unloaded
|
* If {@code instance} is an {@link InstanceContainer} all chunks are unloaded.
|
||||||
*
|
*
|
||||||
* @param instance the {@link Instance} to unregister
|
* @param instance the {@link Instance} to unregister
|
||||||
*/
|
*/
|
||||||
@ -131,7 +132,7 @@ public final class InstanceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the registered instances
|
* Gets all the registered instances.
|
||||||
*
|
*
|
||||||
* @return an unmodifiable {@link Set} containing all the registered instances
|
* @return an unmodifiable {@link Set} containing all the registered instances
|
||||||
*/
|
*/
|
||||||
@ -140,9 +141,9 @@ public final class InstanceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register an {@link Instance} internally
|
* Registers an {@link Instance} internally.
|
||||||
* <p>
|
* <p>
|
||||||
* Unsafe because it does not check if {@code instance} is a {@link SharedInstance} to verify its container
|
* Unsafe because it does not check if {@code instance} is a {@link SharedInstance} to verify its container.
|
||||||
*
|
*
|
||||||
* @param instance the {@link Instance} to register
|
* @param instance the {@link Instance} to register
|
||||||
*/
|
*/
|
||||||
|
@ -22,7 +22,7 @@ public class MinestomBasicChunkLoader implements IChunkLoader {
|
|||||||
private final InstanceContainer instanceContainer;
|
private final InstanceContainer instanceContainer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an {@link IChunkLoader} which use a {@link StorageLocation}.
|
* Creates an {@link IChunkLoader} which use a {@link StorageLocation}.
|
||||||
* <p>
|
* <p>
|
||||||
* The {@link ChunkSupplier} is used to customize which type of {@link Chunk} this loader should use for loading.
|
* The {@link ChunkSupplier} is used to customize which type of {@link Chunk} this loader should use for loading.
|
||||||
* <p>
|
* <p>
|
||||||
@ -94,7 +94,7 @@ public class MinestomBasicChunkLoader implements IChunkLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the chunk key used by the {@link StorageLocation}
|
* Gets the chunk key used by the {@link StorageLocation}.
|
||||||
*
|
*
|
||||||
* @param chunkX the chunk X
|
* @param chunkX the chunk X
|
||||||
* @param chunkZ the chunk Z
|
* @param chunkZ the chunk Z
|
||||||
|
@ -147,7 +147,7 @@ public class SharedInstance extends Instance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link InstanceContainer} from where this instance takes its {@link Chunk} from.
|
* Gets the {@link InstanceContainer} from where this instance takes its {@link Chunk} from.
|
||||||
*
|
*
|
||||||
* @return the associated {@link InstanceContainer}
|
* @return the associated {@link InstanceContainer}
|
||||||
*/
|
*/
|
||||||
|
@ -7,7 +7,8 @@ import net.minestom.server.network.packet.server.play.WorldBorderPacket;
|
|||||||
import net.minestom.server.utils.Position;
|
import net.minestom.server.utils.Position;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the world border of an {@link Instance}, can be retrieved with {@link Instance#getWorldBorder()}.
|
* Represents the world border of an {@link Instance},
|
||||||
|
* can be retrieved with {@link Instance#getWorldBorder()}.
|
||||||
*/
|
*/
|
||||||
public class WorldBorder {
|
public class WorldBorder {
|
||||||
|
|
||||||
@ -40,7 +41,7 @@ public class WorldBorder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the X and Z position of the center.
|
* Changes the X and Z position of the center.
|
||||||
*
|
*
|
||||||
* @param centerX the X center
|
* @param centerX the X center
|
||||||
* @param centerZ the Z center
|
* @param centerZ the Z center
|
||||||
@ -52,7 +53,7 @@ public class WorldBorder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the center X of the world border.
|
* Gets the center X of the world border.
|
||||||
*
|
*
|
||||||
* @return the X center
|
* @return the X center
|
||||||
*/
|
*/
|
||||||
@ -61,7 +62,7 @@ public class WorldBorder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the center X of the world border.
|
* Changes the center X of the world border.
|
||||||
*
|
*
|
||||||
* @param centerX the new center X
|
* @param centerX the new center X
|
||||||
*/
|
*/
|
||||||
@ -71,7 +72,7 @@ public class WorldBorder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the center Z of the world border.
|
* Gets the center Z of the world border.
|
||||||
*
|
*
|
||||||
* @return the Z center
|
* @return the Z center
|
||||||
*/
|
*/
|
||||||
@ -80,7 +81,7 @@ public class WorldBorder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the center Z of the world border.
|
* Changes the center Z of the world border.
|
||||||
*
|
*
|
||||||
* @param centerZ the new center Z
|
* @param centerZ the new center Z
|
||||||
*/
|
*/
|
||||||
@ -120,7 +121,7 @@ public class WorldBorder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the diameter to {@code diameter} in {@code speed} milliseconds (interpolation).
|
* Changes the diameter to {@code diameter} in {@code speed} milliseconds (interpolation).
|
||||||
*
|
*
|
||||||
* @param diameter the diameter target
|
* @param diameter the diameter target
|
||||||
* @param speed the time it will take to reach {@code diameter} in milliseconds
|
* @param speed the time it will take to reach {@code diameter} in milliseconds
|
||||||
@ -142,7 +143,7 @@ public class WorldBorder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the diameter of the world border.
|
* Gets the diameter of the world border.
|
||||||
* It takes lerp in consideration.
|
* It takes lerp in consideration.
|
||||||
*
|
*
|
||||||
* @return the current world border diameter
|
* @return the current world border diameter
|
||||||
@ -152,7 +153,7 @@ public class WorldBorder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the diameter of the world border.
|
* Changes the diameter of the world border.
|
||||||
*
|
*
|
||||||
* @param diameter the new diameter of the world border
|
* @param diameter the new diameter of the world border
|
||||||
*/
|
*/
|
||||||
@ -232,7 +233,7 @@ public class WorldBorder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send the world border init packet to a player.
|
* Sends the world border init packet to a player.
|
||||||
*
|
*
|
||||||
* @param player the player to send the packet to
|
* @param player the player to send the packet to
|
||||||
*/
|
*/
|
||||||
@ -245,7 +246,7 @@ public class WorldBorder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link Instance} linked to this world border.
|
* Gets the {@link Instance} linked to this world border.
|
||||||
*
|
*
|
||||||
* @return the {@link Instance} of this world border
|
* @return the {@link Instance} of this world border
|
||||||
*/
|
*/
|
||||||
@ -254,7 +255,7 @@ public class WorldBorder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send the new world border centers to all instance players
|
* Sends the new world border centers to all instance players.
|
||||||
*/
|
*/
|
||||||
private void refreshCenter() {
|
private void refreshCenter() {
|
||||||
WorldBorderPacket worldBorderPacket = new WorldBorderPacket();
|
WorldBorderPacket worldBorderPacket = new WorldBorderPacket();
|
||||||
@ -264,7 +265,7 @@ public class WorldBorder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a {@link WorldBorderPacket} to all the instance players
|
* Sends a {@link WorldBorderPacket} to all the instance players.
|
||||||
*
|
*
|
||||||
* @param worldBorderPacket the packet to send
|
* @param worldBorderPacket the packet to send
|
||||||
*/
|
*/
|
||||||
|
@ -17,7 +17,7 @@ public class BlockManager {
|
|||||||
private BlockPlacementRule[] placementRules = new BlockPlacementRule[Short.MAX_VALUE];
|
private BlockPlacementRule[] placementRules = new BlockPlacementRule[Short.MAX_VALUE];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a {@link CustomBlock}
|
* Registers a {@link CustomBlock}.
|
||||||
*
|
*
|
||||||
* @param customBlock the custom block to register
|
* @param customBlock the custom block to register
|
||||||
* @throws IllegalArgumentException if <code>customBlock</code> block id is not greater than 0
|
* @throws IllegalArgumentException if <code>customBlock</code> block id is not greater than 0
|
||||||
@ -34,7 +34,7 @@ public class BlockManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a {@link BlockPlacementRule}
|
* Registers a {@link BlockPlacementRule}.
|
||||||
*
|
*
|
||||||
* @param blockPlacementRule the block placement rule to register
|
* @param blockPlacementRule the block placement rule to register
|
||||||
* @throws IllegalArgumentException if <code>blockPlacementRule</code> block id is negative
|
* @throws IllegalArgumentException if <code>blockPlacementRule</code> block id is negative
|
||||||
@ -47,7 +47,7 @@ public class BlockManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link BlockPlacementRule} of the specific block
|
* Gets the {@link BlockPlacementRule} of the specific block.
|
||||||
*
|
*
|
||||||
* @param block the block to check
|
* @param block the block to check
|
||||||
* @return the block placement rule associated with the block, null if not any
|
* @return the block placement rule associated with the block, null if not any
|
||||||
@ -57,7 +57,7 @@ public class BlockManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link BlockPlacementRule} of the specific block
|
* Gets the {@link BlockPlacementRule} of the specific block.
|
||||||
*
|
*
|
||||||
* @param blockStateId the block id to check
|
* @param blockStateId the block id to check
|
||||||
* @return the block placement rule associated with the id, null if not any
|
* @return the block placement rule associated with the id, null if not any
|
||||||
@ -68,7 +68,7 @@ public class BlockManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link CustomBlock} with the specific identifier {@link CustomBlock#getIdentifier()}
|
* Gets the {@link CustomBlock} with the specific identifier {@link CustomBlock#getIdentifier()}.
|
||||||
*
|
*
|
||||||
* @param identifier the custom block identifier
|
* @param identifier the custom block identifier
|
||||||
* @return the {@link CustomBlock} associated with the identifier, null if not any
|
* @return the {@link CustomBlock} associated with the identifier, null if not any
|
||||||
@ -78,7 +78,7 @@ public class BlockManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link CustomBlock} with the specific custom block id {@link CustomBlock#getCustomBlockId()}
|
* Gets the {@link CustomBlock} with the specific custom block id {@link CustomBlock#getCustomBlockId()}.
|
||||||
*
|
*
|
||||||
* @param id the custom block id
|
* @param id the custom block id
|
||||||
* @return the {@link CustomBlock} associated with the id, null if not any
|
* @return the {@link CustomBlock} associated with the id, null if not any
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user