mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Fix Additional Devices Vulnerable to Duplication Bug
This commit is contained in:
parent
66176b445a
commit
b16b936b81
@ -211,9 +211,15 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
|
||||
boolean allow = reason.equals(UnregisterReason.PLAYER_BREAK) && (BlockStorage.getBlockInfo(b, "owner").equals(p.getUniqueId().toString()) || p.hasPermission("slimefun.android.bypass"));
|
||||
|
||||
if (allow) {
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(43) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(43));
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(43) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(43));
|
||||
BlockStorage.getInventory(b).replaceExistingItem(43, null);
|
||||
}
|
||||
for (int slot: getOutputSlots()) {
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot));
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot));
|
||||
BlockStorage.getInventory(b).replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
AndroidStatusHologram.remove(b);
|
||||
}
|
||||
|
@ -86,13 +86,13 @@ public abstract class AContainer extends SlimefunItem {
|
||||
for (int slot: getInputSlots()) {
|
||||
if (inv.getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
inv.toInventory().clear(slot);
|
||||
inv.replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
for (int slot: getOutputSlots()) {
|
||||
if (inv.getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
inv.toInventory().clear(slot);
|
||||
inv.replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -141,10 +141,16 @@ public abstract class AContainer extends SlimefunItem {
|
||||
@Override
|
||||
public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) {
|
||||
for (int slot: getInputSlots()) {
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot));
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot));
|
||||
BlockStorage.getInventory(b).replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
for (int slot: getOutputSlots()) {
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot));
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot));
|
||||
BlockStorage.getInventory(b).replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
processing.remove(b);
|
||||
progress.remove(b);
|
||||
|
@ -69,7 +69,10 @@ public abstract class AFarm extends SlimefunItem {
|
||||
@Override
|
||||
public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) {
|
||||
for (int slot: getOutputSlots()) {
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot));
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot));
|
||||
BlockStorage.getInventory(b).replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -112,7 +115,10 @@ public abstract class AFarm extends SlimefunItem {
|
||||
@Override
|
||||
public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) {
|
||||
for (int slot: getOutputSlots()) {
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot));
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot));
|
||||
BlockStorage.getInventory(b).replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -88,10 +88,16 @@ public abstract class AGenerator extends SlimefunItem {
|
||||
BlockMenu inv = BlockStorage.getInventory(b);
|
||||
if (inv != null) {
|
||||
for (int slot: getInputSlots()) {
|
||||
if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
if (inv.getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
inv.replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
for (int slot: getOutputSlots()) {
|
||||
if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
if (inv.getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
inv.replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
progress.remove(b.getLocation());
|
||||
@ -141,10 +147,16 @@ public abstract class AGenerator extends SlimefunItem {
|
||||
BlockMenu inv = BlockStorage.getInventory(b);
|
||||
if (inv != null) {
|
||||
for (int slot: getInputSlots()) {
|
||||
if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
if (inv.getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
inv.replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
for (int slot: getOutputSlots()) {
|
||||
if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
if (inv.getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
inv.replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
progress.remove(b.getLocation());
|
||||
|
@ -134,13 +134,22 @@ public abstract class AReactor extends SlimefunItem {
|
||||
BlockMenu inv = BlockStorage.getInventory(b);
|
||||
if (inv != null) {
|
||||
for (int slot: getFuelSlots()) {
|
||||
if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
if (inv.getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
inv.replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
for (int slot: getCoolantSlots()) {
|
||||
if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
if (inv.getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
inv.replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
for (int slot: getOutputSlots()) {
|
||||
if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
if (inv.getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
inv.replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
progress.remove(b.getLocation());
|
||||
|
@ -211,7 +211,10 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
|
||||
@Override
|
||||
public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) {
|
||||
for (int slot: getInputSlots()) {
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot));
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot));
|
||||
BlockStorage.getInventory(b).replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -71,7 +71,10 @@ public class AnimalGrowthAccelerator extends SlimefunItem {
|
||||
public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) {
|
||||
me.mrCookieSlime.Slimefun.holograms.AnimalGrowthAccelerator.getArmorStand(b).remove();
|
||||
for (int slot: getInputSlots()) {
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot));
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot));
|
||||
BlockStorage.getInventory(b).replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -71,7 +71,10 @@ public class AutoBreeder extends SlimefunItem {
|
||||
public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) {
|
||||
me.mrCookieSlime.Slimefun.holograms.AutoBreeder.getArmorStand(b).remove();
|
||||
for (int slot: getInputSlots()) {
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot));
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot));
|
||||
BlockStorage.getInventory(b).replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -119,10 +119,16 @@ public abstract class AutomatedCraftingChamber extends SlimefunItem {
|
||||
BlockMenu inv = BlockStorage.getInventory(b);
|
||||
if (inv != null) {
|
||||
for (int slot: getInputSlots()) {
|
||||
if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
if (inv.getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
inv.replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
for (int slot: getOutputSlots()) {
|
||||
if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
if (inv.getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
inv.replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -106,7 +106,10 @@ public class CargoCraftingNode extends SlimefunItem {
|
||||
@Override
|
||||
public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) {
|
||||
for (int slot: getInputSlots()) {
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot));
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot));
|
||||
BlockStorage.getInventory(b).replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -237,7 +237,10 @@ public class CargoInputNode extends SlimefunItem {
|
||||
@Override
|
||||
public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) {
|
||||
for (int slot: getInputSlots()) {
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot));
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot));
|
||||
BlockStorage.getInventory(b).replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -81,7 +81,10 @@ public abstract class CropGrowthAccelerator extends SlimefunItem {
|
||||
@Override
|
||||
public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) {
|
||||
for (int slot: getInputSlots()) {
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot));
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot));
|
||||
BlockStorage.getInventory(b).replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -102,10 +102,16 @@ public abstract class ElectricSmeltery extends AContainer {
|
||||
BlockMenu inv = BlockStorage.getInventory(b);
|
||||
if (inv != null) {
|
||||
for (int slot: getInputSlots()) {
|
||||
if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
if (inv.getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
inv.replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
for (int slot: getOutputSlots()) {
|
||||
if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
if (inv.getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
inv.replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
progress.remove(b.getLocation());
|
||||
|
@ -81,13 +81,22 @@ public class ReactorAccessPort extends SlimefunItem {
|
||||
BlockMenu inv = BlockStorage.getInventory(b);
|
||||
if (inv != null) {
|
||||
for (int slot: getFuelSlots()) {
|
||||
if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
if (inv.getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
inv.replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
for (int slot: getCoolantSlots()) {
|
||||
if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
if (inv.getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
inv.replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
for (int slot: getOutputSlots()) {
|
||||
if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
if (inv.getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
inv.replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -130,10 +130,16 @@ public class WitherAssembler extends SlimefunItem {
|
||||
BlockMenu inv = BlockStorage.getInventory(b);
|
||||
if (inv != null) {
|
||||
for (int slot: getSoulSandSlots()) {
|
||||
if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
if (inv.getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
inv.replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
for (int slot: getWitherSkullSlots()) {
|
||||
if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
if (inv.getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
|
||||
inv.replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -70,7 +70,10 @@ public class XPCollector extends SlimefunItem {
|
||||
public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) {
|
||||
me.mrCookieSlime.Slimefun.holograms.XPCollector.getArmorStand(b).remove();
|
||||
for (int slot: getOutputSlots()) {
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot));
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) {
|
||||
b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot));
|
||||
BlockStorage.getInventory(b).replaceExistingItem(slot, null);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user