#help-development

1 messages · Page 32 of 1

quaint mantle
#

Another one is

#

I mixed

echo basalt
waxen plinth
#

Sure

glossy scroll
#

?workdistro

quaint mantle
#

Im a rust dev not a spigot dev

glossy scroll
#

still down 😅

winter scarab
#

does the Entity.remove method silently kill without particles?

lost matrix
#

Ok so all you need to do is keep a Set<Long> of the modified chunk keys
and then run a second task that relights each chunk after all blocks are set.

noble lantern
#

it should

winter scarab
#

thanks

waxen plinth
#
Bukkit.getScheduler().runTaskTimer(plugin, task -> {
  System.out.println("Hi");
  if (Math.random() < 0.01) {
    task.cancel();
  }
}, 1, 1);```
echo basalt
#

it removes it internally from the server and sends entity destroy packets

waxen plinth
#

@noble lantern

winter scarab
#

so its silent as well?

waxen plinth
#

The only relevant thing here is cancelling the task from within itself

lost matrix
waxen plinth
#

Which can easily be done with the scheduler

glossy scroll
#

ok, got it

echo basalt
#

I've had a deployment where switching from Math.random to ThreadLocalRandom.current increased performance by like 20x

quaint mantle
#

There are so many new people joining and im campin waiting to ban people

waxen plinth
#

Why

glossy scroll
#

but i think an issue here is

waxen plinth
#

Are they new accounts

glossy scroll
#

the lighting engine operates on its own... i dont think i can cancel it?

waxen plinth
#

I didn't know it was that slow

echo basalt
#

so I despise Math.random

waxen plinth
#

Still doesn't matter for this use case though

echo basalt
#

but it was on a concurrent environment

waxen plinth
#

That could be it

quaint mantle
waxen plinth
#

Math.random might be synchronized

waxen plinth
#

It's back up now

lost matrix
echo basalt
#

Math.random uses a static random

glossy scroll
#

hmm

#

let me see if i can make a vid

echo basalt
#

so it kinda is synchronized yeah

glossy scroll
#

gimme a min or two

echo basalt
waxen plinth
#
This method is properly synchronized to allow correct use by more than one thread. However, if many threads need to generate pseudorandom numbers at a great rate, it may reduce contention for each thread to have its own pseudorandom-number generator.```
#

From docs

lost matrix
waxen plinth
#

So yeah that's probably your problem

#

Not Math.random() itself

#

Then you might just need to manually run the steps

lost matrix
#

Did you register the listener?

waxen plinth
#

Set their health to full, teleport them to their spawn point, set their hunger to max, clear potion effects

solemn sorrel
#

Would this glitch if a totem is being used?

waxen plinth
#

(player.getHealth() - finalDamage) <= 0

#

Can also do if (e.getFinalDamage() >= player.getHealth())

lost matrix
#

Whats wrong with using the PlayerDeathEvent here?

#

Checking like this seems unreliable if other plugins modify the damage.

#

And thats a problem because...

waxen plinth
#

Wait

#

Isn't there literally a gamerule for this

solemn sorrel
#

Yeah there is

waxen plinth
#

doImmediateRespawn

#

Just use that

solemn sorrel
#

They said it didn't work for them

waxen plinth
#

What version are they on

#

Should be fine unless some plugin is interfering with it

glossy scroll
#

i should modify my original help message

#

i think had some ?xy

#

my thought process was lighting updates, but in general is that my algo produces lag spikes

lost matrix
#
  @EventHandler
  public void onPlayerDeath(final PlayerDeathEvent event) {
    Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> event.getEntity().spigot().respawn(), 4L);
  }

This works

glossy scroll
#

i dont care if it takes longer, but lag spikes are a problem

#

ive tried makign ti slower and it doesnt seem to make the server smoother (in fact... its worse than just using no work distro)

#

which is why i think its lighting updates but have no reason to confirm that

waxen plinth
#

Use a profiler

#

Find out

glossy scroll
#

oh?

lost matrix
waxen plinth
glossy scroll
#

serverside definitely

lost matrix
#

Timings v2 PES_MmmSip

glossy scroll
#

would timings make sense for this?

waxen plinth
#

Eh, I kinda like spark better

#

But it's up to you

glossy scroll
#

i will look into it

#

let me post this vid first in case any of you have intuition

#

of what may be happening

barren peak
#

This doesn't work, no effects are applied to the potion. If anyone could help me figure out what is wrong that would help. Thanks!

ItemStack fireres = new ItemStack(Material.SPLASH_POTION);
PotionMeta pm = (PotionMeta)fireres.getItemMeta();
pm.setColor(Color.ORANGE);
pm.addCustomEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 10, 0), true);
fireres.setItemMeta(pm);

waxen plinth
#

But you're passing 10 for the duration

#

That's 10 ticks

#

A potion that lasts half a second

barren peak
#

yea that probably is it

#

thanks

#

I thought it was seconds

solemn sorrel
#

How precise is the bukkit scheduler? It seems to be consistently off but I might be timing it wrong

barren peak
solemn sorrel
#

Good enough I guess

lost matrix
solemn sorrel
#

Is there a better alternative for using real-world time? I probably don't need it, but it would be better if its easy to migrate to

solemn sorrel
glossy scroll
#

ok finally

lost matrix
glossy scroll
#

my video

waxen plinth
#

No

#

Because you'll have to wait until the beginning of the next tick

#

And that amount of time won't always be the same

solemn sorrel
#

Oh its just until tick? Thats probably fine then

