#help-development
1 messages · Page 324 of 1
oh its not fucking Keyed
declaration: package: org.bukkit.potion, class: PotionEffectType
thats so dumb
1.17
thank you Coll
Shh
epic upgrade ur version
but support
version support is for the losers
i think im a loser then
Exactly
Coll can u link ur PR
Go to #help-server
so he can implement it
Someone wants a 1.0 plugin
i saw that
i saw that too lmfao
it is
not in his version
betteritemconfig depends on 1.17.1
for whatever god forbidden reason
support
Does anyone still use 1.17
people are weird
josh does minetweaks not work on 1.17.1 or higher
Counterpoint, don't support 1.8+

I always support "version it was originally released for"+
and sometimes, not anymore
lol
I support "whatever API I want to use, that's the minimum"
I dropped minetweaks support on 1.17
when did it get keyed
1.18
smh
This allowed me to get rid of all the NMS so worth
in 1.18 it was keyed
so im saying FUCK YOU to all those 1.17ers
also i get to upgrade to java 17
to fuck them even more
isnt 1.18 java 17 anyway? 😄
yeah
GH packages are stupid
it says "Choose a registry" but you cannot click on anything there
oh
i have the other 2 1.18 versions
the "Choose a registry" makes no sense, it seems like it's a request to click on any of these boxes
why am i watching a talking racoon
You tell us
but thats ok if u can figure it out
avengers
way too blu
yeah, and when using the Darcula theme, it's basically invisible
this just hurts my eyes
mine too
https://www.formdev.com/flatlaf/theme-editor @tender shard does this help
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
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
Yeah I was guessing ty !
If im not wrong everything in miencraft are entity
not sure what he means either.
tileentities are. Somewhat
he's probably thinking entity as in you would when saying "The entity controlling the vehicles in Michigan is the Michigan DMV"
"entity refers to any living or non-living object that is rendered in the game world"
in Minecraft an entity is just the mobs and animals
and tileentities, somewhat
not blocks
There is such things called Block Entities
am very confused here
I said this
and so did Jan
basically everything in mc, are entities
no
blocks are only entities when they store extra data
and they arent fully entities either
like the block still exists
or when they are them special blocks
that are not like actual blocks
wdym
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
also stores the offset of block or blocks that should be moved or broken as well
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
but yeah not everything are entities
Pistons are not a tile entity
but at that point I'm getting into territory I'm not confident in
Tile entities are for anything that stores dynamic data
which pistons do
a piston is in Bedrock and Education
yes
Which is good because if it was you couldn’t move it with pistons
Because Mojang still hasn’t given us that on java
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
yes they are? o.O
he means pistons are not tile entities in java lol
oh
yeah this has to be or
you're inversing the conditions
right the piston base is not a tile entity
thanks for some reason that didn't click
I kept thinking about it.
smh
np lol, we all have been there
some more then others
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
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.
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
To be clear, this should work per player? Meaning that each player has their own list of UUIDs.
Def something is not making sense
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
^^
what's the error?
Saying that it cannot access to CommandHandler (its an interface)
let's see commandhandler
that should work
see what intellij suggests u do
Nothing tho, just saying the error i sent on top
💀
First time something like this happen
Maybe IJ is bug
invalidate caches and restart
I guess I'm still a little confused about this. At least I'm having trouble visualizing it. How exactly am I to store the list?
right
you'd have a separate table
and each row would be an item in the list
so like player_interactions would be your table
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?
no primary key
it stores like
player1 | player2
player1 | player3
player1 | player4
player2 | player1
there's no point in that though right?
it shows up as projectile
but iirc a primary key will help the database engine do its job
if that were the case, won't a primary key be generated for all tables without 1?
internally atleast
perhaps you can create a composite primary key?
in fact that's probably the best option
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
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
Let me figure out how to explain this.
foreign keys are only handy if you are linking two tables together. Primary key is generally recommended to use with Foreign key
you can use UUID's as primary keys
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)
);
if this is a single table, I wouldn't even bother with foreign keys
Btw ur fork didn't account for entity storage / accessing entity mcas
what are we even making btw with DB?
a List<UUID> for "player interactions"
Nop, issue still persist
But as a point holy crap it puts worldedit to shame
Phone spelling haha
@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.
you need 3 tables for this to work
users table, given hugs table, received table
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)
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
obviously you don't know DB design
I must admit I've only ever parsed data from a db directly.
can it just be a hug or can it be anything else @kind hatch
In this case, just a hug.
they are probably wanting to record who they got a hug from
if that is the case it is still 3 tables
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)
);
you mean in the entities folder?
why wouldnt that work tho frost
all the third table is, is just 2 keys
I don't mind flexibility or extensibility. Maybe in the future I'd also want to keep a timestamp as well.
Yup. To account for entities with storage
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
the third table is just basically the keys that reference both tables
frostalf they dont need an interactions table like u have
So, I think I already have the first table. Maybe. My Schema is as follows. The users table in your example might just be my player_data table.
its just hugs, and even if it wasnt they dont need a description of a hug
maybe not, but it will let them expand in the future
it is called database normalization btw
here is a link for it
sure but those should be hardcoded, because each type would need to be handled in code
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...
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
users is just player_data
and player_id is just uuid (in my create table statement)
sure but why a random primary key which doesnt do anything 
Hey!
in a many to many like this, composite key better imo
Do you know what cause this issue ""Cannot acess dev.alex.net.command.core.CommandHandler" but everything is okay, i already invalidated cache
autoincrement isn't random
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
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;
}
well it is visible if you fetch metadata
lol
but yes you could use a singular table, But I would recommend at minimum at least 2
halp plz
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
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
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
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
Not necessarily.
alright, as long as that's the case
I'd probably make separate tables for ones given vs ones received.
bro
Just to separate them
I wouldn't do that, creating too many tables can be just as bad as not creating enough tables
its a fine balance
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;
}
Well, I'm new to this, so bear with me
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=?
given and received hugs relate to each other, therefore they should be in the same table
if a hug is given to someone, it's received by someone else. no need t have two tables
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
yes
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
but a JOIN is utilizing DB features
I'm still trying to figure out how the 3 tables work together. I don't quite get this many to many relationship.
you can do lightning fast joins if properly written
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
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
Yea, that also confused me a little.
ahem but looking at your wireframe again shadow
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.
Yes, there are different types.
mass being?
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.
okay this actually requires a different database design then
That's how I store all the data in yaml.
All of that needs to get turned into MySQL
you would create a function
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
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
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
does MySQL support functions though
ik that Postgre does, but never used them there either
mysql supports functions and stored procedures
that's what I meant
stored procedures
are you talking about something different? 
@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
Uhhh. I don't think I actually ever made a way for that data to be saved. lmao
I guess I never got that far. This is still a work in progress after all. I probably would have done something like this:
# <UUID> <TYPE> <TIMESTAMP>
03687ca0-30cf-4c3c-8c1d-3b2dd75c3ff0:MASS:1662979648432
btw, since you were wanting to know about how to store a list
MySQL has set
and Enum
so you can if you really wanted to store an entire list
O.o
I wouldnt use that for this though
because your list is like
some aggregate of data
Lmao, I would have used this if I had know about it.
but that MASS means nothing
like u didnt store the other people who got hugged
am confused
also for timestamps you don't use text. MySQL has Date and timestamp types
I was actually using SQLite data browser to make that last statement
and it doesnt have that type
ah
thats my bad, forgot to change
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.
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.
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
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
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)
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
no I get that part
this calculation is what I meant
so you would multiply all the numbers from 1-50 and then square it
Factorials?
I mean 25
oh
I understand how to calculate the permutations lol
well it would be hard to calculate size
because of how MySQL stores stuff and optimizes
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
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
its not impossible, think there is mysql commands or you could look in the schema info or even quite possibly it might be stored in the metadata of the table of how much space it is using
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.
wait actually?
there was something I was ttempting to do with mysql and I was told it was impossible
would have to go look, not really something I have ever really needed to look at though
perhaps it wasnt that
but I think it was 
well
@kind hatch you'll be getting rid of your integer statistics columns anyways
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;
those serve no purpose when you can just use a count
I was right it would be in the schema 🙂
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
What? How would I get the total numbers then?
you could just use a mysql function to do that
that would literally count for you
Just the fact that one occurred.
alright
I don't have a reason otherwise.
Or at least can't think of a purpose to store the users.
but then you wouldnt know if they gave a hug to UUID5 yet
if they mass hugged and UUID5 was one of them
Uhh, I'm not treating mass hug interactions as unique interactions. It's a separate thing.
Well, part of the problem here is that I've been working around the YAML implementation for so long that I've been adapting it to work for that. I hadn't even considered this as legit functionality.
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")
);
updated the query above. The first query will get the size of all databases combined, the second one is all tables in a particular database, and the third will get the size of a particular table in a database
nothing like having two somewhat decent DBA's giving you advice lmao
and essentially teaching you how powerful DB's can really be 😛
I'm in over my head. 💀
you're fine
Lmao, but I appreciate it regardless.
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
this will merely store a null hugged entry with a type of "mass" if it was mass, so you know that it happened, but not who got hugged
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
Does that mean that there's no way to determine unique interactions? Or am I misunderstanding?
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
lol
itzdlg has spent the past hour here instead of doing their plugin
that would be the easier option unless you want to start setting up counters
this project has me using mongo
and I'm not using mongo properly
I can nearly guarantee that
don't recommend setting up all kinds of counters
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
@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
uhm
I want to cancel chunk creation, pretty much
oh well
I guess because of isNewChunk
it'll still generate
just wont load
okay literally what I just said, yeah
So what can I do
will need to wait for someone else to answer that, havent attempted this myself
best way would be to create a void world and then use your generator to create what you want
generated what, void?
@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
if you did it correctly, it should only generate void chunks
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?
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
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
is it not already?
No because it's generating lol
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.
generating void or normal terrain
?
That's how bukkit will load a world right? Wanna make sure
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();
}
Have that
I thought so
But
That means
I can't generate worlds using code
Cause I gotta add them there...
you can, but then when the world goes to generate more, it no longer knows your plugin created it
Gonna try Bukkit.createWorld(new WorldCreator("lobby").generator(new Generator())); first
like one the server restarts and you go back into that world
Fair
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
nono
because ik you dont need to do that for a fact
well @kind hatch there's always ALTER TABLE statement
And just leaving the spawn ones
but depending on what u need to add, you might need a redesign. idk mate what u want to add
8 more mins.lol
nothing is future proof
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.
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
that's easy
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
ty epic
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
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.
knowing if u hugged them yet xd
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.
Lmao, now that would be an interesting feature.
make sure that uuid is has foreign key reference to player_data(uuid)
the preferences(uuid) one
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
thats me
who said to use multiverse
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
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?
4MB upload restrictions be like
you can
it's 6.2 mb 😦
just make the external link to your nexus jar
@compact haven
Open that
Decomp
How cringe
Why does this sound to me like it might not be a good idea? Or am just completely off base?
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
there is no obfuscation
well there might be in the jar
but I mean it's literally on github xd
oh
that's kind of funny
and you still need to do this step

