#help-development

1 messages · Page 573 of 1

livid dove
#

I thought the rule of thumb was rule of 3?

tardy delta
#

dunno what you are on

livid dove
fluid river
#

nobody really cares tho

#

you can have as much params as you like, unless they slow the code down

#

and make it unreadable

tardy delta
#

parameters always slow the code down 🤡

fluid river
#

i mean yeah, you can erase label completely

#

it's literally useless

tardy delta
#

but then you dont know what alias is being used 🤡

#

dunno wheres thats useful for but whatever

fluid river
tardy delta
#

maybe for echoing the command usage back

fluid river
#

you'd better move aliases to the command parameter ig

tardy delta
#

command contains the aliases yes, but without extra param you dont know which alias is being used

young knoll
#

Alias is used by essentials

#

For stuff like gm1 gm2 gm3

fluid river
#

I mean isn't Command object constructed when onCommand is getting called

#

or it's predefined

#

and you just toss it from cache to the method

#

like you can just have an alias field if object is constructed with the onCommand call

#

so you do like command.getAlias()

#

and if the default command is used, it will just return the command name

#

or null

#

but i don't know the logic behind onCommand so

eternal oxide
#

so the alias if it was used

tardy delta
#

ye ik

eternal oxide
#

sorry that was the wrong ping

tardy delta
#

still wondering how id get rid of that offset, its only 0 in the first iteration, then it changes to 1

#
Tokenizer paramTokenizer = this;
do {
    int posOffset = paramTokenizer == this ? 0 : 1; // TODO: only 0 for first iteration, avoid branch
    paramTokenizer = paramTokenizer.branchOff(Utility::isValidArgument, paramTokenizer.pos + posOffset);
    parameters.add(paramTokenizer.readTokens().solve());
} while (paramTokenizer.peek() == ',');```
#

lemme sent it like this

#

could do it like my old code but that looks kinda scuffed

//            Tokenizer paramTokenizer = branchOff(Utility::isValidArgument, pos); // position them to read the first parameter
//            parameters.add(paramTokenizer.readTokens().solve());
//
//            while (paramTokenizer.peek() == ',') { // extra param coming
//                paramTokenizer = paramTokenizer.branchOff(Utility::isValidArgument, paramTokenizer.pos + 1); // + 1 to consume comma
//                parameters.add(paramTokenizer.readTokens().solve());
//            }
//            pos = paramTokenizer.pos;```
tender shard
tardy delta
#

your data now belongs to the CCP

tender shard
#

nice, it does work

#

ok this makes more sense

young knoll
#

Why do you use strings for true false

silent steeple
#

whats the method to add something to an inventory but if its full drop the item instead of replacing

young knoll
#

addItem will return a map of what it can’t add

vast ledge
young knoll
#

Which you can then use to drop

young knoll
#

A byte is going to be a bit smaller

vast ledge
#

idk

#

Is that YML

#

or

#

what is that even

#

it aint json

remote swallow
#

it is yml

vast ledge
#

I havent used yml in a while

#

xD

vernal sluice
#

Hi, I tried to build a 1.8.8 version using BuildTools and encountered an error with org.codehaus.mojo:animal-sniffer-maven-plugin, which caused a build failure. Here is the complete error message:

Compiling CraftBukkit
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< org.bukkit:craftbukkit >-----------------------
[INFO] Building CraftBukkit 1.8.8-R0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ craftbukkit ---
[INFO]
[INFO] --- scriptus:0.2:describe (default) @ craftbukkit ---
[INFO] Set property "describe" to "git-Bukkit-741a1bd"
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ craftbukkit ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ craftbukkit ---
[INFO] Changes detected - recompiling the module!
[INFO]
[INFO] --- animal-sniffer-maven-plugin:1.13:check (default) @ craftbukkit ---
[INFO] Checking unresolved references to org.codehaus.mojo.signature:java16:1.1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.078 s
[INFO] Finished at: 2023-06-19T22:42:08+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:animal-sniffer-maven-plugin:1.13:check (default) on project craftbukkit: Execution default of goal org.codehaus.mojo:animal-sniffer-maven-plugin:1.13:check failed.: IllegalArgumentException -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
Exception in thread "main" java.lang.RuntimeException: Error running command, return status !=0: [D:\D▒veloppement\Minecraft\Spigot\Neisis 1.8.8\apache-maven-3.6.0/bin/mvn.cmd, -Dbt.name=582a, clean, install]
        at org.spigotmc.builder.Builder.runProcess0(Builder.java:1062)
        at org.spigotmc.builder.Builder.runProcess(Builder.java:993)
        at org.spigotmc.builder.Builder.runMaven0(Builder.java:962)
        at org.spigotmc.builder.Builder.runMavenServer(Builder.java:931)
        at org.spigotmc.builder.Builder.main(Builder.java:731)
        at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)
wet breach
#

also known as java 1.8

tender shard
#

also IIRC you must not have spaces in the build apth

young knoll
#

What the heck is a maven sniffer plugin

remote swallow
#

animal sniffer josh

wet breach
#

its for catching errors

young knoll
#

I see

#

What a name

wet breach
#

you need it when you decompile and then what to compile again

#

it helps catch some problems before trying to compile again lol

vernal sluice
wet breach
#

so we are not guessin

vernal sluice
wet breach
#

before you do

#

did you use command prompt?

#

or did you use gitbash?

vast ledge
#

@vernal sluice

vernal sluice
#

I used everything, windows terminal, gitbash, cmd

wet breach
#

interesting

vast ledge
#

how

vernal sluice
#

Always the same problem

vast ledge
#

oh

#

that

#

ok

upbeat hornet
#

I have a right clicker listener (PlayerInteractEvent)
There is a bunch of code in it. It may causse NullPointerException etc.
But for some reason, unless it can exit the method without an error, the rest of the code doesn't run (like this sout at the very begining of the eventhandler)

Is there a way to fix that? Trying to debug rn

vast ledge
#

try catch

wet breach
#

Neisis 1.8.8

#

remove the space here

#

and then try it again

vernal sluice
#

Ok, i will try

vast ledge
upbeat hornet
#

ok

vast ledge
#

Hi Olivo 😄

chrome beacon
#

It's better to just prevent the null pointer to begin with

vast ledge
#

yea

#

but it can happen if you try to get a block that is null

chrome beacon
#

Why would you recommend a try catch instead of just an if statement

vast ledge
#

yea, he could just do if(block == null)

#

I dont know where his error is

vast ledge
#

he just sent 1 line of code

#

I cant do much with that

#

an error would also be nice

upbeat hornet
noble lantern
#

Whats wrong with my SHA-1 hashing for resource packs? I put the file from the variable in an online checksum and its fine (and my logs in minecraft match the online one)

But when I run this code the SHA-1 never matches the clients... (expected be5e06ed13636196ca94c1c661a9c00f6eafe5d8, found 0c8e074b3341d871d86938d4c30965e9331cff83)

vast ledge
#

?paste

undone axleBOT
vast ledge
#

@upbeat hornet

upbeat hornet
#

ok...

chrome beacon
vast ledge
#

idk

#

he said he keeps getting a nullpt

#

wat

#

how

#

do you know

#

then

#

bruh

upbeat hornet
upbeat hornet
vast ledge
#

Ok

#

then send me the error?

upbeat hornet
#

there's no error

#

console is empty appart from my print

vast ledge
#

Then how do you know

#

theres an error

noble lantern
upbeat hornet
#

because code doesn't execute

vast ledge
#

Then make debug messages

chrome beacon
#

Which code doesn't execute

upbeat hornet
#

That's what I tried...

vast ledge
#

Does the rightclick event trigger at all?

upbeat hornet
#

oh wait cant screenshare

vast ledge
#

And what is ur if nesting

#

it hurt my eyes

upbeat hornet
#

i know I have a problem with that

chrome beacon
#

You probably forgot to register the listener if the sysout in the screenshot doesn't fire

