#development

1 messages · Page 46 of 1

dusky harness
#

like in PDC

dark garnet
#

no i meant all the data on the item to be a Map<String, String>

#

like if u were to get all the item's data it'd be in a Map<String, String>

#

ex with lore:

key1: value1
key2: value2
dusky harness
#

wait wdym

#

registered twice?

#

why dont u track which enchants were registered?

dark garnet
#

once an enchantment is registered, it's name is stuck (so it's data value can never be altered)

#

and even if it was able to be changed, it'd be changed for every item (or just break lmao)

warped hill
#

If you’re using a Map then you won’t be able to route two values to a key. That’s literally what the map is specifically built to NOT let you do.
If you want two items to have the same “key” and “value” pair use something like a List<Map.Entry> or make your own custom class and use a List<CustomClass>.
From there just search for what you need using .stream().filter() or sm

lyric gyro
#

my server is.. crashing for some reason can anyone help?

river solstice
icy shadow
dark garnet
#

Each item basically has its own map (in a form of enchantments)

dark garnet
dark garnet
#

Just using nbt api now, don’t think enchantments would work in the long run

proud pebble
#

tbh i avoided using the normal enchant registering and used nms to create nbt data manually

#

not pike the enchants would be visible anyways since the tooltip doesnt show any enchants that arent registered on the client side

#

like

west socket
#

Yeah I wouldn’t use the vanilla system

dark garnet
#

But in the future I might look into it’s source code and just remake it myself (probably not lmao)

dusky harness
dark garnet
dusky harness
#

O

dark garnet
#

Like I do with bstats

dusky harness
#

So if they already have nbt api shaded

#

They just have to deal with 2 nbt apis?

#

Or

dark garnet
#

It might conflict tbh

#

Idk y they would do that tho

dusky harness
dark garnet
west socket
#

I'm trying to spawn a custom nms entity into the world, but nothing spawns if there is no player nearby, even though the server has the chunk loaded

#

Anyone know why this might be?

icy shadow
#

show code

