#help-development

1 messages · Page 678 of 1

wet breach
#

/data get entity UUID

tender shard
#

or just use selectors

wet breach
#

can't use name if they are offline because MC doesn't store player data by name but by UUID

#

the name is only relevant if they are online

smoky oak
rotund ravine
#

It’s offline right?

smoky oak
#

yea

rotund ravine
#

Where did you get that uuid

smoky oak
#

from the join message

rotund ravine
#

Ah

smoky oak
#

'uuid of player is'

#

hm

wet breach
#

think you need to add entity in there?

smoky oak
#

data get entity uuid just prints out 'entity not found'

wet breach
#

hence it saying incorrect argument

#

hmmm

smoky oak
#

do you know if i can fake the command using the offlinePlayer -> player copy of the player?

#

I'm interested in the data printout @wet breach

rotund ravine
#

What

smoky oak
#

just for offline

rotund ravine
#

Can’t u use @p?

smoky oak
#

offline

wet breach
smoky oak
#

says contents:{}

#

which imma doubt

rotund ravine
#

An offlineplay is still a player yes?

smoky oak
#

dont think so

wet breach
#

via the api yes

rotund ravine
#

Then think again

wet breach
#

native mc has no concept of an offline player

smoky oak
#

the storage thing prints out {} for everything i give it btw

#

so i dont think thats linked to uuid

wet breach
#

interesting

#

well, if you want you could obtain most of that info you want via the api

#

using OfflinePlayer or reading the player dat file in question

#

player dat files are named by uuid

smoky oak
#

yea true

#

do they contain the name of their last join btw?

wet breach
#

yes

rotund ravine
#

Well

#

If the name changes the uuid changes on offline

opal carbon
#

thats how that "_ joined the game (previously _)" works if uve seen that before

wet breach
#

the name they last used is stored in the dat file until they join again and if their name is different it will upate upon a world save or when they disconnect

opal carbon
#

well yeah

wet breach
#

so, that means as long as they are still offline you have at minimum last known name

opal carbon
#

but offline mode is a special case because its wierd as hell

smoky oak
#

uuid doesnt change if the name does

#

its how we uniquely identify after all

rotund ravine
#

It does on offline

smoky oak
#

no it doesnt

rotund ravine
#

Are you fumb

wet breach
#

they are not doing anything in offline mode

opal carbon
#

offline mode it does

rotund ravine
#

Ohhh

wet breach
#

rather offline players

rotund ravine
#

Thought we were talking about offlinemode

#

My bdd

opal carbon
#

no we arent

#

offline mode is dumb and a pain to deal with ngl

rotund ravine
#

Yes

#

Never touching that

wet breach
#

I just don't support or implement offline mode in anything 🙂

opal carbon
#

exactly

rotund ravine
#

All i know is that the uuid is like UUID.fromString(“OfflinePlayer:” + name) or smth on offlinemode

opal carbon
#

if the plugin breaks because of offline mode fucking with shit oh well

smoky oak
#

all I know is that it eats your inventory

rotund ravine
#

I wonder what’s the changes of a player having the same uuid online and offline

wet breach
wet breach
#

offline UUID uses version 3 of the UUID where as Mojang uses version 4 for online mode

smoky oak
#

isnt that still the same format

wet breach
#

no

smoky oak
#

im pretty sure only the generation is different

#

yea its different generators

rotund ravine
wet breach
#

its not, it has a big difference in how the UUID is calculated

smoky oak
wet breach
#

so it isn't possible for an online player to have the same UUID if they are in offline mode. This was done purposefully to avoid collisions in the event the server was put in offline mode and had online mode players

smoky oak
#

statistically unlikely != impossible

slender elbow
#

it is literally impossible

wet breach
#

^

slender elbow
#

like actually, literally impossible, not mathematically unlikely, mathematically impossible

rotund ravine
#

Well that seems false

#

Just cause there is an infinitely small chance for it to happen doesn’t mean it can’t

slender elbow
#

no

#

literally impossible

#

not unlikely

smoky oak
#

v4 UUIDs, which contain 122 bits of randomness is very much equal an 1/(2^122) chance to have the same uuid online and offline

#

thats what RANDOM means

wet breach
#

V4 incorporates a time element

smoky oak
#

thats v1 not v4?

#

do they both have that?

wet breach
#

V3 does not have this

rotund ravine
#

Guess you just gotta be blessed by the time god too then

slender elbow
#

even then, the version of a UUID is determined by a specific byte, if it's version 4, it is set 4, if it's version 3, that byte is set to 3, i think we can agree that 3 cannot collide with 4

#

they literally cannot collide when the version byte is always different between the two

rotund ravine
#

I see now that makes sende

#

Sense

slender elbow
#

not unlikely, but impossible

wet breach
#

there is that, other then that both calaculate UUID's significantly differently

slender elbow
#

not even a byte, but half a byte lol

wet breach
#

so a nibble

tender shard
slender elbow
#

funny word

smoky oak
chilly hearth
#

Yo alec

#

Alex*

#

I was just stuck how to get an speicifx player head in itemstack

#

Or if there is any other way

wet breach
#

look at the item meta

chilly hearth
#

By specific I mean there texture

tender shard
#

basically you just do NbtIo.readCompressed

chilly hearth
#

Like an iron golem head

tender shard
#

or do you mean base64 textures?

chilly hearth
#

Yes

tender shard
#

Spigot 1.18.1 added the new PlayerProfiles class, which finally allows us to use custom heads without needing any reflection! You can obtain them as normal items, or actually place them down into the world. I’ll show you how both works: Creating a new PlayerProfile First, we gotta create a new PlayerProfile object. To do so,...

chilly hearth
#

Ty

wet breach
#

well a good portion of us have probably done many things most come here for help with 😛

tender shard
smoky oak
#

isnt that just

#

uuid -> offline player -> player -> PDC

tender shard
torn shuttle
#

chip away at making plugins for long enough and you'll eventually have done everything

tender shard
smoky oak
#

im pretty sure you can cast it

tender shard
#

sure, you can cast null to anything

carmine mica
#

🤦‍♂️

smoky oak
#

i meant

tender shard
#

trust me, you cannot get a Player object from an offline player just by casting it

smoky oak
#

im fairly certain Player player = (Player) getOfflinePlayer(uuid) worked in a plugin i did like 2 years ago

tender shard
#

no

carmine mica
#

It works for online players

tender shard
#

yes

carmine mica
#

But not for offline players

tender shard
#

if it'd actually work for offline players, there'd be no point in having an OfflinePlayer interface in the first place