you made me waste all this time and it doesnt have any relation to your problem
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
What do you use to do that
allatori
Pretty cool
and he wrote his own string obfuscator
Or, the more appropriate question is should I remove them?
because he likes annoying with people like me
yes lol
Pretty cool but cringe lol
it doesnt matter to me
if it can be determined from one column, my guess is based on true/false, just do that
How do we get past bukkit.yml world generators incode only
there's no benefit in 2 extra columns when it's related to one
especially if it can create data integrity errors
wdym?
Wanna create a world with a custom generator
he wants to make it so he doesnt need to add his plugin as a generator in bukkit.yml
^
Bukkit.createWorld(new WorldCreator("lobby").generator(new Generator()));
Does not do the trick
ah okay well let's see where bukkit stores this list in the first place
lol
how else would you do it?
wtf really
I cant imagine that multiverse core does anything else
That's the only way?
yes really
(It was a rhetorical question alex because I told him he might have to do the same thing)
the only way you could have custom world generation without using a plugin would be to use a datapack
I've never had to add a generator to bukkit
Not what I said
does he want his generator tyo be used by default worlds or something?
oh
I have a generator and it works elgarl
But it works only if I add the stuff in bukkit.yml
definately not needed in Bukkit.yml
How can I use Bukkit.createWorld(new WorldCreator("lobby")); without having to edit the bukkit.yml
It is or it doesn't work
let me load my IDE
Literally default generation otherwise
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
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?
has to be type Flat or it will not use custom generators
,,,
This is why you're a genius
And the rest of us consider using multiverse api
lmao wtf
Ty for saving us
never considered this
I believe it says somewhere in teh docs.
lol
Appreciate the help
all I suggested was checking multiverse source code to see how they did it xd
Now we know
Elgar when the server restarts, it'll know to use your plugin for generation without editing bukkit.yml?
Multiverse has 301231223123132123 files
Your world is loaded by your plugin so bukkit doesn;t need to know anything
but how does bukkit know it was created by your plugin? it stores that?
you always have to load the world yourself again everytime
^
mm that's true
if you wanna change the default world's generator, you still need bukkit.yml
alright that's the piece of the puzzle I wasnt thinking of
bukkit unlodas them when it shuts down
Ok great, thanks
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

