#help-development

1 messages · Page 393 of 1

undone yarrow
#

Im trying it with a static variable rn, but I dont think it'll change anything

#

Ahh now it works

#

no way

#

AI saved my ass once again

#

So what was happening (I think) is something is reloading/resetting the variable each time, making it kinda empty

#

using static prevents that.... apparently

swift sequoia
#

Yeah i think you should learn Java before using IA

quiet ice
#

Do note that mods would have evolved differently - reflection wouldn't be based on signatures for example.
People would quickly design deobfuscators such as the one I mentioned above, which is able to guess the generics of collections in a fairly safe manner.

undone yarrow
quiet ice
undone yarrow
swift sequoia
quiet ice
dry yacht
undone yarrow
#

hold on

#

I think it might be doing something

#

Ah it's doing something!

quiet ice
tardy delta
#

hmm does anyone knows what the dif is between Char2ObjectArrayMap and Char2ObjectOpenHashMap?

crimson mulch
#
Could not find io.netty:netty-transport-native-epoll:4.1.82.Final.
Searched in the following locations:
  - file:/Users/249438/.m2/repository/io/netty/netty-transport-native-epoll/4.1.82.Final/netty-transport-native-epoll-4.1.82.Final.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
    project : > org.spigotmc:spigot:1.19.3-R0.1-SNAPSHOT

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

Hey does someone know why it gives me that error with Maven Local. I've downloaded latest spigot with BuildTool

undone yarrow
quiet ice
#

We're looking for a new keyword that shouldn't be there

#

Ideally you would need to send the whole class file(s) so I could pinpoint it directly

quiet ice
quiet ice
#

Buildtools

chrome beacon
#

?paste

undone axleBOT
undone yarrow
quiet ice
tardy delta
#

hmm i need a Map<char, List<ItemStack>>

dry yacht
#

Does it need to be fast? xD

tardy delta
#

it will hold 9 elements at most so doesnt really matter

#

jsut wanted to try out those fastutil stuff

#

always fun when i get it as a transitive dependency

#

but i just need it to do 1000 times

regal scaffold
#

If I want to cancel blockPlaceEvent and instead of the block. Place my own custom block

#

How can I do so

dry yacht
tardy delta
#

max 9 lookups per map and that max 1000 different times

quiet ice
tardy delta
#

ok

analog thicket
#

Is someone free to help now?

hazy parrot
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

hazy parrot
#

Don't ask to ask or ask if people are awake or available

analog thicket
#

Thats why im asking

tardy delta
#

deserializing those mojang recipe jsons is a pain in the ass lol

analog thicket
crimson mulch
tardy delta
#

deserializing mojang stuff be like

tardy delta
#

damn im atleast able to deserialize one recipe

#

545/1xxx lol

chrome beacon
tardy delta
#

this is a mess to parse lol

#

gotta adapt me to every single situation 💀

crimson mulch
tawdry echo
#

when i have three methods @eventhandler for playerjoinevent then first is runned with the highest priority?

quiet ice
quiet ice
tawdry echo
#

ok thx

quiet ice
#

Do a shitton of null handling then

storm isle
#

hello i was wondering if anyone could help me with this code

the first part work that says "this is a sheep but after that "else" doesnt work and it doesnt say this is not a sheep when trying to sheer another entity

quiet ice
#
  • there is a reason why I never use nullability analysis with minecraft
quiet ice
#

Instead a PlayerInteractEvent will be logged, which you likely want to listen for

storm isle
#

oh so if the entity cant be sheared it wont register

quiet ice
#

Yep

storm isle
#

ok well thanks for the help

analog thicket
#

Could it have something to do with it saying null here?

tawny remnant
tall dragon
#

its not annotated with @EventHandler

remote swallow
#

and == for enums

proper summit
#

Guys, help!

I can't find this packet:

#

@lost matrix

#

You sent me a screenshot earlier

quiet ice
tawny remnant
left plover
tall dragon
#

huhhh

#

lmfao

#

it can only take the event

quiet ice
#

Try

for (Object o : config.getList("casino.crates")) {
  ConfigurationSection sect1 = ((ConfigurationSection) o).
getConfigurationSection(id0);
  for (Object o2 : config.getList("rewards")) {
    String material = ((Map) o2).get("rewards").toString();
    String antal = ((Map) o2).get("anatal").toString();
  }
}

But I am sure that won't work like that

tawny remnant
quiet ice
#

Something is broken but I cannot tell what given that it has been years since I've last used configuration sections @analog thicket

tall dragon
#

and get the player from the event.

tall dragon
#

yes

tawny remnant
#

im greatful

analog thicket
quiet ice
#

Nah, one of the two casts is invalid

#

If the configsection cast is invalid, the map approach is the right one. Otherwise it is the configuration section one

analog thicket
regal scaffold
#

Is anyone familiar with MorePDC by alex?

quiet ice
#

then you may want to dump that section - something feels wrong

#

?stash alternatively I could stop guessing and look at the actual sauce

undone axleBOT
regal scaffold
#

How can I have fields in my serializable class that don't need to be initialized or can be null?

#

With more pdc you can't just do that

#

?paste

undone axleBOT
regal scaffold
#

That's the file that's getting serialized

#

ultraChest.setLocation(chest.getLocation());

#

Before it tries to serialize

#

49 -> this.world = world

26 Location location

#

Back to this

#
        ultraChest.setLocation(chest.getLocation());
        PDCUtils.set(chest, NBTTags.ULTRA_CHEST_STORAGE, getDataType(), ultraChest);

not valid

analog thicket
#

Dammit

eternal oxide
regal scaffold
#

No. this is on block place

eternal oxide
#

then as others said, your world is null

#

well location is

regal scaffold
#

I guess somehow chest.getLocation() is null

#

Will figure it out

undone yarrow
#

Hey... again. Im making a system that allows you to specify blocks as loot sources, which you can right click to get loot. The block then has a cooldown of lets say 1 minute, until it can be looted again. I got the particles working and I can detect if I right clicked an available block, but now I need to be able to loot the blocks. So far I have this:

    public void LootBlock(Player p, Location loc){
        scrapLocations.remove(loc);
        lootedScrapLocations.add(loc);
    }``` This moves the location of the lootsource to the lootedScrapLocations. I'm wondering however, how I'm supposed to add a cooldown, so that the loc in lootedscraplocations goes back to scraplocations after one minute
#

It sounds quite easy but idk where to start

tardy delta
#

?conventions

undone yarrow
#

Having more trouble with my code. I get this error when I try running it[23:15:46] [Server thread/ERROR]: Could not pass event PlayerInteractEvent to ScrapCollection v1.0 org.bukkit.event.EventException: null
This script checks if I right-click a block that has been registered as scrapLocation.

public class EventListener implements Listener {
    public EventListener(main plugin) {plugin.getServer().getPluginManager().registerEvents(this, plugin);}
    private final ParticleHandler pHandler = new ParticleHandler();

    @EventHandler
    public void onRightClick(PlayerInteractEvent ie){
        Action action = ie.getAction();
        if(!action.equals(Action.RIGHT_CLICK_BLOCK)) return;
        Player p = ie.getPlayer();
        Block b = ie.getClickedBlock();
        Location blockLoc = Objects.requireNonNull(b).getLocation().add(.5, 1.4, .5);
        if(!pHandler.CheckLoc(blockLoc)){ // check if the block is in scrapLocations
            return;
        }
        pHandler.LootBlock(p, blockLoc);
    }
}```
https://paste.md-5.net/ikoqugezej.java - ParticleHandler
river oracle
undone yarrow
#

