#help-development

1 messages Β· Page 833 of 1

smoky oak
#

nope still there

#

its there for completeness

quaint mantle
#

Ya listen to this

smoky oak
#

if someone registers it it needs to be passed through

young knoll
#

Them issue

quaint mantle
#

what needs to be passed through

smoky oak
#

u might recall the code elgar sent me

#

im making an interface between event handlers and the actual events to do some specific tasks easier

slate tinsel
#

But should I check if it has the right PDC and just run cancel on the damage event?

eternal oxide
#

yes

quaint mantle
#

@smoky oak

#

Deprecation

#

Should do it

smoky oak
#

neither Deprecated nor Deprecation works

#

its lowercase deprecation

#

tf

quaint mantle
#

Idk then

#

And it's upper camel for ConstantConditions

smoky oak
#

well maybe some are on lowercase

slate tinsel
#

I had intended to make it so that the player does not take damage when it falls to the ground. Is it kind of easiest to do so that the player does not take any damage before the player has touched the ground and if the server closes etc. you just teleport the player back to the place the player started.

The context of this is in a gadget

smoky oak
#

er wtf
just cancel fall damage

slate tinsel
#

The player should be able to take fall damage but not from this gadget

pseudo hazel
#

wdym by from the gadget

#

and what is a gadget

half arrow
#

can anyone advise the best hologram library for 1.20?

pseudo hazel
#

I have used decentholograms

#

but now I am just making my own

half arrow
#

why? its for development

#

use case my plugin, i need to spawn holo's above items

echo basalt
#

What would the ideal packet abstraction look like thinking

#

Where I can send requests and get responses

slender elbow
#

a socket

hushed spindle
#

it just adds a dependency

#

so if you dont want that you'll need to look into packets and spawning fake armor stands or display entities

#

whats the reason i cant make my own implementations of RecipeChoice? i would like to be able to use customized ingredients without having to write an independent listener for crafting

#

is this still illegal or just like a relic of the past

remote swallow
#

recipe choice has an item stack value iirc

raw epoch
#

Hello, i'm trying to intercept a BossBar packet with protocolLib (to insert TextComponent instead of a basic String) but the ChatComponent is empty when i try it πŸ€·β€β™‚οΈ

If anyone can help me ! πŸ™

ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(
        this,
        ListenerPriority.NORMAL,
        PacketType.Play.Server.BOSS
) {
    @Override
    public void onPacketSending(PacketEvent event) {
        PacketContainer packet = event.getPacket();
        //System.out.println(packet.getChatComponents().toString());
        WrappedChatComponent baseWrap = packet.getChatComponents().read(0);
        if (baseWrap != null && !Strings.isNullOrEmpty(baseWrap.getJson())) {
            String firstPass = ChatColor.stripColor(TextComponent.toLegacyText(ComponentSerializer.parse(baseWrap.getJson())));
            baseWrap = ComponentConverter.fromBaseComponent(ComponentSerializer.parse(firstPass));
            packet.getChatComponents().write(0, baseWrap);
        }
    }
});

This is what i get in console :

[19:09:56] [Server thread/INFO]: StructureModifier[fieldType=interface net.minecraft.network.chat.IChatBaseComponent, data=[]]
[19:09:56] [Server thread/ERROR]: [CECoreHUD] Unhandled exception occurred in onPacketSending(PacketEvent) for CECoreHUD
com.comphenix.protocol.reflect.FieldAccessException: Field index 0 is out of bounds for length 0
        at com.comphenix.protocol.reflect.FieldAccessException.fromFormat(FieldAccessException.java:49) ~[?:?]
        at com.comphenix.protocol.reflect.StructureModifier.read(StructureModifier.java:244) ~[?:?]
        at fr.citeevent.cecorehud.CECoreHUD$1.onPacketSending(CECoreHUD.java:53) ~[?:?]
hushed spindle
remote swallow
#

im just saying there isnt really a reason to make a custom impl if it can take an item stack

hushed spindle
#

why not

#

the only available recipechoices are of the type alone or the exact meta

#

i would like to use a recipechoice that only checks some custom meta

#

the reason is mainly that i have custom items that use the same base type but that i would like to have different recipes for

#

and these custom items are also like weapons so i cant use exact recipechoices, and since several weapons can have the same type i cant use material recipechoices either

young knoll
#

Pretty sure it just won't work if you make a custom one

#

You are welcome to try though

quaint mantle
#

are particles thread safe?

carmine mica
#

depends what you are doing with them

#

I don't think the methods on World are thread-safe, but the ones on Player probably are

eternal oxide
#

particles are only packets, you can safely send them async

scenic onyx
#

is correct?

shadow night
#

Have you tried testing it

scenic onyx
remote swallow
#

theres an error there somewhere, not in that screenshot

scenic onyx
shadow night
scenic onyx
#

is wrong?

pseudo hazel
#

the writing is usually corrected if its wrong as otherwise it will not build the prject

#

unless you mean spelling mistakes

scenic onyx
pseudo hazel
#

seems to be your main plugin class so its fine

scenic onyx
#

is multi instance so multi module

pseudo hazel
#

okay

#

well even then

molten hearth
#

is it normal that the stacktrace for an error is being truncated in the console

pseudo hazel
#

its still fine for a class name

molten hearth
#

I did e.printStackTrace() and all that ended up in the console is [19:24:50 WARN]: java.lang.NullPointerException lol

pseudo hazel
#

might depend on the error

molten hearth
#

that is in fact NOT a useful stacktrace

pseudo hazel
#

oh oof

molten hearth
#

ah -XX:-OmitStackTraceInFastThrow fixed it thanks

hushed spindle
#

looks like imma have to custom make this recipe shit

young knoll
#

PrepareItemCraftEvent time

pliant topaz
#

