#development

1 messages Β· Page 67 of 1

sterile hinge
#

well there is no guaranteed way to know whether someone is joining via a VPN

#

you can check if the IP is in a range known to be used by a VPN provider

#

but more than that? Not really

#

(not exposing that it is a VPN is the idea behind a VPN)

dreamy wolf
#

Is there a Minecraft plugin development competition currently running or upcoming?

dense drift
#

you use get logger? what

proud pebble
#

other then manually writing down each block's color or checking the material's string name for a valid color no there isnt

#

theres no api for it because its a bit too niche and the color of the block's texture can be different then its supposed to be with resource packs for example

#

like theres a MaterialTags for colorable, but other then that no doesnt exist rn

edgy fulcrum
#

Hello, java noob here and I have made a method that infinitely spams my error log whenever it runs. Do you see any way to stop this?

pseudo:

  • pass in a loaded chunk from chunk loaded listener
  • select random X/Z coordinates in that chunk, find the highest Y location at that X/Z
  • check some booleans about the material of the block at that location, before proceeding onto "NewNodeEvent.createNode" method
  • if none of the booleans pass, call the method again to get a new random X/Z coordinate and try again

the code works fine, it does exactly what it's intended to do, but for some reason every time this method is called it spams my server console with errors

        int randX = rng.nextInt(16);
        int randZ = rng.nextInt(16);
        int topY = chunk.getChunkSnapshot().getHighestBlockYAt(randX, randZ);
        Block targetBlock = chunk.getBlock(randX,topY,randZ);
        Material targetMaterial = targetBlock.getType();

        if (checkMaterial1(targetMaterial)) {
            Location finalLocation = targetBlock.getLocation();
            NewNodeEvent.createNode(targetBlock, finalLocation);
        }

        if (checkMaterial2(targetMaterial)){
            Location finalLocation = targetBlock.getLocation().add(0,1,0);
            Block finalTarget = finalLocation.getBlock();
            NewNodeEvent.createNode(finalTarget, finalLocation);
        }

        if (checkMaterial3(targetMaterial))
            FoundLeavesLogic(targetBlock.getLocation(), chunk);

        else {
            TryNode(chunk);
        }
    }```
neat pierBOT
edgy fulcrum
river solstice
#

stack overflow, who could've though about that in a recursive function

#

you're not doing anything with the chunk and you're calling the method again with the same chunk

edgy fulcrum
#

intentionally

#

the end of each if statement sends to a new method which ends in return

river solstice
#

idk

#

need more context

edgy fulcrum
#

Here's "NewNodeEvent.createNode" method for example


        int tryNodeRNG = rng.nextInt(10) + 1;

        if (targetLocation.getY() >= 120)
            return;

        if (targetBlock.getBiome().equals(Biome.SNOWY_BEACH) || targetBlock.getBiome().equals(Biome.BEACH))
            return;

        if (targetLocation.getY() > 75) {
            if (targetBlock.getBiome().equals(Biome.STONY_PEAKS)) {
                if (tryNodeRNG >= 5) {
                    targetBlock.setType(Material.BEDROCK);
                    targetBlock.getWorld().spawnEntity(targetLocation, EntityType.MARKER);
                    return;
                }
            }
          //etc
          //etc ```

"if biome this, do this, return"
"if heigh this, do this, return"

It gets passed into more logic about the block it found and every statement ends in return;

so it should be logically impossible for the function to get looped unless it failed the 3 boolean checks in the initial method
river solstice
#

I don't think you understand how it works

edgy fulcrum
#

no probably not, I've been coding for 4 days

river solstice
edgy fulcrum
#

ohh

#

yea that makes sense

river solstice
#

whatever happens in createNode where you do the return, stops the execution of the createNode method, not the TryNode method.

edgy fulcrum
#

my understanding was it would take the result of the createNode method (return) and apply that to the original if statement which sent it there

river solstice
#

in your provided code it will only stop if checkMaterial3 returns true

#

else it will loop infinitely

#

hence StackOverflow exception

edgy fulcrum
#

gotcha

#

alright well that's an easy fix then, I'll check it out

#

its throwing the same StackOverflow error. I'm sure the missing return statements was a problem, but it looks like it's not "the problem"

river solstice
#

so uh

#

maybe none of the conditions ever return true?

#

because at the end of the day you're calling the TryNode on the same chunk without altering it in any way

edgy fulcrum
#

that can't be it, because it is actually functioning and giving me the result I wanted to get when the conditions are true. It spawns a little mini structure at the target location, they are all over my world now.

#

I just can't figure out why it's blasting my error log

river solstice
#

well, because it's being called too many times

edgy fulcrum
#

I think I just needed more return statements. I'm looking deeper into the methods its splitting off into, and there is another one that tries to call "TryNode" at the very end if all conditions fail.

edgy fulcrum
#

yea I'm completely clueless as to why this is still giving me issues so I'm just going to set a recursion limit to only try the same chunk 5 times before giving up. 5 is smaller than infinity, I'm pretty sure.

#

as long as the plugin isn't completely torching my server resources, it's behaving in game exactly the way I wanted to, so I can be happy with that

dreamy wolf
#

Are there any minecraft plugin development competitions?

edgy fulcrum
#

wtf haha

#

I fixed it but I don't know why it fixed

#

I put this condition at the top of TryNode

if (!(checkMaterial3(targetMaterial)) && !(checkMaterial2(targetMaterial)) && !(checkMaterial1(targetMaterial)))
{
TryNode(chunk);
return;
}

and that pleased the machine god

#

I cannot fathom why the method kept calling itself after the boolean checks were passed, I put such an excessive amount of return statements everywhere I could think to cram them

#

but if I check for the absence of the booleans first, then everything works?

#

there is clearly some sort of computer logic going on that does not match the human logic which wrote it

#

but the problem is solved and my error log is clear. Thanks for your help @river solstice

#

just kidding, that was just reorganizing the same problematic code.

#

The problem I believe is that I have no contingency plan for when the attempt is made in an ocean. It tries to find a block that is not water, and it can't find that block, so it just endlessly loops itself pinging the same 16 water blocks ad infinitum

#

the logic was sound, but I didn't give the method any way to handle chunks that don't have a single viable spawn location

#

actually fixed it now. This is definitely the biggest problem I have debugged and I don't think I could have done it without someone explaining StackOverflow to me

#

Thanks again sir, enjoy the wall of text I have errected in this channel.

river solstice
sonic nebula
#

its literally infiny loop my man

#

if you are not turkish i value u turkeybastard for begin such a great person

edgy fulcrum
#

step 1: make infinity
step 2: "why infinity?"

royal hedge
placid sierra
#

hey guys, crazy question but is it possible to like randomize item texture overlays, like the overlay might be from a pool of a few different textures. I know you can do this with blocks textures but im not sure about items

smthn like this

    "parent": "item/handheld",
    "textures": {
        "layer0": "item/sword",
    "layer1": "item/#random overlay from a choice of multiple files#"
    }

}```
sullen acorn
sullen acorn
#

ive done all the testing i can

#

even used a fresh server

#

the empty spaces in 5 and 3 don't show for 0 reason

#

im so confused????

molten venture
# sullen acorn So I'm trying to make a scoreboard, but when I added the location part, the spac...

Try this:

objective.getScore(ChatColor.BLUE + "   ").setScore(5);
objective.getScore(ChatColor.WHITE + "✦ ").setScore(4); // Location
objective.getScore(ChatColor.BLUE + "  ").setScore(3);
objective.getScore(ChatColor.WHITE + "Balance: " + ChatColor.GOLD + "0").setScore(2); // Money
objective.getScore(ChatColor.BLUE + " ").setScore(1);
objective.getScore(ChatColor.AQUA + "" + ChatColor.BOLD + "SERVER.IP").setScore(0); // Server's IP
sullen acorn
#

it works

#

how does that make sense?

#

ohh i think i understand

molten venture
#

πŸ˜‰

sullen acorn
#

tysm

versed leaf
#

who can help me start my server

sonic nebula
#

how long does auctionbar display in seconds?

hazy nimbus
#

auctionbar?

dusky harness
hazy nimbus
#

ikr?

#

I just wanted to troll tony

#

whatever

#

some old spigot forum thread says that it stays for 2s and then fades for 1s

#

obv varies by client, cuz the packet itself only contains the text

sonic nebula
#

also

#

anoher question

#

how to get inventory name

#

i see no shit in the api

#

or waitin

#

inventory class

#

inventory.getview.gettitle

#

doesnt exist

#

in new vesions

#

ver*

dense drift
#

can you stop spamming?

river solstice
#

real

pulsar ferry
hazy nimbus
#

I worry why he needs the name of the inventory

pulsar ferry
#

Inb4 it's to check if it's his inventory lol

dense drift
#

classic use of that method kek

hazy nimbus
sullen acorn
#

I have a custom entity (villager) with a custom name, how do I check if a player interacts with this villager?

#

actually the listener doesn't work at all

river solstice
#

idk add an nbt/pdc tag on creation

#

and try to retrieve the tag when player interacts with a villager

sacred holly
#

**I was wondering if it is possible to after I make something like (see yml below) then add some lines to prevent the player purchasing it again after a he has done it once and recieved his permission. ** Example: eglow.color.red.

I need this to prevent players from spending their coins on the same color twice on accident.

||`'glow1':
material: red_dye
slot: 11
hide_enchantments: true
enchantments:
- DURABILITY;1
display_name: "&c&lRed glow"
lore:
- ""
- "&fCost: &#FF711E250 Gold"
- ""
- "&a&lβž₯ CLICK TO PURHCASE"
left_click_requirement:
requirements:
anything_here:
type: '>='
input: '%playerpoints_points%'
output: '250'
deny_commands:
- '[message] &cYou dont have enough &6gold &cto buy this glow.'
- '[close]'

