#help-development

1 messages · Page 199 of 1

undone axleBOT
sacred mountain
#

and idk if you should use .getCursor()

#

maybe getClickedItem()

grizzled oasis
#

how i get the item renamed by the player and rename it in the case contains a word?

cosmic spear
#

Hi guys i have a problem with HikariCP did anyone can help me?
When mine plugin do query for 6 times or less or more, stop doing the query what can be?

    public void setup() throws java.sql.SQLException {
        hikari = new HikariDataSource();
        hikari.setJdbcUrl("jdbc:mysql://" + HOST + ":" + PORT + "/" + DATABASE);
        hikari.setUsername(USER);
        hikari.setPassword(PASSWORD);
        hikari.setMaximumPoolSize(10);
        hikari.setMaxLifetime(870000000);
        hikari.setConnectionTimeout(870000000);
        Logger.log(LogLevel.DEBUG, "Database connesso");
        CreateClanTable();
    }

this is the method

warm token
#

Idk why NBTAPI says that one of his methods isn't loaded

midnight wasp
#

hey when i buy a vulcan

#

do i have to verify it like something or?

warm token
#

I mean, to be sure it would work, I even scheduled it in a Task 10s later, since this method is called after few ticks it's loaded

frail gale
#

what do you think is better? Sorting a List to check if it contains some value or doing a Linear Search and then checking?

tardy delta
#

what context

frail gale
tardy delta
#

need context

#

linear search aint efficient after all

frail gale
#

You know what is sorting

#

right now for search I made a method which sorts a List if it contains the given value and after that does Binary Search

#

but I think the Binary Search is not needed

#

because the List is already sorted and the first indexes are the right ones

#

always

#

so I'll maybe do a short Linear Search so I got all the first indexes which contains the given value

serene sigil
#

how to detect if an item dies? (EntityDeathEvent doesnt work and EntityDamageEvent triggers multiple times sometimes)

#

ye

#

like every death cause

frail gale
#

Yeah but EntityDeathEvent returns only LivingEntity

serene sigil
#

yea

#

and entitydamageevent triggers more than 1 time

#

so i have to use this?

frail gale
#

does someone know if I can do an abstraction for AsyncPlayerChatEvent?

#

like in GUIs

#

but I don't think this is possible in the ChatEvent

#

no I mean if I can do it so one class can implement or extend a class or an interface and no need to register each of them

serene sigil
#

well, i would also like to detect if an entity is destroyed in any way (fire, void, cactus etc.)

frail gale
#

like the abstract GUI class for example?

#

which implements an InventoryHolder after that you can check if the inventory is instanceof your abstract class and then do the listener method

serene sigil
#

that will do all?

frail gale
#

but I don't think this is possible with AsyncPlayerChatEvent because you cannot check it like that way in the InventoryClickEvent

#

because I need to get player input from the chat

#

the best way I can think this can be accomplished is to use HashMap

#

yeah that's right

#

Don't worry I have an access to the inventory

#

everytime

#

I have a GUI Manager so when you open custom GUI the GUI is added in a Map with the Player Name and also has all the history of the older GUIs too.

#

and when you close the inventory all the GUIs get removed

#

yeah I can also try with the UUID

#

because Player Names are not really safe

#

they can be changed via Reflection

next plume
frail gale
#

there's another map which contains the Player Object and it's for the opened GUIs counter

#

why do you think it's bad to use the Player Object?

#

I'll change it then

#

ow shesh

#

I'll rework it then but maybe tomorrow

#

also I can try to revamp the Player Counter and try without another HashMap

next plume
#

"The Conversations API is a new Bukkit API for creating an interactive dialog between your plugin and a player. For the duration of the conversation your plugin has exclusive access to the player's console, enabling a back and forth conversation to take place."

#

New in 2012.

frail gale
#

yeah that's right

#

technically the Player should be always removed from the both Maps

#

on closing

#

I mainly made this system so I wouldn't gonna need to create everytime a new GUI on clicking the back Button

#

Haven't tested yet

#

I always forget I'll test right now

#

if that's the case I can implement a Quit Checker so if the player quits then remove them

#

yeah I'll change it that when I have more time haha

#

tomorrow is the last day which is gonna be for studying Friday will be Sport celebration (which is very cool I'll play) and then I'll have 4 free days so I'll try to do good progress on my Plugin Development

#

thanks :)

#

okay right now I kicked myself from the console while I opened one of the GUIs and the Closing system checked it

#

ALT + F4 also triggers the event/check

#

but still gonna implement a Quit Event just for more safety

ashen bridge
#

someone can help me to fix then

onyx fjord
#

no dont cross post

proper yarrow
#

newbie:
delay:86400
item:
- 306 1
- 307 1
- 308 1
- 309 1
- 267 1
- 257 1
- 258 1
- 256 1
- 322 1
- 364 32
- 17 64
member:
delay: 172800
items:
- 7059 1
- 7060 1
- 7061 1
- 7062 1
- 7099 1
- 7097 1
- 7095 1
- 7098 1
- 364 32
- 10873 1
- 322 5
- 368 16
- 23813 1
- 23812 5
vip:
delay:86400
items:
- 7507 1
- 7508 1
- 7509 1
- 7510 1
- 7519 1
- 7518 1
- 7517 1
- 7515 1
- 10873 10
- 10862:2 1
- 10862:4 1
- 10862:6 1
- 384 64
- 23809 1
- 23808 10
- 322:1 10

#

why is this breaking my essentials/config.yml?

#

OH MY GOD I SEE WHY NOW

#

HAHAHAHA

#

Sorry thanks anyways

onyx fjord
#

ye tho this is help development

upper vale
proper yarrow
#

nopee

#

nevermind didnt work still

#

very confused

#

every time i insert that section into the config it breaks the config

#

it doesnt make sense because my kits are an exact copy of the tools kit just with a different name

serene sigil
#

is there a way to get an item from ur inventory that is picked up by the cursor like this?

#

nvm it wont show the cursor but i think u get the point

tranquil dome
#

I am working on a custom EntityFishingHook projectile, which is spawned into the world by using the following code:


        val craftPlayer: CraftPlayer = player as CraftPlayer
        val entityHuman: EntityHuman = craftPlayer.handle as EntityHuman
        val world = entityHuman.world

        val wireKunai = WireKunai(world, entityHuman)
        val location = player.eyeLocation

        wireKunai.setLocation(location.x, location.y, location.z, location.yaw, location.pitch)
        world.addEntity(wireKunai)

This does spawn the entity, but only for a short amount of time (it despawns). I have overridden all methods from EntityFishingHook that use this.die() and commented out the line, but this does not work. How do I make it so the fish hook stays and acts like a regular fish hook? The above method works, but only when I am holding a fishing rod.

quaint mantle
#

