#help-development

1 messages · Page 324 of 1

remote swallow
#

neither does PotionEffect or PotionEffect.getType have keys

#

on 1.17

compact haven
#

oh its not fucking Keyed

#

thats so dumb

young knoll
#

1.17

compact haven
#

thank you Coll

remote swallow
#

1.17.1 actually

#

but close enough

young knoll
#

Shh

compact haven
#

epic upgrade ur version

remote swallow
#

but support

compact haven
#

version support is for the losers

remote swallow
#

i think im a loser then

young knoll
#

Exactly

compact haven
#

Coll can u link ur PR

young knoll
compact haven
#

so he can implement it

young knoll
#

Someone wants a 1.0 plugin

remote swallow
#

i saw that

compact haven
#

i saw that too lmfao

tender shard
compact haven
#

not in his version

#

betteritemconfig depends on 1.17.1

#

for whatever god forbidden reason

remote swallow
#

support

young knoll
#

Does anyone still use 1.17

remote swallow
#

people are weird

tender shard
#

whut

#

nobody uses 1.17

compact haven
#

W take

#

either support 1.8+ or 1.19.3

#

like idk man

remote swallow
#

josh does minetweaks not work on 1.17.1 or higher

worldly ingot
#

Counterpoint, don't support 1.8+

compact haven
tender shard
#

I always support "version it was originally released for"+

#

and sometimes, not anymore

#

lol

worldly ingot
#

I support "whatever API I want to use, that's the minimum"

young knoll
#

I dropped minetweaks support on 1.17

remote swallow
#

when did it get keyed

young knoll
#

1.18

remote swallow
#

smh

young knoll
tender shard
#

in 1.18 it was keyed

remote swallow
#

so im saying FUCK YOU to all those 1.17ers

#

also i get to upgrade to java 17

#

to fuck them even more

tender shard
#

isnt 1.18 java 17 anyway? 😄

remote swallow
#

yeah

tender shard
#

GH packages are stupid

#

it says "Choose a registry" but you cannot click on anything there

remote swallow
#

for

#

fuck

#

sake

#

i upgrade to 1.18

#

and i dont have it

compact haven
#

oh

remote swallow
#

i have the other 2 1.18 versions

young knoll
#

It might have been a minor version

#

What did 1.18 go to again

compact haven
#

mate

#

perhaps u need to publish to your registry

#

not github packages directly

tender shard
remote swallow
#

why am i watching a talking racoon

young knoll
#

You tell us

compact haven
#

but thats ok if u can figure it out

remote swallow
remote swallow
#

and theres a talking tree

#

who says he is groot

tender shard
#

I must say, FlatLaf looks indeed very nice

#

except for the Hyperlink things

remote swallow
#

way too blu

tender shard
#

yeah, and when using the Darcula theme, it's basically invisible

#

this just hurts my eyes

compact haven
#

mine too

tender shard
#

thanks but I don't think so, the TableCellRenderer is from SwingX's HyperlinkProvider which probably can't be changed with flatlaf

#

it's not part of the default swing stuff

balmy valve
#

Anyone know if it's possible to set the BlockState of a Falling block? Don't see any methods for it so I assume its impossible but doesn't hurt to ask

compact haven
#

falling block is an entity

#

will need to wait until it falls

#

afaik

balmy valve
#

Yeah I was guessing ty !

sterile token
compact haven
#

huh

#

no blocks are not entities

rotund ravine
#

not sure what he means either.

rotund ravine
compact haven
#

he's probably thinking entity as in you would when saying "The entity controlling the vehicles in Michigan is the Michigan DMV"

sterile token
#

"entity refers to any living or non-living object that is rendered in the game world"

compact haven
#

in Minecraft an entity is just the mobs and animals

#

and tileentities, somewhat

#

not blocks

wet breach
#

There is such things called Block Entities

compact haven
#

am very confused here

wet breach
compact haven
compact haven
sterile token
#

basically everything in mc, are entities

compact haven
#

no

#

blocks are only entities when they store extra data

#

and they arent fully entities either

#

like the block still exists

wet breach
#

that are not like actual blocks

compact haven
#

wdym

wet breach
#

like pistons, beehives, campfires etc

#

those are all block entities

compact haven
#

right, but they all store extra data

#

for example a piston has a state

#

and beehives have bees literally in the nbt

#

and chests I assume you also include there, they store an inventory

wet breach
compact haven
#

if I'm not wrong tile entities only exist so they didnt need extra space in the blocks section since many blocks dont have extra tags

wet breach
#

but yeah not everything are entities

young knoll
#

Pistons are not a tile entity

compact haven
#

but at that point I'm getting into territory I'm not confident in

young knoll
#

Tile entities are for anything that stores dynamic data

wet breach
#

which pistons do

compact haven
#

a piston is in Bedrock and Education

young knoll
#

Blocks can only store states, which are static

#

Pistons are not in java

compact haven
#

the piston head is a tile entity, anyways

#

that's likely what frostalf meant

young knoll
#

A moving piston is a tile entity

#

But not a static one

compact haven
#

yes

young knoll
#

Which is good because if it was you couldn’t move it with pistons

#

Because Mojang still hasn’t given us that on java

river oracle
#

I feel so fucking stupid right now.

        // return if the player is not sneaking and the action is not right click block
        if (!e.getPlayer().isSneaking() && e.getAction() != Action.RIGHT_CLICK_BLOCK) {
            return;
        }
        Bukkit.getLogger().info("Pass");

Why does this still trigger even if the player is only right clicking the block.

I want them to have to crouch and right click the block

compact haven
#

or

#

right?

wet breach
compact haven
#

he means pistons are not tile entities in java lol

wet breach
#

oh

compact haven
#

you're inversing the conditions

wet breach
#

right the piston base is not a tile entity

river oracle
#

I kept thinking about it.

#

smh

compact haven
#

np lol, we all have been there

wet breach
#

some more then others

torn shuttle
#

hey anyone know off the top of their heads if fireworks damage scans as explosion damage or something?

#

is there a way to block it specifically?

#

(easy way that is)

#

would it trigger the entity damage by entity event so I can check if it's a firework maybe?

#

yeah seems like it

kind hatch
#

Does anyone know how I should go about storing a List<UUID> in mysql? This list is supposed to serve as a way to keep track of unique interactions between players.

compact haven
#

yes

#

as a separate table

#

row_id | player_id | interaction_player_id |

#

and store the UUIDs as strings if necessary

#

there is a UUID function though

#

don't know how well that plays out with the JDBC

#

INSERT (player_id, interaction_player_id) INTO table VALUES (UUID(?), UUID(?))

#

might work

#

just serialize them yourself, much easier imo

kind hatch
#

To be clear, this should work per player? Meaning that each player has their own list of UUIDs.

sterile token
#

Def something is not making sense

humble tulip
#

then you get the list by getting where player id = theplayer u wanna get and all the resulting interaction_player_id in the resultset makes the list

