#help-development

1 messages · Page 2157 of 1

golden kelp
#

these are still left

slim kernel
#

dk what you mean with that but I need to save a loc basically so a player can teleport himself there then

eternal oxide
#

in which case you are likely going to need pitch and yaw too

slim kernel
#

yes

eternal oxide
#

and teh double precision

golden kelp
#

this prints that the list has elements but doesnt empty em

eternal oxide
slim kernel
crimson terrace
#

I fixed it, appearently this is what it takes to call a custom event

golden kelp
#

how do i get players in X radius of a Location

slim kernel
eternal oxide
#

it will handle all primitives fine

slim kernel
eternal oxide
#

it should handle blocks. I don;t belive there is anything in a Block that it would struggle with

twilit roost
#

How do I get TPS from BungeeCord?

golden kelp
#
scheduler.scheduleSyncRepeatingTask(this, () -> {
            for (Location loc : getLightLocations()) {
                for (Player player: getServer().getOnlinePlayers()) {
//                    if(player.getLocation().getBlock().equals(loc.getBlock())) {
                        World world = loc.getWorld();
                        int lightLevel = LightAPI.get().getLightLevel(
                            world.getName(),
                            loc.getBlockX(),
                            loc.getBlockY(),
                            loc.getBlockZ()
                        );
                
                        if(!world.getNearbyEntities(loc, 1, 1, 1).contains(player)) {
                            if (lightLevel > 0) {
                                LightAPI.get().setLightLevel(
                                    world.getName(),
                                    loc.getBlockX(),
                                    loc.getBlockY(),
                                    loc.getBlockZ(),
                                    0
                                );
                                getLightLocations().removeIf(location -> location.equals(loc));
                            }
                            LightAPI.get().setLightLevel(
                                world.getName(),
                                loc.getBlockX(),
                                loc.getBlockY(),
                                loc.getBlockZ(),
                                lightPlayers.get(player).getIntensity()
                            );
                        }
                        
//                    }
                }
            }
        }, 0L, 0L);
#

This still leaves some lights

lost matrix
twilit roost
#

I mean from BC plugin
I want to get all servers tps

lost matrix
#

Send a custom plugin message through plugin messages

twilit roost
#

right.. thx

slim kernel
ivory flume
#

does anyone know hwo to create custom entities with ai? i just need to use player models

#

but i need them to do stuff

#

how would I make it? how would I add ai to it?

lost matrix
ivory flume
#

i did modding before

#

nms shouldnt be so hard

#

is there any guide on how to start

lost matrix
#

You need to extends an nms entity that is of type insentient and change its AI goal selector.
But making an entity look like a player is a bit tricky.

ivory flume
#

oh?

#

can you explain

lost matrix
#

Which part. How to create a custom entity or how to disguise entities as players?

ivory flume
#

is there like a guide anywhere

#

disguise entities as players

#

i think i can figure out the other stuff

lost matrix
midnight shore
#

how did they put a text under the pointer?

lost matrix
#

with a resourcepack

midnight shore
#

no no there isn't any

tender shard
#

isn't that just a title?

ivory flume
#

pretty sure rhats just /title

lost matrix
#

Then its probably the second line of a title

#

makes sense because of the shadows

ivory flume
#

subtitle 👀

tender shard
#

yea just Player.sendTitle(null, ".......") or sth

midnight shore
#

okkk thank you all i didn't think of that option

tardy delta
#

are these good to use?

humble tulip
#

I don't even set those😂

#

I jjst use whatever the default is

errant narwhal
#

hi can someone help how to set custom damage for itemstack?

humble tulip
#

It's not like i need to push it to its limit so i assume the default works well enough

tender shard
#

just cast the ItemStack's ItemMeta to Damageable, set the damage, then set back the Meta using ItemStack.setItemMeta(...)

errant narwhal
tender shard
#

oh idk about 1.12

#

I only do 1.13+ stuff

errant narwhal
#

let me try

tender shard
#

I think in 1.12 you can just do setDamage(...) or sth on the itemstack itself

lost matrix
tender shard
#

I think they want to damage the item itself, and not change how much damage this itemstack does to mobs

#

but not sure

errant narwhal
tender shard
#

do you want to "damage" the itemstack, or change how much damage this item does to mobs/players?

errant narwhal
tender shard
#

ooh okay

#

then ignore everything I said

errant narwhal
#

thank you

tender shard
#

you could always use the EntityDamageByEntityEvent, then check if the damager had your custom item equipped

errant narwhal
#

i will doing event EntityDamagebyEntity event to change damaage

tender shard
#

but attributes are better, as 7smile said

errant narwhal
tender shard
#

yeah as said, I don't know anything about 1.12 API

#

but I am pretty sure that attributes existed there too

errant narwhal
#

@lost matrix do you have anyway to set Attribute for item in bukkit 1.12.2?

ebon coral
#

Can anyone familiar with JSON help me- I am trying to get a long value from a JSON Object but it gives me this error, but it also literally says it's a long..

waxen plinth
#

It's a string

#

It's wrapped in quotes, so it's a string

#

Get it as a string and then use Long#parseLong

ebon coral
#

Why would it be?

crimson terrace
#

Long.parseLong() i think should help

ebon coral
#

Hm

waxen plinth
#

I dunno, you tell me

ebon coral
#

But it's literally stored as a long :{

#

Int64 is a long

crimson terrace
#

its serialized, which means that it is stored as a String basically

#

when deserializing you have to take that into acount

waxen plinth
#

Oh worse yet

#

It's storing the long as a JSON object

ebon coral
#

Why would it be serialized though, I thought converting a document to json handles that.

#

Oh god what why

waxen plinth
#

It might be due to boxed types

ebon coral
#

So should I iterate and unbox each thing when converting the document to json?

crimson terrace
#

you meant this when saying that it was stored as a long?

ebon coral
#

On MongoDB it is stored as a long, and all I did was Document.toJson() which converts the document to json, which leads to me to believe that it'd be a long lol

#

Then again it's just printing the Json Element as a string, that could be it's info when it's a string- but when I do getAsLong() (what it should be) it errors.

tender shard
#

json is a bit weird

#

one reason to avoid it lol

crimson terrace
#

the key to the value is "$numberLong", that doesnt mean it is stored as a long

ebon coral
#

The key is supposed to be "price" lol

#

When getting the "price" element it is that

#

Alright I may have found the issue, when looking into MongoDB- using toJson has different modes which changes what the output will be for things.

#

It seems if I set it to relaxed it'll fix the issue.

#

Yup

sterile token
#

Oh you are talking about Mongo i seen, as far im getting this shity error but i think its caused by the logger of mongo:

may 22, 2022 11:15:22 A.M. 
com.mongodb.diagnostics.logging.JULLogger log

INFORMACIÓN: Cluster created with settings {hosts=[127.0.0.1:27017], srvHost=mongodb.aa6vu.mongodb.net, mode=MULTIPLE, requiredClusterType=REPLICA_SET, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500, requiredReplicaSetName='atlas-j0k5hq-shard-0'}
#

If someone can confirm i will be thanks

gleaming olive
#

How do I get if the block is tilled dirt ?
LEGACY_SOIL is deprecated

crimson terrace
#

do you mean Material.FARMLAND?

latent pelican
#

