#help-development

1 messages · Page 1827 of 1

mighty sparrow
#

For*

fair sand
#

I'm looking it up

#

Thx ^^

mighty sparrow
#

Np

fair sand
fossil mural
#

Im writing a minecraft parkour plugin. With the help of a command I can set the checkpoints location earlier. But when i'm checking if the player is at the location i need to have the variable from the commands class to the eventhandler. How do I do that?

mighty sparrow
#

Im going to sleep mb

fair sand
#

Ok good night

mighty sparrow
#

Thx

fossil mural
#

A location varible

waxen plinth
#

How are you storing checkpoint locations

fossil mural
waxen plinth
#

Jesus

#

Why would you call getRelative(BlockFace.SELF)

#

And why are you getting all those values from the location just to construct an identical one

#

Just get their location

#

And those variables will be deleted as soon as the command is finished being run

#

?learnjava

undone axleBOT
waxen plinth
#

I think you need to learn Java basics before attempting to write something like this

fossil mural
#

okey

quaint mantle
#

wow that code LOL

#

i cant imagine something uglier than that lul

ivory sleet
#

Don’t be mean guys

tired dagger
#

^

#

Everyone starts somewhere

rough basin
#

Is it possible to create an event that is triggered when there is an entity inside the BoundingBox?

quaint mantle
#

why not

#

just dunno how 🤔

rough basin
#

me too lmao

earnest tulip
#

how would I go about making a player swim faster, other than obviously checking for the player swimming

tired dagger
#

I assume you'd do something with collisions. There may or may not be an event for that but I don't think it would be that hard to create

earnest tulip
tired dagger
#

Wdym?

earnest tulip
#

yeah that didnt make sense, did it lol
ive tried getting the player's velocity and setting a new velocity to that, but obviously that will cause issues, and i tried getDirection but it was way too fast

#

i hope that explains it better

tired dagger
#

Hmm? What exactly do you mean when you say setting the velocity will cause issues?

earnest tulip
#

so i did something like player.setVelocity(player.getVelocity().multiply(1.5)), but that results in a recursive increase in speed, which launches me across the world lol

tired dagger
#

Ohh, haha

earnest tulip
#

idk man i just want to swim faster 🥲

#

150% speed is all i need

tired dagger
#

Guessing bc the event calls each time the player is detected for being in the water so it repeatedly calls your method.

waxen plinth
#

Why not just give them dolphin's grace

earnest tulip
#

heelllll no

waxen plinth
#

Or depth strider boots

earnest tulip
#

i hate dolphjins grace

#

(sorry)

waxen plinth
#

.-.

earnest tulip
#

it does this weird slippery sht

waxen plinth
#

Ok well those are how you can modify the swim speed

#

Depth strider then

earnest tulip
#

...sure with vanilla

tired dagger
#

Mmm, I suppose you could keep using your swim event but use a var to see if you've run it and set a cool-down if so

earnest tulip
#

i was thinking of using an armorstand and teleporting the player to it instead but that would be janky

earnest tulip
waxen plinth
#

You could just cap the velocity

earnest tulip
#

thats a fair point

tired dagger
#

That would work too

waxen plinth
#

Though they would still get propelled endlessly once they started moving

earnest tulip
#

yuea

#

the issue is that i want the player to have their velocity set in the direction they are swiming

waxen plinth
#

Okay

tired dagger
#

What about speed effects? Do those work in the water?

earnest tulip
#

nah

#

unfortunately

primal ledge
#

Need help deciding. I have an extension classes for Spigot's file API which contain functional equivalent of the getters (return an Optional). What do you think the methods should be called like?

public double getDouble(String route); // Main method
public Optional<Double> ?(String route) // Functional equivalent

The name could be getOptDouble, getOptionalDouble, getDoubleOpt, getDoubleOptional... or something else. Could you help me decide what's the best? Thx :))

earnest tulip
#

🤔

waxen plinth
#

Isn't there an OptionalDouble class

primal ledge
#

Assuming there are about 25 of those methods even for custom types, that isn't an option :((

waxen plinth
#

Huh

#

How not

#

Like, instead of Optional<Double>

#

There's OptionalDouble

lethal island
#

can someone pls link me something on updating plugins to 1.18

waxen plinth
#

Why

primal ledge
#

Yes, but there are also custom getters, where class like this doesn't exist. Therefore, I just sticked with Optional.

waxen plinth
#

Plugins should work on 1.18 without any changes unless they're doing something funky

primal ledge
#

And I think using the same class for everything would be better :))

#

e.g. Optional

waxen plinth
#

Ok well getDoubleOpt is what I would do

primal ledge
#

Thx ❤️

lethal island
#

i swapped out the spigot jar and all of the imports broke

primal ledge
#

any other opinons?

lethal island
#

i probably did something wrong dw

chrome beacon
#

I recommend using Maven instead of directly importing jars

lethal island
#

ok thank u i will look into that

chrome beacon
#

Directly importing the 1.18 jar won't work very well

opal juniper
#

it will “work”™️

waxen plinth
#

Gradle

opal juniper
#

argh

#

redempt stop being a shill smh

waxen plinth
#

What

#

Gradle is good

#

Any build system is better than none though

chrome beacon
opal juniper
#

true dat

#

i haven’t had time to look inside it tho

#

so i’m not familiar with the format

chrome beacon
opal juniper
#

wait

faint vapor
opal juniper
#

it packages actual jars? thought normally they just included teh classes

#

seems weird

earnest tulip
chrome beacon
#

It's jars this time

tired dagger
#

You're welcome!

waxen plinth
faint vapor
#

never mind Bukkit.spigot.getconf, it didnt really pop up in any of my google searches

primal ledge
#

Do you think that if I name a class Path in a widely used API, it would be a problem to differentiate it from already built-in Java class Path (NIO package)? Path will be used for the same purpose as string paths in Spigot configuration API. Should I use other name, so it isn't confusing - e.g. Route?

hybrid spoke
#

i would name it ConfigurationPath or whatever

primal ledge
hybrid spoke
#

too long for what?

primal ledge
#

I mean, assuming the class would be used often by devs, wouldn't it make the code much longer than needed?

quaint mantle
#

nah it shouldnt be a problem with me, who do every code on one line

primal ledge
#

That's why I thought about Route at first

quaint mantle
#

public void setMessage(String message) { this.getConnection.getPlayer.getStates.changeMessage(message); his.getConnection.getPlayer.getStates.updateMessages(); }

hybrid spoke
#

too long would be something like SpigotFileConfigurationConfigurationSectionPath since you could split it down and it would have the same meaning

karmic mural
#

Passing my main class to a class with an eventhandler... can I just have a constructor in that class with the eventhandler?

#

Basically I have a class with an eventhandler and I want to access my config from it

#

ignore the image I sent it was not meant for this chat.

tardy delta
#

if a create a variable in the constructor to use as paramater in lambda, when is it gc'ed?

primal ledge
primal ledge
ivory sleet
#

Yuh the name might be confusing

#

Might wanna call it DestinationPath or smtng

primal ledge
#

Route is not that descriptive when representing path isn't it

ivory sleet
#

Depends, I mean it sounds pretty high level

primal ledge
# ivory sleet Depends, I mean it sounds pretty high level

Well, Spigot uses string keys. Per YAML spec, any object is allowed as key, which I would like to make accessible for devs. So I need a class that will carry an array containing the individual keys (instances of Object). That's what I need it for :)) Does "Route" sound good for this job now?

#

bcs I really like it but I don't know if it's good and need other opinions yk :))

ivory sleet
#

Yeah I know yaml specs is kinda baboony

primal ledge
#

so I think it would be great to make an extension for that