left_click_commands:
  - '[console] lp user %player_name% permission set eglow.color.red'
  - '[console] playerpoints:p take %player_name% 250'`||
proud pebble
#

tho you can just create a requirement that requires the player to not have a permission

#

theres a bit on it in the docs

sacred holly
#

Oh sorry for the wrong channel

#

I’ll check that out

sonic nebula
#

i dont use inventory names to check within my plugins of those are my inventories

#

i check via addresses

#

nah i was making a plugin to work as a rat and return some data of some actions in an other plugin πŸ˜‰ thanks for all the advice i made it!

atomic trail
#

Forgot how this thing works, is this correct usage? String regionType = type instanceof FarmRegionType ? "farm" : "mine";
If it's true it should be set to "farm" else set to "mine"

icy shadow
#

try it and see

#

jshell is your friend

#

but also yes

atomic trail
#

Havn't heard of jshell before actually

atomic trail
dusky harness
icy shadow
#

yes but much more effort when all you need is a single expression

river solstice
#

answer to all your questions

#

ask no more

atomic trail
river solstice
#

ternary operator

atomic trail
#

Thanks

tulip anvil
#

why is it saying material cannot be null when trying to use items from newer versions (such as NETHERITE_SWORD)? my paper api is on version 1.18.2?

[18:54:13] [Server thread/ERROR]: Error occurred while enabling ChestRegen v1.0-SNAPSHOT (Is it up to date?)

java.lang.IllegalArgumentException: Material cannot be null

at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[commons-lang-2.6.jar:2.6]

at org.bukkit.inventory.ItemStack.<init>(ItemStack.java:86) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]

at org.bukkit.inventory.ItemStack.<init>(ItemStack.java:74) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]

at org.bukkit.inventory.ItemStack.deserialize(ItemStack.java:516) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]

here's the yml that its deserializing:

# Loot items for the chests
loot:
  - type: DIAMOND
    min: 1
    max: 5
    chance: 1
  - type: IRON_INGOT
    min: 1
    max: 5
    chance: 0.75
  - type: NETHERITE_SWORD
    min: 1
    max: 3
    chance: 1
#

in plugin.yml I have api-version: '1.18'

river solstice
#

bad deserialize

tulip anvil
#

?

river solstice
#

is it a custom method you are using or what

tulip anvil
#

no its just ItemStack.deserialize()

river solstice
#

and how are you using it in your code

tulip anvil
#
val lootItems = configFile.getList("loot")?.mapNotNull {
  if (it is Map<*, *>) {
    val min = (it["min"] as? Number)?.toInt() ?: return@mapNotNull null
    val max = (it["max"] as? Number)?.toInt() ?: return@mapNotNull null
    val chance = (it["chance"] as? Number)?.toDouble() ?: return@mapNotNull null

    val item = ItemStack.deserialize(
      (it as Map<String, Any>).minus(listOf("min", "max", "chance"))
    )

    LootItem(item, min, max, chance)
  } else {
    null
  }
}
#

it works fine for every other item, it's just items from newer versions (i think 1.12+) that it doesn't recognize when i have them for the type field, like NETHERITE_SWORD would throw an error, but DIAMOND_SWORD works fine

river solstice
#

ig it doesnt know what netherite sword is

tulip anvil
#

πŸ˜”

dusky harness
#

in plugin.yml

#

Β―_(ツ)_/Β―

#

i dont think it should make a difference

#

but

#

Β―_(ツ)_/Β―

#

yeah it really shouldn't

#

hm

proud pebble
tulip anvil
tulip anvil
fast glade
#

anyone have any idea how to get the loot/drops of a mob thru the bukkit/spigot/paper api? is it possible to do so without using nms?

#

i see Bukkit#getServer()#getLootTable() but not sure exactly how to use it

river solstice
modest goblet
#

Hey, im trying to compile the plugin 'oraxen'. i git cloneed the repo, then ran ./gradlew build

Starting a Gradle Daemon (subsequent builds will be faster)

> Configure project :
w: file:///root/oraxen/oraxen/oraxen/build.gradle.kts:40:13: 'paperDevBundle(String? = ..., String = ..., String = ..., String? = ..., String? = ..., String? = ..., String = ..., ExternalModuleDependency.() -> Unit = ...): ExternalModuleDependency' is deprecated. Replaced by extension methods

> Configure project :core
Branch: master

FAILURE: Build failed with an exception.

* Where:
Build file '/root/oraxen/oraxen/oraxen/core/build.gradle.kts' line: 56

* What went wrong:
null cannot be cast to non-null type kotlin.String

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 2m 11s
root@germanythpire:~/oraxen/oraxen```
#

Build fails with this error, can i get some help?

#

line 56, which seems to be causing hte problem is empty

