#help-development

1 messages · Page 305 of 1

dry yacht
#

I think I need to quickly spawn an armorstand locally and have a look myself. This seems really weird, xD.

vale ember
#

k

onyx garden
vale ember
#

?

tardy delta
#

tabnine 💀

misty current
#

i didn't really understand your answer

#

what am I supposed to do?

radiant cedar
#

when i make a nether portal it spawns exactly in the overworld location/8, it doesnt look for empty spaces

dry yacht
# vale ember k

Yeah, well, it's as I've thought, the item in the arm itself cannot be rotated like on your picture, you have to move the arm outwards and then fold it inside, so L and R become switched and the item is higher up than normal. No idea how to do this otherwise. Since euler angles are additive, it becomes quite a pain thinking about how to compensate for rotations. What are you trying to accomplish? Is the armor stand going to be visible? How should the final pose look?

dry yacht
vale ember
onyx garden
# misty current i didn't really understand your answer

setRightArmPose(EulerAngle pose) - sets the current pos
You must watching out the EulaAngle to set (0|0|0)

puplic static final EulerAngle ZERO = A EulerAngle with every axis set to 0
puplic EulerAngle(double x, double y, double z) = Creates a EularAngle with each axis set to the passed angle in radians

or you want to set y axis only.
public EulerAngle setY(double y)

getting this way
public EulerAngle getY()

dry yacht
# vale ember the armor stand isn't going to be visible. i am creating an ability for a player...

Oh, well then you could have just experimented with these values until you found a pose you like and just hard-code that, lol. I once made this little debug utility where you can click (playerinteractevent), and while you hold that button, move-events (yaw) is scanned, delta between last and curr is calculated and that delta is added to the currently selected euler angle. This can be useful to generate rotations like these.

misty current
#

i don't really see what does my question have to do with armor stand arm poses

dry yacht
vale ember
#

thank you very much!

dry yacht
dry yacht
misty current
#

i have a vector and i want to rotate it 90 degrees around its tail

#

imagine the vector is the player's direction

onyx garden
#

I think you mean getBodyPos()

misty current
#

the vector should then point to the left of the player

#

after i have rotated it 90 degrees

dry yacht
misty current
#

this is an example, i could need to rotate it both on yaw and pitch and of a different angle than 90

onyx garden
#

Watch out EulerAngel

dry yacht
# misty current i have a vector and i want to rotate it 90 degrees around its tail

https://paste.md-5.net/xusacelafa.cpp

This is what I threw together just recently to get something done. you just call rotateXYZInPlace, where base is what you input and handle is the vector which will get the result stored in place. angleX/Y/Z are the rotations on the corresponding axies while shiftX/Y/Z let's you move the rotation origin. Just leave shift at zero, y/z or y/x at zero and set the remaining angle, while inputing the player's eye location's direction as the base.

misty current
#

do you really need matrices tho? it seems a quite inefficient approach

dry yacht
#

Depends on what you're trying to accomplish. The rotation of a fixed 90 degree angle is well defined and can be also computed without them.

south skiff
#

Hey I got a short question. I am picking a Player in a 'Public static void' and I am storing his UUID in a variable. Now I want to access that variable of the UUID outside of this method, but I can't and don't know how. How can I do it?

tardy delta
#

sounds like static abuse

#

?di

undone axleBOT
south skiff
#
    public static void pickPlayer() {
        if(Bukkit.getOnlinePlayers().size() > 0) {
            ArrayList<Player> players = new ArrayList<>(Bukkit.getOnlinePlayers());
            Player player = players.get(ThreadLocalRandom.current().nextInt(players.size()));

            Player choosenPlayer = player;

            player.sendMessage("Yo it worked!!!");
        } else {
            return;
        }
    }
    public void testMessage() {
        System.out.println(choosenPlayer);
    }
}```
fluid river
#

what's the point of this? just a shorter version of while(true)?

modern vigil
fluid river
#

can i do smth like for (i;10;++)

modern vigil
#

since the ; is a seperator for the var initialization, the action on each loop cycle and the conditon, and they're all empty, it's just an infinite loop

fluid river
#

oh then no

modern vigil
#

you can see the for loop as just a while loop which looks like the following

#
// this for loop 
for(init, cond, cycle) {
  code
}

// is the equivalent of:
init
while(cond) {
  cycle
  code
}```
remote swallow
#

Cant say ive seen a for loop written with the i++ in the center

modern vigil
#

o oops

remote swallow
#

Lol

wet breach
#

the main difference between for loop and while, is that you can use do-while. That is perform an action so as long as it is true or false. A for loop has an end to it unless something constantly updates what the end condition is.

vale ember
#

is there any difference between Player#getEquipment()#getItemInMainHand() and Player#getInventory()#getItemInMainHand()?

wet breach
vale ember
#

will i get the same item?

wet breach
#

yes

vale ember
#

k thanks

worldly ingot
#

Also a lesser known fun fact about for loops, you can modify multiple variables in the increment

for (int i = 0, j = 0; i < 10 && j < 20; i++, j += 2) {
    System.out.println(i);
}```
hasty prawn
#

That is a fun fact

#

I didn't know that

vale ember
worldly ingot
#

Honestly no reason

#

Edited, it compiles fine too lol

vale ember
#

btw will performance be significantly affected if i use

IntStream.range(0, number).forEach(i -> { /* code */ });

instead of simple loop to just do something N times?

wet breach
#

and the advantage a ListIterator has over a normal one, is backwards traversal

tardy delta
#

never used it, i always did a reverse loop

vale ember
#

k ill use for then

tardy delta
#

isnt just the generation of the stream slow but not the looping?

wet breach
#

Foreach is best used with Arrays and Collections like with LinkedList because it is more optimal then a for loop

#

Both are technically iterators, one is internal the other is external

wet breach
tardy delta
#

it probably only keeps track of the min and max

#

assuming it only stores a whole segment of integers and not just random ones

#

never used an intstream tho 💀

#

ah it doesnt

wet breach
#

if they need an array super quickly

#

they could do this

#
int[] arr = new int[end - start];
Arrays.parallelSetAll(arr, i -> i + start);```
#

fills the array very quickly especially if its a large array

tardy delta
#

ye ik about setAll

wet breach
tardy delta
#

well i once used it instead of a for loop

wet breach
#

and you can

#

however foreach itself is an interator that is internal, unlike the for loop so there is times where it is better to use it over the for loop

#

just depends on what you need really

vale ember
#

i just asked and decided to go with normal for loop

wet breach
#

indeed they did 🙂

#

and got a response that met their requirement for satisfactory response levels

remote swallow
#

its like 11am

#

why are you eating chicken wings

dusty herald
#

Yeah and

#

I'm broke

remote swallow
#

L?

dusty herald
#

W.

#

shifs fire

fluid river
#

?paste

undone axleBOT
last bolt
#

How might I get hold of the Bukkit instance in order to getMethod().invoke() on it?

tardy delta
#

Bukkit.class.getDeclaredMethod(x).invoke(Bukkit.getServer())

last bolt
#

Oh, getServer() has all the same methods of the underlying Bukkit class.

tardy delta
#

Bukkit class wraps a Server instance

#

nothing more nothing less

last bolt
#

Superb, thank you.

fluid river
#
static Object[][] goods = new Object[10][10];

static void someMethod(Scanner sc) {
    // some code
    String name = sc.next();
    String costRaw = sc.next();
    while(true) {
        try {
            double cost = Double.valueOf(costRaw);
            int slot = firstEmpty();
            goods[slot][0] = name;
            goods[slot][1] = cost;
            // messages
            break;
        } catch (NumberFormatException ex) {
            System.out.println("Cost must be a number! Enter cost again.");
            costRaw = sc.next();
        }
    }
}

static void printArray() {
    for (int i = 0; i < 10; i++) {
        Object o = goods[i][1];
        System.out.println(nameFormat(goods[i][0]) + (o == null? "0": ((Double) o).doubleValue()));
    }
}```
#

imagine being me

tardy delta
#

love it how you can be serious for some time and then you start sending gifs

onyx fjord
#

how do ppl go with attaching armorstand to the player

#

if we move it there are some delays that client sees

#

it has to do with mounting right

fiery prairie
#

Hi, i have this currently. How would I disable the damage of the enderpearl?

wet breach
onyx fjord
#

ProjectileHitEvent > getEntity

wet breach
#

when the armor stand is a real entity it follows the ticking rules

onyx fjord
#

@fiery prairie

wet breach
#

so, while although you told it to move, it won't move at that exact instant

onyx fjord
wet breach
#

however you can tell the client it did move instantly 🙂

fiery prairie
onyx fjord
#

what about ping and shit

wet breach
onyx fjord
#

oh

#

Spawn Entity packet?

wet breach
#

if you are spawning it

onyx fjord
#

and if i wanna mount?

wet breach
#

if you want it to move larger distances, you use the teleport packet if movement is greater then 8 blocks I think it is

wet breach
onyx fjord
#

i see

misty current
#

how can you turn yaw and pitch into a vector?

fiery prairie
wet breach
misty current
#

prob was

eternal night
#

getDirection() on a location would return a normalised vector that points in the direction of the yaw/pitch

misty current
#

i've just found the method

eternal night
#

toVector() on a method does not care about yaw and pitch

#

it just creates a vector with the x y and z of the location

misty current
#

i meant how does pitch work in locations

#

is 0 when you look straight forward?

#

then -90 when you look straight down and 90 straight up?

eternal night
#

the javadocs should clarify this

#

they do

misty current
#

alright thanks, i'll try the code there

#

the method returns a normalized vec doesn't it

eternal night
#

which method ? xD

#

getDirection() does yea

wet breach
misty current
#

is it me or is this wrong

input: player.sendMessage("vector: " + VectorUtils.getSphericalVector2(Math.sqrt(5 * 5 * 3), 45, 45));
output: -4.33, -6.12, 4.33
wet breach
#

because you can have 360 and -360

#

the difference here is that positive means turning their head clockwise if its negative they are turning their head counter clockwise

misty current
#

this is rounded but you should get the idea

#
    public static Vector getSphericalVector2(double radius, double yaw, double pitch) {
        Vector vector = new Vector();

        double xz = Math.cos(Math.toRadians(pitch));
        vector.setY(-Math.sin(Math.toRadians(pitch)));
        vector.setX(-xz * Math.sin(Math.toRadians(yaw)));
        vector.setZ(xz * Math.cos(Math.toRadians(yaw)));

        return vector.multiply(radius);
    }
``` this is the method
#

i've put that value as the radius so the 3 vector components should be 5

#

and also i don't understand why is the y negative

wet breach
#

however if you don't care which direction they are moving their head and just want the yaw

#

use absolute

misty current
#

and also distorted compared to the other locations

misty current
wet breach
#

I was just letting you know the caveat with yaw

misty current
#

i appreciate that

wet breach
#

as sometimes people get tripped up when they get results of negative values 😛

misty current
#

but i don't know if i don't understand how it works

#

but i'm pretty sure this is not supposed to happen

misty current
#

can't even trust the api :c

lilac dagger
#

it's so segmented

#

and generic looking

opal juniper
#

configurate is cool

lilac dagger
#

but do you guys understand it?

opal juniper
#

what do you mean understand? have you looked at the wiki

lilac dagger
#

without looking at the wiki

#

i'm not interested in the usage, i'm trying to learn from it

opal juniper
#

learn what

lilac dagger
#

i feel my code style is much simpler than this

misty current
opal juniper
wet breach
#

the way you could do it is to create a new vector

#

let x be your pitch, and z your yaw setting y to 0

#

should be able to use most of the vector api for your needs if done that way

misty current
#

i don't really see how tbh

#

i'm not the best at vector math

eternal oxide
#

If you have a yaw and pitch you likely have a Location they came from

#

Location#getDirection()

misty current
#

i don't, i need a method to create circular motion animations and so i am providing yaw and pitch by hand

eternal oxide
#

then you have to calculate it using cos and sin

misty current
#

that's what i was doing, i've copied the getDIrection method but the values it returns are kind of messed up

eternal oxide
#

can't look at code at the mo

quaint mantle
#

Can someone tell me where is the JavaPlugin in 1.19.3 build tool which used to exist in 1.8.8?

chrome beacon
#

?

#

Are you trying to depend on the Spigot jar directly

quaint mantle
#

yes

last bolt
#

IllegalAccessException when calling .size() on a Collection using reflection, but not when done directly in code. Any idea what might be causing this? The collection in question is the result of Bukkit.getServer().getOnlinePlayers().

chrome beacon
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

quaint mantle
#

i see

#

thanks

chrome beacon
#

Also show your code

#

?paste

undone axleBOT
last bolt
#

Because I'm getting data based on arguments supplied in config.yml and there are too many things to hand write code for each option so I am using reflection. I have great success retrieving the Collection itself and can print it out to the console, but calling size() on it causes an error.

tardy delta
#

what

last bolt
#

I get
java.lang.IllegalAccessException: cannot access a member of class java.util.Collections$UnmodifiableCollection (in module java.base) with modifiers "public" on that one method.

#

If I leave off the '.size()' part I get the collection just fine and can print its contents. If use the same process on 'getMaxPlayers()' it works fine. It seems to be something with calling .size() on a collection using reflection.

chrome beacon
last bolt
#

How so?

chrome beacon
#

ah wait you're reassigning o

#

Double check and make sure that split works

last bolt
#

Yeah, I get the Collection back okay.

#

It does, I actually have logic further up the class that checks all that first.

last bolt
#

It also works fine on getOperators().size(), though getOperators returns a Set, not a Collection.

misty current
#

how can I offset a location to the right/left of the player?

