#help-development

1 messages · Page 1726 of 1

stiff ember
#

Maybe something with packets

young knoll
#

No

paper viper
#

Yeah

young knoll
#

But it should send a packet per tick

paper viper
#

thats what i thought

#

but its kinda risky

lavish hemlock
#

either that or something to do with shields

stiff ember
#

e

paper viper
#

to implement

young knoll
#

I just listen for the right click event and keep track of the time inbetween them

mortal hare
#

what I initially thought is there are two different command handlers for commands. one is for vanilla commands, and one is for bukkit ones

stiff ember
#

I need to do it while they hold it though

paper viper
#

im gonna have to need that when i try implementing osu inside mc

#

lol

young knoll
#

It works alright for custom foods

#

Technically you can spam right click instead, but I don't know why you would

stiff ember
#

ok ig sneaking will have to work

ivory sleet
#

yeah well

mortal hare
#

well its kinda true since vanillaCommandDispatcher still exists, and its authentic to vanilla, but the whole PlayerConnection chat() method is overriden to use Bukkit command api

ivory sleet
#

click holding is easily spoofable im concerned about

paper viper
#

how many times can you sneak per second?

#

in mc

stiff ember
#

Anyway next question

#

how do you shoot out a splash water bottle REALLY fast?

ivory sleet
#

you give it some damn velocity

mortal hare
#

remove it from your inventory

#

light speed

young knoll
#

ThrownPotion.yeet()

stiff ember
mortal hare
#

get the thrown potion entity

tender shard
mortal hare
#

and add velocity

ivory sleet
#

btw whats the acceleration due to gravity in mc if anyone knows?

mortal hare
#

yeet is the method lol?

young knoll
#

If you believe hard enough it is

stiff ember
#

lol

#

who knows

ivory sleet
#

7.26

#

hmm

#

that is if there even is one

stiff ember
#

i made that up lol

#

there is gravity

#

so

young knoll
#

Just print the players velocity constantly and stand still

stiff ember
#

there must be

#

or decompile minecraft

ivory sleet
#

yeah like they documented that tho

young knoll
#

Maybe they did

#

We can't see their comments

ivory sleet
#

oh yeah true

stiff ember
#

Whats best item to use for a water hose

#

like

#

material

#

water bucket?

#

stick?

young knoll
#

Dye some horse armor green or somethin

stiff ember
tender shard
young knoll
tender shard
#

oh sorry for ping

#

didnt mean to reply

stiff ember
#

WHAT

#

is that new?

young knoll
#

1.14

stiff ember
#

oh

#

3 years

#

kinda sad i didnt know that

young knoll
#

Same way you dye player armor

tender shard
#

1.14.1 was the best release ever

stiff ember
#

nah

#

player armor only needs 1 dye

young knoll
#

Correct

stiff ember
#

nvm

#

same with horse

#

wow

ivory sleet
muted sand
#

I have an async task loop running that gets all online players and inserts into a database every 5 minutes
but every 5 minutes, the server lags for a second or two with around 8 players online, and i am not sure why as it's an async loop

tender shard
#

yeah but 1.14 added PDC, it's hard to get better than that lol

young knoll
#

To be fair that is not related to 1.14 itself :p

stiff ember
#

Whats a good hose recipe?

tender shard
ivory sleet
#

It might be the case something runs using locking mechanisms in which case async doesnt matter assuming the lock awaits the main thread

#

or if you happen to join the async task

quaint mantle
#
record Entry<K, V>(K k, V v) {
}

class HashMap<K, V> {
    private final Set<Entry<K, V>> entries = new HashSet<>();

    void put(K k, V v) {
        entries.add(new Entry<>(k, v));
    }

    V get(K k) {
        int keyHash = k.hashCode();
        for (Entry<K, V> entry : entries) {
            if (keyHash == entry.k().hashCode()) {
                if (k.equals(entry.k())) {
                    return entry.v();
                }
            }
        }
        return null;
    }
}

Hashmap.

ivory sleet
#

that doesn't support buckets

#

or maybe it does

#

nvm

young knoll
#

What about bukkits

ivory sleet
#

sealed is also rly nice

stiff ember
#

" " "^^^" "^ "? ^ = iron ig?

tender shard
#

speaking about bukkits, I'll go to kfc tomorrow

