#help-development
1 messages · Page 738 of 1
e.g. you can't do Chunk.getChunkSnapshot() in an async task, but you can do Chunk.getChunkSnapshot() synchronously than pass it to an asynchronous task
kk
I mean, I would say mvn install, but this looks like a multi module project.
it is
maybe my caches are fucked up
it built once
it just didn't build one module for some reason
than I try to go back and redeploy and it won't deploy now
You do the deploy step?
Well, do you have a reason for it? I thought deploy was usually used for uploading to a server.
tis
exactly what I'm doing
more pressingly though I can't even deploy seeing as bukkit-core module won't build even though all other modules do
.
how can it be absent. It doesn't even "need" to be there I'm simply depending on another module it doesn't have to exist yet until a later build step
adding scope provided doesn't help the fact either
Can you paste your poms?
this might be asec
suketto-parent: https://paste.md-5.net/iqasipudec.xml
core: https://paste.md-5.net/rubuwasebi.xml
nms-api: https://paste.md-5.net/dicuzuyoco.xml
v1_20_1: https://paste.md-5.net/asagisisul.xml
v1_20_2: https://paste.md-5.net/ivoyujujag.xml
bukkit-core: https://paste.md-5.net/opujeguqak.xml
dist: https://paste.md-5.net/pomudovinu.xml
okay that's all of them
forgot dist 💀
Hmm, nothing looks out of the ordinary. All your versions match up.
I usually just use the parent version when I set up multi module projects. (${project.parent.version})
I also made the parent version a variable so I only need to change it in one spot.
i use mojo version plugin so it changes versions for me
Maybe that's why? That plugin could potentially be causing that issue.
nah I've been using it for a while
no reason it'd break now vs in the past when nothings changed
Tell that to my BT compilations. 💀
I just don't get why it let me deploy once
could be my maven cache extension
Ig I'll try clearing that too
though mvn clean install doesn't work either
Do you have a suketto module?
Hmmm
it never gets to the dist module though as bukkit-core never compiles
nop 😢
same error when running mcn clean install -U
😭 found someone with a similar issue on stack overflow, 0 answers
@kind hatch clearing my build cache solved the issue
probably a bad file in there
What command did you use? I should try it for BT.
maven only caches if you use the extension, if there is a build cache it'd be in .m2/build-cache
rm -r /home/[youruser]/.m2/build-cache
Rip. Guess I just gotta deal with my compiler.
looking for suggestions, I want to display the light particle to players holding a certain item, similar to holding a light block in creative mode.
So far my idea is to put players holding the item in a list and iterate over the list to get the blocks around them which are light blocks.
Then just put the iterating into a bukkit runnable
Any suggestions to do it otherwise?
List is probably not necessary. You can just iterate through online players.
ok i tried to solve this myself but i gave up lol. i logged in with git credential manager and am able to read/write for the repo so im not sure why i get this with buildtools: https://mihadkho2019_gmail.com@hub.spigotmc.org/stash/scm/~mihadkho2019_gmail.com/bukkit.git: Authentication is required but no CredentialsProvider has been registered
Can we make plugins on Mobile?
Honestly, I'm too lazy to get out of bed and open my laptop.😂
You would need to waste way more energy on that rather than making one with your laptop...
lol u cud create an app with chatgpt that takes in voice recognition and codes for you as u speak
That's the easy part
How are you going to compile the code into a jar file?
also install the spigot api dependency
ssh in shambles
[HELP] BuildTools Authentication error when running jar
I wanted to know if it is necessary to every local object add final if I don’t want to pass a new reference to the object there
What
Anyone know how to make a code that creates a new world without it being a lag spike on the server?
Not possible on Spigot, unless you do it during startup/shutdown
you can emulate a new world probably by just restricting the players to a very far away quadrant on the map. ive seen a few plugins do that
How do you mean? I want to create a new world like "nether", "the end", etc
oh a new dimension?
So just a new overworld only
Okay, so there's no way then? But can this lag spike crash the server or how dangerous can it be for the server?
that all depends on teh power of the server
on weak servers creating a new world can kick all connected players due to lag
oh, but can i sort of run code to create the new world on another thread?
Okay, so the only way to generate new world is to do it when you start the server then to be safe
is there an Event i can use to check when player equips certain items in any slots?
In InventoryClickEvent, am I safe to use == instead of Inventory#equals to check if inventory reference matches the reference I am holding inside InventoryManager?
My idea is increasing performance but this wouldn't be possible if there would be a case that InventoryClickEvent creates a new instance of Inventory and passes it in the event
guys what Minecraft 1.20.2 change in Networking ?
The majority of changelogs I've come across simply state "Improved Networking.". i just was looking more in depth and had to find out was they Changed
so do you think they acutally improved stuff ?
Idk
You won't gain any noticable performance improvements as I am certain that it simply uses the default equals method provided by the Object class that already just does ==
If a player has a Slow 2, then I added a new potion effect Slow, with level 1. Now the player would have Slow 3 right? Is it possible to remove the recently added potion effect Slow 1, so it becomes Slow 2 again, instead of removing slow effect completely?
If you add a higher level it will override
If you add a lower level it will be ignored
I see.. Okay thank you!
What did they change regarding Advancements?
can u cancel an InventoryCloseEvent in 1.8.8?
No
Sure
is this how you run commands as a player in bungee?
will this also dispatch to the proxy or only the server the player is on
this is meant to be called remotely from a server node to invoke network commands
ah great thanksl
What IDE are you using? 🙂
intellij
Thanks
Generation is already async
Kinda
I think the main issue is adding the world itself
Sure
Doesn’t stop a lag spike tho
what is the difference between getEntity and getPotion in PotionSplashEvent? both return ThrownPotion
getEntity is there because it extends an ProjectileHitEvent but then getPotion seems sorta redundant
Probably just for clarity
There is an abstract class A and B.
How to make B's descendant not inherit A's methods as well. But B extend A
I don't think you can
At least not anymore. Chat spoofing hasn't worked for a hot minute
aint no way
ill try to access the command handler code in bungee through reflection ig
why doesnt chat spoofing work tho
the signatures?
Signatures, yes
new snapshots dont require a valid signature anymore th
tho
so it could be reintroduced maybe
lmao wtf
Is there a way to store arbitrary information on any block, or only on blocks that are tile entities (and so have PDCs)?
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
Ah, cool
I was about to send u that @restive mango
I’ll probably just
Store everything in a string
It’s just locations after all
It’ll only be like 20,000 characters
can you make instanceof checks switch directly (ik i can do it with class names but thats most likely slower)
fuck u cant
elif it is
generic hell
pretty sure a switch on getClass.asString is slower than three instanceof checks
Some reason in inteliJ I'm getting this error: Malformed \uxxxx encoding.
This is my maven POM.xml:
yeah
I've been able to compile this for months, and now for some reason it doesn't work
== should be fine
Unless you cross check against multiple class loaders
Very unlikely
But i'm pretty sure even equals fails then
Why do you cast on generic
For some reason maven is not putting the classes in my jar.
I run mvn package and it only adds pom.xml, plugin.yml and some other config stuff.
Show your pom
probably an invisible illegal character in there have fun 😭
?paste
btw don't type it in chat
You mean it doesn't compile your classes?
why are you targeting java 21
when your java version is 8
what sense does that make
In that case, screenshot your project structure
did you just copy and paste this configuration?
Looks like it
I think it might have to do with the whole project version = 1.8 compile source and target = 21
I don't know. I use Java 21
you can't target 1.16 with java 21 anyways
the server won't run that
you need to use java 8
I modified spigot to be able to do that.
well then target java 21 java.version = 21
Yes. It happened after i ran mvn clean package
It only includes META-INF and plugin.yml
try clearing your cache
You mean invalidate caches in intelliJ?
that and build-cache if you use it for maven
if you have no clue what that means just ignore ^
target folder and invalidate caches in intellij
@dusky crane can you show your project structure too please
I can't upload photos
?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 can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
try getting rid of maven compiler plugin
than recompiling
you don't technically need MavenCompiler plugin here as you don't need to configure it
<outputDirectory> is a valid configuration of maven shade
as well as <finalName>
Compilation failure.
I removed this from my pomxml <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.1</version> <configuration> <source>21</source> <target>21</target> <outputDirectory>~/Desktop/MCserver/plugins</outputDirectory> </configuration> </plugin>
[ERROR] Source option 7 is no longer supported. Use 8 or later.
[ERROR] Target option 7 is no longer supported. Use 8 or later.
Maven requires 8 minimum
I'm using java 21
no you're not
Sure but you're probably running Maven with Java 7
you have lots going on here
- You're project java.version property is 8
- You're running maven with java 7
- you're trying to compile to java 21
as you could imagine this might cause some issues
https://paste.md-5.net/obezafixug.xml this plugin configuration should work compile maven with teh buttons inside of intellij
though I'd personally create the dependencyReducedPom
Many people who are using the maven-shade-plugin commonly set to false for reasons beyond my grasp. This is generally a bad idea, as it can lead to problems if you’re writing a library, and has absolutely no advantages. Here’s a rule of thumbs: If your project shades dependencies, it should create a dependency-reduced-pom.xml. The...
in the future make sure all your versions are consistent
always use the java version property for consistency
Now I'm gettings lots of errors 🙂
as expected when using java 21 with 1.16
About the same problem when I have java version set to 1.8
What dependecy do I need to update in Spigot to make it work with Java 21?
would it be better to have multiple PlayerInteractEvents or combine them all into 1 and seperate the logic into their own methods? I'm not 100% sure on the performance impacts one recieves from going with 1 or the other.
public ChunkGenerator.ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, BiomeGrid biome) {
ChunkData chunkData = createChunkData(world);
chunkData.setRegion(0,0,0,15,0,15, Material.BEDROCK);
chunkData.setRegion(0, 30,0,15, 60, 15, Material.STONE);
chunkData.setRegion(0, 61, 0, 15, 64, 15, Material.DIRT);
System.out.println("Stared generation");
System.out.println("chunkX: "+chunkX);
System.out.println("chunkZ: "+chunkZ);
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
for (int y = 1; y <= 64; y++) {
System.out.println(x + " " + y + " " + z);
biome.setBiome(x, y ,z, Biome.BIRCH_FOREST);
if (y < 7) {
if (random.nextDouble() > 0.15) {
chunkData.setBlock(x, y, z, Material.LAVA);
}
}
if (y > 3 && y < 35) {
if (random.nextDouble() < 0.2) {
int i = random.nextInt(10);
if (i == 0){
chunkData.setBlock(x, y, z, Material.DIAMOND_ORE);
} else if (i < 6) {
chunkData.setBlock(x, y, z, Material.IRON_ORE);
} else if (i > 6 && i < 9) {
chunkData.setBlock(x, y, z, Material.GOLD_ORE);
}else {
chunkData.setBlock(x, y, z, Material.LAPIS_ORE);
}
}else chunkData.setBlock(x, y, z, Material.STONE);
}
}
}
}
Bukkit.getLogger().info("Generation complete");
return chunkData;
}```
I think something here is calling itself
After some time I got this error: https://paste.md-5.net/coxufigeli.sql
Can I cycle through players and locations around them asynchronously?
https://wiki.vg/Protocol#Registry_Data Is this packet missing from ProtocolLib or am I misunderstanding? It's referenced as a separate packet in the MC source code as well however I was only able to find a reference to the PacketType.Play.Server.CUSTOM_PAYLOAD packet
okay nvm
it seems that the latest source does have this packet defined
but it hasn't been released yet?
oh wait nvm I'm being stupid
I should be checking protocol for version 1.20.1
The configuration phase was only added in 1.20.2, so that would be why you're only seeing it there
The breaking proxy’s phase
understandable have a nice day
Location, 100%. Player you have to be aware the player can leave and the object can go stale
hello, i need a function that returns a random entitytype that is a normal mob, but i dont know how to filter the entitytype enum corrently so it gives me like item frames, markers, amourstands etc
First you want to filter EntityType#getEntityClass()#isAssignableFrom(LivingEntity.class)
That'll remove most non-mobs
Then filter out armor stands because they are special
Then filter out !EntityType#isSpawnable to remove non spawnable types (Probably only player)
EntityType#isLiving may also work for this
like that: val entities = EntityType.entries.filter { EntityType#getEntityClass()#isAssignableFrom(LivingEntity.class) }?
OHHH
im using kotlin
btw
The issue is actually that the JDK does not support the java version, not maven.
But I guess you figured that already out
Uhh idk how to do it with kotlin :p
Maven itself can even compile down to Java 6 for sure, probably Java 5 too but I did not try that out yet.
You can only run Maven with Java 8+ though
You can compile lower, sure, but the JDK you have installed must be 8
how would that function look in java?
probably like
final List<EntityType> livingEntity = Arrays.stream(EntityType.values()).filter(type -> type.getEntityClass().isAssignableFrom(LivingEntity.class)).toList();
My plugin name is showing before the command when I go to type the command in game. Like pluginname:command, is there a way to remove that? I searched google for hours >_<
You can do it without the plugin name as well, it's for preventing conflict issues
You can disable it server wide or with some code in your plugin
I'd like to disable it in my plugin.
Use the PlayerCommandSendEvent and remove the version with the prefix
I advise against it though, like I said it exists for a reason
Thank you, I will try that event
In that case you will get a different error though (something along the lines of Incompatible Class Change Error)
error was revolved likely because they had so many conflicting java versions 3 too be exact :3 just handed them my configuration to solve the issue. project version, compiling version, and target version were all different resulting in some weird shit
Yeah this just had something to do with the JDK being more than 3 LTS versions ahead of the target version
This worked perfectly, plugin is complete 😄
In 3 years Java 8 projects will no longer be compileable [on the most recent JDK] and I don't quite like that...
its a good thing
its about time java 8 dies
Yeah unfortunately I do not have that luxury. And for some dumb ass reason I'm getting people demanding Java 5 backports for my projects
Yes, Java 5.
what projects?
Have you considered violence
I'd honestly ignore those demans unless its for your job then you can't
java 5 is dead
Micromixin.
Ooh looks cool
I've already ruled out a J5 port though, J6 is the lowest I'm comfortable to go even though J11 (which is the only JDK my project now compiles on) is EOL at this point
However thanks to gradle toolchains Java versions are noone's concern anymore
How can I get title of an inventory object?
The Inventory doesn't have a title, only the View does
? wdym
I need to use reflection?
i dont see any get view
a view is when a player has an Inventory open
It's only in events
nvm
reflections worked
also inventory does have a title
you know when you create an inventory, you provide a title
let me show u, wait
No
I need because I'm making a wrapper
Using reflections worked so yeah
yeah
the class isn't public lmao
istg who made mc
This worked, to get inventory name, if anyone else needs.
not the best way, but works
Bukkti consumer is fully deprecated in modern versions
Idk, maybe it's from before java consumers
don't they're deprecated for a reason
they were added prior to java 8 because Consumers didn't exist
Makes sense
https://imgur.com/a/EvndHFf how do i remove the "Interact ..." text
?
What interact
item.itemFlags.clear() it dont work though
you don't
that's an in game tooltip
It's not hide placed on. It's hide potion effects
What r u guys talking about 😂💀
so how do i remove it
looking for suggestions, I want to display the light particle to players holding a certain item, similar to holding a light block in creative mode or barrier block.
So far my idea is to put players holding the item in a list and iterate over the list to get the blocks around them which are light blocks.
Then just put the iterating into a bukkit runnable
Any suggestions to do it otherwise?
ItemStack item = new ItemStack(Material.SPAWN_EGG);
ItemMeta meta = item.getItemMeta();
meta.addItemFlag(ItemFlag.HIDE_POTION_EFFECTS);
item.setItemMeta(meta);
player.getInventory().addItem(item);```
Yeah that seems reasonable to me
Maybe instead of setting the blocks on the server, just Player#sendBlockChange() would suffice though as to not change the state of the world unnecessarily
Oh, sorry, misread
np
Thought you wanted dynamic lighting
\nickname Qualenski (uses Kotlin)
Yeah no that's totally fine then
you cant
we cant change nicknames
that was changing their actual display name
bc their spigot name was the same as display/profile name they didnt get a nicknam
worked
love you
no homo
how could I set an IromGolems Path AI to be like a wolf? to follow its owner.
Do they even have an owner
so i could spawn set tham as spawn, and then set their owner key to the player? they will then follow the player?
No you need to replace their ai
how am I to do that? Make my own IronGolem class? because setAI is just a boolean to turn it on or off.
setup tutorial here
You don't need your own class, you can modify the existing one
Only problem is PathfinderGoalFollowOwner only accepts EntityTameableAnimal
Iron golem does not implement EntityTameableAnimal
Couldn't I make the IronGolem Tameable?
couldn't you make your own Pathfinder goal for that
nah its not as simple as implementing the interface unfortunately
damn..
Yes
you'll need to 1. Use NMS, 2. Make your own Pathfinder Goal, 3. Make some systemf or keeping track of the owner
If I can find how the golem even stores it's owner
normally they wouldn't have it.
Ive added it into their pdc petOwner.
because I thought that would work lol
yeah no :P
if you need any help with nms you can try and come here though people aren't guarenteed to know as its more abstract
@young knoll coll pathfinder api when?
Oh it doesn't store its target
It just stores that a player created it
So yeah you'll need to add a pdc tag for the owner, and then check that in the ai goal
that's kinda why i dont want to use NMS. like from what i've seen naming convention isnt like a thing.
intellij plugin or a standalone app?
?nms
they are a thing
Mojmaps make life so easy read the blog to set NMS up
unless your on versions < 1.17.1 you'll be fine
if you're below that suffer 😈
then follow the guide above
😩
The main problem is Mojang has like 200 existing pathfinder goals, and they all take different arguments
Which makes it hard to expose them in the API
Maybe if you want to set a record for the worlds biggest factory class
I mean is there really a better way to do it though
Couldn't you just make a bunch of pathfinder goals as records maybe? not sure how those work exactly
PRs in the past have had this issue
that there is a ton of PathFinder goals?
instead of all this looks to be hard and long work, could i possibly some how make an unbreakable and invisible lead on the iron golems?
Wait, if i cant change the length of how long they can go, i dont know if that would be worth it.
Personally I'm looking for a server host for a 2-3 gb server for friends. I know Shockbyte is really cheap but I heard it's terrible. Apex is double the price and is rated "alright".
Any recommendations?
Bloom is good
Hello, I need help with my pom.xml file.
You need to run build tools
Spigot jar is not on remote, you have to build it by hand
And reload maven
Its pricing is good, but my server is much smaller than what it's for. I'll definitely consider it
Also what theme is that? Send in dms
Darcula if im not wrong
Alr that's clean
I would ask why they dont already built the jars and provide the download
So far paper does that and they havent been punished 💀
But why spigot doesnt? I now spigot likes to over complicate
idk
Thats my final theory spigot community likes to over complicate a lot haha
They over engineer the things too much
Heya, just run BuildTools and make the latest 1.20.2 jar?
Or do I have to do something special?
Just run build tools
It will auto add
Make sure you run with remap flag cause I think you want it
Alrighty, I'll try that.
Then I assume, I have to manually add that jar to the pom file?
You just add it as normal maven repo
Because when you build tools, it will install the spigot jar into local maven repo
Hmm, it failed? https://pastebin.com/hf7aqvJ0
Maybe I should update to latest maven 3.9.5?
Do oyu have latest java
I have Java 17 and Java 20 installed.
right, should be working
let me see your error
That shouldnt be the only part
Can you send the whole issue in
?paste
I think the reason you cant download a .jar was like a legal reason or whatever
I updated maven and it is now building
oh perfect, so that was the issue nice from hearing it
😉
Using NMS does anyone know how you can listen for packets without injecting the player? I mean from the server side what it's receiving and sending
Yeah because spigot skidded or appropiate ilegally from the server jar
Listenings are only by player connection
Even plugin messaging packets are sent thru Player
But how can you then listen for packets before the player has joined? ;D
Oh my bad, they get it directly from the Netty in bound handler if im not wrong
you mean like all packets sent to the server in general
yes, he means that
yeah
yeah
but im pretty sure each player has their own socket
so after the first packets i dont think you can listen for them on the server channel anymore
Yes each player has his own Socket
after the player log in, its own socket is created if im not wrongly
yeah
so if you want to listen for all packets i think there might be a list of all connections somewhere which you can inject into
im not sure though
Yeah its a mess, because they dont provide any getter for the Netty boostrap
reflection?
You must thousens of reflections
yeah, but its a mess
Okay thank you I will try to figure it out ;D
Yeah you will hate mc
hahaha
How they designed looks like a child with no knowledge trying to do something really difficult
Thats what i can say from Minecraft, they dont even use a proper protocol compression. They just use ugly varInts and those shits
LMAOO i thought you were calling me stupid haha 💀
What r u trying to do?
right, i cotninue listen
to execute the action you mean?
oh yeah i catch what you mean
I have happen by the same with this
Nothing related but what about this?
why extends Player? I would like to know hee
You never know when Mojang will add another player class
Make a custom item class amd have the type in it. And save the custom stack in a class like ParticleGUI, make an inventory with .createInventory and provide the holder as this. Then you can get inventory.getHolder and cast to custom class if you know what I mean
Very confusing yes but
I was going to say that first, but ddint want to mess him
I was going to tell create an particle item wrapper for the item type and the action
Why InventoryHolder? I was told thousens of time not using it, but still using it
Yeah, because we are in the same mess. Because creating a wrapper item or doing what you mean is the same
InventoryHolders are a terrible way to do custom inventories
A better way to manage custom inventories is below
https://www.spigotmc.org/threads/a-modern-approach-to-inventory-guis.594005/
how to make a title when you break a block?
Heya, me again. I am now missing Spigot/Bukkit imports.
And this is my pom.xml https://pastebin.com/WxbaacSP
You need to run build tools for 1.20.x
And then depend on the artifact spigot and not spigot-api
how can i reset deaths and lives
Ok hmm thanks for the info. I didn't know. Any other way similar to that? Or just make my own inventory implementation? Or smth
Hmm hashmaps
hashmap is god
What if I made my own inventory system
I mean you could thats just a lot of NMS to maintain by yourself
Not deep
Just
Iinvetory
IInventory
I'm already coding my own server (framework) in rust so it'd be a learning experience
HashMaps are still pretty good
could be worse you could be using InventoryHolder
HashMaps are really not inefficent
inefficent 😭 I can't take unefficent anymore
What happen with it?
I dont really understand why you spill up something but not giving good reasons why not
Is it ahahaha, I couldn't bother myself to Google what is correct
for a second I thought java has friend classes now 😂
Not a huge huge fan just because it limits how you read and parse GUIs from a config
What do you mean with that?
GUIs aren't something that's made to be hardcoded
I mean more in detail if you are not busy
Yeah i agree that, but what do you mean exactly?
I would like to improvee while coding guis and those things
That's true
you mean via code?
yeah, you are coding a spy system?
so this is incorrect channel
bit hard to explain it with a diagram
So if you want to, for example, load a menu from a config
You load a "mask selection", you map each item in the mask to a Button and assign actions to them
Placeholders are applicable on the entire menu or on the element
For pagination, the paginable layer holds multiple "paginable areas" which just render a selection based on the page selected
The page counter is bound to the layer
right, thats really interesting i will give a deep into it. So far i will listen your messages
So if you want, for example, a battle pass menu, you just set 2 paginable areas on a single paginable layer
If you want independent scrolling you set 2 paginable layers
For example on hypixel skyblock's Skill menu where they have the little snake
It's just the slot order on the selection that changes
Which is why I use an ordered list rather than a generic collection
okay, this makes better use of resources if thats what i udnerstand
Mainly what refers into scalability
Just decouples things
oh right, sounds weird but makes sense
Atleast if you just wanna store data without human reading is okay
that's what databases are for
Configurations, in my opinion, are read-only formats
You only write to it if you're adding new content on an older config version
yeah, but how? I have been trying to use items with database and never figured properly items saving
Without server resources being into worst
Turn it into bytes
Thats what make sever going to 100%, isnt it?
Homie has 0 idea of how performance works
Data has 3 states, only 2 of them are important in this context
In use <-> In memory <-> In storage
With more complex architectures "in storage" is wack and can be in a temporary cache server
Anyways
When data is going from "In memory" to "In storage", the entire process should be done async
yeah i understand that. when doing I/O must always use Async
Serializing and tossing it in the database should never be done in the main thread
I already knwo that, but binary serialization is not so fast. It has its downstunes
It's still done async
Which means..
Slower methods just end up in higher latency
But your TPS won't be affected
When you're managing your server and you see 100% in pterodactyl, keep in mind it's the mean of all cores
So if you have 6 cores, your max value is 600%
They're useful even if you self-host ¯_(ツ)_/¯
Im taking about plain VP's and their usages, pen testing mainly
But yeah if you want something faster than binary serialization
Just make it yourself
NBT is quite simple
pretty sure paper has methods for that builtin
They do, why don't we?
uhh... ask Choco
Paper 💀
u have just broken me in 2
LMAOO how u can use paper worst thing i have ever seen
So far i dont see Paper following naming conventions, have u already seen them?
yes ofc, they are data classes
That sucks sorry for syaing
They call source to entities (to CommandSender and Player too) 💀
na dont worry i cant explain myself to paper lovers
oh thats true, my bad its not really good
wild isnt something is dangerous? Like lions are wild
but if sound rude really sorry, if thats what u mean
override fun guiItem(): ItemStack {
val config = Main.instance.config
val item = ItemStack(Material.POTION, 1)
val itemMeta = item.itemMeta
itemMeta.addItemFlags(ItemFlag.HIDE_ITEM_SPECIFICS)
itemMeta.displayName(Component.text("Random Effect Challenge").decorate(TextDecoration.BOLD))
if (isActive) {
itemMeta.lore(mutableListOf(Component.text("Enabled").color(NamedTextColor.GREEN)))
} else {
itemMeta.lore(mutableListOf(Component.text("Disabled").color(NamedTextColor.RED)))
}
itemMeta.lore()?.add(Component.text("Delay: " + config.get("challenges.random-effect-challenge.run-time-lower-bound") + "s - " + config.get("challenges.random-effect-challenge.run-time-upper-bound") + "s"))
itemMeta.lore()?.add(Component.text("Level: " + config.get("challenges.random-effect-challenge.min-level") + " - " + config.get("challenges.random-effect-challenge.max-level")))
if (config.get("challenges.random-effect-challenge.infinite-effect-duration") == false) {
itemMeta.lore()?.add(Component.text("Duration: " + config.get("challenges.random-effect-challenge.effect-duration")))
} else {
itemMeta.lore()?.add(Component.text("Duration: ∞"))
}
item.setItemMeta(itemMeta)
return item
}
``` yo guys why doesnt this work?
So in conclusion, but thing for inventories is to directly get them via equals method. Taking about from what i've read on the article someone sent it
i mean, im not sure exaclty which is more effective
Was goignt o say the same haha but i was goign to sun rude
still spigot
paper ha they community
got exposed
no, == is reference equality, equals is value equality
== works only if you're comparing the same instance
Also unless .equals is overridden somewhere in your class hierarchy, .equals defaults to ==
i understand that, but what about for inventories?
oh perfect!!
alright what the hell is Spigot smoking today
println(config.getString(Constants.Config.WORLD))
if (config.getString(Constants.Config.WORLD).isNullOrEmpty()) {
For whatever reason it seems like it's using the default config even though there's a config in the plugin folder
and it doesn't have the value I'm looking for at all
It's looking for world: something and somehow finding a value there for that even though this is all that's in the config
main-world: world
yes
and yes, it's specifically looking for world: someString and not main-world: someString
when I actually set the value to something random it worked right
but if it's not there at all it seems like it's just pulling the default config
well at least my error message formatting seems to be working
Why would you use it
So what the best way for custom ivnentories to conclude? Is it better to use equals() ?
yeah == is for comparing memory section / location and equals for content
wdym by conclude
okay, but why, why not? i want to learn
Not just get a yes or a no
hmn right, we should check that so
Because we are not really sure so far
.
are you talking about conclure the staff?
im talking about what you wrote
well
even then
thats not an english sentence afaik
what does it mean in this context
just wanna get a conclusion about how to find custom inventories without them being able to de duplicated
If that whats you mean i understand my english is no the best
if they cant get duplicated then == will work
what do you mean with that?
if you mean you want to make sure you are acting on the right inventory, which I guess in the context of a player, then it should be fine to also use == im pretty sure
like getOpenInventory
I mean cant get duplicate via renaming in game, what most sever has the issue
if thats still a thing
Just wanna learn better way to make sure the inventory interacted is totally custom and not fake via in game
Thats what i mean, im not sure i explain
rgiht let me explain
Have you seen some servers you can replicate some of they inventories during game
For example i have seen a virtual crates plugin, where you renaming the items name and adding the lore could be used as the crate opening item - Do i explain now? I use it as an example, but happens the same on severs but with inventories
yeah you just mean to create an inventory using Bukkit.createInventory
yeah not only that, just making the best way to know when they using an inventory created via code (like a custom one) or one they faked or exploited to get the inventory
well if its not your own plugin its gonna be pretty hard
no no, i mean im coding my own menus library. Just wanna learn practices for working with menus
because spigot is acting like the payer is opening a valid inventory
if its for your own plugin where all menu are yours, you can just keep a reference to the inventory when you create it and compare using ==
but iirc I dont do inventory comparisons like that in the first place xD
So then if someone uses the menu api, you duplicate them via items. Do i explain what i mean?
I think im not explaining exactly what i mean
yeah I dont know what you mean by duplicating inventories using items
I assume you are just talking about opening an inventory when you use an item
how do i do this in the new versions (getting an inventorys name)
I mean there are exploits that allow you to replicate the same inventory that some servers generate for certain things.
For example, it happened on an mc server. Where they used a virtual crates plugin where the inventory they used could be replicated using a normal chest, adding all the properties (title, size and items) everything like the menu would look like. And it was fully functional, that's why I ask. In order not to have the same error
Thats using translator that why looks better written
I think you need to get the inventory view but im not 100% sure
Pretty sure it's in inventory view now
Oh right lol
yes in view
Inventory apy has changed on newer versions
That is why you compare inventories with ==, anyway not sure you can change inventory name trought vanilla lol
oh right, well in that case, make sure to not create inventories based on the name of a chest I guess
So goski you udnerstand what i mean?
rename chest in anvil
yeah exactly
Inventory name will change in that case?
add pdc to the chest which will have all inventory information
they were replicating custom menus form the server changing their name thru anvils and those type of things
yeah
yeah but compatbility purpouse 😬
compat with what
Lol, anyway inventories always have reference equality
1.8x to 1.19
use itemmeta
You can always compare them with ==
inventories has item meta? 🤔
no no the issue was not with the item, with the view of the inventory itself
not only happen with their items, with fully menus they have
my plugin creates a new inventory when I want to show it to the player
it doesnt do anything when I open some existing container that I dont have logic attached to
but like, if your code does that it is easy to test
You could replicate custom menus just by adding the same name (with or without colors depending on the name of that menu), the exact items in exact positions. And it works identically to a menu of some command they had or whatever it was that opened it.
That is why you don't compare inventories by name
so, how?
like this?
Or anything that player control
yes, you can also use the docs. Its all speciffied there
Already told you
What the best way? By the holder, equals or == ?
i dont like docs they make me loose my mind
not the holder
==
equals or == doesnt matter in this case
okay, the same if i have a custom object right?
of what
But they wont be able to repicate the exact view right? Just in case i ask
Custom inventory made with bukkit.createInventiry?
yeah
Yes, they also have reference equality
I have the next logic let me send the code
So far i was told that not matter how you find the menus, they will be find / detected as custom ones. If they add the same properties from the custom ones
That why i came and started this topic dicussion
well what properties are you talking about
a player cannot create a menu using Bukkit.createInventory
same inventory view title, same items and exact positions
unless you add that yourself
there exploits to do that, replicate inventories
use ==
For third time, that is why you check with ==
but == compare the memory space?
it checks the actual memory part of the computer to see if the inventory is stored at the same exact adress as they one you are comparing it with
you are comparing the adress, not teh actual object, since if the adress is the same, the object will be the same
yeah that what i mean
how do you make a title saying the block you broke for example coal_ore when you break a block
Sadly we don't have components for titles yet
But you can use Material#name or Material#getKey#getKey
is there a way i can remove the premade ban thingy and only display what i want on recconect?
So it doesnt display you are banned from this server blablabla
and only the stuff i want
no
You can edit the message in the player kick event
i know that
the minecraft clinet adds the other text
Does it?
I thought it did
I thought the default message was just “You are banned from this server”
like the "Reason:" and You are banned from this server parts
and Failed to connect to server
I dont think you can change any of those
so i cant really ban them but need to kick them on every connect?
If the kick event doesn’t let you change it
Then do that..?
well thats what i just said?
why cant you ban them?
cause i dont want it to display the other stuff?
i can freely choose what it displays when i kick them
but not when i ban them
seems kinda pointless to make a system for it
and since i already have a database anyways its not a big problem to just kick them on every connect
but I guess yeah
They should automatically get kicked on every connect
Which will fire the event
Unless that doesn’t count as a kick
If not you can still do it
AsyncPlayerPreLoginEvent -> check if banned -> event#disallow
thx
okay so it doesnt fire a playerKickEvent
so im gonna try the other thingy
what of the 10 million results do i use
do they decide what it says at the top?
yes, they do
thx for the help coll
ly
how do i add a channel in discord that shows the tebex store
Hi, Im using a InventoryClickEvent and need to set /change the cursor but it says its deprecated as it can lead to inconsistencies. Are there any alternatives as I need it 🙂
InventoryView has a non-deprecated setCursor
Thx
I have a problem..I am working on one InventoryClickEvent but the problem is that when I change the CurrentItem and Cursor and so on it triggers another InventoryClickEvent eventhough there is no new click and the event is cancelled
you could make your own banned database and when they try to connect kiock them with your message
Thats litearlly what i did
nice
i needed a database anyways for cross server
and implementation of discord bots
so it was not really a lot of addittional work
Why does changing objects from events trigger other events even though there is no new click?
what
what event, what objects, what click
there is so much information missing
Okay I have one handler for an InventoryClickEvent that checks if something is right clicked with cursor having air as object and then places an item at cursor
Then I have a second handler also for InventoryClickEvent that checks if something is right clicked with item in cursor and then it removes the item from the cursor
The Problem is if the remove event finishes the other event still happens even though there is no new click. The other way around it doesn't seem to be the case. But I don't get why the other event triggers
If they are both listening for inventory click event they will both fire for every click event
Yeah but at the exact time when the one click happens only one of them meets the condition (and the others condition is only reached after the other handler is executed)
Is the event the same instance?
Because then I see why it’s happening…should I try to set slot item and cursor through the player or smth like that 🤔
You can always check if it’s the same instance
Or just refactor your code so you only need 1 handler
Does anyone know why commands aren't registering properly at runtime? Here's my class: https://paste.md-5.net/dowigosene.java Ignore the print statements, that's just while I'm debugging. Anyway, the goal is to reload the commands (in order to change the command that's used to execute them) by un-registering the OG ones (using reflect) and then register new instances. The un-register thing is working, HOWEVER: If the name and aliases are different, it un-registers the old but doesn't register the new one. Anyone have any idea why this might be?
is there a way i can get an offline player from ther username ignoring case
cause the way i found only seems to work if i use the case correctly
So I save various data in a HashMap<String, PlayerInfo>. Occasionally I need to completely wipe an entry in the HashMap which works fine, however when I save the HashMap to config in a custom format after having deleted an entry, it ends up remaining in config. It seems to me that the Java configs retain info unless told to delete or override it, which makes sense. I wipe the config by deleting it on plugin shutdown and recreating it immediately afterwards, but it still retains the info. I moved the deletion to right after loading the config into the HashMap and it seemed to fix the issue (??????). Does anyone have any clue as to why deleting the config on plugin startup would have a different effect than on plugin shutdown? Do I need to implement a delay or something?
Wait, are you trying to wipe the entire config or just one entry in the hashmap?
So how come CraftBukkit's .gitignore does not include NMS, even though it's never meant to be in the version control?
I'm just wiping one entry in the HashMap
Can I see the code?
able to vc? it's a bunch of seperate areas
Can't rn soz
Instead, just check a couple of things for me:
First: When you're wiping data from the hashmap, are you just setting the value to null?
So, #HashMap.remove(#String) right?
Okay, and how are you saving to your yml? Looping through the map?
this should answer that no?
Oh yh true
So anyway
You said you remove the value from the hashmap to wipe the data right?
So that for loop's never gonna call the String that you want wiping
I remove the entry in it's entirety not just the value but yeah
Right and that's why I delete the config directly prior to config save
I'm ngl, deleting the config to update its contents seems like a bad idea
I agree
Is that just the only way it works?
I'm trying to figure out another method
And oddly the deletion only works if you delete after load
IMO, either
A: Update the config when you wipe a players data. Like, as part of the wiping process, edit the YAMLConfiguration and save it
right
B: Hold a Set of changes. Then, when you wanna refresh the config, cycle through them editing the config directly
alright
both make sense it just seems odd that there's no easier detection with the config package
What do you mean detection? Like, something that listens for the hashmap being changed and then updates the config directly?
Tbh, you could make your own Map object that does that if you wanted, auto saves / removes data to the config whenever you .put or .remove from the map
yeah I suppose it would be unpractical to do so with custom configs
Though it does depend on whether you want people to be abel to edit the config during runtime or not
irrelevant to me
In which case, I'd say use the save and load functions method. If you don't need to, not much point in saving and loading all the time. Too much unnecessary processing
thanks dude
Np :D
Also, BUMP
guava has map caching functionality which is shaded into spigot
as for the issue of the config thing, you can save maps to yml since yml supports maps
I noticed but I had trouble a while ago saving certain data types
within the maps
Are you saying you are trying to change the class responsible for the command?
No, trying to recreate it. In it's constructor, it reads the config to get its aliases etc
two solutions would be to use a custom map then or just translate to a list. In either case it should update in config if you just save the list or custom map object back to the config without needing to do anything else
maybe plugin.yml could be the source of the issue
Oh yh, it doesn't show in the paste but the Command class is a custom one extending BukkitCommand
but this is one of the reasons why I don't bother with reflection etc either XD
is what you are doing for some public plugin?
or is this just something for your own server
ah nvm then, was going to say if this is just for a server of yours could just modify the server code to make things possible like you want 😛
some people just forget that part lmao
no? buildtools gives you the server source code. The main reason reflection even exists is because you don't have the ability to change the source code or some other reason makes that impossible
but if you have your own server, then you have the source to change it freely thus no reflection needed ever lol
but since this is instead a public plugin you are making, that is obviously not an option for you so reflection it is
anyways for your problem its hard to say specifically what is interfering other then classes stuck loaded and not being cleared out
just because you unregister a command from the map, doesn't mean the class was unloaded from the JVM
Why wouldn't it though? Also, is there a way to check this?
yes there is a way to check. findLoadedClass(String) the reason being it doesn't unload the class is because all classes are loaded into the JVM not counting some niche scenarios. This is why its possible to remove a jar or replace a jar while the jvm is running and no changes being reflected until you do something that causes the jvm to unload the relevant classes and load the new ones up. IE restarting the server for example. The problem with unloading a class is that the classloader that was responsible for loading it, in this case the plugin class loader needs to get garbage collected. Every plugin has its own plugin class loader. So essentially you would need to unload your plugin entirely along with its class loader and then re-load it.
if you don't unload classes you end up with scenarios like what you have, as well as it will over time increase the amount of memory being needed since you are loading more classes but never unloading any of them
which means its a form of memory leak
Right, think I got it
Is bloom hosting good/legit? Looking into making a small private server for friends
so I have a custom spawn event and I need to have two statuses pre and post should I have a PlayerPreSpawnEvent and PlayerPostSpawnEvent or have PlayerSpawnEvent with a getter for the status?
yes I know a few people who have used it before and have gotten good results
their terms and privacy policy aren't invasive either
- dedicated resources on mid & high tier plans
I used to use bloom. They were amazing, support is phenomenal. I use a VPS now.
ew
I talked this out and figured it out no need anymore
Currious what you decided
Two classes to reduce unnecessary event calling and not requiring an extra if statement in every listener
Also had a moment for a while where I was considering if this was even necessary but ended up going with it for my use-case
Also the pre event is cancellable and the post isn't because... It already happened
Sort of just makes more sense
I'm trying to set the display name via command but doing so prevents the player from chatting. How do I fix this? I can provide code if necessary.
how do i go about testing craftbukkit/bukkit changes besides just the unit testing. like creating a plugin or something
Yes
im wondering how exactly can i go about that
is there a way to set up that environment
iterator vs removeIf ?
from what i heard, only use removeIf if you don't wanna remove all the elements
What is the best way to keep track of what faction a player is in? (Custom faction type I made)
I'm thinking of maybe adding NBT tag; is there a code way to do it better?
Names will be unique of the factions and all factions are in a hashset of factions
hashmap
you need a separate map that has uuid as key and factionplayer as object
and in that object you're holding cool stuff like the faction the player is in or not
factions are best to be kept in an arraylist
assuming you'll loop through
hmm
could I simply add the UUID of a faction to a player upon them joining/creating a faction? I could add this to the metadata couldnt I
that way I can access the faction the player is a member of
usually via looping or a new map that has membered key factions
uuid as member and faction as value
this way you'll have fast access to all the users from the factions
skipping you the loop on join
the faction object should be shared, not a copy
wait so why cant I keep track of the faction UUID in each player metadata
oh
you're talking about pdt?
can you access pdt from the offline player?
i'm not aware
if you can this can definitely be a way
but i think it'll create a desync
Hello! Is it possible to have multiple worlds with their own nether and end? I don't need worldA to be linked with worldB just worldA linked with worldAnether and WorldAend, and WorldB linked with WorldBnether and WorldBend.
I tried to generate a nether and end matching the extra world base name but it still links to the default world. Just want to check if there's something easy before I use PlayerPortalEvent to build a solution
just run up two servers with a bungee proxy. Its easier
This should be tracked central in a manager with a
Map<UUID, UUID> which maps playerIDs to clan IDs.
Also a Map<UUID, Clan> ofc. With the clan itself containing a
Set<UUID> to track the members.
You’re absolutely right and I am super dumb I can just put it in one if no idea why I thought I would need two handlers
A players PDC should only contain data which is exclusively linked to his game session.
And a clan exists, weather a player is online or not.
so synching issues happen ?
so i see, we want to use a global hashmap of mapping players to factions and it's still O(1) access time
hm
im interested in how synching issues could happen by editing player metadata
You cant access a players PDC via his offline player.
So kicking a player out of a clan when he is offline will be impossible if you use the PDC
I wonder if saving the pdc to the world would fix that kind of issue
all clan data should be maintained in memory and separate from any actual game data.
I agree
Im not aware of a mechanic like that. The game has one primary nether and all nether portals link to it.
Probably a database then
SQLite if the server doesn't have an SQL database
Where its persisted is irrelevant
Well technically it is relevant because game data is a form of persistence 🤓☝️
In most cases the File system will do just fine
backend shoudl be an after thought
As a backend developer, I am offended (joking)
Keep all data live in memory and push to a save queue when it changes
Object val = entity.getPersistentDataContainer().get(GTHealthDisplay.getKey(), PersistentDataType.INTEGER);
if(val != null && (int) val == version) {
entity.remove();
}``` is it correct way to do this?
No
what is correct then?
Use Integer instead of Object and if 'version' is of type int, then compare it with Integer#intValue() of your value (after the null check ofc)
You can also use getOrDefault and use something like -1 as the default
If your value is never negative
if(val != null && val == version) {
entity.remove();
}``` so like this
if(val != null && val.intValue() == version) {
entity.remove();
}
Never compare primitive wrapper with ==
IDE says that is unnecessary to use "intValue()"
Does it prefer an int cast instead?
no, then it just stands out in gray, which means it’s not necessary to cast
just through "==" everything is ok
Integers get casted down to int implicitly when comparing with int, so that makes sense
it autounboxing for u ig
What is the best way to get the "last" item of an inventory? Do I really have to go through the entire contents or is there a more efficient way?
Thx in advance
The item in the highest slot that is not air
Ok thats what I thought thx 🙂
The inventory has a size. Just use a direct index access with size-1 as the index...