#help-development

1 messages · Page 741 of 1

remote swallow
#

wrap it in try catch

silent slate
#

plugin doesnt crash when starting i can still use other commands

lost matrix
#

Then show us your onEnable

smoky oak
#

dafuq
i removed the json import why does this still happen

remote swallow
#

instead of what you have remvoe the the throws ParseException and add ```java
try {
// line that calls #parse
} catch (ParseException ex) {
ex.printStackTrace();
}

silent slate
lost matrix
#

And pls start there before you add try catch blocks anywhere.
There is a fundamental problem with your listener that needs to be solved first.

silent slate
#

ok so the throws ... is gone now

#

its only this: java @EventHandler public void onSpeak(AsyncPlayerChatEvent e) { e.getPlayer().sendMessage("Test works"); if(!MuteUtils.muteCheck(e.getPlayer())) { e.getPlayer().sendMessage("is false"); } if(!DataConfiguration.INSTANCE.getData().contains("Data." + e.getPlayer().getUniqueId())) return; if(MuteUtils.muteCheck(e.getPlayer())) { e.setCancelled(true); } }

lost matrix
silent slate
#

?paste

undone axleBOT
silent slate
lost matrix
#

Now the PlayerListener pls

silent slate
#

WAIT

#

tempmute and mute is both the same

#

i just realized that

lost matrix
#

That should not clash with your listener not being called

silent slate
earnest prawn
#

Anyone know why Player.getEyeLocation would return a different value every other tick while the player is in a vehicle? It's as if it doesn't acknowledge the player is in a vehicle

lost matrix
silent slate
#

not before

#

i can try now bc i made some changes

lost matrix
#

If you dont get the message "Test works" then its throwing an exception.
Otherwise the information you gave us is faulty.

silent slate
#

gor that error when reloading using plugmanX

icy beacon
#
  1. don't reload with plugmanx ever again
#

Restart your entire goddamn server

remote swallow
#

dont use plugmanx, and the command isnt in pugin.yml

silent slate
#

takes 5 minutes

lost matrix
silent slate
#

but it is

icy beacon
#

Now restart

#

The longer you don't restart, the longer it'll take you to do so

silent slate
#

ok did it

#

this is my plugin.yml

#

commands:
ban:
description: Bans player
unban:
description: Unbans player
kick:
description: Kicks a player
mute:
description: Mutes a player
unmute:
description: Unmutes a player
warn:
description: Warns a player
unwarn:
description: Unwarns a player

#

i havent created warn and unwarn yet as a file, is that a problem?

hybrid turret
#

I don‘t quite understand how I get the data from a block using the CustomBlockData-API, can u tell me how, 7smile7?

silent slate
#

tempmute doesnt exist

#

its mute

lost matrix
hybrid turret
#

Uhm oh damn wait it‘s that simple?

#

Oh-

lost matrix
# silent slate its mute

Alright, then start the server, make sure you dont get any exceptions while starting, use the /pl command to check
if your plugin loaded correctly and write something in chat.

silent slate
lost matrix
earnest prawn
# lost matrix What is the delta?

Actually after restarting the server it seems to have fixed the difference in the position, no idea why. It was ~1 on the Y axis in an empty boat + whatever the boat direction with a mob inside it. Though it now returns the eye position a bit higher than what it actually is while inside of a boat, about the height of the boat's hitbox

#

While riding on horses and camels the location is correct

silent slate
#

added this

@EventHandler
public void onTest(BlockBreakEvent e) {
e.getPlayer().sendMessage("Test works");
}

#

still waiting for restart

#

i dunno what the server is doing, its restarting again

#

YES

silent slate
lost matrix
#

But not when writing something in chat?

silent slate
#

...

#

WHY IS IT WORKING NOW

#

its firing but not blocking the chat

lost matrix
#

Well, did you mute the player?

silent slate
#

wait a second

#

its firing 2 times but we can fix that

#

the message gets blocked tho

tall dragon
#

bon appetit

silent slate
#

why is it sending it 2 times tho

#

WORKS

#

thank u so much smile

#

and the others

chrome beacon
#

Need a ladder?

inner mulch
#

Does somebody know how I can get just the Player's message from the textcomponent?

ivory sleet
#

I believe spigot has just AsyncPlayerChatEvent#getMessage no?

inner mulch
#

do you know how i get the message from the component?

ivory sleet
#

ru using paper?

#

cuz paper has the ChatEvent etc

inner mulch
#

yes

timber crescent
#

how do I spawn a silverfish and make it not attack a certain player

ivory sleet
#

isnt that what u're after

blazing ocean
#

hello, I'm trying to make scoreboard teams with prefix and colour and currently using this code: ```java
public void register(Scoreboard board) {
this.team = board.registerNewTeam(this.name);
team.setPrefix(this.icon);
team.setColor(this.colour);
team.setDisplayName(this.displayName);
}

