mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 05:06:45 +01:00
Vanished players are treated as if they are offline for inspect command
Fixed #4444
This commit is contained in:
parent
72264205d0
commit
b59d1afdb4
@ -1,6 +1,11 @@
|
||||
Version 2.1.177
|
||||
Environmentally aware will now protect Wolves from Magma blocks
|
||||
Fixed a bug where mcMMO would fail to update a players name when it detected a name change
|
||||
mcMMO will treat vanished players as if they are offline when using the inspect command on them now (see notes)
|
||||
|
||||
NOTES:
|
||||
A few changes were made to the inspect command, it used to reject you when used on vanished players, now it will be processed as if they are offline.
|
||||
Additionally if you do inspect a vanished player, it will not use their display name (consistent with offline players) as that would give them away for being online
|
||||
|
||||
Version 2.1.176
|
||||
Another fix for Double Smelt bringing item stack size to illegal values
|
||||
|
@ -36,7 +36,9 @@ public class InspectCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Config.getInstance().getScoreboardsEnabled() && sender instanceof Player && Config.getInstance().getInspectUseBoard()) {
|
||||
if (Config.getInstance().getScoreboardsEnabled()
|
||||
&& sender instanceof Player
|
||||
&& Config.getInstance().getInspectUseBoard()) {
|
||||
ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, profile);
|
||||
|
||||
if (!Config.getInstance().getInspectUseChat()) {
|
||||
@ -63,16 +65,21 @@ public class InspectCommand implements TabExecutor {
|
||||
|
||||
} else {
|
||||
Player target = mcMMOPlayer.getPlayer();
|
||||
boolean isVanished = false;
|
||||
|
||||
if (CommandUtils.hidden(sender, target, Permissions.inspectHidden(sender))) {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
|
||||
return true;
|
||||
} else if (CommandUtils.tooFar(sender, target, Permissions.inspectFar(sender))) {
|
||||
isVanished = true;
|
||||
}
|
||||
|
||||
//Only distance check players who are online and not vanished
|
||||
if (!isVanished && CommandUtils.tooFar(sender, target, Permissions.inspectFar(sender))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Config.getInstance().getScoreboardsEnabled() && sender instanceof Player && Config.getInstance().getInspectUseBoard()) {
|
||||
ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, mcMMOPlayer.getProfile());
|
||||
if (Config.getInstance().getScoreboardsEnabled()
|
||||
&& sender instanceof Player
|
||||
&& Config.getInstance().getInspectUseBoard()) {
|
||||
ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, mcMMOPlayer);
|
||||
|
||||
if (!Config.getInstance().getInspectUseChat()) {
|
||||
return true;
|
||||
|
@ -21,6 +21,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
@ -327,7 +328,7 @@ public class ScoreboardManager {
|
||||
changeScoreboard(wrapper, Config.getInstance().getStatsScoreboardTime());
|
||||
}
|
||||
|
||||
public static void enablePlayerInspectScoreboard(Player player, PlayerProfile targetProfile) {
|
||||
public static void enablePlayerInspectScoreboard(@NotNull Player player, @NotNull PlayerProfile targetProfile) {
|
||||
ScoreboardWrapper wrapper = getWrapper(player);
|
||||
|
||||
if(wrapper == null) {
|
||||
@ -343,6 +344,22 @@ public class ScoreboardManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static void enablePlayerInspectScoreboard(@NotNull Player player, @NotNull McMMOPlayer targetMcMMOPlayer) {
|
||||
ScoreboardWrapper wrapper = getWrapper(player);
|
||||
|
||||
if(wrapper == null) {
|
||||
setupPlayer(player);
|
||||
wrapper = getWrapper(player);
|
||||
}
|
||||
|
||||
if(wrapper != null) {
|
||||
wrapper.setOldScoreboard();
|
||||
wrapper.setTypeInspectStats(targetMcMMOPlayer);
|
||||
|
||||
changeScoreboard(wrapper, Config.getInstance().getInspectScoreboardTime());
|
||||
}
|
||||
}
|
||||
|
||||
public static void enablePlayerCooldownScoreboard(Player player) {
|
||||
ScoreboardWrapper wrapper = getWrapper(player);
|
||||
|
||||
|
@ -25,6 +25,7 @@ import org.bukkit.scoreboard.DisplaySlot;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
import org.bukkit.scoreboard.Score;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -322,6 +323,17 @@ public class ScoreboardWrapper {
|
||||
loadObjective(LocaleLoader.getString("Scoreboard.Header.PlayerInspect", targetPlayer));
|
||||
}
|
||||
|
||||
public void setTypeInspectStats(@NotNull McMMOPlayer mcMMOPlayer) {
|
||||
this.sidebarType = SidebarType.STATS_BOARD;
|
||||
targetPlayer = mcMMOPlayer.getPlayer().getName();
|
||||
targetProfile = mcMMOPlayer.getProfile();
|
||||
|
||||
targetSkill = null;
|
||||
leaderboardPage = -1;
|
||||
|
||||
loadObjective(LocaleLoader.getString("Scoreboard.Header.PlayerInspect", targetPlayer));
|
||||
}
|
||||
|
||||
public void setTypeCooldowns() {
|
||||
this.sidebarType = SidebarType.COOLDOWNS_BOARD;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user