lmaooo
Man it was actually
so dumb
But we're not gonna check to see where it says it
How can I send you a link to a doc categoru
declaration: package: org.bukkit, class: WorldCreator
@NotNull
public WorldCreator generatorSettings​(@NotNull
String generatorSettings)
Fine print
Literally in the fine print
that doesnt say that it requires WorldType.FLAT
merely "Currently only WorldType.FLAT uses these settings"
Vague
that message means nothing for https://helpch.at/docs/1.16.4/org/bukkit/WorldCreator.html#generator(org.bukkit.generator.ChunkGenerator)
declaration: package: org.bukkit, class: WorldCreator
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
I got it from teh generator settings
it states there that only FLAT will use the settings
yeah, but that's not for the generator
I guess
its teh same
Itz and I just don't interpret the things the right way lol
I believe I read it elsewhere too. probably in a tutorial
others came before and wrote their knowledge down for us peons 🙂
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
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
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?
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
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?
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
That gets created when they join. If it doesn't already exist.
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
is it possible to run a minecraft server while includes the plugin in the IDE?
I've seen some people doing this
yes, you run it in the debugger
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"
could you explain it more like what should i run in the debugger
you would attach the server jar to it
oh actually wait
forgot that we made interaction_id auto increment
and that interaction_id is the PK + unique
Wouldn't I also need to supply a timestamp? Or does the database do that automatically?
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
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.
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
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.