lost matrix
# glossy scroll my video

I would split the placement of each room into smaller pieces as well.
And Generate bedrock. The void can be quite cpu intensive to work with.

echo basalt
#

oh yeah lighting

solemn sorrel
#

How would I do that then?

waxen plinth
#

Do what

#

Wait until the next tick to run something from another thread?

solemn sorrel
#

Run timers on a seperate thread?

waxen plinth
#

Use an Executor

#

Then you can schedule things in it and use CompletableFutures

#

Which are quite nice

solemn sorrel
#

Will it create a new thread each time?

glossy scroll
#

also about splitting room placement

#

theyre structures

#

like the default mc ones

waxen plinth
#

It literally says in the method

#

newSingleThreadScheduledExecutor

#

SingleThread

lost matrix
solemn sorrel
#

I was wondering if the executor was on a single thread lol

#

Haven't worked with threads much if you cant tell

waxen plinth
#

You should basically never work with Threads directly

solemn sorrel
#

Fair enough

waxen plinth
#

Java has some really nice built-in concurrency mechanisms

#

Like Executors

lost matrix
solemn sorrel
#

Alright. Can you cancel these?

quaint mantle
#

Hello how can I add comments to a bungee cord custom config file

#

From code

waxen plinth
#

Since 1.18.2 I think you can use ConfigurationSection#setComments or something

glossy scroll
#

i mean i could handle block placement on my own... just seems like a huge hassle

quaint mantle
#

Is that for bungee cord

waxen plinth
#

?jd

waxen plinth
#

Nope

lost matrix
glossy scroll
#

i jsut like the ease of filling the structures in the first place

quaint mantle
#

Spigot I already done that a while it more spigot I’m confused about

solemn sorrel
#

Oh does ScheduledExecutorService just have a cancel method?

glossy scroll
#

ive never had good things with fawe

#

always breaks

#

hmmm maybe i could copy paste nms structure code 🙊

glossy scroll
#

and just do the workloads that way

waxen plinth
#

Anything you schedule via the executor service will be a ScheduledFuture

#

Which you can then call cancel on later

solemn sorrel
#

mmm thanks

waxen plinth
#

👍

lost matrix
#

Fur structs of this size we alone would work too.
But start with bigger delays between placements.
Spigot can kind of catch up some longer ticks if it has not much to do otherwise.

waxen plinth
#

I've got a library that specifically has functionality for building structures across multiple ticks

#

It uses its own structure format though

glossy scroll
#

a big reason why i use mc strcutres

#

is that they have PDC

waxen plinth
#

Ah

#

Yeah mine doesn't

#

It only stores what's serialized with the BlockData

glossy scroll
#

(which I added to structures by the waY! that was MY PR!!)

waxen plinth
#

Which is mostly everything but not skull textures, chest contents and the like

solemn sorrel
#

Wait so I make 1 executor and then tell it to run multiple things?

glossy scroll
#

well what does it save it as

waxen plinth
#

A custom format

glossy scroll
#

yea i need a way to serialize some data in there

waxen plinth
#

I've done it before

#

It's not really designed for it though

#

I guess I could always rewrite it...

#

I've already done that several times though lol

glossy scroll
#

like i can do this

#

and have all my roomMap stuff

#

?workdistro

glossy scroll
#

are spigot images borke for other people?

echo basalt
#

yeah they brokey

glossy scroll
#

how many millis do you reckon it takes to place a block

#

or nanos

#

@lost matrix maybe this is a suitable workaround?

#

uses volume to compute time

wise mesa
#

so im a little confused

#

im new to protocollib

#

this thing hasn't been updated in two years

#

does it still work?

echo basalt
#

?tas

undone axleBOT
echo basalt
#

protocollib just wraps nms packets

wise mesa
#

right but are the packetwrappers still valid

#

im just trying to understand how it all works

echo basalt
#

I created a basic tutorial

#

which explains the internals in a basic way

glossy scroll
#

definitely not for later versions

#

actually latest update was for 1.15.2

#

its a very easy pattern

#

all it does is take the decompiled data from MC and make it easier to handle without NMS

#

you could look at the NMS yourself and figure it out too

wise mesa
#

ok

#

that makes more sense

#

@echo basalt ill check out your tutorial

#

i just want to use the vehicle steer packet 😭

glossy scroll
#

that tutorial also doesnt use the mojang mappings

quaint mantle
#

hello, you know when you type a command, you can press tab to complete it for you, for example in the arguments, you can press tab on player names? can we add our own options to it?

glossy scroll
#

which i would recommend

#

also something extremely useful for figuring out packet data:

wise mesa
#

what's the name of that website where you can type in the nms name and it gives you the mojang name

echo basalt
quaint mantle
#

im in 1.19 tho

echo basalt
#

pressing tab (or any character on 1.13+) sends a packet to the server asking for tab complete data

quaint mantle
#

oh so there is an event for it?

wise mesa
#

no

#

its part of when you register your command

quaint mantle
#

to give the player more options other than just player names

wise mesa
#

you register a tab completer too

quaint mantle
#

ah so its called tab completer okay, will look into it

wise mesa
#

i don't really know how it works though i have yet to use it

#

there's also that thing aikar made

#

was the vehicle steer packet moved/replaced

#

or is vehicle move the same as vehicle steer

#

omg did they replace vehicle steer with vehicle move in 1.19????

#

😭 😭 😭 😭

#

does anyone know how vehicle move works

echo basalt
wise mesa
#

and how i can use it to get wsad

echo basalt
#

