#help-development
1 messages · Page 355 of 1
Haha
Nice
Anyway, i am german. We invented potatoes
We also invented hitler, so i better shut up
I'm American we invented everything good
They're mid
I think you‘re going to lose this discussion
Shut tf up get outta here
I don't need your shitty opinions
Go home miles, you‘re drunk, everything nice was invented by non-muricans.
Cars & rockets = german
Internet = english
Maple syrup = canadian
Nothing left to say
Fried were invented in belgium
I was gonna say well Germany invented Hitler but they didn't even do thay 😭
Guy was Austrian
Yeah he was austrian lol
Fun fact: WW1 started because an Austran dude got shot.
WW2 started because an austrian dude did NOT get shot
Damn Austrians
My spigot is better
D:
I'm in bed so I can't show you though
Dw
Just trust me
You can send a pic tomorrow
How do you use Display Entity in Spigot API? there's no google results (Minecraft 1.19.4)
Spigot doesn't do snapshot releases
You'll have to wait until 1.19.4 to do anything with them
Whenever Minecraft 1.19.4 releases at least lol
Mojang hasn't given an estimate yet ¯_(ツ)_/¯
That's just naming convention for Maven projects
No correlation to Mojang's snapshot terminology
1.19.4?
funny thing
yep
I mean he just seemed curious lol
We get people ask for unreleased versions from time to time. Gotten more prominent ever since Fabric picked up given they do snapshot releases
true, but they kept asking about 1.19.4
seemed scammy to me
people should know that there is no 1.19.4
if there's no client version for XXX, there sure as hell won't be any spigot version for it
also I blocked that person weeks ago because this isn't the first time they tried to annoy people
Is there a way to connect data in proxy server? ( Only Can Mysql?)
I want to send config's data to another server Is it possible?
Snapshots technically refers to test builds. But not everyone uses maven profiles to distinguish between snapshot and releases and if you dont just easier to just use the default which it appends snapshot.
From time to time client versions may be higher then server version
This happens when they fix something in the client but nothing needed to change with the server
There is only a handful of versions where this has happened
To be fair, the next version of Minecraft is going to be 1.19.4, and that’s the one with the display entities they were asking about
They just thought spigot had api for snapshots
hm idk
06a is an amazing snapshot
that was the same guy that spent atleast 4-6 hours typing in general that resulted in saying "hi guys how are you"
i'm trying to have maven handle the version incrementing for me using the Build-Helper plugin.
what i have so far is three profiles which respectively (are supposed to) increment patch, minor, and major versions
but whenever i run a mvn validate, the version is simply not updated (but it shows in the lifecycle)
what should i check for first?
(i can ofc send my pom.xml)
not yet
Which Event gets triggered if a player changes the selected item in the hotbar?
Thanks!
Does someone have any idea why my code isn't adding the "durability" aspect to the ConfigurationSection?
And yes, the bool is true, I quadruple checked. And there are no errors in the console
either you didnt save or nbtData is empty
The customItemConf obj is instantiated in the following way:
YamlConfiguration customItemConf = new YamlConfiguration();
did u save after that?
also it looks like the yml is an old version
after the write
I do, that's why there's something in the config at all
best guess is durability is somehow null
if thats a file you should be making that FileConfiguration customConfig = YamlConfiguration.load(FILE)
I need a ConfigurationSection, I save the section into a file using a FileConfiguration.
can you give the return value from getDurability
This is more interesting, why is it uppercase?
but you dont load it from the file again dont you?
make sure its not nukl ig
one sec, gotta check smth. The material shouldn't be uppercase, yet it is?
?paste your full code and yml
gimme sec, wanna check something really quick.
ConfigurationSection section = FileConfiguration.getConfigurationSection()
section.set("among", "us")
// save the config
?configs
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
all explained
ik how they work, it's rather the issue of everything works, except if it's key is "durability", then it just doesn't
ok fixed it, there was an issue with the server suddenly not using the correct plugin, ause a jar was created, server registered it, then it got deleted again.
😬
is there a way to check if villager job is priest?
Oh Yeah I know that method
Villager myVillager = ...;
if (myVillager.getVillagerData().getProfession().equals(Villager.Profession.PRIEST)) {
// The villager is a priest
} else {
// The villager is no priest
}
== for enums
hmm... There's no method getVillagerData and no parameter PRIEST
I'm on 1.19.3
try myVillager.getProfession()
Oh That's work but still don't find priest enum
oh wait I got it
Okkay
AND What's librarian?
Profession.LIBRARIAN
XD
haha
yeah
There is a fuction for the spectator gamemode to highlight all players. How's that function called and is there a way to use it for other gamemodes? So technically to highlight all players for specific players?
hi i've read this post https://www.spigotmc.org/threads/question-about-npc-ai.550692/#post-4382992 one man in here say how to add AI for EntityPlayer him say make a fake entityInsident for EntityPlayer but i don't know how to do someone help?
i really want to make npc player just use nms please not citizens
hi?
Hi everyone,
All my NMS villagers don't spawn in the first launch of my local server, but only after a restart... There's only half of them at the first launch... Does anyone knows why ?
spawning too early before the worlds have finished loading
how to solve this issue ?
don't spawn in onEnable
I tried in onJoin with an if, but it doesn't work...
I've got 2 villagers in one side, and two others in the other side
you need to make sure the chunk is loaded, if not load it. When the chunk is loaded spawn your NPC.
is here a good place to ask for help for a minecraft Maven Plugin? (regarding dependencies like craftbukkit and such)
Don't depend on craftbukkit anymore, depend on Spigot
does getnearbyentities detect all areas of a bounding box or only the centre of an entity
all areas
so it could even detect a small corner of a bounding box?
the thing is, someone made the plugin, that depends on Craftbukkit and I am not experienced enough to straight go to Spigot for it😅
more precise, this import: import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
that was the problem ! Thanks
That's nms
?nms
please help me simplify this god forsaken code
if (UnderscoreKillstreaks.killstreaks.stream().anyMatch(ks -> ks.getUuid().equals(uuid.toString()))) {
final int kills = UnderscoreKillstreaks.killstreaks.stream().filter(ks -> ks.getUuid().equals(uuid.toString())).findFirst().get().getKills();
UnderscoreKillstreaks.killstreaks.removeIf(ks -> ks.getUuid().equals(uuid.toString()));
UnderscoreKillstreaks.killstreaks.add(new Killstreak(uuid.toString(), kills + 1));
}
i believe it can be simplified
dont do anyMatch
ifPresent
and dont do Optional#get
Why not use plain a hashmap which stores that?
and dont expose collections
because it's more convenient for me to use a class everywhere else but this piece of code
i normally don't but i did this one static just to make sure i'm not crazy and it's always the same
what would i use then
simplify isnt the right keyword here
you gotta optimize that
you are iterating three times over the same collection
youre doing two streams instead of one
equivalent of checking map.contains and then map.get
if (UnderscoreKillstreaks.killstreaks.stream().anyMatch(ks -> ks.getUuid().equals(uuid.toString()))) { final int kills = UnderscoreKillstreaks.killstreaks.stream().filter(ks -> ks.getUuid().equals(uuid.toString())).findFirst().get().getKills(); UnderscoreKillstreaks.killstreaks.removeIf(ks -> ks.getUuid().equals(uuid.toString()));
all of this could be a single removeIf
work with java Optional<SomeData> data = killStreaks.stream().filter(ks.getId()::equals).findFirst(); if (data.isPresent()) { int kills = data.getKills(); // }
i guess i could indeed combine anymatch and removeif
but removeif is a boolean, doesn't return kills like remove does
oh that is definitely better, i'll see what i can do there
ty
There is also Optional#orElse if you want for example to default kills to 0 if not present in collection
his optional returns some holder for the kills, not the kills itself
Oh, didn't notice, nvm
but looking at that a map would be the simpliest
then i see that java guava
I'm always baffled
it used to be a map and it was really simple
i did refactor it to a list because 1) i might expand the killstreak class at some point 2) it's more convenient for me to use a class everywhere else
so map the killstreak class to the uuid?
what the heck is that
that code is not good for my blood pressure
134/80
it's fixed now lol
btw
try (final Reader reader = new FileReader(killstreaks)) {
final Type type = new TypeToken<Map<UUID, Killstreak>>() {}.getType();
UnderscoreKillstreaks.killstreaks.putAll(gson.fromJson(reader, type));
} catch (final IOException e) {
e.printStackTrace();
}
can someone explain this code to me
particularly the second line
i'm trying to figure out how it works
copilot suggested it to me
the second line creates a new TypeToken<Map<UUID,Killstreak>>
yeah but i'm a bit weirded out by the syntax, maybe i'm just sleepy, why are there curly brackets lmao
the curly brackets are there because it's a new anonymous class
one second
SomeClass myObject = new SomeClass();
this is the normal way to instantiate a new SomeClass
but
you can ofc also just create a "new class on the fly":
SomeClass myObject = new SomeClass() {
// Override some methods here
}
you are doing this ^ except that you do not override anything
oh yeah that's true, but typetoken has no methods that must be overridden?
that's why
thanks alex haha
you could just remove the { } part I guess
lol
my squid is almost done
🦑
ok i kinda see why i'm creating this abomination
so if i had to deserialize one class i'd just go with
gson.fromJson(reader, Killstreak.class);
but i am deserializing a map
and it's weirder
lol
cant you use the Files static methods instead of using a filereader?
Files.readString and writeString
erm is spigotmc's 2fa broken?
I just enabled 2fa by app, then logged out and logged back in, and it didnt ask for any code lol
does it work for anybody else?
I avoid 2fa when possible
anybody knows how i can get block under targeted? my zombie looking at Y:65 and i wanna get Y:64
Block blockY = block.getLocation().subtract(x, y-1, z).getBlock();
not works?
getLocation().getBlock().getRelative(BlockFace.DOWN)
you subtract the coordinates
that won't work
hm
okay, gonna try it
works, thanks
np
you previously substracted the x,y,z value "from itself" so you basically always just got the block at 0,0,0
hello how can i report server for using cracked plugins?
Has anyone here ever tried changing the method body of a foreign method? As in, having a library where you want to change a small detail, therefore need to change a method body.
If so, how did you go about doing so? Cause I'm currently trying to inject some code via javassist, but it doesn't work.
Any info or help would be greatly appreciated.
To give some context:
I'm currently developing an addon for a different plugin. One which I cannot or rather whos jar file I don't want to change.
I would extend it, but it would not do what I need from it. Therefore I'm trying to inject some code, which is currently not working.
If someone pings me, I'm gone for a while, so don't expect an immediate answer.
Edit: Found a fix for this.
can i make repeating timer inside run() method?
what run method
BukkitRunnable
first of all, dont instantiate bukkitrunnables but use the scheduler
and yes you can nest runnables
Hi, how can i change the wood type of a block in spigot 1.8.8? Like i have a WOOD block but i want it to be specifically SPRUCE planks
What am i supposed to learn from javadocs? xD
Both methods were removed since then however so they are likely only available on 1.12 and before
Thank you
how do i convert uuid object into the 4 integers stored in nbt?
UUID#getMSB and UUID#getLSB
Then get the MSBs and LSBs for both the MSB and LSB (giving you 4 ints in total)
I am not too sure why one would store an UUID as 4 ints anyways
But if the NBT spec demands it, you are kinda forced to - whether it is sensical is a nonsensical question
Im trying to create custom enchantment, but i get error, here is the code:
hi, is there a built in method to get the player face as an image? (like the one in tab)
No
how could i acheve this (im trying to save the online players name and face in a db)
namemc api?
I'd use https://minotar.net/
Minotar is an insanely fast service for turning your Minecraft skin into an Avatar. Easily embeddable and usable for your site, blog or plugin.
cool! tysm
whats the maven dep for it?
When making a custom strength enchantment, should I use EntityDamageByEntityEvent, EntityDamageEvent or PlayerItemDamageEvent. The enchantment is only available for swords but it should apply when hitting other entities like sheep and zombies, not just players.
EntityDamageByEntityEvent
Ok thank you
which bungee event is first fired when client connects and is accepted
?jd-bc
well, you can use ServerConnectEvent depending which type of connect you want
ye im looking at it rn
that event is called when it starts connecting, not when its successfully connected
not sure which u want
the one before deciding a server to connect to
or actually that one
the one that decides where to connect
i found it on github but never used it. https://github.com/SpigotMC/BungeeCord/blob/master/api/src/main/java/net/md_5/bungee/api/event/ServerConnectEvent.java
ye seems perfect
have anyone used gradle for setuping multiproject builds?
is there any way to setup subproject name without renaming it from rootProjects settings.gradle file?
How would I modify the damage in EntityDamageByEntity event?
Not that I'm aware of. rootProject is the root project, so there can only ever be one name for it
Im asking here as it seems more of a common sense thing for the dev lads than a typical server owner. What does this particular catch mean?
There are "too large of a y axis movement" etc but the wording of "impossible" gives me pause
i would guess its like passing through blocks or moving way way to high way y value
Hi, im having some problems with this code
https://sourceb.in/DG21NBM3q1
Error: https://sourceb.in/XQO4Wb9UqZ
I don't understand why it happens, only when i use items
null at whatever is ListenerDrugs.java:80
80 is the if
split it up but I'd guess Config is null
config is not null
im sure
i already debuged it
Then getItemMeta() is nullable. you never check it
so i need to check like ....getItemMeta() != null
hasItemMeta
ok thanks
just check if itemmeta is null cuz hasItemMeta does some bs you dont need
does the PlayerInteractEvent also fire for when you press Q, because it seems like it, but doenst make any sense imo
what does pressing q even do
It does because of a quirk in how the interact event is fired
👀
The interaction event is called based on the swing of the arm
Unless that's changed recently but if that's behaviour you're experiencing, that's why
oh
also it seems to also affect me pointing at air or an actual block
which is kinda annoying
since I cant prevent it afaik
I just want the player to "use" my item when they right click on it
oh, skipping the event if the action isnt a right click seems to work
they probably need to add a dropitem action
Can't. If that's something we could control we would just not fire an interact event when an item is dropped
The way we detect punching the air is the same code that gets called when an item is dropped
I guess so haha
that's too bad
anyways, nothing a few more lines of code wont solve haha
Can anyone help me make a shop menu? wit the plugin deluxemenu
just wondering, will there be possible issues if you get the location of an entity just after youve .remove() 'd it (same tick)
ig you would get location where entity was at before it was removed
Was the playerdeath event disabled / removed
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/PlayerDeathEvent.html doesnt look like it
declaration: package: org.bukkit.event.entity, class: PlayerDeathEvent
Doesnt come up on the jd and doesnt fire on code
1.19.3?
yeah
the fuck? idk how that wouldnt appear on java docs
seems to be my code
well i havent able to make custom subproject names, but what i achieved instead is to make rootproject prefixes to artifacts
which suits my needs
// prefixes all the subproject artifacts with rootProject name. Neat!
subprojects{
afterEvaluate {
if (pluginManager.hasPlugin("java")) {
archivesBaseName = "${rootProject.name}-${name}"
}
}
}
finally I separated bukkit implementation classes from my core plugin classes
at least i learned gradle more
can someone remind me which version it is in which the API had an overhaul in regards to items? for example when Material.LOG changed to Material.OAK_LOG?
thank you
Hello, so I want to break this block, but when I call block.breakNaturally() the block just disappears, I wanted to make so it breaks with the particles and sound.
Is there a method for that?
it doesn't tho
any errors
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/Block.html#breakNaturally() both methods should work to do that
declaration: package: org.bukkit.block, interface: Block
the method just makes the block disappear, i wanted so it plays the break sound and show the particles
i looked up and the only thing I could find was this thread of a guy telling that you could only do it with nms
what version
I'm using the latest
1.19.3?
yes
if theres no errors not much else i can say, breakNaturally should do exactly what you want
It doesn't tho, i don't think there's a method for what I want. breakNaturally documentation only says it "breaks the block, and of you provide the correct itemstack tool, the block will drop"
breakNaturally() just calls breakNaturally(null)
yeah it doesn't look like it's calling the particles and sound, i guess I'll have to resort to nms
what block are you breaking
glass
does glass even have particles for being broke
yes
you can probably just summon the particles normally
every block does
no need for nms
how can I do it
declaration: package: org.bukkit, interface: World
using spigot api is for the weak I haven't coded a spigot plugin in years NMS only
how come when players move in servers there's minimal to no jitter?
using NMS is for the weak I made my own server
using servers is for the weak I made my own game
making your own game is for the weak I made my own operating system to run my own game to run my own server
making your own operating system is for the weak, I made my own hardware
hah I invented my own hardware to make
I made the universe, fuck it
I made the simulation the universe is in
what came first
I came first
what about ur mom
how are your brains feeling
no no I can not
I got a major headache
you win
and am listening to a 2008 song remixed into hardstyle
just take a look at that
most liekly
i wonder if that ever changes
it does not
check NoClipManager and all
ive only got to the spigot page and hate it already
it's braindead
here's how they do aliases
why
just why
you know what is fun, just looking at projects where people use a domain as their package and they dont own that domain
what the fuck
Cries in me.illusion
what the fuck
i dont care about those
wait
dont you own illusion.ev
.dev
https://illusion.dev 100% you
sure
why dont you use dev.illusionthe
oo the owner of that domain has a mutual discord server with me
and it's minecraft plugins related
me omw to spend 700 grand on illusion.com
thats nothing
i dont get the point of doing this
most people have already seen its gpl or whatever
this bug is so bad
like
how does builders utilites manage to do that
he added the bug tag
1 fucking year ago
illusiondev.com is like 10 bucks hm
do I really want to spend that much when my website is poo poo
and I can't bother learning the absolute minimum of HTML
its like maven
I might just make my website with wix honestly but I really can't bother
but worse
I'm making my web app in fucking Vaadin
which is a java framework
because I can't bother
whats wrong with illusionthe.dev lol
fun
dev.illusionthe
it's fancy but not too fancy
and package name looks bad
makes sense
illusion.com is like 700 grand
illusion.dev is owned
I want it
illusion.tech is 1.3 grand
i wonder when choco will fix his ssl cert
because .tech is extortion
i have casper.sbs which i like but the registry thought it would be funny to jack up the price so i cant afford it anymore lmao
why am I looking at domains I can't even afford food lmao
well I can but not for long
gotta renew my domain in like a month
is nms stuff now just net.minecraft.server.stuff not the net.minecraft.server.version.stuf
illusion.sh is available but ~$30
i wonder what net.minecraft.server.version.Item is now-a-days
illusion.center is 20$/year, illusion.place is 15$
or u could go for a very high tier one: illusion.pizza at just 60$ a year 🗿
🗿
make it redirect to domino's
I actually had a very nice experience with domino's today
store was empty, was just me and the manager
guy asked us what the request would be so he could prep while we were paying
we just sat down, guy went out of his way to serve
brought cups and a drink and all
didn't accept tips
pizza was a bit undercooked but was probably because I asked for extra sauce
i only went to a domino's once and it was nice employees there🗿
they opened like 2 months ago, here
so nice experience as well 🗿
they also remade the entire website like 2 days ago
which means my selenium automation is broken
yes I automated the ordering process
Is there a built-in method to get a username from a uuid?
I believe...
Server,getOfflinePlayer(uuid).getName()?
That won't work perfectly, I think a player has to have joined the server
(And it's also broken for offline servers but we don't support those anyway)
Yeah the player I'm gonna check will have joined at least once
Yeah with offline servers comes some problems, I don't mind them as I do not really endorse them anyways
Offline players should work fine then
If you wanted to check for players who hadn't yet joined, you'd probably have to work with the Mojang API
I'm not entirely sure if Spigot supports that through PlayerProfile, but looking through CraftBukkit it doesn't seem likely.
ok thanks
If the player hasnt joined it will fetch the info from mojang servers
Yea that method can be a huge lag source
That's why we always call that method asynchronously 
What convention should i use for naming an alt account object? I dotn really finding a good time to call it
May i ask why they already havent done those type of things run async? So its another extra step removed / out
Because that's not really the responsibility of the API tbh. Maybe you want to run it synchronously
All you realistically have to do is wrap it in a CF
Why would you like to run it sync, if it can hang the sever ? I mean it doesnt make sense
This are the most significative example of bad api design - Taken from a paid plugin api
is it possible to spawn some item on the ground (entity, not itemstack) and have it only collectable for a certain player?
Really it just depends what you are doing. I would say the scenario to run it sync is more on the niche side but it doesnt mean reasons dont exist
Yes. There is an event for picking up items. If it doesnt match the player you want to pick it up. Just cancel the event
So I would have to give the item some pdc to inform what player can collect it, then check the pdc every time someone tries to pick it up right?
That is one way to do it
Item entities have uuids as well so you could just store that in a map too
Either way is acceptable and which you should use is up to you. Recommend going for which ever is easier for you
there really isn't pros/cons of one over the other?
except that pdc would take more storage ig?
There is. Pdc adds information to the item. Where as the map is more temporary. If items are short lived on the ground anyways, then no reason to store information in a persitent way so a map does just fine as it is easier to evict objects out of a map.
But like i sais, both methods accomplish what you are needing
Now the downside of the map is that if the items will persitent on the ground and want to still track said items between restarts. Then pdc it is
Map wont persist between the restarts
How would get a list of numbers? So then you can simply recommend thru tab completer
Because i tried doing it with Integer.MAX_VALUE, but then tab completer get bug because they are thosen of number
I always forget that CompletableFuture exists
Yeah and its an amazing tool for playing around with it
When you register api, it override those classes, tbh don't see why it's bad design
Same as with using interfaces, just throws error instead
I once had a dumb asf issue with a completable future, thanks BUYCRAFTAPI PLACEHOLDERAPI EXPANSION, basically I think it blocked all the completable future's threads. So when I tried running more completable futures, they would never start.
it was FUN debugging that :D
Yeah, if it's something important (like SQL) it's usually a good idea to supply an executor
yeah what i thought, but still really bozo to sea an api like that i will all life prefer the well designed apis which doesnt do those type of harcodes
LMA0 working ith arguments its so confusing, specially when working over nested commands (commands with sub commands, inside of sub commands, etc)
Hi guys, How are you guys doing today?
Hi how to use pathfindergoals in EntityPlayer?
Uh
EntityPlayer?
NPC Right?
I've never tried it
maybe someone else can help you with it
Wdym
if u use LibsDisguises you can disguise a zombie or some other entity and give the zombie path finder goals and it works fine
Did you already set NMS remapped up?
you can look through LibsDisguises code and make your own
is remapped good?
cause i use obfuscated version
well
If you use maven ^
It's fine not like I can't read the obfuscated code
But you will have to adjust it on every new release
Remapped is basically „always working“ no matter which version
guess what? I only code 1.17.1
and its not like decompiling would hurt
not saying that you have a bad point, you have a great point it's just that im lazy
well okay then lol
anyway, what's your question about pathfinding goals? they are quite straightforward to use
i wrote some wrappers for pathfinders in jefflib https://github.com/JEFF-Media-GbR/JeffLib/tree/master/core/src/main/java/com/jeff_media/jefflib/ai
not mine
theirs
they were asking to make pathfinder for EntityPlayers
Yes
so what's the problem?
usually you can just delete everything from the existing goal selector, then add your own goal
and that's it
can u use pathfinders for actual players? im curious
Can this add pathfinder for entityplayer?
Im debuggign a Bungee plugin, but now the event seems not to be toggled
I've try but it keep error and say EntityPlayer cant use pathfinder
Do you have any example of this
is EntityPlayer instanceof EntityLiving?
Cuz i want to make a npc model player can challenge player to pvp with them
probably not
yes
Then it should work
it's LivingEntity, and yes ServerPlayer extends that
but I am also pretty sure that players cannot have pathfinder goals because obv they are controlled through their PlayerConnection
ask ChatGPT
ChatGPT doesnt even know the order of event priorities
I mean
¯_(ツ)_/¯
I'll ask for you, wait.
oh they got it fixed
a few days ago, it claimed HIGHEST was executed first
now it got fixed
Man chill, it's still an AI
I don't complain, I just say that you cannot rely on GPT giving correct answers
sometimes it's correct, sometimes it isnt
ChatGPT also gives wrongs answer
I asked for 1.17.1 btw
Yea if so just ask it to correct it
?
this is what they mean
you can tell it "no, that's bullshit" and then it'll give you another answer
however, in this case the original answer was right lol
just test the code, if it doesnt work, tell it what doesnt work
or just go through the NMS code yourself and figure out a way
Nah chatgpt sucks
Sure
I'll make it on 1.17.1 obfuscated NMS
since i dont want to use remapped or some shit
stop calling it shit 🥲
:>
he said or some shit
i dont think he was trying to say something bad about remapped
idk
all I can say is, I love remapped, and it was the best decision ever to use it
if now spigot would use it too, my life would be awesome
that'd stop requiring plugin devs to recompile their plugins for every new version
F
There is a fuction for the spectator gamemode to highlight all players. Does anyone know how that function is called and is there a way to use it for other gamemodes? So technically to highlight all players for specific players?
should i wait for some ms to get the response of plugin message from bungee?
how much should it be
the response is in a listener
How to send a hoverable message with more than one line?
which means it instantly responds?
ikr
im using a class for both listening and sending bytes
oh
well it doesn't have to be instant
as soon as the event fires that's the response
I may have to use wait method i guess but for how much ms should i use it
there is no wait method needed though?
Like
Send -> Bungee -> All Listeners (if any response)
Hi. I'm making a skin plugin which has command /skin <username> command to set the player's skin but when I execute the command nothing happens and my skin doesn't change. What is wrong with this?
public void setPlayerSkinWithUsername(Player player, String username) {
final EntityPlayer nmsPlayer = ((CraftPlayer) player).getHandle();
final PropertyMap properties = nmsPlayer.getProfile().getProperties();
nmsPlayer.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, nmsPlayer));
properties.removeAll("textures");
final String[] playerSkin = getPlayerSkinFromUsername(username);
properties.put("textures", new Property("textures", playerSkin[0], playerSkin[1]));
nmsPlayer.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, nmsPlayer));
}
@SneakyThrows
public String[] getPlayerSkinFromUsername(String username) {
final URL url = new URL("https://api.mojang.com/users/profiles/minecraft/" + username);
final InputStreamReader streamReader = new InputStreamReader(url.openStream());
final String uuid = new JsonParser().parse(streamReader).getAsJsonObject().get("id").getAsString();
final URL url1 = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid + "?unsigned=false");
final InputStreamReader streamReader1 = new InputStreamReader(url1.openStream());
final JsonObject textureProperty = new JsonParser().parse(streamReader1).getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject();
final String texture = textureProperty.get("value").getAsString();
final String signature = textureProperty.get("signature").getAsString();
return new String[]{texture, signature};
}```
Is there a reason for why the PlayerMoveEvent is triggered in this kind of very debounced manner? Is that intentional behavior as maybe performance would dip otherwise? Do I have to intercept the packet-stream to check for MoveLook packets (or whatever they were called)? :-:
I'm talking about yaw and pitch btw, positional updates seem to work fine.
move from gradle to kotlin lol
gradle == groovy
Seems like packets are again the only way to do this. Fine...
delete it and call World.generateTree
hi , is it possible to :
when server start wait (Configurable time) minutes and start the method?
?scheduling
i tried this :
yeb , i tried it , but it seems its not working .. idk why nothing is hapening after 5 minutes
scheduling is in ticks
yeah
what if i want it to run every 2 hours?
do i need to save the last time it was run? then compare it to the current time?
the repeat time
However, using the scheduler over long periods is likely to be fairly inaccurate.
ok so :
just for testing :
this will run only 1 time
i want it to repeat it self after every 2 hours
is it possible?
schedule a repeating task
Is there a dedicated Villager Trade event? (I can't seem to find one, so I'm asking here)
When you are talking about 2 hours you would be better using a ScheduledExecutor than using the Bukkit scheduler.
The Bukkit scheduler is mainly for things you want to run in a few ticks to minutes
if (player.getGameMode() != GameMode.CREATIVE) {
ItemStack item = new ItemStack(Material.HOPPER);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.WHITE + "Alloy Furnace");
meta.setCustomModelData(1);
meta.getPersistentDataContainer().set(CustomNamespacedKeys.customBlock, PersistentDataType.STRING, "AlloyFurnace");
meta.getPersistentDataContainer().set(CustomNamespacedKeys.energyStored, PersistentDataType.INTEGER, energyStored);
meta.getPersistentDataContainer().set(CustomNamespacedKeys.energyCapacity, PersistentDataType.INTEGER, energyCapacity);
List<String> lores = new ArrayList<>();
lores.add(ChatColor.GRAY + String.format(" ⚡ Energy Stored: %d / %d", energyStored, energyCapacity));
meta.setLore(lores);
item.setItemMeta(meta);
block.getWorld().dropItemNaturally(block.getLocation(), item);
}
this method is in a BlockBreakEvent it does run perfectly fine however it only sometimes drops the item
could someone help?
PlayerCommandPreprocessEvent is whenever a player enters a command.
PlayerCommandSendEvent is when the server sends all available commands to the client
ty
if I cancel the PlayerCommandPreprocessEvent it will cancel the command?
so for example :
this will run it , after 1 minute , and it will repeat every 5 minutes correct?
Yes
correct
Thanks
wait, is it measured in minutes?
you can do minutes , seconds , miliseconds
yes, he's not using Bukkit anymore
If it only runs sometimes, then the condition of not being in creative likely isn't being met.
yes its working perffectly thanks
it does run all the time (i am not testing in creative obviously) it just doesnt spawn the item like half of the time
this will run first time after 2 hours , and it will repeat after 2 hours
correct?
i just want to make sure
yes
it will keep repeating every 2 hours
that's what iam aiming for
its custom events for my skypvp plugin , the content is when event start , the most player's with lootbox clicked will recive a prize
the event for 15 minutes only
xd
?paste the entire method then.
i doubt looking at the code will make a difference as I said it does run everytime
it just doesnt spawn it somtimes
what is correct?
I believe delay is in milliseconds so that should be 900 seconds so yeah 15 minutes
you can also use TimeUnit.MINUTES.toMillis(15)
It might be because of the entity clearing that you do directly after spawning the item. You could add that item that you dropped to an exclusion list.
oh damn yeah thanks
i mean this start after 15 minute when the event start :
the end of event giving the prize and reset
delay is the time in milliseconds before the task is executed
so yeah that should start after 15 minutes
I haven't used the timer stuff in java though so I might actually be wrong on that but I think that is how it works
can you someone please help me. I'm so stuck on this!
take out your sneakyThrows and see what errors you get
any reason you aren't using the scheduler in spigot to do these tasks?
is there any way to beautify json? i'm using gson to save it to a file, maybe there's a built-in for saving it in a beautified way or a library to beautify json files?
Bukkit scheduler is not accurate for long durations, like hours
oh do you know why that is? kinda curious
The Bukkit scheduler runs based upon server ticks, which can vary drastically over time. Not all servers run a steady 20 ticks per second
10 tps == task runs x2 slower than when 20tps
at 10tps all of a sudden your two hour events run every four
i found the answer, for anyone wondering, use gsonbuilder to create your gson:
final Gson gson = new GsonBuilder().setPrettyPrinting().create();
ItemStack sharp6sword = new ItemStack(Material.NETHERITE_SWORD);
sharp6sword.addEnchantment(Enchantment.DAMAGE_ALL, 6);
i tried making an sharpness 6 sword, but i get java.lang.IllegalArgumentException: Enchantment level is either too low or too high (given 6, bounds are 1 to 5), but i actually want to make a craft to turn an sharpness 5 sword to sharpness 6
ItemStack#addUnsafeEnchantment()
that should be done on meta
No it shouldn't
Enchants should be applied to the ItemStack directly after the ItemMeta has been set.
meta.addEnchant(Enchantment, level, true) would add it as if you ran addUnsafeEnchantment
doesn't work
?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.
it's showing the same error
What does your code look like now?
you are not using addunsafe then
// ---------------------------------------------- SHARP 6 NETHERITE SWORD
ItemStack sharp6sword = new ItemStack(Material.NETHERITE_SWORD);
sharp6sword.addEnchantment(Enchantment.DAMAGE_ALL, 6);
ItemStack sharp5 = new ItemStack(Material.DIAMOND_SWORD);
sharp5.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 5);
ShapedRecipe recipe = new ShapedRecipe(new NamespacedKey(this, "netherite sword sharp 6"), sharp6sword);
recipe.shape("AXA", "BCB", "DXD");
recipe.setIngredient('X', Material.NETHERITE_INGOT);
recipe.setIngredient('A', Material.GOLD_BLOCK);
recipe.setIngredient('C', sharp5.getData());
Bukkit.addRecipe(recipe);```
oh wait
remote debugging
For whatever reason, enchantments don't always save properly when using ItemMeta. It may be under certain circumstances, but every time I see someone dealing with enchantments, the solution is to just apply it to the itemstack after they set their item meta.
jank
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(this, this);
System.out.println("Hello World from Blood SMP Plugin");
recipes();
}
@EventHandler
public void recipes() {
//rest of the code
i tried doing that, but i got this error
[12:03:16 ERROR]: [BloodSMP] BloodSMP v1.4.0 attempted to register an invalid EventHandler method signature "public void komas19.bloodsmp.plugin.Main.recipes()" in class komas19.bloodsmp.plugin.Main```
thats not how you make a listener
and you shouldnt call it yourself
?events
?eventapi
What event would that handle if you don't have any event inside of method arguments
Well, you need some event to handle, spigot can't guess it yet, also as epic said, no reason to call that method yourself in onEnable
so i should just put the code in onEnable ?
No, just put event you want to handle inside of recipes() function argument
or if there is no event, dont mark it with event handler and dont register the event
since there is no events, should i move the code to onEnable?
you can still have it in that method
@Override
public void onEnable() {
myCoolMethod();
}
public void myCoolMethod() {
//code
}
just remove the EventHandler annotation
why did you add it anyway?
because i thought it had to be done like that
no, just remove it
ok
does someone understand java.nio package decently?
does FileSystems.newFileSystem can retrieve paths from network file systems
for example from network drives etc
recipe.setIngredient('C', Material.NETHERITE_SWORD);
i want that netherite sword to be sharpness 5, but idk how
i think that recipes only check for materials
if you want any custom data you'd better handle PrepareRecipeEvent by yourself or smth
so as to check if the items in the crafting table are what you want and then yield the result
im just a beginner to java in general
?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.
but first read this
Hey when I wanna create a GUI. So when I set Items for example: inv.setItem(slot, item) can I put in this line multiple slots?
alr ty
In an entity damage by entity event, if the damager was an end crystal, how could I get the "igniter" of the end crystal?
such as an arrow, player, snowball, etc
if the end crystal still exists you getLastDamager or cause
if you can get teh last damage you can cast to a damage event and get teh killer
Smart, thanks!
Too many colours, hard to read
should
you got the entire RGB in your palete
ye
idk how that works but are you sure you have to open the webhook every time
cant you keep it alive
- you probably want to make it async
idk man first time using the webhook thing
if (entity instanceof EnderCrystal crystal) {
var cause = crystal.getLastDamageCause();
if (cause instanceof EntityDamageByEntityEvent event) {
return event.getDamager();
}
}
```?
what are you trying to do?
Get the entity cause of an end crystal's explosion
if the damage was by arrow you will have to drill deeper to get the shooter
Yeah the entire method has many more cases
The actual thing is more of a recursive thing
like
if (entity instanceof EnderCrystal crystal) {
var cause = crystal.getLastDamageCause();
if (cause instanceof EntityDamageByEntityEvent event) {
return getCause(event.getDamager());
}
}
should work
Removed the recursion to make it simpler to read, but yeah it just recurses
Hello, I Created my custom enchant, named 'isus', it works, i can enchant item with it, BUT when i try to
enchant things through the anvil with book, i cant, no errors, just wont give me item with enchant.. just nothing
436456 generic types provided by libraries:
?
?pdc
hmmmm... im using 1.12.2
then you're fucked
on 1.12 you gotta use NBT tags
my problem is, that i cant enchant item with enchantment book though anvil
how so
looks good to me
great for local variables
i done lore, enchant, it work when i use /enchant
because you never know which type the var has
var something = "asd";
what the heck is this? a string? a ChatSequence? An Object?
var something = somethingElse;
what's this?
your ide should tell it too
can you make an ItemStack shiny?
hover over the identifier
without any enchantments
whatever somethingElse is
add any random enchantment
like var makes a ton of sense
var = bad design
see? You cannot tell from this line
var = good design
@tender shard
no, var is shit
but only for local stuff
var = lazy design
or its just impossible
agreed on instance vars
yes I don't want to type
and if I need to know the type I just hover
not possible
doesnt have anything to do with laziness
okok ty
if now "event.getPlayer()" would change the return type, so would your "var" do. Sounds shitty to me
You shoudl be able to tell that variable type by looking not by having to hover or jump around
I would rather explicitly tell javac which type "player" has
You would still need to change it
the methods wouldn't work
exactly
is there any reason to make it var?
no
readability
var is only the type inference. you cant return it or can you?
add enchant tag in the nbt without any enchants in the list
the only time var is reasonable to use is if you dont know what something returns and you dont know, then you change it to the correct type
if you use var everywhere, its a you problem
if you name your variable correctly, and don't do weird shit, it's fine
"var" makes it less readable
it makes it much cleaner
Player player = we know it's a player
var player = we know shit
so you don't know it's a player if I change the type?
correct variable naming goes a long ass way
you do you. imho "var" is shit and it just hides the important information
if #getPlayer doesnt return a Player its an architecture problem
yeah, it could also be a HumanEntity or however it's called
e.g. in InventoyClicKEvent, getPlayer() does NOT return a player
then I would call it humanEntity
it's simple
^
so if you want to use it somewhere else as a player, the ide will complain
I would rather just declare the correct type in the first place
and imho it never makes sense
still have to get into it
anyone know if the check is correct?
such as on the same line as a math expression (eg 10L * someLong I know it's a long), same line as a cast (or +-1)
this works
^^
but my work forces me to use it so easy
no
or hell, if I know it's a method like getBytes I'll still use var, I know it's a byte array (such as in Files.readAllBytes)
and I'd name the var fileBytes
var filePath = file.getPath();
etc
And then when you have long generics like Map<SomeGenericType<T>, Function<T, SomeGenericResult<T>> I'd much rather using var


