#dev-general
1 messages · Page 157 of 1
idk why even minecraft blocks access to some classes like WHYP''
wut
like
with anvil guis
you have to do some realy wierd stuff
cause mc blocked access to some class functions
What's saturation? (Currently looking at player.setSaturation(Int))
saturation is when u eat and then it gives u saturation until the next time u need to eat afaik
the more saturation, the longer the time before ur hunger bar goes down
ah
Also - does .setFoodLevel do what I think it does? - that being, set your hunger bar
yea
Is there some API limit, or ?
as I have two loops altering the hunger bar for 10 iterations each
What are the good things about using yaml to store data? Like I could use MySQL but never rlly worked with it and ye I wouldn’t use my plugin in a network so no need for that I suppose..?
Need opinions
Mackenzie, this ain't discord
@pastel imp sqlite maybe
You can spam shit as much as you want, just like ya know don't call it thousands of times a second
Yaml isnt the best storage option
Depends what kinda data
@hot hull
Bad enough that the api is shit :p
That's fine
I see no change in hunger bar though
Welp store like player levels
Also please do not do what you're doing
You telling me that frosty, or Afonso?
So would be something new for me
What is a better wait then?
Sql it's not that hard
Runnables
What do you need to store?
Yes lets all just put the main server thread to sleep 🙂
:))
Where did you learn about Thread.sleep? If it was from a person, please block them
Gn
What’s the difference between sqlite and MySQL? Also store player level/xp
An int
For each player
If it was a google link, please delete it, just forget about it
sqllite is local
Sqlite store data to a file
@hot hull You're welcome to murder me.... StackOverflow
And mysql has some functions that sqlite doesnt if im not wrong
Yea
Don't go in our lord and savior kangarkoo's steps please
Frosty, can you give me some wait code?
I mean each of the diff sql implementations have diff features
runnable
I am noob
So what’s my best option?
Don't go in our lord and savior kangarkoo's steps please
WHo the hell is that?
Oh that plugin academy weirdo?
:))
oh
MySQL I suppose?
He closed his company or some shit now I think
oh
Probably nobody
xD
Wait depends on what?
Plenty of people bought it due to sheer stupidity
On what you need to store
As said INTs
Show us the class defenition maybe?
Don’t even started
A basic plan would suffice
I am trying to know how I will store it
Ah
You can most probably just go with Sqlite for most cases
You can also use persistent data if you are on 1.14+ I guess
Depends how you do it
But is a lag free option though?
@pastel imp
Completely on how you manage that
Avoid connections on the main thread
Which means?
Handle transactions on other threads
Ye idk what you are rlly saying there xd
If they get xp each 5 ticks you dont want to constantly update the database if im not wrong
Do you know what a Thread is?
As said never used SQLite
Thread indirectly yes
But you better explain to be sure
Lol
Qustion, will bukkit remove from memory already run / cancelled runnables?
If they get xp each 5 ticks you dont want to constantly update the database if im not wrong
@distant sun ye they would get xp by mining blocks?
So I would need to store the data in a var and like each 2minutes or so store it in the database?
Welp actually good question
I am gonna use the xpbar as progression system
Qustion, will bukkit remove from memory already run / cancelled runnables?
@distant sun bukkit removes nothing from memory but I'd assume it doesn't randomly keep references of your runnable objects
Probably
I mean the xpbar is percentage
I just get the amount you need to go from level 1 to 2
And get the amount the player has
And voila
?
dont use the spigot methods for that
What exactly are you even trying to do
They are shit
What exactly are you even trying to do
@old wyvern player levels
You just want to set a player's level?
dont use the spigot methods for that
@distant sun you mean the setLevel etc?
You just want to set a player's level?
@old wyvern I want a custom level system
get / setTotalExp
But I won’t have the vanilla system
Oh dont use spigots set level for that lol
Can probably do some math and use it @old wyvern
is there anything plugin breaking in 1.16.2 update?
?
So what would you suggest using then?
Actually
What was the reply about gab?
If you set the level to X, will the xp also change?
xp is just the visible bar afaik
The amount you have yes
0 to 1
But what I am thinking isn’t getting the amount xp the player has
But the progression of the xpbar
As it’s 0-100
So if I have 50% of the xpbar
And xp needed to level up
Ye but can you use setLevel without modify the total xp?
Ye but can you use setLevel without modify the total xp?
There is no total xp
There is no total xp
@old wyvern ^^
No?
Yes
how so lol
Confused me a lot when i was working on something last year tbf
Xp is a separated system
how so lol
wdym?
But the xpbar works as a percentage
I know
getXP just returns the percent of the xp bar filled
anyways
getLevel gets the current level
You can get the total xp with some math tho
Theres a function on the wiki for that
So means if I block ANY vanilla ways of getting xp I can use the default xp storing system in my advantage? Xd
Dont
Why
It will be a pain in the ass, trust me.
Don’t think it will
Then go ahead 🙂
👍
on a scale from 1 to 2 how hard would you say making a global chat plugin that only players with a permission would see is?
1
btw I have no bungee experience and just some basic spigot
Oh bungee support?
Global as in bungee?
I guess you can use plugin messaging event
Well 1.2 then
And get the message then broadcast it to people with a certain permission
1.6
You probably dont have to use bungee at all
xD
than went from 1 to 1.6 very quick
well then how would I broadcast it on other servers?
Ye xd
Check if plugin message event its on spigot or bungee
I suppose Matt's FM works on bungee btw?
How do I do a for loop with a wait in it? (Minecraft, pls give code)
Become Self Reliant
@lavish notch What kind of wait
One that laggs the server, i'm guessing not 🙂
I guess like a count down is the best way to desribe it
Ah okay
??
class Countdown extends BukkitRunnable {
int i = 5;
@Override
public void run() {
//do something with i.
if (i == 0) {
//countdown finished
cancel();
return;
}
i--;
}
}```
So I had this Bukkit.getScheduler().scheduleSyncDelayedTask(main, () -> commandSender.setFoodLevel(finalI), 10);
..and to do what I needed was Bukkit.getScheduler().scheduleSyncDelayedTask(main, () -> commandSender.setFoodLevel(finalI), 10*finalI);
difference being *finalI
(The loop iteration counter)
oh yeah that works as well 👍
yep
And one, breaks the other with Plugin already intilialized how can I fix it?
Plugin.yml for one:
name: "Wack"
main: "ml.mackenziemolloy.Main"
author: "Mackenzie Molloy"
version: "1.0"
apt-version: "1.15"
commands:
wack:
aliases: [wk]
description: Main command
No
ml.mackenziemolloy.<pluginname1>.Main
class Countdown extends BukkitRunnable {
int i = 5;
@Override
public void run() {
//do something with i.
if (i == 0) {
//countdown finished
cancel();
return;
}
i--;
}
}```
@heady birch NO
I mean use Consumer<BukkitTask> 
https://gist.github.com/Jaimss/f67ec1d63e043abbe5fc7ab6a6387a6d should i submit this as a barry command for a link for people who ask about update checkers
aye my man got a Kotlin example
yessir
i did it in kotlin first then decided to add java for the people who use java lmao
wait what is KHttp?
its what i use for json requests
ah a Kotlin HTTP library
yea
ah okay it uses org.json
@prisma wave if only i had used pdm
WOW
no thats a you problem
sounds like user error
goddamn kotlin-reflect adding another 3mb 
also there have been many bugfixes since
well i can guarantee this plugin isnt going on spigot anytime soon
it will if you PDM™️ it
do you want me to try pdm again
Relocations when
Or do you want me to link you previous examples of how to do the class loader stuff?
Lol what
im stupid ignore me
Oh
excuse me
pdm good
wow
veri good
no
no?
you're doing it wrong probably @remote goblet
aight
i am innocent
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '6.0.0'
id 'org.jetbrains.kotlin.jvm' version '1.3.72'
id 'me.bristermitten.pdm' version "0.0.18"
}
dependencies {
// Overlord language
pdm "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
pdm "org.jetbrains.kotlin:kotlin-reflect:1.3.72"
// Spigot Stuff
compileOnly 'org.spigotmc:spigot-api:1.16.1-R0.1-SNAPSHOT'
compileOnly 'me.clip:placeholderapi:2.10.9'
pdm 'dev.rosewood:guiframework:1.1.1'
// Other
compileOnly 'com.zaxxer:HikariCP:3.4.5'
}
jar.dependsOn project.tasks.getByName('pdm')
there isnt anything else to discuss 
are you running gradle shadowJar
absolutely 
gradle build
i do
lol
these are things you should explain on your readme that are comprehendable
jar.dependsOn project.tasks.getByName('pdm') //Always run the pdm task when we build. Alternatively, just run [gradle pdm build]```
tell them they need a computer as well
that is very comprehendable
i aint read that far
wait are you not suppose to use gradle shadowjar?
ori 9head
not with pdm
I was told to use that instead of gradle build
if ur not using pdm and need to shade then yes shadowjar
^
ah Ic
Jython is a new garbage language
java + python = jython? sounds awful
Jython is an implementation of the Python programming language designed to run on the Java platform. The implementation was formerly known as JPython until 1999. Wikipedia
Sounds like
absolute
yesterday you were idolizing clojure
fucking garbage
If you can't handle the truth we can't be friends 🙂
I can't handle the truth