instead of relying on nulls
you do know you can set defaults for columns?
why would I set a default for a player id?
it's meant to be null for a type of "self"
not player id
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
well do lol
anyways I see it now
Welp, guess I'm using varchar(10) for the "type"
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`)
);
Question about the CURRENT_TIMESTAMP. Does that grab the local time of the machine it's hosted on?
TIMESTAMP is seconds after unix epoch
which is absolute, it doesn't matter what timezone you are in
in retrospec it would use the time the server has synced. So in a way it does use the time of the host but only to determine the milliseconds to put in
It doesn't record time zone dependent information
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
but according to https://dev.mysql.com/doc/refman/8.0/en/datetime.html it isnt
(which makes no sense)
ugh yeah my knowledge is half baked
:3
you have 2 options shadow
internally it is backed by the ms
but yeah the way the timestamp is structured in the DB isn't purely ms
according to https://dev.mysql.com/doc/refman/8.0/en/datetime.html it's converted to UTC for storage
but loaded back using the time zone
20 ticks = 1 second
wdym valid range
'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
well that'd just be between 0 and 2^31
dk what umeant by valid range
anyways shadow
few options
thank you xd
- 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
Yea, I'd rather just store System.currentTimeMillis().
I'm assuming that I'd use a BIGINT rather than a TIMESTAMP?
where
so you would update the column definition to be timestamp(6) which gives microsecond resolution
but you're still using the host's timezone
which we aren't guaranteeing to be the same as the server
time is derived from the mysql server which it gets from the host it is running on
yes I know that
ok, not sure why timezone would be a factor here? But that is what DateTime is for
how does TIMESTAMP return to you
because it sure seems like it's backed by time zone in the mysql server
well UTC is time zone independent
correct, which mysql server will get from the host upon when you retrieve the data
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
but it doesn't need to be
well explain why the time zones need to be the same?
because once it's loaded from storage, the mysql server is going to convert it to the hosts timezone
you could always modify the query to account for time zone differences though
but why do that when you can just store unix epoch
like sure when the Java code is written you could convert it back to the MC host's timezone, but that's as much hassle as another function in every sql query
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
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
I will note that this argument doesnt apply to everything, like you use mysql to count instead of storing statistics, but in this case it should apply just fine
if you want a more fancy way
CAST(UNIX_TIMESTAMP(CURTIME(3)) * 1000 AS unsigned)
this will make it an integer type
frost i feel like you havent read 40% of what I've been saying today lmao
does someone know how to make a fake block?
well this would let them just use a normal int
instead of bigint
doubt you will need that large of a row
considering epoch time is still 32bits
you could use a normal int if you just divide by /1000
and store seconds instead of ms
which is completely fine
even if you stored milliseconds you only need normal int o.O
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
uhm so no?
ah right
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
sadly ;c
keep in mind I have been up for like almost 24 hours XD
lmao, u all good
That explains some things lol
who cares if the Banks and Governments collapse because they are using 20 year old code
in almost all applications/software it is just a matter of manually moving the calendar time yourself
that is another way
technically thats so they can make a snowflake since a discord epoch would significantly shorten the number of bits they needed to pack
thats what a fake block is
you tell th client a block exists, when it really doesnt
so you can't do that from server?
exept using a crappy way like falling blocks
use the player.sendBlockChange()
there u go
Compiling error while there is literally no code in plugin
When did
@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?
player.sendTitle() get added
Quite a while back.
can remove type and the third ? for a self hug
as longa s you use the latest sql I sent*
6:10am time to bed. gn
you need more then just block packet
^ 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
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
you dont need to modify chunks, u can do player.sendBlockChange()
I didn't say modify chunks
u only need to do that if it hasnt been loaded on the client yet
you need to modify the chunk packet to include the fake block
chunk packets*
u dont send a whole chunk packet for 1 block update
or am I like going crazy
do you actually?
no
yes, because the server will send the chunk packet without the fake block because server isn't aware of the fake block
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
or when an update is requested or something causes the chunk to update
If I remove type, how does the enum get set for normal or mass hugs? It'll just default to self.
hm?
Wait
yes you put it back
