#development

1 messages · Page 19 of 1

merry knoll
#

otherwise people just come back with questions that can be solved with learning a basic concept

tight junco
#

but in that specific instance above, they were literally just told learn english and learn java

#

literally nothing else

lyric gyro
#

how to recode built plugin

dusky harness
#

wdym

#

build the plugin again to create an updated jar

lyric gyro
#

edit plugin

#

no

#

plugin is not create by me

dusty frost
dusky harness
# lyric gyro edit plugin

if the plugin is not open source, then you can't just edit the plugin code since it's already been converted to bytecode

dusky harness
#

well you can decompile it, but you will have to most likely change quite a bit of stuff

merry knoll
#

its a pain in the ass tho

tight junco
#

but they were given nothing else from there

#

which is my point

lyric gyro
#

I'm not gonna defend the dude above but you're extrapolating the situation as if it was every single case

icy shadow
#

^

merry knoll
#

this the hill you wanna die on?

icy shadow
#

generally people will give some sort of help

hoary scarab
#

I gave them the actual code xD

merry knoll
#

imho quite an appropriate response after the exchange, they are nowhere near the level to code it nor to copy it from someone

hoary scarab
#

Spoonfeeding is the better learning experience in my opinion because its up to them whether or not they learn from it.

lyric gyro
#

recode plugin

#

how to

merry knoll
merry knoll
#

pseudo code is the best way imho, as long as they understand the logic

hoary scarab
#

I still have people coming back to me asking the same questions after years lol

dusky harness
#

imo, if they are willing to accept that coding is not as simple to learn as 1 + 2 = 3, then it's fine to help them even if they aren't an expert on java
but if they know pretty much nothing about java and just want the code...

icy shadow
#

literally all of you are wrong

neat pierBOT
merry knoll
lyric gyro
lyric gyro
#

voluntary slavery

hoary scarab
icy shadow
#

its not slavery if it's voluntary

dusty frost
#

it really depends on the level

#

like, an example can help if you already know java and just need to figure out a good way to work with the spigot api

#

if you know literally nothing, you're just going to copy paste and have no idea what it's doing or hwo to modify it

merry knoll
#

i just dont understand the expectancy of being able to jump into it today and make something quite complex

#

^ such as editing another plugin

proud pebble
#

in a plugin that i was trying to modify to fix a lag issue before i became a dev, i thought that player.sendmesssage() was causing lag, now that i have some sort of understanding of whats taxing or not i now know it was another function that was causing the lag, its called a shit backpack prison plugin

#

it was a paid plugin too

stuck hearth
#

True

#

I was the prison

high edge
#

The site for hacktoberfest is sick

shell moon
#

Best way to check if player interacts with nether portal? (I mean like when it start receiving the nausea effect). Something like detecting when player "touches" a nether portal

high edge
#

checking the block they're standing on I guess?

stuck hearth
#

I imagine you stand on obsidian more than just for portals

uneven lanternBOT
dusky harness
#

oo

#

d;EntityEnterPortalEvent

uneven lanternBOT
#
public class EntityPortalEnterEvent
extends EntityEvent```
EntityPortalEnterEvent has 1 extensions, and  4 methods.
Description:

Called when an entity comes into contact with a portal

shell moon
dense drift
#

d;1.8.8 EntityEnterPortalEvent

uneven lanternBOT
#
public class EntityPortalEnterEvent
extends EntityEvent```
EntityPortalEnterEvent has 1 extensions, and  4 methods.
Description:

Called when an entity comes into contact with a portal

dense drift
#

@shell moon

shell moon
dark garnet
#

hi, im trying to remove all bossbars that end with a certain phrase (jugg), how can i do it?

#

Bukkit#getBossBars() doesnt include ones that were made using Bukkit#createBossBar, so i cant use that

stuck hearth
#

Is it from your plugin or a different one

lyric gyro
#

yes

dark garnet
robust flower
#

I guess just keep track of them into a map/multimap of some sort, and remove them when you don't need them anymore

dark garnet
#

ig ill just have to removeall players from the bossbar, but its annoying cause their temporary so i dont just want them sitting around not used, its alr tho

lyric gyro
#

Bossbar#bossbar

dark garnet
#

im not a huge fan of adventure

lyric gyro
#

its a pretty good api lmao, why not?

lyric gyro
#

I want code sharingan

#

In naruto

#

Help the code=)

#

I am lazy

stuck hearth
#

😦

proud pebble
#

yk what, get to fuck.

merry knoll
#

makes it a huge pain to do 1 jar setups for velocity + spigot at the same time

dusky harness
#

Or even python if you don't put that much effort

dusky harness
dusky harness
#

Unless u mean that velocity uses adventure

#

I haven't used velocity api before

merry knoll
#

yes velocity also has adventure

#

which normally wouldnt be an issue, but velocity api is completely different from bungee

dense drift
floral beacon
#

how can i get on which bungeecord proxy subserver the ProxiedPlayer is?

robust flower
dark garnet
tight junco
#

d;spigot BossBar#removePlayer

uneven lanternBOT
#
void removePlayer(@NotNull Player player)```
Description:

Removes the player from this boss bar causing it to be removed from their screen.

Parameters:

player - the player to remove

vestal talon
#

I found that armorstands being duplicated for some reason and I'm trying to find the way to prevent it

#

I create armorstands on loading the server and after few hours suddenly they being duplicated for no reason

#

maybe there's something to do with chunks load but i can't figure what exactly

merry knoll
#

you would need to show code

dusky harness
#

If you're checking if armoratands no longer exist, that's why

#

They "don't exist" when chunks unload

hazy nimbus
#

So I'm trying to send a login plugin message request packet via protocollib, however, I have a hard time setting the data
Here's the code:

            var container = new PacketContainer(PacketType.Login.Server.CUSTOM_PAYLOAD);
            
            container.getIntegers().write(0, 0); // Mesage ID
            container.getMinecraftKeys().write(0, channel); // Channel
            container.getByteArrays().write(0, new byte[0]); // Data

When I attempt to execute it, it fails when writing the byte array: com.comphenix.protocol.reflect.FieldAccessException: No field with type [B exists in class PacketLoginOutCustomPayload.

When I do some debugging, the field appears to be of the following type: PacketDataSerializer
How am I supposed to write the bytes?

dusky harness
# hazy nimbus So I'm trying to send a login plugin message request packet via protocollib, how...

Assuming this is latest version
https://github.com/dmulloy2/PacketWrapper/blob/master/PacketWrapper/src/main/java/com/comphenix/packetwrapper/WrapperPlayServerCustomPayload.java
They use ```java
public void setContentsBuffer(ByteBuf contents) {
if (MinecraftReflection.is(MinecraftReflection.getPacketDataSerializerClass(), contents)) {
handle.getModifier().withType(ByteBuf.class).write(0, contents);
} else {
Object serializer = MinecraftReflection.getPacketDataSerializer(contents);
handle.getModifier().withType(ByteBuf.class).write(0, serializer);
}
}

public void setContents(byte[] content) {
    setContentsBuffer(Unpooled.copiedBuffer(content));
}
hazy nimbus
#

dank

#

any idea on how would I use it in my case?

dusky harness
# hazy nimbus dank

So basically: ```java
public void setContents(byte[] content) {
ByteBuf contents = Unpooled.copiedBuffer(content);
Object serializer = MinecraftReflection.getPacketDataSerializer(contents);
container.getModifier().withType(ByteBuf.class).write(0, serializer);
}

#

also for the channel, it appears that it uses MinecraftKeys

hazy nimbus
#

gonna try, will need to add netty as a dependency first tho

dusky harness
#

o

#

is it not included?

hazy nimbus
dusky harness
#

what mc version btw

dusky harness
hazy nimbus
dusky harness
#

gradle/maven?

#

although

#

packetwrapper doesn't have netty

hazy nimbus
# dusky harness ohhh I misread

hahah, it was my first mistake (I tried to write it as a string), however I was able to figure out with debugger that it is a MinecraftKey

hazy nimbus
dusky harness
dusky harness
#

wait so if you try ```java
import io.netty.buffer.ByteBuf;

hazy nimbus
#

yes, however I do not have the packetwrapper thingy included in my dependencies

dusky harness
#

ye u dont need to

hazy nimbus
#