ivory sleet
#

Yeah, but I mean spigot and any other stuff really has to narrow down the amount of yaml specs you’d support

#

Because yaml specs is just too diverse

primal ledge
#

Couldn't agree more. I will use YAML 1.2 which allows safe JSON parsing... decided it's the best

ivory sleet
#

Yeah, the worst part is probably the whole anything can be a key and comments are not node attached

primal ledge
#

Agree. I'm only going to support it bcs not a lot of work is needed and might help someone who needs it... Regarding the comments, thats what my lib is going to solve (not only that); comments will be supported everywhere.

#

and actually are, just finishing documentation :))

ivory sleet
#

Yuh

#

Anywaya regarding Route, I think that’ll do fine

primal ledge
#

Thank you ❤️

ivory sleet
#

With the presumption that it’s put into the according package

primal ledge
#

sure it is! :))

#

also, would like to ask you one thing

ivory sleet
#

Sure, ask away

rotund pond
#

?paste

undone axleBOT
primal ledge
#

would you be interested in being part of the project in form of reviewing the beta documentation when it's ready?

ivory sleet
#

Yeah, why not (:

primal ledge
#

Sent you a friend request :))

ivory sleet
#

🙌

lavish hemlock
#

tip:

#

Just don't use YAML, ever.

#

TOML ftw.

chrome beacon
#

I like yaml more

#

Do miss comments though

regal dew
#

yaml has comments

primal ledge
#

YAML has comments, but mostly no one implements them

regal dew
#

its just that, the only library used in spigot is snek yaml

#

which does not support it

chrome beacon
#

Comments don't get saved in the yaml spec

primal ledge
#

that's why I made my own lib, which will support them everywhere :)) available soon

ivory sleet
#

Newer versions of snake yaml support it

#

However the specs say that the comments are not bound to any particular node as they’re mainly there to explain/clarify the structure (or other things)

wild marten
#

so im tryna build (with buildtools) a 1.18 jar, how do i select my java 17 JDK cuz it defaults to using java 8

chrome beacon
#

What OS are you using

#

Windows?

wild marten
#

windows 10

summer scroll
wild marten
#

thanks

karmic mural
#

What's the best way to check if blocks are naturally generated when a player breaks them?

#

Is there an easy way to do it or would I actually have to store player-placed blocks or something like that? (I want to track ores specifically)

young knoll
#

Yes you would have to store them

karmic mural
#

Is there an existing plugin you know of that makes this easier for me? 😅

young knoll
#

Not that I know of

karmic mural
#

Would you happen to know how much strain it would put on a server to do this? I'd assume I would have to use BlockPlaceEvent, then check if it's an oreblock, and if that condition is met add the block to a map/collection?

young knoll
#

Yes

#

You can just add the location

rigid hazel
#

Error: [14:06:52 ERROR]: [MythicMobs] [SCHEDULER] Exception thrown whilst executing task [14:06:52 WARN]: java.lang.IllegalStateException: Asynchronous getNearbyEntities! [14:06:52 WARN]: at org.spigotmc.AsyncCatcher.catchOp(AsyncCatcher.java:16) [14:06:52 WARN]: at org.bukkit.craftbukkit.v1_17_R1.entity.CraftEntity.getNearbyEntities(CraftEntity.java:600) [14:06:52 WARN]: at AureliumMythicMobs-1.0.jar//me.often.aureliummobs.mythicmobs.SetNameMechanicExtension.castAtEntity(SetNameMechanicExtension.java:45) [14:06:52 WARN]: at MythicMobs-4.13.1.jar//io.lumine.xikage.mythicmobs.skills.SkillMechanic.lambda$executeTargetedEntitySkill$5(SkillMechanic.java:453) [14:06:52 WARN]: at java.base/java.lang.Iterable.forEach(Iterable.java:75) [14:06:52 WARN]: at MythicMobs-4.13.1.jar//io.lumine.xikage.mythicmobs.skills.SkillMechanic.executeTargetedEntitySkill(SkillMechanic.java:449) [14:06:52 WARN]: at MythicMobs-4.13.1.jar//io.lumine.xikage.mythicmobs.skills.SkillMechanic.lambda$executeSkills$1(SkillMechanic.java:406) [14:06:52 WARN]: at MythicMobs-4.13.1.jar//io.lumine.xikage.mythicmobs.skills.SkillMechanic.runMechanic(SkillMechanic.java:444) [14:06:52 WARN]: at MythicMobs-4.13.1.jar//io.lumine.xikage.mythicmobs.skills.SkillMechanic.executeSkills(SkillMechanic.java:406) [14:06:52 WARN]: at MythicMobs-4.13.1.jar//io.lumine.xikage.mythicmobs.skills.SkillMechanic.execute(SkillMechanic.java:324) [14:06:52 WARN]: at MythicMobs-4.13.1.jar//io.lumine.xikage.mythicmobs.mobs.MythicMob.lambda$executeSkills$2(MythicMob.java:1066) [14:06:52 WARN]: at MythicMobs-4.13.1.jar//io.lumine.xikage.mythicmobs.utils.Delegates$RunnableToSupplier.get(Delegates.java:121) [14:06:52 WARN]: at MythicMobs-4.13.1.jar//io.lumine.xikage.mythicmobs.utils.promise.LuminePromise$SupplyRunnable.run(LuminePromise.java:654)

#
List<Entity> players = monster.getNearbyEntities(radius, radius, radius).stream().filter(entity -> entity instanceof Player).toList();
#

How do I fix this?

quaint mantle
#

Use sync not async

rigid hazel
candid galleon
#

bug the mythic mobs developer

rigid hazel
quaint mantle
#

Bruh? LMAO

candid galleon
#

It is not my code

I coded it myself

#

fucking big brain we got in here

quaint mantle
#

Ahahha

young knoll
#

Call it sync

rigid hazel
#

Then how do I do it?

rigid hazel
candid galleon
ivory sleet
#

No async

candid galleon
#

Asynchronous getNearbyEntities!!!

ivory sleet
#

Basically

#

?scheduling

undone axleBOT
rigid hazel
#

This is my code

#

But the method I call there from MythicMobs is async

candid galleon
#

odd that Mythicmobs runs it async

rigid hazel
#

How do I avoid that?

candid galleon
#

you can't without a lot of work

rigid hazel
ivory sleet
#

BukkitScheduler::runTask

candid galleon
#

you could make it run sync next tick

rigid hazel
rigid hazel
#

I will try

ivory sleet
#

Best of luck

rigid hazel
#

Ok. It fixed the error. Thanks.

gloomy spoke
#

Hey, I just followed a tutorial, and I'm a little confused. Where do I access all the items from in the API?

#

if(player.getInventory().getItemInOffHand().isSimilar()){
I have this thing, and I just dont know where to pull the items for the isSimilar() for

#

I tried Material, but pretty sure that's blocks..

candid galleon
#

Material works for items as well

gloomy spoke
#

'cause i cant find the shield

#

oh

#

nevermind, somehow worked this time

candid galleon
gloomy spoke
#

sorry, and thank you

candid galleon
#

👍 np

gloomy spoke
#

wait how do i get the itemstack out of the material?

candid galleon
#

swap it

#

you can get the material out of the itemstack

#

ItemStack#getType

gloomy spoke
#

wait what

#

for the isSimilar() i need ItemStack

candid galleon
#

that method compares two item stacks

#

if you just want to check if an item is a specific material (ie shield) you can do item.getType() == Material.SHIELD

gloomy spoke
#

ohhhh

#

Seems to be working, thank you very much

candid galleon
#

👍

gloomy spoke
#

So far, this API seems to be very clean though, I love it!

quaint mantle
gloomy spoke
#

No, I mean the 5 tick delay after right clicking with a shield out before it actually blocks

quaint mantle
#

i always thought it was instant

gloomy spoke
#

:^)