west socket
#
EntityManager.registerEntity("PitBlaze", 61, CustomPitBlaze.class);

        World nmsWorld = ((CraftWorld) spawnLocation.getWorld()).getHandle();

        CustomPitBlaze blaze = new CustomPitBlaze(nmsWorld);
        blaze.setLocation(spawnLocation.getX(), spawnLocation.getY() + 5, spawnLocation.getZ(), 0, 0);

        System.out.println(nmsWorld.addEntity(blaze));```
#

They spawn on plugin start. If I reload in the general area, they spawn

#

If I reload in the spawn area and tp to the chunks

#

Theres nothing there

#

Everything works fine for the vanilla mobs

tardy beacon
#

hi, could anyone help me out with Bungeecord?

west socket
tardy beacon
west socket
#

Using it as in developing with its api, or just using it on a network?

tardy beacon
#

um.. what?

west socket
#

Ok I’m just going to assume you’re using it normally then

tardy beacon
#

yeah, probably.

west socket
#

So run me through what you’re trying to do

tardy beacon
#

I'm trying to get on the server, but when i connect it just kicks me for "Kicked whilst connecting to lobby: You are already connected to this proxy"

west socket
#

Hmm, either the proxy is frozen or your internet is really bad

#

I assume that you aren’t already on the server on your client?

tardy beacon
#

I am not

west socket
#

Type /Glist into the bungee console

#

Or without the slash

tardy beacon
#

Total players online: 0

west socket
#

And it’s still giving you that message?

tardy beacon
#

yes

west socket
#

Does it show you attempting to join in console?

tardy beacon
#

yes

west socket
#

I don’t see how that could happen, try restarting it

tardy beacon
#

well it says

19.05 21:25:40 [Server] [INFO] [Jeetic] disconnected with: Kicked whilst connecting to lobby: You are already connected to this proxy!
19.05 21:25:40 [Server] [INFO] [Jeetic] -> UpstreamBridge has disconnected

tardy beacon
west socket
#

Check your lobby console

#

See if it says anything

tardy beacon
#

my lobby console?

west socket
#

Yeah, tell me if it shows you attempting to join

tardy beacon
#

i dont have a lobby console

#

this is the only console I have

#

maybe thats the problem.. :/

west socket
#

What server are you trying to send the people to?

tardy beacon
#

the Bungeecord server

west socket
#

Bungeecord isn’t a Minecraft server

#

It’s just proxy software

tardy beacon
#

:|

west socket
#

It doesn’t actually create any joinable world

#

It’s only used to seamlessly move players inbetween servers

tardy beacon
#

oh.

dusky harness
#

bungeecord lets you connect multiple servers with only 1 ip (basically)

tardy beacon
#

so that means I need to pay for multiple servers?

west socket
#

Still not sure why that error would occur though

dusky harness
#

do you have a playerbase yet?
I'd recommend just using 1 server until you build up a playerbase

#

theres always plugins such as Multiverse which lets you make multiple worlds

tardy beacon
#

or could I host a Bungeecord server on my computer and then host the "lobby" server on the host im using

dusky harness
#

yeah but ping might be high

#

and u should setup tcpshield if so

#

it's rare but someone might want to ddos or act like they know where you live and scare/threaten/etc

west socket
#

If you’re trying to have a multi-server network, using Minecraft server hosting is not the way to go

tardy beacon
#

so what is the way to go?

dusky harness
#

wellllll

#

hold up

#

first of all

west socket
#

You would want either a vps or a dedi

dusky harness
#

first of all

dusky harness
#

but vps/dedi for the first time isn't as simple as paying and booting up a server

#

once you get used to it it's ez

west socket
#

Yes, I don’t recommend starting with a bungee network, but it will always be more cost effective to use one of those options when doing so

tardy beacon
#

so Multiverse is the way to go in the beginning then, as I have no playerbase

dusky harness
#

but starting a bungee server + spigot servers + vps/dedi all at the same time and for the first time isn't the way to go
(+ vps/dedi probably would prob be even more expensive if you don't need a powerful server)

west socket
#

Yeah, likely

dusky harness
#

although there is Oracle free tier

#

if u wanna try it

west socket
#

Unless you have actual issues with conflicting plugins/server software, it’s less efficient to have multiple servers

dusky harness
#

u dont really lose anything since its free

#

24gb free memory and 4 vcpu

west socket
#

damn, I didn’t know about that

#

100% uptime?

dusky harness
#

enjoy

dusky harness
#

its a large company

#

so i assume they have good uptimes

west socket
#

Just making sure they’re not pulling some minehut shit

tardy beacon
#

I think ill stick with Multiverse

west socket
#

Yeah, multiverse is nice

dusky harness
#

i should prob update the guide a bit

#

but

tardy beacon
#

maybe when I get actual players.. lol

dusky harness
#

¯_(ツ)_/¯

#

lol

tardy beacon
#

alright thank you

west socket
#

Yeah I’m kind of over my head in server space

#

Not a good place to be unless you got money to burn

dusky harness
west socket
#

Lol

dusky harness
#

but it actually was a long time ago

#

like a year or smth idk

west socket
#

Did it delete data?

dusky harness
#

i dont think so

#

fortunately

west socket
#

Probably fine then

#

Data loss is tough 😦

dusky harness
#

ya

#

now they have explicit requirements

west socket
#

Accidentally deleted my production sql database once

dusky harness
#

and give you a week before terminating if you don't meet those

#

ooooooof

#

gitlab

#

🤡

#

did u see the gitlab scenario

west socket
#

Luckily all the important stuff is in firestore

tardy beacon
#

I have another question! If I want my Spigot/Paper/Bukkit idk whatever server to work on 1.8.9-1.19.4/latest version, what do I use?

west socket
#

No

west socket
dusky harness
#

i think

west socket
#

Never heard of that, trust him over me

tardy beacon
#

pufferfish..?

dusky harness
#

paper but better 😌
u can use paper for stability ig

tardy beacon
#

what theheck is pufferfish

dusky harness
#

but pufferfish has been out for a while now

#

lol

#

just dont use spigot or bukkit 👍

tardy beacon
#

so Paper

dusky harness
#

yeah

tardy beacon
#

so Paper 1.8.8 with viaversion or 1.19.4 with viaversion?

#

enter the chill zone !!!

dusky harness
#

lol my internet

west socket
#

I’m having a really fun time digging through nms rn

dusky harness
west socket
#

I’ve heard of it, can’t figure out how to install it though

#

The readme wasn’t very clear

dusky harness
#

ah

#

yeah

#

it has like separate modules

#

lines 22 and below are unneeded i think

west socket
#

One sec

tardy beacon
#

so I can make the server 1.8.8 and install viaversion for it to support 1.19.4?

west socket
#

I think the issue is that I don't know how to install gradle plugins lol

dusky harness
tardy beacon
#

why not?

dusky harness
#

since plugin devs aren't gonna like you 🥲

tardy beacon
#

why

dusky harness
#

since its old

west socket
dusky harness
#

so the api is missing a lot

tardy beacon
#

eh, what could possibly go wrong

dusky harness
#

u can also use viaversion on 1.19

tardy beacon
#

but then i need like 5 other via plugins

dusky harness
#

tru

#

protocolsupport better but its not being updated

#

:(

#

ok gtg

#

glhf

#

!

tardy beacon
#

thanks u

#

hey guess what - another question!!!
how can i make it so (in F3) it doesnt say "PaperSpigot" server?

ocean crow
#

Iirc

tardy beacon
ocean crow
#

Uh

#

I know it's in one of the scripts for the jar, as I haven't needed todo it.

west socket
#

You're not going to be able to edit that unless you know how to read and compile code

tardy beacon
tardy beacon
#

LMAO that was exactly what i was looking for

#

thank yoU!

dusky harness
#

np 👍

dark garnet
#

hey im trying to use json messages (click events and such) in 1.8.8 but im having trouble finding documentation, examples, tutorials, etc... online, anyone got any?

#

or maybe if someone just knows how to string together multiple TextComponents (in 1.11 i was using the ComponentBuilder but it doesnt rly seem to work in 1.8.8 for some reason, unless im just using it wrong)?

dusky harness
#

bungee textcomponent?

dark garnet
tardy beacon
#

how can i make it so the Minecraft "Statistics" thingy doesnt update?

dusky harness
#

¯_(ツ)_/¯

dark garnet
dusky harness
#

np

#

👍

#

my most helpful response today

tardy beacon
#

itd be easier if i could send pictures

dark garnet
#

i think u can

dusky harness
#

although

#

this disables achievements too

dark garnet
#

ah those statistics

tardy beacon
#

okay, thanks

#

ill try that

dark garnet
#

which makes ZERO fucking sense

west socket
#

I can get you an example

#

1s

#

@dark garnet Looks like you need "TextComponent.addExtra()"

minor summit
#

something something adventure

tardy beacon
#

[Server] [ERROR] Could not pass event WorldLoadEvent to Multiverse-Core v2.5-b699

simple lagoon
#

rip

dark garnet
#

makes everything 10x easier lmao

west socket
#

Nice

dark garnet
#

alright im back with more json stuff 💀
how the heck do i use HoverEvent.Action.SHOW_ACHIEVEMENT, HoverEvent.Action.SHOW_ITEM, and HoverEvent.Action.SHOW_ENTITY?

#

cause HoverEvent.Action.SHOW_TEXT is just used like this: new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("text to show on hover").create())
the only constructor for HoverEvent is HoverEvent(HoverEvent.Action, BaseComponent[])

dense drift
#

And I can't find show achievement

minor summit
#

for adventure there's a PR for it, but show achievement got removed in 1.12 anyway

hazy summit
#

Hey I have the following problem (Spigot 1.19.3):

I want to set a player's spectator target, which by itself is no issue, however if the target is a farther away then it won't work and the player only gets teleported to the target.

v1: Only works on close distances

player.setGameMode(GameMode.SPECTATOR);
player.setSpectatorTarget(target);

v2: same results as v1

player.setGameMode(GameMode.SPECTATOR);
player.teleport(target.getLocation());
player.setSpectatorTarget(target);

v3: this actually works, but the delay is very noticeable

player.setGameMode(GameMode.SPECTATOR);
player.teleport(target.getLocation());
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> player.setSpectatorTarget(target), 1);

Does anyone here have an idea what I could do differently so I wont have to add a delay?

wind tapir
#

Hello, anyone knows how to go over the 16 char limits in the nametags in 1.8.8 ? I did a lot of research but with no achievement, hypixel does, and a french server named FunCraft does in 1.9.4

warm steppe
#

i've found this by searching the question on google:

They use scoreboard teams to split the name up in three sections of 16 characters and set them as the prefix, name and suffix of the team. This way they can have name length up to 48 characters.
ocean raptor
#

you should probably go with first option and update your server tho

wind tapir
#

I tried everything that you've said to me

warm steppe
#

lower the armor stand?

hazy nimbus
warm steppe
#

it takes, it's just that the person has not done any research on this

hazy nimbus
#

Tho if I were you I would just drop 1.8 support, it's been more than 8 years since it's release

warm steppe
#

because all of their questions would've been already solved

wind tapir
tardy beacon
#

I dont understand whats happening

tired olive
#

it barely takes google search to figure that out

#

well for the first error at least

#

for the second error it looks like a region from ur world is corrupt

mellow pond
dark garnet
hazy summit
dark garnet
#

its just 1 tick

dark garnet
#

dang ye, rip

drowsy edge
#

So ik this doesnt rlly deal with code but im making this plugin where you can use 3 special moves and doing something allows you to activate, one of them is an ultimate. I was originally going to go with shift-leftclick and shift-rightclick with a pvp command activated but I feel like there could be a more efficient way that I just cant see

hoary scarab
#

So using reflection to generate an object... When looping through the constructors from PacketPlayOutPlayerInfo.PlayerInfoData I get

DEBUG (Construct) >> public net.minecraft.server.v1_16_R3.PacketPlayOutPlayerInfo$PlayerInfoData(net.minecraft.server.v1_16_R3.PacketPlayOutPlayerInfo,com.mojang.authlib.GamePro file,int,net.minecraft.server.v1_16_R3.EnumGamemode,net.minecraft.server.v1_16_R3.IChatBaseComponent)

But the constructor doesn't contain PacketPlayOutPlayerInfo as a parameter... and when running newInstance(params) it errors.

public PacketPlayOutPlayerInfo$PlayerInfoData(GameProfile var1, int var2, @Nullable EnumGamemode var3, @Nullable IChatBaseComponent var4) {
    this.d = var1;
    this.b = var2;
    this.c = var3;
    this.e = var4;
}
proud pebble
#

ohh

#

your trying to create the data object

#

the only constructor for that object is (ClientboundPlayerInfoPacket arg0, com.mojang.authlib.GameProfile arg1, int arg2, GameType arg3, Component arg4)

#

huh

#

i wonder where they pull that constructor if its wrong

#

maybe cus its a subclass or something like that

hoary scarab
#

Adding PacketPlayOutPlayerInfo to the parms works but why would I have to add that in the first place when the parameters of the constructor don't include it. (Atleast in the actual code.)

proud pebble
#

id assume some bullshit with playerinfodata being a subclass

floral root
dense drift
#

placeholderapi is not present on the server and you are trying to register an expansion probably

dusky harness
#

they check if papi is enabled, so it should be working, I'm not sure why 🤔

dusky harness
dense drift
#

make sure you add it as softdepend or depend to your plugin

floral root
#

but no works

dusty zodiac
#

Hi ! is anyone already use the BetterRTP api ? I have a nullRef about getInstance()

Caused by: java.lang.NullPointerException: Cannot invoke "me.SuperRonanCraft.BetterRTP.BetterRTP.getRTP()" because the return value of "me.SuperRonanCraft.BetterRTP.BetterRTP.getInstance()" is null
else { // Teleport player on random location using BetterRTP

    if (sender == null) sender = this.plugin.getServer().getConsoleSender();

    // Biome list
    List<String> biomes = KSMP.config.getStringList("biomes");

    HelperRTP.tp(player, sender, world, biomes, RTP_TYPE.FORCED, true, true);
}

What did I do wrong?

proud pebble
#

either depends: or softdepend: [BetterRTP] in your plugin.yml

dusty zodiac
#

That's very weir cause i tried this

me.SuperRonanCraft.BetterRTP.BetterRTP rtp = null;
if (Bukkit.getServer().getPluginManager().isPluginEnabled("BetterRTP")) {
    // Log the class of Bukkit.getServer().getPluginManager().getPlugin("BetterRTP")
    sender.sendMessage(ChatColor.GREEN + Bukkit.getServer().getPluginManager().getPlugin("BetterRTP").getClass().toString());

    rtp = (me.SuperRonanCraft.BetterRTP.BetterRTP) Bukkit.getServer().getPluginManager().getPlugin("BetterRTP");
}

and i have this error :

Caused by: java.lang.ClassCastException: class me.SuperRonanCraft.BetterRTP.BetterRTP cannot be cast to class me.SuperRonanCraft.BetterRTP.BetterRTP (me.SuperRonanCraft.BetterRTP.BetterRTP is in unnamed module of loader 'BetterRTP.jar' @642748a; me.SuperRonanCraft.BetterRTP.BetterRTP is in unnamed module of loader 'KSMP.jar' @543e636c)
proud pebble
#

did betterrtp load correctly?

#

as in its not disabled

dusty zodiac
#

yes it work normally on the server

proud pebble
#

so im just confused as why it hasnt been enabled if your loading after it

dusty zodiac
#

hmm the error i trigger by a command so i don't think the BetterRTP is not loaded at this moment

rare echo
#

are you useing betterRTP?

proud pebble
#

i think thats obvious

rare echo
#

i had trouble using it on my server

#

it made it crash over and over

#

and the permissions for it weird

#

so I just found another one

#

and that one works

proud pebble
#

i didnt think that betterrtp had any form of api tbh

rare echo
#

yeah

dusty zodiac
rare echo
#

1 sec got to find it

proud pebble
#

ic

rare echo
proud pebble
#

last update 2019, F

rare echo
#

it still works for me

#

but I don't know about 1.19

proud pebble
#

probably doesnt have any api documentation, or any api at all

rare echo
#

oh i didnt know you need that

proud pebble
#

they might beable to answer better since they actually know their plugin

dusty zodiac
#

yes i already do that, i'm waiting now

proud pebble
#

turns out 3.6.2 doesnt work

#

changed it to 3.6.8-3 and it worked

proud pebble
#

its not complaining of the instance being null

proud pebble
dusty zodiac
#

I was using 3.6.9-1 so i'm testing with the 3.6.8-3

proud pebble
#

what version are you depending on in either your pom.xml or build.gradle

#

put this in your onEnable() as a test to see what it comes up with

if (Bukkit.getPluginManager().getPlugin("BetterRTP") != null) {
            BetterRTP rtp = (BetterRTP) Bukkit.getPluginManager().getPlugin("BetterRTP");
            if (rtp != null) {
                getLogger().info("BetterRTP found, instance exists");
                WORLD_TYPE type = HelperRTP.getWorldType(Bukkit.getWorld("world"));
            } else {
                getLogger().info("BetterRTP found, instance is currently null :(");
            }
        } else {
            getLogger().info("BetterRTP Not Found :(");
        }
#

cus its what i used to see if it worked or not

dusty zodiac
#

I'm new with java and maven so i think i'v did weird think with my imports and i cannot make it work :/

stable shadow
#

Hello, please tell me how to use the % sign in math

dense drift
#

?

stable shadow
#

Number with % example 100+10%

dense drift
stable shadow
#

Thank you very much, you helped me a lot

craggy pelican
#

Hi, how do i do in java a global variable for all players, for example if a player place a block it add 1 to the variable, and if an other player place a block it add 1 to the variable that make is value at 2 ???? Thanks

stable shadow
stable shadow
craggy pelican
#

ok thx

stable shadow
craggy pelican
#

noo

#

but it helped me fr

stable shadow
#

Ok then sorry

torpid raft
#

doesnt even need to be static

#

just, a variable

#

that isnt unique to every player

forest jay
#

I am developing a backend system for a server built to withstand high player counts. It involves some RPG stuff, and I have a lot of data that needs to be loaded. Some needs to be loaded when the player is offline, so I have offline data classes that are loaded when the player's data is queried and they are offline, and is transferred to the main player instance when they come online. Should I preload all the offline data instances when starting the server, or just load them on a need-be basis? That seems a little inefficient, although having potentially thousands of instances of classes all loaded at once doesnt sound like a good idea. Is this where Redis comes in handy? What do you guys think?

torpid raft
#

for example, maybe only data from offline friends of an online player need to be loaded

#

if something like that is the case then you can def squeeze by with loading all friend data when someone hops on

forest jay
torpid raft
#

both friend requests and auctions can probably survive without prefetching offline player data

forest jay
#

I might load all the offline data into a redis, and then load from the redis, just from a speed standpoint. Not sure what the load times are between Redis and MySQL and if it would make a difference.

forest jay
torpid raft
#

how much latency are you willing to tolerate

#

also mysql generally caches data that is frequently accessed, so there is a chance that repeated queries will be done from memory rather than reading from disk each time

#

i think if i were in your shoes i would not preoptimize too much by trying to load everything into memory, since it should be pretty easy to toss that functionality in down the line if you design things right

west socket
#

Employ a system where profiles can be loaded instantaneously

#

I prefer NoSQL options, but MySQL generally works as well

#

The only reason to ever attempt to load all profiles is if you're indexing leaderboard data or something

rancid bronze
#

Yeah load when needed, keep in a lru cache

#

If its used frequently it’ll be in the cache, otherwise it’ll just be pushed out when the cache is full with more recently used things

weary galleon
#

yo guys, can someone help me with installing phpMyAdmin on my VPS and make it accessible with a subdomain?

river solstice
#

what's a phpmypanel

weary galleon
#

I guess

dense drift
#

phpmyadmin

weary galleon
#

oh I miss typed it

hazy summit
#

Hey!

I'm currently having some issues with setting a spectator target.

Basically, what I'm doing is teleport the player to the target and then set the spectator target. The target doesn't move at all, yet as soon as I set the spectator target, the camera seems to always do a 180 degree turn. Does anybody know what could cause this or how to prevent it?

(The teleport as well as the delayed task are to help with larger distances.)

Edit: tried manually rotating 180 degrees to test, but there's still rotation happening

Spigot 1.19.3 / Java 17.0.3

public void setSpectate(Player target) {
  player.setGameMode(GameMode.SPECTATOR);

  PotionEffect blindness = PotionEffectType.BLINDNESS.createEffect(30, 9);
  PotionEffect slowness = PotionEffectType.SLOW.createEffect(30, 0);
  player.addPotionEffects(Arrays.asList(blindness, slowness));

  player.hidePlayer(plugin, target);
  player.teleport(target.getLocation());

  Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {
    player.showPlayer(plugin, target);
    player.setSpectatorTarget(target);
  }, 10);
}
west socket
#

I assume the entity is facing the same way as the player

hazy summit
#

Player and target should be facing in the same direction, because I’m teleporting to the targets exact location which includes yaw and pitch

#

So I don’t understand why there’s a 180 degree turn happening

grand canyon
#

I was coding a simple Plugin to log the Ingame chat to discord via webhooks. On my testing machine everything worked. Once I started to use it on a "production" server I'm receiving this error: ```
[20:53:37] [Server thread/ERROR]: Could not load 'plugins/VaroChatlog.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:162) ~[spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:133) [spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:292) [spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]
at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:198) [spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]
at java.lang.Thread.run(Thread.java:750) [?:1.8.0_362]
Caused by: java.util.zip.ZipException: invalid END header (bad central directory offset)
at java.util.zip.ZipFile.open(Native Method) ~[?:1.8.0_362]
at java.util.zip.ZipFile.<init>(ZipFile.java:228) ~[?:1.8.0_362]
at java.util.zip.ZipFile.<init>(ZipFile.java:157) ~[?:1.8.0_362]
at java.util.jar.JarFile.<init>(JarFile.java:171) ~[?:1.8.0_362]
at java.util.jar.JarFile.<init>(JarFile.java:135) ~[?:1.8.0_362]
at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:150) ~[spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]
... 5 more