(didn't know it existed till now)

dusky harness
#

i mean you can look at how it works (basically an example for every packet)

#

you don't have to include all of it

hazy nimbus
#

I am using it

dusky harness
#

👍

dusky harness
#

interesting

hazy nimbus
#

Oh I see, so the packetwrapper is supposed to replace manual field setting?

dusky harness
hazy nimbus
#

Is there a maven repo including it?

dusky harness
#

You can use PacketWrapper as a dependency if you wish, although it is highly recommended that plugin authors simply copy and paste the classes they need into their project. This helps guard against future changes in PacketWrapper and makes it easier on the end user.
You can use jitpack

hazy nimbus
#

Understandable, copy pasting will be the better solution ig

dusky harness
#

didn't know that it wasn't recommended until now lol

#

just looked in readme for the dependency

#

@hazy nimbus gradle kts or groovy

#

or have you got the netty stuff figured out already

hazy nimbus
dusky harness
#

aww alr
still better than maven tho 😌

hazy nimbus
dusky harness
hazy nimbus
#

will io.netty:netty-buffer:4.1.82.Final do?

dusky harness
#

yes

dusky harness
hazy nimbus
#

Downloading...

hazy nimbus
dusky harness
#

👍 lmk if it works

hazy nimbus
#

Seems to be stuck at downloading maven-metadata.xml

#

ah nvm

#

it downloaded (finally)

#

@dusky harness So, the packet appears to have been sent successfully, however the proxy doesn't register it. Might be an issue in Velocity tho

dusky harness
#

wdym

#

like the proxy doesn't pass it along?

hazy nimbus
#

I use the login plugin message to communicate between proxy <-> backend server

hazy nimbus
#

at all

dusky harness
#

oh

#

wait what

#

are you sure?

hazy nimbus
#

Well the ServerLoginPluginMessageEvent does not fire

#

I will probably try to put pakkit in-between to verify whether the packet is actually sent

hazy nimbus
lilac sierra
#

https://imgur.com/a/QOAu3iH
I'm using Javascript PlaceholderAPI extension to make a shop in deluxemenus, but it goes to a negative number when i click many times on remove 64 or other, in my javascript file i set when is under 0 set to 1 but it doesn't work, can someone help me pls :))

hazy nimbus
#

@dusky harness I think I see where the issue is OMEGALUL

#

I send the custom payload packet for the play state

#

not for the login

#
    // Cannot find type for b
    // Cannot find type for b

oh no

#

Ok, so copypasting things from the play packet seems to have worked

merry knoll
#

does anyone know what parts of world generation (nms) is safe to do on another thread? i was hoping the objects that you can generate manually would be safe to do, but apparently they call other internals in their constructor

sterile hinge
#

what do you mean with "the objects that you can generate manually"? Also, are you referring to a custom world generator?

merry knoll
#

and no, not generator

#

internal ServerLevel object

#

aka net.minecraft world

#

for example, this should technically be safe to instantiate on another thread

#

then pass it with callback, but apparently not

sterile hinge
#

well creating a ServerLevel instance isn't really part of world generation. Not sure what exactly is the problem in your code snippet, but some things might access whatever internal registry

merry knoll
#

im just asking if anyone dabbled in this and already know what parts are thread safe

#

otherwise, i need to check the source on each so trying to cut some work

sterile hinge
#

I still don't understand your use case. Is it like a regular world or is it separate?

merry knoll
#

i mean use case doesnt matter for the question does it?

#

i implement custom file saving for instancing purposes

sterile hinge
#

it does, as it matters if e.g. the world will be ticked during generation and stuff like that

merry knoll
#

nah, i register it manually once i generate it

#

there are no default mechanisms involved

sterile hinge
#

okay that should work then. Running generation on a different thread should be fine, you probably need to suppress entity generation

#

and if you want to parallelize it, it gets a bit more tricky

merry knoll
#

yes i know, turns out they still call internals

#

so my question was if anyone dabbled in it before and already know which ones need to be called on main

sterile hinge
#

I mean I don't know what you're intending to call, there are a lot of methods

#

also depends on if you only want to use the default generator or if you want to support any custom generator etc

dark garnet
lyric gyro
#

each score entry is a line on its own

#

make it a new score entry

dark garnet
#

unless ur saying something else?

robust flower
#

What would be the equivalent type of Java's Map<String, String> in TS?

lyric gyro
#

Variable 'playerInv' might not have been initialized

#

how to fix

#

help

#

Variable 'playerInv' might not have been initialized

#

help me

vale panther
#

Can some admin help me on a channel issue? PM me

merry knoll
#

why not use multiple lines though

proud pebble
#

if you want a dynamic scoreboard, then using a prebuilt plugin to do so is probably not the best idea

#

since i know of no scoreboard plugin that allows for dynamically adding lines

lyric gyro
proud pebble
#

you can add more lines to a scoreboard by just doing \n? is that actually a thing?

lyric gyro
#

no, that is exactly what does not work

#

proposed solution is to use multiple score entries

#

given that each entry is its own line

#

effectively a working newline

merry knoll
#

and were asking how to do the placeholder to support it

lyric gyro
#

oh i see

#

yeah that stinks balls

stoic kayak
#

im trying to get a list of online players but the array is empty even when there are players on

    public void execute(CommandSender sender, String[] args) {
        Object[] playersOn = {};
        ProxyServer.getInstance().getPlayers().toArray(playersOn);
        for (Object players:playersOn) {
            sender.sendMessage( new TextComponent( "List:" + players.toString()) );

        }


    }
proud pebble
#

bungeecord, velocity, etc?

stoic kayak
proud pebble
#

also the for loop looks kinda pointless aswell since that would just make a new line of every player rather then a list of all players online

stoic kayak
dusky harness
sterile hinge
#

Also read the Javadocs of toArray if you want to know why it behaves like that

proud pebble
#

id say do something like sender.sendMessage(new TextComponent("Count: "+ProxyServer.getInstance().getPlayers().size()))

stoic kayak
#

ah okay

#

thanks

icy shadow
#

hey does anyone know

#

