#help-development

1 messages · Page 208 of 1

rough drift
serene sigil
#

hi, can any 1 plz help... im trying to make it so the compass tracks to the location provided... it doesnt work but the location isnt null

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.

lofty junco
#

hello does anyone know how to teleport a player to a construction like the stronghold

rough drift
#

oh wait nvm

#

but like

#

tf is that code

alpine urchin
#

🤣

rough drift
#

no that's beyond abuse

zealous osprey
grim ice
#

i think

rough drift
#

Not really

grim ice
river oracle
#

she* or he* or they*

#

actually its in their bio

#

she*

#

gottem

echo basalt
#

how would I go about decoding the chunk byte[] buffer on the chunk packets, 1.19?

#

🤔

#

It's just a fuckin byte[] idk how to decode it

#

and modify it

tacit sierra
echo basalt
#

did you register your listener

#

also extends Object does nothing

tacit sierra
#

Ok, how would I do this?

#

I dont know how to regester a listener.

#

How would I do this?

#

Thanks, ill try that.

golden turret
#

Hey guys, I need some help to convert this to an actual code instead of using switch cases

torn shuttle
#

@echo basalt hey I feel like we're no longer in touch and that's sad. So I just wanted to hop on and let you know I am still at work by going to the gym, lifting those heavy weights so I can one day yeet you off the cliff like you deserve.

golden turret
torn shuttle
golden turret
#

nop

echo basalt
torn shuttle
#

was there an ancient mummy curse on the sarcophagus that code was in?

golden turret
#

I just make this code with the help of copilot

torn shuttle
#

huh

#

remind me never to use copilot

echo basalt
#

and then just add the 4 spaces in the middle

#

or whatever

golden turret
#

dont work

#

copilot gave me this too

#

but dont work as I want

echo basalt
#

how come

