#help-development

1 messages · Page 641 of 1

lost matrix
#

Yeah, kind of like real time operating systems do it 😄

lavish hemlock
#

So the goal is not that it makes the task run faster but it prevents the entire server from lagging while the task is ongoing then.

lunar wigeon
#

tps are not the only important thing

lavish hemlock
#

And if you wanted to improve the performance of the actual task you'd use a more optimized method (i.e. the NMS-based alternative)

lost matrix
lavish hemlock
lost matrix
lavish hemlock
#

I remember older plugins where one player would modify a large area w/ WorldEdit and the server would just pause for a solid 3 seconds

lunar wigeon
#

you can have 20 tps and 200 ms per second on your plugin

remote swallow
#

uh what

lavish hemlock
remote swallow
#

there is always going to be 1000ms per second

#

that will never change

lavish hemlock
#

Destroy time

lost matrix
lost matrix
lavish hemlock
#

Aren't ticks a fixed time unit?

lost matrix
lavish hemlock
#

Actually no scratch that, game loop

lost matrix
#

And a plugin like that belongs straight in the garbage.

lavish hemlock
#

They're fixed time points (hence "every 5 ticks") but they do not correlate to a specific amount of milliseconds

lost matrix
#

*Unless this is a 99.9th percentile

lavish hemlock
lunar wigeon
lavish hemlock
#

There's a number of things that can cause fluctuations during a game loop (hence why delta time exists for physics calculations)

lunar wigeon
#

it was 20 tps

lost matrix
#

You can have a single tick >50ms because there are catchup mechanics.
But it still disrupts the game loop.

lunar wigeon
#

20 tps != optimized

#

not always

sterile breach
#

is not a code error?

lavish hemlock
#

Can't believe I just guessed at how ticks worked

#

A game tick is where Minecraft's game loop runs once.

#

This is what happens when you try to code your own game engine.

lost matrix
#

btw every game has a tick loop. This is not exclusive to minecraft.

lavish hemlock
#

I know

#

Most games don't call them ticks though, afaik

lost matrix
lavish hemlock
wet breach
#

I was about to point this out until i seen you mentioned it lol

lunar wigeon
lost matrix
lunar wigeon
#

and cs2 doesnt have ticks system

lavish hemlock
#

Interesting

#

The wiki doesn't mention that at all

wet breach
abstract sorrel
lost matrix
lavish hemlock
lost matrix
abstract sorrel
#

if it is null the code assigns a value to it though so i dont understand what is causing that error

lunar wigeon
#

@lost matrix I have tried your workload distributor and it kinda lags, when it has 1 task to do (1 cuboid) it does good. But when I gave it 10 cuboids 50x50 it was lagging

wet breach
abstract sorrel
#

yes it does

lost matrix
lavish hemlock
#

But can it run Doom?

lost matrix
remote swallow
#

can you run doom

lavish hemlock
#

Yeah I think I can imagine some Doom gameplay

#

It's not perfect but it's usable enough

remote swallow
#

encode it on ur dna

lunar wigeon
#

literally copied and pasted

wet breach
abstract sorrel
#

the plugin created the file

lost matrix
#

Its not in the config

wet breach
#

Well you path for obtaining the file and or creating it is flawed whch is why i am asking about it

abstract sorrel
#

earlier it checks if it is null and then assigns a value

#

how do u paste images in this server

lost matrix
#

?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

abstract sorrel
lavish hemlock
abstract sorrel
#

we can't even see that its smaller than ur pp

remote swallow
#

it looks sus

#

its a sus distraction ddfance

lavish hemlock
lunar wigeon
wet breach
# lunar wigeon but minecraft has 20 ticks, most games are based on 64, 128 ticks

Ticks is a bit arbitrary really. These days the main game loops are set to run as fast as possible. The only loops which typically are not are usually your rendering loops as you want those in sync with the refresh rate the hardware can handle. But tick loops is a bit arbitrary as well in that its really whatever you consider 1 loop to be. Typically ticks refer to the in game time speed however in game time speed are decoupled and dont usually dictate how fast everything else can be processed lol

lost matrix
lunar wigeon
#

so 10 workloadrunnables every 1 ticks?

lavish hemlock
#

Mmm that makes sense.

#

Because they're all competing for the same slice of time.

lunar wigeon
#

I mean then those workloadrunnables will overlap each other

wet breach
#

Depending on what you are doing probably could offload some of the work to another thread

lavish hemlock
#

Something to maybe consider is a hierarchical system.

wet breach
lavish hemlock
#

i.e. a root workload scheduler that is able to split time between multiple schedulers (one per each big task)

#

You do a little of one task, then a little of the next, and so on.

#

That way, they all perform at "the same time" and aren't dependent on one finishing before the other.

abstract sorrel
wet breach
#

And adjust accordingly on scheduling or executing the next task

slender elbow
#

"it's only reading" doesn't mean thread safe

#

I'm sure you know about that funny hash map infinite loop

wet breach
#

And for hashmap there is concurrenthashmap

#

Which is a thread safe hashmap if you need it

lavish hemlock
# wet breach You could always just keep track of runnables that are scheduled and if whether ...

Actually lemme explain better.

Consider you have multiple tasks occurring at once
These tasks are split up into smaller parts
Task 1 and task 2 should appear as if they're operating concurrently, so we can't just do all of task 1 and then do all of task 2, we need to do part of task 1 and then part of task 2
However it would be slow to always run each task every cycle, we want to do task 1 for a few ticks, task 2 the next few ticks, repeat
So you need a scheduler that decides which task gets run, and those tasks decide which micro-task gets run (which is probably just going to be the next one)

In other words
task = process
micro-task = instruction
lol

#

I'm sure you got the gist I just wasn't happy with my original explanation

wet breach
#

And what are you trying to accomplish in doing this in regards to the cuboids?

lavish hemlock
#

It means we can process all cuboids concurrently while keeping TPS at 20, like with the original workload distributor

wet breach
#

Well no

#

Its linear processing

#

So it will never be truly concurrent. Which is why i asked what are you trying to accomplish with the cuboids that you need such a system

#

Because what you are trying to setup may very well just make completing tasks slower

lavish hemlock
#

Operating systems handle processes on singular cores in a ""concurrent"" fashion. Since there's no way to execute multiple processes at the same time, they provide each process with a small period of time (a time slice) to execute instructions and swap between each process to give the impression of concurrent processing.

#

Round robin scheduling, it's basically what I've planned out above.

wet breach
#

Unless you are referring to processes as in work needing to be done?

lavish hemlock
lost matrix
lavish hemlock
# lavish hemlock

On a multi-core system, true concurrency can be achieved as multiple instructions can be executed simultaneously by different cores (which further utilize round robin scheduling so that multiple cores can handle multiple processes).
But when working with a single core, you cannot have multiple instructions from different processes executing simultaneously.

wet breach
# lavish hemlock

How the OS executes stuff is completely different then how applications execute stuff. Even if you have a single core you can still execute processes concurrently because threading still exists for single cores

lavish hemlock
#

