#development

1 messages · Page 65 of 1

icy shadow
#

if youre just using it, thats fine

formal crane
#

i use it like this

icy shadow
#

thats fine

proud pebble
#

if you were to do public class YourClass implements RecipeChoice thats not allowed, but just using it like you showed that is allowed

torn kraken
#

Hello everyone i get this error on my plugin java.lang.NoClassDefFoundError: net/dv8tion/jda/api/JDABuilder . That looks like a dependency problem but i've also <dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.0.0-alpha.22</version>
</dependency> as a dependency. How can i fix it

lavish sapphire
#

Any one need to make his own logo then dm me i can design logo what type of logo you want send me blue print i made that type of logo

#

Dm. Me if any one wanta

river solstice
#

no

worn jasper
#

Uhm quick question about redis, if I wanna use it as a cache, the "map" or whatever you call it, it's global right? so all connections have the same map?

river solstice
#

yes

worn jasper
icy shadow
#

?

worn jasper
# icy shadow ?

for "cache" storage, since all connections use the same map, what's the best way to "separate" them or "filter" them? Would adding a prefix before each key work for instance? IE. X-Key1, X-Key2 and Y-Key1

river solstice
#

yes

worn jasper
#

The question is, is that the best way of doing it?

river solstice
#

I'm not aware of any alternatives

icy shadow
#

multiple servers ig

river solstice
#

though there's also a category:subcategory:item practice

#
SET category:subcategory1:item1 value1
SET category:subcategory1:item2 value2
SET category:subcategory2:item3 value3
river solstice
#

with one instance

icy shadow
#

why would u need it to be global and distinct

river solstice
#

¯_(ツ)_/¯

#

ask afonzer

worn jasper
#

limited by client

#

¯_(ツ)_/¯

tardy cosmos
#

Somebody is getting this wild error is one of my plugins, seems like the method to spawn entities is just.. gone? huh? Purpur moment?
https://pastebin.com/0GG5P8Ya

tight junco
#

skill issue SNIFFA

tardy cosmos
#

have confirmed this is at least a purpur issue, trying to find what the actual patch is because it was fixed between the latest 1.20.1 purpur version and the current 1.20.2 version at some point

#

..this is also an issue with the latest 1.20.1 paper build

#

paper how could you do this to me

minor summit
#

don't compile against newer versions if the plugin runs on older versions

tardy cosmos
#

oh god

minor summit
#

if only there was some proper way for plugin/server versioning, something like, an api-version that was actually useful

tardy cosmos
#

well I need the latest API so looks like I'm doing a terrible cast here to the old consumer as a fix

minor summit
#

you need 1.20.2?

tardy cosmos
#

I guess technically not but I'm definitely going to need 1.21.0

minor summit
#

damn you living in the future or what

tardy cosmos
#

pretty much, yeah. just going to have to deal with fixing this again in the future I guess

minor summit
tardy cosmos
#

I'm not sure either, I'm just reverting back to building against 1.20.1 for now

minor summit
#

yeah that's not gonna work

#

you can do some reflection magic for sure

tardy cosmos
#

okie dokie they simply broke backwards compatibility, not the first time I guess

minor summit
#

i mean

tardy cosmos
minor summit
#

newer plugins were never guaranteed to work on older versions tho

tardy cosmos
#

I know backwards compatibility isn't necessarily guaranteed anyway

#

yeah

tardy cosmos
#

The 1.20.1 depend did fix it, thank you for the insight

marble heart
#

gg

worn jasper
#

how tf do you solve the Unsupported class file major version 65 error in gradle? Legit tried every single thing I could find and none worked lmao

worn jasper
#

already tried switching it like 5 times

hoary scarab
#

Does your IDE offer any quick fixes?

worn jasper
#

nothing

#

wait

#

bruh

#

just restarted it and deleted .idea

#

and it appears to work now

#

but... Could not resolve: io.papermc.paper:paper-api:1.20.2-R0.1-SNAPSHOT lmao

#

what's actually wrong bruh

#

I am like, 99.9% sure it's right

minor summit
#

specify the java.toolchain in your gradle build script to java 17+
don't run gradle with java 21

worn jasper
#

lol

minor summit
#

what is?

#

where

worn jasper
#

like 100% sure repo and dependency is right

#

so no idea what's happening

#

even with toolchain

hoary scarab
#

Isn't "1.20.2" R2?

worn jasper
#

nop

hoary scarab
#

Yeah IDK then. Did you say its fixed now though?

minor summit
#

share build script?

dusky harness
worn jasper
#

unsure what I even did lmao

#

it just works now?

#

clicked like, 5 times to rebuild

#

and at the fifth time it worked

#

?

#

lmao

atomic trail
#

Yes I know I shouldn't use 1.12.2, but ACF should still work?

fading stag
#

What would be the best way to save an item with all nbt tags? I mean is there any way to get item as json or byte array etc?

tawny sable
#

Has anyone listener the Quests event? I can't capture the "QuesterPreStartQuestEvent" no matter what.

#

I start my server, and I set a breakpoint in the Quests source code. I can confirm that Quests successfully executed this line of code.
final QuesterPreStartQuestEvent preEvent = new QuesterPreStartQuestEvent(this, quest);
plugin.getServer().getPluginManager().callEvent(preEvent);

#

But my code is not reflecting.
@EventHandler
public void questTake(QuesterPreStartQuestEvent event) {
IQuest quest = event.getQuest();
String description = quest.getDescription();
String name = quest.getName();

    log.info("questTake, {0}, {1}", name, description);
}

@EventHandler
public void dropItem(PlayerDropItemEvent event) {
log.info(event.getItemDrop().name().toString());
}

#

I can make sure my listener is registered properly because "dropItem" works fine

#

🥹

worn jasper
fading stag
worn jasper
#

if I am not mistaken

#

then you can use that for base64

fading stag
#

Thanks

worn jasper
#

np

atomic trail
#

This is probably very simple but can someone tell me why this doesn't copy the jar to the destination?

    register<Copy>("copyVald") {
        dependsOn(shadowJar)
        try {
            if (project.findProperty("destination") != null) {
                from(layout.buildDirectory.file("build/libs/" + "${project.name}-${project.version}.jar"))
                into(file(project.findProperty("destination").toString()))
                
                logger.log(LogLevel.ERROR,
                    "build/libs/" + "${project.name}-${project.version}.jar"
                )
            }
        } catch (_: MissingPropertyException) {}
    }
#

The log is called

#

At correct path btw

dusky harness
#

Same with the into

atomic trail
#

How do I check if file exists in kotlin?

atomic trail
dusky harness
#

Yeah

#

The variable is just for debug, u can remove later

atomic trail
#

I can call .exists() on toDir, but not fromFile, should probably just call File(whatever) first

dusky harness
atomic trail
#

Oh, only toDir exists

                val fromFile = file(layout.buildDirectory.file("build/libs/" + "${project.name}-${project.version}.jar"))
                val toDir = file(project.findProperty("destination").toString())
                logger.log(LogLevel.WARN, "TEST")
                if(fromFile.exists()) {
                    logger.log(LogLevel.WARN, "fromFile: " + fromFile.absolutePath)
                }
                if(toDir.exists()) {
                    logger.log(LogLevel.WARN, "toDir: " +  toDir.absolutePath)
                }
#

Hmm

dusky harness
#

Does the absolute path print valid?

atomic trail
#

Only the toDir.exists() returns true, and prints the correct path

#

So something is wrong with fromFile

dusky harness
#

Does from File absolute path print correct?

#

Like is it highlited blue in ij

atomic trail
#

Aha got it

#

Thank youuu

#

build is there twice

atomic trail
#

Nvm it does now

#

Only for the fromFile though

#

But it works

#

So ty

dusky harness
#

👍

dusky harness
atomic trail
#

Only for files within the project though it seems

dusky harness
#

🤨

#

Idk I don't remember

worn jasper
#

what's recommended to replace bukkit scheduler's timer? I know about swing's Timer, but is that the ideal one? Is there any better alternative? What are the differences? (preferably async)

sterile hinge
#

ScheduledExecutorService

worn jasper
#

Ty

rich stone
#

Can you look for a developer here for an assignment?

sullen acorn
#

how do i ban a player? The player to ban is called "victim", I have tried to use victim.ban() but idk how to do it, can someone help pls

hoary scarab
sullen acorn
#

by called i mean the variable is called victim

#

but thanks

#

what do you mean by /ban victim?

sullen acorn
#

thanks

dusky harness
#

there used to be a bot for it but its 🪦

#

🥲

sullen acorn
#

what would I put for source?

dusky harness
sullen acorn
#

