#help-development

1 messages Β· Page 1619 of 1

chrome beacon
#

You can wait let me get the recipe I made

grim ice
#

2 pages

#

;-;

chrome beacon
#

Minecraft wiki has a guide

grim ice
#

@chrome beacon isnt making datapacks

#

different from

#

spigot

chrome beacon
#

It is

grim ice
#

o

chrome beacon
#

Read above as to why we're doing it

eager sapphire
#

πŸ˜„

#
        "#": {
            "item": "minecraft:diamond",
            "Unbreakable": 1
        }

Maybe it's like this?

#

server loaded at least so we will see

proud basin
#

no

#

item has to be capi

grim ice
#

why are you making data packs anyways

#

plugins are way more efficient and easier

proud basin
#

less memory usage maybe

eager sapphire
#

tl;dr testing custom recipes that don't seem to work correctly client-side when registered via a plugin

grim ice
#

wdym

grim ice
proud basin
#

I believe data packs only gets used when a player joins

grim ice
#

plugins still better i think

dusk flicker
#

plugins are always better but look at their reasoning above

grim ice
#

plugins have almost infinite possibilities

eager sapphire
#

Whelp, same behavior from a datapack

#

guess I'm hosed

grim ice
#

and are more easy on servers

dusk flicker
eager sapphire
grim ice
dusk flicker
#

looks at FAWE

eager sapphire
#

Recipe ingredient must be an unbreakable diamond- works exactly as if my plugin had registered it

grim ice
#

We're talking about spigot capabilities not your capabilities

dusk flicker
#

I wasn't talking about mine

grim ice
#

yes ik

eager sapphire
#

On the bright side I guess I can submit it as a bug to Mojang πŸ€·β€β™‚οΈ

chrome beacon
grim ice
#

What's your issue

chrome beacon
#

That doesn't look right to me

grim ice
#

datapacks dont have events

#

they always have to rely on loops

#

so theyre wayyy worse than plugins

chrome beacon
#

We are making Recipes

grim ice
#

Yes

eager sapphire
#

Yeah I'm sure, it worked πŸ™‚

grim ice
#

arent recipes like so weird in datapacks

chrome beacon
#

Aight

eager sapphire
grim ice
#

i would say just make a plugin for it

eager sapphire
#

great deal there

grim ice
#

way easier

chrome beacon
grim ice
#

couldve done that in seconds if it was spigot lol

#

its like 5 lines of code

eager sapphire
#

I think you are missing the whole point

chrome beacon
#

Yeah most people don't know Java though

eager sapphire
#

even though I tl;dr'd it πŸ˜‚

chrome beacon
#

^

grim ice
#

He knows java tho

#

wheres it

#

sorry didnt see it

chrome beacon
#

You literally replied to it 🀣

eager sapphire
eager sapphire
chrome beacon
#

True true

eager sapphire
#

I don't know how to summarize it better though, so there's my original question

grim ice
#

o

grim ice
#

its imaginedev not me

#

anyways u could just use ExactChoice in spigot

eager sapphire
#

ok so "what??" not "?"

grim ice
#

spigot for the win

eager sapphire
#

but the sentiment was the same πŸ˜‚

chrome beacon
#

Oh well if it doesn't work with Vanilla create a bug report

eager sapphire
#

oml

chrome beacon
#

This really should be fixed

eager sapphire
#

yep on it (the bug report)

#

Someone already submitted one but didn't do the work to test in vanilla

grim ice
#

i mean would they rly care to fix it

eager sapphire
#

Well if it's actually possible to do via a datapack then it's a great custom crafting feature that should be fixed

#

B/c custom model data, custom items, custom crafting- seems like a win

grim ice
#

honestly

#

what makes datapacks a bit good

#

is that they work in singleplayer

#

they do, right?

ivory sleet
#

yeah

grim ice
#

hmm

eternal night
#

Looking into le client for a bit, mojang specifically removes any damaged, enchanted or custom named items from the stacked contents that make up the base for recipe matching

grim ice
#

OH THATS WHY MY RECIPES R NOT DOING THAT

#

OK OK

#

That makes sense

eager sapphire
#

This item is technically none of those things, it just has an unbreakable tag

#

but maybe that's lumped in too?

grim ice
#

but fuck am i gonna redo 24 recipes? hell nah

eternal night
#

Specifically net.minecraft.world.entity.player.StackedContents line 26

grim ice
#

@eternal night btw ur tutorial is great

#

the one for pcd

#

i mean i learnt pcd weeks ago but thanksss

#

really useful :D

worn tundra
#

pdc?

chrome beacon
#

PersistantDataContainer

eternal night
#

hmm unbreakable does not seem to be part of it

eternal night
crimson scarab
#

hey everyone i'm trying to compare two itemstacks but one they have different attribute modifers uuids any suggestions.

eager sapphire
#

I think this did not work

        "#": {
            "item": "minecraft:diamond",
            "Unbreakable": 1
        }
#

it just wants regular diamonds

chrome beacon
#

Yeah that's what I thought

eternal night
#

Tho, I see your point, the recipe is technically "valid" but cannot be transferred into the container

eager sapphire
#

There is a way to do it via a datapack though?

chrome beacon
#

"#": {
"item": "minecraft:diamond",
"tag": "{unbreakable:1b}"
}

#

Try that

eager sapphire
#

Doesn't seem to work 😦
I tried Unbreakable (capital) as well

chrome beacon
#

Ow

#

Try nbt instead of tag

eager sapphire
#

anyway to reload datapacks on the fly? πŸ˜…

chrome beacon
#

/minecraft:reload

#

Or just /reload on vanilla

crimson scarab
#

how to ignore attribute modifers when comparing item stacks

fluid cypress
#

how can i set a head block with the skin of a player?

eager sapphire
eager sapphire
#

The server must parse datapacks, right? I should just find where that happens in the code...

chrome beacon
#

Yeah

eager sapphire
chrome beacon
#

NMS contains code for auto generating recipies too

fluid cypress
#

just by using setOwner it will change the texture to the player's skin?

#

what about skinrestorer and offline mode stuff

eager sapphire
#

SkinRestorer can only set a player's skin to some other player's skin, right?

#

so you'd have to see if that plugin has an API so you can get the real player skin, use that in your skull

chrome beacon
ivory sleet
#

Offline mode has become a cult lol

chrome beacon
#

Don't help people breaking the EULA

crimson scarab
eternal oxide
#

isSimilar only excludes stack size

eager sapphire
#

oh whoop sorry 😦 I'm batting 0 here πŸ˜‚

hasty prawn
eternal oxide
#

What are you trying to compare?

crimson scarab
#

two itemstacks

#

both are the same

hasty prawn
#

ItemStacks ignoring only AttributeModifiers

crimson scarab
#

but because of attributemodifer uuids they are different

#

even though everything else is identical

fluid cypress
eternal oxide
hasty prawn
#

True

crimson scarab
#

hmm

hasty prawn
#

That's probably the best idea

crimson scarab
#

i live in pain

wary harness
#

any one can tell me how to force permission on player which is OP

#

so event if they are op

#

they will need to have permission ?

crimson scarab
#

suppose i should make it a method if i have to do it for a full set of armour

ivory sleet
#

set default to not op

chrome beacon
#

Set the default propery of permission

eternal oxide
#

if both are true while op they actually have the permission

wary harness
#

I was unaware of isset method

eager sapphire
#

^ assuming the perm manager is implemented correctly (PowerRanks has issues with both of those methods in my experience)

wary harness
#

for years

ivory sleet
eternal oxide
#

GroupManager πŸ˜‰

ivory sleet
#

πŸ₯²

eager sapphire
#

I've had people using both