vast ledge
#

Yea

upbeat hornet
vast ledge
#

never reload

upbeat hornet
#

I could explain in screenshare

vast ledge
#

restart

#

reloading isnt good

#

it breaks shit

upbeat hornet
#

reloading fixes my shit

#

for the oddest reason

vast ledge
#

So everything works now?

upbeat hornet
#

well no

#

because people aren't gonna reload every single time they want to play

#

and it only works one time

vast ledge
#

Ok

upbeat hornet
#

you need to :

  • start
  • reload
  • do the thing
  • reload
  • do the thing
  • ...
vast ledge
#

what happens on a reload

upbeat hornet
chrome beacon
#

Now troubleshoot from there

#

We don't have enough information to help you

upbeat hornet
#

commenting line #82 on Meteorite.java fixes partially everything

vast ledge
upbeat hornet
#

what's your string?

#

Because in my plugin I have done exactly this

vast ledge
#

I just have a normal Json string

#

i can try printing the raw string gimme a sec

upbeat hornet
#

I can reconstruct a HashMap<String, ArrayList<Integer>> from this:

{
  "uwu": [
    [
      -18,
      64,
      -8
    ]
  ]
}
vast ledge
upbeat hornet
#

https://github.com/xef5000/EventMaster/blob/master/src/com/xef5000/EventMaster/Utils/Managers/MeteoriteManager.java

Take a look at line 67 where I flush my memory to json
line 34 where I retrieve the json file and reconstruct a hashmap

GitHub

EventMaster is a spigot 1.8.8 plugin that manages all sorts of events for minecraft servers - EventMaster/src/com/xef5000/EventMaster/Utils/Managers/MeteoriteManager.java at master · xef5000/EventM...

chrome beacon
#

?conventions

chrome beacon
#

^ you should follow these

upbeat hornet
#

me or them?

chrome beacon
#

You

upbeat hornet
#

where?

#

for my class/package name?

chrome beacon
#

Package names

upbeat hornet
#

shouldn't be capitalized, right

sweet sonnet
#

Whats the best way to go about making a config reload command?

vast ledge
#

yea

vast ledge
#

from the file

sweet sonnet
#

I know how, just wondering what others do regarding the command

upbeat hornet
sweet sonnet
#

like do they make a command with the name of the plugin then have reload as an argument?

sweet sonnet
vast ledge
#
[INFO] {"Settings":{"MongoDB":{"Encrypt-Pass":true,"Settings":{"Username":"*******","Database":"*****","Server-Link":"********.******.*******.***","Password":"*******************"}}}}
upbeat hornet
vast ledge
#

I brokey my JSON Config lib it aint saving anymore gimme a sec

wet breach
vernal sluice
wet breach
#

not sure why you would be having that problem unless you have some kind of bad version in your maven repo for the maven plugins

#

maybe try removing that from your maven repo and see if it downloads it appropriately

vernal sluice
wet breach
#

your local maven repo is located in your user directory

#

so got to C:\ then windows, then users, then find your username click that

#

and then you should see a directory called .m2

vernal sluice
#

Ok i found it

wet breach
#

alright you are going to navigate to the org directory

#

then after that to codehaus

#

then delete the one that says mojo

vernal sluice
#

I need to remove only org.codehaus.mojo.animal-sniffer?

wet breach
#

yeah

vernal sluice
#

Done, i restart build

wet breach
#

now lets see if redownloading that fixes your problem lol

#

maven should automatically do that

#

because I can't see from the build log in why you would be having issues with that =/

#

typically that isn't even something someone has issues with

vernal sluice
#

same error

wet breach
#

try with a different build tools version

vernal sluice
#

Maybe a problem with the version of the library, I don't know

wet breach
#

its 1.8.8, nothing has changed XD

vernal sluice
#

Yeah i know x)

#

I try with 1.12.2

wet breach
#

well that will most likely work

tender shard
#

intelliJ doing the most useless quickfix again

upbeat hornet
#

what's the difference between accessing a private field (from an object, inside the object)

vernal sluice
eternal oxide
#

nothing. readability

#

or context. you can have Class scope and method scope

sweet sonnet
upbeat hornet
#

In both cases I'm refering to the object's scope

onyx fjord
#

what does Bukkit#broadcastMessage do under the hood?

tender shard
tender shard
upbeat hornet
#

in this example this.holograms and holograms is the same right?

tender shard
tender shard
sweet sonnet
next zinc
#
@EventHandler
    public void onBlockBreak(VehicleDestroyEvent event) {
        Vehicle vehicle = event.getVehicle();
        if(vehicle instanceof Boat) {
            Boat boat = (Boat) event.getVehicle();
            
            Bukkit.broadcastMessage("boat");
            
            boat.getLocation().getBlock().getDrops().clear();
            boat.getWorld().dropItemNaturally(boat.getLocation(), itemDictionary.getDinghy());
        }
    }

Any reason why its not clearing the regular boat drop?

chrome ferry
#

how would i create a premium buyer checker for spigot?

tender shard
tender shard
tender shard
#

usually you can assume someone bought it if they have the .jar lol

chrome ferry
#

yeah i mean i just want to verify it via a spigot user id tbf

sweet sonnet
upbeat hornet
#

Do you guys listen to music while programming?

tender shard
#
private String spigotUserId = "%%__USER__%%";
private char[] spigotUserIdChars = {'%','%','_','_','U', /* etc */, '%'};

public boolean isValidUser() {
  return !spigotUserId.equals(new String(spigotUserIdChars));
}

sth like this will check if it actually got replaced. That way it returns false when compiling it yourself, but true if it was downloaded from SpigotMC

#

@chrome ferry

chrome ferry
#

im not doing it via a plugin ahaha

#

its via discord bot

sweet sonnet
tender shard
#

then I'm not sure what you're trying to do

sweet sonnet
tender shard
#

you e.g. want to check whether user 123456 bought plugin 98765?

chrome ferry
#

yeh

#

obviously i own the plugin via my spigot

tender shard
#

that will only work if you have the credentials of either the author of the plugin, or the credentials of the buyer, and then you gotta scrape the cloudflare-protected spigotmc website. There's libraries to avoid cloudflare's protection but they usually break every other week

upbeat hornet
#

NAHHHHHH BRO

I was debuging my code for around 2h and the fix was to remove a line that produced a nullpt onEnable. It was in the console but I ignored it for 2 hours
🙂 🔫

chrome ferry
upbeat hornet
#

have you registered it?

next zinc
#

yep no error

#

It still drops the vanilla drops but also drops the item I itend it to drop

upbeat hornet
#

Ohh

young knoll
#

Why would clearing the drops of the block stop the boat from dropping

upbeat hornet
#

you are doing that on the block

young knoll
#

Ignoring the fact that block.getDrops is a clone

next zinc
#

Well I didnt see any method to get the boat vehicle drops itself

upbeat hornet
#

Yeah you are removing the drops of the block it is on

young knoll
#

You probably can’t via that event

#

There’s the ItemSpawnEvent though

upbeat hornet
young knoll
#

You’d have to keep track of the location

#

Ah yeah you could in theory also just .remove the boat

upbeat hornet
#

😄

next zinc
#

I'll try both ideas then

upbeat hornet
#

Only do one 💀

next zinc
#

yep

eternal oxide
#

a Boat is an entity so perhaps check the EntityDeathEvent

next zinc
#

yours worked xef lmao

#

i appreciate the help tho

cold pawn
#

Hey there 👋 I'm trying to create a packet that sets the armor of an npc when it's created, I did some online searching and looked at the packets wiki and came up with the code below. Everything goes through and I don' t revieve an error in console, but the armor does not show up on the npc. I'm using 1.18.2 so I don't know if anything changed packet wise. Any solutions? (Using protocolLib BTW)

upbeat hornet
#

a packet?

cold pawn
#

Yes a packet

upbeat hornet
#

