#/store help

1 messages · Page 1 of 1 (latest)

oak elm
#

When I do /store on my plugins test server it dosnt work and shows this

#

let me send my code

#

this is my code for the /store

shut snow
#

cuz you are returning false in your onCommand probably

#

yes

oak elm
#

ohhh

shut snow
#

returning true means the command has been successfully processed, false will show the usage message

oak elm
#

makes sense thanks a lot im new to using spigot api and stuff

main jolt
#

you should be returning true in the code blocks, and returning false if none of the code block conditions were met

oak elm
#

alright thanks guys i did it but let me test it

#

now the message appears blank and if you saw in this code I tried to get it from the config

#

let me show you the config

#

(im trying to remake minemen club plugins bc me and my friends wanna remake it)

#

did I do anything wrong

shut snow
#

does the message not exist? just print smth to the terminal to see if it actually works

oak elm
#

wait print something in minecraft console or use "System.out.println" in the code?

shut snow
#

same thing

oak elm
#

alright let me try

#

actually i have this print out when the plugin enables and it works (just doesnt have the color)

shut snow
#

if you really want color codes, Bukkit.getConsoleSender().sendMessage() would work but you generally dont want to color stuff in console

oak elm
#

alright

#

but it does show the message

#

at first I thought it was because config.yml is formatted incorrectly

#

but now i dont know

shut snow
#

just print the config message

main jolt
#

translateAlternateColorCodes("&", "String here")

#

for the color stuff

oak elm
shut snow
#

ye i mean get the message from config and print whats inside

oak elm
#

how can I do that

#

thats what i put

#

but it didnt work so

shut snow
#

just assign your plugin.getConfig().getString() to a variable and sysout it

main jolt
shut snow
#

smh just realized

oak elm
#

wym

main jolt
#

it should be "Messages.store"

#

in the getString()

shut snow
#

wasnt looking at the path 🥹

oak elm
main jolt
#

where is your quotations?

oak elm
#

ohh mb

#

i just realized

#

so this?

main jolt
#

yep

oak elm
#

thank you very much

#

you guys were helpful

#

as i said im new to spigot api but im still learning

shut snow
#
BukkitWiki

The Configuration API is a set of tools to help developers quickly parse and emit configuration files that are human readable and editable. Despite the name, the API can easily be used to store plugin data in addition to plugin configuration. Presently only YAML configurations can be used. The API however was designed to be extensible and allow ...

oak elm
#

thx

#

wait how can I fix this the color codes dont work and its sending a message to the player not the console so I don't think I can do "Bukkit.getConsoleSender().sendMessage()"

main jolt
#

I have gave you the solution higher up

#

in regards to color

oak elm
#

do this?translateAlternateColorCodes("&", "String here")

main jolt
#

yep

#

String here is where you put your string or message

#

and print that

oak elm
#

wait how can I add it to here

main jolt
#
player.sendMessage(ChatColor.translateAlternateColorCodes("&", this.plugin.getConfig().getString("Messages.store")));
oak elm
#

thx man

#

its underlined in red

#

wait

#

nvm

main jolt
#

add the import for ChatColor

oak elm
#

fixed it

#

yeah i did that

#

i just did

#

i never knew it could say "Someone didn't code the command well :c"

#

i have 0 errors on intellij

main jolt
#

show what you have now for code

oak elm
#

the store class

#

the main class

main jolt
#

why do you check if the args length is 0?

oak elm
#

you're right i put that a day ago i forgot why

#

i removed it

main jolt
oak elm
#

where

main jolt
#

you added one two many S's to messages

oak elm
#

oh wtf

#

i did lmao

#

there i finally fixed it

main jolt
#

should be good now 🙂

oak elm
#

thanks a lot

#

it works

main jolt
#

should be able to type /store as well

#

adding the plugins name is only useful if you have 2 plugins with the same command's

#

also, if you add http://