eternal oxide
#

dabestest

ivory sleet
#

lol

hasty prawn
#

I'm still partial to PEX πŸ™

eager sapphire
#

I had to re-work all my permission checks for PowerRanks to not totally choke on my plugin 😐

wary harness
#

how does lp finds permissions in your plugin

#

?

eternal oxide
#

you should be registering yoru permissions

chrome beacon
#

You define them in the plugin.yml

wary harness
#

in plugin.yml ?

#

oh

ivory sleet
wary harness
#

what about

eternal night
#

Okay, even deeper digging into the workings for recipe placement. The server only handles so called "stacking indexes", basically runtime int ids for item materials, when placing recipes

#

while the recipe matches

eager sapphire
#

I assume they meant essentials gm?

eager sapphire
crimson scarab
#

i need to set itemmeta right i can just use a.getItemMeta().removeAttributeModifier(Attribute.GENERIC_ARMOR);

eager sapphire
#

But unless I can actually find a use-case in vanilla I don't think Mojang will care

eternal night
#

and the client actually attempts to place the recipe, the server fails to find the respective "plain" item based on the stacking index in the player inventory as that logic does not consider unbreakable items the exact same as plain items

#

This would however mean that datapacks cannot add recipes using custom items too

eager sapphire
#

sounds like that explains the behavior re: unbreakable vs named

wary harness
#

this type of permission Economy.TokenDrops.Type.Mobs.Skeleton how to define it in plugin.yml

eternal night
#

as they would fail at the same hurdle

eager sapphire
#

well so far I'm not convinced there is even a syntax for a datapack to try

wary harness
#

it would be crazy to type every mob type

eager sapphire
#

The recipe parsing code in nms is semi indecipherable to me, just hoping to glean how I might try to put this in a datapack

wary harness
#

@chrome beacon

eternal night
#

so I guess the only really valid suggestion to mojang would be to allow datapacks to register recipes using custom named/nbt item stacks

wary harness
#

but again defie every mob ore in my case block

eternal night
#

if you can already do that as of right now, my deep dive into the server source code must have missed something

eager sapphire
ivory sleet
#

lowercase tho

#

also whats type?

chrome beacon
#

^

eager sapphire
#

heh- no gm I've ever used seems to care about case, but yeah sue me it was 10 years ago and there wasn't really a standard I was aware of πŸ˜‚

wary harness
#

do I need to have list in my code some where

#

and then plugin takes it

eager sapphire
wary harness
#

on load

chrome beacon
eager sapphire
#

ah ok thanks anyway! πŸ˜„

ivory sleet
#

olivo u on vac?

eager sapphire
wary harness
#

like BeastTokens.TokenDrops.Type.Mobs.*

#

for all mobs

chrome beacon
wary harness
#

or for specific mob BeastTokens.TokenDrops.Type.Mobs.skeleton

ivory sleet
chrome beacon
eager sapphire
#

Yeh MrAxe the two perm blocks I pasted will do that- you just check for the mob type in your code, and they can either do "*" to have them all, or it'll act like a list and they can have specific mobs in the list

#

in my case I give * by default but you can change the default to false or op if you want

wary harness
#

ok thanks

#

🍺

wary harness
#

like Token.*.drop.*

eternal oxide
#

no

#

well, yes

wary harness
#

that wont work ?

#

will it

eternal oxide
#

if your permission is that exactly

ivory sleet
#

thats not how wildcards work

eternal oxide
#

it will not be treated as a wildcard

ivory sleet
#

a wildcard represents everything literally

#

suppose to do it

wary harness
#

so only on end then

ivory sleet
#

you can actually override it in spigot for some bizarre reason

crimson scarab
#

ladies and gentleman i got it working

woeful moon
#

how can I get a player's total playtime in hours?

chrome beacon
#

Read the statistic

woeful moon
#

wdym?

eager sapphire
#

Statistic.PLAY_ONE_TICK I think

ivory sleet
#

its PLAY_ONE_MINUTE

eager sapphire
#
  • 20 * 60 = hours πŸ˜„
ivory sleet
#

iirc

#

but yeah its measured in ticks

eager sapphire
#

derp, I was looking at 1.9 docs πŸ˜“

ivory sleet
#

lmao why

woeful moon
#

so player.statistic.PLAY_ONE_MINUTE?

#

or how can I get statistic of a player?

ivory sleet
#

its an enum constant

#

probably refer to it as Statistic.PLAY_ONE_MINUTE

eager sapphire
#

.. reluctant backwards compatibility πŸ˜›

ivory sleet
#

here

#

but in the future

#

search through the javadocs yourself

#

?jd-s

undone axleBOT
eager sapphire
chrome beacon
#

Pings are fine

#

Keep spamming them if you want idc

ivory sleet
#

you turned off sounds or how do you handle it?

chrome beacon
#

I have nothing to do atm

#

Just sitting here on my phone bored

eager sapphire
#

Yeah it drives me nuts personally but glad I didn't bother you πŸ˜„

ivory sleet
#

yeah same

#

if someone pings me and I am gone whilst, then once I come back it's literally a hell to find that one message mentioning me

proud basin
#

how come? can’t you just look who pinged you

ivory sleet
#

idk

proud basin
#

Top right

#

click the inbox

chrome beacon
ivory sleet
#

my discord doesnt work that way apparently

proud basin
#

Are you on mobile

ivory sleet
#

both

proud basin
#

well on mobile just search your name

#

and click mention

#

desktop top right inbox

ivory sleet
#

hmm let me see

#

oh right

#

wtf why dont I know this

proud basin
#

Because you’re conclure

ivory sleet
#

touchΓ©

proud basin
#

I just saved you 10 minutes

ivory sleet
quaint mantle
#

Im creating an Inventory GUI is there a safe & easy way to check if the open inventory is really from the plugin (so people cant just rename a chest etc.)

#

Hey, what's the maximum size of a minecraft inventory?

#

even if it's buggy

chrome beacon
chrome beacon
ivory sleet
#

wait

#

wat

#

81 is possible?

chrome beacon
#

Tripple chest

#

Ye

ivory sleet
#

holy cow

#

why do u know this

quaint mantle
#

yeah this is the one that looks buggy

chrome beacon
#

I made one by accident

quaint mantle
#

is it supported by IF?

ivory sleet
#

lol alr

chrome beacon
#

Spigot api don't support it

#

You need NMS

quaint mantle
#

I thought it did

ivory sleet
#

IF builds upon spigot iirc

chrome beacon
#

^

quaint mantle
#

oh fuck

#

I think it supported it in the past

left swift
#

how can i spawn falling block? i tried

