more freedom i guess?

This commit is contained in:
Ivan 2019-12-08 12:41:09 -05:00
parent 93e6361148
commit 5cfb525a1f
5 changed files with 6 additions and 176 deletions

View File

@ -83,16 +83,6 @@ public class AntiSpam extends FreedomService
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
// Check for message repeat
if (playerdata.getLastMessage().equalsIgnoreCase(message))
{
FSync.playerMsg(player, "Please do not repeat messages.");
event.setCancelled(true);
return;
}
playerdata.setLastMessage(message);
} }
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.LOW)

View File

@ -53,23 +53,14 @@ public class ChatManager extends FreedomService
{ {
final Player player = event.getPlayer(); final Player player = event.getPlayer();
String message = event.getMessage().trim(); String message = event.getMessage().trim();
// Format colors
if (plugin.al.isAdmin(player))
{ {
// Format color message = FUtil.colorize(message);
message = message.replaceAll(ChatColor.BOLD.toString(), "&l"); message = message.replaceAll(ChatColor.BOLD.toString(), "&l");
message = message.replaceAll(ChatColor.MAGIC.toString(), "&k");
message = message.replaceAll(ChatColor.ITALIC.toString(), "&o"); message = message.replaceAll(ChatColor.ITALIC.toString(), "&o");
message = message.replaceAll(ChatColor.UNDERLINE.toString(), "&n"); message = message.replaceAll(ChatColor.UNDERLINE.toString(), "&n");
message = message.replaceAll(ChatColor.STRIKETHROUGH.toString(), "&m"); message = message.replaceAll(ChatColor.STRIKETHROUGH.toString(), "&m");
message = FUtil.colorize(message);
} }
else
{
// Strip color from messages
message = ChatColor.stripColor(message);
}
// Truncate messages that are too long - 256 characters is vanilla client max // Truncate messages that are too long - 256 characters is vanilla client max
if (message.length() > 256) if (message.length() > 256)
{ {
@ -77,26 +68,6 @@ public class ChatManager extends FreedomService
FSync.playerMsg(player, "Message was shortened because it was too long to send."); FSync.playerMsg(player, "Message was shortened because it was too long to send.");
} }
// Check for caps
if (message.length() >= 6)
{
int caps = 0;
for (char c : message.toCharArray())
{
if (Character.isUpperCase(c))
{
caps++;
}
}
if (((float)caps / (float)message.length()) > 0.65) //Compute a ratio so that longer sentences can have more caps.
{
if (!plugin.al.isAdmin(player))
{
message = message.toLowerCase();
}
}
}
// Check for adminchat // Check for adminchat
final FPlayer fPlayer = plugin.pl.getPlayerSync(player); final FPlayer fPlayer = plugin.pl.getPlayerSync(player);
if (fPlayer.inAdminChat()) if (fPlayer.inAdminChat())

View File

@ -56,7 +56,9 @@ public class Command_tabcolor extends FreedomCommand
playerSender.setPlayerListName(StringUtils.substring(color + sender.getName(), 0, 16)); playerSender.setPlayerListName(StringUtils.substring(color + sender.getName(), 0, 16));
msg("ok dad"); final String newTabColor = color + ChatColor.stripColor(playerSender.getDisplayName()).trim() + ChatColor.WHITE;
msg("Your tab name will now appear as: " + newTabColor);
return true; return true;
} }

View File

@ -1,133 +0,0 @@
package me.totalfreedom.totalfreedommod.hub;
import java.util.Arrays;
import java.util.List;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.player.PlayerArmorStandManipulateEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent;
public class HubWorldRestrictions extends FreedomService
{
public final List<String> ALLOWED_COMMANDS = Arrays.asList(
"list", "opall", "gmc", "gms", "gma", "gmsp", "purgeall", "stfu", "tempban", "gtfo", "noob", "flatlands", "adminworld", "masterbuilderworld", "world", "nether", "spawn", "tpo", "tp", "expel", "item", "i", "give", "adminchat", "adventure", "creative", "survival", "spectator", "say", "blockcmd", "blockpvp", "blockredstone", "stoplag", "halt-activity", "nickclean", "nick", "nicknyan", "vanish", "verify", "verifynoadmin", "co", "coreprotect", "core", "mobpurge", "logs", "links", "vote", "o", "linkdiscord");
public HubWorldRestrictions(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
{
}
@Override
protected void onStop()
{
}
public boolean doRestrict(Player player)
{
/*if (!FUtil.isExecutive(player.getName()) && player.getWorld().equals(plugin.wm.hubworld.getWorld()))
{
return true;
}
return false;*/
return true;
}
@EventHandler(priority = EventPriority.NORMAL)
public void onBlockPlace(BlockPlaceEvent event)
{
final Player player = event.getPlayer();
if (doRestrict(player))
{
player.sendMessage(ChatColor.RED + "Only Executives can do this in the Hub World!");
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event)
{
final Player player = event.getPlayer();
if (doRestrict(player))
{
player.sendMessage(ChatColor.RED + "Only Executives can do this in the Hub World!");
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerInteract(PlayerInteractEvent event)
{
final Player player = event.getPlayer();
if (doRestrict(player))
{
player.sendMessage(ChatColor.RED + "Only Executives can do this in the Hub World!");
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.NORMAL)
public void onArmorStandManipulate(PlayerArmorStandManipulateEvent event)
{
final Player player = event.getPlayer();
if (doRestrict(player))
{
player.sendMessage(ChatColor.RED + "Only Executives can do this in the Hub World!");
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.NORMAL)
public void onEntityDamageByEntity(EntityDamageByEntityEvent event)
{
if (event.getDamager() instanceof Player)
{
Player player = (Player)event.getDamager();
if (doRestrict(player))
{
player.sendMessage(ChatColor.RED + "Only Executives can do this in the Hub World!");
event.setCancelled(true);
}
}
}
@EventHandler(priority = EventPriority.NORMAL)
public void onCommandPreprocess(PlayerCommandPreprocessEvent event)
{
final Player player = event.getPlayer();
if (doRestrict(player))
{
String command = event.getMessage().split("\\s+")[0].substring(1, event.getMessage().split("\\s+")[0].length()).toLowerCase();
if (ALLOWED_COMMANDS.contains(command))
{
event.setCancelled(false);
}
else if (command.startsWith(""))
{
player.sendMessage(ChatColor.RED + "Only Executives are allowed to execute commands in the Hub World!");
event.setCancelled(true);
}
}
}
}

View File

@ -129,7 +129,7 @@ allow:
frostwalker: false frostwalker: false
unsafe_enchantments: true unsafe_enchantments: true
bells: true bells: true
armorstands: false armorstands: true
minecarts: false minecarts: false
clearonjoin: false clearonjoin: false
tpronjoin: false tpronjoin: false