mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-28 03:34:42 +02:00
Inject EventDispatcher and PlotListener
This commit is contained in:
@ -36,6 +36,7 @@ import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.PlotWeather;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.util.EconHandler;
|
||||
import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.MathMan;
|
||||
import com.plotsquared.core.util.StringMan;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
@ -77,16 +78,19 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
||||
*
|
||||
* @param player Bukkit player instance
|
||||
*/
|
||||
public BukkitPlayer(@NotNull final PlotAreaManager plotAreaManager, @NotNull final Player player) {
|
||||
this(plotAreaManager, player, false);
|
||||
public BukkitPlayer(@NotNull final PlotAreaManager plotAreaManager, @NotNull final EventDispatcher eventDispatcher,
|
||||
@NotNull final Player player) {
|
||||
this(plotAreaManager, eventDispatcher, player, false);
|
||||
}
|
||||
|
||||
public BukkitPlayer(@NotNull final PlotAreaManager plotAreaManager, @NotNull final Player player, final boolean offline) {
|
||||
this(plotAreaManager, player, offline, true);
|
||||
public BukkitPlayer(@NotNull final PlotAreaManager plotAreaManager, @NotNull final EventDispatcher eventDispatcher,
|
||||
@NotNull final Player player, final boolean offline) {
|
||||
this(plotAreaManager, eventDispatcher, player, offline, true);
|
||||
}
|
||||
|
||||
public BukkitPlayer(@NotNull final PlotAreaManager plotAreaManager, @NotNull final Player player, final boolean offline, final boolean realPlayer) {
|
||||
super(plotAreaManager);
|
||||
public BukkitPlayer(@NotNull final PlotAreaManager plotAreaManager, @NotNull final
|
||||
EventDispatcher eventDispatcher, @NotNull final Player player, final boolean offline, final boolean realPlayer) {
|
||||
super(plotAreaManager, eventDispatcher);
|
||||
this.player = player;
|
||||
this.offline = offline;
|
||||
if (realPlayer) {
|
||||
|
@ -26,7 +26,9 @@
|
||||
package com.plotsquared.bukkit.player;
|
||||
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.PlayerManager;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -37,19 +39,16 @@ import java.util.UUID;
|
||||
/**
|
||||
* Player manager providing {@link BukkitPlayer Bukkit players}
|
||||
*/
|
||||
public class BukkitPlayerManager extends PlayerManager<BukkitPlayer, Player> {
|
||||
@RequiredArgsConstructor public class BukkitPlayerManager extends PlayerManager<BukkitPlayer, Player> {
|
||||
|
||||
private final PlotAreaManager plotAreaManager;
|
||||
|
||||
public BukkitPlayerManager(@NotNull final PlotAreaManager plotAreaManager) {
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
}
|
||||
private final EventDispatcher eventDispatcher;
|
||||
|
||||
@NotNull @Override public BukkitPlayer getPlayer(@NotNull final Player object) {
|
||||
try {
|
||||
return getPlayer(object.getUniqueId());
|
||||
} catch (final NoSuchPlayerException exception) {
|
||||
return new BukkitPlayer(this.plotAreaManager, object, object.isOnline(), false);
|
||||
return new BukkitPlayer(this.plotAreaManager, this.eventDispatcher, object, object.isOnline(), false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,7 +57,7 @@ public class BukkitPlayerManager extends PlayerManager<BukkitPlayer, Player> {
|
||||
if (player == null || !player.isOnline()) {
|
||||
throw new NoSuchPlayerException(uuid);
|
||||
}
|
||||
return new BukkitPlayer(this.plotAreaManager, player);
|
||||
return new BukkitPlayer(this.plotAreaManager, this.eventDispatcher, player);
|
||||
}
|
||||
|
||||
@Nullable @Override public BukkitOfflinePlayer getOfflinePlayer(@Nullable final UUID uuid) {
|
||||
|
Reference in New Issue
Block a user