#help-development
1 messages · Page 401 of 1
Working in kotlin limits the amount of people willing to help you by around 90%
Are you serious?
Yes
But writing java is so much worse because it doesn't have like .filter etc
I like functional stuff like that as it's so much fucking easier to write code
kotlin here is associated with dellusional people that think kotlin is better
There is nothing inherently wrong with it, other than that it only adds more complexity to something which is already more complex than the average plugin developer can handle - the plugin itself.
java does have filters and all
I prefer kotlin because of the map functions and filter functions etc
java can do filters to collections and maps :)
like x.filter { it.toLower() == "hello" } is much simpler than the verbose having to use for loop version...
Unless I don't know Java that much - that's kind of sucky
Regardless of what you say... we still don't care
java can do this btw
Show me
accept its more verbose which is scary
yep stream filter
x.stream().filter(Function Here)
?
myCollection.stream().filter(object -> object.equalsIgnoreCase("hello"))
Stream.of(x).filter(
But why do you have to .stream() it?
a quick question: how do i give a player a tag and how to remove? i tried with player.performCommand but you need op for that
couldn't you just do String::equalsIgnoreCase
no
List<String> data = new ArrayList<>();
List<String> filteredData = data.stream()
.filter(item -> item.toLowerCase(Locale.ROOT).equals("hello"))
.collect(Collectors.toList());
What's so ugly about that in comparison to your kotlin function? Does it already result in a collection?
I still hate the stream api
Now I don't mind being verbose, but why the hell do you have to stream it???
I like streams for specific uses, like filtering and map
Whatever you put in comes out e.g. a filtered mutable list comes out as a filtered mutable list
Like what is a stream???
stream is basically iterating the collection
If I know that, then I'll instantly switch my codebase just on the basis more people will help
Oh?
So you only love Kotlin because it hides implementation details behind little concise functions for you?
It's a transformation wrapper
the only reason why 200 collection types won't impl it, is because not everyone wants to use the streaming API
So should I do this/if I do this y'all will actually help me? 🤣
There are some lambda functions handled by collections, but most of them are part of the streaming api
that came with java 8
pretty much everything that you use in kotlin already exists in Java, just not as scripty
kotlin replaces verbose code with keywords
equalsIgnoreCase says hello
you would definately get help quicker
and people argue it's better without understanding that java is designed to be verbose
Oh fuck yes ok then that makes me want to switch to it then lol
99% of people here do not use kotlin
Oh ok
there are the weird odballs ofcourse
Well
only like jantuck uses kotlin
I just used the example they provided and translated it to java, xD.
only regular ik here that uses it
Then gimme like an hour and my codebase will be completely Java - then I can actually solve shit 👍
If you like kotlin more, sorry to say it, but it's stupid to move to java just to get more help
pretty sure intellij can do the conversion for you
I do prefer Kotlin - but everyone else is just ignoring the fact that it's not hard to read/comprehend...
wether you know kotlin or not, you can;t lose anything learning Java.
It's just more concise
I'd be fucking really annoyed if it does
tbf most people here also don't know the hundreds of keywords kotlin has
so its difficult and annoying to read
But you know, if there's more support in Java compared to Kotlin/more people want to actually help with Java compared to Kotlin then I'll make the switch 💀
inline fun
Fair enough
companion object
i never understood languages calling their functions fun
One of things that doesn't exist in java ^
It’s not hard if you know kotlin, but few people are going to attempt to correct code in a language they don’t know
Although I originally am from a completely typescript & python background so I am all for scripty stuff - it's just what I'm used to lmfao
Optimizing for conciseness does not make your codebase better, just saying, xD
Yeah, I guess
I guess?
I mean it makes it easier to read (for people that know Kotlin) but still
ok lemme try and switch this over
Nothing hard about it,!! Asserts not null and ? Is null safe chaining operator
It's not about hiding details, abbreviating or being concise, it's about being as simple as possible but as complex as needed.
spigot-api
I miss writing plugin code that actually did stuff
As opposed to?
oh for fuck sake - it's one way 💀
that used maps & itemframes
That’s doing stuff
Big OOP architectures that just delegate calls around, LOL (just a joke, xD)
^
(it's not a joke)
I seriously have to re-write everything 💀
(Little did he know it wasn't a joke)
Whelp
It's being critical towards OOP, but many people here don't like to hear that
/convert it all
you can grab 80% of the code here and make an OS with it
You and I have differing definitions of “doing stuff” then lol
You don’t have to
this project compiles to like 800kb and has about 5 listeners and 8 commands
I kind of want support/help, and while I do enjoy Kotlin a lot more than Java - I'd say availability of support takes precedence....
no shading
does public void run() only work in my main class?
no 🤦
thanks for the emoji 👍

You don't have this?
It's greyed out for me
hm
So god damn annoying
I guess it cannot convert because of the vastly different-ish syntax 🤷
Ah, yes, a a factory inside a factory which inherits from an abstract factory so it can create new factories which can create builders which finally create the manager that can get the needed object.
like e.g. companion objects and null coalescing etc
nah that's enterprise code
I have a wrapper for the bukkit scheduler
Or probably because you're looking at source code so there's nothing to decompile
If you compiled that to bytecode and were looking at a class it would probably let you use that option
I also have my own version of CompletableFuture that doesn't suck up exceptions
Suck up exceptions?
Literally all you have to do is handle exceptions
Either whenComplete(), handle(), or exceptionally()
You end up having 200 duplicate .exceptionally(thr -> thr.printStackTrace(); return null;}); code blocks
Yeah if you're using CFs incorrectly you will
You still need to add handling by default to show exceptions
Instead of your code just failing and the exception showing up regardless
other useless classes I have include my own time profiling system, that makes fancy graphs in grafana
my command system, my placeholder system
Skin changing system
uh
cinematic stuff like transitions, text animations
Not too amazing at Java, is a mutable map in kotlin equivalent to the following?
public static HashMap<UUID, Inventory> guiMap = new HashMap<>();
Idk if that's the same, that's all I can find online - anyway
ok cool
Each way has positive and negative aspects
For example, you can have an ArrayList and a LinkedList
yeah, and in KT you just do mutableMapOf<T>()
done
boom
ok making some good progress ig
not much diff, biggest problem is the null assertions and no semicolons
I'm interested in making a character customization-type gui for an rpg server, but i don't know how I would actually store the customizations for the player
any ideas?
Would I create a config file and store each players decision there?
that would be an option. but the best option would probably be a database
how would i go at doing that?
first you would choose a database. and then look at documentation regarding interaction with said database
and then you interact with it to insert, get your data
i currently have a file config
org.shawty.Files.Minions.get().addDefault("Minions", new ArrayList<String>());
org.shawty.Files.Minions.get().options().copyDefaults(true);
org.shawty.Files.Minions.save();```
but everytime the server restarts, the defaults get set again so the value is just getting reset every time? how can i fix this?
it isnt really a default when it gets reset every time
im sorry, im new to this
where would i find a database thats good for the data im trying to store
Well sort of
there’s both hashMapOf and mutableMapOf
but it can be good to do some reseach on them for how much data you are going to insert
which one should I use then when switching to Java?
however mutableMapOf may not be a hash map by contract
Since you know, kotlin can be compiled to other stuff
Where the impl may not be the java hash map
mutableMapOf is fine tho
Its like the same thing with when you use the type ArrayList vs just List
does your program actually depend on an array list specifically? Or just a list, where ArrayList happens to be the most accurate implementation to use?
This goes under liskov’ substitution principle
https://github.com/BlvckBytes/BBConfigMapper/blob/main/src/main/java/me/blvckbytes/bbconfigmapper/YamlConfig.java#L122-L134
This is going to save me so much time by not having to delete the darn config file anymore if I add new keys... 
anyone know why this happens?
I have no idea what org.shawty.Files.Minions is, but I'd guess that the call to save will just override the config with whatever the current configuration in memory holds. Are you loading the file before the call to save?
org.shawty.Files.Minions:
public class Minions {
private static File file;
private static FileConfiguration configFile;
public static void setup() {
file = new File(Core.getPlugin().getDataFolder(), "minions.yml");
if(!file.exists()) {
try {
file.createNewFile();
} catch(IOException e) {
Bukkit.getLogger().severe("Cannot create the minions.yml file!");
}
}
configFile = YamlConfiguration.loadConfiguration(file);
}
public static FileConfiguration get() {
return configFile;
}
public static void save() {
try {
configFile.save(file);
} catch (IOException e) {
Bukkit.getLogger().severe("Cannot save the minions.yml file!");
}
}
public static void reload() {
configFile = YamlConfiguration.loadConfiguration(file);
}
}
and loading, what do you mean?
Don't use static too often...
You're loading the configuration from the file in setup, so after having loaded it into memory, a call to save shouldn't override anything, if there were no changes in the mean time. If you edit the file after your plugin has loaded and then call save onDisable or something similar, your plugin is of course not gonna know about the changes you did manually, outside of the system.
Lol it will mess all your code. Then you change the value of whatever static you assigned, it will literally change every value that was called with the static. Idk how to explain it in simple terms. It breaks the idea behind object orientated programming
Just stay away from it as much as possible. You only use static in rare cases. Go watch more videos behind static functions in java
Whoever's code this is, don't rely on learning from them. You will almost 100% come with problems when continuing on this....
Most programmers probably wouldnt be here without youtube though
And removing static is not going to fix the issue either... my lord.
I have a plugin that's supposed to save some variables, and it does, but it wont load them. Everything works alright, and it makes a file, saves the data and everything, but after a restart it cant seem to open the file and read the data. The only error I get is:
[13:56:55 ERROR]: [org.bukkit.configuration.serialization.ConfigurationSerialization] Could not call method 'public static org.bukkit.Location org.bukkit.Location.deserialize(java.util.Map)' of class org.bukkit.Location for deserialization```
Can someone please help? I've literally been trying to fix this tiny stupid plugin for 3 days now and it's driving me insane!
Here's the ChestObject class (note, the plugin has 0 things to do with chests): https://paste.md-5.net/lizahekuda.java
And here's the ParticleHandler class. https://paste.md-5.net/unikatatol.java
Both the chestobject and particlehandler classes have something to do with saving and loading data. Here's the main class just in case
https://paste.md-5.net/rizujaboju.java
If you have any clue on a possible fix, ping me a trillion times because I've already tried everything and don't know what to do anymore
average github lurker
The setup file code is the first thing in oneEnable so no other changes are made. And I call save and reload on every change so I don't see a reason to put save in onDisable
so you want me to make a class instead?
Hey, I’m looking into getting better at nms and I have a few questions regarding this. I’m sure a bunch of you know the answer
?nms
As I understand. NMS is directly related to a Minecraft server version, therefore, if I want to make my plugin multi version I most likely need to do some adapting regarding nms directly
ugh wrong one
I’ve read that anyways
I see that many plugins have folders for each Minecraft version, and inside of them specific nms stuff for that version
There’s a lot but for this example
multi module
AnvilGUI
How does my code know which version to use? How do I make those files? What actually goes in them
google mbaxter github multimodule
Im accepting resources if you have any as well! Greatly welcome
I will look at all the stuff you send
Coming back to this, I think it has to do with this piece of code. java public static ChestObject deserialize(Map<String, Object> args) { // Get all the variables from the Map, and return them as a ChestObject boolean isLooted = (boolean) args.get("isLooted"); Location location = (Location) args.get("location"); if(location == null) Bukkit.broadcastMessage("Location is null in deserialization method 1"); Particle particle = Particle.valueOf((String) args.get("particle")); int cooldown = (int) args.get("cooldown"); List<ItemStack> items = (List<ItemStack>) args.get("items"); return new ChestObject(isLooted, location, particle, cooldown, items); } I'm sure the order of the new ChestObject is correct, so I'm guessing it has to do with the items. I think there's going something wrong there, when deserializing. What would be a way to check if there something wrong with that?
The error says Could not call method 'public static org.bukkit.Location org.bukkit.Location.deserialize(java.util.Map)' of class org.bukkit.Location for deserialization
Each module implement a separate class behind an interface, then during runtime you have ur main class which fetches the nms version from the package of one of the craft bukkit classes.
(And obv u then choose which implementation of that interface to use)
So I make an interface containing all the methods I would need and then program each version class manually to adapt to each version?
Now this might sound dumb. But isn’t nms massive? Wouldn’t the file be thousands of lines long?
So you can leave behind a default implementation
You can have multiple interfaces
Or use reflection and dont have multiple modules
oh i hope this includes it https://www.spigotmc.org/threads/all-you-need-to-know-about-nms.582651/#post-4517602
What I mean is, I assume I make each version module depending to my needs regarding nms? It’s not like I make a global NMS for absolutely everything nms has
Like, for example, your nms file won’t be the same as mine, even if it’s for the same version
Cause we want to do different things
I need to read all these so I’m just asking questions which will probably get answered after I read but just to get more resources
Now, he said:
Use reflection and you don’t need multimodules
I know what reflection does and how it works. But how does reflection simplify that? Why isn’t everyone using reflection for it
reflection is slow asf
Ahhhh gotcha so that’s the main reason
Now, I know there’s libraries out there like protocol lib as well
How can I remove the link https://cdn.discordapp.com/attachments/picture.png from a message received in the chat and replace that message with the text "image"? Im gonna use it in DiscordSRV plugin, so the image from discord gonna become clickable text "image" into the chat
myes
What's the diff between a hashmap keyset and entry set?!?
Oh wait I just do .put to set to a map nevermind
So with nms then. I assume I write everything I need for 1 version first. And then make the handler and expand to other versions with my version as reference?
Ah yes, I love writing Java like Kotlin:
Arrays.stream(items).filter(Objects::nonNull).forEach(inventory::addItem);
This is exactly what I like 😊
Oh wait what the actual hell
IntelliJ is smarter with Java than it is with it's own language!!!?!?!?
what do you mean there
Like it's giving smarter like suggestions and stuff
Idk never noticed it with KT compared to Java 🤔
probably depends on the settings of your IDE
Oh my fucking god
People often think eclipse is dumb - but that is only because they let is stay at default settings.
Same applies in your case too most likely
I am trying to write Java in the style of Kotlin because that's what I'm used to
And I made this abomination:
ItemStack[] itemsToDonate = (ItemStack[]) Arrays.stream(event.getInventory().getContents()).filter(itemStack ->
!Objects.equals(itemStack.displayName(), Component.text("Donate to Admins")) && itemStack.getType() != Material.ARROW
).toArray();
absolutely beautiful 🤌
😦
at least put the itemstack type comparision ahead of the display name comparision
ItemStack[] itemsToDonate = (ItemStack[]) Arrays.stream(event.getInventory().getContents()).filter(itemStack ->
itemStack.getType() != Material.ARROW && !Objects.equals(itemStack.displayName(), Component.text("Donate to Admins"))
).toArray();
So like this?
ItemStack[] itemsToDonate = (ItemStack[]) Arrays.stream(event.getInventory().getContents()).filter(Objects::nonNull).filter(itemStack ->
itemStack.getType() != Material.ARROW && !Objects.equals(itemStack.displayName(), Component.text("Donate to Admins"))
).toArray();
it's slightly faster given that comparing instances is fairly cheap - comparing strings are not.
Ohhh ok
Fair enough 👍
How would you actually write that? I kind of get that that's kind of a piece of shit snippet 💀
But performance will be rather shit regardless, so it is kinda pointless that I suggest that to you
What do you mean?
Why?
Streams have a large overhead
fack
not so much now
Hey, I need to know
they improved a short while back, in performance
Yeah it's okay unless you call it like thousands of times every tick
Is this type of abstraction specific for something or is it a good general version of it
Like I'm still a bit confused on this nms stuff after reading for a while
Yes ok let's go I get to do functional shit in an OOP language 🤤
let's go
Do I only make the nms methods that I need? Do I need a general one for stuff that I won't use?
Do I add stuff as I need it instead?
idk I just find it easier to read and faster to code if I code the way I already know (pure functional and progressive code rather than object everything)
What if I need something else? Do I need to rewrite the entire interface?
List<ItemStack> temp = new ArrayList<>();
for (ItemStack itemStack : event.getInventory().getContents()) {
if (itemStack.getType() == Material.ARROW || Objects.equals(itemStack.displayName(), Component.text("Donate to Admins"))) {
continue;
}
temp.add(itemStack);
}
ItemStack[] itemsToDonate = temp.toArray(new ItemStack[0]);
Would be a more readable approach
Hm
(although I'd advise against the List#toArray call if possible - just added it in here to preserve the same code outcomes)
ItemStack[]::new 🥹
Wtf is that
an intfunction
Yeah here's a thing I notice more in vanilla Java compared to Kotlin tho - it's a lot more vanilla for loops than anything else
Not gonna lie
Which I don't really like as much
But hey ho
sadly not a thing depending on your java version
on amazon coretto 17
it's fine
Basically it allocates an array of a given size
so it basically it makes a new thing in the style of a class/object?!?
mhm
It's a shortcut for (int var10001) -> new ItemStack[var10001]
how can I set cooldown for event? It sends me 2 messages to times per 1 click
var10001 🥹
I've worked too much with FF/QF
playerinteractevent?
and whats that
PlayerInteractEntityEvent
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
works the same i believe
yo does extending CommandExecutor work somehow?
Similar thing is with Object:new which is a shortcut for () -> new Object().
Same with stuff like Objects::equals which is shorthand for (var10001, var10002) -> Objects.equals(var10001, var10002)
I wanna add/modify some functionality of CommandExecutor
well what does FF/QF stand for?
Fernflower (more commonly known as IntelliJ-decompiler)/Quiltflower. Two java decompilers
I mean make sure that the code is not executed twice on click
Would anyone be able to help me with setting a color of a glass pane in an item stack the only thing im finding is the depreciated way of setting durability with the itemstack
colours from durability are pre 1.12
so long as you have the correct api-version in your plugin.yml it's just a material choice
Yo, I got this error I can't understand how to fix it
is List.of performant?
what you mean ?
In this context:
List<ItemStack> itemsToStoreInPDC = new ArrayList<>();
itemsToStoreInPDC.addAll(List.of(itemsInDonationPDC));
itemsToStoreInPDC.addAll(List.of(itemsToDonate));
I can send you the code if you want
Tbh I don't see what you mean by concat, English is not my native language, so you lost 😅
Concatenate
Make a list consisting of all elements of one array, and all elements of other
general warning for List.of:
An immutably list is generated.
Not important for this context, just wanted to mention it in case you ever wonder why you are getting an error.
But what'd be the best way to do this in java?
The thing is that 7smile7 gave me a snippet to make a glowing block for a only player using ProtocolLib 5.0.0 (https://gist.github.com/Flo0/3020ede8f4efd10783b672aa278df2d8)
It was working but now generating me this error and not showing the glowing invisible slime but it was working before
why shouldn't it be fine?
Also performace normally isn't an issue, unless the operation is executed many, many times.
Do not try to overly optimize code, make it readable instead.
wrong version of protocollib maybe
it cant find the class
nope
PacketContainer is from protocollib right
Yes
what version do you have installed on the server
Spigot 1.19.3 ProtocolLib 5.0.0
tf
Cool, will do on that readable bit - thanks 👍
Why am I getting this window?
I want that default window where I can select which type of plugin I want to create
The interface changed, I don't like it either...
When??
Idk
it was good for me 2 hours ago
You updated the plugin 2 hours ago then I think 🥲
can you look into the protocollib jar with winrar or smth
to check if the class exists
if it doesnt the class is either coming from some other dependency or you do have a version mismatch
otherwise maybe a bukkit/java class loader bug tho i cant imagine that being the case
Okay I think the problem is with protocollib, I setuped another server with protocollib and my plugin and it work perfectly
@lost matrix Are you around
Extending CommandExecutor? It's an interface, xD. What do you want to modify about it? Personally, I don't at all use this interface, I always inherit from org.bukkit.command.Command.
I wanna change things like automaticly managing permissions
(which will of course need to do some things on command-execution)
acf hehe
Get out of here
with pleasure
why am I having this?
You should just build your own middleware, I guess. I once had an implementation I played around with, where I threw exceptions for things like missing arguments, missing permissions, player not online, unparsable input, etc., which I then caught in the middleware, that mapped these to configurable messages and explained to the user what went wrong. I don't even know how bukkit automatically verifies permissions, as I never made use of that feature.
blvck can I ask you some stuff regarding nms multiversion
yeah thats basicly what I want
Sure, go ahead,
but what the heck should I use as a basis? That was my idea, extending something like CommandExecutor
cannot just throw in my own CommandMap and all lol
how are you building?
oh you gotta be kiddin me
So you should create a command, like I do with PlayerCommand, that extends Command, and then have an abstract void onPlayerCommand(Player player, String label, String[] args); in your PlayerCommand. Inside that class, you call onPlayerCommand in Command#execute, if applicable. Wrap that call in a try-catch, which then responds to known exceptions by telling the player what happened. This way, you can always just quickly throw in your actual handler and make this "middleware" handle talking to the player.
Where is this???
NMS holograms
tbh I did not even know that Command was a thing lol. Is it new?
I missed a lot of stuff because I came from 1.12.2 and just converted from that
just click view > tool windows > maven
Command is the version of CommandExecutor for grown-ups, lol. It has always been there, at least since 1.8. You can also use the CommandExecutor as a base of your middleware.
its there just click it open
whats the difference?
Well, more control, plus the ability to register without a stupid entry into the plugin.yml
yeah aight gonna use that as a basis then^^
but sadly cannot start until tomorrow. Now I gotta learn for the exam tomorrow, and then write a curriculum vitae for the new school c.c
I use Command its way better than that silly plugin.yml stuff lol
personally not a big fan of it
since I did not know it was even a thing I did not bother with it at all lol
I automatically register my commands using the AutoWirer, I don't even bother to register anything anymore. Such a pain.
Is there some way to register permissions without the plugin yaml?
You can just add these children of Command to the command-map by calling it's register function. Maybe there's even a way to get the handle of said map without reflection, I'm just not aware of one atm.
reflections my beloved
I hate registering permissions anyways, I just check them myself. I don't need bukkit to hold my hand on that part, xDD
thats some interesting naming convention
Yep, I get that quite often, xD. It's internal to my lib and not going to change.
How can i check if a player can actually see a another player?
Isn't that just checking if the other player is hidden? It's not actually checking whether you can see them.
I believe it's canSee(), yeah
I mean like if a player is behind a wall and i can't see him
Oh lol
How could i do it?
I tried some methods using vectors to check the block but none of them worked
There's nothing for that built-in because it's not exactly light weight
Sounds like another call for raytracing. You need to really define what you take as "can see". How much of the player has to be visible? xD.
Just the head
I can check if the block in between is glass or a flower or something like this
Then just build a vector from player A's eye-location to player B's eye-location and check for all blocks which that ray intersects with. There should even be a bukkit method for that, I think. Then iterate all results and check if you can see through them.
I found this plugin https://www.spigotmc.org/resources/must-have-name-hide-no-lag-client-side.83899/ and wanted to make something similar
Can you give me an example? like this i don't know what to do
?
Can I not do this?
List<ItemStack> inventoryGUIItems = Arrays.stream(Objects.requireNonNull(event.getClickedInventory()).getContents()).filter(Objects::nonNull).toList();
That's not using list
Because that seems to work?
That's saying inventoryGUIItems is equal to something that implements List
That just returns you an implementation of List, what list you actually get is up to the Stream API
uhuh...
@SafeVarargs
@SuppressWarnings("varargs")
public static <T> List<T> asList(T... a) {
return new ArrayList<>(a);
}
Likely just an ArrayList, xD. But it could be any list, like a LinkedList, etc.
Yeah ok
So use arraylist for a dynamic array
got it
uhh any docs on how to answer a craft recipe request packet on client side?
LinkedList has some interesting performance issues, so you probably don't want to use that unless you really need to
i see it probably accepts a recipe id but need more info
I doubt that that is doable
Cool, will use arrayList
In b4 it is another Java 9+ thing
ah, then that is a different ArrayList class
Since java.util.Arrays.ArrayList cannot be resized where as java.util.ArrayList can
should
question is to which extend
I used this method to check if a player can seen an another player, but it isn't working
Vector v = b.toVector().subtract(a.toVector());
double j = Math.floor(v.length());
v.multiply(1/v.length());
for (int i = 0; i<=j; i++) {
v = b.toVector().subtract(a.toVector());
v.multiply(1 / v.length());
Block block = a.getWorld().getBlockAt((a.toVector().add(v.multiply(i))).toLocation(a.getWorld()));
if (!block.getType().equals(Material.AIR) && !block.getType().equals(Material.WATER)) {
return true;
}
}
return false;
}```
just raytrace one player to the other and see if it hits a block
Hmm, I can certainly try to, yeah. Give me a second, I haven't used the API myself, xD
For the most part, it would look something like this. The issue is that there's no available predicate, as far as I can see. So if you hit a block like glass or flowers and the like, it will return you this result, but won't provide any results after that position on the ray.
Maybe somebody else knows the API better than me
You guys know that Horse jump bar thingy? is it possible to disable that + disable the jumping ability?
Not enought arrows
Damn, those are a lot of arrows. I almost cannot see what they're trying to show me
Instructions unclear needs more arrows
Whether you can disable it depends on if the client automatically switches the mode of the "XP-Bar", or if the server has to initialize this. Jumping can most definitely be disabled, yes. Maybe there's even an event you can just easily cancel.
little bit
Yes! that's what we're talking about
Hmm that's cool
I guess I can also just remove the texture for the jumping xp bar lmao
declaration: package: org.bukkit.event.entity, class: HorseJumpEvent
What am I supposed to look at exactly? im very confused i think i need some more.
That background is miss leading
am I right
And how can I rotate an animal in the same direction a player is looking at? So for example, using the Citizens plugin, you can ride any animals using /npc mount. But the thing is, the animals dont rotate with the player bcs the devs were too lazy to add that.
So how would I change the animals rot to the players rot
But only the animal theyre riding
Entity#lookAt
afaik
The citizens plugin also has a command for that, but when you're riding an animal, it gets confused bcs you're on top of it and it just doesnt work
Yes but how
nms?
Im only familiar with no mans sky
Net Minecraft Server
Just track the player move event and set the thing the player's mounted on's yaw and pitch to the values of the players
the rabbit hole of all the pain
🤔 Cool, didn't know that was possible, thanks!
I mean, I hope it is, xD. You need to test that theory
I guess that the whole thing rotates if you change the yaw, it should
Yeah, it sounds possible
My last question (I swear, then I'll piss off): is it possible to add acceleration to animals? So when you're riding them, and you go forward they slowly go faster and faster
you can change their velocity
just use orse horse = (Horse) entity;
// Disable horse jumping
horse.setJumpStrength(0);
to disable horse umping
Damn did your parents really not give you a name?
so via some timers you can accelerate
nah they left
shit man, sorry
yo bro I found your dad, he's right on ur pfp
Something like this. You need to check if that works, I'm too lazy, lol
yeah 😭
joke btw
Timers? Tried using schedulers before, I hope you dont mean that because I'd rather die a million times over than using those again
I know lol
welp it's time for you to die
or use scheduler
what if it wasnt???????????????
*remove that thank you
Thanks! I'll give it a try tomorrow.
pretty sure you can use: player.getVehicle();
and then change velocity
this might work idk: vehicle.setVelocity(vehicle.getVelocity().normalize().multiply(newSpeed));
not speed limit?!
Welp now I know everything I want to do is (most likely) possible, Ill get back to dying
whats this dude coding in
jGrasp?
yah looks like that
Dude, those names are... one of their kind, xD
I wonder how geol could have possibly figured that out
some dude sent his coding assignment

congratulations choco you have eyes
Surely not this way
SURELY NOT
Maybe it's just a compiler check which you can bypass, haha
Well to be fair, file name doesn't necessarily have to equal the class name I don't think
Your IDE tries to force that to be the case but I don't think the JVM has any explicit requirement of that
Would be interesting if you could - let's say - compile class x7, then patch the binary to substitute x7 for 7 and then load the class using reflection as 7. Maybe it just does not matter if the identifier starts with an alphabetic character.
if its a non public class the file name can be different than the class name iirc
It can be different no matter what, naming the file the same as it's root class is just a convention.
oh
Hello guys
anyone know how to fix NAN health problem?
@EventHandler
public void onRespawn(PlayerRespawnEvent e){
Double health = e.getPlayer().getHealth();
if (Double.isNaN(health)){
e.getPlayer().setHealth(20.0);
} else if (Double.isInfinite(health)){
e.getPlayer().setHealth(20.0);
} else if (health < 1.0D){
e.getPlayer().setHealth(20.0);
}
}
e.getPlayer().setHealth(20.0); is't not working
man where are yoy i cant see you
define notworking, health is never going to be nan tho
if (Double.isInfinite(health)){
e.getPlayer().setHealth(20.0);
}
this is working (i have try, use if working send message console)
why are you testing anything? just e.getPlayer().setHealth(20.0)
bruh
silly names
humm ok bro
if (Double.isInfinite(health)){
e.getPlayer().setHealth(20.0);
}
this is working (i have try, use if working send message console)
💀
mean is i want make fix player health system
but its not work (mean e.getPlayer().setHealth(20.0); line not work)
why not make a variable for e.getPlayer()?
bruh whats not working
i dont get it
if it is not working it has to be with calling the function in main class
entity hit player, still cause NAN damage
why isnt the line working?
me neither
only one player cause NAN damage
uhh other plugins?
fix player NAN health
vanilla mob
plugins modifying it
the only way it can be NaN is if other plugings (or yours) is modifying the health
result=Hello, world, class=class 7
System.out.println("result=" + c.getMethod("test").invoke(instance) + ", class=" + c);
Yeah, I guess the JVM accepts classes with the name 7, lol
hmm
There's no reason not to. It's just a convention because of tokenizer/parser ambiguities, I guess
doesnt a mac has screenshots? 💀
CMD + Shift + 4 i think it is
dude hasnt found it yet
-.-
4 or 5, yeah
and 3, yes, for full screen
yep
4 for area, 5 for recording
4 and 5 are kinda the same
mac users
yeah, 5 is an extension of 4
Only using mac for school
I just like the way the operating system is for school work
Yeah as FourteenBrush said use the spawn method that takes a consumer
Otherwise you will spawn the firework and then modify it
It's better to create the entity that you want and then spawn it
The magic can actually be substituted by using the fancy ass builder, xD
I am forking a plugin but it uses maven, never used it tbh, which command should i use for building it?
Yep, it's quite nice to use. I do the same with my reflection handle predicates. I have builders for them. It's a treat.
mvn package
then forgetting one param and regretting
Map<String,Object> :>
I needed to use clean install
the minestom approach for custom blockdata i believe
still finding out if thats the way to bind an inv to a block or what
inventory is probably nbt though
It's been ages since I last touched minestom
the fact that so many people talk about that makes me pretty sad
Well I did update one of my minestom projects recently, but that is about it
Yeah... that's the one thing I dislike about the builder pattern, which is not the fault of the pattern, it's just the way it works. You're not forced to pass all needed parameters, as dispersion is it's goal, so you need to check your state in the final "build" step yourself. But other than that, they are still great.
smh, not having descriptive error messages
ye well, it was pretty unstable when I looked at last time, but its def a viable option nowadays
It still feels like it's not being used though
But I guess that is because almost all fun projects using minestom are closed-source for some reason
IMO it's just a shame
if they are going to make something so hard to use
then at least make it different to nms
not a clone
I know that you can blacklist the completion of such packages on eclipse - IJ probably can do that too
are they even following the footsteps of nms?
Yeah... I need to add that, thanks for making me realize, xD
I don't think so
It's not hard to use?
yes
hard to use in the sense that it won't gain mass adoption
That's how I feel when I get an java.awt.List
Or a NMS import when I desired a bukkit class
It just hurts...
maybe, that's a good selling point some extent, like being spigot devs familiar with the api design somewhat
but cant tell since I havent worked with minestom, so would just be speculating
Eclipse's solution to that problem was to blacklist the entire java.awt package. Fun times
You pretty much had no autocompletion when working with swing thanks to that
Wasn't that list configurable?
it was (and still is) - but good luck knowing why some class is randomly missing
Yeah I guess, I'm sure it's a great project and I'm just not giving it a good enough chance
IntelliJ sometimes just imports stuff on it's own it seems like, that really sucks. What also sucks is when it decides to merge multiple imports into a wildcard import which shadows the member you're trying to import, haha
IntelliJ is just a headache, tbh
You can configure IJ to get rid of * imports
and with java making tremendous steps in terms of their std lib for concurrency, minestom could conceivably be even more favorable in the future
Tbh, that sounds hella limiting. Who cares about familiarity, what matters is to not make a mess again, as we're in currently. I think we're really boxing ourselves in again.
Do you know how? I'd love to know, but am too lazy to google, :(
perhaps, but likely not the way they are going
yeah well, ask the consumers of the software
Tbh, the consumers are a big part of the problem.
Not at my pc now so I can't show you
Alright, no worries, I'll open the G then
ye unfortunaly
yeah, but even so, not ignorable at all
I entered "intellij disable" and first guess was "intellij disable wildcard imports". I'm feeling watched.
Minestom is really only usable for Minigames and stuff. Wouldn't use it for "normal" survival play anytime soon
Didn't say that, but people then cannot complain about new software falling into the footsteps of their predecessors if they don't have the balls to finally break the chains and go into the right directions. People who just want to get stuff done and don't care about efficiency or readability wouldn't be my users, if it was my project.
ye
This is my thinking... and I have worked on something similar to minestom
The only thing I don't like about Minestom is that they got rid of their integrated Mixin support - which means that I am the only one finding and fixing the bugs that that system had.
and I know there are a ton of pitfalls and it's not easy
but eve if what I was working on wasn't perfect
it was NOTHING like nms
I just added back Mixins in to my jar
It's a bit harder than that from my experience (unless you go the javaagent route)
It works fine
Mixin is annoying to use outside Launchwrapper (so annoying that I'm reimplementing it)
Basically you create your mixin classloader and then load minestom using it
I'm already knees deep into so many ideas, projects and research things that I literally cannot afford going into that rabbit hole. Otherwise, it would be something I'd be working on, I think.
I still like to imagine the server as a big state machine, a big packet switch with state, which receives and sends out packets over sockets and just has to simulate the game according to how mojang specified it. That does not at all dictate how the actual control flow has to work out. The developers are still in charge of designing that architecture. We could do so much better than what we currently have.
mojang code is perfect 👍 stop spreading anti mojang propaganda 
Yeah, only that Minestom's old classloader has tons of bugs (such as swallowing classloading exceptions). So you'd need to roll out your own implementation
Other issues are that code modifiers cannot be removed or added while transforming classes (big no-no in concurrent environment), JPMS being ~fun~ (Mixin mandates Launchwrapper AND Java 16+ on that regard - but the fewest care about JPMS anyways), Mixin being a annotation processor that runs by default under maven (you only see issues once you have Mixin annotations in your jar though) and much more
You really should use the spawn method that takes a consumer like we showed earlier
Yeah, it's fine, but you're still adding the entity to the world before customizing it. It's not ideal, but it works.
yeah I agree, I had a system that wasn't based around these big god objects that minestom and NMS have. For example instead of having some huge registry of items, and player.world.everything etc.
An "item" is just a simple data class that inventories care about. The actual logic is not tied to them in any way... instead in order to "construct" one you might call a function like:
val steak = ItemFood(<id for steak>) {
//on consume do whatever.
}
And now in whatever context you called that in, the logic to actually make that item do something is now present and enabled. At the time this particular system was going to be rewritten but here's an example:
https://sourceb.in/KL9PioHkko
So where in spigot you "build down" to make a minigame... cancelling all the default logic and events... in my system (glayve) you would build up... there would be no logic until you specified it. Lets you get closer to a "properly designed" system... better following design principles... but it was well past the limits of java and was pushing what kotlin was able to do as well.... context() would have helped massively but only was added when the project was already dying.
what is the difference between the fork of Fernflower on Spigot mc's bitbucket and the base Jetbrains Fernflower because I can't build it saying it needs a dependency net.md-5:determiner:0.1
I'm having a hard time getting the Player target = Bukkit.getPlayer(args[0]); information into another class. What should I do?
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
or make a method with params
In TSC or IRC?
TSC
Pretty sure I've never spoken to you in IRC
I was an annoying lil kid starting out
and pretending I was more mature than I really was
and you were there... doing what I do nowadays
helping others
I was tryna make a server from scratch and didn't even understand what a mask was
or how bytes worked lmao
Oh my, getting flashbacks of my own past
I see many people have come to me doing this and asking similar things so I don't remember which one was you right off lol
I had no profile pic
exe, r u still in contact with the guy with purple gorilla pfp
I also kept talking about how shit my laptop was and how I wanted to buy a new one
most of our talks were around 2019 I'd say
I was also the guy that made my own schedule builder that was like a copypaste of yours
I looked up to you man
Sounds like a nice and new approach to things, inversing the "building direction". I personally wonder whether a new implementation should even stick to the original language used - Java. But I'm not aware of any massively better languages, other than maybe Jai, Zig, Rust or the like. I'm not sure if Java really is the limiting factor, or if those limitations would just signal overcomplication to the person running into them. I really have a lot of respect for people who start massive projects like these, as I'd personally just feel crushed by them on my own.
I mean in terms of performance obviously other languages like zig (which IMO is too early to use but very interesting conceptually) would probably be better.
But I don't think it's the performance of java that's lacking, it's the design.
what's wrong with this?
@Override
public void hideHologram(Hologram hologram, Player player) {
List<HologramLine> lines = hologram.getLines();
ServerPlayer plr = ((CraftPlayer) player).getHandle();
for (HologramLine line : lines) {
net.minecraft.world.entity.LivingEntity entity = ((CraftLivingEntity) line.getArmorStand()).getHandle();
ClientboundRemoveEntitiesPacket packet = new ClientboundRemoveEntitiesPacket(entity.getId());
plr.connection.send(packet);
}
}```
wont remove the entity
not sure why
If I were to make a server impl I'd probably abuse the hell out of lambdas
To go about it the way I was, while following DIP and the other solid design principles... you might end up with something like:
final var item = SomeItem(parentScope, world, players, id, meta, tags, useCallback, anotherCallback)
but people hate that, so they start reaching for hackier and hackier solutions, or they start grouping together player and world... player.world, world.players, etc.
So they are compromising design for usability
In kotlin we can make parent scope, world and players a context... so it's passed around implicitly... for me world was literally just this interface:
interface World : Streamable {
operator fun get(position: Position): Block
val onChanged: ChangeEvent<Position, Block>
}
interface MutableWorld : World {
operator fun set(position: Position, block: Block): Block
}
But that's ok because other "world responsibilities" can be handled via other contexts.
It's also about buildsystems and how deep if at all you can hook into the compiler, where Jai shines, I'd say. But again, the question is if you'd need such complex features if you design the system right from the get-go.
Ultimately if you are clever enough you have something easier to use than spigot... but infinitely flexible by comparison.
I haven't ever used Jai, I saw it on hacker news at somepoint and that's it.
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/fernflower/browse?at=1.19 what does this version of fernflower do?
I'd love to have a buildsystem which just uses the same language as the actual code. Maven, gradle, etc... they just suck. Needless abstraction.
But I think complexity is very relative thing. It's hard enough to balance design, usability and performance... sometimes it takes a complicated tool to provide a simple developer experience.
build.gradle.kts looking at you rn crying
its really clean with both kotlin and java projects
Sure, a full server is immensely complex, so I know that it cannot be a simple and clean system to the degree small and insignificant software can be.
I like gradle on the whole, it has issues but it's nice for big micro service style projects... I hate projects with 50 shell scripts 10 build tools etc. Gradle can replace all of that in kotlin
seems like they did some changes to how strings are handled
Missed opportunity, could've used java but chose bad kotlin
I'm not really liking kotlin, but that's just a personal thing. I'm sure kotlin gradle is a lot better than maven.
Even groovy is better
I wanted to look into it but I can't get it to compile there are absolutely no instructions and both using the gradle wrapper in there and the maven pom didn't work
ok you try to do anything functionally in java this is the one reason why it was chosen
I like kts but kotlin hurts my brain
i do like writing in java more, but i HATE writing scripts with it
Groovy is the real crime here
👎
Tried kotlin once, the way you do the type always messes me up
finally a sane statement
I still use groovy to this day
This is a kotlin free zone
i mean i use python with a static type checker and I like it it's basically the same from my limited use of kotlin
and kotlin is more robust then anything like python or typescript could be
cool changes but how's a man supposed to use it
great question
kotlin replaces verbose with keywords
certainly if you are arguing groovy is great and kotlin sucks I'll never see eye to eye
I prefer verbose
but I can understand only liking java
Because english
java is verbose by design
Java feels like English
literally the pom is broken wtf is the first plugin
kotlin people arguing that it's better because it's not verbose is tomfoolery
i have never seen it
And I like java myself... it lends itself super well to some styles... Just happens not to be mine
agreed
I feel kotlin is a bit overbloated with semantic features
Even if it's verbose so what, does it matter to compiler?
at the end of the day you can ship working and maintainable software with many languages it does come down to what you are doing
and interoperability, which kotlin uses as selling point is far from ideal
Im just getting eye cancer when seing kotlin code lmao
True
🤓
It has some goofy stuff
It just looks ugly as hell for me
probably only thing you hate is lambda as scope
Sure, but it also has features that I find myself dying for in all other languages.
true
As well as I hate Python Syntax
:(
I would choose bash any time
Also I personally think that the people who are sitting there using spring... other hacky compiler extension/reflection based systems
I mean null safety and coroutines being the biggest features Id use kotlin for
It just has this... unreadability for me
don't have a huge amount of room to say that kotlin is bad, ugly, unreadable
yea
it's the people who use pure java cleanly and carefully
coroutines really make me choose kotlin over java
that I respect not caring for kotlin.
I find the way kotlin handles null super weird, but probably just me using it wrong.
Like I need my clean satisfying well-readable java syntax structure
its so easy to work with them
Java also has better mascot and logo

and then those who use kotlin and lombok
Kotlin has some oversimplified robot
Kotlin technically doesn't have a mascot atm
L
nobody liked the thing they made
Bro just look how sexy my pfp is
Fr
JavaSkript?
Skript

Yes sql
sqeel
sql sexy
C hashtag
MySqlScript

well, Rust instead of cpp
Both is horror
Oh no, not that again
Bro its a nightmare having to use kotlin for me lol
so its not just me that thinks rust looks cursed
See plus
what advantage does kotlin offer besides looking funny???
I hate rust with a passion for it's bad inherited nomenclature from C++. All those stupid ass abbreviations. It's a good language otherwise, I'm sure, but that just kills it for me.
oh and extension functions
Nice emojis, discord!
coroutines
literally my reason why i choose kotlin when i have option
Minimalistic
inline infix extension fun functions :DD
Sounds like fun
And has no lactose
whats even the point of extension functions isn't that just a less clear extension of a class
kotlin has such little lactose, its bones shatter when going up the stairs
Guys we probably wanna go to #general lol
I mean it is programming related
nah this is character development
I'm getting programming help
player.customMethod()
instead of
customMethod(player)
on learing why people think kotling is good
so then u can end up doing
x.y()
.z()
.t()
Well #general does not load for me anyways lol
which is a bit more readable
mans got the boonies wifi
Nah but my smartphone screams to go into the trashcan
I guess you can do functional programming with Kotling too 🤷🏽♂️ but I'm too stupid to use functional anyways
object cout{}
infix fun cout.<<(foo: String) {
println(foo)
}
fun main() {
cout << "Hello world"
}
❤️
But no $ for a new phone
I still don't get how you'd code everything without classes 💀
y2k stop
I was thinking about buying a new phone today
u use functional stuff so often
Stop shifting cout to the left by "Hello World" bits
dont even try
?
I was dreaming about having money today
.

I do? I thought java enforced oop
like how often do u not touch streams
I worked like mad last week and got paid a small fortune
yes but java has adopted functional style
haven't touched streams in over a year 
Bro I'd lose my mind when going to school + working
Optional::flatMap for instance being a monad
💀 I'd die without streams
I go to school, after-hours classes, gym, work
Already got days without any free time with just school
well, okay, lambda expressions
it's part of life
I'd have 0 time for hobbies when working
I mean like idk how people code strictly functionally moreso than not using it at all
well
oh
usually u dont have just functions
And also imma go get into depression with only things I don't like in my life lol
but consider a category where morphisms are functions and objects are types y2k
Not enough
listen man I've been doing this shitty 8am - 6pm + gym until 8pm + work until 5am
routine
for like
3 years
but isn't functional's thing like no inheritance at all? Or maybe I'm just misunderstanding the goal
yes
weekends give you a ton of time
idk How you'd get stuff done without any abstraction
Whats the point of having money if not having time to spend it?
Bro im at the point where I only got 1 free day in the week lol
instead of working today, I just chilled at home and went out for a walk
I'm at the point where I Work 7 days / week (except when I decide to chill) and sleep 3h/day, every day
And if I would do even more things I don't like I could not have sanity anymore
I'm telling you, you will find time to do hobbies
@river oracle u have type inheritance still
You'll just have to learn to manage your time more efficiently
I would not psychologicly tank the damage
what type of inheritance don't you have
on moments you're down bad, you cna just... not work
implementation inheritance
what's what I do
I only have 10 hearts
but in true functional programming, no inheritance
isn't that just a ton more work though
just functions, types and composition
resistance IV
well, think about it
So always
not really
For me, always
I got paid last friday and already have plans to renovate half my room
In Java people talk about inheritance being one of the main concepts, yet we so often advocate composition over inheritance
so imma work less this week, and yeet out half my stuff
wakatime lets me graph my mental health fairly accurately
Imma just not work for 12$/hour in a job I don't like
you can just... charge more
I charge 25$/hr+ for development
And nobody would pay me
not with that attitude
Guess what, nobody would pay me 5$ an hour lol
I'm a 17 year old kid earning 4x my national average income / hour
Sure you're still learning
but so was I like 2 years ago
And you are actually good enough to market your skills
I posted a premium plugin on spigot
functional just seem so foreign and weird to me. I'd love to try to program functionally, but its seems just so convoluted and like a ton of extra work
Listen, I am coding for over 5 years now. And im still bad at it
I've been coding for over 11 years and only now are things starting to flow
I've been coding for almost 2 years now I'm happy to say 😭 idk wtf is going on
have a lil trust in yourself
ye
I like structural
like how typescript works
I've met this guy with 0 coding experience
never used typescript
Guess what? If I post a premium plugin, the government comes and bonks me for doing that lol
Got him to start coding about 13 months ago
And also nobody would buy it
He's now my employee and does most of the code at work
but object orientation is a very nice way of splitting up a problem into smaller problems
and solve that big problem bit for bit
stop being that paranoid