public void addPlayer(Player player) {
    players.add(new TeamPlayer(this, player));
    team.addPlayer(player);

    player.sendMessage("mci team players:");
    for(TeamPlayer p : this.players) {
        player.sendMessage(p.getPlayer().getName());
    }

    player.sendMessage("scoreboard team players:");
    for(OfflinePlayer p : team.getPlayers()) {
        player.sendMessage(p.getName());
    }
}```

scoreboard team players are me, but when I run /team list <name> theres nobody in there, also prefix and colour are not working. what am i doing wrong?

inner mulch
ivory sleet
#

abstract one is just the shared one which both ChatEvent and AsyncChatEvent extend

inner mulch
#

there is still no #getMessage in both of them

ivory sleet
#

the method is message() just

inner mulch
#

but if i send a player his own message it ends up looking not like his message

ivory sleet
#

ofc

inner mulch
#

?

#

dont leave me :(

ivory sleet
#

before the message is sent it goes through the ChatRenderer

#

thats how the paper api works for chat events

inner mulch
#

oh no :(

#

i need to get it from the chatrenderer?

ivory sleet
#

unlike spigot, you usually dont need to cancel the chat event

#

well what ru tryna do

inner mulch
#

I'm currently creating a chatfilter and I want to send the player the offensive word found, as well as the whole text, so that if something get filters wrongly they got proof and can report it

ivory sleet
#

wait u wna send the offensive words back to the player who sent them?

inner mulch
#

yeah i alr got this one figured out, but i want to send the full text too.
like this for example

found chat abuse: "😡"

your message: bla bla 😡

ivory sleet
#

and do you still want the message to go through?

#

like should it still be sent for other players to see?

inner mulch
#

no i alr cancelled it

ivory sleet
#

ah alr

#

in that case yeah lol, you'd prob need to invoke the chat renderer urself

inner mulch
#

why does it be so complicated

#

why is there no #getMessage :(

ivory sleet
#

thats literally #message

#

its just that its a component and not a string

inner mulch
#

but i dont know how to translate them

#

if i send the #message component, it sends more than the acutal message

ivory sleet
#

yeah

#

well

#

Id suggest using minimessage

#

and then you append or whatever the result of ChatRenderer::render

inner mulch
#

is there no way of getting only the content of the component?

ivory sleet
#

the text?

inner mulch
#

yes

ivory sleet
#

there is, but like you might not get the colors and text styles then

#

etc

pseudo hazel
#

toLegacyString?

#

or is that another component?

ivory sleet
#

ig thats one way, Id just use the serializer

#

PlainTextComponentSerializer.plainText().serialize(component)

inner mulch
#

ok

eternal night
#

.html

inner mulch
#

lynxplay

ivory sleet
#

woops :>

inner mulch
#

lynxplay, you are developing paper, right?

eternal night
ivory sleet
#

yeah lynx in the dev team lol

eternal night
#

imma just

#

?whereami

pseudo hazel
#

lmao

eternal night
#

and run

ivory sleet
#

:,)

inner mulch
# eternal night and run

lynxplay why did you do this man :( please add a event#getMessage that returns the string of the text, that a player sent in the chatevent

eternal night
#

conclure literally showed you how to use plain text serialiser

inner mulch
#

WHY COMPONENTS

eternal night
#

because it is a component ??

#

the server doesn't deal in leagcy text

inner mulch
#

:(

eternal night
#

like, litearlly just throw it full power at plain text component serialiser

#

and you are good

inner mulch
#

ok

ivory sleet
# inner mulch WHY COMPONENTS

you know, it just happens to be the case most text in minecraft is more than just a sequence of characters, for instance being able to click on text, hover over text, color text, style text and so on, for this to be possible and to work well in code using mere strings isn't a great idea, hope you have a splendid day

inner mulch
#

thank you

kind hatch
#

Is reflection needed on values that are public?

ivory sleet
#

public fields?

kind hatch
#

Ye

ivory sleet
#

ugh I mean no, you could just access it without

kind hatch
#

That's what I thought.
Wonder what I'm doing wrong then. :/

ivory sleet
#

whats going on?

kind hatch
#

Trying to figure out why advancement toasts don't show up anymore in 1.20.2

#

The advancement map has apparently been converted to an ImmutableMap, so I set it to a normal hashmap and custom advancements that are loaded through bukkit don't want to show the toast.

ivory sleet
#

ahh

kind hatch
#

Maybe I'm just doing it wrong?

ivory sleet
#

hmm

#

the only thing I may think of is if something is caching the map before u're able to mutate the reference

kind hatch
#

The other thing with this is that if I set the chat message value to true, it will show. Even with both values (chat and toast) set to true, only the chat message shows.

gilded tangle
hasty prawn
#

I reckon you should restart your game

lilac dagger
#

yeah

#

looks like it

gilded tangle
#

Not working xd

hasty prawn
#

Try logging out of the launcher and logging back in

gilded tangle
#

Already tried too

chrome beacon
#

Make sure you're using the official launcher

gilded tangle
#

I can enter any server except my BungeeCord server

ivory sleet
#

havent look too much at 1.20.2

kind hatch
#

There's another mutation.

ivory sleet
#

yeah

#

maybe, or perhaps you're passing an invalid json

#

idk

#

wait lme check changelog

kind hatch
#

AFAIK, that's the proper structure for advancements.

slender elbow
#

why are the booleans written as strings :thonk:

kind hatch
#

Would that be screwing it up?

slender elbow
#

i doubt it

#

uh, maybe?

kind hatch
#

I'll de-stringify them and try.

#

Yea, makes no difference. :sadge:

minor crest
#

Really stupid question, but is it possible to link both a Java and Bedrock server under the same ip?

Hub that goes to a Java server, and one that goes to a bedrock server (for world generation)

#

Idk if that makes any sense

ivory sleet
#

in theory that is possible

chrome beacon
#

Bedrock and Java does use different ports

#

as for the second part I don't quite understand what you mean

ivory sleet
#

i assume they mean some sort of proxy server and then one server is java and one server is bedrock

minor crest
#

The Java world is modified with custom plugins, but is separate from the bedrock world

terse pumice
#

Is there an easy way to check if the server version is above or below a specific version? eg. check if the server version is newer than 1.19 for example

echo basalt
#

there are so many utils for that

terse pumice
#

such as?

fluid river
#

Server#getBukkitVersion()

#

or Server#getVersion()

#

format it a bit and check if higher/lower than your desired value

echo basalt
terse pumice
#

yeahh that's perfect

#

thank you both!

fluid river
echo basalt
#

Or you can just use this lib and do stuff like

fluid river
#

yes

echo basalt
#

Version.isVersion(1, 19, 2)

fluid river
#

also get minor and patch versions

terse pumice
# fluid river

Yeahh this is what I am currently doing but didn't really want to make a list of the older versions even though it would work equally fine

mellow snow
#

plugin.reloadConfig()
doesn't work .-.

fluid river
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

fluid river
#

it works like always with no bugs

mellow snow
kind hatch
#

#reloadConfig() pulls in changes from disk. Unless you saved your changes, it won't reload with the values you are expecting.

mellow snow
#

                plugin.reloadConfig();
                p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&f&l[TheLogger] &aConfig reloaded! &fPlugin by Mjicio_"));

            }```
#

I would like that when someone modifies the config, using the /test reload command the config is reloaded and the changes are seen without restarting the jar or the server

fluid river
#

and what happens after your command runs?

mellow snow
fluid river
#

are you editing your config with notepad++

mellow snow
#

but the config changes doesn't work in the game

fluid river
#

show some code where your config is used

mellow snow
#

I'm trying the plugin on a vps

fluid river
mellow snow
kind hatch
#

How are you changing it though?

fluid river
#

maybe you preload the stuff in onEnable() or on class inst

mellow snow
fluid river
#

and that's why nothing happens after reloadConfig()

fluid river
#

he is doing that tho

#

he just changes the yml

mellow snow
#