sterile token
#

🤔

humble tulip
sterile token
humble tulip
#

let's see commandhandler

sterile token
#

ok

#

I dont wondering to think tha tthe final on ComnandAPi is causing the issue

humble tulip
#

that should work

sterile token
#

Yeah

#

Its weird

humble tulip
#

see what intellij suggests u do

sterile token
#

💀

#

First time something like this happen

#

Maybe IJ is bug

humble tulip
#

invalidate caches and restart

kind hatch
sterile token
#

right

compact haven
#

and each row would be an item in the list

#

so like player_interactions would be your table

kind hatch
#

Ok, I think I get that, but what about the primary key? Should I just let the table auto increment or can I use the player uuid as a foreign key?

humble tulip
#

it stores like

player1 | player2
player1 | player3
player1 | player4
player2 | player1
compact haven
#

if you want a primary key include a row id

#

doesnt affect anything

humble tulip
#

there's no point in that though right?

compact haven
#

but iirc a primary key will help the database engine do its job

humble tulip
#

if that were the case, won't a primary key be generated for all tables without 1?

#

internally atleast

compact haven
#

perhaps you can create a composite primary key?

#

in fact that's probably the best option

kind hatch
#

Well, I'd like to have the foreign key be the uuid of the player I want to look up. Not sure if that's possible, but the table would just auto increment otherwise and I don't have a way to tie random numbers to uuids.

*player1* | player2
*player1* | player3
*player1* | player4
player2 | player1
compact haven
#

well are interactions not vice-versa?

#

you'd want a foreign key for both UUID columns to the users table, if you have one

#

and a composite primary key on both UUID columns

#

that's how I'd place it

kind hatch
#

Let me figure out how to explain this.

wet breach
#

you can use UUID's as primary keys

compact haven
#

I mean I dont think you really need to explain

CREATE TABLE interactions(
  lookup_player VARCHAR(36) NOT NULL FOREIGN KEY REFERENCES users(player_id),
  secondary_player VARCHAR(36) NOT NULL FOREIGN KEY REFERENCES users(player_id),
  PRIMARY KEY (lookup_player, secondary_player)
);
wet breach
#

if this is a single table, I wouldn't even bother with foreign keys

livid dove
wet breach
#

what are we even making btw with DB?

compact haven
#

a List<UUID> for "player interactions"

livid dove
humble tulip
#

worldwide?

#

huh?

livid dove
kind hatch
#

@compact haven
So, I am letting end users choose what database they want to use. By default, it's flat files, but I'm working on the MySQL implementation now.

In my yaml setup, I keep track of unique interactions per player with just a simple list. The interaction in this case is just a hug. It's more or less just a simple check of have you given this player a hug before. If no, save the data, if yes don't.

  unique_hugs:
    given:
      - UUID1
      - UUID2
      - UUID3
    received:
      - UUID1
      - UUID2
      - UUID3

These lists can grow infinitely. I want to store these in MySQL, but I need to link them back to the proper user.

wet breach
#

you need 3 tables for this to work

humble tulip
wet breach
#

you have what is called a many to many relationship

#

and that isn't all that difficult to implement in MySQL

#
users (UUID, (anything else you want to store on users))
interactions (id, description)
list (users, interactions)
livid dove
#

Why are we pissing around with 3 tables when you could record them all on one table but with check to see if it's their first hug or not.

If so make the "first hug" collum entry a 0, if it isn't then a 1

wet breach
livid dove
compact haven
#

can it just be a hug or can it be anything else @kind hatch

kind hatch
#

In this case, just a hug.

compact haven
#

then u only need 2

#

users and interactions

wet breach
#

they are probably wanting to record who they got a hug from

#

if that is the case it is still 3 tables

compact haven
#
CREATE TABLE hugs(
  hugged_by VARCHAR(36) NOT NULL FOREIGN KEY REFERENCES users(player_id),
  hugged VARCHAR(36) NOT NULL FOREIGN KEY REFERENCES users(player_id),
  PRIMARY KEY (hugged_by, hugged)
);
humble tulip
compact haven
#

why wouldnt that work tho frost

wet breach
#

all the third table is, is just 2 keys

kind hatch
#

I don't mind flexibility or extensibility. Maybe in the future I'd also want to keep a timestamp as well.

livid dove
compact haven
#

would just store the interaction type in the actual list table alongside, since you dont need extra data with it

#

if you wanted to extend it past just hugs

wet breach
#

the third table is just basically the keys that reference both tables

compact haven
#

frostalf they dont need an interactions table like u have

kind hatch
compact haven
#

its just hugs, and even if it wasnt they dont need a description of a hug

wet breach
#

it is called database normalization btw

#

here is a link for it

compact haven
#

sure but those should be hardcoded, because each type would need to be handled in code

wet breach
#

Database normalization or database normalisation (see spelling differences) is the process of structuring a relational database in accordance with a series of so-called normal forms in order to reduce data redundancy and improve data integrity. It was first proposed by British computer scientist Edgar F. Codd as part of his relational model.
Nor...

compact haven
#

the database is normalized once you add the composite primary key

#

because mysql will ensure that record is unique

#

you dont need that second table

compact haven
#

and player_id is just uuid (in my create table statement)

wet breach
#

or autoincremented ID

#

which ever they want

#

ideally UUID

compact haven
#

sure but why a random primary key which doesnt do anything pepe_shrug

regal scaffold
#

Hey!

compact haven
#

in a many to many like this, composite key better imo

sterile token
compact haven
#

obviously not

#

I meant random as in

#

no purpose in the data set

#

it isnt a player id

#

InnoDB will create such a thing automatically, just not visible to you

regal scaffold
#

If I have a Events.java class that implements Listener

can I register my events from main using
Bukkit.getPluginManager().registerEvents(new SpawnEvents(this), this);

To pass a instance of my plugin to the Events.java

#

new SpawnEvents(this), this)

#

If I have a Events.java class that implements Listener

can I register my events from main using
Bukkit.getPluginManager().registerEvents(new SpawnEvents(this), this);

To pass a instance of my plugin to the Events.java

    public Events(Plugin plugin) {
        this.plugin = plugin;
    }
wet breach
compact haven
#

you know what I meant frostalf

wet breach
#

lol

#

but yes you could use a singular table, But I would recommend at minimum at least 2

wet breach
#

I would probably use 3 just because it is easier

#

I mean not all that hard to use joins or just let another table aggregate the stuff for you

compact haven
#

anyways @kind hatch if you are still having trouble understanding the design,

UUID_P:
  unique_hugs:
    given:
      - UUID1
      - UUID2
      - UUID3
    received:
      - UUID1
      - UUID2
      - UUID3

would map to

hugged_by | hugged
UUID_P | UUID1
UUID_P | UUID2
UUID_P | UUID3
UUID1 | UUID_P
UUID2 | UUID_P
UUID3 | UUID_P
wet breach
#