it has 2 floats

#

one for left-right

#

the other for forward-backward

#

-1 is left, 1 is right

#

-1 is backwards, 1 is forwards iirc

wise mesa
#

this thing right?

echo basalt
#

type thing

#

ye

wise mesa
#

it doesn't exist on latest wiki vg

#

and theres no packetplayinvehiclesteer on that website you sent me

echo basalt
#

PacketPlayInVehicleSteer is the nms obfuscated name

wise mesa
#

i know i switched to the spigot mappings

#

in the drop down

echo basalt
wise mesa
#

ok

#

but that's different

#

its not steer anymore

#

its move now

#

on wiki vg for today there's no vehicle steer packet

#

it's gone

#

there's a different vehicle move packet

echo basalt
#

vehicle move, vehicle steer

#

same shit

wise mesa
#

it isn't the same!!!

#

instead of two input floats it just has a location and a rotation

#

did the vehicle code move from server to client??

#

please i feel like im going insane here

echo basalt
#

?tas

undone axleBOT
echo basalt
#

debug incoming packets

wise mesa
#

😭😭😭

glossy scroll
#

one thing you need to be careful of

wise mesa
#

I don’t know how to do that!!

glossy scroll
#

wiki.vg tells you the serialized packet information

wise mesa
#

I’ve never messed with nms before

glossy scroll
#

NOT the fields in the java file

wise mesa
#

Hm that’s true

glossy scroll
#

you need to physically look at hte decompiled file for yourself

#

the data is then serialized into primitives and etc

#

@lost matrix it takes longer to generate bedrock-floor worlds btw so im not quite sure what you meant

wise mesa
#

Ok I looked at the packets fields

#

They’re different from before when it would give you two floats for steering a vehicle

#

Now the client just gives a new absolute position and rotation of the vehicle

#

I might just be stupid

#

Give me a sec here

#

Alright I’m kinda lost

#

Ok here’s my interpretation

#

There was always a Vehicle Move packet

#

This has always existed

#

There used to be a vehicle steer packet

#

There is no longer a vehicle steer packet

#

I can’t access my computer anymore tonight

#

So someone who has free time and computer access if you would be willing to look into this for me it would be majorly appreciated

ornate patio
#

Bump

wise mesa
#

OH MY GOD

#

They renamed it to Player Input Packet

#

That took you sent me earlier is super helpful

#

Oh this is so great

lost matrix
wise mesa
#

So wait are mojang mappings now recommended over nms mappings?

#

I haven’t been doing spigot since like 1.15 things are a little different now

lost matrix
lost matrix
ornate patio
#

Specifically replace the username with a player’s in-game first and last name

glossy scroll
#

AHA

#

it IS the lighting engine

lost matrix
#

Generate Bedrock as i told you

glossy scroll
#

below or above?

#

i generated it below...

lost matrix
#

If you generate it at top and bottom layer then you should be fine

glossy scroll
#

ok let see here

lost matrix
glossy scroll
#

ok so

#

i need a bedrock layer at -64 and 319

#

which makes the air blocks in between...

ornate patio
#

Also will that effect other aspects of the plugin

#

Like will the result of Bukkit.getOnlinePlayers change so that the players have a new name

glossy scroll
#

went from 50 seconds to 12 seconds

lost matrix
#

Nice

glossy scroll
#

now i need to find a way to decrease the world generation time

#

do you reckon storing a preset bedrock world thing will help?

lost matrix
# ornate patio How so

The tag above a players head is his actual name. If you want to change only the name tag without renaming the player then you need some trickery.

glossy scroll
#

and just load that in whenever i need it?

lost matrix
glossy scroll
#

yea right now it takes around 10 seconds to generate the world

#

and then my portion is between4-6 seconds

wise mesa
#

So just want to confirm that there’s no way to access the vehicle steer without using nms

glossy scroll
wise mesa
#

No vehicle steer event or anything?

glossy scroll
#

now im wondering if any of this volume stuff was necessary...

lost matrix
wise mesa
#

Alright I’ll give them a look

#

Nope neither are really what I want

#

Alright I’ll use the packet then

#

Just wanted to double check

wise mesa
#

Might be something that should become part of the spigot api at some point but idk where to even begin with something like that

carmine nacelle
#

@lost matrix I figured it out btw… storing stuff in nbt data. Only issue now is cancelling that mob from spawning and spawning my custom one instead

#

And carrying over the data

ornate patio
#

not the player’s actual name

rotund pond
carmine nacelle
#

The issue is copying the entity nbt data to the new entity

rotund pond
carmine nacelle
#

That’s pdc

#

Not nbt data

sharp flare
#

are u below 1.14?

#

y not pdc

rotund pond
#

Mh, feeling like you have to use NMS no ?

carmine nacelle
#

Pdc doesn’t persist when a bee enters then exits a hive.

#

But nbt values do

sharp flare
#

don't you have list for the bees that enters?

rotund pond
sharp flare
#

can also store the pdc in a list or map and once it exits you can set it again

#

not sure if thats feasible in your case though

rotund pond
charred blaze
#

@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
event.setCancelled(true);
}

rotund pond
charred blaze
#

why isnt this working?

#

xD

kind hatch
#

Because you can't actually prevent the player from disconnecting.

charred blaze
#

😄

#

Forcing players to play on server

#

XD

rotund pond
charred blaze
solemn sorrel
#

Stacktrace help

charred blaze
#

you can send lot of packets

#

and crash user's pc

#

xD

#

thats illegall maybe

