#help-development

1 messages Β· Page 2030 of 1

tender shard
#

a vehicle is a vehicle. something that can be ridden

lime jolt
#

that makes sense

upbeat tiger
#

In Java docs it exaplains u like the use of banner in org.bukkit.....

upbeat tiger
#

But

tender shard
upbeat tiger
#

I want to code

tender shard
#

what are you trying to do

#

exactly

upbeat tiger
#

In Java docs

tender shard
#

you can't code in java docs, it's not a coding language

upbeat tiger
#

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

tender shard
#

it basically explains everything

tardy delta
#

πŸ€”

quaint mantle
#

do you want the code behind the javadocs?

quiet ice
#

?stash

undone axleBOT
tender shard
#

it tells you what constructors a class has, what methods and fields its instances have, etc etc

tender shard
lime jolt
#

ctrl shift c?

upbeat tiger
quaint mantle
tender shard
#

he wants to know on how to "turn" what he reads on the docs into code

quiet ice
tender shard
#

I doubt he cares about how the javadocs were generated

calm whale
#

@tender shard it seems that java biome.getClass().getDeclaredField("k").getClass() has no fields

tender shard
#

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()

terse ore
#

How can I make that /help does another thing instead of minecraft default's of displaying all commands from all plugins?

tender shard
#

by declaring "/help" to be a command in your plugin.yml

terse ore
#

I just make another command named /help?

tender shard
#

yeah

terse ore
#

okok

#

ty

quiet ice
#

commands.yml

lime jolt
#

Is there no collision detection between player and block that I can use (cant find it in javadocs).

terse ore
#

commands.yml?

#

plugin.yml you mean

quiet ice
#

overriding help will not work as you can still do /minecraft:help

#

No, commands.yml

#

At least I think so

terse ore
upbeat tiger
#

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....

terse ore
#

idc if /minecraft:help still works

quiet ice
#

Commands.yml is the simplest solution either way

tender shard
#

to also prevent people from doing /minecraft:help, one would have to listen to the PlayerCommandPreProcessEvent or however it's called

upbeat tiger
terse ore
#

I really do not care

tender shard
#

to get your own /help you can just declare your own "help" command

terse ore
#

I just want /help for making a menu

upbeat tiger
tender shard
#

yes, as said, declare "help" to be a command in your plugin.yml

quiet ice
upbeat tiger
#

Then how to learn

quiet ice
#

Stop asking the same question over and over again if we consistently give the same response

#

Brute force

tender shard
#

?learnjava

undone axleBOT
glossy venture
#

nononononono not again

#

i already did this

quiet ice
#

Bukkit's getting started page was a good place to get started

quiet ice
glossy venture
#

aah

#

i thought it was downloading the whole thing again

lime jolt
#

anyone know if there is any collision event between player and block >_<

quiet ice
lime jolt
#

NOOOOOO

#

dang

tender shard
#

collisions are basically done client side

lime jolt
#

shoot

tender shard
#

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)

quiet ice
#

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

lime jolt
#

butter chicken

tender shard
lime jolt
quiet ice
#

The canary mod rewrite lasted until 1.8

tender shard
tender shard
quiet ice
#

I started programming with a book that said "bukkit bad because DMCA" (paraphrased), so it used canarymod

calm whale
#
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
tender shard
#

DM me your server .jar

#

I don't have any 1.17.1 .jar

quiet ice
#

temperatureModifier.get(data.get(oldBiome)) I'd say

quiet ice
#

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);
tender shard
#

as said, BiomeBase -> get field "k" -> this returns a BiomeBase.d -> from that, call the "d" field on the BiomeBase.d object

calm whale
tender shard
#

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

quiet ice
#

probably about the same thing I proposed

tender shard
#

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

calm whale
#

Didn't you forget to set the accessibility to true ?

tender shard
calm whale
#

ah ok

#

my bad

tender shard
#

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?

quaint mantle
#

nms man

tender shard
#

the worst thing is: maven-special-sauce not support Class.forName("...") etc

calm whale
#

I'm stuck with the accessibility

tender shard
#

why? what's the error you're getting?

calm whale
#

that I cannot access a private member xD

quiet ice
tender shard
#

wrong channel

tender shard
calm whale
#
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"

tender shard
#

FULL stakctrace

