Initial 1.5 update

This commit is contained in:
GunfighterJ 2013-03-15 14:41:42 -05:00
parent fc96d7e0e9
commit 96c5bebdf2
8 changed files with 55 additions and 13 deletions

View File

@ -69,7 +69,7 @@ import org.yaml.snakeyaml.error.YAMLException;
public class Essentials extends JavaPlugin implements IEssentials public class Essentials extends JavaPlugin implements IEssentials
{ {
public static final int BUKKIT_VERSION = 2624; public static final int BUKKIT_VERSION = 2646;
private static final Logger LOGGER = Logger.getLogger("Minecraft"); private static final Logger LOGGER = Logger.getLogger("Minecraft");
private transient ISettings settings; private transient ISettings settings;
private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this); private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this);

View File

@ -1168,4 +1168,28 @@ public class OfflinePlayer implements Player
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException("Not supported yet.");
} }
@Override
public void setCustomName(String string)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getCustomName()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setCustomNameVisible(boolean bln)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean isCustomNameVisible()
{
throw new UnsupportedOperationException("Not supported yet.");
}
} }

View File

@ -253,7 +253,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
{ {
setLastLocation(getLocation()); setLastLocation(getLocation());
} }
@Override @Override
public void setLogoutLocation() public void setLogoutLocation()
{ {

View File

@ -510,6 +510,8 @@ protect:
portal-creation: false portal-creation: false
tnt-explosion: false tnt-explosion: false
tnt-playerdamage: false tnt-playerdamage: false
tnt-minecart-explosion: false
tnt-minecart-playerdamage: false
fireball-explosion: false fireball-explosion: false
fireball-fire: false fireball-fire: false
fireball-playerdamage: false fireball-playerdamage: false

View File

@ -102,7 +102,14 @@ public class EssentialsProtectEntityListener implements Listener
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
if (eAttack instanceof MinecartTNT && prot.getSettingBool(ProtectConfig.prevent_tntminecart_playerdmg)
&& !(target instanceof Player && shouldBeDamaged(user, "tnt-minecart")))
{
event.setCancelled(true);
return;
}
// PVP Settings // PVP Settings
if (target instanceof Player && eAttack instanceof Player if (target instanceof Player && eAttack instanceof Player
&& prot.getSettingBool(ProtectConfig.disable_pvp) && prot.getSettingBool(ProtectConfig.disable_pvp)
@ -185,9 +192,10 @@ public class EssentialsProtectEntityListener implements Listener
{ {
return; return;
} }
Entity entity = event.getEntity();
final int maxHeight = ess.getSettings().getProtectCreeperMaxHeight(); final int maxHeight = ess.getSettings().getProtectCreeperMaxHeight();
if (event.getEntity() instanceof EnderDragon if (entity instanceof EnderDragon
&& prot.getSettingBool(ProtectConfig.prevent_enderdragon_blockdmg)) && prot.getSettingBool(ProtectConfig.prevent_enderdragon_blockdmg))
{ {
event.setCancelled(true); event.setCancelled(true);
@ -197,12 +205,12 @@ public class EssentialsProtectEntityListener implements Listener
} }
return; return;
} }
if (event.getEntity() instanceof Wither if (entity instanceof Wither
&& prot.getSettingBool(ProtectConfig.prevent_wither_spawnexplosion)) && prot.getSettingBool(ProtectConfig.prevent_wither_spawnexplosion))
{ {
event.setCancelled(true); event.setCancelled(true);
} }
else if (event.getEntity() instanceof Creeper else if (entity instanceof Creeper
&& (prot.getSettingBool(ProtectConfig.prevent_creeper_explosion) && (prot.getSettingBool(ProtectConfig.prevent_creeper_explosion)
|| prot.getSettingBool(ProtectConfig.prevent_creeper_blockdmg) || prot.getSettingBool(ProtectConfig.prevent_creeper_blockdmg)
|| (maxHeight >= 0 && event.getLocation().getBlockY() > maxHeight))) || (maxHeight >= 0 && event.getLocation().getBlockY() > maxHeight)))
@ -211,23 +219,27 @@ public class EssentialsProtectEntityListener implements Listener
event.setCancelled(true); event.setCancelled(true);
event.getLocation().getWorld().createExplosion(event.getLocation(), 0F); event.getLocation().getWorld().createExplosion(event.getLocation(), 0F);
} }
else if (event.getEntity() instanceof TNTPrimed else if (entity instanceof TNTPrimed
&& prot.getSettingBool(ProtectConfig.prevent_tnt_explosion)) && prot.getSettingBool(ProtectConfig.prevent_tnt_explosion))
{ {
event.setCancelled(true); event.setCancelled(true);
} }
else if ((event.getEntity() instanceof Fireball || event.getEntity() instanceof SmallFireball) else if ((entity instanceof Fireball || entity instanceof SmallFireball)
&& prot.getSettingBool(ProtectConfig.prevent_fireball_explosion)) && prot.getSettingBool(ProtectConfig.prevent_fireball_explosion))
{ {
event.setCancelled(true); event.setCancelled(true);
} }
else if ((event.getEntity() instanceof WitherSkull) else if ((entity instanceof WitherSkull)
&& prot.getSettingBool(ProtectConfig.prevent_witherskull_explosion)) && prot.getSettingBool(ProtectConfig.prevent_witherskull_explosion))
{ {
event.setCancelled(true); event.setCancelled(true);
}
else if ((entity instanceof MinecartTNT)
&& prot.getSettingBool(ProtectConfig.prevent_tntminecart_explosion))
{
event.setCancelled(true);
} }
} }
@ -304,9 +316,11 @@ public class EssentialsProtectEntityListener implements Listener
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPaintingBreak(HangingBreakByEntityEvent event) public void onPaintingBreak(HangingBreakByEntityEvent event)
{ {
if (event.getCause() == HangingBreakEvent.RemoveCause.ENTITY if ((event.getCause() == HangingBreakEvent.RemoveCause.ENTITY)
&& event.getRemover() instanceof Creeper && ((event.getRemover() instanceof Creeper) && prot.getSettingBool(ProtectConfig.prevent_creeper_explosion)
&& prot.getSettingBool(ProtectConfig.prevent_creeper_explosion)) || (((event.getRemover() instanceof Fireball) || (event.getRemover() instanceof SmallFireball)) && prot.getSettingBool(ProtectConfig.prevent_fireball_explosion))
|| ((event.getRemover() instanceof TNTPrimed) && prot.getSettingBool(ProtectConfig.prevent_tnt_explosion))
|| ((event.getRemover() instanceof WitherSkull) && prot.getSettingBool(ProtectConfig.prevent_witherskull_explosion))))
{ {
event.setCancelled(true); event.setCancelled(true);
} }

View File

@ -27,6 +27,8 @@ public enum ProtectConfig
prevent_block_on_rail("protect.protect.prevent-block-on-rails", false), prevent_block_on_rail("protect.protect.prevent-block-on-rails", false),
prevent_tnt_explosion("protect.prevent.tnt-explosion", false), prevent_tnt_explosion("protect.prevent.tnt-explosion", false),
prevent_tnt_playerdmg("protect.prevent.tnt-playerdamage", false), prevent_tnt_playerdmg("protect.prevent.tnt-playerdamage", false),
prevent_tntminecart_explosion("protect.prevent.tnt-minecart-explosion", false),
prevent_tntminecart_playerdmg("protect.prevent.tnt-minecart-playerdamage", false),
prevent_fireball_explosion("protect.prevent.fireball-explosion", false), prevent_fireball_explosion("protect.prevent.fireball-explosion", false),
prevent_fireball_fire("protect.prevent.fireball-fire", false), prevent_fireball_fire("protect.prevent.fireball-fire", false),
prevent_fireball_playerdmg("protect.prevent.fireball-playerdamage", false), prevent_fireball_playerdmg("protect.prevent.fireball-playerdamage", false),

Binary file not shown.

Binary file not shown.