1
0
mirror of https://e.coding.net/circlecloud/JumpPlate.git synced 2025-11-25 19:46:01 +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> <modelVersion>4.0.0</modelVersion>
<groupId>cn.citycraft</groupId> <groupId>cn.citycraft</groupId>
<artifactId>JumpPlate</artifactId> <artifactId>JumpPlate</artifactId>
<version>1.2</version> <version>1.3</version>
<name>JumpPlate</name> <name>JumpPlate</name>
<build> <build>
<finalName>${project.name}</finalName> <finalName>${project.name}</finalName>
@@ -54,7 +54,7 @@
</build> </build>
<properties> <properties>
<jenkins.url>http://ci.citycraft.cn:8080</jenkins.url> <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> <update.changes></update.changes>
<env.GIT_COMMIT>DEBUG</env.GIT_COMMIT> <env.GIT_COMMIT>DEBUG</env.GIT_COMMIT>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <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) { public void onFallDamage(final EntityDamageEvent e) {
if (e.getEntity() instanceof Player) { if (e.getEntity() instanceof Player) {
final Player p = (Player) e.getEntity(); final Player p = (Player) e.getEntity();
if (e.getCause() == DamageCause.FALL && (fall.contains(p.getName()))) { if (e.getCause() == DamageCause.FALL && fall.contains(p.getName())) {
final Location gb = p.getLocation(); final Block gb = p.getLocation().getBlock();
final Block loc = gb.add(0.0D, -1.0D, 0.0D).getBlock(); final Block loc = gb.getRelative(BlockFace.DOWN);
final Block loc_1 = gb.add(0.0D, -1.0D, 0.0D).getBlock(); final Block loc_1 = gb.getRelative(BlockFace.DOWN, 2);
final Block loc_2 = gb.add(0.0D, -1.0D, 0.0D).getBlock(); 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())) { 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); 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 = gb.getRelative(BlockFace.DOWN);
final Block loc_1 = gb.getRelative(BlockFace.DOWN, 2); final Block loc_1 = gb.getRelative(BlockFace.DOWN, 2);
final Block loc_2 = gb.getRelative(BlockFace.DOWN, 3); 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")) { if (!p.hasPermission("JumpPlate.use")) {
p.sendMessage(pluginname + config.getMessage("no-permission")); p.sendMessage(pluginname + config.getMessage("no-permission"));
return; return;
} }
switch (loc.getType()) { switch (loc.getType()) {
case IRON_BLOCK: case IRON_BLOCK:
fall.add(p.getName());
p.setVelocity(p.getVelocity().setY(1)); p.setVelocity(p.getVelocity().setY(1));
break; break;
case GOLD_BLOCK: case GOLD_BLOCK:
fall.add(p.getName());
p.setVelocity(p.getVelocity().setY(1.5)); p.setVelocity(p.getVelocity().setY(1.5));
break; break;
case DIAMOND_BLOCK: case DIAMOND_BLOCK:
fall.add(p.getName());
p.setVelocity(p.getVelocity().setY(2)); p.setVelocity(p.getVelocity().setY(2));
break; break;
case EMERALD_BLOCK: case EMERALD_BLOCK:
fall.add(p.getName());
p.setVelocity(p.getVelocity().setY(2.5)); p.setVelocity(p.getVelocity().setY(2.5));
break; break;
case BEDROCK: case BEDROCK:
fall.add(p.getName());
p.setVelocity(p.getVelocity().setY(config.getDouble("BEDROCK"))); p.setVelocity(p.getVelocity().setY(config.getDouble("BEDROCK")));
break; break;
default: default:
break; break;
} }
fall.add(p.getName());
} }
} }