Merge branch 'master' of github.com:nossr50/vminecraft-plugin

This commit is contained in:
cerevisiae 2010-11-29 21:00:42 -06:00
commit 746fdb97b1
4 changed files with 23 additions and 8 deletions

View File

@ -272,7 +272,7 @@ public class vminecraftCommands{
player.sendMessage(Colors.Blue + "Groups: " + group); player.sendMessage(Colors.Blue + "Groups: " + group);
//Admin //Admin
player.sendMessage(Colors.Blue+"Admin: " + player.sendMessage(Colors.Blue+"Admin: " +
String.valueOf(playerTarget.canIgnoreRestrictions())); String.valueOf(playerTarget.isAdmin()));
//IP //IP
player.sendMessage(Colors.Blue+"IP: " + playerTarget.getIP()); player.sendMessage(Colors.Blue+"IP: " + playerTarget.getIP());
//Restrictions //Restrictions

View File

@ -83,9 +83,15 @@ public class vminecraftListener extends PluginListener {
} }
else if (vminecraftSettings.getInstance().globalmessages() && player.getHealth() < 1) { else if (vminecraftSettings.getInstance().globalmessages() && player.getHealth() < 1) {
vminecraftChat.gmsg(Colors.Gray + player.getName() + " is no more"); vminecraftChat.gmsg(Colors.Gray + player.getName() + " " + vminecraftSettings.randomDeathMsg());
} }
return false; return false;
} }
/** Not working yet, I posted the issue to hMod on github though
public boolean onDamage(DamageType type, BaseEntity attacker, BaseEntity defender, int amount) {
return false;
}
**/
} }

View File

