#help-development

1 messages · Page 2090 of 1

lavish hemlock
#

Result is kind of like exceptions

#

but not really

grim ice
#

u cant handle errors in java too

#

so theyre similar s well

lavish hemlock
#

okay yes but error-handling is a more generic term than exception-handling, Rust doesn't fucking have exception-handling because it doesn't have exceptions, therefore I use the term error-handling to describe the action of HANDLING ERROR STATES.

grim ice
#

ic

lavish hemlock
#

and TECHNICALLY

grim ice
#

but even as a generic term

lavish hemlock
#

Java allows you to handle errors

grim ice
#

u dont handle errors

#

errors crash ur program

lavish hemlock
#

if you're referring to Error at least

grim ice
#

not recoverable

lavish hemlock
#

bc they're still able to be caught

grim ice
#

ah yes

lavish hemlock
#

(you're just not supposed to)

grim ice
#

catch outofmemoryerror

lavish hemlock
#

Minecraft used to do that

#

actually maybe it still does

#

idk

grim ice
#

Lmao

lavish hemlock
#

Going back to the original thing:

Error handling refers to the response and recovery procedures from error conditions present in a software application. In other words, it is the process comprised of anticipation, detection and resolution of application errors, programming errors or communication errors.

#

I'm not a fucking moron, okay?

#

It's a real term, that's used the way I use it.

#

Hell

#

Even MDN uses the term "error handling"

#

THE FUCKING SWIFT LANGUAGE GUIDE USES THE TERM

quaint mantle
#

and python

knotty gale
#

alr I cannot figure this out someone pls just give me raw source code for accessing another variable from another class

lavish hemlock
#

So the next time someone gets on my case for saying "you don't handle errors"

knotty gale
#

I read the stuff but it dont make sense

lavish hemlock
#

SHUT THE FUCK UP

#

BECAUSE

#

GOOGLE SAYS OTHERWISE

knotty gale
#

LMFAO

lavish hemlock
#

Sorry not responding to you

undone axleBOT
quaint mantle
#

getters and setters

lavish hemlock
#

Anyway it seems like error-handling and exception-handling are actually one and the same

#

In fact, exception-handling is the more common term, but neither is more proper

viral crag
#

no

quaint mantle
#

based

viral crag
#

an error is when you do something wrong, an exception is when your code does something wrong

quaint mantle
viral crag
#

no, that is how it works

quaint mantle
#

no..

viral crag
#

an error can generate an exception but an exception can not generate an error

lavish hemlock
#

The term "error handling" is also used by the C++ reference, Node.js documentation, Python documentation (as Imajin said), Rust documentation, and Win32 Microsoft documentation.

#

Not to mention error does not explicitly mean a programmer fault

viral crag
#

i didnt say programmers fault

lavish hemlock
#

As judged by the fact Error in Java refers to unrecoverable exceptions

#

an error is when you do something wrong

quaint mantle
lavish hemlock
#

then what the fuck did you say??

crude loom
#

Is there a way to get how much time the player played on the server?

quaint mantle
#

search engines are a wonder

lavish hemlock
#

Oh ye also PHP and AWS documentation uses the term "error handling"

viral crag
#

"you" is just the environment outside the code itself, there is no good term for it

lavish hemlock
#

I would not describe acts of God as errors

viral crag
#

then gamma radiation and photons do not generate errors

lavish hemlock
#

rather

#

I would call them

#

unfortunate circumstances

granite owl
#

why does AsyncPlayerChatEvent.setFormat(...) break when a player types the % character

#

13.04 22:18:01 [Server] INFO Caused by: java.util.UnknownFormatConversionException: Conversion = '%'

lavish hemlock
#

String.format stuff

#

% is the prefix of a formatting code

#

setFormat sets the format string for a message I assume?

granite owl
#

ah k ty

granite owl
#

not too elaborating on it

#

xD

lavish hemlock
#

Bukkit power

granite owl
#

mhm

#

okay so .setFormat(String.format(str));

#

?

hybrid spoke
#

dont use String.format

#

it performs very badly

#

compared to StringBuilder or MessageFormat

west glacier
#

i do a simple plugin that show the name of a player and in a message when break a diamond ore but i it appears every time i broke a block, how can i do to show the message only one time in 2 min?

hybrid spoke
#

or a simply +

granite owl
#

so how to prevent a simple % char to break the callback then

hybrid spoke
#

replace it

granite owl
#

the %?

granite owl
#

when someone types it?

hybrid spoke
#

yup

west glacier
hybrid spoke
undone axleBOT
viral crag
#

do you know how to schedule a timer?

west glacier
#

nop

#

i starte to do code since 3 days

viral crag
#

yeah then reading the above would be advised

west glacier
#

okay

viral crag
#

something like this is non-critical so you could use an asyc timer

#

the hard part will be adapting your code to work with the timer

#

just start by creating a timer to fire you a message after two minutes (you do not need a repeating timer for something like this)

west glacier
viral crag
#

does it work?

west glacier
#

this dosent work, idk why

sterile token
#

Lmao itsnot funny to be tagging and deleting tags 😡

viral crag
#

to start with, how do you think your timer is going to decrement?

sterile token
#

For doint countdon i would use timestamps

neat laurel
#

countdown*

west glacier
#

i want a timer for not appear the message since 2 min

sterile token
#

yea

#

You can do a timestamp

west glacier
#

what is??

sterile token
#

A timestamp its number or date that its checked every time

#

I ill send the classfor creating timestamps

#

give 1 sec

west glacier
#

thx😊

viral crag
#

epoch is, futureEpoch=epoch + (2400 /20) , is epoch match futureEpoch roughly

sterile token
#
public class Cooldown {

    private String name;
    private long end;

    public Cooldown(String name, Long time) {
        this.name = name;
        this.end = System.CurrentMillis() + time;
    }

    public void stop() { this.end = 0; }

    public boolean hasExpired() { return (System.currentTimeMillis() - this.end >= 1L); }

    public String getName() { return name; }

    public long getRemaining() { return this.end - System.currentTimeMillis(); }
}
viral crag
#

i had forgotten that java has time

sterile token
#

Its inded to be used in millis seconds

#

I do a getName(), so then you can have multiple cooldowns

#

You can create a manager for the cooldowns (Set<Cooldown>)

west glacier
#

i want to do a timer for each player

sterile token
#

Allright

#

But the player will have diff timers?

neat laurel
#

I think he wants 1 countdown for each player (find diamond and the message will appear once, after 2 minutes if you find diamond again the message may appear again). That's what I think

sterile token
#

Oh ok i was using the class to each player have many cooldons

#

But you can use it as you wish

neat laurel
#

@sterile token Are you spanish?

sterile token
#

Yeah

#

Im spanish

neat laurel
#

lol like me

sterile token
#

Dm me

#

For spanish dm

#

Because here its not alllowed

main dew
#

Hi how I can check player who had a nickname selected?
for example "Proscreeam1337". Now there is no player with this nickname but in the past there were 3 people

quaint mantle
#

or however much data u want to assocaite

#
somenickname:
  - uuid
  - uuid2
#

the uuids would represent players who have assocaited with that nickname

main dew
vocal cloud
#

From the player class?

west glacier
#

i made the cooldown but the message only appears when pass 2 min y want that the cooldown starts when the player breaks the block.

public class BlockBreakDiamond implements Listener {

    @EventHandler
    public static void blockBreak(BlockBreakEvent event) {
        Player p = event.getPlayer();
        Block block = event.getBlock();
        Material material = block.getType();
    
    if(material.equals(Material.DIAMOND_ORE)) {
        
        if(Main.getInstance().getCooldowns().getCooldown(p.getUniqueId())==null) Main.getInstance().getCooldowns().add(p.getUniqueId(), 120000L);
        Cooldown cooldown = Main.getInstance().getCooldowns().getCooldown(p.getUniqueId());
        if(cooldown.hasExpired() ) {
            String mensaje1 = ChatColor.GREEN+p.getName();     //coje el nombre del jugador
            String mensaje2 = ChatColor.GRAY+"Ha conseguido"+ChatColor.AQUA+"diamantes.";    //mensaje que sale en el chat
            
            Bukkit.getServer().broadcastMessage(mensaje1+" "+mensaje2); //Hace que envie el mensaje el server para que lo vean todos
            Main.getInstance().getCooldowns().add(p.getUniqueId(), 120000L);
        }
    }
    }
}
sterile token
#

Mike

#

Can you help him please :D

vocal cloud
#

What I do for cooldowns is just make a hashmap with time in it. Then I do a if(currentTime > timeInMap) dosomething();

main dew
vocal cloud
#

Looks way more complicated

sterile token
#

Mike=?

#

Are u still alive?

#

He is prob ignoring us

vocal cloud
#
    private static HashMap<UUID,Long> coolDowns = new HashMap<>();

    public void event() {

        if(System.currentTimeMillis() < coolDowns.get(playerUUID)) {
            return;
        } else {
            coolDowns.put(playerUUID,System.currentTimeMillis() + (60 * 1000)); // cd for 60 seconds
        }

    }
sterile token
#

🤔

#

But doesnt fix his issue

vocal cloud
#

Yeah but so much more work

sterile token
#

He is issue is the next, when you break a diamond fo first time, you have to receive the message and them create the cooldown, and send the message every time he want

#

That what he means

#

Do we have expalined?

vocal cloud
#

Meh the < should be > oops

sterile token
#

isnt the same?

#

🤔

#

Code looks exactly the same

vocal cloud
#

But so much cleaner

sterile token
#

Is the same i made him

vocal cloud
#

They have some Cooldown cooldown = Main.getInstance().getCooldowns().getCooldown(p.getUniqueId()); class which is unnecessary

#

Just need a hashmap

#

Anyways what is the issue here? When they break it the message send then what?

#

You want a message if it fails to break? Add an else to the if(cooldowns#)

sterile token
#

I already explained the issue

west glacier
#

the problem is that when a player broke the block i want to put a cooldown to this player that not send the message again

#

since 2 min

sterile token
#

Now the cooldown doesnt works 🤡

vocal cloud
#

If you used my code the > needs to be swapped lol

#

nvm idk

vocal cloud
coarse finch
#

where should i put a playerteleport event for a /back event?

vocal cloud
#

What?

#

Within the command?

dusk flicker
#

ew static event

vocal cloud
echo basalt
coarse finch
#

quick question, can a dictionary contain multiple of the same key like python or if i .put() a key that already exists will it override it?

vocal cloud
#

It will override

coarse finch
#

ok thanks

stuck flax
#
    public void onInventoryClick(InventoryClickEvent event) {
        if(event.getView().getTitle().equals(ChatColor.translateAlternateColorCodes('&', "&8Weaponsmith"))) {
            event.setCancelled(true);
        }
    }

how do i make it so the player can move stuff in their own inventory but not the GUI?

delicate lynx
#

don't check inventory name

stuck flax
delicate lynx
#

you would want to create a custom InventoryHolder and make you GUI use that

#

and when you check the click, you would want to see if getHolder() on the inventory is instanceof your custom holder

summer scroll
#

if player click on top inventory, cancel it

worldly ingot
#

Don't do that

#

Just keep reference to the InventoryView from Player#openInventory()

#

Referentially compare it when clicked in an event

#

Then yes, follow agler's suggestion. You can compare the clicked inventory

coarse finch
vocal cloud
#

What do you mean by "that errors" what error

coarse finch
#

wait nvm

#

but

#

do i put it in the command class or another

#

class

vocal cloud
#

I mean it should be in the command

coarse finch
#

in the on command?

#

hang on

#

wtf

#

my mouse is always in a clicking icon on intellij

#

ok heres my command

#
public class BackCommand implements CommandExecutor, Listener {
    public static Hashtable<UUID, Location> backDict = new Hashtable<>();

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (sender instanceof Player player) {
            if (Config.getConfig().getString("back-enabled").equals("true")) {
                if (backDict.containsKey(player.getUniqueId())) {
                    Location location = backDict.get(player.getUniqueId());
                    player.teleport(location);
                } else {
                    player.sendMessage(ChatColor.RED + "You haven't teleported yet!");
                }
            }
        } else {
            Bukkit.getLogger().info(ChatColor.RED + "This command can only be executed by players!");
        }
        return true;
    }

    @EventHandler
    public void PlayerTeleportEvent(PlayerTeleportEvent event) {
        Player player = event.getPlayer();
        Location from = event.getFrom();
        BackCommand.backDict.put(player.getUniqueId(), from);
    }
}```
#

how would i add it in main file

quaint mantle
#

why are you using a hashtable

vagrant stratus
#

Anyone know if there's a better way of doing

    private static final List<String> CLIMBABLE_MATERIALS = new Arraylist<>();

    static {
        CLIMBABLE_MATERIALS.add("LADDER");
        CLIMBABLE_MATERIALS.add("VINE");
        CLIMBABLE_MATERIALS.add("SCAFFOLDING");
        CLIMBABLE_MATERIALS.ADD("TRAPDOOR");
    }

Besides making an EnumSet of every material?

coarse finch
vagrant stratus
#

ah, looks like there's a tag lol nvm
Edit: Tag.CLIMBABLE btw

quaint mantle
coarse finch
#

can i use it the same way

quaint mantle
#

yup

coarse finch
#

ok

#

hashmap is apparently not a thing

quaint mantle
#

good luck

coarse finch
#

oh its capital m

#

but

coarse finch
#

how do i add the playerteleport event in main file

quaint mantle
#

dont

coarse finch
#

ok

#

"Did you maybe forget to register the listener?"

#

on spigot forums

#

about issue with playerteleportevent

quaint mantle
#

did you?

coarse finch
#

i dont know how to register it

noble lantern
quaint mantle
#
this.getServer().getPluginManager().registerEvents(new PlayerTeleportListener(), this);
noble lantern
#

oh nvm he figured it out

coarse finch
#

what

#

all of a sudden my test server is 1.18.2

#

what is this wizardry

#

i did not update it

noble lantern
#

is it a host

#

host probably changed it

coarse finch
#

not a host

#

i am goona go talk to purpur devs

noble lantern
#

idk even if its a fork server versions just dont magically change

coarse finch
#

yes ik

#

the teleport event doesnt fire

noble lantern
#

is the class implementing Listener

#

and does the method have @EventHandler annotation

coarse finch
#

yes and yes

noble lantern
#

then its something in how your handling your event ie the logic of it

coarse finch
#

i put the command class name for the event right?

noble lantern
#

command class?

#

your registering an event?

coarse finch
#

yes

#

they said put it in the command

noble lantern
#

yes

#

new BankCommand() but you should create this BankCommand as a variable so you dont have to instances of it running when you reister your command

coarse finch
#

ok

#

what do i put the type as

noble lantern
#

for what?

coarse finch
#

the variable

#

its not a class

#

but the type

#

idk

noble lantern
#

well the class is a typeof BankCommand so your BankCommand would be the variable

BankCommand bankCommand = new BankCommand();

// reister events using bankCommand
// registerExecutor using bankCommand
coarse finch
#

ok

#

wait do i register events before executor or does it not matter

noble lantern
#

uhmm hmm

#

sometimes it depends

#

but in this case no

coarse finch
#

well if this doesnt work ill try it

#

it works

#

:))

next zinc
#

Any reason this wouldn't work?

    @EventHandler
    public void onLand(ProjectileHitEvent event) {
        if(event.getEntity() instanceof Arrow) {
            Arrow arrow = (Arrow) event.getEntity();
                if(arrow.isOnGround()) {
                    arrow.setGlowing(true);
                }
            }
        }
    }
#

I know that the event runs since I've tried debugging but can't figure out why it wont detect if its on the ground

worldly ingot
#

I'm not confident that #isOnGround() will be true by the time that event is called

#

You can check if ProjectileHitEvent#getHitBlock() isn't null though, that will accomplish the same goal

#
if (event.getEntity() instanceof Arrow arrow && event.getHitBlock() != null) {
    arrow.setGlowing(true);
}```
#

I'm also not entirely certain that Arrow#setGlowing() works exactly how you want...

noble lantern
#

holy shit do you have copilot on your discord or something

#

you typed that mad fast

worldly ingot
#

lol

next zinc
#

Im just using it for a visual test

#

but ill try that out

worldly ingot
#

Yeah I just don't think setGlowing() will work on an arrow. iirc it's an Entity method but accomplishes the same thing as giving the glowing potion effect without actually giving the effect

#

Could be wrong about that though. I'd print a message there to verify if it's actually running that code

next zinc
#

Nah you're code worked flawlessly

worldly ingot
#

Oh it does glow? Neat

next zinc
#

arrows glowing any everything

#

Indeed

#

Ty for the help

worldly ingot
#

o/

next zinc
#

o/

echo basalt
#

only entity I highly doubt is area of effect cloud

worldly ingot
#

I've just never seen an arrow glow aPES_Laugh Wasn't sure

#

Aside from a spectral arrow I think

echo basalt
#
Location targetLocation = target.getLocation();
Location entityLocation = entity.getLocation();
World world = entity.getWorld();

Vector velocity = entityLocation.clone().subtract(targetLocation).toVector().normalize().multiply(1.5);
SmallFireball fireball = world.spawn(entityLocation.add(velocity), SmallFireball.class);
fireball.setVelocity(velocity);

I'm probably an idiot but this shouldn't shoot from the entity's line of sight

hot fjord
#

thank god this place exists

buoyant viper
#

eyah

worldly ingot
echo basalt
#

1 - the entity is not looking at the target
2 - it's shooting off its eye direction, rather than shooting at the target

worldly ingot
#

No I get it's not looking at the target but getLocation() is at the feet

#

getEyeLocation() is at eye height

echo basalt
#

shouldn't matter much

worldly ingot
#

No but it's probably closer to what you want ;p

echo basalt
#

this is close enough

worldly ingot
#

You want to subtract target - entity position though

#

Backwards

echo basalt
#

also I'm not using livingentity so getEye location doesn't exist

worldly ingot
#

Ah that's fine then. But yeah, wrong subtraction direction

echo basalt
#

sometimes I wonder how I miss such things but then I look at the time

pliant oyster
#

for some reason protocolmanager is null and idk why

#
[02:41:55 ERROR]: Error occurred while enabling FirstAC v1.0-SNAPSHOT (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "com.comphenix.protocol.ProtocolManager.addPacketListener(com.comphenix.protocol.events.PacketListener)" because "protocolManager" is null
    at me.blebdapleb.firstac.FirstAC.onEnable(FirstAC.java:23) ~[FirstAC-1.0-SNAPSHOT.jar:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[patched_1.17.1.jar:git-Paper-408]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.17.1.jar:git-Paper-408]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.17.1.jar:git-Paper-408]
    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:561) ~[patched_1.17.1.jar:git-Paper-408]
    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:475) ~[patched_1.17.1.jar:git-Paper-408]
    at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:733) ~[patched_1.17.1.jar:git-Paper-408]
    at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:317) ~[patched_1.17.1.jar:git-Paper-408]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1220) ~[patched_1.17.1.jar:git-Paper-408]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Paper-408]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]```
vocal cloud
#

Ah paper kekw

#

Show pom

pliant oyster
#
    @Override
    public void onEnable() {

        instance  = this;

        // Managers
        ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();

        // Packet listeners
        protocolManager.addPacketListener(KillAuraA.killAuraACheck);
vocal cloud
#

Don't show code show pom

pliant oyster
vocal cloud
#

Theres your problem change the scope of protocol lib to provided and it'll work

pliant oyster
#

breh

#

I changed provided

#

to the wrong one

outer sorrel
#

how can i show what input type is allowed for a command if it allows any string or int input?

vocal cloud
#

By adding a usage to the command. Also using a tabcompleter to assist

outer sorrel
#

ah thanks

noble lantern
#

Could I apply bullshit states to items to retexture?

IE adding waterlogged: true to a grassblock

hexed hatch
#

Nope

#

Because the blocks you want to add bullshit states to won’t be able to hold said state at all

#

Still scavenging for more ways to make custom blocks?

noble lantern
#

well

#

i want to add custom liquids

#

but i doubt theres a way to do this

hexed hatch
#

Sadly that’s a hard no

#

However

noble lantern
#

mainly just a simple color retexture

hexed hatch
#

I did something a little silly to make the illusion of custom liquids

noble lantern
#

im fine with illusions

hexed hatch
#

Well actually, I have a better option for you

#

Custom biomes can change water color

noble lantern
#

this water has no special propperties its just water

#

discord lag

#

hmm

#

and biomes can be seperate by x y and z in 1.18 correct?

hexed hatch
#

Correct

#

Now there is some blending weirdness

#

So the color won’t sit neatly in its spot

noble lantern
#

only issue would be it would be strictly 1.18 which is sadge

I could implement it in other versions but then the water underneath the islands would change too

hexed hatch
#

Well actually

noble lantern
hexed hatch
#

3D biomes have been in the game since 1.16

noble lantern
#

oh?

hexed hatch
#

Came with the nether update

noble lantern
#

oh shit your right

#

so 1.16 - 1.18 then hmm

#

not too bad i normally dont go below 1.14 anyways cause of pdc

#

alright ill take a look at that ty for the idea 🙂

crude loom
#

I'm using this to get the time the player played on the server : player.getStatistic(Statistic.PLAY_ONE_MINUTE)
But for some reason the text is italic and purple, how do I fix this?

waxen plinth
#

You're probably putting it in lore

#

getStatistic doesn't return a string

#

It returns a number

#

A number can't even have properties like that

crude loom
waxen plinth
#

If you're setting it in an item's lore, being purple and italicized is the default format, you can prepend ChatColor.RESET or any color to correct it

crude loom
#

Ah ok, thanks!

dull whale
#

how can I add invisible light sourcse

waxen plinth
#

You can do it with this

#

Though also I think there is a light block in the latest versions

#

Yep

#

Material.LIGHT

#

You can even set its level precisely

dull whale
#

wow thanks

cedar kindle
#

How do I get the plugin's folder path?

tardy delta
#

plugin.getDataFolder()

cedar kindle
#

should i take a screenshot of the project files?

tardy delta
#

No take a a screenshot of what you did

cedar kindle
#

what do i use to send screenshots? i don't have the permission to send an image

#

imgur?

tardy delta
#

Ah then just copy then code

#

?paste

undone axleBOT
cedar kindle
tardy delta
#

?di to get the plugin

undone axleBOT
tardy delta
#

You don't have a plugin variable that's the problem

cedar kindle
#

aha, thanks for the help

low temple
#

Is there any way to add items to a LootTables object?

limber owl
#

player pickup event for 1.18.2 ?

low temple
#

like am i able to add items to specific loot types during some event?

low temple
crude loom
#

Is it possible to change the name that appears at the top left when I open a player's inventory?

cedar kindle
#

I just copied and pasted from the website you sent btw, I didn't read anything (sorry)

lavish hemlock
#

This is feeling like a ?learnjava

cedar kindle
#

or you can help me instead of making fun of me

lavish hemlock
#

I'm just stating the obvious :p

silver nimbus
#

lol

lavish hemlock
#

People who copy-paste code instead of actually making an effort to understand it are more likely not to know the source language

#

If you actually took the time to read over the guide, you'd realize that it gives you examples, not working code snippets.

#

This is truly the only part you need to understand

#

It doesn't matter what BlockBreakListener is

#

Just the fact that you're giving it an instance of your plugin

#

(Also SpigotPlugin doesn't exist I don't know why the guide uses it, maybe to stop people from copy-pasting?)

#

(Another thing: FancyLogger does not exist)

cedar kindle
#

I just realized "SpigotPlugin" is the class name

lavish hemlock
#

(Your code would 100% fail to compile)

#

Oh right

#

I wrote a blog post on DI about a month ago

tardy delta
#

Maow help him lol

lavish hemlock
#

That's what I'm trying to do :p

cedar kindle
#

I do have a stupid question tho.
Is that really the only way to get the plugin variable?

lavish hemlock
#

Well no, but it's the most preferable

#

You could use something like a singleton, JavaPlugin.getPlugin(...) (which is equivalent to a singleton imo), or a setter.

#

But most of these options are not conventional

cedar kindle
lavish hemlock
#

Why thank you :)

#

lmao

#

Yeah, but in different ways

#

For one, getPlugin will most certainly fail if called before the plugin is loaded.

#

Setters also introduce state and nullability

#

Dunno, it could happen though

#

So ye imo constructor DI is the cleanest solution

#

It's also just favoured by most Java devs

patent quarry
#

Hey, I try to modify the damage of a Trident but it seems not work, someone has already encountered this problem ?

Trident extends AbstractArrow, so I tried to use the setDamage() of AbstractArrow, it works fine for Arrow but not for Trident.

smoky oak
#

are you sure you havent just forgotten to reload the plugin? That method should work

quaint mantle
#

I need to load each value inside the config.yml and create a command

commands:
  command1: "Custom response"
  command2: "Another response"

so everything in 'commands' is read, with the first value, e.g. 'command1' being the name of the command and 'Custom response' being the value that is sent to the player when the command is run.

However, I would have no idea where to start since loading commands from config files, without the use of plugin.yml is decently new to me.

Anyone got any idea how I could start it? You don't have to provide the code necessarily, more just the steps for doing it

crimson terrace
#

you should make it a list instead of separate paths

#

so instead of
commands:
commands1:
...

you could use
commands:

  • <response1>
  • <response2>
#

that way you can get all the values of commands by using config.getStringList()

#

if you wanna have the command response pair together instead of in 2 lines or so you could just put both in the same line and split it into command and response after

patent quarry
smoky oak
#

not with tridents, but arrows. They, too, extend AbstractArrow

patent quarry
#

Yes for arrows it works well, but not for trident

smoky oak
#

and yes it worked at that time

quaint mantle
crimson terrace
#

no problem!

smoky oak
#

also question of my own how do i do a lambda consumer again?

crimson terrace
#

you have to put () -> or something I believe

#

possibly () -> { do something here}, 100, 100)

smoky oak
#

right event is still part of the scope

#

worked thanks

main dew
#

Hi how I can check player who had a nickname selected?
for example "Proscreeam1337". Now there is no player with this nickname but in the past there were 3 people

crimson terrace
#

please explain what you mean by nickname. you mean the playername they have or some nickname on your server specifically

#

either way the answer should be something to do with the players UUID

lavish hemlock
# smoky oak right event is still part of the scope

It's called a captured local. Lambdas allow you to retrieve variables from outside of the lambda scope, but also allow defining new variables as part of their scope if passed to the lambda (lambda arguments).

smoky oak
#

yea. i got a different issue now

#

namely i only want it to run once

lavish hemlock
#

(Technically the trait of having captured locals mean lambdas are actually closures, but who cares?)

crimson terrace
#

lay it on us 🙂

smoky oak
#

but calling cancel() throws an error

crimson terrace
#

cancelling the task from inside the task you mean?

smoky oak
#

yep

crimson terrace
#

damnit, thats something I wasnt able to figure out either

smoky oak
#

urgh extending runnable it is

crimson terrace
#

maybe with a simple return; to grasp at straws here?

smoky oak
#

well the method .runTaskTimer specifically asks for Plugin, Runable, double, double

crimson terrace
#

return inside the runnable?

#

or call a method which cancels it?

smoky oak
#

well afaik a runnable calls, periodically, the run method, and the lambda gets translated into a runnable

crimson terrace
#

the () -> is an anonymous class and executes the run method which is specified inside the {} as far as i know. then again, i barely paid attention in that class

smoky oak
#

on a different topic how do i prevent Item entities from stacking?

#

I know its to reduce lag but its necessary for me right now

crimson terrace
#

possibly by changing some of its data? changing some of the persistentDataContainer may do the trick

smoky oak
#

well the issue is i need them to stack again when they're picked up

#

i imagine changing metadata or PDC would make that problematic

crimson terrace
#

then undo the changes when you need it

smoky oak
#

wait, do changes to the PDC and metadata of the Item entity transfer to the ItemStack instance?

crimson terrace
#

I dont know. Im guessing here

#

does the entityDeathEvent or the EntityDamageEvent get called when you pick up an item? that would be very useful

smoky oak
#

the jd mentions neither so i dont think so

smoky oak
#

or that

#

that works too lol

noble lantern
smoky oak
crimson terrace
#

it does I believe

noble lantern
#

item entity as in dropped itemstack correct

crimson terrace
#

Ive made special items which carry their data in PDC and when I drop it and pick it back up it still works. that should be enough, right?

noble lantern
#

yes

#

they will be there

#

PDC is similar to NBT in a sense, the data is persistant and applied to the item directly

smoky oak
crimson terrace
#

but not persistent when inside an itemstack which is then placed on the ground

noble lantern
#

^ unless its a typeof BlockMetaData

#

then its perstant all throughout except for when breaking the block

#

moral of the story

#

yes dropped items will keep your PDC data and MetaData

#

?paste

undone axleBOT
pine island
#

yep

#

i forgot

crimson terrace
#

lol

tardy delta
#

mc on linux be like

smoky oak
#

uuuuuurgh other way around
I modify the metadata/pdc of a item when it's created when it's dropped.
If a specific condition applies, i want to prevent it from merging with other Item entities.
ElgarL provided one possible solution, but i still want to know if the metadata and PDC of an Item ENTITY carries over to the picked up ItemStack

pine island
noble lantern
#

items with different PDC and meta data dont merge

#

even if theyre the same type

pine island
smoky oak
#

not the question. I KNOW THAT! I want to know if that PDC and metadata of an ITEM entity affects the picked up ITEMSTACK

noble lantern
#

its the same as when you dropped it like ive said many times now... nothing changes

#

dropped item with pdc -> dropped itemstack entity with pdc -> pickup -> same pdc

#

nothing changes here

smoky oak
#

i am aware that the item entity holds a itemstack with the pdc and metadata of the dropped item.
However.
The item entity itself has fields for metadata and PDC.
If i change those, the Item entities cant combine.
What i am asking is: Does the metadata and PDC of the item entities affect the itemStack it holds in any way, at any point in time

noble lantern
#

IIRC yes they do change if you change that dropped items PDT/MetaData you can always test it too ofc

#

the PDT of the ItemStack remains persistant throughout its life time

#

change the PDT as an entity, its edited when you pick it back up as an item stack

hexed atlas
#

does anyone know how to fix this reset glitch? the server is running on geyser and is cross playing java and bedrock but whenever u log out and log in your stuff gets wiped ( and ender chest) if your new to the server and u join and get some stuff and log out it will be gone plus achievements and there are other plugins like /tpa /team but i hope this issue gets fixed (its a cracked server it only occured 4 days ago and it was fine 2 weeks ago)

if not thank you for your time

vocal cloud
#

Cracked server lmfao

#

Shoo

tardy delta
#

is there an airplane or something?

#

or is that just the compooter

vocal cloud
#

That's the computer

#

At 5fps

young cape
#

Hello, do you know guys what's the best way to recognize a custom item

tardy delta
#

indian voices

wet breach
#

how would you not recognize a custom item?

#

o.O

tardy delta
#

if you are not ingame

wet breach
#

that isn't what I meant

vocal cloud
#

What if I slather my custom item in honey hmmm

wet breach
#

if you made a plugin to generate custom items, then should know it is a custom item

young cape
#

Ty guys

noble lantern
wet breach
#

lol

noble lantern
#

theres this weird bug where 50% of the time the items isnt detected as a custom item tho

#

currently working hard to fix this bug!

noble lantern
proper pawn
#

How do I make players not be able to rotate items in item frames? because this doesn't seem to work (the if statement does get called)

@EventHandler
public void onItemFrameMove(PlayerInteractAtEntityEvent event) {
    Player player = event.getPlayer();
    if (event.getRightClicked().getType().toString().equals("ITEM_FRAME")) {
        event.setCancelled(true);
    }
}
smoky oak
#

getType()==Material.ITEM_FRAME, maybe?

proper pawn
#

no thats not the problem

#

the problem is event.setCancelled(true);

#

the if statement gets called with 0 problems

sharp flare
#

Have u tried denying any block or item use result

sharp flare
#

Even though its not the problem

noble lantern
#

that wont matter

#

sometimes

#

you need string checks for version safe plugin writing

#

as calling Material.<Something> will throw an error

#

Its not the error here if anything

noble lantern
#

he should be checking if getRightClicked() is instanceof ItemFrame, but all 3 methods work for detecting if thats an itemframe

#

bkgert do you have any other InteractEvents?

#

or is it just that one

#

oh i see

proper pawn
#

this is the only PlayerInteractAtEntityEvent

sharp flare
noble lantern
#

PlayerInteractEntityEvent

#

try this one

proper pawn
#

ill try

#

it works!

#

thank you!

noble lantern
#

another thing to note

#

i dont think this prevents taking items out of the ItemFrame

#

might need to check that

proper pawn
#

already fixed that :)

noble lantern
#

ah nice! sounds good then

proper pawn
#

thanks for reminding me

tardy delta
#

duck

#

wanna become friends

#

👉👈

buoyant viper
#

?jd-s

undone axleBOT
summer scroll
#

How PlayerTeleportEvent#getTo can be null?

eternal oxide
#

it can't

eternal night
#

It can afaik

#

during portal teleportation logic

#

tho effectively that won't happen

eternal oxide
#

well it IS nullable, so I guess you can pass a null location in a teleport

#

all @NotNull

summer scroll
#

so just ignore that?

#

like i don't need to nullcheck the getTo location

eternal oxide
#

I have never ever seen a null Location in getTo

restive tangle
#

Are there any naming conventions for group ID in Maven?

eternal oxide
#

lower case

#

artifact too

restive tangle
eternal night
#

me.quzack would be the group id and pluginname the artifactid

restive tangle
#

I read somewhere that you can use your GitHub name for a group ID, how would I format that?

eternal night
#

The fun part about github is that you "own" the domain username.github.io

#

so you can use (for example for me) io.github.lynxplay as the groupid

#

because no one but you will ever "own" that domain

restive tangle
#

Alright, cool. Thanks

static pendant
#

Hey guys!
I'm a returning plugin-dev, last time I've coded a small plugin for our own server was with api-version 1.16 . Now I'm coming back, wanting to create some new custom ShapedRecipes, but I see a lot of the stuff being marked as deprecated. For example:

ItemMeta magicWandMeta = magicWand.getItemMeta();
magicWandMeta.setDisplayName(ChatColor.GOLD + "Magic Wand");    // The .setDisplayName() method is marked as deprecated

It recommends me using these fancy new Kyori.Adventure Components instead. So what I'm trying now is to:

ItemMeta magicWandMeta = magicWand.getItemMeta();
magicWandMeta.displayName(Component.text("Magic Wand").color(NamedTextColor.GOLD));  // Trying to set the display name with the fancy components

.. but without any effect. What am I missing here?

lavish hemlock
#

Those methods are from the Paper API

#

This is Spigot

static pendant
#

Well this helped me already, honestly

#

What do you recommend? Paper or Spigot?

earnest forum
#

spigot

static pendant
#

Spigot seems more natural to me, lol

lavish hemlock
#

I'd recommend using Spigot's API but Paper's server jar.

static pendant
#

Cool! Soooo all the deprecated stuff isn't really deprecated then?

lavish hemlock
#

Yeah nah it's just discouraged from use since Adventure is seen as better.

#

String-based methods use the legacy text format and are unable to do things as cleanly. I also don't believe they support things like chat events.

eternal night
#

I mean, only really useful if you want to publish your plugin to spigot

#

if you only run your plugins on your own server and that server already runs paper

#

just go with paper-api too

lavish hemlock
#

Yep

pliant oyster
lavish hemlock
#

It's just a varint

#

It's called an enum since it should only ever be one of the values listed

static pendant
#

I see. Well, as far as I can see the Spigot API has a more "natural feel", I'm planning to use that. Thanks for bringing me up-to-date maow!

pliant oyster
#

so do I just get an int?

lavish hemlock
#

Yes

pliant oyster
#

alr

lavish hemlock
#

Which is similar-ish to Adventure

#

A little worse though, imo

pliant oyster
#

so like int clickType = packet.getIntegers(1);

#

like that?

#

cuz there is another varint there already

lavish hemlock
#

Depends on the placement of that int in the packet's class

pliant oyster
#

ye

static pendant
#

Since spigot is planning to get rid of the "old way"

lavish hemlock
#

They're not

#

Paper isn't either

#

Legacy text afaik will stay for a long time

#

(Oh and btw you can use Adventure on Spigot too via their adventure-platform-bukkit dependency)

eternal night
#

I mean, we will see how long legacy survives if paper ever hardforks

#

legacy text is just so incredibly useless with the current ecosystem

#

like, mini message can make your life (if you prefer a string based approach) so easy

lavish hemlock
#

Fair point

#

MiniMessage ftw

static pendant
#

I see I got a lot of stuff to catch up upon lol

#

Can't seem to find any nice guide on the spigot forums tho

lavish hemlock
#

MiniMessage allows you to write string-based formatted text pretty easily

static pendant
#

Seems outdated

lavish hemlock
#

It uses Adventure and an XML-like syntax

#

Also supports stuff like gradients and placeholders iirc

static pendant
#

oh sweet stuff

lavish hemlock
#

Ye it's made by one of the users here

#

MiniDigger

#

I believe he's also a Paper contributor

eternal night
#

*core team member

lavish hemlock
static pendant
#

got any docu for all of that?

eternal night
eternal night
#

it has a section for mini message too

lavish hemlock
static pendant
#

Great help! Thanks guys

pliant oyster
#

Field index out of bounds. (Index: 1, Size: 1)

lavish hemlock
#

yep ok that means you actually can't use getIntegers then

pliant oyster
#

yeah

#

so it's not an int?

lavish hemlock
#

Well it's an int when received/sent

#

but it's then decoded to an implementation of EnumEntityUseAction

#

so technically it's an object

pliant oyster
#

oh

#

wait so how do I get it

lavish hemlock
#

I have no fuckin' clue lol

pliant oyster
#

lmao

slim kernel
#

I have a method that normally returns a Array of Blocks if it finds some. But sometimes it cant return the array because it didnt find any blocks ... what can I return then so I can check, when using that method, if it found Blocks or not?

pliant oyster
#

ye that's why I asked cuz forums say that it's an entityuseaction which idfk how to get

slim kernel
lavish hemlock
#

Three choices:
Have method return Optional<Block[]> (Optional.empty()) - I wouldn't recommend this.
Have method return null - I wouldn't recommend this.
What FourteenBrush said, new Block[0] - This is preferable since iterating over it won't throw an NPE.

tardy delta
#

imagine returning an optional array

lavish hemlock
#

It's an option! Just not a good one!

#

Although actually...

#

There's getEntityUseActions() and getEnumEntityUseActions()...

#

You probably want the latter.

pliant oyster
#

oh

#

wait so do I use getEnumEntityUseActions to get it?

slim kernel
lavish hemlock
#

Well it wouldn't be too hard for the last one

#

Just arr.length == 0

#

I mean

#

Every solution requires checking the array

#

Just different ways of doing so

slim kernel
tardy delta
#

just iterate over it

#

if its empty it wont do anything

lavish hemlock
#

But if it's null, you will die a long, terribly painful death :)

slim kernel
lavish hemlock
#

Well yeah

#

Array initializers are actually just shorthands

tardy delta
lavish hemlock
#
String[] s = new String[] {
    "Hello, ",
    "World!"
};
// is equivalent to
String[] s = new String[2];
s[0] = "Hello, ";
s[1] = "World!";
slim kernel
#

okay thank you

lavish hemlock
#

In fact

#

An empty array likely has the same performance as a null pointer

#

Since it contains literally nothing, meaning there's likely only a few bytes allocated?

#

And those would just be for the type of the array

#

So ye

#

No need to worry about that

slim kernel
#

And this Block[] blocks = {}; is the same as that Block[] blocks = new Block[] {}; ?

lavish hemlock
#

Actually no bc the former is not valid Java iirc

#

Maybe it is now

#

but I'm pretty sure it's not

#

Usually {} by itself is reserved for anonymous class implementations and specifying annotation array parameters

slim kernel
#

so I use the right one?

lavish hemlock
#

Yes

#

Well no

#

You shouldn't declare an empty array initializer

#

Just looks shit

#

use new Block[0]

slim kernel
#

okay ok

tardy delta
#

Block[0]::new 🙄

lavish hemlock
#

Block[]::new is though

#

Array constructor references ✨

#

Actually wait I wonder what those compile to...

tardy delta
#

its valid for a supplier

lavish hemlock
#

Oh, wow.

tardy delta
#

🥶

lavish hemlock
#

I honestly thought there would be some kind of optimization here...?

#

But nope

#

It literally creates a proxy of Function that creates a new empty array

glossy venture
#

how does minecraft implement its crafting

lavish hemlock
#

Who the fuck knows

glossy venture
#

i dont

rough drift
#

games with gabe does

lavish hemlock
#

Good point

rough drift
#

he is recreating a mc clone

glossy venture
#

fr?

rough drift
#

pretty good so far

glossy venture
#

oh nice

lavish hemlock
#

That guy knows basically fuckin' everything about Minecraft at this point

glossy venture
#

but is it the exact same because there are some features that id like to have

#

mainly (actually only) how to have shaped recipes work everywhere in the grid

#

instead of only in the top left corner

rough drift
#

yes

#

he made a devlog abt it

glossy venture
#

i thought about first moving the recipe to the top left and then eliminating empty space around it to leave you with only what you need

lavish hemlock
#

Well

#

An idea is that you could essentially

#

figure out the max size of a recipe

#

based on how many slots it would span in a 3x3 grid

glossy venture
#

but then i have to normalize (thats what i call the process) for every recipe

lavish hemlock
#

e.g. the sword recipe is 1x3

glossy venture
#

and rn im using a decision tree for matching

lavish hemlock
#

fishing rod is actually 3x3

glossy venture
#

yeah

lavish hemlock
#

you would basically then just like

#

check a list of recipes under that size

#

to find which one corresponds to what's in the grid

glossy venture
#

wait what if i just loop over all empty space around it

#

skip over

#

i meam

#

mean

lavish hemlock
#

I think your best bet is what I suggested

#

I don't know how performant it would be tho

rough drift
#

there

#

linked to implementing crafting

glossy venture
#

but how do i figure out the bounds of the recipe

#

inputted

#

vy the user

rough drift
#

no need

#

just see what he did

tardy delta
#

ay i saw that video

lavish hemlock
#

and what did he do?

#

I'd watch the video

#

but I don't want to bc I'm tired

glossy venture
#

i have flexible i ingredients so hashing wont work

#

anyways ima eatch the vid noe

#

he matches every possible positioning of every recipe against the player input

#

is what hes saying i think

crude loom
#

Where can I get the list of all the objects that can be stored in config?

tardy delta
#

just check out all the get... methods

#

getInt, getLong, getLocation etc

summer scroll
slim kernel
crude loom
#

if I have something like this:
if( (condition1 || condition2) && condition3)
then the statement will be true if condition1 && codition3 or condition2 && condition3 ?

cursive loom
#

Hey do you know how I can put HEX color in a scoreboard ? Thats work for my title but thats didn't work for the objectives

            String title = ChatColor.of("#25bfbf") +"S" +ChatColor.of("#29bdad")+"e" +ChatColor.of("#2dbb9b")+ "a" +ChatColor.of("#32ba8a")+"O"+ChatColor.of("#36b878")+"f"
                    +ChatColor.of("#3bb767")+"S"+ChatColor.of("#3fb555")+"k"+ChatColor.of("#44b444")+"y";
            ob.setDisplayName(title);

            Score s2 = ob.getScore("§7│  §e▪ "+ChatColor.of("#24E48A")+"Grade§f: " + SCOREBOARD_UTILS.getGroup(p));
            Score s3 = ob.getScore("§7│  §e▪ §aConnectés§f: §e" + co);
            Score s4 = ob.getScore("§7│  §e▪ §aPlayTime§f: §e" + SCOREBOARD_UTILS.playerTime(p));
            Score s5 = ob.getScore("§7│  §e▪ §bTempFly§f: §e" + SCOREBOARD_UTILS.getFly(p));
            Score s6 = ob.getScore("§7│§b");
            Score s7 = ob.getScore("§7│");
            Score s8 = ob.getScore("§7│§e");
            Score s9 = ob.getScore("§7│  §e▪ §aRôle§f: §e" + SCOREBOARD_UTILS.getRole(p));
            Score s10 = ob.getScore("§7│  §e▪ §aNiveau§f: §e" + level);
            Score s11 = ob.getScore("§7│  §e▪ §aArgent§f: §e" + SHORT_MONEY.getShort(MoneyAPI.getMoney(p)));
            Score s12 = ob.getScore("§7│§0");
            Score s13 = ob.getScore("§7│ §6VoteParty§f(§e" + 0 + "§f/§750§f) §7━");
eternal night
crude loom
#

?paste

undone axleBOT
crude loom
#

I have this code that switches the player item in their hand and vanishes or unvanishes them when they right click
The thing is that for some reason when the player looks at the air it requires to clicks and when the players looks at a block it requires one click
Any idea why?

crimson terrace
#

first of all, compare Materials with ==, not equals. it can get weird with equals

crude loom
#

Ok I changed it

crimson terrace
#

other than that I cant see any mistakes in the code you sent. to check further you would need to send the plugin.checkMode, unVanish and vanish implementations

crude loom
#

wdym?

crimson terrace
#

I can't see anything that would cause that bug in the code you sent, so I assume it is in the rest of the code

crude loom
#

oh, I will look into that

#

the thing is, when I look at a block it fires the event twice, so maybe its that somehow?

crimson terrace
#

thats also possible

crude loom
#

do you know what could possibly fix that?

#

the firing twice I mean

crimson terrace
#

let me look at the docs, one sec

#

ah I googled it

#

the event is fired once for the left hand and once for the right hand, so maybe recheck that it is the right hand, even if the Action.RIGHT_CLICK* thing should check it by itself?

crude loom
#

Ah, then I will also need to check for the game version as I want the plugin to be 1.8 compatible

#

Let me do it rq

crimson terrace
crude loom
#

Haha ok thanks!

cursive loom
shrewd sentinel
#

I created a Custom mob plugin but when I tp away and then tp back they are heavily duped

coarse finch
#

how can i use getDescription in a static method?

crimson terrace
#

I was referring to that specific case since they were already comparing the Action enum by ==

merry goblet
#

Bungeecord - Kotlin - config.yml

alpine urchin
#

is that a method in bukkit's Plugin?

#

by either holding a static reference to your plugin instance

#

or

#

using

Plugin plugin = Bukkit.getPluginManager().getPlugin("pluginnamehere");
#

then plugin.getDescription() or whatever it is

coarse finch
#

i can use that to get the description

#

?

hot panther
#

Is there a way to make items "unique"?
So that I can read out with a plugin whether a certain chest has been clicked on?

alpine urchin
coarse finch
#

ok thanks

hot panther
#

Whats the easiest way?

quaint mantle
#

does anyone know how do i check if 5 is the amount of light blue wool exists in the player inventory

#

I will check when the Player place a block then i want to check how much is the wool left

#

But how

crimson terrace
quaint mantle
#

How do i check

crimson terrace
#

for loop through the inventory and add up all the matching blocks

quaint mantle
#

ok

crimson terrace
#

zacken, that ones for you

#

😄

#

keep and use it, its the best way to convey that information

coarse finch
#

can spigot please unblock tor this is frustrating

#

im using it to bypass thier restrictions

#

they block google.

#

i cant

#

they block everything

crimson terrace
#

possibly because they dont want you on spigot XD

#

schools are openly anti spigot, we must rise up

#

same

coarse finch
#

no tor

#

school bloks proxy

#

i think spigot blocks proxies anyways

river oracle
#

Just get into your school's staff wifi

#

Ez

coarse finch
river oracle
#

Still damn feels bad

merry goblet
#

does anybody knows a good article or video about making Bungeecord configs in Kotlin because I can't get it to work

coarse finch
#

the thing is everyone uses the same wifi

#

teachers and student

river oracle
#

I just use a vps at school

#

Runs my browser fine somehow

coarse finch
#

vps wouldnt help

river oracle
#

No

#

Vps

#

Lmfa9

coarse finch
#

my computer is here

river oracle
#

I have this too

coarse finch
#

i bring my laptop

river oracle
#

I have it for other things too

coarse finch
#

wait i i have a rpi at home i might be able to

river oracle
#

Do you live at school?

coarse finch
#

no

#

well pretty much

river oracle
#

Why is your pc there then

coarse finch
#

i get here at 7:40 and leave at 7

river oracle
#

tf feels bad

coarse finch
river oracle
#

Ohhh

merry goblet
#

does anybody knows a good article or video about making Bungeecord configs in Kotlin because I can't get it to work

river oracle
#

Yes spam this in every channel

merry goblet
#

?

crimson terrace
torn shuttle
#

ok I have a really dumb issue

#

I open a new inventory when a player clicks an icon but it's carrying the click event to the next menu

crimson terrace
#

letting go of the click may be causing the click event? maybe? never worked with it

upper niche
#

open the inventory one tick later?

torn shuttle
#

I tested that specifically actually, it's not it

#

I really wanted to avoid doing the 1-tick trick

#

the snippet is uh a bit massive

undone axleBOT
crimson terrace
#

thats what the paste is for

torn shuttle
#

actually

#

I think I might have a trick up my sleeve let me test real quick

#

it's really dumb too

crimson terrace
#

code is dumb alltogether, that translates into the solutions you make for problems you didnt need to have in the first place

past vapor
#

Is there an event that is triggered for ANY block breaking, changing state, victim of an explosion event etc, or is there a way to tell when any of these events happen.

I currently have a plugin which listens for each of these events, and adds blocks to an array to be reset later - This mostly works however sometimes blocks are not replaced, which is why i was wondering if there was any event that catches any block changing state or being destroyed or changed.

torn shuttle
#

huh

#

it worked

#

well that's particularly dumb

past vapor
#

It's a shame the BlockBreakEvent is only called when broken by a player 😢

torn shuttle
#

ignorecancelled set to true, I suspected it was literally using the same click event even though it was a different menu

#

this sort of feels like a spigot bug

#

well

#

at least I avoided doing another 1 tick trick

#

I hate those, they always come back later to bite me in the ass

last ledge
#

player.playEffect(Effect.valueOf(plugin.getConfig().getString("sound")));

past vapor
#

Most of it is fine as is,

torn shuttle
#

lol respawning players is cringe I dump them to spectator mode when they would've died

past vapor
#

The only blocks that are not being detected seem to be stacked blocks

#

As in, a bottom cactus breaks

last ledge
#
EntityEffect
Provided:
Effect```
#