my plugin.yml looks like this: ```yml
name: VaroChatlog
version: 1.0
main: ppy.sh.VaroChatlog.Main```
It used to be a bit longer, but I scrapped it to hopefully fix it. 
My test machine and the production server are using the same spigot version.. YAML Formatter says everything is fine. And yes the plugin.yml is in the jar.
Only the java versions are different, could that maybe be the issue?
river solstice
#

the classic 'works on my machine'

grand canyon
#

legit

#

Same as at work

dark garnet
grand canyon
#

That was one of my first thoughts

#

so i waited a minute before copying it to the server

dark garnet
#

u could use 7-zip to just confirm the plugin.yml is being correctly added to the jar

grand canyon
#

I checked it and its fine

river solstice
#

I mean it shouldn't matter, but local and host servers are different OS's, right?

grand canyon
river solstice
#

eh, that's probably it

dark garnet
river solstice
#

macos poopoo

grand canyon
river solstice
#

personally I haven't dealt with such issue cuz I don't own a mac, but I assume that's the case

#

Windows => Unix usually works fine

dark garnet
#

like the infamous _MACOSX folder in zips lmao

grand canyon
#

okay so I guess I will go and built it on windows

dark garnet
#

if u have the project on github then u can use actions

grand canyon
#

Wasn't worth for that project imo xd

