#help-development

1 messages · Page 665 of 1

vital sandal
#

it showed null but I checked if it is null or not

tender shard
#

are you on 1.16 or sth?

vital sandal
#

nope

tender shard
#

which version is that?

vital sandal
#

1.19.4

tender shard
#

ermmm

#

then why are you not using mojang maps?

vital sandal
#

just too lazy to use mapping

tender shard
#

but using the mappings is the lazy way

vital sandal
#

I'm fine with the dictionary 😄

tender shard
#

you are doing it the more complicated way

#

yeah well but nobody else knows what b() is or i()

#

or AdvancementProgress#a

#

and without the full stacktrace, we also cannot help

vital sandal
#

noted there

opaque scarab
vital sandal
#

it keep telling me that it is null while It cannot be null

cunning osprey
#

Also

#

As im starting to learn what you guys think is the best tutorial foe learning mc development

remote swallow
#

intellij

#

technically its up to opinion

#

your best to try the most popular ones

#

intellij, eclipse, netbeans, visual studio

cunning osprey
north nova
#

if you know java well enough, you have all the resources you could possibly need to build the most complex plugin that ever existed

cunning osprey
#

But tutoiral

north nova
#

so learn lava

remote swallow
#

?learnjava

undone axleBOT
cunning osprey
#

But for spigot-api

remote swallow
#

theres the wiki

cunning osprey
remote swallow
cunning osprey
#

Wait a min

#

?learnspigot

flint coyote
#

nah there's only

#

?learnjava

undone axleBOT
cunning osprey
flint coyote
#

If you "perfectly" understand java you should take a look at the wiki and some plugin on github.

#

Should get you pretty far

#

Obviously you want to look at smaller plugins so you learn more about the basics of the api instead of being overwhelmed by huge projects

ripe pumice
#
public static final enum Type {
}

why this didnt work?

north nova
#

oh god

remote swallow
#

why does it need to be static final

#

it already is

north nova
#

that's not how enums work

flint coyote
#

uhm why do you need static and final on an enum

ripe pumice
#

still dont works when i removed static

remote swallow
#

remove final too

ripe pumice
#

why

remote swallow
#

an enum is already final

north nova
#

oh my god

#

man

flint coyote
#

Because an enum is a compile-time constant

#

^ that's final in more words

#

Except for finals that get their values by a constructor since those can obviously be dynamic as in can be read from a file

#

But maybe we should start with the question why you thought an enum should be static final in the first place?

north nova
#

i doubt you're getting an answer to that

flint coyote
#

Will probably write an api full of final classes at some point💀

north nova
#

i suggest java gets removed from the face of earth so people don't have the issue of not knowing java

#

