RockinChaos / ItemJoin

Get custom items on join.
https://www.craftationgaming.com/
GNU Lesser General Public License v3.0
140 stars 36 forks source link

[Suggest] Some features. #236

Open momoservertw opened 4 years ago

momoservertw commented 4 years ago

ItemJoin is very powerful and efficiency now. There may no any important things to do. If you want to add more feature, you can look at it. Thank you for spending a lot of time updating ItemJoin.

~1. Custom disposable conditions.~ [ COMPLETED ] Only some situation will execute commands and consume that item. It can be very useful to create a special item for other plugin. For example, a pet skill ticket. If player has a pet, it will change his pet's skill. Otherwise it will show a failure message.

- '%mypet_has_pet%:equal:true'
- '%other_placeholder%:notequal:VALUE'
- '%other_placeholder%:over:100'
- '%other_placeholder%:under:200'

fail-message: '&cYou need to summon your pet.'

Some placeholder equal null. You need to check it, if the value equal "". %other_placeholder%:equal:

~2. More triggers.~ [ COMPLETED ]

3. Random commands. More custom way to select a command.

- <chance:0.1> say 0.1 / ( 0.9 + 0.1 + 0.2 ) * 100% = 8.3%
- <chance:0.2> say 0.2 / ( 0.9 + 0.1 + 0.2 ) * 100% = 16.7%

This is an example

    double radomTotalChance = Math.round(Math.random() * totalChance);
    for (String command : commandList){
        // To get that command's change. I don't know how to get it from "<chance:0.9>".
        double chance = ConfigHandler.getConfig("config.yml").getDouble(command + ".chance");
        // Compare the chance and the number below total chance.
        if (chance >= radomTotalChance) {
            return ExecuteCommand;
        }
        // To minus the chance and let it no longer be included in the total chance.
        // For example, a random number below "1.2" is "1.15".
        // If it is over "0.9", it will minus 0.9 and change to "0.25".
        // If it is over "0.1", it will minus 0.1 and change to "0.15".
        // It is under "0.2" then execute commands.
        radomTotalChance -= chance;
    }

~4. Custom food~ [ COMPLETED ] ItemJoin can custom the golden apple, but it will be more interesting if we can add any potion effect by click a custom item like a skull 'Apple Cake'. And using less CPU performance if we directly using the Spigot API, not commands. The potion effect's format could be the golden apple's.

~5. Better Commands~ [ COMPLETED ] I am using the menu plugin "BossShopPro" which has some great command types. You can refer to it~ The command type of inventory will be more abundant!

In addition, is it possible to add the "Middle-Click" when players use the mouse wheel. And it may be clearer to distinguish the Click action from the Inventory action?

~6. Conditions for Each Command Execution~ [ COMPLETED ] Examples;

inventory-left-condition:
- '%mypet_has_pet%:equal:true'
- '%other_placeholder%:notequal:VALUE'
- '%other_placeholder%:over:100'
- '%other_placeholder%:under:200'
inventory-shift-right-condition:
- '%mypet_has_pet%:equal:true'
- '%other_placeholder%:notequal:VALUE'
- '%other_placeholder%:over:100'
- '%other_placeholder%:under:200'

fail-message: '&cYou need to summon your pet.'

RockinChaos commented 4 years ago

Okay so currently I have added all requested features for no.3 (Recipes, Mobs-Drop. and Blocks-Drop) available in the latest snapshot for testing; http://ci.craftationgaming.com/job/ItemJoin/430/

Here is how you should set up each use-case (you can do this in the /itemjoin menu WAY easier.)

  recipe-item:
    id: BEDROCK
    slot: ARBITRARY
    name: '&6Essence'
    lore:
    - '&7Shhhh don''t tell anyone...'
    recipe:
    # X Stands for Air, do NOT include X in the 'ingredients' below.
    - 'XGX' # First row in the crafting table
    - 'IDI' # Second row in the crafting table
    - 'XGX' # Third row in the crafting table
    ingredients:
    # Format: LETTER:ITEMID
    - 'G:GOLD_INGOT' # G Stands for Gold Ingot.
    - 'I:IRON_INGOT' # I Stands for Iron Ingot.
    - 'D:DIAMOND' # D Stands for Diamond, you can use any letter here and the ITEMID can be numerical.
    triggers: DISABLED

Additional info can be found here; https://github.com/RockinChaos/ItemJoin/wiki/DevLog

RockinChaos commented 4 years ago

Snapshot b509 now contains the requested (5. Better Commands). Link; http://ci.craftationgaming.com/job/ItemJoin/509/