But I usually like to setup my DB's in such a way that allows for some expanding though and not locking myself into a certain way completely as well

compact haven
#

though looking at the data set you gave me, it sure seems as though the columns aren't very orderly, as in each hugged_by uuid also exists in reverse

kind hatch
#

Not necessarily.

compact haven
#

alright, as long as that's the case

kind hatch
#

I'd probably make separate tables for ones given vs ones received.

compact haven
#

bro

kind hatch
#

Just to separate them

compact haven
#

that is literally

#

not how databases work

wet breach
#

I wouldn't do that, creating too many tables can be just as bad as not creating enough tables

#

its a fine balance

regal scaffold
#

If I have a Events.java class that implements Listener

can I register my events from main using
Bukkit.getPluginManager().registerEvents(new SpawnEvents(this), this);

To pass a instance of my plugin to the Events.java

    public Events(Plugin plugin) {
        this.plugin = plugin;
    }
kind hatch
compact haven
#

the query for given is just SELECT hugged FROM hugs WHERE hugged_by=? and the query for received is just SELECT hugged_by FROM hugs WHERE hugged=?

wet breach
#

given and received hugs relate to each other, therefore they should be in the same table

humble tulip
wet breach
#

they also relate to players but you have other data relating to players already, so we use primary and foreign keys to link them together

#

because you might want to aggregate the hugs data and having it in its own table makes that more easier to do

wet breach
#

So, now we have 2 tables. The third table in what I had given, all it is is just the keys

#

you can do without the third table and just use 2 but you will need to use joins yourself

#

where as my third table would basically join the data for you

#

either way is valid

#

personally I am always a fan of utilizing the DB and its features

#

as well as reducing query sizes

compact haven
#

but a JOIN is utilizing DB features

kind hatch
#

I'm still trying to figure out how the 3 tables work together. I don't quite get this many to many relationship.

compact haven
#

you can do lightning fast joins if properly written

wet breach
#

indeed, but at the same time joins doesn't necessarily reduce query size either. So if you can have a table that aggregates the data you are going to commonly use with a query anyways

#

then that is the better option

#

usually

compact haven
#

well how does your third table aggregate the data

#

explain that to me, because all I saw was 3 tables, 1 being like I had, 1 was his player data column, and the other was a list of interaction types from my understanding

#

like interactions was

id | description
and a sample entry wouldve been id="hugs" description="hug another player"

#

and I was completely confused as to why that existed

kind hatch
#

Yea, that also confused me a little.

compact haven
#

ahem but looking at your wireframe again shadow

kind hatch
#

I don't care if it's two or three tables. I might have to redo this entire database with all of the data I want to store anyways, but as long as it's flexible.

compact haven
#

it seems there's three different types of hugs?

#

self, mass, and normal?

kind hatch
#

Yes, there are different types.

compact haven
#

mass being?

kind hatch
#

Group hugs. (or just everyone on the server at the time)

#

Let me give you the yaml file. Just to give you an idea of what I need to store in MySQL.

compact haven
#

okay this actually requires a different database design then

kind hatch
#

That's how I store all the data in yaml.

#

All of that needs to get turned into MySQL

wet breach
#

functions are very powerful if you know how to use them and when to use them. They basically can do all sorts of things on their own or when certain things happen. You can even create a cronjob to just invoke a mysql function if you really wanted to lol

#

but essentially a function could easily populate the third table of the data you want and will commonly be querying for anyways

compact haven
#
CREATE TABLE "hugs" (
    "hugged_by"    TEXT NOT NULL,
    "hugged"    TEXT,
    "type"    TEXT DEFAULT "normal",
    "interaction_id"    INTEGER,
    "timestamp"    TEXT NOT NULL,
    FOREIGN KEY("hugged_by") REFERENCES "player_data"("uuid"),
    FOREIGN KEY("hugged") REFERENCES "player_data"("uuid"),
    PRIMARY KEY("hugged_by","hugged","interaction_id")
);
#

ehm where interaction_id, hugged, and hugged_by are unique altogether

#

because in a mass hug, you'd have 1 interaction_id

#

that's similar to the index id of your recent_hugs.given, I guess

wet breach
#

anyways we should probably stick with your way for now though

#

probably don't need to be introducing something too complex 😛

#

I mean its not super complex, but it is different

compact haven
#

does MySQL support functions though

#

ik that Postgre does, but never used them there either

wet breach
#

mysql supports functions and stored procedures

compact haven
#

that's what I meant

#

stored procedures

#

are you talking about something different? PikaThink

#

@kind hatch can u send a yaml example of a mass_hug

#

is it just a bunch of normal hugs, or does it store differently

kind hatch
wet breach
#

MySQL has set

#

and Enum

#

so you can if you really wanted to store an entire list

kind hatch
#

O.o

compact haven
#

I wouldnt use that for this though

#

because your list is like

#

some aggregate of data

wet breach
#

no I wouldn't either

#

but I was clarifying though that MySQL does have that ability

kind hatch
#

Lmao, I would have used this if I had know about it.

compact haven
#

like u didnt store the other people who got hugged

#

am confused

wet breach
compact haven
#

I was actually using SQLite data browser to make that last statement

#

and it doesnt have that type

wet breach
#

ah

compact haven
#

thats my bad, forgot to change

wet breach
#
DATE     A date. Format: YYYY-MM-DD. The supported range is from '1000-01-01' to '9999-12-31'

DATETIME(fsp)     A date and time combination. Format: YYYY-MM-DD hh:mm:ss. The supported range is from '1000-01-01 00:00:00' to '9999-12-31 23:59:59'. Adding DEFAULT and ON UPDATE in the column definition to get automatic initialization and updating to the current date and time

TIMESTAMP(fsp)     A timestamp. TIMESTAMP values are stored as the number of seconds since the Unix epoch ('1970-01-01 00:00:00' UTC). Format: YYYY-MM-DD hh:mm:ss. The supported range is from '1970-01-01 00:00:01' UTC to '2038-01-09 03:14:07' UTC. Automatic initialization and updating to the current date and time can be specified using DEFAULT CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP in the column definition

TIME(fsp)     A time. Format: hh:mm:ss. The supported range is from '-838:59:59' to '838:59:59'

YEAR     A year in four-digit format. Values allowed in four-digit format: 1901 to 2155, and 0000.
MySQL 8.0 does not support year in two-digit format.
kind hatch
# compact haven but that MASS means nothing

I haven't gotten this far. I am admittedly running into a weird data storage issue since I started with the YAML implementation first. MySQL has been making me rethink everything about how I store the data.

You're right though, I should probably keep track of those who were hugged too, but I have no use for it other than statistics or smth. Also, I can't even begin to imagine how much data that would store in yaml file. I'm trying to retain feature parity regardless of which database they choose.

compact haven
#

mm honestly

#

I'd say sqlite or mysql