#

I started really feeling it on hard difficulty against skeletons

#

the added server delay just made it 2x worse

candid galleon
#

You'd probably have to look at the packets

gloomy spoke
#

What's that?

candid galleon
#

Basically you'd want to use ProtocolLib and listen to the packets being sent from the client

#

no guarantee that would work

gloomy spoke
#

Christ

candid galleon
#

yeah

gloomy spoke
#

maybe i could make the player manually deflect arrows for 5 ticks after they start blocking?

rough basin
#

How to remove snowball that snowman shoot?
I just found ProjectileLaunchEvent to Trigger this working, but I have no idea what should i do next :(

candid galleon
#

look at the javadocs for that event and see if there's a way to fetch the entity

#

Entities have a remove method

rough basin
#

if i use getEntity Method, What should i get for return?
I have no idea it is Snowman or Snowball

candid galleon
#

well the event is called ProjectileLaunchEvent

rough basin
#

hmm

candid galleon
#

getEntity returns the projectile

#

if you wanted to get the thrower / shooter you'd have to cast it to a projectile

rough basin
#

Forgive my poor english :d
javadoc always makes me confusing like this

rough basin
#

Thanks for your answer :D

gloomy spoke
candid galleon
gloomy spoke
#

Okay that's fair

rough basin
#

I hope it is legit

candid galleon
#

you don't want to create a new itemstack just to check materials

hybrid spoke
#

not even close

rough basin
#

🤦

quaint mantle
#

?learnjava just in case, ya know, it still impress me everyday even tho i read it for like more than 10 times lol

undone axleBOT
quaint mantle
#

nohow

candid galleon
#

i mean

#

you could query the mojang API whenever a player joins

#

as long as you cache the results and don't have that many players joining could work in theory

quaint mantle
#

Fr tho

candid galleon
#

every time on join you'd have to check if it was cached

#

invalidating/updating a cache would be trivial

#

but yes, you would still have to query the API if you didn't have it cached

gloomy spoke
#

ok god damn it's working

#

i cant believe i managed it first try

#

just gotta make the shield take damage now

candid galleon
#

🎊

#

good job

rough basin
#

hmm

#

seems more nice?

candid galleon
#

you can do item.getType() == Material.VILLAGER_SPAWN_EGG

#

the code you have wouldn't work, as a Material cannot Equal an ItemStack

gloomy spoke
#

Is there some sort of event that i could call for an item taking durability damage? i dont want to have to calculate Unbreaking enchantments in my own code...

rough basin
#

damn

candid galleon
#

looks like unbreaking is a simple 1 / (level + 1) check

#

I don't think Spigot has the functionality you're looking for, it wouldn't be that difficult to implement it yourself

smoky finch
#

How do I check if any painting is attached to any side of a block? I'm currently using getNearbyEntities but the problem is that you can't know how the painting is positioned (depending on the size of the painting) to see if a particular block is one of the blocks that's holding the painting.

My final goal was to just prevent a painting from falling without block support, but I don't think that's possible so I'm looking for a way to not remove blocks that are supporting a hanging entity.

candid galleon
#

I think blockphysicsevent might be what updates paintings

tender shard
candid galleon
#

and Painting has a getArt (Art) which supports getWidth/Height

tender shard
#

e.g. IIRC, if the painting has a direction of WEST, you'll have to check the block at EAST

candid galleon
#

isn't that built in

smoky finch
candid galleon
#

trial and error

#

most likely the painting is at a consistent place

#

whether that be lowest x / z

smoky finch
#

Is it tho? If not that doesn't make sense

candid galleon
#

try some debugging

#

it wouldn't make sense, so it would be worth it to try 😉

tender shard
#

somehow I didn't find it back when I needed it

#

or something was wrong with that method. I think it only worked for the default blockfaces, but not for SOUTH_SOUTH_EAST or something? i dont remember

trail lintel
#

Hey guys, a bit of a followup to my question from yesterday. So I have created a custom item, defined a recipe for it, set its meta to be "unique" and put an enchant on it with the "hide enchantments" tag, to make it appear unique. I have also put a value of custom model data on it, so when a player is using the resource pack I have made, they see a custom texture for the item. However, I was wondering if there was a way to have the item appear enchanted if they do NOT have the resource pack, but to make it appear unenchanted if they DO have the resource pack. If they have a custom skin for the item, the enchantment effect seems somewhat redundant (and makes the art harder to see). Thanks in advance for any help =]

candid galleon
#

no

#

afaik no

keen lake
#

Hi. Has anyone created a plugin with ORM handling the database (preferably Hibernate)?

candid galleon
#

you could customize the enchantment glint in the resource pack to be transparent

trail lintel
#

I figured that was the case =] I will prob just have it always appear enchanted then

candid galleon
#

but then no items would appear enchanted

trail lintel
#

That was my intuition, thanks a bunch =]

#

@keen lake Samples on the example page. This one is for mysql but same idea.
https://www.spigotmc.org/wiki/plugin-snippets/
https://www.spigotmc.org/wiki/connecting-to-databases-mysql/

#

oops tagged wrong guy sorry

trail lintel
#

Ok one other question 😉

#

So I want to have some configuration options in my config. Two of which are the name of the item, and the message shown when somebody isnt allowed to use it (not permission based, separate logic). In the message, I want people to be able to make references to the name of the item, so they could do something like "You cannot use {itemName} yet.. Is there a convention for string replacements in spigot plugins? What "indicators" are usually used to say this is a string replacement? Somebody might want to put { or } in their message. Hmmmm.

#

I assume my mod page would list out available "replacement strings" -n = item name, d = item description

candid galleon
#

%'s are pretty popular

#

%itemName% for example

trail lintel
#

Ohhh yeah thats not a bad idea

candid galleon
#

I personally use native string formatting %s

trail lintel
#

I think that is what I shall do, thanks a lot 😄

#

my java is a bit rusty haha

#

So in that case, you use native string formatting, how do you tell it what to replace WITH? what does %s equal? Are you doing this in the context of config files or just in the code

#

I suspect in my case I will need to define pre-existing possible values, like %n would string replace the name in?

regal dew
#

String#format

#

%s is a string, %d a number, %f a float etc

trail lintel
#

That I'm familiar with

#

But like, these aren't arbitrary strings they can replace

regal dew
#

but yeah it depends on order

trail lintel
#

It will specifically be looking for like ItemName in my yaml

regal dew
#

String#format is not idea lfor configurations

#

something that is nice however is adventure + minimessage

#

in minimessage you have templates, which you can replace during the parsing

#

<red><item_name></red> e.g.

trail lintel
#

Ohhhh interesting, looking at their documentation now

#

yup I was prob overthinking it, this suits my needs just fine 😉

gameModeChangeMessage: 'Sets game mode to %s'
String message = getConfig().getString("gameModeChangeMessage");
String messageFormatted = message.contains("%s") ? String.format(message, gameMode)
#

(example from stack overflow, not my situation)

vale ember
#

What's a good NPC lib without need for installing in plugins folder?

gloomy spoke
#

Can someone explain why it cant find .setDamage? from what i've seen this is the general way to do it

candid galleon
#

setDamage takes a parameter right?

tender shard
#

does someone know whether in spigot.yml, the "world-settings.<worldname>" settings are case sensitive for the world name?

candid galleon
#

what does your IDE say when you hover over the red?

gloomy spoke
#

it cant find it at all

vale ember
#

where's ind argument

#

int*

#

setDamage(int damage)

gloomy spoke
#