I'm speaking from a very primitive perspective on multitasking.

Until the early 2000s, most desktop computers had only one single-core CPU, with no support for hardware threads

lavish hemlock
#

We don't have support for hardware threads in a Minecraft context either, whatever those would even be in that context.

lavish hemlock
#

I'm using the term as an analogy

#

We're executing a set of tasks like how an OS executes a set of processes

wet breach
#

Some stuff is multi threaded in mc as well as you can create threads

lavish hemlock
#

Minecraft is single-threaded and apparently not thread-safe so we can argue we're limited to one core, no threads.

wet breach
lavish hemlock
#

Yes you can lol

wet breach
lavish hemlock
#

An OS is an application, all a round robin scheduler is is an algorithm for multitasking tasks.

wet breach
#

So no you are not limited to a single core

#

Java threads for example when they are created can in fact execute on other cores if the os dictates it should

wet breach
lavish hemlock
wet breach
#

Not sure what you mean that is an implementation detail.

lavish hemlock
#

However the OS chooses to execute Java's code is not Java's responsibility.

wet breach
#

But it is because java can decide to over rule the os and put all threads on a very specific core

lavish hemlock
#

Isn't most chunk/entity logic single-threaded?

wet breach
#

In mc? Depends which ones you are referring to

lavish hemlock
#

Actually chunk logic might no longer be single-threaded.

#

I don't know, haven't looked deeply into it.

wet breach
#

World generation for example is multi threaded.

lost matrix
#

Anyways

lavish hemlock
#

Regardless we're making the assumption that we can't use multithreading for everything because not everything is safe to use multithreading with.

wet breach
#

But i am not sure how this all relates to what you are doing

lavish hemlock
#

Well here's the thing, if you have multiple players spawn new tasks, why should one player wait for another player's task to finish?

lost matrix
lunar wigeon
#

;D

lavish hemlock
#

I don't recall seeing an API for saying "I want this thread in particular to be on this core"

wet breach
#

Because it isnt available in the api

lavish hemlock
#

So to the eyes of a Java programmer, Thread could refer to either an OS or hardware thread.

wet breach
#

It will never refer to a hardware thread

#

No application has the ability to mess with hardware threads except the OS itself

lavish hemlock
#

Correction: It could refer to code that runs on either an OS or hardware thread.

wet breach
#

Not even correct either. Everything runs on a hardware thread. Threads spawned by an application are virtual threads which run on a hardware thread

lavish hemlock
#

Actually that's a fair point.

#

I'll give you that one.

lavish hemlock
#

Imagine the first task takes 5 seconds to complete

wet breach
#

Well it depends on what those tasks are for

lavish hemlock
#

That's 5 seconds before the other player even sees their task (the second task) begin to start.

wet breach
#

Which is why i asked because i dont know

lavish hemlock
#

And what if you're the unlucky 5th player? That's an entire 20 seconds.

lavish hemlock
#

I mean I'd still need to see an implementation of this to be sure it actually has a benefit.

barren pumice
#

so what is the best method to place many blocks then?

lavish hemlock
#

I think an issue would arise from complexity since more tasks = more time for each to complete.

#

There's less of an issue if you can take advantage of multithreading but I dunno.

wet breach
barren pumice
#

code example? im beginner

#

maybe not beginner but not that advanced

lavish hemlock
#

I'm curious as to if cooperative multitasking would maybe work (i.e. fibers/coroutines)

#

Only issue is that that doesn't natively exist in Java (yet) and would therefore be a pain to implement lol

lavish hemlock
ivory sleet
#

I mean project loom will address coroutines relatively well

lavish hemlock
#

Yeah but it's probably going to take a bit before it's actually available

#

re: Valhalla

ivory sleet
#

Loom?

#

I mean loom is like 50-75% delivered

glad prawn
#

Should i save ZonedDateTime as String or convert to TimeStamp in database?

rotund ravine
#

Whatever you want

#

I would probably convert to smth easy to save. So it’s all up to you.

glad prawn
#

ok

ivory sleet
glad prawn
#

k 'll try

wet breach
paper cosmos
#

Why my intellig idea keeps freezing and telling me it needs more memory. Every time after I increase it. Now its already 6 GB. Isn't it enough?

lunar wigeon
#

invalidate caches or reinstall intellij

#

you might also want to use intellij idea EAP

hazy parrot
#

There is no kotlin jvm

#

You run it on any jvm

#

It's compiled to normal bytecode

knotty meteor
sullen marlin
#

its just changing the text each time

knotty meteor
#

Oowh so i have to do it manually then

vast ledge
#

Idk

#

maybe a while loop

#

or an async bukkit runnable

twilit roost
#

eeem what the duck?

knotty meteor
#

I also think it is a runnable but wont removing and adding the armorstand create lagg?

lunar wigeon
knotty meteor
#

Oh yes that is also possible

#

Thank you! I will take a look at it

sullen marlin
#

your plugin is corrupt, recompile it

twilit roost
#

strange

quaint mantle
zealous osprey
#

I have a very weird issue that I've never come across before:
I have a static block in an enum:

static {
        System.out.println("HERE");
        // create matName set
        for (StackableMachines stackableMachine : values()) {
            matMap.put(stackableMachine.material, stackableMachine);
            matNameSet.add(stackableMachine.material.name().toUpperCase(Locale.ROOT));
        }

        System.out.println("HERE");
        // create modMachines map
        for (StackableMods mod : StackableMods.values()) {
            final List<StackableMachines> modMachinesList = new LinkedList<>();
            for (StackableMachines machine : values()) {
                if (machine.getMaterial().name().startsWith(mod.getModPrefix())) modMachinesList.add(machine);
            }

            modMachines.put(mod, modMachinesList.toArray(new StackableMachines[0]));
        }
    }

And when I call a function on the enum for the first time I get a java.lang.ExceptionInInitializerError: null; But it doesn't even come to the sout; And why is the InInitializerError null.
Any help would be greatly appreciated :D

#

Nvm, figured it out

vast ledge
#

smort

drowsy helm
#

what is "a function"

#

which function?

#

and why not use the constructor instead of a static block

vast ledge
#

what

#

where did you get that from

lost matrix
#

Because the constructor would be called for every enum entry

drowsy helm
#

they're iterating through every value anyway

lost matrix
#

I would still go for lazy initializatzion instead.
Static blocks tend to break the classloader

zealous osprey
quaint mantle
#

by lazy !!

lost matrix
#

Let me give you an example real quick

zealous osprey
#

Thx :D

lost matrix
# zealous osprey Thx :D
@Getter
@AllArgsConstructor
public enum VehicleType {

  CAR(false),
  BICYCLE(false),
  PLANE(true),
  HELICOPTER(true);

  private final boolean flying;

  private static EnumSet<VehicleType> flyingVehicles;
  
  public static EnumSet<VehicleType> getFlyingTypes() {
    if(this.flyingVehicles == null) {
      initializeFlyingVehicles();
    }
    return EnumSet.copyOf(this.flyingVehicles);
  }

