#help-development

1 messages ยท Page 943 of 1

wintry lynx
#

I didnt even know that was a thing... Geez i feel stupid

remote swallow
#

i didnt either till about 30 seconds ago

wintry lynx
#

lol

#

well thank you

golden turret
#

I have this code to find my data in the mongodb

#

the problem is that this happens

#

if I change the fieldName to an invalid one, it works (of course if finds nothing)

#

i can do it directly though

#

fixed

#

I needed to call the reader.readEndDocument() in my codec

lilac sand
#

Hello I have a question and maybe I am just being really stupid. SO, I am currently working on creating a parkour plugin for a server that I am creating. I am having an issue with getting the text from the sign to check if it is a checkpoint sign. I have done some research and I saw that getLine() is a thing but it is deprecated and I was wondering if there is anything that I should be using because it is deprecated? Thank you in advance!

drowsy helm
#

Returns SignSide then you get getLine

lilac sand
#

Thank you

wintry lynx
#

So as far as I know there is no way to get the satuartion and value of a food source using bukkit metas and such. To the smart code peeps, is that true?

ivory sleet
#

Maybe with the new component system thingy

#

But that wouldnt be in api yet, so probs not?

rough ibex
#

I believe you'll have to store that info yourself

#

luckily the wiki has them

cinder spindle
#

Hey hey
Anyone is taking commissions atm?

rough ibex
#

?services

undone axleBOT
rare rover
#

is there a program or something to convert json to nbt

#

(not using mojangs stuff)

#

can't find one

#

i could write my own ig

#

that's boring

spare hazel
#
permissions:
  gamemodealert.bypass:
    description: bypasses alerts
    default: op
  gamemodealert.admin:
    description: receives alerts
    default: op
ocean hollow
#

how can I send a package to players so that instead of its item they see a drawn crossbow?

spare hazel
rough ibex
rare rover
#

OO

#

ty

rough ibex
#

this should work.

#

again, google.

rare rover
#

legit opened all of it

spare hazel
#

is there any available dockerfile for running spigot minecraft servers?

rough ibex
#

Yes

#

also found via ddg

spare hazel
#

thanks

blazing ocean
#

those are a bit annoying to use, if you rlly want them, set up pterodactyl

blazing ocean
#

which is a container-exclusive isshe

rough ibex
#

YMMV, buyer beware, you're on your own, have fun

blazing ocean
#

lol

novel depot
#

is there a way to allow pistons to push anvil

agile anvil
#

I've never worked with redstones in plugins. However I am thinking about a little trickery:
Instead of placing actual anvil block you can spawn a FallingBlock entity of Anvil and thus push it with a piston.

however it seems a hard process to do since you will have to handle many cases to avoid your Anvil moving, handle the break, handle the fall when no blocks are below, etc...

tall dragon
#

anvil will stop working tho ;d

gentle nexus
#

what does normalising a vector do ?

agile anvil
#

just give up it's just too much of a pain lmao

agile anvil
lost matrix
tall dragon
#

and it does work even for vanilla clients on the fabric server

agile anvil
#

Maybe the BlockPistonExtendEvent is actually thrown for the anvil before cancelled?

slate surge
#

How to use Location.getBlock.setType() to set a bed

lost matrix
#

If you have a Block and a BlockFace, then you can place the first part of your bed
on

#

nvm ill write it up, thats quicker

slate surge
#

umm

lost matrix
# slate surge umm
  public void setBed(Block headBlock, BlockFace facing, Material bedMaterial) {
    Preconditions.checkArgument(Tag.BEDS.isTagged(bedMaterial), "Material is not a bed.");

    Bed headData = (Bed) bedMaterial.createBlockData();
    headData.setPart(Bed.Part.HEAD);
    headData.setFacing(facing);

    headBlock.setBlockData(headData);
    
    BlockFace oppositeFace = facing.getOppositeFace();
    Block footBlock = headBlock.getRelative(facing);

    Bed footData = (Bed) bedMaterial.createBlockData();
    footData.setPart(Bed.Part.FOOT);
    footData.setFacing(oppositeFace);
    
    footBlock.setBlockData(footData);
  }
slate surge
#

also ik this is teribble but it doesn't work?

    @EventHandler
    public void onPlayerKick(PlayerKickEvent event) // Not working, gets ignored
    {
        Player player = event.getPlayer();
        System.out.println("Called onPlayerKick event");

        event.setLeaveMessage(Helpers.getFormattedMessage(playerKickMessage.replace("{player}", event.getPlayer().getDisplayName()).replace("{reason}", event.getReason())));
}```
lost matrix
slate surge
#

nope

#

the debug sout works but the message isnt getting set

#

it is the default kick message "player left the game"

lost matrix
#

Whats up with the // Not working, gets ignored comment then?

slate surge
#

thats just for the future dev if i leave it not working if atm it starts to work i will remove it

dire marsh
#

not many people know 1.8 api anymore

slate surge
#

unfortunatly

#

its very out dated

#

but the performance is pretty good

#

so thats why i am using it

lost matrix
# slate surge i am using 1.8 ๐Ÿ’€

No idea. event.setLeaveMessage() should work. Maybe you have a PlayerQuitEvent listener which overwrites it or something.
Did you check for exceptions in console?

slate surge
#

no errors

#

so maybe the playerquitevent is messing it up or smth

#

because only the message is not getting set because the method is getting called

#

not interfearing

#

still the same

lost matrix
slate surge
#

works when printing it

lost matrix
#

Where do you expect the leave message to be sent?

fallen lily
#

It will require patching nms directly

#

PistonExtendsChecker#a()Z

silent slate
#

is the question conversaton over? i dont wanna interrupt

slate surge
agile anvil
silent slate
#

Okay, well this is a question ive asked yesterday evening, but havent gotten solved yet

lost matrix
#

First of all: When a player joins you should load all his inventories into memory.
While he is online, dont tinker with files.
When he quits, save all inventories back to a File.

What is your "error"?

agile anvil
#

NPE on the offHandItem

silent slate
lost matrix
#

Also this code here can be simplified to just

boolean isInBuildMode = storage.getBoolean(uuid + "." + world + "." + "buildmode");
String savedInvType = isInBuildMode ? "buildinventory" : "normalinventory";
String loadedInvType = isInBuildMode ? "normalinventory" : "buildinventory";
inventoryFromBase64((String) storage.get(uuid + "." + world + "." + "loadedInvType"), player);
storage.set(uuid + "." + world + "." + invType, inventoryToBase64(player.getInventory()));
storage.set(uuid + "." + world + "." + "buildmode", isInBuildMode);
silent slate
#

im a bit confused there

#

possibly i dont understand that higher end java expressions

lost matrix
#

Yeah scrap that. You should generally not do any of that in the first place.
Tinkering with files on runtime is very undesired.
Load all your data into a manager when the player joins, use this loaded data to swap between inventories
and only save it back when the player quits again.

silent slate
#

am i not loading it into runtime by using Yaml.loadconfiguration ?

lost matrix
#

Yes its in memory. But accessing it through a bunch of strings is very fragile.

#

There is so much structure abuse here. For example this:

#

Are you aware when this code is being executed when it just lays around loosely in a class?

silent slate
#

well i dont really know what you mean by laying around loosely and stuff, i know that i am static abusing, but ive never seen that as a problem because it never resulted in a problem

lost matrix
# silent slate well i dont really know what you mean by laying around loosely and stuff, i know...

static abuse will eventually always lead to problems.
If your AltBuildUtils.class gets randomly touched by the ClassLoader, then the entire ClassLoader will just throw erros which will take
ages to figure out. Using static like that can not only compromise your own plugin, but can interfere with other plugins as well.
For example if they use the library guice. Then your plugin will often just break, without you ever finding out why.

silent slate
#

When restarting the server i often need to manually restart this plugin, how to fix that?

#

is that bc of static abuse

agile anvil
#

Restart the plugin?

#

How so?

lost matrix
#

I dont know what that means... How can you even "manually restart" a plugin?
Restarting the server will completely stop the application and start it again.

silent slate
#

well using plugman to reload it

lost matrix
agile anvil
#

oula

lost matrix
lilac dagger
#

plugman can introduce bugs

#

use /reload as a last measure

silent slate
lost matrix
#

Yeah this sounds like this can be caused by static abuse

silent slate
#

Are you free to talk? Takes ages to write i can also send you the project

agile anvil
#

Is there even some errors or?

silent slate
#

i dont think so

lilac dagger
#

this reminds me of a bug in my plugin were due to multiverse loading after my plugin my plugin wouldn't work until you'd restart/reload later on when the world did load

silent slate
#

could be the case

#

i also use multiverse

#

back to the roots of the problem though: How do i save the inventory per Player when he loads / quits and how to save the current status: Buildmode or not

agile anvil
#

I think the loading issue is something you would like to solve before the rest

lilac dagger
#

along with other multiverse like plugins for good measure

silent slate
#

Like this

  - Multiverse```
