#help-development

1 messages · Page 841 of 1

lost matrix
#

Ah yes. Mojang fkery.

hushed spindle
#

wdym dont know how to get the name

#

its an enum isnt it

lost matrix
#
    net.minecraft.world.entity.EntityType<?> nmsType = net.minecraft.world.entity.EntityType.BEE;
    ResourceLocation resourceLocation = net.minecraft.world.entity.EntityType.getKey(nmsType);
    String path = resourceLocation.getPath();
    EntityType bukkitType = EntityType.valueOf(path.toUpperCase());
cinder abyss
#

it's harder than "just getting the name" x)

lost matrix
#

*If the enum names are matched

#

But there is probably a better way. I just eyeballed this from the src code.

cinder abyss
#

maybe but I think no

lost matrix
cinder abyss
hushed spindle
#

caching literally just means to store your method params and their outputs in a map or something so its in memory

#

and to return that cached value if it exists

cinder abyss
#

do you have any example?

hushed spindle
#

so in this case you'd be making a

Map<net.minecraft.world.entity.EntityType<?>, EntityType> cache = new HashMap<>()
cinder abyss
#

okay I see

#

so I just need to iterate through every EntityType nms?

#

and store them in this map?

river oracle
#

that conversion method does absolutely 0 reflection

hushed spindle
#

in your method do

if (cache.containsKey(nmsType)) return cache.get(nmsType);
// do your thing
cache.put(nmsType, actualType);
return actualType;
river oracle
#

you're just moving the store point in memory from one point to another

hushed spindle
#

oh yea you right

#

turned my brain off there

river oracle
# cinder abyss starting getting big 💀 https://paste.md-5.net/eranunahov.java

please organize your classes properly

    public static EntityType getEntityTypeFromNms(net.minecraft.world.entity.EntityType<?> nmsType){
        ResourceLocation resourceLocation = net.minecraft.world.entity.EntityType.getKey(nmsType);
        String path = resourceLocation.getPath();
        return EntityType.valueOf(path.toUpperCase());
    }``` putting this method in your reflection class is heavily missleading
#

as the stunning lack of reflection it does

lost matrix
# cinder abyss any tutorial to caching?
  private static final Map<Class<?>, Map<String, Field>> FIELD_CACHE = new HashMap<>();

  public static <T> Object getValue(T instance, String fieldName) throws NoSuchFieldException, IllegalAccessException {
    Map<String, Field> fieldMap = FIELD_CACHE.computeIfAbsent(instance.getClass(), clazz -> new HashMap<>());
    Field field = fieldMap.computeIfAbsent(fieldName, name -> {
      try {
        Field declared = instance.getClass().getDeclaredField(name);
        declared.setAccessible(true);
        return declared;
      } catch (NoSuchFieldException e) {
        throw new RuntimeException(e);
      }
    });
    return field.get(instance);
  }

This basically reduces the field reading to 2 map lookups for every reading after the first one.

river oracle
#

I wouldn't

hushed spindle
#

not necessary no

river oracle
#

do as 7smile7 suggested

cinder abyss
#

okay thanks

#

Let's convert every method

#

@lost matrix

lost matrix
cinder abyss
#

(I switched directly after sending my message the field to the top)

dusky prawn
#

How do i make a cooldown on 10 minutes, with this code:


    private final Plugin6 plugin;

        public SpawnCommand(Plugin6 plugin) {
            this.plugin = plugin;
        }
    @Override
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) {

        if (sender instanceof Player){
            Player player = (Player) sender;
            Location location = plugin.getConfig().getLocation("spawn");

            if (location != null ){
                player.teleport(location);
                player.sendMessage(Colorize.color("&fDu blev &ekørt &ftil &espawn&f."));
                player.playSound(player.getLocation(), Sound.BLOCK_BELL_USE, 10, 10);
                // Lav cooldown(15 min)
                // Gør så det koster penge
            }else{
                player.sendMessage(Colorize.color("&fLokationen er &cikke &fblevet sat. Kontakt en Admin"));
                System.out.println("PLUGIN6: Der er intet spawnpoint sat.");
            }
        }```
#

And how do i do, so when you join the server, you spawn at the location i've made, in that code?

quaint mantle
dusky prawn
#

Nice, how then?

quaint mantle
#

Thats all you have to learn

orchid trout
#

what exactly are you trying to do?

glass mauve
#

is Hibernate used in combination with plugins and is it recommended if working with a database or should I look at smth else?

remote swallow
#

it can be used with plugins but id recommened doing something lighter

glass mauve
#

for example? also I use Hikari with PostgreSQL if thats important

remote swallow
#

manually writing the sql if you dont have too many things you store, or something like orm lite

eternal night
#

half the time, plain JDBC calls suffice honestly

#

otherwise, look into e.g. jooq

remote swallow
#

wait

#

i can english

glass mauve
#

ok thanks :D

subtle tapir
eternal night
#

You are trying to add a new class from decompiled

#

what class do you want to edit

subtle tapir
#

oh sorry, i corrected the link

tender shard
#

ok what exactly do you mean with point 3?

eternal night
#

Copy the selected file to the src/main/java/net/minecraft/server folder in CraftBukkit.

subtle tapir
#

Do i have to copy only the server package or the complete net/minecraft into src folder?

eternal night
#

you generally have to copy nothing unless you want to edit a class that does not yet have a patch

#

what nms class do you want to edit

subtle tapir
#

But as i created a pr for fixing the docs. another option was suggested

eternal night
#

Yea, but that is not in an NMS class

#

that is in a craftbukkit class

#

that is alreaddy there

#

the entire section "Making Changes to Minecraft" is only needed if you want to edit a class from the mojang server that has no current changes from craftbukkit

subtle tapir
#

So is it normal that the whole project is errored aout in NetBeans?

eternal night
#

did you apply patches

subtle tapir
#

ahhh i forgot that

eternal night
#

yea, that is the first step

subtle tapir
#

I was thinking that those two sections dont depend on each other

timid berry
#
package org.example;

import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;

public class events implements Listener {

    @EventHandler
    public void onPostLogin(PostLoginEvent event) {
        for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) {
            player.sendMessage(new TextComponent(event.getPlayer().getName() + " has joined the network."));

        }
    }

}

how can i make the server say it instead of the player? the "has joined " part

rough drift
#

plugin messages are your own custom data proxy <-> server

timid berry
#

i ment

#

in the console

#

the bungee console

#

is there a way i can do something with the output? like if the output mataches a string, it will do something

remote swallow
#

output of what

subtle tapir
timid berry
#

the out put of the command

#

@remote swallow

#

like

#
package org.example;

import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;

public class events implements Listener {

    @EventHandler
    public void onPostLogin(PostLoginEvent event) {
        for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) {
            player.sendMessage(new TextComponent(event.getPlayer().getName() + " has joined the network."));
            String namses = event.getPlayer().getName();
            String commandcheck = "domain " + namses;
            ProxyServer.getInstance().getPluginManager().dispatchCommand(ProxyServer.getInstance().getConsole(), commandcheck);
        }


    }

}
remote swallow
#

what

#

i mean sure but idk why a name would be like that

timid berry
#

what

#

its running the command

#

/domain {user}

#

