#help-development

1 messages ยท Page 108 of 1

boreal seal
#

alex why do u use

#

enums?

#

like whats the point?

sterile token
#

i dont udnerstand

#

explain again

desert frigate
#

lemme just show u the full code

Campfire campfire = (Campfire) Bukkit.getWorld("birchForest").getBlockData(120, 94, -38);
        campfire.setLit(true);
        player.sendBlockChange(new Location(Bukkit.getWorld("birchForest"),120, 94, -38), (CraftBlockData) campfire);```
noble forge
#

you could also send the errors

#

which is a lot more useful

#

since they tell you whats wrong

sterile token
# boreal seal like whats the point?

I mean i need to block every interaction that has an inventory, so as the plugin should work on 1.13, 1.14, etc, until 1.19 i need an enum with all block which contains inventory

glossy lily
#

_ _

#

some1 help

sterile token
desert frigate
glossy lily
#

ok

sterile token
#

If need fast support go and look for someone on services

#

We are not getting paid for help so just be quiet and wait patienly until someone answer/help

glossy lily
#

illiterate

#

be more specific

sterile token
#

I mean

glossy lily
#

i thought you were one of those stupid kids that comes here & types gibberish into this channel then leaves

#

i had to read that like 5 times

sterile token
#

?

#

I dont udnerstand your point

#

have you seen that mc contains items which has inventories right? So that items are diff on each version (1.13, 1.14, etc until 1.19) so i cant just loop over a Set<Material> with all that type of blocks

granite burrow
#

I'm so confused...

How come when I have brackets [ & ] in my text component the formatting works perfectly, but when I remove them it no longer allows me to reset the bold?

The [ & ] is from converting a list to a string btw

The base code I use for converting to a string and coloring everything is:

    // Convert the string list to a string
    private String formatHoverMessage(Player p, List<String> strList) {
        String output = strList.toString().replace(", ", "&r\n&r").replace("[", "").replace("]", "");

        return output;
    }
    // Convert string to colored Text
    public Text textCompChatColor(String str) {
        Text textComp = new Text(TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', str), ChatColor.WHITE));
        // Allow user to use & instead of the weird minecraft color codes
        return textComp;
    }
desert frigate
# noble forge you could also send the errors
Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_18_R1.block.data.CraftBlockData cannot be cast to class org.bukkit.block.data.type.Campfire (org.bukkit.craftbukkit.v1_18_R1.block.data.CraftBlockData and org.bukkit.block.data.type.Campfire are in unnamed module of loader java.net.URLClassLoader @7aec35a)
    at moody.core.commands.test.onCommand(test.java:32) ~[MoodyCore.jar:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.18-R0.1-SNAPSHOT.jar:?]
    ... 21 more```
glossy lily
#

im pretty sure theres a function to check if a block id exists or not

sterile token
#

He?

#

I dont understand what you mean

#

You are talking in english really closed which i cant understand

glossy lily
#

what language do you speak

#

?

sterile token
#

Spanish

#

But spigot crazy rules doesnt allow to speak another lang

round finch
#

si

sterile token
torpid sapphire
#
AttributeModifier modifier = new AttributeModifier("generic.attack_damage", 0, AttributeModifier.Operation.MULTIPLY_SCALAR_1);
meta.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, modifier);``` is this the correct way to set the sword damage to 0?
glossy lily
#

looks correct

#

are you applying the new meta to the sword

#

?

torpid sapphire
#

yes

glossy lily
#

does it work

#

?

torpid sapphire
#

just wondering if this was the correct way

#

works just fine

glossy lily
#

looks about right

#

i think you could make it more compact but that would look ugly

torpid sapphire
#

yeah this is already too long

round finch
sterile token
#

I thought u were spanish

glossy lily
#

can anyone help now

desert frigate
#

same error

tardy delta
#

what erro?

noble forge
#

what is line 32 of test.java

desert frigate
#

uh

    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
        Player player = (Player) sender;
        Lightable campfire = (Lightable) Bukkit.getWorld("birchForest").getBlockAt(120, 94, -38);
        campfire.setLit(true);
        player.sendBlockChange(new Location(Bukkit.getWorld("birchForest"),120, 94, -38), campfire.getMaterial().createBlockData());```
#

thats lines 32

tardy delta
#

cast the blockstate

#

or data, check docs

noble forge
#

you changed getBlockData to getBlockAt

ancient plank
#

cursed

lime jolt
#

why cant I run a method in a "onCommand" method

hazy parrot
#

send your code

lime jolt
#

alr

#

public static void allSpawnTp(String mapName){}

tardy delta
#

lmao

lime jolt
#

inside

hazy parrot
#

you cant declare method

lime jolt
hazy parrot
#

inside of another method

lime jolt
#

it aint in the other method

#

lmao

hazy parrot
#

your code looks like

public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

  public static void allSpawnTp(String mapName){}

}
#

?

lime jolt
#

no

hazy parrot
#

then send your code

lime jolt
#

its like 1k lines long

hazy parrot
#

only relevant part

lime jolt
#

when I call allSpawnTp.(map);

#

inside of

hazy parrot
#

remove dot

lime jolt
#

wait

#

omg

#

;-;

#

sometimes

#

I wonder

#

why

glossy lily
#

braindead

lime jolt
#

Ima go back to learning java basics

glossy lily
#

its ok i am also braindead

lime jolt
#

๐Ÿค“

hazy parrot
#

We all are sometimes

lime jolt
#

very big L moment

round finch
#

error Code-18?

lime jolt
#

SystemdotoutdotprintlnparenthesisquotationmarksHello Worldquotationmarksparenthesissemicolon

glossy lily
#

can anyone help me

#

_ _

#

im not sure of a good fix for this

hybrid pond
#

nope, Bukkit.getScheduler().runTask takes BukkitRunnable but I have BukkitTask

#

