1
0
mirror of https://e.coding.net/circlecloud/JumpPlate.git synced 2024-12-28 07:49:11 +00:00

修复使用跳板后不扣血的问题...

Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
502647092 2016-02-21 22:28:31 +08:00
parent 4c4eb95d54
commit 69ed966373
2 changed files with 10 additions and 14 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>cn.citycraft</groupId>
<artifactId>JumpPlate</artifactId>
<version>1.2</version>
<version>1.3</version>
<name>JumpPlate</name>
<build>
<finalName>${project.name}</finalName>
@ -54,7 +54,7 @@
</build>
<properties>
<jenkins.url>http://ci.citycraft.cn:8080</jenkins.url>
<update.description>&amp;c修复跳板命令问题...</update.description>
<update.description>&amp;c修复使用跳板后不扣血的问题...</update.description>
<update.changes></update.changes>
<env.GIT_COMMIT>DEBUG</env.GIT_COMMIT>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

View File

@ -69,13 +69,13 @@ public class JumpPlate extends JavaPlugin implements Listener, HandlerCommands {
public void onFallDamage(final EntityDamageEvent e) {
if (e.getEntity() instanceof Player) {
final Player p = (Player) e.getEntity();
if (e.getCause() == DamageCause.FALL && (fall.contains(p.getName()))) {
final Location gb = p.getLocation();
final Block loc = gb.add(0.0D, -1.0D, 0.0D).getBlock();
final Block loc_1 = gb.add(0.0D, -1.0D, 0.0D).getBlock();
final Block loc_2 = gb.add(0.0D, -1.0D, 0.0D).getBlock();
if (e.getCause() == DamageCause.FALL && fall.contains(p.getName())) {
final Block gb = p.getLocation().getBlock();
final Block loc = gb.getRelative(BlockFace.DOWN);
final Block loc_1 = gb.getRelative(BlockFace.DOWN, 2);
final Block loc_2 = gb.getRelative(BlockFace.DOWN, 3);
if (loc_1.getType() != Material.GLASS || loc_2.getType() != Material.LAPIS_BLOCK || !ml.contains(loc.getType())) {
fall.remove(p);
fall.remove(p.getName());
}
e.setDamage(DamageModifier.BASE, 0);
}
@ -95,35 +95,31 @@ public class JumpPlate extends JavaPlugin implements Listener, HandlerCommands {
final Block loc = gb.getRelative(BlockFace.DOWN);
final Block loc_1 = gb.getRelative(BlockFace.DOWN, 2);
final Block loc_2 = gb.getRelative(BlockFace.DOWN, 3);
if ((loc_1.getType() == Material.GLASS) && (loc_2.getType() == Material.LAPIS_BLOCK)) {
if (loc_1.getType() == Material.GLASS && loc_2.getType() == Material.LAPIS_BLOCK && ml.contains(loc.getType())) {
if (!p.hasPermission("JumpPlate.use")) {
p.sendMessage(pluginname + config.getMessage("no-permission"));
return;
}
switch (loc.getType()) {
case IRON_BLOCK:
fall.add(p.getName());
p.setVelocity(p.getVelocity().setY(1));
break;
case GOLD_BLOCK:
fall.add(p.getName());
p.setVelocity(p.getVelocity().setY(1.5));
break;
case DIAMOND_BLOCK:
fall.add(p.getName());
p.setVelocity(p.getVelocity().setY(2));
break;
case EMERALD_BLOCK:
fall.add(p.getName());
p.setVelocity(p.getVelocity().setY(2.5));
break;
case BEDROCK:
fall.add(p.getName());
p.setVelocity(p.getVelocity().setY(config.getDouble("BEDROCK")));
break;
default:
break;
}
fall.add(p.getName());
}
}