declaration: package: org.bukkit.entity, interface: Vehicle
#help-development
1 messages Β· Page 2030 of 1
that makes sense
In Java docs it exaplains u like the use of banner in org.bukkit.....
thx
But
what exactly is your question
I want to code
In Java docs
you can't code in java docs, it's not a coding language
It oy exaplains u what things are
But
In this case
I wanna code
So
From where can I learn the code of Java docs
it basically explains everything
π€
do you want the code behind the javadocs?
?stash
it tells you what constructors a class has, what methods and fields its instances have, etc etc
no
ctrl shift c?
Exactly my point
.
he wants to know on how to "turn" what he reads on the docs into code
Oh that is the stash
I doubt he cares about how the javadocs were generated
@tender shard it seems that java biome.getClass().getDeclaredField("k").getClass() has no fields
oh I am sorry
you of course have to first get the object that's in that "k" field
and then get the class of that object
so ```java
biome.getClass().getDeclaredField("k").get(biome).getClass()
How can I make that /help does another thing instead of minecraft default's of displaying all commands from all plugins?
override the /help command
by declaring "/help" to be a command in your plugin.yml
I just make another command named /help?
yeah
commands.yml
Is there no collision detection between player and block that I can use (cant find it in javadocs).
overriding help will not work as you can still do /minecraft:help
No, commands.yml
At least I think so
I just want that /help does another thing
Lemme explain you in a simple way, suppose i wanna code an explosion, javadocs show in which importstatement u should do it on org.bukkit....
idc if /minecraft:help still works
Commands.yml is the simplest solution either way
to also prevent people from doing /minecraft:help, one would have to listen to the PlayerCommandPreProcessEvent or however it's called
I wanna learn the code to do it
I really do not care
to get your own /help you can just declare your own "help" command
I just want /help for making a menu
From which website can I do that
yes, as said, declare "help" to be a command in your plugin.yml
as we said, none
Then how to learn
Stop asking the same question over and over again if we consistently give the same response
Brute force
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Bukkit's getting started page was a good place to get started
paper recieved update?
anyone know if there is any collision event between player and block >_<
albeit it is a bit dated these days
or is this impossible
there is none
collisions are basically done client side
shoot
that's why clients can cheat themselves through blocks etc
that's why anti cheat plugins exist
(well, it's ONE reason why they exist)
no idea what the best getting started guide is nowadays given that I started with plugins back in the 1.8 days with CanaryMod and migrated to bukkit in the 1.12 days
butter chicken
canary mod? you must be talking about BETA 1.8
thx for telling me though, I was looking for hours and could not find anything, this clears it up
The canary mod rewrite lasted until 1.8
yeah there's nothing on the server for it, that's also the reason why NPCs (fake entities) don't have proper collisions etc
didnt know that
dang did not know that, thanks
I started programming with a book that said "bukkit bad because DMCA" (paraphrased), so it used canarymod
Field data = oldBiome.getClass().getDeclaredField("k");
data.setAccessible(true);
Class<?> dataClass = data.get(oldBiome).getClass();
Field temperatureModifier = dataClass.getDeclaredField("d");
temperatureModifier.setAccessible(true);
BiomeBase.TemperatureModifier modifier = (BiomeBase.TemperatureModifier) temperatureModifier.get(UNKOWN);```
π€ What Am I supposed to use to replace 'UNKOWN' ? I need a **BiomeBase.d** type var, so I would need to cast data into **BiomeBase.d** it but it's impossible
If you send me your server .jar, I'll write it up for you
DM me your server .jar
I don't have any 1.17.1 .jar
temperatureModifier.get(data.get(oldBiome)) I'd say
nope
I. e. you'd have something like
Field dataField = oldBiome.getClass().getDeclaredField("k");
dataField.setAccessible(true);
var dataInstance = dataField.get(oldBiome);
Class<?> dataClass = dataInstance.getClass();
Field temperatureModifier = dataClass.getDeclaredField("d");
temperatureModifier.setAccessible(true);
BiomeBase.TemperatureModifier modifier = (BiomeBase.TemperatureModifier) temperatureModifier.get(dataInstance);
as said, BiomeBase -> get field "k" -> this returns a BiomeBase.d -> from that, call the "d" field on the BiomeBase.d object
well actually I have no more error with it, I have to test the next step
try this again pls:
BiomeBase biome = null;
Object biomeBaseD = biome.getClass().getDeclaredField("k").get(biome);
Class biomeBaseDClazz = biomeBaseD.getClass();
Field temparetureModifierField = biomeBaseDClazz.getDeclaredField("d");
BiomeBase.TemperatureModifier modifier = (BiomeBase.TemperatureModifier) temparetureModifierField.get(biomeBaseD);
this should put the TemperatureModifier of "biome" into the "modifier" variable
I am 99% sure that it works. if it doesn't, please show the exact error message you get while using exactly this code ^
(obviously you still have to make the fields accessible)
so again, here's the full code:
BiomeBase biome = null;
biome.getClass().getDeclaredField("k").setAccessible(true);
Object biomeBaseD = biome.getClass().getDeclaredField("k").get(biome);
Class biomeBaseDClazz = biomeBaseD.getClass();
Field temparetureModifierField = biomeBaseDClazz.getDeclaredField("d");
temparetureModifierField.setAccessible(true);
BiomeBase.TemperatureModifier modifier = (BiomeBase.TemperatureModifier) temparetureModifierField.get(biomeBaseD);
this also makes the fields accesible
probably about the same thing I proposed
might be true, haven't checked
I used names similar to the classes so I can keep track of what classes I am actually having
reflection can be very nasty
Didn't you forget to set the accessibility to true ?
see my updated code
^
if that doesn't work, send the full stacktrace and I'll get you a working version with the .jar you sent me
@calm whale does it work? π
I wonder, what do you even need the TempMod for?
nms man
the worst thing is: maven-special-sauce not support Class.forName("...") etc
I'm stuck with the accessibility
why? what's the error you're getting?
that I cannot access a private member xD
wrong channel
full stacktrace
oldBiome.getClass().getDeclaredField("k").setAccessible(true);
Object biomeBaseD = oldBiome.getClass().getDeclaredField("k").get(oldBiome);
Class biomeBaseDClazz = biomeBaseD.getClass();
Field temparetureField = biomeBaseDClazz.getDeclaredField("c");
Field temparetureModifierField = biomeBaseDClazz.getDeclaredField("d");
Field downfallField = biomeBaseDClazz.getDeclaredField("e");
temparetureField.setAccessible(true);
temparetureModifierField.setAccessible(true);
downfallField.setAccessible(true);
float temperature = temparetureField.getFloat(biomeBaseD);
BiomeBase.TemperatureModifier temperatureModifier = (BiomeBase.TemperatureModifier) temparetureModifierField.get(biomeBaseD);
float downfall = downfallField.getFloat(biomeBaseD);
newBiome.a(temperatureModifier);// Temperature modifier
newBiome.c(temperature); //Temperature of biome
newBiome.d(downfall); //Downfall of biome```
i don't see where I forgot the accessibility param
java.lang.IllegalAccessException: class net.johnpoliakov.snowycraft.BiomeBaseWrapper_1_17R1 cannot access a member of class net.minecraft.world.level.biome.BiomeBase with modifiers "private final"
there is no stacktrace
yup I know, I caught the IllegalAccessException
it suggests that Object biomeBaseD = oldBiome.getClass().getDeclaredField("k").get(oldBiome); errors out
catch (NoSuchFieldException | IllegalAccessException e){
Bukkit.getLogger().info("Β§c"+e);
Bukkit.getLogger().info("Β§cERROR: Cannot add snowy variant of Β§e"+biome.getKey().getKey());
}```
do e.printStackTrace()
^
then you have a proper stacktrace
then send it
I really need to do a blog post about people not sending the full error
[18:53:48 WARN]: at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
[18:53:48 WARN]: at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674)
[18:53:48 WARN]: at java.base/java.lang.reflect.Field.checkAccess(Field.java:1102)
[18:53:48 WARN]: at java.base/java.lang.reflect.Field.get(Field.java:423)
[18:53:48 WARN]: at SnowyCraft-1.0-RELEASE.jar//net.johnpoliakov.snowycraft.BiomeBaseWrapper_1_17R1.build(BiomeBaseWrapper_1_17R1.java:52)
[18:53:48 WARN]: at SnowyCraft-1.0-RELEASE.jar//net.johnpoliakov.snowycraft.SnowyCraft.onEnable(SnowyCraft.java:22)
[18:53:48 WARN]: at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264)
[18:53:48 WARN]: at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370)
[18:53:48 WARN]: at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500)
[18:53:48 WARN]: at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:561)
[18:53:48 WARN]: at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:475)
[18:53:48 WARN]: at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:733)
[18:53:48 WARN]: at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:317)
[18:53:48 WARN]: at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1220)
[18:53:48 WARN]: at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319)
[18:53:48 WARN]: at java.base/java.lang.Thread.run(Thread.java:833)
To be fair, doing throwable.toString is a mistake even more advanced people do
Object biomeBaseD = oldBiome.getClass().getDeclaredField("k").get(oldBiome);```
what's SnowyCraft line 22?
Hah, I knew it
you didn't set oldBiome.getClass().getDeclaredField("k") to be accessible
oldBiome.getClass().getDeclaredField("k").setAccessible(true);
Object biomeBaseD = oldBiome.getClass().getDeclaredField("k").get(oldBiome);```
it's your code
File var10001 = oldBiome.getClass().getDeclaredField("k");
var10001.setAccessible(true);
Object biomeBaseD = var10001.get(oldBiome);
Class biomeBaseDClazz = biomeBaseD.getClass();
Field temparetureField = biomeBaseDClazz.getDeclaredField("c");
Field temparetureModifierField = biomeBaseDClazz.getDeclaredField("d");
Field downfallField = biomeBaseDClazz.getDeclaredField("e");
temparetureField.setAccessible(true);
temparetureModifierField.setAccessible(true);
downfallField.setAccessible(true);
float temperature = temparetureField.getFloat(biomeBaseD);
BiomeBase.TemperatureModifier temperatureModifier = (BiomeBase.TemperatureModifier) temparetureModifierField.get(biomeBaseD);
float downfall = downfallField.getFloat(biomeBaseD);
newBiome.a(temperatureModifier);// Temperature modifier
newBiome.c(temperature); //Temperature of biome
newBiome.d(downfall); //Downfall of biome
try this
Copy paste error
don't call it "var10001"
xD
call it "biomeBase_field_k"
I know, but not knowing what this field does I just called it like that
trust me, I do reflection way too often, I know that it's really important to use proper names when doing reflection π
otherwise you get lost
var1000x is my default naming scheme for when I have no idea of what I am doing
why didn't you just use this?
I am pretty sure the code I sent will work fine
oldBiome.getClass().getDeclaredField("k").setAccessible(true); does not seem to work
why not?
indeed
because it throws the exception?
oh whut, did I misread sth
Java logic I guess
It likely resets the accessibility for each object which makes sense I guess
but donno
if setting it accessible once doesn't work, yeah cache the field object and reuse it
one sec
π π π π π
try {
BiomeBase biome = null;
Field biomeBase_field_k = biome.getClass().getDeclaredField("k");
biomeBase_field_k.setAccessible(true);
Object biomeBaseD = biomeBase_field_k.get(biome);
Class biomeBaseDClazz = biomeBaseD.getClass();
Field temparetureModifierField = biomeBaseDClazz.getDeclaredField("d");
temparetureModifierField.setAccessible(true);
BiomeBase.TemperatureModifier modifier = (BiomeBase.TemperatureModifier) temparetureModifierField.get(biomeBaseD);
} catch (Exception e) {
e.printStackTrace();
}
try this, and EXACTLY this pls
it works well, I'v just figured out something really cursed
(except for biome= null of course)
Even more cursed than reflection?
reflection itself isn't cursed
lol no, it's a logic thing but it involves so many other things
reflection actually is awesome
I prefer access transformers, sadly we do not have this in bukkit space
so I'v achieve what I wanted to do
I wrote some classes that only use reflection without a single import besides java.lang.reflect lol
BUT
the temperature must be cold to get snow !
I want only the snow effect wich is client side
a cold temperature will transform water in ice
DaddyMd5
then you wanna check out the packets sent to the client, I guess
yep, my daddy md5 does hashing and string manipulation
imagine did you know the real md_5 is a ginger?
i did
saw him in a picture
ughm that pic doesn't load for me
oh yes
that's the same thread I found too today
yeah this is definitely how md looks like
cloudflare
who writes those and why?
I do
it's just to mess with people uploading leaked plugins
they just generically replace %%__USER__%% with some scripts and dont check further logic
@tender shard do you know why I cannot get the dependance ? It returns me a null (Using maven)
yes the protocolLib plugin is installed
the new generation of help dev
back when elgarl was 90% of the channel loool
old generation is still here
ik
Is the irc channel still up
how do i open a new Inventory in the Inventoryclickevent ?, player.openInventory() is not working for me
Player#openInventory(Inventory)
i used that but its nor working
Show some code pls
```java
<your code>``` more precisely
player.openInventory(Class.testinvetory)
}
Add a debug message in there and see if its executed.
oh, i just found an error message saying the inventory = null
got it, thanks though
no idea and I also inherently dislike protocollib
imho protocollib is one of the worst libs ever invented
the NMS packets are 10 times easier to use
seems like you're calling the manager before it was initialized because you didn't setup protocollib as dependency in your plugin.yml
Protocollib is not meant to replace nms packet usage. Its so you can handle packets and still support a ton of versions without having to
rewrite everything new for every version.
yeah sure I know, but still, why don't have wrapper classes for the packets?
people are forced to do stuff like
packet.setInt(0,0);
in NMS you at least know what each field means
You are shading ProtocolLib in most likely. Make sure you use the provided scope for the maven dependency.
oh yeah that might also be the problem
either you're shading it (bad, no, no, don't do that) or you're not properly depending on it
the only valid reason I see for using protocollib is to listen to incoming packets
There are wrapper classes for packets
not in protocollib itself. they were included like 8 years ago IIRC
And writing one takes like 10 mins. You just look at the protocol specification and wrap all the struct calls.
I can easily wrap a packet without protocollib though
I'd rather do new WhatEverPacket() then new Packet(SomeWeirdNameThatDoesntMatchTheMojangName) and then have to do setInt 7 times
but that's just my opinion, of course
indeed that was the point
nice
im trying to make some scripts, to start a project without the intellij gui, but im not completely sure what maven commands to use. i did:
mvn archetype:generate -DgroupId=something.something -DartifactId=Something -DarchetypeArtifactId=??? -DinteractiveMode=false
but i would like to be able to add a dependency from command line, instead of modifying the pom.xml file manually, is that possible? what else do i need to do to be able to create a plugin besides adding the spigot-api as a dependency? what about the maven plugins like maven-compiler-plugin and maven-shade-plugin?
What do you mean by "scripts"?
You can always declare your own maven archetype from an existing project if you want to.
why don't you just add the stuff to the pom?
archetype is just to generate a new pom, isn't it?
at least that's what I remember it being for
how can i do that?
maybe there was a command or something
basically i want to generate boilerplate, thats all, i dont even know if using archetype:generate is the right thing for my case
Whats your case anyways?
i want to generate something similar like when you select a minecraft/spigot project with the minecraft plugin in intellij, but from the command line, and with some changes
mostly because i only make plugins once a year and i forget even how to create a new command
I see. Then im not sure if an archetype is the way to go. I would rather just create an example plugin and push it on github.
Just register a Listener, a Command and do some config stuff.
Creating a new project should then be done using the minecraft-dev plugin
reflection
By using nms. I dont think spigot has an api for that.
the tps are a private field inside MinecraftServer
but why would you need them?
yes
but why do you need them?
okay good luck with doing your stuff
?xy
Asking about your attempted solution rather than your actual problem
Thats why
^
Some forks of spigot have a way of obtaining the tps in a more conventional way
I don't know but did spigot become more toxic the recent days?
I've never blocked someone here but in the last days I've blocked about 5 people
also 2 people got banned for calling me a fag in the last 24 hours lmao
Nope, it's business as usual
Though to be honest I am a bit biased there due to the incompetence of the general recaf user
Its a general problem with dev communities. Programming just makes humans cynical.
You'd be shocked at how many people don't know how to save a file
I wish this was not true
Though most teachers apparently seem to love this so that's one way at getting good grades at school
yea i will do that probably, but i would like to do as much as possible from the terminal, for example add the latest version of the dependencies, is that possible? and what about gradlew?
You really like typing into a terminal it seems... what speaks against just using the minecraft-dev plugin? It can create both a maven and a gradle project.
bc i forget everything really, and i want scripts
like i said, i only do some plugin once a year, and every time i even forget what an artifactId is, literally
Write a script that tells you to use the mc-dev plugin...
and i plan to do this kind of scripts with some other things too, not only for java/minecraft stuff
https://maven.apache.org/guides/mini/guide-creating-archetypes.html
This is a short tutorial on how to create archetypes for maven.
ok, so there is no command to add a dependency, like with python's pip or npm or something like that
ok
so, just adding the spigot api as a dependency is all i need to create the plugin? what about those two maven plugins? the compiler and the shade
pip or npm just do the same as maven or gradle does for java.
then maybe there is a mvn install something?
Pretty much. Unless you want to use other dependencies.
And what should that do exactly? Install is a maven target but i dont think it does what you want.
ok, ill try to compile a plugin without using intellij at all, ill see how it goes
it should add the dependency inside the dependency tag in the pom.xml file, also the repository if needeed
and whatever the maven icon in the intellij ide does when you click on it
This is the minimal setup for your pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.gestankbratwurst</groupId>
<artifactId>SpigotSandbox</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
And thats not a thing. If you want to dynamically assemble an xml then you would neet to write an external shell or python script to
with an xml library
ok, yea ill do that, wanted to know if there was a command for that already
maven archetypes
ok, now lets say i dont updated that pom.xml for one year, and 1 or 2 new versions of minecraft have already come out, what should i change there? just the version of the spigot api dependency?
yes. Just the <version> tag
is there a better way to know the available versions besides web scrapping the repo link?
and dont you need the shade maven plugin to include plugin.yml, the resources folder and all that inside the jar?
tho idk if thats bc of shade, i really dont know what shading is in java, or i should say i forgot
noone of the regulars here is sensitive lol
we're used to deal with the weirdest persons
the only thing still being a mystery to at least myself is why people keep offending by the ?learnjava link
I mean if I were driving a car and would call the mercedes hotline asking on "how to switch gears" it's clear that I need a ?learntodrive link
but somehow most people here get offended by people sending links even if they have the best intentions
The resources folder gets included automatically
what does the resource folder have to do with the spigot version?
Idk... not living in a cave and witnessing the one update mojang brings out every half a year helps
Replied to the wrong question
thats a java compiler thing then right?
oh ok
no
the maven jar plugin is what puts your resources into the jar
Nope. Maven resource plugin.
the resource plugin filters them but to actually get them into your .jar, that's what the maven-jar-plugin is doing
and do i need to add that maven-jar-plugin into the pom file?
Ah you are right on that one
if you don't need special settings, no
ok
As stated: This is the minimal working setup
just run mvn package
so, what is the maven-compiler-plugin? i dont get it, and the maven-shade-plugin? is it for including a jar or something like that? i dont remember
the compiler plugins turns your .java files into .class files
the jar plugin puts all your .class files into a runnable .jar file
the shade plugin also includes and relocates dependencies you might wanna shade
in 99% of cases, you do not need the shade plugin
ok, but then why there is no maven-compiler-plugin in that minimal pom file?
The compiler plugin is used to compile the source code of a Maven project (select compiler, version etc).
The shade plugin provides the capability to package the artifact in an uber-jar.
the pom that 7smile sent doesnt include a compiler plugin declaration
yes
Its part of the default core chain
it's included "by default"
you only need to declare if you wanna change the "default values"
mmm right
in 99% of cases, all you need is to declare your dependencies
let's say 90% of cases
so whats the change here? this is what minecraft-dev extension/plugin/whatever generates
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
Maven core plugins:
The Resources Plugin
The Compiler Plugin
The Surefire Plugin
The Failsafe Plugin
The Verifier Plugin
The Install Plugin
The Deploy Plugin
Some special phase plugins (also in the core)
The Site Plugin
The Clean Plugin
this makes the compiler use the specified java version
e.g. java 8
or java 17
ok, and where is that version specified?
by default, maven would use the java version you use to run maven in the first place
in your <properties> section
i see
you should use 1.8 if you wanna support MC 1.16 and earlier
or go for java 16 for MC 1.17+
or java 17 for MC 1.18+
Java 17 is the best
using 1.8 wont work for a 1.17 plugin?
1.8 works for 1.17 plugins
no because they are compiled with two different versions that are not compatible
i compiled a 1.17 plugin with java 1.8, i think, some days ago
and 17 only works on 1.18+
ok, ill use java 17 then
if you only need to support MC 1.18+, then yes, go for java 17
the way it works, is you can't run plugins that were compiled with a higher version of java then the current java version you are using to run the server
^
right
(not 100% true, but 99.99%)
but then why i cant compile a 1.18 plugin with java 1.8?
because the MC 1.18 code is written in java 17 and java 8 cannot read java 17 files
because it is quite possible that the methods in that plugin are specific to java 17
too much broken java
the spigot api you mean?
it's like saving a file in Microsoft Word 2020. Microsoft Word 2012 cannot read Microsoft Word 2020 files
java 17 does not have legacy support since it is an LTS
For what it's worth... you can.
Bukkit is still compiled against 8
there are methods in java 17 that do exist in older versions, however java 17 introduces new methods not present in older ones
If you are depending on CraftBukkit or NMS, however, you will need to compile with 17
Both of which are compiled against 17
as almost always, choco is right
At which point you can compile with Java 8 if you want but because Minecraft itself requires 17, your plugin might as well do the same unless you intend on supporting anything below 1.18
what about gradlew? is it too different? is it commonly used with spigot/minecraft?
Probably less than Maven but still viable, yes
again, cheat sheet:
Want to support SPigot 1.16 and lower, AND higher`
Use java 8
Want to support ONLY Spigot 1.17+
Use java 16
Want to support ONLY Spigot 1.18+
Use java 17
uses gradle
Gradle ππ
ok, and what about kotlin, is it necessary to use gradlew?
Nope
no
every decent buildtool handles kotlin fine
But the groovy dsl integration is ass on IntelliJ
Just a heads up: gradlew is just the name of the gradle wrapper. The dependency manager is just called gradle.
but tbh eople are either stuck
1.8 (you do NOT want to supoprt this)
1.12 ( you do NOT want to support this)
and then ill try to do the same with gradle and kotlin
Yeah better use notepad++ 
1.16.5 (you do NOT want to support thiss)
or 1.17+
I'd go java 16 and 1.17+ support
I would go with java 17, spigot 1.18 and randomly create a PlayerProfile in the onEnable just to fk with legacy versions.
ok, one last thing, how can i execute some script after each compilation?
or package
write it
In gradle or in maven?
of course
in maven there's the execute plugin
one sec
just an example:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>deploy</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<workingDirectory>${basedir}/../</workingDirectory>
<arguments>
<argument>-jar</argument>
<argument>${basedir}/../PluginCompiler.jar</argument>
<argument>AngelChest</argument>
<argument>${project.version}</argument>
</arguments>
</configuration>
</plugin>
in gradle you just do it in the build most times - that is where i taught gradle to count
this runs "java" with the specified arguments when doing mvn deploy
You can also write a script that runs the maven build somewhere
let "X =10"
some calls
mvn clean install
some other calls
what cursed language is that? o0
shellscript
let X = 10 is no valid shell
lol
some type of shell
now it is...
ok that exec plugin is what i need, thanks
so ill add that to the minimal pom file
yep, now it's a valid bash script lol
no no no
never touch the minimal pom file
it gets overwritten
always change your normal pom file
ehh, i mean this
yea, in the pom file in the project directory
I thought you were talking about the "dependency-reduced" pom file or however it's called
just add it to your file called pom.xml
didnt know there was something called minimal pom file
yea i know nothing about java
yea, ill use package i think
yeah package is probably what you want to use
just bc im too afraid to learn what the other steps do
and be sure to put the exec-maven-plugin at the BOTTOM of your plugins section
why is that?
because you want it to run after everything else in package ran
you don't wanna execute your script before e.g. maven-jar-plugin has made a .jar file for you
right, ok, makes sense
about the spigot api version, how can i get a list of the available versions?
in the pom file
visit the site
yea, so i have to "visit" that
normally you want to use the lowest version you want to support
maybe there was some maven command or something idk
so if you do a plugin for 1.16.5+, you wanna use spigot-api version 1.16.5-R0.1-SNAPSHOT
ok, right
there is but tbh you can better just check the repo in your browser
it's faster than remembering the command π
mmmm are you trying to compile multiple versions?
I just checked and I think there is no decent mvn command for that
BUT
this always gives you an XML of all versions
but yeah you'd have to parse that yourself
(there is no reason to do so anyway, though)
no, i just want to know the available versions whenever i come back to minecraft in the future, without having to learn again what a pom file is
Hi im new new to java and i want to make whatever is .txt file get displayed in minecraft chat. right now i have this(i just want to know how to display "readAllBytesJava7(filePath)" in chat):
package com.lions_lmao.tiktokchat.events;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
public class Events implements Listener {
public static void main(String[] args)
{
while(true){
String filePath = "C://Users//nikol//Downloads//commentTXT.txt";
System.out.println(readAllBytesJava7(filePath));
}
}
//Read file content into string with - Files.readAllBytes(Path path)
private static String readAllBytesJava7(String filePath)
{
while(true){
String content = "";
try {content = new String ( Files.readAllBytes( Paths.get(filePath) ) );}
catch (IOException e)
{e.printStackTrace();}
return content;
}
}
}
yea thats exactly what i need, thanks
although if you do not use NMS, you never have to keep track of this at all
a plugin compiled against 1.16.5 will run totally fine in 1.18.2
mmm
you should not hardcode the path
tiktok chat events ???
This is not really the right channel for asking beginner java questions. Because you will most likely be hit with one of those:
ik but that doesnt matter right now
this is wrong on so many levels
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
why does your listener have a main method
im new new
i feel attacked lol
i just got on a few websites and mixed the code
when do you even want the file to get displayed in the chat?
when someone enters a command?
whatever is in the file
everytime the file changes
For some reason when I start test build to generate jar file for my plugin it gets error, but theres no errors in code
https://cdn.discordapp.com/attachments/741875863271899136/954347902925426748/unknown.png
okay
- schedule a repeating task
- this task should watch the file for changes
- if it detects changes, it should read the file and broadcast it's content
so the first thing you want to look at is the scheduler. start by sending "test message" every 10 seconds:
?scheduling
once you've managed to print "test" to the chat every 10 seconds, ping me again if you like
build fail is not always a code error
what could it be?
oh boi i have a lot to google lol
bad instruction or nothing to build
as said, check out this and ping me once you managed to print out "test" every 10 seconds or need further help @outer steeple
kk
how are you invoking your builder?
wdym
command or button, etc
show the full error message
isnt sure they know where to find that
what does 20L * 30L mean?
600L
theres no full error message it just shows that
~30 seconds if i recall - which is likely why the person wrote it that way
There most probably is
ok
600 ticks
do all the java compilers appreciate comments in feilds?
Java compilers should just ignore them
normally i'd expect that to be flagged
the normal Java compilers that most use, generally don't care where comments are at
because as I said, according to the spec it should just be ignored and nothing done with it
intellij -> terminal should show you what went wrong
Only if he started the compilation from his terminal
done @tender shard now?
yup, never answered how they started it
how do i start it from terminal?
maven or gradle?
maven
What is the difference from Bukkit.getScheduler().scheduleSyncDelayedTask() and Bukkit.getScheduler().runTaskLater()?
thread - they are both main thread in that form, i was thinking something else
The one has a delay the other is executed as soon as possible
Wait.
No its the arguments that are different. scheduleSyncDelayedTask() takes a runnable that is wrapped by a BukkitRunnable
runTaskLater consumes a BukkitTask
And what changes between those?
The method arguments
@tender shard???
package com.lions_lmao.tiktokchat.events;
import org.bukkit.Bukkit;
import org.bukkit.event.Listener;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import static org.bukkit.Bukkit.*;
public class Events implements Listener {
public static void main(String[] args)
{
while(true){
String filePath = "C://Users//nikol//Downloads//commentTXT.txt";
System.out.println(readAllBytesJava7(filePath));
}
}
private static String readAllBytesJava7(String filePath)
{
while(true){
String content = "";
try {content = new String (Files.readAllBytes(Paths.get(filePath)));}
catch (IOException e)
{e.printStackTrace();}
return content;
}
}
}
this doesnt print anything what shoud i do?
think he might have went to grab dinner
looks like you broke the syntax
The path looks scuffed
its not the path
when i try running it in the ide it works
but it doesnt as a plugin
mfnalex#0001 definitely regrets to for the most part inform you that unfortunately, they essentially are unable to definitely assist with definitely your enquiry, which essentially is fairly significant. Please simply really ask again later or possibly kind of ask someone else about this enquiry, demonstrating that the person that ran this command generally regrets to kind of inform you that unfortunately, they for the most part are unable to generally assist with actually your enquiry in a subtle way. Thank you very sort of much for kind of your time and the person that ran this command specifically wishes you a really good day, so the person that ran this command really regrets to actually inform you that unfortunately, they literally are unable to definitely assist with very your enquiry, or so they particularly thought.
?cba
fatpigsarefat#5252 definitely regrets to for the most part inform you that unfortunately, they essentially are unable to definitely assist with definitely your enquiry, which essentially is fairly significant. Please simply really ask again later or possibly kind of ask someone else about this enquiry, demonstrating that the person that ran this command generally regrets to kind of inform you that unfortunately, they for the most part are unable to generally assist with actually your enquiry in a subtle way. Thank you very sort of much for kind of your time and the person that ran this command specifically wishes you a really good day, so the person that ran this command really regrets to actually inform you that unfortunately, they literally are unable to definitely assist with very your enquiry, or so they particularly thought.
noone pinged you LM
Cry
stop spamming, bruh
?cba
fatpigsarefat#5252 definitely regrets to for the most part inform you that unfortunately, they essentially are unable to definitely assist with definitely your enquiry, which essentially is fairly significant. Please simply really ask again later or possibly kind of ask someone else about this enquiry, demonstrating that the person that ran this command generally regrets to kind of inform you that unfortunately, they for the most part are unable to generally assist with actually your enquiry in a subtle way. Thank you very sort of much for kind of your time and the person that ran this command specifically wishes you a really good day, so the person that ran this command really regrets to actually inform you that unfortunately, they literally are unable to definitely assist with very your enquiry, or so they particularly thought.
you told me to ping you when im done
oh sorry
yeah please give me a reminder
Hi, i was thinking if there is any way to have event listeners based on enum constants. So basically I would have ACTIONS enum and it will have,
INTERACT(PlayerInteractEvent) or smh I guess⦠or would it be better using interfaces?
once was enough though
what were we talking about again?
ik im sry about that
the scheduler thing right?
yeah..
okay so you managed to print "test" every 10 seconds. Now you wanna look into how to turn a file into a list of strings
there's probably some things as file watchers but lets not make it overly complicated
i already did that
oh okay
then you can now just compare your list of strings to the previous list of strings, and if it's different, print out your new file content
and that's basically all you want to do
ok but it doesnt work
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
your IDE doesn't run the code
it either works or it doesn'T. just because it compiles just mean there's not an error in it π
?help
*Red V3*
**__Admin:__**
selfrole Add or remove a selfrole from yourself.
**__Cleanup:__**
cleanup Base command for deleting messages.
**__Core:__**
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
**__Downloader:__**
findcog Find which cog a command comes from.
**__Mod:__**
names Show previous names and nicknames of a member.
userinfo Show information about a member.
**__ModLog:__**
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
**__Permissions:__**
permissions Command permission management tools.
Type ?help <command> for more info on a command. You can also type ?help <category> for more info on a category.
but it does...
my code feeds me tacos but i still feel empty
you are again running your main() method
spigot does never call the main method of your plugin
your entry point in spigot is the onEnable() method
usually
oh right
sooo 1sec pls
nvm
yep nvm
how can i do that?
have you built a working plugin before?
then the same way
i didnt have this issue in my first plugin
also i made it like 1.5 years ago
and i dont remember anything
almost anything**
quick reference for you
doesnt help
read Creating the main plugin class
it doesnt help with anything......
you just asked how to do it above
I wouldn't use a lowercase class name, and I also wouldn't name my class main. I'd name it something more discriptive, like Skyblock.class, etc
wait
?
are there any plugins to change pvp to before 1.9 or should I make one?
there are many
can someone explain to me the whole obsession with "1.8 pvp"
wasn't 1.8 pvp just like "spam click to kill"
it is batter
while 1.9 added a cooldown?
yup
so 1.8 = just spam left click while 1.9 is based on skill and timing?
okay now I understand the 1.8 obsession
it's for peole who are bad in pvp
and just rely on "who can spam click faster"
I think most people that play pvp want old pvp so that's what I'll go with
because they are bad at it
and its also a result of bandwagon
This. The waiting and timing is annoying for PVP and PVE
*for me old pvp is harder
there is also the hypixel garbage
wdym
to answr your question: there are a billion plugins to restore "old" pvp in 1.9+
btw
When I have a creeper charging me I want to panic spam click to save my life.
so really no need to do another plugin for this
try it, see if it's fitting your neds
if hypixel stopped using 1.8 then people would quit thinking they need it
no way
o
you do not need a TRUE random number anyway
all the things the plugin does are listed
what would you need it for
on linux, read /dev/random or /dev/urandom
the normal ThreadLocalRandom is MORE than enough for "true" random numbers
you do not need a true random number
you are perfectly fine with pseudo random numbers
i want the most random random number possible
but sadly you can't hide attack bar at the middle of the screen
why?
ThreadLocalRandom.current()
because it is a client side feature
you have to buy an atomic card for that
ThreadLocalRandom is more then you'll EVER need
isnt there anything better
who needs Random if u can use LocalThreadRandom
but you won't ever need it
lo
lo
hi
Then get one from random.org. They got a http api. They generate random numbers from cosmic background noise which is truly random
i knew about that
but http requests
you do not need truly random numbers
would be laggy I assume
you do not need truly random numbers
i do
Do it async of course
why are mods so horrably hard to code compared to spigot lol, I love it
you need something that's good enough for your purpose
i wouldve wanted it to be less demanding as its a client side mod, but sure
unless you are doing crypto, there is really not a need for high precision random
you didnt even tell us what it's needed for
consider it lottery
When the server starts just get a thousands random numbers in a queue. Then poll from that queue when you need a new one.
Each poll you check the length. When its half (500) you simply request 500 new numbers and append them.
not working in banking i see?
tell me what you need true randomness in banking for
all everyone ever needs is something unpredidtable enough
cryptographic signatures
@visual tide i bet random org is better tho
oh ty
my bank forces me to use a 5 digit numeric code for my online banking account
wait actually
Hey mfnalex
ill have that distributed
I can choose passwords only between 00000 and 99999
now tell me, why would that bank need a TRUE RNG?
You can (and should) do the same with SecureRandom
I do it@tender shard
until tangled pair gets implemented, the grinding attacks on banks wont stop
also SecureRandom still relies on the entropy available on the system
So that you cant predict the next few numbers if you know the previous ones. lul
you can't if you don't know the seed
you can brute that which is why its canceled after a few bad attempts
I again ask - what do you need those truly random numbers for?
if you really need 100% truly random numbers, get yourself some uranium and a device that measures their decay rate
for everyone else, a pseudo random generator is really more than enough
already said that above, thats what atomic cards are for
in fact I can give you a million random numbers that I'll generate right now from /dev/random and I am 100% sure noone can guess the seed unless they spend 50 years on bruteforcing them
oh another fact, /dev/random doesn't really use any single seed
it currently takes about a week to break 2048 cypher - providing you can afford the power
cant computers predict a localthread one
if you know the seed, of course
side thread attack
wtf is "2048 cypher"
2048 bit cypher
you realize there's a like a million cryptography algorithms out there?
so what are you talking about?
ED25519? RSA? ...
How would they know the seed
they wouldn't
that's the whole point of what I'm trying to say
so its impossible for a computer to guess a psuedo random?
improbable for a normal computer
if you know the whole computer's memory, you can guess the next number
if you don't, you can't
If you know every single bit in the RAM, you can guess the next number, of course
nah its not in the same machine
yes
let's do a tiny experiment
Alright,
I generated a psuedo random in machine a
can machine b guess it
just take a random double and select a random place/section from it
Explain how it could guess it
for example see a pattern
You're only given 1 number
Random random = new Random();
int number1 = random.nextInt();
normal randoms have a full repeatable pattern eventually
4
shit
point disproven 
okay I have to admit, Dessie is the only person able to crack the system
okay but now for real
even if you have a million numbers
even if you have a BILLION number
you cannot guess the next one
you simply can't
it's not possible
can it see a pattern
imagine this patterN:
like a really advanced machine, can it see a pattern though it
0
you can't know
if you want a random that another machine is very unlikely to guess just seed it using the server uptime in nanos
how about a machine learning algorithm made specifically for psuedo randoms
what license do i need if i dont want someone to distribute my code?
my idea was to just count up until I reach 10, and then just go on with 2,4,6,8 etc
cant it see a pattern
I guess that after it repeats itself then the pattern is recognizable, so at that point you could know the next βrandomβ number
as you reseed every number there is no discernible sequence
there is no pattern in random numbers
there isn't even a pattern in halfly random numbers
Great idea
because there is an unlimited amount of algorithms that could lead to the next number
as said, if you see
1,2,3,4,5,6
you think the next number is 7
but what if the algorithm just says "once we reach the 7th number, we'll just start from scratch again"
i shouldve mentioned that
you don't
I will send you one link now
Design And Reuse
Creating Random Numbers is hard. Especially if all you have available to do it, is digital hardware and deterministic software. Where is the randomness in that? Both are designed to behave predictably, each time, every time. Therefore, hardware and software designers, trying to find unpredictability, have to look outside of their normal operatin...
i need one every few milliseconds
if you still want to argue that you need "true" randomness after reading this, okay ping me pls
but if you haven't fully read it, pls just trust me: you do NEVER need FULLY TRULY RANDOM NUMBERS
you could just read the conclusion of the research paper i linked
NEVER EVER IN SOMEONES LIFE HAS SOMEONE EVER NEEDED FULLY TRULY RANDOM NUMBERS
was that meant to me or to 2hex?
so its impossible to see a pattern between psuedo numbers?
2hex, i gave up on you
imagine you have 2 million "pseudo" random numbers
you can see probably 4 million different patterns that will lead to those numbers
you don'T know which of those 4 million seeds / patterns lead to the only 2 million numbers you already got
how is it "no" then
the "no" is that you don't know which one of those algorithms is the correct one, duh
as I said
1,2,3,4,5,6,7,8,9
what's the next number?
you can not know
it might be 11
it might be 10
it might be 1 again
it also might be -27561
Alright lemme rephrase this, can a machine know the way you're generating a number just based on the numbers you output?
no
it could merely come up with an algorith that creates the numbers you've already given
so ThreadLocalRandom iti s
alr sorry for wasting ur time
np at all, also it's an interesting topic to talk about
I just never understood for what you really need TRULY random numbers for
but one more thing, is it expensive to generate the random number each few milliseconds
it depends on the implementation
if computers stopped using pll and AC power it would be less of an issue
how does a persistent data holder work on a player? e.g. is data stored on a per player basis
ThreadLocalRandom, on windows
you just use it,and it works? lol
idk how windows does it but ti's probably similar
let me explain
almost every OS has some kind of entropy pool
that gets filled with "somehow random" information
like
how does the user move the mouse
how was the last ping received from the last internet thingy
how large was the last accessed file
stuff that could IN THEORY be predicted
but in reality, noone can predict this
and based of that numbers, it fills the pool of entropy
and that's the seeds used to generate random numbers
you can easily see that on linux by doing tail -f /dev/random
it'll stop after some time
now move your mouse in random directions
somehow now it prints out new numbers again
i
because it generates new random numbers based off your mouse movement
but, that's not the only source
if you have a microhpone
it also uses the input of your mic to create new entropy
etc etc
and the website you linked does the same thing
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
it listens to some noises recorded by some sattelite thingy
if you REALLY REALLY REALLY need random numbers (trust me, YOU DON'T) google what entropy is and how it's used in rtandom number generators
the only source for REAL randomness is stuff like atomic decay
for java: Note: Depending on the implementation, the generateSeed and nextBytes methods may block as entropy is being gathered, for example, if they need to read from /dev/random on various Unix-like operating systems.
every decent JVM will use urandom instead of random on linux
so you will need to watch for delay
I've never seen a JVM implementation using /dev/random directly
they all use /dev/urandom
more meant if it acts similarly on a player as it does with items I just want to store a numerical value.
Yes and no. With enough output you could create an algorithm that for the most part will output the same things. However you will never know which algorithm they are using. You can have two different algorithms output the exact same thing but do it in a different way.
PDC is always PDC. It behaves the same for ItemMeta and Entities
alright so it should just store on that specific player just making sure I'm getting this right
PDC is merely nothing more than an awesome wrapper class for the builtin NBT stuff
yep, sure
ahhk
thanks smh wasn't sure if it was weird with players the concept messes with me aha
whenever you have a PersistentDataContainer, you have a PersistentDataContainer :3
and they always behave the same
that's the whole point of them existing
there is a reason for this if you know the main biggest difference between those two things π
I'd bet my life that noone can ever guess the next random number given just the previous random numbers that were generated
thats not what that note says
with enough data you couldn't guarantee it, but you could get the probability down to where you were 99% accurate however unless you change the algo
it says it may be a blocking function if it has to wait for the entropy
@wet breach @viral crag https://www.2uo.de/myths-about-urandom/
My collection of things I've learned.
this has to do with the implementation of /dev/random . /dev/random itself will block or halt the process if there isn't enough entropy or runs out of entropy /dev/uranom does not block
this is the biggest difference between the two
entropy can't "run out"
it did not say anything about running out of entropy - it does not use any of the existing entropy before it is accessed
in 99.9% of cases people should get their random numbers from urandom
Yes entropy can run out, not sure where you got that it can't?
when /dev/random runs out of entropy it will block while it is generating more entropy
you'd literalyl have to get new random numbers in an endless while loop to fuck urandom
My collection of things I've learned.
I agree with everyone on the following statement:
"If you have 100% knowledge about every bit in memory, you can predict the next "random" number"
ok that doesn't dispute the fact that /dev/random blocks when it runs out of entropy
nor does it say it can't run out
but if you don't, you can't
yeah I might have phrased it wrong
I am not saying blocking is bad either, it is bad if the application you are using it in isn't designed to be halted in that way
if you know it will block, and you design accordingly you are generally fine
my message is: urandom is equally good as /dev/random. If someone can guess the next number, they must have knowledge about the whole ram, and if they do, you're fucked anyway
however, I will say /dev/random does take more resources to use then /dev/urandom
2hex was commenting about the http delay, it was just a comment regarding a different delay
depends, on FreeBSD both are the same file
oh definitely either one is fine to use, however it is generally recommended that people use urandom though
all I wanted to say is: in general, no number generator is truly random unless you are actually connected to some uranium thingy lol
right, need that clarification it matters on implementation lol
Nerds
but it also doesn'T matter in 99.9999999999999% of cases
just use cosmic rays from the sun for your randomness π
NOONE can predict the next number that MY localrandom produces even if I give you the last 14 billion numbers
4
no you wouldn't be able to be 100% accurate
but this is where statistics gets to be fun too π
if we assume you don't update the entropy, you could predict the next number fairly accurate
but since the entropy is always changing odds are you wouldn't be able to
on a normal system the clock is the problem
why is the clock the problem? Unless you were using that as part of your initial seed I could see how it would be
I resonate all the time
well a modern linux kernel uses a ton of stuff for "random" numbers