wet breach
#

its doable, just a pain to do

tender shard
#
public Player getOnlinePlayer(OfflinePlayer offlinePlayer) {
  while(!(offlinePlayer instanceof Player)) {
    offlinePlayer = offlinePlayer.getPlayer();
  }
  return offlinePlayer;
}

^^ very useful

lilac dagger
#

i got it

#

😄

#

there's some optimization that triggered this call

torn shuttle
#

I don't even know why I'm making a python interface to poke at chatgpt

wet breach
torn shuttle
#

this is not what I should be doing

#

has anyone made a chatgpt plugin yet

lilac dagger
#

nah

tender shard
torn shuttle
#

mhyeah makes sense

#

shame api calls are so expensive

#

this is me not even using it, just poking the api to test responses as I make software around it

pulsar parcel
#

I'm trying to use nms to make player spectate entity, but when I use this code I get an error for playerConnection. Am I doing it right?

smoky oak
#

im pretty sure playerConnection is supposed to be a getter

pulsar parcel
wet breach
#

just make sure to set the player to spectator mode first before using that method

tender shard
#

?switchmappings

wet breach
#

or just didn't find it

tender shard
#

oh yeah

#

why is helpch.at missing javadocs for 1.19.4 and 1.20 🥲

lilac dagger
#

alex, do you have support for multi modules in aliatory?

#

like support for classes per module?

tender shard
#

aliatory?

#

classes per module?

#

I really have no clue what you're asking about tbh lol

twilit basalt
#

Hey, I have a plugin there which is extended by another class, in core plugin I load this plugin but it is not instance of that another class, any ideas how to fix this? It worked though

flint coyote
#

I don't understand your problem

twilit basalt
#

What you don't understand? I load plugin (addon) with my core plugin, but it is not instance of another class which extends it

grizzled oasis
#

I know support for older versions is not given but something to ask about Durability, with damage i can make a texture linked with an item if i use a pickaxe, damage will not damage and show up on the item, or its separate? im talking about 1.12 so custom data model do not exist (found out yes)

flint coyote
#

So you have Class B extends A

and when you do
if(bInstance instanceof A) it returns false?

grizzled oasis
twilit basalt
lilac dagger
twilit basalt
#

but it is not instance of AbstractAddon

grizzled oasis
twilit basalt
#

seems like something bit different

wet breach
twilit basalt
#

I have these addons in pluginName/addons/

vast raven
#

Hi, does anyone know how to get the ICrafting instance of a player starting from the EntityPlayer? In 1.16_R3 the EntityPlayer class implements the ICrafting interface, but in 1.17_R2 it does not.

grizzled oasis
wet breach
#

damage value is just another way to state extra data

#

unless you are not talking about damage values

#

and instead actual damage

grizzled oasis
wet breach
#

ah then I think you are talking about damage value then

#

reason we call it damage value for those interested is because the item doesn't change and looks like the rest but it isn't treated as being different as if its damaged 😉

#

or it slightly changes

#

and thus now damaged lol

#

but its just a fancy way of saying extra data values

grizzled oasis
#