still cant find it

#

i put in a number and it's still red

visual tide
#

why cast

vale ember
#

can you put and send screenshot again?

gloomy spoke
vale ember
#

what spigot version you're using?

eternal oxide
#

Probably the wrong Damageable import

gloomy spoke
gloomy spoke
#

1.18-R0.1

candid galleon
#

what damageable import are you importing?

gloomy spoke
candid galleon
#

there are multiple

#

can you show us it?

gloomy spoke
vale ember
#

org.bukkit.inventory.meta

gloomy spoke
#

import org.bukkit.entity.Damageable;

#

oh

vale ember
#

org.bukkit.inventory.meta.Damageable

gloomy spoke
#

ohhh

#

ohhhh

#

shit

tender shard
#

someone has an idea for a better version of this? I need to get the "world-settings.<worldname>.hopper-amount" for all worlds, but since I need to do it in every InventoryMoveItemEvent, maybe there's a better / faster version?

    private final HashMap<String,Integer> maxHopperMoveAmounts = new HashMap<>();
    private final int maxHopperMoveAmountDefault;

    {
        maxHopperMoveAmountDefault = Bukkit.spigot().getConfig().getInt("world-settings.default.hopper-amount",1);
        if(Bukkit.spigot().getConfig().isConfigurationSection("world-settings")) {
            for (String worldname : Bukkit.spigot().getConfig().getConfigurationSection("world-settings").getKeys(false)) {
                maxHopperMoveAmounts.put(worldname, Bukkit.spigot().getConfig().getInt("world-settings." + worldname + ".hopper-amount", maxHopperMoveAmountDefault));
            }
        }
    }
    
    // This gets called once in EVERY InventoryMoveItemEvent    
    private int getHopperMoveAmount(String worldName) {
        return maxHopperMoveAmounts.getOrDefault(worldName,maxHopperMoveAmountDefault);
    }
gloomy spoke
#

this one's on me, sorry for the fuss xdd

vale ember
#

that's really shit, couldn't bukkit developers add some prefix like MetaDamagable or ItemDamageable?

eternal oxide
#

there is, its in the import package

candid galleon
#

you're free to contribute that

gloomy spoke
#

massive thanks though

vale ember
# eternal oxide there is, its in the import package

but it's confusing, you can easily misimport it or if you use both you will end up with long, less-readable statement like "((org.bukkit.inventory.meta.Damageable) damageable).setDamage(10)" instead of "((MetaDamageable) damageable).setDamage(10)"

eternal oxide
#

true

tender shard
#

this is one of those problems that occur once, and then you will always remember it and it'll never happen again lol

vale ember
ivory sleet
#

It’s weird they didn’t name it to smtng like Durable instead of Damageable

ivory sleet
vale ember
tender shard
sacred ice
#

Hey, how do I send packet in 1.18 java.lang.NoSuchMethodError: 'void net.minecraft.server.network.PlayerConnection.sendPacket(net.minecraft.network.protocol.Packet)', Thanks

#

I get this error

late sonnet
sacred ice
#

For something not include in the API

late sonnet
#

The handle in craftplayer has a method for sendpackey or send not sure the name

#

Then only need create the class for the packet... Works same since... Not sure

visual tide
sacred ice
#

I have ((org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer)player).getHandle().b.sendPacket(packet));

candid galleon
#

hot take

#

packets aren't supported by spigot

sacred ice
#

it works with packets

candid galleon
#

and you know that because it works?

sacred ice
#

no because i have the jar and I can see through

#

inside i mean

candid galleon
#

so are you trying to copy a plugin?

visual tide
sacred ice
#

The spigot jar

vale ember
#

what npc lib/plugin i can safely shade in my plugin?

#

which supports 1.14.4+

sacred ice
#

ty

visual tide
ivory sleet
#

technically

vale ember
#

i mean i don't want to depend

#

on plugin

visual tide
#

yes shade the whole plugin

ivory sleet
#

shade, relocate and just invoke its onEnable and onDisable

visual tide
#

...

vale ember
ivory sleet
#

heavy as?

vale ember
#

i need simple npcs

#

just standing

ivory sleet
#

I mean your jar will certainly become fat

vale ember
#

with right click listener

#

and custom skins

visual tide
#

or do it yourself

vale ember
#

simple npcs + no need to depend + 1.14.4+

cinder timber
#

developing a fully pvp-based server, it won't have high specs so should i use 1.8.8 jar or just latest

ivory sleet
#

I mean I always encourage newer versions

#

but since certain people tend to play 1.8 still, Ig?

#

altho you'll have to live with outdated api, possible memory leaks and vulnerabilities

golden turret
#

is there a way to get all available EntityTypes that can get from the creative tab?

trail lintel
#

Ok.... one more question about custom items lol. To check if a given item is mine in the right click event, I am comparing the metas. However, now if I change the meta like the name of the item or something in an update and restart the server, my event.getItem().getItemMeta().equals(item.getItemMeta()) will no longer match and the old item wont be treated the same anymore. Is there a way to just set like a custom tag on an item, so that I can keep that the same between version changes and do checks on that instead of the whole meta object?

golden turret
#

?pdc

stone sinew
golden turret
#

oh yes the material

trail lintel
#

awesome, this is exactly what I needed =]

robust forge
#

How can I get all entities in a chunk when loading it? I tried to use

    public void load(ChunkLoadEvent e) {
        Bukkit.getLogger().info("Chunk loaded");
        for(Entity entity : e.getChunk().getEntities()) {
            Bukkit.getLogger().info("Entity Found");
        }
    }```
golden turret
#

what it says

robust forge
#

Only Chunk Loaded

#

Doesnt give me the Entity Found

golden turret
#

wait a tick

quaint mantle
#

Sorry for cross-post, but i wonder, it is okay to abuse sql transaction like that?

PreparedBatch batch = handle.prepareBatch("INSERT OR IGNORE INTO members (clan_tag, uuid, role) VALUES (<tag>, <uuid>, <role>)");
            for(ClanMember member : clan.getMembers()) {
                batch.bind("tag", clan.getTag())
                        .bind("uuid", member.getUniqueId())
                        .bind("role", member.getRole().getName())
                        .add();
            }
            updates = Arrays.stream(batch.execute()).sum(); 

            if(updates != clan.getMembers().size()) { // some members weren't added; those are already in another clans; 

                handle.rollback();
            }

golden turret
#

and check

robust forge
#

But there are animals in the chunk

#

Ok thanks

eternal oxide
#

If I remember correctly there is an entities loaded event now

golden turret
#

if i call entity.damage(damage, player), the EntityDamageByEntityEvent wil lbe called?

chrome beacon
#

Probably

golden turret
#

yes

#

im trying to kill an entity with entity.damage(entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(), player);

#

this is in the PlayerInteractAtEntityEvent and im needing to interact with the entity 2 time to it kill the entity

chrome beacon
#

If you want to kill it eithet set hp to 0 directly or do a larger amount of damage

golden turret
#

Float.MAX_VALUE 🤡

hybrid spoke
#

will this unalive him?

austere thicket
#

How could i intercept a chat message? in bungeecoord

heavy perch
#

Question to memory consumers and savers
Are instances prefered?

heavy perch
#

static vs getInstance

tender shard
#

getInstance basically always is a static method

quaint mantle
#

Just pass you plugin in constructor like any other depenency 😗

heavy perch
#

Ig

trail lintel
#

hey guys, is there a way to make getConfig() serialize to a java object for simple access instead of having to do getObject(String id) each time? I think i'm close with extending from Config class perhaps?

tender shard
ivory sleet
#

ConfigurationSerializable perhaps

trail lintel
#

I would like to serialize the entire config file into a java object

quaint mantle
#

Bukkit config api starts sucking at this point

tender shard
#

But it already is a java object: FileCOnfiguration

trail lintel
#

Or if this is stupid, how do you guys approach this?

tender shard
#

what are you actually trying to do?

trail lintel
#

I want to just have a simple object I can reference its members instead of querying the config for a value each time in my event handler

#

cache it once when the server loads up

ivory sleet
#

I use object relational mapping 😛

tender shard
#

the config already is nothing else on the inside than a Map<String,Object> IIRC

ivory sleet
#

or just object mapping 😛

trail lintel
#

Lololol am wait

#

I am likely being the big dumb 😉

quaint mantle
#

as variant, you can manually parse your config, or, use a library like Configurate or DazzleConf

trail lintel
#

yeah I think you are right its just a map anyway, so it shouldn't be any less efficient

quaint mantle
#

Which does Object mapping for you based on annotations

trail lintel
#

I was thinking it was reading from the file each time

golden turret
#
public class Config extends YamlConfiguration {
  //load your config somewhere

  public Map<String, Object> getMap() {
    return map;
  }
}```
quaint mantle
#