Hey, so I was wondering how'd I go about only having one word of a message have a ClickEvent, but instead of the text with the ClickEvent, it sends the entire data of the TextComponent as a string. Anyone knows how I could achieve what I'm trying to do?
Here's my code:

                    invClickMsg.setColor(ChatColor.YELLOW.asBungee());
                    invClickMsg.setBold(true);
                    invClickMsg.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/joingame " + sender.getName()));
                    TextComponent invPlayerMsg = new TextComponent(ChatColor.GREEN + "Click " + invClickMsg + ChatColor.RESET + ChatColor.GREEN + " to join!");
                    invPlayer.spigot().sendMessage(invPlayerMsg);```
#

(discord kinda formats it wrong because one line is too long, so just ignore that, the formatting is done correctly in my code)

#

how would I go about adding the first part, as it doesn't seem like I can add normal text infront, even if it's a texcomponent I cannot put another Component at the end, as addExtra only allows for strings

kind hatch
#

Use the component builder

echo basalt
pliant topaz
#

i didn't see the one with component bruh

#

it's 1.20.2

#

yea, just overlooked it xd

#

ty

scenic onyx
scenic onyx
umbral ridge
#

when an entity dies, these particles are spawned? can i customize/remove them?

minor junco
#

I don't think you can honestly

scenic onyx
minor junco
#

you can add onto it, but remove them? Idk tbch

echo basalt
#

bedwars is a minigame

umbral ridge
#

different particles per entity kind of thing

minor junco
#

I mean just add onto the default particles no?

scenic onyx
echo basalt
#

Not necessarily

#

It's just about making an engine you can reuse

serene sigil
#

Hi guys, I am trying to make a "lockdown" plugin which will basically free up as much CPU usage as possible when there are no players in the server. It should NOT stop the server, it should only lockdown it so a player can just join and make the server behave normal again. Is Unloading all chunks enough to do the job or is there still something else taking up CPU usage?

umbral ridge
shadow night
minor junco
shadow night
minor junco
#

But if it works I guess

shadow night
umbral ridge
#

idk how deaths work

minor junco
#

Just have fun seeing how the dead body is interpolated to the fucking moon

scenic onyx
proud badge
#

Does the BukkitScheduler.runTaskAsync queue tasks, or would I have to do that myself? (for example if there are multiple async tasks at once, it queues them up instead of them all executing at once)

umbral ridge
#

damn

minor junco
#

Just add onto it bro ain't a big deal 😭

shadow night
#

you could maybe do some packet stuff and instead of sending the death packet just send some kind of entity disappear packet which does not trigger particles. Or maybe the particles are send as packets and we are just doing shit rn

umbral ridge
#

because killing them results in particles being spawned

minor junco
#

You could theoretically cancel the packet event using protocollib

#

But you need to sort out where the particles origin from

proud badge
#

Does Thread.activeCount() work in Bukkit/Spigot? (Get the amount of threads currently in use)

umbral ridge
#

or anything

minor junco
#

Probably not

umbral ridge
#

?jd-s

undone axleBOT
shadow night
umbral ridge
#

bruh

#

I don't know how to work with packets

minor junco
#
  1. Just add onto it
  2. Work with packets
#

That's your choices

#

Choose wisely young man

shadow night
umbral ridge
#

as well as io operations

serene sigil
#

yea but once the chunks have been unloaded and it stays unloaded for about 12+ hrs it is worth it, isnt it?

orchid trout
#

stopping the server works

umbral ridge
#

if you haven't had a player on the server for 12 hours, I'd even shut it off at this point and start it at specific hours

serene sigil
orchid trout
#

theres literally no point in that

serene sigil
#

is that true?

frigid finch
#

Hello,
I just set my plugin as FREE (was premium for a long time), but it seems that it is not working, it is not in the Premium category, but we cannot download it "SpigotMC - High Performance Minecraft - Error
You must purchase the resource in order to download."Does someone have an idea please ?
thanks

orchid trout
#

?support

undone axleBOT
orchid trout
shadow night
serene sigil
serene sigil
#

cuz no one is on anyways

orchid trout
#

tickspeed is a gamerule im pretty sure

serene sigil
#

Bukkit.getWorlds().forEach(world -> {
world.setGameRuleValue("randomTickSpeed", "1");
world.setGameRuleValue("doDaylightCycle", "false");
});

#

?

#

thats what shitgpt gave me

#

idk why he wanted to disable daylighrcycle πŸ˜‚

#

does anyone know what happens if you set the randomtickspeed to 0?

umbral ridge
#

try it

weak meteor
#

hello

#

im getting a weird error

#

just see the if statements

#

its telling me that eco.getBalance() (that in my case is 202) is less than 10

#

what could be happening?

proud badge
#

If there are no available worker threads in the pool when an asynchronous task is scheduled, the task is queued and will be executed once a worker thread becomes available. Bukkit will automatically manage the execution of tasks in a way that avoids overloading the server.
Is this true? -ChatGPT

exotic obsidian
#

guys i have a problem with my vps server

#

when i am trying to connect to the database

lost matrix
serene sigil
#

wait when the playerjoinevent gets called and there was 0 players befoire the event fired, what will be the size() in Bukkit.getOnlinePlayers()?

#

i always forget

#

its so confusing

lost matrix
#

One more than before...

serene sigil
#

Ok

serene sigil
umbral ridge
serene sigil
#

no thats not true?

#

it shows 1

umbral ridge
#

where it shows 1?

serene sigil
#

inside the event when i print out size()

lost matrix
#

You mean the tick which this event is fired in?
In this case: The player will always be in the playerlist while he is involved in an event

serene sigil
#

I knew it!!!!!!!!!

lost matrix
#

Meaning PlayerJoinEvent -> He is already included in the playerlist
PlayerQuitEvent -> He is still in the playerlist

serene sigil
#

so u have to do size()-1 to find out if there is no player on the server anymore (if u do it in the event)

lost matrix
#

*If he is the last player about to leave. Yeah.

serene sigil
#

alright,

#

thanks for the info

lost matrix
weak meteor
#

look

#

ITS NOT

#

HELP

scenic onyx
#

@weak meteor I don't understand what you're trying to do

weak meteor
#

a discord bot

#

but its just a check of balance

#

with 2 integers

#

eco.getBalance() < 10

scenic onyx
#

the problem?

hazy parrot
#

i mean if eco.getBalance < 10 evaluates to true, its fact that eco.getBalance is less then 10

#

also wtf

lost matrix
# weak meteor eco.getBalance() < 10

You've posted two different pieces of code so far.
Do a clean reset, gather enough information and come back with data that can actually be used to help you.

exotic obsidian
#

ovh vps

proud badge
#

How would I limit my Plugin so its only able to create 1 thread at a time?

hazy parrot
#

i would also suggest using jda instead of javacord

hazy parrot
lost matrix
scenic onyx
exotic obsidian
#

my plugin isn't connect to my vps database

#

i don't know why

hazy parrot
hazy parrot
exotic obsidian
hazy parrot
#

i mean if u don't want to provide error

#

i doubt anyone will be able to help you

#

other from guessing

weak meteor
lost matrix
proud badge
#

ok thx

serene sigil
#

guys what are all events that get fired when a player joins a server per order

weak meteor
#

and the debug value:

weak meteor
proud badge
#

What is better for async:
Using the bukkit scheduled or the bukkitrunnable?

weak meteor
#

Bukkit Runnable is a task

lost matrix
# serene sigil ?

AsyncPlayerPreLoginEvent
(PlayerPreLoginEvent)
PlayerJoinEvent
PlayerCommandSendEvent (Not 100% about order)
PlayerSpawnLocationEvent

weak meteor
#

Its your decision if you use Async or sync with the Scheduler

wet breach
serene sigil
wet breach
#

however, the runnables don't require to be scheduled to run though

#

you could simply invoke their run method

#

this doesn't necessarily mean they are sync as you could just make another thread and toss it in there as well

#

also, runnables can be created via anonymous inner classes too

weak meteor
wet breach
#

hope that clears up the confusion between those two things πŸ™‚

serene sigil
wet breach
#

ideally you should use the scheduler to schedule your tasks as it makes it easier

weak meteor
#

i guess

#

im not sure

lost matrix
# serene sigil OMG tysm

AsyncPlayerPreLoginEvent
(PlayerPreLoginEvent)
PlayerSpawnLocationEvent
PlayerJoinEvent
PlayerCommandSendEvent

wet breach
#

pretty sure join is before spawn

serene sigil
#

whats the difference between AsyncPlayerPreLoginEvent and PlayerPreLoginEvent

chrome beacon
#

Async

lost matrix
wet breach
#

weird

#

is the same even if tested multiple times?

#

I wonder if they are just sent at the same time

#

or maybe they happen at the same time and at some point the order swapped somewhere

lost matrix
#

Cant really fire events "at the same time" if they are sync πŸ™‚

serene sigil
#

and when using the AsyncPlayerPreLoginEvent will the size of getOnlinePlayers.size be 0 or 1

wet breach
#

That isn't what I meant

#

I just mean if they both happen within the same block code to be thrown

serene sigil
#

depending that it had no players

wet breach
#

if that is true, then its just a matter that the order of throwing the events could have changed over time

#

all well, seems spawn comes before join according to your test

lost matrix
#

Just tried a bunch of times, even with removing the player dat

lost matrix
river oracle
lost matrix
wet breach
#

I will have to do some tests. To see if this makes much a difference

wet breach
#

It could be a slight over sight if calling spawn before join actually does present a slight issue

serene sigil
#

I perhaps want to use PlayerLoginEvent in my case

wet breach
#

Playerlogin event happens on the network stack and the benefit of using it there is that you can make the player wait a bit of time without problems unlike the join the event

serene sigil
#

so will the playΓͺr show in the list?

wet breach
#

No. They show in the list when they join

#

But they show up as connected if they make it past the login event

serene sigil
#

so Bukkit.getOnlinePlayers.size will show 1 after the event?

#

assuming no player was on before

wet breach
#

Um connected players if they query the server should show 1 if they made it past login. Getonlineplayers should show 1 if they make it past join

#

But considering spawn is before join though its possible that it shows 1 before

#

Which i am still uncertain if spawn being before join causes issues lol

umbral ridge
#

hey, are vanilla death messages broadcasted per world or is it seen by all players in all worlds?

wet breach
lost matrix
exotic obsidian
#

@lost matrix @hazy parrot

#

i got this error when i joined the server

lost matrix
exotic obsidian
#

yup

lost matrix
#

Then debug why your database is not connected

exotic obsidian
#

listen

#

when i was programming my plugin on my localhost (database)

#

it's works great

#

but i changed the database connection info because im using vps now

lost matrix
#

Cool. Now go ahead and debug why your connection couldnt be established.

exotic obsidian
#

idk but i will check

#

btw i installed mysql server on my vps

umbral ridge
knotty aspen
#

Paper has an event for that. but with Spigot the best you can do is cancelling the interaction and handling the respawn stuff yourself

umbral ridge
echo basalt
#

should I make a wrapper object for this

minor junco
#

No, but wrap the code

echo basalt
#

I wonder if there's a better way to do this

minor junco
#

Still is not wrapped

minor junco
#

Idk looks wrong just allocating objects and not doing anything to them

echo basalt
#

They're being stored in the super class

minor junco
#

Mhn kay

shut field
#

how can you rotate an entities head smoothly to make it look like it's looking towards a location? But not just teleporting them to look at it cause that's rigid

#

maybe teleporting them multiple times to the same x,y,z, with different pitch and yaw, but I'm manly asking about the math of getting the pitch and yaw

shut field
#

woah I remember smth about that in linear algebra

echo basalt
#
public double lerp(double start, double end, double progress) {
  return start + (end - start) * progress;
}
#

Progress ranges from 0-1

shut field
#

would progress be smth comparable to the step?

echo basalt
#

progress = step / totalSteps

#

yeah

shut field
#

that's smart

#

thanks

echo basalt
#

No worries

gleaming grove
#

ItemDisplay + TextDisplay + mathematics ?

umbral ridge
#

hey

#

any idea how to catch ClientboundGameEventPacket with ProtocolLib?

wet breach
quaint mantle
#

for a server like hypixel, is it like a different "server" for each gamemode

echo basalt
#

uh no

quaint mantle
#

like

#

how do i explain

echo basalt
#

Hypixel has like 4 different "templates"

#

At least

#

They have their lobby servers, their "mini" servers, their "mega" servers, smp and skyblock

quaint mantle
#

so like when you join a new bw game

#

what's actually happening

echo basalt
#

So

#

Due to the way their minigame engine works, they can actually just have all their minigames under 1 plugin

quaint mantle
#

ya

echo basalt
#

So when you ask to join a bedwars game their matchmaking service points you to the "ideal" bedwars server

#

Then it asks the load balancer in case it needs to scale up or down

quaint mantle
#

scale what

echo basalt
#

The amount of servers deployed

#

I'm working on something like that right now

quaint mantle
#

so

echo basalt
#

Basically they just have a bunch of templates that are copypasted across machines

quaint mantle
#

ah so if I made a mini game server

#

my plugin would need like a

#

world management system right

echo basalt
#

Well, we'll get to that

quaint mantle
#

because i dont think it's like

fleet kraken
#

i'm not caching it

echo basalt
#

The load balancer is responsible for starting and stopping server instances from a template

quaint mantle
#

so it is a different server for each gamemode?

echo basalt
#

Eh, yes and no

#

Their "mini" instances hold all the small-scale minigames like bedwars, skywars etc

#

Their "mega" instances hold all their large-scale gamemodes like mega walls

#

Their "lobby" instances (might be merged into mini) handle the player lobby

#

They also have "proxy" instances

#

And for skyblock I'm not too sure but I'd say islands are ran on mini instances and larger stuff are handled in mega instances

#

They could be their own templates

#

Regardless, the "mini" instance receives command from the matchmaking service to, let's say, "create a bedwars game with XYZ map"

wet breach
echo basalt
#

Exactly

quaint mantle
#

so is that where a world manager is put in place

echo basalt
#

I'm not saying each instance's lifecycle is tied to a game

#

Each instance can manage 10 game lifecycles (or more)

#

Worlds are all in-memory as we don't need persistence, so that's where SWM comes in

quaint mantle
#

like for example in a bukkit server it's like a bunch of worlds each get their own folder

echo basalt
#

With hypixel's it's just all in memory with little to no file caching

wet breach
quaint mantle
#

yeah so

echo basalt
#

or as I call it "allocator"

quaint mantle
#

how does each vm handle 10 games

wet breach
echo basalt
#

So you don't need to fully build a whole world around this

#

You just need to do a bunch of networking

#

For example, "matchmaker" sends "instance-ab123" a packet saying "hey, ImIllusion wants to join game bedwars123, here's all the user data you need"

#

"instance-ab123" replies saying "ok, bring ImIllusion to bedwars123" and the player is sent

#

It's just networking

wet breach
#

Vms can have templates they are created from which contains all the necessary stuff already. Therefore its just a matter of stuffing that vm image with a custom mc server and a couple of plugins so when it comes alive it attaches to the network automatically

#

When the vm is has no connections for a period of time it just shuts down or informs the master its idle and the master decides

echo basalt
#

I'm not a HUGE fan of making a VM for each instance as it has a bunch of overhead

#

If all the tech we're running is proprietary we don't need that much and we can share resources like game maps

wet breach
#

Its not a vm per instance

echo basalt
#

Just a VM per machine?

quaint mantle
#

ok

#

well

#

if im making a mega game where there isn't a start phase

deep herald
#

i think i asked this b4 but why does this happen with bungee

quaint mantle
#

how is that handled

wet breach
#

No. More like 10 or so vms on a machine each vm handling up to 10 games at once

deep herald
#

it gets stuck on that forever

echo basalt
#

I treat an "instance" as a minecraft server

#

So yeah that's a VM per instance

#

I'm structuring mine as just a controller per machine where each instance has its own folder

quaint mantle
#

im so confused

echo basalt
#

It allows resources like map files to be cached per-machine rather than per-instance

quaint mantle
#

so does each mini game server have a world manager

echo basalt
#

Let me make you a diagram

wet breach
echo basalt
#

I'll make you one for the way I'd do it

quaint mantle
#

what abt like a big gamemode like

#

hypixel the pit

echo basalt
#

That's a mega

quaint mantle
#

do you think hypixel's code included a world manager

#

ye

#

for a mega gamemode

echo basalt
#

It's just a minigame that has no "start" phase

wet breach
#

Optic still wants me to create my proprietary system

echo basalt
#

Just a big eternal "playing phase"

echo basalt
#

Started my own little allocation system last night

#

Just need to write all the networking and some of the client logic

wet breach
#

Thats neat. Reason optic wants mine is because its already proven

quaint mantle
#

it's just that im making a plugin and bunch of items got special abilitites, I dont want those abilities to be triggered in special areas

#

what's the best way to handle this

echo basalt
quaint mantle
#

should i interact with world gaurd api?

echo basalt
#

Or piggyback off worldguard, sure

quaint mantle
#

do you happen to know if checking if one location is in a region is a "fast" task

wet breach
quaint mantle
#

and checking a flag of that region

#

because im assuming world guard stores its regions in memory

echo basalt
#

And how many regions there are

quaint mantle
#

a square

echo basalt
#

It can be O(n) or O(1) depending on the way regions are organized

quaint mantle
#

how can it be o(1)

echo basalt
#

binary tree or chunk system of some sort

quaint mantle
#

binary tree?

#

how

echo basalt
#

magic

quaint mantle
#

maybe what it does is it registers regions to chunks

echo basalt
#

Something like that

#

perhap

quaint mantle
#

gets the chunk at the location of the region and loops through the regions in the chunk

#

so then it doesnt go through every single region

simple bough
#

Hey! Does anyone knows how to remove the Spigot text when the client has an unsupported version? Like "Spigot 1.20.2". Just wanted to say 1.20.2 like the normal Minecraft servers.

echo basalt
echo basalt
#

Each "allocation client" is responsible for keeping track of its own images and spin up servers when the master asks for it

quaint mantle
#

okay

echo basalt
#

I'd split the spigot part into a few parts:

  • Allocation agent (Responsible for sending heartbeats to its managing client saying it's alive)
  • Matchmaking agent (Responsible for receiving user data by the matchmaking service and relaying it)
  • Minigame engine (Contains all the minigame logic and games)
  • World manager (could be merged into the minigame engine, loads worlds in memory)
quaint mantle
#

That's a lot of work

echo basalt
#

indeed

umbral ridge
echo basalt
#

Yeah so

#

Look at the NMS class

#

And just use protocollib's packetcontainer getters

#

they do something funky here

umbral ridge
#

so then how do I compare it

#

its kinda confusing

echo basalt
umbral ridge
#

that gives me StructureModifier<Integer>

echo basalt
#

.readSafely(0)

#

that's your int

#

just print out the values

#

you'll get there

umbral ridge
#

XD

#

readSafely

#

ok nice finally,

#

works

quaint mantle
#

question can i use a custom yml file instead of a config file
would they work the same?

echo basalt
#

A config file is just a yml file

#

Unless you mean reading your own config.yml file, that's also fine

quaint mantle
#

oh so it won't matter

echo basalt
#

Pretty much

quaint mantle
#

oh well thanks ^^

quaint mantle
echo basalt
#

Your set call isn't valid

#

set("join_sound", "ENTITY_WHATEVER");
set("announcement", "whatever");

quaint mantle
#

can i use get string to change an enum or is there another way for that?

echo basalt
#

getString returns you a string value present on your .yml

#

wrap it with valueOf and you have your enum value

quaint mantle
#

hm i never did it like that before i gotta see what i can do

rigid otter
#

I wonder my, e.g., Bukkit.getPluginCommand("decentholograms"); always return null; That means I can't get PluginCommand of other commands

echo basalt
#

Is it registered in the plugin.yml

rigid otter
#

Sure

#

I've got no idea now

quaint mantle
echo basalt
#

MyEnum value = MyEnum.valueOf(myConfig.getString("my-enum-value"))

quaint mantle
#

is hte myenum called that or do i name it for the sound i am using?

echo basalt
#

MyEnum is just the enum type

#

Sound.valueOf or whatever

quaint mantle
#

thing is it keeps showing red on the MyEnum part constantly

remote swallow
#

You are meant to change MyEnum to whatever the enum you want is called

echo basalt
#

facepalm tell em

torn shuttle
#

that way when it shows up red you know it's right

river oracle
quaint mantle
#

Does anyone have an idea why this doesn't work?

        ServerPlayer serverPlayer = ((CraftPlayer) sender).getHandle();
        GameProfile gameProfile = new GameProfile(UUID.randomUUID(), "Frensor");
        ServerPlayer frensor = new ServerPlayer(serverPlayer.getServer(), serverPlayer.getLevel(), gameProfile);
        serverPlayer.connection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, frensor));

Other packets DO work.

eternal oxide
#

look at your player tab screen

quaint mantle
#

I already did it

#

Nothing appears there

eternal oxide
#

Bruuuuhhh

#

that one packet will not add a fake player

quaint mantle
#

This worked for me before

quaint mantle
eternal oxide
#
        ClientboundPlayerInfoPacket playerInfoAdd = new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, npc);
        ClientboundAddPlayerPacket playerSpawn = new ClientboundAddPlayerPacket(npc);
        ClientboundRotateHeadPacket headRotation = new ClientboundRotateHeadPacket(npc, (byte) Math.floor(npc.getYHeadRot() * 256f / 360f));```