Why would you need a packet? Can't you use built-in methods?

young knoll
#

In that screenshot you are using air

#

Obviously air doesn’t render when worn as armor

cold pawn
#

yes, if the item is null

#

Get a NullPointer without it

young knoll
#

I see

#

And you’ve got the items in the correct order

#

And they are actually armor items

cold pawn
#

Yes manually set the armor in code

#

and i've made sure im actually wearing armor in-game 😅

upbeat hornet
#

can you show me the class where you spawn the npc?

sweet sonnet
cold pawn
#

Thats were I set the armor for the npc

upbeat hornet
#

that will spawn a dead body

cold pawn
#

Yeah

#

It's really just an npc in the sleep pose

hard socket
#

how do I shoot dragon breath? do I use DragonFireball class?

mortal hare
#

i have architectural question

#

lets say i have dimensions of the table

#

and the position of the cursor inside the table

#

should i make separate methods to get the specific axis of the dimension coordinate

#

or instead i should return Position and Dimension object

#

returning object seems pretty much solid

#

except for a fact that now im copying two fields at once

#

when I dont need one or the other in some purposes

#

getX(), getY() can be cumbersome to add to all classes separately

#

but at the same time, whenever i need one field i get one field, whenever i need two i call both methods

pseudo hazel
mortal hare
#

principle

pseudo hazel
#

dry my ass

#

they both have a clear purpose

#

typing getx and gety constantly will repeat yourself so if you dont want that then go for the object

#

but then your memory copies wont be micro optimized i guess

#

I would just do both and call it done, then you have the answer for every case

#

dry or wet

#

I mean thats if you want usable code anyways..

eternal oxide
#

raising the event only notifies other plugins you want to alter the health

#

it does no more than that

#

if after callEvent it's not cancelled you should apply the healing yourself

vernal sluice
#

You need something like p.setHealth(health);

young knoll
#

Does calling setHealth raise the event automatically?

eternal oxide
#

I don;t believe so

vernal sluice
#

if EntityRegainHealthEvent is a custom event, no

eternal oxide
#

its custom when you raise it yourself

tender shard
vernal sluice
#

You just need to add the new player health after calling the event

remote swallow
#

you should do if it isnt cancelled

vernal sluice
#

Yeah, but what create an custom event for that?

young knoll
#

It’s not custom

remote swallow
#
EntityRegainHealthEvent entityRegainHealthEvent = new EntityRegainHealthEvent(player, (player.getMaxHealth() - player.getHealth()), EntityRegainHealthEvent.RegainReason.CUSTOM);
        Bukkit.getPluginManager().callEvent(entityRegainHealthEvent);
if (!entityRegainHealthEvent.isCancelled()) player.setHealth(stuff);
vernal sluice
#

Oh it's in 1.20 ok

#

I rarely develop above 1.12

remote swallow
#

smh

#

it was added way back in 2011

tender shard
#

I'd kill myself if I couldn't use at least 1.16.3

young knoll
#

Then it’s probably in 1.12

vernal sluice
#

It's not an event I need so I never paid attention to it

hazy parrot
#

we need some context

#

you dont need to update if player is above limit if he is not moving right

teal kindle
#

Is there a way to get the entity that damaged another entity through a sweep attack? I tried browsing the forums on this, and it seems that the only event called when an entity is damaged by a sweep attack is EntityDamageEvent, not (somewhat strangely) EntityDamageByEntityEvent, which would have the methods I'm looking for.

#

Another solution appeared to have used a global map. I could do that, but I'm wondering if there's a cleaner API solution

young knoll
#

That’s not really what villagers are for

#

But you can probably use the inventory click event to set the output when you place the input

#

You should be able to get the entity via the holder

#

You have the entities inventory

#

It’s the one you click on

remote swallow
#

check if the entity type is villager and cast it

#

or use pdc

young knoll
#

Get the holder of the inventory

#

If it’s a villager, check if it’s your villager

quaint mantle
#

hello mates

#

Having a little issue with setDamage

young knoll
#

?ask

undone axleBOT
#

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

high pewter
#

By default, an item is just {id: "minecraft:...", Count: 1b} and if I add lore to it it becomes {id: "minecraft:...", tag: {display: {Lore: [...]}}, Count: 1b} but if I then remove that same lore by doing, for example, ItemMeta.lore(Collections.emptyList()) then it still leaves behind {id: "minecraft:...", tag: {display: {Lore: []}}, Count: 1b} so the item still shows the NBT: 1 tag(s) tooltip. It's a minor annoyance, but I'm curious how I can prevent/fix this?

young knoll
#

Try setLore(null)

#

Since it’s nullable

high pewter
#

Oh that makes sense! I'll try it, thanks 😄

#

Yup, that works! Thanks again!

quaint mantle
#

STATUS: Unresolved
So I have a custom enchantment which when procs doubles the attack damage. My method to set damage is

    public static void increaseEventDamage(double amount, EntityDamageByEntityEvent event) {
        event.setDamage(event.getDamage() * amount);
    }//increaseEventDamage

but the output of the damage with armor is messed up. If the player is naked the double'd damage scales fine. But if the player is wearing normal diamond armor (also occurs with other armors) without enchants i get a value that is not double...

https://prnt.sc/tybAIJgUf5yv

As you can see the first attack where is normal damage gives off 0.8 damage
And the second attack where the enchantment is in effect gives off 2.09 damage

But the raw damage is doubled between the first and second attack.

young knoll
#

Does the same occur with iron armor

quaint mantle
#

let me check

young knoll
#

Diamond armor has armor toughness which helps more against stronger attacks

neon nymph
#

Do all entities have the same default walk speed for the player, which is 0.2?

young knoll
#

No

neon nymph
#

I see, thanks

young knoll
#

That may just be how armor protection works

#

I don’t believe there is a way to set the final damage directly either

quaint mantle
#

idk if this is a minecraft thing or something on my side

#

I know protection does have a random variable in it to calculate damage taken

#

without armor is works fine. With armor I start having the issue.

quaint mantle
#

I've done some more testing and found that tools that do the same damage by vanilla minecraft give off the same amount of damage my tools when the enchant is active.

Still confused why there seems to be some other factor with calculating damage with armor

young knoll
#

I think it’s just higher damage gets reduced less

opaque scarab
#

I’m developing an ambient sound plugin, and I’d like to have spore blossom particles falling from trees. I feel having dozens of particles consistently being spawned could be somewhat taxing. I’m guessing spore blossom particles from the block aren’t spawned server side, but are when the client detects them. Would actually placing the spore blossom on trees be drastically more efficient? I can make them invisible through the resource pack.

young knoll
#

I believe they are fully client side, yes

#

But just having an async task spawn them isn’t going to kill the server

worldly ingot
#

tbh neither would a sync one

opaque scarab
young knoll
#

Still not a big deal

#

All the method does is send a packet

noble lantern
#

Is there any other way to update resource packs without hash's?

#

Im actually fed up with this shit at this point

#

?paste

undone axleBOT
noble lantern
#

Class im using to zip file on my server: https://paste.md-5.net/wuwunofupe.java
How im using the class: https://paste.md-5.net/opewegeher.java

After its zipped its left in its directory and i have Spark serving the folder as a static resource for the resource pack

After the server is started, and queued players from my player join event get sent the rest servers link to where the resource pack gets hosted at, i also provide the hash as it needs to be able to be updated, here is how im calculating the hash: https://paste.md-5.net/equxefibov.cs

Im using apache's digest utils, but i also tried with the vanilla java way and im getting the same behaviour:

The behaviour: When i join the server after the resource pack is available, and the pack gets sent to me my client complains that the hash is INVALID File C:\Users\burch\AppData\Roaming\.minecraft\server-resource-packs\b3c641980ac1cc50c81cd5ce39255343a2104f9a had wrong hash (expected a69fa0068db5a4ae3fa57595394b1ff39630cb71, found 3adfc8a1816a85fd1e9586faed670127fd522f9a) then slightly after i get the message saying it deleted the resource pack