rotund pond
#

Maybe

#

😏

kind hatch
#

Player#sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut);

solemn sorrel
#

You are supposed to put values in the paramaters, not the paramaters

#

Like this

#

Player.sendTitle("Hi", "Hello there", 5, 10, 5);

echo basalt
#

🤦

solemn sorrel
#

np

ripe owl
#

Could not find bungeecord-chat-1.12-SNAPSHOT.jar (net.md-5:bungeecord-chat:1.12-SNAPSHOT:20200123.020804-1).

#

nice error

#

does anyone know this error?

#

i create new project but same error

echo basalt
#

Yeah you a bit outdated

#

bungeecord-chat 1.12 was a loooong time ago

cerulean jasper
#

Hi. Trying to find out easiest way to sum up how many iron ingots player smelts

echo basalt
#

bungeecord generally follows the same version as spigot

cerulean jasper
#

It can be triggered by furnace-take, doesnt matter

#

but... which event should I use?

solemn sorrel
cerulean jasper
#

hmm... like from vanilla? nah, I really want Java/Spigot solution here xD

echo basalt
cerulean jasper
#

ye

#

ooh

#

cool

lost matrix
cerulean jasper
#

yeh I want to make it simple and just use FurnaceExtract then

#

dont care about laser accuracy

echo basalt
#

imagine tracking the player that originally dropped the item

#

that went into a hopper

#

that went into a furnace

cerulean jasper
#

lool

#

its ok

solemn sorrel
echo basalt
#

and if the api just loads it, print the stacktrace and source it to the last player object created

#

perfection

lost matrix
#

Just track down the personal information of the server owner and blackmail him into writing down every smelted ore and giving rewards to the users

echo basalt
#

much simpler

#

we should make an api that blackmails server owners

#

then PR it into essentials or protocollib

kind hatch
echo basalt
#

what if the player puts an item in a dropper

#

and then triggers a redstone signal

#

type thing

charred blaze
#

i have a question in bungee PostLoginEvent
will this e.getPlayer().getAddress().getHostString(); return me IP like 1.1.1.1?

echo basalt
#

?tas

undone axleBOT
echo basalt
#

but it should

charred blaze
#

what the

echo basalt
#

click it

charred blaze
crisp steeple
echo basalt
#

here's the embed version

charred blaze
#

:DDDD

#

lmao

charred blaze
#

i dont want to restart my server 19023821x times

echo basalt
#

bothering us takes our time as well

#

Ideally asking in here should be the last option

charred blaze
#

if you dont want

#

xd

echo basalt
#

Then you'd be wasting your own time

charred blaze
#

:vvv

echo basalt
#
  • Ideally, first you do basic research (if you're looking for a specific event, try your IDE's autocompleter or check javadocs)

  • Then, if it doesn't work, google it ("spigot whatever my problem is")

  • Then, if it doesn't work, check the source code of any project that might have faced a similar problem to yours

  • Then, if it doesn't work, ask us for help

#

And we'll just repeat the same steps

#

and maybe look into nms or the protocol

charred blaze
#

Huh

echo basalt
#

That's my R&D method for developing and it has had a huge success rate over the years

river oracle
echo basalt
#

I just wrote out the standard development technique

river oracle
#

funnily enough thats how I solve other peoples issues on here

#

I look up "spigot insert issue here"

#

and copy paste the thread/answer

echo basalt
#

Except I replace the 4th solution with "dive deep into nms"

quaint mantle
#

hacks

echo basalt
#

Man was suffering with bee PDC loss whenever a bee entered the beehive

#

so I made him override NMS's save method

#

👍

river oracle
#

👍 thats smart

#

ideally we should overrite all nms code and make it better

echo basalt
#

The amount of stuff I learned just by looking at NMS is insane

#

specially after I setup mojmappings after dealing with obfuscated nms for 2 years

river oracle
#

I never touch nms but I do enjoy looking around in it

#

I'm sure I could do more packet fuckery though

#

I've never used a packet before lol

echo basalt
#

I've done lots of packet fuckery and custom mob AI recently

#

I eventually made the pentagram spin

river oracle
#

damn thats cool

echo basalt
#

that was like 150 lines of nms

ornate patio
#

give them a helicopter

river oracle
echo basalt
river oracle
echo basalt
#

It was a commission

#

dude looked at the cows and said "add a pentagram under them"

river oracle
#

lol wtf I wanna know who wants that and why skeletons

echo basalt
river oracle
#

tell them that there tastes in skeleton modifcitions is shit thats nasty why skeletons are terrifying enough with there aimbot already

echo basalt
small current
#

i have a problem with pdc

#

for some reason its not working

#

it won't get applied

#

i sout the item and there is nothing

#

i get it's data and its nothing

#

this channel was active like 1 minute ago

#

why its dead now

lost matrix
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

small current
#

yeah bro so helpful

#

i just said whats not working

#

it won't get applied

#

and if you have 1% of a brain

#

you can understand my goal is to apply something!!!

lost matrix
#

?pdc

lost matrix
#

Thats all you get from me now

small current
#

i done this in another plugin

#

it worked

shadow zinc
#

how do I get the actual capacity of an inventory?

#

not the amount of items

echo basalt
#

getSize

shadow zinc
#

is that actual capacity?

echo basalt
#

It returns the number of slots

shadow zinc
#

okay thanks

#

and how do I get the amount of items in an inventory?

#

is that getcontents?

#

size

lost matrix
shadow zinc
#

yeah im trying to add an auto pagination thing to my util

echo basalt
#

7smile you should go to bed

shadow zinc
#

im adding it to additem

echo basalt
#

I can tell very well we have both been up all night

shadow zinc
#

so the best approach would be to check the size, if it overloads then move the bottom row to a new inventory and get a back and forwards button in the old one

lost matrix
echo basalt
#

girlfriend 👀

#

I thought you were a developer

#

what is this

shadow zinc
#

we haven't touched grass, and definitely not a woman

lost matrix
#

Yes oops. I mean ugah buga im gonna turn out my lights and hack the government.

echo basalt
#

oh okay that seems more reasonable

#

should I get the full 10$ discord nitro to boost the server so I can spam hacker and crazy frog emotes

kind hatch
#

A true hacker would just post the emotes without paying money.

noble lantern
echo basalt
#

I mean it's like 5$ more

#

and I get 100mb video uploads instead of 50mb

noble lantern
#

oh free gets 50mb now

echo basalt
#

I got nitro classic

noble lantern
#

ohhh classic

echo basalt
#

everybody gangsta until the server limits emojis to nitro boosters

kind hatch
#

Free users can get 50mb upload if the server has a enough level.

echo basalt
#

you can get 100mb upload if the server has enough level

#

you can upload 100mb files here

#

that's like the whole shrek movie compressed really hard

#

brb imma go down the street and get some breakfast

#

haven't eaten in 14 hours

noble lantern
#

damn

#

so no modded minecraft z_aCRYYY

shadow zinc
#

any way to get the size of inventory without it being in an event?

#

purely just with the Inventory

noble lantern
#

getContents().size returns the amount of slots an entire inventory has

#

wait

kind hatch
#

I thought Inventory#getSize() was a thing?

noble lantern
#

no it doesnt

#

^

#

its that one

#

getContents().size is amount of slots that have items in them

shadow zinc
#

?paste

undone axleBOT
noble lantern
#

yep

shadow zinc
#

wait im dyslexic

noble lantern
#

getSize

shadow zinc
#

i meant title

#

idk why I asked size

noble lantern
#

uhm

kind hatch
#

InventoryView

shadow zinc
#

how do I get inventoryview?

noble lantern
#

Inventory#getView#getTitle

shadow zinc
#

okay

noble lantern
#

i just fat fingered that method so hard lol

kind hatch
#

You can no longer get the inventory title from the normal Inventory object.

noble lantern
#

oh

shadow zinc
#

getview doesnt exist

noble lantern
#

Ohhh

#

getView is a event thing

kind hatch
#

It does under the InventoryClickEvent

shadow zinc
#

i cant rely on an event for this

noble lantern
#

yeah in that case you need an object that holds the Inventory + its name

#

eg like a InventoryWrapper

#

ffs i cant type

#

sec

kind hatch
#

Also, I have a feeling, but don't compare inventory titles. Compare the instances themselves.

shadow zinc
noble lantern
#

i got an example

#

Why do you need the inv name at all in that code?

shadow zinc
#

umm

#

because new page

#

needs old title

noble lantern
#

ah so thats what its doing

shadow zinc
#

is the code alright?

kind hatch
#

Do you not have a variable that you can modify?
Smth like

String inventoryName = "Page %pageNum%";

public void test() {
  int page = 1;
  Inventory inv = Bukkit.createInventory(null, 9 * 6, inventoryName.replace("pageNum", page));
}
noble lantern
shadow zinc
#

I created that

#

ffs I hate an error and now jitpack is having a spaz attack

noble lantern
#

I test libs like this locally ngl

A lot easier

#

too much of a pain to change code, commit, make tag for github and wait for its slow build servers to build my jar

shadow zinc
#

Ik, i forgot to do that

noble lantern
#

you can install it into your .m2 directory

#

much simpler

shadow zinc
#

no idea how to do that

#

especially on linux

viral temple
#

Does anyone know if plugin.getLogger() is thread safe?

#

I think it should be, but knowing the complexity of log4j I'm not sure

abstract sleet
#

I'm also interested in this answer ^^

small current
#

is there anyway to listen if i place a block (its this red wool for example)
get the 5 block infront of it depending on player's yaw ? (like the blue one is)

abstract sleet
#

there are possibly multiple ways to go about this. one way is to get the placed block, depending on the player's yaw, get the block beside it on that direction ("relative to" it might be called?) and do that 4 times

echo basalt
#

getTargetBlockExact

#

No need to overcomplicate

abstract sleet
#

they're not looking for the target block

#

block place event, get block?..

eternal oxide
#

You are looking for a simple direction

#

in blockPlace java Vector direction = event.getPlayer().getDirection(); direction.setPitch(90); Block target = event.getBlock().getLocation().add(direction.multiply(5)).getBlock();

#

it may be a pitch of 0 I forget

echo basalt
#

Wouldn't pitch be 0

#

90 makes it look up

eternal oxide
#

yeah its early 😉

cunning canopy
kind hatch
#

?paste for the love of god

undone axleBOT
eternal oxide
#

I think you need more whitespace

echo basalt
#

Idk who's more fucked up atm

#

Anyways a simple way I think of pitch

#

Is by thinking on a piano's pitch knob

#

It defaults at 0, increasing it will look up

kind hatch
#

Isn't pitch your left to right? And then yaw is your up and down?

deft mesa
eternal oxide
#

pitch is up/down

echo basalt
#

And descreasing it will look down

eternal oxide
#

yaw is turning

kind hatch
#

Oh, then 90 pitch would make you look straight down.