#

and just be done with that

#

but the storage usage is still there

#

ehm just a little less apparent

wet breach
#

since this is data that typically you wouldn't want edited and would generally cause problems if it was, instead of yaml you should go with binary storage

#

and then your issues with yaml would go away

#

you could however use yaml as a intermediary to look at stored data to see if there is problems

compact haven
#

frostalf can u do a quick calculation on how many rows of the last table you can store with like 10mb of pages, is it even possible to do that calculation

#

because in the current write-up it'd store each interaction, so if they hugged the entire server of say 50 people, that's 50 rows

#

(I have no idea to calculate that, or if it's even possible, is why I asked you lol)

wet breach
#

this is a combinations/permutations calculation

#

so since there is 50 people that could hug in theory 50 people since they could hug themselves

#

the calculation is quite simple

compact haven
#

no I get that part

compact haven
wet breach
#

so you would multiply all the numbers from 1-50 and then square it

kind hatch
#

Factorials?

wet breach
#

I mean 25

compact haven
#

frostalf xd

#

thats not the calculation I was talking about

wet breach
#

oh

compact haven
#

I understand how to calculate the permutations lol

wet breach
#

well it would be hard to calculate size

#

because of how MySQL stores stuff and optimizes

compact haven
#

right, like its impossible basically to even know how much storage a table takes up

#

thats why I didnt know if such a calculation was even possible

wet breach
#

just because your column is varchar 36, doesn't necessarily mean that column is taking up 36 character size all the time if nothing is making use of the max limit

wet breach
kind hatch
#

I guess I could drop yaml as I am already working on an SQLite implementation. It's half baked since I still need to figure out a good database design, but I'd like to be able to convert existing data. So when people update, they won't just lose all existing data.

compact haven
#

wait actually?

#

there was something I was ttempting to do with mysql and I was told it was impossible

wet breach
#

would have to go look, not really something I have ever really needed to look at though

compact haven
#

perhaps it wasnt that

#

but I think it was pepe_shrug

#

well

#

@kind hatch you'll be getting rid of your integer statistics columns anyways

wet breach
# compact haven but I think it was <:pepe_shrug:723588242238210088>

SELECT TABLE_SCHEMA AS `Database`, TABLE_NAME AS `Table`, ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)` FROM information_schema ORDER BY (DATA_LENGTH + INDEX_LENGTH) DESC;

SELECT
  TABLE_NAME AS `Table`,
  ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)`
FROM
  information_schema.TABLES
WHERE
    TABLE_SCHEMA = "bookstore"
  AND
    TABLE_NAME = "book"
ORDER BY
  (DATA_LENGTH + INDEX_LENGTH)
DESC;