Hello! in authme, where can I set it not to ask again? I can't really find it in config

river oracle
#

Just don't support cracked

quaint mantle
#

man wtf

river oracle
quaint mantle
#

There are many people in Hungary who cannot afford to buy minecraft.
they use significantly cracked servers here

cobalt marlin
#

unfortunate

#

if you cant afford a $27 game maybe you have better things to be doing than playing said game

quaint mantle
#

What kind of attitude is that?

eternal night
#

what attitude is "some people are too broke, so it is okay to pirate" ?

river oracle
#

My question would be who then funds those servers how would they gather funds to stay up genuinely curious I understand the sentiment

#

Surely hosting a vps would be expensive let alone supporting whole networks

eternal oxide
#

Minecraft sure went up in price 😦

quaint mantle
#

I have the regular game. However, keep in mind that there are families who cannot do this or whose parents do not trust them.

#

I asked a simple friendly question. You shouldn't attack the other :/

eternal oxide
#

Don;t worry, with the cost of heating, food and Electricity going up you will shortly not be able to afford to live. No need for Minecraft.

river oracle
#

You bet I'm excited for these upcoming economic issues

languid flare
#

How do I create a command (/rank user group) from this?

#
    NORMAL(""),
    ADMIN(ChatColor.RED + "ADMIN");

    private final String prefix;

    Rank(String prefix) {
        this.prefix = prefix;
    }
}
robust sinew
#

If I set a falling block to the same velocity as a monster, the monster moves slightly less than the falling blocks

#

how would I fix that?

quaint mantle
#

then reduce the amount of velocity

#

for the entity

robust sinew
#

do I have to keep doing trial and error?

#

until I get the exact amount?

quaint mantle
#

ig, or make a test command and do it there

robust sinew
#

ah true true

quaint mantle
#

takes way less time

robust sinew
#

yeah

cobalt marlin
soft fiber
#

java

robust sinew
#

and got a good number for the monster

fresh timber
#

Randomly, when someone chats, this error comes up on my AsyncPlayerChatEvent. The event just changes the format and some stuff. It works most of the time, but, randomly, it stops and gives this error... anyone know why?

soft fiber
#

java
File card = new File(getDataFolder(), "cards.yml");
FileConfiguration configuration = YamlConfiguration.loadConfiguration(file);
configuration.set("cards.Material", Material.STONE);
configuation.save(file);

why cards.yml nothing changed..?

fresh timber
#

ok

soft fiber
fresh timber
cobalt marlin
#

wtf

fresh timber
#

?

drowsy helm
#

format doesnt work like that

#

event.setFormat("text" + "%2$s")

fresh timber
#

u cannot use +?

drowsy helm
#

you can

#

you just need the delim

fresh timber
#

idk what delim is

drowsy helm
#

the "%2$s" bit

fresh timber
#

oh

#

what does that do

#

would it send %2$s?

#

as part of the format?

drowsy helm
#

read that

fresh timber
#

I'm confused, can you change this line to it so I can understand?

event.setFormat(ChatColor.translateAlternateColorCodes('&', "§8[§4§lOWNER§8] §f" + event.getPlayer().getDisplayName() + ": " + event.getMessage()));
#

oh ok

#

omg I hate this website

drowsy helm
#

lmao why

fresh timber
#

so hard to understand

#

and its very bright

#

burning my eyes

#

I still dont understand

drowsy helm
#

so %2 is player name %s is message

fresh timber
#

the only thing I see that might mean something is that it wants String, Object...

fresh timber
drowsy helm
#

wdym

fresh timber
#

wait will %2 return the player in a string?

drowsy helm
#

it will be replaced with the player name, yes

fresh timber
#

oh

#

ok

#

I didnt know that

#

so this would work? event.setFormat(ChatColor.translateAlternateColorCodes('&', "§8[§4§lOWNER§8] §f%2: $s"));

drowsy helm
#

yup

#

should

fresh timber
#

ahh ok

#

thx

quaint mantle
fresh timber
#

its for the players msg

#

so like I could use &c in a message if im owner but others cant

quaint mantle
#

Use &, with § i dont think you need the translation part

fresh timber
#

I could use & but I added translate after I had § so I just left it

quaint mantle
#

Ah

soft fiber
undone axleBOT
#

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

soft fiber
#

not get any errors

echo basalt
#

Instead of asking "why is x not working", ask yourself " How can I get x to work, and how does it differ to my current solution?"

soft fiber
echo basalt
#

Ehh I won't bother with this

eternal oxide
echo basalt
#

Just seeing static for the sake of being static just starts it off in the wrong direction

eternal oxide
#

you also have code outside of a method. That will not even compile

soft fiber
#

okok