torn shuttle
maiden briar
#
player.connect(target, (done, error) -> ...

Error is null, but that message is sent. Printing both server's names both print different values
(BUNGEE)

torn shuttle
#

this one doesn't

#

seems pretty clear to me

golden turret
#

what I want vs what it returns

echo basalt
#

don't put the spaces in the alphabet string

sterile token
#

Nice mongo db is trolling

{
  "_id" : ObjectId("6362d4fce9c1d74824b11e14"), 
  "uuid" : BinData(3,"hz5tv5G9ev6A0W4V9LH9sQ=="), 
  "build" : false 
}

IllegalArgumentException: Invalid BSON field name uuid

echo basalt
#

we can just add an "exemption zone" by substringing and adding it back later

golden turret
torn shuttle
#

this just makes me think of people who say that one day AI will write all your code for you and you will just tell it what you want done

torn shuttle
#

wizardly's code

sterile token
#

oh k

golden turret
tacit sierra
#

It worked, but now the code is giving me a "org.bukkit.event.EventException: null" error

#

Oh, how would I avoid this?

torn shuttle
#

I am still in two minds as to whether it is better to pass null or empty

tacit sierra
#

What is a null check? I am very new to java lol

sterile token
torn shuttle
#

I feel like empty is cleaner but sometimes null just makes more sense because empty might signify some kind of logic

sterile token
#

You musnt start coding smth which you havent learnt the lang basics

tacit sierra
#

Ok

sterile token
#

Bson not finding database field

hollow pelican
#

How do I create an array of JSON objects in a file?

#

Example: [ { "property1":"EXAMPLE_TEXT" }, { "property2":"EXAMPLE_TEXT_2" } ]

eternal night
#

using GSON ?

hollow pelican
#

Yes.

eternal night
#

you litearlly just shove a YourType[] into it

hollow pelican
eternal night
#

why would you use the intermediate format xD

#

you loose like, half the functionality of gson

hollow pelican
sterile token
sterile token
eternal night
#

half the heavy lifting gson does for you is converting json into java types

hollow pelican
#

I never knew how to use it properly, It's hard to find the right documentation imo

eternal night
#

if you have to convert your own java type into the intermediate format of JsonObject and JsonArray

#

that is just useless work

hollow pelican
#

It's just strings, dates and longs.

sterile token
#

Master, you can declare you own java object, then use Gson#toJson() and Gson#fromJson()

#

I would like to understand what shit is happening with mongo is not finding any property i have declared

#

👏

hollow pelican
#

I have my own object class already which contains the properties I need but every time I try, it's not putting it in an array properly.

#

But it just replaces the old one with the new data or when I try to append it, it's still not in an array so it then becomes an invalid JSON file.

undone axleBOT
sterile token
#

Let start from the begining, paste your object and code for loading/unloading the file

hollow pelican
#

I haven't got anything that unloads it currently.

#

It's just meant to write to a .json file but I can't get it in an array properly.

frail gale
#

sorry for late reply but on enabling you can load each quest from config then add it to the map.

hollow pelican
sterile token
#

ok

#

That is perfect

hollow pelican
#

Any time I try to append it, it adds it but not in an array so it's then invalid.

sterile token
#

MyObject obj = gson.fromJson(reader, MyObject.class);
Parsing back what you saved into the object

hollow pelican
#

I'm guessing it's a JsonReader that I need?

sterile token
hollow pelican
#

I just got a Malformed JSON Exception.

#

I'm just going to clear the current file and see what it does then.

#

Alright, there we go.

#

I see all 4 of the properties that my object has.

#

Helpful for reading the object itself at least.

topaz cape
#

how do you guys get the server version on 1.17+

#

i used to do the nms way

#

and now there's no such thing as net.minecraft.server.1_17_R1.Classname

hollow pelican
#

Bukkit Version or Minecraft Version?

topaz cape
#

mc

hollow pelican
#

Try Bukkit.getServer().getMinecraftVersion();

topaz cape
#

hmmm ill look into that

hollow pelican
#

It's a string value.

topaz cape
#

what does it return like

#

is there any examples

hollow pelican
#

I've not used it personally but I'd imagine it just returns the version of the game it's on.

topaz cape
#

so prolly 1.17 for example since there is no old nms

#

i see

hollow pelican
#

What do you need the version for?

sterile token
undone axleBOT
hollow pelican
#

Just shows a video.

topaz cape
#

i use it for my disguise API

#

xd

hollow pelican
#

I'd recommend using a switch statement instead of a bunch of else-if statements.

#

Smooth logo btw

topaz cape
#

ty

#

and i considered doing that

#

im just waiting till i find a better way of doing this

mortal hare
#

or just use an enum class

sterile token
#

Also please try avoiding nested if/if-else

mortal hare
#

define your own enum values and provide methods to them

#

it would save a bit of cpu usage

#

because you will not be dealing with string comparisons

#

which are O(N) in the worst case

hollow pelican
#

I still can't get the objects go into a single array.

sterile token
mortal hare
sterile token
#

I remember you used to help me a lot on Skript discord

mortal hare
#

I recently graduated from school and entered an uni

sterile token
#

Oh pretty nice

#

Im swearing with shity mongo haha

mortal hare
#

i have lots of programming problems

#

to do

river oracle
#

Myes

topaz cape
#

it's a 1 time initialization on the java app startup anyways

#

so it doesn't matter as much

mortal hare
#

i just gave you an advice

trim lake
#

Can I detect if player click on GUI (virtual inventory) or on his inventory? event.getInventory().getType() always return chest.

mortal hare
trim lake
#

Yeh, in that event Im getting chest as return

topaz cape
#

im trying to get the version of the Minecraft server just to use X class as a DisguiseProvider

trim lake
#

It should return InventoryType.Player

topaz cape
#

and my old method doesn't work with 1.17 because of obv reasons (nms names removal)

#

and an enum isn't really the key to solve it

trim lake
#

If I click in bottom inv, returns Chest as well

mortal hare
topaz cape
#

i can work with it as it is i need to figure out if the server is 1.17 on startup

#

smh

#

in runtime

mortal hare
#
if (event.getPlayer().getInventory() == event.getView().getBottomInventory()) {}
#

try this

topaz cape
#

yuhhh... i would use Object(s?) .equals

mortal hare
#

i might misnamed some of method names tho

sterile token
#

Indeed

mortal hare
#

arent they the same objects

sterile token
#

if (event.getPlayer().getInventory().equals(event.getView().getBottomInventory())) {}

sterile token
mortal hare
#

wtf

#

why

sterile token
#

"==" doesnt compare memory instance, while "equals" does it

mortal hare
#

== compares hashcodes of an objects

#

if the instances are the same it would return true

sterile token
#

No

#

You are mixed

#

That is only apply with python, java does not apply

mortal hare
#

We can use == operators for reference comparison (address comparison) and . equals() method for content comparison. In simple words, == checks if both objects point to the same memory location whereas . equals() evaluates to the comparison of values in the objects.

#

googled it

#

i've used C/C++ for the past two months so idk

sterile token
# trim lake This works, thanks!

Na dont worry, for more readbility you can do:

if (!event.getPlayer().getInventory().equals(event.getView().getBottomInventory())) return;
// do actions when menu is botton one

hollow pelican
#

Gson is so weird ngl

trim lake
#

I just think, If I will click on bottom inventory, it will return InventoryType.Player but it doesn't.

mortal hare
#

but i kinda liked it while i was developing experimental things

hybrid spoke
hollow pelican
#

I still can't get it to put the objects under 1 array.

mortal hare
#

wait till you see this

#

size_t j = ((k%3)%2)*((n-1+i*n)%(size+1))+((k%3)/2)*(size-i-1)+(k/3)*((i*n)%size+i/n);

#

this nasty hack allows me to rotate array matrix by 90-360 degrees

#

without if statements 😄

hollow pelican
#

......

#

my eyes.

mortal hare
#

you specify k [0-4] and it will output you the transformed index for specified i index

eternal night
#

ssshhh

#

I thought I was in my terminal

tacit sierra
#

How would I make a for loop that gets each items in the players inventory, and checks for the lore "Anomaly" and deletes the items that do not have the lore "Anomaly"

#

Here is my current code

hollow pelican
#

Check if the items in the player's inventory have the lore tag and if they don't then delete the item.

tacit sierra
mortal hare
#
for (ItemStack item : player.getInventory()) {
  ItemMeta meta = item.getItemMeta();
  for (String line : meta.getLore()) {
    if (line.contains("Anomaly")) {
      item.setAmount(0);
    }
  }
}
#

maybe smth like this

#

i've almost forgot spigot api

tacit sierra
mortal hare
#

wait no

#

this is not righy

tacit sierra
#

ok

mortal hare
#

it would delete anomaly itemstacks

hollow pelican
#

I haven't really used item lore yet but it should be as easy as doing something like:java if(!lore.get(0).equals("ºxºBº2º0º0ºEºDAnomaly")) { item.setAmount(0); }

mortal hare
#

that would work with one line lores

#

but if its multiline it wouldnt

tacit sierra
#

Yea, I am using a multiline lore

hollow pelican
#

True.

sacred mountain
#

anyone know nms raytrace fields without mappings lol

chrome beacon
sacred mountain
#

tryna get collider collisionoption

mortal hare
#
for (ItemStack item : player.getInventory()) {
  ItemMeta meta = item.getItemMeta();
  boolean flag = false;
  for (String line : meta.getLore()) {
    if (line.contains("Anomaly")) {
      flag = true;
      break;
    }
  }
  if (!flag) item.setAmount(0);
}
#

try this

sacred mountain
#

and fluidhandler

hollow pelican
#

Why without mappings though?

undone axleBOT
#

Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.

chrome beacon
mortal hare
#

i did it only once for the past 3-4 months

hollow pelican
#

Surely the mappings would be easier

sacred mountain
#

its like 2 fields idk if i can be bothered

#

lemme see tho

hollow pelican
#

They're pretty easy to set up.

sacred mountain
#

i've never actually used them

#

i learnt a whole section of mojang unmapped 💀

#

my code was looking something like
getHandle.b.a().c.d

mortal hare
#

tbh i've got so used to obf nms, that it was hard for me to adopt since 1.16

#

have spigot api implemented custom biome api yet?

chrome beacon
#

Not that I'm aware of

hollow pelican
#

Here is my old spigot mapping dependency from my pom.xml

chrome beacon
#

You can make a PR

hollow pelican
#
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <classifier>remapped-mojang</classifier>
            <version>1.19.2-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>```
chrome beacon
hollow pelican
#

There are great tutorials for setting it up.

mortal hare
#

man i wish to be embedded developer

sacred mountain
mortal hare
#

i love fighting with computational limits

hollow pelican
#

Here is the tutorial video I used to learn how to set up the mappings: https://www.youtube.com/watch?v=5AVezxCH-oM

In this video, I introduce you to the topic of NMS, which stands for net.minecraft.server and is the vanilla server code for Minecraft. We start from the ground up by introducing the source code of CraftBukkit, Bukkit, NMS, Spigot, and the Spigot API. Using these things and understanding how they work will allow you to start diving into using NM...

▶ Play video
chrome beacon
hollow pelican
#

Make sure you set them up so it's remapped on compilation since you can't legally distribute the Mojang Mappings.

#

I prefer the mojang mappings personally.

mortal hare
#

does any of you know what's the order of arithmetic modulo operator?

#

% one

#

answered myself

#

it has the same place of order as division or multiply operations

frank compass
#

Hello, how do I change a player to op as soon as the plugin starts?

mortal hare
#

((ServerOperator)player).setOp(true);

#

although your request is very suspicious? 🤔

frank compass
mortal hare
#

you even have hecker pfp

#

sus

frank compass
mortal hare
#

it depends what kind of player do you want to make as an operator

frank compass
#

specific*

mortal hare
#

yea i forgot spigot api since i havent wrote anything for it since may

#

no you're good, my mistake

tawdry elbow
#

What to create /commandspy?

frank compass
undone axleBOT
mortal hare
#

research

#

why couldnt you

#

commandspy like plugins are being abused like keyloggers to steal credential data from the players in plain text

#

that's why they do not advise to use that event

#

that's not the problem, some people purposefully set up fake servers and invite people to join and (especially on cracked servers) to register, knowing 99% that the inputted authme password is the same as in any real server

#

or even worse they try to access people sensitive data such as emails if the same pass is used, since player chat input is not encrypted (well it is kinda since 1.19, but server afaik still can see it in plain text)

hybrid spoke
#

i should not?

#

fuck

sterile token
#

How i can put that terminal on the footer?

#

I have clicked on smth and now i can move the terminal everywhere

#

I mean i want to pin the console

dusk flicker
#

ive done that before and now trying to remember how to put it back lol

sterile token
#

Oh thanks cute

#

I have been with that 10m

#

Find it!

dusk flicker
#

i typed int to open intellij and opened internet explorer smh

sterile token
#

But thanks tho

#

you right click over it, view mode and dock pinned

dusk flicker
#

click that

#

to set it back

#

oh lol just saw the message now saying you got it

sterile token
#

Yeah but thanks!

#

its posible to deletea thread?

tawdry elbow
#

Buenos dias

misty current
#

if i want to check if superclass is a superclass or the same class as subclass, and both of those are Class objects, what should I do?

mortal hare
#

maybe object.getClass().getSuperClass() == SuperClass.class for the first check?

#

Returns the Class representing the superclass of the entity (class, interface, primitive type or void)

#

java.lang.Class javadoc

misty current
#

i think i've found it, superclass.isAssignableFrom(subclass)

sterile token
tawdry elbow
sterile token
#

Na its fine

#

I speak spanish tho

#

hahaha

#

I tell because i dont care helping in spanish but it should be via dms

sterile token
#

Spigot rules 🤡

sterile token
#

What are the reasons of mongo, not saving a document?

tawdry elbow
#

Sorry

tawdry elbow
sterile token
#

64

#

That is default mc

sonic goblet
#

What does the add line look like?

#

Is it only default ItemStacks being added to the list?

#

Idk what you're trying to do but if you're looking to count all the nether sprouts just keep a hashmap of material and amounts

#

And loop through your itemstack list

#

:chad_emote:

restive mango
#

How can I edit an entity before a spawn entity packet is generated?

#

World.spawnentity sends out a packet

#

And that’s before I edit the entity

tranquil prairie
#

?paste

undone axleBOT
restive mango
#

@tranquil prairie what do you mean to suggest

#

That I paste some code?

tranquil prairie
#

no i just needed the link

restive mango
#

Oh

#

Well if anyone knows, lemme know

#

I’ve thought about maybe using NMS

#

But god that shit is frustrating

#

I already use it to make the packets themselves

#

It’s fucking horrifying

#

Like digging my fists into my own eyeballs

sonic goblet
#

@restive mango You're just trying to edit an entity before spawning it right?

restive mango
#

Yeah, I’m trying to grab its persistentdatscontainer and add a value to it

#

I have a packet listener which catches outgoing packets and checks if the entity has this persistent value, and if so, deletes the outgoing packet and then sends my own version of that packet

tranquil prairie
#

I asked a spigot mod earlier and he didnt know why either

restive mango
#

In this case, the outgoing packet has the entity replaced with the entity ID from the persistentdatscontainer

#

@sonic goblet

tranquil prairie
#

.

sonic goblet
restive mango
#

Sadly on creation a packet is sent BEFORE I do the editing to its persistentdatscontainer

#

Thanks man

#

Oh wait

#

This spawns the entity though

#

That’s the problem

sonic goblet
#

Oh I see what you're trying to do now

restive mango
#

Yeh

sonic goblet
#

Hmmmm

restive mango
#

My hacky solution right now is to just send an additional packet whenever an entity spawns but like that’s gross and ugly

#

I want something pure

#

Anyway let me know if you have an idea @sonic goblet

#

Someone else mentioned something about a ‘consumer version of the create event’ but I have no idea what that means

sonic goblet
#

I believe they were referring to this

restive mango
#

Ah

#

Nice

#

Sexy

#

I love it

mortal hare
#

in that case you dont need any NMS object to modify packet data before sending it

#

Its a class part of NMS that lets you send raw packet data and construct the packets without instanceiating fake nms classes. You just construct the packet with that constructor which accepts that class

#

I did this before to bypass the strict NMS encapsulation of some fields

#

its very similiar to ProtocolLibs way of manipulating packet data

mortal hare
#

you just use https://wiki.vg/ protocol documentation to construct the packets properly and abracadabra your packets are ready to be sent

dapper sapphire
#

Im using citizens api, they werent able to help much in the citizens support. I've created a trait and I assign it my npc. How do I pass a string to the trait when its assigned so I can use it in its trait functions.

restive mango
#

he mentioned me because im great

boreal python
#

Anyway to make players not take any knockback when a shield they are holding is active? (1.18.2)

tawdry elbow
#

Good morning, I'm new to a question, how do I add permissions to a command in my plugin?

river oracle
#

If Player#hasPermission

#

V easy

#

U welcum

quaint mantle
#

how can you do line breaks in spigot without sending tons of separate blank messages?

#

\n\n\n\n\n\n doesnt work :sadness:

#

does the TextComponent API have anything for this?

#

edit: im gonna test escaping the \

#

brb

#

ok didnt work

#

eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

quaint mantle
#

You can't

#

The best way is

Arrays.stream(message.split("\n")).forEach(player::sendMessage);
#

i actually just worked out a way

#

put characters that mc renders as invisible on each line. spigot compacts lines that dont have content from what i can see. e.g putting \n&e on each line with translated colour codes means it works fine

#

but without content on each line it just compacts it

short gulch
#

Hey- I'm looking for an event that is called when a water source block forms. I've played around with the method described here: https://www.spigotmc.org/threads/detecting-water-source-forming.292697/#post-2812999
However, it is three years old, and the BlockFromToEvent event does not fire for the created source when another source is placed in flowing water.
It's possible that I could make it work with this event if I played around with it for a while, but it would most likely require lots of relative block checks; and that would start to get intensive for a pretty common event.

These also do not fire:

  • BlockFormEvent
  • BlockSpreadEvent

I need to avoid scheduler tasks if possible. Is there a method for detecting this that I could not find, or should I create a PR?

raw prairie
#

@eternal oxide

#

Have you figured out the problem?

eternal oxide
#

I've not looked since you didn't send me your structure

raw prairie
#

No memeory

#

Or

#

Too much to handle for the server

eternal oxide
#

what error?

raw prairie
eternal oxide
#

no clue

raw prairie
#

Why can't we load the chunk with the changes already made

eternal oxide
#

you can

raw prairie
eternal oxide
#

but not until you can successfully copy/paste a structure

raw prairie
#

Or do we have to paste it every 16 blocks

eternal oxide
#

you haven't managed to copy/paste one yet

raw prairie
#

The nbt file

eternal oxide
raw prairie
eternal oxide
#

near enough

raw prairie
#

Try it with bigger nbt files

raw prairie
eternal oxide
#

I did delay the paste by 20 ticks

raw prairie
eternal oxide
#

runTaskLater instead of runTask

raw prairie
#

Performance

raw prairie
eternal oxide
#

it seems slow to update new chunks

#

I'll see if its faster in the worldgen

raw prairie
eternal oxide
#

interesting, no need to set blocks to air for the worldgen

raw prairie
eternal oxide
#

just testing at teh moment. trying to find the optimal way to paste

wet breach
#

It is not optimal for an array to be perfectly even

#

When dealing with more then 1 dimensions

eternal oxide
#

it seems Structure pasting is quite slow

#

slower than worldgen

#

oddly

wet breach
#

Well pasting manually might be the way to go. The optimal way to paste would be to arrange the array at the y value since in terms of pasting commonly there isn't as many y values as there will be x or z

eternal oxide
#

We were looking to use teh Structure API in Bukkit, but it seems slow

#

Structure#place(loc, false, StructureRotation.NONE, Mirror.NONE, 0, 1, new Random());

raw prairie
#

Room?

#

Oh

wet breach
#

Doesn't surprise me as typically vanilla stuff is exposed and left unchanged until a reason to change it

eternal oxide
#

I wonder if using the pallete in worldgen would be faster

raw prairie
wet breach
#

So the code for pasting structures most likely has a bunch of unnecessary calls it makes

raw prairie
#

I am also intending for different random rotations in the structures as well

quaint mantle
#

NMS is the only practical way to create custom worlds now It's sad that Spigot deprecated/removed ChunkGenerator#generateBlockSections..

wet breach
raw prairie
wet breach
#

No

quaint mantle
#

Last time I tried overriding #generateBlockSections caused UnsupportedOperationException

#

(because I didn't override #generateChunkData

wide fern
#

so it seems like java public void onServerStart(PluginDisableEvent event) { ... } is firing twice, same thing with start?

wet breach
quaint mantle
#

I think you have at lesat 2 plugins installed?

#

The event is fired for every plugin

wide fern
#

like 2 files or i registered it 2 times or...?

quaint mantle
#

But your plugin might not receive every PluginDisableEvent because after the plugin is disabled your plugin can't receive PluginDisableEvent anymore

#

2 jar files

wide fern
#

only 1 jar file

quaint mantle
#

Anyway you should check the plugin

public void onServerStop(PluginDisableEvent e) {
  if(e.getPlugin() != this) return;
  ..
}
#

This makes sure the actual code is only processed once

wide fern
#

im still confused how an instance besides the only class I have the disable event called in would be passed to the event

#

but ill try it

raw prairie
#

@eternal oxide can we just stick with what we have

#

I'm planning alot more than this 1 world generator

eternal oxide
#

not really. it is too laggy to generate

raw prairie
#

Well, how do other world generators run so smoothly

#

Like iris world gen

eternal oxide
#

flying around in creative, just placing this one Structure in every chunk causes Moved too quickly errors

#

odd as its only a 16 x 7 x 16 Structure

mighty cipher
#

A way to reset a map After a minigame?

quaint mantle
#

Set world#setAutoSave(false) and unload the world using
Bukkit.unloadWorld(world, false) after teleporting all players to lobby

quaint mantle
quaint mantle
#

I think "this" does not extend JavaPlugin

#

Make sure you pass your plugin main object instead of "this"

mighty cipher
wide fern
#

im just confused now

#

im using this when I'm registering the class

mighty cipher
wide fern
#
public ServerEvents(SaltyBot plugin, TextChannel relayChannel) {
        Bukkit.getPluginManager().registerEvents(this, plugin);
        this.relayChannel = relayChannel;
    }```
#

should I use plugin instead?

quaint mantle
#
public void onServerStop(PluginDisableEvent e) {
  if(e.getPlugin() != plugin) return;
  ..
}
raw prairie
wide fern
#

ok

eternal oxide
#

possibly as that is basically what the Palette is for

#

it a List of BlockState mapped to the BlockVector

quaint mantle
eternal oxide
#

a profiler would do no good as teh "Slow" part is in Bukkit

#

I just need to work out which order teh BlockList is in the Palette to use it

wide fern
quaint mantle
#

because you forgot to add @EventHandler

wide fern
#

ty

eternal oxide
#

?stash

undone axleBOT
raw prairie
eternal oxide
#

doesn;t matter if it's 3d or 1d

#

the only difference is math

raw prairie
eternal oxide
#

its just a List of BlockStates

#

every Block in the Structure

#

However, decoding the order of the List is more work than I really want to do in a project I'm not writing myself.

#

Yeah Structures have Terrible performance when placing

#

The only efficient way would be to use it's Palette in the generateSurface method of the ChunkGenerator. However thats somethign that needs time to pull apart as you need to know the order of the BlockStates in the List

#

Does it store X then Y then Z or some other order

#

Know that and its easy to use the data

wet breach
eternal oxide
#

yes it is, Bukkit only wraps the Mojang code

wet breach
#

Might be worth making a for

#

Pr

eternal oxide
#

I did look at that but without knowing the order I can;t be bothered to experiment

#

oh a Pr

#

Nothing to Pr really

wet breach
#

There is to make it efficient

eternal oxide
#

The Palette is usable IF you know the order of X/Y/Z

#

you can place it directly in teh surface gen

#

but I can;t be bothered to experiment and find what the order of it is in the List

wet breach
#

Well typically mojang stores by y first. Not if that matters fo palette

eternal oxide
#

so Y,X,Z

wet breach
#

Yep

eternal oxide
#

Yeah, it's not hard if thats the case. Just multiply by the BlockVector and pull the relevant BlockState#getBlockData()

#

something like (example) (y * (xSize * zSize)) + (z * xSize) + x

#

to calculate the index

#

again depends on teh order of storage

#

Thats incorrect if Y is first, just an example of the math.

mighty cipher
#

How can load the world after unloading it?

quaint mantle
#

Simply use WorldCreator

quaint mantle
#

Hello I was setting large blocks with Block#setBlockState(); but it lags a
how do you set block(blockstate, type, etc) with 1.19.2 nms? I couldn't find anything realated to 1.19.2.

torn badge
#

How many blocks are you setting?

tall dragon
# quaint mantle Hello I was setting large blocks with Block#setBlockState(); but it lags a how...
    // 1.19.2
    @Override
    public void setBlockSuperFast(Block b, Material material, byte data, boolean applyLightUpdate) {
        WorldServer nmsWorld = ((CraftWorld) b.getWorld()).getHandle();
        Chunk nmsChunk = nmsWorld.d(b.getX() >> 4, b.getZ() >> 4);
        BlockPosition bp = new BlockPosition(b.getX(), b.getY(), b.getZ());

        IBlockData ibd = CraftMagicNumbers.getBlock(material).m();
        ChunkProviderServer chunkProvider = nmsWorld.k();

        //modify blocks
        nmsChunk.a(bp, ibd, false);

        //update lights
        if (applyLightUpdate) {
            LightEngine engine = chunkProvider.a();
            engine.a(bp);
        }

        // send to client?
        chunkProvider.a(bp);
    }
turbid crest
#

Hey 😄 I'm trying to develop on Intellij, and started a new project using the Minecraft extension and selected maven 1.19. The compilation works fine but the problem is that I don't get any import error/suggestion.

#

For example when I write Location location = player.getLocation(); , I don't get any error (only during compilation, not in IDE) and when I hover it with my mouse, there is no import suggestion

#

So I have to manually import everything, and this is quite annoying

#

I also imported spigot.jar in the project dependencies but it doesn't do anything... Any idea ?

tall dragon
#

you have to use maven to add the dependency

#

did you add it in your pom.xml?

turbid crest
#

<repositories> and <dependencies> sections

tall dragon
#

alright. in your project structure should be a map named "external resources" i believe. is spigot in there?

turbid crest
#

Yes sir !

#

But something weird is that my java files are marked 'Java outside of source root'

tall dragon
#

ohhh

#

can you screenshot your project sctrucure for me?

turbid crest
#

Sure !

tall dragon
#

ok.

#

right-click ur "java" folder. almost at the bottom should be a menu named something like "mark directory as", you want to select "sources root"

turbid crest
#

Yay !

#

Thank you so much !

tall dragon
turbid crest
#

Uh

#

My main file is full or errors

#

Oh

#

It can't resolve JavaPlugin

#

Spigot looks like is not imported

tall dragon
tall dragon
# turbid crest Uh

your resources is also not marked as resource root. how did you create your maven project. it should do all these things automatically for you

turbid crest
#

I used the Minecraft Development extension

echo basalt
#

my man added the bootstrap jar as a dependency 💀

turbid crest
#

Here is the pom.xml

echo basalt
#

just run a clean install

#

if it works, it's IDE cache

#

mvn clean install or mvn package

turbid crest
#

Uh

#

I just find out what was wrong

#

It was the spigot jar

#

I just manually runned the build tool

#

And i works

#

Thanks guys !

tall dragon
turbid crest
#

Yep I just did it 😄

quaint mantle
#

Guys, Can I set the displayname of armor stand from placeholderAPI?

echo basalt
#

you want it to display the viewing player's name or something?

quaint mantle
echo basalt
#

You usually gotta pass any player to parse papi text

quaint mantle
#

yeah I was check it

echo basalt
#

as well... the placeholders apply to the player

#

You can just get any random one or do some hacky shit to display the player's own values by modifying outbound packets

quaint mantle
echo basalt
#

Bukkit.getOnlinePlayers().iterator().next(); type deal

#

idfk

quaint mantle
#

Yeah

#

I'm just wonder the entity name can be change by placeholder

#

@echo basalt

echo basalt
#

You can set the entity name to anything

#

entity.setCustomName(PlaceholderAPI.setPlaceholders("%player_name%", player)); type deal

#

I don't remember the actual method

quaint mantle
#

Oh

#

thanks

sterile token
#

I mean I want to change the player name and add another lines under it

#

Mainly how does nametagedit

hoary sierra
#

Ok so ive been asking for help for abt 2 days now and alot of ppl did help but theres still 1 issue, im trying to increase pvp dmg by 15% but it doesnt seem to be working

sterile token
#

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

trim lake
#

Im trying to monitor InventoryAction.COLLECT_TO_CURSOR. This should sync gui with specific player inventory. But, If I do this (code), its remove form first slot witch contains that item. Is there way how to monitor slot of GUI where is item removed? Probably I will save the previous content in inventory and check with updated one? Or can I do it other way?

            //TODO
            player.sendMessage(ChatColor.RED + "Need to be done...");
            ItemStack item = new ItemStack(Material.AIR);
            if (event.getCursor() == null) {
                item = new ItemStack(event.getCurrentItem());
            }
            else {
                item = new ItemStack(event.getCursor());
            }                       
            item.setAmount( item.getMaxStackSize() - event.getCursor().getAmount() );
            Thief.thiefs.get(player).getInventory().removeItem(item);
        }```
drowsy helm
#

is this InventoryClickEvent

#

if so just use event.getSlot

trim lake
#

Ye, this will only return clicked slot, but change is on more then oneSlot

echo basalt
sterile token
#

Doesnt lang the sever that tho?

echo basalt
#

you can make it entirely packet based

sterile token
#

Packets cringe

#

Because versioning with spigot is shit

echo basalt
#

no u

sterile token
#

Spigot api is looking line paper shity

hybrid spoke
#

a title system?

sterile token
#

Idk what had happened

hybrid spoke
#

with infinite lines?

sterile token
#

No no

#

Nametags

#

Player nametags but with múltiple lines

hybrid spoke
#

so basically a title

#

or do you mean in width

sterile token
#

Are the same?

drowsy helm
#

can you give an example

trim lake
# drowsy helm what are you trying to do anyway

I'm making a plugin to thief players. I don't want to display the entire looted player's inventory. So I need the items that the player sees to be the same in the clone and in the player's inventory.

On InventoryAction.COLLECT_TO_CURSOR, multiple inventory slots are affected. event.getSlot returns only the clicked slot. That is, I need to find out which slots have been changed.

quasi flint
#

store the inventory before

#

and after

#

compare

#

done

trim lake
#

I think there wil be some othre way. But looks like is not 😄 Problem is, onClickEvent return the inventory before click. So I need send that inventory somewhere or something. Thanks

quasi flint
#

what

#

for storing that inventory a variable / list will do

trim lake
#

If I click in inventory, onClickEvent event.getInventory will return inventory before the click. So I if click on slot 1 and it will contains 64 stone, it will return 64 stone on slot 1. But, after click the slot is empty and I have it in cursor slot.

wet breach
#

inventory has getContents() which returns an itemstack array of the entire inventory

quaint mantle
#

I have BlockData and it requires Block b, Material material(Can be solved with BlockData#getMaterial()), byte data(This is problem), boolean applyLightUpdate

trim lake
quasi flint
#

just clean up. afterwards

mighty pier
#

how do i check if every value in string[] is an integer?

wet breach
#

materialdata has byte you need

trim lake
#

Wouldn't it be better to clean them when closing the inv?

wet breach
#

just be forewarned that MaterialData is deprecated so no guarantees that it will exist in the future but for the time being it should work for your usage

mighty pier
trim lake
#

Gona try, thansk for now.

quaint mantle
quasi flint
wet breach
mighty pier
quaint mantle
quasi flint
#

you cant look at all the values

#

without looping lmao

#

why woulndt u wanna loop there?

tardy delta
#

love it when one line of code fucks up my whole database

quasi flint
#

love to see it

quaint mantle
tall dragon
#

@quaint mantle in most cases you can just input (byte) 0

#

actually it looks like the byte is not even being used in the 1.19 version

unreal sandal
#

Hello, I have a problem and i can't resolve it on google. I managed to set permissions to player but it is still in red in the tab when the player types the command but the command works

#

Someone can help me please ?

mighty pier
#

how do i stop a constructor if the values are invalid?

hazy parrot
#

Throw an exception I guess

mighty pier
#
        String[] xyzS = twoXYZ.split(";");


        for (String s : xyzS) {
            if (!isInteger(s)) throw ;
        }``` i have this