SELECT
  TABLE_NAME AS `Table`,
  ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)`
FROM
  information_schema.TABLES
WHERE
  TABLE_SCHEMA = "bookstore"
ORDER BY
  (DATA_LENGTH + INDEX_LENGTH)
DESC;

compact haven
#

those serve no purpose when you can just use a count

wet breach
#

I was right it would be in the schema 🙂

compact haven
#

what an interesting command

#

ty frostalf

#

what data do you want to preserve

#

the fact they did a mass hug, or exactly who they mass hugged

kind hatch
wet breach
#

you could just use a mysql function to do that

compact haven
wet breach
#

that would literally count for you

compact haven
#

database engines are incredibly powerful

#

well the ones typically seen, anyways

wet breach
#

as long as you are not asking mysql to do complex equations

#

it is fine

kind hatch
compact haven
#

alright

kind hatch
#

I don't have a reason otherwise.

#

Or at least can't think of a purpose to store the users.

compact haven
#

but then you wouldnt know if they gave a hug to UUID5 yet

#

if they mass hugged and UUID5 was one of them

kind hatch
#

Uhh, I'm not treating mass hug interactions as unique interactions. It's a separate thing.

compact haven
#

alright

#

Angery continuing to make me revise this schema

kind hatch
compact haven
#
CREATE TABLE "hugs" (
    "hugged_by"    VARCHAR(36) NOT NULL,
    "hugged"    VARCHAR(36),
    "type"    TEXT DEFAULT "normal",
    "hugged_at"    DATETIME NOT NULL,
    FOREIGN KEY("hugged_by") REFERENCES "player_data"("uuid"),
    PRIMARY KEY("hugged_by","hugged"),
    FOREIGN KEY("hugged") REFERENCES "player_data"("uuid")
);
wet breach
#

nothing like having two somewhat decent DBA's giving you advice lmao

#

and essentially teaching you how powerful DB's can really be 😛

kind hatch
#

I'm in over my head. 💀

compact haven
#

you're fine

kind hatch
#

Lmao, but I appreciate it regardless.

compact haven
#

I mean hey, learning it now is better than having to refactor after you let the code do all of the querying and joining for you

compact haven
#

I've gotten rid of the interaction_id as well, since it was no longer "necessary" to determine whether an interaction was unique (because there was no longer more than 1 entry for a single interaction)

#

if it's normal, then both hugged_by and hugged should be set
if it's self, then only hugged_by should be set
if it's mass, same as self

kind hatch
compact haven
#

ehm that is the case

#

actually a composite primary key doesnt even work here

#

or wait

#

@wet breach because I'm assuming you can hug the player several times, then you'd need another interaction_id anyways, right?

#

honestly frostalf was right from the start, unless I've confused myself

#

am sorry that I talked him out of that

#

you do need an interaction_id anyways

wet breach
#

lol

remote swallow
#

itzdlg has spent the past hour here instead of doing their plugin

compact haven
#

bro is so correct

#

but this is more fun

wet breach
#

that would be the easier option unless you want to start setting up counters

compact haven
#

this project has me using mongo

#

and I'm not using mongo properly

#

I can nearly guarantee that

wet breach
#

don't recommend setting up all kinds of counters

compact haven
#
CREATE TABLE "hugs" (
    "interaction_id"    INTEGER NOT NULL AUTOINCREMENT UNIQUE,
    "hugged_by"    VARCHAR(36) NOT NULL,
    "hugged"    VARCHAR(36),
    "type"    TEXT DEFAULT "normal",
    "hugged_at"    TIMESTAMP NOT NULL,
    FOREIGN KEY("hugged_by") REFERENCES "player_data"("uuid"),
    PRIMARY KEY("interaction_id"),
    FOREIGN KEY("hugged") REFERENCES "player_data"("uuid")
);
#

iteration 35 of the hugs table

#

interaction_id here is UNIQUE because a mass hug is merely recorded as it happened, not a row for each person hugged by hugged_by

#

as opposed to the other one, where it was a 3-way composite between the 2 hugs & the interaction_id because it had that type of design

#

ehm okay

#

I think we're pretty much set to mirror your current yaml setup @kind hatch

regal scaffold
#
    @EventHandler(priority = EventPriority.HIGHEST)
    public void onChunkLoad(ChunkLoadEvent event) {
        if (!event.getWorld().equals(Utils.SPAWN_WORLD)) return;
        if (event.isNewChunk())
            event.getChunk().unload(false);
    }
#

Is this the best way to make sure there's void

compact haven
#

uhm

regal scaffold
#

I want to cancel chunk creation, pretty much

compact haven
#

no that'll stop it from loading

#

it'll still generate

regal scaffold
#

oooo

#

I have a generator

compact haven
#

oh well

#

I guess because of isNewChunk

#

it'll still generate

#

just wont load

#

okay literally what I just said, yeah

regal scaffold
#

So what can I do

compact haven
#

will need to wait for someone else to answer that, havent attempted this myself

wet breach
#

best way would be to create a void world and then use your generator to create what you want

regal scaffold
#

I did that

#

But for some reason it still generated

compact haven
#

generated what, void?

regal scaffold
#
    @Override
    public void generateNoise(@NotNull WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkZ, @NotNull ChunkGenerator.ChunkData chunkData) {
        if (chunkX == 0 && chunkZ == 0)
            chunkData.setBlock(0, 50, 0, Material.BEDROCK);

    }

    @Nullable
    @Override
    public Location getFixedSpawnLocation(@NotNull World world, @NotNull Random random) {
        return new Location(world, 0, 50, 0);
    }
#

And it works

wet breach
#

if you did it correctly, it should only generate void chunks

regal scaffold
#

It generates void with a bedrock at cords

#

Any thoughts

kind hatch
# compact haven I think we're pretty much set to mirror your current yaml setup <@14300407543536...

Well, I feel like I'm now in a conundrum. Ever since you pointed out the mass hug interaction potential, I realized that the YAML setup might be incomplete or at the very least could be done better, but I feel that I should clarify the logic of each type just to make sure we are on the same page. However, I have to look back at the code since I've lost track of what everything does. I've been tinkering here and there and might have missed something.

Also, slightly unrelated, but if I were to ever want to add something to this database, would it require another redesign?

compact haven
#

wdym add something

#

like u can kiss instead of hug?

#

uhm @regal scaffold it sure sounds like it does what u want

#

why are u trying to stop generation

regal scaffold
#

Do I need to set the generator in spigt.yml or can I do it using
Bukkit.createWorld(new WorldCreator("lobby").generator(new Generator()));

#

Because it's a spawn

#

And I want it to be void outside of it

compact haven
#

is it not already?

regal scaffold
#

No because it's generating lol

kind hatch
# compact haven like u can kiss instead of hug?

No, but future "interactions" like that would be an interesting separate project. I mean that I might have hardcoded some stupid bullshit just to get it working and didn't log it to the yaml file.

compact haven
#

generating void or normal terrain

regal scaffold
#

normal terrain

#

Which blew my mind

regal scaffold
#

That's how bukkit will load a world right? Wanna make sure

compact haven
#

u might need to add to bukkit.yml

#
worlds:
  world:
    generator: plugin
# Replace "world" with the name of the server's main world name.
# Replace "plugin" with your plugin's name.
#

in your JavaPlugin subclass:

@Override
public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
    return new CustomChunkGenerator();
}
regal scaffold
#

But

#

That means

#

I can't generate worlds using code

#

Cause I gotta add them there...

compact haven
#

you can, but then when the world goes to generate more, it no longer knows your plugin created it

regal scaffold
#

Gonna try Bukkit.createWorld(new WorldCreator("lobby").generator(new Generator())); first

compact haven
#

like one the server restarts and you go back into that world

compact haven
#

how is it supposed to know that your plugin made it, that instance of ChunkGenerator is long gone

#

now I'd look into Multiverse Core

regal scaffold
#

nono

compact haven
#

because ik you dont need to do that for a fact

regal scaffold
#

I believe in myself

#

lol ik

#

I looked at it before I started

compact haven
#

am curious on how they fix that

#

could be reflection

regal scaffold
#

Trust I got this

#

Currently deleting like 3000 chunks from the map file

compact haven
#

well @kind hatch there's always ALTER TABLE statement

regal scaffold
#

And just leaving the spawn ones

compact haven
#

but depending on what u need to add, you might need a redesign. idk mate what u want to add

regal scaffold
#

8 more mins.lol

compact haven
#

nothing is future proof

kind hatch
#

Idk, I feel like I just need to keep better track of these interactions to begin with so that I don't have to redesign the entire thing. The only thing that I can currently think of adding is other types of statistics. Idk, what if I wanted to keep track of how many times the server owner was hugged or something. That's the best I can think of off the top of my head.

remote swallow
#

okay so itzdlg, im going to bed ill probably be not avaliable from anywhere untill at the minimum 2pm my time, maximum 6pm probably, its 6:45am atm. Anything you need doing go ahead and send a pr in if you remember

compact haven
#

all of those statistics are easy

#

remember, you arent having stat columns

#

you'd use the count function with a where clause hugged=? and the 1st parameter there ("?") is simply the UUID of the server owner

#

obviously that'd have to be in the config somewhere, but not hard

compact haven
#

I really appreciate all of ur work on this

#

btw u can call me dlg

#

_ _

but do note that if u want to keep track of all participants in a mass hug, then yes you'd need to redesign

kind hatch
#

Can you think of a reason to keep track of them? At this point in time, nothing comes to mind on what can be done with that information.

compact haven
#

knowing if u hugged them yet xd

kind hatch
#

That's the point of the normal hugs though? Idk, maybe I haven't thought this out as well as I think I have.

Looking over my stuff, it looks like I don't have any hardcoded bs lingering. Just to clarify some things.
I'm trying to track each hug type separately.

The normal hug is the only one that will keep track of unique statistics. (Both given and received)
The self and mass hugs are just counter stats.

I also have user preference data, but I already have the tables setup for that.

compact haven
#

user preference? o.O

#

is this like Marry v2

kind hatch
compact haven
#

oh

#

LMAO

#

I thought you meant preferences towards other users

kind hatch
#

Lmao, now that would be an interesting feature.

compact haven
#

make sure that uuid is has foreign key reference to player_data(uuid)

#

the preferences(uuid) one

kind hatch
#

Yea, I need to fix that preferences table. I need to remove the wants_realistic_hugs column since I can determine that based on the huggability column.

#

Actually

#

Can I remove both of them?

compact haven
#

idk

#

why u asking me

regal scaffold
#

@compact haven

compact haven
#

thats me

regal scaffold
#

Can you help me including multiverse in my pom

#

I'm having mental issues

compact haven
#

who said to use multiverse

regal scaffold
#

Maybe you

#

Not the point lol

compact haven
#

no i meant to check the source code

#

LMAO

regal scaffold
#

Oh no I wanna use their api now LMAO

#

Ok fine

#

I'll check

compact haven
#

I would never advocate for using multiverse just to do what u want

#

i actually already peeked at it for you

#

and I decided against it because its too many classes

#

I have no idea where the hacky shit would be to not include generators in bukkit.yml would be

kind hatch
# compact haven why u asking me

Cause design. If the huggability column can determine whether they want normal hugs or realistic hugs, then can't I just remove both of those columns and just compare the huggability value?

tender shard
#

🥲

#

gotta upload it as external file

kind hatch
#

4MB upload restrictions be like

tender shard
compact haven
#

just make the external link to your nexus jar

regal scaffold
#

@compact haven

#

Open that

#

Decomp

#

How cringe

compact haven
#

it literally provides a github link?

#

why would I decompile

regal scaffold
#

I know for memes

#

Just look

#

It's kinda cool

kind hatch
compact haven
#

idk what u find cool about it

#

it's a mess of versioned classes and annotations

#

and I dont believe it helps you with the current problem xd

regal scaffold
#

The obfustaction

#

Well

#

"Obfuscation"

compact haven
#

there is no obfuscation

#

well there might be in the jar

#

but I mean it's literally on github xd

regal scaffold
#

I know

compact haven
#

oh

regal scaffold
#

It just looked cool

#

lol

compact haven
#

that's kind of funny

regal scaffold
#

True ig

#

lol

compact haven
#

and you still need to do this step

#

you made me waste all this time and it doesnt have any relation to your problem

regal scaffold
#

yeah no I got it to work with the thing on bukkit.yml

#

You enjoyed it

tender shard
compact haven
#

yeah but you were supposed to not have to do that

#

like u wanted to not

#

i had recommended that abt a year ago to u

regal scaffold
#

I know I don't

#

But for the next hour it

#

it'll do

regal scaffold
tender shard
#

allatori

regal scaffold
#

Pretty cool

tender shard
compact haven
#

and he wrote his own string obfuscator

kind hatch
compact haven
#

because he likes annoying with people like me

tender shard
regal scaffold
#

Pretty cool but cringe lol

compact haven
regal scaffold
#

Alex now that you're here

#

Help us out

compact haven
#

if it can be determined from one column, my guess is based on true/false, just do that

regal scaffold
#

How do we get past bukkit.yml world generators incode only

compact haven
#

there's no benefit in 2 extra columns when it's related to one

#

especially if it can create data integrity errors

regal scaffold
#

Wanna create a world with a custom generator

compact haven
#

he wants to make it so he doesnt need to add his plugin as a generator in bukkit.yml

regal scaffold
#

^

#

Bukkit.createWorld(new WorldCreator("lobby").generator(new Generator()));

#

Does not do the trick

tender shard
#

ah okay well let's see where bukkit stores this list in the first place

compact haven
#

are u just going to tell him to reflectively add to it

regal scaffold
#

lol

tender shard
#

how else would you do it?

regal scaffold
#

wtf really

compact haven
#

I cant imagine that multiverse core does anything else

regal scaffold
#

That's the only way?

compact haven
#

yes really

regal scaffold
#

I'm checking the core

#

brb

compact haven
#

(It was a rhetorical question alex because I told him he might have to do the same thing)

wet breach
#

the only way you could have custom world generation without using a plugin would be to use a datapack

compact haven
#

no he's using a plugin

#

he doesnt want those extra 4 lines in bukkit.yml

eternal oxide
#

I've never had to add a generator to bukkit

regal scaffold
eternal oxide
#

does he want his generator tyo be used by default worlds or something?

regal scaffold
#

If you create worlds on command

#

You need to add every time

compact haven
#

oh

regal scaffold
#

I have a generator and it works elgarl

#

But it works only if I add the stuff in bukkit.yml

eternal oxide
#

definately not needed in Bukkit.yml

regal scaffold
#

How can I use Bukkit.createWorld(new WorldCreator("lobby")); without having to edit the bukkit.yml

#

It is or it doesn't work

eternal oxide
#

let me load my IDE

regal scaffold
#

Literally default generation otherwise

eternal oxide
#
    private void createWorld() {

        WorldCreator wc = new WorldCreator(name);
        wc.generator(new VoidGenerator());
        wc.generateStructures(false);
        wc.type(WorldType.FLAT);
        world = wc.createWorld();
    }```