However, if I simply just rejoin the server I get sent the right hash: Found file C:\Users\burch\AppData\Roaming\.minecraft\server-resource-packs\b3c641980ac1cc50c81cd5ce39255343a2104f9a matching requested hash a69fa0068db5a4ae3fa57595394b1ff39630cb71

What the fuck is going on? Ive been beating myself up over this for hours now and im just so lost why the first hash is ALWAYS INVALID.

wet breach
#

Buffered input stream will typically have garbage data in it to keep the buffer open and by default i think that is 1024bytes

#

So when its requested a second time all the garbage data made it out and its just completely zip file after that

noble lantern
#

So how could i make it not add the garbage data into it for the first time? Or should i just use raw input streams and see how that works

wet breach
#

Grab the file size and then use that size to make the buffer exact same

#

And then it should just contain nothing but the zip

#

If that doesnt work i would try raw input stream

#

Or just sha1 the file from file method lol

noble lantern
wet breach
#

No you are doing it from the stream

noble lantern
#

changing it rn to do the buffer thing you told me, but this is what i was trying all last night (before trying the apache lib)

wet breach
#

Instead just toss the file object in there

#

Have no idea from a glance in what you were trying lol

#

Ok you were sha1'ing each index in the array

#

That can work but only if bits end up in proper order and didnt have any uneven bits

#

Which i guess offset was supposed to handle that i assume

noble lantern
#

no idea tbh

#

idk how any of this sha1 works nor coud i rly care im just trying to find something that works lmao so i was just copying/pasting sha1 methods

wet breach
#

Lol

noble lantern
#

stupid that it needs a sha1 to tell the client to update the pack imo

#

client should be able to dicpher it not the fuckin server

wet breach
#

Well the client should inform the server what it has and then server should respond with the file.

#

If what client has doesnt match

young knoll
#

There’s something called a DigestInputStream

sullen marlin
#

Or just guava hasher

wet breach
young knoll
#

Idk google gave me that

wet breach
#

Well i just go off memory

#

XD

noble lantern
#

one sec lemme try with that

#

yeah same thing with that too

#

im at a lost and honestly im just tempted to kick the player if it fails

#

it ALWAYS succeeds infinitely after the first failure

#

also appears just passing null like the docs doesnt work at all

#

So like how tf are you supposed to updates resource packs seamlessly lmao, other people do it smh

The packs have a 4mb difference but the client ignores the change 👌

#

screw it im just gonna use UUID's as the file name and force the client to entirely redownload the pack everytime they update it

#

fuck theyre storage

rough ibex
#

resource pack hashes have been broken for a long time

#

mojang has not fixed it at all

noble lantern
#

yeah tbh i had issues with this pack even in my properties file

#

it just wouldnt ever update for nothing unless i changed the name

#

i would try this on an older version but i just cba

#

even ended up just versioning the name and everytime i add a texture i just bump the version for this pack, couldnt get this one working in my properties file for nothing

somber scarab
#

how can i regenerate chunks to how they originally were?

#

just like world edit's regen command

hasty obsidian
#

Block throwing Item

heady wasp
#

It also doesn't make a database, I connected to my DB with MongoDBCompass and I had to create it myself

noble lantern
#

sec

#

hmm cant find my mongo class i use on github sorry takin me a minute

heady wasp
#

Alright

noble lantern
#

okay so about the database thing:

getDatabase does create the data yes

BUT

You need to write data into the database and then it should get created (According to the document ation online)

Reguarding document being null, which ones specifically?

#

also

heady wasp
#

Document document = NukkitCore.getInstance().getMongoCollection().find(Filters.eq("uuid", uuid.toString())).first(); This is what is null

wet breach
noble lantern
heady wasp
#

No errors, just null

noble lantern
noble lantern
heady wasp
#

Wdym

noble lantern
#

first() is null if find() is not found/empty

noble lantern
#

should look something like this

heady wasp
#

Can't because the database doesn't exist

noble lantern
#

yeah so if find() == null player doesnt exist -> inject data into database

heady wasp
noble lantern
#

and it will create the database when you inject the Document

somber scarab
#

does anyone know how many blocks far a 1 volume sound covers?

noble lantern
noble lantern
noble lantern
somber scarab
# noble lantern can you explain a lil more im confused

So im amking a minigame where there is action and i wanna add pigstep and back music to fir in with the feel. The game map is around 9 chunks in a square form so 2 chunks out in each direction.

I wanna play a sound with enough volume to JUST cover this space

noble lantern
#

if your first() result is null the data doesnt exist so just go ahead and create it

heady wasp
#

idk what you mean sorry xd my brain isn't working rn it's late for me

noble lantern
noble lantern
noble lantern
#

first() == null

the document does not exists

insert data into database, inserting the document into a database that doesnt exist will create the database

somber scarab
#

they ARE in the chunks. Always. I just need to play a sound in the middle of the map with enough volume to cover the map

#

that's why i was asking, how many blocks wide can you hear a 1 volume sound

noble lantern
#

youll just have to send and see but imo this isnt a great approach

#

it will be MEGA LOUD at the origin

noble lantern
somber scarab
noble lantern
#

youd need a large volume to cover that + theres a max iirc

#

uhh wrong one scroll down one

#

but same thing

somber scarab
#

Ill just play a sound with high volume and see.. I dont think volume means how loud the overall sound is. just how far it travels

noble lantern
#

it 100% is how loud it is

somber scarab
#

I remember testing that

noble lantern
#

i mean it called volume....

noble lantern
#
  • i use it to adjust volume with my music plugin
#

louder sound = louder origin but further away

This is how most sound engines work tbh, if your wanting to do what you do your 100% better off just getting the players chunk, if player is in chunk play sounds, and when they exit (which i doubt is possible since its a minigame until you programatically leave) stop sound

Unless you want a super loud origin point for your sound, then go for it but turn your headset down

somber scarab
#

okay..

noble lantern
#

plays would likely find it annoying though going to the center of the map only to get earraped CH_Kek

somber scarab
#

i dont mean to offend you if I still wanna test it out

noble lantern
#

go for it

somber scarab
#

exactly what i needed.

noble lantern
somber scarab
#

yes.

noble lantern
#

hmm

somber scarab
#

main.GAME_WORLD.playSound(gameBorder.getCenter(),Sound.MUSIC_DISC_PIGSTEP,100,1);

noble lantern
#

shouldnt be doing that but alright

somber scarab
#

or atleast doesnt do that

noble lantern
#

wonder if its cause its music its doing that

Normally when you play a sound at a Location it only plays for that location and outwards x blocks

somber scarab
#

all sounds really..

somber scarab
#

like water from world edit?

#

I wanna place lava that does not flow

noble lantern
somber scarab
#

just just compare locations and types....

noble lantern
heady elbow
#

is there some simple way to build a jar with gradle when trying to run the server locally in intellij and have it copy the jar to the plugins folder? I can have gradle build the jar before launch but that doesnt inject to the server after

somber scarab
#

how can i regenerate the chunks to their original vanilla form???

#

regenchunk is depricated

#

i didnt find any other solution

noble lantern
somber scarab
#

yea but when im playing in the chunk and start placing blocks and lava, the chunk IS already loaded..

#

I just wanna regenerate it when im done playing

noble lantern
#

ahh i see, while the player is in the chunk that one is gonna be tricky

#

youll likely have to create your own lil system for that with schematics or flashing the Chunk blocks and then replacing them when the game is over

somber scarab
noble lantern
#

should work on already loaded ones, if not just unload()

noble lantern
#

Whether or not to generate a chunk if it doesn't already exist

somber scarab
#

thanks

noble lantern
#

ofc ofc

#

just unsure whtether or not unload() needs to be called before or not, i feel like it may not be needed but if you run into issues try that

noble lantern
#

yee

wet breach
#

No need to worry about so called regenerating uwu