fluid river
#
public void onExplode(EntityExplodeEvent event) {
    if (event.getEntity() instanceof Creeper) event.blockList().clear();
}```
#

i'm too lazy

#

would it work

eternal oxide
#

probably

fluid river
#

oh

#

yeah it would

#

hey guys

#

weird design patterns time

#

ProjectileHitEvent has getEntity() which returns Projectile

#

but it doesn't override the getEntity() of EntityEvent i guess

#

cuz they return different objects

#

or i don't know something about overriding a method

#

does getEntity() in EntityEvent have default realization?

#

or that's some hacks which i don't know about

fluid river
desert loom
#

Projectile extends Entity so it's fine to change the return type to Projectile

#

you can override it like that.

fluid river
#

oh

#

Wanna test it right now

#

bruh...

#

Polymorphism goes brrt

#

well now since this is answered

#

would it be weird to have this thing?

#

it's just a waste of stack memory and one nanosecond but

#

this is kinda more detailed for API users

vocal cloud
#

Stop pinging people

fluid river
#

hehe

#

sorry

#

can you help me with my question tho

desert loom
#

Probably unnecessary since getEntity's documentation already states it will return the Entity involved in the event. Adding a method like that might bring even more confusion since it would introduce some ambiguity.

#

the naming scheme/documentation is clear enough in my opinion.

soft fiber
eternal oxide
#

Same as before. you load before you save overwriting any data

soft fiber
#

oh i will check it

soft fiber
wet breach
#

Implementing the empty interface gives you access to the api methods above it while having a custom name

fluid river
#

thanks for your answer

wet breach
#

Np. Helping is what I like doing uwu

barren peak
barren peak
#

is there a way to disable vex ai (or at least prevent it from flying upwards after I force its velocity downwards) but still be able to set its velocity?

remote swallow
#

gradle or maven

#

@solemn frigate

nimble hill
#

You should use a builder like Grad/Mvn so you can do implementations

remote swallow
#

only way that i know to make the build jar smaller is with maven or gradle, you can build stuff to your maven local and use that in gradle and maven to make it easier

nimble hill
#

^ mmhm

#

Stuff like this

remote swallow
#

why you got paper and minimessages when its built into paper now

nimble hill
#

Is paperlib and kyori really in paper now?

quaint mantle
#

Gradle moment

nimble hill
#

And also because im not sure what is upstream or downstream of spigot so its better to be safe than sorry, not hurting anyone anyway

remote swallow
#

dont know about paperlib but i know that minimessages is in paper

nimble hill
remote swallow
#

is the jar your adding a local thing?

#

is it gradle or maven?

#

no pom.xml or build.gradle?

nimble hill
#

Raw wraps it all

remote swallow
#

i dont get the point of that

nimble hill
#

Easy for starting, more headache later

remote swallow
#

link the github

nimble hill
#

I did it when i was new too, till someone showed me how to use gradle

remote swallow
#

i started on maven and ive swapped to gradle now

#

im gonna hope you have the entire project

#

its gradle

#

if you do press control twice and type gradlew publishToMavenLocal then use gradle or maven to get it from your maven local, its then possible to make the jar smaller as long as it even supports it

nimble hill
remote swallow
#

im gonna guess the easiest way that i can think of is setting them to adventure mode

nimble hill
#

Oooo

#

Doubt thatll work but its an idea

#

Yea i cant do that, as soon as i check the event it seems like it was already placed on the client, id need to set it RIGHT BEFORE, but i cant

tranquil dome
#

I am working on a custom EntityFishingHook projectile, which is spawned into the world by using the following code:


        val craftPlayer: CraftPlayer = player as CraftPlayer
        val entityHuman: EntityHuman = craftPlayer.handle as EntityHuman
        val world = entityHuman.world

        val wireKunai = WireKunai(world, entityHuman)
        val location = player.eyeLocation

        wireKunai.setLocation(location.x, location.y, location.z, location.yaw, location.pitch)
        world.addEntity(wireKunai)

This does spawn the entity, but only for a short amount of time (it despawns). I have overridden all methods from EntityFishingHook that use this.die() and commented out the line, but this does not work. How do I make it so the fish hook stays and acts like a regular fish hook? The above method works, but only when I am holding a fishing rod.

crimson terrace
#

you got their repository? (unless its not needed idrk this stuff)

normal loom
#

Hello guys, what do you think is the best way to check if a player is using a custom item/consuming custom potion/ etc.?
Many people usually compare by displayname but I don't think it's the best solution since if a player has certain permissions he could change the displayname of an item.

drowsy helm
#

dont use item name its a horrible way of doing it

normal loom
eternal night
#

Well, specifically PDC

#

if you don't develop on like 1.8

normal loom
eternal night
#

?pdc

tender shard
#

yeah pdc is the only valid answer for 1.14+

round finch
molten hearth
#

is it an issue if you send chunks in a void biome type?

serene sigil
#

why doesnt this work? (it should detect if the block u placed is a shulker with a dragon egg in it)

tender shard
#

what do you nean with "doesnt work"? does it at least print the first msg?

#

btw you are getting the blockstate of the block that was there BEFORE the shulkerbox was placed

#

it should actually throw a ClassCastException in the ShulkerBox shulkerBox = ... line

#

getBlockReplacedState with be AIR in most cases (or another "replacable" block like GRASS etc)

serene sigil
#

i didnt really know what i was doing

tender shard
#

you can btw also get the inventory of the shulkerbox directly from the ItemStack instead of from the block, by casting the ItemMeta to BlockStateMeta, then casting the BlockState to Container

#
ItemStack myItem = ...;
if(myItem.getType() != Material.SHULKER_BOX)) return; // better use tags
BlockStateMeta meta = (BlockStateMeta) myItem.getItemMeta();
Container container = (Container) meta.getBlockState();
Inventory inventory = container.getInventory();
wet breach
serene sigil
#

well idk how u can get the itemstack

#

cuz it returns a block

wet breach
#

Inventory lets you grab itemstacks

tender shard
#

as I already said - do not use getBlockReplacedState, but get the BlockState of event.getBlock()

#

the "replaced" block is the OLD block, mostly air

wet breach
#

And as well as what alex is saying

serene sigil
#

wait whats the difference of .getBlock() and getBlockPlaced()?

tender shard
#

it's the same

#

as described in the javadocs

#

You currently try to cast the old block to shulkerbox which will 100% throw errors so I wonder why you didnt see those

serene sigil
#

like this?

#

@tender shard

tardy delta
#

Had to create some shitty domotica system in Java class today

#

We have to code with 2 People on one laptop now ;/

serene sigil
#

oof

tardy delta
#

Yesterday too

#

Sucks

serene sigil
#

ye

serene sigil
tardy delta
#

What messages are bein printed?

serene sigil
#

only the first and it gave me a classcastexeption at the shulker cast part

tardy delta
#

Only blockstate can be cast to sheulkerbox ig

#

Check docs and see what shulkerbox implements

serene sigil
tardy delta
#

One of them must extend blockstate

tender shard
tardy delta
#

So try casting blockstate instead of block

#

^^

tender shard
serene sigil
#

yay now its fixed!

#

tysm

fierce whale
#

those anyone know about java.lang.NoClassDefFoundError?
I actually defined the class but it always returns error 😦

tall dragon
#

it cannot find the class

crimson terrace
#

what are you doing with the class?

fierce whale
#

this is error all of error message

tall dragon
#

thats not the same error

fierce whale
#

oh

#

yeah

#

sorry

#
java.lang.NoClassDefFoundError: me/rukon0621/dialogquest/playerdata
        at me.rukon0621.dialogquest.main.onDisable(main.java:104) ~[dialogquest-1.0-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:266) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(JavaPluginLoader.java:399) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.disablePlugin(SimplePluginManager.java:578) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.disablePlugins(SimplePluginManager.java:555) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.clearPlugins(SimplePluginManager.java:633) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_18_R2.CraftServer.reload(CraftServer.java:978) ~[paper-1.18.2.jar:git-Paper-379]
        at org.bukkit.Bukkit.reload(Bukkit.java:909) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:54) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
#

        at org.bukkit.craftbukkit.v1_18_R2.CraftServer.dispatchCommand(CraftServer.java:906) ~[paper-1.18.2.jar:git-Paper-379]
        at org.bukkit.craftbukkit.v1_18_R2.CraftServer.dispatchServerCommand(CraftServer.java:869) ~[paper-1.18.2.jar:git-Paper-379]
        at net.minecraft.server.dedicated.DedicatedServer.handleConsoleInputs(DedicatedServer.java:510) ~[paper-1.18.2.jar:git-Paper-379]
        at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:484) ~[paper-1.18.2.jar:git-Paper-379]
        at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1456) ~[paper-1.18.2.jar:git-Paper-379]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1226) ~[paper-1.18.2.jar:git-Paper-379]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[paper-1.18.2.jar:git-Paper-379]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.ClassNotFoundException: me.rukon0621.dialogquest.playerdata
        at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:151) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:103) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
tender shard
#

you cannot load classes in onDisable

#

do Class.forName("me.rukon0621.dialogquest.playerdata") in onEnable

#

then the class is loaded at startup and you can use it in onDisable

fierce whale
#

So if i wanna load some class on Disable

tender shard
#

it's too late to load a class in onDisable

fierce whale
#

I had to load class on Enable

#

before disable

tender shard
#

yeah basically in onDisable you can only use classes that are already loaded

fierce whale
#

ahha

#

I got it thanks 🙂

tender shard
#

np

normal loom
#

I'm here again to ask to you guys, what's the best method to create a custom item object? Can't find an answer that satisfies me

#

Most people instantiate it inside a method, but I wish it was more something independent, like a class, but I don't know whether to extend ItemStack or not

tender shard
#

that's probably what they mean with custom items

serene sigil
#

hi, im stuck at detecting if the dragon egg got put inside a chest with a number key, also im using InventoryClickEvent

tender shard
#

you shouldnt extend ItemStack

#

the docs say you should only do that for classes (or interfaces) that are clearly marked as such or obviously made for this

serene sigil
#

the code i wrote so far (it detects if any item entered)

tender shard
#

just save your ItemStack in a field and return a clone() everytime you need a new one

normal loom
tender shard
#

yeah but why don't you just save that ItemStack in a field?

#
public class MyClass {
  private final ItemStack myItem;
  {
    myItem = new ItemStack(Material.DIAMOND_PICKAXE);
    // set custom name
  }
  public ItemStack getMyItem() {
    return myItem.clone();
  }
}
#

this is the proper way

#

this always returns an undamaged version of your item

#

yeah sure it would work, but you're not supposed to do it

normal loom
#

Yeah, but I should have a class that contains all these custom items?

tender shard
#

if you want to, sure, just make an "Items" class or similar

normal loom
#

for best practice

tender shard
#

you could just create public static final fields like Items.MY_CUSTOM_PICKAXE, Items.MY_CUSTOM_DIRT_BLOCK, etc

tender shard
#

or you could have a Map<String,ItemStack> in your main class if you have configurable items, then just do myMainInstance.getItem("my-custom-item-1") etc, whatever

#

there's a thousand ways to do this

normal loom
#

Okay, thanks for your help @tender shard @last temple

tender shard
serene sigil
#

and how to check if the thing u put inside is a dragon egg?

#

no

#

it also executes if i put in the egg

brazen hollow
#

Is there a way to make that shorter?

#

Smth like getShopItemMaterial(shopItem.id) != null ? that : Material.FILLED_MAP

#

And the problem is that all the stream stuff going on in the getShopItemMaterial is also executed twice

raw prairie
#

?learnjava

undone axleBOT
tender shard
#

in kotlin you could use the ? operator but not in normal java

#

or

ItemStack myItem = getMyCustomItem();
Material myMat = myItem == null ? Material.FILLED_MAP : myItem.getType();
#

I mean, both are longer code-wise but at least they don't call getMyCustomItem() twice

#

i'd probably use a method for this anyway

public static Material getMaterialOrDefault(ItemStack item, Material defMat) {
  return item != null ? item.getType() : defMat;
}

{
  Material myMat = getMaterialOrDefault(getMyCustomItem(), Material.FILLED_MAP);
}
#

also, sometimes the ItemStack will be AIR with an amount of 0 (e.g. in certain InventoryClickEvents), so MIGHT as well also check for that

#

yeah well, it doesnt call getCustomItem() twice

warm token
#

https://pastebin.com/xzCRUJJY

Idk why NBTAPI says that one of his methods isn't loaded
I mean, to be sure it would work, I even scheduled it in a Task 10s later, since this method is called after few ticks it's loaded

tender shard
#

getCustomItem() might be expensive, constructing or cloning ItemMeta, etc

#

what's NBTReflectionUtil.java:611?

tender shard
#

the method basically is one line

#

and you can reuse it everywhere else you might need it

#

doing things in one line is a stupid goal

brazen hollow
#

Nonono

tender shard
tardy delta
warm token
tender shard
vivid skiff
#

Is better to storage playerdata in a SQLite database or in a yaml?

tender shard
#

depends, I'd go for the player's PDC instead

#

that way you don't have to worry about I/O latency at all

#

otherwise, for both YAML and SQLite, you'd have to do stuff asyncs, using Futures or Callbacks or whatever

tardy delta
#

dont ask me wtf i was doing

eternal night
#

I mean

#

if your data is large and does not need a lot of writes

#

SQlite is fine

#

you'd just load the data on player join

warm token
eternal night
#

and write like every 5 mins or so and on disconnect

tardy delta
#

should probably implement that in my plugin too

tender shard
eternal night
#

I mean, I'd move anything that isn't a few flags or settings into a DB

tender shard
#

I wonder how much a written book is if you fill it with thousands of pages

eternal night
#

too much

serene sigil
#

how do u get the item that a fox is holding in its mouth?

tender shard
#

probably getEquipment().getItemInMainHand() ?

eternal night
#

^

tardy delta
#

going back to a project after a few months goes brr

#

i have no idea what i was doing

serene sigil
tender shard
serene sigil
#

if no, i just have to do EquiptmentSlot.HAND and OFF_HAND

tender shard
#

ofc they cannot do it naturally

#

only if a plugin makes them wear it but even then it's probably invisible except for when used as helmet

hasty prawn
#

wtf

tardy delta
#

wrote that shit a while ago

#

i knew it was bad but couldnt find a better way

opal juniper
tardy delta
#

yoo wheres my fancy color

opal juniper
#

nitro

tardy delta
#

🙄

opal juniper
#

broke ass

tardy delta
#

nah

#

new code ig

#

should probably abstract away plugin.getLang(LangKey)

vocal cloud
#

Not paying Discord enough

#

Gotta make that flashbang profile page

tender shard
#

nitro is such a rip off

opal juniper
#

yes

tender shard
#

I only got it for longer text msgs and higher file limit

opal juniper
#

considering nitro basic cause all i use are the emojis

tender shard
#

I mean nitro "normal" also gets a free server boost IIRC?

vocal cloud
#

2

tender shard
#

oh fr?

vocal cloud
#

I think so?

tender shard
#

yeah youre right

#

and 30% off for additional boosts

opal juniper
#

i only have those 2

vocal cloud
#

Yeah, I've been boosting this and another server for years. Mainly cause I'm lazy

tender shard
#

me too

#

also I don't want this fancy pink color gone

echo basalt
#

emotes would be cool

vocal cloud
echo basalt
#

I only need nitro "basic"

#

to spam crazy frog emotes

vocal cloud
#

You have nitro tho thonk

echo basalt
#

I got nitro basic

opal juniper
#

yeah i might downgrade at some point

hasty prawn
vocal cloud
#

Stickers are great too

opal juniper
#

stickers suck

#

hate em

vocal cloud
#

Same but at the same time

opal juniper
vocal cloud
#

yknow what sucks. Bots used to have the same file limits as users until some users decided to ruin it for everyone by making file sharing bots sadge

vocal cloud
#

Ew betterdiscord

tender shard
#

betterdiscord isnt really better imho

#

I mean, what actually does it add?

opal juniper
#

a lot

#

the seeing invisible channels is cool

cobalt marlin
#

plugin api, themes

opal juniper
#

but yeah, the plugins are the good thing

tender shard
#

"somebody once told me" it was able to hide "3 messages hidden from blocker user" but I never found that option

hasty prawn
#

It adds breach of TOS is what it adds lol

hasty prawn
#

And perhaps some security holes

#

Very good h_thumbsup_parrot

tender shard
#

yeah it's not exactly worth it imho lol

wet breach
#

?verify

tender shard
#

i mean who cares about the theme of an app?

wet breach
#

!verify

tender shard
#

!verify

undone axleBOT
#

Usage: !verify <forums username>

#

Usage: !verify <forums username>

cobalt marlin
#

i dont have a spigot account lol

summer mountain
#

Not sure if its the right place to ask this since its mostly resource pack related but once i've made it in blockbench, obviously you can replace existing mobs but how do you go about adding it for the custom mob without making it name dependant (e.x Having to name a mob to spawn the custom mob).
Like if you have an NMS mob and want to add a texture for it.

cobalt marlin
#

i write my own plugins or get the core ones like luckperms and ncp from github

tender shard
cobalt marlin
#

yea ik

#

idrc

hasty prawn
#

Resourcepacks can only overwrite existing models/textures

#

Afaik anyways

tender shard
cobalt marlin
tender shard
#

a zombie will always have the zombie texture

cobalt marlin
#

no

hasty prawn
cobalt marlin
#

armor stands

tender shard
hasty prawn
#

Yeah that's not a new entity KEKW

cobalt marlin
#

yea but to the player it is the same result

hasty prawn
#

True but that's not what they asked smoil

cobalt marlin
#

i think thats mostly what they meant?

tender shard
#

they said they have "an nms mob" and want to add a texture for it

#

and that's not possible without making all the same mobs also change appereance

#

appearance

#

i never know how to write this word

cobalt marlin
#

yeah but you could reimplement the mob as armor stands

tender shard
#

english spelling is fuuucked

cobalt marlin
#

if you really wanted to

hasty prawn
cobalt marlin
#

it doesn't really matter what happens in the backend as long as the player sees what you want

hasty prawn
#

We're all right

summer mountain
#

My end goal is to create a mob with its own texture that has its own patterns on how it behaves, I was planning to go the nms route but would going with amour stands make this easier? or possible then?

hybrid spoke
#

changing the behaviour and what not of an already existing mob would require nms and shit. armorstand would mean you can define your own behaviour with the api but have to start from scratch

summer mountain
#

Alright so armour stand would allow more freedom but would be harder to do?

cobalt marlin
#

yes

#

also consider server performance cost

#

you will not want many armor stand mobs

hybrid spoke
#

why not

cobalt marlin
#

all the animations have to be done on the server

hybrid spoke
#

what animations

#

he wants to apply a custom model

#

thats just changing an itemstack

cobalt marlin
#

yeah but any mob with functionality will be doing more than standing in place

summer mountain
#

What would be good resources to get started on learning armour stands?

quaint mantle
#

if I set a variable (plotCoords) like this:

public final class Housing extends JavaPlugin {
    public static Housing inst;
    public static int[][] plotCoords = new int[2147483647][3];

will it save past server reboot?

#

for player data ive been using persistent data container but that doenst have a container

summer mountain
quaint mantle
#

and I've used config.yml in the past, but it didnt save past reboot

echo basalt
#

oh god you absolutely don't know what you're doing, do you?

tardy delta
#

you have to save config after setting something

quaint mantle
#

pretty sure I did that 🤔 idk this was a couple months ago

meager horizon
#

Hello! Does anyone know how to get rid of the question mark behind chat messages in 1.19.2? I'm currently using Freedomchat, but I'd like to fix it manually.

tardy delta
#

why would you want to create a 2 billion int array

quaint mantle
#

I just need it to be big so I thought why not 32-bit integer limit

#

idk how big I would want it

#

I could use a class that changes size

tardy delta
#

thats not how oop works

quaint mantle
#

ig

#

I meant like a vector

#

from c++

hasty prawn
#

List

quaint mantle
#

yeah thats what its called

tardy delta
#

🤔

hazy parrot
#

its literally list object

hasty prawn
#

Yeah use that instead of an array of 2 billion ints

quaint mantle
#

forgot the name for a second

quaint mantle
#

💀

#

cus the [3]

hasty prawn
#

yeah dont

quaint mantle
#

which represents a coordinate

hasty prawn
#

dont do that KEKW

quaint mantle
#

lmao

hasty prawn
#

List<Location> ez

quaint mantle
#

fr

tardy delta
#

i actually seem to have forgotten but doing arr[i] on a new int[0] will return 0 right

#

like array prefilled with default primitives?

hasty prawn
#

It'd say IndexOutOfBounds, no?

#

You're making an array with size 0 and tryna access index i

tardy delta
#

ah lets say new int[10] then

hasty prawn
#

Yeah it'll return 0 I'm guessing

tardy delta
#

was just talking bout an array where stuff isnt being put in

wet breach
#

in case anyone was curious in what it would return

hasty prawn
#

how would that return anything

wet breach
#

because it still creates an object just one that doesn't have space

tardy delta
#

prints 0

hasty prawn
#

Yeah figures

#

Try 0 and see what it does

#

Should say IndexOutOfBounds

wet breach
# tardy delta

this is because the compiler detects it and changes it

#

there is a way though to get it to be really 0

tardy delta
#

ah

meager horizon
hasty prawn
#

No idea what question mark youre talking about

#

Send a ss of it

tardy delta
#

signed chat?

hasty prawn
#

Probably

tardy delta
#

or whatever its called

meager horizon
#

Thing with chat moderation

wet breach
hoary perch
#

Is there a way to check if a enderchest contains (any type of) a shulkerbox that contains the dragon egg?

tardy delta
#

still using 1.17 api

meager horizon
meager horizon
wet breach
#

I am going to assume it has something to do with yaml and dutch

#

if not that, then you most likely are going to probably have to use the UTF escape code for the character that appears as a question mark

tardy delta
#

isnt a non recognized char just a rectangle box?

wet breach
#

sometimes

#

that is usually if the character code is outside of the encoding's range

hasty prawn
#

ah yeah bc why would it be consistent

wet breach
#

if it is in the range, but the code isn't assigned a character its generally a question mark

meager horizon
#

Would it be hard to fix? 'Cause I'm gonna be honest: I'm pretty much not educated in all of this stuff

#

I have absolutely zero knowledge of what I'm doing

wet breach
#

I don't know what the character is supposed to be, but you could try replacing that character with a utf escaped one instead

#

it should resolve the problem

meager horizon
#

Uh, well... I have no idea what that is

wet breach
#

its in your config

tardy delta
#

tf was i doing like four months ago 💀

wet breach
#

obviously find the position where such a character would be

wet breach
meager horizon
#

where can I find the yaml?

tardy delta
#

more like messing with constants

#

seems like it has bugs in it

wet breach
vivid skiff
#

How can i spawn an entity death particles?

wet breach
#

spawnparticle?

vivid skiff
wet breach
#

give it velocity

echo basalt
# tardy delta prints 0

Basic explanation: Primitives can't be null, instead they have a default value (0 / false). The array's length is 10 so you can't be out of bounds, yet all the values are unset so they're defaulted (object default value is null)

tardy delta
#

👀

#

havent been using arrays for ages

#

smh i rejoin my server after being 3 months idle

#

looks like copilot did smth stupid

wet breach
#

arrays are fun

#

until they start breaking the rules

tardy delta
#

until you get out of bounds

#

ok i forgot an i + 1 and that caused the error

quaint mantle
#

how do I use the /fill function using spigot

opal juniper
#

for loop

quaint mantle
#

effort

#

not really though

#

lol

twilit roost
#

I have the black square.
and I want to fill it with other squares ( orange )
for that I need to get positions of corner 1 ( yellow line intercepts it) and corner 2 ( green line intercepts it )

I know by how much I should change X and Z coordinates of rectangle, so they will fit in perfectly.
Also I know how many of those rectangles there will be.

next plume
languid flare
#
java.lang.UnsupportedClassVersionError: net/cubepix/Cubepix has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at net.md_5.bungee.api.plugin.PluginClassloader.findClass(PluginClassloader.java:152)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at net.md_5.bungee.api.plugin.PluginClassloader.loadClass0(PluginClassloader.java:66)
    at net.md_5.bungee.api.plugin.PluginClassloader.loadClass(PluginClassloader.java:59)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at net.md_5.bungee.api.plugin.PluginManager.enablePlugin(PluginManager.java:340)
    at net.md_5.bungee.api.plugin.PluginManager.loadPlugins(PluginManager.java:250)
    at net.md_5.bungee.BungeeCord.start(BungeeCord.java:271)
    at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:67)
    at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15)```
