#help-development
1 messages · Page 958 of 1
good
Anyone has minecraft but plugins which youtubers play?
Random question, totally unrelated to anyone here
How annoying does one have to be to get banned ?
I was interested...
Don't tag random ppl for unrelated stuff
And do not spam this place with your question, read the pinned message from alex
Also, this is not the place to ask for this
quite annoying
cmarco lasted at least a year
oh damn :D
Wait cmarco is banned?
Even paper ? 🤣
no clue
I remember he once for banned for self-bot removing 20k messages and absolutely nuking the logs channel
He is such a meme
Every mod prob just voted in favor of banning him or sumn idk I'm not a mod
I'm a plugin 
B-b-but whos going to make enterprise grade premium plugins for the spigot community???
Spigot has gone downhill ever since our best coder, cmarco was banned
Dont be blasphemous
It just happens to not be profitable :(
or even pay for the cost of making it
I am cooking up a tiny tiny plugin
with a super overengineered uh
thing
I wanna find out why he got banned lmao
no matter that. who is going to leave the extremely detailed reviews on almost all major plugins??
He never really did anything nefarious, was just really really annoying
Im sure he was delusional enough to think he was doing good
I mean
He was leaving 1-2 star reviews on a lot of his competitors
Shitting on them for seemlingly arguable reasons
But then failing to follow his own standards on his own work
And not outlining that
It's predatory
its so funny u go to resources. sort by most downloaded
and 9/10 will have a paragraph from him 😂
I'd rather laugh at mfnalex's drunk videos than meme about cmarco's fucked up attitude
I love that he thought most plugins made him the best dev
Dont think anyone will ever beat inventive talent though
She was fucking amazing
Works for hypixel now
Does it make sense to chache/persist a player in a db and constrain uuids in the db as a foreign key for the cached/persisted players? Basically OfflinePlayer#hasPlayedBefore ig?
She's been there for a few years
P sure she wrote a blog post about using machine learning for prioritizing chat reports
Very likely reports get processed first
Wait, who are you all talking about ?
Oh that's a name...
That makes sense lol
Some people are just super gifted with programming
And also hardworking
And with good timing
I wish I was a lil older rn
Only started actually writing good stuff around 2020/2021
Never wish to be older
Well yeah but my timing's a bit late 
time passes slowly when young, but gets faster and faster as you age
At the same time things developed at the right time
How can I get the block instacne of the inventory player is closing?
@EventHandler
public void onInventoryCloseEvent(InventoryCloseEvent event) {
var inventory = event.getInventory();
if (inventory instanceof CraftingInventory craftingInventory)
{
Block block = ????
handleInventoryClose(craftingInventory);
}
}
uh
but how to get Block reference?
ok I got it
Block block = event.getInventory().getLocation().getBlock();
yes
Returns null when it‘s not opened using a block probably
Well yeah I'm trying to figure out where it's set in nms
the inventory system is messy
hmm, so for example for the Furnace or Anvil I will not get the proper location
Furnace or Anvil you might
But if it's a virtual crafting menu then you get the player's location
I'd still recommend getting the block and checking just in case
or seeing if it has decimals or sumn
but what in case player is arounded by Anvils
Should still be accurate
or just arounded by blocks that have inventory feature
I will try it this case later
If the type is crafting then get the block and see if it's a crafting table
Also see if the location returned is not null and and all the decimals are floored
OR
You can just check with nms
And see if it's a crafting menu and get the access n stuff
Makes sense tho, no? Bc at that point the player IS the crafting table
The player is not the crafting table. The view just isn't linked to any block
So the player's location is returned because it's expected that every crafting menu has a location
is the view even really "linked" at any point? since the crafting table cannot hold the items
Uh
Not really no
the entire getLocation thing is just api
It has no use
Pretty sure it just has to do with uh
Breaking the table
Makes sense tbh
yea ig
Ahhh yes "descriptive" variables
something happened to the font and i dont like it
Do you need to find an item in your inventory?
nope
Explain in more detail what you need 0_o
I've already resolved this issue
ok
1.9 apparently
pretty cool aye
Its too late now...
That is why you do it yourself
idk where to start
Idk if I should put each subcommand in its own method, or in its own class, but if I do that I need to do the same check 30 times
Make everything it's own class. That would be the enterprise way.
Or go the geolykt way and chuck everything in a single method and hope you abandon the project before you loose track of how the megamoth works
Should the class include all the checks or only the code that should be executed if you get past the checks
That being said latter approach probably only works well enough for me as I have quite great memory and thus it takes over a year or more until I forget how a 2k+ LoSC method works
i'm at 699 lines now
If you go the enterprise route: Only the actual code, the checks are each outsourced to their own class and are combined in an interface
oh that is quite bearable
yeah but it's all in the commandexecutor, and some commands have it's own class and others don't
I'll see what I can do i guess but I'm lost in the mess
new spigot pr
the geol method for input command
wtf
i don't even know what it's doing ngl
A lot of ASM
I like my ASM; okay
this looks like the groovy runtime except that groovy is worse
clearly self documenting for future continuation
declaration: package: org.bukkit.inventory, interface: BlockInventoryHolder
get the holder of the inventory 😉
Yeah, I thought the same, but holder in case of CraftingTable was Player, not the Block
well crafting table doesn't have an inventory
the inventory that is opened is technically the player
therefore the holder being player
anyway solution was event.getInventory().getLocation().getBlock()
well as long as that works
yes, there might be case when location is null
wait inventory has a location?
😄
only if the inventory type is specific
or the event really
if you tried to do it from some generic event, you would need to grab the holder
hmm
or attempt to cast to some appropriate inventory type
custom inventories for example XD
yes
when i have a list with 3 items and i remove index 1, will the third item then go into index 1 or is index 1 simply null?
if you have item1 item2 and item3, if you remove item1 item2 becomes 1 and 3 becomes 2
if you want nulls u'd need ur own list impl iirc
ok
Sure, nulls are allowed in lists. You can just set an object at a certain index to null
okay thanks
But when you remove something, by default the list will shrink
why is there no containsindex method :(
Because all indices in a list are 0 to N-1 with N being the amount of elements in that list.
Thats the whole definition of an index
So if a number is bigger or equal to 0 and smaller than N, then its an index of that list.
idk what hes tryna do. but it would work with a plain old array
idk
im working with lists
bool containsIndex = index >= 0 && index < list.size();
probably lol
they should've made it a method 😔
No def not. If you need this method then you are abusing lists.
= looks like a sad face :(
why am i abusing them
im not abusive
Because you are using them for a purpose they where not designed for.
i just dont want to get an indexoutofboundsexception
without always having to write this if statement
No idea what you are doing. Maybe a Map<Integer, X> is more suitable for you?
Wait, did discord change the font for codeblocks?
yes
ye they did
🤨
i need the list tho so i collapses once something is removed
@echo basalt You got some time? I need someone to throw an idea against for a skill system.
some monospaced variant
You mean what is this damn code...
lemme just override --font-code
lemme just hack the webserver and override the font for everyone
Make it comic sans
havent looked at code but it looks awful too
they shouldve used firacode for code snippets
public class Test extends A {}

what font even is it
Source code pro
doesnt look like any of this https://fonts.google.com/specimen/Source+Code+Pro
Are you... using discord from within your browser?
yes
just f12 isn't discord a web app in disguise
Electron
You need to enable it
electron
But yes
Coll you are on the move, right?
sort off, its mostly just api end points for literally everything
i believe you could even extract the full code of it
I just need someone to criticize my approach to a skill system.
ahh way better with monospace, i doubt that overriding css sheets is permanent
extension, chromium based browser
well I mean, its just api end points. The discord app is really just for the visual. Could easily make your own app and have it look however you want, just as long as you send the appropriate payloads to the appropriate end points you are good
Rust discord app when?
i tried making my own discord but that didnt end well
Lets see how it looks with highlighting
public class SkillHolderManager<C> {
private final Map<C, SkillHolder<C>> skillHolders;
public SkillHolderManager() {
this.skillHolders = new HashMap<>();
}
public void addSkillHolder(C caster) {
this.skillHolders.put(caster, new SkillHolder<>());
}
public void removeSkillHolder(C caster) {
this.skillHolders.remove(caster);
}
public SkillHolder<C> getSkillHolder(C caster) {
return this.skillHolders.get(caster);
}
public <T extends SkillTrigger<C>> void triggerSkills(T trigger) {
SkillHolder<C> skillHolder = this.skillHolders.get(trigger.getCaster());
if (skillHolder == null) {
return;
}
skillHolder.triggerSkills(trigger);
}
}
too much reverse engineering
Meh, i whish the generics would be better highlighted
Can’t believe mobile still doesn’t do highlighting
they pretty much publish all the end points in their dev section
cuz i used the gateway api which sends json messages through a socket, i mean the spec is partially specified but its meant for bots
here it is btw
https://github.com/FourteenBrush/fusioncord/tree/main/fusioncord-core/src
I will have to look at it during the weekend
what the fuck is that font
C059
what the fuck is this font
how does it look on desktop
this one is nice
it looks fucking dredful
this is the most horrible font ive ever seen someone use for codng
id rather write in russian than this
ive seen people in college code in such fonts
college mostly teaches you nonsense
only thing they do is oop and they even praise it
oh, mine is loading async
oh god conclure joined, now ill get critcism on that
Really? Our prog teacher flamed oop on a daily basis
whos this conclure your talking about
myuup
good
conclube do you know who this conclure is
i love oop
yea, guy stole my name
blud stole my entire identity
how could he steal your name if you are the conclube
ill always call you doodle bud alex from now on
I dont think you love oop, i think you love structural programming and procedural programming, but not the classic oop programming
meh maybe
one day surely
i used to be the conclure
:(
ok lol
you completely missed what i was going for there
Like, you know, inheritance is cringe, riiight?
yea my brain aint braining
i actually think ingeritance isnt that horrible anymore
It is
i looked at it a bit
maybe you should leave italy
i think you just havent touched anything else
are you in sweeden now
Yea
i touched a lot
are you at home in sweeden
The only time inheritance is good is when u dont have to inherit no state and not a lot of behavior
btw the day you arrived in italy relism left italy
i think hes scared
swedish people on stream always seem to have an amusing voice \👀
Which is like, well you’re at type inheritance at that point
going home?
Damn, i repel him that badly?
yea
plot twist: he drives the taxi
do you remember when you said cat ears
CaskaydiaCove kinda goated ngl
hmm, i dont think I can refer to this one
oh yea
but I cant buy ones on phone
:/
sweedish people saiyng i am the winner in english but with the like sweede accent is funny
bc it sounds like i am de vinner
you should hear that with a german accent
just listen to this guys voice, doesnt it sound amazing?
https://www.youtube.com/watch?v=b5ovU9xeQ7c&t=533s
or i am de wiener
yes
jdh has the best voice ever
it doesnt top PirateSoftware
and the fact that he uses c + vim makes it like 10x better
thor also has an insane voice
he really does
bro is rawdogging gamedev
i mean when looking at code, the first thing i look at is the theme
Do you any of you guys use vim?
nvim
Like religiously
sometimes
i tried once
nah
wdym regiously
primeagen type vim user
always* I mean
yes except for when i can use jetbrains ides in some times
like java and c# are the only exceptions
yeah kotlin has terrible LSPs outside of intellij
i dont see a reason to use vim honestly
and kotlin
Oh fair
Really, do you use numpad stuff instead or?
kotlin my beloved
kotlin suspend fun
i just like to auto generate methods
like getters and setters
for example
minestom people dont seem to like kotlin
intellij has great tooling
WHAT
good.
"K*TLIN"?
a lot of people are biased against kotlin
that also looks like i clicked java but i didnt
mostly those who have not tried it
shoulde been Shitlin
yes
correct
no
qwhat the fuck
thats like pointless :/
not lombok
lmao
do you hate joy as a concept
id rather die than touch kotlin again
wasnt it mfnalex who combined those?
why????????????
what of lombok would be ever necessary in kotlin
"k*tlin"
oh god i remeber having to do kotlin for spigot basics
Idk, maybe stuff like delegate
all those kotlin haters because they've never used it properly
kotlin has delegate as language construct
i did i still hate it
what even is lombok
Oh right
i prefer vanilla stuff its too kinky
annotation based code gen plugin
e.g. @getter to generate getters
💀
ive been looking into it past few days. i find it looks quite nice actually. lots of small things to reduce boilerplate
yes
it saves me a lot of headache when working with java tbh
operator overloading hehe
yessssss
like if (i in 1..30)
The problem with kotlin is that its somewhat too bloated, I mean the language itself isnt bad, but its easily used wrongly, more so often than Java
stuff like that so nice
the thing i love the most is the ability to move lambdas outside of parentheses as last arguments
they make code pretty
kotlinified adventure
return@coroutineScope 🫢
not exacttly sure what you are talking about, could you give an example?
yes i love that
pretty sure u can also do this in kotlin if (foo and bar == "Hi") thats rlly cool too
looks like my font is even more fucked up
oo not sure abt that but if true that's rly cool
this@Player my beloved
ye its agly now
oh my ghod
that return@ is always a bit cheeky
for starters lets say operator overloading, its a good feature but admittedly its very easy to overuse it and make ur code less maintainable if you’re not careful, because suddenly + allocates memory and maybe even dispatches async work. Ofc this is not mutually exclusive to kotlin.
fair point
just dont overruse it 🤓 could say that for every language
Yea, but some languages provide more ergonomic variety making it easier to abuse and misuse
why is ctx.sender as? Player in parentheses?
style choice?
uh dunno most code did intellij convert
@ivory sleet can you learn how to do setup adsense for me
lol
just an old plugin that i converted to kotlin
havent touched the api in probably more than a year
Oh, another google api?

google api docs make me feel extra stupid
they are just stupid
the indexed google link for the docs is outdated and there's a banner leading to a new version
the new version is documented very excessively except for the thing i need
there's some 39 step oauth required
and shit like that
microsoft & hp support pages are worse
only 404s
ive been looking at it for 2 days and i still struggle
pain
what the
reversing google maps api was easier
google maps api is nice, openstreetmap isnt
i didnt even want images
just needed places
hence places api
but for some unknown reason
it refuses to give you any results outside your IP‘s area
the worst part is
you cant experiment with them
cause its so goddamn expensive
1 loop to many
and you gotta sell your house
xd
google apis are ass
docs*
docs are ass
when i was developing for android and trying to actually make a proper app with good code design philipp lackner saved my ass
their docs say so much and convey so little
jetpack compose?
yes
its quite nice, heard it also has a native version now
it is rly nice and quite intuitive
until your async stuff doesnt cause a re-render
when i was trying to understand stuff like dagger hilt and retrofit and mvvm, that's when philipp lackner helped me a lot
and to get the initial hang of jc
used Room?
ill just look for another ad api
sql server thing for android like hibernate
ok i see the pros, what are the cons?
can you give a use case example
could send you the code i wrote in college but its owned by the college team on gh, could see if i can fork it
that i can no longer promote it ( https://catbase.siea.dev/ ) on spigot mc
just like a general use case for room
oo wow that is a good site
its just for working with a db without typing sql manually
bookmarked
ah like for local stuff perhaps?
bc you wouldn't like directly call sql for external stuff you'd use an api?
yay
well actually you kinda had to write sql manually, but there are more checks on it autogenerates code for your statements
you may want to make it more clear what this does lol
this seems useful to store like flatfile h2 esque stuff
damn the repo with my code is private, i dont have any rights on it and i cant transfer it to my main account
i mean ye
i have this listener class that cancels the item drop event but i can still drop items
package me.lars.factoryplugin.Listeners;
import me.lars.factoryplugin.Classes.TemporaryStuff;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDropItemEvent;
public class DropListener implements Listener {
@EventHandler
private void onItemDrop(EntityDropItemEvent e){
e.setCancelled(true);
if (e.getEntityType().equals(EntityType.PLAYER)){
Player p = (Player)e.getEntity();
if(e.getItemDrop().getItemStack().getItemMeta() == null || e.getItemDrop().getItemStack().getItemMeta().getLore() == null) { return;}
if(e.getItemDrop().getItemStack().getItemMeta().getLore().contains("Factory Machine")){
e.setCancelled(true);
TemporaryStuff.rotate(p);
}
}
}
}
does anyone know why?
getServer().getPluginManager().registerEvents(new DropListener(), this);```
i did register it in my main class
simple, it didnt work so i put a cancel at the top to cancel the event to check if my code was even running
try PlayerDropItemEvent
you can use print statements to debug your code
maybe once i find the time if it bothers you so much feel free to push it to github xd
i am NOT a webdev not even close i would break everything probably
i know i just find this easier
i was making a school project with svelte and typescript i almost broke a monitor
(im not either this site has horrible code)
nothing there ill try playerdropevent
that one worked awesome
thanks alot
lemme actually take that back
i'm trying to use nms in my plugin and using buildtools to get a jar to depend on. first I managed to import the classes etc I need, but when I try to compile, I get a cannot access com.mojang.serialization.MapCodec. i tried adding/depending on a few other different things, tried depending on the Spigot/Spigot-API/target/spigot-api-<MC-VERSION>-SNAPSHOT-shaded.jar, and nothing really works. is there a clear thing that I should look for to depend on for everything to work smoothly?
You cant depend on the spigot jar anymore. Has been like this for several versions now.
Use maven for nms.
?nms
took you 1 hour to reconsider lmao
yes
? bootstrap
I hate mobile autocomplete
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
i how to change splash potion tick delay
wdym?
@echo basalt Thanks, my system almost go easier with that...
Generics are fun they said
That function can be a dedicated class
Lmao
You can be deditatet wham my guy

Me every 19 seconds because my glasses are loose
Map of a map just noticed
You can't possibly be serious
Needs more maps
4 closing square brackets
I have no idea what you are doing but I think it's not the best way
Yes
I got a free participation medal for visiting my fav teacher this week
Damn just noticed I never added mr smiley face as a friend o_o I'm giving free tech support to strangers
...
Already split it up ofc
what a shame
it's boring now
So say I have a class here:
abstract class AbstractAchievement<T: PlayerEvent> : Listener {
...
@EventHandler
fun handleEvent(e: T) {
...
}
And I try to make an implementation of the class
class ExampleAchievement : AbstractAchievement<PlayerInteractEvent>() {
...
}
And I try to put it into a registry list, and register them on plugin startup
object AchievementManager {
val achievements: ArrayList<AbstractAchievement<out PlayerEvent>> = arrayListOf(
ExampleAchievement
)
fun registerAchievements() {
for (achievement in achievements) {
Bukkit.getPluginManager().registerEvents(achievement, BasePlugin.instance)
}
}
}
When the server starts up, it claims it can't register the achievements as PlayerEvent doesn't have the static getHandlerList method, which makes sense given the ArrayList the achievements are stored in
That being said, I'm not entirely sure how else to go about this, as I'd rather not have the boilerplate init { Bukkit.getPluginManager().registerEvents(this, BasePlugin.instance) } in every single one of the classes.
did they change the code boxes font
yes
Yeah...
same
same
same
I didn't notice 😉 I wonder why that could be
wow they just added shiki code blocks to regular dicsord
I can turn this off now
oh wait nvm epic lied to me
was it just the font or the coloring too?
for some reason i remember it looking different
Dont create abstract listeners. Constantly registering and unregistering listeners durin runtime is bad practice.
Listen to the event once, and then propagate it to all instances that need the event.
nah seems to be a plugin overriding it
uh i might be confused but since when do listeners need a getHandlerList(), I thought that was for events?
is that discord, i used to have that before they changed all the css class names
The event in the parameter does, and so spigot doesn’t like registering a listener of an event that doesn’t have a handler list
its Vesktop
ah a listener for the event, gotcha
Hm, I’ll take a look at that
Just not entirely sure how I’ll propagate an event to achievements with different event types for each one of them
For example if I have an achievement that wants to listen for PlayerInteractEvent and an achievement that wants to listen for a custom event in my plugin, how would I propagate those out?
map<class, something>? if i think one sec about it
like dispatch behaviour per event class or something
sounds like a pub/sub problem to me
How can I connect with a plugin to a MySQL Databank?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
actually i don't think this is the best way
I've already looked but I don't understand it
Connection connection = DriverManager.getConnection("jdbc:mysql://" + data.getHost() + ":" + data.getPort() + "/" + data.getDatabase(), properties)```
where at properties
Properties properties = new Properties();
properties.setProperty("user", data.getUser());
properties.setProperty("password", data.getPassword());```
and to execute a query you can
try (PreparedStatement statement = connection.prepareStatement(query)) {
request.accept(statement);
} catch (SQLException e) {
e.printStackTrace();
}```
wait how do i use the code blocks?
?codeblock
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
oh it's 3
i would do something like this, please note that i havent used the api in months and my response might not be very accurate ```kt
object EventQueue : Listener {
private val registeredHandlers = mutableMapOf<Klass<out PlayerEvent>, List<AchievementHandler>>
fun register() {
for (subscriberClass, handlers) in registeredHandlers.keys {
Bukkit.getPluginManager().registerEvent(/* i forgot params, something is a Class */) {
handlers.forEach(AchievementHandler::invoke)
}
}
}
}```
And in your achievement::init, call into the subscribe method of the eventbus
and please do this with di rather than BasePlugin.instance
damn downloading Consolas makes the font really look good again
with kotlin i do my database handling like this
fun <R> fetch(query: String, vararg args: String, block: ResultSet.() -> R): R = coroutineScope {
dataSource.connection.use { conn ->
conn.prepareStatement(query).use { statement ->
params.forEachIndexed { index, param -> statement.setObject(index + 1, param) }
return@coroutineScope statement.executeQuery().use { rs -> block(rs) }
}
}
}
which automatically closes everything you need to close and is fancy
thoughts
?
.use(block)
fair
cool, maybe error handling could b better otherwise niceu
and if using jetbrains annotations kt fun <T> fetch(@Language("SQL") query: String)
bruh just don't do error in code problem solved
oo never knew that existed
but i mostly store all queries in a separate file like Queries.kt so idk if that would properly do the check
so many cool jetbrains annotations exist that youve never heard of
gimme your top 3
@ApiStatus.Experimental
@Language
@VisibleForTesting
first and third dont actually do anything
latter tells readers that the access modifier is higher than normal because of testing purposes
i use like 3 annotations ever which are @NotNull, @Nullable and @Contract if I'm felling fancy while documenting
i see
no need for the first two in kotlin
ik
and i barely use contracts, as ij as able to infer most of them
i sometimes do stuff in java because some people that commission me want source code in java
true but it makes me feel cool
anyway i'll go back to doing my hw i've been procrastinating in the middle of it for a long time
hf
i only use @Nullable and assume not mentioning it implicitly means @NotNull
anyways
im scared of setObject due to auto wrapping or whatever its called again
I like TestOnly, CheckReturnValue and Async.Schedule+Execute
is that like InvokeSuper?
gives you this monstrosity
mye
Especially when it’s a lock to my front door and the key is on top of the doormat D:
Since when?????????????
few weeks
Holy fucking fucking shit
Can you possibly find the "done that felt good" cafebabe message that was the ban
I want to read what was happening then
poor dude wanted to show off his ugh ugh coding skills
Elaborate plz
As I'm finishing up my hw
roh
int -> Integer, i forgot how that stuff is called, once looked into a drivers src and i did a switch on the actual type but ye
its a thing you might want to consider
Post question
Just the cross section of a cube
Find the plane defined by MPK
Or plane
Idk what this is called in english lmao
This is just the basics in this stereometry webinar series
have you guys found a way to handle this warning?
I found a way to suppress it. But unsafe casts can never be handled programatically (unless its non-generic and you have the type class)
so suppressing is the only way, thanks
Looks about right
Wrapping yeah
Is that bad though?
depends
boxing/autoboxing is not "bad" if you have a need
ie, you need to support null
what should i do if I see for 1 tick not transformated blockdisplay?
use the spawn method that accepts a consumer
i wanted to make a point that some drivers have a more efficient implementation when you the appropriate setX method directly, but one might argue about that
Isn't it negligible?
it can build up
esp since for instance some Integer instances are cached, so a lot of lookups, and otherwise unnecessary instance method invocations may be present uk underhood
Fair point
Hello, guys. I want to spawn particles that does not shoot out.
player.getWorld().spawnParticle(Particle.END_ROD, player.getLocation(), 10, 0, 0 ,0);```
this one doesnt work
whats like
the easiest workaround for adding custom blocks
is it an itemdisplay? wont that render weird?
yo guys
recourse pack?
Isn't there a thing for disabling a plugin at runtime?
like getPluginManager().disablePlugin() or smth
can't you give textures based on the items pdc?
Not on PDC but on model data
what would happen to all registered listeners and command executors when you disable the thing?
ah, yeah that
they die
Well
They are now parts of plugin manager, aren't they?
hmm
is there any way to put many ByteBufs into one (basically sending a lot of minecraft packets as one)?
items but not blocks
There's a bundle packet
I'm using particles that's why
It ensures everything runs on the same tick
ooh
It also helps due to compression
bruh
i kinda don't get how they die basically
that's the whole pe class
Wrapper
same with nms
ProtocolLib o_o
i mean when event is fired, plugin manager just sends a notification to all listeners which are registered, doesn't it?
no
your packets followed by delimiters
packet events
or when you use disablePlugin, pluginmanager also unregisters all listeners itself?
yes
well, ig it has some good way to store which listener belongs to which plugin
so when you disable it, listeners are not dying cuz of errors, but just get disabled
uh
hi! I have problem with player interact event, because it calls twice, but not always.
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
Block block = event.getClickedBlock();
if (event.getHand() != EquipmentSlot.HAND) {
return;
}
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) {
return;
}
if (block == null) {
return;
}
Location clickedBlockLocation = block.getLocation();
Material blockMaterial = block.getType();
if (!chests.contains(blockMaterial)) {
return;
}
for (ProtectedRegion locationRegion : this.protectionService.getLocationRegions(clickedBlockLocation)) {
Option<House> houseOption = this.houseService.getHouse(locationRegion);
if (houseOption.isEmpty()) {
return;
}
House house = houseOption.get();
Owner owner = house.getOwner().get();
if (owner.getUuid().equals(uuid)) {
return;
}
Option<HouseMember> houseMemberOption = this.houseMemberService.getHouseMember(house, uuid);
if (houseMemberOption.isEmpty()) {
this.notificationAnnouncer.sendMessage(player, this.messageConfiguration.house.permissionToOpenChests); <-- there, message is sending once (good)
event.setUseInteractedBlock(Event.Result.DENY);
return;
}
HouseMember houseMember = houseMemberOption.get();
if (this.houseMemberService.hasPermission(houseMember, HouseMemberPermission.OPEN_CHESTS)) {
return;
}
this.notificationAnnouncer.sendMessage(player, this.messageConfiguration.house.permissionToOpenChests); <-- there, message is sending twice (bad)
event.setUseInteractedBlock(Event.Result.DENY);
}
}
can someone pls help me?
shows no implementations
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
You already check that uh
Another thing I usually do is uh
add a little 200ms cooldown :)
big uhh
after this conditional?
Whenever
sure why not
hmm, i will check it
so I can add delay only to sending message?
I'd add it above the hand check
lez go baby
Basically players by default when hold-clicking an item send a packet every 200ms
yeah but
I might just cave and use protocollib
the inverse
I create a ByteBuf from packets
and send that
since they need to be transformed later anyway by the server
could you
look for this
this is the transforming
but I don't seem to have it for some reason
damn, you have it non obfuscated
so like the listener.handleBundlePacket
does it show you any implementations?
hmm
I'd need to know how it's done in order to write it into a ByteBuf
like what's it's syntax?
Hi
Pretty sure this is client code ngl
is not
are you sure
Sometimes mojang leaves some code like this around in interfaces with no impl
encoder and decoder are almost identical
And this is an interface with no impl
I believe prob responsible for handling incoming Clientbound packets
it needs to have an impl
otherwise it wouldn't work
The impl is on the client not on the server
The server has an interface of this style too
And an impl for it which handles all the received packets
I'm confident that method is leftover client code
what the f-
nope
it needs to have an implementation
in order to be written into a bytebuf
Bundle packets sound pretty special to me
Solid chance that when you queue up a packet it just gets written to a bundle at the end
I need to look into the protocol 1s
The delimiter for a bundle of packets. When received, the client should store every subsequent packet it receives, and wait until another delimiter is received. Once that happens, the client is guaranteed to process every packet in the bundle on the same tick, and the client should stop storing packets. For example, this is used to ensure Spawn Entity and Set Entity Metadata happen on the same tick.
So you send a bundle delimiter
And then you send a shit ton of packets
And then you send another bundle delimiter
Yeah
bullshit
And yeah this bundle packet thing is just a list that's built on the client
And then processed as one packet
The implementation you are looking for is not on the server 💯
which is prob just a for loop in the client impl
Behind the interface
Minecraft does some wacky shit
so there is no way to write many packets into a single bytebuf?
if you spectate the entity you're riding your camera's frozen but you send look packets
Uh no
Stop trying to be network perfect
micro optimizing for you and your 3 players
but I send like a lot lot
Cull the particles
not for me
I've had issues where uh
it's a public plugin
We were sending like 100mbps to each player
solid 16k particles per tick
don't ask
wat
The fix was to cull particles
Basically the whole concept is
If the particle is too far or too close to another particle
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
Block block = event.getClickedBlock();
List<Material> chests = this.pluginConfiguration.chests;
if (event.getHand() != EquipmentSlot.HAND) {
return;
}
this.scheduler.laterSync(() -> {
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) {
return;
}
if (block == null) {
return;
}
player.sendMessage("a");
Location clickedBlockLocation = block.getLocation();
Material blockMaterial = block.getType();
if (!chests.contains(blockMaterial)) {
return;
}
for (ProtectedRegion locationRegion : this.protectionService.getLocationRegions(clickedBlockLocation)) {
Option<House> houseOption = this.houseService.getHouse(locationRegion);
if (houseOption.isEmpty()) {
return;
}
House house = houseOption.get();
Owner owner = house.getOwner().get();
if (owner.getUuid().equals(uuid)) {
return;
}
Option<HouseMember> houseMemberOption = this.houseMemberService.getHouseMember(house, uuid);
if (houseMemberOption.isEmpty()) {
event.setUseInteractedBlock(Event.Result.DENY);
return;
}
HouseMember houseMember = houseMemberOption.get();
if (this.houseMemberService.hasPermission(houseMember, HouseMemberPermission.OPEN_CHESTS)) {
return;
}
this.notificationAnnouncer.sendMessage(player, this.messageConfiguration.house.permissionToOpenChests);
event.setUseInteractedBlock(Event.Result.DENY);
}
}, Duration.ofMillis(200));
}
now It is not working
Does it really need to exist?
That's not what I meant
I said a cooldown not a delay
I've been awake for like 19 hours the caffeine is starting to wear off o_o
I generate a captcha and send it as particles
like this
Anyways the neat solution I came up with to cull particles was to basically segment a block into 16x16x16 or 8x8x8
so I can't remove much
so, what I must to do?
When generating a hashcode for a given particle location
I already experimented
and yes, otherwise it becomes unreadable
A long is 64 bit, 4 for X decimal, 4 for Y decimal, 4 for Z decimal
You have 52 bits left over to lossily encode your X,Y,Z for that given player
iirc it was uh
20 bit for x, 20 bit for z 12 bit for y
You convert your location into that hash for each particle sent to a player and if the hash matches then the particle is too close and shouldn't exist
I don't do the encoding myself
Try it out it has no visual difference
I was intercepting outgoing packets
1s I can find this
whaaat
Yeah it's a hash that downgrades the accuracy of the decimals to a specific offset
I don't get the concept
wonky ass algorithm but you could convert your position to a Long and if 2 longs matched then the locations were within 1/16th of each other
^
@echo basalt sorry for the ping, could you send me an example of a display entity created with model engine?
Model Engine creates its display entities automagically
What you need to do is create an entity (or a modelengine dummy) and apply your model on top of it
It’s essentially a masked model over the entity I created correct?
Do you have an example of some sort of blueprint bone impl
Nope
Erm that’s gonna take a while to figure out
Ty btw
It's literally just a cooldown
ah, this?
no idea what bit magic you do
probably not an issue right now, but you might want to test it with a colorblindness filter if you intend on squashing the characters together more
but my sending looks like this
private static final Object DUMMY = new Object();
private final Cache<UUID, Object> cooldown = CacheBuilder.newBuilder()
.expireAfterWrite(200, TimeUnit.MILLISECONDS)
.build();
@EventHandler
public void onWhatever(PlayerEvent whatever) {
Player player = whatever.getPlayer();
UUID playerId = player.getUniqueId();
if(cooldown.getIfPresent(playerId) != null) {
return;
}
cooldown.put(playerId, DUMMY);
...
}
So from what I could understand, the bones are used for animations?
I was thinking of making it black n' white or at least adding an option like that
Yeah uh
This code is ass if you want to hook with it and stuff
You need to do this filtering before you write the buffer
Basically just remove particles that aren't XYZ blocks away from each other
Yeah this
I don't send any unncessary packets
all of them are really near
I know since it's an image to location transformation
As I said, squash down the decimals into as few bits as possible so that it basically rounds to whatever
ah
The highest number you can represent with 4 bits is 16
So you store the decimal points for each axis in 4 bits
So your decimal gets squashed into a range of 0-15
So your X is 0-15, your Y is 0-15, your Z is 0-15
And if they all match up then they're "close enough"
Illusion did you learn Meg through docs / messing around with impl?
You can store 3 bits instead of 4 and it's 0-7 now. Your precision is half which means the "distance between particles" required doubles
Docs for MEG4 aren't as bad as MEG3
They're just hard to find
as always
thanks, I'll try it out rn
It's a neat thing I thought of while sleep deprived in class
like 2 years ago
And it works well enough
The cool thing is you can do some wonky math
Weirdly enough there are 8 vertices in a cube
The maximum number of particles you can render in a block depends on how many bits you allocate but it ends up as 8 ^ bits
So if you have 3 bits it's 8^3 or 512
If you have 4 bits of precision per axis it's 8^4 or 4096
neato
But whatever more bits for precision means you end up with a smaller range to represent your block's xyz coordinates
If you have too few bits you risk culling the wrong stuff
This is fine as-is
Ah neat, they monospaced code blocks now
A little nicer to read imo
It's awful yuck
ahh, i will try thanks
You'll get used to it. Just like how you got used to Discord's new font that everyone thought was so unbearably bad and they'll never get used to it
It's still awful
You didn't even give it a second thought until I mentioned it :p
I hadn't updated discord yet
Humans really are just adverse to any and all change huh?
No we just get used to good things and then they turn sour
I'm going to bed for a bit
so uh
it got rid of like
10 buffers
Ez
Lower the bits to 3 instead of 4
private static long hash(double x, double y, double z) {
int xPos = (int) x;
int yPos = (int) y;
int zPos = (int) z;
int xIndex = (int) ((x - xPos) * 0xF);
int yIndex = (int) ((y - yPos) * 0xF);
int zIndex = (int) ((z - zPos) * 0xF);
// 22 bits for xPos, zPos
// 8 bits for yPos
// 4 bits for xIndex
// 4 bits for zIndex
// 4 bits for yIndex
long hash = 0;
hash |= xPos & 0x3FFFFF;
hash |= (long) (zPos & 0x3FFFFF) << 22;
hash |= (long) (yPos & 0xFF) << 44;
hash |= (long) (xIndex & 0xF) << 52;
hash |= (long) (zIndex & 0xF) << 56;
hash |= (long) (yIndex & 0xF) << 60;
return hash;
}
what is
wait discord chanegd how code looks
nice
anyways
I don't quiet get this magic
the shifting?
is that what I should change?
Yea ask gpt
* 0xF? That is a bit unusual
Issa feature
== for strings
Hold on, where the hell does this code come from anyways?
wdym
I wrote it 2 years ago
.equals
goddamnit
Dw
damn you java
It's just an intentionally lossy hash
It's deliberate
Anyways we want to replace all the 0xF 4 bit thing with 3 bit
And realign the shifts
I can't bother because I'm in bed
what does that mean?
0xf is 15
so 2^4 - 1
Yeah that's the highest number represented in 4 bits
so I guess 2^3 - 1, being 7?
Yuh
All
got it
Should be enough for half the precision
Try it out it should cull more
is there any other way?
like 4 bits is reducing of em
and 3 bits makes it harder to read
There's no 3.5 bits
dam
like I said, I have no idea what is happening here
I've heard of stuff that actually allow fractional bits. Though I suppose it isn't for hashing
Quantum spooky
Your shift can be any number between 0 and 15
That represents the number of "sections" per axis in a given block
More sections = more particles
12 is a good attempt
will try rn
how can i get like the prestation of the server with a command?
Wut
like i want to see the usage of the cpu the ram etc
well that makes more sense
Spark?
Hello, who want help
i want make it and i want only 1 command
When I set EntityExplodeEvent yeld to 100, explosion is as it should by default...
it's somehow the worst of them all
Rip
it's now 1/4th and there's barely anything
Make a command and test em all
