#help-development
1 messages ยท Page 76 of 1
I told the gangsta guy that he was a mofo and we got smacking
what is a static keyword used for
how do i do this?
so basically you instigated it then. In other words yes.
It's just the intellij's code suggester idk what to tell you
we were all pricks
maybe so, but at least you were honest about it lol
Can you explain the garbage collector as if I was 5?
we found a girl's backpack and proceeded to wreck everything inside
clued pads to walls type of thing
thts not a beginner question
lmao
when garbage fills up in your kitchen, someone has to empty the trash can so it can hold more objects.
kitchen room
grabbed red markers and drew all over it
future job if java falls off
when earth gets more than 8 billion humans, we need a nuke to collect the garbage
How long it takes for GC to happen depends how large the heap is but allocate too much ram and it becomes inefficient. Analogy for this is, yes you can get a larger garbage can and thus wait longer before having to take it out, but then it becomes more difficult to take it out because it is now heavier. ๐
7smile7 typing an essay here
reminds me of that dude that made a whole thesis on minecraft modding
contents included setting up intellij and making a basic java program
What would be the console output here:
public class TestClass {
private static final TestClass singleton = new TestClass();
public static TestClass get() {
return singleton;
}
static {
System.out.println("ZZZ");
}
private TestClass() {
System.out.println("YYY");
}
public void print() {
System.out.println("XXX");
}
}
public class Main {
public static void main(String[] args) {
TestClass.get().print();
}
}
btw why is a lazy singleton bad
change xyz to 123 to confuse further ๐
Who said that it is?
and change one println to print to confuse further
i heard some guy say that in a server
i always use lazy singletons instead of simple singletons
why not YYY @quaint mantle
or ZZZ
lazy singleton is an actual design patter. It helps with dependency problems but works against the fail fast principle.
It has its place.
talking about lazy singletons...
me
whenever i'm abroad, I pretend that my name is jeff
it ofc isnt
why would ur class be ur name
thats a bad idea
a class is supposed to be named about what it does
ZZZ
YYY
XXX
``` right
mfnalex named his main class like that because his library is called JeffLib
I want to set a trail of blocks where a certain player has walked to a special type, currently I'm doing it via having a listener with a static list that takes in a player and a material, and then have a player move event handler that listens and finds if the player is in the trail list and replace it there.
Is there a better way to do this?
yes
in usual java applications name it Main, or <ProjectName>Main
but
in a bukkit plugin
ur plugin isnt the main software
the class is called JeffLib because it's the "main" class of JeffLib, yes, lol
so it would be
<ProjectName>Plugin
or
<ProjectName>
its not his name
its his project name
This is what I usually do :)
SkyblockPlugin, EconomyPlugin.. etc
his name is jeff, but his project is jefflib
that sounds ass
and i wouldnt name a library like that
its too vague and doesnt explain anything about what it does
nice
though mfnalex prob has his reason for it
and its a matter of opinion for the most part
that sounds good, it doesnt break any naming convention
its really up to you, as long as you follow java naming conventions, and not name your plugin main class "Main"
Any clue guys?
it really is his name
Yes. What does this print?
public static void main(String[] args) {
System.out.println(areEqual(1, 1));
System.out.println(areEqual(10, 10));
System.out.println(areEqual(100, 100));
System.out.println(areEqual(1000, 1000));
}
private static boolean areEqual(int x, int y) {
return Integer.valueOf(x) == Integer.valueOf(y);
}
he just doesn't want to admit it ๐
idk
does == call intValue()
it can only be 0
Alot of false
No
< does
but then its still true
because it holds a constant pool
for the values
i think
Packet<?> packet = new PacketPlayOutWorldParticles(particleEnum, true, (float) location.getX(),
(float) location.getY(), (float) location.getZ(), (float) 0, (float) 255, (float) 0, 0, 0, 0);```
How do I give colour to a particle like REDSTONE? I've seen several spigot posts where they explain it but none of them work, in fact this is something I've seen but the only thing it does is change the distance of the particle not the colour, when in the post it indicates that it changes the colour. 1.9
Dont use packets for particles. Its utterly useless because the spigot api already sends packets in the background.
Tf discord
any idea?
java lang short has it
Heh
PS the result is
true
true
true
false
wrong send
and yes when i tried it it was this
thats weird af
So how do I create particles in 1.8 for example?
Why not Four times false
Beware that the constant pool size is an impl-specific thing
Update to a version that is still supported and use the api. It sends particles as packets.
Though either way the idea behind the constant pool is the same across all impls more or less
That's what I'm currently* doing, I was wondering if there was a way to make some sort of runnable that only stays for the specified time where the user is using the block trail, and do nothing other times
OHH
Just set a boolean for each player and check it in the move event
In 1.8 there is no spawnParticles method, how do I make it work then? I can only think of packets
jvm caches integer values, therefore the numbers from -128 to 127
are the only ones that work
unless u change it with a jvm flag ye
How would that work? Is it like the bukkit runnable that runs in an internval
1.8 is half a decade old and support was dropped years ago. Nobody plays this broken old version besides a handful of kids.
Search in ancient forum posts. This has probably been done.
Update to a newer, still supported version and call spawnParticles
Sure okay, that's what I'm currently doing, I guess I should stick to this then
As someone that has a younger brother that plays that version, I can attest that it is broken
My question is related to 1.8-1.9, there are still people using that version and my plugin is claimed on that version. ๐คทโโ๏ธ
It is rare to see a day where my brother is not complaining about 5-10 second lagspikes while playing on 1.8
thats an issue on his end
just to assure you
i play that version frequently, I never face such issues
Nah, that is just caused by stupid ass GC
At least that is my idea, I never bothered to debug that issue
Then live with the consequences that come with using such an old piece of software.
There are probably some old forum posts that answer your problem.
Sounds like a problem with your pc
Nah, that is how mc is built
Or rather there is something (such as GC) being misconfigured
i play heavily modded packs
Was about to say
this is mostly due to two reasons. First most people don't use optimal jvm arguments or hardware and second they typically use outdated java versions to run 1.8
To be honest mods have always been poorly optimized
have you tried using JVM arguments on the client like you would for the server?
Every Inventory can have multiple viewers
I remember the good ol days where it took half an hour to start a good modpack
how to get main viewer?
who is executing everything?
single player isn't really different from the server. The client just runs a server internally on single player. There is some minor differences with some things but otherwise it is mostly the same
There is no main viewer. Everyone who views the inventory can also click in it.
then what am i supposed to do
lol
huh
have you tried running JVM arguments for the client like you would for the server?
if not try it
might see some improvements ๐
if there is only player in inventory who opened it will this e.getViewers().get(0) return me player who opened inventory?
not necessarily
why
if the one who opened was originally at 0, and another came along and opened and are not at 1, but lets say the first one leaves
that second one that came by is now 0
The anvil inventory does not belong to a player
PlayerInventory is the only class that you can 100% connect to a player
For anvil inventory it is safe-ish to get A player
This is where it might help to implement some protection like stuff and primary reason why protection plugins exist or lock plugins ๐
The anvil could as well be prepared by code. So in the PrepareAnvilEvent you might not even have a player interacting with the inventory.
You need to do some extra checking with InventoryClickEvents.
what are the jvm arguments i shoud use
never missed with that shit before
try out aikar flags on the client ๐
Yeah, aikar works good enough
maybe don't allocate 10GB of ram though, only need like 4GB for the client
Well if you allocate 10gb then you can do some pretty greedy garbage collections
true, but I think that is a bit overkill for the client lmao
yeah might help with mods, needs lots of ram for mods anyways especially if you got like 50-100 of them
-Xms3G -Xmx3G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1
3 is prob enough
I have attempted to shrink the memory requirements and the lowest I could ever get it down to was 5GB minimum
not really
ive got 320 mods
could run it on 2gb if i wanted to
I would love to see this
I have never got a modded client to get even remotely close to loading before crashing or running out of memory
i tried running optifine only in 512mb
and that was just with 100mods
it worked
depends on how heavy ur mods are tbh
optifine isn't a super heavy mod
anyways is this right?
optifine changes the quality of the graphics but uses different methods to do so
like how
remove the end bit of it setting the flag for aikar flags
otherwise the client will complain about it
only works on paper
or if you have the paper api plugin
-Xms3G -Xmx3G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1
this gud?
yep
You are a programmer. Do some programming ๐
Extract a model, write manager classes that keep track of states, listen to events, etc.
i have another idea
Ok, I'm very confused right now. I am currently working on a plugin(I'm very new to plugin creation) that will give custom abilities to predefined Items(These have been created in game already and I am trying to replicate them in the plugin so that I can have the proper trigger for the ability) As of now this is my code and its not working and giving me errors of not knowing what setDisplayName is and that their isnt a super constructor for the private class item(doesn't include the imports or package)
private class item extends PlayerInteractEvent {
final ItemStack item = new ItemStack(Material.SCUTE, 1);
final ItemMeta meta = item.getItemMeta();
meta.setDisplayName();
PlayerInteractEvent(Action RightClickBlock, ItemStack);
}
}```
we want it for the client however

you don't extend events unless you want to add functionality as well as provide a customized event, not what you are looking for
what you want to do instead is actually listen for that event and thus need to create a listener class
Take 2 steps back and tackle the fundamentals. Spigot is not beginner friendly. You should learn at least the very basics of Java before
jumping into plugin development.
?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.
Spigot is a lot more beginner friendly that ~~some ~~ all of the alternatives though
I have done some of the basics of java. Also the reason most of my code is the way that it is is because when I wrote it the way I thought i should have(implementing listeners and such) it was spitting errors at me telling me thats wrong and that it needs to be extends playerinteractevent
I can agree a little bit with this, however those who are relatively new shouldn't be trying to create complex stuff without some kind of understanding of the language XD
I have never heard of this, unless you mean it couldn't find the symbol or import for that event?
It should be something like
public class ClassName implements Listener {
@EventHandler
public void /* did you know that it can be boolean too? (but that is deprecated and should not be used) */ methodName(PlayerInteractEvent event) {
I was pretty confused with a lot of the concepts at the beginning. Like the JavaPlugin class. I had no idea who instantiates it.
Or listeners. I didnt fathom the point of the annotations and i had no idea why the method names where irrelevant. Only after
fully understanding how the classloader worked and how you can reflectively scan for annotated methods, did i understand how spigot works.
in that case, it is a matter of including the api dependency into your project
why would it be a boolean
:o
is it to cancel
Can't really remember
As I am rewriting this(having actually recalled things and reread API docs) it does appear that I was merely putting in my code incorrectly. Thanks all of you for the help.
to know if the event was successful or not
https://github.com/Zedly/Zenchantments/blob/master/Zenchantments/src/main/java/zedly/zenchantments/WatcherArrow.java#L51 Yeah, whether it was processed or not
paper will print a wall of text about this - which is how I found out about this syntax
lol
just open up the implementation at some point or the api
and just look at stuff
be surprised what you might find that exists ๐
the boolean never did anything iirc
you could return anything there
just that it fucked up our optimisations
it did at one point work, and then when it got deprecated then it stop really being maintained, but no one ever really bothered removing it. So yeah it pretty much didn't do anything after that.
Is there documentation on the class loader?
:I
Dig through here
I know how it works
That is working as intended actually
technically there is if you know how class loaders are suppose to work in Java
It uses reflect to scan all the class methods
and if you know that, then all you have to do is look at the implementation
AAAAAAAAAAAAAAAAAAA
?
that statement is wrong as hell. How can you use reflection on something that does not exist?
If the classloader would use reflections... that would be fun.
Let alone scan methods on non-loaded classes
(though there are frameworks that do that)
I mean the event handler
you can create custom class loaders to do this
(but they don't use reflection with reflections)
Not the class loader
I don't know anything about the class loader, that's why I'm asking about docs
but that is loading the class
in a way, just depends what it is you are trying to provide
reflection can let you look at a class without actually loading it well initializing it really
Old Minestom's classloading logic was a treasure trove for understanding class loading for me
Bukkit uses something that scans the registerred classes for methods that have an parameter that extends Event and have the EventHandler annotation, right?
right....
Im waiting a little bit longer for Minestom to mature and then im gonna do a proper project with it.
Thats the sandbox i always wanted.
Im trying to create a Message.yml file, using Spigots YAMLConfiguration.
But im getting a weird result.
https://paste.md-5.net/mafenasefa.cs (both in here hopefuly)
Is there any way to fix it?
Thanks in advance
I might have to look into this at some point
how can i get a world using BlockBreakEvent
For event listening you were indeed right that it uses reflections
I just mismatched the dots and thought that you were referring to class loading there
There was a lil misunderstanding there ๐
well they did ask about docs for the class loader
Several ways. You can get the World from the Block or the Player that broke the Block.
so I mean makes sense to assume
Reflection happens at runtime
would be interesting to have it happen at compile time
Then it wouldn't be 100% dynamic, would it?
Pretty much. And its multithreaded.
And that you have almost nothing to work with
it would be dynamic since it happens before the application loads. Once compiled, it is only as dynamic as it is programmed to be
Which is the No 1 killer for me - especially after they removed Mixin/ASM-transformation support
I readded that myself
still though, minestom likes fucking amazing
Yes, I prefer raw ASM Transformation but for larger things it is a bit unfeasible to work with ClassNodes
until someone complains about "tha knockback"
especially RPG servers
... oh BOY
survival not so much
Minestom has next to no world gen
pathfinding would be easy tho
really not that hard to find a voxel world gen library lol
I think some world gen plugins have been ported to minestom though
there is some decent ones out there that are opensource ๐
Any help with this one
But not too sure
Use utf-8 file encoding in your project. What spigot version are you on?
1.8.8
Ik right
Then update to a newer spigot version and use the latest java version.
Should solve your problems.
But the server 1.8.8?
No update
I mean even then there is nothing to worry about
The file's contents are just as you want
Well then live with fked up configs i suppose. ๐คท
My guess is that your file encoding is the problem.
But why do other plugins work just fine
It just took me far longer than I would like to admit to discover an exception was being eaten in my CompletableFuture making the whole method inoperable.
The classic... i hate the exception blackhole better known as CompletableFuture.
yep, just quietly dies with no warning
Handling them is often so awkward
It was my stupid fault, but I could have saved about 8 hours of debugging if it just told me
you need to escape unicode characters
instead of using the section symbol directly replace it with \u00A7
this should solve your problem
Before I answer, curiously where do you think it is from?
hi
your wife gave u the nickname
i made this on inventory click event:
e.setCancelled(true);
e.getInventory().setItem(e.getSlot(), null);
p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cYou cant change item's name while you are muted!"));
so
imma say its one of the millions different elf like races in any of the games
not quite what I was expecting for you to say. Anyways, my name is of the Norse language and it means Cold Elf or Frost Elf
why isnt it cancelling the click?
close enough
i mean i can grab log
My name is older then that game you refer to
idk what game I am referring to xD
sounds like a dark elf
has some game of thrones vibes idk why
why isnt it cancelling the click???
Dark age of Camelot
is that the game ?
The origins of the Frostalf date back many generations to the time of the twin Svartalfar princes, Hauk and Enar, who, when their parents both died suddenly, were left to determine who should rule. One, and only one, could rule the kingdom, but they did not know which twin was the firstborn and therefore the rightful ruler. Into this situation c...
see an entire wiki page just for me ๐
ignoring level 100
not really lmao
did you register your listener?
doesnt e.setCancelled(); on inventory click event cancells click?
code of sending message is in same listener
?paste
oh hell naw exception blackhole
I always just end up logging all exceptions manually
Quick question. When creating items using ItemStack and ItemMeta how do I have the names have custom colors and formatting?
not entirely if this is the issue or not but can try it anyways, but instead of setting this line here
https://paste.md-5.net/womufipiqe.coffeescript#L408
set it to just only @EventHandler
don't really have time to look over it all, multi-tasking between playing my game and what not ๐
I used the Flow class quite a lot this week. And accidentally black-holing exceptions is hard to avoid in concurrent multi-thread environments
so maybe someone else here will look at it and help XD
I'd take a look but that thing's so nested that it won't fit on my monitor
I'm also busy helping a turkish guy setup mysql through anydesk
ok wait
well seems some people are busy so will have to wait, in the mean time probably can fix the formatting of that class to look cleaner ๐
;//
create a thread in here then and put your issue there
There is no point in attempting to pressure volunteers
hopefully someone sees it, if not, ask again after you have slept or whatever else you have going on
always good to have a nice break from something after having some issues
who knows maybe after some rest and away time from it, you will solve it on your own ๐
cannot cancel event of inventory click event
You are cancelling the event LONG after it has been processed
@EventHandler
public onEvent(Cancellable event) {
invokeLater(() -> event.setCancelled(true));
}
Or variations thereof are always asking for trouble
well they created a thread, maybe good to post it there and they will see an answer when they get back ๐
This means you need to query your database synchronously... If you are lucky your code is structured in a way that it didn't make sense to put it async in the first place
who knows
im here
this is an oversight right, or am I stupid? MaterialData is depreacted, so BlockData#getData should be deprecated too, right? https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/pull-requests/783/overview
I should really sign that damned CLA one day
I just added @Deprecated to BlockState#getData
I just tried to find out for someone why their plugin always enabled legacy data support at runtime
I was like "do you use any deprecated methods"
"no"
yeah, because this fucking method is not deprecated although it returns MaterialData >.<
lol
yes, you should. it only takes like a minute
@tender shard Apologies but could you send me the github to jefflib?
I wanna do a PR.
ty
what are you going to PR? ๐
Sorry to bother. I'm going to repost my question from earlier so it doesn't get lost.
Quick question. When creating items using ItemStack and ItemMeta how do I have the names have custom colors and formatting?
This probably has to do twitch4j but I'm gonna post it here in case its not
I'm having an issue where disabling or reloading my plugin causes a bunch of weird errors to pop up. I'm using twitch4j in my plugin, this is my class used to handle it. The constructor is called when the plugin is enabled and the disconnect method is called with its disabled:
https://mystb.in/IncomeIctTalks
Using the TwitchClient#close() method doesn't cause issues in a normal non-spigot application.
Here are the errors I'm getting:
Four methods: NMS Entity to Base64, Base64 to Bukkit Entity, NMS ItemStack to Mag32, Mag32 to Bukkit ItemStack
Actually I could also add in the NMS Inventory to Base64 (Using the ItemStack to Mag32) and vice-versa.
I suspect that the TwitchClient#close() method is leaving some left over threads which could cause some issues
but it could be something entirely different
anyone has advanced topics to learn about?
doesnt matter if they arent that useful
give me any somewhat-hard-to-understand topic you have
Forge modding :kek:
wave function collapse
i already do that
GUI Creation in forge modding 1.18.2
Collatz Conjecture solution
@tender shard In retrospect I'll do the PR in some time, there's something I need to do first
my bad lol
Custom class loaders
Hey, does someone know how to spawn an armour stand as invisible from the start ? I have this little issue where my armour stand is visible for a fraction of second before it becomes invisible.
Here is my code:
armorStand.setVisible(false);```
ArmorStand armorStand = player.getWorld().spawn(player.getLocation(), ArmorStand.class, stand -> stand.setVisible(false));
That's exactly what I needed, tyvm
Using the UnsafeValues class to mass-transform plugins into malware
so I took at a look at the documentation and while it doesn't specifically state anything about it, but I think you need to leave channels first before disconnecting
this sounds fun
because it is setup the API that is, to reconnect to channels if you disconnect
alright let me try that
makes sense
this is obviously an oversight on their part when the disconnect method is called
that it should remove said user from the channels lol
unless this is intentional then they need to be a bit more clear for the usage of the disconnect method
yeah it should
this is my reload command but for some reason it doesn't reload the config
public class Reload implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (cmd.getName().equalsIgnoreCase("blreload")) {
Iaddon.getInstance().reloadConfig();
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&3Reload complete!"));
}
return true;
}
}
You need to get the new reloaded config to the places where its being used. You also need to get the values out of that new config again.
nice! are you going to serialize it using the entity's compoundtag?
so if i use getConfig() in a class then reload it wont work
have fun with entity to byte[]
also, please don't encode shit in base64 for no reason whatsoever (if you are going forward with that PR)
hmm well the [14:47:28] [OkHttp ConnectionPool/WARN]: A connection to https://id.twitch.tv/ was leaked. Did you forget to close a response body? To see where this was allocated, set the OkHttpClient logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE); is gone, but the "ReadingThread" exception still persists
b64 can be useful if it needs to be encoded
Reloading the config generates a new Object. The old config still contains the old config values. getConfig() will now return a new, updated config.
I#d prefer Entity -> json string and json string -> entity
yes, it can be useful. having a method always return base64 is just trash design
json string 
byte[]
ByteBuffer
that's better
yes
basically ALL entity data is inside its compoundtag
and compoundtag#getAsString returns a json
soooo
I mean, yea spigot has some to snbt methods lined up
iirc for item stack choco has one
but getConfig() isnt getting the new values
to spigot?
anyway, a "kinda" json version of an entity basically holds everything that's needed to serialize a whole entity
If you reloaded the config then it does
but none of my values are working
to serialize entities without nms
even tho it just serialized it to the world file
we got mojang mappings now
yeah
dont remember
prob 5 by now
i started to love NMS
Send your code
i use it for sooo much stuff
stockhold syndrome but in coding:
so item to snbt and back exists
no need to re-do that
at which point, adding inventory to snbt is a pretty meh addition imo
Sorry to bother you, but last question, if I wish to use multiple functions on stand how could I do it?
like stand.setVisible(false) && stand.setGravity(false)
if (config.getStringList("items").contains(namespace)) {
if (
config.getBoolean(namespace.replace(":", "") + ".water-collision")&&
event.getBlock().getLocation().getBlock().isLiquid()
) {
event.setCancelled(true);
MsgUtil.wrongblockconsole(player, namespace, bunder.toString());
MsgUtil.wrongBlockMsg(player);
return;
}
Best you can do is ItemStack[] to String[]
which, everyone can do that with 4 lines
well I mean, NMS was shitty when you had to figure out the obfuscated names in every update. but since mojang mappings exist, it's just "change the mappings"
config is still the old config. You are not updating the field.
player.getWorld().spawn(player.getLocation(), ArmorStand.class, stand -> {
stand.setVisible(false);
stand.setGravity(false);
});
bmup
I see, thank you very much
that error looks like you are replacing the plugin jar file at runtime
well an improvement
I can't really see anything else in the API
are you using the latest version?
all im doing it disabling it right now
yeah
i just copied the maven dependency lines from the api docs
it is interesting though that is complaining in the error about zip file
am i maybe shading it wrong or something?
do you by chance use reload?

does that also happen on server stop ?
lemme check
"disable the plugin" is not a spigot functionality
sounds more like a plugman moment
indeed
technically it is, just no command provided by spigot, but api exists for such things
I still like to make my plugins disable/enable safely
heres my pom.xml
https://mystb.in/DevonPavilionQuoted
not going, am. There's just one concept that I am not 100% sure that it's the most efficient one and I want to make sure lol
Anyways, it does use the NBTComponentTag of the entity ^^
unless we are not looking at main class
can we see that?
Then I found a way to create an entity using NMS, to be applied to a world using WorldServer.add, so the method returns Entity
is this why private static FileConfiguration config = Iaddon.getInstance().getConfig();
yes
noice!
NBTComponentTag
"the thing that PDC wraps"
this is the same thing right?
// if the block should be whitelisted or blacklisted
if (config.getBoolean(namespace.replace(":", "") + ".whitelist"))
// if the block under the placement is in the blocks list
if (config.getStringList(namespace.replace(":", "") + ".blocks").contains(bunder.toString())
|| config.getStringList(namespace.replace(":", "") + ".custom-blocks").contains(custom.getNamespacedID())) {
return;
} else {
event.setCancelled(true);
MsgUtil.wrongblockconsole(player, namespace, bunder.toString());
MsgUtil.wrongBlockMsg(player);
return;
}
// if the block should be whitelisted or blacklisted
if (!config.getBoolean(namespace.replace(":", "") + ".whitelist"))
// if the block under the placement is not in the blocks list
if (!config.getStringList(namespace.replace(":", "") + ".blocks").contains(bunder.toString())
|| !config.getStringList(namespace.replace(":", "") + ".custom-blocks").contains(custom.getNamespacedID())) {
return;
} else {
event.setCancelled(true);
MsgUtil.wrongblockconsole(player, namespace, bunder.toString());
MsgUtil.wrongBlockMsg(player);
return;
}
"the thing"
noone is going to read it one by one
tell us where the difference is except for the new line between the if and the return
๐
looks the same one has ! the other is =
There really should be a universal naming scheme for these things
use your IDE and see where this is called in the implementation. https://github.com/twitch4j/twitch4j/blob/92b05116aa31f7a5513b311206c42a371500926b/client-websocket/src/main/java/com/github/twitch4j/client/websocket/WebsocketConnection.java#L219
Modular Async/Sync/Reactive Twitch API Client / IRC Client - twitch4j/WebsocketConnection.java at 92b05116aa31f7a5513b311206c42a371500926b ยท twitch4j/twitch4j
literally the official namings
if you can't find it called anywhere, then quite possible you might need to call that
xD
okay
Well anyway, please don't force base64 on people
@eternal night can you help me quickly, only takes 30 seconds
beyond that, gl with the PR, md_5 is really keen on nbt in the API
I will DM you on spigotmc
sure
and you just reply to it
Jokes on you, I'm using base32.

:kekw:
okay done, pls reply
got you
because if I am not mistaken, your reply will trigger my DM auto responder
yea I did
It does do that, yeah
I am not looking for plugin support tho
That bug has been around since forever
yeah I just wanted to report this in the forums because it confuses people A LOT
don't tell me that!!
i cant even find where it is lmao
well it needs to somehow disconnect from the websocket but I guess maybe you are suppose to do that?
wouldn't really make sense nor a good api if you are having to do all these extra steps to just simply disconnect XD
i cant even find a WebsocketConnection anywhere in TwitchClient
so it is quite possible then a dependency that twitch4j relies on, is causing issues
which would be neovisionaries
I would probably at this point find something better then twitch4j
or just do it yourself or something lmao
their documentation is like not very helpful or non-existent
mm okay
although i rlly would like to use twitch4j because i did a lot of testing with it in a seperate app already
its also the only async api i found so far
Well I mean you can use it, pull twitch4j into your IDE and maybe you can attempt fixing the dependency on it
odds are you probably just need to update that dependency and it will be fixed XD
mm okay
thanks for ur help ima get back to this later
i tried ```java
if (twitchClient != null) {
twitchClient.getChat().leaveChannel(channelName);
twitchClient.getChat().disconnect();
twitchClient.close();
}
same issue
whatever idk
is twitchClient instanceof AutoCloseable?
no
oh ok
but TwitchClient contains a TwitchChat, which contains a WebsocketConnection which implements AutoCloseable
you should wrap that into another class
Native speakers, do I say A message being added under / below / underneath the description ?
okay thanks :)
what changes would i make tho
plugin.getConfig().set(place, loc);
size++;
plugin.getConfig().set("tailsize", size);
feed.destroy();
plugin.saveConfig();```
Okay so here is the code I am using to store a list of locations in a config file however each location is being set to the same variable each time a new location is added to the file. Any idea how to get it to stop over writing every location stored in the file?
why dont you just use.. well a list?
Looks weird
Can you give some more context to that code?
Locations can't be parsed from a string list and you can't retrieve a list<location> from configs.
Sure, do you want the .jar?
?paste
I've already tried.
Can you give a snippet of code cause when I tried I just got an error.
currently playing a game but willing to help if im done and ur still strugling
Sure, do you want the .jar?
lol
I'll just take a pastebin.
Sure, I think I'm gonna try some other stuff first but if I have to use a list then I would love to see a method of converting a string into a location.
Can't this just be done like saving your location as a string looking something like "WorldName:X:Y:Z:Yaw:Pitch" and then create a String array with contents of that string split by : char, then you have array[0] for name, 1 for X, etc
Thanks
I'll try that.
I think I've done that in the past, though I'm not sure if it is really the best method
but it works
The main problem I was experiencing was that the config would change all saved locations and not just the one referenced.
Like all I'm trying to do is delete a placed block after it has been around for 5 ticks.
is there a way to check if a player is holding a charged bow or an uncharged one
as @iron glade described
public void toLocations(List<String> raw)
{
List<Location> output = new ArrayList<>();
for (String s : raw) {
output.add(toLocation(s));
}
}
public Location toLocation(String raw)
{
String[] spliced = raw.split(":");
UUID world = UUID.fromString(spliced[0]);
double x = Integer.valueOf(spliced[1]);
double y = Integer.valueOf(spliced[2]);
double z = Integer.valueOf(spliced[3]);
return new Location(Bukkit.getWorld(world), x, y, z);
}
you can figure out how to get it from Location to string yourself i trust
Thanks
Quick question. I am currently trying to give blindness to all entities within a radius of a player. I know how to get the nearby entities(player.getNearbyEntities(x,y,z)) What I don't know is how to give those entities the blindness effect. I know how to add the blindness affect to specific players but not how to do this. Can anyone help me?
I found an easier work around. I'm just gonna use a bukkit runable to delay the deleting process and just feed in the blocks location when it is placed.
can I cast JavaPlugin to my main class, even if I am using an API?
.forEach(entity -> entity.addPotionEffect());
Depending on the version you might need to cast to living entity
Im in 1.19
and it said it could not find addPotionEffect in Entity
And well I primarily want the effect to be given to players but I thought it would be easier to just do all entities. Do you know if I could just use p.getNearbyEntities(20,5, 20).forEach(Player -> Player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 30, 10, false, false))
do you only want to get nearby players?
Yeah
player.getWorld().getNearbyPlayers(player.getLocation(), radius).forEach(foundPlayer -> foundPlayer.addPotionEffect());
it doesn't appear to
I was gonna use paper but several things weren't working so I switched back to spigot
damn paper is so nice xD
I have a quick question, is it better to make a local PlayerManager that keeps track of all players on all servers and stores them in a map. This map will contain an object with a uuid, name, rank enum and maybe 1 or 2 settings like message requests and friend requests. Or should I just store all these players in redis. Pros is that it doesn't make DB queries, quicker for players on the server, easier to code as you don't have to worry about async stuff. I can't see it using more than 0.5GB (which I don't mind sacrificing) evem with like 5k players which the server wont have any time soon xD
"playerHandler" ๐
That is helping answer my question :/ On a real it seems like that is personal preference and seeing like im the only dev it makes it more readable
who deleted the screen
I'm using "Manager" suffixes too, dw
i didn't have time to see it but it looked funny
How do you handle restarts with the first option?
how can i pass CommandSender to Player
you mean cast it?
ye
((Player) sender)
just cast it like any other variable
Tbf that is a good point. I didn't think of that, I have the same idea running for servers as it can run on mutliple proxies but max there would only be 10 servers and they don't update as often so incorrect data didn't really matter. Then when it loaded it just read it from the cache. But players would join/leave/change servers update data more often so that's probably not a sustainable way to do it.
Your data needs to be stored hard somewhere at some point
You can make DB async requests + cache some things. That way the players don't see the difference
For example how would I go about someone disabling their messages, as that needs to update asap. But lets say the player is cached and expires every 3 seconds, if it is already cached and someone tries to message them then they can, even though the player messages are off.
If you update the cache when you change the option?
I would say imo that there's no perfect solution to this problem
Code?
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (cmd.getName().equalsIgnoreCase("bledit")) {
if (!(sender instanceof Player)) return true;
editorgui.openEditor((Player) sender);
}
return true;
}
public static void openEditor(Player player) {
Gui gui = Gui.gui()
.title(Component.text("GUI Title!"))
.rows(1)
.create();
GuiItem guiItem = ItemBuilder.from(Material.STONE).asGuiItem(event -> {
event.getWhoClicked().sendMessage("you clicked which means this is working");
});
gui.setItem(4, guiItem);
gui.open(player);
}
NoClassDefFoundError: dev/triumphteam/gui/guis/Gui
Do you use maven or gradle?
maven
did you shade this dependency?
nope
<dependency>
<groupId>dev.triumphteam</groupId>
<artifactId>triumph-gui</artifactId>
<version>3.1.3</version>
</dependency>
you must unless you already have it on your server
How am I meant to handle a dependency of my main class for my interface?
public interface Tps {
DataManager DATA_MANAGER = NeoPerformance.getDataManager();
default double getTPS(NeoPerformance plugin) {
return plugin.getHeartBeat().getUpdatedTPS();
}```
Not entirely sure why that's an interface to begin with
I wasn't really sure the of the application of interfaces, but using it like this made everything a lot more convenient.
If that's your only method, and it's a default method, it should just be a class lol
Looks like it can be a class to me as there is nothing to inherit
Those are all default methods. Yeah. That should really just all be a class
No reason whatsoever for that to be an interface
So whats the main reason to use an interface?
It actually kind of looks like a good candidate for a utility class
Interfaces are a contract that guarantee an instance has a method
List, for instance, is an interface. Regardless of what type of List you're using (whether it be an ArrayList or a Deque), they all have #add()
So if you define a method for an interface in one class can another class use that method?
Sure, so long as you're passing the interface type
thats cool
public interface MyInterface {
public void thisMethodExists(String value);
}
// Somewhere else
public void doSomething(MyInterface foo) {
foo.thisMethodExists("Hello world!");
}```
So now no matter what, any class that implements MyInterface can be passed into that and it's guaranteed to implement that method
and by this you mean @UtilityClass
I think that's a Lombok annotation or something, which would automatically generate that code
But no you can make your own
public final class MyUtility {
private MyUtility() { }
public static void doSomething() {
// Do something
}
}```
is it possible to use special source with java 18
Just means you finalize your class, have a private constructor, and it contains only static methods
and its okay if I pass my plugin instance through the private constructor of that utility class?
You wouldn't be able to because it's private. Utility classes aren't instantiated
Ideally you'd just pull a static instance of your plugin in that class
I'm trying to keep everything DI
None of those methods look like they need an instance of things though. At most, maybe passing in your plugin and DataManager instances
Hence the reason all those methods could be static. None of them rely on instances of things. They just seem like general utilities
default double getTPS(NeoPerformance plugin) {
return plugin.getHeartBeat().getUpdatedTPS();
}```
this needs the heartbeat class to get the tps
Yeah. Though imho that just seems like an unnecessary class because anywhere you have your plugin instance you'd just call plugin.getHeartBeat().getUpdatedTPS() instead of running it through some utility
true
Design patterns like this take some getting used to and you'll get better with them in time
They're a little tough to wrap your head around
Yeah thats why I am trying to learn of them now, I just understood builder patterns yesterday which has helped my code a lot.
Even then, there's more than meets the eye. Builder patterns are generally used in cases of immutability
Sort of. An immutable object can be seen as "read only"
Nothing internally should be changed by its callers
I think the LootTable interface is immutable in Bukkit
Oh right, but you have getters and setters?
LootContext*, sorry, is immutable https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/loot/LootContext.html
You would have getters, no setters. The setters would be done in the builder
(which LootContext has :D)
This is generally speaking by the way. More or less a practice a lot of people will abide by but it's certainly not written in stone
Well I can see why its done, and generally it does make things cleaner
Sorry, tangenting lol
does anyone know if theres a way to make special source work with java 18
If I were to write your class, it would probably be along the lines of this
https://paste.md-5.net/mocejiyiko.java
I'm not sure SpecialSource supports J18 yet
tragic
yo choco, seems like md5 considers the auto-reply to original DM initiator as feature and not as bug D:
i don't think j18 even has any new language features
Nice, thats what my current version is looking like right now
i just want to use simple web server ๐ญ
lightppd
simple = lightpptd
kinda simple and powerful = apache
not simple, halfway powerful but fast = nginx
imho apache is the best balance between powerful, performance and easy to setup
my plan was to embed a web server in my plugin that people could proxy pass to from apache or nginx
like in dynmap for example
oh yeah but no
that might work for a server with less than 1000 requests per minute
its not that complicated i just want to automatically serve a resource pack
oooooh
and the resource pack is built at runtime
yeah then, go for it, use java's builtin webserver
Does anyone know why my code doesnt work?
?paste
Is it possible to detect when a player starts and stops jumping? I need a way to keep running a task as long as a player has the space bar held down
I don't think you'll find anything better than that: https://jd.papermc.io/paper/1.19/com/destroystokyo/paper/event/player/PlayerJumpEvent.html
declaration: package: com.destroystokyo.paper.event.player, class: PlayerJumpEvent
damn
Is it possible to see if the player is holding down right click?
Iโd assume so
declaration: package: org.bukkit.event.player, class: PlayerInteractEvent
Short answer is no
doesn't that only get called when its on a block?
in the air it does nothing right?
Not unless you check for them right clicking at the interval right clicks are sent at by the client when holding
But I'm not sure if that varies (in ticks) with serverside lag
yo redempt I recently stalked redlib and I found out that you do something similar to me with this "getPlugin()" stuff that gets the calling plugin right?
ยซย Represents an event that is called when a player interacts with an object or airย ยป
yeah I think I went a bit too far lmao https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/JeffLib.java#L144
Lol
wtf
I also had trouble myself getting the proper NMSHandler when relocating and obfuscating my stuff so my code to find the proper NMS Handler is equally weird lol https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/JeffLib.java#L262
event.Action.LEFT/RIGHT_click_air/block
okay no need to rub acid in my organs
๐ข
Yeah, who knows where ๐ฅธ
just use a MoveToBLockGoal
tbh i have no idea
Sorry but world can be null, please assert it
Shut up, don't call me that
๐ญ
Not my fault the good thread about signs was old and used legacy materials
people kept complaining about my PR btw
What's pr?
ikr, when I need to do something all the good threads are 5 years old
MaterialData wasn't deprecated tho, was it?
Oh, the old one
there is no "new" MaterialData
But for me it wasn't showing anything
MaterialData was a weird mixture between blockstate and blockdata
That's why you did the pull
imagine using materialdata when you could use recipechoice
whut
ok lol
Imagine using materialdata if you can just play vanilla Minecraft ๐
WTF is that from 1.19 docs?
OMG md5 was right, all of this shit should be deprecated
believe so
I will write a script to PR making everything that uses it deprecated
yea that took me a bit to figure out when i was making custom recipes

i was confused at first because the material data one wasn't deprecated
it was announced for years that stuff like that must be gone
but the class itself is right
even using material IDs is still possible
only a few methods still return material data
yeah but none of those is deprecated
well this one takes material data lol
(at least not in spigot)
:>
i know that lynx is a paper freak, and this is one of the rare cases where I agree with them that it shouldnt even be deprecated, but removed completely
legacy material support is so unneccessary :<
Very strange see a removed thing in spigot 
ViaVersions plugin needs it no?
let's estimate what percentage of plugins with actual support for 1.19 use legacy materials
None of its methods are deprecated because MaterialData itself is deprecated. Any attempt at using MaterialData would display at deprecated anyways so there was no real point in doing it
if it all, I'd vote for the whole material enum to be replaced with sth like in vanilla - a blocks class for blocks, and an items class for items
WIP
nah, it doesn't
yea the function doesn't show as deprecated even though it takes a deprecated parameter
like in intellij or whatever
If you do myBlock.getState().getData().getSomething(), then INtelliJ does NOT mark it as dep
that single PR is worse than papers PR queue
you could avoid ever seeing the horrid strikethrough
I was going to send my image but I'm not verified ๐
so saying "just because the return value is dep makes you know that you shouldnt use it" - nah, thats not true. at least not in intelliJ ๐ฆ
The queue thing remindme check if need rebase again 
๐ญ
so verify yourself ๐
Maybe someday
literally take 2 minutes
When I actually release plugins to public
do you have a spigot account?
I have a few but don't feel like they are what I am right now
see? looks fine in the IDE
inmho getData() should be "strikethourhg" / deprecated
on first glance, it looks "fine"
you literally have to know that MaterialData is dep
Gladly I had alex to assist me, or I would have legacy support on my servers forever ๐
And server lag everytime after a restart ๐ญ
^ this is just NOT GOOD. getData() should be deprecated and have a huge strikethrough in intellij ๐ฅฒ
Block block = null;
ItemStack diamond = new ItemStack(Material.DIAMOND);
ShapedRecipe diamondRecipe = new ShapedRecipe(new NamespacedKey(this, "diamond"), diamond)
.shape(
"bbb",
"b b",
"bbb")
.setIngredient('b', block.getState().getData().getItemType());
alex give that one a try
see if there's any strikethrough anywhere
you know, I'm schrรถdingers spigot dev. I am way better than most people here, but also way worse then the real good coders here lol. I'm a good and bad dev at the same time, depending on your reference point
i feel like im in a similar position
Good or bad you fixed my issue that spigot has, so you're a needed help

whos that sexy beast?
the java compiler also does not throw a warning ๐
md_5 obviously
i know
๐คช
that's why I proposed to mark it deprecated ๐
yeah it's like 10 things in total in bukkit
havent counted but its definitely not too many
fucking shit, I lost my keys
MaterialData was a good attempt at abstracting out byte data pre-1.13
It had a great use
It was incomplete, but yes it worked
I still sometimes wonder, why are somethings BlockState and others are BLockData
arent both basically the same thing?
whats the technical difference?
BlockState = tile entity
BlockData = the states a block can have
e.g. chest[facing=north] is a BlockData
well block state does not have to be a tile entity
the Chest tile entity is a BlockState
but like, block state is the entire block plus any data attached
block data is yea ^
yeah normal blocks also have a blockstate
Normal blocks do have a block state, but it's not necessarily a TileState
TileState is a tile entity, BlockState is kind of just an abstract state, but it doesn't have much in it
well sometimes it just feels weird. a sign can have text and a "direction". although you need the blockdata to get the direction but the state to get the text
Right because there are actually 8 different sign blocks, they're just hidden
Well they are completely different in mojang too
it just feels a bit random but it's probably something to do with how mojang made it
Every individually faced sign is a different block type
There are 6 stone buttons for instance. One on the floor, the wall, and the ceiling, and one for each power state on or off
Those are BlockData

so I have some code that looks like this
but it never actually added anything to the config
can we answer now ?
yes
omg
You have to tell it to copy defaults
my bad
that makes a lot of sense
i knew there was some kind of function like that
thanks guys
don't thank us yet 
๐ญ
declaration: package: org.bukkit.configuration, class: ConfigurationOptions
here even the javadoc link ๐
lmao xD