MAIN


    @Override
    public void onEnable() {
        // Plugin startup logic
        System.out.println(ChatColor.BOLD + "[TheLogger]" + ChatColor.GREEN + ChatColor.BOLD + "Enable!");
       //There is commands and events register

        this.saveDefaultConfig();
        config = this.getConfig();
    }```

COMMANDS CLASS

```} else if (args[0].equals("reload")) {

                plugin.reloadConfig();
                p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&f&l[TheLogger] &aConfig reloaded! &fPlugin by Mjicio_"));

            }```
fluid river
#

using hands

mellow snow
kind hatch
#

Where are you changing the message though?

fluid river
#

just why

mellow snow
#

why what?

mellow snow
fluid river
#
  1. where is the code with getting something from config
#

config.get...()

#
  1. Why are you saving config to variable
#

there are 999 ways to access it anyways

mellow snow
#

I send

#

I use config.getString(path)

fluid river
#

can you show an example please

mellow snow
#

yesser

mellow snow
#

p.sendMessage(ChatColor.translateAlternateColorCodes('&', config.getString("prefix") + ChatColor.translateAlternateColorCodes('&', config.getString("xrayOn"))));

fluid river
#

and when you change the message and reload config

#

this code still shows old message

#

right?

mellow snow
#

YES

#

ops

#

sorry caps

fluid river
#

well ig your config stores old FileConfiguration

kind hatch
#

If you're modifying the file on the disk manually, then you should see that reflected in your server as long as you actually saved the file.

fluid river
#

get rid of public static FileConfiguration config;
and config = this.getConfig();

kind hatch
#

^

#

FileConfiguration is only needed if you need more than the default config.yml

fluid river
#

yup

mellow snow
#

k but

fluid river
#

and access your config using built-in way

#

JavaPlugin#getConfig()

mellow snow
#

Know how the other classes take the String : config?

#

I have to replace all config.getString with plugin.getConfig().getString()?

kind hatch
#

Shouldn't be that big a deal if you are using DI.

fluid river
mellow snow
fluid river
#

which will do config = getConfig() again

kind hatch
mellow snow
pseudo hazel
#

the issue is the FileConfiguration being public static

fluid river
#

most of the code above is kinda issue 🙂

#

i have one super prohibited way tho

mellow snow
#

So, I have to replace all config.getString() with plugin.getConfig().getString()?

fluid river
#

yes

valid burrow
#

what would be the best way to find out the color of a specific char in a string aka what color code is applied to it

ivory sleet
#

shadow did u solve it?

kind hatch
#

Negative

mellow snow
fluid river
#

if you take colored string it would have different length cuz it will have a lot of §x shit

lofty badge
#

who can help me make good effect for my site on html and css

#

??

valid burrow
fluid river
valid burrow
#

xD

kind hatch
#

I thought there was a method in ChatColor to get the color?

remote swallow
#

there is

#

bungee chat color

fluid river
#

i hate discord

remote swallow
#

same

pseudo hazel
#

the superior chatcolor

fluid river
#

the chatcolorest chatcolor

valid burrow
#

i have a message where i highlight playernames and i want the part after the playername to keep going with the color before the name

fluid river
#

why don't you just do it manually

#

§aCringe... §b%playername% §adied.

remote swallow
#

split the name, get the color pre name, color name, set color after name

valid burrow
fluid river
#

i mean it's your plugin no

remote swallow
#

pretext name aftertext »

split »
split space

valid burrow
valid burrow
fluid river
#

you are to lazy to add two symbols after name?

valid burrow
#

are you stupid

#

or just slow

fluid river
#

ig second

valid burrow
#

look

#

lets ay

#

say

#

a player times

#

Hey "playername" lets get some wood

#

i want to highlight the playername there

#

even

pseudo hazel
#

im pretty sure you can do that with components cant you?

kind hatch
#

Huh, bungee chat color does not have the #getLastColors() method for some reason.

pseudo hazel
#

whats that supposed to do

fluid river
kind hatch
remote swallow
valid burrow
fluid river
#

chance of what

lilac dagger
#

getLastColors would fail so hard tho

remote swallow
lilac dagger
#

hex colors are not easy

remote swallow
#

there could be trillions of cobinations of words to format

pseudo hazel
#

they are though?

mellow snow
#

@fluid river IT WORKS

mellow snow
#

i love u

fluid river
#
raided-countdown-bar-name: '&dВас скоро зарейдит город &e%town%&d.'
raider-countdown-bar-name: '&dСкоро вы начнёте рейд на &e%town%&d.'
raid-raided-bar-name: '&dВас рейдят.'
raid-raider-bar-name: '&dВы проводите рейд.'```
#

literally what i have

remote swallow
#

yeah

#

thats config able

#

you cant configure what someone types

fluid river
#

any prob with that?

valid burrow
#

what does get lastchatcolors return? just the colorcode as a string?

fluid river
#

SHIT

remote swallow
#

there you go nuker

valid burrow
#

took you long enough

fluid river
#

That's what he meant

valid burrow
#

xd

fluid river
#

have a message where i highlight playernames and i want the part after the playername to keep going with the color before the name

#

i thought it's message from his plugin

#

not from user input

ivory sleet
#

@kind hatch its weird, I believe it should work just fine

#

hmm

valid burrow
#

yh now that i look back its a bit wacky explained

#

mvmv

#

mbmbm

fluid river
#

so well

#

how do you actually highlight the name in the message

fluid river
#

like it's just a word, no?

remote swallow
#

split at the char between prefix, name and suffix, split at space, get center word, color it, get color of 1st word, set color of 3rd word

valid burrow
#

thats what im trying to do

#

but for that to wokr

valid burrow
#

i need to know what getchatcolor returns xd

remote swallow
fluid river
#

yeah that's what i mean

#

well welll

#

welllll

#

each time players sends a message

#

get all player names on the server

#

loop to find any of them in the string

#

erase it

#

copy the color

#

paste it again

kind hatch
# ivory sleet <@143004075435360256> its weird, I believe it should work just fine

What tests have you tried?
I tried using Bukkit#getUnsafe() and it throws the Immutable Map error.
I tried setting the map to a new hashmap and then using bukkit unsafe, but I crash when using viaversion.
I've changed the advancement format a couple times and manually added the values that should be auto filled.

I was originally trying to just update my nms packet, but it wanted something that isn't needed for the minecraft:impossible trigger.
I'm just stuck at this point.

valid burrow
#

this is not my problem i know how to solve that.... i just want to know what type of string get chatcolor returns man

#

thats all i wanna knw

fluid river
#

no clue

ivory sleet
kind hatch
#

I have a different system for pre 1.20.2. I was originally sending nms packets which were consistent up until this version.

ivory sleet
#

Have you checked how its done in CraftMagicNumbers#loadAdvancement

kind hatch
#

In the older version or the 1.20.2 version?

ivory sleet
#

1.20.2

kind hatch
#

I think I did, but let me double check real quick. I'm pretty sure it's the same impl as 1.20.1, hence the immutable map error.

ivory sleet
#

oh lol it is

#

my bad

kind hatch
#

Yea, the only difference I see is the null check being done first in 1.20.1, vs 1.20.2.
Same methods are used to add advancements.

ivory sleet
#

I mean paper seem to be doing this as well

#

                MinecraftServer.getServer().getPlayerList().getPlayers().forEach(player -> {
                    player.getAdvancements().reload(MinecraftServer.getServer().getAdvancements());
                    player.getAdvancements().flushDirty(player);
                });
#

idk how necessary that is

kind hatch
#

Well, I think there is some difference as now there's the introduction of AdvancementHolders and that changed the format from a list to a map. Not sure why it needs to be immutable though.

kind hatch
ivory sleet
#

CraftMagicNumbers#loadAdvancement

#

AdvancementHolder seems to just be an entry for namespace and an advancement

ivory sleet
kind hatch
ivory sleet
#

in onEnable?

kind hatch
#

It's done every time a command is run. Probably should move it to onEnable though.

ivory sleet
#

yeah try to move the injection to onEnable first and foremost

kind hatch
#

Uhh, let me get back to you on this. Gotta run an errand and I have to figure out how to make it run with my multi module project.

ivory sleet
#

yeah sure take ur time ^^

zenith gate
#

Can you change someone's playerData while the player is in the game? like to replace their playerdata in the world folder, with something else. I want to make a profiles aspect, and I need to know if I have to kick the player to change their save, or if I can just do it there.

ivory sleet
#

Player#saveData and loadData is a thing :)

zenith gate
#

Ohhh.. I was thinking I'd have to do this all my self 😅

ivory sleet
#

well tbh it was recently added

#

sorta

#

so dw

zenith gate
#

Alrighty, welp thank you.

lofty badge
#

guys

#

who can help with site?

pseudo hazel
#

wdym

