#development

1 messages · Page 119 of 1

patent zephyr
#

ohh, my issue is fixed now

#

I made some changes in my code

loud sorrel
#

?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

cinder forum
#

if action != null je uplne zbytecne

#

plus myslim ze bys mel misto equals pouzit ==

#

pouzij InteliJ a ne eclipse, ten ti poradi spoustu veci ci je to jen theme

loud sorrel
patent zephyr
#

a už je to fixed

leaden sinew
#

Idk what threads have to do with it

warm steppe
#

check if player is not null

#

also if inventory is not null

vestal forge
#

Does anyone know how to disable monster collision damage?

#

I have damage methods overriden with empty body but its still there

loud sorrel
dusky harness
#

but they cut off the stacktrace :p

atomic trail
#

How can I compare a set based on size for comparable? Kinda like this

    @Override
    public int compareTo(@NotNull Set<IPlayer> iPlayers) {
        return players.compareTo(iPlayers);
    }
sterile hinge
#

use the size() method?

atomic trail
#

Doesn't work, can't use Integer.compareTo() for some reason

dusky harness
atomic trail
dusky harness
atomic trail
dusky harness
#

use Integer.valueOf

atomic trail
#

Oh yeah, also this would work btw

dusky harness
#

if not then u have to use that ig

atomic trail
#

Can't use Integer.valueOf(Object) though

#

I guess I'll just use a try catch first

dusky harness
#

isn't there Integer.valueOf(int)?

#

d;Integer#valueOf

uneven lanternBOT
#
public static Integer valueOf(int i)```
Description:

Returns an Integer instance representing the specified int value. If a new Integer instance is not required, this method should generally be used in preference to the constructor Integer(int), as this method is likely to yield significantly better space and time performance by caching frequently requested values. This method will always cache values in the range -128 to 127, inclusive, and may cache other values outside of this range.

Since:

1.5

Parameters:

i - an int value.

Returns:

an Integer instance representing i.

atomic trail
atomic trail
#

Yeah

graceful hedge
#

what type of object 😮

dusky harness
#

^

#

check instanceof

#

and cast

#

like how #equals does it

graceful hedge
#

you might just want to return 1 if the object is not an instance of Integer

dusky harness
#

or IllegalArgumentException

#

¯_(ツ)_/¯

graceful hedge
#

?

#

no

#

that'd explode

dusky harness
#

uh

atomic trail
#
    @Override
    public int compareTo(@NotNull Object o) {
        if(!(o instanceof Integer)) {
            return 1;
        }

        return Integer.compare(players.size(), (Integer) o);
    }

?

graceful hedge
#

yes

dusky harness
#

yes

graceful hedge
#

basically, if we are the right type, then we are greater than them

atomic trail
#

Yeah makes sense

pulsar ferry
pulsar ferry
topaz kindle
#

I add content to a HashMap, and I want it to see with a command, but it is empty 😦 ```java
public HashMap<UUID, PermissionAttachment> playerPermissions = new HashMap<>();

public void setupPermissions(Player player) {
PermissionAttachment attachment = player.addAttachment(Main.getPlugin(Main.class));
playerPermissions.put(player.getUniqueId(), attachment);
permissionsSetter(player);
}

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(sender instanceof Player) {
Player player = (Player) sender;
player.sendMessage(playerPermissions.toString());
return true;
}
return false;
}```This is my code, the setupPermissions() function it is executed in the JoinEvent

#

When I execute the command the HashMap is: {}, and must have informatio

atomic trail
#

Way easier

#

Found a way better solution actually, I can just parse Integer as the Comparable parameter so Comparable<Integer>

loud sorrel
queen plank
#

How do I get server TPS? People keep telling me to use Bukkit.getServer().spigot().getTPS() but it does not exist for 1.18?

dense drift
loud sorrel
#

yes there is lmao. player.openInventory

dense drift
#

d;paper Server#getTps

uneven lanternBOT
#
@NotNull
@org.jetbrains.annotations.NotNull double[] getTPS()```
Description:

Gets the current server TPS

Returns:

current server TPS (1m, 5m, 15m in Paper-Server)

loud sorrel
#

i use it all the time for guis

dense drift
#

player.openInventory is not the same as p.openInventory

#

And, show the full exception

loud sorrel
#

p is Player, player is CratePlayer

#

that is the full excetion

#

it doesnt print a stack trace

#

this is one of the annoying ones

#

player vs p are just variable names

dense drift
#

Ok

loud sorrel
#

any ideas?

floral beacon
#

ok so i'm always using eclipse and i really can't switch to any other IDE because i'm not professional and only do recode/update/fix stuff when i need

i wanted to ask, what is alternative to org.jetbrains.annotations.NotNull?

Can I use @NonNull instead?

I don't know the differences and i can't get precise answer online

thank you in advance

#

ok i just now realized that i can use org.jetbrains.annotations.NotNull in eclipse(?)

dense drift
#

It is just a library

floral beacon
vale spindle
#

Hi, I get this error once I try to register custom placeholders.
https://paste.helpch.at/hojusiwezi.md

This is my code:

        getConfig().getStringList("connected-servers").forEach(server -> {
            sqlModules.addServer(server);
            new PlaceholderExpansion() {
                @Override
                public @NotNull String getIdentifier() {
                    return "adminutils_" + server;
                }

                @Override
                public @NotNull String getAuthor() {
                    return "Waterbroodje";
                }

                @Override
                public @NotNull String getVersion() {
                    return "1.0.0";
                }

                @Override
                public @Nullable String onPlaceholderRequest(Player player, @NotNull String params) {
                    return String.valueOf(getSqlModules().getOnlinePlayers(server));
                }
            }.register();
        });
high edge
#

Cause I'm guessing you're running this on bungee?

vale spindle
high edge
#

You don't have papi on bungee, so it doesn't find it, also papi doesn't work on bungee so

vale spindle
#

@high edge

proud pebble
#

maybe make it load after placeholderapi does

vale spindle
#

so..

#

@hushed badge can you maybe help?

lyric gyro
#

can you share the whole server logs/latest.log @vale spindle

vale spindle
lyric gyro
#

can't you just send it here ?

vale spindle
#

There is sensitive information in the logs

lyric gyro
#

bruh alright, dms open

river solstice
#

what's the best way to kill an entity (mob) for it to drop items on death?

#

.damage(999) or smt?

wooden loom
#
for (Player vanishedPlayer : VanishModule.vanished) {
  if (vanishedPlayer == player) {
    continue;
  }
  if (vanishedPlayer.hasPermission("vronsky.lobby.vanish.see")) {
    vanishedPlayer.sendMessage(ChatColor.DARK_AQUA + player.getName() + " has joined vanished and silently.");
  }
}
wooden loom
river solstice
#

I assume it's on join?

wooden loom
#

yes it is in the playerjoinevent

lyric gyro
#

@vale spindle make sure you aren't shading papi (should be a compileOnly dependency if you're using gradle, or have <scope>provided</scope> if you're using maven)

worn jasper
#

uh, how can I get the killer on a death event? we used to have .getKiller...

#

there is now a #getPlayer and a #getEntity

#

what's the function of each, and is one of them the killer?

#

wait, I am stupid.

#

omfg .-.

river solstice
#

lol

worn jasper
#

legit stupid, ignore me

river solstice
#

best way for solution to a problem is to type it out

#

happened to me too, I asked and then I realized lol

vale spindle
lyric gyro
#

does it register fine? is it in /papi list?

void orchid
loud sorrel
#

so, ik that there is alr a lecture on chat hoverings, but i want to add a hoverable to a msg from asynchatevent and dont want to send the player a new msg. is there any way to do that?

dusky harness
#
val distance = 50.0

val original = Location(null, 0.0, 0.0, 0.0)
val new = Location(null, 100.0, 0.0, 100.0)

val angle = atan2(new.y - original.y, new.x - original.x) * (180 / Math.PI)