and it runs on the next tick, I fear plugin wont exist on the next tick

round finch
sharp heart
#

do someone know why player#rayTraceBlocks() don't detect entities ?

#

it always return me null

queen apex
#

Doesn't work

method getLogger in class org.bukkit.plugin.java.JavaPlugin cannot be applied to given types;
hazy parrot
#

what are you putting as args ?

sharp heart
hazy parrot
#

what range

sharp heart
#

100

#

it's work perfectly for blocks

#

but don't detect entity

hazy parrot
#

oh you originally said it doesn't work for block too

#

because its probably rayTraceBlocks

sharp heart
#

yes

#

but player doesn't have rayTraceEntities

#

instead of World

hazy parrot
sharp heart
#

how to get the Vector "direction" ?

#

with a player

#

forget that

#

I'm idiot

boreal seal
#

guski

#

i got an question

kindred valley
#

So what is the difference between instantiated value and the value?

boreal seal
#

im using switch case

#

anyway

#

dont judge me please

#

can i use Biome in enum?

#

Biome is already an enum

#

but it dont allow me to use StringValueOf in biome

#

lol

kindred valley
hazy parrot
#

and then vector with Location#getDirection() i guess

quaint mantle
#

I have a data.yml file in my resource folder in intelij and it compiles fine but when I run the plugin when starting the minecraft server the folder does not show up, what am I doing wrong ?

hazy parrot
quaint mantle
hazy parrot
grim ice
hazy parrot
grim ice
quaint mantle
regal lake
#

Is there a way to get all items which are used while crafting (CraftItemEvent) except the result item ?

eternal oxide
#

Either get the recipe or read the matrix

regal lake
#

If i get the recipe i get the wrong itemstack (wrong itemmeta) or ?
What do you mean with "read the matrix" ?

eternal oxide
#

The event has a getInventory() method. That will have the crafting matrix in it

#

or just use the recipe, if the action was to remove the result

regal lake
#

I tried it with

CraftingInventory craftingInventory = event.getInventory();
-> craftingInventory.getContents()

But it also contains the result item.
I only need the items which are consumed after crafting for some checks e.g. custom model data.

eternal oxide
#

CraftingInventory has a method getMatrix()

regal lake
#

This is what i searched for, thanks!

arctic moth
#

"worldgen plugin"

dire marsh
arctic moth
#

ikr

narrow lichen
#

hi, how can i add disable-world to my plugin?

arctic moth
#

anyone know what P is?

#

a lot of entities in p

visual tide
haughty idol
#

agh i'm in pain

#

i'm trying to make it so that when i choose a class in my GUI it saves the username to the config.yml file but it's beeing really annoying

kind hatch
#

How are you trying to save it? It should be as simple as this.

getConfig().set("path.to.username.variable", player.getName());
saveConfig();
haughty idol
#

i can show my code in a bit, but for now, all i'm doing is trying to save the config in an eventhandler

median trench
#

Is it possible to block wither invulnerability particles or is it client side?

haughty idol
#

and i can't find a way to saveconfig

#

i can do getconfig by accessing Bukkit.getServer().spigot().getConfig()

river oracle
#

Bukkit#getConfig

#

or wait its

#

Plugin#getConfig

kind hatch
#

^

haughty idol
#

"Non-static method can not be referenced from a static context

kind hatch
river oracle
haughty idol
#

also i'm trying to saveconfig

#

oh.

#

pain

#

???

median trench
haughty idol
#

i don't have static anywhere in my code twt

#

also why do you put #'s instead of .'s

kind hatch
hazy parrot
#

Because that is reffering to instance method

median trench
haughty idol
#

hm

#

so i wouldn't actually put the # in my code? i would put a .?

haughty idol
#

ok

river oracle
#

please learn java basics before starting spigot :)

hazy parrot
#

Cant do just Plugin.getConfig()

haughty idol
#

so i would get the plugin

#

right

#

how? i can't input more than one parameter into a event

kind hatch
#

Through the constructor.

hazy parrot
#

?learnjava

undone axleBOT
haughty idol
#

mk

#

thanks shadow

sleek ridge
#

how do i remove these: [โ€‹IMG]

from my spigot page?
like its not in the editor

#

i wish i could post pictures

kind hatch
#

You just need to verify your spigot account to post images.

#

It's either ?verify of !verify.

dusk flicker
#

in the resource description if its showing up it means it generally cant locate that image

#

so reupload them/new link

kind hatch
#

Yea, broken image links. Likely doesn't exist anymore.

#

So you'll have to update the image link, or just remove it.

dusk flicker
#

something should show in the editor

#

or you might have to look in the bbcode option

kind hatch
#

The advanced editor is all I use. ๐Ÿ˜›

haughty idol
#

Menu menu = new Menu(); hmm this breaks because i have some set paramaters in the constructor. i can't remove them because i assume that would break the executors

sleek ridge
haughty idol
kind hatch
haughty idol
#

i should take a water break

sleek ridge
#

thankyou

torpid sapphire
#

is there an easy way to slow down mining speed without just using mining fatigue?

haughty idol
kind hatch
dusk flicker
#

+1 Shadow

pallid yoke
#

Oh lol sorry, I was in the wrong channel. Thanks!

haughty idol
dusk flicker
#

you arent giving us any information

haughty idol
#

should i put it in a pastebin or just put it right here

dusk flicker
#

yes, and what you are actually doing

#

?paste in here

undone axleBOT
haughty idol
#

I'm trying to implement a class system that saves the player's class in the config files

kind hatch
#

Uhhhhh, I don't believe that is a valid config.yml

dusk flicker
#

looks like its stored in json

#

which would be a valid yml

hazy parrot
#

Use database for those kind of stuff

#

Not yaml or jsons

dusk flicker
#

but as Goksi said, you should use a db

haughty idol
#

hm

#

okay

dusk flicker
#

some other things of note I see