river solstice
#

It might not be the issue, the OS incompatibility or wtv, but that's my best guess, since, well, it should work fine if the files are the same

grand canyon
#

I'm gonna try it out

dark garnet
#

for some reason the damage isnt being applied to the item:

if (DAMAGEABLE_CLASS != null && DAMAGEABLE_SET_DAMAGE_METHOD != null && DAMAGEABLE_CLASS.isInstance(meta)) try {
    DAMAGEABLE_SET_DAMAGE_METHOD.invoke(meta, damage);
} catch (final IllegalAccessException | InvocationTargetException e) {
    e.printStackTrace();
}
```code on github: https://github.com/srnyx/annoying-api/blob/main/api/src/main/java/xyz/srnyx/annoyingapi/file/AnnoyingFile.java#L286-L291
#

i think its cause the meta variable is of type ItemMeta, so when the item meta of the item is eventually set, it doesnt have the damage information attached with it (cause its just an ItemMeta, not a Damageable), which just means ill have to set the item meta twice 🙃
can anyone confirm or disprove?

grand canyon
wary dust
#

Is it possible to make a block appear as one material for one player and another for a different player using packets?

#

E.g obsidian appears as bedrock for certain players

marble nimbus
#

Hey, I need some quick help with something, I am not sure how to achieve the following:

When hitting a player with lets say a Knockback 5 stick, and the player then "flies" away. How can I damage the Wall / Ground the player hits depending on the velocity of the player?

signal grove
marble nimbus
#

Using that you can change a specific Block for a Player

#

once he tries to break it or interact with it, it will change back

marble nimbus
#

mainly just damage them

signal grove
#

Oh if it’s like an anvil

marble nimbus
#

yea

signal grove
#

You stuck on the actual damaging? Or the logic for if they slam into it

marble nimbus
#

the slaming into

#

damaging is thanks to paper fairy easy

signal grove
#

on each movement, check if bounding box (expand it a little bit) overlaps with any blocks around them

#

if they do, get their velocity and damage the blocks if it goes above a threshold

signal grove
marble nimbus
#

so basically on movement -> check colliding with surrounding solid blocks -> check velocity and damage

signal grove
#

yeah

marble nimbus
#

cool lets try

#

okay so slightly different approach (more like yours)
on move -> get Player BoundingBox and expand it -> somehow get all blocks inside the bounding box / it collides with -> do the rest

#

is there an easy way to get all blocks that the bounding box is coliding with?

signal grove
#

maybe, i dont know off hand

#

i'd just iterate through the like (maximum 27?) blocks that a player is in

#

plus or minus 1 on every axis

#

another thing you want to make sure is that the direction of the block is the same(ish) direction as their velocity, so you can damage the correct block instead of all of the surrounding ones

dense drift
dusky harness
#

and so you might accidentally think that an api is from 1.8 when its not

dark garnet
#

thank u for saving me from so much pain dkim, i never thought i'd be thanking u for anything

dense drift
#

tbh it is annoying that not even paper uses @since

minor summit
#

lol

minor summit
#

but like, if anyone wants to PR, go ahead

#

it's just not something dev team will bother doing

dense drift
#

yeah but I mean, at least for the new stuff

dark garnet
dusky harness
#

also, @SuppressWarnings("deprecation") incoming

#

🙃

#

well maybe not a lot

#

compared to using paper api

#

but

dense drift
#

Well, have fun with reflections then

#

Also, you are already checking the docs for method name and class 🤣

#

What @dusky harness

dusky harness
#

kinda like using paper api for a spigot compatible plugin, but not as bad

dark garnet
dusky harness
#

although "binary searching" through the versions does help

#

¯_(ツ)_/¯

#

still not fun tho

#

especially if you're testing on 1.19 for stuff that you wouldn't think be unavailable on 1.8

dark garnet
dusky harness
#

lol

dense drift
#

Aaanyways

dark garnet
#

plugin.log(Level.SEVERE, DAMAGEABLE_CLASS.cast(item.getItemMeta()).getClass().getName()); is logging org.bukkit.craftbukkit.v1_19_R3.inventory.CraftMetaItem, even tho the meta is checked to be of type Damageable beforehand

tired olive
#

anyone know how to make gradle be guaranteed to create a new jvm for specific tests?

dense drift
#

Wdym?

#

You want to run tests individually?

tired olive
#

Gradle makes "forked" jvms responsible for executing x tests but i need to create seperate forked jvms for specific tests

sterile hinge
#

that sounds like bad tests tbh

tired olive
#

It's not

#

Well ig it kinda is but i cant help it

#

Im starting up paper so i can do integration tests

sterile hinge
#

other than that, I'm not aware of anything where gradle decides which tests are run in which process, it just calls JUnit with a given selection of tests

tired olive
sterile hinge
#

you'd most likely use a custom junit launcher for that I guess

tired olive
#

Ill look into that thx

grand canyon
#

Probably a stupid question but I'm using Spigot 1.8.8 and using the PlayerDeathEvent. I have another Plugin on my server which also uses this event. Now I have the issue that my plugin steals the event from the other one. Is there a way to share the events between the plugins?

proud pebble
grand canyon
#

is there a method or a return object which i have to call so other plugins get the correct data?

#
org.bukkit.event.EventException: null```
```Caused by: java.lang.NullPointerException
        at org.Ziron5.Listeners.PlayerListener.onDeath(PlayerListener.java:287) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_362]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_362]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_362]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_362]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]```
#

I am pretty new to the Plugin world, so sorry for the time waste with me xd

proud pebble
#

you could post your ondeath method section to paste.helpch.at if its your code thats not working

grand canyon
#

it isnt mine xd

proud pebble
#

then its not your problem

grand canyon
#

But if I remove my plugin (the other one) that doesnt happen

#

thats why i was wondering

proud pebble
#

what are you setting to null?

grand canyon
#

I am just reading the data which is given by the event

#

Can't post my code rn

sterile hinge
#

well you're trying to access something from null, the solution is to not do that

storm sinew
silent trench
dense drift
#

You can just do Material#name()#endsWith("_AXE")

dense drift
storm sinew
#

^

dense drift
#

The tag for all axes would be AXES or whatever

silent trench
#

🤦‍♂️

dense drift
#

Just like wooden_doors and the rest

silent trench
#

👍Your solutions is the best then

grand canyon
dense drift
storm sinew
#

Yeah saw it too

#

weird they didn't have it before

#

anyway ty :)

dense drift
#

Paper's class for tags allows to create your own tags outside the ones registered in the game iirc

#

But I guess they are like a wrapper for a Set

storm sinew
#

there's also none for all blocks?? ;-;

dense drift
#

d;Material#isBlock