But it's just not working

#

lol

river oracle
#

or like a Cache from Caffeine or something would actually be pretty good too

shut field
#

what event occurs when a ground item is burned or exploded?

tardy delta
#

how would one call smth like this: minecraft:sand, a namespace?

undone yarrow
tardy delta
#

did you get that from chatgpt?

undone yarrow
#

I mean sure the formatting and choice of words is weird

#

but the answer it gives is correct

#

I made sure to check them of course

undone yarrow
#

afaik

#

but maybe Im wrong

dry yacht
#

NamespacedKey, isn't it?

regal scaffold
#

I just checked if location was null

dry yacht
#

Where the namespace is minecraft and the key is sand.

regal scaffold
#

And it isn't, but serializable is still null

undone yarrow
regal scaffold
#

others

undone yarrow
#

ah alright

#

got me confused for a sec

regal scaffold
remote swallow
#

this is absolutely tragic

#

mcdev changed the new project screen

#

this weird

undone yarrow
regal scaffold
#

Oh

#

Wait a second

undone yarrow
undone yarrow
onyx fjord
#

block b 😐

regal scaffold
#

That location error is not from the serializable class but the hologram field that is location?

dry yacht
regal scaffold
#

Cause my class has a location and then I assume hologram has a location too

#

Hehe

regal scaffold
#

Shading be like}

onyx fjord
#

nah its just wrongly shaded

regal scaffold
#

Good luck zipping that folder

remote swallow
#

how did the second package get there

wary harness
#

Well I got specific problem I am making my LibPlugin with all libs which I am using in the rest of my other plugins.
I am shading them and now when I use my lib as dependancy I can still access original lib and import them looks like from some reason my plugins can access lib pom files with list of dpendencies and that allowes me to import original not shaded libs
How would I avoid that so I have only imports for shaded ones in my lib?
I am doing that with maven

regal scaffold
#

Xd

#

No one is ever gonna be able to unzip this

#

4 minutes scrolling through folders

dry yacht
#

That's almost a zip bomb

onyx fjord
#

but uh

wary harness
onyx fjord
#

you mean that they still want the dependency?

wary harness
#

here to be more specific

undone yarrow
# wary harness Well I got specific problem I am making my LibPlugin with all libs which I am ...

Make sure that you have the Maven Shade Plugin configured in your pom.xml file.
Verify that you are shading all of the necessary dependencies, and that they are being properly relocated. You can check the relocated classes by opening the shaded JAR file and looking for the package names in the class files.
Check that the original dependencies are not being included in the classpath of your application. You can do this by checking the output of mvn dependency:tree.
Finally, make sure that your application is using the shaded JAR file as its dependency, and not the original JAR file.
If that doesnt work, dont ask me because idk

regal scaffold
#

Ok I fixed the path

#

But either way

#

Let me see if removing hologram makes it work

tardy delta
#

imma call you chatgpt man

onyx fjord
undone yarrow
#

If only I could change nicknames

#

on this server

wary harness
#

and using shaded jar

onyx fjord
#

ah maven

undone yarrow
undone yarrow
dry yacht
#

Typical decompiler moment, xDD. Man, that thing butchered my library. I need to get into the habit of sources jars.

onyx fjord
#

double while true

#

yummy

regal scaffold
#

We have moved errors

#

These errors are so long lol

undone yarrow
regal scaffold
#

Is that because you can't set pdc data onto a chest?

#

Nothing changed besides removing hologram from serializable class

#

To test

remote swallow
#

a chest is a tile entitty so it should have pdc

regal scaffold
#

Placed, right?

analog thicket
#

What does it want here?

#
                List<Map<?, ?>> rewardList = (List<Map<?, ?>>) name.get("rewards");
regal scaffold
#

I have a feeling I'm messing up when I get the block from the BlockPlaceEvent

remote swallow
tardy delta
#

@SuppressWarnings("unchecked")

regal scaffold
#

(Chest) event.getBlock().getState()

analog thicket
regal scaffold
#

Maybe it can't give me a chest object at that moment?

remote swallow
#

Chest chest = (Chest)block.getBlockData()

#

i think

#

might want to do a instance of check

regal scaffold
#

I shall try

#

It's a chest, I've done the checks

tardy delta
#

its blockstate

regal scaffold
#

Just the 1 line where I call it

tardy delta
regal scaffold
regal scaffold
#

So why am I getting this error

undone yarrow
#

Bruh my server suddenly doesnt see my plugin anymore. All I changed was this

regal scaffold
#

Oh wait

#

I know why

regal scaffold
#

public Block block;

remote swallow
#

and naming conventions where

undone yarrow
regal scaffold
#

A Block might not be serializable

undone yarrow
#

why not do that?

remote swallow
#

dont call main class man, use YourPluginName and use upper camel case

wary harness
remote swallow
undone yarrow
#

ehh

#

shit

worldly ingot
#

You can't construct a new instance of your plugin class

#

Classloader won't let you

undone yarrow
#

Good to know

regal scaffold
#

Is a Block serializable then? Anyone know?

worldly ingot
#

Instead of instantiating it there, you can do it either onEnable or onLoad

#

Block is not serializable, no

remote swallow
#

use di or


public class MyPlugin extends JavaPlugin {
    private static MyPlugin instance;

    @Override
    public void onEnable() {
        instance = this;

    }