#

works with zero changes to Bukkit.yml

regal scaffold
#

What the fk

#

I literally had that

#

Bukkit.createWorld(new WorldCreator("lobby").generator(new Generator()));

#

I had it like that

#

I guess you need the extra stuff?

eternal oxide
#

has to be type Flat or it will not use custom generators

regal scaffold
#

,,,

#

This is why you're a genius

#

And the rest of us consider using multiverse api

compact haven
#

lmao wtf

regal scaffold
#

Ty for saving us

compact haven
regal scaffold
#

@compact haven We would've never

#

ever

#

guessed that

eternal oxide
#

I believe it says somewhere in teh docs.

regal scaffold
#

Lets not look for it

#

ok?

eternal oxide
#

lol

regal scaffold
#

Appreciate the help

compact haven
#

all I suggested was checking multiverse source code to see how they did it xd

regal scaffold
#

Now we know

compact haven
#

Elgar when the server restarts, it'll know to use your plugin for generation without editing bukkit.yml?

regal scaffold
#

Multiverse has 301231223123132123 files

eternal oxide
compact haven
#

but how does bukkit know it was created by your plugin? it stores that?

tender shard
#

you always have to load the world yourself again everytime

eternal oxide
#

^

compact haven
#

mm that's true

tender shard
#

if you wanna change the default world's generator, you still need bukkit.yml

compact haven
#

alright that's the piece of the puzzle I wasnt thinking of

regal scaffold
#

Do you need to unload your world?

#

Or bukkit do that

tender shard
#

bukkit unlodas them when it shuts down

regal scaffold
#

Ok great, thanks

compact haven
#

btw tom

#

just so you know

#

I've been through the source code of Multiverse, VoidGen, and now checking Bukkit commits

#

just to try and figure out the solution to ur problem

regal scaffold
#

lmaooo

#

Man it was actually

#

so dumb

#

But we're not gonna check to see where it says it

compact haven
#

Elgar is just lying to you

regal scaffold
#

It does

#

Wait

compact haven
#

where

regal scaffold
#

How can I send you a link to a doc categoru

#
@NotNull
public WorldCreator generatorSettings​(@NotNull
String generatorSettings)
#

Fine print

#

Literally in the fine print

compact haven
#

that doesnt say that it requires WorldType.FLAT

#

merely "Currently only WorldType.FLAT uses these settings"

regal scaffold
#

Vague

compact haven
#

Not to mention, why is FLAT required when setting a custom generator

#

like you can have a non FLAT world with a custom generator xd

regal scaffold
#

Exactly

#

Bukkit things

eternal oxide
#

I got it from teh generator settings

#

it states there that only FLAT will use the settings

compact haven
#

yeah, but that's not for the generator

regal scaffold
#

I guess