how do i put arrays in it :((

proud pebble
#

oh yeah you never actually redefine playerOn so it would always be 0 cus you never changed it

#

updated it, you get the point

#

cant believe i only just realized that

feral cedar
#
if (this.lastDeadPlayer != null) {
    final Player playerUUID = Bukkit.getPlayer(this.lastDeadPlayer);
    if (playerUUID != null) {
        Bukkit.broadcastMessage(ChatColor.AQUA + playerUUID.getName() + " was the last man standing!");
        Bukkit.getScheduler().scheduleSyncDelayedTask(instance, () -> playerUUID.giveExpLevels(1),  40L); //this is the line not running
    }
}

Anyone know why the commented line above would not be running? No errors appear in console

proud pebble
#

try not setting the player object as final

icy shadow
#

🤨

icy shadow
feral cedar
#

Players level is not increasing by 1 in game but the message above it saying who was the last man standing is running

dark garnet
dusky harness
#

is it a set number of lines

#

or does it change

#

if it's a set number just make a placeholder for each line

#

if not then technically you still can do it with TAB but its messy and wouldn't really work as a public plugin

proud pebble
half pollen
#

can 2 spigot plugins & bungeecord use the same custom messaging channel? for some reason only 1 server is receiving the data between the channel, even though the 2 servers are identical

#

nvm

dark garnet
dusky harness
#

oh I didn't see that part

dark garnet
#

so anyone got a solution?

merry knoll
#

make your own scoreboard impl

dusky harness
#

or use a scoreboard library

#

if one exists

merry knoll
#

scoreboards are simple enough honestly

dark garnet
dark garnet
merry knoll
#

cant you just edit the list?

#

on here

#

worst case, you can just resend the scoreboard

#

on line count change

dark garnet
dark garnet
cinder forum
#

hi

thin storm
grim oasis
#

usually I just get the config and .set it (to a list/map/whatever), never using createSection

#

you're making a section, then setting the value TNTLocations to be the location

#

it isn't making 2 sections

#

the value of TNTLocations is all that location information

#

You most likely want to take it apart and store the information you want/need (x/y/z/world)

thin storm
#

ah, that makes sense thank you. When you store them like that, how would you go about accessing them then?

grim oasis
#
        minerConf.set("miners", new HashMap<>());
        for (Entry<String, AutoMiner> e : autoMiners.entrySet()) {
            String s = "miners." + e.getKey() + ".";
            AutoMiner a = e.getValue();
            Location loc = a.getLoc();
            minerConf.set(s + "world", loc.getWorld().getName());
            minerConf.set(s + "x", loc.getX());
            minerConf.set(s + "y", loc.getY());
            minerConf.set(s + "z", loc.getZ());
            minerConf.set(s + "yaw", loc.getYaw());
            minerConf.set(s + "pitch", loc.getPitch());
            minerConf.set(s + "region", a.getRegion());
            if (a.getSign() != null) {
                s = s + "sign.";
                loc = a.getSign();
                minerConf.set(s + "world", loc.getWorld().getName());
                minerConf.set(s + "x", loc.getX());
                minerConf.set(s + "y", loc.getY());
                minerConf.set(s + "z", loc.getZ());
                minerConf.set(s + "yaw", loc.getYaw());
                minerConf.set(s + "pitch", loc.getPitch());
            } else {
                minerConf.set(s + "sign", new HashMap<>());
            }
        }
        Utils.save(minerConf, "miners.yml");
#

saving data this

#

retrieving data

        if (minerConf.getConfigurationSection("miners").getKeys(false) != null
                || !minerConf.getConfigurationSection("miners").getKeys(false).isEmpty()) {
            for (String s : minerConf.getConfigurationSection("miners").getKeys(false)) {
                ConfigurationSection t = minerConf.getConfigurationSection("miners." + s);
                Location loc = new Location(Bukkit.getWorld(t.getString("world")), t.getDouble("x"), t.getDouble("y"),
                        t.getDouble("z"), (float) t.getDouble("yaw"), (float) t.getDouble("pitch"));
                String reg = t.getString("region");
                AutoMiner a = null;
                if (!t.getConfigurationSection("sign").getKeys(false).isEmpty()) {
                    t = t.getConfigurationSection("sign");
                    Location sign = new Location(Bukkit.getWorld(t.getString("world")), t.getDouble("x"),
                            t.getDouble("y"), t.getDouble("z"), (float) t.getDouble("yaw"),
                            (float) t.getDouble("pitch"));
                    a = new AutoMiner(s, reg, loc, sign);
                } else {
                    a = new AutoMiner(s, reg, loc);
                }
                miners.put(s, a);
            }
        }
#

it's a mess

#

ngl

#

older code, but it does the job

thin storm
#

this is really helpful, now that I have an example to work off of

#

thank you

stuck canopy
#

        try {
            String sql = "INSERT INTO Profiles(world, name, type, members, ex_members, ignored_players, island_size, minion_slots, guests_limit, coop_slots, coins_allowance, ender_chest_pages, accessory_bag, sack_of_sacks, magic_find, bazaar_flipper) VALUES ('?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?');";
            PreparedStatement stmt = connection.prepareStatement(sql);
            stmt.setString(1, profile.getWorld()); // Set the first "?" to "Something"
            stmt.setString(2, profile.getName());
            stmt.setString(3, profile.getType().toString());
            stmt.setString(4, profile.getMembers().toString());
            stmt.setString(5, profile.getEx_members().toString());
            stmt.setString(6, profile.getIgnored_players().toString());
            stmt.setInt(7, profile.getIsland_size());
            stmt.setInt(8, profile.getMinion_slots());
            stmt.setInt(9, profile.getGuests_limit());
            stmt.setInt(10, profile.getCoop_slots());
            stmt.setInt(11, profile.getCoins_allowance());
            stmt.setInt(12, profile.getEnder_chest_pages());
            stmt.setInt(13, profile.getAccessory_bag());
            stmt.setInt(14, profile.getSack_of_sacks());
            stmt.setInt(15, profile.getMagic_find());
            stmt.setInt(16, profile.getBazaar_flipper());
            stmt.executeUpdate();
        }catch (SQLException e) {
            e.printStackTrace();
        }
    }```
#

what am I doing wrong here

dense drift
#

remove the ' ' from around the ?s

lone saddle
stuck canopy
proud pebble
#

looks like its the island profile

stuck canopy
#

it is

cyan vine
#

AHHHHH

neat pierBOT
sly estuary
stray kernel
#

yo it seems as if the autosellevent doesnt trigger when using 1.18..... idk if im tripping or something lol. added debug messages and everything but doesnt seems to work...tried same method on a 1.16.5 server and it works so idk

merry knoll
#

what is autosell event even

#

added by a plugin?

broken elbow
#

yeah. by autosell

neat pierBOT
#
FAQ Answer:

Spigot Account Linking
To get support for a premium plugin owned by Clip or Glare you will need to verify your spigot account using /spigot in the #bot-commands channel. After you have successfully linked your spigot account you should ask your question in the coresponding channel for that plugin. If you have already linked your account and want to update your roles, run this command /spigot check.

broken elbow
#

@stray kernel this

hazy summit
#

Hey,
Is it possible to access a file in the plugins "internal" resources folder?
I just want to have a second config to declare some stuff, but without creating it in the plugin's folder

stray kernel
#

@broken elbow so i cant get support if i didnt buy it?

broken elbow
neat pierBOT
#
FAQ Answer:

Not the owner of the server?
If you're not the owner of the server and you're the one requesting the support you'll need to first get the owner who purchased the plugin to join and run through the verification system listed in #spigot-linking, once linked they just need to give us the thumbs up that you're with them.

broken elbow
#

you can read more here this

stray kernel
#

o ffs they sleeping 😭 ... alright guess ill wait

sly estuary
merry knoll
#

the class thats missing def exists, but chances are you didnt obf it back

sly estuary
#

Do you mean this one? <remappedClassifierName>remapped-obf</remappedClassifierName>

keen root
#

Hi, how can i add a number to an item (maybe a nbt tag) ? After that a want to read it and edit it...

merry knoll
#

been a while since i touched maven alltogether

#

honestly

sly estuary
#

So the problem is to reobf the project, right?

merry knoll
#

im willing to bet thats what it is

sly estuary
#

Alright thank you, then I'm going to dive into it

merry knoll
#

lemme check real quick

#

yeah thats what your issue is

#

it maps to EntityHuman

keen root
#

Hi, how can i add a number to an item (maybe a nbt tag) ? After that a want to read it and edit it...

viral moth
viral moth
#
        ItemMeta meta = item.getItemMeta();
        meta.getPersistentDataContainer().set(new NamespacedKey(pluginInstance, "number"), PersistentDataType.INTEGER, intValue);
        item.setItemMeta(meta);```
#

on the PDC you can then use the .get(namespacedKey, dataType) method

#

when setting data, make sure to set the item meta back on the item stack

#

hopefully that explains it

keen root
#

Ok thanks I'll try it

keen root
keen root
#

Thanks

next hare
#

With what program can I encrypt a plugin, I have its source code

dense drift
#

you mean build? Turn the code into a .jar file

next hare
#

I have the source code, but I want to add some things and fix its duration system

viral moth
#

are you trying to turn the source code into a plugin?

next hare
#

yes, but by step add some functions

#

to complement

dense drift
next hare
#

So I'm fine, but when I select the plugin folder and then convert it to .jar it doesn't convert as it should

merry knoll
#

what do you mean "convert"

#

you gotta compile it

#
open class ConcurrentSingleLazyMap<K : Any, V: Any>(
  private val lazy : suspend (K) -> V?,
  private val valueCache: ConcurrentHashMap<K, V> = ConcurrentHashMap()
) : Map<K,V> by valueCache {
    fun invalidate(key: K) = valueCache.remove(key)

    suspend fun getOrFetch(key: K): V? = valueCache[key].let { lazy.invoke(key)?.let { valueCache[key] = it; valueCache[key]} }
}
#

is there a better way to make a lazy map with one generating function?

#

holy damn it doesnt even fit one line formatted a bit

proud pebble
broken elbow
#

well. you don't have to

proud pebble
#

id say compile using whatever compiler the plugin source uses as its usually easier then switching

broken elbow
#

buttt

proud pebble
#

its probably better to start people on that then exporting and having the plugin be plugin jar + plugin code size

#

that was not fun

sly estuary
merry knoll
lyric gyro
#

I'm following a CodedRed tutorial to figure out how to do TAB stuff (https://youtu.be/WYXVypbVVOs?t=472) but when I try and put in PacketPlayOutPlayerListHeaderFooter it just goes red without saying anything

I'm trying to do

PacketPlayOutPlayerListHeaderFooter = new PacketPlayOutPlayerListHeaderFooter();
grim oasis
#

forgot the variable name

#

packet

lyric gyro
#

I mean sorry yea I'm trying to do ```js
PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter();

grim oasis
#

doesn't auto-import? says it doesn't exist?

lyric gyro
#

Yea

grim oasis
#

how do you have your sources setup

#

I think codedred uses direct jar files no maven/gradle/anything

lyric gyro
#

Ah

#

Yea im using Maven

grim oasis
#

Might be happening because I think that's NMS, spigot-api doesn't include nms

lyric gyro
#

Damn

#

Alright well thanks :)