FallingBlock chest = w.spawnFallingBlock(p.getLocation(), Material.CHEST, (byte) 0);``` but this place block if i'm on the ground, but if i'm flying it does nothing
quaint mantle
chrome beacon
#

If you're not experienced use a library such as IF (InventoryFramework)

#

I have to get some sleep now

ivory sleet
#

gn

eager sapphire
# chrome beacon Keep spamming them if you want idc

Ok soooo I think I found what i was looking for, in RecipeItemStack.Provider.a(JsonObject) - it appears to only look at "item" and nothing else, so seems impossible to register anything but plain items as ingredients in vanilla 😭

chrome beacon
eager sapphire
#

Unless there is some way to do it with tags but I have zero knowledge of how those work

chrome beacon
quaint mantle
#

I guess im just gonna put a permission check on all interactions too

fluid cypress
#

is the PlayerDeathEvent fired if the player uses a totem of undying?

chrome beacon
#

Anyway gn

eager sapphire
#

I will keep looking πŸ˜„
... actually, no, I will not - I give up. Pretty positive at this point it's not supported in vanilla, if anyone sees otherwise please tag me.

viral dome
#

hey I am trying to create vehicles plugin, whats the best way to move player riding for example invisible armorstand? because that's probably the best way of doing this?

#

I was thinking about kindof copy horse movement logic

#

but its not really a solution

eager sapphire
#

I had to dig into NMS to do that.. I made a PR a long time ago but it kind of died

#

There are some fields on the nms player you can read that basically map to WASD/space when they're in a vehicle

#

(including an armor stand or whatever mount)

viral dome
#

yeah ik

#

player is sending steer packets

#

if riding shit

minor garnet
#

what is your version @viral dome

eager sapphire
#

oh, ok, well sounds like you got it- what's you're question?

viral dome
#

but how do you actually move him

eager sapphire
#

.setVelocity

viral dome
#

uh

#

;/

#

I was thinking on more teleport approach ig

#

set velocity is problematic

crude sleet
#

https://hastebin.com/lakivohoge.yaml Hey, i want to check if the player have copper ore on slot 0 and coal on slot 1. It worked but only if i already have copper and coal on this slots. If the slots are empty and i place my coal and copper in the slots, nothing happends.

viral dome
#

beacause to achieve smooth movement

fluid cypress
#

why if i do PlayerDeathEvent#setKeepInventory(true) the player still drops its inventory?

viral dome
#

you need to spam

#

and it wont work in case of helicopter

crude sleet
viral dome
#

how would you go for helicopter movement logic then? lets say you want to make it go up when press a and go down when press d

eager sapphire
#

yeah I just set velocity every tick, not a huge deal- if you want them to hover without velocity I'm not sure there's a way other than giving them creative flight πŸ€·β€β™‚οΈ

viral dome
eager sapphire
#

I use space for up.. i think dismount is cancellable (again, recently) so you could use shift for down

viral dome
#

hmm

eager sapphire
#

If you want to try it to see what it feels like I can show you πŸ™‚

viral dome
#

or maybe not

#

wait

#

if you disable gravity

#

it sould work

#

yeah

#

yeah

#

okay another thing I was thinking of

#

when you have horse right

#

you can ride 1 block up

#

like automatically

#

it would be hard to copy that with velocity?

#

because you must somehow knock up player

#

when he is reaching block wall

digital plinth
#

gravity?

viral dome
#

of height 1

digital plinth
#

u can disable gravity?

#

with a plugin?

eager sapphire
#

yeah I agree, that is hard and my vehicles don't handle 1-block ramps super well 😭

#

for flying ones it doesn't matter much, i think for cars I had to do some look-ahead and like bump it upwards and it all feels very awkward

viral dome
viral dome
#

the low range one

#

idk how it was called in packets

#

because you would just tp player 1 up

#

and it would be smooth

#

hmm

#

its hard

eager sapphire
#

keep in mind teleporting mounted entities is tricky

viral dome
#

bukkit blocking it anyway

eager sapphire
#

you gotta unmount everything, teleport the pieces and re-mount on the other end

#

doing that every time you want to move might look really weird πŸ€·β€β™‚οΈ

viral dome
#

I was testing with teleport packet

#

and I was teleporting mounted palyer

#

it was fine

#

but server desync

#

lol

eager sapphire
#

doesn't sound very fine then πŸ˜‚

viral dome
#

well teleport packets should never be touched on real entities

eager sapphire
#

but maybe you could hack into the entity location server-side and keep it in sync yourself? Sounds ugly tho

viral dome
#

or just use some nms teleport methods

#

which do not prevent

#

from teleporting mounted players

#

but thats probably forbidden for a reason

eager sapphire
#

yeah I went down that road, it's not just like "bukkit blocks it to be annoying"

viral dome
#

another shit I am afraid of are physics of vehicles

#

for example you have some speed

#

and jump of a cliff

#

you should have parabolic road

#

and not hit the ground instantly

#

velocity in that case would be better ig?

#

hmm

#

@eager sapphire or just copy horse movement lol

#

like spawn dummy horse inside

#

and copy its movement

#

for block jumps

eager sapphire
#

heh that'd be kind of intereseting πŸ˜„

digital plinth
viral dome
#

for other mobs probably you would need to do some shit

#

like

#

extending armorstand

#

and replace it with other mobs

#

etc

eager sapphire
#

yah if you are willing to create a custom mob then you could probably make a rideable armor stand .. I have still not tried custom mobs myself though

#

I am getting tempted to now that 1.17 forced me into version-specific packages though πŸ™‚

quaint mantle
#

hey, how do i set the amount of players online when the ServerListPingEvent calls

proud basin
#

I have java PlayerData data = playerMap.get(iPlayer.getUuid()); playerMap.put(UUID.fromString(e.getUniqueId().toString()), new PlayerData(iPlayer.getUuid())); and seems that PlayerData is null but I just don't see why it would: PlayerData class ```java
public Map<String, Long> cooldownMap = new HashMap<>();

private UUID playerUUID;

public PlayerData(UUID uuid) {
    this.playerUUID = uuid;
}

public void addCooldown(String cooldown, Long time) {
    cooldownMap.put(cooldown, time);
}```
#

playerMap isn't null and iplayer isn't null

eternal oxide
#

wth? UUID.fromString(e.getUniqueId().toString()

#

convert to a UUID from a String, then back to a String?

#

getUniqueId() is a UUID

proud basin
#

UUID.fromString takes a String and e.getUniqueId is a UUID

#

oh wait

eternal oxide
#

you are getting a UIID, converting that to a String, then converting back to a UUID

proud basin
#

I don't even need that

#

yeah

#

anyways

eternal oxide
#

if you have an NPE error, break the line up to see what is null

proud basin
#

The only thing that I can see it that it might be is data.cooldownMap

#

So the map

eternal oxide
#

It could be empty but the map itself won;t be null. It could return null on a get if there is no entry

crude sleet
proud basin
#

right it would just print {}

eternal oxide
#

oh you are passing into that method

#

then most likely you didn;t register your Listener class

crude sleet
#

Yes, you can't do that individually either. So neither of both works. It works when an item is already on that slot

#

So i think when i place an item on that slot, the slot is null. Idk why

eternal oxide
#

Compare enums with == not .equals

crude sleet
#

Allright, sec

vivid zodiac
#

I want have my pseudo colored but that don't work why ?

Commands.Blue.addPlayer(player);
Commands.Blue.setColor(ChatColor.AQUA);
#

Teams work but with no color

sleek turret
#

maybe try putting the Blue.setColor before the use of it

#

actually no, that doesnt matter

crude sleet
eternal oxide
#

so you have the option to cancel it,

#

you need to check the clicked slot and the item

crude sleet
#

Okay sec

slim bough
#

Does anyone know of a way to simply make a permanent item in the last slot of the players inventry (similar to wynncraft or hypixel skyblock), where whenever someone right clicks the item, it runs a command like /menu

#

basically a menu item in the last slot of your inventory at all times

quaint mantle
#

just set that slot of their hotbar

#

and see if they drop it or try to drag it

#

and cancel the event

proud basin
#

Are you able to do if (!res.isBeforeFirst()) to check if resultset is empty?

eternal oxide
#

what? if (rs.next()) { } else {// is empty}

proud basin
#

if you do that won't you get Illegal operation on empty result set.

#

oh wait

#

im retarted

#

I just did it another way

crude sleet
#

I mean on SHIFT + CLICK, nothing happends and i need to check that too

eternal oxide
#

in InventoryClickEvent

manic bison
#

hey does anyone know how can i case switch on strings ? so far i have this but it wont work

#

switch (player.hasPermission()) {
case "permission1": break;

eternal oxide
#

you can;t use hasPermission like that

manic bison
#

why not

eternal oxide
#

because thats not how the method nor switch statements work

manic bison
#

so i'll haave to use if statements for every permission ?

eternal oxide
#

yes

manic bison
#

alrighty

#

thanks 4 help

crude sleet
quaint mantle
proud basin
#

error?

quaint mantle
proud basin
#

so what's suppose to happen

quaint mantle
#

Right now just
Bukkit.broadcastMessage("Vote - " + vote.getServiceName() + " - " + vote.getUsername());

#

Im using NuVotifier v2.7.2 if that helps

proud basin
#

could you print out player

quaint mantle
#

well none of this code is even running

#

it's like votifier doesn't see it as a listener

proud basin
#

then do ```if (player != null) {
PlayerLevelManager.checkVote(player);
} else {
Bukkit.broadcastMessage("1");
}````

