#help-development

1 messages · Page 103 of 1

hasty prawn
#

yeah won't matter then probs

slate mortar
#

also i'd have to rewrite my whole command system

#

and no, thanks

vocal cloud
#

Slash commands are easier to search through

slate mortar
#

ofc

#

but on my bot, you can just do ;help <command>

#

and it outputs an entire fancy embed message with all yu need to know

#

which only you can see

vocal cloud
#

Well with slash it also allows for the ability to not need a help command as all that info is built into discord.

slate mortar
#

it costs me more time to rewrite the sytem than it costs me to use ;help <command>

#

so i won't change except they really force me

iron glade
slate mortar
#

possible

vocal cloud
#

Yeah but for the spigot bot it'd be nice

gray merlin
#

I'm using it

ancient plank
#

it's ?cc

gray merlin
#

The NMS methods change on some versions.

hasty prawn
#

?cc

#

how dare you.

eternal night
#

wow

#

mods lying to us now

#

wrong guns

slate mortar
#

what has this become if even mods don't tell the truth

vocal cloud
#

Reported

ancient plank
#

Ppl spam them so ssamjh removed a lot of perms

hasty prawn
slate mortar
#

i wonder

#

?cc

vocal cloud
#

It's my commands and I want it now

slate mortar
#

even me?

#

this is disgusting

smoky oak
#
//instance extends JavaPlugin
InputStream inputStream = instance.getResource(path);
if(inputStream==null) throw new RuntimeException("Input Stream <"+path+"> doesn't exist.");

NPE: Caused by: java.lang.RuntimeException: Input Stream <structure\ritual_struct\amethyst\amethyst_01.dat> doesn't exist.
where tf did my file go

hasty prawn
#

I would've rioted if it worked for you and not me

slate mortar
#

i'm clearly a trustful person

ancient plank
#

Ppl are asking for help here so go to another channel for your discussions

eternal night
#

call getResource on the class loader

#

not the instance itself

young knoll
#

Isn't there like

smoky oak
#

'non static method cannot be accessed from a static context'

smoky oak
#

yea thats what im using

#

or trying to use

young knoll
#

Check the path in the jar to be sure

smoky oak
#

well it works with the same path and the test command

#

resource path is good in the built jar too

#

i want to know why the SAME method call does work on one occasion but doesnt on the other

young knoll
#

Where is the one that returns null called from

smoky oak
#
//This is an eventHandler class
Echo instance;
    public EventHookPlayerInteract(Echo echo){
        instance = echo;
    }