#

if the string isnt the right format

#

what exception would that be>

tall dragon
#

IllegalArgumentException i guess

mighty pier
#

thank

sterile token
#

Frandma

trim lake
# quasi flint yes

I was rly dumb...

    public void onInventoryClick (InventoryClickEvent event) {
        if (!(Thief.thiefedInvs.containsValue(event.getInventory()))) return;
        if (event.getClickedInventory() == null) return;
        if ( !(event.getClickedInventory().getType().equals(InventoryType.CHEST)) ) return;        
        if (event.getAction().equals(InventoryAction.NOTHING)) return;

        Player player = (Player) event.getWhoClicked();
        
        new BukkitRunnable() {
            public void run() {
                updateInventory(player, event.getInventory());
            }
        }.runTaskLater(Main.getPlugin(Main.class), 1);
    }

public void updateInventory (Player player, Inventory inv) {
        Inventory thiefPinv = Thief.thiefs.get(player).getInventory();
        for(int i = 0; i < 36; i++) {
            thiefPinv.setItem(i, inv.getItem(i));            
        }
    }```
Bum done 😄 How simple 😄
sterile token
#

Location is serializable.

getConfig().set("Location", event.getLocation());

Location location = getConfig().getLocation(''Location");

tall dragon
sterile token
#

Config api or not is same shit

#

Hahaha

river oracle
#

Location adds a bunch of unnecessary shit tbh I'd just serialize the minimum necessary

sterile token
#

I mena just dont reivent the wjerl

tall dragon
#

its not reinventing the wheel at all. spigot serialization is just garbage imo

river oracle
#

So x y and z minimum in a easy x,y,z format

sterile token
#

I would just serialize location as World name, x, y, z

tall dragon
#

also to "deserialize" a location and create the location object. its world must be loaded

#

which would be a pain in alot of cases

echo basalt
#

I mean location is fine if you need rotations and all

#

Otherwise I'd rather just store a vector

wet breach
#

just fyi, java objects/classes are serializable themselves as long as they implement serializable 😉

#

in other words you can store a java object itself if you really wanted to and just pull the object back out

eternal night
#

yes, data version

#

basically an attempt at making sure that your data from like, 1.8 is still loadable on 1.19

#

iirc spigot runs the item through the data converter at some point

echo basalt
#

haha conversion layer go brr

#

I remember seeing the world conversion code somewhere nested into NMS

#

they converted between every patch 💀

#

every snapshot had world conversion

#

Well... every snapshot that changed anything

eternal night
#

you mean DFU ?

echo basalt
#

maybe

#

DFU doesn't seem to have like 200 classes indicating version numbers afaict

eternal night
#

I presume that is what you are talking about 😅

echo basalt
#

yeah might've been that

robust sinew
#

for some reason, when this code runs in my PlayerInteractEvent, the game crashes java ItemStack skullStack = event.getItem().clone(); event.getPlayer().getInventory().remove(event.getItem()); event.getPlayer().getInventory().setHelmet(skullStack); event.getPlayer().getWorld().playSound(event.getPlayer(), Sound.ITEM_ARMOR_EQUIP_GENERIC, 1, 1);

#

it crashes with Encountered an unexpected exception java.lang.AssertionError: TRAP

#

does anyone know why this would happen?

pallid oxide
#

full error?

robust sinew
#

oh nvm

#

I found it

#

its something to do with removing the last item in a stack while the event is still running

#

I found some random github issue for some thing explaining it

#

I'm gonna try it now

tardy delta
#

still lookin horrible

hazy parrot
#

You probably want to create second table called locations and make some column in homes like locationid foreign key into locations table

robust sinew
#

ok it worked

#

turns out you have to wait 1 tick before removing the itemstack

tardy delta
#

a table homes and a table locations :/

#

wondering why im not using smth nosql

hazy parrot
#

Yap, cuz location is different entity

#

And it's some kind of pratcice

#

But however are you comfortable tbh

tardy delta
#

kinda weird nobody in highschool or college has ever told me how to create a good table 🤔

#

thats what they call education then

cobalt thorn
#

Hi im having a problem with this code when i type and probably result is empty

Code: https://sourceb.in/AUflyDEPhH
Error:

Caused by: java.lang.NullPointerException
        at it.zerotwo.luna.Manager.Moderation.AIType.AnalyzeChat(AIType.java:34) ~[?:?] // float is the line
        at it.zerotwo.luna.Listener.Chat.onChat(Chat.java:28) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_282]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_282]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_282]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_282]
tardy delta
#

AIType.java:34

#

check that line

cobalt thorn
tardy delta
#

uh one of those things is null?

robust sinew
#

how do I set an armor stand to not equip armor if you right click it with armor?

#

because currently you can right click it to swap a leather helmet for example with the player skull I put on it

tardy delta
#

cancel interact event

#

or even interact at entity event

robust sinew
#

that's what I was thinking

cobalt thorn
tardy delta
#

just do a nullcheck on those things?

cobalt thorn
hazy parrot
#

Yeah, because float can't be null

robust sinew
tardy delta
#

is this the line: float result = Luna.pAPI.analyze(text).getAttributeScore(AttributeType.TOXICITY).getSummaryScore().getValue();

tardy delta
#

one of those chained things is null

cobalt thorn
#

probably getValue()?

tardy delta
#

i dunno

hazy parrot
#

Get value is probably only one that can't be null

cobalt thorn
hazy parrot
#

As fourteenbrush said, one of those chained things is null

vocal cloud
#

This is why you should multiline a statement. The stacktrace should tell you your error

sterile token
#

Agree

hybrid spoke
#
float result = Luna
                  .pAPI
                  .analyze(text)
                  .getAttributeScore(AttributeType.TOXICITY)
                  .getSummaryScore()
                  .getValue();

dankfingers

vocal cloud
#

ah perspective API. What a masterpiece

tardy delta
#

i thought i was looking at an itembuilder for a sec

zealous osprey
#

I thought it was for getting a custom attribute from a player

keen basin
#

Does anyone know how I can sort the players in the Tablist by ranks (using LuckPerms)

tall dragon
#

what would one call a class that serializes/deserializes an object PES_Think

tardy delta
#

they call it a TypeAdapter in gson

#

i called mine a context resolver

tall dragon
#

context resolver huh

tardy delta
#

idk sounded fancy

eternal night
#

Lool

tall dragon
#

it would be a class that deserializes / serializes my player wrapper class and it would be versioned. so i can still deserialize older versions and update them

tardy delta
#

VersionedPlayerWrapperTypeAdapter 🤡

wet breach
#

just call it postliminary

grizzled oasis
#

Hi question how i can make an external "library" for comunicate to my plugin and create an API

tardy delta
#

i believe we should all make a essentials 2.0 or smth together lol

wet breach
#

yeah I want to

#

I think that is one of the things I will do this weekend

golden turret
vocal cloud
golden turret
#

I tried

#

nothing helpful

vocal cloud
#

Have you tried decreasing the button width to 90%?

golden turret
#

I dont think thats the problem because I have the same issue with another project

vocal cloud
#

The issue here is you're not respecting your margins

golden turret
#

can you explain please

vocal cloud
#

1s let me make a video because I'm too lazy to type

golden turret
#

alright

#

thanks

vocal cloud
golden turret
#

I would never see that

vocal cloud
#

yw. Use inspect element more.

golden turret
#

I used but I didn't realise that

#

actually, I didn't even know what the colors meant

vocal cloud
#

The colors each represent specific formatting types.

#

I don't know them either but I get the gist of it

warm token
#

Hi, does anyone know how to change the skin of the head of a player, the one you see next to the player name on tab?

analog fractal
#

How can I become better at kotlin/java minecraft-development?

#

Any tips anyone?

sterile token
#

Learn first the lang

#

I would recommend first learning about java works or Kotlin depending which you select to code

sterile token
#

Then learn any dependency manager like Maven or Gradke

analog fractal
#

but the minecraft part is a bit differ

sterile token
#

And finally learn how to use the spigot api

analog fractal
#

I learned Maven

analog fractal
#

A guy told me paper is faster for localhosts

sterile token
#

Oh paper 🤢

analog fractal
sterile token
analog fractal
#

nvm actually you can

sterile token
#

If you want to perdist your message create a Thread

analog fractal
#

using a custom command

sterile token
#

Money

analog fractal
sterile token
#

Let talk back we were

analog fractal
#

Ok

sterile token
#

So you al read learned java and maven right?

analog fractal
#

Yes

#

I just wanna know the minecraft-dev part

sterile token
#

I would recommend reading spigot tutorial about Basic things line plugin.yml, commands, events, event listening

analog fractal
#

and others things are left

sterile token
#

Ok

analog fractal
#

I'll learn them

#

Thanks for the help !

sterile token
#

I mainly learnt spigot api by using it

#

Your welcome

analog fractal
#

Mhm

sterile token
#

I also learnt from a udeny tutorial

analog fractal
#

Alr I'll try /fly, /nick and little commands on it

sterile token
#

Udemy*

#

There is a course for minecraft development on Udemy

analog fractal
sterile token
#

The problem is that is not free

#

But let me look for it

analog fractal
#

Yea np

#

Ty for the help man

slow oyster
#

I'm away from my desktop atm so I'm on my Macbook trying to do some Spigot patches but ./applyPatches.sh seems to have some issues on macOS for me? It's giving me this, anyone seen it before? Jamess-MacBook-Air:craftbukkit james$ ./applyPatches.sh ../../Documents/BuildTools/work/decompile-latest find: -printf: unknown primary or operator

#

Happens in both a zsh and bash shell

sterile token
sterile token
slow oyster
#

uhh no it's not a server question, it's a Spigot development question

sterile token
#

Oh ok

#

What is the problem?

#

Are u trying to runa sever?

slow oyster
#

No no, I'm making some commits to CraftBukkit

sterile token
#

Hmn no idea sorry

#

For git just run:

git add . - For adding files into the local repo

git commit -m "message here" - Making a commit

git push - For uploading commits into remote repo

slow oyster
#

It's okay, it's not to do with that

sterile token
#

So?

#

🤔

slow oyster
#

@worldly ingot have you ever tried applying CB patches under macOS? I had to change the script to use gfind instead of find and then it worked

sterile token
#

Also take care we give support to paper

sterile token
#

Please read the rules first

slow oyster
#

Bro relax, I'm leaving him a message to see when he logs on.

sterile token
#

You mustnt do that

#

Must be pacient like everyone here

#

😡

remote swallow
#

im pretty sure tagging staff for that is reasonable

sterile token
#

I mean depends for what

#

Not for asking for coding support

#

I dont know why this society is really anxious and doesnt like waiting patientlly

hot panther
#

Hello, maybe someone can help me here:
I need the ItemStack from the destination of the InventoryMoveEvent.
How do I get this?

lilac cobalt
#
"http://maven.apache.org/POM/4.0.0":mailingLists, "http://maven.apache.org/POM/4.0.0":developers, "http://maven.apache.org/POM/4.0.0":contributors, "http://maven.apache.org/POM/4.0.0":licenses, "http://maven.apache.org/POM/4.0.0":scm, "http://maven.apache.org/POM/4.0.0":organization, "http://maven.apache.org/POM/4.0.0":profiles, "http://maven.apache.org/POM/4.0.0":modules, "http://maven.apache.org/POM/4.0.0":pluginRepositories, "http://maven.apache.org/POM/4.0.0":reports, "http://maven.apache.org/POM/4.0.0":reporting, 
"http://maven.apache.org/POM/4.0.0":dependencyManagement, "http://maven.apache.org/POM/4.0.0":distributionManagement}' is expected.```
remote swallow
#

