Sick Gaming
Minecraft CMI Admin / Server / Item Shops Method with Examples - Printable Version

+- Sick Gaming (https://www.sickgaming.net)
+-- Forum: Our Game Servers (https://www.sickgaming.net/forum-58.html)
+--- Forum: Minecraft (https://www.sickgaming.net/forum-103.html)
+--- Thread: Minecraft CMI Admin / Server / Item Shops Method with Examples (/thread-100189.html)



Minecraft CMI Admin / Server / Item Shops Method with Examples - SickProdigy - 11-05-2022

Admin/Server/Item Shops

Zrips: https://www.zrips.net/itemshop/

Felt like this method/tutorial should be let known. The method on the website kind of points in one direction, and doesn't quite touch base on how to get a decent, server/admin shop setup.

With Residences (another plugin offered by zrips), you are able to create shops within also. That has not been incorporated into this yet.

Dynamic Signs could be used if you like editing from config file. Must first be setup for each sign. Not very intuitive. if you use '/dsign' or '/cmi dsign' while looking at a dynamic sign, you can edit it. To make a dynamic sign, you place a sign, then run the following

Command:
Code:
/cmi dsign new
Note* Must be looking at a sign.

Config File it created: dynamicSigns.yml
Example:
Code:
'1':
  Interval: 5.0
  Range: 8
  Personal: true
  Lines:
  - {#dfcd6f}Bread
  - 'Price: {#24500f}50₿'
  - {#1c39bb}Click to BUY

The issue with using Dynamic sign, is if you use sign edit '/se [linenumber] text' the dynamic sign just goes obsolete. So it is recommended to NOT use /se with dynamic signs. All of these are separate features and have to be used somewhat differently from each other. Or in certain fashions to work correctly.


Interactive Commands;
Using IC, you can view all IC's available with '/ic' or '/cmi ic'
Also, once a sign has been made it will not update from config. It will be a static sign that's intractable. Using this method doesn't make it easy to edit signs already made.

Creating an InteractiveCommand Sign:

IC Method 1:
Method 1 TL;DR: Create a sign with /ic, apply permissions, use [ic:icname] in first line of sign upon creation. Doesn't work any other way. /cmi reload doesn't reload config SignLines.


Command:

Code:
/cmi ic new name-of-sign/shop

Config File: interactiveCommands.yml
Code:
# Use [ic:[icname]] in first line of sign. Make sure to give permissions for cmi.interactivesign.* to user posting
goldappless:
  Locations:
  - world1;-1066.0;71.0;-552.0
  Commands:
  - cmi money take [playerName] 10000
  - cmi give [playerName] golden_apple
  - cmi actionbarmsg [playerName] Golden Apple placed in your inventory
  SignLines:
  - '{#dfcd6f}Golden Apple'
  - 'Price: {#0bda51}10000₿'
  - ' '
  - '{#08e8de}Click to BUY'
  Public: true
sellshop:
  Commands: []
carrotshop:
  Locations:
  - world1;-1063.0;71.0;-555.0
  Commands:
  - cmi money take [playerName] 50
  - cmi give [playerName] carrot
  - cmi actionbarmsg [playerName] Carrot placed in your inventory
  SignLines:
  - '{#dfcd6f}Carrot'
  - 'Price: {#0bda51}50₿'
  - ' '
  - '{#08e8de}Click to BUY'
  Public: true
cakeshop:
  Locations:
  - world1;-1063.0;71.0;-554.0
  Commands:
  - cmi money take [playerName] 150
  - cmi give [playerName] cake
  - cmi actionbarmsg [playerName] Cake placed in your inventory
  SignLines:
  - '{#dfcd6f}Cake'
  - 'Price: {#0bda51}150₿'
  - ' '
  - '{#08e8de}Click to BUY'
  Public: true
applesshop:
  Locations:
  - world1;-1066.0;72.0;-553.0
  Commands:
  - cmi money take [playerName] 100
  - cmi give [playerName] apple
  - cmi actionbarmsg [playerName] Apple placed in your inventory
  SignLines:
  - '{#dfcd6f}Apples'
  - 'Price: {#0bda51}100₿'
  - ' '
  - '{#08e8de}Click to BUY'
  Public: true
breadshop:
  Locations:
  - world1;-1063.0;71.0;-552.0
  Commands:
  - cmi money take [playerName] 50
  - cmi give [playerName] bread
  - cmi actionbarmsg [playerName] Bread placed in your inventory
  SignLines:
  - '{#dfcd6f}Bread'
  - 'Price: {#0bda51}50₿'
  - ' '
  - '{#08e8de}Click to BUY'
  Public: true
eggsshop:
  Locations:
  - world1;-1063.0;72.0;-553.0
  Commands:
  - cmi money take [playerName] 50
  - cmi give [playerName] egg
  - cmi actionbarmsg [playerName] Egg placed in your inventory
  SignLines:
  - '{#dfcd6f}Egg'
  - 'Price: {#0bda51}50₿'
  - ' '
  - '{#08e8de}Click to BUY'
  Public: true
sugarshop:
  Locations:
  - world1;-1063.0;71.0;-556.0
  Commands:
  - cmi money take [playerName] 50
  - cmi give [playerName] sugar
  - ' '
  - cmi actionbarmsg [playerName] Sugar placed in your inventory
  SignLines:
  - '{#dfcd6f}Sugar'
  - 'Price: {#0bda51}50₿'
  - ' '
  - '{#08e8de}Click to BUY'
  Public: true

You can use the sign name like so
Code:
[ic:applesshop]
In the first line of the sign only when you first place the sign. You must remove and replace the sign to name again with Interactive Command options and sign lines.

If you run
Code:
/ic

You will get a list of InteractiveCommands you have created. Or option to create more by clicking GREEN + sign.

[Image: NxsvdGz.png]

From here you can click the InteractiveCommand you want and make it public.
[Image: PvA74ct.png]
You should be able to see what the sign should have in the top line here also.
Make sure to
[Image: kLL6Ye5.png]
Enabled, requires permission to place the sign.
Also add that permission or cmi.interactivesign.* to the user or group trying to create the signs.

This only works when you first create the sign. Sign Edit will mess it up, along with dynamic sign. So don't use those on the sign once you get it working.

With IC, you can edit signs in the config file if you used [ic:[icname]] in top line of sign:
Code:
apples-shop:
  Locations:
  - world1;-1066.0;71.0;-555.0
  Commands:
  - cmi money take [playerName] 100
  - cmi give [playerName] apple
  SignLines:
  - '{#dfcd6f}Apples'
  - 'Price: {#0bda51}100₿'
  - '{#08e8de}Click to BUY'
The lines don't seem to update with /cmi reload.
So doesn't seem to be a quick way to update compared to dynamic signs. It will reload with the command above.

You can also edit sign lines using /ic click the ic,
and look for [EditSignLines] in the new conext menu followed with a click.
Now each line is editable with a click.
Example:
[Image: VsYIJMo.png]

If you change it to public status, anyone can paste the IC sign.
If you enable [ReqPerm], any user with cmi.interactivesign.[icname] permission node will be able to paste that IC sign.
You could give admin cmi.interactivesign.* for access to all signs.
Locations in file are updated automatically.

cmi.interactivesign.[icname] – Allows to create interactive signs when using [ic:[icName]] as top line of sign

As you can see, you can further narrow it down per group in Lucky Perms (permission software).
Have VIP members able to use signs, or maybe user shops can come into play. cmi pay command can be used etc.

Note* Editing from config and then editing from GUI can turn into a hassle. Be sure your copy is updated everytime you make an edit. Otherwise some changes won't be saved, or some changes will be overwritten. Editing sign lines DOESN'T auto update in game.

IC Method 2:
Method 2 TL;DR: You can preformat a sign in game using /se or /dsign and apply an interactive sign to the block you are looking at.

Command:
Code:
/cmi ic new name-of-sign/shop

Config File: interactiveCommands.yml
Code:
# Use [ic:[icname]] in first line of sign. Make sure to give permissions for cmi.interactivesign.* to user posting
goldappless:
  Locations:
  - world1;-1066.0;71.0;-552.0
  Commands:
  - cmi money take [playerName] 10000
  - cmi give [playerName] golden_apple
  - cmi actionbarmsg [playerName] Golden Apple placed in your inventory
  SignLines:
  - '{#dfcd6f}Golden Apple'
  - 'Price: {#0bda51}10000₿'
  - ' '
  - '{#08e8de}Click to BUY'
  Public: true
sellshop:
  Commands: []
carrotshop:
  Locations:
  - world1;-1063.0;71.0;-555.0
  Commands:
  - cmi money take [playerName] 50
  - cmi give [playerName] carrot
  - cmi actionbarmsg [playerName] Carrot placed in your inventory
  SignLines:
  - '{#dfcd6f}Carrot'
  - 'Price: {#0bda51}50₿'
  - ' '
  - '{#08e8de}Click to BUY'
  Public: true
cakeshop:
  Locations:
  - world1;-1063.0;71.0;-554.0
  Commands:
  - cmi money take [playerName] 150
  - cmi give [playerName] cake
  - cmi actionbarmsg [playerName] Cake placed in your inventory
  SignLines:
  - '{#dfcd6f}Cake'
  - 'Price: {#0bda51}150₿'
  - ' '
  - '{#08e8de}Click to BUY'
  Public: true
applesshop:
  Locations:
  - world1;-1066.0;72.0;-553.0
  Commands:
  - cmi money take [playerName] 100
  - cmi give [playerName] apple
  - cmi actionbarmsg [playerName] Apple placed in your inventory
  SignLines:
  - '{#dfcd6f}Apples'
  - 'Price: {#0bda51}100₿'
  - ' '
  - '{#08e8de}Click to BUY'
  Public: true
breadshop:
  Locations:
  - world1;-1063.0;71.0;-552.0
  Commands:
  - cmi money take [playerName] 50
  - cmi give [playerName] bread
  - cmi actionbarmsg [playerName] Bread placed in your inventory
  SignLines:
  - '{#dfcd6f}Bread'
  - 'Price: {#0bda51}50₿'
  - ' '
  - '{#08e8de}Click to BUY'
  Public: true
eggsshop:
  Locations:
  - world1;-1063.0;72.0;-553.0
  Commands:
  - cmi money take [playerName] 50
  - cmi give [playerName] egg
  - cmi actionbarmsg [playerName] Egg placed in your inventory
  SignLines:
  - '{#dfcd6f}Egg'
  - 'Price: {#0bda51}50₿'
  - ' '
  - '{#08e8de}Click to BUY'
  Public: true
sugarshop:
  Locations:
  - world1;-1063.0;71.0;-556.0
  Commands:
  - cmi money take [playerName] 50
  - cmi give [playerName] sugar
  - ' '
  - cmi actionbarmsg [playerName] Sugar placed in your inventory
  SignLines:
  - '{#dfcd6f}Sugar'
  - 'Price: {#0bda51}50₿'
  - ' '
  - '{#08e8de}Click to BUY'
  Public: true

There should be a command to auto bind to the block you are facing when inputting that command. I'm not sure of it at this moment.

Instead, click the + button after you run the command. It will add the block you are looking at when looking at a sign (or hologram, or whatever object really).

[Image: dIo3cmk.png]

You can use this exact script from above, just delete the location for everything, and in game run '/cmi ic'. Click the item you want to add a location for. Then click the '+' button to use the location you are looking at.

If you use the + button to add the sign instead of using the [ic:[icname]] in the first line, you can use sign edit (/se) or dynamic sign (/dsign) on the sign to manage it.
This does dis-associate the InteractiveCommand sign-lines with the sign though. Rather annoying it doesn't work like dynamic signs and reload anytime the top line says [ic:icname], so keep in mind that little bug.

And that's the end of IC Method 2.

You can technically have any block, hologram w/wo floating icon, or even entities as right clickable. Have a sign or another hologram line to explain the price. Only limited by your imagination it seems.

In image example below you will see I have setup a hologram in front of a sign, but when you right click the sign it will buy the item floating.

[Image: 6iarLYq.png]

You could have the item floating right clickable in hologram also to buy. Not covered here yet.


Hologram Sell Shops:

You could use hologram with pages, and each page would be a different item. just right click the 'Buy' line to buy the item, using commands from above. May look sleek. Will have to try it later.

Note*

Priority of Sign features are like so

Sign Edit > Dynamic Signs > Interactive Commands

If you use sign edit, that sign will be dis-associated with Dynamic sign or Interactive commands. So SE (Sign edit) takes precedence over the other features. Then dynamic sign, I believe will take precedence over IC signs. So if you setup an IC, then use DS on it, you no longer can edit with IC. You can always change the commands on IC, just won't have access to edit SignLines because the sign has been dis-associated. Using IC to create a sign, changes made in config aren't static after a sign has been made using IC.

Hope this helps others.

SickProdigy