muted sand
# ivory sleet do you have the code?
    @Override
    public void run() {
        BukkitScheduler scheduler = plugin.getServer().getScheduler();
        scheduler.runTaskAsynchronously(this.plugin, () -> {
            for (Player player : this.plugin.getServer().getOnlinePlayers()) {
                Bson filter = Filters.eq("_id", player.getUniqueId().toString().replaceAll("-", ""));
// more down here

                this.collection.updateOne(filter, update, options);});

quaint mantle
ivory sleet
#

yeah somewhat weird, shouldn't freeze

muted sand
#

its getting player stats in the async method

ivory sleet
#

although I'd say, use a custom thread pool

muted sand
#

hm? how?

ivory sleet
#

since that operations has nothing to do with bukkit nor needs it tick loop

tender shard
#

maybe the database makes the cpu go sheeesh

muted sand
#

then i am very much confused why the lag spikes for a bit

#

looking at a timings report now, it's not my plugin causing the most amount of lag
but the server still spikes hard every 5 minutes

ivory sleet
#
ExecutorService service = new ForkJoinPool(
  Runtime.getRuntime().availableProcessors(),
  ForkJoinPool.defaultForkJoinWorkerThreadFactory,
  (t, e) e.printStackTrace(),
  true
);

then

CompletableFuture.runAsync(() -> {
  //TODO
},service);

//or 
service.submit(() -> { 
  //TODO
});
stiff ember
#

How can I use water buckets as ammo for a water hose?

ivory sleet
#

and also cache the pool

stiff ember
#

they have no durability

ivory sleet
#

you only need one

muted sand
#

oh, thank you!

ivory sleet
#

try and see if it helps

tender shard
quaint mantle
#

it will make everything easier

stiff ember
#

and that would last like one second with a full inventory

quaint mantle
#

?

#

i thought you were shooting buckets of water

#

are you just like placing them

stiff ember
quaint mantle
#
Item item = world.dropItem(player.getLocation(), new ItemStack(Material.WATER_BOTTLE));
item.setVelocity(velocity);
#

you can edit the item entity's pdc

stiff ember
#

pdc?

young knoll
#

?pdc

eternal night
#

a perfect exchange

stiff ember
#

oh

#

lol

quaint mantle
young knoll
#

cdp?

stiff ember
#

?pdcdp?

quaint mantle
#

cdp?pdc

stiff ember
#

CDP

stiff ember
quaint mantle
#

ɔpd¿

quaint mantle
#

so you can detect when they hit

stiff ember
#

I am

quaint mantle
#

???????

stiff ember
#

I am using splashbottles

#

lol

quaint mantle
#

did you not just say water bottles

#

i thought you mean normal bottle

stiff ember
#

but i wanna use water buckets

#

as ammo

quaint mantle
#

🙂

stiff ember
#

uh

#

ty

#

?

#

lol

#

ok nvm

#

but

#

how can i throw

#

a bottle?

young knoll
#

I believe you can just use launchProjectile

stiff ember
#

What type of projectile is it though?

#

lol

young knoll
#

ThrownPotion

wispy dagger
#

Haha guys so I'm getting back into mc plugins and I completely forgot, what version of java do you use?

young knoll
#

What version do you want to develop for

stiff ember
#

How can I get the right velocity so something goes the way a player is looking?

#

aaannnd everyones gone

stone sinew
eternal night
#

basically don't be a 1.8 pleb, use java 16 and develop for spigot 1.17

stiff ember
#

ty

#

Also how do I turn a thrownpotion into a thrown water bottle?

restive mango
#

hi

#

im looking to see if anyone knows how to fix this error

#

[20:47:35 WARN]: [AesopianProject] Task #1873573 for AesopianProject v1.15.2 generated an exception
java.lang.ClassCastException: class java.util.Collections$UnmodifiableRandomAccessList cannot be cast to class org.bukkit.block.BlockState (java.util.Collections$UnmodifiableRandomAccessList is in module java.base of loader 'bootstrap'; org.bukkit.block.BlockState is in unnamed module of loader 'app')

#

i store a blockstate as metadata

#

then i try to get that metadata and cast it onto a blockstate object

#

but when i do so

#

it throws that

#

i assume i need to try some other way to cast or something

restive mango
#

BlockState teststate = loc.getBlock().getState();

    loc.getBlock().setBlockData(Material.AIR.createBlockData());

    loc.getBlock().setMetadata("aeso", new FixedMetadataValue(AesopianProject.getAesopianProject(),teststate));

    ((BlockState) loc.getBlock().getMetadata("aeso")).update(TRUE);
#

just assume loc is some location

#

but yeah i dont think this will work

#

let me know if you have any ideas how to save blockstates

stiff ember
#

Anyone know how to turn a ThrownPotion into a Water bottle?

#

like

#

to change its type

hasty prawn
stiff ember
#

I need it to be the blue and to put out fires

restive mango
#

i did give the code

golden turret
#

"next time use this"

restive mango
#

wat

golden turret
#

discord ate my message

#

and replaced it with the gif

restive mango
#

oh roflmao

#

well hey

#

do YOU know how to store a bunch of blockstates

#

preferrably on blocks or something

golden turret
#

what would be a bunch of blocstates

restive mango
#

not in a hashmap i mean

#

i'm tryna figure out a way to store a bunch of blocks so i can change them all to be air and then replace them if the server restarts

#

including chests, hoppers, redstone, whatnot

#

i really dont want to do it with worldedit

#

mostly because it would be really inefficient

#

i want to just store a blockstate

#

i tried setting the metadata of a block to be a blockstate

#

did not work

golden turret
#

?pdc ?

golden turret
#

or you can store the location of each block

#

and get them when the server starts

restive mango
#

i dont know what this is but imma read it

#

if it solves my problem can i give you money

#

wait

#

no

#

i cant store blockstates in these

#

welp

golden turret
#

then store the location in a database

#

and when the server starts

#

do something with the blocks in the locations

restive mango
#

alas

#

seems like i might have to worldedit

hasty prawn
paper geyser
#

hi!

#

i'm trying to add the nbt "hide_attributes 64" to an item

#

when using addItemFlags(ItemFlag.HIDE_ATTRIBUTES) it won't hide disc attributes

sullen marlin
#

Disc?

paper geyser
#

Music Discs

#

saying what song it is

sullen marlin
#

Isn't 64 HIDE_DYE

torn shuttle
#

anyone happen to know off the top of their head why end crystals would be protected by a wg region? my brain feels like it's swimming through molasses right now

sullen marlin
#

MC wiki says 'Adding 64 hides "Dyed" on leather armors'

torn shuttle
#

just that? because mobs are also entities

hasty prawn
#

Use 32 @paper geyser

young knoll
#

Do you have any entity protection flags enabled

paper geyser
#

ok

#

but how would I go about doing that

quaint mantle
#

why tf does intellij have 50 keybinds now

#

im not even pressing anything crazy and theres a keybind for it

paper geyser
#

im not understanding how to add nbts

#

based off what I've read

young knoll
#

Doing what

hasty prawn
#

I think it's just ItemMeta#addItemFlag(ItemFlag.HIDE_POTION_EFFECTS)

young knoll
#

Not sure that one will work

#

But it’s worth a try

hasty prawn
#

From the Wiki: "Adding 32 hides other information, including potion effects, shield pattern info, "StoredEnchantments", written book "generation" and "author", "Explosion", "Fireworks", and map tooltips "

#

It's just called HIDE_POTION_EFFECTS

#

I tried it, it hides some of the disc data

young knoll
#

Some?

hasty prawn
#

Wait no nvm it hides all of it

#

The.. one line it has lmao

young knoll
#

Good to know

outer sorrel
#

how do i check if a player is wearing an elytra? it keeps giving null errors and when i check if it isnt null it doesnt run

young knoll
#

Get the chest plate, check for null and then compare material

quaint mantle
#

wait

#

hide potion effects = hide disc data 😂 ?

young knoll
#

Mhm

remote gazelle
#

.

#

how can i convert Color to closest DyeColor?

raw frost
#

Unable to connect to BungeeCord: Could not connect to a default or fallback server, please try again later: io.netty.channel.AbstractChannel$AnnotatedConnectException

Bungeecord:
ping_passthrough: false, online_mode: false, ip_forward: true
Spigot (sub servers):
online_mode: false, bungeecord: true, connection: -1

gritty urchin
#

How would I update a block 50 times a second given that the maximum ticks per second in Minecraft is 20

plain helm
#

Use timer task

#

You access timer task from Bukkit.getServer().getScheduler().runTaskTimer

tender shard
gritty urchin
#

Trying to create a smooth GIF with maps

#

@tender shard

tender shard
#

are you actually placing blocks to create map pictures? o0

#

that's quite inefficient

gritty urchin
#

no

#

image to map conversion is done by the plugin

tender shard
#

and why do you have to update a block then?

#

ohh

#

I see

#

you mean the map's blockstate or sth

gritty urchin
#

yeah

plain helm
#

So it will run 50 times per second

#

If the ticks are 20

gritty urchin
#

I thought it only accepts long values

tender shard
#

true

plain helm
#

Ah thats right

gritty urchin
#

so that wouldnt work

plain helm
#

Idk if it would accept this but what if you put (20/50)L

gritty urchin
#

nah that wouldn't work

#

because its still 0.4L

#

which isnt a long value

#

I don't think anything can be run more than 20 times per second in MC

#

unless the TPS is changed

quaint mantle
#

dont use ticks 🤔

gritty urchin
#

everything in the game runs on ticks

plain helm
#

I guess the only solution is to change the tps in your server

#

Have you ever seen any other plugin doing something like this? I mean 50fps map animation

gritty urchin
acoustic pendant
#

how can i cancel critical hits?

gritty urchin
acoustic pendant
gritty urchin
acoustic pendant
#

ok, ty

acoustic pendant
quaint mantle
#

I’m guessing it’s not passing all of the If statement as you used && not ||

tender shard
#

they exist for a reason

quaint mantle
#

Also… That’s not even an Event -_-

quaint mantle
#

That’s just a method

#

It’s a private Boolean too..

tender shard
quaint mantle
plain helm
acoustic pendant
acoustic pendant
tender shard
#

then it would be very good idea to listen to any damage events

tender shard
acoustic pendant
#

nvm

plain helm
acoustic pendant
#

no?

plain helm
#

Sorry even for ping

acoustic pendant
#

xD

plain helm
#

It’s a listener

#

Oh wait

acoustic pendant
#

but with @fresh templethandler it won't work the variable "Player"

#

sorry even

plain helm
#

You need to pass an event to the listener

tender shard
#

"Player" is not an event you could listen to

plain helm
#

In that way the plugin has no idea what to do with that class

tender shard
#

?events

#

hm

chrome beacon
#

?event-api

tender shard
#

?eventapi

undone axleBOT
chrome beacon
#

Ah there

tender shard
#

can someone help me? My library has a few modules but when I update it to a new version string in the pom.xml, nothing compiles anymore. I have absolutely no knowledge about maven modules and just followed a tutorial

tender shard
chrome beacon
#

Actually if you update the version you need to update the parent information in each submodule

tender shard
#

yep I did that

#

just replaced 5.0.0-SNAPSHOT (working fine) in all files with 6.0.0-SNAPSHOT

#

?paste

undone axleBOT
tender shard
sullen marlin
#

Forgot to replace version in parent pom maybe

#

Also consider heeding the warning about it should be a constant

tender shard
tender shard
sullen marlin
#

Did you recompile the parent

tender shard
#

I ran mvn clean install on the parent pom

sullen marlin
#

Did you accidentally specify a parent in the parent

tender shard
#

a parent in the parent?

sullen marlin
#

Your children have Jefflib not jefflib-parent as their parent

tender shard
#

thanks, I'll check it out

sullen marlin
#

You probably changed it at some point and forgot to update the children

tender shard
#

yeah I used to call JeffLib JeffLib-dist

opal juniper
tender shard
#

and the parent was just called JeffLib

sullen marlin
#

Only exposed now that you updated the version too

tender shard
#

sooo that probably broke it

#

thanks!

plain helm
#

Guys would blocking too many accesses to a server and limit the number of players connected from the same ip prevent bot attacks and their impact to the server’s performance?

tender shard
#

Perfect! Changing the parent of JeffLib to JeffLib-parent worked! How tf could I not notice that lol

tender shard
sullen marlin
#

Start with online mode

tender shard
#

I always forget that offline servers even exist

plain helm
opal juniper
#

Then yeah, online mode and from that point there isnt a whole tonne you can do

#

limiting player count seems like a stupid solution

#

but

#

from the same ip that seems like a valid way

tender shard
#

If so just block those using iptables/nftables after X connection attempts etc

maiden mountain
#

Is there a way to create plugin data files?

tender shard
#

do you want to save some data inside files?

maiden mountain
#

I'm current writing my own way using gson

#

Yes but not in yml

tender shard
#

new File(...).createNewFile()

maiden mountain
#

So i was wondering if spigot has a built in api for data files

tender shard
#

I dont think so, just use the standard java things for writing to files

maiden mountain
#

frick

#
 java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module @58134517
#

When trying to save data ahaha

wintry pilot
#

Is it a problem to create an addon for a paid plugin and use it personally?

opal juniper
#

Use YamlConfiguration

maiden mountain
#

Serializing a hashset

acoustic pendant
#

i'm not good at reading console errors could anyone help me?

tender shard
maiden mountain
#

using gson

opal juniper
#

oh oh

#

so just save to a file

#

peasy

acoustic pendant
opal juniper
#

org.bukkit.craftbukkit.v1_17_R1.entity.CraftAxolotl cannot be cast to class org.bukkit.entity.Player

tender shard
opal juniper
#

there you go

#

at me.fragment.damageindicator.Events.CriticalHits.isCritical(CriticalHits.java:16)

tender shard
#

you are casting an Axolotol to a player

acoustic pendant
#

wtf?

tender shard
#

you somewhere do Player player = (Player) entity or something

opal juniper
#

show ur code

tender shard
#

without checking whether entity is a player

maiden mountain
acoustic pendant
#

Player damager = (Player) e.getDamager();
if (damager instanceof Player) {

#

that's what i'm doing

maiden mountain
#

I'm just having issues with serializing the hashset to json

opal juniper
#

lol

#

instanceof check after casting

acoustic pendant
#

oh

#

i just realized

maiden mountain
#

Because it seems it doesnt like it that much ahaha

acoustic pendant
#

so, instanceof isn't necesary?

opal juniper
tender shard
#

you cast the e.getDamager to player

opal juniper
#

just do it befroe

normal flower
#

How would I get access to the lines of a sign in 1.17 java Sign sign = (Sign) targetBlock.getState();No methods for obtaining the lines are available from the sign interface.

opal juniper
#

you cast

tender shard
acoustic pendant
maiden mountain
#
String json = gson.toJson(this.dataFile);
            Files.writeString(dataFile.toPath(), json);
maiden mountain
#

nooooo

#

i'm stupid

maiden mountain
#

AHAHA

#

now i see the issue

#

i'm trying to parse the File not the hashset ahahaha

maiden mountain
#

Big brain mode initiated

gaunt hornet
#

I'm trying to make a custom item that makes creepers run away from the player when the item is held - Does anyone know of a method that makes a mob flee like a creeper does next to an ocelot?

opal juniper
#

u are gonna have to mess with pathfinding goals afaik

maiden mountain
#

Fixed it. Thanks for the help lads

gaunt hornet
#

Damn

#

I was really hoping that I wouldn't have to lol

acoustic pendant
tender shard
acoustic pendant
#

i changed it

normal flower
tender shard
#

probably blockdata not block

tender shard
acoustic pendant
#

hmm

tender shard
#

check which of those if statements is true and which are not etc

acoustic pendant
#

inside the bolean flag = sout"1" //code

#

like that?

tender shard
#

first of all refactor the code

#

e.g. instead of checking whether e.getDamager() is instanceof player, check if it is NOT instanceof of player and then return

#

same for all the other checks you are doing

#

then you can print after every if statement whether it's still executing

#

then you can easily see which condition isnt true

#

also @acoustic pendant why do you check whether your player is instanceof LivingEntity?

acoustic pendant
#

maybe an entity hits 1sec before dying and maybe it has died but mc detect him as a LivingEntity

#

idk if you get what i mean

tender shard
#

you say Player damager = ...

#

so damager is always a player

#

try this

#
    @EventHandler
    public void isCritical(EntityDamageByEntityEvent e) {
        System.out.println(1);
        if (!(e.getDamager() instanceof Player)) return;
        System.out.println(2);
        Player damager = (Player) e.getDamager();
        if(damager.getFallDistance() <= 0.0F) return;
        System.out.println(3);
        if(damager.isOnGround()) return; // isOnGround is deprecated
        System.out.println(4);
        if(!(damager instanceof LivingEntity)) return; // Unnecessary
        System.out.println(5);
        if(damager.hasPotionEffect(PotionEffectType.BLINDNESS)) return;
        System.out.println(6);
        if(damager.getVehicle() != null) return;
        System.out.println(7);
        if(e.getDamage() <= 0.0F) return;
        System.out.println(8);
        e.setDamage(e.getDamage() / 1.5F);
        }
    }
acoustic pendant
#

oh

#

and maybe the player register a hit before dying?

tender shard
#

damager is ALWAYS a Player

acoustic pendant
#

yes

austere cove
#

no

acoustic pendant
#

that's what i'm saying

tender shard
austere cove
#

oh thought u mean in general

tender shard
#

oh no

#

I meant his "damager" variable

austere cove
#

ill go back in my corner now

#

~

tender shard
#

😄

acoustic pendant
#

lol?

#

i found a 4 cactus

#

pog

tender shard
acoustic pendant
#

yes, i'm looking for an entity

tender shard
#

/summon Zombie

acoustic pendant
#

not op

#

to try if the problem is op

tender shard
#

it isnt

acoustic pendant
#
[12:48:56] [Server thread/INFO]: 1
[12:48:57] [Server thread/INFO]: 1
[12:48:58] [Server thread/INFO]: 1
[12:49:23] [Server thread/INFO]: 1
[12:49:23] [Server thread/INFO]: 2
[12:49:26] [Server thread/INFO]: 1
[12:49:26] [Server thread/INFO]: 2
[12:49:43] [Server thread/INFO]: 1
[12:49:43] [Server thread/INFO]: 2
[12:49:43] [Server thread/INFO]: 3
[12:49:43] [Server thread/INFO]: 4
[12:49:43] [Server thread/INFO]: 5
[12:49:43] [Server thread/INFO]: 6
[12:49:43] [Server thread/INFO]: 7
[12:49:43] [Server thread/INFO]: 8
[12:49:45] [Server thread/INFO]: 1
[12:49:46] [Server thread/INFO]: 1
[12:49:47] [Server thread/INFO]: 1
[12:49:49] [Server thread/INFO]: 1
[12:49:50] [Server thread/INFO]: 1
golden turret
#

remote jvm debug >>>>>>>>>>>>>>>>>>>>>

tender shard
#

that means the whole thing was executed once

acoustic pendant
#

but didn't cancel the hit

#

crit

tender shard
#

it set the damage to damage / 1.5

tender shard
acoustic pendant
#

yes, but the damage is still like a crit hit

tender shard
#

you mean it shows the "crit hit" animation?

acoustic pendant
#

i did a plugin that is for damageindicator

acoustic pendant
#

the damage

#

i did a plugin that sends the damage

#

well, i don't know why is not cancelling the crit damage

dire marsh
#

are you trying to detect critical hits

acoustic pendant
#

to cancel them

dire marsh
#

can't you just set the total damage to the base damage

acoustic pendant
#

i'm dividing the damage for 1.5

#

this is the code:

dire marsh
#

well for a start you're missing a lot of things there

#

the wiki details it pretty well

#

but what is the current issue you have?

acoustic pendant
#

that all the code is executed

#

but when i hit a entity jumping it does more damage

#

base damage:

#

Critical damage:

dire marsh
#

can't you just set the damage to the base damage of the weapon in hand?

eternal night
#

are you sure you are actually dealing that dmg

acoustic pendant
#

yes?

eternal night
#

concerning you are playing around with the same event that might be responsible for spawning these damage indicators

#

you might modify after it spawns

acoustic pendant
#

hmm

#

that makes sense

eternal night
#

(e.g. have you checked the entities health using commands)

acoustic pendant
#

nope

dire marsh
#

tbh, mc damage code is a mess

acoustic pendant
#

ok, i check the damage with e.getDamager(); and e.getDamage();

#

should i add like finalDamage?

eternal night
#

huh ? are you writing the plugin that spawns the damage indicators ?

acoustic pendant
#

yes

dire marsh
#

I'm also amazed there is not API for this yet

acoustic pendant
#

yes lol

golden turret
#

hello, i want to save a ConfigurationSerializable in the root yaml

eternal night
#

move the listener that spawns these to monitor level

acoustic pendant
#

so, to get the final damage, should i do something with events?

golden turret
dire marsh
#

I believe it should be possible to add an isCritical or some event, I'll have to open up my paper fork and find how

acoustic pendant
#

something like this? double finalDamageDealt = e.getFinalDamage();

dire marsh
#

Oh well would you look at that

#

there is a pr to add it to paper

tender shard
golden turret
#

:C

#

i think i will set it to a path so

#

easier

tender shard
#

like

for(String key : mySection.getKeys(false)) {
  config.set(key, mySection.get(key));
}
golden turret
#

ik

acoustic pendant
#

how can i get the life of an entity?

dire marsh
#

cast it to Damageable

acoustic pendant
#

i mean, with a command

tender shard
dire marsh
#

or install a mod that shows entity hp if you just want to see the damage lol

acoustic pendant
#

hmm

#

i tried with this: double finalDamageDealt = e.getFinalDamage();

#

but no

tender shard
#

you literally have no idea what events are, do you?

acoustic pendant
#

?

tender shard
acoustic pendant
#

yes, and i'm reducing the crit damage

tender shard
#

and now ask how you get the health of an entity inside a command

#

what does a command have to do with a entitydamageevent?

acoustic pendant
#

because i want to check if the hp of the entity

eternal night
#

you don't need to code your own command for that

acoustic pendant
#

it's according to what the hologram says

eternal night
#

there is the /data command

tender shard
#

I think with "command" he meant java code and not an ingame command

acoustic pendant
#

ingame

tender shard
#

?

#

I have no idea what you are looking for

acoustic pendant
#

ok

#

wait

tender shard
acoustic pendant
#

i explain you.

#

I have a code that creates a hologram every time i hit an entity

dire marsh
#

Lynx just mentioned the /data command

#

I have no idea how that works though

tender shard
dire marsh
#

nice

tender shard
acoustic pendant
#

i want to see the entity health because i don't know if crits are cancelling or is a problem of the hologram

dire marsh
#

where is the code that creates a hologram?

acoustic pendant
#

do i send you?

dire marsh
#

well yes

acoustic pendant
#

here it is

dire marsh
#

why are you listening to the event twice

#

for setting damage and then spawning hologram

acoustic pendant
#

oh

dire marsh
#

that is probably why it's wrong

acoustic pendant
#

because if i spawn where the hit is

#

you can see the armor stand for a few secs

dire marsh
#

put the hologram code in the same event after you set the damage

#

or set the priority of the @fresh templetHandler i guess

acoustic pendant
#

like this?

dire marsh
#

fuck i pinged that guy again

dire marsh
#

no

#

put it inside the same code block

acoustic pendant
#

well

#

now works

dire marsh
#

I wouldn't trust that to continue working

tender shard
#

you really shouldnt call your ArmorStand "damage", that's kinda confusing - at least in my opinion

acoustic pendant
#

the delay?

tender shard
#

No

#

Creating a variable for the scheduler

acoustic pendant
#

eeh

#

that's a great question

#

oh

#

because if not

#

well

#

nvm

#

Bukkit.getScheduler().runTaskLater(DamageIndicator.getInstance(), () -> {
damage.remove();
}, 40 );
}
}

