#help-development
1 messages ยท Page 1949 of 1
idk
How would I be able to fix this error? I get this in console every time I execute a cmd
[14:25:06] [Server thread/INFO]: laptev issued server command: /particle heart
[14:25:06] [Server thread/ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'particle' in plugin Heart-Projectiles v1.0-SNAPSHOT
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[airplane.jar:3284a-Spigot-3892929-0ab8487]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149) ~[airplane.jar:3284a-Spigot-3892929-0ab8487]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.dispatchCommand(CraftServer.java:790) ~[airplane.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.server.network.PlayerConnection.handleCommand(PlayerConnection.java:1931) ~[airplane.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1770) ~[airplane.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1751) ~[airplane.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:46) ~[airplane.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:1) ~[airplane.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:30) ~[airplane.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.server.TickTask.run(SourceFile:18) ~[airplane.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.util.thread.IAsyncTaskHandler.executeTask(SourceFile:151) ~[airplane.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[airplane.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.util.thread.IAsyncTaskHandler.executeNext(SourceFile:125) ~[airplane.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.server.MinecraftServer.bf(MinecraftServer.java:1148) ~[airplane.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.server.MinecraftServer.executeNext(MinecraftServer.java:1141) ~[airplane.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.util.thread.IAsyncTaskHandler.awaitTasks(SourceFile:134) ~[airplane.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.server.MinecraftServer.sleepForTick(MinecraftServer.java:1125) ~[airplane.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1054) ~[airplane.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[airplane.jar:3284a-Spigot-3892929-0ab8487]
at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.hasPermission(String)" because "this.player" is null
at me.rockorbonk.candor.laptevsorder.LaptevsCommands.onCommand(LaptevsCommands.java:66) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[airplane.jar:3284a-Spigot-3892929-0ab8487]```
read the stacktrace
I did
java.lang.IllegalArgumentException: File cannot be null
Im trying to edit a mobs attack damage but skeleton.getAttribute(Attribute.GENERIC_ATTACK_DAMAGE).setBaseValue()
doesnt seem to work. Anyone know anything about this?
and make sure your file isnt null
if (customFile == null) {
setup();
reload();
}
return customFile;
}```
idk what that is
is that in response to the codei j ust sent
it said file cannot be null in the stack trace, so wouldnt if (customFile == null) not work
i guess setup sets up your file and the fileconfig
hey how would i make it so i can use this syntax in a config file?
effects:
- ABSORPTION:3:120
- REGENERATION:3:8
EFFECT:AMPLIFIER:DURATION
PotionEffect effect1 = new PotionEffect(PotionEffectType.ABSORPTION, 120, 3);
player.addPotionEffect(effect1);
Do you guys recommend any config API?
org.bukkit.configuration.file.YamlConfiguration is great
if i get player location in player move event is it the new or old one?
event.getLocation()?
i know
or event.getPlayer().getLocation()
i mean if i use event.getPlayer().getLocation() is it new or old one?
i guess the current one
is it before or after movement
I'm trying to return the value of what T is. Anyway I can do this?
wait there is getFrom and getTo
What class T is sorry, like if there was a T.class or something
you can't return T's class, java is type ereasired
you can't, java have type erasure
T.class?
NO it won't work
wont that work
not possible with generics
I see
ah ๐ฅฒ
java erase all generics on compile
new T().getClass() :kekw:
it replace them with Object and insert cast
I'll explain what I;m trying to do overall then
your option is probably to accept Class<T> in constructor so you can have it
so it'l be new ItemAbility(String key, Consumer<T> ability, Class<T> clazz)
and then you store it in field
and return it in your method
wont work
basically I want to add abilities using persistent data containers. My plan was as follows: when an event like a right click occurs, look at the tags of the item. Tags would be an ability id, id would go into a hash map to get an ability, then check if the class of the fired event matched the event class of the retrieved ability. If it matches, fire the ability.
then do what i said, accept Class<T> in constructor, store it in field and return, tho you will need to specific the class twifce on instantiation like:
new ItemAbility<MyClass>("", e -> {}, MyClass.class)
yeah which seems annoying
that's annoying but it's the only way
I could remove the generic
it's not C#
but that means having to cast in the consumer
that's what java do on compile basicly
it remove generics, replace everything with Object and insert casts, thats also the reason you can't have primitive as generic type
right
I'll try this then ๐
how would i make it so i dont have to check the config value every time inside a listener
should i update all the variables in the reload()
wat
checking a config value isnt actually demanding at all
o ok thanks
that
was
the
joke
hence the :kekw:
i just thought it would be, whenever a player clicks a certain item it would have to open the file
as ive been told its like a hashmap with a (optimally) runtime of O(1)
the config is always loaded I believe
ty ๐
np
anyone have any ideas for this? multiplying the baseValue by 5 doesnt make a difference at all
also another thing about config, how do i make it save the old config to a different file if the config is messed up? and generate a new one. or maybe something like a version , so it would convert if necessar
@tender shard do you have the link to that one? I remember earlier someone said you had a good one
hey could you show an example if you got some time please?
im writing some sort of storage implementation but im not sure if i would delegate it
Does plugin.getLogger().log(Level.SEVERE, "something", exeption) also prints the stacktrace?
You should use modifiers tbh
what would be the best way to detect if an flying redstone machine goes to the specific chunk and then make it stop
exeption object != stacktrace
or at least how to detect it
then I can just remove all the power like redstone blocks to stop it
yea i know but will the method handle printing the stacktrace too?
doubt it
hm
can i use onPluginDisable event instead of javaplugin's onDisable?
also can i use event.getPlayer().performCommand() in playerquitevent?
the player is still there at that moment i guess
i think so, but thats a tryandsee moment
?tas
how do you set up mongodb with the plugin
So currently I have a design that'll only show the enemies the player has encountered in their enemy catalog. I achieve this by, when attacking a new enemy, checking if they have that enemies specific permission, then giving it to them if not. Then in the enemy catalog GUI, I check for each of these permissions and make the enemy appear if they have it. Thus, I'll have about 60 unique permissions total for the enemies. My question is, is this efficient? Is there a better way of achieving the same thing?
all im getting is outdated stuff using deprecated methods
Compared to a simple HashMap, not really efficient CPU wise, but it could be more efficient memory wise
HashMap containing what? A UUID and List<String>/List<Integer>?
You'd actually want an enum instead of a string/int ID
Wouldn't the hashmap have be to writen/read from a file on startup/shutdown?
Actually, Set<CustomDatatype> (CustomDatatype being a record(UUID, EntityType)) might be better here
And yes, you'd need to write/save it
better than permissions atleast
Btw I'd actually say that killing an enemy gives you their permission.
Means you can't just hit one once and then run and gain the entry.
So completionism is harder.
(Also means you have to kill the ender dragon/wither to get their entry)
But that's just some gameplay feedback.
Gotcha, the way the battling works in my plugin, rewards are only added upon a battle end so that shouldn't be too bad
Would this only work with existing minecraft mobs? All enemies in my game are Citizens2 NPCs
Well, then use some other identifier instead of EntityType, ideally it is an enum, but anything with a fast-ish .equals() and .hashcode() method should suffice
uuid maybe?
There are multiples of the same enenmy
I recommended enums bc of the EnumSet class, which acts as an abstraction over bit flags.
or wont that work if the npcs are no actual entities?
I'm having trouble trying to think of how this EnumSet would work. Would the EnumSet be contained within a hashmap? And what would the EnumSet look like? I have enemies differentiated by name. So would the set contain "Enemy Name 1", "Enemy Name 2", etc?
I think it would work like
Usually you'd want to identify it using an enum, not using a string
HashMap<UUID, EnumSet<EnemyType>>, where UUID is the player who is assigned with the entries in EnumSet, and EnemyType is the enemies they've seen so far.
You do need to do a computeIfAbsent before accessing the value, since a player might not have one yet.
Alternatively Set<Map.Entry<UUID, EnemyType>>, which would reduce a lot of the enumset allocations
Interesting
However it would be less efficent memory-wise if there are a lot of players with high completion, but would be more efficent if there are a lot of players with almost no completion
is there any issues with using YAML for large databases since I know JSON can be corrupted
In both cases, what would the enum EnemyType be? Not too experienced in enums
Probably the latter, but I'll keep both methods in mind
not really as its a map internally
but i would use a db
Honestly collection allocation is the least important thing when it comes to optimization.
My solution makes lookup time very fast.
What is the advantages of using a database over a YAML file
Depends on your code, however I imagine something like this:
public enum EnemyType {
ENEMY_TYPE_1,
ENEMY_TYPE_2,
ENEMY_TYPE_3,
ETC;
}
Meanwhile mine makes the random lookup/write times faster
you can store stuff in a relational way with f.e. tables for each type of stuff you want to store
Heh, useless microoptimisation
Battle of the Java titans
(While I believing storing a set of entries is not only redundant (since HashSet uses HashMap underlyingly), but lookup requires an iterative process where you have to check contains multiple times, instead of a single get and iteration over the result)
I'm not gonna be storing much, just a number to a UUID so I'll go with YAML. Thanks for the help.
ye if youre only storing that kind of stuff i think yaml is better
Also the monolithic map/set approach is far easier to make atomic which is why I usually use it over nested maps/sets as having "fully async capable" is probably a good (albeit useless) selling point
I mean you can just make a custom wrapper type
Although in this case I think both have more or less the same atomicity as long as you use putIfAbsent
Although in this situation I don't think he needs async
Is there an advantage of putIfAbsent over .contains() == null?
acutally just if .contains()
I still recommend computeIfAbsent
Got it
putIfAbsent requires you pass the value to put, which results in a useless allocation if you don't need to put a value in there.
While computeIfAbsent allows you to pass a Supplier function
Interesting
what if he just wants to put a value?
Then put :p
Well my point is that if the value isn't absent, a call to putIfAbsent does more than it needs to.
While computeIfAbsent does effectively nothing in the same situation.
I mean, the chance of there being a race condition is minimal enough so there isn't too much of a diff, but interesting to note
how to fix mob (villager) looking down by default?
Not more than expected
More than it needs to
When you do putIfAbsent(key, new MyValue())
You have to instantiate MyValue to call putIfAbsent
while computeIfAbsent(key, MyValue::new /* () -> new MyValue() */) doesn't instantiate it until necessary
I'm pretty sure putIfAbsent exists as a pre-Java 8 method.
Object o = map.get(key);
if (o == null) {
o = new Object();
Object var10001 = map.putIfAbsent(o);
if (var10001 != null) {
o = var10001;
}
}
In the rare case that something is added between get and putIfAbsent, the new Object allocation is useless there
Is that the decompiled code or smthn?
What is the best way to handle anti swear? Regex?
what is the yaw and pitch for mob looking forward not down?
I have been looking at too much decompiled code so I start using stupid var naming
A hundreds of lines long filter
Good luck
Pff
It looks too much like decompiled code
It's the fact that you're storing each value in o
It reminds me of like
If the compiler did multiple ASTORE instructions to the same local
Yeah, this is intended and I do this very often in production code nowadays (just not with o as the var name)
Yeah the only time I will set a variable is like
Indices (i) and strings that I'm substringing
Otherwise I final all my locals.
local final variables ๐
try looking at ready things, look at source code if you want to do it yourself
I like it, it makes the variables stand out more
void doSomething(@NotNull final Object o) ๐ฅบ
it can be useful if you suspect that you could accidentally set it to a value later on
Or final ARM resources
do final paramters have any impact on performance or not?
Nope
final has no bearing on performance except for fields, I'm pretty sure.
Well field access has to be optimized
Although
The compiler automatically inlines public static final
But yeah there's some hints that private static final is JVM optimized
Lemme find the post
If it's not inlined by the AOT compiler (Javac), it is by the JIT compiler.
(Also here's a fun fact https://shipilev.net/jvm/anatomy-quarks/14-constant-variables/)
(I actually ran into this quirk myself)
String newDisplayName = format(target.getCustomName().replace(String.valueOf(alreadyStacked), String.valueOf(newAmount)));
Why would this be limited to 9? Once I get to ten it changes to this:
guys there is a big exploit insta kill with bow works from 1.9 up to 1.18
any one has solutin for this
Altening: https://fortnite.thealtening.com/
Mod Download In Discord: https://discord.gg/ham
Saturns Discord: https://discord.gg/moles
dont read below all i did was steal Ishlaqs description for more views rofl @Shlaqlu get trolled
Like ParrotX2 and his School's Minecraft Server / School SMP Series where he Started a War or Ended a ...
it should look like this
So I have my HashMap<UUID, EnumSet<EnemyType>> but would there be a way to store the number defeated along with the EnemyType?
Been up for 3 days... and it's only got 20k views... hmm. Looks fake.
it is real iit works on bigger servers
fake
how do i load a 5 chunk radius near a pair of x,z coordinates?
Is it just for-looping my ass off?
have you tried yourself?
Although, only 25 dislikes...
yes
Also gotta love that Fortnite sponsor in the middle of an exploit PSA
That's not sketchy
how you see dislikes??
Browser extension
it still works? do it show up to date?
Currently, YT has just hidden dislikes but they're still recorded.
Nope, the extension guesses the dislike count based on users
They already removed the public endpoint
Agreed
Do you maybe know anything about exploit which I posted
I think Kotlin renames those methods to smthn like this
im wondering what different database implementations i would use for my plugins storage
like i have one now a SqlStorage which uses either mysql or h2, cant make an apart one for h2 cuz it follows the same sql syntax
As long as it isn't an RCE I don't really care about this exploit
Yeah me neither lol
Even if it is real
I don't play on servers ever
SQLite is the only one that comes to mind
Which has a different syntax than MySQL does
it's flat file though
Does anyone happen to know where exactly the motY field in the NMS Entity class is edited when a player takes fall damage?
mhm ye
I got a words array, how do I regex through the e.message to see if there are any words from words array in there? Thanks
How can I get the empty slots?
if i understood correctly, you wont need regex for that
of an inventory
So? how could i do it? i mean i thought regex was good cus its optimised im just makking antis wear
.contains would not really help
yeah you dont need regex for that just iterate over an array of words and check for every word if the string contains it using String.contains(...)
because they can easily change it
look at my msg pls
so like regex would detect if they try circumventing
if you really want to you could split the string into words and check per word an error term
im not going to add thousands of iterations and variations when a regex could possibly solve it?
not regex
ohh but would that be a bit slow / unoptimized?
basically same as regex
oh right
i mean you would have to iterate over all words anyways
lemme work on a simple implementation
im not a regex expert but i dont think thats how regex works
you cant say shit meh
also please put it in a code block
"`"
ty
```kotlin would even better
dunno how to do it
just type it after the `
i did.....
fkin stupid
kotlin```val words: List<String> = arrayListOf("fuck", "shit")
val wordsToMatch = "(" + java.lang.String.join("|", words) + ")"
val x = e.message.replace("(?i)\\b$wordsToMatch\\b", "****")
broadcastMessage(x)```
see
i wrote kotlin
and it goes green
but not the code ?
Developer: "Users shouldn't swear."
Developer: "shite, fkin"
this looks more like python than kotlin
???
It is kotlin ๐
why the fuck are you doing java.lang.String.join
because i found it on forum
Never use Java stdlib classes inside Kotlin
dont swear ._.
Ok
I'm pretty sure you can do words.join("|")
Oh sorry it's joinToString
Type inference failed:
fun <T> Iterable<T>.joinToString
(
separator: CharSequence = ...,
prefix: CharSequence = ...,
postfix: CharSequence = ...,
limit: Int = ...,
truncated: CharSequence = ...,
transform: ((T) โ CharSequence)? = ...
)
: String
cannot be applied to
receiver: List<String>
arguments:
(
String,
List<String>
)
val wordsToMatch = "(" + words.joinToString("|", words) + ")"kotlin
I wonder who was dropped on their head as a kid
Anyway
I said joinToString("|")
what the fuck?
No second argument
you alright?
I told you it does not work
Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
Show me your code :p
Like this then?
words.joinToString("|", "(", ")")
val x = e.message.replace("(?i)\\b$wordsToMatch\\b", "****")
broadcastMessage(x)```
You do understand that i am still learning and kind of a beginner right? So maybe dont say stuff like this
I am aware you're a beginner, it's quite obvious.
People make mistakes and ur being rude
epic command fail
The fact is your level of beginnerness doesn't matter in this situation, I gave you clear instructions :p
Still prints it for some reason
yo @neon minnow i wrote a very simple implementation
well not simple
but it only works for words of the same size
but you could just include both fuck and fck to check both
look at my code vs yours
Your code doesn't work.
That's not a strong debate.
console saying shit hmm how will this end
maybe read my message
huh? lol
i tested it and mine works
Orby's probably works p'well honestly.
it works but if there is a more optimized way to do it i would prefer that
Regex isn't optimized lmao
regex is slow af
your code is very long
you still have to go through every word
meh
mh yeh
Because that's what Java is.
i added comments
Java is verbose.
i wonder why it didnt work
I'd use something like this to match bad words https://github.com/xdrop/fuzzywuzzy
i did everything the other person told me to do lmao
I personally dislike swear filters tho :p
also do you have any idea how long the code behind regex is
at least 10 lines
if thats what you base performance off
Either they're shit and they have too many false positives
Or they're shit and they have too many false negatives
And either way, I find them encroaching on my right as an American to speak my mind using endless amounts of swear words :)
exactly
Fuck shit piss balls ass fucker
I'd rather have a filter that replaces nice words with bad ones
e.g. thanks -> fuck you
Roblox's actually has this issue
robloxs filter is shit
Indeed
like actual dogwater
See the best idea
Is to do swear filters incrementally
You add onto the filter as more swears are discovered by your users
Until eventually, you cover about 90% of cases
yeah
Because in that case, you only block the actual swears and not regular words
And you have a large list
just let staff decide on who to mute / kick / ban
(fun fact, I once was on a server where you got warned for saying "merry christmas")
wha if staff is absent af
Just look up the Unicode list of confusables
theyre always either easily bypassable or way too strict
๊ฌตucke๐
That could make it past ^
And there's
SO
MANY
OTHER
LETTERS
Back on this point
You can still say the word "dick"
By just making innuendos
Lmao yeah
Unless you want to block "die"
In which case
"dang I just died"
gets covered too
and that's problematic in a VIDEOGAME
yeah but its so short it would probably affect many other words too
lmao
the singular of dice
I did your mom last night
so if you have a bad algorithm it might match that
With a toggleable filter you encourage people that want to swear to just turn off their filter
And if they bypass it for some dumb reasons, you mute them
everyone knows that you are superior if you did someones mom
gotta love having a non-complete fontset
inferior
Although actually
Staff could misinterpret something
And then falsely ban someone
So fuck staff
Let's just employ robots
AI isnโt perfect either
you could train a neural network to do it
Ban all words. Allow only the happy and sad emojis
thats actually not a very bad idea
lmfao
Lmfao
use this https://www.perspectiveapi.com/
Combatting toxicity online.
Link it to your servers chat, filter it through it and voila
That's why your chat log should include the uncensored versions
is it an http service
I got banned from a discord once because is said "I knew this was going to happen" after a plugin the server admin made broke down
Humans are the worst thing on earth
It's an API so if by http service you mean it requires request delay the answer is yes
how does this look?
https://paste.md-5.net/rohocapuco.java
Does changing the player display name in tablist (using packets) modify the name above player head too?
Ah RIP guess you can't use it then
lets go i can just use it

Damn ok then
Y'know what would be funny?
If I just put in one of my own opinions
And saw how "toxic" it was
yes
Because you wrote it wrong
if you trained that ai on twitter it would make everything toxic
or offensive
bruh the bot is very sensitive
Hah
Removing the swear removes the meter
So I guess we learned swears are toxic ๐คทโโ๏ธ
is this free?
Oh and apparently
"bitch" is less toxic than "asshole"
B-B-BUT BITCH IS TOXIC TOWARD WAmeN
where can i try it
Last I checked you have to request access. I still happen to have my old keys that have infinite requests
. I was one of the first people to get in
yeah but from what it seems there are no limits
how is it less toxic than what maow said lmao
I like how my opinion is more toxic than literally "die"
exactly
maow is toxic
Ig I'm just toxic then
who thought
try "rosette stallion"
not toxic
Ratelimiting is still an issue though. So for a server with a lot of chat caching results is something worth considering
yeah true
Also "ass" is 90% toxic
Lemme just like
Copy-paste some erotic fanfic in there one sec
just, you know, get a few keys and cycle thru them
Yeah idk how I'd feel trying to trick google
"shit" is more toxic than "shitter" while "shitter" is like a direct insult
I'VE GONE TOO FAR HELP
WHY DID I THINK THIS WAS A GOOD IDEA
its a bit of a weird insult but it is a direct insult
lmfao what happened
lmfaoo
anyone know why this does not work https://paste.md-5.net/uxulocihil.nginx
what's the yaw and pitch to make villager look forward not down????
well, its less toxic. we arent talking about morally correct though
It had the word "dick" in it tho that's a swear ๐ฅ
ugh please use the fully qualified import. val ๐คฎ
and what is broadcastMessage
you have to teleport it
sad its not giving me an answer
either its crashed
wdym? cant i spawn it with correct look direction
no i dont think so
you mean just teleport to the same location?
Yes you can.
how?
You can define pre spawn method calls
seems like more work than just teleporting it but who am i to judge 
what does this mean
Means his log is still printing the swear
Even when it shouldn't
So his filter is broknekn
T entity -> World#spawn(Class<T>, Consumer<T>) or something like that
I mean roblox took what 7 years to make their chat filter semi decent and it makes life hell on earth to talk? Why write your own

anti swear chat msg replace
also simple regex wont be able to filter special symbol replacments like $hit or A$$
So basically
What all of us are trying to say is:
Stop trying to make a swear filter, it will be broken no matter what.
Another person trying to create something that only a human moderator or a billion dollar company can put together
ฦรck
Im not trying to make a perfect anti swear. I am trying to make an anti swear, that works....
รitch just replaced b with german sz lolll ๐
A simple one... actually..
Nothing wrong with having a basic chat filter
Just do what AQ worlds did and have canned chat. Allow for only select responses
lol
(if they're implemented properly)
I said a simple filter, the one im working on that is about 10 lines of code. not a full api with listeners, events, commands and a range filter
It's also Kotlin which reduces the amount of people who can help
Kotlin is not as bad as you make it out to be
No but you are acting like it is
no one said it's bad, just less people know it
Hm
What I love Kotlin come at me bro
java is simply more popular especially in spigot community i think
I love Kotlin ๐ and I know it
I am a Kotlinsexual
Sexually attracted to that sweet-ass programming lang
slurrururruyrrurrrurrp

In three words, convince me to use Kotlin over Java
very sweet ass
Not the bees
my face when
My name Jeff
Iโm convinced
Good code, short
less verbose code
emotional damage
No more nullpointers ๐
Oh yeah that's a good one
Kotlin practices null-safety within its standard library
can it even cause a npr?
it has ? operator
When will java get ?
N e v e r
:c
isnt it something like obj?.something()?.something()
Yeah basically ?. does a null check before calling something

what happens if its null
You die
It doesn't do the thing
and the method signature expects for example a boolean?
java have optional api which basically sucks, but mean that java won't introduce ?
Honestly though java should have that
val s: String? = getNullableString()
Nullable types
They force you to use ? or !!
what about something like
fun returnSomeBoolean() : bool {
yield obj?.methodToReturnBoolean()
}```
thats my own kotlin smh dont blame me
not bool, Bool
It returns Bool?
The return type of a method called from a nullable type is made nullable
although
If you want to specify a default if it is null
can i do something like new T() in kotlin with generics?
You can do obj?.method() ?: true
No
There's no way for the compiler to know how many args in the type
fun 
But there are reified generics if you want to use reflection
every time i take a nap im making sure that method isnt under my bed
well basically can't compiler insert Class<T> arguments and use reflecton but make a reified generics illusion?
Nah
The compiler only allows reified generics for inline functions
I think generating reflection is unwise for Kotlin
Since it adds a lot of slowdown the developer won't notice unless they decompile
Or know the intrinsics of the operation
like
public void <T> myMethod() {
return new T();
}
// Will be replaced with at compile time
public void <T> myMethod(Class<T> clazz) {
return clazz.getConstructor().newInstance();
}
class MySpaghettiCodePlugin {}```
That's also just error-prone
Like there's no way to validate it
It'd be better to do what C# does and have generics validation in a where clause
applicable in some plugins
well, everyone does that if they need, that will just remove annoying .class and manual argument passing
yeah i know that sweet syntax, why won't notch write minecraft via c# ๐ข
It would also actually allow for structural typing on the JVM
Back when Minecraft was first made, the .NET platform only worked on Windows
catch (Exception e) where e.getMessage().startsWith("unknown character") {} would be great
It's called an if statement
and then re-throw exception if the statement isn't satisfied
Yeah
meh
i like it being fancy
It's just for when you have messy code
And you need to put the superclass/subclass of a generic at the end of the method header
e.g. fun <T> myMethod() where T : MyType
class MySpaghettiCode {} where programmingKnowledge = 0```
I must be an Italian chef because all of my code ends up as pasta.
saw someone calling his exceptions calling ingredients and then like throw pasta
throw owo kekw
You just pick up a furry
And fuckin' punt them
Out a window
How can I convert a set<string> to a list<string> Im trying to get the keys from a configuration
No.
new ArrayList<>(mySet);
new ArrayList<>(set)??
why not just working on the set?
Yeah
if you need #get okay
for looping?
for pasta?
I don't understand
๐ค
Why do you need get?
to get the pasta
im trying to make a page system so i for example i need the values in indexs between 15 and 30 or 45 and 60
Oh I see
That's reasonable ig
Althooough
I think there's a sub-collection method one sec
List#subList?
This is fuckin' great
olive oil
if that exists i still need the list
.
subList returns a List, so just assign the return value to a new one.
so
List<String> keys = new ArrayList<>(dataConfig.getKeys());
List<String> pageKeys = keys.subList((currentPage - 1) * viewSlots, currentPage * viewSlots);```
Yeah probably smthn like that
How do I make a spigot plugin with Visual Studio Code?
shame
What version of spigot added the text component stuff? (Clickable/hover text etc)
howcome
for me using IntelliJ has been a better experience.
iirc that component stuff has been there forever
Visual Studio Code has Java plugins, but wasn't designed for Java,
Same
my guy is using 1.4
so he isnt sure
if its there
xd
are you joking?>
Same way you would with any other IDE. Just make sure it supports the syntax, and has options for compiling.
That being said, Iโd recommend using an IDE made specifically for Java, like IntelliJ. You could make plugins in notepad, but who wants to do that?
how to add dependencies ๐
But how do I get started? Because on IntelliJ there is a plugin for that
you dont need any plugin to make a spigot plugin
ide plugin, i mean
Sure it can be helpful, but isn't required if you have basic java knowledge
Wdym there is a plugin? IntelliJ just supports the language out of the box. You donโt need anything special to start making Spigot Plugins. You just need the API.
I think they mean the minecraft development plugin
which basically creates the outline of the project already
basically skips step one but people use it off the start and never learn how to just do it on your own
I forgot I have that installed. I just create the projects from scratch. Lol
Okay, so how do I do that. Is there like an instructions page?
There are a few ways. Question is how you want to do so?
Doing it manually.
OR
Use a dependency manager like Maven or Gradle.
Is Maven or Gradle better?
Gradle
It's personal opinion
Thatโs a debated topic, but there is a mix of people here who use either or.
Personally, I use maven, but man is it a pain in the ass sometimes.
Havenโt actually tried gradle so I canโt comment on it.
I'd recommend Maven because it has a lot less odd errors
Although Gradle is more concise
gradle is simple as dick much less verbose
Well, lets go with Maven then
Setting up a maven project is easy with IntelliJ as itโs a preset. Im not sure how Visual Studio Code handles it. If it even supports it.
Eh it probably does
im trying to build my project and this keeps popping up
Hmm
org.gradle oh god
Do you have any folders open
like in the project structure?
In your file explorer
Sometimes Gradle errors on me during compilation if I have a folder open that it's trying to modify :p
Otherwise, try killing the daemon if you have it enabled.
Maven does that too, but only if you have a file open with another program.
nope
would you want my build.gradle ? or would that not be linked to the problem
?paste
redlib ๐คฉ๐คฉ
mhm
redlibs the reason i aint using maven anymore
shading it w/ relocation is complicated there
I'm probably gonna either
switch to Maven
or finish my buildsystem and switch to it
hey anyone know how to create a configuration section like this, and print it in chat?
the screenshots are what i have so far
theyre a bit jumpled
what
thats a list not a section
i dont create project from intellij but via gradle init
o
intellij dont work fine with jdk 17 and gradle together
just fileconfig.set("help-message", someList)
is it possible to run a java 16 plugin on 1.18?
i just dont know how to print it
in chat
it probably should be possible
new jvm shoudl be able to interpret older bytecode AFAIK
fileConfig.getStringList("help-message") and for loop
Like all the way to JSE 1.0.2
Not always
Lol
๐คฉ
Like finalize is being deprecated for removal.
how would i add it to an item lore? the same thing but with meta.add
did you include repo??
You have to iterate over your list to send the message. If you want it as one contiguous block of text, use a StringBuilder to append everything together and add a new line with each iteration.
And all the reflection stuff they changed with modules
And removing access to internals
theres a plugin for intellij that sets all that stuff up automatically
>:(
yeah, tho it don't support kotlin dsl for kotlin :(, so can you show gradle file?
for (String s : fileConfig.getStringList("path")) {
plugin.getLogger().info(s);
}```
yeah ok cool
tbh i haven't really found a practical use for kotlin over java yet
just seems like a lifestyle thing
or just .forEach(logger::info) kekw fancy way
i meant kotlin dsl not kotlin, basically the kotlin language just for config file instead of groovy
the intellij plugin dont
mhm
Can anyone help solve this puzzle? Why I'm getting 0 UNIX time?
what
pretty strange, i use the same links and names and it works,
what?
for (String s : configFile.getFireballLore()) {
Logger.log(s);
}```
that should work right
I'k its my birthday xD
ah
Why not save the date as a Unix timestamp and then convert it with Date?
The thing is that works in mc 1.18
could you dm me your links? theres the possibility im missing a / or smth
And was pretty sure that was working but unfortunately not.
lore is a list yeah i guess
and logger not Logger
That should work regardless as thatโs a Java feature not a spigot feature.
or well if its some kind of implementation nvm
Then why is that not working xd
actually i use gradle plugin which does the links for me, but they're the same as in the spigot guide, maybe try changing from 1.18.1 to 1.18 cuz thats how it is in spigot docs
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
yeah it is. i just realised it wont work because meta doesnt have an addlore, only a setlore that requires a list not individual strings
im usre theres an easy way
ah yep that did it. thx so much
np
i can just create a new arraylist and add the lores in aloop that way
and then set the lore to the arraylist
also if you're interested you can look at the https://www.spigotmc.org/threads/spigradle-intelligent-gradle-plugin-for-developing-spigot-plugin.422004/ plugin, it gives link shortcuts and can generate plugin.yml for you
are you trying to add the lore from the config list?
List<String> lore = new ArrayList<>(configFile.getFireballLore());
there we go
this.fbmeta.setLore(lore);
not sure if it is the best way, but you can check for PlayerCommandPreprocessEvent and check if the command is "unban"
also if you're using some plugins they may have custom storage system
for ban lists
i guess configFile.getFireballLore() returns a List?
so if you're using some plugin then you should consult to it's api, idk about vanilla system
mhm
then you dont need new ArrayList
i cant think rn
EntityIllagerWizard.Spell spel = EntityIllagerWizard.Spell.valueOf(spellname.getSingle(event));
if(evoker.getSingle(event).getType().equals(EntityType.EVOKER)){
CraftLivingEntity entityLiving = (CraftLivingEntity) evoker.getSingle(event);
EntityEvoker entityEvoker = (EntityEvoker) entityLiving.getHandle();
entityEvoker.setSpell(spel);
entityEvoker.setGoalTarget(((CraftLivingEntity) entity.getSingle(event)).getHandle());
Class<?> outerClass = entityEvoker.getClass();
Class<?> innerclass = outerClass.getDeclaredClasses()[1];
try {
Method m = innerclass.getMethod("j");
m.setAccessible(true);
m.invoke(entityEvoker);
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
e.printStackTrace();
}
}
This is successfully making the evoker target me, but it doesn't execute the spell I'm referencing
This does make his hands go in the air and play particles though
just nothing happens
yeah, probably, the PlayerCommandPreprocessEvent just was the first thing in my head, but u'r right
but if you're using some punishment plugin the best way is to use their API
then use PlayerCommandSendEvent
BUT, note that if the player's name was manually removed from banned-players.json you won't detect this!!
the banned player names are stored in a file called banned-players.json
if someone manually remove someone's nickname from it
you wont detect it
[
{
"uuid": "30f66a0c-ba36-4cdd-a4c0-4037e3a57579",
"name": "Aregcraft",
"created": "2022-02-12 23:09:20 +0400",
"source": "Server",
"expires": "forever",
"reason": "Banned by an operator."
}
]
like this
idk
but you should be aware that that's possible
update: he does the particles for the specified spell and then quits and does what he wants
how could i ignore the defense from a single part of the armor in the EntityDamageByEntityEvent
You need to calculate the armor points of that part and then add them to the damage dealt
hey @ivory sleet
should i delegate my database storage to give it different implementations?
however i need completablefutures everywhere so i dont see that much sense
im having like an storage interface which gets implemented for some database types, all sync and then i have a delegatingstorage which wraps itself around the implementation and has the methods with the futures to do the stuff async
May come in handy. That's how I went about it. Granted very simple stuff I need to store, but useful
is there any implementation of setting the number of slots depending on the server load (tps)?
prob better to actually find the cause of the lag
Id say tps isnt a good metric to change slots based on
Was going to say, most people are like how do I get the other x thousand people on the server before tps drops.
I want to make an unlimited number of slots as long as the server can maintain stable operation.
you will need a lot more metrics then tps then
I'd say you are jumping down a rabbit hole that you don't want to be
It obv depends on server type, but if you really want thousands of people on a server consider splitting them up across multiple servers with linking with redis or something
obv for certain gamemodes that wont work
After all, the number of people the server can handle depends on the activity of the players at any given time
Yeah, in past bandwidth plugged up before CPU and Memory resources did. In the past however, the driving of traffic to your server from the clients, would basically just "rearrange" the internet to get you the bandwidth you needed.
ISPs have changed though...
bandwidth would def be a thing yeah
all those packets would be insane
If you really want to do it off tps, you can just get the tps and come up with a formula to calculate player slots based on that
I'm afraid that 1.18 can not withstand more than 70 players ๐
have you tested that? Any server optimizations? etc
I just thought that there should already be a plugin for such a task
70 players is a lot and i believe 70 players with no optimizations in 1.8 for example will cause laggs too
eh
YOOOOOOOOOOOOO i just spent 4 hours making a plugin without testing it once, and it worked FIRST TRY WTF
it wont be much lag but it could be some
ive seen 1k+ players on a 1.7 server, and thats not as optimized as 1.8
Of course thats a highly optimized server
well depends on hardware too ...
but i never saw an server with 100 players that had no optimizations to work lagg-free
Lets be honest, minecraft is not scalable at all
Rn it is designed like a game to play with friends, having 20 players on server maximum
the optimizations have gone to shit yeah
I mean, mojang never cared about optimization too much
1.12.2 was just lightweight
Do you return false in onCommand?
prob returned true
Returning true doesnโt send the message
or whatever condition gives the alias
False does
cant remember which one lol
That also looks like a tab completion message
its not i havent coded that lol
thats client side
oh
Return true if you donโt want the usage message
Tab complete stuff doesnโt appear in the chat
does in 1.8
Ew 1.8
yea ik
Love when that happens/
i spent a month making a plugin and it worked first try
minus the database stuff ofc
but I knew that wasnt gonna work
I have not had more than like 12 people on a server I host in recent history, but back when I was in high school (which I am now 31) I had version what ever of Minecraft from 15-ish years ago, hardware from 15 years ago, and we had over 250 people on one server in one world with integrated proximity TeamSpeak chat, and performance was fine.
I would worry more about giving people a reason to get on and play, than whether your set up can support an amount of people.
That was bukkit too, spigot did not even exist back then.
ah yes minecraft in 2007
I think that's why there is a sect of people that build Bukkit servers using 1.8, then do something which I have no clue about to like meld the versions together. Like the servers that stay up even when the updates come out without them updating the server.