i want it so

#

it will kick the player

#

with reason

#

"this domain is not allowed"

remote swallow
#

uh

timid berry
#

lmao

remote swallow
#

sure

#

ideally you wouldnt be wanting to check the result of a command like that

#

you would have a method the command just calls

timid berry
#

everyplayer has a domain

#

but i will kick players with bad domain

remote swallow
#

are you talking about their host ip?

timid berry
#

no

#

the command /domain is from another plugin

remote swallow
#

does said plugin have an api?

timid berry
#

prolly not

remote swallow
#

what plugin is it

timid berry
#

blud

#

its complicated

#

is it possible to get the response from the command

remote swallow
#

yes but that is most likely bad design

timid berry
#

just tell me how to do it

remote swallow
#

run the command as console and listen to the logs

#

which you shouldnt have to do, almost ever

timid berry
#

oh aight

#

the plugin has an api folder in its source

#

maybe i can get the response from there

remote swallow
#

name the plugin

timid berry
#

its too sketchy

remote swallow
#

just say it

timid berry
#

nvm the api folder has no mention of said domain

remote swallow
#

if you dont want to say it here dm it me and ill check if it has an api you can use

timid berry
#

na its fine i dosent have one

remote swallow
#

somehow im doubting that

timid berry
#

getLatestLogEntry

#

what does this do?

remote swallow
#

where is the method

timid berry
#

i dont know

#

where can i find methods?

remote swallow
#

so how do you expect me to know what it does

lament tree
#

💀

timid berry
#

yah

#

where can i find methods?

remote swallow
#

what are you trying to copy

timid berry
#

i just found some weird guide

remote swallow
timid berry
#

is there documentation on it

remote swallow
#

does it haev anything before it

#

eg something.getLatestLogEntry

timid berry
#

no

#

i made it up

#

now

#

is there a website for documentation

#

for the different methods

remote swallow
#

no

#

because thats a custom method

#

you make it

timid berry
#

right

#

is there a website for the regular methods

remote swallow
#

yes

#

?learnjava!

undone axleBOT
timid berry
#

i ment the

#

uh

#

bungeecord methods

remote swallow
#

?jd-bc

timid berry
#

okay

#

so for the log file thing

#

i would make the plugin

#

open latest.log

#

and see if the last output

#

matches what i want

#

right

remote swallow
#

no you would probably want to read the print stream

#

why are you so scared of just saying the plugin name

remote swallow
#

just dm me the plugin name

timid berry
#

na its fine

#

ill read the output stream

remote swallow
#

you keep just making this an xy issue

timid berry
#

lemme make a spigot thread

remote swallow
#

you confuse me so much

timid berry
#

cant i do

#

String consoleOutput = dispatchCommandAndGetOutput(ProxyServer.getInstance().getConsole(), commandCheck);

#

and then check the varibles match

#

rip

remote swallow
#

you are making this so much harder bt just not saying the plugin name

#

dont even have to say it here

timid berry
#

bro im gonna get banned

remote swallow
#

dm it me

timid berry
#

its for cracked minecraft stuff

ivory sleet
#