#

I'm curious if the player is null

quaint mantle
#

but it's not even doing the first bukkit.broadcastMessage();

proud basin
#

I know

quaint mantle
#

so the event isn't even running

proud basin
#

hm

#

Can you show me how your registering the listener?

quaint mantle
#

Bukkit.getPluginManager().registerEvents(new VoteEvent(), this);

proud basin
#

Instead of implementing Listener change it to VoteListener then in the event method change it to Vote

quaint mantle
#

VoteListener isn't a class

#

I already tried that

proud basin
#

this is worth a try but idk if it's even gonna change anything instead of Bukkit. try getServer() when registering the event

quaint mantle
#

Do you know where a reliable NuVotifier maven repo is?

cursive kite
quaint mantle
#

onEnable()

cursive kite
#

and your onenable is being called?

quaint mantle
#

yes

#

I just cant find a repo now for NuVotifier

#

or votifier in general

#

maven all fucky

raw coral
#

Is there anyway for me to launch a projectile from 1 block left relative to the player, Player.launchProjectile() shoots from where the players head is with the right direction and im trying to do that just 1 block to the left

quaint mantle
raw coral
#

is there a way that i can make that go exactly one block (I havent really used vectors much i'm not sure how they work)

quaint mantle
#
vecY = py;
vecZ = pz - pz-1;

new vector(vecX, vecY, vecZ)```
#

hey,,, how do i convert a list into something readable like "Entry1, entry2, entry3" etc.

#

im using List#toString() currently but that has [ and ] at the end

#

you could just List#toString().replace("[", "").replace("]", "")

quaint mantle
#

I lied

#

you can do this instead

#

also fair

#
List<String> list = Arrays.asList("A", "B", "C");
String delim = ", "; 
String res = String.join(delim, list);```
#

ahhhh

#

thank you, i'll make a method for that or smt

#

no prob

quaint mantle
#
vecY = py;
vecZ = pz-1;

new vector(vecX, vecY, vecZ)```
#

sorry

raw coral
#

lol its fine

#

tysm for helping

quaint mantle
#

no prob

fluid cypress
#

there is no way to add permissions consistently without using a permissions manager plugin, right? what if i want to make a plugin that adds or removes permissions, but being compatible with any permission manager? without having to add as softdepend every existing permission that currently exists and their corresponding apis??

quaint mantle
#

you can use your permissions manager's api

raw coral
#

Did i implement this wrong, arrow.velocity = Vector(p.location.x+1,p.location.y,p.location.z-1)?

fluid cypress
quaint mantle
#

Vector vec = new Vector(p.location.x+1,p.location.y,p.location.z-1);
arrow.setVelocity(vec);

#

wdym

raw coral
quaint mantle
#

what was the error

fluid cypress
#

i know that a plugin can register itself as the permission manager, or something like that, so i think: maybe there is also a way to register a specific method that the spigot api will call when another plugin uses a spigot api method to add or remove a permission?? or something like that
if that doesnt exist, it definitely should

raw coral
#

Excessive velocity set detected: tried to set velocity of entity #37114 to (-108.45421004992656,74.24918707874468,-49.2350891731692).

quaint mantle
#

I think it is actually new Vector(1, 0, -1) @raw coral

#

I'm not too familiar with vectors tbh

raw coral
#

thats in between

#

forward

#

and left

#

i just tried that

#

Anyway

#

z -1

quaint mantle
#

what do you want it to do

raw coral
#

is left

quaint mantle
#

oh you just want left?

raw coral
#

well basically

#

ill draw smth

#

1s

quaint mantle
#

yeah then its Vector(0, 0, -1)

fossil sage
#

If i want multiple minigames going on at once but i only have one server do you think it would be a good idea to use different worlds?

quaint mantle
#

yes, but it also depends on the ram/thread usage of each minigame

raw coral
#

although

quaint mantle
#

it would be more beneficial to do a server/minigame

raw coral
#

^

fossil sage
#

ok thanks

raw coral
#

ok ill dm you the image

#

since i cant

#

send it here

quaint mantle
#

okay

fierce swan
#

I'm using GSON to store my data, and it seems that when I try to save in onDisable it doesn't see some of my classes. I have a function saveAll that saves all the server data, and it's called in two cases: 1) If I run /pk save, or 2) when the server shuts down.
It saves just fine when I run /pk save, however when the server shuts down, this error occurs: ```
[20:07:08] [Server thread/ERROR]: Error occurred while disabling ScovillePlugin v1.0-SNAPSHOT (Is it up to date?)
java.lang.NoClassDefFoundError: net/emily/scovilleplugin/Types/CourseType$1
at net.emily.scovilleplugin.Types.CourseType.toInt(CourseType.java:9) ~[?:?]
at net.emily.scovilleplugin.Misc.SaveHelper.lambda$static$12(SaveHelper.java:90) ~[?:?]
at com.google.gson.internal.bind.TreeTypeAdapter.write(TreeTypeAdapter.java:81) ~[spigot.jar:git-Spigot-596221b-9a1fc1e]
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69) ~[spigot.jar:git-Spigot-596221b-9a1fc1e]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:125) ~[spigot.jar:git-Spigot-596221b-9a1fc1e]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:243) ~[spigot.jar:git-Spigot-596221b-9a1fc1e]
...

#

The code for courseTypeJsonSerializer is:

private static final JsonSerializer<CourseType> courseTypeJsonSerializer = (courseType, type, jsonSerializationContext) -> {
    Gson gson = new Gson();
    System.out.println(courseType);
    return gson.toJsonTree(courseType.toInt());
};
#

The println was for debugging

#

And toInt is defined as:

#
public int toInt() {
  switch (this) {
    case OPEN: return 1;
    case RANKUP: return 2;
    default: return 0;
  }
}
#

The fact that it saves fine on /pk save but doesn't in onDisable makes me think this is a Spigot issue

lost matrix
#

The order at which they are fired is undefined. In this case it depends which listener was registered earlier

fierce swan
#

It's probably just whichever you loaded first in the plugin

#

So like

#
new FooListener()
new BarListener()

FooListener would fire before BarListener

lost matrix
#

If you and the other plugin have the same priority then yours might be called earlier. But this is not guaranteed.

fierce swan
#

Ah, other plugins

lost matrix
fierce swan
#

I think using the shaded version fixed it yeah

#

It's not erroring anymore at least and it's saving properly

lost matrix
#

Interesting. This might suggest that gson is somehow compromised when spigot unloads

fierce swan
#

I haven't seen anyone else with this problem, which leads me to believe it might have been something I did? That being said it was saving just fine and I hadn't changed anything about CourseType when it started erroring

lost matrix
#

Btw why dont you use the ordinal of your enum instad of a custom toInt method?

fierce swan
#

I assumed there was something like that but I guess I just wrote it weirdly into google because I didn't see anything, I'll look into it again, thanks!