#

my java is out of date?

tall dragon
languid flare
#

how can i fix this?

tall dragon
#

what spigot version are you using

warm token
languid flare
eternal oxide
#

It includes imports

tall dragon
languid flare
#

Ok, thanks 🙌

#

i'll try again

tall dragon
#

or compile ur plugin to java 8

warm token
eternal oxide
#

From the error it looks like you are either not depending on nbtapi, you callled your config too early, before nbtapi was loaded, or your nbtapi is out of date

#

Config.java:99

warm token
#

Even cause I tried to use that method via command, and it still give me this error
And nbt isn't outdated

eternal oxide
#

nbt is sying it can;t find that method

#

which is a setUUID method

languid flare
#

@tall dragonHow can I compile a plugin on an older version?

eternal oxide
languid flare
#

Ok

eternal oxide
#

your Server looks to be running on Java 8

#

update the Java on your server or compile with a source/target of 8

tardy delta
#

what the

eternal oxide
#

Its sensible as reflection is slow. Caching is optimal

tardy delta
#

i see..

#

im wondering if methodhandles can be used for the same purpose?

#

in terms of getting fields, getting and setting value etc

eternal oxide
#

yes, so long as its an instance

#

yes

tardy delta
#

and those are assumed to be faster right?

eternal oxide
#