:(

timid berry
#

:(

#

yah anyways

#

it dosent have an api

#

for domain checker

#

so idk how i can get the output of the /domain command

#

and do something with it

#

damn

proud badge
dry hazel
#

what does DiscordExecutor#executeDiscord do?

echo basalt
#

yikes this hurts to read

river oracle
#

it causes discord

river oracle
river oracle
#

Legacy with text components too

remote swallow
proud badge
quaint mantle
#

Io blocking

quaint mantle
#

nvm im dumb

inner mulch
#

Are noSQL databases better than mySQL databases? Or what are the pros and cons of both?

quaint mantle
proud badge
#

no because im looping different objects

quaint mantle
#

no

#

for (Player online : Bukkit.getOnlinePlayers()) {
if (online.hasPermission("griefalert.use")) {
online.spigot().sendMessage(alertComp);
}
}

#

duplicate code fragment

ivory sleet
#

I assume you mean mongo by nosql?

quaint mantle
#

it hurts my eyes to even read that sh!t

inner mulch
ivory sleet
#

The big advantage with mysql is that u can query just a single field of data from a specific user

#

I guess data analysis can be easier with mysql, altho there are tools to do with mongo as well

inner mulch
#

May I ask, whats your favourite?

ivory sleet
#

I don’t have a favorite

#

I believe all these database tools like mongo, postgre, cassandra, google spreadsheet (yes lol) and redis have different usecases

inner mulch
#

Isnt mongo better, if i dont want to create a new table for every single thing, because i huess you can just add data in an unorganized DB?

ivory sleet
#

I mean if you only care about storing blobs of data for each user persistently, then yeah mongo prob is fine

inner mulch
#

Or for saving the bans of a player as everyone has a different amount of prior bans, with SQL you would need a new row each time?

ivory sleet
#

you mean like logging previous bans?

opal elbow
#

I use Maven, and therefore, I built my own Spigot on version 1.20.2. However, I am unable to find any methods related to packets. My Maven configuration looks like this:

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.20.2-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>```
inner mulch
ivory sleet
#

Mongo is fine

shadow night
inner mulch
opal elbow
shadow night
opal elbow
chrome beacon
#

?nms

chrome beacon
#

as for packet libraries look at ProtocolLib or PacketEvents

opal elbow
#

Thank you

cinder abyss
#

Hello, how can I check if there is grass between two entities?

chrome beacon
cinder abyss
cinder abyss
chrome beacon
#

The one you want to use / fits your use case

cinder abyss
chrome beacon
#

both do

cinder abyss
#

idk if I need to select one in bukkit world, or one in bukkit player...

chrome beacon
#

Depends on what your goal is

cinder abyss
#

I told you x)

#

to check if there is grass between two entities

#

a player and a LivingEntity

chrome beacon
#

Why do you need to check if there's grass between two entities

cinder abyss
chrome beacon
#

Yeah had a feeling that was the case

#

use the player one

cinder abyss
#

x)

#

okay thanks

cinder abyss
#

Hello, how can I get player weapon damage and if the player is reloading his weapon?

quaint mantle
#

Does anyone here casually have all the entities head sizes?

#

not me

inner mulch
#

Are you talking about bows?

cinder abyss
#

also axes

inner mulch
#

wdym by reloading then?

cinder abyss
#

this

inner mulch
#

hm, im not sure about this one sorry

cinder abyss
#

okay

#

maybe it's clientside

inner mulch
#

but you can get the damage on the EntityDamageEntityEvent

#

i think

cinder abyss
remote swallow
#

that is recharging the crit attack cooldown

inner mulch
#

ok

cinder abyss
vocal cloud
#

There is an arm cooldown not sure if spigot has a method for it

cinder abyss
#

So, according to 1.9+ pvp system, how can I make a method to deal damages to an entity based on player's weapon attack damage and attack cooldown? (if cooldown is charged, the player inflict the weapon damage (there isn't critical in this case) and if it isn't, the player inflict the damage when you spam (I think it's 0.5 PV?))

vocal cloud
#

There you go

cinder abyss
#

so I need to get weapon damage

#

does someone know? please

#

I know I need to deal with attributesModifiers and Generic AttackDamage but idk how

subtle tapir
#

Ok i got it myself. The Bukkit API was slightly outdated.

cinder abyss
green plaza
#

Enabled plugin with unregistered PluginClassLoader -> What does this mean? How to avoid that

young knoll
#

128x128

compact hawk
#

does anyone know when doing player.removePassenger

#

i wanna throw the entity in a distance

young knoll
#

Add some velocity to it a tick later

quaint mantle
#

how do i make a normal java event a bukkit event

river oracle
#

what are "normal java events"

#

unless you're talking about swing I don't believe any such things exist

river oracle
#

Step 1. Listen to the event using Log4J's API
Step 2. Create a Bukkit Event that provides the relevant similar data
Step 3. Use the listener you created in Step 1 to call the event you created in Step 3.
Step 4. Profit

quaint mantle
#

which listener

river oracle
#

did a bit of research don't think you can/should use this class

#

doesn't seem like it does what you expect it to

quaint mantle
#

ok what should i use then

river oracle
#

idk I'm not an expert in the Log4j API

quaint mantle
#

i just need a log event

river oracle
#

I highly doubt they have some listenable event that triggers every time something is logged too

#

seems insanely resource intensive for little to no gain

river oracle
quaint mantle
#

i need a log event

river oracle
#

why'

quaint mantle
#

i want one

river oracle
#

?xyproblem

#

whatever

#

?xy

undone axleBOT
quaint mantle
#

i literally just want a log event

river oracle
#

its useless

#

don't

quaint mantle
#

how

river oracle
#

this really screams xy problem

#

"i want one" is not a very good reason

#

a LogEvent in of itself seems pretty useless too

quaint mantle
#

why should there be a reason

river oracle
#

because if you want to do something like this there should be a reason you want to do it other than "eh i want to ig"

quaint mantle
#

ok but why would you want to know

river oracle
#

because it really seems like xyproblem

#

by knowing x its very likely you don't need to do y

quaint mantle
#

i want a bukkit event that will be called when ever a log gets sent to the console

river oracle
#

why that seems utterly useless

quaint mantle
#

cuz i want it

quaint mantle
#

lol

#

Mixin?

wet breach
#

Just fyi you can always swap out the handler for log levels or register an additional handler etc

#

But you seem to be new so

#

?learnjava

undone axleBOT
sterile flicker
#

how do I make
the net.minecraft(nms) package for 1.16.5 available for use

#

?

wet breach
#

?bootloader

chrome beacon
#

Import the Spigot artifact

wet breach
#

Hmmm forgot the name

chrome beacon
#

After running BuildTools

wet breach
chrome beacon
#

1.16

quaint mantle
chrome beacon
#

Is older than 1.17.1 it has no mojmaps (with Spigot)

wet breach
#

Ah

wet breach
quaint mantle
#

Ok

sterile flicker
#

Can I use something from my mod, meaning, is there something similar when it comes to plugins in terms of custom entities? For example, there's a snake entity, and there's code to draw/animate snake tongue using OpenGL Can this be utilized in a plugin with some resource pack (which I want to create from the mod's assets folder)? However, I also understand that many things may not be supported.

#

So it is possible with nms?

chrome beacon
#

No nms is server side

wet breach
#

Yes just not easy and you need to get creative.

chrome beacon
#

If you're drawing with pure OpenGL you can update to a newer version and use GLSL Shaders in a ResourcePack

#

But yeah it does require you to be creative

sterile flicker
#

where is the buildtools artifact located I can't find the spigot-api folder in the spigot folder

quaint mantle
#

I think they did it with resource pack

sterile flicker
#

and it just didn't end

quaint mantle
#

Anyways hypixel makes their custom pets with resource pack

sterile flicker
#

do I need exactly the artifact in the spigot-api folder to support nms?

quaint mantle
#

Idk what u mean by spigot-api folder. Just download the build tools version u need and run it lol

sterile flicker
#

I have is the core right in the buildtools folder

#

is there a tutorial on this for 1.16.5(nms)?

wet breach
#

No

echo basalt
#

there are mappings for it

#

so just look n learn

sterile flicker
#
        try {
            setArrowCountMethod.invoke(player, amount);
        } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
            e.printStackTrace();
        }
    }``` setArrowsOnEntity(entityPlayer, 20);
#
``` how to update the player state
#

at the moment, the arrows only appear when I shoot myself and yes I use nms

sterile flicker
#

solved: solution is - ```DataWatcher dataWatcher = entityPlayer.getDataWatcher();
int arrowCountIndex = 9;
DataWatcherObject<Integer> arrowCountDataWatcherObject = new DataWatcherObject<>(arrowCountIndex, DataWatcherRegistry.b);

    dataWatcher.set(arrowCountDataWatcherObject, 40);

    PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(entityPlayer.getId(), dataWatcher, true);
    new BukkitRunnable() {
        @Override
        public void run() {
            ((CraftPlayer) p).getHandle().playerConnection.sendPacket(metadataPacket);
        }
    }.runTaskTimer(SumeruBosses.plugin, 20, 20);```
warm mica
peak depot
#

is there an event for when a player has finished downloading the custom server rescource pack

agile hollow
#
    public void onPlayerDeath(PlayerDeathEvent event) {
        Player player = event.getEntity();
        GamePlayers1.remove(player.getUniqueId());
        GameNames1.remove(player);
        if (event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) {
            EntityDamageByEntityEvent nEvent = (EntityDamageByEntityEvent) event
                    .getEntity().getLastDamageCause();

            if ((nEvent.getDamager() instanceof Player)) {
                Player p = (Player) nEvent.getDamager();
                p.sendMessage("Hai assassinato " + player.getName());
                player.sendMessage("Sei stato assassinato da " + p.getName());
                if(GamePlayers1.size()==1) {
                    p.sendMessage("Hai vinto il minigame!");
                }
            }
        }
    }```

why it isn't removing the value in the 2 List GamePlayers1 and GameNames1?
lost matrix
agile hollow
lost matrix
agile hollow
#

for example it send the messages to the 2 players without problems

lost matrix
agile hollow
#

for clone a List from one to another it's like that right? GamePlayers1.addAll(QueuePlayers); Because i'm thinking the problem is here

lost matrix
#

This doesnt remove previous entries. So its not cloning. It simply adds all objects from ListA into ListB

agile hollow
#

because i clear the old list after doing that action

lost matrix
agile hollow
lost matrix
#

?

#

Just show me your command and listener classes pls

#

?paste

undone axleBOT
agile hollow
lost matrix
#

Alright, now the command

agile hollow
lost matrix
#

Field and method names start with lower case characters pls.

agile hollow
#

ok sry

#

i will convert all rn

celest notch
#

for some reason i can't import nms in 1.20.4

wet breach
#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

celest notch
#

im confused how do i change my xml

lost matrix
# agile hollow https://paste.md-5.net/ijisokemeq.cpp

I cant make out the problem.
Check the player names before and after dying.
Btw: Every collection (Lists, Sets, Maps etc) should always be private, final and should have no getter or setter.
That is very important.

lost matrix
celest notch
#

ik thta

#

*that

#

but how do I fix my problem with nms not working

lost matrix
celest notch
#

yes i did

#
java -jar BuildTools.jar --rev 1.20.4 --remapped
lost matrix
#

Then check if your versioning is correct.

celest notch
#

its 1.20.4-R0.1-SNAPSHOT right

lost matrix
#

Let me check

#

1.20.4-R0.1-SNAPSHOT

#

Yeah looks about right

#

Then invalidate caches and restart your IDE

chrome beacon
#

So what nms class are you trying to access

#

in which package

celest notch
#

basically my issue is im missing classes like CraftPlayer

agile hollow
#

@lost matrix ok i make the loop of all the player first and after killing a player and nothing changed from before and after the kill

celest notch
onyx fjord
#

any way to change datapack priority either in server config or thru the api?

agile hollow
#

a done it before and after

lost matrix
#

Wait, show me your JavaPlugin class all together

agile hollow
#

the main class?

lost matrix
#

Sure

#

Im guessing its EnjoyingEvent, right?

agile hollow
#

yes

lost matrix
#

As predicted

agile hollow
#

oh

#

sry

lost matrix
#

All good. Btw a manager class should not be a listener.
You should separate your concerns there 👍

agile hollow
agile hollow
lost matrix
agile hollow
#

oh ok now i understand thx

round finch
#

Fun random fact java has some weird queue class

lost matrix
#

It has a bunch of weird queue classes. And even some quite unknown gem queues for multithreading.

round finch
tall furnace
#

So I've been working on a custom map renderer, but I find that the renderer no longer affects the map once the map is scaled. Also map initialize event is not called when a map is scaled, even though it resets the exploration.

#

How do I detect when a map gets scaled so I can update the renderer?

rotund sun
#

anyone know how to fix this npc im using NPC Utils https://www.spigotmc.org/threads/advanced-npc-util-1-17-packets.512445/

here the error[12:54:56 WARN]: [DeathPro] Task #26 for DeathPro v1.0-SNAPSHOT generated an exception java.lang.NullPointerException: Cannot invoke "java.util.function.BiConsumer.accept(Object, Object)" because "callback" is null at io.github.danielthedev.npc.NPC.setASyncSkin(NPC.java:429) ~[DeathPro.jar:?] at io.github.danielthedev.npc.NPC.setASyncSkin(NPC.java:433) ~[DeathPro.jar:?] at io.github.danielthedev.npc.NPC.lambda$setASyncSkinByUsername$17(NPC.java:409) ~[DeathPro.jar:?] at io.github.danielthedev.npc.NPC$SkinTextures$1$1.run(NPC.java:1058) ~[DeathPro.jar:?] at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[patched_1.17.1.jar:git-Pufferfish-22] at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[patched_1.17.1.jar:git-Pufferfish-22] at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1569) ~[patched_1.17.1.jar:git-Pufferfish-22] at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:495) ~[patched_1.17.1.jar:git-Pufferfish-22] at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1485) ~[patched_1.17.1.jar:git-Pufferfish-22] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1284) ~[patched_1.17.1.jar:git-Pufferfish-22] at net.minecraft.server.MinecraftServer.lambda$spin$1(MinecraftServer.java:321) ~[patched_1.17.1.jar:git-Pufferfish-22] at java.lang.Thread.run(Thread.java:840) ~[?:?]

#
java.lang.NoSuchMethodError: 'void net.minecraft.network.protocol.game.PacketPlayOutEntityDestroy.<init>(int)'
        at io.github.danielthedev.npc.NPC.getEntityDestroyPacket(NPC.java:319) ~[DeathPro.jar:?]
        at io.github.danielthedev.npc.NPC.destroyNPC(NPC.java:113) ~[DeathPro.jar:?]
        at org.firestorm.deathpro.EventListener.DeadBody.lambda$onDeadBody$0(DeadBody.java:36) ~[DeathPro.jar:?]
        at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[patched_1.17.1.jar:git-Pufferfish-22]
        at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[patched_1.17.1.jar:git-Pufferfish-22]
        at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1569) ~[patched_1.17.1.jar:git-Pufferfish-22]
        at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:495) ~[patched_1.17.1.jar:git-Pufferfish-22]
        at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1485) ~[patched_1.17.1.jar:git-Pufferfish-22]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1284) ~[patched_1.17.1.jar:git-Pufferfish-22]
        at net.minecraft.server.MinecraftServer.lambda$spin$1(MinecraftServer.java:321) ~[patched_1.17.1.jar:git-Pufferfish-22]
        at java.lang.Thread.run(Thread.java:840) ~[?:?]```
#

my code ```public class DeadBody implements Listener {

public DeathPro plugin;
public DelayedTask delayedTask;

public DeadBody(DeathPro plugin, DelayedTask delayedTask) {
    this.plugin = plugin;
    this.delayedTask = delayedTask;
}

@EventHandler
public void onDeadBody(PlayerDeathEvent e) {
    Player p = e.getEntity();

    NPC npc = new NPC(p.getLocation(), p.getDisplayName());
    npc.removeFromTabList(p);
    npc.setNameTagVisibility(p, false);
    npc.setASyncSkinByUsername(plugin, p, p.getDisplayName());
    npc.spawnNPC(p);

    NPC.NPCMetaData metaData = npc.getMetadata();
    metaData.setPose(NPC.Pose.SLEEPING);
    npc.updateMetadata(p);

    delayedTask.runTaskLater(() -> {
        npc.destroyNPC(p);
    }, 10 * 20L);
}

}```

peak depot
#

can I somehow get the ProxiedPlayer from LoginEvent

open pawn
#

send your code

chrome beacon
odd turtle
#

Anyone knows how to alter the attack speed of any monster, e.g. zombies ?
Can this only be done using nms?
Should I have a task timer at the desired speed to make it "manually" attack then? <= resource intensive

chrome beacon
#

The attack speed does look hardcoded in to the mob AI

chrome beacon
#

yeah it's from 2012

#

Try not to randomly post things from Google

peak depot
peak depot
chrome beacon
#

and which jar did you use

peak depot
#

shaded

peak depot
#

thanks anways

midnight gyro
#

Hello friends, I'm looking for a dev who knows how to program using JDA api, I know there's a specific area to hire devs, but I don't know where, can anyone lend a hand?

chrome beacon
#

?services

undone axleBOT
midnight gyro
#

thanks bro

peak depot
#

In the plugin yml can you only use x.x.x or can I do smth like 23w52a

chrome beacon
#

For what?

peak depot
#

version

chrome beacon
#

Your version can be anything but I do recommend following semantic versioning

sterile flicker
#

it is impossible to use GL11 drawing methods in spigot?

rough drift
#

Is the spigot server the client

#

it doesn't even have LWJGL as a dependency

sterile flicker
#

I have a tileentity in my forge mod that creates rotating nbt crystal around an entity and I want to make the same one in a spigot

#

Is there really no way?

rough drift
#

you can summon an entity with nbt data and render it with the mod

#

but you can't in spigot

sterile flicker
sterile flicker
#

so I cant do something close to that?

rough drift
#

... you can?

chrome beacon
#

The server cannot render stuff

rough drift
#

What part of "you can summon an entity with custom nbt data and render it with your mod" is unclear

chrome beacon
#

Rendering happens on the client

rough drift
#

^

sterile flicker
#

can I draw something with texture pack?

#

although it just sets the textures

peak depot
#

for nms how can I do create a ClientInformation for an NPC thats my code so far```java
package eu.hylix;

import com.mojang.authlib.GameProfile;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.v1_20_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;

import java.util.UUID;

public class CreateCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
if(sender instanceof Player player) {
CraftPlayer craftPlayer = (CraftPlayer) player;
ServerPlayer sp = craftPlayer.getHandle();

        MinecraftServer server = sp.getServer();
        ServerLevel level = sp.serverLevel().getLevel();
        GameProfile gameProfile = new GameProfile(UUID.randomUUID(), "Billy Bob"),


        ServerPlayer npc = new ServerPlayer(server, level, gameProfile, );
    }
    return false;
}

}

sterile flicker
#

if there was something that would allow you to draw on the client side on spigot server

rough drift
#

it's literally not a thing

#

I mean I know how to do something similar

chrome beacon
rough drift
#

but uhhh... work secret ;-;

chrome beacon
#

You can use shaders to draw stuff

sterile flicker
chrome beacon
#

Yeah I'm aware

sterile flicker
chrome beacon
#

They can contain shaders

quaint mantle
#

If I rotate a DisplayEntity through the Transformation, 180 degrees (degrees to radians), it does in fact rotate 180 but the issue is that it also modifies the y translation.

How may I rotate any axis (x,y,z) without affecting translation?

sterile flicker
#

or do I have a wrong understanding of this

