mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-04-25 07:59:44 +00:00
/Vanish no longer broadcasts user activity on PlayerCommandPreProcessEvent.
Implement more hard coded customizability with commands that shouldn't broadcast afk activity on PlayerCommandPreProcessEvent.
This commit is contained in:
parent
9f75f1aad3
commit
38c8a8e666
1 changed files with 19 additions and 3 deletions
|
@ -9,6 +9,7 @@ import net.ess3.api.IEssentials;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.command.PluginCommand;
|
||||||
import org.bukkit.entity.HumanEntity;
|
import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
@ -381,9 +382,24 @@ public class EssentialsPlayerListener implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!cmd.equalsIgnoreCase("afk")) {
|
} else {
|
||||||
final User user = ess.getUser(player);
|
boolean broadcast = true; // whether to broadcast the updated activity
|
||||||
user.updateActivity(true);
|
boolean update = true; // Only modified when the command is afk
|
||||||
|
|
||||||
|
PluginCommand pluginCommand = ess.getServer().getPluginCommand(cmd);
|
||||||
|
if (pluginCommand != null) {
|
||||||
|
// Switch case for commands that shouldn't broadcast afk activity.
|
||||||
|
switch (pluginCommand.getName()) {
|
||||||
|
case "afk":
|
||||||
|
update = false;
|
||||||
|
case "vanish":
|
||||||
|
broadcast = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (update) {
|
||||||
|
final User user = ess.getUser(player);
|
||||||
|
user.updateActivity(broadcast);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue