#help-development

1 messages · Page 1999 of 1

tall dragon
#

probably because you told it to

trail pilot
tall dragon
#

is it supposed to be like 358 ?

trail pilot
#

yes

tall dragon
#

getBlockX()

trail pilot
#

thanks

tardy delta
#

because its a double?

red sedge
#
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
    public void onBlockPhysics(BlockPhysicsEvent event) {
        Block aboveBlock = event.getBlock().getLocation().add(0, 1, 0).getBlock();
        if (aboveBlock.getType() == Material.NOTE_BLOCK) {
            updateAndCheck(event.getBlock().getLocation());
            event.setCancelled(true);
        }
        if (event.getBlock().getType() == Material.NOTE_BLOCK) {
            event.setCancelled(true);
        }
        if (event.getBlock().getType().toString().toLowerCase().contains("sign")) {
            return;
        }
        event.getBlock().getState().update(true, false);
    }```
I have this snippet to prevent note blocks from changing state whenever the block under them gets broken, but it seems like it does this 1 tick later how can I fix this
tardy delta
#

x, y, z are doubles not ints

red sedge
#

it doesnt cancel it in the triggered tick

#

rather the next tick

trail pilot
#

now i need to do only for yaw and pitch

tall dragon
trail pilot
viral crag
#

BlockPhysicsEvent has a warning about how much it is called, it might just not be able to since you are blocking the thread

red sedge
tall dragon
red sedge
#

I have this snippet to prevent note blocks from changing state whenever the block under them gets broken, but it seems like it does this 1 tick later how can I fix this
^^

tall dragon
#

sure. but why

red sedge
#

because i need to?

#

save the state of the noteblock

viral crag
#

you could try the block destroy event as well

trail pilot
#

uhm how i can make a double into a int (yaw and pitch)

tall dragon
#

yea i am asking why. there might be a different way.

red sedge
#

and custom blocks change the state differently

red sedge
#

i need to prevent minecraft from changing it

viral crag
#

that last one would be called much less as it handles only player events

red sedge
#

yeah but the block under the noteblock could be exploded

#

destroyed

#

etc

hasty prawn
#

Cast it

tardy delta
#

yaw and pitch are floats

lusty osprey
#

Hi guys!!! Question: How can I update my plugin logo, in case it was not originally loaded, but the item responsible for loading was selected?

tardy delta
#

same principe

trail pilot
somber hull
#

Like in the spigot website?

lusty osprey
#

yea

somber hull
#

Hit the change icon button

trail pilot
#

41.74658 that thing is ugly

tardy delta
#

(int)

trail pilot
#

i want it as int not as float

lusty osprey
trail pilot
#

lmao

delicate lynx
#

under resource tools on the right side

trail pilot
#

mybad

somber hull
trail pilot
tardy delta
#

int i = (int) myFloat

lusty osprey
#

If you don't mind, could you point a finger at me?

olive lance
#

why does hashmap not take primitive types

lusty osprey
#

this is the first time we've uploaded a resource to spigot

tardy delta
#

because generics doesnt allow primitives

delicate lynx
olive lance
#

i just cut my paging file down to like 1 gig so i could have space to installa game

lusty osprey
#

OHHHH...

#

I FIND :dddd

#

Thank you very much, lmao.

somber hull
#

So

#

How much do I have to donate

#

To get vip or whatever it is

#

I can’t find the post about it

#

I just wanna change my name on the forums

tall dragon
#

i donated 10 bucks & i could access it

#

not sure if its less

tardy delta
#

probably 0.01

#

lol

tall dragon
#

yea, probably any donation tbh

tardy delta
#

0.01 BTC

trail pilot
#

D:

tardy delta
#

the hell are you doin

#

show code

trail pilot
grim ice
#

this is painful

#

why are there spaces

#

it looks ugly

tardy delta
#

why util method

grim ice
#

what is ur getPlayerLocation method

#

istg if its one line

delicate lynx
#

bruh just do int yaw = (int) player.getLocation().getYaw();

trail pilot
grim ice
#

just show it

trail pilot
grim ice
#

bruh

delicate lynx
#

why

tardy delta
#

lol just do player.getLocation()

somber hull
#

I found it

grim ice
#

its longer to write that method than to just use player.getLocation() bro

#

why do u even do that

somber hull
tall dragon
#

ah

grim ice
#

anyways

#

anyone has some lib idea

trail pilot
grim ice
#

wdym

trail pilot
grim ice
#

btw is it open source

#

u should make ur stuff open source so u can get bullied by other people until you learn

trail pilot
grim ice
#

thats how i vibe

#

good

trail pilot
#

but i dont know why its still float

delicate lynx
grim ice
#

it isnt

delicate lynx
#

there it is

grim ice
#

thats some good taste in theme btw

trail pilot
#

config utils and homeutils

grim ice
#

and font

delicate lynx
#

imagine changing intellij colors and font

grim ice
#

but please ctrl alt L

viral crag
#

lots of themes in there

delicate lynx
#

default > themes

vocal cloud
grim ice
#

my theme and font

#

needs some change tbf

#

i got bored from it

#

anyways

#

give lib idea

vocal cloud
#

Work of art

grim ice
#

spacing between

#

semicolons in discord is smaller than in intellij

#

wow

vocal cloud
tardy delta
#

👌

trail pilot
somber hull
grim ice
#

Masterpiece

#

btw guys

somber hull
#

True

grim ice
#

small tip if ur copy pasting methods

#

click the method minimizer thing in intellij

#

then it will become a one line

#

u can copy it

trail pilot
#

💀 I didn't even notice

tardy delta
#

copy pasta

#

;{

grim ice
#

ill sue you!

#

you stole my idea!

tardy delta
#

where to find the source code?

grim ice
#

heaven

vocal cloud
#

If you're copy pasting methods probably doing something wrong thonk

grim ice
#

what if u wanna show it to someone

trail pilot
#

lol

#

but im not gonna give it because it illegal!!!

vocal cloud
#

Poor intellij struggling to intellisense all those semis

tardy delta
#

20 gb file

vocal cloud
crimson terrace
#

we need a 1 TB file made of only ';'

trail pilot
vocal cloud
somber hull
vocal cloud
crimson terrace
#

because we can

somber hull
#

💀

vocal cloud
#

Poor intellij is still trying to clean up this file

tall dragon
vocal cloud
#

If I had the disk space I would

quiet ice
#

writes a custom http server just to pretend to have such a massive file

#

Although, pretty sure that java will fail to send such a huge file. I guess it'd need to be some serial protocol

vocal cloud
viral crag
#

just write a sed loop and append to file

vocal cloud
#

Feel free to download it

silver shuttle
#

package org.apache.commons.codec.digest does not exist
How come this?

quiet ice
#

Wasn't apache-commons deprecated in spigot for a while now?

silver shuttle
#

oh uuuuuh idk

#

what's the alternative

quiet ice
#

@vocal cloud scam

silver shuttle
vocal cloud
silver shuttle
#

So what is the spigot alternative for DigestUtils?

rough drift
#

quick thing, can you check when an item is picked up in inv (so like clicked on cursor, because rn InventoryClickEvent only tells me the item on placing down)

quiet ice
#

Oh nice. Cloudflare now thinks that I am a threat

silver shuttle
quiet ice
#

Okay, force-reloading spigot worked

#
Planned Removal of commons-lang
The API currently includes a very outdated copy of commons-lang. This API dependency is now deprecated and will be removed from the API and eventually the Server in a future release. Please consider switching to Google Guava (which is a supported bundled API) or using your own copy of the much more recent commons-lang3.

Okay, actually commons-codec should work

silver shuttle
#

buuuut why it dont

quiet ice
#

Just include & shade commons-codec instead. noone is preventing you from doing just that

silver shuttle
#

my ide is ._.

rough drift
#

great ide ._.

desert tinsel
#

How to create a listener like: "Player left-click to another player"?

#

without damage

vocal cloud
#

Allocate more ram to make ide = =D

viral crag
#

java.security.MessageDigest ...

quiet ice
grim ice
#

imagine having ur own website

#

i dont even know html lmfao

viral crag
rough drift
silver shuttle
quiet ice
rough drift
#

just listen to EntityDamageByEntityEvent and cancel it if both entities involved are players

desert tinsel
rough drift
desert tinsel
#

player are in god mode

quiet ice
#

SHA-512 is supported by java.security.MessageDigest

rough drift
#

then just EntityDamageByEntityEvent

#

it will still trigger

quiet ice
#

At least I think so

#
MessageDigest Algorithms
The algorithm names in this section can be specified when generating an instance of MessageDigest.

Algorithm Name
MD2
MD5
SHA-1
SHA-224
SHA-256
SHA-384
SHA-512
SHA-512/224
SHA-512/256
desert tinsel
#

player doesn't have invulnerability

rough drift
vocal cloud
rough drift
#

np

silver shuttle
#

uuuh just found out java commons message digest relies on java.security.messagedigest

viral crag
#

it would, it is a core language library

silver shuttle
#

I'll just use BCrypt

pearl ibex
#

Does anyone know how to detect a player right clicking with a certain item in their main hand?

tall dragon
#

PlayerInteractEvent

rough drift
#

^

silver shuttle
rough drift
#

well no

#

actually

#

PlayerInteractEvent
PlayerInteractAtEntityEvent
those are two different things

#

they don't run together

pearl ibex
#

import me.[MY NAME].customitems.items.itemManager;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;

public class teleportAbility implements Listener {

    @EventHandler
    public void click(PlayerInteractEvent event) {
        Player player = event.getPlayer();

        if (event.getAction() == Action.RIGHT_CLICK_AIR) {

            if (player.getInventory().getItemInMainHand().getItemMeta().getDisplayName() == "§6Teleport Stick") {

                player.sendMessage("Click");
            }
        }

        return;
    }
}```
#

i have that code at the minite but its not working

rough drift
#

don't use == on strings

#

use .equals

#

== doesn't work

#

also

rough drift
#

use PDC

tall dragon
#

dont use displayname

#

yea

rough drift
#

because player name can change

#

item*

tall dust
#

Can someone help? Why code no work?
Hello my code no work
Here's code

public final class fortniteinminecraft extends JavaPlugin {
    final boolean hasgun = true; //True if player has gun, false if player dont has have gun
    final int ammo = 77; //AMMO
    @Override
    public void onEnable() {
 if(hasgun) Player.SendMessage(Player.shoot()) //Shoot if player has gun and when click
    }

// shoot
    def shoot() {
      
      Bow bow; //get the weapon
      bow.shoot(forward); //shoot forward
      return "I shooted, Ammo: ammo - 1" //Tell player that shooted and remove one ammo and tell the player ammo.
    }

}
}

I use python more so i can don't know java good, but this must work because i know java because i have google

Error: I don't know what error means but i think it's cool

rough drift
#

so either you are a troll

tall dragon
#

def?

rough drift
#

or you are really, really dumb

rough drift
tall dust
#

def is function

#

me dumb?

tall dragon
#

not in java?

tall dust
#

Why

lost matrix
#

Pyva

rough drift
tall dragon
#

Pyva :D

tall dragon
#

i know

rough drift
#

we know

tall dragon
#

but ur writing ur code half python half java

tall dust
#

Oh

rough drift
#

and what is that..

tall dust
#

Is that why code dont work?

rough drift
#

this is just cursed code

rough drift
#

only thing you got right are strings lmao

#

wait nvm

#

true is the only thing you got right

#

also this is a troll

#

but its hilarious

#

so ill go with it

tall dust
#

Who is troll?

#

Im confusied

rough drift
#

yes

#

yes is troll

#

no is trollage

tall dust
#

What wrong with my age?

tall dust
#

But why dont code shoot?

#

My code is no work

rough drift
#

i either don't know if you're a troll

#

or if you're a kid

#

either way its fucking hilarious

#

this is better than the md_5 and wifispy's convo

dusk flicker
#

LOL THIS CONVO

tall dust
#

Im not kid

dusk flicker
#

bet

tall dust
#

Im huge brain human

halcyon marsh
#

Hello i have a problem for use NameTag edit

||```java

[ERROR] null
org.bukkit.command.CommandException: Cannot execute command 'ne' in plugin NametagEdit v4.5.0 - plugin is disabled.
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:37) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_18_R1.CraftServer.dispatchCommand(CraftServer.java:907) ~[paper-1.18.1.jar:git-Paper-207]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handleCommand(ServerGamePacketListenerImpl.java:2289) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2100) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2081) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundChatPacket.handle(ServerboundChatPacket.java:46) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundChatPacket.a(ServerboundChatPacket.java:6) ~[?:?]
at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:56) ~[?:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.18.1.jar:git-Paper-207]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:149) ~[?:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:23) ~[?:?]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1414) ~[paper-1.18.1.jar:git-Paper-207]
at net.minecraft.server.MinecraftServer.c(MinecraftServer.java:189) ~[paper-1.18.1.jar:git-Paper-207]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:122) ~[?:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1391) ~[paper-1.18.1.jar:git-Paper-207]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1384) ~[paper-1.18.1.jar:git-Paper-207]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:132) ~[?:?]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1362) ~[paper-1.18.1.jar:git-Paper-207]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1268) ~[paper-1.18.1.jar:git-Paper-207]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.18.1.jar:git-Paper-207]
at java.lang.Thread.run(Thread.java:833) ~[?:?]```||

rough drift
#

its really fun

dire salmon
#

also naming conventions

tall dust
dire salmon
#

^^^

halcyon marsh
rough drift
dire salmon
#

i have nothing to do ¯_(ツ)_/¯

grim ice
#

return urDiamondsToYou;

hexed hatch
#

If someone is telling you your code is bad, they're lying. They want you to fail

dire salmon
#

what is the enchantment for protection?

#

Enchantment.PROTECTION_ENVIROMENTAL?

tall dragon
#

yep

dire salmon
#

kk thanks

#

and for aquatic thing in helmet

#

WATER_WORKER?

hexed hatch
#

that's aqua affinity

dire salmon
#

ok

tall dust
dire salmon
#

i put AQUA and it didnt appear

hexed hatch
dire salmon
#

but yes, its water_worker

tall dust
#

Yes i do will

dire salmon
#

do you get any errors?

#

in console/IDE

tall dust
#

Yes but no

dire salmon
#

?

rough drift
#

its the holy grail of coding

#

just keep compiling

#

inteilli will realize

dire salmon
#

ye

hexed hatch
#

The absolute zenith of human achievement

dire salmon
#

the greatest conquest of humanity

rough drift
#

er meio de sto monno

(it means: "The best of this world", written in dialect, its not perfect tho)

hexed hatch
#

Getting code that is that perfect to run will be a test of perseverance

dire salmon
#

what is a good enchantment to put in custom chestplate?

#

that isnt protection or thorns

rough drift
#

please go to #general

hexed hatch
#

a custom enchantment that makes laser beams come out of your chest like a plasma ball and zaps everything that comes nearby

rough drift
#

stop the DRM things

tall dust
# tall dust Can someone help? Why code no work? Hello my code no work Here's code ```java pu...
public class FortnitePlayer {
    private final Player player;
    private final Gun gun;
    private final GameManager manager;

    private FortnitePlayer(Player player, Gun gun, GameManager manager) {
        this.player = player;
        this.gun = gun;
        this.manager = manager;
    }

    public Player getPlayer() {
        return player;
    }

    public Gun getGun() {
        return gun;
    }

    public int getAmmo() {
        return gun.getAmmo();
    }

    public void shootGun() {
        ShootResult result = gun.shoot();

        if(result.getKill() == null) return;

        final FortnitePlayer killedPlayer = result.getKill();

        player.sendTitle(
                "You killed",
                killedPlayer.getPlayer().getName(),
                20, 20*3, 20
        );

        gameManager.updateAdvancements(this);
    }
}


public final class FortniteInMinecraft extends JavaPlugin implements Listener {
    final ArrayList<FortnitePlayer> players = new ArrayList<>();
    final GameManager gameManager = new GameManager();

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

    @EventHandler
    public void onShoot(PlayerInteractEvent e) {
        if(e.getAction() != Action.RIGHT_CLICK_AIR) return;
        getFortnitePlayerByUUID(e.getPlayer().getUniqueId()).shootGun();
    }

    private FortnitePlayer getFortnitePlayerByUUID(final UUID uuid) {
        for (FortnitePlayer player : players) {
            if(player.getPlayer().getUniqueId().equals(uuid)) return player;
        }
        return null;
    }

    @EventHandler
    public void onJoin(PlayerJoinEvent e) {
        players.add(new FortnitePlayer(e.getPlayer(), new Gun(GunType.SHOTGUN, 12), gameManager));
    }
}

I made it! It works now. Tahnk, I've been saying all along that the old code looks like python, but you wouldn't believe it.

It way better then old code

tall dragon
tall dust
#

Yes but shoot no work 😢

tall dust
#

me dont understand

trail pilot
hexed hatch
#

no he's a fortnite gamer

tall dust
#

No

trail pilot
#

im so tired

tall dust
#

Im fortnite god

#

Not gaymer

hexed hatch
#

wow

#

I'm so proud of you

trail pilot
tall dust
trail pilot
tall dust
tall dust
trail pilot
tall dragon
# tall dust Im fortnite god

really?, are you one of those players that can replicate the entire empire state building within 5 seconds of hearing a few shots?

tall dust
#

No 2 of them

tall dragon
#

2 seconds?!

tall dust
#

No i have 2 dads

tall dragon
#

huh

hexed hatch
#

that's so progressive

tall dust
#

Im fortnite OG

trail pilot
#

gimme 1

#

cuz i dont have one lmao

hexed hatch
#

you should've thought about that before you decided to not have a dad

trail pilot
#

mine sucks af

#

lmao

hexed hatch
#

just get a new one then

tardy delta
#

lets take a nap lol

tall dust
#

We dont need parents

#

WE have ofrntite

hexed hatch
#

so true bestie

tardy delta
#

11:20pm hmm

trail pilot
#

pm

#

24*

#

breh

mighty bane
#

Okay so we're trying to stop a player from being able to mine any blocks however this code is not working:
@EventHandler
public void onBlockBreak(BlockBreakEvent blockBreakEvent) {
Player player = blockBreakEvent.getPlayer();
if(player != null) {
blockBreakEvent.setCancelled(true);
}
}

Does anyone know what we did wrong?

tall dragon
#

did you register it!

mighty bane
#

Oh...

#

how do you register again?

tall dragon
#

il take that as a no.

silver shuttle
#

lol

mighty bane
#

We forgot about registering

tall dragon
#

getServer().getPluginManager().registerEvents();

#

in main

#

takes ur plugin class & event class

dawn hazel
#

cant wait for this to blow up

mighty bane
dire salmon
#

is there a way to make lore appear before enchantments
without having to hide enchantments name and make a lore for them

hexed hatch
#

Nope

paper viper
#

i think its a client side thing

ivory sleet
#

yo pulse

paper viper
ivory sleet
#

hows life

paper viper
#

not too well

#

that jerk is still being a jerk

ivory sleet
#

ah pity...

paper viper
#

yeah

ivory sleet
#

wish u the best Star , tho have u touched any code recently? 😮

paper viper
#

Sorta

#

I mean i haven't touched my lib for like two weeks

#

but i do teach a java class still every sat

ivory sleet
#

ah thats nice

#

do u upload it on yt as well?

paper viper
#

nah

#

lol

ivory sleet
#

ah fair

lyric grove
#

what is the difference between loginevent and asyncloginevent?

ivory sleet
#

theres no asyncloginevent

lyric grove
ivory sleet
#

there's asyncplayerpreloginevent, playerpreloginevent (deprecated) and playerloginevent

tidal hollow
#

Does anyone know how to make it give you an effect when using a normal totem and not when using another custom?

ivory sleet
#

asyncplayerpreloginevent handles the listener callback which is non blocking and thats done when the connection gets initialized and everything

lyric grove
#

yeah what im asking is all the code in it run async?

ivory sleet
#

login is where the initialization is stabilized

#

so having that async would be practically useless

#

yes

lyric grove
#

thanks

ivory sleet
#

AsyncPlayerPreLoginEvent iirc gets called on a netty thread

#

or sth

mighty bane
#

Okay, another question. So we're trying to make it to where when the player left clicks, it summons a fireball of a random explosive power. However whenever we run the command, it says unknown command. Is this code not possible?

    public void onPlayerInteract(PlayerInteractEvent playerInteractEvent) {
        Player player = playerInteractEvent.getPlayer();
        if (playerInteractEvent.getAction().isLeftClick()) {
            int explosivePower = (int)Math.floor(Math.random() * 10) + 1;
            player.performCommand("/summon minecraft:fireball ~ ~ ~ {ExplosionPower:" + explosivePower + "}");
            player.sendMessage("/summon minecraft:fireball ~ ~ ~ {ExplosionPower:" + explosivePower + "}");
        }
    }```
minor fox
#

Is there a limit to how often you can use Player#setVelocity or how big the vector can be?

tall dragon
mighty bane
#

Yes we did.

tall dragon
#

ah well, worth a try

ivory sleet
tidal hollow
#

I have made a totem with lore and texture etc., and I want that when using a normal totem it gives you effects and when using the custom one it does not
I don't know if I explain myself

ivory sleet
#

idk about size limit

#

theoretically not

tall dragon
#

yes and?, read his message

ivory sleet
#

but practically you'll probably encounter weird bugs given a colossal magnitude for a vector

tall dragon
minor fox
mighty bane
tall dragon
# mighty bane What do you mean by that?
            Fireball fireball = (Fireball) world.spawnEntity(new Location(world, 0 ,0 ,0), EntityType.FIREBALL);
            fireball.setYield(/*your power*/);
            fireball.setVelocity(/*your velocity*/);
ivory sleet
minor fox
tall dragon
maiden thicket
#

and check if its a physical action

lost matrix
tender shard
#

does anyone know a some algorithm like base64? I just need to make a string non-human-readable and be able to easily reverse it to the original

#

doesn't need to be fast, doesn't need to be good, and size also doesn't matter

tender shard
#

nah base64 is too common

maiden thicket
#

base128

#

😎

tender shard
#

if people see the string they'll think "oh lets use base64 and check what it says" and that's what I need to avoid

lost matrix
minor fox
tender shard
#

thx I'll take a look at some of them

tender shard
#

md5 is not reversable

#

neither is sha1

#

no idea baout the others

lost matrix
tender shard
#

yeah that's probably the easiest solution lol

tidal hollow
tender shard
#

`pdc

#

?pdc

tender shard
#

PDC = "modern NBT"

dawn hazel
#

anyone know why its saying username cannot be null?
heres the database loading string

mongoDataStore = new MongoDataStore(config.getString("database.ip"), config.getInt("database.port"), config.getString("database.password"), config.getString("database.database"), config.getString("database.user"));```
and also that it isnt null in the config
lost matrix
#

?npe

#

npe when?

tender shard
#

"database.username" != "database.user"

dawn hazel
#

OH

#

me big dumdum

tender shard
#

yeah it's always things like "username"/"user", "pass"/"password" etc lol

dawn hazel
#

its always the smallest things u dont notice

tender shard
#

yep lol

dawn hazel
#

thats one thing i hate about coding you have to be really precise and exact with what your doing otherwise you arent going to get the results you desire

#

welp time to see if it explodes this time

tall dragon
#

imagine if you did not have to be precise

minor fox
#

Does anyone know what conditions will prevent a player from applying the velocity they're given through Player#setVelocity?

tall dragon
#

and the program just kinda guessed

dawn hazel
tall dragon
lost matrix
#

Thats why i threw away everything String based and just generate configs from classes.
This generates me like 200 lines of config

dawn hazel
#

you can

#

if your google

tall dragon
lost matrix
ivory sleet
#

Smile are you good at designing apis? I kinda have a small issue if you’re interested 😅

lost matrix
ivory sleet
#

Oh god

dawn hazel
#

cause to actually be able to tell a computer exactly what to do you need a metric fuck ton of code

lost matrix
ivory sleet
#

So yeah Idk if you’re familiar with recent prs, but one of them added comment support, however they just added new methods to the interface ConfigurationSection etc, you know I have been working on this JsonConfiguration pr, and problem is, I have no idea how to deal with the comment contract such as ConfigurationSection::getComments. Do I just throw UnsupportedOperationException or what’s your thoughts?

minor fox
dawn hazel
#

thats fun. just fun

lost matrix
lost matrix
ivory sleet
#

Yeah I thought of having another interface, but wouldn’t that break existing api?

#

As I’d assume many devs use for instance
ConfigSection sec = plugin.getConfig();
sec.getComments();

[relying directly on ConfigurationSection]

mighty bane
#

We are just at a lost as to what is happening...

lost matrix
ivory sleet
#

Yeah

#

It’s somewhat intricate

lost matrix
#

Ah i see... ConfigSection is already the yml implementation

ivory sleet
#

Myeah

#

A bit of a poor design for other conceivable config format additions

lost matrix
#

I mean... You could still write an AbstractConfigurationSection and let ConfigSection extend that
while having an additional JsonConfigSection...

dawn hazel
unreal quartz
#

In ur code

dawn hazel
#

ok maybe too broad of a question

#

this is what actually saves the thing

lost matrix
ivory sleet
#

Holy shit

#

Genius

#

Thanks for enlightening me

#

🙏

tall dragon
lost matrix
jovial lotus
#

Hello !
I'm holding a future mini-game server.
I have several game servers joinable, when a player clicks a special Item in the game menu, I want to loop through all game servers and get the name of the first that is not full (because a game is 16 players maximum) to tp the player in
My issue is, I don't know how to get the online players size in a server, I've searched on Internet but I didn't find anything

quaint mantle
ivory sleet
#

Collection<? extends Player>

jovial lotus
quaint mantle
#
 @EventHandler
    public void onPlayerSleep(PlayerDeepSleepEvent event){
        Server server = getServer();
        server.broadcast(new TextComponent(event.getPlayer().getName()+" is sleeping"));
    }```

hey so im trying to send a message to all players when someone sleeps using a custom plugin however nothing happens, does anyone know why?
ivory sleet
#

Did you register the listener

ivory sleet
quaint mantle
ivory sleet
#

?event-api

undone axleBOT
quaint mantle
#

or not

#

Also I NEVER KNEW THERE WAS SOMETHING CALLED A DEEP SLEEP

vague swallow
#

lmao

quaint mantle
#

this

tidal hollow
#

How can I make using a totem give you an effect? I have this code and they tell me that it doesn't work because the totem you are looking for is no longer in the inventory xD, and I have thought of other ways but I can't think of anything

Someone help me?

@EventHandler
   public void totemMessage(EntityResurrectEvent event) {
       if (event.getEntity() instanceof Player) {
           Player player = (Player) event.getEntity();
           if (player.getInventory().getItemInMainHand().getType() == Material.TOTEM_OF_UNDYING || player.getInventory().getItemInOffHand().getType() == Material.TOTEM_OF_UNDYING) {
               for (Player all : Bukkit.getOnlinePlayers()) {
                   all.sendMessage(ChatColor.GRAY + "¡El Jugador " + ChatColor.DARK_PURPLE + "" + ChatColor.BOLD + player.getName() + ChatColor.GRAY + " ha consumido un tótem!. Causa: " + player.getLastDamageCause().getCause());
p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 6000, 1));
pulsar zenith
#

Correct me if im wrong, but doesn't the event only get called when the entity has a totem?

#

there is no other way to resurrect an entity

tender shard
#

it'll be cancelled if the entitiy didnt have a totem though

young knoll
#

It’ll be cancelled if they don’t have a totem

pulsar zenith
#

Ahhhh ok

#

Makes sense ty

minor fox
# minor fox bump

A PlayerVelocityEvent tells me the first interact event applies a different velocity than what is seen in the code. The second event works perfectly fine. Any ideas why?

    public void onPlayerInteract(PlayerInteractEvent event) {
        if(event.getAction() == Action.PHYSICAL) {
            Player player = event.getPlayer();
            event.getPlayer().setVelocity(event.getPlayer().getLocation().getDirection().setY(2));
        }
    }

    @EventHandler
    public void onPlayerInteracat(PlayerInteractEvent event) {
        if(event.getAction() == Action.LEFT_CLICK_AIR)
            event.getPlayer().setVelocity(event.getPlayer().getLocation().getDirection().setY(2));
    }```
hexed hatch
minor fox
#

I would assume so

young knoll
#

Yep

#

And when they hit a pressure plate

quaint mantle
fickle frost
#

If you’re using text components, you’ll probably want to use a componentbuilder and use their stylize methods.

#

Or do this, which, if I recall, requires a string, not a text component.

#

Which would mean you can use chatcolor codes.

quaint mantle
#

ChatColor is doing nothing

fickle frost
#

It definitely won’t do anything if you’re using it in a text component. Hence the stylize methods.

quaint mantle
#

ahh ok

#
server.sendMessage(new ComponentBuilder("test").color((ChatColor.AQUA)));
``` what part of this is wrong?
young knoll
#

You need to call .create() at the end iirc

#

Also you need to make sure you are using the method that accepts components

quaint mantle
#

create isnt showing up as a object.

young knoll
#

Might be build

#

There’s some method to convert the builder into a component[]

quaint mantle
#

also im getting ComponentBuilder is abstract; cannot be instantiated error.

eternal oxide
#

delete new keyword

echo basalt
#

Hey, does anyone know how I can force a villager to move to a certain location?

#

I tried both the navigator method and also removing pathfinders

unkempt peak
patent horizon
#

how can i run gradle shadowjar on intellij through the run button

echo basalt
echo basalt
patent horizon
#

yes

unkempt peak
echo basalt
echo basalt
patent horizon
#

where did u get to that

echo basalt
vernal pier
#

array = new int[1000] or Arrays.fill(array, 0)

vocal cloud
subtle pewter
#

I could set the proxy instance you my own class that extends ProxyServer right?

#

Ping with answer

quaint mantle
#

umm hi
can a zombie do the animations of the player?

hexed hatch
#

Nope

#

They can do the animations of a zombie though

quaint mantle
#

can a giant do the animation of a zombie?

hexed hatch
#

I believe so

#

I’m not certain, but I think they can

quaint mantle
#

can you please show the sample code
also can you send the link of the docs of animations of entities

#

the sample code for entity doing some animation

vast shale
#

I'm trying to put an org.bukkit.Location into a SortedMap but I'm getting

Caused by: java.lang.ClassCastException: class org.bukkit.Location cannot be cast to class java.lang.Comparable (org.bukkit.Location is in unnamed module of loader 'app'; java.lang.Comparable is in module java.base of loader 'bootstrap')
hexed hatch
#

Entity animations aren’t covered by the api as far as I know

#

You’ll have to use packets I believe

vernal pier
#

why are u using a sorted map

vocal cloud
#

Can't even see the code so can't even help

vast shale
#

So they remain in a specific order

vernal pier
#

you can use linkedhashmap to maintain the insertion order

granite burrow
#

How can I set a block to vine, and have it only on one side of the block?

#

Example (example used glow lichen):

I have it so I can set it like show in the image below, but I want to set it like the rest of the wall

delicate lynx
#

I believe there is a method to set which way vines face

#

nvm it's deprecated

fickle frost
young knoll
#

It’ll be using block data

#

I don’t remember what the data for vines is

#

MultipleFacing? Maybe

granite burrow
young knoll
#

You gotta get the block data

granite burrow
#

welp, I feel dumb for that one, time to investigate further into faces

#

okay, I can place it on a custom face, time to try to figure out how I can get the face that the player clicks

carmine nacelle
#

I'm going back to my code from like 6 months ago and trying to update it, I was using ProtocolLib for holograms and the following used to work but now it's erroring:

//metadata.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(0, WrappedDataWatcher.Registry.get(Byte.class)), 32);
metadata.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(2, WrappedDataWatcher.Registry.getChatComponentSerializer(true)), opt);
metadata.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(3, WrappedDataWatcher.Registry.get(Boolean.class)), true);
//metadata.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(15, WrappedDataWatcher.Registry.get(Byte.class)), 25);
packet.getWatchableCollectionModifier().write(0, metadata.getWatchableObjects());
packet.getIntegers().write(0, hologram.getHoloIDs().get(curHoloLine));

I completely forgot what these are and how they work, I don't even see documentation on them..anyone care to lend a hand?

Error: Internal Exception: io.netty.handler.codec.EncoderException: java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.Byte (java.lang.Integer and java.lang.Byte are in module java.base of loader 'bootstrap')

Specifically it's the commented out ones that are giving that error

hexed hatch
#

I thought you were dead

carmine nacelle
#

YOOO GIZ

#

NO WAY

hexed hatch
#

Hey baby girl

carmine nacelle
#

have u passed me in dev yet

hexed hatch
#

Is this from the project we were working on back in the day?

carmine nacelle
#

nah

#

completely different

hexed hatch
carmine nacelle
#

nice nice

fickle frost
#

Ah, young love.

hexed hatch
#

But I also haven’t really done jack shit in the last year or so

carmine nacelle
#

same kinda

fickle frost
#

Or perhaps cast the numerical parameters to bytes.

#

Whichever avoids an incorrect class cast.

carmine nacelle
#

I mean that made the error go away but its still not working

#

i also lost all these files during my windows 11 upgrade so this is all from a decompiled jar, which did a good job of decompiling into source code but

#

some things are slightly changed

granite burrow
#

Whats the best way to figure out what direction a vine is facing? It seems that the whole vine item type has been depreciated in 1.17

fickle frost
#

Decompilers tend to erase necessary casting, so probably cast the numerical params to bytes rather than changing the class to integer.

#

Hopefully it's just the decompiler's fault and not ProtocolLib changing.

#

@granite burrow get the block data, cast it to whichever interface handles directional block data, and you should be able to get the direction from that.

#

What do you know, it's just called Directional.

granite burrow
#

thanks ill look into it more thanks for the push 😄

fickle frost
#

Not a problem. Good luck.

carmine nacelle
#
metadata.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(0, WrappedDataWatcher.Registry.get((Class)Byte.class)), (Object)32);
#

This is what the decompiler gave me

hexed hatch
#

God that is so gross

carmine nacelle
#

packets are gross

fickle frost
#

Gross.

carmine nacelle
#

im probably just stupid

fickle frost
#

There's the most relevant documentation for it.

carmine nacelle
#

god I suck at reading docs

#

😭

#

especially this one

fickle frost
#

These docs aren't really helpful to be fair.

carmine nacelle
#

Idk where to even start on here like what am I even looking for

#

and why wont it let me cast to byte?

hexed hatch
#

Are these for static holograms in the world?

carmine nacelle
#

nah

#

dynamic

hexed hatch
#

Ah

carmine nacelle
#

but they do save/load

#

and are interactable.

hexed hatch
#

I was going to recommend conceding and using holographic displays

carmine nacelle
#

worked perfectly fine before

fickle frost
#

You've cast 32 to an object, which means it's being autoboxed, so get rid of that cast.

carmine nacelle
#

metadata.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(0, WrappedDataWatcher.Registry.get(Byte.class)), 32);

#

Yeah that's my current

#

I removed the casts from the decompiler

hexed hatch
carmine nacelle
#

I wish I had my original src man

fickle frost
#

And casting 32 to (byte) doesn't fix it I take it.

carmine nacelle
#

Won't let me

fickle frost
#

Lowercase the b.

carmine nacelle
#

...bruh.

fickle frost
#

Rookie mistake.

carmine nacelle
#

sadge

fickle frost
#

Figures crossed that's all it was.

carmine nacelle
#

it was

#

😄

fickle frost
#

Congratulations on your holograms.

carmine nacelle
#

something so simple man

#

thanks lol

hexed hatch
carmine nacelle
#

its just on my local test

#

which isnt PF'd

hexed hatch
#

Boring

fickle frost
young knoll
#

Idk about really powerful

#

But it’s pretty decent

fickle frost
#

^ In the context of "free" though.

young knoll
#

True

#

It can probably handle 10-20 players

hexed hatch
#

Wow

#

That’s tempting

maiden path
#

I'm having trouble with BuildTools version 1.8.8 can anyone help please?

#

It doesn't matter if it's paid or free, but version 1.8.8 is a must for me.

brave sparrow
#

?help

undone axleBOT
#
CafeBabe Help Menu
*Red V3*
**__Admin:__**

selfrole Add or remove a selfrole from yourself.

**__Cleanup:__**

cleanup Base command for deleting messages.

**__Core:__**

embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.

**__Downloader:__**

findcog Find which cog a command comes from.

**__Mod:__**

names Show previous names and nicknames of a member.
userinfo Show information about a member.

**__ModLog:__**

listcases List cases for the specified member.
reason Specify a reason for a modlog case.

**__Permissions:__**

permissions Command permission management tools.

brave sparrow
#

?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!

brave sparrow
#

@maiden path

maiden path
#
Applying CraftBukkit Patches
Backing up NMS dir
Patching BiomeTheEndDecorator.java
Patching Block.java
Exception in thread "main" java.lang.RuntimeException: Error patching Block.java
        at org.spigotmc.builder.Builder.lambda$main$2(Builder.java:644)
        at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)
        at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source)
        at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
        at java.util.Iterator.forEachRemaining(Unknown Source)
        at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
        at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
        at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source)
        at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source)
        at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
        at java.util.stream.ReferencePipeline.forEach(Unknown Source)
        at org.spigotmc.builder.Builder.main(Builder.java:595)
        at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)
Caused by: difflib.PatchFailedException: Incorrect Chunk: the chunk content doesn't match the target
        at difflib.Chunk.verify(Chunk.java:86)
        at difflib.ChangeDelta.verify(ChangeDelta.java:78)
        at difflib.ChangeDelta.applyTo(ChangeDelta.java:44)
        at difflib.Patch.applyTo(Patch.java:43)
        at difflib.DiffUtils.patch(DiffUtils.java:70)
        at org.spigotmc.builder.Builder.lambda$main$2(Builder.java:632)
        ... 13 more

#

i really need help with this

brave sparrow
#

Huh

#

Never seen that before

#

Have you tried wiping the folder and starting from scratch?

maiden path
#

yes

#

I really don't understand why it gives an error, I couldn't figure it out

brave sparrow
#

Well it looks like something is screwy with the patch

#

But idk how that could be

brave sparrow
#

Try wiping anything minecraft or spigot related from your .m2, resetting the build tools dir, and starting again

sharp flare
last tulip
#
    @EventHandler
    public void PlayerRespawnEvent (PlayerRespawnEvent event) {
        Player player = event.getPlayer();
        for (Player pl : Bukkit.getOnlinePlayers()) {
            if (pl.getWorld().getName().equals("world")) {
                player.sendMessage(ChatColor.RED + "You Died...");
                player.getInventory().addItem(new ItemStack(Material.DIAMOND));
            }
        }
    }

i want give item when player respawn (after died), but this code not working

waxen plinth
#

Why are you iterating over every player

#

And why are you checking if their world's name is "world"

#

You could just...

#
for (Player p : Bukkit.getWorld("world").getPlayers()) {
  ...
}```
#

But I still do wanna know why you're looping over all players to begin with

last tulip
#
 @EventHandler
    public void PlayerDeathEvent(PlayerRespawnEvent event) {
        Player player = event.getPlayer();
        for (Player pl : Bukkit.getWorld("world").getPlayers()) {
                player.sendMessage(ChatColor.RED + "You Died...");
                player.getInventory().addItem(new ItemStack(Material.DIAMOND));

        }
    }```
#

still not work it works!

granite burrow
#

Alright, so ive been working on trying to get where a vine is facing, however the only way I was able to get this information was through the deperciated Vine material. I tried to instance directional but it doesn't seem to comply with that either any ideas?

Im on 1.17 API

tidal skiff
#

how do i set the colour of a particle

earnest forum
#

only some particles can be coloured

tidal skiff
#

is the redstone particle one of them?

earnest forum
#

yes

tidal skiff
#

well it doesnt seem to want to

earnest forum
#

i had an example in one of my plugins

#

give me a bit

tidal skiff
#

alr

earnest forum
#

can u send ur code

#

@tidal skiff

tidal skiff
#

p.spawnParticle(Particle.SPELL, newLoc.getX(), newLoc.getY(), newLoc.getZ(), 0, 0.4, 0, 0, 1);

#

i tried spell too

#

cuz redstone wasnt working

earnest forum
#

ur particle amount is 0?

#

the first number is the particle amount

tidal skiff
#

the wiki said it has to be -

earnest forum
#

how much u wanna spawn

tidal skiff
#

0

earnest forum
#
p.spawnParticle(Particle.REDSTONE, location, am,0,-5,0,dust);
young knoll
#

The new method allows you to pass a Color as the last param

#

Iirc

earnest forum
#

this is my code

#

am is the amount

#

"dust" is a DustOptions class

tidal skiff
#

ill try with 1

earnest forum
#
dust = new DustOptions(Color.RED, 1.0F);
tidal skiff
#

still doesnt work

earnest forum
#

if u wanna use redstone

#

just use this

earnest forum
#

just a single number is a colour?

young knoll
#

Didn’t know you needed a float too

earnest forum
#

float is the alpha i think

#

im not 100%

young knoll
#

Probably

dawn hazel
#

fun fact

#

if you dont organize your classes by their purpose

#

youll likely piss off a lot of java devs

tardy flame
#

You will for sure

noble lantern
#

time to start organizing alphabetically

quaint mantle
#

hello how can I get which cardinal direction is a player looking?

tidal skiff
#

anyone know how to align the particle with the players head

#

actually i think i know how

fickle frost
#

+1 on the y axis.

tidal skiff
#

shouldnt it be 1.6

opal juniper
tidal skiff
#
    @Override
    public void run() {

        for(PortalData i : PortalGunEvents.datas.values()){

            i.getPlayer().getWorld().spawnParticle(Particle.REDSTONE, i.getBlue(), 3, 0, 0, 0, 0, new Particle.DustOptions(Color.BLUE, 10f));
            i.getPlayer().sendMessage("this line has been run");

        }

    }
#

can anyone tell me why this code can do literally anything except spawn particles

#

the "this line has been run" line runs just fine

#

the particles from when you do the thing in the first place show just fine

#

im stumped

earnest forum
#

why is there 5 numbers

tidal skiff
#

on the particle bit?

earnest forum
#

the 3 xyz values are not colour

tidal skiff
#

idk but it seems to work just fine

earnest forum
#

for redstone

tidal skiff
#

for the other one

earnest forum
#

only for spwell

#

spell

#

redstone is just regular particle

#

look at my old

#

msg

tidal skiff
#

its nothing to do with the particle line itself

#

its the same line as when u use the rod

#

actually maybe it is

#

let me see

earnest forum
#

ur not giving it a location bro

tidal skiff
#

mope its not

#

i.getBlue() is a location in my constructor

earnest forum
#

(particle, location, am, offsetx,y,z, dust)

#

ah

#

ok

#

and an amouint**

tidal skiff
#

yea

#

3

#

oh

earnest forum
#

u put an extra 0

tidal skiff
#

i figured it out

earnest forum
#

and also the max is 1f

#

for the dustoptions

#

its 0-1

tidal skiff
#

its putting the particle at the last possible place the location can be

#

i gotta fix that

earnest forum
#

when u got a problem u have to test every part of it

#

the location n shit

chrome beacon
#

You can always look at how the command works

tidal skiff
#

how do i check the distance between 2 locations

idle kindle
#

how to put a fully filled cauldron with water

quasi flint
#

Basic algebra

#

The location class has a distance func

#

Although it's pretty slow

quaint mantle
#

Hi I am facing an issue, I want the cardinal direction that the player is facing but it is not working
I think there is a problem in this code and it isnt working as intended. can someone help me

        int degrees = (Math.round(player.getLocation().getYaw()) + 270) % 360;
        if (degrees <= 22) return "North";
        if (degrees <= 67) return "Northeast";
        if (degrees <= 112) return "East";
        if (degrees <= 157) return "Southeast";
        if (degrees <= 202) return "South";
        if (degrees <= 247) return "Southwest";
        if (degrees <= 292) return "West";
        if (degrees <= 337) return "Northwest";
        if (degrees <= 359) return "North";
        return null;
    }```
and then
```direction=getDirection(player);
player.sendMessage(direction);```
#

I am facing east but the direction detected is south

rough drift
torn vale
#

Hello 👋

rough drift
#

:D

#

hi

torn vale
#

    private final HashMap<Player, Boolean> cooldown = new HashMap<>();

    @EventHandler
    public void onJoin(PlayerJoinEvent event) {
        event.getPlayer().setAllowFlight(true);
        cooldown.put(event.getPlayer(), false);
    }

    @EventHandler
    public void onFly(PlayerToggleFlightEvent event) {
        Player player = event.getPlayer();
        if (event.getPlayer().getGameMode() == GameMode.SURVIVAL || event.getPlayer().getGameMode() == GameMode.ADVENTURE) {
            event.setCancelled(true);
            if (cooldown.get(event.getPlayer())) return;
            event.getPlayer().setVelocity(event.getPlayer().getLocation().getDirection().setY(1));
            player.playSound(player.getLocation(), Sound.WITHER_SHOOT,1.0f, 1.0f);
            cooldown.put(event.getPlayer(), true);
        }
    }

    @EventHandler
    public void onMove(PlayerMoveEvent event) {
        Player player = event.getPlayer();
        Location location = player.getLocation().clone();
        if (cooldown.containsKey(player)) {
            if (location.add(0, -0.1, 0).getBlock().getType().isSolid()) {
                cooldown.put(player, false);
            }
        }
    }

    @EventHandler
    public void onGamemodeChange(PlayerGameModeChangeEvent event) {
        if (event.getNewGameMode() == GameMode.SURVIVAL || event.getNewGameMode() == GameMode.ADVENTURE) {
            event.getPlayer().setAllowFlight(true);
        }
    }```
I have wrote this code for a doublejump function
#

but I have a problem: If I keep spamming my space key the player will just do a little jump in the air (like a 0.1 block jump)

#

so smth with the cooldown ist wrong, could some1 help me?

rough drift
#

i don't think its the cooldown

#

its the fact that you are going in and out of flight

torn vale
#

so its smth with the PlayerToggleFlightEvent?

rough drift
#

yeah

#

try removing their Y vel a bit when there is a cooldown

torn vale
#

so I have to reduce setY()?

rough drift
#

nope

#

if (cooldown.get(event.getPlayer())) return; you see that line?

#

make it into

#
if (cooldown.get(event.getPlayer())) {
  event.getPlayer().getLocation().setY(event.getPlayer().getLocation().getY() - .1);
  return;
}
#

try that

torn vale
#

oh

rough drift
#

also i suggest you use your player object

#

rather than event.getPlayer

#

as you already have that

torn vale
#

okay 👍
1min :)

rough drift
#
Player player = event.getPlayer();
        if (player.getGameMode() == GameMode.SURVIVAL || player.getGameMode() == GameMode.ADVENTURE) {
            event.setCancelled(true);
            if (cooldown.get(player)) return;
            player.setVelocity(player.getLocation().getDirection().setY(1));
            player.playSound(player.getLocation(), Sound.WITHER_SHOOT,1.0f, 1.0f);
            cooldown.put(player, true);
        }
```that's a bit better
torn vale
#

umm

#

now I can fly like i am in gamemode 1

#

but I am in gamemode 0

#
    @EventHandler
    public void onFly(PlayerToggleFlightEvent event) {
        Player player = event.getPlayer();
        if (cooldown.get(player)) {
            player.getLocation().setY(event.getPlayer().getLocation().getY() - .1);
            return;
        }
        if (player.getGameMode() == GameMode.SURVIVAL || player.getGameMode() == GameMode.ADVENTURE) {
            event.setCancelled(true);
            if (cooldown.get(player)) return;
            player.setVelocity(player.getLocation().getDirection().setY(1));
            player.playSound(player.getLocation(), Sound.WITHER_SHOOT,1.0f, 1.0f);
            cooldown.put(player, true);
        }
    }```
currently thats my event
rough drift
#

no no no

torn vale
#

whats wrong? :o

rough drift
#

you have to replace the if statement the arrow is pointing at with that

torn vale
#

oh

#

my fault, sry

rough drift
#

np

torn vale
#

okay, now I can doublejump again but I can still "hover" when I keep spamming the spacebar

rough drift
#

show me what you did

torn vale
#
public class DoubleJump implements Listener {

    private final HashMap<Player, Boolean> cooldown = new HashMap<>();

    @EventHandler
    public void onJoin(PlayerJoinEvent event) {
        event.getPlayer().setAllowFlight(true);
        cooldown.put(event.getPlayer(), false);
    }

    @EventHandler
    public void onFly(PlayerToggleFlightEvent event) {
        Player player = event.getPlayer();

        if (player.getGameMode() == GameMode.SURVIVAL || player.getGameMode() == GameMode.ADVENTURE) {
            event.setCancelled(true);
            if (cooldown.get(player)) {
                player.getLocation().setY(event.getPlayer().getLocation().getY() - .1);
                return;
            }
            player.setVelocity(player.getLocation().getDirection().setY(1));
            player.playSound(player.getLocation(), Sound.WITHER_SHOOT,1.0f, 1.0f);
            cooldown.put(player, true);
        }
    }

    @EventHandler
    public void onMove(PlayerMoveEvent event) {
        Player player = event.getPlayer();
        Location location = player.getLocation().clone();
        if (cooldown.containsKey(player)) {
            if (location.add(0, -0.1, 0).getBlock().getType().isSolid()) {
                cooldown.put(player, false);
            }
        }
    }

    @EventHandler
    public void onGamemodeChange(PlayerGameModeChangeEvent event) {
        if (event.getNewGameMode() == GameMode.SURVIVAL || event.getNewGameMode() == GameMode.ADVENTURE) {
            event.getPlayer().setAllowFlight(true);
        }
    }
}
rough drift
#

mhm that's correct

torn vale
#

could my sever version be the problem? I am using 1.8.8 lol

rough drift
#

try increasing the amount you subtract by?

torn vale
rough drift
#

nice

#

try increasing it a bit more if you want

torn vale
rough drift
#

sadge

torn vale
#

yeah

#

I had this problem like 6 months ago but back then my Java knowledge was very bad

#

now I tried to fix it but no xd

#

the weird thing is: Back then the exact same code worked just fine for other people

#

maybe there is smth wrong with my build?

crimson terrace
#

what does it mean when an entity is marked for removal?

vague swallow
#

How can I get the UUID of an offline Player?

crimson terrace
#

maybe this?

vague swallow
#

well

#

I have the name of a player

#

but I need to get the UUID of the player

#

even if he is offline

crimson terrace
#

you know how to stream an array?

vague swallow
#

no

crimson terrace
ivory sleet
#

OfflinePlayer::getUniqueId is guaranteed to work

#

however OfflinePlayer::getName can still return null

vague swallow
#

thanks you 2, I'll try it

viral temple
#

Can Bukkit.getLogger() be used instead of Plugin.getLogger() or I have to adapt my static methods to Plugin.getLogger()? 🤔

tender shard
torn badge
torn badge
#

Double Jump?

torn vale
#

yes

torn badge
#

That’s a bad approach

#

Just use Player#setVelocity

#

But the problem in your code is in the MoveEvent

lost matrix
#

HashMap<Player, Boolean> should just be a HashSet<UUID>
Map<T, Boolean> rarely makes sense as its already a binary state: present or not