quaint mantle
eternal oxide
#

correct, but it's very similar

quaint mantle
#

Why would this work?

eternal oxide
#

uh, because thats how you do it

quaint mantle
#

I already tried it with this one ClientboundAddPlayerPacket playerSpawn = new ClientboundAddPlayerPacket(npc);.
The NPC appeared, but the tablist didn't change.

eternal oxide
#

for 1.20.4 its ```java
ClientboundPlayerInfoUpdatePacket playerInfoAdd = new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, serverPlayer);
ClientboundSetEntityDataPacket setEntityData = new ClientboundSetEntityDataPacket(serverPlayer.getId(), serverPlayer.getEntityData().getNonDefaultValues());

    CommonPlayerSpawnInfo spawnInfo = new CommonPlayerSpawnInfo(
            nmsLevel.dimensionTypeId(),                                // dimensionType
            nmsLevel.dimension(),                                    // dimension
            nmsLevel.getSeed(),                                        // Seed
            serverPlayer.gameMode.getGameModeForPlayer(),            // playerGameType
            serverPlayer.gameMode.getPreviousGameModeForPlayer(),    // previousPlayerGameType
            nmsLevel.isDebug(),                                        // isDebug
            nmsLevel.isFlat(),                                        // isFlat
            serverPlayer.getLastDeathLocation(),                    // lastDeathLocation
            (byte) 1                                                // keepAllPlayerData
            );
            
    ClientboundRespawnPacket respawnPacket = new ClientboundRespawnPacket(spawnInfo, (byte) 0);```
#

err

#

thats for 1.20.4

#

uses a CommonPlayerSpawnInfo now

quaint mantle
#

Why this many things? I only need to update the tablist. I'm using 1.19.4 btw. I haven't used 1.20.2 and above before.

dry hazel
#

it's just how the protocol does it

quaint mantle
#

This isn't appropriate for 1.20.1 and lower.

eternal oxide
#

no its not

quaint mantle
#

But I said I'm using 1.19.4. Why send something that doesn't work?

eternal oxide
#

1.19.4 uses ClientboundRespawnPacket

#

ok I'll not saend anythign else.

quaint mantle
#

I don't think that major changes appeared one version behind

eternal oxide
#

the respawn is sent if you are changing the players skin

dry hazel
#

mojang can rewrite the entire game in the next snapshot, there's nothing limiting them from doing changes

quaint mantle
#

What if I only use these two?

quaint mantle
#

Okay... Im gonna commit a crime: @remote swallow

remote swallow
#

what crime

quiet ice
#

Pong

remote swallow
#

ping

quaint mantle
remote swallow
#

havent got a clue

quaint mantle
wet breach
#

are you using protocolib?

#

or don't respond I guess

quaint mantle
wet breach
#

well the bitmask that needs to be sent is 9

#

which consists of 2 actions

