Other available versions. Ordered by newest to oldest versions:
Just so you know, we don't know the file format for every file. If it's just a bunch of random characters, it's probably a .zip or .jar.
# ################################################################
# Chat Items
# This script allows players to put items from their inventory in chat. You can also put
# multiple items in chat by specifying a slot between 1 and 36.
# WORKS WITH ANY ITEM
# Made by AsuDev
# Date: 2/6/20
# Requires skript-mirror 2.0 / skquery
# NOTICE
# If you are using Skript 2.3.7 or LOWER, you do not need to change anything.
# If you are using Skript 2.3.7 or HIGHER, you need to comment out line 171 and uncomment line 172!
# ################################################################
# OPTIONS / IMPORTS
option ver:
get:
return console.getServer().getClass().getPackage().getName().split("\.")[3]
import:
org.bukkit.inventory.ItemStack
net.minecraft.server.{@ver}.ChatComponentText
org.bukkit.craftbukkit.{@ver}.inventory.CraftItemStack
java.lang.String as St
java.util.UUID
options:
# PERMISSION OPTIONS
# Require sharing items in chat to have permission 'chatitems.share'
useItemChatPermission: false
# CHAT OPTIONS
# The amount of items a player can put in chat
allowedOccurencesOfItem: 3
# Capitalize uncapitalized item names for items that do not have a name
capitalizeItemNames: true
# Removes underscores and replace with spaces
replaceUnderScoresWithSpaces: true
# The original chat color so it reformats itself after adding an item
originalChatColor: &f
# Default item color for items that do not have a name
defaultItemColor: &7
# Bracket color
defaultBracketColor: &7
# Item tooltip when hovering over items in chat
hoverItemTooltip: %{_defaultItemColor}%%{_n}%%nl%&7Click to view this item.
# Show item stack amount in chat
showStackAmount: true
# Item stack in chat format
amountFormat: &7x%{_amount}%
# GUI OPTIONS
# Display item gui name
guiDisplayItemName: &a%arg 1%'s Display Item
# Gui size (rows)
guiSize: 1
# Item slot
itemGuiSlot: 4
on skript start:
set {item-counter} to 1
delete {item-displays::*}
set {hidden-id} to UUID.randomUUID().toString()
on script load:
{item-counter} is not set
set {item-counter} to 1
delete {item-displays::*}
set {hidden-id} to UUID.randomUUID().toString()
# ################################################################
# FUNCTIONS
function replaceUnderScoresWithSpaces(s: string) :: string:
replace all "_" with " " in {_s}
return {_s}
function capitalizeItemNames(s: string) :: string:
set {_s::*} to {_s} split by " "
loop {_s::*}:
set {_sub} to ""
set {_sub} to subtext of loop-value from 2 to length of loop-value
set {_s::%loop-index%} to "%first character of loop-value in upper case%%{_sub}%"
return join {_s::*} by " "
# COMMANDS
# This command should not be used normally, only for chat.
command /viewitem [<text>] [<text>] [<integer>]:
trigger:
if arg 1 is not set:
stop
if arg 2 is not {hidden-id}:
stop
if {item-displays::%arg 3%} is not set:
message "&cThat preview item no longer exists."
stop
set metadata value "Item-Gui" of player to "true"
open chest with {@guiSize} rows named "{@guiDisplayItemName}" to player
wait 1 ticks
set slot {@itemGuiSlot} of player's current inventory to {item-displays::%arg 3%}
# HIGHLY RECOMMENDED TO CLEAR CHAT AFTER RESET!
command /resetchatitems:
trigger:
if player has permission "chatitems.admin":
delete {item-counter} and {item-displays::*}
message "&7Chat items have been completely reset."
else:
message "&cYou do not have permission to do this."
# ################################################################
# EVENTS
# Main chat event
on chat:
if message contains "[item-" or "[i-":
if {@useItemChatPermission} is true:
if player does not have permission "chatitems.share":
stop
if event is not cancelled:
cancel event
if event.getFormat() contains "%%":
set {_s} to St.format(event.getFormat(), player.getDisplayName(), message)
else:
set {_s} to event.getFormat()
set {_counter} to 0
set {_defaultItemColor} to "{@defaultItemColor}"
set {_subtexts::*} to {_s} split by " "
loop {_subtexts::*}:
delete {_failed} and {_n} and {_amount}
if {_counter} is {@allowedOccurencesOfItem}:
stop 1 loop
if loop-value contains "[item-" or "[i-":
set {_c} to loop-value
replace all "[item-" and "[i-" and "slot" and "sl" and "s" and "]" with "" in {_c}
set {_c} to "%{_c}%" parsed as integer
if {_c} is not a integer:
set {_failed} to true
if {_c} is not between 1 and 36:
set {_failed} to true
if slot {_c}-1 of player's inventory is air:
set {_failed} to true
{_failed} is not set
set {_i} to slot {_c}-1 of player's inventory
if {@showStackAmount} is not true:
set {_i} to 1 of {_i}
add {_i} to {item-displays::*}
set {_n} to name of {_i}
if {_n} is not set:
set {_n} to "%type of {_i}%"
if {@replaceUnderScoresWithSpaces} is true:
set {_n} to replaceUnderScoresWithSpaces({_n})
if {@capitalizeItemNames} is true:
set {_n} to capitalizeItemNames({_n})
replace all " Item" and "Item" with "" in {_n}
if {@showStackAmount} is true:
set {_amount} to {_i}.getAmount()
set {_n} to "{@amountFormat} {@defaultItemColor}%{_n}%"
set {_subtexts::%loop-index%} to "<tooltip:{@hoverItemTooltip}><cmd:/viewitem %player% %{hidden-id}% %{item-counter}%>{@defaultBracketColor}[{@defaultItemColor}%{_n}%{@defaultBracketColor}]&r{@originalChatColor}"
add 1 to {_counter} and {item-counter}
set {_s} to join {_subtexts::*} by " "
send "%{_s}%" to all players # For versions under 2.3.7
#send formatted "%{_s}%" to all players # For versions 2.3.7+
send "%St.format(event.getFormat(), player.getDisplayName(), message)%" to console
on inventory click:
metadata value "Item-Gui" of player is set
cancel event
on inventory close:
metadata value "Item-Gui" of player is set
clear metadata value "Item-Gui" of player
# ################################################################