torn vale
#
public class DoubleJump implements Listener {

    private final HashSet<UUID> cooldown = new HashSet<>();

    @EventHandler
    public void onJoin(PlayerJoinEvent event) {
        event.getPlayer().setAllowFlight(true);
        cooldown.add(event.getPlayer().getUniqueId());
    }

    @EventHandler
    public void onFly(PlayerToggleFlightEvent event) {
        Player player = event.getPlayer();

        if (player.getGameMode() == GameMode.SURVIVAL || player.getGameMode() == GameMode.ADVENTURE) {
            event.setCancelled(true);
            if (cooldown.contains(player.getUniqueId())) {
                player.getLocation().setY(event.getPlayer().getLocation().getY() - .1);
                return;
            }
            player.setVelocity(player.getLocation().getDirection().setY(1));
            player.playSound(player.getLocation(), Sound.WITHER_SHOOT,1.0f, 1.0f);
            cooldown.add(player.getUniqueId());
        }
    }

    @EventHandler
    public void onMove(PlayerMoveEvent event) {
        Player player = event.getPlayer();
        Location location = player.getLocation().clone();
        if (cooldown.contains(player.getUniqueId())) {
            if (location.add(0, -0.5, 0).getBlock().getType().isSolid()) {
                cooldown.remove(player.getUniqueId());
            }
        }
    }

    @EventHandler
    public void onGamemodeChange(PlayerGameModeChangeEvent event) {
        if (event.getNewGameMode() == GameMode.SURVIVAL || event.getNewGameMode() == GameMode.ADVENTURE) {
            event.getPlayer().setAllowFlight(true);
        }
    }
}```
Still the same
tender shard
#

shit wrong reply

#

I hate discord replies

#

@torn vale what exactly is your question?

torn vale
#

I have wrote this doublejumo code (as you can see)

#

but if I keep spamming my spacebar I hove through the air

#

like I jump up 0.1 Blocks per jump when im in the air

#

yk?

tender shard
#

yeah that makes sense, since you only remove the player from the map/list if the block 0.5 below them is solid

torn vale
#

what should I do instaed?

tender shard
#

tbh I don't think you can properly allow double jump at all

tender shard
# torn vale so what?

as said, in my opinion you'll have to think of this idea like "kannste net machen, weil... det geht einfach net" :/

torn vale
#

hmm okay

tender shard
#

at least you can't do it properly since the client simply doesn't send a "player pressed space" packet

#

abusing the fly mode for this will probably lead to many more problems that you can't fix

#

the ONLY thing I could think of is making users require other keys like Q ( drop key ) to double jump

#

because you can actually listen to that key being pressed

#

but you can't do so for space being pressed mid-air

torn vale
#

okay, tyvm

tender shard
#

I might be wrong, of course

#

maybe it is indeed possible without problems, but I doubt it

torn vale
#

👍

tender shard
#

if you indeed find another way, pls ping me, I'd love to know too 🙂

torn vale
#

Okay :)

fading lake
#

whats the current issue? is the force just not great enough?

torn vale
fading lake
#

what do you mean by 'hovering'

#

flight doesnt disable?

torn vale
#

its kinda difficult to explain

torn vale
fading lake
#

so the flight doesnt disable?

#

im struggling to understand what you mean

torn vale
#

are you able to join my server? There I can show it to you, its kinda difficult to explain it

fading lake
#

not currently, could you record it and send it to me?

torn vale
#

I will try, 1sec

#

as you can see I hover down slowly when spamming my spacebar

fading lake
#

that looks more like your cooldown script if anything

#

yeah you do something when the player is on cooldown in the flight event

#

whats that supposed to do

torn vale
#

some1 here told me to add this to my code, idk tbh

fading lake
#

do you want to be able to hover like that or is it just a double jump?

torn vale
#

just a double jump

#

I want to get rid of the hover thing

fading lake
#

replace your event with this and see if it changes anything

@EventHandler
public void onFly(PlayerToggleFlightEvent event) {
    Player player = event.getPlayer();

    if (player.getGameMode() == GameMode.SURVIVAL || player.getGameMode() == GameMode.ADVENTURE) {
        event.setCancelled(true);
        if (cooldown.contains(player.getUniqueId())) {
        //    player.getLocation().setY(event.getPlayer().getLocation().getY() - .1);
            return;
        }
        player.setVelocity(player.getLocation().getDirection().setY(1));
        player.playSound(player.getLocation(), Sound.WITHER_SHOOT,1.0f, 1.0f);
        cooldown.add(player.getUniqueId());
    }
}
#

(i.e just commenting out that part that does the other velocity thing)

torn vale
fading lake
#

OH, no hang on

#

there

#

just comment out the other velocity not the entire thing

#

im half asleep clearly

#

see if that fixes anything

torn vale
#

I am still able to hover and sometimes I can do a second double jump in the air

fading lake
#

hovering in the same way?

torn vale
#

It feels like I have a bigger cooldown between my hover jumps now but I am not sure

fading lake
#

is it still doing it the same way though?

#

like

#

the red squares are jumps

#

it was adding a smaller velocity that was still allowing you to jump midair on cooldown

#

which would mean the big initial wouldnt happen again because it was returning

torn vale
#

yes

fading lake
#

so now its only returning

#

its doing exactly the same thing?

torn vale
#

yes but now sometimes (like every 3-4 double jumps from the ground) the initial happens two times

fading lake
torn vale
#

yes

lost matrix
#

Also test with something other than a pressure plate too.

round elbow
#
    @SneakyThrows
    public void writeData(DataModule dataModule) {
        Gson builder = new GsonBuilder().setPrettyPrinting().serializeNulls().create();
        FileWriter writer = new FileWriter(configFile);
        writer.write(builder.toJson(dataModule.getPlayerHomes())); // this is line 26
        writer.close();
    }

&

public class DataModule {
    private HashMap<UUID, List<HomeModule>> playerHomes = new HashMap<>();

    public HashMap<UUID, List<HomeModule>> getPlayerHomes() {
        return playerHomes;
    }

this happens
at com.google.gson.Gson.toJson(Gson.java:618) ~[gson-2.8.8.jar:?]
at me.rephrasing.sethomes.config.ConfigManager.writeData(ConfigManager.java:26) ~[sethomes-1.0-SNAPSHOT.jar:?]
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private java.lang.Object java.lang.ref.Reference.referent accessible: module java.base does not "opens java.lang.ref" to unnamed module @2006863f

#

using java 16

fading lake
# torn vale yes

I want to say the way you're calculating when the cooldown finishes is the problem (your way of seeing if a player has hit the ground)

chrome beacon
#

SneakyThrows 👀

fading lake
#

could you put a print when the cooldown is removed so you know when its actually being removed vs when we think its being removed

fading lake
#

im too tired to remember if air is considered solid, I know there is a stupid item that is solid cant remember which

#

just under that remove yeah

lost matrix
fading lake
#

also you do know that Location#subtract is a thing?

minor fox
round elbow
# lost matrix Show your HomeModule class

@Getter
@Setter
public class HomeModule {

    private String name;
    private Location location;

    HomeModule(String name, Location location) {
        this.name = name;
        this.location = location;
    }
}
#

is it the location part

lost matrix
torn vale
#

it prints when I hit the ground

fading lake
#

and if you keep jumping and doing the floaty thing, it doesnt fire at all then?

torn vale
#

yes

round elbow
fading lake
#

yes it does or no it doesnt?

round elbow
#

and a method thats vice versa