No for sure

golden turret
#

gg

golden turret
trail lintel
#

ohhh interesting

tender shard
golden turret
#

yo, is the Player#discoverRecipe permanent?

#

espaço

austere thicket
golden turret
tender shard
#

sth like this

#
package de.jeff_media.bungeecore.bungee.listeners;

import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.event.ChatEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;

public class ChatListener implements Listener {
    
    @EventHandler
    public void onChat(ChatEvent event) {
        if(event.getMessage().contains("bad word")) {
            event.setCancelled(true);
            event.getSender().disconnect(TextComponent.fromLegacyText("Stop saying bad words lmao"));
        }
    }
}

#

and in your main class' onEnable, register the listener, like

@Override
public void onEnable() {
  getProxy().getPluginManager().registerListener(this, new ChatListener());
}
#

basically it works exactly the same as in bukkit

sacred ice
#

So I am back and found that you send packet like that in 1.18 : ((org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer)player).getHandle().b.a(Packet packet); in need

tender shard
sacred ice
#

idk how

tender shard
#

in mojang mappings you have proper names

#
package de.jeff_media.jefflib.internal.nms.v1_18_R1;

import lombok.experimental.UtilityClass;
import net.minecraft.network.Connection;
import net.minecraft.network.protocol.Packet;
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;

@UtilityClass
public class NMSPacketUtils {

    private static Connection getPlayerConnection(final Player player) {
        return ((CraftPlayer)player).getHandle().connection.connection;
    }

    public static void sendPacket(final Player player, final Object packet) {
        if(!(packet instanceof Packet<?>)) {
            throw new IllegalArgumentException(packet + " is not instanceof " + Packet.class.getName());
        }
        getPlayerConnection(player).send((Packet<?>) packet);
    }
}
vale ember
#

how do i measure the impact of my plugin on server's performance?

olive lance
#

so why did mojang release mappings and not just not obfuscate them

young knoll
#

From what I’ve heard

#

Legal reasons and potential performance

olive lance
#

interesting

buoyant viper
#

and whatever the fukc fabrics mappings are

#

yarn names are so strange

young knoll
#

I’ve heard the opposite

buoyant viper
#

when ur switching from mcp to fabric its a real smack in the face @young knoll

#

u go to type Minecraft.getMinecraft() and its actually like MinecraftClient.getInstance()

young knoll
#

This is why you use Mojmap for everything

#

Consistency

buoyant viper
#

i had plans to do an mcp thing that used mojangs mappings but ended up forgetting

quaint mantle
#

Does forge support mojang mappings

young knoll
#

Yes

young knoll
#

That’s all they use now

quaint mantle
#

Great

rapid sable
#

Hello there, can anybody help me with NMS on 1.17(+)?
I already installed BuildTools but the dependency does not work (it does not add the NMS-classes).

#

(I added both the 'SHADED' and non-shaded)

eternal oxide
rapid sable
#

Well, I cannot send any screenshots...

young knoll
#

You need to be verified

olive lance
#

Whats the flag to get remapped jar from buildtools

young knoll
#

--remapped

rapid sable
#

I have read the thing, worked on it the past hour. I added the thing as dependency inside the pom.xml and tried without. It just doesn't work for me 😭

onyx fjord
#

@rapid sable you need mapped jars i think

rapid sable
#

I need to add a mapped jar to the server or add it as dependency?

rapid sable
#

So... Where do I add it inside the pom.xml?
I tried to put it outside of the '<project>...</project>', create other brackets to put it in.

eternal needle
#

hi can someone help me i did compile a plugin and i want it to work on 1.18 but its so many things that are wrong pls help me if you can tag me

hasty prawn
#

?ask

undone axleBOT
#

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

sacred ice
#

post code

sacred ice
#

It is possible to support 1.17 nms code and 1.18 nms code? How could I support 1.17 and 1.18 if they are both same named packages and names?

tender shard
quaint mantle
#

Make multiple modules

olive lance
#

how much of it is supposed to be remapped?

tender shard
#

well, everything from NMS basically. maven can do it automatically for you

rapid sable
tender shard
#

1.18 and 1.18.1 have the same mappings, at least for 99.9% of the code

#

both are 1_18_R1, one module is enough

#

also I doubt anyone uses 1.18 instead of 1.18.1

quaint mantle
#

I'd say more

olive lance
#

Am i supposed to be able to see these remappings when i decompile the jar from builtools that i used --remapped on

sacred ice
#

ok... i have to move to maven now

quaint mantle
#

1.18.1 has no server code changes

tender shard
tender shard
#

you will see fields being called "connection" instead of "b" etc

hasty prawn
#

Once you have remapping setup it's literally a godsend

tender shard
#

exactly

olive lance
#

i still see a ton of obfuscated classes and methods

jovial bluff
#

Hi

hasty prawn
#

You didn't do it right then probably

#

I don't think I see any obfuscated names like "b" or "a" anymore