?paste your pom

undone axleBOT
lilac cobalt
warm light
#

'isCancelled()' is deprecated. so how can I check if event is cancelled?

wide fern
#

so when I went to update my 1.18.2 plugin to 1.19.2, I'm not entirely sure what I did, but the org.bukkit library doesn't seem to exist anymore if im reading the errors right, anyone know if i can just download it somewhere and import it or if theres a proper maven section to add so it can be found?

crude tapir
#

Hey guys im pretty new to spigot coding and i wanna get some practice, but im out of ideas. Would be cool if u tell me some ideas for plugins or general practices that i could do 🙂

warm light
river oracle
crude tapir
#

depends just tell me some ideas

wide fern
river oracle
#

Make a plugin that does something cool

crude tapir
#

lmao

crimson terrace
river oracle
wide fern
#

ok

warm light
crimson terrace
#

I found this in the PlayerInteractEvent

#

not sure if any other events have this

warm light
#

Al event have this. but isCancelled() is deprecated

crimson terrace
#

there should be a reason for it

#

look at its jdoc

#

there may be tips on what to do instead of the isCancelled() method?

warm light
#

umm, got it

#

so I should just check useInteractedBlock() != null as I am working with block. right?

crimson terrace
#

not sure what the workaround is but isCancelled() is set by other plugins so a null check wont do you too well