lilac dagger
#

yeah, but the name's different

#

check it in /plugins

silent slate
#

Multiverse-Core

lost matrix
#

Thinking about my next PR. What do you guys deem to be more useful:

ChunLoadEvent -> add a getLoadReason() method to check if a Player triggered the load.
(Can be used for example to prevent certain players from generating new chunks)

Inventory -> add the remove(Predicate, int), first(Predicate) methods.
Could be used like this:

// Remove 10 items with the luck enchantment from the inventory:
Inventory inventory = player.getInventory();
inventory.remove(item -> item.getEnchantmentLevel(Enchantment.LUCK) > 0, 10);

And

// Get first slot which has a tool for this Block
Block block = ...;
Inventory inventory = player.getInventory();
int toolSlot = inventory.first(block::isPreferredTool);
chrome beacon
#

ChunkLoad

lost matrix
#

Hoped the other would be more useful because the chunk load requres writing a few patches for nms PES_Old

nova notch
#

Inventory stuff is super easy to just make yourself in like 5 minutes or less

#

It's cool tho

lost matrix
#

Yeah i should probably start writing more api that actually exposes nms functionality instead of utility

worthy star
#

how do i save a list of data to player like (reports, warnings ...) without using pdc

#

whats the best way to do it

chrome beacon
#

The best way would probably be a database

#

SQLite if you want a flatfile one

worthy star
#

no database

#

i want to use like maps and sets

chrome beacon
#

Those are in memory

worthy star
#

i tried
public static Map<UUID, Set<String>> warns = new HashMap<>(); but i don't think this is an efficient way

chrome beacon
#

They will be lost on restart

worthy star
#

oh

#

dang

#

ig i'll use data files

#

how can i get the size of a configuration section from a config?

#

nvm

tardy delta
#

by reading the docs

ancient reef
#

is there a bukkit api way of getting worldgen info like ore distribution?

acoustic pendant
#

Could someone suggest a way of getting the item clicked in a gui (when all are the same material, heads basically) without using namespacedkey?

blazing ocean
#

you can check for the skull owner ig

#

or use pdc

#

or just get the slot of said item

acoustic pendant
#

i'll try with nbt tags

#

or maybe don't support old version, i'll see

tall dragon
#

idk what u mean. why not use InventoryClickEvent#getCurrentItem() ?

native ruin
#

Do i have to reinstall nms with the correct mapping or can i do that seperatly?

acoustic pendant
tall dragon
tired star
#

so Im trying to prevent Trident pick ups when they're stuck somewhere. What's the right event for it? EntityPickupItemEvent doesnt seem to work

acoustic pendant
#

I can try creating an itemstack and checking that maybe

tall dragon
#

doesnt ur config specify a slot?

#

just compare that

acoustic pendant
#

I can give a id to the item in config maybe

tall dragon
acoustic pendant
#

oh

#

I could actually do that with a map

#

thanks!

molten hearth
#

yo chat how does one use the intellij profiler for a shadowJar task output

#

do i need to run it separately via java -jar and configure it to attach in some way?

#

i figured it out

#

it has a task to run jar apps

gentle nexus
#

how would i like
damage an entity at certain coordinates ?

native ruin
#

Maybe Getnearbyentites with tiny radius?

#

And than damage

calm lichen
#

hey, does anyone know anything about trying to use protocollib as a dependency to simulate packets?
https://paste.md-5.net/uzoxevayor.java
https://paste.md-5.net/apawadudul.java
https://paste.md-5.net/unerikilax.java
https://paste.md-5.net/imodoluroc.xml
https://paste.md-5.net/puhezupige.coffeescript

basically i want to re-create/simulate the slowed mining effect + the block break animation that cosmic prisons utilized but for minecraft 1.20. I'm a little lost as to what I should be doing at this point.

lilac phoenix
#

Is it possible to modify the data of players in the game by modifying mysql? I use it to manage player accounts on the web.

slate surge
lilac phoenix
#

Is there any plug-in that can modify the player's data in the game by modifying mysql? I use it to manage player accounts on the web page.

slate surge
#

umm the plugin which is affecting the player data in game files, you want that to also be changed in the database?

slender elbow
#

bro you asked that 5 minutes ago and the message is still visible, have some patience

chrome beacon
#

also this is the wrong channel

#

stay in help server

eternal oxide
#

Also, wrong channel

lilac phoenix
slender elbow
#

any economy plugin made in the last 5 years will have sql support

worldly ingot
#

10 years, even

slender elbow
#

20, dare I say

gentle nexus
#

how do i make a cooldown ?
like the listener can only listen again after x amout of time
would i have to do thread sleep or somin?

worldly ingot
#

wtf woah, let's not get too crazy

undone axleBOT
thick oracle
#

Is there an alternative to Ageable#setAgeLock?

slate surge
rough drift
shadow night
slate surge
#

no but what is happening with the config

slate surge
rough drift
#

yes I saw it

#

I don't know what's happening

slate surge
#

the config is changing in every reboot?

#

and also is there any scoreboard and tab list api?

slender elbow
#

the config values aren't changing, just the order

#

so, not really an issue

slate surge
#

umm ok but why is that? a bug in bungeecord?

calm lichen
#

im still here if anyone gets a chance to respond to my query just respond to it and ill see it, thanks ๐Ÿ™‚

slate surge
#

what query?

calm lichen
#

got lost in the whole chat about what this chat is/isnt supposed to be used for and saying that every economy plugin has sqlite support lol

#

im working on figuring it out on my end as well ofc, but any insights would be more than welcome

slate surge
#

no idea in nms or protocol lib

#

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

alpine urchin
#

just saying its possible to "simulate" packets using packetevents

slender elbow
#

tbh I'd just wait for 1.20.5, since you'll be able to just change that with the whole data components stuff

calm lichen
#

rip guess im a little early on that huh

#

basically figuring out how to do this on 1.20 was a task given to me by my other dev friend cuz he couldnt figure it out since they removed packets but he offered to help with the project if i was able to work it out. looking over the data components stuff tho it seems like it would be pretty easy to just wait for that to implement that part of the project

sand spire
#

Does anyone who has connected LuckPerms to MongoDB in the past have any idea what I'm doing wrong?

slate surge
#

@sand spire see if the mongo db is binding on that address or not

sand spire
slate surge
#

binding means in which address is the mongodb hosted on

fallen lily
#

Usually preceding after a colon

sand spire
slate surge
#

is the mongodb binding on that port?

sand spire
#

i have no idea

slate surge
#

Why is this sending me to fbf1 first?

servers:
  fbf001:
    motd: fbf001
    address: 127.0.0.1:25566
    restricted: false
  hub1:
    motd: hub1
    address: 127.0.0.1:25567
    restricted: false

  priorities:
  - hub1
  - fbf001

#

give your mongodb config

sand spire
slate surge
#

show the hosting address

slate surge
#

show the config

sand spire
#

i have no config for mongodb

slate surge
#

@sand spire search how to connect mongodb to luckperms on yt

sand spire
#

and this is the config for luckperms

sand spire
#

oh to luckperms my bad

#

i already did

lean pumice
#

who can go to general-2 to help me?

sand spire
#

i couldn't find the solution myself that's why I'm asking here

hollow reef
#

what is the fastest way to encode / serialize a chunk to a string / byte[]?

agile anvil
#

Why would you do that?

#

And should it be fast to decode ? ๐Ÿ˜„

hybrid spoke
#

otherwise nbt or protobuf

sand spire
slender elbow
#

what was the issue

sand spire
#

i still have no idea how to do it the other way but this works so

hollow reef
hollow reef
remote swallow
lost matrix
calm lichen
#

anyone know how long it generally takes after a minecraft update for spigot to update as well? after looking into it quite a bit more it seems like my project would be much better suited for 1.20.5

eternal night
#

?eta

undone axleBOT
#

There is no ETA. Having an ETA leads to unrealistic deadlines, false hope, and a bad product. It will be ready when it's ready.

eternal night
#

I mean, this release is HUGE (1.20.5)

#