#

add player and update listed

quaint mantle
#

Oo so I need to do both now

wet breach
#

yeah update listed is a boolean

#

which informs whether the player being added should show up on the list or not

quaint mantle
#

wait my hero

shadow night
#

How tf do you listen to packets without any external libs

wet breach
#

you hook into the network manager

shadow night
#

The whaa

wet breach
#

and then you obtain the appropriate queue for whether you want packets for being sent or packets being received

quaint mantle
#

Wait

#

Can you send me a snippet?

wet breach
#

I do not have a snippet at hand to show

umbral ridge
quaint mantle
proud badge
#

Gradle or maven?

quaint mantle
#

Gradle

#

Its pretty hard at start

umbral ridge
wary harness
wet breach
eternal night
#

Ant

dry hazel
#

bazel

proud badge
#

Is it possible to convert my maven project code to gradle?

shadow night
#

why wouldn't it be

eternal night
#

I mean, it will end up with some manual work

shadow night
#

definitely

eternal night
#

while gradle has something that tries to auto convert

#

it is far from perfect

shadow night
#

it should be easy to do it manually anyways

#

well, if you know gradle

lost matrix
#

I would start with maven for spigot development and stick with it for a while.

proud badge
#

Is gradle only faster when building?

#

Or is it faster in general gameplay etc?

lost matrix
#

Your build tool has no effect on the quality of your generated bytecode.
Its simply a tool to orchestrate additional steps for your building process.
The compilation is faster because some steps are cached. The initial compilation is usually slower.

proud badge
# lost matrix Create a manager of some sort: ```java private final ExecutorService executor ...

  public void execute(Runnable runnable) {
    this.executor.execute(runnable);
  }

  public <T> Future<T> submit(Callable<T> callable) {
    return this.executor.submit(callable);
  }
  @EventHandler
   public void onBlockBreak(BlockBreakEvent event) {
      Bukkit.getScheduler().runTaskAsynchronously(this, () -> {
        //This code can only use 1 thread at a time
      });
  }

```Would something like this work? Or did I do it wrong?
rotund ravine
#

What’s ur executor service doing

lost matrix
proud badge
#

ye this was just an example trying to understand how this works

proud badge
lost matrix
# proud badge no clue

You cant use bukkit tasks and your executor. Chooser either of those two.
I would stick with bukkit tasks for now and scrap the executor if you have no clue what it does.

hoary spire
#
ItemStack deneme = new ItemStack(Material.PLAYER_HEAD);
ItemMeta denemeMeta = deneme.getItemMeta();
denemeMeta.setDisplayName("ae");
deneme.setItemMeta(denemeMeta);```
#

