mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-12-27 20:27:37 +00:00
Fixed Auto-Decaps not working
Added Removal of excessive exclamation marks
This commit is contained in:
parent
fbc8d20fda
commit
488d721a93
@ -325,21 +325,33 @@ public class TFM_PlayerListener implements Listener
|
||||
TFM_Util.playerMsg(p, "Message was shortened because it was too long to send.");
|
||||
}
|
||||
|
||||
// check for caps
|
||||
|
||||
// check for caps and exclamation marks
|
||||
if (message.length() >= 6)
|
||||
{
|
||||
int caps = 0;
|
||||
int excl = 0;
|
||||
for (char c : message.toCharArray())
|
||||
{
|
||||
if (Character.isUpperCase(c))
|
||||
{
|
||||
caps++;
|
||||
}
|
||||
|
||||
if(c == '!')
|
||||
{
|
||||
excl++;
|
||||
}
|
||||
}
|
||||
if (((float) caps / (float) message.length()) > 0.75) //Compute a ratio so that longer sentences can have more caps.
|
||||
if (caps > 6 || caps > 3 && ((float) caps / (float) message.length()) > 0.55)
|
||||
{
|
||||
message = message.toLowerCase();
|
||||
}
|
||||
|
||||
if(excl++ > 3)
|
||||
{
|
||||
message = message.replaceAll("!", "") + '!';
|
||||
}
|
||||
}
|
||||
|
||||
// finally, set message
|
||||
|
@ -15,11 +15,10 @@ import org.bukkit.World;
|
||||
|
||||
public class TFM_ProtectedArea implements Serializable
|
||||
{
|
||||
// Serializable Classes need one of these apperantly
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
public static final double MAX_RADIUS = 50.0D;
|
||||
// Serializable Classes need one of these apperantly
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static final double MAX_RADIUS = 50.0D;
|
||||
private static Map<String, TFM_ProtectedArea> protectedAreas = new HashMap<String, TFM_ProtectedArea>();
|
||||
private final SerializableLocation center_location;
|
||||
private final double radius;
|
||||
|
Loading…
Reference in New Issue
Block a user