manic bison
#

hey does anyone know how to store someone's next message in a string, and ONLY the next one ?

lost matrix
#

Map<UUID, String> ?

#

What is the "next message"? How would you know someones next message?

reef wind
manic bison
#

i want to make it so they click in a gui, and it prompts them to enter something in chat

#

a string

#

then i store this string

#

but it doesnt send message on chat

lost matrix
#

Want to take a look at my utility class for that? Getting a users chat input is quite useful.

manic bison
#

sure i do

lost matrix
#

Hope thats not littering the chat...

#
public class ChatInput implements Listener {

  private static final Map<UUID, Consumer<String>> PROMPTS = new HashMap<>();

  public static void init(final JavaPlugin host) {
    Bukkit.getPluginManager().registerEvents(new ChatInput(), host);
  }

  public static void create(final Player player, final Consumer<String> consumer) {
    PROMPTS.put(player.getUniqueId(), consumer);
  }

  @EventHandler
  public void onChat(final AsyncPlayerChatEvent event) {
    final String msg = event.getMessage();
    final UUID playerID = event.getPlayer().getUniqueId();
    if (PROMPTS.containsKey(playerID)) {
      TaskManager.getInstance().runBukkitSync(() -> PROMPTS.remove(playerID).accept(msg));
      event.setCancelled(true);
    }
  }

  @EventHandler
  public void onQuit(final PlayerQuitEvent event) {
    final UUID playerID = event.getPlayer().getUniqueId();
    if (PROMPTS.containsKey(playerID)) {
      TaskManager.getInstance().runBukkitSync(() -> PROMPTS.remove(playerID));
    }
  }

}
quaint mantle
#

what are the links to show what to change to optomize server?

lost matrix
lost matrix
# manic bison thanks!!!!!

If you want to use it.

In onEnable():

    ChatInput.init(this);

Usage:

    Player player = ...;
    ChatInput.create(player, input -> System.out.println(input));
manic bison
#

i needed the hashmaps methods in it to store

#

thanks for precising

cursive kite
#

I just opened one of my old eclipse projects in intellij and i can't figure out this error, it says java: method does not override or implement a method from a supertype in this part ``` public static class OverridenServerDataSerializer extends ServerPing.ServerData.Serializer{

    @Override
    public ServerData a(JsonElement arg0, Type arg1, JsonDeserializationContext arg2) throws JsonParseException {
        // TODO Auto-generated method stub
        return super.a(arg0, arg1, arg2);
    }
}```
#

The 'Serializer' is the one throwing the error

cursive kite
#

Serializer still says 'Cannot resolve symbol 'Serializer''

reef wind
#

hover over it and see id you need to import something

cursive kite
#

I have it open in my other computer in eclipse and it recognizes it, im confused

reef wind
cursive kite
#

Its asking me to create the class, no import option

#

i cant figure this one out

regal dew
#

If using intellij, try β€œInvalidate caches & restart”

cursive kite
raw coral
#

if a have a location is there a way that i can get if that location is in an entity

quaint mantle
#
private double distanceRelative = 1; // Distance relative to be allowed in blocks

private Entity getEntityAt(Location loc) {
    for (Entity e : loc.getChunk().getEntities()) {
        if (e.getLocation().distance(loc) <= distanceRelative) {
            return e;
        }
    }
    return null;
}

@raw coral try this

#

it loops through each entity, and if the entity's location is smaller than the max distance set, it will return it

young knoll
#

Is that any faster than getNearbyEntities

#

Also chunk borders will cause issues

quaint mantle
fierce swan
#

woops

fierce swan
#

cause it just failed again

barren moon
#

where can I find the implementation of org.bukkit.entity.Entity?

chrome silo
#

I think its prolly CraftEntity

hardy swan
#

rip, even net.minecraft.util got remapped ;-;

#

cant use tuple across versions

barren moon
#

I want to see the code of entity.level.getEntities() I cant find this "level" in CraftEntity

proud basin
#

So this happens whenever a kit is chosen https://imgur.com/a/bNgjDtP and debugging it this is what's causing it ```java
public long getTime(IPlayer iPlayer, String cooldown) {
PlayerData data = playerMap.get(iPlayer.getUuid());
if (data.cooldownMap.get(cooldown) == null) {
data.addCooldown(cooldown, 0L);
}
return data.cooldownMap.get(cooldown);
}

dusk flicker
#

prob CraftWorld

barren moon
# barren moon I want to see the code of entity.level.getEntities() I cant find this "level...

` @Override
public List<org.bukkit.entity.Entity> getNearbyEntities(double x, double y, double z) {
List<Entity> notchEntityList = entity.level.getEntities(entity, entity.getBoundingBox().grow(x, y, z), Predicates.alwaysTrue());
List<org.bukkit.entity.Entity> bukkitEntityList = new java.util.ArrayList<org.bukkit.entity.Entity>(notchEntityList.size());

    for (Entity e : notchEntityList) {
        bukkitEntityList.add(e.getBukkitEntity());
    }
    return bukkitEntityList;
}`

It is in this method. Im trying to figure out how getNearbyEntitise works.

chrome silo
#

import net.minecraft.world.entity.Entity;

#

@barren moon check here

barren moon
#

I cant find class Entity in net.minecraft.world.entity

lost matrix
barren moon
#

yeah

#

1.17 doesnt have that?

lost matrix
#

net.minecraft.world.entity.Entity Thats the full path

#

Thats basically what you want:

    net.minecraft.world.entity.Entity entity = ...;
    entity.getWorld().getEntities(...);
barren moon
#

ok, I will just look at the world.getEntities

lost matrix
#

Tha fk is EntityChangeListener and EntityIndex?

#

What package is that?

barren moon
#

I find it in fabricmc minecraft-1.17.1-mapped-net.fabricmc.yarn-1.17.1+build.14-v2.jar

lost matrix
#

Dont

#

Dont use that for spigot development. It has zero value for your case.

barren moon
#

then what is a correct way to see the net.minecraft?

lost matrix
#

Run BuildTools on your machine. Then everything will be installed in your local maven repository.

dusk flicker
#

?bt

undone axleBOT
barren moon
#

I tried it and get code of craftbukkik, bukkit , but I ran into error and cant find net.minecraft. I will try it again

#

it worked this time. thanks

crimson scarab
#

anybody know how to get enchantment display names

lost matrix
crimson scarab
#

can nms help me

lost matrix
# crimson scarab can nms help me

I mean the actual displayed enchantment depends on the language settings of the client... So its probably not possible to get the name of enchantments on the server side.
You can however use translatable components so the client translates them automatically when he sees the ItemStack.

quaint mantle
#

Why would you want log-villager-deaths set to true?

chrome silo
#

because ur a bastard

#

and u enjoy bastard things

lost matrix
quaint mantle
#

lol

#

hi

#

how doi i make a commmand only work in a specific server

#

on my bungee

#

but with bukkit api on spigot server

lost matrix
#

Huh?

quaint mantle
#

ugh

#

hard 2 explaionm

#

so i want to be able to set specific servers in config

#

for what servers a certain command will work on

#

but i want it to be servers in the bunge config

#

make sense yet?

lost matrix
#

Is this config containing the whitelist on your bungee server?
Where do you register the command?

quaint mantle
#

in spigot server

#

its hard to explaiojn

lost matrix
#

Wait. So the whitelist is in one of your spigot servers?

quaint mantle
#

huh

#

nooo

#

i mean

#

i want to have a command right

#

on a spigot server

#

but i want it to check if the server it gets executed in

#

is a server specified in pluigins config]

lost matrix
#

Ah ok. Then send a plugin message to the bungee server and ask if your server is whitelisted.

quaint mantle
#