This why dont works?

#

It gaves <identifier> expected and illegal start of expression

lost matrix
#

Show the exception pls

proud badge
#

ItemStack(Material.PLAYER_HEAD, 1); maybe

lost matrix
hoary spire
lost matrix
# hoary spire Yea

This means you have a simple syntactic error.
Show us your entire class or a screenshot of it.

hoary spire
#

Only create gui code but wait some second

#
package my.package.gui;

import org.bukkit.entity.Player;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;


public class mainMenu {
  
  public class testGui {
    ChestGui gui = new ChestGui(2, "deneme");
    
    ItemStack deneme = new ItemStack(Material.PLAYER_HEAD);
    ItemMeta denemeMeta = deneme.getItemMeta();
    denemeMeta.setDisplayName("ae");
    deneme.setItemMeta(denemeMeta);
  }
}```
#

Im using IF(Inventory Framework)

proud badge
#

How come it always skips the hundreds, how could I make it not skip it?

#

Maybe ChatGPT misunderstood what I asked it

lost matrix
proud badge
hoary spire
minor junco
#

Oh no I just seen it

lost matrix
proud badge
#

ye chatgpt misunderstood me

minor junco
undone axleBOT
quiet ice
#

You gotta understand what chatGPT gives you, but I guess times change

proud badge
#

I wanted it to detect if its 1 number and then all zeros at the back for example 20, 90, 500, 9000, 30000, 80

quiet ice
#

Ah that is more effort

proud badge
#

Rip

hoary spire
#

but you can help me about fix it?

lost matrix
proud badge
#

Btw what happens if I make some java code to open a GUI (not minecraft gui, gui as in window/app) and put it on my server as a plugin

quiet ice
#
while (x > 9) {
  if (x > 9 && x & 10 != 0) {
    return false;
  }
  x /= 10;
}
return true;

Would be the code for that if you didn't figure it out already

proud badge
#

thx

minor junco
quaint mantle
lost matrix
quiet ice
minor junco
hoary spire
#

But this need only creates gui

quiet ice
minor junco
hoary spire
quiet ice
#

I did the if first, then the while, so I did not realize

lost matrix
minor junco
wet breach
#

maven and gradle can be setup in the same project since both use different systems and files

#

in this manner if both are setup in the project it doesn't matter which you decide to use

proud badge
quiet ice
wet breach
#

o.O

#

why only me?

quiet ice
#

Because that is such a "well, actually" moment I can't expect from many

wet breach
#

lol

quiet ice
#

It's right, but whyyyy would you do that?

eternal night
#

if you don't know what build tool you use, how will your enemies

#

confuse them, trash your repo with multiple build tool files

lost matrix
#

Throw a makefile in as well

quiet ice
#

Although that gives me an idea for the moment I will invariably start migrating away from gradle

#

I'll probably keep both systems alive since realistically there is little maintenance cost to a gradle project once it is set up.

remote swallow
#

No

#

No switching back to maven

quiet ice
#

I cannot use maven in many of my gradle projects

umbral ridge
#

whats possible with gradle thats not possible with maven?

quiet ice
#

Dependency generation on the fly

lost matrix
quiet ice
#

Well with just maven it is possible, but IDEs say "nope, I'll parse the pom myself for deps"

umbral ridge
quiet ice
#

Also, conditional deps are a lot more restricted under maven

umbral ridge
#

hmm

lost matrix
wet breach
#

they don't have to be forced to use one or the other

quiet ice
#

Until the moment it only builds with one as the other silently broke and noone tested

umbral ridge
eternal night
#

"forced to use one or the other" kekwhyper

remote swallow
umbral ridge
wet breach
quiet ice
quiet ice
lost matrix
#

I can imagine that every IDE would really like having multiple build tools in their project directory.
Makes it easier for it to just commit unaliving.

quiet ice
#

Eclipse will only pick one

#

But you can add the relevant natures manually if you love duplicate suggestions

#

But given that the integrations work by registering their own containers, nothing breaks on that front besides code suggestions

lost matrix
quiet ice
#

And even then I don't think so

wet breach
#

well it was in the past anyways as not everyone could use a specific one

umbral ridge
#

in <configuration> block

quiet ice
#

No

lost matrix
quiet ice
#

It's minimize

umbral ridge
quiet ice
remote swallow
#

add <minimizeJar>true</minimizeJar> into the configuration block

hoary spire
eternal night
#

notably, minimize can clap you in some fun ways

umbral ridge
#

It's just that my jar is getting a little big in size. around 1 MB and I want to compress it

remote swallow
#

1mb is nothing

umbral ridge
#

It's a big plugin

wet breach
# umbral ridge is it called createDependencyReducedPom?

dependency reduced pom is just for removing transitive dependencies that are already shaded into your jar so that when another project depends on the jar it doesn't try to fetch those dependencies since they are already included

remote swallow
#

start worrying when its over 5 or 10

quiet ice
umbral ridge
#

and its tons of classes

young knoll
quiet ice
#

Yeah then no minimize

umbral ridge
#

I don't like how essentialsx isn't so customizable so i wanted to create my own version

shadow night
quiet ice
#

Minimize should only be removed to handle dependencies not being used to their full potential

umbral ridge
#

plugin for my server only

shadow night
#

Hm

lost matrix
umbral ridge
lost matrix
#

Yes classes are scary eyes_shake

quiet ice
#

You should use mvn clean package for building - takes less size (~10% at times)

shadow night
quiet ice
#

Oh and use fewer classes if you want a smaller project

quiet ice
#

Beyond that, there is little to reduce size

wet breach
quiet ice
quiet ice
#

The size diff is real though

shadow night
#

I'm not very good at understanding sarcasm, humour, etc.

umbral ridge
#

the more customizable it is the better it is

lost matrix
wet breach
#

it removes the majority of unused classes from dependencies and transitive dependencies

#

and understands your code to know this, however you need to do some testing to ensure nothing breaks

umbral ridge
lost matrix
shadow night
#

Lol

#

Funny how a lot of plugin devs don't even play mc anymore

umbral ridge
#

I dont play minecraft either, i barely have time even for myself, i come home tired asf almost everyday

#

but coding is fun

shadow night
umbral ridge
#

an ideal server for me would only have my plugins installed

lost matrix
#

Vault would at least need CompletableFuture<Double> queryBalance(OfflinePlayer player) for me to be useful.

young knoll
#

Pr it

#

:p

umbral ridge
#

I think the best is what you do yourself, you know exactly whats happening

lost matrix
# umbral ridge I think the best is what you do yourself, you know exactly whats happening

It really depends on how much time you have and if its worth it.
I wrote a huge library for personal use while on a summer semester break.
Included everything from holograms, NPCs to tablists, GUIs etc.
There is so much backbone in it, that i can write content on top of that with ease.
And it grew over the years. I think the biggest time saver was introducing the
Gson backed serialization model.

umbral ridge
#

I was thinking of making a few util classes that would handle that sort of stuff too

#

it just that all takes time

#

almost too much time

#

you start to ask yourself if its worth it lol

#

but once its done, its done

#

usually the best stuff you want to code is hard to find and you have to do it all by yourself. think it out uwu

quaint mantle
#

How to obfuscate nms stuff in codebase back when compiling? Like theres plugin for maven but I have gradle.

quaint mantle
remote swallow
quaint mantle
#

What about spigot?

remote swallow
#

nothing offical

quaint mantle
remote swallow
quaint mantle
#

Thanks

eternal night
#

I wonder how worth it would be to just maintain a spigot devbundle for paperweight

#

should be simple enough to setup and automate publishing

#

maybe that is my christmas obsession NODDERS

lost matrix
eternal night
#

kekwhyper I got a few days off uni, gotta burn myself out somehow

lost matrix
eternal night
#

Finals are in March and August o.O

#

I have a single exam somewhere at the end of Feb

lost matrix
#

What county are you in?

eternal night
#

BW

#

I guess that is what you mean with county ?

lost matrix
#

Yeah, i thought we had the same schedule in Bay and BW.
Are you at a Universitiy for applied sciences or at a technical university?

eternal night
#

KIT

#

so sure ? xD

lost matrix
#

🀷

hoary spire
remote swallow
hoary spire
#

But it doesnt explains problem totally

eternal night
#

it does

remote swallow
#

it does

eternal night
#

?learnjava

undone axleBOT
proud badge
#

Having a cooldown for events/chat messages below 50 MS (1 tick) is useless right as its impossible to go that fast?

eternal night
#

Pretty much

#

Well some events might happen more.often, e.g. async ones if they never have to sync with the tick thread

#

One tick might call multiple of the same event tho

#

Just, usually different context etc

hoary spire
proud badge
hoary spire
hazy parrot
umbral ridge
#

:)

proud badge
hazy parrot
#

(x&10)!=0

umbral ridge
#

oh wait nvm i dont understand it

proud badge
#

What im trying to do: see if a number is one non zero one in the front and the others are zeros for example 90 500 10000 etc

onyx fjord
#

is it somehow possible to get the chat format for messages without having the chat event instance?

hazy parrot
#

Isn't format set on event?

onyx fjord
#

ah damn so i cant get around it?

rotund ravine
#

I mean

#

You can fire a fake event or hook into the apis. First one might sent a message though

#

Some plugins cancel and broadcast so sadge

cyan void
#

this may be a bit advanced for me to be asking in a discord server but how can i use my plugin to sture data even when the serevr restats???

rotund ravine
#

You can store it in configuration files

cyan void
#

educate me

#

or show me were to be educated

rotund ravine
cyan void
#

but is that a good idea

#

in a config file

#

for data

umbral ridge
#

yeah yml works fine

cyan void
#

k good

#

ty everyone who helped me πŸ˜„

cyan void
rotund ravine
quaint mantle
#

Let me test

#

Oh I can't post imgs

eternal oxide
#

?img

undone axleBOT
#

Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.

Here's some screenshot utilities that can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org

quaint mantle
#

I tested with these

9000000
9
10
1000
1009 x
1100 x
1010 x
1000010000 x
110000000000000 x
1
2
1000000000000000000000

#

I tested with these

#

ones with x failed

#

others passed

remote swallow
#

anyone that knows kotlin know what the fuck this means

rotund ravine
#

First parameter returns

#

archiveDirectory as file or parentfile if archiveDirectory is null

#

Second parameter is much the name with archiveClassifier and archiveNamw

orchid trout
#

rs.getString(1) is null pointer

rotund ravine
#

0 too?

hazy parrot
#

You forgot rs.next

orchid trout
#

thaks

hoary spire
#

cannot be converted to org.bukkit.command.CommandExecutor

getCommand("testcmd").setExecutor(new mainGuiTestCmd());```
#

