#help-development
1 messages · Page 591 of 1
How do you get a Location cordinates from chunk cordinates
right now I'm using
x >> 4 and z >> 4 to get chunk cordinates
I used x << 4 and z << 4 to get world cordinates, but I semeed to get slightly incorrect results
In this case my chunk cordinates are correct
(73, -54)
But when bit shifting back I get a block in the chunk
(73, -55) how can I shift back or adjust for my inaccuracies
so basically, my friend out of a joke tries to make a plugin, that on chunk creation on every birch tree replaces 2nd block from bottom with birch sign with text. The way he does it now is, on chunk generation, it looks or all Birch Wood blocks, once it finds them it moves one block up and replaces block with sign. This is very unoptimised as it checks whole chunk with all blocks and only can be height limited. Can it be done any othey way that doesn't destoy server hardware on each chunk generation? (my friend is too stubborn to ask himself.)
chunk to location will return the corner block
PacketPlayOutWorldBorder
Anyone know what this is called in the latest version
why is the corner block in the wrong chunk then?
your math is wrong
yep turns out I fd someting up (like usual), the event is working now 😉
do you not bit shift >> 4
then it should wokr no?
yeah same thing
yes it should work
Use Screaming sandals :)
chunk to location is multiply by 16, plus the block offset you want
probably off-by-one
I did
i.e. you are flooring or discarding the decimal result/bits
I actually use it alot
Listen to epic
But it changes names and sometims I cant find it
domainRegistry.getAll().forEach((DomainInfo info) -> {
final LightChunk corner1 = info.flagChunks().getCorner1();
final int x = corner1.getX() << 4;
final int z = corner1.getZ() << 4;
getLogger().info("Zone Name: " + info.name());
getLogger().info("Check Cords: (%d, %d)".formatted(x, z));
});
``` This gets me the exact corner block in the chunk, but when I go in game to check its in the next chunk over
Yeah true, u can always track it by packet id
Yeah I got it bookmarked
I mean like, the packet id
Cuz it stays the same regardless of name refactorizations
I would just add 1 to the z xD
then your check in game is wrong
chunks index on zero
Can i just use .append .event .append .event, or somehow i should need to stop hover event before appending next text?
guh tryna post screenshots of ingame coords, but my discord is being dumb
my guess you are storing the initial chunk wrong
but the inital chunk cords check out as working
I've confirmed that in previous tests
if I was storing chunks wrong wouldn't that be off too?
<<4 >> 4 can;t give you an incorrect result, so you are either storing the wrong value or checkign the wrong value
does it matter what corner of the chunk you check the cordinate on?
e.g. I set my zone on this corner of the chunk
why not just get teh chunk coords from teh chunk not the location?
no math to do to get teh ints
and you guarantee you have the correct chunk
true, I believe there was somewhere that didn't work, but no point and not going back and seeing if I can refactor
when you use the location are you using getX or getBlockX?
How do I fix this
Use getFinalDamage instead of getDamage
I use
weBoundingBox.getPos1().getX() >> 4, weBoundingBox.getPos1().getZ() >> 4
your boundingbox is probably 1 pixel larger than your block
lol I didn't realize WorldEdit had getBlock
smh foolish mistake
thank you
It does, you just have to pay attention to where you put the marker.
It's hard to tell cause of your small screenshot, but you need to put the character after your values.
Not just the inbetween sections.
Yea, you're missing the characters after each ColorAPI#process call.
You are appending the calls directly one after the other.
Add "\n" + at the end of each of those lines.
That's the only one that has it and you can see it in your screenshot.
Pay attention to what you are writing. ColorAPI#process() returns a string. You are concatenating strings.
When you concatenate strings, they get joined together.
If you want to move to the next line, you add the \n character.
So when you do ColorAPI.process(whatever) + ColorAPI.process(whatever else), you will end up with whateverwhatever else not
whatever
whatever else
you were right looking at it closely its off by literally one pixel 🤣
You don't have to, you just have to add the character after the process. Which you do for the line you pointed out, but not on the ones you are getting confused about.
No it's not.
This is the only line that adds it.
All the ones above it don't have the newline string appended.
make the dashes strike through
the formatting
&m
also i have this —
—
longer than a dash
—————
might connect in game
How to do this in 1.20? CraftPlayer handle no longer has playerInteractManager:
((CraftPlayer) player).getHandle().playerInteractManager.breakBlock(new BlockPosition(b.getBlockX(), b.getBlockY(), b.getBlockZ()));
1.16.5 for sure
why not do this with the API?
?paste
its gameMode in mojmaps
The API does not provide a block break function as far as I know, only Block::breakNaturally()
breakNaturally is teh break
there is also Player#breakBlock
no point in using nms for that
https://paste.md-5.net/bewedeqebu.php
https://paste.md-5.net/siriroreye.bash
https://paste.md-5.net/urezekijis.json
Any reason that its finding an Array??? I'm so genuinenly confused it says its finding it line 4
"armor": { but the { literally denotes the start of an object?
Can you not have nested objects named like that?
ooo
Wait, I think this is wrong. Is there a way to break a block (properly) without specifying a player breaking it?
That would just be breakNaturally
set it to air
But this will drop the item
But the NMS code you were using is exactly what Player.breakBlock does
set it to air then
But this is not properly (no animation + side effects)
might just cry... Never registered my type adapter
well this is one of those take a break or the PC is going out the window moments
its been 3 hours me stumped on this
is ur gf spigotchan
no my gf is cuter than spigotchan will ever be
so you arent a spigot chan simp
break naturally and cancel block drop item event
Won’t fire unless a player breaks it
Anyone?
Could i get another persons opinion towards my problem? #1123699678425399396 Thanks.. ( My responds may be a little slow, got really bad hotspot service rn ).
You return false after sending the no permission message
Thanks
I should learn Java better first
By using static you’re not learning java better though
It’s one if not the worst obstacle for beginners
Anyone know how I can make the background of a text display transparent?
List<WrappedDataValue> dataValues = List.of(
new WrappedDataValue(22, WrappedDataWatcher.Registry.getChatComponentSerializer(), WrappedChatComponent.fromText(ChatColor.RED + "Test").getHandle()),
new WrappedDataValue(14, WrappedDataWatcher.Registry.get(Byte.class), (byte) 3),
new WrappedDataValue(26, WrappedDataWatcher.Registry.get(Byte.class), (byte) 40)
);
None of the values ive tried work
How do i set so the priority is group testGroup4?
So if your group is testGroup1 it shows somethig in a menu and same with testGroup2 and so on
But if i have testGroup1 (the "baddest" group) and testGroup4 (the "best" group)
It shows the items for testGroup1, and how do i make it so if you have both it will shows it for the highest group?
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("Only players can do this");
}
Player player = (Player) sender;
if (!(isPlayerInGroup(player, "testGroup1") || isPlayerInGroup(player, "testGroup2") || isPlayerInGroup(player, "testGroup3") || isPlayerInGroup(player, "testGroup4"))) {
sender.sendMessage("You dont have permission for this.");
}else{
if(player.getWorld().getName().equalsIgnoreCase("A")){
new VagtshopA().open(player);
} else if(player.getWorld().getName().equalsIgnoreCase("B")){
new VagtshopB().open(player);
} else if(player.getWorld().getName().equalsIgnoreCase("C")){
new VagtshopC().open(player);
}
}
return true;
}
}
Think there’s a special color u use, idr tho but should be
Let me check actualy
Just gonna open my recent project
alright
displayEntity.setBackgroundColor(Color.fromARGB(0));
This is what I used
Which is black I think?
What are those data values representing if I may ask?
I haven’t looked at nms for display entities at all so my bad
im still trying to figure that out myself
I could help you in 10 min prob, at my pc then, else someone else might be able to give u a hint
how do I make a chicken fly the direction the player is looking at?
I currently use this:
// set the chickens velocity
int m = 10;
Vector v = new Vector();
v.setX(L.getDirection().getX() * m);
v.setY(L.getDirection().getY() * m);
v.setZ(L.getDirection().getZ() * m);
C.setVelocity(v);
C = Chicken
L = Player's location
however it does not fly away yet. What am I missing?
What's the easiest method to check if BlockDropItemEvent actually had a chance of dropping an item (other than just the contents of an inventory)? For some reason I thought it didn't get called if the player used the wrong tool, but it still does and I also need to check for the event being cancelled or if the player is in creative. But then, even if you're in creative, multi-block structures such as torches will still be dropped, just not the original block broken. I was thinking I could just check if event.getItems() is empty, but that doesn't account for breaking containers such as dispensers with items in it using your fist (where the items are still dropped but not the dispenser itself) and would also have a random outcome if you harvested crops. I'm just hoping there's something that checks all this for me.
hi , i started to work on redis and i have few questions if any one could elaborate :
redis.clients.jedis.exceptions.JedisConnectionException: Failed to create socket.
what can cause this ?
the ip / port / password is correct i doubled checked them ..
iam working on a communcation system for my network :
- send a player bettwen servers .
- get number of players
using redis ..
👀
He ded
How can I get the exp drop amount for an entity that is not killed
Let's refactor this as chicken.setVelocity(location.getDirection().multiply(10))
Now for this to work, your chicken needs to have AI (setAI(false) breaks things)
....
The failed to create socket issue happens because your ip/port is incorrect, nothing else
password is a different thing
For the communication system, I'd suggest you make some packet system that runs on top of redis. Just sending around strings saying "CONNECT IMILLUSION LOBBY" is not fun
check the wiki
it says it
default_background: 0b, background: 0 this is the NBT for it
0x02 should be 1 iirc
and background color should be 0
actually
don't touch 0x02
So the entire bitmask should be 0 which is the default lol
Ah i see, yeah if you wanted to change the background color you need to set that bitmask to 1
no
0x04 is it will use default if Background Color is 0
you need to set both to zero to disable it
In order for 24 to take effect you have to tell it to not use default
I am pretty sure it might be backwards in this case from a day or twos testing
Used it myself
it works like I am telling you
Use background color should be 0b for false
Background color should be 0 for transparent black
In that case it seems that bitmask is useless to even have set. Wonder why mojang even included it will have to at some point look at mojangs code which i havent really done yet
So..
new WrappedDataValue(26, WrappedDataWatcher.Registry.get(Byte.class), (byte) 0b)
0b doesnt work here
must contain at least one binary digit
unless im missing something
Should be 0 after 0b since 0b means its a binary
0b00
Alternatively
Just stick an int there
I guess im confused on how to set values on "sub" things
like, how to set a value for a bitmask
A bitmask just refers to bits in a byte
There is 4 bits in a byte
8
Yeah that stupid phone
4 bytes in an int
4 bits = nibble
8 bites = byte
2 bytes = 16 bits = short
4 bytes = 32 bits = int
8 bytes = 64 bits = long
https://i.imgur.com/OMFNgGF.png but for example, how do I say to set 0x08 to 0, for index 26?
Since that is at the end
uhh
00000001
that alignment bit is icky
just trying to figure out how to reference everything in code
When you figured out the binary value you can turn that binary into decimal or integer
And use that int to pass in
new WrappedDataValue(24, WrappedDataWatcher.Registry.get(Byte.class), (byte) 0),
new WrappedDataValue(26, WrappedDataWatcher.Registry.get(Byte.class), (byte) 0)
Did i somehow not do it right..?
Oh wait..
Idk what color 0 is
If that even registers
damn I gotta take the time to clean my keyboard
my tab key been hella sticky lately, just shined a flashlight at it and it's crusty
There you go
new WrappedDataValue(24, WrappedDataWatcher.Registry.get(Integer.class), 0),
only took forever and pinging me 25 times
had to change it to Integer.class instead of Byte.class
You will get the hang of it. Just dont let bitmasks scare you
it was like... 3 ok..
I still dont understand why it works
ngl I barely looked at your code
24's field is varint
varint is just a specially encoded int
Code end automatically transforms 0 to byte
passing byte wouldn't ever work
But 0 is an int not a byte
0b00 is a byte
My bad binary
0x00 is a byte representation way
0x04 refers to where in the bitmask that is
new WrappedDataValue(26, WrappedDataWatcher.Registry.get(Byte.class), (byte) 0)
So this is the same as
new WrappedDataValue(26, WrappedDataWatcher.Registry.get(Byte.class), 0x04)
0x04 is not 0
For context let's take a look at what hex converted to binary is
https://i.imgur.com/Bt7gmSd.png Real question is... why is there not a 0x03? and why does it jump from 0x04 to 0x08?
00000001 -> 0x1
00000010 -> 0x2
00000100 -> 0x4
00001000 -> 0x8
00010000 -> 0x10
00100000 -> 0x20
01000000 -> 0x40
10000000 -> 0x80
Because a bit requires two values to represent it. So 00 is one bit
This is the basics of a bitmask
A bitmask is just a byte representing up to 8 booleans
And those booleans just correspond to if the bit is a 1 or a 0
All a bitmask allows is using the bits in a byte instead of using an entire byte to mean 1 thing. Since a byte can be rather large. You dont need a byte for a boolean for example
So why waste that bytes space
So does X just replace everything before the 1..?
We can say "one is true, two is true" by saying
00000011
AKA 0x1 | 0x2
like :: in ipv6
0xwhatever just represents hex
0x just refers which notation you are representing it in
0bwhatever just represents binary
ok so...
new WrappedDataValue(26, WrappedDataWatcher.Registry.get(Byte.class), (byte) 0)
(byte) 0, how does this reference 0x04 if its entirely different?
and 0 isnt 0x04
I thought it was the index..?
Patreon ➤ https://www.patreon.com/jacobsorber
Courses ➤ https://jacobsorber.thinkific.com
Website ➤ https://www.jacobsorber.com
What are Bit Masks, and how do I use them? (examples in C) // This is a quick video about Bit Masks and Bit Masking, a topic that a lot of students don't get until long after it would have been useful. This vide...
Because this infers all options should be 0
So this is setting ALL options in 26 to 0
So regardless how many bits you want everything to be 0
Because 0 as a byte is just 00000000
right
If we split it into bits of 0
Its still all 0
Now conversely if we pass an int of 1
It would set the last bitnask
Hey does anyone know of a good way I can position slime entities on the head, body and feet of an npc lying down? Im using slime entities as a artificial bounding box, since when an npc is in a sleeping pose, there bounding box is to small and only at the feet. I wanna know how I can position the slime on top of the npc perfectly (or at least close to it), even if the npc turns diagonally at times.
Because binary of 1 is 00000001
right, and 2 is 00000010
I get that part at least
Right, so this how you use ints to set the bitmask
this video confused me even more 😅
Now java allows you to represent numbers in different notations too
Maybe a practical demo would help?
new WrappedDataValue(26, WrappedDataWatcher.Registry.get(Byte.class), (byte) 0)
So this is setting ALL of these to 0, right? https://i.imgur.com/TviRt98.png
shadow to 0, see through to 0..
Yes, but you need to use integer class
Otherwise byte representation to pass is actually 0x00000000
To force the programming to convert it properly
but since im casting it to a byte, it converts the 0 to 0x00000000
Frosty you got this I got more to do than teaching bitmasks 😛
Use your military networking experience
It should but as you noticed when you tried with other ints earlier it didnt quite do that
any clarification on this..? this is driving me mad
I recommend just playing with it and convert it to different representations to get the idea
yes (byte) 0 is the same as 0x00000000
byte 0, in binary, is 0b 00000000, so all the bits are turned off, which means all values are false
I get that part
Let's say you only want the first value as true
You'd set.. 0x1 which in binary is 0b 00000001
Oh right lsb and msb
So the first value would be "has shadow"
Correct
Let's say you want the second value to be true
You'd set... 0x2 which in binary is 0b 00000010
So uh something we didnt cover minecraft uses LSB
So it's the second bit starting from the right
And if I wanted the "is see through" and "use default background color" to 0..
but not the first
00000110
right?
Least significant bit first which is all the way at the right
Correct
0x06
Seems they are understanding now 
Well..
now im confused cause 0x06, wouldnt that mean all 3 ending digits are on?
Let's talk about this
00000001 -> 0x1
00000010 -> 0x2
00000100 -> 0x4
00001000 -> 0x8
00010000 -> 0x10
00100000 -> 0x20
01000000 -> 0x40
10000000 -> 0x80
add the numbers of the bits that are on in your bitmask
wait seriously? so if I wanted every other one
Has Shadow, Use default background color... it would be 0x00000101... so 0x5..?
So if you have essentially "110", right -> left it'd be (0 * 1) + (1 * 2) + (1 * 4) which results in 2 + 4 which is 6
Exactly
ahhhh...
The idea of a bitmask is that it's just a number whose binary representation is seen as a list of booleans
This is the moment the light bulb finally turned on for them and they can now see
so I need to set all my values at once?
Like, if initially I want to set "has shadow" and "use default background color", I have to do 0x05
I went through this myself so I try my best to give different perspectives
Yes
but say later on, I want to only enable the "has shadow"
I need to re-set the entire bit
Yes
Yes
i see..
Now, notice this funky thing
To get the number which is equivalent to your position (basically this list)
wait until he starts throwing & and | at you 🙂
It's pow(2, index) where index starts at 0 (I'll refer this as 2 ^ exponent)
So
2 ^ 0 = 1 (0b 00000001)
2 ^ 1 = 2 (0b 00000010)
2 ^ 2 = 4 (0b 00000100)
2 ^ 3 = 8 (0b 00001000)
...
But we don't use pow when it comes to bits, we just do bitshifting :)
Lol
I should point them to my console colors app to show bitshifting xD
Or just use the windows calculator in programmer mode
But i dont think they are ready for that yet
Bit shifting is basically... shifting bits
Basically? It literally is lol
So
0b 00011100
<< 1 (left shift one) is 0b 00111000
1 (right shift one) is 0b 00001110
ehh pretty much
except when they go out of bounds it's just gone
Its probably one of the few things in programming its name is quite literal
yeah
Throwback to when I was messing with collisions and nms had this mess
But back to bitmasking
You can set your numbers individually by doing
(to set to true)
bitmask |= number
(to set to false)
bitmask &= ~number
Like I did here
This is probably the easiest example I got for bitmasks used in minecraft
0x01 | 0x02 | 0x04 == 0x07
ye
easy to read bit masking
0x07 | 0x04 = 0x07 because the bit is already set :p
vivian probably left the convo 5 mins ago and we're just showing off
he's sat in teh corner dribbling
it's not an opinion my dude
You guys got mad Skillz
Yoo guyd
So, if I wanted to change this to being a green background instead.. how would I get the integer for a specific green color? I know how to get the hex through just an html color picker new WrappedDataValue(24, WrappedDataWatcher.Registry.get(Integer.class), 0),
Just convert that hex to base 10
How do i create a 1.8.9 mod? All tutorials fail for me
This is for spigot, but you can always just read the docs.
it's lit
My brain could never comprehend doing any of that.
Oh i thought i was in the forge server mb
ehh
all good.
After enough time you'll eventually need this
I mean idk. rn im just making a simple rpg plugin type thing. Im stuck on set bonuses for armor. I doubt i will lol.
Some of us have been doing this for years or decades
new WrappedDataValue(24, WrappedDataWatcher.Registry.get(Integer.class), 0x40c42d),
https://i.imgur.com/mbcPD6Y.png just replace the # with 0x?
I've been doing programming for 12ish years, plugins for the past 6
Wow. im not even 2 decades lmao.
It hasn't been until the past few years that I needed to learn this
Or even had the mental capacity to learn (I just turned 18 a couple months ago)
i turned 17 2 weeks ago lol
Ehh you're still on time
should I have another energy drink and make tnt tag in an hour 
think my body's gonna cry for help if I do
I just lack the motivation to continue doing it. It's a lot of work and it keeps growing. Sometimes it just comes to much for me to work on my own.
you should
make it so when they explode they explode of villager sounds 🙂
Customer's the one doing the decisions, not me
but like.. I've already got the weirdest mix going on
Cause I had dinner, an energy drink
Perfect combo
and prescription pills
got the Gamer Fuel
lmfao
that you mix with water
sounds gross
it literally tastes like watermelon juice
it's clear isolate
there are a few poses that minecraft has
crawling is just "flying with an elytra"
or
"sleeping in a bed"
depends in how you say it
it's usually just done with packets
I did it at work once by spawning a fake npc that was lying down, teleporting the player into the ground and setting them invisible
and spawning a client-sided barrier on their head so they couldn't jump
but that was for a zombies minigame
god damn what havent you done.
uhh
no clue honestly
only things I haven't made are uhh
- a scoreboard plugin
- a chat plugin
- fancy particle effects
probably
most likely for youtubers
I would kill for fancy particles.
did a "minecraft but I'm spider man" plugin once
I've made over 500 projects over the past 6 years it's hard for me to tell
youve been doing this since you were 12?
I've been coding since I was 11, but didn't start minecraft until like a year or 2 ago.
.
been coding since I was 6
made bots for flash games
WHAT?
and shitty programs in C
How could you have gotten into it at 6?
I had no friends
and I played this game where it had fun minigames ran by bots
and I saw a tutorial on how to make my own
and made a bot that spawned a random maze that'd close in and whatever
then I revised the project a couple years back, added a points system, made a shop
damn my undiagnosed ADHD would have never allowed me to do that lmao
made friends with the game's devs
think I also made a bot that'd grab your movement and make a sort of 2d shooting game (it was a 2d sandbox game)
pressing space to shoot
So, if I change the value to the default, it changes the color to the default. I cant make it any other color except the default or invisible (0) https://i.imgur.com/TGZlVBL.png
And we'd have capture the flag, team deathmatch, free for all
I made a command system, a map system
it was fun
I wish i could have the motivation to do all that. and probably would like to go back and learn a better language to start off.
I started with C# and then moved to C and Java
I started with python, moved to Lua, an JS, I only use Java to code plugins I dont know like anything outside of that.
pass new Color(whatever).getRGB()
for example pure white would be new Color(255, 255, 255).getRGB()
https://i.imgur.com/kdA1WX7.png wtf lol
the other color
I only know a little bit of Lua, I didn't really use it that often. Only for a faster way of accessing data in a local database, really. I used it alongside Python, and I hate JS lol I never want to use it again.
not bukkit's
Congrats!!
that's the alpha channel
Yeah but I dont see an option for using alpha with this guy
I dont get why its telling me it has private access
like why do I care just WORK
Is there a time delay that is needed when a player joins for editing their PDC? I need to get 3 booleans on login to see if they get these improvements or not. rn they just dont get them.
new Color(red, green, blue, alpha)
alpha is transparency where 255 is solid
and 0 is transparent
Using bukkit color or awt?
neither are working for me.
For me, AWT doesnt let me use alpha
.png be like
Hello, i'm trying to learn how to use mongodb, so i have a data saved on yml like this https://paste.md-5.net/ilorubolag.bash, how can I convert it into mongodb?
the data is about logging every actions that the player do on item with custom model data
So you need to create a "codec"
A codec is basically a serializer for a specific object
Or you can just... write it in the document class but I wouldn't advise
If you already have a data class that represents that object it'd be ideal
i have an object called Action which stores the type, date, and location
Alright so you can probably make an ActionCodec
which is just implementing the codec class and doing the stuff
A codec looks like this
I made a static instance because I can't bother actually doing DI for this
Then on your mongo class, you'd make a MongoCollection<Action> after registering the codec
and that's.. your collection
if you can see on the link that i put here
the action data is under the "counter" section
Yeah so
You make a data class for that and a codec
You can make multiple codecs and reference each other to split your code up
Like I do here
so i can have a codec that have another codec?
so like i have multiple types of action, and every action has different data that needs to be saved
i have like inventory action too, so when player move around the item on inventory it will have a log
and it has information what inventory type that player is interacting in
Yeah so you'd make a codec for each type of action
basically you want to serialize this
Or you can just... save all of this data individually into a Document and skip the codecs entirely but that's not really advisable
i have classes like this, can i just implement the codec there?
is it possible to save multiple objects but with same uuid on mongo?
i can do something like that in sql as long as the uuid is not set to be unique
you can't have 2 entries with the same row id in sql
and the _id field acts as the row id in mongo
so I highly doubt it
if i was using sql, my plan was to create a table with column like
"player_uuid, item_uuid, item_material, item_custom_model_data, action_type, action_date, action_location.... etc"
yeah i was wondering if creating like that is possible
How can i outline a container for many types of data that can be set and used across multiple files in java? I want to make an outline for a custom item. Containing things like a name, a function that might be ran for specific cases, the type of event those functions will be ran on, ect. Is it a good idea to use classes for this?
You should use classes for everything
is it possible to make an item display with A lore when it real lore is B :l?
like client-side lore?
Yes
any reference for that?
I don't thing it is the packet :l
that's exactly what you do lmfao
or if so it gonna be a lots of things to do
you intercept the inventory packet and change the lore before it's sent to the client
;-; dam that gonna be painful to do so
correct
creative is just bullshit, they still haven't fixed that nonsense yet?
I seen hypixel have some things like that so it is the same solution?
I don't understand how you know Hypixel has this because you wouldn't know the item's real lore if they wanted to change it on your client
Why did you delete that lmfao
Unless you mean like you drop the item and they see something else, then yes
Honestly bro you need to learn a bit of Java, before you code the plugin. The way you talk makes it seem like you don't really grasp oop concepts
Yeah totally, that's why i deleted
I think i'm lacking some pretty fundamental knowledge
what you described is literally an interface, I guess?
I made something with client-sided lore in the past
it's ass
don't recommend
At least you are not in denial in regards to your skills
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
These are all good links
Though for oop specific things you might wanna do your own research
@peoples make an API to set an ItemStack's lore for a particular Player on their client, with the option of persistence using PDC perhaps?
would be sick and I'd love you for it
would be saved in my Spigot bookmark folder
can't bother
Cb f u ck ed
client-sided lore is done with a couple packets
and is usually done by intercepting rather than actually sending new data on top
unless you want to be that guy sending a packet every tick
because I've done that before
i don't like packets and i've never gotten round to learning about them, but should I?
if there's no better way to waste your time, sure
ty
Yeah the creative issue with client side lore is annoying
Granted it doesn’t matter if ur hypixel, they probably don’t use creative :p
or they can just afford to write those extra 2 checks
I started with php before getting into programming. And like what illusion said some of us have been doing this for years. I have been using java since nearly its beginning and doing plugins since mc existed officially.
Well yeah you can just strip it on the incoming packet
Or just don’t show it for people in creative
p much
Stripping it can be kinda annoying since you need to know what lines you are stripping
it's usually just the last X lines you'd be adding anyways
if you only add a single line saying its rarity, then you only remove that 1 line if the item's source is the creative inv
God damn. See i love programming. I love the puzzles and collaboration between friends/colleges. It's something I want to do as a job. I plan on doing this for decades. I'm a self taught everything pretty much. I've watched tutorials and read docs. Never had or taken a class.
Hypixel have set armors
and armor bonus which showing on the amors is changed by who see it
like if you wear 2 pieces you see any thing 2 pieces bonus
hypixel has a hybrid api, its totally different from what spigot api provides, so they may have api to do those things w/o low level packet interception
Is there a fancy way of adding "interactability" with the new TEXT DISPLAYs?
Other than just intercepting the interact packet
I assume they are client side only
hmmm..
In your case
so how could I make something happen when right clicking a text display..?
Before, I was using an armor stand..
If you actually spawn then on the server you can raytrace
Or you could attach an interaction entity to it
It’s an entity designed for detecting interactions
They can have a custom width and height
Can that be done on the client?
Make it a passenger
Help making a system to mount any entity
Help applying potion effects
how can i get the block under a player?
Get the players location and go one block down
You can either subtract one from the Y of the location
Or getBlock.getRelative
Thats good. Just a warning doing this as a job is different and could ruin doing this as a hobby for you because you wont look at programming the same way. It is why i mainly do this as a hobby
this is my code and that's what trying to do but its not functioning as i expected
public class pathspeed implements Listener {
private int SPEED_BOOST = 2;
Plugin plugin = DoofsToolkit.getPlugin(DoofsToolkit.class);
@EventHandler
public void onpathblock(PlayerMoveEvent e){
Player player = e.getPlayer();
Block block = player.getLocation().subtract(0, 1, 0).getBlock();
if (block.getType() == "minecraft:stone") {
player.setWalkSpeed(player.getWalkSpeed() + SPEED_BOOST);
} else {
return;
}
}
}
Well wasnt too far off
ooooh
The change needed wont draistically change their code much so that is good
Just change that string to Material.STONE
Or to whatever material you are checking for
if block.getType returns a Material then what checks for the block id?
What do you mean I’d see it differently? What changes ?
You can use Material.getKey to get the namespaced key of a material
And then toString that
When you do it as a job, you lose freedom in what you want to do and you are obligated to do whatever the employer is wanting you to do to include not optimizing or using non optimal solutions. When it is just a hobby you put whatever time you want into it as well as dont really answer to anyone
You know, now that you say it, that makes sense. I’ve never thought abt it that way, and the whole reason I got into this, was to create things I had to pay for and didn’t want to. That kind of freedom and creativity I don’t think I could give up.
But when you do it as a job all the time, you may lose interest in doing it as a hobby since your job requires you to do that programming for like 8-12 hours a day and may not want to use that free time you get to work on hobby projects
Some people manage to do both but from my experience that isnt the majority of people lol
So just a warning if you do seek jobs in the programming industry
Yeah, that kind of sways what I’d want. Cause I would probably get tired of it.
Lol
But that student debt was calling for youuu
Nahhh you’d have to have them. 😂
Or at minimum like minidigger who works for a bank and is on charge of their own team and works remotely with no real requirement to show up in person lol
bro if else fr
Would anyone know why my plugin is loading before Vault even though its in the depends?
My plugin needs Vault to do some things, but it loads after it
Make sure your depends is properly formatted
depend: [ProtocolLib, Vault]
And the exported jar has the updated plugin.yml
this is my code now and im not getting any errors but it is still not working
@EventHandler
public void onpathblock(PlayerMoveEvent e){
Player player = e.getPlayer();
Block block = player.getLocation().subtract(0, 1, 0).getBlock();
if (block.getType() == Material.STONE) {
player.setWalkSpeed(2);
player.sendMessage("on" + block.getType());
}
}
it was meant to be 1 but was testing 2
and it is still not working
Is the event registered
Check the event is registered and that the block below is indeed stone in the game
omg i might be dumb let me cheak
no lol i feel kinna dumb lmao
Does .addPassenger let me put a player on top of any entity?
to be fair its my first day so its not habbit yet ig lol
Is my depend not properly formatted or something..?
There is a tag for load after if i recall
for some reason, it seems like vault loads, disables, then reloads?
A trick is to format your code so that it doesnt depend on load order
depend is the one for load after
Yeah im using depend..
I mean.. how? ```java
public void onEnable() {
if (!this.setupEconomy()) {
this.getServer().getPluginManager().disablePlugin(this);
return;
}
I gotta get a Vault instance onEnable
Just check in the onenable for vault being loaded after like a minute or two or being enabled
What if someone tries to do something within that time that requires vault?
it'll error
Not if you just dont allow it or delay it
You can delay it by a tick and it should work fine
I delayed it by 5 seconds and it still didnt work
Since scheduled tasks don’t start until after everything is enabled
what the hack player.setWalkSpeed(2); is not working but player.setHealth(0); is
value - The new speed, from -1 to 1.
👍
What does -1 do? Stop them?
its working thanks for the help!
So walking is inverted?
I guess so
You can use load: POSTWORLD
Tho if you depend on Vault, your plugin always loads after it
it is just stoping me and making my FOV small lol
weird
it doesnt though.
ive tried depend, softdepend
indeed
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
The error it says isnt the actual reason its crashing
[00:44:04] [Server thread/ERROR]: [CadiaCore] [CadiaCore] - Disabled due to no Vault dependency found!
Unsupported API version 1.2
I get this error when setting the api-version in plugin.yml to 1.20
Wrap it in quotes.
Show your method which throws this message
Im quite sure u are registering perms or economy there
api-version: "1.20"?
public void onEnable() {
if (!setupEconomy() ) {
getLogger().log(Level.SEVERE, (String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName())));
getServer().getPluginManager().disablePlugin(this);
return;
}
this.setupProtocolLib();
this.registerClassInstances();
//this.furnaceRecipes.registerRecipes();
this.loadConfigs();
this.registerListeners();
this.registerCommandExecutor();
this.hologramManager.spawnOwnableHolos();
this.holoListeners.registerHoloListeners();
CadiaCore.instance = this;
}
private boolean setupEconomy() {
if (getServer().getPluginManager().getPlugin("Vault") == null) {
return false;
}
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
return false;
}
econ = rsp.getProvider();
return econ != null;
}
Ye
Which economy plugin do you use
Vault
?
tf
On setupEconomy method
bro..
is it seriously erroring cause i dont have essentials on my test server
i swear to fking god
Why can I drop items even when cancelling PlayerDropItemEvent?
Yeah
Vault for some reason only registering eco with any economy plugin
And perms with PEX or LP
It's one of the biggest misconceptions people have about Vault.
Vault is just an API. Nothing more, nothing less. It cannot be an economy plugin itself.
Yeah
It’s also not a perms plugin
Its just using this RegisteredServiceProvider stuff
It’s nice to have a unified api
Which is part of bukkit iirc
Even if it is somewhat dated with no async support
Yes but the vault api doesn’t support async
To test your stuff
Would be nice to have some future methods
I don't know if this guy cares
Fair
Did the Treasury devs ever gain enough popularity?
What is Treasury
A Vault alternative.
Never heard of it
So i guess in Russia it's unknown
Every server i worked on used Vault and random eco plugin
And LuckPerms ofc
Hmm, might be dead. It was gaining traction at one point as it all started as a Resource thread.
https://www.spigotmc.org/resources/treasury.99531/
I guess we are the last guys who switched from PeX to LP
Im sure half of russian servers still use pex tho
They are doing a V2.0 of the api rn
They claim that Vault is outdated but without evidence the claim really doesn't hold water
Vault really is outdated, there is no point arguing against that
It just works TM
^
I love Skyrim community(except LoversLab)
Meh, UUID support is the main thing I am looking forward to
But it won't happen in vault - ever
For years i thought that Vault isnt a real word
Several years ago i found this word in a random book
The biggest issue with treasury would probably be their willingness to break things. Would mean that plugins would require a specific version. I guess you could shade it if you really wanted to
Still everytime i read it i get Vault's icon from dev.bukkit in my head
That is the main concern yeah
B I G decimals 
They are doing Biiig decimals here
Whats that plugin name
ayo
What packet gets sent when u right click a block
Depends on the block as there could be multiple packets
how do i use hex color codes for text in 1.20 spigot?
i used this before
Bukkit.getConsoleSender().sendMessage(net.md_5.bungee.api.ChatColor.of("#0033ff")+"["+net.md_5.bungee.api.ChatColor.of("#ffffff")+"FactionsUUIDLOTR"+net.md_5.bungee.api.ChatColor.of("#0033ff")+"] "+ChatColor.RESET+message);
but it doesnt work anymore in newer spigot
?jd-bcc
I like how that link has "latest" in it, when it really isn't the "latest"
still using 1.16 bungeecord chat stuff
we dont question the scuffed javadocs
run either mvn dependency:tree or gradlew dependencies and see if its listed
🧌🧌
well i opened a plugin i made for 1.17
and changed it to 1.20
and this broke the net.md_5 stuff
what exactly did you change
and how
where
i just removed the old 1.17 spigot api jar from my external libs
and put in spigot-api-1.20.1-R0.1-20230626.214335-16.jar
im trying to set a horses heath two double on spawn
this is my code so far
public class HorseBuff implements Listener {
@EventHandler
public void Spawn(EntitySpawnEvent e){
if (e.getEntityType() == EntityType.HORSE){
// set health * 2
}
}
does anyone know what i would use to do this?
To set the health?
e.getAttribute(GENERIC_MAX_HEALTH).setBase(...)
or something
setup your workspace with maven and use that to manage dependencies
This might be your problem but idk
max health yes
getAttribute is not listed
uuhh I believe only LivingEntity has attributes so you have to cast the entity
if you can use instanceof pattern matching as well
There is any like e.getEntity().setHealt() or something like that?
that I believe is deprecated
Idk, never managed with that
How you use the docs
you search...
how would i implement this?
like this?
getAttribute is not listed
like this is where im at and it wont let me get or set attributes
@EventHandler
public void Spawn(EntityTameEvent e){
if (e.getEntityType() == EntityType.HORSE){
// set health * 2
e.getA
}
}
they said to cast your entity to a living entity
since attributes only apply to living entities
e is an event here... not an entity
sorry one sec...
now what would i put in to set the max health
@EventHandler
public void Spawn(EntityTameEvent event){
if (event.getEntityType() == EntityType.HORSE){
// set health * 2
}
}
I would start by getting the entity...
ye that fixed it thanks
i used shaded jar instead
Hello, i am trying to create placeholders with placeholder api (not using any exetension, directly the plugin), so i create my project, ans depends, i add PlaceholderAPI, and then i also have to do something in pom.xml?
like event.getEntity() or how do i call it becuse there is no setAttribute under getEntity or am i doing something wrong?
there is no setAttribute
you use getAttribute
I mean just look at the docs I guess
Maybe you can try Entity entity = e.getEntity() but they said the method is for a LivingEntity soy instead of Entity type use Living
entity and you cast like they said
If I’m wrong correct me pls
if (entity instanceof LivingEntity livingEntity) { livingEntity..... }
I am not giving more
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
i have been but i am new to java as a language and i am confuzed but thanks for your help up to this point i will try and work it out.
in that case
well looking at docs should not be a java exclusive skill
and also mardroide and steve should look the docs as EntityTameEvent::getEntity returns a LivingEntity
yes
they changed the event for some reason
maybe they changed their mind ?
its fine
Better I don’t say anything because I will be wrong a 100%
well if you never say anything you will learn way slower
better to get corrected on something you said than not say anything at all
generally speaking ofc
Yeah, but some people correcting sometimes are so annoying 😂 the just say ‘learn Java’ idk if I explained that well.
thanks for you help guys i just dont think my brain was braining because im very sleep deprived :/ Have a good rest of your day/night.
Use the SHADED jar instead
lmao first read the whole convo maybe ?
Well that was well below the original message, hence I assumed it went unnoticed
fair
How do I make the other players clients think that a certain player has no armor or items?
And eh, better be safe than sorry
packets
What packets
There is anyway to like change the opacity of a player?
uhhh
you only have one set opacity that you get with invisibility and some team settings
how to get the actual displaying name of an itemstack?
Example: if no name was set, it should answer what's displaying still "Netherite Chestplate"
Are those hard coded or can I actually retrieve it? (i can always make a custom function ofc)
.getDisplayName() doesn't do the job well, it just for custom names
its null if no name was set
The idea is to do the vanish command but the people that are vanished see them with a 25% more or less of opacity
I wonder if the same applies to players
If you also have been vanish
idk tbh
I know I need to use packets, but I have no idea what packets those are
There must be some packet sent to the other clients, so ig time for fun
Set Equipment
Packet 0x55
Hmm
hmm I just accessed it with firefox tho 🤔
Lol
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>``` I'm trying to use nms, I watched a video on it and really just don't get it
anybody up to help me?
?nms
I'm trying to do it with paper.
?fork
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
got this shit down huh
?whereami
this place is a joke bruh
Use spigot and we'll help. You are not.
You are a joke
Woah now, no need to get all mad guys
what event is fired when a player picks up an item?
PlayerPickupItemEvent
thanks
bro has been typing for a while
huh
Bouta read none of it
The message and explanation is clear and understandable. I don’t find a reason to say that this place is a joke. Without md_5 and spigot maybe a lot of thing wouldn’t exist in minecraft
Don’t read then
Damn thas sad
Not sure it is actually PlayerPickupItemEvent
I mean it still works
PLAYER
You should use it anyways.
Why
Yes
PlayerPickupItemEvent is not deprecated
Let me check
You are not using Spigot
this is the page you just sent
this
Yes
um, I'm probably reading wrong.
Yep you are 100% correct
EntityPickupItemEvent is its replacement
just check if entity is instanceof player and do whatever needed
It's not deprecated on paper
Bruh
petition to add :nopaper: emote ?
yes
📜
nopaper
I’ll make a emote for that
🥵
Does anyone know if there is a way to organize and structure the hierarchy of npc names on the tablist? I'm developing a minigame which utilizes fake player instances, and I'm assigning kits to them which are showcased on the tablist. The problem is, there should be a descending order of how the players are displayed, from the rarest kit to the most common one. I'm familiar with teams and how to manipulate players on the tablist, but I'm unsure what the best approach here would be considering I'm using packets to display npc info. Any help would be much appreciated.
if you do, please send it to me so I can add it to my server and use it at least
Sure
how i can ban player on ALL servers, cuz im making a spigot plugin for bungeecord server and if i ban player on 1 server, they can still join other servers, how i can fix that
You'd simply put the npcs in teams
You need to have a way to store all player punishments globally, for example in a mysql database, and access it to check when a player attempts to join/chat
I understand, which is why I'm asking if there's a way to achieve the same effect when using packets
Teams uses player names or uuid
You don't need to do anything special
Entering the npcs information in to the team api should work just fine
if you want to order them in tab use unprintable chars in the team prefix
Essentially yes, I'd like them to be displayed in the tablist with respect to the rarity of the kit they have, which would place them above some players and below others
I was researching if this could be done in a different way with packet manipulation, as I don't think adding them into teams worked properly
the method is #addEntry which takes in a string
players you add by name, entities you add by UUID.toString()
and this has to be a uuid for entities? such as randomUuid ?
the entities UUID
But I'm creating and sending a player info packet to display the npcs in the first place, there are no actual npc entities
you are using players so you use their name
You have no Bukkit entity so you will have to send team meta packets yourself
yes, that's the issue I'm having with
with team manipulation
I'll have to do some research into team meta packets, I don't think I've heard of that
you've given me enough info to work with, thanks for the help, I'll do some more research into the problem
if (entity instanceof Player player) {
}
not needed nesting
I remember, when coding discord bots there was some error that made returns crash sometimes because of some shitty library and since then I'm scared to return lol
what
Why a cross emoji
look at my reply
that creates a layer of nesting
for no reason
why wrap the whole thing?
I wish I could do shift alt f or whatever it was in vscode to format my code
if (!(entity instanceof Player player)) return;
idk how to do that in ij
this works exactly the same
you can
Prettier
code > format code