Cit (Optifine system) works inside server uses names (i know the client doesn't know nbt from other users)

vast raven
trim lake
#

Hi, I just need to change inventory title in my plugin. But problem is there is not method for that in 1.18.2 (I think). How can I do that properly? Im just making kit plugin and after every click (probably) I would like to check if some items in inventory are same as items in kit. If not change title. But something is canceling InventoryClickEvent for me every time even if I set setCancelled to false.
Code:

public void handleMenu(InventoryClickEvent e) {
        ItemStack item = e.getCurrentItem();
        Player p = (Player) e.getWhoClicked();
        int slots = getRows()*9;
        int slot = e.getRawSlot();
        if (slot > 8 && slot < slots-9) {
            p.sendMessage("not canceled");
            e.setCancelled(false);
        }
        if (!e.getView().getTopInventory().equals(e.getClickedInventory())) {
            p.sendMessage("not canceled");
            e.setCancelled(false);
        }
        saveKitItems();
        inv.clear();
        open();

public void open() {
        inv = Bukkit.createInventory(this, getRows()*9, ChatUtils.format(getTitle()));
        setDefaultItems();
        setMenuItems();
        owner.openInventory(inv);
    }
#

Or is there anothrey way where I dont need to open another inventory for player?

quiet ice
#

I think you can change the title via the respective view?

simple schooner
#

One more question, how would I get the 3x3x3 area surrounding the minion?

trim lake
simple schooner
#

I may be dumb

#

Do I have to use a for loop or somethiny?

knotty shell
#

Can anyone explain what 'display' is, in entity-tracking-range, for spigot.yml

rare rover
tender shard
#

for int x = -1; x <= block.getX() + 1, x++

#

same for y and z

ripe moat
#

how do i add subtitles to a player and only display it to certain players?

tender shard
simple schooner
#

I just dont know how to implement it lol

#

Im so bad at math

maiden geode
#

Hello,
I've ran into one issue with my world creation method, which is simply creating a void world for islands to be created. The world is used for different tasks and it always shows "null", I can't teleport to the world as well, it just throws an error (null, couldn't find the world). Will appreciate any advices.

private fun makeWorld() {
        val wc = WorldCreator("world_island")
        wc.type(WorldType.FLAT)
        wc.generateStructures(false)
        wc.generator(main.generator)
        wc.environment(World.Environment.NORMAL)
        wc.createWorld()
    }

(WorldCreator wc = [...]) for Java users

tender shard
# simple schooner I was right

sth like this shuold do. in this case, radius would have to be 1 for 3x3x3 (because the center block is always included, so it goes +/- 1 into each direction which results in 3)

    public static List<Block> getBlocksInRadius(Block origin, int radius) {
        List<Block> list = new ArrayList<>():
        int startX = origin.getX();
        int startY = origin.getY();
        int startZ = origin.getZ();
        
        for(int x = startX - radius; x <= startX + radius; x++) {
            for(int y = startY - radius; y <= startY + radius; y++) {
                for(int z = startZ - radius; z <= startZ + radius; z++) {
                    list.add(origin.getWorld().getBlockAt(x,y,z));
                }
            }
        }
        
        return list;
    }
wet breach
maiden geode
wet breach
#

you only have to interate half as the other half is just the inverse

#

and since its an equal square only one iteration is needed

#

technically a cube, but regardless still applies the same lol

tender shard
#

are you using paper?

#

try it on spigot. createWorld() should be blocking IIRC

maiden geode
#

Yes, I'm programming in spigot but using paper as the engine

tender shard
#

try to run it on spigot

tender shard
#

maybe on paper the WorldCreator does async stuff or sth so the world isn't "finished" when you try to use it?

trim lake
maiden geode
#

I've tried restarting the server, the world is indeed being created but that's all about it

#
[17:02:25] [Server thread/WARN]: java.lang.NullPointerException: Cannot invoke "org.bukkit.World.getBlockAt(org.bukkit.Location)" because the return value of "org.bukkit.Location.getWorld()" is null
#

The same thing

tender shard
#

you have to call your "create" method again after a restart

#

I don't know kotlin syntax but maybe add sth like this in your create method, but before the return statement:

Bukkit.getScheduler().runTaskTimer(myPlugin, new Consumer<BukkitTask>() {
public void accept(BukkitTask task) {
  if(Bukkit.getWorld(worldName) == null) {
    System.out.println("World is not laoded yet... waiting...");
  } else {
    System.out.println("World is now loaded!");
    task.cancel();
  }
}, 1, 1);
#

then see if it actually says "World is now loaded" some time

tacit drift
#

maybe start the plugin before worlds loaded?

#

wasn't it an option in plugin.yml? (haven't followed the whole issue)

maiden geode
tender shard
maiden geode
#

It used to work... Used to...

wet breach
tender shard
#

it was added very recently

wet breach
#

it was just updated in what it was called

#

but its been there

tender shard
#

it was added in may

wet breach
#

it used to be setName

tender shard
#

bukkit #849 cb #1176

wet breach
#

as I said, it used to be SetName

tender shard
#

no

wet breach
#

ok, well go look at old apis

tender shard
#

there's no setName

#

IIRC Inventory#setName() or sth existed but that was back in 1.8

wet breach
#

unless it used to be in inventory holder

#

and just moved to the view

#

instead

#

either way, setting the name of an inventory has always been a thing

#

just where in the API was changed

tender shard
#

it was definitely not possible in 1.16 and 1.19 without NMS

wet breach
#

to set the name of the inventory?

tender shard
#

to change the name of an already existing inventory

#

e.g. for animated GUI titles or shit

wet breach
#

oh, yeah to change an existing inventories name that is true

maiden geode
#

@tender shard I just sent a string to the player with the world name and it works, so I think the issue is with generating the world for some reason... But why .-. It used to work perfectly fine

trim lake
#

I just want make notification in inventory title to dont forget to save the changed kit, if its changed.

#

Need to figurate out some other way of reminder. Prorably with some item. Looks like in title is not possible

tender shard
#

and that future only completes once the world is "done"

wet breach
trim lake
wet breach
#

well chat is visible while in the inventory

trim lake
#

My goal was this

wet breach
#

well you can update the title of an existing inventory via NMS

trim lake
#

I dont think someone will read it chat while chaning the kit

wet breach
#

not overly difficult to do it

tender shard
#
    public static CompletableFuture<World> createWorld(WorldCreator creator) {
        return CompletableFuture.supplyAsync(() -> {
            World myWorld = creator.createWorld();
            while (Bukkit.getWorld(myWorld.getName()) == null) {
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            return myWorld;
        });
    }

this would probably work but it's pretty shit

wet breach
#

you could use buttons

#

also to continue with your idea on closing

#

you could make a notification in chat with buttons if they wanted to save it

trim lake
wet breach
#

no

#

you can make a button in the chat

trim lake
#

Oh you mean in chat

wet breach
#

with 2 options

#

yes or no

lilac dagger
#

can the metrics class be obfuscated?

wet breach
#

maybe? but why would you want that to be obfuscated?

tender shard
trim lake
#

There is no point to make no option probably, he can just ingore that message. Just You didnt save your kit. Click here to save! whould be probably enought

lilac dagger
tender shard
#

you can obfsucate any class you like

wet breach
#

idk why you are so obsessed with saving bytes

tender shard
#

yeah that makes little sense

#

nobody cares if a plugin is 347kb or 248

wet breach
#

not just that, but literally no one is using a 56k modem either

#

or connection

#

well none that are playing MC

tender shard
#

maybe they are making a plugin that's being used on the ISS

#

they have slow internet

wet breach
#

they actually have decent speed on the ISS

chrome beacon
#

People like to think larger file size means worse server performance

tender shard
#

last time I checked they used remote desktop and couldnt actually access internet directly

tender shard
wet breach
tender shard
#

hm idk I read something on quora and IIRC an actual former ISS dude said the internet is horrible, at least couldnt be used to stream videos

trim lake
#

Btw. thats remind me another question. If I want to link someone with player (some settings or what ever) and save that to HashMap is problem if I do HashMap<Player, String> or its better to do HashMap<UUID, String> ?

tender shard
#

but that might be outdated, idk

wet breach
tender shard
#

hmm you're right

#

maybe that dude was full of bullshit then, or the answer I read was from 2007

tender shard
maiden geode
#

No idea bout this worlds, it's really weird

tender shard
#

you can also just use the Player object directly but you will have to listen to PlayerQuitEvent and remove them from the map then

#

in any case, you'd ideally use an IdentityHashMap and not a normal hashmap if you wanna go for using Players

#

oh and it'll break on shitty forks such as mohist

#

UUID will however always work

trim lake
tender shard
#

TL;DR whether using a player works depends on server software, it will not work on mohist

#

I'd use an UUID

wet breach
#

and this is probably where they didn't clarify

tender shard
#

that might be true

trim lake
#

I dont even know what is mohist xD Okey, gonana change all Player to UUID. Thanks. You every day learn something nuew

maiden geode
tender shard
#

and both only works half-assed

trim lake
#

Anyway, I should use UUIDs so thats need to be changed

tender shard
#

IntelliJ has a feature to replace every occurance of Player with player.getuniqueId() btw

maiden geode
tender shard
#

somewhere in the refactor menu

trim lake
wet breach
maiden geode
#

No, it's been working just fine before. I suppose to start the server and be teleported to this world once I join the server...

tender shard
wet breach
#

yeah you need to wait a tick for them to fully join

maiden geode
#

No idea why it doesn't work now, it just broke

tender shard
trim lake
tender shard
#

does anybody know if it's possible to use "variables" in javadocs, i.e. so that I don't have to write the same docs twice and be able to say "pls reuse the same javadocs as from the following method: ..."?

smoky oak
#

doesnt actually copy the JD, i dont think thats possible inside the same class, but it points to the jd of the other method

trim lake
smoky oak
#

maybe it's @see

#

im not sure which @ it was

tender shard
#

but I don't remember if this actually works lol. maybe it doesn't haha

trim lake
#

Not look likese what I want it 😄

#

Nwm, I will just change the type and I will get errors and just fix them

tender shard
# trim lake Not look likese what I want it 😄

that looks correct. You can change org.bukkit.entity.Player to java.lang.UUID and then there should be an additional field that lets you say "what used to be player now is player.getUniqueId()" or sth

glass mauve
#

if I have this config.yml:

group1:
  entry1:
    message: "Hello"
  entry2:
    message: "Hello"

whats the best way to iterate through all entries?
will getStringList("group1")
return a list like this: ["entry1", "entry2"]
and then I iterate throw the keys?

tender shard
smoky oak
#

no, entry1 and entry2 are treated as path parts

#

you call getKeys on group1 and iterate through the configurationsection starting at group1

#

you need to know your config structure

glass mauve
#

ah ok thanks

tender shard
tender shard
glass mauve
#

ah ok good to know :D

maiden geode
tender shard
maiden geode
#

"home.world?.getChunkat..." is getting the world. "home" is a home location, it is using Location class as a location so there is world saved in it

smoky oak
tender shard
#

sad

smoky oak
#

think ur out of luck

tender shard
#

thanks anyway

smoky oak
#

like i said my solution is just @see lol

#

its just one click extra

tender shard
#

I will just add a comment to remind myself to always update both

smoky oak
#

yea, id just forget, so thats not an option for me

#

my solution was to figure out a way to do it with varargs lol

#

but that doesnt always work

maiden geode
smoky oak
#

how the f

#

how does a location not have a world

trim lake
onyx fjord
#

UUID p 💀
Event e 💀

maiden geode
smoky oak
#

have you set up a debugger?

#

you might want to take a look at that variable

trim lake
smoky oak
orchid trout
smoky oak
#

e is the standard name for event and p is the standard for player

#

some short forms are 100% acceptable

north nova
#

i usually use unicode for my vairables

smoky oak
#

WHAT

#

how does that even compile lo

trim lake
smoky oak
#

my compiler breaks at anything beyond ASCII-8

north nova
#

final Player $@! = Bukkit.getPlayer(*test");

#

yep

#

i only name my unused lambda parameters

maiden geode
smoky oak
onyx fjord
maiden geode
#

It's old intellij in the tut lol

onyx fjord
#

shorter var names dont make your plugin faster

maiden geode
#

Or mac version

smoky oak
#

ah it still works the same

clear panther
#

how to make a mob my pet

smoky oak
clear panther
#

and what is a passenger

#

tho

smoky oak
#

just go edit configuration -> remote JVM debug, copy the line in the 'command line arg' part, and paste it in your start.bat

#

start server, wait for load, press the bug looking button

#

done

maiden geode
#

Yeah, I got it

smoky oak
#

good

#

just place a breakpoint

#

works like normal

#

btw

#

edit spigot.yml timeout

#

or server crashes after 60 seconds

#

vanilla mc dcs after 30

#

theres a mod but idk the name that makes client timeout longer

maiden geode
#

What about this thing:

smoky oak
#

yea thats good like that

#

thats just the hook for the server

#

tells java to listen for interrupts

maiden geode
#

Yeah? But where should I paste that? xD

smoky oak
#

wait how do you start your server

maiden geode
#

Windows batch file

smoky oak
#

yea

#

that goes in that batch file

maiden geode
#

Like from the folder

smoky oak
maiden geode
#

Can I use paper with it or not really?

smoky oak
#

probably

#

but

#

?whereami

unborn dew
#

Hmmmm can someone verify something for me. I wanna stop the breaking of an ArmorStand when the player has a permission asedit.disableCreativeBreak and when they are in Creative Mode (hence the permission name). Is the below snippet of code a good start?

    @EventHandler(priority = EventPriority.LOWEST)
    void onArmorStandBreak (BlockBreakEvent event){
        //Disables breaking an ArmorStand in Creative Mode ?
        if (ignoreNextInteract) return;
        if (event.getBlock().getType() != Material.ARMOR_STAND) return;
        Player player = event.getPlayer();

        if(player.hasPermission("asedit.disableCreativeBreak")){
            Block block = event.getBlock();
            if(block.getType() == Material.ARMOR_STAND && player.getGameMode() == GameMode.CREATIVE){
                event.setCancelled(true);
            }
        }
    }
north nova
#

why dont you try it...?

echo basalt
#

screams chatgpt to me

#

or copilot

sage patio
#

how can i prevent a player from death?

smoky oak
#

who pays for ai nowadays lolbruh

smoky oak
north nova
echo basalt
#

just do a basic check

north nova
#

wrong

echo basalt
hazy parrot
#

If ur student

maiden geode
smoky oak
#

im a student and im not below using copilot

#

gpt and pilot are kinda useless the second you want something with more than 1 moving part

#

i tried once and never again

echo basalt
#

copilot is a good dev tool imo

#

it learns with you

#

so if you write shit code

#

it writes shit code with you

smoky oak
#

see heres the thing

#

im not actually good

#

i just know a lot

echo basalt
#

then don't use AI in the first place

#

AI is a tool, not a mentor

north nova
#

its good if u know what ur doing

#

funny tho

clear panther
north nova
#

copilot fucked x11 on my linux setup

#

like it wouldn't boot

smoky oak
#

i just told yall im not using it

north nova
#

cause i ran out of memory

echo basalt
#

copilot is awful at resolving maven repos n shit

clear panther
#

you can ask AI for suggesting but def not for coding

#

never ask AI for code

echo basalt
#

and it bugs out when writing javadocs

#

and writes docs for methods that don't exist

lilac dagger
#

i was considering it

clear panther
#

yep

lilac dagger
#

but if it's still bad not sure i'll try it yet

clear panther
#

AI will only write a part of code and not even correct

echo basalt
#

At least it makes a decent attempt at code

#

but you have to correct it often

#

Still faster

#

like what the fuck is it thinking

maiden geode
#

@smoky oak ummm

north nova
#

200% certainty

maiden geode
#

No idea how you did it but you've got some magic powers lol

echo basalt
#

I honestly think knowing regex helps more than using copilot

maiden geode
#

I can now create islands and everything with no issues xD

smoky oak
#

🤷 ui didnt change much

echo basalt
#

you can do some crazy stuff

clear panther
echo basalt
#

uhh

#

cleans code

smoky oak
clear panther
#

playerinearct

echo basalt
clear panther
#

or smh

smoky oak
#

yea not for laptops

echo basalt
#

I think I paid like 280 bucks

clear panther
#

PlayerInteractEvent

echo basalt
smoky oak
#

what

#

mine had the same dam price

echo basalt
#

got no gpu though

smoky oak
#

ah well

echo basalt
#

but it's an lg gram 17 inch

clear panther
smoky oak
#

mine is like 2kg and is like a mid range pc in my pocket lol

#

i cannot stand not having to do anything

clear panther
echo basalt
echo basalt
smoky oak
#

i mean 2060-equivalent GPU and 12 core at 4GHZ

echo basalt
#

ehh that's decent

#

at least you can play Dude Simulator™️

smoky oak
#

hah

#

it lags the moment anything pops up

#

i cant even run doom ethernal at low res

echo basalt
#

something tells me you have a weird power config

#

mine can't run warframe with everything on min

#

because of the resolution

#

and that game can run on a potato

#

but it's a good coding machine

smoky oak
#

ive got a 1920 by 1080 at 144hz

echo basalt
#

ddr5 ram, 1440p screen

#

really nice color calibration

#

backlit keyboard

#

huge battery and shitty thermals thumbsup

smoky oak
#

oh yea im going to get a better color screen next time

echo basalt
#

also supports 2 nvme drives

echo basalt
#

I had a shitty acer aspire

smoky oak
#

you dont get to talk shitty thermals to my 95°c GPU tho

echo basalt
#

with a 6-bit screen

echo basalt
smoky oak
#

oh

#

hows your max wattage

echo basalt
#

I think they used spit instead of thermal paste

echo basalt
#

so not much

smoky oak
#

ah

#

mines 145

#

probs cuz of the gpu

echo basalt
#

Yeah I got an lg gram 17z90q

smoky oak
#

Gigabyge 5

maiden geode
#

@smoky oak No idea how debugger works but now it's creating islands in the normal world? Without debugger it doesn't work lol

smoky oak
#

thats not how a debugger works wtf

maiden geode
#

So wth

echo basalt
#

something tells me you're having inconsistencies with world load speeds

smoky oak
#

honestly @echo basalt im surprised my cpu's not cooked yet. I do get the occasionally BSOD when im running UE5 games for some reason tho

echo basalt
#

nearly every laptop has cooling issues

#

don't be surprised

maiden geode
#

Now it's not working at all, debugger is empty, even tho there is a huge amount of errors in the console

echo basalt
#

I've ran my desktop ryzen cpu at 120C a couple times

smoky oak
#

im more surprised that for some reason games brick my os

echo basalt
#

when booting minecraft pointandlaugh

smoky oak
#

like why the fuck do you bluescreen if and only if im in deep rock galactic lol

echo basalt
#

I had a defective AIO and the thermal paste was dry

maiden geode
echo basalt
#

I'd boot the game and like 3 seconds later my pc would just shut off

smoky oak
#

ouch

echo basalt
#

no clue exactly what you're doing

#

but when playing with worlds, there are tolerances for everything

#

I barely have any timing tolerances on my skyblock core because I'm not using .mca files but there's still a lot of tuning when managing worlds

smoky oak
echo basalt
#

When playing with paper, world IO is done async and there's no way to know when it's done

#

The event fires and then IO starts

smoky oak
#

wait i thought spigot cant break on paper

#

the more you know

echo basalt
#

well

#

paper isn't 1:1

#

and this isn't quite bukkit api

smoky oak
#

cant you run both and print out timenanos before and after?

maiden geode
#

@echo basalt I can share my repo with you on github so you can have a better look if you'd like to. There are just 2 classes responsible for creating the world (IslandManager and IslandCore(main, which is simply calling IslandManger)), would it be okay?

echo basalt
#

containsKey before get -> get & null check

warped shell
smoky oak
#

been a few years since i touched vector math

echo basalt
warped shell
#

hm i tried that but maybe i didnt do it right

echo basalt
#

no clue what effect you're trying to make but there's probably an easier way

warped shell
#

just goofing around with it

#

I just started

smoky oak
#

yea now run it a few times then check the other variant

#

btw for easier readout, subtract start time from end time before displaying

echo basalt
#

oh god

#

yeah my approach will work

smoky oak
#

by the way

#

do not spawn more than 25k particles at once

#

otherwise it'll get hacked up

warped shell
#

ik ive learnt that the hard way

echo basalt
#
new Vector(xOffset, 0, z).rotateAroundY(Math.toRadians(player.getYaw()))
smoky oak
#

yea now for my question

echo basalt
#

type deal

warped shell
#

crashed my test server a few times lol

smoky oak
#

howd u make the legs transparent?

#

like i need that exact effect for a plugin of mine

warped shell
#

just needed to make it radians

maiden geode
echo basalt
#

ye

maiden geode
#

Hm

rare rover
#

how can i keep MONGO_COLLECTION connected?

#

its null when i try to use it

tender shard
wide coyote
#

by not using try-with-resources

#

thats what causes the issue ig

maiden geode
#

So the world works now, but it works only after creating it and restarting the server (if I try to use it after the first start and creation of it - it won't work). How can I solve it?

warped shell
#

nothing special there

smoky oak
#

pretty sure invis doesnt make you transparent

#

some nonsense with a resource pack?

warped shell
#

lemme check

#

in f5 it makes you transparent to yourself I think

#

look pretty cool though

outer river
#

Hello, i have a question, i would like put "serial number" on items wich will allow me to trace them. Do you think NBT Api is the best option te create NBT tag in items (server 1.8.9)

tall dragon
#

in 1.8.9 i would say so yea

tender shard
#

on 1.14+ you could use the included PersistentDataContainer api

outer river
#

okok thx for your answers 🙂

tranquil dome
#

Could I get support here for maven? I have a plugin, common and v1_8_r3 module. For some reason when compiling I get a build failure (see image). In my IDE I have reloaded the maven project but it does not give any errors (see second image). These are the dependencies in my plugin module pom:

    <dependencies>
        <dependency>
            <groupId>dev.bloedarend</groupId>
            <artifactId>common</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>dev.bloedarend</groupId>
            <artifactId>v1_8_r3</artifactId>
            <version>1.0.0</version>
        </dependency>
    </dependencies>

Am I missing something?

rare rover
tall dragon
#

pretty sure u just need to do it without try-with-resources

#

like how was said

#

its closing it right away

rare rover
#

ah

#

alr

#

nah i need the try and catch

#

or shows up with this

tall dragon
#

well thats a diff issue then

#

can u even connect to it?

rare rover
#

ye

#

it connects for like 2 seconds

tall dragon
#

ru sure

#

have u altered data

rare rover
#

no

tranquil dome
rare rover
tall dragon
tranquil dome
#

How do I shade them?

tall dragon
#

maven shade plugin

#

and put the scope on compile

tranquil dome
#

I have that

tranquil dome
tall dragon
#

well with the shade plugin & scope on compile it should work

#

build and show build log

tranquil dome
tall dragon
tranquil dome
#

just a plugin folder

#

not the other modules

shy finch
#

I am having some issues with line endings in the craftbukkit project. When I write code normally, there doesn't seem to be any issue, but when I run makePatches.sh, it changes the line endings of every single patch file.

It looks there is code to handle these line endings in the makePatches script but I'm not familiar enough with patches to know exactly what is wrong. Of course I don't want to make a pull request with 500 changed files when I only changed 3 or 4.

tall dragon
tranquil dome
#

sure 1 moment

lilac dagger
#

how does creating a database look like?

tall dragon
#

its create on demand type stuff

tight roost
#

tbh in most plugin environments an rdbms would probably be better than like

#

a document db

#

😭

lilac dagger
tight roost
tall dragon
#

i like it as well though

#

aint gotta worry about creating it

rare rover
#

hmm

#

how tf do i do this then

tall dragon
#

id also move all the shading to ur plugin pom

#

and only keep provided shit in parent pom

#

cuz rn whats happening i think

#

ur shading alll this kotlin shit into all the modules

#

which u then all shade into plugin

#

causing all these overlaps

#

which should be cleaned up nicely ofcourse. but i think something might be going wrong there

tranquil dome
#

I don't think it's shading anything into plugin either. Also I'm using a library called BoostedYAML (which requires shading) in multiple modules, so I have the dependency and do the shading of that in the main pom.

tall dragon
#

why

#

in the end u only need the shading into ur plugin

#

the other modules can just have it as provided

tranquil dome
#

I've put the shading into the build script for the plugin module

#

and set my own dependencies as provided in every module other than plugin

#

and I can add provided to kotlin libraries too?

tall dragon
#

i dont use kotlin. but i assume so yea

tranquil dome
#

alright

#

it still does not shade my other modules though

tall dragon
#

can u show the log again?

tranquil dome
tall dragon
#

thats pretty odd

#

clearly they are being included

#

can u do mvn clean install?

tranquil dome
#

sure

ocean hollow
#

is it possible to remove all bossbars from a player? for example from the wither / dragon?

tranquil dome
smoky oak
#

clean compile package verify

#

try building with that maybe

tranquil dome
lilac dagger
#

it's named like this

tranquil dome
#

I do

            <!-- Maven shade plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <configuration>
                    <relocations>
                        <relocation>
                            <pattern>dev.dejvokep.boostedyaml</pattern>
                            <shadedPattern>dev.bloedarend.plugin</shadedPattern>
                        </relocation>
                    </relocations>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
vapid grove
#
protected String enchant;
        protected int enchantLevel;
        
        public EnchantFuncs(String fullEnchant){
            String[] split = fullEnchant.split(":");
            this.enchant = split[0];
            this.enchantLevel = split.length > 1 ? Integer.parseInt(split[1]) : 1;
        }
        
        public String getEnchant(){
            return this.enchant;
        }

Random question, at getEnchant() is this even required anymore as since ive already called EnchantFuncs

#

or should I still use this.enchant for safety

#

Yeah I was thinking the same, I wanted to double check however just incase

#

I shouldnt run into issues tho as im not using same variable names

tranquil dome
#

Also I don't know if this is helpful but it only says dev.bloedarend for the parent and the api module

vapid grove
#

Fair

#

speaking of, what does final actually do

#

Ohhhh, gotcha

#

I was thinking that it entirely locked it or smth
Where lets say its a hashmap, you cant add onto it

#

You cant call .put()\

#

Thats actually useful

#

So then lets say:

final int a;
a = 0; --now its 0
a = 1; --still 0
#

This would be correct then right?

#

Since the variable wasnt assigned yet

north nova
#

no

#

u can't change it

#

ide would cry

vapid grove
#

I like learning lol

north nova
#

?

sage patio
#

how i can set a player like hes swiming? (i already did it with player.setSwiming(true) but it changes immediately, how can i prevent that? iirc it has an event)

north nova
#

this is cause you're actually assigning it after

lilac dagger
#

but final only means you can't modify that field or you can't override or extend final methods and classes

vapid grove
#

Gotcha

#

Also, random issue, Named my plugin something dumb

#

Wanna change it

#

Now IDE is freaking out cause I renamed files

#

And I tried editing the pom as well

#

Am I missing something

#

Lettme reload

#

Oh nvm it fixed lol

lilac dagger
#

just look into .idea for deleted modules

#

so you don't have problems later on if you wanna rename onto that

tranquil dome
#

@tall dragon the shinobistriker-api module was empty and after adding a class into it, it was also shaded but with a different name

#

I originally copied this project over from another plugin which only had a plugin and "discordo-api" module. Maybe something went wrong because of that?

tall dragon
#

honeslty no clue in ur case lmao

tranquil dome
#

rip

sage patio
#

nvm, its EntityToggleSwimEvent

shy finch
tranquil dome
#

but renaming the sources folder from kotlin to java fixed it

tall dragon
#

😄

tranquil dome
#

there go 3 hours of my day

#

o well

glad prawn
#

lol

sage patio
#

ig it is because of he has Doctor Strange skin

#

bro think he is Doctor Strange

glass mauve
#

I would really like to use ServiceManager but this makes my code kinda untestable, Bukkit.getServicesManager throws an exception
anything I can do about it?

vapid grove
#

?paste

undone axleBOT
vapid grove
#

Can someone review this class I created for enchants, and tell me how I can improve it if needed

sage patio
carmine mica
#

why do you have nonstatic methods interacting with a map in a static field?

#

that enchantmentList should just be an instance field, not static

vapid grove
#

Thank you for porting that out

#

Hold on wait I remember why I did that

#

lets say I initalize all the enchantments, and try to call new EnchantManager from another class

#

Are the enchants still gunna exist in enchantmentList

carmine mica
#

don't call new, just create one

vapid grove
carmine mica
#

why would you create a new one? if

#

create a single one, and use it in multiple places

#

or if you want to abuse static, just make all the methods static

vapid grove
vapid grove
carmine mica
#

also, why does that inner class extend the EnchantmentManager

undone axleBOT
vapid grove
#

?paste

undone axleBOT
vapid grove
#

Enchantment base in question

carmine mica
#

why isnt the EnchantmentBase a field there instead of the string identifier?

vapid grove
#

No enclosing instance of type 'me.emerald.plugin.resources.main.EnchantmentManager' is in scope

#

I would have kept it in the same clas otherwise

carmine mica
#

where is Enchantmentbase? is it a nonstatic inner class?

vapid grove
#

abstract class

#

for the enchantments themselves

carmine mica
#

a top level class?

vapid grove
#

Yes

carmine mica
#

shouldn't have any issue with putting it as a field in EnchantFuncs

vapid grove
carmine mica
#

screenshot pls, I want to see where the issue is

vapid grove
#

k

vapid grove
#

With 0 information

carmine mica
#

you said it was a top level class

#

that is NOT a top level class

vapid grove
#

I assumed it was

carmine mica
#

is EnchantmentBase inside EnchantmentManager?

vapid grove
#

Oh wait I see what you mean now

carmine mica
#

and its not static?

vapid grove
#

No its not a top level class, I thought you meant my new version of it

#

the seperate class for it

carmine mica
#

EnchantmentBase should be a static class if its inside another class

vapid grove
south mason
#

I am writing a plugin like skywars, and I have the distribution of players by their islands and the issuance of a gamemode spectator, but some players do not have bodies and hitboxes

orchid trout
#

?nocode

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

rare rover
#

is there a way to keep your sqlite connection alive after a .execute?

orchid trout
#

save it on a field

rare rover
#

DATABASE_CONNECTION is a private static variable

#

but after 1 executeUpdate() it'll disconnect it

remote swallow
#

it shouldnt get closed there

#

its not try with resources

south mason
#

I just use
for (Player player : playerlist) [
player.setGamemode(Gamemode.Survival);
]

rare rover
#

idk

#

it does

#

oh wait

#

🤦‍♂️

#

nvm im just dumb

#

🙂

south mason
#

Only head, without legs and body, without hitbox

orchid trout
orchid trout
south mason
#

But theu cant fly

#

And have normal hud

orchid trout
#

are you using paper or something

south mason
#

no, I have some kind of bug when I put players in survival mode with my plugin, some players have no body and hitbox

orchid trout
#

?nocode

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

south mason
#

if(gameManager.getGameState() == GameState.Active){
for(Player player : playerList){
logger.info(playerList.toString());
player.sendTitle("Одиночный режим", "Тимминг запрещен!");
player.setGameMode(GameMode.SURVIVAL);
player.getInventory().clear();
player.teleport(spawnloc.get(indexloc));
indexloc++;
}
RandomItem();
}

onyx fjord
#

is linkedlist faster than arraylist for iteration?

marsh crater
#
@Override
    public void onDisable() {
        ChatBridge.sendMessageToDiscord(":octagonal_sign: The server has stopped");
        discordBot.shutdown();

}

RestAction queue returned failure

I assume this is shutting down my bot before the queued message is sent to discord?
The message still went through but I don't like this error. How could I fix this/make sure the message goes through before shutting down the bot?

#

my assumption is correct?

#

ok

#

can I just paste this in my discordbot.shutdown() method?
currently I just have jda.shutdownNow()

#

ok thanks!

#

yep, onDisable calls discordBot.shutdown() and that snippet is now in discordBot.shutdown()

hazy parrot
#

xd ?

#

i never saw your await shutdown

#

and complete is totally fine if you are running something on application shutdown

#

as it will block the thread for request (it doesn't matter as application will be killed anyway)

hazy parrot
#

nah, that definetly isn't case 😄

marsh crater
#

ok well my project has been fully tested. should I push to github now or wait for a consensus here? lol

#

oh cool

#

posted it

#

thanks

ocean hollow
#

I've been suffering for an hour now, why is the text not displayed in the bossbar? it updates the bossbar and sends a message to the chat, but for some reason there is hi in the chat (for testing), but not in the bossbar

#
        Component result = Component.text("");

        List<String> strings = new ArrayList<>(){{
            add("ɱ");
            add("ɤ");
            add("ʥ");
        }};

        // generate horizontal offset
        result = result.append(createHorizontal().font(Key.key("minecraft:default")));

        Component offset = Component.translatable("space.-1").font(Key.key("space:default"));
        Component newLine = Component.translatable("space.-1025").font(Key.key("space:default"));

        for(String string : strings){
            Component text = Component.text(string);

            result = result
                    .append(text)
                    .append(offset)
                    .append(text)
                    .append(offset)
                    .append(text)
                    .append(offset)
                    .append(text);

            if(!string.equals("ʥ")){
                result = result.append(newLine);
            }
        }

        player.sendMessage(result);
        return result;
    }```
#
        String text = "space.";

        if(horizontal < 0) {
            text = text + "-";
        }

        // was "hi"
        text = text + (16 * Math.abs(horizontal));

        return Component.translatable(text).font(Key.key("space:default"));
    }```
sterile breach
smoky oak
#

let me rephrase that

#

can i call a constructor as the not-first instruction in another constructor

zealous osprey
#

Could you provide an example please?
"not-first" is a bit off putting

smoky oak
#

basically i want to do this

constructorA(Player, someStaticData){}
constructorB(Player, CommonCasesEnum){
  switch(CommonCasesEnum){
    case EMPTY: this(player, null); break;
    case JUMPER: this(player, List.of(Abilities.DOUBLE_JUMP); break;
    ...
  }
}
zealous osprey
#

Neither do I, youd have to make a check with an inline statement or create a function to parse the static data

smoky oak
#

actually i might have an absolutely aboniable idea

#

laughs in sith lord

#

yea that was my idea

#

just cuz its the first argument doesnt mean i cant do stuff inside

#

wait a moment

#

i dont even need a helper function :D

#

welp time to copy down 200 effects

#

im not looking forwards to this

#

by the way, is there a way to generate pairs of values somehow?

#

like so that they're close in source code?

#

the first entry is a list of effects and the second a list of their strengths

#

i mean i could do something absolutely cursed a la

object secondary_values(God patron, boolean effect){
  switch(patron){
    case 1: return effect ? List.of("String","String") : List.of(1,2);
  }
}

#

but

#

you know

desert loom
smoky oak
#

basic coding principles

smoky oak
desert loom
#
    public enum Abilities {
        JUMPER;
    }

    public enum SomeEnum {
        EMPTY((Abilities) null),
        JUPITER(Abilities.JUMPER);

        private final List<Abilities> abilities;

        SomeEnum(Abilities... abilities) {
            this.abilities = List.of(abilities);
        }

        public List<Abilities> getAbilities() {
            return abilities;
        }

    }

    public static class SomeClass {

        private final List<Abilities> abilities;

        public SomeClass(SomeEnum someEnum) {
            this.abilities = someEnum.abilities;
        }

    }

something like this

smoky oak
#

pretty sure thats still normal java there

echo basalt
#

that's a weird approach

#

Just do what mojang does

smoky oak
#

oh not using enums at all you mean

#

took a moment to register

#

I... just realized all those would be static and initialized when first accessed, wouldn't work with my approach

#

I need a reference to player

#

i can probably work around that but its gonna be a pain

echo basalt
#

You can have it as an interface / abstract class / a factory of some sort

#

This is my constraint class

smoky oak
#

yea similar idea, but i need more than 20 minutes to call judgement if i want to do it like that

echo basalt
#

Not the best but I properly sanitize stuff

smoky oak
#

ah I'm clearing out my values on the playerLeave event

#

and init on playerJoin

#

the instances are interchangeable, the player is the lynchpin

echo basalt
#

You can have an AbilitiesProvider interface that's just a factory then

#

and a registry for those

smoky oak
# echo basalt

I'll see if i can do it like this, seems cleaner. Thanks for the advice, Illusion

#

I can just do a mapping player->abilityProvider

echo basalt
#

yeah something like that

#
public interface AbilityProvider {

  Ability provide(Player player);

}
smoky oak
#

I'm keeping a singletron in my plugin main class cuz some bukkit stuff requires it, easier to access there

echo basalt
#

icky

smoky oak
#

i mean

echo basalt
#

So yeah convert to an interface

smoky oak
#

its not getting lost lol

#

my reasoning is that since plugin's a singletron anyways, i dont need to keep references to it

sweet sonnet
#

Is this the correct way to connect to a sqlite database and then create a table?

// Database
try {
    connection = DriverManager.getConnection("jdbc:sqlite:" + getDataFolder() + File.separator + "data.db");
    try (Statement statement = connection.createStatement()) {
        statement.setQueryTimeout(30);
        statement.executeUpdate("CREATE TABLE IF NOT EXISTS Reports (reportID INT, reportedPlayerUUID TEXT, reporterUUID TEXT, reason TEXT, timeStamp TEXT)");
    } catch (SQLException e) {
        getLogger().severe("Error executing SQL query: " + e.getMessage());
    }
} catch (SQLException e) {
    getLogger().severe("Error connecting to the database: " + e.getMessage());
    getServer().getPluginManager().disablePlugin(this);
}
echo basalt
#

I'd split the logic up a bit more

#

especially if you care about mysql later

sweet sonnet
#

it would be more or less the same for mysql right? just replace the connection url with the sql database credentials

echo basalt
#

well

#

That results in duplicate code

#

Time for an ✨ abstraction ✨

#

For example, what would your "database" class look like?

sweet sonnet
#

could you elaborate please

sweet sonnet
echo basalt
#

We're going to write a more.. generic way of handling data, so that implementing a new database doesn't require a ton of effort

onyx fjord
smoky oak
#

ah it's been resolved already

#

interface's better here

echo basalt
#

What would yours look like

echo basalt
#

Alright

#

So let's just start by writing an interface that serves as a template for how we're going to handle this data

smoky oak
#

like i know youre talking to snow but it feels like youre talking to me cuz i just thought how crap my code is lol

echo basalt
#
public interface ReportDatabase {

  CompletableFuture<Boolean> tryEnable(ConfigurationSection section);

  CompletableFuture<Report> fetchReport(int reportId);
  CompletableFuture<Void> saveReport(Report report);
  CompletableFuture<List<Report>> getReportsBelongingTo(UUID reportedPlayerId);
  CompletableFuture<Void> deleteReport(int reportId);
  
  default CompletableFuture<Boolean> contains(int reportId) {
    return fetchReport(reportId).thenApply(report -> report != null);
  }
}
#

This is my guide on completablefutures if you'd like to see

#

Anyways we can then create an SQLQuery enum and an abstract sql implementation so we can later just implement our drivers

smoky oak
#

man you should start ur own blog

echo basalt
#
public enum SQLQuery {
  CREATE_TABLE,
  FETCH_REPORT,
  SAVE_REPORT,
  GET_PLAYER_REPORTS,
  DELETE_REPORT,
}
#

And a basic impl

sweet sonnet
echo basalt
#
public abstract class AbstractSqlDatabase implements ReportDatabase {

  private final AtomicReference<Connection> connectionReference = new AtomicReference(null); // You can switch to a connection pool if you'd like

  protected abstract Connection createConnection();
  protected abstract Map<SQLQuery, String> getQueries();
  protected abstract boolean enable(ConfigurationSection section);

  @Override
  public CompletableFuture<Boolean> tryEnable(ConfigurationSection section) {
      return CompletableFuture.runAsync(() -> enable(section)).thenCompose(unused -> createTables());
  }

  ...
}
#

And implement our methods

#

I can't bother writing a full driver

vapid grove
#
public ItemBase(String key){
            this.key = key;
            this.item = generateItem(null);
            this.recipe = createRecipe();
        }

Since this.key and this.item is running first, can createRecipe() access them or no

echo basalt
#

sure

vapid grove
#

alr

blazing flare
#

If I wanted to create pagination, what is the best approach for keeping track of the current page? I can store it in an item's name, lore or pdc but I think, although haven't tried, I can save it in a custom inventory holder. Is there a preferred approach? I was initially thinking of using a custom holder with a hashmap of metadata that I add to it, not just limited to current page number of course.

vapid grove
#

I just made a new class for each gui to store information on that gui

#

And for pagination, pretty simple, just a protected int variable called page

#
public InventoryFW(int rows, String name){
        Bukkit.getServer().getPluginManager().registerEvents(this, Main.instance);
        inv = Bukkit.createInventory(null, rows * 9, name);
}
#

Old code mind it

#

But it works like a charm

#

Otherwise, your best other approach is just creating a class for each ui seperately, and making a call for it, and doing the same thing

vapid grove
#

I never knew that

#

Only thought it worked with itemstacks, and entities

young knoll
#

It doesn’t work with inventories

vapid grove
#

Oh welp :P

blazing flare
#

Pagination works with items, so if you clicked previous or next, it's clicking an itemstack.

#

that pdc 😛

vapid grove
#

In my oppinion however, why set pdc for an items page instead of just a variable

#

Just seems quite odd

topaz panther
#

Do i use Hex Color Codes for a Custom Color?

young knoll
#

Custom color for what

topaz panther
#

Chat maybe...?

young knoll
#

You can, sure