bc panther asked for it

This commit is contained in:
Super_ 2020-01-02 00:51:02 -05:00
parent eb3a266bf6
commit 35ef866690
3 changed files with 66 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import com.google.common.base.Strings;
import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
import me.totalfreedom.totalfreedommod.rank.Displayable; import me.totalfreedom.totalfreedommod.rank.Displayable;
import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FSync; import me.totalfreedom.totalfreedommod.util.FSync;
@ -90,6 +91,12 @@ public class ChatManager extends FreedomService
} }
} }
VPlayer vPlayer = plugin.pv.getVerificationPlayer(player);
if (vPlayer.getColor() != null)
{
message = vPlayer.getColor() + message;
}
// Finally, set message // Finally, set message
event.setMessage(message); event.setMessage(message);

View File

@ -0,0 +1,53 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
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;
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Change your default chat color.", usage = "/<command> <color>")
public class Command_chatcolor extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length != 1)
{
return false;
}
VPlayer vPlayer = plugin.pv.getVerificationPlayer(playerSender);
if (args[0].equals("clear"))
{
vPlayer.setColor(null);
msg("Default chat color cleared.");
return true;
}
if (args[0].equalsIgnoreCase("k")
|| args[0].equalsIgnoreCase("0")
|| args[0].equalsIgnoreCase("m"))
{
msg("You are not allowed to use that color as default.");
return true;
}
ChatColor color = ChatColor.getByChar(args[0]);
if (color == null)
{
msg("Please enter a valid color. Example: a, 2, e");
return true;
}
vPlayer.setColor(color);
msg("Default chat color set to \"" + args[0] + ".\"");
return true;
}
}

View File

@ -9,6 +9,7 @@ import net.pravian.aero.base.ConfigLoadable;
import net.pravian.aero.base.ConfigSavable; import net.pravian.aero.base.ConfigSavable;
import net.pravian.aero.base.Validatable; import net.pravian.aero.base.Validatable;
import org.apache.commons.lang.Validate; import org.apache.commons.lang.Validate;
import org.bukkit.ChatColor;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -37,6 +38,9 @@ public class VPlayer implements ConfigLoadable, ConfigSavable, Validatable
@Getter @Getter
@Setter @Setter
private String rideMode = "ask"; private String rideMode = "ask";
@Getter
@Setter
private ChatColor color = null;
public VPlayer(String name) public VPlayer(String name)
{ {
@ -59,6 +63,7 @@ public class VPlayer implements ConfigLoadable, ConfigSavable, Validatable
tag = cs.getString("tag", null); tag = cs.getString("tag", null);
clearChatOptOut = cs.getBoolean("clearChatOptOut", false); clearChatOptOut = cs.getBoolean("clearChatOptOut", false);
rideMode = cs.getString("rideMode", rideMode); rideMode = cs.getString("rideMode", rideMode);
color = ChatColor.getByChar(String.valueOf(cs.get("color")));
} }
@Override @Override
@ -72,6 +77,7 @@ public class VPlayer implements ConfigLoadable, ConfigSavable, Validatable
cs.set("ips", Lists.newArrayList(ips)); cs.set("ips", Lists.newArrayList(ips));
cs.set("clearChatOptOut", clearChatOptOut); cs.set("clearChatOptOut", clearChatOptOut);
cs.set("rideMode", rideMode); cs.set("rideMode", rideMode);
cs.set("color", color.getChar());
} }
public List<String> getIps() public List<String> getIps()