noble lantern
#

yep that ways defo faster + you can do it async for the most part unlike with regenning chunks

somber scarab
#

in the same world

#

I put a random 9 chunk square from -2999999 to 2999999 and teleport the players to it

#

after the game is done. i want those 9 chunks to be back again to their og form

#

while a game is going on. another game can start midway and end before the first, after at the same time. A third party can start playing before the second ends

#

I cant unload a world and make a new one either too resource intesive

pseudo hazel
#

maybe you can make one game happen per region and then just remove the region after

somber scarab
#

also weird question... how do I make a runTaskTimer stop itself from within?

#

a simple timer

#
        Bukkit.getScheduler().runTaskTimer(main.main, new Runnable() {
            int countDown = 3;
            @Override
            public void run() {
                if(countDown <= 0){
                    Tools.announce(joinedList, ChatColor.AQUA + "Teleporting...");
                    new GameLobby(Tools.getLobbyFromOwner(OWNER).joinedList,OWNER);
                    InviteLobby.INVITE_LOBBY_LIST.remove(Tools.getLobbyFromOwner(OWNER));
                    //STOP HERE
                }
                Tools.announce(joinedList,ChatColor.RED + "Game starts" + ChatColor.RESET+ " in " + ChatColor.AQUA + countDown);
                countDown--;
            }
        },0,21L);
pseudo hazel
#

cancel()?

somber scarab
#

i tried that.. doesnt exist

pseudo hazel
#

well you are using a runnable

#

not a bukkitrunnable

somber scarab
#

ACH

#

okay

chrome beacon
#

Use a lambda with a task

somber scarab
#

thanks

chrome beacon
#

BukkitRunnable is deprecated in the scheduler

#

Bukkit.getScheduler().runTaskTimer(main.main, (task) -> task.cancel(), 0, 21L);

#

Also main.main 💀

somber scarab
#

okay...

somber scarab
chrome beacon
#

?main

chrome beacon
#

?di

undone axleBOT
somber scarab
#

i didnt think about that

tardy delta
#

if only those rust enums existed in java lol

winged anvil
#

lmao not the custom result

#

ive been reading the rust book and i absolutely love everything so far

tardy delta
#

made me realize that Optional is also poorly implemented

winged anvil
#

thats what I said

tardy delta
#

instead of two classes they just do the checking at runtime

winged anvil
#

but the optional type i dont think would work as well in rust if it didnt have its exhaustive match expressions nor the pattern matching with the if let Some

#

like thats what makes it mwah

tardy delta
#

we have a stupid ifPresent

winged anvil
#

yeahhhh

tardy delta
#

cant afford doing checks at runtime

tardy delta
#

even c++ has std::variant :(

#

i always laughed at them but their newly added stuff is quite good

winged anvil
#

also being able to implement behavior for types external to your own project is wonderful

#

no more wrapper

tardy delta
#

i love it

#

i believe the rust haters are still sleeping

wet breach
#

You can have multiple games going in multiple worlds this is fine, just append a unique id to each new game world

somber scarab
#

lags the server till death

wet breach
#

Well need to start planning some upgrades lol unfortunately cant do everything. Anyways your only alternative is to use schematics with a custom plugin

#

You would just paste in the schematic in that spot and voila

wet breach
#

Could even optimize the schematic pasting by not overwriting thr block if its the one that needs to be there

#

But yeah that seems your only option at this point

#

But do plan for upgrading lol

#

Because at this rate you are going to need it and it will make things easier for you

somber scarab
vernal sluice
noble lantern
#

some plugins have some extra steps

rose trail
#

is there any way to get messages from the server console?

noble lantern
#

like Headdatabase you need to listen to theyre HeaddatabaseInit event before you can use theyre api

green prism
#

Hello there, I have a quick question: How can I determine if the person setting off the fireworks is a Player?

    @EventHandler
    public void onInteract(FireworkExplodeEvent event) {

        if (!(event.getEntity() instanceof Player player)) return;

        if (player.getLocation().getWorld() != PlayerUtil.getSpawnLocation().getWorld()) return;


        player.sendMessage(Translator.translate("&4You cannot do this at spawn."));
        player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(Translator.translate("&4You cannot do this at spawn.")));

        event.setCancelled(true);

    }
noble lantern
noble lantern
rose trail
#

I need to forward messages from the console

somber scarab
noble lantern
#

will be useful for you

somber scarab
#

thankss

green prism
noble lantern
green prism
#

This was my previous code:

    @EventHandler
    public void onInteract(PlayerInteractEvent event) {

        if (event.getItem() == null) return;
        
        if(!event.getAction().equals(Action.RIGHT_CLICK_AIR) && !event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) return;

        if(event.getPlayer().getLocation().getWorld() != PlayerUtil.getSpawnLocation().getWorld()) return;

        if (event.getItem().getType() == Material.FIREWORK_ROCKET && event.getAction() == Action.RIGHT_CLICK_AIR) {
            Player player = event.getPlayer();

            player.sendMessage(Translator.translate("&4You cannot do this at spawn."));
            player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(Translator.translate("&4You cannot do this at spawn.")));

            event.setCancelled(true);
        }
    }
noble lantern
green prism
#

aw shit

noble lantern
#

use the or operator for that one so both always fire :)) || clickTypeRightBlockHere

green prism
#

Thanks!

somber scarab
#

@noble lantern Why does my intellij say the dependency in my POM is wrong?

somber scarab
#
        <dependency>
            <groupId>com.sk89q.worldedit</groupId>
            <artifactId>worldedit-core</artifactId>
            <version>7.2.0-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
noble lantern
#

use worldedit-bukkit

somber scarab
#

same...

#

id send a pic but IM NOT FKN VERIFIED

#

@undone axle

#

dumass

noble lantern
#

seems that version dont exist

#

do 7.2.9

#

oh it does

#

still, use more recent :p

somber scarab
#

i used 7.3.0-SNAPSHOT

#

still red... wtf

noble lantern
#

dont use the snapshots use the prime versions

#

snapshots are actually older

somber scarab
#

huh, they're all snapshots

#

in the link

noble lantern
#

7.2.9....

somber scarab
#

nvm

#

im blind

noble lantern
#

xD

#

doubt it may fix the issue though but still good to use the most recent one thats not a snapshot

somber scarab
#

okay.. i dont think changing anything there will fix it

noble lantern
#

make sure to add the repo as well

somber scarab
#

it has to be something else

#

i did

noble lantern
#

send whole pom?

somber scarab
#
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>floorIsLava</groupId>
    <artifactId>floorIsLava</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>Floor Is Lava</name>

    <description>You and your friends are trapped in a world where lava will rise till only one survives! Who will it
        be?
    </description>
    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <plugins>
            <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>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

    <repositories>
        <repository>
            <id>spigotmc-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/groups/public/</url>
        </repository>
        <repository>
            <id>enginehub-maven</id>
            <url>https://maven.enginehub.org/repo/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.20-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.sk89q.worldedit</groupId>
            <artifactId>worldedit-bukkit</artifactId>
            <version>7.2.9</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</project>
noble lantern
#

hmm works for me weird

#

i doubt this but

#
        <repository>
            <id>sk89q-repo</id>
            <url>https://maven.enginehub.org/repo/</url>
        </repository>