judging from previous releases, md_5 prepares most of spigot during snapshot phase, it gets published rather quickly.
However not in a production ready state usually and early builds are to be considered with care

lost matrix
eternal night
#

sweating block system?

#

did I miss a snapshot

lost matrix
#

In the api, the game doesnt really have block changes.

eternal night
#

oh you mean BlockType and ItemType?

lost matrix
#

Well its technically just item changes

eternal night
#

Yea I mean, if that lands in .5 COPIUM

lost matrix
#

If not then quite a lot of it would have to be changed for the new component-driven item system, no?

eternal night
#

not really

lost matrix
#

Im really curious how those components will be implemented in the API.
But im suspecting a Registry mirror for this. Lets hope we will be able to register our own components.

eternal night
#

not at all kekwhyper

#

โ„ข๏ธ

#

nah but, I mean ItemType and BlockType don't change

umbral ridge
#

how do you spawn a custom villager with a custom display name, and that they can't walk, just look around? Look at players?

eternal night
#

I might argue we will want to remove the .Typed subtypes again

#

idk what @young knoll's opinion on that is tho

#

Like, e.g. anything can be food now

#

or like, suspicious stew like

#

so technically ItemType.STONE could just return a SuspiciousStewMeta typed ItemType.Typed ?

#

its weird

lost matrix
#

Its really a matter on which tools we want to have for detecting the different types. instanceof would be the current approach i assume?

eternal night
#

Yea but I mean, that will fail soon

#

the more functionality they add to these components, the less the java class hirachy layout of ItemMeta will work

#

Well, at least the instanceOf part of it

#

different types might still make sense on an API level to represent archetypes of items/promise that some components are present

lost matrix
#

I mean ItemStacks are literally completely driven by components now.
You can set the stack size, custom durability for any item, if they are a suitable tool for certain blocks.
You can make stone and stick consumable. Everything.

eternal night
#

not really everything yet โ„ข๏ธ but yea

#

they are getting there

lost matrix
#

Whats not?

#

The texture i guess

eternal night
#

I mean, a lot of stuff is still bound to the type obviously

#

a banner pattern on a stone block doesn't make sense

#

until they allow you to customize what block is placed when you interact with the item

#

at which point, ggwp

shadow night
#

didn't mojang just make it possible to turn any item into any other item

eternal night
#

but yea, instanceOf just works less and less in the context of ItemMeta

umbral ridge
#

i think instanceof is perfect

lost matrix
#

Im gonna make people snort gunpowder and let them explode after playing a goat horn sound

eternal night
#

tho, tbf, most developers will not care about that anyway

umbral ridge
#

CommandSender instanceof Player ๐Ÿค“

acoustic pendant
#

Hey, so i have this code, but when i try to get the last value in the List (petManager) it says it is out of bounds, could someone help me? here's the code:

#
 int j = 1;
        ConfigurationSection section = pets.getConfig().getConfigurationSection("Pets");
        for (String str : section.getKeys(false)) {
            ConfigurationSection s = section.getConfigurationSection(str);
            s.set("id", j);
            List<String> lore = new ArrayList<>();
            for (int i = 0; i < s.getStringList("lore").size(); i++) {
                lore.add(ChatColor.translateAlternateColorCodes('&',
                        s.getStringList("lore").get(i)));
            }
            petManager.add(new PetManager(
                    s.getString("skin"), s.getString("name"),
                    j, lore));
            j++;```
#

could someone help me?

#

when i try to get other values it works

lost matrix
shadow night
#

The value List#size returns is one higher than the highest index in the list

young knoll
shadow night
acoustic pendant
eternal night
acoustic pendant
# lost matrix Refactor the single letter variables and i might give it a look
int id = 1;
        ConfigurationSection csection = pets.getConfig().getConfigurationSection("Pets");
        for (String string : csection.getKeys(false)) {
            ConfigurationSection section = csection.getConfigurationSection(string);
            section.set("id", id);
            List<String> lore = new ArrayList<>();
            for (int i = 0; i < section.getStringList("lore").size(); i++) {
                lore.add(ChatColor.translateAlternateColorCodes('&',
                        section.getStringList("lore").get(i)));
            }
            petManager.add(new PetManager(
                    section.getString("skin"), section.getString("name"),
                    id, lore));
            id++;```
#

Like that?

lost matrix
#

Before the for loop

acoustic pendant
lost matrix
acoustic pendant
lost matrix
acoustic pendant
#

petManager is a list

#

and i'm adding values

lost matrix
#

Ok one sec...

acoustic pendant
#

but when i try to access the last value of that list, it says i'm out of bounds

inner mulch
#

then the list is probably empty or not full enough

acoustic pendant
#

is not empty, I can still get the other values

nimble blade
#

Hi there, I installed skript and tuske but tuske doesn't work and when I do /pl is tuske in red what do I do?

icy beacon
lost matrix
# acoustic pendant is not empty, I can still get the other values
        int id = 1;
        ConfigurationSection petRootSection = pets.getConfig().getConfigurationSection("Pets");
        Set<Key> petKeys = petRootSection.getKeys(false);
        for (String petKey : petKeys) {
            ConfigurationSection petSection = csection.getConfigurationSection(petKey);

            petSection.set("id", id);
            List<String> lore = new ArrayList<>();
            List<String> configLore = section.getStringList("lore");

            for (int i = 0; i < configLore.size(); i++) {
                String configLoreLine = configLore.get(i);
                String translatedLoreLine = ChatColor.translateAlternateColorCodes('&', configLoreLine);
                lore.add(translatedLoreLine);
            }

            String petSkin = section.getString("skin");
            String petName = section.getString("name");
            PetManager createdPetManager = new PetManager(petSkin, petName, id, lore);
            petManager.add(createdPetManager);
            id++;

Here is the refactored code of yours

acoustic pendant
#

oh

#

well, probably my code is not really optimized ๐Ÿ˜…

nimble blade
#

Okay

acoustic pendant
#

but, do you know what is causing the error out of bounds?

lost matrix
acoustic pendant
#

sure, sorry

lost matrix
#

All good

acoustic pendant
#

?paste

undone axleBOT
acoustic pendant
#

the code is still without context 1s xd

#

(is a loop)

#

think that's all what is relevant, actualPet is working fine

lost matrix
acoustic pendant
#

yea

lost matrix
acoustic pendant
valid burrow
#

why would you have a list of manager classes

lost matrix
#

Your -1 is at the wrong place

valid burrow
#

doesnt that kinda defeat the purpose of a manager class

acoustic pendant
lost matrix
acoustic pendant
lost matrix
acoustic pendant
#

ok, let me check

lost matrix
#

But thats really more of a gut feeling solution because this system is a bit messy

acoustic pendant
#

I know, i messed a lot here

wanton comet
#

Hey, I am trying to build the 1.15.2 version with buildtools but I get this error

Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.ssl.Alerts.getSSLException(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
    at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
    at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
    at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source)
    at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
    at sun.security.ssl.Handshaker.processLoop(Unknown Source)
    at sun.security.ssl.Handshaker.process_record(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.followRedirect0(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.followRedirect(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
    at java.net.URL.openStream(Unknown Source)
    at com.google.common.io.Resources$UrlByteSource.openStream(Resources.java:70)
    at com.google.common.io.ByteSource.read(ByteSource.java:296)
    at com.google.common.io.Resources.toByteArray(Resources.java:96)
    at org.spigotmc.builder.Builder.download(Builder.java:1152)
    at org.spigotmc.builder.Builder.startBuilder(Builder.java:207)
    at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:60)
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.validator.PKIXValidator.doBuild(Unknown Source)
    at sun.security.validator.PKIXValidator.engineValidate(Unknown Source)
    at sun.security.validator.Validator.validate(Unknown Source)
    at sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source)
    at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source)
    at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)
    ... 22 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.provider.certpath.SunCertPathBuilder.build(Unknown Source)
    at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source)
    at java.security.cert.CertPathBuilder.build(Unknown Source)
    ... 28 more
chrome beacon
#

Looks like a missing cert?

acoustic pendant
#

tysm

chrome beacon
#

Make sure you're using a recent Java 8 version and not an ancient one

icy beacon
#

No, cause this is a 3.1k line project,

#

Apparently with 2 minecraft instances, a server and a bungee proxy running at the same time, this compiles 6 times slower than usual

young knoll
#

Who would have guessed

icy beacon
#

Well to be fair the instances and server are 1.8

#

They should be consuming like 3 kb memory total

#

But I should really upgrade from 16GB and probably a stronger cpu