//...
Structure struct = RStructHandler.findStruct(instance,event.getClickedBlock().getLocation());```
calls, through a loop that gives some more args, and passes down instance 
```java
public static MultiBlockStructure getMBS(Echo instance, String path, String name, Boolean strict, Boolean ignoreAir){
        try{
            InputStream inputStream = instance.getResource(path);
            if(inputStream==null) throw new RuntimeException("Input Stream <"+path+"> doesn't exist.");
mellow pebble
quiet ice
tall dragon
#

orrr jitpack

smoky oak
mellow pebble
#

if it would be on maven i would easily do it already

quiet ice
tall dragon
#

it does?

quiet ice
quiet ice
mellow pebble
quiet ice
#

oh jesus that repo is a chonker

mellow pebble
#

why dont people just put everything on maven

#

muuch muuch easier

#

AHHAHA

tall dragon
mellow pebble
#

that is probably the only api that can sort of be used and that has some sort of example how to use it

tall dragon
#

make your own 😄

quiet ice
#

Oh yeah, jitpack works

mellow pebble
#

tabapi that is on spigot is 1.12 to above but i plan on 1.8 to above so that is not really a option

mellow pebble
quiet ice
#

You probably want to depend on that shared dependency, but given that I have never used it so idk

mellow pebble
quiet ice
#
[WARNING] Some problems were encountered while building the effective model for io.github.nosequel.tab:v1_17_R1:jar:1.1-SNAPSHOT
[WARNING] The expression ${parent.version} is deprecated. Please use ${project.parent.version} instead.
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.

NOICE

tall dragon
#

well some ppl in here are really smart

#

haha

quiet ice
#
[ERROR] Failed to execute goal on project shared: Could not resolve dependencies for project io.github.nosequel.tab:shared:jar:1.1-SNAPSHOT: Could not find artifact com.github.ProtocolSupport:ProtocolSupport:jar:f188eb2ea8 in jitpack (https://jitpack.io) -> [Help 1]

Yeah sorry, fails to build for me

mellow pebble
#

so i should learn NMS ig

smoky oak
#

okay
well then
can SOMEONE explain what im supposed to use in place of File.separator, because that doesnt work

#
[21:50:10] [Server thread/INFO]: [Shards] Trying to access: structure\ritual_struct\amethyst\amethyst_01.dat
[21:50:10] [Server thread/WARN]: [Shards] Tried to access a non-existent resource file: structure\ritual_struct\amethyst\amethyst_01.dat```
#

second doesnt work

young knoll
#

It should

smoky oak
#

second is generated using strings and File.separator

#

wtf

fleet comet
#

?paste

undone axleBOT
quiet ice
#

And WTF, why is that project AGPL

smoky oak
#

AH

#

file.pathSeparator

#

i hate java sometimes

tall dragon
mellow pebble
#

hahahah

tall dragon
#

no i dont

smoky oak
#

URGH

#

so apparantly file.pathSeparator is a ';' for some reason

#

so neither file.separator nor file.pathseparator allows me to create a functional path

#

any ideas

kind hatch
#

It's probably something with how you are using that value. You have value 1 acting as a double in a string format. Your second value is the string representation of null. You then try using value1 for the player name and value2 for something else. So value1 is most likely null as there will never be a player named 20.0

vivid skiff
#

How can i make spawn a armorstand looiking at the player who spawned it?

flint coyote
smoky oak
#

trying to find out why file.separator isnt working

#

redemptd dmd me to just use / which SEEMS to work

flint coyote
#

what does it return?

smoky oak
#

a NPE

flint coyote
#

lol

#

What about
FileSystems.getDefault().getSeparator()

#

but yeah you can add the slashes as a string aswell

smoky oak
#

which is kinda the issue here

#

spigot wants a forward slash for some godforsaken reason

flint coyote
#

Just manually create a path string then

#

with slashes

smoky oak
#

yea thats what im doing now

kind hatch
#

It's also pretty much the standard when it comes to zip files as well.

smoky oak
#

probably cuz unix is free

flint coyote
#

and unix is a lot more stable and faster than Windows

#

Perfect for servers

kind hatch
sacred mountain
#

how should i go about tracking this

kind hatch
#

When dealing with internal resources, you just start at the parent directory.

sacred mountain
#

im thinking about mojang statistics

#

and checking the distance difference every 10 seconds or something

#

but im not sure how to get those stats

smoky oak
smoky oak
kind hatch
sacred mountain
#

PlayerStatisticIncrementEvent

#

WALK_ONE_CM?

smoky oak
#

this the old code

#

im looping to check which object is interacted with

sacred mountain
#

ah i see

#

oh right

#

thats simple

#

lmao

#

thanks

flint coyote
#

also works for Player. No need for OfflinePlayer

lost matrix
smoky oak
#

thats a much better idea than playermoveevent tbh

gray merlin
#

Hey, sometimes my GUI closes randomly, without me doing anything

#

Why would that be?

#

not sometimes, it's consistent, in the first seconds of it being open

lost matrix
iron glade
#

then you have some issue in your code

kind hatch
# smoky oak this the old code

Is there any specific reason why you are using Paths#get() instead of the more common File.separator? There's a number of ways you can get a much more accurate path than that method. One of them being just making a new file object and passing the path of that file instead. Or you could write the string manually and use the File.separator to make your path, since it's basically the same as what Paths#get() does.

gray merlin
#

I open that same GUI through a different command, and that issue doesn't happen tho.

smoky oak
#

both fuck me cuz theyre both backslashes and produce a npe as a result

#

hence me now using a forward slash character in place of file.separator

iron glade
kind hatch
smoky oak
#

yes

sacred mountain
#

theres both walk_one_cm and sprint_one_cm

#

do i account for both and add them up

sacred mountain
#

and fall_one_cm lmfao

#

theres a lot

kind hatch
# smoky oak yes

Oh, then yea. You'll have to use forward slashes. Internal resources are treated differently. If it was on the disk, File.separator would work as expected. But when traversing internal directories, the behavior is different. I'm not 100% sure why, but the internal spigot methods like #saveResource() automatically convert backslashes into forward slashes.

flint coyote
#

You could also do your scheduler and check the distance from the last location. Sure it wouldn't account walking in circles correctly but it would be fine for the most part.

sacred mountain
#

its for long distance stuff, so if they make a turn with an elytra or something it wont account for any of that

#

the mojang ones are pretty accurate so imma do that

smoky oak
flint coyote
#

Well if you do it every second it would :p

smoky oak
#

ill just never bother with file.separator in spigot ever again

sacred mountain
#

and theres no point since theres an easy way anyway

lost matrix
flint coyote
#

yeah then just add up the different ones you need

sacred mountain
#

AVIATE_ONE_CM

kind hatch
sacred mountain
#

what is this

#

is that elytra

smoky oak
#

thats levitation effect

#

shulker

sacred mountain
#

got it

young knoll
#

Distance by Elytra The total distance traveled by elytra. minecraft:aviate_one_cm

#

It's Elytra

kind hatch
# kind hatch Oh, then yea. You'll have to use forward slashes. Internal resources are treated...

I guess I should be a little more specific with this. Some of the internal spigot methods, not all of them, convert to the forward slash. It depends on the context that you use them. For instance, when saving resources from your jar file, you need to use a forward slash with #saveResource(). If you found another way to get the file from your jar, you would likely use File.separator to preserve the directory structure.

Either way, it's not going to hurt anything or anyone if you use the methods as they are intended.

river oracle
#

Is there a way to set server motd without using the ServerPingEvent or whatever its called.

sacred mountain
#

what's "fly" then

#

creative mode?

river oracle
#

I'm doing it with code

lost matrix
river oracle
#

😢 static here I come

lost matrix
#

Why?

river oracle
#

hmmm actually 🤔 I might beable to do this without breaking oop gotta think

lost matrix
#

You can prevent static in 100% of cases

#

*excluding stuff like constants

river oracle
#

eh figured it out without static just going to be a pain to implement

worldly ingot
#

but i like static 🥺

river oracle
#

god no

#

in a good 90% of cases its just used wrong and makes code unbearable to maintain

#

the exception being an Actual Singleton class

young knoll
kind hatch
#

Ok, now do it with the whole armor stand, not just the head.

#

Then make every body part spin 360 constantly.

lost matrix
#

?paste

undone axleBOT
gray merlin
#

If I develop a plugin for 1.19 using JDK16, and have it technically still be runnable in previous versions code-wise, will I be able to run it in servers that use a lower JDK?

#

so, 1.16.5 and older?

smoky oak
#

if u compile it on a lower jdk

gray merlin
#

But then I won't be able to run that on higher jdk's will I?

smoky oak
#

thats not true

gray merlin
#

Oh?

smoky oak
#

almost all java code runs on higher java versions flawlessly

#

parts of minecraft 1.19 still have java 1.8 code

gray merlin
#

I see, thank you.

coarse bridge
#

Can anyone help me? I get this error: Error occurred while enabling Testing v1.0-SNAPSHOT (Is it up to date?) java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics at me.jones.testing.Testing.onEnable(Testing.kt:14) ~[?:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot-api-1.19.2-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-api-1.19.2-R0.1-SNAPSHOT.jar:?]

How can I fix this? I am initialising the Listener like this:```tk
var manager = Bukkit.getPluginManager()

    val joinlistener = JoinListener()
    manager.registerEvents(joinlistener, this)```
lost matrix
coarse bridge
#

Wdym? It worked with an easy msg to the console until I added the Listener...

lost matrix
#

You need to shadow the kotlin std lib into your plugin jar so you can use it on runtime

lost matrix
#

Any reason why you want to insist on using kotlin?

gray merlin
#

Can I develop plugins for, say, 1.16.5 with the 1.19 spigot pkg?

lost matrix
coarse bridge
#

What's the problem with Kotlin? It should be about the same

lost matrix
gray merlin
#

So there's no way to make a universal version?

#

I was going to use reflection on a lot of things for it, but I remembered that we need to download the api and yeah

lost matrix
kind hatch
# gray merlin So there's no way to make a universal version?

You can make your plugin support multiple versions, but don't expect it to be as easy as just using methods from the latest version of the API. APIs are constantly changing, so methods like reflection will only get you so far. If you want a plugin that'll run perfectly on every version, you need version specific code.

coarse bridge
fleet comet
#

So I am making a custom items plugin using YML as the source for making the actual items. I'm using this code for left click actions, https://paste.md-5.net/axiwoqadub.cs
And it is saying that value1 is "null", not sure why. Here's the yml file i am using```yaml
id: "test_item"
name: "&bIt is a diamond!"
material: "DIAMOND"

enchantments:

  • "minecraft:loyalty;1"

shape1: " "
shape2: " D "
shape3: "O O"

ingredients:

  • "D;DIAMOND"
  • "O;COAL_BLOCK"

laction:

  • HEAL;%holder%;10.0

raction:

  • KILL;%holder%```
gray merlin
#

Thus why we don't shade it

lost matrix
fleet comet
#

thats exactly why, it was my mistake in the YML

#

wait no i didnt

kind hatch
fleet comet
coarse bridge
# lost matrix Show your whole JavaPlugin class pls
package me.jones.testing

import me.jones.testing.listeners.JoinListener
import org.bukkit.Bukkit
import org.bukkit.event.Listener
import org.bukkit.plugin.java.JavaPlugin

class Testing : JavaPlugin(), Listener {

    override fun onEnable() {
        // Plugin startup logic
        Bukkit.getConsoleSender().sendMessage("§bPlugin was loaded §asuccessfully§b!")

        var manager = Bukkit.getPluginManager()

        val joinlistener = JoinListener()
        manager.registerEvents(joinlistener, this)
    }


    override fun onDisable() {
        // Plugin shutdown logic
    }
}```

and the listener:
```package me.jones.testing.listeners

import net.kyori.adventure.text.Component
import org.bukkit.Particle
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.event.player.PlayerJoinEvent

class JoinListener : Listener {


    @EventHandler
    public fun onJoin(event: PlayerJoinEvent) {
        var p = event.player
        var msg = Component.text("§aWelcome " + p.displayName())
        event.joinMessage(msg)
        p.spawnParticle(Particle.CLOUD, p.location, 30)
    }
}```
kind hatch
coarse bridge
#

@lost matrix does this help?

lost matrix
coarse bridge
sacred mountain
#

there are only 2 other parameter types, this is for the walk_one_cm statistic

#

Material and EntityType

#

do i need to supply entitytype.player or wht

#

java.lang.IllegalArgumentException: This statistic does not take an EntityType parameter
damn ok

fleet comet
#

what the hell

sacred mountain
#

healthy boi

fleet comet
#
public void rightClickAction(PlayerInteractEvent event) {
        List<String> actions = configuration.getStringList("raction");
        for (String a : actions) {
            a = a.replaceAll("%holder%", event.getPlayer().getName());
            List<String> ac = List.of(a.split(";"));
            ActionType type = ActionType.HEAL;
            String value1 = "imnobody";
            String value2 = "5.0";
            int index = 0;
            for (String acString : ac) {
                if (index == 0) {
                    type = ActionType.valueOf(acString);
                } else if (index == 1) {
                    value1 = acString;
                } else if (index == 3) {
                    value2 = acString;
                }
                index = index + 1;
            }
            switch (type) {
                case KICK -> {
                    Bukkit.getPlayer(value1).kickPlayer(value2);
                }
                case HEAL -> {
                    Player target = Bukkit.getPlayer(value1);
                    double amount = Double.parseDouble(value2);
                    target.setHealth(target.getHealth() + amount);
                }
                case KILL -> {
                    Player target = Bukkit.getPlayer(value1);
                    target.setHealth(0);
                }
            }
        }
    }```
#

i dont understand- how

hasty prawn
#

You don't understand what

fleet comet
hasty prawn
#

20 is the max and you tried setting it to 30

fleet comet
#

its set to 5.0

tall dragon
fleet comet
sacred mountain
#

target.setHealth(target.getHealth() + amount);

grim oak
#

Im getting the following error, can anyone help?Error occurred while enabling LorePlugin v1.0-SNAPSHOT (Is it up to date?)

Error occurred while enabling LorePlugin v1.0-SNAPSHOT (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "me.vaindev.loreplugin.LorePlugin.getCommand(String)" is null
        at me.vaindev.loreplugin.LorePlugin.onEnable(LorePlugin.java:18) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:479) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:520) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3537-Spigot-56be6a8-622dbe6]
        at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:434) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3537-Spigot-56be6a8-622dbe6]
        at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:582) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3537-Spigot-56be6a8-622dbe6]
        at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:401) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3537-Spigot-56be6a8-622dbe6]
        at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:255) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3537-Spigot-56be6a8-622dbe6]
        at net.minecraft.server.MinecraftServer.v(MinecraftServer.java:966) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3537-Spigot-56be6a8-622dbe6]
        at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:291) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3537-Spigot-56be6a8-622dbe6]
        at java.lang.Thread.run(Thread.java:833) [?:?]```
fleet comet
sacred mountain
#

target.setHealth(target.getHealth() + amount);
this will set. their health above 20 right

lost matrix
fleet comet
#

im being a dumbass

river oracle
grim oak
#

If my plugin yml was in the wrong directory would the plugin not work at all or could that be a possible readon?

#

reason*

hasty prawn
#

It wouldn't work at all

grim oak
#

Okay so at least ik its in the right directory

fleet comet
flint coyote
#

why are you destroying the yaml format so badly? ;-;

fleet comet
#

by you saying that

#

there not in strings ;-;

flint coyote
#

But please don't do it like that

#

that's just dirty and lazy

grim oak
fleet comet
tall dragon
#

not like this man

flint coyote
#

with actual yaml? Multiple fields?
laction:
task: HEAL
target: %holder%
value: 10.0

#

something like that

fleet comet
flint coyote
#

well then make a list of actions

#

laction:
actions:
- HEAL
- TELEPORT
- USE_YAML

fleet comet
flint coyote
#

or if each action needs more fields you nest it deeper

#

Aren't you using spigot?

fleet comet
flint coyote
#

Just use YamlConfiguration class 💀 It does everything for you

fleet comet
#

what it reads

#

what methods

flint coyote
#

Oh

fleet comet
#

etc.

flint coyote
#

yeah do it right then xD

fleet comet
flint coyote
#

YamlConfiguration#getStringList(path)

fleet comet
#

also please let me keep this 🥺

flint coyote
#

no owo. What does the letter even mean

fleet comet
#

i just couldn't take another for loop

flint coyote
#

why is that split in 3 paths aaaah

#

yaml murderer

fleet comet
flint coyote
#

💀

fleet comet
# flint coyote 💀
public void rightClickAction(PlayerInteractEvent event) {
        List<String> actions = configuration.getStringList("raction");
        for (String a : actions) {
            a = a.replaceAll("%holder%", event.getPlayer().getName());
            List<String> ac = List.of(a.split(";"));
            ActionType type = ActionType.HEAL;
            String value1 = "imnobody";
            String value2 = "5.0";
            int index = 0;
            for (String acString : ac) {
                if (index == 0) {
                    type = ActionType.valueOf(acString);
                } else if (index == 1) {
                    value1 = acString;
                } else if (index == 3) {
                    value2 = acString;
                }
                index = index + 1;
            }
            try {
                switch (type) {
                    case KICK -> {
                        Bukkit.getPlayer(value1).kickPlayer(value2);
                    }
                    case HEAL -> {
                        Player target = Bukkit.getPlayer(value1);
                        double amount = Double.parseDouble(value2);
                        double c = target.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();
                        target.setHealth(target.getHealth() + amount);
                    }
                    case KILL -> {
                        Player target = Bukkit.getPlayer(value1);
                        target.setHealth(0);
                    }
                }
            } catch (Exception e) {
                Bukkit.getLogger().severe("There was an issue using this item.");
            }
        }
    }``` do you see all these for loops???
flint coyote
#

for(String str : cfg.getString(path).split("\n")

fleet comet
flint coyote
#

ofc you can

fleet comet
flint coyote
#

lul

fleet comet
flint coyote
#

but your code is messy :x you should have a class that reads config values

#

Up to you. Either String list or one single multiline string

urban kernel
#

how do i get the way the player died in a playerdeathevent?

fleet comet
#

still yaml

#

plus its cleaner

flint coyote
fleet comet
#

more room for more actions

urban kernel
#

found it :P

#

e.getEntity().getLastDamageCause();

#

what does that return

flint coyote
# fleet comet plus its cleaner

it's not cleaner. That's like using json and doing

"Abilities":["HEAL;%holder%;10.0","TELEPORT;%holder%,%spawn%"] instead of actually using a decent json structure

urban kernel
#

what does e.getEntity().getLastDamageCause(); return?

flint coyote
#

ENTITY_ATTACK, PROJECTILE, CUSTOM etc

fleet comet
flint coyote
fleet comet
flint coyote
#

Also lets say you wanna add 2 lists of unlimited length to your actions later? How you gonna do that?

Split them with ;; instead of ;?

#

you limit yourself for the future

urban kernel
flint coyote
flint coyote
#

google for "DamageCause spigot docs"

flint coyote
#

I'm proud of yoh

#

u

urban kernel
#

if(!(e.getEntity().getLastDamageCause() != DamageCause.ENTITY_ATTACK)) {

#

causes error

#

how do i fix

#

fixed

flint coyote
#

yeah add getCause()

urban kernel
#

i fixed with

flint coyote
#

👍

urban kernel
#

if(!(e.getEntity().getLastDamageCause().equals(DamageCause.ENTITY_ATTACK))) {

flint coyote
#

that won't work 💀

urban kernel
#

rlly

flint coyote
#

getLastDamageCause returns the last EntityDamageEvent

#

so you need getLastDamageCause().getReason()

#

then you can do != again

urban kernel
flint coyote
#

getCause() sorry

urban kernel
#

if(!(e.getEntity().getLastDamageCause().getCause().equals(DamageCause.ENTITY_ATTACK))) {?

upper vale
#

==

urban kernel
#

!=*

flint coyote
#

yup like that with != since you are comparing 2 enums

#

Although .equals() would default to == anyway. It's an avoidable extra method call

urban kernel
#

can you use colour codes &4 in ban reasons?

flint coyote
#

Also keep in mind that entity attack will not be the cause for skeletons arrows

urban kernel
#

i mostly want it for players

flint coyote
#

You have to translate them but yes I guess you can

urban kernel
#

aaaa how would i translate them

flint coyote
#

ChatColor.translateAlternateColorCode('&', yourString);

#

returns a string with translated colors

urban kernel
#

tbf i cba

flint coyote
#

cba?

urban kernel
#

it's quarter past 11

urban kernel
flint coyote
#

I see

#

Yeah quarter past 12 for me

urban kernel
#

wow

echo basalt
#

mans got a very good sleep schedule

flint coyote
#

But I'm driving since 14 hours so might aswell help people in here instead of being bored

echo basalt
#

very developer unlike

flint coyote
#

True. I'm usually awake till 5-7 when I don't have to work

urban kernel
#

is there a specifit type of DamageCause for player-inflicted damage?

flint coyote
#

No you would have to track it using the entitydamagebyentityevent

urban kernel
#

wait

#

cant i just use getCause.getEntity

#

e.getEntity().getLastDamageCause().getEntity()

flint coyote
#

how would a cause have an entity?

#

Or does that actually work?

urban kernel
#

if it's a DamageCause.ENTITY_ATTACK

flint coyote
#

Yeah but there's no entity attached to it

boreal python
#

How would I give mooshrooms invisibility? (No particles)

urban kernel
#

oh

urban kernel
#

1.16+

onyx fjord
#

Mushrooms?

#

Wdym

flint coyote
#

mooshrooms

boreal python
#

the red cows

flint coyote
#

the cows

onyx fjord
#

Ooh

boreal python
#

👍

onyx fjord
#

Ye what he said

#

Tho I think you can disable ambient particles when using effect too

urban kernel
#

is a drop considered a LivingEntity?

flint coyote
#

no

#

just an Entity

urban kernel
#

alr

#

just wondering :P

#

but how would i get the entity from the DamageCause.ENTITY_ATTACK

flint coyote
#

That's the neat part: You don't

urban kernel
#

aaaaaaaaaaaa

timid jetty
#

funny cause ive got a question in the same vein

flint coyote
#

Track it with EntityDamageByEntityEvent

urban kernel
#

can i have 2 events in the same class

#

:P

flint coyote
#

Yes

timid jetty
#

in EntityDamageByEntityEvent, event.getDamager() refers to the entity that shot projectile in the case of a projectile damaging

timid jetty
flint coyote
#

no it refers to the projectile

buoyant viper
flint coyote
#

but you can do projectile.getShooter()

timid jetty
buoyant viper
#

😔

flint coyote
#

You can make a Utils class for it tho

delicate lynx
flint coyote
#

or more like 1 function in a utils class. Or just add the function to the listener class

timid jetty
urban kernel
#

how do i see if EntityDamageByEntityEvent#getDamager is a player or not

timid jetty
urban kernel
#

ty

flint coyote
#

just with extra steps

timid jetty
#

yeah im doing it in like 4 separate listeners wonder if I just create my own class

#

like own event

flint coyote
timid jetty
flint coyote
timid jetty
#

welp guess im doing that first lmao

flint coyote
urban kernel
#

aaaaaaa lifesteal plugin go brrrrrrrrrrrr

timid jetty
flint coyote
timid jetty
#

would want this to be robust but never set up my own event

flint coyote
#

I mean instead of simply continuing to do your code after the method call you would then trigger an event just to have another listener that reacts to the event

#

But if you need it in multiple plugins you could actually make a plugin for additional events or core features or libs or whatever and add it there. That way you would only have to change it inside there instead of changing every plugin

timid jetty
#

thanks chief

sinful rapids
#
Config:
Hello: "hello"
List: []
Code:
public static List<String> lista = GMDIBank.plugin.getConfig().getStringList("Lista");
lista.add(target.getName());
GMDIBank.plugin.getConfig().set("Lista", target.getName());
GMDIBank.getInstance().saveConfig();

When saving the list it deletes the string Hello, how can I solve?

snow lava
#

¿paste

buoyant viper
#

close

snow lava
#

¿help

buoyant viper
#

?paste

undone axleBOT
sinful rapids
#

ok

snow lava
#

I wanna create an array list that contains a whitelist of material but for some reason this doesn't work in the server

hasty prawn
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

sinful rapids
hasty prawn
flint coyote
sinful rapids
snow lava
hasty prawn
#

What is it supposed to do?

snow lava
#

i get this

hasty prawn
#

You're making a new instance of your JavaPlugin class, don't do that

snow lava
#

ahhh, so i can't make an object of my main class

slate mortar
#

spigot initializes it automatically

hazy parrot
#

Or you could use built in spigot method

slate mortar
#

wdym

hazy parrot
#

Im assuming he is initializing it to get access to vars/ methods

slate mortar
#

most likely

hazy parrot
#

so getPlugin will do the job

slate mortar
#

if you mean using getPlugin(Main.class), yes it's possible, but kinda ugly/long

hazy parrot
#

yap, just gave another example how instance could be pass ^^

timid jetty
#

hi what is the type of splash potions, are they considered projectiles?

torpid sapphire
#

how do i use NamespacedKey? what am i supposed to use as my key?
do i use different keys for different types of data?

hasty prawn
gray merlin
#

This isn't really about spigot, but yeah

#

I had a multi-module maven project, and I loaded it up now, and reloaded maven... and this happened

hasty prawn
#

I mean it applies, NamespacedKey is a Bukkit class.

#

Oh, you mean your own thing

#

😄

gray merlin
torpid sapphire
#

it needs a plugin instance and a key

#

what is that key supposed to be

gray merlin
#

everything kinda broke apart and now it's not a modular project anymore? and yeah

#

How would I fix this...?

#

I'm clueless

hasty prawn
#

It depends on what you're using NamespacedKeys for.

torpid sapphire
#

PersistentData

hasty prawn
#

For example, Minecraft uses them. minecraft:diamond for example. minecraft is their namespace, and diamond is the key they use.

torpid sapphire
#

ohh i see

#

thats what those are

#

well i just want to store some data on an item

#

do i just call it data and be done with it

hasty prawn
#

You could but I would name it something more meaningful to what you're actually storing.

torpid sapphire
#

so i do use different keys for different data

hasty prawn
#

Yes, so if you were storing 2 ints and a String onto something, each would have their own unique key identifier.

#

level, damage, and name, for example.

torpid sapphire
#

wait i might be a bit stupid

#

i am

#

right

#

my bad, got it

hasty prawn
# gray merlin

I know Gradle does this if the names don't match in my settings.gradle. Could be something similar?

gray merlin
#

I'll check

torpid sapphire
#

for some reason i thought you needed the key to get the data container, not as an actual key for the data

#

how do i get the plugin instance? do i use the plugin manager or is there some convenience method to get the current plugin

hasty prawn
#

?di

undone axleBOT
torpid sapphire
#

i see

#

thanks

gray merlin
#

Is there a way to make the icons not be replaced? Or at least be consistently replaced?

hasty prawn
#

Disable the plugin thats replacing them

gray merlin
#

It's probably the mc plugin one

#

thanks

#

Thought that was default behaviour in some way

atomic swift
#

im trying to add a dbfile to the datafile but i keep getting this error, dont worry about the warn, also its the sql part of the java code

[23:38:37 INFO]: [Genesis-network] Loading Genesis-network v1.0.0
[23:38:37 INFO]: Connection to database
[23:38:37 INFO]: [Genesis-network] [STDOUT] [INFO] SQLite file "DONT-TOUCH-THIS/database.db" not found, creating file...
[23:38:37 WARN]: Nag author(s): '[Jonathan_Nathan]' of 'Genesis-network' about their usage of System.out/err.print. Please use your plugin's logger instead (JavaPlugin#getLogger).
[23:38:37 INFO]: [Genesis-network] [STDOUT] [ERROR] Error at creating database connection: path to 'DONT-TOUCH-THIS/database.db': '/home/container/DONT-TOUCH-THIS' does not exist
[23:38:37 INFO]: [Genesis-network] [STDOUT] [ERROR] Database connection failed. Continuing without database.
public Database(DBType dbType) {
   try {
        if (dbType == DBType.MySQL) {
            con = DriverManager.getConnection(
"jdbc:mysql://" + mysql_hostname + ":" + mysql_port + "/" + mysql_database
         + "?autoReconnect=true", mysql_username, mysql_password);
          Gen.getInstance().getLogger().info("[INFO] Successfully initialized database connection.");
 } else if (dbType == DBType.SQLite) {
       File sqliteFile = new File(Gen.getInstance().getDataFolder(), filePath);
        if (!sqliteFile.exists()) {
          Gen.getInstance().getLogger().info("[INFO] SQLite file \"" + filePath + "\" not found, creating file...");
                    sqliteFile.getParentFile().mkdirs();
                    Gen.getInstance().saveResource(filePath, false);
                }
                con = DriverManager.getConnection("jdbc:sqlite:" + filePath);
                Gen.getInstance().getLogger().info("[INFO] Successfully initialized database connection.");
            }
        } catch (Exception ex) {
            Gen.getInstance().getLogger().severe("[ERROR] Error at creating database connection: " + ex.getMessage());
}
}
delicate lynx
#

try to use jdbc:sqlite:// + file path

atomic swift
#
    /**
     * SQLite Data
     * Set this data if you use DBType#SQLite
     * <p>
     * field filePath - This can either be a relative or absolute path.
     * ex: sokobot.db
     * or: C:/sqlite/db/sokobot.db
     */
    private final String filePath = "DONT-TOUCH-THIS/database.db";

    /**
     * MySQL Data
     * Set this data if you use DBType#MySQL
     */
    private final String mysql_hostname = "";
    /**
     * MySQL Port
     * Set this data if you use DBType#MySQL
     */
    private final int mysql_port = 3306;
    /**
     * MySQL database
     * Set this data if you use DBType#MySQL
     */
    private final String mysql_database = "";
    /**
     * MySQL username
     * Set this data if you use DBType#MySQL
     */
    private final String mysql_username = "";
    /**
     * MySQL password
     * Set this data if you use DBType#MySQL
     */
    private final String mysql_password = "";
    /**
     * the connection
     */
    public Connection con = null;
    /**
     * the database type
     *
     * @apiNote the dbType set in Bot.java
     */
dusk flicker
#

not according to your screenshot

delicate lynx
#

con = DriverManager.getConnection("jdbc:sqlite:" + filePath);

#

you have this

#

change it to jdbc:sqlite://

atomic swift
#

might be bc i dont have the driver

#

idk ill try with the driver

#

so

#

its creating the db but

#

i get

[00:21:37 INFO]: [Genesis-network] [INFO] SQLite file "plugins/Genesis-networkDONT-TOUCH-THIS/database.db" not found, creating file...
[00:21:37 ERROR]: [Genesis-network] [ERROR] Error at creating database connection: The embedded resource 'plugins/Genesis-networkDONT-TOUCH-THIS/database.db' cannot be found in plugins/GenNetwork-0.0.1-SNAPSHOT.jar
[00:21:37 INFO]: [Genesis-network] [STDOUT] [ERROR] Database connection failed. Continuing without database.
dusk flicker
#

have you actually tried what hyperdefined said?

atomic swift
#

no bc i have used the same exact thing in a diff project and it worked ill try it tho

#

// is defining a new path

#
- [00:26:12 ERROR]: [Genesis-network] [ERROR] Error at creating database connection: path to '//DONT-TOUCH-THIS/database.db': '/DONT-TOUCH-THIS' does not exist
rare flicker
#

is there a way to damage a player without applying knockback?
Player.damage(double) does exactly that but the damage is absolute and ignores armor which isn't what i want

gray merlin
#

It seems that maven is hiding the version names for my modules. How would I make it not hide them?

atomic swift
# dusk flicker have you actually tried what hyperdefined said?

i create a file the same way with

    private void createCTConfig() {
        ctConfigFile = new File(getDataFolder(), "minigames/Color-Takeover.yml");
        if (!ctConfigFile.exists()) {
            ctConfigFile.getParentFile().mkdirs();
            saveResource("minigames/Color-Takeover.yml", false);
        }
        
        ctConfig = new YamlConfiguration();
        try {
            ctConfig.load(ctConfigFile);
        } catch (IOException | InvalidConfigurationException e) {
            e.printStackTrace();
        }
    }
terse panther
#

is there a tool to obfuscate code at compiling time with gradle?

atomic swift
#

ok i fixed it all i need to do was con = DriverManager.getConnection("jdbc:sqlite:" + Gen.getInstance().getDataFolder() + "/" + filePath);

eternal oxide
#

unless you are on an old sql driver you need to use getDatafolder().getRelativePath()

#

newer drivers don't allow that

#

it might need absolute. I'll check. One sec

#

ide slow opening

#

needs absolute getDataFolder().getAbsolutePath()

timid jetty
#

is there a list of metadata that bukkit already has for items somewhere/

#

the namespacedkeys?

dry forum
#

are there any good forms on how to send an actionbar using nms

drowsy helm
river oracle
#

just use spigot api

hasty prawn
#

?ask

undone axleBOT
#

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

hasty prawn
#

Wdym it doesn't work

#

Do they just ignore it?

#

I don't really understand what you mean by the last part honestly.

#

The Endermen teleports instead of walking when you call moveTo?

#

What are you setting speed to?

drowsy helm
#

does NamespacedKey#minecraft have to be a default minecraft key?

#

or can it be anything

hasty prawn
#

Aren't you talking about walking though..?

worldly ingot
hasty prawn
#

I mean you just said it yourself. Speed affects walking. If your speed is too high it will look like they're teleporting. moveTo alone isn't going to teleport an entity afaik.

#

Let me try something.

hasty prawn
#

Well I've broken Minecraft

#

getNavigation().moveTo() works for me

#
public class CustomZombie extends Zombie {
    public CustomZombie(Location location) {
        super(EntityType.ZOMBIE, ((CraftWorld) location.getWorld()).getHandle());

        this.setPos(location.getX(), location.getY(), location.getZ());

        ((CraftWorld) location.getWorld()).addEntity(this, CreatureSpawnEvent.SpawnReason.CUSTOM);
    }

    @Override
    public void tick() {
        super.tick();
        this.getNavigation().moveTo(this.getX() + 5, this.getY(), this.getZ() + 5, 15);
    }
}

I'm constantly reminding him that he needs to get his ass moving

#

Every tick

#

Just uh

#

Just make sure you call super.tick() or you get the broken guys that dont leave

#

Because if you override tick() without calling super then nothing happens when the server ticks the zombie

#

Which means no AI... no anything. It just does nothing

#

He'll stand there I assume

#

You need extra logic to prevent him from going there permanently

#

Or a Goal

#

You can do it in the Goal's tick method then

#

That way he'll only move there when the Goal's canUse() method returns true.

#

Want him to move? Let him use the goal. Don't want him to do that? Return false

quaint mantle
#

Guys can someon help i have vault,luckyperms and prefix wont show

hasty prawn
eternal oxide
#

do you super() in teh tick method of your mob?

#

this is in my NPC```java
@Override
public void tick(){
super.tick();
doTick();
}

@Override
public void doTick() {
    super.baseTick();
    moveWithFallDamage();
}```
#

calls teh local doTick

#

for movement

#

I guess

hasty prawn
#

I dont even have doTick

eternal oxide
#

That is for ServerPlayer. I've not messed with mobs

hasty prawn
#

Ah

eternal oxide
#

But I'd assume its close

hasty prawn
#

Mobs dont have doTick

eternal oxide
#

then probably just super in yoru tick method

hasty prawn
#

So you just need tick()

#

Yes

#

Look at what mine is doing, might give you hints as to what you're doing wrong.

#

You should be adding the goal when you create the Zombie, for instance.

#

Also 10 is an insanely high speed

#

I did 3 earlier and he was the god damn flash

#

You can do both of those things yes

#

Lower the speed, and then re-work your goal properly.

#

Call moveTo in the Goal's tick method and use canUse() in the goal to determine when he should be moving towards your target.

hasty prawn
#

You don't, thats fine.

#

Yes, if that returns false then the goal's tick() method won't be called.

#

So he'll stop moving.

#

Well in my case it's just toggling his movement every 100 ticks. You can decide when yours moves and doesn't move.

#

I dont know what constraints it should have

#

Stop moving when he reaches the block or something I guess?

#

Then yeah stop the goal once he reaches the block

#

Make canUse return false

#

Mhm

eternal oxide
#

thats a local field in his class

worthy yarrow
#
                FarmShop.setItem(1, carrot);

                ItemStack potato = new ItemStack(Material.POTATO);
                FarmShop.setItem(2, potato); ```

For some odd reason neither the carrot or potato show up in the gui any ideas?
hasty prawn
#

Show the code for opening the inventory

worthy yarrow
#
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

            Player p = (Player) sender;

            if (p.hasPermission("necon.shop.use")) {

                Inventory FarmShop = Bukkit.createInventory(null, 36, ChatColor.GREEN + "Farm Shop");

                ItemStack wheat = new ItemStack(Material.WHEAT);
                FarmShop.setItem(0, wheat);

               // ItemStack carrot = new ItemStack(Material.CARROT);
               // FarmShop.setItem(1, carrot);

               // ItemStack potato = new ItemStack(Material.POTATO);
               // FarmShop.setItem(2, potato);

                ItemStack pumpkin = new ItemStack(Material.PUMPKIN);
                FarmShop.setItem(1, pumpkin);

                ItemStack melonBlock = new ItemStack(Material.MELON);
                FarmShop.setItem(2, melonBlock);

                ItemStack melonSeed = new ItemStack(Material.MELON_SEEDS);
                FarmShop.setItem(3, melonSeed);

                ItemStack returnShop = new ItemStack(Material.BARRIER);
                ItemMeta returnShopMeta = returnShop.getItemMeta();
                returnShopMeta.setDisplayName(ChatColor.GRAY + "Return to " + ChatColor.RED + "Main shop");
                returnShop.setItemMeta(returnShopMeta);
                FarmShop.setItem(31, returnShop);

                p.openInventory(FarmShop);
            }```
hasty prawn
#

They're commented out

worthy yarrow
#

ik

#

because they werent working

hasty prawn
#

The other ones work? Wheat and pumpkin etc?

worthy yarrow
#

yea its weird ill send ss

hasty prawn
#

Oh its because you're overwriting them

#

With pumpkin and melon

#

Same slots

worthy yarrow
#

not that, i changed it so that it wouldnt be missing 2 slots

hasty prawn
#

Change it back, I'm guessing it'll work.

worthy yarrow
#

maybe ill try and send ss

hasty prawn
#

Uhh you might be able to move it outside, putting it in the tick method just makes 100% sure it doesn't lose interest for some reason.

river oracle
#

is there an api method for reading the action bar?

eternal oxide
#

just add a method canMove on teh mob

#

set it true/false if you want them to move

undone axleBOT
eternal oxide
#

ad a method so you can set shouldMove

#
public void setCanMove(boolean value) {
    this.canmove = value;
}```
#

no, you don;t want a listener per mob

#

with that above method you can enable or disable the mob movement in your listener

#

yes

#

yes, no clue why you are nesting

#

Goal has nothing to do with PlayerEvents

#

the Goal should be its own class or nested in the mob itself

#

The mob should not have its own listener

#

Its an action of your Player not teh mob

#

it affects the mob but its an activity your player is doing

#

teh Goal should not implement Listener

river oracle
#

agghhhh My eeyesss

#

lol just kidding

eternal oxide
#

Ok, single responsibility principle Your one class is currently a Player event listener, a mob spawner and a Goal creator.

#

your Player Listener class shoudl ONLY listen to player events.

river oracle
#

I go a step further and only listen to 1 player event per class :p

#

only so I don't get distracted thats a bit overkill

eternal oxide
#

you don;t

#

you call a toggle to enable/disable the mob from moving

#

in your MyMob class you have a Field for canMove, or whatever you want to call it

#

you have direct access to that when you get a mob instance in yoru single responsibility PlayerListener

#

you can set the mob to moving or not.

#

You are literally just moving public boolean shouldMove; into your MyMob class.

#

add a getter/setter for it.

#

and move your MyGoal out of your listener

fallen anvil
#

Trying to replace the CustomModelData of an item in an item frame.
I tried frame.getItem().getItemMeta().setCustomModelData(newvalue); to no avail, next I tried:

eternal oxide
#

put teh meta back after changing it. Its a clone

#

looks like you did

fallen anvil
#

Eh no I missed that step

#

I don't think setItemMeta showed up when I tried it

eternal oxide
#

ah yep you put the item back

#

no need to do that, just apply the meta back to the item.

fallen anvil
#

It came up now 😄

#

fingers crossed!

#

Looks like it needs both, but it's (sort of) working!

cobalt thorn
#

Hi a question im trying to make a config where the user can add more level

  ActionPercentage:
    enabled: false
    level_1:
      percentage: 10
      Behavior: "{Behavior}, Replika doesn't love user but like him as friend"

i tried using a for but without result any solution?

fallen anvil
#

Replika? o.o

cobalt thorn
fallen anvil
#

Oh I see

cobalt thorn
fallen anvil
#

I don't know what you mean by a for

#

like a for loop or foreach?

cobalt thorn
# fallen anvil like a for loop or foreach?
if(Main.getInstance().getConfig().getBoolean("Replika.ActionPercentage.enabled")) {
                    for (int i = 0; i < Integer.parseInt(String.valueOf(Main.getInstance().getConfig().getStringList("Replika.ActionPercentage.level_" + i))); i++) {
                        System.out.println(i);
                    }
                }
eternal oxide
#

you have no level key

#

yours is "level_1"

#

thats better 🙂

chrome beacon
#

Loop getKeys

eternal oxide
#

use getConfig().getConfigurationSection("Replika.ActionPercentage").getKeys(false)

cobalt thorn
eternal oxide
#

no, that gets you all the root keys under that section

#

so enabled and level_1

cobalt thorn
#

in this way?

eternal oxide
#

no

#

getKeys(false) is returning you a List

cobalt thorn
eternal oxide
#

not with that for loop

cobalt thorn
#

foreach?

eternal oxide
#

for (String key : getConfig().getConfigurationSection("Replika.ActionPercentage").getKeys(false)) {

cobalt thorn
eternal oxide
#
if (split.length == 2) ... //test if split[1] is a value```
#

also check split[0].equalIgnorecase("level")

#

if (split.length == 2 && split[0].equalsIgnorecase("level"))...

cobalt thorn
eternal oxide
cobalt thorn
eternal oxide
#

level_1 is a section key not a value

#

yes

cobalt thorn
# eternal oxide level_1 is a section key not a value
for (String key : Main.getInstance().getConfig().getConfigurationSection("Replika.ActionPercentage").getKeys(false)) {
                String[] split = key.split("_");
                if (split.length == 2 && split[0].equalsIgnoreCase("level")) {
                    Main.getInstance().getLogger().info(String.valueOf(Main.getInstance().getConfig().getInt("Replika.ActionPercentage.level_" + split[1])));
                }
            }
eternal oxide
#

get teh section, then get the keys beneath

cobalt thorn
#

this is the code done

cobalt thorn
eternal oxide
#

its not an int

cobalt thorn
#

parse int?

eternal oxide
#
getConfigurationSection(key).getint("percentage")```
cobalt thorn
eternal oxide
#

nope thats all

cobalt thorn
eternal oxide
#

oh sorry that won;t work

#

I forgot key is not a path

cobalt thorn
#

no problem

eternal oxide
#
getConfigurationSection("Replika.ActionPercentage." + key).getint("percentage")```
winter glen
#

Who cann help with custom mc plugins and server setup i Will pay.

undone axleBOT
kind hatch
#

Has anyone written load balancing logic? Right now I'm just prototyping and I've made one that is based off of the amount of online players, but it feels very basic. (Get all online servers, sort by lowest player count, then send to the smallest player count server).

Is there a smarter way to balance players? What other contexts should I be considering when it comes to servers?

torn oyster
#

what's the best way to communicate between plugins without using bungee plugin messaging

#

is redis good for that? idk i remember someone saying it is but i'm not sure if it was in this context

kind hatch
torn oyster
#

like that of bigger servers

kind hatch
#

Then a shared database would likely be your best bet. You'd just need to setup the proper credentials in your server creation tool.

torn oyster
#

i'm making a standalone java app to run in the background which processes requests (through a shared database)

#

will that work?

kind hatch
#

So long as your on-demand servers are able to connect to the proper database, everything should be fine.

grim oak
#

hi im making a command and im wondering if i want the format to be like this editlore {newlore} what arg would i use to set the lore, because if i use args[0], if the lore is more than 1 word it will only use the first word

kind hatch
#

Use the entire array instead of just the first element.

hazy parrot
#

Join args

#

Or use whole array if edit lore supports that

grim oak
#

is there a better way of doing it than this?

kind hatch
#

String.join(" ", args)

reef lagoon
#

Paper is better

kind hatch
#

Go to the paper discord then. lol

worn tundra
#

Paper is spigot

eternal oxide
#

nope

#

?fork

undone axleBOT
#

SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.

worn tundra
#

Paper is literally built on spigot

hazy parrot
#

google what fork means

worn tundra
#

I know what a fork is lol

hazy parrot
#

what is not clear then ?

fallen anvil
#

Paper has Location.getNearbyEntities but it looks like getNearbyEntities doesn't exist on Location in Spigot, what's the best way to get entities surrounding a central point?

worn tundra
#

Nothing, what?

hazy parrot
#

¯_(ツ)_/¯

fallen anvil
#

Can you explain that a little?

eternal oxide
#

or World#getNearByEntities

fallen anvil
#

I'm not familiar with #

agile anvil
#

It's Javadoc style, and way more sexier. Grab the instance of you world or entity, and entity.getNearbyEntities()

eternal oxide
#

its just an instance method

fallen anvil
#

Okay, let me look at the docs. This happens after an item frame is removed, so there's no entity to work off of. Lessee

agile anvil
#

Then work on the world

fallen anvil
#

yeah world takes a location arg

#

perfect ❤️

kind hatch
#

You could spawn in an armorstand temporarily if you don't want to use the world object, but either way, methods exist.

fallen anvil
#

Thank you

eternal oxide
#

is this in some event?

fallen anvil
#

Yeah, an event I'm trying to have implemented into Oraxen 😄

eternal oxide
#

which event? if its cancellable then teh ItemFrame will still exist. You can use that as the origin

fallen anvil
#

I think Oraxen might have problems with Spigot but I'm coding my add-on on Spigot in case Oraxen fixes their stuff.

#

It's cancellable, but based on how the OraxenFurniturePlaceEvent works it might delete the items first and then replace them if the action is cancelled

#

and I misspoke, I created OraxenFurniturePlace not OraxenFurnitureBreak, that already exists.

#

Interesting, Entity.getNearbyEntities returns a List<Entity> but World.getNearbyentities returns a Collection<Entity>

kind hatch
agile anvil
kind hatch
#

Trying to, but for now it's all "artificial" logic as I don't have large amounts of servers and players.

agile anvil
#

Well, loadbalancing inside a bungee is quite useless. Of course hypixel loadbalance lobbies for instance but that's only to allow players to see something because there are too much of them.
However, loadbalancing become essential when you start having too much players for one bungee: then you'll have to balance the incoming network in multiple bungee instance.
For that don't program your loadbalancer, but use one existing (to be clear, it's not a bungee that redirect to multiple bungee)

kind hatch
#

I don't see how it would be useless to load balance internally. Sure, externally, 100%, but internal balancing can help with individual server load. That's what I'm trying to target at least.

#

Also, what's the upper limit for bungee? I thought it could handle something like 2500+ connections pretty easily.

agile anvil
serene egret
#

how can i make a Playerhead itemstack with a customhead?

agile anvil
# kind hatch Also, what's the upper limit for bungee? I thought it could handle something lik...

It really depends on many many levels. The easiest to see is the modules and plugins usage, then there is the quantity of packets you send. What I mean is if your servers are vanilla there is no "extra packets" to send through, but when you start playing with particles, animations, quick updates, you're increasing as hell the number of packets. Each packet go through the bungee. So it can even become laggy as soon as 500 players for instance

agile anvil
serene egret
#

ok

kind hatch
# agile anvil What kind of server do you loadbalance ?

That's the thing. I don't know what types of server it would be balancing. I'm trying to make it dynamic/flexible enough to handle most cases, or hell, even make it configurable enough down to each individual grouping of servers.

kind hatch
opal juniper
ornate mantle
#

what do the DisplaySlot BELOW_NAME, PLAYER_LIST and SIDERBAR look like?

chrome beacon
#

Playerlist is a number after name (in tab)
Below name is a number below the name
Sidebar is scoreboard

gray merlin
#

I have some code that I want to reuse across all Minecraft versions, but I have no idea how to do it because it uses code existent in the spigot api. Is there a way to do this?

ornate mantle
#

ah aight

smoky oak
#

in which corner of a block is the block.getlocation location

#

north bottom west?

chrome beacon
#

0, 0

#

No decimals I believe

#

Which direction that is idk

smoky oak
#

should be what i said

#

hm

kind hatch
#

I don't think there is a direction tied to it. It's a coordinate based system, so it just returns the coordinates you are asking for.

smoky oak
#

fair

#

on a different note, is there a simpler way of turning a Collection<Entity> into an ArrayList<ItemStack> than looping through it?

kind hatch
#

Those are incompatible types no?

chrome beacon
#

They are

smoky oak
#

im getting them with a predicate

chrome beacon
#

So you'd have to get the ItemStack from the entity somehow

smoky oak
#

all entities are itemstack

kind hatch
#

That doesn't sound right.

chrome beacon
#

You mean the Item entity?

smoky oak
#

yes

chrome beacon
#

Not ItemStack

#

You can use a stream if you want

smoky oak
#

well droppeditem now ig

kind hatch
gray merlin
#

Nope, I mean having one utility class be reused across all mc versions of my project

smoky oak
#

copy paste

gray merlin
#

Yeah, no.

kind hatch
#

Well, that would depend on what your utility class contains. I feel like I said this earlier today, but I'll reiterate. If you are wanting to use code across multiple generations of an API, you should really abstract your codebase. Make a multi-module project and write version specific code. There is no guarantee that the API you are using will have the same methods available in the future, nor the current functionality of existing methods being the same.

gray merlin
#

Issue with that though, wouldn't that work for only 1.17+ projects?

#

Since java modules were only introduced in JDK9

#

Also for the non-version specific code; What spigot lib would that use?

#

I'm guessing just the latest

kind hatch
#

No, you can have multi-module projects in Java 1.8. It's not a java specific thing, but a project setup thing.
Also, yes, you would use the latest for everything else that isn't version specific.

smoky oak
#

org.bukkit.craftbukkit.v1_19_R1.entity.CraftItem cannot be cast to class org.bukkit.inventory.ItemStack
welp
how do i cast e instanceof Dropped_item to ItemStacck

gray merlin
#

CraftItemStack#asBukkitCopy

smoky oak
#

well the dumb part is

#

im doing this entirely in bukkit api code

#

so where does the nms come from

gray merlin
#

The server provides it to you I believe

smoky oak
#

ah

#

cast to ITEM, call getItemStack

gray merlin
sacred mountain
#

why does OfflinePlayer#getStatistic() require more than one parameter for the something_one_cm

kind hatch
gray merlin
serene egret
#

how can i add a armorstand a tag?

tall dragon
#

with pdc

serene egret
#

whats pdc

tall dragon
#

?pdc

kind hatch
reef lagoon
#

Bukkit's implementation of nbt ig

serene egret
#

thx

smoky oak
#

I set my logging level to all. a getlogger().fine(message) did not get printed to console

#

why

quiet ice
#

Because the logger is configured in a way that it does not log fine messages?

smoky oak
quiet ice
#

fine is kinda like SLJF4J's trace level - one of the lowest you can have

smoky oak
#

and a level ALL that can be used to enable logging of all messages.

gray merlin
#

Does anyone have any example of a spigot multi module project?

smoky oak
#

how is ALL a really low level

#

and why does the oracle doc say it logs everything then

quiet ice
#

What logger are you using?

#

SLF4J (doubt so), Apache or java.util.logging?

smoky oak
#

the standard one? (class extends JavaPlugin).getLogger()

#

should be java.util.logging considering it wants a java.util.logging.Level

quiet ice
#

?jd-s

undone axleBOT
quiet ice
#

Yeah, it's java.util.logging.Logger

smoky oak
#

so whyd it not log fine if the level was all

sacred mountain
#

Anyone know how to retrieve a player's mojang statistic?

tardy delta
#

mojang stats?

sacred mountain
#

OfflinePlayer#getStatistic() requires additional params, and does not take either EntityType or Material like specified

tardy delta
#

you mean Player#getStatistic?

sacred mountain
#

yteah

quiet ice
smoky oak
#

i set the log level to finest

#

it did NOT log the fine log

eternal oxide
#

You can set the logger level fine, you just have to make sure you are using the same logger you set.

smoky oak
#

the level stays though?

smoky oak
#

i set the level and later if i check the level it says the level i set

#
if(strings.length == 0){
  commandSender.sendMessage("Please specify a Logging level. Current level: "+instance.getLogger().getLevel());
  return true;
}
try{
  Level level = Level.parse(strings[0]);
  instance.getLogger().setLevel(level);
}
//catch and log test
sacred mountain
#

"Mojang changed it. Its best for plugins to not assert that the statistics are static. Any Minecraft update can change anything."
Does this mean i have to find another way of calculating my stat

#

or another way of getting the statistic

smoky oak
#

it says the level is whatever i set

#

then refuses to log anything below info

quiet ice
#

Or better said the log4j logger

smoky oak
#

so youre saying i have to use the log4j logger if i want my logging to work

tardy delta
#

i.e. additional parameters

sacred mountain
#

yeah but is there any way to even get it

#

reflection or sum

#

i dont know much about that

agile anvil
#

Why don't you use the Player#getStatistic method ?

#

Is there a problem with it?

tardy delta
drowsy helm
#

i love completable futures

tardy delta
#

same, only hate the overhead they have with f.e ::join

eternal oxide
#

and the annoying exception handling

tardy delta
#

mwoa i love that way of handling them

drowsy helm
#

lmao

eternal oxide
#

its a black hole

tardy delta
#

lets me think of the rust exception handling

quiet ice
#

Exception handling in concurrent environments is hard to do

ornate mantle
#

if i have a string like "ZOMBIE 10/20 ❤️" where 10 and 20 are green whereas the / is white and the name is some other goofy ahh colour, how do i get the 10 in the string? (10 and 20 are variables)

drowsy helm
#

use String.splt or something

ornate mantle
#

10 and 20 could be 69 and 4 morbillion

tardy delta
#

strip color first

drowsy helm
#

you should be storing the variables elsewhere anyway

tardy delta
#

^^

drowsy helm
#

trying to decode a string is just inefficient

ornate mantle
#

its for each and every mob

#

in the entire server

#

storing it is pointless

drowsy helm
#

get the health and max health then?

eternal oxide
#

put it on the mob itself

ornate mantle
#

its being stored as a mob's name

drowsy helm
#

use pdc or something

ornate mantle
#

tf is that

drowsy helm
#

its the same with checking inventory names for custom inventories

#

?pdc

eternal oxide
#

or health/max health/scale

drowsy helm
#

nbt wrapper

ornate mantle
#

oh that

#

im using 1.8 💀

#

no persistent data containers

eternal oxide
#

haha

drowsy helm
#

oh

#

lol

ornate mantle
#

i thought abt that aswell

#

plus i dont think mobs are persistent data holders

#

oh wait

drowsy helm
#

they are

ornate mantle
#

i could just do mob.gethealth 💀

sacred mountain
#

is that a problem? im not sure how i use that ss lma

ornate mantle
#

also another question do chatcolours become § when you print them as a string

ornate mantle
#

that solves my entire problem

drowsy helm
#

no stupid indentation now

sacred mountain
#

just use translatealternatecolorcodes

sacred mountain
tardy delta
#

bruh my rabbit escaped and had to catch it

drowsy helm
#

yeah so much nicer to read

drowsy helm
tardy delta
#

it ran back into its cage smh

sacred mountain
#

for instance

if (!something) return;
doSomethingElse();

instead of

if (something) {
  doSomethingElse();
  //more checks 
}```
drowsy helm
#

yeah early returns

tardy delta
#

i thought i saw my cat running but no

drowsy helm
#

are much nicer

sacred mountain
#

now will someone explain how i get statistics

tardy delta
#

bruh whats wrong with the Player#getStatistic

ornate mantle
#

thats literally how you get stats

sacred mountain
#

it just throws errors

tardy delta
#

that it expects another param?

sacred mountain
#

'needs more parameters' or 'does not accept this parameter'

#

how

eternal oxide
#

which statistic?

sacred mountain
#

its the walk_one_cm

#

it doesnt need an additional param

tardy delta
#

does it say what one? i forgot tbh

sacred mountain
#

ive tried every material and every entitytype as a parameter

#

none works

tardy delta
#

check impl i'd say but impl sucks

sacred mountain
#

all just say

tardy delta
#

what does it say when providing it with nothin?

eternal oxide
#

yes it should just be the stat enum

sacred mountain
agile anvil
#

Wait which version are you ?

sacred mountain
#

1.19.2

eternal oxide
#

OfflinePlayer#getStatistic(Statistic.WALK_ONE_CM)

tardy delta
sacred mountain
#

no clue what that is

eternal oxide
#

I'll test it

sacred mountain
#

i may have fixed it tho

#

lemme test build

tardy delta
#

whats the Statistic.WALK_ONE_CM.getType()?

eternal oxide
#

works just fine

#

System.out.println("Walk one: " + Bukkit.getOfflinePlayer("ElgarL").getStatistic(Statistic.WALK_ONE_CM));

sacred mountain
#

bro what

#

im redoing this class

tardy delta
#

what with Player#getStatistic?

#

instead of offline

sacred mountain
#

idfk what i did wrong then

tardy delta
#

extra params can only be of those types

quaint mantle
#

Put on database and get it?

tardy delta
#

?

ornate mantle
#

genuis

steel moat
#

Hello, can anyone help me with that one, i'm trying to make a command send all the players to another server before closing the server they are on (basically, replace the /stop) cause right now it's just disconnecting all of them without giving a warning, a message, or sending them to another server (the hub basically), so what i'm trying to do is that when an authorised user does "/stop" it broadcast a message, if they add a parameter like "/stop <arg1> <arg2>" (where the first one would be a message and the second one the timer (like 10s) it would say "server will close in 10 seconds" and then, tp them and send a message to them (all the tped players) saying "The server you were previously on has been closed, you have been moved to <name>"

drowsy helm
#
    public T await(AbsPacketManager packetManager, int timeoutSeconds){
        packetManager.sendCallbackPacket(this, timeoutSeconds);
        try {
            CompletableFuture<T> future = CompletableFuture.supplyAsync(() -> {
                while (response == null && !timeout){}
                return response;
            });
            return future.get();
        } catch (InterruptedException | ExecutionException e) {
            e.printStackTrace();
            return null;
        }
    }```
anyone know what i can do instead of this while loop? Just trying to wait until either is satisfied
#

compiler just removes it if i dont have a body

tardy delta
#

make it synchronized and use wait() and notify()?

drowsy helm
#

ah didnt even think of that lmao

tardy delta
#

is this in the context of spigot or whatever?

drowsy helm
#

yeah spigot but async