`
import net.minecraft.world.entity.ai.goal.target.PathfinderGoalNearestAttackableTarget;
import net.minecraft.world.entity.animal.EntityPig;
import net.minecraft.world.entity.monster.EntityZombie;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_18_R1.CraftWorld;
import org.bukkit.entity.Zombie;

public class CustomZombie extends EntityZombie {

public CustomZombie(World world) {
    super(((CraftWorld)world).getHandle());

    Zombie craftZombie = (Zombie) this.getBukkitEntity();

    this.targetSelector.a(new PathfinderGoalNearestAttackableTarget<EntityPig>(this, EntityPig.class, true));

    this.getWorld().addEntity(this);
}

}
`
Why are my methods targetSelector and getWorld red - cannot ressolve method xy in Custom Zombie?

eager knoll
#

How would I go about creating guilds that I can be saved and others can join?

sterile token
fringe latch
eager knoll
#

But it also has to save over server restarts

sterile token
#

Then you should use a database/yaml or json for saving them

latent pelican
fringe latch
#

try this.bQ instead of this.targetSelector

tardy delta
#

bbq

midnight shore
dusk flicker
#

It's compiled on a newer Java version than the one you are running

midnight shore
#

yes i know that, but how can i fix this? that is a dependency i added in my pom

quaint mantle
#

use Java 17

midnight shore
tardy delta
#

^

dusk flicker
#

Basically update your Java

tardy delta
#

or use an older version of the dependency which i might not recommend

midnight shore
midnight shore
daring lark
#

can i put items on head of armorStand?

dusk flicker
#

Find an older update than

#

Or update to 1.18

midnight shore
#

or probably not

dusk flicker
#

Doubt that

#

Not many things changed on the api side iirc

#

Only thing is really the world

midnight shore
#

this is 1.18 right?

dusk flicker
#

Yes but use 1.18.2

quaint mantle
#

is there a way to make tnt smaller

#

or like have it ride a player

#

without ruining their hitreg

midnight shore
quaint mantle
#

you forgot the R0.1

midnight shore
dusk flicker
#

Forgot the -

#

Legit your first 1.18 one but you add .2 after the 1.18

midnight shore
#

so R0.2?

dusk flicker
#

No

azure vault
#

1.18.2-R0.1-SNAPSHOT @midnight shore

#

not that hard

#

how do I retrieve the clicked entity from a PlayerInteractEntityEvent?

midnight shore
#

Thank you

dusk flicker
#

Get the entity

azure vault
#

how

midnight shore
#

e.getRightClicked() i guess

azure vault
#

no

tardy delta
#

check the docs

azure vault
#

oh

#

wait

#

for fucks sake

#

I'm blind

tardy delta
#

or check what methods the object has

azure vault
#

I was looking for getClickedEntity

#

:madge:

#

thanks

midnight shore
#

np

dusk flicker
#

Lol

midnight shore
#

idk why my maven reload is getting slower and slower, even if i don't quite think there are lot of heavy things in there

daring lark
#

is there any way to create armorstand inside a blokc>

#

?

midnight shore
#

get a location and spawn the armorstand there, it will spawn at any location even if it is inside of a block

daring lark
#

no

midnight shore
#

?

dusk flicker
#

That's how I'd do it lol

midnight shore
#

or if it doesn't work just teleport inside

dusk flicker
#

Probably need to deal with collisions and what not

daring lark
#

do you know how?

karmic hull
#

is there a method in the ProjectileHitEvent event that gets the damaged/hit entity? (That works in the 1.8.8, event.getHitEntity(); throws a NoSuchMethodError here)

dusk flicker
#

Check the javadocs

#

If it's throwing a nosuchmethod i would assume that your api version does not match the server version

tardy delta
#

listen for the EntityDamageByEntityEvent and verify that the damager is an arrow and get the entity (defender)

#

same thing

tardy delta
#

iirc tho

karmic hull
#

im so silly

#

thanks man

daring lark
midnight shore
crimson terrace
#

bad password?

quaint mantle
midnight shore
crimson terrace
#

then I dont know

midnight shore
#

i fixed, ty anyways

dense falcon
#
plugins {
    id 'java'
}

group 'fr.program.testplugin'
version '1.0.0'

repositories {
    maven {
        url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
        content {
            includeGroup 'org.bukkit'
            includeGroup 'org.spigotmc'
        }
    }
    maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
    maven { url = 'https://oss.sonatype.org/content/repositories/central' }
}

dependencies {
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
    compileOnly 'org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT'
}

test {
    useJUnitPlatform()
}
``` When I execute : gradle on the right -> build -> jar, I got this: ```
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not find commons-lang:commons-lang:2.6.
     Searched in the following locations:
       - https://oss.sonatype.org/content/repositories/snapshots/commons-lang/commons-lang/2.6/commons-lang-2.6.pom
       - https://oss.sonatype.org/content/repositories/central/commons-lang/commons-lang/2.6/commons-lang-2.6.pom
     Required by:
         project : > org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT:20220517.093124-43
   > Could not find com.google.guava:guava:31.0.1-jre.
     Searched in the following locations:
       - https://oss.sonatype.org/content/repositories/snapshots/com/google/guava/guava/31.0.1-jre/guava-31.0.1-jre.pom
       - https://oss.sonatype.org/content/repositories/central/com/google/guava/guava/31.0.1-jre/guava-31.0.1-jre.pom
     Required by:
         project : > org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT:20220517.093124-43
   > Could not find com.google.code.gson:gson:2.8.9.
     Searched in the following locations:
       - https://oss.sonatype.org/content/repositories/snapshots/com/google/code/gson/gson/2.8.9/gson-2.8.9.pom
       - https://oss.sonatype.org/content/repositories/central/com/google/code/gson/gson/2.8.9/gson-2.8.9.pom
     Required by:
         project : > org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT:20220517.093124-43
   > Could not find net.md-5:bungeecord-chat:1.16-R0.4.
     Searched in the following locations:
       - https://oss.sonatype.org/content/repositories/snapshots/net/md-5/bungeecord-chat/1.16-R0.4/bungeecord-chat-1.16-R0.4.pom
       - https://oss.sonatype.org/content/repositories/central/net/md-5/bungeecord-chat/1.16-R0.4/bungeecord-chat-1.16-R0.4.pom
     Required by:
         project : > org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT:20220517.093124-43
   > Could not find org.yaml:snakeyaml:1.30.
     Searched in the following locations:
       - https://oss.sonatype.org/content/repositories/snapshots/org/yaml/snakeyaml/1.30/snakeyaml-1.30.pom
       - https://oss.sonatype.org/content/repositories/central/org/yaml/snakeyaml/1.30/snakeyaml-1.30.pom
     Required by:
         project : > org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT:20220517.093124-43

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

#

I would like to do my plugins test in 1.18.1

