#dev-general
1 messages · Page 37 of 1
you can get to the paper's via their website
you will have to loop over the list then call Block.getType()
what are you actually trying to do?
Stop specific blocks from exploding, i figured out a way
Hi, how I can create large tablist in my plugin ?
you loop blocklist, then if they match your requirements just remove them from said list
using list index is probs the easiest way to do so
in what way?
They want to get the block material that caused the explosion
But you might be able to use block list and compare the Location with BlockExplodeEvent#getBlock
I what create tablist like bungeetablistplus plugin with information on tablist
ah, then you would send a bunch of dummy player tab list data to the client
using packets
protocollib, packetevents or good old nms can do it
you could also look at bungeetablistplus's source and find out what they do
tho id assume the exact same thing that i said
Stop specific blocks from exploding, i figured out a way sounds more like they wanna prevent certain block types from exploding, rather then preventing the block that caused the explosion from exploding
They might mean like stopping beds from exploding
Idk but either way
He found a solution 🤷
Hopefully it uses blocklist()
And not some hacky method
¯_(ツ)_/¯
okay, I try, thanks for help
well beds still come under what i saidd
bed is a block type
its just a material with directional data
Not all beds though
Only if it was the one being exploded
I think
thats still exactly what i said
Then I guess I clarified 🤷♂️
from what i could tell, they wanted to prevent certain blocks from being removed in the radius of the explosion, not prevent the block that caused said explosion from being removed, which is what your message sounded like
He didn't really clarify which
Yes, that was what my message intended
Either way, once again, he got his solution (which he didn't post ☹️)
fair
would be nice to have clarification if they said exploded by or was use to explode, like if they wanted to prevent certain blocks from being exploded in the explosion blast radius or wanted the block that caused the explosion to not be destroyed during said explosion, like beds in the nether or primed tnt exploding
their message was a tad vague
such fun
Yeah
Also I forgot that beds only explode in the nether so hopefully I didn't cause further confusion 🥲
(also minor note but primed tnt is an entity, confused me for a bit but makes sense)
So, does TNT trigger the BlockExplodeEvent tho?
I don't think so
On phone so can't really check
Since it turns into a primed tnt entity
tnt blocks are deleted and converted into a primed tnt entity, so probably not
but the primed tnt would trigger the event since its blocks being exploded event, rather then Block that caused explosion event
💣 🧨
🛫
🛬
🛫
(╯°□°)╯︵ ┻━┻
I mean im trying to stop the explosion from happening, if the reason for the explosion is something specific
and i found a way by watching the interact event
classic
lmao i saw this
in showcase
very embrassing
just checking for strings
so if my resource is not leaked
but contans
cracked
LOL
it will flag
actually when i think about it t here no other way
for resources they u r not familier with their stracture
how ever
useless resource.
Not exactly useless, we use a similar thing here for Barry's automated resposnes to common issues
If barry scans a paste/error and sees something he knows, he'll respond
Similar to how that showcase works I'd imagine
name your plugin CrackedEggs
Flagged yes, as long as it's not automatic punishment that is fine
A very common false flag we get is CRACKED_STONE_BRICKS for example
@past eagle hey, how do you manage to change the skin here? #showcase message
I thought the skin had to be signed by mojang
hey, is a support of kyori minimessage is planned?
I'm pretty sure the answer is no but you can ask in #general-plugins or #1007620980627230730 and specify which plugin
yeah but it cost me nothing to ask, thanks i'll post it there
MineSkinAPI + SkinsRestorer, along with MojangAPI usage
I knew it SkinRestorer
For applying the skin, yes, and MineSkin to generate the actual signature and texture
The process to actually generate the manipulated image is still much more different than just applying a skin, so the system itself basically puts everything together (set-up overlays), creates the full skin png, generates signature+texture based off the manipulated skin png image and lastly applies it using SkinsRestorer to avoid having to re-log to see the skin-changes 
I was afraid you would say that
Don't you abuse the API doing this?
Not by much honestly, haven't ran into an issue, although I am definitely planning to set-up soon enough a better caching system so it directly applies the same skins from the cache instead of using the api all over again to generate the skin from zero
I think the API pool isn't really that large
So if this were to be pushed into a real plugin I think it would probably overload it
There's already around 7-8 users now of this system along with other private servers using the exact same system for their skin generation, hence why I'll definitely set-up the caching to avoid future overload issues from it
Could always setup a usage limit as well so it doesn't allow usage abuse
Does anyone know whether there’s a direct way to make NPCs only visible to the user that created them? Or something such sort
can anyone write me the proper code line for reducing the default armor stats ( for example: iron armor be reduced to half of its effectiveness ) PLEASE and thank you.
feel free to @ me
Send the packets only to that player
ItemMeta#setAttribute or something like this
sorry.... i meant like the whole .json explanation
What json? Are you making a data pack?
This channel wont be very useful for data packs
i assumed i would need to make a datapack in order to drop the attributes of all armors and make that the new default for my server
also where would i be able to talk to people about this
Hello how can i parse this as console PlaceholderAPI.setPlaceholders(null, "%%bungee_total%% oyuncuyu")
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), PlaceholderAPI.setPlaceholders(null, "<command>"));
you just do null
I'm pretty sure it accepts a nullable OfflinePlayer
i did (Player) null
idk what the problem even to return to any player same value then
really no reason thing to do
I have a custom enchantment, glow. It's sole purpose, as you can imagine, is just to make an item glow. Before the item is added, the enchantment is applied, however, after it is added the enchantment is removed. Any idea why?
player.getInventory().addItem(ITEM);
System.out.println(ITEM);
for (ItemStack i : player.getInventory().getContents())
if (i != null)
System.out.println(i);
[11:43:44 INFO]: ItemStack{DIAMOND_SWORD x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, enchants={glow=1}}}
[11:43:44 INFO]: ItemStack{DIAMOND_SWORD x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC}}
how you apply it... (enchantment)
Does anyone know the proper name for using a like queue/tracking based push system for database writes?
Like when you save a changes in-memory and bulk-writing/saving to DB on a timer etc?
Batching?
Using ITEM.addEnchantment(Enchantment.GLOW, 1);
Try adding it to the itemmeta
@final scroll show the whole code. There shouldn't be a reason based on that code the enchant gets removed.
I meant more the design/ strategy thing
Yeah I mean I would call that a batching strategy
Computerized batch processing is a method of running software programs called jobs in batches automatically. While users are required to submit the jobs, no other interaction by the user is required to process the batch. Batches may automatically be run at scheduled times as well as being run contingent on the availability of computer resources.
@blissful sluice
Ig it's just because of the terminology/language being so different from what I'd expect it sounds off
i mean yeah idk, that's just what I'd call it in general lol, doing jobs in batches as opposed to individually
This is all really, there has to be some event that's affecting it I assume? But I can't think of what that can be though.
public class TEST extends AbstractCommand {
private static final ItemStack ITEM;
static {
ITEM = new ItemStack(Material.DIAMOND_SWORD);
ITEM.addUnsafeEnchantment(Enchantment.GLOW, 1);
}
@Override
public void call(CommandSender sender, String[] args, CommandSendEvent event) {
((Player) sender).getInventory().addItem(ITEM);
System.out.println(ITEM);
for (ItemStack i : ((Player) sender).getInventory().getContents())
if (i != null)
System.out.println(i);
}
}
I found the terms write-through and write-behind caching, the latter seems to match
I mean, in the specific context of databases, I think most engines now use Write-Ahead-Logs, which is like the other half of doing that lol
Hmmm. Yeah try itemmeta
I also have an ItemFactory class where I do this:```java
for (Entry<Enchantment, Integer> e : enchantments.getEnchantments().entrySet())
m.addEnchant(e.getKey(), e.getValue(), true);
Same result
ItemMeta meta = ITEM.getItemMeta();
meta.addUnsafeEnchantment(<glow>);
ITEM.setItemMeta(meta);
```Or something similar.
That does not exist, ItemStack#addUnsafeEnchantment calls ItemMeta#addEnchant(Enchantment, int, boolean)
Yeah not on PC so can't check the code. I wonder if the final modifier is causing an issue...
I doubt it, as the enchantment is applied to the meta it should be fine. Also neither ItemStack or ItemMeta are immutable
I can try
Noop, no difference
I guess there must be a Listener causing some trouble somewhere
Yeah. I'm not seeming to be able to replicate it removing the enchant.
public class BaseCommand implements CommandExecutor {
public static ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
static {
sword.addUnsafeEnchantment(Core.glow, 1);
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (cmd.getName().equalsIgnoreCase("test")) {
if (!(sender instanceof Player p))
return true;
p.getInventory().addItem(sword);
return true;
}
return false;
}
}
I'll have to find the one Listener in my pl causing this then. I hope I'll be done before new years, wish me luck lol. Thanks for your help!
Could just disable your listeners 1 by 1 and if you only have one listener then do it by events.
I could, if I knew where they all were lol. I'm too lazy to initialize them manually, so I do it via reflections when the plugin boots. So I have to find all the Listeners first lol
... hmmm well let me know if you find the issue.
ctrl shift f "implements Listener"? 🥴
that sounds terrible
Guys i need help So i got cutom sharpness 12 sword that i enchanted with essentials it does the same damage like sharpness 5 sword? How and why?
I have these plugins is any of them blocking the sharpness 12 or something?
oh cant upload image here
unsafe-enchantments in EssX config
They are enabled but still they work like normal max ones
which is weird
post the image to imgur
also post an image of the item itself
actually, #general-plugins or #minecraft
continue there
it doesnt look like sharpness has a damage cap
who can help me with one easy config?
don't ask to ask
just post the exact issue so others can see it and help, that way we don't have to back and forth a bunch
Eclipse :p
stop using eclipse, use intellij ;3
I'm way too used to Eclipse, it works well for me. The only problem is some small inconveniences every now and then :>
find god
💀
I can code in it, it's fine lol :)
I can't miss what I don't know exists. I didn't know you could search like that in Intellij, so I'm not missing it heh
crtl+h on the project
convinced some of you are legit masochists
man I have to use eclipse at work to edit some internal tool BECAUSE IT DOESN'T USE A BUILT TOOL AND THEY HAVE EXAMPLES ONLY FOR ECLIPSE and I hate every second spent in it
You can use intellij artifacts... If your work lets you
Actually it's prob better to just use eclipse
yeah idk, the project is so weird, ive tried to import it in IJ but it didn't recognise the libraries and shit so I quit
I might try again though, using eclipse is not good for my mental health 
Idk why everyone hates Eclipse, it works fine imo :)
it works fine until you open the code in IntelliJ and every line has a warning
xd
I've seen it so many times, you can tell from the code quality whenever someone was using eclipse
if you want to write minecraft plugins, java would be the best I guess
Only Javascript?
How about Kotlin?
Kotlin works, but most guides and forums and whatnot will be Java
I already learned Html and css, I think I want to further my knowledge to make plugins.
Facts, I hate a co-worker that refused to use IJ and the code was full of warnings, from spelling errors to unnecessary code/conditions 
html and css don't really help you there
I'd say go Java, but if you really want kotlin works
No, I mean I learned about website development..
I'd say Kotlin is actually more difficult than Java, but easier than Scala
Java and JavaScript are not the same thing/similar, it is easy for a beginner to mix up the both (or for a recruiter
)
Can I use C+ or C++ to make plugins?
Java or other JVM languages (idk how, I've only used Kotlin besides Java)
I am confused, what you mean by other JVM languages
In theory: yes. Is it practical: no, not at all. You'd make your life very terrible
Ywell, can you explain what JVM is?
Sorry.. I am beginner D:
JVM languages are languages than can be run by the JVM, i.e., they can be compiled to Java bytecode. This includes languages like Java, Kotlin, Scala, Clojure and more
the JVM (=Java Virtual Machine) "understands" java bytecode and can execute it then
Should I use Linux to learn Java?
no, you can develop with Java on windows just fine
This but unironically
It’s kinda the equivalent of an artist using ms paint
Sure it works, but it’s limiting you and indicates you’re not super serious about the projects you make
Also this is more subjective but eclipse UI is fugly
Exactly
I can barelly tell they are still updating eclipse 
The flat IJ ui is not so bad
I like that gradient at the top and other things
Fr, fresh out of 2004
Yeah vanilla IJ is decent, and then you add plugins and it becomes 10000x better
What plugins do you use? I only got material theme and atom icons
Talking ab icons, I hate how most stuff are flat / minimalistic in comparison to the original ui, yet the buttons at the top are so fucking big (like run, build) and why is there one for plugins in the main ui??
yeah just those two really lol

Rainbow Brackets is nice
oh yeah that ones good too
Github Copilot too
and then Minecraft Development makes developing plugins / mods far quicker
how so?
It only creates the base project
nothing else
And it still does not support gradle kotlin DSL 
it has support for some Mixin stuff along with NBT data, and it can do MCP mappings
Well yeah, that has nothing to do with plugins
yeah, I meant just minecraft in general
y'all speaking about eclipse & intellij? I use netbeans at school, ngl quite like it in someways...
IJ plugins I personally use:
- CodeGlance Pro
- Copilot
- Rainbow Brackets
- Statistic
- String Manipulation
- Key Promoter X
after an eternity of figuring out why passkeys did not work on my (android - samsung) phone (the "setup passkey" button just didn't do anything but freeze the screen for a split second), I figured it out
Google Chrome had to be installed 🥲
you don't even have to set up chrome or anything
it just needs to be there
welp
just gonna leave this here in case someone else has chrome uninstalled
don't know why that's a requirement though
What the hell is string manipulation
And codeglance pro
codeglance basically gives you the same minimap vscode does
string manipulation gives you a variety of options for selected text:
Damnnn that's so nice
What about key promoter X?
if you click a thing manually with your mouse, such as 'build', if there's a keybind for it, it shows you what you could've pressed instead
though it sadly only promotes the stuff that is easy to do with your mouse anyway. The really powerful things can't be really promoted because there's no equivalent operation
But IntelliJ has the Productivity Guide where you can see which feature you're using how much (and which one you don't!)
this is what it looks like
well, remembering a shortcut is still faster than navigating with your mouse
yeah but for example syntax aware selection is what really speeds up your coding (at least for me)
no, it's more powerful than that
here's a quick example how it extends the selection depending on the syntactical structure
yeah, I'm aware of that, been using this a lot lot
It's probably one of my favorite features together with Alt + J
another cool IJ thing is CTRL + Right click
(though maybe that's rainbow brackets feature, I'm not sure)
That's actually so nice wtf
I feel like I'm not using any of the features that intellij or my plugins have
is there a way to hide that selection?
esc
What are some other plugins you would recommend other than the ones previously mentioned
usually depends what you need or like, other ones I use is jsondiff, One Dark Theme, Grep Console, SonarLint, CSV Editor, Extra ToolWindow Colorful Icons
What does it do? I assume the commit message is from another plugin
default git plugin
What's that
yeah I was talking about the commit message lol
it makes progress bars nyan cat
I meant to reply to gab
Ohh I used to have that
I think I know you from somewhere
Are you ehh
Argentinian?
eyeah
I think I unfortunately remember you
double totalChances = droptable.values().stream().mapToDouble(Double::doubleValue).sum();
double randomChance = new Random().nextDouble() * totalChances;
double currentSum = 0;
DropItem closestItem = null;
double minDifference = Double.MAX_VALUE;
for (Map.Entry<DropItem, Double> entry : droptable.entrySet()) {
currentSum += entry.getValue();
double difference = Math.abs(randomChance - currentSum);
if (difference < minDifference) {
closestItem = entry.getKey();
minDifference = difference;
}
}
return closestItem;
}
i feel like it doesnt work currectly
What doesn't work
I feel like she doesn't love me.
now, any good person would ask "why doesn't she love you?" or "why do you feel that?"
anyways, be specific xd, a lot can not work
Yeah and what does it do?
I hope you're not really creating a new random instance whenever you call that code
id assume converting a drop table into something you can actually use a random value to get from
converting the chances into like a stacking value composition,
you end up with values like
0.5
0.8
1
and youd going through the list from lowest chance to highest chance and seeing if the random value is bigger
the values would only be different then their chances if theres more or less then 100% chance total for all items in said drop table
doing the composition that way means you dont have to input a single value between 0 and 1 and end up getting something from the droptable list
uhm random question, what's a good framework/library to use for a very fast rest api? In terms of latency, requests per second, etc. Performance in general
that's extremely hard to tell and depending on where the data comes from, the framework might not even matter at all
well when screen-sharing with colleagues, it's easier to mark the block of code you're refering to
than saying 'uh yeah it's the if statement at the line 175 and the end at 189'
not a big life-saver but still
Like it does work
But I feel that I wrote the code not in right way
Since the chances seem not work
Like low chance items appear pretty often
Which is weird
I call it couple of times only …
yeah every time you call that code
Well yeah
But still it doesn’t work as I plan it on paper
Like not really paper as it was in my head lol
I don't know what you're trying to achieve
but you should reuse a random instance
or just use ThreadLocalRandom
also, you probably want to check out https://stackoverflow.com/a/6409791/7137402
I see
Hmm maybe I’ll change not to be really random
What do u think about it
Let’s say we have a lootFactory which uses the sum and just pushes next number every time that way
I’ll make map that stacks the num of each item
As time when it should appear and then
Random won’t be random
Like random doesn’t exist it probably uses system time or something
To return me a diff num every time
😂
what
{a2,b4,c6} a=2 b=6 c=12
just use the stackoverflow code smh
Technically, going to make a request to another api and parse it, so that alone takes around 100ms and I am gonna use redis for caching for the auth keys
Just saying, if you need fast data access don't use rest apis?
Imo the fastest json file served wouldn't be much faster using Rust than Scratch
there's no other option, I am doing something similar to analyse (not metrics though), the mc plugin communicates and sends data to my webserver... and since it's public, using websockets or whatever is not an option.
kinda going to have to handle a lot of requests per second though
Why are websockets not an option
it's for a public project and to my knowledge websockets require extra setup and well, shouldn't be used for these things?
it's not for private use.
- it requires for the user to open a port
so, yeah, unsure what other options I have
have you tested any yet?
I feel like popular rest apis really shouldn't have any noticeable overhead
even if it does take like >1ms, if it's a large library it probably has taken performance into account, so latency should be like 99% uncontrollable by the server software
I haven't made a rest api in java before 🥲 so I can't really say much
having an http server also requires opening a port
from the user perspective, the amount of setup should be the same, if not less for using a websocket
not if you're hosting the web server and the clients just have to send the data lol
keeping websocket sessions open is a pain, it's not really worth the overhead
just use any rest api framework, it basically doesn't matter, you'll be constrained by data storage no matter what
@pastel imp Tebex for example, which has pretty quick execution, just sends a GET requests every 10 seconds
good old polling
the user doesn't require opening a port, they only send requests to a webserver, they don't receive any nor host a server.
the plugin sends the request to tebex or the other way?
then you don't need a port for websockets either
only the server of the websocket needs the port open
but aren't websockets tricky to keep open + "less secure"? Not that educated in websocket tbh
don't they require some type of password/auth?
there's wss:// instead of ws:// - websocket secure which I assume is similar to http and https
as for tricky to keep open, that's what Spooky Star said, I asked wdym but got no response 🥲 so I'm not really sure on that either
but password/auth is not required
afaik
I can still have some type of api key though right?
websockets are prone to just shitting themselves
is that even a lot?
I assume star has more experience though so take this into account, even if he didn't explain further 🥲
so having an instance just send a request every 10 seconds and split the requests onto multiple instances via a loadbalancer, you should be good to go
that's low balling it and assuming it doesn't get popular, it can easily got to the thousands per second if it blows up lmao
how about you first tell us for what exactly you need all those requests
sadly can't do this in theory, I mean, I can for the not "real-time" mode of the service, but for the real-time mode, a request needs to be sent on every message sent in the chat. Sending the requests on bulk would only work for "Assistance Mode"
for every message?
sending a request for each message sounds like a bad idea?
well I guess that answers your question
it is a bad idea
yeah not exactly
why is it a bad idea?
why do you need a request for every message?
depending on the usecase
metrics
actually no
no that would be too stupid
just send the data every x seconds or when it reaches a certain threshold and that should be fine 
I said analyse as an example since they are similar in the way it works, but working on an AI Moderation system/assistance. For the assistance mode, this would be fine, to send in bulk every few seconds, but for real-time, each message would have to be checked asap and return a response to know if the message should be sent in chat or not. from what I have seen it would delay messages around 80-140ms which isn't that noticeable.
^^
o is this gonna be a public plugin?
it's a tricky challange, since you have to find the middle ground for UX and at the same time not blow up my webserver lol
more like service, similar to analyse or craftbench.ai (formely Minevision).
but it's not going to be solely minecraft focused.
having it wait to send the message is not a good idea
it should just check messages async after they're sent and remove them if they're not allowed
yeah
if your service goes down for whatever reason, people just won't be able to send messages anymore
u can remove signed messages
yeah well, you did not mention this part, you said "analyse" which simply accepts post requests with data 
theres a packet
good point.
most servers don't do signed messages
true-
true
either way, "real-time" mode would be impossible in that case
moral of the story, literally any good REST api framework will be able to handle thousands of requests a second easily with a fair bit of resources
Django, FastAPI, Laravel, Spring, ASP.NET, anything
i believe the bottleneck would become the moderation ai 
that part is covered, working quite decently
cool
if you're really worried, write it in Rust or something lol, that shit'll be lightning
fast++
xD
hell that reminds me of that one time like 3-4 years ago where people were using skript as a backend 💀
can you please throw thousands of messages at it and send the results here?
where would I get thousands of messages xD
random generator bruh?
what has that anything to do with rust 
you have a dictionary and a brain that can do programmer things
oh nothing, just popped in my mind suddenly while speaking about backends
from the data you used to train it 
good point
mmmm overfitting
true
I mean, it still sucks in a few things
fking mod
(auto mod didn't let me send the msg)
so lets see if it shits itself
like it doesn't really recognize "noob" or the 3 letters used to tell someone to yeah, RIP
but it does handle stuff like
"shit, you are right"
doing pretty good, I see
ping me when you let it moderate a thousand messages a second pls
gotta make a system to make it more compact for that
what
right now it generates a json with some extra data
so it would be a nightmare to read
OLAP db time
"Lightning"? 😭 quarkus is faster by like 70%
i mean, source? lol
what's OLAP?
idrc though, there's not a lot of speed difference in web frameworks like this
yeah look into clickhouse fr though, shit is so good at storing that kind of data
will give it a check, thanks
I am also doing tests to compare this with using something like fine tuning an openai model, turbo models are awesome and from the tests I did are decently better than my current one but it would be way more costly to do it.
how much are you planning to charge?
tbf, no fking idea. I think the plans will be based on monthly requests. But you can link as many servers as you like, and I plan on adding support for discord servers too.
Right now, I am in a dilema on if I should do like Minevision and make it based on a discord bot + kofi for starters, then move to a website or if I should just go with a web app directly, which would require much more time, and knowledge since I have no experience with web apps lol but have a lot with discord bots.
So quite unsure on that side on how I should proceed. I am going to begin trials on 2 servers I work for whenever I have the web api set up.
A Discord bot works for Minevision because Discord is an easy way to exchange prompts and return images, like Midjourney did. If you want the whole thing to also work on Minecraft servers and on other platforms, you shouldn't use a Discord bot
You can still use KoFi, but I've had a few issues with it and it's not really built for that
You can easily achieve a monthly subscription with stripe or Gumroad for example
thats just my opinion though
having a discord bot as your interface will shoot you in the knee in the future
that's why I am still having my doubts, although the system should be built to support moving to web flawlessly, since the discord bot would only be an interface.
Also, do you mind sharing what issues you had?
gonna. be. a. pain. in. the. butt.
gonna be a pain in the butt either way since I have near zero experience building web apps xd, so chances something goes wrong are very similar
an issue i had is kofi saying that the subscription expired while the customer only cancelled yesterday and the subscription should still be available until the end
either you do it now, or you do it later while also spending time refining a UI you will be removing either way and designing a system around modular UIs
also as I said, kofi isnt built for such a thing
I think at the end, I know that I should just do a web app, but my lack of experience scares me of fking up and the comfort I have with discord bots works as an escape for me
youll have to do it either way?
fighting a mind war lmao
honestly if you go with Laravel you will save much time
yeah I suppose, but meanwhile I could already be testing the waters
that's what I am leaning into
Laravel 😌
if you're not familiar with frontend shit, you can get pretty far with just Blade templates
yeah
especially for like, a basic config thing for the service
doesnt have to look pretty
define frontend shit
I am quite decently comfortable with html and css, javascript I suck lmao
only one I have used is Svelte
you can use Laravel/Inertia with Svelte easily
although react ecosystem do be poggers
it's kind of annoying to get it SSR'd, but if you're just doing a basic config site it shouldn't be that bad
yeah, got told so by Charlie xD
you can use Blade templates for the marketing part if you need
yes
not that required though
it is for marketing/public facing parts
unless you want to never get any SEO and not show up on google lol
the text is always static, isnt it?
huh?
in a normal SPA, the html is empty, it just mounts a javascript script that makes all the content
that's why you SSR, so that the first initial page load has all the shit on it
i was stupid there for a sec
xD
Was thinking on using Laravel Spark if I went with Laravel but it sadly only supports Stripe...
Could Tebex be an option? Don't they have Tebex Checkout or whatever it's called?
use Stripe?
Tebex is more for game servers
like stripe is the thing you'd use
use something like Shopify or Lemon Squeezy if you want broad support and an easy API
imho
in both of those, you could just make a checkout link, redirect the user to it, then receive a webhook when the payment goes through
PayPal support is the biggest downside here
no support for PayPal as said above and we all know big chunk of minecraft audience uses paypal
ah crap minecraftttttt
but don't they have Tebex Checkout which is supposed to be for everything?
idk but your fees are most likely going to be higher than just doing your own thing
especially if you don't plan on using their webstore
Tech empower
I'll watch the 7minute segment about SSR and tell ya how it works
okay, well idk how much I trust that, but 62,000 requests per second seems pretty all right to me
I guess they could use actix-http for 500,000 requests per second lol
or just a load balancer
i severely doubt the rest layer will be the bottleneck
btw is this for someone already familiar with Laravel or straight from scratch?
I would not buy a course lmao
i believe this is for somebody already familiar
Just follow the Laravel breeze tutorial
super easy stuff, it can scaffold a whole project with auth and everything with Svelte iirc
might just be React/Vue, but it's pretty easy to swap out
the tutorials are good etc and youtube too but this course has served me exceptionally well: ~~https://www.udemy.com/course/lalavel-beginner-fundamentals/~~
Yeah thats what i was thinking
(only doing this because i dont pay for them)
Actix or axum are more lighting
yeah lol, kind of a weird ad
just reminding you, you are speaking with someone with 0 knowledge on these things, max I have done on the web is static websites, I am more of a frontend dev
yeah the one i sent above is straight for beginners
its not an ad
eyo, wanna share secret?
Or i think as every rust nerd says, blazingly fast
it... basically is? "here buy this coursee it's really good only $16"
i didnt say you should buy it, only said courses like that one have served me well in comparison to the laravel tutorials and countless youtube videos
but yes it could be seen as an ad
i dont intend for it though
yeah already saw this, although was quite lost in it lmao
Just do Breeze & Blade
welp, will have to check this out tomorrow, gotta head to bed rn
thanks though for help in both things
RRRRAAAAARRGHHGFFFFF
hoh
oh
I've setup paypal with laravel myself, was quite iffy but doable
rust 😍 😍 😍 😍 😍 😍 😍 (ive like never used it)
haskell <<<
curry man <<<
I will hurt you
if necessary
here what i mean
i will always have on my hand the existing possible drops
everytime an item will be token out i will re generate them back to list
instead i wont use double anymore for lower precentages its dumb
ill shuffle everytime and take [0] and ill just add the missing item using its ID
Actually no need shuffle
ill just make work in loops
when i add something to list it goes always to be last position right?
Yes
But that’s not really random
But I still don’t know why you don’t just use the NavigableMap approach
really random does no exist lets be honest
it will be random for users
because they wont know whats next ;p
and it will keep things in right balance
There are different RNG implementations that have different guarantees about their quality
my team senior dev uses white theme intellij
should I hit him with 'white theme detected, opinion rejected'??
101%
I have this code for storing a value in a MySQL database.
private static final String INSERTION_QUERY = "INSERT INTO FooBar(id, data) VALUES (?, ?) ON DUPLICATE KEY UPDATE data = VALUES(data)"
//...
String id = structure.getUUID().toString();
String serialized = new String(ByteSerializer.SERIALIZABLE.serialize(structure));
PreparedStatement pstmt = connection.prepareStatement(INSERTION_QUERY);
pstmt.setString(1, id);
pstmt.setString(2, serialized);
pstmt.execute();
pstmt.close();
I also have this code for getting the value in the database.
private static final String SELECTOR_QUERY = "SELECT data FROM FooBar WHERE id = ?";
//...
String id = uuid.toString();
PreparedStatement pstmt = connection.prepareStatement(SELECTOR_QUERY);
pstmt.setString(1, id);
ResultSet set = pstmt.executeQuery();
String value = !set.next() ? null : set.getString("data");
set.close();
pstmt.close();
But I get the following error when loading the data and I do not understand why java.sql.SQLException: Column 'data' not found.
Well does your database have the table?
When I do it manually all works fine
So yes, the table is there
have you tried to use a debugger?
I mean I think it’s better then random
Because random can hit twice same@number
Or never something
also data is highlighted there, maybe it's a keyword in your sql dialect? If so, try putting it in ``
That way I know once 100 generates there will be 1 lucky player 😉
If I put the data in '' I get this. The correct value is display if there are no '' :/
well if you do whatever you're doing right now, you should just probably use a Queue instead of a List, but then you still have the issue that you always have the same order
``, not '' or ""
Like in the SQL software? Because everything works fine there. It is the Java code that is the problem.
no, in Java
Ahh, I see. Sadly that did nothing though.
It’s ok even if same order
How should I queue
The thing is there will be couple queues
For category and sub item
Now it will be appeared within 10 other items
It doesn’t really matter because users will do 600 of those every hour
Players figure out stuff like that faster than you might think
The same you do as with the list, but removing the first element from an ArrayList is far more expensive than removing it from an implementation that is meant to be used as queue
Set<Object> objects -> objects.get(Random.nextInt(objects.length-1))
i dont think because the size of the tables are around 200 options
now u can multiplie those options by 100
which gives me 200,000
i think too big list lol
yeah that might be fine then
but then you really shouldn't remove the first element from an ArrayList lmao
i wont remove any element
i will just init the size
and then do if (size > pos){ +1 } else { 0 }...
yeah that's fine then
yeah the amount of things players can get is so huge actually
some items have different stats
its rng in rng in rng in rng lol
dunno how i will do wiki haha
nah random is bad
it works like shit from some reason
and doesnt feel like the 0.5% is 0.5%
I create a map of items with their chance... Run random and collect items above the number. Then I choose a random item from the collected.
I mean that certainly is an issue on your side, as it works as guaranteed by its specification
it sounds also pretty good but random isnt really random dont u think so?
at the moment i do simillar thing
i have sum of all options it doesnt go by 0-100
it goes by amount of options which is around couple of thousands
and i reterive the most close option
if random isn't really random, what are you doing to make it actually random?
in programming there's no actual 'random', just 'random'-enough or pseudo-random
there's the dn random algorithm
dn?
jokes on you, did a coinflip once using the Random class, somehow a guy won it 16x in a row lmao
either he's a luckly mf or idk
that's like 0.001526% of happening
I mean that's just how probability works
true
50% chance every time
yeah, 16 times in a row adding up to a whopping ~0.0015% for the entire sequence
"a better gaming chair"
yes
some random algorithm depends on system time , or other thing that updates consteantly
and then you get some sort of random
but in general random class is really bad i think
it doesnt work like random at all
int randomnum = (int)Math.floor(Math.random()*(max-min+1)+min);
i think Mah.random is better
then Random
man you really have no clue what you're talking about
Math.random() uses a global instance of Random
Gonna repeat what SirYwell said, but yeah, you use the Random class when you, for ex. want each class instance to have a different seed for it, Math.random() just uses a static instance of Random class itself, and you're kinda limited to the one method Math class provides which returns double. If you use Random itself you can use next, nextInt, nextLong, nextBoolean, etc.
What
Shocker
Its like this is somewhat universal between coding languages
You'd be shocked that javascript also has Math.random
Guns are illegal in minecraft
Banned
Yea yeah I think its only for the servers
Mods, plugins etc... can't be removed by mojang cause it's not their code. But servers can be blacklisted that have these banned resources... you could just remove the ban code from the client though.
they can send you a takedown request if the plugin/mod does not align with their community guidelines
They have no legal standing to do so. As long as you aren't using their assests you're fine.
Well.. they can, because its their game that you're modding. They'd only need to send a takedown to like CurseForge for example
Yeah lol they have every right to do something like that
oops wrong channel
epic fail
Yapper yapping again
it's literally in the license to which you agree simply by downloading the game or launcher lmao
they can definitely take that to court if you refuse and they wanted to
will that happen? unlikely, they'll probably take other cheaper actions, but they can
How long does it take for my spigot account to be verified in average? I kinda need some support for the premium version of the guild plugin 
I'd give it a few hours to a day, but in my case it was a few minutes (it was a long time ago)
I remember not having any problems with that lol
yup
wrong chat
Use https://paste.helpch.at/ for errors, logs and configs. So we don't spam the discord.
anyone able to help me with this im trying to use a left click requirement
requirements:
anything_here:
type: has item
material: QUARTZ
amount: 50```
Java docs/spigot forums has it, click listener I believe, did you check over there?
Damn doing some micro optimization for my bitcoin mining software...
Just doing String blockheader = job.version + job.previous_hash + hexRoot + job.time + job.bits + nonce; drops the amount of calculations from 100+ mh/s to 13 mh/s
Also tested with StringBuilder and had the same performance issue.
Any ideas on how to optimize this? Literally just appending variables into a string.
Seems like collecting the values from the variables is what causes the strain on performance...
String blockheader = "Test1" + "Test2" + "Test3" + "Test4" + "Test5" + "Test6"; works fine.
Well the latter will compile to a single string
But generally, string concatenation has a few problems: you need to allocate memory , you need to create a string from most non-string objects before, you need to convert numbers into a string representation…
But e.g. converting an integer to a hex string should be somewhat faster than decimal
Well... all of those variables are strings lol
Then it’s most likely just memory overhead
as always, run a profiler before trying to make any assumptions about performance
I was adding in line by line to see where the most strain from the calculation comes from. So I narrowed it to that to start with.
That then hex then hash.
Changing code is a bad idea when tracking down performance issues
Just use a profiler as bm said
Long.toHexString() also takes some time but not many better methods then that.
I can do both ways. It's only a few lines of code so there isn't a lot of code to profile lol
Also got and increase in calculation by not checking an atomicboolean and just doing while(true) {
You‘d be surprised by how many things can go wrong this way
🤷 working out fine for me.
I'll probably pre concat the string when the job is found and add the nonce when needed.
Yeah having the variables appended when the job is found makes about a 10 mh/s difference.
String blockheader = preheader + nonce; is still taking a good 70+ mh/s off the total calculations it can do before hex/hash
string.concat(String) is faster then +
String blockheader = preheader.concat(nonce); jumped up to 43 mh/s
Getting an additional 2 mh/s as the result 😉
100+ kH/s on my raspberry pi
i believe this will vary a LOT
Well at the moment its varying in my favor lol
It’s on Java ?
Yes
Just why would you write a CPU miner in Java?
can someone explain how gradient work ?
Cause I can.
Why not?
"because java slow" - them, probably
It's definitely slow for making a CPU Bitcoin miner
bro hasn't heard of hotspot
Yeah Java isn't the fastest language for a bitcoin miner. But if you look for one there aren't many if any. And I like to make my own things and I know Java more then c so 🤷
Could try something like rust, or i imagine go is even faster than java
They wouldn't be faster then c. At least in this case.
(That could or might have already changed though)
rust can outperform c under the right circumstances
you said know you more Java than C, so I was trying to find a middle ground :p
i find rust so bulky sometimes
like, with the whole crates thing
Honestly I should learn c and stem to other languages from there. Been limiting myself to Java for years.
Maybe try working down, rather than falling down
Nah. I go straight for my goals lol
Going from not managing your memory at all to managing every spare bit sounds... painful
I usually try to keep in mind what I'm saving to memory anyways
how so?
Understandable
you need a use crates for basically everything meaningful, at least that's what it seems like
maybe
async- need a crate
decent http stuff- need a crate
json stuff- need a crate
but it's not like theyre hard to use
java doesnt have json built in either
and it only recently got decent http
Yeah and?
it's the "npm philosophy" i guess lol
laughs in leftpad
Literally one command to install the relevant crate
Or tbh, the IDE might even install it for you
yeah i should clarify, the npm philosophy but not shit
Except no shitty node_modules folder
Idk I just don't like that the sdk doesn't come with some of these imo basic tools
mmm
as i said, you could say the same about java up until very recently
😭
using json and building CLI applications in go is fucking amazeballs
I think maybe the goal of the authors was to keep the executable as small as possible?
technically you need a package for json in go too
i am all for hating on rust but this doesnt seem like a great way to direct the hatred
wot
import "encoding/json"
realistically how is this different to adding a single line to the cargo file?
because it's internal, not external
if you cant tell the difference, does it matter?
imo yes
not to mention, go's json support is just generally a whole level of its own
maybe you're right
but i think as long as the 3rd party libraries are equally high quality it doesnt matter too much
a lot of languages have small sdks
and like, concurrency in rust... gotta use tokio, there's another 3rd party dependency
decent flags system for commands? pretty sure that's another crate
go, flag support is native
concurrency too, with their whole channels thing (at least that's what I understand that to be for)
you're correct
i suppose the justification would be that it's better to let the community decide what works best rather than mandating a single "perfect" way of doing things
after all, go is not without its flaws
go's need to constantly define and check for errors is kinda annoying
a lot of the time half the code just ends up being
if err != nil {
lot.Fatal(err)
}
or some variation of that, repeated every few lines
yup
go error handling is potentially the worst thing in all of programming in the 21st century
fair, but at the same time when you end up with libraries like reqwest (or whatever it's called), tokio and serde as the de facto standards, you're not really deciding anymore, you're just using 3rd party libraries that have become so big due to the lack of their existence in the sdk itself
Why?
In most cases, it comes down to whether someone knows what they‘re doing, the language is rather a secondary factor
they are popular but theyre far from standards - there are plenty other options for async libraries for example
sometimes it's not terrible, like when I can do:
if err := doSomething(); err != nil {
log.Fatal(err) // or whatever
}
and i still think that's better than the sdk designers trying to get it right first-time, failing, and then being stuck with legacy code in the sdk for years
yeah that still sucks
you also need to return in most cases or you end up with further errors later on
at least 3 lines of code per failure case is unacceptable
even checked exceptions are better
God I hate checked exceptions
i'd rather just have default behaviour be some sort of log/stderr/panic thing, for those smaller applications where doing anything more than that isn't necessary
Checked exceptions are an extremely powerful concept
oh yeah theyre overhated
But their integration in the language could definitely be better
but this is just a runtime exception system like java/kotlin has
eh ig
anyway conclusion is that monadic errors > everything
I also hate Go's variable system sometimes, mostly as a result of this error checking system
cus you can end up with 2 different variable states which means you either have to do hacky shit to assign the variables
one feature of go that i recently discovered which actually seems pretty powerful is go's return system
if you name your return types with variables, you can assign to them and just return at the end, rather than return x, y
oh i dont like that at all
it stinks of the single return point antipattern
yes lets introduce more mutable variables all the time that will be great
imma say something that seems really dumb:
I don't actually understand async stuff, especially as frequently used in MC
Like, you're almost always going to end up joining onto the main thread anyway, so what's the point?
you're almost always going to end up joining onto the main thread anyway
not if you're smart
async DB queries especially
ok, perfect example
let's say a query takes 200ms, so 4 ticks
doing that on main thread and joining means the whole server spends 4 ticks waiting for the query and doing nothing else
doing it on another thread and using a callback (or similar mechanism) means the server can be doing other things while it's waiting
if you're joining regularly you're doing something wrong
fair chance i'm doing something wrong, tbf
it certainly sounds like it
but in my defence, i'm not the only one
far from it
the spigot community is notoriously incompetent
cuz everyone learned from shitty yt tutorials and never learned how to actually program
raises hand in shame
My latest question in #development message is the result of this
i'm trying to learn, but it's so hard trying to wrap my head around these things
I learn best by doing and by seeing how others do things, but because of the nature of my projects being very... particular, there's not a massive amount of good quality references
i dont think theres an objectively right answer to that question, it's quite subjective
personally i try to stick to POJOs for the data and then have repository types that handle the actual reading & writing
like Spring does
Like i've been sitting here on and off for the past few months/year doing those JetBrains Academy lesson/tutorial/project things, and I get kinda bored pretty quickly cus most of the stuff I know, and the projects are simple enough that they aren't really helping me
that's not quite what I meant, i don't think
I was more talking about relationships with other objects, like say for the sake of argument in a factions/towny type thing:
Should the Player/User/whatever object hold a reference to their Faction/Town or should there be some sort of map, or both?
i think it depends, really
i prefer to go for hard references but theyre not always achievable, often if you have bidirectional references then it can get messed up
and you get a toString that StackOverflows
but hard reference unless you need a map, seems like a good approach
same question for the DB representation, though I think the answer for DBs is a bit simpler:
Even though it's one to many, should it be a reference table with a composite PK (e.g. faction_guid, player_guid)
or just a coloumn in the player table: faction_guid
for DB purposes I'm always inclined to go for the latter, but that type of thing tends to result in me having circular relations:
a player with a faction, and a faction with a player (e.g. faction_leader)
that's what i assumed
I've thought about adding a CS degree onto my list of degrees in the hopes it'd maybe teach me even half this sorta shit, but from what I've seen/heard, CS degrees rarely teach actual programming
at least this sort of programming; most of it seems to be web dev or python or the like
lol yet today this is true
depends on the degree a lot, mine is a healthy mix of theory and practical so far.
that sounds more like software engineering than CS
always will be
not worth the 3 years or 45k if it doesn't teach what i care about, that's 3 years and 45k I could put towards postgrad
oh yeah i wouldnt get a degree just to learn relational database design lol
I mean it wouldn't just be that, just program design type shit in general too
yeah all of that can be self taught with enough time & effort though
exactly why i haven't added that degree to my list- it's only my backup if both my other 2 fall through
Whats the topic, I'm a programming genius and I'll answer your question
what is a monad?
Idk
i've heard of that word, that's about all i know
hehe
not that it's relevant, but the other 2 (which I'm planning on learning successively and/or concurrently, depending on where I end up in the next year) are international studies & law
2 degrees??
that's just undergrad
if i have the means (financial, motivation, and academic capacity) to do so, i'll probably end up with another 2 postgrad at least (one in each field- international relations and law)
a monoid in the category of endofunctors 🥲
true
eh only ~100k for the 2 undergrads
bit less, bit more, depending on the exact arrangements
Sadly had to learn category theory since we use haskell for reasons unreasoned for
wait you actually learned category theory??
interested in international relations and law
thats so unnecessary lol
Yea we are being taught basic category theory with the classic example of using category set
well, that's just shy of the ~115k no-interest loans the govt give us :p
oh thats actually really cool
oh damn 🥲
couldnt be uk
even so, it's a hell of a lot of commitment
totally unnecessary but it's a very interesting branch of maths
get a job?
that's a funny idea
it is
if things work out with the degrees i'll hopefully end up with a job at DFAT (Australia's State Department/Foreign Ministry) or the UN, or somewhere similar
or if i do really well in my degrees, maybe i stay in academia and continue on to masters etc
that's 3-8 years (depending on configuration) down the line, we'll see what happens then
anyway, do you have any open source projects that deal with databases properly i can take a peak at
?
uhhh https://github.com/knightzmc/vouchers/tree/master/src/main/java/me/bristermitten/vouchers this is kinda old but might help you
the actual implementation is in the persistence package
thanks, will take a peak
but its a bit of a mess
That is uh, certainly one way of describing what I'm seeing :p
generally though:
https://github.com/knightzmc/vouchers/blob/master/src/main/java/me/bristermitten/vouchers/data/claimbox/ClaimBox.java pojo for the actual data
https://github.com/knightzmc/vouchers/blob/master/src/main/java/me/bristermitten/vouchers/data/claimbox/persistence/SQLClaimBoxPersistence.java SQL implementation that does all the queries and loading
it's slightly overengineered bc i wanted json support too
overengineered is one of my favourite states :p
real
is it really engineered if it isn't overengineered
One thing I love about newer versions of Java, I can now write multiline SQL queries without it looking like a mess
hmm, i notice you don't have a dedicated thread pool for your async stuff
yeah i just use the forkjoinpool
frankly im not sure if it's a good idea or not to do that
From what I saw in LuckPerms and in Aikar's IDB, they both created some form of thread pool
suggests maybe not the greatest idea to do that
However, here's my problem:
you can't easily use CompletableFutures in a TaskChain-like manner switching between sync and async unless you have the executors for both handy
thats not entirely true
but ive basically never had to do that
but just make the executors constants and ur balling
can't easily do that, at least without static stuff- e.g. an instance method on ur JavaPlugin or using the JavaPlugin#getPlugin/getProvidingPlugin stuff to access main thread
this is when you throw in a DI framework and you make your own @ServerThread annotation you can have something like public MyCtor(@ServerThread Executor serverThreadExecutor) and configure your DI setup to bind the main thread executor to an Executor.class annotatedWith ServerThread

but DI framework = more bloat 😦
i'm the type of person that will try to break down a library and remove all the shit that i don't want/need
^^^ except I just code it from scratch lol
You're the yapper type ig
it's one of the reasons I have such a hard time settling on a command framework too
LAMP ftw
What do you need more?
it was something to do with permissions
it was a complicated permissions system on top of the base permissions system
like, think factions permissions type thing
can still do it yourself hehe
i wanted to use their resolver system
wait no that wasn't the most important part
the most important part was the ability to optionally consume input as part of a resolver
Can you not?
I don't think so at the time
What type of resolver?
I wanted to have it so that if the user hadn't provided input, the parameter value would be provided
idk what the deal was, but it wouldn't work
I'm confused
wasn't designed to allow it
Eh whwatever
I was trying to do something equivalent to ACF's IssuerAwareContext
Never used acf, then use that
You may also use registerIssuerAwareContext instead to tell ACF that this resolver is able to resolve without consuming input, by understanding the context of the issuer of the command (such as World, Location, Etc)
A non issuer aware resolver must consume input. Issuer Aware may optionally consume input if supplied, and fallback to context if not.
f you want an Issuer Only resolver, one that always resolves based on Issuer and never consumes input, you may use
registerIssuerOnlyContext
that's the description for ACF's parameter resolution system
why not just use ACF?
ACF was too complicated in some parts
That sounds like legalease lmao
too bulky for what i wanted
So you want complicated features but not a framework that has that feature and is accordingly bulky
nah ACF has a bunch of stuff on top of that xD
If you want a cf and you can't adjust to any other make it yourself
ain't that big brained
the next on my list of frameworks to look at is Piston by the WorldEdit people
so, i'm looking at this, and i realised you barely managed to avoid my #1 sql-pojo problem:
getting the primary key
yeah, but normally you'd use a long/int auto-increment
that doesnt make a huge difference though
especially for relational tables that are all inter-mingling
doesn't it though?
If you've got a bunch of tables all using a uuid foreign key?
how is that different to a long foreign key
i mean, size of data for one
and also everyone i read online keeps saying that UUIDs are bad cus of indexing and sorting issues or something
i mean, size of data for one
yes but how does that make a practical difference. my code still works, doesnt it? just replaceUUIDwithlong
i meant in the database
yeah? same thing
efficiency n stuff?
just int instead of varchar(36) or whatever
i really dont get what your point is
just change the type
suddenly your #1 problem is solved
you're sacrificing DB efficiency/performance
sure but i dont care lol
it's an unfinished plugin that never released
and using UUIDs is infinitely more convenient
that was generic you, not you you
sure
but without being rude i really dont see why this is my problem lmao
you know a better approach, so use it
i know the approach I should be using, but i have no idea how to implement it properly xD

