mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 17:01:56 +01:00
SPIGOT-6829: Add per-player world border API
By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
parent
e795b5d12f
commit
2d304809b5
4 changed files with 59 additions and 0 deletions
|
@ -715,6 +715,18 @@ public final class Bukkit {
|
|||
return server.getWorld(uid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new virtual {@link WorldBorder}.
|
||||
*
|
||||
* @return the created world border instance
|
||||
*
|
||||
* @see Player#setWorldBorder(WorldBorder)
|
||||
*/
|
||||
@NotNull
|
||||
public static WorldBorder createWorldBorder() {
|
||||
return server.createWorldBorder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the map from the given item ID.
|
||||
*
|
||||
|
|
|
@ -604,6 +604,19 @@ public interface Server extends PluginMessageRecipient {
|
|||
@Nullable
|
||||
public World getWorld(@NotNull UUID uid);
|
||||
|
||||
/**
|
||||
* Create a new virtual {@link WorldBorder}.
|
||||
* <p>
|
||||
* Note that world borders created by the server will not respect any world
|
||||
* scaling effects (i.e. coordinates are not divided by 8 in the nether).
|
||||
*
|
||||
* @return the created world border instance
|
||||
*
|
||||
* @see Player#setWorldBorder(WorldBorder)
|
||||
*/
|
||||
@NotNull
|
||||
public WorldBorder createWorldBorder();
|
||||
|
||||
/**
|
||||
* Gets the map from the given item ID.
|
||||
*
|
||||
|
|
|
@ -1,9 +1,19 @@
|
|||
package org.bukkit;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface WorldBorder {
|
||||
|
||||
/**
|
||||
* Get the {@link World} in which the border resides.
|
||||
*
|
||||
* @return the associated world, or null if this world border is not associated
|
||||
* with any specific world, such as those created via {@link Server#createWorldBorder()}
|
||||
*/
|
||||
@Nullable
|
||||
public World getWorld();
|
||||
|
||||
/**
|
||||
* Resets the border to default values.
|
||||
*/
|
||||
|
|
|
@ -10,9 +10,11 @@ import org.bukkit.Material;
|
|||
import org.bukkit.Note;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.SoundCategory;
|
||||
import org.bukkit.WeatherType;
|
||||
import org.bukkit.WorldBorder;
|
||||
import org.bukkit.advancement.Advancement;
|
||||
import org.bukkit.advancement.AdvancementProgress;
|
||||
import org.bukkit.block.Block;
|
||||
|
@ -1153,6 +1155,28 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
|||
*/
|
||||
public void setScoreboard(@NotNull Scoreboard scoreboard) throws IllegalArgumentException, IllegalStateException;
|
||||
|
||||
/**
|
||||
* Gets the {@link WorldBorder} visible to this Player, or null if viewing
|
||||
* the world's world border.
|
||||
*
|
||||
* @return the player's world border
|
||||
*/
|
||||
@Nullable
|
||||
public WorldBorder getWorldBorder();
|
||||
|
||||
/**
|
||||
* Sets the {@link WorldBorder} visible to this Player.
|
||||
*
|
||||
* @param border the border to set, or null to set to the world border of
|
||||
* the player's current world
|
||||
*
|
||||
* @throws UnsupportedOperationException if setting the border to that of
|
||||
* a world in which the player is not currently present.
|
||||
*
|
||||
* @see Server#createWorldBorder()
|
||||
*/
|
||||
public void setWorldBorder(@Nullable WorldBorder border);
|
||||
|
||||
/**
|
||||
* Gets if the client is displayed a 'scaled' health, that is, health on a
|
||||
* scale from 0-{@link #getHealthScale()}.
|
||||
|
|
Loading…
Reference in a new issue