  private static void initializeFlyingVehicles() {
    this.flyingVehicles = EnumSet.noneOf(VehicleType.class);
    for(VehicleType type : values()) {
      if(type.isFlying()) {
        this.flyingVehicles.add(type);
      }
    }
  }

}
zealous osprey
#

Ooh, you init whenever you need it, but only once then

lost matrix
#

Yes. This a common trick to increase startup times of applications. Especially in the web space.
Only initialize data the first time its needed.

zealous osprey
#

Fair, but I find that annoying when you have multiple functions and in all of them you'd have to check if the data was init first.

lost matrix
#

Let me write a simple abstraction for that really quick

#

You can simply write a class Lazy<T> which encapsulate this mechanic of containing an uninitialized element
and calling a supplier for the first time it is needed.

public class Lazy<T> implements Supplier<T> {

  private T element = null;
  private final Supplier<T> initializer;

  public Lazy(Supplier<T> initializer) {
    this.initializer = initializer;
  }

  @Override
  public T get() {
    return element == null ? (element = initializer.get()) : element;
  }
  
}

This results in great reusability

@Getter
@AllArgsConstructor
public enum VehicleType {

  CAR(false),
  BICYCLE(false),
  PLANE(true),
  HELICOPTER(true);

  private final boolean flying;

  private static final Lazy<EnumSet<VehicleType>> flyingVehicles = new Lazy<>(VehicleType::fetchFlyingVehicles);

  private static EnumSet<VehicleType> fetchFlyingVehicles() {
    EnumSet<VehicleType> fetched = EnumSet.noneOf(VehicleType.class);
    for(VehicleType type : values()) {
      if(type.isFlying()) {
        fetched.add(type);
      }
    }
    return flyingVehicles;
  }

  public EnumSet<VehicleType> getFlyingVehicles() {
    return flyingVehicles.get();
  }

}
#

Its a bit complicated to understand if you dont have functional programming internalized...

sterile breach
#

Hello, I have a question, for a give command for example, where arguments such as targetpalyer and amount are optional, am I obliged to rewrite the code a little each time?

when there are no args, when there are 1, 2 etc...

is this a good thing? or a bad thing?

zealous osprey
lost matrix
#

I should have renamed that. It refers to the local variable

zealous osprey
#

ahhh, that makes more sense

lost matrix
zealous osprey
#

Ahhh, I think I finally understood

#

yup; Well, yeah, ig. It's good to know and thanks for showing me how this might be used. But I'll worry about smth like that when performance becomes an issue.

lost matrix
#

Its more about stability really. But find your path 🙂

#

My young padawan lol

zealous osprey
#

Stability? You mentioned something about it being more reliable with classloader, but how so?

sterile breach
zealous osprey
zealous osprey
lost matrix
#

You still need array length checks btw

vast ledge
#

can you not do

switch(args.size) {
  case: 1,2,3,4 -> yeet1
  case: 6,9,100,19 -> yeet2
}
lost matrix
#

I would look for an external command library. Spigots is quite crude and ungreatful to work with.

sterile breach
vast ledge
#

AIKAR

#

He has acf

#

its great

lost matrix
#

Im using that as well.
Main problem is the very steep learning curve.

vast ledge
#

dont complain

#

about

vast ledge
#

the class registering itself

zealous osprey
lost matrix
#

Ah i see. The obligatory

new AdminCommand();

line. Not constructor abuse at all ^^

vast ledge
#

Let me abuse

#

my constructor

sterile breach
vast ledge
#

@lost matrix got any suggestions to improve perfomance on this?

lost matrix
#

There... is nothing happening here. Performance wise there is nothing to gain.
Structurally this looks good. One caveat: Your isEnabled variable should be named enabled
and the getter for it should be isEnabled(). Everything else looks clean.

silent steeple
vast ledge
silent steeple
#

This is functional code

#

Boilerplate doesn’t affect performance

lost matrix
# vast ledge

getAllowedMaterials should probably return a Set<Material>
Im assuming that you call contains() on this?

vast ledge
#

What is the difference between set and arraylist

zealous osprey
# vast ledge

Why do you have a setIsEnabled method that sets the value of the config section to the boolean?
Your not changing the value in the enum then

placid moss
#

i.e. all items are unique

zealous osprey
vast ledge
#

it returns the value from config

#

I also want the fallback value

zealous osprey
#

ooh, your isEnable boolean is meant for fallback? Why not make it final then

vast ledge
zealous osprey
#

ahh, now I see that there were 2 bools

lost matrix
#

Sets do not allow duplicates. This comes with the benefit of having very fast contains() implementations.
HashSet for example scales O(1). This means contains is always fast regardless of size.
ArrayList scales O(n). This means it gets linearly worse.
Example could look like this

| N Elements | List.contains() | Set.contains() |
|          1 |             1ms |            2ms |
|         10 |            10ms |            2ms |
|        100 |           100ms |            2ms |
|       1000 |              1s |            2ms |
|      10000 |             10s |            2ms |
lunar wigeon
#

psss. ArrrayList has .get

lost matrix
#

Yes sets are by definition unordered and dont have an index access.
But index access is used very rarely in properly written applications.

#

You need to keep track of those instances yourself.
Use a manager class which contains a Map<Integer, YourEntity> to
keep track of your virtual entities.

lost matrix
vast ledge
#

getFancyName() 😆

lost matrix
#

Catching Nullpointers is something i would strongly advise against

vast ledge
#

My poor console tho

lost matrix
#

Dont get me wrong, you should handle them. Just not by catching them.

vast ledge
#

wdym not catching them

lost matrix
#

try {} catch() {} on NPEs means that you didnt bother handling them

vast ledge
#

Then how do i bother handling them

lost matrix
#

You should check with if(element == null) instead

vast ledge
#

they are generated if there is an error with the json

lost matrix
#

Is that jsonsimple you are using?

vast ledge
#

fixed it

vast ledge
lost matrix
vast ledge
#

duesnt get throw a null pointer thow

lost matrix
lilac dagger
#

is this worth doing over Math.pow(double base, double exponent) that returns a double?
public static int pow(int base, int exponent) { int result = 1; for (int i = 0; i < exponent; i++) { result *= base; } return result; }

lunar wigeon
#

well, yes

vast ledge
#

how do i prevent that from being null

lunar wigeon
#

there has to be method that returns boolean so you can check it

vast ledge
lost matrix
icy beacon
vast ledge
#

but by doing that

#

ill create a nullpointer

icy beacon
#

no

vast ledge
#

master.get

#

can throw nullpointer

icy beacon
#

if master is null then yes

vast ledge
#

if the string im searching for cannot be found

lilac dagger
vast ledge
lilac dagger
#

it was some sort of programming trick for faster time or something

icy beacon
#

master.get(arg)
if master == null, this will throw an NPE
if it's not, it will either return a string or null

lost matrix
#

Probably not worth it

icy beacon
#

so in your case

String something = master.get(something); // also make sure that master != null if you didn't already
if (something == null) {
  bad;
}
JSONObject g = (JSONObject) something;
vast ledge
#