haughty idol
#

(don't mind me being dumb, but i use a sql for that right?)

hazy parrot
#

Sure

dusk flicker
#

sql is one of many options

haughty idol
#

what's the best?

#

or are they all fine

hazy parrot
#

I personally like postgresql, but there are much more options

haughty idol
dusk flicker
#

a few other things I see; for getting your config in the Menu class you are getting it from Bukkit.getServer.spigot.getConfig; just use your main class .getConfig
Commands in the main class- drop the Objects.requireNonNull it's just makes it look stupid. Only reason it will be null is if it does not exist in the plugin yml.

kind hatch
#

Yaml and json are also fine for storing data. At least starting off. The problem with them comes with larger datasets. Mostly file overhead and speed vs a much faster and more optimized database.

haughty idol
hazy parrot
#

Or some kind of database, relational or not, doesn't matter

kind hatch
# dusk flicker a few other things I see; for getting your config in the Menu class you are gett...

Some things I see.
- Registering listeners in the constructor of the class.
- This is only bad because if this class gets instantiated again for some reason during runtime, the entire event listener list has to be remade/recalculated.
- No break keywords in your switch statements.
- With the newer style of switch statements, you can omit them, but they are still required for the older style.

  • What is this implements ClassSystem.Variables
haughty idol
dusk flicker
#

singleton

kind hatch
haughty idol
#

oh...

hazy parrot
dusk flicker
#

OR

haughty idol
#

i'm fricking dumb

dusk flicker
#

?di

undone axleBOT
dusk flicker
#

which you can use

#

as you basically have it already

#

you're using DI for registering listeners, all you would need to do is set a variable in said class to your main class which you got through the contructor

#

(rough explination, read the wiki lol)

hazy parrot
haughty idol
#

so should i register listeners in main class?

dusk flicker
#

ye

haughty idol
#

ok

dusk flicker
#

still pass your plugin instance; you can use that for DI (the wiki)

onyx fjord
#

spigot has no mixins and shit right?

eternal night
#

it does not

onyx fjord
#

lol

dusk flicker
#

what do you mean by mixins?

onyx fjord
#

then why NCR dev sent me to some page with mixins

grim ice
eternal night
#

there is ignition

onyx fjord
eternal night
#

which is a loader for spigot to get mixins

#

looks like a fabric mod xD

onyx fjord
#

yeah but it detects servers using my plugin as servers that sign

#

while they dont

kind hatch
onyx fjord
#

actually i can open plugin message channel right?

#

so other software can hook

dusk flicker
#

Not technically true Shadow

dusk flicker
#

yes it uses Json

#

BUT it really uses Bson- their version of it, which saves it as binary

hazy parrot
#

I won't argue over it, but here is straight from json site

haughty idol
#

for each player

#

its an array

dusk flicker
grim ice
hazy parrot
grim ice
#

what even is this argument about

kind hatch
#

Whether or not JSON is a valid way to store data compared to a standard database.

grim ice
#

and btw

#

just so u know

dusk flicker
#

storing playerdata in a yml file

#

thats what this is about

hazy parrot
#

its not argument

grim ice
#

json is a non relational flat-file database

hazy parrot
dusk flicker
#

Does JSON get used for storing data? Yes. Is it JSON's use case? No.

grim ice
#

same for json

hazy parrot
grim ice
#

Hm? prove me wrong then

haughty idol
hazy parrot
#

i mean, using that logic, you can use txt for saving data

kind hatch
#

I mean... you can.

grim ice
#

And?

haughty idol
#

i mean i'm gonna use sql, it's really good to learn

grim ice
#

that's pretty much wrong

haughty idol
#

for like website databases

hazy parrot
grim ice
#

json and yml are specifically made for storing data

haughty idol
#

i was just using config.yml's cuz i forgot i could use sqls

hazy parrot
#

dude you must be trolling

grim ice
#

No?

#

youre not proving any thing here

hazy parrot
#

ยฏ_(ใƒ„)_/ยฏ

kind hatch
# haughty idol i was just using config.yml's cuz i forgot i could use sqls

Using the built in config is fine. If you wanted to make it a little more advanced, you could make a per-player file system and only load players when they join, but at a certain point, you would want your end users to switch to a database.

Files are fine to start off with. Nothing wrong with it. However, if you have a large amount of players/data of players, then a database is the better choice.

grim ice
#

i dont think you really know what you;re doing either

haughty idol
hazy parrot
#

No need to be rude, just pointing some things out ๐Ÿ˜„

grim ice
#

I don't see how am I rude

kind hatch
grim ice
#

simply saying that you're in no place to say that people have no idea about what theyre doing, when you're not in that high of a level yourself

haughty idol
kind hatch
#

Because player names can change.

grim ice
#

players can change their account names

kind hatch
#

UUIDs cannot.

haughty idol
#

ohhh yeah

grim ice
#

yes

haughty idol
#

thanks

hazy parrot
#

I would like you to point me out how can i improve my code

#

my dms are open :3

grim ice
#

I will just do it here anyways

#

well first off, why use init

#

when you can just use a constructor and make your variablles final

haughty idol
kind hatch
#

Wdym? You would just add the player's UUID to the proper list when they choose their class.

#

Alternatively, you could save yourself some hassle and instead of saving player UUID's per class. Save the class per player UUID.

hazy parrot
haughty idol
#

String pName = ("" + pUUID); i'm assuming this is a really bad way of doing it?

echo basalt
#

so you're abusing mutability?

grim ice
#

^

haughty idol
#

ah okay didn't know that was a thing lmao

#

tysm for the help shadow :)

hazy parrot
kind hatch
grim ice
#

and plus, it cant be ran again without initializing another object anyways

#

since it's non static

haughty idol
#