tender shard
olive lance
#
  @DontObfuscate
  public static void main(OptionSet optionset) {
    SharedConstants.a();
    try {
      DataPackResources datapackresources;
      CrashReport.h();
      if (optionset.has("jfrProfile"))
        JvmProfiler.e.a(Environment.b); 
      DispenserRegistry.a();
      DispenserRegistry.c();
      SystemUtils.m();```
tender shard
#

wtf is that

olive lance
#

NMS.Main

tender shard
#

erm

#

package name pls

olive lance
#

net.minecraft.server.Main

tender shard
#

it's supposed to look like this

olive lance
#

ok so i did something wrong then

#

-jar BuildTools.jar --remapped

#

yeah?

tender shard
#

yes

olive lance
#

didnt work for me

#

i got a lot of stuff that said profile 'remapped' couldnt be found

#

i noticed

rapid sable
#

So... It does not work for some reason..
"Cannot resolve org.spigotmc: spigot:1.18-R0.1-SNAPSHOT

tender shard
rapid sable
#

I copied it from the github ;?

rapid sable
#

Oh well.. It was referring to a different part...

tender shard
#

and don't forget to use "1.18.1" instead of "1.18" everywhere

olive lance
#

Yeah i read that all the way through. Do i need to specify a version maybe?

trail lintel
#

How do I go about getting a list of a list of strings from the FileConfiguration? This is the closest I can get, forcing a cast to avoid List<capture of ?> returned from getList(), but it seems to always be null.

public List<List<String>> recipeKeys;
recipeKeys = (List<List<String>>) config.getList("recipe.key", recipeKeys);
rapid sable
#

I already use 1.18.1 everywhere 🙂

It was referring to a failed attempt of mine that I did not delete yet.

olive lance
#

My only difference between what you did was i just used latest version

tender shard
trail lintel
#

I need a list, of a list of strings

#

a 2d array basically

quaint mantle
#

Oh

rapid sable
#

But I am still not allowed to use the NMS.

tender shard
olive lance
tender shard
#

should work

olive lance
#

I thought i could just decompile what buildtools gave?

tender shard
rapid sable
#

Reloading maven right now.

trail lintel
#

Ohhhh thanks mfnalex lemme give that a shot

olive lance
tender shard
#

there should be a jar called spigot-1.18.1-R0.1-SNAPSHOT-remapped-mojang

rapid sable
#

Now it does work. Thank you!

So I have to run the remapped on the server too, right?

olive lance
#

Ok so

olive lance
#

I cannot just decompile what buildtools gives to view

tender shard
#

on your server you run the normal .jar. the "special-sauce" inside your pom.xml translates the mapped mappings you are using back to the obfuscated ones

trail lintel
#

that seems to have done it, thanks a bunch @tender shard

olive lance
#

Ok i see now thank you

rapid sable
#

Then I have some bad news... My burger ain't working!

#

java.lang.ClassNotFoundException: net.minecraft.server.v1_18_R1.

tender shard
#

yeah, it's now just net.minecraft.server

#

of course almost all classes have different names now

#

because you are now using the original names mojang used in 1.17+ and not the old ones

rapid sable
#

If I am correct, I am checking for both 'net.minecraft.server' and 'org.bukkit.craftbukkit'

tender shard
#

e.g. what used to be EntityPlayer inside net.minecraft.server.v1_16_R3.entity is now net.minecraft.server.level.ServerPlayer

golden turret
#

so im using player.discoverRecipe(recipe) to add the recipe to the recipe book of the player, but when i open the recipe book with the items for the recipe, it shows that i dont have enough items

tender shard
#

the middle item is another one than what you have

buoyant viper
onyx fjord
#

hello

tender shard
onyx fjord
#

what is wrong with this line of code (its not my plugin)

tender shard
# vale ember please

just make some timing reports or manually measure the execution time of certain parts

tender shard
onyx fjord
tender shard
#

what class is CONTAINER?

onyx fjord
tender shard
#

that class simpy doesn't have any method called getOptional

onyx fjord
#

breh

rapid sable
#

So then how do I summon an EntityPlayer?
I can get the MinecraftServer but not the WorldServer...

tender shard
#

You have to forget about the old names

quaint mantle
tender shard
#

There is no WorldServer anymore

#

It's called ServerLevel

tender shard
#

as sad, EntityPlayer does not exist. It was the name spigot used, in mojang mappings that never existed. And WorldServer also does not exist, it's called ServerLevel

tender shard
#

ah its just the overlay?

golden turret
#

yes

tender shard
#

sorry bout that

#

how did you register the recipe?

golden turret
#

yes

tender shard
#

how?

#

MaterialChoice or ExactChoice?

golden turret
#

exact

#

i can craft the item

#

but in the book it says that i dont have items

tender shard
#

what's your spigot version?

golden turret
#

latest

#

:C

tender shard
#

I remember a bug that was fixed in 2019 regarding exact choice + recipe book

golden turret
#

all my items have custom nbt tags

#

and im not setting them with the pdc

tender shard
#

why don't you use PDC? 😛

#

but that probably wouldnt help anyway

quaint mantle
#

Why not pdc

tender shard
#

I just checked, and custom PDC tags in the recipe book work fine for me

shut meadow
#

hello can someone say me how to display the real life time in the chat, but before a message, and it should update after every minute

#

because i have that the time will displayed but it will not updated

crimson terrace
#

with packages?

tender shard
#

once the message was sent, it's sent

#

you can't tell the client to update a message after that

shut meadow
#

i know but when a new message will be send that the new real life time will be displayed

#

because actually only when i make a server reload the time will be updatet

tender shard
#

I also wonder how that would be useful - what's the purpose in prefixing a message with the current time instead of the time when the message was sent

shut meadow
#

right

tender shard
#

or resend the message every minute

#

as said you cannot update already sent messages

shut meadow
#

i dont want to update sent messages

shut meadow
quaint mantle
#

Hmm, idk, but maybe score components can update in the Chat?

tender shard
#

then just use the AsyncPlayerChatEvent, use setFormat and add the current time

shut meadow
#

the time will be displayed, but after to or three minuets the same time is displayed after a server reload the newst time is displayed again

tender shard
#

then your code doesn't generate a new string for every message

#

they just want something like

[0.01 am] player1: hi
[0.02 am] player2: hi too!

shut meadow
#

right

tender shard
#

so just create a new string in every message instead of generating that strng once

#

show your current code pls

shut meadow
#
    Date now = new Date(System.currentTimeMillis());
    SimpleDateFormat format = new SimpleDateFormat("HH:mm");

    Bukkit.broadcastMessage("§7[" + format.format(now) + "]§f " + player.getName() + "§7 > §f" + msg);
tender shard
#

cheap example:

in AsyncPlayerChatEvent, use SetFormat(System.currentTimeMillis() + " %s: %s")
it will show the current milliseconds + playername + message

#

where do you execute that from? that should work normally

golden turret
#

update: when using material choice it works

tender shard
golden turret
#

wlib

tender shard
#

wlib?

golden turret
#

wlib!

shut meadow
# tender shard where do you execute that from? that should work normally
public void onChat(AsyncPlayerChatEvent event) {
        Player player = event.getPlayer();
        String msg = event.getMessage();
        event.setCancelled(true);
        if (commands.livers.contains(player.getName())) {
            event.setCancelled(true);
            Bukkit.broadcastMessage("§f[§9LIVE§f] " + player.getName() + "§8 > §7" + msg);
        } else if (commands.aufnehmer.contains(player.getName())) {
            event.setCancelled(true);
            Bukkit.broadcastMessage("§f[§cREC§f] " + player.getName() + "§8 > §7" + msg);
        } else if (commands.redstoner.contains(player.getName())) {
            event.setCancelled(true);
            Bukkit.broadcastMessage("§f[§4REDSTONE§f] " + player.getName() + "§8 > §7" + msg);
        } else if (commands.afks.contains(player.getName())) {
            event.setCancelled(true);
            Bukkit.broadcastMessage("§f[§7AFK§f] " + player.getName() + "§8 > §7" + msg);
        } else if (commands.miners.contains(player.getName())) {
            event.setCancelled(true);
            Bukkit.broadcastMessage("§f[§bMINING§f] " + player.getName() + "§8 > §7" + msg);
        } else if (commands.rper.contains(player.getName())) {
            event.setCancelled(true);
            Bukkit.broadcastMessage("§f[§dRP§f] " + player.getName() + "§8 > §7" + msg);
        } else {
            event.setCancelled(true);
            Bukkit.broadcastMessage("§7[" + format.format(now) + "]§f " + player.getName() + "§7 > §f" + msg);
        }

    }
}
tender shard
# golden turret wlib!

again: wlib?

NBT isn't part of the API so I wouldn't expect it to work with the Recipe API. PDC however will work fine

quaint mantle
#

i guess another noname common lib

tender shard
#

you can say wlib as often as you want, noone knows what you're trying to say

tender shard
#

so it will never update

quaint mantle
#

better make an implementation that uses pdc if possible

shut meadow
shut meadow
tender shard
#

add Date now = new Date(System.currentTimeMillis()); inside your event

tender shard
shut meadow
#

i got it now working

#

sry

tender shard
#

np^^

quaint mantle
#

Um new Date() will return the current date

tender shard
#

you have to learn basic java, your problem was as I said - you never updated your "now" variable

#

you probably set it once when creating the class instance instead of everytime someone chatted

quaint mantle
#

Btw use new time api

misty current
#

i'm tryna use this code to create a circle

    public static Vector getSphericalVector(double radius, double yaw, double pitch){
        double yawCos = Math.cos(Math.toRadians(yaw));
        double yawSin = Math.sin(Math.toRadians(yaw));

        double pitchCos = Math.cos(Math.toRadians(pitch));
        double pitchSin = Math.sin(Math.toRadians(pitch));

        double x = yawCos * pitchCos * radius;
        double y = pitchSin * radius;
        double z = yawSin * pitchCos * radius;

        return new Vector(x, y, z);
    }

but i'm not sure why it has these strange gaps

lavish hemlock
#

that's p'cool

#

but I can't help

misty current
#
for(int i = 0; i < 360; i++){
    Vector vec = VectorUtils.getSphericalVector(4, i, 0);
    new ParticleBuilder(ParticleEffect.REDSTONE)
            .setLocation(player.getLocation().add(vec))
            .setParticleData(new RegularColor(Color.RED))
            .setSpeed(0)
            .setAmount(1)
            .display();
}
#

the ParticleBuilder is part of the api i use to play particles

trail lintel
#

So assuming I change some values in the config for my plugin which changes the meta for my custom item, I need to iterate through all players on startup and make sure any items tagged with the persistent data for my item who had an old version are updated. Is the most efficient way to do this to iterate through JavaPlugin.getServer().getOnlinePlayers() and .getOfflinePlayers() doing a check on their inventory? Would it be more efficient to do it on a player connect do you think, instead of all players once on startup? The first would only need to happen once, when the server starts to check the config. so that seems better to me.

tender shard
trail lintel
#

Ahhh well that makes this an easy choice then 😉

#

gonna have to do the onConnect

misty current
#

remember players could also store them in chests

trail lintel
#

Oh shit ur right..... Can you iterate through all containers? That seems silly....

tender shard
#

well you COULD, in onChunkLoad and then getting the tileentities

#

is there any reason you have to update PDC data?

#

there's probably some cleaner way

trail lintel
#

cuz like I want part of the config of the plugin to be able to name the item

#

and part of the item creation is reading that config value and storing it in the meta

tender shard
#

I'd probably just tell server admins that the new name will only apply to new items 😄

#

otherwise you will have a looot of work for a pretty minor feature imho

#

well

trail lintel
#

That is probably true, but it is slightly annoying haha

tender shard
#

you could check inventory open event and onconnect

#

and, if you really care that much, also entitypickupitemevent

trail lintel
#

Hmmm thats not a bad idea

#

yeah for entities sitting on the ground leftover in a chunk

tender shard
#

performance impact should be next to nothing

trail lintel
#

Thats whats up 😄 I think I'll do exactly that

#

will give me some more experience too

tender shard
#

oki 🙂

#

although tbh I wouldnt care about entitypickupitemevent

trail lintel
#

yeah that one will probably rarely happen

#

only if t hey like dropped it while flying over a chunk and came back

tender shard
#

basically only if a player drops an item, then server restarts with new config, and then player picks it up again

trail lintel
#

ohh yeah or that

deep tiger
#

How can I bump guava version of paper 1.8.8 ?

tender shard
#

compile paper yourself

eternal oxide
#

this isn't paper

tender shard
#

or shade the required lib version into your plugin

tender shard
deep tiger
#

Spigot if you want but it's the same problem x)

tender shard
#

as said, either compile it manually, adjusting the pom or just shade what you need yourself

deep tiger
#

I got this exception when using the last version of guice :
java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V

mighty sparrow
#

Are Exit Conditions a good practice in plugin development ?

quaint mantle
#

@ivory sleet

#

how can I make the value on, off when executing a command? Persistent Data Container

#

?

tender shard
quaint mantle
#

on, off

tender shard
#

you want to toggle a PDC value?

#

are you using boolean or byte as datatype in the PDC?

quaint mantle
deep tiger
#

I mean, the guava version I want to target is already shaded in my plugin, but it seems like the server is still using the wrong version

tender shard
#

but you should rather use BYTE or BOOLEAN as datatype instead when it's just a true/false thing

quaint mantle
tender shard
#

pdc.set(yourKey, PersistentDataType.STRING, pdc.get(yourKey, PersistentDataType.STRING).equals("on") ? "off" : "on");

tender shard
deep tiger
#

I'm using gradle

tender shard
#

well then replace maven with gradle and google it anyway 😄

quaint mantle
#

"gradle shadow relocate depenency"

tender shard
#

basically just

shadowJar {
   relocate 'junit.framework', 'your.package.junit.framework'
}
``` (from what I found on google)
deep tiger
tender shard
#

e.g. my plugins have the packagename de.jeff_media.pluginname so I shade libs to de.jeff_media.pluginname.libs

deep tiger
#

I wrote :

    relocate("com.google.guava", "me.choukas.dodgecreeper.libs.com.google.guava")
#

But it doesn't work x)

tender shard
#

looks good

#

show your full gradle.build pls

deep tiger
#
plugins {
    id("dodgecreeper.java-conventions")
    id("fr.il_totore.manadrop") version "0.4.1-SNAPSHOT"
    id("com.github.johnrengelman.shadow") version "7.1.0"
}

repositories {
    // Repos
}

dependencies {
    // API
    implementation(project(":api"))

    // SmartInvs
    implementation(group = "fr.minuskube.inv", name = "smart-invs", version = "1.2.7")

    // BungeeChannelAPI
    implementation(group = "io.github.leonardosnt", name = "bungeechannelapi", version = "1.0.0-SNAPSHOT")

    // Guice
    implementation(group = "com.google.inject", name = "guice", version = "5.0.1")
    implementation(group = "com.google.inject.extensions", name = "guice-throwingproviders", version = "5.0.1")
    //implementation("com.google.inject.extensions:guice-multibindings:3.0")

    // TODO DEBUG
    /*implementation("com.google.guava:guava:31.0.1-jre")
    implementation("org.apache.httpcomponents:httpcore:4.4.15")*/

    // Adventure API
    implementation(group = "net.kyori", name = "adventure-platform-bukkit", version = "4.0.1")

    // Jupiter
    testImplementation(group = "org.junit.jupiter", name = "junit-jupiter-api", version = "5.8.2")
    testImplementation(group = "org.junit.jupiter", name = "junit-jupiter-engine", version = "5.8.2")

    // MockBukkit
    testImplementation(group = "com.github.seeseemelk", name = "MockBukkit", version = "v1.8-spigot-SNAPSHOT")
}

spigot {
    desc {
        named(project.properties["plugin-name"].toString())
        authors("Choukas")
        main("me.choukas.dodgecreeper.core.DodgeCreeperPlugin")
    }
}

tasks.processResources {
    finalizedBy("spigotPlugin")
}

tasks.shadowJar {
    relocate("com.google.guava", "me.choukas.dodgecreeper.libs.com.google.guava")

    archiveFileName.set("${project.properties["plugin-name"].toString()}.jar")
    destinationDirectory.set(file(System.getenv("SERVER_PLUGINS_FOLDER")))
}

tasks.test {
    useJUnitPlatform()
}
tender shard
#

you dont declare guava as dependency

#

there's nothing to relocate

#

you commented guava out

deep tiger
#

Oh

tender shard
#

although I have no idea about gradle. I don't know if "implementation" is enough to actually "shade" it at all

#

in maven you'd declare that dependency to be "<scope>compile</scope>"

#

then it would be added to your .jar and you can relocate it

tender shard
#

no idea, someone with gradle knowledge will have to help you then, I only know maven^^

deep tiger
#

Doesn't work either

golden turret
#

?pdc

golden turret
#

which is the relative to NBTTagList in the pdc?

tender shard
#

PersistentDataType.TAG_CONTAINER

golden turret
#

thanks

tender shard
#

it's basically a PDC inside a PDC

tender shard
golden turret
#

wdym

tender shard
#

it adds a ton of new datatypes

#

e.g. so you can easily save ItemStacks inside a PDC and other stuff

#

there's a table on that github page in the readme

quaint mantle
minor garnet
#

can someone explain to me which blocks do not have bouding box?

tender shard
tender shard
ivory sleet
#

Imagine if paper or spigot just decided to add all of those 🤡

tender shard
#

e.g. flowers?

#

not sure though

tender shard
minor garnet
quaint mantle
#

well you have docs at least

tender shard
#

I do?

#

maybe

#

oh I thought you meant javadocs

quaint mantle
#

i have efficient collection data type implementation

#

no, you, kinda, have readme

#

hi, manya

#

privet

minor garnet
#

what can be an uncollidable block?

quaint mantle
#

pdc

tender shard
quaint mantle
#

nihuya ne ponyal

#

mne nuzhno komandy dlya on, off

#

Can your library do
PersistentDataType<?, ImmutableList<ItemStack>> ITEM_LIST = DataTypes.collection(ImmutableList.toImmutableList(), DataTypes.ITEM_STACK);? 😼

tender shard
#

no, I never needed that^^

quaint mantle
golden turret
#

and how could i store a map and a list using the pdc?

quaint mantle
golden turret
#

would i need to create new data types?

tender shard
golden turret
#

*i dont want libs, im making*

quaint mantle
#

ok

tender shard
#

well, if your map has strings as keys, you can just save it as TAG_CONTAINER

quaint mantle
tender shard
#

@quaint mantle whom are you replying to all the time?

golden turret
#

so i would need only for the list

tender shard
#

but the message you are answering to has nothing to do with your messages

quaint mantle
tender shard
#

switch what?

quaint mantle
#

can you use your brain a little bit

#

on, off

lavish hemlock
#

uhh

#

AK

lavish hemlock
#

you keep replying to the same message

tender shard
#

yeah lol

#

this is a weird conversation

#

may I kindly suggest to

lavish hemlock
#

I've never seen this before

tender shard
#

?learnjava

undone axleBOT
quaint mantle
tender shard
#

so you want a method that returns "on" when you pass "off" to it, and vice versa, right?

#

if so, I already gave you that

#
public String getOpposite(String input) {
        return input.equals("on") ? "off" : "on";
}
quaint mantle
tender shard
#

and what exactly is the problem where you're stuck with?

quaint mantle
#

and remove

tender shard
tender shard
#

how replace what

quaint mantle
#

i'm Russian and dolboeb

#

name key

#

replace

tender shard
#

alright I don't care if this is spoonfeeding. So you have an ItemStack, right? And you want it to save "on" or "off" inside. And switch it when entering /test right?

golden turret
#

@tender shard so i would need to create a custom data type only for the List, right?

tender shard
golden turret
#

list

tender shard
# quaint mantle yes
@Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        NamespacedKey key = new NamespacedKey(this, "nameOfTheKey");
        Player player = (Player) sender;
        ItemStack item = player.getInventory().getItemInMainHand();
        ItemMeta meta = item.getItemMeta();
        String oldValue = meta.getPersistentDataContainer().getOrDefault(key, PersistentDataType.STRING,"off");
        String newValue = oldValue.equals("on") ? "off" : "on";
        meta.getPersistentDataContainer().set(key, PersistentDataType.STRING, newValue);
        item.setItemMeta(meta);
        return true;
    }
#

obviously this isn't perfect ^

wild cedar
#

Hey there, is there any way to get all spigot api mappings with documentations?

tender shard
#

or wait

#

are you talking about Spigot API, or NMS?

#

because Spigot API doesn't have any "mappings", and NMS is not documented because it's not part of the API

wild cedar
wild cedar
tender shard
#

javadocs for spigot?

wild cedar
#

javadocs yea

tender shard
#

?jd

wild cedar
#

yea I do have the website, I just wanted to use it for my bot, so I can search it easily

tender shard
#

BuildTools can generate the docs for you too so you have them locally

#

if that's what you're looking for, idk

wild cedar
#

Spigot-API I guess?

tender shard
#

run BuildTools with --generate-docs flag

#

one sec

tender shard
#

as said you need to run buildtools with --generate-docs

wild cedar
tender shard
#

np

sullen marlin
#

you can also download them off nexus

tender shard
#

running buildtools is cooler though

quaint mantle
#

paperclip is cooler

wild cedar
snow compass
#

I find a "bug" in fromLegacyText method. All formats return " " (perhaps intended behaviour????).

tender shard
snow compass
quaint mantle
#

What

snow compass
#

It still add the colours on the text, but if you look inside the return BaseComponent [TextComponent{text=test, BaseComponent(color=, font=null, bold=null, italic=null, underlined=null, strikethrough=null, obfuscated=null, insertion=null, extra=null, clickEvent=null, hoverEvent=null)}, TextComponent{text= text, BaseComponent(color=, font=null, bold=null, italic=null, underlined=null, strikethrough=null, obfuscated=null, insertion=null, extra=null, clickEvent=null, hoverEvent=null)}] color= is blank.

#

Is really odd behaviour.

lethal knoll
#

is it okay to change the price of a premium resource?

tender shard
#

but it has to be under 20€/USD or sth IIRC

lethal knoll
#

yea maybe it goes back into an approval stage

tender shard
#

no

lethal knoll
#

yes certainly

tender shard
#

you can change it anytime

lethal knoll
#

I'm planning on lowering the price

snow compass
#

even if return value have color (but is empty).

mortal hare
#

why is InventoryDragEvent so weird

#

whenever i drag one item

#

and the event is cancelled it returns the cursor as null

#

but whenever i drag 2+ items in the event, while it is cancelled it returns the uncalculated cursor value (2+ cursor items, instead of amount it should've calculated)

snow compass
mortal hare
#

ik

snow compass
#

in that event

mortal hare
#

lemme explain it:
event.getCursor()

event.setCancelled(true)

1 item dragged - event.getCursor() == null
3 items dragged - event.getCursor() == {ItemStack x 3}
mortal hare
#

i don't need it

#

the event is cancelled

#

why it returns calculated value

#

whenver dragged item is 1

#

that makes no sense, it should return {ItemStack x 1} instead

#

since the event is cancelled

#

but somehow it returns the calculated value if dragged item amount is 1

#

is this a bug

#

this weird calculation handling seems like a bug for me

#

if the event is cancelled it should always return the oldcursor

#

instead i get some sort of mix

calm star
#

how can i make it so when i do /start a timer counts up from 0 above your hotbar

mortal hare
#

Use a scheduler

#

and BukkitRunnable's runTaskTimer()

calm star
#

how do you add it above the hotbar

mortal hare
#

its called action bar

#

google it

calm star
#

ok tanks

#

thanks

mortal hare
#

np

tulip owl
#

When I make a command with custom tab completion, do I make two classes for the command and the tab completion? Or do I replace the normal one with the tab one?

tender shard
#

somePlayerObject.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("your message"));

calm star
#

for the stopwatch, i do this:

runTaskTimer(this, new Runnable(){}, ??)
#

wat should the last parameter be

tender shard
#

or yeah just create a new class, however you like

tender shard
calm star
#

20 ticks then

#

cause thats 1 sec

tulip owl
#

If so, what one?