Fixed "somebody" instead of name for new players.
This commit is contained in:
parent
1eb211f0aa
commit
ff491c1443
|
|
@ -39,6 +39,7 @@ import org.bukkit.event.block.BlockDispenseEvent;
|
|||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
||||
import org.bukkit.event.block.BlockMultiPlaceEvent;
|
||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
|
|
@ -132,6 +133,28 @@ public class BlockEventHandler implements Listener
|
|||
}
|
||||
}
|
||||
|
||||
//when a player places multiple blocks...
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||
public void onBlocksPlace(BlockMultiPlaceEvent placeEvent)
|
||||
{
|
||||
Player player = placeEvent.getPlayer();
|
||||
|
||||
//don't track in worlds where claims are not enabled
|
||||
if(!GriefPrevention.instance.claimsEnabledForWorld(placeEvent.getBlock().getWorld())) return;
|
||||
|
||||
//make sure the player is allowed to build at the location
|
||||
for(BlockState block : placeEvent.getReplacedBlockStates())
|
||||
{
|
||||
String noBuildReason = GriefPrevention.instance.allowBuild(player, block.getLocation(), block.getType());
|
||||
if(noBuildReason != null)
|
||||
{
|
||||
GriefPrevention.sendMessage(player, TextMode.Err, noBuildReason);
|
||||
placeEvent.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//when a player places a block...
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
|
||||
public void onBlockPlace(BlockPlaceEvent placeEvent)
|
||||
|
|
|
|||
|
|
@ -2236,11 +2236,11 @@ public class GriefPrevention extends JavaPlugin
|
|||
static String lookupPlayerName(UUID playerID)
|
||||
{
|
||||
//parameter validation
|
||||
if(playerID == null) return "someone";
|
||||
if(playerID == null) return "somebody";
|
||||
|
||||
//check the cache
|
||||
OfflinePlayer player = GriefPrevention.instance.getServer().getOfflinePlayer(playerID);
|
||||
if(player.hasPlayedBefore())
|
||||
if(player.hasPlayedBefore() || player.isOnline())
|
||||
{
|
||||
return player.getName();
|
||||
}
|
||||
|
|
@ -2454,9 +2454,9 @@ public class GriefPrevention extends JavaPlugin
|
|||
return reason;
|
||||
}
|
||||
|
||||
else
|
||||
//but it's fine in survival mode
|
||||
else
|
||||
{
|
||||
//but it's fine in survival mode
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user