now fuck off with yo garbage languages
kotlin good
Jython is the future, today
The end.
Just code in electrical pulses
Unlike all of these gimmicky languages
Shock the motherboard real quick
Jython is consistent and powerful
now lets find where that jar file went
Second only to JRuby
shit I can't change my name
wym ori
Skript my dude

Skript will always hit different
OOWWW
i am home
not drunk
:)
just stupid
ori why u have minusonehead
ah found it
perhaps its being used already
just put a J infront of everything now ig
make new class called Main that extends JavaPlugin:
when Main is enabled:
kill every player
clearly
what the fuck
this is the future
lmao
it is expressive but powerful
not even funny
clean and concise
there will exist plugins that code plugins
This is getting concerning
very
you cannot handle the truth
no u cant
nor deny it
this is objectively superior
now to fix it
you don't need to worry about complicated algorithms anymore
evenhandedly
brister despite the fact you now think kotlin is bad
can you tell me wtf this means
fallacious error

OH NO
what
peepoSasd
https://www.reddit.com/r/kotlinmemes/comments/i8plbu/why_kotlin_sucks/ @prisma wave delete it
oh wow
Wtf happened there, he started having stroke at the end
it's the real james gosling
i fuqking hate maven users fr
if its maven
It's fugly
you can still get gradle still