echo basalt
#

It will point up

#

-90 is down

kind hatch
echo basalt
#

There's also roll but we don't mention it

#

Think of roll as leaning your neck to the side

#

Attempting to crack it

cunning canopy
#

does the restart script run with sudo permissions?

kind hatch
echo basalt
#

Running java with sudo perms can be dangerous sometimes but it's your fault

kind hatch
echo basalt
#

Then it's -90

#

Yet another case of tryitandsee working

kind hatch
#

But I have. You are telling me it's wrong even though it's not. -.-

echo basalt
#

If your client says -90 then it's -90

#

Not arguing, just stating the obvious

#

Minecraft is weird sometimes

eternal oxide
thick scarab
#

Which event is called when player uses Destroy item in creative inventory?

eternal oxide
#

probably none

#

Creative is almost completely client side

rotund pond
#

Then depends on slot

young knoll
#

Nah the destroy item button is fully client side

mental nymph
#

how to change world time from a thread? Exception in thread "Thread-110" java.lang.IllegalStateException: TimeSkipEvent may only be triggered synchronously.

eternal oxide
#

Bukkit.runTask

mental nymph
eternal oxide
#

?svheduling

#

?scheduling

undone axleBOT
mental nymph
#

thanks

opal juniper
#

Bukkit.runTask(Runnable, PLUGIN_INSTANCE)

#

schedules it for the next tick

mental nymph
#

how to now make pauses like sleep()?

eternal oxide
#

you don;t

#

you delay with runTaskLater etc

knotty meteor
#

How can i get a player from tab without vanishing him?

eternal oxide
#

only options are hidePlayer or send a packet to all players

cunning canopy
#
HashMap<Integer, Sheep> sheepTable = new HashMap<>();
for (Integer i = 0; i<5; i++) {
  Sheep s = (Sheep) Sheepstack.this.world.spawnEntity(p.getLocation(), EntityType.SHEEP);
  s.setGravity(false);
  s.setAI(false);
  s.setSilent(true);
  s.setColor(Sheepstack.this.playerDyeColors.get(p.getUniqueId()));
  sheepTable.put(i, s);
}
Sheepstack.this.playersSheep.put(p.getUniqueId(), sheepTable);
#

Sheepstack.this.playersSheep.get(UUID) will now point to the same memory location initialized on the first line right

eternal oxide
#

sheepTable and playersSheep are not the same object

vivid cave
#

Why would I use BlockVector instead of Vector?

#

reading the docs, it says it floors the coordinates

#

so its just less precise?

#

or does it have advantages

eternal oxide
#

BlockVector is a Block representation

#

it minimalistic but it does have use cases

vivid cave
eternal oxide
#

I believe schmatics use them?

cunning canopy
eternal oxide
#

You never showed your playersSheep so I can;t tell

vivid cave
# eternal oxide it minimalistic but it does have use cases

but besides saving memory that uses double/floats over integers I really don't see the point of BlockVector could you give me usecases?
Cuz everything that works with blockvector should work with vector am i wrong? If so do you have an example

cunning canopy
eternal oxide
#

each Sheep is an entity so is unique

#

any Sheep in either Map will be the same Object

cunning canopy
#

thanks

mental nymph
#

yay i made it, async time changing with pauses), every time i need change time, runTask() runs a new TimeSetTask() maybe this genius or im stupid

floral pewter
floral pewter
#

That just sounds like
A: Performance overhead
B: Using an async timer to run a sync timer which then does it

#

Or C: If it’s fully async and if you’re not caught by spigot, thread safety issues

mental nymph
#

this is work and this everything i need

vivid cave
# eternal oxide it minimalistic but it does have use cases

Here's what I'm doing, and I'm struggling to find out whether I should use BlockVector, because at least for the second part of the algorithm the ray needs to be precise.
I have an entity at some coordinates x,y,z. My goal is to find out whether this entity is in the field of view of the player. (I will consider that the player is using the default fov on their client, which is 104.2° horizontal field of view.)
Therefore I determine the angle between two following vectors: the eloc=player.getEyeLocation().getDirection() and the **towardsEntity=Vector(**x-eloc.x, y-eloc.y, z-eloc.z) (which is basically the vector which direction is the line between player and entity)
I then only need to check whether the non oriented angle is less than 104.2/2=52.1°, and i also check that the entity is in the sphere of radius 30 blocks of the player.... Easy...
I then raytrace the towardsEntity vector to make sure there ain't any opaque block in the way
Everything works, BUT MY QUESTION IS: Should I use BlockVector for what's in bold? A part of me says yes cuz technically we are tracing the blocks that are in the way, and the entity itself coordinates is the coordinates of a block with integer coordinates, but at the same time, reading the docs of BlockVector it just states that its like Vector which coordinates are floored, so i feel like i'm losing in precision, and that could be very unfortunate if it considers there is an opaque block in the way whereas it was a neighbor block of the ray that was opaque, u know what i mean

quaint mantle
#

^ no one?

eternal oxide
vivid cave
#

alr^^

#

thx

tender shard
quaint mantle
vivid cave
#

Random question, if ur in 1.19.1, report chat enabled, but a plugin takes care of cancelling every messages, and rebroadcasting (tellraw or whatever, or just player.sendMessage) to everyone the intercepted message, will it still be somehow reportable and readable by mojang/microsoft?

cunning canopy
#

?paste

undone axleBOT
grim ice
#

uh

cunning canopy
#

Somehow the count==0 thing is repeating

grim ice
#

