From 7dcda9b2d97fba0fa6c84412926bda2efafaf77d Mon Sep 17 00:00:00 2001 From: j502647092 Date: Sat, 1 Aug 2015 17:05:02 +0800 Subject: [PATCH] fix onPlayerMove NullPointerException... Signed-off-by: j502647092 --- pom.xml | 2 +- .../listeners/ResidencePlayerListener.java | 25 +++++++++++-------- src/plugin.yml | 2 +- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 6176bc5..ab8b4ab 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 cn.CityCraft Residence - 2.7.0.5-SNAPSHOT + 2.7.0.6-SNAPSHOT Residence ${project.name} diff --git a/src/com/bekvon/bukkit/residence/listeners/ResidencePlayerListener.java b/src/com/bekvon/bukkit/residence/listeners/ResidencePlayerListener.java index 311d941..51689be 100644 --- a/src/com/bekvon/bukkit/residence/listeners/ResidencePlayerListener.java +++ b/src/com/bekvon/bukkit/residence/listeners/ResidencePlayerListener.java @@ -196,8 +196,8 @@ public class ResidencePlayerListener implements Listener { ActionBar.send( player, (new StringBuilder()).append(ChatColor.YELLOW) - .append(insertMessages(player, areaname, res, enterMessage)) - .toString()); + .append(insertMessages(player, areaname, res, enterMessage)) + .toString()); } else { player.sendMessage(ChatColor.YELLOW + this.insertMessages(player, areaname, res, enterMessage)); @@ -245,7 +245,7 @@ public class ResidencePlayerListener implements Listener { || mat == Material.PISTON_STICKY_BASE || mat == Material.DRAGON_EGG || Residence.getConfigManager().getCustomBothClick() - .contains(Integer.valueOf(block.getTypeId())); + .contains(Integer.valueOf(block.getTypeId())); } private boolean isCanUseEntity_RClickOnly(Material mat, Block block) { @@ -264,14 +264,14 @@ public class ResidencePlayerListener implements Listener { || mat == Material.BREWING_STAND || mat == Material.ENCHANTMENT_TABLE || Residence.getConfigManager().getCustomRightClick() - .contains(Integer.valueOf(block.getTypeId())); + .contains(Integer.valueOf(block.getTypeId())); } private boolean isContainer(Material mat, Block block) { return FlagPermissions.getMaterialUseFlagList().containsKey(mat) && FlagPermissions.getMaterialUseFlagList().get(mat).equals("container") || Residence.getConfigManager().getCustomContainers() - .contains(Integer.valueOf(block.getTypeId())); + .contains(Integer.valueOf(block.getTypeId())); } @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) @@ -415,16 +415,16 @@ public class ResidencePlayerListener implements Listener { player.sendMessage(ChatColor.GREEN + Residence.getLanguage().getPhrase("SelectPoint", Residence.getLanguage().getPhrase("Primary")) - + ChatColor.RED + "(" + loc.getBlockX() + "," + loc.getBlockY() - + "," + loc.getBlockZ() + ")" + ChatColor.GREEN + "!"); + + ChatColor.RED + "(" + loc.getBlockX() + "," + loc.getBlockY() + + "," + loc.getBlockZ() + ")" + ChatColor.GREEN + "!"); } else if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { Location loc = block.getLocation(); Residence.getSelectionManager().placeLoc2(player, loc); player.sendMessage(ChatColor.GREEN + Residence.getLanguage().getPhrase("SelectPoint", Residence.getLanguage().getPhrase("Secondary")) - + ChatColor.RED + "(" + loc.getBlockX() + "," + loc.getBlockY() - + "," + loc.getBlockZ() + ")" + ChatColor.GREEN + "!"); + + ChatColor.RED + "(" + loc.getBlockX() + "," + loc.getBlockY() + + "," + loc.getBlockZ() + ")" + ChatColor.GREEN + "!"); } event.setCancelled(true); } @@ -452,7 +452,7 @@ public class ResidencePlayerListener implements Listener { || player.getItemInHand().getData().getData() == 3 && block.getTypeId() == 17 && (block.getData() == 3 || block.getData() == 7 - || block.getData() == 11 || block.getData() == 15)) { + || block.getData() == 11 || block.getData() == 15)) { perms = Residence.getPermsByLocForPlayer( block.getRelative(event.getBlockFace()).getLocation(), player); @@ -610,8 +610,11 @@ public class ResidencePlayerListener implements Listener { Player player = event.getPlayer(); if (player == null) return; - long last = lastUpdate.get(player.getName()); long now = System.currentTimeMillis(); + if (!lastUpdate.containsKey(player.getName())) { + lastUpdate.put(player.getName(), now); + } + long last = lastUpdate.get(player.getName()); if (now - last < Residence.getConfigManager().getMinMoveUpdateInterval()) return; lastUpdate.put(player.getName(), now); diff --git a/src/plugin.yml b/src/plugin.yml index c56ce2b..790de35 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: Residence main: com.bekvon.bukkit.residence.ResidenceCommandListener -version: 2.7.0.5 +version: 2.7.0.6 website: http://ci.citycraft.cn:8800/jenkins/job/Residence-Fix/ description: Cuboid Residence Plugin authors: [bekvon,nate302,t00thpick1,喵♂呜]