mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 05:06:45 +01:00
Fixed /msg and /ignore
This commit is contained in:
parent
9ff47ae104
commit
263a5701d7
@ -107,7 +107,6 @@ public class vMinecraftCommands{
|
|||||||
cl.registerMessage("/ban", "%p has banned %0p", Colors.Blue, 1, false);
|
cl.registerMessage("/ban", "%p has banned %0p", Colors.Blue, 1, false);
|
||||||
cl.registerMessage("/ipban", "%p has IP banned %0p", Colors.Blue, 1, false);
|
cl.registerMessage("/ipban", "%p has IP banned %0p", Colors.Blue, 1, false);
|
||||||
cl.registerMessage("/time", "Time change thanks to %p", Colors.Blue, 1, true);
|
cl.registerMessage("/time", "Time change thanks to %p", Colors.Blue, 1, true);
|
||||||
cl.registerMessage("/tp", "%p has teleported to %0p", Colors.Blue, 1, true);
|
|
||||||
}
|
}
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
//Function: vminecrafthelp (/vhelp or /vminecraft)
|
//Function: vminecrafthelp (/vhelp or /vminecraft)
|
||||||
@ -582,7 +581,7 @@ public class vMinecraftCommands{
|
|||||||
|
|
||||||
//Make sure the player exists
|
//Make sure the player exists
|
||||||
Player toPlayer = etc.getServer().matchPlayer(args[0]);
|
Player toPlayer = etc.getServer().matchPlayer(args[0]);
|
||||||
if (toPlayer != null && args.length > 0) {
|
if (toPlayer == null || args.length < 1) {
|
||||||
vMinecraftChat.sendMessage(player, player, Colors.Rose
|
vMinecraftChat.sendMessage(player, player, Colors.Rose
|
||||||
+ "No player by the name of " + args[0] + " could be found.");
|
+ "No player by the name of " + args[0] + " could be found.");
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
@ -683,7 +682,7 @@ public class vMinecraftCommands{
|
|||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ignore.hasControlOver(player))
|
if(!player.hasControlOver(ignore))
|
||||||
{
|
{
|
||||||
vMinecraftChat.sendMessage(player, player, Colors.Rose
|
vMinecraftChat.sendMessage(player, player, Colors.Rose
|
||||||
+ "You can't ignore someone a higher rank than you.");
|
+ "You can't ignore someone a higher rank than you.");
|
||||||
@ -691,7 +690,7 @@ public class vMinecraftCommands{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Don't let the player ignore themselves
|
//Don't let the player ignore themselves
|
||||||
if(!ignore.getName().equalsIgnoreCase(player.getName()))
|
if(ignore.getName().equalsIgnoreCase(player.getName()))
|
||||||
{
|
{
|
||||||
vMinecraftChat.sendMessage(player, player,
|
vMinecraftChat.sendMessage(player, player,
|
||||||
Colors.Rose + "You cannot ignore yourself");
|
Colors.Rose + "You cannot ignore yourself");
|
||||||
@ -862,7 +861,7 @@ public class vMinecraftCommands{
|
|||||||
//Make sure the user has access to the command
|
//Make sure the user has access to the command
|
||||||
if(!player.canUseCommand("/suicide")) return EXIT_FAIL;
|
if(!player.canUseCommand("/suicide")) return EXIT_FAIL;
|
||||||
|
|
||||||
if(vMinecraftSettings.getInstance().cmdSuicide()) return EXIT_FAIL;
|
if(!vMinecraftSettings.getInstance().cmdSuicide()) return EXIT_FAIL;
|
||||||
|
|
||||||
//Set your health to 0. Not much to it.
|
//Set your health to 0. Not much to it.
|
||||||
player.setHealth(0);
|
player.setHealth(0);
|
||||||
@ -908,6 +907,9 @@ public class vMinecraftCommands{
|
|||||||
|
|
||||||
//If the player exists transport the user to the player
|
//If the player exists transport the user to the player
|
||||||
else {
|
else {
|
||||||
|
vMinecraftChat.gmsg( player, vMinecraftChat.getName(player)
|
||||||
|
+ Colors.LightBlue + "has teleported to"
|
||||||
|
+ vMinecraftChat.getName(playerTarget));
|
||||||
log.log(Level.INFO, player.getName() + " teleported to " +
|
log.log(Level.INFO, player.getName() + " teleported to " +
|
||||||
playerTarget.getName());
|
playerTarget.getName());
|
||||||
player.teleportTo(playerTarget);
|
player.teleportTo(playerTarget);
|
||||||
|
@ -88,6 +88,7 @@ public class vMinecraftListener extends PluginListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onLogin(Player player){
|
public void onLogin(Player player){
|
||||||
|
vMinecraftChat.sendMessage(player, player, Colors.Rose + "There are currently " + etc.getServer().getPlayerList().size() + " players online.");
|
||||||
vMinecraftUsers.addUser(player);
|
vMinecraftUsers.addUser(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,17 +7,16 @@ import java.util.Scanner;
|
|||||||
public class vMinecraftUsers {
|
public class vMinecraftUsers {
|
||||||
private static volatile vMinecraftUsers instance;
|
private static volatile vMinecraftUsers instance;
|
||||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||||
String file = "vminecraftusers.txt";
|
|
||||||
private PropertiesFile properties;
|
private PropertiesFile properties;
|
||||||
String location = "vminecraftusers.txt";
|
String location = "vminecraft.users";
|
||||||
|
|
||||||
public static PlayerList players = new PlayerList();
|
public static PlayerList players = new PlayerList();
|
||||||
|
|
||||||
|
|
||||||
public void loadUsers(){
|
public void loadUsers(){
|
||||||
File theDir = new File("vminecraftusers.txt");
|
File theDir = new File(location);
|
||||||
if(!theDir.exists()){
|
if(!theDir.exists()){
|
||||||
properties = new PropertiesFile("vminecraftusers.txt");
|
properties = new PropertiesFile(location);
|
||||||
FileWriter writer = null;
|
FileWriter writer = null;
|
||||||
try {
|
try {
|
||||||
writer = new FileWriter(location);
|
writer = new FileWriter(location);
|
||||||
@ -36,11 +35,11 @@ public class vMinecraftUsers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
properties = new PropertiesFile("vminecraftusers.txt");
|
properties = new PropertiesFile(location);
|
||||||
try {
|
try {
|
||||||
properties.load();
|
properties.load();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.log(Level.SEVERE, "Exception while loading vminecraftusers.txt", e);
|
log.log(Level.SEVERE, "Exception while loading " + location, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -166,6 +165,8 @@ class PlayerList
|
|||||||
tag,
|
tag,
|
||||||
suffix,
|
suffix,
|
||||||
defaultColor;
|
defaultColor;
|
||||||
|
|
||||||
|
String location = "vminecraft.users";
|
||||||
|
|
||||||
private ArrayList<String> ignoreList;
|
private ArrayList<String> ignoreList;
|
||||||
private commandList aliasList;
|
private commandList aliasList;
|
||||||
@ -190,7 +191,6 @@ class PlayerList
|
|||||||
suffix = new String();
|
suffix = new String();
|
||||||
ignoreList = new ArrayList<String>();
|
ignoreList = new ArrayList<String>();
|
||||||
aliasList = new commandList();
|
aliasList = new commandList();
|
||||||
String location = "vminecraftusers.txt";
|
|
||||||
|
|
||||||
//Try to apply what we can
|
//Try to apply what we can
|
||||||
try {
|
try {
|
||||||
@ -257,7 +257,6 @@ class PlayerList
|
|||||||
//=====================================================================
|
//=====================================================================
|
||||||
public void save(){
|
public void save(){
|
||||||
try {
|
try {
|
||||||
String location = "vminecraftusers.txt";
|
|
||||||
BufferedWriter bw = new BufferedWriter(new FileWriter(location, true));
|
BufferedWriter bw = new BufferedWriter(new FileWriter(location, true));
|
||||||
Scanner scanner = new Scanner(new File(location));
|
Scanner scanner = new Scanner(new File(location));
|
||||||
while (scanner.hasNextLine()) {
|
while (scanner.hasNextLine()) {
|
||||||
@ -277,7 +276,6 @@ class PlayerList
|
|||||||
}
|
}
|
||||||
scanner.close();
|
scanner.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String location = "vminecraftusers.txt";
|
|
||||||
log.log(Level.SEVERE, "Exception while writing to " + location + " (Are you sure you formatted it correctly?)", e);
|
log.log(Level.SEVERE, "Exception while writing to " + location + " (Are you sure you formatted it correctly?)", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user