yes
Im gonna pr
IM SO friking good in eng.
howly
yay just got notification that i have windows update waiting for restart of pc.
eh
do ur thing
?
udpate
so shaded stuff and dependencies is fuqed
@steel heart you do realise that all that gradle does when publishing is generate a maven pom?
You don’t really know the context but that’s correct.
kids a pyschopath
@agile stag what do you have to say for yourself
Fuck you
Kotlin good
No
kotlin very good
Java as a whole sucks major dick
C# is better and faster
Ur dumb
Kotlin gets interpreted into java
That isnt efficient at all
probably
it compiles to JVM bytecode
That's different to being built on Java
whatever that means
bruh java is speedy gonzales
...
no kotlin is speedy gonzales v2
No
They're literally the same speed
They compile to the same thing
The kotlin compiler is literally faster than Java's in some situations
Faster != efficient when compiling
What are you basing these remarks on?
just like java...
Its me vs everyone here im not gonna win any arguments
What are you basing these remarks on?
the best tool of intellectual argument, opinion
🤣
you're not going to win because you're wrong

Nothing to do with how many people there are
Whatever you say
Both are slow anyways

In what world
C is better :)
Electrocute your motherboard with proper timing
damn now thats speedy
kotlin is ancient
C is better

kotlin bad motherboard shock good
nope
no
You are wrong
Just plain wrong
Clearly the system has brainwashed you
Wake up
Keeple
u are brainwashed
I need to use motherboard shock device to shock mitten
hes brainwashed for thinking kotlin compiles to jvm bytecode 
cuz i said so kid lol
o
insane
u got him good there
so with that in mind
Tell me what is the best language?
😬
the best language is in fact vbscript
of course
😳
It all makes sense now
cant disagree with that
I was just too 4headish to see it
Fun fact
Changing your nick on mobile lets you see all of the roles
oh yea i remember seeing that
mildly interesting
indeed
Dummy-tier I and II aren't applied to anywhere, why those exists 
¯\_(ツ)_/¯
Maybe Barry makes copies of every tier automatically
@onyx loom proof for that pls
Anyway, I'm finishing this (probably stupid) move in the code project rn
Converting from JSON -> yaml file
And some placeholders for my World expansion
Just create a json converter
That's what I'm trying to do?
I mean, the format code, not the validation
that might be a cool side project
A tool that could convert between markup languages
Yaml > JSON > XML > toml
And korm ofc
I'm almost finishing the convert part when this screwed me off:
yaml1:
- 1
- <package..smth>
- 3
-4
with this json:
[1, {"Hi","Hello"}, 3, 4]
Map lists
I'm trying that method a while back, probably gonna re-make it
ssh-keygen -t ecdsa -b 521
what would that do?
create an ssh key
ssh keys don't have permissions
the key is just a password
you're free to limit the account it's linked to though
it's literally just a file with text in it
anything else you want is done on the server
I feel dumb but I know nada about this
ty anyways
very helpful
btw
how would I manage the permissions then? like in the server
what sort of permissions?
accessability to directories
you can't
you'd have to virtualize them
for sftp, you can chroot
but there's no way to limit ssh like that
do not use ftp
if all you're worrying about is sftp, disable ssh access on the account and chroot the directory
however, if you really require fool proof permissions of the sort, virtualization is the only way
depends on the level of virtualization
docker for example, may be fine
or you may need something like proxmox
what's it for out of curiosity?
what's he trying to do
well he is basically trying to give me limited sftp access
Why not just make an account that only has access to a certain directory
uhm I mean if that is possible
As far as I know it is
it's not fool proof vb
Ah
with ssh access, workarounds will always be possible
Huh
oh my bad it's sftp
TIL
shitty software running on root that can be accessible from a non-root account for example
Oh yeah good point
This power point contains MACROS would you like to allow third party MACROS?
Does
public static boolean pCB(String pathBoolean) {
return plugin.getConfig().getBoolean(pathBoolean);
}
and
plugin.getConfig().getBoolean("path.hi")
do the same thing ?
yes
🤔 then why my plugin is crashing (getting error)
probably because pcb is static and when you call it plugin is null or something
Would be easier if you showed the error 
ok wait
utils line 39
plugin is probably null
or the boolean doesnt exist in the config
ok let me check
@obtuse gale which class are u talking about ?
@prisma wave why not just make pdm not limited to plugins 
It isnt
I remember him specifically telling me its possible to use with your own class loader
Let me find that
well the pdm itself implements the spigot api aswell so 
Not everywhere
Just in specific places
If you dont load those classes it would work fine
If you load it with a different approach it can be used outside of plugins
It's just not convenient at all
Gross
https://i.gyazo.com/67cb7699a074afd41499d0292077d29a.gif my plugins work
Kotlin
well yes
😍
Someone using my API 🙂
Jesus christ
thats one thicc main class
Lightweight dependency injection frameworks?
no
guice
spring
pico
cdi + weld
open web beans
https://paste.helpch.at/dkfjfjfj.cs someone just sent me this to review. How do I tell him in a nice constructive and respectful way how bad it is? I want to rant but that won't make our relationship better
oi fuckface, your codes shit
Ok. I've told him its shit because of the redundant checks, arrow code, lack of switch, unused if else, bad naming. Anything else?
Once he fixes all of the above, send it again
He said he will recode it once he fixes his problem...
nono it doesn't work like that
He seems quite arrogant now and says that his code doesn't need to be recoded
He says it works so its fine
then why did he ask you to review it...
Just don't respond to him anymore, ez
Ok
@remote goblet yeah like yugi said. If there was actually demand I'd decouple PDMBuilder, but I really don't think anyone is gonna be using it outside of plugins rn
using it for discord bots would simply be 
i tried it and instantly got an error where it was just like
not happy
couldn't find anything 
but aye
it shortened my jar file from 27mb to less than 300kb
so thats cool atleast
chances of this actually working
Probably slim
Actually
It will probably work it's just not a very efficient way of storing them
Because you only include positive X and positive Z
@prisma wave am I thinking wrong about yesterday or this doesn't make any sense:
Btw, did you know of js-expansion yet?
is there a way to listen to both piston events in 1 function? instead of having 2?
@regal gale what happened yesterday lol
About JSON here:
"json": {
"data": {
"group1":"Hello"
}
}```
When I called Data.get("data").json.data, it returns an empty string (supposedly Data.get() is actually getConfig().get())
Well yeah
But using Data.get("data").json.data.group1, script throws error cause "property doesn't exist" or smth
Because the path would be "json.data.group1" ?
The property that doesn't exist is "group1"
Supposely your assumption is already applied before
Btw the yml is like this:
data:
json:
data:
group1: "Hello"
But using Data.get("data").json.data.group1, script throws error cause "property doesn't exist" or smth
@regal gale
perfect
VBScript 
Does something like get().json work @regal gale ?
@obtuse gale it's the best language
Objectively
Returns empty string
That kind of makes sense
y u do dis 2 me
what happened to clojure
I still don't get why path returns empty then error at the end
and how do you know so many laguages
Firstly
Never use requireNonNull in kotlin
@obtuse gale idk VBScript piggy just convinced me it was superior
Erm.. my problem please 👀
@remote goblet
val value = getString() ?: defaultMessage
return value.colorify()
@regal gale I'm pretty sure what's happening is that Data.get is returning a LinkedHashMap, and as such JS can't do property access
Try printing out the result of get()
Pretty sure it will be a Map
On phone rn so I can't test
Why that item for border
i like it
what da fk:
org.bukkit.plugin.IllegalPluginAccessException: Unable to find handler list for event org.bukkit.event.block.BlockEvent. Static getHandlerList method required!
lmao
apparently this line:
pm.registerEvents(CropPistonListener(cropStorage, cropDrops), this)
i guess BlockPistonEvent isnt valid event :?
:))
Do you listen to BlockEvent?
i listen for piston retract/extebd
ye but to BlockEvent?
BlockPistonExtendEvent / BlockPistonRetractEvent
Does Kotlin have a way of forcing classes that extend another class to implement a static method?
not really, best option is making every companion object implement a certain interface
static inheritance is kind of a hack anyway
not really, best option is making every companion object implement a certain interface
@prisma wave That works for me, ty
@prisma wave got another issue here:
I have my data class Attribute defined like so:
data class Attribute<T> (...) {...}
and a 'Unique' interface:
interface Unique<A, T> {
fun from(id: T): A
}
So now, I'd like the Attribute companion object to extend that Unique interface
data class Attribute<T> (...) {
companion object : Unique<Attribute<T>, String> {
override fun from(id: String) {...}
}
}
But the compiler doesn't see T as a generic type
and doesn't know what to do with it
class Attribute<T> works, but in the companion object Unique<Attribute<T> doesn't
Oh shit
right yeah that makes sense
Can I make it return an unspecified Attribute<?> ?
If I wanna use the same project on two pcs and imma do this through git, do i add the .idea stuff? Or just let IJ auto generate that on the second pc
Im willing to bet 5 bucks im gonna get issues with this lol, especially since its different OS's for each pc
Don't include .idea
alright how bout .gradle?
er
what if it didnt make one
I manually made one so I think that overwrote it or smthn
https://github.com/katsumag/ItemActionsLib/blob/master/.gitignore this is the one it auto gens
alright
this is all id have 
@prisma wave for PDMs relocation, have you looked at Lucko's jar relocator? https://github.com/lucko/jar-relocator
Not in a whole lot of detail
but yeah
Will probably end up using that
although I'd prefer an in-house solution
I changed my .gitignore to add something new and its not removed off the thing, do i need to manually remove it first? If so how
git rm (--cached if you want to keep it on the file system)
talking about shading:
[15:23:01 WARN]: [VirtusCustoms] Loaded class eu.virtusdevelops.virtuscore.utils.TextUtil from SimpleCrops v1.0-SNAPSHOT which is not a depend, softdepend or loadbefore of this plugin.
so should i like do what since i use same core in all my plugins.
softdepend on the core
no
core is not seperate plugin
its built into each pl
i just shade it in with fatjar
I mean in all honesty you can ignore it, since that's just spigot being smooth brained
okay.
but then theres problem if one of my plugins runs older version of core, other plugins try to use that and get error something like function or something thats missing in older version.
relocate it
yeh i need to guess how to do that
u using gradle?
shadowJar {
relocate "path", "new path"
}
Make sure you have the plugin imported ^
id 'com.github.johnrengelman.shadow' version '5.2.0'
oke
Ne spremlam, sej gre vse skup u kurac pocas
XD
6.0.0 katsu
¯_(ツ)_/¯
Just use 6.0.0 github outdated
oke
so how exactly is that gonna work?
i did:
relocate "eu.virtusdevelops.virtuscore", "eu.virtusdevelops.virtuscorecrops"
Can you specify a companion object in an interface?
I don't believe so
I guess it "can"
In Kotlin, an interface can have a companion object but it is not part of the contract that must be implemented by classes that implement the interface. It is just an object associated to the interface that has one singleton instance. So it is a place you can store things, but doesn't mean anything to the implementation class.
What would one call a package with listeners inside it which manage entity mechanics, I already have a base mechanics package for it, and I don't wanna name it the same, any suggestions?
"listeners" yeah
ie.
mechanic.handler or mechanic.listener probably ?
Not what I'm asking
what ya asking then? (napisi po slovensko ce neves kak bi eng explaino)
I'm gonna have a subpackage for the entity one, because I want to seperate them, but I don't want to name them mechanic because it'd look odd, so I need an alternative word for it
oh so you dont want like mechanics.mechanics?
So something like mechanic.listener.entity?
but that's vague af, the entire mechanic category is listeners (with the expection of the event package)
mechanic.entity.listeners.bukkitevents.listeners.help.mechanic.core
howly
bruh, inb4 NIall pops up
but that's vague af, the entire mechanic category is listeners (with the expection of the event package)
@hot hull mechanic.entity.mob
frcsty ur intellij theme bad
Leave
why do you say its bad, each person has its own taste???
....
It is butiful.
horrible
wth is that resolution?
to be fair the themes not that bad on its own, that combo you got going there is a bit weird tho
with the grey
wtf
3:4
square!
semi square
Rectangle
u wot Gasper
for me its square
Your 4head is a square
noice
I like how you say you like oceanic theme and yet the actual code portion isn't oceanic xD
I see you copied my string color ;p
It's butiful
Need to figure what to do with the oranges in my color scheme i don't like them
blue 
pink
or purple/pink
Lot of orange
It's a shame all classes have to be the same color
Would be nice if you could customize it further
cant be ping due to all purple
Pink is for static
try tomato color
use the background color 
let's see
Oh god, that's worse
try this:
#ccff00
Yuck yellow xD
It's like a lime
No seriously, the one I pasted above is 
Just a sec
Lot of orange
@ocean quartz I need that color scheme plis
Do I see sorcery?
rainbow brackets?
Damn imagine if you could make everything rainbow
you can
rainbow brackets is a godsend
technically
Elaborate Johnny