``` maybe its the repo ID

doubt it though but ***random bullshit go***

After this try invalidating intellij caches if it still doesnt work
#

?paste

undone axleBOT
noble lantern
somber scarab
#

hm...

somber scarab
#

the cache thing

noble lantern
#

top left -> File -> Invalidate Caches

somber scarab
#

huh

#

worked

#

no longer red

#

so NOW my plugin will not load unless worldedit 7.2.9 is running

noble lantern
#

any world edit version should be fine, dev and client versions are diff sometimes

#

as long as its somewhat modern

#

theyre api is pretty consistent like bukkit/spigots

somber scarab
#

oh okay cool

noble lantern
#

or like classes randomly stop importing

noble lantern
#

its locked for verified users so icant ping it

somber scarab
#

org.bukkit.plugin.InvalidDescriptionException: depend is of wrong type

noble lantern
#

try depends maybe

#

nope

#

its depend

somber scarab
#

yea

noble lantern
somber scarab
#

wait

noble lantern
#

should be a string list like this (ignore softdepend its just what im using)

somber scarab
#

oh space between -

noble lantern
#

yeh

noble lantern
#

alr then

#

leftover code go brrrt

somber scarab
onyx fjord
#

can i make IJ enforce this. prefix when its possible on formatting for consistency?

somber scarab
#

is there anywhere else i can learn them from?

onyx fjord
noble lantern
#

It DOES automaticallly do

#

SomeClass.this :p

#

but thats in some werid lambda cases

subtle folio
#

🐑da

noble lantern
#

thats what i do

#

well "borrow"

#

i just look at open source projects that do what i wanna do and see how they do it

#

like the other day i discoevered world guard has its own events and you dont cancel bukkit events for the flags you make

noble lantern
#

goat dad?

subtle folio
#

lamb bro

noble lantern
#

OH

#

LMAO

subtle folio
#

this is what happens when you develop musepluse for 4 days straight

#

better get atleast 1k downloads

noble lantern
#

it will be another 3 days

#

having some maaaajor api issues with hashes + resource packs not workin

#

so having to wedo some file structuring

#

i feel so fried from dealing with all this in java

somber scarab
#

so far i know now how to select a region and fill it with blocks

#

@noble lantern for some reason intellij doesnt highlight errors when made with world edit API calls

karmic mural
#

I'm going travelling and not sure if I will have internet... With that said I wanted to create an offline copy of the docs so I can still work and access docs if needed. I tried following the guide on spigot website but I got stuck on running the command. I'm not sure what parts of the command to replace with filepaths, and what those filepaths I'm putting there should lead to. Any insight is greatly appreciated. https://www.spigotmc.org/wiki/creating-offline-javadoc-for-the-spigot-api/#wikiPage

somber scarab
#

actually.. no hightlights at alll

vernal sluice
# vernal sluice Someone can help me?

I solved the problem, for those who also have this: I cleared my entire maven repo (I had already tried to simply delete the library in question, it did not change anything)

rose trail
#

how to capture server console logs?

tender shard
#

attach a custom filter to the bukkit logger

#

or an appender

rose trail
#

how :^

#

i tried but nothing worked

full glade
#

How to disable the ability to fish for custom mobs(dolphins)? Spigot 1.20

somber scarab
#

does anyone know WorldEdit's API??

#
        EditSession editSession = WorldEdit.getInstance().newEditSession(BukkitAdapter.adapt(FloorIsLava.GAME_WORLD));
        Region region = new CuboidRegion(BukkitAdapter.adapt(FloorIsLava.GAME_WORLD),
                BlockVector3.at(gameStartLoc.getX(), gameStartLoc.getY(), gameStartLoc.getZ()),
                BlockVector3.at(gameEndLoc.getX(), gameEndLoc.getY(), gameEndLoc.getZ()));

        Bukkit.getConsoleSender().sendMessage(region.getWorld().regenerate(region, editSession)+ "");

This prints out the correct region coords and prints out true as well but still doesnt regen the area to its original form

tender shard
# rose trail how :^

example, not tested

public class NMS extends JavaPlugin implements Listener {

    private static final class MyLogWatcher extends AbstractAppender {

        public MyLogWatcher(String name, Filter filter, Layout<? extends Serializable> layout, boolean ignoreExceptions, Property[] properties) {
            super(name, filter, layout, ignoreExceptions, properties);
        }

        @Override
        public void append(LogEvent event) {
            // Something was logged
        }
    }

    {
        Logger root = LogManager.getRootLogger();
        final Appender appender = new MyLogWatcher("Test", null, null, false, null); /* Not sure if they all accept null, if not get those properties from the root logger or sth, idk */
        appender.start();
        ((org.apache.logging.log4j.core.Logger)root).addAppender(appender);
    }

}

#

you either need to add log4j as a provided dependency, or use spigot instead of spigot-api to have the log4j classes on your classpath btw ^ @rose trail

#

note, you need the following imports, NOT the java.util.logging ones:

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.Appender;
import org.apache.logging.log4j.core.Layout;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.appender.AbstractAppender;
import org.apache.logging.log4j.core.config.Property;
import org.apache.logging.log4j.core.Filter;
#

btw it works fine, just tested it

#

I wonder what you need it for though, lmao

somber scarab
#
        EditSession editSession = WorldEdit.getInstance().newEditSession(BukkitAdapter.adapt(FloorIsLava.GAME_WORLD));
        Region region = new CuboidRegion(BukkitAdapter.adapt(FloorIsLava.GAME_WORLD),
                BlockVector3.at(gameStartLoc.getX(), gameStartLoc.getY(), gameStartLoc.getZ()),
                BlockVector3.at(gameEndLoc.getX(), gameEndLoc.getY(), gameEndLoc.getZ()));

        Bukkit.getConsoleSender().sendMessage(region.getWorld().regenerate(region, editSession)+ "");

This prints out the correct region coords and prints out true as well but still doesnt regen the area to its original form

tender shard
shadow night
#

Is it theoretically possible to put two plugins into one jar?

tawdry echo
warm mica
#

If you plan to combine Spigot and Bungee, yes that's possible

shadow night
#

I'm just curious if that would be possible

shadow night
warm mica
#

Two Spigot plugins? You could fizzle around with the plugin loaders. Somehow it's surely possible

warm mica
tender shard
warm mica
#

This might be obvious, but just make sure that you aren't mixing up the Spigot and Bungee classes within your implementation

shadow night
#

I wonder if it's possible to do packet fckery on bungeecord to make it seem the player is joining an empty world if the backend server is offline

chrome beacon
#

That would be possible

#

I would bundle a simple Minestom implementation to make it easier

shadow night
#

I just gogoled, so minestom is a server rewrite that barely has any functionality by default and you have to make it yourself using the api?

chrome beacon
#

Yes

#

Which makes it perfect for a simple lobby

shadow night
#

I gotta try it

chrome beacon
#

And it can easily handle hundreds of players

shadow night
#

Using a bungeecord as a minecraft server? That's something new

#

I wonder how many times it's been done before

quaint mantle
#

(learning cmd blocks/redstone first, then brush up on java, & then spigot api) Wrong Discord to post this question in I guess but not in many servers on this new account right now so:

How would I go about using Glow to change colors when a players health state changes using cmd blocks? Unsure if this is a decent example but,
e.g. - Green=20, Yellow=14, Red=8

noble lantern
#

Likely just setup a loop for all players on the server every x ticks

if health <= amount set theyre glow color to your desires

smoky anchor
noble lantern
#

I'm starting to think setResourcePack isn't entirely working as intended, or I'm horribly misunderstanding something here

I've entirely re-written my file system for creating the resource pack, and afterwards, I still get the expected issue:

  1. Client has a resource pack for the server already with 3 songs
  2. Server changes pack and sends the updated pack + hash with 4 songs
  3. Client says the hash is incorrect, and promptly just deletes the cached resource pack it has, and doesn't bother with the new resource pack that sent from the server

But, after i relog all is dandy, presumably because the server just yeeted the client-side resource pack & can freely download whatever now

So, does this method not automatically clear the cached resource pack? Why cant the client just download my resource pack with the modified hash?

Passing null as a second argument also doesnt seem to follow the documented directions: "If the hash is null and the client has downloaded and cached the same resource pack in the past, it will perform a file size check against the response content to determine if the resource pack has changed and needs to be downloaded again."
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Player.html#setResourcePack(java.lang.String,byte[])

anyone experiencing this at all on newer mc versions? Really hate to fill users drives up with renamed resource packs, not sure why this methods so bug-ridden

eternal oxide
#

not using the one with force?

noble lantern
#

the force just makes them disconnect if they decline the pack

eternal oxide
#

yep, then at least you would see if it's the client not downloading/updating. using force would kick them if it's the client refusing

full glade
noble lantern
eternal oxide
#

What I mean is the server is at teh whim of the client in many instances

#

in certain cases the server can tell the client to do something but it can't force it to.

#

why I said to try with the force set is to see if it's an issue on teh client or the server when it doesn;t download your new pack

#

if it is kicked the client refused. if it isn;t kicked it's a server issue

noble lantern
#

Would there be a way to get around it if its a client issue?

eternal oxide
#

unlikely

#

MC trusts the client too much

smoky anchor
#

I may not exactly understand your problem but maybe you can try sending an empty resourcepack first and then the one with new songs ?

noble lantern
#

tried that too (just an empty string)

#

the pack gets removed when server closes anyways

#

and isnt re-applied until its sent to the client

#

trying something whacky

#

my idea is that since the first call deletes the resource pack and results in a failed download, i might be able to just resend it again later

wish me luck CH_Kek

#

seems it just ignores it the second time nice

#

ong the shittiest part of the spigot api ive ever touched

#

this shits worse than PrepareAnvilEvent

#

at this point looks like ill just have to spam the users servers resource packs with a bunchf of different-named resource packs

#

even though it should be an api feature to refresh the pack with a hash (It was in previous versions)

#

really dumb of mojang to remove this feature

smoky anchor
#

I don't suppose you could shuffle between two names ?

noble lantern
#

ide be in the same boat of them not updating bc of hash's

#

this also doesnt work in server.properties tbh

smoky anchor
#

aaah

noble lantern
#

im just hoping maybe someone else in here has had the same experience as me so i can stop going insane over this can just call it a limitation and move on

#

its 5am, been at this since i woke up today and its driving me nuts

hybrid spoke
#

whats the problem in 2 sentences

#

tldr me

noble lantern
#

tldr

the minecraft client is deleting resource packs without re-installing them with hash's

#

leading in a forced relog for the update to sync

#

imma try one more thing hrm

hybrid spoke
#

yeah apparently cant help with that, no clue of resourcepacks

noble lantern
#

oh this is mega fucked actually

noble lantern
#

this entire method is just fucked in 1.19

#

1.16 this was smooth as butter and i never even needed hashes

smoky anchor
#

wait, why do you even need the hash ?
There is a method without hash

noble lantern
#

its to make the client update the pack

#

yeah that one doesnt make the client update

#

tried it + javadocs say so

#

unles you change the name

#

thats like my only work around rn but changing the name duplicates the files on the client

#

ill prolly make a spigot bug and see where it goes it put way to many hours into this

hybrid spoke
noble lantern
#

guarantee its even more broken in that version

#

i knew i wasnt going insane

#

mojang is lame asf

#

seems it immediantly broke after 1.16 lmao

eternal oxide
#

there is a workaround there too

noble lantern
#

it does what im doing already

#

changing the file name

#

and forcing client to download an entirely new rsource pack

eternal oxide
#

it shoudl not change the name

#

the # is a page index

noble lantern
#

lemme try ~5-10 mins

#

ah yes invalid session hell

#

love it

deft thistle
#

Hey why can't I cast a MetadataValue object into a ArenaModel object?

public ArenaModel getPlayerArena(Player player) {
        return (ArenaModel) player.getMetadata("currentArena").get(0);
    }

The object does exist, right here:

 public void teleportToArena(Player joiningPlayer,String arenaName ) {
        if( this.arenaExists(arenaName) ) {
            ArenaModel arenaModel = arenas.get(arenaName);
            joiningPlayer.setMetadata("locationBeforeArena", new FixedMetadataValue(plugin,joiningPlayer.getLocation()) );
            joiningPlayer.setMetadata("currentArena", new FixedMetadataValue(plugin,arenaModel) );
            joiningPlayer.teleport(arenaModel.getLobbySpawn());
            arenaModel.getCurrentPlayers().add(joiningPlayer.getUniqueId());
            String message = String.format("§f%s§e joined! §a(%d/2)",joiningPlayer.getName(),arenaModel.getCurrentPlayers().size());
            arenaModel.annunceMessage(message);
        }
    }

Thanks in advance.

smoky anchor
#

the getMetadata returns FixedMetadataValue I believe

deft thistle
#

Caused by: java.lang.ClassCastException: class org.bukkit.metadata.FixedMetadataValue cannot be cast to class bonnie20402.simplespigotplugin.models.arena.ArenaModel (org.bukkit.metadata.FixedMetadataValue is in unnamed module of loader java.net.URLClassLoader @3d82c5f3; bonnie20402.simplespigotplugin.models.arena.ArenaModel is in unnamed module of loader 'SimpleSpigotPlugin-1.0-SNAPSHOT.jar' @30cd2e25)

#

I can't cast a FixedMetadataValue into ArenaModel

#

How do I convert it back then?

smoky anchor
quaint mantle
#

someone pls help

smoky anchor
quaint mantle
#

when ever i do /shopkeeper citizen it says

smoky anchor
undone axleBOT
#

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

deft thistle
#

alright

quaint mantle
#

The shop ject type 'citizen' is disabled

undone axleBOT
#

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

deft thistle
#

Thanik you for your help

quaint mantle
#

wheneer i do /shopkeeper citizen it says The shop ject type 'citizen' is disabled

#

how do i fix that

smoky anchor
#

Next time just send one message -_-

quaint mantle
#

can someone help me stil?

smoky anchor
#

ask in the correct channel

noble lantern
#

oh well i can brush off this 20 gb of extra data as a limitation now though (okay its rly only like 120 mb per pack but still)

#

"complain to mojang, thanks"

quaint mantle
smoky anchor
smoky anchor
# noble lantern "complain to mojang, thanks"

So if I understood correctly, unless the player leaves the server you can't update the resourcepack ?
If that is the case, you can at least limit the amount of new resourcepacks by sending _0, _1, _2 and reset the count every time the player leaves.

noble lantern
# smoky anchor So if I understood correctly, unless the player leaves the server you can't upda...

you cant see what packs the client has sadly so its impossible to limit it

And, the reason the relog fixes it is because the clients delete the resource pack

And this is only ever gonna be once while the players are online, packs only get sent to the client when new songs get added and the packs get re-built, however seomtimes if admins are doing configurations then yeah itll reload a few times while the players are online

noble lantern
#

and im rly going for that seamless feel

shadow night
#

I have permissions in my plugin and they are used for certain commands. For some reason, I can't execute some commands even being op or the console. I need it to be usable only by ops or those, who have permissions given by a certain permissions plugin. It works when using a permissions plugin and giving the perms btw.
My plugin.yml looks kinda like:

#
# default stuff like name and version here
#
commands:
    tnt:
        description: Spawn TNT at your location, also choose the number
        usage: /tnt [number]
        permission: serverplugin.tnt
        aliases: [tntspawn]
permissions:
    serverplugin.tnt:
        description: Allows you to spawn TNT
        default: false
eternal oxide
#

default: op

tender shard
#

default: op is the default default lol

eternal oxide
#

he has default: false

shadow night
#

bruh

tender shard
#

oh I am blind

#

yeah just delete the default part

eternal oxide
#

yes op is a thing, also non-op

shadow night
#

where can I look next time when I have those stupid moments?

eternal oxide
#

google 🙂

shadow night
#

thanks

deft thistle
#

Why can't I clear a metadatavalue after I don't need it anymore? Do I just leave it at memory for no reason?

    private Location getLocationBeforeArena(Player player) {
        Location location = (Location) player.getMetadata(plugin.getName() + "_locationBeforeArena").get(0).value();
        player.getMetadata(plugin.getName() + "_locationBeforeArena").clear();
        return location;
    }
Caused by: java.lang.UnsupportedOperationException
        at java.util.Collections$UnmodifiableCollection.clear(Collections.java:1086) ~[?:?]
(...)```
#

