#help-development

1 messages ยท Page 2261 of 1

quaint mantle
#

What is your point

quiet ice
#

Performance

quaint mantle
#

?!?!

#

Obviously use hasItemMeta when you dont access the meta

#

Also you're talking microseconds of performance

#

it doesnt matter

quiet ice
#

ItemMeta#clone is a pretty expensive call

quaint mantle
#

๐Ÿ™‚

quiet ice
#

We are talking in dozens of ฮผs

quaint mantle
#

๐Ÿ˜ฑ

#

Someone doesnt know what multilining means

quiet ice
#

ItemStack#equals can be discarded anyways

quaint mantle
#

Huh

somber hull
#

Im redoing a plugin i madea while back basically from scratch

#

I need to generate a spawner with certain parameters as PDC values

#

Should i make a static class that has methods to generate that?
Also i have a bunch of namespaced keys. I have no idea what to name the class or package to put them in

quiet ice
quaint mantle
#

How can i make an npc teleport randomly to any player? (in a volume defined by me, that volume would be the map i have)

eternal oxide
#

npc.teleport(randomPlayer.getLocation())

quaint mantle
#

But

#

I forgot to add that the npc teleports from time to time to the player

eternal oxide
#

?scheduling

undone axleBOT
somber hull
#

Ok, since everyone is ignoring my previous messages. New question

I have a "DataManager" class that has methods that saves the dataconfig and all the file work. Then i have a "Data" class that is mapped into a file as the config (gotten with getConfig()). Should i use plugin.getDataManager().getConfig() or should i save object holding the config in my plugin class to do plugin.getConfig()

#

Maybe im overcomplicationg this

agile anvil
#

Otherwise change your whole structure

somber hull
#

Thank you

#

thats what i did

#

@lost matrix

public class Data {
    private final Map<UUID, String> playerListMap = new HashMap<>();
    
    /**
     * This method is used to get a clone of a players items from the config
     * @param playerUUID The target players UUID.
     * @return Returns clone of players items.
     */
    public List<ItemStack> getPlayerItems(UUID playerUUID) {
        if (!playerListMap.containsKey(playerUUID)) {
            putPlayerItems(playerUUID, new ArrayList<>());
        }
        return List.of(SerializationUtils.deserialize(playerListMap.get(playerUUID)).clone());
    }
    
    /**
     * This method simply puts the players items into the hashmap saved into the config
     * @param playerUUID The target player.
     * @param items The target playuers items.
     */
    public void putPlayerItems(UUID playerUUID, List<ItemStack> items) {
        playerListMap.put(playerUUID, SerializationUtils.serialize(items.toArray(new ItemStack[0])));
    }
    
}

I have spent an hour on this ๐Ÿ’€ but its the most beutiful looking code i have ever written

dense crow
#

heyho, i have a question. how do i catch out the nullpointerexeption when im asking for a location for a String what didnt got one at the moment?

public List < Location > getFdoorLoc(String frak) {
        List < Location > savedLocs = new ArrayList < Location > ();
        for (String locationID: data.getConfigurationSection(frak).getKeys(false)) {
                savedLocs.add(new Location(Bukkit.getWorld(data.getString(frak + "." + locationID + ".world")), data.getDouble(frak + "." + locationID + ".x"), data.getDouble(frak + "." + locationID + ".y"), data.getDouble(frak + "." + locationID + ".z")));
        }
        return savedLocs;
    }
dense crow
#

lol

somber hull
#

Also

#

I dont understand the second half of your question

dense crow
#

i wanna request locations for stringst who didnt got one

#

and it throws nullpointerexeption

somber hull
#

for strings who didnt got one

#

huh

eternal oxide
dense crow
#

my english is bad

somber hull
#

Thats fair

eternal oxide
#

seems very conflated though

dense crow
#

german schools dont teach good enough for it

somber hull
dense crow
#

but anyways im trying to get a location for a String like mex what didnt got any location at the moment

#

and i know its returning null

#

so i wanna catch it so i dont get a nullpointer

eternal oxide
dense crow
eternal oxide
#

Makes teh code above it redundant

somber hull
#

got it

#

one small problem tho

eternal oxide
#

ItemStack

#

or whatewver your List contains

somber hull
#

got it

#

oh wait

#

shit

#

you just pointed out a big whoopsie on my part

#

thank you for showing me that, but in this case that wont work

#

Cause its not a array its a serialized array stored in a string

eternal oxide
#

yep

somber hull
#

So i should check

#

If it doesnt have the key

#

And then make a new array and return that

eternal oxide
#

yes

somber hull
eternal oxide
#

you can still use getOrDefault

somber hull
#

wait

#

you might be right

#

i might be stupid hold up

#

Yea no getOrDefault wouldnt work here

#

i dont think

#
    public List<ItemStack> getPlayerItems(UUID playerUUID) {
        if (!playerListMap.containsKey(playerUUID)) {
            return new ArrayList<>();
        }
        return List.of(SerializationUtils.deserialize(playerListMap.get(playerUUID)).clone());
    }
#

that would be what would work

#

And since im cloning the existing value

#

It doesnt matter that the new value is a new array

#

Cause i will have to use putPlayerItems() anyway

#

Unless you have a way of optimizing that

#

@eternal oxide Thoughts on saving namespacedkeys in my main class like this?

#
public class BetterSpawners extends JavaPlugin {
    public final NamespacedKey ENTITY_TYPE_KEY = new NamespacedKey(this, "bs.entityType");
    public final NamespacedKey MULTIPLIER_KEY = new NamespacedKey(this, "bs.multiplier");
    public final NamespacedKey MINED_KEY = new NamespacedKey(this, "bs.wasMined");
    public final NamespacedKey OWNER_KEY = new NamespacedKey(this, "bs.ownerName");
    public final NamespacedKey XP_KEY = new NamespacedKey(this, "bs.xpAmount");
    public final NamespacedKey LAST_GEN_KEY = new NamespacedKey(this, "bs.lastGen");
eternal oxide
#

You literally push an empty array if there is no entry for the player

somber hull
#

Cant think of a better place lmao.

eternal oxide
#

so just do the same, push an empty array with getOrDefault instead of pushign an empty one first

somber hull
#

Maybe im not understanding how getordefault works

eternal oxide
#

oh actually you don;t push an empty one, you return an empty one

#

I see

somber hull
#

ye

eternal oxide
#

if there is no entry you don;t add one, you just return an empty List

somber hull
#

Yed

eternal oxide
#

then you are correct

somber hull
#

thats a first

eternal oxide
#

Mine would bloat teh data with empty arrays using getOrDefault

eternal oxide
#

move to a contants file. somethign like KEYS

#

static

somber hull
#

It cant be static

#

it requires a plugin instance

eternal oxide
#

BetterSpawners.KEYS.ENTITY_TYPE_KEY

#

you can pass a plugin reference to a static class

somber hull
#

How?

somber hull
#

Assuming KEYS is a class?

quaint mantle
#

What would be the specific event to make an npc teleport? and these, (the npcs) are entities and not players I guess, right?

eternal oxide
#

?paste

undone axleBOT
quaint mantle
#

?

somber hull
#

Step 1: Realize you can cancel events
Step 2: Find PlayerQuitEvent
Step 3: troll

somber hull
#

and hes using a paste to be nice

quaint mantle
#

Oh ok

eternal oxide
somber hull
#

is that how static is supposed to be used?

eternal oxide
#

yes

somber hull
#

Oh ok

eternal oxide
#

constants

somber hull
#

thank you so much for that

somber hull
eternal oxide
#

no

somber hull
#

oh

#

i see why

eternal oxide
#

You'd not be able to assign it if it was

somber hull
#
    public static Keys KEYS;
    
