#help-development
1 messages ยท Page 943 of 1
i didnt either till about 30 seconds ago
I have this code to find my data in the mongodb
the problem is that this happens
if I change the fieldName to an invalid one, it works (of course if finds nothing)
i can do it directly though
fixed
I needed to call the reader.readEndDocument() in my codec
Hello I have a question and maybe I am just being really stupid. SO, I am currently working on creating a parkour plugin for a server that I am creating. I am having an issue with getting the text from the sign to check if it is a checkpoint sign. I have done some research and I saw that getLine() is a thing but it is deprecated and I was wondering if there is anything that I should be using because it is deprecated? Thank you in advance!
You have to get the side first
Returns SignSide then you get getLine
Thank you
So as far as I know there is no way to get the satuartion and value of a food source using bukkit metas and such. To the smart code peeps, is that true?
Maybe with the new component system thingy
But that wouldnt be in api yet, so probs not?
Hey hey
Anyone is taking commissions atm?
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
is there a program or something to convert json to nbt
(not using mojangs stuff)
can't find one
i could write my own ig
that's boring
permissions:
gamemodealert.bypass:
description: bypasses alerts
default: op
gamemodealert.admin:
description: receives alerts
default: op
how can I send a package to players so that instead of its item they see a drawn crossbow?
is this how to register permissions from plugin.yml?
legit opened all of it
is there any available dockerfile for running spigot minecraft servers?
Yes
also found via ddg
thanks
those are a bit annoying to use, if you rlly want them, set up pterodactyl
ive had issues with it just crashing randomly
which is a container-exclusive isshe
YMMV, buyer beware, you're on your own, have fun
lol
is there a way to allow pistons to push anvil
I've never worked with redstones in plugins. However I am thinking about a little trickery:
Instead of placing actual anvil block you can spawn a FallingBlock entity of Anvil and thus push it with a piston.
however it seems a hard process to do since you will have to handle many cases to avoid your Anvil moving, handle the break, handle the fall when no blocks are below, etc...
anvil will stop working tho ;d
what does normalising a vector do ?
one more case to handle
just give up it's just too much of a pain lmao
The norm of a vector is its length. When you normalize it, you divise all components by the norm of the vector. The resulting vector is a vector of norm 1
Set its length to 1.0
Basically cropping or lengthening it.
though carpet mod for fabric does actually have this funcionality
and it does work even for vanilla clients on the fabric server
Maybe the BlockPistonExtendEvent is actually thrown for the anvil before cancelled?
How to use Location.getBlock.setType() to set a bed
If you have a Block and a BlockFace, then you can place the first part of your bed
on
nvm ill write it up, thats quicker
umm
public void setBed(Block headBlock, BlockFace facing, Material bedMaterial) {
Preconditions.checkArgument(Tag.BEDS.isTagged(bedMaterial), "Material is not a bed.");
Bed headData = (Bed) bedMaterial.createBlockData();
headData.setPart(Bed.Part.HEAD);
headData.setFacing(facing);
headBlock.setBlockData(headData);
BlockFace oppositeFace = facing.getOppositeFace();
Block footBlock = headBlock.getRelative(facing);
Bed footData = (Bed) bedMaterial.createBlockData();
footData.setPart(Bed.Part.FOOT);
footData.setFacing(oppositeFace);
footBlock.setBlockData(footData);
}
also ik this is teribble but it doesn't work?
@EventHandler
public void onPlayerKick(PlayerKickEvent event) // Not working, gets ignored
{
Player player = event.getPlayer();
System.out.println("Called onPlayerKick event");
event.setLeaveMessage(Helpers.getFormattedMessage(playerKickMessage.replace("{player}", event.getPlayer().getDisplayName()).replace("{reason}", event.getReason())));
}```
thnx
Did you forget to register an instance of your listener?
nope
the debug sout works but the message isnt getting set
it is the default kick message "player left the game"
i am using 1.8 ๐
Whats up with the // Not working, gets ignored comment then?
thats just for the future dev if i leave it not working if atm it starts to work i will remove it
not many people know 1.8 api anymore
unfortunatly
its very out dated
but the performance is pretty good
so thats why i am using it
No idea. event.setLeaveMessage() should work. Maybe you have a PlayerQuitEvent listener which overwrites it or something.
Did you check for exceptions in console?
no errors
so maybe the playerquitevent is messing it up or smth
because only the message is not getting set because the method is getting called
not interfearing
still the same
Print out the leave message before adding it
Where do you expect the leave message to be sent?
I have a feeling PistonExtendsChecker will probably early return before dispatching the event
It will require patching nms directly
PistonExtendsChecker#a()Z
is the question conversaton over? i dont wanna interrupt
in chat when the server shuts down or when is kicked by an operator
Feel free to ask your questions
Okay, well this is a question ive asked yesterday evening, but havent gotten solved yet
First of all: When a player joins you should load all his inventories into memory.
While he is online, dont tinker with files.
When he quits, save all inventories back to a File.
What is your "error"?
NPE on the offHandItem
Well strangely when executing the command for the first time there is no error, when redoing it again this occurs:
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Also this code here can be simplified to just
boolean isInBuildMode = storage.getBoolean(uuid + "." + world + "." + "buildmode");
String savedInvType = isInBuildMode ? "buildinventory" : "normalinventory";
String loadedInvType = isInBuildMode ? "normalinventory" : "buildinventory";
inventoryFromBase64((String) storage.get(uuid + "." + world + "." + "loadedInvType"), player);
storage.set(uuid + "." + world + "." + invType, inventoryToBase64(player.getInventory()));
storage.set(uuid + "." + world + "." + "buildmode", isInBuildMode);
im a bit confused there
possibly i dont understand that higher end java expressions
Yeah scrap that. You should generally not do any of that in the first place.
Tinkering with files on runtime is very undesired.
Load all your data into a manager when the player joins, use this loaded data to swap between inventories
and only save it back when the player quits again.
am i not loading it into runtime by using Yaml.loadconfiguration ?
Yes its in memory. But accessing it through a bunch of strings is very fragile.
There is so much structure abuse here. For example this:
Are you aware when this code is being executed when it just lays around loosely in a class?
well i dont really know what you mean by laying around loosely and stuff, i know that i am static abusing, but ive never seen that as a problem because it never resulted in a problem
static abuse will eventually always lead to problems.
If your AltBuildUtils.class gets randomly touched by the ClassLoader, then the entire ClassLoader will just throw erros which will take
ages to figure out. Using static like that can not only compromise your own plugin, but can interfere with other plugins as well.
For example if they use the library guice. Then your plugin will often just break, without you ever finding out why.
When restarting the server i often need to manually restart this plugin, how to fix that?
is that bc of static abuse
I dont know what that means... How can you even "manually restart" a plugin?
Restarting the server will completely stop the application and start it again.
well using plugman to reload it

oula
- Dont use the reload command
- And definitely never use plugins like Plugman.
And yes, Plugman completely breaks every plugin that abuses static.
Well its like this:
- Server restart /restart
- Server boots up: Plugin doesnt work
- Plugman reload: Plugin works
Yeah this sounds like this can be caused by static abuse
Are you free to talk? Takes ages to write i can also send you the project
Is there even some errors or?
i dont think so
this reminds me of a bug in my plugin were due to multiverse loading after my plugin my plugin wouldn't work until you'd restart/reload later on when the world did load
could be the case
i also use multiverse
back to the roots of the problem though: How do i save the inventory per Player when he loads / quits and how to save the current status: Buildmode or not
I think the loading issue is something you would like to solve before the rest
can be fixed by adding multiverse as a softdependency
along with other multiverse like plugins for good measure
Like this
- Multiverse```
Multiverse-Core
Thinking about my next PR. What do you guys deem to be more useful:
ChunLoadEvent -> add a getLoadReason() method to check if a Player triggered the load.
(Can be used for example to prevent certain players from generating new chunks)
Inventory -> add the remove(Predicate, int), first(Predicate) methods.
Could be used like this:
// Remove 10 items with the luck enchantment from the inventory:
Inventory inventory = player.getInventory();
inventory.remove(item -> item.getEnchantmentLevel(Enchantment.LUCK) > 0, 10);
And
// Get first slot which has a tool for this Block
Block block = ...;
Inventory inventory = player.getInventory();
int toolSlot = inventory.first(block::isPreferredTool);
ChunkLoad
Hoped the other would be more useful because the chunk load requres writing a few patches for nms 
Inventory stuff is super easy to just make yourself in like 5 minutes or less
It's cool tho
Yeah i should probably start writing more api that actually exposes nms functionality instead of utility
how do i save a list of data to player like (reports, warnings ...) without using pdc
whats the best way to do it
Those are in memory
i tried
public static Map<UUID, Set<String>> warns = new HashMap<>(); but i don't think this is an efficient way
They will be lost on restart
oh
dang
ig i'll use data files
how can i get the size of a configuration section from a config?
nvm
by reading the docs
is there a bukkit api way of getting worldgen info like ore distribution?
Could someone suggest a way of getting the item clicked in a gui (when all are the same material, heads basically) without using namespacedkey?
why would you need a namespacedkey
you can check for the skull owner ig
or use pdc
or just get the slot of said item
that wouldn't work
i'll try with nbt tags
or maybe don't support old version, i'll see
idk what u mean. why not use InventoryClickEvent#getCurrentItem() ?
Do i have to reinstall nms with the correct mapping or can i do that seperatly?
Because the material is the same and I have to get the item from the config
i dont see why that matters. getCurrentItem returns the itemstack clicked in that event
so Im trying to prevent Trident pick ups when they're stuck somewhere. What's the right event for it? EntityPickupItemEvent doesnt seem to work
I tried to get the name of both, the clicked item and from the config, that didn't work
I can try creating an itemstack and checking that maybe
doesn't
I can give a id to the item in config maybe
i would just map slots to a menubutton object, that houses both how the item will look & what happens when its clicked
yo chat how does one use the intellij profiler for a shadowJar task output
do i need to run it separately via java -jar and configure it to attach in some way?
i figured it out
it has a task to run jar apps
how would i like
damage an entity at certain coordinates ?
hey, does anyone know anything about trying to use protocollib as a dependency to simulate packets?
https://paste.md-5.net/uzoxevayor.java
https://paste.md-5.net/apawadudul.java
https://paste.md-5.net/unerikilax.java
https://paste.md-5.net/imodoluroc.xml
https://paste.md-5.net/puhezupige.coffeescript
basically i want to re-create/simulate the slowed mining effect + the block break animation that cosmic prisons utilized but for minecraft 1.20. I'm a little lost as to what I should be doing at this point.
Is it possible to modify the data of players in the game by modifying mysql? I use it to manage player accounts on the web.
what is this?
Is there any plug-in that can modify the player's data in the game by modifying mysql? I use it to manage player accounts on the web page.
wdym?
umm the plugin which is affecting the player data in game files, you want that to also be changed in the database?
bro you asked that 5 minutes ago and the message is still visible, have some patience
i didnt saw that XD
Also, wrong channel
Yes, I want to make deposits and withdrawals, and I need to modify the balance.
any economy plugin made in the last 5 years will have sql support
10 years, even
20, dare I say
how do i make a cooldown ?
like the listener can only listen again after x amout of time
would i have to do thread sleep or somin?
woah, let's not get too crazy
?cooldowns
Is there an alternative to Ageable#setAgeLock?
help any1
wdym
That's a video file
no but what is happening with the config
see the replied video
the config is changing in every reboot?
and also is there any scoreboard and tab list api?
umm ok but why is that? a bug in bungeecord?
im still here if anyone gets a chance to respond to my query just respond to it and ill see it, thanks ๐
what query?
^
got lost in the whole chat about what this chat is/isnt supposed to be used for and saying that every economy plugin has sqlite support lol
im working on figuring it out on my end as well ofc, but any insights would be more than welcome
just saying its possible to "simulate" packets using packetevents
tbh I'd just wait for 1.20.5, since you'll be able to just change that with the whole data components stuff
rip guess im a little early on that huh
basically figuring out how to do this on 1.20 was a task given to me by my other dev friend cuz he couldnt figure it out since they removed packets but he offered to help with the project if i was able to work it out. looking over the data components stuff tho it seems like it would be pretty easy to just wait for that to implement that part of the project
Does anyone who has connected LuckPerms to MongoDB in the past have any idea what I'm doing wrong?
@sand spire see if the mongo db is binding on that address or not
wdym binding? but I connected to mongodb through my code before with mongoClient = MongoClients.create("mongodb+srv://username:password@spigotcluster.xxxxxx.mongodb.net/?retryWrites=true&w=majority&appName=SpigotCluster");
binding means in which address is the mongodb hosted on
The 2-5 digit number after the host address
Usually preceding after a colon
the ip and the port
is the mongodb binding on that port?
i have no idea
Why is this sending me to fbf1 first?
servers:
fbf001:
motd: fbf001
address: 127.0.0.1:25566
restricted: false
hub1:
motd: hub1
address: 127.0.0.1:25567
restricted: false
priorities:
- hub1
- fbf001
give your mongodb config
i don't have a mongodb configuration file I have this
show the hosting address
@slate surge
show the config
i have no config for mongodb
@sand spire search how to connect mongodb to luckperms on yt
and this is the config for luckperms
I know how to connect, I'm connecting through this link
retryWrites=true&w=majority&appName=SpigotCluster");```
oh to luckperms my bad
i already did
who can go to general-2 to help me?
i couldn't find the solution myself that's why I'm asking here
what is the fastest way to encode / serialize a chunk to a string / byte[]?
you could check how cb does it
otherwise nbt or protobuf
thanks i somehow understood the solution in a german video ๐
what was the issue
well apparently there is another part in the configfile 3 stories below that overwrites the way I didn't understand
i still have no idea how to do it the other way but this works so
cb?
yeah
craftbukkit
What do you need this for? Maybe there is an approach that doesnt require hooking into the nms serialization.
The question is quite complicated to answer, because chunks can contain more than only the actual palette (block data).
It could also contain a sky light mask, block light mask, block entities, a height map and some more stuff.
anyone know how long it generally takes after a minecraft update for spigot to update as well? after looking into it quite a bit more it seems like my project would be much better suited for 1.20.5
?eta
There is no ETA. Having an ETA leads to unrealistic deadlines, false hope, and a bad product. It will be ready when it's ready.
I mean, this release is HUGE (1.20.5)
judging from previous releases, md_5 prepares most of spigot during snapshot phase, it gets published rather quickly.
However not in a production ready state usually and early builds are to be considered with care
Usually it doesnt take too long because the development is already happening with the snapshots in the background.
But this update is something different. It will bring a tremendous overhaul to the game and the API because the entire
item and block system is being overhauled.
In the api, the game doesnt really have block changes.
oh you mean BlockType and ItemType?
Well its technically just item changes
Yea I mean, if that lands in .5 
Yeah
If not then quite a lot of it would have to be changed for the new component-driven item system, no?
not really
Im really curious how those components will be implemented in the API.
But im suspecting a Registry mirror for this. Lets hope we will be able to register our own components.
how do you spawn a custom villager with a custom display name, and that they can't walk, just look around? Look at players?
I might argue we will want to remove the .Typed subtypes again
idk what @young knoll's opinion on that is tho
Like, e.g. anything can be food now
or like, suspicious stew like
so technically ItemType.STONE could just return a SuspiciousStewMeta typed ItemType.Typed ?
its weird
Its really a matter on which tools we want to have for detecting the different types. instanceof would be the current approach i assume?
Yea but I mean, that will fail soon
the more functionality they add to these components, the less the java class hirachy layout of ItemMeta will work
Well, at least the instanceOf part of it
different types might still make sense on an API level to represent archetypes of items/promise that some components are present
I mean ItemStacks are literally completely driven by components now.
You can set the stack size, custom durability for any item, if they are a suitable tool for certain blocks.
You can make stone and stick consumable. Everything.
I mean, a lot of stuff is still bound to the type obviously
a banner pattern on a stone block doesn't make sense
until they allow you to customize what block is placed when you interact with the item
at which point, ggwp
didn't mojang just make it possible to turn any item into any other item
but yea, instanceOf just works less and less in the context of ItemMeta
i think instanceof is perfect
Im gonna make people snort gunpowder and let them explode after playing a goat horn sound
tho, tbf, most developers will not care about that anyway
CommandSender instanceof Player ๐ค
Hey, so i have this code, but when i try to get the last value in the List (petManager) it says it is out of bounds, could someone help me? here's the code:
int j = 1;
ConfigurationSection section = pets.getConfig().getConfigurationSection("Pets");
for (String str : section.getKeys(false)) {
ConfigurationSection s = section.getConfigurationSection(str);
s.set("id", j);
List<String> lore = new ArrayList<>();
for (int i = 0; i < s.getStringList("lore").size(); i++) {
lore.add(ChatColor.translateAlternateColorCodes('&',
s.getStringList("lore").get(i)));
}
petManager.add(new PetManager(
s.getString("skin"), s.getString("name"),
j, lore));
j++;```
could someone help me?
when i try to get other values it works
Refactor the single letter variables and i might give it a look
The value List#size returns is one higher than the highest index in the list
I think MD planned to just add that stuff to the generic ItemMeta
I'm like 70% sure that's the reason
when i get the value i'm doing -1 so that's not the case
uuh
1s
Yea I mean, probably the vibe if you want to make ItemMeta "work"
int id = 1;
ConfigurationSection csection = pets.getConfig().getConfigurationSection("Pets");
for (String string : csection.getKeys(false)) {
ConfigurationSection section = csection.getConfigurationSection(string);
section.set("id", id);
List<String> lore = new ArrayList<>();
for (int i = 0; i < section.getStringList("lore").size(); i++) {
lore.add(ChatColor.translateAlternateColorCodes('&',
section.getStringList("lore").get(i)));
}
petManager.add(new PetManager(
section.getString("skin"), section.getString("name"),
id, lore));
id++;```
Like that?
Alright. Next find a better name for your string variable and allocate a new variable for your "lore" stringlist
Before the for loop
But I need a lore for each key in the section
Between those lines
Yea, i don't understand what do you want me to do
Tell me which part troubles you.
Declare a List<String> variable there, and initialize it with the list you get from your current section. The key in the current section is "lore"
The problem isn't lore
petManager is a list
and i'm adding values
Ok one sec...
but when i try to access the last value of that list, it says i'm out of bounds
then the list is probably empty or not full enough
is not empty, I can still get the other values
Hi there, I installed skript and tuske but tuske doesn't work and when I do /pl is tuske in red what do I do?
int id = 1;
ConfigurationSection petRootSection = pets.getConfig().getConfigurationSection("Pets");
Set<Key> petKeys = petRootSection.getKeys(false);
for (String petKey : petKeys) {
ConfigurationSection petSection = csection.getConfigurationSection(petKey);
petSection.set("id", id);
List<String> lore = new ArrayList<>();
List<String> configLore = section.getStringList("lore");
for (int i = 0; i < configLore.size(); i++) {
String configLoreLine = configLore.get(i);
String translatedLoreLine = ChatColor.translateAlternateColorCodes('&', configLoreLine);
lore.add(translatedLoreLine);
}
String petSkin = section.getString("skin");
String petName = section.getString("name");
PetManager createdPetManager = new PetManager(petSkin, petName, id, lore);
petManager.add(createdPetManager);
id++;
Here is the refactored code of yours
Okay
but, do you know what is causing the error out of bounds?
Send us the stack trace and the corresponding code.
When you paste the code, make sure to let us know which line in your code corresponds to the stack trace line number.
sure, sorry
All good
?paste
https://paste.md-5.net/uboseyegol.cs // the error
the code is still without context 1s xd
(is a loop)
think that's all what is relevant, actualPet is working fine
So this is ListPets.class line 81?
yea
Is... petManager a List<PetManager>?
yes, it is
why would you have a list of manager classes
Your -1 is at the wrong place
doesnt that kinda defeat the purpose of a manager class
Is it?
Is actualPet a Map<ItemStack, Integer> ?
Yea, sorry didn't specify that
Try
petManager.get(actualPet.get(e.getCurrentItem()) - 1).getId() == section.getInt("id"))
instead of
petManager.get(actualPet.get(e.getCurrentItem())).getId() - 1 == section.getInt("id"))
ok, let me check
But thats really more of a gut feeling solution because this system is a bit messy
I know, i messed a lot here
Hey, I am trying to build the 1.15.2 version with buildtools but I get this error
Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.ssl.Alerts.getSSLException(Unknown Source)
at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source)
at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
at sun.security.ssl.Handshaker.processLoop(Unknown Source)
at sun.security.ssl.Handshaker.process_record(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.followRedirect0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.followRedirect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
at java.net.URL.openStream(Unknown Source)
at com.google.common.io.Resources$UrlByteSource.openStream(Resources.java:70)
at com.google.common.io.ByteSource.read(ByteSource.java:296)
at com.google.common.io.Resources.toByteArray(Resources.java:96)
at org.spigotmc.builder.Builder.download(Builder.java:1152)
at org.spigotmc.builder.Builder.startBuilder(Builder.java:207)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:60)
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.validator.PKIXValidator.doBuild(Unknown Source)
at sun.security.validator.PKIXValidator.engineValidate(Unknown Source)
at sun.security.validator.Validator.validate(Unknown Source)
at sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source)
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)
... 22 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.provider.certpath.SunCertPathBuilder.build(Unknown Source)
at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source)
at java.security.cert.CertPathBuilder.build(Unknown Source)
... 28 more
Looks like a missing cert?
I'm not believing the problem was the place of a number xd
tysm
Make sure you're using a recent Java 8 version and not an ancient one
No, cause this is a 3.1k line project,
Apparently with 2 minecraft instances, a server and a bungee proxy running at the same time, this compiles 6 times slower than usual
Who would have guessed
Well to be fair the instances and server are 1.8
They should be consuming like 3 kb memory total
But I should really upgrade from 16GB and probably a stronger cpu
Hey, I'm trying to learn how to work with HikariCP, but I whenever I compile my plugin it throws this error:
'dependencies.dependency.version' for com.zaxxer:HikariCP:jar is either LATEST or RELEASE (both of them are being deprecated) @ line 78, column 22
It is highly recommended to fix these problems because they threaten the stability of your build.
For this reason, future Maven versions might no longer support building such malformed projects.
My dependencies in pom.xml
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>LATEST</version>
<scope>compile</scope>
</dependency>
</dependencies>
It tells you what's wrong
compile time ๐
Thanks
That'd probably make my compile time plunge even lower
What CPU are you using?
AMD Ryzen 5 1600 Six-Core Processor according to task manager
I don't exactly have a say over my pc components because I don't have, well uh, money
My dad bought this a while ago and said that this is the farthest this motherboard can go
So upon upgrading the cpu, the motherboard also should be upgraded
So, not soon
Maven, but kotlin, this project is kinda old (from when i didn't understand shit about gradle) so I have been thinking of switching
ah nice that's AM4 you have plenty of upgrade options available
Bc kotlin + gradle = fast (except the first compilation lol)
You don't need to replace the motherboard
Just update the bios and you should be able to use any AM4 CPU
That is one scary step
My motherboard refused to detect my 5600X because the bios was outdated
Thankfully it had a no CPU flash button
I'm running A320M PRO-E (MS-7A36) by Micro-Star International Co. Ltd. with American Megatrends Inc.'s H.00 - AMD AGESA PinnaclePI-AM4 1.0.0.6 dating back to December 2018
So it might be upgradable idrkkkk
Oh wait he might've said it about the last cpu we had
Yeah just update the bios and you'll be fine
What CPU would you recommend
I have an 5600G which is more than enough for me
since AM4 is last gen you could probably find something good used
5600X or 5800X3D are two popular choices
Yeah it'd be cool to upgrade
Oh btw Olivo
Do you by chance have like 500$ just lying around?
Bros about to spend 200$ on snacks
You got a problem with that? xD
That's a day worth of gum if even
I'm pretty sure my intellij is leaking memory somewhere
That pesky minecraft development plugin probably
probably
Yeah I removed it and restarted and my compilations got 2.5x faster
[22:08:45 ERROR]: [DirectoryProviderSource] Error loading plugin: Restricted name, cannot use 0x20 (space character) in a plugin name
im getting this error
but plugin name doesnt have any space
Send plugin.yml
Hey, is it possible to give a player an item from a mod? Like Coins from a mod?
Spigot doesn't support mods
Nor do we provide support for any weird hybrid fork you are using, ask them
yeah I am using mohist (to use Mods and Spigot). Although you don't provide support using a hybrid, could you give me some inspiration of how I could make this possible?
entirely up to how mohist implements this in their API
spigot does not support it one bit so like, yea
no one is going to be able to tell you how unless they know mohist
i saw something ๐
i did not
did i see something?
good job 
alright, thanks
see what?
I did see something
hide in the basement coll
nvm
hes already in the basement

go take his pc
ill tell md about this 

what is the official way to convert a CompoundTag to string?
what
about what
like a nbt compound tag to string and vice versa
Do you mean to convert it into sNBT
hm something to store it in a file / database
It's binary
If you are referring to the nms nbt compound, then there is a serializer for that in nms. What do you need this for?
Ah i guess you found the ChunkSerializer class which serializes chunks to nbt compounds.
And you now have the great idea of throwing that into an SQL DB
actually I want to save a chunk, and I found the ChunkSerializer that is s pretty fast - but I cant save the compoundtag or at least I don't raelly now to to save the nbt
You read minds
CompoundTag chunkTag = ChunkSerializer.saveChunk(...);
SnbtPrinterTagVisitor visitor = new SnbtPrinterTagVisitor();
String sNbt = visitor.visit(chunkTag);
True, in a DB you probably want this as a blob and not a Varchar
I'm just curious, what is the usecase, why are you saving chunks?
This is what I use for to/from a byte[]
public byte[] toBytes(CompoundTag compound) {
java.io.ByteArrayOutputStream outputStream = new java.io.ByteArrayOutputStream();
try {
net.minecraft.nbt.NbtIo.writeCompressed(compound, outputStream);
} catch (IOException ex) {
throw new NMSException("Failed to save NBT as bytes", ex);
}
return outputStream.toByteArray();
}
public CompoundTag fromBytes(byte[] data) {
CompoundTag compound;
try {
compound = net.minecraft.nbt.NbtIo.readCompressed(new java.io.ByteArrayInputStream(data), NbtAccounter.unlimitedHeap());
} catch (IOException ex) {
throw new NMSException("Failed to read NBT from bytes", ex);
}
return compound;
}
what is a .nbt file compressed to? It ain't GZip
It is
when i package
why does 2 plugins get created in target folder
one is original plugin name and the other is just plugin name
well wtf
You need the plugin name only
it is
and then when i package again it make another one called shaded or somin
NBT is usually gzip compressed afaik
This is the result of the maven-shade-plugin. original only contains your own code, the other contains everything you need to run the plugin. (Including libs)
Gzip old smh
I am totally a genius for coming up with the idea to use Zstd
Did not steal it from hypixel, nope
What are you doing to that poor packet
making my own protocol, im currently stuck on stupid configuration
ik it ain't spigot related but y'all smart and reply fast ๐
Glowstone2
fr
๐
i actually got way farther than i thought which is why im continuing with this
Damn, nice
when did we start using stds for compression
Lmao
Programming is so fucking ass, like why can't I write code once and not refactor it 6 months later because I "changed my code style" or "thought of a way to write this in a prettier way"
Sign of growth
spigot api be like. That what i hapen from apis, one month is like this and 6 months ago like that
Fr lmao
enjoy your ranning
Yes but like
Alright I guess I can't argue
chatgpt could help
Not necessarily spigot api. Just in general, with any code I write
besides what i have said, i agree with you. We all are continuesly changing the code we have done and works pretty okay, because we humans love to being perfect
Let's all slowly develop a light form of OCD
For we must write perfect code and perfect code only
No room for imperfections
edits message
editing the message speaks volumes
LMAO
Google it
i found a good one like that
no github
Google like
son item stack serializer and serializer github
not the one i use
looks like your type adapter is shit
Option.Some<Either<BaseComponent, String>> for fucks sake
i like this, but why the local finals?
ask @river oracle
make EVERYTHING final
no mutate at all
me in kotlin
me in java
for some reason i hate seeing final before method variables in java but have nothing against val in kotlin
brains are weird
yeah because its one or the other
And you cant use val var everywhere
Like in parameters
if a project is using the MIT license and i upload a built jar of it to github am i good since the jar includes the license in meta-inf or do i need to do extra steps
Kotlin has canonical forms
If the jar includes the license with the attribution, yes
You are fine
alrighty thank u
I can some how get deffault item name? Like that one if item is not renamed I want to add something before that name. I tried creating new ItemStack but if I get empty name.
The name that an item has is controlled by the resource pack loaded
You can use translatable components to solve this but Spigot doesn't provide an easy way to do so
hmm, thats unfortunate
what's the formula for speed potion's speed? i found this ((amplifier * 0.1) + 1) * 100 but i'm not sure how percise it is
The Minecraft wiki probably has it
yeah it does, thanks
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Scoreboard;
import pl.playgroundhc.lobby.Lobby;
public class create_sb implements Listener {
@EventHandler
public void sb_create(PlayerJoinEvent e){
Player p = e.getPlayer();
new BukkitRunnable() {
@Override
public void run() {
Scoreboard sb = Bukkit.getScoreboardManager().getNewScoreboard();
Objective obj = sb.registerNewObjective(ChatColor.GREEN + "๐
๐
๐
๐
๐
จ","dummy");
obj.getScore(ChatColor.AQUA + ":pencil2: Nick: " +ChatColor.GRAY+ p.getDisplayName()).setScore(5);
obj.getScore(ChatColor.WHITE + "Gracze ma lobby: " + ChatColor.GRAY + Bukkit.getOnlinePlayers().size()).setScore(4);
obj.getScore("Tryby gry:").setScore(3);
obj.getScore("- " + ChatColor.RED + ":heartpulse: KillSMP").setScore(2);
obj.getScore("- " + ChatColor.GREEN + ":pick: Survival").setScore(1);
obj.getScore("PlaygroundHC.PL").setScore(0);
p.setScoreboard(sb);
p.setPlayerListHeaderFooter("Lobby",ChatColor.WHITE +"\n ip โ ip ");
}
}.runTaskTimer(Lobby.getInstance(), 0,20);
}
}
```why doesn't it work ?
?doesntwork
?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.
did they make Does not working have grammar mistakes on purpose
yes
did u register the listener
also registering a new bukkit runnable for every player that joins is pointless and will cause issues when the player leaves, just loop all players every 20 ticks and do whatever
oh yeah that'll also cause lag, just edit the objectives you want to change
Is taking stuff from an event object (like event.getBlock()) safe in async?
save it to a variable first
// async stuff here```
actually u prob dont have to, it's safe either way since the event object never changes
If you're unsure the answer is probably no
You shouldn't use Block async
Can I some how use TranslatableComponent in item name and let MC translate that? ๐ค I tired this and its not translating that text:
TranslatableComponent translate = new TranslatableComponent(item.getTranslationKey());
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("test " + translate.getTranslate());
item.setItemMeta(meta);
Components aren't Strings
you have to send it as a component
Spigot doesn't expose a setter for component item names
you can do that with plugins?
Paper does though
yetโข๏ธ
yeah
probably I cant do that for item name can I?
needs nms for spigot
I want to avoid that but well... looks like Its not possible, thanks guys
@young knoll can you wait for ItemMeta.Spigot#setDisplayName()
Uhh aktually
yes i know its gonna be components
ItemMeta.Components#setDisplayName()
Not my server
you still can time me out and tell others i was being rude or smth
guys im trying to figure out how to make a minigame but im stuck on the part where i switch worlds, do you guys have any tutorials on this? or some documentation
wdym by "stuck on the part where I switch worlds"?
does the player switch worlds by themselves? does the plugin do that?
i dont have any good idea of how im going to switch from my lobby to the minigame world
teleport them
Just teleport the player?
is that how bedwars works?
yeah
oh ty
I mean, not hypixels, but that's beside the point
so basically i should be good just teleporting the players right?
besides the fact that the tab screen will still show them
yes
alright thanks for the help
The reason other servers don't show them is because they use bungeecord
Different servers
what is bungeecord
sorry, but im new to plugin development
It's a proxy
System to connect multiple servers together
But you can just hide players from other players, even just using the api
interesting
player.updateInventory(); is marked as unstable. what do I do instead?
I'm running buildtools for mojang mappings, but for some reason the correct jar does not generate in my spigot maven repository folder.
java -jar BuildTools.jar --rev 1.8.8 --remapped
This is what I'm running. I tried to use the remapped jar file I found in my buildtools folder under Spigot-Server/target, which was named spigot-1.8.8-remapped, but when I used it in my intellij projects all the classes and names seemed to be like regular spigot has.
1.8 doesn't have remapped
Remapped is 1.17+
Preferably nothing
Generally you shouldn't need it, what is the use case?
I just want to update the inventory when I do inventory.setitem()?
on ItemStawnEvent how do i check if is not a player that dropped the item?
Listen for the PlayerDropItemEvent and mark all items that players drop
Then in the spawn event check if it's marked
What am i coming back to 
Hello, does anyone have experience with oraxen?
If at any point you have to invoke Player#updateInventory(), it's a bug and you should probably report it so that we can fix it in CraftBukkit :p
Sure, don't you have a link? Since I couldn't find him anywhere
You bought it, yes?
or did you compile
You are allowed to use it without paying
but if you do, there is no help
I have it delivered by a friend who has been buying the plugin for a long time, but I need help with the settings regarding tabu and scoreboard and I don't know where to write, because I am no longer in contact with that friend
does this error indicate that i'm sending an invalid NBT?
Likely
Did they transfer the license to you
or simply let you use it
I'm assuming the latter
in which case you unfortunately don't have the ability to ask for help officially.
to me it looks like your keys arent wrapped in quotes
This
that's good to know
oh, do they need to be?
iirc yeah
sorry, you aren't entitled to support
you're on your own
good luck
what are you even doing with that much nbt
registry data
i'm just not sure why its throwing that error
been stuck on this for like 2 days
is it a custom registry or a mojank registry
it it inside net.minecraft
im guessing there some other malformation in it then
chuck it in a json parser or smth
Client log might have more info
let me check
why does every folder has a different icon
atom material icons
no just gives me a 1 line erro
๐ญ
could be modrinth though
let me open a nms project rq
wish it would give me the actual exception
with more info
hmmm
maybe that
๐ค
seems to be something here ig
oh wait ๐ค
its sending it twice
still saying Unknown base tag
hmm
Format to json and pretty print
how would i do that?
Yeah I am not calling it anymore, looks like all is working so no worries but will let you know if I run into a bug ๐
There are converters out there
Description: Initializing game
[22:53:17] [Thread-3/INFO]:
[22:53:17] [Thread-3/INFO]: java.lang.RuntimeException: Could not execute entrypoint stage 'client' due to errors, provided by 'auto-miner'!
....
at de.rainix.autominer.client.AutoMinerClient.onInitializeClient(AutoMinerClient.java:24)
[22:53:17] [Thread-3/INFO]: at net.fabricmc.loader.impl.entrypoint.EntrypointUtils.invoke0(EntrypointUtils.java:47)
[22:53:17] [Thread-3/INFO]: ... 7 more
[22:53:17] [Thread-3/INFO]: Caused by: java.lang.ClassNotFoundException: net.minecraft.util.math.Vec3i
line 24: import java.util.Random;
anyone any clue why this occurs and how to fix it?
?whereami
Fabric oh my
sounds like you need to remap your jar
"auto miner" 
hello, I'm currently trying to send the minecraft chunks from my java server to a bedrock server, so I can enjoy vanilla worlds in bedrock. Problem is, the serialization of the chunk takes ~30ms which is a lot...what can I do to serialize it faster? the problem is, I don't understand how the bit storage of the chunks selects longs (e.g SimpleBitStorage / PalettedContainer in nms) - so I cant decode it in bedrock
any simple and fast chunk compressions?
Isnโt there programs for this
And if you just want to join a java server on bedrock
Use geyser
nah I want to "stream" the chunks while playing on the bedrock server
nah thats cheating
You can write your own serializer
but I'm really sure what you would optimize
This may just be unavoidable overhead.
you can't just press a switch and make it go faster, you have to make some sort of fast change
does anyone know why this doesn't work??
@EventHandler public void onEntityDamage(EntityDamageEvent event) { System.out.println("Hiii"); LivingEntity ent = (LivingEntity) event; System.out.println(ent.getHealth()); event.setCancelled(true); }
i'll send the full code if i need to
the event outright doesn't fire i think
send the whole thing
like there's nothing in the console when i hit something
did you register the event
OH that'll be it oml ty
You are trying to cast the event to an entity
Ohh yeah that aswell
i was so focused on why it wouldn;'t work in the first place i didn't notice ๐ญ
yeah the problem is, minecraft's chunk serialization takes <1ms, mine more than 30x...
this is my current code, if you have any ideas
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
int maxY = snapshot.getHighestBlockYAt(x, z);
stateStream.putInt(maxY);
for (int y = minY; y <= maxY; y++) {
BlockData blockData = snapshot.getBlockData(x, y, z);
String data = blockData.getAsString().replace(" ", "");
int id1;
if (!blockStates.contains(data)) {
id1 = blockStates.size();
blockStates.add(data);
} else {
id1 = blockStates.indexOf(data);
}
stateStream.putInt(id1);
Biome biome = snapshot.getBiome(x, y, z);
int id2;
if (!biomes.contains(biome)) {
id2 = biomes.size();
biomes.add(biome);
} else {
id2 = biomes.indexOf(biome);
}
stateStream.putByte((byte) id2);
}
}
}
profiling
I'm not gonna look at this really without a profiler first
design patterns
I never used that, how do I set it up?
or any good projects?
Doesnโt minecraft just serialize the palette container directly
It does
yeah but I don't understand how the bit storage of the chunks selects longs (e.g SimpleBitStorage / PalettedContainer in nms)
Oh yeah that doesnt look too bad, thank you
how do i set and get an entity's movement speed?
i want to briefly stop an enitity's movement, i dont know if there's another way to do it
movement speed is an attribute of the entity.
Get the attribute -> https://hub.spigotmc.org/javadocs/spigot/org/bukkit/attribute/Attributable.html#getAttribute(org.bukkit.attribute.Attribute)
from there you can set the base value
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/attribute/AttributeInstance.html#setBaseValue(double)
Hey, I am having a strange issue with this function. https://paste.md-5.net/anebuxasoj.cs Basically, I am iterating through a list of inventories trying to remove a specific amount of items with certain material types. Right now, it is skipping over the materials it is supposed to be removing, saying that the material stored in the hashmap is not equal to the item's type. [00:11:05 INFO]: [TWClaim] [STDOUT] Paying Cost [00:11:05 INFO]: [TWClaim] [STDOUT] Getting relevant inventories [00:11:05 INFO]: [TWClaim] [STDOUT] Material: DIAMOND [00:11:05 INFO]: [TWClaim] [STDOUT] Inventory: [Lorg.bukkit.inventory.ItemStack;@12cc702e [00:11:05 INFO]: DIAMOND [00:11:05 INFO]: [TWClaim] [STDOUT] DIAMOND Does not equals DIAMOND ...continuing
The Material from the HashMap was gotten by converting the Material of an item to a string and then back into a Material later in the program with Material.getMaterial(). I feel like that should not be causing the issue though.
XD
Pretty sure enums are meant to be compared with == and not .equals()
I think I figured it out LMAO
I didn't put an !
so it skipped if it did match
instead of skipping if it didn't match
I would add a scalar modifier of 0.0 because you dont have to remember the old value that way
@EventHandler
public void onMoveEmeraldBlock(PlayerMoveEvent e) throws IOException {
Player player = e.getPlayer();
int x = player.getLocation().getBlockX();
int y = player.getLocation().getBlockY();
int z = player.getLocation().getBlockZ();
Material block = player.getWorld().getBlockAt(x, (y - 1), z).getType();
if (block == Material.EMERALD_BLOCK) {
player.getWorld().getBlockAt(x, (y-1), z).setType(Material.EMERALD_ORE);
NamespacedKey key = new NamespacedKey("minecraft", "test");
StructureManager manager = Bukkit.getStructureManager();
File file = manager.getStructureFile(key);
Structure struct = manager.loadStructure(file);
Location LocP = player.getLocation().subtract(new Vector(0,1,0));
player.sendMessage(ChatColor.GREEN + LocP.toString());
Vector Vec = struct.getSize();
player.sendMessage(ChatColor.AQUA + Vec.toString());
double VecX = Vec.getX();
double VecZ = Vec.getZ();
Vec.setX(1.0);
Vec.setZ(VecZ / -2.0);
Vec.setY(0.0);
player.sendMessage(ChatColor.LIGHT_PURPLE + Vec.toString());
LocP.add(Vec);
player.sendMessage(LocP.toString());
struct.place(LocP, true, NONE, Mirror.NONE, 0, 1, new Random());
}
}
this works but i want to get the center of the structure (which works but when I walk on the left edge of the block it doesn't center any1 know why)
how can i post a video to show the issue
since its hard to explaion
im makig a yt vid give it a few min to upload
here is the vid
Material block = player.getWorld().getBlockAt(x, (y - 1), z).getType();
if (block == Material.EMERALD_BLOCK) {
player.getWorld().getBlockAt(x, (y-1), z).setType(Material.EMERALD_ORE);
Should be
Block block = player.getWorld().getBlockAt(0, -1, 0);
Material material = block.getType();
if (material == Material.EMERALD_BLOCK) {
block.setType(Material.EMERALD_ORE);
But that makes little sense. Your logic here is:
"If the block is of type EMERALD_BLOCK, then set the blocks type to EMERALD_BLOCK"
But let me read the rest
ty
ok so i have
for (int i = 0;i<9;i++){ meta.setDisplayName("item "+i); item.setItemMeta(meta); itemarray[i]=item; }
when i add all item in the array to an inventory
all of them have item 8 as the name for some reason
One moment ill finding something out about the random that is passed
dw take your time ur the one voulenterring to help me
oh yeah, thats a smarter idea, i didnt even think of that.
Ive rarely touched these in bukkit
You are creating a lot of variables which are fairly similar to each other.
I've extracted placing the structure into its own method.
@EventHandler
public void onMoveEmeraldBlock(PlayerMoveEvent event) throws IOException {
Player player = event.getPlayer();
Location playerLocation = player.getLocation();
Block blockBelow = playerLocation.getBlock().getRelative(0, -1, 0);
Material material = block.getType();
if (material == Material.EMERALD_BLOCK) {
placeStructure(blockBelow.getLocation());
}
}
private void placeStructure(Location location) throws IOException {
NamespacedKey key = new NamespacedKey("minecraft", "test");
StructureManager manager = Bukkit.getStructureManager();
File file = manager.getStructureFile(key);
Structure struct = manager.loadStructure(file);
Vector structSize = struct.getSize();
Vector structCenter = structSize.clone().multiply(0.5);
structureCenter.setY(0);
Location placeLocation = location.add(structCenter);
struct.place(placeLocation, true, StructureRotation.NONE, Mirror.NONE, 0, 1, new Random());
}
If this doesnt work then the offset for the Players Block is important.
Its not for "some reason". You are literally setting all names to "item 8".
Show more code pls.
` ItemStack item = new ItemStack(Material.DIAMOND_SWORD);
ItemMeta meta = item.getItemMeta();
for (int i = 0;i< 9;i++){
meta.setDisplayName("item"+(i));
item.setItemMeta(meta);
itemarray[i]=item;
}`
this is the full methord btw
You are placing the same ItemStack in every slot. Create a new ItemStack for each slot.
so making an array wont work?
No it works perfectly fine
so I just started learning today and I followed a tutorial but I don't think this is working its 1.19.3 paper server
using gradle
getServer().getPluginManager().registerEvents((Listener) new MenuListener(), this);
[02:10:48 INFO]: XxAwesqmexX issued server command: /manage XxAwesqmexX
[02:10:48 ERROR]: null
org.bukkit.command.CommandException: Cannot execute command 'manage' in plugin learning_1 v1.0-SNAPSHOT - plugin is disabled.
how do I 'enable' the plugin
this works i just need to tweak the offset a bit to center it thx so much ๐
thanks for the tips btw
You should create a new ItemStack for each index of your array.
If you just create one ItemStack, and place the same ItemStack in every slot, then you will end up
with the same ItemStack in every slot.
Im not sure how to formulate this any clearer.
You cant randomly cast objects to what you want them to be.
Fixing this is quite trivial:
- Remove the cast
(Listener) - Let your
MenuListenerclass implementListener
public class MenuListener implements Listener {
...
}
okay I'll try it ty :)
ah
so itemarray[i]=new ItemStack(item); ?
I would allocate a variable instead, then modify the ItemStack and only set it in the array when its done.
okay it worked but now it's sending this in console
[02:22:30 INFO]: XxAwesqmexX issued server command: /manage XxAwesqmexX
[02:22:30 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'manage' in plugin learning_1 v1.0-SNAPSHOT
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R2.CraftServer.dispatchCommand(CraftServer.java:911) ~[paper-1.19.3.jar:git-Paper-448]
at org.bukkit.craftbukkit.v1_19_R2.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64) ~[paper-1.19.3.jar:git-Paper-448]
at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:264) ~[paper-1.19.3.jar:?]
at net.minecraft.commands.Commands.performCommand(Commands.java:316) ~[?:?]
at net.minecraft.commands.Commands.performCommand(Commands.java:300) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.performChatCommand(ServerGamePacketListenerImpl.java:2288) ~[?:?]
Entire stacktrace please
"caused by" is the important part
how it says 23 more also it's too big for discord
well i can send multiple but
... 23 more
I mean its a NullpointerException. You should learn to debug them as they are the most common exceptions for newer devs.
You have a variable that contains a null value. And if you then try to call a .method() on this, you get a null pointer exception
because null obviously doesnt have any methods to call.
okay
here is where the null is
Inventory inventory = Bukkit.createInventory(null, 53, ChatColor.RED + "Manage Player");
maybe use InventoryType instead:
public static @NotNull Inventory createInventory(@Nullable
@Nullable InventoryHolder owner,
@NotNull
@NotNull InventoryType type,
@NotNull String title)
wait i hope this isnt paper-only
?jd-s
wdym it's a spigot plugin but my server is paper
nvm, im a bit stupid rn, try createInventory(player, 53, "")
okay
i always use the paper javadocs and they have some custom methods :p
alright, I'm trying rn lets see
same thing xd
[03:05:03 INFO]: XxAwesqmexX issued server command: /manage XxAwesqmexX
[03:05:03 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'manage' in plugin learning_1 v1.0-SNAPSHOT
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R2.CraftServer.dispatchCommand(CraftServer.java:911) ~[paper-1.19.3.jar:git-Paper-448]
at org.bukkit.craftbukkit.v1_19_R2.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64) ~[paper-1.19.3.jar:git-Paper-448]
at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:264) ~[paper-1.19.3.jar:?]
at net.minecraft.commands.Commands.performCommand(Commands.java:316) ~[?:?]
at net.minecraft.commands.Commands.performCommand(Commands.java:300) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.performChatCommand(ServerGamePacketListenerImpl.java:2288) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$20(ServerGamePacketListenerImpl.java:2248) ~[?:?]
at net.minecraft.util.thread.BlockableEventLoop.lambda$submitAsync$0(BlockableEventLoop.java:59) ~[?:?]
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.19.3.jar:git-Paper-448]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1341) ~[paper-1.19.3.jar:git-Paper-448]
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:197) ~[paper-1.19.3.jar:git-Paper-448]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1318) ~[paper-1.19.3.jar:git-Paper-448]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1311) ~[paper-1.19.3.jar:git-Paper-448]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1289) ~[paper-1.19.3.jar:git-Paper-448]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1177) ~[paper-1.19.3.jar:git-Paper-448]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[paper-1.19.3.jar:git-Paper-448]
at java.lang.Thread.run(Thread.java:842) ~[?:?]
Caused by: java.lang.IllegalArgumentException: Size for custom inventory must be a multiple of 9 between 9 and 54 slots (got 53)
at org.apache.commons.lang.Validate.isTrue(Validate.java:136) ~[commons-lang-2.6.jar:2.6]
at org.bukkit.craftbukkit.v1_19_R2.CraftServer.createInventory(CraftServer.java:2117) ~[paper-1.19.3.jar:git-Paper-448]
at org.bukkit.Bukkit.createInventory(Bukkit.java:1629) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at dev.xxawesqmexx.learning_1.guis.ManageMenu.<init>(ManageMenu.java:20) ~[learning_1-1.0-SNAPSHOT.jar:?]
at dev.xxawesqmexx.learning_1.commands.ManageCommand.onCommand(ManageCommand.java:34) ~[learning_1-1.0-SNAPSHOT.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
... 23 more```
ohh,,,,,,,,,,,,,,,,,,,,,
im so slow
it's really hard to read when it's console
i should uh
paste it out first
that will probably fix it tysm lol
yeah it worked tysm xD
how would I set all the slots to gray stained glass pane like efficiently ?
how can i speed up workLoad for chunk removal so that it removes a chunk in 1 tick for example 3 chunks
bc this very slow
I tried to give more time per tick, but it's still slow.
i think i need change condation
but idk
What do you mean by chunk removal?
player.sendMessage(ChatColor.RED + "Healed %target%");
how would I use the variable target in the text cuz %target% doesn't work
What you are trying to do is called String interpolation. Its currently not supported by java and is only introduced in releases from java 21 onwards.
You have basically three options:
- String concatenation:
String message = ChatColor.RED + "Healed " + target + " for " + amount;
- String formatting: (This is also used in many other programming languages)
String message = "%s Healed %s for %s".format(ChatColor.RED, target, amount);
- Token replacement
String message = "[color] Healed #target# for *amount*";
String replaced = message.replace("[color]", ChatColor.RED).replace("#target#", target).replace("*amount*", amount);
Keep in mind that Strings in java are immutable.
This means if you create a String once, then changing it will always result in a completely new String object.
okay ty what is %s?
Placeholder
It will be changed during the .format
They are called format specifiers
ohhh I see okay thank you
both
also what websites should I use for just basic information to look around the only 'coding' ive done b4 this is skript so I don't really now much about java
The most important ones are:
%s -> Strings
%d -> Integer
%f -> Floats/Doubles
%.2f for example will result in 0.01344 being replaced as "0.01"
so float is rounding?
Just look for examples online. baeldung has quite good resources usually.
The most important part is learning terminology so you can actually search for what you need.
For example the difference between an object and a class. What a variable is. What it means to declare a variable or initialize a variable.
Constructor, Method, Field etc. All of those.
More like truncating
If you by some miracle are using Kotlin, you just simply use $target
HOW TO SAVE A CONFIG FILE IN BUNGEE API?
First step: calm down, stop yelling
ConfigurationProvider iirc
I do not know Bungee API
like obv u load up the right implementation
whats the difference between getclickedinventory and getinventory
getInventory returns the top inventory
getClickedInventory returns the clicked inventory
which can be null
whats the difference between top inv and clicked inv?
is it the same thing if an item has been clicked ?
Like the inv where the click happens is the clicked one
top inventory is just the one on top
Usually gonna be like a chest, or furnace etc
the other open inventory apart from the playerโs own inventory
well it can still be the playerโs inventory
If there is no other inventory
so if i want to do sominthing when an item in an inventory is clicked ill use clicked inventory ?
yes
be aware that inv are very complicated to work with and if not managed properly raises security issues
as one was in the vulcan
and
auction house
etc
getInventory always returns the top inventory.
If you want to cancel interactions with UI completely, then always check if getInventory() returns your custom inventory.
Not getClickedInventory().
I know the vulcan one, what is this about ?
im adding items to an inventory
how do i make them not stack ?
set them on a specific slot instead of adding them
Generally what Fabsi said yes ^
But if you ever want your item to not stack with other alike items, you can add some arbitrary value to its PDC (or NBT if you're under version 1.14)
i want to avoid that cause ill be using the same item in multiple guis and such
why would that make a difference
wait adding items to a custom gui?
dont add them to the inventory
set them
When you can dupe items
I am still waiting for spigot to implement a built in anti bungeeguard
anti bungeeguard???
what do you mean by this?
is there an event when u water log a chest
or do I need to cancle it on interact event
?
public void onClose(InventoryCloseEvent event) {
if(event.getInventory().getHolder() instanceof ClanIndividualVaultMenu) {
int index = ((ClanIndividualVaultMenu) event.getInventory().getHolder()).getIndex();
ClanVault vault = ((ClanIndividualVaultMenu) event.getInventory().getHolder()).getVault();
vault.updateVault(event.getInventory(), index);
System.out.println("AWIDNIWADN");
vault.closeVault(index);
}
}```
Anyone know why InventoryCloseEvent is fired when an inventory is **opened**?
because another inventory was closed?
to open an inventory the previous one must be closed first
And you should also not use the inventory holder to identify the inventory
No, no other inventory was previously closed, I used a command to open it
._. at first people were telling me to use inventory holder now not anymore?
Didn't inventory holders cause lag
how often should I send a packet to the player using ProtocolLib in order to show him another item?
more detail needed
if player has x item in hand, other player sees y
public void sendPacket(Player from, Player to){
ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
PacketContainer packet = protocolManager.createPacket(PacketType.Play.Server.ENTITY_EQUIPMENT);
packet.getIntegers().write(0, from.getEntityId());
List<Pair<EnumWrappers.ItemSlot, ItemStack>> list = new ArrayList<>();
list.add(new Pair<>(EnumWrappers.ItemSlot.MAINHAND, new ItemStack(Material.CROSSBOW)));
packet.getSlotStackPairLists().write(0, list);
try {
protocolManager.sendServerPacket(to, packet);
}
catch (InvocationTargetException e) {
e.printStackTrace();
}
}
``` i wrote this, but idk how often to use it
every tick, but you may have a flash of the old item unless you consume packets
how can I consume packets?
I've never done it
okay, thanks
7smile7 (if alive) would know
quick question: how could I give a player a permission to execute a command and after for example player.performCommand() remove the permission?
@ocean hollow Closest I could find https://www.spigotmc.org/threads/unable-to-modify-entity-metadata-packet-using-protocollib-1-19-3.582442/
Listen for the equip packet and modify it for a specific player
when you have a closed inventory, the server considers you have your own inventory open
for, reasons
that's why the inv open event doesn't fire for your own
I figured it out, I accidentally had the same inventory open twice
:bruh:
hey, how do I add command autosuggestions? I'm trying to move away from cloudcommandframework
Either brigadier or just regular tab completion
which part of the docs is that in for something that would require the least amount of dependencies
does that have the autosuggest stuff as well?
Uh yes 1.13+ clients send a tab completion request for every character they write after the /
It's basically just a command executor but you return a list instead
protocolManager.addPacketListener(new PacketAdapter(this,
ListenerPriority.HIGH,
PacketType.Play.Server.ENTITY_EQUIPMENT) {
@Override
public void onPacketSending(PacketEvent event) {
if(event.isCancelled()) return;
if(event.getPacketType() != PacketType.Play.Server.ENTITY_EQUIPMENT) return;
final PacketContainer packet = event.getPacket();
final Entity entity = packet.getEntityModifier(event).read(0);
if(entity == null) return;
if(entity.getType() != EntityType.PLAYER) return;
List<Pair<EnumWrappers.ItemSlot, ItemStack>> list = new ArrayList<>();
list.add(new Pair<>(EnumWrappers.ItemSlot.MAINHAND, new ItemStack(Material.CROSSBOW)));
packet.getSlotStackPairLists().write(0, list);
event.setPacket(packet);
}
});
``` so it should be like that?
I just didn't understand(((
that is, I need to get the ID, and then get the essence from it? I saw on the Internet that they are creating a class that saves all entities into a map.
Class cls = Class.forName("me.xyntheria.xrpg.item");
gives the error
Unhandled exception: java.lang.ClassNotFoundException
any idea?
Class doesnt exist on runtime
so
And im not seeing a package, nor a class with the name "item"
omfg
okay
i was
okay ignore everything i said
i thought item was test for some reason
my brain was not working
Btw, whatever you are doing with getting the class this way: Don't
so, is there any better way to get a class by a string ?
why are you getting a class by string
Why do you need to get a class by a string
block system?