val newX = original.x + (distance * cos(angle)).toInt()
val newY = original.y + (distance * sin(angle)).toInt()
println("x: $newX, y: $newY")
```anyone know why this prints out `x: 50.0, y: 0.0`? 

I'm trying to get a point (starting from `original`) and 50 blocks away towards `new`
lyric gyro
#

right

dusky harness
#

uh

lyric gyro
#

x y z

dusky harness
#

YHGASDGHYHGADIDSAHDHAIWSD_ _ _ _ _ _

#

okay but

#

its still not working 😦

#
val distance = 50.0

val original = Location(null, 0.0, 0.0, 0.0)
val new = Location(null, 100.0, 0.0, 100.0)

val angle = atan2(new.z - original.z, new.x - original.x) * (180 / Math.PI)

val newX = original.x + (distance * cos(angle)).toInt()
val newZ = original.z + (distance * sin(angle)).toInt()
println("x: $newX, z: $newZ")
#
x: 26.0, z: 42.0
#

🤔

#

oh nvm fixed it

#

was using degrees

#

not radians

dusky harness
cinder forum
#

o

dusky harness
#

😌

icy grail
vale spindle
white siren
#

Help

lyric gyro
#

ok

echo briar
lyric gyro
#

Is there a command that will send the message annoucer?

#

I wanna make sure i did it right

white siren
#

Some one is yousing my phone number on here

#

How can I git it on thiss acc

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.

lyric gyro
white siren
#

It did not help that site

#

Barry

mental cypress
#

Contact Discord for help. We aren't Discord.

white siren
#

How

lyric gyro
hoary scarab
#

It's funny that discord doesn't provide support on discord any more.

proud pebble
#

tbf it would be better if they did lol

hoary scarab
#

Yeah they had a server for it but it's gone.

proud pebble
#

the owner's account probs got banned lol

#

or it got nuked

#

imagine that

#

official discord server getting nuked

hoary scarab
#

They also had a "feedback" server. But now it's got a picture of a leaf and has no channels.

white siren
#

I tried it did not have nothing to help me

proud pebble
#

well we arent discord support so we cant help you

#

guess you will have to suffer ¯_(ツ)_/¯

warm steppe
#

i had the same problem

#

discord didnt do anything about it

#

had to change my number anyway so ehh

formal locust
dense drift
#

java.lang.NullPointerException: null

#

find what's null

formal locust
#

ah

formal locust
#

its giving warns in intellij

dense drift
#

Good, now go ahead and fix that

formal locust
#

i added correct path

#
database:
  host: localhost
  port: ''
  database: minecraft
  username: root
  password: ''
  ssl: false

dense drift
#

What does that warning mean?

formal locust
dense drift
#

Good, now assign a value to that variable

formal locust
dense drift
#

The problem is not database.host but the object on which you are calling getConfig()

formal locust
#

Lol i got the problem

#

the issue is i didnt use saveDefaultConfig();

vale spindle
# void orchid aren't you supposed to return true with the persist & canRegister methods?

Ive this now,

        getConfig().getStringList("connected-servers").forEach(server -> {
            sqlModules.addServer(server);
            new PlaceholderExpansion() {
                @Override
                public @NotNull String getIdentifier() {
                    return "adminutils_" + server;
                }

                @Override
                public @NotNull String getAuthor() {
                    return "Waterbroodje";
                }

                @Override
                public @NotNull String getVersion() {
                    return "1.0.0";
                }

                @Override
                public @Nullable String onPlaceholderRequest(Player player, @NotNull String params) {
                    return String.valueOf(getSqlModules().getOnlinePlayers(server));
                }

                @Override
                public boolean persist() {
                    return true;
                }

                @Override
                public boolean canRegister() {
                    return true;
                }
            }.register();
        });```

It shows on the /papi list, but when I try to use `/papi parse me %adminutils_event%` it shows `%adminutils_event%`.
ocean raptor
#

try %adminutils_event_a%

vale spindle
#

doesn't work

dense drift
#

Timo, you are using papi wrong

#

Register a single expansion and onRequest() check if the provided params are one of your servers and then call getSqlModules().getOnlinePlayers(params)

vale spindle
# dense drift Timo, you are using papi wrong

So this is correct right?

        getConfig().getStringList("connected-servers").forEach(server -> {
            sqlModules.addServer(server);
            servers.add(server);
        });

        new PlaceholderExpansion() {
            @Override
            public @NotNull String getIdentifier() {
                return "adminutils";
            }

            @Override
            public @NotNull String getAuthor() {
                return "Waterbroodje";
            }

            @Override
            public @NotNull String getVersion() {
                return "1.0.0";
            }

            String r = "";
            @Override
            public String onRequest(OfflinePlayer player, @NotNull String params) {
                servers.forEach(s -> {
                    if (servers.contains(params)) {
                        r = String.valueOf(sqlModules.getOnlinePlayers(params));
                    }
                });
                return r;
            }
        }.register();```
dense drift
#
if (servers.contains(params)) {
  return String.valueOf(sqlModules.getOnlinePlayers(params));
}

return "Unknown server '" + params + "'";```
vale spindle
#

alright thank you

edgy lintel
#

hi,just need some info on sql
Is BIT the correct field type for boolean field in java sql?
if yes,when i retrieve the value do i use getBoolean(fieldname)?or getInt()?

night ice
#

you need to add NMS packages

#

These packages are not present in the spigotAPI..you need to basically add NMS for that

dense drift
#

You need the mojang authlib

grand island
#

(Paper)

dense drift
#

Yes

#

You can find it on here

broken elbow
#

?

spiral prairie
#

?

#

And?

broken elbow
#

?

spiral prairie
#

?

night ice
broken elbow
#
<dependency>
  <groupId>dev.triumphteam</groupId>
  <artifactId>triumph-gui</artifactId>
  <version>3.1.1</version>