How can i fix this?

hazy parrot
#

executor has to be instance of CommandExecutor

eternal oxide
#

mainGuiTestCommand must be ^

hazy parrot
#

Aka your mainGuiTestCmd

#

?conventions

glad prawn
#

\d for any number, change it for your case

quaint mantle
#

^\d0*$

#

Doesn't that work alrdy

hazy parrot
#

Code geol already sent is completely fine

#

Also much faster

glad prawn
quaint mantle
#

well idk if he wants that or not

glad prawn
#

non zero one in the front

quaint mantle
#

Ok my bad

minor junco
glad prawn
#

ik

orchid trout
onyx fjord
#

im p sure the game uses some translation key for chat messages

umbral ridge
eternal oxide
orchid trout
#

100%

#

i copied the one in the database file and pasted it into the code

eternal oxide
#

I'd suggest not, or you are reading from an empty database and not the one you showed

#

also you can;t use your discordID as the Profile name. It's too long

#

pretty sure names are still limited to 16 characters

orchid trout
#

i use user id

eternal oxide
#

user id?

#

in your code you use discordID

#

which is supposed to be the one from your database, which is 18 characters

orchid trout
#

uh

#

doesnt this set the limit

eternal oxide
#

yes

orchid trout
#

so its fine

eternal oxide
#

no

orchid trout
#

ohh

eternal oxide
#

your limit is 36, your discordID is a length of 18, names are max 16

orchid trout
#

column name? or what do you mean by name

eternal oxide
#

Profile name

#

new Profile(uuid, name)

#

you pass in a length 18 String (discordID) as teh name arg

orchid trout
#

its my profile objec

#

t

eternal oxide
#

ah ok

#

in that case you are passing in the wrong discordID or using the wrong database

orchid trout
#

im lost in the sauce

#

i have no idea whats going on right now in my code

remote swallow
eternal oxide
#

someone threw it?

hoary spire
eternal oxide
#

?tas

undone axleBOT
hoary spire
#

Yes. It.

#

Now it gaves this in compilation
is not abstract and does not override abstract method onCommand(org.bukkit.command.CommandSender,org.bukkit.command.Command,java.lang.String,java.lang.String[]) in org.bukkit.command.CommandExecutor

