#help-development

1 messages · Page 1795 of 1

buoyant viper
#

i think something got fucked with using local jars as dependencies

#

so i was forced to downgrade

paper viper
#

I see

buoyant viper
#

but yeah upgrading to 7+ fixed

#

thank

#

i probably wouldntve tried that, thought about it, but dismissed it

paper viper
#

Yea

opal sluice
#

Hi, I have a small problem,
I'm trying to make custom recipes with items that have names that can change.
I tryed to do it with the PrepareItemCraftEvent but it makes a dupe glitch for a really weird reason (that's totally bugged, the items disappear but you can still click on the result and you see sometime the ingredients being literally duplicated in amount)

#

Is there a way to do it with exactchoice recipe ?

#

here is the actual PrepareItemCraftEvent that makes the dupe glitch (saw on the forum that it seems to be a spigot issue bc it shouldn't be used to make recipes, or smthing like that)

    public void onPrepareItemCraft(PrepareItemCraftEvent e)
    {
        final CraftingInventory craftInventory = e.getInventory();
        ItemStack[] content = craftInventory.getContents();
        if(content.length >= 7)
        {
            if(content[4] != null && content[5] != null && content[6] != null
                && content[5].hasItemMeta())
            {
                ItemStack poopItem = ZePoopItem.getPoopItem(plugin);
                ItemMeta poopIM = poopItem.getItemMeta();
                ItemStack middleItem = content[5];
                ItemMeta middleItemMeta = middleItem.getItemMeta();

                poopIM.setDisplayName(middleItemMeta.getDisplayName());
                poopItem.setItemMeta(poopIM);
                poopItem.setAmount(middleItem.getAmount());

                if(content[4].getType().equals(Material.WHEAT)
                    && content[6].getType().equals(Material.WHEAT)
                    && middleItem.equals(poopItem))
                {
                    craftInventory.setResult(ZePoopCookieItem.getPoopCookieItem(plugin));
                }
            }
        }
    }
sullen marlin
#

do you have a matching recipe registered

#

likely not

#

the prepare event isnt sufficient, you need a recipe, or to remove the items in the actual Craft event

young knoll
#

A PDCRecipeChoice would be nice

opal sluice
#

If I place like only one ingredient of each type

#

and get the result, it work normally, no duplication

sullen marlin
#

you are setting a result but if no recipe exists, then the server doesnt know to 'use' the craft items when the actual craft occurs

#

this is why it dupes

#

so you either need to register a recipe (recommended); or code for actual CraftItemEvent, not just prepare

opal sluice
young knoll
#

You still can

#

Just use the base material

opal sluice
#

That wouldn't be good ^^'

young knoll
#

Then you do the validation in the prepare event

#

Just like ye old days before ExactChoice

opal sluice
#

Oh, well, that could be a solution also, thanks, gonna try that too

spare marsh
#

Do TextComponent support hexColors in 1.17?

opal sluice
spare marsh
#

I have no idea why this is happening

young knoll
#

Are you using .color

#

Or are you adding it directly to the string

opal sluice
spare marsh
#
tring stringBuilder = Tools.hexColorMSG("#4db9e3⭐#484f2aRango &e➠ ") + "%MyPlugin_hexColors%" + "\n" +
                    Tools.hexColorMSG("#4db9e3⭐#484f2aMonedas &e➠ &7") + Tools.getPlayerCoins(player) + "\n" +
                    Tools.hexColorMSG("#4db9e3⭐#484f2aCorazones &e➠ &7") + Tools.getPlayerHearts(player);


            

            ComponentBuilder builder = new ComponentBuilder();
            TextComponent format = new TextComponent(event.getFormat());
            format.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(stringBuilder)));
            TextComponent finalMessage = new TextComponent(event.getMessage());
            finalMessage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(" ")));
            builder.append(format).append(finalMessage);
            for(Player online : Bukkit.getOnlinePlayers()){
                online.spigot().sendMessage(builder.create());
            }```
#

Its coming from another method but it is bungee's

#

Because it works for original message but not for the text component

quasi patrol
#

Anyone know what the MVdWPlaceholderAPI Gradle Dependency, and Repository code are? Idc that it is outdated, the server I'm dev for just uses it for some reason. .-.

young knoll
#

TextComponent.fromLegacyText

opal sluice
spare marsh
#

where exactly would I use that>

young knoll
#

Anywhere you want to use a string with color codes in it

quasi patrol
young knoll
#

Or you can use .color on your text components

opal sluice
quasi patrol
spare marsh
#

Alright let me try that

opal sluice
quasi patrol
#

.-.

opal sluice
spare marsh
quasi patrol
opal sluice
#

Well, they could have their own gradle repos

#

since I don't see any gradle repos on their posts

quasi patrol
#

Wait.

spare marsh
opal sluice
#

This @quasi patrol ?

spare marsh
#

the same from the first one

quasi patrol
opal sluice
granite beacon
#

How do I add a NMS player to a scoreboard team? I already tried adding the name as an entry to the team.
Any other suggestions (or packets I should send to the player to notify them of the change?)

quasi patrol
opal sluice
spare marsh
#

So I add two TextComponents together with a ComponentBuilder but I would like for one to have a hover event and the second one not to have one. I don't add hover event for the seconds one but it still shows the one from the first one.

sullen marlin
#

.reset

#

Or .append(... FormatRetention)

spare marsh
#

Alright I'll try that thank you!

quaint mantle
spare marsh
#

THose methods, reset and append worked on the builder

quaint mantle
#

so here's how im using it

#

the main parts to focus on, is usernameColored which has a hover event

#

show_text, just shows the rank

#

format is for chat

#

it shows the name >> message, right

#

assuming that .reset() works... there should be no hover event on the space, arrow, or message

#

there is a hover event on all of those though

#

the weird thing is that mute has a hover event, and .reset() seems to work there

#

like there's no hover event in the space, nor prefix in the mute + " " + format

muted sand
#

how do I deobfuscate minecraft's server source code? Can I even make changes to it if i do?

#

is it BuildTools that can be used to make my own server jar?

quaint mantle
#

yes

#

?bt

undone axleBOT
muted sand
#

Ah hm, thanks!

lean gull
#

how do i look at the required input value of a gamerule in code?

ancient plank
#

?jd

lean gull
#

that- doesn't really help me

ancient plank
#

Wasn't doing that for you

lean gull
#

o ok

#

mb

muted sand
#

So I can uh, use BuildTools to make a small edit (like a random new line in a file), and build a new server jar off of that-?

sullen marlin
#

sure but why

muted sand
#

Just wondering

shut field
lean gull
#

what does the Class data type do

noble lantern
#

Is there a way to get the Villager/Entity instance from a Inventory / MerchantInventory?

MerchantInventory#getMerchant#getTrader is the Player instance

sullen marlin
#

isnt getMerchant what you want....

#

cast Merchant to Villager

noble lantern
shut field
young knoll
#

Do we have a trade event yet?

lean gull
#

huh?

sullen marlin
#

yes, lots

#

TradeSelectEvent

#

VillagerAcquireTradeEvent

#

VillagerReplenishTradeEvent

shut field
lean gull
#

can't i just do .toString() at the end and then it will say like boolean or integer

#

1 sec lemme test that theory

#

i was right

#
[04:40:48 INFO]: [Gamerules] class java.lang.Integer
[04:40:48 INFO]: [Gamerules] class java.lang.Boolean```
noble lantern
#

