#help-development

1 messages · Page 491 of 1

fluid river
#

where @worldly ingot

topaz atlas
#

Anyways creating a new class helped

fluid river
#

add please

kind hatch
fluid river
#

eclipse is good man

native nexus
#

What is eclipse?

young knoll
#

An IDE

kind hatch
#

An IDE?

wary topaz
#

a type of moon

native nexus
#

What is an IDE?

wary topaz
#

an idea

fluid river
#

basically a physical process

kind hatch
#

Integrated Development Environment. How did you end up here?

young knoll
#

IDEez nuts

#

Gottem

wary topaz
#

ez nuts

native nexus
#

What is an Integrated Development Enviornement?

young knoll
#

What is love

fluid river
#

where one physical body overlaps another

dusk flicker
#

baby dont hurt me

native nexus
wary topaz
#

its where a mommy puts the poopstick in the fathers virgina

native nexus
wary topaz
#

it was a joke

kind hatch
#

Glad to see we are all cultured here.

weak meteor
#

You scare me

fluid river
#

so the eclipse observer sees some optical effects

#

ez

weak meteor
#

gonna cry

native nexus
#

No but seriously why use eclipse when there is a community version of IntelliJ that does everything better ;-;

weak meteor
#

i do not understand

#

why my code

#

doesnt work

wary topaz
native nexus
#

Show the code

dusk flicker
#

welcome to programming

wary topaz
#

thats a spigot

fluid river
#

we also don't

undone axleBOT
#

Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.

weak meteor
#

No one knows :(

kind hatch
#

?nocode

undone axleBOT
#

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

weak meteor
#

im storing the inventory, right?

#

and then when i call it

#

it explodes

#

ggez

kind hatch
#

Is inventory even serializable? Cause if not, you need to create an inventory then set the contents.

native nexus
#

I know location is serializeable

wary topaz
#

Inventory a = new Bukkit.createInventory(i dont remember);

native nexus
#

Look at the javadocs ez pz

fluid river
#

cuz array of itemstacks serialization to yaml

wary topaz
#

youcan save the contents

#

idk how a yaml would work with that though

#

as there is no .getInventory for yamlConfiguration lol

native nexus
#

You look through the contents

young knoll
#

Inventory itself is not serializable

native nexus
#

then use a Configuration sections

young knoll
#

But a list of items should be

native nexus
#

Use ConfigurationSections and then easy peasy

wary topaz
#

I would just prefer to have a hashmap, print the contents 1 by on onto a txt than read them when needed linep er line

fluid river
#

sheeeit

kind hatch
#

Ah, so yea. You just need to create an inventory instance then.

wary topaz
#

make sure its a public inventory

fluid river
fluid river
#

make sure to leave a report on JIRA

weak meteor
#

explosion

fluid river
#

show how your config looks

#

when you save the data

wary topaz
#

who likes trees

fluid river
#

binary trees

wary topaz
#

SortedMap m = Collections.synchronizedSortedMap(new TreeMap(...));
m.addTrees(favoriteTrees("NukerFall"));

fluid river
#

no way

wary topaz
#

i have learned

weak meteor
#

never creates

fluid river
#

what

wary topaz
#

delete them and try again

fluid river
#

cool

kind hatch
fluid river
#

where is the inventories folder mkdir()?

ember estuary
#

What will Bukkit.getOfflinePlayer(uuid) return if the player has never joined the server?

native nexus
#

I probably failed but here is your spoon full of feed

wary topaz
#

hehe

fluid river
#

for getOfflinePlayer every player exists

ember estuary
#

what will .getName() of such an offline player return?

#

his actual name?

fluid river
#

it will just have less actual data

fluid river
#

just null

ember estuary
#

ah ok, so its just an empty offlineplayer object that contains only the uuid

fluid river
#

?jd-s

undone axleBOT
kind hatch
#

If the player doesn't exist on the server, it should fetch it from mojang servers and put the temp data in the usercache.json

wary topaz
#

should add that

#

?jd-b

fluid river
young knoll
#

It’ll make a lookup to Mojang for their name

#

If it’s null that means no minecraft account with that uuid exists

fluid river
#

it can just return null if player like never existed

ember estuary
#

Ah yea, it actually says in the docs

#

Player name or null if we have not seen a name for this player yet

#

thanks

young knoll
#

Ah does it not make a lookup

ember estuary
#

nah lol

wary topaz
#

!ban

young knoll
#

I’m probably thinking of game profile then

kind hatch
#

Ohh, it does if you use the sting method.

wary topaz
#

!ban

craggy cosmosBOT
#
**Command:** -ban

Description: Ban a member, optional time limit
Cooldown: 3 seconds
Usage:
-ban [user] [limit] [reason]
-ban save [user] [limit] [reason]
-ban noappeal [user] [limit] [reason]
Example:
-ban bean making bugs
-ban save gin 2d needs to calm down
-ban noappeal piguy dont come back

wary topaz
#

there we go

kind hatch
fluid river
#

yup

wary topaz
#

might want to use exception catcher 3000 on that

fluid river
#

-ban EthanGarey 1d i like how he codes

#

😦

wary topaz
#

my code consists of

ByteArrayDataOutput out = ByteStreams.newDataOutput();
        out.writeUTF("ConnectOther");
        out.writeUTF(player.getName());
        out.writeUTF(args[0]);

        // If you don't care about the player
        // Player player = Iterables.getFirst(Bukkit.getOnlinePlayers(), null);
        // Else, specify them
        player.sendPluginMessage(this, "BungeeCord", out.toByteArray());

it's so baddd

ember estuary
# kind hatch

So they implemented a web request lookup for name -> UUID but not for UUID -> name ? Thats kinda sad xD But good to know

fluid river
#

bungee

kind hatch
fluid river
#

so you know that player existed

#

unless you just do UUID.randomUUID

#

for like no real purpose

wary topaz
#

you could use that to reset the players uuid (plugin specific)

kind hatch
#

It would be nice if we could have that as an optional parameter.
OfflinePlayer#getOfflinePlayer(UUID uuid, boolean lookup)

#

I'd rather have the info in the usercache just in case.

fluid river
#

i mean is there like any reason to use getOfflinePlayer?

young knoll
#

If you want name from uuid you can use a gameprofile

fluid river
#

to get his name

kind hatch
wary topaz
#

||a||

weak meteor
#

well

#

its supposed to...

wary topaz
#

what does that folder look like?

fluid river
#

you don't have the folder created in plugin's folder

fluid river
#

you need to mkdir() it

weak meteor
#

but i do all of my user stuff like that

#

lemme see

fluid river
#

or use the file.mkdirs() method and an if check

weak meteor
#

mega explosion

#

whats Caused by: org.bukkit.command.CommandException: Unhandled exception executing command 'staff' in plugin Nao v1.0

#

and even with mkdirs it doesnt appear the folder

wary topaz
#

whats at OnJoinEvent line 49?

weak meteor
weak meteor
weak meteor
#

:(

fluid river
#

you load config before making sure that file exists lol

weak meteor
#

i always do that

#

👀

fluid river
#

and well, your file doesnt

weak meteor
#

better?

fluid river
#

you don't have createNewFile() and your mkdirs() is running after all of that

remote swallow
#

createNewFile doesnt need to be made

#

unless its not in resources

fluid river
#

4real

weak meteor
#

createNewFile just creates an empty file

#

i tried

weak meteor
fluid river
#

i thought you need to have createNewFile in case you want to get the YamlConfiguration instance

fluid river
weak meteor
#

look what i do with other files

fluid river
#

and search for the file

weak meteor
#

and that works

remote swallow
#

that hurts

#

if that file doesnt exist its erroring

#

if you call loadConfiguration(file) on a non existent file it will error

weak meteor
#

i rlly dont know how tf it works

fluid river
#

i literally said that

orchid brook
#

hello do u know a plugin to block all command and tab completion in a hub server ?

fluid river
#

code one

weak meteor
#

that code

#

its ok

#

but the other

#

one

#

it isnt

#

damn

#

i dont understand anything

orchid brook
fluid river
#

kinda sussy

#

i would like you to just have

weak meteor
#

this one ok?

fluid river
#

file.mkdirs() + file.createNewFile()

#

and after that get YamlConfig and save

remote swallow
#

do you check if the file exists first

weak meteor
#

no

#

bc

#

when the player joins

fluid river
weak meteor
#

damn

#

thats true.

fluid river
#

but we don't have a file

weak meteor
#

ok lemme see if its works

fluid river
#

cuz your file creating code is not working

weak meteor
weak meteor
#

well, the folder appears, smth is smth

fluid river
#

the file inside?

weak meteor
#

what in the big actual fuck

remote swallow
#

well done, you are calling mkdirs on the file

#

not createNewFile

fluid river
#

oh true

weak meteor
fluid river
#

i forgor that you have one variable

#

for just the yaml file

weak meteor
#

yep

fluid river
#

does the createNewFile work if folder is not present

#

afair it doesn't

weak meteor
#

well

#

we got it

#

at least

remote swallow
#

first, go and rewrite your systems to check if the file exists before loading it

#

then mkdirs the playerdata folder if it doesnt exists on startup

weak meteor
#

oh im doing that

#

but thats another folder

fluid river
#

youd better just mkdir all of the folders in onEnable()

weak meteor
#

this folder is only for staff inventories

weak meteor
#

but now

#

another explosion

#

maybe in itemstack stuff

remote swallow
#

what does the staff command do

fluid river
#

cool you have null string

#

basically all

weak meteor
#

the normal ui of /staff

#

freeze

#

wand

#

tp

#

and stuff

remote swallow
#

im taking a wild guess, you are trying to access and args entry

remote swallow
#

you are getting a command error

fluid river
weak meteor
#

oh right i dont have it on config

remote swallow
#

what is staff command line 76

fluid river
weak meteor
#

its cool

remote swallow
#

no?

#

cool

#

cant help you then

#

good luck

weak meteor
#

i was missing name

#

bc i was trying something

#

lol

#

got it

fluid river
#

guy doesn't have a small util method for colorizing

#

💩

weak meteor
#

how can i fully vanish a player?

#

idk how

#

😢

remote swallow
#

check how supervanish or vanish no packet do it

weak meteor
#

K

kind hatch
#

I mean, there's Player#hidePlayer() and Player#hideEntity()

fluid river
#
for (var p : Bukkit.getOnlinePlayers()) {
    if (p.getUniqueId().equals(player.getUniqueId())) continue;
    p.hidePlayer(player);
}```
#

smth like this ig

#

jd-s at your service

weak meteor
#

well, i dont need to mess with events?

fluid river
#

no

#

you just paste the code

weak meteor
#

k then

fluid river
#

if it works*

#

cuz i don't remember what does the hidePlayer do

young knoll
#

You technically should be able to compare players with ==

fluid river
#

who is getting hidden from who

fluid river
#

so i avoid 99 if checks

#

idk what's faster

kind hatch
fluid river
#

so my code is right then

weak meteor
#

What i was thinking to do is to make a static map of UUID and Name and with a event of appearing a entity hide it if it matches with the player in map

#

But its easier

#

lol

fluid river
#

thanks anyways

#

(i will forget it in 10 seconds)

weak meteor
#

its deprecated

#

But why plugin is there?

kind hatch
#

Use the non deprecated one then.

remote swallow
#

its hideEntity now

#

oh it is still hidePlayer(plugin

kind hatch
#

No, it's still #hidePlayer(), you just need to supply a JavaPlugin instance.

weak meteor
#

k

young knoll
#

It’s so multiple plugins hiding and showing players work together properly

#

ie if 2 plugins hide and then 1 shows again

#

It should still be hidden because of that other plugin

kind hatch
quaint mantle
#

how can i check if the projectile is a specifig enderpearl

kind hatch
#

Do an instanceof check.

#

Then cast.

young knoll
#

Or compare type

quaint mantle
#

like this?

young knoll
#

Oh you want to see if it matches a specific instance?

weak meteor
#

what in the ginourmous biggo actual fuck 😿

young knoll
#

Or is endlessEnderPearl an ItemStack

quaint mantle
kind hatch
#

He wants to see if the projectile is an enderpearl.

young knoll
#

Ah

#

You can’t compare a projectile to an ItemStack

topaz atlas
fluid river
young knoll
#

I think you can get the held item for the projectile launch event

topaz atlas
#

index and anotherString dont exist for some reason

weak meteor
fluid river
#

players.get

young knoll
#

You don’t specify the argument names

kind hatch
weak meteor
#

:dance;

topaz atlas
fluid river
topaz atlas
young knoll
#

Correct

kind hatch
fluid river
#

bruh stop pasting everything you see

young knoll
#

Also eclipse can show those parameter names

#

It’s a setting

fluid river
#

well it's turned off for me then

young knoll
#

It’s off by default

fluid river
#

i just hover my mouse over method name

young knoll
#

Idk why

quaint mantle
#

how would i get the player that caused the projectile launch event

fluid river
#

to see what i need

fluid river
young knoll
#

You can’t

quaint mantle
kind hatch
#

You need the thrower entity

weak meteor
#

Nuker look

young knoll
#

Oh right

#

Projectile has a getShooter

fluid river
weak meteor
#

why whatt

fluid river
#

just... why

weak meteor
#

i cant do Collection#get

#

IDK WHY

fluid river
#

you dont even need it

young knoll
#

Why is it a collection

#

Make it a list

weak meteor
#

thats what it returns

fluid river
#
for (var p : Bukkit.getOnlinePlayers()) {
    if (p.getUniqueId().equals(player.getUniqueId())) continue;
    p.hidePlayer(player);
}```
weak meteor
#

look

kind hatch
fluid river
#

no

weak meteor
fluid river
#

just hide player from every player

fluid river
#

you need Player instead of var

weak meteor
#

i dont think so

kind hatch
#

Also, isn't that kotlin?

fluid river
#

no

weak meteor
#

its 17

young knoll
#

No java has var

kind hatch
#

Wat?

fluid river
#

var is like from java 13

young knoll
#

But like, avoid using it

kind hatch
#

Since when?

weak meteor
young knoll
#

Especially in this case

fluid river
#

or even before that

kind hatch
#

Why on earth did var come to Java?

young knoll
#

Idk

weak meteor
#

idk

fluid river
#

cuz we are too lazy to type generics

quaint mantle
weak meteor
#

thats the worst datatype i know.

young knoll
#

If only your ide could do it for you

quaint mantle
#

i may be dumb rn

young knoll
#

Oh wait it can

kind hatch
young knoll
#

Check and cast

kind hatch
#

But before that, check it.

young knoll
#

Shooter may not be a player

weak meteor
#

Lol

young knoll
#

It could be another entity

#

Or a dispenser in the case of arrows and stuff

fluid river
#

your project comp. level is lower than 13

weak meteor
#

well it works that way

fluid river
#

you need to set java version to 17 in pom.xml/ build.gradle

weak meteor
#

bc its Collection<? extends Player>

#

wu

#

Well finished for today

fluid river
#

gtg sleep

#

cya guys

kind hatch
young knoll
#

Collection is the generic interface for all collections

fluid river
#

learnjava

young knoll
#

List, Set, Queue

quaint mantle
#

like this?

kind hatch
#

Yea

fluid river
#

you can just use pattern matching

#

on newer jdk

#

if (!(source instanceof Player p)) returnl

young knoll
#

Yay pattern matching

kind hatch
#

Idk if I'll ever get used to that.

young knoll
#

Best new feature

quaint mantle
#

i can check if a item has a certain flag cant i

young knoll
#

Flag?

#

As in ItemFlag?

quaint mantle
#

yea

#

what are itemflasg even

#

maybe im confusing something

young knoll
#

They are used to hide certain stuff in the tooltip

kind hatch
#

What are you trying to look for on the item?

quaint mantle
#

how to i compare now

#

im lost

topaz atlas
#

How do i get the config of main

#

the config.ymk

#

*yml

young knoll
#

?di

undone axleBOT
topaz atlas
#

am I able to add that in the Main class before its extended

orchid brook
#

so i success to disable all command like this.

    @EventHandler
    public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
        Player player = event.getPlayer();

        if (!player.isOp()) {
            event.setCancelled(true);
        }
    }

but my code for turn off tab completion for no operator user, doen't work, can someone try to explain my error please ?

    @EventHandler
    public void onTabComplete(TabCompleteEvent event) {
        Player player = (Player) event.getSender();

        if (!player.isOp()) {
            event.setCancelled(true);
        }
    }
topaz atlas
#

?

remote swallow
#

it needs an intance

eternal oxide
#

read the link he gave until you understand it

remote swallow
#

getConfig is not static

topaz atlas
eternal oxide
topaz atlas
#

Oh wait

#

Nvm

young knoll
#

If you want to remove tab complete

#

Wipe the command list sent to players in the PlayerCommandSendEvent

#

Think I got that name right

topaz atlas
#
    private FancyLogger logger;

    @Override
    public void onEnable() {
        // pass in the current instance of the class in the constructor of the new class
        logger = new FancyLogger(this);
        BlockBreakListener listener = new BlockBreakListener(this);

        super.getServer().getPluginManager().registerEvents(listener, this);
    }

    /**
     * Returns this plugins fancy logger.
     *
     * @return the FancyLogger for this instance
     */
    public FancyLogger getFancyLogger() {
        return logger;
    }
}```
#

It says that this returns the main class

#

so I can access this, then I can access the config?

eternal oxide
#

yes, so long as you use it in your Listener

remote swallow
#

you need to access the instance

eternal oxide
#

this just refers to the object you are currently in.

topaz atlas
eternal oxide
#

no point

topaz atlas
remote swallow
#

you pass an instance of your class

#

?di read this

undone axleBOT
eternal oxide
#

read the dependency injection link, Everything is in there.

orchid brook
eternal oxide
#

do you mean the command or the arguments?

orchid brook
#

commands

eternal oxide
#

onTabComplete is for arguments

humble tulip
#

Spigot needs to annotate stuff with the version it was added

#

When was that event added

eternal oxide
#

probably when Player#updateCommands() was added

analog snow
#

Hey, how can I send people into different servers with a plugin using bungeecord?

humble tulip
eternal oxide
#

yes 😄

kind hatch
humble tulip
#

Plugin messaging

topaz atlas
eternal oxide
#

no

analog snow
young knoll
#

We’ve talked about since tags before

young knoll
#

But having since tags might make people thing we support those older versions

topaz atlas
#

Time to re-read i guess

young knoll
#

So everything is @since latest

eternal oxide
#

You didn't understand a single sentence in the dependency injection

humble tulip
kind hatch
eternal oxide
#

I honestly thought this guy was a troll earlier when he kept messing up his pom.

humble tulip
eternal oxide
#

He got there in the end so I'm assuming it's severe case of ADHD

humble tulip
#

So if you want to create a listener that needs your plugin instance

#

You use dependency injection

#

If you then want to use the config in that class, you can do plugin.getConfig

eternal oxide
#

Thats possible too 🙂

humble tulip
humble tulip
topaz atlas
#

Chill

topaz atlas
#

config.yml can be accessed via main class

kind hatch
humble tulip
#

But why do you want to pass the config to your main class?

#

Your main class already has your config

topaz atlas
humble tulip
#

Exactly

#

But in your code, you passed it to Main

topaz atlas
#

Oh, so i need to flip it

humble tulip
#

Well it seemed like you intended to

#

Create a constructor for the class that requires the dependency (config)

young knoll
#

It’s in latest

#

And that’s what you should be using

humble tulip
#

I guess we should just remove all old spigot versions then since they're not supported

kind hatch
humble tulip
#

It makes sense that older versions are not supported

young knoll
#

But people are nice and still help

#

Unlike paper :p

humble tulip
#

But that doesn't mean you can't document when something was added

eternal oxide
#

Then do you have multiple annotations when somethign changes?

#

one for when it was first added, another for when it changed

kind hatch
#

Have any of the methods changed?

humble tulip
#

Ideally method behavior shouldn't change

eternal oxide
#

I can see the point of a searchable database of changes

orchid brook
eternal oxide
#

annotations I can see as being problematic

humble tulip
#

So you just need a @AddedAt("version") and @ForRemoval("version") for deprecated stuff

young knoll
#

Generally changes mean nee methods

kind hatch
#

You don't even need annotations, just the comment tags.

eternal oxide
#

true

young knoll
#

And deprecated stuff is never removed

humble tulip
#

Damn

young knoll
#

Unless it’s straight up impossible to keep it then no

topaz atlas
#
    
    FileConfiguration config = this.getConfig();
    
    SignEvents signEvent = new SignEvents(config);```
```public class SignEvents implements Listener {
    
    private FileConfiguration config;

    public SignEvents(FileConfiguration config) {
        this.config = config;
    }
    ```
young knoll
#

Spigot is all about backwards compat

topaz atlas
#

Please tell me im close

humble tulip
#

Config will be null

#

You need to do in in onEnable

eternal oxide
#

do not store config

#

just pass this.getConfig(), or just this

humble tulip
#

Config is not loaded when the plugin instance is created

eternal oxide
#

its loaded when first accessed

humble tulip
#

SignEvents class is correct tho

humble tulip
kind hatch
humble tulip
#

You just need to do your stuff in onEnable@topaz atlas

topaz atlas
#
        FileConfiguration config = this.getConfig();
        
        SignEvents signEvent = new SignEvents(config);```
#

There

#

thats all

humble tulip
#

Sure

#

That'll work

eternal oxide
#
public void onEnable() {
        SignEvents signEvent = new SignEvents(this.getConfig());```
young knoll
#

Latest is the only supported for new development

#

But you don’t want old plugins to break

humble tulip
#

Register signEvent

eternal oxide
#

pass signEvent not new SignEvents()

humble tulip
#

You already created the new SignEvents and stored it in signEvent

topaz atlas
#

ok

#

Bukkit.getPluginManager().registerEvents(signEvent, this);