so my config file looks like this right now, is this good?

  rogue:
  warrior:
  scout:
  mage:
  cleric:```
hazy parrot
kind hatch
haughty idol
#

ah

#

thanks

grim ice
#

you don't "like it this way"

#

that's simply wrong

haughty idol
#

WAIT WAS I USING {} IN MY FIRST .YML

#

twt i am so sorry

grim ice
#

the next thing is somewhat opinionated, but a good thing to know

haughty idol
#

that must have been so painful twt

#

i overlooked that

kind hatch
grim ice
#

u should not have a public method that isnt being inherited

hazy parrot
grim ice
#

since an object working without a contract is impossible to mock in a unit test. Second, a contract-less object is impossible to extend via decoration

grim ice
#

from elegant objects principles

haughty idol
#

what

grim ice
#

seven virtues of a good object

haughty idol
#

when i run /menu in minecraft it just says "/menu" in chat

hazy parrot
haughty idol
#

there are no errors

hazy parrot
#

how would i able to access that method if its outside of package

kind hatch
grim ice
#

read this

#

it isnt that long

#

every object should work by contract

#

meaning that no matter what the object is, as long as it abides by a certain contract, you can use it

#

in simple terms

#

dont be racist with objects!

haughty idol
grim ice
#

this is badly named as well

hazy parrot
grim ice
#

it's pretty simple

hazy parrot
#

So explain please ๐Ÿ™‚

grim ice
#

"The rule here is simple: every public method in a good object should implement his counterpart from an interface. If your object has public methods that are not inherited from any interface, he is badly designed."

haughty idol
#

hm lemme try something

kind hatch
haughty idol
#

oh

#

wait

#

thanks so much LOL

#

i assumed this.getServer().getPluginManager().registerEvents(new Menu(this), this); this would register it lmfao

hazy parrot
#

or interface if it would implement just one class

grim ice
hazy parrot
#

it runs just on program startup

grim ice
haughty idol
#
this.getServer().getPluginManager().registerEvents(new Menu(this), this);```
grim ice
#

oh i see

#

so getApiUrl()

haughty idol
#

fixed it i think

grim ice
#

is ran only once

#

?

hazy parrot
#

yap

grim ice
#

yeah and the class name should be changed too

haughty idol
#

wait no i had to plug in the plugin

#

hahahaha get it

grim ice
#

"Data" is too vague, it's almost an interface

hazy parrot
hazy parrot
haughty idol
#

hahaha i'm not funny twt

grim ice
#

unscalable

hazy parrot
#

Its not larger project, just small thingy to help me manage servers

#

so i really see no reason to have Impl classes

#

i don't need any type of abstraction here

grim ice
haughty idol
grim ice
#

then yeah

hazy parrot
haughty idol
#

oh wait i don't think i set up the saveDefaultConfig();

grim ice
#

im not sure what your project even does, but a concrete class shouldnt be called "Data"

hazy parrot
#

Its holding all nececery data that should be persistent after restart of application

kind hatch
haughty idol
#

oh good idea

hazy parrot
#

so i really can't think of any other name ๐Ÿค—

hazy parrot
#

app url, api key

grim ice
#

ApplicationConfigurationData

#

somewhat long but eh

hazy parrot
#

no thanks ๐Ÿ˜‚

grim ice
#

sure

haughty idol
#

ok its working so far

#

YES it worked

#

thank you so much Shadow!!

iron glade
#

no problem

kind hatch
arctic moth
#

how do i play custom sounds to players

#

like with a resource pack

grim ice
#

well that's it for that project i guess

hazy parrot
#

oh thanks !

arctic moth
kind hatch
smoky oak
#

whats the difference between ItemStack#getenchants and Itemstack#getItemmeta#getenchants

arctic moth
kind hatch
#

Like, with spigot code or the vanilla command? Cause the vanilla command uses the namespace you set.
/playsound customsound:example.path.to.sound neutral @s ~ ~ ~ 1 1

wintry badger
#

hi. i wanted to develop my next simple plugin in 1.19.2 but i get error for commands: unknown or incomplete command

#

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (args.length > 1) {
if (args[0].equals("enable")) {
Tough.isEnabled = true;
}
}
}

#

i also get warnings about notnull/nullable in intellij

kind hatch
#

You kinda have to. Block hardness isn't something accessible via the API, so you are left with NMS.

wintry badger
#

Unknown or incomplete command, see below for error

kind hatch
#

You can if you're verified. Otherwise, you have to share image links.

wintry badger
#

getCommand(ToughCommand.COMMAND).setExecutor(new ToughCommand());

#

this is how i register the command

dusk flicker
manic furnace
#

I am making a GUI with which you can change the look of my plugins text. What block do you think represents the italic font type the best?

wintry badger
#

my plugin.yml looks like: commands:
commands: tough enable: description: Enables the plugin usage: /<command> tough disable: description: Disables the plugin usage: /<command> tough cure: description: Cures the player usage: /<command>

dusk flicker
#

dont need nms last time I checked

grim ice
#

or iron bar

#

cuz the symbol is an I

kind hatch
manic furnace
kind hatch
wintry badger
#

so i get the same error if i use a random command that doesnt really exist

kind hatch
#

Integer.MAX_VALUE?

echo basalt
#

that 2 is the tick length

kind hatch
wintry badger
#

do command classes look differently for 1.19 ?

#

when overriding the method

haughty idol
haughty idol
#

defaults or current?

#

oh wait nope i know

#

i'm being dumb

#

lmfao

tall dragon
#

๐Ÿ˜„

haughty idol
#

i gotta put class.mage instead of mage

tall dragon
haughty idol
#

config?

#

i'm just starting to learn this and am gonna reimplement it in sql when i get a better understanding

tall dragon
#

its much better in my opinion to save data per player for example

uuid:
   class: mage
haughty idol
#

oh

#

ok

#

good idea

#

i'll do it next time

tall dragon
#

this way you dont have 5 different lists

#

๐Ÿ‘