uneven lanternBOT
#
public boolean isBlock()```
Description:

Checks if this Material is a placable block

Returns:

true if this material is a block

storm sinew
#

Oh, thank you

west socket
#

Does it happen when you make them spectate without them being teleported first?

sour rain
#

Hey guys, I'm very new to coding in java but I'm very open to judgement and criticism. Although, I'm mostly looking for advice lol
I've got a post over in #1007620980627230730 if any of you know anything about Vault Economy, .yml file creation, and writing to said .yml file please check out my post. I've been stumped for too long

#

Any help is greatly appreciated!

dark garnet
dark garnet
minor summit
#

have you done any debugging?

#

ensure the right things are called, what is and isn't null, ... etc

river solstice
#

debuging aka => System.out.println 😎

minor summit
#

that is one approach yes

river solstice
#

print masterrace

#

what even is a debugger

#

tfu

minor summit
dark garnet
dense drift
#

just wondering, what item are you using for testing?

robust flower
#

for me, reflection is complicated because it feels like programming but backwards, I always feel slow when I need to do things with reflection

sterile hinge
#

that's why it's reflection I guess?

robust flower
#

the best way of doing reflection development (among others) is to use a proper debugger instead of trying to println everything, you quickly figure out what works and what doesn't, what methods are available, it's much easier in general

#

@dark garnet ^

hoary scarab
sterile hinge
#

or probably do something sane

#

Void.TYPE == void.class btw

hoary scarab
sterile hinge
dark garnet
dark garnet
hoary scarab
dusky harness
#

oh what paper v1 api is still up?

#

i thought they took it down

minor summit
#

dkim

#

you're not gonna believe this

#

that guide is outdated 😱

dusky harness
#

rn

#

oh wait

#

do they still support old versions in the api

#

i thought they were just gonna take the whole v1 api down

#

oh nvm its a 2kb jar file

#

weird how the api is still up tho.. even though it doesn't work

#

this is cool

minor summit
#

hilarious

dark garnet
dusky harness
dark garnet
dusky harness
#

🥲 🥲

dense drift
robust flower
dusty frost
#

ladybug? 🤨

signal grove
#

i always thought it was a ladybug too, but i guess it could just be any bug

#

"lay debug"

dusky harness
#

according to ChatGPT (I could not find anything on Google about this lol) it is indeed a ladybug 😌

dusty frost
#

i mean the signature ladybug moment is red/black and spots

#

that icon has neither of those lol

signal grove
#

i used to use a shitty IDE called jgrasp

#

which has a ladybug

#

maybe its just a standard that was adopted

versed carbon
#

Hey all, I was wondering is there any recommended ways of storing mass custom items? So far I think enum is what I'm looking for? But I'm no expert.

river solstice
#

depends

versed carbon
#

I'm looking to store a lot of items like 60 + so that I can link them to commands, event etc.
These items would have enchants, a lore, a display name, attributes.
I just want my plugin code to look less messy and just a line per item would look tidier than

                ItemMeta itemMetaHelmet = itemStackHelmet.getItemMeta();
                itemMetaHelmet.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&7&kL&cGodly Helmet&7&kL"));
                List<String> loreListHelmet = new ArrayList<>();
                loreListHelmet.add(ChatColor.GRAY + "A godly helmet forged with the blood, sweat and tears of the developer.");
                loreListHelmet.add(ChatColor.GRAY + " - = Enchants = -");
                loreListHelmet.add(ChatColor.GRAY + "Protection V");
                loreListHelmet.add(ChatColor.GRAY + "Projectile Protection V");
                loreListHelmet.add(ChatColor.GRAY + "Fire Protection V");
                loreListHelmet.add(ChatColor.GRAY + "Blast Protection V");
                loreListHelmet.add(ChatColor.GRAY + "Respiration III");
                loreListHelmet.add(ChatColor.GRAY + "Extra Hearts III");
                loreListHelmet.add(ChatColor.GRAY + "Aqua Affinity");
                loreListHelmet.add(ChatColor.GRAY + "Unbreakable");
                loreListHelmet.add(ChatColor.translateAlternateColorCodes('&', "&7Obtained from the [&cTier 4 Crate&7]"));
                loreListHelmet.add(ChatColor.translateAlternateColorCodes('&', "&7Owned by: &c" + name));
                itemMetaHelmet.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 5, true);
                itemMetaHelmet.addEnchant(Enchantment.PROTECTION_EXPLOSIONS, 5, true);
                itemMetaHelmet.addEnchant(Enchantment.PROTECTION_FIRE, 5, true);
                itemMetaHelmet.addEnchant(Enchantment.PROTECTION_PROJECTILE, 5, true);
                itemMetaHelmet.addEnchant(Enchantment.WATER_WORKER, 1, false);
                itemMetaHelmet.addEnchant(Enchantment.OXYGEN, 3, false);
                itemMetaHelmet.setUnbreakable(true);
                AttributeModifier maxHealthBoostHelmet = new AttributeModifier(UUID.randomUUID(), "maxHealthBoost", 3.0, AttributeModifier.Operation.ADD_NUMBER);
                itemMetaHelmet.addAttributeModifier(Attribute.GENERIC_MAX_HEALTH, maxHealthBoostHelmet);
                itemMetaHelmet.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
                itemMetaHelmet.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);
                itemMetaHelmet.addItemFlags(ItemFlag.HIDE_ENCHANTS);
                itemMetaHelmet.setLore(loreListHelmet);
                itemStackHelmet.setItemMeta(itemMetaHelmet);```
This over and over again.
dense drift
#

Well, you still need to create them all at some point

versed carbon
#

Yes that's why I'm looking for a way to store the information. Then I'd be able to grab that info from the item storage class and link it too whatever.
That would mean the item gets created when I do a command for example but I'd be keeping all the messy data somewhere else.
Or is it better to type it out each time?

worn jasper
dense drift
#

Looks like a decompiler, JD GUI?

dusky harness
hoary scarab
brisk mango
#

that is if you're using java 14 or later, since records were added then

#

I think minecraft 1.18(?) requires java 17 anyway

icy shadow
#

you could do the same thing without records lol, they just make it a little more convenient

brisk mango
#

That's fair, I just think it would be more convenient to store in an immutable record class

dense drift
#

I mean, you can just create the item and just copy it before using it

proud pebble
#

i personally just have a bunch of classes that define each item and then use another class to generate the item's lore and shit

hoary scarab
#

Given his code though, I think a json string of the item converted/cached onenable would be "cleaner". He also said he wants 60+ items so having all of that code duplicated 60 times is useless.

proud pebble
#

something that could also work is some form of item wrapper to make generating the itemstack in a much cleaner way without having tons of duplicate code

dense drift
#

json would be good only if they can find some tool that lets you import existing NBT and edit it tbh

hoary scarab
dense drift
#

everything is NBT 🙂

hoary scarab
lyric gyro
#

Hello all I recently bought an api but can’t figure how to create a config I have tried but can’t figure it would anyone be willing to help me figure it out ?

dense drift
#

You did what?

river solstice
#

bought an api 💀

spiral prairie
#

What the hell

tired olive
#

How do you expect them to make money?

river solstice
#

who's selling APIs

#

plugin - yes, API, what

lyric gyro
#

I bought it from senior studios

dense drift
#

bought what?

lyric gyro
#

An api for making configs items and everything

dense drift
#

why

#

anyways, just ask your question, but I doubt anyone has experience with it if you say it is paid

lyric gyro
#

I’ve been trying to figure it can seem to find how too make a simple config

#

Can’t*

spiral prairie
#

Ask them?

#

I use configurate which is free and oss

river solstice
#

buys random ass api without figuring out how to use it in the first place then struggle to find anyone to help them with a paid api that likely noone has experience with >>>

spiral prairie
dense drift
#

@reef delta do you know anything about this? lol

dense drift
reef delta
#

Ah, not a clue- I don't have access to all tickets sadly.

#

They likely requested some Builder API for all I know.

dense drift
#

not what I meant to say, is the team selling APIs? 🤣

reef delta
#

Oh.

dense drift
#

or was it a commission from a dev

reef delta
#

They probs mean a library rather than API lol

dense drift
#

same shit

reef delta
#

fuck i just woke up

#

uh

#

I mean shit like mf-gui whatever that shit is called

dense drift
#

yes a library

reef delta
#

Then yes, freelancers do make and sell libraries upon request.

#

Even if a good one already exists

dense drift
#

ok I was just curious

reef delta
#

(99% of bot requests can be done with corebot but bot devs still make the same fucking bot for more)

reef delta
dense drift
reef delta
dense drift
#

at least he was honest xD

reef delta
reef delta
spiral prairie
#

Jeez mackenzie you're everywhere

fading stag
#

If I'm creating a plugin which uses a configurable database (for example mysql, postgresql and sqlite) how should I publish the plugin? Should I fade any of these drivers to it or add all of these drivers as a library?

west socket
#

Assuming it’s not the standard jdbc, I would include them, but make sure you relocate it to prevent conflicts with other plugins

dense drift
#

you can do what luckperms does and download the driver only if it is needed

west socket
#

Oo smart

#

Lucko is very underrated

dense drift
#

I wouldn't say that but ok

west socket
#

He literally makes two of the most useful free plugins

#

And they’re both super high quality

dense drift
#

there's also BungeeGuard

west socket
#

Yes

craggy pelican
#

Hi, i have many errors on this event, how do i modify this code to make that i can use all inventory normally except when the clicked item is "§b§lTest" ???