(since it won't exist anymore)

flint coyote
#

And then we all use kotlin?

north nova
#

no

#

we all learn assembly

#

why bother with a programming language when u can just not need one

zealous osprey
#

Does anyone know how the uid.dat file in a world is created?
It has 128bits, so it's UUID; But it doesn't match the value that's safed in the playerdata.dat files.

north nova
#

what do you mean by how it is crated

zealous osprey
#

Yeah "created" might have been a bad word for it, whoops.
What I meant was, how do you convert those 128 bits to the WorldUUIDMost and WorldUUIDLeast?
It seems that each player safes 3 things about the dim they are in:

  • Dimension (an int like 0, -1 or 1)
  • WorldUUIDMost; I assume the first 64bits of the 128
  • WorldUUIDLeast; I assume the last 64 bits

But when I ran the code I got following result:
128bits: [2, -128, -46, 100, -101, -121, 66, -87, -77, -24, 93, 121, 20, -9, 57, 29] (Shortened to a byte array here)

First 64bits: 180375314642715305
WorldUUIDMost however is 180375314642715300; I'm off by a value of 5?!

Last 64bits: -5483029771699406563
WorldUUIDLeast however is -5483029771699407000; Here's a greater margin of error and idk why

toxic sage
#

there is a way to create an inventory with a title that has a custom font?

        BaseComponent component = new TextComponent("123");
        component.setFont("custom:font");
        Inventory inventory = Bukkit.createInventory(null, 27, component.toString());

this method doesn't work 🥸

dusky crane
#

No exception

native bramble
#

which is the best way to generate sha1 for resource pack?

north nova
native bramble
#

trying to use DigestUtils.sha1Hex(), but is not working

north nova
#

i'm not sure the uid.dat file is used for actually identifying the world

zealous osprey
#

Cause I want to TP an offline player; And therefore I need to change their playerdata.
No, chaching that they SHOULD be teleported is not an option.

north nova
#

iirc u can even delete the uid.dat file and it will be regenerated

zealous osprey
#

Changing their position isn't hard, however teleporting them through dimensions is

north nova
#

why is teleporting through dimensions difficult wtf

zealous osprey
echo basalt
#

The player's position is not stored in uid.dat

zealous osprey
north nova
#

if you really wanna do that u can probably have to take a look into editing playerdata

echo basalt
#

You just need to read their .dat files and yeet them into another position

north nova
#

but why not just cache it?

#

store it in a file or in a database

zealous osprey
echo basalt
#

Nah there's a copy in their player data

zealous osprey
zealous osprey
# echo basalt

wait, how did you get that? It looks like you opened the .dat file in intelij

echo basalt
#

magic

zealous osprey
#

Hm, cause I always have to use VScode or now my own editor

remote swallow
zealous osprey
#

yes

zealous osprey
echo basalt
#

so

#

128 bits is.. 16 bytes

#

The format is split into 2 segments

#

of 8 bytes each

#

Pure coincidence that a UUID's constructor takes 2 longs and a long is 8 bytes huh

zealous osprey
#

That's exactly what I did in the msg I wrote, yet the values aren't correct

echo basalt
#

I wonder where I've seen this before

zealous osprey
#

I'm not using UUID, I just called it that cause of the naming they used

echo basalt
#

Yeah but they are

#

Only reason why it's saved into 2 segments is because it uses less overhead than writing a string

zealous osprey
echo basalt
#

No clue what you're on about

#

Maybe start by providing a method and some test cases

#

And describing your expected output and what you're getting

zealous osprey
#

Ok, so I get the 128bits, no problem; Then I spit them into 2x 64bits, did that; Then I get the values from them, aka msb and lsb. But they are still different to the values that they should be, but just by a slight margin.

zealous osprey
echo basalt
#

flag bits maybe?

#

Got no clue, you've given us no code to troubleshoot

native bramble
#

how can i generate sha1 for resourcepack?

zealous osprey
# echo basalt Got no clue, you've given us no code to troubleshoot

Here's the uid file and here's the code I used to get the data I mentioned:

final File file = new File(path + "\\uid.dat");

final byte[] a = Files.readAllBytes(file.toPath());
System.out.println(Arrays.toString(a));
final String s = toBinary(a);

private String toBinary(byte... bytes ) {
  StringBuilder sb = new StringBuilder(bytes.length * Byte.SIZE);
  for( int i = 0; i < Byte.SIZE * bytes.length; i++ )
    sb.append((bytes[i / Byte.SIZE] << i % Byte.SIZE & 0x80) == 0 ? '0' : '1');
  return sb.toString();
}
kindred sentinel
#

is ItemMeta.setLore outdated?

echo basalt
kindred sentinel
river oracle
#

that's paper only

river oracle
kindred sentinel
lilac dagger
#

how do components work on itemstacks?

river oracle
zealous osprey
# echo basalt this your expected result?

That's the issue; the MSB should be 180375314642715300, but it's 180375314642715305 for some reason. That's the same result I got aswell.
Same with the LSB, it's also wrong for some reason

lilac dagger
#

you can't hover over the text as far as i know

river oracle
#

just click events won't work and hover events

kindred sentinel
#

but ItemMeta.lore().add() is working

lilac dagger
#

ah

river oracle
#

we don't support those methods here

lilac dagger
#

well, they are just fancy texts then

echo basalt
kindred sentinel
#

oh ok sorry

kindred sentinel
zealous osprey
river oracle
#

use setLore

echo basalt
#

corrupt player dat file maybe? Send that over

kindred sentinel
zealous osprey
#

It would be quite the coincidence if 2 players were corrupted and had the exact same value

echo basalt
#

got no clue

zealous osprey
echo basalt
#

but still good to double-check

zealous osprey
#

You want both .dat files for me and my alt?

echo basalt
#

yeah your reader is garbage

zealous osprey
#

WTF

echo basalt
#

took me a bit because I accidentally assigned intellij to not open .dat files

zealous osprey
#

I'm gonna hit someone AHHHHHHHHHHHH

#

Thanks alot <3

#

Also, please mister Wizard, tell me your secret of opening these files in intelij

echo basalt
#

ide plugin clown_2

zealous osprey
#

Great; Now I have to find the bug in my parsing code... yey

echo basalt
zealous osprey
#

❤️

quaint mantle
#

What's regionised multithreading and how could it affect a minecraft server?
It has nothing to be with spigot, just saw Folia thing (a papermc fork) which sais that's using that regionised multithreading

#

||Don't wherami me 😔||

marsh crater
#

So I made a plugin that gives you a temporary inventory (for a duel).
In the event that a player disconnects during a duel, should I save their inventory to a file and restore it when they rejoin or just revert their player.dat file to before they started the duel?

quaint mantle
marsh crater
quaint mantle
#

Instead of doing it when they join back

marsh crater
#

if so that makes this much easier

quaint mantle
#

Wdym?
PlayerQuitEvent has a getPlayer method, the event gets fired before the player actually disconnects the server

#

Or are you modifying directly .dat files?

#

If so, you shouldn't

marsh crater
near mason
#

how to use interpolations with block displays?

quaint mantle
quaint mantle
#

You could store their inventory, in case the plugin gets shutdown while duels active (in which case player inventories won't be restored), so when the plugin starts again, its able to restore "saved" inventories

#

And in that case, you will need to use the PlayerJoinEvent instead

chrome beacon
near mason
#

wait interpolation doesnt work with tp omg

#

i forgot that

#

ty

echo basalt
#

It's split into regions

#

And those regions have their own scheduler

#

So if someone's base is laggy, the rest of the server doesn't get affected

quaint mantle
#

Yeah, I've been reading how it works, I kinda like it

#

Even though they say it breaks almost everything

lilac dagger
#

folia's concept is amazing

#

but how do plugins work with it, i assume entities events will be called from another thread

quaint mantle
#

As of now

#

But basically yes

#

Apparently, for example, EntityDamageByEntityEvent, each entity could have its own "region", which means performing the same action on both entities could happen at different times?

#

What I really like about Folia is that there's not a main thread as it is

#

A good part of it, is that they will allow to schedule a task for the next "tick" or something like that

cursive kite
#
    public void onUserIsTeleporting(PlayerMoveEvent event) {
        Player player = event.getPlayer();
        Location to = event.getTo(), from = event.getFrom();
        if(to.getX() != from.getX() || to.getY() != from.getY() || to.getZ() != from.getZ()) {
            if(player.isTeleporting()) {
            player
.cancelTeleport();
            }
        }
    }```
#

I am trying to make it so the player can look around while teleporting but if they move x,y,z it cancels

#

But this cancels if the player moves their mouse which isn't making sense

lilac dagger
#

use epsilon to check if it's not the same location

#

there might be small corrections that triggers it

cursive kite
#

What do you mean by epilson

flint coyote
#

or just compare block locations if it's fine for you if they move on the same block

cursive kite
#

Ideally i want it so any x,y,z movement cancels

#

Only pitch,yaw movements

lilac dagger
#

(Math.abs(x1 - x2) < epsilon)

#

basically your tolerance

#

it allows for small double errors to go unchecked

cursive kite
#

What would a good tolerance be

#

Like what is the highest corrections issued

flint coyote
#

I mean you can always run a print statement

#

probably only the last digit of double

lilac dagger
#

not sure what epsilon tolerance is exactly

cursive kite
#

if(Math.abs(x1 - x2) > Math.E || Math.abs(y1 - y2) > Math.E || Math.abs(z1 - z2) > Math.E)

#

Like this?

flint coyote
lilac dagger
#

that's euler's constant

#

that's too much

cursive kite
#

Sorry i havent dug into much math stuff lol

kindred sentinel
#

What event happens when a block changes itself? For example coral dries up

lilac dagger
#

just go with 0.15

#

it's enough for you

cursive kite
#
        if(Math.abs(x1 - x2) > tolerance || Math.abs(y1 - y2) > tolerance || Math.abs(z1 - z2) > tolerance) {```
flint coyote
lilac dagger
#

hmm

flint coyote
#

Either compare the original location (and store it) or go for 0.00001

#

can also test with more digits obviously

cursive kite
#

I thought this would be simple lol

cursive kite
#

Yea the tolerance lets me walk more than i'd like it to before cancelling it

lilac dagger
#

just lower it until you're happy

cursive kite
#

If I do 0.015 would that be good

flint coyote
#

how long is your teleport cooldown?

cursive kite
#

3 seconds

flint coyote
#

that's 0.9 blocks of possible movement (with a hack client)

cursive kite
#

hmm

lilac dagger
#

that's a good compromise

#

not that much

cursive kite
#

My code use to work back a couple years ago lol

flint coyote
#

can also go for 0.0015 which makes it 0.09 blocks (which is minimal)

cursive kite
#

All the sudden correction movements mesed it up

#

Didn't work

#

I moved my mouse around and it triggered

quaint mantle
flint coyote
#

Are you sure you are actually running the correct code?
I never had a problem with X Y and Z exact comparisons either

lilac dagger
#

yeah, it's something odd

#

it's not like minecraft keep changing the x, y z of player for yaw/ piatch movement

cursive kite
#
    public void onUserIsTeleporting(PlayerMoveEvent event) {
        Player player = event.getPlayer();
        Location to = event.getTo(), from = event.getFrom();
        double x1 = to.getX(), y1 = to.getY(), z1 = to.getZ();
        double x2 = from.getX(), y2 = from.getY(), z2 = from.getZ();
        double tolerance = 0.0015;
        if(Math.abs(x1 - x2) > tolerance || Math.abs(y1 - y2) > tolerance || Math.abs(z1 - z2) > tolerance) {
            player.sendMessage("You moved!");
        }
    }```
cursive kite
#

What do you mean?

lunar wigeon
#

its the shittest code I have ever seen

flint coyote
wide coyote
#

lmao bro literally got 3 replies saying "remove"

lilac dagger
flint coyote
quaint mantle
#

🥹

lunar wigeon
lilac dagger
#

assuming you put to and from

cursive kite
#

Are you referring to the entire code or just using the PlayerMoveEvent?

lilac dagger
#

that would give insane movement

#

plus you're using sqrt in playermovement event

wide coyote
#

why not simply get blockY/X/Z and compare them

#

instead of double values

lilac dagger
#

comparing blocks is best

#

if you can

cursive kite
#

Comparing blocks allows movement on the same block tho

lilac dagger
#

but if you want precision use tolerance

cursive kite
#
    public void onUserIsTeleporting(PlayerMoveEvent event) {
        Player player = event.getPlayer();
        Location to = event.getTo(), from = event.getFrom();
        if(hasMoved(to, from)) {
            player.sendMessage("You moved!");
        }
    }```
#

Better?

quaint mantle
cursive kite
#

The hasMoved allows too much movement

lilac dagger
#

as i said

#

use tolerance instead

clever lantern
#

why would i use PlayerTeleportEvent.TeleportCause

cursive kite
#

what did i do so wrong in tolerance everyone wants me to remove it

lilac dagger
#

they are bots i think

#

if you look on their spigot profile they are friends

#

or something

#

they just go at it together

quick beacon
#

Hi

lunar wigeon
quick beacon
#

Forgive me for writing here, it's somehow easier for me here, who can tell me. I want to ban the use of elites on the roof of hell.

lunar wigeon
#

are you dumb or something

lilac dagger
#

maybe stop complaining about code you don't understand

#

and also don't give bad code in playermoveevent

flint coyote
#

Yeah I thought the same, they are bots

cursive kite
#

I don't get why it is always so hostile to ask for help here

near mason
#

what is Vector.distanceSquared?

opaque scarab
tribal quarry
#

to.getX != from.getX,
Omg bro really??

quick beacon
tribal quarry
#

!=

quick beacon
lilac dagger
#

but this doesn't work because it seems camera movement also prevent movement, maybe read the guy's problem first before

cursive kite
#
    public void onUserIsTeleporting(PlayerMoveEvent event) {
        Player player = event.getPlayer();
        Location to = event.getTo(), from = event.getFrom();
        double x1 = to.getX(), y1 = to.getY(), z1 = to.getZ();
        double x2 = from.getX(), y2 = from.getY(), z2 = from.getZ();
        double tolerance = 0.015;
        if(Math.abs(x1 - x2) > tolerance || Math.abs(y1 - y2) > tolerance || Math.abs(z1 - z2) > tolerance) {
            player.sendMessage("You moved!");
        }
    }```
#

Can I use this or is it really that bad

lilac dagger
#

use it

lunar wigeon
#

dont use it please

quick beacon
#

On my server, everyone uses this, I would still like to prohibit the full use of elytra on the roof of hell

cursive kite
#

How would you do it then

quick beacon
#

you can help me ?

lunar wigeon
tribal quarry
#

Each time you call event.getFrom, it gives you a new (from location)

quick beacon
#

what if he put them on before he got on the roof?

tribal quarry
#

Which you found out not working as expected

quaint mantle
tribal quarry
quick beacon
#

Do you want me to just pick up the elites? It is necessary to somehow prohibit so that they remain

onyx fjord
#

hey, i have an abstract class like this that takes T extends Event

but when i extend this class and set generic to in this case EntityDamageByEntityEvent i still get an error when registering the listener saying i cannot register a listener for Event class

quick beacon
lunar wigeon
lilac dagger
#

plus how would they work?

#

they all become whatever T extends in compiled code

#

the information will be lost

onyx fjord
#

ahh i see

#

i need to prevent that somehow

#

to be the class that extends

#

unless theres a different way to register a listener manually

lunar wigeon
tribal quarry
#

Are there any better solutions, so come up with it

echo basalt
#

players as map keys woeisme fuck no

echo basalt
tribal quarry
echo basalt
#

UUID ???

onyx fjord
#

use uuids

echo basalt
#

y'all come up with so much jank

#

meanwhile me at work

kindred sentinel
#

Where does everybody usually store additional information about players, and things for the plugin?

onyx fjord
echo basalt
#

made an interface for teleporting a player joeswag

echo basalt
onyx fjord
#

?

#

its a listener not event

lunar wigeon
#

simply

echo basalt
#

type deal

onyx fjord
#

🤔

quick beacon
knotty shell
#

onFart(SpawnerSpawnEvent event)

lunar wigeon
#

compare event.getTo() and event.getFrom()

livid dove
#

Ive read the documentatiuon for player interact events and I am still a bit confused.

Im wanting to check when a player right clicks, with nothing in their hand

quick beacon
echo basalt
lunar wigeon
echo basalt
#

So either use a resourcepack and make an invisible item

#

or have some sort of invisible entity 5 blocks into their cursor

quick beacon
tribal quarry
lunar wigeon
lunar wigeon
#
Location from = event.getFrom();
Location to = event.getTo();

if (from.getX() == to.getX() && from.getZ() == to.getZ()) {
    return;
}

even this is better

#

you can also use distanceSquared

lilac dagger
#

dude, read the guy's problem, he couldn't move the camera

#

this doesn't help with y

tribal quarry
#

Sorry, going to sleep rn

echo basalt
#

bruh I ordered burger king and this shit ain't showing up

#

family's gonna get mad if someone rings the bell at fuckin 2am

quick beacon
#

I would be very grateful to you if someone would help me solve my problem. I'm a newbie

tribal quarry
lunar wigeon
knotty shell
#

be more worried the BK was open still at 2am

lunar wigeon
#

if he couldnt move camera then he modifies player yaw or pitch

lilac dagger
#

what about camera being affected?

lunar wigeon
#

its not the check error

opaque scarab
echo basalt
#

so

lunar wigeon
#

what about you start thinking

echo basalt
#

cancel the movement

#

and set the new yaw and pitch

tribal quarry
#

Or I'm getting wrong

livid dove
# echo basalt client doesn't send a packet

Represents an event that is called when a player interacts with an object or air, potentially fired once for each hand. The hand can be determined using getHand().

To be clear i believe you, but the documentation seems to be worded oddly

cursive kite
echo basalt
#

It fires if:

  • The player interacts with an item, looking at air
  • The player interacts with a block
quick beacon
echo basalt
#

There's also the interact entity events for when the player clicks on an entity

lunar wigeon
cursive kite
#

The code triggers when a player moves their mouse

lunar wigeon
#

yes, thats why you check if he has moved

echo basalt
#

Well sometimes it does

lunar wigeon
#

if you dont want to cancel event you can teleport player to old location

echo basalt
#

You don't want to compare decimal values directly like that, but do an epsilon check

#

the amount of misinformation that's spreading

lunar wigeon
lilac dagger
#

this is what distanceSquared does: NumberConversions.square(this.x - o.x) + NumberConversions.square(this.y - o.y) + NumberConversions.square(this.z - o.z)

lunar wigeon
#

if no, then use distanceSquared

quick beacon
lilac dagger
#

answered

lunar wigeon
echo basalt
tribal quarry
lunar wigeon
#

its block location

#

not double location

quick beacon
echo basalt
#

Location#getX returns a double

lunar wigeon
echo basalt
#

are you blind

lunar wigeon
#

just use distanceSquaredffff

#

oh I did

echo basalt
lunar wigeon
#

but still

opaque scarab
lunar wigeon
#

you can use block location

lilac dagger
#

he didn't want block changes as that's too much

tribal quarry
lunar wigeon
#

wdym

tribal quarry
#

Track the from location,

#

That's it

clever lantern
#

can i use spring with spigot?

echo basalt
#

Great question

tribal quarry
# lunar wigeon wdym

That was why I made that map, just put loggers in move listener as see what it does

echo basalt
#

Just make a separate spring service and do some communication

#

Easier to test and won't blow up your server

lunar wigeon
echo basalt
#

Introduces security vulnerabilities

lunar wigeon
echo basalt
#

Just stick to a database or some messaging system like rabbitmq

lunar wigeon
#

java sockets and websockets are encrypted

echo basalt
#

Uhh anyone can start a connection

#

So not really

#

Also quit talking out of your ass

lunar wigeon
#

the same goes for database 🤣

quaint mantle
#

just use firewall maybe

#

?

echo basalt
#

With a well configured firewall sure

quaint mantle
#

with simple configured

echo basalt
#

Databases at least try doing authenthication

lunar wigeon
#

also you can block other ip connections

#

you check socket ip

#

you can choose which ip can connect

echo basalt
#

🤦

#

Sure go for it man

quick beacon
cursive kite
#

I adjusted a settings on my Eclipse now when I click a file it opens in my Project Explorer window how do i undo that

quaint mantle
quick beacon
quaint mantle
#

so do it

lunar wigeon
#
String clientIP = clientSocket.getInetAddress().getHostAddress();

if (isBlockedIP(clientIP)) {
    System.out.println("Blocked connection attempt from: " + clientIP);
    clientSocket.close();
} else {
    System.out.println("Accepted connection from: " + clientIP);
}
quick beacon
#

I want to forbid using on the roof of hell

tall dragon
#

you can probably just take it away and put it right back a tick later to force fly mode off

#

not sure why cancelling that event woulnt work tho

echo basalt
quaint mantle
#

asklfchvaskjd bszd b

#

sf

#

a

#

asf

#

f

#

u are idiot

#

so use firewall

lunar wigeon
echo basalt
#

It's a real vulnerability

echo basalt
#

I can just try every single ip out there

quaint mantle
#

u are idiot xd

tall dragon
quaint mantle
#

just use brain

lunar wigeon
quaint mantle
#

and block ports

#

idiots

echo basalt
#

sudo ufw

quaint mantle
#

use firewall

#

use ufw

echo basalt
#

and move on

lunar wigeon
#

you can block ports and use shields

tall dragon
quaint mantle
#

i cant read this shit

echo basalt
#

I have a degree in systems management and programming, I know enough about network security jfc

lunar wigeon
tribal quarry
echo basalt
#

yes use python's firewall

glossy venture
echo basalt
#

because it has bandwidth limits?

tribal quarry
glossy venture
#

yo illusion sorry to report this to you man but u have no brain

echo basalt
#

thanks

tall dragon
#

lmfao

glossy venture
#

appereantly

quaint mantle
lunar wigeon
#

if you have no idea about servers then please don't talk

echo basalt
#

bunch of trolls

glossy venture
#

lmfao

echo basalt
#

fuck it i'm too ooga booga for this

glossy venture
#

the network handler would probably crash the server before the sysout spam does tho

lunar wigeon
tribal quarry
echo basalt
#

^

#

This is my day job

tall dragon
#

and you are troll about forming a proper english sentence

glossy venture
tall dragon
#

yikes

tribal quarry
echo basalt
#

Quit trying to sound almighty because you have a plugin with 400k downloads

#

Alt account vibes

lunar wigeon
#

???

#

yes I have 400k alt accounts

glossy venture
#

but illusion where did you see empty interfaces in my bytecode analyzer im curious

tribal quarry
#

And more worse, you two comparing from and to locations, no one did this before in Minecraft history, since it failes with higher tolerance and lower speeds

lunar wigeon
#

lets go

lunar wigeon
tribal quarry
tribal quarry
#

Doesn't get what I mean

glossy venture
#

when you override it

livid dove
# echo basalt client doesn't send a packet

Just as a small update, i found out that Mythic Craft have actually got something in their in house library that can detect / "register" this sorta thing from what I can tell.

Trying to get the deets

glossy venture
#

its like an abstract class minus the class

tribal quarry
glossy venture
echo basalt
#

because floating point stuff

echo basalt
tribal quarry
glossy venture
#

isnt that unfixable

echo basalt
#

So

lunar wigeon
glossy venture
#

because it cant store more precise values

tribal quarry
#

That comparation is just meant to disable camera and does nothing

echo basalt
lilac dagger
#

not doubles

lunar wigeon
#

then be more precisie

glossy venture
#

ok wait how tf else are you comparing doubles

echo basalt
#

If you want to see if 2 doubles are "equal" you define an epsilon (-1E6), subtract the values and see if they're within that epsilon

glossy venture
echo basalt
#

Floating point innacuracies ;)

echo basalt
#

If the bits were the same then == would work directly

tribal quarry
#

:|||

glossy venture
echo basalt
#

No

tribal quarry
#

:|

glossy venture
#

like 2 = inaccurate 2 and 4/2 = same 2

#

nvm then

echo basalt
#

Doubles are generally represented as a fraction or exponent of a weird number

glossy venture
#

ik how theyre represented

echo basalt
#

Yeah so if you have 2 numbers from different "sources" (4/2 and 1+1) they might not match

glossy venture
#

just dont see why you couldnt compare the bits, but i dont know the algorithms cpus use for arithmetic

glossy venture
#

ok

#

so how would you do a more precise comparison

tribal quarry
#

Floor doubles, and compare them

echo basalt
#

epsilon

#

as I said like 5 times

glossy venture
#

shouldn't that be the standard algorithm in cpus then

tribal quarry
#

Or idk, approximately (if that's not wrong in english

tribal quarry
#

3.14159 -> 3.14000

glossy venture
#

theres no way comparisons are that unprecise

tribal quarry
#

That also not needed in this situation

glossy venture
#

for such small numbers

echo basalt
opal carbon
#

floating point innacuracies my beloved

slender elbow
#

ah yes my favourite website

olive lance
#

This is totally not spigot but is totally development
has anybody ever programmed a amx touch screen av controller

opal juniper
#

ie normalised floating point

#

so all values have a specific way to represent them

river oracle
#

?nms

brisk jetty
#

Hey so im sure this has been asked alot before so im sorry for repeating it but ive been looking online and i cant really find one definitive answer

When is it okay to use the keyword static? like when is it not considered static abuse
Because some stuff like constants, utility methods, and trying to replicate singleton patterns make sense
But what about other scenerios?

echo basalt
#

this might answer your question

kindred sentinel
#

Where do people usually store information for plugins, like additional information of players or something like that? In json files?

tall dragon
#

databases are also often used

kindred sentinel
#

Configs, databases, json files?

tall dragon
#

any type of database that works good for you

#

i dont recommend storing data in configs like yml

#

json is fine imo

echo basalt
#

I usually just make an interface and impls at will

tall dragon
#

yea

kindred sentinel
#

Ok, then json

brisk jetty
# echo basalt this might answer your question

Kindof
But if i have multiple instances that should be sharing a variable is it valid to make it an static or should the variable be moved to another class then be accessed via DI?
Also what are the limits of constants? Like if i have a inventory with a set amount of Items in it (like a gui Menu)
Is it wrong for that to be a static/constant, since it never changes?

echo basalt
#

Here's an example

#

And then you can use it like this

kindred sentinel
#

But the data is going to the database?

echo basalt
#

Yes

#

Well not in the case of Memory but with any other, yes

kindred sentinel
#

Oh ok, thanks!

#

#db

brisk jetty
echo basalt
#

I'd say an inventory would be static abuse as it's mutable and can be changed at any time

#

Constants are things like how many ticks in a second

#

Collections shouldn't be kept as static

#

But in short just keep asking yourself "Does this belong to the object or to the class itself"

#

If your collection is immutable (let's say a map for time units, or a list of all the iron tools) then it might be fine to have it as static

#

Basically a permanent read-only thing

tall dragon
#

?paste

undone axleBOT
tall dragon
brisk jetty
echo basalt
#

Unless that variable is read-only immutable type deal

brisk jetty
#

Okie I thought so

tall dragon
echo basalt
#

Like if you don't have any context for that variable (let's say a list of iron tools) then static is fine, but if it's something a bit more specific like your main instance

tall dragon
#

yeaa i thought so xd

#

like it uses a static map to save itself as data xD

#

at the time i thought it was quite smart

brisk jetty
#

whyy does the static key word even exisstt
It seems so easy to abuse lmao

river oracle
#

the static keyword is absolutely needed

tall dragon
#

well it has very good applications as well for which it must exist

brisk jetty
#

Uh oh i fear i have said something

brisk jetty
river oracle
#

coding without static would be hell honestly

echo basalt
#

Your entry point

river oracle
#

Constants

tall dragon
#

image if u need to create Math m = new Math() to use math

#

😄

echo basalt
#

new UtilityClass().getTicksPerSecond

river oracle
#

it would be kind of horrible (yet fun) to see an entire project without static

echo basalt
#

Pov: my code

echo basalt
#

Easy refactor

river oracle
#

that's crazy I love my singletons to death

echo basalt
#

I don't

river oracle
#

why should I need to pass around registries etc

#

that's so pointless

tall dragon
#

i also never user singletons

echo basalt
#

I DI everywhere

tall dragon
#

me too, but i do write utils

brisk jetty
# river oracle Constants

Fairr

Also i was thinking about things like constants on small scale
5000 object each storing a variable that is the same will be more resource intensive than 5000 objects all accessing one variable
Unless im being dumb, which is very possible

echo basalt
#

I think I use singletons for stuff like mongodb codecs

tall dragon
#

since its just a reference to the same var

#

might just be the same tho

river oracle
echo basalt
#

Ew

river oracle
#

data classes just make sense, you're using the data everywhere why should I pass it around to every class instead of just use the data where its needed with my singleton I (a.) know will be initialized and (b.) will always ever be one instance of it.

#

at that point the DI pattern becomes a burden more than anything ofc I need my data class in this class the project is working with my data

echo basalt
#

No justification you're just lazy

river oracle
#

what about translations too?, it gets to the point where you're passing in things that could just be a singleton. Translations you'll only ever need one instance they'll never change

brisk jetty
#

Hmm so heres a question
Is it acceptable to use a static method to get an inventory that will always be the same
Cause all the method is doing is creating a new inventory, putting items into it, then returning that inventory
And it is the same every time
That would be a form of utility, no?
Unless im mistaken, which again, i very well might be

brisk jetty
#

Damn really?

echo basalt
river oracle
# brisk jetty Hmm so heres a question Is it acceptable to use a static method to get an inven...

static usually won't pair well with inventories mostly because of just their nature. You usally want to take a DI approach with them seeing as they are well ever changing, though 7smile7 has a good article on a good modern approach to inventories that uses a clean approach https://www.spigotmc.org/threads/a-modern-approach-to-inventory-guis.594005/

river oracle
#

certain things should just be a singleton, Databases, Translations, registries, some data classes (depending on their function)

brisk jetty
river oracle
#

for example my wrapper of BungeeChat component builder only has static access points so Component#of vs new ComponentBuilder

young knoll
#

What about new ComponentBuilder().of

brisk jetty
#

My mind is vaguelyy understanding this
Which is a pleasant surprise that i understand it at all

river oracle
#

I prefer my static access to Builders think it lokos better

tall dragon
river oracle
#

granted its kinda all preference with the builders as you don't "need" the static constructors

livid dove
#

*no

#

*the manager

#

mb mistype

river oracle
echo basalt
#

There are worse approaches

river oracle
#

but the rest of the stuff probably should stay away from it

livid dove
#

Clues in the name singleton

#

ANything with more than 1

river oracle
#

you'd be hard pressed to justify a singleton gui

livid dove
#

shouldnt be static

river oracle
#

can't really see a use case for that even

livid dove
#

Whats the point of a manager

#

if your gonna fill it with singletons lmao

#

silly shenanigans right there

river oracle
#

working with BungeeChat without arrays has been a pleasent experience

young knoll
#

I’m single a ton

#

:(

river oracle
#

I removed them all 😆

livid dove
river oracle
#

no more arrays

river oracle
#

What should I name my NMS handle class NMS looks bad and Nms looks horrid

tall dragon
#

nMs

river oracle
#

😭

#

netMinecraftServer.java

tall dragon
#

perfection

river oracle
#

I think I might just do MinecraftServer or like NativeCode though I think the latter is too ambiguous

river oracle
#

smart

tall dragon
#

i ussualy just do like 1_8_R2

river oracle
#

oh god for the class name

#

that's terrible

tall dragon
#

😄

rotund ravine
#

I use reflection cause i hate those annoying names

river oracle
#

I use reflection too :P

tall dragon
#

ehh, im not a fan of reflection

#

to each their own i guess

river oracle
#

and I usually have multiple handler classes that all do different things like ItemHandler, InventoryHandler etc

river oracle
rotund ravine
#

Yeah VersionItemHandler etc.

tall dragon
rotund ravine
young knoll
#

My name is usually NMSAdapter and NMSAdapterImpl

upper cypress
#

so I want to add a blocking mechanic for pvp where once you do a certain action it either greatly decreases or negates damage. Any ideas for good ways to do this, shifting seems to easy

young knoll
#

Make them right click with good timing

upper cypress
#

I was thinking that too but fighting with fists is a big part and I don't think you can detect right clicking with an empty hand

young knoll
#

You can if they are looking at a block or entity

#

But yeah not if they are clicking the air

cursive kite
#
            health.setDisplayName(ChatColor.DARK_RED + "❤");```
I created a health scoreboard but it begins at 0 until the entity takes damage, how can I have it begin at player health?
river oracle
#

@young knoll I noticed you never acknowledged the fact that I'm forcing you to redo the inventory system so we can have AnvilInventories

echo basalt
#

anvils don't have tiles

young knoll
#

I deflect responsibility to choco

river oracle
#

which just reconstructs an IInventory

echo basalt
#

make a pr then

river oracle
#

too lazy I'm shoving responsability onto coll

river oracle
#

like I could do Inventories

#

might give it another crack tonight

young knoll
#

Crack is wack

river oracle
#

you're wack

river oracle
young knoll
#

Performance changes?

#

What are those

#

:p

echo basalt
#

man I really don't feel like working tonight woeisme

#

but tomorrow's invoice day

river oracle
echo basalt
#

BRO

#

I just found the stupidest code issue

#

Apparently this works

#

But the moment I change it to this, it loads the class prematurely and issues a noclassdeffound

slender elbow
#

yes

echo basalt
#

go figure

slender elbow
#

i mean

#

for the lambda expression above, it creates a separate method in your class file that has the code you have in there

#

for the bottom one it points directly to the class' ctor

#

so it needs to exist, as it is tried to be fetched eagerly

echo basalt
#

I should just make a separate interface for this

#

or something

#

factory

slender elbow
#

okay but what about a factory factory builder?

echo basalt
#

lgtm

river oracle
#

my favorite FactoryFactoryBuilder

wraith dragon
#
for (Team team : this.gameData.getTeams()){
            // first we can check if the team already exists.
            if (this.teams.containsKey(team)){
                // this means the team exists.
                int teamSize = this.teams.get(team).size() + 1;
                if (teamSize < this.gameMode.getPlayersPerTeam()) {
                    // this means the team's size is still less than the gameMode's players per team.
                    // add them to the existing team.
                    this.teams.get(team).add(player.getUniqueId());
                    this.players.put(player.getUniqueId(), team);
                    Bukkit.getLogger().info(player.getName() + " got assigned to an existing team " + team.getColor());
                    break;
                } else if (teamSize == this.gameMode.getPlayersPerTeam()) {
                    // this means the team's size is equal to the gameMode's players per team.
                    // create a new team.
                    this.teams.put(team, new HashSet<>());
                    this.teams.get(team).add(player.getUniqueId());
                    this.players.put(player.getUniqueId(), team);
                    Bukkit.getLogger().info(player.getName() + " got assigned to new team because of existing team being full " + team.getColor());
                    break;
                }
            } else {
                // create a new team because one doesn't exist yet.
                this.teams.put(team, new HashSet<>());
                this.teams.get(team).add(player.getUniqueId());
                this.players.put(player.getUniqueId(), team);
                Bukkit.getLogger().info(player.getName() + " got assigned to a new team " + team.getColor());
                break;
            }
        }
#

can anyone help me fix this?
everything works fine when its 1 playerPerTeam
or solo
but if team game mode
it doesnt work
ok
Bukkit.getLogger().info(player.getName() + " got assigned to a new team " + team.getColor()); prints out fine
Bukkit.getLogger().info(player.getName() + " got assigned to an existing team " + team.getColor());
this prints out fine aswell
the problem is
when creating a new team when an existing team is full

echo basalt
#

icky

wraith dragon
#

fixed

brisk jetty
#

Is there anyway to stop players from shift clicking items into an inventory?

#

i cant seem to find an event for it

young knoll
#

InventoryClickEvent

rare rover
#

is this a good way? (im not using the api cuz wanna learn dis)

#
  • too lazy to setup all the modules
#

🙂

river oracle
#

Look at how nms does it

#

They have some listener you might beable to realistically mix into

#

I feel like mixing best way to go here

sullen marlin
#

Wtf are you doing

#

You realise that's all in the API, right

rare rover
#

obviously

quaint mantle
river oracle
quaint mantle
#

wtf

#

ur getting nobuscated classes?

#

unobuscated

cursive kite
#

Can anyone help with my scoreboard please?

vocal cloud
#

you just need to make a custom event and then fire it whenever a player takes fall damage

#

or if you just want to detect then just use the damage event

vital sandal
#

what does PacketPlayOutAdvancements consume?

#

I read wiki.vg and figure out that there are 3 of this

#

but have no idea what to put in

opal carbon
#

do you want to actually make a new event

#

or just detect the fall damage

#

then register a entitydamageevent listener

#

make sure its a player

#

and if so and the damage cause is fall damage

#

do whatever

#

well yeah it could

#

you could check for any damagable entities

#

thats why its entitydamageevent

#

yeah just add a new event handler

#

listen to entity damage event

#

check if its a sheep or whatever

#

and if its fall damage do ___

final monolith
#

Whats the event fired when i place a block above a DIRT_PATH turning it into a DIRT?

opal carbon
#

how tf do you know how to listen to entitydamagebyentity event

#

but not just simply a different event

#

what event

#

never used what event

#

ur listening to an event

#

how tf you know how to listen to one event

#

but have dementia of how to listen to one

#

okay so just change what event it is

opal carbon
#
@EventHandler
public void entityDamage(EntityDamageEvent event) {

}
#

spoonfeed of shame

#

fym then

#

you asked me how to listen

#

event.getCause()

#

oh my lord

#

u ever heard of javadocs

#

what

#

so right there ur setting getting the entity

#

doing nothing

#

then returning

#

after doing a check

#

what are you . ing

#

what are you actually trying to do with this

#

im so confused

#

why do you just say .

#

im sorry but most . messages is because they are trying to reply to a message

#

and you doing that and not replying confounds me

cursive kite
#

faction.getEnemies().stream().map(StringUtils.capitalise(Faction::getName)).collect(Collectors.joining(", ")

#

How can I do this correctly

#

It doesnt like the StringUtils.capitalise

river oracle
cursive kite
#

list of object names

#

huh

#

I used it in half my code

opal carbon
#

okay well have fun then

#

ah

river oracle
#

compeltely different things

#

you can't just throw a function call inside the method to makeup for it either

cursive kite
#

How can I do this

opal carbon
#

please try javadocs next time though getCause is literally the first method thay shows up in entity damage event javadocs

#

yes

vital yacht
river oracle
river oracle
#

do it in one function

opal carbon
#

idk at this point

#

nope

cursive kite
#

How do I do it within 1 function

vital yacht
river oracle
opal carbon
#

istg im going to stab you next . you send without replying to a message

#

im going to just combust now

cursive kite
#

Imma use map(Faction::getName).map(StringUtils::capitalize)

vital yacht
#

You should learn more about lambdas before using them

#

Do you know why your original code didn’t work?

cursive kite
#

Not really tbh

vital yacht
river oracle
vital yacht
#

Because it’s a lambda that has an input, it require you to specify the input such as faction -> someCode

#

What you did didn’t provide an input for the function parameter of the map method

#

You tried using a method reference inside the method call

#

But that doesn’t work because the StringUtils::capitalize would have to be what you used

#

Or you can change it to faction -> StringUtils.capitalize(faction.getName())

vital yacht
vital sandal
#

could someone help me with this

#

PacketPlayOutAdvancements

#

I have no idea to create that packet without bugs

cursive kite
#

I have some other bad code - I want to know how to do it more efficent

#
            int index = 0, length = results.size(), resultsPerPage = (28 - 1);
            int start = index + ((page - 1) * resultsPerPage);
            List<Integer> resultsForPage = new ArrayList<>();
            for(int i = start; i < resultsPerPage; i++) {
                resultsForPage.add(results.get(i));
            }
            return resultsForPage;```
hybrid turret
#

Do I use an interface or an Array for checking if a user-input String is allowed?

buoyant viper
#

whatever ur germanic heart desires

hybrid turret
#

How can I iterate though an interface tho?

#

also lmao

#

never used those before lol

buoyant viper
#

oh wait interface

#

there is no reason to use that there i think

zealous osprey
#

I'd recommend making it a Set though, if you are planning on using an "array". Or an Enum.
Cause Sets have some nice methods to work with

hybrid turret
buoyant viper
#

nooo

hybrid turret
buoyant viper
#

a few of my friends went to eras n im soo jealous lol

hybrid turret
#

i feel

hybrid turret
#

but well idk if a set is necessary here

#

it's just strings for languages. and i doubt that i will translate this into more than 3 lmao

#

probably german, english and french xd

zealous osprey
#

They are really cool.
Basically they are just a list of predefined names, which you can then use innyour code too ensure that you don't pass a wrong/nonexistent value.

hybrid turret
#

uhm

#

bc idk shit about those

#

lol

hybrid turret
#

and enums are kinda their own type, no?

zealous osprey
#

That's the good part, cause then you don't have to pass around Strings, but rather enums. Ehich means in method parameters can be set as an enum and you know what values are allowed. If a method would just take a string as an argument, then you'd probably forget which strings would be valid

#

And you can convert strings to enums, for example if you use the players input and then you can use the enum in your code instead of a string.

hybrid turret
#

how does the conversion work?

zealous osprey
#

Welp, I'm heading off now, but I really recommend reading up on enums, they are very useful in my opinion.

hybrid spoke
hybrid turret
#

yeah i was just wondering lmao

#

rn i'm using the array shown in the screenshot

hybrid spoke
#

an enum is the best you can go for

zealous osprey
# hybrid turret how does the conversion work?

Either you make your own function for that, or enums have a predefined function called valueOf, I think.
Though you have to make sure that the string is the exact same to the name of the enum or it will throw an exception

hybrid spoke
#

second best a list, array, general collections

zealous osprey
#

Set?

hazy parrot
#

Yes

hybrid turret
#

well .toUpperCase ig

hybrid spoke
# zealous osprey Set?

general collections, but a set doesnt give any advantage to a list or anything in this context

zealous osprey
#

That's why you might have to make your own function for converting them.

hybrid turret
#

ic

zealous osprey
hybrid spoke
#

exactly. if you sort in a language twice you have other problems. and to discuss about big o notation for a <200 elements collection then have fun with a monologue

zealous osprey
#

I don't, idk, a Set just "fells" right there, if a collection were to be used.

hybrid spoke
#

not wrong but yet redundant. i would intuitive probably also stick to a set when i somehow whyever should not use an enum

hybrid turret
#

when using a command in the console, is that an instance of ConsoleCommandSender?

quasi flint
#

well ig so

#

thats what the name suggests

hybrid turret
#

yeah ig i can test it once i get home. but not that necessary anyway tbh. (would be used for a safety check, but my plugin disables the execute command (by default) anyway so whatever)

zealous osprey
#

You can check if the "sender" arg is an instance of "Player", if not, it was the console or a command block.

hybrid turret
#

what about /execute?

#

Can you do shenanigans with that like using an entity or smth?

smoky anchor
#

you can't use bukkit commands with /execute in any way iirc

hybrid turret
#

config.yml is updated onReload right?

hybrid turret
smoky anchor
#

I am not, hence the "iirc"
I don't think it gets registrated to Brigadier so vanilla commands don't know about it

dusty swan
#

hey, what jdk should i download to make plugins? i am using intellij

smoky anchor
#

the one that supports the version your plugin will be running on

dusty swan
#

so lets say for 1.20, would i download the latest java jdk?

smoky anchor
dusty swan
#

than kyou

hybrid turret
#

oh right. prettier. i wanna include prettier in the project. how do i do that?

sterile breach
#

Hello. For a multiple server communication what is the best solution (without pluginmessages). Socket or redis ? Or other ?

dusty swan
#

how do i download a sdk?

buoyant viper
#

wait no

smoky anchor
#

doesn't intellij have an option for that ?

dusty swan
#

its not working, keeps saying no sdk specified

smoky anchor
#

no, I am sure it can download one

dusty swan
#

i think i got it to work

dusty swan
#

it let me create a new project tho so i think it worked

hybrid turret
#

If a player is hit by a player, ONLY the EntityDamageByEntityEvent is called, correct?

#

EntityDamageEvent is JUST non-Entity damage causes, right?

eternal oxide
#

no

#

EntityDamageEvent is a parent event

sullen marlin
#

EntityDamageEvent is called, but its the same event

#

so its not called twice, but it is called

tender shard
#

am I blind? where'd the git push/pull/etc buttons go in the "new" IJ GUI?

eternal oxide
#

You can listen to EntityDamageEvent and then check instanceof to see which child event type it is

hybrid turret
tender shard
flint coyote
#

The top "git" dropdown also has the options

hybrid turret
#

and pulling is by clicking on the branch on the top bar

tender shard
#

I can't find the push button (except in the drop down menu)

hybrid turret
#

commit and commit and push is on the bottom here

tender shard
#

yeah but I want to push without committing anything new

hybrid turret
#

ctrl + shift + k

tender shard
#

so they jut removed that button? smh

hybrid turret
#

idk lol

#

have always been using the shortcuts

lilac dagger
#

click master

#

you'll see push in there

flint coyote
#

I've always been using the dropdown

tender shard
#

I hate the new UI, all the useful buttons are now hidden in an extra menu

tender shard
hybrid turret
#

i love it lol

lilac dagger
#

i don't mind the new menu

hybrid turret
#

a lot cleaner and you still have shortcuts

lilac dagger
#

not like you push every few mins

eternal oxide
#

I hate change