</dependency>```
dense drift
#

no that blitz lol

#

I wanted to show them the authlib

broken elbow
#

oh lmao.

#

didn't read the entire conversation

lyric gyro
#
If (player.write_sign.text = "Hi") {
  player.sendMessage("Hello)"
}

Something like this

#

I tried to make event listeners that check if player write Hello in sign it would response back to player

spiral prairie
#

and where is the issue?

lyric gyro
#

I don't know how to

#

do it

#

I already tried many times

#

Material.SIGN_POST doesn't work anymore

#

I'm using Spigot 1.18.1

carmine hull
#

I am getting this error

#

with papi

#

posting here because it is not letting me to write in placeholder-api room

night ice
#

The plugin beasttokens is formatting a parses Double number(1513,812) with commas...

slow kiln
#

Has anyone here worked with the CooldownMap feature on Lucko's Helper library, I've been having a problem where it's been sending multiple messages once a single block is broken:

CooldownMap<Player> cooldownMap = CooldownMap.create(Cooldown.of(10, TimeUnit.SECONDS));

        Events.subscribe(BlockBreakEvent.class)
                .filter(event -> {
                    if(cooldownMap.test(event.getPlayer())){
                        return true;
                    }
                    Players.msg(event.getPlayer(), "You're on cooldown, please wait " + cooldownMap.remainingTime(event.getPlayer(), TimeUnit.SECONDS) + "s");
                    return false;
                })
                .handler(event -> {
                            Player player = event.getPlayer();
                            Block brokenBlock = event.getBlock();

https://prnt.sc/26mjkxp

candid arch
#

hi there, some of my plugin user got this error when the server closes, and I see that many people complains about this kind of error from public plugins. Can someone explains me what can cause this error or how can I fix it ?

karma is registered to PAPI on startup, and the message error appears when my plugin send some datas into database just before my plugin disable. I don't use PAPI at this moment.

https://pastebin.com/p1hsMucV

Many thanks for your attention

spiral prairie
candid arch
#

Tasks, not functions that's it ?

#

OOooh I see. yes I do some Tasks inside. I'll remove them

#

Thanks

lyric gyro
#

Hi there

#

However my question is in regards to the first few answers of the topic vs the last few answers of the topic.

#

I can see why in terms of memory usage and other reasonings, you'd rather not have a timer/tick 24/7 running and checking things if it's not necessary. Correct?

#

However

If you want to improve the performance of the plugin, just store the System.currentTimeMillis() of the last hit (update it each time the player gets hit) and compare it to the actual System.currentTimeMillis() each time you want to check if he is out of combat.
#

compare it to the actual System.currentTimeMillis() each time you want to check if he is out of combat.

lyric gyro
shell moon
#

on hit, update last damage time

#

if player leaves and last damage time is less than pvp cooldown, he's escaping from combat, punish

warm steppe
#

ezpz

lyric gyro
#

That's where my issue arrives

lyric gyro
#

I've fixed it by using a PlayerMoveEvent for now, but I feel like there are different options.

#

Next, I have another question.

#

ChatColor.WHITE + ChatColor.BOLD + "Proto" + ChatColor.GRAY + ChatColor.BOLD + "Type" + ChatColor.DARK_GRAY + ChatColor.BOLD + " >> " +

lyric gyro
#

I'd like to make a final value and use it in all my classes. What would be the best way going about it?

zealous parcel
#

hey, i feel stupid asking this, but anyone know why the "World.getHighestBlockAt" method is spamming my console with an out of bounds exception even though the coordinates i put in are a random int between -500 and 500?
(I have a megabyte's worth of text just spamming this error) https://paste.helpch.at/dobedufike.sql

dense drift
#

Index 293601592 out of bounds for length 315

zealous parcel
#

i know that

#

but im not giving it anywhere near that index

dense drift
#

show some code

zealous parcel
#
            p.teleport(world.getHighestBlockAt(0, 0).getLocation());
#

thats all the code for that method

edgy wedge
zealous parcel
#

wait, now it works, when i changed it from random -500 500, to 0

#

so its something to do with my random class,

#

line 27 invokes that method

#

yes

#

so... whats wrong with this randomint function?

return min + (max - min) * r.nextInt();
#

wait, i think i just figured it out

#

let me test

edgy wedge
zealous parcel
#

sorry, p is a player, world is the world, minimum is -500 and max is 500

dense drift
#

🤯

zealous parcel
#

but i think i just fixed it,

#

i was multiplying 500, with a random int between all possible int values

#

instead of a double between 0 and 1 and then rounding it

dense drift
#

there's nextInt(min, max)

zealous parcel
#

.... wait, ok, now i feel even more stupid

#

thank you so much!

dense drift
#

you want Math.random() or nextDouble(0, 1) for that

#

np

zealous parcel
#

is that exclusive or inclusive bounds?

dense drift
#

[min, max)

zealous parcel
#

yea, but is the max exclusive?

dense drift
#

yes

zealous parcel
#

ok, ill add 1 to max then, tysm!

dense drift
#

np

shell moon
lyric gyro
#

I want the plugin to perform as best as possible. (performance wise)

fading stag
#

I'm adding hover event to chat messages and to do it I cancel event and broadcast a New Message but it breaks gangchat, is chat etc. What should I do?

spiral prairie
shell moon
#

I dont get what you are trying to do exactly. For countdown to prevent players disconnecting in combat i've always used a task

#

i mean, why would i use move event for that?

#

why exactly move event?

orchid forum
#

Anyone familiar with maven modules? I've got a project setup like parent -> core | 1.16.5 classes | 1.17 classes | 1.17.1 classes -> dist. Dist uses maven shade plugin to shade everything into one .jar. Trying to figure out how I can generate a separate javadoc .jar with the maven javadoc plugin but just can't seem to get it to work.
This is the project setup: https://github.com/BlackBeltPanda/Transport-Pipes/tree/MultiModule

Any help is much appreciated. 🙂

hoary scarab
#

I've been trying for hours today and have tried for days before. Maven, jars etc... I can not get 1.18 to properly allow me to use NMS and API. I can get the code to not give errors using NMS but the server will error saying methods don't exist. I use the API and then the code errors.

I've tried mapped, remapped, original etc... None of the jars or maven dependencies (or configurations) have worked. This one plugin I have doesn't use reflection so unfortunately I'm stuck with spigots shitty excuse for a 1.18 version.

#

I've had multiple users say "depend on this jar", "depend on that jar", "read the spigot post for the maven configuration" and more. None of these worked either. So if someone has a working NMS/api jar and can detail how to get it let me know. I can use maven too but would prefer jars.

proud pebble
#

@hoary scarab i just ran buildtools with java -jar BuildTools.jar --rev 1.18.1 --remapped and after it had built it i went to my intellij and added to my projects pom.xml the md5 plugin for compiling the remapped jar and changed my artifactId from spigot-api to spigot.

hoary scarab
proud pebble
#

thats my pom.xml

hoary scarab
proud pebble
#

well i copied from there and it worked for me

hoary scarab
#

Its funny how they don't just release a downloadable jar now since they aren't including minecrafts source in the actual source of the jar now.

#

NVM Forgot I commented out the imports 🤦 Testing now.

#

With the md plugin in my pom maven errors.

Adding inheritance <hidden-path>\.m2\repository\org\spigotmc\spigot\1.18-R0.1-SNAPSHOT\spigot-1.18-R0.1-SNAPSHOT-remapped-mojang.jar
java.lang.IllegalArgumentException
    at org.objectweb.asm.signature.SignatureReader.parseType(SignatureReader.java:249)
    at org.objectweb.asm.signature.SignatureReader.acceptType(SignatureReader.java:140)
    at org.objectweb.asm.commons.Remapper.mapSignature(Remapper.java:207)
    at net.md_5.specialsource.CustomRemapper.mapSignature(CustomRemapper.java:63)
    at org.objectweb.asm.commons.MethodRemapper.visitLocalVariable(MethodRemapper.java:243)
    at net.md_5.specialsource.RemappingClassAdapter$2.visitLocalVariable(RemappingClassAdapter.java:183)
    at org.objectweb.asm.ClassReader.readCode(ClassReader.java:2571)
    at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1491)
    at org.objectweb.asm.ClassReader.accept(ClassReader.java:721)
    at org.objectweb.asm.ClassReader.accept(ClassReader.java:401)
    at net.md_5.specialsource.JarRemapper.remapClassFile(JarRemapper.java:289)
    at net.md_5.specialsource.JarRemapper.remapClassFile(JarRemapper.java:268)
    at net.md_5.specialsource.JarRemapper.remapJar(JarRemapper.java:205)
    at net.md_5.specialsource.JarRemapper.remapJar(JarRemapper.java:178)
    at net.md_5.specialsource.mavenplugin.RemapMojo.execute(RemapMojo.java:214)
    <Removed rest because of char limit.>
dense drift
#

do you use java 17?

hoary scarab
#

Not on my ide

#

Is it needed?

dense drift
#

yes

hoary scarab
#

ok one sec

lyric gyro
#

since they aren't including minecrafts source in the actual source of the jar now
errr... the jar build by buildtools does contain the modified server which cannot be distributed.. as it always did

hoary scarab
lyric gyro
#

that's basically paperclip and would render buildtools 100% useless now if that was the case for spigot

proud pebble
#

if your using the md5 remap plugin then you need to set your ides java version to the same as its required version i found that out when i tried to compile using java 14

lyric gyro
#

buildtools still builds the same jar as it always did tho, but with the new bundling system

#

it extracts the already patched jar(s) from inside itself, it doesn't download them and patch them on the fly

hoary scarab
hoary scarab
#

🤦 nope still didn't work. Caused by: java.lang.ClassNotFoundException: qr

#

The remapped jar added random casts to the methods and objects.

proud pebble
#

if your using the remapped jar then they wont be found

#

since they no longer use obfusicated code

#

eg: NBTTagCompound is now CompoundTag

#

all previous obfusicated methods will now use the mojang method, class, etc names

#

i believe variables are still obfusicated as var0, var1, etc but its definitly alot better to work with

hoary scarab
#

Well there is remapped-obf and remapped I tried both and both error still.

Remapped-obf adds the random casts and causes the qr not found error that i posted above.

Remapped says EntityArmorStand.setLocation(Double, Double, Double, Float, Float) doesn't exist.

proud pebble
#

i cant find anything relating to EntityArmorStand

#

or any of the entities

#

i believe your looking for net.minecraft.world.entity.decoration.ArmorStand

#

@hoary scarab

hoary scarab
lyric gyro
#

I strongly suggest switching to gradle and use paperweight-userdev

#

it's literally drag and drop and it works

worn jasper
#

Some people will want to kill me but...
I am having an issue, I added the jar directly as a dependency (FAWE from this version AKA Legacy), all imports work perfectly, but when I build the project, I get this:

E:\Plugins\PrivateMines\we-1-8\src\main\java\me\bristermitten\privatemines\worldedit\LegacyWEHook.java:4: error: package com.boydti.fawe.object.schematic does not exist
import com.boydti.fawe.object.schematic.Schematic;```
For context, trying to build/update this privatemines plugin that got abandoned
hoary scarab
lyric gyro
#

unless you use paper exclusive methods (in both internals and api), it will work on spigot just fine

hoary scarab
#

I'll look into it then. Thx

lyric gyro
#

the thing is that the runtime jar has spigot mappings for class names, but everything else is reobfuscated (field/method names), packages are mojmapped

#

and it's not really suited for developing against it either as the actual server jar + libs are inside (which is then extracted.. blah blah)

#

it's a mess

hoary scarab
#

So I shouldn't use it?

#

Why can't spigot just go back to the old jars. 1 jar contains all we need with no issues.

lyric gyro
#

because

hoary scarab
#

Like I'm lazy and don't want to recode 17 classes into 1 reflection class so I always kept the same code.
Now it might just be easier to use reflection.

worn jasper
#

rip theotherpig

dense drift
#

I think you also need the WE API, afonso

lyric gyro
#

with the proper tooling now it's easier than ever to use internals (and it being easy to adapt between versions, at best you wouldn't even need to recompile!)

#

but yeah

spigot
proper tooling

dense drift
lyric gyro
#

why does that emoji exist

#

what the

dense drift
#

Its from mc discord :))

#

But ye

hoary scarab
dense drift
worn jasper
#

and I am importing both fawe and we

#

no errors or whatsoever.

dense drift
#

Hm, is it located above fawe?

worn jasper
#

uh.

#

no. let me change that.

#

ye still same issue

lyric gyro
#

I think the official mc discord is the only "big" mc community server I never joined

#

and with the emojis it has... I have no intentions of doing so

worn jasper
#

I am unsure why this is happening tbh lol

dense drift
worn jasper
#

agree.

#

we should all do a fortnite dance

#

maybe it will suddenly work

#

xd ¯_(ツ)_/¯

#

giving me headaches

#

besides the fact I can't even find similar issues in the internet