#
public void InventoryClickEvent(InventoryClickEvent event) {
  Player p = (Player) event.getWhoClicked();
  String itemName = event.getCurrentItem().getItemMeta().getDisplayName();
  if (event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.AIR) {
    if (Main.commandemod.estMod(p)){
    if (event.getCurrentItem() != null) {
          if (itemName.equals("§b§lTest"){
            event.setCancelled(true);
            p.updateInventory();
          }
        }
      }
    }
  }
#

Here is the error :

neat pierBOT
craggy pelican
#

I have an other error when i shift click on an item in creative:

#

Whereas i don't use InventoryCreativeEvent in the plugin

dense drift
#
  String itemName = event.getCurrentItem().getItemMeta().getDisplayName();
  if (event.getCurrentItem() != null```
You use the `currentItem` before the null check
craggy pelican
#

Oh yes thx

fading stag
#

Is there any api to get materials like deluxe menus? For example being able to using baseheads etc

proud pebble
lyric gyro
#

How can i loop through StringLists in a config for broadcasts ik how to put it too a player just not get a random string list from a config as the would be like 1 :Stringlist
2: Stringlist
so on

hoary scarab
# lyric gyro How can i loop through StringLists in a config for broadcasts ik how to put it t...
Broadcasts:
  '1': ["This is", "the first broadcast."]
  '2': ["Broadcast #2"]
  '3': ["Broadcast #3"]
```Just an example layout.
```java
private BukkitTask = broadcastTask;

public void startBroadcaster() {
    if(broadcastTask != null)
        return; // returns as a task is already running
    Random random = new Random(); // or Thread.getCurrentRandom();
    broadcastTask = new BukkitRunnable() {
        public void run() {
            ConfigurationSection cs = getConfig().getConfigurationSection("Broadcasts");
            cs.getStringList(random.nextInt(cs.size()-1)).forEach(string -> Bukkit.broadcast(string));
        }
    }.runTaskTimer(<JavaPlugin>, 0, 600);
}
```Written on phone so code might have to be adjusted.
crimson jasper
#

hello how depend plugin in my plugin with pox.xml ?

shell moon
#

why no just add it as dependency in your project structure?

proud pebble
#

for example placeholder api

#

you would copy everything in the repositories section, find where your repositories tag in your pom.xml is and then paste it in there, then do the same with dependencies, then depending on your ide, for example intellj you would click the red M button that should show up then itll refresh and allow you to use the other plugins code

#

also make sure to add either softdepend to depend to your plugin.yml

crimson jasper
silent trench
crimson jasper
ionic pulsar
#

Where I have to contact to create an account on extendedclip ?

#

I wan't to add an extension

proud pebble
#

also i didnt know that deluxemenus had an api

dense drift
#

it .. doesn't?

proud pebble
#

that will be why it doesnt work then more then likely

spiral prairie
#

I'm pretty confused right now... The server I'm working on has all nvme drives but still, this is the report I get: https://spark.lucko.me/sWpils6h0w
Aurelium Skills getting a BlockState, after asking their support, chunk loading is apparently slow. Anything I could check to make it better?

spark is a performance profiler for Minecraft clients, servers, and proxies.

spiral prairie
#

Hm yeah

#

the get state seems to be the issue tho

dense drift
#

ahh I didn't see what's beneath that part

#

looks like they do some hackery with block state for getting a player's skull

spiral prairie
#

yeah they say its slow chunk loading

dense drift
#

slow chunk loading?

#

what's wrong with Chunk#load if they need it loaded?

spiral prairie
dense drift
#

ahh I thought that's what they do, "slow chunk loading"

#

well, ask them why the fuck they set a player skull at playerX 0 playerZ LOL

spiral prairie
#

yeah i was so confused about that too

#

like completely useless

dense drift
#

I thought it is some weird library that does that to cache the skull, but it just sets the skin to the block

spiral prairie
#

hm

#

But I have been experiencing other issues with slow chunk loading too, but idk why

#

Is there anything I could do to measure performance?

shell moon
#

Someone knows a good class to create custom crafting recipes that allows you to check displayname, lore, or even nbt tags?

dense drift
#

d;RecipeChoice$ExactChoice

uneven lanternBOT
#
public static class RecipeChoice.ExactChoice
extends Object
implements RecipeChoice```
RecipeChoice.ExactChoice has 1 extensions, 1 implementations, 4 all implementations, and  8 methods.
Description:

Represents a choice that will be valid only one of the stacks is exactly matched (aside from stack size).
Only valid for shaped recipes

shell moon
#

Let me re ask the question

#

Someone knows a good class to create custom crafting recipes that allows you to check displayname, lore, or even nbt tags? (also to support 1.8 so Exact.Choice is not an option, even for 1.13+ i'd need to check for nbttags)

dense drift
#

Listening to the craft event is probably the only way

shell moon
#

i was asking bc probably someone has a full class for it xd

crystal sluice
#

HEy i keep getting this error - https://sourceb.in/2h1sAXDfPK
whenever i run the plugin in the server, no build errors or such
the dependency on pom.xml is

<dependency>
  <groupId>net.luckperms</groupId>
  <artifactId>api</artifactId>
  <version>5.4</version>
  <scope>provided</scope>
</dependency>```

and
im using the latest Bukkit version of luckperms in the server, v5.4.79
weak wyvern
#

Hi, I am trying to access the methods/classes from a secondary JAR, through a kotlin project by adding it as a library/dependency in my project.

I have done this, and it allows me to import the packages and access its methods, although when I try to build the project it gives me an error called "Unresolved reference: denis", denis is part of the package name, which has no errors in the code, and can access when doing import, although errors on compile.

e: C:\Users\alme\Downloads\DexCore\dex-core-master\src\main\kotlin\dev\denis\dexcore\DexCore.kt: (17, 11): Unresolved reference: denis

Line 17 is the import of the package

dusky harness
#

I suspect that you're trying to use a build tool along with IJ/Eclipse's built-in build tool at the same time

#

But I need more info (what did you use to import the secondary jar?)

weak wyvern
weak wyvern
dusky harness
weak wyvern
spiral prairie
#

Anything else I need for Vault? Cause it ain't working...

             Bukkit.getServicesManager().register(VaultImpl.class, new VaultImpl(), Bukkit.getPluginManager().getPlugin("Vault"), ServicePriority.Normal); 
         }
#

Excuse the formatting, I'm on my phone

dense drift
#

what is not working?

#

And you most likely want to register Economy.class or whatever VaultImpl extends

ornate raven
sharp hemlock
minor summit
#

out of curiosity, why clone the packet?

sharp hemlock
# minor summit out of curiosity, why clone the packet?

because if i don't im getting weird behavior , for context. Im adding glowing to the player to certain players.

But due to the metadata, if it does change like if a player crouches, it removes the glowing effect. so i add it back again to this event. i only clone it to make sure it doesn't effect the packet to the other players without that it causes a lot of weird behavior

#

I have a sneaky feeling its actually something to do with the first packet i actually send. which is the glowing effect.

sharp hemlock
#

ah yeah it wasn't protocollib. i had to change my original sending my packet

fading stag
#

Inventory#firstEmpty is a way to check if the player's inventory is full but If I'm giving the x item and user's inventory already contains x item and it has no empty space it will return -1 which means there is no empty slot. Is the best way to check it is looping over items (or just using any method) and check for any of them is similar with my item?

shell moon
#

you add the item

#

if return map is not empty

#

then its full

minor summit
#

well, some items might get added, but maybe not all

#

🤔

proud pebble
dusky harness
#

How can I get a jar of the server jar of paper?
I tried versions/1.19.4/paper-1.19.4.jar, but that doesn't seem to have the api or libraries (as those are in the libraries folder)

wary dust
#

Anyone know why I'm having an issue with cancelling fall damage?

#

Both debugs show

#

but I still die to fall damage

#

its inside the EntityDamageEvent and theres no way the event ever gets "uncancelled"

river solstice
#

(!noFallDamage)?

#

You're inverting the condition

wary dust
#

its a list of players who dont receive fall damage

#

Yeah no its worded badly

#

But the debugs do show and they still die which is so weird

river solstice
#
    @EventHandler(priority = EventPriority.HIGH)
    public void onEntityDamage(EntityDamageEvent event) {
        if (event.getCause() != EntityDamageEvent.DamageCause.FALL) {
            return;
        }

        if (event.getEntity() instanceof Player player) {
            event.setCancelled(true); 
            player.setFallDistance(0);
        }
    }
wary dust
#

Oh no I was actually being an idiot

#

I was using an early return then changed it and you're right it was meant to be noFallDamags.contains Facepalm

cerulean vessel
#

Hello, I tried making a simple Hello world plugin with a command that gives you back a response in chat, but when I type it in chat nothing happens, no errors or anything either, just nothing.

package me.marphh.helloworld;

import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.material.Command;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Objects;

public final class HelloWorld extends JavaPlugin {

    @Override
    public void onEnable() {
        // Plugin startup logic




    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic


    }

    // /hello -> hey welcome!


    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (label.equalsIgnoreCase("hello")) {
            if (sender instanceof Player) {
                // player
                Player player = (Player) sender;
                if (player.hasPermission("hello.use")) {
                    player.sendMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "Hey welcome to the server!");
                    player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&1H&2a&3v&4e&5 f&6u&7n&8!"));
                    return true;
                }
                player.sendMessage(ChatColor.RED + "You do not have perms bruh");
                return true;
            }
            else {
                sender.sendMessage("Whats up console");
                return true;
                // console

            }
        }
        return false;
    }



}

