Added logging for ghast fireballs

This commit is contained in:
Robin Kupper
2011-03-30 16:15:25 +02:00
parent 68cf395ce1
commit fc158bc1ab
2 changed files with 12 additions and 2 deletions

View File

@@ -26,6 +26,7 @@ public class Config {
boolean logChestAccess;
String logTNTExplosionsAs;
String logCreeperExplosionsAs;
String logFireballExplosionsAs;
String logFireAs;
String logLeavesDecayAs;
boolean usePermissions;
@@ -76,6 +77,8 @@ public class Config {
config.setProperty("logTNTExplosionsAs", "TNT");
if (!keys.contains("logCreeperExplosionsAs"))
config.setProperty("logCreeperExplosionsAs", "Creeper");
if (!keys.contains("logFireballExplosionsAs"))
config.setProperty("logFireballExplosionsAs", "Ghast");
if (!keys.contains("logFireAs"))
config.setProperty("logFireAs", "Fire");
if (!keys.contains("logLeavesDecayAs"))
@@ -104,6 +107,7 @@ public class Config {
logLeavesDecay = config.getBoolean("logLeavesDecay", false);
logTNTExplosionsAs = config.getString("logTNTExplosionsAs");
logCreeperExplosionsAs = config.getString("logCreeperExplosionsAs");
logFireballExplosionsAs = config.getString("logFireballExplosionsAs");
logFireAs = config.getString("logFireAs");
logLeavesDecayAs = config.getString("logLeavesDecayAs");
usePermissions = config.getBoolean("usePermissions", false);

View File

@@ -19,6 +19,8 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.Fireball;
import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.Event;
@@ -301,7 +303,7 @@ public class LogBlock extends JavaPlugin
if (!dbm.getTables(null, null, "lb-players", null).next())
return false;
}
state.execute("INSERT IGNORE INTO `lb-players` (`playername`) VALUES ('" + config.logTNTExplosionsAs + "'), ('" + config.logCreeperExplosionsAs + "'), ('" + config.logFireAs + "'), ('" + config.logLeavesDecayAs + "')");
state.execute("INSERT IGNORE INTO `lb-players` (`playername`) VALUES ('" + config.logTNTExplosionsAs + "'), ('" + config.logCreeperExplosionsAs + "'), ('" + config.logFireAs + "'), ('" + config.logLeavesDecayAs + "'), ('" + config.logFireballExplosionsAs + "'), ('Environment')");
for (int i = 0; i < config.worldNames.size(); i++) {
String table = config.worldTables.get(i);
if (!dbm.getTables(null, null, table, null).next()) {
@@ -456,8 +458,12 @@ public class LogBlock extends JavaPlugin
String name;
if (event.getEntity() instanceof TNTPrimed)
name = config.logTNTExplosionsAs;
else
else if (event.getEntity() instanceof Creeper)
name = config.logCreeperExplosionsAs;
else if (event.getEntity() instanceof Fireball)
name = config.logFireballExplosionsAs;
else
name = "Environment";
for (Block block : event.blockList())
queueBlock(name, block, block.getTypeId(), 0, block.getData());
}