how do i listen to System.out.println calls

#

without System.setOut

vocal cloud
#

Why tho THONK

grim ice
#

im making a forge mod

#

some mod

#

is receiving a socket

#

from a backend

#

then souting it

#

and using it somewhere else

#

i wanna inject my own behaviour to it as wlel

#

so i thought maybe i can just listen to the sout

#

and i cant use setOut cuz it bugs out mixins for some reason

grim ice
vocal cloud
#

Wait you plan to listen to sys out and then run code based on it?

#

that's a bad idea

grim ice
#

then what do i do

#

lol

#

do i just listen for that socket the other mod is listening for

#

too

#

but it's so annoying

vocal cloud
#

Listening to a sys out, especially for a mod, is a terrible idea lol

grim ice
#

then

#

whhat do i do

#

do i just listen for the sockets

vocal cloud
#

Pretty much

grim ice
#

ah fuck

#

there are like

#

4 uris

#

wtf do i do

vocal cloud
#

I'm confused, so you have another mod that uses channels and you want to listen to those channels?

grim ice
#

ye

#

isnt there a way to listen for sys outs without setOut man

cunning canopy
#

I think my taskTimer isnt stopping

#

this.cancel should do the trick right?

vocal cloud
tender shard
cunning canopy
#

isnt int and Integer same thing?

tender shard
#

no

cunning canopy
#

whats the difference?

tender shard
tender shard
#

it's not the cause of your problem, just wanted to mention because using for(Integer i = 0; ...) is weird

tardy delta
#

