#help-development

1 messages · Page 149 of 1

tardy delta
#

anyways use players uuid in config, as name might change

plain yoke
#

how? im an stupid

echo basalt
#

fourteen you're literally blind

tardy delta
#

didnt see p.getname first

echo basalt
#

you're still blind

floral drum
#

you're blind asf

#

😭

echo basalt
#

getBoolean(path) returns either true|false

tardy delta
#

but why "anvil." + pl + ".true" and not anvil.player-name?

#

stfu /j

echo basalt
#

getBoolean(path + ".true") is just stupid

floral drum
#

LOL fourteen

echo basalt
#

would require

something:
  name:
    true: false
tardy delta
#

smh ill go back to c++

plain yoke
floral drum
#

sorry ❤️

echo basalt
#

but yeah imma hit the local mcdonalds it's lunch time

#

gotta sell a shower in an hour because if I don't use it I might as well just make some money

tardy delta
#

already eaten second lunch

plain yoke
#

i dont understand 😦

fluid river
#

it will

floral drum
plain yoke
#

i made a big code and only one thing is didnt work

fluid river
#

but just don't name your key true

#

name it enabled or smth

plain yoke
#

okay

#

ty

tardy delta
#

remember guys never try to answer a java question when doin c++

plain yoke
#

like this
"anvil." + pl + ".enabled"

tardy delta
#

why not doing like

