#help-development

1 messages · Page 493 of 1

tribal quarry
#

but somehow there is no wiki for completion colors lol

lyric turtle
#

isnt that just custom implementation??

tender shard
#

what even do people mean with "completion colors"?

lyric turtle
#

idk lol

#

im not even talking about completion

#

im talking about color while typing in console

tender shard
#

can you show a screenshot of what you mean?

tribal quarry
#

like if you type an unknown command, then it becomes red in jline

lyric turtle
#

"line highlighting functionality"

#

i guess

tender shard
#

definitely not part of spigot

tribal quarry
#

found it

#

BrigadierCommandHighlighter

#

its handled by minecraft

#
builder.append((buffer.substring(pos)), AttributedStyle.DEFAULT.foreground(AttributedStyle.RED));
lyric turtle
tribal quarry
#
   LineReader lineReader = LineReaderBuilder.builder()
                              .terminal(terminal)
                              .completer(new MyCompleter())
                              .highlighter(new MyHighlighter())
                              .build();
lyric turtle
tribal quarry
#

google skills 💀

tender shard
lyric turtle
#

i mean in minecraft code

paper viper
tribal quarry
tribal quarry
tender shard
# paper viper You mean java

no, they mean using spigot. obviously you can create your own CLI interface in java, but good luck doing that using spigot, where you are supposed to just "listen" to incoming commands and not just try to handle any console input yourself

tribal quarry
#

io.papermc.paper.console.BrigadierCommandHighlighter, that is a paper feature

tender shard
tribal quarry
#

my brain

lyric turtle
#

yeah?? i thought that its spigot feature...

#

my bad i didnt checked

tender shard
tribal quarry
#

but you can implement it your on in spigot too

#

^

tender shard
#

show your config.yml

eternal oxide
#

LIne 189, 205 include if they have no entry in PlayerDropConfig

#

and 222 etc

#

I'm assuming PlayerDropConfig doesn't have any entry for a player by default.

kind hatch
#

?nocode

undone axleBOT
#

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

onyx fjord
#

any way i can tell if block is a shulkerbox without making an if for every color?

hushed spindle
#

so spigot uses a list where you can't add anything, when it comes to block drops, is it possible to add more entries to this list anyway using reflection or something

tawny remnant
#

How can I make my npc attack a player?

hushed spindle
onyx fjord
#

kinda a solution

hushed spindle
#

or check if the block is an inventory holder and see if that type is of a shulker box

hushed spindle
#

yeah yeah i know i more meant that you cant add anything to it

#

but what if you want to add something anyway

#

can you do it with reflection

eternal oxide
#

Why not just drop it yourself?

hushed spindle
#

doesnt play nice with other plugins

onyx fjord
#

you will go to jail

#

maybe fire a new event idk

hushed spindle
#

this isnt an issue on paper or purpur or whatever, can add things to them just fine

onyx fjord
#

i dont remember what my solution was

pseudo hazel
kind hatch
#

I'm not sure why you couldn't be able to add items to it. It says it's mutable. Meaning it should allow you to add new ones.

hushed spindle
#

right, but it still throws an IllegalOperationException when you do

#

i have no clue why spigot has this restriction still

onyx fjord
hazy parrot
#

as ShulkerBox extends block state

onyx fjord
#

not sure about that one

hushed spindle
#

it extends Container, Lidded, and Lootable

onyx fjord
#

it would be a different package

#

block.data.type or whatever

hushed spindle
#

it is a blockstate though

hazy parrot
hushed spindle
#

if you look at its superinterfaces

onyx fjord
#

oh damn thats weird

hushed spindle
#

nuh uh

#

blockstate is also in org.bukkit.block

hazy parrot
#

it extends container which extends tilestate which extends blockstate

pseudo hazel
#

you misspelled event in your config

#

nvm

#

im blind

#

also your codestyle is weird

desert tinsel
#

how to hide a player nametag just for some players, and other player can see it?

eternal oxide
#

scoreboard Teams

desert tinsel
#

yes, but how can I set the visibility just for a player

tawny remnant
#

How do I make this calculation for the NPC to look down like a goblin instead of looking normaly at me? (byte) ((pitch%360)*256/360)

weak meteor
#

Someone nows about log4shell?

vocal cloud
#

I'm sure most active devs do

quaint mantle
#

Hello, i got a little question.
I am trying to download JDK 8 for making a plugin, and i dont have an account on oracle and i dont have to make one because i need to input all my information
So i want to hear if anybody who has a account couldt send it to mee

eternal oxide
#

Don't use Oracle. OpenJDK or Adoptium

floral drum
#

I don't get why oracle did that tbh

#

like why do you need my information to download jdk 8 💀

eternal oxide
#

I believe there is a tiny link to download without an account still, but it's hard to spot

quaint mantle
#

I cant send a screenshot

eternal oxide
#

Eclipse Adoptium provides prebuilt OpenJDK binaries from a fully open source set of build scripts and infrastructure. Supported platforms include Linux, macOS, Windows, ARM, Solaris, and AIX.

floral drum
quaint mantle
#

What is best or is it just the same?

eternal oxide
#

it makes no real difference which you pick

quaint mantle
#

.msi or .zip?

eternal oxide
#

msi to install

#

zip if you don;t need to instal and just want to access

quaint mantle
#

Okay thank you so much 🙂

desert tinsel
#

I try to find a way to hide players' nametags, and I know you can do that with teams, but I want to make a plugin that hides all players' nametags, but some players who are "friends" can see their nametags, and at the same time, each player can see other players' nametags if they are at a certain distance from them, what would you recommend me to try to do?

boreal remnant
#

hey how do I update my spigot server to current version? I cant find any helpful videos?????

tender shard
quaint mantle
#

Why do i have this boring menu while creating a new projekt where other people have a cool looking menu?
Everything for me is on the same page and for other people its split out in around 5 pages or something

#

hello

#

i need help

#

what is the name of sharpness in ItemStack?

desert tinsel
#

Enchantment.DAMAGE_ALL

quaint mantle
#

ok

#

thanks

#

and what's name of protaction and unbreaking?

desert tinsel
quaint mantle
gleaming grove
#

Why do I getting this error? error: package org.bukkit does not exist import org.bukkit.ChatColor; ^ dependencies { compileOnly 'org.spigotmc:spigot-api:1.19.4-R0.1-SNAPSHOT' compileOnly 'org.projectlombok:lombok:1.18.22' }

desert tinsel
sterile token
#

For building the bold method, do they use some sort of functional interface or what?

GuiItem clickItem = ItemBuilder.from(Material.GOLD_BLOCK).asButton().action((InventoryClickEvent event) -> {});

GuiItem dragItem = ItemBuilder.from(Material.IRON_BLOCK).asButton().action((InventoryDragEvent event) -> {});

#

I mean is that even posible?

gleaming grove
sterile token
#

Right, but would allow to change the object being consume?

#

There is where i get stuck, im not sure if i will allow to do exactly that

quaint mantle
#

Why cant i find my jdk when im trying to put it in my plugin? i cant see it when i am going to its location

gleaming grove
#