final star
daring lark
#
        ArmorStand hologram = (ArmorStand) chest.getBlock().getWorld().spawnEntity(chest.getLocation().add(0.5,0,0.5), EntityType.ARMOR_STAND);
        hologram.setMarker(true);
        hologram.setGravity(false);
        hologram.setInvulnerable(true);
        hologram.setCustomName("test");
        hologram.setCustomNameVisible(true);
    }``` why name of hologram is invisible?
quaint mantle
#

You're setting all of those things after you already spawned the armor stand

daring lark
#

does it matter?

quaint mantle
#

yes iirc

daring lark
#

but other things works, like setMarker etc.

quaint mantle
#

someone help me for maven ?

kind hatch
#

Does anyone know why my result set is null? I'm working with SQLite and I've also tried changing what I'm selecting. * to self_hugs. The data is in the database, so why am I getting null?

tardy delta
#

not using a try with resources aaaaa

kind hatch
#

The sqlite.executeQuery() is.

eternal night
#

the result set is closed

#

if you close its statement

#

iirc

kind hatch
#

But I pass it through.

tardy delta
#

yep

eternal night
#

okay ?

#

you still close the statement before you return it

tardy delta
#

he connection and the ps are closed after the try block

eternal night
#

yea

tardy delta
#

ah got ninjad

eternal night
#

🥷

kind hatch
#

So I would have to make the same query again wouldn't I?
Or just move the check to that try block?

tardy delta
#

i guess you want to handle the try with resources in the method that handles the resultset

#

so put it in one place

eternal night
#

I mean, either you pass a consumer

#

or a Function<ResultSet, OutputType>

tardy delta
#

or use some fancy database library brrr

eternal night
#

or that

#

additionally, prepared statements exist for a reason

#

passing in the entire query as a string screams for SQL injection

kind hatch
#

Well, I'm just testing things out right now. I'm sure once I get things in a working state, I'll try and improve things. I'm also using PreparedStatements btw, it's just that I'm currently passing in a concatenated string. Which will probably change to that mysql syntax with the question marks here shortly.

eternal night
#

a good idea to do that asap 👍

kind hatch
#

Yea, that's what I'm probably going to do for as a starting point.

eternal night
#

Yea usually the easier approach

tardy delta
#

and now i remade my whole storage design for different databases :/

kind hatch
#

Oh right, this is SQLite. So I'm used to mysql using a while loop to iterate over the resultset. This seems to be an issue with SQLite. Will there be any issues if I change it to an if statement? Wouldn't that cause issues if there are multiple results?

eternal night
#

the result set works the same

#

you should still be able to use a while look just fine

quaint mantle
#

It would, yes. You use a while

kind hatch
#

Well apparently I'm having issues with that. 😛
java.sql.SQLException: ResultSet already requested

sterile token
#

Amazing shity, i have checked on goole and its okay

tardy delta
#

UUID.fromString

sterile token
#

If im telling to cast as uuid, why its treating it as string?

tardy delta
#

are you still busy with that claims plugin?

sterile token
#

Yeah 1 month

#

could be caused because the datbase contains a document?

#

I will try deleting the test document i created, maybe that the issue

quaint mantle
#

im working for authme maven 2 hours

sterile token
kindred valley
#

what the hell is this

quaint mantle
#

and i try to add authme with maven

chrome beacon
quaint mantle
#

but i get this errors

kindred valley
#

yeah but i cant see any other informations

chrome beacon
#

You have something hiding the rest

sterile token
tardy delta
#

did you reload it?

quaint mantle
kindred valley
#

wdym

quaint mantle
#

yes

#

is this ?

sterile token
#

I really dont know just check the authme repo on their github

quaint mantle
sterile token
quaint mantle
#

yes this is true

sterile token
#

😂

sterile token
dense falcon
#

How can I enable UTF-8 for my plugin?

quaint mantle
sterile token
tardy delta
#

do people even use google

sterile token
# quaint mantle yes

Try this things:

  1. Go to .m2/fr/xephi/authme and check if its inside the pom.xml or if its empty the directory

  2. Delete the .m2/fr/xephi directory

  3. Close your project, open it again and reload the maven

  4. If issue still there, try to invalidating cache if you are on Intellij

sterile token
#

That what i usually do when something its not working

daring lark
#

is there any way to get front face of chest?

kind hatch
quaint mantle
#

is there an way to delete an chunk or prevent generating new chunks entirely?

daring lark
#

how could i get fornt face of chest?

dense falcon
#

Uh why? I got this error: error: illegal character: '\u00bb' package fr.program.testplugin.commands;

package fr.program.testplugin.commands;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class AnnonceCMD implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        if (command.getName().equalsIgnoreCase("annonce")  || command.getName().equalsIgnoreCase("announce")) {
            if (sender instanceof Player) {
                Player plr = (Player) sender;

                if (args.length > 0) {
                    Bukkit.broadcastMessage("§f[§4ANNONCE§f] §7" + args);
                } else {
                    plr.sendMessage("§f[§ERREUR§f] §7 Vous devez donner des arguments !");
                }
            }
        }

        return false;
    }
}
quaint mantle
#

i want to change some plugin's commands with maven someone know ?

#

actually i wanna execute command with

kind hatch
kind hatch
#

Ensure that the section down in the bottom right says this when you are in a file. Your project settings look fine. Are you using maven for this project?

dense falcon
#

Gradle project.

kind hatch
#

Welp. Check your build files then. In maven we have to declare the following properties.

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>8</maven.compiler.source>
    <maven.compiler.target>8</maven.compiler.target>
</properties>

Something similar should exist for gradle.

dense falcon
#

No nvm.

kind hatch
#

Whatever file is equivalent to the pom for maven. I think it's gradlew.

dense falcon
#

I am using gradle and nomaven.

#

Ah.

kind hatch
#

Looks like this might be it.

compileJava {
    options.encoding = 'UTF-8'
}
gleaming olive
daring lark
#

how much hp does armorstand has?

slim kernel
sacred mountain
#

I'm writing a large-ish killeffects plugin, and all the effect classes are inside of my package net.vlands.effects. Is there a way to go through every class and add it to my effectmanager map instead of writing like 120 lines for all the effects

#

using reflection maybe im not sure

#
public static List<Class<?>> getClassesInPackage(String packageName) {
        String path = packageName.replaceAll("\\.", File.separator);
        List<Class<?>> classes = new ArrayList<>();
        String[] classPathEntries = System.getProperty("java.class.path").split(System.getProperty("path.separator"));

        String name;
        for (String classpathEntry : classPathEntries) {
            if (classpathEntry.endsWith(".jar")) {
                File jar = new File(classpathEntry);
                try {
                    JarInputStream is = new JarInputStream(new FileInputStream(jar));
                    JarEntry entry;
                    while((entry = is.getNextJarEntry()) != null) {
                        name = entry.getName();
                        if (name.endsWith(".class")) {
                            if (name.contains(path) && name.endsWith(".class")) {
                                String classPath = name.substring(0, entry.getName().length() - 6);
                                classPath = classPath.replaceAll("[\\|/]", ".");
                                classes.add(Class.forName(classPath));
                            }
                        }
                    }
                } catch (Exception ex) {
                    // Silence is gold
                }
            } else {
                try {
                    File base = new File(classpathEntry + File.separatorChar + path);
                    for (File file : Objects.requireNonNull(base.listFiles())) {
                        name = file.getName();
                        if (name.endsWith(".class")) {
                            name = name.substring(0, name.length() - 6);
                            classes.add(Class.forName(packageName + "." + name));
                        }
                    }
                } catch (Exception ex) {
                    // Silence is gold
                }
            }
        }

        return classes;
    }```
#

from stack overflow lol

rustic pewter
#

Hi I was wondering if someone knows why this doesnt work. Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "team add Ruubbie.Robbers"); I have it in the onEnable method and when I type it in the console myself it does work. I have already tried and the . isnt the problem.

sacred mountain
#

dont use dispatchcommand use the actual team thing

#

in the api

rustic pewter
#

Oh didnt know that was a thing. Thanks1

#

!