#

Think thats all

jagged badge
#
        scheduler.run(() -> {
            player.setVelocity(location.clone().add(player.getLocation().getDirection().multiply(-2)).toVector().subtract(player.getLocation().toVector()));
        });

I have this code that works perfectly on my server (moves the player around the initial location depending on the direction he is looking).
But on someone else's server it doesn't work at all. It teleports the player back and forth and makes a bit of a mess)

my tests gave these results. In both cases I did not move. If everything works, I have to be teleported once to be placed in the right trajectory, then I don't have to move anymore (because I don't change my look)

my server: it works

28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] -----------------------
[03:50:24 INFO]: [BEmote] [STDOUT] X: 1,93 Y: 0,21 Z: 0,46                                           -> your move
[03:50:24 INFO]: [BEmote] [STDOUT] X: 1,93 Y: 0,21 Z: 0,46
[03:50:24 INFO]: [BEmote] [STDOUT] X: -792.6763758631731 Y: 21.0 Z: 1771.232863963201
[03:50:24 INFO]: [BEmote] [STDOUT] X: -792.6763758631731 Y: 21.0 Z: 1771.232863963201                -> your current coordinates
[03:50:24 INFO]: [BEmote] [STDOUT] -----------------------
[03:50:24 INFO]: [BEmote] [STDOUT] -----------------------
[03:50:24 INFO]: [BEmote] [STDOUT] X: 0 Y: 0 Z: 0                                                    -> next move
[03:50:24 INFO]: [BEmote] [STDOUT] X: 1,93 Y: 0,21 Z: 0,46
[03:50:24 INFO]: [BEmote] [STDOUT] X: -792.6763758631731 Y: 21.0 Z: 1771.232863963201
[03:50:24 INFO]: [BEmote] [STDOUT] X: -790.7415008631731 Y: 21.21425 Z: 1771.691238963201            -> moved
[03:50:24 INFO]: [BEmote] [STDOUT] -----------------------
#

its server: I am not moved the first time, and my move afterwards is not zero

28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] -----------------------
28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] X: -1.71 Y: 0.1 Z: 1.03                              -> your move
28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] X: -1.71 Y: 0.1 Z: 1.03
28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] X: 0.5130243148498054 Y: 52.0 Z: 463.4330223617531
28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] X: 0.5130243148498054 Y: 52.0 Z: 463.4330223617531   -> your current coordinates
28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] -----------------------
28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] -----------------------
28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] X: -1.71 Y: 0.1 Z: 1.03                              -> next move
28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] X: -1.71 Y: 0.1 Z: 1.03
28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] X: 0.5130243148498054 Y: 52.0 Z: 463.4330223617531
28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] X: 0.5130243148498054 Y: 52.0 Z: 463.4330223617531    -> you did not move
28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] -----------------------
wise mesa
#

in acf, I want the tab complete for a command to be all the players that are in the party

jagged badge
#

anyone have an idea? I don't understand it

wise mesa
#

is there an easy way to do this? and not just have it be every player

wise mesa
quaint mantle
#

completly weird question but is there a way to stop a enderpearl from being consumed on use without canceling the event?

jagged badge
wise mesa
#

ooh

#

thank you

#

that is very helpful

wise mesa
#

is it like @Completion or something like that?

jagged badge
wise mesa
#

ah

#

thank you

#

is that for the parameter or for the function itself

jagged badge
#

if you want an example

    /**
     * Command tag delete
     */
    @Syntax("/tag delete <name>")
    @Subcommand("delete")
    @CommandPermission("tag.delete")
    @Description("Deletes a key.")
    @CommandCompletion("@tags @empty")
    public void onCommandTagDelete(Player sender, String name) {

        //Checks if the tag is not registered
        if (!TagManager.isRegistered(name)) {
            sender.sendMessage(TagNotification.TAG_NOT_REGISTERED.getNotification(new BPlaceHolder("%name%", name)));
            return;
        }

        //Deletes the tag
        TagManager.delete(name);

        //Messages
        sender.sendMessage(TagNotification.TAG_DELETED.getNotification(new BPlaceHolder("%name%", name)));
    }
wise mesa
#

interesting

#

thank you

jagged badge
wise mesa
#

very cool

#

thank you so much

jagged badge
# wise mesa we're probably gonna need more code than that
Location location = player.getLocation().clone();

