#help-development
1 messages · Page 368 of 1
:-:
I'm sorry for starting this, xDD. I misinterpreted the order of operations, as I wasn't thinking mathematically, my brain feels like a mashed potato today.
Already did.
Had no idea you were that specific with your statements, xD
To be fair most of this is caused by the english language not using commas aggressively
Let's just settle on: (not using <li>) in conjunction with ol. xDD
I had no idea there were people out there who would do that, which is why I completely discarded this case of interpreting your sentence.
English is so unprecise
Compared to eg german or latin at least
english is amazingb
It actually was intended to be "not using <li>, in conjuction with <ol>"
The smell of diesel is amazing too
I'm wondering how that sentence would be more precise in the german language, xD.
its still correct
why is there so many "the"s in german
Implicitly, it is false
oh right alex is german
It depends on the case of a word
And the gender
And singular/plural
this just reminds me of trying to learn the difference between por and para in spanish and it makes my brain hurt
iirc finnish is worse with like 13 cases
Para is like ablative in latin, por is dative and accusative
I think its icelandic that has so many cases but i might be wrong
that'd help a lot if I knew any latin whatsoever
Latin got 6 cases but one is basically useless
It also implicitly states that german has no plural form - but it does. Singular forms are der (masculine), die (feminine), das (neutral), where as the pular form is die (regardless of grammatical gender)
(Vocative)
why do you know any latin
Unless its not nomative lol
It could also be „den“ or whatever
I learnt that in school from grade 6 to 12
one of the possible tetrary languages in the german school system iirc
Yeah but the de-jure default is nomative
The alternative would have been french - ofc i chose latin
Oh, why not spanish?
i believe they also have like spanish, greek and french
tf no english as a tetrary language
that is so strange
Many people picked latin at my school - almost everyone rued it
Im grade 6 we had to choose latin or french. Spanish, italian, greek etc was only a possible choice for grade 8+
well germany goes 'require german 1-10, english 4-8, one of 2 choices third'
I find it confusing that they prioritize a dead language over something like Spanish etc
When you know latin, learning other similar languages is totally easy. Also you need quite a bunch of latin in law (and medicine too i guess)
german is 1 - 13 and so is english. Only tertiary language is at least 4 years
You're not dead if many languages inherit from you, xD
My english classes started in grade 3, and the year before me started with english in grade 5
Ah right lol
couldve sworn it started in grade 4
dead just means no one speaks latin
English classes start with grade 3
It depends on the country i guess. My class in NRW was the first to start in grade 3
cough doctors cough
Although to be fair it only really starts at grade 5. Grade 3 & 4 english is nonsense
„I like pizza. Yummy yummy“
But hey, gotta start somewhere lol
I started spanish in 2nd grade american schools must just be shit at teaching language
It's even worse: "Apple.", "Pencil.", "Book."
I mean, in latin we also didnt start off with ACI Constructions or plusquamperfekt lol
i mean
better than how they started latin with us
'heres a speech. translate.'
wtf
actually, apparently you don't need to know latin to be in the medical field
well actually i got 49.x% and they gave me 50
why would you that is the most random requirement xD
You do need to know latin if you want to be a history prof in german though
I can't imagine my doctor needing to know latin
„Quintus in hortus est. caecilia clamat: „quinte!“
Lol
say what now
like
why
Heiliges Römisches Reich
latin started dying out in like 16th 17th century
also you dont need to speak english to teach the history of the english empire i dont think?!
why would you need to know the language spoken to teach history about that thing
Well you only need to have your "latinitium" (or however it is written out), which is basically a blank sheet of paper proofing that you did learn latin at some point.
At least in law, many basic rules are still in latin. In dubio pro reo, actio libera in causa, etc etc
Holy Roman Empire was the predecessor of the first german empire.
Whether you still know it is something else entirely
i know that latin is used in church
Nullam poene sine leges… i could go on
dont
Ok
Well used to - outside of high-ranking official positions few ought to know it
Sad that we didnt really learn about the history before Around 1890.
It was 1 year WWI and from then on only the horrible things we did in WWII with
the following economic miracle, cold war until the fall of the berlin wall.
Everything before that is not really tought.
a lot of this chat is german
for some reason
A bit strange though, usually we exclude everything happening past 1945
i mean
60 years of not doing much
hooray?
whats there to teach besides the stupidity of russia
I mean the allies did some messed up stuff too
I think it we had 1 year 1900 - 1918 then a ton of years 1933-45 and maybe one year for 1945-1980
I didnt do anything in ww2 😦
if you wouldve your profile picture wouldnt have that much color
my country had quite an history in 90's, so we teach about that alot 😄
Right, the world was black and white back then
Hm who had a lot of stuff going on in the 90s? Middle east mainly
Balkans
oooh that brings me back
we did like a school project and in walks this middle aged lady
everything about her was grayscale
like everything everything
clothes, make up eyes
and i was just looking at her confused if my eyes were working or not
Lol
Hey everyone,
Has anyone every tried to spawn a command block with a command in it? I tried but the command is not actually updated in-game. Here is the code snippet:
Block block = Bukkit.getWorld(world).getBlockAt(100, 100, 100);
block.setType(XMaterial.COMMAND_BLOCK.parseMaterial());
CommandBlock commandBlock = (CommandBlock) block.getState();
commandBlock.setCommand(command.toString());
The block spawns without the command in it, and I guess the block state is not linked but I don't see how I can set the state on that block again
My curtains are certified by some iso standard but not made from iron
commandBlock.update()
you do audio stuff?
Yeah but when i got the curtains i didnt knew anything about this
Thanks! Wasn't aware of that
I only discovered this 10 minutes ago
Akustik
I call this a scam
unfortunately it isnt
Idk check it yourself https://www.creationbaumann.com/de/Akustikstoffe-fuer-Akustik-und-Aesthetik-in-Harmonie-18670.html maybe its bullshit, i dont know lol
germany is that one land with far too much paperwork
you get a certificate for everything and also need one for doing anything
... which is why it is easier to scam people than to do real business
Considering it is hard to verify these so called standards (It is beyond me how proprietary standards can be considered as standards) I cannot say much
However the summaries of these standards do match up with each other and the rest of the document, so it cannot be outright considered to be a definite scam
I just ordered some dude to my house, me showed some materials, i chose some that looked nice, then 6 weeks later he brought the finished curtains. He didnt mention this „acoustic stuff“ even once lol
Hello everyone! I have a question about databases. Is it a good idea to load users from a database (on plugin start-up) if I only have 20-30 of them there? Or is it better to load them on login and delete them on disconnect?
If its only 20-30, id just load everything on startup lol
Yeah if it isn't part of the mainstream marketing then I assume this site only exists for those that really care and thus is likely to not be bullshit
id do login
Well that company exists since 1886 or so, i doubt they are only bullshitting. But who knows
its germany, they're serious
I also dont really care
Wirecard???
The curtains look nice
Wirecard completely showed that germany is completely incompetent at being serious
We got this EZNick dude arrested though right?
Never heard of them.
Spigot plugin with a crypto miner or sth similar
I dont remember it 100%
About a year ago
If it is anything below a few dozen megs, just keep everything in memory and regularly flush the contents to disk
also on unload
that is obvious, so was omitted
people are stupid me included
ig that works lol, i probably want ||
okay, thanks!
damn discord made a bigger images preview
i better hope thats right
dont you have this stuff?
No? Where is that from?
new update ig
ur a brony?
imageception, lol
i have so many questions about that screenshot lol
how the fuck
ahaha
No they are
for me it's next to each other
imma reload
Same
i better dont spam this channel with cats
why not
uhh anyways, are there other boolean operators than or, and, xor and not?
maybe the logical leadsto
like the thing with the t f t t table
Sir, this is help-development (lol)
only if someone asked a question
Oh, I thought general was general and help-development was not general
md5 isnt online
Bc somebody once got agitated, xD
"Who's Bob Vance"?
You wouldnt know if he was. Old man is always invis.
in all other episodes they ran away when grandpa starts talking lol
im watching the simpsons right now
the episode where homer becomes a krusty imitator
Dropped simpsons years ago. I like Family guy but nothing beats South Park.
https://a57.foxnews.com/static.foxnews.com/foxnews.com/content/uploads/2023/02/640/320/Screenshot-133.png?ve=1&tl=1
damn chatgpt very useful
i might aswell allow 1 == 2 as valid syntax
and add boolean operators
Yes
This is done with custom fonts for example
Im not sure i understand that sentence...
you become chinese 🤡
9x<>
What does that even mean?
Why do you have a height of 200?
For 16x16 images the font should look like this
Then you need to play around with the properties
Hello dev community
I found this plugin called RasberryJuice thats basically an API that connects Python to your spigot server and you can do basic cool tingz, may've heard of it
but like the latest version that i could find of it was 1.16.5 which I cant apply it to my own server (thats on 1.19)
Any idea what i can do? Does anyone know any similar plugin thats on 1.19 or is there a way to somehow tweak the plugin file so that its recognized as 1.19?
looking at the source code, it should work fine using 1.19
however why not just use java? that'd be so much easier
average python enjoyer
beautiful
lol
imagine not having it like this
nah it's supposed to look like this
💅
does anyone elses intellij like to have a stroke and hit 100% cpu usage in the matter of seconds because you double clicked something to select it
on windows, this indeed does happen to me like once a week
on mac this never happened
just like 2-3 hours ago it crashed because of this
nah only minecraft makes my cpu hit 100%
well not sure whether it was because of selecting sth, I just tried to click somewhere to select sth and then "IJ has stopped responding..."
i gotta shut it down thru task manager or my fans are gonna go zoom
fans go zoom zoom
oh and this does only seem to happen when having the shitty "minecraft development" plugin enabled
oh that might be it
without it, this never happened to me
it only really started happening to me about a month ago
maybe i can just use an older version and itll be ight
do you actually need that plugin? I mean, it doesnt even do anything for spigot
(except displaying chat colors)
its nice when making a new project and you're lazy
but once you got it going you dont need it
I just use my own maven archetype for this https://github.com/JEFF-Media-GbR/Spigot-Plugin-Generator
here's the archetype and its features: https://github.com/JEFF-Media-GbR/spigot-plugin-archetype
the first link is just a GUI for it
oh thats sick
I made that to avoid having to copy/paste the same and the same dependency information every time again (ACF, MockBukkit. etc bla bla)
:3
if you're missing a dependency that you regularly use, you can just pull request it to the archetype repo, the GUI automatically updates itself
McDev plugin for the poor?
for the poor? it can do way more
(for spigot, at least)
the mc dev plugin just creates the same lame pom everytime
cannot remap, or create an exportToServer profile, doesnt allow to include any other dependencies, etc