    public BetterSpawners(){
        KEYS = new Keys(this);
    }
#
public class Keys {
    private static BetterSpawners plugin;
    
    public Keys(BetterSpawners plugin) {
        Keys.plugin = plugin;
    }
    public static final NamespacedKey ENTITY_TYPE_KEY = new NamespacedKey(plugin, "bs.entityType");
    public static final NamespacedKey MULTIPLIER_KEY = new NamespacedKey(plugin, "bs.multiplier");
    public static final NamespacedKey MINED_KEY = new NamespacedKey(plugin, "bs.wasMined");
    public static final NamespacedKey OWNER_KEY = new NamespacedKey(plugin, "bs.ownerName");
    public static final NamespacedKey XP_KEY = new NamespacedKey(plugin, "bs.xpAmount");
    public static final NamespacedKey LAST_GEN_KEY = new NamespacedKey(plugin, "bs.lastGen");
}`
eternal oxide
#

yep

somber hull
#

awesome

#

i cant test anything yet cause nothing works yet ๐Ÿ’€

#

im redoing a big plugin

#

Its looking great

#

@eternal oxide

#

hold up

#

plugin.KEYS.ENTITY_TYPE_KEY

#

or

#

Keys.ENTITY_TYPE_KEY

eternal oxide
#

plugin

somber hull
#

doesnt that defeat the purpose of making it static?

eternal oxide
#

yes, you could remove all the statics in keys

somber hull
#

got it

eternal oxide
#

so they are protected

somber hull
#

Should i remove it from private static BetterSpawners plugin;

eternal oxide
#

its mornign for me, so not fully awake

#

yes

somber hull
#

its alr

#

got it ok

eternal oxide
#

no need to static access within Keys

tardy delta
iron glade
#

Any way to add a player twice to the player list? Or add a fake player to it?

somber hull
#

idk how

#

but citizens has a bug

#

where npcs will show up there

#

so im sure you could recreate that

eternal oxide
somber hull
#

So

#

I have a system

#

With "dynamic permissions"

#
gui:
  groups:
    #Use default group if user does not have any betterspawners.group.(group)
    default-group:
      spawner-amount: 3
      cansilk: false
    # Groups to be used in permissions, so betterspawners.group.(group)
    custom-groups:
      vip:
        spawner-amount: 5
        cansilk: true

      admin:
        spawner-amount: 10
        cansilk: true
#

So i was told to create some way to track these groups on startup. And then keep track of them from that rather than from checking the config every time

#

They might have been referring to generally any config value.

#

Not sure, anyway how would i go about that?

#

@eternal oxide

#

Create a "groups" class holding those values?

eternal oxide
#

create a properties class to hold the data for each group

#

then read and store each in a HashMap

somber hull
#

is that essentially what i said lmao

somber hull
eternal oxide
#

yep

somber hull
#

What would the value be?

eternal oxide
#

stores under a key

#

the name of the group

somber hull
#

Ahhh

#

Im stupid

#

thank you

eternal oxide
#

as I assume you are allowing editing of the config to create custom groups

somber hull
#

Yes

#

Should i save this hashmap in datamanager?

#

or main class?

#

wait

eternal oxide
#

a manager

somber hull
#

Like its own manager

#

yes

eternal oxide
#

yes

somber hull
#

i will do that

iron glade
#

Is this a spigot only thing? No imports found on paper

agile anvil
somber hull
#

This should work correct?

#
configSection.getInt(i + ".spawner-amount")
#
configSection = plugin.getConfig().getConfigurationSection("gui.groups.custom-groups");
iron glade
#

have you tried it?

somber hull
#
    custom-groups:
      vip:
        spawner-amount: 5
        cansilk: true

      admin:
        spawner-amount: 10
        cansilk: true
somber hull
#

But i dont know how configurationsection works

somber hull
somber hull
#

my bad

#

for (String i : configSection.getKeys(false)) {

#
        for (String i : configSection.getKeys(false)) {
            try{
                new Group(configSection.getString(i), configSection.getInt(i + ".spawner-amount"), configSection.getBoolean(i + ".cansilk"));
            }catch(Exception e){
                System.out.println("Error getting group " + i + ".\n" + e);
            }
        }
#

And catching that exception wont break the loop right?

#

@eternal oxide For the hashmap should i use it through a getter or through custom methods such as getGroup(String)

sharp flare
#

catching a generic exception is not really that good, I suggest you test this properly and make your assumptions when an exception pops up

eternal oxide
#

If it were me I'd get teh Map from the config and deserialize it

somber hull
#
    private void getGroups(){
        for (String i : configSection.getKeys(false)) {
            try{
                groupMap.put(i, new Group(configSection.getString(i), configSection.getInt(i + ".spawner-amount"), configSection.getBoolean(i + ".cansilk")));
            }catch(Exception e){
                System.out.println("Error getting group " + i + ".\n" + e);
            }
        }
    }
    
    public void resetGroups(){
        groupMap = new HashMap<>();
        getGroups();
    }

In resetGroups is that how to clear a hashmap?

somber hull
sharp flare
#

you can serialize a map in a config and deserialize it on retrieval

somber hull
#

I dont see how thats relevant?

sharp flare
somber hull
#

Yea so @eternal oxide i dont see how thats relevant

eternal oxide
#

Surely it should be new Group(i, ...)

somber hull
eternal oxide
#

I assume is the name?

somber hull
#

yeas

eternal oxide
#

then what is configSection.getString(i)?

somber hull
#

i replaced it with i

eternal oxide
#

groupMap.put(i, Group.deserialize(i, configSection.get(i).getValues(true));Probably

somber hull
#

well that seems a lot easier than what im doing

eternal oxide
#

do that for each group

somber hull
#

But that sleep deprivity is starting to kick in

#
    private Group getPlayerGroup(Player plr){
        String group = "default-group";
        for (String i : groupMap.keySet()) {
            if (plr.hasPermission("betterspawners.group." + i)) {
                group = i;
                break;
            }
        }
        return groupMap.get(group);
    }
    
    public boolean canPlayerSilk(Player plr){
        return getPlayerGroup(plr).getCanSilk();
    }
    
    public int getSpawnerAmount(Player plr){
        return getPlayerGroup(plr).getSpawnerAmount();
    }
#

this is what im doing

#
    private void getGroups(){
        for (String i : configSection.getKeys(false)) {
            try{
                groupMap.put(i, new Group(i, configSection.getInt(i + ".spawner-amount"), configSection.getBoolean(i + ".cansilk")));
            }catch(Exception e){
                System.out.println("Error getting group " + i + ".\n" + e);
            }
        }
        //Add the default section to the map.
        ConfigurationSection defaultGroupSection = plugin.getConfig().getConfigurationSection("gui.groups.default-group");
        groupMap.put("default-group", new Group("default-group", defaultGroupSection.getInt("spawner-amount"), defaultGroupSection.getBoolean("cansilk")));
    }
#

Im gonna review it in the morning

#

Caujse im super tired rn

eternal oxide
#

Your permission check is probaly going to mess up for Ops

#

actually, it may not as these are undefined permission nodes

mighty pier
#

is there a way to create a flat world?

eternal oxide
#

WorldCreator("MyWorld").type(WorldType.FLAT).createWorld();

#

you may have to add a generatorSetting string

left swift
#

Entity's hitbox size is defined only in the entity type or can it be changed per entity? (server side hitbox)

winged storm
#

how do i make a plugin

dire basin
#

guys, sorry for the stupid question: how to make the event activate on command?

chrome beacon
#

"the event"?

small current
#

guys in InventoryPickupItemEvent

#

how can i get the hopper or hopper minecart that picks the thing up

#

and its location

eternal oxide
#

getInventory().getType() == InventoyType.HOPPER

#

to get teh hopper itself get Inventory and getHolder()

#

is my guess

winged storm
#

is there an api documentatin for all the events and stuff

eternal oxide
#

?jd-s

undone axleBOT
winged storm
#

gracias

dire basin
chrome beacon
#

Do you want to activate a custom event

#

Or do you want to make a command

winged storm
#

how do i make the plugin type in chat

dire basin
chrome beacon
#

?eventapi

undone axleBOT
chrome beacon
winged storm
#

how

#

sorry im new

chrome beacon
#

Bukkit.broadcastMessage("Hello World!");

vocal cloud
#

Don't spoon

#

Give material to learn

chrome beacon
#

True

tardy delta
#

.

#

someone got nothin to do ig

vocal cloud
#

When I was in the hospital my home PC got me to 2 weeks

tardy delta
#

havent shut down my pc for 4 days or smth

winged storm
#

how to add variable to string

vocal cloud
#

By learning java first

chrome beacon
#

?learnjava

undone axleBOT
winged storm
#

how do i get the jar file

#

of te plugin

vocal cloud
#

By packaging it

tardy delta
#

ยฏ_(ใƒ„)_/ยฏ

#

"how do i destroy the pentagon?"

vocal cloud
#

I want a waffle toaster

winged storm
#

im using intellij btw

chrome beacon
#

Depends on the project

tardy delta
#

double ctrl and mvn package

#

lol

chrome beacon
#

You really should learn these things before starting with Spigot

vocal cloud
#

I'm gonna learn Gradle tbh.

#

Oh wait this isn't the therapy channel

chrome beacon
#

I started learning Gradle a bit back

#

I think I know everything I'm going to need

#

But there's so much you can do with it

eternal oxide
vocal cloud
#

Things take too long to package with maven.

vocal cloud
# winged storm i really should\

It's great you want to make a plugin but we need to rewind to learning java first. Some resources are above but lots of free content everywhere

winged storm
#

is using skript good?

#

i tried it

#

but i dont like it

chrome beacon
#

No it's not good

vocal cloud
#

Skript is fine if you're building something for yourself on a small scale. You want real control you need to use java.

winged storm
#

k

vocal cloud
#

Taking the training wheels off so to speak

winged storm
#

i packaged it

#

do i use the

#

origianl-MyuPlugin.jar

#

or

#

MuPLugin.kar

chrome beacon
#

Depends on if you shaded anything important

winged storm
#

whats the differecne

#

between them

vocal cloud
#

?shading

#

Sadge

chrome beacon
#

One is your code only it starts with original-

The other one contains other code that you included in it from your dependencies

tardy delta
#

shading includes some stuff..

#

thats all i can say smh

vocal cloud
formal bear
#

Ok so i made PlayerInteractionEvent to check if player right-clicks playerhead, how to check if the playerhead has custom data from for example https://minecraft-heads.com/

vocal cloud
#

Isn't there a meta for heads SkullMeta or w/e

chrome beacon
#

There is

#

If you're on 1.18.2 or above there is api for this

formal bear
#

1.18.1 sadly

chrome beacon
#

Oh well NMS it is then I believe

eternal oxide
#

no reason to be on 1.18.1

chrome beacon
#

^

formal bear
#

if i want to rebuild project for 1.18.2 api, i need to just change pom.xml?

vocal cloud
#

Yup

#

1.18.1 is kinda sus

tardy delta
eternal oxide
#

I never knew that was there

tardy delta
#

kekw

winged storm
#

why isint my plugin working

tardy delta
#

lmao we are supposed to smell that or smth?

#

errors?

winged storm
#
    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
        Bukkit.broadcastMessage("Welcome!" + event.getPlayer() + "Hope you enjoy your stay!");

        Player player = event.getPlayer();

        player.giveExp(100000);
    }
#

anythuing wronmg with taht

tardy delta
#

you registered it?

winged storm
#

register?

tardy delta
#

in your onEnable: getServer().getPluginManager().registerEvents(new ListenerClass(), this)

vocal cloud
#

Definitely some things wrong with that. But run it and find out cause you'll see.

tardy delta
#

mye use the event::setJoinmessage instead

#

and other stuff..

vocal cloud
#

They'll figure it out when it runs

winged storm
#
    @Override
    public void onEnable() {
        // Plugin startup logic
        getLogger().info("Yo bro, my awesome plugin is working!");
        getServer().getPluginManager().registerEvents(new ListnerClass(), this);

    }
#

like this?

vocal cloud
winged storm
#

tias is also here lmfao

vocal cloud
#

Yuppers

winged storm
#

cannot find symbol

tardy delta
#

what symbol

winged storm
#
        getServer().getPluginManager().registerEvents(new onPlayerJoin(), this);
#

is this wrong

eternal oxide
#

yes

#

you are (I assume) trying to register a method in your Main class so registerEvents(this, this);

tardy delta
#

oh god

#

makes sense that it cannot find your listener class if you dont have one

vocal cloud
#

Ah the joys of learning

winged storm
#

ay it works

#

kinda

tardy delta
#

the java channel in the coding den is even worse

#

people not following conventions at all

vocal cloud
#

I left that place it was too toxic and I realized that learning through discord suxs

winged storm
#

depends on what you're learning

vocal cloud
#

I'm 99% sure that unless you're learning about power tripping moderators or how little social interaction effects peoples ability to communicate properly there are better learning sources lol

winged storm
#

perhaps

formal bear
#

I'm confused

vocal cloud
#

?jd-s

undone axleBOT
formal bear
#

Skull block tysm

kind coral
#

how could i store info inside blocks previous to 1.16?

eternal oxide
#

only Blocks with TileStates hold data

#

?pdc

tardy delta
#

or use the chunk pdc

#

kinda hacky

dim palm
winged storm
#

i figured that out

#

but thanks anyways

umbral bear
#

Hey @chrome beacon, sorry for ping, but i wanted to let you know that i fixed my issue

#

googling a bit more i found out that i needed to use \\ instead of \

quaint mantle
#

How do I know how many slots should be filled?

quaint berry
#

Is this just broken for 1.18.2? I'm using the correct dependency and the correct API version but nothing happened on the events?

#

Sorry for butting in

tardy delta
#

(rowto - rowfrom) * (colonto - colonfrom)?

lost matrix
tardy delta
#

7smile why are you so fast..

quaint berry
#

Thanks

#

I'm special

quaint berry
#

๐Ÿ‘๐Ÿป

lost matrix
quaint mantle
tardy delta
#

well idk why you should use such a method too

#

who not just taking a start and end index as params

quaint mantle
#

At the end I have to check if all slots are filled

eternal oxide
#

I gave you all the code you needed yesterday. You should be checking the number of items sent before you start filling a UI

#

Its no good shoving everything into a UI and finding you don;t have room

quaint berry
#

Sorry to but in but what api-version do you use for a 1.18.2 plugin in the plugin.yml?

#

1.18.2 doesn't work

eternal oxide
#

1.18

quaint berry
#

Oh

#

Thanks

quaint mantle
eternal oxide
#

Thats not going to work... one sec

quaint mantle
#

No, you're right, though.

eternal oxide
#

?paste

undone axleBOT
eternal oxide
#

fully working, just add it as a listener to see how it works

zenith spire
#

I'm trying to store a list of objects in a json file. Saving works fine with serializing and gson.
But i can't get reading to work. Are there any examples on how to do that, or other ways to do that?

eternal oxide
#

what objects?

lost matrix
mortal hare
#

afaik you need them not make non static in order for this to work

tardy delta
#

he didnt register it

mortal hare
#

oh

#

so you can make it static

tardy delta
#

ye but kinda weird

zenith spire
lost matrix
zenith spire
#

also does spigot include any form of json library?

lost matrix
lost matrix
lost matrix
# zenith spire also does spigot include any form of json library?

As you are not willing to provide any more information: Here is the general approach.

Saving a map:

    // Your data map
    Map<UUID, PlayerData> dataMap = ...;

    // Creating a json string from that map
    String jsonString = gson.toJson(dataMap);

    // <- Save the string in a File

Loading a map:

    // Reading the string from a file
    String jsonString = ...;
    
    // Creating a type token because the class we want to serialize is generic
    Type typeToken = new TypeToken<Map<UUID, PlayerData>>() {}.getType();

    // Deserialize the json string
    Map<UUID, PlayerData> dataMap = gson.fromJson(jsonString, typeToken);
tardy delta
#

lets go its finished

#

lets clean up those method names a little

#

150 lines mwoa

#

lets see how essentials does it

manic bison
#

Hello,

if i have 3 coordinates :
-178 62 193
345 3 -1
0 134 -1033

how could I do to check which coordinates of these 3 is the most near to a player

tardy delta
#

weak they only have 50 lines

lost matrix
tardy delta
#

why is there even a squared method?

manic bison
#

okay lets use my math knowledge

#

ill try

lost matrix
tardy delta
#

hmm

#

oh right i remember that from math class ages ago...

lost matrix
#
|a| = โˆšx^2 + y^2

And squaring this us just

|a| = x * x + y * y

Which is way cheaper to calculate

twilit roost
#

PlayerDropItemEvent
When I cancel the Event and try
Player#getInventory#remove(Event#getItem)
it just cancels event
and doesn't do anything else..
any clue why?

#
ItemStack i = e.getItemDrop().getItemStack();

e.setCancelled(true);
p.getInventory().remove(i);
twilit roost
#

using bukkit runnable or is there some other way to wait a tick

tardy delta
#

scheduler.runTask

lost matrix
# manic bison ill try
  public Location closest(Location target, List<Location> points) {
    double smallestDistance = Double.MAX_VALUE;
    Location closestLocation = null;

    for(Location point : points) {
      double distance = target.distanceSquared(point);
      if(distance < smallestDistance) {
        smallestDistance = distance;
        closestLocation = point;
      }
    }

    return closestLocation;
  }

๐Ÿฅ„

manic bison
#

so basically ill do this?

#

โˆš[(xโ‚‚ - xโ‚)ยฒ + (yโ‚‚ - yโ‚)ยฒ]

paper viper
#

No square root

lost matrix
quaint mantle
#

Hello someone knows how to use maven ?

tardy delta
#

yes lol

manic bison
paper viper
#

Ask your question

quaint mantle
#

So some time ago I purchased source code for a Discord bot and the guy built for me the source code and it used to look like this and everything was good
https://media.discordapp.net/attachments/994579878336811079/994580155601264680/unknown.png

but now my bot have new token and when I try to install it with maven it looks different:
when I install the source code (target/) :
https://media.discordapp.net/attachments/994579878336811079/994580296462774312/unknown.png
and when i try run the HoloInvites.jar it aint working

left swift
#

How can I teleport entity relatively to other entity'r direction? I mean when other entity e.g will turn then teleported entity changes self position

paper viper
twilit roost
quaint mantle
paper viper
#

pom

paper viper
#

Can we not have a picture of a section

#

But the whole thing

quaint mantle
#

but I meant why there is different structure when i install and he install

quaint mantle
quaint mantle
#

I dont really know Java

paper viper
#

He probably used a different build tool or the built in one

quaint mantle
#

The difference is just the structure ?

paper viper
#

I need your full pom, not just a screenshot of some of the dependencies

#

Use this:

#

?paste

undone axleBOT
quaint mantle
paper viper
#

I think you chose the Jar without dependencies

#

I think the error is caused by the dependencies being missing and not shaded.

#

Just to check, what is the size of the original JAR compared to the one you made?

#

Because also in your pom I donโ€™t see any shading configuration setup

quaint mantle
#

alright

#

yeah I also think its dependencies

#

when I try to mvn verify

#

how do i fix that ?

#

when I try to download in maven menu it just dont download

paper viper
#

Search online for maven shading guide and implement it

fiery prairie
#
        }else if (command.getName().equalsIgnoreCase("healther")) {
            if (sender instanceof Player) {
                Player p = (Player) sender;
                if (args.length == 0) {
                    p.sendMessage(ChatColor.translateAlternateColorCodes(&, getConfig().getString("heal-success")));
                    p.setHealth(p.getAttribute(Attribute.GENERIC_MAX_HEALTH).getDefaultValue());
                }else if(args.length == 1){
                    Player target = Bukkit.getServer().getPlayer(args[0]).getName();
                }
           ```
Errors:
#

Help?

#

p.sendmessage from args.length==0 is line 54

sudden violet
#

first up, youve got a floating &

fiery prairie
#

floating?

sudden violet
#

ChatColor#translateAlternateColorCodes(Char, String);

#

surround your & with '

fiery prairie
#

alright i have this now

sudden violet
#

if your args.length == 0 is line 54, your line 57 is the else if?

fiery prairie
#

57 is Player target = bukkit and more on in that line

sudden violet
#

Ah yes

#

get rid of the .getName()

#

youre casting a string to a player, then back to a string, then back to a player

fiery prairie
#

Thanks

sudden violet
#

np

#

yep

fiery prairie
#

alright thx sorry for deleting

#

last thing, how can i check if target is an online player on the server?

#

would if(target.isOnline()){} work?

paper viper
#

If the player from Bukkit.getPlayer is null, they are offline

fiery prairie
#

yea but it shows an internal error for me

#

if i target an offline player

paper viper
#

What error?

fiery prairie
#

An internal error occurred while attempting to perform this command

paper viper
#

Thatโ€™s not enough information

fiery prairie
#

works if I target an online player though

paper viper
#

Go into console

fiery prairie
#

alright wait

paper viper
#

It shows NullPointerException

#

Right?

dull whale
#

is there a way to make mobs pick up any item

fiery prairie
paper viper
#

Mhm

#

Offline players cause Bukkit.getPlayer to return null

sudden violet
#

i think with offline player theres a function to check 1) if they're online, and 2) if theyve ever joined