sacred mountain
sacred mountain
#
public void registerAllEffects() {
        List<Class<?>> discoveredClasses = ClassEnumerator.getPackageClasses(Angry.class.getPackage());
        discoveredClasses.forEach(clazz -> {
            try {
                clazz.newInstance();
            } catch (InstantiationException | IllegalAccessException e) {
                e.printStackTrace();
            }
        });
    }```
#

lmao idk

dense falcon
final star
#

Does anyone know how I make the schematic paste to the direction the player is looking?

sacred mountain
#

maybe something with the player's direction ? idk if they have methods for that

uneven fiber
#

Anyone know how to check what item the playyer dropped?

#

I want something to happen when a player drops tnt

eternal night
#

why is that in a bukkit runnable

wet breach
eternal night
#

besides that your IDE is already screaming at you

wet breach
#

or at the player?

eternal night
#

you are comparing an item stack with a material

uneven fiber
#

ok i want it to explode like 10 seconds after they drop the tnt

eternal night
#

those will never add up

final star
wet breach
#

if you want the schematic to face away, you need to rotate in memory 180 degrees

uneven fiber
#

any idea on how to compare it?

eternal night
#

you can grab an item stacks type using .getType()

uneven fiber
eternal night
sacred mountain
#

how do i cast an unknown subclass to it's superclass?

I have a List<Class<?>> and i can iterate through them with

forEach(clazz -> {}

uneven fiber
#

accidently deleted something

sacred mountain
#
public void registerAllEffects() {
        List<Class<?>> discoveredClasses = ClassEnumerator.getPackageClasses(Angry.class.getPackage());
        discoveredClasses.forEach(clazz -> {
            try {
                clazz.newInstance();
                if (clazz.getSuperclass().equals(Effect.class)) {
                    plugin.getEffectsManager().addEffect(((Effect) clazz));
                }
            } catch (InstantiationException | IllegalAccessException e) {
                e.printStackTrace();
            }
        });
    }```
I dont even know
#

im tryna init every class in a package and add those classes to my effectmanager map

#

i could just do 120 lines of new Class() but if this is possible i wanna see if i can get it to work

eternal night
#

you cannot cast a class to its super class

#

they are different instances

sacred mountain
#

oh right ok 😬

eternal night
#

you can cast the instance of the subclass as a super class

#

but the class themselves are not related on the type system level (well they are the same type, java.lang.Class)

sacred mountain
eternal night
#

I don't think I understand your point

sacred mountain
#

i should cast thei nstance and not the class you mean

eternal night
#

yes

#

the class is just an instance of java.lang.Class

#

there is nothing to cast there

#

your code is just not good

#

you are creating a new instance

#

and do nothing with it

#

you want to cast that instance

#

tho that is also wrong, you should check the type of the class before hand

#
Entity.class.isAssignableFrom(Player.class)
``` would return true
rustic pewter
#

I am still a beginner and cant really figure the team api out. Does someone have a example?

dense falcon
#
package fr.program.testplugin.commands;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class AnnonceCMD implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        if (command.getName().equalsIgnoreCase("annonce")  || command.getName().equalsIgnoreCase("announce")) {
            if (sender instanceof Player) {
                Player plr = (Player) sender;

                if (args.length > 0) {
                    Bukkit.broadcastMessage("§f[§4ANNONCE§f] §7" + args);
                } else {
                    plr.sendMessage("§f[§ERREUR§f] §7 Vous devez donner des arguments !");
                }
            }
        }

        return false;
    }
}
quaint mantle
#

guys someone help me ? i download authme's source code from github and open with intellij but i can't build this project no one console messages and no one file for target someone help ?

buoyant creek
#

hi can someone help me please ? I want to spawn an entity in a random location around another location

crimson terrace
#

do you wanna randomize the y aswell? or just x and z

buoyant creek
#

x and z for now i guess

crimson terrace
#

you have your location to spawn around?

buoyant creek
#

this is my actual line

#

loc.getWorld().spawnEntity(loc, EntityType.ZOMBIE);

crimson terrace
#

at that point you just have to get 2 random numbers, I believe that ThreadLocalRandom.current().nextInt(int lowerBound, int upperBound) should be good enough

#

what radius should it be in?

buoyant creek
#

maybe like +5 to -5

crimson terrace
#

so you have your bounds for the random number. now do it for both x and z and you got yourself a pseudorandom location around the original location

#

alternatively you could randomize a vector and its length, but thats a bit more complicated than just randomizing the location

crimson terrace
buoyant creek
#

I try some .add() with fixed value but it didn't work

#

i'm a beginner and i'm kinda lost x)

crimson terrace
#

you mean location.add()?

buoyant creek
#

yes

crimson terrace
#

hold on

#

thats the one you want. randomize the first and third one, put the second at 0

crimson terrace
buoyant creek
#

java

crimson terrace
#

ah ok, could you show me what you tried for the add() method?

buoyant creek
#

can i take you in mp ?

crimson terrace
#

mp?

buoyant creek
#

private message

crimson terrace
#

pm

#

yeah sure

buoyant creek
#

mb

midnight shore
quaint mantle
#

guys pls help i download a project from github and open with intellij i build project but no one file in target why ?

rustic pewter
#

I have this now, but it does not do anything. 😦 ```public final class Teams extends JavaPlugin implements Listener {

Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
Team Red = board.registerNewTeam("Red");

@Override
public void onEnable() {

    getServer().getPluginManager().registerEvents(this, this);
    Red.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.NEVER);
}

    @EventHandler
    public void onPlayerJoin (PlayerJoinEvent e){
    
        Red.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.NEVER);
        Red.addEntry(e.getPlayer().getName());


    }
}```
ivory flume
#

how could I attach special data when a player switches over to another server?

#

my use case is that i need to send resource pack status from one server to the other so that I know not to redownload it on switch

#

how can I accomplish this in bungeecord’s message system or some other bungeecord feature?

sacred mountain
# eternal night ```java Entity.class.isAssignableFrom(Player.class) ``` would return true
public void registerAllEffects() {
        List<Class<?>> discoveredClasses = ClassEnumerator.getPackageClasses(Angry.class.getPackage());
        discoveredClasses.forEach(clazz -> {
            if (Effect.class.isAssignableFrom(clazz)) {
                try {
                    plugin.getEffectsManager().addEffect(((Effect) clazz.newInstance()));
                } catch (InstantiationException | IllegalAccessException e) {
                    e.printStackTrace();
                }
            }
        });
    }```
devout solstice
#

Mine reset lite dose not work for me can someone help

kindred valley
#

hello guys how could we decrease the amounts of ores

fossil lily
#

Can I get the entity that the projectile hit with EntityProjectileHitEvent?

crimson terrace
#

there is no EntityProjectileHitEvent

#

do you mean the ProjectileHitEvent?

quaint mantle
#

is there an way to add or remove an permission to/from an player? I know there are permission plugins. but i want to do it with an own plugin.

#

is there an bukkit method for it?

crimson terrace
#

if so, you can use the getEntity() and getShooter() methods in order to get the source of the projectile

sterile token
#

What is better an armor-stand or player entity for doing npcs?

latent pelican
#

Hi I am using a for loop and want it to sleep for 500ms after every repeat: How do you do that in spigot?

eternal oxide
#

?scheduling

undone axleBOT
eternal oxide
#

you never sleep in the main thread

latent pelican
#

How can I manage to do that??

#

Its urgent

eternal oxide
#

read the link I gave you

sterile token
#

If need it fast pay someone to do it

#

If not be patient...

eternal oxide
#