tardy delta
tardy delta
#

copilot weird

random helm
#

Hey everyone, I'm trying to use the api of CoreProtect for rollback, but it doesn't really work. This is my code. I made a minigame. The variable Time is the number of seconds ago to rollback to. From lookup.size() I get 0

        Bukkit.getLogger().info("Time is " + time);
        List<String> playerNames = new ArrayList<>();

        for(Player player : playerList){
            playerNames.add(player.getName());
            Bukkit.getLogger().info(player.getName());
        }

        List<String[]> lookup = coreProtect.performRollback(time, playerNames, null, null, null, null, 0, null);
        if (lookup == null){
            Bukkit.getLogger().info("Lookup is null");
        }
        Bukkit.getLogger().info("blocks: " + String.valueOf(lookup.size()));```
Can anyone help me?
vocal cloud
#

If you're doing a minigame wouldn't saving the state yourself and "rolling back" by just loading the data you've saved be more efficient than using a 3rd party library?

tardy delta
#

does anyone know why acf doesnt recognize the kPlayer as a context resolver, do i need to annotate it or smth?

#

seemed to work for other commands but it decided to fuck up 🥲

#

oh well its called a command context actually

random helm
random helm
#

All my arenas are in the same world

vocal cloud
random helm
#

Oke, thanks

tardy delta
#

ok final thing

torn shuttle
#

man I just wasted 3 hours being gaslit by my past self

#

I need to stop being so specific with my method calls

#

I almost always use super when calling methods from something I extend, trolled myself because now something that gets extended below under that class wasn't able to adequately override method calls

crimson terrace
mighty pier
#

if i make a bukkitrunnable in a constructor, will it be stopped when the object is deleted?

eternal oxide
#

no

mighty pier
#

cum momento

torn shuttle
mighty pier
#

uh

#

if an object isnt stored anywhere

#

then

#

it is not there yes?

#

garbage colector

torn shuttle
#

if it's not referenced then it's flagged for removal

eternal oxide
#

The runnable is it's own object, it's reference is held by the Scheduler

torn shuttle
#

whether it truly is there or not is hard to guess

mighty pier
#

ok so

#

i have arena object yes

#

it contains seconds

#

and every seconds

#

wait

#

scratch\

torn shuttle
#

he did it guys

#

he contained time itself

mighty pier
#
public class Arena {

    private String name;
    private Cube cube;
    private Material material;
    private int seconds;

    public Arena(String name, Cube cube, Material material, int seconds) {
        this.name = name;
        this.cube = cube;
        this.material = material;
        this.seconds = seconds;
        ArenaManager.addArena(this);
    }

    public String getName() {
        return name;
    }

    public Cube getCube() {
        return cube;
    }

    public Material getMaterial() {
        return material;
    }

    public int getSeconds() {
        return seconds;
    }
}```
#