How do I fix it

past vapor
#

The top one is not detected to be broken sometimes

torn shuttle
#

also important side note my trash bin bugged out

#

I think it's broken, it no longer automatically opens

#

shit sucks it worked for all of 4 days

#

imagine having to debug your trash can

fleet juniper
#

How i add a resource pack in my server spigot?

torn shuttle
#

tbf I fed it too low a voltage

#

but to be even fairer they didn't include the power cable for it

#

look the store page said 4 AA bateries

#

it gets here and says 4 D batteries

#

all I have to say about that is D-z nuts

last ledge
#

I did

#

still

torn shuttle
#

oh shit I'm stupid

last ledge
#

Not sure, what I'm missing

torn shuttle
#

I just realized I turned the power socket off on purpose to enter recording mode

#

alright debugged my trash can

#

on with the next one

#

yep works just fine

fleet juniper
#

How can i insert a zip file in a txt file?

torn shuttle
past vapor
#

BlockBurnEvent, BlockCanBuildEvent, BlockCookEvent, BlockDamageAbortEvent, BlockDamageEvent, BlockDispenseEvent, BlockDropItemEvent, BlockExpEvent, BlockExplodeEvent, BlockFadeEvent, BlockFertilizeEvent, BlockFromToEvent, BlockGrowEvent, BlockIgniteEvent, BlockPhysicsEvent, BlockPistonEvent, BlockPlaceEvent, BlockReceiveGameEvent, BlockRedstoneEvent, BlockShearEntityEvent, BrewEvent, BrewingStandFuelEvent, CauldronLevelChangeEvent, FluidLevelChangeEvent, FurnaceBurnEvent, FurnaceStartSmeltEvent, LeavesDecayEvent, MoistureChangeEvent, NotePlayEvent, SignChangeEvent, SpongeAbsorbEvent 😭