yep

tardy delta
#

hmm i might want to use them then

warm token
eternal oxide
#

have you tried on a version other than 12?

#

The only other thing I can think (as I've not read anything other than your error), is this error happenign at a specific time? ie shutdown.

warm token
#

I mean, that method it's used once the plugins gets enabled, I thought that since my plugin name starts with A, NBT is not loaded yet, but even scheduling a task, or calling it using "/test" command, returns the same error

hoary perch
#

How can i check an enderchest for special items if the player closes it (inventoryCloseEvent)? with any for loop or smth?

fluid river
#
Player#getEnderChest().getContents().forEach(i -> {

});```
tardy delta
#

impact of Bukkit.createExplosion(40) go brr

hoary perch
fluid river
#

yes

hoary perch
#

okay

fluid river
#

i mean it's item for current loop step

#

oh shit

#

it's array

#

forEach's not gonna work

hoary perch
#

how?

vast raven
fluid river
#
for (ItemStack i : Player#getEnderChest().getContents()) {

}```
hoary perch
#

thanks

warm token
fluid river
#

what's the difference between inventory and inventory.getContents()

#

except one is Iterable and second is Array

vast raven
tardy delta
#

uses an

eternal night
#

I mean Google any weighted randomness in java

glossy venture
#
HashMap<Inventory, MenuGUI> guis = new HashMap<>();