#
group = "io.th0rgal"
version = pluginVersion
//This is line 56
allprojects {
    apply(plugin = "java")
    repositories {
        mavenCentral()
proud pebble
#

so perhaps something like new NamespacedKey(NamespacedKey.MINECRAFT,"entities/zombie");

#

tho maybe you should have a look at datapacks since they can override loottables and might have some insight into how to use loottables even if its just a basic understanding

#

im not saying to use datapacks, just see what they do

dusky harness
#

orr what about Lootable#getLootTable

proud pebble
#

ohh that exists?

#

interesting

dusky harness
#

yea i was just looking through Zombie javadocs πŸ₯²

proud pebble
#

if i was to add custom drops to an entity i would just manually do it on mob death rather then using loottables, like i might make my own version of loottables but i wouldnt use minecraft's tables

dusky harness
proud pebble
#

yeah probably

pure crater
#

its super easy to just override the table and i think thats what your supposed to do anyways

tulip anvil
#

why is lore always italic?

fun replaceColorCodes(input: String): Component {
    return LegacyComponentSerializer
        .legacyAmpersand()
        .deserialize(input)
}

val sword = ItemStack(Material.DIAMOND_SWORD)
sword.lore(
    listOf(replaceColorCodes("&r&7Telepathy I"))
)

#

got it, i needed to put .decoration(TextDecoration.ITALIC, false)

dusky harness
#

applyFallbackStyle*

tulip anvil
#

what's the difference between that and what i did?

dusky harness
#

applyFallbackStyle(TextDecoration.ITALIC.withState(false))

dusky harness
tulip anvil
#

but why

#

ohh

dusky harness
#

but fallback will only disable italics if not set

#

i think

#

although if you hardcode it it really doesn't matter ig

tulip anvil
#

i just did the .decoration() at the end of the listOf stuff not the actual replaceColorCodes fn

dusky harness
#

I would put fallback in replaceColorCodes

tulip anvil
#

alright

tulip anvil
#

how can i place a double chest? I placed two chests, but they're not joining together

dusky harness
#

oh probably

#

try this

tulip anvil
#

I don't see Type.Left

#

nevermind!

#

this doens't work

(leftChest.blockData as Chest).type = Type.LEFT

Error: Type mismatch. Required: Material Found: Chest.Type

#

nvm, im awesome leftChest.blockData = Material.CHEST.createBlockData("[type=right]")

proud pebble
#

there is org.bukkit.block.data.type.Chest
and
org.bukkit.block.Chest

#

the first one's getType() uses Chest.Type and the second ones getType uses Material

tulip anvil
#

ohh probably yeah

royal spire
#

45$ monthly, Single thread 2468

For minecraft

sterile hinge
#

terrible

royal spire
#

D:

royal spire
tulip anvil
#

why do i have a little iron next to my EventHandler? It's like a lightning bolt with blue headphones on?

dense drift
#

it is an event listener, just a small icon from mc dev plugin

tulip anvil
#

gotcha, i was wondering if it was like a warning of some sort, ty!

peak harbor
#

hello! I was wondering: how do I parse papi placeholders in the case of a broadcasted message? The message is intercepted via the BroadcastMessageEvent

dusky harness
#

like %player_name%

#

if so, you'll likely need to intercept packets as well

peak harbor
dusky harness
#

not optimal

#

but i dont think theres an alternative

#

besides modifying the plugins themselves

peak harbor
#

isn't there really an event fired for a message sent by a plugin to a player?

dusky harness
#

not that I know of

peak harbor
#

I tried searching in the purpur javadocs (we are using it for our backend) but I had no luck

dusky harness
dusky harness
peak harbor
dusky harness
#

I don't know how ess fetches it exactly since I haven't looked into it

peak harbor
minor summit
#

LP does not inject anything anywhere

#

Essentials requests the prefix from luckperms

#

then essentials does some weird shenanigans PepeLa

peak harbor
#

oh boi

dusky harness
#

btw what is your usecase for this?

#

if you need a /broadcast to support PAPI, make your own /broadcast command

#

that's the awesome part of being a developer fingerguns

peak harbor
#

I'm also looking at their API (which I just discovered existing) and it's confusing me more than before, also the javadocs are... something?

peak harbor
tulip anvil
#

what is getDamageIncrease in Enchantment class?

dusky harness
#

I haven't managed a server in forever so i dont remember

peak harbor
#

but as some guys stated on Purpur discord, I could just do my welcome message and afk too

peak harbor
dusky harness
tulip anvil
peak harbor
tulip anvil
#

?

peak harbor
#

sorry if it's purpur, I had this on my hand πŸ˜‚

tulip anvil
#

yeah i see the function description but i have nooo idea what it's used for πŸ€”

peak harbor
tulip anvil
#

so would it be for like sharpness for example?

peak harbor
#

Sharpness adds 0.5 * level + 0.5 extra damage according to mc fandom, so let's say you are using it on Sharpness 4, getDamageIncrease() returns 2.5

tulip anvil
#

i see

#

that's weird that getDamageIncrease is required for all Enchantment

peak harbor
#

what do you mean by required?

tulip anvil
#

like if you want to extend Enchantment, you have to add that method

#

i'm a new java dev so theres probably a reason but i find it a little weird

peak harbor
#

what you need to extend for?

tulip anvil
#

making custom enchants

dusky harness
peak harbor
#

I see, but I think you can just return 0 if your enchanting is harmless

tulip anvil
#

im gonna make a wrapper class so i dont need all these random things

peak harbor
proud pebble
#

i personally modify and check the itemstack's nbt data manually instead of trying to register the custom enchant using the vanilla enchants system

#

just cus all ive seen of others doing it using the vanilla system is complaints of something not working right

topaz bear
#

any devs that can help me please?

#

urgent

neat pierBOT
#
FAQ Answer:
Β» Give the helpers some details
Β» Ask suitable questions
Β» Be polite
Β» Wait

Source

topaz bear
#

anyone ? can you help me with player pushing each other and also help me make the server less laggy?

dusky harness
#

for players pushing each other, you can use paper and in paper.yml, search for collisions -> enable-player-collisions and change it from true to false

hoary scarab
#

If I make an event/listener system, should the listener be ran on the same thread as the event if the event is called when read from a socket? Or should I pass the data to listeners on a separate thread?

dusty frost
#

i mean, it doesn't technically matter, it will likely work the same, but for true async message passing they probably should be run at least on some sort of thread pool scenario where they can share resources and actually run concurrently

modern osprey
#

Hello, I have a question about PAPI. I have read this guide: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Hook-into-PlaceholderAPI, but I have some doubts.
Let's assume a situation where I want to use placeholders in the message displayed after defeating a player. I'm not entirely sure how I can apply this to two players at the same time. Sample message: "%victim_player_name% was killed by %killer_player_name%". The PlaceholderAPI.setPlaceholders() method accepts only one player. How to do that? W will be glad for help!

rich lance
#

Since this is a death message and the values don’t depend on the player viewer, you don’t need any variables

#

assuming you can retrieve the values from your event or whatever

modern osprey
# rich lance Since this is a death message and the values don’t depend on the player viewer, ...

I don't quite understand. I want to have placeholders for two players in one string. I gave the example with death message because there is such a situation there.
Now suppose I want to send a death message to all players on the server. I get the message from the plugin configuration file and now I need to replace the placeholders with values. How to tell these players apart? For example, their prefixes: %player1_vault_prefix%, %player2_vault_prefix% or in this case %victim_vault_prefix%, %killer_vault_prefix%. I have no idea how to write this in code.

rich lance
#

Assuming these values are grabbed from an event or something

#

You can also pass a null player

#

But that won’t work for this use case

molten venture
rich lance
#

yeah exactly ^^

#

was just typing that out lmao

molten venture
rich lance
#

PlaceholderAPI isn't what you need here. you'd use it for example for something that is based on the player viewing, but for global things its better to just directly replace it with regular string methods, and much faster too anyway

#

and not only that, you should really only want to use it when you want to support other plugin placeholders, or want other plugins to use your placeholders

modern osprey
#

I understand, thank you for your help!

rich lance
#

if another plugin was the one providing the %victim_vault_prefix% or whatever in question, then yeah you would need to use it maybe, but since its all internal don't bother

rich lance
#

if you for example, decide to track player kills or whatever and make a %player_kills% placeholder, then that also calls for placeholderapi support, in case you want to use %player_kills% in your tablist or chat plugin or etc etc

#

its kind of like:

Valid: Plugin1 -> PAPI -> Plugin2

but you're asking more for

Plugin1 -> PAPI -> Plugin1
west socket
#

Could someone tell me what is going on here?

#

Im trying to make other players invisible via the entityMetaDataPacket and ProtocolLib

#
new PacketAdapter(PixelParty.INSTANCE, PacketType.Play.Server.ENTITY_METADATA) {
                    @Override
                    public void onPacketSending(PacketEvent event) {
//        
                        WrapperPlayServerEntityMetadata wrapper = new WrapperPlayServerEntityMetadata(event.getPacket());
                        
                        Entity entity = wrapper.getEntity(event);
                        Bukkit.broadcastMessage(event.getPlayer().getName() + " - " + entity.getName());

                        if(!Objects.equals(entity.getName(), event.getPlayer().getName())) {
                            List<WrappedWatchableObject> watchers = wrapper.getEntityMetadata();
                            for(WrappedWatchableObject watcher : watchers) {
                                if(watcher.getIndex() == 0) {
                                    watcher.setValue((byte) 0x20);
                                }
                            }

                        }


                    }
                });```
#

The name check is respected when only one player is online, however the second player loads in not being able to see themselves and shortly after the first player disapears to themselves as well

#

The name check should be fine as far as my printouts have gone, but I have also tried comparing entity and entityID

#

I just have no idea how in any case a player would be invisible to themselves with that if statement

distant brook
#

Inside open commands, from deluxemenus. How can I set a command to move you between modes?

molten venture
# west socket ```java new PacketAdapter(PixelParty.INSTANCE, PacketType.Play.Server.ENTITY_MET...
new PacketAdapter(PixelParty.INSTANCE, PacketType.Play.Server.ENTITY_METADATA) {
    @Override
    public void onPacketSending(PacketEvent event) {
        WrapperPlayServerEntityMetadata wrapper = new WrapperPlayServerEntityMetadata(event.getPacket());
        Entity entity = wrapper.getEntity(event);
        Bukkit.broadcastMessage(event.getPlayer().getName() + " - " + entity.getName());

        if(!Objects.equals(entity, event.getPlayer())) {
            List<WrappedWatchableObject> watchers = wrapper.getEntityMetadata();
            for(WrappedWatchableObject watcher : watchers) {
                if(watcher.getIndex() == 0) {
                    watcher.setValue((byte) 0x20);
                }
            }
        }
    }
});
west socket
#

Oh you reformatted it, thanks.

molten venture
minor summit
#

Player#hidePlayer or something

craggy zealot
#

can someone help me with this confusing world edit issue

#

im trying to give my builders the permission world.edit.* right using my own plugin but when they go and //wand

#

the command works but the little things after it are red and this message pops up

#

unknown or incomplete command, see below for error at position 1: /

craggy zealot
#

its a development thing isnt it?

molten venture
pulsar ferry
molten venture
limpid summit
neat pierBOT
molten venture
limpid summit
limpid summit
neat pierBOT
molten venture
limpid summit
#

nvm I found out the fix but tysm for the help i appriciate it :)

molten venture
#

No problem 😊

limpid summit
#

The problem was me forgeting to use p.spigot().sendmessage

#

ahaha

#

I instead used p.sendmessage

molten venture
#

Oh πŸ˜‚

limpid summit
#

aahaha

limpid summit
#

Any idea on why I'm getting null

#
public static void TradeSystem(Player p, String args[]) {
            if (args.length == 2) {
                if (args[0].equals("request")) {
                    Player tradeWith = Bukkit.getPlayer(args[1]);
                    if (Bukkit.getOnlinePlayers().contains(tradeWith)) {
                        messagePlayer(p, true, "You sent a trade tequest to: &6" + args[1]);
                        requestTrade.put(tradeWith, p);
                        TextComponent accept = Logger.createClickableMessage(HoverEvent.Action.SHOW_TEXT, ClickEvent.Action.RUN_COMMAND, "&2Accept Trade", "&2Accept Trade", "/trade accept");
                        TextComponent decline = Logger.createClickableMessage(HoverEvent.Action.SHOW_TEXT, ClickEvent.Action.RUN_COMMAND, "&4Decline Trade", "&4Decline Trade", "/trade decline");
                        messagePlayer(tradeWith, true, "&6" + p.getDisplayName() + "&7 wants to trade with you ");
                        messagePlayer(tradeWith, true, "&7Click to accept:");
                        tradeWith.spigot().sendMessage(accept);
                        messagePlayer(tradeWith, true, "&7Click to decline:");
                        tradeWith.spigot().sendMessage(decline);
                    } else {
                        messagePlayer(p, true, "&c" + args[1] + " &6 is not online");
                    }
                }
            } else if (args.length == 1) {
                if (args[0].equals("accept")) {
                    if (requestTrade.isEmpty()) {
                        messagePlayer(p, true, "&c" + args[1] + " &6 there are no active trade requests");
                        return;
                    }

                    if (requestTrade.containsKey(p)) {
                        Player tradeWith = requestTrade.get(p);
                        if (Bukkit.getOnlinePlayers().contains(tradeWith)) {
                            //create the menu and then open it for the player
                            tradingPlayers.put(p, tradeWith);
                            requestTrade.remove(p);
                            Inventory tradeMenu = new TradeMenu().CreateInventory();
                            p.openInventory(tradeMenu);
                            tradeWith.openInventory(tradeMenu);
                        } else {
                            messagePlayer(p, true, "&c" + args[1] + " &6 is not online anymore");
                            requestTrade.remove(p);
                        }
                    } else {
                        messagePlayer(p, true, "&c" + args[1] + " &6 there are no active trade requests");
                    }
                } else if (args[0].equals("decline")) {
                    if (requestTrade.isEmpty()) {
                        messagePlayer(p, true, "&c" + args[1] + " &6 there are no active trade requests");
                        return;
                    }
                    if (requestTrade.containsKey(p)) {
                        Player tradeWith = requestTrade.get(p);
                        messagePlayer(p, true, "&6You have declined the trade request");
                        messagePlayer(tradeWith, true, "&c" + p.getDisplayName() + " &6 Has declined the trade request");
                        requestTrade.remove(p);
                    } else {
                        messagePlayer(p, true, "&c" + args[1] + " &6 there are no active trade requests");
                    }
                } else {
                    messagePlayer(p, true, "&4Command timed out");
                }
            } else {
                messagePlayer(p, true, "&4Command timed out");
            }
        }```
dense drift
#

Stop sending images lol

limpid summit
neat pierBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
β€’ HelpChat Paste - How To Use

limpid summit
#

might be too long and considered as spam

limpid summit
hoary scarab
#

Thats not pastebin. Also how TF would pastebin be banned?

limpid summit
minor summit
#

there are hundreds if not thousands of paste sites

limpid summit
#

here ya go

#

Why am I getting null here any ideas?

minor summit
#

ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
Utils$PlayerManager.TradeSystem (Utils.java:353)
in line 353 in your utils class you are trying to access object at index 1 in an array that only has 1 element (at index 0)

#

which one is line 353?

dusky harness
#
messagePlayer(p, true, "&c" + args[1] + " &6 there are no active trade requests");
#

i think

minor summit
#

im guessing here yeah

dusky harness
#

You might want to replace that with like p.getName()

limpid summit
#

aightt tysmm lemme check

minor summit
#

oh there are many uses of args[1] under that check

#

you'll want to not have those cuz they'll all fail lol

limpid summit
#

I'm lookin into that ahahaha

#

tysm again :)

molten venture
limpid summit
#

alrr fixeddd

molten venture
limpid summit
west socket
uneven needle
#

what the code did i just read

tulip anvil
#

How can i get the actual string value of an item displayName() ?

#

item#displayName is the displayName but it also has square brackets before/after?

#

item.itemMeta.displayName() works, that's weird there's two different functions ?

minor summit
#

ItemStack#displayName() is a misnomer, it's how the game shows the item, for example, when you kill someone with a renamed or enchanted item, it'll have the brackets and you can hover your cursor over it and see some of the item details

#

ItemMeta#displayName() is the component in the NBT display.Name

tulip anvil
#

ohh, i see thank you!

rotund inlet
#

Hello, i need a little help with a plugin Im making, so its a type of authentication but thing is that i have a flaw where the users can still use commands while not being authenticated. How could i disable users rights to use any other command than the plugins /authenticate command?

torpid raft
#

if this is a plugin you are making for public use, you can have a config setting for the permission node(s) to apply to players after the auth process is completed

rotund inlet
torpid raft
rotund inlet
torpid raft
#

πŸ‘

flint kernel
#

Question: is there any reason not to use an interface over a regular class for a class containing purely (or mostly) constants / sf variables?

sterile hinge
#

You can’t really prevent the interface from being extended/implemented

flint kernel
#

Yeah but when it only contains those constants that's not really relevant is it?

sterile hinge
#

Well you could argue it’s bad design

#

But afaik interfaces don’t allow static initializers, so that’s a limitation too

flint kernel
#

yeah those are the reasons i was expecting, just not sure what they are

torpid raft
#

are those the ```
static {

}