#

then again i either would not save data in yml at all. but as you said ur reimplementing in sql so thats good

haughty idol
#

yea ty

arctic moth
#

uhhhhhhh

tall dragon
#

its almost done, trust

haughty idol
#

LMFAO

haughty idol
tall dragon
#

alright then show your current code & config

haughty idol
#

ok

tall dragon
#

ok and whats it looking like where ur testing

haughty idol
#

it says in chat "You are not a mage"

#

and the config looks like this:```class:
Rogue: []
Mage:
- 38387f3b-0edb-4d38-a5e5-4413e3769bdd
Scout: []
Warrior: []
Cleric: []

tall dragon
#

Mage is capital M there

haughty idol
#

oh

tall dragon
#

in ur code its not

haughty idol
#

frick

#

what

#

uhh hold on

#

AH

vocal cloud
#

Use a database ๐Ÿ˜ญ

haughty idol
#

i got it

#

thanks

haughty idol
vocal cloud
#

Good. Way better than configs

ruby fjord
tall dragon
#

well on the java doc is does say Called when a player has **changed** servers.

#

so i would assume so

ruby fjord
#

In my life I am never 100% sure xD

#

However thanks mate

eternal oxide
#

Always go with how the javadoc is worded. If its wrong complain

tall dragon
#

^ ๐Ÿ˜„

warm saddle
#

Hi i was wondering if someone could help. I want to make a plugin that allows players to rename items using a command but i was it to mimic the normal cost to rename the item that is being held

#

is there a way to do this?

tall dragon
#

if you look up how the cost is calculated. sure it is

torn oyster
#

how do i not store passwords in my code

#

and config files

eternal oxide
#

store a hash of them

chrome beacon
eternal oxide
#

sha1

torn oyster
#

oh i thought u meant hashmap i'm stupid

tall dragon
eternal oxide
#

if you need the password you can;t store a hash, you need the password

#

if you only want to validate they entered teh correct password you store a hash/sha1

chrome beacon
tall dragon
#

yea just looked at the wiki

#

sais its always 1 level

torn oyster
#

storing the mysql account password

tall dragon
#

so @warm saddle simply take 1 level from the player and rename the item

eternal oxide
#

plain text

#

you need the password to connect

torn oyster
#

okay then

eternal oxide
#

any effort you make to encrypt it, they can just look at your code to see how you extract it

torn oyster
#

ig

warm saddle
tall dragon
#

yea it is

#

if you are just renaming that is

eternal oxide
#

your MySQL server should be same machine or at least on teh same network protected by a firewall

warm saddle
#

but what if the item has been previously enchanted

tall dragon
#

still 1 level

warm saddle
#

but how come when i've tested in an anvil it can be up to like 30 levels?

tall dragon
#

wait maybe it does add the prior work penalty

#

let me do some testing too

warm saddle
#

yeah so i just tested and it wasn't just 1

chrome beacon
#

Ah yeah that says in addition to any prior work penalty

tall dragon
#

yea @warm saddle you were right. it does add the past penalty

#

yes its worded rlly weird

chrome beacon
warm saddle
#

ok so i have now run into a different issue where when comparing if the player has enough exp to do the rename, its always saying that the player doesn't have enough exp

tall dragon
#

i probably know whats going wrong. but show us some code

warm saddle
#

here is the bit that is comparing the exp to the cost```java
float cost = getRepairCost(player, meta);

    if (player.getExp() < cost) {
        player.sendMessage(PREFIX + "You do not have enough experience to rename this item. Required Experience: " + cost);
        return;
    }``` here is the getRepairCost() method
private static float getRepairCost(Player player, ItemMeta meta) {
        float cost = 1;
        if(player.getGameMode().equals(GameMode.CREATIVE) || player.getGameMode().equals(GameMode.SPECTATOR))
            return 0;
        else if(meta instanceof Repairable repairable) {
            cost = repairable.getRepairCost() + 1;
            return Math.min(cost, maximumRepairCost);
        }

        return cost;
    }```
tall dragon
#

did you check what getRepairCost returns?

chrome beacon
tall dragon
#

also mind getExp gets the progress towards the next level

warm saddle
#

ah

#

thats probably the issue

#

i'll try that rq

chrome beacon
#

Also if you want it to be like vanilla instead of using a math min it should just fail if cost is too high

tall dragon
warm saddle
#

Ok that has fixed the issue, thank you guys so much for your help :D

snow lava
#

which is the best way to create a delay? I have tried runtakslatter but i use external variables and doesn't work

tall dragon
#

?scheduling

undone axleBOT
hazy parrot
#

i guess you can use standard for loop

#

and do #setItem(index, item)

snow lava
#

?pasate

#

?paste

undone axleBOT
snow lava
#

why i'm still getting this error

eternal oxide
#

plugin is null

humble tulip
#

For loop from 0 to size of inv. Check if each slot has something, if not set it to glass

snow lava
eternal oxide
#

you are passing a plugin field which you never set. plugin field is null

#

at teh top of that class you created a field YourPluginClass plugin; You never initialized it.

snow lava
#

thanks, how do you detect the error

tall dragon
#

well it tells you

snow lava
mighty aurora
lost matrix
#

Or you are shading in plib

#

which you should not

mighty aurora
#

I've been asked about that before and they had me show them my pom.xml and such and they said that I am NOT shading it into my jar.

vocal cloud
#

And the server has it? And you depend on it in your config?

mighty aurora
#

Yes

#

I stated that in my original message

lost matrix
#
  1. spigot version
  2. plib version
  3. pom.xml
  4. How do you compile
mighty aurora
#

1.19, protocol lib dev version 600(latest), I compile using the Maven Package in IntelliJ

haughty idol
#

and how do i add the uuid

lost matrix
tall dragon
#

default will just be empty

haughty idol
#

how would i do that

tall dragon
#

1 second let me type up an example