anvil:
  first-player: true
  second-player: false```
plain yoke
#

but it didnt work

tardy delta
#

cuz you were checking for "anvil.first-player.true"

#

which doesnt make sense

plain yoke
#

how do i need check then

tardy delta
#

getBoolean("anvil." + player.getName())

#

anyways store Player#getUniqueId instead of Player#getName too

plain yoke
#

omg im an idiot

#

ty

tardy delta
#

name might change

#

you can login to your minecraft profile and change your username, thats what i mean

#

idk by having a whitelist on name ig

#

if not implemented by uuid internally anyways

echo basalt
echo basalt
#

Has no veggies, just meat, custom sauce and bacon

floral drum
#

omg

#

send pics!

echo basalt
#

Then ask for extra meat

#

Ye

#

Box of 10 nuggets, garlic mayo

floral drum
#

osu is very poggers

#

omg

echo basalt
#

Decent game

floral drum
#

friend!

#

you two are cool

#

F

#

you cheated? omegalul

#

or multiacc

#

ah damn

#

F

echo basalt
#

Got mf 700pp

floral drum
#

only rank 156k rn D:

#

I got 2x 200pp

#

's yesterday tho

#

which is fucking pog

#

relax I love

#

haha

#

you play an rx server? ezppfarm, akatsuki, ripple?

plain yoke
#

oh my god its working thanks to everyone to help russian stupid develope

floral drum
#

ah

#

my food downstairs smells fucking delicious omg

echo basalt
#

Omw to McDonald's

floral drum
#

kingg

echo basalt
#

Gotta pass through the boonies

floral drum
#

good luck LMAO

#

my tablet area @quaint mantle

#

you two chill asf no cpa

echo basalt
#

Just wait until you ask me a stupid nms question

floral drum
#

ahaha

echo basalt
#

Touch screen

floral drum
#

haha

#

got the ending diff too

#

can't haha

#

I'll do the ending

#

that's all

#

haha

opal juniper
shadow gazelle
#

I'm trying to make it so that you can have up to double the normal enchantment levels but not allow conflicting enchantments, but the latter doesn't seem to be working for reasons I don't understand, any ideas?
https://github.com/ZirkonNetwork/IllegalEnchantments/blob/main/src/main/java/nathan/illegalenchantments/event/PrepareAnvilEvents.java

GitHub

A somewhat hacky way to allow players to get enchantments up to double the normal levels - IllegalEnchantments/PrepareAnvilEvents.java at main · ZirkonNetwork/IllegalEnchantments

#

Also yes, I know this is pretty shit

floral drum
#

this is a good one

#

haha I have that one too

#

so relatable

#

ignore my score

#

alr

#

that was ages ag

echo basalt
#

Mans tryna get help 💀

#

Yeah ok this is unreadable on mobile

floral drum
#

no cap

tardy delta
#

what the

#

not caching get() 😢

shadow gazelle
#

I had no braincells left when I was like half way through writing it and when I slightly improved it I lost half of them by reading it

grim ice
#

this looks delicious

#

except it has bacon which i cant eat

young shell
#

Is there an API way to get all Permissions a plugin offers?

tardy delta
worldly ingot
#

So long as they're declared in the plugin.yml, then yes that's correct

#

(as they should be, but as we all know... devs don't always do what they should)

kindred valley
#

Stop abusing static

quaint mantle
#

What a troll

charred blaze
#

how do i get offline player from bungee?

#

by name

floral drum
#

haha mine too

#

I went blind for like 10 minutes

kindred valley
#

On this community

charred blaze
kindred valley
#

Bukkit.getOfflinePlayer(); ?

worldly ingot
#

If you mean Bukkit's OfflinePlayer object, you don't

#

Bungee is the proxy

kindred valley
#

Ah its bungee sorry

#

@quaint mantle i am better than you mate

#

I am not abusing static anymore

charred blaze
young shell
#

Reflection is fair play

worldly ingot
#

No and no to both of those questions lol

floral drum
grim ice
worldly ingot
#

Permissions are plugin-agnostic for the most part

young shell
charred blaze
#

Bruh.

worldly ingot
#

The ones declared in the plugin.yml are instantiated and added to the plugin manager but it doesn't retain which plugin registered them

kindred valley
#

You have bigger brain man.. Sorry

charred blaze
#

So how can I check if an offline player has x permission?

grim ice
#

your naming conventions are dead and you're static abusing, well technically it isnt static abuse from what you sent us, but you definitely dont know why you used static for your plugin variable

worldly ingot
#

You can't

charred blaze
#

:///

worldly ingot
#

You can't even do that for Bukkit

#

You would have to go through your permissions plugin if you have one

tardy delta
#

are player permissions nodes saved in data files? kekw

worldly ingot
#

No, Vault requires online players

#

It actually requires a CommandSender which is... weird

shadow gazelle
charred blaze
worldly ingot
#

Right because online proxy players have a hasPermission() method. But if you want to query the permissions of an offline player, you'll have to use LuckPerms' API to query the database with a UUID

#

I mean that Permissible is the more appropriate option

#

All CommandSenders are Permissible, but Permissible is the correct type

floral drum
#

he's not static abusing no cap, he's just creating an instance of the class to grab a (probably) static final Map. Which is still a very very weird way of doing it. I would recommend using dependency injection to get your Storage class that way, then you don't need to constantly create a new instance of the class to get a field. You just do storage.map or storage.getMap() however you have it laid out.

#

hi mr chocolate ❤️

tardy delta
#

cant believe that people are still instantiating bukkitrunnables, i mean use scheduler

#

😢

echo basalt
#

Mister choco... You are so dum

floral drum
#

Bukkit.getScheduler go brt

worldly ingot
#

They can send commands :)

charred blaze
floral drum
#

what the fuck

worldly ingot
#

Yeah. All entities have the ability to send commands too

#

It doesn't often happen, but it certainly can

worldly ingot
#

No, the command block is executing that

floral drum
#

execute as @e[type=Skeleton] ~ ~ ~ kill @a

#

ez w

worldly ingot
#

But you can do it with execute as

#

Yep

fluid river
#

i usually make bukkitrunnable variable and run it directly

floral drum
#

loll

#

sniped choco!

shadow gazelle
floral drum
#

I zone out when I type

shadow gazelle
#

I don't think there's really any other way to do something like that without a mess of ifs

grim ice
#

what u said made no sense

tardy delta
#

i only use a bukkitrunnable when my class extends it

grim ice
#

"create a new instance to access a static field"

#

Java 100

floral drum
#

it seems that way

#

or else the map would be empty

grim ice
#

Dude

#

💀

#

hes accessing the map from an object

tardy delta
#

i dont not extend StaticAbusers, im sorry

#

do not

floral drum
#

not me

#

I used to extend StaticAbusers but they realized how bad it is, so they removed it from me

grim ice
#

iin this case you shoud have a proxy for List btw

#

something like

public interface StaticAbusers extends List<StaticAbuser> { }

#

not really required, but convenient

tardy delta
#

🤔

vivid skiff
#

How can i add health to a player?

i made it like this

player.setHealth(player.getHealth() + 6);

but if the player haven't - 6 of health it doesn't do anything

tardy delta
#

change health attribute base value first guess

vivid skiff
#

?

tardy delta
#

anyone what?

shadow gazelle
#

Have any idea what the issue with conflicting enchantments is

#

They're being added when they shouldn't be

tardy delta
#

maybe clean up that code first

shadow gazelle
#

There's nothing to clean up

#

It's just going to be a mess because of what it has to do

compact haven
#

@vivid skiff add a Math.max to ensure it doesn’t go beyond player.getMaxHealth()

shadow gazelle
#

The extent of cleaning up that I was able to do was putting similar functions in one method and reusing calls

cold field
#

Hi guys I've a problem with build tools. I've run the tool with the --generate-docs --generate-source --remapped args but i can't find the jar with source or docs

torn shuttle
#

I wonder if I'd get in trouble if I made my plugin play chug jug with you every time you beat a boss fight

gray merlin
#

I'm trying to check when an item hits the ground. For this i'm using a method that performs a while loop trying to check when item.isOnGround() returns true. However, this doesn't work because I need to update the item instance somehow.

#

How can I do this?

torn shuttle
#

your while loop will run on the same tick

#

you're checking the same state over an over again

#

use a scheduled repeating task

tardy delta
#

imagine dropping an item from 200blocks high and then doing a while loop

gray merlin
#

Oh that's true. Maybe that's why it doesn't work, and the isOnGround method actually doesn't just return a constant

#

Thanks

torn shuttle
tardy delta
#

sheesh

torn shuttle
#

I wonder if I could rig intellij to play segments of chug jug on every compile

#

hmmm

echo basalt
#

Likely

torn shuttle
#

weird the premade stuff has a before compilation field but not a post-compilation field

#

clearly jetbrains fears these advanced programming techniques

cold field
#

Does anyone had any success installing CB sources into mvn local repo through the build tools?

true shuttle
#

Anyone know why PlayerLaunchProjectileEvent is only working on select projectiles?

#

according to the javadocs, it should work on every projectile, but from what I've found it only works on things like eggs and snowballs, and not tridents, bows, or crossbows

#

I'm getting no console errors or anything

#

ProjectileLaunchEvent works on everything, but i need to be able to get the player that launches it and the ItemStack it was from

#

any thoughts?

eternal night
#

trident is a bug

#

bows and crossbows aren't

#

see EntityShootBowEvent

echo basalt
true shuttle
#

thats sad

#

cuz i need trident

#

:(

eternal night
#

I mean

#

watch the open issue for that bug

cobalt thorn
#

how i can make damage the armor the player is wearing

glossy venture
#

is there a way to get a method handle to a package private method

#

because i need fast invocation

#

and im pretty sure method handles are faster than reflection right

torn shuttle
#

stay on your toes

echo basalt
#

👀

#

your code scares me even more

torn shuttle
#

greatness can be terrifying to mere mortals

shut field
#

what can I do if packets are being lost or aren't being sent, how do I find the issue

eternal oxide
#

Minecraft uses a TCP connection. Packets can;t be lost

shut field
#

7smile7 said that the packet may be "randoly lost"

#

but what reason would there be for a player not be getting the packet?

#

I teleport a mob and like 1/4 of the time a player doesn't see the update while a different player on the server DOES see the update

#

(the mob will look different on the two player's screens)

eternal oxide
#

have you actually monitored the client side packets incoming?

eternal oxide
#

Well as I said, MC uses a TCP connection so packets are in a stream one after the other. they are sequential and can;t be "lost" unless the connection is lost too.

shut field
eternal oxide
#

He was talking about waterfall. That I don't know

shut field
#

I see

eternal oxide
#

Server to client can;t lose packets. Adding in a proxy I can only see it dropping a packet if it was malformed.

eternal oxide
#

no

#

thats still only server side

#

well, it would tell you if it was skipping a player

shut field
eternal oxide
#

you really need to test on the server and client end to see if the packet is sent/received

eternal oxide
#

as its TCP its pretty much impossible for it to get lost in transit

shut field
#

I thought that you could monitor packets by using the PacketListener

eternal oxide
#

do you have anything on teh client to monitor packets?

shut field
#

is that a mod?

steady rivet
#

Is there a PersistentDataContainer for blocks that I can use to simply store a string that I can look at later to tell if a player placed the block or not? I know that you can check if GetState of a block is an instance of TileState but idk if every block has a tilestate or not

eternal oxide
#

no clue if it still works

#

but that was a quick search

shut field
#

patch the contents into minecraft.jar??

#

lemme see if i can find how to do that

eternal night
#

wat

#

oh god

#

just use pakkit

shut field
eternal night
eternal oxide
#

Much better. Its up to date

true shuttle
#

Anyone know an easy way to intentionally crash a server with a plugin?

#

divide by 0 doesnt work :((

eternal oxide
#

For what reason?

eternal night
#

Bukkit.shutdown()

true shuttle
#

i'll probably just spawn a bazillion entities or something if all else fails

floral drum
eternal night
#

but why

true shuttle
shut field
floral drum
#

nah fam

cold field
#

A recursive method?

floral drum
#

the server only needs to be timed out for like 60 seconds

#

for it to crash

shut field
#

I see

true shuttle
eternal night
#

I mean

#

just don't upload the plugin to spigot then

#

maliciously crashing a server won't be healthy for your account

true shuttle
#

oh yeah

#

ofc

#

uhh

#

excuse me

#

how did the server NOT crash

#
for (int i = 0; i < 10000; i++) {                  
e.getEntity().getWorld().spawnEntity(e.getEntity().getLocation(), EntityType.ARROW);
}
tardy delta
#

bcs it doesnt take that long?

true shuttle
#

MORE

#

seems like it maxes out at around 12000 before u get a proper crash

#

SCIENCE!

#

huh

#

i seem to have killed my server

#

maybe 10000000 was too many...

tardy delta
#

lmfao

true shuttle
#

yep

#

time for a new world

silk elk
#

Does anyone know a way that I can check if a player moves an item from a custom inventory to their player inventory? I'm trying to make an inventory which you can move items around in, but I don't want them to be able to actually take the items from the inventory

dim palm
#

is there a event to detect when player equip armor?

chrome beacon
#

There isn't one in Spigot

dim palm
#

thanks

onyx fjord
smoky oak
#

is it possible to bundle multiple packets and send them at once

floral drum
smoky oak
#

im going to do particle stuff soon and dont want to ddos people

floral drum
#

What are you going to do with packets? Any estimated on how many particles there's going to be

onyx fjord
#

ill always save you people

smoky oak
#

uh i just found the upper limit with testing

#

which's about 6000

#

beyond that it stutters

floral drum
onyx fjord
#

md should start paying me for reportign shit

floral drum
#

PluginMetrics one 😭

onyx fjord
#

theres that weird nLogin plugin that has its classes in BIN file

#

💀

#

it seems sus

smoky oak
#

the issue is you do NEED a lotta particles to do anything that aint a straight line

floral drum
#

dude this pakkit executable is sick ASF

solid cargo
#

yo is there any way to convert Block to Material?

solid cargo
#

something like that

#

well

#

it should be chosenMaterial

#

but point persists

eternal oxide
#

block.getType() == material

solid cargo
#

but it doesnt work

#

getType gets colored red, aka cant find a method

#

i have imported import org.bukkit.block.Block;
btw

eternal oxide
#

what~? colored red is not Spigot

solid cargo
#

cant resolve method apologies

eternal oxide
#

oh you mean underlined

#

then the rest of your code is crap

solid cargo
#

ok thanks online code

eternal oxide
#

that error says you don;t have a block, you have an ArrayList

silk elk
solid cargo
#

i want to clear out all blocks in a certain area EXCEPT a chosen one

silk elk
#

Just loop through the ArrayList and check the material

solid cargo
echo basalt
#

You just gotta cover a shaped perimeter

silk elk
#

Something along these lines

for(Block block : list) {
  if(block.getType == Material.WHATEVER) continue;
  // Do whatever here
}```
solid cargo
#