BScheduler.syncScheduler().every(1).run(() -> 
    player.setVelocity(location.clone().add(player.getLocation().getDirection().multiply(-2)).toVector().subtract(player.getLocation().toVector()));
);```
wise mesa
#

why wouldn't it teleport them back and forth

#

oh wait

#

nevermind i read it wrong

#

yea I'm pretty confused idk

#

but uh i think I figured out my thing, thanks for the help @jagged badge

#
commandManager.getCommandCompletions().registerCompletion("partyPlayers", context -> {
            final var player = context.getPlayer();
            final var party = partyManager.getPartyWith(player);

            if (party == null)
                throw new InvalidCommandArgument();

            return party.getAllPlayers().stream()
                    .map(OfflinePlayer::getName)
                    .toList();
        });
jagged badge
#

yes, that's it, congratulations

wise mesa
#

i love functional programming

humble tulip
jagged badge
# wise mesa yea I'm pretty confused idk

if we take the problem in 2d, my code takes the initial position, calculates the position on the circle of radius 2 according to the yaw/pitch of the player. Then I calculate the vector between the current position of my player and the position I calculated to push him to this position. But on the second server, it doesn't make sense...

wise mesa
#

well im curious why you're doing it on every tick

jagged badge
wise mesa
#

unfortunately

#

which is why we should use rust 👍 😁 👍

jagged badge
humble tulip
#

loc.add(direction * - 2).subtract(loc)

jagged badge
#

so I calculate its position at each tick to move it if necessary

humble tulip
#

Bruh you're setting his velocity to his look direction * - 2

#

Which will push the player in the opposite direction they're facing

jagged badge
#

first vector is
location.clone().add(player.getLocation().getDirection().multiply(-2)).toVector()

#

it corresponds to the position on the sphere of radius 2 around the initial position

humble tulip
#

Do you want the player to fly or you want the camera to move

#

As of they moved their mouse

wise mesa
jagged badge
humble tulip
#

Setting the velocity is they wrong thing

#

You wanna tp the player instead

#

But in increments

jagged badge
#

no it will glitched

humble tulip
#

Basically you wanna lerp it

#

So small increments

#

Alternatively, you can probably make the player spectate something and then lerp that

#

So the client smooths it out

#

Hein?

humble tulip
#

Yes lerp

kind hatch
#

Linear Interpolation

humble tulip
#

Basically if you want the player to look from A to B

#

You do it in small increments

#

Lerping isn't the right term

#

But you can use the concept

jagged badge
#

but the problem is that on one server it works and on the other it doesn't. Otherwise my thing works the way I want it to. It's already moving the player a little bit at a time

kind hatch
#

I mean, you could lerp if you were wanting to smooth it out.

jagged badge
#

if I teleport the player every tick, it will block his yaw/pitch, the player won't be able to look in another direction for me to move him

#

with small move or not

remote swallow
#

doing it every tick wont look smooth probably

wise mesa
#

this has me thinking

#

is it possible to spectate an item display?

#

are you able to spectate any entity?

young knoll
#

Should be able to

kind hatch
#

Player#setSpectatorTarget(Entity entity) exists, but it only works if the player is already in spectator mode.

young knoll
#

Display entities have no hitbox so I don’t think you can manually spectate them

kind hatch
#

Is the hitbox a requirement for spectating?

wise mesa
#

manually spectating yes

#

but I was just curious if you could force it to happen

#

im thinking you could turn on display lerping

#

and have them spectate an empty display

#

and it would look nice

#

but idk

young knoll
#

Interpolation doesn’t move the entity

#

It only changes its transformation

wise mesa
#

no im aware

#

and then you would move the entity

#

wait

#

oh

kind hatch
#

Do the display entities not get a UUID assigned to them? I thought you could remove them with the /kill command.

wise mesa
#

i understand now

kind hatch
#

Odd, I'm not getting an option to do so.

#

It looks like you can spectate the display entities though.

#

At least with the vanilla commands.

#

So it should be possible with the api.

wise mesa
#

the problem is that they have no hitbox

#

so you can't look at them and hit tab and have it autofill their uuid

#

so you'd have to use some other command to get it

kind hatch
#

It's working for me.

#

The UUIDs are an issue though.

#

I had to use the limit selector.

wise mesa
#

yes

kind hatch
#

/spectate @e[type=minecraft:text_display,limit=1]

wise mesa
#

right

#

because you can't use tab to get it

kind hatch
#

You could probably do a range as well

wise mesa
#

im sure there's some command that can tell you the uuid of entities near you

kind hatch
#

It should be significantly easier with actual code though since you can just call Entity#getUniqueId()

kind hatch
young knoll
#

Don’t compare strings with ==

#

Use .equals or .equalsIgnoreCase

topaz atlas
#

Omg these things are so simple and im so dumb, sorry, im not used to this. Thanks.

kind hatch
# kind hatch Probably the data command.

Idk why the distance flag doesn't work properly, but if you find a way to get it to work, you can be more precise, /data get entity @e[type=minecraft:text_display,limit=1]

young knoll
#

Should just be distance =..x

wise mesa
#

what did you do for range

young knoll
#

Where x is the number

kind hatch
#

distance=10

wise mesa
#

you have to do ..x to specify up to x

kind hatch
#

That's what I did

wise mesa
#

they removed distance a long time ago

#

range now

#

nop

kind hatch
#

I think you got that backwards.

wise mesa
#

you right

#

anyways distance=10 means exactly 10 blocks

#

..10 means up to 10

kind hatch
#

I was well within the 10 block range.

#

I wasn't even 2 blocks away from it.

wise mesa
#

reread my message

#

distance=10 --> the distance of the entity is 10.0 exactly blocks away from you

kind hatch
#

Wat?

wise mesa
#

distance=..10 --> the distance of the entity is 10.0 or less blocks away from you

kind hatch
#

Is that the new way to do range?

wise mesa
#

since they replaced range with distance

#

yes

kind hatch
#

I would have never guessed that.

wise mesa
#

no its a little weird

kind hatch
#

Is it specifically 2 dots or does 1 dot do anything different?

wise mesa
#

useful once you get used to it

#

1 dot is a decimal place

#

you can do ranges

#

2..10

#

for example

#

its interesting

kind hatch
#

Idk why they didn't just use the - sign. It's not like you can have a negative distance.

wise mesa
#

because they're used in other places to

#

its a way to do ranges in selectors

#

distance is just a common place to make use of it

#

and .. is taken from programming languages that use it

rigid otter
#

In v1.12.2, before BlockData
How to set a block to, for example, Black Concrete?
Because there is only Material.CONCRETE available. And I don't see Concrete extends MaterialData

wise mesa
#

somewhat common range notation

regal scaffold
#

What's the replacement for

young knoll
#

Black is uhh

kind hatch
wise mesa
#

here's rust

young knoll
#

Concrete meta data 15

#

I think

regal scaffold
#

new HoverEffect(HoverType, BaseComponent)

wise mesa
#

and don't use them as fucking std::iota

#

hate c++

regal scaffold
rigid otter
kind hatch
wise mesa
#

i just did?

kind hatch
#

Oh, I see the screenshot.

wise mesa
#

hahaha

#

it might just be rust actually

#

i can't find any others 😅

#

but the notation is at least preexisting

young knoll
#

Mojang secretly invented rust

#

Confirmed

wise mesa
#

confirmed

regal scaffold
#

What

#

What's the flag to allow copy defaults into config on Main.java

kind hatch
wise mesa
#

looks like haskell has something pretty similar

young knoll
#

For blocks I think it was like

wise mesa
young knoll
#

setTypeAndData

#

Idk 1.12 is like 73 years old

wise mesa
#

rust probably just stole them from haskell

#

as all great things do

kind hatch
regal scaffold
#

There's something you need to enable

rigid otter
regal scaffold
#

To then use getConfig().addDefault()

#

Is it that?

#

Edit on runtime

young knoll
#

The defaults system is cursed

kind hatch
#

Facts

young knoll
#

What exactly do you want to do

regal scaffold
#

I just want to be able to use

kind hatch
#

That's why I don't ever use it. lol

regal scaffold
#

addDefaults()

#

In my onEnable

young knoll
#

If you want defaults, ship a default file

kind hatch
#

It'll make your life so much easier.

regal scaffold
#

That's not what addDefaults is for... Adding a value if it isn't there

#

And not override anything

young knoll
#

That’s just (!isSet) {
set
}

wise mesa
#

he wants if the user deletes a section it'll get regenerated

#

yea that'll work

young knoll
#

I thought add defaults added some invisible default values that would be returned if you tried to get() a path that didn’t exist

#

Idk like I said I’ve never used them

kind hatch
regal scaffold
#

AddDefault copies to the file

#

A default value

remote swallow
#

addDefault doenst copy by defauly

regal scaffold
#

Wut

remote swallow
#

by default calling addDefault wont copy anything, you have to config.options().copyDefaults(true) and that only works if the config doesnt exist iirc

eternal oxide
#

if you addDefault and save the config those defaults will not be put in the saved config.

regal scaffold
#

That's what it was

#

That's what I was asking for

#

config.options.copyDefaults(true)

eternal oxide
#

yes, copyDefaults(true) will replace any missing sections so you can save

regal scaffold
#

Ok good

#

So now

#

What's the order

humble tulip
#

Set copydefualts after saveDefaultConfig

regal scaffold
#

saveDefaultConfig()
copyDefaults(true)

#addDefault()

humble tulip
#

Yes

regal scaffold
#

And then there's the save

#

Or nowhere

humble tulip
#

Not sure abt the saving

eternal oxide
#

well no

#

if you saveDefaultConfig teh config from yoru jar is saved, IF no config already exists.

regal scaffold
#

Yes

#

And then

copyDefaults(true) + config.addDefault(val)

#

Will write to the file

kind hatch
#

No it wont.

#

It will write to the cached version. At least it should if is using MemorySection.

eternal oxide
#

so what would be better is getConfig().setDefaults(ne FileConfiguration(...getResource(path)
then config.save

regal scaffold
#

jesus

#

Ok

#

So weird

eternal oxide
#

oh copyuDefaults(true) after setting defaults

remote swallow
#

thats why we use a pre made config updater

regal scaffold
#

Yeah

#

But I just wanted to understand it

#

What is

#

this.save()

kind hatch
#

Probably some extended method from another class.

regal scaffold
#

What would it do

eternal oxide
#

he probably means saveConfig()

regal scaffold
#

Yeah

#

Thought so

kind hatch
#

Oh, well it takes the cached config and writes it to disk.

regal scaffold
#

Ahhhhhh

#

That makes so much more sense

#

And how do you do that

kind hatch
#

By using that method.

regal scaffold
#

Yeah but the logic

#

Cause we don't have the method

kind hatch
#

Are you using the default config?

regal scaffold
#

Yes

kind hatch
#

Then you can just call JavaPlugin#saveConfig()

regal scaffold
#

There you go!

#

That's so much easier than what we were saying

kind hatch
#

Otherwise if you were dealing with normal FileConfigurations, you'd have to call FileConfiguration#save()

regal scaffold
#

Fantastic

#

Yup

#

Understood now

shadow gazelle
#

Is there some way to access the shearing loot tables for an entity to so that I can generate the loot?

regal scaffold
#
        saveDefaultConfig();
        getConfig().options().copyDefaults(true);
        
        //Whatever you want with getConfig.addDefault();

        this.saveConfig();
#

Like a charm

round finch
#

(Java) Spigot + Math / code for shapes

#

if anyone wanna add some cool shapes be free

kind hatch
#

Are discord threads stored permanently? Or do they dissapear after some time.

shadow gazelle
#

They get closed, but they can be reponeded

#

They're just there forever until they're deleted like a channel is, but they can also be deleted by the person who created them

rigid otter
#

In v1.12.2, why is this deprecated as Magic value?

    /**
     * @param type the type
     * @param data the raw data value
     * @deprecated Magic value
     */
    @Deprecated
    public MaterialData(final Material type, final byte data) {
        this(type.getId(), data);
    }
kind hatch
#

It's deprecated in 1.13+ because items now use namespaces.

rigid otter
#

Why shouldn't I set the data?

rigid otter
#

Ahh

kind hatch
#

You can ignore that warning if you are using 1.12 or below.

rigid otter
#

OK thank you

eternal oxide
#

Threads are 2 weeks by default I believe

shadow gazelle
#

Three days unless you change it and there might be a server setting to change it to two weeks automatically

young knoll
#

Until they get archived

#

But they stay archived and don’t get deleted as long as the channel doesn’t

kind hatch
#

I remember trying to load an archived thread and it taking 15+ minutes to load the content.

young knoll
#

A discord employee has to manually go get the tape and load it into the system

wild cedar
#

Hey, I'm trying to outline(aka glow?) a block, exactly how you could do it for entities starting from version 1.16 I guess... Since you can't outline a block, it has to be an entity, I decided to spawn the falling block of the block that I'm looking at for the sake of the test and:

  1. Make it invisible
  2. Make it not affected by gravity
  3. Make it have an outline

I tried searching in forums, including spigot and each have different answers with different ways that are not working/not what I wanted.
However I'm getting this result, in the video below, I provide the code I used in the thread as well. I would appreciate any help. I'm using NMS 1.19.4 as well.

https://cdn.discordapp.com/attachments/902581431019135029/1101347007492259890/8mb.video-92U-RtAOKUjC.mp4

young knoll
#

1.19.4 it should be easy with a display entity

#

Or an interaction entity

#

Before that I think shulkers were a common method

kind hatch
#

1.19.4 BlockDisplay has #setGlowColorOverride(). Absolute chad method that exists.

wild cedar
#

Indeed, 1.19.4 may have display entities but 1.19 doesn't, which that's why I decided to achieve it using this way

kind hatch
#

I think one method people used was using shulkers since they fit the block perfectly and set their color using the scoreboard teams.

wild cedar
#

I also heard of shulker method, but the scoreboard is new.

summer scroll
#

How can I achieve something like for example the higher the player balance is, the chances of creeper spawned near them is lower. So initially, the player will start with $1000, and the chance of creeper being spawned on them every hour is 50%, if player has higher balance, the chances will be lower, how can I achieve something like that?

Sorry if it's hard to understand, i'm struggling finding the right sentences.

kind hatch
young knoll
#

The only thing you can really do for spawning is either

  • make your own entire custom spawning system
  • cancel/replace spawn events
kind hatch
young knoll
#

I don’t think that effects what mobs spawn

#

Just how they are equipped

wary topaz
#
    public void onClick(PlayerInteractEvent event) {
        if (event.getItem() != null) {
            if (Objects.requireNonNull(Objects.requireNonNull(event.getItem()).getItemMeta()).getDisplayName().equals(ChatColor.RED + String.valueOf(ChatColor.BOLD) + "Server Selector")) {
                event.getPlayer().performCommand("serverselector");
            }
        }
    }```