#

just confirmed if it wasn't gradle removing it but it can't be since I am compiling it too

#

compileOnly files('lib/FastAsyncWorldEdit-bukkit-Legacy.jar')

#

okay wait, discovered it isn't importing it afterall

#

but the question now is why, the location is right...

lyric gyro
#

try with file instead of files?

#

uh

worn jasper
#

logic be like

#

oh wait

#

actually got an error this time when reloading the gradle

#

the sad part is, I have no idea why it isn't taking it as a dependency

lyric gyro
#

yeah files should work then

#

don't they.. like.. have a repo and a published artifact you can add instead?

worn jasper
#

this is a legacy version

lyric gyro
#

ok...?

worn jasper
#

it had, but it used jenkins and apparently it isn't working anymore

#

well I would get the same errors before

#

at least.

#

well, it wouldn't even import

#

which apparently doesn't work anymore

lyric gyro
#

hm

worn jasper
#

I legit can't find any way to solve this lmao

narrow wagon
#

in general, I know ray tracing is fairly expensive. Is there enough negative stigma with it in spigot development that it should be avoided or used spairlingly?

#

I'm trying to test if a block can at least part of a block another and it seems like the logical choice. But I need to test several rays for the potential block pairing

worn jasper
#

cool. When I find a working fawe version that I can use, it strikes again:

worn jasper
#

Okay, so... how can I prevent gradle from modifying my dependencies?

#

in other words, how can I prevent this?

compact viper
#

so I have this folder, with a deconstructed minecraft plugin in it. How would I use a console command to compile it into a jar, with the bukkit library aswell? cause i tried jar -cf pl.jar * which compiles it to a .jar, but that dosn't have the bukkit library, and it throws errors when i put in it my server. Is there any way to do this?

dusty frost
#

Use a build tool to shade whatever you need

icy grail
#

Would also help if you showed code, shared what errors, etc

silk rover
#

Is there a way to set an item to an inventory without changing its reference? the current methods, setContents and setItem, create a nms copy of the item so it loses the reference :/

lyric gyro
#

I'm trying to use send webhooks to Discord, does anyone have any idea as to why I'm getting this error?
deleted the code and error ignore this message

lyric gyro
#

there is one for /webhooks/{webhook.id}/{webhook.token} so make sure it has the token i guess

lyric gyro
dusty frost
#

HTTP 400 means you did something wrong, so malformed header or something

#

Do you have at least one of content embeds or file in the JSON?

lyric gyro
dusty frost
#

runTaskAsynchronously runs a task a single time on a separate thread to the main server thread, so whenever the scheduler decides to slot it in. It's different every time, but generally pretty quick

dense galleon
#

I got this so far

#

But that doesn't exactly work, since it starts from the highest Y value and ends at the lowest Y value (And I need it to skip between values so it does
0, 1, -1, -2, 2, 3, -3, -4, 4, 5, -5)

sterile hinge
#

that sounds highly inefficient

wheat carbon
#

I don't think he's path finding, probably for some in game animation

#

ik the gif was path finding

#

but I'm guessing he was just using that site to demo what he actually wanted

sterile hinge
#

it's inefficient in every case

dense galleon
#

It wouldnt be inefficient

#

If I find a way to not keep going over the same blocks over and over again

#

And I am doing this for a mob AI

#

I need it to check one block per tick around itself, but these blocks have to be from closest to furthest

#

If I do a normal search it'd start from the bottom left corner of a cuboid area and end at the top right corner

#

I'd need it to check blocks at distance 1 first, then blocks at distance 2, then at distance 3 and so on

sterile hinge
#

what's wrong with a simple flood fill like approach?

dense galleon
#

So that as soon as a valid block is found, the loop stops

#

If the block is next to the mob it'd loop through hundreds of block

#

Since I need to get the closest block to the mob

#

I COULD loop through all the blocks and check the distance for each but that's extremely slow and inefficient

#

Hence I'd need to check in an increasing radius around the mob

orchid forum
#

I agree with SirYwell; flood fill approach is probably the easiest here. Just add the locations that are check to a list to avoid checking them again. Start at the center location and it should roughly move from the inside out. Can set a limit on the size of the location list, as well, to limit the looping.

dense galleon
#

Adding the location to a list = creating a new location object, then I gotta compare two location objects together every single time the loop is ran (which is ~1000 times)

#

that's also inefficient

#

It is called flood fill algorithm

#

At least I know what it's claled

orchid forum
#

Sounds like micro optimization

dense galleon
#

I mean i'd be avoiding creating 1000 location objects

#

Or adding to a list up to 1000 times

#

That ain't micro

orchid forum
#

Only 1000? That's pretty micro, IMO.

#

Location objects and comparisons aren't so heavy that 1000 of them would have much of an impact

dense galleon
#

Idk I've been told in the Minecraft Mod Development discord that it gets heavy if there is like 20 of these mobs that do this check like 20 times a minute

orchid forum
#

Oh yeah, if you're doing that every tick, then that's gonna be heavy

dense galleon
#

Not every tick but once every few seconds

#

For each mob

orchid forum
#

Oh, misread; thought you said 20 per second lol

dense galleon
#

Unless I give all of them a shared brain to see where all the instances of that block are stored

#

Either way, I'll look into the flood fill algorithm

orchid forum
#

🙂 👍

dense galleon
#

Nah never mind

wooden loom
#

how can I send a player to a other server with a bukkit or spigot plugin

dusty frost
#

As in, in your own Bungeecord/general proxy network?

wooden loom
#

yes

dusty frost
#

d;bungeecord ProxiedPlayer#connect

uneven lanternBOT
#
void connect(ServerInfo target, Callback callback)```
Description:

Connects / transfers this user to the specified connection, gracefully closing the current one. Depending on the implementation, this method might return before the user has been connected.

Parameters:

target - the new server to connect to
callback - the method called when the connection is complete, or when an exception is encountered. The boolean parameter denotes success (true) or failure (false).

dusty frost
#

like that ^

broken elbow
#

yeah but he wants to do it from a spigot plugin

broken elbow
#
  public void connect(Player p, String server) {
    ByteArrayDataOutput out = ByteStreams.newDataOutput();

    try {
      out.writeUTF("Connect");
      out.writeUTF(server);
    } catch (Exception e) {
      // the sending failed
    }

    p.sendPluginMessage(this, "BungeeCord", out.toByteArray());
  }```
#

this will be the plugin btw

wooden loom
#

thanks 🙂

river solstice
#

so, jcenter gone?

#

iirc it's now read-only, right?

broken elbow
#

ye

dense drift
proud pebble
#

im currently figuring out protocollib, im using Play#Client#WINDOW_CLICK and im not sure how to get the item on the cursor when i click

#

im wanting to allow players to put items that arent helmets on their head

river solstice
#

I have PAPI dependency included in build.gradle, as well as it's repo, tho it's not imported, what

spiral prairie
#

What

river solstice
#
repositories {
    maven {
        url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
    }
}

dependencies {
    compileOnly 'me.clip:placeholderapi:2.11.1'
}
#

???

spiral prairie
#

Did you click the reload button?

river solstice
#

obviously

#

it's in dependencies tab too

spiral prairie
#

Tf

#

Never experienced this

river solstice
#

¯_(ツ)_/¯

lyric gyro
#

uh tried.. restarting ij?

#

there's a new "fix" button or whatever

#

ah, File -> Repair IDE

river solstice
#

restarted didn't help either

#