You can not sleep in a for loop on the main thread. Use the scheduler to move off the main Thread (Async), or use a Sync repeating task (BukkitRunnable) to increment a value instead of a for loop.

sterile token
#

Also why do you need to sleep in a loop?

#

Just for being curious

eternal oxide
#

Usually people want delays between sending messages and think sleep is the way

latent pelican
#

Ok I have this code:
// With BukkitRunnable new BukkitRunnable() { @Override public void run() { Bukkit.broadcastMessage("Mooooo!"); } }.runTaskTimer(plugin, 20L * 10L /*<-- the initial delay */, 20L * 5L /*<-- the interval */);

sterile token
latent pelican
#

But whats with pluginn??

#

The name of my plugin?

eternal oxide
#

The "plugin" is the instance of your Main class

sterile token
eternal oxide
#

if you are IN your main class you use "this"

sterile token
#

Maybe iits worst but idk i always learn new things

eternal oxide
#

If you are not in your main class you use dependency injection to pass a reference to your main class.

#

?di

undone axleBOT
devout solstice
#

Mine reset lite dose not work for me can someone help

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!

latent pelican
eternal oxide
eternal oxide
sterile token
#

I dont want to sound rude but have learnt java before doing plugins?

#

If you didnt most of the time its not recommend to start first doing plugins without learning java atleast the basics things

#

Sorry if i sound rude but that the truth

latent pelican
#

weell i have, but i havent heard about dependency injection

#

And i still dont get how to use that to fill the plugin section

eternal oxide
#

everything in Java is Objects. There is only ever one copy (instance) of your main class. You need to pass that reference around to any other objects which need to access it

#

read teh wiki about it. its very easy once you read it

sacred mountain
#

oops

lost matrix
quiet ice
#

Is there any efficent (i.e. preferably without sorting based on random values) way of iterating over a list in a random fashion?

sacred mountain
#

can someone tell me if this will work? my aim is to find all the classes in a package and initialise them.

the method: https://pastes.dev/VtDoR3lKAK
the ClassEnumerator (taken from github and not mine): https://github.com/ddopson/java-class-enumerator/blob/master/src/main/java/pro/ddopson/ClassEnumerator.java

#

syntaxed in javascript woops

lost matrix
lost matrix
#
Reflections reflections = new Reflections("com.my.project");

Set<Class<?>> subTypes = reflections.get(SubTypes.of(SomeType.class).asClass());

Set<Class<?>> annotated = reflections.get(SubTypes.of(TypesAnnotated.with(SomeAnnotation.class)).asClass());
latent pelican
#

Is this the code (example from wiki)

#

`
public class PlayerStatsPlugin extends JavaPlugin {
@Override
public void onEnable() {
this.getServer().getPluginManager().registerEvents(new PlayerListener(this),this);
}
}

public class PlayerListener implements Listener {
private final PlayerStatsPlugin plugin;

public PlayerListener(PlayerStatsPlugin plugin) {
this.plugin = plugin;
}

@EventHandler
public void onJoin(PlayerJoinEvent event) {
event.getPlayer().sendMessage("This server uses %s :)".formatted(plugin.getName()));
}
}
`

eternal oxide
#

Yes

#

its using DI to pass a reference of the Plugin to the PlayerListener

quiet ice
#

Basically I want to do something like

while (true) {
    Predicate predicate = predicates.get(random.nextInt(predicates.size()));
    if (predicate.test(testObject)) {
        // Do something with the predicate
    }
}

but have a stop-condition at some point so just in case that none of the predicates match I will be able to return a default value or something
But I guess I'll use Collections#shuffle on second thought given that I do not actually need to preserve the order of the list thankfully

eternal oxide
#

The PlayerListener then uses that Plugin reference to access the Plugins name

sterile token
#

For sending short code use this

echo basalt
#
Collection<Predicate<?>> predicates = ...;
Collections.shuffle(preficates);

for(Predicate<?> predicate : predicates)
  if(predicate.test(someObject)) {
    ...
    return ...;
  }

return defaultValue;
#

I might be tripping with the generic type part

quiet ice
#

That is what I will do

#

Though it does not make much sense to shuffle the entire collection if the first random value matches, aah.
I think I'll just look at Collections#shuffle and see if I can cheat a bit there

echo basalt
#

you can call Collections#removeIf

#

before shuffling

#

unless that predicate does more than just checking

#

predicates.removeIf(predicate -> !predicate.test(someObject));

quiet ice
sacred mountain
#

what saerver

latent pelican
#

We are currently stuck in our project and have a private server

quiet ice
quiet ice
#

Oh I see

latent pelican
quiet ice
#

Eh, I'm over-complicating things anyways

sacred mountain
#

oh

woeful moon
#

Hey, how can I send a message with translateAlternateColorcodes that is also bold?

    Random rand = new Random();
    List<String> colorCodes = Arrays.asList("&1", "&2", "&6", "&9", "&a", "&c", "&d", "&e");

    @EventHandler
    public void onChat(AsyncPlayerChatEvent e) {
        if(e.getMessage().equalsIgnoreCase("GG")) {
            if(BLGGWave.getPlugin().isActiveWave()) {
                // cancel the event
                e.setCancelled(true);
                // send message with random colors
                e.getPlayer().sendMessage((ChatColor.translateAlternateColorCodes('&', randomColorCode() + "G" + randomColorCode() + "G")));
            }
        }
    }

    private String randomColorCode() {
        return colorCodes.get(rand.nextInt(colorCodes.size()));
    }
latent pelican
sacred mountain
#

mk

#

dm me

woeful moon
#

what's the problem?

sacred mountain
#

oh random color code ok

#

misread lol

#

i thought u were using an arraylist for color coding idk

lost matrix
#

@quiet ice
Just thought about something. Try this:

  public static <T> void iterateRandomly(List<T> list, Consumer<T> consumer) {
    ThreadLocalRandom.current().ints(list.size(), 0, list.size()).mapToObj(list::get).forEach(consumer);
  }
#

Hm... does this produce duplicates? I think it does :/

quiet ice
#

Probably does

woeful moon
midnight shore
#

how can i save an itemstack in a mongodb collection?

quiet ice
lost matrix
midnight shore
quiet ice
#

For serialisation you'd need to use BukkitObjectOutputStream or if you use paper use it's serialisation methods which are a bit saner given that they come from DFU

lost matrix
# midnight shore yes, what primitive should i use?

Dont worry.
Just do something like:

private static final Gson GSON = ...;

public Document toDocument(ItemStack item) {
  Map<String, Object> data = item.serialize();
  String json = GSON.toJson(data);
  return Document.parse(json);
}

This is really rudimentary but you get the general idea.
I personally like implementing a Gson backed Codec for MongoDB so i can literally
throw anything in it and treat MongoDB as a Map<K, V>

quiet ice
#

oh yeah that might be a bit better

midnight shore
#

thank you!

lost matrix
# midnight shore thank you!

*PS

private static final Gson GSON = ...;

public ItemStack fromDocument(Document document) {
  String json = document.toJson();
  Map<String, Object> data = GSON.fromJson(json, new TypeToken<Map<String, Object>>{}.getType());
  return ItemStack.deserialize(data);
}
midnight shore
quiet ice
#

probably should take in the map

lost matrix
#

Nope.

midnight shore
lost matrix
#

Bson can easily be translated to a json String

quiet ice
#

huh, then how can GSON know what to serialise?

lost matrix
#

Oh you mean GSON.toJson(). Yes that needs an argument. I thought you were talking about document.toJson().