not using the bukkitscheduler :(

grim ice
#

why is that a problem tho

vocal cloud
#

Because you really shouldn't rely on reading system.out for information. I'm not saying it wouldn't work but especially with forge and the client-server relationship you have to be careful when doing it

tardy delta
#

just use the logger and add a handler to the logger

cunning canopy
tardy delta
#

eventually yhe bukkits logger

cunning canopy
#

Do you know what the cause is?

grim ice
#

i wanna listen for all those ws clients' onTextMessage

#

do i just replicate what theyre doing

grim ice
#

if you are, then no im not using bukkit

tardy delta
#

yes

cunning canopy
vocal cloud
#

Wait it's forge and they're using WS

tardy delta
#

theres no reason to not use an int

vocal cloud
tardy delta
#

?whereami

vocal cloud
#

AND THEY'RE USING SYSTEM.OUT INSTEAD OF A LOGGER

tardy delta
#

14 yo?

vocal cloud
#

Idfk

#

I picked a gif with a keyboard being smashed

grim ice
#

uh

vocal cloud
#

It only showed that

grim ice
#

do i just use a factory to create

#

clients

#

then

vocal cloud
#

Why not just take their mod and make it better first

grim ice
#

register listeners

#

thats for later

#

anyways

#

im not even familiar with sockets

#

so like

tender shard
grim ice
#

im not in any position to fix their shit

#

anyways

tender shard
#

so as long as using "int" throws no errors, use int

grim ice
#

WebSocketFactory factory = new WebSocketFactory();

factory.setVerifyHostname(false);
factory.setSSLContext(NaiveSSLContext.getInstance("TLSv1.2"));
factory.setConnectionTimeout(10*1000);
this.socket = factory.createSocket(uri);
this.socket.addListener(this);

cunning canopy
grim ice
#

this for every uri they use

#

right

tender shard
vocal cloud
#

Okay firstly websockets are a nono

grim ice
#

they use them tho

#

i can do nothing about that

vocal cloud
#

Yeah, you can take their code and make it better

grim ice
#

no

#

i wouldnt know what to do anyways

#

lmao

#

dude thats not the problem here

cunning canopy
#

could the problem have something to do with me referencing the count instead of this.count?

grim ice
#

bruh

noble lantern
#

you can have a class variable called count, and an argument called count

#

if yours is like that, i reccomend just changing the names

#

even with this no need to confuse yourself

cunning canopy
#

I only have one count

#

and its a class variable

noble lantern
#

so count/this.count doesnt really matter then since they both will referance the same thing

#

this is mainly a keyword to help developers out, so they know that the variables is tied to this class

#

but, can also excplicity tell a method body what variable to use at the same time

supple elk
#

Will this return the item used in an interact event, or does that not count as using?

noble lantern
supple elk
#

it's complicated

noble lantern
#

in that case, likely not

#

it would return null on empty hands

#

or items that cant be used

#

like a stick

supple elk
#

kk

sacred mountain
#

where do i download the default log4j2 for 1.19.1 ?

#

xml

cunning canopy
#

aaagh, this is so confusing. I have absolutely no clue why my for loop is repeating itself

tardy delta
#

show code

#

lmfao

noble lantern
cunning canopy
#

you want the whole class?

noble lantern
#

just the for loop for now

vocal cloud
#

?paste it

undone axleBOT
cunning canopy
sacred mountain
#

erm

#

how many times do you want it to repeat tho

#

it will repeat 5 times atm for each loop

cunning canopy
#

its only supposed to spawn 1 sheep tower

#

of 5 sheep

#

in each tower

#

1 tower per player

sacred mountain
#

sheep tower?

#

can u tell me the expected and actual

#

whats happening currently

noble lantern
#

screenshots are a big help

cunning canopy
#

its spawning endless

#

sheep

#

each second

#

shall I send the whole runnable?

noble lantern
#

okay send whole class then

#

your task timer isnt stopping

cunning canopy
#

?paste

undone axleBOT
noble lantern
#

why even use a task timer tho

tardy delta
#

my eyes

noble lantern
#

this should just be something called once

sacred mountain
#

yea

cunning canopy
#

its a countdown

sacred mountain
#

anyways does anyone know where the minecraft files are located

cunning canopy
#

and at 0

#

this is executed

noble lantern
#

or just game files

cunning canopy
sacred mountain
#

for 1.19.1

noble lantern
#

oh have no idea for that

sacred mountain
#

i cant seem to find a gist or anything

noble lantern
#

oh

#

you mean adefault log4j

sacred mountain
#

yea

noble lantern
#

you can just use any

#

it isnt tied to a mc version i think

#

unless theyre doing some fuck shit

sacred mountain
#

hm ok

#

i've seen gists for 1.11, 1.12, 1.14, 1.15.2 and 1.18

#

by random people

#

and the descrption is just 'minecrtaft default log4j2 as of <ver>'

#

so im not even sure

noble lantern
cunning canopy
#

cause I want to spawn sheep at the end of it

sacred mountain
#

the §4 or wahhteerv don't work

#

the § character seems to be completely gone

tardy delta
#

please do Map<>

noble lantern
#

its not canceling the timer

#

so you got a mem leak

#

but, its not the cause

cunning canopy
#

whats a memory leak

#

im new to this low level stuff

sacred mountain
#

oh

noble lantern
#

IE something thats meant to be closed but wasnt and is still running

#

so it takes up system resources

#

and, typically its something that happens over an over

#

so eventually you end up with all these dead processing wasting resources until the server crashes

#

so use this.cancel() then return

cunning canopy
#

isnt that what I did?

noble lantern
#

not that i see unless im blind

cunning canopy
#

Sheepstack.this.gameLoop.runTaskTimer(Sheepstack.this, 0L, 1L);
this.cancel();
return;

#

see at the bottom of run

#

thats just a return guard

tardy delta
#

return guard :/

noble lantern
#

so, why not cancel in the guard

#

thats kind of the point

#

guard clauses should entirely stop the code in that scope

cunning canopy
#

well

#

my idea is that it should handle the counting

#

until the countdown is at zero

#

then the sheep should spawn

noble lantern
#

ah

cunning canopy
#

after the guard

noble lantern
#

i see

cunning canopy
#

I thought it was good practice

noble lantern
#

Thats fine, sorry just hard to read large blocks of code all at once without an idea

cunning canopy
#

Totally get that

noble lantern
#

"Sheepstack is now starting"

How many times is this broadcasted once?

cunning canopy
#

the function is only running once

noble lantern
#

or infinite too

#

kk

cunning canopy
#

I tested it with the statement

#

it only broadcasts when I run the command

grim ice
#

um

cunning canopy
#

so thats not the problem

grim ice
#

does anyone know what do i do

#

i fi wanna listen to System.out

#

.println

#

without System.setOut

noble lantern
#

unless im overlooking something really simple i dont see the issue

#

its all relatively fine to me

cunning canopy
#

Same lol

#

thats why Im so confused

noble lantern
#

try a refactor

cunning canopy
#

of the whole code?

noble lantern
#

just the method

#

split up your glass code and stuff

#

you should really have seperate classes for it

cunning canopy
noble lantern
#

yes that seems to be the method at hand causing issues

cunning canopy
#

like

#

making for better readability?

#

refactoring?

#

or renaming stuff

frosty tinsel
#

Hi does anyone know how to run two tasks in Gradle (Kotlin DSL) in order? So first a jar is built and after its built, its copied to where we want.
This doesn't run the tasks sequentially.

tasks.register<GradleBuild>("buildAndDeploy") {
    dependsOn("shadowJar", "copyToServer")
}
noble lantern
#

yes and shorten code

Whenevr i have an issue i typically refactor and i find my issue that way, basically just restructure the method a few times

Also try i<=5

cunning canopy
noble lantern
#

well, you said its infinitley spawning sheep, so maybe the for loop conditions arent getting met

#

and thus making them inifinite

sacred mountain
noble lantern
#

indeed, im bad at math

tardy delta
#

fixed it

sacred mountain
#

lmfao

noble lantern
#

but, im out of ideas

cunning canopy
#

I can make other methods inside the runnable right?

tardy delta
#

i guess you should just clean your code up and have proper methods for spawning your sheep

noble lantern
#

^

#

splitting code up while sounds daughnting helps debugging overall

vocal cloud
#

Also makes readability so much better

noble lantern
#

you may think having the entire code block in one method is nice, and it is when you first get started but after a while it becomes a headache maintaining a wall of code

sacred mountain
#

is coding without guard clauses, then adding them in afterwards even do anything?

#

i find it easier to read without

#

and then tidying up code afterwards

noble lantern
#

guard clauses are preferantial

#

wether you use explicit or implicit statements doesnt rly matter to much

#

however

#

heres is my evidence

#

as to why you should use guard clauses

#

case closed

sacred mountain
#

my code never looks like that

noble lantern
#

tbf in java it never does

#

thats js callback hell

#

but, java can have callbacks easily and run into same issue

#

especially with lambdas

sacred mountain
#

i've been doing js xmlhttprequests for the past 3 days

#

i hate js

#

arrow syntax => yesyesy

tardy delta
#

whats this supposed to mean?

cunning canopy
#

can I do Map x = new HashMap

tardy delta
#

yes with the generic stuff

proper notch
tardy delta
#

ah and this() must be the first call smh

proper notch
#

So instead of doing this.location = thing, etc.. you call the constructor of the record