#help-development
1 messages Β· Page 570 of 1
https://paste.md-5.net/exuteyimoc.sql these are up to 1.17
could 100% be wrong for some of them though
but blame chatgpt for that
:)
a quick look and anyone can see its wrong haha, never rely on chatgpt for facts
nothing on bukkit but if we check nms
end rods, chests and all are incorrect
Β―_(γ)_/Β―
makes sense
Here's blocks that also break if you break the block under
amazing, much appreciated!
I don't see scaffolding tho
scaffolding is behaving different
scaffold is just built different
is there a way to differentiate between the blocks that drop themselves and the ones that drop nothing? Or will I have to do that manually?
give an example of a drop that drops nothing
vine
yeah looking at its code
the devs couldn't bother writing proper checks
so they recalc the distance for each scaffold
every tick
It's like a tile entity
nah rust is sexy
is it possible to check if mob killed by powered creeper in EntityDeathEvent ??
Yeah
I'd rather use EntityDamageByEntity
just because it's easier to have context
and just check the damage and health
if health - damage <= 0
type deal
The event is cancellable to the entity won't be dead at the time the event is fired
oh
can you give me a flowchart of doing it in EntityDeathEvent please? or just explain in short?
im making a large advancement tree and i need to store player data eg. how many potions they have brewed to date. what would be the best way to store all this data.
file-based database?
im so lost here not sure why im even getting this java.io.FileNotFoundException: decompiled\org\benf\cfr\reader\api\CfrDriver$Builder.java (The system cannot find the path specified)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
at org.example.commands.command.Decompile.decompileJar(Decompile.java:84)
at org.example.commands.command.Decompile.lambda$execute$0(Decompile.java:53)
at java.util.concurrent.CompletableFuture.uniAccept(CompletableFuture.java:670)
at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:646)
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)
at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:575)
at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:594)
at java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:457)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1067)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1703)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:172) im trying to make decompiler
thats a link to nothing...
use this;
?paste
the system cant find the path
The path to what though?
the jarFile parsed to decompileJar (i think idk)
so im having trouble figuring out why my json thing isnt working and ive tried pretty much every idea i had, now im stuck
heres the code in question: https://paste.md-5.net/edixuvakic.java
data.put(jsonObject.get("UUID").toString(), jsonObject.get("Password").toString()); is null
yeah, im trying to find out why its returning null. it wasnt before now it is which is really confusing
I tried using JD Core to decompile but it didn't seen to work it just gave me an empty file
im trying to have the player drop a newly spawned in apple on the floor when they die. This is my code so far
i very new to this so idk what im doing π
Why kotlin?
so im trying to convert my json userdata array to a hashmap. it doesnt throw any errors but when i log it to console it says that the map is null in that position and i have no idea why
public void ConvertDataToMap() {
required2FA.dataListMap.clear();
for (int i = 0; i < required2FA.dataList.size(); i++) {
required2FA.dataListMap.put(required2FA.dataList.get(i).UUID, required2FA.dataList.get(i).Password);
System.out.println(required2FA.dataList.get(i).UUID);
System.out.println(required2FA.dataListMap.get(i));
}
}```
Hi, does anybody know how to change Kill message ? (with a Listener)
Does 1.8.8 just not like configs?
not really
fuck me sideways
what about 1.12
?1.8
Too old! (Click the link to get the exact time)
?paste
https://paste.md-5.net/omelunuvey.java
Is unzipping zip files (18mb compressed, 71mb uncompressed) supposed to take 2-3 minutes?
make sure jitpack (or whatever the repo is) is added in your repos
i have it
tried reloading the project & invalidatinging intellij cache?
send me the imports too i can try em
<groupId>com.github.plan-player-analytics</groupId>
<artifactId>Plan</artifactId>
<version>5.5.241</version>
<scope>provided</scope>
</dependency>```
``` <repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>```
use version 5.5.2411 π
seems they pushed a bad build
oh, thanks π
oh i needed to use buffers i see not this oop
Third plugin, let me know if there is anything that I should be doing differently.
https://github.com/SnowzNZ/SnowReports
Criticism is appreciated π
https://github.com/SnowzNZ/SnowReports/blob/main/src/main/java/me/snowznz/snowreports/SnowReports.java your Object.requireNotNull is unnessarcary and if the command is null, you have bigger problems.
InteliJ moment
Yep
https://github.com/SnowzNZ/SnowReports/blob/main/src/main/java/me/snowznz/snowreports/commands/Report.java this is more of a suggestion, you should add a tab completion section into this so that its more user friendly.
I just do what it says so it shuts up
lmao
Permission receiveReport = new Permission("snowreports.report.receive");
getServer().getPluginManager().addPermission(receiveReport);```
You yourself aren't making a permission plugin.. what's the need for this?
Other plugins like vault or lp will do this for you and it may actaully cause an exception
it looks for one. If it isn't present, the player doesn't have permission.
Okay, thanks
okay ,
import static org.bukkit.Bukkit.getOnlinePlayers;
import static org.bukkit.Bukkit.getPlayer;
``` Import static is not something you should use lightly. As the makers of java have officially stated:
> So when should you use static import? Very sparingly! Only use it when you'd otherwise be tempted to declare local copies of constants, or to abuse inheritance (the Constant Interface Antipattern). ... If you overuse the static import feature, it can make your program unreadable and unmaintainable, polluting its namespace with all the static members you import. Readers of your code (including you, a few months after you wrote it) will not know which class a static member comes from. Importing all of the static members from a class can be particularly harmful to readability; if you need only one or two members, import them individually.
So just import Bukkit and call it from Bukkit right
π
Now, on the surface, this isn't totally horrible.
if (!(Objects.equals(config.getString("discord-webhook-url"), ""))) {
DiscordWebhook webhook = new DiscordWebhook(config.getString("discord-webhook-url"));
webhook.addEmbed(new DiscordWebhook.EmbedObject()
.setDescription("**" + reportedPlayer.getName() + "** has been reported for: " + reason)
.setFooter("Reported by: " + reporter.getName(), "https://mc-heads.net/avatar/" + reporter.getUniqueId()));
webhook.setUsername("SnowReports");
try {
webhook.execute();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
``` But because you run the same if check every time a command is run, might be best to make a seperate class that wraps all this info
for this type of if check you should run it in onEnable and then throw an error
if (Objects.equals(config.getString("discord-webhook-url"), "")) {
getLogger().warning("discord-webhook-url is not set, reports wont be sent to discord!");
}
I have this in onEnable, but not throwing an error.
https://github.com/plan-player-analytics/Plan
how can I use all Plan? I imported all like they said, but I have only half of it.
https://plan-player-analytics.github.io/Plan/
(only api here, I want to use whole project)
Alright, nice.
might be best to make a seperate class that wraps all this info
Not sure if you saw this, but also act upon that.
Also for your heads api. Might I suggest https://crafatar.com/ ? It works much faster than mc-heads.
okay
Thanks
I made something similar to this about a year ago but lost interest in Java and plugin development
Glad you got back into it.
Now time to attempt to do this
Haha, just create another Util class that runs that code.
I used that same code to make the embeds, https://github.com/tazpvp/Tazpvp/blob/main/src/main/java/net/tazpvp/tazpvp/discord/webhook/DiscordWebhook.java Take a look at #execute as I made it multithreaded which should improve performance.
https://github.com/tazpvp/Tazpvp/tree/main/src/main/java/net/tazpvp/tazpvp/discord/webhook I also wrapped my report embed in its own class π€£
wowow 2 minutes to like 13 seconds wtf https://paste.md-5.net/eduqucuteq.java
whats the purpose of increasing buffers for reading btw? Is it bad to set them too high/low? i normally just see most examples online using 1024
Use try with resources
i kept getting that notification earlier tbh but didn't know what it meant
sec googling
ahh so inlined
so instead of the regular try / catch i would do
try (//variables that throw io in here; //another; //another) {
}
Havent ever really played with em whats really the different between the two? Or is it like with inlined variables in the new instance of checks?
with the assurance that the resources will be closed after the execution of that block
Ahh
.
so it just ENSURED 100% the failed variables get destroyed
Yeah
In old Java you'd use try catch and close in a final statement
a lot of my brain is still stuck in old java mode, for exmaple the try/catch, and then not using bufferd readers earlier π€£
can you explain whatchya mean?
you mean placeholder haha?
yes it is
but
whats the prefix for it
like
Jun 16 2023
but
it does it auto
not entirely sure i assume spigot/mojang just do it themselves
Or the Calender API might be able to abreviate months
you can always just splice the first 3-4 letters of the month too (prolly best option)
i-
i said that earlier lol
its a placeholder one sec
should be able to display it using the SimpleDateFormat
then another plugin is registering it as a placeholder
actually no you can do it with sdf
i sent that literally 2 messages earlier...
and you said you tried it lmao
also next time #help-server :p
hmm in my maven project with different modules, i need to depend on another module, is there a way to tell maven to not look into maven central?
for whatever reason it doesnt work anymore
Does the module build order match?
i have a distribution module that depends on two modules it needs at runtime, for the rest not really
What I'm saying is if you build the parent module, does it build the modules in the order you'd expect?
i think hes having issues actually reloading the project
so buildings prolly off the table rn
shouldnt be hardcoding them
could probably do ${parent.version}
but then i still have the version in my parent tag
i always find it hard to do small qol things
Yeah, versions in multi-module builds can be a pain
like i just cant
cant i like specify one 'lastest version' property somewhere?
there is the maven-versioning-plugin (or however it is called) to alleviate the difficulties of version changes but I never used it and I don't think that it is a super useful plugin
There is LATEST... but afaik it is deprecated for removal.
And I don't think whether it works in this usecase
Also isn't great if you want to build an older version for whatever reason only for it to use a newer version that may be incompatible
hmm project.version in a sub module is the same as project.parent.version π
not necessarily
just to keep it interesting :)
ctrl + f is easy enough tbf just use replace all function
There is also RELEASE but it has the same properties as LATEST but on top of that it does not resolve snapshot versions (duh)
If you are a fan of SemVer you could use version ranges to have it only break half the time though
Beware to not use the range [1,2) but rather use the range [1,1.999]
no thanks its bad enough my code only works half the time, dont need my maven doing that too 
btw is System.console() actually a thing? it always returns null
or does it rely on some system prop
"returns null if there is no console" hmm ij doesnt have a console then :|
"Unfortunately, your recent report has been rejected: Resource Update in <resource name> - Demno obfuscation"
What does that mean? I obfuscated using allatori not demno
hmm now it still searches in maven central, am i supposed to install those modules to my local repo or smth?
ye
im wondering how it worked before then lol
Eclipse will do the hardest part for you anyways
:l Iβve seen server packet contain chunk data with numbers
So if those numbers referred to block ID so where are the nbt of the block storages ?
turns out doesnt work on intellij, but windows powershell supports it
Like there are chest and stuffs have those data
Demo, you used demo allatori
Is there an issue with it?
What free obfuscator can I use?
Yes, the demo version is a demo version
What other obfuscators that are free can I use?
Use proguard
Ok, but also allori is on that list, so I don't really understand what's the issue, why is only the paid version allowed, what's the difference?
It's for demo not releasing things with it
How come this keeps happening when trying to clean its soo annoying intellij has administrator perms
is there just no way to make maven force clean without any care cause its just a large hinderance for my project (or any of them, happens on any moduled project) at this point
Seems the file is semething from some test task even though im just doing clean package
How to create a wither skeleton with a custom item in his hand and on his head?
Although my api-version is set to 1.20 within my plugin.yml file, I am getting this error:console [12:17:40 ERROR]: [ModernPluginLoadingStrategy] Could not load plugin '7rbuild-1.0-SNAPSHOT.jar' in folder 'plugins' org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.2 Any advice?
thank you
?paste
Hello, how can I do something like an EntityMoveEvent ?
what
listen to entities movements
googling this
show the code that you have now
I saw this, but I don't know how to use BKCommonLib https://bukkit.org/threads/detect-entity-movement.420586/
nothing
oh entitymove doesn't exists iirc
yes x)
you can use protocollib
I saw this, but Packet Listening is really strange https://www.spigotmc.org/threads/detect-entity-move.205054/
https://paste.md-5.net/awogidonoh.java
Anyone have any ideas why files from the zip files are being written to as null text?
File names and everything is fine but the actual contents are just null for everything
(and this is not what I want to use)
there is no other solution
well...
paper (from the tree π )
I forgot ! I have this :java manager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.REL_ENTITY_MOVE) { @Override public void onPacketReceiving(PacketEvent event) { Player player = event.getPlayer(); PacketContainer packet = event.getPacket(); } });
this isnt the paper discord you wont get banned for saying other forks in here lol
But I can only get the player
most in here use paper anyways
for tehyre server software
Is a paper plugin compatible with a spigot server ?
is it due to the output stream
no
not sure but wouldnt rly know what to change on it tbh
nah but spigot plugins are
okay I see thanks
idk what to log because i is just a byte 
oh
seems buffer was breaking it
writing the byte directly is fine
and doesnt sacrifice speed weird
then wtf is buffer for 
public static final String COPYRIGHTED =
"""
Copyright Β© 2023 Kyren223. All rights reserved.
""";
Is adding this to every class in my project fine by spigot?
I got rejected for using an obfuscator, so instead of obfuscating it, I'll just add this.
Just wanted to make sure spigot won't reject my plugin because of it
You can add the copyright as a comment at the top of ur class or use intellij copyright feature
I added it also as a comment, but when someone decompiles the code, it won't show the comments
My question is if it's allowed and I won't get rejected again because of it
maybe this suffices
automation is always better π
I am not asking for better ways to do it, I am asking if what I did is fine and won't get rejected
cry about it
Bruh
i'm just giving a tip man
If you cannot help with my questions then don't answer, don't tell me better ways to do stuff I already did
ok mr knowall
std
As long as you add GPLv3 or compliances
youβre good
the license-maven-plugin is something else. It doesn't do what they want to do except if you really try hard
What do you mean by that?
You likely misconfigured the obfuscator
As long as your code is licensed with GPLv3
having a copyright string is fine
My code is copyrighted
There is the school of thought that all plugins need to be licensed under the GPLv3
However noone really knows whether it applies in the real world
itβs required by spigot
all spigot plug-ins must be under gplv3
In theory
Also, just saying it is ARR suffices too and is technically a pretty safe route
??
Is having the copyright string in each class file fine, or will it get rejected because of it?
should be fine
There is the other school of thought that says that the GPLv3 cannot apply to plugins
Well it can (as in you can use the GPL if you want), but the issue we are talking about cannot apply
windows, the most useless software on the face of the planet smh
It should be just configure
same thing
Are you sure that you don't have a configure.bat file somewhere?
hmm its as file on here
Also did you install GNU Autoconf or however that application is called?
(im using the binaries)
im trying to get this to work on MC server but the java lib wont accept the raw class files so tbh i have no idea wtf im doing
What do you need ffmpeg for?
mp3 -> ogg
istg if youβre developing for windows
and i run this on mac
and i see \

is this not universal bruh
for fucks sakes
why is this so hard
i just want mp3 -> ogg fucks sakes
im rly about to make a rest server
this is a one liner in any other language this is some horse shit
pissin me off fr
dont get why mp3 -> whatever cant just be a library
is it not?
noooo gotta use shit meg
The issue is that mp3 is proprietary iirc
cant find one ANYWHERE
so is there no way to have a universal ffmpeg container then? i have to sit here and build it per os?
π
You could ask the libGDX people about this. They are bound to know an answer. Using ffmpeg is meh
i saw this but tbh i couldnt believe it was true imma slap it in my project
lmao
just something about it screamed im not gonna work
you seem to have trust issues when it comes to java
I'm creating a large advancement tree, I need a way to save data such as how many potions a player has made so I can grant the advancement when they reach 200. there are a bunch of other advancements like that. at the moment I am creating a new custom yaml file for each one to save and track the data. is there a better way i can do this ? I'd rather not use SQL but i can if i have to
Are you sure that you must do that mp3 -> ogg conversion at runtime?
yeah resource packs dont support mp3 anymore
so has to be ogg
arenβt you doing youtube to mp3 to ogg?
yep welcome to pain world
why not get rid of the middle man
oh shit
I guess you can't use FLAC then
use ffmpeg after
flac?
In this series, you'll learn how to create a full stack application with node.js that converts a YouTube video to MP3. In this video, we subscribe to the YouTube MP3 API from Rapid API. We also setup our endpoint and begin making requests to the API.
Watch the entire series here:
https://www.youtube.com/playlist?list=PLtMugc7g4Gaq1FdZMF3BUTQPx...
ffmpeg -i input.mp3 output.ogg
make a webserver ong
But how are you going to get java bindings?
Not to speak how are you going to compile it for each OS?
thats what the java wrapper is for but ide need to handle it for every OS which is ass
hum true
alr lemme try that class
gotta refactor my ffmpeg shit i wrote smh
that downlaoder was slick asf too
i shall be back in 15 mins with results
Hello, how can I not broadcast named mob death ?
[13:03:09 INFO]: Named entity EntitySalmon['Salmon 3 HP'/43, uuid='8aef6c78-1304-4bbe-a33f-f65307dfb967', l='ServerLevel[world]', x=247.63, y=61.91, z=-3.63, cpos=[15, -1], tl=196713, v=true] died: Salmon 3 HP was shot by PauLem79YT```
Another audio container for which I know there is a read and write library (https://github.com/Hangman/FLAC-library-Java)
Then you'd only need to figure out a way to get mp3 -> PCM
hes using some lib so theres missing classes sad
I guess you could do PCM -> wav instead of PCM -> FLAC which should be easier to do yourself without a library
sounds like a lot of converting
PCM is basically the raw audio data. Wav is only a small wrapper around PCM from what I know
but ide need ogg
mp3 -> ogg
online this is simple and other language just have this as a built in thing normally
https://github.com/Palkovsky/gdx-pcm/blob/master/src/main/java/pl/dawidmacek/gdxpcm/decoders/Mpeg3Decoder.java seems to be able to read MP3 to PCM. Sadly it does not offer any PCM -> OGG ability and I haven't been able to find one that could do that that fast. Which is strange but OGG seems like a terribly complicated file format
i think imma just suck it up and get ffmpeg to run on all 3 platforms
second thought fuck apple users
why tf they running a mc server on apple anyways
weird ah mfs
what's the issue with that lol
shit u got alex in here
not according to ffmpeg
its weird linux and windows exist 
macOS is the only actual unix you'll see people running minecraft on
what
according to ffmpeg macos needs a seperate set of binaries to run
80% of all mc servers are on linux
linux is not unix
linux binaries
windows binaries
macos binaries
and i cba to push macos binaries to my repo
same diff tbh
Linux is a unix-like OS
linux is "a bit like unix" but not actually
they both use the same file structure
its a kernal thing
True Unix would be BSD and Solaris
okbro
and macOS
round 3, 3rd times a charm
MacOS diverged ages ago
idk, all I know is that macOS is actual unix and it's posix compliant
yt-dlp supports the --audio-format=opus -x option btw, but I am not sure if yt-dlp has ffmpeg and ffprobe bundled or if you need to download them seperately (I already have both of those installed on my OS so I cannot check without breaking a lot of stuff)
HOLY
got ffmpeg working :DD
now to fix up my shitty async, dont question that error
I'm creating a large advancement tree, I need a way to save data such as how many potions a player has made so I can grant the advancement when they reach 200. there are a bunch of other advancements like that. at the moment I am creating a new custom yaml file for each one to save and track the data. is there a better way i can do this ? I'd rather not use SQL but i can if i have to
yeah I'd also go for PDC https://blog.jeff-media.com/persistent-data-container-the-better-alternative-to-nbt-tags/
If I placed down a wheat block named like βHay Baleβ instead of whatever itβs usually named how do I know which hay blocks are named hay bale and which are normal
you can use CustomBlockData to save a PDC tag with either the original name, or just a boolean like "isMyCustomBlock" or sth:
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
Legacy
yeah I'd use some data object that serializes into mysql or json or whatever like this
world-uuid: String/UUID
x, y, z: int
name: String
alternatively you could use the world's name but I guess UUIDs are better
in case the world gets renamed, or recreated with the same name
Cool, never heard of world UUIDs lol
maybe they were added post 1.13
nah, even 1.8 has World#getUID()
so yeah I'd use UUIDs for the world
that avoids issues with e.g. farming worlds that get reset once per month
World UUIDs have been around since very OG Bukkit

I hate that
i never knew apache commons was that interesting
you ain't seen nothing
I was looking at nms block states last night
and I found this
ah i just wanted to ask if it was worse than this
fwiw that's likely a decompile issue
what is that 
faster
Looks like potentially they're trying to avoid division as much as possible
they fooling us

i think that delegates to the OS sqrt which delegates to some modern CPU stuff has sqrt handling
And doesn't Math#sqrt() just call to java.util.FastMath#sqrt()?
don't the javadocs mention that
Note: this implementation currently delegates to Math.sqrt(double) hmyes
I'm very grateful for Javadocs after dealing with C++'s poor excuse for documentation
cppreference is decent but it pales in comparison to Java's stdlib Javadocs
c++ documentation ha
how can i get all information from mysql table?
Gotta be a little more specific than that
Python docstrings are like the same thing as javadocs
You can SELECT * FROM table; if you'd like which will get you all entries
are we talking about information scheme?
do you mean the structure of a table, like which columns it has and what type they have etc? if so, describe <tablename>;
ugh image emojis
SELECT * FROM table; if I use it, how can I work with data?
You loop through the entries
if you buy me nitro, sure
i just need faster internet, there was a noticable delay between url and embed
ah shit ive been caught
This page explains to you how you can execute a query and retrieve its entries, https://docs.oracle.com/javase/tutorial/jdbc/basics/processingsqlstatements.html
Though it has some questionable decisions...
JDBCTutorialUtilities.printSQLException(e); ???
Just fucking e.printStackTrace(). For a tutorial? Really?
whut
smth like that?
ur executing 2 times
Sure but you have a dead ps.executeQuery() there
Other than that (and the fact that your dataManager doesn't exist), LGTM
and use a try with resources
now better?
They're 1 indexed. Though tbh I hate using indices for this sort of thing anyways. The column names are always better
have fun changing column names :)
If you have to change column names, you failed to design your schema
whatever...
maybe i need to use while? to get all data
yes
Didn't even notice you were using if lol. Yes, while
Hello in my code i have a error
show code and error
missing ()
Hello, how can I display a customName with a heart ?
I tried this java entity.setCustomName("\\u2754");
But I get \u2754
try just \u2754 ?
well...
Then use the correct unicode for the heart
okay thanks
\β€οΈ just paste this in your code id say
Hit it
I have this codejava @EventHandler public void onInventoryMoveItem(@NotNull InventoryMoveItemEvent event) { if (event.getDestination().getViewers().stream().anyMatch(this::isInOngoingGame)) { game.addLoreTo(event.getItem()); } else { game.removeLoreFrom(event.getItem()); } event.calledGetItem = false; }Which is supposed to show/hide lore from an item moved between two inventories depending on if a player is viewing the destination inventory. It works, but for some reason whatever it does to the item not only happens to the individual item moved to the destination, but the entire stack it originated from. For example, if I put a stack of stone into a hopper placed above a chest, one stone will move from the hopper to the chest at a time and event.getItem() returns an ItemStack containing one stone which is what I'd expect. However, when I add/remove the lore from that "one stone", it not only happens to the one stone moved but also to the 63 stone remaining in the hopper. My best guess as to why this happens is that the ItemMeta for that one stone is still the same as the ItemMeta for the stack it originated from and the lore is set on the ItemMeta not the ItemStack, but I'm not sure how I could fix this. Any ideas?
π
what is event.calledGetItem
If you modify an item moved via InventoryMoveItemEvent, it doesn't remove the item from the source inventory by setting event.calledGetItem or event.calledSetItem to true for some reason, so in order to avoid cancelling the event I have to set it back to false
if modified, the original item will not be removed from the source inventory.
declaration: package: org.bukkit.event.inventory, class: InventoryMoveItemEvent
cant even find that calledGetItem lol
Hello, does anyone know why I can't see debug markers through blocks anymore ? (1.20)
Well it's there lol. I guess just not documented
Oh it's documented in Paper, might just be a Paper thing? https://jd.papermc.io/paper/1.19/org/bukkit/event/inventory/InventoryMoveItemEvent.html
declaration: package: org.bukkit.event.inventory, class: InventoryMoveItemEvent
Who knows how to transfer item meta data via BungeeCord Plugin Messaging Channel? I know how to use writeUTF, but ItemMeta is not a String.
well you sent it as a bytearray?
i dont understand you...
sendPluginMessage takes a byte array to send
then yes
i could convert ItemMeta into string and send it via writeUTF but i cant convert String to ItemMeta to use it later
cant you use some object input stream thing or smth to deserialize those bytes back to an itemmeta obj
sounds goofy to send itemmeta but whatever
BukkitObjectInputStream#readObject
i dont understand how to use BukkitObjectStreams
create one with a ByteArrayInputStream as param
so i should do like this?
@EventHandler
public void onEntityPortalEnter(EntityPortalEnterEvent event) {
Entity entity = event.getEntity();
if (!(entity instanceof Item || entity instanceof Mob)) return;
try {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
BukkitObjectOutputStream out = new BukkitObjectOutputStream(outputStream);
out.writeUTF("Forward"); // forward message
out.writeUTF(Objects.requireNonNull(getConfig().getString("teleportTo")));
out.writeUTF("EntityPortalEnter"); // sub channel
out.writeUTF(entity.getType().toString()); // message
if (entity instanceof Item) {
Item item = (Item) entity;
ItemStack itemStack = item.getItemStack();
String itemName = itemStack.getType().name();
int itemAmount = itemStack.getAmount();
ItemMeta itemMeta = itemStack.getItemMeta();
out.writeUTF(itemName);
out.writeInt(itemAmount);
out.writeObject(itemMeta);
}
getServer().sendPluginMessage(this, "BungeeCord", outputStream.toByteArray());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Ok I removed that line and it doesn't seem to actually do anything anyways lol. Maybe modifying the lore doesn't count as modifying the item itself? Still have the same issue as before though
i thought you were reading it?
i should write it first
ah for writing id say BukkitObjectOutputStream#writeObject
say where?
here?
BukkitObjectOutputStream#writeObject
]d
create one and write your meta to it
then send the toByteArray()
ive never used plugin messages lol
Can I get Respawn Reason from PlayerRespawnEvent in modern version of spigot?
hi, can someone explain to me whats new in 1.20 coding wise?
read #announcements
no, i mean for example that you can strech blocks now and so on
I need the nms for 1.20.1. I use maven
i tried but it gives error
could be useful if you said what error
part of error:
[16:38:24 ERROR]: [server connection] ADAMADA8 -> survival: exception encountered in com.velocitypowered.proxy.connection.backend.BackendPlaySessionHandler@10d42d9b
java.lang.IndexOutOfBoundsException: readerIndex(2) + length(44269) exceeds writerIndex(53): PooledSlicedByteBuf(ridx: 2, widx: 53, cap: 53/53, unwrapped: PooledUnsafeDirectByteBuf(ridx: 72, widx: 72, cap: 2048))
at io.netty.buffer.AbstractByteBuf.checkReadableBytes0(AbstractByteBuf.java:1442) ~[velocity.jar:3.2.0-SNAPSHOT (git-bda1430d-b259)]
at io.netty.buffer.AbstractByteBuf.checkReadableBytes(AbstractByteBuf.java:1428) ~[velocity.jar:3.2.0-SNAPSHOT (git-bda1430d-b259)]
at io.netty.buffer.AbstractByteBuf.readBytes(AbstractByteBuf.java:895) ~[velocity.jar:3.2.0-SNAPSHOT (git-bda1430d-b259)]
at com.velocitypowered.proxy.protocol.util.ByteBufDataInput.readFully(ByteBufDataInput.java:54) ~[velocity.jar:3.2.0-SNAPSHOT (git-bda1430d-b259)]
at java.io.DataInputStream.readUTF(DataInputStream.java:614) ~[?:?]
at com.velocitypowered.proxy.protocol.util.ByteBufDataInput.readUTF(ByteBufDataInput.java:121) ~[velocity.jar:3.2.0-SNAPSHOT (git-bda1430d-b259)]
at com.velocitypowered.proxy.connection.backend.BungeeCordMessageResponder.process(BungeeCordMessageResponder.java:327) ~[velocity.jar:3.2.0-SNAPSHOT (git-bda1430d-b259)]
at com.velocitypowered.proxy.connection.backend.BackendPlaySessionHandler.handle(BackendPlaySessionHandler.java:197) ~[velocity.jar:3.2.0-SNAPSHOT (git-bda1430d-b259)]
at com.velocitypowered.proxy.protocol.packet.PluginMessage.handle(PluginMessage.java:104) ~[velocity.jar:3.2.0-SNAPSHOT (git-bda1430d-b259)]
what the
when im replacing ByteArrayDataOutput out = ByteStreams.newDataOutput(); to ```
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
BukkitObjectOutputStream out = new BukkitObjectOutputStream(outputStream);
?paste the full code
u wanna see full code?
for that stuff ye
uhh
what?
do u have any ideas?
π¦
hmm that posOffset kinda pisses me off, its already better than before tho
its only 0 for the first invocation
damn i refactored 6 lines into 6 lines
Good job
Hello, how can I stop broadcasting named mobs death ?
Named entity EntityCow['Cow 1.0 β€'/12653, uuid='1ece2207-7a0f-41ea-935b-e9734517fce4', l='ServerLevel[world]', x=360.52, y=72.68, z=-312.32, cpos=[22, -20], tl=265, v=true] died: Cow 1.0 β€ was slain by PauLem79YT
iirc it's in spigot.yml
well they are good when you are working with CAS implementations
thanks
Hello, is there an event before an entity die ?
(do EntityDeathEvent execute after the entity is already dead ?)
before id say, otherwise you wouldnt be able to cancel it
ah you cant even cancel it lmao
Hello, i have a problem at installation of the latest spigot version https://image.noelshack.com/fichiers/2023/24/7/1687098431-error.png
What's the solution ?
Hello, what is volume and pitch for playSound ?
loudness and frequency
HIGHEST_PRIORITY = Stream.of(values()).max(Comparator.comparing(Operator::getPriority)).orElseThrow().getPriority(); myes i love streams
Do you have a solution for this ?
guys how do we connect to supabase postgresql in spigot
i have seen people use normal jdbc connections
but im tryna use a supabase one
it keeps erroring saying that theres no suitable drivers (i installed postgre one for it)
in the sense?
i directly used the host,password etc
similar to the locahost connection
shade = package teh driver in your jar
yea i added the driver in my libraries
thats not shaded
hello, how can I make a block have the particles of when a block has water above it?
the drips?
exactly
https://jd.papermc.io/paper/1.20/org/bukkit/Particle.html#DRIP_WATER There are these but i think you have to spawn them manually
okay thanls
"Please pastebin the entire Buildtools.log.txt file when seeking support"
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
so i gotta add this?
im kinda lost
the postgresql docs didnt mention needing to shade it
Sorry :/
Please, ping me for the answer
try running buildtools in gitbash
guys i shaded it
still doesnt seem to work
so what do i do
welp ima just go and use mongodb
Ok I try it
How to make a custom mob not despawn?
Spigot 1.20
you can use a combination of Bukkits EntitySpawnEvent and the PersistentDataContainer.
declaration: package: org.bukkit.entity, interface: Entity
Depends on how custom that mob is
Hello, how can I get the time being in a clear weather ? (bump)
Thank you very much, it's working
Register your custom entity with Bukkit using EntityTypes.register(EntityTypes.a("custom_mob"), YourCustomMobEntity::new) Make sure to replace "custom_mob" with the desired name for your custom mob entity
I wouldn't recommend that
What would you recommended π
World.getTime()
okay thanks
First approach you said or what I mentioned
Hi, does anyone know how to get rid of these yellow ping numbers in a tablist scoreboard?
I will send you dm π
okay thanks
damn intellij, would eclipse also be able to generate that?
Never
prob lol
looks like a standard clone impl
sorry but i have to laugh at eclipse every time
:,)
Object#clone does a shallow copy right?
"contents of the fields are not cloned" ig so
Mobs won't spawn in some places. I think this is due to the fact that I am trying to spawn them in an unloaded chunk, but loading the chunk before spawning them does not help. setPersistent() is enabled. How to fix it?
Spigot 1.20
if (!chunk.isLoaded()) chunk.load();
Slime entity = loc.getWorld().spawn(loc, Slime.class, slime -> {
...
slime.setPersistent(true);
});
why is CreatureSpawner#getSpawnedType now returning null on block place on 1.20.1?
Yes its a spawner, yes it has a mob assigned to it. Yes it worked on a previous version
spawners no longer have a default type of Pig
Unlike slimes, dogs spawn or do not despawn.
i hate it when java hides all the useful internal stuff
reflection time :P
too slow
ye its just awful what java does sometimes
or you could just recreate the method
It didn't help. It's just a slime with a custom name, speed, attack, size, without AI.
The first option doesn't suit me, and the second one didn't help either.
I need the mob not to despawn.
is it a custom entity or not?
u can set persistent
but u prob wanna set remove when far away to false
just get the mob and set it persistent
Thank you very much! It helped.
how to stop ender dragon from breaking blocks
public class KillListener implements Listener {
public void onKill(EntityDeathEvent e) {
e.setMessage()
}
``` Like so ?
playerdeathevent?
oh yes thx
dont forget ur @EventHandler
e.getPlayer probably
declaration: package: org.bukkit.event.entity, class: PlayerDeathEvent
but enumConstantDirectory() itself uses reflection
ye only once and then caches it, but whatever
I just cache all the enum values myself when I need them https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/data/EnumCache.java
mye
where is my pom.xml
java enums are just weirdly implemented
values() making a copy, like meh
but atleast they are not just numbers like in other langs
rust enums <3
I'd almost rather them be numerical
but that sucks when you gotta map fields to them
you don't have any, and if you had one, the project structure would be messed up anyway. where's the src/main directory?
could do some kind of index lookup, but the moment you start assigning indices that are not packed together :(
i started and idk why this time i got this error i tryed to restart the server but it didn't work please help "io.netty.AbstractChannel$AnnnotedConnectException: Connection refused: no further information"
the plugin builds
Does anyone know how to remove the yellow ping number in a tablist?
how can i post java code in discord i dont know how xd
?paste
or ```java
Or
```java
// Code here
```
?format
ja i done it in paste.md
so my problem is im trying to code a doubleJump all is working the cooldown too but the cooldown messages dont appear and i dont know any further so please help...
i started and idk why this time i got this error i tryed to restart the server but it didn't work please help "io.netty.AbstractChannel$AnnnotedConnectException: Connection refused: no further information"
is the player in adventure mode even?
Could you send the body of Cooldown.checkCooldown?
the method name is really ambiguous fyi and may be an issue later on if you want to debug it
yes i know that but thats not the problem now
so do you have an idea why i dont get these messages
From what you sent us there is no issue
yes and thats my probem :/
no error no nothing it should work fine...
oh no wait there is an error in my console
guys for the ENTITY_ATTACK damage cause, will it ever be the cause when the EntityDamageEvent is not an instance of EntityDamageByEntityEvent?
is not*
Ideally yes
It could be the case if a plugin wills it
but its not an error for double jump so its irrelavent
what I'm saying is that
A) I cannot comprehend what you are attempting to do
and/or
B) I do not have sufficent knowledge about called methods or other methods that do other things that just happen to affect the global state of the application and thus your piece of code
mhh okay im trying to fix it on my own
Dang
Spigot doesnβt have any way to remove some of the vanilla tree generation does it
nerd
probably something to do with block populate
Hi, I think I found a bug that maybe should be fixed. I cannot find the place to report it to the devs, could you guys tell me?
The bug:
EntityPortalEvent doesn't trigger if a NPC travels through an end gateway, while it works as i think it should be with nether and end portals.
End gateways huh
?jira
Do I need to make an api for accessing vanilla populators now
paper has a EntityTeleportEndGatewayEvent
yeah
Anyone know if there is a way to detect if a FallingBlock converts back into a regular block?
So far I've tried making a runnable that detects if a fallingblock hits the ground, but that didn't work
EntityChangeBlockEvent
Hello, how can I add nms net.minecraft.server.v1_19_R1 to my gradle plugin ?
I did tell you when you started to use maven not gradle
you have to use a 3rd party plugin for nms
how to convert it ?
okay thanks
how can i ask if a player is jumping? i didnt find one in the internet that worked
use PlayerMoveEvent and then check if event.getFrom().getY() is inferior to event.getTo().getY()
what was the symbol for inferior
you probably want to check if the difference is like over .5, could also just use the statistic event
inferior < superior
yes i know i done !isSwimming and !isFlying after that with an &&
if you can undertsand my english i hope xd
listen to the statistic event to increare the jump stat
about as good as you can get
Database question.
If iβm storing like, ability and progression paths for my game modes, Woild MongoDB be the best approach?
Is it a private or public plugin?
private
Then whatever you feel most comfortable with
Though Iβd probably build it in public,
Iβve never used mongo before. Was hoping to use this project as a maybe reason to learn, but not sure if this is the right justification
Most people use SQL so people might not want to have 2 DBs on their server
The project itself is a server core. π
If iβve got multiple unstructured sets of data, I donβt know if mysql could keep up
If you're slowing down SQL then that's a you problem not a SQL problem
Hello, is EntitySpawnEvent applicable when a player join the world ?
yes
okay thanks
not clear
Player = Entity
You are doing string - long
I want to make a sorta claim plugin for my server. Is worlguard a good API for claimed lands?
why does that response sound so AI Generated?
Idk how you expect that to work
100% is
lmao why respond with an ai generated response?
I just checked with chatgpt, it is
yea but it does not really answer my question
its more explains what worldguard is
stop responding using AI generated shit
thats because you are trying to do math using a string. Convert it to whatever datatype you need.
what's the difference between setComments() and setInlineComments()?
in YamlConfiguration
chatgpt isnβt always accurate when it comes to coding with spigot, suggested me methods that didnβt even exist π
i asked it for a method to send the player to mars and it gave me #sendToPlanet(PlanetType.MARS)
then tried to link me the java doc to that
okay @somber sinew stop
# Comment
test: value #Inline
Stop with the AI responses. It's an idiot and annoying. Only respond if you know the answer.
right, doesnβt really matter. People came here to talk to humans, if they wanted to ask chatgpt they could have.
thanks for explaining in baby mode lol
people living under a rock??
highly doubt anyone here doesnβt know what that is
especially in a programming discord
This is not really spigot related. Just use a math formula to do that
figure out how many ms there are in a second
s = ms / 1000
m = s / 60
m = (ms / 1000) / 60
you have to replace the s with the value of your seconds
and the ms with the value of your miliseconde
and m = minutes
you should really encapsulate your cooldown stuff into a separate class, e.g. like this https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/data/Cooldown.java
that way it's reusable and you don't have to repeat all your code if you need a second cooldown somewhere else
you could do that, yes
Literally anyone who is on social media knows chatgpt
or reads news
No AI is accurate
isn't that quite self-explanatory?
// Create cooldown, save it as field or sth
Cooldown cooldown = new Cooldown();
// set cooldown
cooldown.setCooldown(somePlayer, 20, TimeUnit.SECONDS); // Player has cooldown for 20 seconds now
// check cooldown
if(cooldown.hasCooldown(somePlayer)) {
// Still in cooldown
}
``` @sage hare
chatgpt is differently not known to be perfect at math
uuuugh where can I delete my fork on spigot's stash, it used to be in repository settings but I can't find it anymore lol
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
@somber sinew you should ask ur buddy chatgpt
why are you calling cooldown.get() on setting it?
And why are you calling TimeUnit.DAYS.SECONDS?!
cooldown.setCooldown(player, 20, TimeUnit.SECONDS);
if(cooldown.hasCooldown(player)) {
...
}
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
did you create the class as it shows, and then use methods on Duration??
is your variable called timeleft?
so modify it to your usage
use it where you need cooldowns
just modify the ifs if it is a command or not
also a little tip, try to use if-not-return, makes the code a little cleaner IMO. so:
public class CooldownCommand implements CommandExecutor {
private final CooldownManager cooldownManager = new CooldownManager();
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
// Player only command
if (!(sender instanceof Player)) {
sender.sendMessage("Player-only command");
return true;
}
Player player = (Player) sender;
UUID playerId = player.getUniqueId();
Duration timeLeft = cooldownManager.getRemainingCooldown(playerId);
if (timeLeft.isZero() || timeLeft.isNegative()) {
player.sendMessage(ChatColor.GREEN + "Feature used!");
cooldownManager.setCooldown(playerId, Duration.ofSeconds(CooldownManager.DEFAULT_COOLDOWN));
} else {
player.sendMessage(ChatColor.RED + timeLeft.toSeconds() + " seconds before you can use this feature again.");
}
return true;
}
}
depends on your use case too ngl
the code was taken off the wiki, its just copying the prior code lol
oops
AttributeModifier modifier = new AttributeModifier(UUID.randomUUID(), "generic.attackSpeed", swordSpeed, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND);
meta.addAttributeModifier(Attribute.GENERIC_ATTACK_SPEED, modifier);
Anyone know why this doesn't seem to be changing the speed?
I'm not sure if there is an easy way to check if its working besides just starring at the cooldown sword thing which from what I can see doesn't appear to change even when I change the variable for swordSpeed
Does it show on the item
yeah
Then it's working
Then how can I set the base of the attribute to be that number as it's adding to it which I don't want
So a player by default has a attackSpeed of 4?
So the attack speed on something like a netherite axe is x + 4?
A netherite axe has a default attack speed of 1
So it has a -3 attack speed modifier
Does anyone know how rankup works?
what's rankup
yes
Helpful
How did you remove the #
hacks
and duration of nitro subscription
hey guys HomosexualDemon here
I am also nitro and it won't let me
it depends on when your account was created too
if you had nitro when the update started you will join nitro 2022, if you didnt your in the normal 2022 lot
its on like the 2017 no nitro atm or smething
In my other account I have been with the nitro since 2015 and it does not let me
i got mine with the 2019 nitro group Β―_(γ)_/Β― contact support or something
And how I do it
you'll have a popup telling you you can do it
I look at it with my mobile and it doesn't come out
no idea if the name update shows on mobile
Yes it does
I changed mine on mobile - without nitro since I registered in 2017
your discord app could be outdated
did you have nitro like 2 months ago
But since discord is basically just chromium I think you don't have to update for features like that anyway
no. I have nitro since like a week
and only had it once before, like a year ago
huh
Well I was able to change because I registered in 2017, not because I have nitro
yeah, i thought they handnt gotten to 2017 no nitro yet
That's what I wanted to explain with it
huh
private void createTables() {
try (Connection connection = connectionPool.getConnection()) {
@Cleanup PreparedStatement createBloodlineStmt = connection.prepareStatement("CREATE TABLE IF NOT EXISTS bloodlines (" +
"uuid VARCHAR(36) PRIMARY KEY," +
"exp INTEGER" +
");");
@Cleanup PreparedStatement createTraitsStmt = connection.prepareStatement("CREATE TABLE IF NOT EXISTS bloodlineTraits (" +
"bloodlineUuid VARCHAR(36) PRIMARY KEY," +
"name VARCHAR(20)," +
"level INTEGER" +
");");
@Cleanup PreparedStatement createPlayerDataStmt = connection.prepareStatement("CREATE TABLE IF NOT EXISTS playerData (" +
"playerUuid VARCHAR(36) PRIMARY KEY," +
"bloodlineUuid VARCHAR(36)" +
");");
createBloodlineStmt.executeUpdate();
createTraitsStmt.executeUpdate();
createPlayerDataStmt.executeUpdate();
} catch (SQLException ex) {
ex.printStackTrace();
}
}
``` anyone know a better way i could do this, bloodline can have mutiple players, a player can only have 1 bloodline, a bloodline has no set limit for possible traits
how can I prevent the ender dragon from going through blocks
I also watched it on PC
https://paste.md-5.net/ocewoyahuc.cs
I tried this but I think it will break since the dragon will go fast
Use jooq lib for sql queries:)
We need @fluid river for free java lessons
π
since when was that fourteen
well you can get a dragons boundingbox, check all full blocks it contain, and if there is at least one solid block, teleport dragon somewhere
nuker is the jree fava lessons
yes
You have to rewrite entire ai of the enderdragon
but that would be in a tasktimer, cuz there's no EnderDragonMoveEvent
fixed it
nooo waaaay
fourteen is a self-made equation calculator guy
In my defense: I didn't get much sleep
and i'm jreefava guy
How should I approach making a 1.20 plugin that makes certain entities look like they are glowing only for specific players
(So using packets to "fake" the glowing effect, without actually using the glowing effect)
lol yeah I remember that - is he done?
partially
Nbt
he haven't added trigonometry staff iirc
use packets?
That's not something NBT can do
?nms
trigonometry stuff as in?
sin/tg
have all those functions
i kinda lost myself
then my information is outdated lol
check the gh if you wanna figure out
no thanks
Yea, already siad using packets, but how exactly? as in what packet
I also started making something like that since I needed variables to in-time-replace. I kinda stopped after a while though
we had like 2-days conversation about how to add stuff to your calculator
ill make it have variables and multiline expressions
i remember
wiki vg?
pog. Can it also calculate boolean expressions?
I need that, too
it has functions for those, im thinking about actually making them operators
e.g.
CURRENT_DAY == MONDAY
yeah thanks
Wait you changed nickname?