minor garnet
#
FieldUtils.readField(protocol, "f");```
some1 have a better reflection util class than protocollib? 🤣
misty current
#

use fieldutils from apache

#

also i think you need to include a parameter which is something like force

#

that basically sets the field accessible

#

that's how it works with the apache utils class

#

not sure about yours

sullen marlin
last bolt
#

Lemme just spin it up again and see what the error was.

#

Hmm, 'NoSuchMethodException'. I don't recall it being that last time I tried, but there it is.

#

To be precise: java.lang.NoSuchMethodException: java.util.Collections$UnmodifiableRandomAccessList.size()

rotund ravine
rotund ravine
last bolt
#

Yup

rotund ravine
#

Write out the class UnmodifiableRandomAccessList import it and AlT + left click

last bolt
#

Will do

#

Unable to import, can't resolve UnmodifiableRandomAccessList

quiet ice
#

smh, in eclipse it doesn't require clicking or anything

rotund ravine
last bolt
#

I've found the definition for UnmodifiableRandomAccessList in Collections but I don't really know what I'm looking for here.

rotund ravine
#

@last bolt Nothing i’ve checked

last bolt
#

Ah, okay.

#

Thank you!

rotund ravine
#

You can get the method you want bt doing Collection.class.getMethod(“size”) and invoking that on your lidt

#

List

#

Or similar am on my phone

last bolt
#

I'll give that a whirl now.

tardy delta
#

get the internal array and call ::length on it :))

last bolt
fluid river
tardy delta
#

wha

vale ember
#

in RaytraceResult#getHitBlock return docs says the hit block, or null if not available. what does it mean not available?

river oracle
#

No block was hit probably

#

Seems most logical

vale ember
#

wouldn't then raytrace result be null

#

it says he ray trace hit result, or null if there is no hit

#

in World#rayTraceBlock

river oracle
#

I'd assume they can just do the math for raytraced location without loading chunks

misty current
#

in a result an entity could be available but a block could not be available at the same tie

#

time*

pallid patio
#

is there a way to edit level.dat?

#

I want to modify the bossbar fog

sterile token
#

What mesaage broker will u recommend? because i need one which works as fast as redis but having the security that the data will never get losted

#

Because thats the main issue that we're experimenting at our project thanks

chrome beacon
#

What's wrong with Redis?

misty current
tardy delta
#

sounds like a skill issue

tender shard
orchid gazelle
#

NBTExplorer

orchid gazelle
quaint mantle
#

Without insulting my whole family, can you tell me if this should work?

ItemStack clickedItem = e.getCurrentItem();

       if (clickedItem.getType() == Material.DIAMOND_SOWRD) {
            if (!p.getInventory().getBoots().equals(Material.CHAINMAIL_BOOTS)) {
                if (playerInventory.contains(Material.EMERALD, 4 )) {
                    playerInventory.removeItem(new ItemStack(Material.EMERALD 4));
                       p.getInventory().setBoots(new ItemStack(Material.CHAINMAIL_BOOTS));
                    p.getInventory().setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS));
                }
            }
        }
pseudo hazel
#

it would probably do something, thats for sure

#

what is working in your eyes

#

like whats it supposed to do

quaint mantle
#

This give me the armor but dont remove the 4 emerald

pseudo hazel
#

well I dont think you can remove a new itemstack

quaint mantle
#

and what should I do for you?

#

because I dont really know

pseudo hazel
#

you can get the emerald stack and decrease the amount by 4

quaint mantle
#

in playerInventory.removeItem() ?

pseudo hazel
#

oh or you could do getItem instead of using new ItemStack

#

like use Inventory.first to get the first emerald stack

#

and then use removeitem with that

quaint mantle
#

ok and then removeItem?

#

ok, I will try, thanks

pseudo hazel
#

its not completely fool proof though, but if you want to make a shop there are more robust ways in any case

quaint mantle
#

Like?

copper scaffold
#

Is there any way to get a player list of existing Minecraft accounts

quaint mantle
#

Do you mean all of minecraft account created?

copper scaffold
quaint mantle
#

In a plugin?

copper scaffold
#

yea

quaint mantle
#

I dont think so

copper scaffold
#

uff

#

okay thx

pallid patio
#

@faint totem

urban kindle
undone axleBOT
urban kindle
#

yes 1.8.8

#

😔

#

But it's about config I think it can be solved

#

if you can look at my topic

south skiff
urban kindle
#

I just wanted to know how I can create names in the config to be drawn in my mystery box, but each name with its rarity

misty current
#

hmm yes

urban kindle
#

probably that

misty current
#

i dare anyone to sit on that irl

south skiff
#

Oh yeah thanks, but I don't understand exactly what the source is. So what could I put in there(except from null), if you know? ^^

urban kindle
#

yes exactly that

south skiff
#

Thanks ^^

urban kindle
#

only I wanted to make it raffle an item of some rarity with a list of items within the rarity

#

example

#

Can you help me with this?

#

I did like this

#

I did it like this because I'm Portuguese but it's the same scheme

#

I just wanted to put a custom name on the items in the rarities list

#

Because when they are drawn, the name will appear on the mystery box reward armorstand

#

such that?

urban kindle
#

can you teach me how to do this to show how i want to do it

#

The only way I can do it is by list but then I can't by custom names

#

this code

#

I really don't know how to do this sorry ☹️

olive cloud
#

I do not know much so I need so help I do not know java

urban kindle
#

would you have an example base to show this?

olive cloud
#

It is not building

urban kindle
#

I'm a little newbie at this yet sorry

olive cloud
#

yea same

#

ok thank you

#
Could not find artifact com.mojang:authlib:pom:1.5.21 in central (https://repo.maven.apache.org/maven2)
Could not find artifact com.mojang:authlib:pom:1.5.21 in central (https://repo.maven.apache.org/maven2)
#

wdym

urban kindle
#

I wanted to know how to leave the name of the string customized by the list

willow widget
#

Helppp, I don't understand why this doesn't work:

[16:38:45 ERROR]: Error occurred while enabling SmcLimbo v0.1.0 (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "org.bukkit.plugin.RegisteredServiceProvider.getProvider()" because "rsp" is null
        at me.ferju.smc.Main.setupVault(Main.java:77) ~[SmcLimbo-1.0-SNAPSHOT.jar:?]
        at me.ferju.smc.Main.onEnable(Main.java:42) ~[SmcLimbo-1.0-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[purpur-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[purpur-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:541) ~[purpur-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugin(CraftServer.java:560) ~[purpur-1.18.2.jar:git-Purpur-1631]
        at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugins(CraftServer.java:474) ~[purpur-1.18.2.jar:git-Purpur-1631]
        at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:669) ~[purpur-1.18.2.jar:git-Purpur-1631]
        at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:436) ~[purpur-1.18.2.jar:git-Purpur-1631]
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:352) ~[purpur-1.18.2.jar:git-Purpur-1631]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1179) ~[purpur-1.18.2.jar:git-Purpur-1631]
        at net.minecraft.server.MinecraftServer.lambda$spin$1(MinecraftServer.java:320) ~[purpur-1.18.2.jar:git-Purpur-1631]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
[16:38:45 INFO]: [SMCL] Disabling SmcLimbo v0.1.0

Here goes the code...

#

The code is to check if Vault is enabled:

    private boolean setupVault() {
        if (getServer().getPluginManager().getPlugin("Vault") == null) {
            Utils.LogWarn("Vault not found, Vault utils will not work.");
            return false;
        }
        RegisteredServiceProvider<Permission> rsp = getServer().getServicesManager().getRegistration(Permission.class);
        vaultPerms = rsp.getProvider();
        return vaultPerms != null;
    }
#

I do have Vault installed on the server as well as LuckPerms

#

and yes, Vault is set as a dependency, as well as LuckPerms as a soft dependency which I think I don't even need xD

#

nevermind, I just had to change my gradle way of import lol

tardy delta
urban kindle
#
   Hat:
      Name: '&aCommon Hat'```
urban kindle
pastel fulcrum
#

Cannot resolve method 'getDataFolder' in 'Plugin'

tardy delta
#

its JavaPlugin

#

and should use File.separator instead of "/" or it will break on non windows things

#

or just do new File(plugin.getDataFolder(), path)

hazy parrot
#

\\ is windows

native nexus
#

You can use plugin, you don’t have to use JavaPlugin.

urban kindle
#

Hey bro I got it done the way I wanted @last temple