Does java garbage man takes care of it for me? There is technically still a reference to it tho, which is what im trying to remove

deft thistle
#

oooh

#

thank you

#

these guys are gods know how to answer everything 🙂

noble lantern
#

wait why arent you using PDC?

deft thistle
#

becuase I don't want to save the data

noble lantern
#

ah i see

deft thistle
#

Question, is metadata owned by my plugin acessible to other plugins?

smoky anchor
#

I do believe so

deft thistle
#

Like if for some reason another plugin puts a metadata value with the same key as me would there be any issue?

smoky anchor
#

There should not

deft thistle
#

alright then using plugin.getName() as prefix is just redundant

pseudo hazel
#

yeah, it probably creates a namespaced key from the plugin instance you pass it

#

thats probably the sole reason for it to want your plugin

deft thistle
#

true

#

I just fucking love when things just make sense 🙂

smoky anchor
#

10/10 status @noble lantern
I had something similar, but with spigot breaking vanilla feature
Ever noticed how items sometimes just levitate ?
Can be mostly seen when deforesting
I found the cause... after looking for it for hours and after building a redstone machine that exploits a vanilla item optimization
SPIGOT-7118

quaint mantle
#

How do you make a project modular? I know it sounds a bit weird but lets say I have a permission plugin. I want this to be divided like permissions-api and permissions-plugin how do I do that with maven?