Im trying to get a Villager instance or Entity instance via InventoryClickEvent

#

So doing that wouldnt be useful, and casting getMerchant to Villager is just a ClassCastException

sullen marlin
#

(Villager) getClickedInventory().getHolder()

noble lantern
#

Ahh ty

young knoll
worldly ingot
#

Yes

young knoll
#

I guess you could detect when it’s used via the click event

worldly ingot
#

Hmmm... curious for anybody that's done this before

#

When you use Entity#teleport() it makes the entity immune for about 2 seconds or so

#

Can that be overwritten with Entity#setNoDamageTicks(0)?

#

That invulnerability period is extremely annoying and if I can override that, it would be awesome

quaint mantle
#

try it 🙂

worldly ingot
#

for anybody that's done this before

#

Not able to test it at the moment and I'm sure someone's run into the same issue lol

quaint mantle
#

hmm lemme try

#

wait i wonder if kill still kill the entity even if they are immune?

quasi patrol
#

Gradle btw.

#

Idc that MVdWPlaceholderAPI is outdated, the server I'm developing for uses this plugin so I have to suffer with it. .-.

shut field
#

I'm using libs disguises and getting java.lang.IllegalArgumentException: Plugin cannot be null

#

anyone know what could be causing that?

opal sluice
quasi patrol
young knoll
#

Share the error

shut field
#

ok

shut field
opal sluice
runic mesa
#

How do i check if an item is a wooden sword

#

or something like that

#

i know its incredibly basic im just brain dead rn

quaint mantle
#

?learnjava when

undone axleBOT
opal sluice
young knoll
undone axleBOT
opal sluice
#

Not hard to understand imo ^^'

quaint mantle
#

bro im lazy to even read bro so hard to understand!11!!11!11

quasi patrol
#

The website that I found wasn't very helpful .-.

opal sluice
torpid jetty
#

!verify sudologic

undone axleBOT
#

This account is already verified!

quasi patrol
opal sluice
#

Try the actual commit hash

primal sequoia
#

Idk what the issue is

young knoll
quasi patrol
opal sluice
quasi patrol
#

Where on the github repos?

opal sluice
#

in the commits section ?

shut field
#

(it is the DisguiseAPI.disguiseEntity())

quasi patrol
opal sluice
#

That's the branch name

quasi patrol
#

.-.

#

I think I found it.

quasi patrol
#

This?

opal sluice
#

yup

quasi patrol
opal sluice
#

the long one

quasi patrol
#

For what I assume is this. .-.

opal sluice
#

yup

#

that's it

quasi patrol
#

Ok.

#

Lets see if it works.

#

.-.

quasi patrol
opal sluice
#

You did add the jitpack repo to your gradle right ?

quasi patrol
opal sluice
#

yes, it should be in the build.gradle file

quasi patrol
#

It is.

opal sluice
#

mmmh well that's strange, it should work x)

#

Already did that for many plugin without repos but only github repos

#

and worked pretty well for me x)

quasi patrol
#

This correct?

opal sluice
#

Should be since we can see in the error it tries to go over jitpack.io

opal sluice
quasi patrol
#

D:

opal sluice
#

So, add your plugin in your maven local repos

#

and add "mavenLocal()" to your build.gradle repositories

quasi patrol
#

Brain cells are now gone.

young knoll
# shut field

Well I don’t see anything with namespaced keys there so I imagine LibDisguises is to blame

#

Is your version up to date

primal sequoia
quaint mantle
#

if i was making a player shop, where people could buy items... would i just store the things as

HashMap<Material, Integer>
Material the thing they're buying, Integer cost, loop through it and add it to the store..? or

#

im not tryna make a config for that 💀

primal sequoia
waxen plinth
quaint mantle
#

you have another library

waxen plinth
#
@ConfigValue
private Map<Material, Integer> shopPrices = ConfigManager.map(Material.class, Integer.class);```
#

Indeed I do

#

Did you end up trying the command library?

quaint mantle
#

LOL

quaint mantle
#

but i got wrapped up in making Cosmetics

waxen plinth
#

Why did you copy the classes instead of just shading with maven lol

quaint mantle
#

idk

waxen plinth
#

Well anyways if you want to make it configurable more easily you can try my config library

#

Let me know if you're interested and I will send docs

quaint mantle
#

alrrr

#

i did have some config questions, but just the Bukkit configs so i'll ask those here if anyone¨s good with configs

waxen plinth
#

Shoot

quaint mantle
#

if anyones good, lmk -

quaint mantle
#

so i have all my player data files, in their own individual files

#

and they're just .txt, right

waxen plinth
#

Right

young knoll
#

Do you have a library library

waxen plinth
#

That doesn't sound like a very good idea

quaint mantle
#

like its just

economy things
bans
etc.```
#

just raw values

young knoll
#

Use like

#

Json

waxen plinth
#

Or yaml, or sqlite

#

Or any proper format

quaint mantle
#

how could i take each and every profile, add it to a configuration section, like a file i have player-info.yml

young knoll
#

You can make a class directly serializable and deserialize with json

zinc spire
#

can someone help me, im using FaweAPI to load and paste schematic but it show the not in GZIP format warnings

quaint mantle
#

let me make an example rq, of what i am trying to accomplish so its easier for me, and whoevers reading this

waxen plinth
#

Doing that with the standard config library is a bit of a pain

#

But you can create a config section with createConfigurationSection(String) on any config class

#

And for that config section you can set additional keys and such

#

You don't actually need that though

#

You could just loop over each player doing this