tribal cypress
#

Hey, I'm trying to learn how to work with HikariCP, but I whenever I compile my plugin it throws this error:

'dependencies.dependency.version' for com.zaxxer:HikariCP:jar is either LATEST or RELEASE (both of them are being deprecated) @ line 78, column 22
It is highly recommended to fix these problems because they threaten the stability of your build.
For this reason, future Maven versions might no longer support building such malformed projects.

My dependencies in pom.xml

 <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.18.2-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
            <version>LATEST</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
icy beacon
#

compile time ๐Ÿ’€

chrome beacon
#

Don't use latest

#

use the version you want

tribal cypress
#

Thanks

obsidian plinth
#

if (cpu == 100%)
{cpu = 10}

#

fixxed

icy beacon
#

That'd probably make my compile time plunge even lower

chrome beacon
#

What CPU are you using?

icy beacon
#

AMD Ryzen 5 1600 Six-Core Processor according to task manager

#

I don't exactly have a say over my pc components because I don't have, well uh, money

#

My dad bought this a while ago and said that this is the farthest this motherboard can go

#

So upon upgrading the cpu, the motherboard also should be upgraded

#

So, not soon

river oracle
#

U use gradle or maven?

#

If ur using maven use the cache extension

icy beacon
#

Maven, but kotlin, this project is kinda old (from when i didn't understand shit about gradle) so I have been thinking of switching

chrome beacon
icy beacon
chrome beacon
#

You don't need to replace the motherboard

icy beacon
#

Well my dad could be wrong. I have no clue what mb I'm running

#

This is hearsay

chrome beacon
#

Just update the bios and you should be able to use any AM4 CPU

icy beacon
#

That is one scary step

chrome beacon
#

My motherboard refused to detect my 5600X because the bios was outdated

#

Thankfully it had a no CPU flash button

icy beacon
#

I'm running A320M PRO-E (MS-7A36) by Micro-Star International Co. Ltd. with American Megatrends Inc.'s H.00 - AMD AGESA PinnaclePI-AM4 1.0.0.6 dating back to December 2018

#

So it might be upgradable idrkkkk

chrome beacon
icy beacon
#

Oh wait he might've said it about the last cpu we had

chrome beacon
#

Yeah just update the bios and you'll be fine

icy beacon
#

What CPU would you recommend

chrome beacon
#

I have an 5600G which is more than enough for me

#

since AM4 is last gen you could probably find something good used

#

5600X or 5800X3D are two popular choices

icy beacon
#

Yeah it'd be cool to upgrade

#

Oh btw Olivo

#

Do you by chance have like 500$ just lying around?

chrome beacon
#

๐Ÿ‘€

#

What are you going to buy with that

#

The 5800X3D is not that expensive

icy beacon
#

The CPU and some snacks perhaps

#

Snacks are

chrome beacon
#

Bros about to spend 200$ on snacks

icy beacon
#

You got a problem with that? xD

#

That's a day worth of gum if even

#

I'm pretty sure my intellij is leaking memory somewhere

#

That pesky minecraft development plugin probably

chrome beacon
#

probably

icy beacon
#

Yeah I removed it and restarted and my compilations got 2.5x faster

gentle nexus
#

[22:08:45 ERROR]: [DirectoryProviderSource] Error loading plugin: Restricted name, cannot use 0x20 (space character) in a plugin name
im getting this error
but plugin name doesnt have any space

young knoll
#

Send plugin.yml

gentle nexus
#

oh

#

thats where the space is

grave laurel
#

Hey, is it possible to give a player an item from a mod? Like Coins from a mod?

young knoll
#

Spigot doesn't support mods

#

Nor do we provide support for any weird hybrid fork you are using, ask them

grave laurel
#

yeah I am using mohist (to use Mods and Spigot). Although you don't provide support using a hybrid, could you give me some inspiration of how I could make this possible?

eternal night
#

entirely up to how mohist implements this in their API

#

spigot does not support it one bit so like, yea

#

no one is going to be able to tell you how unless they know mohist

icy beacon
#

i saw something ๐Ÿ‘€

eternal night
#

do they not have a support discord?

#

you did not kirbygun

icy beacon
#

i did not

remote swallow
#

did i see something?

eternal night
#

good job PETTHEPEEPO

grave laurel
#

alright, thanks

icy beacon
#

see what?

young knoll
#

I did see something

eternal night
#

hide in the basement coll

remote swallow
#

guess not

icy beacon
remote swallow
eternal night
remote swallow
#

go take his pc

valid burrow
#

ill tell md about this erm

eternal night
hollow reef
#

what is the official way to convert a CompoundTag to string?

shadow night
#

what

remote swallow
valid burrow
#

weird

hollow reef
shadow night
hollow reef
#

hm something to store it in a file / database

shadow night
#

It's binary

hollow reef
#

can still be a string, cant it?

#

or maybe byte array or smh

lost matrix
chrome beacon
#

ig

lost matrix
#

Ah i guess you found the ChunkSerializer class which serializes chunks to nbt compounds.

#

And you now have the great idea of throwing that into an SQL DB

hollow reef
lost matrix
young knoll
#

Generally bytes is better for storage

#

Unless you need it to be readable

lost matrix
#

True, in a DB you probably want this as a blob and not a Varchar

icy beacon
young knoll
#

This is what I use for to/from a byte[]

#
    public byte[] toBytes(CompoundTag compound) {
        java.io.ByteArrayOutputStream outputStream = new java.io.ByteArrayOutputStream();
        try {
            net.minecraft.nbt.NbtIo.writeCompressed(compound, outputStream);
        } catch (IOException ex) {
            throw new NMSException("Failed to save NBT as bytes", ex);
        }
        return outputStream.toByteArray();
    }

    public CompoundTag fromBytes(byte[] data) {
        CompoundTag compound;
        try {
            compound = net.minecraft.nbt.NbtIo.readCompressed(new java.io.ByteArrayInputStream(data), NbtAccounter.unlimitedHeap());
        } catch (IOException ex) {
            throw new NMSException("Failed to read NBT from bytes", ex);
        }
        return compound;
    }
rare rover
#

what is a .nbt file compressed to? It ain't GZip

young knoll
#

It is

rare rover
gentle nexus
#

when i package
why does 2 plugins get created in target folder
one is original plugin name and the other is just plugin name

rare rover
#

well wtf

young knoll
#

They may not be compressed tho

#

NBT can be both

rare rover
#

it is

gentle nexus
rare rover
shadow night
#

NBT is usually gzip compressed afaik

lost matrix
rare rover
#

oh wait

#

๐Ÿคฆโ€โ™‚๏ธ

#

it wont read it doe

young knoll
#

Gzip old smh

#

I am totally a genius for coming up with the idea to use Zstd

#

Did not steal it from hypixel, nope

rare rover
#

WAIT

#

im actually so dumb ๐Ÿ’€

#

it wasn't compressed

#

bruh

young knoll
#

What are you doing to that poor packet

rare rover
#

making my own protocol, im currently stuck on stupid configuration

#

ik it ain't spigot related but y'all smart and reply fast ๐Ÿ™‚

young knoll
#

Glowstone2

rare rover
#

fr

#

๐Ÿ˜„

#

i actually got way farther than i thought which is why im continuing with this

icy beacon
#

Damn, nice

remote swallow
shadow night
#

Lmao

young knoll
#

Uhh

#

August 2016

#

Wtf it just updated today

#

Ree

icy beacon
#

Programming is so fucking ass, like why can't I write code once and not refactor it 6 months later because I "changed my code style" or "thought of a way to write this in a prettier way"

sterile token
lost matrix
#

Since when... is verano back

#

Im gonna go for a run

icy beacon
sterile token
icy beacon
#

Yes but like

icy beacon
alpine urchin
#

chatgpt could help

icy beacon
sterile token
# icy beacon Yes but like

besides what i have said, i agree with you. We all are continuesly changing the code we have done and works pretty okay, because we humans love to being perfect

icy beacon
#

Let's all slowly develop a light form of OCD

#

For we must write perfect code and perfect code only

#

No room for imperfections

alpine urchin
#

edits message

sand spire
icy beacon
#

LMAO

obsidian plinth
#

Google it

#

i found a good one like that

#

no github

#

Google like
son item stack serializer and serializer github

#

not the one i use

tardy delta
#

looks like your type adapter is shit

remote swallow
tardy delta
#

Option.Some<Either<BaseComponent, String>> for fucks sake

lilac dagger
remote swallow
#

ask @river oracle

eternal night
#

make EVERYTHING final

rough ibex
#

no mutate at all

remote swallow
eternal night
#

me in java

remote swallow
#

for some reason i hate seeing final before method variables in java but have nothing against val in kotlin

#

brains are weird

rough ibex
#

yeah because its one or the other

#

And you cant use val var everywhere

#

Like in parameters

molten hearth
#

if a project is using the MIT license and i upload a built jar of it to github am i good since the jar includes the license in meta-inf or do i need to do extra steps

rough ibex
#

Kotlin has canonical forms

rough ibex
#

You are fine

molten hearth
#

alrighty thank u

river oracle
#

Clarity

trim lake
#

I can some how get deffault item name? Like that one if item is not renamed I want to add something before that name. I tried creating new ItemStack but if I get empty name.

chrome beacon
#

The name that an item has is controlled by the resource pack loaded

#

You can use translatable components to solve this but Spigot doesn't provide an easy way to do so

trim lake
#

hmm, thats unfortunate

dawn flower
#

what's the formula for speed potion's speed? i found this ((amplifier * 0.1) + 1) * 100 but i'm not sure how percise it is

chrome beacon
#

The Minecraft wiki probably has it

dawn flower
#

yeah it does, thanks

quaint mantle
#
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Scoreboard;
import pl.playgroundhc.lobby.Lobby;

public class create_sb implements Listener {
    @EventHandler
    public void sb_create(PlayerJoinEvent e){
        Player p = e.getPlayer();
        new BukkitRunnable() {
            @Override
            public void run() {
                Scoreboard sb = Bukkit.getScoreboardManager().getNewScoreboard();
                Objective obj = sb.registerNewObjective(ChatColor.GREEN  + "๐Ÿ…›๐Ÿ…ž๐Ÿ…‘๐Ÿ…‘๐Ÿ…จ","dummy");
                obj.getScore(ChatColor.AQUA + ":pencil2: Nick: " +ChatColor.GRAY+ p.getDisplayName()).setScore(5);
                obj.getScore(ChatColor.WHITE + "Gracze ma lobby: " + ChatColor.GRAY + Bukkit.getOnlinePlayers().size()).setScore(4);
                obj.getScore("Tryby gry:").setScore(3);
                obj.getScore("- " + ChatColor.RED + ":heartpulse: KillSMP").setScore(2);
                obj.getScore("- " + ChatColor.GREEN + ":pick: Survival").setScore(1);
                obj.getScore("PlaygroundHC.PL").setScore(0);
                p.setScoreboard(sb);
                p.setPlayerListHeaderFooter("Lobby",ChatColor.WHITE +"\n  ip โ— ip  ");
            }
        }.runTaskTimer(Lobby.getInstance(), 0,20);
    }
}
```why doesn't it work ?
dawn flower
#

?doesntwork

valid burrow
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

dawn flower
#

did they make Does not working have grammar mistakes on purpose

young knoll
#

yes

dawn flower
#

also registering a new bukkit runnable for every player that joins is pointless and will cause issues when the player leaves, just loop all players every 20 ticks and do whatever

young knoll
#

Not to mention

#

You are making an entire new scoreboard every second

dawn flower
#

oh yeah that'll also cause lag, just edit the objectives you want to change

proud badge
#

Is taking stuff from an event object (like event.getBlock()) safe in async?

dawn flower
#

save it to a variable first

#
// async stuff here```
#

actually u prob dont have to, it's safe either way since the event object never changes

chrome beacon
#

You shouldn't use Block async

trim lake
#

Can I some how use TranslatableComponent in item name and let MC translate that? ๐Ÿค” I tired this and its not translating that text:

TranslatableComponent translate = new TranslatableComponent(item.getTranslationKey());
        ItemMeta meta = item.getItemMeta();
        meta.setDisplayName("test " + translate.getTranslate());
        item.setItemMeta(meta);
chrome beacon
#

Components aren't Strings

remote swallow
#

you have to send it as a component

chrome beacon
#

Spigot doesn't expose a setter for component item names

dawn flower
#

you can do that with plugins?

chrome beacon
#

Paper does though

remote swallow
remote swallow
trim lake
remote swallow
#

needs nms for spigot

trim lake
#

I want to avoid that but well... looks like Its not possible, thanks guys

remote swallow
#

@young knoll can you wait for ItemMeta.Spigot#setDisplayName()

young knoll
#

Uhh aktually

remote swallow
#

yes i know its gonna be components

young knoll
#

ItemMeta.Components#setDisplayName()

remote swallow
#

shut up

#

im surprised you havent ever timed me out yet

young knoll
#

Not my server

remote swallow
#

you still can time me out and tell others i was being rude or smth

surreal wind
#

guys im trying to figure out how to make a minigame but im stuck on the part where i switch worlds, do you guys have any tutorials on this? or some documentation

slender elbow
#

wdym by "stuck on the part where I switch worlds"?

#

does the player switch worlds by themselves? does the plugin do that?

surreal wind
#

i dont have any good idea of how im going to switch from my lobby to the minigame world

remote swallow
#

teleport them

young knoll
#

Just teleport the player?

surreal wind
#

is that how bedwars works?

remote swallow
#

yeah

surreal wind
#

oh ty

young knoll
#

I mean, not hypixels, but that's beside the point

surreal wind
#

so basically i should be good just teleporting the players right?

#

besides the fact that the tab screen will still show them

young knoll
#

yes

surreal wind
#

alright thanks for the help

minor junco
#

Different servers

surreal wind
#

sorry, but im new to plugin development

young knoll
#

It's a proxy

#

System to connect multiple servers together

#

But you can just hide players from other players, even just using the api

surreal wind
#

interesting

native nexus
#

player.updateInventory(); is marked as unstable. what do I do instead?

vital ridge
#

I'm running buildtools for mojang mappings, but for some reason the correct jar does not generate in my spigot maven repository folder.

java -jar BuildTools.jar --rev 1.8.8 --remapped

This is what I'm running. I tried to use the remapped jar file I found in my buildtools folder under Spigot-Server/target, which was named spigot-1.8.8-remapped, but when I used it in my intellij projects all the classes and names seemed to be like regular spigot has.

vital ridge
#

Oh frl?

#

Damn

young knoll
#

Remapped is 1.17+

young knoll
native nexus
#

I just want to update the inventory when I do inventory.setitem()?

young knoll
#

You shouldn't have to

#

The api will handle that

sleek estuary
#

on ItemStawnEvent how do i check if is not a player that dropped the item?

chrome beacon
#

Listen for the PlayerDropItemEvent and mark all items that players drop

#

Then in the spawn event check if it's marked

nocturne gale
#

Hello, does anyone have experience with oraxen?

rough ibex
#

ask the oraxen discord

#

I am ssure they know more about their own plugin than we do

worldly ingot
nocturne gale
rough ibex
#

You bought it, yes?

#

or did you compile

#

You are allowed to use it without paying

#

but if you do, there is no help

nocturne gale
#

I have it delivered by a friend who has been buying the plugin for a long time, but I need help with the settings regarding tabu and scoreboard and I don't know where to write, because I am no longer in contact with that friend

rare rover
#

does this error indicate that i'm sending an invalid NBT?

rough ibex
#

Likely

rough ibex
#

or simply let you use it

#

I'm assuming the latter

#

in which case you unfortunately don't have the ability to ask for help officially.

rare rover
#

weird

#

it looks fine doe

#

not all of the NBT but

remote swallow
#

to me it looks like your keys arent wrapped in quotes

nocturne gale
rare rover
remote swallow
#

iirc yeah

rough ibex
#

you're on your own

#

good luck

rare rover
#

that also is showing the error ๐Ÿ˜ญ

remote swallow
#

what are you even doing with that much nbt

rare rover
#

registry data

#

i'm just not sure why its throwing that error

#

been stuck on this for like 2 days

remote swallow
#

is it a custom registry or a mojank registry

rare rover
remote swallow
#

it it inside net.minecraft

rare rover
#

well the problem with that is, this isn't dependent on mojang at all

#

so, no

remote swallow
#

im guessing there some other malformation in it then

rare rover
#

yeah

#

the nbt is legit like 23KB long so its hard

#

could be my nbt serializer too

remote swallow
#

chuck it in a json parser or smth

rare rover
#

cuz im reading from a .nbt file

young knoll
#

Client log might have more info

rare rover
#

let me check

tardy delta
#

why does every folder has a different icon

rare rover
#

no just gives me a 1 line erro

#

๐Ÿ˜ญ

#

could be modrinth though

young knoll
#

Go find that class and see what it does

#

Kek

rare rover
#

let me open a nms project rq

#

wish it would give me the actual exception

#

with more info

young knoll
#

Oof itโ€™s just the exception class

#

F

rare rover
#

hmmm

#

maybe that

#

๐Ÿค”

#

seems to be something here ig

#

oh wait ๐Ÿค”

#

its sending it twice

#

still saying Unknown base tag

#

hmm

rough ibex
#

Format to json and pretty print

rare rover
#

how would i do that?

native nexus
rough ibex
rare rover
#

yeah i found one already

#

ty

rare rover
dusk cobalt
#

Description: Initializing game
[22:53:17] [Thread-3/INFO]:
[22:53:17] [Thread-3/INFO]: java.lang.RuntimeException: Could not execute entrypoint stage 'client' due to errors, provided by 'auto-miner'!
....
at de.rainix.autominer.client.AutoMinerClient.onInitializeClient(AutoMinerClient.java:24)
[22:53:17] [Thread-3/INFO]: at net.fabricmc.loader.impl.entrypoint.EntrypointUtils.invoke0(EntrypointUtils.java:47)
[22:53:17] [Thread-3/INFO]: ... 7 more
[22:53:17] [Thread-3/INFO]: Caused by: java.lang.ClassNotFoundException: net.minecraft.util.math.Vec3i

line 24: import java.util.Random;

anyone any clue why this occurs and how to fix it?

remote swallow
#

?whereami

rough ibex
#

Fabric oh my

slender elbow
#

sounds like you need to remap your jar

worldly ingot
#

"auto miner" PES3_HmmCoffee

hollow reef
#

hello, I'm currently trying to send the minecraft chunks from my java server to a bedrock server, so I can enjoy vanilla worlds in bedrock. Problem is, the serialization of the chunk takes ~30ms which is a lot...what can I do to serialize it faster? the problem is, I don't understand how the bit storage of the chunks selects longs (e.g SimpleBitStorage / PalettedContainer in nms) - so I cant decode it in bedrock

#

any simple and fast chunk compressions?

young knoll
#

Isnโ€™t there programs for this

#

And if you just want to join a java server on bedrock

#

Use geyser

hollow reef
hollow reef
rough ibex
#

You can write your own serializer

#

but I'm really sure what you would optimize

#

This may just be unavoidable overhead.

#

you can't just press a switch and make it go faster, you have to make some sort of fast change

quaint mantle
#

does anyone know why this doesn't work??

@EventHandler public void onEntityDamage(EntityDamageEvent event) { System.out.println("Hiii"); LivingEntity ent = (LivingEntity) event; System.out.println(ent.getHealth()); event.setCancelled(true); }

#

i'll send the full code if i need to

#

the event outright doesn't fire i think

drowsy helm
#

send the whole thing

quaint mantle
#

like there's nothing in the console when i hit something

drowsy helm
#

that snippet tells us nothing

#

is it registered?

tall dragon
#

did you register the event

quaint mantle
#

OH that'll be it oml ty

young knoll
#

You are trying to cast the event to an entity

quaint mantle
#

Ohh yeah that aswell

#

i was so focused on why it wouldn;'t work in the first place i didn't notice ๐Ÿ˜ญ

hollow reef
# rough ibex you can't just press a switch and make it go faster, you have to make some sort ...

yeah the problem is, minecraft's chunk serialization takes <1ms, mine more than 30x...
this is my current code, if you have any ideas

for (int x = 0; x < 16; x++) {
    for (int z = 0; z < 16; z++) {
        int maxY = snapshot.getHighestBlockYAt(x, z);
        stateStream.putInt(maxY);
        for (int y = minY; y <= maxY; y++) {
            BlockData blockData = snapshot.getBlockData(x, y, z);
            String data = blockData.getAsString().replace(" ", "");
            int id1;
            if (!blockStates.contains(data)) {
                id1 = blockStates.size();
                blockStates.add(data);
            } else {
                id1 = blockStates.indexOf(data);
            }
            stateStream.putInt(id1);

            Biome biome = snapshot.getBiome(x, y, z);
            int id2;
            if (!biomes.contains(biome)) {
                id2 = biomes.size();
                biomes.add(biome);
            } else {
                id2 = biomes.indexOf(biome);
            }
            stateStream.putByte((byte) id2);
        }
    }
}
rough ibex
#

profiling

storm crystal
#

Any tutorials on oop attitude in programming

#

I forgot a lot of it

rough ibex
#

I'm not gonna look at this really without a profiler first

rough ibex
hollow reef
#

or any good projects?

young knoll
#

Doesnโ€™t minecraft just serialize the palette container directly

echo basalt
#

It does

hollow reef
young knoll
#

It compresses the values into a certain number of bits

hollow reef
#

Oh yeah that doesnt look too bad, thank you

junior anvil
#

how do i set and get an entity's movement speed?
i want to briefly stop an enitity's movement, i dont know if there's another way to do it

strong parcel
#

Hey, I am having a strange issue with this function. https://paste.md-5.net/anebuxasoj.cs Basically, I am iterating through a list of inventories trying to remove a specific amount of items with certain material types. Right now, it is skipping over the materials it is supposed to be removing, saying that the material stored in the hashmap is not equal to the item's type. [00:11:05 INFO]: [TWClaim] [STDOUT] Paying Cost [00:11:05 INFO]: [TWClaim] [STDOUT] Getting relevant inventories [00:11:05 INFO]: [TWClaim] [STDOUT] Material: DIAMOND [00:11:05 INFO]: [TWClaim] [STDOUT] Inventory: [Lorg.bukkit.inventory.ItemStack;@12cc702e [00:11:05 INFO]: DIAMOND [00:11:05 INFO]: [TWClaim] [STDOUT] DIAMOND Does not equals DIAMOND ...continuing

#

The Material from the HashMap was gotten by converting the Material of an item to a string and then back into a Material later in the program with Material.getMaterial(). I feel like that should not be causing the issue though.

#

XD

kind hatch
#

Pretty sure enums are meant to be compared with == and not .equals()

strong parcel
#

I think I figured it out LMAO

#

I didn't put an !

#

so it skipped if it did match

#

instead of skipping if it didn't match

lost matrix
plucky rock
#
    @EventHandler
    public void onMoveEmeraldBlock(PlayerMoveEvent e) throws IOException {

        Player player = e.getPlayer();
        int x = player.getLocation().getBlockX();
        int y = player.getLocation().getBlockY();
        int z = player.getLocation().getBlockZ();

        Material block = player.getWorld().getBlockAt(x, (y - 1), z).getType();




        if (block == Material.EMERALD_BLOCK) {
            player.getWorld().getBlockAt(x, (y-1), z).setType(Material.EMERALD_ORE);
            NamespacedKey key = new NamespacedKey("minecraft", "test");
            StructureManager manager = Bukkit.getStructureManager();
            File file = manager.getStructureFile(key);
            Structure struct = manager.loadStructure(file);
            Location LocP = player.getLocation().subtract(new Vector(0,1,0));
            player.sendMessage(ChatColor.GREEN + LocP.toString());
            Vector Vec = struct.getSize();
            player.sendMessage(ChatColor.AQUA + Vec.toString());
            double VecX  = Vec.getX();
            double VecZ  = Vec.getZ();
            Vec.setX(1.0);
            Vec.setZ(VecZ / -2.0);
            Vec.setY(0.0);
            player.sendMessage(ChatColor.LIGHT_PURPLE + Vec.toString());
            LocP.add(Vec);


            player.sendMessage(LocP.toString());
            struct.place(LocP, true, NONE, Mirror.NONE, 0, 1, new Random());

        }




    }

this works but i want to get the center of the structure (which works but when I walk on the left edge of the block it doesn't center any1 know why)

#

how can i post a video to show the issue

#

since its hard to explaion

#

im makig a yt vid give it a few min to upload

#

here is the vid

lost matrix
# plucky rock ```java @EventHandler public void onMoveEmeraldBlock(PlayerMoveEvent e) ...
        Material block = player.getWorld().getBlockAt(x, (y - 1), z).getType();

        if (block == Material.EMERALD_BLOCK) {
            player.getWorld().getBlockAt(x, (y-1), z).setType(Material.EMERALD_ORE);

Should be

        Block block = player.getWorld().getBlockAt(0, -1, 0);
        Material material = block.getType();

        if (material == Material.EMERALD_BLOCK) {
            block.setType(Material.EMERALD_ORE);

But that makes little sense. Your logic here is:
"If the block is of type EMERALD_BLOCK, then set the blocks type to EMERALD_BLOCK"

#

But let me read the rest

plucky rock
#

ty

gentle nexus
#

ok so i have
for (int i = 0;i<9;i++){ meta.setDisplayName("item "+i); item.setItemMeta(meta); itemarray[i]=item; }
when i add all item in the array to an inventory
all of them have item 8 as the name for some reason

lost matrix
# plucky rock ty

One moment ill finding something out about the random that is passed

plucky rock
silver apex
lost matrix
# plucky rock dw take your time ur the one voulenterring to help me

You are creating a lot of variables which are fairly similar to each other.
I've extracted placing the structure into its own method.

  @EventHandler
  public void onMoveEmeraldBlock(PlayerMoveEvent event) throws IOException {
    Player player = event.getPlayer();
    Location playerLocation = player.getLocation();
    Block blockBelow = playerLocation.getBlock().getRelative(0, -1, 0);
    Material material = block.getType();

    if (material == Material.EMERALD_BLOCK) {
      placeStructure(blockBelow.getLocation());
    }
  }

  private void placeStructure(Location location) throws IOException {
    NamespacedKey key = new NamespacedKey("minecraft", "test");
    StructureManager manager = Bukkit.getStructureManager();
    File file = manager.getStructureFile(key);
    Structure struct = manager.loadStructure(file);

    Vector structSize = struct.getSize();
    Vector structCenter = structSize.clone().multiply(0.5);
    structureCenter.setY(0);

    Location placeLocation = location.add(structCenter);

    struct.place(placeLocation, true, StructureRotation.NONE, Mirror.NONE, 0, 1, new Random());
  }

If this doesnt work then the offset for the Players Block is important.

lost matrix
gentle nexus
#

this is the full methord btw

lost matrix
gentle nexus
#

wdym ?

#

itemarray is an array of itemstacks btw

lost matrix
#

You can take what i said in a literal sense

#

Tell me what you need help with

gentle nexus
#

so making an array wont work?

lost matrix
#

No it works perfectly fine

acoustic shuttle
#

so I just started learning today and I followed a tutorial but I don't think this is working its 1.19.3 paper server
using gradle
getServer().getPluginManager().registerEvents((Listener) new MenuListener(), this);

[02:10:48 INFO]: XxAwesqmexX issued server command: /manage XxAwesqmexX
[02:10:48 ERROR]: null
org.bukkit.command.CommandException: Cannot execute command 'manage' in plugin learning_1 v1.0-SNAPSHOT - plugin is disabled.
how do I 'enable' the plugin

plucky rock
#

thanks for the tips btw

lost matrix
# gentle nexus so making an array wont work?

You should create a new ItemStack for each index of your array.
If you just create one ItemStack, and place the same ItemStack in every slot, then you will end up
with the same ItemStack in every slot.

Im not sure how to formulate this any clearer.

lost matrix
acoustic shuttle
#

okay I'll try it ty :)

gentle nexus
lost matrix
acoustic shuttle
# lost matrix You cant randomly cast objects to what you want them to be. Fixing this is quite...

okay it worked but now it's sending this in console

[02:22:30 INFO]: XxAwesqmexX issued server command: /manage XxAwesqmexX
[02:22:30 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'manage' in plugin learning_1 v1.0-SNAPSHOT
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_19_R2.CraftServer.dispatchCommand(CraftServer.java:911) ~[paper-1.19.3.jar:git-Paper-448]
        at org.bukkit.craftbukkit.v1_19_R2.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64) ~[paper-1.19.3.jar:git-Paper-448]
        at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:264) ~[paper-1.19.3.jar:?]
        at net.minecraft.commands.Commands.performCommand(Commands.java:316) ~[?:?]
        at net.minecraft.commands.Commands.performCommand(Commands.java:300) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.performChatCommand(ServerGamePacketListenerImpl.java:2288) ~[?:?]
lost matrix
#

"caused by" is the important part

acoustic shuttle
#

how it says 23 more also it's too big for discord

#

well i can send multiple but

#

... 23 more

lost matrix
# acoustic shuttle how it says 23 more also it's too big for discord

I mean its a NullpointerException. You should learn to debug them as they are the most common exceptions for newer devs.
You have a variable that contains a null value. And if you then try to call a .method() on this, you get a null pointer exception
because null obviously doesnt have any methods to call.

acoustic shuttle
#

okay
here is where the null is
Inventory inventory = Bukkit.createInventory(null, 53, ChatColor.RED + "Manage Player");

blazing ocean
#

wait i hope this isnt paper-only

#

?jd-s

undone axleBOT
acoustic shuttle
blazing ocean
#

nvm, im a bit stupid rn, try createInventory(player, 53, "")

acoustic shuttle
#

okay

blazing ocean
acoustic shuttle
#

same thing xd

blazing ocean
#

send the full stacktrace

#

?paste

undone axleBOT
acoustic shuttle
#
[03:05:03 INFO]: XxAwesqmexX issued server command: /manage XxAwesqmexX
[03:05:03 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'manage' in plugin learning_1 v1.0-SNAPSHOT
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_19_R2.CraftServer.dispatchCommand(CraftServer.java:911) ~[paper-1.19.3.jar:git-Paper-448]
        at org.bukkit.craftbukkit.v1_19_R2.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64) ~[paper-1.19.3.jar:git-Paper-448]
        at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:264) ~[paper-1.19.3.jar:?]
        at net.minecraft.commands.Commands.performCommand(Commands.java:316) ~[?:?]
        at net.minecraft.commands.Commands.performCommand(Commands.java:300) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.performChatCommand(ServerGamePacketListenerImpl.java:2288) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$20(ServerGamePacketListenerImpl.java:2248) ~[?:?]
        at net.minecraft.util.thread.BlockableEventLoop.lambda$submitAsync$0(BlockableEventLoop.java:59) ~[?:?]
        at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
        at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.19.3.jar:git-Paper-448]
        at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
        at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
#
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1341) ~[paper-1.19.3.jar:git-Paper-448]
        at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:197) ~[paper-1.19.3.jar:git-Paper-448]
        at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
        at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1318) ~[paper-1.19.3.jar:git-Paper-448]
        at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1311) ~[paper-1.19.3.jar:git-Paper-448]
        at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
        at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1289) ~[paper-1.19.3.jar:git-Paper-448]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1177) ~[paper-1.19.3.jar:git-Paper-448]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[paper-1.19.3.jar:git-Paper-448]
        at java.lang.Thread.run(Thread.java:842) ~[?:?]