fixedd

lunar wigeon
#

replace return; with continue;

icy beacon
#

true

icy beacon
vast ledge
#

oh

#

i see

icy beacon
#

if master.get() returns null, casting null will throw smth

vast ledge
#

only go over the 1 isntance that has null as the return value, not break the entire loop

lunar wigeon
#

you have to cast it after checking if it's null

vast ledge
icy beacon
#

yes

#

it's casting

sterile breach
#

Hi, on location.tostring, i can reconvert to location?

icy beacon
#

if you cast null i'm pretty sure it'll throw an exception

vast ledge
#

lets try

lost matrix
# lilac dagger i remember somewhere of a way to save on iterations, but i forgot where

Not sure if it works like i intend it to

    public static int power(int base, int exponent) {
      if (exponent == 0) {
        return 1;
      }
        
      int temp = power(base, exponent / 2);
      int result = temp * temp;
        
      if (exponent % 2 == 1) {
        result *= base;
      }
        
      return result;
    }

Hm this saves on iterations for smaller exponents.
Main drawback is that its recursive.
This is for sure faster. Every exponent that would make this slower than a loop
would lead to an overflow anyways.

lunar wigeon
lilac dagger
lost matrix
lunar wigeon
# sterile breach Hi, on location.tostring, i can reconvert to location?
    public static String locationToString(Location location) {
        StringBuilder builder = new StringBuilder();
        return builder.append(location.getWorld().getName())
                .append(":")
                .append(location.getBlockX())
                .append(":")
                .append(location.getBlockY())
                .append(":")
                .append(location.getBlockZ()).toString();
    }

    public static Location locationFromString(String string) {
        String[] splitted = string.split(":");
        return new Location(Bukkit.getWorld(splitted[0]),
                Double.parseDouble(splitted[1]),
                Double.parseDouble(splitted[2]),
                Double.parseDouble(splitted[3]));
    }

for example this.

lilac dagger
#

maybe i can make it non recursive

#

nope, it's a head recursion, hmm

sterile breach
lost matrix
#

In that case you need to serialize it yourself

silent steeple
#

@buoyant viper if ur still trying to make a straight line on ur scoreboard without using &m- try &m─

vast ledge
#

wat da hail

icy beacon
# vast ledge

i think they can be ignored but you can try bumping them to latest versions if they aren't already

vast ledge
#

I cant find the maven-resources-plugin in my pom.xml

zealous osprey
#

Btw, while we are on the topic of coding, efficiency and practices; What is a decent rule of thumb for when to throw exceptions, errors or just return smth like null?

sterile breach
#

Hey, i have a problem, on my serverstop, i loop an array to stock all my data in db, but but it seems to be taking too long, so he spits.

lunar wigeon
#

and nulls when you have to

zealous osprey
#

That's what I've been doing; Internally using null for private stuff, cause I know too expect it, but then exceptions for public stuff

lunar wigeon
#

I mean you can check nulls using standard if statement but java has Optional and its useful sometimes

#

Optional reduces useless if's

pseudo hazel
#

exceptions are annoying anyways

zealous osprey
#

I only use Optionals if I see no other way to show that no value coould be returned

zealous osprey
#

Well... I see their use, as in, "hey, smth has gone wrong and YOU have to deal with it"

vast ledge
#

It doesnt

silent steeple
#

python is so ass

pseudo hazel
#

its the same for nulls

#

but then the language will just throw nullptr exception anyways

#

if we are strictly talking about null pointer checks thats a useless exception to add yourself since it will already be thrown if you fuck it up

#

unless your code can accept nulls as valid values

#

then its on the api implementation to deal with it

#

thats how I see it

pseudo hazel
vast ledge
#

nope

pseudo hazel
#

okay nice xD

sterile breach
# lost matrix In that case you need to serialize it yourself

public static Location serializeLocation(String locationString) {
String[] parts = locationString.split(",");
if (parts.length != 4) {
return null; // La chaîne n'est pas valide
}

    String worldName = parts[0];
    double x = Double.parseDouble(parts[1]);
    double y = Double.parseDouble(parts[2]);
    double z = Double.parseDouble(parts[3]);


    return new Location(Bukkit.getWorld(worldName), x, y, z);
}

is good?

pseudo hazel
#

yes looks good, except this is deserialization

#

if you want to put it into the database, you want it to go the other way around

lunar wigeon
#

I would throw exception instead of returning null

pseudo hazel
#

what exception

onyx fjord
#

probably custom

#

thats what i do

#

so its more clear where to look

#

you could also do optional ofnullable i guess

pseudo hazel
#

at that point just return null xD

onyx fjord
#

why not optional tho

#

with it you are sure nobody's gonna ignore it

pseudo hazel
#

yeah maybe u right..

lunar wigeon
#

you throw exceptions when you really need this method

#

and I guess he really needs to serialize and deserialize it

pseudo hazel
#

well if you dont really need a method then why do you have it

lunar wigeon
#

but some methods accept null's

#

I don't think so he want to accept Location that is null

#

especially if he deserialize it and serialize it

manic crown
#

Idk if this topic is at the right place here, but I´ll ask it anyways...

Goal: PlayerHead before the name in Chat

Problem: ResourcePacks force me to use the pixels at least height 8

  • How can I make it so it is the single pixel that is shown in the chat,
  • My plan is to use special Character negative spaces and ancent to align the pixels correctly
lunar wigeon
#

you probably can't send player head on chat (at least not in one message)

#

but then you can fetch it from for example namemc

#

or gameprofile

wet breach
lost matrix
lunar wigeon
#

yea, unfortunately you can't send itemstacks in chat

#

maybe in future

lost matrix
#

Itemstacks would work in the same manner. Just by using 16x16 pixels and
having an invisible pixel. Keep in mind that this will tank quite a bit.

#

Its better to distribute a resourcepack with item icons which replace characters.
Let me check if i have screenshots from a project i worked on that did this

lunar wigeon
#

that would be awesome

lost matrix
#

Hm i just found this where i used the icons in the tab list

#

Ah and in the lore

#

So its possible just needs a resourcepack

lunar wigeon
#

yea

#

exactly, you need resourcepack

shut mauve
#

Hi, I'm trying to code a plugin, but when I try to put accents in my messages such as é, à è..., it becomes é... I put my projet in UTF-8, but i still have the problem... Has anyone an idea ?

lost matrix
kind hatch
#
<properties>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
lost matrix
#
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
shut mauve
lost matrix
#

Ah gradle

#

Gradle uses utf8 on default iirc

shut mauve
#

Yes, but I've this enconding problem, so I don't know where does it come from

lost matrix
#

Are they weird only in console or also in the client?

lunar wigeon
#

I will send you gradle code

shut mauve
#

They're weird in console & in chat

lunar wigeon
#

mate

lost matrix
tender shard
#

is the file itself also saved as UTF8? open the file and check the bottom status bar

shut mauve
shut mauve
lost matrix
#

Jetbrains IDEs have that info in the bottom right corner

shut mauve
tender shard
#

