mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Adds Something that is missing
Adds Futil.strictcolorize (that filters Banned colors on smite and gtfo) Adds Actual Server-TFM features Adds Wipewarps adds wipecoreprotectdata adds spectator adds rainbownick adds rainbowtag
This commit is contained in:
parent
489bbf4fc9
commit
2443d3eaca
3
.gitignore
vendored
3
.gitignore
vendored
@ -32,3 +32,6 @@ manifest.mf
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
src/main/java/me/totalfreedom/totalfreedommod/command/Command_pvpspy.java
|
||||
src/main/java/me/totalfreedom/totalfreedommod/util/EnchantManager.java
|
||||
src/main/java/me/totalfreedom/totalfreedommod/command/Command_enchant.java
|
||||
|
@ -68,7 +68,7 @@ public class Command_blockcmd extends FreedomCommand
|
||||
|
||||
if (isAdmin(player))
|
||||
{
|
||||
msg(player.getName() + " is an admin, and cannot have their commands blocked.");
|
||||
msg(player.getName() + " is a Superadmin, and cannot have their commands blocked.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ public class Command_blockedit extends FreedomCommand
|
||||
return false;
|
||||
}
|
||||
if (args[0].equals("list")) {
|
||||
this.msg("Block edits blocked for players:");
|
||||
this.msg("Blocked block edits players:");
|
||||
int count = 0;
|
||||
for (final Player mp : this.server.getOnlinePlayers()) {
|
||||
final FPlayer info = ((TotalFreedomMod)this.plugin).pl.getPlayer(mp);
|
||||
@ -51,7 +51,7 @@ public class Command_blockedit extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("all")) {
|
||||
FUtil.adminAction(sender.getName(), "Blocking block edits for all non-admins.", true);
|
||||
FUtil.adminAction(sender.getName(), "Blocking block edits for all non-Superadmins", true);
|
||||
int counter = 0;
|
||||
for (final Player player : this.server.getOnlinePlayers()) {
|
||||
if (!((TotalFreedomMod)this.plugin).al.isAdmin((CommandSender)player)) {
|
||||
@ -60,7 +60,7 @@ public class Command_blockedit extends FreedomCommand
|
||||
++counter;
|
||||
}
|
||||
}
|
||||
this.msg("Blocked block edits for " + counter + " players.");
|
||||
this.msg("Blocked all block edit for " + counter + " players.");
|
||||
return true;
|
||||
}
|
||||
final boolean smite = args[0].equals("-s");
|
||||
@ -81,14 +81,14 @@ public class Command_blockedit extends FreedomCommand
|
||||
}
|
||||
final FPlayer playerdata2 = ((TotalFreedomMod)this.plugin).pl.getPlayer(player2);
|
||||
if (playerdata2.isEditBlock()) {
|
||||
FUtil.adminAction(sender.getName(), "Unblocking block edits for " + player2.getName(), true);
|
||||
FUtil.adminAction(sender.getName(), "Unblocking all block edits for " + player2.getName(), true);
|
||||
playerdata2.setEditBlocked(false);
|
||||
this.msg("Unblocking block edits for " + player2.getName());
|
||||
this.msg((CommandSender)player2, "Your block edits have been unblocked.", ChatColor.RED);
|
||||
this.msg("Unblocking all block edits for " + player2.getName());
|
||||
this.msg((CommandSender)player2, "You block edits have been unblocked.", ChatColor.RED);
|
||||
}
|
||||
else {
|
||||
if (((TotalFreedomMod)this.plugin).al.isAdmin((CommandSender)player2)) {
|
||||
this.msg(player2.getName() + " is an admin, and cannot have their block edits blocked.");
|
||||
this.msg(player2.getName() + " is a superadmin, and his block edits can't be blocked .");
|
||||
return true;
|
||||
}
|
||||
FUtil.adminAction(sender.getName(), "Blocking block edits for " + player2.getName(), true);
|
||||
@ -97,10 +97,10 @@ public class Command_blockedit extends FreedomCommand
|
||||
Command_smite.smite(player2, sender);
|
||||
}
|
||||
if (reason != null) {
|
||||
this.msg((CommandSender)player2, "Your block edits have been blocked. Reason: " + reason, ChatColor.RED);
|
||||
this.msg((CommandSender)player2, "You block edits have been blocked. Reason: " + reason, ChatColor.RED);
|
||||
}
|
||||
else {
|
||||
this.msg((CommandSender)player2, "Your block edits have been blocked.", ChatColor.RED);
|
||||
this.msg((CommandSender)player2, "You block edits have been blocked.", ChatColor.RED);
|
||||
}
|
||||
this.msg("Blocked all block edits for " + player2.getName());
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class Command_blockpvp extends FreedomCommand
|
||||
return false;
|
||||
}
|
||||
if (args[0].equals("list")) {
|
||||
this.msg("PVP is blocked for players:");
|
||||
this.msg("Disabled PVP mode players:");
|
||||
int count = 0;
|
||||
for (final Player mp : this.server.getOnlinePlayers()) {
|
||||
final FPlayer info = ((TotalFreedomMod)this.plugin).pl.getPlayer(mp);
|
||||
@ -38,7 +38,7 @@ public class Command_blockpvp extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("purge")) {
|
||||
FUtil.adminAction(sender.getName(), "Enabling PVP for all players.", true);
|
||||
FUtil.adminAction(sender.getName(), "Enabling PVP mode for all players.", true);
|
||||
int count = 0;
|
||||
for (final Player mp : this.server.getOnlinePlayers()) {
|
||||
final FPlayer info = ((TotalFreedomMod)this.plugin).pl.getPlayer(mp);
|
||||
@ -47,11 +47,11 @@ public class Command_blockpvp extends FreedomCommand
|
||||
++count;
|
||||
}
|
||||
}
|
||||
this.msg("Enabled PVP for " + count + " players.");
|
||||
this.msg("Enabling PVP mode for " + count + " players.");
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("all")) {
|
||||
FUtil.adminAction(sender.getName(), "Disabling PVP for all non-admins", true);
|
||||
FUtil.adminAction(sender.getName(), "Disabling PVP mode for all non-Superadmins", true);
|
||||
int counter = 0;
|
||||
for (final Player player : this.server.getOnlinePlayers()) {
|
||||
if (!((TotalFreedomMod)this.plugin).al.isAdmin((CommandSender)player)) {
|
||||
@ -60,7 +60,7 @@ public class Command_blockpvp extends FreedomCommand
|
||||
++counter;
|
||||
}
|
||||
}
|
||||
this.msg("Disabling PVP for " + counter + " players.");
|
||||
this.msg("Disabling PVP mode for " + counter + " players.");
|
||||
return true;
|
||||
}
|
||||
final boolean smite = args[0].equals("-s");
|
||||
@ -81,28 +81,28 @@ public class Command_blockpvp extends FreedomCommand
|
||||
}
|
||||
final FPlayer playerdata2 = ((TotalFreedomMod)this.plugin).pl.getPlayer(player2);
|
||||
if (playerdata2.isPVPBlock()) {
|
||||
FUtil.adminAction(sender.getName(), "Enabling PVP for " + player2.getName(), true);
|
||||
FUtil.adminAction(sender.getName(), "Enabling PVP mode for " + player2.getName(), true);
|
||||
playerdata2.setPVPBlock(false);
|
||||
this.msg("Enabling PVP for " + player2.getName());
|
||||
this.msg((CommandSender)player2, "Your PVP have been enabled.", ChatColor.GREEN);
|
||||
this.msg("Enabling PVP mode for " + player2.getName());
|
||||
this.msg((CommandSender)player2, "Your PVP mode have been enabled.", ChatColor.GREEN);
|
||||
}
|
||||
else {
|
||||
if (((TotalFreedomMod)this.plugin).al.isAdmin((CommandSender)player2)) {
|
||||
this.msg(player2.getName() + " is an admin, and his PVP cannot be disabled.");
|
||||
this.msg(player2.getName() + " is a superadmin, and his PVP mode can't be disabled.");
|
||||
return true;
|
||||
}
|
||||
FUtil.adminAction(sender.getName(), "Disabling PVP for " + player2.getName(), true);
|
||||
FUtil.adminAction(sender.getName(), "Disabling PVP mode for " + player2.getName(), true);
|
||||
playerdata2.setPVPBlock(true);
|
||||
if (smite) {
|
||||
Command_smite.smite(player2, sender);
|
||||
}
|
||||
if (reason != null) {
|
||||
this.msg((CommandSender)player2, "Your PVP has been disabled. Reason: " + reason, ChatColor.RED);
|
||||
this.msg((CommandSender)player2, "Your PVP Mode has been disabled. Reason: " + reason, ChatColor.RED);
|
||||
}
|
||||
else {
|
||||
this.msg((CommandSender)player2, "Your PVP has been disabled.", ChatColor.RED);
|
||||
this.msg((CommandSender)player2, "Your PVP Mode has been disabled.", ChatColor.RED);
|
||||
}
|
||||
this.msg("Disabled PVP for " + player2.getName());
|
||||
this.msg("Disabled PVP mode for " + player2.getName());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Place a cage around someone.", usage = "/<command> <purge | off | <partialname> [skull | block] [blockname | skullname]")
|
||||
@CommandParameters(description = "Place a cage around someone.", usage = "/<command> <purge | off | <partialname> [custom | block] [Block name | Player name(for skull)]")
|
||||
public class Command_cage extends FreedomCommand
|
||||
{
|
||||
public static String playerSkullName;
|
||||
@ -52,7 +52,7 @@ public class Command_cage extends FreedomCommand
|
||||
playerdata3.getCageData().setCaged(false);
|
||||
return true;
|
||||
}
|
||||
case "skull": {
|
||||
case "custom": {
|
||||
outerMaterial = Material.SKULL;
|
||||
Command_cage.playerSkullName = args[2];
|
||||
break;
|
||||
|
@ -24,7 +24,7 @@ public class Command_disguisetoggle extends FreedomCommand
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), (DisallowedDisguises.disabled ? "Enabling" : "Disabling") + " " +
|
||||
"disguises.", false);
|
||||
"Disguises", false);
|
||||
|
||||
if (plugin.ldb.isDisguisesEnabled())
|
||||
{
|
||||
|
@ -59,9 +59,16 @@ public class Command_gtfo extends FreedomCommand
|
||||
plugin.rb.rollback(player.getName());
|
||||
|
||||
}
|
||||
else
|
||||
|
||||
if (getServer().getPluginManager().isPluginEnabled("CoreProtect"))
|
||||
{
|
||||
plugin.cpb.rollback(player.getName());
|
||||
try
|
||||
{
|
||||
server.dispatchCommand(sender, "co rollback t:1d r:#global #silent u:" + player.getName());
|
||||
}
|
||||
catch (NoClassDefFoundError ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// Deop
|
||||
@ -95,7 +102,7 @@ public class Command_gtfo extends FreedomCommand
|
||||
.append(ip);
|
||||
if (reason != null)
|
||||
{
|
||||
bcast.append(" - Reason: ").append(ChatColor.YELLOW).append(FUtil.colorize(reason));
|
||||
bcast.append(" - Reason: ").append(ChatColor.YELLOW).append(FUtil.StrictColorize(reason));
|
||||
}
|
||||
FUtil.bcastMsg(bcast.toString());
|
||||
|
||||
|
@ -0,0 +1,68 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.Iterator;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Essentials Interface Command - Rainbowify your nickname.", usage = "/<command> <<nick> | off>")
|
||||
public class Command_rainbownick extends FreedomCommand
|
||||
{
|
||||
|
||||
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ("off".equals(args[0]))
|
||||
{
|
||||
((TotalFreedomMod) this.plugin).esb.setNickname(sender.getName(), null);
|
||||
this.msg("Nickname cleared.");
|
||||
return true;
|
||||
}
|
||||
|
||||
final String nickPlain = ChatColor.stripColor(FUtil.colorize(args[0].trim()));
|
||||
|
||||
if (!nickPlain.matches("^[a-zA-Z_0-9" + ChatColor.COLOR_CHAR + "]+$"))
|
||||
{
|
||||
msg("That nickname contains invalid characters.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (nickPlain.length() < 4 || nickPlain.length() > 30)
|
||||
{
|
||||
this.msg("Your nickname must be between 4 and 30 characters long.");
|
||||
return true;
|
||||
}
|
||||
for (final Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (player == playerSender)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (player.getName().equalsIgnoreCase(nickPlain) || ChatColor.stripColor(player.getDisplayName()).trim().equalsIgnoreCase(nickPlain))
|
||||
{
|
||||
this.msg("That nickname is already in use.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
final StringBuilder newNick = new StringBuilder();
|
||||
final char[] charArray;
|
||||
final char[] chars = charArray = nickPlain.toCharArray();
|
||||
for (final char c : charArray)
|
||||
{
|
||||
newNick.append(FUtil.rainbowChatColor()).append(c);
|
||||
}
|
||||
newNick.append(ChatColor.WHITE);
|
||||
((TotalFreedomMod) this.plugin).esb.setNickname(sender.getName(), newNick.toString());
|
||||
this.msg("Your nickname is now: " + newNick.toString());
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.Arrays;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Gives you a tag with Rainbow", usage = "/<command> <tag>", aliases = "tn")
|
||||
public class Command_rainbowtag extends FreedomCommand
|
||||
{
|
||||
|
||||
public static final List<String> FORBIDDEN_WORDS = Arrays.asList(new String[]
|
||||
{
|
||||
"admin", "owner", "moderator", "developer", "console", "SRA", "TCA", "SA"
|
||||
});
|
||||
|
||||
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final StringBuilder tag = new StringBuilder();
|
||||
for (final char c : ChatColor.stripColor(FUtil.colorize(StringUtils.join((Object[]) args, " "))).toCharArray())
|
||||
{
|
||||
tag.append(FUtil.rainbowChatColor()).append(c);
|
||||
}
|
||||
final String tagStr = tag.toString();
|
||||
for (final String word : FORBIDDEN_WORDS)
|
||||
{
|
||||
if (tagStr.contains(word))
|
||||
{
|
||||
this.msg("That tag contains a forbidden word.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
final FPlayer data = ((TotalFreedomMod) this.plugin).pl.getPlayer(playerSender);
|
||||
data.setTag(tagStr);
|
||||
this.msg("Set tag to " + (Object) tag);
|
||||
return true;
|
||||
}
|
||||
}
|
@ -16,73 +16,58 @@ import org.bukkit.entity.Player;
|
||||
public class Command_smite extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
final Player player = this.getPlayer(args[0]);
|
||||
String reason = null;
|
||||
if (args.length > 1)
|
||||
{
|
||||
reason = StringUtils.join(args, " ", 1, args.length);
|
||||
reason = StringUtils.join((Object[]) args, " ", 1, args.length);
|
||||
}
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
msg(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
this.msg(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
smite(player, reason);
|
||||
smite(player, sender, reason);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void smite(Player player)
|
||||
public static void smite(final Player player, final CommandSender sender)
|
||||
{
|
||||
smite(player, null);
|
||||
smite(player, sender, null);
|
||||
}
|
||||
|
||||
public static void smite(Player player, String reason)
|
||||
public static void smite(final Player player, final CommandSender sender, final String reason)
|
||||
{
|
||||
FUtil.bcastMsg(player.getName() + " has been a naughty, naughty boy.", ChatColor.RED);
|
||||
|
||||
if (reason != null)
|
||||
{
|
||||
FUtil.bcastMsg(" Reason: " + reason, ChatColor.YELLOW);
|
||||
FUtil.bcastMsg(ChatColor.RED + " Reason: " + ChatColor.YELLOW + FUtil.StrictColorize(reason));
|
||||
}
|
||||
|
||||
// Deop
|
||||
FUtil.bcastMsg(ChatColor.RED + " Smitten by: " + ChatColor.YELLOW + sender.getName());
|
||||
player.setOp(false);
|
||||
|
||||
// Set gamemode to survival
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
|
||||
// Clear inventory
|
||||
player.getInventory().clear();
|
||||
|
||||
// Strike with lightning effect
|
||||
final Location targetPos = player.getLocation();
|
||||
final World world = player.getWorld();
|
||||
for (int x = -1; x <= 1; x++)
|
||||
for (int x = -1; x <= 1; ++x)
|
||||
{
|
||||
for (int z = -1; z <= 1; z++)
|
||||
for (int z = -1; z <= 1; ++z)
|
||||
{
|
||||
final Location strike_pos = new Location(world, targetPos.getBlockX() + x, targetPos.getBlockY(), targetPos.getBlockZ() + z);
|
||||
world.strikeLightning(strike_pos);
|
||||
final Location strike_pos = new Location(world, (double) (targetPos.getBlockX() + x), (double) targetPos.getBlockY(), (double) (targetPos.getBlockZ() + z));
|
||||
world.strikeLightningEffect(strike_pos);
|
||||
}
|
||||
}
|
||||
|
||||
// Kill
|
||||
player.setHealth(0.0);
|
||||
|
||||
player.sendMessage(ChatColor.RED + "You've been smitten by: " + ChatColor.YELLOW + sender.getName());
|
||||
if (reason != null)
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "You've been smitten. Reason: " + ChatColor.YELLOW + reason);
|
||||
player.sendMessage(ChatColor.RED + "Reason: " + ChatColor.YELLOW + FUtil.StrictColorize(reason));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
|
||||
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Quickly change your own gamemode to spectator.", usage = "/<command>", aliases = "gmsp")
|
||||
public class Command_spectator extends FreedomCommand
|
||||
{
|
||||
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole) {
|
||||
if (args.length == 0) {
|
||||
if (this.isConsole()) {
|
||||
sender.sendMessage("When used from the console, you must define a target player.");
|
||||
return true;
|
||||
}
|
||||
playerSender.setGameMode(GameMode.SPECTATOR);
|
||||
this.msg("Gamemode set to spectator.");
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
this.checkRank(Rank.SUPER_ADMIN);
|
||||
final Player player = this.getPlayer(args[0]);
|
||||
if (player == null) {
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
this.msg("Setting " + player.getName() + " to game mode spectator");
|
||||
this.msg((CommandSender)player, sender.getName() + " set your game mode to spectator");
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -130,7 +130,7 @@ public class Command_stfu extends FreedomCommand
|
||||
|
||||
if (smite)
|
||||
{
|
||||
Command_smite.smite(player);
|
||||
Command_smite.smite(player, sender);
|
||||
}
|
||||
|
||||
if (reason != null)
|
||||
|
@ -18,7 +18,7 @@ public class Command_tag extends FreedomCommand
|
||||
|
||||
public static final List<String> FORBIDDEN_WORDS = Arrays.asList(new String[]
|
||||
{
|
||||
"admin", "owner", "moderator", "developer", "console"
|
||||
"admin", "owner", "moderator", "developer", "console", "SRA", "TCA", "SA"
|
||||
});
|
||||
|
||||
@Override
|
||||
|
@ -1,5 +1,7 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
@ -13,6 +15,11 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Gives you a tag with random colors", usage = "/<command> <tag>", aliases = "tn")
|
||||
public class Command_tagnyan extends FreedomCommand
|
||||
{
|
||||
|
||||
public static final List<String> FORBIDDEN_WORDS = Arrays.asList(new String[]
|
||||
{
|
||||
"admin", "owner", "moderator", "developer", "console", "SRA", "TCA", "SA"
|
||||
});
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
|
@ -48,7 +48,7 @@ public class Command_tban extends FreedomCommand
|
||||
for (int z = -1; z <= 1; z++)
|
||||
{
|
||||
final Location strike_pos = new Location(targetPos.getWorld(), targetPos.getBlockX() + x, targetPos.getBlockY(), targetPos.getBlockZ() + z);
|
||||
targetPos.getWorld().strikeLightning(strike_pos);
|
||||
targetPos.getWorld().strikeLightningEffect(strike_pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class Command_tempban extends FreedomCommand
|
||||
for (int z = -1; z <= 1; z++)
|
||||
{
|
||||
final Location strike_pos = new Location(targetPos.getWorld(), targetPos.getBlockX() + x, targetPos.getBlockY(), targetPos.getBlockZ() + z);
|
||||
targetPos.getWorld().strikeLightning(strike_pos);
|
||||
targetPos.getWorld().strikeLightningEffect(strike_pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.GameRuleHandler;
|
||||
import me.totalfreedom.totalfreedommod.GameRuleHandler.GameRule;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
@ -25,6 +27,8 @@ public class Command_toggle extends FreedomCommand
|
||||
msg("- fluidspread");
|
||||
msg("- lavadmg");
|
||||
msg("- firespread");
|
||||
msg("- frostwalk");
|
||||
msg("- firework");
|
||||
msg("- prelog");
|
||||
msg("- lockdown");
|
||||
msg("- petprotect");
|
||||
@ -34,133 +38,103 @@ public class Command_toggle extends FreedomCommand
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equals("waterplace"))
|
||||
{
|
||||
toggle("Water placement is", ConfigEntry.ALLOW_WATER_PLACE);
|
||||
if (args[0].equals("waterplace")) {
|
||||
this.toggle("Water placement is", ConfigEntry.ALLOW_WATER_PLACE);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("fireplace"))
|
||||
{
|
||||
toggle("Fire placement is", ConfigEntry.ALLOW_FIRE_PLACE);
|
||||
if (args[0].equals("frostwalk")) {
|
||||
this.toggle("Frost walker enchantment is ", ConfigEntry.ALLOW_FROSTWALKER);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("lavaplace"))
|
||||
{
|
||||
toggle("Lava placement is", ConfigEntry.ALLOW_LAVA_PLACE);
|
||||
if (args[0].equals("fireplace")) {
|
||||
this.toggle("Fire placement is", ConfigEntry.ALLOW_FIRE_PLACE);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("fluidspread"))
|
||||
if (args[0].equals("lavaplace")) {
|
||||
this.toggle("Lava placement is", ConfigEntry.ALLOW_LAVA_PLACE);
|
||||
return true;
|
||||
}
|
||||
/*if (args[0].equals("explosivearrows"))
|
||||
{
|
||||
toggle("Fluid spread is", ConfigEntry.ALLOW_FLUID_SPREAD);
|
||||
toggle("Explosive arrows are now", ConfigEntry.MAKE_ARROW_EXPLOSIVE);
|
||||
return true;
|
||||
}*/
|
||||
if (args[0].equals("fluidspread")) {
|
||||
this.toggle("Fluid spread is", ConfigEntry.ALLOW_FLUID_SPREAD);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("lavadmg"))
|
||||
{
|
||||
toggle("Lava damage is", ConfigEntry.ALLOW_LAVA_DAMAGE);
|
||||
if (args[0].equals("lavadmg")) {
|
||||
this.toggle("Lava damage is", ConfigEntry.ALLOW_LAVA_DAMAGE);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("firespread"))
|
||||
{
|
||||
toggle("Fire spread is", ConfigEntry.ALLOW_FIRE_SPREAD);
|
||||
plugin.gr.setGameRule(GameRule.DO_FIRE_TICK, ConfigEntry.ALLOW_FIRE_SPREAD.getBoolean());
|
||||
if (args[0].equals("firespread")) {
|
||||
this.toggle("Fire spread is", ConfigEntry.ALLOW_FIRE_SPREAD);
|
||||
((TotalFreedomMod)this.plugin).gr.setGameRule(GameRuleHandler.GameRule.DO_FIRE_TICK, ConfigEntry.ALLOW_FIRE_SPREAD.getBoolean());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("prelog"))
|
||||
{
|
||||
toggle("Command prelogging is", ConfigEntry.ENABLE_PREPROCESS_LOG);
|
||||
if (args[0].equals("prelog")) {
|
||||
this.toggle("Command prelogging is", ConfigEntry.ENABLE_PREPROCESS_LOG);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("lockdown"))
|
||||
{
|
||||
boolean active = !plugin.lp.isLockdownEnabled();
|
||||
plugin.lp.setLockdownEnabled(active);
|
||||
|
||||
if (args[0].equals("lockdown")) {
|
||||
final boolean active = !((TotalFreedomMod)this.plugin).lp.isLockdownEnabled();
|
||||
((TotalFreedomMod)this.plugin).lp.setLockdownEnabled(active);
|
||||
FUtil.adminAction(sender.getName(), (active ? "A" : "De-a") + "ctivating server lockdown", true);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("petprotect"))
|
||||
{
|
||||
toggle("Tamed pet protection is", ConfigEntry.ENABLE_PET_PROTECT);
|
||||
if (args[0].equals("petprotect")) {
|
||||
this.toggle("Tamed pet protection is", ConfigEntry.ENABLE_PET_PROTECT);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("entitywipe"))
|
||||
{
|
||||
toggle("Automatic entity wiping is", ConfigEntry.AUTO_ENTITY_WIPE);
|
||||
if (args[0].equals("entitywipe")) {
|
||||
this.toggle("Automatic entity wiping is", ConfigEntry.AUTO_ENTITY_WIPE);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("nonuke"))
|
||||
{
|
||||
if (args.length >= 2)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (args[0].equals("firework")) {
|
||||
this.toggle("Firework explosion is", ConfigEntry.ALLOW_FIREWORK_EXPLOSION);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("nonuke")) {
|
||||
if (args.length >= 2) {
|
||||
try {
|
||||
ConfigEntry.NUKE_MONITOR_RANGE.setDouble(Math.max(1.0, Math.min(500.0, Double.parseDouble(args[1]))));
|
||||
}
|
||||
catch (NumberFormatException nfex)
|
||||
{
|
||||
}
|
||||
catch (NumberFormatException ex2) {}
|
||||
}
|
||||
|
||||
if (args.length >= 3)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (args.length >= 3) {
|
||||
try {
|
||||
ConfigEntry.NUKE_MONITOR_COUNT_BREAK.setInteger(Math.max(1, Math.min(500, Integer.parseInt(args[2]))));
|
||||
}
|
||||
catch (NumberFormatException nfex)
|
||||
{
|
||||
}
|
||||
catch (NumberFormatException ex3) {}
|
||||
}
|
||||
|
||||
toggle("Nuke monitor is", ConfigEntry.NUKE_MONITOR_ENABLED);
|
||||
|
||||
if (ConfigEntry.NUKE_MONITOR_ENABLED.getBoolean())
|
||||
{
|
||||
msg("Anti-freecam range is set to " + ConfigEntry.NUKE_MONITOR_RANGE.getDouble() + " blocks.");
|
||||
msg("Block throttle rate is set to " + ConfigEntry.NUKE_MONITOR_COUNT_BREAK.getInteger() + " blocks destroyed per 5 seconds.");
|
||||
this.toggle("Nuke monitor is", ConfigEntry.NUKE_MONITOR_ENABLED);
|
||||
if (ConfigEntry.NUKE_MONITOR_ENABLED.getBoolean()) {
|
||||
this.msg("Anti-freecam range is set to " + ConfigEntry.NUKE_MONITOR_RANGE.getDouble() + " blocks.");
|
||||
this.msg("Block throttle rate is set to " + ConfigEntry.NUKE_MONITOR_COUNT_BREAK.getInteger() + " blocks destroyed per 5 seconds.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("explosives"))
|
||||
{
|
||||
if (args.length == 2)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (args[0].equals("explosives")) {
|
||||
if (args.length == 2) {
|
||||
try {
|
||||
ConfigEntry.EXPLOSIVE_RADIUS.setDouble(Math.max(1.0, Math.min(30.0, Double.parseDouble(args[1]))));
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
msg(ex.getMessage());
|
||||
catch (NumberFormatException ex) {
|
||||
this.msg(ex.getMessage());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
toggle("Explosions are", ConfigEntry.ALLOW_EXPLOSIONS);
|
||||
|
||||
if (ConfigEntry.ALLOW_EXPLOSIONS.getBoolean())
|
||||
{
|
||||
msg("Radius set to " + ConfigEntry.EXPLOSIVE_RADIUS.getDouble());
|
||||
this.toggle("Explosions are", ConfigEntry.ALLOW_EXPLOSIONS);
|
||||
if (ConfigEntry.ALLOW_EXPLOSIONS.getBoolean()) {
|
||||
this.msg("Radius set to " + ConfigEntry.EXPLOSIVE_RADIUS.getDouble());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void toggle(String name, ConfigEntry entry)
|
||||
{
|
||||
msg(name + " now " + (entry.setBoolean(!entry.getBoolean()) ? "enabled." : "disabled."));
|
||||
|
||||
private void toggle(final String name, final ConfigEntry entry) {
|
||||
this.msg(name + " now " + (entry.setBoolean(!entry.getBoolean()) ? "enabled." : "disabled."));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
//import me.libraryaddict.disguise.DisallowedDisguises;
|
||||
import me.libraryaddict.disguise.DisallowedDisguises;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.command.Command;
|
||||
@ -14,7 +15,7 @@ public class Command_undisguiseall extends FreedomCommand
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{ /*
|
||||
{
|
||||
if (!plugin.ldb.isPluginEnabled())
|
||||
{
|
||||
msg("LibsDisguises is not enabled.");
|
||||
@ -32,10 +33,5 @@ public class Command_undisguiseall extends FreedomCommand
|
||||
plugin.ldb.undisguiseAll(false);
|
||||
|
||||
return true;
|
||||
|
||||
*/
|
||||
|
||||
msg("This command has been disabled for technical reasons. Contact a developer for additional information.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,10 @@ package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.command.CommandParameters;
|
||||
import me.totalfreedom.totalfreedommod.command.CommandPermissions;
|
||||
import me.totalfreedom.totalfreedommod.command.FreedomCommand;
|
||||
import me.totalfreedom.totalfreedommod.command.SourceType;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -0,0 +1,31 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
@CommandPermissions(level = Rank.TELNET_ADMIN, source = SourceType.ONLY_CONSOLE)
|
||||
@CommandParameters(description = "Wipes the CoreProtect data for the flatlands", usage = "/<command>")
|
||||
public class Command_wipecoreprotectdata extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(final CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Wiping CoreProtect data for the flatlands", true);
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
plugin.cpb.clearDatabase(plugin.wm.flatlands.getWorld());
|
||||
}
|
||||
}.runTaskAsynchronously(plugin);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
||||
@CommandParameters(description = "Wipe the flatlands map. Requires manual restart after command is used.", usage = "/<command>")
|
||||
@ -24,8 +25,22 @@ public class Command_wipeflatlands extends FreedomCommand
|
||||
player.kickPlayer("Server is going offline for flatlands wipe, come back in a few minutes.");
|
||||
}
|
||||
|
||||
server.shutdown();
|
||||
if (!plugin.cpb.isEnabled())
|
||||
{
|
||||
server.shutdown();
|
||||
}
|
||||
else
|
||||
{
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
plugin.cpb.clearDatabase(plugin.wm.flatlands.getWorld(), true);
|
||||
}
|
||||
}.runTaskAsynchronously(plugin);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import com.sk89q.worldguard.bukkit.RegionContainer;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
import java.util.Map;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
@CommandPermissions(level = Rank.TELNET_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Wipe all WorldGuard regions for a specified world.", usage = "/<command> <world>", aliases = "wiperegions")
|
||||
public class Command_wiperegions extends FreedomCommand
|
||||
{
|
||||
|
||||
public WorldGuardPlugin getWorldGuard()
|
||||
{
|
||||
Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
|
||||
|
||||
if (plugin == null || !(plugin instanceof WorldGuardPlugin))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return (WorldGuardPlugin) plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (getWorldGuard() == null)
|
||||
{
|
||||
msg("WorldGuard is not installed.", ChatColor.GRAY);
|
||||
return true;
|
||||
}
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
World world = server.getWorld(args[0]);
|
||||
if (world == null)
|
||||
{
|
||||
msg("World : \"" + args[0] + "\" not found.", ChatColor.GRAY);
|
||||
return true;
|
||||
}
|
||||
if (world.equals(plugin.wm.adminworld.getWorld()) && !plugin.rm.getRank(sender).isAtLeast(Rank.SENIOR_ADMIN))
|
||||
{
|
||||
msg("You do not have permission to wipe adminworld.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
RegionContainer container = getWorldGuard().getRegionContainer();
|
||||
RegionManager rm = container.get(world);
|
||||
if (rm != null)
|
||||
{
|
||||
Map<String, ProtectedRegion> regions = rm.getRegions();
|
||||
for (ProtectedRegion region : regions.values())
|
||||
{
|
||||
rm.removeRegion(region.getId());
|
||||
}
|
||||
FUtil.adminAction(sender.getName(), "Wiping regions for world: " + world.getName(), true);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
msg(ChatColor.RED + "No regions have been found for world: \"" + world.getName() + "\".");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,8 +1,12 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import static org.bukkit.Bukkit.getServer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -21,11 +25,24 @@ public class Command_wipeuserdata extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Wiping Essentials playerdata", true);
|
||||
FUtil.adminAction(sender.getName(), "Wiping Essentials and Worlds playerdata", true);
|
||||
|
||||
FUtil.deleteFolder(new File(server.getPluginManager().getPlugin("Essentials").getDataFolder(), "userdata"));
|
||||
for (World w : Bukkit.getWorlds())
|
||||
{
|
||||
if (w.getName().equals(plugin.wm.adminworld.getWorld()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
msg("All playerdata deleted.");
|
||||
return true;
|
||||
FUtil.deleteFolder(new File(server.getPluginManager().getPlugin("Essentials").getDataFolder(), "userdata"));
|
||||
FUtil.deleteFolder(new File(Bukkit.getServer().getWorld(plugin.wm.flatlands.getName()).getWorldFolder().getName() + "playerdata"));
|
||||
FUtil.deleteFolder(new File(Bukkit.getServer().getWorld(plugin.wm.flatlands.getName()).getWorldFolder().getName() + "stats"));
|
||||
FUtil.deleteFolder(new File(Bukkit.getServer().getWorld(w.getName()).getWorldFolder().getName() + "stats"));
|
||||
FUtil.deleteFolder(new File(Bukkit.getServer().getWorld(w.getName()).getWorldFolder().getName() + "playerdata"));
|
||||
|
||||
msg("All playerdata deleted.");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,35 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.io.File;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
||||
@CommandParameters(description = "Removes essentials warps", usage = "/<command>")
|
||||
public class Command_wipewarps extends FreedomCommand
|
||||
{
|
||||
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!server.getPluginManager().isPluginEnabled("Essentials"))
|
||||
{
|
||||
msg("Essentials is not enabled on this server");
|
||||
return true;
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Wiping Essentials Warps", true);
|
||||
|
||||
FUtil.deleteFolder(new File(server.getPluginManager().getPlugin("Essentials").getDataFolder(), "warps"));
|
||||
|
||||
server.dispatchCommand(sender, "plc reload essentials");
|
||||
|
||||
msg("All warps deleted.");
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
@ -134,6 +134,11 @@ public abstract class FreedomCommand extends AbstractCommandBase<TotalFreedomMod
|
||||
msg(sender, message, ChatColor.GRAY);
|
||||
}
|
||||
|
||||
public CommandParameters getParams()
|
||||
{
|
||||
return this.params;
|
||||
}
|
||||
|
||||
protected void msg(final String message)
|
||||
{
|
||||
msg(sender, message);
|
||||
@ -159,6 +164,11 @@ public abstract class FreedomCommand extends AbstractCommandBase<TotalFreedomMod
|
||||
return plugin.pl.getData(player);
|
||||
}
|
||||
|
||||
public CommandPermissions getPerms()
|
||||
{
|
||||
return this.perms;
|
||||
}
|
||||
|
||||
public static FreedomCommand getFrom(Command command)
|
||||
{
|
||||
try
|
||||
|
@ -45,8 +45,16 @@ public class FUtil
|
||||
public static final List<ChatColor> CHAT_COLOR_POOL;
|
||||
public static final List<ChatColor> CHAT_RAINBOW;
|
||||
private static Iterator<ChatColor> color;
|
||||
|
||||
static {
|
||||
private static final ChatColor[] BLOCKED = new ChatColor[]
|
||||
{
|
||||
ChatColor.MAGIC,
|
||||
ChatColor.STRIKETHROUGH,
|
||||
ChatColor.ITALIC,
|
||||
ChatColor.UNDERLINE,
|
||||
ChatColor.BLACK
|
||||
};
|
||||
|
||||
static {
|
||||
RANDOM = new Random();
|
||||
DEVELOPERS = Arrays.asList("Madgeek1450", "Prozza", "WickedGamingUK", "aggelosQQ", "OxLemonxO", "Commodore64x", "Wild1145", "marcocorriero");
|
||||
FOUNDER = Arrays.asList("markbyron");
|
||||
@ -64,9 +72,10 @@ public class FUtil
|
||||
}
|
||||
FUtil.color = FUtil.CHAT_RAINBOW.iterator();
|
||||
}
|
||||
|
||||
private static final Pattern REGEX = Pattern.compile(ChatColor.COLOR_CHAR + "[" + StringUtils.join(BLOCKED, "") + "]", Pattern.CASE_INSENSITIVE);
|
||||
|
||||
private FUtil()
|
||||
|
||||
private FUtil()
|
||||
{
|
||||
}
|
||||
|
||||
@ -389,6 +398,22 @@ private FUtil()
|
||||
return ChatColor.translateAlternateColorCodes('&', string);
|
||||
}
|
||||
|
||||
public static String StrictColorize(String string)
|
||||
{
|
||||
String string2 = ChatColor.translateAlternateColorCodes('&', string);
|
||||
final Matcher matcher = REGEX.matcher(string2);
|
||||
if (matcher.find())
|
||||
{
|
||||
final String filteredcolorize = matcher.replaceAll("&");
|
||||
if(matcher.find(REGEX.matcher(ChatColor.BLACK)))
|
||||
return filteredcolorize;
|
||||
}
|
||||
else
|
||||
{
|
||||
return string2;
|
||||
}
|
||||
}
|
||||
|
||||
public static Date getUnixDate(long unix)
|
||||
{
|
||||
return new Date(unix * 1000);
|
||||
|
Loading…
Reference in New Issue
Block a user