fiery prairie
#

so i could do if(target.isOnline) to avoid the errors?

sudden violet
#

i think so

#

i could be wrong though

fiery prairie
#

alright thank you

fiery prairie
#

๐Ÿ˜„ thx

dull whale
sudden violet
#

how are you going about allowing all mobs to pick up items? like are you changing it on mob spawn, using custom mobs, etc?

balmy fox
#

Where can I download the Spigot API 1.19 for my plugin development?

sudden violet
dull whale
#

and I enable items' canmobspickup on itemspawnevent&itemmergeevent

sudden violet
#

I assume you want certain mobs to be able to pick up everything?

dull whale
#

yes

#

i dont have to like push items to the mob when they get near right

sudden violet
#

got any code snippets?

#

specifically your listener class

dull whale
# sudden violet specifically your listener class
    @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
    public void onItemSpawn(ItemSpawnEvent event){
        Item item = event.getEntity();
        if(!item.canMobPickup()){
            item.setCanMobPickup(true);
            item.setOp(true);
        }
    }

    @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
    public void onItemMerge(ItemMergeEvent event){
        Item item = event.getEntity();
        if(!item.canMobPickup()){
            item.setCanMobPickup(true);
            item.setOp(true);
        }
    }
balmy fox
lost matrix
balmy fox
#