try adding this to your build file

compileJava.options.encoding = "UTF-8"
#

or this or whatever ```groovy
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}

lunar wigeon
#

yea

tender shard
#

np

#

no idea why it doesnt default to utf8

hazy parrot
shut mauve
#

I've another question, I used to use ChatColor, but it's not depreciated in favor of net.kayori w/ Component.text..., isn't there any other easier methods do format text and colors ?

lunar wigeon
#

kyori provides Component and with components their own color system

#
    private static final LegacyComponentSerializer SERIALIZER =
            LegacyComponentSerializer
                    .builder()
                    .hexColors()
                    .extractUrls()
                    .hexCharacter('#')
                    .character('&')
                    .useUnusualXRepeatedCharacterHexFormat()
                    .build();

    public static TextComponent colored(String text) {
        return SERIALIZER.deserialize(text);
    }

using colored(String text) it will translate your String 🙂 (you can use hex)

shut mauve
#

I use Component.text but when I want to compare e.g. itemStack.displayName and Component.text("smth) it doesn't work

lunar wigeon
#

but Component.text("hi") doesn't color your message

shut mauve
#

yes, but when I add .color(NamedTextColor.DARK_BLUE), it looks like this

[12:56:52 INFO]: TextComponentImpl{content="Team §1blue", style=StyleImpl{obfuscated=not_set, bold=not_set, strikethrough=not_set, underlined=not_set, italic=not_set, color=null, clickEvent=null, hoverEvent=null, insertion=null, font=null}, children=[]}

[12:56:52 INFO]: TextComponentImpl{content="Team", style=StyleImpl{obfuscated=not_set, bold=not_set, strikethrough=not_set, underlined=not_set, italic=not_set, color=null, clickEvent=null, hoverEvent=null, insertion=null, font=null}, children=[TextComponentImpl{content="blue", style=StyleImpl{obfuscated=not_set, bold=not_set, strikethrough=not_set, underlined=not_set, italic=not_set, color=NamedTextColor{name="dark_blue", value="#0000aa"}, clickEvent=null, hoverEvent=null, insertion=null, font=null}, children=[]}]}

lunar wigeon
#

I know

#

I send you code to use

lunar wigeon
shut mauve
lunar wigeon
#

it deserializes String into TextComponent

#

and applies color

shut mauve
#

I'll be able to compare displayName() and my string thx to that ?

lunar wigeon
#

this method just allows you to use COLORS in component

#

default minecraft colors and hex

sullen marlin
#

Sir this is spigot

shut mauve
#

I'm asking for methods to format text, not kyori

lunar wigeon
#

oh

shut mauve
#

I use kyori, but I'm not satisfied

lunar wigeon
#

then use ChatColor.translateAlternateColorCodes('&', "&7your text");

vast ledge
#

ye

lunar wigeon
#

I recommend making utility class for that

vast ledge
#

the simplest way

lunar wigeon
vast ledge
#

Why do you need hex?

lunar wigeon
#

hexes are cool

shut mauve
#

I'm not only looking for colors, I'm looking for compare a .displayName() which gives a Component and a string

lunar wigeon
#

dude you are using paper

placid moss
#

lmao

sullen marlin
#

This is spigot

placid moss
#

?whereami

lunar wigeon
manic crown
lunar wigeon
#

oooor he can use deprecated methods XD

icy beacon
manic crown
#

Yeah, isn´t that what he wants?

icy beacon
#

i don't know i just joined the convo lol

vast ledge
#

@lunar wigeon

lilac dagger
#

md5's components are pretty good

icy beacon
#

thought he'd want colors

lilac dagger
#

you guys should try them

lunar wigeon
#

but I think you can use RGB

#

or Color.decode

young knoll
#

Look at startup logs for errors

#

And then share said error

#

?paste

undone axleBOT
tender shard
#

it would be very handy if you'd show us more than one line

lilac dagger
#

do you have a plugin.yml file?

tender shard
#

also the "Modern"PluginLoadingStrategy is a paper thing

lilac dagger
#

haha

tender shard
#

just paste the full log

#

your class is called me.mcorsen.main.Main

#

but in plugin.yml you used com.mcorsen.main.Main

#

me != com

#

in plugin.yml change "main" to me.mcorsen.main.Main

young knoll
#

It should be in src/main/resources if you use maven/gradle

kind hatch
#

If you're using maven, it goes in the resources folder.
Otherwise it goes in the main directory.

#

Then make sure it lives in the project root.

idle tinsel
#

Hey guys, can someone help me with creating the teams and random team select for my minigame similar to skywars?

echo basalt
#

If you're writing a minigame

#

You should know enough

austere cove
#

Looking at PluginDescriptionFile, this is the pattern used to verify plugin names:

private static final Pattern VALID_NAME = Pattern.compile("^[A-Za-z0-9 _.-]+$");

This pattern allows spaces.

Looking at NamespacedKey, this is the checker for namespaces:

private static boolean isValidNamespaceChar(char c) {
    return (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '.' || c == '_' || c == '-';
}

This pattern does not allow spaces.

This means this would throw an exception right:

Plugin plugin = ...; // Plugin with name with space
NamespacedKey key = new NamespacedKey(plugin, "my-key");
echo basalt
#

Pr time

idle tinsel
austere cove
#

I don't have a stash account xdd

#

I should really get one huh

young knoll
#

Plugins explicitly throw an exception if they have a space in their name

echo basalt
#

Your game should have a team handler which is just a map of that relates what team each player chose

echo basalt
austere cove
#

don't have an environment setup

eternal night
#
if (!VALID_NAME.matcher(name).matches()) {
    throw new IllegalArgumentException("name '" + name + "' contains invalid characters.");
}
name = name.replace(' ', '_');
idle tinsel
austere cove
#

wait did I really miss the next line

echo basalt
#

Yeah so that's just an even distribution

austere cove
#

oh I did that's embarassing

young knoll
#

Ah seems it was changed to replace spaces with _

austere cove
#

pretend I didn't say anything

young knoll
#

It used to throw an error

#

You set the x and z scale to 0

echo basalt
#

List of players, list of teams

tender shard
#

who calls their method "a" o0

young knoll
#

Pre obfuscated

echo basalt
#

Loop through all players and assign the next team

young knoll
#

:p

echo basalt
#

And loop around

young knoll
#

Crazy? I was crazy once

idle tinsel
eternal oxide
#

set as passenger

tender shard
#

it is directly at your feet

shadow night
#

It's just that you are directly in between two blocks

eternal oxide
#

if you want it to follow the player, set as a passenger and apply a translation

icy beacon
#

i'm working on a discord bot that should be working when my server network is working. it's best to tie it together with a bungee plugin, right? so that the bot would be always online except for when the proxy goes down

tender shard
#

then add 0.5, 0, 0.5

icy beacon
#

ty

eternal oxide
#

your math is bad

#

show some code

#

you are using transformations

#

so you should not be adjusting the location

#

don;t bother set it as a passenger

#

yes, then set a translation

#

so?

#

yes

#

yes

#

adjust translation to where you want it

#

no, your origin is zero as its a passenger

#

you translate relative

#

setTansformation(getTranslation... adjust

#

the translation is a vector

#

as a passenger you'll likely only have to adjust the Y component of Translation

#

-1 or -1..5

#

yes it will as it's a passenger

#

you are probably still trying to teleport it

#

thats what the tranformation is for

#

a negative Y vector

worldly ingot
#

Matrix math. How does it work, amirite?

eternal oxide
#

throw numbers at it until it works

hybrid spoke
#

but it doesnt take Number 😔

#

but you can take my number 😏

lilac dagger
#

matrix rotation sucks

round charm
#

Hi, I purchased a resource from Spigot and I'm having an issue where the money is paid but I can't download the resource. Where should I raise an issue?🥲

undone axleBOT
round charm
#

Thank you and have a great day!👏

icy beacon
#

is it possible to limit slash commands in jda to only be accessible specific channels when creating them? or should i just check in SlashCommandInteractionEvent?

twin venture
#

IChatBaseComponent.ChatSerializer.a("{"text": "" + line + ""}");

can i do for example :
Utils.color(line)

#

using nms 1.16.5 , for custom entites

#

want to set the name with colors

unborn sable
#

Would I be able to create a plugin that allows jukeboxes to be ejected by a button?

echo basalt
#

sounds doable

unborn sable
#

I think i know what to do for ejecting a disc, but what would I do to accept a red stone signal input

icy beacon
#

how do i create a thread in jda? can't find much info on that

ivory sleet
#

ThreadChannel

#

ig u can just use IThreadContainer#createThreadChannel

#

but yeah u get a ThreadChannel object

icy beacon
icy beacon
icy beacon
#

actually wait

pseudo hazel
ivory sleet
#

do u know what a MessageChannelUnion is?

icy beacon
#

i can cast it to GuildChannel, ritght?

icy beacon
icy beacon
ivory sleet
#

how does ur code look

#

dont cast it

icy beacon
#

well rn that's it, regarding the relevant part

  override fun onModalInteraction(event: ModalInteractionEvent) {
    if (event.modalId != "appeal") return

    val comment = event.getValue("appeal")?.asString ?: return
    // ???
  }
#

i feel like something can be done with event.channel.asGuildMessageChannel() but i can't see anything

eternal oxide
#

does kotlin allow String comparison with == ?

icy beacon
#

yep

#

it calls equals

eternal oxide
#

I know its not valid in Java

icy beacon
icy beacon
eternal oxide
#

k

#

odd

icy beacon
#

oh wait

#

event.channel.asTextChannel().createThreadChannel()

#

this should be good

ivory sleet
#

yea

#

well

#

its problematic still

icy beacon
#

why so?

ivory sleet
#

since it may not be a TextChannel

icy beacon
#

ah, well i can always check beforehand, right?

ivory sleet
#

yes

#

getType() == TEXT

icy beacon
#

yup

#

and another question, is there any way to retrieve the title of the modal from ModalInteractionEvent? all i have is a modalId and I do not know if it's possible to get a modal from its id

ivory sleet
#

getInteraction()

#

no?

icy beacon
#

that returns a ModalInteraction and i don't see anything in ModalInteraction that returns modal/title

#

actually, this is an xyproblem probably, so i basically want to pass information received in SlashCommandInteractionEvent into the modal, so that it can also be treated in ModalInteractionEvent, and my first idea was the title, but maybe there are other ways

#

now that i think of it, i probably don't need to pass it into the command

#

i can just make fields in the modal

#

yeah

#

that works

vast ledge
#

My Furnace is pathfinding a way to the block above it

#

help

sage dragon
#

Is there an event that fires when a shrieker is activated?

#

I found the BlockReceiveGameEvent, but that isn't fired for Shriekers, right?

sage dragon
lavish hemlock
# wet breach Coroutines for kotlin only work if you use kotlin jvm

Kotlin does not have a special JVM. If you mean their compiler, then yes, but this is kind of pointless to bring up since I didn't say that you could use Kotlin coroutines without using Kotlin (after all, anyone with experience with them knows that suspend is a compiler feature)

lavish hemlock
lunar wigeon
tender shard
hazy parrot
#

===

tender shard
#

lol well ok

lavish hemlock
#

And while yes the JDK 21 project does say they're adding virtual threads, that's not available to anyone yet.
Additionally the point I was trying to make is that Java, in its current state, for most people, makes it hard to work with coroutines.

#

(I do wonder how many goddamn previews their memory/FFI API has to go through though)

#

Oh shit they're adding string templates, okay.

sterile breach
#

hello, have a question, on my plugin I need to load all the content of my db in a map and put it back / update it in the db when the server stops and every 5 min.

but over time imagine that I have 15000 lines to load it will no longer be possible if?

young knoll
#

Why do you need to load it all

eternal oxide
#

preload and only save changes

#

or don't load until you need it

tender shard
#

damn the compile result of coroutines is pretty ugly

sterile breach
eternal oxide
#

good luck keeping all those block locations/data in memory

#

at least load/unload on chunk load/unload

sterile breach
#

Bad thing ?

#

So, how to do?

eternal oxide
#

no point in keeping block locations in memory for chunks that are not loaded

hazy parrot
# tender shard

Try making suspending function, wonder if results would differ

sterile breach
eternal oxide
#

no, on chunk load

#

there is no on enter

#

you can also be in one chunk and break blocks in another

eternal oxide
#

so only load data for chunks as they load

lavish hemlock
sterile breach
eternal oxide
#

you need to loop all loaded chunks in onEnable to load data, then load your data in the chunk load event too.

#

drop/save your data in chunk unload

sterile breach
#

Just load all at server start in asynchrone is bad ?

eternal oxide
#

no thats fine

sterile breach
#

So i can?

echo basalt
#

enterprise code go brr

eternal oxide
sterile breach
eternal oxide
#

Yes its ok to load your data async

sterile breach
eternal oxide
#

You were having problems understanding what I was saying

#

Wanted to find out if it was age, language or trolling.

shadow night
#

Looks like he is using a translator to me schnitzel

eternal oxide
#

seems so

sterile breach
eternal oxide
#

^ I never said loading your data async was bad. Which is why it seemed you were confused

sterile breach
#

You advised against it, saying that priority should be given to "chunk loading"

sterile breach
eternal oxide
#

In onEnable loop all loaded chunks and (async) load your data for those chunks.
in ChunkLoadEvent load any data you have for that chunk.
in ChunkUnloadEvent save any data which has changed and unload all junk data for the unloading chunk

tender shard
tawdry echo
#

How to create an invisible glowing slime and stretch iton a region to mark it for the player for a few seconds?

young knoll
#

You can only increase it's size

#

Which expands it in all directions

eternal oxide
#

Display Entity has a scale

pseudo hazel
#

why make it invisible

young knoll
#

^ Display entities are a much better option

lapis schooner
#

Hello good people,
Might I enquire how would one sneak own ChannelDuplexHandler into a connection pipeline to sneak on the packers sent to the client? Since the NetworkManager in PlayerConnection is private upwards of version 1.19 I know not of a way to access it

tawdry echo
#

BlockDisplay?

pseudo hazel
lapis schooner
tender shard
#

if it's private, you can only use reflection

lapis schooner
#

Welp, ok then. Thank u

quaint mantle
#
for (Player player : players.getPlayers()) {
            (((CraftPlayer)player).getHandle()).playerConnection.sendPacket((Packet)packet);
            (((CraftPlayer)player).getHandle()).playerConnection.sendPacket((Packet)new PacketPlayOutEntityVelocity(entityfallingblock.getId(), x, y, z));
        }```
