mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Changes to the party system
This commit is contained in:
parent
03f73a0353
commit
25e9d7afcf
19
vCom.java
19
vCom.java
@ -272,24 +272,22 @@ 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() && args.length > 1){
|
if(!vUsers.getProfile(player).inParty() && args.length == 0){
|
||||||
|
player.sendMessage(Colors.Red + "Correct usage is /party [partyname]");
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
if((vUsers.getProfile(player).inParty()) && (args.length > 0)){
|
||||||
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");
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
if(vUsers.getProfile(player).inParty()){
|
if(vUsers.getProfile(player).inParty()){
|
||||||
int x = 0;
|
player.sendMessage(Colors.Green + "Party Members: " + vmc.getInstance().getPartyMembers(player));
|
||||||
String partymembers[] = null;
|
return EXIT_SUCCESS;
|
||||||
for(Player p : etc.getServer().getPlayerList()){
|
|
||||||
if(vmc.inSameParty(player, p)){
|
|
||||||
partymembers[x] = p.getName();
|
|
||||||
x++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
player.sendMessage(Colors.Green + "Party Members: " + partymembers);
|
|
||||||
}
|
}
|
||||||
if(args[0] != null) {
|
if(args[0] != null) {
|
||||||
vUsers.getProfile(player).setParty(args[0]);
|
vUsers.getProfile(player).setParty(args[0]);
|
||||||
player.sendMessage(Colors.DarkPurple + "Party set to " + args[0]);
|
player.sendMessage(Colors.DarkPurple + "Party set to " + args[0]);
|
||||||
|
vmc.informPartyMembers(player);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(Colors.Red + "Correct usage is /party [partyname]");
|
player.sendMessage(Colors.Red + "Correct usage is /party [partyname]");
|
||||||
@ -298,6 +296,7 @@ private static HashMap<String, Player> hidden = new HashMap<String, Player>();
|
|||||||
}
|
}
|
||||||
public static int partyquit(Player player, String[] args){
|
public static int partyquit(Player player, String[] args){
|
||||||
if(vUsers.getProfile(player).inParty()){
|
if(vUsers.getProfile(player).inParty()){
|
||||||
|
vmc.informPartyMembersQuit(player);
|
||||||
vUsers.getProfile(player).removeParty();
|
vUsers.getProfile(player).removeParty();
|
||||||
player.sendMessage(Colors.LightGreen + "Party successfully removed");
|
player.sendMessage(Colors.LightGreen + "Party successfully removed");
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
37
vmc.java
37
vmc.java
@ -1,5 +1,6 @@
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.lang.String;
|
import java.lang.String;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
public class vmc {
|
public class vmc {
|
||||||
@ -41,6 +42,37 @@ String location = "groups.txt";
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public String[] getPartyMembers(Player player){
|
||||||
|
int x = 0;
|
||||||
|
String partyarray[] = null;
|
||||||
|
ArrayList<String> partymembers = new ArrayList<String>();
|
||||||
|
for(Player p : etc.getServer().getPlayerList()){
|
||||||
|
if(vmc.inSameParty(player, p) && p != null){
|
||||||
|
partymembers.add(p.getName());
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
partymembers.toArray(partyarray);
|
||||||
|
return partyarray;
|
||||||
|
}
|
||||||
|
public static void informPartyMembers(Player player){
|
||||||
|
int x = 0;
|
||||||
|
for(Player p : etc.getServer().getPlayerList()){
|
||||||
|
if(vmc.inSameParty(player, p) && !p.getName().equals(player.getName())){
|
||||||
|
p.sendMessage(vUsers.getProfile(player).getTag() + player.getName() + Colors.Green + " has joined your party");
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void informPartyMembersQuit(Player player){
|
||||||
|
int x = 0;
|
||||||
|
for(Player p : etc.getServer().getPlayerList()){
|
||||||
|
if(vmc.inSameParty(player, p) && !p.getName().equals(player.getName())){
|
||||||
|
p.sendMessage(vUsers.getProfile(player).getTag() + player.getName() + Colors.Green + " has left your party");
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
public String getGroupPrefix(Player player){
|
public String getGroupPrefix(Player player){
|
||||||
String groups[] = player.getGroups();
|
String groups[] = player.getGroups();
|
||||||
String groupline[] = null;
|
String groupline[] = null;
|
||||||
@ -56,12 +88,13 @@ String location = "groups.txt";
|
|||||||
}
|
}
|
||||||
//Grab the line with the same group as the player
|
//Grab the line with the same group as the player
|
||||||
for(String herp : groups){
|
for(String herp : groups){
|
||||||
|
if(herp != null)
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
if(x > 0)
|
if(x != 0)
|
||||||
groupline = properties.getString(groups[0]).split(":");
|
groupline = properties.getString(groups[0]).split(":");
|
||||||
//Check if the prefix is null or not
|
//Check if the prefix is null or not
|
||||||
if(!groupline[0].isEmpty())
|
if(!groupline[0].isEmpty() && groupline != null)
|
||||||
{
|
{
|
||||||
//vChat.colorChange(groupline[0].charAt(0));
|
//vChat.colorChange(groupline[0].charAt(0));
|
||||||
prefix = groupline[0];
|
prefix = groupline[0];
|
||||||
|
Loading…
Reference in New Issue
Block a user