mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 09:07:37 +00:00
make getPlayer a function because mongo doesnt call constructors
This commit is contained in:
parent
829bb88959
commit
16e29b80a7
@ -24,11 +24,15 @@ public class CommandListener extends PlexListener
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
Bukkit.getOnlinePlayers().stream().filter(pl -> plugin.getPlayerCache().getPlexPlayer(pl.getUniqueId()).isCommandSpy() && hasCommandSpy(plugin.getPlayerCache().getPlexPlayer(pl.getUniqueId()))).forEach(pl ->
|
||||
Bukkit.getOnlinePlayers().stream().filter(pl -> {
|
||||
PlexPlayer player = plugin.getPlayerCache().getPlexPlayer(pl.getUniqueId());
|
||||
return player.isCommandSpy() && hasCommandSpy(plugin.getPlayerCache().getPlexPlayer(pl.getUniqueId()));
|
||||
}).forEach(pl ->
|
||||
{
|
||||
System.out.println("Sending to " + pl.getUniqueId());
|
||||
Player player = event.getPlayer();
|
||||
String command = event.getMessage();
|
||||
if (pl != player)
|
||||
if (!pl.getUniqueId().equals(player.getUniqueId()))
|
||||
{
|
||||
pl.sendMessage(ChatColor.GRAY + player.getName() + ": " + command);
|
||||
}
|
||||
|
@ -41,7 +41,6 @@ public class PlexPlayer
|
||||
|
||||
@Indexed
|
||||
private String name;
|
||||
private transient Player player;
|
||||
|
||||
private String loginMessage;
|
||||
private String prefix;
|
||||
@ -78,7 +77,6 @@ public class PlexPlayer
|
||||
this.id = uuid.toString().substring(0, 8);
|
||||
|
||||
this.name = "";
|
||||
this.player = Bukkit.getPlayer(name);
|
||||
|
||||
this.loginMessage = "";
|
||||
this.prefix = "";
|
||||
@ -106,7 +104,7 @@ public class PlexPlayer
|
||||
|
||||
public String displayName()
|
||||
{
|
||||
return PlainTextComponentSerializer.plainText().serialize(player.displayName());
|
||||
return PlainTextComponentSerializer.plainText().serialize(getPlayer().displayName());
|
||||
}
|
||||
|
||||
public Rank getRankFromString()
|
||||
@ -150,4 +148,8 @@ public class PlexPlayer
|
||||
{
|
||||
return new GsonBuilder().registerTypeAdapter(ZonedDateTime.class, new ZonedDateTimeSerializer()).create().toJson(this);
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return Bukkit.getPlayer(this.uuid);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user