Example with functional interface public interface CustomEvent { void onExecute(Player player, int age); } ```

public Main asButton()
{
    return this;
}

public Main Action(CustomEvent arg)
{
    return this;
}  ```  ``` new Main().asButton().Action((player, age) -> {

    });```
sterile token
#

.

I have thought that i can make a MenuEvent and them sub events for clicking and dragging. To finally make the Consumer<MenuEvent>

#

Because my main goal is to allow the end user, to decide if the action will be for the click or drag event

gleaming grove
#

I think if you want to have more then one parameter in lamda then use functional interface so there could be as much parameters as you what. In case of passing single object better to user Consumer<T>

sterile token
#

Something like?

gleaming grove
#

like here there are 2 parameters

sterile token
#

oh ok

#

thanks man

#

I will write the logic and publish it here, so you tell me your opinion or give suggestions

gleaming grove
#

sure

sterile token
#

So far the creaiton looks pretty clean

#

Im opened to suggestions!

gleaming grove
#

tbh I've never seen syntax like .action((MenuClickEvent event) ->... mostly I see .action(event ->...

sterile token
#

Yeah me too

#

But i have thought that why adding 2 method for the actions, if you can just change the event of it

#

I didnt know you could do that tho

gleaming grove
#

what about generic type?

#

like .action<MenuClickEvent>(event -> {})

#

then you can register as many events of different types using only one method as you want

sterile token
#

you broken my braisn with that, i didnt thought even you can do that

gleaming grove
sterile token
#

Java has so sweaty things i didnt know

#

My originally question started wheen i seen this example of on open source menu. So far it called my attention if i can adapt it to my use. Making you using the same action method, but changing the type (either dragging or clicking) of it

hazy parrot
#

TIL you can have typed lambda parameters in java lol

echo basalt
#

Really rare but I've used it before

sterile token
#

i will read about typed lambda, first time i listen that tho

#

okay i understand what they are now, seems pretty nice to have that feature

somber night
#

how can i make custom furnace recipes (like smelting a nether star with namespaced key "item")

ivory sleet
sterile token
undone axleBOT
sterile token
#

?

ivory sleet
sterile token
#

Really happy to see you 🤙

mossy marlin
#

ok i have found a solution to create menu

but is not centering have any idea to centering it ?

tardy delta
#

starting to love c++ syntax

mossy marlin
#

i found solution

pseudo hazel
#

looks like a resource pack then you need to ad negative spaces to the title

mossy marlin
#

i had negative ttf

pseudo hazel
#

nice

mossy marlin
#

and use unicode to make padding

glad prawn
mossy marlin
#

now i need to remove inventory txt

pseudo hazel
#

good luck with that

#

let me know if you found a solution

mossy marlin
#

no problem i think i can add z-index 😂 as same as css

onyx fjord
#

what blockdata do saplings have?

pseudo hazel
#

look in the docs

eternal oxide
#

do you mean Sapling or do you actually mean young tree?

pseudo hazel
#

wtf is a young tree

onyx fjord
eternal oxide
#

a tree that is not grown

onyx fjord
#

wut

pseudo hazel
#

yeah thats a sapling is it not

pseudo hazel
#

yeah

#

where is this young tree you speak of

onyx fjord
#

cool that its different for crops 🙏

pseudo hazel
#

as far as I know there are only 2 stages for trees in mc, saplings and trees

eternal oxide
#

I was trying to determine if he was just referring to the specific Sapling or trees as the material

pseudo hazel
#

I see

#

I didnt even know that was still a thing

#

its been deprecated to hell though

eternal oxide
#

its a complete mess in there

pseudo hazel
#

well yeah that has never changed xD

#

blame mc for that

eternal oxide
#

even though teh Material for Sapling links to it

#

I guess Bamboo and Mangrove Propagule are special cases

pseudo hazel
#

yeah

#

they just have extra features ig

#

or not

#

the propagule is apparently an empty interface

eternal oxide
#

lol

gilded bloom
#

Hello, I have a problem with changing the player pose. I would like to send this packet to set the swimming animation for a specyfic player so that it looks like crawling. I have seen that this can be achieved by sending ENTITY_METADATA packet, but unfortunately I don't know how to send it correctly. Currently, nothing is happening and there is no error.
CODE:

ProtocolManager manager = ProtocolLibrary.getProtocolManager();
            PacketContainer packet = manager.createPacket(PacketType.Play.Server.ENTITY_METADATA);
            packet.getModifier().writeDefaults();
            List<WrappedWatchableObject> wwo_list = new ArrayList<>();
            wwo_list.add(new WrappedWatchableObject(6, EnumWrappers.EntityPose.SWIMMING));

            packet.getIntegers().write(0, p.getEntityId());
            packet.getWatchableCollectionModifier().write(0, wwo_list);
            for(Player target : Bukkit.getOnlinePlayers())
            {
                try
                {
                    manager.sendServerPacket(target, packet);
                }
                catch (Exception e)
                {
                    Bukkit.broadcastMessage(e.toString());
                }
            }
tardy delta
#

doing c++ and then back on doing java scares me whenever i see 'new'

wise mesa
#

real

remote swallow
#

new Integer(98)

#

ez

tardy delta
flint carbon
#

hi guys, i'm new to plugin development and i was wondering if there's a way to avoid restarting the server every time i want to rebuild the plugin

tardy delta
#

put the plugin in plugins/update/ and reload server, it will automatically replace the old one

kind hatch
flint carbon
#

and then it will replace the old one

tardy delta
#

no you have to put it there yourself

flint carbon
tardy delta
#

ye

flint carbon
#

does it have to be in /plugins

tardy delta
#

yes

#

update folder in plugins folder

flint carbon
#

like this?

tardy delta
#

ye

#

theres a BossBar#setProgress

#

?scheduling

undone axleBOT
quaint mantle
#

can i use spigot with bungecoord

#

like

rough drift
#

Yes?

hexed falcon
#

is there a way to hide the /commands from players that arn't op?

quaint mantle
#

no well

#

i mean

#

is there any way i can use spigot in a plugin that runs on the bungecord main server

#

well the problem is there are many limitations in bungee

#

for example i cant change people gamemode with means i would need to load the same plugin on every single server instead of just on the bungee main server

#

wich kinda seems like a waste of resources

sullen marlin
#

What resources

quaint mantle
#

ram

#

cpu

#

talking about usage

sullen marlin
#

1 megabyte of memory and 50kb of disk space?

quaint mantle
#

thats just a small example its a bigger plugin

sullen marlin
#

Ok 50mb of memory and 2mb of disk space

quaint mantle
#

stacked on 10 different spigot servers thats still half a gig used

sullen marlin
#

On vs 20gb overall... 2.5%

flint coyote
#

It's not like memory is expensive these days

young knoll
#

I don't suppose there is some magic method to load my plugin before the game loads datapacks

flint coyote
#

I'm not sure. Are datapacks loaded before or after the world gets loaded?

#

If it's after then yes there is

young knoll
#

Before

#

They are like the first thing loaded

sullen marlin
#

Datapacks are hardcore baked into the server as of 1.19

young knoll
#

Sadge

#