plugin yml

name: HelloWorld
version: '${project.version}'
main: me.marphh.helloworld.HelloWorld
api-version: 1.19
authors: [Marphh]
description: Test plugin created may 28th 2023
website: marphh.com

commands:
  hello:
    description: "pretty cool"
dense star
#

register it on onenable

cerulean vessel
#

getCommand("hello").setExecutor(this);

#

added that to onenable still nothing

dense star
#

what

#

make it return true

#

at the end

dense star
cerulean vessel
#

added an else statement, nothing.

made it return true instead of false at the end, nothing

#

🥲

dense star
#

show me the full code

cerulean vessel
# dense star show me the full code
package me.marphh.helloworld;

import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.material.Command;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Objects;

public final class HelloWorld extends JavaPlugin {

    @Override
    public void onEnable() {
        // Plugin startup logic

        getCommand("hello").setExecutor(this);




    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic


    }

    // /hello -> hey welcome!


    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (label.equalsIgnoreCase("hello")) {
            if (sender instanceof Player) {
                // player
                Player player = (Player) sender;
                if (player.hasPermission("hello.use")) {
                    player.sendMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "Hey welcome to the server!");
                    player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&1H&2a&3v&4e&5 f&6u&7n&8!"));
                    return true;
                }
                else {
                    player.sendMessage(ChatColor.RED + "You do not have perms bruh");
                    return true;
                }

            }
            else {
                sender.sendMessage("Whats up console");
                return true;
                // console

            }
        }
        return true;
    }



}
proud pebble
#

actually doesnt seem to mayter, both are supposed to work

shell moon
#

getCommand works too

proud pebble
#

when you run the command it doesnt say anything, but it comes up as registered right

proud pebble
#

they should learn the technique of debugging through the use of getLogger or sender.sendMessage

#

at each point

#

throw a logger.info at the start, the result of each if ststement that doesnt show up as right and potentially the current values tjat make up the if statements

shell moon
#

naaa

#

he doesnt have the @override annotation

#

probably

#

or plugin iss not even being enabled

#

¯_(ツ)_/¯

dusky harness
#

Still works without override

#

But risky

proud pebble
#

afaik the override annotation doesnt actually do anything, just is used by the ide to verify shit

#

i woupdnt thought that the main class would have to extend or implement CommandExecutor but apparently not

#

idr if its an interface or not

proud pebble
sterile hinge
dusky harness
shell moon
cerulean vessel
#

Yeah still no luck. It gives me an error when I try adding @Override above the oncommand
In the console logs when the server starts the plugin gets enabled with no errors or warnings

@proud pebble how and where do I add the logger.info?

proud pebble
#

while debugging using some form of print method throughout your method while getting to work isnt a bad way to do things

#

such as a message at the start of the method to make sure its actually getting there, the result of label since its obviously not returning hello for whatever reason

cerulean vessel
#

could i also use just a system.out.println statement?

proud pebble
#

well yeah, but you shouldnt as the server complains if you do so

#

or sender.sendMessage

#

up to you

cerulean vessel
#

ah gotcha ill try those

proud pebble
#

player extends sender at some point so player.sendMessage also exists

#

if when you run the command and even with a print at the start of the onCommand nothing shows up then there really is something wrong

cerulean vessel
#

yeah thats what im worried about hahah

#

never had this issue before its so odd

#

testing it now

proud pebble
#

tho pwrsonally id make a class for each command so that you dont have to check label

cerulean vessel
#

oh yeah i tried that too but same result

proud pebble
#

did you register it

cerulean vessel
#

yes

proud pebble
#

also maoe sure that you have set a usage in plugin.yml for the command

cerulean vessel
#

its gotta be something with the ide probably

proud pebble
#

that doesnt really make any sense

cerulean vessel
#

Well I'm using the minecraft development plugin with intellij

proud pebble
#

it only generates an empty projwct

cerulean vessel
#

i cant really think of any other reason why its doing this

#

yeah true

proud pebble
#

how are you testing the plugin?

cerulean vessel
#

localhost server

#

yep. no luck

#

only log that went through was the plugin being enabled

proud pebble
#

are you rebooting after every recompile, using plugman, using /reload, etc

cerulean vessel
#

rebooting.

proud pebble
#

you are 100% sure the jar is actually different right

cerulean vessel
#

wdym?

proud pebble
#

ive had issues in the past while copying the new jar and it just wouldnt be different

#

it was very annoying

cerulean vessel
#

yes since i can see the changes i make when the plugin gets enabled

#

(like the logging message)

#

sent you an ss of what i mean

proud pebble
#

chuck me the jar in dms

proud pebble
#

thats so fucky

#

...

cerulean vessel
#

:o

proud pebble
#

since you didnt add an override in ide, it didnt check that the parameters to override the onCommand method were correct

#

you imported org.bukkit.material.Command instead of org.bukkit.command.Command

#

so it might look fine, but the import fucked it all up

cerulean vessel
#

no fucking way

#

im testing it right now hold up

#

that makes so much sense

proud pebble
#

since it basically thinks this is a new method with new parameters, not the one that already exists so i wont override it

sterile hinge
cerulean vessel
#

Yep, luna you're right

proud pebble
#

actually using the @Override anotation wouldve showed this issue in much faster time

cerulean vessel
#

everything works now

proud pebble
#

one time when override wouldve saved us so much time

cerulean vessel
#

luna you're a godsend lmao thank you so much

#

oh yeah how do i add the override?

#

it gives me an error when i try to do so

#

oh

#

nevermind

proud pebble
#