```yaml
Cannot find symbol```
#

so im getting the error "Cannot find symbol"

eternal oxide
#

?nms

tender shard
#

but yeah you are not using mojang maps

#

or you are but your code doesn't

#

?switchmappings

quaint mantle
#

hmm

#

thats into maven right

eternal oxide
#

we need an ?alexindex 🙂

lapis schooner
quaint mantle
#

just clariyfing

tender shard
#

are you using gradle? did you already set up mojang mappings or NMS in the first place?

#

what even is the symbol that it cannot find?

#

you either did not correctly import NMS classes in the first place, or you used remapped-mojang but are still trying to use spigot mappings

#

if it's the first: see first link
if it's the second: see second link

icy beacon
#

how do i mention a role with JDA without it looking awkward? i currently just do "<@$roleId>"

quaint mantle
#

prob its the first one

#

didnt do the mapping

tender shard
#

it would be very helpful if you could start by showing the full error you get

quaint mantle
#

thats all it said

#

highlighted .getPlayers

tender shard
#

well what even is "players"?

quaint mantle
#

I have 0 clue

tender shard
#

wow

quaint mantle
#

trying to fix up an abonded project

#

got everything up but

#

.getPlayers()

icy beacon
#

thx

tender shard
quaint mantle
#

alr lemme check