#

I'll find another way

grim oasis
#

ya i just have no idea how to import from spigot not spigot-api

#

otherwise I could help ye with that

spark totem
#

Anyone know why my plugins are not working

#

I do have a plugin folder with all plugins inside

high edge
#

Did it generate the plugins folder itself?

spark totem
#

No

high edge
#

delete everything, and start the server with just the server jar itself

#

So it generates everything needed

spark totem
#

Alr

#

I mean it loaded everything

#

Except plugin folder

cinder forum
#

vanilla doesnt support plugins, Bukkit and its forks do (Spigot, Paper, Purpur (use Paper/Purpur))

spark totem
#

What

#

Im using server.jar

cinder forum
#

by Mojang

#

Vanilla doesnt support any external modification except datapacks

spark totem
#

òoh

#

how do i get tthe normale one?

#

u got a link for that?

cinder forum
#

use Paper/Purpur, just google it

#

if you r new to this you can just use paper, you wouldnt benefit from purpur ig

merry knoll
#

i am guessing its here, kinda hard to debug due to coroutines

#
java.lang.IllegalArgumentException: Callable expects 2 arguments, but 1 were provided.
    at kotlin.reflect.jvm.internal.calls.Caller$DefaultImpls.checkArguments(Caller.kt:20) ~[orbital-demo-1.0.0.jar:?]
    at kotlin.reflect.jvm.internal.calls.CallerImpl.checkArguments(CallerImpl.kt:15) ~[orbital-demo-1.0.0.jar:?]
    at kotlin.reflect.jvm.internal.calls.CallerImpl$Method$Instance.call(CallerImpl.kt:112) ~[orbital-demo-1.0.0.jar:?]
    at kotlin.reflect.jvm.internal.KCallableImpl.call(KCallableImpl.kt:108) ~[orbital-demo-1.0.0.jar:?]
    at dev.peopo.orbitaldemo.sql.SQLKt$fetchBalance$$inlined$fetch$1.invokeSuspend(Table.kt:114) ~[orbital-demo-1.0.0.jar:?]
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) ~[orbital-demo-1.0.0.jar:?]
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) ~[orbital-demo-1.0.0.jar:?]
    at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42) ~[orbital-demo-1.0.0.jar:?]
    at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95) ~[orbital-demo-1.0.0.jar:?]
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) ~[orbital-demo-1.0.0.jar:?]
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) ~[orbital-demo-1.0.0.jar:?]
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) ~[orbital-demo-1.0.0.jar:?]
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664) ~[orbital-demo-1.0.0.jar:?]
#

is it some weird interaction with function overloading and inline functions?
turns out its just me missing to add a variable to a reflection part

merry knoll
#

apparently property setters on kotlin reflect take varargs, instead of instance - value pair so it compiles fine with 1 value Facepalm

proud pebble
#

you also need to run buildtools and create a jar of the version your wanting to make for

#

so for example, if you wanna use 1.19.2, then in buildtools you would generate a spigot jar of that version

#

the reason you have to do this is that when making the jar with buildtools, it creates some files in the .m2 folder on your pc, which intellij can use to compile your plugin from

#

you dont need the output jar thats made in your buildtools folder

#

basically,
download buildtools from https://hub.spigotmc.org/jenkins/job/BuildTools/
create a folder for buildtools,
create a bat file that contains java -jar BuildTools.jar --rev yourversionhere (change yourversionhere to a version like 1.19.2)
run that bat file and itll generate a spigot jar file,
then in your project, open pom.xml, scrolldown and in your dependencies change artifactId from spigot-api to spigot

then you should beable to use craftbukkit and nms classes.

broken elbow
#

You know that spigot has a wiki page for all of this right? 🤣

hoary scarab
#

You need to add --remapped if you want the unobfuscated class/method names

hoary scarab
#

Is there a method to check the playerinventory size without the slots for equipment? (I know I can just use int size = 36;) Just curious.

lyric gyro
#

storageContents does not include offhand and armour slots

#

so uh I guess you could fetch the size from that

proud pebble
#

yep, player.getinventory.getStorageContents().length

lyric gyro
#

storage*contents

#

contents returns everything iirc

proud pebble
#

actually, might be length

hoary scarab
#

Ah ok thanks. Was just curious.

dusky harness
#

how do I convert a direction -> (normalized) Vector?

#

to be used in World#rayTraceBlocks

#

or basically my main goal is that I have 2 points, let's say point A and point B
point A spots point B and modifies its direction by a couple degrees and then runs rayTraceBlocks to see if it hit point B

lyric gyro
#

"direction" being?

dusky harness
#

so point A looks at point B - that direction

lyric gyro
#

bVector.subtract(aVector)

dusky harness
#

but then I also have to modify it a little bit

#

so that it doesn't always look directly at point B

dusky harness
lyric gyro
#

.add(rng.nextDouble())

dusky harness
#

wait what will that work?

#

after I normalize it

lyric gyro
#

i mean idk the exact methods but yeah

#

beware of bukkit's mutable vectors ClearLa

dusky harness
#

💀 yea I wonder why vectors and locations are mutable

#

those should be immutable, I think

dusky harness
lyric gyro
#

i would normalise after performing all the operations that reorient the vector tho

dusky harness
#
val a = Vector(5, 5, 5)
val b = Vector(10, 5, 5)
val subtracted = b.subtract(a)
val added = subtracted.add(Vector(90, 90, 90)) // only add(Vector) exists
println(added.normalize())
```you mean like this?
#

since that prints out ~0.6, ~0.56, ~0.56

lyric gyro
#

the subtraction results in the vector from a to b

#

I believe bukkit Vector has specific methods to apply rotation on x/y/z axis, i'm not sure

#

also 90 is a lot lol

dusky harness
#

oh

#

oh yea

#

I just did 90 to test

#

so there's ```kt
val a = Vector(5, 5, 5)
val b = Vector(10, 5, 5)
val subtracted = b.subtract(a)
val added = subtracted.rotateAroundY(90.0)
println(added.normalize())

lyric gyro
#

you sure it's in degrees?

dusky harness
#

oh-

#

forgot

#

whoops

#

seems like it works!!

#
6.123233995736766E-17,0.0,-1.0
lyric gyro
#

neat

dusky harness
#

Thanks emily

dark garnet
#
public LaserTeam getWinner() {
    LaserTeam winner = null;
    for (final String teamId : ControlManager.teams) {
        final LaserTeam team = getTeam(teamId);
        if (winner == null || team.score > winner.score) winner = team;
    }
    return winner;
}```im sleep deprived and i need to check if all teams have the same score and if they do then return `null` (tie), and if they dont, calculate highest scoring team (and return it)
*ping me if u reply, im going to bed 💤*
dusky harness
#

👍

#

that should work

#

good job

dark garnet
#

cause when it loops thru the first team it sets winner to that team, so the method wont return null

#

the only possibility of the method ever returning null is if ControlManager.teams is empty

dusky harness
#

ohh I didn't see the tie part

dark garnet
#

😭

viral moth
viral moth
#

so if you have 3 teams with the scores of 10, 10, 4, do you return null or...

#

the first thing that came to my head was the saying "throw a hashmap at it." the more i think about it, the more i feel like that would simplify things. just an idea

dark garnet
dusky harness
#

ok i'm back

#

lets see

#
public LaserTeam getWinner() {
    LaserTeam winner = null;
    int highestInvalid = Integer.MIN_VALUE;
    for (final String teamId : ControlManager.teams) {
        final LaserTeam team = getTeam(teamId);
        if (winner == null || team.score > winner.score) {
            winner = team;
            continue;
        }
        if (team.score == winner.score) {
            highestInvalid = team.score;
        }
    }
    return highestInvalid == winner.score ? null : winner;
}
```this should work
viral moth
#

hear me out, put all of the data into a TreeMap<Integer, List<LaserTeam>> and then you can check the highest scoring team(s) and see if the size of the list is bigger than 1. if it is, then you return null, if there is only one team in the list of teams with the highest score, then you know that there is no team that scored higher than that. if the highest scoring team list has more than one team, then you know that multiple teams tied.