blocks
flint kernel
#

Ah those

hoary scarab
#

I might be saying this wrong, isn't interface just a mockup of another class?

flint kernel
#

It can have fields, but they're all public, static and final

#

I found it used for LuckPerms' messaging system, and it seems pretty clean

proud pebble
#

hmm

#

commandpreprocessevent or smth

#

you could cancel that if they arent authenticated

merry knoll
proud pebble
#

lowest in this case cus you wanna have the final say

minor summit
#

highest comes last :^)

#

well, monitor comes last but you are not meant to modify the event

rotund inlet
#

Asking anybody now theres probably a way better method for this, but whenever i make change to my plugin i have to rebuild it and restart the server, im using Eclipse is there a more time efficient way?

sharp cove
#

Hey whats a better way to do this?

                                List<String> message = new ArrayList<>();
                                message.add(Colors.translate(user1.getName() + "&7:"));
                                message.add(Colors.translate("&7Kingdom &8> &7" + user1.getKingdom_Display()));
                                message.add(Colors.translate("&7Rank &8> &7" + user1.getRank_Display()));
                                message.add(Colors.translate("&7Points &8> &a" + String.valueOf(user1.getPoints())));
                                message.add(Colors.translate("&7Status &8> #2cbf4c&lONLINE"));
                                
                                for (String msg : message)
                                    player.sendMessage(msg);```
#

Like a Stringbuilder or something?

#
StringBuilder messageBuilder = new StringBuilder();

messageBuilder.append(Colors.translate(user1.getName() + "&7:")).append("\n");
messageBuilder.append(Colors.translate("&7Kingdom &8> &7")).append(user1.getKingdom_Display()).append("\n");
messageBuilder.append(Colors.translate("&7Rank &8> &7")).append(user1.getRank_Display()).append("\n");
messageBuilder.append(Colors.translate("&7Points &8> &a")).append(user1.getPoints()).append("\n");
messageBuilder.append(Colors.translate("&7Status &8> #2cbf4c&lONLINE"));

player.sendMessage(messageBuilder.toString());``` is this better?
wheat carbon
#

java has multiline strings

sharp cove
#

oh alr

#

thx

wheat carbon
#

what does #getPoints return?

#

you probably don't need String.valueOf around it

sharp cove
#

No it returns a int, I think its indeed unnecessary to use String.valueOf().

                                String message = Colors.translate(
                                        user1.getName() + "&7:" + "\n" +
                                        "&7Kingdom &8> &7" + user1.getKingdom_Display() + "\n" +
                                        "&7Rank &8> &7" + user1.getRank_Display() + "\n" +
                                        "&7Points &8> &a" + user1.getPoints() + "\n" +
                                        "&7Status &8> #2cbf4c&lONLINE");```
#

Got this πŸ‘

wheat carbon
#

you can use multiline strings like this

#
"""
this
is
a
multiline
string"""```
river solstice
#

is it really

wheat carbon
#

no

river solstice
#

thought so

sharp cove
#

oh alr

#
}.runTaskLater(Kingdom.instance, wilderniss ? Kingdom.instance.kGetConfig().SpawnTimeWilderniss * 20 : Kingdom.instance.kGetConfig().SpawnTime * 20);``` do I need to use Long for this?
#

For this "Kingdom.instance.kGetConfig().SpawnTime * 20"

dense drift
#

Java will convert int to long

dense drift
#

or consider to use components if you are using paper

merry knoll
drifting nymph
#

guys how to fix it

#
[17:41:13 WARN]: [DeluxeMenus] Plugin DeluxeMenus v1.13.7-Release generated an exception while executing task 32652037
java.lang.NullPointerException: null
#

help

river solstice
#

idk

grand mantle
#

Hey guys! Just joined the discord looking for some support. I've been developing an alternative bundle plugin for minecraft that bascially opens a gui with 9 slots. I've been having an issue where I can put a bundle inside of the gui with the use of hotkeys, I have a system stopping players from being able to shift click or drag them in but I can use hotkeys to bypass that. Can anyone help?

this is my system for not being able to drag or shift click bundles into the gui:
(also i used a debug stick and re-textured it so ignore that)

    public void onInventoryClick(InventoryClickEvent event) {
        Inventory inv = event.getInventory();
        if (event.getClickedInventory() != null && event.getView().getTitle().equals("Bundle")) {
            if (event.getCurrentItem() != null) {
                ItemStack clickedItem = event.getCurrentItem();

                if(event.getCurrentItem() == null){
                    event.setCancelled(true);
                    return;
                }

                // Check if the clicked item is a bundle
                if (clickedItem.getType() == Material.DEBUG_STICK && clickedItem.hasItemMeta() &&
                        clickedItem.getItemMeta().hasDisplayName() &&
                        clickedItem.getItemMeta().getDisplayName().equals(ChatColor.GOLD + "Bundle")) {
                    // Cancel the event to prevent placing bundles inside the bundle GUI
                    event.setCancelled(true);
                }
            }
        }
    }```
dusky harness
#

Ik it's not called that

#

But I think something like it exists

grand mantle
dusky harness
#

Server-side doesn't know about keybinds and stuff

#

It just sees it as 9 (edit: 8)

#

getHotbarButton

#

Btw

molten venture
#

Use that

junior shard
#

Anybody know why I am getting an error trying to implement the VaultAPI? I remember this being an issue in the past and honestly I can't remember how I resolved it

pure crater
# junior shard

try deleting the local maven repo and forcing gradle to retrieve it again

royal hedge
pure crater
#

i think this is a jitpack issue

junior shard
junior shard
dusky harness
#

Not intellij

junior shard
#

Uhh, well I would tell you except its not there anymore. Not sure what I did, but the error is gone all of a sudden

dusky harness
#

Oh ok
BTW intellij does that for new repos I think before you refresh maven

#

Or new dependencies

#

Or both

#

It's kinda misleading

#

Especially since it's marked as an error

junior shard
#

Yeah, I had the issue in a previous project as well and it just sort of fixed itself after an hour

pure crater
#

yeah and jitpack is also buggy

#

sometimes it's down for no reason

#

stopped using it cause i hated running into these random errors lol

junior shard
#

Sounds about right

#

Do you just make a standalone economy? Or use an alternative

pure crater
#

well in this case i pretty much have no choice since vaultapi requires jitpack

#

unless u want to compile it into your maven local

grand mantle
west socket
#

Could someone help me understand how this code could possibly effect a player who is not receiving the packet?
https://paste.helpch.at/edubewedix.csharp
I thought at first it might be an issue where the DataWatcher obtained from the packet object being the same instance as the one attached to the player, but even after a deep copy, if the metadata of a player is set to invisible at all when sending a packet to another player, it causes the original player to still see themself as invisible.

molten venture
molten venture
# west socket Could someone help me understand how this code could possibly effect a player wh...

The code has a check to prevent the packet from being modified if the entity in the packet is the same as the player receiving the packet (if(event.getPlayer().getEntityId() == entityId) return;).
This means that a player should not receive an altered packet about themselves, and therefore should not see themselves as invisible.

If a player is seeing themselves as invisible, it might be due to another part of your code or a plugin that is sending an ENTITY_METADATA packet to the player about themselves with the invisibility flag set. You might want to check other parts of your code or any other plugins you’re using to see if they might be causing this issue.

molten venture
# grand mantle can you or <@521485088995672084> make a snippet? sorry im a little confused

maybe like this idk:

@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
    // Your existing code...

    // Check the inventory after a delay to allow the hotkey action to complete
    Bukkit.getScheduler().runTaskLater(plugin, () -> {
        Inventory inv = event.getInventory();
        Player player = (Player) event.getWhoClicked();

        // Iterate over the slots in the inventory
        for (int i = 0; i < inv.getSize(); i++) {
            ItemStack item = inv.getItem(i);

            // Check if the item is a bundle
            if (item != null && item.getType() == Material.DEBUG_STICK && item.hasItemMeta() &&
                item.getItemMeta().hasDisplayName() &&
                item.getItemMeta().getDisplayName().equals(ChatColor.GOLD + "Bundle")) {
                // Remove the bundle from the GUI
                inv.clear(i);

                // Add the bundle back to the player's inventory
                player.getInventory().addItem(item);
            }
        }
    }, 1L); 
}```
terse vigil
#

Does anyone know how to turn this code into a minecraft paper plugin?
Code:
https://bit.ly/3uCf5jr
(I need nitro to send code in message)

minor summit
#

no you don't

mellow pond
#

wouldnt work

#

if your using chatgpt, dont make it a paper plugin tbh

terse vigil
#

I'm just new

#

To coding

mellow pond
#

// Check if the role already exists
// Assuming playerRoles is a Map<String, String> where key is playerName and value is the assigned role

/shrug/ feels very much chatgpt written

west socket
#

And came to the same conclusion as you

#

I think it might boil down to some strange protocol quirk that isn’t documented well

west socket
gritty bane
#

@eternal wolf

limpid summit
#
       public static List GetOwnedSlots() {
            Logger.success("Henllllo");
            List<Integer> ownedslots = new ArrayList<>();
            int column;
            for (int turns = 0; turns > 20; turns++) {
            switch (turns){
                case 6:
                    column = 1;
                    Logger.error(column + "Henlos");
                    break;
                case 11:
                    column = 2;
                    Logger.error(column + "Henloss");
                    break;
                case 16:
                    column = 3;
                    Logger.error(column + "Henlosss");
                    break;
                default:
                    column = 0;
                    Logger.error(column + "Henlossss");
                    break;
            }
                column += 9;
                ownedslots.add(column);
                Logger.error(column + "Henlo");
            }
            Logger.success(ownedslots.stream().toString() + " Henlo2");
            return ownedslots;
        }
    }```
#
[22:05:30 INFO]: [GC] Henllllo
[22:05:30 INFO]: [GC] java.util.stream.ReferencePipeline$Head@1be2453 Henlo2
[22:05:37 INFO]: [GC] Henllllo
[22:05:37 INFO]: [GC] java.util.stream.ReferencePipeline$Head@1012571e Henlo2```
#

what is the problem?

river solstice
#

for (int turns = 0; turns > 20; turns++) {

#

turns are never greater than 20

#

it should be for (int turns = 0; turns < 20; turns++) {

limpid summit
#

owhhh alr tysmm

#

I feel like I'm blind rn after seeing that

river solstice
#

happens

limpid summit
#

tysm :)

sterile hinge
#

IntelliJ should tell you that there's something wrong already

sterile hinge
#

It does

signal grove
#

any way i can speed up the time it takes for fish to bite? I basically want to simulate 'lure' except even faster, since i think lure above level 3 doesn't increase the speed

#

or invoke a fish bite somehow

grand mantle
#

Is there an event for dropping an item from a gui? Also I've been working on a bundle plugin that has 1 row in a chest gui, but whenever I drop an item that is in the slots (top half) they dissapear instead of falling out.

signal grove
#

what do you mean by "drop", like the same as pressing q?

grand mantle
#

yeah basically

#

i mean obviously people may have different binds than q

signal grove
#

PlayerDropItemEvent

#

or EntityDropItemEvent for non players

grand mantle
# signal grove PlayerDropItemEvent

I used this then tried dropping an item from my gui, and it didnt say anything in chat

public void onPlayerDropItem(PlayerDropItemEvent event) {
event.getPlayer().sendMessage("test123");
}```
signal grove
#

your events class isnt registered as a listener

#

is this in the same class as the main plugin?

grand mantle
signal grove
#

oh, then it is registered

#

hmm

#

so if you put an item in a gui and then press q on it (or whatever), it does not print?

grand mantle
#

Well if I drop an item from the gui, it doesn't send the message and the item just goes away. As in it just doesnt drop from the inventory, it dissapears when i drop it lol

signal grove
#

thats weird, the item disappearing might be some other plugin, but the event should still fire and print...

#

im not sure

grand mantle
#

I could send you my code, i dont see why any of this would happen

signal grove
#

sure, use the paste

grand mantle
#

i have no idea how that works

#

do i just ctrl+c and ctrl+v into that box?

signal grove
#

?paste

neat pierBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
β€’ HelpChat Paste - How To Use

signal grove
#

click the first link

neat pierBOT
grand mantle
#

i think i got it @signal grove

signal grove
#

xD well you pasted a link to another paste

#

but i got it

grand mantle
signal grove
#

yeah honestly no clue, i can't see anything that would cause the PlayerDropItemEvent not to fire in a gui

dusky harness
#

it should fire in there

#

don't know why it wouldn't fire in drop event tho

grand mantle
#

Figured it out, the playerinteract event I have was not limited to only right clicking, it happend every time i tried to drop something.

