revert my changes (#158)

This commit is contained in:
super 2019-11-28 13:21:54 -05:00 committed by Seth
parent 0ab0ca2c66
commit 421315a31c
3 changed files with 2 additions and 68 deletions

View File

@ -12,7 +12,6 @@ import me.totalfreedom.totalfreedommod.blocking.BlockBlocker;
import me.totalfreedom.totalfreedommod.blocking.EditBlocker;
import me.totalfreedom.totalfreedommod.blocking.EventBlocker;
import me.totalfreedom.totalfreedommod.blocking.InteractBlocker;
import me.totalfreedom.totalfreedommod.blocking.InventoryBlocker;
import me.totalfreedom.totalfreedommod.blocking.MobBlocker;
import me.totalfreedom.totalfreedommod.blocking.PVPBlocker;
import me.totalfreedom.totalfreedommod.blocking.PotionBlocker;
@ -88,7 +87,6 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
public MobBlocker mb;
public InteractBlocker ib;
public PotionBlocker pb;
public InventoryBlocker inb;
public LoginProcess lp;
public AntiNuke nu;
public AntiSpam as;
@ -196,7 +194,6 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
mb = services.registerService(MobBlocker.class);
ib = services.registerService(InteractBlocker.class);
pb = services.registerService(PotionBlocker.class);
inb = services.registerService(InventoryBlocker.class);
lp = services.registerService(LoginProcess.class);
nu = services.registerService(AntiNuke.class);
as = services.registerService(AntiSpam.class);

View File

@ -1,63 +0,0 @@
package me.totalfreedom.totalfreedommod.blocking;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import net.minecraft.server.v1_14_R1.NBTTagCompound;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_14_R1.inventory.CraftItemStack;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;
public class InventoryBlocker extends FreedomService
{
public InventoryBlocker(TotalFreedomMod plugin)
{
super(plugin);
}
private BukkitTask inventoryChecker;
@Override
protected void onStart()
{
inventoryChecker = new BukkitRunnable()
{
@Override
public void run()
{
for (Player player : Bukkit.getOnlinePlayers())
{
Inventory inv = player.getInventory();
for (int i = 0; i < inv.getSize(); i++)
{
ItemStack item = inv.getItem(i);
if (item == null)
continue;
if (!item.hasItemMeta())
continue;
if (item.getType() == Material.JUKEBOX)
{
if (!CraftItemStack.asNMSCopy(item).hasTag())
continue;
net.minecraft.server.v1_14_R1.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
NBTTagCompound compound = nmsItem.getTag();
compound.set("BlockEntityTag", null);
inv.setItem(i, new ItemStack(CraftItemStack.asBukkitCopy(nmsItem)));
}
}
}
}
}.runTaskTimer(plugin, 0L, 1);
}
@Override
protected void onStop()
{
inventoryChecker.cancel();
inventoryChecker = null;
}
}