remote swallow
#

you are doing so many completely differents projects

lofty badge
#

i have site but i don't like it, who can remake it

#

??

remote swallow
#

assembley, webdev, spigot/java dev

pseudo hazel
#

well noone is gonna remake your site for free xD

lofty badge
#

i'm not joking

remote swallow
lofty badge
grave laurel
#

hey, I've got some problems with my config and I can't get it to work.. Can anyone help me with that?

pseudo hazel
#

what kinda problems

grave laurel
#

So basically I am making a plugin that uses the spigot config and as soon as someone joins his name should be saved i the config.

#

public class JoinListener implements Listener {

@EventHandler
public void onJoin(PlayerJoinEvent event) {
    Player player = event.getPlayer();
    if (!LaserTag.instance.config.contains("Coin." + player.getName())) {
        LaserTag.instance.config.addDefault("Coin." + player.getName(), 0);
        LaserTag.instance.saveConfig();
        LaserTag.instance.reloadConfig();
    }
}

}

remote swallow
#

use set

#

not addDefault

lofty badge
#

i need advanced css

terse pumice
#

how long does the spigot api take to update?

eternal oxide
#

5

terse pumice
#

5 minutes?

river oracle
#

no no just 5

terse pumice
#

5 breakdowns lol

river oracle
blazing ocean
terse pumice
#

that is many more numbers than i want

#

time to move over to spiget

river oracle
remote swallow
#

its either 30 min to like a few hours

river oracle
#

if you are uncertain about an answer you are bound to be more likely to give the correct one if you provide a large range

remote swallow
#

spiget is probably at the same limit

terse pumice
#

makes sense

timber crescent
#

for creatures, how can i make them not target one spesific player? id use the event system but i cant use it with what im doing

#

this is how im spawning them

Silverfish silverfish = (Silverfish) event.getPlayer().getWorld().spawnEntity(event.getPlayer().getLocation(), EntityType.SILVERFISH);```
shadow night
timber crescent
shadow night
#

oh

echo basalt
#
Player player = event.getPlayer();
Location playerLocation = player.getLocation();
World world = playerLocation.getWorld();

world.spawnEntity(playerLocation, EntityType.SILVERFISH);
worldly ingot
#

Well two of those are seriously unnecessary lol

timber crescent
kind hatch
#

@ivory sleet Same issue when moving the injection to the #onEnable() method.

orchid gazelle
#

hello again, maybe anyone new can help now. I am trying to set a command's permission message. The issue is that it will just give me "unknown or incomplete command" even though I registered the message via API, so Command#setPermissionMessage

fluid river
#

wha

#

show code and your input

lofty badge
#

who can help me? ```java
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (command.getName().equalsIgnoreCase("login") && sender instanceof Player) {
Player player = (Player) sender;
if (args.length == 1) {
String password = args[0];

            if (password.equals("testpassword")) {
                player.sendMessage("Auth successfully!");
                player.setWalkSpeed(0.2f);
            }

            else {
                player.sendMessage("Not your password!");
            }
        }

        else {
            player.sendMessage("Use: /login <password>");
        }
    }

    return true;
}``` my code. i need make it working with jdbc, who can help with this and register command
#

??

lofty badge
hazy parrot
#

Are you expecting someone to make whole system for you or?

#

This is not really a question which can be answered

lofty badge
#

bruh, i know how to work with this, idk about SQL

hazy parrot
#

Time to learn

lofty badge
#

I don't know what I should use to look up the password in the database

hazy parrot
#

Sql query

lofty badge
#

ok, guys, let me try. If I succeed I'll show the code

#

i think, i need new class for database code

#

my friend says it's good, because my main file will be clean

pseudo hazel
#

youll want a class for a lot of things

lofty badge
#

what about security? maybe i need pack passwords?

remote swallow
#

ideally you hash them

lofty badge
#

and why it's not working? @EventHandler public void onPlayerJoin(PlayerJoinEvent event) { event.getPlayer().setWalkSpeed(0); event.getPlayer().sendMessage("Enter password: /login <password>"); }

remote swallow
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

lofty badge
#

ok.. i found my error

chrome beacon
#

Why not use an existing login plugin

glad prawn
#

Have you registered for the listening event?

lofty badge
#

i forgot about getServer().getPluginManager().registerEvents(this, this); in onEnable

#

sorry guys

remote swallow
#

listeners should have their own class

lofty badge
#

it's bad code? ```java
public static String readPassword(String playerName) throws SQLException {
String playerPassword = "";
String query = "SELECT password FROM users WHERE name = ?";

    try (PreparedStatement statement = conn.prepareStatement(query)) {
        statement.setString(1, playerName);
        ResultSet resultSet = statement.executeQuery();

        if (resultSet.next()) {
            playerPassword = resultSet.getString("password");
        }
    }
    catch (SQLException e) {
        throw new RuntimeException(e);
    }

    return playerPassword;
}```
proper notch
#

I pretty please hope that password is hashed

lofty badge
#

tomorrow i want make it hashed

remote swallow
#

you should be running all io async

#

and to make it easier for yourself use completable futures

orchid gazelle
lofty badge
#

how to check if value exists in db?

statmt = conn.prepareStatement("select val1 from table1 where name = ?")

```?
remote swallow
#

execute query and check result set

chrome beacon
lofty badge
pseudo hazel
#

throw Exception or whatever

#

?learnjava

undone axleBOT
remote swallow
#

else the result set check and there you go

orchid gazelle
lofty badge
#
        String query = "SELECT password FROM users WHERE name = ?";

        try (PreparedStatement statement = conn.prepareStatement(query)) {
            statement.setString(1, playerName);
            ResultSet resultSet = statement.executeQuery();
        }
        catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }```?
chrome beacon
#

Exceptions are a wonderful thing. They can let your code recover from unexpected situations in a nice and clean way, if you use them properly. That does not mean that you should always rely on them though. For example, imagine this: Most highways have guardrails in the middle to avoid cars going into oncoming traffic....

hazy parrot
#

any reason why those methods are static ?

orchid gazelle
#

looks like a generic static method

#

why not?

hazy parrot
#

according to this code connection is also static

kind hatch
#

I don't get it man. Why won't it just display the toast?

hazy parrot
#

this is pretty much static abuse

orchid gazelle
#

isn't a mysql con like always static?

#

you just... access it

remote swallow
#

you should have a instanced class that handles sql stuff

quasi berry
#

or should I self-compile?

fluid river
#

jreefav

quasi berry
#

oh lmao

#

ty

quaint mantle
#

Can a dropped item have a velocity, ex to cleanly move across the ground

fluid river
#

well you can use blockdisplay in never versions

quaint mantle
fluid river
#

well i made some shit with dropped tnts

#

which rotated around the player

#

like magic orbs

#

so ig yeah drops can have velocity

quaint mantle
#

Im tryna make a conveyer belt for items (not pickable) and tryna figure out how to make it look clean to the user

fluid river
#

well you can try teleporting them each tick for sure

#

don't remember if you can actually apply velocity

quaint mantle
#

I feel like that would not look clean

fluid river
#

but well drops can be moved by water

#

so ig they have velocity

tall dragon
#

velocity can certainly be applied

#

but idk if u can get it to look nice

fluid river
#

^

zenith gate
#

how does the attack speed attribute work? it seems like any value i put in its just super fast.

fluid river
#

try using .0 values

zenith gate
#

i tried 0.0008 and its still fast

#

0.008

#

ive tried whole integers and its fast, like anything i put it registeres it as like half a second

quaint mantle
remote swallow
sick edge
#

What is the path I should enter in my plugin for creating a File object and the file itself is in the resources folder

remote swallow
#

JavaPlugin#getDataFolder

sick edge
#

It doesnt seem to get the resource folder but the folder in plugins

remote swallow
#

the resource folder doesnt exist as a folder, you would have to get the jarfile, use JavaPlugin#saveResource

eternal oxide
#

you can;t access resources in your jar with a file object. Do ^

sick edge
#

I am using getResource right now but I need to load nbt file

eternal oxide
#

why?

#

Structure file?

sick edge
#

Yeah isn't that the right way? Use getResource and then loadStructure() from StructureManager?

eternal oxide
#

are you getting a zip/zlib error?

sick edge
#

It seems to work well now that Im using getresource

quaint mantle
#

does JavaPlugin.getConfig() do Disk IO everytime it is run?

#

I am guessing it does not cache anything, it just goes to the disk to fetch info every single time?

eternal oxide
#

no

inner mulch
#

How can I change how a variable is defined under different circumstances?
example:

int num = 1 + 1;

if(math = false) {
   num = 2 + 1
}
print(num);```