limpid summit
#
       if (tradingPlayers.containsValue(p)) { //Player 1
           if (p.getOpenInventory().getBottomInventory().equals(InventoryClick.getClickedInventory())){
               ItemStack clickedItem = InventoryClick.getCurrentItem();
               for (Integer i: getOwnedSlots()){
                   if (p.getOpenInventory().getTopInventory().getItem(i) == null){
                       int amount = 0;
                       for (ItemStack itemStack :p.getOpenInventory().getBottomInventory().getContents()) {
                           if (itemStack != null) {
                               if (itemStack.getItemMeta() == clickedItem.getItemMeta()) {
                                   amount += itemStack.getAmount();
                               }
                           }
                       }
                       clickedItem.setAmount(amount);
                       p.getOpenInventory().getTopInventory().setItem(i,clickedItem);
                       p.getOpenInventory().getBottomInventory().remove(clickedItem);
                       break;
                   }
               }
                return;
           }```
#

I'm trying to loop thru all the slots of the bottom inventory to check if there is another item that is same in the inventory so I can send it to the other inventory without item loss

neat pierBOT
#
FAQ Answer:
Β» Give the helpers some details
Β» Ask suitable questions
Β» Be polite
Β» Wait

Source

dusky harness
limpid summit
molten venture
# limpid summit ```java if (tradingPlayers.containsValue(p)) { //Player 1 if (...

Can you try with this:

if (tradingPlayers.containsValue(p)) { //Player 1
    if (p.getOpenInventory().getBottomInventory().equals(InventoryClick.getClickedInventory())){
        ItemStack clickedItem = InventoryClick.getCurrentItem();
        for (Integer i: getOwnedSlots()){
            if (p.getOpenInventory().getTopInventory().getItem(i) == null){
                int amount = 0;
                for (ItemStack itemStack :p.getOpenInventory().getBottomInventory().getContents()) {
                    if (itemStack != null) {
                        if (itemStack.getItemMeta() == clickedItem.getItemMeta()) {
                            amount += itemStack.getAmount();
                            p.getOpenInventory().getBottomInventory().remove(itemStack);
                        }
                    }
                }
                clickedItem.setAmount(amount);
                p.getOpenInventory().getTopInventory().setItem(i,clickedItem);
                break;
            }
        }
        return;
    }
}
#

lmk

limpid summit
# molten venture Can you try with this: ``` if (tradingPlayers.containsValue(p)) { //Player 1 ...
      if (tradingPlayers.containsValue(p)) { //Player 1
           if (p.getOpenInventory().getBottomInventory().equals(InventoryClick.getClickedInventory())){
               ItemStack clickedItem = InventoryClick.getCurrentItem();
               for (Integer i: getOwnedSlots()){
                   if (p.getOpenInventory().getTopInventory().getItem(i) == null) {
                       if (clickedItem.getAmount() <clickedItem.getMaxStackSize()) {
                           int amount = 0;
                           for (ItemStack itemStack : p.getOpenInventory().getBottomInventory()) {
                               if (itemStack != null) {
                                   if (itemStack.getType().equals(clickedItem.getType())) {
                                       amount += itemStack.getAmount();
                                       p.getOpenInventory().getBottomInventory().remove(itemStack);
                                   }
                               }
                           }
                           clickedItem.setAmount(amount);
                       }
                       p.getOpenInventory().getTopInventory().setItem(i,clickedItem);
                       break;
                   }
               }
               InventoryClick.setCancelled(true);
                return;
           }```
#

I did this lemme give it a try and let's see what happens

molten venture
limpid summit
# molten venture Okay thats right
       if (tradingPlayers.containsValue(p)) { //Player 1
           if (p.getOpenInventory().getBottomInventory().equals(InventoryClick.getClickedInventory())){
               ItemStack clickedItem = InventoryClick.getCurrentItem();
               for (Integer i: getOwnedSlots()){
                   if (p.getOpenInventory().getTopInventory().getItem(i) == null) {
                       if (clickedItem.getAmount() <clickedItem.getMaxStackSize()) {
                           int amount = 0;
                           for (ItemStack itemStack : p.getOpenInventory().getBottomInventory()) {
                               if (itemStack != null) {
                                   if (itemStack.getType().equals(clickedItem.getType())) {
                                       amount += itemStack.getAmount();
                                       p.getOpenInventory().getBottomInventory().remove(itemStack);
                                   }
                               }
                           }
                           clickedItem.setAmount(amount);
                       }else{
                           p.getOpenInventory().getBottomInventory().removeItem(clickedItem);
                       }
                       p.getOpenInventory().getTopInventory().setItem(i,clickedItem);
                       break;
                   }
               }```
#

how about this?

molten venture
# limpid summit ```java if (tradingPlayers.containsValue(p)) { //Player 1 if (...
    if (p.getOpenInventory().getBottomInventory().equals(InventoryClick.getClickedInventory())){
        ItemStack clickedItem = InventoryClick.getCurrentItem();
        int amount = 0;
        for (ItemStack itemStack : p.getOpenInventory().getBottomInventory().getContents()) {
            if (itemStack != null) {
                if (itemStack.getType().equals(clickedItem.getType())) {
                    amount += itemStack.getAmount();
                    p.getOpenInventory().getBottomInventory().remove(itemStack);
                }
            }
        }
        for (Integer i: getOwnedSlots()){
            if (p.getOpenInventory().getTopInventory().getItem(i) == null) {
                ItemStack itemToMove = new ItemStack(clickedItem.getType());
                if (amount > clickedItem.getMaxStackSize()) {
                    itemToMove.setAmount(clickedItem.getMaxStackSize());
                    amount -= clickedItem.getMaxStackSize();
                } else {
                    itemToMove.setAmount(amount);
                    amount = 0;
                }
                p.getOpenInventory().getTopInventory().setItem(i, itemToMove);
                if (amount == 0) {
                    break;
                }
            }
        }
        InventoryClick.setCancelled(true);
        return;
    }
}
noble oxide
#

hello guys! i just entered server and the welcome chat message was literally a png of the logo of the server.. how is that possible? does it works with a font resource pack or is there any other option?

pulsar ferry
noble oxide
#

ok ty!

molten venture
limpid summit
#
   if (getOwnedSlots().contains(InventoryClick.getSlot())) {
            ItemStack clickedItem = InventoryClick.getCurrentItem();
            p.getOpenInventory().getBottomInventory().addItem(clickedItem);
            p.getOpenInventory().getTopInventory().removeItemAnySlot(clickedItem);
            InventoryClick.setCancelled(true);
        }```
limpid summit
#

sorry for keeping you busy

#

but how can I make it only remove the slot I clicked

#

actually like make it go from bottom to top so no matter where the player clicks it will remove the same item from the bottom and not let the inventory have a gap in between items

molten venture
# limpid summit I have one more question :,(
    ItemStack clickedItem = InventoryClick.getCurrentItem();
    p.getOpenInventory().getBottomInventory().addItem(clickedItem);
    p.getOpenInventory().getTopInventory().clear(InventoryClick.getSlot());
    InventoryClick.setCancelled(true);
}
lyric gyro
#

anyone able to help me with a small job?

#

willing to pay if neccessary but I want an old plugin modified very slightly

#

it already sends admins a message when they join the server alerting them of the sub-domain used to join... but I want to be if it's not the main sub-domain to send them a message "You joined using X domain, you should be using X instead!"

lyric gyro
#

im willing to pay

molten venture
lyric gyro
#

oml lol

#

thnx 4 directions

molten venture
limpid summit
#

So there is no gap in between two slots

molten venture
# limpid summit But i dont want to delete all the same typed items i want to only remove the one...

Like this?

if (getOwnedSlots().contains(InventoryClick.getSlot())) {
    ItemStack clickedItem = InventoryClick.getCurrentItem();
    p.getOpenInventory().getBottomInventory().addItem(clickedItem);
    p.getOpenInventory().getTopInventory().clear(InventoryClick.getSlot());
    InventoryClick.setCancelled(true);
    
    ItemStack[] contents = p.getOpenInventory().getBottomInventory().getContents();
    for (int i = InventoryClick.getSlot(); i < contents.length - 1; i++) {
        contents[i] = contents[i + 1];
    }
    contents[contents.length - 1] = null;
    p.getOpenInventory().getBottomInventory().setContents(contents);
}
drowsy kite
#

hi i was looking to get into plugin development but im not sure how to start
my questions are:

does anyone have a reccomended tutorial for the basics?
are there differences between mc versions and which should i start in?
what is the difference between paper and spigot?

i did a little python and c# before and also made alot with skript

slim lynx
#

Hey can anyone please help me add models in my server with oraxen?

junior shard
#

I know this is a little bit of a dumb question, however I am getting back into this after 2 years or so.

I am starting to use PaperMC's api, and I noticed that the Bukkit ChatColor got depreciated. What do I do in replacement of ChatColor and the TranslateAlternateChatCode or whatever it was called?

junior shard
#

He also have a java tutorial series as well, if you're not familiar with the basics of java

sterile hinge
junior shard
#

Are those new APIs?

dusky harness
junior shard
#

Ah

dusky harness
junior shard
#

Alright cool, I will take a look into it

#

Thanks!

dusky harness
#

also, static imports make adventure a lot nicer to use, imo :)))
like the only times i use static imports lol

junior shard
#

lol

#

perfect

junior shard
#

@dusky harness any idea why IntelliJ can't find the depenency for AdventureAPI?

#

I've added it to my pom.xml already as the docs explain to do, but for some reason BukkitAudiences just cant be found

sterile hinge
#

BukkitAudiences is specific to the bukkit adapter

#

if you only want to target paper, it's probably easier to just use that (a Player is an Audience there already)

dusky harness
#

basically if you're shading adventure

#

if you're using latest version + paper, there shouldn't really be any reason to shade it

junior shard
#

ah so essentially I just do this then

Component msg = MiniMessage.miniMessage().deserialize("<rainbow>THIS IS RAINBOW</rainbow> <gray>and this is normal gray</gray>");
        Player p = (Player) commandSender;
        p.sendMessage(msg);
dusky harness
junior shard
#

Gotcha

junior shard
#

I read they were redundant in the documentation but I guess my hours of writing things in bbcode for TS and Enjin got to me lol

minor summit
#

lol enjin

#

haven't heard that since they were bought

tight junco
#

they turned into a crypto scam didnt they

#

yes they did

#

well they turned into a crypto wallet

junior shard
#

Yikes lmao

gusty frost
#

Solved

drowsy kite
junior shard
#

They are probably 3-4 years old at this point, I can’t remember when I first saw them, but there isn’t a whole lot that is different from the older versions

fast glade
#

thru the bukkit api, is there a way to get the loot table of a specific entitytype? like the odds, etc

I've looked at loottable, lootable, and lootcontext, but they all seem to require an actual entity object. and then i've only been able to get the resulting loot, not the actual odds of the all the possible loot

dusky harness
#

Edit: probably wouldn't work

fast glade
#

i attempted this, but using lootcontext i was only able to get what loot would come after the odds

dusky harness
#

Hmm

dusky harness
#

I'm looking at nms mappings

#

If you use something like paperweight it shouldn't be tooooooo hard to figure out

#

I think idk

fast glade
#

i'd figured it was, was just hoping could do it thru bukkit since they already have some loot stuff

dusky harness
#

Hmm, don't know why they only expose those 2 methods

fast glade
#

yeah its actually funny

dusky harness
#

Unless mojang does too, I only looked at the fields

fast glade
dusky harness
#

I think mojang keeps it in a private field

#

And so it's unaccessible unless cb uses reflection

#

Assuming the loot map is the List<LootPool> variable in nms LootTable

ocean raptor
#

I am making a cross server supported skyblock plugin, just like hypixel's. And of course it uses many services. Should I add a http api and manage almost every action from there or stick to the old system and just use the services inside the plugin? Even if I use an http api I would still need to use some of the services in the plugin too, and thats what made me think

#

I wonder what you guys think about this

#

feel free to ping me

#

the old one was working btw, but I just wasnt sure about the scalability and safety (lock, data loss etc)

frosty crypt
#

I’m looking for devs

river solstice
#

cool

wet pier
#

it should be null

#

why it auto fill the name

wet pier
#

@dawn viper help me

river solstice
#

what

wet pier
river solstice
#

what should be null

wet pier
river solstice
#

and what did you pass as args[0]?

#

Bot_0?

wet pier
river solstice
#

well in the image it says Bot_0

#

in the text dialog it says B

wet pier
#

input is B, and Bukkit.getPlayer("B") should be null

#

found the way πŸ₯²

#

getPlayerExact

minor summit
#

yes

#

getPlayer is stupid and should be deprecated

spark skiff
#

That nesting tho

#

Question
Say you have a method that gets a profile from a database/cache and returns a future
How would you use this in places where you need the profile sync? (Eg scoreboard tick)

minor summit
#

when the future completes, use the scheduler to update the scoreboard sync

#

if you're using CompletableFuture, see .thenAccept

broken elbow
#

Hello. Any chance, anyone here can help me get TailwindCSS tab completion work properly in PyCharm? I have the TailwindCSS plugin.

I am using the TailwindCSS CLI to generate the .css file not the npm package. The problem is that the CLI can only generate the minimized styles. From what I found on github and youtrack issues, there is no single compilation for all TailwindCSS styles.
From what I can see, the tailwind developers don't want to give a compilation of all styles because it is pretty big and they don't want people to be sending these over the network. I don't want to send it in requests, I just want to use it for tab completion in pycharm...

dusty frost
# broken elbow Hello. Any chance, anyone here can help me get TailwindCSS tab completion work p...

Uh, two questions, 1. is there a good reason to not use the npm package? It's just basically the CLI but better, the only reason would be if you're not using Node at all during development, and even then it's pretty easy to just do it.

  1. Have you tried just putting a tailwind.config.js file in your project? That's how the IJ Tailwind plugin gets its settings and can provide you lints. I ran into an issue where I was using tailwind.config.ts (typescript) and it would not recognize it.
broken elbow
#

I don't want to install it either. I might have to though

outer kestrel
#

Hi

#

I have a question

neat pierBOT
#

There is no time to wait! Ask your question @outer kestrel!

outer kestrel
#

PlaceHolderAPI

#

How can I make argument logic with PlaceHolderapi?

dusty frost
dusky harness
broken elbow
#

But I do. I guess its time to install it

dusty frost
#

I mean yeah lol

#

just embrace node.js 😌

#

i'm curious what you're working with though that's not node, Spring or something?

broken elbow
#

Python FastAPI Htmx

#

Python will change to rust

#

Just want a POC

dusty frost
#

damn what are you building that's that speed dependent?

#

most stuff will be served pretty well with just a node based website lol

#

unless you're going really hard on a backend, but even then, usually you have a separate frontend yk

broken elbow
#

not speed dependent

#

just want to learn new stuff

#

also, I dislike javascript. For a long time I've just hated doing frontend stuff and after trying htmx, I've realised it is just javascript's fault

dusty frost
#

lol

#

TS is pretty nice, I've really gotten into it recently

#

and it's just basically impossible to avoid the whole frontend ecosystem is in JS/TS

#

I've been liking Vue recently honestly, but even stuff like Svelte is super refreshing for people who don't like normal JS stuff

tiny nebula
#

Is there a way to cancel chunk specific weather with paper or do I need NMS for this?

molten venture
tiny nebula
#

How does worldguard manage region specific weather?

eternal hollow
#

do someone have some tutorials that can help me make custom abilities for some cool weapons im making? For instance one weapon granting the person holding it speed and the weapon has like a 50% chance of giving them the flame effect? Or have time to teach me?

dusky harness
#

probably

dusky harness
#

for the speed one, you can probably just check like every tick if the player is holding the item, and apply speed potion effect if so

eternal hollow
eternal hollow
dusky harness
dusky harness
eternal hollow
eternal hollow
dusky harness
#

yeah I just want to know how much you know already

dusky harness
eternal hollow
dusky harness
#

wait model?
This is for spigot & a resource pack, not forge/fabric, right?

eternal hollow
#

Blockbench model

dusky harness
#

or spigot plugins

eternal hollow
#

I assume it would be forge/fabric

dusky harness
#

do you have a build.gradle or build.gradle.kts file?

#

assuming you made the coding project already

dusky harness
eternal hollow
#

Ye, it’s impossible to find tutorials on it online

#

I’ve searched for everything

dusky harness
#

so idk why i wrote all that

#

but

#

ok

#

anyways

eternal hollow
#

I have no clue tbh

dusky harness
#

so like PlaceholderAPI

#

you want to make a plugin like that?

#

obviously with different features

#

but like same server setup

eternal hollow
#

Idk if it’s a plug-in, can I just send you something in DMs maybe you’ll understand a little bit better?

dense drift
dusty frost
dense drift
#

I don't skip numbers, there's \d at the begin of the regex, but I didn't know that they can overlap

dusty frost
#

oh yeah, i just wouldn't recommend regex tbh

dense drift
#

😦
FINALLY GOT IT!

broken elbow
dusty frost
#

yeah i guess

#

idk, i just had goals of using nice component libraries and stuff and having nice interactive websites and using htmx for that kind of highly interactive stuff is actual hell

#

it's certainly nice for lower interactivity stuff, but i find that even when i'm doing something simple, once i want to do something kinda complicated it gets horrendous

#

kind of a room to grow kinda situation

tulip anvil
#

i'm using the citizens api and im trying to make an npc that looks to nearby players, but i can't seem to figure out how to get it to work. i have this code:

CitizensAPI.getNPCRegistry().createNPC(
            EntityType.WITCH, "&c&lEnchanter", Location(
                Bukkit.getWorlds()[0], -200.0, 203.0, 420.0
            )
        ).apply {
            addTrait(Enchanter())
            addTrait(LookClose())
            addTrait(RotationTrait())
            data().setPersistent("lookclose", true)
        }
#

the NPC looks fine when i do /npc to get the data, and then whenever i do /npc look and then check /npc again, the traits look the same so i'm not sure what's wrong

broken elbow
tulip anvil
tiny nebula
dusky harness
#

they aren't planning to make plugins anymore

#

since they don't want it on a server

spark skiff
# minor summit when the future completes, use the scheduler to update the scoreboard sync

what if the scoreboard is updated like this?

// ran every tick
@Override
public List<String> getLines(Player player) {
  database.getProfileByUniqueId(player.getUniqueId()).thenAccept(profile -> {});
  // how am i supposed to get data inside the profile
  // without stalling the thread?
}

or if i need to get data on login, such as disguises

@EventHandler
public void onLogin(AsyncPlayerPreLoginEvent event) {
  // not using CompletableFuture#join
  database.getProfileByUniqueId(player.getUniqueId()).thenAccept(profile -> {
    PlayerProfile prevProfile = event.getPlayerProfile();
    PlayerProfile profile = Bukkit.createProfileExact(event.getUniqueId(), profile.getDisguiseName());
    profile.setProperties(prevProfile.getProperties());
    // im guessing this doesnt work 
    event.setPlayerProfile(profile);
  });
}
dense drift
hoary scarab
#

How do you remove a file from github repo? I added gitignore in the original post but the file was still there and even after multiple commits it still gets displayed...

icy shadow
#

git rm --cached filename

#

gitignore will just ignore it from IDE or matching paths for git add, it doesnt delete the file

hoary scarab
#

That will remove it from here?

icy shadow
#

if you then commit and push the changes, yes

hoary scarab
#

πŸ‘ will test that out in a bit.

hoary scarab
#

Worked. Thank you.

spark skiff
minor summit
#

well, your options are:

  1. block
  2. cache the result ahead of time and reach into the cache
dusky harness
#

assuming the scoreboad is being shown to everyone, having a runTaskTimer every tick and a concurrent map should work nicely

#

i think

#

emily's #2 option

slim lynx
#

Hello, does anyone know how I can recreate a plugins gui using deluxemenus for example how would I make my own gui of auction house but it still works the same just the gui change?

#

I also have oraxen if that helps

tulip anvil
#

does anyone know how i can store a List<ItemStack> either in a yml file or a .json so I can save/use the items in the file?

#

im using kotlin if that makes any difference

stuck canopy
tulip anvil
#

ohj alright

drowsy kite
#

if (e.getArmorStandItem().getData().getItemType() != Material.AIR){
why does this pass while the item is air?

#

like there is nothing on the armor stand

molten venture
proud pebble
#

so asyncchunk's method should be the one that works

junior shard
#

Does anybody know of a good NPC Api that I could use to make a plugin similar to corpses? For 1.20.2

slim lynx
#

Does anyone know if I can merge oraxen and items adder cause there is some textures I need from items added but I also wanna use oraxen so is there a way to merge both?

balmy cobalt
#

Is there a way to add an extension to a plugin internally? One that's already a thing like the "Player" placeholders for example. I want to have that loaded already.

worn jasper
#

XY problem?

balmy cobalt
#

I'm guessing. I don't want to have to run /papi ecloud download player.

#

I want it to be apart of my plugin already if that makes sense.

#

So players that use it, dont have to run that command either.

balmy cobalt
#

That's if I wanted to create new ones. I don't.

#

Unless I missed something specific.

night ice
flint kernel
#

Unless there's a better way, best bet might be to use PAPI's ExpansionManagers, check if the extension is installed otherwise ask PAPI to install it

night ice
balmy cobalt
#

I'll try that tmr. My current solution was to download it with ecloud, then import it to my plugin resources. From there add it to expansions if it doesn't already exist.

proud pebble
balmy cobalt
#

yeh sadly

#

and tbh its not working, i got somethin messed up cuz its adding more data than it should

proud pebble
#

is there a reason why you want the plaher expansion to be loaded by your plugin?

balmy cobalt
#

I thought it'd make things easier tbh

#

It uses the placeholders from it

proud pebble
balmy cobalt
#

maybe?

proud pebble
balmy cobalt
#

To allow players to use specific placeholders in config files.

#

Like player and server.

proud pebble
balmy cobalt
#

It's automatically apart of it?

proud pebble
#

no

#

if youve used papi for any length of tine its pretty much common knowledge that if a placeholder doesnt work either your missing thr plugin that adds it and or the expansion

balmy cobalt
#

Yeah. I want to add said expansion on my own terms. If its not possible, then oh well.

proud pebble
#

so people who are using your plugin should beable to figure it out and you dont have to tell them

#

tho if they come to your discord or whatever for support and thats the issue just tell them to download the expansion using the papi commands

#

hopefully it ahouldnt be every singls time

balmy cobalt
#

or just do it the easy way and just do the command

#

        File file = new File(getDataFolder().getParent() + "/PlaceholderAPI/expansions/Expansion-player.jar");
        if (!file.exists()){
            Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "papi ecloud download player");
            Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "papi reload");
        }
#

this'll work, thx tho

proud pebble
#

so like after you run that, add a message like attempting to load player expansion or smth

balmy cobalt
#

yuh

flint kernel
#

Will using the expansionmanager mean the expansion is properly tracked for versioning by PAPI?

proud pebble
#

probably?

flint kernel
#

if it does, i'd say use that mechanism

#

rather than trying to check if files exist then using commands

balmy cobalt
#

I think access to that is private

#

i lied

#

just found it lol

warm steppe
flint kernel
#

why do people always hardcode "/" in paths

worn jasper
warm steppe
#

plugin folder wont change ?

flint kernel
#

Paths#get with spaces

#
Paths.get("PlaceholderAPI", "expansions", "Expansion-player.jar")

or something, alternatively the Path#resolve methojds

warm steppe
#

how is that better?

flint kernel
#

cus Java will automagically handle file separators afaik

warm steppe
#

so will do extra work? did i understand correctly?

flint kernel
#

i might be wrong idk

#

have a look at the Path & Paths classes

worn jasper
slim oxide
#

{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "item/empty",
"layer1": "malikaset:armor/malika_chestplate_icon"
}
}
how do i give myself this item?

river solstice
#

idk

#

how

proud pebble
#

uhh id assume thats to create a model data, so like do that

#

create an itemstack then assign the model data value that bit of json is assigned to

#

probs in itemmeta or smth

sharp cove
#

Bruh

#

In the newest versions you can't get the player in InventoryPickupItemEvent

#

;/

minor summit
#

read the deprecation note

minor summit
#

Called when a hopper or hopper minecart picks up a dropped item.

sharp cove
#

But how do I get a playerpickupitemevent

#

hahaha

#

pickupevent

minor summit
#

read the deprecation notice

sharp cove
#

how

minor summit
#

with your eyes

sharp cove
#

πŸ’€

minor summit
#

not org, io

#

look up the event, it has javadoc and it has a depreciation note

sharp cove
#

oh bruh

#

its entitypickup event now

#

Look at this

#

Oh

#

This confused me

#

@minor summit Sorry

#

Thanks

marble heart
tight junco
#

QUESTION, when making a discord bot that has an sql db, when having a table with auto incrementing ids, is having a unique table per guild to allow the ids to be unique a bad idea

junior shard
#

Is there a way in my TabCompleter class for a command to only suggest the player names of online players when the player hits tab? The same way that chat works

#

For example I dont want this to show up until the player hits tab

forest jay
#

just have a "id" field in the columns for the guild id

torpid raft
#

this will leave you having to make a brand new table for every additional guild

#

also making a unique table for each guild is going to do the opposite of allow the ids to be unique - rows in different tables may end up with the same id this way

#

definitely better to just have a single table with an extra guild column

spiral prairie
#

MySQL can easily handle many millions of rows, but a few thousand tables, i dont know

torpid raft
#

yeah its definitely not designed to scale the number of tables

tight junco
#

fair

dusty frost
#

composite primary key if you really care

#

or use a UUID key, or just have an auto incrementing + another column of like guildname_id that is unique globally

tight junco
#

okay thank you for input!

icy shadow
#

no problem

hoary scarab
# junior shard

TabComplete or something like that and you apply it to the command.

junior shard
#

The same way the vanilla chat works, you type in chat and it doesn’t suggest anything, but if you press TAB it starts to suggest player names

minor summit
#

you don't

#

that's pretty much entirely controlled by the client, and the client does not tell the server when they press tab

junior shard
#

Damn, alright I’ll just keep it where it recommends player names every line lol

dusky harness
#

idk what /g yo is but for ex in a /msg command, I think it'd be better to have the player names show up without pressing tab or anything because that's what the command expects

whereas in chat, it's not expecting you to always type a player's name

#

Β―_(ツ)_/Β―

minor summit
#

g for greply

junior shard
#

The /g is my global chat command, I have normal chat set to proximity based

#

/g (msg)

dusky harness
#

ohh

#

oh that's what the "yo" is lol

junior shard
#

Yeah lmao

minor summit
#

uh I mean, you can suggest nothing for /g

junior shard
#

Yeah I could, but I have a player mention system built into the chat plugin and I think it’s QOL to be able to tab complete a username versus having to type it out

#

Especially if someone’s name is something wack such as 1_to0_gre4t or something

minor summit
#

I guess you could do, like, if they type two or three characters and they match the beginning of some player names then suggest those, but under that threshold keep it to nothing

junior shard
#

Hmm that’s a good idea actually, I might try that when I’m home

formal crane
#

So i am having a little trouble with nodejs/javascript.

I am trying to create a prisma client and then use it as a test.

This is my prismaClient.js file:

const { PrismaClient } = require("@prisma/client");
const logger = require('utilities/logger');

let prisma = null;

async function initialize() {
    prisma = new PrismaClient();
    logger.setPrefix('DATABASE').level('INFO').log('Created new Prisma Client!');
}

module.exports = { initialize, prisma };```
This is how i am trying to use it:
```javascript
const { initialize, prisma } = require('lib/prismaClient');

app.listen(process.env.PORT, async () => {
    await initialize();
    const user = await prisma.user.create({
        data: {
            email: "testFF@gmail.com",
            username: 'Rawr',
            password: '123',
            first_name: 'Test',
            last_name: 'Faar',
            pterodactyl_id: 500,
            proxmox_id: 100,
            messages: []
        }
    });
    console.log(user);
});```
This is the error / startup log: https://paste.helpch.at/aqujobamam.less
dusky harness
#

Actually

#

I'm new to js so I'm assuming some stuff here with knowledge of other languages
But what if you export a getter function

#

Instead of prisma itself

#

Oh cmon

#

I'm 6 hours late

drowsy kite
#

i want to strike fake lightning at an armor stand but it doesnt appear

            stand.getWorld().strikeLightningEffect(stand.getLocation());
            stand.getWorld().strikeLightningEffect(stand.getLocation());
            ItemStack item = new ItemStack(Material.DIAMOND_HELMET);
            stand.getWorld().dropItem(stand.getLocation(), item);
            stand.remove();
            this.cancel();```
im using this
#

using strikeLightning does work for me but it destroys the item

grave sky
# drowsy kite i want to strike fake lightning at an armor stand but it doesnt appear ``` ...

maybe try this

Location location = stand.getLocation();
World world = location.getWorld();

// Create lightning effects at the armor stand's location
world.strikeLightningEffect(location);
world.strikeLightningEffect(location);
world.strikeLightningEffect(location);

// Drop the item near the armor stand (slightly offset to avoid removal with the stand)
ItemStack item = new ItemStack(Material.DIAMOND_HELMET);
world.dropItem(location.clone().add(0, 0.5, 0), item);

// Remove the armor stand
stand.remove();
this.cancel();

this can wrong but just give it a try

drowsy kite
#

huh its just working now with the old code

#

thanks anyway though

formal crane
# dusky harness I'm new to js so I'm assuming some stuff here with knowledge of other languages ...

so, i tried to use a getter function now but now its stuck at '.create' instead of '.user',
Here is the updated file:

const { PrismaClient } = require("@prisma/client");
const logger = require('utilities/logger');

let prisma = null;

async function initialize() {
    prisma = new PrismaClient();
    logger.setPrefix('DATABASE').level('INFO').log('Created new Prisma Client!');
}

async function getPrismaClient() {
    return prisma;
}
module.exports = { initialize, getPrismaClient };```
And i tried using it like this:
```javascript
app.listen(process.env.PORT, async () => {
    await prisma.initialize();

    const user = await (prisma.getPrismaClient).user.create({
        data: {
            email: "testFF@gmail.com",
            username: 'Rawr',
            password: '123',
            first_name: 'Test',
            last_name: 'Faar',
            pterodactyl_id: 500,
            proxmox_id: 100,
            messages: []
        }
    });
    console.log(user);
    logger.setPrefix('SYSTEM').level('INFO').log('Server started up in ' + (Date.now() - timeElapsed) + 'ms!');
});```
But when i try the code to create a user in the Prisma file itself it does work, i don't know what to try now
grand barn
#

https://uploadir.com/82530/Ytc1VcZagW
Code: https://pastebin.com/vy7UiZJp

Does anyone know how to show the last action? 😐 What i'm doing wrong?

tried also directly with:
cloneInventory.setContents(event.getClickedInventory().getContents()); Main.getLive().getBot().openInventory(cloneInventory);
still not working, same issue

dusky harness
stuck canopy
#

is there a way to get ItemStack drops from a Material?

dusky harness
#

Or you can look in nms or cb to see how it works internally

#

But I'm not home so

formal crane
blissful parcel
#

Hello people, any idea why failing to connect to a database server takes sooo long? I connect successfully almost instantly, but whenever I input a wrong database server IP, it takes around 2 minutes to tell me that it failed..

Console:

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.```

Plugin code: https://gist.github.com/technyk/cf3681c25c06df535580e9a955e3add3

I followed the tutorial from here https://www.spigotmc.org/wiki/connecting-to-databases-mysql/ and therefor added this to my `pom.xml`:
```xml
<dependency>
    <groupId>com.mysql</groupId>
    <artifactId>mysql-connector-j</artifactId>
    <version>8.2.0</version>
</dependency>

e.: if there are any other solutions better than this, lmk
this solution unfortunately makes my plugin have 4 MB more than it's original size without the mysql connector

torpid raft
#

there should be a way to shorten it somewhere so it doesnt try to connect to a nonexistent db for too long

blissful parcel
#

I thought the validation was where the timeout is set, but I set the timeout to 1 second..

torpid raft
#

idk for sure but maybe there is a different timeout for the initial connection

#

also while you're starting to work with SQL you may as well get used to working with a connection pool

#

something like HikariCP

blissful parcel
#

I thought that was some advanced thing

torpid raft
#

it's advanced in that it makes your life easier

blissful parcel
#

I'd like to start out slowly and then move onto the "advanced" stuff

torpid raft
#

working with it is honestly easier than working with a regular sql connection

#

that being said no pressure since you're just starting to mess with it all

blissful parcel
#

of course, just tryin to solve this issue first before I move on

#

there seem to be some timeout setters

dataSource.setInitialTimeout();
dataSource.setConnectTimeout();
dataSource.setLoginTimeout();
torpid raft
#

yeah try playing around with those

blissful parcel
#

yup, thanks for the help

torpid raft
#

πŸ‘

stuck canopy
dusky harness
#

I meant that to revert the block

#

but if you use false, then it won't change the material back

stuck canopy
#

this worked

#

doesn't change the block's type but gets the drops

dusky harness
stuck canopy
#

or actually wait

#

I think I don't even need to update it

dusky harness
#

oh wait

#

yeah

#

ohhh

#

I seeee

#

yeah your solution is better than what i was thinking of

#

I didn't know you could get drops from BlockState

stuck canopy
#

it works without executing the update method as well

hoary scarab
#

CraftMagicNumbers has a getBlock method with a material parameter.

#

Also pretty sure updating the state is server side so relogging or other updating events would display that updated state.

dusky harness
dusky harness
#

@stuck canopy

#

Β―_(ツ)_/Β―

stuck canopy
dusky harness
#

oh

#

yeah

#

whoops

hoary scarab
#

It's craftbukkit

dusky harness
#

forgot that was cb

dusky harness
#

and it's a bunch of work/risk for something simple like this

stuck canopy
#

btw I am using papermc. how do I import nms?

hoary scarab
dusky harness
#

and risk

hoary scarab
dusky harness
#

then you run reobfJar instead of shadowJar most of the time

hoary scarab
dusky harness
dusky harness
#

oh ok then nvm πŸ₯²

stuck canopy
#

xD

dusky harness
#

you can still use like the server jar but nms will be obfuscated I'm pretty sure

#

and you have to manually download sources or smth

hoary scarab
dusky harness
#

ye, that's what this would do, no?

#

Block/BlockState#getDrops

hoary scarab
#

And if you use the itemstack parameter it can use enchants like silktouch.

dusky harness
# stuck canopy

I assume he already tested this - but a better solution wouldn't hurt

hoary scarab
stuck canopy
#

and it seemed to work

hoary scarab
#

Are you sure about modifying the state though? Pretty sure it is server sided.

dusky harness