I'm trying to inject custom stuff for use in datapacks, but I have no way to do so early enough

sullen marlin
#

Reload the datapacks?

young knoll
#

The server refuses to start if the datapacks have an error

#

At least in terms of worldgen stuff

sullen marlin
#

Add the new datapack later and then reload

young knoll
#

Worldgen datapacks don't work with reload

sullen marlin
#

Rip

young knoll
#

Dangit mojang

#

Why you gotta cap structures to a size of 7

quiet ice
#

7 chunks or 7 blocks?

young knoll
#

7 branch depth

trim lake
#

Can I somehow cancel IvnetoryClickEvent only in GUI and not in player inventory? I need let player put some items in specific slots.

flint coyote
#

Yes. Inventories implement equals and hashcode so you can hold your instances in a list or HashMap (depending on usecase)

#

Oh I suppose the question is how to not prevent clicks in the bottom inventory when a gui is open, right?
In that case check for the rawSlot

trim lake
#

Im just checking clicked slot now, But is canceling in player invnetory too thats the issue.

flint coyote
#

You can determine those using the raw slot number. It's unique

#

getSlot() does return the same number for some player inventory slots aswell

sterile token
#

What do you mean with that? I mean im interested to learn tho

trim lake
sterile token
#

Depends what you are doing

young knoll
#

Jesus datapacks are loaded before the server thread even starts

#

Mojang plz

sterile token
flint carbon
#

are nested try/catches and if statements normal in plugin development?

trim lake
#

The up inventory is custom (just menu) idk how I can grap that tied this :

if (p.getInventory().equals(e.getInventory())) e.setCancelled(false);
sterile token
#

Wait what you wondering to do?

quaint mantle
#

e.getClickcedInventory(); should be the right method probably.

sterile token
#

why are you comparing player inventory with event one?

#

Shouldnt compare your event inventory against your custom inventory instance?

trim lake
#

to detect if player clicked on custom or player inv.

kind hatch
#

Something like this could probably work.

if (event.getView().getTopInventory().equals(event.getClickedInventory()))
sterile token
trim lake
#

you mean like PulseSapphire´s msg?

#

that works to

quaint mantle
#

i was going to suggest you could have a hashmap but that might be a better method.

#

wait! What if the top inventory is null?

#

you probably cannot use .equals(); on a null object. Just use == operator.

kind hatch
#

Just do a null check beforehand then.

sterile token
#

You should already take i ncare that while coding

trim lake
sterile token
#

Dont you have a instance of custom inventory? 🤔

kind hatch
quaint mantle
#

if its an inventory gui, it may have a hashmap or hashset of inventory objects, if it does not, create one then checked the clickedInventory against that hashmap or hashset. Might be one way to do this though probably.

trim lake
sterile token
#
Inventory custom;

onClick(InventoryClickEvent event) {
    Inventory inventory = event.getView().getTopInventory();
    if (inventory == null || !inventory.equals(custom)) return;
    // your code here
}```
kind hatch
#

Well, you can actually just use an == check if you are comparing instances.

sterile token
kind hatch
#

If you are comparing instances, yes.
If you are comparing contents, no.

sterile token
#

you not only compare instance, you need conten tto be compared too

kind hatch
#

No you don't.

quaint mantle
kind hatch
#

You just need the instance.

sterile token
#

What if the instance are the same, but the content doesnt match, will returns as your custom inventory - thats a fail, isnt it?

#

i mean i want to nderstand not wondering to be rude just to clarify because them ppl say im trolling or those weird things

kind hatch
#

That shouldn't be possible.

quaint mantle
sterile token
kind hatch
#

Look, let me give you an example of how the comparison works. Just give me a sec.

quaint mantle
#

why would two of the same instances have different contents?

quaint mantle
#

if it references the same object, the contents should not be different.

sterile token
#

i dont think its that simple

#

a friend had a case of using == to compare 2 objects, which were exactly the same. But when debugging it showed that they were not the same, when they were. His solution was to use equals().

kind hatch
#
Inventory inv = Bukkit.createInventory(blah blah) // This is a new instance lets call it Instance1

@EventHandler
public void onClick(InventoryClickEvent event) {
  event.getClickedInventory(); // This will return the inventory instance that was clicked.
  // Lets say that it doesn't match and the inventory we clicked is Instance40

  // it doesn't matter what we do from this point on, the inventory doesn't match.
}

Now lets assume that the instances do match.

@EventHandler
public void onClick(InventoryClickEvent event) {
  Inventory clicked = event.getClickedInventory(); // Lets say that the clicked inventory was actually Instance1
  
  // If Instance1 == Instance1
  if (event.getClickedInventory() == inv) {
    // Check succeded, do your stuff.
  }
}
kind hatch
sterile token
#

right, but when you exactly check via instance and via content ?

kind hatch
#

That depends on what you need.

quaint mantle
#

I am bored.

sterile token
#

Because also when working with custom inventories you dont want only the instance matching, you want both of them. Where if the instance is the same but content is different, then is an issue. Because you want the exactly inventory with the exact contnet

#

🤔

kind hatch
#

Your inventory will have the correct contents if you are using the correct instance.

#

That's why we need to save those instances we create so that we can use them later.

hazy parrot
#

there will never be a case where instance is same but content different

quaint mantle
#

this has less to do with minecraft inventories and more so with java basics though.

trim lake
#

So this if is okey?

if (e.getView().getTopInventory() != null && !e.getView().getTopInventory().equals(e.getClickedInventory()))```
Im kinda lost now in int 😄 Or just should I have used inventory in variable like this variable? ```java
inv = Bukkit.createInventory(this, getRows()*9, ChatUtils.format(getTitle()));    ```
quaint mantle
#

you might not know java properly if you don't know how instances and references work.

sterile token
#

So intance checking does internally check for contnet? Becuase then you can replicate a fake instance and they will be the same. refering to inventories ofc

kind hatch
#

If you need to compare contents, then you'll need to use .equals().

quaint mantle
sterile token
#

1m i will translate to english and see because i think im explaning really bad

hazy parrot
#

== compares location in memory, if its same its true

#

simple as that

sterile token
#

My question is how do you really make sure that both inventories are identical, that is: name, size and content is the same. Because there are vulnerabilities to replicate inventories, that's what I want to get to.

kind hatch
trim lake
quaint mantle
#

um.

#

you still might wanna make sure that inventory clicked is not just any random inventory though probably.

sterile token
trim lake
#