gtev

#

i dont want it to be whitelsit

lost matrix
#

You want a list like this:

commands:
  buba:
    allowed:
    - "lobby 1"
    - "lobby 2"
  skills:
    allowed:
    - "rpg 1"
    - "rpg 2"
quaint mantle
#

mhm

lost matrix
#

Thats a whitelist

quaint mantle
#

k

lost matrix
#

Let me see if there is an API way of handling dispatched commands on bungee side.

#

?jd

lost matrix
#

?help

undone axleBOT
#
CafeBabe Help Menu
*Red V3*
**__Admin:__**

selfrole Add or remove a selfrole from yourself.

**__Cleanup:__**

cleanup Base command for deleting messages.

**__Core:__**

embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.

**__Downloader:__**

findcog Find which cog a command comes from.

**__Mod:__**

names Show previous names and nicknames of a member.

**__ModLog:__**

listcases List cases for the specified member.
reason Specify a reason for a modlog case.

**__Permissions:__**

permissions Command permission management tools.

lost matrix
#

?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.

#

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.

lost matrix
# quaint mantle k

Ok so i found a solution.
When your bungee server starts: load the config into a Map<String, Set<String>> where the key is a command and the value is a Set of Strings containing all allowed servers.
Then listen for the ChatEvent on your bungee server. Check if its a command and if its in the map. If its in the map then get the set out of it and check if it contains the
servers name to which the command is being sent to. If its not in the Set then cancel the event.

#

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.

quaint mantle
#

message.channel.send(bot.token)

#

hyi

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.

lost matrix
#

Dont spam the ask command -.-

quaint mantle
lost matrix
#

What do you mean by "custom item"? How do you determine if an item is custom?

quaint mantle
#

?

lost matrix
#
  public void removeCustomItemsFromPlayer(final Player player) {
    final Inventory inventory = player.getInventory();
    for (int index = 0; index < inventory.getSize(); index++) {
      final ItemStack itemStack = inventory.getItem(index);
      if (this.isCustomItem(itemStack)) {
        inventory.setItem(index, null);
      }
    }
  }

  private boolean isCustomItem(final ItemStack itemStack) {
    // Do your custom item check here
  }
outer sorrel
#

is there a way to run certain code when a message in chat is clicked or at least run multiple commands?

lost matrix
#

What? This channel is for development help.

lost matrix
outer sorrel
#

yea, just wondering if there was a better way because I dont want people to just be able to run the command whenever

lost matrix
chrome silo
#

nope its client side

unreal bear
#

Is there an event that is fired when a tree grows? BlockGrowEvent seem promising, but the docs only seem to mention crops

outer sorrel
chrome silo
#

this mentions trees

lost matrix
# outer sorrel :o

You can make the command obscure like /gßej9q54egh95jhug4e89hgj and hidden.
Then you can use a Map<Player, Consumer<Player>> that is accessed by the command.
If nothing is in there then nothing will happen.
You can also expand on that if you want mutliple clickable messages using tokens:
Map<Player, Map<String, Consumer<Player>>>
This way you can use one command for all your click actions with abstracting the whole command layer away from you.

#

Actually i need that in my new library... Let me write a mock up.

outer sorrel
#

:o thanks, ill do that

lost matrix
outer sorrel
#

ooo nice

lost matrix
#

It maybe uses some dependencies you dont have but the general idea is there ^^

unique halo
#

how do i only set the x y and z of a player, and leave their pitch and yaw alone?

quaint mantle
#

A lot of helper methods :3

quaint mantle
unique halo
#

i tried e.teleport, but it would still be really weird when looking around

#

i tried that

#

problem is

#

you only get their angle for that tick

#

and minecrafft makes it so when you look around your angle updates a ton

quaint mantle
#

Store the angle you want to keep them at

unique halo
#

i tried that, want a video of what it looks like, it looks really weird beacsue you keep getting teleported to that angle

quaint mantle
#

It just teleports its back I’m assuming but sure

unique halo
#

heres what it looks like when i try to move around while being frozen

lost matrix
#

You can do a hacky freeze with the jump boost potion iirc

unique halo
#

how do you do it

#

wait

#

actually i think i can just set the players velocity to 0

young knoll
#

I suppose you could just use one command with a single argument

lost matrix
raw coral
# young knoll Is that any faster than getNearbyEntities

Sorry this is a really late reply but since i am dealing with locations the getNearbyEntities() function only works on the Entity class so is their any ways that i could get arround that other then spawning an invisible armorstand?

young knoll
#

Unless you are stuck 5 years in the past

raw coral
#

*method not message

#

im really tired

quaint mantle
#

hey im wondering if its possible to uh.

#

not have that happen

lost matrix
#

Ask the dev of CoreProtect

quaint mantle
#

its a dupe glitch on 1.17, should i just listen for the item drop event, and get teh amount of ItemStack

lost matrix
#

Wut?

quaint mantle
#

ya

#

its a huge dupe glitch on 1.17

#

the mod literally adds a "Dupe" button

#

IDK how it works

#

is this not patched in 1.17.1 πŸ€” pretty sure it is

#

its a 1.17 server

lost matrix
#

Then update

quaint mantle
#

so should i just listen for

lost matrix
#

lul

quaint mantle
#

so should i just listen for the item drop event

#

and get the amount of the e.getItem() they dropped

lost matrix
#

Nope. You should update πŸ˜„
There is literally no drawback to that

quaint mantle
#

you update

high pewter
#

How do other plugin developers reduce their file size so much? For example, just adding mysql-connector-java as a dependency to my plugin increases the file size from just a few kilobytes to 4 megabytes, meanwhile other plugins which support several databases are usually only 1 megabyte

quaint mantle
#

If you have multiple plugins depending on the same thing make some sort of api/library

#

That it depends on, in the end it does not matter all that much

lost matrix
#

There is one jdbc driver provided by spigot. There is also the maven shade plugin minimizer and you can even download dependencies on runtime if you really want to.

high pewter
# lost matrix There is one jdbc driver provided by spigot. There is also the maven shade plugi...

I actually followed Spigot's tutorial for JDBC when setting it up https://www.spigotmc.org/wiki/connecting-to-databases-mysql/ but when I compiled without shading it, I got errors for all of my usages of JDBC being unrecognised
Also, where can I find that minimiser plugin / how do I use it? I tried searching for it but all I can find is the shade plugin itself

#

nvm just read the section on Driver Implementation, I assume that's why haha

crimson scarab
#

i hate to ask for solutions but does anyone know how to launch a non entity projectile

lost matrix
#

minimizing is a function of the maven shade plugin

crimson scarab
#

such as an axe

lost matrix
# crimson scarab such as an axe

There are multiple solutions. If you are on the latest spigot version then you can just launch a snowball and set its texture to the one of an axe.

crimson scarab
#

wait really

#

is nms needed

lost matrix
#
  public void throwAxe(final Player player) {
    final Snowball snowball = player.launchProjectile(Snowball.class);
    snowball.setItem(new ItemStack(Material.IRON_AXE));
    PersistentDataContainer container = snowball.getPersistentDataContainer();
    // You probably want to set some PDC data so you can check for
    // that in the ProjectileHitEvent
  }
high pewter
crimson scarab
#

anybody know why event just isn't reacting

#

Waraxe Class:

#
package me.tapwater.customitems.weapons;

import me.tapwater.customitems.CustomItems;
import me.tapwater.customitems.items.Weapons;
import org.bukkit.Material;
import org.bukkit.entity.Snowball;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;

public class KratosWaraxe implements Listener {