console : (what i want to see)
3

I've tried it like this but it doesnt seem to work
quaint mantle
#

or is the config file loaded on startup then cached?

eternal oxide
#

its loaded on first access

quaint mantle
#

ok, i was reviewing someone's code, thought they were accessing the disk everytime a listener ran.

#

its been a while since I have worked with the Bukkit API.

inner mulch
#

i want to change a variable under circumstances

#

if the player has something then the variable isnt the default value it is something else

wraith apex
#

Is there anyway to bypass the distance requirement to open and edit a sign?

quaint mantle
#

what are the prerequisites for modding in minecraft? I know java, the basic stuff and pretty much can do most things in java, but modding in minecraft is different, it has no official documentation so you really need to know everything. What are ALL the prerequisites for doing this properly?

I just got this project that needs working outside of what the Bukkit ecosystem provides.

inner mulch
#

thanks for the response, this is an example, not the actual thing, its just to showcase what i mean by my question

bold swallow
#

having trouble with grief defender if anyone has some insight haha any helps appreciated

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

inner mulch
#

i have a value, if something is true the value changes, but for some reason it doesnt in my case

#

ok

#
        errors = new Errors();
        if(command.getName().equalsIgnoreCase("r")) {
            if(previousConvPartner.get(player) != null) {
                targetPlayer = previousConvPartner.get(player);
            } else {
                player.sendMessage(errors.noChatPartner());
            }
        }

        if(targetPlayer == null) {
            player.sendMessage(errors.nullTarget());
            return false;
        }```
This here is causing trouble, I made sure that there is something in the hashmap "previousConvPartner".
#

thanks for the advice, but doesnt the hashmap get cleared once the player leaves either way?

#

the value is still in the hashmap

#

but not assigned to anyone

#

the class is implementing a /msg and /r is used to reply

#

wait

#

why listener?

sick edge
#

How can I delete a world or make sure everytime a world is created the new world replaces a folder with the same name?
Should I unload and delete the folder?

inner mulch
#

ok, im using only a commandexecutor, no anything else

#

this was about the use of hashmaps

#

the problem in the command is, that targetplayer remains null even tho there is a player assigned to the other player via hashmap

#

when i use /r

#

i dont have any test players :( im doing it with my own acc only me, and i do stay on the server.

undone axleBOT
inner mulch
#

i think i got the problem, one second

#

okay so the line

if(command.getName().equalsIgnoreCase("r")) {```
doesnt activate when i use the alias /r
eternal oxide
#

getName will return the registered command

remote swallow
#

im pretty sure its the 3rd param for alias

eternal oxide
#

yes

inner mulch
#

ok

#

no

#

i registered the alias

#

it wasnt capital

#

thank you guys, looking for the aliases resolved the issue

#

can u explain why it would be better, if the hashmap clears after restart? (im just curios)

hazy parrot
#

wow

remote swallow
#

also you cause memory leaks holding old/expires players

hazy parrot
#

i was really scrolled up

inner mulch
#

doesnt it stay with a uuid too? or is it only with players

#

oh

#

yeah

#

i will change it

remote swallow
#

uuid is forever, player is temporary

kind hatch
#

Did you ever find a solution for this? Looking to solve a similar issue.
(pls ping if you respond)

river oracle
#

Trying to make a regex here how would I match any non digit besides /

#

I know to match any non digit you do [\D] but thats as far as I've gotten lol

#

ah! figured it out

#

[^\d\/]

quaint mantle
#

am i the only one who struggles to work with build tools?

#

is there a good guide on how to use build tools properly?

#

what did you all use to learn using build tools?

#

i was using maven, it uses xml which I actually understand but was kind of confusing to work with if you dont know what some the xml tags are for.

#

then gradle uses a format called groovy or whatever that I am not familiar with and is even more confusing, could have used json, xml or yaml.

weak meteor
#

Never used buildtools in my life

#

Just use maven its the most easy

#

And Minecraft Development Plugin in IntelliJ IDEA

quaint mantle
#

this groovy format only makes it worse for me right now.

#

i could at least read xml and know the structure of things.

kind hatch
#

If so

#

?nms

quaint mantle
#

no just build tools in general.

kind hatch
#

If you have any questions about the GUI, either ask in that thread or just ping me.

glacial ice
#

Iris is a custom world generator. I want to use some of the trees from the plugin and export them as a schem. However the files in the generator are like tree.iob anybody know how custom generators work. is there anyway I can rip the object from the source as a schematic.

quiet ice
kind hatch
trail geode
#

Hello I made a plugin in eclipse but how can i make lang foolder for plugin? The plugin it does not load the lang foolder and en.yml

How can i fix this?

vapid anvil
#

Is it possible to create a location-bound BlockState without using NMS?

hybrid turret
#

So I've tried around a bit but I don't quite get how I convert a PersistentDataContainer of an item in my main hand to CustomBlockData. I tried casting but that's not the way ig (am i missing a documentation or something?)

glacial ice
#

Iris is a custom world generator. I want to use some of the trees from the plugin and export them as a schem. However the files in the generator are like tree.iob anybody know how custom generators work. is there anyway I can rip the object from the source as a schematic.

hushed scaffold
glacial ice
#

For what I am doing it would be much more convenient to convert the iob file to a schem

jagged bobcat
glacial ice
jagged bobcat
hybrid turret
hybrid turret
#
  @EventHandler
  public void onUseKeyOnDoor(PlayerInteractEvent event) {
    if (event.getHand() != EquipmentSlot.HAND) return;
    if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return;

    Block block = event.getClickedBlock();

    if (block.getType() != Material.IRON_DOOR) return;

    BlockState state = block.getState();
    Openable ironDoor = (Openable) state.getData();
    ironDoor.setOpen(!ironDoor.isOpen());
    state.setData((MaterialData) ironDoor);
    state.update();
  }