I makeit like this:

        int slot = e.getSlot();
        if (slot > 8 && slot < slots-9) {
            e.setCancelled(false);
        }
        if (e.getView().getTopInventory() != null && !e.getView().getTopInventory().equals(e.getClickedInventory())) {
            p.sendMessage("yep");
            e.setCancelled(false);
        }```
and before that Im chcecking if is instace of menu or not
#

Mby I shloud use .getRawSlot insted of .getSlot

kind hatch
trim lake
#

I need. I need to first and last slot not be clickable. There are some items what I dont want player to grap.

kind hatch
#

Oh, are you making the top inventory useable?

trim lake
#

Acctualy.. If I use rawSlot method (first if) I don need the second one. 🤔

trim lake
kind hatch
#

But you want people to move items from their inventory to the available space in the top inventory corrrect?

trim lake
#

Yep on slots from 9-44 (all rows expect first and last)

kind hatch
#

Ok ok. Usually people don't want anything to be moved in their custom inventories.
Your check that you have is just fine then.

young knoll
#

Sometimes mojangs code is... questionable
List<Pair<Function<StructureTemplatePool.Projection, ? extends StructurePoolElement>, Integer>> elementCountsByGetters

kind hatch
#

What the?

#

Is that relating to datapacks?

young knoll
#

Somewhat

young knoll
#

Do you not enjoy a list of pairs of functions

quaint mantle
#

hm.

trim lake
#

Perfect hthanks a lot! I can't think about these things properly sometimes. Its kit editor thats why I want that

sterile token
#

I have done a kit editor and i understand the pain of it

trim lake
#

Idk is not that hard to save and load items from file (using .yml for now, DB will be later). Gona make some plugin probably public soon. Something kinda new.

sterile token
#

nice from hearing that

#

Also making public plugins make you learn a lot of experience while coding

trim lake
#

I hope so. I get one ide about plugin what is not done yet, at least not knowing about.

orchid gazelle
#

anyone knowing why the armorstand-teleports are soo laggy?

topaz atlas
#

How do you create a block in spigot?

#
        if (event.getBlock().getState() instanceof Sign) {
            Sign sign = (Sign)event.getBlock().getState();
                if (sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player2]") || sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player1]")){
                    Location loc = sign.getLocation();
                    TimeUnit.SECONDS.sleep(1);
                    Block block = Bukkit.getWorld("world").getBlockAt(loc);
                    block.setType(Material.OAK_SIGN);
                    logger.log(Level.INFO, block.getType().name());
                }
            }
        }
    }```
#

This does not work

#

im trying to create a sign

kind hatch
orchid gazelle
#

just using ArmorStand#teleport, calling on PlayerInteractEvent

kind hatch
wet breach
#

curiously why you throwing interruptedexception o.O

orchid gazelle
kind hatch
#

You can teleport using vectors?

orchid gazelle
#

nah I just made that myself

#

its just getting the Location of the AS and then adds the offset of the vector to it

tender shard
#

am I delusional for wanting this to be possible?

echo basalt
#

you mean char[] = new char[6}?

tender shard
#

no

echo basalt
#

an array is still an object and not a primitive

tender shard
#

I want to declare that "hex" is always a 6-length char

#

and can never be 5 or 7 lengh long

kind hatch
#

Oh

echo basalt
#

You can literally initialize it as an empty array

tender shard
#

well I do not really care, I just started typing this, then realized it won't work lol

echo basalt
#

that's has a fixed length of 6

topaz atlas
tender shard
#

FixedLengthArray<Character, Integer>

#

happy now

#

?!

kind hatch
#

You'd need some way to ensure that it's always filled with content. Maybe a default value would work, but I can see why we use the up to approach.

tender shard
#

nah I don't need that

#

all I needed to do was to declare the length in the field itself, and I know it's not possible, and I never asked for it to be possible, all I want is this to be possible 🥲

topaz atlas
#

?create block

kind hatch
topaz atlas
#

?blockstate#update

topaz atlas
#

for it

kind hatch
#

You just have to call that method. You already set the type, now you need to update the block.

orchid gazelle
topaz atlas
#
                    TimeUnit.SECONDS.sleep(1);
                    Block block = Bukkit.getWorld("world").getBlockAt(loc);
                    block.setType(Material.OAK_SIGN);
                    block.getState().update();
                    logger.log(Level.INFO, block.getType().name());```
#

is there any redundancy?

humble tulip
kind hatch
sterile token
humble tulip
#

yes lol

river oracle
# humble tulip yes lol

imho they aren't sleeping long enough if you are going to freeze the server you might as well crash it

#

TimeUnit.SECONDS.sleep(Integer.MAX_VALUE);

#

the code should be adjusted to reflect this change ^

sterile token
#

And less with single threaded softwares

vast kelp
#

pizza good

quartz gull
#

nvm didnt think it thru

delicate lynx
#

uwu

deft jewel
#

so confused on why this is making the duration 7 seconds.

    public cItemStack SetTippedArrowEffect(PotionEffectType potionEffectType, int amplifier) {
        ItemStack arrowItem = new ItemStack(Material.TIPPED_ARROW, this.getAmount());
        PotionMeta potionMeta = (PotionMeta) arrowItem.getItemMeta();
        assert potionMeta != null;
        potionMeta.setColor(potionEffectType.getColor());
        potionMeta.setBasePotionData(new PotionData(PotionType.UNCRAFTABLE));
        potionMeta.addCustomEffect(new PotionEffect(potionEffectType, 1200, amplifier), true);
        arrowItem.setItemMeta(potionMeta);
        return new cItemStack(arrowItem);
    }
delicate lynx
#

use assert for tests only!!!!!!

quartz gull
#

^ just null check instead of asserts

tender shard
#

imagine people claiming "gradle is so much faster than maven", meanwhile you had a smoke, took a shit, and drank a beer, but gradle is still not done with setting up the project you cloned 17 minutes ago lmao

quartz gull
#

slow pc or what (or big project)

tender shard
#

SuperiorSkyblock2

delicate lynx
#

gradle is kind enough to let you do that

tender shard
#

how many cigarettes am I supposed to smoke before it's done finishing its job

delicate lynx
#

time to find out

sterile token
tender shard
#

oh damn it's done, only 20 minutes

topaz atlas
#
                    Location loc = sign.getLocation();
                    TimeUnit.SECONDS.sleep(1);
                    Block block = Bukkit.getWorld("world").getBlockAt(loc);
                    block.setType(Material.OAK_SIGN);
                    block.getState().update();
                    logger.log(Level.INFO, block.getType().name());```
#

This does not create a new sign

tender shard
#

do you wanna replace a sign with an empty oak sign?

topaz atlas
topaz atlas
#

When its broken it should come back

tender shard
#

and does sign.getLine(0) equalsIgnoreCase "[Player2]" in dark aqua?

tender shard
#

does the logger print out "DARK_OAK_SIGN"?

topaz atlas
tender shard
#

what's the output of /version ?

#

also why are you lagging the main thread by one second?

#

or are you running this inside some runnable?

topaz atlas
tender shard
#

yes

#

well from console, just enter version

#

without the / slash

topaz atlas
tender shard
#

but if you just sleep, nothing inbetween happens anyway

#

all it does is cause useless lag