is it the player that banned them?

dusky harness
#

ohh maybe?

#

I'm not sure

#

I'll look into it

dusky harness
#

not sure what it's used for though 🤔

sullen acorn
#

k thanks

fading stag
#

How can I use relational placeholders in my plugin? For example I want to use %rel_factionsuuid_relation% placeholder

dusky harness
fading stag
#

thanks

sullen acorn
#

I've been using this:
Bukkit.getPlayerExact(String.valueOf(victim)).ban("L", (Date) null, null, true);
to ban players, although when it is time to execute it, it doesn't work, any reason why? It doesn't give any errors, and it ignores the event.setCancelled(true) and let's me take it and move it around

dusky harness
#

that's likely not what you want

sullen acorn
#

if i dont use string valueof it just gives me the error "expected string given player"

dusky harness
#

what is victim?

sullen acorn
#

the player that was right clicked

#

it's a variable

dusky harness
#

what variable type is it?

sullen acorn
#

Player

dusky harness
#

dont use getplayerexact

#

just use victim.ban(...)

sullen acorn
#

i tried

#

didn't work

dusky harness
#

are you sure the code is running?

#

try putting like a print statement

#
System.out.println("banned " + victim.getName());
victim.ban(...);
#

for example

sullen acorn
#

alr

sullen acorn
proud pebble
#

reason is what will show up when they attempt to rejoin or the message on man, date is when the ban will expire, can be null for perm ban, source can be null or you can put your plugin name if you wish so if some other plugin checks the source itll display your plugin name

#

it can be null

#

so ban(null,null,null) is valid, will ban for default reason of ban hammer has spoken (i think), forever and no specific source

#

source is probs for something like plugin string name, player name of who banned them, etc

eager kestrel
#

Hi folks,
I'm trying to learn solidity, so I would appreciate it if you could send me a video on building a solidity environment.

sullen acorn
#

so i have a public list (public ArrayList<Player> list_of_flying_players = new ArrayList<>();), how can I use it in a different file?

#

it's currently in the file called "mzxfly" but I want to check it in the file "menuSystem"

#

nvm

river solstice
#

public ArrayList<Foo> bar = new ArrayList<>(); 😩😩😩

#

Liskov crying rn

#

@icy shadow tell em

icy shadow
#

um actually thats not what the liskov substitution principle means

#

that's a remnant of the sxtanna days, all of us were deceived

river solstice
#

🤓☝️

#

It is, shush

pure crater
#

LSP just means "objects of a superclass should be replaceable with objects of its subclasses without breaking the application"

#

i dont think its actually related to just replacing arraylist of list in this case

#

it's more about just if you replace it with List you can guarantee that the rest of your code will only use methods from the List class

#

so it's easier to use the same methods between different types of Lists

minor summit
#

LSP just means, if i have a func(List<T> l) and func uses function X on List, all List subtypes should abide to the contract of X and work without func "knowing"

#

basically, it's just interfaces and contracts

icy shadow
#

Yeah it’s more of an “axiom” than a design principle

#

It’s just how “lawful” code should work

dusky harness
minor summit
#

not really no

icy shadow
#

it’s not like using List for local variables is actually better

#

It makes zero difference

icy shadow
#

apart from slightly more brittle refactoring

minor summit
#

since when can local vars be public, hmm

#

idiot

icy shadow
#

Oh yea

#

shut up

minor summit
#

