[MECH/RPG] CraftGroup v0.3.1 - Prevent crafting of specific items and blocks [1000]

Discussion in 'Inactive/Unsupported Plugins' started by FrozenBrain, Jul 10, 2011.

  1. Offline

    FrozenBrain

    CraftGroup - Prevent crafting of specific items and blocks
    Version: v0.3.1
    CraftBukkit Build: 1000

    CraftGroup lets you assign so-called CraftGroups to the players of your server via Permissions. Those CraftGroups can be used to prevent crafting, smelting, using, placing or breaking of specific items and blocks. This is propably most useful for RPG servers.

    How to use:
    Show Spoiler

    Download the plugin and drop it in your plugins folder. After the first run, BukkitContrib will be downloaded (if it's not installed already) and a file called "config.yml" will be created inside the plugins/CraftGroup directory.

    You can now create new CraftGroups by simply adding a new node to this file.

    Example:
    Code:
    version: 13
    
    global-blacklist:
        break:
    # Don't break TNT
        - -TNT
        craft:
    # Don't craft orange wool
        - -WOOL:1
        use:
    # Don't use golden apples
        - -GOLDEN_APPLE
        place:
    Blaster:
        break:
        craft:
    # Even though the global-blacklist prevents everyone from crafting TNT,
    # we can whitelist it here again.
        - TNT
        use:
        place:
    Note: The 'use' rules are quite buggy. That's not my fault, CraftBukkit fails at this point. Maybe I'll find a workaround soon.

    As you can see, you can use either the name or the id of the item or block. If you want to prevent someone from crafting, placing, breaking or using something, put a "-" in front of the item (this blacklists the item). You can also whitelist an item by not putting a "-" there. This overwrites the blacklist rules.

    After setting up the CraftGroups, open up your Permissions configuration files and assign the CraftGroups to your groups or players by giving them the
    Code:
    craftgroup.group.GROUPNAME
    permission (replace GROUPNAME with the actual name of the CraftGroup).

    Remember that the CraftGroups and the "craftgroup.group.GROUPNAME" permission are case-sensitive!

    Permissions:
    PermissionNeeded to...
    craftgroup.addUse /cg add
    craftgroup.removeUse /cg remove
    craftgroup.listUse /cg list
    craftgroup.reloadUse /cg reload
    craftgroup.bypassBypass all restrictions
    craftgroup.group.GROUPNAMEAssign a CraftGroup (replace GROUPNAME with the name of the CraftGroup)


    Commands:
    CommandDescriptionUsage
    /cg addAdd an item or block to a group/cg add <list> <allow/deny> <type> <item>
    /cg remove <list> <allow/deny> <type> <item>Remove an item or block from a group/cg remove <list> <item>
    /cg listShow all lists or items in a group/cg list [list ] [type/*] [page]
    /cg reloadReload the configuration file/cg reload

    You can also use /craftgroup instead of /cg.

    Features:
    • Prevent crafting, smelting, using, placing or breaking of items and blocks
    • Assign CraftGroups to players and groups via Permissions
    • Multi-World (not with Permissions 2)
    • Ingame-Editing of CraftGroups
    • bypass-permission for Admins
    • Global Black-/Whitelist
    • Support for data values
    • Support for ItemCraft

    Download CraftGroup-dev (.jar; Minecraft 1.8; Spout)
    Download CraftGroup v0.3.1 (.jar)
    Source on GitHub
    [​IMG]

    Changelog:
    Version 0.3.1
    • Fixed 2 NPEs
    Version 0.3.0
    • Support for data values
    • Support for ItemCraft (requires testing)
    Show Spoiler
    Version 0.2.2
    • Fixed a problem with the different permission types
    Version 0.2.1
    • Fixed global-blacklist
    Version 0.2.0
    • Added support for permissions 2 and groupmanager (untested)
    • You can now prevent people from placing, destroying and using items/blocks
    Version 0.1.2
    • Forgot that HashMaps are case-sensitive
    Version 0.1.1
    • Never try casting an integer to a string!
    Version 0.1
    • Initial release
     
    Nomanoclass likes this.
  2. Offline

    p000ison

  3. Offline

    Snaipe

    yup, but from what I saw, it only prevent crafting ( and I assume smelting ), whereas craftgroup can also deny block placement/destruction and item use.
     
  4. Offline

    theGZ

    Absolutely LOVE the idea. Seriously, please keep updating. My favorite plugin <3
     
  5. Offline

    Arignir

    This plugin doesn't work for the pine, the birch, wooden slab.

    Could you please correct this ? It's important !
     
  6. Offline

    dadaking

    I have also a problem with smelting. It doesn't work with me. Can you show me how you do for the character doesn't smelting iron for example?

    Thanks!
     
  7. Offline

    dadaking

    Someone can help me pliz?

    I don't found the solution :(
     
  8. Offline

    p000ison

    FrozenBrain wasnt seen since 7. Oct.
    And the source code is the Old without spout. :|

    Code:
    12:41:05 [SEVERE] Could not pass event CUSTOM_EVENT to CraftGroup
    java.lang.IllegalAccessError: tried to access field net.minecraft.server.ItemStack.damage from class de.frozenbrain.CraftGroup.Listener.cgInventoryLis
    tener
            at de.frozenbrain.CraftGroup.Listener.cgInventoryListener.onInventoryClick(cgInventoryListener.java:43)
            at org.getspout.spoutapi.event.inventory.InventoryListener.onCustomEvent(InventoryListener.java:57)
            at org.bukkit.plugin.java.JavaPluginLoader$96.execute(JavaPluginLoader.java:934)
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:339)
            at org.getspout.spout.SpoutNetServerHandler.handleInventoryClick(SpoutNetServerHandler.java:388)
            at org.getspout.spout.SpoutNetServerHandler.a(SpoutNetServerHandler.java:343)
            at net.minecraft.server.Packet102WindowClick.a(SourceFile:28)
            at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:92)
            at org.getspout.spout.SpoutNetServerHandler.a(SpoutNetServerHandler.java:501)
            at net.minecraft.server.NetworkListenThread.a(SourceFile:108)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:471)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:374)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)

    Cant get smelting work,too. damn Please FrozenBrain.. Update this! ^^

    EDIT: Using latest dev from spout #515

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  9. Offline

    dadaking

    ok i'm not crazy so it is not possible to stop smelting :p

    We hope an update so :)
     
  10. Offline

    dadaking

    Nobody have some information about the build of this plugin?
     
  11. Offline

    Flenix

    I'm not sure if he ever updated it for spout - I did a version I'm not sure if he released that or made his own, but either way never updated the Github.

    I'm trying to get at least crafting working with latest build, but its not playing fair, no errors and no stack traces - just simply not blocking the crafting! If you want the source let me know and I'll send it as .txt files, I have it updated for spout and superperms.

    If I do get it working I'll upload my own to DevBukkit (with full credit to fb) and post a link here - last I spoke to him he said "if I'm not updating you can always update and release it yourself" so I'll assume that as his permission.

    EDIT: Found the problem (I THINK)
    "org.bukkit.event.Event.Result.DENY

    Note: This element has no attached source and the Javadoc could not be found in the attached Javadoc."

    I actually noticed it in the smelting section but its the same for all the plugin...
     
  12. Offline

    p000ison

    Yeah would be great. Maybe Ill could look then into the heroes problem...
    Would be so great if we could get this plugin work again.
     
  13. Offline

    Flenix

    Heroes is a problem in general - whats the issue with craftgroup and heroes? (I'm guessing its a part that I don't use, I have both plugins and not noticed issues before..
     
  14. Offline

    p000ison

    If you get exp for crafting and this item is restricted with craftgroup you can click and click and click........
    And everytime you get exp for this.
    And please release your source code^^

    Hmm updated it right now myself. Same problem as you^^
    I think ill swich to banrecipe. The dev will integrate furnace support. Not sure weather data values.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  15. Offline

    p000ison

    Oh damn CraftGroup is the best solution for restrict crafting. Please FrozenBrain! Awake! Need the source code for the 1.3.1!
     
  16. Offline

    dadaking

    Yes please, continue your project or give your source code to otherone :/
     
  17. Offline

    Flenix

    @p000ison @dadaking @FrozenBrain - tagged just in case he wanted the updated source I worked on - he might decide to update and it would save him a little time I guess?

    I can't use Github but here is source as far as I've done it.
    Works with Spout, uses new perm system. No errors, but doesn't work. I'm personally waiting on ChanceCraft because I can't get my head around updating this but here is the source for anyone who wants it... technically it'd be 1.3.3 ?

    flenix.craftgroup (open)

    cgPermission.java:
    Code:
    package flenix.craftgroup;
    
    public enum cgPermission {
    	DEFAULT,
    	ALLOW,
    	DENY
    }
    
    cgPermissionType

    Code:
    package flenix.craftgroup;
    
    public enum cgPermissionType {
    	CRAFT,
    	PLACE,
    	BREAK,
    	USE
    }
    
    cgPlugin

    Code:
    package flenix.craftgroup;
    
    import java.io.BufferedOutputStream;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.net.URL;
    import java.util.Collection;
    import java.util.List;
    import java.util.logging.Logger;
    
    import org.bukkit.event.Event;
    import org.bukkit.event.Event.Priority;
    import org.bukkit.permissions.Permission;
    import org.bukkit.plugin.Plugin;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.util.config.Configuration;
    import org.bukkit.util.config.ConfigurationNode;
    
    import flenix.craftgroup.Commands.cgCommandHandler;
    import flenix.craftgroup.Listener.cgBlockListener;
    import flenix.craftgroup.Listener.cgEntityListener;
    import flenix.craftgroup.Listener.cgInventoryListener;
    import flenix.craftgroup.Listener.cgPlayerListener;
    
    @SuppressWarnings("deprecation")
    public class cgPlugin extends JavaPlugin {
    
    	public static Logger log = Logger.getLogger("Minecraft");
    	public cgInventoryListener inventoryListener;
    	public cgBlockListener blockListener;
    	public cgPlayerListener playerListener;
    	public cgEntityListener entityListener;
    	public static Permission permissionHandler;
    	private Configuration config;
    
    	public void onDisable() {
    		log.info("[CraftGroup] v" + this.getDescription().getVersion() + " disabled.");
    	}
    
    	public void onEnable() {
    	    final PluginManager pm = getServer().getPluginManager();
    	    log.info("[CraftGroup] v" + this.getDescription().getVersion() + " enabled.");
    	    if (pm.getPlugin("Spout") == null) {
    	    	log.info("[CraftGroup] Spout is not installed.");
    	        try {
    	            pm.loadPlugin(new File("plugins/Spout.jar"));
    	            pm.enablePlugin(pm.getPlugin("Spout"));
    	        } catch (final Exception ex) {
    	            log.warning("[CraftGroup] Could not find the Spout plugin. Please download from BukkitDev.");
    	            return;
    	        }
    	    }
    
    	    loadPermissions();
    	    loadConfig();
    
    	    inventoryListener = new cgInventoryListener(this);
    	    playerListener = new cgPlayerListener(this);
    	    blockListener = new cgBlockListener(this);
    	    entityListener = new cgEntityListener(this);
    	    pm.registerEvent(Event.Type.CUSTOM_EVENT, inventoryListener, Priority.Highest, this);
    	    pm.registerEvent(Event.Type.PLAYER_INTERACT, playerListener, Priority.Highest, this);
    	    pm.registerEvent(Event.Type.PLAYER_INTERACT_ENTITY, playerListener, Priority.Highest, this);
    	    pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Priority.Highest, this);
    	    pm.registerEvent(Event.Type.BLOCK_BREAK, blockListener, Priority.Highest, this);
    	    pm.registerEvent(Event.Type.BLOCK_PLACE, blockListener, Priority.Highest, this);
    
    	    getCommand("cg").setExecutor(new cgCommandHandler(this));
    
    	}
    
    	public void loadConfig() {
    		this.config = this.getConfiguration();
    		this.config.load();
    		if(this.config.getInt("version", 12) == 12) {
    			log.info("[CraftGroup] Old config found. Converting from [N/A] to [13]..");
    			this.config.setProperty("version", 13);
    			for(String convGroup: this.config.getKeys()) {
    				List<Object> groupList = this.config.getList(convGroup);
    				if(groupList != null) {
    					this.config.removeProperty(convGroup);
    					for(int i = 0; i<groupList.size(); i++) {
    						groupList.set(i, "-" + String.valueOf(groupList.get(i)));
    					}
    					this.config.setProperty(convGroup + ".craft", groupList);
    					this.config.setProperty(convGroup + ".place", null);
    					this.config.setProperty(convGroup + ".break", null);
    					this.config.setProperty(convGroup + ".use", null);
    				}
    			}
    			this.config.save();
    			this.config.load();
    			log.info("[CraftGroup] Done. Please check if everything is correct.");
    		}
    
    		CraftGroup.clearGroups();
    
    		ConfigurationNode node = this.config.getNode("global-blacklist");
    		if(node == null) {
    			this.config.setProperty("global-blacklist.craft", null);
    			this.config.setProperty("global-blacklist.place", null);
    			this.config.setProperty("global-blacklist.break", null);
    			this.config.setProperty("global-blacklist.use", null);
    			CraftGroup.newGroup("global-blacklist");
    		} else {
    			CraftGroup newGlobal = CraftGroup.newGroup("global-blacklist");
    			parseList(newGlobal, node);
    		}
    
    		List<String> keys = this.config.getKeys();
    		for(String groupName: keys) {
    			if(!groupName.equals("global-blacklist") && !groupName.equals("version")) {
    				CraftGroup newGlobal = CraftGroup.newGroup(groupName);
    				parseList(newGlobal, this.config.getNode(groupName));
    			}
    		}
    
    		this.config.save();
    		saveConfig();
    	}
    
    	public void saveConfig() {
    		this.config.load();
    
    		Collection<CraftGroup> list = CraftGroup.getCraftGroups();
    		for(CraftGroup cg: list) {
    			this.config.setProperty(cg.getName() + ".craft", cg.getList(cgPermissionType.CRAFT));
    			this.config.setProperty(cg.getName() + ".place", cg.getList(cgPermissionType.PLACE));
    			this.config.setProperty(cg.getName() + ".break", cg.getList(cgPermissionType.BREAK));
    			this.config.setProperty(cg.getName() + ".use", cg.getList(cgPermissionType.USE));
    		}
    
    		this.config.save();
    	}
    
    	private void parseList(CraftGroup addTo, ConfigurationNode node) {
    		if(node == null) return;
    
    		List<Object> lcraft = node.getList("craft");
    		List<Object> lplace = node.getList("place");
    		List<Object> lbreak = node.getList("break");
    		List<Object> luse = node.getList("use");
    
    		if(lcraft != null) {
    			for(Object nameObj: lcraft) {
    				addTo.parse(String.valueOf(nameObj), cgPermissionType.CRAFT);
    			}
    		}
    
    		if(lplace != null) {
    			for(Object nameObj: lplace) {
    				addTo.parse(String.valueOf(nameObj), cgPermissionType.PLACE);
    			}
    		}
    
    		if(lbreak != null) {
    			for(Object nameObj: lbreak) {
    				addTo.parse(String.valueOf(nameObj), cgPermissionType.BREAK);
    			}
    		}
    
    		if(luse != null) {
    			for(Object nameObj: luse) {
    				addTo.parse(String.valueOf(nameObj), cgPermissionType.USE);
    			}
    		}
    	}
    
    	private void loadPermissions() {
    	    if (permissionHandler != null) {
    	        return;
    	    }
    
    	    Plugin permissionsPlugin = this.getServer().getPluginManager().getPlugin("Permissions");
    
    	    if (permissionsPlugin == null) {
    	        log.info("[CraftGroup] Permission system not detected, only the global-blacklist will be used.");
    	        return;
    	    }
    
    	}
    
    	public static void download(Logger log, URL url, File file) throws IOException {
    	    if (!file.getParentFile().exists())
    	        file.getParentFile().mkdir();
    	    if (file.exists())
    	        file.delete();
    	    file.createNewFile();
    	    final int size = url.openConnection().getContentLength();
    	    log.info("[CraftGroup] Downloading " + file.getName() + " (" + size / 1024 + "kb) ...");
    	    final InputStream in = url.openStream();
    	    final OutputStream out = new BufferedOutputStream(new FileOutputStream(file));
    	    final byte[] buffer = new byte[1024];
    	    int len, downloaded = 0, msgs = 0;
    	    final long start = System.currentTimeMillis();
    	    while ((len = in.read(buffer)) >= 0) {
    	        out.write(buffer, 0, len);
    	        downloaded += len;
    	        if ((int)((System.currentTimeMillis() - start) / 500) > msgs) {
    	            log.info((int)((double)downloaded / (double)size * 100d) + "%");
    	            msgs++;
    	        }
    	    }
    	    in.close();
    	    out.close();
    	    log.info("[CraftGroup] Download finished");
    	}
    }
    
    (Last part probably isn't needed, I disabled the auto-download in line with Spout's requirements.)

    CraftGroup

    Code:
    package flenix.craftgroup;
    
    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.HashMap;
    import java.util.List;
    
    import org.bukkit.Material;
    import org.bukkit.entity.Player;
    
    public class CraftGroup {
    	private static HashMap<String, CraftGroup> groups = new HashMap<String, CraftGroup>();
    
    	private List<Material> allowCraft = new ArrayList<Material>();
    	private List<Material> denyCraft = new ArrayList<Material>();
    	private List<Material> allowPlace = new ArrayList<Material>();
    	private List<Material> denyPlace = new ArrayList<Material>();
    	private List<Material> allowBreak = new ArrayList<Material>();
    	private List<Material> denyBreak = new ArrayList<Material>();
    	private List<Material> allowUse = new ArrayList<Material>();
    	private List<Material> denyUse = new ArrayList<Material>();
    	private final String name;
    
    	public CraftGroup(String name) {
    		this.name = name;
    	}
    
    	public void allow(Material material, cgPermissionType type) {
    		switch(type) {
    			case CRAFT:
    				allowCraft.add(material);
    				return;
    			case PLACE:
    				allowPlace.add(material);
    				return;
    			case BREAK:
    				allowBreak.add(material);
    				return;
    			case USE:
    				allowUse.add(material);
    				return;
    		}
    	}
    
    	public void deny(Material material, cgPermissionType type) {
    		switch(type) {
    			case CRAFT:
    				denyCraft.add(material);
    				return;
    			case PLACE:
    				denyPlace.add(material);
    				return;
    			case BREAK:
    				denyBreak.add(material);
    				return;
    			case USE:
    				denyUse.add(material);
    				return;
    		}
    	}
    
    	public void parse(String material, cgPermissionType type) {
    		Material mat;
    		boolean allow;
    
    		if(material.startsWith("-")) {
    			material = material.substring(1);
    			allow = false;
    		} else {
    			allow = true;
    		}
    
    		try {
    			int id = Integer.parseInt(material);
    			mat = Material.getMaterial(id);
    		} catch(Exception e) {
    			mat = Material.getMaterial(material.toUpperCase());
    		}
    
    		if(mat == null) {
    			cgPlugin.log.info("[CraftGroup] Unknown Material \"" + material + "\", ignoring.");
    		} else {
    			if(allow) {
    				allow(mat, type);
    			} else {
    				deny(mat, type);
    			}
    		}
    	}
    
    	public boolean remove(Material material, cgPermissionType type, cgPermission perm) {
    		// If someone knows a better way of doing this, please let me know :S
    		switch(perm) {
    			case ALLOW:
    				switch(type) {
    					case CRAFT:
    						if(!allowCraft.contains(material)) return false;
    						allowCraft.remove(material);
    						return true;
    					case PLACE:
    						if(!allowPlace.contains(material)) return false;
    						allowPlace.remove(material);
    						return true;
    					case BREAK:
    						if(!allowBreak.contains(material)) return false;
    						allowBreak.remove(material);
    						return true;
    					case USE:
    						if(!allowUse.contains(material)) return false;
    						allowUse.remove(material);
    						return true;
    				}
    			case DENY:
    				switch(type) {
    					case CRAFT:
    						if(!denyCraft.contains(material)) return false;
    						denyCraft.remove(material);
    						return true;
    					case PLACE:
    						if(!denyPlace.contains(material)) return false;
    						denyPlace.remove(material);
    						return true;
    					case BREAK:
    						if(!denyBreak.contains(material)) return false;
    						denyBreak.remove(material);
    						return true;
    					case USE:
    						if(!denyUse.contains(material)) return false;
    						denyUse.remove(material);
    						return true;
    				}
    		}
    
    		return false;
    	}
    
    	private List<String> getList(List<Material> listAllow, List<Material> listDeny) {
    		List<String> list = new ArrayList<String>();
    
    		for(Material mat: listAllow) {
    			list.add(mat.name());
    		}
    
    		for(Material mat: listDeny) {
    			list.add("-" + mat.name());
    		}
    
    		if(list.size() == 0) return null;
    
    		return list;
    	}
    
    	public List<String> getList(cgPermissionType type) {
    		switch(type) {
    			case CRAFT:
    				return getList(allowCraft, denyCraft);
    			case PLACE:
    				return getList(allowPlace, denyPlace);
    			case BREAK:
    				return getList(allowBreak, denyBreak);
    			case USE:
    				return getList(allowUse, denyUse);
    			default:
    				return null;
    		}
    	}
    
    	public cgPermission hasPermission(Material material, cgPermissionType type) {
    		if(allowCraft.contains(material)) return cgPermission.ALLOW;
    		if(denyCraft.contains(material)) return cgPermission.DENY;
    		switch(type) {
    			case CRAFT:
    				if(allowCraft.contains(material)) return cgPermission.ALLOW;
    				if(denyCraft.contains(material)) return cgPermission.DENY;
    				return cgPermission.DEFAULT;
    			case PLACE:
    				if(allowPlace.contains(material)) return cgPermission.ALLOW;
    				if(denyPlace.contains(material)) return cgPermission.DENY;
    				return cgPermission.DEFAULT;
    			case BREAK:
    				if(allowBreak.contains(material)) return cgPermission.ALLOW;
    				if(denyBreak.contains(material)) return cgPermission.DENY;
    				return cgPermission.DEFAULT;
    			case USE:
    				if(allowUse.contains(material)) return cgPermission.ALLOW;
    				if(denyUse.contains(material)) return cgPermission.DENY;
    				return cgPermission.DEFAULT;
    			default:
    				return cgPermission.DEFAULT;
    		}
    	}
    
    	public String getName() {
    		return name;
    	}
    
    	public int countRules(cgPermissionType type) {
    		int count = 0;
    		if(type == null) {
    			count += allowCraft.size();
    			count += denyCraft.size();
    			count += allowPlace.size();
    			count += denyPlace.size();
    			count += allowBreak.size();
    			count += denyBreak.size();
    			count += allowUse.size();
    			count += denyUse.size();
    			return count;
    		}
    		switch(type) {
    			case CRAFT:
    				count += allowCraft.size();
    				count += denyCraft.size();
    				return count;
    			case PLACE:
    				count += allowPlace.size();
    				count += denyPlace.size();
    				return count;
    			case BREAK:
    				count += allowBreak.size();
    				count += denyBreak.size();
    				return count;
    			case USE:
    				count += allowUse.size();
    				count += denyUse.size();
    				return count;
    		}
    
    		return 0;
    	}
    
    	public List<String> listRulesAsStrings(cgPermissionType type) {
    		if(type == null) {
    			List<String> list = new ArrayList<String>();
    
    			List<String> craft = getList(allowCraft, denyCraft);
    			if(craft != null) {
    				for(int i = 0; i < craft.size(); i++) {
    					craft.set(i, "[CRAFT]" + ("[ALLOW] " + craft.get(i)).replace("[ALLOW] -", "[DENY] "));
    				}
    				list.addAll(craft);
    			}
    
    			List<String> place = getList(allowPlace, denyPlace);
    			if(place != null) {
    				for(int i = 0; i < place.size(); i++) {
    					place.set(i, "[PLACE]" + ("[ALLOW] " + place.get(i)).replace("[ALLOW] -", "[DENY] "));
    				}
    				list.addAll(place);
    			}
    
    			List<String> breakl = getList(allowBreak, denyBreak);
    			if(breakl != null) {
    				for(int i = 0; i < breakl.size(); i++) {
    					breakl.set(i, "[BREAK]" + ("[ALLOW] " + breakl.get(i)).replace("[ALLOW] -", "[DENY] "));
    				}
    				list.addAll(breakl);
    			}
    
    			List<String> use = getList(allowUse, denyUse);
    			if(use != null) {
    				for(int i = 0; i < use.size(); i++) {
    					use.set(i, "[USE]" + ("[ALLOW] " + use.get(i)).replace("[ALLOW] -", "[DENY] "));
    				}
    				list.addAll(use);
    			}
    
    			return list;
    		}
    
    		List<String> list = null;
    		switch(type) {
    			case CRAFT:
    				list = getList(allowCraft, denyCraft);
    				break;
    			case PLACE:
    				list = getList(allowPlace, denyPlace);
    				break;
    			case BREAK:
    				list = getList(allowBreak, denyBreak);
    				break;
    			case USE:
    				list = getList(allowUse, denyUse);
    				break;
    		}
    
    		if(list == null) list = new ArrayList<String>();
    
    		if(list != null) {
    			for(int i = 0; i < list.size(); i++) {
    				list.set(i, "[" + type.name() + "]" + ("[ALLOW] " + list.get(i)).replace("[ALLOW] -", "[DENY] "));
    			}
    		}
    		return list;
    	}
    
    	public static CraftGroup newGroup(String name) {
    		CraftGroup newGroup = new CraftGroup(name);
    		groups.put(name, newGroup);
    		return newGroup;
    	}
    
    	public static void clearGroups() {
    		groups.clear();
    	}
    
    	public static CraftGroup getGroupByName(String name) {
    		return groups.get(name);
    	}
    
    	public static boolean hasPermission(Player player, Material material, cgPermissionType type) {
    		if(player.hasPermission("craftgroup.bypass")) {
    				return true;}
    		return true;
    	}
    
    	public static Collection<CraftGroup> getCraftGroups() {
    		return groups.values();
    	}
    
    }
    


    (Rest is on next page...)
     
  18. Offline

    p000ison

    Did you asked him, if you could make the code yours?
     
  19. Offline

    Flenix

    I never said the code itself is mine, I just changed the directories because that was easier for me.

    But yes, he did say I could update and release it quite a few months ago (It's on another thread for another one of his plugins - I asked if he planned to update this and he said "You can always update it if I don't get the chance to, I'm busy with life sometimes" so I did :)
     
  20. Offline

    Muchoman1

    whats happening with this plugin?

    cause i really need one that allows me to control drops, block breaking, and placing items/blocks on a individual user basis

    is there any other plugins that allow that?
     
  21. Offline

    Flenix

    Something in Bukkit changed around build 1300 that broke all plugins that do stuff like that - from what I've seen, noone can work out quite what.

    I need a plugin to just control crafting on a user-basis, learnt java mostly to try and fix this (a few months ago - I did update it once as in my source above but can't work out whats up now)
     
  22. Offline

    Milchshakee

    I fixed CraftGroup. For me it works, but only the crafting. I made it for my Rpg Server and I only need the Crafting.
    If you only need the Crafting too, then it should work. I tested it and it worked. Furnaces should work too.

    Here it is:

    Try WorldGuard with the blacklist.
     

    Attached Files:

    Last edited by a moderator: May 18, 2016
  23. Offline

    Flenix

    Thanks! Although its throwing an error...
    Screenshot was much easier sorry. If you do need the log version I can get it but it'd take me a bit longer to find :)

    craftgroup.png
     
  24. Offline

    Milchshakee

    This exception can occur when the source is built targeting a JDK that is not supported by the JDK attempting to run it. In the above example, if the plugin was built targeting only JDK 1.7, but the server runs JDK 1.6, the above exception will occur.

    I'll upload Craftgroup, supporting Jdk 1.6 *_*

    Here it is:
     

    Attached Files:

  25. Offline

    torox850

    hello, I have a problem, the last. zip settle a spout.jar JDK 1.6 at the same time, why? (I'm french)
     
  26. Offline

    Flenix

    Works fine, thanks!
    @torox850 - Not quite sure what you mean with "settle a spout.jar" - If you want to get Spout, go to ci.getspout.org
     
  27. Offline

    torox850

    the last. zip (JDK 1.6) download spout.jar automaticly, why? When removing spout to only keep craftgroup, spout is automaticly re-downloaded. (I'm french)
     
  28. Offline

    Muchoman1

    how would i do that? sorry im a little noob at worldguard

    can you post an example using my username and not letting me mine iron ore?
     
  29. Offline

    torox850

    is it possible to remove spout from plugin?
     
  30. Offline

    Milchshakee

    Spout have to be installed to use Craftgroup. Because that, it downloads Spout automaticly.

    [Ironore]
    ignore-groups=admins //groups that can mine Ironore
    on-break=deny,tell // That happens when someone trys to mine Ironore and is not in ignore-groups
    message=You can't mine Ironore! // message when someone trys to mine ironore and is not in ignore-groups. Only needed when on-break=tell

    No

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  31. Offline

    torox850

    anyone have the old version of CraftGroup without spout?
     

Share This Page