quaint mantle
#
player-data:
    fb4cdeed-f266-4db8-87e4-ddfd963d7b00:
        UUID: fb4cdeed-f266-4db8-87e4-ddfd963d7b00
        Shards: 246
        Rank: 100
        Warns: 11
        Kicks: 1
        Mutes: 10
        Bans: 1
        Is muted: false
        Is banned: false
        Is vanished: false
        Receiving notifications: true
        Home location: -2372.2764900112825 72.0 -802.4190905671 world
``` is what im trying to get
#

and then for each player it just makes a new section

waxen plinth
#
for (Player player : players) {
  config.set(player.getUniqueId() + ".shards", 150);
  config.set(player.getUniqueId() + ".rank", 100);
  ...
}```
quaint mantle
#

how would i edit them, and save them

waxen plinth
#

Edit them with set

quaint mantle
#

i'd just config.set(their uuid, thing)

waxen plinth
#

Yes

quaint mantle
#

and then config.saveDefaults();?

waxen plinth
#

No

quaint mantle
#

no

waxen plinth
#

Not saveDefaults

quaint mantle
#

i was lying

#

it was a quiz

waxen plinth
#

If you're using the config from Plugin#getConfig you can just call Plugin#saveConfiguration or whatever it is

#

Otherwise you call save(File)

quaint mantle
#

ahhh

#

config.save(File);

zinc spire
#

hello

quaint mantle
waxen plinth
#

Sure, but it's gonna be kinda annoying to use the standard config library

#

I guess it's worth trying it at least a few times

#

But it's a lot of boilerplate and gets real old real fast

#

Mine isn't the only config libraries, there are a number of good ones out there

quaint mantle
#

can a metadata store a location

waxen plinth
#

You mean ItemMeta?

zinc spire
#

can someone help me with load and pasting schematic with world edit, it shows "not in GZIP format" warnings
Im using this code

quaint mantle
#

no

waxen plinth
#

Then what do you mean "a metadata"

#

PDC?

quaint mantle
#

?

young knoll
#

Metadata

#

It’s pdc but not persistent

noble lantern
#

If i wanted unlimited trades would i:

Set this to max int limit or -1?

OR

After trade is compelted set the trade amount += 1?

quaint mantle
#

can it store locations

young knoll
#

Probably

young knoll
#

If not you can just serialize them to a string or whatever

waxen plinth
#

Is that not defined by maxUses?

zinc spire
#

can someone help me?

waxen plinth
#

If you wanted "unlimited" just set it to Integer.MAX_INT

waxen plinth
#

This is spigot support, not fawe support

zinc spire
#

alright

noble lantern
waxen plinth
#

👍

noble lantern
#

Finally, MMOItems support with villager trades

#

Ah crud i need to reset the trade after it completes to reroll the stats smh

fading parcel
noble lantern
#

The sword is from MMOItems

#

But the villager trader plugin i made uses its API to put MMOItems into trades

#

Gonna work on implementing the costs now

fading parcel
#

Thx

young knoll
#

I need to work on support for item plugins

#

But there are so many, ahhh

noble lantern
#

Im only supporting the 2 i use

#

Theyre premium though so not many people will even use them

waxen plinth
#

If the plugin is any good you should just be able to treat them like normal items without issue unless you're doing something funky on them

#

I mean for storage and similar

noble lantern
#

I mean things like Shops and whatnot its useful

#

EG with ShopGui+ having suport for items supports ise really useful

#

Yes you can just use the commands options and remake the item in the gui but

#

Why not just use the Plugins API to support that item and it will update as you change the item

#

If your just rewarding the custom item to a player then commands are fine but most cases do require a hook for item plugins

young knoll
#

I mean, I guess I could expect people to stick in serialized itemstacks... but I don’t think anyone will do that

#

Suppose I could make some kind of in game GUI to configure it

noble lantern
#

Ide just hook into the plugins api ngl

#

it takes just 1-2 lines of code

#

With MMOItems and CustomItems at least, theyre just simple one liners

young knoll
#

Yeah but there are dozens of them

#

Why do that when I can just let the user stick in any old itemstack

noble lantern
#

Just add support when someone asks for it

noble lantern
#

While if you use api it always works

young knoll
#

Then they should update the item in the GUI

noble lantern
#

Its just a lot of work for the end user

#

Because anytime they wanna update an item they now have to go throughand do other configs as well now, even if its just guis its just rather tedious

young knoll
#

Well I’ve already had a request for a plugin I can’t even find the dang API for

#

Actually it’s the one you just mentioned

noble lantern
#

Yeah MMOItems and CustomItems you need to mvn install-file

#

mvn install:install-file -Dfile=CustomItems.jar -DgroupId=com.jojomd -DartifactId=CustomItems -Dversion=1.0.0-SNAPSHOT -Dpackaging=jar

#

And then you can import it like so

#

ignore selection my snipping tool buggin

young knoll
#

What if I don’t own the plugin

noble lantern
#

Uhmm if its CustomItems ask JoJo he can help you, he will likely give you a copy of it as ive seen him do it before

#

as for MMOItems im not sure

young knoll
#

Not having a public API for your premium plugin

#

0/10

noble lantern
#

fr though

#

I mean its public just not to people who bought the plugin 😉

#

xD

#

So privatly-public

#

But yeah idk why its so hard to implement a public API

#

Like almost any premium plugin doesnt have a public api anymore

#

Ive actually been waiting almost a year now for CustomItems to make a maven repo xD

noble lantern
#

Wow that was so much easier than i thought it was gonna be

#

Now trade ingredients can be mmo/custom items

quaint mantle
#

im having some fileconfiguration issues

noble lantern
#

Whats it saying?

quaint mantle
#

wondering why this

#

gets turned into

noble lantern
#

Thats quite weird

#

Are you sure your not seting the full uuid object somewhere else?

quaint mantle
#

positive, im retrieving it frm somewhere, but im getting it as a string first

#

security thing, dont question the logistics behind it:

candid galleon
#

does path end with the .?

quaint mantle
#

yes

#

its just the uuid + "."

#

it gets confusing for me when i see the + in a lot of places)

quaint mantle
#

give me, two seconds

candid galleon
#

why would the UUID be the path and the value

quaint mantle
#

oh and its just a recycled thing, idk why its there

#

it used to be a security thing for the old player info system that i had

candid galleon
#

what happens if you try using uuid + ""?

quaint mantle
#

this might be a config thing actuallyyy, i'll try something.. let me just delete the entire section and remake it

#

the config value you showed looks like something from a previous test

hybrid spoke
quaint mantle
#

yeah i think so @quaint mantle

