#help-development
1 messages · Page 1167 of 1
Just disables the custom ticking behavior, makes the entities tick every.. tick
man
Well, wouldn't that take a lot of juice out of the server?
It's just misc entities, minecarts, items, idk what else
Really all that would do is match vanilla
And fix the spigot bug
is there a way to modify how many items can you put in Bundle so it is not limited to one stack amount
I don't see any method in BundleMeta.class
I'm looking through the API and I don't think spawnFallingBlock has any constructors which accept a Consumer. There's one which accepts byte data, but .. ?
Oh, hm. Maybe like this?
var fallingBlock = Objects.requireNonNull(location.getWorld()).spawn(location, FallingBlock.class, consumer);
yeah like that
that was ages ago
debug the return value
see what material comes up
see if it's a block or a block state
no idea
the packet shows huge
is the password 4.7k characters or something
?
yea
that's very weird
yeah I got no idea either
I've never done really databases
but this ain't supposed to happen
yeah, it always returns false
i'm sure your way works, but you can use properties to declare username and password
public MySQL(MySQLData data, Properties properties) throws SQLException {
super(DriverManager.getConnection("jdbc:mysql://" + data.getHost() + ":" + data.getPort() + "/" + data.getDatabase(), properties));
}
Properties properties
Properties properties = new Properties();
properties.setProperty("user", data.getUser());
properties.setProperty("password", data.getPassword());
your way should work as well tho
i use properties because i can allow the end user control over them
I don't know what is going on, but that messed up my whole server.
[18:42:06] [Server thread/WARN]: UUID of added entity already exists: EntityFallingBlock['Falling Air'/4590, l='ServerLevel[Kuumaa]', x=896.50, y=-32.00, z=-570.50
I'm getting a lot of these errors and it's super laggy.
Here's what I tried to do.
it seems you added an entity using the same uuid
At line 246.
Not intentionally.
I'm not sure where that happens or why.
The other spawn method didn't have this problem.
instead of bukkit runnable you can use Bukkit.getscheduler run task plugin () -> {//your code here}
it's cleaner
will that fix the issue? if so, why?
no, that won't solve the issue
but seeing how clean your code is i thought to help you a bit here lol
Also this does not work, at all
i think you're going over the same block twice
spawin the entity only once per block
it was pseude code
xD, dont use pseudocode if you are talking about the syntax
the correct format is like:
Bukkit.getScheduler().runTask(plugin_instance, () -> {
//Your code here
});
That would seem to be the case, but the problem is I'm staring at the code but I can't see the issue.
well, you've wrote this
you an decypher it better than someone who gives you a possible fix no?
but i think your neighbouring algorithm goes twice over
or more than twice
not sure
I wouldn't have asked for help if it wasn't a problem in this case.
without trying to change your algorithm a fix is to use a set that has the blocks you already looked at
if (checkedblocks.add(block) ) {
//spawn falling block
}
it'll be false if the block is already in the set
What’s prob the best place to learn Java to code Minecraft plugins? People here? Website?
For some reason that doesn't seem to work.
show code
i hope your set doesn't get reset every time
I don't know why it even tries to run several times.
use Block instead of Location
and now that i look i see you have a List of blocks
you can use it instead of the list
Set<Block> and initiate it as new LinkedHashSet<>()
this will keep the order of the list as you add blocks to it
and also have the property of being a set
@lilac daggerI'm having hard time following what you're saying. Your sentences seem to be contradicting each other. Can you elaborate a bit on what you mean by all that?
Tracking blocks instead of location seems to work. I made a mistake there.
But all that stuff about the list of blocks and set and linkedhashset, that I didn't understand.
i haven't contradicted myself
private void tryMakeBlocksFall(List<Block> blocks) {
here a set
instead of list
you don't need both here
and also don't use locations
you're getting new locations every time you call a get location
it'll never equal
a block instead will be the same for as long as the chunk is loaded
I'm not that great with all these weird Java collections. I'm more familiar with C# 😓 but I'll try to replace all the List<Block> with Set<Block> if you think it's better.
Except I can't. They can't be sorted.
And I don't really see what the benefit is.
But at least the core issue now seems to be fixed. Thank you so much for helping.
and use block instead of location
and you don't need to remove blocks
you're giving it a new list every time
and if you don't remove while looping a list of blocks
you don't have to do it a tick later either
it can be done at the same time
no problem
The 1 tick delay, if I remember correctly, is to correct an issue where the blocks were falling on top of each other and landing at the same time and some of them were removed by MC.
So if 3 blocks fall only 1-2 might make it.
if that's the case just remove this anyway processingBlocks.remove(location);
the list is a throwaway
removing from it will only cause unnecesary resource usage
let the gc remove it
people here say to use
?learnjava
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉
I changed world container directory in bukkit.yml and when i trying to get worlds with Bukkit#getWorld method it returns null
solved by adding "--world-container plots" flag after "nogui" flag, then i recreated the worlds and it works nice
so i wrote code (similar to this)
int times = 2;
for (int x = -range; x <= range; x++) {
for (int z = -range; z <= range; z++) {
Block nearby = block.getRelative(x, 0, z);
if (!(block.getBlockData() instanceof Ageable crop)) continue;
if (crop.getAge() == crop.getMaximumAge()) continue;
for (int i = 0; i<times; i++) {
nearby.applyBoneMeal(BlockFace.UP);
}
}
}
we are iterating throug blocks in distance of "range" and "times" is the amount of times you apply bonemeal to each block, but when times = 2 or 1 it works fine, but when its more than 2, this happens - (image)
any ideas? i have no ideas, also what im trying to do is to bonemeal every block until its grown so its getAge() == getMaximumAge(), so i made for loop like this
for (int i = 0; crop.getAge() < crop.getMaximumAge() && i<times; i++) {
nearby.applyBoneMeal(BlockFace.UP);
}
maybe its a bad solution?
What is wrong with the image. The stage 1 crops?
Why don't you just... set the age? I don't understand the reason for bonemealing it an arbitrary amount of times
If you want the particles, you can play the effect for it
world.playEffect(blockLocation, Effect.BONE_MEAL_USE, 3) (the 3 is the amount of particles)
Why is my maven build button greyed out
Whats the difference between BlockState and BlockData, like how do I know if a certain property of a block will be in the block state or the block data?
BlockState = block entity, like a furnace. It has NBT data
BlockData = block states, e.g. the way it's facing, or whether or not it's lit, etc.
Yes :)
ok
but who named those things
why does block state not hold.. block state
is it just that old ?
i love BlockStates
best api ever
i wish there was a better way to get specific block states/blockdata without casting
but that's life with java
BlockState is extremely old, yes
"Block states" as referred to in vanilla didn't exist when Bukkit's BlockState was invented back in like 2011
we wouldn't even know how they were named internally since everyting was obfuscated anyway
yeah, they all should get grown, but it grows in a weird pattern
i can show you with bigger distance, its the same shape
cant figure it out
So some of them randomly dont get grown to 100%?
not randomly
its a shape
i think that
you know its a loop in a loop
so when it reaches the middle block it stops?
now i think about it and thats probably it
but why
Let's go caveman
Print out the x and y values
have u tried crop.setage(crop.maxage)
x and z
yes that
you can spawn them yourself
yes
no, i wanna fix this solution
ok
know why doesnt work
what for?
i already did it
and printed their age
ok thats solution but i still wanna fix this one
And? Are the coordinates shown?
of the blocks not grown fully
It seems youre only applying bonemeal twice
Try
while(age is not max age) applyBonemeal;
this is wrong
I think ?
i think you dont get itt
the thing is that if i apply bonemeal 2 times it works, if more, it doesnt, if there is more than 2 it only applies bonemeal till it reached middle block
but why
should be nearby not block
jesus..
thats why it stoppes after middle block
because middle block is fully grown then
and it chekcs the middle block alwayss 💀
imma try it
i mean change it
idk why i didnt realize
😭 thank you so much
what i did is actually something like this:
for (int i = 0; crop.getAge() < crop.getMaximumAge() && i<100; i++) {
nearby.applyBoneMeal(BlockFace.UP);
}
so it tries until its fully grown, or if it repeats 100 times its stops, just for safety
100 is too much probably but..
yeah works
or you could not waste precious processing power on useless loop and just "grow" the crops directly
umm
grow?
but i dont actually loop 100 times, its for safety, it probably will loop 2-3 times and end
doing this is just objectively bad
ehh
why is it objectively bad?
you're making something as simple as growing a crop not deterministic
Idk the exact bone meal chance but what if you just get really unlucky
then someone will be like "what?" and i dont care 😀
and.... its actually
probably bonemeal always grows plants
its just random how much
so in 100 times it will grow full
ill check
Wut
You can get really unlucky with Beetroots haha
lol
and trees I think?
But your reluctance to change this simple thing scares me
Do not become a professional developer
i dont bonemeal them anyway
bruh
i can change it, i was just asking
basically if you have to say your code "probably" does x, you might want to reconsider it
obviously there's some cases where it's unavoidable but still
i did, and now i know that beetrots have only 75% chance to grow xdd
anyway
thanks for help steve
that was dumb
👍
that was rude though
i can kind of understand him tho, but the thing that matters is: you learned something new and can improve next time
only with inefficient code and errors (aka you learn something new after it) you can become a good developer, its a learning process we all have to go through :)
yeah, all that i get it but "dont become a professional dev" like whaaat
yes
Do you have any experience with Java?
you do need a bit of a thick skin when asking in these help channels, some people will just choose to criticquize before actually helping. The intention is always good, the means are bad
you can either be the bigger person, take a deep breath and try to figure out what they actually are trying to convey outside of the attitude given, or just ignore the comment and hope someone else answers in a more appropriate manner
No lol 😭
I was expecting if someone has a tutorial (video or written), because i already did a lot of things (like programming) just using a tutorial 🥹
?learnjava
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉
https://lp.jetbrains.com/academy/learn-java/ is a good choice too
oops, that's already linked there
whoever has access to the bot should change the link to the learn java course tho
Even if i learned, i don't found anyone talking about how to update a plugin 😓
Update can mean a lot of things
if you learn java then you'll be able to figure out where to start upgrading your plugin
as said above, it isn't a straightforward process, the bigger the plugin the worse it'll be so bear that in mind
it is also annoying if they depend on overly specific behavior or if it mainly depended on server internals, but not the end of the world
updating to a new version!
like 1.21.3
Take this into account then, when you’re using an api of some sort (obviously in this circumstance it’s spigot) and you need to update to a newer version of said api, that means perhaps a lot of the internal methods and workings and what not may have changed. Without learning java and attempting to implement versioning support you’re going to have a very hard time. It’d be very hard for you to understand the code as is not to mention what you’d have to do to backport a plugin for example
Generally yes, but that’s the issue is in those niche cases
forwards compat**
And certainly not easy considering you’re raw dogging nms versioning support
No, backwards compatible
i dont think spigot is backwards compat
its pretty compatible
im on 1.8 and all the methods are pretty much the same except for new stuff
backwards or fowards theyve done a good job
1.8 stuff works on 1.21 not 1.21 stuff works on 1.8
The Wii was backwards compatible with GameCube games
"If something is backwards compatible, it will function with earlier versions of the product. Something will function with a later version of the product if it is forward compatible."
“Forward compatibility or upward compatibility is a design characteristic that allows a system to accept input intended for a later version of itself.”
Spigot will not accept input for later versions of itself
If you try to use 1.20 api on 1.12, it will fail
i blame whoever came up with naming
The new model item component makes me a bit sad
CustomModelData fails somewhat gracefully, if you have an item with custom model data but not the resource pack, it’ll just show the default item
If you have an item with the custom model component but not the resource pack, you get missing texture
But you don’t have to worry about custom model data conflicts, so it’s a pretty good trade off
Well, it's still can be an advantage, if you're making project with obligatory resource pack, missing texture will make people download resourcepack
A fallback option would be nice
@remote swallow is it your birthday already :O
yeah
Happy birthday big boy
tyty
DAM!
born on the same day someone tried to explode parliment like 400 years ago or smth
I'll blow you up
Finish his job, then blow me up
It’s gonna have to wait I broke my pinky toe
Cut it off
Cut it off
No!!
its @floral drum ?!
It might be idk how purple purple actually is
doesnt the server store if the player accepted the pack or not
does anyone know how i can set the durablity of an itemstack?
as far as i know theres no info online about this, and i look at the docs and its either not true or doesnt work
yes, i did
im reading through them right now, i didnt get these results on google
I somehow doubt that.
the first result should tell you what changed
and the docs tell you what's deprecated.
im not interested in an argument right now, i just asked a question man
duckduckgo :(
its in itemmeta
not itemstack
it moved
if u havent looked @ wht they sent, it should be something like
var itemMeta = (Damageable) stack.getItemMeta();
itemMeta.setDamage(1);
stack.setItemMeta(itemMeta);```
the hell you mean :(
searXng to the 🌑 🚀
(i actually just use Startpage and sometimes Qwant)
and thats where my issues arises lol
dMeta.setDamage(1);```
setDamage is red in intellij, so that lead me to believe the docs we're wrong 😭
unless i did something wrong?
what version spigot API
^
maven or gradle?
maven
version says '1.21-R0.1-SNAPSHOT'
dumb question, does it still compile?
ignoring the obvious red hinting from ur IDE
because it could be invalid caches on the IDEs part, despite the method existing
Did you import the wrong Damageable
TRUE
There's two of them
wish bukkit/spigot would differentiate besides the package sometimes
OH YEA, it says entity 😭
i had no idea there was two of them
bukkit is spigot
so why would they differentiate
thank you all btw (I was starting to bang my head against my monitor)
but they do... sometimes, randomly... every once in a while...
e.g. this lol
I never know: what url do I use?
Or do I need to register some driver for this to not happen?
if (currentTime - farmingBlock.getDestroyTime() >= 4000) {
PacketContainer restorePacket = new PacketContainer(PacketType.Play.Server.BLOCK_CHANGE);
Block block = farmingBlock.getBlock();
int maxAge = ((Ageable) block.getBlockData()).getMaximumAge();
WrappedBlockData restoreBlockType = WrappedBlockData.createData(block.getType(), (byte) maxAge);
BlockPosition position = new BlockPosition(location.toVector());
...
...
}
Can someone help me ? When i have the maxAge variable in the createData methods, i got this log and a little lag:
[org.bukkit.craftbukkit.legacy.CraftLegacy] Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!
what's your api-version
Oh yep api version i know
its was 1.20
sry
will try with 1.13
I have change api version to 1.13 in spigot.yml but i got the same warn
let me check
ok so with
WrappedBlockData restoreBlockType = WrappedBlockData.createData(block.getType());
There is 0 warn and the crops respawn with the minimum age so
If i come back to
I got the warn, and the crops respawn with the maximum age (after the lag caused by the initializing legacy material....)
plib may be calling a legacy material then, upstream
yep
private static WrappedBlockData createNewData(Material material, int data) {
return new NewBlockData(FROM_LEGACY_DATA.invoke(null, material, (byte) data));
}
find a different way
no way to fix this so ? until i use another lib ?
Ok nice i have found another way to do it
i don't know why im was doing that with protocolib actualy lol Player::;sendBlockChange(location, block) work great lol
👍
What does your query look like?
wtf
hi frosty :D
SELECT time, length, reason FROM punishments WHERE type = 'ban' AND uuid = '%player's uuid%'
But the error is thrown on getConnection
I may not know SQL, but uuid = '%player's uuid%' does not look good.
as in you got 3x '
It's a placeholder
You should avoid using ' in place holders when it comes to queries also you should use the query builder methods if you do have them to avoid unintended side affects
That being said i think you should fix the query to see if that may have been causing your issue otherwise your issue is the server is returning a lot of records that exceeds the server config limit for a packet which only ways to fix is either limit what is returned or increase the limit in the config
What about
`SELECT time, length, reason FROM punishments WHERE type = 'ban' AND uuid = '%player's uuid%'` LIMIT 10
I think that should be the next step after they eliminate that ' in the query
I think bro already uses prepared statements
Ok but it will cause issues if its not replaced
You cant assume it will always replace
Mysql is picky about its quotes lol
But since they are having issues i think it is best to use process of elimination and make things proper
This way we know what is definitely not the problem and wont be a future problem
Or use mongodb (bad ending)
Lol. There is query builder methods to use place holders. Not that hard to change it. Currently two issues with it. If place holder value does not get replaced query is cut short because of the 'and sometimes mysql runs with it. Then we have the issue if place holder is replaced but its empty instead
Proper query builder avoids those things
PacketTooBig is thrown
At DriverManager.getConnection
It's not the actual placeholder
It was added for show
Add this before getting your connection. Also put your connection in a try statement as well
try {
// The newInstance() call is a work around for some
// broken Java implementations
Class.forName("com.mysql.cj.jdbc.Driver").newInstance();
} catch (Exception ex) {
// handle the error
}
This should register that you want to use mysql driver in case some other driver is trying to be used instead
There probably is
But i wouldnt know of any off hand. I normally just make my own so that i can easily transform data from one to the other as well.
Like if a user wanted to export to another storage format for example
I literally need just this
Wouldnt surprise me if one exists but sometimes you need to make your own since only you would know what data is actually necessary and what isnt
Or if you make use of primary and foreign keys you would know how that data is related
Btw, what does this do?
The limit
Db will give 10 rows instead of giving them all
I think the problem that users might have long records
why u guys don't support hybrid (modds and plugins) servers?
so someone told me that if you are going to open a modded server, i should do it with mods instead of plugins.
if i make a mod on the client side, can i force players to enter the server with that mod?
you cannot force anyone to download a mod
i just want the logins to be with my own client.
You're always gonna be able to spoof that tho
well, is there any way to do this? as i said i want them to log in with my own client so i can reduce the cheating a little bit
I think a solution would be to have an actual account thing
Have your server (not the MC) send some kind of token to the client, the client then sends that token to the MC server and then the MC server can verify that you logged in with that mod ?
But this does not really belong here, go to Forge or Fabric discord server.
But sorry to tell you, if you have to ask this, whatever anti-cheat method you create will probably not be sufficient.
well, what do you think is the best solution against cheats?
You can always spoof communication from the client to the server
But you can not spoof a token a remote server gives you
What I proposed is basically what MC used to do before MS accounts
You send the wrong token to MC server ? whoops, no entry for you.
well ty guys
if you are going to go with your own client then your best bet is to change the protocol
make it so that the server doesn't rely on the client input, rather the client informs in what it wants to do but the server has ultimate say
however do note the more the server needs to do the more resources it will need
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
plugin name zacution house
Are you developing a plugin ?
na
go to #help-server
Amount of falling blocks in world Kuumaa: 39057
What can I do?
Why don't they disappear?
Are they outside the entity-activation-range
if so they might not be ticking enough to land
Well. I added timer to remove the falling blocks.
And it does seem to work.
Although maybe a bit too fast.
And I don't understand what causes those physics, the blocks move back to where they started and then they fly off again.
Back and forth.
Is it about the entity activation range or something?
probably
I tried setting it to the 0, but it resulted in horribly buggy and dangerous behavior.
Would increasing it make it better... ?
I'll give 8 a go.
That's quite low
The default was 4.
The default is 32 for mobs and entities
Really? Hm. Okay.
You've probably followed an "optimization" guide that told you to lower it for performance
Perhaps I did. I don't remember anymore.
gradlew build
explain
That's the command
where
in the project folder
yes those are the files that it will be using
through command prompt?
yes
is there no way to build it through intellij
Open the gradle tab on the right and find the build task
why does this source have imported stuff from packages that dont exist??!!
You're probably missing a dependency or smth
why are you blanking part of teh package path?
also, why the heck is fastboard being relocated under .minecraft?
its a dev name
no leaking 🫢
its the main package name
the import should be the normal import for fastboard. it will be remapped when shaded
now in english
fastboard is a dependency
right
right
you shoudl be using teh default fastboard package path in your code
when you build it will be remapped to yoru relocated path
idfk which package its from
fastboard
oh
right
so what do I do
rewrite the imports??
yes
it looks like you are using decompiled code if yoru imports are remapped
thats what Ive been thinking too
why did they use .minecraft for their relocated packages
Instead of .libs or something sane
its the default package
if ykwim
supposedly this isnt decompiled
so then tf is this
i love how we're censoring packages now
i just don't use packages
it's my code, i can obfuscate it if i want
Pretty sure bigger applications can save megabytes of space by obfuscating
How can I serialize an ItemStack into a byte array?
why inventory click event is such a mess? why clicking in creative inventory is different, and is hotbar different inventory than the rest?
Not sure what you mean by "hotbar is different than the rest"
as for the creative inventory that's just how it was programmed. The client has full control over items in their inventory when in creative mode
different inventory
i mean that
the hotbar is considered as different inventory than the other 27 slots
i mean when you shify click on item the item gets from hotbar to the other slots, its MOVE_TO_OTHER_INVENTORY
i think its a mess
It's not
The shift clicking action is just called that
'bot_eq':
material: armor_boots
data: 1
priority: 1
slot: 37
display_name: "&aThis is a special stone"
lore:
view_requirement:
requirements:
bot_kontrol:
type: has item
slot: "36"
material: armor_boots
amount: 1
update_interval: 5
'bot_noeq':
material: BARRIER
data: 1
priority: 2
slot: 37
display_name: "&aThis is a special stone"
lore:
view_requirement:
requirements:
bot_kontrol_yok:
type: has item
slot: "36"
material: AIR
amount: 1
update_interval: 5
Why doesn't this code work? can you help
That's a yml file
Not code
Move to #help-server and use a paste site instead of flooding the chat
?paste
ty
Does 1.8 have PDC?
||i dont think so||
It doesn't
It was added in 1.14
what do you do when you want to make item unique in <1.14 ?
Nbt
You use nms to set the nbt
PDC is the Spigot API layer on top of NBT
and NBT is the data that's saved
short for net.minecraft.server
later
which generally just means Mojangs code
some may even call the CraftBukkit stuff as nms
so it can be used as a broader term than it's origin
ummm its mojangs code? like the same but variables were called weird
It's obfuscated yes
because its decoded or something i dont know
but you can add mappings on top of it to reverse the method, field and class names
and you do stuff like b.a()
I believe most people call craftbukkit code obc or something along those lines
We use spigot mappings
if there were mappings in 1.8 yea ;d
Never seen anyone say obc
Constantly see it here
There are mappings for 1.8
Just not Mojang ones
There are spigot mappings and mcp mappings in 1.8
well yea. i mean by mojang
People have also been backporting yarn
reverse? what does it mean
It does exist, but I don't think we got any decent software to use it with spigot yet
okayy
I'm makign sploon with @blazing ocean but that'll take a while
do you know this?
what about it
a very nice read ^
why dont register the inventory in "handleOpen" method, because you unregister it in "handleClose" method, so why not register in open method?
what if you want to open the menu twice?
Because it's registered when created
i thought it only exists only when player has it opened
^^ He does
thanks
so its also true that inventory only exists in the map while player has it opened
okii
Can someone help with my code, it doesn't work when the value of dayLength is above 24000
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
if dayLength is above 24000, it has no effect and the daylight cycle still takes 24000 ticks to complete
and what is the "effect"
for example if i set dayLength to 48000, the daylight cycle should take twice as long to complete
but it doesnt
[18:28:32] [Server thread/INFO]: MrNameless666 issued server command: /rpgcalendar set 48000
[18:28:32] [Server thread/INFO]: Cancelled existing task for world world with task ID 23.
[18:28:32] [Server thread/INFO]: Scheduling task for world world with interval 2 and increment 1
[18:28:32] [Server thread/INFO]: World time now: 22882
[18:28:32] [Server thread/INFO]: World time now: 22886
[18:28:32] [Server thread/INFO]: World time now: 22889
[18:28:32] [Server thread/INFO]: World time now: 22892
[18:28:32] [Server thread/INFO]: World time now: 22895
[18:28:33] [Server thread/INFO]: World time now: 22898
[18:28:33] [Server thread/INFO]: World time now: 22901
[18:28:33] [Server thread/INFO]: World time now: 22904
[18:28:33] [Server thread/INFO]: World time now: 22907
If I rmember there is a seperate setting for day/night cycle
it defines the transition period
Do Daylight Cycle is turned off, so nothing else should be affecting it
What values are you getting for gcd
public long gcd(long n1, long n2) {
if (n2 == 0) {
return n1;
}
return gcd(n2, n1 % n2);
}
gcd of 24000 and 48000 is 24000, so the time increment is 24000 / 24000 = 1
and the interval is 48000 / 24000 = 2, then thats put into a syncrepeating task, so every 2 ticks, increase the time in the world by 1 tick
Are you sure those are the values you are getting
Yes, as in the code:
// Calculate the GCD of the day length and the default Minecraft day length (24000)
long gcdValue = gcd(dayLength, 24000L);
// Calculate interval and increment
long interval = dayLength / gcdValue; // When to update the time
long increment = 24000L / gcdValue; // How much to increment the time
getLogger().log(Level.INFO, "Scheduling task for world {0} with interval {1} and increment {2}",
new Object[]{world.getName(), interval, increment});
I feel like you're overcomplicating this
Make a task that ticks every second
each tick it adds 1 to some counter
you divide that counter by the amount of ticks a day should have
multiply that by 24000 and set that to the current world time
I think that should be the math
That would also take care of days which have length of something other than multiples of 24000
So would it work with all values of day length, such as like 240, 28800, or 1728000
You could also use a fixed interval of 1 and allow decimal increments
Then just floor it when setting the time
@young knoll hlo sir
I just told you to not ping random people
Bro I need help
Have some patience
You're not gonna get it by annoying random ppl
ikr
im trying to set a leash from a player to an armorstand but it doesnt work
Wrong channel and bad manners will not help
the armor stand is invisible, would that be the reason
Ok
Show your code
My guess would be that simply players can not be lashed
But I never tried it so idk
private void createWorld(String worldName) {
gameWorld = Bukkit.createWorld(new WorldCreator(worldName));
}
private void teleportPlayersToGameWorld() {
gameWorld = Bukkit.createWorld(new WorldCreator("world_2"));
for (Player player : Bukkit.getOnlinePlayers()) {
player.teleport(gameWorld.getSpawnLocation());
}
}
private void deleteWorld(String worldName) {
World world = Bukkit.getWorld(worldName);
if (world != null) {
Bukkit.unloadWorld(world, true); // Выгружаем мир
File worldFolder = new File(Bukkit.getWorldContainer(), worldName);
if (worldFolder.exists()) {
boolean deleted = deleteFolder(worldFolder); // Удаляем папку мира
if (deleted) {
getLogger().info("World " + worldName + " deleted.");
} else {
getLogger().warning("Failed to delete world " + worldName + ".");
}
} else {
getLogger().warning("World folder " + worldName + " does not exist.");
}
} else {
getLogger().warning("World " + worldName + " not found.");
}
}
private void teleportPlayersBack() {
for (Player player : Bukkit.getOnlinePlayers()) {
player.teleport(Bukkit.getWorld("world_2").getSpawnLocation()); // Телепортируем обратно в основной мир
}
}
private boolean deleteFolder(File folder) {
if (folder.isDirectory()) {
File[] files = folder.listFiles();
if (files != null) {
for (File file : files) {
deleteFolder(file); // Рекурсивно удаляем все файлы и папки
}
}
}
return folder.delete(); // Удаляем саму папку или файл
}
Can anyone help? I need to delete and create a new world after the end of the event, but for some reason it does not happen
payphoneMachine.getEntity().setLeashHolder(player);
payphoneMachine is just an armorstand
hm
well using getEntity, i get the armorstand
lemme try if it works if the armor stand isnt ivisbke
invisible
Try it the other way around ?
I’m not sure the game likes leashing armor stands
na didnt work g
na idk
didnt even work with the
non invisible armorstand
maybe cuz there is no "leash holder"
the invisibility has no effect
needs to be created somehow?
sn
one sec
na it doesnt work
but i think i might know why'
im putting an item in the players inv right after
would that cancel the leash
i want the player to hold the item and still have the lead
?tas
guys, any tips on reading and modifying other plugins' source code?
At runtime ?
??
I'll take that as a no
yeah
what u tryna do cuz that can be illegal
not decompiling, dw
and not
illegal stuff
what u tryna modify
Reading and modifying isn't
a plugin left over by another dev
yeah nah leash holder still doesnt work
Then just open up the project
I did
decompiling aint illegal
but theres a bunch of code
Now take a look around and see what things do
no?
u couldve worded ur original statement more clearly
what version are you on
1.19.4
rip
Did the last dev leave any code comments
nop 😶
perhaps I am unaware of some things that could have different meanings on higher level that I am right now
yeah I get that
so like any tips for figuring it out
'cause not latest
I want to test that myself
or just "f around and find out"
jussss do it 🙏
if u consider almost 2 years new then yes
rip
been there done that
yh the server started development 2 yrs ago
were prob gonna be done by the start of next year
then we can slowly start updating
pls help
after release
end of what event
ah yes
end game
noice
and what happens when you try
As planned, I teleport to another world and then back again.
But the world remains the same.
Can you show your getEntity method ?
just a regular getter for the field
private @Nullable ArmorStand entity = null;
thats the field
annotated with @getter
Are Sugarcane/Cactus's data types both classed as Ageable?
And you just return the entity, nothing el-
ok lombok
ye
why is this a thing
oh the pain
my bad bro
huh
armorstand doesnt work?
thats the only one i need icl
actually i could use cow
and just turn off its ai
ye, and leash it a tick later (for some reason)
sn ill try it now thx
yeah it worked thats could sound @smoky anchor
now setting leash holder to null doesnt work ill delay that by a tick too ig
am i in an async thread? tf
what
well yes
nah nah i just can unleash it
oh
im calling it on the player
prob have to call it on the cow
yea sick it works
Ye, I checked and you can not leash ArmorStand even with NMS
ah
how can i check if a player is in a custom gui created by https://github.com/stefvanschie/IF
This is sort of complex because I dont expect a lot of people here to fully understand the way fabricmc does packet codecs (yknow cause its spigotmc), but I am attempting to send a plugin message (custom payload packet) clientbound from a plugin. I have made a mod that interacts with the logical server and client by sharing packets (so the client can 'learn' info about a target block, being a chiseled bookshelf) and the server sends a packet detailing what itemstack the player is looking at.
I am trying to personally add functionality to my own server, where I have set up a plugin message listener to get the custom packets, and I can decipher the information, but when I attempt to send the packet with a serialized itemstack, it crashes. with the bytes supposedly being larger than expected (smth like 70 extra...) using the ItemStack#serializeAsBytes method
uzsiciaupk nevykeli
check if inventory view is an instance of InventoryBased
na its calm i worked it out
if (player.getOpenInventory().getTopInventory().getHolder() instanceof CusotmGUI)
alr
CusotmGUI
💀
Is it possible to add Inventory as PDC?
Technically
Just store the title and items
It's better to add to pdc size, items, and title or convert inventory to bytes or something like that?
keep it as is don't convert it to bytes
Problem is that, if player oppened inventory and the second player opens inventory it will just create 2 different inventories
most™️ inventories should be per player
Then just check if one has been opened already?
so anyone know how to fix extra bytes being read in a custom payload :)
Just create map with inventory > players, and check every time if player have already opened inventory?
or how?
Not sure why you need a map with inventories to players
Inventories already store their viewers
im feeling xy here
what is the inventory showing and should all players only see 1 inventory and all modify that 1 inventory
custom inventories for custom blocks
does a player directly modify the inventory with moving items
yeah
so that would be a per player inventory
A map <Location, Inventory> would make more sense
if ur saving it to pdc, is the inv a chest
Location can be switched out for a record with block positions (ints)
I'm talking about custom blocks like brewing stands/chests. I mean, if 2 players opened chests, items move directly, so players have opened the same inventory
That makes sense
it's the supported way in Paper, guess they didn't care about doing it "properly" on spigot
hough I don't know what the proper way is supposed to be
you arent meant to use holder
you are meant to in Paper
in spigot atleast
nowadays you could probably use PDC, but eh
it used to be inventory views at some point but that changed and now there aren't really any interfaces that you can use to identify inventories, you just gotta track them out of band
that guide is tracking them out-of-band so it doesn't change what I said
I don't love that guide tbh, it is essentially "create your own inventory framework" which is eh
I guess it is better that people do it that way so they don't stumble upon themselves in the future
is there any good way to use ^ ^ ^ instead of ~ ~ ~ while spawning particles? i had to do this:
Location playerLocation = player.getEyeLocation();
Vector playerRotation = playerLocation.getDirection();
if (!mcfpsPlayer.isZoom()) {
Location caseParticleLocation = playerLocation.clone().add(playerRotation.clone().multiply(0.5));
caseParticleLocation.setDirection(playerRotation);
double forward = 0.0;
double up = -0.1;
double left = 0.4;
Vector direction = playerRotation.clone();
Vector upVector = new Vector(0, 1, 0);
Vector leftVector = direction.clone().crossProduct(upVector).normalize();
Vector relativePosition = direction.multiply(forward).add(upVector.multiply(up)).add(leftVector.multiply(left));
caseParticleLocation.add(relativePosition);
player.getWorld().spawnParticle(Particle.LAVA, caseParticleLocation, 1, 0, 0, 0, 0.1);
}
what was the difference between those again, directorionality?
yeah
ig ill just ask for basic help sending plugin messages... anyone?
i am sending the result of ItemStack#deserializeAsBytes however my client mod, expecting an item stack in its codec, cannot decode correctly
Locations are terrible keys
Block is actually pretty good
It implements equals and hash
that's a crazy statement
blocks are tied to the world, so if the world unloads then the key dissapears
though I guess Location also is in a way
If that's the case you can listen to chunk unload world unload and remove those accordingly from your map
But it's based on floats I think
no?
Then I guess locations are safe too
only yaw and pitch are based on floats. because those are in fact. floats
If the hash was on doubles then any change would just mess it up
I'm trying to run BuildTools, I've tried a lot of things but I keep running into this error:
Java Version: 23
OS: Fedora
problem: https://paste.gg/p/anonymous/cefbd193a43e4ed1b9e4db31efdaa677
Another point is that location is mutable while block is not
Use JDK 21
What's the best way to make a polar bear angry towards a player?
i usually use my own object as key tbh
// Damege the mob and set damage source to the player.
entity.damage(0, nearestPlayer);
This didn't seem to work.
i'm not sure what this does exactly
In the spigot terms there is written that guns plugins will be rejected but yet there are many of them on spigot. Can i publish mine or not?
but any change in any of the coord will give another hash no?
run buildtools in a new folder
1.21.1 requires java 21. you most likely have an old build in that folder, use a new folder
No?
1.21.1 requires JDK 21 as ebic said
hmm, idk, i had issues with the newer jdks on 1.21 but dunno about 1.21.1 tbh
I fixed it by using Zulu version of JDK 21
My version I had installed from dnf didn't work
It was probably a JRE instead
It's always I do all the re-search, trying hard for hours, and exactly the time I decide to ask for help I find solution.
it always happens
happens to all of us
not really but you could make a method for it:
public static Location directionalOffset(Location location, double longitudinal, double lateral, double vertical) {
var direction = location.getDirection(); // maybe clone this?
var longitudOffset = direction.multiply(longitudinal);
// cross onto the Y-axis to get the perpendicular vector
var lateralOffset = direction.crossProduct(new Vector(0, 1, 0)).normalize().multiply(lateral);
var verticalOffset = new Vector(0, vertical, 0);
var totalOffset = longitudOffset.add(lateralOffset).add(verticalOffset);
return location.clone().add(totalOffset);
}
https://i.e-z.host/grt4f99r.png will this always do it every 15 mins?
why are you running save-all every 15 minutes
the server does that automatically
I believe you can configure the amount of time it takes in the spigot/bukkit config
i want it to be more frequent so shit doesnt roll back
things shouldn't rollback if you are closing your server properly
if you are experiencing frequent crashes then that's the bigger problem to tackle
crash?
bro can u just tell me if it does it every 15 mins?
yes
would love to know to, because i eliminate the server often instantly to update and test plugins
it can be configured in the bukkit.yml, there's an autosave key
Do neutral mobs target the player in
@EventHandler public void onMobTargetingPlayer(EntityTargetLivingEntityEvent event) {}
this event?
If the player gets close etc.
Or is it only for attacking or following?
why
uhm
there's no need to get rid of your whole server just to test plugins
attacking/following
however it is good to have a development environment that replicates production, if it can be helped
since you don't want to test faulty plugins on production
So the only way to make a neutral mob like the polar bear angry is to damage it and set damager to player?
you can set the target of an entity
Is that enough?
setting the target should work
don't know if it triggers the even upon targeting, but it's worth a try
ah right, you may want to set the angry at memory key if it is an entity with brains
don't know if setting the target handles that for you or not
Yeah ... setting target for polar bear does nothing.
what about settting the memory key
polarBear.setMemory(MemoryKey.ANGRY_AT, player.getUniqueId())
Oh, that's pretty cool. What about Universal Anger? Would that work as well?
it may, I'm not sure how that works really
I would like to believe that is just a boolean that gets turned on and off depending on the AngerTime
There's time as well?
AngerTime is part of the NBT, unsure if the API exposes that
Hmm. So something like get the persistentDataContainer for the mob and create a nespacedkey for the anger time?
I mean, do you need the time-based property?
I don't know. If it were up to me I would like them to be outright hostile all the time.
then try setting universal anger to true
it's kinda annoying since for mobs with goals, you have to set the target but for mobs with brains, you'd have to set their memories
Well, one final attempt. Then I'm giving up.
for anyone interested into making a mob do nothing use these
Only for mobs that use brains :p
of course
at least the brain system is way more understandable than pathfinder goals
wish they just revamped all entities to use brains already
Idk I don’t understand the brain system yet
not 100% sure this is the right seciton. planing on releasing a premium plugin at spigot and want to know how you control prices etc. can you change price, what is the options relative to 'free' ?
you mean, if Spigot can change the price of your plugin?
Yes
if that's what you mean, I've never seen it done, don't know what the specific terms are on that though
I highly doubt they will ever do that
there's a limit of like what, 50 bucks for a premium plugin though

