Hi..Mi...Tsu..

This commit is contained in:
nossr50 2011-02-04 18:16:52 -08:00
parent 9084b3fca4
commit 19ffdab631
3 changed files with 43 additions and 7 deletions

View File

@ -28,6 +28,12 @@ public class mcEntityListener extends EntityListener {
if(mcUsers.getProfile(defender).getParty().equals(mcUsers.getProfile(attacker).getParty())){
event.setCancelled(true);
}
if((defender.getHealth() - event.getDamage()) <= 0){
for(Player derp : plugin.getServer().getOnlinePlayers()){
derp.sendMessage(ChatColor.GRAY+attacker.getName() + " has " +ChatColor.DARK_RED+"slain "+ChatColor.GRAY+defender.getName());
mcUsers.getProfile(defender).setDead(true);
}
}
}
}
}
@ -55,6 +61,18 @@ public class mcEntityListener extends EntityListener {
}
}
}
public void onEntityDeath(EntityDeathEvent event) {
Entity x = event.getEntity();
if(x instanceof Player){
Player player = (Player)x;
if(mcUsers.getProfile(player).isDead()){
return;
}
for(Player derp : plugin.getServer().getOnlinePlayers()){
derp.sendMessage(ChatColor.GRAY+player.getName()+" has died.");
}
}
}
public boolean isPlayer(Entity entity){
if (entity instanceof Player) {
return true;

View File

@ -17,11 +17,13 @@ public class mcPlayerListener extends PlayerListener {
public void onPlayerJoin(PlayerEvent event) {
Player player = event.getPlayer();
mcUsers.addUser(player);
player.sendMessage(ChatColor.GREEN+"Welcome to /v/ - Minecraft");
player.sendMessage(ChatColor.GREEN+"Steam Group: vminecraft");
player.sendMessage(ChatColor.DARK_RED+"Welcome to /v/ - Minecraft");
player.sendMessage(ChatColor.DARK_RED+"Steam Group: vminecraft");
player.sendMessage(ChatColor.AQUA + "This server is running mcMMO type /stats for your information");
player.sendMessage(ChatColor.GREEN + "Use "+ChatColor.YELLOW+"/party "+ChatColor.WHITE+"to create/join parties.");
player.sendMessage(ChatColor.GREEN + "Use "+ChatColor.YELLOW+"/p"+ChatColor.WHITE+" to toggle party chat");
player.sendMessage(ChatColor.GREEN + "Use "+ChatColor.YELLOW+"/party "+ChatColor.GREEN+"to create/join parties and");
player.sendMessage(ChatColor.GREEN+"to check who is in your current party.");
player.sendMessage(ChatColor.GREEN + "Use "+ChatColor.YELLOW+"/p"+ChatColor.GREEN+" to toggle party chat");
player.sendMessage(ChatColor.GREEN + "Use "+ChatColor.YELLOW+"/ptp "+ChatColor.GREEN+"to teleport to party members");
player.sendMessage("Set your spawn with "+ChatColor.YELLOW+"/setmyspawn"+ChatColor.WHITE+", Travel to it with /myspawn");
player.sendMessage(ChatColor.RED+"WARNING: "+ChatColor.DARK_GRAY+ "Using /myspawn will clear your inventory!");
}
@ -56,6 +58,18 @@ public class mcPlayerListener extends PlayerListener {
String[] split = event.getMessage().split(" ");
String playerName = player.getName();
//mcMMO command
if(mcUsers.getProfile(player).inParty() && split[0].equalsIgnoreCase("/ptp")){
if(split.length < 2){
player.sendMessage(ChatColor.RED+"Usage is /ptp <playername>");
return;
}
if(isPlayer(split[1])){
Player target = getPlayer(split[1]);
player.teleportTo(target);
player.sendMessage(ChatColor.GREEN+"You have teleport to "+target.getName());
target.sendMessage(ChatColor.GREEN+player.getName() + " has teleported to you.");
}
}
if(player.isOp() && split[0].equalsIgnoreCase("/whois")){
if(split.length < 2){
player.sendMessage(ChatColor.RED + "Proper usage is /whois <playername>");
@ -124,8 +138,9 @@ public class mcPlayerListener extends PlayerListener {
player.sendMessage(ChatColor.GREEN + "Party Members ("+ChatColor.WHITE+tempList+ChatColor.GREEN+")");
}
if(split[1].equals("q") && mcUsers.getProfile(player).inParty()){
mcUsers.getProfile(player).removeParty();
informPartyMembersQuit(player);
mcUsers.getProfile(player).removeParty();
player.sendMessage(ChatColor.RED + "You have left that party");
return;
}
mcUsers.getProfile(player).setParty(split[1]);

View File

@ -199,9 +199,10 @@ class PlayerList
//Get gather
if(character.length > 1)
gather = character[1];
if(character.length > 2){
if(character.length > 2)
myspawn = character[2];
}
if(character.length > 3)
party = character[3];
in.close();
return true;
}
@ -243,6 +244,7 @@ class PlayerList
writer.append(playerName + ":");
writer.append(gather + ":");
writer.append(myspawn + ":");
writer.append(party+":");
writer.append("\r\n");
}
}
@ -266,6 +268,7 @@ class PlayerList
out.append(playerName + ":");
out.append(gather + ":");
out.append(myspawn+":");
out.append(party+":");
//Add more in the same format as the line above
out.newLine();