1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Merge pull request #3 from TheBusyBiscuit/master

update to master
This commit is contained in:
dniym 2019-08-19 00:55:28 -04:00 committed by GitHub
commit 21f2eb9793
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 567 additions and 549 deletions

View File

@ -112,7 +112,7 @@
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId>
<version>7.0.0</version>
<version>7.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>

File diff suppressed because it is too large Load Diff

View File

@ -1536,6 +1536,7 @@ public class SlimefunSetup {
@Override
public boolean onBlockBreak(BlockBreakEvent e, ItemStack item, int fortune, List<ItemStack> drops) {
if (SlimefunManager.isItemSimiliar(item, SlimefunItems.AUTO_SMELT_PICKAXE, true)) {
if (BlockStorage.hasBlockInfo(e.getBlock())) return true;
if (e.getBlock().getType().equals(Material.PLAYER_HEAD)) return true;
int j = -1;
@ -1838,17 +1839,18 @@ public class SlimefunSetup {
@Override
public boolean onBlockBreak(BlockBreakEvent e, ItemStack item, int fortune, List<ItemStack> drops) {
if (SlimefunManager.isItemSimiliar(item, SlimefunItems.PICKAXE_OF_CONTAINMENT, true)) {
if (e.getBlock().getType() != Material.SPAWNER) return true;
BlockStorage.clearBlockInfo(e.getBlock());
Block b = e.getBlock(); // Refactored it into this so we don't need to call e.getBlock() all the time.
if (b.getType() != Material.SPAWNER || BlockStorage.hasBlockInfo(b)) return true;
// If the spawner's BlockStorage has BlockInfo, then it's not a vanilla spawner and shouldn't give a broken spawner.
ItemStack spawner = SlimefunItems.BROKEN_SPAWNER.clone();
ItemMeta im = spawner.getItemMeta();
List<String> lore = im.getLore();
for (int i = 0; i < lore.size(); i++) {
if (lore.get(i).contains("<Type>")) lore.set(i, lore.get(i).replace("<Type>", StringUtils.format(((CreatureSpawner) e.getBlock().getState()).getSpawnedType().toString())));
if (lore.get(i).contains("<Type>")) lore.set(i, lore.get(i).replace("<Type>", StringUtils.format(((CreatureSpawner) b.getState()).getSpawnedType().toString())));
}
im.setLore(lore);
spawner.setItemMeta(im);
e.getBlock().getLocation().getWorld().dropItemNaturally(e.getBlock().getLocation(), spawner);
b.getLocation().getWorld().dropItemNaturally(b.getLocation(), spawner);
e.setExpToDrop(0);
return true;
}
@ -2179,7 +2181,7 @@ public class SlimefunSetup {
for (int y = -1; y <= 1; y++) {
for (int z = -1; z <= 1; z++) {
Block b = e.getBlock().getRelative(x, y, z);
if (b.getType() != Material.AIR && !StringUtils.equals(b.getType().toString(), explosiveblacklist)) {
if (b.getType() != Material.AIR && !b.isLiquid() && !StringUtils.equals(b.getType().toString(), explosiveblacklist)) {
if (CSCoreLib.getLib().getProtectionManager().canBuild(e.getPlayer().getUniqueId(), b)) {
if (SlimefunStartup.instance.isCoreProtectInstalled()) SlimefunStartup.instance.getCoreProtectAPI().logRemoval(e.getPlayer().getName(), b.getLocation(), b.getType(), b.getBlockData());
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getType());

View File

@ -2,12 +2,15 @@ package me.mrCookieSlime.Slimefun.listeners;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.ChestedHorse;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
@ -105,13 +108,21 @@ public class DamageListener implements Listener {
}
if (!e.getEntity().getCanPickupItems() && Talisman.checkFor(e, SlimefunItem.getByID("HUNTER_TALISMAN")) && !(e.getEntity() instanceof Player)) {
List<ItemStack> newDrops = new ArrayList<ItemStack>();
for (ItemStack drop : e.getDrops()) {
newDrops.add(drop);
newDrops.add(drop);
}
for (ItemStack drop : newDrops) {
e.getDrops().add(drop);
}
if(e.getEntity() instanceof ChestedHorse) {
for(ItemStack invItem : ((ChestedHorse) e.getEntity()).getInventory().getStorageContents()) {
e.getDrops().remove(invItem);
}
e.getDrops().remove(new ItemStack(Material.CHEST)); //The chest is not included in getStorageContents()
}
}
}
}