twilit garden
#
public static ArrayList<String> colorArray(String string) {
        String[] splittedString = string.split("@");
        ArrayList<String> strings = new ArrayList<> (Arrays.asList(splittedString));
        ArrayList<String> finalStrings = new ArrayList<>();
        for (String str : strings) {
            ChatColor.translateAlternateColorCodes('&', str);
            finalStrings.add(str);
        }

        return finalStrings;
    }

umm help, am trying to make something that splits and colors (with the color code) a String, seperering it into a array

#

for lore

#

and tis is not working

urban kindle
#

Can I create multiple configurationsection or not?

#
        String rewards = "";
        ConfigurationSection comum = Main.instance.recompensas.getConfigurationSection("Recompensas.Comum");
        for (String key : comum.getKeys(false)) {
            try {
                String name = comum.getString(key).replace("&", "§");
                if (type == Rewards.COMMOM) {
                    rewards = name;
                    MySQL.updateUItem(p, name);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        
        return rewards;
    }```
#

I created it like this and I want to put another one for the rare item, I can make another configuration section or it's ok

remote swallow
#

You can make however many you want

#

And they can go in eachother

urban kindle
#

Okay thanks

humble tulip
#

IntelliJ tells me this is missing a return

#

ah wait

#

nvm ik why

#

fixed

#

yep

urban kindle
#

I have another problem, I wanted to know how to make it draw an item inside the configurationsection that I made

#

I wanted to make that if the item was of the common rarity it would draw one of the names that are within the common

torn badge
#

Anyone have an idea on how I could make setItemMeta() more performant if I have to call it on almost every item that drops in the world?

torn badge
#

Would that even make a big difference? Since almost all of those items are picked up eventually

#

So it would just move the load to another point

humble tulip
#

oh you mean in your case

#

hm

torn badge
humble tulip
#

how are you doing it atm?

#

can you show a snippet?

torn badge
#

Just setting the lore in ItemSpawnEvent

#

And setting some keys in the PersistentDataContainer

humble tulip
#

do you need to add the same lore to every item?

#

or is it on a per item basis?

torn badge
#

It depends on the item

humble tulip
#

I doubt you could optimize it much then

torn badge
#

Async won't work since it's not thread safe

humble tulip
#

exactly

south skiff
#

Hello, I experimented a bit with LootTables. My plan was to give my chest this LootTable, but the chest is empty. These LootTables are really complex, so if anyone could help, that would be really nice ^^

        Block chestBlockLocation = chestLocation.getBlock();

        chestBlockLocation.setType(Material.CHEST);

        Chest chest = (Chest) chestBlockLocation.getState();
        chest.customName(Component.text("§cMeteorite"));


        Inventory chestInv = chest.getBlockInventory();

        ItemStack test = new ItemStack(Material.STONE);
        chestInv.setItem(5, test);
        chestInv.contains(test, 10);

        LootContext context =
                new LootContext.Builder(chestLocation).lootingModifier(player.getLevel()).build();


        LootTable lt = new LootTable() {
            @Override
            public @NotNull Collection<ItemStack> populateLoot(@Nullable Random random, @NotNull LootContext context) {
                int loot = context.getLootingModifier();
                double lootingMod = loot * 0.2;

                final List<ItemStack> items = new ArrayList<>();

                if (random.nextDouble() <= (.05 + lootingMod)) {
                    int dropAmount = random.nextInt(3);
                    items.add(new ItemStack(Material.LEATHER, dropAmount == 0 ? 1 : dropAmount));
                }
                return items;
            }

            @Override
            public void fillInventory(@NotNull Inventory inventory, @Nullable Random random, @NotNull LootContext context) {

            }

            @Override
            public @NotNull NamespacedKey getKey() {
                return new NamespacedKey(JavaPlugin.getProvidingPlugin(MoonLightMC.class), "extra_meteorite_loots");
            }
        };

        chest.setLootTable(lt);
        chest.update();```
subtle temple
#

anyone able to help with a texture pack. I cant figure out why its not applying to my model

#

im guessing it has to do with my format of my model in model.json but cant pinpoint what im doing wrong

river oracle
#

I'm trying to use caffeine's AsyncCacheLoader for my plugin. I setup a removal listener, but when the server shutdowns obviously everything is removed async which isn't exactly ideal. I looked through Caffeine's docs and it seems there is absolutely no way to run it sync without triggering the removal listener that's in place for when the server is running. This is mildly annoying because this ruins the convenience of using a AsyncLoadingCache in the first place. purely because when the server gets shut down the data won't have time to save. Any ideas on how to improve my cache setup or get rid of things at server stop?

humble tulip
humble tulip
subtle temple
#

got it.

TEXTURE LOADING CHANGES

To improve loading performance, block and item textures are now loaded before they are processed by block and item models

By default, textures not in the textures/item and textures/block directories will no longer be automatically recognized and will fail to load
river oracle
#

I mean no I can't find anything

south skiff
humble tulip
south skiff
#

Oh okay, I really have no idea how these LootTables work :(

humble tulip
#

LootContext applies to mobs

south skiff
#

Oh okay

humble tulip
#

if savingOnDisable is false, let your listener not do anything

river oracle
#

I suppose :/ I was hoping for a fairly clean solution

dire marsh
#

you can call synchronous can you not?

#

there is a method for a sync view

river oracle
#

don't think you understand how caffeine is setup, but no

dire marsh
#

my current setup is a saveUser future method, on disable I just take the sync view and save that user calling join method on the future

river oracle
dire marsh
#

so you're saving in the removal listener?

river oracle
#

while the server is running yes

#

RemovalListener is run asynchronously

dire marsh
#

my setup is pretty specific but I personally check if it was removed via the explicity type, if it was that removal type let whatever removed it explicity handle any optional saving

river oracle
#

I am saving data based on a spigot event not off of cache policy

dire marsh
#

rip

river oracle
#

I could technically save off of a cache policy, but that'd also cause background tasks to be running that just don't need to be

wet breach
#

If you are saving to a db periodically just create a daemon thread specifically for db calls

#

Then it doesnt really matter what is going on for that thread as it would be separate from the main thread

river oracle
#

I don't mind whats going on, on the other threads was just looking for a decent way to save with Caffeine, which minion suggested. Don't necessarily feel like making my own cacheing api with the features caffeine offers

green tapir
#

how to summon fireball flying at direction mob is facing

#

like mc cmd

#

pls help

remote swallow
#

./summon fireball?

green tapir
#

that summons a fireball hovering but not fired

#

i want to make a pikachu and the thunderball move is using mythicmobs

#

and

#

i summon a fireball with electric particles i did that but it doesnt fly naturally

#

it just hovers

remote swallow
#

you cant summon a moving fireball

#

there is no way to add velocity to it

green tapir
#

then can i make the mob hit it?

#

is that possible?

remote swallow
#

no idea

#

its a mob

green tapir
#

its a husk

remote swallow
#

i doubt it can have a click triggered

green tapir
#

maybe summon invis ghast that auto targets?

#

is that possible?

remote swallow
#

not by /summon

green tapir
#

i think you can /summon a mob with invis right?

remote swallow
#

you can

green tapir
#

yea that's all i need then

#

cuz ghasts dont target husks?

remote swallow
#

no idea

#

/summon mob ~ ~ ~ {invisible:1b} or somethign

green tapir
#

ok

#

thx for the help

ivory sleet
#

Its not like that thing isnt thread safe if u get what I mean

#

Also because the notion of sync is relative

humble tulip
#

bruh

#

just realized theres a half assed ArmorEquipEvent in spigot kinda

#

GenericGameEvent

ivory sleet
#

Mye

humble tulip
#

that's acc kinda cool

#

I dont need to use the ArmorEquipEvent from mfnalex

ivory sleet
#

Mye

remote swallow
#

poor alex

ivory sleet
#

I never really used those events

remote swallow
#

spent so long makig it

ivory sleet
#

NMS <:

humble tulip
#

you still need to use alex's event if you need any information other than the fact that armor was equipped

full steppe
#

hey guys

#

i'm new in minecraft plugin development, so the question is pretty simple

#

what event is called when a player moves an item to a container or back?

wet breach
#

Inventory click event and inventory drag event are the two you will utilize. Inventory move event is used for hoppers

full steppe
#

yeah I have already found out by myself that InventoryMoveItemEvent is for hoppers

#

well

#

I thought there should be an event fired when you move an item across the inventories

#

I slightly don't get how to use InventoryClickEvent and InventoryDragEvent

#

can u please help?

#

my code when I used InventoryMoveItemEvent by mistake was ```java
@EventHandler
public void onRemove(InventoryMoveItemEvent event) {
ItemStack item = event.getItem();
if (item.getType() != Material.DEBUG_STICK) {
return;
}
else {
Bukkit.getLogger().info("Stick was (not) moved to a container");
event.setCancelled(true);
}
}

#

I just want to disallow people on my server to put debug sticks into containers

kind hatch
crystal palm
#

im looking to make it so that specific dropped items cannot explode/burn. is entitydamageevent the only way to do it?

remote swallow
#

Entity or Block explode event

#

they both should have a way to get blocks being blown up

crystal palm
#

i said dropped items :p

remote swallow
#

the entity explode event might do that

crystal palm
#

i dont think it has getEntities()

remote swallow
remote swallow
#

this will probably be something like a creeper exlpoding

#

some of these event names

crystal palm
#

mhm
i think ill just have to use entitydamageevent for this and check whether damage type was explosion && entity was item

remote swallow
#

looks like they dont have any method for re-setting the explode list so i would guess the damage eent

crystal palm
#

yeh

onyx blade
#

So I am adding features to a plugin for someone, this plugin has a stats.yml file. Gets updated with players in game stats. Basic enough.

There is a lobby server and a game server, both running this plugin. Somehow the stats.yml file is synced on both servers but I can't find any logic in the plugin that would do this.

Is there some built in function I am missing here?

#

Any help would be great

fluid river
#

is that your plugin?

#

from the beginning

onyx blade
#

No, it is not my plugin

fluid river
#

which stats are synced

onyx blade
#

Sec

fluid river
#

plugin might have some messaging support

onyx blade
#

I can see the SQL implementation but it's not been put in

fluid river
#

is bungeecord proxy runnin the same plugin?

#

but for bungee

onyx blade
#

This is the only time these stats are really saved in any way

#

and it just looks like standard saving 🤷‍♂️

onyx blade
onyx blade
#

still at a complete loss

remote swallow
#

took years

marsh hawk
#

Hello,
Not sure if this is the right place to ask this.
I've gone through the server chats for similair answers, but it looks like there is no 100% clear answer.
Whats the situation on releasing plugins? What cannot be released, because of copyright, only nms imports?
Is there perhaps a guide/link for a way to correctly compile a plugin, making it distributable?

ivory sleet
#

oh fuck that was the wrong thing

marsh hawk
ivory sleet
#

this
"Any Mods you create for the Game from scratch belong to you (including pre-run Mods and in-memory Mods) and you can do whatever you want with them, as long as you don't sell them for money / try to make money from them and so long as you don't distribute Modded Versions of the Game. Remember that a Mod means something that is your original work and that does not contain a substantial part of our code or content. You only own what you created; you do not own our code or content."

#

from eula

ivory sleet
#

that is fine

round finch
#

Is injection sellable?

#

I haven't read the whole deal

ivory sleet
#

I believe so

#

injection is also kind of ambiguous

#

but "in-memory Mods"

#

I assume it falls under that

round finch
#

Ahh

#

I see

#

So none possible way lol

ivory sleet
#

idk

#

im not an expert, but regarding nms imports im quite sure

marsh hawk
ivory sleet
#

So I understand it is that spigot plugins depend on the spigot api

#

as such, they're completely commercializable

kind hatch
# marsh hawk It seems like Im misunderstanding something. Wouldnt this imply that it is not f...

Minecraft has commercial usage guidelines. https://www.minecraft.net/en-us/terms#terms-commercial_guidelines

Although it mostly covers server related monetization, the rules are pretty lax so long as you aren't trying to impersonate the brand or distribute pure mojang code. It's even stated later in the guidelines to just use common sense. It should also be noted that there is a difference between mods and plugins. Although mojang/microsoft reserve the right to declare what constitutes a "mod", it's been pretty clear that spigot plugins aren't mods. It's just due to the nature of what spigot is. Spigot is free modification of the vanilla server jar. So it fits within the rules of the EULA.

The important part to remember is that Spigot is an API. So plugins that use the API aren't distributing mojang code, they are distributing spigot code. Hence, they are allowed to be monetized.

marsh hawk
wet breach
#

as well as there is case law to back up such definitions

warm light
#

is there anyway to remove slash command which was created by my bot? (JDA)
making a plugin that use / features. want to register command onEnable and remove onDisable

remote swallow
#

dont register them globally

#

and i dont think you can remove commands like that

vale ember
#

is there a way to convert item meta into org.bukkit.attriubte.Attributable?

kind hatch
remote swallow
#

iirc they had a method to update commands but idk if it updates global

warm light
remote swallow
#

might be something like updateCommands

kind hatch
#

You can indeed remove global commands.

#

It'll just take some time to fully propagate to servers.

warm light
#

umm, so only global command can be removed and it will take upto 1 hour?

remote swallow
#

you can remove guild commands iirc i just dont remember how

kind hatch
#

IIRC, there were some weird rules for guild commands.

warm light
#

okay, I will figure this out
I need more 1 help.
its saying I need to call OptionData#setAutoComplete(true)
but where? it didn't show any example

remote swallow
#

auto complete is default from what i remember

warm light
#

ow

#

okay thanks

kind hatch
#

It's been a while but, I believe the difference between global commands and guild commands is whether or not you use the Guild class.
Guild#updateCommands() vs JDA#updateCommands()

Also, I believe that guild commands are instantly updated.

remote swallow
#

you can register guild commands

#

my brain typed that before i read the Guild is just for guild

radiant cedar
#

anyone know why this could be happenning

remote swallow
#

its a non ssl certified domain, you have to enable it in settings.xml in maven

radiant cedar
#

i cant find settings.xml

radiant cedar
remote swallow
#

it would have to be in maven home from what i remembere

radiant cedar
#

idk what this is

remote swallow
#

@wet breach you maven right?

wet breach
#

yep

radiant cedar
#

could u help me

wet breach
#

in a bit i can

radiant cedar
#

ok just ping me pls

vale ember
#

How do you resolve an ADD_SCALAR (Operation 1) attribute modifier on an item?

kind hatch
remote swallow
vale ember
tropic ingot
#

public class PlayerGrimaldelloListener implements Listener {
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
Block block = event.getClickedBlock();
ItemStack item = event.getPlayer().getInventory().getItemInMainHand();

    // Check if the player is clicking on a iron door
    if (block != null && block.getType() == Material.IRON_DOOR) {
        Door door = (Door) block.getBlockData();
        // Check if the player is holding the specific stick
        if (item.getType() == Material.STICK && item.getItemMeta().getCustomModelData() == 303002) {
            // Open or close the door
            door.setOpen(!door.isOpen());
            block.setBlockData(door);
        }
    }
}

Why when in game I stick click with CustomModelData equal to "303003" the iron door doesn't open?

remote swallow
#

its a method on the attributes

vale ember
#

like #addAttriubteModifier?

remote swallow
#

yeah

vale ember
#

i mean something different,

remote swallow
spiral junco
#

Hey Guys i have a question, is it possible, to change the plugin GriefPrevention like "u can´t break blocks of other people claims" but u can "use tnt to break their claims" i want to make a Minecraft Server what is like the game "Rust" does it work ? or how can i make it work

kind hatch
vale ember
#

i wanna calculate their values myself

remote swallow
#

check stash

vale ember
#

i have a list of attribute modifiers with this operation, how do i calculate it? it depends on attributes base value, but how do iget that for an item

radiant cedar
#

i havent done maven before

tropic ingot
remote swallow
#

print the custom model data before the check

tropic ingot
kind hatch
# radiant cedar how can i do this could u help me

I haven't had many reasons to use the settings.xml file and frostalf would probably know more than me, but I believe that you can make a .mvn directory in your project and create two files.
maven.config
local-settings.xml

The first file just declares what setting file to use when the compiler starts to run. The second file is the file that you will point to in the config file. Then you can setup your mirror rules in the settings file.

Idk why the repo you are trying to use isn't using HTTPS, but you should probably ask the dev to fix that.

remote swallow
#

System.out.println(item.getItemMeta().getCustomModelData())

tropic ingot
remote swallow
#

look in console for the data

#

you are printing the value so you can check what it is

tropic ingot
tropic ingot
remote swallow
#

sysout something after the door.setOpen

#

oh wait

#

i know your issue

#

its running once for each hand

#

?interactevent

undone axleBOT
#

The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.

For example, only executing code if the main hand was used:

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
    if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
        return; // do not progress past this point  |
    }
    // provide functionality
}
quaint mantle
#

how do I do it so when I plant a wheat seed with a specific name it starts monitoring and when the wheat grows completely it replaces the block

tropic ingot
#

Indeed you are right

remote swallow
#

then do your checks on it

radiant cedar
#

i changed http to https in their repositroy

#

and it works lmfao

tropic ingot
remote swallow
#

add a sysout after each if statement and see where it gets to

wet breach
radiant cedar
#

intellij

#

well it works now cus it was meant to be https instead of http

#

but now i get Caused by: java.lang.NullPointerException: Cannot invoke "com.nametagedit.plugin.api.INametagApi.setNametag(org.bukkit.entity.Player, String, String)" because the return value of "com.nametagedit.plugin.NametagEdit.getApi()" is null

wet breach
#

need to declare it a dependency in your plugin.yml and ensure it is present on your server

#

can't just depend on something and then it not be there

quaint mantle
wet breach
# radiant cedar intellij

for future reference, intellij uses the settings.xml from this location C:\Users{user}\.m2\settings.xml

#

also projects can override the global as well by including a settings.xml in the root project folder

radiant cedar
#

is this how u depend

kind hatch
#

No need for .jar

#

Just the name of the plugin.

tropic ingot
radiant cedar
#

ok also does the version in the dependency hav eto be the same as the jar

wet breach
#

Now when others use it, and don't have that dependency it will in a more kind way tell them that 🙂

wet breach
wet breach
#

does the jar on the server have to match the version in the dependency listed in the pom

radiant cedar
wet breach
#

is what I think they are referring to

radiant cedar
wet breach
#

but an easy fix is just to depend on the updated version

kind hatch
#

What version are you using?

tardy delta
#

1.8 🤡

radiant cedar
tropic ingot
tardy delta
#

check the name in their plugin.yml

#

NametagEdit

radiant cedar
#

oh mb

#

lmao

kind hatch
#

That should solve your issue.

radiant cedar
#

this still happens tho

kind hatch
#

Legacy Materials are used if you don't specify an api version.

tardy delta
#

💀

tropic ingot
tropic ingot
formal bear
#

How to set world's time to day? What's the exact long value for start of the day in minecraft? 0?

kind hatch
#

Minecraft days start at 0 and end at 24000.

formal bear
#

Tysm!

covert yacht
#

Hi, is there a fast way to copy a specific block with all it's data, like content for chest or text for signs etc (basically all blocks that can be altered in any way) ?

wet breach
#

the fastest way would be to just copy the nbt data from the chunk

#

well correction that is the safest fastest way

#

the unsafe fast way would be to just look inside the region file and grab the data you are looking for without waiting on the server to load it lol

covert yacht
#

Cureently i have this that copies facing + block but not content

Material blockToPaste = bottomBlock.getBlock().getType();
BlockData blockData = bottomBlock.getBlock().getBlockData();
spawnPoint.getBlock().setType(blockToPaste);
spawnPoint.getBlock().setBlockData(blockData);
opal wedge
#

Hey, I use some NamespacedKey in my plugins. Is it a good habit to set these static final or is there another way to create them? An example is:

public static final NamespacedKey MAP_KEY = new NamespacedKey(Minesweeper.getPlugin(Minesweeper.class), "map");
radiant cedar
#

it still doesnt work

quaint mantle
#

[12:12:19 PM ERROR] [Minecraft] Could not pass event PlayerInteractEvent to

#

someone knows why?

hasty prawn
#

Well you didn't provide the full error so we're kind of left guessing, but both getClickedBlock() and getItemInUse() can be null which would throw an error.

quaint mantle
#

the full error was just Could not pass event PlayerInteractEvent to PluginName-1.0

undone axleBOT
radiant cedar
#

Anyone know a way I can change peoples names on their head?

humble tulip
#

What version?

radiant cedar
#

1.19.2

humble tulip
#

You can send a packet to destroy a player

#

And spawn one with another name

radiant cedar
#

Can i do team with prefix and suffix

humble tulip
#

Hm not sure actually

#

Why isn't nametageedit working?

radiant cedar
#

No clue

radiant cedar
humble tulip
#

Did nametagedit enable properly?

#

Check your entire latest.log

radiant cedar
#

Ye

#

Lemme check again

#

ye its enabled properly

#

what does this mean

undone axleBOT
humble tulip
#

Did u shade nametagedit?

#

LOL

radiant cedar
#

i do not know what that means

humble tulip
#

Add scope provided to nametagedit

radiant cedar
#

i think it works now

#

tysm guys

quaint mantle
#

still giving the same error :(

remote swallow
#

do i need to remap/reobsfucate if im using something.b().b() or is that obsfucated

#

and not needing remapping

wet breach
#

that is obfuscated

remote swallow
#

so i shouldnt need to do anything else?

wet breach
#

shouldn't need to if its already obfuscated

remote swallow
#

this gets somewhat easier

wet breach
#

I have always used obfuscated code as its never been an issue in just looking to see what it does lol

remote swallow
#

screamingsandles ftw

vale ember
#

where can i find docs for api.spigotmc.org and is there any api for java?

quiet ice
#

?jd-s You mean that?

undone axleBOT
vale ember
#

not that

#

the api for website

#

(forum)

#

for like getting resource's version in code

quiet ice
#

Spiget might have a wrapper, but not completely sure about that

#

There definitely aren't any docs within an official capacity that I am aware of

tropic ingot
#

I should make that every time I use a tool (in this case a wooden shovel) it decreases its durability by 30, the code works except for the part where it actually has to decrease the durability. Reading on I found that setDurability and getDurability have been deprecated. How could I modify the code to make it fit and make it work?

quiet ice
#

You need to increment the damage

tropic ingot
quiet ice
#

however if I had to guess your item.getType().getMaxDurability() > durability is the root cause of your issue. The APIs should still work, even if they are deprecated

#

Well there are caveats attached to it which is why they are deprecated. If you are unsure - better read the notice in it's entirety

wet breach
vale ember
tropic ingot
quiet ice
#

You use getDamage

wet breach
#

well hasDamage() is only going to give you two values

#

so I mean not really whole lot of options there

remote swallow
#

you have to cast it to damageable

#

or better you should use an if check with instanceof

wet breach
#

either it is going to be true or it is going to be false

sterile token
# chrome beacon What's wrong with Redis?

Our problems came on testing phase when we tried all posible events that may happen.

For example, redis service is shutdown, what happen with our pub/sub data? Well that data will be loosted

#

I don't know if i really explained My point

#

No no i don't think You understand what i keak

chrome beacon
#

You know that other systems can fail not just Redis

#

You'll need to handle that

sterile token
#

Althought there is something called RabbitMQ another mesaage broker which has a similar way for transmiting data but works using the collector based concept instead of pub/sub

remote swallow
#

and that appears on gradle reload

tropic ingot
sterile token
chrome beacon
#

Depends on how the queue is handled

sterile token
#

Yeah that make senses to me

#

But i still have my questions

chrome beacon
#

You will need multiple queue servers and replicate data, so nothing is lost if the queue server goes down

sterile token
#

Ok

#

So there i will need to make usage of?

#

I don't really understand how they make data replication

proper notch
#

RabbitMQ is not necessarily an in-memory queue. It does save to disk and IIRC u can control some of this behaviour

sterile token
#

Okay

#

I thought that both of them worked directly on memory

#

I suppouse that rabbit save the data to disk but it's still a memory if i'm not wromg

proper notch
#

Ultimately tho, replication and automatic recovery is the way to ensure HA

sterile token
#

Ok, so what do u recommend me for data replication?

#

From My personal experience i never need to replicate the same data

#

The most related i have done is replication with mongo and redis using their incorporated clustering system

proper notch
#

I need to check but I think if your queues are durable the data will be persisted in case of some kind of failure. Lemme check tho

sterile token
#

Allrigth thanks gentle man

remote swallow
#

multi module is confusing

dim snow
#

Hey, this code works when a user joins (this code is ran on join):

var board = Bukkit.getScoreboardManager().getNewScoreboard();
        player.setScoreboard(board);
var obj = board.registerNewObjective(OBJECTIVE_ID, Criteria.DUMMY, Component.empty());
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
var team = board.registerNewTeam("test");
team.setPrefix("TEST PREFIX");
obj.getScore("test").setScore(0);

However, when they relog, no scoreboard is shown. Also note, creating a new scoreboard is a weak reference. So, it is destroyed when the user logs out (and no I do not store a reference to it)

#

Does anyone have any ideas (this is on 1.19.3, in Java 17)?

quaint mantle
#

Anyone help me with this? Can't workout why it's getting stuck at the contains checks...

sterile token
dim snow
#

I am using an annotation based system

#

that is not the problem

remote swallow
#

@echo basalt for some reason gradle is saying shadowJar isnt a applicable type for my root project and its just started happening after ive added my multi-module stuff and i dont how why or how its happened and how to fix it

echo basalt
#

what makes you think I'm a gradle expert

#

I have beginner level of knowledge when it comes to gradle

sterile token
#

Hahaha

remote swallow
quaint mantle
#

Anyone? 🙂

remote swallow
#

you have like 600 projects

sterile token
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!

quaint mantle
#

none

#

just sends me my debug messages

remote swallow
#

what part are you getting stuck on

quaint mantle
#

The checks for the arraylist

remote swallow
#

checking if the list contains the uuid?

quaint mantle
#

Yep

remote swallow
#

i dont get how you get stuck on that

#

list.contains

quaint mantle
#

Neither

#

It's stupid af

remote swallow
#

i doubt it being final is doing any good

tropic ingot
quaint mantle
#

Yeah idk the ide highlights it as an error without

#

Makes sense for it to not be final though

remote swallow
#

what does the ide say

#

let me guess

quaint mantle
#

Field 'STAFF' may be 'final'

remote swallow
#

ss it

quaint mantle
dim snow
quaint mantle
#

Yeah that is true, I'm only checking for contains etc

#

Still don't get why it's getting stuck

dim snow
#

it freezes the server?

#

or does it just not work

quaint mantle
#

No the events just aren't working, i debugged and it gets stuck at the checking of if the player is in the arraylist, I'm debugging the adding of the player right now

remote swallow
#

that would be the only way

#

if the player isnt in the list

dim snow
#

it gets "stuck" sort of sounds like it halts the thread. Are you using the same reference of ModeHandler to add them as when you check it?

remote swallow
#

are you creating 1 instance of the class on the command and 1 instance on the events

quaint mantle
#

Seperate classes

dim snow
#

you're creating two instances...?

remote swallow
#

so you have 2 new ModeHandlers?

quaint mantle
#

No

remote swallow
#

you are creating 2 instances of the class then

dim snow
#

where are you getting modeHandler from?

quaint mantle
#

hmm yeah I need to make it extend the class don't i, i am making 2 instances

dim snow
#

just make one instance

quaint mantle
#

It's two classes, command and listener

dim snow
#

either a static instance or one in your plugin class

quaint mantle
#

ah kk

#

yeah a getter

remote swallow
#

making the instance in main class is probably easier

quaint mantle
#

Yeah i'll do that thanks

dim snow
#

to be honest though that looks more like a utility class

#

you'd be better off just making the whole class static

quaint mantle
#

Never come across this before didn't realise it messed it up doing it like that

quaint mantle
#

Lol yeah ima avoid static

remote swallow
#

okay so i think this will be my one and only multi module project

dim snow
#

there's literally no harm in static

#

just a bunch of java noobs think it looks weird

remote swallow
#

lots of harm

#

kills everything

dim snow
#

no it doesn't..

remote swallow
#

makes everything throw nomethodfoundexceptions

dim snow
#

as long as you know what you're doing

#

bro what 💀

remote swallow
#

im joking

#

have you never heard of them

remote swallow
#

Component.empty() sounds like paper to me

dim snow
#

shhh

remote swallow
#

?whereami smh

quiet ice
dim snow
#

i am banned in their discord

#

😦

quiet ice
#

Learn your libraries

remote swallow
#

its used in paper for everything

dim snow
#

in this case lets just say im using adventure

dim snow
#

that's basically it, I set the lines it works when I first join

quiet ice
#

The entire class at best

#

If not, the entire event handler method

dim snow
#

I've debugged that part and I'm almost certain it's those lines right there

quaint mantle
# remote swallow im joking

Just so I know i'm right why, can you explain to me rq why creating the instance in the command class and in listener class of the modehandler messed that up?

dim snow
#

the code creates the scoreboard on join, I set the lines later on (all of this 100% happens)

quiet ice
#

Always making it so complicated

#

And you also set the objective and whatever?

remote swallow
quiet ice
#

Really, I want the full scope. These lines are NOT the issue

quaint mantle
#

Yhyh sound

humble tulip
#
            Block block = blocks.get(i);

            if (block.getRelative(BlockFace.UP).getType() == Material.AIR);
            
            else if (block.getRelative(BlockFace.DOWN).getType() == Material.AIR)
                block = block.getRelative(BlockFace.DOWN);
            
            else continue;
#

i feel like there's a way to not have an empty if

#

but i cant think of it atm

remote swallow
#

PepeCryHands i think i have to swap to maven

quiet ice
remote swallow
#

a singluar if statement without braces is fine

#

any more and you have braces

dim snow
# quiet ice Really, I want the full scope. These lines are **NOT** the issue
var board = Bukkit.getScoreboardManager().getNewScoreboard();
        player.setScoreboard(board);
var obj = board.registerNewObjective(OBJECTIVE_ID, Criteria.DUMMY, Component.empty());
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
var team = board.registerNewTeam("test");
team.setPrefix("TEST PREFIX");
obj.getScore("test").setScore(0);

Same issue

humble tulip
#

wait i typed that wrong

quiet ice
remote swallow
#

why should i type {} for something that doesnt need it

remote swallow
#

?paste the whole method

undone axleBOT
dim snow
#

that's literally the all the code

#

I removed everything else

quiet ice
remote swallow
#

looks weird

quiet ice
#

You never assign the player to the objective

humble tulip
#
        List<Block> blocks = player.getPlayer().getLineOfSight((Set<Material>) null, 20);

        for (int i = blocks.size() - 1; i >= 0; i--) {
            Block block = blocks.get(i);

            if (block.getRelative(BlockFace.UP).getType() == Material.AIR);

            else if (block.getRelative(BlockFace.DOWN).getType() == Material.AIR)
                block = block.getRelative(BlockFace.DOWN);

            else continue;

            player.getPlayer().teleport(block.getLocation().add(0.5, 0, 0.5).setDirection(player.getPlayer().getLocation().getDirection()));
            if (hasExecutorMessage())
                player.getPlayer().sendMessage(getExecutorMessage());
            return true;
        }
quiet ice
#

or ... lemme see how I do it

dim snow
#

?

humble tulip
#

i want to do nothing if above block is air

dim snow
#

also you were right

#

I just tested that code

#

im stupid LMAOOOO

#

god such a stupid bug

quiet ice
#

Did someone hijack @wet breach 's account

remote swallow
#

no

#

thats just frostalf

twilit garden
#
public static ArrayList<String> colorArray(String string) {
        String[] splittedString = string.split("@");
        ArrayList<String> strings = new ArrayList<> (Arrays.asList(splittedString));
        ArrayList<String> finalStrings = new ArrayList<>();
        for (String str : strings) {
            ChatColor.translateAlternateColorCodes('&', str);
            finalStrings.add(str);
        }

        return finalStrings;
    }

im trying to split and color a string

#

tis not working :/

#

pls help

remote swallow
#

if you want the colour to pass you need to get the last colour and apply that to the next string

quaint mantle
#

Best way to loop round the edge of an inventory? I tried imagining it was a 2darray but it hasn't gone to plan...

twilit garden
remote swallow
quaint mantle
#

ahh kk

warm light
#

I am getting 600+ can't find superclass or interface when using proguard. any idea?
I searched on google but didn't get proper help.
here is the proguard config.

-dontoptimize
-dontshrink
-dontobfuscate

-keep public class * extends org.bukkit.plugin.java.JavaPlugin {
    public *;
}

-keep public class * extends org.bukkit.command.Command {
    public *;
}

-keep public class * extends org.bukkit.event.Listener {
    public *;
}

remote swallow
# quaint mantle ahh kk
        for (int a = 0, b = 18; a <= 8 && b <= 26; a++, b++) {
            do(a);
            do(b);
        }
``` then just do the stuff for the extra
quiet ice
#

But I am not 100% sure given that I am not using proguard

humble tulip
#

https://youtu.be/Jv4p1Qs90FM

    @Override
    public boolean onClick(AbilityPlayer player, PlayerInteractEvent event) {
        if (hasExecutorMessage())
            player.getPlayer().sendMessage(getExecutorMessage());        player.getPlayer().setVelocity(player.getPlayer().getEyeLocation().getDirection().setY(0).normalize().multiply(10).setY(0.5));
        return true;
    }
#

not even moving me in my eye direction

quiet ice
#

A) Is that method called?
B) Are you sure that hasExecutorMessage() returns true

humble tulip
#

it works most of the time

#

hasexecutor msg doesnt matter

#

that's just to send the message You used ravage

#

ye it's called

#

it sends me the correct way most of the time

#

It always works if i'm in the air

rough drift
#

Sql Syntax error

quaint mantle
quiet ice
quaint mantle
#

If it was a 2darray id be able to do it

quiet ice
#

If it returns false we don't need to hold this discussion

quaint mantle
#

but can't do nested for loop the way you would with 2darray

humble tulip
#

no it doesnt

remote swallow
#

if (hasExecutor()) when its false be like

humble tulip
#

it doesnt matter

quiet ice
#

<hjkl jnbkötdjnh

humble tulip
#

it just sends the msg

#

which i do see

quiet ice
#

Use braces FFS

#

See and learn!

#

IT ABSOLUTELY DOES MATTER

remote swallow
#

no

#

braces b ad

quiet ice
#

But of course there is an absolute idiot telling otherwise

remote swallow
#

thats me

humble tulip
#

can you help me?

#

the braces aren't the issue

quiet ice
#

Give the hasExecutorMessage contents

humble tulip
quiet ice
#

IT DOES

remote swallow
#

it doesnt

#

you are wrong

humble tulip
#

no it doesnt

quiet ice
#

AH LOL

remote swallow
#

only the send message relies on that if

quiet ice
#

Yeah that is why I hate such if stuff

#

Because I merged the two lines in my head

remote swallow
#

if you realise the ssyntax its great

humble tulip
#

my issue is with setvelocity

quiet ice
humble tulip
#

it works all the time if im in the air and use it. It works unreliably on the ground

quiet ice
#

Most likely due to something known as gravity and friction. Perhaps moving the player a tiny bit more at teh Y axis might help?

humble tulip
#

i dont understand why it's moving me in a completely different direction

quiet ice
#

As in if it only works on air just make the player be in the air

humble tulip
#

if they're near the ground it's still unreliable

remote swallow
#

are you looking below eye line

#

look straight forward

frank kettle
#

Is there a way to check if a Material exists in that particular version?

Like for example Mob Spawners were MOB_SPAWNER and then became SPAWNER but I want my plugin to work for both versions so I'm trying to do like Material.valuesOf("SPAWNER")... and then check if the material was found or not and if not get MOB_SPAWNER instead.

is there a way for this? 🤔

#

if i try to check if it's null it says it will always be false.

remote swallow
#

ternary operators

tardy delta
#

Try catch

frank kettle
#

wait I guess Material.getMaterial("name") will do the job

tardy delta
#

XMaterial smh

remote swallow
#

Material.valueOf("SPAWNER") == null ? true : false;

frank kettle
#

checking if its null no longer says "always false"

#

whats the different between getMaterial and valueOf?

tardy delta
#

Bruh that method never returns null

frank kettle
tardy delta
#

I assume they implemented it as the Enum method

humble tulip
#

found the issue @remote swallow

#

it's the way mc handles collisions with blocks internally

#

well mc 1.8.8

#

since that's what my client wants it for

frank kettle
#

i guess this works

tardy delta