how check if string contains letters not from ascii table
Just like always
Same as you would check with letters from the ascii table
Theres nothing special about not-ascii
boolean isAscii = CharMatcher.ascii().matchesAllOf(someString);
if you wanna test an entire string for ascii only
ok
from com.google.guava
Oh thats what you meant
guava caching
That actually looks very interesting on first glance, gotta check it out later myself too, :D
this is jeff media we talking about here
only bangers
i saw that custom block data stuff of his and i shat myself
so very useful
feels like alex is the only one here writing javadoc
?morepdc
You can create custom persistent data types on your own, or use one of the many libraries available which have implemented those which match your needs. Learn about more persistent data types here: https://www.spigotmc.org/threads/more-persistent-data-types-collections-maps-and-arrays-for-pdc.520677/
Sometimes i am bored
poll
wasn't that the way AWE used to work before it was a standalone plugin?
maybe I'm confusing it with someone totally different
maybe, probably, ...
This plugin has only one function: eliminate the lag caused by the WorldEdit! This is done by replacing the WorldEdits session with an special asynchronous one.
so yeah that's what it does
Is the bungeecord-proxy the equipvalent of importing the full core?
Because maven is not currently resolving it
you normally need to import bungeecord-api, not bungeecord-proxy
I need the proxy caused im doing weird things related to packets, which are basically inside the "master module"
"bungeecord-proxy vs bungeecord-api" is basically like "spigot vs spigot-api"
Yeah
What i have said
spigot-api doesnt contain packet related and in bungeecord happen the same
yeah then you probably need bungeecore-proxy, yeah
yes, but so far maven was founding it that why i came here haha
That is something that i dont like about third party, why dont they put all in same self hosting
Instead of making us dev to add thousans of different repo, for dependencies made by the same author/company, its something really clown. But so far they are not my libraries i dont care about how they do it
well bungeecord originally was developed by some private server IIRC; they probably already used that repo before spigot took over
if at all, you should complain why not everything's on maven central
oh wait md5 didnt do the proxy? I thought he did the proxy when he started with Spigot
I didnt know they where different authors
It seems intellij aint a big fan of this: ```java
meta.displayName(ChatColor.YELLOW + "" + ChatColor.BOLD + "Lightning Stick");
new TextComponent("your colored text here")
SpigotMC says "BungeeCord is a useful software written in-house by the team at SpigotMC." but the bungee pom.xml says "Proxy component of the Elastic Portal Suite" lol
so no clue
maybe md did write it, i dont know
net.kyori?
Please dont tell me you are using paper on Spigot discord 💀
Component.text("...")
yo uare using paper API
Agree, paper have they own discord for support
right i alays writte it wrongly
Yeah mfalex, the bungee description are diff i just realize that
Welp. Sorry. It's a fork so alot of stuff is pretty much the same. Much bigger community here.
Spigot != Paper, so spigot comm != shity paper comm
paper always wants adventure components everywhere
the docs for adventure are here: https://docs.adventure.kyori.net/
if you see any setters without "set" in the name, it's a paper method
spigot doesn't use weird "fluent" names
LMAo i read so fast that i read "verano dont use weird fluent names" hahahaha
Is paper plugins faster then spigot plugins?
Paper has his own comm tho, maybe they can help you with paper related
Alright, I guess I will just move back to spigot then
Yes please!
in 99% of cases, you wanna write your plugins for spigot, then they work on both. if you only use paper api, chances are high your plugin will not work at all on spigot
I always code for spigot, use spigot.jar to test my plugins, but for actual servers I use paper .jar
Can I just change the gradle dependency or do I need to make a whole new project?
You can jut change dependency, and update your code replacing paper methods with Spigot ones
if you already used paper methods, you will now get compile errors you gotta fix
for example: PersistentDataContainer.has(NamespacedKey) is a paper only method
I think most of my stuff is spigot, but I am using paperweight and nms. Can I till just change the dependency?
well if you use paperweight for NMS, you cannot just go back to spigot on gradle
I havent actually implemented any nms stuff yet though
for remapped NMS on spigot, there's only an official maven way to do
ah okay well then no problem
then just get rid of the paperweight stuff and use "spigot" or "spigot-api" as dependency
(usually, you want to use modules for your NMS stuff anyway, then you could just use paperweight in the submodules, but keep the "core" module to spigot-api)
ah paperweight has a lot of plugins and weird stuff in the gradle file so I think it will be faster for me to just create a new project
Does API-version mean the minimum version required? Or a list of all versions
Hm probably, yeah
Minimum
ty
this is only if youre using pure paper API tho
NMS often needs very specific versions
What is groupid? Is it my domain?
The specific version stuff goes inside the plugin not in plugin.yml
Its your identifier
Like the nms logic and such
group id would be ur domain backwards or me.yourname if you dont have one
can I use io.github.miklath?
Yes
thanks
Hello. I would like to ask you, how I can make an item in my plugin unplacable. Thank you.
Apply a custom pdc tag to it, then in BlockPlaceEvent, check if the item has this tag
smack something unique to it, pdc, lore, an enchantment
check on placement if it has it
if yes cancel
Does everyone in the spigot community use maven
Thank you dear man
No
I feel like roughly 50% use maven, 30% gradle and 20% nothing lol
For spigot or all of java?
Probably both lol
Hey! I just found some interesting bug.
Java can't run replaceAll when String contains $
I tried running my command, which sends message to player with $ as message.
I get this error:
https://paste.md-5.net/yebojadoho.bash
Pointing towards first .replaceAll mention in my code
Isnt there like a lot of preformance benefits to gradle?
replaceAll uses regex
Just use replace
It also replaces „all“ occurences but it uses plain strings, not regex
will it still replace all mentions of pattern given?
Yes
oh great
tysm
or replaceRegex
And replaceFirst should be replaceFirstRegex
would make a lot more sense
„aaa“.replace(„a“,“b“) will be „bbb“
hee? How?
Its an instance method, not static
ik
If it would be String.replace(…), then what would be the string you call it on?
because you sent something weird
Maybe my discord is broken and doesnt format it properly
ohh my bad
frigging phones
sorry for losting ur time
„This is how quotes work in german“
Command for building maven plugin from terminal?
mvn package or mvn clean package - Dpeends what you are doing
mvn archetype:generate
But i got sth better for you
is it an android?
Im listening
Oh wait thats just the gui
idk if you'll have it too but i can switch between keyboard languages when holding the spacebar. to my own and english.
Check the link in the readme of the link i sent
Iphone
Oh no. I was talking about building artifacts
Why dont u just use IJ interface for creating the maven project
mvn package or mvn clean package
mvn package
Sounds like you two disagree
Package = compile and package into a jar
I guess it was
clean package = clear caches, then package
You should run „mvn clean package“ when you changed your pom or resource files
Otherwise if you only changed code, normal „mvn package“ is enough
I always make batch files for my projects
Yeah cant hurt except that with clean, it ofc takes way longer for multi module or large projects
does it?
building pushing to the server and making the server restart automatically
Sure, clean removes everything that was cached
Does IJ have an option for having global configs sets for applications? So then i dont need to make mc server configuration on every IJ project
eh without clean it took roughly 10 seconds. with it it took 15
so you are correct it seems 😮
Why would Papi return null if it's set as a soft-depend
Oh wait I have my answer already
Look your code carefully before asking, take your time its not a rage*
So with clean its 50% slower
Jefflib is roughly 1:30 with clean and 30 seconds without
but i used to sometimes run into very odd issues when i did not clean
Yeah when you change the pom or resources, you should always run clean
i don't have enough braincells to remember that though
Sure
Do you have PAPI installed?
If yes: you shaded it into your plugin
Dont do that
Can i see how?
Thanks alex
I never find how to sync spigot server with IJ only time for every IJ project
Because actually i havent find a way to dont configure the spigot server and IJ when i change from one IJ poroject to another
Which settings do you mean btw?
The application jars which allow you link custom jars into IJ, which then are runned directly from IJ
Do i explain?
1m i will take a picture
That thing for being specific, i want to know if there is a way for setting that globally so i dont need to configure it on every IJ project
Ah yeah you can definitely store that globally, but tbh no clue how, im in the bathtub lol
hello. i want to do simple teleport plugin. when player stays on certain block from config it teleports him to a location and it have to work reverse too. i got many errors on player move event
pls help
Show full stack trace pls
^
null bro
Line 23 is throwing it
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
or use static getter
di>
alr thanks
reason?
i bet there is no reason
both have their advantages
I mean, for actual PROPER dependency injection, one would pass the location to the listener, instead of the plugin instance
if you just throw your plugin instance into everything, you could as well just directly use MyMainClass.getInstance()
DI means to pass in the required dependencies, and not just your main instance all the time
Does maven delete the target folder for every build?
I want to have a git repo inside target folder. Does that mean I can never use clean?
why would you have git repo inside of target folder
^
seems like you are doing smth wrong tbh
so I can push jars to my server?
gh releases
and no I wont build on the server
what repo do u have in your target folder
a repo connected to my server
that automatically pulls new jar files
why don't you use the maven-publish-plugin
to publish it to some repo
please elaborate
do you have a webserver or anything?
mvn publish will upload your stuff to a repository, e.g. nexus. but it can also just be some FTP(S) server or anything
Nexus Repository Manager
any way to use git and github?
ofc but I gotta go now
alright thanks
if ur using gh, you can utilize gh workflow
or actions, however they are called
which will for example build plugin on every pull request and upload it via (s)ftp
aha thanks
Will it build on my machine or cloud?
on cloud
Yo guys. This may seem like a very strange question, but anyway. Should I cache null-values when working with a database? 🤔
Im not sure what I have done here, Im just switching from Eclipse to IntelliJ, and its chiming at me in console:
17.02 21:36:56 [Server] [INFO] java.lang.ClassNotFoundException: com.a113.discordtest.Main
Any advice would be wonderful
- how are you compiling your plugin
- folder structure should be <root of project>/src/main/java/<your package>
Does anyone know how can I make a plugin that everytime when you have more than 9 iron ore, transform 9 of them into an iron block (just an example). I don't think listening for BlockBreakEvent will be the best solution, thanks.
listening to block break event is probably the better option imo
But when there are 100 players mining together?
Yes but this was an example, for a mining server every block needs to be calculated
Tbh, sounds like deploying locally through scp, for example, would be more than enough. You built the jar, so you might as well deploy it.
Never hurts to learn a new tech skills used in enterprises
If you're doing it to learn something new it's great, otherwise it's just a complete overkill. Only because it's an enterprise doesn't mean that you have to look up to them and take every action they perform as the ultimate solution.
what is the best way to get current cpu usage ?
Why is it overkill though? I love automation
on linux its probably top
programically
oh
You can still automate scp, but there's no need to spin up a remote vm to build your stuff if you already build locally (to check if it compiles, or to run tests).
Well, what language are we talking about? Java?
CPU stuff in Java is annoying
yap
I dont test ony a local server I test on production 😎 😎 😎 😎 😎 😎 😎 (speaking of following good practices lol)
It's not really something the JVM knows about so to speak. It has to call specifically to some implementation details
You can copy/paste code from here, works fine https://stackoverflow.com/a/47199/6327919
Reason it uses reflection is because there are different implementations of the OS depending on whether or not you're on OSX or Windows
well, i didn't think you would need to use reflection for it, but thanks 👍
Yeah, the details of it are hidden behind unexposed methods for some reason
(note that's an internal class)
You can of course go the route of setting up GH actions, it will be a great learning experience for you, don't get me wrong. I don't want to discourage you from doing so. But the scp version most definitely gives you more for the time you have to invest. You can whip that up in a few minutes, while actions will take a bit for you to fully understand them and actually implement it properly.
If you're working on it alone, there's no need to test and deploy centrally. I'm just a big fan of letting the system grow with the demands in a natural fashion, instead of going all out on the beginning already.
What is scp?
Remote copy over the secure shell (ssh). It's basically from host and path to host and path.
so basically wget and curl?
It's a command that should be available on all operating systems nowadays.
Uhm... well, if you like to imagine it that way, sure! xD
ah. can it be automated?
You need to just make maven run a shell script after finishing the package phase, which then contains the invocation of that command. I'd recommend storing host, username and password in environment variables in a separate file which you add to .gitignore and source at the beginning of that script.
Just wanted to give you another simpler solution, you can research both and make up your mind afterwards, of course.
Will a batch file that builds then runs scp work the same?
Well, is your current build system a batch-file?
almost...
call mvn clean package
scp stuff here
"Write once, run everywhere", :((. The last resort would probably be to download an os-specific binary which can extract these metrics in userland, invoke it over a subprocess and extract the required information, as sad as that sounds.
Yeah, like I said, it's not great lol. It's just the only way to get that information in the stdlib
Oh yeah, sure, that would work! mvn clean package blocks until the jar is built, then you could just invoke scp on the target folder's jar file. If you add that batch file to .gitignore, you might as well hard-code the credentials. No idea how you can run scp on windows tho, I haven't used that OS for many years.
normally you would use an enviroment variable right?
Yep, and I really don't get why that's the case. The JVM obviously has to know these metrics, yet it still fails to provide them. Great answer tho, as it seems to work out in most cases and doesn't involve the hackery I mentioned.
Doesn't minecraft shade in a library that supports such features?
Yeah, I'd just have a script like the following:
DEPLOY_USERNAME=root
DEPLOY_PASSWORD=12345
DEPLOY_HOST=192.168.1.128
DEPLOY_PATH=/home/minecraft/server/plugins
Then source that right before invoking scp and use those variables.
If it does, it wouldn't be on the server
OSHI should be able to get such functionalities
Client only for the F3 menu
What about invoking something like top from java?
I'd be hesitant lol
I'd not invoke top
Then you'd need to know that top is installed, and you're on linux, xD.
Especially since top is not meant to be parsable
Oh. I forget that people are developing plugins that they are distrubuting.
so me, hahaha
You could probably make an api in another language though that you could easily interact with from java
OSHI is a free JNA-based (native) Operating System and Hardware Information library for Java. It does not require the installation of any additional native libraries and aims to provide a cross-platform implementation to retrieve system information, such as OS version, processes, memory and CPU usage, disks and partitions, devices, sensors, etc.
I'd really just use OSHI
Since all roads lead to JNI anyways
Although with panama it might be a slightly different story
And I know that paper shades in OSHI for /timings - so you'd only need to shade in the library yourself for spigot users
Ah. I love being a sysengineer in my own home
Especcialy when all the servers are laptops that somehow manages to unplug themselves
Isn't that just an API in another language (likely C) that's being accessed? I've never worked with JNI, but I guess that C bindings is what it's mostly about.
Yes
I've used JNA but not OSHI
Really need to play with JNA myself too, just to get a feel for it. Seems pretty cool! :)
used it to interface with FFMPEG
However there is OSHI-FFM which uses panama and henceforth works a bit differently since panama allows to write stuff with less C
But OSHI-FFM is still in dev for the forseeable future due to panama being very new
looks like thingy from com.sun works
ur just tryna get cpu load?, havent been following the convo
ya
Hi guys, i have a problem, I want to block a way for player to put items in offhand slot in their Inventory (I already blocked the F shortcut). I can't get right the checks in event. Can someone help me out? I will give you below what I have already got
@EventHandler
public static void withHeartInventoryOffHandClick(InventoryClickEvent event) {
if (event.getCursor() != null) {
System.out.println("bim");
if (event.getCurrentItem().getItemMeta() != null) {
if (event.getCurrentItem().getItemMeta().equals(ItemManager.life_heart.getItemMeta())) {
System.out.println("bam");
if (event.getRawSlot() == 45 && event.getClick() == ClickType.LEFT) {
event.setCancelled(true);
}
}
}
}
}
?arrowcode
ye, i don't do this. It's just a first version to block it, then i will get to refactoring
did you want overall cpu usage or cpu usage being consumed by java?
if you want cpu usage consumed by java you don't need reflection for it
consumed by jvm
ended up doing
OperatingSystemMXBean operatingSystemMXBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
cpuUsage = operatingSystemMXBean.getProcessCpuLoad();
ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
for(Long threadID : threadMXBean.getAllThreadIds()) {
ThreadInfo info = threadMXBean.getThreadInfo(threadID);
System.out.println("Thread name: " + info.getThreadName());
System.out.println("Thread State: " + info.getThreadState());
System.out.println(String.format("CPU time: %s ns",
threadMXBean.getThreadCpuTime(threadID)));
}
gives you cpu time in ns for all threads being used by java
What's printed when you use right click? Nothing?
could even add the cpu load thing too to it
this would be the correct way 🙂
the other way you could do it, if you wanted the cpu load of the whole system would be to drop out of java and invoke the console
both of prints, depends if i am picking or dropping item in inventory
Well, you're only cancelling if event.getClick() == ClickType.LEFT is satisfied, how about just ignoring click type if that target item is on the cursor and the slot matches? That should be sufficient.
okay, so i removed it, now it allows me to put in offhand slot and every other move from offhand slot is cancelled
I also think that you shouldn't compare against getCurrentItem, but rather against the cursor item, as that's what you're about to place down, and you want to block putting items.
Ye, that works, tysm for help
Awesome! :)
Anyone know why but when i restart my server the stats in the scoreboard resets ^^ i use hashmap
Im using PvPManager, does anyone know how i can make it so people with op can get into combat
Because hashmap is not persistent
It only stores in memory, which is of course removed after restart
Hi, I'm using ProtocolLib to send a fake block to a player but it doesn't want to work, I'm using this code :
PacketContainer packet = Main.getInstance().protocolManager.createPacket(PacketType.Play.Server.BLOCK_CHANGE);
packet.getBlockPositionModifier().write(0, new BlockPosition(x, y, z));
packet.getBlockData().write(0, Bukkit.createBlockData(block));
// Envoi du packet au joueur dans le monde spécifié
try {
Main.getInstance().protocolManager.sendServerPacket(player, packet);
} catch (InvocationTargetException e) {
e.printStackTrace();
}
But on line 3 it doesn't accept Bukkit.createBlockData(block) and suggest me to Cast it as "WrappedBlockData" or "Wrap using WrappedBlockData.fromHandle()" but neither of them work, it get me a error in console saying :
Caused by: java.lang.IllegalArgumentException: handle (CraftBlockData{minecraft:gold_block}) is not a class net.minecraft.world.level.block.state.IBlockData, but class org.bukkit.craftbukkit.v1_19_R1.block.data.CraftBlockData
Alright so i guess you need to store the data somewhere and could i do that in mongodb or is there any other store thingy that you would recommend?
config file or db 😅 (i recommand db)
spigot has a sendBlockChange to handle fake blocks
db =mongodb right?
Oh, how can I do that ?
mongodb, sqlite, mysql
Thanks, i'll take a look at it
It's awesome thanks you ! It work perfectly
You can also save data in player pdc
?pdc
How can I get/edit the contents of a composter? By contents I mean the bonemeal output, not the levels
Composter has an inventory https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/InventoryType.html#COMPOSTER
yeahh, but how do I get that inventory aha
yeahh- that's the road block I've hit haha
ah it has BlockData type of Levelled
it does indeed
so getBlockData() and cast
what am I casting it to? Levelled?
yes
how do i get the contents from that?
from my understanding that only allows me to get/set the level of the composter
um that gives you a levelled data you can change how much is in it
I guess how full
yeahh, i'm trying to change the actual item in it when it's full
oh
you'd probably have to intercept the interact event to prevent it throwing things out when you click on it
might be on block drop item event
ooh hadn't head of this one before
let me give it a shot!
I was going to "setCancelled" player interact but wasn't so keen
that seems to indicate it only fies on a block break but you'll have to test and see
will do :)
No clue then
Why does my plugin correctly hook into vault in my test enviorement but other people report that a no vault dependency is found?
Why would this be the case
load order varies
only initialize your vault dependency 1 tick after your onEnable
possibly https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityChangeBlockEvent.html
declaration: package: org.bukkit.event.entity, class: EntityChangeBlockEvent
for composer
oooh, let me give it a shot!
not sure exactly how it could be utilized tho
So use
Bukkit.getScheduler().runTaskLater(this, new Runnable() {
@Override
public void run() {
// Send the message
}
}, 1L);
```?
i have a slight idea, i could probably use it in a similar way to how I was using PlayerInteractEvent, except cancelling that event is less likely to cause damage to other plugins
you can also format that l ike ```java
Bukkit.getScheduler().runTask(this, () -> {
run stuff
});
How can I disable my entire plugin if it's not found tho
Cause obviously "this" is no longer valid
what if they dont want a lambda smh
if you do that on enable just use this
if you want to disable add vault as a depend not a softdepend
getServer().getPluginManager().disablePlugin(Bukkit.getPluginManager().getPlugin("BetterPrefix"));
just use this
Vault is a depend
you will still have a plugin instance
Oh
then your plugin will nto enable if it's absent
Ok ok
sorry to annoy you but do you remember how you made the custom blocks?
Still some users are reporting errors
you can't be initializing correctly
I'm checking the logs file and vault is actually loaded fully before too
can't do more without seeing code
Bukkit.getScheduler().runTask(this, () -> {
if (!setupEconomy() ) {
log.severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
getServer().getPluginManager().disablePlugin(this);
return;
}
setupPermissions();
setupChat();
log.info(String.format("[%s] - Plugin was enabled successfully!", getDescription().getName()));
});
I copy pasted exactly what vault does
It works perfectly for me
Just not for a specific user
get his server log. make sure he really has vault
I do have it
I even got his timings report
I'm trying to understand why it works on my test setup but not for him. Nothing is different
I even see other plugins successfully getting vault
[07:39:06] [Server thread/INFO]: [Vault] Enabling Vault v1.7.3-b131
[07:39:06] [Server thread/INFO]: [Vault] [Permission] SuperPermissions loaded as backup permission system.
[07:39:06] [Server thread/INFO]: [Vault] Enabled Version 1.7.3-b131
[07:39:06] [Server thread/INFO]: [LuckPerms] Registered Vault permission & chat hook.
In their api. vault has
if (getServer().getPluginManager().getPlugin("Vault") == null) {
return false;
}
Can't I just remove it since I have it as a depend in my plugin.yml
It won't even reach that part if it's not present
not safe to
What else could it be
I even got his vault jar checked if it was the same and it worked for me
k
so long as it is a depend and not a softdepend then spigot will always load your plugin second
softdepend is not guaranteed
and as long a you hook vault 1 tick after onEnable there is no reason for any issues
Bukkit.getScheduler().runTask(this, () -> {
if (!setupEconomy() ) {
log.severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
getServer().getPluginManager().disablePlugin(this);
return;
}
setupPermissions();
setupChat();
log.info(String.format("[%s] - Plugin was enabled successfully!", getDescription().getName()));
});
Yet he still gets the same error
his error is the output you do for no vault?
makes no sense
if it works for you not him, get him to send you his vault jar
and test with that'
gremlins then
show us his startup log
Does anyone the guy that once Sent me His storage libraur github link, i rememberit was written un kotlim, but i can find the repo
Literally just repasted all his files to make sure
I'm getting him to zip his entire server and send it over
line 419 is when the server finishes loading
I'm gonna get to the bottom of this weird wuju
I don;t see your vault error after that
is that vault custom compiled
400-401\
im pretty sure the spigot version doesnt have the b131 on it
Nope. latest of spigot
Yeah I thought that too so I asked for the jar
It's the same
400 is before the server is loaded, before yoru onEnable has finished
What does that mean then?
thats not using the scheduled load yoru showed us
well line 404 says another plugin cant hook valt
yep both attempting to hook too early
It is, I have different logs it was a bit higher
You're saying all the way at the bottom of my onEnable then?
you must be checking for vault twice
if it was being checked in your scheduled task it would error after line 419
Ok wait I will change it
unless, it's that wierd server distro he's using
latest paper
pufferfish is a fork of purpur i think
as line 405+ shows the scheduler running, but thats too early to be running tasks
its a fork of paper it turns out
But why would some plugins correctly load vault and others not
Ok wait let me change something around and try again
there are issues with that log
Wait so elgarl
No tasks shoudl be run before line 419
I'm moving my scheduler inside the new runTask
the scheduler doesn;t run any until the server is loaded
And I moved runtask to the all bottom of onenable
So it will only check for vault and start the scheduler 1 tick after onenable
Compiling and testing on his setup
whats the scheduler for if you have run task
actually no task should execute before line 423
tasktimer
that is a seriously messed up log
no, I want him to run a normal server and see if it works. None of those tasks shoudl run early
his server is broken
his server runs its first task at line 390
WAY too early. scheduler is not started then
Isn;t that stuff directly related to plugins tho?
makes no difference
no scheduled task can be run before the server finishes loading
His server jar has impact on that?
the scheduler doesn;t allow it
Features
Sentry Integration Easily track all errors coming from your server in excruciating detail
Better Entity Performance Reduces the performance impact of entities by skipping useless work and making barely-noticeable changes to behavior
Partial Asynchronous Processing Partially offloads some heavy work to other threads where possible without sacrificing stability
8x Faster Map Rendering Reduces or eliminates lag spikes caused by plugins like ImageOnMap or ImageMaps
30% faster hoppers over Paper (Airplane)
Reduced GC times & frequency from removing useless allocations, which also improves CPU performance (Airplane)
Fast raytracing which improves performance of any entity which utilizes line of sight, mainly Villagers (Airplane)
Built-in profiler which has 0 performance hit and easy to read metrics for both server owners and developers (Airplane)
Faster crafting, reduction in uselessly loaded chunks, faster entity ticking, faster block ticking, faster bat spawning, and more!
Complete compatibility with any plugin compatible with Paper
And more coming soon...
you can queue up tasks in yoru plugins startup
but none shoudl run until the server is started
Who knows why people use these weird forks
Yeah no, not even with the changes
Running normal paper
Trying now
Its an issue with pufferfish starting the scheduler too early
i noticed when i run something async it starts a thread number but it keeps always increasing. is this thread number the total or the number of active threads? like im afraid im supposed to "remove" them in some way to maybe decrease potential lag later on
yep, it's not your codes fault
complain to pufferfish they are starting the scheduler too early
didn't?
scheduler starting too early? then it's one of his plughins causing it, via version perhaps
time to binary search the plugins if its not via ver
yep 395 the scheduler starts, too early again
Even for paper?
has to be a plugin causing it
Aikar's Timings Viewer - View Timings v2 reports from Paper and Sponge
yep
no task shoudl run before you see Done (15.268s)! For help, type "help"
line 428
via ver might but ive never seen that happen with it
Let me install viaversion on my terst
whatever is giving this output is the likely culprit[22:12:06] [Server thread/INFO]: Successfully loaded using bukkit version: v1_19_R2 [22:12:06] [Server thread/INFO]: Found LuckPerms! Hooking in. [22:12:06] [Server thread/INFO]: Running delayed init tasks
looks like that runs after BetterPrefix is enabled
It should run before actually. But that doesn't require vault
Indeed now the error is in my test server too
something there is doing naughty things and kicking off the scheduler early
Ok the wierdest thing happened:
I copied his plugins folder to my test server. It worked with all loaded plugins. I copied all the plugins back to his test server
And now it worked
wtf?
scheduler workign as it should?
idk about that part but it's registering vault
And just started his pufferfish
jar
And it registered vault too
what tf
I blame sunspots
That're the resons i dont MC server hosting and just like using vms rather single Sever host
Cus they aleays internallh inject a custom plugin so they can limitur severs by diff ways
Some of that was English 🙂
??
Anyone know what this is for? In the yt video im following it gives me an error
Isn't that old from mongo?
Is there a way to disable a event for just one player?
Probably the vid is 4 years old xd
MongoClient client = MongoClients.create();
If I'm not wrong
Aight
Cam haber some sintax issue I'm.currrnt on cellphoen
oh god
you still havent learnt java and your doing mongo
I,ll take that as a joke
9xx2 was here yesterday for basic java syntax issues
i also had a string with "uri" and not sure that was for however i made a config to connect my mongo to
Because most ppl learnt the lang where coding beforr uskng apis/libs 💀
they got told to learn java a lot and then left
Righg
Nah its because i solved it
I watched a few tutorials about basic java that a few hours and none of them covered Mongo so im not sure thats basic java
Nvm solved it
how is the list Bukkit.getOfflinePlayers() made? like who are the first in this list? is it based on players joined, so 1st player ever joined will be first, 2nd is 2nd and so on... or is it different each time when server starts? or something different than this
Sure. I've replaced existing blocks which where useless to us.
There is no good method currently to add custom blocks to the game
I think the first few ones are those in the offline player cache. From then on it loads the players in whatever order they are
on the File system.
so based on their uuid alphabetic order
Yeah probably
How can I change the output of a message in console? Why does it look empty?
https://cdn.discordapp.com/attachments/741875863271899136/1076323819234545704/image.png
do you modify the content
Yeah placeholder stuff
format = format.replace("{PREFIX}", getChat().getPlayerPrefix(player));
format = format.replace("{NAME}", player.getName());
format = format.replace("{SUFFIX}", getChat().getPlayerSuffix(player));
format = format.replace("{MESSAGE}", message);
format = colorize(translateHexColorCodes(this.getServer().getPluginManager().isPluginEnabled("PlaceholderAPI") ? PlaceholderAPI.setPlaceholders(player, format) : format));
event.setFormat(format);
modify the format and use %2$s as the message
Like to test? replace format with %2$s?
%2$s is the plaecholder for the message
make sure its on async chat event on high/highest priority too
console might be stuff relating to secure profile
change priority
It has been on highest
Nope, nothing at all just no player displayed
@EventHandler(priority = EventPriority.HIGHEST)
public void onChat(AsyncPlayerChatEvent event) {
if (CHAT_ENABLED) {
String message = event.getMessage();
Player player = event.getPlayer();
event.setMessage(ChatColor.translateAlternateColorCodes('&', message));
String format = "%2$s";
format = format.replace("{PREFIX}", getChat().getPlayerPrefix(player));
format = format.replace("{NAME}", player.getName());
format = format.replace("{SUFFIX}", getChat().getPlayerSuffix(player));
format = format.replace("{MESSAGE}", message);
format = colorize(translateHexColorCodes(this.getServer().getPluginManager().isPluginEnabled("PlaceholderAPI") ? PlaceholderAPI.setPlaceholders(player, format) : format));
event.setFormat(format);
}
}