I think I needed it for javaFX

opal juniper
#

you can add maven depends

#

afaik

dull whale
sudden violet
#

java 8?

tardy delta
#

EntityPickupItemEvent

lost matrix
sudden violet
#

I think he means, wheres his code going wrong

lost matrix
#

Zombies for example can pickup any item

#

But a sheep cant

tardy delta
#

imagine a sheep picking up a sword and killing u ๐Ÿ˜ฟ

fiery prairie
#

why is there no 1.19?

lost matrix
fleet comet
#

dis spigot

fiery prairie
#

alright so i should change to spigot?

fleet comet
#

if u want help ye

fiery prairie
#

alr thx

lost matrix
fiery prairie
#

thx it works now

fleet comet
#

waitt

fleet comet
#

bukkit no support 1.19

#

bukkit not great

fiery prairie
#

ye its weird

eternal oxide
#

of course Bukkit supports 1.19

fiery prairie
#

yea but i couldnt change to 1.16 and above with bukkit

eternal oxide
#

ah depending on bukkit. yep thats wrong

paper viper
#

Thatโ€™s just IntelliJ tab complete

#

I believe it fetches from what you already have downloaded

fiery prairie
paper viper
#

Not sure then

lost matrix
#

bukkit is not publicly available. You need to run buildtools for that version so its being installed in your local maven repo