#

got it

pastel stag
#

use code block for putting code in discord homie

dire marsh
#

you should also make your plugin field private final

pastel stag
#

multi-lines of code you can use three ` at the start and then another 3 at the end of your code

tender shard
dire marsh
#

you can also highlight code in discord

tender shard
#

wrong quote

#

yeah that's useless

acoustic pendant
#

i almost deleted my main class

dire marsh
#
if (a) {
 System.out.println("hi");
}```
tender shard
dire marsh
tender shard
#
System.out.println(getLogger());
pastel stag
#

what even is Bukkit.getLogger()

plain helm
#

you can use that to send info, warns or errors

#

instead of printing normal strings

pastel stag
#

......

#

i was being facetious

#

i

#

was being sarcastic

plain helm
#

yep

pastel stag
#

i suppose it's completely reasonable to assume people here wouldn't actually know

#

noted

tender shard
#

well there are people here who blindly cast an Entitiy to Plugin because that removes the red underlines in IntelliJ

#

so they think it'll work now

pastel stag
#

i guess i really didn't think anyone who would be looking in a spigot help-development channel wouldn't know what Bukkit.getLogger() was lol but yeaaaaa its probably not safe to assume that

ivory sleet
#

Bukkit::getLogger returntype is the normal java utility Logger afaik