#
public static void sendVelocityBlock(Location loc, Material mat, byte data, World players, Integer delay, Vector vec) {
        WorldServer worldServer = ((CraftWorld)loc.getWorld()).getHandle();
        EntityFallingBlock entityfallingblock = new EntityFallingBlock((World)worldServer);
        entityfallingblock.setLocation(loc.getX(), loc.getY(), loc.getZ(), 0.0F, 0.0F);
        PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity((Entity)entityfallingblock, 70, mat.getId() + (data << 12));
        double x = vec.getX();
        double y = vec.getY();
        double z = vec.getZ();
        for (Player player : players.getPlayers()) {
            (((CraftPlayer)player).getHandle()).playerConnection.sendPacket((Packet)packet);
            (((CraftPlayer)player).getHandle()).playerConnection.sendPacket((Packet)new PacketPlayOutEntityVelocity(entityfallingblock.getId(), x, y, z));
        }
        SUtil.delay(() -> removeBlock(entityfallingblock, players), delay.intValue());
    }
#

SUtil

tender shard
#

"players" must be a field

#

oh wait

#

wtf

#

"players" is a world

#

why is the world called players

quaint mantle
#

nope got nothing

ivory sleet
# lapis schooner M?

((CraftPlayer) target).getHandle().connection.connection.channel gives u the netty channel

#

then just inject

quaint mantle
#

o

#

that is

#

spigot 1.20

#

and im on

#

1.18

#

dang my servers gonna die

tender shard
#

getPlayers has existed for ages

quaint mantle
#

how does it work tho

lapis schooner
tender shard
#

how does what work?

#

even in 1.8.8, World#getPlayers() exists

quaint mantle
#

Cannot resolve symbol 'player'

#

whats with this

tender shard
undone axleBOT
tender shard
ivory sleet
#

weird

tender shard
eternal oxide
#

it changed

ivory sleet
#

in 1.20 it works just fine

#

against paper

tender shard
#

?whereami

lapis schooner
lapis schooner
tender shard
#

yes in 1.19.2

#

but not in recent versions

eternal oxide
#

nope

tender shard
#

1.19.4 made it private

eternal oxide
#

1.19.2 was the last time I saw it public

tender shard
#

1.19.3 its still public

#

just checked

eternal oxide
#

k

shadow gazelle
#

Are teams still the preferred method for hiding nametags?

tender shard
#

I think so

lapis schooner
lilac dagger
#

network or something became private

echo basalt
#

17 interfaces, 8 abstract classes and 70 regular classes

#

I wonder if I'm going overboard with interfaces

quaint mantle
#

hi
how can i create a holograms (im using dh holograms) for show the timing remaining to a mine spawn with realmines

#

[INFO] Replacing original artifact with shaded artifact.
[INFO] Replacing D:\STUFF\189server\plugins\Spectaculation-0.2-SNAPSHOT.jar with C:\Users\xxx\Downloads\Skyblock-main\Skyblock-main\target\Skyblock-0.2-SNAPSHOT-shaded.jar

#

any reason this happens?

tender shard
#

because you're using the maven-shade-plugin

#

and have declared an execution for it, probably during package

#

the question should rather be, why did you use a totally different name for the .jar

lapis schooner
lilac dagger
lapis schooner
#

Every class and every method has to have an interface of it

echo basalt
lilac dagger
#

and bridges

tender shard
#

and blackjack

echo basalt
#

I do have an adapter somewhere

lilac dagger
#

good enough

echo basalt
#

but it's getting funky

#

got the biggest headache lmao

quaint mantle
#

is it me or do some images just appear blur when I click on them

echo basalt
#

might be the resolution

tender shard
#

looks fine to me

echo basalt
#

Because my monitor's 2k and it might be downscaling

#

first pic looks blurry on my 1080p monitor

#

And I also have really strong contrast settings on my 2k monitor which means sharex might be tripping

tender shard
#

looks fine

#

here too

echo basalt
#

mans flexing his 4k screen

#

I do want to get one

#

but I'm not in the right financial situation for that

lilac dagger
#

mac looks so fancy

eternal oxide
#

2k is plenty

tender shard
eternal oxide
#

I already use 120% on everything at 2k

echo basalt
#

I paid mad money for my 17 inch 1440p 16:10 screen on my laptop

#

Was nice for coding in class

#

but now I'm done with school

tender shard
#

only time I've seen a school from inside during the last 10 years was once when I was drunk and visited my old school, and when there's elections going on

shadow gazelle
eternal oxide
#

I use a 32" 1440

echo basalt
#

ayy reached 30 stars

shadow gazelle
#

I looked at my mod that other day and it had 41k downloads lmao

echo basalt
#

bruh

tender shard
#

probably you also have to set the "general" visibility or sth

lilac dagger
#

don't you need protocollib?

tender shard
#

i would just use TextDisplays for holograms btw

shadow gazelle
echo basalt
#

well

#

sometimes it helps

lilac dagger
#

i'm pretty sure you do for per player stuff

shadow gazelle
#

Well, holographic displays maybe since it requires it if I remember correctly

echo basalt
#

but sometimes

#