spare prism
#

Why aren't the libraries being excluded?

        <dependency>
            <groupId>net.dv8tion</groupId>
            <artifactId>JDA</artifactId>
            <version>4.4.0_350</version>
            <exclusions>
                <exclusion>
                    <groupId>club.minnced</groupId>
                    <artifactId>opus-java</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>log4j-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
candid galleon
#

don't you use the scope for that

#

<scope> included </scope>

noble lantern
#

Nah he means exclusions

#

And IIRC JDA needs those libaries and uses them

#

so you cant exclude them unless the library isnt used

spare prism
noble lantern
#

Unless exclusions need a scope? Cause i never knew them to need one

spare prism
noble lantern
#

even just referancing it will mean you cant exclude it, because youd get runtime errors

spare prism
noble lantern
#

I see

#

And the groupId and artifactID match the ones set in JDA's Pom?

spare prism
#

JDA

    api("club.minnced:opus-java:1.1.0@pom") {
        isTransitive = true
    }
noble lantern
#

Weird

#

Im not entirely sure why maven wouldnt exclude that especially since its marked as transitive

spare prism
#

😵‍💫

quaint mantle
#

so i tried removing the section..

#

and so i rejoined, expecting it to be remade

#

the file size is now 307, so somethings shorter

#

but when i open it, its blank

candid galleon
#

can we see the code context?

quaint mantle
#

yes which one

#

the creation of the line "Uuid" shouldnt have any more issues, its all string now..

candid galleon
#

the function it's in

quaint mantle
#

thats the removal of the section

#

there's a ton of arguments for this, ignore that

candid galleon
#

and what's fc?

quaint mantle
candid galleon
#

gross

#

Conf class?

quaint mantle
#

essentially a useless class

candid galleon
#

and the file is just a bunch of empty lines?

quaint mantle
#

its 1 line

#

refreshed a ton, restarted notepad++

#

i'll restart FileZilla

candid galleon
#

is your code on a github by any chance?

quaint mantle
#

no

#

its private code, for my server

uneven rapids
#

anyone know how to prevent an anvil from changing the font/color when you enchant/apply books to an item?

quaint mantle
#

ahhh, it was a FileZilla error @candid galleon

#

the lines are al there, and the uuid is now a string

candid galleon
#

tf is FileZilla

candid galleon
quaint mantle
candid galleon
#

why not use WinSCP

quaint mantle
#

and WinSCP causes my CPU to go BRRR

candid galleon
#

strange

quaint mantle
#

ya

uneven rapids
#

yeah no that is not it

hybrid spoke
quaint mantle
hybrid spoke
quaint mantle
#

💀

#

as is this

#

any reason why imports are like, making no sense?

#

like why a class, that exists, and has existed for a while that i made... is suddenly "not real", when in reality it is right there

#

and is imported?

candid galleon
#

version update?

quaint mantle
candid galleon
#

what does it say when you hover over the red lines?

quaint mantle
#

highkey lowkey wack

hybrid spoke
candid galleon
#

second one you can just click the import one

quaint mantle
candid galleon
#

first one i'd double check the path

quaint mantle
hybrid spoke
#

whats the class visibility?

quaint mantle
#

they're both already imported, and the paths are correct

broken hare
#

How can I register a command without using the plugin.yml, because I want to register commands from the config.yml

#

Is this possible.

hybrid spoke
#

yes, you will need to go over the commandmap and register your command there

pale escarp
#

hey I am new to gradle and plugin development, could anyone help me understand how to build a gradle based plugin in intellij?

quaint mantle
#

The terminal is your best friend

eternal oxide
#

if you are new to both Maven is probably your better choice

pale escarp
eternal oxide
#

ok

pale escarp
quaint mantle
#

Then Just use gradlew.bat build / ./gradlew build

pale escarp
#

in intellij there is no built in ? not sure if we are talking about intellij here

#

I was trying to create an artifact

quaint mantle
#

IntelliJ has a Terminal built-in, but cmd.exe does the same

pale escarp
#

So cannot use artifacts. i have to only use glradew?

quaint mantle
pale escarp
#

nono

#

I am trying to just getting a working jar using artifacts feature in intellij

quaint mantle
#

So you Just want to create a jar?

pale escarp
#

yep

quaint mantle
#

No Idea what this artifact Feature is about, but gradlew build should work with building a jar

#

The jar is created in the build/libs folder iirc

pale escarp
#

Alright thanks ^^

maiden thicket
#

how would i prevent an arrow from slowing down and stopping in water?

native gale
#

Will this work, if the block in the location is not lodestone?

eternal oxide
#

it depends on how often you set it

#

the value is validated whenever the compass is placed in or taken out of an inventory

native gale
#

Hmm, okay

#

Then, is there a way to make a specific compass to point to the specific location?

eternal oxide
#

no, not permanently

valid solstice
#

How'd I make it so that when a new inventory opens to the player, it does not reset the mouse cursor to the middle