chrome beacon
#

Packets just send basic information like: There is a zombie at x,y,z

#

The client then renders a zombie at that location

quaint mantle
peak depot
#
    public class CreateCommand implements CommandExecutor {
        @Override
        public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
            if(sender instanceof Player player) {
                CraftPlayer craftPlayer = (CraftPlayer) player;
                ServerPlayer sp = craftPlayer.getHandle();

                MinecraftServer server = sp.getServer();
                ServerLevel level = sp.serverLevel().getLevel();
                GameProfile gameProfile = new GameProfile(UUID.randomUUID(), "Billy Bob");
                ClientInformation info = new ClientInformation("de", 1, ChatVisiblity.FULL, true, 2, HumanoidArm.RIGHT, true, true);

                ServerPlayer npc = new ServerPlayer(server, level, gameProfile, info);

                ServerGamePacketListener ps = sp.connection;
                ps.

            }
            return false;
        }
    }
``` there was .send for ps but now no longer anybody know what it is now?
chrome beacon
#

Look at Mojangs code

peak depot
#

you got a link for me?

chrome beacon
#

It's in your IDE

#

Look at the nms classes and see how Mojang uses them

peak depot
#

how can I see where its used?

#

I use IntelliJ

chrome beacon
#

The Spigot tooling isn't great for that but you can probably guess

peak depot
#

what would you recommend then

chrome beacon
#

A modding environment will probably work better

#

Personally I just use my mod project to quickly view decomp sources

south mason
#

I'm writing a plugin for my own chat and would like to add PAPI support, how can this be implemented?

quaint mantle
chrome beacon
#

check the documentation

odd turtle
odd turtle
chrome beacon
#

it's up to you

odd turtle
#

Right well with nms, how would I do that? I can't seem to find any up to date 'documentation' or examples

chrome beacon
#

nms is undocumented

#

Which is why it's more of an advanced topic

#

You need to be able to read the decompiled code and figure out what it does

#

In your case it really isn't that hard, just look at the attack goal and how it's stored in the entity

#

oh and when you're asking for help with nms it's very important that you specify the exact version you need help with

#

and the more details you can provide the better

odd turtle
#

Right thanks, I'll figure it out, thank you for your time

quaint mantle
#

Because of obfuscation some methods and fields might be also different between versions, I usually check older versions and try to find references to find the new name

river oracle
#

mojmaps 💪

glass chasm
#

Im trying to intercept the biome array from the map_chunk packet type in protocol lib in 1.19.2. Has anything changed in the library because there isnt an bytearray in the packet

chrome beacon
#

Messing with chunk data is a pain to do

#

wiki vg should contain the protocol information you're looking for

somber night
#

im trying to make a custom item made with another custom item, this worked using glass porions instead of arrows, am i missing something? https://paste.md-5.net/ugujitafeh.cs
forgot to say the problem, my bad: It wont let me craft the new item

kindred trellis
#

how do i hide player from playerlist? i tried:
player.setCustomName(null);
player.setPlayerListName(null);
player.setDisplayName(null);
and none of this is working

chrome beacon
#

That requires some packet trickery

#

or if you want to hide the player entierly you can use the hidePlayer method

kindred trellis
chrome beacon
#

You'd send the player info remove packet

#

using nms or your packet lib of choice

kindred trellis
#

thanksss

#

i dont have PacketPlayOutPlayerInfo what do i do to be able to use that?

carmine mica
#

exact choice doesn't work on spigot for shapeless recipes

somber night
#

it worked on a different item though

carmine mica
#

what is tpItem?

somber night
#

a custom item that also works

carmine mica
#

right, but do other items of the same type also work in its place?

somber night
#

tpItem is a netherstar, if thats what you mean
and no, others dont work

carmine mica
#

what server are you running?

#

do /version and show the output

somber night
#

This server is running Paper version git-Paper-81 (MC: 1.19) (Implementing API version 1.19-R0.1-SNAPSHOT) (Git: 86f87ba)
You are running the latest version

chrome beacon
#

._.

carmine mica
#

yeah, they work on paper, they don't work on spigot (which is why I italicized spigot earlier)

somber night
#

a

#

my bad then i guess

sterile flicker
#

is there the same extension id("xyz.jpenilla.run-paper") only for the spigot, I just have the error com.destroystokyo.paper.exception.ServerInternalException: Attempted to place a tile entity (com.sumeru.bosses.tileentity.TileEntityBaseBeehive@a0b5175) at 0,0,0 (Block{minecraft:air}) where there was no entity tile! [20:50:19 WARN]: Chunk coordinates: -16,-240 [20:50:19 WARN]: although I am sure that it is not related to the paper but to an error in the code, but I want to fully use the spigot to get support here

chrome beacon
sterile flicker
# chrome beacon Looks like you forced a tile entity where there shouldn't be one

code: ```package com.sumeru.bosses.tileentity;

import net.minecraft.server.v1_16_R3.Entity;
import net.minecraft.server.v1_16_R3.IBlockData;
import net.minecraft.server.v1_16_R3.TileEntityBeehive;

import java.util.List;

public class TileEntityBaseBeehive extends TileEntityBeehive {

public TileEntityBaseBeehive() {
}

@Override
public void addBee(Entity entity, boolean flag) {
    super.addBee(entity, flag);
}

@Override
public List<Entity> releaseBees(IBlockData blockData, ReleaseStatus releaseStatus, boolean force) {
    return super.releaseBees(blockData, releaseStatus, force);
}

}``` WorldServer nmsWorld = ((CraftWorld) world).getHandle();
nmsWorld.setTileEntity(Teleportation.getPlayerBlockPosition(player), new TileEntityBaseBeehive());

#

I do not know how it works as there are very few tutorials on this on the Internet

cinder abyss
#

Hello, how can I get weapon attack speed? (directly from his modifiers, not from Material modifiers)

chrome beacon
#

Not sure what you want me to do

sterile flicker
#

but I'm creating a tile entity right on the player's coordinates to see what it is in general. I expect to see a beehive

sterile flicker
#
        Location location = player.getLocation();

        int x = location.getBlockX();
        int y = location.getBlockY();
        int z = location.getBlockZ();

        return new BlockPosition(x, y, z);
    }```
