ItemRules
ItemRules is a simple to use, but highly configurable plugin for controlling how, when and even where items and blocks can be used, picked up, crafted, placed or broken based on the world, a players xp level, the faction they are in, their mcMMO skill level, their rank/group, their permissions, and more. It is a complete rewrite/revisioning of my previous plugin LevelRestrictions
Latest Builds
ItemRules can allow you to restrict items and blocks based on XP level and/or will integrate with Factions (e.g. allow only certain factions to use certain items), McMMO (e.g. restrict ores from being mined unless mining skill is a minimum level), Vault (e.g. restrict weapons based on permission group).
ItemRules will also allow you to configure certain rules that will be applied when players walk into defined regions (e.g. a PvP zone that only allows you to use carrots as weapons)
Configuration Examples
- Click here for details on configuring basic rules.
- Click here for details on configuring rules that only apply to specified areas.
Here is an example of restricting iron tools and equipment until player is level 2:
ironEquipment: description: 'Use of iron stuff until level 2' messages: restricted: 'You cant %s %s until level 2' actions: [USE, BREAK, PICKUP] xp: min: 2 items: restrict: [256, 257, 258, 267, 292]
Here is an example of McMMO integration that prevents cutting down Birch trees until woodcutting skill is level 2:
Woodcutting-Brichwood: messages: restricted: 'You cant cut birch until woodcutting 2' actions: [BREAK] mcmmo: skills: woodcutting: 2 items: restrict: ['17.2']
You can also specify rules to apply to groups (note this requires Vault) by adding this to your rule:
groups: applyto: ['newbs', 'badpeeps']
You can use the same format to exclude rules from groups (using Vault) like:
groups: exclude: ['vips']
Permissions
Note that by default all OP's will bypass rules.
permission | notes |
---|---|
itemRules.bypass.* | Do not process ANY rules for player |
itemRules.bypass.RULENAME | Do not process specific rule for player |
Commands
command | arguments | example | explanation |
---|---|---|---|
/rules | [playername] | list all rules currently applied to player. No arguments for self |
Change log
- v1.0.9 - Jun 21st, 2013
- Silent exception handling when Entity attacks player with an invalid item.
- v1.0.8 - Feb 18th, 2013
- Fixed potential issue with groups and perms not applying correctly.
- v1.0.6 - Feb 17th, 2013
- Fixed bug with certain manual rules not properly applying.
- Changed Item text to use Vault if installed.
- v1.0.5 - Feb 9th, 2013
- Changed permission check to prefer Vault (if installed) over Bukkit.
- Bugs zapped
- v1.0.3 - Feb 9th, 2013
- Changes mcMMO skill type checks to take advantage of their new api accepting strings instead of data types.
- v1.0.2 - Jan 30th 2013
- Added support for mcMMO versions with build newer than #1282 ( Jan 22nd 2013). Otherwise, same exact build.
@Geekola
LOL it's good now. 1.0.5 is cherry :P I've done the same thing with app's I've written at work in VB and forgot to take out my msgbox tests. People were like "What are all these boxes that keep popping up?" :P
@techrosis
Ok. I was trying to capture console skill changes in mcMMO (doesn't appear to be any way to catch them as events). Left a remenant that triggered everytime someone was give xp. Guess that was a lot :) 1.0.5 uploaded. Sorry for the hassle!
@techrosis
lmao.ffs Bukkit team is going to kill me. BRB :)
We have a new weird side effect LOL. Everything appears to be working, but now everytime someone hit's something or repairs or anything it says "levelup" in chat. And if we are in a mcMMO party it says that to everyone. It's not actually leveling up anything it just says "levelup". Any ideas on that one?
@Geekola
NP it's awesome communities like this that keeps MineCraft so enjoyable! Awesome plugin btw :P
@techrosis
Just missed you on this. I updated the package to 1.0.4 to default to using Vault for permissions. Have tested with pex and bpermissions and both work as expected.
Thanks for helping make the plugin better :)
@Geekola
I didn't notice that it was a lowercase i but I've tried that too. I've tried ^itemRules.bypass* and ^itemRules.bypass.* and neither one works for me :( I think bPermissions doesn't like ItemRules LOL. I guess I'll have to wait until your Vault version is ready because I have too many plugins and rules to switch to pex :( Dang :(
edit: Okay. I went ahead and switched to PEX and all is well now :P works perfect. -itemRules.bypass* is working. May want to make a note that it doesn't work with bPermissions.
@techrosis
Try itemRules.bypass* NOT ItemRules
Have just tried with pex and it works fine. Have another build ready to go that uses Vault for permission as a preference to player.hasPermissions but as above, it is working for me and pex on the 1.0.3 build as is. Make sure case is correct :)
HTHs
@Geekola
:( well it works for players but not OP's. I use bPermissions and the negative formatting is: ^ItemRules.bypass.* but that isn't working for the OPs. Perhaps do you know if Vault (which I do use) is tied into bPermissions groups and then I could add the groups: to the rules such as
edit: Doesn't seem to work either :( What permissions does ItemRules support?
@techrosis
Yea, looking at the source, mcMMO doesn't appear to raise an event for skills being changed via commands. Not sure how to tackle this one yet. Good news is that a reload or player logging in/out will calculate correctly.
re: perms... a negative perm should be fine: e.g. -ItemRules.bypass.*
@Geekola
For some reason it started working LOL. Sorry for the confusion. Just one more question. The permissions is kind of confusing. If I want it to apply to OP's I should do a negative permission of ItemRules.bypass* correct?
@techrosis
Are you testing by using command lines to raise/lower skill?
Am testing here and it works, however if you grant skill level via a command, it doesn't appear to raise an event that notifies ItemRules that a skill level has changed. Logging out and back in seems to sort it out.
Can you let me know so I am not trying to fix the wrong thing? :)
@Geekola
Nope no errors. PM'ing config now.
@techrosis
Are there any errors in your console? Can you pm me your config between <<code>> blocks?
I may have spoke too soon unless I have something wrong. It loads without error but doesn't seem to be working. Does this block look correct?
If so it's not working. I can still use it. I though it may be a permission thing so I deopped and same thing. My swords skill is only 123 so it should keep me from using Diamond Swords correct?
@Geekola
That did it man!!! Thanks. Sorry I couldn't test for you yesterday evening, I had players logged in :(
@techrosis
Yup, they moved the SkillTypes data to another package again. Good news is that they have made it so their API doen't need it anymore so it shouldn't be a problem anymore.
v1.0.3 is awaiting approval but has the mcMMO changes for 1.4 beta + (link in description up top)
Thanks!
@techrosis
Very odd. Will download that build and check it out tomorrow. Wonder if they moved the datatypes again. In the meantime, try v1.0.1 and let me know if you get the same error. Only difference between the two is where it looks for the mcmmo data.
@Geekola
I ask because this is what I get when I try (it loads up fine without any changes to the config).
15:17:08 [INFO] mcMMO integration for [ItemRules] is enabled 15:17:08 [SEVERE] Error occurred while enabling ItemRules v1.0.2 (Is it up to date?) java.lang.NoClassDefFoundError: com/gmail/nossr50/skills/SkillType at com.github.mineGeek.ItemRules.Rules.Rules.addRule(Rules.java:288) at com.github.mineGeek.ItemRules.Rules.Rules.addRule(Rules.java:248) at com.github.mineGeek.ItemRestrictions.Utilities.Config.loadRulesFromConfig(Config.java:177) at com.github.mineGeek.ItemRules.ItemRules.onEnable(ItemRules.java:86) at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217) at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:457) at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381) at org.bukkit.craftbukkit.v1_4_R1.CraftServer.loadPlugin(CraftServer.java:282) at org.bukkit.craftbukkit.v1_4_R1.CraftServer.enablePlugins(CraftServer.java:264) at net.minecraft.server.v1_4_R1.MinecraftServer.j(MinecraftServer.java:321) at net.minecraft.server.v1_4_R1.MinecraftServer.e(MinecraftServer.java:300) at net.minecraft.server.v1_4_R1.MinecraftServer.a(MinecraftServer.java:259) at net.minecraft.server.v1_4_R1.DedicatedServer.init(DedicatedServer.java:149) at net.minecraft.server.v1_4_R1.MinecraftServer.run(MinecraftServer.java:399) at net.minecraft.server.v1_4_R1.ThreadServerApplication.run(SourceFile:849) Caused by: java.lang.ClassNotFoundException: com.gmail.nossr50.skills.SkillType at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at org.bukkit.plugin.java.PluginClassLoader.findClass0(PluginClassLoader.java:80) at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:53) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ... 15 more
All I changed was, I took out the default rules in the rules section and pasted in your Herbalism example just to see if it would load. If I use any mcmmo skills it craps out :( .
I'm using the mcmmo beta 2 build 1509 on craftbukkit 1.4.7 r0.1 Any ideas?
@techrosis
v1.0.2 is compiled against mcMMO v1.4.00-dev-b1379
So unless something has changed in recent builds, yes... it does :)