    public void OnUseWaraxe(PlayerInteractEvent event) {
        Weapons weapons = new Weapons();
        System.out.println("a");
        if (CustomItems.Equals(event.getItem(), weapons.KratosWaraxe())) {
            final Snowball snowball = event.getPlayer().launchProjectile(Snowball.class);
            snowball.setItem(new ItemStack(Material.IRON_AXE));
        }
    }
}
lost matrix
#

@EventHandler

crimson scarab
#

damn

#

i stupid

#

anyway to set the orientation of the item

#

so its facing forwards for example

lost matrix
#

Nope. For that you would have to mount the snowball with an ArmorStand, make both invisible and set the head item to an axe.
This requires NMS. Dont forget to clean up the ArmorStand when the Snowball dies

crimson scarab
#

i've never messed with nms so i'll leave that for now

#

could this be achieved by moving an armour stand smoothly using entitymoveevent to check for collisions?

barren moon
#

but how to make an armorstand's head rotate smoothly rather than 20fps?

lost matrix
summer scroll
#

How can I rotate armor stand y rotation (pitch) with nms/packets?

#

I want the y rotation to follow specific player's head rotation.

summer scroll
quaint mantle
#

Hey! How could I allow users to use some specific noteblock blockstates to create a beacon?

lost matrix
quaint mantle
#

yes

#

I was told it's really easy with datapacks

#

And I found some tags in spigot api, but I have no idea how to use them

lost matrix
#

Uhm. Id have to check at what occasion the beacon checks for the Blocks beneath it.

quaint mantle
#

thank you!

lost matrix
# quaint mantle thank you!

Ok after further investigation this sounds like its either impossible or can only be done through some really nasty hacking.
Im pretty sure that this is not done "really easy with datapacks"

quaint mantle
#

Hmm okay :/

#

thank you ❀️

hybrid spoke
#

i am not sure but would it be a solution to send packets to change the block to what you want but in reality the blocks are diamond blocks?

opal juniper
#

they could be any of the correct blocks

#

but yea - packets could work ig

rigid hazel
#
                guild.getGuildLocation().getBlock().setType(Material.GOLD_BLOCK);

                // Sets the blocks manually, because I'm bad in math
                guild.getGuildLocation().add(1, 0, 0).getBlock().setType(Material.GOLD_BLOCK);
                guild.getGuildLocation().add(0, 0, 1).getBlock().setType(Material.GOLD_BLOCK);

                guild.getGuildLocation().subtract(1, 0, 0).getBlock().setType(Material.GOLD_BLOCK);
                guild.getGuildLocation().subtract(0, 0, 1).getBlock().setType(Material.GOLD_BLOCK);

                guild.getGuildLocation().add(1, 0, 1).getBlock().setType(Material.GOLD_BLOCK);
                guild.getGuildLocation().subtract(1, 0, 1).getBlock().setType(Material.GOLD_BLOCK);

                guild.getGuildLocation().subtract(1, 0, 0).add(0, 0, 1).getBlock().setType(Material.GOLD_BLOCK);
                guild.getGuildLocation().subtract(0, 0, 1).add(1, 0, 0).getBlock().setType(Material.GOLD_BLOCK);

                guild.getGuildLocation().add(0, 1, 0).getBlock().setType(Material.BEACON);
#

Why the block don't set correctly?

lost matrix
#

Probably because you dont clone the location.
You should also use a for loop for this. Its the perfect use case.

rigid hazel
#

// Sets the blocks manually, because I'm bad in math

#

πŸ˜…

rigid hazel
#

Like this: guild.getGuildLocation().clone().add?

opal juniper
#

myea

rigid hazel
#

Okay.

opal juniper
#

but use a loop

rigid hazel
#

Okay. I will try. 😫

opal juniper
#

it is not hard math

rigid hazel
#

Yes.

#

I'm just too lazy

lost matrix
# rigid hazel Okay.

You should probably clone the location in your getGuildLocation() method. Dont expose a mutable object like that.

rigid hazel
#

Sorry.

rigid hazel
#
public Location getGuildLocation() {
        return guildLocation.clone();
    }
opal juniper
#

yea

rigid hazel
#

I have to read what clone() does. xD

opal juniper
#

copies it to a new object

#

same data

rigid hazel
#

Ah

opal juniper
#

it literally "clones" it πŸ™ƒ

rigid hazel
#

Thanks.

grim ice
#

is there a nms and packets tutorial out there

manic bison
#

hey, does anyone know how i could make a user input method ? I can't seem to find any and using protocolLib i get error message java.lang.IllegalArgumentException: Cannot find legacy packet 53

worn tundra
#

Input method?

manic bison
#

yes, means someone inputs text (in a sign, chat or anvil) then i retrieve the message in a string

opal juniper
#

Bukkit Conversations API

echo basalt
#

On top of being obfuscated

#

Then using packets with ProtocolLib, decompile NMS's packets and look at the fields

#

Example:

public class PacketPlayOutSomeExample extends Packet<...> {

  private int a;
  private boolean b;

  public PacketPlayOutSomeExample(Entity entity) {
    this.a = entity.getSomeValue();
    this.b = entity.getSomeOtherValue();

    ...
  }

  ...
}
#

You'd do packet.getIntegers().write(0, someInt); instead of writing an entity

#

Because that's how ProtocolLib works

grim ice
#

o

echo basalt
#

As for NMS purely

#

Uhh

#

Just use a decompiler mostly

#

It's not that hard to figure out appropriate names for things

#

Useful stuff is like

#

To make an entity move somewhere, look into EntityInsentient#getNavigation

#

there's a method named a(Location, float);

#

If you decompile it, you can easily figure out it should be called something like moveTo(Location target, float speed);

#

Among other stuff

#

Nowadays nms is mostly deobfuscated with mojang's mappings

#

although you can't really share them

#

There's also SpecialSource which gives you nice names for NMS and changes them at compile time to their original value

opal juniper
#

can i get some help with this, i was doing the top thing:
https://paste.md-5.net/uwibatenux.cpp

but then in the interest of making it thread safe i changed to the bottom and now it doesn't work - anyone know why it doesn't work.

My usecase for it is in a pathfinder

#

so i am getting all the surrounding block "Nodes"

ivory sleet
#

You’re pathfinding async?

opal juniper
#

thats the idea πŸ˜„

#

well - the path is broken up into 50 block Paths

#

which are then chained together

ivory sleet
#

Can you share more code heh

opal juniper
#

squint no stealing lmao

ivory sleet
#

Thing is you have to make some sort of lock mechanism probably which can be somewhat performance taking

#

Send Dm then if you’re afraid of skidders

opal juniper
#

ye il shove it in a paste

grim ice
#

eh honestly

#

if you go around stealing people code go get a life

ivory sleet
#

I steal code all the time

umbral pagoda
#

hi

#

ineed code for 1.8.8 that when player place any thing blocks or fire or water this thing will remove after 5s

grim ice
#

no one will spoonfeed

#

go make it yourself, its simple

#

make a block place event

#

then a scheduler

#

after 100 ticks it gets replaced with air

umbral pagoda
#

@grim ice

#

@EventHandler
public void removeBlock(BlockPlaceEvent event) {
if(event.getBlock() !=null) {
Block block = (Block) event.getBlock();
Bukkit.getScheduler().runTaskLater((Plugin) this, () -> {
block.setType(Material.AIR);
},200L);
}
}

#

but air not found

maiden briar
#

Caused by: java.lang.IllegalStateException: Cannot get plugin for class me.tvhee.bedwars.lib.plugin.SimplePlugin from a static initializer (decompiled version) https://paste.md-5.net/eseficoxuw.java, I don't see any static initializers anywhere?

grim ice
#

also 200 ticks are 10 seconds

#

and why in the world are you doing this in your main class