carmine mica
#

what on earth are you trying to do with a custom tile entity?

chrome beacon
#

only bee hive can be a bee hive

sterile flicker
carmine mica
#

yeah, tile entities can only exist at locations that have the correct block type

#

a chest tile entity can only exist at the location of a chest

chrome beacon
sterile flicker
#

So how do I summon him correctly

chrome beacon
#

Why are you making your own tile entity

sterile flicker
chrome beacon
#

how else what

sterile flicker
#

sorry translator

#

how otherwise?

chrome beacon
#

what are you trying to do

chrome beacon
#

?

#

What is the goal

sterile flicker
#

to understand what a tile entity is and what can be done with it, since I'm making a plugin for mobs and maybe it will come in handy somehow

chrome beacon
#

a tile entity is a block that contains extra data

cinder abyss
#

I get an empty list

sterile flicker
cinder abyss
chrome beacon
sterile flicker
chrome beacon
#

Spigot has api for that

peak depot
chrome beacon
#

It's not a real player

peak depot
#

but how would I spawn it in then?

chrome beacon
#

If you're just copy pasting npc code from the internet you might as well just use an NPC lib like Citizens

peak depot
#

ps.send(new ClientboundAddEntityPacket(sp)); thats line 40

sterile flicker
chrome beacon
#

why you ask, because it's not a real player

#

so nothing is connected to it

echo basalt
#

you gotta fake a connection

sterile flicker
echo basalt
#

don't ask why

#

the packet seems to get some data from the connection

peak depot
#

CraftPlayer craftPlayer = (CraftPlayer) player;
ServerPlayer sp = craftPlayer.getHandle(); but that means sp has a connection or not

echo basalt
#

now here's the funny ass thing

#

why are you sending the player to itself

chrome beacon
#

I don't know exactly how the tile entity check is implemented

chrome beacon
sterile flicker
echo basalt
#

?tryandsee

undone axleBOT
peak depot
chrome beacon
#

that is the connection variable

peak depot
#

yes but the Real player has a real connection or not?

echo basalt
#

it has

chrome beacon
#

Every real player has a connection

peak depot
#

so why are you telling me that real player doesnt have one

chrome beacon
#

I haven't done that

glass mauve
#

what is the preferred way of parsing a time from command args?
like /command days hours minutes seconds
or just one arg in some specific format?

echo basalt
#

the npc doesn't have a connection

#

it's trying to get data from it on the tab packet

glass mauve
#

thanks

peak depot
echo basalt
#

it would

chrome beacon
#

but why would you do that

echo basalt
#

you need to emulate a fake connection

chrome beacon
#

^^

echo basalt
#

to retain API (plugins sending packets)

#

just make the packets go nowhere

peak depot
#

npc.connection = new ServerGamePacketListenerImpl(server, new Connection(PacketFlow.SERVERBOUND), npc, CommonListenerCookie.createInitial(gameProfile)); does this look about right?

echo basalt
#

extend the class and make your own impl

#

you might be able to pass null a bunch

peak depot
#

all of them have a notnullable

echo basalt
#

I guess that works

peak depot
#

to all set them to null?

echo basalt
#

no

#

your suggestion

#

try and see

peak depot
echo basalt
#

radical ok

#

What if

#

you just make a DummyServerPlayerConnection class

#

that implements the ServerPlayerConnection interface

peak depot
#

but where do I need the ServerPlayerConnection like npc.connection takes ServerGamePacketListenerImpl

echo basalt
#

why does the interface exist

peak depot
#

nah bro fr I dont get it rn

chrome beacon
#

Yeah might want to use Citizens

echo basalt
#

nah

#

this is just annoying

#

but it's doable

chrome beacon
#

ofc it's doable but there's no need to reinvent the wheel

echo basalt
#

it'll probably break api but you can just create the packet in another way and skip the connection entirely

peak depot
#

do you guys know what this.n is? so maby i can trace it back and fix it

echo basalt
#

?mappings

undone axleBOT
echo basalt
grim dock
#

Is it possible to cancel a task created via Bukkit.getScheduler().scheduleSyncRepeatingTask(...) from within the task? It seems like it loops endlessly if I structure my code like this:

private int taskId;

...

this.taskId = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, () -> { ... Bukkit.getScheduler().cancelTask(taskId)}, 0, 5);

My guess is, that I made the usual mistake thinking that taskId is already given the value of the task but this is done after the task executes. Am I right with that?

peak depot
#

Isnt there cancel()?

grim dock
#

Not inside the lamda, no

glad prawn
undone axleBOT
grim dock
#

I think I already found a solution. Instead of Bukkit.getScheduler().scheduleSyncRepeatingTask() I can use Bukkit.getScheduler().runTaskTimer(plugin, new BukkitRunnable() {...}, 0,1)

#

In the BukkitRunnable I can use cancel()

grim dock
#

True

chrome beacon
#

Just read the wiki page ._.

grim dock
glass chasm
chrome beacon
#

Do make sure you select the correct version of the wiki

#

also if you're using protocol lib it will wrap certain data for you

fickle mantle
#

Hey, I was trying to run buildtools for 1.20.4, but I get that Exception: org.eclipse.jgit.api.errors.TransportException: Tag mismatch! I already whitelisted https://hub.spigotmc.org/ to my AV but nothing worked

peak depot
fickle mantle
grim ice
#

WTF is wrong with intellij

#

kept freezing

#

till i somehow fixed it

astral scroll
#

im needing a name

#

for my plugin

#

its utility, so

#

idk

#

how can i create ideas?

#

i tried with AI but nothing

lost matrix
eternal oxide
#

Virus

astral scroll
#

anvm

#

i thought of Flux

#

do i need to declare package on kotlin?

#

literally first kotlin project

lost matrix
dry hazel
#

you can have package-less classes, not recommended though

astral scroll
#

package org.bukkit.inventory lets say

lost matrix
#

Do you mean for imports or your own classes?

eternal oxide
#

his own

#

Java does at teh top

astral scroll
#

yea

lost matrix
#

I mean sure. Declare the package at the top as well.

rough harness
#

anyone know how i could hid the paper but keep the text

chrome beacon
#

Custom item model without a texture?

quaint mantle
#

Is EntityPlaceEvent supposed to be called when you spawn an entity using an egg?

#

Nvm

#

Just read the javadoc

quaint hedge
#

how can i get NeworkManager from PlayerConnection?

#

im trying to create a NPC

chrome beacon
#

sigh not another one

quaint hedge
#

why? its a problem?

chrome beacon
#

I don't mean to be rude, I'm just tired

rough harness
chrome beacon
quaint hedge
#

1.20.4

chrome beacon
#

I'm guessing you're following an outdated guide

quaint hedge
#

something like that

#

i upgraded my server to this version