topaz atlas
#
[02:43:07 INFO]: This server is running Paper version git-Paper-519 (MC: 1.19.4) (Implementing API version 1.19.4-R0.1-SNAPSHOT) (Git: 936205b)
You are 2 version(s) behind
Download the new version at: https://papermc.io/downloads/paper
Previous version: git-Purpur-1907 (MC: 1.19.3)```
topaz atlas
topaz atlas
deft jewel
topaz atlas
#

now what is my code missing?

tender shard
#

are you running it in some kind of thread / runnable?

wise mesa
#

how slow would it be to loop through every single inventory in the server by loading every chunk and getting the tile entities

topaz atlas
tender shard
topaz atlas
#
    public void blockBreak(BlockBreakEvent event) throws InterruptedException {
        if (event.getBlock().getState() instanceof Sign) {
            Sign sign = (Sign)event.getBlock().getState();
                if (sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player2]") || sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player1]")){
                    Location loc = sign.getLocation();
                    //TimeUnit.SECONDS.sleep(1);
                    Block block = Bukkit.getWorld("world").getBlockAt(loc);
                    block.setType(Material.OAK_SIGN);
                    block.getState().update();
                    logger.log(Level.INFO, block.getType().name());
                }
            }
        }
    }```
tender shard
undone axleBOT
wise mesa
#

ughhhh but I don't feel like setting up sqlite just to track all the inventories

tender shard
#

?xy

undone axleBOT
wise mesa
#

that's so much efforttttttt

#

waaaaaahhhhhh

#

okay here's the problem

#

on our server we wish to modify the attributes of all armor

wise mesa
#

so for example every iron chestplate will have different stats than vanilla

#

but

#

ocasionally the attributes we want will change

#

so my idea is a /upgrade command that will loop through all tile and player inventories and """upgrade""" the items

tender shard
#

loop, e.g. every second, over all player's invs, and do the changes then/there

wise mesa
#

ughhhh but that's so inefficientttttt

#

alright fine

#

thank you alex

tender shard
#

it's like 125 times more efficient than looping over all, and loading all, existing chunks, though

tender shard
#

you are updating the blockstate of another block instance, from what I'd guess

#

the whole code is quite messy, tbh

wise mesa
topaz atlas
wise mesa
#

idk

#

oh well

topaz atlas
tender shard
#

why the heck do you do "Bukkit.getWorld("world") although you already have the world

tender shard
#

and then you call getBlock(Location) on that, although you already got the block

#

event.getBlock()

#

Block block = Bukkit.getWorld("world").getBlockAt(loc);

#

why not just use event.getBLock()

topaz atlas
#

Yes I get your point

#

Anyways, so, what were we talking about.

#

Right, umm, do you have a example

#

of someone creating a blockk that will work

tender shard
#
    @EventHandler
    public void blockBreak(BlockBreakEvent event) throws InterruptedException {
        if (event.getBlock().getState() instanceof Sign) {
            Sign sign = (Sign)event.getBlock().getState();
            if (sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player2]") || sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player1]")){
                Block block = event.getBlock();
                block.setType(Material.OAK_SIGN);
                block.getState().update();
                System.out.println("asd 123 test");
                event.setCancelled(true);
            }
        }
    }
topaz atlas
tender shard
tender shard
topaz atlas
tender shard
#

it WILL work

topaz atlas
#

ima change it to the logger.

tender shard
#

also you are supposed to cancel the BlockBreakEvent, otherwise there will only be air at that block anymore

tender shard
#

paper is still able to print out messages from stoud, it just loves to complain about it

#

but yes, sure, use the logger instead

#

the logger is ofc better, that's correct

#

once again, paper loves to complain about normal spigot features. if they'd want plugins to stop using STDOUT, they'd just make those messages vanish. Or just proxy it to the actual logger. Instead, they rather proxy that message, just to show a warning, instead of just proxying it properly to that plugin's logger

topaz atlas
#

The block does not recreate

tender shard
#

you obviously did not copy/paste my code