lost matrix
# mighty aurora no

Download the latest plib version (5.0.0) and place it into your server. The server might be running an outdated version.

haughty idol
#

oh wait i'm dumb

#

would it be in the main function or where i want to add the uuid

tall dragon
# haughty idol oh wait i'm dumb

for example

        FileConfiguration conf = getConfig();
        
        UUID uuid ...;
        conf.set(uuid.toString() + ".class", "mage");

if you were to do in your main class

#

this would result in

uuid:
  class: "mage"
haughty idol
#

what if i want it to be blank by default

#

should i just put ""

tall dragon
#

yea. or any placeholder

lost matrix
# mighty aurora I did

Well we are running out of possibilities here.
If you hop on your server and get the enabled plugins + their
version, what do you see?

#

aka /protocol version

mighty aurora
haughty idol
lost matrix
tall dragon
mighty aurora
lost matrix
#

Then the only other possibility is you shading plib into your plugin

vocal cloud
#

Send a whole server log

haughty idol
#

agh how do i stop it complaigning aobut reassigned local variable, i know i'm reassigning it that's the whole point

lost matrix
mighty aurora
#

in Intelij IDEA

haughty idol
#

its complaigning about string playerclass = null on line 41 and then when i change it in each of the cases

#

i don't think i care about it

#

its not gonna give me an error... right?

tall dragon
#

only when none of the cases match

#

so you should add a default case

haughty idol
#

oh yeah

lost matrix
haughty idol
#

its not giving me an error in the build tho so i think its fine

tall dragon
#

its just gray right?

haughty idol
#

yea

#

well white

tall dragon
#

should be fine

tall dragon
mighty aurora
#

I want to clarify before I go screwing things over

haughty idol
lost matrix
#

in terminal its just
mvn clean install

