mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Merge branch 'master' into mg_incomplete
Conflicts: appinfo.properties buildnumber.properties
This commit is contained in:
commit
bea480c1f1
@ -1,5 +1,5 @@
|
||||
#Sun, 11 Aug 2013 21:06:54 -0400
|
||||
#Mon, 12 Aug 2013 12:49:58 +0200
|
||||
|
||||
program.VERSION=2.22
|
||||
program.BUILDNUM=396
|
||||
program.BUILDDATE=08/11/2013 09\:06 PM
|
||||
program.BUILDNUM=403
|
||||
program.BUILDDATE=08/12/2013 12\:49 PM
|
||||
|
@ -1,3 +1,3 @@
|
||||
#Build Number for ANT. Do not edit!
|
||||
#Sun Aug 11 21:06:54 EDT 2013
|
||||
build.number=397
|
||||
#Mon Aug 12 12:49:58 CEST 2013
|
||||
build.number=404
|
||||
|
@ -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;
|
||||
|
@ -26,15 +26,15 @@ public class Command_saconfig extends TFM_Command
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!senderIsConsole)
|
||||
if (!TFM_SuperadminList.isSeniorAdmin(sender))
|
||||
{
|
||||
playerMsg("This command may only be used from the console.");
|
||||
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("clean"))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Cleaning superadmin list.", true);
|
||||
TFM_Util.adminAction(sender.getName(), "Cleaning superadmin list", true);
|
||||
TFM_SuperadminList.cleanSuperadminList(true);
|
||||
playerMsg("Superadmins: " + StringUtils.join(TFM_SuperadminList.getSuperadminNames(), ", "), ChatColor.YELLOW);
|
||||
}
|
||||
@ -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;
|
||||
@ -165,7 +165,7 @@ public class Command_saconfig extends TFM_Command
|
||||
else if ("disabled".equals(reply))
|
||||
{
|
||||
TFM_Util.playerMsg(sender, "Warning: Could not check if player has a twitter handle!");
|
||||
TFM_Util.playerMsg(sender, "TwitterBot has been temporarily disabled,, please wait until it get re-enabled", ChatColor.RED);
|
||||
TFM_Util.playerMsg(sender, "TwitterBot has been temporarily disabled, please wait until it gets re-enabled", ChatColor.RED);
|
||||
}
|
||||
else if ("failed".equals(reply))
|
||||
{
|
||||
|
118
src/me/StevenLawson/TotalFreedomMod/Commands/Command_tag.java
Normal file
118
src/me/StevenLawson/TotalFreedomMod/Commands/Command_tag.java
Normal file
@ -0,0 +1,118 @@
|
||||
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 me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Sets yourself a prefix", usage = "/<command> <<prefix> | off | clear <player> | clearall>")
|
||||
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)
|
||||
{
|
||||
|
||||
if ("clearall".equals(args[0]))
|
||||
{
|
||||
if (!TFM_SuperadminList.isUserSuperadmin(sender))
|
||||
{
|
||||
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
|
||||
|
||||
if (playerdata.getTag() != null)
|
||||
{
|
||||
count++;
|
||||
TFM_PlayerData.getPlayerData(p).setTag(null);
|
||||
}
|
||||
}
|
||||
|
||||
playerMsg(count + " tag(s) removed.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (senderIsConsole)
|
||||
{
|
||||
playerMsg("This can only be used by players.");
|
||||
return true;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
else if (args.length == 2)
|
||||
{
|
||||
if ("clear".equals(args[0]))
|
||||
{
|
||||
if (!TFM_SuperadminList.isUserSuperadmin(sender))
|
||||
{
|
||||
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
final Player p;
|
||||
try
|
||||
{
|
||||
p = getPlayer(args[1]);
|
||||
}
|
||||
catch (CantFindPlayerException ex)
|
||||
{
|
||||
playerMsg(ex.getMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_PlayerData.getPlayerData(p).setTag(null);
|
||||
playerMsg("Removed " + p.getName() + "'s tag.");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
@ -962,6 +962,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,
|
||||
@ -981,4 +982,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