chrome beacon
#

If you're trying to send a packet it's connection.connection

#

great naming by Mojang on that one

quaint hedge
#

from what i understand i need to create a method call inject that use Channel and later send packets

#

but the problem is to get the Channel from PlayerConnecion

chrome beacon
#

Are you trying to listen to packets?

quaint hedge
#

yes in order to make NPCInteractEvent

chrome beacon
#

Yeah then you need to inject in to the netty pipeline

#

Honestly though just use Citizens it'll save you a lot of time

peak depot
quaint hedge
quaint hedge
chrome beacon
quaint hedge
#

i try to searh in PlayerConnection class

#

and nothing

rough harness
quaint hedge
#

there is no somthing that can help me with NetworkManager

chrome beacon
#

that would be a pain to do

#

?nms

quaint hedge
celest notch
#

Is it possible to use a local path for a resource pack on a server I do not want to depend on hosting sites that may go down

chrome beacon
quaint hedge
#

can you explain me the map unmap thing?

#

i understood its something that very helpful

celest notch
#

how would i do that would i set the path in the config to like

/home/user/resourcepack/resourcepack1.zip

would that work

chrome beacon
celest notch
#

ok how would i do it

chrome beacon
#

You'd run a local web server that can provide the file

chrome beacon
celest notch
#

thats annoying since i want to possibly upload the plugin

#

most users dont know how to do that

astral scroll
#

how do i make

#

a static method

#

on kotlin

#

static fun doesnt work :(

chrome beacon
celest notch
#

YOU CAN DO THAT?

#

oops

chrome beacon
#

yes ofc

dry hazel
quaint hedge
chrome beacon
#

?

quaint hedge
#

or the nms is already mapping?

chrome beacon
#

If you've followed the guide then the mappings are applied

celest notch
#

does the url box in the server.properties support localhost

chrome beacon
celest notch
#

127.0.0.1?

chrome beacon
#

The client needs to know where to download the resource pack from

quaint hedge
#

public static Map<UUID, Channel> channels = new HashMap<>();
private int count = 0;
Channel channel;

    private Channel getChannel(Player player) {
        try {
            PlayerConnection connection = ((CraftPlayer) player).getHandle().c;

            Field GetNetworkManager = PlayerConnection.class.getDeclaredField("h");
            GetNetworkManager.setAccessible(true);

            NetworkManager networkManager = (NetworkManager) GetNetworkManager.get(connection);


// Get the Channel object from the NetworkManager object
            return networkManager.n;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

public void inject(Player player) {

    CraftPlayer craftPlayer = (CraftPlayer) player;
    //Entity Player playerconnection, playerConnection network manager, Network manager channel
    channel = getChannel(player);
    channels.put(player.getUniqueId(), channel);
    System.out.println(player.getDisplayName() + " Added to pipeline");

    if (channel.pipeline().get("PacketInjector") != null) {
        return;
    }

    channel.pipeline().addAfter("decoder", "PacketInjector", new MessageToMessageDecoder<PacketPlayInUseEntity>() {

        @Override
        protected void decode(ChannelHandlerContext channel, PacketPlayInUseEntity packet, List<Object> arg) throws Exception {
            arg.add(packet);
            readPacket(player, packet);
        }
    });
}

this is the code for inject do i use mapping?

celest notch
#

so people would have to enable port forwarding to even use it

chrome beacon
#

yes

#

but that goes for the server too

chrome beacon
#

?nms

quaint hedge
# chrome beacon ?nms

import net.minecraft.network.NetworkManager;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.PacketPlayInUseEntity;
import net.minecraft.server.network.PlayerConnection;

chrome beacon
#

mhm

#

Now add the mappings

quaint hedge
#

how?

chrome beacon
#

?nms

chrome beacon
#

._.

quaint hedge
#

😅

chrome beacon
#

I had to send you that 4 times for you to read it

quaint hedge
#

oops

#

sorry

chrome beacon
#

This is why I sigh every time someone tries to make NPCs

#

It always happens that they ignore advice

quaint hedge
#

i didnt read the message

chrome beacon
#

They all have a meaning

#

You should at least read it once

quaint hedge
#

you are right

timid hedge
#

How do i use a config path in a switch statement?

Im trying to make a kit plugin with 3 ranks, so if you have add to 1 you will see 1 when you use /kit and if you have 2 you will see 2 and so on..
But i want to make so the ranks name can be changed in the config

chrome beacon
#

So why do you need to switch

timid hedge
#

i though i could switch it because i dont know how i should do it in 'if' statements becuase i think it is going to send the message 3 times if you have alle 3 ranks

chrome beacon
#

That doesn't have to be the case

timid hedge
#

I mean how do i make this on a smarter way?

                if(player.hasPermission(Kits.plugin.getConfig().getString("Vist"))){
                }

                if(player.hasPermission(Kits.plugin.getConfig().getString("Vista"))){
                }

                if(player.hasPermission(Kits.plugin.getConfig().getString("Vist+"))){
                }
chrome beacon
#

New name same old icon ig

sullen marlin
#

make an object for each kit

#

then make a kit.hasPermission(Player) method

timid hedge
#

Sorry but i dont understand how to make objects

sullen marlin
#

?learnjava

undone axleBOT
quaint hedge
chrome beacon
tender shard
chrome beacon
#

Did you run BuildTools

tender shard
#

*with --remapped flag

quaint hedge
#

code:
plugins {
id 'java'
id("io.github.patrick.remapper") version "1.4.0"
}

group = 'me'
version = '1.0'

repositories {
maven {
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'

    content {
        includeGroup 'org.bukkit'
        includeGroup 'org.spigotmc'
    }
}
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url = 'https://oss.sonatype.org/content/repositories/central' }
mavenLocal()
mavenCentral()

}

tasks {
remap {
version.set("1.20.4")
}
}

dependencies {
compileOnly 'org.spigotmc:spigot-api:1.20.4-R0.1-SNAPSHOT:remapped-mojang'
compileOnly 'org.spigotmcspigot1.20.4-R0.1-SNAPSHOT:remapped-mojang'
implementation files('D:/Projects Files/Plugins/IdeaProjects/Essential/build/libs/Essential-1.12.jar')
}

and i run the task for remap and i have an error:

Unsupported class file major version 65

#

my JDK is the problem?

chrome beacon
#

Looks like somethings written in Java 21

quaint hedge
#

ya

#

should i use in other version?

chrome beacon
#

?

quaint hedge
#

other version of JDK

chrome beacon
#

if you're depending on something written in Java 21 you need a JDK that understands Java 21

#

so yes

#

oh and try not to use file dependencies like that

#

If you only have a jar then install it in to your local maven repo

chrome beacon
#

^ if you don't plan on using modern Java features

#

or set it to 17 if you want to be on the same version as 1.20.4

tender shard
#

then ?paste the full gradle log pls

quaint hedge
#

oof i HATE NPC

chrome beacon
#

Wait didn't Gradle have problems with Java 21

#

or is that fixed now?

tender shard
#

idk

chrome beacon
#

alr fixed in Gradle 8.5

#

so make sure you have that

quaint hedge
#

i will upgrade

orchid gazelle
#

could I theoretically proxy networking so that I can run the main-server on one server but somehow send chunks from another server so that the main-server does not need the bandwidth to upload chunks to the players?

quaint hedge
chrome beacon
#

Methods won't be called a b c anymore

#

and class names will change

quaint hedge
#

correct

#

now i dont have PlayerConnection

#

i have Connection

tender shard
tender shard
#

?switchmappings

tender shard
#

this explains how to find out the "new" method and class names

quaint hedge
#

niceee

#

ok i will try now to create the NPC

#

wait so EntityPlayer doesnt exist now and i dont find the map of it

chrome beacon
#

ServerPlayer

tender shard
quaint hedge
#

ya now i reading

#

wow its very useful

#

i love it

tender shard
#

because this tells you the name. just do it like explained in the blog post

#

quilt hashed mappings wtf

quaint hedge
tender shard
quaint hedge
#

oh now i see that thanks

tender shard
#

np

quaint hedge
#

the task of remap still doesnt work
Unsupported class file major version 65

and i use now JDK 11

#

def targetJavaVersion = 11
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}

chrome beacon
#

Use JDK 21

quaint hedge
#

i used that before

chrome beacon
#

or remove the library requiring it

rough harness
ivory sleet
#

u either go with src compatibility and target compatibility or the toolchain

#

Idr even if you can use both, but iirc it should give errors

quaint hedge
#

nvm its working the compile but now i have problem when i run it in my server it says it doesnt find ServerPlayer did i forgot something?

chrome beacon
#

That happens when the remapper isn't working

quaint hedge
#

and what could be the problem?

peak depot
#

How can I cancel messages with bungeecord without getting kicked after sending a new message after

quaint hedge
#

something in the compiler?

#

nvm i see now the remap still have the same error and im using JDK 21

quaint hedge
#

yes

#

def targetJavaVersion = 21
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}

