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.
restriction not working on mcmmo unless i leveled up, and got this error when i logged in everytime.
[04:41:26 ERROR]: Could not pass event PlayerJoinEvent to ItemRules v1.0.10 org.bukkit.event.EventException at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja va:310) [spigot18.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav a:62) [spigot18.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j ava:502) [spigot18.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j ava:487) [spigot18.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.PlayerList.onPlayerJoin(PlayerList.java: 298) [spigot18.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.PlayerList.a(PlayerList.java:157) [spigo t18.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.LoginListener.b(LoginListener.java:144) [spigot18.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.LoginListener.c(LoginListener.java:54) [ spigot18.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.NetworkManager.a(NetworkManager.java:231 ) [spigot18.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.ServerConnection.c(ServerConnection.java :148) [spigot18.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:8 14) [spigot18.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:3 74) [spigot18.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:6 54) [spigot18.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java :557) [spigot18.jar:git-Spigot-db6de12-18fbb24] at java.lang.Thread.run(Unknown Source) [?:1.8.0_74] Caused by: com.gmail.nossr50.api.exceptions.McMMOPlayerNotFoundException: McMMOP layer object was not found for: Rf_Hardian a525b40f-6b6b-3de7-a4f3-483607d6868a at com.gmail.nossr50.api.ExperienceAPI.getPlayer(ExperienceAPI.java:1097 ) [?:?] at com.gmail.nossr50.api.ExperienceAPI.getLevel(ExperienceAPI.java:656) [?:?] at com.github.mineGeek.ItemRules.Integration.McMMOPlayer.getSkillLevel(M cMMOPlayer.java:55) [?:?] at com.github.mineGeek.ItemRules.Rules.ConditionMcMMO.isApplicable(Condi tionMcMMO.java:93) [?:?] at com.github.mineGeek.ItemRules.Rules.ConditionMcMMO.isApplicable(Condi tionMcMMO.java:117) [?:?] at com.github.mineGeek.ItemRules.Rules.Rule.appliesToPlayer(Rule.java:39 0) [?:?] at com.github.mineGeek.ItemRules.Rules.Rule.appliesToPlayer(Rule.java:36 5) [?:?] at com.github.mineGeek.ItemRules.Rules.Rules.getPlayerRules(Rules.java:1 14) [?:?] at com.github.mineGeek.ItemRules.Store.IRPlayer.loadRules(IRPlayer.java: 329) [?:?] at com.github.mineGeek.ItemRules.Store.IRPlayer.loadRules(IRPlayer.java: 318) [?:?] at com.github.mineGeek.ItemRules.Store.Players.addPlayer(Players.java:59 ) [?:?] at com.github.mineGeek.ItemRules.Events.Listeners.onPlayerJoin(Listeners .java:91) [?:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [?:1.8.0 _74] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [?:1.8.0 _74] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [?:1 .8.0_74] at java.lang.reflect.Method.invoke(Unknown Source) [?:1.8.0_74] at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja va:306) [spigot18.jar:git-Spigot-db6de12-18fbb24] ... 14 more
any help?
[14:43:53] [Server thread/WARN]: java.lang.NullPointerException [14:43:53] [Server thread/WARN]: at com.github.mineGeek.ItemRules.Store.IRPlayer.getRuleData(IRPlayer.java:557) [14:43:53] [Server thread/WARN]: at com.github.mineGeek.ItemRules.Store.IRPlayer.isRestricted(IRPlayer.java:576) [14:43:53] [Server thread/WARN]: at com.github.mineGeek.ItemRules.Events.Listeners.onPlayerInteractBlock(Listeners.java:354) [14:43:53] [Server thread/WARN]: at sun.reflect.GeneratedMethodAccessor59.invoke(Unknown Source) [14:43:53] [Server thread/WARN]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [14:43:53] [Server thread/WARN]: at java.lang.reflect.Method.invoke(Unknown Source) [14:43:53] [Server thread/WARN]: at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:292) [14:43:53] [Server thread/WARN]: at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) [14:43:53] [Server thread/WARN]: at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:501) [14:43:53] [Server thread/WARN]: at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:486) [14:43:53] [Server thread/WARN]: at org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:225) [14:43:53] [Server thread/WARN]: at net.minecraft.server.v1_7_R4.PlayerConnection.a(PlayerConnection.java:540) [14:43:53] [Server thread/WARN]: at net.minecraft.server.v1_7_R4.PacketPlayInBlockDig.a(SourceFile:53) [14:43:53] [Server thread/WARN]: at net.minecraft.server.v1_7_R4.PacketPlayInBlockDig.handle(SourceFile:8) [14:43:53] [Server thread/WARN]: at net.minecraft.server.v1_7_R4.NetworkManager.a(NetworkManager.java:157) [14:43:53] [Server thread/WARN]: at net.minecraft.server.v1_7_R4.ServerConnection.c(SourceFile:134) [14:43:53] [Server thread/WARN]: at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:667) [14:43:53] [Server thread/WARN]: at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:258) [14:43:53] [Server thread/WARN]: at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:558) [14:43:53] [Server thread/WARN]: at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:469) [14:43:53] [Server thread/WARN]: at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628)
@eduardo31
I didn't even know there was that permission?
EDIT: Nvm, I found it in the description.
Bug: itemRules.bypass.* permission is not working on groupmanager any ideas ? please help
It's even worse now. None of the rules are working at all. Geekola, I have waited for a response for almost 3 months now. If you have a Skype or any other form of communication besides this chat could you please pm me that info? I'm really frustrated... I realize you haven't worked on this recently, but you are the only one who would know what I'm doing wrong.
Any updated ideas Geekola? If it matters, I am using this plugin on a 1.8 server. I don't know enough right now to know if that matters for this plugin.
@kev3200
Update: Didn't work... I tried doing /irapply kev3200 birchWood /reload server, and then /rules kev3200 "You have no rules applied to you." I can make a video if you want if that would help to show you my problem and what I'm trying to accomplish.
@Geekola
Ok I think I get it now. So if I want the rules to be applied permanently, once the player reaches a certain level for instance, I would need to give them the permission and /irapply <playername> <rule> to refresh the rule list. Next time they login, the plugin "sees" that they have the permission and will reapply the rule automatically, yes?
@kev3200
I haven't tested (and wrote this over a year ago so commenting from memory). I made a long reply, but let me see if I can sum it up better: those commands apply/remove a rule, but that effect is temporary until rules are automatically re-evaluated (e.g. next time they log on). IF a rule requires x permission, you give the player that permission, then next time their rules are re-evaluated, they will have that rule. IF you give them that permission and run /irapply "rule" that will manually apply and refresh their rules in the interim. However: IF a rule requires x permission and you do not give them that permission but run /irapply "rule", then they will have the rule applied until the next time their rules are evaluated (e.g. when they next log in). Hope that help clarify!!!
@Geekola
So using /irapply and /irrevoke, would those rules stay on or off the player permanently? Or only for the duration of one login?
@kev3200
Looks like commands are: irapply and irrevoke "playername" "rulename" (without quotes). It also doesn't look like it gives feedback.
In your instance, if you base your rules on permissions, you could possibly use an empty rule that can be applied/removed just so it refreshes the users current rules (which would then be revaluated next time they login).
@Geekola
K, so I understand how the commands work, but what is the syntax for using them? is it: "/apply <playername> <rulename>"? Cause when I try that in the console there is no feedback. Also, I have disabled the xp levels having any correlations with the player's levels in LevelMe. (assuming that's what you are referring to). I want to be able to add all the rules manually via commands issued by the console. That way the rules/permissions a player has will not be tied to their xp level but instead to their level in certain categories (woodcutting, mining, etc.).
P.S.(Yes I am using Vault)
@kev3200
Those 2 commands enable you to manually add or lift a rule. e.g. if you have a rule called "IronGear" you could add it to someone who otherwise didn't have it applied or remove it. The problem here is that rules are automatically reapplied at particular intervals (e.g. someone gaining an xp level). That will override the manual apply/removal.
@kev3200
I am assuming I can hook into a vault perm change even to reload - but that is just me assuming (just like I am assuming you use Vault)
Another question:
I see the plugin recognizes two commands that aren't on the list of Commands on this page. /apply /revoke What do these commands do, what is the syntax for using them? When I try them in game there is no message on how to use it.
@Geekola
So here's my problem. Maybe you can think of a clever solution. I have my itemRules config set to exclude a rule from players with a certain permission. I'm using a command to add a permission node to a player (PEX) using a separate plugin. The problem is, once the permission has been added, itemRules doesn't seem to know there has been a change to the player's permissions and doesn't exclude them from the rule. Is this an itemRules problem or is there a way I can work around this? Using PermissionsEX for permissions and levelMe (different plugin) for adding the permission to the player.
@Geekola
Ok that doesn't sound like my problem then.. I'll keep searching :P
@kev3200
Hey Kev, it means that the automatic rules may overwrite the change you made. For instance, if a rule is applied to players below xp level 5 and you manually remove the rule when they are level 3, it may go be reapplied when they get to level 4
Hey Geekola,
sorry got a question while looking through the code:
/**
What does this section mean? It's in the ApplyRule class. I think this is the problem I'm having but not sure. What does "fall back off" mean?
@Geekola
Ok so I'll check back with you in a month then :) My server idea can't move forward till this updates so I'll just wait...
(I'm slowly starting to learn Java so I'll take a look at the code maybe next week and see if I can decipher it :P)