I really dont know what's happening
#

supposed to bring up a gui

#

it is a bungeecoord command if that matters

#

okayyeah it prob does but how can I get passed that?

eternal oxide
#

event.getPlayer().performCommand("serverselector"); does not go through bungee

wary topaz
#

than what do I do?

eternal oxide
#

you can not issue commands for bungee through that API

wary topaz
#

what api do you mean?

#

spigot?

eternal oxide
#

performCommand

wary topaz
#

so which one is it?

#

dont you dare tell me nms

eternal oxide
#

there is no method

wary topaz
#

is it possible to have on click events in bungeecoord?

#

so I can transfer the ode

eternal oxide
#

you obviously have a plugin running on Spigot so why are you tryign to issue a command to bungee?

wary topaz
#

the bungeecoord has a special api with ability to create GUIS

#

that api needs to be accessedin offline mode

#

so no mysqy

eternal oxide
#

api offline? what?

wary topaz
#

the plugin is not offline but it works perfeclty fine

#

this is the gui coded in bungeecoord

eternal oxide
#

just do it on Spigot using messaging channels

#

you can get a list of all servers

wary topaz
#

this gui took 5 hours

#

and its not convertable

eternal oxide
#

?pmc

wary topaz
#

i ust messaging channels

#

use*

#

for a /connect command

eternal oxide
#

pmc has built in methods for gettign server lists and switching servers

wary topaz
#