midnight shore
#

😅

lost matrix
#

You can pass the ItemStack if you registered a JsonSerializer<ItemStack> in your Gson instance. Then the method would look like this:

public <T> Document toDocument(T element) {
  return Document.parse(GSON.toJson(element));
}
#

Which is quite handy because Gson can (de)serialize a ton of things on default.
Just not ItemStacks, Locations and other game bound objects.

midnight shore
lost matrix
#

You can register custom TypeAdapters in Gson.

#

Im thinking about writing a resource thread about the Gson, MongoDB stack...

midnight shore
#

might be useful

twilit roost
#

BungeeCord
How can I check if Server's contain My plugin?

quiet ice
#

?services

undone axleBOT
quiet ice
lost matrix
twilit roost
#

im currently sending msg but it takes some time till it reaches back

woeful moon
#

How can I call Player#chat() from AsyncPlayerChatEvent? I'm getting an AsyncPlayerChatEvent may only be triggered synchronously. error.

quiet ice
#

Still the wrong place to ask: #help-server is the correct one then

sterile token
sterile token
#

Yeah

#

Im not lying

midnight shore
#

and that would work?

lost matrix
quiet ice
sterile token
#

Im not trolling lmao, in my case is working

midnight shore
woeful moon
quiet ice
#

?stash this error message makes 0 sense, let's see why that may be

undone axleBOT
sterile token
#

@lost matrix explain why please.... You are always doing people feel small

lost matrix
quiet ice
#

You cannot make player send messages async

lost matrix
quiet ice
#

Ah, the good ol internet

#

As senselessly time-consuming as ever

lost matrix
#

I want to check out if it can actually handle ItemStacks

ivory sleet
#

also imagine if that ItemStack instance is a direct CraftItemStack instance

lost matrix
#

I can see a ton of problems with skulls. As soon as you hit like 10 recursion levels into the PlayerProfile and the codec starts choking on some internals like a WeakReference<World> or something XD

mortal hare
#

why doesn't spigot adopt adventure api by default

#

they're way better than bungeecord's basecomponents

quiet ice
#

Spigot is a bit too old at this point

ivory sleet
#

"unnecessary change" afaik

lost matrix
#

But be prepared for a bazillion upstream problems

ivory sleet
#

but yeah also, all things considered, adventure adds a ton of complexity also, somehow a oneliner devolved into a 25 liner

quiet ice
#

Myeh, a collision with paper's adventure integration would be fun

lost matrix
ivory sleet
#

lol

mortal hare
#

But adventure uses proper chat formatting which mojang has introduced back in 1.8 days

ivory sleet
#

not saying that the complexity is bad necessarily, but it definitely has cons

#

yup dovidas

quiet ice
#

I personally use things such as MineDown if I just want formatting

#

Of course you guys probably want to use MiniMessage instead

#

They all support spigot in one way or another

midnight shore
#

Hi, i've added a new file to my github repository, made a release and got it on jitpack but i can't seem to find this new class when i use the dependency

lost matrix
quiet ice
#

that is why you selfhost repositories, much easier to understand where the issue is. I believe however that you might need to add a bit more info there to be able to narrow down your issue

midnight shore
#

first: release | second: the class i've added | third: the pom i use | fourth: the class doesn't show up

quiet ice
#

Did you refresh your IDE?

midnight shore
#

yeah

quiet ice
#

You may need to invalidate caches and all the fun

lost matrix
quiet ice
#

Meanwhile, me: FTP all the way

lost matrix
midnight shore
lost matrix
#

Then -> invalidate caches and restart in Intellij

midnight shore
#

still nothing

quiet ice
#

I.e. for me installing stuff to a maven repo is just as simple as adding


    <distributionManagement>
        <repository>
            <id>geolykt-maven-ftp</id>
            <!-- This is the developer connection. The actual repository 
                is located under https://geolykt.de/maven/ -->
            <url>ftp://geolykt.de/geolykt.de/public_html/maven/</url>
        </repository>
    </distributionManagement>

    <build>
        <extensions>
            <!-- Enabling the use of FTP for deployment -->
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-ftp</artifactId>
                <version>3.5.1</version>
            </extension>
        </extensions>

to the pom as well as doing the one-time initialisation for the ftp connection (where you set up the usernames and passwords to use) and then you just can do mvn deploy. Gradle on the other hand is a bit trickier

#

Sure, you won't find any fancy index files, but noone will use your repo seriously anyways

polar ermine
#

Does EssentialsX come with configurable permissions or do i have to get another plugin for it?

#

I need to make groups to give people certain perms

ivory sleet
#

LuckPerms is probably what you want then

polar ermine
ivory sleet
#

well every essentials command has a permission

#

so just add that permission to the luckperms group

midnight shore
polar ermine
polar ermine
#

this looks much easier than the way i had to do it 8 years ago

lost matrix
# midnight shore

I would create my gson instance by using the builder:

Gson GSON = new GsonBuilder().disableHtmlEscaping().create();

But other than that the serializer looks fine

midnight shore
quiet ice
#

ah

slim kernel
#

Should I rather commit and push my code to github alot like after every few things I made or like once per week?

midnight shore
#

what does this part do?

quiet ice
lost matrix
lost matrix
midnight shore
lost matrix
#

Wait let me check

tardy delta
#

(){}.getType()?

midnight shore
lost matrix
# midnight shore true

Map<String, Object> data = gson.fromJson(json, new TypeToken<Map<String, Object>>(){}.getType());

tardy delta
#

why the {} tho?

lost matrix
#

TypeToken is an interface

#

Anonymous class creation

quiet ice
#

Ah right, that was anonymous

tardy delta
lost matrix
#

*abstract class

#

either way you cant instanciate it

tardy delta
#

ah ye youre right about the instantiation

#

lol

lost matrix
midnight shore
#

it WORKS! TY!!!

sterile token
#

Im burning my brains trying to think what code goes first on the event BlockPlaceEvent, because i need to:

  1. Check if a claim already exists on that location and run custom event
  2. Create a new claim, if a claim doesnt exists and he is placing a specific block
#

So im really dumb

#

I dont know why its so diff for me

tardy delta
#

its the gson typetoken class no? lol now it shows up

midnight shore
#

so with this method i can actually serialize everything that implements serializable right?

lost matrix
lost matrix
midnight shore
#

or anything that is a map<String, Object>

sterile token
lost matrix
# midnight shore or anything that is a map<String, Object>

Gson can also serialize your data classes like

public class PlayerData {
  
  private final Set<UUID> friends = new HashSet<>();
  private double currency = 250.0;
  private long playTimeMillis = Duration.ofHours(30).toMillis();
  // and so on
  
}

With ease. No need to implement ConfigurationSerializable.

midnight shore
#

this is fantastic

tardy delta
#

is that supposed to be friends? >-<

lost matrix
#

Yeah just typed it really quick XD

midnight shore
#

it was cool firends! leave it like that

lost matrix
#

Can only think of reflections.

quiet ice
#

?jd-s

undone axleBOT
tardy delta
#

it is an enum isnt it? just loop over the values() then

quiet ice
#

Yeah, reflections will probably be the only way

tardy delta
#

lmao ninjad again

quiet ice
#

It isn't an enum

#

ChatColor is an enum

midnight shore
#

uh

quiet ice
#

Color is a normal class

midnight shore
#

sorry my bad

#

i confused them

tardy delta
#

oh i see, lets do it manually then

quiet ice
#