There's native API for setting entity visibility in bukkit

#

But no native api for per-player metadata

tender shard
echo basalt
#

maybe wait a tick

#

holodisplays wack

tender shard
#

idk, never used holographic displays

#

i always use armorstands or textdisplays

lunar wigeon
#

I recommend using decentholograms

#

🙂

echo basalt
#

never expected that to work lmao

#

I need sunlight exposure, might go our for a walk

eternal oxide
#

I live in the UK. I miss the sun.

echo basalt
#

I live in a coastal city

#

but I honestly can't focus on anything rn

#

and got a weird headache so I might just go out for a walk

eternal oxide
#

we get about 4 weeks of sun, and 47 of rain

echo basalt
#

it's the opposite here

#

Like 5 days of rain per year

#

and summer for the other 360 days

shadow gazelle
#

How should I make a countdown?

lunar wigeon
#

using HashMap or Cache and System.currentTimeMillis

quaint mantle
#

for database
is it a small query that happens every second
or is it a big query that happens every hour?

shadow gazelle
#

no

quaint mantle
#

wut

#

to me ?

shadow gazelle
#

yes

#

it's not for a db

quaint mantle
#

wydm

shadow gazelle
#

just a countdown from whatever amount that sends a message every second

quaint mantle
#

i ask for myself

#

btw

shadow gazelle
#

???

tall dragon
#

?scheduling

undone axleBOT
quaint mantle
#

for database which one am i need use ?

  • is it a small query that happens every second?
  • or is it a big query that happens every hour?
shadow gazelle
tall dragon
ancient plank
#

Think about it, and you'll find your answer

tall dragon
#

by cancelling it

#

its all on the page

ancient plank
tall dragon
#

haha yes it is

ancient plank
#

Dark blue, dark green, and black against a dark gray background

echo basalt
#

When a player joins, do a query, fetch their data, save once in a while

#

and when the player quits you save once more and remove from the cache

quaint mantle
#

is it necessary ?

echo basalt
quaint mantle
#

ah this smiley 😄

cinder abyss
#

Hello, is there an easy way to store a persistent data in a Block ?

tender shard
#

?blockpdc

undone axleBOT
cinder abyss
#

okay thanks

quaint mantle
lunar wigeon
#

you can also use metadata

tender shard
#

metadata is not persistent

cinder abyss
cinder abyss
# tender shard ?blockpdc

I want to make custom blocks using ItemDisplay (packet-based) and I need to identify the block inside the ItemDisplay (to resend the custom block after a restart for example)

tender shard
#

but itemdisplays are entities and hence already implement PersistentDataHolder

cinder abyss
tender shard
#

aah yeah

cinder abyss
#

so I can't retreive it after a restart

tender shard
#

then you can just use CustomBlockData

cinder abyss
#

'cause that's useful

quaint mantle
#

Cannot resolve method 'getPlayers' in 'World'

#
for (Player player : players.getPlayers()) {
            (((CraftPlayer) player).getHandle()).playerConnection.sendPacket((Packet) packet);
            (((CraftPlayer) player).getHandle()).playerConnection.sendPacket((Packet) new PacketPlayOutEntityVelocity(entityfallingblock.getId(), x, y, z));
        }```
#

what I did wrong

eternal oxide
#

getPlayers() exists in World.

#

your players variable can;t be a world

tender shard
#

Or wrong import

eternal oxide
#

for a start name it world if it IS a world

tender shard
#

Or they are using bukkit 1.2 or sth lol

eternal oxide
#

true

quaint mantle
#

hi ElgarL

eternal oxide
#

hi

tender shard
#

Hello elgar

eternal oxide
#

hi too

quaint mantle
#

they said i need use uuid in hashmap for save datas at offline server
i got my reply but i wonder ur reply
why i can't use player in offline server?

#

im not offline player

#

i just wonder

eternal oxide
#

uuid is persistent. Player is not

quaint mantle
#

but in offline server

#

player isnt persistent ?

eternal oxide
#

if the player relogs the current Player object will not be valid

#

a new one is created

chrome beacon
#

Offline mode?

eternal oxide
#

use UUID and get a Player when you need it

shadow night
#

Wait, in offline mode servers, is the uuid a random uuid or the actual uuid of the player? schnitzel

eternal oxide
#

its a UUID based upon their name in offline mode

shadow night
#

And that means? schnitzel

quaint mantle
eternal oxide
#

if two players log in with the same name at different times they use the same UUID

shadow night
#

But is the UUID the UUID the player with that name would usually have in online mode? Sorry for me being stupid schnitzel

eternal oxide
#

no

#

its somethign like UUID.fromString("OfflinePlayer:" + name)

#

online UUID is assigned by Mojang and has no relation to a players name

#

an online UUID is always the same for an account

shadow night
#

Hmm, but is it possible to change the uuid of a player before they are logged into the server fully? I don't have any use for this, just curious schnitzel

eternal oxide
#

if using bungee, yes

quaint mantle
#

How does spigot work with offline uuid?

#

how does it perceive

lilac dagger
#

nothing more

shadow night
eternal oxide
#

probably not.

#

as the UUID doesn't come from the client

twilit roost
#

heY!
I just realized that spigotmc supports only x mb of plugin size
but my plugin needs to have some stuff shaded

is there some way to upload it and bypass the limit?

eternal oxide
#

in thoery you could assign yoru own ids

shadow night
#

Hmm, ig. Well, I don't really know what to use that info for anyways lol schnitzel

eternal oxide
twilit roost
hazy parrot
twilit roost
#

oh!
oke
tysm

hazy parrot
#

And inside of your pom change scope to provided

shadow night
#

Hmm, wait. Could you in theory make a plugin that would allow offline mode people to join an online mode server? schnitzel

quaint mantle
#

What do u prefer for caching and save player data ?

on left the server save datas from hashmap
or save datas from hashmap every 1 hour ?

eternal oxide
#

In thoery you can replace all teh minecraft server code and do whatever you want

hazy parrot
#

I mean yes, if you change server code lol

shadow night
#

But as far as I'm concerned of spigot got no mixins schnitzel

#

Time to switch to sponge lol schnitzel

quaint mantle
#

😄 why u use schnitzel ?

shadow night
#

It is my religion schnitzel

hazy parrot
#

Fair enough

shadow night
#

I'm a follower of the great and holy, of the schnitzel schnitzel schnitzel

quaint mantle
#

am i save player data on left server

#

or every 1 hour ?

eternal oxide
#

what data specifically?

shadow night
#

Well, I would do both to make sure the data is safe schnitzel

quaint mantle
eternal oxide
#

do you need access to that offline?

quaint mantle
#

wydm for offline

#

offline mode ?

shadow night
#

Offline player ig schnitzel

eternal oxide
#

no, when the player is not logged in

quaint mantle
#

actually i will get this

#

but for bungeecord

eternal oxide
#

ok

quaint mantle
#

@eternal oxide if u wanna

#

wait

eternal oxide
#

then save when log out and every x minutes

quaint mantle
#

i will explain u better? my project