remote swallow
#

learning java can help

eternal oxide
#

look at your IDE warnings. it's telling you what is wrong

shadow night
eternal oxide
#

if something is underlined, hover over to see what it tells you

quaint mantle
proud badge
#

To getNearbyEntities on the exact same coordinate do I use 0 or 1?

quiet ice
#

Use 1 and filter those out who are not on that coordinate

#

Given that the edges of a block are nearer than the corners

proud badge
#

Im looking for an item frame

#

So it cant be on edges

quiet ice
#

I'd still do it

#

I cannot find any better APIs for this usecase strangely enough

clear elm
#

www

eternal oxide
#

.

unique bronze
#

hey for the new enchantment stuff do we just return the key we had used in the constructor in the getKey method instead of passing it in startup?

proud badge
#
        Player target = Bukkit.getPlayer(targetName);
        if(target!= null) {
            Inventory inventory = target.getInventory();
            if(inventory.contains(drop)) {
                inventory.remove(drop);
            }else{
                player.sendMessage("Β§cWe attempted to remove the item from the player's inventory, but it was not found ("+ MaterialConverter.convertMaterial(drop.getType())+")");
            }
        }else{
            player.sendMessage("Β§cWe attempted to remove the item from the player's inventory, but they were offline");
        }
    }```
Issue, if the item stacks ontop of another item (for example the 1 torch in my inv goes onto another one and it becomes 2 torches) this code will recognise as there being no torches in the inventory (cause ItemStack 2). How could I make it so it notices it even if it stacks ontop of another one?
pseudo hazel
#

compare the material

#

or iirc there might be a way to compare disregarding the count

#

or you could make a copy, change the amount, and then see of its equal

#

but like

#

thats kinda expensive

inner mulch
#

its not possible to define any mutable fields in interfaces or fields that are pre-defined, right?

carmine mica
#

no instance fields

#

can have static final fields

lost matrix
inner mulch
#

okay

#

thanks

proud badge
#

Ok I assume I did something wrong because I checked, the array isn't null and the block is definitely a sign

#

The sign doesnt get the lines updated ingame

lost matrix
#

Force an update on the blockstate

proud badge
#

ok epic, how, since setBlockState does not exist

rotund ravine
#

Also use the proper nondeprecated ways

#

.update

proud badge
#

ok lemme try

#

Epic it worked

wet breach
young knoll
#

Pretty sure the legacy converter shoves it all in the extra section

inner mulch
#

are there clean ways of automatically getting fields based on conditions. Except naming them the same every time and using reflection? (i heard reflection isnt considered clean)

lost matrix
#

Unless its for serialization.

inner mulch
#

im not quite sure what serialization means, i just want that when i create new enum entries in a certain enum the fields and methods associated arent as tideous to update

carmine mica
#

not sure what would require updating if you add an enum entry?

#

can you give a better example?

inner mulch
#

i have added a stat enum based on events stats need to change in the player object, i create a method taht switches stats (i dont know what stat will be changed) and for every stat something special happens and the field taht describes the stats value is changed

#

if i add a new stat i would need to add a new case all the time

#

but when i could somehow get the field tied to the stat it could be easier

#

so that i just need to create a field with a closely related name to the stat

carmine mica
#

sounds like a general design issue

#

a simple idea for stats is an enum for the stat type, then a map of maps for players to stats to values

#

Map<Player,Map<Stat, Integer>> is just a super basic example

#

then you just increment the value for a stat key

inner mulch
#

how could i forget that xd

carmine mica
#

keeping a separate field for each stat's value sounds not good

inner mulch
#

thanks

#

you are correct

inner mulch
carmine mica
#

Map is the interface, HashMap is one implementation of that interface

#

there are lots of implementations, IdentityHashMap, LinkedHashMap, TreeMap and plenty more

inner mulch
#

okay

carmine mica
#

Map just defines the methods and their general contracts (what the method is supposed to do)

#

an implementation like HashMap actually contains the logic to do what the Map interface contract says

#

like if you look at the source of Map, you see that there's no actual logic, just methods to be implemented

brisk estuary
#

Does anybody know any 1.19+ plugin that uses NMS to create npcs and custom entities with multiple versions support? I want to check their code to learn how to do that.

quaint mantle
#

should I use world guard or just make my own region manager

#

cause the worldguard ui looks horrible

umbral ridge
#

make your own worldguard plugin

restive tangle
#

Light weight region manager

quaint mantle
#

anyone have an idea how worldguard gets the region given a x,y,z location

#

their dev said it's "as optimized as it gets"

#

using a tree

sullen marlin
#

For years and years they just iterated every region

#

They use some sort of structure now, idk what. Check the source code

slender elbow
#

yeah

#

priority r-tree

tender shard
#

Fancee

#

Whatever that is

lost matrix
#

You can do that by initially calculating all chunks intersecting your region and then mapping the chunk x, y to your regions.

quaint mantle
#

What if there is two regions in one chunk

#

like the chunk completely surrounds the region

#

Both regions

umbral ridge
#

can you make maven increment your plugin version build number each time i recompile the project? i want something like 1.0.0.b<build>

lost matrix
#

Its O(n) for that because a region could only slightly intersect a chunk and other regions can overlap.
You need to decide if overlapping is ok. In that case you need a priority check as well.

slender elbow
#

i mean that strategy kinda goes sideways with verticality and checks finer than a chunk, then you need to start iterating or add some extra mapping, which is very pepega in terms of memory footprint

#

it is a trade-off, but "most optimised" does not tell you what it's optimised for

lost matrix
#

Ah, i actually didnt think about a more granular mapping. You could easily have a discrete value for which parts of the chunks are overlapped as well.
I usually just iterate if multiple regions overlap the same chunk (which is pretty much always 1 or 2 at max).

umbral ridge
dry forum
#

if i want to save a decent amount of data to a file, should i do it all in a seperate thread? also should i read and do stuff with the data in a seperate thread?

young knoll
#

Yes

quaint mantle
lost matrix
quaint mantle
#

to check if the player joined before

#

cause if not it'll run for new players only

#

i am still new so i am doing my best

lost matrix
#

isnt it just player.hasPlayedBefore()

quaint mantle
#

oh it is xd

quaint mantle
lost matrix
quaint mantle
#

i just want it to only run for new players who haven't joined before since i am new this is the best way i can do if there's another way i don't know how to do it

lost matrix
#

Create a new class
Let it implement Listener
Create a new instance of that class
Register that instance in your onEnable