mortal hare
#

day 2 researching brigadier. You cannot override brigadier error messages due to the way they're hardcoded into brigadier classes. Unless you edit the source code, there's no way of changing them

ivory sleet
#

Oof

mortal hare
#
public class BuiltInExceptions implements BuiltInExceptionProvider {
    private static final Dynamic2CommandExceptionType DOUBLE_TOO_SMALL = new Dynamic2CommandExceptionType((found, min) -> {
        return new LiteralMessage("Double must not be less than " + min + ", found " + found);
    });
    private static final Dynamic2CommandExceptionType DOUBLE_TOO_BIG = new Dynamic2CommandExceptionType((found, max) -> {
        return new LiteralMessage("Double must not be more than " + max + ", found " + found);
#

that's a deal breaker for me

ivory sleet
#

Maybe pr?

mortal hare
#

if these were changeable i would switch my command framework to brigadier one

#

this a mojang lib

#

not spigot's impl

#

pr is impossible in this case

ivory sleet
#

You can pr brig tho, and the hopefully they’d include it in minecraft 1.18

mortal hare
#

i doubt it, its not a brigadier's problem. NMS messages and brigadier messages are actually different

#

there are two classes which implement BuiltInExceptionProvider

#

i have no idea how the instance of NMS class injected into brigadier static method to retrieve exception provider

#

wait nvm

#

these are exceptions

#

NMS just catches those exceptions and replace those with its own class exceptions.

ivory sleet
#

ah

mortal hare
#
            } catch (CommandSyntaxException var18) {
                commandlistenerwrapper.sendFailureMessage(ChatComponentUtils.a(var18.getRawMessage()));
#

nvm

#

it sends the exception message from brigadier

#

as you can see var18.getRawMessage()

tender shard
#

ah yes, var18, that's how I also like to call my variables

mortal hare
#

decompilation

tender shard
#

I know

#

anyway

#

a friend of mine obfuscated his code by hand lmao

#

most stupid thing I ever heard of

mortal hare
#

there's only two ways to override brigadier error messages

#

you need to extend net.minecraft.commands CommandDispatcher class and override public int a(CommandListenerWrapper commandlistenerwrapper, String s, String label, boolean stripSlash)

#

do copy paste from default method and edit sendFailureMessage argument to provide your own messages

quaint mantle
#

why wont this work?
I want to store all block break info in a chat file for my server

#
    public void blockbreakdata(PlayerHarvestBlockEvent f) throws IOException
    {
        String time;
        DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        Calendar cal = Calendar.getInstance();
        time = (dateFormat.format(cal.getTime()));
        String player,block,loc;
        String finalmsg;
        int bx,by,bz;
        block=f.getHarvestedBlock().toString();
        player=f.getPlayer().getDisplayName();
        bx=f.getHarvestedBlock().getX();
        by=f.getHarvestedBlock().getY();
        bz=f.getHarvestedBlock().getZ();
        loc=f.getPlayer().getLocation().toString();
        finalmsg=time+"| Player "+player+" broke "+block+" at x:"+bx+", y:"+by+", z:"+bz+". "+player+" was at "+loc;
        write("blockbreakrecord",finalmsg);
        System.out.println("Stored block data");
    }```
quaint mantle
#

it is supposed to store the block break in a file

#

block break data

tender shard
#

you arent even listening to the blockbreakevent

quaint mantle
#

sorry I am extremely new in making plugins

#

can u tell me how to

tender shard
#

use BlockBreakEvent instead of PlayerHarvestBlockEvent

#

the PlayerHarvestBlockEvent is for harvesting berry bushes etc

quaint mantle
#

dang it ok

#

tysm lemme try

tender shard
#

np

pastel stag
#

why do people always use single letter objects in their code 😦

tender shard
#

I also used to do that

quaint mantle
#

because I literally started learning programming 6 months ago

pastel stag
#

it makes things so hard to read imo

tender shard
#

I could understand if you would have called the event "e", but why "f"? 😄

pastel stag
#

call event event homie lmao

quaint mantle
#

ohk ig

pastel stag
#

public void onBreak(BlockBreakEvent event) {

quaint mantle
#

it is a big word "event"

#

better e or f

tender shard
pastel stag
#

i mean you dont HAVE to, technically you are not wrong but its just easier to read later on as you add to your code and have to go back to it it makes it easier on yourself later on

tender shard
#

the whole code is a meme lol

#

"quality code" according to the author 😄

#
    static void doodWhrsMyCar(UUID sweet) {
        if (dr0pp3dPuhlayars.containsKey(sweet)) Bukkit.getScheduler().cancelTask(dr0pp3dPuhlayars.remove(sweet));
    }
pastel stag
#

🤮

tender shard
#
TooCool2Teleport.microwave(player);
#
@EventHandler(ignoreCancelled = true)
    private void onPlayerTryingToBreakLegs(EntityDamageEvent ouch) {
pastel stag
#

i feel like if my plugin gets found by someone in this channel it will surely get roasted as well

#

but this....

mortal hare
#

lemme remind that this project has 7 contributors lol

pastel stag
#

wow

tender shard
#

but it has a CNNListener

pastel stag
#

we dont need no stinking packages

#

hmph

tender shard
#

lmao

#
        if (bonelessIceScream(loco))
            loco = netherLocation(loco, 110);
        else if (billyIceScream(loco))
golden turret
#

whyyyyy

pastel stag
#

my brain

#

it fucking hurts

tender shard
#
public class TooCool2Teleport implements Listener {
    static HashMap<UUID, Location>       coldPlayers = new HashMap<UUID, Location>();
    static HashMap<UUID, BukkitTask>     coldTaxs    = new HashMap<UUID, BukkitTask>();
    static HashMap<UUID, boolean[]>      boobools    = new HashMap<UUID, boolean[]>();
    static HashMap<UUID, PotionEffect[]> sauces      = new HashMap<UUID, PotionEffect[]>();
#

ah yes, the sauces hashmap

pastel stag
#

btw the only time it is acceptable to use a few characters for your objects is with sql statements

#

cause you got me fucked up if im going to type PreparedStatement1.blah 50 fucking times

#

that shit's just too long, ps1.blah

mortal hare
#

these are static fields

#

not getters

#

nothing

#

i thought i would never see something like this in a github with lots of favorite stars on it and 7 contributors LMAOO

tender shard
#
    static void addPlayer(Player player, boolean[] tips, PotionEffect[] dishes, BukkitTask taxs) {
        UUID coffee = player.getUniqueId();

        if (coldPlayers.containsKey(coffee)) microwave(player);

        boobools.put(coffee, tips);
        sauces.put(coffee, dishes);
        coldPlayers.put(coffee, player.getLocation());
        if (taxs != null) coldTaxs.put(coffee, taxs);
        // As addPlayer() can be called async, have to do it in a sync task
        if (dishes != null && dishes.length > 0)
            new BukkitRunnable() {
                @Override
                public void run() {
                    for (PotionEffect leftovers : dishes) player.addPotionEffect(leftovers);
                }
            }.runTask(instace);
    }
#

the whole plugin is just a parody or sth I think

golden turret
tender shard
#

UUIDs called hotdog, BukkitTasks called callofduty, microving players, OuechieListener.doodWhrsMyCar(hotdog), sauces.remove(hotdog), .... 😄

pastel stag
#

i dont feel so horrible about my code anymore

tender shard
quaint mantle
quaint mantle
tender shard
#

Bukkit has that builtin.

#

First, your Plugin has the method getConfig()

#

that includes everything inside your config.yml file

tender shard
#

to create your own config files, you can do YamlConfiguration.loadConfiguration(File)

tender shard
#

if your plugin includes a config.yml, you can save it using saveDefaultConfig()

tender shard
#

and as set, you can get values using getConfig(), e.g. getConfig().getString("name");

#

yes

#

I'm a bot

pastel stag
#

@tender shard is our answer silly questions bot bot

tender shard
pastel stag
#

he uses AI

tender shard
#

yes , Alcohol-driven Intoxication

#

Cheers!

#

anyway gotta do the dishes, cya

quaint mantle
#

btw is there any website which we can access for like ai chat response?

quaint mantle
#

Localhost for example.

#

no like

#

wait

quaint mantle
#

similarly is there any website which gives an intelligent response to a chat

quaint mantle
#

there is an expert guy i know about that

#

he did it in 5 minutes

#

i can give his id

#

yes give me

#

:D

#

ye let me ask him

#

he turn off the bot (self-bot, access a database that he also made, all of them just in 5 minutes 😂 )

#

damn

wide flicker
quaint mantle
#

?

wide flicker
quaint mantle
#

okie I just wanna learn as a hobby so if u have one for free let me know tysm anyways

quaint mantle
#

same I m india

#

Btw I don't really know him that much, only once tell him to create a discord bot to replace Groovy and Rythm and 2 hours later he already made it, really detail, and I see nothing to say that it is bad.

quaint mantle
#

is there a way to get the current tps without nms and ANY other plugins api ?

#

or the recentTps

golden turret
#

maybe

quaint mantle
#

so how ?

golden turret
#

actually

#

i dont think so

#

you could fake a commandsender

#

and make it run /tps

#

and you could get the message

#

and split

#

:114:

quaint mantle
#

😐

acoustic pendant
#

?actionbar

#

is there any guide for action bar?

ivory sleet
#

barely needed

acoustic pendant
#

i need it

young knoll
#

Player.spigot.sendMessage

acoustic pendant
#

what should i implement?

#

to the class

ivory sleet
#

wym?

acoustic pendant
#

hmm

#

to define "player"

ivory sleet
#

assume you have your player variable, then invoke
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("action bar"));

acoustic pendant
#

i don't have player variable

ivory sleet
#

then you'd need to obtain one

#

or well a player instance

#

Bukkit.getPlayer("name")
or Bukkit.getPlayer(uuid) might help you

quaint mantle
acoustic pendant
#

to the player

quaint mantle
#

who is the player

#

a player in an event ?

#

or what

acoustic pendant
#

i want to when the player joins

#

get an action bar

quaint mantle
#

so if you have no variable
just use e.getPlayer().sendMessage().....

acoustic pendant
#
    public void actionBar(Player player) {
        player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("action bar"));


    }
}
#

i have it like that

quaint mantle
#

yes

acoustic pendant
#

but TextComponent is giving an error

#

i haven't used TextComponent never

quaint mantle
#

TextComponent.fromLegacyText("action bar")

acoustic pendant
#

no?

quaint mantle
#

wait

acoustic pendant
#

sure

quaint mantle
#

this is strange
mine doesn't work either

#

oh bruh i was using 1.8.8

#

@acoustic pendant

   public void sendActionBar(Player player, String text) {

        player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', text)));

    }
#

i guess this will work

acoustic pendant
#

i did this

#

idk

#

but in minecraft, it doesn't send any message

crimson terrace
#

do player.sendmessage()

ivory sleet
#

adri, you never use the method

crimson terrace
#

oh nvm me I didnt read above

acoustic pendant
ivory sleet
#

Just because you declare its existence doesn’t mean it’s automatically going to work

acoustic pendant
#

well

#

that makes sense

tender shard
#

@acoustic pendant please do us a favor and learn basic java, you always come up with totally basic questions, like "why does my code not work" when you don't even call it anywhere, etc

ancient plank
#

do the command

tender shard
#

i dont know the commands

ancient plank
#

rip

#

learn the command

#

?learnjava

undone axleBOT
tender shard
#

?learnthecommands

ancient plank
#

has it registered in your brain?

mortal hare
#

how old are you guys

#

im 18

tender shard
#

26

mortal hare
#

im freezing rn in my home

#

soo cold

#

*sad nordic noises*

tender shard
#

oh what the it's already 4pm, I have to switch to harder drinks now

tender shard
mortal hare
#

here the sun is shining too

tender shard
#

16°C

mortal hare
#

and it still cold

#

7 C

tender shard
#

anyone knows how I can prevent IntelliJ from having to click on Commit twice when it finds "problems"?

#

it always says my code got problems because it also checks codeblocks in markdown files

mortal hare
#

im still researching brigadier in NMS

#

can you believe it

tender shard
#

I can 😄

mortal hare
#

apparently server send translatablechat component to the client

#

and the text is displayed is from translation file

#

not from the server itself

#

changing the text is too much hassle

#

you can, but that would require to extending and modifying the dispatch method of the existing vanilla command dispatcher, create VanillaCommandWrapper classes, add them to bukkit command map, and then it would work

fierce jolt
#

Is there like a way to stop a player from fishing? Like they throw out their hook and after some specific condition I make them reel in again

#

can't seem to find anything regarding it

mortal hare
#

maybe cancel right click event

stone sinew
fierce jolt
#

as in reel in their hook, but my plugin would trigger that action

mortal hare
tender shard
#

if you don't find a better way, in the worst case you can simply change their item in main hand to air and then give them the fishing rod back

fierce jolt
#

Might dive into the NMS for this as well, there has to be some kind of method that's being used

tender shard
#

I don't see any way on how that would help to cancel fishing after like 5 seconds

#

all I can see in that code is that stuff happens when a player reels in the line themselves

#

but no way to make them force to do so

stone sinew
tender shard
fierce jolt
#

You are really not getting it...

#

When you throw your fishing hook out, it stays in the water right?

tender shard
fierce jolt
#

I want to make the player reel in that hook plugin based

#

time to get to the nms

tender shard
#

yeah I also think there's no other way. Do you also want the player to get the reel in animation?

fierce jolt
#

Kind of

#

Let me try to do something with the hook entity.

#

might be able to just remove that one

#

see what it does

tender shard
#

good luck! let me know when you found I way. Not that I need it, but it would be interesting to know 😄

fierce jolt
#

I surely will!

tender shard
#

ty

fierce jolt
#

teleports the hook entity into oblivion

tender shard
#

I have an idea

#

send a chat message "You reeled in your hook but didn't notice it"

#

SCNR

fierce jolt
#

@tender shard removing the hook entity from the world does work.

tender shard
#

oooh

#

awesome, that's way easier than I would have thought

fierce jolt
#

does not trigger a REEL_IN event though, so I might fuck the inner workings a bit hahaha

tender shard
#

you can just call the event yourself

#

the event itself is just to notify plugins

#

bukkit / mc doesn't care at all about the events

fierce jolt
#

I guess it triggers the same part of code that triggers when you get out of reach of your hook

#

that doesn't trigger any events either

#

Which it probably should but EH, this could be my first PR to spigot maybe ;D ¯_(ツ)_/¯

tender shard
#

Weeel

#

to be honest

#

I'm not sure whether the event should be called in this case

#

because

#

it's a PlayerFishEvent, it gets called when a player does fishing stuff

#

but the player didnt do anything in this case

fierce jolt
#

Walking away and stopping to fish does seem like something that should be called though

#

hahaha

tender shard
#

yeah that's true, maybe another Action

#

REEL_IN_BECAUSE_TOO_FAR_AWAY lol

fierce jolt
#

This actually breaks the visuals I have setup oof

stone sinew
#

You can probs send a reel packet to the player then cancel the playerfishevent.

fierce jolt
#

not again pls

tender shard
#

lol

#

what playerfishevent? there is none

stone sinew
stone sinew
tender shard
#

you just don't get it

#

we want to cancel the fishing after the player is already fishing for 5 seconds

#

do you think the server keeps to call a playerfishevent every tick the whole time a player fishes?

#

because it doesnt

fierce jolt
ancient plank
#

any bobbers in the chat

stone sinew
#

Yes. so check playerfishevent launch a task after 5 seconds send the reel packet and remove the hook entitiy.

fierce jolt
#

I doubt there is a reel in packet

tender shard
#

removing the hook is enough

fierce jolt
#

and why would you need it

#

^^

tender shard
#

removing the hook = player gets reel in animation

ancient plank
#

reminds me of when I was making my fishing plugin

tender shard
#

I once was fishing IRL and I was totally disappointed that I didnt get old boots all the time

ancient plank
#

fishing irl is exhilarating

fierce jolt
#

This seems to be enough

#

Craftfishhook though

tender shard
#

quick javadocs question

#
    /**
     * Returns the {@link Random} instance.
     *
     * @return Random instance
     */
    public static Random getRandom() {
        return random;
    }

Would you also add a {@link Random} to the return thing?

#

shit

#

sorry for ping

ivory sleet
#

uh no

#

one time is enough

tender shard
#

oki

#

thanX

#

I'm currently at the point where I have no new ideas so I'm reworking all the javadocs lol

ivory sleet
#

or just have
/**
* @graceful fractalturn {@link Random} instance
*/

#

oh

#

shit

tender shard
#

haha

#

same happened to me

ivory sleet
#

but yeah it gets almost insulting with this Returns the {@link Random} instance.

tender shard
#

isn't a description required?

ivory sleet
#

not really

tender shard
#

I think that it throws warnings without ANY description

ivory sleet
#

oh

#

idk

tender shard
#

Not sure though, at least it's true if the parameters or return things aren't commented

ivory sleet
#

I usually just javadoc the absolutely necessary

#

ah yeah

tender shard
#

yeah me too but right now I'm bored lol

ivory sleet
ancient plank
#

poor re_ovo

golden turret
tender shard
#

yeah I also keep tagging someone on github very often by accident, though I forgot who it was lol

tender shard
golden turret
#

so it is not random

#

it is

#

specific

#

:D

#

😎

ivory sleet
#

since Random instances can be expensive to construct

lavish hemlock
#

it is a specific random

golden turret
#

^

tender shard
#

I didnt choose the name for that class lol

#

it's an instance of Random

#

and I get it with getRandom

#

lol

#

like I get a Player with getPlayer

#

or a Burrito with getBurrito

lavish hemlock
#

getPepsi

tender shard
#

i'm going to getVodkaCoke now if there's still ice in the fridge

golden turret
#

getJoke()