forked from Upstream/mmocore
Slightly improved where custom block drops spawn
This commit is contained in:
parent
17d99ace1b
commit
df52b2c679
@ -89,15 +89,22 @@ public class BlockListener implements Listener {
|
|||||||
if (info.hasTriggers() && !block.hasMetadata("player_placed")) {
|
if (info.hasTriggers() && !block.hasMetadata("player_placed")) {
|
||||||
PlayerData playerData = PlayerData.get(player);
|
PlayerData playerData = PlayerData.get(player);
|
||||||
info.getTriggers().forEach(trigger -> trigger.apply(playerData));
|
info.getTriggers().forEach(trigger -> trigger.apply(playerData));
|
||||||
/**if (!block.hasMetadata("player_placed") && info.hasExperience() && MMOCore.plugin.hasHolograms())
|
/**
|
||||||
MMOCore.plugin.hologramSupport.displayIndicator(block.getLocation().add(.5, 1.5, .5), MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + called.getGainedExperience().getValue()).message(), player);*/
|
* if (!block.hasMetadata("player_placed") &&
|
||||||
|
* info.hasExperience() && MMOCore.plugin.hasHolograms())
|
||||||
|
* MMOCore.plugin.hologramSupport.displayIndicator(block.getLocation().add(.5,
|
||||||
|
* 1.5, .5),
|
||||||
|
* MMOCore.plugin.configManager.getSimpleMessage("exp-hologram",
|
||||||
|
* "exp", "" +
|
||||||
|
* called.getGainedExperience().getValue()).message(), player);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* apply drop tables
|
* apply drop tables
|
||||||
*/
|
*/
|
||||||
if (info.hasDropTable()) {
|
if (info.hasDropTable()) {
|
||||||
Location dropLocation = getSafeDropLocation(block, !info.hasDropTable());
|
Location dropLocation = getSafeDropLocation(block, true);
|
||||||
for (ItemStack drop : called.getDrops())
|
for (ItemStack drop : called.getDrops())
|
||||||
if (drop.getType() != Material.AIR && drop.getAmount() > 0)
|
if (drop.getType() != Material.AIR && drop.getAmount() > 0)
|
||||||
block.getWorld().dropItemNaturally(dropLocation, drop);
|
block.getWorld().dropItemNaturally(dropLocation, drop);
|
||||||
@ -134,7 +141,8 @@ public class BlockListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void c1(BlockPistonExtendEvent event) {
|
public void c1(BlockPistonExtendEvent event) {
|
||||||
Block movedBlock = event.getBlock();
|
Block movedBlock = event.getBlock();
|
||||||
if(!movedBlock.hasMetadata("player_placed")) return;
|
if (!movedBlock.hasMetadata("player_placed"))
|
||||||
|
return;
|
||||||
BlockFace direction = event.getDirection();
|
BlockFace direction = event.getDirection();
|
||||||
movedBlock = movedBlock.getRelative(direction, 2);
|
movedBlock = movedBlock.getRelative(direction, 2);
|
||||||
|
|
||||||
@ -145,6 +153,7 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void c2(BlockPistonRetractEvent event) {
|
public void c2(BlockPistonRetractEvent event) {
|
||||||
BlockFace direction = event.getDirection();
|
BlockFace direction = event.getDirection();
|
||||||
|
@ -124,7 +124,7 @@ public class CustomBlockManager extends MMOManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class BlockInfo {
|
public class BlockInfo {
|
||||||
private Material block;
|
private final Material block;
|
||||||
private final DropTable table;
|
private final DropTable table;
|
||||||
private final boolean vanillaDrops;
|
private final boolean vanillaDrops;
|
||||||
private final String headValue;
|
private final String headValue;
|
||||||
|
Loading…
Reference in New Issue
Block a user