#help-development
1 messages · Page 334 of 1
rotate can mean instantly go to the end
it is all what it said .....
not very descriptive
which ?
if the location hasn't changed much the client extrapolates movement
does anyone happen to know where a server's recipes are stored? or does it actually alter the jar when recipes are removed
Teleport entity packet
this guy wants interpolation
just look into linear interpolation
basically
progress = number/total
number = total * progress
so like
let's say you want to go from 90 to 180
I think Client does some Interpolation alread
so each tick, you do increment = (end - start) / totalTicks
i know that but i want to use that packet
It doesnt Work
you gotta send lots of packets for it to look smooth
and that is not smooth either
You see that the rotate head Packet doesnt work
Because the console yells at you to Teleport the entity
You need to use a scheduler and all
wep it take too long to rotate
^
well that is what i avoided
?
Well you tried
But it obviously doesnt work
So that is the most elegant solution to your problem
Really good namong for interpolation data
Does the timed one take a distance and the distance one take a time?
You should make a constructor that takes anglePerTick for distance and an angle and totalTime for time
Just a suggestion
But that's a really good name
I'm bad at naming stuff
not that smooth compared to this https://youtu.be/qBOpTJtWogI?t=877
Learn how to create an NPC! The super-easy way using packets and NMS!
Patreon:
https://www.patreon.com/codedred
Donate to me :)
https://www.paypal.me/CGMax
Join my discord:
https://discord.gg/zMzXSgk
------ Links ------
Download Eclipse: https://www.eclipse.org/downloads/packages/release/2019-03/r/eclipse-ide-java-developers
Download Spig...
that's because I didn't put in the effort
lmao
hippity hoppity im putting a copyright on that property
idk it's just something I made in like 2 hours
50 dolla
I also made it look at the player's feet instead of eyes
@vital sandal does this satisfy you
nah :d
i am stimulate the gun shifting or shaking (no idea what that called)
it should be less than 1 tick for it :l
recoil?
but i appreciate your work
yeh that^
why do you want to teleport the entity
what is the problem you are facing
teleports don't interpolate
rotation + headlook packet is used for changing yaw and pitch
Wow, what a discussion! xD Maybe I'm missing something, but I don't get what's so complicated about making the entity rotate smoothly.
They're using teleport ig
Why tho? I don't see what's keeping one from using the PacketPlayOutEntityHeadRotation and call it a day.
no pitch
Not true?
i dont see a 2nd byte or int anywhere on here
That's something stupid I wrote like a year ago, and it was smooth as butter.
You're right, I used two packets.
I already forgot, haha
But none the less, I still don't understand why you'd calculate the interpolation of rotations serverside. That just sounds kind of wrong.
Is the first packet even needed?
Not sure, try it
Oh wait the head and body can rotate independently
I guess, didn't work with it for a while
It feels to me like they kinda screwed the pitch up there, yes, haha
Sending head pitch with body rotation packet
Actually i feel like the first packet isn't needed
But i cba to test since i dont need this
https://www.veed.io/view/c79218bb-6889-4093-b8da-c4c289347e2f
I mean, looks like it's smooth enough to me. No idea what the requirements to smoothness are tho, xD
I can actually try removing that real quick, as I dug out the old codebase already anyways.
It's required, actually: https://www.veed.io/view/c2a44574-4f5d-42b5-840f-ca3ac1779b92
Wow
But I guess that this is still too slow for @vital sandal, xD. No idea if you could make that happen faster by cranking out a ton of pre-calculated teleportation packets. Also not sure if it would actually be worth avoiding the minor delay you're having with the proper method.
do you have a best practice tutorial for versioning on github with a spigot plugin? I confess I don't know what files to send and what files to ignore
Is normal that even if i cancel the block break event only if the broken block is a Large Fern or a small one, some times the block breaks?
Are you spam breaking it?
Yes, with the hand
Im doing that i done that when the large fern i breaken by a player it replants a small one that grows after 5s, but some times the small one is no more replanted
I tried to add a delay to but nothing changes
I don't particularly need to touch the automatically generated .gitignore? I just initiate and send without asking myself too many questions?
idk what the default is
This is what I use for .gitignore:
# Eclipse
.classpath
.project
.settings/
# Intellij
.idea/
*.iml
*.iws
# Mac
.DS_Store
# Maven
log/
target/
dependency-reduced-pom.xml
If you do git status before doing commits, it will show you any modified/untracked files, and you can add them to .gitignore if you don't want them in your repository.
yes I am familiar with github on jetbrains
Looks like most of mine might be covered in that default file.
Bukkit.getPlayer(UUID.fromString(string))
If they’re online^
Well yeah
show code
package dev.eymen.events;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
public class BlockBreak implements Listener {
@EventHandler
public void event(BlockBreakEvent e) {
e.getPlayer().sendMessage(e.getBlock().getType().name());
}
}
Update: Both bamboo and sweet berries gets detected as AIR.
lol
What's the issue?
Set the api version in your plugin.yml
Hello, I'm having a trouble finding a way to tell if a packet is getting shown or not. Here's what I've tested, although they all return the same values even when destroying the entity packet. If anyone can help, it would be much appreciated. ```@Override
public boolean isShown() {
System.out.println("Valid: " + this.entityArmorStand.valid);
System.out.println("Removed: " + this.entityArmorStand.isRemoved());
System.out.println("is Dead or dying:" + this.entityArmorStand.isDeadOrDying());
System.out.println("isNull: " + (this.entityArmorStand == null));
System.out.println("Bukkit: " + (entityArmorStand.getBukkitEntity() != null));
System.out.println("Bukkit valid: " + (entityArmorStand.getBukkitEntity().isValid()));
return this.entityArmorStand.getBukkitEntity().isValid();
}```Here's the method I'm using to destroy the entity packet ```Remain.sendPacket(player, new ClientboundRemoveEntitiesPacket(armorStand.getId()));```
Try on the forums
for some reason when i try to make holograms with armorstands and place them really close to blocks below they get like black words(as if they are inside the block and so that changes), is there a way to bypass this? like if I use packets will this be fixed?
I dont understand what you're trying to accomplish. The entity still exists on the server side so all of those should say it's not removed, not dead, not null, etc
Set them as a marker I think fixes that
^
nop
oh, they are not set as marker, i will test, ty
concerning that the server does not even send them to clients that would be weird xD
wait
huh
that is nor a marker

they are talking about a marker armor stand
not the marker entity
two different things
Yeah what is that LOL
Yeah but what does it do
it is purely there for map makers
to mark locations etc
its cheaper than an armor stand tho
ah
ultra stupid armor stand then
pretty much, but kinda nice over armor stands unless you need visuals
does the entire code inside onDisable run? or should I stop writting stuff in it?
🤔
is using an interface as an utils class generally considered good practice if that class is stateless?
it runs when the plugin disables
all the code that can run will run
what does "all the code that can run" mean
so does it influenciate the time the server takes to close? (like, does it go through all the code no matter what) or does it stop midway if server closes too quick? 🤔
some stuff cant run in the time the plugin has to disable
most stuff will run, but there is stuff like world creation etc that wont have enough time to run
it blocks the server from closing
All code takes time to run. Therefor if you run code the server will take longer to close
oh okay
im using it to save data from the plugin
and force players to quit and save their data since playerquitevent doesnt get called when they get force kicked on close
hi, i tried making a plugin using maven and i dont know why, but it cant find my plugin.yml, i put it under source folder as usual
It should be in the resources folder
^^
o
didnt work, it has the same error
What's the error? And how are you building the plugin?
?img
Not verified? Upload screenshots here: https://prnt.sc/
I think a class would be the better choice.
how do you build
intellij
artifacts
which artifact
na im using that just for the referencing
Time to use maven to build your plugin
which artifact do you press to build
See the maven tab on the right side
yea
Open it and find package
Then double click that
It should then use maven to build your plugin
oh yea
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
thats a bit concerning though
warnings dont matter
how can i show a player his hands while he is invisible? using packets
ok the plugin yml works but now this happens https://prnt.sc/aFRd1AfyOMKv
show your pom
thats not really spigot tho
?paste
JDA isn't loaded on the server
You have two options to load it
The first one is shading it with the maven shade plugin
The second only works for 1.17.1+ but it's the libraries feature
libraries:
- "net.dv8tion:JDA:5.0.0-beta.3"
^^ this is the libraries feature
Add it to your plugin.yml
also update JDA in your pom so you're using the same version
You need to make the player only invisible to others. You can intercept the potion effect packet to achieve that
nice it works, thanks
why not just use the API
there's both hidePlayer and hideEntity
I just assumed they wanted the potion effect
it this something to worry about
WARNING: Illegal reflective access by retrofit2.Platform (file:/C:/Users/krist/.m2/repository/com/squareup/retrofit2/retrofit/2.9.0/retrofit-2.9.0.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of retrofit2.Platform
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
by the way should everything both discord and minecraft side be in the package that gets turned into a jar
or can the discord side be separate
PotionEffectType doesn't have a .valueOf() method, any clues?
In second option olivo provided discord part is separated
In first, it's all in same jar
Use https://github.com/xxDark/deencapsulation or similar and there is nothing to worry
Otherwise - yes - there is something to worry about
oh, the comes from an internal library...
Yeah - then it is pretty much a coinflip whether it is an issue or not
::getByName
How you structure the packages are up to you, but try to follow the naming conventions
?conventions
anyone know a way to implement the text here?
wha
?img
Not verified? Upload screenshots here: https://prnt.sc/
thats an action bar
mmm
Player#Spigot#sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("text here"))
?scheduling to keep it from sending cuz it dissapears after a few ticks
?scheduling
bruh
If you guys are interested in automating this, I made an Apache 2.0 class for this
bruh
You just pass a String and then you choose the naming convention you would like to convert.
so basically for noobs that dont know java conventions and thus dont know how to use that library either?
No, I mean people who are actually integrating stuff to their IDE
if you have a bit of common sense, dont you apply the right conventions yourself already?
wtf is screaming kebab case lmao
whats kebab case in the first place
With what I just provided, you can name your class “hELLOwORLD” and it would apply the right convention without needing to write the code for converting it.
Just in case hehe
💀
So what do people think of utilising async more but by cheating out bukkit usage?
E.g: Plugin that checks if a large ammount of blocks meet 5+ Y conditions and then deciding to do Z thing.
-Set the various potential options for what the check will determine as a non-bukkit representation and store somewhere (in the async code, in a yml etc could utilise hashmaps?)
-scan every block you need to scan and save the property being checked as an int in an array
- ASYNC: Do the check based on the created int array against the properties saved
-Each property that meets the check will fill a new int array of 1's and 0's (or multiple ints if there are multile actions
-Send it back to the main thread and, via a hashmap, do the actions now the checks are done based on the numbers presented in the int array
I have no clue
but wouldnt that defeat the point of people naming their classes
if you make it an ide integration first
It’s snake case but instead of an underscore its a dash
They still name them, it’s just that you could be more lazy 🤓
would you just use reflection or something to actually change the class name or something
There's already a plugin for Intellij that can do this. It's called String Manipulation
Okay i'll spin this (lecturer in the house ya'll lol)
I think the points made by others here are valid, but the underlying concept could be spun on its head to be utilised as a team-based lib to allow teams to set a standard across a team in terms of naming conventions for stuff that arnt already established (like say how to name variables, create guis etc) to ensure a more stable, easy to bug fix code any dev in the team can sift through and understand relatively easily
Stop looking at your spaget code then 😉
whats a spaget
spaghetti
you would be surprised
proof of what
That your parser project's a spaget, 😂
people are weird
Does anyone know how to make a minecraft plugin that connects to somekind of webhook and receives Tiktok follow alerts then spawn like a zombie on all the players in the server :P Or is this not the discord/ channel for that :P
💀
I think that tells me enough
They spent so hard figuring out if they could, they didnt ask themselves if they should
While I certainly do know how, I'm not sure that I could participate in such filthy activities.
Filthy? I think you could sell it on tiktok for alot of money :P
If you would want
Poetry!
I just want one for my own tiktok streams
Coders who read poems are less likely to make ~~Spigot ~~Spaget plugins. Change my mind
if tiktok have an api
maybe
Well, if we're talking actual bucks, I might change my mind about said filth.
Tiktok doesnt but you can use Tikfinity which has an option for webhooks trough ifttt
And make the whole community a spaget by making everybody use their spagets.
@shrewd saddle who would the target audience be, why would they wish to buy it and what is the appeal in general of the idea
Dont there are some coding standards that to this day infuriate me
*jokingly of course
im not an asshole lol
If there's a will, there's a way.
uuugh parmesan tastes like unwashed socks
but yeah erm.... big brain play?
Well, I certainly am. Let's rather not go down that path.
Well I saw this tiktok account doing it... they had like 1000 people watching because it is interactive with the people on the stream. You could add some kind tiktok gift = Spawn zombie or something like that. then The tiktokkers would get donations because of it
And pwnplantgrowth plugin tastes of parmesan.... weird that
yeah but you do realize
gifts pay -5
So yeah
your plan is failed
donos*
Yeah thats the only thing that sucks but its interactive and you could get followers because of it
and then what
Wdym?
Like what's the goal
Profit?
Isn't tiktok not even monetized
There is lots of things that you can do when you get out of that
No its not but there are alot of businesses that want big tiktokkers to promote their shit
Well fair point, but you still don't get a profit out of it unless you sellout
Also I just want to learn a bit of java and this is a big challange for me
And just for fun make a challenge of the tiktok streams.
Tbh, I think that it's actually a bit too much for just learning java, if it's to be used in real life, not just in a lab.
Well it's simple really, figure out how receiving events from the IFTTT webhook works, then when a message arrives just do
<T extends Entity> World#spawn(Location, Class<T>, Consumer<T> consumer)
Well I made this plugin that already spawns a zombie on me when I type some sorth of command so yeah that worked :P
Yeah I got that just the webhook shit I couldnt get to work
Even chatgpt couldnt get it to work so I thought maybe one of you guys could help me out
tokenizer kinda slow Enter an expression or type exit() to exit: sin(12*6)+rad(e())^4-1 Took 12.5µs to solve Took 0.5µs to solve Took 10.5µs to solve [✔] Result: -0.7461715709788503 (6805.4 µs)
Just don't want you to make a fool of yourself infront of all your viewers if your software trips up live and people get mad. This thing has to be quite bulletproof.
ah sysout is also slow asf
EVEN?! My lord, people value this pice of shit way too much.
Hahaha :P It works quite good most of the time
I dont mind it that much
Can you judge it tho, without having deep knowledge of programming? Most of it's errors are subtle but detremental.
Not really its cool it can do all these small things :) its not made for programming
Well, it does what most devs do: Scrap together stuff from others and glue it together to get as close to the actual solution as possible. Lol
Hahaha Yepp
While producing a spaget, also like most devs. xD
whats this for chief?
Would you want to help me with it? :)
U no wanna know
This is development help, not development do it for you mate.
I dont say this meanly, I say this as coding is a really good skill to learn and i'd suggest you learn the craft yourself and not need to ask others to help.
Hell your learning process itself could provide content for your viewers
no go on humour me
Not sure, what's in it for me?
You can try to sell it through me?
An expression parser, implemented in the most complex and indirect way available, xD.
made a cli for parsing expressions
ill probably add a gui too
When people ask how I got it Ill just send them to you and you can sell it to them
Try try try, while my time is already in it. Well, not sure.
Oh aye any chance i can have a look?
Always interesting to see other dev's approaches
have a look at the outdated code https://github.com/FourteenBrush/MathExpressionParser
Oh yeah I understand
lemme just make a push this evening
got a working example you can show?
Not gonna steal the show by advertising it's rival, haha
wdym working example
Thank you for the offer but I'm alright I dont want to put in alot of money or probably not enough for you to make the entire thing
of the lib in action
you know the "here is a cool example of how this can be utilised"
if thats what you mean, here you go
So. and do forgive me , its an input based calculator ?
yes
Never said that I need a lot, as I'm one of the people who actually tinkers a lot but never made a dime. Not like I have inflated prices like some people in here.
But yeah, you're probably better off researching the topic a bit further and pulling it off yourself, as you're independent that way.
True, Thank you though!
Is spigot still using it's own mappings instead of the one provided by mojang?
yes
yes but you can use the mojang maps
?nms
Lol for real I see so many new people just depending on it 😂
Mh, is spigot mappings complete as mojang is?
Bc I was thinking of directly using spigot mappings
spigot mappings have every class moj maps do, just named differently
life saver
1.19.3 doesn't use Spigot mappings anymore iirc
So the ultimate spigot dev conundrum:
-Haz code
-Nicely structured
-Allows the effective deletion of a particular enchantment from every armor piece in chests, shulkers in chests, player and any other wacky container (offline and online) in under 3 minutes for an entire 7k*7k world...
-Wants to show off when full finished and polished
-...... is in kotlin
How bad i gonna get rinsed here? ;0
Older 1.19 versions still have Spigot named classes
no, it maybe has like 20% lol
huh? what else would it use?
https://prnt.sc/jBA8-nV4wrtx (for some reason it thinks the channel is null)
whats your code
because if it thinks that the channel is null, then I am like 1000% sure that the channel is indeed null
I like JDA
i dont
what's painful is to invite your own bot to your server lol
have you seen my quizbot epic?
i think i did
https://prnt.sc/GPYjSQAXKPQe (token being there is bad practice ik thats just temporary)
What would cause a trash like that.
why dont you just use jdaBuilder = JDABuilder intead of jdaBuilder = builder
- doing struff like that is pointless
does your bot even have the proper intents in the discord developer portal?
yea
which ones does it have?
JDABuilder.createDefault(token).setStatus().setActivity().build().awaitReady()
oh
?main too
whats your plugin called
IPCBot
tbh I always call my main class Main
call it ICPBot
get out
that'd suggest that the plugin is a bot
it's however a plugin
soooo
if at all
call it IPCBotPlugin
oh yeah
there is a lot wrong with this code lol
the channel however should not be null if the bot can access it
you sure the ID is correct? might wanna invite me to that server for a second? 😛
the permissions are usually not the problem, but rather the intents
weird request but sure just leave when youre done (its the id for general)
ill dm it
none of those things cause exceptions, you build twice, have very unneeded variables
yeah i should prob just set builder build as a static global variable
then its only done once
oki
public JDA jda;
@Override
public void onEnable() {
jda = JDABuilder.createDefault(token).setActivity().setStatus().build().awaitReady();
// do stuff
}
hm permissions are definitely correct and the ID obv too
you probably didnt wait until the bot is ready
yeah
im used to discord dot net so im still getting used to the whole jda thing
also change that code to match what i sent
this should fix it.
why not static, its the only jda instance is it not
static bad
and why public
i use lombok
I'd make it a private NON-STATIC field
because the JDA isn't describing anything about the class
yeah I kinda also dislike useless getters but everyone's angry if you make your fields public
Can someone help me with this problem:
[SCHWERWIEGEND] Exception in thread "main"
18:34:00 [SCHWERWIEGEND] java.lang.RuntimeException: Invalid configuration encountered - this is a configuration error and NOT a bug! Please attempt to fix the error or see httpsww.spigotmc.org/ for help.
why the heck is your log4j in german
having useless code is a nono
?stacktrace
We cannot help without the full stacktrace; Please paste it here: https://paste.md-5.net
Because I'm German😅
the only reasons for getter functions is if there is more logic to it
yeah but it's weird lol
anyway, send the full stacktrace
there should be many more lines
So erm what did folks think of the wild funni async man? 😄
dawat
Yes, I also think it's funny that it's in German, I would have preferred to have it in English
.
i dont really underdtand at all what you're talking about tbh
Where should I send the whole log
?paste
?paste
Rather than having checks be done bukkit side (and hence not being asyncable) set the checks up as standard variables and do the hard checks in an async task, and then feed back to bukkit
so rather than say 100 material checks on blocks you've scanned... you scan the blocks, give each of em a int value or string value etc etc, throw them into an async task that does the checks based on that non bukkit value.
ok thank you Do I get an answer for that?
I think the same
once we get the link of the paste we can help
unfortunately most people disagree
yeah it was the await
well they are dummies
you gotta paste it there, then click on the "save" button in the upper right, then send the link
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
fuck
gg epic
sorry sorry i didnt know
@subtle adder for the record, do not send in multiple channels,
noted 🫡
a wild conclure appears
Better way to explain
For tasks that have multiple checks being done as opposed to large ammounts of bukkit tasks being the issue
because checks on stuff that , tbh u dont need the bukkit api for is stinky
Absolutely nothing wrong with that
i think the same
Ngl I give a small tear of pride and joy when I see that someone has a 30+ class plugin with multiple packages and see that the UTTER LEGEND had the common sense to call their main class GOD DAMN MAIN! IT ISNT HARD PEOPLE! 😎
sometimes being too clever with your code makes it hard for others to appreciate it
Simple can be better, sometimes :L
Can vault get the price of a sellitem?
what is a sellitem?
No
Vault is for handling player economy
Not for interacting with prices
But it's connected to an economy, if I need to get the price I need to hook straight to the sell plugin then?
yeah tbh anybody who gets upset about a main class being called main is a bit weird
Yes hook the sell plugin
Thanks
Nah u gotta call ur main class xxVVE"QAS7869. This is true beauty, if you disagree its a hate crime
inb4 compile error
I can't post in the forum ):
is it bad i only started working on betteritemconfig again earlier dlg
I've had my account for 3 years and it won't let me post in the services & recruitment, could I please post here? 😄
No
you need to post elsewhere to get access there iirc
idc
If you can't post you contact one of the developers offering their services
People who say that it's bad practise don't understand the underlying problem people are trying to warn others about by saying that it's "bad practise". It only is if your FQN is no longer unique, which would mean that your last root-subpackage isn't a unique project-name, which in itself would be total insanity. Other than that, it's completely fine. You're the boss in your own namespace.
u don’t know how many projects I have that are forever “on the back burner”
.
ive got like 1 other project im working on
i just somehow managed to not work on anything
cries in setting up a group dev war plugin project
for 3 days or whatever its been
i dont have these issues
exactly
Wow, you can seriously count yourself lucky. Having so many projects all at once is more of a curse than a blessing.
we dont talk about the things i was gonna make
Let me invoatteeeeeee
Well, I work on things for a month and then ditch them, not any better, is it? xD
it is not
You should get that checked out dude, xD
TaskChain that
fuck you discord
?
yeah
That's not that much, lol
Btw real talk why the ever living hell is not literally every large computational plugin using taskchain
that’s is much
I dont have any, do I?
it's all on JEFF-Media-GbR
I have 74 or something, and I'm depressed af and only work in bursts. 116 is not much for somebody who probably does a lot more than me.
It's called extracting and isolating reusable functionality while also keeping it separate. Why not make use of the free archive service GH offers us? lol
BingeDrinker? Really? LOL
yeah okay 7 lol
it's a blood alcohol calculator
Aight, I've seen enough, I'mma head out
binge drinker is just sth like this
Nah, cool project! :D It's just that I thought it sounded like something completely different. Like a spigot plugin about getting drunk, haha
Oh, okay, xD. No idea of their URL layout, as I'm a discord noob. Thanks for clearing that up.
Daddy/StepSister is my anti piracy library
but named completely intentionally
Alex wdym by “pain to compile”
you literally can’t
like you don’t even have the artifacts anywhere

Who knows how to disable possibility to Push other players
I can move a player from spawnpoint to warzone . How to disable it
Teams.
bois i has generics question.
@Override
public boolean addAll(@NotNull Collection<? extends E> c) {
Preconditions.checkNotNull(c);
Stream<? extends IdentityEntry<E>> stream = c.stream().map(IdentityEntry::new);
return set.addAll(stream.toList());
}
This works, but
@Override
public boolean addAll(@NotNull Collection<? extends E> c) {
Preconditions.checkNotNull(c);
return set.addAll(c.stream().map(IdentityEntry::new).toList());
}
this does not
and idk why
set is a Set<IdentityEntry<E>>
@austere cove I wonder if you wrap the stream & map op with a cast it’ll work?
it’s gotta just be too unspecific most likely
what does the error message say tho?
you are not specific enough with the generics yea
Stream<? extends IdentityEntry<? extends E>> stream = c.stream().map(IdentityEntry::new);
is technically what you are getting
which is not applicable to addAll
yes ik that but I don't have to cast it to Collection<? extends IdentityEntry<E>>
return set.addAll(c.stream().Stream<? extends IdentityEntry<E>>map(IdentityEntry::new).toList()); idk if java has smth like this.
It's just dumb with generics sometimes.
yea
is it possible to create an itemstack that is like a stack (64) of pickaxes or saddles
yes
no
you can just cast the elements up
nvm
@SuppressWarnings("unchecked")
@Override
public boolean addAll(@NotNull Collection<? extends E> c) {
Preconditions.checkNotNull(c);
return set.addAll((Collection<IdentityEntry<E>>) (List<?>) c.stream().map(IdentityEntry::new).toList());
}
mega cursed
that will work won’t it
mfw
tho @austere cove the best way would probably be .map(IdentityEntry<E>::new)
before you go off with a cursed solution
going with return set.addAll(c.stream().map(IdentityEntry<E>::new).toList()); which seems to work
cheers
🥳
mfw i need a concurrent implementation of a set with identity semantics

so the code is cursed anyways 👀
Not even sure what that means, xD But hey, you figured it out! :)
nvm I just found out about Inventory.setMaxStackSize, that is all I need 😄
mfw when people use "mfw": "what the heck does mfw mean"
motherfucker what
verano when we say alex: "yo"
"who pinged me"
mfw means my face when 
I guess it could also be motherfucker what
but I never thought of it as that
how i can fix this? https://paste.md-5.net/uxuhematuj.cs
i tried with chatpgt solutions but none worked and i have no idea what i should do
Can't really help if you don't give the relevant parts of your code
i.e. the kits class (and maybe the item stack builder)
private void generateLevel() {
new BukkitRunnable() {
@Override
public void run() {
cancel(); <-----------------
return; <-----------------
}
}.runTaskTimer(plugin, 1, 1);
}
If I call this method using generateLevel() what will cancel() and return do to the task
#cancel() will cancel the task for future scheduling, return breaks out of the method scope
so return will make the timer run again and cancel() will stop until generateLevel is called?
returns makes code that comes after the cancel isnt being executed
And will cancel() wait until generateLevel() is called again? Like it fully cancels the task/
wdym wait until the method is called again
Like this task in only started when generateLevel() is called
How can I stop the task completely until generateLevel() is called again
Is that what cancel does
?
Every time you call #generateLevel() you schedule a new task
You schedule it on a timer for some reason, but you cancel it on the first run
When I cancel() a task that doesn't mean run again right away right. That's a proper cancel to stop
hello guys, i would like to know if there is a better way to modif config files IG with a gui than writing tons of code like that, thx
yeah i think i'll do this, thx
The concept is called data-mapping, I'd say. You automatically map your section key-value pairs to some sort of controls in a GUI, bidirectionally. But tbh, that question is way too vague. And it's a pain using GUIs to configure plugins anyways, what's so wrong about editing the file itself?
just add an nbt tag that stores the config path and value type (create an enum for your minutes hours thing), then on click just fetch the path and value type and set it accordingly
edit config means i should give consol's permission to my mods and i wouldn't prefer
Also, "".replace(...) does nothing, and you should use the ChatColor class
k i see, thx
Is it better to use scoreboard apis to make them or is it just better to make your own. Personal usage
Then you're either gonna have a lot of repearing code, or you're gonna abstract the devil out of it and build a full blown configurator.
You have multiple data types and controls, it's not going to be a five minute easy solution.
yeah i understand
Depends on what you want to do, and what environment you're in. Any details on that?
kit class and itemstackbuilder
scoreboards suck big time, and not in the good way. I'd use an API like FastBoard or however it's called
Really alex, that bad huh
Not if you're in full control and don't run next to another plugin which also tries to update assigned scoreboard instances. It's fine I guess, but it still obscures what's actually going on. The API is just designed in a way which barely aligns with how people actually think about it.
I'd use FastBoard if I was you
FastBoard the best? alr
FB is the only one I know
This always happens tho
check out the spigotmc resources list
1 sec
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
wtf why doesnt the resource list list XMaterial in that section lol
Wasn't featherboard a thing before
I think that's a plugin, not an API
Still has api
hmmmm could just replace all
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
idk, I never did any custom scoreboard things
Thing is currently already have a plugin doing scoreboard so I need to make sure I can override it
is it, by any chance, TAB?
it is indeed lol
tab also got an API iirc
Technically I could use placeholders instead of direct api hook
sure
Meh tho
Oh wait it does have an api
Man feather board looks so much cooler tho hehehe
just man up and do it yourself ,then it looks as cool as you can get it
My god, yet another "we do it all" bloatware plugin
I mean it really does. but I'll use tab anyways
application specific software >>> feature creeps
tell this to angelchest 🥲
oh CMI deserves to rot in hell
so does songoda
CMI is the only plugin I ever rated 1 star on spigotmc
so true
I don’t want something that can do everything mediocrely
cmi author literally ignored my bug report for over a year, but added a feature request I made within a week
It's as bad as songoda it's actually crazy
@tender shard nice api lol
I guess I gotta use placeholder api instead
here's my bug report btw. nobody can tell me that this report isn't detailled enough ugh https://github.com/Zrips/CMI/issues/6419
By someone who scrapped together a thousand features into a single spaget of a codebase. I'd love to know what I'd run on my server, so I'd have to study the codebase, if it's even available. The time it takes me to wrap my head around crap is probably twice the time it takes me to build something smart and concise myself.
it does work
getIP returns the listening IP
which is 0.0.0.0 or ::1 in 90% of cases
there is no reliable way to get your public internet IP unless you query some website. I usually do it like this: https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/NetUtils.java#L79
even if you could get the output of e.g. ip a, it might just give you your internal IP, e.g. 10.0.0.2 or sth
so yeah you need to do a http request to find it out
that includes dns
alex I was gonna try using your lib but I couldn't go through seeing all I could do I probably did things that your lib can do. I even have it added to pom loll
Hello, I want to make custom mob and I found some guide on spigot. But it's outdated, so I can't extend EntityZombie class. Is here any way how to do it on 1.19.2 spigot api? Ps the guide is: https://www.spigotmc.org/threads/tutorial-creating-custom-entities-with-pathfindergoals.18519/
i put config yml in same place as plugin yml right (resources)
I'm using blockbreakevent for when I break a carrot, it returns the drops, but it always returns only 1 drop, how can I do it?
Okay, but won't it generate lag to check if it's a carrot every time it falls? I want to do this with carrots and potatoes. Imagine that the player has a cactus farm, it won't generate lag for each cactus he drops, does he check if it's a carrot?
I'll check if it's a carrot or a potato and add it to a list
ok it seems having it as a plugin seems to have some issue since if two servers are running the plugin one overrides the other
so what should i do to fix that
Hey, I am currently working on a plugin where the player should see specific stats for him in the scoreboard. First I tried to use the MainScoreboard because I use it in combination with teams, but this didn't work. Now I try to use a NewScoreboard().
What I do:
Get the Scoreboard of the player. If it is equals to the MainScoreboard, I get a NewScoreboard. Then I unregister the old ovjective and save this to the players scoreboard. Now I generate a NewObjective, add all the scores and than save it back to the player.
At the first time it works. The Socreboard is shown to the player. But it never updates.
I already outputted the values and the number is changing I want to display but the scoreboard is not updating.
Anyone any ideas?
Scoreboard score = player.getScoreboard();
if (score.equals(Bukkit.getScoreboardManager().getMainScoreboard()))
score = Bukkit.getScoreboardManager().getNewScoreboard();
Objective objective;
if (score.getObjective("stats") != null) {
score.getObjective("stats").unregister();
}
objective = score.registerNewObjective("stats", "stats", ChatColor.BOLD + "" + ChatColor.GREEN + "Stickfight Stats");
player.setScoreboard(score);
score.getObjectives().forEach(o -> System.out.println(o.getName()));
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
System.out.println(map.getPlayer(player.getUniqueId()).getDeaths());
objective.getScore(ChatColor.BLACK + "+----------------+ ").setScore(7);
objective.getScore(ChatColor.BLACK + " ").setScore(6);
objective.getScore(ChatColor.WHITE + "Map: " + ChatColor.YELLOW + map.getName()).setScore(5);
objective.getScore(ChatColor.BLACK + " ").setScore(4);
objective.getScore(ChatColor.GREEN + "Kills: " + ChatColor.DARK_PURPLE + map.getPlayer(player.getUniqueId()).getKills()).setScore(3);
objective.getScore(ChatColor.RED + "Deaths: " + ChatColor.LIGHT_PURPLE + map.getPlayer(player.getUniqueId()).getDeaths()).setScore(2);
objective.getScore(ChatColor.BLACK + " ").setScore(1);
objective.getScore(ChatColor.BLACK + "+----------------+").setScore(0);
System.out.println("updating");
player.setScoreboard(score);
This is my method
for updating and showing the first time
anyone know how I can plant seeds. I thought I could set air block to seeds but im getting illegal argument exception
java.lang.IllegalArgumentException: Cannot get data for not block BEETROOT_SEEDS
why do I need teams
🤞
hey something totally not spigot related but does someone know hot to make a thread that is like doessnt die. in the end i wanted to use it in spigot so i can put different sections of my plugin in threads
sooooo its not smart?
threads are never safe tho
and i think i still want to try just for the fun of it
exept if its really bad
would you happen to have a documentation?
thx 🙂
no shot
java.lang.IllegalArgumentException: Cannot get data for not block BEETROOT
Beetroot is not beetroots
oh, theres like a million materials. my bad
lets try that again
perfect 🙂 thank you everyone
Depends on what you want to do
im making bungeecord plugin and i want to get instance of bungeecord but idk how should i import it and do it i know from past that there was like
net.md_5.bungee.BungeeCord;
but not anymore in 1.19 so any help myb ?
is there a way to inject invocation handlers into an interface, like using java.lang.reflect.Proxy but on an already existent instance?
like
interface A {
default void hello() { }
}
class B implements A { }
class Injector {
void inject(B b) {
// idk how to do this
// but lets just say here i want to make hello() say Hello World
injectInvocationHandler(...);
}
}
wut
for some reason a "simple event"(trying to debug to figure error) is not getting called.
@EventHandler
public void onTreeBreak(BlockBreakEvent e) {
Player p = e.getPlayer();
p.sendMessage("breaking block");```
the class is registered as an event(it has another event in it, playerInteractEvent which is working fine) but it is not working at all, it's not sending a message when i break a block 😐 idk what to look for anymore, has anyone have had this issue?
Did you mispell "transforming bytecode of already loaded classes"?
no
idk how proxies work but i should theoretically be able to set an invocation handler on an instance right
or is that not how it works
the class is registered as an event(
it has another event in it and works fine
im now separating into 2 classes
unlikely
Yes
Kinda
Unless you wrap your object
Besically you wanna overridde some methods?
But you can't just change the way a method behaves
the event is still not being called even on different class with everything registered fine 😐 my only possibility is if there's another function with the same exact name and that is "corrupting" which class to be called.
Basically when you create a proxy instance it creates an instance with empty methods
You can add a handler which handles method execution
ok ima explain my thought process
i thought that proxies work by telling the jvm to, when a method is called, redirect that call to an InvocationHandler if it is somehow marked as a proxy class
so what i want to do (which seems entirely possible if it works like this, only problem is the protections in place) is set an InvocationHandler on a normal object and mark it as a proxy
does it gen a new class?
with empty methods
But you need to replace your origonal instance with your proxy instance as well as pass the original instance to your handler
hm
Why not just show the whole class as well as the point where you add it to the event handler registry?
Not sure what it does internally but it's pretty much the same effect
Lemme show u an example
that would slow down normal calls a lot tho
sure
Yep
Well I'm not sure
You can test it
A proxy just reroutes all calls to interfaces in it's class[] to a single method you can then intercept. You still have to make the class use it. It's simple with fields, but how are you gonna set a method with reflect?
pm = Bukkit.getPluginManager();
the event is not getting called at all and no error
lowercase class names
Says "the whole classes", gets excerpts again. :(
public class Main {
private static List<String> names = new ArrayList<>();
static {
names.add("Steve");
names.add("Alex");
}
public static void main(String[] args) throws Exception {
names = (List<String>) Proxy.newProxyInstance(List.class.getClassLoader(), new Class[]{List.class}, new ListHandler(names));
names.add("Test");
System.out.println(names);
}
}
whole classes would be too much
public class ListHandler implements InvocationHandler {
private final List<?> list;
public ListHandler(List<?> list) {
this.list = list;
}
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (method.getName().equals("add"))
return false;
return list.getClass().getMethod(method.getName(), method.getParameterTypes()).invoke(list, args);
}
}
@glossy venture
No idea what's wrong with that, my fortune teller's kinda not helping me today.
all this does is disallow the addition of items to a list
the rest of it shouldnt be affecting when the class is being registered, has listener and everything after doesnt matter since first line is not working and plugin is not giving any error.
what are you using proxies for?
the plugin is not giving any error
why would anything after affect when there's no error
also i just realized, return list.getClass().getMethod(method.getName(), method.getParameterTypes()).invoke(list, args); is useless
you can use InvocationHandler.invokeDefault as well
are u updating ur plugin on the server properly ? :d
for default methods
yes since the other class I registered is working
not here tho
return method.invoke(list, args);
can be replaced with this
?paste the entire class
or we cant see much
What do you expect us to tell you? Oh, that's issue #837482, BlockBreakEvent is known for that! You just gotta add some of special #18283 and #21912 and it'll work again.
How the hell are we supposed to know your mistake with that little code. Obviously it doesn't work, so no point in arguing why.
What are you using proxies for?
nah,
basically want to make
public interface MyService {
@ActionCall
default void say(@Param("text") String str) { }
}
LMFAOOO
this ^^
i want to know if the names affect at all
what is @ActionCall?
and then have a method
... void inject(Object service) {
// make say(...) call some action
}
you should just stick to Upper Camel case for classes
annotation which denotes a method wrapping an action call for convenience
No, why would they. Bukkit queries your class' method declarations and saves methods which are annotated by @EventHandler in it's caller list, the name is pretty much irrelevant.
but in theory that shoulnt be a problem
those are the methods id want to proxy
action calls can be remote
so cant just directly call them
Don’t know if this is helpful but I’d check out https://github.com/Moderocky/Mimic
this next best thing
looks promisiing
They do a lot of cool JVM libraries, would check them out if you haven’t already
Mirror, Overlord, Mimic, etc
sick
love fucking around with the jmv
jvm
but dont think this will work either
dont even know if what im trying is possible
need to inject an invocation handler into an instance
not create a new proxy
oh 
I bet you're just facing some cache issue where you don't even execute your new event's code on the server.
show the invokation handler
sad that it doesnt seem people use this
Not many
what you can do is create a proxy with said invocation handler, also pass the instance to the invokation handler so methods that it doesnt handle can be called upon the instance
and then replace the instance with the proxy
yeah but the instance probably wont be an interface
that's fine
no
hm
look
wtf
we are we using proxies again
i sent my example
java.util.List is an interface tho
private static List<String> names = new ArrayList<>();
static {
names.add("Steve");
names.add("Alex");
}
public static void main(String[] args) throws Exception {
names = (List<String>) Proxy.newProxyInstance(List.class.getClassLoader(), new Class[]{List.class}, new ListHandler(names));
names.add("Test");
System.out.println(names);
}
public class ListHandler implements InvocationHandler {
private final List<?> list;
public ListHandler(List<?> list) {
this.list = list;
}
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (method.getName().equals("add"))
return false;
return method.invoke(list, args);
}
}
i mean the wrapped instance doesnt have to be
look at this
yeah ik
wait you mean the class u wanna override is not an interface?
ill just drop the idea not rlly necessary anyways
then proxies won't work
u can use the thing sent above
service.say("gg");
// vs
MyService.ACTION_SAY.call("gg");
Basically what you have to do (read-only, tho) if you want to know if a player's permission changed in interrupt-style without polling yourself. Sad but true, lmao
first is obv nicest
where's the list to replace tho?
won't said list be in the permission plugin?
https://github.com/BlvckBytes/PermissionChangeListener
Not sure if this is cross-version, it was just a hack I did once to achieve something in my personal playground. Thought it'd be worth isolating, as it seemed interesting. You can have a look through, it's very very concise.
So permission plugins need to submit the permissions a player has to bukkit?
nah they can inject a permissible i think
full idea:
public class MyService {
public static final ActionSpec ACTION_SAY = ...;
@ActionCall(action = "say")
public void say(@Param("str")String str) { }
/*
some other shit
this is why i cant use an itf
*/
}
public class ActionManager {
// ...
public <T> T init(T service) {
// proxy all @ActionCall methods to
// call their respective actions
//
// in this case, say(String str) will
// call ACTION_SAY.call(ActionManager, new Object[] { str })
}
}
/* somewhere */ {
MyService service = ...;
actionManager.init(service);
service.say("gg"); // calls the action
}
Of course, as every plugin asks the bukkit API for permissions, not the managing plugin. The PermissibleBase or what it's called calculates permissions for the player, so it's the central point for this kinda information.
ohh
yeah but perm plugins can override it and inject it with reflection
directly into the craftplayer thing
And Bukkit doesn't fire these types of events, no idea why. Somebody missed adding an API again.
i thought permission plugins just told bukkit that i will handle permissions now so bukkit just forwards permission checks to the plugin
As far as I know my implementation also catches that. It worked with LuckPerms, and it did something along those lines. It's already quite old, I don't fully remember.
if u take the already set permissible and wrap it it prob will work
unless its not been set by the plugin yet
I love how weak y'all are.
or the plugin resets it
That's what I do. So you'd just need to load after your permission plugin to proxy the proxy, lol
the perm plugins dont create a proxy right
Just use Objectweb ASM to create a new wrapper class
they just override permissible
"Proxy" was more meant in an abstract way, I have no idea what they do. Good thing I don't need to, as it just worked, xD.
I did, as I worked on virtual furnaces and wanted to instantly stop processing a furnace a player lost permissions to. Like, if a server gave you another instance for a few hours, that would have had no other way of achieving this. I don't want to poll regularly, I want to be interrupted.
what is the purpose of the InventoryHolder interface?
its supposed to represent an object/entity that holds an inventory
but alotta people use it for inventory library stuff
like what
to identify custom inventories
yep
kinda annoying you need to implement it though for creating inventories using bukkit.createinv
or do you
wait I just noticed that humanentity is also an inventory holder
It seems to be the unified way of getting inventories of entities and blocks, so calling it completely useless is maybe a bit harsh. It just has this one inventory getter method in it, that's it.
well sure, I meant that I dont really have to care about what I do for it
as long as it gets something it should work
or do I like for example make the player the holder if they are the one to open it
Oh, when using Bukkit#createInventory you can just leave that at null. But you could also pass a player, as it's already an InventoryHolder.
okay I see
I just never saw a need for that, so I always set it to null.
well i think imma use null since at the time of creating the class that holds the inventory the player isnt there yet in some cases
thanks for the explanation
Inventory#getHolder returns a nullable InventoryHolder, which suggests that an inventory could be "owned" by a player, but don't have to be and may also just be an inventory on it's own.
As I've said, there's no reason to actually set this, as you probably got more than enough handler-logic for how you handle these inventories already and don't at all need this information.
true, may have been a bit of an X/Y question since I am trying to find out why Inventory.setMaxStackSize doesnt work how I want it to
like I am trying to set the size to 100 but it doesnt go higher than 64
but it also goes to 64 on tools and stuff
just not beyonf
but if I set that on teh players inv instead of my gui's inventory, it does seem to work
That's kind of a client-side limitation, I think. The client also limits your max book-pages, for example. There are actual hard-coded limits for some numbers. I still remember that you could stack two 64's of potions in the old days, no idea how this behaviour changed over time tho.
hmm
Oh, it does actually go above 64? lol
yeah
for the player s inventory
but not for the top one
which is where I put i items by code, but before adding each item I am setting max size
I can work around it for now since I just wanted to get stackable tools, but still its kinda annoying it doesnt work the way as advertised
Hey so I was following a tutorial and when I tried to do something with the ItemManager its red but idk how to import whatever it is, because the tutorial doesn't really show:
@Override
public void onEnable() {
super.onEnable();
this.getLogger().log(Level.INFO, "BetterPicks Successfully Loaded!");
ItemManager.init();
this.getServer().getPluginManager().registerEvents(new MultiBreakPickaxeEvent(), this);
im not familiar with any ItemManager
what tutorial are you following
and whats this manager supposed to do
"Creating a Multibreak Pickaxe (Minecraft Spigot Plugin) Tutorial" by SyntaxError , supposedly the ItemManager is supposed to like register an event I made in an item
around 24:01
It has been advertised to go above the max stack size? Didn't know that one! :D
how to i turn on piston duping? in my server
declaration: package: org.bukkit.inventory, interface: Inventory

