mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 07:06:45 +01:00
Player brackets in chat can now be colored the same as the group prefix color, allowing quick and easy identification of a players group.
This commit is contained in:
parent
5cc636f269
commit
621fe2279b
10
TODO
10
TODO
@ -1,5 +1,4 @@
|
|||||||
vMinecraft v1 Todo:
|
vMinecraft v1 Todo:
|
||||||
+ Brackets with group prefix colors in chat
|
|
||||||
+ Add permission toggle for using colors
|
+ Add permission toggle for using colors
|
||||||
+ Guilds
|
+ Guilds
|
||||||
+ Party Leaders
|
+ Party Leaders
|
||||||
@ -33,10 +32,11 @@ vMinecraft v2 Updates!
|
|||||||
how much longer they are probated for.
|
how much longer they are probated for.
|
||||||
|
|
||||||
DONE
|
DONE
|
||||||
+Party system
|
+ Brackets with group prefix colors in chat
|
||||||
+Party Chat
|
+ Party system
|
||||||
+Fix death messages
|
+ Party Chat
|
||||||
+Added /freeze command to stop players from moving
|
+ Fix death messages
|
||||||
|
+ Added /freeze command to stop players from moving
|
||||||
+ Quick recode of /me to use the new getName function
|
+ Quick recode of /me to use the new getName function
|
||||||
+ Promote and Demote (ASAP) <Cere> DIBS
|
+ Promote and Demote (ASAP) <Cere> DIBS
|
||||||
+ Simple Fire Antigrief
|
+ Simple Fire Antigrief
|
||||||
|
12
vChat.java
12
vChat.java
@ -478,8 +478,8 @@ public class vChat {
|
|||||||
public static boolean quote(Player player, String message)
|
public static boolean quote(Player player, String message)
|
||||||
{
|
{
|
||||||
//Format the name
|
//Format the name
|
||||||
String playerName = Colors.White + "<" + getName(player)
|
String playerName = vmc.getInstance().getGroupPrefix(player) + "<" + getName(player)
|
||||||
+ Colors.White + "> ";
|
+ vmc.getInstance().getGroupPrefix(player) + "> ";
|
||||||
if(vConfig.getInstance().greentext()) {
|
if(vConfig.getInstance().greentext()) {
|
||||||
//Log the chat
|
//Log the chat
|
||||||
log.log(Level.INFO, "<"+player.getName()+"> " + message);
|
log.log(Level.INFO, "<"+player.getName()+"> " + message);
|
||||||
@ -501,8 +501,8 @@ public class vChat {
|
|||||||
public static boolean rage(Player player, String message)
|
public static boolean rage(Player player, String message)
|
||||||
{
|
{
|
||||||
//Format the name
|
//Format the name
|
||||||
String playerName = Colors.White + "<"
|
String playerName = vmc.getInstance().getGroupPrefix(player) + "<"
|
||||||
+ getName(player) + Colors.White +"> ";
|
+ getName(player) + vmc.getInstance().getGroupPrefix(player) +"> ";
|
||||||
if (vConfig.getInstance().FFF()) {
|
if (vConfig.getInstance().FFF()) {
|
||||||
log.log(Level.INFO, "<"+player.getName()+"> "+message);
|
log.log(Level.INFO, "<"+player.getName()+"> "+message);
|
||||||
|
|
||||||
@ -523,8 +523,8 @@ public class vChat {
|
|||||||
public static boolean quakeColors(Player player, String message)
|
public static boolean quakeColors(Player player, String message)
|
||||||
{
|
{
|
||||||
//Format the name
|
//Format the name
|
||||||
String playerName = Colors.White + "<"
|
String playerName = vmc.getInstance().getGroupPrefix(player) + "<"
|
||||||
+ getName(player) + Colors.White +"> ";
|
+ getName(player) + vmc.getInstance().getGroupPrefix(player) +"> ";
|
||||||
if(vConfig.getInstance().quakeColors()) {
|
if(vConfig.getInstance().quakeColors()) {
|
||||||
|
|
||||||
String color = vUsers.getProfile(player).getColor();
|
String color = vUsers.getProfile(player).getColor();
|
||||||
|
@ -262,6 +262,7 @@ private static HashMap<String, Player> hidden = new HashMap<String, Player>();
|
|||||||
{
|
{
|
||||||
for (Player p : playerList)
|
for (Player p : playerList)
|
||||||
{
|
{
|
||||||
|
if(p != null){
|
||||||
if (vmc.getDistance(InvisiblePlayer, p) <= vConfig.range && p.getUser() != InvisiblePlayer.getUser())
|
if (vmc.getDistance(InvisiblePlayer, p) <= vConfig.range && p.getUser() != InvisiblePlayer.getUser())
|
||||||
{
|
{
|
||||||
p.getUser().a.b(new dv(InvisiblePlayer.getUser().g));
|
p.getUser().a.b(new dv(InvisiblePlayer.getUser().g));
|
||||||
@ -269,6 +270,7 @@ private static HashMap<String, Player> hidden = new HashMap<String, Player>();
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public static int party(Player player, String[] args){
|
public static int party(Player player, String[] args){
|
||||||
if(vUsers.getProfile(player).inParty()){
|
if(vUsers.getProfile(player).inParty()){
|
||||||
player.sendMessage(Colors.Red + "You are already in a party, use /pquit to leave it");
|
player.sendMessage(Colors.Red + "You are already in a party, use /pquit to leave it");
|
||||||
|
@ -18,6 +18,7 @@ public class vConfig {
|
|||||||
//The feature settings
|
//The feature settings
|
||||||
static boolean toggle = true,
|
static boolean toggle = true,
|
||||||
adminChat = false,
|
adminChat = false,
|
||||||
|
groupcoloredbrackets = false,
|
||||||
partyChat = false,
|
partyChat = false,
|
||||||
greentext = false,
|
greentext = false,
|
||||||
FFF = false,
|
FFF = false,
|
||||||
@ -81,10 +82,12 @@ public class vConfig {
|
|||||||
FileWriter writer = null;
|
FileWriter writer = null;
|
||||||
try {
|
try {
|
||||||
writer = new FileWriter(location);
|
writer = new FileWriter(location);
|
||||||
writer.write("#This plugin is modular\r\n");
|
writer.append("#This plugin is modular\r\n");
|
||||||
writer.write("#Turn any features you don't want to false and they won't be running\r\n");
|
writer.write("#Turn any features you don't want to false and they won't be running\r\n");
|
||||||
writer.write("#If you edit this file and save it, then use /reload it will reload the settings\r\n");
|
writer.write("#If you edit this file and save it, then use /reload it will reload the settings\r\n");
|
||||||
writer.write("#Chat Options\r\n");
|
writer.write("#Chat Options\r\n");
|
||||||
|
writer.write("#Group prefix colors apply to player brackets\r\n");
|
||||||
|
writer.write("groupcoloredbrackets=true\r\n");
|
||||||
writer.write("#Allows the use of color codes following ^ symbol\r\n");
|
writer.write("#Allows the use of color codes following ^ symbol\r\n");
|
||||||
writer.write("ColoredChat=true\r\n");
|
writer.write("ColoredChat=true\r\n");
|
||||||
writer.write("#Require per player permission for quakecolors\r\n");
|
writer.write("#Require per player permission for quakecolors\r\n");
|
||||||
@ -168,6 +171,7 @@ public class vConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
groupcoloredbrackets = properties.getBoolean("groupcoloredbrackets",true);
|
||||||
adminChat = properties.getBoolean("adminchat",true);
|
adminChat = properties.getBoolean("adminchat",true);
|
||||||
partyChat = properties.getBoolean("partychat",true);
|
partyChat = properties.getBoolean("partychat",true);
|
||||||
playerspawn = properties.getBoolean("playerspawn",true);
|
playerspawn = properties.getBoolean("playerspawn",true);
|
||||||
@ -229,6 +233,7 @@ public class vConfig {
|
|||||||
//Use: Returns if the feature is enabled
|
//Use: Returns if the feature is enabled
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
public boolean adminchat() {return adminChat;}
|
public boolean adminchat() {return adminChat;}
|
||||||
|
public boolean groupcoloredbrackets(){return groupcoloredbrackets;}
|
||||||
public boolean partyChat() {return partyChat;}
|
public boolean partyChat() {return partyChat;}
|
||||||
public boolean adminChatToggle() {return cmdAdminToggle;}
|
public boolean adminChatToggle() {return cmdAdminToggle;}
|
||||||
public boolean greentext() {return greentext;}
|
public boolean greentext() {return greentext;}
|
||||||
|
@ -14,13 +14,13 @@ public class vListener extends PluginListener {
|
|||||||
{
|
{
|
||||||
if(split.length > 1){
|
if(split.length > 1){
|
||||||
String args = " " + etc.combineSplit(1, split, " ");
|
String args = " " + etc.combineSplit(1, split, " ");
|
||||||
vChat.gmsg(server + args);
|
vChat.gmsg(server + " " + args);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(split[0].equalsIgnoreCase("stop"))
|
if(split[0].equalsIgnoreCase("stop"))
|
||||||
vChat.gmsg(server + "shutting down the server");
|
vChat.gmsg(server + " shutting down the server");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ public class vListener extends PluginListener {
|
|||||||
//Then we preceed to check if they are in the same party, the code for this is stored elsewhere
|
//Then we preceed to check if they are in the same party, the code for this is stored elsewhere
|
||||||
if(vUsers.getProfile(dplayer).inParty()){
|
if(vUsers.getProfile(dplayer).inParty()){
|
||||||
//If they are in the same party we tell onDamage to return true stopping the damage code from executing
|
//If they are in the same party we tell onDamage to return true stopping the damage code from executing
|
||||||
if(vmc.inSameParty(aplayer, dplayer)){
|
if(aplayer != null && vmc.inSameParty(aplayer, dplayer)){
|
||||||
return true;
|
return true;
|
||||||
//if they aren't we tell it to return false, making the damage happen
|
//if they aren't we tell it to return false, making the damage happen
|
||||||
} else{
|
} else{
|
||||||
|
45
vmc.java
45
vmc.java
@ -1,5 +1,12 @@
|
|||||||
|
import java.io.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
public class vmc {
|
public class vmc {
|
||||||
|
private static volatile vmc instance;
|
||||||
|
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||||
|
private PropertiesFile properties;
|
||||||
|
String location = "groups.txt";
|
||||||
//Check if two players are in the same party
|
//Check if two players are in the same party
|
||||||
public static boolean inSameParty(Player playera, Player playerb){
|
public static boolean inSameParty(Player playera, Player playerb){
|
||||||
if(vUsers.getProfile(playera).getParty().equals(vUsers.getProfile(playerb).getParty())){
|
if(vUsers.getProfile(playera).getParty().equals(vUsers.getProfile(playerb).getParty())){
|
||||||
@ -18,7 +25,7 @@ public class vmc {
|
|||||||
public static void sendInvisible(Player player){
|
public static void sendInvisible(Player player){
|
||||||
for (Player p : etc.getServer().getPlayerList())
|
for (Player p : etc.getServer().getPlayerList())
|
||||||
{
|
{
|
||||||
if (vmc.getDistance(player, p) <= vConfig.range && p.getUser() != player.getUser())
|
if (getDistance(player, p) <= vConfig.range && p.getUser() != player.getUser())
|
||||||
{
|
{
|
||||||
p.getUser().a.b(new dv(player.getUser().g));
|
p.getUser().a.b(new dv(player.getUser().g));
|
||||||
}
|
}
|
||||||
@ -28,10 +35,42 @@ public class vmc {
|
|||||||
public static void sendNotInvisible(Player player){
|
public static void sendNotInvisible(Player player){
|
||||||
for (Player p : etc.getServer().getPlayerList())
|
for (Player p : etc.getServer().getPlayerList())
|
||||||
{
|
{
|
||||||
if (vmc.getDistance(player, p) < vConfig.range && p.getUser() != player.getUser())
|
if (getDistance(player, p) < vConfig.range && p.getUser() != player.getUser())
|
||||||
{
|
{
|
||||||
p.getUser().a.b(new d(player.getUser()));
|
p.getUser().a.b(new d(player.getUser()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public String getGroupPrefix(Player player){
|
||||||
|
String groups[] = player.getGroups();
|
||||||
|
String groupline[] = null;
|
||||||
|
String prefix = Colors.White;
|
||||||
|
if(vConfig.getInstance().groupcoloredbrackets()){
|
||||||
|
//Read the file
|
||||||
|
properties = new PropertiesFile(location);
|
||||||
|
try {
|
||||||
|
properties.load();
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.log(Level.SEVERE, "Exception while loading " + location, e);
|
||||||
|
}
|
||||||
|
//Grab the line with the same group as the player
|
||||||
|
if(!groups[0].isEmpty())
|
||||||
|
groupline = properties.getString(groups[0]).split(":");
|
||||||
|
//Check if the prefix is null or not
|
||||||
|
if(groupline[0] != null)
|
||||||
|
{
|
||||||
|
//vChat.colorChange(groupline[0].charAt(0));
|
||||||
|
prefix = groupline[0];
|
||||||
|
prefix = vChat.colorChange(prefix.charAt(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static vmc getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new vmc();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user