i said im already using pmc

eternal oxide
#

nowhere that I saw

wary topaz
eternal oxide
#

thats not even english

wary topaz
#

yeah I corrected the "use"

eternal oxide
#

ah

#

if you already use pmc then it's simple

#

that GUI is really basic

round finch
#

gettign

eternal oxide
#

lots 🙂

#

at least mine had all teh correct letters 🙂

wary topaz
#

is there a way I can do a shaped gui?

eternal oxide
#

yes that teh was intentional 🙂

round finch
#

teh heh

eternal oxide
#

shaped GUI? datapacks

wary topaz
#

no like normal 9x4 but just replace the "x"& "o" with blocks

#

liked shaped recipes

eternal oxide
#

not sure what you mean by "shaped" then

wary topaz
#

"xox"
"oxo"
"xox"

REPLACE X WITH SANDSTONE
REPLACE O WITH DIRT

#

but in a 9x4 saison

wary topaz
#

thats not helpful./.

round finch
eternal oxide
#

um, it's what you asked for, no?

wary topaz
#

this but for inventorys

eternal oxide
#

recipes are not inventories

wary topaz
#

omg

round finch
#

yup

eternal oxide
#

the matrix is, kinda

wary topaz
#

im saying like similar

eternal oxide
#

I'm clearly not understanding the "similar" part

kind hatch
#

It’s possible. It’s been done in a few of the countless inventory frameworks that exist.

eternal oxide
#

you want a recipe you can push to an inventory?

wary topaz
#

;-;

#

am I the only one who knows what i'm talking about?

kind hatch
#

It’s just a larger matrix. You need a chat array and to map the chats to the items.

#

Char*

wary topaz
#

YES a char array

#

but shadow do you agree with elgar that you cant execute bungeecoord commands with any spigot api?

eternal oxide
#

so just char[][]

kind hatch
#

Yes. That’s what the messaging channel is for.

wary topaz
#

so use dispatch command?

kind hatch
wary topaz
#

so i dont need to recreate the gui!

#

phew

kind hatch
#

You obv have to make it yourself, but it’s more than possible.

#

It’s already been done before.

wary topaz
#

can I see?

kind hatch
#

Again, just look up some of the inventory frameworks on spigot. A couple of them have it.

wary topaz
#

frameworks?

#

why?

#

I already have the gui made in bungeecoord

eternal oxide
#
char[][] matrix = {
    {x,x,x,o,o,o,x,x,x},
    {x,x,x,o,o,o,x,x,x},
    {x,x,x,o,o,o,x,x,x},
    {x,x,x,o,o,o,x,x,x} };```
kind hatch
#

I just can’t remember the names of them right now.

wary topaz
#

protolizer

wary topaz
eternal oxide
#

you don;t use a matrix there

wary topaz
#

its for the 9x4 gui

#

idk why he put the o's but its fine

#

I dont see any reason to continue working in bungeecoord

eternal oxide
#

there isn;t any

#

not for this

wary topaz
#

ill just delete that mess

round finch
#

it took me 3 days to finally make chatgpt give me the right math for
a 3d Ellipsoid

#

i really wish to learn the math that i need for that stuff

round finch
#

bruh it works for me!

#

now i can make a Ellipsoid there can turn 2 ways

eternal oxide
#

oh if I'd have realized I have code to do that 😦

#

well actually to draw an elipse perimiter with particles

#

adding a 3rd dimension would be easy

round finch
#
public static void generateEllipsoid(World world, Location center, int width1, int width2, int depth, Material material, double theta, double phi) {
        int a = width1 / 2; // horizontal radius
        int b = width2 / 2; // vertical radius
        int c = depth / 2; // depth radius

        // Adjust loop limits to add more space
        int xMin = -a - 5;
        int xMax = a + 5;
        int yMin = -b - 5;
        int yMax = b + 5;
        int zMin = -c - 5;
        int zMax = c + 5;

        for (int x = xMin; x <= xMax; x++) {
            for (int y = yMin; y <= yMax; y++) {
                for (int z = zMin; z <= zMax; z++) {
                    double x1 = x;
                    double y1 = y * Math.cos(theta) - z * Math.sin(theta);
                    double z1 = y * Math.sin(theta) + z * Math.cos(theta);
                    double x2 = x1 * Math.cos(phi) - z1 * Math.sin(phi);
                    double y2 = y1;
                    double z2 = x1 * Math.sin(phi) + z1 * Math.cos(phi);
                    double distance = (x2 / a) * (x2 / a) + (y2 / b) * (y2 / b) + (z2 / c) * (z2 / c);
                    if (distance <= 1) {
                        Location loc = center.clone().add(x, y, z);
                        world.getBlockAt(loc).setType(material);
                    }
                }
            }
        }
    }
#

(x^2/a^2) + (y^2/b^2) + (z^2/c^2) = 1

where x, y, and z are the coordinates of a point on the surface of the ellipsoid.

To rotate the ellipsoid, you can apply a transformation matrix to the coordinates (x, y, z) before plugging them into the equation. The matrix depends on the angles of rotation (theta and phi) and can be written as:

[ cos(theta)*cos(phi), -sin(phi), sin(theta)*cos(phi) ]
[ cos(theta)*sin(phi), cos(phi), sin(theta)*sin(phi) ]
[ -sin(theta), 0, cos(theta) ]

Multiplying this matrix by the column vector (x, y, z) gives you the rotated coordinates (x', y', z'):

[ x' ] [ cos(theta)*cos(phi), -sin(phi), sin(theta)*cos(phi) ] [ x ]
[ y' ] = [ cos(theta)*sin(phi), cos(phi), sin(theta)*sin(phi) ] * [ y ]
[ z' ] [ -sin(theta), 0, cos(theta) ] [ z ]

Then you can plug x', y', and z' into the equation for the ellipsoid to get the rotated surface.

#

chatgpt made it for me and i can't do math

eternal oxide
#

nice

#

it's going to take all our jobs

#

you seen that YT vid where the guy gets it to write an angry birds game?

round finch
#

postives and negatives i'm right

#

more time to enjoy what you like

cobalt thorn
eternal oxide
#

yeah, except you need money for leisure