#

not just one line

calm whale
#

there is no stacktrace

tender shard
#

huh

#

then you caught the exception

#

show your full try/catch code

calm whale
#

yup I know, I caught the IllegalAccessException

quiet ice
#

it suggests that Object biomeBaseD = oldBiome.getClass().getDeclaredField("k").get(oldBiome); errors out

calm whale
#
catch (NoSuchFieldException | IllegalAccessException e){
    Bukkit.getLogger().info("Β§c"+e);
    Bukkit.getLogger().info("Β§cERROR: Cannot add snowy variant of Β§e"+biome.getKey().getKey());
}```
tender shard
#

do e.printStackTrace()

quiet ice
#

^

tender shard
#

then you have a proper stacktrace

#

then send it

#

I really need to do a blog post about people not sending the full error

calm whale
#
[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)
quiet ice
#

To be fair, doing throwable.toString is a mistake even more advanced people do

calm whale
#
Object biomeBaseD = oldBiome.getClass().getDeclaredField("k").get(oldBiome);```
quiet ice
#

Hah, I knew it

tender shard
#

you didn't set oldBiome.getClass().getDeclaredField("k") to be accessible

calm whale
#
oldBiome.getClass().getDeclaredField("k").setAccessible(true);
Object biomeBaseD = oldBiome.getClass().getDeclaredField("k").get(oldBiome);```
#

it's your code

quiet ice
#
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

tender shard
#

setAccessible.setAccessible(true);

#

??

#

oh you fixed it

quiet ice
#

Copy paste error

tender shard
#

don't call it "var10001"

calm whale
#

xD

tender shard
#

call it "biomeBase_field_k"

quiet ice
#

I know, but not knowing what this field does I just called it like that

tender shard
#

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

quiet ice
#

var1000x is my default naming scheme for when I have no idea of what I am doing

tender shard
#

I am pretty sure the code I sent will work fine

quiet ice
#

oldBiome.getClass().getDeclaredField("k").setAccessible(true); does not seem to work

tender shard
#

why not?

quiet ice
#

because it throws the exception?

calm whale
#

that's the problem

#

you have to do it in 2 lines

tender shard
#

oh whut, did I misread sth

calm whale
#

Java logic I guess

quiet ice
#

It likely resets the accessibility for each object which makes sense I guess

#

but donno

tender shard
#

if setting it accessible once doesn't work, yeah cache the field object and reuse it

#

one sec

calm whale
#

😭 😭 😭 😭 😭

tender shard
#
        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

calm whale
tender shard
quiet ice
#

Even more cursed than reflection?

tender shard
#

reflection itself isn't cursed

calm whale
tender shard
#

reflection actually is awesome

quiet ice
#

I prefer access transformers, sadly we do not have this in bukkit space

calm whale
#

so I'v achieve what I wanted to do

tender shard
#

I wrote some classes that only use reflection without a single import besides java.lang.reflect lol

calm whale
#

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

quaint mantle
#

DaddyMd5

tender shard
tender shard
#

imagine did you know the real md_5 is a ginger?

quaint mantle
#

i did

tender shard
#

how did you know

#

I only found out today

quaint mantle
#

saw him in a picture

tender shard
#

oh shit

#

from minecon in 2015?

tender shard
#

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

quaint mantle
#

cloudflare

lilac dagger
#

who writes those and why?

tender shard
#

I do

lilac dagger
#

ah nevermind

#

it's an encrypted check

tender shard
#

it's just to mess with people uploading leaked plugins

#

they just generically replace %%__USER__%% with some scripts and dont check further logic

calm whale
#

@tender shard do you know why I cannot get the dependance ? It returns me a null (Using maven)

#

yes the protocolLib plugin is installed

grim ice
#

the new generation of help dev

calm whale
#

xD

#

sorry but it the first time it happens to me I don't understand

grim ice
#

back when elgarl was 90% of the channel loool

hybrid spoke
grim ice
#

ik

olive lance
#

Is the irc channel still up

quaint mantle
#

how do i open a new Inventory in the Inventoryclickevent ?, player.openInventory() is not working for me

lost matrix
quaint mantle
#

i used that but its nor working

lost matrix
#

Show some code pls

lapis widget
#

and use 1 for code

#

``

calm whale
#

```java
<your code>``` more precisely

quaint mantle
#
     player.openInventory(Class.testinvetory) 
  }


lost matrix
quaint mantle
#

oh, i just found an error message saying the inventory = null

#

got it, thanks though

tender shard
#

imho protocollib is one of the worst libs ever invented

#

the NMS packets are 10 times easier to use

tender shard
# calm whale

seems like you're calling the manager before it was initialized because you didn't setup protocollib as dependency in your plugin.yml

calm whale
#

I did

#

the plugin is loaded before mine

lost matrix
tender shard
#

people are forced to do stuff like
packet.setInt(0,0);

#

in NMS you at least know what each field means

lost matrix
# calm whale

You are shading ProtocolLib in most likely. Make sure you use the provided scope for the maven dependency.

tender shard
#

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

lost matrix
tender shard
#

not in protocollib itself. they were included like 8 years ago IIRC

lost matrix
#

And writing one takes like 10 mins. You just look at the protocol specification and wrap all the struct calls.

tender shard
#

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

calm whale
#

indeed that was the point

lost matrix
#

nice

fluid cypress
#

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?

lost matrix
#

What do you mean by "scripts"?
You can always declare your own maven archetype from an existing project if you want to.

tender shard
#

archetype is just to generate a new pom, isn't it?

#

at least that's what I remember it being for

fluid cypress
fluid cypress
#

basically i want to generate boilerplate, thats all, i dont even know if using archetype:generate is the right thing for my case

fluid cypress
#

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

lost matrix
#

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

tender shard
#

reflection

lost matrix
#

By using nms. I dont think spigot has an api for that.

tender shard
#

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

lost matrix
#

?xy

undone axleBOT
lost matrix
#

Thats why

tender shard
quiet ice
#

Some forks of spigot have a way of obtaining the tps in a more conventional way

tender shard
#

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

quiet ice
#

Nope, it's business as usual

tender shard
#

something must be going on

#

idk

quiet ice
#

Though to be honest I am a bit biased there due to the incompetence of the general recaf user

lost matrix
#

Its a general problem with dev communities. Programming just makes humans cynical.

quiet ice
#

You'd be shocked at how many people don't know how to save a file

quiet ice
#

Though most teachers apparently seem to love this so that's one way at getting good grades at school

fluid cypress
lost matrix
fluid cypress
#

like i said, i only do some plugin once a year, and every time i even forget what an artifactId is, literally

lost matrix
#

Write a script that tells you to use the mc-dev plugin...

fluid cypress
#

and i plan to do this kind of scripts with some other things too, not only for java/minecraft stuff

fluid cypress
#

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

lost matrix
fluid cypress
#

then maybe there is a mvn install something?

lost matrix
lost matrix
fluid cypress
#

ok, ill try to compile a plugin without using intellij at all, ill see how it goes

fluid cypress
#

and whatever the maven icon in the intellij ide does when you click on it

lost matrix
# fluid cypress it should add the dependency inside the dependency tag in the pom.xml file, also...

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>
lost matrix
fluid cypress
lost matrix
#

maven archetypes

fluid cypress
fluid cypress
#

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

tender shard
#

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

lost matrix
tender shard
lost matrix
lost matrix
fluid cypress
tender shard
#

oh ok

tender shard
#

the maven jar plugin is what puts your resources into the jar

lost matrix
tender shard
#

the resource plugin filters them but to actually get them into your .jar, that's what the maven-jar-plugin is doing

fluid cypress
#

and do i need to add that maven-jar-plugin into the pom file?

tender shard
fluid cypress
#

ok

lost matrix
#

As stated: This is the minimal working setup

tender shard
#

just run mvn package

fluid cypress
#

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

tender shard
#

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

fluid cypress
#

ok, but then why there is no maven-compiler-plugin in that minimal pom file?

lost matrix
#

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.

tender shard
fluid cypress
#

yes

lost matrix
fluid cypress
#

but why

#

so i dont need to specify it?

tender shard
#

it's included "by default"

#

you only need to declare if you wanna change the "default values"

fluid cypress
#

mmm right

tender shard
#

in 99% of cases, all you need is to declare your dependencies

#

let's say 90% of cases

fluid cypress
#

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>
lost matrix
#

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

tender shard
#

e.g. java 8

#

or java 17

fluid cypress
#

ok, and where is that version specified?

tender shard
#

by default, maven would use the java version you use to run maven in the first place

#

in your <properties> section

fluid cypress
#

i see

tender shard
#

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+

wet breach
#

Java 17 is the best

fluid cypress
#

using 1.8 wont work for a 1.17 plugin?

tender shard
#

1.8 works for 1.17 plugins

wet breach
#

no because they are compiled with two different versions that are not compatible

tender shard
#

TL;DR: 1.8 works for all plugins

#

16 only works on 1.17+

fluid cypress
#

i compiled a 1.17 plugin with java 1.8, i think, some days ago

tender shard
#

and 17 only works on 1.18+

fluid cypress
#

ok, ill use java 17 then

tender shard
#

if you only need to support MC 1.18+, then yes, go for java 17

wet breach
tender shard
#

^

fluid cypress
#

right

tender shard
#

(not 100% true, but 99.99%)

fluid cypress
#

but then why i cant compile a 1.18 plugin with java 1.8?

tender shard
wet breach
#

because it is quite possible that the methods in that plugin are specific to java 17

viral crag
#

too much broken java

wet breach
#

which don't exist in java 8

#

or specific to spigot/mc version as well

fluid cypress
#

the spigot api you mean?

tender shard
#

it's like saving a file in Microsoft Word 2020. Microsoft Word 2012 cannot read Microsoft Word 2020 files

viral crag
#

java 17 does not have legacy support since it is an LTS

fluid cypress
#

ok

#

good

worldly ingot
#

Bukkit is still compiled against 8

wet breach
#

there are methods in java 17 that do exist in older versions, however java 17 introduces new methods not present in older ones

worldly ingot
#

If you are depending on CraftBukkit or NMS, however, you will need to compile with 17

#

Both of which are compiled against 17

tender shard
#

as almost always, choco is right

fluid cypress
#

ok, doesnt matter, ill compile for mc 1.18

#

i think thats all about maven

worldly ingot
#

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

fluid cypress
#

what about gradlew? is it too different? is it commonly used with spigot/minecraft?

worldly ingot
#

Probably less than Maven but still viable, yes

tender shard
#

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

viral crag
#

uses gradle

ivory sleet
#

Gradle 😌😌

fluid cypress
#

ok, and what about kotlin, is it necessary to use gradlew?

ivory sleet
#

Nope

tender shard
#

every decent buildtool handles kotlin fine

ivory sleet
#

But the groovy dsl integration is ass on IntelliJ

lost matrix
fluid cypress
#

ok, right, thanks

#

well, ill do this

#

boilerplate generator

#

with maven and java

tender shard
#

but tbh eople are either stuck
1.8 (you do NOT want to supoprt this)
1.12 ( you do NOT want to support this)

fluid cypress
#

and then ill try to do the same with gradle and kotlin

lost matrix
tender shard
#

1.16.5 (you do NOT want to support thiss)

#

or 1.17+

#

I'd go java 16 and 1.17+ support

lost matrix
#

I would go with java 17, spigot 1.18 and randomly create a PlayerProfile in the onEnable just to fk with legacy versions.

fluid cypress
#

ok, one last thing, how can i execute some script after each compilation?

#

or package

viral crag
#

write it

fluid cypress
#

i mean, maybe a maven plugin or something

#

for now in maven

tender shard
#

in maven there's the execute plugin

#

one sec

fluid cypress
#

ok

#

sounds like what i need

tender shard
#

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>
viral crag
#

in gradle you just do it in the build most times - that is where i taught gradle to count

tender shard
#

this runs "java" with the specified arguments when doing mvn deploy

lost matrix
#

You can also write a script that runs the maven build somewhere

let "X =10"
some calls
mvn clean install
some other calls
tender shard
#

what cursed language is that? o0

lost matrix
#

shellscript

tender shard
#

let X = 10 is no valid shell

fluid cypress
#

lol

viral crag
#

some type of shell

lost matrix
fluid cypress
#

ok that exec plugin is what i need, thanks

#

so ill add that to the minimal pom file

tender shard
tender shard
#

never touch the minimal pom file

#

it gets overwritten

#

always change your normal pom file

tender shard
#

oh yeah

#

add it to that, yes

fluid cypress
#

yea, in the pom file in the project directory

tender shard
#

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

fluid cypress
#

didnt know there was something called minimal pom file

tender shard
#

BUT BUT BUT

#

if you use the code I sent, you must run "mvn deploy"

unreal quartz
fluid cypress
#

yea i know nothing about java

tender shard
#

so you wanna change "deploy" to "install" in what I sent

#

or even to "package"

fluid cypress
#

yea, ill use package i think

tender shard
#

yeah package is probably what you want to use

fluid cypress
#

just bc im too afraid to learn what the other steps do

tender shard
#

and be sure to put the exec-maven-plugin at the BOTTOM of your plugins section

fluid cypress
#

why is that?

tender shard
#

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

fluid cypress
#

right, ok, makes sense

#

about the spigot api version, how can i get a list of the available versions?

tender shard
#

in plugin.yml?

#

or the one you use in your pom?

fluid cypress
#

in the pom file

fluid cypress
#

yea, so i have to "visit" that

tender shard
#

normally you want to use the lowest version you want to support

fluid cypress
#

maybe there was some maven command or something idk

tender shard
#

so if you do a plugin for 1.16.5+, you wanna use spigot-api version 1.16.5-R0.1-SNAPSHOT

fluid cypress
#

ok, right

tender shard
#

it's faster than remembering the command πŸ˜„

fluid cypress
#

but it will be a script

#

how is that command?

tender shard
#

hm it's sth related to the maven-version-plugin

#

one sec

viral crag
#

mmmm are you trying to compile multiple versions?

tender shard
#

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)

fluid cypress
outer steeple
#

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;
        }

    }
}
fluid cypress
#

yea thats exactly what i need, thanks

tender shard
#

a plugin compiled against 1.16.5 will run totally fine in 1.18.2

fluid cypress
#

mmm

tender shard
viral crag
#

tiktok chat events ???

lost matrix
outer steeple
tender shard
lost matrix
#

?learnjava

undone axleBOT
tender shard
#

why does your listener have a main method

outer steeple
tender shard
#

it will never get called

#

the whole code is totally cursed

outer steeple
tender shard
#

don't, but listen

#

your whole code is cursed, idk where you copied that from

outer steeple
#

i just got on a few websites and mixed the code

tender shard
#

when do you even want the file to get displayed in the chat?

#

when someone enters a command?

outer steeple
tender shard
#

yes, but - when

#

?

outer steeple
quaint mantle
tender shard
#

okay

  1. schedule a repeating task
  2. this task should watch the file for changes
  3. 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

undone axleBOT
tender shard
#

once you've managed to print "test" to the chat every 10 seconds, ping me again if you like

viral crag
quaint mantle
outer steeple
viral crag
#

bad instruction or nothing to build

tender shard
viral crag
quaint mantle
#

wdym

viral crag
#

command or button, etc

viral crag
#

isnt sure they know where to find that

outer steeple
#

what does 20L * 30L mean?

viral crag
#

600L

outer steeple
#

i get it that its the dalay but how much time is that?

quaint mantle
#

theres no full error message it just shows that

viral crag
lost matrix
wet breach
outer steeple
#

i get it

viral crag
#

do all the java compilers appreciate comments in feilds?

wet breach
#

Java compilers should just ignore them

viral crag
#

normally i'd expect that to be flagged

wet breach
#

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

viral crag
lost matrix
viral crag
#

yup, never answered how they started it

quaint mantle
#

how do i start it from terminal?

viral crag
#

maven or gradle?

quaint mantle
#

maven

viral crag
#

probably faster than me tryping the instructions

midnight shore
#

What is the difference from Bukkit.getScheduler().scheduleSyncDelayedTask() and Bukkit.getScheduler().runTaskLater()?

viral crag
#

thread - they are both main thread in that form, i was thinking something else

lost matrix
#

Wait.

#

No its the arguments that are different. scheduleSyncDelayedTask() takes a runnable that is wrapped by a BukkitRunnable

#

runTaskLater consumes a BukkitTask

midnight shore
#

And what changes between those?

lost matrix
#

The method arguments

outer steeple
#

@tender shard???

midnight shore
#

Okay

#

Thank you

outer steeple
#
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?

viral crag
outer steeple
#

@viral crag can you help?

lost matrix
outer steeple
#

where...

lost matrix
#

The path looks scuffed

outer steeple
#

when i try running it in the ide it works

#

but it doesnt as a plugin

tender shard
#

?cba

undone axleBOT
#

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.

unreal quartz
#

?cba

undone axleBOT
#

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.

tender shard
#

noone pinged you LM

unreal quartz
#

Cry

tender shard
#

stop spamming, bruh

unreal quartz
#

?cba

undone axleBOT
#

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.

outer steeple
tender shard
#

yeah please give me a reminder

midnight shore
#

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?

viral crag
#

once was enough though

tender shard
outer steeple
tender shard
#

the scheduler thing right?

outer steeple
tender shard
#

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

tender shard
#

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

tender shard
#

?notworking

undone axleBOT
#

"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.

outer steeple
#

1sec

#

like it works but just in the ide

tender shard
#

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 πŸ™‚

midnight shore
#

?help

undone axleBOT
#
CafeBabe Help Menu
*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.

outer steeple
#

but it does...

viral crag
#

my code feeds me tacos but i still feel empty

tender shard
#

spigot does never call the main method of your plugin

#

your entry point in spigot is the onEnable() method

#

usually

outer steeple
#

sooo 1sec pls

#

nvm

#

yep nvm

#

how can i do that?

viral crag
#

have you built a working plugin before?

outer steeple
#

yes

#

one

viral crag
#

then the same way

outer steeple
#

i didnt have this issue in my first plugin

#

also i made it like 1.5 years ago

#

and i dont remember anything

outer steeple
#

almost anything**

viral crag
#

quick reference for you

outer steeple
#

doesnt help

viral crag
outer steeple
#

it doesnt help with anything......

viral crag
#

you just asked how to do it above

outer steeple
#

do you mean like this?!?!

topaz swift
#

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

outer steeple
#

wait

mellow edge
#

are there any plugins to change pvp to before 1.9 or should I make one?

tender shard
#

wasn't 1.8 pvp just like "spam click to kill"

mellow edge
#

it is batter

tender shard
#

while 1.9 added a cooldown?

viral crag
#

yup

mellow edge
#

because I made my own autoclicker

#

in javafx

#

xD

tender shard
#

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"

grim ice
#

actually

#

its probably just annoying u have to wait to hit again

mellow edge
#

I think most people that play pvp want old pvp so that's what I'll go with

grim ice
#

so u cant have cool looking comboes

#

and hit synces

#

and cool montages etc

tender shard
grim ice
#

and its also a result of bandwagon

eternal oxide
mellow edge
#

*for me old pvp is harder

viral crag
#

there is also the hypixel garbage

mellow edge
#

wdym

tender shard
#

to answr your question: there are a billion plugins to restore "old" pvp in 1.9+

grim ice
#

btw

eternal oxide
#

When I have a creeper charging me I want to panic spam click to save my life.

tender shard
#

so really no need to do another plugin for this

tender shard
#

try it, see if it's fitting your neds

grim ice
#

Also, How to get a completely random number

#

COMPLETELY random

viral crag
#

if hypixel stopped using 1.8 then people would quit thinking they need it

tender shard
grim ice
#

o

tender shard
#

you do not need a TRUE random number anyway

mellow edge
#

all the things the plugin does are listed

tender shard
#

what would you need it for

grim ice
#

well

#

i want a completely random delay

#

that will never show any pattern

tender shard
#

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

grim ice
#

i want the most random random number possible

mellow edge
#

but sadly you can't hide attack bar at the middle of the screen

lost matrix
tender shard
mellow edge
#

because it is a client side feature

viral crag
grim ice
#

its not an xy problem, dw

tender shard
#

ThreadLocalRandom is more then you'll EVER need

grim ice
#

isnt there anything better

tender shard
#

no

#

well

#

yes

mellow edge
#

who needs Random if u can use LocalThreadRandom

tender shard
#

but you won't ever need it

grim ice
#

I do

#

want it

tender shard
#

use ThreadLocalRandom or get lost in implementation details

#

idc

grim ice
#

lo

mellow edge
#

lo

tender shard
#

hi

lost matrix
tender shard
#

linux also provides /dev/(u)random

#

which is probably 99.9999% equally good

grim ice
#

but http requests

tender shard
#

you do not need truly random numbers

grim ice
#

would be laggy I assume

tender shard
#

you do not need truly random numbers

grim ice
tender shard
#

no

#

you do not need truly random numbers

lost matrix
mellow edge
#

why are mods so horrably hard to code compared to spigot lol, I love it

tender shard
grim ice
#

i wouldve wanted it to be less demanding as its a client side mod, but sure

viral crag
#

unless you are doing crypto, there is really not a need for high precision random

tender shard
grim ice
#

consider it lottery

tender shard
#

NOONE has EVER needed REALLY TRUE random numbers

#

NOONE

lost matrix
#

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.

viral crag
tender shard
#

all everyone ever needs is something unpredidtable enough

visual tide
#

SecureRandom

#

best u'll get

viral crag
#

cryptographic signatures

grim ice
#

@visual tide i bet random org is better tho

tender shard
grim ice
#

wait actually

manic delta
#

Hey mfnalex

grim ice
#

ill have that distributed

tender shard
#

I can choose passwords only between 00000 and 99999

#

now tell me, why would that bank need a TRUE RNG?

lost matrix
manic delta
grim ice
#

evenly

#

over a few seconds i assume

viral crag
#

until tangled pair gets implemented, the grinding attacks on banks wont stop

tender shard
#

also SecureRandom still relies on the entropy available on the system

lost matrix
tender shard
viral crag
#

you can brute that which is why its canceled after a few bad attempts

tender shard
#

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

viral crag
tender shard
#

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

viral crag
#

it currently takes about a week to break 2048 cypher - providing you can afford the power

grim ice
#

cant computers predict a localthread one

tender shard
viral crag
viral crag
#

2048 bit cypher

tender shard
#

you realize there's a like a million cryptography algorithms out there?

#

so what are you talking about?

#

ED25519? RSA? ...

grim ice
tender shard
#

that's the whole point of what I'm trying to say

grim ice
#

so its impossible for a computer to guess a psuedo random?

tender shard
#

no, of course not

#

it depends on how much you know

viral crag
#

improbable for a normal computer

grim ice
#

Not enough

tender shard
#

if you know the whole computer's memory, you can guess the next number

grim ice
#

no

#

well

tender shard
#

if you don't, you can't

grim ice
#

what if its another computer user

#

can he guess ur psuedorandom

tender shard
#

If you know every single bit in the RAM, you can guess the next number, of course

grim ice
#

nah its not in the same machine

tender shard
#

what are you talking about

#

I am talking about a normal "random" number generator

grim ice
#

yes

tender shard
#

let's do a tiny experiment

grim ice
#

Alright,
I generated a psuedo random in machine a
can machine b guess it

viral crag
#

just take a random double and select a random place/section from it

hasty prawn
grim ice
#

for example see a pattern

hasty prawn
#

You're only given 1 number

tender shard
#
Random random = new Random();
        int number1 = random.nextInt();
viral crag
#

normal randoms have a full repeatable pattern eventually

tender shard
#

-757614367

#

what's the next int?

hasty prawn
#

4

tender shard
hasty prawn
#

point disproven hypixel_cool

tender shard
#

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

tender shard
#

even if you have a BILLION number

#

you cannot guess the next one

#

you simply can't

#

it's not possible

grim ice
#

can it see a pattern

tender shard
#

imagine this patterN:

grim ice
#

like a really advanced machine, can it see a pattern though it

tender shard
#

1,2,3,4,5,6,7,8,9

#

what's the next number?

#

is it 10?

#

or is it 0?

grim ice
#

0

tender shard
#

or is it maybe 11

#

and then follows 22?

tender shard
eternal oxide
#

if you want a random that another machine is very unlikely to guess just seed it using the server uptime in nanos

grim ice
#

how about a machine learning algorithm made specifically for psuedo randoms

simple anvil
#

what license do i need if i dont want someone to distribute my code?

tender shard
#

my idea was to just count up until I reach 10, and then just go on with 2,4,6,8 etc

grim ice
#

cant it see a pattern

midnight shore
#

I guess that after it repeats itself then the pattern is recognizable, so at that point you could know the next β€œrandom” number

eternal oxide
#

as you reseed every number there is no discernible sequence

tender shard
#

there isn't even a pattern in halfly random numbers

tender shard
#

because there is an unlimited amount of algorithms that could lead to the next number

grim ice
#

but i need

#

probably a few hundred thousand

#

randoms

tender shard
#

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"

grim ice
#

i shouldve mentioned that

tender shard
#

I will send you one link now

#
grim ice
#

i need one every few milliseconds

tender shard
#

if you still want to argue that you need "true" randomness after reading this, okay ping me pls

grim ice
#

no way im reading all of this

#

ill just believe you

tender shard
#

but if you haven't fully read it, pls just trust me: you do NEVER need FULLY TRULY RANDOM NUMBERS

viral crag
#

you could just read the conclusion of the research paper i linked

tender shard
#

NEVER EVER IN SOMEONES LIFE HAS SOMEONE EVER NEEDED FULLY TRULY RANDOM NUMBERS

tender shard
grim ice
#

so its impossible to see a pattern between psuedo numbers?

tender shard
#

but

viral crag
#

2hex, i gave up on you

tender shard
#

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

grim ice
#

how is it "no" then

tender shard
#

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

grim ice
#

Alright lemme rephrase this, can a machine know the way you're generating a number just based on the numbers you output?

grim ice
#

Ic

#

thats enough randomness then

tender shard
#

it could merely come up with an algorith that creates the numbers you've already given

grim ice
#

so ThreadLocalRandom iti s

tender shard
#

I said that 20 times already

#

ThreadLocalRandom is totally fine to use

grim ice
#

alr sorry for wasting ur time

tender shard
#

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

grim ice
#

but one more thing, is it expensive to generate the random number each few milliseconds

tender shard
#

it depends on the implementation

viral crag
#

if computers stopped using pll and AC power it would be less of an issue

tender shard
#

IIRC java on linux uses /dev/urandom

#

so, no

river oracle
#

how does a persistent data holder work on a player? e.g. is data stored on a per player basis

grim ice
#

ThreadLocalRandom, on windows

tender shard
tender shard
#

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

grim ice
#

i

tender shard
#

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

kindred valley
#

?learnjava

undone axleBOT
tender shard
#

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

viral crag
#

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.

tender shard
viral crag
#

so you will need to watch for delay

tender shard
#

I've never seen a JVM implementation using /dev/random directly

#

they all use /dev/urandom

river oracle
wet breach
tender shard
river oracle
#

alright so it should just store on that specific player just making sure I'm getting this right

tender shard
#

PDC is merely nothing more than an awesome wrapper class for the builtin NBT stuff

river oracle
#

ahhk

#

thanks smh wasn't sure if it was weird with players the concept messes with me aha

tender shard
#

whenever you have a PersistentDataContainer, you have a PersistentDataContainer :3

#

and they always behave the same

#

that's the whole point of them existing

wet breach
tender shard
wet breach
viral crag
#

it says it may be a blocking function if it has to wait for the entropy

tender shard
wet breach
#

this is the biggest difference between the two

viral crag
#

it did not say anything about running out of entropy - it does not use any of the existing entropy before it is accessed

tender shard
#

in 99.9% of cases people should get their random numbers from urandom

wet breach
#

when /dev/random runs out of entropy it will block while it is generating more entropy

tender shard
#

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"

wet breach
#

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

tender shard
wet breach
#

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

tender shard
#

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

wet breach
#

however, I will say /dev/random does take more resources to use then /dev/urandom

viral crag
#

2hex was commenting about the http delay, it was just a comment regarding a different delay

tender shard
wet breach
tender shard
#

all I wanted to say is: in general, no number generator is truly random unless you are actually connected to some uranium thingy lol

wet breach
unreal quartz
#

Nerds

tender shard
#

but it also doesn'T matter in 99.9999999999999% of cases

wet breach
tender shard
#

NOONE can predict the next number that MY localrandom produces even if I give you the last 14 billion numbers

unreal quartz
#

4

wet breach
tender shard
#

:<

wet breach
#

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

viral crag
#

on a normal system the clock is the problem

wet breach
#

why is the clock the problem? Unless you were using that as part of your initial seed I could see how it would be

viral crag
#

because AC power and PLL devices resonate

#

if they didnt, random truly would be

unreal quartz
#

I resonate all the time

tender shard
#

well a modern linux kernel uses a ton of stuff for "random" numbers