Upon clicking the upper part of the door the door breaks and drops twice and when clicking the lower part of the door, it works as intended, why does that happen?

hybrid turret
hybrid turret
pseudo hazel
#

maybe you need to cancel the player interact event?

drowsy cosmos
#

Is there an Enum that consists of all weapons or tools? And enum that consist of all armor pieces? I want to compare them to ItemStack

hybrid turret
fallen lily
#

you can use Kotlin Script

#

and for dependency declaration use libs.versions.toml

hybrid turret
#

that's why two drop...

#

but how to fix that with the CustomBlockData, no idea... maybe alex or smile can help me later or sum

pseudo hazel
#

i.e. get the bottom part of the door and open it

kind coral
#

hello everyone i am trying to put my serialized itemstack (as byte array) into a blob inside my SQLite database, upon retrieving tho i get a data mismatch error

@Override
    public CompletableFuture<Collection<DatabaseItem>> readAll() {
        String sql = "SELECT * FROM registered_items";
        return database.asyncQuery(sql)
                .thenApply(resultSet -> {
                    List<DatabaseItem> registeredItems = Lists.newArrayList();

                    try (resultSet) {
                        while (resultSet.next()) {
                            String name = resultSet.getString("name");
                            byte[] itemData = resultSet.getBytes("serialized_item");
                            System.out.printf("Name: %s, item data: %s\n", name, itemData);
                            if (itemData == null || itemData.length == 0) continue;

//                            String className = itemClass.getClass().getName();
//                            String classSimpleName = itemClass.getClass().getSimpleName();
//
//                            System.out.printf("Class name: %s, class simple name: %s\n", className, classSimpleName);
                            registeredItems.add(new DatabaseItem(name, itemData));
                            Bukkit.getLogger().info("[HydraStorage] Loaded item: [" + name + "]");
                        }
                    } catch (Exception exception) {
                        exception.printStackTrace();
                    }

                    return registeredItems;
                });
    }

i also tried getting the class name and it has indeed returned me byte[] but upon getting the column it drops an error

lilac dagger
#

You might wanna base64 the array

lost matrix
lost matrix
lilac dagger
#

Ye

lost matrix
#

But i wasnt quite sure if this was only done because nbt looks like json/yml and messes with file structures

wicked steppe
#

hello

chrome beacon
wicked steppe
#

okayy

fluid river
#

jree fava

kind coral
#

btw the error is at the getBytes

kind coral
eternal night
#

I mean, what do you store in that table skully what is the table definition

kind coral
#

its just name of type varchar a blob which is called serialized_item

#

thats it

hazy parrot
#

varchar!=blob

eternal night
#

can you share the SQL to create the table 👍

kind coral
#

not 1

hazy parrot
#

Oh

kind coral
#
CREATE TABLE IF NOT EXISTS registered_items (name VARCHAR(64), serialized_item BLOB)
lost matrix
#

How does the insert query look like?

kind coral
#

lemme get that for you real quick

#
INSERT INTO registered_items (name, serialized_item) VALUES (?, ?) ON CONFLICT (name) DO UPDATE SET serialized_item = ?
eternal night
#

Ehhh

#

I wanna say you are getting clapped by CachedResultSet then

kind coral
#

why that?

eternal night
#

you might have to go over the #getBlob method on the result

kind coral
#

lul

eternal night
kind coral
#

i also tried getting the class name and it has indeed returned me byte[] but upon getting the column it drops an error

