mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-12-27 20:27:37 +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.BUILDNUM=392
|
||||
program.BUILDDATE=08/10/2013 03\:43 PM
|
||||
program.BUILDNUM=400
|
||||
program.BUILDDATE=08/12/2013 12\:25 PM
|
||||
|
@ -1,3 +1,3 @@
|
||||
#Build Number for ANT. Do not edit!
|
||||
#Sat Aug 10 15:43:16 EDT 2013
|
||||
build.number=393
|
||||
#Mon Aug 12 12:25:56 CEST 2013
|
||||
build.number=401
|
||||
|
@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -16,7 +15,7 @@ public class Command_rawsay extends TFM_Command
|
||||
{
|
||||
if (args.length > 0)
|
||||
{
|
||||
TFM_Util.bcastMsg(ChatColor.translateAlternateColorCodes('&', StringUtils.join(args, " ")));
|
||||
TFM_Util.bcastMsg(TFM_Util.colorise(StringUtils.join(args, " ")));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -77,7 +77,7 @@ public class Command_saconfig extends TFM_Command
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg(ChatColor.stripColor(ChatColor.translateAlternateColorCodes('&', superadmin.toString())));
|
||||
playerMsg(ChatColor.stripColor(TFM_Util.colorise(superadmin.toString())));
|
||||
}
|
||||
|
||||
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.sendMessage(ChatColor.GRAY + "Water buckets are currently disabled.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -61,7 +60,6 @@ public class TFM_PlayerListener implements Listener
|
||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
||||
player.sendMessage(ChatColor.GRAY + "Lava buckets are currently disabled.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -442,6 +440,12 @@ public class TFM_PlayerListener implements Listener
|
||||
|
||||
// Finally, set message
|
||||
event.setMessage(message);
|
||||
|
||||
// Set the tag
|
||||
if (playerdata.getTag() != null) {
|
||||
p.setDisplayName((playerdata.getTag() + " " + p.getDisplayName().replaceAll(" ", "")));
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -71,7 +71,7 @@ public class TFM_CommandBlocker
|
||||
}
|
||||
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
|
||||
{
|
||||
response = ChatColor.GRAY + ChatColor.translateAlternateColorCodes('&', this.message);
|
||||
response = ChatColor.GRAY + TFM_Util.colorise(this.message);
|
||||
}
|
||||
|
||||
sender.sendMessage(response);
|
||||
|
@ -53,6 +53,7 @@ public class TFM_PlayerData
|
||||
private Boolean superadmin_id_verified = null;
|
||||
private String last_command = "";
|
||||
private boolean cmdspy_enabled = false;
|
||||
private String tag = null;
|
||||
|
||||
public TFM_PlayerData(Player player)
|
||||
{
|
||||
@ -504,4 +505,22 @@ public class TFM_PlayerData
|
||||
{
|
||||
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
|
||||
{
|
||||
private String _username;
|
||||
private List<String> _ip_addresses = new ArrayList<String>();
|
||||
private String username;
|
||||
private List<String> ip_addresses = new ArrayList<String>();
|
||||
|
||||
public TFM_UserListEntry(String username, List<String> ip_addresses)
|
||||
{
|
||||
_username = username;
|
||||
_ip_addresses = ip_addresses;
|
||||
this.username = username;
|
||||
this.ip_addresses = ip_addresses;
|
||||
}
|
||||
|
||||
public TFM_UserListEntry(String username)
|
||||
{
|
||||
_username = username;
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public List<String> getIpAddresses()
|
||||
{
|
||||
return _ip_addresses;
|
||||
return ip_addresses;
|
||||
}
|
||||
|
||||
public String getUsername()
|
||||
{
|
||||
return _username;
|
||||
return username;
|
||||
}
|
||||
|
||||
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 false;
|
||||
|
@ -906,6 +906,7 @@ public class TFM_Util
|
||||
while (checkClass.getSuperclass() != Object.class && ((checkClass = checkClass.getSuperclass()) != null));
|
||||
return null;
|
||||
}
|
||||
|
||||
public static final List<ChatColor> COLOR_POOL = Arrays.asList(
|
||||
ChatColor.DARK_BLUE,
|
||||
ChatColor.DARK_GREEN,
|
||||
@ -925,4 +926,9 @@ public class TFM_Util
|
||||
{
|
||||
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