:(

lyric gyro
#

😵‍💫

spiral prairie
#

Bintray lmao

river solstice
#

oh lol

#

yeah

#

that was the issue

#

isn't it read-only now tho

#

and should still work

spiral prairie
#

Not latest version afaik

river solstice
#

yeah it was the same with older

#

tried newer after

leaden sinew
#

How would I spawn a fake player with the skin of an online player? I am able to do it with textures and their signature.

warm steppe
#

uhh

#

did you just answer to your own question or what?

spiral prairie
#

Just spawn it xD

warm steppe
#

i found this for mc 1.7 (nms)

worn jasper
#

Any ideas? Ping if you can help.

leaden sinew
icy shadow
worn jasper
worn jasper
# icy shadow Show me

Can it be in a few hours? Kinda at school right now. But if you check the source code, you will see base, compact and plugin folders each with their own build.gradle

icy shadow
#

yes, that's correct

#

and the plugin/build/libs should be where the plugin jar builds to

worn jasper
#

And well, it’s generating a jar for each one of them

worn jasper
#

Which Isn’t the whole plugin

icy shadow
#

try building with gradle plugin:shadowJar

worn jasper
#

Will try when I am at home, thx

#

Will let you know if it works

sinful portal
#

Can i have event listeners in papi expansions?

trail burrow
#

is there a simple null check when checking config file?

dense drift
#

null check for the value of config.getX() ?

trail burrow
#

plugin.getlangConfig().getString("savechestlog");

dense drift
#

ok, get the string, put it on a variable and then do a null check

hoary scarab
#

So I'm using reflection and trying to generate a ChatComponentText object

chatComponent = beforeSeventeen ?
        Class.forName(nms+NMS_VERSION+".ChatComponentText") : Class.forName("net.minecraft.network.chat.ChatComponentText");
```I see `chatComponent.newInstance()` but I can't add parameters to it. I need to replicate `new ChatComponentText(String)`
dense drift
#

d;jdk Class#newInstance

uneven lanternBOT
#
@Deprecated
public T newInstance()
throws IllegalAccessException, SecurityException, InstantiationException, ExceptionInInitializerError```
Description:

Creates a new instance of the class represented by this Class object. The class is instantiated as if by a new expression with an empty argument list. The class is initialized if it has not already been initialized.

Deprecation Message:

This method propagates any exception thrown by the nullary constructor, including a checked exception. Use of this method effectively bypasses the compile-time exception checking that would otherwise be performed by the compiler. The Constructor.newInstance method avoids this problem by wrapping any exception thrown by the constructor in a (checked) InvocationTargetException. The call
clazz.newInstance()
can be replaced by
clazz.getDeclaredConstructor().newInstance()
The latter sequence of calls is inferred to be able to throw the additional exception types InvocationTargetException and NoSuchMethodException. Both of these exception types are subclasses of ReflectiveOperationException.

Throws:

IllegalAccessException - if the class or its nullary constructor is not accessible.
SecurityException - If a security manager, s, is present and the caller's class loader is not the same as or an ancestor of the class loader for the current class and invocation of s.checkPackageAccess() denies access to the package of this class.
InstantiationException - if this Class represents an abstract class, an interface, an array class, a primitive type, or void; or if the class has no nullary constructor; or if the instantiation fails for some other reason.
ExceptionInInitializerError - if the initialization provoked by this method fails.

Returns:

a newly allocated instance of the class represented by this object.

dense drift
#

@hoary scarab

#

The deprecation message says to use getDeclaredConstructor

hoary scarab
#

Didn't see that let me reread. Thank you.

dense drift
#

Np

hoary scarab
#

I'm blind I see it now lol.

dense drift
#

yeah it has some Class<?> params

hoary scarab
#

Damn... what do I use under java 9?

dense drift
#

d;javadocs

uneven lanternBOT
#
Miscellaneous:

Javadocs that don't fit into other categories.

• caffeine                  • gson
• commons-cli               • guava
• commons-codec             • guice
• commons-collections4      • helper
• commons-compress          • helper-sql
• commons-configuration2    • javacord
• commons-crypto            • jda
• commons-email             • processing
• commons-io                • snakeyaml
• commons-lang3             
• commons-logging           
• commons-text              
• configurate-core          
• configurate-hocon         
• configurate-json          
dense drift
#

d;jdk8 Class#getDeclaredConstructor

uneven lanternBOT
#
public Constructor<T> getDeclaredConstructor(Class... parameterTypes)
throws SecurityException, NoSuchMethodException```
Description:

Returns a Constructor object that reflects the specified constructor of the class or interface represented by this Class object. The parameterTypes parameter is an array of Class objects that identify the constructor's formal parameter types, in declared order. If this Class object represents an inner class declared in a non-static context, the formal parameter types include the explicit enclosing instance as the first parameter.

Since:

JDK1.1

Parameters:

parameterTypes - the parameter array

Throws:

SecurityException - If a security manager, s, is present and any of the following conditions is met: the caller's class loader is not the same as the class loader of this class and invocation of s.checkPermission method with RuntimePermission("accessDeclaredMembers") denies access to the declared constructor the caller's class loader is not the same as or an ancestor of the class loader for the current class and invocation of s.checkPackageAccess() denies access to the package of this class
NoSuchMethodException - if a matching method is not found.

Returns:

The Constructor object for the constructor with the specified parameter list

hoary scarab
#

Oh ok. Thought the method was only added in java 9

dense drift
#

btw do you really need NMS Components?

#

Can't adventure do the job?

hoary scarab
dense drift
#

aight

hoary scarab
#

And yes NMS is needed because spigot still has no API for packet based entities.

dense drift
#

Nothing new 🤣

hoary scarab
#

I think they added particle packets to send to individual players but if that is the case thats the only packet based feature you can use via the api.

dense drift
#

ah, yea, true

#

Eclipse 🥲

hoary scarab
dense drift
#

Why not support only the major versions

#

1.8.8, 1.9.2, 1.10.2, 1.11.2, 1.12.2 etc

hoary scarab
#

Wasn't my plugin. I took it over.

dense drift
#

ah, alright

hoary scarab
#

I would have done reflection if I made this originally xD

dense drift
#

I hate this process tbh xD

#

I sometimes wish that mc was one of those games that force you to play only the latest version xD

hoary scarab
#

I don't, each version has its purpose. I'm actually forced to use reflection because 1.18 fucked up the api and nms methods/classes. (Still haven't gotten it to work)

dense drift
proud pebble
#

The minecraft protocol makes me wanna rip out my hair cause i am clearly missing something

#

listen to Play#Client#WINDOW_CLICK
send a Play#Server#SET_SLOT packet that should place an item on the players head.

hoary scarab
dense drift
lyric gyro
#

oh yeah 1.13+ for wasting time

#

that's why over 75% of all servers use 1.16+

dense drift
#

performances are better now, if that's what you are talking about, Yapp

plush pebble
#

Hey, wonder if discord shachst will. E supported on psn now that you can link them

dense drift
dense drift
#

Is it worth to put @Contract on a kotlin method?
For example, this

@Contract("!null -> !null")
inline fun <reified E: Enum<E>> String.test(default: E? = null): E? {
    return Enums.getIfPresent(E::class.java, this.uppercase()).orNull() ?: default
}```
warm steppe
#

no

hoary scarab
dense drift
#

yeah but why would you play survival on 1.8 ?? I see your point, but that doesn't mean the new stuff are 'useless'

proud pebble
#
if (e.getPacketType() == PacketType.Play.Client.WINDOW_CLICK) {

                    ItemStack item1 = p.getItemOnCursor();
                    ItemStack item2 = p.getInventory().getHelmet();

                    if (packet.getIntegers().readSafely(0).equals(0)) {
                        if (packet.getModifier().readSafely(2).equals(5)) {
                            p.getInventory().setHelmet(item1);
                            p.setItemOnCursor(item2);
                        }
                    }

I have this, WINDOW_CLICK does get sent out every time i click but this only changes the helmet and cursor if i double click which makes no sense to me

warm steppe
hoary scarab
warm steppe
#

it's more likely a you problem

hoary scarab
pulsar ferry
dense drift
#

ah so that's how you use it

pale swallow
#

Anyone that knows a library that can set blocks with nms

#

i don't want to use worldedit

dense drift
#

ProtocolLib?

proud pebble
#

Anyone have any idea what packets are sent when you try to put a helmet or pumpkin on your head but isnt sent when you try to place a regular block on your head?

#

i know that WINDOW_CLICK is sent but have no idea what other packets are or arent sent

dense drift
#

Thats because the class doesnt have an empty constructor

#

use chatComponent ?

#

chatComponent is already a Class

hoary scarab
#

🤦

#

lol

dense drift
#

Also, the reason getDeclaredConstructor has Class<?> params is to tell it what constructor you want to get

hoary scarab
#

I'm here writing this shit and I miss that SMH.

dense drift
#

And it your case it would be getDeclaredConstructor(String.class).newInstance(text)

hoary scarab
#

👍 thank you.

dense drift
#

Np

worn jasper
#

any ideas on how I can convert a material to a List<ItemStack>?

hoary scarab
worn jasper
#

Well, let's suppose I have a command that takes a material as argument

#

but the method I want to execute only accepts List<ItemStack>

#

I need to convert it

#

I suppose I could create a list, turn the material to an itemstack and then add it to the list?

hoary scarab
#

Arrays.asList(new ItemStack(Material.getMaterial(arg)))

worn jasper
#

ty

drowsy edge
#
x()' in 'net.minecraft.world.entity.EntityInsentient' clashes with 'x()' in 'net.minecraft.world.entity.EntityLiving'; attempting to use incompatible return type
``` this error keeps popping up and I honestly have no clue to fix it and i've been trying to for a while.
ionic flax
#

Guys does anyone knows how to fix this issue "An existing connection was forcibly closed"

ionic flax
#

is there a fix though?

drowsy edge
#

im not sure

#

i just rejoin immediately if it happens to me

ionic flax
#

i do everything but keeps showing up

forest jay
#

How can I turn off statistics for my server? I dont want the player able to go Menu >> Statistics and see things

drowsy edge
#

does anybody know the client bound version of PacketPlayOutNamedEntitySpawn

lyric gyro
#

hello

#

i have a channel, the roles for my coleaders and admins. The are not able to kick, add roles or any permission i set them to do and i have everything activated. Need help, why cant they have their powers when the permissions are allowed?

drowsy edge
#
org.spigotmc:spigot-api:txt:remapped-mojang:1.18-R0.1-SNAPSHOT was not found in https://hub.spigotmc.org/nexus/content/repositories/snapshots/ 

This error pops up and i honestly dunno what to change, its stopping me from exporting jar

forest jay
#

idk where that specific jar is located at

forest jay
#

or something in your pom.xml

#

goes both ways

drowsy edge
#

ill check

#

it looks correct

#

idk ill look at it later again

rigid mountain
#

Anyone know in 1.8 how i can repalce a bunch of blocks fast?
Im having an issue with NMS and ghostblocks, and im trying FAWE, but there isnt many docs on 1.8

warm steppe
#

you misspelled 1.18

rigid mountain
#

no...

#

1.8.8

rugged bane
opaque badge
#

So my question is how to open a project up in spigot

proud pebble
#

i figured it out fuck yeah

#

using protocollib i figured out how to put blocks not normally allowed on players heads on their heads through the inventory interface

trail burrow
#

what would cause getLogger().info not to work on a command?

cinder forum
#

command is not registered (in code or plugin yml)? like if you do something else than log info its working?

dusky harness
#

idk

trail burrow
leaden sinew
trail burrow
#

I fixed it, still don't know why Intellij wouldn't add the import

lyric gyro
#

iterate thru every element out of list and writeString into the output stream

spiral prairie
shell moon
#

Probably client limiting the amount of particles? ¯_(ツ)_/¯

spiral prairie
#

probably

#

does any1 know how long the stay time for redstone particles is

lyric gyro
#

That's controlled by the speed parameter

broken elbow
#

Can you guys recommend a pagination lib that works with JDA 5.0.0? ty

molten wagon
#

I know you should not access bukkit async (in many cases), but how it is when you only want to check blocktype on x location (no modifications in the world)?

past ibex
#

It will get angry if you try to load a chunk

molten wagon
past ibex
#

how do you know if the chunk is loaded?

dense drift
#

d;spigot Chunk#isLoaded

uneven lanternBOT
#
boolean isLoaded()```
Description:

Checks if the chunk is loaded.

Returns:

True if it is loaded.

past ibex
#

race condition!

#

chunk may technically unload before the next call, although it's unlikely

molten wagon
#

I can also say #isLoaded will make big hit on the plugin tick usage (if you have close to 5000 entity's in the cache) 🙂

molten wagon
neat pierBOT
#
FAQ Answer:
» Give the helpers some details
» Ask suitable questions
» Be polite
» Wait

Source

spiral prairie
#

no, we cant, we dont know what the issue is

warm steppe
#

that the fuck is that code

spiral prairie
#

ikr

dusky harness
#

What's the best way to teleport a player to a different server & location?

#

using bungee api

hoary scarab
#

PluginMessaging?

dusky harness
#

yea im using it already but what if the player isn't on the server yet?

#

but at the same time I don't want it to seem too delayed

#

oh wait

#

isn't there a join event-

#

🤦

hoary scarab
dusky harness
#

so it'll always have a player anyways

#

:))