wet breach
noble lantern
wet breach
#

hmmm

noble lantern
wet breach
#

I wonder if I still know some obscure ones 🤔

noble lantern
#

i wonder if the statistic bug i found got fixed

quaint mantle
wet breach
#

also could you send me that resource pack

noble lantern
#

past 1.16 hash's seem to say no

wet breach
noble lantern
#

its a client thing

smoky anchor
#

I wanna see you fix client
with spigot

noble lantern
#

client isnt redownloading the resource pack after clearing it

wet breach
#

well generally the fix has always been renaming

noble lantern
#

and sending it againg a few seconds later doesnt help it, tried that too

#

yeah im doing that

#

but it created a bunch of files

#

but is what it is

#

"limitations" ill put it with a warning in the readme

wet breach
#

I will have to take a look at the client code, might still be able to patch on spigot side to handle it

noble lantern
#

read the issue, people looked into it

#

its 100% client

wet breach
#

I get that

noble lantern
#

mojangs incompetence

wet breach
#

but you are not understanding either

#

lets say for example the client hashes incorrectly, a fix would be to also hash incorrectly on the server side

#

it would match so as long as you are doing the same on server side

noble lantern
#

but you dont want them matching...

wet breach
#

I said for example....

#

its an answer to those curious how you fix a client bug from the server side, answer is you don't, you just treat it like a feature 😛

noble lantern
#

yep hence why im just renaming files and pretending hash just doesnt exist anymore

smoky anchor
noble lantern
#

using uuid's as a makeshift hash

#

aint worth it mojang just needs to fix theyre shit code

#

they just need to make the client redownload if the hash's mismatch

smoky anchor
#

find a security vulnerability in it somehow, that'll force them to fix the bug :D

noble lantern
#

currently it just deletes and says thank you i successfully loaded the pack to the server

wet breach
#

it was quite common to fix Mojang mistakes and if it couldn't really fully be fixed, you just put a band aide on it and called it good 😄

noble lantern
#

i wonder if minecraft deletes server resource packs after some time

wet breach
#

no

noble lantern
#

so they just indefinitely sit there dang

wet breach
#

until you tell it to delete them

#

but otherwise yes

trail coral
#

can someone help me understand inventories better?

I found this: https://www.spigotmc.org/threads/creating-guis-the-right-way.156378/
but I don't really understand it.

I need to make a "trade" gui, on the left i put 1 item and on the right i get an item in return, how do i check if im putting the right item in the right slot? I dont want to be able to put anything on the right side either. I also dont understand while i need to identify the inventories by uuid, im only making 1 gui and thats it. can someone help me please?

smoky anchor
#

The UUID is used to identify who has the GUI currently open so you can do actions in the correct gui for the correct player.
You may be making only one gui, but there might be multiple instances of it.

pseudo hazel
#

making a trade ui like that will be kinda hard

trail coral
#

yeah its my first time handling guis like this aswell

pseudo hazel
#

you gotta cancel the event based on which slots are interacted with

trail coral
#

I cant avoid guis forever tho i gotta learn at some point lol

noble lantern
#

IMO smiles guide is 10x better

pseudo hazel
#

when you cancel a click event for example it will not allow you move the item to that slot

trail coral
#

i had an idea with villagers which is what i saw on another server, villagers do the exact thing i want to do here

#

but idk how i can make dynamic trades with villagers, do i listen for inventroyclickevent?

#

and making custom villagers seems like more of a hassle

noble lantern
#

and paginatation is super easy to implement with it

trail coral
#

Idk how i can make a gui class for a gui like this tho

#

its too specific to make a general class for

noble lantern
#

your supposed to have a interface to make manipulating inventories easier, and you implement/extend said interface to create your "general" class

#

thats what smiles guide takes you through

#

class hierarchy 🙂

trail coral
#

ah thanks but i think for my idea guis arent suitable and i should probably work with a villager since it already has the concept im looking for. i do need to learn guis so i might just do it just for experience haha

pseudo hazel
#

i have a menu interface and a basic implementation for it which does stuff like handle click events and add items to the inventory, then I have my specialized menus built on top of that basic implementation

#

idk how easy it is to customize the trade screen

noble lantern
#

p easy you just edit MerchantRecipe's on a Merchant

pseudo hazel
#

oh

#

well then thats the way to go

noble lantern
#

yeah surprisingly its one of the easier things to do lmao

#

basically like making a crafting table recipe

trail coral
#

oh shit

#

and then can i edit the trade as the inventory is open?

noble lantern
#

you can edit it before actually

#

Merchant itself store the trades

#

so youll never need to touch any invent code

trail coral
#

basically what im trying to do is:
I have custom items with custom durabilitys and custom xp values, so for example a blood axe or whatever that is damaged to 100 durability would convert into 100 xp bottles. I dont know for sure which item im going to get in the trade so i need to change the outcome according to whatever item the player puts in

noble lantern
#

oof

trail coral
#

ikr

noble lantern
#

sadly MerchantRecipes are limiting

#

takes 2 materials not item stacks iirc

pseudo hazel
#

oof

#

looks like its time to learn inventory guis after all

trail coral
#

i saw it being done on a really old server that was also on legacy versions tho

pseudo hazel
#

you can probably do it with packets

noble lantern
pseudo hazel
#

but its complicated

noble lantern
#

addIngredient(itemStack)

pseudo hazel
#

even more than just making the custom gui probably

noble lantern
trail coral
noble lantern
#

if not then update

trail coral
#

i cant update sadly

noble lantern
#

either way, 99% sure those classes exist on 1.12

#

just type em see if they do

#

Merchant might be AbstractVillager on that version if Merchant doesnt exist

trail coral
#

so it is possible to change outcome while the inventory is open right?

noble lantern
#

not with villagers no not really

#

you set theyre trades before the gui is open normally

trail coral
#

ah that sucks

#

so ill have to make guis 😭

#

thanks for your help btw

hard socket
#

do I have yo use Spigot to work? I use paper

warm mica
#

= That plugin likely only supports 1.19.4

hard socket
#

wait if I use 1.19.2 and add Via version will that work fine?

#

or do I add support for all versions

heavy prairie
#

For some reason my plugin doesnt appear on a friend's server. The server is 1.19.3, it is located in the server's plugins folder but for some reason it doesnt appear on the server. Is there something wrong with my code? I can send the .xml and .yml if needed.

#

I was asked to host a treasure hunt for the server so i need help

eternal oxide
#

check server log for errors