mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-30 02:05:41 +00:00
Hotfix to potion spy
Note to self: don't do crack cocain when you code, this will actually announce the potion splashes to admins (also fixed a spell issue).
This commit is contained in:
parent
5401cc5dc7
commit
073a618035
@ -22,8 +22,8 @@ import org.bukkit.potion.PotionEffectType;
|
|||||||
public class Monitors extends FreedomService
|
public class Monitors extends FreedomService
|
||||||
{
|
{
|
||||||
@Getter
|
@Getter
|
||||||
private List<Map.Entry<ThrownPotion, Long>> allThrownPotions = new ArrayList<>();
|
private final List<Map.Entry<ThrownPotion, Long>> allThrownPotions = new ArrayList<>();
|
||||||
private Map<Player, List<ThrownPotion>> recentlyThrownPotions = new HashMap<>();
|
private final Map<Player, List<ThrownPotion>> recentlyThrownPotions = new HashMap<>();
|
||||||
private final List<PotionEffectType> badPotionEffects = new ArrayList<>(Arrays.asList(PotionEffectType.BLINDNESS,
|
private final List<PotionEffectType> badPotionEffects = new ArrayList<>(Arrays.asList(PotionEffectType.BLINDNESS,
|
||||||
PotionEffectType.LEVITATION, PotionEffectType.CONFUSION, PotionEffectType.SLOW, PotionEffectType.SLOW_DIGGING, PotionEffectType.HUNGER)); // A list of all effects that count as "troll".
|
PotionEffectType.LEVITATION, PotionEffectType.CONFUSION, PotionEffectType.SLOW, PotionEffectType.SLOW_DIGGING, PotionEffectType.HUNGER)); // A list of all effects that count as "troll".
|
||||||
|
|
||||||
@ -39,19 +39,19 @@ public class Monitors extends FreedomService
|
|||||||
List<ThrownPotion> playerThrownPotions = recentlyThrownPotions.get(player);
|
List<ThrownPotion> playerThrownPotions = recentlyThrownPotions.get(player);
|
||||||
ThrownPotion latestThrownPotion = playerThrownPotions.get(playerThrownPotions.size() - 1); // Get most recently thrown potion for the position.
|
ThrownPotion latestThrownPotion = playerThrownPotions.get(playerThrownPotions.size() - 1); // Get most recently thrown potion for the position.
|
||||||
int potionsThrown = playerThrownPotions.size();
|
int potionsThrown = playerThrownPotions.size();
|
||||||
boolean trollPotions = false;
|
int trollPotions = 0;
|
||||||
|
|
||||||
for (ThrownPotion potion : playerThrownPotions)
|
for (ThrownPotion potion : playerThrownPotions)
|
||||||
{
|
{
|
||||||
if (isTrollPotion(potion))
|
if (isTrollPotion(potion))
|
||||||
{
|
{
|
||||||
trollPotions = true;
|
trollPotions++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FUtil.playerMsg(player, ChatColor.translateAlternateColorCodes('&', String.format("&8[&ePotionSpy&8] &r%s splashed %s %s at X: %s Y: %s Z: %s in the world '%s'%s.",
|
plugin.al.messageAllAdmins(ChatColor.translateAlternateColorCodes('&', String.format("&8[&ePotionSpy&8] &r%s splashed %s %s at X: %s Y: %s Z: %s in the world '%s'%s.",
|
||||||
player.getName(), potionsThrown, potionsThrown == 1 ? "potion" : "potions", latestThrownPotion.getLocation().getBlockX(), latestThrownPotion.getLocation().getBlockY(), latestThrownPotion.getLocation().getBlockZ(),
|
player.getName(), potionsThrown, potionsThrown == 1 ? "potion" : "potions", latestThrownPotion.getLocation().getBlockX(), latestThrownPotion.getLocation().getBlockY(), latestThrownPotion.getLocation().getBlockZ(),
|
||||||
latestThrownPotion.getWorld().getName(), trollPotions ? " &c(most likely troll potion/potions)" : "")));
|
latestThrownPotion.getWorld().getName(), trollPotions > 0 ? String.format(" &c(most likely troll %s)", trollPotions == 1 ? "potion" : "potions") : "")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
recentlyThrownPotions.clear();
|
recentlyThrownPotions.clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user