hoary scarab
#

👍

dusky harness
#

😃

graceful hedge
#

that type parameter gets erased iirc

hoary scarab
hard wigeon
#
@EventHandler
        public void onItemCraft(CraftItemEvent event) {
            if (!event.getRecipe().getResult().getType().name().endsWith("_SHULKER_BOX")) return;
            ItemMeta meta = event.getCurrentItem().getItemMeta();
            if (meta instanceof BlockStateMeta) {
                BlockStateMeta blockStateMeta = (BlockStateMeta) meta;
                if (blockStateMeta.getBlockState() instanceof ShulkerBox) {
                    System.out.println("It's a shulker box");
                    ShulkerBox shulkerBox = (ShulkerBox) blockStateMeta.getBlockState();
                    shulkerBox.getInventory().setItem(0, new ItemStack(Material.WHITE_DYE));
                }
            }
        }

Any clue why this doesn't work?

#

the It's a shulker box message is printed

#

but the white dye is never added

lyric gyro
#

event.getRecipe().getResult().getType().name().endsWith("_SHULKER_BOX")
aaaaaaaaaaaaa

hard wigeon
#

lmao

#

that was for debug stuff

#

it's un needed

#

at this point

lyric gyro
#

Tag.SHULKER_BOXES.isTagged(blah.blah.getType())

hard wigeon
lyric gyro
#

proooobably 1.13

hard wigeon
#

wtf

#

news to me

#

and I only learned java in like 1.16 era

#

anyway, that's not important lmao

lyric gyro
#

lol