Things to note; 1.) Shift-Middle-Click could not be implemented as it is never detected server or client-side. 2.) Creative Mode has been entirely separated from the commands and now has it's own command action since creative mode has been known to be buggy. Something to note about this though is that if this action is defined, any creative mode action will trigger the command as it cannot tell the difference between left/right-click, shifting, or middle-click. This is because MD_5 hardcoded creative mode to always output that the place is left-clicking.

Here are the current command actions, these changes are reflected in the DevLog.


Also note, commands-type has been removed.

RockinChaos commented 3 years ago

Another update, the Snapshot b603 now contains (6. Conditions for Each Command Execution) and (1. Custom disposable conditions.) as well as trigger-conditions. Link; https://ci.craftationgaming.com/job/ItemJoin/603/

These can be defined as a list or single object, the fail message is also optional. For the action to perform you only need to have met ONE of the conditions listed.

1.) Disposable conditions are exactly as described above, simply define them as such;

disposable-conditions:
- '%mypet_has_pet%:equal:true'
- '%other_placeholder%:notequal:VALUE'
- '%other_placeholder%:over:100'
- '%other_placeholder%:under:200'

disposable-fail-message: '&cYou need to summon your pet.'

I wasn't quite sure if you wanted this to PREVENT the command from executing, from what I can tell above is that you want it to execute but not consume under certain conditions so I made the consumption of the item independent from the command execution.

2.) Command conditions are also exactly as described above, however, they do not share a single fail message, you can define individual ones for each condition TYPE, such as interact-conditions can have an interact-fail-message or inventory-left can have an inventory-left-fail-message

inventory-left-conditions:
- '%mypet_has_pet%:equal:true'
- '%other_placeholder%:notequal:VALUE'
- '%other_placeholder%:over:100'
- '%other_placeholder%:under:200'

inventory-left-fail-message: '&cYou need to summon your pet.'

3.) Triggers now can be defined with a condition, (these are shared so it is essentially the condition requirement to GET the item), the ij get command respects these requirements.

trigger-conditions:
- '%mypet_has_pet%:equal:true'
- '%other_placeholder%:notequal:VALUE'
- '%other_placeholder%:over:100'
- '%other_placeholder%:under:200'

trigger-fail-message: '&cYou need to summon your pet.'

Enjoy!

momoservertw commented 3 years ago

Thanks for adding lots of feature~ The condition idea is very wonderful. But I test the interact condition is not work correctly.

This is the test video: https://youtu.be/ncw8pcXYayI

The test configuration: https://pastebin.com/4XRW6RYt

Paper version: git-Paper-439 (MC: 1.16.5) (Implementing API version 1.16.5-R0.1-SNAPSHOT) ItemJoin version: v5.1.1-SNAPSHOT-b603 (Video) ItemJoin version: v5.1.1-SNAPSHOT-b660

Wish you have a nice day. >.0

RockinChaos commented 3 years ago

Thanks for adding lots of feature~ The condition idea is very wonderful. But I test the interact condition is not work correctly.

This is the test video: https://youtu.be/ncw8pcXYayI

The test configuration: https://pastebin.com/4XRW6RYt

Paper version: git-Paper-439 (MC: 1.16.5) (Implementing API version 1.16.5-R0.1-SNAPSHOT) ItemJoin version: v5.1.1-SNAPSHOT-b603 (Video) ItemJoin version: v5.1.1-SNAPSHOT-b660

Wish you have a nice day. >.0

Apologies, I completely forgot to implement Placeholder translation.

The latest snapshot should fix this issue. Please NOTE though, this snapshot contains major changes, notably I have refactored conditions to now end in an S such as interact-condition is now interact-conditions. This was done as it was confusing people since it is technically a listed object. Lastly, the commands identifier was removed for listing commands.

So commands which resembled;

    commands:
      interact-right:
      - 'player: deluxemenus open navigation4'

Should now look like;

    interact-right:
    - 'player: deluxemenus open navigation4'

Do make sure you implement proper YAML formatting as when you remove the commands node there is two spaces in-front of the interact-right node you need to remove.

PS: Thanks for the donation from earlier, I updated the pages to reflect your new contribution amount :)

Link: https://ci.craftationgaming.com/job/ItemJoin/663/ Remember to remove your old ItemJoin.jar file.

RockinChaos commented 3 years ago

Added custom foods as request in the latest snapshot. They use the existing system that the custom apples use so simply define them using the potion-effects option. Example; potion-effects: JUMP:2:120, NIGHT_VISION:2:400, GLOWING:1:410, REGENERATION:1:160

This will work for All consumable foods and for skull items.

Do note this previously was called potion-effect but is now refactored to be potion-effects

Link; https://ci.craftationgaming.com/job/ItemJoin/716/ Remember to remove your old ItemJoin.jar file

Last up... better random commands!