this

#

every seconds

torn shuttle
#

you should bottle it up and sell it

mighty pier
#

haha

#

fnny joke

#

the cube\

#

which is x1, x2....

#

gets filled with material

#

how do i do that

#

thanks

#

every seconds ^

eternal oxide
#

a runnable

mighty pier
#

when i delete the arena

#

remove it

#

yes

torn shuttle
eternal oxide
#

I want my seconds back

mighty pier
#

haha

torn shuttle
#

too bad, I stole them and I ain't giving them back

eternal oxide
#

How many arenas will you have at a time?

mighty pier
#

however many i feel like

#

idk

#

it will be created with commands

#

wow

#

incredivble

eternal oxide
#

use a single runnable that iterates over your arenas and does whatever is required

mighty pier
#

what if different sekunde

eternal oxide
#

each arena will be different

#

put new arena in a Map, runnable iterates over teh map every second and does whatever that arena needs

mighty pier
#

why map

#

why not list

eternal oxide
#

its a tick method

#

you cna use a List

#

however you want to store it

#

a Queue

crude tapir
#

yo guys 1 question: how to check if an arg is equals any mob?

eternal oxide
#

a Set, Map List.

crude tapir
#

im kinda getting stuck right here oof

mighty pier
#

explain in spoon feeding terms

eternal oxide
#

an arg is a String, how are you wanting to compare that to a Mob?

crude tapir
#

i mean a mobtype or mobname sry

mighty pier
#

dont entities have like a .fromstring

#

mthod

eternal oxide
#

MobType.valueof(arg) or something close

mighty pier
#

exactly

crude tapir
#

ah ty

#

i thought it was sth like that but i couldnt remember

mighty pier
#

you probably have to try catch

eternal oxide
#

EntityType

mighty pier
#

to parse it

eternal oxide
#

um

#

in your arena class add a method called tick()

#

in that method you put whatever logic you want to run every second