Made mentio actually do it's job, removed debug outputs
This commit is contained in:
parent
cd2536afeb
commit
bacf6e0e3b
@ -2,6 +2,7 @@ package com.redstoner.modules.mentio;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -22,7 +23,7 @@ import com.redstoner.misc.Utils;
|
|||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
@AutoRegisterListener
|
@AutoRegisterListener
|
||||||
@Version(major = 1, minor = 0, revision = 1, compatible = 1)
|
@Version(major = 1, minor = 0, revision = 2, compatible = 1)
|
||||||
public class Mentio implements Module, Listener
|
public class Mentio implements Module, Listener
|
||||||
{
|
{
|
||||||
private boolean enabled = false;
|
private boolean enabled = false;
|
||||||
@ -140,7 +141,7 @@ public class Mentio implements Module, Listener
|
|||||||
if (event.getMessage().toLowerCase().contains(mentio.toLowerCase()))
|
if (event.getMessage().toLowerCase().contains(mentio.toLowerCase()))
|
||||||
{
|
{
|
||||||
event.getRecipients().remove(player);
|
event.getRecipients().remove(player);
|
||||||
String temp = event.getMessage().replace(mentio, "§§");
|
String temp = event.getMessage().replaceAll("(?i)" + Pattern.quote(mentio), "§§");
|
||||||
String lastColorCodes = "§r";
|
String lastColorCodes = "§r";
|
||||||
char lastChar = ' ';
|
char lastChar = ' ';
|
||||||
for (char c : temp.toCharArray())
|
for (char c : temp.toCharArray())
|
||||||
@ -155,8 +156,6 @@ public class Mentio implements Module, Listener
|
|||||||
Utils.sendMessage(player, "",
|
Utils.sendMessage(player, "",
|
||||||
event.getFormat().replace("%1$s", event.getPlayer().getDisplayName()).replace("%2$s",
|
event.getFormat().replace("%1$s", event.getPlayer().getDisplayName()).replace("%2$s",
|
||||||
temp.replaceFirst("§§", "§a§o" + mentio + lastColorCodes).replace("§§", mentio)));
|
temp.replaceFirst("§§", "§a§o" + mentio + lastColorCodes).replace("§§", mentio)));
|
||||||
Utils.log(event.getMessage());
|
|
||||||
Utils.log(event.getFormat());
|
|
||||||
player.playSound(player.getLocation(), Sound.ENTITY_CHICKEN_EGG, 1, 1);
|
player.playSound(player.getLocation(), Sound.ENTITY_CHICKEN_EGG, 1, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user