@EventHandler
void click(InventoryClickEvent e) {
  MenuGUI gui = guis.get(e.getClickedInventory());
  if (gui == null) return; // didnt click an active GUI
  MenuItem item = gui.getItemAt(e.getSlot());
  if (item == null) return; // didnt click a menu item
}
#

smth like this

tardy delta
#

pass in the same itemstack then smh

eternal oxide
#

If you require NBTAPI your plugin MUST add it as a depends in your plugin.yml

tardy delta
#

dont use pdc but use the above thing

hoary perch
#

idk why

#

ah it isnt working if i dont shift click it in

#

nvm i know why

#

it is not working with air

#

it is crashing with a nullpointerexception

tardy delta
#

cuz its null duh

hoary perch
#

i know

warm token
eternal oxide
#

?paste your plugin.yml

#

wakeup bot

hoary perch
tardy delta
#

yes

eternal oxide
#

looks fine. now show the code that is generating this error

languid flare
#

@tall dragonI achieved 🥲

eternal oxide
#

I see no reason for it to not find that method. The alternative is to set it as a string rather than a UUID object

#

uuid.toString() and UUID.fromString()

languid flare
#

would like to create a group system for BungeeCord. Where should I start?

#

example: /group user set admin

#

should i use enum?

eternal oxide
#

When depending on other plugins you should not assume they are actually up and running until after ALL onEnables are finished.

vast raven
#

But even testing through a command, so when all plugins are loaded, it doesn't work