topaz atlas
#
    public void blockBreak(BlockBreakEvent event) throws InterruptedException {
        if (event.getBlock().getState() instanceof Sign) {
            Sign sign = (Sign)event.getBlock().getState();
            if (sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player2]") || sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player1]")){
                Block block = event.getBlock();
                block.setType(Material.OAK_SIGN);
                block.getState().update();
                logger.log(Level.INFO, block.getType().name());
            }
        }
    }```
#

This is the code

#

i put in

tender shard
#

why does that method even declare "throws InterruptedEx"?

#

I told you to print out "asd 123 test" for good reasons btw

topaz atlas
topaz atlas
tender shard
#

also where does "granted" come from?

topaz atlas
#

but I doubt itll log

tender shard
#

if it would not log, you'd know where the issue is - the if statement fails

topaz atlas
tender shard
topaz atlas
#

only plugin logs

tender shard
#

I know paper and how shitty it is, but sout's work fine

#

only issue is that it prints a warning every 100 messages

topaz atlas
tender shard
#

anyway, if I send you code, and ask you to try it out, you're better off copy/pasting exactly what I sent, instead of adjusting and changing it all the time again, because then we both have no clue what's going on

topaz atlas
#

ok ill add the whole thing

tender shard
topaz atlas
tender shard
#

why don't you just test it locally yourself instead

#

wouldn't that be much easier?

topaz atlas
#

Anyways, it seems like the stoudout issue only occurs mid startup

#

which is so very weird

#

anyways everything works

#

thank you

#

It recreates the sign with the text

#

which is weird because I did not set text on it

flint carbon
#

Is there a modern alternative for createInventory?

sullen marlin
#

?

flint carbon
#

it says that createInventory is deprecated?

echo basalt
#

?whereami

echo basalt
#

paper deprecated it

river oracle
#

^

echo basalt
#

In favor of component titles

#

because why not

river oracle
flint carbon
river oracle
#

doesn't that sound fun

river oracle
sullen marlin
#

this is spigot

river oracle
#

deprecate paper

regal scaffold
#

Any efficient way to run a task once a week?

#

Like execute a piece of code every saturday at 3am or whatever

#

Without using a 20L tick

echo basalt
#

Store an epoch, do some sanity checks on startup and once in a while

flint carbon
#

if i plan on putting something on spigot.org, should i use spigot instead?

echo basalt
#

Yes

echo basalt
river oracle
#

I mean you could people just might get angry your plugin isn't working

wet breach
regal scaffold
#

Well

wet breach
#

use the calendar api to determine the day of the week

regal scaffold
#

But

#

That means it needs to go inside a task anyways

wet breach
#

not sure what you mean

echo basalt
#

scheduleNextTask:

  • get current epoch
  • get target epoch
  • subtract to make a difference
  • calculate the ticks until that difference (difference * 20)
  • call scheduleNextTask in half that time, that way any tps drops will be fluctuated
  • if current epoch == targetEpoch, run task, scheduleNextTask
wet breach
#

calendar stuff wouldn't need to go into a tasj

#

on startup, use it to get the day of the week, then look at the clock for time

#

if its sat 3am then execute whatever code

regal scaffold
#

What if there's no startup

echo basalt
#

onEnable ??

regal scaffold
#

That implies the server is restarted

#

What if it's not restarted once a week when I need it to run

wet breach
echo basalt
#

the onEnable just calls scheduleNextTask

#

you can call it manually

#

Just a lightweight recursive scheduler type deal

regal scaffold
#

Ok what I'm saying is I still need to make a task that runs what, once every second? once every minute?

echo basalt
#

Instead of making it repeating

regal scaffold
#

Ohhhhhhhhhhhhhhhhhhhhhhh

#

I just now

#

Understood

echo basalt
#

do it dynamic in a way where tick fluctiations don't do stuff

regal scaffold
#

What you meant

echo basalt
#

Let's say your task runs at 1pm

regal scaffold
#

You're saying

wet breach
regal scaffold
#

Schedule the task to run

echo basalt
#

and it's 1am now, so 12h difference

regal scaffold
#

The specific day I want

wet breach
#

like day night cycle. I don't like using tasks unless I really need to

echo basalt
#

12h / 2 = 6h

regal scaffold
#

yup got it

echo basalt
#

so re-run the checks in 6 hours (6 * 60 * 60 * 20)

#

and then repeat

sullen marlin
#

I would run a task at a fixed frequency (every minute) that does simple check: if (shouldExecuteNow) execute(); else return();

regal scaffold
#

What if instead

#

I schedule a delayed task

echo basalt
#

fixed frequency also works

regal scaffold
#

With the delay = (day I need - current day)

#

On startup

wet breach
#

with the calendar api you could get the time until you want it to run and then schedule the task for that specific time too

sullen marlin
#

if the task is once per week, then just schedule it every hour

echo basalt
#

tick fluctuations will make it a bit more unreliable

#

my method would self-correct

regal scaffold
#

Hmmm damn

wet breach
echo basalt
#

Sure it'd run a bunch more times the closer it gets but you can just hardcode a threshold

regal scaffold
#

I mean

echo basalt
regal scaffold
#

When you say unreliable

#

Do you mean

#

3pm saturday could be between 2:55 - 3:05

#

Or like

echo basalt
#

I mean if you server lags for a minute so does your delay

wet breach
regal scaffold
#

3 hours

echo basalt
regal scaffold
#

If the server is lagging for a minute that should be looked at no?

echo basalt
#

newScheduledThreadPool(1).whatever

echo basalt
wet breach
echo basalt
#

and one of those every second start adding up

regal scaffold
#

Alright thanks

echo basalt
#

I'm only awake because my dad gotta wake up at 4am and I'm usually gaming at that time

wet breach
#

nice

regal scaffold
#

If I have a scheduled task

#

And i unload/load the plugin but not the server

#

I assume the task gets cancelled

pseudo hazel
#

how do you reload the plugin, using /reload?

wet breach
regal scaffold
#

plugman so yes

wet breach
#

that is something you will have to handle

regal scaffold
#

So it will remain scheduled until server restart

#

Interesting, alright

wet breach
#

correct

#

but, it won't have a proper instance

#

so it would still error

regal scaffold
#

So error

#

Gotcha

pseudo hazel
#

wait what are we scheduling?

regal scaffold
#

Once a week task

pseudo hazel
#

okay

wet breach
#

what exactly does your code do btw?

pseudo hazel
#

well assuming the server will always be on in that time, I would save that timestamp to a file

regal scaffold
#
runTaskLater()

takes the delay as a long. I see that ZonedDateTime would return a long but I assume it's not the same value

#

No need

#

I found a better solution

wet breach
#

I might have a better one

#

if I knew what it needed to do

pseudo hazel
#

and then just schedule a task for that time when you enable the plugin/start teh task

regal scaffold
#

I'm scheduling a task for "next saturday" on plugin load

#

If the server restarts

#

It'll just update the task with the next scheduled

#

Otherwise, it'll keep the task going and do some adjustments

wet breach
regal scaffold
#

Yup

#

Did it

#

Now using ZonedDateTime

wet breach
#

but what does your task do though?

regal scaffold
#

Resets some data for all players recorded

#

Class reset

#

So all players will have their classes removed, and if online sent to the class selector

wet breach
#

so I imagine the reset is mostly just interacting with a DB?

regal scaffold
#

Sort of

#

Cache but yeah

#

Eventually written to db

#

Since the server doesn't need to restart for it to update

wet breach
#

if your cache refreshes properly

#

then I have a better way

regal scaffold
#

Considering

#

I'm using MassiveCore

#

I can't

#

Don't ask why

#

Just how it was when I got here

wet breach
#

use a chron job to reset the data in the DB, add a column that is a boolean so you know data has been reset

#

now it doesn't matter if the server is on or not it will always run

#

and no need to worry about scheduling anything in the server itself

regal scaffold
#

That's also a nice alternative

#

I kinda like that

#

But either way

pseudo hazel
#

okay so then you would just poll the boolean until the end of time

regal scaffold
#

the long delay from runtasklater

wet breach
#

it would be part of the cached data

regal scaffold
#

Is it the same as ZonedDateTime

wet breach
#

its only purpose is to just make it super easy to know they should go to class selector instead of doing null checks

regal scaffold
#

Like what do I get from ZoneDateTime to get the long value for task

wet breach
regal scaffold
#

And I assume getLong is in seconds

pseudo hazel
#

well yes but it would be hard to do something in the server at the exact time it gets reset though right?

wet breach
#

so you would need to convert the time to millis and then to ticks

regal scaffold
#

so seconds * 20

wet breach
#

or seconds I mean

regal scaffold
#

Oh

#

Yeah

#

Wait it's second * 20 right

#

I'm not crazy

wet breach
#

yes

pseudo hazel
#

yes 20 ticks per second

regal scaffold
#

Yeah threw me off

pseudo hazel
#

imo by far the easiest way is to just deal with it on plugin load

regal scaffold
#

I agree but I do like frost solution

#

It's nice

wet breach
#

or chron job lol super easy to create a bash script to interact with the db

#

and chron time isn't hard at all

regal scaffold
#

Mongodb is not that fun

#

But yeah

pseudo hazel
#

yes that's true

#

ig it also depends on what the time stamp is for exactly

wet breach
#

but the advantage of the chron job is that even if the server is off

#

the data can still be reset

regal scaffold
#

Another question

wet breach
#

doesn't need to wait for the server to be started

regal scaffold
#

runTaskLater

pseudo hazel
#

if just resetting db info is enough then def go for the chron job

regal scaffold
#

has a method that returns void and BukkitTask

#

What do I edit to make it return the BukkitTask

#

Needs a Consumer<BukkitTask>

#

Or a runnable

wet breach
#

well, to return a bukkitTask you would just stuff the bukkittask into a bukkittask object

#

similar to how you would obtain the id

regal scaffold
#

Should I use Scheduler or Runnable

pseudo hazel
#

doesnt matter

#

usually scheduler is most consice is most cases

regal scaffold
#
        task = Bukkit.getScheduler().runTaskLater(PrisonCore.get(),task -> {
            ProfilesModule profilesModule = PrisonCore.get().getModule(ProfilesModule.class);

        },nextSaturdayAt3PM.getSecond() * 20L);
#

"Stuffing into bukkittask object"

#

wym

#

@wet breach

pseudo hazel
#

to get the task you supply the runnable

regal scaffold
#

Oh

echo basalt
#

ayy mans using a module system

#

swag

regal scaffold
#

Ill

#

If you saw this project

#

You would be proud

echo basalt
#

unfortunately you have a singleton so I'll have to wipe you from this planet

regal scaffold
#

😦

echo basalt
wet breach
#

lmao

pseudo hazel
#

😂

regal scaffold
#

😦

#

Remember when I just started a few months ago

echo basalt
#

no

regal scaffold
#

Ok ur mean

echo basalt
#

girls like baddies

wet breach
echo basalt
#

Oh I'm here to help you out and provide code support

#

just not emotional support

pseudo hazel
#

what about emotional code

echo basalt
#

no such thing

#

what's next

pseudo hazel
#

why not

echo basalt
#

new Emotion()

pseudo hazel
#

Human.getEmotion(EmotionFactory.emote.yeet())

regal scaffold
#

Can I not pass it the runnable without making a new class?

topaz atlas
#
    public void blockBreak(BlockBreakEvent event)  {
        if (event.getBlock().getState() instanceof Sign) {
            Sign sign = (Sign)event.getBlock().getState();
            if (sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player2]") || sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player1]")){
                try {
                    TimeUnit.SECONDS.sleep(1);
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                Block block = event.getBlock();
                block.setType(Material.OAK_SIGN);
                //((Sign) block.getState()).setLine(0, ChatColor.RED + "LOCKED");
                block.getState().update();
                event.setCancelled(true);
            }
        }
    }```