Technically there are near-infinite colors

midnight shore
#

because you can get it from rgb

quiet ice
#

There probably are a few other similar methods

midnight shore
#

in theory they should be 16.581.375

#

wait google says another thing

lost matrix
# midnight shore in theory they should be 16.581.375

Just to show how easy it would be:

public static Document toDocument(PlayerData data) {
  return Document.parse(GSON.toJson(data));
}

public static PlayerData fromDocument(Document document) {
  return GSON.fromJson(document.toJson(), PlayerData.class);
}

And the data class has to contain only objects that are serializable by Gson.
You can expand that list by registering TypeAdapters. This way your data can also
hold ItemStacks, Inventories and Locations...

quiet ice
midnight shore
#

i've done in the calculator 255^3

quiet ice
#

Why ^3

midnight shore
#

but google says more

midnight shore
lost matrix
#

0 included so 256^3

quiet ice
#

Yeah

#

Or just go with the more sane way and use 2^24

midnight shore
#

true, now its correct

lost matrix
#

0xFFFFFF
Or Red Green Blue:
[FF, FF, FF]
(0 -> 0xFF) = (0 -> 255)
So 3 slots with 256 possible entries resulting in 256^3 total possibilities

quiet ice
#

Still, I prefer my power of twos

#

3 is just beyond ugly

midnight shore
#

i prefer working with low exponents

lost matrix
#

I prefer working with powers of a level exceeding at least 9000

polar ermine
#

I just set up Luckperms but the prefixes aren't showing up, the only other plugin that I have is essentialsx. How do I fix this

midnight shore
lost matrix
#

If not then ask the plugin dev

quiet ice
#

I am doing a bit too much bit manipulation apparently

lost matrix
quiet ice
#

but idk

midnight shore
lost matrix
#

Yes

#

Right click your top package and select "replace in files..."

polar ermine
quiet ice
#

At least that is the idea

polar ermine
#

ok i'll try that

brittle lily
#

Hey Guys. I set string for Player msg and When event finished I wanna reset this string. How Can I Do That

#

When I try to do a second operation it gets the previous string

#

I Have String for "Boss Name". Players can create a boss whatever name he want. But When Players Try to create boss for second time. It setting boss name to previous boss name

#

How Can I reset previous Boss Name String

vocal cloud
#

Send code lol otherwise we can't help

#

?paste

undone axleBOT
brittle lily
brittle lily
daring lark
#

how could i check if player clikc at blokc?

eternal oxide
#

PlayerInteractEvent

eternal oxide
#

BoundingBox.overlaps

#