mighty aurora
# lost matrix in terminal its just ``mvn clean install``
At line:1 char:1
+ mvn clean install
+ ~~~
    + CategoryInfo          : ObjectNotFound: (mvn:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException```
Would this be caused by me being in the wrong location to run this? I got this error when I ran that command in the terminal.
lost matrix
#

This is caused by maven not being installed on your pc

mighty aurora
#

Would it matter if the location of the project is not on my pc(stored on a separate file server) but edited from my pc?

fossil lily
#

Is it possible to check if a vector intercepts a block?

lost matrix
fossil lily
#

nevermind looks like raycasting is right for me

lost matrix
fossil lily
#

No

#

Its a vector im creating

lost matrix
#

Whats your use case

fossil lily
#

Check if there is a block between a tnt explosion and the block it explodes

#

So I can protect blocks behind other blocks

mighty aurora
mighty aurora
lost matrix
fossil lily
lost matrix
#

Ah i see

lost matrix
mighty aurora
native nexus
mighty aurora
dry forum
#

when was the feature added to be able to send an actionbar without nms

fossil lily
eternal oxide
#

are you trying to process something async and you shouldn't

echo basalt
#

Or you're looping an iterator without checking hasNext

lost matrix
fossil lily
#

oh yea im doing it in a lambda

#

agh

#

How can I run it in a for loop? I want to do it for multiple blocks.

eternal oxide
#

a lambda is fine, if you loop over checking it hasNext

eternal oxide
#

you are calling .next twice in the loop

fossil lily
#

omg

#

thanks xd

plain vapor
#

Hey guys, is the only way to execute code after an event is completed by using tasks/runnables? I feel like just delaying a task a couple ticks so the event is completed is really hacky and there is no guarantee that the event is complete by then

#

I haven't found much on the net other than people suggesting runnables

eternal oxide
#

yes

#

The event finishes once the event exits. 1 tick

#

the actions of some events will not be seen immediately

shadow zinc
dusk flicker
#

?details

undone axleBOT
#

Please provide your server version, relevant server logs ( https://paste.md-5.net/ ), a list of plugins, and what you've already tried doing.

quaint mantle
#

I want maven for complier plugin

shadow zinc
#

I want to send a plugin message with a method that returns a callback

plain vapor
#

Thanks

shadow zinc
dusk flicker
undone axleBOT
eternal oxide
#

There is no callback on plugin messaging

lost matrix
eternal oxide
#

or any way of doing so

#

oh

#

time to read ๐Ÿ™‚

quaint mantle
dusk flicker
#

assuming thats what you meant

shadow zinc
#

also how do I make people interested in contributing to my open projects?

kind hatch
#
  1. Money
  2. Project has to have a large following/userbase.
  3. Get lucky with some god tier programmer who's bored out of their mind.
eternal oxide
#

@lost matrix nice. Please fix red the sub-channel should be read.

shadow zinc
mighty aurora
hasty wasp
#

Can you set a villagers target on a zombie, so that it will not run away from the zombie?

drowsy helm
kind hatch
mighty aurora
mighty aurora
drowsy helm
#

thats strange you have covered all bases

kind hatch
#

Well, your IDE likely won't tell you if something is out of date as it has no context for what out of date means. The best it can do is tell you that your dependencies are outdated and newer ones are available, but even that is limited to certain build tools. I'd check to see if your plugin is depending on the latest version of the API available and if so, try recompiling and load it up again. Who knows, maybe it just needs a refreshed jar or something. Restarts are weird sometimes.

drowsy helm
#

it really just looks like you're shading it or something

#

but evidently you're not

mighty aurora
drowsy helm
#

wait

#

if you're depending on it, wouldn't it say could not find depdendency etc in console

#

rather than a noclassdef error

mighty aurora
#

The plugin is their.

drowsy helm
#

can i see your plugin.yml

#

wait no you did that already

#

dang

#

have you tried running the plugin on a diff server environment

mighty aurora
#

Also for some odd reason whether the protocollib plugin is their or not I get the same error... Also other thing I didn't send my plugin.yml so here it is

drowsy helm
#

no spaces

#

just incase

mighty aurora
drowsy helm
#

yeah I'd be down to run your plugin if you want

kind hatch
#

Can you share your pom as well?

drowsy helm
#

see if it happens on my end aswell

mighty aurora
mighty aurora
kind hatch
#

Aight

drowsy helm
#

yep same issue

#

so its your jar then

#

also

kind hatch
#

That jar is missing the depend section in the plugin.yml

drowsy helm
#

your plugin isnt compiling with the depend

#

put it first

mighty aurora
#

put depend at the top of my plugin.yml file?

drowsy helm
#

yeah

mighty aurora
#

above main:

#

?

drowsy helm
#

above everything

#

first line

kind hatch
#

So, why do you have the shade plugin if you aren't shading anything in your project?

mighty aurora
kind hatch
#

Well, I'd remove it since it's not needed anyways.

eternal oxide
#

lol bug in latest build of paper. it creates a file called plugins instead of a folder ๐Ÿ˜ฆ

mighty aurora
kind hatch
mighty aurora
drowsy helm
#

you're shading minimessage

mighty aurora
#

Also it still gave same issue.

drowsy helm
#

dont use the original jar

#

mvn clean then package again

mighty aurora
#

I have the other one I just grabbed the wrong file

kind hatch
#

Also, you should add a defaultGoal to your build so you don't have to run maven commands manually.

shadow zinc
#

on a callback return, can I somehow return that callback in the method it is in or convert it to a completable future and return that? So instead of executing all the code in a callback I would use a variable as a placeholder that could have the return result.

drowsy helm
#

same deal

mighty aurora
drowsy helm
#

your depend isnt in the compiled jar

kind hatch
mighty aurora
#

Doesn't that wipe my target folder each time? Part of the reason why I change the version each time I compile it is so that I can keep previous versions(I can't get github to work) when I last ran that it wiped all the previous versions that were saved their.

drowsy helm
#

why cant you get github working lol

mighty aurora
#

I use a network drive to store most of the things I work on and github doesn't like it for some reason. I've tried a bunch of stuff and non of it has worked. Also reason for network drive is so that I can work on my stuff when I'm not at my computer(or can't use my pc)

eternal oxide
#

@mighty aurora you have protocollib imports/fields in yrou main class.

mighty aurora
#

yeah... why?(why is that relevant)

eternal oxide
#

I'm betting it's trying to instance them before the classloading is done

kind hatch
#

That would be inconsistent with how other plugins load would it not?

eternal oxide
#

you have a depend which means spigot will not try to LOAD your plugin before Protocollib but it will be instanced

#

or it MAY be instanced before Plib

#

you should not reference anythign plib before onEnable

mighty aurora
#

Another thing(don't know how relevant it is) the plugin has the error regardless of whether ProtocolLib is on the server or not.

eternal oxide
#

yes, you are being instanced before plib

#

move all plib code out of your main, and init it when you get to onEnable

mighty aurora
#

The only things that are located above my onEnable function are variable definitions.

eternal oxide
#

yes

#

fields which use plib classes

drowsy helm
#

fix your depend loading in your plugin.yml

#

i guarantee you it's just loading before protocollib

mighty aurora
eternal oxide
#

spaces are fine. they will be ignored

drowsy helm
#

not spaces

#

its just not showing up in the jar

eternal oxide
#

ah

drowsy helm
eternal oxide
#

yeah, no depend line

drowsy helm
#

put it in the right order aswell

mighty aurora
#

I just checked

drowsy helm
#

yeah thats most definitely the reason

#

depend, name, version, main, api-ver

#

that order

eternal oxide
#

yep, it works for me with the depend

#

I'd still not have anything plib in my main though

#

I try not to reference any other plugins in my main plugin class

mighty aurora
#

This is what my plugin.yml file looks like. Is their anything wrong?

eternal oxide
#

no

mighty aurora
#

So then why wouldn't it be compiling

eternal oxide
#

what? a plugin.yml will not prevent compiling

mighty aurora
#

I was meaning why wouldn't the depend part not be compiling

eternal oxide
#

you didn;t do a clean package

kind hatch
#

I think you are copying the wrong jar. If you haven't been cleaning out your build folders, then you have a potential chance to grab the wrong one.

drowsy helm
#

if you really need copies of jars just move it to another folder

eternal oxide
#

and your ide didn't pick up the change to the plugin.yml because you didn't hit F5 after editing it

#

^ to build folders. Your jar should be found in the target folder

fossil lily
#

So I need to draw a vector from one location to another and check if there is a specific block in between

#

Anyone know how I would go about doing this?

eternal oxide
#

rayTraceBlocks

fossil lily
eternal oxide
#

to get a Vector from two locations java Vector vector = endLoc.toVector().subtract(startLoc.toVector());

fossil lily
#

yea I got that

#

im painfully on 1.8.9 so it doesnt exist

mighty aurora
dry forum
#

is it possible to make text display just above the players hotbar? i want to send actionbar type messages so a player can see them from a gui

drowsy helm
#

just run mvn clean package

eternal oxide
#

why not just send an actionbar message?

dry forum
#

shows up way above the playes hotbar

kind hatch
#

You know you can see actionbar messages just fine outside of the GUI if your GUI scale is set to anything other than the default.

dry forum
#

wdym

#

gui scale as in the size or?

kind hatch
#

The GUI Scale option in your video settings.

dry forum
#

ah but id rather not rly do that since not everyone would

kind hatch
#

I mean, I only know one person who uses the default GUI scale of 4, but everyone else I know uses a GUI scale of 2. However, I understand wanting to support those who refuse to change their settings.

#

But, yea. That does leave you with resource packs as your only real option.

dry forum
#

adding a newline wouldnt move it down?

drowsy helm
#

no, only resourcepacks

kind hatch
#

Nope. The actionbar text is a oneliner fixed position. You would need to modify the location of the message, which can only be done with resourcepacks.

dry forum
#

ah thats anoying :/

snow lava
#

how can i delay the code to occur?

kind hatch
#

?scheduling

undone axleBOT
snow lava
#

yea i tried that but that delay the task and the tasks get stacked

kind hatch
#

Sounds like you're doing something wrong then.

#

If that's not what you wanted to happen anyways.

snow lava
#

i used runtasklatter on a for where every cycle the parameters change but when i test it everything occurs after 5 seconds as i establish but the tasks get stacked

drowsy helm
#

show your code

snow lava
#

?paste

undone axleBOT
snow lava
#

it's the expand method

drowsy helm
#

wheres the runnable

snow lava
#

i deleted it because doesn't worked

drowsy helm
#

im asking for the code with the code that wasnt working

scarlet creek
#

Can you cast a uuid to a player?

drowsy helm
kind hatch
#

No, but you can use a UUID to get a player object. Bukkit#getPlayer(uuid)

drowsy helm
#

not casting, use uuid to get the player

scarlet creek
#

Ah yes

#

Ok thanks

snow lava
scarlet creek
drowsy helm
#

yep

eternal oxide
#

Never sleep the main thread. Scheduling is the correct way to do it

drowsy helm
#

thats why im asking for your scheduling code so we can see what you did wrong and help

mighty aurora
# drowsy helm just run mvn clean package

I believe this was related to the conversation we were having. I tried this and it did absolutely nothing. It still doesn't contain the depend in the plugin.yml despite doing that.

drowsy helm
eternal oxide
#

1 second later

drowsy helm
#

thats gonna run a lot of times

snow lava
#

i wanna make a cube increase on the past of time

eternal oxide
#

then only schedule the blockUnder.getRelative(x, y, z).setType(Material.NETHERRACK); line

#

increasing each time

#

ah you want a full cube to grow each time

snow lava
#

yes

mighty aurora
eternal oxide
#

then do 20L * center?

#

or radius2, whichever increments it each loop

snow lava
#

sorry if i'm not expressing well because i speak spanish, but what the code does is to generate a bigger cube every cycle and i wanna create a delay beetween does cycles

eternal oxide
#

basically each iteration of the while loop you need to multiple 20L by that count

#

first iteration 20L * 1
second iteration 20L * 2

snow lava
#

20 is the time or not

eternal oxide
#

yes

#

but its teh time from This code execution

#

20L = 1 second (about)

#

so you make each task run later and later by multiplying 20L

snow lava
#

the time is always the same

eternal oxide
#

yes, increase it

snow lava
#

ahh

#

i get it

#

i will try that

#

thanks you ElgarL, this worked

mighty aurora
shadow zinc
#

Can someone tell me if this should work compile times are very long java public static Future<byte[]> send(String channel, String message) { Player player = Iterables.getFirst(Bukkit.getOnlinePlayers(), null); ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF(channel); out.writeUTF(message); player.sendPluginMessage(NeoUtils.getInstance(), "BungeeCord", out.toByteArray()); CompletableFuture<byte[]> future = new CompletableFuture<>(); NeoUtils.getInstance().getBungeeCord().getPluginMessageBroker().request(player, channel, (rec, msg) -> future.complete(msg)); return future; }

#

request returns a callback (we know the callback works)

fossil lily
eternal oxide
#

paste the full error

shadow zinc
fossil lily
eternal oxide
#

at me.gtx.bedwars.twist.Boom.projectileHit(Boom.java:96)

fossil lily
eternal oxide
#

that is line 96 in Boom.java?

fossil lily
#

yea

shadow zinc
#

thats weird

eternal oxide
#

impossible

fossil lily
#

I know right

#

It makes no sense

eternal oxide
#

thats seriously impossible

fossil lily
#

Maybe its a SportPaper error

shadow zinc
#

is it possible that the world is somehow not registered?

fossil lily
#

Its used tons of other times

eternal oxide
#

line 10 in your paste will throw an error though

fossil lily
#

But it works when it doesnt damage a player

#

But if its in range it dies

eternal oxide
#

line 9 you call e.getEntity().remove(). You then use e.getEntity in line 10

#

that is your npe

fossil lily
#

๐Ÿค”

#

lemme try

fossil lily
#

Still erroring

#

I just swapped the two lines

#

Also once again it works if its not in range of damaging a player

eternal oxide
#

your supposed line 96 is impossible to npe

fossil lily
#

so it must be an error in the branch of spigot im using?

eternal oxide
#

change top line to java if (e.getEntity() == null || e.getEntity().getLocation() == null) return;

#

thast the only possible thing you are not checkign could be null

shadow zinc
fossil lily
#

How does that fix it

#

It didnt make it return

#

It fixed it

#

oop nevermind

#

I was in creative ๐Ÿฅฒ

shadow zinc
#

I just pushed my current code so refresh if you are looking at it

#

So to reiterate I'm using completeable futures to update the playercount on an items lore, however, I'm crashing the server.

hasty prawn
#

BungeeCordUtils.playerCount returns a CompleteableFuture, yes?

shadow zinc
#

yes

hasty prawn
#

My guess is you're crashing at this line then.

return Arrays.toString(BungeeCordUtils.playerCount(gameItem.getServerName()).get());

#

get() is a blocking method. You're halting the server thread.

shadow zinc
#

So how do I ensure that I get() after its been unblocked?

hasty prawn
#

Use CompleteableFuture's methods such as thenAccept(), thenRun(), etc

shadow zinc
#

is this an async problem?

hasty prawn
#

Those are callback methods that are called when the Future is completed.

hasty prawn
# shadow zinc is this an async problem?

I mean sorta I guess? More of the lack of async, although you're modifying and item so adding another Thread here doesn't do you any good because I don't think you can change ItemMeta asynchronously

shadow zinc
#

sorry my internet went down