:(

river solstice
#

lol brister idiot

sharp cove
#

hey

#

does someone know ifjava PotionEffect​(PotionEffectType type, int duration, int amplifier)
the duration is in ticks or seconds?

#

i think its in ticks right?

river solstice
#

ticks

sharp cove
#

Thx

proud pebble
#

the spigotapi javadocs usually say what the parameter does

sharp cove
#

Ah

#

Read over it

#

Sorry

royal hedge
#

not that that's that useful without dependency injection

icy shadow
#

SOLID principles are kinda cringe anyway

dusky harness
#

?solid

neat pierBOT
icy shadow
#

"ummm implementations should follow the defined contracts" YES thats why its called a contract

#

LOOK at what object oriented programmers have been doing with your money

icy shadow
#

meanwhile in REAL languages it is quite literally impossible to write unlawful code (in some cases)

fading stag
#

What is the best way (or at least a way) for loading libraries dynanically (Spigot). For example I provide more than one database option and all of them have different drivers, is there any way to make Spigot download and use my drivers according to user's selection (for example from config etc)

dusky harness
#

I think it's 1.17+

fading stag
#

Just using libraries: in plugin.yml and loading? Right?

fiery pollen
#

I'm setting up a mc server in Oracle and I got it all setup, but I can't seem to get the ports working. I enabled the ports using firewall-cmd, and it shows at firewall-cmd --list-all.

sudo ss -ltn also shows that the port is open. But whenever I try to join, or ping the server at that port. It says the port is closed. (Port 25565)

dusky harness
#

ubuntu doesn't have firewall-cmd by default I don't think

fiery pollen
#

Uhm, no idea. I'm trying to login into the cloud but oracle cloud is taking ages to load. But I've also tried using ufw

dusky harness
#

similar to port forwarding on your local network, you have to open the port on Oracle website as well

fiery pollen
#

Oh, I actually have to open it on oracle?

dusky harness
#

yeah
it's some subnet setting

#

1 sec

#

on the vps instance details, click the virtual cloud network

#

then click the subnet

#

then default security list

#

then add an Ingress rule

#

Source CIDR: 0.0.0.0/0 and edit source port range to 25565

#

or you can do what I do and just allow all protocols and leave Source port range empty as well 🙃

fiery pollen
#

Alright sounds good, thanks a lot

#

Is it normal that it stays on this screen for like 5 min?

#

It won't load me into the cloud for some reason

minor summit
#

uh no

fiery pollen
dusky harness
fiery pollen
#

Yeah

dusky harness
#

might be a firewall issue then
You're not using both ufw and firewall-cmd, right?

fiery pollen
#

Yeah, I might have them both installed on the VPS

dusky harness
#

uhh

#

which one did you configure

fiery pollen
#

Both

dusky harness
#

ok try sudo ufw disable

#

and sudo systemctl restart firewalld

#

(firewalld is firewall-cmd i think)

#

so that they're not conflicting with each other

fiery pollen
#

Alright, just did that. The second command, didn't return any message tho but that's probably normal. (Also I'm checking if the port is open using https://portchecker.co/checking, I hope that's fine?)

#

On the site it's still showing as closed

dusky harness
fiery pollen
#

Oh, let me start the server rq.

#

Yeah, it's working now, thanks a lot

fiery pollen
#

So I am using the oracle cloud free services with the OCPU count of 4 and 24GB of memory. And I would like to have like a small hub server, a bungee and a skyblock server. Would it be better to install Pterodactyl to have a good view over all the servers. Or should I just create them all in the VPS and let them run like that.

sterile hinge
#

Doesn’t really matter, the performance won’t be great

torpid raft
#

but technically you should see better performance (assuming you have all the same jvm flags set, etc) if you deploy them on the bare server instead of through docker

#

overall i think ptero is probably worth it, the performance difference is not going to be that big and it'll be nice and easy to do stuff if you don't want to cozy up to the various linux command line tools too much

signal grove
#

is it expensive to frequently call plugin.getConfig().getDouble(), wondering if i should cache the value or it's "good enough"

night ice
#

It’s not that expensive of a call, the yaml would be already loaded to the memory on the startup. It’s not like every time you call, the plugin needs to read the file from the disk.

But, imo you can cache it if it’s not too hard. I don’t know exactly how Bukkit’s configuration retrieves the value

#

Also a getter would be far more better in terms of maintainability and readability, than hardcoding the configs node path in all the places you are gonna call those config value

signal grove
#

thanks

sharp cove
#

Hey is this still a correct way to get a player his UUID? (offline player)

    public static UUID getOfflinePlayerUUID(String playerName) {
        OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(playerName);
        if (offlinePlayer.hasPlayedBefore()) {
            return offlinePlayer.getUniqueId();
        } else {
            // Speler heeft nog nooit gespeeld, UUID is niet beschikbaar
            return null;
        }
    }

    public static void main(String[] args) {
        String playerName = "SpelerNaam"; // Vervang dit met de naam van de speler waarvan je de UUID wilt weten
        UUID playerUUID = getOfflinePlayerUUID(playerName);
        if (playerUUID != null) {
            System.out.println("De UUID van speler " + playerName + " is: " + playerUUID.toString());
        } else {
            System.out.println("Speler " + playerName + " heeft nog nooit gespeeld en heeft dus geen UUID.");
        }
    }```
#

Or do I need to use the mojang API?

icy shadow
#

thanks charles

torpid raft
#

what a nice man

lyric gyro
#

If I’m trying to make a plug-in that the total blocks forward(not left to right just forward) a crossbow or bow shot is IF IT HITS SOMEONE and they are hit once how would I do that
Explanation
I shoot crossbow into somone 5 blocks away from me straight they then strafe 2 blocks Side to side then go up 3 more before being hit it should calculat 8 how would I do that

worn jasper
#

There are ways to avoid memory leaks or smt, like you can delete that variable after x seconds or whatever

lyric gyro
dusky harness
worn jasper
worn jasper
dusky harness
#

oops just edited my message 🥲
is the 'yes' still true

dusky harness
# lyric gyro yes

spigot provides a distance method on Location (ex loc1.distance(loc2))
So you can make like a HashMap<UUID, Location> to store the hit locations (google HashMap for more information)

Beyond that, I'd need more information

stuck canopy
#

is there any library similar to SlimJar available for Maven?

river solstice
#

nice ping

pulsar ferry
#

We get it, you vape

stable topaz
#

Hey, question. Im using getConfig() to save and load my config. but im having trouble with the data after a reload

#

Its lost, anyone knows why?

#
@Override
    public void onDisable() {
        for (ZooFeeAnimal a : AllAnimals){
            a.HolographicName.removeAll();
        }

        Bukkit.getScheduler().cancelTask(growTaskId);

        saveConfig();

    }

My on disable

delicate hatch
#

hello everyone, how does one set up xc and xv after installing paper 1.18.2, the dependencies and jars?

#

i would appreciate the help a lot

proud pebble
#

xc and xv?

dense drift
#

Xmx and Xms ?

delicate hatch
#

yea

river solstice
#

guns 😱

delicate hatch
#

yep!

#

can someone help me plz i would appreciate it lots

delicate hatch
#

i can provide the jars if u want

river solstice
#

nah, ty

delicate hatch
#

i have no idea how to get this to work

#

i really want my sv to have ww1 ww2 vibes and i need this plugin

river solstice
#

guns bad - illegal

delicate hatch
#

british

#

british no like gun

#

but im uruguayan hehe

#

topfu i saw u texting, do u know anything about the plugin? :0

void orchid
delicate hatch
#

i already have the jars built tho

#

let me try again

#

ill build it again

#

also i have paper 1.18.2 as asked by the readme

void orchid
#

Then what's the issue? Is it not being recognized as a plugin or something?

delicate hatch
#

like

#

xc got installed but there is no guns nor anything

#

xv didnt even created a folder

void orchid
#

Look at the server's console, there is most likely an error there

delicate hatch
#

ur right

#

ill check!

#

thx for the help :D

#

GENIUS

#

sorr

#

sorry*

river solstice
#

who could've though that there might be errors in the console

delicate hatch
#

fro the caps

delicate hatch
#

like

#

yeah ur right

river solstice
#

I mean it should be first thing to do

#

instead of going to discord to ask for help

#

where you will be asked to check the console for errors

delicate hatch
#

im a newbie at making MC servers once again tho so plz be patient haha

delicate hatch
#

hello again everyone, hope ur having a good evening.
Does anyone know about a dynmap addon that adds towny towns to the dynmap? dynmap-towny doesnt support 1.18.2 apparently

river solstice
#

i dont

proud pebble
#

or check for an earlier version of it that does

#

cus its unlikely that they never supported 1.18 unless it was left unmaintained untill 1.19 came out or smth

delicate hatch
delicate hatch
#

ill keep searching

dusky harness
delicate hatch
#

sorry for the incorrect use of the channel, thanks for the info!

spiral mural
#

So I am having trouble trying to link plugins with my maven dependency (this is the pom of the Main plugin).
In other plugins I can't call JavaPlugin class, or the static method from this plugin. I get i either java.lang.ClassCastException: Cannot cast me.albusthepenguin.mines.Mines to me.albusthepenguin.mastery.Mastery at java.lang.Class.cast(Class.java:3889) ~[?:?] at org.bukkit.plugin.java.JavaPlugin.getPlugin(JavaPlugin.java:431) ~[slimeworldmanager-api-1.20.2-R0.1-SNAPSHOT.jar:?] at me.albusthepenguin.mines.Mines.onEnable(Mines.java:42) ~[Mines-1.0.jar:?] with the class call, JavaPlugin.getPlguin(class) <- and with a static instance of the class I get java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "masteryPlugin" is null.
https://paste.helpch.at/zaxosuselu.xml (fixed)..

tight junco
#

Anyone here have experience with SmartInvs, specifically creating like a storage gui using it

proud pebble
#

also have you made sure that the plugin you are trying to hook into is being set as either a depend or softdepend

#

so if your trying to hook into Mastery from Mines, you would set Mastery as a depend or softdepend in the plugin.yml of Mines

shell moon
#

what this might mean?

org.bukkit.plugin.IllegalPluginAccessException: Unable to find handler list for event org.bukkit.event.player.PlayerEvent. Static getHandlerList method required!
the event being registered is really basic, this one:

public class KitSelectEvent extends PlayerEvent implements Cancellable {
    private static final HandlerList HANDLERS_LIST = new HandlerList();
    private boolean cancelled;
    public KitSelectEvent(final Player player) {
        super(player);
        this.cancelled = false;
    }
    public boolean isCancelled() {return this.cancelled;}
    public void setCancelled(final boolean cancelled) {this.cancelled = cancelled;}
    @Override
    public HandlerList getHandlers() {return HANDLERS_LIST;}
    public static HandlerList getHandlerList() {return HANDLERS_LIST;}
}

sterile hinge
#

where does the stacktrace come from? Are you trying to listen to PlayerEvent?

shell moon
#

Code is literally on main class

    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(new KitSelectListener(), this);
    }

and listener is

public class KitSelectListener implements Listener {
    @EventHandler
    public void onKitSelect(KitSelectEvent event) {
        Bukkit.getLogger().warning("Kit Selected");
    }
}
spiral mural
sterile hinge
shell moon
#

updated to 1.20.1 spigot as dependency, seems to work

#

i'll have to test now using java 8 in server to make sure nothing broke in old versions

#

thanks for the reply ^^

loud token
#

I'm looking to hire experienced Plugin Configurators

tight junco
proud pebble
#

is there a way to convert MyClass.class to new MyClass(para1, para2) so i dont have to do MyClass.class.getConstructor(...)?
im trying to add a object type as an id so i can create an object of that type using its constructor so i dont have to make a massive switch statement of strings to get the relative other object

hoary scarab
#

I don't think so. I think a constructor would be required in that class.

proud pebble
#

basically im trying to copy how ItemStack and ItemMeta classes work to implement it for my custom items, ive searched through how bukkit handles getting a relative ItemMeta object from the item's id (Material) and it looks like they hardcode a switch statement of

switch(Material) {
    case LEATHER_HELMET, LEATHER_CHESTPLATE, ... -> new CraftLeatherArmorMeta(item.getTag());
    ...
}
#

for example this

#

actually

#

i think i figuredd out a method just now

#

ill just make a method that i can override to give whatever meta its supposed to have

#

which means i dont have to make the massive switch statement

#

since itll call the owner class of that method anyways

graceful hedge
#

Isnt there like an ItemFactory or sth that does just this

proud pebble
#

my own impl

graceful hedge
#

Oh

#

Nvm im goofy

proud pebble
#

ive done it for a couple different projects

#

i like how the item modification works with ItemStack and ItemMeta so why not just use their concepts to allow for my own metas to exist

graceful hedge
#

Myea

proud pebble
#

ofcourse without extending itemmeta cus idk if thats even legal to do so

graceful hedge
#

yeah ik internals don’t always like being extended and implemented left and right lol

graceful hedge
proud pebble
#

basically

graceful hedge
worn jasper
#

[16:48:11 ERROR]: Thread Craft Scheduler Thread - 14 - BDiscord failed main thread check: command dispatch java.lang.Throwable: null just wondering, is this cause I can't dispatch a command async?

sullen acorn
#

why is uploading files actually not allowed

dusky harness
sullen acorn
#

imgur is a pain tho

dusky harness
# sullen acorn imgur is a pain tho

It's to prevent spam, once you're tier 2, you will have permissions
Also if you have a program such as ShareX, it uploads your screenshots to imgur automatically

sullen acorn
#

how does it prevent spam exactly?

dusky harness
#

So I usually end up sending imgur links anyways even tho I have perms

dusky harness
#

I'm not staff btw

sullen acorn
#

what

#

ok then

#

So I have this if statement, how do I turn it into a switch statement? I'm planning on making multiple of these if statements and someone told me to use switch but idk how

dusky harness
sullen acorn
#

yes

dusky harness
#

(just did for embedding)
You can do ```
switch (event.blah().getDisplayName().toLowerCase()) {
case "name"
}

#

Lowercase is to ignore case

sullen acorn
#

thanks

dusky harness
#

Google switch statement and try going based off my incomplete code 🥲

sullen acorn
#

doesnt work

dusky harness
#

Show code and hopefully someone else can help

#

And error

#

Or be more specific

sullen acorn
#

it simply doesnt do anything

#

as if the item i clicked wasnt named "Kits menu"

#

probably because the item has the color "blue" while the swtich statement is looking for the text without a color

#

I tried doing case case ChatColor.BLUE + "Kits menu": but that doesnt work

#

says "Constant expression required"

sullen acorn
#

ive got it to work now

#

just had to remove the color from the item

#

which isnt that big of a deal

sturdy elbow
#

does anyone know how to disable a hover+clickevent after you click them once for adventure components

proud pebble
#

you cant get rid of the hover and click from the message since you cant modify messages that have already been sent

#

you can only prevent them from accessing whatever when clicked

teal saffron
#

Does anyone know how to track whether a player has moved an item from a spexific chest into his inventory and if he has moved a specific amount of diamonds back into the slot?

uneven needle
#

That's never gonna be true

sullen acorn
#

well it worked

#

oh yeah i removed the .toLowerCase

#

didnt need it

sullen acorn
#

So i have these custom items, and I don't want them to stack so I want to add a custom "tag" to it in the lore, i want it to look something like this, how do I go about doing that?
https://imgur.com/mZoeBkB

#

I was thinking about using random?

mossy shard
#

Hey, I'm using Triumph GUI and I've been wondering how I can make "dynamic" items with a PaginatedGui.

For example, if the player's on the first page, the "previous page" item shouldn't be shown and instead be empty/another item. Same with "next", if the player's on the last page. Is there a way I can add this?

Thanks in advance

mossy shard
brazen rain
#

Trying to learn Kotlin for MC plugins and for some reason .isOP and .sendMessage aren't a thing according to IntelliJ, the error is "unresolved reference".

broken elbow
vale gate
#

Hello, Im not sure if this issue is with PlaceholderAPI or not but I would like your advice.

So the issue Im experiencing is that whenever I use a placeholder from within a local placeholder expension(from a different plugin like ItemsAdder or DiscordSRV) in one of my plugin messages, it seems to not work on server startup.
Like directly after the server restart my placeholders aren't working, they only start working out of them selfs after like a minute or two after server restart(even when requesting them 100 times).
Though, what is weird is that whenever a different plugin uses the placeholders or even /papi parse --null <placeholder> it works fine. And hell after /papi parse my placeholder in my plugin start working.

I've tried alot of different things and maked sure my placeholders are parsed after PAPI and its expensions, but Im unable to find a reason for why it does this.
I hope you can help me, thanks.

dusky harness
vale gate
#

I've tried alot of different things and maked sure my placeholders are parsed after PAPI and its expensions
Like I sayd ^^
I even tried to schedule a task 200 ticks after server startup and it still doesn't work

#

2000 ticks on the other hand works, but this has the same affect as waiting for the placeholders to start working

dusky harness
#

Oh huh

vale gate
#

Yea, Im kinda speechless as I don't know what to try next.
I was wondering if I overlooked something obliviously so thats why I came and ask here

#

Even if DiscordSRV triggers a message(send by my plugin), the placeholders don't parse, but after a while they start working for some odd reason.
The weird thing being, is that /papi parse makes them work magically

#

Its like /papi parse inits the expension or some, but I looked at github and it doesn't do anything different then PlaceholderAPI#parse

dusky harness
vale gate
#

I mean, that might work as a workaround, I will test it soon and let you know if it worked

hoary scarab
#

Its possible the local placeholders are awaiting to be loaded by placeholderapi. These plugins likely softdepend on it and you should use it to so all placeholders should be loaded by the time you try to access them.

vale gate
#

I would think that to, but then still, these is no reason that /papi parse always works for the first time, even directly on server restart

lavish sapphire
#

I can help you in video editing and logo editing dm me for more information

vale gate
# dusky harness Lol what if you Bukkit.dispatchCommand?

Doesn't work either, see this where I test the placeholder using /papi parse which works and followed by my plugin executing a delayed task which tries to parse the placeholder:

[18:39:16 INFO]: 
[18:39:18 ERROR]: [EconomyShopGUI-Premium] [STDERR] %img_test% - true```
proud pebble
vale gate
#

This is my code for testing the placeholders:

for (int i = 0; i < 100; i++) {
            System.err.println(PlaceholderAPIHook.translate(p, "%img_test%"));
        }
proud pebble
vale gate
#
public static String translate(OfflinePlayer p, String message) {
        System.err.println(message + " - " + PlaceholderAPIHook.enabled);
        if (!PlaceholderAPIHook.enabled || !PlaceholderAPIHook.plugin.placeholders)
            return message;

        return PlaceholderAPI.setPlaceholders(p, message);
    }
proud pebble
vale gate
#

Yep, I just looked at it and thought by myself "Im a moron" :p

#

Trying it now..

#

Well, thank you, I guess I shouldn't be coding at 4AM...

#

I feel so emberased now lol

proud pebble
vale gate
#

Yes, since PlaceholderAPIHook.plugin.placeholders loads delayed

proud pebble
#

if statements can be the most frustrating thing when you expect them to be true, but actually they are false for some dumb reason and you can think your code after it is broke and its not

#

like for awhile i didnt know InventoryDragEvent existed which was fucking with my first interactable menu i ever made

vale gate
river solstice
#

before calling X and expecting it to return Y, you should know what X behaviour is in A, B, C, etc. situations. of course this cant always be applied (though most of these imo should be/are usually covered by tests, either by mocking/stubbing or in a working environment), but you get the gist

#

or dont code at 4am, that usually fixes the problem

proud pebble
vale gate
#

True, thank you guys. For helping me debug my own code :p

proud pebble
#

if you fixed your issue, or atleast diagnosed it and can figure out a fix then i say it was well worth it

craggy zealot
#

how can i do client side builds?

#

like only a user can see these builds

dapper jackal
#

Hello, can I take a question about minecraft packets and protocole libs here? or just about helpchat's plugins?

hoary scarab
#

Anything related to development. (Following topic rules ofcourse)

proud pebble
#

either manually through nms or by using something like protocollib or packetevents

dapper jackal
#

Well, I am begginnrr in protocollibs . To train i Try to make the equivelent of the spigot event "PlayerCommandSendEvent". I have check I think its https://wiki.vg/Protocol#Commands
so the commands are more or less stored in "nodes" but nodes is a custom object, isn't it? (I can't find it in the libs protocol methods. So which packetcontainner method do I use to retrieve commands?

light wing
minor summit
# dapper jackal Well, I am begginnrr in protocollibs . To train i Try to make the equivelent of ...

for protocollib i'd suggest using PacketWrapper https://github.com/dmulloy2/PacketWrapper they are type-safe packet wrappers with plib "WrappedXxx" types with all the necessary getters and setters, but you don't need to fiddle with indices or anything
as you can see in the wrapped commands packet https://github.com/dmulloy2/PacketWrapper/blob/master/PacketWrapper/src/main/java/com/comphenix/packetwrapper/WrapperPlayServerCommands.java there is no "special" getCommands in PacketContainer, it's just brigadier's RootCommandNode directly (since it's technically not "nms internals" so it doesn't really need a wrapper representation)

dusky harness
#

It's not always up to date but it can be very useful

#

It shows examples/utils to use protocollib

dapper jackal
dusky harness
#

Oh

#

Emily already said

dapper jackal
#

packwraper add an abstration couche at protocolib?

dusky harness
#

Not sure what a couche is but I think so, yes

dapper jackal
#

yes not really couche

dapper jackal
dusky harness
#

Work with

dapper jackal
dusky harness
#

It shows you how to use protocollib

#

I wouldn't recommend using the wrapper itself since it can be wrong/outdated sometimes

#

So look at the wrapper code to see how it works and use it in your code

dapper jackal
#

okay

dapper jackal
minor summit
#

I recommend not looking at wiki.vg when working with protocollib, wiki.vg shows you the encoded byte stream that is sent to the socket and goes over the network, protocollib simply allows you to use the Packet java objects/classes and its java fields without having to use reflection and weird names, this is before it is encoded and is why PacketWrapper is useful. wiki.vg is not useful at all when working with plib

#

The type is, like PacketWrapper shows there, a RootCommandNode, it is a Java class you can access and it is part of Minecraft's command framework https://github.com/Mojang/Brigadier

minor summit
#

yes

dapper jackal
#

So you're telling me not to use packet warper but to see how it works to do the same thing with the protocollib??

dapper jackal
minor summit
#

yeah

#

PacketWrapper is fairly dated but it's still a good reference for some stuff

dapper jackal
dapper jackal
# minor summit yeah

well i found that here
https://github.com/dmulloy2/PacketWrapper/blob/master/PacketWrapper/src/main/java/com/comphenix/packetwrapper/WrapperPlayServerCommands.java#L43

I did pretty much the same thing


        protocolManager.addPacketListener(new PacketAdapter(
                this,
                ListenerPriority.NORMAL,
                PacketType.Play.Server.COMMANDS
        ) {
            @Override
            public void onPacketSending(PacketEvent event) {
                PacketContainer packetContainer = event.getPacket();
                Player p = event.getPlayer();

                //extracting infos
                RootCommandNode node = (RootCommandNode) packetContainer.getModifier().read(0);
                System.out.println(node);

            }

        });

    }```

but on load I got 
java.lang.ClassCastException: class java.lang.Integer cannot be cast to class com.mojang.brigadier.tree.RootCommandNode

an integer Can't an object be cast regardless of the child?
dusky harness
#

You want the 2nd value

#

So do read(1) and not read(0)

dapper jackal
# dusky harness So do read(1) and not read(0)

so i found this
https://github.com/dmulloy2/ProtocolLib/issues/1646

and I have make this code but I got an com.comphenix.protocol.reflect.FieldAccessException: Field index 0 is out of bounds for length 0 at com.comphenix.protocol.reflect.FieldAccessException.fromFormat(FieldAccessException.java:49) ~[?:?] at com.comphenix.protocol.reflect.StructureModifier.read(StructureModifier.java:245) ~[?:?]

error generated by InternalStructure commandInfo = subCommand.getStructures().read(0);

            public void onPacketSending(PacketEvent event) {
                PacketContainer packetContainer = event.getPacket();
                Player p = event.getPlayer();
                //extracting informatdions from the packet
                //RootCommandNode node = (RootCommandNode) packetContainer.getModifier().read(0);
                int rootIndex = event.getPacket().getIntegers().read(0);

                StructureModifier<List<InternalStructure>> lists = event.getPacket().getLists(InternalStructure.getConverter());
                List<InternalStructure> commands = lists.read(0);

                int[] subCommands = commands.get(rootIndex).getIntegerArrays().read(0);
                for (int i = 0; i < subCommands.length; i++) {
                    InternalStructure subCommand = commands.get(i);
                    InternalStructure commandInfo = subCommand.getStructures().read(0);
                    String commandName = commandInfo.getStrings().read(0);

                    if (commandName.equals("help")) {
                        System.out.println("help");
                    }
                }

                }
#

is an internal problem? (in protocolib)

dapper jackal
#

i'm desperate now I generate an error instead java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "generic" is null

I deduce that commands with protocollibs can't work after 1.19 and I have to conctact the dev?

dusky harness
#

Also ignore my other response

#

The 1 instead of 0 one

dapper jackal
#

the problem line is

InternalStructure commandInfo = subCommand.getStructures().read(0);
yes the devlopper has givent it in a commit but was for 1.19 maybe no work in 1.20?

minor summit
#

it is possible that the packet class structure has changed

#

why are you doing this anyway?

waxen sigil
#

Can I return a Component instead of a string in the placeholder?

dense drift
#

no, but you can return a MM string if that helps

dapper jackal
# minor summit why are you doing this anyway?

to learn packets, and also to redefine commands via the sendcommmand PlayerCommandSendEvent event is not sure, there are client to get server plugins without /pl because when you use PlayerCommandSendEvent event if you remove certain command. Theys command will still be sended to the client, i want avoid that

dapper jackal
dapper jackal
#

ah I thought the changes were in protocollib

dusky harness
#

I haven't looked at the github issue yet so idk protocllib has support for it

dapper jackal
dusky harness
#

hm, then I'm not sure why it doesn't work

dapper jackal
#

yes stranger (I don't get the same errorall the time)

#

what I have to do ? open an issue in the project?

fading stag
#

Litebans says "All punishments made through LiteBans will take effect globally across all servers linked to the same database."
What would be the best way to implement something like that? Checking db every second for new records?

proud pebble
#

like if you own a copy of litebans you could open it up with jdgui or recaf to see what they do

#

afaik its not obfuscated

minor summit
#

i think what they mean is more of a message queue system

#

e.g. you ban someone playing in Server1 while you're in Lobby2 or w/e

fading stag
#

I understand they are not caching and querying, which makes banning in one server affects the other but I didn't understand how can it send the message to other server

hoary scarab
#

Probably sends a pluginmessage to the other servers

hoary scarab
#

yes

agile rampart
#

Hey, anyone know a way to paste worldedit schematic so that only a specific player can see them? Similar to player#sendBlockChange however I want it to work with schematics.

minor summit
#

you'd want to create an Extent that delegates the setBlock call to the (worldedit) Player#sendFakeBlock

minor summit
#

uh that's not standard worldedit API, idk what you're using

#

but you want to create your own Extent class

river solstice
flat tendon
agile rampart
craggy gale
#

Hey guys, i'm working on a plugin for the first time since 2015, I'm trying to set a block at a players death location but I'm facing some issues:
location.getBlock().setType(Material.OAK_PLANKS);

DOES NOT WORK... it gives the error: The method setType(BlockType<?>) in the type Block is not applicable for the arguments (Material)

Any reason on why this is?

proud pebble
craggy gale
proud pebble
craggy gale
#

Eclipse

proud pebble
craggy gale
#

ohh your talking about what built the spigot.jar for the library?

proud pebble
#

your not using a buildtool?

#

like gradle or maven

craggy gale
#

I used the buildtool program from the spigot site to build the .jar I am using

proud pebble
#

to compile your plugin

craggy gale
#

... you dont just export it in eclipse?

proud pebble
#

gradle or maven is the go to way to compile your plugins nowadays

craggy gale
#

I'm to too concerned about 45mb lol for a basic plugin like this

proud pebble
craggy gale
#

How would you set a block in the newer versions of spigot?

player.getlocation().getblock.setType(Material.SAND) use to be the way but

#

,setType(Material.SAND) does not work anymore and looks deprecated

proud pebble
minor summit
#

did you build the experimental branch of spigot or something 🤨

proud pebble
#

that exists?

minor summit
#

yes

#

enum eradication, ItemType/BlockType etc etc

craggy gale
#

So anoying we cant send pictures here

neat pierBOT
minor summit
#

^

craggy gale
#

thats dumb but yes it says material. is deprecated

minor summit
#

yeah you built the experimental branch lol

craggy gale
#

So in the experimental branch of spigot they removed material. ? What did they replace it with?

#

Whats the point of changing somthing years old smh

minor summit
#

BlockType

minor summit
proud pebble
minor summit
#

the whole point is to separate item types from block types

#

they are very different things with different behaviours

proud pebble
#

means setting invalid materials is no longer a thing

craggy gale
#

Never understood complicating things like that which then makes updating old plugins a pain in the ass

minor summit
#

It's not complicated?

#

lol

proud pebble
#

atleast that means that people wont try to set blocks to MATERIAL.DIAMOND anymore for example

craggy gale
#

Its changing something that been around for over a decade its silly imo

minor summit
#

there are literal issues with the Material enum

#

but sure

proud pebble
#

updating legacy shit that is annoying af is a good thing

minor summit
#

you can just not use the experimental branch anyway

#

since 0 people are running it because it's incomplete

proud pebble
#

its experimental for a reason

craggy gale
#

I miss the days of just downloading the bukkit.jar from bukkit.org straight from the page... so much easier to make sure you always had the right version

proud pebble
#

well those days have been long over since like 1.7 days

craggy gale
#

Sadly

proud pebble
#

so time to get with the times and ig cope?

craggy gale
#

Or quit

#

I choose quit

minor summit
#

how childish

#

"oh no, the platform is improving for good! bleh"

#

bukkit has been stagnant for almost a decade and this is just one of the many changes that have been long overdue

proud pebble
#

im actually rooting for that update

craggy gale
#

Well i didnt quit for the material change

#

I quit when Bukkit shutdown in 1.7

proud pebble
#

didnt even know that it was being changed till like 20 minutes ago

craggy gale
#

The only way to get the non experimental version of the spigot.jar is to use their buildtool right? They dont have a direct download or anything?

proud pebble
#

you could also not download a jar and use it as an external library

#

gradle or maven (gradle is so good tbh) is so nice for that

minor summit
#

running the regular buildtools command won't build the experimental build

#

you have to explicitly opt in a flag

proud pebble
#

and it means you can also hook into other peoples plugins so much easier and wont include their code either unless you specify otherwise

craggy gale
minor summit
#

odd

dusky harness
#

or else they wouldn't have added the Material.LEGACY_STUFF

proud pebble
#

its like
ItemStack(Material type, int amount, short damage)
only exists because 1.12.2 and below used the damage value to specify an items sub material, like stone types were like 1:6 for polished andesite for example

minor summit
#

yeah it definitely doesn't automagically build the experimental branch for me without me telling it to do so lol

wicked canyon
#

I'm quite new to plugin development, working on my first one.
I've been having an issue and looked around various threads looking for a solution but it seems there might not be one.
Is it seriously impossible to detect a player right clicking the air with no item in their hand? That seems like something that should be detectible.

void orchid
# wicked canyon I'm quite new to plugin development, working on my first one. I've been having a...

I don't think so? To detect player interactions, listen to the PlayerInteractEvent event, and then use hasItem() to achieve what you want. Here's the javadocs for that particular event for more details: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html

proud pebble
wicked canyon
#

I am using PlayerInteractEvent, but it's not firing at all when there's no item. I searched several threads on spigot/bukkit and all I found were people saying the client doesn't send a packet in this case, but that seems really dumb. Is this really the case even in 1.20?

proud pebble
wicked canyon
#

Correct.

#
  @EventHandler
  private void onInteract(final PlayerInteractEvent e) {
    Plugin.plugin.LOGGER.info("Right click!");
    <code to be triggered>
  }
#

When right clicking the air with no item in hand, the top logger line doesn't run at all, so the event must not be firing. The event is registered, and it fires in all other cases.

proud pebble
#

ive looked online and seems like alot of people have come to the same conclusion that its not possible to see if a player has right clicked air with an empty hand

#

you could in theory set an entity to always be infront of them and see if they click it but idk if they can only click it if its not invisible

#

might just be sol

wicked canyon
#

That's very dumb..
Unfortunate, I guess I'll have to switch which trigger I use. Or use that invisible entity method, though that sounds like it could get messy..

#

Well thanks for confirming.

proud pebble
#

ypu could use left click

#

or drop item

#

tho idk if drop item works when you have nothingnin your hand

rapid canyon
#

Does this channel apply to skripting as well?

hoary scarab
rapid canyon
#

Good to know, ty

delicate sinew
#

yo

#

is it possible to make a place holder that detects the version and sends whatever it picks like if your on older versions it sends [owner] but with newer versions it sends a unicode aka

#

snap

#

i cant send images

neat pierBOT
delicate sinew
#

just image a custom rank icon

#

imagine

delicate sinew
#

did some research

#

it is

#

it uses java script

delicate sinew
#

alright it works
but the place holders wont send
(i fixed it )

#

moved from the placeholder-api channel

uneven needle
#

this motivates me to come back to coding server side

lyric gyro
#

Hey, im pretty new to plugin development, iv come into a situation where i need to store a value with a UUID for every player that joins, and i feel this isnt the best way to do this, how would yall typically handle that

sterile hinge
#

Well that depends on what you’re trying to achieve, and what "store" means to you

lyric gyro
shell moon
#

it would be better if you explain what exactly you want to do and why, maybe there is a better solution

sterile hinge
#

But yeah, knowing what you want to achieve would be better

river solstice
#

The real question is do you want it to persist or not

#

If it's just a number and you don't need it to persist you can just store it in a map

#

If you do need it to persist, your options are:
MySql
SQLite
Yaml

You can probably just use yaml-based storage in your specific case.

lyric gyro
hoary scarab
#

NBT, PDC?

river solstice
river solstice
hoary scarab
#

Depends on his version

lyric gyro
#

im using 1.20.1 but i think yaml will work the best

icy sonnet
flat tendon
uneven needle
rich lance
river solstice
icy shadow
#

his ass is not looking at message history

craggy gale
#

Hey guys so im writing a grave stone mod for storing a player inventory in a yml file and ive run into a 1.20 issue where since players can color signs in single player they are able to recreate the grave stone signs. Any solutions to avoid this? Besides storing the locations of the signs

rich lance
craggy gale
river solstice
hoary scarab
#

I feel like I'm missing something simple... Was testing if my classes are caching, but the method isn't even outputting the strings.

public static void main(String[] args) {
    System.out.println(ReflectionBaseRecode.base().parsePlaceholders("{NMSVersion}"));
    System.out.println(ReflectionBaseRecode.base().getClassFromPath("com.thecrappiest.library.reflection.single.ReflectionMain"));
    System.out.println(ReflectionBaseRecode.base().getClassFromPath("com.thecrappiest.library.reflection.single.ReflectionMain"));
}

public Class<?> getClassFromPath(String path) {
    System.out.println("Path >> "+path);
        
    String parsedPath = parsePath(path);
    System.out.println("Parsed >> "+parsedPath);
```Output```
net.minecraft.server.v1_20_R2
class com.thecrappiest.library.reflection.single.ReflectionMain
class com.thecrappiest.library.reflection.single.ReflectionMain
dusky harness
hoary scarab
dusky harness
#

then either it's not building correctly or you have a duplicate method, unless there's something else that I'm not thinking of

#

but with the info right now, I don't think there's anything I can say besides running in debug mode (shift f9 instead of shift f10 i think)

#

and putting breakpoints

#

actually yeah i think thats a good idea

hoary scarab
#
public class ReflectionBaseRecode {

    private static ReflectionBase instance;
    public static ReflectionBase base() {
        return instance = instance == null ? new ReflectionBase() : instance;
    }

    public Class<?> getClassFromPath(String path) {
        System.out.println("Path >> "+path);
        
        String parsedPath = parsePath(path);
        System.out.println("Parsed >> "+parsedPath);

        System.out.println("Cached >> "+cachedClasses.toString());
        
        if (cachedClasses.containsKey(parsedPath))
            return cachedClasses.get(parsedPath);

        try {
            Class<?> retrievedClass = Class.forName(parsedPath);
            cachedClasses.put(parsedPath, retrievedClass);
            return retrievedClass;
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }

        return null;
    }

}
dusky harness
#

yeah that looks right, use the debugger

#

you aren't doing anything with the output right?
Like this is normal and default System.out (no System.setOut or whatever it is) into a normal and default terminal? (or intellij terminal)

hoary scarab
#

Normal output. (Eclipse)

dusky harness
#

I assume eclipse has a debugger with breakpoints and stuff as well

#

IJ for example allows you to press a button which lets you go line by line and inside methods, I assume eclipse does as well

hoary scarab
#

Doubt it. I'll look

dusky harness
#

yeah it does

hoary scarab
#

Just has "Debug as" which essentially just runs the program

dusky harness
#

look at Stepping

#

Step Into -> go inside method

#

Step Over -> next line

#

Step Return -> exit method

hoary scarab
#

Checking

dusky harness
#

#4

hoary scarab
#

Not seeing any different outputs

dusky harness
#

then ig the only thing left is to post a full code example on like github
if it still doesn't work, then it's an issue with something in your environment that differs (ex using eclipse, or if using eclipse's build tool, that too)

#

wait

#

so you used the debugger

#

it passed through the print statements

#

so yeah either eclipse or its tool is bugging, or you modified terminal somehow either via eclipse or code, could've been intentional or accidental

hoary scarab
#

IDK honestly. I added the breakpoints and it didn't add any additional output.

dusky harness
#

nono use the stepping

#

not just breakpoints

#

or wait

#

did the breakpoints stop the code in the method?

#

that isn't printing

hoary scarab
#

Do I add break points to every line thats suppose to run?

dusky harness
#

but anyways I'm gonna go sleep
Feel free to post a fully reproducible example on GitHub with maven or gradle files included (if used)

hoary scarab
#

I got the Debug perspective to show. Looking thorugh it now. Thank you, have a good night.

#

🤦 Instance is ReflectionBase rather then ReflectionBaseRecode

hoary scarab
river solstice
#

imagine using eclipse

#

🥴

royal hedge
river solstice
#

lmao

#

real

icy shadow
#

You’re basically saying “i wish i could edit a file without saving the file”

dusky harness
#

by portions I mean like if you modify lines 1-3 and 6-8, you can choose to only commit lines 1-3

river solstice
#

or just

#

you know

#

modify only those 1-3 lines

dusky harness
#

I have had usecases where I forgot to commit something and didn't want to commit more than what should've been in that commit

spiral prairie
#

2 commit messages go brr

dusky harness
river solstice
#
  • multiple commits
  • rollbacks
  • stashing
spiral prairie
#

I have that sometimes too

#

I just f it, finish both and commit both with 2 messages

pulsar ferry
river solstice
dusky harness
#

oh

#

u mean for the 2nd commit?

pulsar ferry
#

Commit, realise you forgot something, amend the commit with new content, force push

dusky harness
#

nono I forgot to commit

spiral prairie
#

No that's not the issue

river solstice
#

skill issue

river solstice
#

👵

dusky harness
spiral prairie
#

Lmao yes?

dusky harness
#

...

river solstice
#

lol

#

for ages

dusky harness
#

that's cool

river solstice
#

thats the way I started with git

#

with github desktop

#

commands were too confusing lol

hoary scarab
#

Thats still committing. I don't want the old code available.

Basically I want a text host but with a file display like github.

icy shadow
hoary scarab
#

It doesn't have a "tree" file system.

royal hedge
#

just branch off main and commit changes to that

#

then merge it into main when ur happy with ur changes

#

basic git stuff

dusky harness
#

or amend and force push?

royal hedge
#

force pushing to main is cheeky

hoary scarab
#

Forcepushing still displays a commit and what was updated.

dusky harness
#

if you always force push

royal hedge
#

no it doesnt

river solstice
#

yeah well that's the point of, you know

#

version control system

royal hedge
#

force pushing just pushes ur naughty changes

dusky harness
#

is what i meant by that

royal hedge
#

yeah just amend ur previous commit and it wont add a commit

#

but why do u wanna hide what you changed if its literally there

dusky harness
#

i think that's the best you can go on github

#

or git in general

hoary scarab
river solstice
#

interesting

dusky harness
hoary scarab
dusky harness
#

it won't show you which files

#

or what lines were modified

#

because that 1 commit would cover everything

icy shadow
#

make an empty git repo
every time you make a file change, delete .git and make a new repo
force push
"profit"(?)

#

this is insanely dumb but

icy shadow
#

to remove all the commit history?

hoary scarab
icy shadow
#

what

dusky harness
#

wb amend or rollback

icy shadow
#

that works too but its almost more effort

dusky harness
#

amend?

#

tbh idk what it is on cli but on intellij its very simple so I assume it's very simple on cli as well

hoary scarab
#

Yeah just to clarify, I know how git works.

I want basically gits UI and file management but without commits. You can see the source code as is no older versions no updates etc...

So just a text website like pastebin but be able to clicking through the files with a ui.

#

Just don't wanna bother making it myself.

dusky harness
royal hedge
dusky harness
#

I have posted a solution

#

yeah

#

^

hoary scarab
#

I know it's purpose. I don't care if I'm misusing it lol

icy shadow
#

it seems like theres a big difference between "version control doesnt matter" and "i actively want to remove the version control aspect"

#

curious about the reasoning for the latter

#

if it's some security through obscurity thing, that's a bad idea

hoary scarab
#

Basically I only ever want to show the latest code. That's it.

river solstice
#

idk at this point use like google drive or dropbox lol

dusky harness
#

ok, we gave you the answer already

#

multiple times

hoary scarab
hoary scarab
icy shadow
#

not really a reason but ok

river solstice
#

birstern stop asking!!!!

hoary scarab
royal hedge
icy shadow
icy shadow
dusky harness
icy shadow
#

seems like it's FAR easier to just ignore the history than making your own github replacement

river solstice
#

he wants what he wants stop gaslighting!!!

hoary scarab
#

It's just preference. I don't like having the previous updates posted.

hushed badge
#

get help

hoary scarab
#

I'll just stick with force pushing I was just hoping I can just upload it the same way without additional steps.

royal hedge
#

Well the whole point of git is to track changes so it's kinda expected that it'll take an extra step to not

hoary scarab
river solstice
#

or if you just want to clear history run:

rm -rf .git

git init
git add .
git commit -m "Initial commit"

git remote add origin git@github.com:foo/bar.git
git push -u --force origin main

after every commit

#

could probably automate it with cli

dusky harness
#

amend :)

river solstice
#

or amend

dusky harness
#

also idk if its some setting but you might also just be able to do git push --force

#

btw whats -u?

river solstice
#

short for --set-upstream

dusky harness
#

oh

pulsar ferry
#

Just amend all commits and force push and boom your project will always only have 1 commit :')

spiral prairie
#

This is so stupid lmao

hoary scarab
#

Brister with the recode what do you think of the library now?

river solstice
#

@icy shadow !

#

stop playing skyrim

icy shadow
#

Why would I do that?

river solstice
#

because I told you so

icy shadow
#

Shut up

icy shadow
#

Sorry

river solstice
#

hop on tf2

icy shadow
icy shadow
#

Fell off

river solstice
hoary scarab
icy shadow
#

You know I’m right

river solstice
#

yeah yeah

#

just playing to dunk on some randoms

#

ruining kid's days

dense drift
#

Does anyone know how to get rid of this?

[16:53:28 WARN]: Found inconsistent skull meta, this should normally not happen and is not a Bukkit / Spigot issue, but one from a plugin you are using.
Bukkit will attempt to fix it this time for you, but may not be able to do this every time.
If you see this message after typing a command from a plugin, please report this to the plugin developer, they should use the api instead of relying on reflection (and doing it the wrong way).

https://github.com/TriumphTeam/triumph-gui/blob/9339472c84bc90075a5eacb82e305e7daa27248b/core/src/main/java/dev/triumphteam/gui/builder/item/SkullBuilder.java#L74-L102
According to the Paper team, all we need to do in 1.20.2 is to provide a name, but idk what to do about that warning

hoary scarab
#

I assume just add a string in the name param...

minor summit
#

I mean the warning tells you what to do

dense drift
#

Welp, I gotta see how they do it internally 😦

pulsar ferry
pulsar ferry
#

And how do you make a player profile?

dense drift
pulsar ferry
#

Cool, finally

dense drift
#

ig we can simply use the api on 1.20.2 😄

pulsar ferry
#

Yeah

#

The issue seems to be the serializedProfile missing

dense drift
#

how do you know?

pulsar ferry
dense drift
#

is that spigot or paper?

pulsar ferry
#

Spigot

dense drift
#

maybe smth like this will work?

#

No more warnings

minor summit
pulsar ferry
#

Oh I see

proud pebble
#

is serializedprofile a new thing in 1.20.2?

shell moon
#

i dont think so

#

or maybe it is

dense drift
#

Ig it depends, if you are talking ab spigot it was probably added recently since PlayerProfile only exists since 1.20.1

minor summit
#

you should make a

#

PlayerHeadProfileSetter interface

#

and depending on the profile API availability pick one instance or another

#

yes yes

#

peak software design

dense drift
#

and a factory

shell moon
atomic trail
#

Anyone know why only the last expansion is registered and loaded correctly?

#

Only difference is the onRequest method

dusty frost
#

jesus christ why do you have so many expansions

#

you're supposed to just have one

atomic trail
#

Oh....

#

OHHHHH

#

I see why now

#

Bruh

dusty frost
#

it's tied to your Plugin instance lmao

atomic trail
#

I'm stupid

#

It's ofc what the params.equals is for

#

Thanks lol

craggy gale
#

Can anyone help? For some reason this code ONLY works on a single chest not a double.

public void onInventoryOpenEvent(InventoryOpenEvent event) {
    InventoryHolder holder = event.getInventory().getHolder();
    if (holder instanceof Chest || (holder instanceof DoubleChest && holder instanceof Inventory)) {
        Player player = (Player) event.getPlayer();
        boolean signFound = false;

        if (holder instanceof Chest) {
            Chest chest = (Chest) holder;
            signFound = checkChestForSign(chest, player, event);
        } else if (holder instanceof DoubleChest) {
            DoubleChest doubleChest = (DoubleChest) holder;
            Chest leftChest = (Chest) doubleChest.getLeftSide();
            Chest rightChest = (Chest) doubleChest.getRightSide();

            if (checkChestForSign(leftChest, player, event) || checkChestForSign(rightChest, player, event)) {
                signFound = true; // A valid sign is found on either side
            }
        }

        if (!signFound) {
            // If no valid sign was found, cancel the event
            player.sendMessage("BLOCKED");
            event.setCancelled(true);
        }
    }
}```
#
        Block chestBlock = chest.getBlock();
        BlockFace[] directions = { BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST };

        for (BlockFace direction : directions) {
            Block signBlock = chestBlock.getRelative(direction);

            if (signBlock.getState() instanceof Sign) {
                Sign sign = (Sign) signBlock.getState();

                if (sign.getLine(0).equalsIgnoreCase("§6§l[Lockit]")
                        && sign.getLine(1).equalsIgnoreCase(ChatColor.BOLD + player.getName())) {
                    event.setCancelled(false);
                    return true; // Exit the loop if a valid sign is found
                } else if (sign.getLine(0).equalsIgnoreCase("§6§l[Lockit]")
                        && !sign.getLine(1).equalsIgnoreCase(ChatColor.BOLD + player.getName())) {
                    event.setCancelled(true);
                    player.sendMessage("§6§l[Lockit] §athis chest is locked by " + sign.getLine(1));
                    return true; // Exit the loop if a valid sign is found
                }
            }
        }
        return false; // No valid sign found
    }
}```
#

This is my orginal code that also worked but\ double chests did not work.

    public void onInventoryOpenEvent(InventoryOpenEvent event) {
        if (event.getInventory().getHolder() instanceof Chest
                || event.getInventory().getHolder() instanceof DoubleChest) {
            // Get the block of the chest
            Player player = (Player) event.getPlayer();
            Chest chest = (Chest) event.getInventory().getHolder();
            Block chestBlock = chest.getBlock();

            // Define the possible directions to check for signs
            BlockFace[] directions = { BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST };

            for (BlockFace direction : directions) {
                Block signBlock = chestBlock.getRelative(direction);

                if (signBlock.getState() instanceof Sign) {
                    Sign sign = (Sign) signBlock.getState();

                    if (sign.getLine(0).equalsIgnoreCase("§6§l[Lockit]")
                            && sign.getLine(1).equalsIgnoreCase(ChatColor.BOLD + player.getName().toString())) {
                        event.setCancelled(false);
                        return; // Exit the loop if a valid sign is found
                    } else {
                        if (sign.getLine(0).equalsIgnoreCase("§6§l[Lockit]")
                                && !sign.getLine(1).equalsIgnoreCase(ChatColor.BOLD + player.getName().toString())) {
                            event.setCancelled(true);
                            player.sendMessage("§6§l[Lockit] §athis chest is locked by " + sign.getLine(1).toString());
                        }
                    }
                    //SIGN was FOUND BUT it was not a lockit chest.

                }
            }
        }
    }
}```
void orchid
void orchid
craggy gale
#
    public void onBlockPlace(BlockPlaceEvent event) {
        // Get the placed block and player who placed it
        Block block = event.getBlock();
        Player player = event.getPlayer();

        // Check if the placed block is one of the allowed sign materials
        if (block.getType() == Material.OAK_WALL_SIGN || block.getType() == Material.ACACIA_WALL_SIGN
                || block.getType() == Material.BIRCH_WALL_SIGN || block.getType() == Material.BIRCH_WALL_SIGN
                || block.getType() == Material.SPRUCE_WALL_SIGN || block.getType() == Material.CRIMSON_WALL_SIGN
                || block.getType() == Material.DARK_OAK_WALL_SIGN || block.getType() == Material.JUNGLE_WALL_SIGN) {
            // Define the possible directions to check for other signs
            BlockFace[] directions = { BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST, BlockFace.UP, BlockFace.DOWN };```
#

// Iterate through each direction to check for other signs and a chest
            for (BlockFace signDirection : directions) {
                Block possibleSignBlock = block.getRelative(signDirection);

                // Check if the block in this direction is a chest
                if (possibleSignBlock.getState() instanceof Chest || possibleSignBlock.getState() instanceof DoubleChest) {
                    Chest chest = (Chest) possibleSignBlock.getState();

                    // Now, check if the chest contains a Lockit sign
                    Block chestBlock = chest.getBlock();

                    BlockFace[] chestDirections = { BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST, BlockFace.UP, BlockFace.DOWN };

                    for (BlockFace chestDirection : chestDirections) {
                        Block possibleChestSignBlock = chestBlock.getRelative(chestDirection);

                        if (possibleChestSignBlock.getState() instanceof Sign) {
                            Sign sign = (Sign) possibleChestSignBlock.getState();

                            // Check if the sign text matches the Lockit format
                            if (sign.getLine(0).equalsIgnoreCase("§6§l[Lockit]")) {
                                // Cancel the placement and notify the player
                                event.setCancelled(true);
                                player.sendMessage("§6§l[Lockit] §cthis chest already has a lock on it.");
                                return; // Exit the loop if a valid chest is found
                            }
                        }
                    }
                }
            }
        }
    }```
craggy gale
void orchid
#

Try applying that to the code above, I am sure you will be able to figure it out

craggy gale
void orchid
craggy gale
craggy gale
rich lance
#

Then you can format your sign however you want

craggy gale
rich lance
#

Is it not? Isn’t that orange dye?

craggy gale
#

You also cant make text bold

rich lance
#

orange = gold

#

usually

craggy gale
#

if you look in game it is not the same

rich lance
dense drift
rich lance
#

will make it cleaner

#

bro…

craggy gale
#

@rich lance @void orchid
So this is the code Im using to handle chest breaking so unwanted players cant break a locked chest.

However; What is happening is chests placed diagnoglly from the chest with the sign get the locked properties (in addtion to the fact that double chests do not get protected at all, which I think is releated to how the sign is being calculated) (Also bukkit.broadcast debug never comes up.

    public void onChestBreak(BlockBreakEvent event) {
        Block chestBlock = event.getBlock();
        BlockFace[] directions = { BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST };
        if (chestBlock.getState() instanceof DoubleChest){ 
            Bukkit.broadcastMessage("debug");
        }else 
        if (chestBlock.getState() instanceof Chest || chestBlock.getState() instanceof DoubleChest) {
            for (BlockFace signDirection : directions) {
                Block possibleSignBlock = chestBlock.getRelative(signDirection);
                if (possibleSignBlock.getState() instanceof Sign) {
                    Sign sign = (Sign) possibleSignBlock.getState();
                    if (sign.getLine(0).equalsIgnoreCase("§6§l[Locked]")) {
                        if (!sign.getLine(1).equalsIgnoreCase(ChatColor.BOLD + event.getPlayer().getName())) {
                            event.setCancelled(true);
                            event.getPlayer().sendMessage("§f§l[§6§lChest§7§lLock§f§l] §cOnly §a"
                                    + sign.getLine(1).toString() + " §ccan edit this §6§llock§c.");
                            event.setCancelled(true);
                            return; // Exit the loop if a valid chest is found
                        }
                    }```