My code:

            e.setCancelled(true);
            if(e.getCurrentItem().getType() == Material.BARRIER){
                player.closeInventory();
                player.openInventory(mainMenu.getInventory());
            }
        }```
#

Thanks

native gale
#

Afik, you can't control clients mouse

noble lantern
#

^

#

Was about to say i think thats client sided

valid solstice
#

I've seen other servers that have inventory guis that doesn't reset the location of the cursor

#

any idea how'd they execute this?

eternal oxide
#

then they are not opening new UIs

#

they are likely just clearing and reusing one

valid solstice
#

so clear the inventory, then add more items?

eternal oxide
#

yes

valid solstice
#

that's very tedious for not making the cursor reset every time😓

#

thanks!

#

I'm thinking it's a good suggestion if spigot implements that we can update old inventory to new ones without closing/opening/creating any new inventories

sullen marlin
#

and how would it do that?

#

you're literally telling it to .closeInventory

tacit drift
#

that isn't there

sullen marlin
valid solstice
#

when you closeinventory then openinventory to update it

tacit drift
#

Since you are here md

#

why isn't there a getTPS method

native gale
sullen marlin
#

what is spigot supposed to do about that? That's what happens when you close an inventory lol

restive tangle
#

Anus destroyer.

sullen marlin
#

because 'TPS' is a concept that has no real meaning

valid solstice
sullen marlin
#

uh, so like the existing inventory methods that are already there and allow you to clear and add items

valid solstice
eternal oxide
#

just clear yoru inventory, then add a new contents

#

you can pre build teh array so you just do a single add

sullen marlin
#
  • there is already Inventory.clear
valid solstice
#

hmm. Ok i see, thank you

vague oracle
#

You can open an inventory on top of another that way it won’t move your cursor

vague oracle
#

Idk if that is how you are meant to do it but always worked for me since 1.8

#

Just don’t close the old one

valid solstice
vague oracle
#

And open another whilst you have one open

#

Yup

#

Do it for my network

tacit drift
valid solstice
#

would that draw disadvantages? such as rendering many inventories at once for client side?

vague oracle
#

I wouldn’t imagine so the inventoryclosevent still gets called

#

Just a suggestion, you can use at own risk xD

valid solstice
#

alright, thanks

hybrid spoke
calm star
#

How do u make a bossbar with cusotm text?

crimson terrace
#

BossBar bossbar = new BossBar(*with parameters of course);

hybrid spoke
calm star
#

how do you create one

#

oh sry didnt see that

hybrid spoke
#

Bukkit.createBossbar

calm star
#

wherer do i do that in

#

is there a server tick event or smth

crimson terrace
#

oh crap yeah sorry

#

BossBar bossbar = Bukkit.createBossBar() is the correct one

worn tundra
#

xd

quaint mantle
#

it isnt hard ngl

calm star
#

k

#

would i do smth like this:

@EventHandler
    public void ServerTickEvent(ServerEvent e) {
         System.out.println(":H");
         BossBar bossbar = Bukkit.createBossBar("King of the Hill Event", BarColor.BLUE, BarStyle.SOLID);
    }
hybrid spoke
#

what do you want to do?

calm star
#

no its fine i did it

#

but BossBar bossbar = Bukkit.createBossBar("King of the Hill Event", BarColor.BLUE, BarStyle.SOLID); that isnt doing anything

#
public void serverTickEvent(Server server){
        server.getScheduler().scheduleSyncRepeatingTask(this, new  Runnable(){
            public void run(){
                if (KothMain.kothStarted == true) {
                    System.out.println(":H");
                    BossBar bossbar = Bukkit.createBossBar("King of the Hill Event", BarColor.BLUE, BarStyle.SOLID);
                }
            }
        }, 1, 1);
    }
``` `:H` gets printed every tick but there is no bossbar
chrome beacon
#

Why are you checking == true. There is no point in doing that

hybrid spoke
chrome beacon
#

^

calm star
#

its a preference

#

i always do it

hybrid spoke
chrome beacon
#

Yeah that isn't a real event

#

It's just his method of starting the runnable

hybrid spoke
#

not even sure what events are meant with Miscellaneous server events

calm star
#

will i have to iterate throught the server.getOnlinePlayers() to give it to all the online players?

chrome beacon
#

Yes

calm star
#

cool

chrome beacon
#

Also I don't think it's a good idea creating a new bossbar every tick like that

calm star
#

how should i do it?

chrome beacon
#

Do it once

calm star
#

then add players to it every tick

chrome beacon
#

Then add the player to it on join

calm star
#

not on join

#

cause a command /koth start will activate it

hybrid spoke
#

so you add them on join and show the bossbar when the command gets executed

calm star
#

oh

#

i didnt know u could do that

hybrid spoke
#

thats the way to do it

#

create the bossbar,
add the players to it,
show

noble lantern
#

So this is basically when the Trade event finishes?

calm star
#

thanks @hybrid spoke and @chrome beacon !

quasi flint
#

== true yikes

#

u dont have to write == boolean value

uneven rapids
#

could someone help make a plugin that makes it so anvils don't automatically name items to &b and instead keeps the respective name of what is in the first slot of an anvil?

quasi flint
#

well where is the prob?

#

u stuck coding it

#

or u cant code?

uneven rapids
#

java sucks, that's the problem

quasi flint
#

well then u are wrong at minecraft development

uneven rapids
#

what does that even mean

noble lantern
#

TBF the anvil api is weird but it is fairly easy, you just need to look into the different Anvil events and play around with them a bit

uneven rapids
#

well i've tried but when i try it with a server i just get errors with no idea what they mean

hybrid spoke
#

do you have any code so we can look at it?

noble lantern
#

All you need to do is set the anvil's result item's DisplayName meta to match the DisplayName meta of the item in slot 0 of the Anvil

#

Or just strip color

#

And then you need to handle previewing the item so it doesnt look all funky, i dont remember how to do that part

quasi flint
#

?learnjava

undone axleBOT
noble lantern
#

Or should i just listen to inventory click event and then see if the slot 2 has an item in it when clicked? I dont see an easy option to see when a trade gets completed

the event i showed there didnt fire after trading with a NPC villager

uneven rapids
#

so check to make sure item is not null -> check if itemmeta is not null -> check if displayname is not null -> setdisplay of the result to that of the first item's displayname? or am i just too dumb to get this shit

hybrid spoke
noble lantern
#

Item Meta and DisplayName will never be null

hybrid spoke
#

it will in case of air

noble lantern
hybrid spoke
noble lantern
noble lantern
#

whats up with these Trade Events

#

they straight up dont fire LMAO

#

VillagerReplenishTradeEvent Is supposed to fire after a trade at least from this is what it sounds like

#

Ah screw it im just gonna use InventoryClickEvent and handle completed trade events that way

eternal oxide
#

they fire just fine

noble lantern
#

That method does not fire

eternal oxide
#

Called when a villager's trade's maximum uses is increased, due to a player's trade.

#

not every trade

noble lantern
#

I have a InventoryClickEvent in the same class that works, so i know its registered

#

So then is there any reliable way to see if a trade completes?

#

Other than doing a janky InventoryClickEvent for the 2nd slot on Merchant inventory?

eternal oxide
#

not really. You can watch the TradeSelectEvent to see what trade is selected, then monitor the click I guess

noble lantern
#

Thing is with MerchantInventory i can get the currently selected trade

#

So TradeSelectEvent is kind of overal not needed tbf

grave kite
#

hi, is it possible to cancel chunk load event so it doesn't read chunk files from the file system at all?

quaint mantle
#

wat do you want

eternal oxide
#

no

#

use the javadocs and you will see

quaint mantle
#

we dont want x y problem...

grave kite
#

My plugin instantly switches the world of the player on player join, but I don't want to load the initial world chunks

eternal oxide
#

explain

#

you have a world you don't want to load? or you want a void world?

grave kite
eternal oxide
#

its not teh same

noble lantern
#

Beileve it or not voids worlds are actually generated kinda, theyre not unloaded chunks or anything

grave kite
#