ivory sleet
maiden briar
#

Ok

#

This is non editable for me

#

I've never had this issue before, and today suddenly I got this error

ivory sleet
#

Yeah so basically

#

It’s trying to get your plugin instance before it’s even created

maiden briar
#

It is since I've added private BedWarsLeaderboard leaderboard

maiden briar
ivory sleet
#

Yeah well

maiden briar
#

Then I need to do (outside) SimplePlugin.getInstance()).leaderboard; and create a getter

ivory sleet
maiden briar
#

Ok

ivory sleet
#

If that’s called statically anywhere in the main plugin class or a super class of the main plugin class then it’s going to fail

maiden briar
#

Ok, thanks

#

Why can't I do Class<? extends BedWarsAPIPlugin & T> clazz as method parameter?

smoky finch
#

How do I add offset to a direction, I have this in a loop

Location loc = player.getLocation();
loc.add(loc.getDirection().multiply(distance))

All this does is obviously move in a straight line, but how can I achieve a zipzag effect relative to the player's direction?
This is the locations I'm getting right now (the dots are location points)

.
.
.
.

I want

  .
.
  .
.
  .
.
maiden briar
echo basalt
#

yeah

maiden briar
#

public static <T extends BedWarsAPIPlugin> T getPlugin(Class<T> clazz)

echo basalt
#

Yeah

echo basalt
#

uhhhh

#

you can zigzag easily

#

by checking remainders

#

if it's odd, go right

#

if not, go left

smoky finch
#

Check remainder of what?

echo basalt
#

Like

#

let's say you want to zigzag 100 times

#
for(int iteration = 0; iteration < 100; iteration++) {
  boolean odd = iteration % 2 == 1;

  if(odd)
    ...
  else
    ...
}
smoky finch
#

Oh yea, I already know that, but how do I actually add the offset?

#

I can't just loc.add(offset, ...)

echo basalt
#

add a constant offset on 1 axis and one alternating offset on the other

smoky finch
#

It can't be constant, because it needs to be relative to the direction.

echo basalt
#

cos, sin multiplied by the offset

smoky finch
#
double offset = 0.5;
Location loc = player.getLocation();
loc.add(loc.getDirection().multiply(distance));
loc.add(Math.cos(offset), 0, Math.sin(offset));

Like this?

#

oh wait what

#

Cos sin of what?

echo basalt
#

the direction

#

yaw / pitch

#

I honestly don't know what you're trying to do

#

other than zigzag

smoky finch
#

This is the locations I'm getting right now (| and / \ are location points)

|
|
|
|
|

I want

\
/
\
/
#

The y won't change.

echo basalt
#

In that case

#
double radians = Math.toRadians(yaw);

double baseX = Math.sin(radians) * offset * iteration;
double baseZ = Math.cos(radians) * offset * iteration;

#

Now

#

You can zigzag the yaw

#

and add baseX to the location

hybrid spoke
#

zigzag

smoky finch
#

hmm hold on

smoky finch
# echo basalt ```java double radians = Math.toRadians(yaw); double baseX = Math.sin(radians) ...
new BukkitRunnable() {
    double distance = 1;
    static final double maxDistance = 10;
    boolean odd;

    @Override
    public void run() {
        double offset = odd ? 0.5 : -0.5;
        odd = !odd;
        double radians = Math.toRadians(location.getYaw());
        double baseX = Math.sin(radians) * offset * distance;
        double baseZ = Math.cos(radians) * offset * distance;

        Location loc = location.clone().add(baseX, 0, baseZ);
        player.getWorld().spawnParticle(Particle.FLAME, loc, 1, 0,0,0,0);
        if (distance++ >= maxDistance) cancel();
    }
}.runTaskTimerAsynchronously(plugin, 0L, 1L);

This is just spawning a straight line from two random directions from the player.

echo basalt
#

Okay

manic bison
# opal juniper Bukkit Conversations API

import org.bukkit.Bukkit;
import org.bukkit.conversations.Conversable;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.FixedSetPrompt;
import org.bukkit.conversations.Prompt;

import fr.pierronus.gcaplugin.GCAPlugin;

public class FirstPrompt extends FixedSetPrompt{
    GCAPlugin plugin;
    public String s;
    
    @Override
    public String getPromptText(ConversationContext arg0) {
        System.out.println("What ?");
        return "What ?";
    }

    @Override
    public Prompt acceptValidatedInput(ConversationContext context, String s) {
        Conversable cpo = context.getForWhom();
        System.out.println("acceptVI");
        if (s.equals("None")) {
            System.out.println("none");
        }
        if (s.equalsIgnoreCase("1")) {
            System.out.println("1");
            cpo.sendRawMessage("1");
        }
        return Prompt.END_OF_CONVERSATION;
    }
}

this is my prompt class and the next code is the line that fires (in another class) :

                    .withLocalEcho(false).buildConversation((Conversable) player).begin();```

problem is, it definitely outputs "What ?" in chat, but no matter what i type it'll still repeat What ?, until i type "depart", even tho i typed that if the sender types 1, sysout 1 and send msg 1
dense goblet
#

@smoky finch pretty sure you can achieve a zigzag function with a combination of mod and abs and an offset

#

Try on desmos

#

y = abs((x % 1) - 0.5)

#

Y is your left/right offset and x is the iteration aka forward offset

#

If you want it to be centred around the line x=0 then just subtract 0.25 at the end

#

To change amplitude multiply all the constants by the amplifier

#

To change the frequency multiply x by the frequency variable

#

So full formula would be:
y = a*(abs((x*f % 1) - 0.5) - 0.25)

grim sage
#

Hey there πŸ‘‹ currently working on a plugin witch involve ender dragon, but as you probably know dragons have a « portal locationΒ Β» attribute witch is the location where they will fly around when they are in circling phase for example. I’m trying to modify this attribute but idk how :/

smoky finch
dense goblet
echo basalt
#

assume all this math is with yaw 0

dense goblet
#

There is no absolute directions

echo basalt
#

then just multiply the result by the cos and sin

dense goblet
#

It comes down to what you use for your axis

smoky finch
#

I'm using x and z, but I can't simply just change one of the axis, because it must be relative to the direction

#

I have to change both axis somehow, that's where I'm stuck

dense goblet
#

Your x is just the iteration, y is your left/right offset

#

So multiply the offset with your local right vector

smoky finch
#

Okay, let's say y = abs((x % 1) - 0.5) y is my offset, how do I actually apply it to the final location?

smoky finch
dense goblet
#

Is your zigzag flat horizontally

smoky finch
#

Yep, no y, just x and z

dense goblet
#

Okay then you can rotate your player's forward vector by 90 degrees around the Y axis

#

That will give you the local right vector

hybrid spoke
#

i hate maths

dense goblet
#

Then your final location is forward * x + right * y

smoky finch
#
new BukkitRunnable() {
    double distance = 1;
    static final double maxDistance = 10;
    boolean odd;

    @Override
    public void run() {

        double offset = Math.PI / 2;
        if (odd = !odd) offset = -offset;
        Vector dir = location.getDirection().rotateAroundY(offset).multiply(distance);

        Location loc = location.clone().add(dir);
        player.getWorld().spawnParticle(Particle.FLAME, loc, 1,0,0,0,0);
        if (distance++ >= maxDistance) cancel();
    }
}.runTaskTimerAsynchronously(plugin, 0L, 3L);

Am I doing this right?

echo basalt
#

if (odd = !odd) offset = -offset; this confuses me but works

ivory sleet
#

x%1 πŸ€”

smoky finch
dense goblet
vagrant galleon
#

Idk what the problem is, but the error says: "Cannot resolve symbol 'getConnection'", But in tutorials all ok.