dusky harness
#
team.addEntry(player.name)
Bukkit.broadcast(Component.text("Added entry to ${team.name}:${
    NamedTextColor.NAMES.key(NamedTextColor.nearestTo(team.color()))
}"))
```anyone know why this broadcasts the correct color but my glow color (using Player#setGlowing) is still white?
worn jasper
#

uh quick question, you can't create GUIs with a bungee plugin right?

#

(wouldn't make sense if you could but just making sure)

worn jasper
#

Can you link me something?

dusky harness
#

but how do I make it compatible?

forest jay
#

does anyone know of a way to control and ride an entity through 1.8.8 with NMS? I cant find any tutorials or forum posts on this

vestal forge
#

depends what entity

worn jasper
#

uhm this is correct right? I can't just understand how in.readUTF() is returning 2 different things? ....

@Override
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
  if (!channel.equals("BungeeCord")) {
    return;
  }
  ByteArrayDataInput in = ByteStreams.newDataInput(message);
  String subchannel = in.readUTF();
  if (subchannel.equals("GetServer")) {
    String servername = in.readUTF();
  }
}```
lyric gyro
#

Basically the data is "queued"

worn jasper
#

lol okay, tysm

dense drift
#

ProtocolLib? fingerguns

#

Which variable is the right one, packetClass or pClass?

#

d;jdk Method#invoke

uneven lanternBOT
#
public Object invoke(Object obj, Object... args)
throws IllegalArgumentException, InvocationTargetException, NullPointerException, ExceptionInInitializerError, IllegalAccessException```
Description:

Invokes the underlying method represented by this Method object, on the specified object with the specified parameters. Individual parameters are automatically unwrapped to match primitive formal parameters, and both primitive and reference parameters are subject to method invocation conversions as necessary.

If the underlying method is static, then the specified obj argument is ignored. It may be null.

If the number of formal parameters required by the underlying method is 0, the supplied args array may be of length 0 or null.

If the underlying method is an instance method, it is invoked using dynamic method lookup as documented in The Java Language Specification, section 15.12.4.4; in particular, overriding based on the runtime type of the target object may occur.

If the underlying method is static, the class that declared the method is...

This description has been shortened as it was too long.

Parameters:

obj - the object the underlying method is invoked from
args - the arguments used for the method call

Throws:

IllegalArgumentException - if the method is an instance method and the specified object argument is not an instance of the class or interface declaring the underlying method (or of a subclass or implementor thereof); if the number of actual and formal parameters differ; if an unwrapping conversion for primitive arguments fails; or if, after possible unwrapping, a parameter value cannot be converted to the corresponding formal parameter type by a method invocation conversion.
InvocationTargetException - if the underlying method throws an exception.
NullPointerException - if the specified object is null and the method is an instance method.
ExceptionInInitializerError - if the initialization provoked by this method fails.
IllegalAccessException - if this Method object is enforcing Java language access control and the underlying method is inaccessible.

Returns:

the result of dispatching the method represented by this object on obj with parameters args

dense drift
#

The first argument should be an instance of PlayerConnection, not Class<PlayerConnection>

hoary scarab
hoary scarab
dense drift
#

No

#

It literally says why IllegalArgumentException is thrown

#

And in your code, you call playerConnection.getClass() which give you a Class<?> and you need an instance of PlayerConnection to call sendPacket on

hoary scarab
#

Oh. 🤦 let me test that then.

dense drift
#

if the method is an instance method and the specified object argument is not an instance of the class

hoary scarab
#

Even if I use just playerConnection it has the same error.

dense drift
#

Whats playerConnection?

hoary scarab
#

PlayerConnection

dense drift
#

It clearly isnt

#

show the getPlayerConnection method

tacit belfry
#

If i have multiple arrays that look something like:

new byte[][]{
{0, 0, 0},
{0, 1, 0},
{0, 0, 0}}
```how could I combine them so that the final array looks like:
```java
new byte[][]{
{0, 0, 0, 0, 0, 0},
{0, 1, 0, 1, 0, 0},
{0, 0, 0, 1, 1, 0}}
hoary scarab
#

Object pc = getHandlePlayer.invoke(craftPlayer.cast(p)).getClass().getField(fieldName);
🤦

tacit belfry
dusky harness
#

ohh

dusky harness
#

no he isn't trying to add two arrays together

hoary scarab
#

@dense drift got that fixed thank you.

dense drift
#

ok and?

#

np

tacit belfry
dusky harness
dense drift
#

yes dkim

#

d;guava Bytes#concat

uneven lanternBOT
#
public static byte[] concat(byte[]... arrays)```
Description:

Returns the values from each provided array combined into a single array. For example, concat(new byte[] {a, b}, new byte[] {}, new byte[] {c} returns the array {a, b, c}.

Parameters:

arrays - zero or more byte arrays

Returns:

a single array containing all the values from the source arrays, in order

dense drift
#

simple and easy

tacit belfry
#

oh that works ill try that

tacit belfry
worn jasper
#

(Deleted cause will use hastebin)

dense drift
#

Yes, it doesn't

tacit belfry
#

So should I call that method for each 1d array inside the 2d?

dense drift
#

Yes

worn jasper
#

Uhm soo... trying to work with bungee plugin messaging channel... this is my:

Main goal: The main goal is to get the current server, if it doesn't start with "lobby", get the list of all the servers, add all the servers that start with lobby to a list, get the player count of each server and send the player to the server with the lowest player count.

Issue: It's not passing from the command, I added several debugs and it onlys sends the first one, which means the PluginMessage isn't being sent or there is an issue with channels, or idk.

What I tried: Tried changing the channel, but didn't work, unsure where the issue is.

Extra question related to this: If I use the Bungeecord channel, if I use GetServer, any plugin in that channel will listen to it right?

dusky harness
# tacit belfry If i have multiple arrays that look something like: ```java new byte[][]{ {0, 0...
    public static byte[][] combine(byte[][] first, byte[][] second) {
        if (first.length != second.length) {
            throw new IllegalArgumentException("Arrays must be of equal length");
        }
        byte[][] array = new byte[first.length][first[0].length + second[0].length];
        for (int i = 0; i < first.length; i++) {
            System.arraycopy(first[i], 0, array[i], 0, first[i].length);
            System.arraycopy(second[i], 0, array[i], first[i].length, second[i].length);
        }
        return array;
    }
```here ya go :))
dense drift
#

A player has to be online on both servers @worn jasper

tacit belfry
tacit belfry
#

I could probably tweak it to extend the array of lesser size if they aren't the same size right?

dense drift
#

You need a player on one of these lobby servers for the message to be sent

worn jasper
#

or wait, maybe you didn't

dense drift
#

You are sending a pluginMessage and for that to happen, you need players on all servers you want to receive the message

worn jasper
#

what if I don't have any player on those servers?

dense drift
#

The message wont be sent

#

it is a dumb system

worn jasper
#

what's the fix/solution to it?

dense drift
#

Bungee has methods to get the servers of your network

worn jasper
#

Yes but that would involve using a bungee plugin in that case?

dense drift
#

And the ProxiedServer or whatever has a method to get the player count

#

Well and sounds like a better idea to me

#

Especially that you want to send the player to the server with the lowest player count, which can be 0

#

But with PluginMessaging, the message wont be sent to those servers

worn jasper
#

If the system was only sending the player to the lobby with the lowest count, yes it would be the issue is it isn't just that, if the player is in a lobby, and he does /lobby it should display a list of all lobbies in a GUI, if he is in a game server, it would send him to the lowest count server, is that possible with bungee plugins?

dense drift
#

Yes?

#

How do you think /hub or /server <server> commands work

worn jasper
#

I mean, those send you directly to a specific server.

#

it's a bit different in this case?!

dense drift
#

Its all handled by bungee

#

The connect message is sent through the Bungeecord channel or using bungee specific methods

dusky harness
# tacit belfry I could probably tweak it to extend the array of lesser size if they aren't the ...
    public static byte[][] combine(byte[][] first, byte[][] second) {
        // get highest array size
        final int length = Math.max(first.length, second.length);
        // create the combined array
        byte[][] array = new byte[length][first[0].length + second[0].length];
        // loop to fill the array
        for (int i = 0; i < array.length; i++) {
            // make sure that the array is large enough in case the second is larger
            if (first.length > i) {
                // copy the first array into the combined array
                System.arraycopy(first[i], 0, array[i], 0, first[0].length);
            }
            // make sure that the array is large enough in case the first is larger
            if (second.length > i) {
                // copy the second array into the combined array, but skip the first array size (to avoid overwriting)
                System.arraycopy(second[i], 0, array[i], first[0].length, second[0].length);
            }
        }
        return array;
    }
```i also commented it since it might seem confusing
worn jasper
#

but would I need in this case to have a plugin for bungee, another for the lobbies and another for game servers?

dense drift
#

You can just make a bungee plugin

#

With a command

dense drift
#

@dusky harness or, you know, an byte[n][m] array and then use Guava to combine the arrays :)

tacit belfry
#

I was doing a less efficient way

worn jasper
#

that sends the player to the server with the lowest playercount, but could I then override it in the lobbies? since in lobbies I want it to display a gui with all the servers.

dense drift
#

You can do whatever you want

dusky harness
worn jasper
#

fair enough.

dense drift
#

n = number of rows
m = number of columns of both 2d arrays

tacit belfry
#

Can guava do that?

dusky harness
# uneven lantern

but this method just combines all the array contents into one array

#

i mean i sorta think i get what you're saying? but my brain is unable to understand lol

#

idk

#

a

dense drift
#

create a 2d array where the others will be set
use a for loop from 1 to n, get the arrays from first and second array located at position i, combine them, and set them in the array created before

dusky harness
#

well i mean thats basically what im doing in that above method

#

except im setting it 2 times instead of combining -> setting

#

i understand what u mean now tho

dense drift
#
byte[][] destination = new byte[n][m];

for (i from 0 to n) {
  destination[i] = Bytes.concat(a[i], b[i]);
}```
dusky harness
#

ye

worn jasper
#

is using like var bad practice?

#

example: var servers = plugin.getProxy().getServers();

vestal forge
#

why would it be

worn jasper
#

I see it as a method for lazy people to code, but is it bad practice?

#

no idea why it would

#

hence why I am asking lol

vestal forge
#

you mean var in java or kotlin

worn jasper
#

java

vestal forge
#

its ok to use it

worn jasper
#

k then

dusky harness
#

btw how come ur using NMS for it?

hoary scarab
dusky harness
#

ah

hoary scarab
#

But they like to complain and say use the api even though this doesn't exist lol

dusky harness
#

also iirc nms entities still persist on server restarts so make sure to test that

dusky harness
#

but they still have uuids and stuff

#

hm

#

like if you do /minecraft:kill @e does it remove the armor stand?

hoary scarab
#

I've tested it before when I attempted to find out how many entities the server can actually store lol

dusky harness
#

huh

#

interesting

#

then why have I been using entirely based packet armorstands this whole time 😩

#

i thought it stayed

#

ill have to retest sometime again 🤔

#

hmm

hoary scarab
#

Depends on the reason you need the entity.

dusky harness
#

well since it doesn't stay on server restart there isn't a reason to use packet armorstands

#

(which is what ive been doing)

hoary scarab
#

When the chunk loads it adds the entities into the list. I learned that when it was changing the entity object of my minions.

hoary scarab
#

So when the chunk unloads it unloads the entities from the list. When the chunk loads it will grab the entities from that chunk and readd them.

dusky harness
#

but then wouldn't it also be saved onto the world file?

hoary scarab
#

it is but not saved in memory if the chunk is unloaded.

dusky harness
#

oh

#

then im prob better off using packet based ones then

#

|| might want to rebump ur question ||

hoary scarab
#

yeah lol

dense drift
#

any errors?

#

btw cache those constructors

worn jasper
#

uh... getting this error when building:
Executing Gradle tasks as part of a build without a settings file is not supported. Make sure that you are executing Gradle from a directory within your Gradle project. Your project should have a 'settings.gradle(.kts)' file in the root directory.
The funny part is... the god damn file exists

pure crater
icy shadow
#

theres a big white box

#

thats where the caption is supposed to go

lyric gyro
#

no

icy shadow
#

wasnt talking to you

lyric gyro
#

do i look like i care?

#

spoiler alert: i don't

icy shadow
#

you do actually

#

you care a lot

lyric gyro
#

actually i don't

#

yo udo

lyric gyro
#

u//w//u

robust flower
broken elbow
forest jay
silk rover
dense drift
#
no main manifest attribute, in clippy.jar```
Any idea why Ptero would suddenly complain about this, even though the jar has a manifest file and the `Main-Class` property?
vestal forge
dusky harness
#

Anyone know how I could use the bukkit scoreboard API while another plugin (ex TAB) is also installed on the server?

#

so that I could set player's glow colors

worn jasper
#

uh, hi, can I use methods from a Bukkit plugin API in a Bungeecord plugin?

#

(In this case, I want to use a method only present on a bukkit plugin, when executing a command in a bungee command)

graceful hedge
#

I believe that would result in a NoClassDefFoundError

loud bone
#

Just updated my project to JDK17 and now I'm getting class file has wrong version 61.0, should be 55.0 when compiling. All regarding the papermc API. Anyone has an idea how I can resolve this? Built fine with jdk 11 before

turbid jewel
#

ByteBuf rewrittenBuf = Unpooled.buffer()

Does anyone know if I'm suppose to do ByteBuf#release(); after I did something with it?

#

My plugin is using a lot of memory, trying to figure out why xd

turbid jewel
#

No clue if the additions are necessary, PluginMessage is a packet from VelocityPowered

austere spindle
#

How to set deluxe menu that the nether star will be in our last inventory slot

dense drift
surreal hare
#

Idk why it marked it as CSS

#

The line in the gradle file thats apparently the issue:

mappings = "snapshot_20141130"
rigid mountain
#

Anyone know a good API for making custom mobs?

proud pebble
#

atleast thats what ive heard from alot of youtube videos relating to making custom mobs

rigid mountain
#

ok

spiral prairie
proud pebble
#

never thought about mythicmobs, might be worth using

forest jay
#

what is a good sound for errors or lack of permission?

#

like, using Sound.?

leaden sinew
#

The villager trade deny sound

past ibex
#

do you use plugin messages?

ashen rover
#

nope i just use redis to handle communication

#

i was using bungee channels before but that was bad for certain stuff

rigid mountain
proud pebble
rigid mountain
#

Ok

rigid mountain
#

Anyone know of a guide for custom mobs in 1.18? I cant find much anywhere

spiral prairie
proud pebble
#

cause if so you need the md5 plugin to compile

clever relic
#

Any idea how much it would cost to get a simple chrome extension custom made?

glossy lion
#

Sorry if Im just jumping in, but is there ANY way to change the tick rate update from every tick to like every second in Placeholders?

dusty frost
#

PAPI doesn't do updating or caching, that's up to the provider plugin

glossy lion
#

okok!!

hollow arch
#

Hey guys so I have never used the actual plugin on a server but I have made an expansion for it. When I register a placeholder will they be able to use it in configs of other plugins?

#

b % a

#

wait

#

you can just divide?

#

cant

#

ah

#

um

#

what if you subtract b%a from b/a

torpid raft
#

if you want to find how many times a fits into b then as tom said you just divide b by a

#

you're always special to me 😳

torpid raft
#

if you want it to always round up first make sure it is cast to a double so you don't invoke integer division

#

and then call Math.ceiling or whatever to round up

#

||Math.ceil(...);||

drowsy edge
#

hi im very confused on what im doing wrong but I think im checking wrong and I dont know how to fix. heres my code
https://paste.helpch.at/kelubafini.coffeescript
(Also no errors its just sending message on whether or not the player is exsistant or banned)

mighty knot
#

I am trying to figure out how to create textures and custum model data for my server ive read many guides watched msny videos they were all very unhelpful and/or very specific to being for a world and not a server

lyric gyro
#

Hello so im making a Minions Plugin that Mine While in a GUI can anyone help explain how i could do this dont need the code just explain how i would do it much appreciated

hoary scarab
lyric gyro
#

So i could put a Minion in a GUi it will spawn a NPC that will Mine for me and store How much the Specific Minion has mined in x Time then auto sell them after x amount of time

hoary scarab
#

Gonna need NMS to spawn the NPC. And make your own pathing methods.

lyric gyro
#

ok

lyric gyro
hoary scarab
#

I mean if you code it lol. Just continue to check the gui for the item

lyric gyro
#

Thats all i need thank you@hoary scarab

hoary scarab
#

np

dense galleon
#

Am I the only one who is spooked as hell about switching branches in intellij using github

#

I feel like I might lose a bunch of shit when I do

dense galleon
#

Btw

#

Is there any way to merge changes from one branch to another

#

In case I got a release branch and a dev branch, and I made changes to the release one that I need also on the dev one

drowsy edge
proud pebble
#
getPlayer
@Nullable
Player getPlayer()
Gets a Player object that this represents, if there is one

If the player is online, this will return that player. Otherwise, it will return null.

Returns:
    Online player
graceful hedge
#

@dense galleon Yeah

#

IntelliJ has an awesome interface

#

But also it does a great job keeping changes between them

proud pebble
#

so your method wont work.

graceful hedge
#

Like when I had my forge and fabric bisupported mod it was not problem swapping between the two

proud pebble
#

what you could do instead is instead of modifying the player on pardon, modify the player on join to change its maxhealth

#

so have a Set of revived players and then when a player joins see if the player is on that list and if so change their max health to 6 and remove them from the list

#

save the list to file or database so you dont loose them

worn jasper
#

how can I add a dependency to my build.gradle with a local file? (located in libs/JAR)

dense drift
#

fileTree(dir: 'libs', include: ['*.jar'])

worn jasper
#

cause it appears like it didn't work

#

^^ with didn't work I mean that I still can't import anything. For context: I am trying to use Statz's API

dense drift
#

make sure you add compileOnly before

keen nebula
#

Hey, a quick question about CompletableFutures
I have this chained future with 3 parts.
The first part maps maps an event in a wrapper, where I have a lot of utils methods, used later on.
In the second step, I acknowledge I received the event, before starting working on the event.
Then in the third step, I should start to work on the event.
However, I need access to the data the first part returns, not the data the second part returns.
Is there a way to access the returned data from the first future in the third stage?
(The second stage returns a CompletableFuture, which I need to wait on)

public void onButtonClick(@NotNull ButtonClickEvent event) {
    optionsHandler.getSettings(event.getGuild()).thenApply(options -> {
            Ticket ticket = ticketStore.getTicket(event.getChannel().getId());
            return new GuildButtonInteractionImpl(event, options, null, ticket);
    }).thenCompose(Interaction::deferReply)
    .thenAccept(interaction -> {
        ButtonId buttonId = ButtonId.decode(event.getButton().getId());
        Ticket ticket = interaction.getTicket();
        // Do stuff with ticket
        switch (buttonId.getType()) {
        }
    });
}

The hacky solution I can think of, is to store the variable in a final array

public void onButtonClick(@NotNull ButtonClickEvent event) {
    final GuildButtonInteraction[] interaction = new GuildButtonInteraction[1];
    optionsHandler.getSettings(event.getGuild()).thenApply(options -> {
            Ticket ticket = ticketStore.getTicket(event.getChannel().getId());
            interaction[0] = new GuildButtonInteractionImpl(event, options, null, ticket);
            return interaction[0];
    }).thenCompose(Interaction::deferReply)
    .thenAccept(aVoid-> {
        ButtonId buttonId = ButtonId.decode(event.getButton().getId());
        Ticket ticket = interaction[0].getTicket();
        // Do stuff with ticket
        switch (buttonId.getType()) {
        }
    });
}
drowsy edge
trail burrow
#

how difficult is it to set up to check for update feature in plugins?

pulsar ferry
#

There are some utils that you can just copy and it should work straight away

trail burrow
#

I forked a plugin and it has it working already, just need to to see my Spigot page

forest jay
#

any idea on how to spawn a NMS Entity? I have a class that extends EntitySheep and I cant seem to figure out how to get it to show up in the world. It says it is there, with this.getBukkitEntity().getLocation().

lyric gyro
#

how are you spawning it now?

forest jay
#

I am not

#

that is the issue

#

from what i found

#

just doing new EntitySheep(World world); is supposed to work, but it doesnt

lyric gyro
#

eh yeah that's the thing, it's not

#

first you create it, then you add it to the world

#

addEntity or whatever, i don't know spigot mappings

dusty frost
#

new is just the object constructor

#

that doesn't add it to the world

forest jay
#

yeah that is what I was thinking

drowsy edge
#

so im checking with

 if (deadnames.contains(args[0])) {

(deadnames declaration)

    public static List<String> deadnames = new ArrayList<>();

and im turning the player's name into a player with

Player target = Bukkit.getPlayer(args[0]);
if(target == null) {
  player.sendMessage("something is wrong");
  return false;
}

But if i run a command which adds the player's name, then I run this command it just sends nothing and gives no error nor does target if sends a message so im confused.

shell moon
#

What?

#

What are you trying to do in first place

drowsy edge
#

like when you do /revive <name> and if the player is "dead" then it removes the player's name from the list and it allows them to rejoin

shell moon
#

that's weird

#

anyways, 1) use uuid
2) is this for a "minigame" or survival?

proud pebble
#

also id recommend that you dont store all dead players, since when they die they are banned.

#

which stores the players already

#

storing a set of players waiting to be revived is something you should store.

shell moon
#

he is probably doing that

#

i mean, if player leave, then player is removed ( i guess)

#

at least thats what my plugin do

forest jay
#

is there a way to make a hologram (aka a armor stand with a nametag) have the nametag static, like not move with the player?

#

maybe with NMS?

forest jay
lyric gyro