fiery prairie
#

im not a fan of buildtools tbh

eternal night
#

who is

paper viper
#

paperclip

eternal night
#

ssshhh

lost matrix
#

Since 1.17 you should use a different approach for craftbukkit/nms

eternal oxide
#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

tardy delta
#

i manged to write a 450 lines vanish command ๐Ÿ’€

#

even with acf

balmy fox
#
s.setLine(1, player.getInventory().getItemInMainHand().getType().name());

So Im trying to make a shop plugin. Therefor I need to save the item that I want to sell. But when I use .getType().name() and Amethyst Shard it returns AIR.
What am I doing wrong?

agile anvil
balmy fox
#

Yes

kindred valley
#

so how can i directly fill the blocks between x2000 any z2000

agile anvil
viscid fractal
#

Hi, I've been learning minecraft plugins and am now looking at custom mobs using NMS, and have been looking at videos but a bit confused as they are able to do this.setPosition(loc.getX(), loc.getY(), loc.getZ()) where as I am unable to use .setPosition() and instead I am forced to use this.a(loc.getX(), loc.getY(), loc.getZ()) . been looking for the past hour and haven't found the answer, think it has something to do with buildtools and installing spigot as --remapped but have done this and not sure how to update my current project with it.

balmy fox
fleet comet
#

oh no, there copying hypixel!!

agile anvil
fleet comet
#

um

#

dont ask me

#

idk about withers

balmy fox
#

What should I add?

fleet comet
#

api-version: 1.19

#

or whatever

balmy fox
#

But that is just documentation right?

fleet comet
#

no?

#

thats the version of the api your using

left swift
#

Is it possible to change armorstand's pitch (that blue line when hitbox enabled :D)

viscid fractal
#