fleet juniper
fleet juniper
past vapor
#

google exists btw

#

search there before asking people

torn shuttle
past vapor
#

thats not what hes tryna do tho

#

i dont think he was asking in the right channel

torn shuttle
#

I'm replying to the guy who asked how to put a zip file in a txt file

past vapor
#

I know

torn shuttle
#

he was trying to put a resource pack on their server?

fleet juniper
#

I'll do it alone as always

torn shuttle
#

yeah that's not right

fleet juniper
#

Goodbye

past vapor
#

literally gave him a tutorial

#

🥄

torn shuttle
#

hell yeah I love it when people get help and then act sassy

past vapor
#

ong

fleet juniper
#

I hadn't seen it

cyan compass
#

Is there an easy ish way to teleport to the dead center of a block? I'm trying to teleport myself to a projectile location but it's of course not always centered which bothers me

torn shuttle
#

as easy as that

cyan compass
#

awesome

torn shuttle
#

that being said you probably want y = 1 unless you're really into being inside of blocks

cyan compass
#

player.teleport(enderPearl.getLocation().add(0,2,0).add(0.5,0.5,0.5)); is what i have

#

But i think i might get rid of the first add and replace the second Y level with 2

crude loom
past vapor
#

If that's what you meant

crude loom
#

Yeah that's it, thanks!

past vapor
#

np

pliant oyster
#

anyone know a good update-to-date public anti cheat base? I cba to make my own

#

like all the other files

#

Like check and checktype

#

and the data

past vapor
#

i’ll do it later, just grit through it

#

he didn’t google what he wanted first 💀

#

noob move

#

I rmr when i didn’t understand what docs actually said 😢

#

🙌

last ledge
#

someone teach me how to read docs they are confusing lmao

pliant oyster
#

alr

#

I gotchu

#

first attach some eyes on your face

#

make sure you attach 2

#

then do this function

#
public void useBrainPower(Human human){
    human.learnToRead();
    human.useAttachedEyes().useBrainToRead();

}```
crude loom
#

I have a custom inventory with a name that I assigned with a class, is there a way to get that inventory given the name?

#

Yeah but how do I get the inventory

pliant oyster
#

getInventory()?

last ledge
#

getdisplayname()

pliant oyster
#

what are you trying to do