mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-10 09:34:43 +02:00
Finalize DI stuff
This commit is contained in:
@ -53,8 +53,8 @@ import org.bukkit.event.EventException;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
import org.bukkit.plugin.RegisteredListener;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
@ -82,18 +82,18 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
||||
*
|
||||
* @param player Bukkit player instance
|
||||
*/
|
||||
public BukkitPlayer(@NotNull final PlotAreaManager plotAreaManager, @NotNull final EventDispatcher eventDispatcher,
|
||||
@NotNull final Player player, @Nullable final EconHandler econHandler) {
|
||||
public BukkitPlayer(@Nonnull final PlotAreaManager plotAreaManager, @Nonnull final EventDispatcher eventDispatcher,
|
||||
@Nonnull final Player player, @Nullable final EconHandler econHandler) {
|
||||
this(plotAreaManager, eventDispatcher, player, false, econHandler);
|
||||
}
|
||||
|
||||
public BukkitPlayer(@NotNull final PlotAreaManager plotAreaManager, @NotNull final EventDispatcher eventDispatcher,
|
||||
@NotNull final Player player, final boolean offline, @Nullable final EconHandler econHandler) {
|
||||
public BukkitPlayer(@Nonnull final PlotAreaManager plotAreaManager, @Nonnull final EventDispatcher eventDispatcher,
|
||||
@Nonnull final Player player, final boolean offline, @Nullable final EconHandler econHandler) {
|
||||
this(plotAreaManager, eventDispatcher, player, offline, true, econHandler);
|
||||
}
|
||||
|
||||
public BukkitPlayer(@NotNull final PlotAreaManager plotAreaManager, @NotNull final
|
||||
EventDispatcher eventDispatcher, @NotNull final Player player, final boolean offline,
|
||||
public BukkitPlayer(@Nonnull final PlotAreaManager plotAreaManager, @Nonnull final
|
||||
EventDispatcher eventDispatcher, @Nonnull final Player player, final boolean offline,
|
||||
final boolean realPlayer, @Nullable final EconHandler econHandler) {
|
||||
super(plotAreaManager, eventDispatcher, econHandler);
|
||||
this.player = player;
|
||||
@ -112,12 +112,12 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
@NotNull @Override public Location getLocation() {
|
||||
@Nonnull @Override public Location getLocation() {
|
||||
final Location location = super.getLocation();
|
||||
return location == null ? BukkitUtil.getLocation(this.player) : location;
|
||||
}
|
||||
|
||||
@NotNull @Override public UUID getUUID() {
|
||||
@Nonnull @Override public UUID getUUID() {
|
||||
if (Settings.UUID.OFFLINE) {
|
||||
if (Settings.UUID.FORCE_LOWERCASE) {
|
||||
return UUID.nameUUIDFromBytes(("OfflinePlayer:" +
|
||||
@ -134,7 +134,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
||||
return this.player.getLastPlayed();
|
||||
}
|
||||
|
||||
@Override public boolean canTeleport(@NotNull final Location location) {
|
||||
@Override public boolean canTeleport(@Nonnull final Location location) {
|
||||
final org.bukkit.Location to = BukkitUtil.getLocation(location);
|
||||
final org.bukkit.Location from = player.getLocation();
|
||||
PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to);
|
||||
@ -152,7 +152,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
||||
player.sendTitle(title, subtitle, fadeIn, stay, fadeOut);
|
||||
}
|
||||
|
||||
private void callEvent(@NotNull final Event event) {
|
||||
private void callEvent(@Nonnull final Event event) {
|
||||
final RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners();
|
||||
for (final RegisteredListener listener : listeners) {
|
||||
if (listener.getPlugin().getName().equals(PlotSquared.platform().getPluginName())) {
|
||||
@ -248,7 +248,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void teleport(@NotNull final Location location, @NotNull final TeleportCause cause) {
|
||||
public void teleport(@Nonnull final Location location, @Nonnull final TeleportCause cause) {
|
||||
if (Math.abs(location.getX()) >= 30000000 || Math.abs(location.getZ()) >= 30000000) {
|
||||
return;
|
||||
}
|
||||
@ -279,7 +279,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
||||
return BukkitUtil.getLocationFull(this.player);
|
||||
}
|
||||
|
||||
@Override public void setWeather(@NotNull final PlotWeather weather) {
|
||||
@Override public void setWeather(@Nonnull final PlotWeather weather) {
|
||||
switch (weather) {
|
||||
case CLEAR:
|
||||
this.player.setPlayerWeather(WeatherType.CLEAR);
|
||||
@ -294,7 +294,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull @Override public com.sk89q.worldedit.world.gamemode.GameMode getGameMode() {
|
||||
@Override public com.sk89q.worldedit.world.gamemode.GameMode getGameMode() {
|
||||
switch (this.player.getGameMode()) {
|
||||
case ADVENTURE:
|
||||
return ADVENTURE;
|
||||
@ -309,7 +309,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGameMode(@NotNull final com.sk89q.worldedit.world.gamemode.GameMode gameMode) {
|
||||
public void setGameMode(final com.sk89q.worldedit.world.gamemode.GameMode gameMode) {
|
||||
if (ADVENTURE.equals(gameMode)) {
|
||||
this.player.setGameMode(GameMode.ADVENTURE);
|
||||
} else if (CREATIVE.equals(gameMode)) {
|
||||
@ -337,7 +337,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
||||
this.player.setAllowFlight(fly);
|
||||
}
|
||||
|
||||
@Override public void playMusic(@NotNull final Location location, @NotNull final ItemType id) {
|
||||
@Override public void playMusic(@Nonnull final Location location, @Nonnull final ItemType id) {
|
||||
if (id == ItemTypes.AIR) {
|
||||
// Let's just stop all the discs because why not?
|
||||
for (final Sound sound : Arrays.stream(Sound.values())
|
||||
@ -367,7 +367,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
||||
}
|
||||
|
||||
|
||||
public PlayerTeleportEvent.TeleportCause getTeleportCause(@NotNull final TeleportCause cause) {
|
||||
public PlayerTeleportEvent.TeleportCause getTeleportCause(@Nonnull final TeleportCause cause) {
|
||||
switch (cause) {
|
||||
case COMMAND:
|
||||
return PlayerTeleportEvent.TeleportCause.COMMAND;
|
||||
|
Reference in New Issue
Block a user