the user joins in the overworld and instantly switches to the nether. So I don't want to load the overworld chunks because the player instantly switches and doesn't need them

eternal oxide
#

then generate a void world as yoru overworld

grave kite
#

can I do it from the plugin?

eternal oxide
#

what plugin?

grave kite
#

I don't think that's a good solution, seems a bit hacky

eternal oxide
#

its teh correct solution if you don;t want chunks in yoru main world

grave kite
eternal oxide
#

question, why are you not using your overworld at all?

grave kite
eternal oxide
#

it seems pointless as you move them instantly to the nether, why not just make teh nether your overworld?

#

eliminate teh overworld server all together

#

No point in having it if you don't use it

cedar otter
#

hey what is wrong

[29.11 10:55:51.641] INFO: [Lobby-1] java.lang.NullPointerException
[29.11 10:55:51.641] INFO: [Lobby-1]    at de.badtigermc.mysql.MySQL.createTable(MySQL.java:55) ~[?:?]
[29.11 10:55:51.641] INFO: [Lobby-1]    at de.badtigermc.badban.main.Main.onEnable(Main.java:21) ~[?:?]
[29.11 10:55:51.641] INFO: [Lobby-1]    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
[29.11 10:55:51.641] INFO: [Lobby-1]    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340) [spigot.jar:git-Spigot-db6de12-18fbb24]
[29.11 10:55:51.642] INFO: [Lobby-1]    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot.jar:git-Spigot-db6de12-18fbb24]
[29.11 10:55:51.642] INFO: [Lobby-1]    at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:357) [spigot.jar:git-Spigot-db6de12-18fbb24]
[29.11 10:55:51.642] INFO: [Lobby-1]    at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:317) [spigot.jar:git-Spigot-db6de12-18fbb24]
[29.11 10:55:51.642] INFO: [Lobby-1]    at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:414) [spigot.jar:git-Spigot-db6de12-18fbb24]
[29.11 10:55:51.642] INFO: [Lobby-1]    at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:378) [spigot.jar:git-Spigot-db6de12-18fbb24]
[29.11 10:55:51.642] INFO: [Lobby-1]    at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:333) [spigot.jar:git-Spigot-db6de12-18fbb24]```
#
[29.11 10:55:51.642] INFO: [Lobby-1]    at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [spigot.jar:git-Spigot-db6de12-18fbb24]
[29.11 10:55:51.642] INFO: [Lobby-1]    at java.base/java.lang.Thread.run(Thread.java:829) [?:?]```
grave kite
eternal oxide
#

then link all the player data to the server that has your nether

misty current
#

very quick question because my brain is refusing to compute,
(ench instanceof AttackEnchant || ench instanceof DefenseEnchant) && !(ench instanceof ConditionEnchant) would this condition return false only if ench is instanceof both ConditionEnchant and AttackEnchant or instanceof both ConditionEnchant and DefenseEnchant

eternal oxide
#

no

#

no matter what the first two, if it IS ConditionEnchant it will be false

misty current
#

oh yea

eternal oxide
#

OR its neither of the first two

misty current
#

no wait

grave kite
# eternal oxide then link all the player data to the server that has your nether

That's what I'm doing. The player world and coordinates should be adjusted on world/server switch and I don't want to do it manually. So the player first joins to the same world and I instantly send him to the other world with a reflection so all the coordinates get calculated correctly and I don't mess with the playerdata file myself

eternal oxide
#

type yoru requirements out in english first 🙂

misty current
#

what about !(ench instanceof AttackEnchant || ench instanceof DefenseEnchant) || !(ench instanceof ConditionEnchant)

eternal oxide
#

are you trying to get a true or false response to the test?

misty current
#

it should return false if it's both instances

eternal oxide
#

then test and not or

cedar otter
#

Spigot 1.8.8

noble lantern
#

You need to contact the plugin author

cedar otter
#

im the plugin owner xd

eternal oxide
#

you want to test for?
AttackEnchant && ConditionEnchant
or
DefenseEnchant && ConditionEnchant

misty current
#

yes, its opposite

eternal oxide
#

so java if (!((AttackEnchant || DefenseEnchant) && ConditionEnchant)))?

#

that would return true if its NOT either attack or defense and condition

misty current
#

yea should work

eternal oxide
#

remove teh ! if you want it inverse

misty current
#

thanks

noble lantern
#

My god why is there not a freakin TradeFinishedEvent or similar ffs

#

makes things so complicated

hybrid spoke
noble lantern
#

Yep up above i did

#

it just never fires

#

The acquire isnt finishing of atrade either from what javadocs says

hybrid spoke
#

so then you need to go over InventoryClickEvent

noble lantern
#

Oh trust me i am

#

its hell

#

https://www.toptal.com/developers/hastebin/oqarurahix.kotlin

Its messy right now, imdoing assloads of debugging so itll be like that

Right now im trying to make it so that the commands set to fire when the trade finishes dont keep on firing because if you have a non stackable like a sword and keep sitting there clicking the commands just kept firing

#

I have a fix for it, it was just to send the item right into the players inventory and clear the CurrentItem, but then im gonna have to handle shift clicks...

grim ice
#

Do u have a check for inventory spce

#

Space*

noble lantern
#

nah not yet

#

Oh the way i handled it removed the shift clicking funtionality shiz

#

oh well

grim ice
#

if((p.getInventory.getFirstEmpty) == -1) return "inventory full"

noble lantern
#

oh its that simple

#

I was gonna use the HashMap returned by addItem()

grim ice
#

lol

#

first empty returns -1 if it doesn't find an empty slot

#

so u can use it

noble lantern
#

hmm there is a scenario that methods fail in

#

what if i have a full inv of ItemStack(Material.DIRT, 1)

#

that would fire as i have a full inventory when adding dirt which wouldnt be tre

#

The HashMap returned by addItem returns a HashMap of items that couldnt be added to the inventory iirc

#

oh damn ive managed to keep this plugin under 500 lines so far

grim ice
#

well test it

quaint mantle
#

that is not the problem of the error btw, just performance stuff

#

maybe the connection is null ?

#

do some logging

tender shard
#

btw when you'd use java 16 you could see exactly in the error message what exactly is null

eternal oxide
#

simpler just to try to add it, then drop anything thats in the returned map. Simpler code

tardy delta
#

.values().foreach item -> world.drop item

tender shard
tardy delta
#

AtomicInteger heh

stone sinew
#

https://imgur.com/a/uc8fruZ Any ideas why I can't get CraftWorld to import? I've tried maven, spigot, spigot-api, spigot jar, spigot remapped jar etc... I asked for a few days now still haven't gotten a solution.