How can I change/set the text of a sign upon creation
pseudo hazel
#

not without nms iirc

regal scaffold
#

That for him or me

echo basalt
wet breach
pseudo hazel
regal scaffold
#

Yeah just did with ann

#

All g

wet breach
pseudo hazel
#

well yes

#

I was just wondering what tom meant

wet breach
#

oh

echo basalt
#

SignChangeEvent iirc

pseudo hazel
#

because it can mean like 20 things

wet breach
#

they probably just forgot to add the anonymous class at the tail end or something

echo basalt
#

the client sends a packet with the sign's contents

#

took me a minute to load it up, had to index stuff

regal scaffold
#

You would be proud Ill

#

Even if you don't provide emotional support

echo basalt
#

nah

pseudo hazel
#

modules -> core -> modules do be hitting hard

sullen marlin
#

wow

#

much code

#

such module

#

very organise

echo basalt
#

mm yes code

#

time to record another of these

regal scaffold
#

Considering how little ago I started and how bad it was before

pseudo hazel
#

meanwhile im half crying trying to get my one feature to work xD

trim lake
#

How to remove ersistentDataContainer from item? This is not working.

@Override
public void handleMenu(InventoryClickEvent e) {
    ItemStack item = e.getCurrentItem();
    ItemStack clearItem = new ItemStack(item);    
    ItemMeta meta = clearItem.getItemMeta();        meta.getPersistentDataContainer().remove(new     NamespacedKey(PersoKits.getPlugin(), "function"));
    clearItem.setItemMeta(meta);
regal scaffold
#

Pretty proud of my progress I must say

#

Wouldn't have been possible without the people that are no-life in here 24/7 helping out

pseudo hazel
#

nvm

#

you dont

echo basalt
#

haha code go brr

trim lake
#

I did in last line

topaz atlas
#

hey, is anyone avalible to help me rn? or should I ask later?

pseudo hazel
#

do you want to remove the whole container or just whast in "function"

#

?ask

undone axleBOT
#

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

wet breach
pseudo hazel
#

okay, and how did you check if its been removed?

regal scaffold
#

I have tried, like I said, a lot of it is possible due to you guys here

echo basalt
#

don't you love it when you've dedicated like 6 years of your life into a craft just to see some 15 year old kid from sudan write you a tutorial after coding for 2 weeks

trim lake
#

Im printing that item

regal scaffold
topaz atlas
# pseudo hazel do you want to remove the whole container or just whast in "function"
    public void blockBreak(BlockBreakEvent event)  {
        if (event.getBlock().getState() instanceof Sign) {
            Sign sign = (Sign)event.getBlock().getState();
            if (sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player2]") || sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player1]")){
                try {
                    TimeUnit.SECONDS.sleep(1);
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                Block block = event.getBlock();
                block.setType(Material.OAK_SIGN);
                //((Sign) block.getState()).setLine(0, ChatColor.RED + "LOCKED");
                block.getState().update();
                event.setCancelled(true);
            }
        }
    }```

How do I change the newly created signs text? it just recreates the sign with the text before it
regal scaffold
#

-1

echo basalt
hollow birch
#

ive changed how mining speed works because the server im trying to make uses different detection for speed and which pickaxes break what block using this code

            if (tool.getPickaxeTier() < main.getMiningEvent().getPickaxeLevelRequiredForOres().get(block.getType())) {
                player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_USE, 1, 0);
                player.sendTitle(Utils.color("&4YOUR PICKAXE IS NOT GOOD ENOUGH TO BREAK THIS BLOCK"), null);
                return;
            }
        }
        task = new BukkitRunnable() {
            @Override
            public void run() {
                if (!blockProgress.containsKey(block)) {
                    blockProgress.put(block, 0);
                }
                //player.sendBlockDamage(e.getBlock().getLocation(), blockProgress.get(e.getBlock()) / 10f);
                Location location = block.getLocation();
                sendBreakAnimationPacket(player, new BlockPosition(location.getBlockX(), location.getBlock().getY(), location.getBlockZ()), blockProgress.get(block));

                if (blockProgress.get(block) < 0L || blockProgress.get(block) >= 9) {
                    Bukkit.getPluginManager().callEvent(new BlockBreakEvent(block, player));
                    blockProgress.remove(block);
                    player.sendBlockDamage(location, 0f);
                    this.cancel();
                    return;
                }
                blockProgress.replace(block, blockProgress.get(block) + 1);
            }
        }.runTaskTimer(main, 0L, (long) (((10 - tool.getMiningSpeed()) + (Math.round(hardness / tool.getMiningSpeed())))) - (efficiencyLevel * 2L));```

the issue is whenever you break the block the block still has damage visually
echo basalt
#

oh god just make a class for that runnable

regal scaffold
#

XD

#

My screen

hollow birch
#

its not that baddd

regal scaffold
echo basalt
#

mans doing math in the param skullWazowski

hollow birch
#

shhh

regal scaffold
#

Just a casual 80% of the chat window

#

?paste

undone axleBOT
pseudo hazel
regal scaffold
#

Steaf what is he trying to do

echo basalt
#

thanks for telling someone to read my message

regal scaffold
#

Change a sign while it's already placed?

echo basalt
regal scaffold
#

Faster asking the person who knows a bit more

topaz atlas
#

the sign change event encompasses all changes

echo basalt
#

filter them

topaz atlas
#

I tried getting the sign at its position

echo basalt
#

the sign is passed on the event

#

if you need 2 classes to communicate with each other

#

?di

undone axleBOT
pseudo hazel
# trim lake like this:

ah, you create a copy of the item stack instead of just editing the one you got from the event

#

which seems deliberate so maybe I am missing something

topaz atlas
#

the instance creation and the event

trim lake
pseudo hazel
#

show the code you use to print the pdc in chat

#

like the whole method

#

instead of just the pdc part you showed before