eternal oxide
#

its teh same

regal scaffold
#

Itz and I just don't interpret the things the right way lol

eternal oxide
#

I believe I read it elsewhere too. probably in a tutorial

#

others came before and wrote their knowledge down for us peons 🙂

wet breach
#

ElgarL is correct

#

have to remember there was a time where the generator setting custom didn't exist

#

so, stuff got tossed with flat

#

and so it stayed

#

however like some things, information has been lost with time mainly because some of these things just weren't written down

compact haven
#

has to be an NMS thing then?

#

because as far as I see the generator isn't changed if the world type isnt flat

#

so DedicatedServer from NMS needs to be doing that bs

kind hatch
# compact haven ```sql CREATE TABLE "hugs" ( "interaction_id" INTEGER NOT NULL AUTOINCREM...

I have some questions about this. The biggest one being the foreign keys referencing the same table. I'm struggling to understand what this does and how it works. I understand how it works for multiple keys for different tables, but not the same table. Also, is this going to be the same layout as when we first started discussing this? Where it'll be a list of hugs of any type. Lastly, how am I to query this?

compact haven
#

why can't it reference the same table?

#

a foreign key is very simple

#

its a column in one table that refers to the primary key in another table

#

if I attempted to insert a fake UUID into hugs table that did not exist in player_data, it would not work

#

and that's because any entry for hugged or hugged_by must be in player_data table

#

as to querying

#

give examples

#

im not going to write every query that you could possibly imagine

#

in fact I already wrote 2 selects for you

#

albeit without the joins to player_data

#

in fact, do you even need player_data anymore, do you store anything there besides the statistics

#

@kind hatch

#

uh well actually

kind hatch
#

No, only statistics are stored there, but I still need the uuid from it for the preferences table.
As to the reply, I get that the foreign keys are good for integrity, I was just trying to understand how it worked.
As for the queries, how would I create a new entry?

compact haven
#

I might keep it anyways so you can foreign key preferences and interactions to one place

#

for data integrity

#

but note that any player that ever got hug will need entries for those tables

#

like they need preferences and they need a player_data entry

#

I guess they dont need preferences to be set, but they need a player_data entry

kind hatch
#

That gets created when they join. If it doesn't already exist.

compact haven
#

alright

#

foreign keys just are constraints to ensure random values dont exist in your data set

#

for creating a new entry, you'd have a query like

iron palm
#

is it possible to run a minecraft server while includes the plugin in the IDE?
I've seen some people doing this

wet breach
#

yes, you run it in the debugger

compact haven
#
INSERT INTO hugs (hugged_by, hugged_at, type)
VALUES (?, ?, ?);
PreparedStatement s = ...;
s.setString(1, huggedBy.getUniqueId().toString());
s.setTimestamp(2, new Timestamp(Instant.now().toEpochMilli()));
s.setString(3, "self");

now this is kind of unconventional, I believe, because of the select inside of values

#

btw remove the default I made for type, makes no sense to exist when hugged has no not null constraint

#

if there is a default, it should be "self", not "normal"

iron palm
wet breach
#

you would attach the server jar to it

iron palm
#

ohhh

#

right

#

thanks

compact haven
#

oh actually wait

#

forgot that we made interaction_id auto increment

#

and that interaction_id is the PK + unique

kind hatch
compact haven
#

refer edit, made changes & included JDBC code for you

#

in the initial sketch, the timestamp was legit just the integer 1

#

if you want it to be automatically

#

ehm let me update the sql

#
CREATE TABLE "hugs" (
    "interaction_id"    INTEGER NOT NULL AUTOINCREMENT UNIQUE,
    "hugged_by"    VARCHAR(36) NOT NULL,
    "hugged"    VARCHAR(36),
    "type"    TEXT DEFAULT "self",
    "hugged_at"    TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY("hugged_by") REFERENCES "player_data"("uuid"),
    PRIMARY KEY("interaction_id"),
    FOREIGN KEY("hugged") REFERENCES "player_data"("uuid")
);
#

@kind hatch

#

arent u enjoying this

kind hatch
#

You're having way too much fun. xD
Another question though. If there's 4 values, don't I need to supply them all? In your example, you only have 3.

compact haven
#

wdym four values

#

there's five

#

interaction_id is autoincrement, so no. hugged is default null, so no. type is default "self", so no. hugged_at is default current_timestamp, so no

#

out of all five, with that sql, you need to specify a single one

kind hatch
#

Well, apparently TEXT doesn't like it when I try and give it a default. Looking at the docs as well, it apparently doesn't even support default.

compact haven
kind hatch
compact haven
#

thats so odd

#

I never knew that

wet breach
#

you do know you can set defaults for columns?

compact haven
#

why would I set a default for a player id?

#

it's meant to be null for a type of "self"

wet breach
#

not player id

compact haven
#

which was meant to be the default

#

nothing is null besides hugged (which is a player id)

#

i mean look at the sql frostalf, you can see that I know what a default is, probably xd

wet breach
#

I didn't look at the sql syntax

#

just looked at what you said

compact haven
#

well do lol

wet breach
#

anyways I see it now

kind hatch
#

Welp, guess I'm using varchar(10) for the "type"

compact haven
#

no

#
CREATE TABLE `hugs` (
    `interaction_id`    INTEGER NOT NULL AUTOINCREMENT UNIQUE,
    `hugged_by`    VARCHAR(36) NOT NULL,
    `hugged`    VARCHAR(36),
    `type`    ENUM("normal", "self", "mass") DEFAULT "self",
    `hugged_at`    TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY(`hugged_by`) REFERENCES `player_data`(`uuid`),
    PRIMARY KEY(`interaction_id`),
    FOREIGN KEY(`hugged`) REFERENCES `player_data`(`uuid`)
);
kind hatch
#

Question about the CURRENT_TIMESTAMP. Does that grab the local time of the machine it's hosted on?

compact haven
#

TIMESTAMP is seconds after unix epoch

#

which is absolute, it doesn't matter what timezone you are in

wet breach
#

It doesn't record time zone dependent information

compact haven
#

wait a minute

#

ehm frostalf

#

where u just going off of what I said

#

because I couldve sworn TIMESTAMP was seconds/ms after unix epoch

#

(which makes no sense)

#

ugh yeah my knowledge is half baked

kind hatch
#

:3

compact haven
#

you have 2 options shadow

wet breach
#

but yeah the way the timestamp is structured in the DB isn't purely ms

compact haven
#

but loaded back using the time zone

wet breach
#

indeed

#

but how else is it supposed to know it is in a valid range?

regal scaffold
#

Hey! Delaying a task by 20L

#

is 20 ticks right?

wet breach
#

20 ticks = 1 second

compact haven
#

wdym valid range

wet breach
#

'1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC

#

that is the valid range for timestamps

#

which so happens to be the range for epoch time

compact haven
#

well that'd just be between 0 and 2^31