    public static MyPlugin getInstance() {
        return instance;
    }
tardy delta
#

working with mojang stuff go brr

remote swallow
#

?morepdc

undone axleBOT
remote swallow
#

i wonder if that allows it

regal scaffold
#

It should

#

Wait no

#

You linked the wrong one

#

Cause I'm using that

remote swallow
#

block data

#

not block

regal scaffold
remote swallow
#

oh that one

regal scaffold
#

That might allow a block to be serialized

remote swallow
#

that allows you to save pdc onto any blocks

regal scaffold
#

Now, is this really necessary

#

Probabaly not

remote swallow
#

not needed for chests, been as they are tile entities

regal scaffold
#

Probably just remove block from the serializable class instead

undone yarrow
remote swallow
#

di or using static instance

#

?di

undone axleBOT
remote swallow
#

that too

tardy delta
#

already wrote 300 lines just to deserialize the client recipe jsons 🥹

undone yarrow
#

what's that?

tardy delta
#

and it only works for shaped recipes already

#

ive never seen mc code

undone yarrow
#

it cant be any worse than my code

tardy delta
#

how is it that bad?

undone yarrow
#

but to be fair

#

my code is usually pretty shit

#

Player p = ie.getPlayer();
Block b = ie.getClickedBlock();

#

p and b

dry yacht
tardy delta
#

lemme send a support mail to ask whether they can cleanup the code

tardy delta
dry yacht
#

Ah, right, that's cool! :). Getting right into the things we all take for granted, xD

tardy delta
#

wheres actual code

#

ah

remote swallow
#

fabric yarn is probably better

tardy delta
#

more packets lets go

dry yacht
tardy delta
#

got a free today tmrw so i hope i can implement the whole shaped recipe thing

#

currently i only get 11 illegal state exceptions

dry yacht
#

Uh, btw, what was that in reference to?

tardy delta
#

i believe it was actually able to load 545 recipes

dry yacht
tardy delta
#

oh ye it was able to load a bunch of recipes

#

dont ask me if the data is correct cuz mojang finds it funny to sometimes include the "group" key in the json and sometimes not

echo granite
#

Hey, I have a very large text file I'd like to store(10k lines), what algorithm can I use in order to convert it to a small chunk of text and then decode it back?

tardy delta
#

oh you gotta be kiddin me

dry yacht
echo granite
dry yacht
#

Wrap the OutputStream in a GZIPOutputStream and call it a day, lol

echo granite
#

I'm limited by space so I need to some kind of manipulation on the names instead of simply using a txt file

echo granite
tardy delta
#

no idea if writing the binary data to it will save more space than using ascii characters?

dry yacht
echo granite
#

if you remember

tardy delta
#

real men just use a record inside of a tuple

dry yacht
echo granite
#

thank you very much 🙂

dry yacht
#

Don't forget to also use the GZIPInputStream when reading back

#

To re-inflate, xDD

echo granite
#

I'll let you know if I have any problems

remote swallow
#

is there any way to check if something is a valid playername or the name is associated with an account

dry yacht
remote swallow
#

well if its taken

#

wait a minute

dry yacht
#

Something like that?

remote swallow
#

it would work if i didnt realise the other variant of this would be way longer

buoyant viper
#

just like idk

regal scaffold
#

How to compare 2 UUID

dry yacht
#

equals

#

For equality, that is

regal scaffold
#

Well it's not working

#

Wait

#

Is a unserialized UUID object the same as a player UUID object if it's the same player?

#

No, right?

dry yacht
#

It should contain the same bits, so it should be equal, but it will not be at the same memory address (==)

regal scaffold
#

Ok that's fine then

#

So no clue why it says false

#
if (!ultraChest.getAllowedPlayers().contains(p.getUniqueId()) || !p.hasPermission("ultrastorage.admin") || ultraChest.getOwner().equals(p.getUniqueId()))```
dry yacht
#

Have you printed out both the left as well as the right hand side of equals and checked them visually?

regal scaffold
#

I did print out both UUID yes

#

Oh I see the error

#

already

#

wait nvm

dry yacht
#

Is getOwner() a UUID?

#

Ok, xDD

regal scaffold
#

Yes

#

Nono

#

Mistake

#

Still not fixed

#

getUUID() returns a UUID

#

Other ideas @dry yacht ?

dry yacht
#

Show the prints you added

#

That seems very weird

regal scaffold
#
            Messages.send(p, "Owner: " + Bukkit.getOfflinePlayer(ultraChest.getOwner()).getUniqueId());
            Messages.send(p, "Your UUID: " + p.getUniqueId().toString());
ruby mesa
#

hey guys should I use protocol lib's packet events for signs (where you put like [Click] and when it clicks it sends you a message or smth) or should you just use spigot events

regal scaffold
#

wtf

ruby mesa
#

which would be better

regal scaffold
#

It's returning true

#

And it's going in the method

dry yacht
#

Why did you go through Bukkit#getOfflinePlayer for the log? xDD

regal scaffold
#

copilot moment

dry yacht
regal scaffold
#

Is ultraChest.getOwner().equals(p.getUniqueId())

#
if (!ultraChest.getAllowedPlayers().contains(p.getUniqueId()) || !p.hasPermission("ultrastorage.admin") || !ultraChest.getOwner().equals(p.getUniqueId())) {
            Messages.send(p, plugin.messages.MSG_NOT_ALLOWED_TO_OPEN_ULTRACHEST);
            Messages.send(p, "Allowed: " + ultraChest.getOwner().equals(p.getUniqueId()));
            Messages.send(p, "Owner: " + ultraChest.getOwner());
            Messages.send(p, "Your UUID: " + p.getUniqueId().toString());
            return;
        }
dry yacht
#

Yeah, it works then, your if is borked

#

Oh

regal scaffold
#

How tf is my if broken lol

dry yacht
#

Well, I don't understand the logic because I don't know your plugin, but the UUID comparison works, xD.

dry yacht
regal scaffold
#

Well if you look at the if

#

It's an OR if

#

Oh I know what it is

#

Bruh

#

XD

#

I want to die

ruby mesa
dry yacht
regal scaffold
#

1 sec testing

#

Nice... there is no XOR operator in java

dry yacht
#

Uhm, there is, it's ^

regal scaffold
#

Dumb websites

dry yacht
#

Did they say there's none? xD

regal scaffold
#
Car car = Car.dieselAndManualCar();
boolean dieselXorManual = (car.isDiesel() && !car.isManual()) || (!car.isDiesel() && car.isManual());
#

XDDDDDDDDDDDD

dry yacht
regal scaffold
#

This is starting to take shape

dry yacht
#

Quite literally, huh

regal scaffold
#

hehe

#

It's gonna be pretty cool

dry yacht
#

I'm also working on UIs right now, xDD. What a coincidence. Haven't touched them in months.

#

smile inspired me with his guide, xD

regal scaffold
#

ikr

#

xd

worldly ingot
#

Though that's best used as a method reference

regal scaffold
#

It's fine just dumb websites saying there is no XOR

worldly ingot
#

The baeldung website you linked definitely mentions ^

dry yacht
#

:,D

regal scaffold
#

Now i'm trying to think

buoyant viper
#

baeldung da 🐐 no 🧢

regal scaffold
#

So

#

What are some ways to make a item selector

#

Fancy ways maybe

#

I was thinking anvil selector but then the user needs to know the exact name of the item

#

Putting all items into another GUI and just return the itemname? Seems a lot

#

Ideas/

dry yacht
#

Uhm, what kind of selector? Like, what's the palette of choices? Are there many items?

regal scaffold
#

Yeah like

#

For example

#

Like I want the user to be able to chose an item to add to a filter, ignore the filter part I just need a item pallet

#

Is gui the fanciest way? 😦

dry yacht
#

Yeah, I usually use a live anvil search for that, where the search term can be either something in the name, lore or material of the item

#

But that's not that trivial

regal scaffold
#

But anvil search does not autocomplete

#

So they have to have an idea of what it is

dry yacht
#

Doesn't need to. Usually you've narrowed it down to a few after like 5 letters

dry yacht
regal scaffold
#

Ah I see, I mean I have AnvilGUI

#

I could do that

#

Or I could use an anvil and just make them place the item instead

#

Requires them having 1 of the item

#

Fuck it I'm doing that

white dew
#

Hey guys! I'm making a resource pack and I'm trying to make a custom sound for when you open/close your chest

#

I made a .ogg called "chestopen" and put on minecraft/sounds/random

#

I thought It would work, since I did the same with the click sound and It worked (both are located at random)

regal scaffold
#
Material::isItem

How can I make a custom Material list with this format

#

Predicate<Material> itemFilter

remote swallow
#

iirc Map/List.stream().filter(Material::isItem).toMap/List()

regal scaffold
#

Wait

#

So you say make a List of all the materials I want to use

#

And then use that above

remote swallow
#

yeah, theres probably a way to you can do it with 1 list/map

#

i think thats right anyway

#

that might only exist for lists

regal scaffold
#
            this.itemFilter = itemFilter.and(MATERIALS::contains);
#

Was even easier

#

But you had the right idea

white dew
#

You have to edit sounds/block/chest

#

to make It work

#

not sure why the ambiguous file system

#

but It works!

weak meteor
#

Someone updated Minecraft Development plugin in IntelliJ?

graceful oak
#

I currently have a HashMap with keys as the spaces (0 - 8) and values as the itemstack for a custom crafting recipe being checked in the PrepareItemCraftEvent. Just was wondering if there is a better way to do this because it seems weird but its the only way I could find from what I was looking up.

hoary otter
#

Hi guys, i was coding my first plugin and got a little problem. I was coding a sethome plugin that is working but I don't know how to create a /homes command that shows you all your homes. So if you can help me guys plz.

#

That's how i coded the sethome :

                    Main.getInstance().getConfig().set("home." + player.getUniqueId().toString()+"."+args[0]+".x",player.getLocation().getX());
                    Main.getInstance().getConfig().set("home." + player.getUniqueId().toString()+"."+args[0]+".y",player.getLocation().getY());
                    Main.getInstance().getConfig().set("home." + player.getUniqueId().toString()+"."+args[0]+".z",player.getLocation().getZ());
                    Main.getInstance().getConfig().set("home." + player.getUniqueId().toString()+"."+args[0]+".pitch",player.getEyeLocation().getPitch());
                    Main.getInstance().getConfig().set("home." + player.getUniqueId().toString()+"."+args[0]+".yaw",player.getEyeLocation().getYaw());```
graceful oak
hoary otter
#

yes but the list is temporary

#

like how do i put it in the config doc

#

and the problem is that i don't know how to loop through the names of the homes, like i don’t know how to separate them

#

from the other info

graceful oak
#

Can you show me how your config is storing the data right now in a pastebin?

hoary otter
#

ok

#

just 10 sec

graceful oak
#

or if its not a lot of data just throw it in here

safe flower
#

I'm trying to understand the new world generation API. ChunkGenerator has the methods generateNoise(WorldInfo, Random, int, int, ChunkData) and generateSurface(WorldInfo, Random, int, int, ChunkData). My understanding of world generation is that noise is used to determine the height of various parts of the terrain. The generateNoise method will generate a height value for a given x,z location then use a filler block to populate up to that height. Then generateSurface will go over those locations and modify the surface blocks to make it look pretty. So how does generateSurface know that the height values are that were generated by generateNoise? The latter method does not save those noise values anywhere as far as I know.

hoary otter
#

and dont know why

#

like everything works but when I try to teleport to the home it sends me an error

#

;((

graceful oak
regal scaffold
#

If I want to declare a List<String> in a statement and I want to set the elements, how can I do so

#

setLore(#Make new list here and set the lore in the same statement)

#

Is List.of(Strings...) the best?

crimson mulch
#

What is the difference between R1 R2 R3 ?

fervent panther
#

Hi I'm trying to parse YAML with snakeyaml. I want to store a bukkit vector like this

offset:
  x: 1.0
  y: 1.0
  z: 1.0

But I'm getting an error
No writable property 'x' on class: org.bukkit.util.Vector
I don't understand why because I'm allowed to do

Vector().x = 1.0

and vector seems to have a public setter

#

Hi I m trying to parse YAML with

azure cape
#

Anyone know how to use hex codes on scoreboard? Normal color codes work fine and I know it has to do with md5's bungee api for chat color, but im still not entirely sure what to do with it

azure cape
buoyant viper
azure cape
fervent panther
#

This runs every time I place a block.

val relativeLocation = when (counter.relativeTo) {
  Move.RelativeTo.LAST_ACTION -> lastMoveLocation!!
  Move.RelativeTo.ACTION -> placeLocation
  Move.RelativeTo.PLAYER -> playerBlockLocation
}.add(counter.offset.toVector())
player.sendMessage("x: ${relativeLocation.x} y: ${relativeLocation.y} z: ${relativeLocation.z}")

If I break and place blocks it should send the same location with a specific, but it keeps adding the offset every time

#

any idea what could be causing this?

buoyant viper
#

whats counter.offset?

fervent panther
#

0, -1, 0

#

that's why it's changing y by -1 every time

crimson mulch
#

Okay ! (This is gradle stuff, so if you've never used gradle please pass your way)

So I try to create a "parent module" which will use sub modules (depend on the server version), but I can't compile correctly !

So here's my structure
RisenCore (parent module)

  • src (parent src with all the stuff no depend on the child modules)
  • build.gradle
  • module1
    • build.gradle (dependence on parent module)
  • module2
    • build.gradle (dependence on parent module)

So I want to compile all that stuff in a single jar file.

But when I compile with the jar task from the parent build.gradle it compile only the "parent", I would like to compile the whole stuff

So here's my 3 build.gradle
(parent)

plugins {
    id 'java'
}

group 'net.krisp'
version '1.0.0'

repositories {
    mavenCentral()
    mavenLocal()
}

dependencies {
    compileOnly 'org.spigotmc:spigot:1.19.3-R0.1-SNAPSHOT'
}


setLibsDirName("../exports")

module1

plugins {
    id 'java'
}

group 'net.krisp'
version '1.0.0'

repositories {
    mavenCentral()
    mavenLocal()
}

dependencies {
    implementation project(path: ':')
    compileOnly 'org.spigotmc:spigot:1.8-R0.1-SNAPSHOT'
}

module2

plugins {
    id 'java'
}

group 'net.krisp'
version '1.0.0'

repositories {
    mavenCentral()
    mavenLocal()
}

dependencies {
    implementation project(path: ':')
    compileOnly 'org.spigotmc:spigot:1.8.3-R0.1-SNAPSHOT'
}

Thanks again for reading 😭

#

(Srry btw)

regal scaffold
#

@tender shard hey, you available for a MPDC question?

opal cedar
#

Hey, I'm trying to put a custom font on a placeholder any idea how?

rotund ravine
#

Gl @opal cedar

opal cedar
regal scaffold
#

Jan, help me out with some serializable stuff

#

I could make a fake hologram at the loaded world 0 0 with no data, make every single instance of UltraChest default to that hologram and then once it's setup it will change it?

rotund ravine
#

Sure, that’s one way to do it. Other way would be to not serialize the object if it’s null.

regal scaffold
#

How can I do the not serialize?

#

Cause like I see no option

rotund ravine
#

Can i see the createNewStorage method?

regal scaffold
#
    public static void createNewStorage(Player player, Chest chest) {
        UltraChest ultraChest = new UltraChest();
        ultraChest.setOwner(player.getUniqueId());
        ultraChest.setLocation(chest.getLocation());

        System.out.println(chest.getLocation().toString());
        PDCUtils.set(chest.getLocation().getChunk(), NBTTags.ULTRA_CHEST_LOCATION_KEY, DataType.LOCATION, chest.getLocation());
        PDCUtils.set(chest, NBTTags.ULTRA_CHEST_STORAGE, getDataType(), ultraChest);
        plugin.ultraChests.add(ultraChest);
        chest.update();
    }
rotund ravine
#

And which one of those types store the hologram.

#

Guessing the storage tag

regal scaffold
#

Yeah

rotund ravine
#

Show me that class.

regal scaffold
#

That's the serializable

#

Oh wait

#

I just figured it out

#

I think

#

lol

#

Just take it out of serialize() and deserialize()

rotund ravine
#

That’s not NBTUtils.ULTRA_CHEST_STORAGE

regal scaffold
#

That's just a key

#

NamespaceKey

rotund ravine
#

Oh

#

What does getDataType() return?

regal scaffold
#

Remember I'm using alex's more pdc

rotund ravine
#

I see

regal scaffold
rotund ravine
#

You can just make a new one hasHologram boolean and set that to false if hologram is null. Don’t add hologram if it’s null.

regal scaffold
#

Oh

#

That's actually a better idea

#

I was thinking removing the hologram like you said and then having to add it back every time I load it

#

But I think your way is better

#

if you had to chose between hasHologram boolean and default empty hologram at 0 0

#

Which one would you chose

rotund ravine
#

The one without smth at 0 0

regal scaffold
#

Ok

#

Thanks ja

#

I need to serialize hasHologram too I suppose

rotund ravine
#

Yes

#

You’d check that on deserialize

#

If it’s true load the hologram too

regal scaffold
#

Dope

regal scaffold
#

Time to test!

hoary otter
#

Location spawn = new Location(world,0,1000,0);
what can i put in "world" (not player.getLocation().getWorld())

#

like to setup a spawn

regal scaffold
#

Bukkit#getWorld

hoary otter
#

yes but like there is no name for like the overworld or something like that ?

regal scaffold
#

It's the default world?

hoary otter
#

yes

regal scaffold
#

The name is setup in your servers configs

#

"world"

#

Most likely

hoary otter
#

ok

#

thx

#

it puts an error

regal scaffold
#

?paste erroor

undone axleBOT
hoary otter
#

like underlined in red

#

everything is underlined in red in eclipse

regal scaffold
#

That's not what I said to do...

hoary otter
#

oh

#

my bad

regal scaffold
#

I said Bukkit#getWorld(String worldname);

lost matrix
regal scaffold
#

^

#

?commands

#

?help

undone axleBOT
#
CafeBabe Help Menu
*Red V3*
**__Admin:__**

selfrole Add or remove a selfrole from yourself.

**__Cleanup:__**

cleanup Base command for deleting messages.

**__Core:__**

embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.

**__Downloader:__**

findcog Find which cog a command comes from.

**__Mod:__**

names Show previous names and nicknames of a member.
userinfo Show information about a member.

**__ModLog:__**

listcases List cases for the specified member.
reason Specify a reason for a modlog case.

**__Permissions:__**

permissions Command permission management tools.

regal scaffold
quaint mantle
eternal oxide
#

^ not allowed

regal scaffold
#

XD

crimson mulch
#

So i just tried to add smting to jar task

#

I've read the doc, and you just have to add the "location" of the sources

#

soooo

#

I've done that

#

jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
for (final def module in subprojects) {
from module.name + "/src/main/java"
}
}

#

buuuut

#

it's

#

.java

#

not .class

#

😭

regal scaffold
#

wut?

#

Show me the line you can't add @crimson mulch

crimson mulch
#

what ?

#

what do you mean ?

regal scaffold
#

it's
.java
not .class

#

Show me where

crimson mulch
#

In the jar

#

The files that were add

#

are in .java and not in .class

regal scaffold
#

Of course lol

crimson mulch
#

yeah

regal scaffold
#

.java gets converted to .class

#

It's how java works

crimson mulch
#

No sh*t

#

Your welcome sherlock

regal scaffold
#

Then you gotta explain your issue better

#

Gl getting someone to help you now "senior java developer"

eternal oxide
#

"/src/main/java" is a source path

crimson mulch
#

My issue is that I need to "compile" all my subproject, than put all the compiled file in my final jar

crimson mulch
#

so i decided to change that

#

/build/classes/java/main

regal scaffold
#

xd

eternal oxide
crimson mulch
#

Because I don't know how to do it automaticly without creating a "circular dependency"

eternal oxide
#

I don;t use Gradle but probably the shadow plugin

crimson mulch
#

I already tried that

eternal oxide
#

Yeah I'm not going to guess anymore, you provide so little information

#

Ask a complete question

crimson mulch
#

that was my initial question

#

that no one red

eternal oxide
#

ok you never specified yoru modules in your parent

crimson mulch
#

Okay, and how can I do that ?

#

Please ?

crimson mulch
#

...

eternal oxide
regal scaffold
#
java.lang.NullPointerException: Cannot invoke "me.tomisanhues2.ultrastorage.mechanics.AUChestHologram.updateHologram()" because the return value of "me.tomisanhues2.ultrastorage.data.UltraChest.getHologram()" is null
crimson mulch
#

Would you explain it to me please, I don't understand how it is formatted, I would be appreaciated

regal scaffold
#

Why am I getting that if I specified my method is nullable

#
    @Nullable
    public AUChestHologram getHologram() {
        hasHologram = hologram != null;
        return hologram;
    }
eternal oxide
#

I don;t use Gradle, I use Maven so it's different

eternal oxide
#

multi module setup

crimson mulch
#

already listen that

#

but it's really not the samething I did

#

I don't want to edit my whole structure

eternal oxide
#

multi-module requires a specific format

crimson mulch
#

Well, then I will use my "blr" setup which is very bad, but works

rotund ravine
regal scaffold
#

I was handling it

#

Clearly not correctly

rotund ravine
#

Seems so

regal scaffold
#

I am fixing rn

#

We did it!

#

That looks clean

static ingot
#

Is there a way to simplify checking whether 2 locations are within the same block? instead of i.e.:

if (loc1.getBlockX() == loc2.getBlockX() &&
    loc1.getBlockZ() == loc2.getBlockZ() &&
    loc1.getBlockY() == loc2.getBlockY()) {
    // ...
}```
regal scaffold
#

Does BukkitRunnable#runTaskTimerAsynchronously() also run BukkitRunnable()#run()?

regal scaffold
#

Ty

#

location#distance(location2)

#

Returns a double

static ingot
#

I can't use that to tell if it's at the same block location though. The distance could be 0.2, but it could still be in a different block.

regal scaffold
#

<1 is still the same block

#

If the location is set on a block itself

#

If you get the location of a block

#

It will always return X.00

#

Meaning any change will be a different block

#

Just round it

#

Or

#

nvm that's the best

static ingot
#

¯_(ツ)_/¯

undone yarrow
#

What would be a better way of writing this? java public void RemoveLoc(Location loc, CommandSender sender) { loc.add(0.5, 1.4, 0.5); if (!scrapLocations.contains(loc) || !lootedScrapLocations.contains(loc)){ sender.sendMessage("That block is not a previously added location and therefore cannot be removed."); return; } if(scrapLocations.contains(loc)) scrapLocations.remove(loc); if(lootedScrapLocations.contains(loc)) lootedScrapLocations.remove(loc);

#

Ignore the second line

hazy parrot
#

You can just remove

#

It returns boolean

#

True if that list already contained element

undone yarrow
#

?

#

Could you put that in a sentence a normal human can understand plea/se

lost matrix
#

Ok first of all: Locations are very very precise.
If you have a location at
(1.5, 1.0, 1.5)
Then a location at
(1.5, 1.00000001, 1.5)
Is already completely different.

So using Locations as Block identifiers is a pretty bad idea.

Next:
Collection#remove(Object) returns either true if the Object was removed or false otherwise.
So checking for contains before removing an Object is not necessary.

hazy parrot
undone yarrow
#

But then how would I do that if I had two lists, and a single lloc can be in one of them?

lost matrix
# undone yarrow 1. the locations won't ever become 1.0000000001 y, because of how the code works...
  private final Set<Location> scrapLocations = new HashSet<>();
  private final Set<Location> lootedScrapLocations = new HashSet<>();

  public void removeLoc(Location loc, CommandSender sender) {
    loc.add(0.5, 1.4, 0.5);
    
    if (scrapLocations.remove(loc)) {
      sender.sendMessage("A scrap location was removed.");
      return;
    }
    
    if (lootedScrapLocations.remove(loc)) {
      sender.sendMessage("A looted scrap location was removed.");
      return;
    }
    
    sender.sendMessage("That block is not a previously added location and therefore cannot be removed.");
  }
hazy parrot
#
if(!list1.remove(smth) | !list2.remove(smth)) {
    sendMessage(Sorry can't remove because both locations didn't exist);
} 
#

This is closest to your previous code

#

As you send message only if both lists/sets didn't contain loc

undone yarrow
lost matrix
hazy parrot
lost matrix
#

Yes but it introduces ambiguity about which of those operations executed.

hazy parrot
#

Oh yeah, that is right, but it's just what his original code did

quaint mantle
#

Fuck

#

🚁

lost matrix
#

I meant i would separate the conditions. || wouldnt work ofc.

#

Unless the sets have exclusive access to locations

eternal oxide
#

round the x,y,z of the location before all operations, if you are workgin with blocks.

#

or construct yrou own Location object using ints

undone yarrow
#

Alright so now I have this code that allows you to add, remove and list blocks to a list, and adds particles above them. If you right click the blocks, the particles disappear for a few seconds.
The thing is, I want it to be more customizable, so that players can do /sc add [particle] [cooldown] [loot]. The loot should be a list of some sorts because it should give you a random item from a set of items (specified by [loot])

regal scaffold
#

elgarl

#

Remember what you were helping me with yesterday

undone yarrow
regal scaffold
#

Got something to show

regal scaffold
#

Thanks

#

What does notscheduledYet error mean

#

Like I know what it means lol but like

eternal oxide
#

two things MC really needs... Billboards and my mind went blank and I can;t remember the second 🙂

undone yarrow
regal scaffold
#

Yes but

#

I'm never trying to cancel it

undone yarrow
#

🤔

eternal oxide
#

you must be somewhere

undone yarrow
#

yea

regal scaffold
#
    public void attemptStartSell() {
        if (this.sellUpdateTask != null) {
            return;
        }

        this.sellUpdateTask = (new SellTimerTask(UltraStorage.getInstance())).runTaskTimer(UltraStorage.getInstance(), 20L, 20L);

    }
eternal oxide
#

or you try to cancel an invalid Task ID

#

or you try to cancel it twice

regal scaffold
#
public class SellTimerTask extends BukkitRunnable {

    private final UltraStorage plugin;
    private List<UltraChest> ultraChests;

    private Map<UltraChest, SellTask> sellTasks = new HashMap<>();

    public SellTimerTask(UltraStorage plugin) {
        this.plugin = plugin;
        ultraChests = plugin.ultraChests;
    }

    @Override
    public void run() {
        if (ultraChests.isEmpty())
            return;
        for (UltraChest ultraChest : ultraChests) {
            if (sellTasks.containsKey(ultraChest)) {
                sellTasks.get(ultraChest).cancel();
                sellTasks.remove(ultraChest);
            }
            sellTasks.put(ultraChest, new SellTask(ultraChest));
        }
    }
}
#

no cancel anywhere

eternal oxide
#

sellTasks.get(ultraChest).cancel();

regal scaffold
#

I am

#

Literalluy

#

blind

#

and gonna kms

eternal oxide
#

are tehy actual tasks?

#

🙂

regal scaffold
#

They should be tasks

undone yarrow
#

Or does it have to do with the scheduler

#

That means I would also have to cancel the task of that loc

lost matrix
undone yarrow
#

Because otherwise they all cooldown at the same time

#

and that wouldnt work right

eternal oxide
#

thats when you change from a Set to a Map

#

BlocLocation, cooldown

undone yarrow
#

So what does a map do

lost matrix
#

There are a lot of approaches for cooldowns like this. The most sophisticated would be to use a PriorityQueue for this.
But creating one task for each Location seems like a logistical nightmare. Every time i see people manually
starting and cancelling hundreds of tasks i can smell the problems emerging.

eternal oxide
#

then create an Object

#

an Object which contains teh location, the cooldown, particle and anythgin else you need

undone yarrow
lost matrix
#

I feel like you should create more classes. It looks like you are using a lot of raw dangling Collections with
Objects like Location, Block etc.

undone yarrow
eternal oxide
#

all you do is pass the location

undone yarrow
#

?

eternal oxide
#

as thats all your command sets?

undone yarrow
#

No?

#

It does now

#

But I said I want to add arguments that let a player specify, cooldown, items, and particle

eternal oxide
#

then you create a method which accepts a new YourChestObject

undone yarrow
#

Then that also has to be passed right?

pseudo hazel
#

my item cooldown manager just stores and uses system time haha

#

might not be the best solution for laggy servers but it works

eternal oxide
#

new YourChestObject(Location, Cooldown, Particle)

undone yarrow
#

Hmm alright, but what do you mean with the YourChestObject?

eternal oxide
#

a class you create to store all these things

undone yarrow
#

👍

undone yarrow
lost matrix
# undone yarrow Hmm alright, but how would I pass that information when calling one of the funct...

Here is an idea of what a scrap pile could look like:

public class ScrapPile {

  private final long cooldown;
  private final List<ItemStack> loot = new ArrayList<>();
  private final Particle particle;
  private long respawnTime;

  public ScrapPile(long cooldown, Particle particle) {
    this.cooldown = cooldown;
    this.particle = particle;
  }

  public void addLoot(ItemStack itemStack) {
    this.loot.add(itemStack);
  }

  public long getCooldownLeft() {
    long now = System.currentTimeMillis();
    long timeLeft = respawnTime - now;
    return timeLeft;
  }

  public void startCooldown() {
    long now = System.currentTimeMillis();
    this.respawnTime = now + cooldown;
  }

  public Particle getParticle() {
    return this.particle;
  }

}
eternal oxide
#

In it's constructor you can auto assign values if any of the values are null, and normalize your location

lost matrix
#

Honestly: Create more classes. It will help you build very powerful systems in a fraction of the time eventually.

undone yarrow
#

But this is a really small plugin and creating a billion classes for like 4 methods seems too unnecessary and too unorganized for this

lost matrix
#

o.O

#

What?

eternal oxide
#

you are usign holograms, particles, cooldown and chest. Not so small

lost matrix
#

If you are using a scheduler and keeping track of locations etc then what you are doing is borderline chaotic.
Classes is what makes a project organized in the first place.

pseudo hazel
#

my class count usually averages out to 2-3 classes per logical system of my plugin

undone yarrow
#

Hmmm alright

lost matrix
#

Cant say that for mine...

undone yarrow
#

....

pseudo hazel
#

yeah well you are a little insnae

undone yarrow
#

When I make that many classes I need to look 5 hours before I find the class I need to work with

pseudo hazel
#

and too good at what you do

vocal cloud
pseudo hazel
#

structuring a project is also a skill to learn

tardy delta
#

How many lines main class?

undone yarrow
tardy socket
#

Is there a "getAdvancementManager" method ? ChatGPT tells me that I shall use this but I can't find any document about it

hybrid turret
#

How do I get the display name of an item in a created inventory using the InventoryClickEvent?

tardy delta
#

Isn't that on the meta?

hybrid turret
#

oh yeah i guess

#

mb

#

oh, i may have also just overlooked "getCurrentItem()" lmao

undone yarrow
eternal oxide
#

Start by creating yoru object to accept yoru location, as thats all yoru command does right now

undone yarrow
eternal oxide
#

yes, expand it later

#

learn how to create and store teh object first

#

instead of your current method of add(Location) you would use add(YourChestObject)

lost matrix
eternal oxide
#

Java/oop is all about classes

lost matrix
undone yarrow
#

hmm mkay

lost matrix
#

Idk how long actually XD

undone yarrow
# eternal oxide learn how to create and store teh object first

Does this look good? ```java
import org.bukkit.Location;
import org.bukkit.Particle;

import java.util.List;

public class ChestObject {

private final Location location;
private final Particle particle;
private final long cooldown;
private final List<ItemStack> items;

public ChestObject(Location location, Particle particle, long cooldown, List<ItemStack> items) {
    this.location = location;
    this.particle = particle;
    this.cooldown = cooldown;
    this.items = items;
}

public Location getLocation() {
    return location;
}

public Particle getParticle() {
    return particle;
}

public long getCooldown() {
    return cooldown;
}

public List<ItemStack> getItems() {
    return items;
}

}``` Im not sure if the last 4 methods are really necessary though, I added them to be safe

#

I guess theyre useful if you want specific info

tardy socket
undone yarrow
#

Tell it that thats not correct

#

and ask it what version of the docs he's using

lost matrix
undone yarrow
#

Theyve always confused me

eternal oxide
#

always private, only enums should be public (mostly)

undone yarrow
#

Doesnt making them private make it harder to access them in other classes?

eternal oxide
#

yes

#

thats what getters and setters are for

#

you control access to your Fields

undone yarrow
#

I tried generating the getters but it doesnt work anywhere

eternal oxide
#

if code has to access them via getters they can't be accidentally re-assigned

undone yarrow
#

It keeps saying this

eternal oxide
#

you already have getters

undone yarrow
#

where

eternal oxide
#

public Location getLocation() { etc

undone yarrow
#

ohh those are getters and setters?

#

Or only getters?

eternal oxide
#

getters

undone yarrow
#

So how do I get the setters

eternal oxide
#

same way

#

you shoudl not add a setter for Location though

#

that will never change

undone yarrow
#

Do I even need setters?

tawdry echo
#

You have final fields so you cant generate setters

undone yarrow
#

I mean, if someone wants to change a location, they just remove it and make a new one

undone yarrow
hybrid spoke
#

wait intellij can generate them

eternal oxide
#

you probably want to alter your cooldown?

undone yarrow
#

Then Ill just remove it and make a new one

#

I dont want to make it too complicated lol

#

It should be a simple plugin

hybrid spoke
#

just use lombok

eternal oxide
#

if you want to be able to chage your cooldown take final off it's definition

undone yarrow
#

Yes but why would I want to change cooldown?

#

It's a standard number let's say 60 ticks, then that's how long the cooldown is

eternal oxide
#

I assumed it was a cooldown counter, is it just a fixed value?

cold field
#

do you guys know if it is possible to tell to shadowJar task to relocate everything?

#

with some exceptions

undone yarrow
#

It specifies how long it should take

eternal oxide
#

ok if its a fixed value then keep it final and no setters

pseudo hazel
undone yarrow
#

Chatgpt's data only goes to 2020 or so

tardy delta
#

make it a record if you want

#

exposing collections goes brr but its needed here as far as i see

eternal oxide
#

he is basically creating a Record but he's only just starting with multiple classes so lets go one step at a time 🙂

pseudo hazel
#

thats dumb, might aswell teach the best way to do this stuff from the start

undone yarrow
#

Alright so now that I can make a ChestObject, how would I pass in the arguments from the command? As I said earlier, I can't just say Particle particle = args[1];

eternal oxide
#

no Records are a next step

pseudo hazel
#

just make a record, that will turn this object into like 3 lines if code

eternal oxide
#

it would, and he'd learn almost nothing

pseudo hazel
#

i guess you have a point

#

okay nvm me then

eternal oxide
#

new ChestObject(Location, etc

undone yarrow
#

Yes I have this, and I can pass in blockLoc fine, but what about the other arguments?

#

Such as particle, cooldown etc.
new ChestObject(blockLoc, args[1], etc.) wont work

eternal oxide
#

if you want an actual Particle you can Particle.of(String) or somethign close

#

Particle.valueOf(

#

that does require them to type the correct particle value though

#

you can make that easier later with TabComplete

tardy socket
#

chatGPT is cheating me. I told it that unsafe() is deprecated, and it tells me that I shall use Bukkit.getUnsafe().fromSpecificServer(AdvancementManager.class);

#

🤔

undone yarrow
#

d

#

only gets info from before 2020

#

so changes after that are not recorded in chatgpt

tardy socket
#

bad news

undone yarrow
eternal oxide
#

get everything working first

#

TabComplete is an enhancement you add once you have it all working

crimson terrace
#

alternatively you can use a command framework

eternal oxide
#

God no, don;t use a framework for a beginner

crimson terrace
#

fair enough

undone yarrow
eternal oxide
#

if SCRAPE is a particle then just that

undone yarrow
#

Ugh this stuff is so confusing sometimes. Now I have the chestObject and I passed it on in the Add(ChestObject chest) method, but how can I now access this chest in other methods? And how can I store multiple chests and check which is which using the location?

tardy socket
#

I wonder how I can insert my customized advancement to a proper location in the advancement tree, for example, between Tactical Fishing and The Cutest Predator.

eternal oxide
undone yarrow
#

So I just add the chest to a set

#

and when I want to remove a location I just remove the chest from the set

eternal oxide
#

OR you can use a Map<Location, ChestObject>

undone yarrow
#

Sounds alright, but then how can I check which chest is which using the location

undone yarrow
eternal oxide
#

to make it easy to pull the correct one based on Location, if you need that

#

it really depends on what you need to do with them

undone yarrow
#

Ill go for a map then, I think

eternal oxide
#

if you are just looping over them to do the particles, then a Set is all you need

#

if you want to pull a specific ChestObject then you need its Location so a Map

undone yarrow
#

I also need to remove specific ones

eternal oxide
#

then a Map

undone yarrow
#

and get loot from specific ones so map it is

undone yarrow
eternal oxide
#

Map<Location, ChestObject> yourCollection = new HashMap<>();

undone yarrow
#

I dont want duplicates so HasMap right

#

yea

eternal oxide
#

they will be stored using teh Location as a Key so be sure you are normalizing it

tardy delta
#

time to work on my recipe parser

#

only 500 more files to parse

eternal oxide
#

I'm not going to be about for a while, Wife is coming home from Hospital today so if you get stuck I'll be unavailable.

tardy delta
undone yarrow
analog thicket
tardy socket
#

ok thanks

undone yarrow
#

I don't get why the return value of "java.util.Map.get(Object)" is null

tawdry echo
#

Show ChestObject#getParticle

#

You trying get value from map but key not exist

undone yarrow
tardy delta
#

whats on ParticleHandler line 106

undone yarrow
#
    public void spawnParticlesEverySecond(Plugin _plugin) {
        Particle particle = Particle.SCRAPE;
        plugin = _plugin;
        BukkitRunnable runnable = new BukkitRunnable() {
            public void run() {
                for (Location location : scrapLocations) {
                    Particle particle = chests.get(location).getParticle(); // line 106
                    Objects.requireNonNull(location.getWorld()).spawnParticle(particle, location, 7, 0.1, 0.2, 0.1);
                }
            }
        };
        runnable.runTaskTimer(plugin, 0L, 20L);
    }
eternal oxide
#

normalize teh location in yoru onCommand of the construtor of CHestObject

tardy delta
#

probably that

undone yarrow
eternal oxide
#

yes

undone yarrow
#

But if I do that, the spawn location of the particle is messed up

eternal oxide
#

adjust the particl in the spawn method

undone yarrow
#

k

#

Ill remove all the location.add thingies and Ill normalize it

#

How do I normalize it?

#

the .normalize() doesnt work

#

it doesnt exist

eternal oxide
#

set x,y,z to the getBlockX() getBlockY() getBlockZ()

undone yarrow
#

I can also do ```
public static Location normalizeLocation(Location loc) {
float pitch = loc.getPitch();
float yaw = loc.getYaw();

// normalize pitch
pitch = pitch > 90 ? pitch - 180 : pitch < -90 ? pitch + 180 : pitch;

// normalize yaw
if (yaw < 0) {
    yaw += 360;
}
yaw %= 360;

loc.setPitch(pitch);
loc.setYaw(yaw);

return loc;``` but that seems like overkill
eternal oxide
#

or Math.floor

undone yarrow
tardy delta
#

loc.normalize()?

undone yarrow
eternal oxide
#

loc.setX(Math.floor(loc.getX()))

#

same for y and z

undone yarrow
#

👍

tardy delta
#

mappings are fun

undone yarrow
#

[10:51:48] [Server thread/WARN]: [ScrapCollection] Task #2 for ScrapCollection v1.0 generated an exception
java.lang.NullPointerException: Cannot invoke "me.JustinS_2006.particles.ChestObject.getParticle()" because the return value of "java.util.Map.get(Object)" is null
at me.JustinS_2006.particles.ParticleHandler$1.run(ParticleHandler.java:104) ~[?:?]
at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftTask.run(CraftTask.java:82) ~[server.jar:3284a-Spigot-3892929-0ab8487]

#

ughh why wont this stupid code work

undone yarrow
eternal oxide
#

show your particle handler

#

?paste

undone axleBOT
eternal oxide
#

ok delete yoru scrapLocations

#

you don;t need that set at all now

#

you can chests.getKeySet()

undone yarrow
eternal oxide
#

why not add a flag to your ChestObject for looted

#

isLooted

#

then you don;t need either of yoru two Sets

undone yarrow
#

Hmm

#

smart

#

Time to change everything again

eternal oxide
#

🙂

undone yarrow
eternal oxide
#

w3hat was scrapLocations for?

#

when one is looted it's removed from there?

undone yarrow
#

The locations that arent looted

undone yarrow
#

So basically unlootedLocations

#

but wait cant I simplify this entire method to 1 if check?

eternal oxide
#

yep so if (chests.get(location).isLooted()) chests.get(location).setLooted();

cold field
#

I was trying to relocate sqlite jdbc drivers but that just broke the plugin. I saw this issue https://github.com/xerial/sqlite-jdbc/issues/145 where MD5 says that you can't relocate classes that contains invocation of native methods. So I was wondering how should we handle sqlite jdbc relocation to not clash with other plugins?

eternal oxide
#

err no

#

if you are setting it looted just setLooted

undone yarrow
eternal oxide
#

remove becomes setLooted()

undone yarrow
#

Im removing it from the list

#

But not if I want to remove the entire thing

eternal oxide
#

once looted do you remove the chest?

undone yarrow
#

Like, remove the location

#

dont make it looted or unlooted or anything

#

just remove it from existance

chrome beacon
undone yarrow
#

thats what the remove function does

eternal oxide
#

if you want to remove it when looted just remove from chests

#

chests.remove(location)

undone yarrow
#

I want to remove it no matter if it's looted or not

#

So Ill just remove it from chests, yes

eternal oxide
#

yes

#

thats the only place you shoudl have any trackign of the chest or location

vocal cloud
#

Wait is the goal to create lootable chests?

eternal oxide
#

got to go, wife is home

undone yarrow
#

Lootable blocks

#

lol

cold field
undone yarrow
undone yarrow
#

Does the ! make sure it returns the reverse value?
return !chests.get(loc).isLooted();
So if chests.get(loc).isLooted(); is true, it returns false?

undone yarrow
# lost matrix Here is an idea of what a scrap pile could look like: ```java public class Scrap...

Coming back to this, can you explain how that cooldown works? Now I've got a lot of code working, but Ive arrived at the cooldown which needs some fixing. Rn I have:java public void spawnParticlesEverySecond(Plugin _plugin) { plugin = _plugin; BukkitRunnable runnable = new BukkitRunnable() { public void run() { for (Map.Entry<Location, ChestObject> entry : chests.entrySet()) { Location location = entry.getKey(); Particle particle = chests.get(location).getParticle(); Objects.requireNonNull(location.getWorld()).spawnParticle(particle, location, 7, 0.1, 0.2, 0.1); } } }; runnable.runTaskTimer(plugin, 0L, 20L * chests.get(location).getCooldown()); } though at the last line it asks for a cooldown which I don't have because it's different for each location.
So, what did you say was a better way of doing this?

vast raven
#

How to place an head with a custom texture?

vast raven
lost matrix
# vast raven How to place an head with a custom texture?
  1. Get BlockState of Block
  2. Cast to Skull
  3. Create PlayerProfile with Bukkit class
  4. Get PlayerTextures from it
  5. Set the texture URL on the PlayerTextures
  6. Set PlayerTextures on PlayerProfile
  7. Set PlayerProfile on Skull
  8. Call .update(true) on Skull
chrome beacon
vast raven
#

I didn't used "update(true)"

#

Hoping it wasn't the problem

dark bridge
#

Hello
Why couldn’t i find DiscordSRV plugin in aternos ?

chrome beacon
dark bridge
#

Like I couldn’t find the plugin

chrome beacon
#

Ask Aternos