Solved Item name colour

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

JuliHatSpaB

Member
Aug 18, 2023
47
1
8
I want to give a player an item with the '/give' command with has a bold name. An example command: /give @p netherite_pickaxe{Damage:1000,display:{Name:'[{"text":"Superfast Pickaxe","italic":false,"bold":true},{"text":"","italic":false,"bold":false}]'},Enchantments:[{id:efficiency,lvl:6},{id:unbreaking,lvl:4}]} 1. Now I want to do something like that in skript:
Code:
on block damage:
    if name of player's tool is "&lSuperfast Pickaxe":
But how do I get the correct name of the item? &l doesn't work and just the name without any formatting also doesn't work.
 
on block damage:
if name of player's tool is "&lSuperfast Pickaxe":
execute console command: "/give @p netherite_pickaxe{Damage:1000,display:{Name:'[{"text":"Superfast Pickaxe","italic":false,"bold":true},{"text":"","italic":false,"bold":false}]'},Enchantments:[{id:efficiency,lvl:6},{id:unbreaking,lvl:4}]} 1"

I havent tested it but see if it works
 
I want to give a player an item with the '/give' command with has a bold name. An example command: /give @p netherite_pickaxe{Damage:1000,display:{Name:'[{"text":"Superfast Pickaxe","italic":false,"bold":true},{"text":"","italic":false,"bold":false}]'},Enchantments:[{id:efficiency,lvl:6},{id:unbreaking,lvl:4}]} 1. Now I want to do something like that in skript:
Code:
on block damage:
    if name of player's tool is "&lSuperfast Pickaxe":
But how do I get the correct name of the item? &l doesn't work and just the name without any formatting also doesn't work.
Hello! You could do something like:

Code:
on load:
   set {pick} to netherite pickaxe named "Superfast Pickaxe" of efficiency 6 and unbreaking 4

command adminpick:
   trigger:
      give 1 of {pick} to player

on block damage:
   if player's tool is {pick}:
      # Code here
 
on block damage:
if name of player's tool is "&lSuperfast Pickaxe":
execute console command: "/give @p netherite_pickaxe{Damage:1000,display:{Name:'[{"text":"Superfast Pickaxe","italic":false,"bold":true},{"text":"","italic":false,"bold":false}]'},Enchantments:[{id:efficiency,lvl:6},{id:unbreaking,lvl:4}]} 1"

I havent tested it but see if it works
When giving custom items to players, it is ineffective to use 'execute console command' then the give item command as NBT commands for Vanilla (Like /give) are extremely long and makes code slower/ineffective as compared to the solution I proposed for giving a custom pickaxe (Longer code that works is not good code!).
 
No... You've both missunderstood me...
The player will recievee the tool through command blocks but in skript I want to add a custom function for some blocks when the player tries to break them and I want to check if the player is breaking the block with the Pickaxe but I don't know how I can check this. So how I get the name of the Item when it's bold like this: "text":"Superfast Pickaxe","italic":false,[B]"bold":true[/B].
 
No... You've both missunderstood me...
The player will recievee the tool through command blocks but in skript I want to add a custom function for some blocks when the player tries to break them and I want to check if the player is breaking the block with the Pickaxe but I don't know how I can check this. So how I get the name of the Item when it's bold like this: "text":"Superfast Pickaxe","italic":false,[B]"bold":true[/B].
In that case, I believe your issue would be that in your original code you just use the color code "&l" which only makes it bold. If it's not italic and it's bold it would probably have the color "&f" (So: "&f&lSuperfast Pickaxe"). Also, just a suggestion but command blocks for that kinda of thing aren't super effective since it could be easy for a player to exploit them to lag your server (It would be better to have a custom command set up via Skript and prevent the player from dropping the item but that's just my opinion).
 
In that case, I believe your issue would be that in your original code you just use the color code "&l" which only makes it bold. If it's not italic and it's bold it would probably have the color "&f" (So: "&f&lSuperfast Pickaxe"). Also, just a suggestion but command blocks for that kinda of thing aren't super effective since it could be easy for a player to exploit them to lag your server (It would be better to have a custom command set up via Skript and prevent the player from dropping the item but that's just my opinion).
I will try this soon (not at the PC at the moment). But I guess I'm more limited with Skript that with a command... Or the console command could be an option...