you just do @Override above the public void onCommand(...

cerulean vessel
#

yeah it wasn't working before

#

but now that i changed it from material it works just fine

proud pebble
#

i googled it, saw a stackoverflow thread and boom it was in one of the comments

cerulean vessel
#

i knew that this was either something really big issue on my end, or just a tiny little mishap hahah

proud pebble
#

wrong import making us want to pull out our hair

#

coding is fun™️

cerulean vessel
#

😂

sterile hinge
#

how did you even register the command executor then @cerulean vessel?

#

oh I see, you didn't

#

but it would work because JavaPlugin is a CommandExecutor for some unholy reason

minor summit
#

well, you see

#

bukkit

pulsar ferry
proud pebble
#

but the whole issue was resolved by fixing the Command import since it was using the material.Command not command.Command

dark garnet
#

so what the hell is going on?!

#

its nothing wrong with my reflection or any of my code afaik

#

im giving the item via Player#getInventory() and then Inventory#addItem(ItemStack)

#

IM GONNA CRY IM GONNA CRY IM GONNA CRY
i made the item unbreakable this is the worst day of my life im going to quit programming 😭

cloud panther
#

If anyone knows how NBT tags work on 1.8.8 spigot please feel free to msg me! im here loosing my mind!

hoary scarab
#

Ask your question and show what you have tried.

cloud panther
#
ItemStack sugarCane = new ItemStack(Material.SUGAR_CANE, amount);

        ItemMeta caneMeta = sugarCane.getItemMeta();
        caneMeta.setDisplayName(caneName);
        caneMeta.setLore(translatedLore);
        caneMeta.addEnchant(Enchantment.getById(62), 1, true);
        caneMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
        sugarCane.setItemMeta(caneMeta);

        // Add custom NBT data
        try {
            Class<?> craftItemStackClass = Class.forName("org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack");
            Method asNMSCopyMethod = craftItemStackClass.getDeclaredMethod("asNMSCopy", ItemStack.class);
            Method asBukkitCopyMethod = craftItemStackClass.getDeclaredMethod("asBukkitCopy", Class.forName("net.minecraft.server.v1_8_R3.ItemStack"));

            Class<?> nmsItemStackClass = Class.forName("net.minecraft.server.v1_8_R3.ItemStack");
            Method getTagMethod = nmsItemStackClass.getDeclaredMethod("getTag");
            Method setTagMethod = nmsItemStackClass.getDeclaredMethod("setTag", Class.forName("net.minecraft.server.v1_8_R3.NBTTagCompound"));

            Class<?> nbtTagCompoundClass = Class.forName("net.minecraft.server.v1_8_R3.NBTTagCompound");
            Object nmsItemStack = asNMSCopyMethod.invoke(null, sugarCane);
            Object nbtTagCompound = getTagMethod.invoke(nmsItemStack);

            if (nbtTagCompound == null) {
                nbtTagCompound = nbtTagCompoundClass.newInstance();
            }

            Method setIntMethod = nbtTagCompoundClass.getDeclaredMethod("setInt", String.class, int.class);
            setIntMethod.invoke(nbtTagCompound, "CUSTOM_FARM_ITEM", 1);

            setTagMethod.invoke(nmsItemStack, nbtTagCompound);
            sugarCane = (ItemStack) asBukkitCopyMethod.invoke(null, nmsItemStack);
        } catch (Exception e) {
            e.printStackTrace();
        }

#

omfg it was a space ;/

ocean raptor
#

best answer to what were people doing before pdc was invented

ocean raptor
#

cache your classes etc

dense drift
#

Or if you build a plugin for a single version you can use NMS directly

mental cypress
#

paperweight dance

dense drift
#

Isnt that for like 1.16+?

proud pebble
#

what in the hell is enchantment 62

dense drift
#

Lure

cloud panther
broken elbow
#

that ping was meant for Lunaiskey. My bad

proud pebble
cloud panther
#

@proud pebble cause i didn't know that was a thing crying

#

is there a documentation or something where i can find these things

proud pebble
#

it wouldve also shown up in your ide that its deprecated

#

the getById method

proud pebble
cloud panther
#

@proud pebble cause im new to plugin deving

proud pebble
cloud panther
#

yep

proud pebble
#

or did you use chatgpt to write it for you

cloud panther
proud pebble
#

or did you just copy and paste it from the internet

cloud panther
#

na, i have some experience with java, so reading between the lines and have read some of the other devs codes

#

i just filled in the blanks

icy shadow
#

to be fair

#

it's not like nms code is documented lmao

#

the javadocs wouldnt tell you shit in this case

proud pebble
#

but like how would they know Enchantment#getById() exists but not Enchantment#[InternalEnchantNameHere] doesnt

icy shadow
#

¯_(ツ)_/¯

cloud panther
#

i had to use getById

#

to make it specific

proud pebble
cloud panther
#

i have no clue but when i was checking the nbt data between the two items

#

it was different

#

i had to do it via getbyid

#

tbf i probably had messed something up

#

ANYWAY, the code works now 🙂

proud pebble
#

probably forgot to update the items meta

proud pebble
#

no point using reflection if you dont have to

#

if you want to use nms directly, run buildtools and have it create a 1.8.8 jar, itll add stuff to your .m2 folder aswell, you have to run buildtools atleast once on your system for each minecraft version to beable to get the nms and craftbukkit classes since spigot cant host them in their repo and itll create them in your local repo. then just change the dependency in either your pom.xml or build.gradle from spigot-api to spigot and you should beable to access all the nms and craftbukkit classes

lyric gyro
proud pebble
lyric gyro
proud pebble
#

at line 36

#

in the try catch statement you made

#

cus its very possible that its throwing the failed to create exception, and if it failed then the items variable was never updated making the object null

lyric gyro
vital schooner
#

hi, in intellij there is no 1.8 selection for the minecraft intellij plugin when making a project, so i make a 1.12 one and change the version in pom.xml to 1.8.8 after, but when i try and compile i just get "Malformed \uxxxx encoding.", tried doing a lot of stuff from online research but cant seem to fix, any suggestions?

stuck hearth
#

Don't develop for 1.8 is my suggestion

proud pebble
#

your building for java 8 right?

vital schooner
#

yeah

#

do u recon its worth reinstalling maven

vital schooner
grave wind
proud pebble
spiral prairie
#

Yeah that looks like a crime

stuck hearth
#

Tbh using new is cringe

icy shadow
#

True

#

That’s why I exclusively use Unsafe to allocate instances

spiral prairie
#

yeah

#

who doesnt

#

I run a small assembly executable to allocate new instances by bypassing the kernel to modify the JVM memory pages

half arrow
shell moon
#

haha no code available xd

worn jasper
#

Uhm... think I need some help with this... this looks like biggest spagetthi code I have ever seen lmao

boolean finished = false;
int offset = 0;
while (!finished) {
  HangarProjects projects = hangarClient.getProjects(25, offset).join();
  if (projects.result().size() == 0) {
    finished = true;
  } else {
    offset += 25;
    for (HangarProject project : projects.result()) {
      resourceCache.add(project.namespace().slug(), project, versions);
    }
  }
  try {
    Thread.sleep(1000);
  } catch (InterruptedException e) {
    throw new RuntimeException(e);
  }
}
#

(For context, getting all the projects from Hangar, the Thread sleep is def. getting replaced, but it's there to just not fully spam the api)

worn jasper
#

Hell, I am stupid

dusky harness
#

Lol

worn jasper
#

ok no still didn't fix the spagetthi code

#

only found an useless api call lol

lyric gyro
#

Im trying too put something like this in config its being done all through code as a set
users: {}

dusky harness
#

but I'm not sure exactly what you're asking

lyric gyro
sudden sand
#

Hi, I'm trying to return the value of a CompletableFuture, here is my code

#
public <T> T getData(RunnableReturn<T> runnable){
        if (shutdown) {
            return null;
        }

        CompletableFuture<T> future = CompletableFuture.supplyAsync(runnable::run, databaseExecutor);

        return future.thenAccept(t -> );

    }```
#

how can I return the value "t" inside of the consumer

#

Ok my question is illogical I've found the solution

robust flower
#

I'm stuck with a serialization issue here, I have a Map<String, Object> which values can be anything from simple integers to other complex (but serializable) objects, like Instant, other POJOs, and even other nested Maps inside it.

How can I serialize and deserialize this Map in a way that the new map is .equals to the old map, that is, no types were changed between the old and new maps.

I can use any data representation/format available, it can be literally anything (XML, JSON, you name it), and also any Java/Kotlin library to do this conversion, I just need it to work.

Obs.: Java serialization is out of scope.

icy shadow
#

Unironically javax serialisation is probably your best approach lmao

#

Noooo

#

but with any other framework you’re going to need to register “tags” for all the different types semi-manually

#

If I’m understand you correctly

river solstice
icy shadow
#

projecting

robust flower
#

Well, I tried Jackson's enableDefaultTyping configuration, and it did kinda worked, but it could not correctly deserialize the values from a Map.

icy shadow
#

How so?

robust flower
#

Well, I had a Map containing an Instant, that when deserialized, became a list more or less like this:

{
  "instant": [
    "java.time.Instant",
    16487458.8578154
  ]
}```

instead of becoming an actual `Instant`, but it worked for simple types
dusty frost
#

kotlinx.serialization is pretty sweet from my limited experience

#

though having a map of String -> Object is a bit insane to be honest

#

maybe a bit of an x y problem?

robust flower
#

Well, is asking for a complete solution for deserializing objects from and to something without having to spoonfeed the framework with the types a little bit too much?

Tbh I'm kinda frustrated with this issue, I can't believe there is not a single solution (that doesn't such, I'm looking at you, Java Serializable) that works for these issues. I'm not even asking for JSON to do this, I'm asking for a data format that exists and is able to hold types (read Classes) from their values from before being deserialized

dusty frost
#

i mean what's wrong with Java Serializable?

#

like, most serialization frameworks can do what you're asking pretty easily

robust flower
#

the issue with it is that I'm using some framework classes that do not implement it, so java serialization gives up and explodes when I try to use it