lost matrix
kind coral
# lost matrix How do you prepare the statement?
default void update(String sql, Object... objects) {
        try (Connection connection = getConnection(); PreparedStatement preparedStatement = connection.prepareStatement(sql)) {
            for (int i = 1; i <= objects.length; i++) {
                preparedStatement.setObject(i, objects[i - 1]);
            }
            preparedStatement.executeUpdate();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
lost matrix
#

Ive never used setObject like that. Are you sure it can properly infer a byte[]?
Might interpret it as a varchar.

kind coral
#

when reading the value i tried just getting an object and its name

#

and it has returned me a byte[]

#

so that is the datatype

#

else it would have returned me something different

eternal night
#

idk what prevents you from using getBlob honestly

kind coral
#

a ClassCastException

eternal night
#

how ?

kind coral
#

idk it just explodes

eternal night
#

what exception

kind coral
#

ClassCast

eternal night
#

No but like

#

casting to what

kind coral
#

B to Blob

#

yeah just B

eternal night
#

Like you obviously cannot cast it to a byte array

kind coral
eternal night
#

Well that depends a lot on the driver you are using

#

and their implementation of ResultSet

kind coral
#

SQLite

eternal night
#

yea but you are using a cached result set

kind coral
#

should i use a ResultSet instead?

eternal night
#

I mean, if you can

#

or you can just use the proper getBlob method

kind coral
#
String name = resultSet.getString("name");
                            Bukkit.getLogger().info("[HydraStorage] Loading item: [" + name + "]");
                            Blob blob = resultSet.getBlob("serialized_item");
                            if (blob == null) continue;

                            byte[] itemData = blob.getBytes(1, (int) blob.length());
                            registeredItems.add(new DatabaseItem(name, itemData));
                            Bukkit.getLogger().info("[HydraStorage] Loaded item: [" + name + "]");

ill try this approach

#

nice indentation by discord

eternal night
#

or just getInputStream and #readAllBytes

#

most driver implementations of ResultSet would be fine with just calling getBytes for a blob

#

but the cached result set might very well not be

lost matrix
#

getBytes should work on the ResultSet...

eternal night
#

but they are not on a result set

#

they are on a cached one

lost matrix
#

Unless setObject explicitly added a Blob

kind coral
#

i just moved to a result set

eternal night
#

ah

kind coral
#

instead of a cached one

eternal night
#

Then you should be fine yea

kind coral
#

ill try rn

#

DBeaver time

lost matrix
#

I would have 100% just made scrambled eggs with base64 and thrown it into a varchar at that point

eternal night
#
    /**
     * Indicates whether the given SQL data type is a binary type.
     *
     * @param type one of the constants from <code>java.sql.Types</code>
     * @return <code>true</code> if the given type is <code>BINARY</code>,'
     *         <code>VARBINARY</code>, or <code>LONGVARBINARY</code>;
     *         <code>false</code> otherwise
     */
    private boolean isBinary(int type) {
        switch (type) {
            case java.sql.Types.BINARY:
            case java.sql.Types.VARBINARY:
            case java.sql.Types.LONGVARBINARY:
                return true;
            default:
                return false;
        }
    }
#

btw

#

is the implementation on the caached result set

#

which, well, does not include BLOB

kind coral
#

VARBINARY is same as blob in sqlite afaik

#

i read it on documentation somewhere

#

now it just doesn't execute like the method is not getting called, some exception may be laying around

lost matrix
#

Sounds like CompletableFuture fun

kind coral
#

yes

#

apparently resultset is empty

#
@Override
    public CompletableFuture<Collection<DatabaseItem>> readAll() {
        String sql = "SELECT * FROM registered_items";
        return database.asyncQuery(sql)
                .thenApply(resultSet -> {
                    Bukkit.getLogger().severe("[HydraStorage] Loading all items from database");
                    List<DatabaseItem> registeredItems = Lists.newArrayList();
                    try (resultSet) {
                        Bukkit.getLogger().severe("[HydraStorage] Trying resultset");
                        while (resultSet.next()) {
                            Bukkit.getLogger().severe("[HydraStorage] Resultset next");
                            String name = resultSet.getString("name");
                            Bukkit.getLogger().info("[HydraStorage] Loading item: [" + name + "]");
                            Blob blob = resultSet.getBlob("serialized_item");
                            if (blob == null) continue;

                            byte[] itemData = blob.getBytes(1, (int) blob.length());
                            registeredItems.add(new DatabaseItem(name, itemData));
                            Bukkit.getLogger().info("[HydraStorage] Loaded item: [" + name + "]");
                        }
                    } catch (Exception exception) {
                        Bukkit.getLogger().severe("[HydraStorage] Exception");
                        exception.printStackTrace();
                    }

                    Bukkit.getLogger().severe("[HydraStorage] Loaded all items from database");
                    return registeredItems;
                });
    }
lost matrix
#

No data = No problem 👍

kind coral
#

HAHAHA

#

there is data tho

lost matrix
#

Im wondering if there is maybe an EOF char in there messing with the entry

kind coral
#

it whould have gone into the while loop at least once

#

but it hasn't

#

the ResultSet#next method has returned false

lost matrix
#

I hope you clear the DB and write a new item in there every time you change your serialization code

kind coral
#

wdym

#

i just cleared the db to test this out

lost matrix
#

I meant that you should not try to retrieve old items when your DB code changes.
But if you use a new item on each startup then its fine.

kind coral
#

oh nono i just deleted the database file, let the plugin create a new one and register some items, restart and then see if error pops up

lost matrix
#

I would stay with getBytes. Could you print out the SQL type after adding your objects to the PS?

kind coral
#

you mean on the insert?

lost matrix
#

-> PreparedStatement#getParameterMetaData()
-> ParameterMetaData#getParameterTypeName(int param)

lost matrix
kind coral
#

or from one

lost matrix
#

I would assume 1 bc SQL is just extra like that

opal sluice
#

Hello, does someone knows if when cancelling a task, the task object is still usable?

kind coral
#

yes it is

lost matrix
opal sluice
#

Ok perfect thanks 🙂

kind coral
#

fuuuuuuuuuuuuuuuuuuuuu

spare hazel
#

why is intellij saying cannot resolve symbol pr and its in the location of the keyword "private"

kind coral
opal sluice
kind coral
#

what the frick

#
String sql = "INSERT INTO registered_items (name, serialized_item) VALUES (?, ?) ON CONFLICT (name) DO UPDATE SET serialized_item = ?";
        database.asyncUpdate(
                sql,
                Pair.of(key, Types.VARCHAR),
                Pair.of(value.serializeAsBytes(), Types.BLOB),
                Pair.of(value.serializeAsBytes(), Types.BLOB)
        );
eternal night
#

I guess setObject isn't the vibe

kind coral
spare hazel
#
public void staticSpawnMethod(Location location, Player spawner){
        LivingEntity entity = (LivingEntity) location.getWorld().spawnEntity(location, this.entityType);
        entity.setCustomName(name);
        entity.setCustomNameVisible(true);
        stats.setEntityStats(entity);
        
        customSpawnFeatures(entity, spawner);
    }```

is this scalable enough for spawning custom entities? what can i change
kind coral
#

a function should only do ONE thing

#

just citing from Clean Code by Robert C. Martin

lost matrix
#

And making the class generic would also bring quite a few benefits

kind coral
#

got some beer

#

why the frick does setObject still give me VARCHAR as parameter

quaint mantle
#
me.
    skinnyooonie.
        characterwar.
            character.
                impls.
                    GuyOneCharacter.java
                    GuyTwoCharacter.java
                Character.java(interface)
                CharacterManager.java
            config.
                ServerConfig.java
                ConfigManager.java
            listeners.
                ConnectionListener.java
            CharacterWarPlugin.java

What do you guys think of this project structure so far? A Character here is basically a character, with its implementation; abilities, perks, etc

eternal night
#

the sqlite driver does not give a single shit about the passed type KEKW

lost matrix
#

Kind of

kind coral
#

what the fuck do i do then

lost matrix
#

idk. Throw hibernate at the problem? Probably overkill.

eternal night
#

skully I mean, setObject should be fine

lost matrix
kind coral
lost matrix
#

Thats the standard for serialized ItemStacks

eternal night
#

I mean, you don't have to b64

kind coral
eternal night
#

sqlite should support this

kind coral
#

"should"

lost matrix
#

Have you tried using an actual DB and see if it changes the outcome?

kind coral
#

sadly not because SQLite is the only one i can use atm

#

average shared hosting moment

lost matrix
#

You can be sneaky and start a containerized SQL instance via java

kind coral
#

how? never heard of that

lost matrix
#

Let me find the library. Ive used it in unit tests a few years back.

kind coral
#

thanks much 🙏🏼

eternal night
#

time to write up a minimal replication

kind coral
#

cool, ill check it rn

#

lemme go get another beer

lost matrix
#

Hmm. You might need to have docker installed for this to work.

kind coral
slender elbow
eternal night
#

Yea

#

setObject works great for me in a small local test

lost matrix
eternal night
lost matrix
eternal night
lost matrix
#

serializeAsBytes since when?

eternal night
lost matrix
#

Ah

kind coral
#

does it work for you?

eternal night
#

Yea

kind coral
#

what

#

how

lost matrix
# eternal night Yea

Now remove the types and try again.
But this is what i would have expected as well.

eternal night
#

I mean, again, types literally don't matter for the xenial driver

slender elbow
#

they literally don't lol

lost matrix
slender elbow
#

you can turn on "strict mode" but uh yeah no-one does that

eternal night
#

flame luck

#

why u no autodetect

slender elbow
#

ha

kind coral
#

ok i kinda rewrote the entire database implementation

#

so now i just hope it works

#

kinda like this

#

if that doesn't work ill just try mariabd or mysql

quaint mantle
#

I forgot a command package and other stuff

#

Also how do you manage permissions cause I don't like dynamic studf

#

like people will use getString("stuff.stuff.permisions.idk") and I feel like that's so bug prone

kind coral
#

OMFHJIKEWSRVGFUJKHWESKFDS

#

I DONT EVEN KNOW WHAT I HAVE CHANGED

#

i rewrote the implementation by accepting the types directly instead of objects

#

its way cleaner now

lost matrix
remote swallow
#

If return a void future for the voids

kind coral
#

i dont plan on using CompletableFuture methods but in the implementation there is the runAsync

#

with no return since i dont plan on using it

#

yeah i could migrate it but still

lost matrix
#

I would make everything sync and then call them methods from within a CF

remote swallow
#

CompletableFutute<Void> so you can do something when it finishes

lost matrix
# kind coral its way cleaner now
public interface DataAccess<K, V> {
  
  V getByKey(K key);
  
  void save(K key, V value);
  
  void delete(K key);
  
  void update(K key, V value);
  
  Collection<V> readAllValues();
  
}

Something like this maybe

eternal night
#

honestly, overkill half the time

lost matrix
#

More like 80%

eternal night
#

the slippery slope of writing your own ORM half the time is one I'd suggest avoiding

#

beyond that, why abstract eyes_zoom why u no interface

lost matrix
#

XD yeah ive been there. I realized "wait... this is just a document mapper im writing, right?"

#

But it spawned one thing i liked quite a bit. A map that automatically gets synchronized locally 😄

eternal night
#

trium ?

young knoll
#

Trim I assume

quiet ice
#

That is a thing now?

young knoll
#

Yeah

kind coral
ivory sleet
#

Yes

eternal night
#

already exists

#

@quaint mantle you are too slow xD

dry hazel
#

hmpf

eternal night
#

Aha

#

nah but that means you forked spigot KEKW

#

How the fuck do you add stuff to 1.19.4 without forking KEKW

#

bytecode edit via recaf ?

#

then you'd obviously have that method already

#

I mean

#

if you don't run spigot you run paper of one of its forks

#

which all have that method

#

best of luck

#

smart move

#

¯_(ツ)_/¯

#

A very non spigot take

sick edge
inner mulch
#

?paste

undone axleBOT
inner mulch
subtle folio
#

look at what armor the player is wearing, then profit

#

ArmorMeta i thinks

sick edge
#

Is there something like a spawnprotection for bukkit created worlds?

subtle folio
#

not sure, you can try creating a world and if it does then it does, but if not you can make one

sick edge
#

I would make a listener that checks the chunk of blocks

mellow snow
#

How can I put the same command in multiple different classes?

For example the command /test reload in one class, /test give in another and /test boom in another?

All this without there being any problems in the main

hazy parrot
#

Implement subcommand class with CommandExecutor and save it in Map<String, CommandExecutor>

#

And have one main executor which will get executor from map and run it

#

Key would be subcommand name

#

One of the ways

lilac dagger
#

I have git installed and it's also in the path, however buildtools still downloads their own, any idea how to fix this?

#

nevermind, i've added bin in the path and it works now

echo basalt
#

make a full command system for the sake of it

rough drift
#

It's surprisingly nice to do so

#

then switched to my coworker's because it's just better

echo basalt
#

It's not that hard if you understand how a tree works

young knoll
#

Well, first you plant a seed

peak depot
#

is there a way to see the final name of an renamed item in an anvil

remote swallow
#

Get result get meta get display nsme

slate tinsel
#

Can it be made so that the user can shoot with a bow without an arrow?

peak depot
rough drift
rough drift
#

I forgot the name of it

chrome beacon
sick edge
rough drift
#

Yes

#

You would maybe have something like

#
public abstract class CustomCommand {
  private final Map<String, CustomCommnad> children;

  // etc etc but you get the point
}
sick edge
#

But why is it better? xD

river oracle
#

an if statement is technically faster initially but as you add subcommands a map becomes more realistic

subtle folio
#

just wait until annotations :pog:

upper hazel
#

i try use BukkitTask but this not work for scheduleSyncRepeatingTask

subtle folio
sick edge
#

Ok yeah I agree to that but should I also have more CommandExecutors as @hazy parrot said or just a custom class

river oracle
#

true but I'm providing A reason. Also providing a reason you'd use that data structure it provides O(1) key value access which is perfect for sub commands

river oracle
#

otherwise I'd construct your own custom class and register with the command map using reflection

#

granted it also depends if you want to associate other data with your command

sick edge
#

Thx

kind hatch
sick edge
#

So the advancements are showing up in the manager? I'm not seeing any toasts but I forgot if there was a boolean for it 🤔

kind hatch
#

Not even that. They aren't showing up at all anymore. Even with chat messages and toast messages being enabled.
I'm back to packets because the bukkit implementation doesn't work due to immutable maps now being used.

sick edge
#

Yeah there is a bool for toast let me test rq I might actually want toasts xD

kind hatch
sick edge
#

Yeah the toasts work I'll try and see if I find smth

crude tulip
#

Hey! I am trying to check whether the block the player is standing in is a lava block AND a source block. A thread I came across from 2021 proposed this solution:

// Check if the block is lava if (block.getType() == Material.LAVA // block is a source block && block.getData() == 0 ) { // Turn lava into obsidian block.setType(Material.OBSIDIAN);

However, block.getData() is deprecated, is there a new syntax for this?

tranquil beacon
#

@kind hatch, sorry for the ping, but I wanted to ask you what has changed in 1.20.2 compared to 1.20.1 when it comes to spawning an NPC. I wanted to use the same method I was using in 1.20.1, but I can't; it gives me this error. Has something changed regarding the protocols? The error I'm getting is:
java.lang.NullPointerException: Cannot invoke "net.minecraft.server.network.PlayerConnection.l()" because "var0.c" is null
at this line:

listener.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, this));
sick edge
kind hatch
young knoll
#

That packet constructor requires the player to have a valid connection now

#

However there is another constructor that does not

sick edge
# kind hatch The actual advancement.

Seems to be similar to mine. Do you actually want to instantly grant the advancement so the toast pops up? I use grantProgress() on my AdvancementProgress but not sure if it is needed...

#

AH grant should work

#

Seems to be the same as mine hmm

kind hatch
sick edge
tranquil beacon
frank kettle
#

What's the easiest way of setting a player head owner?

I used to use before profiles for it but skullMeta.setOwner(name) was so much easier and I ended up using that all the time.

But recently when i updated the server from 1.20.1 to 1.20.2, this method is not working anymore, there's no error but the heads are showing default.

sick edge
sick edge
kind hatch
#

I can try that and see what happens.

kind hatch
sick edge
kind hatch
#

I'll try both in the same packet and a separate one.

kind hatch
kind hatch
#

Hmm, I think this is where it's starting to break down. Don't advancements with criteria usually have a number indicator? 1/12 or smth like that?

#

Separate packets didn't do anything either.

#

Criteria was added using

Map<String, Criterion<?>> advCriteria = new HashMap<>();
String adv = "{\"trigger\": \"minecraft:impossible\"}";
JsonElement jsonElement = ServerAdvancementManager.GSON.fromJson(adv, JsonElement.class);
    JsonObject jsonObject = GsonHelper.convertToJsonObject(jsonElement, "advancement");
    advCriteria.put("for_free", Criterion.criterionFromJson(jsonObject, new DeserializationContext(pluginKey.get(), new LootDataManager())));
sick edge
#

Try if this works in a map:

"for_free", new Criterion<>(new ImpossibleTrigger(), new ImpossibleTrigger.TriggerInstance())  
kind hatch
#

That works.

sick edge
#

Don't really know what you're doing up ther but can you somehow modify it xD

kind hatch
#

Idk what the difference really equates to either, but hey, that's less json I have to worry about lmao.
The toasts are now showing up though.

#

I have one thing that could have been interfering with this. Gotta do some testing to verify though.

sick edge
#

👍

inner mulch
kind hatch
# sick edge 👍

Thanks for the help though. Would have still been stuck figuring this out.

dire marsh
#

are you trying to do advancements via packets

#

it is hell

halcyon hemlock
dire marsh
#

and if you ever try to position the advancements, keep in mind that the y coordinate is relative (I don't remember in what way)