mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Added /tag
Minor cleanup
This commit is contained in:
parent
696ec119c6
commit
f3ac19a616
@ -1,5 +1,5 @@
|
|||||||
#Sat, 10 Aug 2013 15:43:16 -0400
|
#Mon, 12 Aug 2013 12:25:56 +0200
|
||||||
|
|
||||||
program.VERSION=2.22
|
program.VERSION=2.22
|
||||||
program.BUILDNUM=392
|
program.BUILDNUM=400
|
||||||
program.BUILDDATE=08/10/2013 03\:43 PM
|
program.BUILDDATE=08/12/2013 12\:25 PM
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#Build Number for ANT. Do not edit!
|
#Build Number for ANT. Do not edit!
|
||||||
#Sat Aug 10 15:43:16 EDT 2013
|
#Mon Aug 12 12:25:56 CEST 2013
|
||||||
build.number=393
|
build.number=401
|
||||||
|
@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
|||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -16,7 +15,7 @@ public class Command_rawsay extends TFM_Command
|
|||||||
{
|
{
|
||||||
if (args.length > 0)
|
if (args.length > 0)
|
||||||
{
|
{
|
||||||
TFM_Util.bcastMsg(ChatColor.translateAlternateColorCodes('&', StringUtils.join(args, " ")));
|
TFM_Util.bcastMsg(TFM_Util.colorise(StringUtils.join(args, " ")));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -77,7 +77,7 @@ public class Command_saconfig extends TFM_Command
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
playerMsg(ChatColor.stripColor(ChatColor.translateAlternateColorCodes('&', superadmin.toString())));
|
playerMsg(ChatColor.stripColor(TFM_Util.colorise(superadmin.toString())));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -0,0 +1,58 @@
|
|||||||
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
|
||||||
|
@CommandParameters(description = "Sets yourself a prefix", usage = "/<command> [<prefix> | off]")
|
||||||
|
public class Command_tag extends TFM_Command
|
||||||
|
{
|
||||||
|
|
||||||
|
public static final List<String> FORBIDDEN_WORDS = Arrays.asList(new String[]{"admin", "owner", "moderator", "developer"});
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
|
{
|
||||||
|
if (args.length != 1)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TFM_Util.isStopCommand(args[0]))
|
||||||
|
{
|
||||||
|
TFM_PlayerData.getPlayerData(sender_p).setTag(null);
|
||||||
|
playerMsg("Removed your tag.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args[0].length() > 15)
|
||||||
|
{
|
||||||
|
playerMsg("That tag is too long.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
|
{
|
||||||
|
for (String word : FORBIDDEN_WORDS)
|
||||||
|
{
|
||||||
|
if (args[0].toLowerCase().contains(word))
|
||||||
|
{
|
||||||
|
playerMsg("That tag contains a forbidden word.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TFM_PlayerData.getPlayerData(sender_p).setTag(args[0]);
|
||||||
|
playerMsg("Tag set.");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -50,7 +50,6 @@ public class TFM_PlayerListener implements Listener
|
|||||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
||||||
player.sendMessage(ChatColor.GRAY + "Water buckets are currently disabled.");
|
player.sendMessage(ChatColor.GRAY + "Water buckets are currently disabled.");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -61,7 +60,6 @@ public class TFM_PlayerListener implements Listener
|
|||||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
||||||
player.sendMessage(ChatColor.GRAY + "Lava buckets are currently disabled.");
|
player.sendMessage(ChatColor.GRAY + "Lava buckets are currently disabled.");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -442,6 +440,12 @@ public class TFM_PlayerListener implements Listener
|
|||||||
|
|
||||||
// Finally, set message
|
// Finally, set message
|
||||||
event.setMessage(message);
|
event.setMessage(message);
|
||||||
|
|
||||||
|
// Set the tag
|
||||||
|
if (playerdata.getTag() != null) {
|
||||||
|
p.setDisplayName((playerdata.getTag() + " " + p.getDisplayName().replaceAll(" ", "")));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -71,7 +71,7 @@ public class TFM_CommandBlocker
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GRAY + ChatColor.translateAlternateColorCodes('&', parts[3]));
|
sender.sendMessage(ChatColor.GRAY + TFM_Util.colorise(parts[3]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,7 +308,7 @@ public class TFM_CommandBlockerNew
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
response = ChatColor.GRAY + ChatColor.translateAlternateColorCodes('&', this.message);
|
response = ChatColor.GRAY + TFM_Util.colorise(this.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(response);
|
sender.sendMessage(response);
|
||||||
|
@ -53,6 +53,7 @@ public class TFM_PlayerData
|
|||||||
private Boolean superadmin_id_verified = null;
|
private Boolean superadmin_id_verified = null;
|
||||||
private String last_command = "";
|
private String last_command = "";
|
||||||
private boolean cmdspy_enabled = false;
|
private boolean cmdspy_enabled = false;
|
||||||
|
private String tag = null;
|
||||||
|
|
||||||
public TFM_PlayerData(Player player)
|
public TFM_PlayerData(Player player)
|
||||||
{
|
{
|
||||||
@ -504,4 +505,22 @@ public class TFM_PlayerData
|
|||||||
{
|
{
|
||||||
return cmdspy_enabled;
|
return cmdspy_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTag(String tag)
|
||||||
|
{
|
||||||
|
if (tag == null)
|
||||||
|
{
|
||||||
|
this.tag = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.tag = TFM_Util.colorise(tag) + ChatColor.WHITE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTag()
|
||||||
|
{
|
||||||
|
return this.tag;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -148,35 +148,35 @@ public class TFM_UserList
|
|||||||
|
|
||||||
public class TFM_UserListEntry
|
public class TFM_UserListEntry
|
||||||
{
|
{
|
||||||
private String _username;
|
private String username;
|
||||||
private List<String> _ip_addresses = new ArrayList<String>();
|
private List<String> ip_addresses = new ArrayList<String>();
|
||||||
|
|
||||||
public TFM_UserListEntry(String username, List<String> ip_addresses)
|
public TFM_UserListEntry(String username, List<String> ip_addresses)
|
||||||
{
|
{
|
||||||
_username = username;
|
this.username = username;
|
||||||
_ip_addresses = ip_addresses;
|
this.ip_addresses = ip_addresses;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TFM_UserListEntry(String username)
|
public TFM_UserListEntry(String username)
|
||||||
{
|
{
|
||||||
_username = username;
|
this.username = username;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getIpAddresses()
|
public List<String> getIpAddresses()
|
||||||
{
|
{
|
||||||
return _ip_addresses;
|
return ip_addresses;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUsername()
|
public String getUsername()
|
||||||
{
|
{
|
||||||
return _username;
|
return username;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean addIpAddress(String ip_address)
|
public boolean addIpAddress(String ip_address)
|
||||||
{
|
{
|
||||||
if (!_ip_addresses.contains(ip_address))
|
if (!ip_addresses.contains(ip_address))
|
||||||
{
|
{
|
||||||
_ip_addresses.add(ip_address);
|
ip_addresses.add(ip_address);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -906,6 +906,7 @@ public class TFM_Util
|
|||||||
while (checkClass.getSuperclass() != Object.class && ((checkClass = checkClass.getSuperclass()) != null));
|
while (checkClass.getSuperclass() != Object.class && ((checkClass = checkClass.getSuperclass()) != null));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final List<ChatColor> COLOR_POOL = Arrays.asList(
|
public static final List<ChatColor> COLOR_POOL = Arrays.asList(
|
||||||
ChatColor.DARK_BLUE,
|
ChatColor.DARK_BLUE,
|
||||||
ChatColor.DARK_GREEN,
|
ChatColor.DARK_GREEN,
|
||||||
@ -925,4 +926,9 @@ public class TFM_Util
|
|||||||
{
|
{
|
||||||
return COLOR_POOL.get(RANDOM.nextInt(COLOR_POOL.size()));
|
return COLOR_POOL.get(RANDOM.nextInt(COLOR_POOL.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String colorise(String string)
|
||||||
|
{
|
||||||
|
return ChatColor.translateAlternateColorCodes('&', string);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user