OH SHIT

#

okay yeah my bad

#

i apologize

#

just found out

#

I WAS CHECKING IN ARRAY LIST

#

me dumb smh

echo basalt
#

1 letter variable

#

🙄

silk elk
#

ikr

echo basalt
#

Only acceptable if the name is either:

  • x
  • y
  • z
solid cargo
#

i also

#

in loops

echo basalt
#

And you're looping in a 2/3d context

#

I no

#

Index

#

for(int index = 0...

solid cargo
#

INDICATION

echo basalt
#

Iteration

#

Idfk

silk elk
#

I used to work with people who would also name Events e and Players p and it annoyed me to no end

echo basalt
#

I used to be that guy like 3 years ago

solid cargo
#

you better dont work with me

echo basalt
#

Back in like... 2019

silk elk
#

I used to when I started until I realized how ugly it looked

smoky oak
solid cargo
#

ok in this new plugin i will use FULL WORDS

#

LIMITED OFFER

echo basalt
solid cargo
#

dw i will start trying to use full words

echo basalt
#

Tons of particles looks crisp

#

But also some particles are bigger than others

floral drum
#

hi illusion ❤️ ❤️

#

how are you

echo basalt
#

And sending particles every second instead of every tick

solid cargo
#

and increase plugin size by 50 bytes 🙄

echo basalt
#

Hello purple

#

Bit cold

smoky oak
#

hm, do particles have modifiable lifespan?

echo basalt
#

No

smoky oak
#

shiet

echo basalt
#

Hardcoded

smoky oak
#

so the more complicated the thing i want to draw the more particles i need to send at once

echo basalt
#

Also latency can make it look flashy

smoky oak
#

yea thats what i meant by it stops working

echo basalt
#

So you gotta compensate

#

By subtracting like 2 ticks + ping*2

#

Should be enough

smoky oak
#

also why'd the ping be important

echo basalt
#

Basically you only want to send as few particles as possible

#

To not burn your cpu, and not burn your network card lol

solid cargo
#

super flat is minecraft:flat or superflat?

echo basalt
#

Ideally you'd send 1 packet / particle / lifespan

silk elk
#

Why does if(event.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY) not run for InventoryClickEvent

smoky oak
#

yea thats the intention but that still totals almost 4000 even for simpler shapes

echo basalt
#

Thing is, it'd look flashy if it took longer to arrive than the lifespan

#

You can:

  • send particles async
  • define x particles per tick
  • resend on a longer interval
#

Or be like me and copy 7smile7's code

smoky oak
#

wasnt aware u could do that async. That might help, but im about 90% sure the issue is the client and not the server

echo basalt
#

Cull particles

#

Send less

#

More particles = more server time

#

But also more client time

smoky oak
#

wait no
neither actually lags
the issue is that the volume of particles isnt coming through at once if too many get sent

#

some network issue

#

thats why i asked if i could bundle em

silk elk
echo basalt
#

Each particle is a single packet

#

And you can only display 16k particles at once

#

Client limitation

smoky oak
#

must be 16k particle packets because i can send particle packets with the particle number set to 10, resulting in 6000 particles but 60k rendered ones

echo basalt
#

Sure

smoky oak
#

or do you mean that it can only spawn internally 16k particles at once?

echo basalt
#

Uhh

#

Try it and see

smoky oak
#

point

silk elk
#

Does anyone know how I can check if a player moves an item from an inventory to their player inventory? I've been stuck on it for like an hour and I can't figure anything out

smoky oak
#

?bukkitevents

echo basalt
#

Inventory Click Event

silk elk
#

I've tried doing it through InventoryClickEvent

echo basalt
#

Handle it all separate

#

And InventoryDragEvent

silk elk
#

And checking if the Action is MOVE_TO_OTHER_INVENTORY and it only works for shift clicking

#

Can I check if it moves to a different inventory in DragEvent?

echo basalt
#

You gotta handle clicking cursor on main gui

#

But also know where the cursor item comes from

silk elk
#

Yeah but how would I do that

echo basalt
#

Idk I'm a developer I google things

silk elk
#

I've exhausted the possible ways to Google the same question

echo basalt
#

You gotta apply brain logic too

#

Forgot to mention that

silk elk
#

Believe me I'm running out of it

#

I just cannot seem to figure out how to stop dragging between inventories

#

It's the only thing I'm stuck on

echo basalt
#

DragEvent for that

silk elk
#

Yeah I know that

#

But like I can't figure out how to check if it actually moves to another inventory

#

I mean would checking the inventory after the drag event and seeing if the item isn't there work?

echo basalt
#

Very hacky

smoky oak
#

time for a stress test
1.2 million particles

shrewd sphinx
quaint mantle
silk elk
#

Have you tried recompiling?

shrewd sphinx
#

yes

quiet ice
# shrewd sphinx

Either caused by the plugin being disabled or being caused by the plugin not having that class

shrewd sphinx
#

oh my god

#

i know whats wrong

quiet ice
#

And what is it?

shrewd sphinx
#

nvm i lied

silk elk
#

And this isn't an API or something?

shrewd sphinx
#

nope

quiet ice
#

Although plugin being disabled most likely does not apply here given that it would usually say that the classloader is closed

shrewd sphinx
#

respawn handler just respawns the player at xyz coordinates

silk elk
#

Hmm if you've tried recompiling then there might be an issue with your IDE when compiling?

shrewd sphinx
#

im using IDEA

#

doubt that would be the case

quiet ice
#

Just fork us over the jar and perhaps we'll see whats wrong from there

shrewd sphinx
#

it was compiling just fine 5 minutes ago

#

let me try something

quiet ice
silk elk
#

I can second that

civic wind
#

Intellij?

quiet ice
#

Yea

silk elk
#

Yeah

civic wind
#

What do you use geol?

quiet ice
shrewd sphinx
#

yeah reloading idea didn't help

civic wind
#

I started with eclipse and went to intellij, not sure what i prefer tbh, intellij was really confusing at first

silk elk
#

You could always decompile the JAR file and see if the class is there at all

#

Which if theres a NoClassDefFoundError I imagine it's not but it's worth a try

quiet ice
#

Hence my comment about giving us the jar

shrewd sphinx
quiet ice
#

CNFE/NCDFE can happen even if the class is actually present in the jar

silk elk
#

Well it's there

quiet ice
#

So class init error. Time to get recaf up and running

silk elk
#

Wait

#

One sec

#

I don't know if this matter but the package says Handlers (capitalized)

#

But the jar has it lowercase

quiet ice
#

does not

shrewd sphinx
#

wtf works fine now?=??

quiet ice
#

Recaf at least doesn't differentiate, java on the other hand...

silk elk
#

Yeah sounds about right

#

IntelliJ for you

shrewd sphinx
#

works fine now ¯_(ツ)_/¯

#

legit did nothing

quiet ice
#

But Recaf and URLClassLoader should have similar constraints

smoky oak
#

can i use lambdas to create a bukkit runnable

quiet ice
#

So yeah, probably an instance of a cache being blown up

quiet ice
silk elk
#

I think?

#

I guess it depends on the context youre talking about

quiet ice
#

BukkitRunnable probably is a FunctionalInterface, so most likely

#

If not, use a wrapper

smoky oak
#

want to pass a runnable to a method

#

but dont want to do the new runnable stuff if i dont have to

quiet ice
#

Suppliers?

silk elk
#

You can do Bukkit.getScheduler().runTaskTimer(plugin, () -> { // code }, delay, time) or something if thats what you mean

smoky oak
#

yea

quiet ice
#

Lambdas still allocate a new object, even if not explicitly

#

Suppliers too technically though

clever musk
#

I'm having weird visual bugs with this:

    @EventHandler(priority = EventPriority.LOWEST)
    public void e(InventoryClickEvent e) {
        e.setCancelled(true);
    }

When an item is clicked, the event is cancelled; however, A fake version of the clicked item appears on the players cursor.

smoky oak
#

hm different question. If i do create a runnable via a lambda that uses variables of the method its initialized in, does it still point to those variables or does it clone them

quiet ice
#

Clone as in?

smoky oak
#

int b = a

quiet ice
#

For primtives the value is copied, for L-type values (so everything else) the reference is

#

Lambdas cannot make use of mutable variables

#

If you cannot add final to the variable declaration without compiler errors, you cannot use the variable in the lambda by design

#

Although you probably know that already...

smoky oak
#

well they can be internally mutable if internally initialized

#

im passing some values but they dont change

quiet ice
#

Java has no concept of HARD-copying objects, so generally it is hard to define clones (do shallow copies count? Do deep copies counts? Does reference passing count as cloning?)

smoky oak
#

my brain is like, if it doesnt change the previous variable, its a clone

quiet ice
#

So reference passing

smoky oak
#

yea also the limit for particles before it gives me issues is about 1024

#

i tested in powers of 2

#

and with issues i mean visual lag

#

btw particles can be sent async right?

quiet ice
#

They are sent async by default iirc

rugged kettle
#

is spigot compatible with modded things ? like if i wanted to make a plugin that repairs an item, is it possible to make it work with modded items ?

young knoll
#

Spigot does not support mods

smoky oak
#

technically its possible but u really, really shouldnt

quiet ice
#

If you are talking fabric (and forks)/forge/spongevanilla kind of modded - then no, not possible

#

Unless you are using one of all those compatibility layers that exist, but then the experience greatly varies and you should define the constraints further

#

If you just mean "how can I set the damage to 0", then just do exactly that - should work on all vanilla and most modded items. (Unless you are in a version prior to 1.13)

shrewd sphinx
#

what is the best way to cancel the AsyncPlayerChatEvent for players only and not the console?

#

Logger?

quiet ice
#

?jd-s

undone axleBOT
rugged kettle
quiet ice
#

1.12?

rugged kettle
#

1.16.5

quiet ice
#

And with modded you mean slimefun (and similar) kind of modded or fabric (and forks)/forge/spongevanilla kind of modded?

rugged kettle
#

yeah, forge

fluid river
quiet ice
# rugged kettle yeah, forge

Then it is likely caused by the compatibility layer not correctly implementing the methods the spigot plugin uses

shrewd sphinx
#

i mean i ended up using getconsolesender instead but im still curious

fluid river
#
var i = or e.getRecepients().iterator();
while (i.hasNext()) {
    if (i.next() instanceof Player p) e.getRecepients().remove(p);
}```
shrewd sphinx
#

bukkit logger outputs weird characters so idk

quiet ice
#

What kind of wierd characters?

shrewd sphinx
#

exp.

fluid river
#

or basically cancel the message end use Bukkit.getConsoleSender().sendMessage(e.getMessage());

rugged kettle
shrewd sphinx
#

žfUSERNAMEž>žMESSAGE

quiet ice
#

And you using String#format?

shrewd sphinx
#

aye

brisk estuary
#

Hi. What method should I use to get the item used to break a block on a BlockBreakEvent, e.getPlayer().getItemInUse() or #getItemInMainHand?

quiet ice
#

Then probably an issue with ANSI, hence why I asked about adventure

shrewd sphinx
#

well im using the translatealternatecolorcodes

quiet ice
#

Adventure has a dedicated lib for that built-in

shrewd sphinx
#

link me

quiet ice
fluid river
#

but actually there should be a getter in the event itself

#

like getItem() which returns what player used to break block

fluid river
#

for paper

brisk estuary
quiet ice
#

Or Adventure-Plattform-bukkit

quiet ice
#

But that's to be expected from a non-bukkit impl.

tranquil stump
#

for the spawn entity packet in protocol lib, are the velocity actually integers even though on the wiki it says short ?

quiet ice
#

It can very well be that they are cast down to shorts after being ints

restive mango
#

say i have a function and all it does is generate random points in a sphere, say 100 of those points
i also want to be able to check if each of those points is inside a solid, and if so, to ignore that point and keep generating them until i get to 100 points
however, i only want to do that SOMETIMES, other times i want to generate those points inside solids
i just use a boolean to say whether or not in this particular instance i generate them outside of solids
how do i do that without having an if statement repeated 100 times checking that boolean OR having what amounts to two blocks of almost the exact same code with the only difference being that check if they are inside solids

tranquil stump
restive mango
#
 while (locationList.size() < 100) {
                double thisLocRadius = outerRadius*(Math.pow((1-((1-(innerRadius/outerRadius))*random())), 1.0/3.0));
                double theta = (1-(2*Math.random())) * Math.PI * (arcAngle/360) + Math.PI;
                double phi = Math.acos((2.0 * Math.random() - 1.0)*(arcAngle/360));
                double x = thisLocRadius * Math.sin(phi) * Math.cos(theta);
                double y = thisLocRadius * Math.sin(phi) * Math.sin(theta);
                double z = thisLocRadius * Math.cos(phi);
                Vector vect = new Vector(x, y, z);

                if (!((noSolids) && (origin.clone().add(vect).getBlock().getType().isSolid()))) {
                    locationList.add(origin.clone().add(vect));
                }


            }
#

it's just the last if (!((noSolids) && (origin.clone().add(vect).getBlock().getType().isSolid()))) {
locationList.add(origin.clone().add(vect));
}

quiet ice
#

Alternatively you could go ask on #mcdevs@irc.libera.chat - could very well be that it has changed lately

restive mango
#

which is bothering me

quiet ice
#

You could just have a Set<Location> or somewhat like that

quiet ice
#

The irc channel where the people behind wiki.vg are

tranquil stump
#

i dont really know how ircs work

#

can I just go to irc.libera.chat?

quiet ice
fluid river
#

guys using static abuse

#

by calling System.out.println()

#

omagaaad

quiet ice
#

System.out is only one static

fluid river
#

yeah i deleted the message where said there are 2

quiet ice
#

with what?

fluid river
#

nvm

void isle
fallow sedge
#

Hey real quick, what's the formating for adding 1.19 release to the gradle build file?

#

compileOnly 'org.spigotmc:spigot-api:1.19' ?

sterile token
#

I need support

quiet ice
fallow sedge
#

Ah alright

fluid river
sterile token
#

Yes!

fallow sedge
#

Thank you!

sterile token
#

Specially for drugs

worldly ingot
sterile token
worldly ingot
#

I mean, if you're writing against 1.19, then yeah

#

but you always have the -R0.1-SNAPSHOT at the end of all versions

sterile token
#

Whst nenas gja g

worldly ingot
#

Yes

sterile token
#

What means that?

worldly ingot
#

So if you were to compile against 1.19, you'd use 1.19-R0.1-SNAPSHOT

sterile token
#

The words are mixed because cellphone is in Spanish

#

Chocó for example what the diff between R1-Snapshoot and R3-Snapshot

worldly ingot
#

Nothing. It never changes

#

It will always be R0.1-SNAPSHOT

vivid skiff
#

How can i heal a player of a specific number of hearth:

I made it like this right now, but if a player have like 2 hearts of damage it doesn' t heal the player.
player.setHealth(player.getHealth() + 6);

sterile token
#

I dont think

#

I have seen spigots with r1 and re

#

For example spigot 1.8

worldly ingot
#

You've seen internal package names with different revisions

#

The API version however has always been R0.1

sterile token
#

In 1.8 you have R1 and R3

worldly ingot
#

Yeah those are package names. The dependency is still 1.8.8-R0.1-SNAPSHOT

sterile token
#

Ohhb

#

My bad

#

Im an idiot

#

I always loosing ur time

sterile token
#

Haha

#

That why I was asking hok

quiet ice
#

But those are all pre-release/debug/ea builds

worldly ingot
#

Yeah they're not stable builds

fallow sedge
#

So I want to make a plugin to let me place blocks in spectator mode. According to this (https://www.spigotmc.org/threads/set-blocks-in-spectators.262217/) post I can override blockcanbuildevent and set it to true to acomplish this. I've made a listener, but I'm not sure what to do in my main method, and where to register the listener

shrewd sphinx
#

@quiet ice do you perhaps have a mongodb class i could use its way too late and i cant bother writing my own

quiet ice
#

I.e. the catch-all-cant-be-bothered method would be JavaPlugin.getProvidingPlugin(new Object() {}.getClass())

fallow sedge
#

oh damn

quiet ice
#

Of course using DI (i.e. passing the plugin instance along) is better, but one can be lazy for one-time setup code

#

You aren't forced to use this however

fallow sedge
#

I'm just making one very simple method for this (if the method I'm planning around works)

shrewd sphinx
quiet ice
#

Hey, DataOutputStream/DataInputStream is the best girl around town - at least in my opinion

shrewd sphinx
#

le what

quiet ice
#

(not to be confused with ObjectOutputStream/ObjectInputStream)

shrewd sphinx
#

doesnt DIS reset when the server stops

quiet ice
quiet ice
fallow sedge
quiet ice
fallow sedge
#

ah okay, but how would I actually write the code? This miiight require more reading, I'm familiar with java but this is a lot to take in hahaha

quiet ice
#

Just to be clear - that alone does not register an event. It only returns the plugin's class that you can use to register an event

#
plublic class MyPlugin extends JavaPlugin {
    public void onEnable() {
        getServer().getPluginManager().registerEvents(new MyListener(), this);
    }
}
public class MyListener implements Listener {

    @EventHandler
    public void onEvent(Event x) {
        System.out.println("You can't listen for the \"Event\" class directly though. You'd need to listen for a subclass of it");
    }
}

Being an example

#

However you can register the listener anywhere by using Bukkit.getServer().getPluginManager().registerEvents(new MyListener(), JavaPlugin.getProvidingPlugin(new Object() {}.getClass()));

fallow sedge
#

Thank you so much for the help btw!!

quiet ice
#

It's be public void onEvent(BlockCanBuildEvent event), but yes

vivid skiff
#

How can i save player data like

Members:
- UUID1
- UUID2
- ...

fallow sedge
quiet ice
vivid skiff
quiet ice
#

People are too stupid, so that approach does not work

#

They will not figure out that they need to change the class name

#

trust me, I tried plenty of times.

#

The anonymous class is also needed because there are other people that want to use it in a static context

quaint mantle
quiet ice
#

You have read the terms and conditions like any good user, you should know it

chrome beacon
#

Also don't ask in every channel

quiet ice
#

Basically: It is possible they will, it is possible they wont

serene onyx
#

^^^^

undone axleBOT
torn shuttle
#

man I didn't even know they made mc servers out there with 50gb of ram

tranquil stump
#

im using protocol lib, what clientbound packet should I use when a living entity is spawned?

fluid river
#

get highest block on the location you want to teleport player

echo basalt
fluid river
#

player.teleport(loc.getWorld().getHighestBlockAt(yourChangedLoc).getLocation().clone().add(0, 1, 0))

#

yeah

#

then just make an algorithm for finding perfect spot

#

you can get this location you made

#

and set y to current player's y

#

and after that teleport at your new location

vagrant stratus
#
        Action action;
        if (args[0].equalsIgnoreCase("assign") || args[0].equalsIgnoreCase("unassign")) {
            try {
                action = Action.valueOf(args[0].toUpperCase());
            } catch (Exception e) {

            }
        }

Any cleaner way of doing this lol

fluid river
#

most of the geometry i made had .normalize()

fluid river
#
if (args[0].matches("assign|unassign") {
    try {
        var action = Action.valueOf(args[0].toUpperCase());
        // here you do the rest of the code
    } catch (Exception ignored) {}
}```
vagrant stratus
#

huh. TIL

fluid river
vagrant stratus
#

".matches"

fluid river
#

true

#

it eats regex

vagrant stratus
#

impl'd in 1.4

fluid river
#

don't worry i learned it only 6 months ago

#

feels bad

#

next time create circle of 12 particles

#

and rotate it 180 degrees each second

#

you will need sin and cos

#

to place particles on a circle

#

and to rotate every particle

#

if you want mafs in minecraft

#

try making circles with sin/cos

#

once i had to code plugin

#

Which simulated solar system in minecraft

#

so basically i had planets which were all rotating around the sun

#

and i had zones around planets which teleported players to another bungeecord server when they entered it

#

yeah

#

i didn't know about sql and redis

tranquil stump
fluid river
#

so i synced everything with bungeecord plugin messaging

#

well planets are on different distances from the sun

#

so i needed to multiply

#

omg i cant believe

#

yea

#

bro why

#

btw once made location wrapper

#

SimpleLocation

#

with magnitude, flatMagnitude, flatDistance methods

#

tagged every "distance" as deprecated

#

basically go to university

#

spend one year

#

and you are done

#

what actually you are trying to make @wind blaze

#

teleport player 1 block forward

#

in direction where he looks?

tranquil stump
#

it says Could not find packet for type SPAWN_ENTITY_LIVING

fluid river
#

is it implemented in your current ProtocolLib version

#

doesn't ProtocolLib have some wiki

tranquil stump
#

im pretty sure its out of date..

fluid river
#

well change it

#

yes

#

left right like X Z or left/right from where he looks

echo basalt
#

so

#

vector(1, 0, 0).rotateY(yaw)

fluid river
#

so like if you move player to the left he will look a bit to the right after tp?

#

like he will look on the same block after tp

#

or just on the same direction, but x blocks left

#
var loc = player.getLocation();
var vec = loc.getDirection().normalize().rotateAroundY(loc.getYaw()).multiply(3);
player.teleport(loc.add(vec));```
#

like this

echo basalt
#

oh god

#

please

#

reuse stuff

fluid river
#

ye

echo basalt
#
Location playerLoc = player.getLocation();
Vector direction = playerLoc.getDirection().normalize();
Vector rotated = direction.rotateAroundY(playerLoc.getYaw();

Vector finalOffset = rotated.multiply(3);

player.teleport(playerLoc.add(finalOffset);
fluid river
#

cuz you look staright up

#

no x no z

#

both zeros

#

did you apply normalize() btw

#

i changed

#

try

#

or try ImIllusion's code

untold jewel
#

so you would know that if the player is in the arraylist the next time he uses the command its always unassign

vagrant stratus
#

Not really

#

That's only a small part of the method lol

fluid river
#

toggle then

#

instead of assign unassign

vagrant stratus
#

Nothing toggle related, was doing something w/ PDC's

fluid river
#

not to you @vagrant stratus

vagrant stratus
#

Ah

fluid river
#

we just made matches

#

now it's all good

#

you can send full code

#

so we can make it 2 times smaller

#

oh today's the day

#

LPR and DPR ref

#

as far as i remember

vagrant stratus
#

I've already made it as small as I can lol

vagrant stratus
#

I however prefer readable code

fluid river
#

py

#

thon

shadow gazelle
#

I'm trying to make it so that you can have up to double the normal enchantment levels but not allow conflicting enchantments, but the latter doesn't seem to be working for unknown reasons, any ideas?
https://github.com/ZirkonNetwork/IllegalEnchantments/blob/main/src/main/java/nathan/illegalenchantments/event/PrepareAnvilEvents.java

GitHub

A somewhat hacky way to allow players to get enchantments up to double the normal levels - IllegalEnchantments/PrepareAnvilEvents.java at main · ZirkonNetwork/IllegalEnchantments

vagrant stratus
#
  • I also don't need every little thing as small as it can be
shadow gazelle
#

I know it's a mess, but there's not really any other way to get something like this to work afaik

dusk scroll
#

Hi I am getting an error where for some reason my enums are having initialization errors? don't quite get why, does anyone know?

Error: https://hastebin.com/viyerexawi.properties
Code:
ShopItems enum: https://hastebin.com/mocixitoka.yaml
Shops enum: https://hastebin.com/apavezuqok.java
Trades enum: https://hastebin.com/behofuginu.java

fluid river
#

don't know what's the problem tho

shadow gazelle
vagrant stratus
#

I do however need to deal w/ rewriting a parser to be less shit @fluid river 😂
Doesn't even handle operators :/

fluid river
#

var - small code

shadow gazelle
vagrant stratus
#

Honestly, ignore Nuker lmao

#

var's usefulness is limited tbh

fluid river
#

can i put my balls

#

in your goal

#

nonono

shadow gazelle
fluid river
#

your goal

shadow gazelle
#

I had no idea what it was because I usually only use J1.8

vagrant stratus
shadow gazelle
vagrant stratus
#

You don't really need static imports either

#

again, best to just ignore Nuker lmao

shadow gazelle
#

Am I even calling anything that's static outside of that event class lol

fluid river
vagrant stratus
#

Quite a lot of duplicate code though, surely you can throw some of that into a method @shadow gazelle

fluid river
#

to find only once case of static import

#
 final Map<Enchantment, Integer> resultEnchantments = result.getEnchantments();
#

var is useless he says

untold jewel
shadow gazelle
fluid river
#

.

fluid river
#

not here

#

anvilInventory.setMaximumRepairCost(IllegalEnchantments.maximumLevel);

#

the only real case where you use static

shadow gazelle
untold jewel
fluid river
#

thought there are more

dusk scroll
#

I never had to do that before.

fluid river
#

streamapi goes brrr

dusk scroll
shadow gazelle
#

var seems like more useless shit added to Java like a lot of it has been recently

dusk scroll
#

with ShopItems.getPrice

fluid river
#

List<HashMap<String, HashMap<Integer, Function<UUID, Location>>>> list = inst.getList();

shadow gazelle
#

or very few use cases

fluid river
#

List<HashMap<String, HashMap<Integer, Function<UUID, Location>>>> list = inst.getList();

#

imagine writing it manually

shadow gazelle
#

yeah, not doing any of that

vagrant stratus
untold jewel
untold jewel
#

As I said, I'm not 100% sure so this might be wrong

fluid river
#

you have to init var variable

#

when you declare it

vagrant stratus
#

and regardless, var hides what's what

hazy parrot
shadow gazelle
#

@vagrant stratus so any ideas about what's wrong with the conflicting enchantments?

hazy parrot
#

Than*

fluid river
shadow gazelle
hazy parrot
#

get List in your case can literally return anything

dusk scroll
fluid river
hazy parrot
#

I would not dig its return type if looking at your code

dusk scroll
#

You may be on the right track with the null thing

hazy parrot
#

I said regarding your example

dusk scroll
#

But it might be because of the cross reference.

#

let's see.

fluid river
#

mostly in loops

vagrant stratus
#

Honestly I've never had a reason to use var

fluid river
#

starting up IDE

fluid river
dusk scroll
fluid river
#

and List generics

vagrant stratus
untold jewel
fluid river
#

and long class names

vagrant stratus
#

Not really an issue w/ the long class names. I just have my IDE autocomplete

dusk scroll
shadow gazelle
#

that's what I was thinking

dusk scroll
#

and are too lazy to actually define what their variable is

untold jewel
shadow gazelle
#

bro's trying to write JS in Java

dusk scroll
#

The Enum is basically just a config file for the base price and item stats/names/description

untold jewel
fluid river
#
var townKey = new NamespacedKey(this, "townyraids-town");

var list = new ArrayList<String>();

var mayor = itown.getTown().getMayor();

var dRegions = WorldGuard.getInstance().getPlatform().getRegionContainer().get(BukkitAdapter.adapt(dLoc.getWorld())).getApplicableRegions(BukkitAdapter.asBlockVector(dLoc));

for (var e : placeTasks.entrySet()) {}

for (var t : tasks.keySet()) {}

var meta = defendersItem.getItemMeta();

for (var t : towns) {}

var tm = TownyRaids.getInstance().getTitleManager();
#

mostly useful if you don't even know what is the returned type

#

so after you made variable var

#

you can hover on it and get it's type printed on the screen

shadow gazelle
#

not knowing the return type almost never happens

fluid river
#

happens a lot

shadow gazelle
#

no it really doesn't

fluid river
#

WGAPI class

#

is renamed every version

#

TitleManager or TitleManagerAPI

#

I still don't know what is the class real name

shadow gazelle
#

that's not a return type

#

that's a class name

fluid river
#

return type

shadow gazelle
#

oh, right instances

fluid river
#

for my getter

#

yeah

shadow gazelle
#

an API really shouldn't be changing names so much

fluid river
#

not even my

shadow gazelle
#

it's an API

fluid river
#

well go to WorldGuard

#

i feel like they are rewriting it every time

#

from scratch

shadow gazelle
#

either way, not exactly a massive use-case

fluid river
#

for (var e : placeTasks.entrySet()) {}

#

imagine writing

#

Entry<Integer, String>

shadow gazelle
#

shitty APIs with developers that don't know the definition of continuity

fluid river
#

instead of var

untold jewel
fluid river
#

or write like ItemMeta, SQLWarDataHandler, or NamespacedKey

#

too long for me

#

not worth my time

echo basalt
#

🤡

untold jewel
fluid river
#

who deleted my branch

#

i lost the message

#

best one on this server

dusk scroll
#

It could potentially be easier

#

However you prefer to do it is up to you, it pretty much just comes down to preference

#

And also application in some cases, like with a bungeecord some may choose to have some information in the server db

untold jewel
#

just figured that sell prices / buy prices displayname and lore should be displayed so a user can change it

dusk scroll
#

Oh yeah, if you want a user to configure it then by all means use a config file.

untold jewel
#

I dont know if I'm going to release it publicly but I will distribute it to specified users

shadow gazelle
#

oh

#

found the issue lol

#

I forgot an !

dusk scroll
#

I don't ever plan to release my plugin to spigot so that's why I'm going to just keep it as an enum

#

I use enums for a lot of things, even configuring some game mechanics.

untold jewel
#

is ur plugin working?

dusk scroll
#

yeah

dusk scroll
untold jewel
#

could I jump on a test server

#

see it+

dusk scroll
#

Unfortunately my own test server is not able to be port forwarded - my landlord is the only one with router access 😂 - but i have a public server

#

just doesn't have the latest code on it

shadow gazelle
dusk scroll
#

so it's missing some features

#

but pretty much everything is there

untold jewel
#

No worries, I could just join if u want

dusk scroll
#

sure

#

i'll come join you

untold jewel
#

what

#

haha

shadow gazelle
#

The Clash Royale enum caught my attention

dusk scroll
#

playing the minigames takes 2 players

#

😛

#

can you accept my friend req so i can dm you the ip?

dusk scroll
#

the clash royale one you see is indeed what you think it is

shadow gazelle
#

hmm

dusk scroll
#

a recreation of CR in minecraft

shadow gazelle
#

Clash Royale minigame :EYES:

dusk scroll
#

it is playable if you want

shadow gazelle
#

I do

dusk scroll
#

ok i'll dm you ip

shadow gazelle
#

yep

#

it works

#

goddamnit

#

forgot one exclamation mark and it broke half of the functionality

fluid river
#

cool

echo basalt
#

sometimes I wonder if I should just get a ton of modellers and make a full crazy frog movie within minecraft

quaint mantle
#

Can you create a mysql database on the mc server

hazy parrot
#

What

quaint mantle
#

Nvm

#

Im dumb

#

We good

tranquil stump
#

does anyone know why this says 0 is out of bounds of range 0

        packet.getShorts()
                .write(0, (short) vector.getX())
                .write(1, (short) vector.getY())
                .write(2, (short) vector.getZ());
#

its for a spawn entity packet

#

Field index 0 is out of bounds for length 0

#

on the wiki it says the shorts are for velocity