#help-development
1 messages Β· Page 1942 of 1
java 8 and 17
yeah and you use java 17 to run buildtools. you must use java 8
Cannot resolve symbol 'YamlConfiguratino'
typo
ah
and i need 17 installed because i have a 1.18 server
nope same error
should i just restart again and see what happens
you must run java 8 instead of java 17 to compile
is your world actually loaded before your plugin gets enabled?
because I'm getting this error
who
you
yes its loaded
how do i run a specific version im very new
are you 100% sure? pls add "System.out.println(Bukkit.getWorld("pvp"));" and see if it prints CraftWorld{asdasd} or "null"
ok
by giving the pull fath, e.g. "C:\Program Files\Java\jdk-17.0.1\bin\java.exe" -jar BuildTools.jar --rev 1.8.8
well obviously use jdk 8 or 1.8
well obviously use jdk 8 or 1.8
there are two java 8 folders with different contents
what do i do about that
how are they called
that's not possible π
jdk and jre
yep it shows the craftworld
use jdk
ok
@trail remnant I'm pretty sure your config.yml is somehow messed up
for example, when I run it through yamllint, it comes up with this weird result:
what is weird about it
that you have key called ? with a value of "y"
idk why thats showing up i just reloaded the plugin and the new file doesnt show that
this doesnt make sense lmao wouldnt this be a spigot bug? the config section 100% existist but its saying its null
np
it works 100% fine for me when the file is actually saved to file and then loaded
[02:08:10 INFO]: [Test] [STDOUT] test->true
the code i sent works for you?
I did it a bit different but kinda the same
can you send it
@Override
public void onEnable() {
saveResource("custom-config.yml",true);
YamlConfiguration yaml = YamlConfiguration.loadConfiguration(new File(getDataFolder(),"custom-config.yml"));
yaml.getKeys(true).forEach(System.out::println);
System.out.println(yaml.getLocation("test.start"));
}
custom-config.yml:
test:
start: &id001
==: org.bukkit.Location
world: world
x: -0.14127050089454213
y: 65.43811814559274
z: -22.821418794485666
pitch: 28.3499
yaw: 26.878477
Name: test
Oh my gosh the amount of stuff that is still going in console is mind blowing
console output:
[02:11:34 INFO]: [Test] Enabling Test v0.9.9
[02:11:34 INFO]: [STDOUT] [java.lang.Iterable] test
[02:11:34 INFO]: [STDOUT] [java.lang.Iterable] test.start
[02:11:34 INFO]: [STDOUT] [java.lang.Iterable] test.Name
[02:11:34 INFO]: Location{world=CraftWorld{name=world},x=-0.14127050089454213,y=.....
so I still think that you just didn't properly save your file
which is weird because you said that the try/catch prints it out
omg im dumb as hell i realised the problem i was storing a world in the same section
bruh why didn't you send the config you were using lol
I didn't ask for the config for fun π
I thought what you sent was the file you were actually using
ok so i did all this because intellij wont let me select 1.8 in the plugin and its still not working do you know why
ugh π
i built it so that i could select 1.8 as a version in the intellij marketplace plugin in the pom.xml file but its still not seen as a valid version what do i do
show your pom.xml
i cant send images
?oaste
?paste
?paste
urgh xD
what
that should do it π
copy and paste the file contents
into the linked website
and then send us the link
you added "1.8"
that is definitely not the right version
did you really compile 1.8?
1.8 is not seen only 1.12 and up
what are they trying
no idea, i guess they want to use 1.8.X api
1.8.8-R0.1-SNAPSHOT is the version string you want
i was watching a tutorial and when they typed 1.8 it showed a thing that came up to autofill for 1.8
not 1.8
yes that
well then just throw that in ?
oh yeah i didnt even see they forgot -R0.1-SNAPSHOT
but it doesnt recognize that
or type it off the tutorial
it does, just click the maven reload button
I mean
and it'll download it
just because intellij doesn't auto suggest something does not mean it isn't valid
I FEEL SO DUMB
AAAAAA
ty for help though
in the tutorial it said to click reload if it doesnt come up and i didnt think that meant u already had to have that tped in for it to work
yeah thats how it works lol
intellij only autocompletes what you already have downloaded
and you can download it by just specifying the version you want, then click on reload
public class PutinPlugin extends JavaPlugin {
static Putin putin = new Putin();
public static Putin getPutin() {
return putin;
}
public static class Putin {
private Putin() {}
}
}
help why is not working
being sarcastic here?
Have you tried turning it off and back on again
"why is this working?"
Have you tried to extending the classes the tenure?
β
i think you need to yes through the maybes? if so.
just google "How to make Putin work"
Always when I pull information from a hashmap from another plugin of mine, does it return null? Can someone help me?
are you sure the key is mapped to anything in the map?
I think I do not understand
a hashmap is like a phonebook.
"mfnalex" -> 12345
"jesus" -> 6789
where mfnalex is the key and 12345 is it's value
so map.get("mfnalex") == 12345
Yes, when I pull information from the main plugin it returns normally.
but, i pull from other plugin, return null
sender.sendMessage("Β§c" + data.getLevel());```
what's the code for getPlugin(), getManager() and getCache()?
public ConsoleCommandSender console = Bukkit.getConsoleSender();
public LBPlayer getCache(UUID uuid) {
return cache.get(uuid);
}
public void addCache(UUID uuid, LBPlayer player) {
cache.put(uuid, player);
}
public void removeCache(UUID uuid) {
cache.remove(uuid);
}
public boolean hasCache(UUID uuid) {
return cache.containsKey(uuid);
}
public int cacheSize() {
return cache.size();
}
public HashMap<UUID, LBPlayer> getCache() {
return cache;
}```
Class Manager
Are you shading the other plugins classes by any chance ?
public static MainEngines getPlugin() {
return instance;
}```
getPlugin in mainclass
private static LBManager Manager;
return Manager;
}```
yeah you probably shaded your first plugin into the second one
hm yes
how to solve this?
Ye
lol
oh
what's the error you're getting actually?
are you shading your plugin ?
maybe it's indeed instance that's null
"always null" might just be a NPE on the initial instance
people that don't have java 15 NPEs have my condolences
at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeTask(SourceFile:144) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
at net.minecraft.server.v1_16_R3.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeNext(SourceFile:118) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
at net.minecraft.server.v1_16_R3.MinecraftServer.bb(MinecraftServer.java:1061) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
at net.minecraft.server.v1_16_R3.MinecraftServer.executeNext(MinecraftServer.java:1054) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.awaitTasks(SourceFile:127) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
at net.minecraft.server.v1_16_R3.MinecraftServer.sleepForTick(MinecraftServer.java:1038) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:970) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:273) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_292]
Caused by: java.lang.NullPointerException
at lb.levels.commands.tab.CommandTest.onCommand(CommandTest.java:23) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
... 19 moreat net.minecraft.server.v1_16_R3.PacketPlayInChat.a(PacketPlayInChat.java:49) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
at net.minecraft.server.v1_16_R3.PacketPlayInChat.a(PacketPlayInChat.java:1) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
at net.minecraft.server.v1_16_R3.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:28) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
at net.minecraft.server.v1_16_R3.TickTask.run(SourceFile:18) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
what's CommandTest line 23?
LBPlayer data = MainEngines.getPlugin().getManager().getCache(player.getUniqueId());
π¦
okay put this into separate lines, like this:
.
I seem to have been correct
MainEngines plugin = MainEngines.getPlugin();
Manager manager = plugin.getManager();
Cache cache = manager.getCache(player.getUniqueId());
or however your classes are actually called
then show the new error again and we know what's null
(or use java 17 when running your server)
is it enough to run it using java 17 or must it also be compiled for java 17?
afaik you are fine running it with java 17
or 15 for that matter
not like the bytecode actually contains NPE checks for this
yeah then that work too. although most people need an hour of explanation to change their java version π
and I guess spigot does not have the paper feature to skip java version validation
so 1.16 might explode
MainEngines plugin = MainEngines.getPlugin();
LBManager manager = plugin.getManager(); (return null in this line)
LBPlayer cache = manager.getCache(player.getUniqueId());
sender.sendMessage("Β§c" + cache.getLevel());
Ye
yeah as we suspected
you shaded your plugin and how you don't have an instance of course
show your pom.xml for the not-working plugin pls
?paste
pls
this makes no sense
how do you even access your plugin
you didn't add it as dependency
how did you even build the .jar?
Artifacts
ugh
you have to use maven to build your .jar
and you also have to use maven to add your other plugin as dependency
does artifact shade ?
that can be toggled per dependency I think
I'm out, no idea about the weird artifacts feature. I'd just switch to maven
^^ probably too
you could check what your failing plugin actually contains in the jar
by e.g. unzipping the jar file
oh yeah alternative might be that they never assigned instance
if the jar contains your MainEngines class file
in the main plugin
did you ever do "instance = this" in your main plugin somewhere?
yes.
then you must get rid of the MainEngines.class in your second plugin
I don't know how it works with artifacts
in maven you'd just have to add <scope>provided</scope> to your dependency
(strong suggestion would be for you to fully move to maven)
yep, currently you have a pom.xml but don't really use it π
after remove
add to your second plugin's plugin.yml
depend: NameOfYourMainPlugin
[LBLevels] Loaded class lb.engines.main.MainEngines from LBEngines v1.0 which is not a depend, softdepend or loadbefore of this plugin. suggests otherwise
oh
oh no wait
oh no nvm
lol
softdepend or depend doesn't really matter here
?paste your plugin.yml pls
looks correct to me
are you sure your .jar actually contains exactly this plugin.yml?
yes
and your plugin jar no longer contains the LBEngine files now ?
I think I do not understand
Yes at this point I am also rather confused. Your softdepending does not seem to work (for whatever reason)
I am still unsure if intellij is shading your LBEngines files into LBLevels
:/
I mean
when you compile your LBLevels jar
without modifying it
does it contain the MainEngines class file
Do several plugins use this dependency?
2-3
Relocate then
from the looks of it they do not want to shade
they want to depend on "api"
LBEngines is a plugin on its own
I see. So its a standalone spigot plugin that has common functionality?
Yes
Then make absolutely sure that no other plugin shades the api in.
the wird thing is that not even softdepend seems to be working for them
although I still think the actual plugin.yml doesn't contain the softdepend part at all
Open your jars with a compression application and make sure its not in one of them
probably they added it and then didn't install the updated .jar or sth
Didnt read far up to be honest
ok
Oof. I actually cant remember how to not build an uber jar when building artifacts...
idk I have never worked with intellij artifacts
I have no idea on how to use artifacts at all lol
Same XD
that was the reason why I hated intelliJ when I still used eclipse lol
there was just no file -> export to jar
I started with Eclipse and then switched to ij while also learning about maven
me too
never build artifact since then
Yes i remember this XD
no, there is no .jar in other plugins
would you mind sending your LBLevels .jar or what ever it's called?
Not surprising... I meant that you should check if the packages of your api is in one of the jars.
no, one moment
Yes they are
yeah it's still shaded
your levels plugin includes another copy of your engines plugin
so it never accesses the actually running LBEngines.getInstance(), but the included one
which was never instantiated
(or again, to make your life for future support a lot easier look into fully doing this with maven)
can you show a screenshot of your Libraries section of LBLevels?
+1
looks correct to me, but after all I have no idea how intellij shading works
in your Levels plugin...
can you see the LMEngine files there too?
did you maybe copy / paste them into the levels plugin?
no?
then I have no idea
Should be Project Settings >> Modules >> Dependencies Tab >> + >> JARs or directories...
oh yeah
check whether your LBEngines is marked as "export" there
if yes, untick it
although I guess modules is just for maven modules
not for manually added libs
You can just add jars there
(just forwarding the images they DMed me)
try to set it from "compile" to "provided"
here
ok, one moment
(although I doubt it's the problem because it's not marked as "export" - as said, we all have no idea about how intellij artifacts work π )
I put it and it still returns null
yeah sorry we all have no idea. we only use maven to not have all those problems π
I strongly suggest you to look into how maven or gradle works
π
ok, i'll get a tutorial, thanks.
if you'd upload both plugins to github, I can change your pom files so that it should work
π³
ohhh
ok
hey, I'm rewriting this really old plugin and trying to figure out how to make it more performant and less laggy, currently it updates a per player hashmap with player's speed from PlayerMoveEvent and more stuff, I feel like that affects the performance a lot, what are some recommendations to fix this
it's depending on getting the player's location to calculate speed and then use that speed to create a vector
What is the overall goal?
declaration: package: org.bukkit.entity, interface: Entity
it's an old soccer plugin, it's using Entity#setVelocity with some parameters that seem really poorly written to me
make a vector from those parameters and set the velocity to said entity
could pretty much just grab the velocity of the player at the point of "kicking the ball"
the euclidean length of the vector represents the "speed" of the player
Hi, may someone explain me how can I use showPlayer?
oh right I forgot to mention, the speed is also used to move the ball around
not just for kicking
Well you call it on a player you previously called hidePlayer on
okay @candid plover First thing: you have groupId and artifactrId messed up in your pom.xml.
It should be like this:
groupId: lb.engines
artifactId: LBEngines (not the other way around) Fix that please, then go to "maven" (right side) -> Lifecycle -> double click on "install"
in LBLevels, also switch groupId and artifactId
hello! for some reason this code isnt working:
package me.mrhonbon.coolplugin;
import com.destroystokyo.paper.event.entity.CreeperIgniteEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class Creeper implements Listener {
@EventHandler
public void onCreeperIgnite(CreeperIgniteEvent e) {
System.out.println("WATCH OUT!");
}
}
could someone help out?
yes
Did you register the event?
heh
i did register
done
package me.mrhonbon.coolplugin;
import org.bukkit.plugin.java.JavaPlugin;
public final class CoolPlugin extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
getServer().getPluginManager().registerEvents(new Creeper(), this);
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}
are you sure you want to println instead of sending players a message
because println ends up in the console
oh
bruh
bruh
yeah i want it sent to all the players MY FAULT LOL
π
Bukkit.broadcastMessage
π
also
if you want it to be in the radius of a player
declaration: package: org.bukkit, interface: World
did you also "install" LBEngine using maven -> Lifecycle -> Install?
neat
imma just send what's concerning me
this is what I'm worried about:
@EventHandler
public void onMove(PlayerMoveEvent event) {
Location to = event.getTo();
Location from = event.getFrom();
double x = Math.abs(to.getX() - from.getX());
double y = Math.abs(to.getY() - from.getY()) / 2.0D;
double z = Math.abs(to.getZ() - from.getZ());
this.speed.put(event.getPlayer().getUniqueId(), Math.sqrt(x * x + y * y + z * z));
}```
and then it's being grabbed like this: `power = this.speed.get(player.getUniqueId()) * 2.0D + 0.4D;`
and used with other values to make a kick happen:
```java
kick = player.getLocation().getDirection().normalize().multiply(power * charge * this.kickPower).setY(0.3D);
and finally set as velocity like:
cube.setVelocity(cube.getVelocity().add(kick));
yes
n * n π€’
n^2 π
okay, now add this to your LBLevels pom.xml (inside the part where you already have <dependencies>:
<dependency>
<groupId>lb.engines</groupId>
<artifactId>LBEngines</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
was too scared to even touch that
should look like this:
How about you just scrap everything and just get the velocity of a Player which is exactly the same
should I still update the velocity in that event?
just replace what's being calculated
Could not find artifact lb.engines:LBEngines:pom:1.0-SNAPSHOT in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
Could not find artifact lb.engines:LBEngines:pom:1.0-SNAPSHOT in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
after you've done that, also double click on maven -> lifecycle -> install in LBLevels. You WILL get some errors because it won't find @ NotNull annotations from com.sun.istack package. Simply remove that import in your 4 command files, and also delete the @ NotNull annotations. Now it should work perfectly fine
Paper -> use adventure
Because for some reason Strings are deprecated. I think this is a highly questionable decision but well...
are you sure your LBEngines pom looks like this?
You dont need the map at all and you dont need to calculate the players velocity
yes, but it requires another argument
why the hell are strings deprecated in a method that uses a string
as said, groupId must be lb.engines and artifactId must be LBEngines
confused what do you mean by that
alright, thank you, I'll try it out
ye thats why im confused
Adventure is actually really nice
takes a long ass time to get into if you have no idea how to tho lol
Ask in the paper discord
ok, i change
The methods that take in a String are deprecated in favour of TextComponent methods as Paper uses Adventure instead of Bukkit/Mojang's "legacy text" system (which would be colour codes)
paper is bumbum head
It also sometimes explodes my legacy code from 2 lines into 2 methods with 10 lines each
I think it's actually smart Paper did that
dear lord lol
I opened a pull request on github for both your plugins. just accept the pull request on both plugins, and redownload both projects from github. then, first install LBEngine, then install LBLevels. should work now
not for a fucking message broadcast method
imagine
See I like that Paper did build it in, makes it much easier to work with imo but its a fucking nightmare to get started with adventure
Like its documentation SUCKS
As other people have mentioned, Adventure is much closer to how Minecraft servers actually represent text.
This. Took me a while to find out the more complex features.
.with is a thing...?
also Adventure is not nearly that complicated
"imagine"
It took me fucking 3 days to figure out how to do stupid hex color codes in a message
it doesn't do char-by-char
a good use for adventure^^
I'm pretty sure you can do TextComponent.of("") for text with no formatting
But why deprecate the String methods? Why force verbosity.
As an additional feature adventure is really nice. But taking away trivial approaches is not.
but idk been a while
lol wtf? I just use ChatColor.translate...
It's less clean to do that for hex color codes.
Since each hex digit must be specified separately.
I didnt find a way I liked with the translate for the bukkit ver
yeah I just run it through some regex beforehand
I wanted something like <#123456 >
hmm interesting
i made pull
(also personally I don't like relying on color codes as opposed to enums)
(codes makes it easier to forget what is what color)
Either way I did want to get into working with adventure as I wanted to do more indepth stuff with chat
but it was nightmare lol
Oh yeah Adventure can also do stuff like hovers and clickables right?
yeah
Also translatable text?
Yeah so that's why Adventure exists. You can't really do that as well with legacy text.
just redownload both projects now from github, open them in intelliJ, maven > lifecycle -> install. first in LBEngines, then in LBLevels
now you have both .jars and they should work fine
You can just not that great
Which is why I said "as well"
Anyway Adventure is great, but I agree they could have better docs
and NOT use "Artifacts" again. From now on, always use maven to compile
Paper did a decent way of implementing it for most things, so you dont have to deal with a lot of the adventure stuff, but I could find like no good documentation on any of the specific implementation and Adventure, and its documentation previously mentioned helped none lmao
Oh also
I think I got Conclure to help me or smth lol
String-based methods aren't removed in Paper
Just deprecated
You can still use them, theoretically.
As stated before: Remove the "speed" map. You can get the velocity of any entity at any time.
since paper claims to be a drop in replacement for spigot, they'll never remove them unless spigot removes them too
It's a warning about convention
yeah that makes sense, I'm just looking for all the doubles that were multiplied by that speed and trying to make sense of it all
"This API usage is unconventional to this framework but must remain for compat" ig
Not if you have tools for quality assurance like sonar that dont let you use deprecated method.
Is there no way to configure those? :p
Sure. But thats like buying a security system and then disabling it because you dont like the idle blinking when you sleep.
Well
QA should be useful to the devs
Therefore devs should have control over it
If there's some edge-case, then why not allow them to handle it?
I think it's valid to disable deprecated methods detection if you must use deprecated methods to make your life easier.
Deprecated methods are not an edge-case...
In this situation they are
No because there are a ton of other deprecated methods in spigot. Which makes the string based broadcast not an edge-case by definition.
well it's kinda bullshit for paper to make them deprecated if they are fine to use spigot and you want to support spigot too
but yeah if you use paper-api, you don't wanna support spigot anyway, so
either use spigot and use their methods or use paper-api and don't use deprecated methods imho
meh
yeah i am so confused
package me.mrhonbon.coolplugin;
import com.destroystokyo.paper.event.entity.CreeperIgniteEvent;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class Creeper implements Listener {
@EventHandler
public void onCreeperIgnite(CreeperIgniteEvent e) {
TextComponent textComponent = Component.text("Watch out!");
}
}
this makes me so mad
thats so ugly bruhh
While I am fine with them supporting adventure, and recommending it a lot, I dont feel like its the best reason to depreciate events, methods, etc. Also some of the naming conventions for adventure stuff I think is horrible, but thats just my opinion (Like for example, the paper server ping event is like Event#motd(TextComponent)
Good. Now broadcast the component. And after that you should ask in the appropriate discord server for help.
?paper
I thought they removed all the old com.destrostokyo stuff years ago and switched to the new packages
No it ain't :p
Static factory API is beautiful :<
I also miss the "getX" "setX" convention. But they had to change it so they could be backward compatible.
ah
I just generally hate getters/setters
They are fucking annoying
I understand their point
but they make code so much uglier
whats your alternative? rawdog the variables?
Then make all your fields public
See I wish I could do that
There's a name for that method name style. I forget what it's called for the life of me
fluent ?
I really dislike it but it's where Java conventions are going now-a-days
Yeah something like that
I mean, records expose fluent style getters π
yeah Im not a fan of it
Yeah, records use them
Am I the only person here who actually enjoys fluent style
its so bad
nah maow I am down for them
Lmao
Like programmers are always arguing over stupid bullshit all the time
and they're always so self-righteous and full of themselves >:(
of course method getter names are better for records
I mean as long as we all agree that gradle is objectively better than maven it is okay
π
levae ^
LOL
Both suck
Just use Make π
Ant π
(jk, Make also kinda sucks)
I can get behind that
make one
we all use it and make it official for spigot
"kinda"
I actually plan on making my own buildsystem soon
It's conceptually good.
so bad
needs to be
setRenderer
showm e
But then Make has so many weird nuances that cause issues for newbies to it
keep in mind might be an easier way to do it
Im gonna write it in js and use 12GB of npm packages.
Oh and it runs on a node server.
And is terribly difficult to read
but thats how ive figured it out
No wait. Ill make it an electron app.
god
Okay actually this is pretty awful
I thought you meant in like
builders or whatever
cuz in builders it looks nice
I mean
thats how I figured out to deal with formatting chat
it also just plain looks wrong
@eternal night we fixed the LBEngine thing by properly compiling with maven π
static methods = no
new StringUtils()
just as a heads up rack, components on the same level do not inherit their chat colour o.O
what?
I like to static import stuff like EventPriority
you act like I can understand adventure
XD
Like
.append(Component.text(CC.WHITE))
.append(Component.text("This must be white"))
is wrong
no
it work in my case Β―_(γ)_/Β―
Static imports make this look nicer btw
.append(text(""))
Okay unless you're not using an IDE
I hate static imports
No
You can easily track a method call to where it came from with an IDE
And most developers use an IDE
but you shouldent have to
It's literally just a second of hovering over the call
And it shows you it comes from Component
thats a second wasted
I'm fucking with you on that, still imo dont like them
but 30 seconds saved for not having to type Component all the time
Okay yeah
Is it just me or does anyone else hate when someone makes a joke in the middle of a serious conversation??
its what I get for doing the same thing for so many years lol
what's really disgusting is when people use this.stuff() all the time lol
.append(tex
EXACTLY
you can auto complete to .append(Component.text(
Sometimesβ’οΈ
idk did it all the time
python is weird because people always import stuff under different names
but intellij is intellij
like import System.out as sout
so ye, sometimes π
I never type system.out anymore
import requests as scrambledeggs
Only type sout and let it autofill
yeah it was an example for python devs
Really screws me up when I aint in IntelliJ
intellij cli version when
that
is basically all CLI editors ever
except with code inspections and autocompletion
public class AClass extends JavaPlugin {
private String name;
private int age;
public AClass(String name, int age) {
AClass me = this;
AClass that = me;
me.age = age;
that.name = name;
}
}
beautiful
oh my god
I love how it's a JavaPlugin too so it'll probably error on instantiation.
Noice
Here's my favorite example of odd code style that takes full advantage of the lexer:
for (int i = 5; i --> 0;) {
System.out.println(i);
}
You have just been introduced to the ""down-to operator""
It is in fact
(i--) > 0
that looks so weird
Would be nice if the second semicolon could be left out here
yes they are beautiful π
real devs don't use forloops, just int streams for that maximal performance
Finally someone agrees
...Of course!
or copy/paste
π₯³ sick
Don't hurt me
I love those stackoverflow questions like "how can I print out all even numbers between 0 and 20 using java" and people answer with
System.out.println("24681012141618");
Ez, first you must-
import isodd;
When i first learned streams i loved them so much that i literally replaced for loops with something like this
public static void main(String[] args) {
IntStream.rangeClosed(0, 5).forEach(System.out::println);
}
I should make a compiler that optimizes eager streams down to loops
javac does this in newer versions already
o.O
I think so
I didn't think Javac had complex optimizations like that
And... I've literally been in the Javac code base before lol
It's a fucking nightmare.
Hm maybe it was just the jit doing the work...
you actually dont want that
see: haskell
this is the code @lost matrix sent
He was talking about the compiler opt
I really like higher-order functions and fluent codestyles
But shit like monads is where I draw the line tbh
does it have to be enabled manually?
Y'know where every type of function must have its own complicated-to-explain term
most if not all optimizations are done with the JIT compiler
I love how java is like "ugh calculating 3*3? What a waste of time, let's replace it with 9."
and then on the next line it's like
"Oh, the square root of 4? Better calculate this one at runtime!"
JIT has two modes it operates in. Interpreted and compiled. It will run your code through interpreted mode if it doesn't already know the optimizations to make for native and observe however long it deems necessary to make the what it thinks is the correct optimizations.
the reason that is done at runtime has to do with floating points
IN ALL FAIRNESS
floating points work differently depending on the OS and CPU
Java also calculates string concatenation at compile-time if possible
yeah but 4 is an integer and 2 is an integer too
strictfp π
Fun fact: strictfp is applied to all classes as of Java 16 I'm pretty sure
4.0 is a floating point
it may have started as an integer but to do square root properly and use cpu extensions it has to be a floating point
it makes no sense anyway because I entered 4 and not 4.0 and java should be easily able to see that
It has to convert int to float to perform the calculation
java 17 removed strictfp's functionality
It would also be a bit weird to optimize method calls at compile time.
Imagine if someone had a different jvm version that handles the sqrt method differently.
but tbh if sqrt(4) ever returns something different than 2, then it's broken
Ye the ACC_STRICT flag is now ignored by the JVM as strict floating points are now mandatory.
π
08.02 22:31:06 [Server] java.lang.NoClassDefFoundError: org/terraform/coregen/populatordata/PopulatorDataAbstract
08.02 22:31:06 [Server] at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
08.02 22:31:06 [Server] at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3344)
08.02 22:31:06 [Server] at java.base/java.lang.Class.getConstructors(Class.java:2043)
Anyone got an idea on how I would be able to access this abstract class? lol
Make sure its there at runtime
shade it?
damn, that really is a lot easier, I've been playing around with it and the only thing that concerns me is that the values are not the same (old and new speed), is it because this is more accurate or?
in order for the compiler to know this, it would have to have done the square root calculation, however instead of risking such intensive process without looking at the numbers, it instead opts to not do such like it did with 3*3
46 = 1.2
60 = 16
use the library loader to spit on maven central TOS ?
yeah I know why, it's still stupid. Math.sqrt must always return the same value for the same input so it could have easily just replace it with the result
not sure where you got that must return the same value?
square root on one system is not always exactly the same as another
even if its whole numbers
It does not. Maybe the implementation uses a fast approximation that isnt fully accurate.
for instance, whole numbers or Integers are sometimes not really whole numbers π
I wonder which implementation returns 1.99999999 instead of 2.0 for sqrt(4)
it could return 2.000000001
*if saved in a float
but Math.sqrt returns a double
2 will be 2
The JVM spec doesn't say how an Integer must be represented internally only that it must function as the API expects it to
If you study cs then you will most probably have a course called numerical mathematics where you learn about the limits and precision of computers.
You will be astound how weird and inaccurate computations can become quite fast.
I get that, but how would it hurt to replace sqrt(4) with 2?
the compiler doesn't invoke methods when compiling as well
it depends on how sqrt is calculated
yes, my whole point is to say it would be useful if would do that sometimes
As compile opt? Because sqrt(4) doesnt have to return 2
as said, I'd love to see an example of when
Math.sqrt(4) == 2.0
return false
if anyone could show an example, that would be nice
just fyi on this, a double is a float just a more precise one as it can have 15-16 decimal places as it is 8bytes wide unlike a float that has 6-7 decimal places as it is 4bytes wide
You should NEVER compare floats with ==
I know what a double and or a float is π
both are doubles
floats in the sense of floating point numbers. Of any precision.
...really? I never knew that.
How do I compare them then?
and doubles are also just floats. Double precision floats. But still floats.
well as stated before, just because it looks like it is a whole number doesn't mean it really is =/
(Y'know I don't work with floating point stuff that often lmao)
using < >
With an epsilon
because "Due to rounding errors, most floating-point numbersΒ end up being slightly imprecise. However, it also means that numbers expected to be equal (e.g. when calculating the same result through different correct methods) often differ slightly, and a simple equality test fails"
...what is an epsilon?
Lowest acceptable delta
I just ran Math.sqrt(4) 100 times on linux amd64, windows amd64, and linux on arm, with jdks between 8 and 17, both oracle and adoptopenjdk and it always returned 2.0 and was == to 2.0
What is a "lowest acceptable delta"?
so all I want to say I'd love to see someone show a situation where this wouldn't work
the lowest difference that you can accept
you are also forgetting hardware and JVM implementation matters
Ah
double epsilon = 1E-6;
if(Math.abs(d1 - d2) < epsilon) {
}
epsiolon is basically a number > 0 but as small as you'd like
That is fuckin' obnoxious
the smaller the less errros you tolerate
it's because if you calculate the same thing two different ways, you can end up with two slightly different values
because floating point is imprecise
I am not forgetting, that's why I tested it on different platforms
all I want is one example of where it would not work
I don't wanna say it will always work, I just want to see one example of a situation where it wouldnt work
double d1 = 0;
for (int i = 1; i <= 8; i++) {
d1 += 0.1;
}
double d2 = 0.1 * 8;
System.out.println(d1);
System.out.println(d2);
Resulting in:
0.7999999999999999
0.8
I was only talking about my Math.sqrt example all the time
I mean it's still really obnoxious
them's the breaks
I understand why Minecraft had such a bad floating point precision error back in the ol' days now
I mean not really fixed per-say
I think they should've kept the chunk generation for them
yeah they added a world border lol
it's because floating point numbers are adding negative powers of 2, so there's not a floating point representation for some decimal numbers
Just removed all the other glitchy aspects
Like the hitboxes being offset or disappearing
And sound beginning to break
Or
java does some implicit rounding off
The game crashing if you go too far
lol
But yeah an official Far Lands biome would've been awesome.
i think
I can imagine people building bases in them.
also for Math.sqrt(2.0) it wouldn't shock me if there was a lookup table under the hood for small perfect squares
Or falling blocks breaking Euclidean geometry
Unless you change the radix ;D
lol
example 0.1
but i think most languages do a round off
so it will still show up as 0.1
smh still 6% on java 8
Java 8 is so nice though :(
don't even want to know how many enterprise applications still run java 8
that is because of the limitation of integers π
java 8 is da bomb diggity
Why are you talking in outdated slang
whut
Anyway so like
then you really don't want to know how many are running 5 6 and 7
yea i recently stumbled upon a project that uses java 6
I would be surprised if anyone was running Java 5 o.O
there's enterprise systems still using vista
at least pre java8 is non-existant in MC servers π
my father's office still used win 2000 server a few years ago
not surprised one bit
the servers weren't connected to any internet thingy though
maven is on the forefront of progress
To this day I argue Java 8 is probably one of the best versions of the lang out of principle.
try support only 1.18.x servers, your java 8 will go away
That is because Java 8 is capable of running precious compiled versions and second the GC in Java 8 in comparison to 7 is a whole lot better.
I know but currently there's still many 1.16 people out there
Java 8 is nice because Java 9 encapsulated the language harder than I encapsulate my bott- Not going to finish that sentence.
tbh java 8 is great just because it brought functional programming to java
or well, first-class functional
Lambdas get overused
I dislike lambdas
I think first-class is actually pretty smart
java 8 was the best update ever but I still don't get why people don't update
Legacy reflection was awesome :(
π what to do if I cannot change my private static final field
Unsafe
yeah because xX_awesome_Admin_69_Xx knows what reflection even is lol
Until that goes away too
one of the reasons has to do with reflection being deprecated in 11 and then stuff being removed/replaced in java 12 that a lot of things before those versions relied on.
doubt that unsafe will go away any time soon
Donβt jinx it
there is always a need for bypassing the compiler/runtime
No it will eventually
They are slowly replacing Unsafe's methods with safe API alternatives
You know allocateMemory? That's the Foreign Memory API from Java 16 (or is it 17?)
There is currently a couple of unsafe methods that would probably prove difficult to remove
Yeah but it'll be out of incubator soon.
unsafe is for interacting with the JVM directly
Probs Java 19 or 20
just give me valhalla Β―_(γ)_/Β―
I wish they had actual language features for Unsafe
only thing I really care about at this point
you can invoke C stuff with JNI
not one single server in north korea π¦
Yeah but then it's not Java
also wtf is wrong with africa
there probably could be servers in NK just we wouldn't know about it. Remember, the internet there is heavily regulated in regards to outside connections XD
new: ~0.21, old: ~0.35 - whilst it's not exactly the same, I think that this makes it actually better
Poverty
thank you for the help 7smile7
well I get emails from a rich prince from ghana all the time
he wants to give me all his money
Hmm
so he must be able to afford an MC server
Did he move from Nigeria
Maybe he just doesn't like MC
nah that's his cousin
He probably plays roblox instead
ugh
uuugh
well at least everyone got a lesson in regards to floating point arithmetic's and precision π
greenland also has not a single server
What about Antarctica
not on the map π¦
Eh there's probably some bored researcher down there
I wasn't the only one that provided information in regards to that topic
Mmm
BStats is unusable smh
arctic and antarctica are missing completely
You're the only one I remembered
there was AlexThecoder and 7smile7
That ain't equality
they also confused austria and austrlia
Oh
@brave sparrow You get a πͺ too
rwanda has more servers than the rest of africa combined
Did Alex and Alex ever fight to the death
it has like 80% of all servers in africa and it's one of the tiniest countries lol
can the other african countries even afford computers?
See, size doesnβt matter
south africa can for sure and marocco too
egypt too
but only 5 servers in whole egypt
that's a lot
(5 who have bstats enabled)
Believe it or not, not all of Africa is starving to death
Well there was like a civil war in Egypt wasn't there?
they are probably too busy fixing everything
it's going since like 10 years now
I still remember when I was out drinking and my father called in the middle of the night and said "my friend gadaffi is dead π¦ "
but that was lybia not egypt
egypt was mubarak
Rip gadaffi
ngl I was hoping for an r/mapswithoutnewzealand situation here
Pr it
ca4431b - Removed New Zealand from map
Maybe bstats consumed your data for antartica, that there are secretly a lot of servers in antartica but must be hidden as part of the effort to conceal a conspiracy
Probably because of the ice walls
yeah that makes sense
lol I was not implying this, however in a lot of countries computers/electronics are actually quite expensive to purchase/own. Easy to not know this or forget this if you live in a country where you have a higher standard of living where these things are actually quite cheap.
I recall watching a documentary in regards to some countries in Africa where most people actually don't own a computer and that most people who use a computer do so at a cafe where a computer is provided for public use, but not many of such are actually provided so it is quite common to share said computer with multiple people at a time.
I sent some bstats screenshots
because why not, nothing else going on π
I noticed that there's 500 mc servers in africa, 450 of those are in rwuanda, and then like 3 in egypt etc lol
I also wouldn't exactly say they live in poverty. It is easy to say someone lives in poverty if they don't have same access to stuff like someone in the US, however some people's way of life don't include needing that stuff to begin with.
No
you can only use textures that were signed by mojang
You canβt add arbitrary capes server side
unless you use client mods or unless mojang changes how vanilla client worls
It is true that player skin changing isn't do able via the API, but not impossible to do server side just need to use NMS because you need to get at the GameProfile to change the player skin
also have to resend some packets as well in regards to other players so the effect happens for everyone and not just the one person XD
it verifies the signatures with Mojang API
there's some websites that give you premade skins + valid signatures for it but that won't work for capes
Yeah you can't change a player's skin or profile at all with the API
π¦
well IRC NMS is not needed to change textures, only some reflection on GameProfile right?
wdym "still be allowed"?
You can't do that now
Doubt it
GameProfile is only accessible with NMS
Can't really add a cape to a player either as far as I'm aware. Nor should you because that's definitely a EULA violation
I wrote a capes mod once
unless you are optifine π
Donβt make me get the gif
Optifine is... weird. It's in violation too lol
I've heard it's only a EULA violation if you are selling capes
Optifine does sell 'em
Which they do
my former's employer's server was banned by mojang for a few months lol
$5 or something
10
Ye it's part of their donations
Mojang knows they sell capes too π
Furry
damn that true
That's hot
@hexed hatch Pardon?
Minecraft: Furry Edition
One day, we will get a Minecraft 2 version XD
β Guilty as charged.
and then all update mechanisms will break π
I mean it literally says "Your local furfag" in my bio so if there were any confusions I'd be confused.
I got one plugin that's at major version 13 now lol
mojang is just afraid of big updates
This is such a computer science major moment
Where does it say that
Mojang's EULA since like forever
the eula changed like 2 years ago
now it's even allowed to sell ingame currency
but it depends
Capes are special
e.g. on pvp servers it's not allowed to sell some kind of totally OP weapons
Mojang wants them to stay special
not that they could prohibit this since in game currencies are not part of their assets or creation π
but it's totally fine to sell currency on city build / economy servers
Afaik I thought they just didn't want you selling P2W items
ofc they could prohibit this. as said, mojang basically banned my former employer's server's IP back in 1.10 or sth
for months
But cosmetics, like capes, are absolutely fine.
Originally they didnβt want you selling anything non cosmetic
really they just want people to stop complaining to Mojang about servers they don't control lmao
this
as said even ingame currency is fine or other perks like getting faster horses, etc
it is just a blacklist and doesn't stop people from connecting lol
Why would capes be an exception
because Capes are special for Mojang
You can force them
vanilla clients couldn't connect
As for why you canβt remodel entities, idk, ask Mojang
Considering Optifine, Lunar and BLC all sell capes as their main source of Income, I'm going to assume that Mojang doesn't care. 
and if you tell people to use hacked client XYZ or forge mod XYZ to connect, you'll lose 99% of players
Well yeah
Mojang does care, but it is quite possible that they have agreements with Mojang about this which that isn't illegal
I guess they could, no idea. π€·ββοΈ
just because an EULA says you can't do something, doesn't mean you can't ask permission to do it anyways
if they say yes you can, you have been granted an exception π
There really isnβt a reason for differences between Java and Bedrock resource packs. Eventually, I imagine they plan on making it so you can make entity models in Java and item models on Bedrock, but it isnβt a priority of theirs
I have to correct my statement, it was in 1.9 when they started blacklisting servers
if it is against their EULA it isn't illegal per-say but you are breaking the license agreement and thus subject to a lawsuit π
this
And getting sniped
you can't sell someones game assets and not expect a copyright or DMCA against you
Bill gates will snipe you personally
but capes ain't game assets are they
optifine capes can only be seen by players who uses optifine etc.
my cousin sold WOW accounts years ago, blizzard sued him but couldn't provide any proof for having any money losses so they lost
but he went to prison anyway for drugs lol
i mean, sure. I'm not a server owner
then you as a user have nothing to worry about
people like Optifine would have something to worry about instead
but again Optifine has an exception. I know they do because Mojang almost bought them out π
but Optifine declined the offer
damn
I doubt that because mojang would have to prove that optine basically "took away mojang's income" or caused any other damages
optifine to remain relevant
i like optifine
Because itβs closed source
in the US Game modifications are subject to the EULA of the game maker
I don't know how it applies elsewhere
yeah but is there any "contract fee" defined in the eula?
idk, I havent read it in a long time
there doesn't need to be a fee associated
but to get money, they'd have to prove they got any "damage" caused by optifine
simply breaking the EULA is enough to be sued, you don't have to prove damages just have to prove they broke the EULA