or more precise BoundingBox.of(start, end).overlaps(...

eternal night
#

wasn't getByCombinedId the legacy shit for block data bytes

river oracle
#

Is there an API or something for making skulls I've never touched making player skulls before so I'm clueless

woeful moon
granite beacon
granite beacon
river oracle
# vocal cloud SkullMeta

yea I'm doing research on how to make it not dependent on a player I found some resources on the website so i'm chillin

woeful moon
#

I'm making a plugin that, whenever someone says "GG" in chat, replaces it with randomly color coded "GG"

vocal cloud
#

There you go

woeful moon
river oracle
#

PlayerAsyncChatEvent should work

#

cancel it change the colors then send

woeful moon
#

The event works, but Player#chat doesn't

woeful moon
#

My problem atm is that I can't use Player#chat() in the async event

#

and I'm unsure how to fix it

#

Oh, I did not know that method was a thing. Going to try it

granite beacon
#

That won't fix your issue though

#

That'll just replace the chat message that is sent with the event?

woeful moon
#

yes, the issue with sending bold messages was resolved already; sorry for the confusion

granite beacon
#

Nah they want it to work with the Player#chat() method

eternal oxide
#

You use teh Scheduler to use teh Player#chat from teh Async event

woeful moon
#

not necessarily, I just want to make peoples' chat fancy colors

granite beacon
#

Huh

eternal oxide
#

then you should not be using Player#chat

woeful moon
#

yeah, I'm using setMessage() now

granite beacon
#

That doesn't send a chat message though

eternal oxide
#

setMessage and setFormat

#

you already have all teh chat in the event, you just format it

woeful moon
#

what's the difference between message and format?

kind hatch
#

I'm running into another weird issue. For some reason, the size of my result set is 0. The data is there, the string I'm checking for is the same as the column name, so wtf?

woeful moon
#

Sets the format to use to display this chat message.

Sets the message that the player will send

What's the difference?

eternal oxide
#

the message is what the player typed

#

the format is... well, print it and see

lethal python
#

i'm summoning an invisible armorstand, is there a way i can make the armorstand not be visible for a really short period before turning invisible

eternal oxide
lethal python
#

i don't know how to do that

#

consumer⸮

lethal python
#

wait what do you mean in your original reply

#

make it visible later?

#

i just want to spawn armorstand invisible so it's never visible ever

eternal oxide
#

In the consumer you get to run code on the Entity before it's actually created. so you can set it invisible etc

lethal python
#

coolio

eternal oxide
#

else it will spawn visible for a fraction of a second

#

While still in teh consumer you create a BukkitRunnable to set it visible at a later time

lethal python
#

i don't want it visible ever

eternal oxide
#

then no need for teh runnable

lethal python
#

poog

eternal oxide
#

just set it invisible in the consumer and it will forever be invisible

lethal python
#

i am loooking at docs

#

why is it called clazz

eternal oxide
#

just a naming convention.

lethal python
#

with z

eternal oxide
#

yes, you can;t use teh name class

lethal python
#

oh right

#

i understand

eternal oxide
#

so we use clazz

lethal python
#

i thoughti it was a typo

eternal oxide
#

clazz would be ArmorStand.class

lethal python
#

this is like a dumb question but how do i use that syntax

#

i've used generics before in uni stuff

#

that bit

ivory sleet
#

the consumer part?

lethal python
#

no the generic bit

#

like what am i doing .spawn on

eternal oxide
#

you don;t

#

thats just the definition

lethal python
#

what

eternal oxide
#

spawn( location, ArmorStand.class, false, stand -> { stand.setVisible(false); } )

lethal python
#

i tried that too

#

spawn() is just red underlined

#

like there's no method spawn

#

do i have to make my class implement regionaccesor

eternal oxide
#

no

#

Drill down from your Location object

lethal python
#

oh is it just world.spawn

#

like i'm already doing world.spawnentity

eternal oxide
#

yes, its just a different method

lethal python
#

hooray

turbid tiger
#

can someone tell me how i can import import org.bukkit.craftbukkit.inventory.CraftItemStack;

#

what is the valid import for craftitemstack

#

I need it for NMS

fallow violet
#

I have a problem. I wrote a code so that i can send and receive plugin messages. The sending process works great but he cannot receive data somehow. Can someone tell me why? Pastebin: https://pastebin.com/k7PNq9jG

eternal oxide
#

NMS imports all changed for 1.17+

#

Servers listening to PMC need to have a player oin them to receive messages

fallow violet
#

I am online

eternal oxide
#

where are you sending the message?

fallow violet
#

in a spigot server

#

where i am online in

#

Can one Plugin send and receive the same time?

eternal oxide
#

where is the message coming from?

fallow violet
#

From the same plugin

#

but i know my problem maybe

#

You cannot send a message from your own plugin on the same server to your own plugin back, right?

#

._.

humble tulip
#

U can't use custom channels from spigot to spigot

#

U have to use the Forward

#

On bungeecord channel

fallow violet
#

What do you mean?

tender shard
#

I also don't understand what they tried to say lol

sterile token
#

That why i prefer redis PubSub over PMC

tender shard
sterile token
#

okay?

#

Let say i understand that

tender shard
#

ugh

#

you are supposed to reply "hello mfnalex, I'm verano"

#

or sth like that

fallow violet
#

does someone have a good tutorial for redis PubSub?

#

if its good

tender shard
tender shard
sterile token
#

Redis is a memory database, which contains a feature called PubSub its a system which allow to send and receive mesages between many devices

#

One of the most amazing of redis pubsub, is that you dont depend on a player for sending or receiving data

fallow violet
#

thats a point

hybrid spoke
#

and one of the most annoying is, that you have to install it

fallow violet
#

is there a third option?

#

like not PMC and not redis?

fallow violet
#

like something else?

tender shard
#

apt install redis and that's it

fallow violet
#

I have redis anyways because of pterodactyl

hybrid spoke
sterile token
tender shard
sterile token
tender shard
#

Alexito?!

hybrid spoke
hybrid spoke
tender shard
#

it isn't even password protected by default IIRC

sterile token
#

Amazing as owner it doesnt allow me to place blocs fucking amazing

#

Atleast it work

#

more than 3 months with this

#

hahahaha

pulsar vessel
#
  public void onDeath(PlayerDeathEvent event) {
    final var deceased = event.getEntity();
    Optional.ofNullable(deceased.getKiller()).ifPresent(killer -> {
      if(deceased.equals(killer)) {
        return;
      }
      killer.sendMessage("§b> §fYou killed §b%s §f and he dropped a §bdisaster shard§f.".formatted(killer.getDisplayName()));
      killer.playSound(deceased.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 1.2F, 1F);
      deceased.getWorld().dropItemNaturally(deceased.getLocation(), CustomItemManager.createDisasterShard());
    });
  }```

Anyone help me with this 
https://github.com/booksaw/BetterTeams/wiki/API

I want to make it so that the custom item won't drop if you were killed by your party but not your allys
GitHub

Create teams to fight to be the best (Minecraft Plugin) - API · booksaw/BetterTeams Wiki

lethal python
#

can i make a small region of the world indestructible

#

like a 1x2x1 part

#

i have an entity with some blocks inside it to give the entity collision

#

but you can break the blocks then walk through it

#

i'd like to make the blocks indestructible

#

is that possible ·_ .

#

if there's another way of achieving collision i would do that : ) as long as it's easy

subtle folio
#

How would I check what inventory a player is in?

ivory flume
#

for what? gui?

subtle folio
#

Yes

kind hatch
#

Inventory#getType()

subtle folio
#

A regular inventory would be a chest correct?

#

solved im dumb

fallow violet
#

Well I have insalled redis and its working properly in my IDE. But in my minecraft server it says this

tender shard
drowsy helm
#

shade it

tender shard
#

?paste your pom.xml pls

undone axleBOT
fallow violet
tender shard
#

are you using maven?

#

if yes, upload your pom.xml

fallow violet
tender shard
fallow violet
#

but whats with shaded?

tender shard
#

you know, the spigot server itself has no idea about how to use redis. that's why you need to "shade" the redis dependency

#

shading basically means that your .jar includes the classes needed to talk to redis

fallow violet
#

okay...

tender shard
#

but I have no idea whether intelliJ artifacts support it. in 99% of cases you should simply use maven to handle all this stuff

fallow violet
#

i have an iml file. Maybe i can use that?

fallow violet
#

oh

#

well

tender shard
#

you should switch to maven

fallow violet
#

okay i try it

#

but

#

how

tender shard
#

check out the link I sent above, then create a new intelliJ project

fallow violet
#

ok

tender shard
#

you can then copy/paste your current code into your new maven project

lethal python
#

how can i give an armorstand collision like it's a block

quaint mantle
fallow violet
#

I have a question. Why is this marked red?

#

Do I need a repository?

vocal cloud
#

Probably? What do they tell you?

fallow violet
tender shard
drowsy helm
#

is it in another repo

fallow violet
#

thanks :>

tender shard
#

oh

#

it already worked

fallow violet
#

xd

vocal cloud
#

I need a meme for everytime someone comments on alex's use of light mode everything

drowsy helm
#

lel

ivory flume
#

Is there any way I can send data when a player goes to anothe rserver in bungeecord?

drowsy helm
vocal cloud
#

Depends on what's being sent

tender shard
#

I mean, I get it, people don't like light mode

fallow violet
#

damn I love maven

tender shard
drowsy helm
#

its pretty funny

#

lol

tender shard
#

it's funny for the first 20 times but after that it just gets boring

#

although I understand that it became a running gag here lol

fallow violet
#

alright now.

tender shard
#

you didn't shade it

fallow violet
#

well

drowsy helm
#

do you have the shade plugin

tender shard
#

you have to add the maven-shade-plugin to your <build> section

fallow violet
#

how

#

aaah

tender shard
#

one minute pls

#

check out the second part

#

the one that says "how to shade dependencies"

ivory flume
drowsy helm
#

what data are you sending?

vocal cloud
#

use something like redis to hold the data

ivory flume
#

resource pack status

#

essentially i need to tell the other servers that player received the resource pack and does not need to be redownloaded when they switch servers

tender shard
#

you could just use plugin messaging for this

drowsy helm
#

i might be wrong but if the resourcepack has the same checksum it wont prompt them

tender shard
#

that's correct

ivory flume
#

it doesnt prompt them, it takes it off then puts it back on again

#

ill check if its checksum or something

fallow violet
#

I shaded it right?

glossy scroll
#

does ItemStack play nicely with GSON, and if not is there a way to make it friendly?

tender shard
drowsy helm
#

but yeah unless you want to do annoying player checking just broadcast it and hope they are on the srver

fallow violet
drowsy helm
#

i wouldn't bother checking if they are on

#

or cache it somewhere

quaint mantle
fallow violet
#

wait

tender shard
fallow violet
#

i use pastebin

tender shard
#

you HAVE to use maven to compile it!

fallow violet
#

yea

fallow violet
tender shard
#

easiest solution would be to upload the whole plugin to github or something, then tell us the link

fallow violet
#

smart

#

but idk

tender shard
#

just upload it and send link lol

lethal python
subtle folio
drowsy helm
#

are you sure you are using the shaded jar

tender shard
subtle folio
tender shard
#

no you shoudln't

#

I just asked because I thought that's what you did

drowsy helm
#

what are you serializing an inv for anyway

subtle folio
#

Alright,

#

Im trying to make custom enderchests.

tender shard
#

org.bukkit.craftbukkit.v1_18_R2.inventory.CraftInventoryCustom

#

sus

subtle folio
#

by saving the inventory gui and loading it each time.

tender shard
#

what InventoryType do you use for your custom inv?

glossy scroll
#

thats the biggest nonanswer ive ever seen

drowsy helm
#

lmao

subtle folio
#

private Inventory poorINV = Bukkit.createInventory(null, 9, "small"); A regular one

humble tulip
#

Look

tender shard
humble tulip
tender shard
#

idk how you can turn that into a json object though

glossy scroll
#

yea

tender shard
#

spigot includes methods for YAML so you can easily save an ItemStack inside a YAML file

tender shard
#

for json, idk how to do it though

drowsy helm
#

json can serailize maps right?

glossy scroll
#

i need it to be json, i think ill just use a typeadapter