@ -23,6 +23,7 @@ public class vminecraftPlugin extends Plugin {
etc.getLoader().addListener(PluginLoader.Hook.CHAT, listener, this, PluginListener.Priority.MEDIUM); etc.getLoader().addListener(PluginLoader.Hook.CHAT, listener, this, PluginListener.Priority.MEDIUM);
etc.getLoader().addListener(PluginLoader.Hook.COMMAND, listener, this, PluginListener.Priority.HIGH); etc.getLoader().addListener(PluginLoader.Hook.COMMAND, listener, this, PluginListener.Priority.HIGH);
etc.getLoader().addListener(PluginLoader.Hook.IGNITE, listener, this, PluginListener.Priority.HIGH); etc.getLoader().addListener(PluginLoader.Hook.IGNITE, listener, this, PluginListener.Priority.HIGH);
etc.getLoader().addListener(PluginLoader.Hook.DAMAGE, listener, this, PluginListener.Priority.MEDIUM);
etc.getLoader().addListener(PluginLoader.Hook.EXPLODE, listener, this, PluginListener.Priority.HIGH); etc.getLoader().addListener(PluginLoader.Hook.EXPLODE, listener, this, PluginListener.Priority.HIGH);
if(etc.getInstance().isHealthEnabled()){ if(etc.getInstance().isHealthEnabled()){
etc.getLoader().addListener(PluginLoader.Hook.HEALTH_CHANGE, listener, this, PluginListener.Priority.MEDIUM); etc.getLoader().addListener(PluginLoader.Hook.HEALTH_CHANGE, listener, this, PluginListener.Priority.MEDIUM);

View File

@ -2,6 +2,7 @@ import java.io.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import java.util.Random;
//===================================================================== //=====================================================================
//Class: vminecraftSettings //Class: vminecraftSettings
//Use: Controls the settings for vminecraft //Use: Controls the settings for vminecraft
@ -11,7 +12,6 @@ public class vminecraftSettings {
//private final static Object syncLock = new Object(); //private final static Object syncLock = new Object();
protected static final Logger log = Logger.getLogger("Minecraft"); protected static final Logger log = Logger.getLogger("Minecraft");
private static volatile vminecraftSettings instance; private static volatile vminecraftSettings instance;
//Invulnerability List
//The feature settings //The feature settings
@ -34,7 +34,6 @@ public class vminecraftSettings {
stopFire = false, stopFire = false,
stopTnt = false, stopTnt = false,
cmdEzModo = false; cmdEzModo = false;
//An array of players currently in ezmodo //An array of players currently in ezmodo
static ArrayList<String> ezModo = new ArrayList<String>(); static ArrayList<String> ezModo = new ArrayList<String>();
//The max health for ezModo //The max health for ezModo
@ -43,6 +42,7 @@ public class vminecraftSettings {
private PropertiesFile properties; private PropertiesFile properties;
String file = "vminecraft.properties"; String file = "vminecraft.properties";
public String rules[] = new String[0]; public String rules[] = new String[0];
public static String deathMessages[] = new String[0];
//===================================================================== //=====================================================================
//Function: loadSettings //Function: loadSettings
@ -83,8 +83,10 @@ public class vminecraftSettings {
writer.write("#The health ezmodo people will have while in ezmodo. Don't set to 0\r\n"); writer.write("#The health ezmodo people will have while in ezmodo. Don't set to 0\r\n");
writer.write("ezHealth=30\r\n"); writer.write("ezHealth=30\r\n");
writer.write("stopFire=false"); writer.write("stopFire=false");
writer.write("stopTnt=false"); writer.write("stopTnt=false");
writer.write("rules=Rules@#1: No griefing@#2: No griefing\r\n"); writer.write("rules=Rules@#1: No griefing@#2: No griefing\r\n");
writer.write("#Death messages, seperate them by comma. All death messages start with the player name and a space.");
writer.write("deathMessages=is no more,died horribly,went peacefully");
} catch (Exception e) { } catch (Exception e) {
log.log(Level.SEVERE, "Exception while creating " + location, e); log.log(Level.SEVERE, "Exception while creating " + location, e);
} finally { } finally {
@ -126,7 +128,7 @@ public class vminecraftSettings {
stopFire = properties.getBoolean("stopFire",true); stopFire = properties.getBoolean("stopFire",true);
stopTnt = properties.getBoolean("stopTNT",true); stopTnt = properties.getBoolean("stopTNT",true);
rules = properties.getString("rules", "").split("@"); rules = properties.getString("rules", "").split("@");
deathMessages = properties.getString("deathmessages", "").split(",");
String[] tempEz = properties.getString("ezModo").split(","); String[] tempEz = properties.getString("ezModo").split(",");
ezModo = new ArrayList<String>(); ezModo = new ArrayList<String>();
for(int i = 0; i < tempEz.length; i++) for(int i = 0; i < tempEz.length; i++)
@ -170,13 +172,19 @@ public class vminecraftSettings {
public boolean stopFire() {return stopFire;} public boolean stopFire() {return stopFire;}
public boolean stopTnt() {return stopTnt;} public boolean stopTnt() {return stopTnt;}
//EzModo functions //EzModo methods
public boolean isEzModo(String playerName) {return ezModo.contains(playerName);} public boolean isEzModo(String playerName) {return ezModo.contains(playerName);}
public void removeEzModo(String playerName) {ezModo.remove(ezModo.indexOf(playerName));} public void removeEzModo(String playerName) {ezModo.remove(ezModo.indexOf(playerName));}
public void addEzModo(String playerName) {ezModo.add(playerName);} public void addEzModo(String playerName) {ezModo.add(playerName);}
public int ezModoHealth() {return ezHealth;} public int ezModoHealth() {return ezHealth;}
public String ezModoList() {return ezModo.toString();} public String ezModoList() {return ezModo.toString();}
//Random death message method
public static String randomDeathMsg() {
if (deathMessages == null) {
return "died";
}
return deathMessages[ (int) (Math.random() * deathMessages.length)];
}
//===================================================================== //=====================================================================
//Function: getInstance //Function: getInstance