probably need to change the mobs pathfinder (that's just the idea that comes to my mind). don't know how to do that as I am trying to learn that myself atm

viscid fractal
fleet comet
#

Hey so making an addon system here. I'm using lamp. and uh im getting this Could not load 'plugins\cloud-1.0-SNAPSHOT.jar' in folder 'plugins' org.bukkit.plugin.InvalidPluginException: org.bukkit.plugin.IllegalPluginAccessException: Plugin attempted to register revxrsal.commands.bukkit.brigadier.Commodore$ServerReloadListener@b55dfd3 while not enabled heres the github https://github.com/JadeStudioss/Cloud

#

i dont have a life to send the classes

tardy delta
#

dont do direct initialisation

balmy fox
tardy delta
#

do all field initialisation in the onEnable

#

atleast the ones which use api code

eternal oxide
#

You can;t register anythign without a valid Plugin instance

tardy delta
#

^^ plugin isnt enabled yet

eternal oxide
#

and as Fourteen said, the plugin must be enabled to do it too

fleet comet
#

im brand new to lamp lol

#

so sry

agile anvil
tardy delta
#

me starting runnables in the constructor ๐Ÿ˜”๐Ÿ˜”

fleet comet
#

it worked!

balmy fox
agile anvil
tardy delta
fleet comet
#

this is also in the addon jar so idk if that would cause it

tardy delta
#

dunno how that framework works

#

registered it?

fleet comet
#
package org.cloud.addon;

import org.cloud.addon.commands.TestCommand;
import org.eternitystudios.plugins.cloud.Cloud;

public class Addon {

        Cloud instance;

        public Addon(Cloud instance) {
            this.instance = instance;
        }


        public void addonMain() {
            instance.registerCommand(new TestCommand(), "test");
        }
    }

``` heres the main class for the addon
#

and the registerCommand method should work

tardy delta
#

i think you should actually do smth in ya command instead of just returning a string

fleet comet
tardy delta
#

add some sysout to test if it works

left swift
#

Is it possible to change armorstand's pitch (that blue line when hitbox enabled)?

dense crow
#

okay how do i list strings from a file ingame? like when theres something in the file written that the command ill do put it out whats written in the file

tardy delta
#

?configs

undone axleBOT
tardy delta
#

uhh

#

just print the content to the player

#

like player.sendMessage(config.getString("boo"))

#

assuming its a yaml file

fleet comet
tardy delta
#

print if the code gets triggered

#

i guess it gets triggered but your command doesnt do anything

rugged gust
#

Hello I'm trying to make a custom join/leave messages plugin so i have this problem i have a config file and i make it so it'll get the string from the config as the welcome msg so i have the dependency placeholder api too but the %player% which is in the config won't load

tardy delta
#

you need to interact with the papi code

#

iirc theres smth like PlaceHolderApi.fillInPlaceHolders or smth

dense crow
rugged gust
#

May i know where should I do that?

dense crow
#

and im not working with the config, im working with files like yml

#

the config is already in use by other thing

tardy delta
rugged gust
dense crow
# tardy delta how are you saving it

like this way: ```java
public static void setreportmessage(String name, String message, String Bugtype) {
File file = new File("plugins/RegiPlug", "reportmessage.yml");
FileConfiguration cfg = YamlConfiguration.loadConfiguration(file);
cfg.set(name + ".repmessage", message);
cfg.set(name + ".bugtype", Bugtype);
try {
cfg.save(file);
} catch (IOException e) {
e.printStackTrace();
}
}

tardy delta
#

so the stuff is saved smth like

name:
  message: 'smth'
  bugtype: 'smthelse'
othername:
summer scroll
#

Kinda like that but you may want to store the FileConfiguration so you don't load it everytime you want to access it.

tardy delta
#

^^

dense crow
tardy delta
#

and what do you want to print everything?

dense crow
#

i want to print when theres something in that file that he print it out in chat for me

#

and there can be more than one entry

tardy delta
#
for (String str : config.getKeys(false)) {
  String message = config.getString(str + ".message");
  String bugtype = config.getString(str + ".bugtype");
  sender.sendMessage(str + " got reported for " + bugtype + ", message: " + message);
}```
#

basically

#

config.getKeys(false) will iterate over the root keys (all the names in your case)

dense crow
#

OHHH

spiral hinge
#

Hey so I am using MongoDB and I am kinda confused on how to organize my stuff. So does it work like where I have a database per server then a collection per plugin?

tardy delta
#

you should be saving the users uuid instead of their name, as their name can change but uuid not

dense crow
#

its just for identification, so i dont have to search all the time for their names

tardy delta
#

then save their last name as a key too

#

but use the uuid the save the thing

dense crow
#

okay okay really thank u

rugged gust
tardy delta
#

check their api page

#

i forgot

rugged gust
#

Ok

#

I couldn't find it. lol I'll figure out my self

rugged gust
tardy delta
#

what are you looking for then

viscid fractal
#

Hi, I've been learning minecraft plugins and am now looking at custom mobs using NMS, and have been looking at videos but a bit confused as they are able to do
this.setPosition(loc.getX(), loc.getY(), loc.getZ())
where as I am unable to use .setPosition() and instead I am forced to use
this.a(loc.getX(), loc.getY(), loc.getZ())
been looking for the past hour and haven't found the answer, think it has something to do with buildtools and installing spigot as --remapped but have done this and not sure how to update my current project with it.

rugged gust
tardy delta
#

what isnt clear about this

rugged gust
subtle folio
#

placeholderapi โค๏ธ

subtle folio
viscid fractal
rugged gust
subtle folio
viscid fractal
#

when I try to copy the pom.xml file it doesn't work

tardy delta
#

2nd param

rugged gust
# subtle folio where what?

where to input the things u said "config#getString("path-to-var")" sorry I'm just a starting stage developer so i have many doubts.

tardy delta
#

always fun when i discover bugs in the code ive been working on for three days smh

subtle folio
rugged gust
subtle folio
#

then replace %player_name% with " + config.getString("path-to-var") + "

rugged gust
#

i mean i have the %player_name% in the config file not the main class..

subtle folio
#

replace %Player% with %player_name%

rugged gust
#

ok

tardy delta
#

500 lines of code with bugs in lets go

#

nearly the 2000 lines of C code with one comment on top of the file: //this code contains bugs

#

๐Ÿฅฒ

mortal hare
#

Why IS IT SO PAINFUL TO DESIGN FULLY FUNCTIONAL API

opal juniper
#

what api

mortal hare
#

im designing ui api

#

which fully implements NMS containers

#

that problem isnt that they don't work

#

problem is that It so hard to maintain bukkit api support by using NMS

#

since every instance of NMS menu or container is hardcoded to packet handling

fleet comet
#

@mortal harewhats your code?

worldly ingot
#

You're welcome to make patch files if necessary and improve our API

#

Want to expose something for your library and it makes sense to be a native Bukkit method? You can add one today! Just call 1-800-44 ehm- sign the CLA and open a PR!

buoyant viper
old cloud
#

Is there a bungee.yml documentation?

tardy delta
fiery prairie
#
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (command.getName().equalsIgnoreCase("healther")) {
            if (sender instanceof Player) {
                Player p = (Player) sender;
                if(p.hasPermission("healther.*")){
                    if (args.length == 0) {
                        p.sendMessage(ChatColor.RED + "List of commands:");
                        p.sendMessage(ChatColor.DARK_GRAY + "- " + ChatColor.RED + "/healther reload");
                        p.sendMessage(ChatColor.DARK_GRAY + "- " + ChatColor.RED + "/healther help");
                        p.sendMessage(ChatColor.DARK_GRAY + "- " + ChatColor.RED + "/healther");
                    } else if (args[0].equalsIgnoreCase("reload")) {

                        reloadConfig();

                        p.sendMessage(ChatColor.GREEN + "Reloaded the config");
                    } else if (args[0].equalsIgnoreCase("help")) {
                        p.sendMessage(ChatColor.RED + "List of commands:");
                        p.sendMessage(ChatColor.DARK_GRAY + "- " + ChatColor.RED + "/healther reload");
                        p.sendMessage(ChatColor.DARK_GRAY + "- " + ChatColor.RED + "/healther help");
                        p.sendMessage(ChatColor.DARK_GRAY + "- " + ChatColor.RED + "/healther");
                    } else {
                        p.sendMessage(ChatColor.RED + "Please enter a valid command, view the list of them using /healther help");
                    }

                }
            }else if (command.getName().equalsIgnoreCase("heal")) {
                if (sender instanceof Player) {
                    Player p = (Player) sender;
                    if (args.length == 0) {
                        p.sendMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("heal-success")));
                        p.setHealth(p.getAttribute(Attribute.GENERIC_MAX_HEALTH).getDefaultValue());
                        p.setSaturation(20);
                    }else if(args.length == 1){
                        Player target = Bukkit.getServer().getPlayer(args[0]);
                        if(target.isOnline()){
                            target.setHealth(target.getAttribute(Attribute.GENERIC_MAX_HEALTH).getDefaultValue());
                            target.setSaturation(20);
                            p.sendMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("heal-other-success").replace("%target%", target.getDisplayName())));
                            target.sendMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("heal-ttt").replace("%player%", p.getDisplayName())));
                        }else{
                            p.sendMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("heal-error")));
                        }
                    }
                }
            }
        }


        return true;
    }``` no  errors, but the command:
else if(command.getName().equalsIgnoreCase("heal")) doesnt respond anything in game
tardy delta
#

so much wrong there

buoyant viper
#

cant tell if its discord formatting but i think its in the healther check

fiery prairie
#

heal:
description: Heals a player
aliases: heal

old cloud
#

your if statements are probably nested wrong idk

fiery prairie
#

btw I removed the aliases

old cloud
#

Did you set the executor as well?

fiery prairie
#

hm?

#

You mean for the class to implement commandexecutor??

old cloud
#

getCommand(String).setExecutor(Command)

fiery prairie
#

oh

kindred valley
#

hello guys how can i avoid the crashing when setting to many blocks

fiery prairie
#

I dont think i have that, where do I put that?

fiery prairie
#

what do I replace String and Command with? I mean the commands always worked without it

old cloud
#

String is the name of the command (needs to be the same as in plugin.yml) and command is an instance of CommandExecutor (so your class that implements it ig)

tardy delta
#

handling all commands in one method is so ugly

fiery prairie
old cloud
tardy delta
#

well youre doing it so idk

quaint mantle
#

what is the event for an npc to teleport?

tardy delta
#

EntityTeleportEvent?

#

if there is one

tardy delta
old cloud
fiery prairie
#

how do I make an instance of the executor though? (sry im new to plugin dev)

tardy delta
# fiery prairie would this work?

take a look at the expected arguments, it takes an instance of your class that implements CommandExecutor so smth like new MyCommandThing()

eternal oxide
#

public class MyCommandThing implements CommandExecutor {

fiery prairie
#

oh i got it working, thanks guys!

bold bough
#

?paste

undone axleBOT
bold bough
eternal oxide
#

are you restarting or reloading?

bold bough
#

Restart server

fiery prairie
#

i dont know exactly, but you have config.set there which from my understanding could set the settings to "Has joined" when the server is enabled

bold bough
#

oh

eternal oxide
fiery prairie
#

this is what i use for config

#
        getConfig().options().copyDefaults();
        saveDefaultConfig();```
#

it works good

eternal oxide
#

getConfig().options().copyDefaults(); is pointless. It does nothing

fiery prairie
#

oh idk ive been using a tutorial

#

well thx then

eternal oxide
#

copyDefaults is a boolean return value.

bold bough
#

i go try

eternal oxide
# bold bough i go try

include a config.yml in your plugin jar and all you need in onEnable() is saveDefaultConfig()

fiery prairie
#

how can i make the plugin work for multiple versions? or is it too hard to just explain here?

eternal oxide
#

Don't use NMS/Craft imports and it will work for multiple versions

bold bough
#

And where should I write things in the config?

eternal oxide
#

write things?

fiery prairie
eternal oxide
#

generally your plugin would not write things to the config, unless you are toggling default options.

bold bough
#

okey

eternal oxide
gritty urchin
#

Can a Bungeecord network have 1 spigot server on online mode and other on offline mode?

buoyant viper
eternal oxide
#

no, validation through bungee is the correct method

eternal oxide
#

replace less at once

buoyant viper
#

^

#

queue the block changes into smaller chunks

kindred valley
#

but i need it suddenly

eternal oxide
#

then redesign what you are doing

kindred valley
eternal oxide
#

you can not replace too many at once, so you need to find another way of doing things.

#

What are you trying to achieve?

kindred valley
#

how can people do that in uhc servers

eternal oxide
#

what is uhc?

kindred valley
#

ultra hardcore survival

#

border stuff

eternal oxide
#

No idea what you are talking about

kindred valley
#

dont you know uhc logic?

eternal oxide
#

I have no idea what uhc is

kindred valley
#

i mean every 10 minutes the border is getting shorter. I mean first 10 min its 2000x2000 after 10 minutes its being 1000x1000

eternal oxide
#

ok

#

and how does that require replacing blocks?

kindred valley
#

after 10 minutes you need to teleport people to 1000x1000 so you need to make a new border 1000x1000

eternal oxide
#

are you talking about the MC border? or some physical border?

kindred valley
#

bedrock border

#

but it can be with mc border too

#

if it requires less space

eternal oxide
#

then all you need is two identical worlds

#

one 20000 and the second 10000

kindred valley
#

its good idea let me try

buoyant viper
#

why not use vanilla worldborder

#

and let ppl take border damage

#

:D

kindred valley
#

i dont know how to use it

#

and vanilla border is not physical thing not let place blocks front of the border

tardy delta
karmic stirrup
karmic stirrup
eternal oxide
#

just cancel()

karmic stirrup
rough drift
#

can you just use

#

?paste

undone axleBOT
rough drift
#

also

#

It's pretty easy

karmic stirrup
tardy delta
#

why not just using the lambda way

eternal oxide
#

external counter. using lambda would require final

tardy delta
#

or the Consumer<BukkitTask> so you could just do runTaskSmth(plugin, task -> { task.cancel(); })

rough drift
#
AtomicInteger integer = new AtomicInteger();
BukkitTask task = return Bukkit.getServer().getScheduler().runTaskTimer(Main.oPlugin, new Runnable() {
            public void run() {
                if (countDownTimer <= 0) {
                    Bukkit.getServer().getScheduler().cancelTask(integer.get());
                    Logger.logMessage("cancelled: " + performShutDownTimerFunction().isCancelled());
                    Logger.writeDebugLog("Removing shutdown task timer: ");
                    Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "forcestop");
                } else if (countDownTimer == 10 || countDownTimer <= 5) {
                    Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "broadcast Restarting the server in " + countDownTimer + " seconds!");
                }

                --countDownTimer;
            }
        }, 0L, 20L);
integer.set(task.getId());
return task;
eternal oxide
#

yep

#

but eww

waxen plinth
#

int[] with one value is my preferred way

rough drift
#
int[] num = new int[] {someNumber};

AtomicInteger num = new AtomicInteger(someNumber);

var obj = {
  int num = someNumber;
}
waxen plinth
#

If it's sync anyways

rough drift
#

all of those are valid

waxen plinth
#

{}?

rough drift
#

ye wait

waxen plinth
#

What is obj supposed to be

rough drift
#

lemme make it correct

rough drift
#

it's been added recently

waxen plinth
#

For real?

rough drift
#

fr

#

I gotta find syntax

waxen plinth
#

Where jep

rough drift
#

I need to find

#

eeeeeeeeee I can't find, wait

waxen plinth
#

Oh it's a Java 10 thing

rough drift
#

yes

waxen plinth
#

It's just the anonymous class definition

rough drift
#

ye

waxen plinth
#

But it lets the variable have an anonymous type

#

Which honestly doesn't seem that useful

kindred valley
rough drift
#

the class, however the objects within don't have to be

waxen plinth
#

Yeah but you couldn't meaningfully return such an object

#

None of its values would be accessible

#

So what's the point

rough drift
#

but they are

waxen plinth
#

What return type could you use that would allow that

rough drift
#

lemme show you what I mean

#

a is of type int

#

it's just that the type is gotten at initialization

#

so you don't type really long names

#

like

paper viper
#

Thatโ€™s inferred types at compilation

rough drift
#

FactoryFactoryBuilderFactoryFactoryBuilder

waxen plinth
#

I know how type inferencing works

rough drift
#

you can just use var

waxen plinth
#

I'm talking about anonymous types

#

You cannot return an anonymous object without losing the type data

rough drift
#

it's used as a workaround for like final stuff

#

so you can have mutable vars passed into lambda without needing to make like finalMyVarName

buoyant viper
#

cries in still writes java 8

twilit roost
waxen plinth
#

I have done something like that before

#

Calculate the curve ahead of time and keep it as a list of locations or something

#

Then set the velocity every tick

twilit roost
tardy delta
#

ok i removed the dependency reduced pom from my project and now the maven tab is gone :/

twilit roost
#

gj

mortal hare
#

x^2 is parabola.

#

use graph calc to calculate your curve

#

and just utilise the math function

#

by placing blocks or particles

bold bough
#

?paste

undone axleBOT
waxen plinth
#

Actually no it wouldn't be

#

You'd just do sqrt(xOffset^2 + zOffset^2) to get your input variable

tardy delta
#

oh FileConfiguration::getString returning whatever it finds

#

i made a section there by default and now its returning MemorySection::toString

bold bough
#

Hi, i have problem with configs.
Create config files is work but events dont send messages

buoyant viper
#

youre trying to see if a string is a boolean

#

?learnjava

undone axleBOT
echo basalt
#

Hey, am having a stupid issue

Trying to send fake blocks using packets on 1.18.1, the packets debug fine but the blocks simply don't appear.
Relevant code: https://paste.md-5.net/oxetovegod.cs

#

I might've encoded the shorts wrong โ˜ ๏ธ

kindred valley
#

anyone have experiences about heavy threads?

tardy delta
#

?ask

undone axleBOT
#

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

ivory sleet
kindred valley
echo basalt
#

@lost matrix has a tutorial on that

lost matrix
#

?workdistro

echo basalt
#

ngl I made like 30$ off of that tutorial

lost matrix
#

lul

kindred valley
#

i just have some problem with my server

lost matrix
#

You cant. Unless the would have a property for that.
They simply have a predefined lifetime and then vanish.

#

Why do you need that?

#

This has to be done repeatedly anyways

#

getLocation() returns the Location at the players feet

kindred valley
buoyant viper
#

are u splitting up the workload

bold bough
#

?configs

undone axleBOT
kindred valley
buoyant viper
#

did u ping me and then delete it or did discord bug and ping me anyway

sterile token
kindred valley
formal bear
#

Am i doing something wrong? xdd how to import authlib

eternal night
#

did you add the correct repo ?

eternal oxide
#

Don't you have to run BT for authlib?

paper viper
#

Wasnโ€™t there libraries.minecraft

#

Or something

eternal night
#

yes

#

https://libraries.minecraft.net/ is the maven repo

paper viper
#

Yes

eternal oxide
#

also, 1.5.21? what old ass version is that?

paper viper
#

Lol

eternal night
#

iirc current 1.19.1 stuff is on 3.9.47

eternal oxide
#

current looks to be 3.5.41

#

oh I guess mine is old too ๐Ÿ™‚

eternal night
#

well no 1.19 is on that xD

#

1.19.1-rep3 is on .47

formal bear
#

I understand, it works rn tysm

#

It was about old version, i ran the BuildTools today

eternal night
#

I mean, concerning there is a maven repo, I'd suggest using that ๐Ÿค”

#

unless you need server internals anyway

buoyant viper
#

woops meant to turn off ping

eternal oxide
#

pings are fine. keeps me awake ๐Ÿ™‚

sterile token
#

A dumb question how i can get server status without ping it every time?

#

Becaue if you are using bungeecord its really annoying to see a ping message every time

sterile token
#

It was a serious question

kindred valley
#

What

sterile token
#

I dont know

#

You are tagging me...

kindred valley
#

Why did you say me to text the correct channel??

#

I was already using the correct one

sterile token
#

Or maybe i confuse with another guy

kindred valley
#

โ‰๏ธ

buoyant viper
#

if an entity is hit by a player (directly, crosshair target) with a fully charged sword, is the damage source still ENTITY_ATTACK or is it ENTITY_SWEEP_ATTACK

#

not in an env to test it myself rn

sterile token
buoyant viper
#

its not very polished tbh, just enough that it does what i need it to do

quaint mantle
#

i wanna see too @buoyant viper

#

i literally just made this lib because im tired of boilerplate config shit

sterile token
#

?jd-s ProtocolInjector

undone axleBOT
buoyant viper
sterile token
#

Sorry for being annoying but if open source a file system would someone be interested on pulling a request to add the ConfigurationSection thing

twilit roost
#

Why on big server Skull Textures dissapear?
On localhost they worked well

formal bear
#
        Skull headBlock = (Skull) event.getClickedBlock().getState();

        ItemStack item = playerHead.getCustomHead(headUrl, headName, headDisplayName);

        if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
            // check if the headblock (placed skull) is item (custom head)
        }

Can someone tell me how to check for this i'm confused theres material.skull and block.skull

lost matrix
eternal oxide
#

Material is for an ItemStack. Skull (BlockState) is for checking a placed skull

twilit roost
formal bear
buoyant viper
#
@EventHandler
    private void onRightClick(PlayerInteractEvent event) {
        if (event.getPlayer().isSneaking()) return;
        if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
        if (event.getHand() == null || !event.getHand().equals(EquipmentSlot.HAND)) return;

        var clickedBlock = event.getClickedBlock();
        if (clickedBlock == null) return;
        if (!(clickedBlock.getState() instanceof Skull skullState)) return;
        if (skullState.getOwningPlayer() == null) return;

        var ownerName = skullState.getOwningPlayer().getName();
        if (ownerName == null) return;

        event.getPlayer().sendMessage(String.format(ChatHelper.format("&eThis head belongs to &c%s"), ownerName));
        event.setCancelled(true);
    }``` heres code i have for skull block
#

dont know if its useful for u

formal bear
#

whats your skullState variable?

buoyant viper
#

if ur also dealing with a placed skull its the block's (Skull)state

formal bear
#

okay

buoyant viper
#

ur equivalent variable is headBlock

formal bear
#

yeah

buoyant viper
#

oh are u trying to make sure its a player head and not like a skeleton or otherwise

formal bear
#

nah nah

#

i have createHead method which generates Gameprofile