eternal oxide
#

run buildtools and use spigot as yoru artifact

stone sinew
eternal oxide
#

in that screenshot you are using spigot-api not spigot

stone sinew
eternal oxide
#

I did, there are 4

stone sinew
eternal oxide
#

ah I see

#

eclipse?

stone sinew
#

also tried both remapped and not

stone sinew
wide coyote
#

it is a problem of eclipse i guess

#

try to import it by your self

eternal oxide
#

right click your pom and select update project

stone sinew
stone sinew
eternal oxide
#

and remove spigot from yoru manual libs

#

it should all be coming from maven

stone sinew
#

Tried.

wide coyote
eternal oxide
#

then you did it wrong

stone sinew
eternal oxide
#

it works just fine

stone sinew
eternal oxide
#

give up programming then

stone sinew
#

Its an issue with spigots new jar system

eternal oxide
#

World = Spigot-api CraftWorld = Spigot

tender shard
eternal oxide
#

no its not, CraftWorld is CraftBukkit, its nothign to do with MC mappings

tardy delta
#

oh just for the lambda?

tender shard
stone sinew
#

even tried with out maven

tender shard
tardy delta
#

lol

stone sinew
eternal oxide
#

um, that is going not work. Multiple of the same API

tender shard
#

eclipse's maven integration sucks btw

#

I wouldn't wonder if eclipse is the problem and if mvn would compile without issues

tender shard
eternal oxide
#

maven/eclipse is fine

tender shard
#

I always had problems with eclipse + maven because eclipse would rather read it's own properties file overwriting the maven stuff

eternal oxide
#

I've never had any issues other than occasionally having to refresh a project

tender shard
#

lucky you 😄

#

or maybe bad luck me

#

idk

stone sinew
#

I don't use maven (unless shading). Just did it for testing because md_5 wouldn't stop complaining that I wasn't using it to depend on spigot.

tender shard
#

I'd shoot myself without maven

#

every one of my plugins depends on at least 3 of my libraries, I don't even want to imagine what'd happen if I'd have to update them all manually

eternal oxide
#

I'd never go back to not using maven

tender shard
#

same

wide coyote
#

imagine using eclipse without maven

tender shard
stone sinew
#

I just don't like needing to "build" my plugin everytime I'm testing and update 1 line of code.

tender shard
#

so you just put the source code into your plugins directory?

stone sinew
tender shard
#

and that's "building"

stone sinew
wide coyote
#

he means building without a buildtool

tender shard
tender shard
stone sinew
tender shard
#

you too

#

even when I run gcc to compile just one single C file, it's also building

#

from the wikipedia article Building (Disambiguation)

stone sinew
#

"wikipedia" lol

tender shard
#

You probably also dont trust books written by CS engineers I assume?

#

They also call it „building“

eternal oxide
#

wikipedia is good for most things, unless its politics

tender shard
#

yeah wikipedia is basically totally fine for everything unless you're writing something scientific etc

#