Caused by: java.lang.IllegalArgumentException: Size for custom inventory must be a multiple of 9 between 9 and 54 slots (got 53)
        at org.apache.commons.lang.Validate.isTrue(Validate.java:136) ~[commons-lang-2.6.jar:2.6]
        at org.bukkit.craftbukkit.v1_19_R2.CraftServer.createInventory(CraftServer.java:2117) ~[paper-1.19.3.jar:git-Paper-448]
        at org.bukkit.Bukkit.createInventory(Bukkit.java:1629) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at dev.xxawesqmexx.learning_1.guis.ManageMenu.<init>(ManageMenu.java:20) ~[learning_1-1.0-SNAPSHOT.jar:?]
        at dev.xxawesqmexx.learning_1.commands.ManageCommand.onCommand(ManageCommand.java:34) ~[learning_1-1.0-SNAPSHOT.jar:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        ... 23 more```
blazing ocean
#

read the error

#

has to be 53 slots

acoustic shuttle
#

ohh,,,,,,,,,,,,,,,,,,,,,

#

im so slow

#

it's really hard to read when it's console

#

i should uh

#

paste it out first

#

that will probably fix it tysm lol

#

yeah it worked tysm xD

#

how would I set all the slots to gray stained glass pane like efficiently ?

blazing ocean
#

iterate over the empty slots

#

so filter the items by if its air

upper hazel
#

how can i speed up workLoad for chunk removal so that it removes a chunk in 1 tick for example 3 chunks

#

bc this very slow

#

I tried to give more time per tick, but it's still slow.

#

i think i need change condation

#

but idk

lost matrix
#

What do you mean by chunk removal?

upper hazel
#

"delete chunk"

#

but this slow

#

i need do this for example in 3 seconds.

#

or 2

acoustic shuttle
#

player.sendMessage(ChatColor.RED + "Healed %target%");
how would I use the variable target in the text cuz %target% doesn't work

lost matrix
# acoustic shuttle ```player.sendMessage(ChatColor.RED + "Healed %target%");``` how would I use the...

What you are trying to do is called String interpolation. Its currently not supported by java and is only introduced in releases from java 21 onwards.
You have basically three options:

  1. String concatenation:
String message = ChatColor.RED + "Healed " + target + " for " + amount;
  1. String formatting: (This is also used in many other programming languages)
String message = "%s Healed %s for %s".format(ChatColor.RED, target, amount);
  1. Token replacement
String message = "[color] Healed #target# for *amount*";
String replaced = message.replace("[color]", ChatColor.RED).replace("#target#", target).replace("*amount*", amount);

Keep in mind that Strings in java are immutable.
This means if you create a String once, then changing it will always result in a completely new String object.

acoustic shuttle
#

okay ty what is %s?

agile anvil
#

It will be changed during the .format

lost matrix
acoustic shuttle
#

ohhh I see okay thank you

#

both

#

also what websites should I use for just basic information to look around the only 'coding' ive done b4 this is skript so I don't really now much about java

lost matrix
#

The most important ones are:
%s -> Strings
%d -> Integer
%f -> Floats/Doubles

%.2f for example will result in 0.01344 being replaced as "0.01"

lost matrix
lost matrix
acoustic shuttle
#

okay ty everyone for all the help

fallen lily
slate surge
#

HOW TO SAVE A CONFIG FILE IN BUNGEE API?

smoky anchor
#

First step: calm down, stop yelling

slate surge
#

first step done

#

๐Ÿ’ฏ

#

@smoky anchor help

ivory sleet
#

ConfigurationProvider iirc

smoky anchor
ivory sleet
#

like obv u load up the right implementation

slate surge
#

step three?

gentle nexus
#

whats the difference between getclickedinventory and getinventory

ivory sleet
#

getClickedInventory returns the clicked inventory

#

which can be null

gentle nexus
#

whats the difference between top inv and clicked inv?

#

is it the same thing if an item has been clicked ?

ivory sleet
#

Like the inv where the click happens is the clicked one

#

top inventory is just the one on top

#

Usually gonna be like a chest, or furnace etc

#

the other open inventory apart from the playerโ€™s own inventory

#

well it can still be the playerโ€™s inventory

#

If there is no other inventory

slate surge
#

i got it

#

the difference

gentle nexus
#

so if i want to do sominthing when an item in an inventory is clicked ill use clicked inventory ?

slate surge
#

yes

#

be aware that inv are very complicated to work with and if not managed properly raises security issues

#

as one was in the vulcan

#

and

#

auction house

#

etc

lost matrix
smoky anchor
gentle nexus
#

im adding items to an inventory
how do i make them not stack ?

flint coyote
#

set them on a specific slot instead of adding them

icy beacon
#

Generally what Fabsi said yes ^
But if you ever want your item to not stack with other alike items, you can add some arbitrary value to its PDC (or NBT if you're under version 1.14)

gentle nexus
valid burrow
valid burrow
#

dont add them to the inventory

#

set them

slate surge
#

I am still waiting for spigot to implement a built in anti bungeeguard

chrome beacon
#

anti bungeeguard???

wet breach
wary harness
#

is there an event when u water log a chest

#

or do I need to cancle it on interact event

#

?

proud badge
#
    public void onClose(InventoryCloseEvent event) {
        if(event.getInventory().getHolder() instanceof ClanIndividualVaultMenu) {
            int index = ((ClanIndividualVaultMenu) event.getInventory().getHolder()).getIndex();
            ClanVault vault = ((ClanIndividualVaultMenu) event.getInventory().getHolder()).getVault();
            vault.updateVault(event.getInventory(), index);
            System.out.println("AWIDNIWADN");
            vault.closeVault(index);
        }
    }``` 
Anyone know why InventoryCloseEvent is fired when an inventory is **opened**?
slender elbow
#

because another inventory was closed?

#

to open an inventory the previous one must be closed first

shadow night
#

And you should also not use the inventory holder to identify the inventory

proud badge
proud badge
shadow night
#

Didn't inventory holders cause lag

chrome beacon
#

they're slow and unsupported

#

could break at any time

ocean hollow
#

how often should I send a packet to the player using ProtocolLib in order to show him another item?

eternal oxide
#

more detail needed

ocean hollow
#

if player has x item in hand, other player sees y

#
    public void sendPacket(Player from, Player to){
        ProtocolManager protocolManager =  ProtocolLibrary.getProtocolManager();
        PacketContainer packet = protocolManager.createPacket(PacketType.Play.Server.ENTITY_EQUIPMENT);
        packet.getIntegers().write(0, from.getEntityId());
        List<Pair<EnumWrappers.ItemSlot, ItemStack>> list = new ArrayList<>();
        list.add(new Pair<>(EnumWrappers.ItemSlot.MAINHAND, new ItemStack(Material.CROSSBOW)));
        packet.getSlotStackPairLists().write(0, list);

        try {
            protocolManager.sendServerPacket(to, packet);
        }
        catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    }

``` i wrote this, but idk how often to use it
eternal oxide
#

every tick, but you may have a flash of the old item unless you consume packets

ocean hollow
#

how can I consume packets?

eternal oxide
#

I've never done it

ocean hollow
#

okay, thanks

eternal oxide
#

7smile7 (if alive) would know

grave laurel
#

quick question: how could I give a player a permission to execute a command and after for example player.performCommand() remove the permission?

eternal oxide
#

Listen for the equip packet and modify it for a specific player

slender elbow
#

for, reasons

#

that's why the inv open event doesn't fire for your own

proud badge
#

I figured it out, I accidentally had the same inventory open twice

slender elbow
#

:bruh:

torn shuttle
#

hey, how do I add command autosuggestions? I'm trying to move away from cloudcommandframework

echo basalt
#

Either brigadier or just regular tab completion

torn shuttle
#

which part of the docs is that in for something that would require the least amount of dependencies

echo basalt
#

So regular tab completion

#

Look at TabCompleter

torn shuttle
#

does that have the autosuggest stuff as well?

echo basalt
#

Uh yes 1.13+ clients send a tab completion request for every character they write after the /

#

It's basically just a command executor but you return a list instead

ocean hollow
# eternal oxide <@751659657629794384> Closest I could find <https://www.spigotmc.org/threads/una...
        protocolManager.addPacketListener(new PacketAdapter(this,
                ListenerPriority.HIGH,
                PacketType.Play.Server.ENTITY_EQUIPMENT) {
            @Override
            public void onPacketSending(PacketEvent event) {
                if(event.isCancelled()) return;
                if(event.getPacketType() != PacketType.Play.Server.ENTITY_EQUIPMENT) return;

                final PacketContainer packet = event.getPacket();
                final Entity entity = packet.getEntityModifier(event).read(0);

                if(entity == null) return;
                if(entity.getType() != EntityType.PLAYER) return;
                
                List<Pair<EnumWrappers.ItemSlot, ItemStack>> list = new ArrayList<>();
                list.add(new Pair<>(EnumWrappers.ItemSlot.MAINHAND, new ItemStack(Material.CROSSBOW)));
                packet.getSlotStackPairLists().write(0, list);

                event.setPacket(packet);
            }
        });

``` so it should be like that?
echo basalt
#

Uh no

#

The entity packet used an entity id field, not the entire entity

ocean hollow
#

uh

#

I should use WrappedDataWatchers?

ocean hollow
young knoll
#

Entity id is just

#

an integer

ocean hollow
#

that is, I need to get the ID, and then get the essence from it? I saw on the Internet that they are creating a class that saves all entities into a map.

echo basalt
#

What the fuck no

#

Entity#getEntityId

torn shuttle
#

making commands is so annoying

#

I should've just made my lib for it from the get-go

flint warren
flint warren
#

so

torn shuttle
#

that looks like a package path

#

classes are traditionally uppercase

flint warren
#

yh im just testing

#

dont mind that

#

its a class name

lost matrix
#

And im not seeing a package, nor a class with the name "item"

flint warren
#

omfg

#

okay

#

i was

#

okay ignore everything i said

#

i thought item was test for some reason

#

my brain was not working

lost matrix
flint warren
#

so, is there any better way to get a class by a string ?

torn shuttle
#

why are you getting a class by string

lost matrix
#

Why do you need to get a class by a string

flint warren
#

im making custom item abilities and im asigning them using strings,

so basically what i do is in an item browser you put, ex: "test"

and then when you, ex: right click, it executes the right click function in the test script

#

any better way to do that without hard coding it