chrome beacon
#

What Gradle version?

quaint hedge
#

8.5

chrome beacon
#

pepeshrug then

#

Guess it's Gradle being jank again

ivory sleet
#

still, pretty sure you just go with the toolchain?

quaint hedge
#

what is that?

chrome beacon
ivory sleet
#

Yeah but the other target compatibility and source compatibility is deprecated afaik

quaint hedge
#

plugins {
id 'java'
id("io.github.patrick.remapper") version("1.4.0")
}

group = 'me'
version = '1.0'

repositories {
maven {
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'

    content {
        includeGroup 'org.bukkit'
        includeGroup 'org.spigotmc'
    }
}
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url = 'https://oss.sonatype.org/content/repositories/central' }
mavenLocal()
mavenCentral()

}

tasks {
remap {
version.set("1.20.4")
}
}

dependencies {
compileOnly 'org.spigotmc:spigot-api:1.20.4-R0.1-SNAPSHOT'
compileOnly 'org.spigotmcspigot1.20.4-R0.1-SNAPSHOT:remapped-mojang'
implementation files('D:/Projects Files/Plugins/IdeaProjects/Essential/build/libs/Essential-1.12.jar')
}

def targetJavaVersion = 21
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}

tasks.withType(JavaCompile).configureEach {
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release = targetJavaVersion
}
}

processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}

ivory sleet
#

and using both def isn’t the intention behind the design

quaint hedge
#

this is the full code

chrome beacon
ivory sleet
#

well whats wrong with toolchain?

chrome beacon
#

It forces the compiler to use a certain Java version

#

Which means you can't depend on Spigot nms with a Java 8 plugin

ivory sleet
#

I mean I’m pretty sure you can with some fiddling around the toolchain

quaint hedge
chrome beacon
#

You didn't follow the instructions of the remapping plugin

quaint hedge
#

i will see again

ivory sleet
#

For instance olivo, its possible to set the compiler on certain tasks if you need to override it (like specify java version etc)

chrome beacon
chrome beacon
quaint hedge
#

thats what im tring to do

#

i run the remap first

#

and then i get the error

chrome beacon
quaint hedge
#

i dont understand what did i miss
i add the remap
i build the buildtools with remap

chrome beacon
chrome beacon
#

Gradle always breaks for me so idk

ivory sleet
#

According to docs

chrome beacon
#

Wouldn't that force it to use Java 8 JDK for compiling

ivory sleet
ivory sleet
chrome beacon
#

which would break it depending on a Java 17 lib

chrome beacon
#

Needs to be a Java 17 JDK so it can reference the lib correctly

ivory sleet
proud badge
#

Do you guys think logging left and right clicks in a database (including the player's held item) is gonna take up lots of storage? The reason is CoreProtect logs a lot of stuff, but it doesnt log everything. I plan on making a plugin that logs things that coreprotect doesnt.

ivory sleet
#

I mean you have compile time dependence and runtime dependence

#

Which both break differently depending on what u do wrongly

chrome beacon
#

Yeah the compiler doesn't like you referencing a class written in a newer java version

ivory sleet
#

Isn’t the ABI conserved?

chrome beacon
#

ABI?

ivory sleet
#

Application binary interface, yk the binary compatibility

chrome beacon
#

No I don't think so

#

but I could be wrong

ivory sleet
#

Cuz I know I’ve been doing fine with compiling down to lower versions while depending on libs with higher java versions

#

So it should be possible, well unless gradle broke recently

ivory sleet
chrome beacon
ivory sleet
#

I could see this happening if you shade the lib

#

Maybe its possible to manage with for instance shadowJar (tho in their case they don’t really have a use for shadowJar presumably)

chrome beacon
ivory sleet
#

Gradle is gradle after all 🥲

chrome beacon
wet breach
ivory sleet
#

Yeah but maybe gradle or whatever thing on gradle fallbacks on the other option :>

wet breach
#

Well runtime compiling is something you have to implement yourself. Not sure if newer jdk versions have this yet

#

Basically you keep the sources that are version dependent in a separate jar or archive and compile at runtime for the version being used

#

Since jre and jdk are no longer separate this is more doable then previously

proud badge
#

In the "aliases" part of my command in my plugin.yml do I need to include the /?

eternal oxide
#

no

proud badge
#
    public void onEnable() {
        getLogger().info("A");
    }``` Is this correct?
#

or do I need to use getPlugin().getLogger() instead?

young knoll
#

That’s fine

lean pumice
#

?paste

undone axleBOT
lean pumice
proud badge
#

ok and if I want to use it in an external class? I cant seem to be able to use it in a static context

young knoll
#

?di

undone axleBOT
young knoll
#

Or just make a static variable for it

#

It’s just the logger

lean pumice
#

i have resolved

proud badge
pseudo hazel
#

the message you send

lean pumice
proud badge
#

ah so not counting the message its the same?

lean pumice
#

this. is like a getInstance

lean pumice
proud badge
#

epic

pseudo hazel
#

yeah

proud badge
#

I understand now

tough mica
#

does anyone have any idea why the item changes after a rejoin?

#

i use this itembuilder: "dev.triumphteam:triumph-gui:3.1.2"

lost matrix
#

?nocode

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

proud badge
#

Is there an event for when a player throws an ender pearl?

young knoll
#

ProjectileLaunchEvent

proud badge
#

And how could I determine if it was an ender pearl? I see there is a getEntity but is this for the player who launched it or the projectile itself?