#

dk what umeant by valid range

#

anyways shadow

#

few options

wet breach
#

to be more precise

compact haven
#

thank you xd

#
  1. you can use a numeric data type which is just the current unix epoch after ms
#

or 2) you can use datetime

#

probably safer to use unix epoch, in my opinion

kind hatch
#

Yea, I'd rather just store System.currentTimeMillis().

#

I'm assuming that I'd use a BIGINT rather than a TIMESTAMP?

compact haven
#

yea

#

since youll be passing in a long on the jdbc side

wet breach
#

no

#

there is an easier way

compact haven
#

where

wet breach
#

timestamp(6)

#

and then in your query you would do FROM_UNIXTIME(col * 0.001)

compact haven
#

huh

#

explain this

wet breach
#

so you would update the column definition to be timestamp(6) which gives microsecond resolution

compact haven
#

but you're still using the host's timezone

#

which we aren't guaranteeing to be the same as the server

wet breach
#

time is derived from the mysql server which it gets from the host it is running on

compact haven
#

yes I know that

wet breach
#

ok, not sure why timezone would be a factor here? But that is what DateTime is for

compact haven
#

how does TIMESTAMP return to you

#

because it sure seems like it's backed by time zone in the mysql server

wet breach
#

well UTC is time zone independent

compact haven
#

its not time zone independent

#

you just need to add the offset

wet breach
#

correct, which mysql server will get from the host upon when you retrieve the data

compact haven
#

frost

#

are you reading what I'm saying lol

#

the timezone on the mysql server is not the same as the one in the minecraft server

#

at least we aren't guaranteeing as such

wet breach
#

but it doesn't need to be

compact haven
#

give a jdbc example to query and insert with TIMESTAMP

#

please

wet breach
#

well explain why the time zones need to be the same?

compact haven
#

because once it's loaded from storage, the mysql server is going to convert it to the hosts timezone

wet breach
#

you could always modify the query to account for time zone differences though

compact haven
#

but why do that when you can just store unix epoch

compact haven
#

or perhaps when the JDBC is concerned, it'll be already converted to Date on the right timezone, or use Instant, I have no idea

#

is why I'm asking you for an example

wet breach
#

SELECT ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000)

#

that converts to milliseconds 🙂

compact haven
#

thats great.. but that's 3 functions and a multiplication for the mysql server to do, when you could've just given it as milliseconds

#

like I find it hard to believe that it'll store TIMESTAMP more efficiently than BIGINT, or that there'll be a big difference at least

compact haven
wet breach
#

if you want a more fancy way

#

CAST(UNIX_TIMESTAMP(CURTIME(3)) * 1000 AS unsigned)

#

this will make it an integer type

compact haven
#

frost i feel like you havent read 40% of what I've been saying today lmao

undone spindle
#

does someone know how to make a fake block?

wet breach
#

instead of bigint

#

doubt you will need that large of a row

#

considering epoch time is still 32bits

compact haven
#

you could use a normal int if you just divide by /1000

#

and store seconds instead of ms

#

which is completely fine

wet breach
#

even if you stored milliseconds you only need normal int o.O

compact haven
#

no?

#

the current epoch time in ms is 1 674 377 855 111, the max int in java is 2^31-1 2 147 483 647

#

that's why System.currentTimeMillis() returns a long instead of an int

undone spindle
#

uhm so no?

compact haven
#

I know the principal

#

you'd send a ehm

#

block packet

#

let me get wiki,vg

wet breach
#

either way can store the seconds as an integer or go with bigint and store the milliseconds

#

I am curious though since year 2038 problem was brought up

#

I wonder what new date they will use for epoch

#

since obviously they are not going to just make it a 64bit value lol

compact haven
#

sadly ;c

wet breach
compact haven
#

lmao, u all good

kind hatch
#

That explains some things lol

compact haven
#

am not worriewd about the Year 2038 problem

#

since it doesnt affect Java

wet breach
#

well it is actually easy to fix

#

it is just a question of a unified fix though

compact haven
#

who cares if the Banks and Governments collapse because they are using 20 year old code

wet breach
#

in almost all applications/software it is just a matter of manually moving the calendar time yourself

compact haven
#

Discord fixed it by having their own "Discord Epoch"

#

oh well

wet breach
#

that is another way

compact haven
#

technically thats so they can make a snowflake since a discord epoch would significantly shorten the number of bits they needed to pack

undone spindle
#

but that is client side

#

right?

compact haven
#

thats what a fake block is

#

you tell th client a block exists, when it really doesnt

undone spindle
#

so you can't do that from server?

compact haven
#

maybe Bukkit supports such a ludicrous thing

#

I have no idea

undone spindle
#

exept using a crappy way like falling blocks

edgy goblet
#

use the player.sendBlockChange()

compact haven
#

there u go

undone spindle
#

thx

past wedge
#

Compiling error while there is literally no code in plugin

regal scaffold
#

When did

kind hatch
#

@compact haven
I want to make sure I understand the queries. Lets assume that I switch from TIMESTAMP to BIGINT and make it NOT NULL.
If I wanted to add a normal hug, the query would be INSERT INTO hugs(hugged, hugged_by, hugged_at, type) VALUES (?, ?, ?, ?)
If I wanted to add a self hug, the query would be INSERT INTO hugs(hugged_by, hugged_at, type) VALUES (?, ?, ?)
The mass hug would be the same as the self hug, but the type would obviously be different.

Am I understanding that correctly?

regal scaffold
#

player.sendTitle() get added

kind hatch
#

Quite a while back.

regal scaffold
#

Damn

#

I remember before you had to use NMS with IChatBaseComponent and so

compact haven
#

as longa s you use the latest sql I sent*

regal scaffold
#

6:10am time to bed. gn

wet breach
compact haven
#

^ you'll also need to handle any packets that the client sends back inquiring/interacting with that fake block

#

otherwise there'll be an error, probably

wet breach
#

you need to actually listen for chunk packet and modify it to include your fake block, and then you need to listen for some other update packets as well. Otherwise those packets will cause the client to realize the block is fake and remove it from the client lol

edgy goblet
wet breach
#

I didn't say modify chunks

compact haven
#

u only need to do that if it hasnt been loaded on the client yet

wet breach
#

you need to modify the chunk packet to include the fake block

edgy goblet
#

chunk packets*

compact haven
#

u dont send a whole chunk packet for 1 block update

#

or am I like going crazy

#

do you actually?

edgy goblet
#

no

wet breach
#

yes, because the server will send the chunk packet without the fake block because server isn't aware of the fake block

compact haven
#

they'll do that when the client loads it, the assumption is that the fake block is already in a chunk loaded by the client

#

it'll send that chunk packet again when they attempt to load it again

wet breach
#

or when an update is requested or something causes the chunk to update

kind hatch
compact haven
#

hm?

kind hatch
#

Wait

compact haven
#

yes you put it back