#

actually, my solution is over complicating it

#

ignore me

dark garnet
iron karma
#

why i get this error on AsyncPlayerChatEvent?

#
format: '%vault_rank% &8| &7{player}: &f{message}'```
this is the format i set
broken elbow
iron karma
#
@EventHandler
    public void onAsyncPlayerChat(AsyncPlayerChatEvent event) {
        String format = plugin.getSettings().getString("default.format")
                .replace("{player}", "%s")
                .replace("{message}", "%s");
        format = PlaceholderAPI.setPlaceholders(event.getPlayer(), format);
        event.setFormat(translate(format));

    }```
this is the code
iron karma
#

and what i need to do?

broken elbow
#

make sure it is replaced. Or don't use percent signs in your format at all.

rose jolt
merry knoll
rose jolt
merry knoll
#

what is that supposed to mean even

rose jolt
#

wait

merry knoll
#

you have placeholders and they dont work when used by other plugins?

#

is what i understood

rose jolt
#

wait i show video

#

@merry knoll i can send youtube link?

merry knoll
#

sure

rose jolt
#

wait

#

now you can watch

#

placeholderapi works in my plugin, but not in others when it is mine

merry knoll
#

you need the expansions downloaded

#

each placeholder comes from an expansion

#

find which ones you need

#

and download them

rose jolt
merry knoll
#

thats for your tab plugin to fix

#

you can test it using

#

/papi parse

#

if they show up there then its set up properly

rose jolt
rose jolt
merry knoll
#

/papi parse <player|me> <string>

#

commands are listed here

rose jolt
merry knoll
#

then its for those plugins to fix

#

contact their devs and see what the issue is

rose jolt
#

would you like to test it yourself? I'll give you these two plugins and you can see for yourself what happens

rose jolt
rose jolt
merry knoll
#

can you show the code?

#

where you use the placeholder api specifically

rose jolt
#

wait

#

                ItemStack gracz = new ItemStack(Material.PLAYER_HEAD);
                SkullMeta gr = (SkullMeta) gracz.getItemMeta();

                gr.setOwner(all.getPlayer().getName());

                gr.setDisplayName(PlaceholderAPI.setPlaceholders(all, plugin.getConfig().getString("head-name-prefix") + all.getDisplayName() + plugin.getConfig().getString("head-name-sufix")));
                ArrayList<String> lore = new ArrayList<>();
                for (String msg : plugin.getConfig().getStringList("description")) {
                    lore.add(PlaceholderAPI.setPlaceholders(all, msg.replace("<tp>", plugin.getConfig().getString("tp"))));
                }
                gr.setLore(lore);
                gracz.setItemMeta(gr);
description:
    - "§bPing:§6 %player_ping%"
    - "§bGame time: §a%statistic_minutes_played%"
    - "§bGamemode: §a%player_gamemode%"
    - "§bMinecraft version: §a%viaversion_player_protocol_version%"
    - "§bRegion owner: §6%worldguard_region_owner%"
    - "%discordsrv_user_name%"
    - ""
    - ""
    - ""
    - "§b*Right click to get Player head"
    - "§b*Click to teleport*"
    - "<tp>"
#

for example

#

and here it works but in other plugins when mine is on the server it does not work, when I remove my plugin everything works normally

merry knoll
#

what is "all" here?