#

(I'm his friend)

eternal oxide
#

in a Task would be fine as that runs at earliest 1 tick later

#

I see nothign wrong in the snippets of code he has show and nothing wrong in his API useage

vast raven
#

Even through a command you get that error

hoary perch
#

which chat event can i use which is not deprecated?

eternal oxide
#

makes no difference, 1 tick is all it needs to guarantee to be after all are enabled

hoary perch
vast raven
#

(still doesn't work tho 200 or 1 tick)

eternal oxide
#

I'd suggest use uuid.toString() to set it and see if that works

#

as in setString("bomba", uuid.toString());

#

if that works, its some issue in NBTAPI

#

You may want to add an API version to your plugin yml, so spigot knows how to handle it

hoary perch
#

can i convert a component back?

chrome beacon
#

to a String?

hoary perch
#

so i wont get smth like this

chrome beacon
#

Send the component instead of turning it in to a string

hoary perch
#

im using bukkit.broadcast

chrome beacon
#

Then use that

hoary perch
#

Operator '+' cannot be applied to 'net.kyori.adventure.text.@org.jetbrains.annotations.NotNull Component', 'net.kyori.adventure.text.@org.jetbrains.annotations.NotNull
ill get an error

chrome beacon
#

Wait are you using adventure text components

hoary perch
#

Bukkit.broadcast(e.getPlayer().displayName() + Component.text(" §7| §8 ") + Component.text(e.getMessage()));

hoary perch
chrome beacon
#

Yeah that's not part of the spigot api

#

You're probably depending on Paper

hoary perch
#

yes im using this but can you still tell me how to use it?

chrome beacon
languid flare
#

how can i get UUID player with BungeeCord?

languid flare
#

thanks

normal loom
#

Guys I can't cancel the event of moving an item in another inventory, if I try to move an item with numbers it works

eternal night
#

That is for hoppers etc

languid flare
#

@chrome beacon

public class Find extends Command{

    public Find() {
        super("find", "bungeecord.command.find", new String [0]);
        
    }
    @Override
    public void execute(CommandSender sender, String[] args) {
        if(args.length !=1) {
            sender.sendMessage(new TextComponent(ChatColor.RED + "Digite /find <nickname>!"));
        } else {
            ProxiedPlayer player = ProxyServer.getInstance().getPlayer(args[0]);
            
            
            sender.sendMessage(new TextComponent(ChatColor.YELLOW + "Info"));
            sender.sendMessage(new TextComponent(ChatColor.WHITE + " Nickname: " + ChatColor.GREEN + player.getName()  ));
            sender.sendMessage(new TextComponent(ChatColor.WHITE + " Rank: "  + ChatColor.GREEN + player.getGroups() ));
            sender.sendMessage(new TextComponent(ChatColor.WHITE + " UUID: " + ChatColor.GREEN + player.getUniqueId()));
            sender.sendMessage(new TextComponent(ChatColor.WHITE + " First login: " + ChatColor.GREEN ));
            sender.sendMessage(new TextComponent(ChatColor.WHITE +  " Last login: " + ChatColor.GREEN ));
            sender.sendMessage(new TextComponent(ChatColor.WHITE + " Servidor: " + ChatColor.GREEN + player.getServer().getInfo().getName()));

            
            
        }
        
    }

}
chrome beacon
#

Yeah

languid flare
#

sender.sendMessage(new TextComponent(ChatColor.WHITE + " Rank: " + ChatColor.GREEN + player.getGroups()));

eternal night
#

Mixing legacy colour codes and components doesn't work

languid flare
chrome beacon
#

It just returns a Collection

languid flare
#

I would like "Rank: ADMIN"

fickle mist
#

How to get the first player message after entering a certain command

tardy delta
#

listen for chat event

serene sigil
#

ive searched EVERYTHERE and i didnt find an answer...

#

is there a way to detect if an item got destroyed in creative mode with the remove item slot?

quaint mantle
#

Yeah, use getItemInMainHand function

#

BlockDestroyEvent, if player.Gamemode == GAMEMODE.CREATIVE

#

If Is true, getItemInMainHand === Material.BlockThere

#

I wrote it to you very superficially, then you see

serene sigil
quaint mantle
#

Check if when you broke the block the item you are holding is the one that intersects you

#

Didn't you ask for this?

serene sigil
#

ohhh

#

no

quaint mantle
#

Then I don't have approx

serene sigil
#

what im asking is that is there a way to detect if u destroyed an item with the X button in the inventory

quaint mantle
#

Oh

serene sigil
#

ye

quaint mantle
#

It should be an event, but I don't want to say nonsense

#

Search on spigot hub

serene sigil
#

i didnt find

quaint mantle
#

Wait a minute, I'm looking for it for you

serene sigil
#

well, i didnt find anything

quaint mantle
#

InventoryAction

#

It should be here

serene sigil
#

cant find any matching enum

round finch
#

any good tutorials for this?

chrome beacon
#

?

#

wdym

round finch
#

Making Math into code

eternal night
#

Automated ?

round finch
#

with java exemple?

chrome beacon
#

Do you want to make a math parser?

quasi flint
round finch
eternal night
#

I mean, you want to generate source code from a math equation

#

Which, that is just transpilation

round finch
#

Math Expression Parser in java?

#

conclude

chrome beacon
round finch
#

wanting to learn for algorithms

golden turret
#

im in 1.8 and I need to set the armorstand item in hand. I tried this but it is not working

#

and yes, I spawned the entity

eternal night
quasi flint
#

Go away 1.8

chrome beacon
#

Why are you spawning it with nms

golden turret
#

because i need it for individual players

tardy delta
#

should be workin on my expression parser tho

round finch
#

more for tasks and loops

chrome beacon
golden turret
chrome beacon
#

Since you're using packets have you sent the entity meta

round finch
#

Algorithms and Pseudo Code hmmmm

chrome beacon
#

No idea then

normal loom
#

I'm trying to spawn a chest in a random position in my player inventory, but sometimes it appears as equipment, any suggestion?

#

I do this:

golden turret
#

bruh

normal loom
#

I think it's because of the index

golden turret
floral drum
#

meow

normal loom
#

but dont know what indexes are for equipment

golden turret
#

olivo

chrome beacon
#

?

golden turret
#

I wanst stand.setArms(true)

#

thats why

chrome beacon
#

ah

serene sigil
chrome beacon
#

No there isn't

#

The creative mode inventory is client side

serene sigil
#

bruh

#

so theres no way to detect sth like that?

chrome beacon
#

Creative mode players have full control over items

serene sigil
#

oh

chrome beacon
#

Working with the creative mode inventory is a pain

#

Why do you want to detect if an item is deleted?

serene sigil
#

i wanted to detect if an item is removed from the inventory in creative mode

#

because u get special effects if u have it

chrome beacon
#

When a player picks up the item to their cursor it is removed from the server

#

iirc

#

(Creative mode only)

serene sigil
#

but its kina optional...

eternal oxide
chrome beacon
#

The client doesn't send a close packet for the player inventory

#

It doesn't even send an open inventory packet

serene sigil
#

nah but its ok

eternal oxide
#

thats a bunner

chrome beacon
#

You can't detect if the player inventory is open

serene sigil
#

i have another question tho...

#

how do u detect if u put an item in a chest with the number key

chrome beacon
#

InventoryClickEvent

round finch
serene sigil
#

ik its invclickevent but theres no good way of detecting it

round finch
#

since client can lie

chrome beacon
#

How did you detect it?

round finch
normal loom
serene sigil
#

ye ik this part

#

but getting the item itself is challenging

chrome beacon
#

?

#

What's the problem

serene sigil
#

only dragon egg

normal loom
#

check if the item is a dragon egg

round finch
#

but it is very poor so dont judge me

serene sigil
chrome beacon
normal loom
serene sigil
#

doesnt work

#

it only triggers if u put the egg out of the chest

#

not in

normal loom
#

could you paste your code?

serene sigil
chrome beacon
#

Check if current item is null or air

#

Then check the item in the hotbar slot

tardy delta
#

&& is a thing

chrome beacon
#

^

serene sigil
#

only out

normal loom
chrome beacon
serene sigil
chrome beacon
#

So check the hotbar item

#

always check it I guess

serene sigil
#

which makes sense

#

what does getCursor() return?

chrome beacon
serene sigil
#

ye but theres no cursor in number key

chrome beacon
#

Yeah so it's null or air

serene sigil
#

okay

serene sigil
static ingot
#

You could be getting an item from an event before it's actually set to the netherite tool. It's hard to tell without any additional context.

#

Are you including api-version: 1.16 in your plugin.yml?

normal loom
round finch
#

@chrome beacon Store Clicked Inventory to memory

inventory open event check if it matchs the stored inventory?

static ingot
#

I think you just use the major update version, so 1.16.5 might be invalid to your plugin.yml, but 1.16 might work

#

weird

normal loom
chrome beacon
#

The InventoryOpenEvent doesn't fire for the player inventory

round finch
#

i gotta find the source

static ingot
# round finch i gotta find the source

To the server, the player inventory is effectively "always open," so even if there isn't one open then that's what will be returned. There is no way to differentiate.

#

Unless you maybe listen to InventoryClickEvent, then you can make a "well-educated guess" that it's currently open if no other one is, lol.

smoky widget
#

I'm trying to save an inventory in mongodb but I can't create an array in a sub object. I would like to do this :

I tested several codes with "$set" except that "set" puts me "inventory" and "slot" in object and "addToSet" puts me "inventory" and "slot" in array I would like "slot" to be an array and "inventory" an object

the codes I tested :

first : dbCol.updateOne(playerData, new BasicDBObject("$set", new BasicDBObject("inventory", new BasicDBObject("slot", new BasicDBObject(String.valueOf(i), itype)))));

second: dbCol.updateOne(playerData, new BasicDBObject("$addToSet", new BasicDBObject("inventory", new BasicDBObject("slot", new BasicDBObject(String.valueOf(i), itype)))));
pliant oyster
smoky widget
#

if it is not clear, I can make a schema of what I would like to do

sharp verge
#

Hi im trying to figure out how to check what part of a bed is right clicked in an event. How would i do this ?

eternal oxide
#

?jd-s

undone axleBOT
sharp verge
undone axleBOT
sharp verge
chrome beacon
#

What version are you coding against?

eternal oxide
#

No, the Part comes from teh BlockData not the Block

chrome beacon
eternal oxide
#

As above, use Tag to check its a bed, then cast BlockData to bed (which is also directional). Get teh head or foot, get facing and getRelative

sharp verge
#

that was spam mb

tardy delta
#

isnt that old api?

#

cant seem to find it

tardy delta
#

hmm that wasnt there when i was looking, anyways

sharp verge
eternal oxide
#

you cast BlockData to Bed

#

not the Block

sharp verge
#

like so ? java public Bed.Part getBedPart(Location loc) { Bed bed; if (loc.getBlock().getType() = Tag.BEDS) { bed = (Bed) loc.getBlock().getBlockData(); return bed.getPart(); }

eternal oxide
#

no

#

if (Tag.BEDS.isTagged(loc.getBlock().getType()))

sharp verge
#

What about the BlockData part did that look fine ?

eternal oxide
#

yes

sharp verge
#

Noice

#

I don't think its linked to the recent inquire i had but i keep getting this error message. It keeps spamming the server console and the server doesn't start

undone axleBOT
sharp verge
eternal oxide
#

wrong version of packet events?

sharp verge
#

Well it didn't happen before, and i just removed the plugin with the code from above

#

So the only change is not in the files anymore and it still occurs

eternal oxide
#

the code above has nothign to do with it

sharp verge
#

But nothing changed from then and now other than the code above

eternal oxide
#

It would be impossible for the above code to cause that error

sharp verge
#

yea also the code is not active in the files anymore so it would deff not be possible

chrome beacon
#

That error is common on 1.8

sharp verge
#

im on 1.17.1

chrome beacon
#

Aight

sharp verge
#

I have viaversions tho

eternal oxide
#

probably one of your plugins incorrectly shaded packetEvents

#

it uses teh same injection method as viaversion

sharp verge
eternal oxide
#

No idea I don;t use any of those plugins

sharp verge
#

Its just a tad wierd because it didn't occur earlier this evening

#

And nothing was changed as in nothing

slow oyster
#

Anyone know a nice way to get the persistentdatacontainer for an OfflinePlayer?

chrome beacon
sharp verge
#

That is litteraly what is causing the problem xd

#

lemme send the latest log

tardy delta
chrome beacon
sharp verge
#

IT appears out of no where

#

With zero information

slow oyster
#

I just based my new persistence all around PDC and I forgot Offline Players dont have access to the PDC lmao

tardy delta
#

lmao

#

pdc should more be used to save simple stuff or flags or smth

sharp verge
#

Fourteen do you have any clue towards my issue? Replacing all plugins seems a bit... much idk

#

Might be what is needed

tardy delta
#

check what plugin causes it first

slow oyster
#

Hmm, it's very useful performance wise to store things directly against the Player/Chunk/Block tbf. I guess I can go down a custom PDC route

sharp verge
#

Well it happens right after the placeholderapi

golden turret
#

my custom entity is not spawning

#

1.8

tardy delta
#

performance shouldnt be the main reason to prefer using pdc over another kind of persistent storage

chrome beacon
tardy delta
#

BiFunction<T, U, R>

#

or create one yourself