craggy gale
#

RIP: Bukkit: Material.SIGN_POST

rich lance
#

just so you don’t have to add a huge if statement like that

#
block.getType().toString().contains(“WALL_SIGN”)
craggy gale
#

Any idea on the diagonal and double chest issue from above?

rich lance
#

To avoid unwanted stuff

#

How do you lock the chests anyway?

craggy gale
#

The sign acts as the lock ie: if the users name is not on the sign it wont open

#

It actually works flawlessly expect for the double chest and diagonal \chest issues

rich lance
#

so I can just put anyone’s name on it?

craggy gale
#

Nope the sign edit event is disabled

#

if it has [locked] as the first line

rich lance
#

no I mean when creating the sign

craggy gale
#

So what I did is for Line 2. and 3. you can add users names, but line 1 is auto set to your name and line 0 is autoset to [Locked] gold and bolded

rich lance
#

So basically you put a chest and then you add the sign to lock it right?

craggy gale
#

sender.sendMessage("-");
sender.sendMessage("1. §fTo create a locked chest, place a sign on any chest with the first line being §6[lock]§f.");
sender.sendMessage("-");
sender.sendMessage("2. §fYou can allow multiple users (up to 2) to have access by adding their names to §c3nd and §c4th §flines of the sign.");

#

Yep

rich lance
#

that’s nice I see. Okay well basically what you could do is use the code for the initial locking to stamp the chests using PDC, then it should be a simple check later to see if a chest is locked or not

craggy gale
#

The issue im facing is around determining if a sign is attached to a chest or not but since im using the faces of the chest to determine that IF a chest is placed diagnol to the locked one it also gets the locked features

rich lance
#

any way you can send the whole class?

#

In a nice paste bin

craggy gale
#

im not sure how you would edit block meta?

rich lance
#

send your class

craggy gale
#

paste bin below

rich lance
#

@craggy gale where is the one that registers a locked chest?

craggy gale
#

Here ill do somthing real quick

rich lance
#

so you can make a pretty simple method here

craggy gale
#

all ears

rich lance
#

actually might need my IDE for this lol