rose jolt
#
 for (Player all : Bukkit.getOnlinePlayers()) {

                int ping = all.getPing();

                for (Integer it : plugin.getConfig().getIntegerList("GRAY_STAINED_GLASS_PANE")) {
                    ItemStack empty = new ItemStack(Material.GRAY_STAINED_GLASS_PANE);
                    ItemMeta s = empty.getItemMeta();
                    s.setDisplayName(ChatColor.BLACK + " ");
                    empty.setItemMeta(s);

                    inv.setItem(it, empty);
                }

                ItemStack gracz = new ItemStack(Material.PLAYER_HEAD);
                SkullMeta gr = (SkullMeta) gracz.getItemMeta();

#
                gr.setOwner(all.getPlayer().getName());

                gr.setDisplayName(PlaceholderAPI.setPlaceholders(all, plugin.getConfig().getString("head-name-prefix") + all.getDisplayName() + plugin.getConfig().getString("head-name-sufix")));
                ArrayList<String> lore = new ArrayList<>();
                for (String msg : plugin.getConfig().getStringList("description")) {
                    lore.add(PlaceholderAPI.setPlaceholders(all, msg.replace("<tp>", plugin.getConfig().getString("tp"))));
                }
                gr.setLore(lore);
                gracz.setItemMeta(gr);

another code


#
another code
#

but this code working

#

my plugin works, but if it is different, it doesn't display placeholders

#

if the server has my plugin, the placeholders only work in my plugin in none of the others,
how to fix it?

rose jolt
rose jolt
rose jolt
pulsar ferry
grim oasis
#

@pulsar ferry he's coding it

marble nimbus
#

Okay I think I am slowly loosing my mind, but: is there a way to make an npc with skin, thst is able to walk to certain locations. Like actual walking not just teleportint

#

(without lib disguise, just protocol lib and nms)

merry knoll
#

teleport and move packets are different

#

@marble nimbus

marble nimbus
#

So the position packet is an equivalent to the walk packet?

merry knoll
#

effectively

marble nimbus
#

Will that also actually display the animation?

merry knoll
#

you need to send it every tick

marble nimbus
merry knoll
#

yes

#

its for updating position

#

thats the exact packet the server sends

#

when a player moves

marble nimbus
#

How big does the change in xyz have to be? Is it enough to call it every tick with 1+ block?

merry knoll
#

1+ block is huge

#

you need to calculate yourself though, got no idea honestly

marble nimbus
#

Ok got it, thanks alot!!

#

That really helps

tranquil terrace
#

can i get help with the bluetooth audio that drops in terms of quality when i open discord?

lyric gyro
#

this is not discord support

#

?not-discord

neat pierBOT
#
FAQ Answer:

Looking for discord support?
HelpChat is a Minecraft plugin and development support server and is not affiliated with discord in any way.
If you require support from discord, we recommend you to visit their official support website at https://support.discord.com
On this website, you can read their FAQs, or open a support ticket if necessary.

tranquil terrace
#

oh shi i searched on internet chat live discord lol

#

mb

lyric gyro
#

👍

marble nimbus
#

the NMS EntityPlayer does not have a Pathfinder / Navigation right?

proud pebble
#

maybe EntityHuman might

#

atleast ithink its entityhuman

#

but then again probably not

#

ive heard you need to send movement packets and stuff to the humanentity to get it to move

#

either to or from the entity

#

one or the other

broken elbow
#

GSON question:

I have some stuff stored as json and I'm using GSON to deserialize using the GSON#fromJson(String, Class). I have added a new property to the object this json gets deserialized into and I want to be able to still deserialize the json without having to write my own deserializer.

The new property is a simple boolean and has a default value. Should I be able to just set the default value in the class and Gson will just know that? I don't have the enviroment to test this.

Thanks.

whole yacht
#

How to show player name in Deluxe menu gui

tight junco
left wigeon
#

hey, i am trying to learn how to code plugins in java right now, and i have encountered this warning, 'org.bukkit.event.player.PlayerPickupItemEvent' is deprecatedi am really new at this so any help will be appreciated!
here is my code: ``` @EventHandler
public void OnItemPickup(PlayerPickupItemEvent event) {

    Player player = event.getPlayer();
    ItemStack type = event.getItem().getItemStack();
    player.sendMessage("Hey you have pick up a " + type);
    }```if you need the full code ask me
high edge
#

Means the event is marked for removal/replacement, if you Ctrl + Click on it, it usually has a comment attached to let you know what it's being replaced with

left wigeon
neat pierBOT
left wigeon
high edge
#

What version you using?

left wigeon
#

Also, it does not work in-game. could you tell me whats wrong with it?

high edge
#

Did you register the listener?

left wigeon
#

i have this method in the same class and it works fine: @EventHandler public void onBlockDestroy(BlockBreakEvent event) { Material type = event.getBlock().getType(); Player player = event.getPlayer(); player.sendMessage("Hey you have breaked a " + type); } but the PlayerPickupItemEvent isn't

high edge
#

Which version are you on

left wigeon
#

of intellij? latest i think i downloaded it the day before yesterday

high edge
#

spigot/paper

left wigeon
#

in minecraft 1.19.2

#

paper

high edge
#

Ah okay yea so the event is deprecated, and it was replaced with EntityPickupItemEvent

left wigeon
#

what can i do about it?

high edge
#

Switch over to the new event

left wigeon
#

first I didn't knew about the PlayerPickupEvent so i used the entity one and i checked if the entity type is an instanceof Player

#

but i couldn't get the player

#

ill try it again and see what happend

high edge
#

If you checked the entity type, then that's why it didn't work, just check if the entity is an instanceof player

#

Since a player is an entity

left wigeon
#

oh ill try tysm!

#

ok, i fixed it (i think, i haven't tested it yet) but if i can ask you something, could you tell me what the (Player) means in this line: Player player = (Player) event.getEntity();?

sterile hinge
#

it's a cast

left wigeon
#

what does that mean?

tight junco
#

The entity variable is "casted" to a player

#

it basically turns the entity into a player

sterile hinge
#

it changes the static type of an expression, in that case event.getEntity() has the static type Entity, but with the cast, it becomes the static type Player

left wigeon
#

oh alright, will i get an error when i cast a cow for example to a player

tight junco
#

because a player is not a cow

#

yes

sterile hinge
#

that only works if the dynamic type of the returned value actually is Player (or a subtype)

left wigeon
#

do you guys have tutorials that I should watch?

tight junco
#

no

#

most if not all spigot tutorials suck

left wigeon
tight junco
#

yes

#

i just came up with ideas on plugins and try shit until it works

#

but the key to doing that is also paying attention to how experienced developers work

broken elbow
#

Anyone still using ConfigMe? How the hell do I create a list property that holds integers? Seems like they only support string collections.

broken elbow
queen plank
#

Is it possible to get the outer class object from a non-static inner class without passing it in as a parameter?

lyric gyro
#

how to make gems like mmoitem?

lyric gyro
#

help

queen plank
#

What do you mean "How to make gems like mmoitem"? What do you need help with, we won't give you a big chunk of code that just works

lyric gyro
#

gems socket

#

like this

#

That gem dragged into the item will increase the feature for that item

queen plank
#

Do you even have a system with items and stats to increase?

lyric gyro
#

yeah

queen plank
#

Then whenever an item is applied to the item, save it in a list or smth and when you get the stats check if the item is in the list

lyric gyro
#

Once the gem is pulled in, it will count the levels one by one, from 1 to 50 (50 is the maximum)

queen plank
#

Yeah?

lyric gyro
#

👍

#

and give stat

queen plank
#

Sure

lyric gyro
#

and have a command

#

ex: /gems give <Player> <type>

#

but I don't know how to code like this, can you give me a sample code?

#

@queen plank if you can help me, dms with me

queen plank
#

Don't know how to code what? Commands? File Saving?

hoary scarab
#

So InventoryClickEvent.setCursor(ItemStack) is deprecated but the javadocs don't mention a replacement.
When I cancel InventoryClickEvent the item the cursor is holding is removed. Any counters to this?

high edge
#

Probably get it's initial position and set it back?

#

tbh the inventory stuff is kinda wack

hoary scarab
high edge
#

Yea I mean the items previous position

hoary scarab
#

See how I'm holding water in the cursor? When I click and cancel the InventoryClickEvent it changes the cursor item to the item I clicked.

high edge
#

And what is the behavior you're looking for?

#

(Slightly confused as to what you're trying to do)

hoary scarab
#

Great now WindowsKey + Shift + S isn't screenshotting xD

#

Fuck it. Just imagine the above image the water bucket turns to stone

high edge
#

Still confused as to what the issue is here

hoary scarab
high edge
#

And what's the goal you wish to achieve? For the water to stay or

hoary scarab
#

Yes, if the InventoryClickEvent is canceled why is the cursor changing its item?

#

And InventoryClickEvent.setCursor(ItemStack) is deprecated so looking for another similar method.

high edge
#

That's been deprecated for a long time, still works tho

#

I believe it's not actually deprecated, but marked as deprecated as a warning

tight junco
#

thats like almost all spigot methods

hoary scarab
#

Its annoying coding with latest methods/api's and java version and having to use a method thats deprecated for no reason lol

high edge
#

Deprecated.
This changes the ItemStack in their hand before any calculations are applied to the Inventory, which has a tendency to create inconsistencies between the Player and the server, and to make unexpected changes in the behavior of the clicked Inventory.

#

Yea it's just a warning

hoary scarab
#

Yeah. And its still a bug on spigots part anyways to change the cursor when the event was cancelled.

high edge
#

Probably just worth resetting it after every click I guess

#

One of those janky things

hoary scarab
#

yeah doing that.

high edge
#

Probably looks horrendous tho right?

hoary scarab
#

Well its 2 extra lines of code lol
@SuppressWarnings("deprecation") and event.setCursor(cursor);

high edge
#

Not what I meant :3, I mean it probably changes to stone, then changes back to water right?

#

Or does it not do that

hoary scarab
#

Doesn't even do that. Might have to delay which means more useless code xD

merry knoll
#

not sure if someone answered on phone atm

hoary scarab
#

Yeah its seeming like you can't change the item in the cursor.... (Atleast in InventoryClickEvent)

merry knoll
hoary scarab
#

InventoryClickEvent

merry knoll
#

yes but you need to cancel both

hoary scarab
#

For a single click?

merry knoll
#

yes

hoary scarab
#

I'll test that one sec

hoary scarab
#

InventoryDragEvent isn't called.

#

Actually... what does call InventoryDragEvent?

lyric gyro
#

dragging items across the inventory

#

into multiple slots

hoary scarab
#

yeah even thats not giving me an output...

#

Looks like it only runs in survival

#

Oh look at that! InventoryClickEvent being cancelled works properly in survival but not creative

lyric gyro
#

creative mode makes a lot of client sided assumptions about inventory interactions that simply do not query the server

hoary scarab
#

Yeah attempting to make use of InventoryCreativeEvent

#

Seeing if that will give me the outcome I want

warm flame
#

I think with what you're doing you just need to listen to InventoryClickEvent and make sure the action is SWAP_WITH_CURSOR

lyric gyro
#

Many things in creative mode simply do not send packets to the server

#

It's a road full of potholes

warm flame
#

yea def when testing anything inventory related it's best to be in survival lol

#

creative is super wonky

hoary scarab
merry knoll
#

i just read the later parts of the convo

lyric gyro
#

Me too pepebla

warm flame
#

moral of the story don't test in creative 🙏

hoary scarab
#

Aside from the fact that no one in survival would be using the methods I'm making... it would be annoying to have to continuously switch back to creative after testing what I am making.

warm flame
#

I'm unsure why it's still so buggy it's been like this forever afaik at least I remember it also being a problem back in 1.8

hoary scarab
#

Well... Looks like InventoryCreativeEvent has issues too...```java
@EventHandler(ignoreCancelled = true)
public void onCreativeInventoryClick(InventoryCreativeEvent event) {
Inventory inv = event.getInventory();
Integer slot = event.getSlot();

if(inv == null)
    return;

ItemStack item = inv.getItem(slot);
Output.debug("Item == null: "+Boolean.valueOf(item == null));

}
```Outputs Item == null: true Whether I click on a slot with an item or not.

sterile hinge
#

yeah because it's not an inventory known by the server

hoary scarab
#

Player's hotbar*

proud pebble
#

the creative inventory is pain

#

the only thing thats sent when in creative is SET_SLOT

lyric gyro
#

Hello

#

How do I do 2 completely different plugins in 1 intellij project?

#

I don't want to create for each plugin a new project

merry knoll
#

why no?

#

not*?

#

you can put them in different modules

lyric gyro
#

im coding my own minecraft server and i want everything in 1 project so I can change them faster

dense drift
#

you should create different projects unless you have a specific reason I guess

merry knoll
#

create different projects and add them as modules

lyric gyro
merry knoll
#

learn gradle and add through there

#

its quite simple just check its documentation

#

as an added bonus they get to share build settings

#

if you want that is

lyric gyro
#

alr thanks

merry knoll
#

how do you guys name your function that are parameters?

#

as in higher order

icy shadow
#

huh?

merry knoll
#

i feel like i keep naming them bogus names like "handler" etc

icy shadow
#

depends on the context?

#

thats like asking how to name an int parameter

merry knoll
#

like for example nokotlin

icy shadow
#

ew

dusky harness
#

onDeny

#

ig

icy shadow
#

yeah i would say that

merry knoll
#

takes permission, does the function on deny

dusky harness
#

also instead of null

merry knoll
#

yeah makes sense

dusky harness
#

you can default to {}

merry knoll
#

nah its intentional

#

its setting a parameter that can be null on java

#

that part aint my code so

merry knoll
icy shadow
#

yw

lyric gyro
#

Drop to armor or weapon

#

And give stats

#

@queen plank

charred ravine
#

Hmm why can't I set a launched arrows shooter to the player on entityshootbowevent?

I did Arrow arrow = player.launchProjectile(Arrow.class, player.getLocation().getDirection();
then arrow.setShooter(event.getProjectile().getShooter();

but in my EntityDamageByEntityEvent (Which I checked damagaer instanceof Projectile & cast projectile to Arrow then Player from arrow.getShooter)

It doesnt seem to account for projectile launched
anyone know why?

charred ravine
#

nvm changed noDamageTicks and it works

floral beacon
#

Hello,
how can I turn BungeeCord (ProxiedPlayer) into variable
So i basically want to target only and only "Test" player?
This is what i tried

ProxiedPlayer player = ProxyServer.getInstance().getPlayer("Test");
#

This gives me errors:

java.lang.NullPointerException: Cannot invoke "net.md_5.bungee.api.connection.ProxiedPlayer.getServer()" because "player" is null
floral beacon
#

But i never used to make BC plugins and i only need this for debugging (to get specifically 1 player name like "Test")

merry knoll
#

if the player is not there then it will give you a null pointer

#

not sure what you are trying to do

floral beacon
#

this works, i joined with my premium account usernaqme (TheJoshua) and not the Test one

#

it actually works, i was unsure if my code works because it usually works 5th time when i try out things i didn't code before... sorry and thank you very much @merry knoll !

merry knoll
#

just do a null check after getting the player

#

if its null, means they are not connected

left wigeon
#

hey, does someone knows what is wrong with this? Objective obj = board.registerNewObjective("Scoreboard", "dummy", "Test"); it says that registerNewObjective is deprecated and its marked with a line. im really new to coding in java so any help will be appreciated!

#

here is the full code: public void createBoard( Player player) { ScoreboardManager manager = Bukkit.getScoreboardManager(); Scoreboard board = manager.getNewScoreboard(); Objective obj = board.registerNewObjective("Scoreboard", "dummy", "Test"); Score score = obj.getScore("Player:" + player.getDisplayName()); }

floral beacon
#

i came up with for loop at first but it seems like some strings (especially the string i called currentServer that will for each ProxyServer.getInstance().getPlayers() get player.getServer().getInfo().getName()) do not cache properly

merry knoll
floral beacon
#

so i am thinking of moving to something like java Maps

floral beacon
#

like to get all players on whole proxy

  • player A
  • player B
  • player C
    then to get their subservers respectively
  • player A's subserver
  • player B's subserver
  • player C's subserver

and then put all this in Map (the problem here is that i need to learn again how to use maps ok)

merry knoll
floral beacon
merry knoll
#

sometimes not the case for spigot but in general, you want to avoid deprecated stuff

#

and use their alternatives

left wigeon
merry knoll
#

you will have to check the javadocs and see whats the replacement

#

or if there is a replacement

merry knoll
left wigeon
#

do you know if there is a replacement for getDisplayName or should i check?

merry knoll
#

no idea, it depends on what .getDisplayName gets called from

#

but just check the javadocs, it should tell you whats the alternative

#

if there is no alternative(usually the case in spigot)

#

then just keep using it

left wigeon
#

alright

floral beacon
# merry knoll why do you want to cache regardless

Well, i can't think an idea of doing this
*I will write down my exact goal:

  • every 5 seconds execute /command Text Text Text <CustomSubsrverName> where title will be sent replacing <CustomSubsrverName> with subserver the player is currently connected to but if it's found in the config it will replace it with custom one so let's say i am on lobby it will replace it with config one (for example &6&lLobby&r)

Now i figured out that this works but it will always use the subserver name of first player that is listed online (Using alphabet so if there are 2 players with usernames A and W, it will always replace <CustomSubsrverName> to subserver name from player whose username starts with A)

#

I hope you understand

#

if not let me know i will try shortening it

#

Now i figured out that this works but it will always use the subserver name of first player that is listed online (Using alphabet so if there are 2 players with usernames A and W, it will always replace <CustomSubsrverName> to subserver name from player whose username starts with A)
this is the only part that i am struggling with, everything else is already solved

#

So I don't know why it uses always the same subserver name for every player (or the first player's subserver ALWAYS) even though 2 players are on 2 differently named subservers

#

and i do use for loop

merry knoll
#

can you share your code instead

floral beacon
#

yes

merry knoll
#

probably easier to understand there

floral beacon
#

should i send here on hastebin?

#

maybe easier haste?

merry knoll
#

?paste

neat pierBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
HelpChat Paste - How To Use

merry knoll
#

here

floral beacon
#

ok i hope you don't mind my spacing because it's really a mess because i have A LOT commented code but i will delete it and not include it into paste

floral beacon
#

(part of) config

alert-prefix-chat: '&6&lAlert &7'

server-names:
    wlobby: "Hello!"

exclude-servers:
    - "wselector"
#

alert-prefix-chat actually doesn't matter that is different part of code but i included it because i used it in code to not use it in specific (this code snippet i sent above) situations

#

Now i figured out that this works but it will always use the subserver name of first player that is listed online (Using alphabet so if there are 2 players with usernames A and W, it will always replace <CustomSubserverName> to subserver name from player whose username starts with A)
just a reminder i will sent this again.

#

<CustomSubserverName> = i used <server> in the code above sorry

merry knoll
#

okay so, from what i am gathering you want to exclude some servers and use a placeholder coming from your config

#

there are some small convention issues btw in the code

#

stuff like message_subtitle etc are wrongly named

floral beacon
#

oh right

merry knoll
#

messageSubtitle is the correct naming

floral beacon
#

however

floral beacon
#

so the problem is that i have 2 accounts on 2 different servers

#

i use for loop as you see

floral beacon
#

this is my server config

merry knoll
#

there is no issues with the way you are handling it

floral beacon
#
server-names:
    _default_: "this currently isn't coded inside of plugin"
    selector: "&b&oDirect product previews"
    wlobby: "&6&lWICKED&r&f✕&r&6&o(Proxy)Lobby&r"
    wlobby16: "&3&lWICKED&r&f✕&r&3&oLobby&r"
#

player A is on wlobby
player B is on wlobby16

#

when we execute the command, it does send title, everything is ok until you realize that both player has same <server> placeholder

#

it ALWAYS uses player A's subserver name replacement

#

i figured out why

#

becuase A goes before B in alphabet

#

i tested this with multiple accounts

#

it's always like that and i can't figure out why

#

so when both players are connected to wlobby16 it will send server-names.wlobby16 instead of <server>

but then i send player B to wlobby, and wait for auto-command to execute from bungee and send this title again -> guess what? both players get title where <server> is replaced AGAIN with server-names.wlobby16

#

then i push player A also to wlobby and then it sends correct <server> (the wlobby's one)

#

it's so weird

#

so i do not reload plugins or anything

#

it just fixes itself but it always looks for first player in the list alphabet-wise (or however to say it ok)

floral beacon
merry knoll
floral beacon
merry knoll
#

you are creating your titles at the start

#

then reusing the objects

floral beacon
#

should i move that into for loop?

merry knoll
#

you want to do this instead

#

moved your excludeServers to the top as well

#

no point calling that each loop

#

honestly you probably want to colorize etc

#

outside as well

#

here

#

forgot to rename message_title and subtitle inside TextComponents

#

but you should get the idea

#

there is also no point creating multiple title instances i think, javadocs say you can send both title and subtitle

#

from 1 builder

floral beacon
#

@merry knoll tried what you've done

#

...

merry knoll
#

im finding that hard to believe, check your config maybe?

#

or print out what currentServer is

floral beacon
#

XD

#

this is crazy

proud pebble
#

the armorstand is named, what would be the way to increase the nametag's height? this is a nms armorstand

floral beacon
#

so IT LITERALLY SAYS in debug messages that matchedServerDisplay is INDEED correct to the current server

floral beacon
#

i don't understand sh1t

#

ok

#

literally the messageSubtitle is faulty

merry knoll
proud pebble
#

i looks like thats what decentholograms does atleast

merry knoll
#

i mean it makes sense

proud pebble
#

tho they remove the headstalk and im not sure how thats done

floral beacon
# floral beacon https://prnt.sc/vAKj15e8sGem

@merry knoll so basically what happens is that there are Test, Test2 and W1CK3_D usernames online.
the messageSubtitle will ALWAYS use the server name from Test because he is the first in the list (alphabetically)
Although i really don't understand why matchedServerDisplay is indeed changed like it's shown in chat debug messages but in the messageSubtitle it doesn't change

proud pebble
merry knoll
#

its most likely mounted on the player

#

and multiple lines are made by mounting on top of the armor stand mounted on the player

#

etc

proud pebble
merry knoll
#

oh then yeah

proud pebble
merry knoll
#

you dont really need the nametag entity in that case though

#

you can just send the packet for it to all nearby

proud pebble
#

kinda hard to see but it is above the head of the mob.

#

also i was going to change to packet armorstand instead of using actual armorstand

merry knoll
#

its quite simple if you use the remappings

#

hmm, i think you can name the mob as well no?

#

and force its name to be constantly visible through the tag?

#

you can do it with item entities afaik

#

so should work the same im assuming

proud pebble
merry knoll
#

thats true

#

altho maybe just add fake coloring to break that possibly?

#

not sure if it would work but something like
d&innerbone should fix?

#

as in the reset char

#

i cant remember what it was

merry knoll
#

for the player if you go with this route

#

since the teleport and spawn packets are different

#

you will have to couple your own with the one thats being sent for the mob

proud pebble
#

basically, im going to have fun

merry knoll
#

yeah.. i was fiddling with a hologram api of my own

#

and doing it properly is a huge pain

#

decentholograms lowkey skip this by doing distance checks afaik

#

and resend constantly on a timer

proud pebble
#

fun

stuck hearth
#

Kotlin has a lot of fun

#

sometimes you have to suspend fun though

high edge
#

get out

merry knoll
stuck hearth
#

😦

devout flume
#

Does anyone now of a good library for Junit testing a plugin. more specifically for testing methods that contain JavaPlugin.getPlugin(MyPlugin.class)

lyric gyro
winged pebble
lyric gyro
#

The plugin instance is not mocked (that would be incredibly stupid), that getter should work fine and there are a few libraries that make use of it too

merry knoll
#

does anyone know when jdbc / hikari commits when you have autocommit = true?

lyric gyro
#

depends on the driver impl i suppose

merry knoll
#

apparently it commits on each statement

#

so im guessing you could not lock a row with that implementation

devout flume
#

Thank you

magic crystal
#

Is there a better way of doing this? I havent done SQL in a long long time and feel like theres definitely a much better way of doing this

    fun insertVariance(variance:Variance){
        if (exists(variance)) return
        val statement = connection.prepareStatement("" +
                "INSERT INTO `wastage` (" +
                "`product`, `date`, `amount`, `percent`)" +
                " VALUES (?, ?, ?, ?)")
        statement.setString(1, variance.product)
        statement.setDate(2, Date.valueOf(variance.date))
        statement.setFloat(3, variance.amount)
        statement.setFloat(4, variance.percent)

        statement.executeUpdate()
    }

    private fun exists(variance:Variance):Boolean{
        val statement = connection.prepareStatement("SELECT * FROM `wastage` WHERE `date`" +
                "='${Date.valueOf(variance.date)}' AND `product`='${variance.product}'")
        val resultSet = statement.executeQuery()
        return resultSet.next()
    }```
devout flume
#

Thank you so much

bitter grove
#

'bebrasmell':
material: barrier
slot: 53
display_name: ' &6↑&d Следующий уровень &6↑ '
priority: 0
click_requirement:
minimum_requirements: 1
stop_at_success: true
deny_commands:
- '[close]'
- '[sound] BLOCK_ANVIL_DESTROY'
- '[message]'
- '[message]&cУ вас недостаточно глины!'
- '[message]'
requirements:
perm1:
type: has permission
permission: k.1
perm2:
type: has permission
permission: k.2
click_commands:
- '[sound] ENTITY_PLAYER_LEVELUP'
- '[givemoney] 600'
hello, is there any mistakes?

#

it is deluxe menu

dense drift
#

Wrong channel

stuck canopy
#

is there a way to get a custom inventory's title in 1.19.2?

hoary scarab
stuck canopy
#

nvm its a method in player.getOpenInventory()

hoary scarab
#

My bad its the events that pass .getView() not the inventories.

magic crystal
#

=paste

#

Hello! Its been a while since ive worked with SQL and dont recall much. I feel there is many inefficiencies in this code, and was just wondering if anyone could help reduce the amount of queries/make more efficient
https://paste.helpch.at/kamoxixone.kotlin

insert variance is being called for each item in a list, so if theres a way to insert all the items at once can someone please let me know. Thanks!

#

(tag on response pls)

merry knoll
#

you might want to insert multiple at the same time

#

with one query

magic crystal
#

I see

merry knoll
#

INSERT INTO class_result VALUES (1,’John’,’A’),(2,’Elsa’,’D’),(3,’Sophia’,’B’),(4,’Paul’,’B’),(5,’Saira’,’A’); <- like this

magic crystal
#

ah ok

merry knoll
#

copy pasted from a website

#

but if you google <yourdatabase> bulk <insert|update> etc

#

you should get the exact syntax for it

magic crystal
#

alrighty cool thanks

#

Does anyone know how I would select all the dates since the current date and the last tuesday?>

magic crystal
#

I dont have the start date tho

#

And I need to do it in just SQL now, no java/kotlin

broken elbow
broken elbow
merry knoll
#

but if its through java, then you can calculate it ^ like @broken elbow sent, then put them in the prepared statement

#

for timestamps i think the syntax is BETWEEN

#

WHERE columnName BETWEEN timestamp1 AND timestamp2 <-

#

you can also put in yyyy:mm:dd hh:mm:ss i think

#

not sure about the exact syntax of it

broken elbow
#

Idk if you can get the last Tuesday directly in SQL. You might have to calculate it in JAVA, then convert it to timestamp and then use what Aki gave you.

merry knoll
#

ah its possible apparently

#

found this

quaint skiff
#

Hi, I tried to code a scoreboard for a minigame (with a countdown and some other stats which are personalized for the Player) But it always flickers or doesn´t get set right. Does anyone know a good API for something like that or at least a good tutorial because i just can´t find anything helpful and i have no idea how i should even start now because of things like scoreboard teams which i dont understand.

merry knoll
#

instead of setting the lines directly

quaint skiff
#

but how do they update then?

merry knoll
#

you update the group prefix and suffix

worn jasper
#

Uhm had an idea, to avoid DI, I have a reload method which basically updates an object to the values of the config file. It has checks to see if anything is wrong in the config, so what I did was create another class called ErrorInfo, which would contain the action done, player, and the error. So this reload method, if an error occurs, it returns that, if not, it would return null, is it a good idea?

#

I personally like it and find it organized, but I am unsure if it's the right approach or if it could cause any issues.

merry knoll
#

its a bit of an anti-pattern

#

and effectively a singleton i am guessing

#

but for the case of the config, its kinda fine

worn jasper
merry knoll
#

makes writing unit tests hell though

#

then dont you have to DI the config object?

#

without static abuse, you will have DI one way or another

worn jasper
#

I mean, yes, sure the config yes, but I really don't wanna have to DI the message handler (I have a method that parses the message and logs it into the console)

#

let me paste what I have rn, maybe it explains better what the idea is

merry knoll
#

it can probably be designed much better honestly

worn jasper
worn jasper
#

but I don't see how

worn jasper
#

each being a gui

dense drift
#

that getOrDefault 🥲

merry knoll
#

why not just throw an exception

#

and catch it instead?

worn jasper
merry knoll
#

effectively does what you want to do and thats what its for

worn jasper
#

although that still doesn't fix one issue

#

which is that I would have to DI the class that has the method that formats and logs the error

merry knoll
#

if (name.equals("-/-")) throw new InvalidConfigException(message)

#

done

#

ah

#

for logger classes

#

you probably want static access

#

using a singleton

#

Logger.getLogger() is a good example

worn jasper
#

oh so static wouldn't be an issue then?