本帖最后由 Junior_Mo 于 2019-3-8 18:42 编辑
DelUU
一款可以删除uu机内可复制物品的插件
腐竹们是否因为uu机内可以复制加速火把而烦恼?
因为加速火把的存在而ban掉uu机?
那么这款插件可以解决您的烦恼
本插件由Another Star开发,转载请注明出处
插件源码:
- package com.gkukhg.deluu;
- import java.io.File;
- import java.lang.reflect.Field;
- import java.lang.reflect.InvocationTargetException;
- import java.lang.reflect.Method;
- import java.util.HashSet;
- import java.util.Iterator;
- import java.util.List;
- import java.util.Map;
- import java.util.Set;
- import net.minecraft.block.Block;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemStack;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.plugin.java.JavaPlugin;
- public class DelUU
- extends JavaPlugin
- {
- private List<Integer> delIdList;
- private Set<Item> delItemList;
-
- public void onEnable()
- {
- if (!getDataFolder().exists()) {
- getDataFolder().mkdir();
- }
- File file = new File(getDataFolder(), "config.yml");
- if (!file.exists()) {
- saveDefaultConfig();
- }
- reloadConfig();
- this.delIdList = getConfig().getIntegerList("delid");
- try
- {
- Class uuc = Class.forName("ic2.core.uu.UuGraph");
- Class toc = Class.forName("com.sci.torcherino.init.ModBlocks");
- Class iswc = Class.forName("ic2.core.util.ItemStackWrapper");
- Method gifb = Item.class.getMethod("func_150898_a", new Class[] { Block.class });
- Method gibi = Item.class.getMethod("func_150899_d", new Class[] { Integer.TYPE });
- Method gi = ItemStack.class.getMethod("func_77973_b", new Class[0]);
- Field n1 = uuc.getDeclaredField("nodes");
- Field n2 = uuc.getDeclaredField("itemNodes");
- Field to = toc.getField("torcherino");
- Field is = iswc.getField("stack");
- this.delItemList = new HashSet();
- for (Integer i : this.delIdList) {
- this.delItemList.add((Item)gibi.invoke(null, new Object[] { i }));
- }
- n1.setAccessible(true);
- n2.setAccessible(true);
- Map nm1 = (Map)n1.get(null);
- Map nm2 = (Map)n2.get(null);
-
- Item toi = (Item)gifb.invoke(null, new Object[] { to.get(null) });
- Iterator it1 = nm1.keySet().iterator();
- Iterator it2 = nm2.keySet().iterator();
- while (it1.hasNext())
- {
- ItemStack t = (ItemStack)is.get(it1.next());
- if (this.delItemList.contains(gi.invoke(t, new Object[0]))) {
- it1.remove();
- }
- }
- while (it2.hasNext()) {
- if (this.delItemList.contains(it2.next())) {
- it2.remove();
- }
- }
- }
- catch (ClassNotFoundException|NoSuchFieldException|SecurityException|IllegalArgumentException|IllegalAccessException|NoSuchMethodException|InvocationTargetException e)
- {
- e.printStackTrace();
- }
- }
- }
复制代码 |
插件下载:
配置文件:
- delid:
- #格式
- #- 禁用uu机物品的数字id
- #默认禁用id:1
- - 1
复制代码 |
使用方法:
将插件放入服务器plugins,重启或者使用yum插件重载
生成配置文件
打开配置文件将需要删除复制的物品id填入保存重载即可
作者留言:
如果出现bug或者其他问题可以找作者提交
请各位大佬多评分多回复
更新日志:
于2019年2月23日修复Bug,并作为正式版发布
于2019年2月24日修复一个特别傻的Bug