pseudo hazel
hollow birch
#
        Bukkit.getScheduler().runTaskTimer(main, new BlockBreakRunnable(block, player), 0L, delay);```
#

that better

pseudo hazel
#

yes for now

#

until you forget how to read it

hollow birch
#

it looks more complicated than it is

pseudo hazel
#

which I would argue might be an issue

hollow birch
#

i mean

pseudo hazel
#

but you used nice names so its fine

hollow birch
#

not really a way to shorten that

#

it makes sense when you read it

pseudo hazel
#

yes I am nitpicking

hollow birch
#

that wasnt my problem tho

#

basically i am sending block break packets myself

#

instead of minecraft doing it

#

and whenever a block is broken it will break as normal but not reset the damage of the block

pseudo hazel
#

what damage, isnt the block already broken?

hollow birch
#

yes exactly

#

it breaks

hollow birch
#

but in the plugin it sets those blocks to bedrock and they respawn after 3 seconds

#

and when they respawn they are still damaged'

topaz atlas
#

Does the sign change event account for sign creation?

#

like by the server

trim lake
#

Hmm if I tried this:

p.sendMessage(meta.getPersistentDataContainer().get(new NamespacedKey(PersoKits.getPlugin(), "function"), PersistentDataType.STRING));

message is empty WTF 😄

pseudo hazel
#

yeah so print the whole container right under it and see if its still there or not

river oracle
echo basalt
#

code

trim lake
#

fist line should be before remove and last after it

pseudo hazel
#

i mean like you showed before xD

regal scaffold
#

Auto-upload script for Gradle?

#

To server using ftp

trim lake
#

this?

p.sendMessage("function: " + meta.getPersistentDataContainer().get(new NamespacedKey(PersoKits.getPlugin(), "function"), PersistentDataType.STRING));
#

ou get it

humble tulip
#

Didn't you create one for maven with my help?

trim lake
#

hmm is gone but.... in that if I save item to list is it still there idk why

regal scaffold
#

Yup

#

I'll do the same

#

Thought there was a diff way'

#

Good memory you got

topaz atlas
#
    public void blockBreak(BlockBreakEvent event)  {
        if (event.getBlock().getState() instanceof Sign) {
            Sign sign = (Sign)event.getBlock().getState();
            if (sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player2]") || sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player1]")){
                try {
                    TimeUnit.SECONDS.sleep(1);
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                Block block = event.getBlock();
                block.setType(Material.OAK_SIGN);
                //((Sign) block.getState()).setLine(0, ChatColor.RED + "LOCKED");
                block.getState().update();
                event.setCancelled(true);
            }
        }
    }```

Since sign change event does not work for server created signs, how can I change the text for the newly created sign?
kind hatch
#

When dealing with MySQL, should I be making the queries execute immediately from a function, or should I be making an object/cache that I can modify and have a scheduled task that executes update queries with the current state of the cache/object?

trim lake
# pseudo hazel i mean like you showed before xD

I FOUND IT! I was thinking my ItemBuilder is returning new ItemStack but is not. So in setMenuItems() method I have this

if (page == 0) {
           for (ItemStack persoItem : varaintItems) {
               inv.addItem(new ItemBuilder(persoItem)
                       .function("removeItem")
                       .make());
           }
       }    

and If I click on item its run that method again so it editing ItemStack in the list...

blissful wagon
#

There is anyway to store a method or something ?
i mean for example i dont wanna store the return of ...getHealth i wanna store the getHealth itself
ik what i said is a bit confusing bc i'm confused myself , but i hope someone can help me

young knoll
#

Supplier

#

get health would be a supplier that returns an int

blissful wagon
#

ty

tender shard
#

anyone knows what all of this does?

#

like, what are the ifs for, if the java version is obv 17

#

why does gradle always turn so simple things into 14 lines of code

#

in maven you just say "target 17, source 17", done lol

rotund ravine
remote swallow
#

targetCompatibility = sourceCompatibility = javaVersion

tender shard
#

yeah but why does the mvdev plugin then create this huge clutter

#

I mean, if it's already set to 17, why would anyone check if it's >= 10

#

and why does it check for 10 in the first place

wet breach
#

it is checking the current JDK being used

#

so, yeah target is set to 17, doesn't mean the JDK is 17

#

it could be higher or lower

tender shard
#

yeah IK but it's a fresh project, apparently generated by the mc-dev plugin, with setting "17" from the beginning, it wouldn't work below 17 anyway

#

so why would anyone check if it's >= 10

rotund ravine
#

Probably just a template

tender shard
#

yeah but shouldn't a template be there to get rid of redundant things

#

I mean, if it's not even "adjusting things" one could also just copy/paste the same file again and again

wet breach
#

well it is probably a dynamic variable. Just happens on this specific version of things, it isn't necessary but its code that can be left there once new versions come about etc

tender shard
#

maybe I'm just too picky about what I expect from a proper build tool 🥲

wet breach
#

probably

tender shard
#

FOR EXAMPLE; SUPPORTING ARCHETYPES duh

wet breach
#

but I don't use plugins like that though

#

I have my own templates

regal scaffold
#

What's the event that gets called when a player takes damage from another player

#

As in, to apply a 5% damage reduction

tender shard
#

EntityDamageByEntityEvent

regal scaffold
#

And if I want to make the eventhandler always be priority I set it to monitor right?

tender shard
#

if you want to CHANGE anything regarded to the event itself, NEVER use Monitor

#

monitor is used to monitor only, hence the name

regal scaffold
#

Highest it is

tender shard
#

use LOWEST or HIGHEST

regal scaffold
#

Why lowest

tender shard
#

usually you wanna go for lowest

regal scaffold
#

Wait

tender shard
#

LOWEST is the first to get executed

regal scaffold
#

Lowest is the one that gets called last?

#

Oh

#

So if I want to apply damage reduction

#

Do I want it first so then stuff like enchantments

tender shard
#

just use normal priority tbh

regal scaffold
#

Can also apply over it?

tender shard
#

sure

regal scaffold
#

I guess it's my decision if the 5% should apply before or after enchantments

tender shard
#

i usually make my event priorities confirubale

#

configurable*

#

and if there's a bug with another plugin, I just tell my user to change the priority of my own plugin

regal scaffold
#

Pretty good idea

tender shard
#

I do it like this usually

regal scaffold
#

Wait so lowest is the first to get executed

#

That's interesting

tender shard
#

LOWEST,. LOW, NORMAL, HIGH, HIGHEST, MONITOR

regal scaffold
#

That is a pretty cool thing to add

tender shard
#

it's a bit of a dirty hack but when you gotta support 19273 other plugins, then it's sometimes the only solution

regal scaffold
#

Alex

#

Rememeber when I just started with dev

#

A few months ago

tender shard
regal scaffold
#

Illusion won't be proud of me

#

But you would

#

I've come far

tender shard
#

I remember, I spammed ?learnjava a few times to you

regal scaffold
#

Never was I that bad

tender shard
#

that means you're improving. When I look at code I wrote like a week ago, I still think "wtf is that"

regal scaffold
#

Yeah I actually changed a lot

remote swallow
regal scaffold
#

Quite proud of myself I must say

tender shard
tender shard
#

wanna see something nasty?

regal scaffold
#

Yes

remote swallow
#

anyone know how i could convert smth like 0xde73af to its # hex varient

tender shard
tender shard
tender shard
#

ikr?