part of the reason is that people without real hobbies like me go through all the changes made by anyone and revert (or don't approve them at all) them when they don't provide proper proof for their changes

stone sinew
#

wikipedia can be edited by anyone. So for most uses its not good.

tender shard
#

try to sneak a change into a wikipedia article and it'll get reverted within 2 minutes, or not approved at all

#

just try it

tender shard
stone sinew
#

There was literally a guy changing the size of a country for 2+ years on it LMFAO

eternal oxide
#

just look for politics or woke rubbish and you'll find loads, but avoid that and its good

stone sinew
#

I got craftworld to import!!!

tender shard
tender shard
stone sinew
#

Still missing other shit like JSONObject and what not.

stone sinew
tender shard
tender shard
stone sinew
stone sinew
tender shard
#

just add Gson as dependency too

stone sinew
tender shard
#

Well

stone sinew
#

I use JSON (preferably simple)

tender shard
#

when you're looking for JSONObject from older spigot versions

#

then yes, you've been using Gson

stone sinew
tender shard
stone sinew
tender shard
#

mc 1.8.3

#

well anyway, also for other json libraries: just add is as dependency when it's included in the server .jar, when not, shade it

stone sinew
tender shard
#

alright, so it includes both

#

your referenced libraries part is really annoying to see lol

stone sinew
#

Gotta support the good versions 😉

tender shard
#

yeah but why not just use modules for that, so you have a clean classpath for every NMS version

tender shard
#

I just have one jar per module. I mean how does it work with 1.17 and 1.18? or are you using the remapped versions?

#

because e.g. "playerConnection" is called "b" in 1.17 and "a.b" or sth in 1.18 IIRC

tender shard
#

oh dear I also used those nasty approaches before I just switched to modules, it's way easier imho

stone sinew
#

Not really. And 1 class is better then 12+ classes with copied code with only the versions changed.

tender shard
#

tell that again when you add 1.18 support please^^

#

It used to work fine with older versions, that's true

stone sinew
#

My minions plugin support 1.8.8 up to 1.18-rc3

tender shard
#

btw is there any already working datapack for 1.18 that adds new biomes with a custom namespacedkey?

#

it's working fine for vanilla biomes but no idea whether it also works for 1.18 custom biomes

primal sequoia
tender shard
#

what dependencies did you use?

#

looks like you were using CraftBukkit / Bukkit as dependency instead of spigot(-api)

stone sinew
#

I feel like I'm missing something... Does Gson not have a method to create a JsonObject from a map?
Closest I can get is

Gson gson = new Gson();
JsonObject = gson.fromJson(gson.toJson(Map));
```I would prefer not having to make it into a json string first.
#

Found it. toJsonTree(map) Hope this is what I want.

tender shard
#

do you need a JsonObject, or just a json string?

#

normally you can just do ```java
Gson gson = new Gson();
String json = gson.toJson(myObject);

ivory sleet
#

JsonObject::new is public fyi

stone sinew
#

The object not the string. (reply to: mfnalex)

ivory sleet
#

But anyways no they don’t have a particular method to convert a map to a JsonObject

stone sinew
#

gson.toJsonTree(Map).getAsJsonObject()

ivory sleet
#

Yes but that takes any object and tries to convert it

tender shard
ivory sleet
#

Why would it take any params

tender shard
#

because they want to have a Jsonobject representing their map and not representing emptiness

primal sequoia
#

Adventure and paper I mean

tender shard
ivory sleet
lost matrix
#

You can just throw a map into Gson. It will serialize it to json,+

west oxide
#

👀

tender shard
lost matrix
ivory sleet
#

^

#

Then check if it’s an instance of JsonObject and invoke get-as

primal sequoia
#

No clue why

#

Lemme open that one

tender shard
#

it will definitely have shown you an error message^^

primal sequoia
#

It did, lemme get it

#

It is too much for me to understand

tender shard
#

you compiled the plugin with a java version more recent than your java version the server runs

lost matrix
tender shard
#

in your pom.xml, you can change the java version inside the maven-compiler-plugin, e.g. like this:

#
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
#

and at the top inside <properties>:

#
<java.version>1.8</java.version>
primal sequoia
#

I use Java JRE 16

#

Maybe mah plugin is Java 17-

lost matrix
#

*But what you should really do is using the latest java version for your server...

tender shard
#

you compiled it using java 16, but your server is running something older

primal sequoia
#

My server is runnning 16

tender shard
#

oh sorry

#

I misread

primal sequoia
tender shard
#

yeah you compiled using java 17

#

and try to run it on java 16

primal sequoia
#

It's been on 16-

tender shard
#

you should compile with java 8 (if you want to support older versions), or java 16 if you need MC 1.17+, or java 17 ir you only need MC 1.18+

tender shard
lost matrix
#

Java 16 uses major version 60
Java 17 uses major version 61

primal sequoia
#

With my host, I go to start it and it says to update but then it don't update bruh

#

there we go

tender shard
#

?

primal sequoia
#

That is in console

tender shard
#

pls answer this: is this a public you code just for you, or for the public

primal sequoia
#

it says the java version

primal sequoia
tender shard
#

for 1.18+ only? for 1.17+ only? or for older versions too?

primal sequoia
#

1.17.1+

tender shard
#

okay then compile it using java 16

#

that means

#

on YOUR PC

#

run java 16 to compile it

lost matrix
#

Then compile with java 16 and spigot 1.17+ and tell everyone that uses old java/spigot versions to fk off.

primal sequoia
#

i might be a slight idiot

#

lol

tender shard
#

or better: let maven handle it. I already posted something about it above

#

we also still don't know whether you're using maven, or gradle, or neither

primal sequoia
#

maven on one thing

tender shard
#

but that would be important to know so we can tell you how to change the java version of your compiler

#

okay show your pom.xml pls

#

?paste

undone axleBOT
primal sequoia
tender shard
#

you literally have "17" inside the pom

#

instead of 16

primal sequoia
tender shard
#

change "maven.compiler.source" and "maven.compiler.target" to 16

primal sequoia
#

i cannot understand stuff usually-

tender shard
#

change those numbers from 17 to 16

#

also, how are you building the .jar file? what exactly are you doing to let it create a .jar file?

patent horizon
#

pressing the play button at the top right corner is the only right answer sunglas

tender shard
#

cough

misty current
#

what am I supposed to use in 1.8 to send titles if the only method is deprecated?

#

packets?

quaint mantle
misty current
#

only one is this

tender shard
misty current
#

1.8

tender shard
#

you are on 1.8. You can safely ignore EVERYTHING that says deprecated

quaint mantle
#

Then cry and use deprecated method

#

unless it doesnt work

tender shard
#

also it's not deprecated because it wasn't subject to being removed, but because "API subject to change"

#

it was basically deprecated because the method was a draft

misty current
#

aight i'll try to use it

#

else packet time

dense shoal
#

I was on a server a couple weeks ago that claimed that they could ban you via hardware id. Up until this point, I was unaware that this was possible since Minecraft didn't send hw info. Am I wrong? I can't find a tutorial on how to get this, but the server seemed pretty convinced this was possible.

#

And if this is possible, I want to integrate this into something lol

tardy delta
#

Hardware id

#

😳

dense shoal
#

Gotcha, thank you for confirming my beliefs

twin venture
#

hi i need help , why this is not updating every 5 seconds? there is no errors in console .. its just happend only when the server startup ..

runic mesa
#

How do i remove an items itemmeta

tender shard
#

ItemStack#setItemMeta(null)

#

well it seems like the file is being used by another process 😄

#

are you on windows?

stone sinew
tender shard
#

maybe you still have some process open that locked the file

#

stupid solution, but a reboot will fix it

#

or you find the process that "locked" the file and kill that one

stone sinew
stone sinew
tender shard
#

what line exactly is throwing that exception?

waxen plinth
#

Windows cringedows

stone sinew
waxen plinth
#

It's possible you have some other code that is trying to open the file

#

And you never close it

tender shard
#

any reason why you're not using try-with-resources btw?

#

it will automatically handle closing the resources

#

no idea whether it helps, but try this

#
        try(InputStream inp = this.getClass().getClassLoader().getResourceAsStream(filename)) {
            Files.copy(inp, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
        } catch (IOException e) {
            e.printStackTrace();
        }
#

because right now, if Files.copy throws an exception, inp is never closed

stone sinew
tender shard
#

but it only happens for the last file, right?

stone sinew
tender shard
#

oh okay

#

are you sure you never opened any of those files already in your code somewhere else?

stone sinew
#

I'm sure.

tender shard
#

then I have no idea

stone sinew
#
public static void main(String args[]) {
    ConfigManager().get().setupFiles();
}
tender shard
#

hugh? What's ConfigManager()? a static method?

runic mesa
#

I have a prepareanvilevent, when i set the result it shows up but i cant take it out

vague oracle
#

If you mean it gives you original item I think you need to listen to another event

stone sinew
#

@tender shard I've even added a 10ms delay and I still get the error.

tender shard
#

you MUST have a process that has the file open

#

you probably can't. You'd have to create the sound manually, or send a fake block to the player at the same time the noteblock plays

lost matrix
#

cant you just make the ConfigManager singleton a constant?

private static final ConfigManager INSTANCE = new ConfigManager();
public static ConfigManager get() {
  return INSTANCE;
}

Unless you need it to be lazily initialised for some reason.

tender shard
runic mesa
tender shard
stone sinew
vague oracle
#

Then you are cancelling the inventory click event

stone sinew
runic mesa
tender shard
#

you got an example code that I can try?

stone sinew
runic mesa
#

I didn't have a repair cost, i set one and it works

stone sinew
#

Even after restarting my pc I get that error.

lost matrix
# twin venture

How does the task update the boards? How does this task obtain instances of your scoreboards?

tender shard
stone sinew
grim ice
#

can I use a minecraft server to launch a discord bot

#

with JDA

tender shard
grim ice
#

LMAO

#

Epic

#

i did smth similar once