#help-development

1 messages ยท Page 823 of 1

lost matrix
#

Ah didnt catch that they added this

eternal night
#

idk if the API is updated for that tho

#

set implies it overwrites

#

are you running paper ?

#

from the looks of it, spigot just consideres "set" to be "add" now

#

paper drops any other resouce pack when running set

patent quarry
#

Uhh ? yeah I have paper, I thought it worked the same as Spigot, I will test ty

eternal night
#

Yea I mean, difficult discussion on those methods

#

spigot basically breaks their old API by not "unsetting" old resource packs.
Paper breaks their spigot API compat by not breaking spigots old api

patent quarry
#

I see :/

eternal night
#

yea its annoying kekwhyper could have just added addResourcePack and dropResourcePack but welp

patent quarry
eternal night
#

I mean, yea that is unload

#

setResourcePack is still technically incorrect now, naming wise at least

#

and obviously behaviour wise

#

like, most simple breaking is like a /resourcepack command or whatever that allows a user to pick their pack.
When they switch from one to another, plugins using SetResourcePack before 1.20.3 would be fine, properly unloads the old one.
Now it keeps the original one and you gotta pray that the second one is fine merged on top of the first one.
Which like, yea gg breaks the behaviour.

grim hound
#

.

young knoll
eternal night
#

Yea I know there was an issue for this

young knoll
#

Idk if it;s worth deprecating just to change it to add

eternal oxide
#

surely there should be two now

eternal night
#

there is 100% a need to just "hey, this is ALL you have now"

#

its a bit annoying with all the overloads tho

#

maybe worth to look into something along the lines of ResourcePackAdditionRequest that just holds all the values

young knoll
#

true

scenic onyx
#

?paste

undone axleBOT
scenic onyx
minor junco
#

Hello. I need help on spigot 1.19.4:

online.setDisplayName(team.getTeamEnum().getChatColor() + player.getName());

When applying ChatColor to my player's displayName I get an exception (any ChatColor for that matter). Following is the error:

 Chain link failed, continuing to next one
java.lang.IllegalStateException: Missing key in ResourceKey[minecraft:root / minecraft:chat_type]: ResourceKey[minecraft:chat_type / minecraft:raw]
        at net.minecraft.core.IRegistry.e(SourceFile:88) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
        at net.minecraft.network.chat.ChatMessageType.a(ChatMessageType.java:59) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
        at net.minecraft.network.chat.ChatMessageType.a(ChatMessageType.java:49) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
        at net.minecraft.server.network.PlayerConnection.chat(PlayerConnection.java:2121) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
        at net.minecraft.server.network.PlayerConnection.b(PlayerConnection.java:2189) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
        at net.minecraft.server.network.PlayerConnection.lambda$17(PlayerConnection.java:1895) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
#

when I do not set a color in the displayName the error disappears

proud badge
#

how come its saying it will produce a nullpointer if im checking if theyre online beforehand

icy beacon
#

Your IDE does not know that "isOnline()" is the same as "is not null"

proud badge
#

Rip

icy beacon
#

Just add a null check too

#

Won't hurt

proud badge
#

if I add a nullcheck the IDE says that its redundant since OfflinePlayer is never null

icy beacon
#

Bukkit.getPlayer(target.getName()) can be

#

It literally says that

hazy parrot
#

you can just call target.getPlayer()

ivory sleet
#

Id prob throw AssertionError or sth if said thing is null

icy beacon
proud badge
#

ok thx

icy beacon
#

Iirc

#

The docs should say that

ivory sleet
#

in theory, Bukkit::getPlayer ought not to be null at that point, or am I missing something?

proud badge
#

how about converting PLayer to OfflinePLayer?

icy beacon
#

Why

proud badge
#

.getOfflinePLayer doesnt exist

icy beacon
#

Precisely why

ivory sleet
#

you mean OfflinePlayer::toPlayer ?

proud badge
#

because my hashmap uses OfflinePlayer

hazy parrot
#

(OfflinePlayer) player

proud badge
#

so I cant use command sender

ivory sleet
eternal night
#

uuid shivering in fear

hazy parrot
#

you should really use UUID

icy beacon
#

^^^^^^^^^^

proud badge
#

true

ivory sleet
#

very true

proud badge
#

I didnt use Player because Player becomes null once they log off

ivory sleet
#

no it doesnt

icy beacon
#

Just use uuid dude

proud badge
#

I guess I could use uuid

icy beacon
ivory sleet
#

but the Player object gets a lot of invalid state

icy beacon
#

It doesn't "become null"

#

Yeah

glossy venture
#

https://paste.md-5.net/uyacefeday.java
yo anyone experienced with streams understand why the output is coming out unsorted? when i call findAll on the datastore it will stream the current list of cached items. it will then request mongodb for an iterable matching the given query and stream that, then concat that to the stream of cached items. when sort is called, it instructs mongodb to sort the iterable on the server but also the stream to be sorted as a whole through CachedStreams.sortStream. this should now give us a sorted stream when a terminal operation is called but calling forEachOrdered gives a mostly unsorted result. i have confirmed the getFastOrderCoefficients method works as intended on cached items

#

ok interestingly removing the projection(...) call it works so it might have something to do with the fact that the data is partial

proud badge
#

when should I use UUID and when should I use OfflinePlayer

hazy parrot
#

if you store something, i would always use uuid

icy beacon
#

If you are storing it use uuid

inner mulch
#

I'm currently trying to create custom items, i cannot implement an interface to the already existing itemstacks to mark them as a custom item. Is there a good way to mark them other than marking them in the persistentdatacontainer of the item and checking each event whether its custom or not?

hazy parrot
#

what is wrong with pdc ?

inner mulch
#

theres nothing wrong with it, it just feels nooby to me to check on every event if theres a specific item container attached

#

if its the best way im fine with it, i just felt like a noob doing it like this

chrome beacon
#

Using PDC is the best way

slender elbow
#

far from nooby

river oracle
#

pdc is the best

slender elbow
#

it's what you should be using to identify items

river oracle
#

it makes me whole inside

inner mulch
#

okay, thank you guys

#

i will be using this

river oracle
#

almost as whole as Inventory PR it's that great!

inner mulch
#

Inventory PR?

glossy venture
#
00000000-0006-02d3-0000-000001e89640, deaths: 3 = fetched(DataItem(00000000-0006-02d3-0000-000001e89640 = MongoDatastoreExample.Stats(uuid=00000000-0006-02d3-0000-000001e89640, kills=0, deaths=5)))
#

wtf?

#

the stupid deaths field changed

#

how

#

OH

#

WAIT
i

#

im sutpdi

river oracle
inner mulch
#

i dont understand i thought pr is hitting 1 rep bench in the gym?

icy beacon
#

pull request

inner mulch
#

pull request?

icy beacon
#

pull request

inner mulch
#

no

#

what is that?

icy beacon
#

?google

undone axleBOT
icy beacon
#

?bing

undone axleBOT
inner mulch
#

why?

icy beacon
#

to not waste time perhaps

inner mulch
#

but if you bring it up and know the answer why do i need to google it

icy beacon
inner mulch
#

i dont know what to google when you just say "pull request"

icy beacon
#

uhh

#

try googling pull request

slender elbow
#

"what is a pull request" is a great starting point

inner mulch
#

i googled and i dont understand

#

:

#

(

hazy parrot
#

it proposal to add some changes or additions to existing codebase

inner mulch
#

ok

glossy venture
#

this took so long

#

and its probably so slow

#

but it works

quiet ice
#

Does anyone happen to know if you can call constructors explicitly via unsafe?

alpine urchin
#

you dont wanna use reflection?

quiet ice
#

Or, worse yet, whether

NEW MyObject
DUP
DUP
INVOKESTATIC OtherClass.consume(LMyObject;)V
INVOKESPECIAL MyObject.<init>()V
[...]

works

quiet ice
#

I probably didn't grasp what DI is, but whatever.

#

And no, reflection does not allow such behaviour last time I checked

slender elbow
#

uh that looks very sus, why pass an unconstructed object around? that isn't exactly legal afaik (e.g. if you're gonna call methods or access fields)

minor junco
quiet ice
#

I know that I cannot use uninitialized objects in the constructor until I invoke the constructor of the superclass (unless it is for putfield).

slender elbow
#

well no, not even for putfield because it requires this which doesn't really exist yet

minor junco
#

What exactly do you want to achieve with just calling the constructor, when the object itself must be existing so the this pointer can be passed

#

I don't understand

#

You need to allocate the object before calling the constructor, otherwise you'll get messy results

quiet ice
# slender elbow well no, not even for putfield because it requires `this` which doesn't really e...

Well

  public org.stianloader.test.smatterdi.generated_ExampleInjectionTarget_0(org.stianloader.smatterdi.InjectionContext);
    descriptor: (Lorg/stianloader/smatterdi/InjectionContext;)V
    flags: (0x0001) ACC_PUBLIC
    Code:
      stack=3, locals=2, args_size=2
         0: aload         0
         2: aload         1
         4: putfield      #7                  // Field generated_context_1702214921568:Lorg/stianloader/smatterdi/InjectionContext;
        18: aload         0
        20: invokespecial #24                 // Method org/stianloader/test/smatterdi/ExampleInjectionTarget."<init>":()V
        23: return

does work

#

It isn't valid java source code, but it is valid java bytecode

slender elbow
#

sounds like a bug

#

although you'd think they'd catch that like every other thing that requires this before the super call

#

unless you're running with noverify which lulw

quiet ice
#

Well the verifier does complain about

         7: aload         1
         9: ldc           #2                  // class org/stianloader/test/smatterdi/generated_ExampleInjectionTarget_0
        11: aload         0
        13: invokeinterface #28,  3           // InterfaceMethod org/stianloader/smatterdi/InjectionContext.autowire:(Ljava/lang/Class;Ljava/lang/Object;)V
        18: aload         0
        20: invokespecial #24                 // Method org/stianloader/test/smatterdi/ExampleInjectionTarget."<init>":()V

So I do not think that I have somehow disabled it

quiet ice
#

Basically what I intend is follows:

final class generated_MyRootObject extends MyRootObject {
  private final InjectionContext ctx;
  public generated_MyRootObject(InjectionContext ctx) {
    this.ctx = ctx;
    ctx.autowire(this);
    super();
  }

  public final MyChildObject getChild0() {
    return this.ctx.getInstance(MyChildObject.class);
  }
}
@Autowire
abstract class MyRootObject {
  private final MyChildObject child = this.getChild0();

  @Inject
  protected MyChildObject getChild0();
}
class MyChildObject {
  MyChildObject(MyRootObject root) {
  }
}
#

Basically the issue is that I have a circular dependency. Most would say "don't have circular dependencies", but I personally find that not very user-friendly and a system should have a way to resolve most benign circular dependencies.

quaint mantle
#

Imagine using numbers when naming methods

quiet ice
#

Appending methods with 0 is convention for "this is internal" or "this thing is stuff in native space" or "this relies on magic"

quaint mantle
quiet ice
#

Java often uses method0() for uncached calls. Where a call to method() is cached

quaint mantle
#

So, native call method0 instead of method?

slender elbow
quiet ice
#

Neither a) nor b) Isn't possible unless I were to modify the constructor of the original class, at which point we wouldn't have this discussion. But it appears as if that is the only real solution unless I go nuclear with nonstandard ways of solving this problem

quaint mantle
vague swallow
#

Hi, does anyone have an idea why event.isShiftClick() of the InventoryClickEvent doesn't return true, even if it was a shift click?

quiet ice
quaint mantle
#

Wait

vague swallow
neat wolf
#

hey is anyone available to help me? (bungeecord problem)

#

so that I don't pose my problem unnecessarily

quaint mantle
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

neat wolf
#

"so that I don't pose my problem unnecessarily"

young knoll
subtle folio
#

just ask lol

vague swallow
vague swallow
quaint mantle
#

hmm

neat wolf
#

I have already prepared the explanation of my problem I don't just want to send it if no one is available to help me

subtle folio
#

creative guis bane of the existence

neat wolf
#

I am currently sending a plugin message from bungeecord to spigot this way. The spigot server receives the message but from a player (I suppose random)

I was wondering if there was a way to specify the player to whom we would like to send the message plugin

Bungeecord Sending Message Code :

        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream);
        try {
            dataOutputStream.writeUTF(swiftLoginBungee.getMainConfiguration().getToken());
            String type = swiftPlayer.isLogged() ? "AUTHORIZED" : (swiftPlayer.isRegistered() ? "LOGIN" : "REGISTER");

            dataOutputStream.writeUTF(type);
            dataOutputStream.writeUTF("none");
            dataOutputStream.writeUTF("");
            serverInfo.sendData(SwiftLoginImplementation.CHANNEL_MESSAGE, byteArrayOutputStream.toByteArray());
            return true;
        } catch (IOException e) {
            player.disconnect(new TextComponent("An error occurred! cannot send your data to the server!"));
            throw e;
        }

Spigot receiving mesage code :

       @Override
       public void onPluginMessageReceived(String s, Player handler, byte[] bytes) {

Basically when I receive my plugin message from spigot I would like the player of the onPluginMessageReceived function to be the one I specified on bungeecord
That would help me a lot

vague swallow
icy beacon
#

You can't handle them like you want to handle them in 90% situations

#

In particular player inv gui

vague swallow
#

it's supposed to be for survival and adventure anyway

#

Thanks very much

quiet ice
# quiet ice Or, worse yet, whether ```jvms NEW MyObject DUP DUP INVOKESTATIC OtherClass.cons...

It does not.

Exception in thread "main" java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    org/stianloader/test/smatterdi/generated_ExampleInjectionTarget_0.$generated_smatterdi_getInstance$(Lorg/stianloader/smatterdi/InjectionContext;)V @8: invokeinterface
  Reason:
    Type uninitialized 4 (current frame, stack[3]) is not assignable to 'java/lang/Object'
  Current Frame:
    bci: @8
    flags: { }
    locals: { 'org/stianloader/smatterdi/InjectionContext' }
    stack: { uninitialized 4, 'org/stianloader/smatterdi/InjectionContext', 'java/lang/Class', uninitialized 4 }
  Bytecode:
    0000000: 1900 1202 bb00 025b b900 1f03 0059 b700
    0000010: 09b0      
warm mica
#

and parse it

neat wolf
#

yeah I know my problem was solved in the thread

#

thanks anyway

blazing ocean
#

hi, im not sure if this is a good place to ask but, how can I have different textures for each tnt stage?

#

or would I just use different blocks

warm mica
winter galleon
#
                    scheduler.runTaskLater(plugin, () ->{
                        Bukkit.broadcastMessage("aa"); }, 40L);```
why its not working
quaint mantle
#

wdym

#

Do method called when you spawn task?

neat wolf
#

give the whole code

river oracle
#
public record Example(List<String> arbitrary){}

If you put a list in a record like above does it return a copy?
e.g.

List<String> arbitrary = example.arbitrary();
arbitrary.add("some string"); // this doesn't modify the record's list but the copy returned??
quaint mantle
#

override getter method i think

carmine mica
#

or you can add the initializer thing and copy it from the input param, so that it stores a copy

#

the

public Example {
  arbitrary = List.copyOf(arbitrary);
}

thing

quaint mantle
river oracle
carmine mica
#

but depending on what you are doing, creating a fully copy on each invocation of the method might not be needed. making 1 copy at the start could be enough

#

(and its immutable)

river oracle
#

yeah gonna go with the single copy

#

won't need to add anything to these lists anyways so returning an immutable copy should do

carmine mica
river oracle
carmine mica
#

well it just runs the initializer (idk if that's what it is called) and uses the paramters afterwards for the constructor

river oracle
#

ahhhk

carmine mica
#

this is where you would put Preconditions or Validates as well

#

stuff you want to run on all creations of the record

glossy venture
#

idk if i understand what u mean

#

prob not with unsafe but methodhandles maybe

orchid gazelle
quiet ice
#

You can just call it via a methodhandle?

glossy venture
#

resolve the method with invokespecial

glossy venture
#

maybe using the internal lookup

molten hearth
#

sun.misc.unsafe my beloved

glossy venture
#

idk of a way to call methods via unsafe but method handles would be the closest thing prob

#

u could try it

quiet ice
#

You cannot use findSpecial as per it's javadocs and findConstructor does not allow to set a specific instance to call it on

quiet ice
grim hound
grim hound
#

Class#getDeclaredConstructors?

glossy venture
dry hazel
grim hound
quiet ice
#

Well I think it is pretty confusing for most if you suddenly remove the constructor

dry hazel
grim hound
grim hound
dry hazel
#

and how does that help him

grim hound
quiet ice
#

I want to call the constructor at a later date basically

grim hound
#

the Constructor object

dry hazel
#

he wants an uninitialized object that was made without calling a constructor, and then call the constructor later when stuff is autowired I presume

quiet ice
#

I want to basically do follows:

MyClass instance = Unsafe.allocateInstance(instance);
consumer.accept(instance);
instance.<init>(); 
grim hound
river oracle
#

you can load an instance without using the constructor my mans

#

Idk how to do it with Unsafe but ik its possible

quiet ice
#

No, I just want to perform logic before calling the super-constructor

quiet ice
#

But I still wouldn't be able to call the (super-)constructor later on

#

Yes I could bypass the constructor in it's entirety, but at that point I might use class redefinition shenanigans instead to inject the logic at the head of the super-constructor

eternal oxide
#

why not do it in a static block then?

#

runs before constructor

quiet ice
#

I would not have this available.

dry hazel
#

I think just redefining the class would be the least cursed way

eternal oxide
#

yeah redesign what you are doing

#

an initialization blocks run before the constructor too

quiet ice
dry hazel
#

no

eternal oxide
#

no

quiet ice
#

Well I figured that I could simply notify the injector that the object is being initialized and if the @Inject-annotated methods of that class get called while super() is called I could autowire it also

river oracle
#

oh are you in the land of the cursed DI frameworks

#

I'm sorry for your lsos

eternal oxide
#

only a child/parent static and parent initializer run before parent constructor

quiet ice
#

It catches like 70% of usecases, but those are enough for my needs - now.
At worst I'll go with classloader mayhem, thankfully I am quite experienced with it but would like to avoid it for the moment.

quiet ice
#

Well there are some that I do semi-understand (Dagger & co.), but those are based on annotation processors which in turn I don't trust.

dry hazel
#

feather is pretty simple

quiet ice
#

Currently my API for creating objects is basically <T> T allocate(Lookup lookup, @NotNull Class<T> type, InjectionContext injectCtx, Object... args), other frameworks seem to overcomplicate it beyond anything

slender elbow
#

annotation processors which in turn I don't trust
yeah so, instead of trusting an AP which produces legal, normal, readable and debuggable source code, you want to hack all around internals and illegal states to find yourself in non standard situations

#

๐Ÿ˜ƒ

quiet ice
slender elbow
#

dagger is the least intrusive DI framework i've used and it's pretty pleasant to use

#

but, you go

dry hazel
#

๐Ÿค“

quiet ice
#

The thing is as long as I cannot specify which constructor to call I am pretty lost

#

I have been working far too much with a nonstandard technology stack the last few years that I am absolutely foreign to the "standard" stack

#

Basically the only DI framework that I really understood is gradle's one, given that it had class transformation powers I'll follow it in it's footsteps

slender elbow
#

it doesn't modify your classes afaik

#

it just subclasses them

#

but they are able to do whatever they want in their own environment ofc

quiet ice
#

I am quite sure it would not be able to inject stuff with just subclassing

slender elbow
#

why not

quiet ice
#

Actually you might be right. I was thinking about getProject(), but that could very well be injected through standard means

slender elbow
#

stuff like

abstract class MyThing {
  @Inject protected abstract ObjectFactory getObjects();
}

is just a field in the subclass

worldly ingot
slender elbow
#

pretty nifty aye

#

for records only tho

#

compact ctors or whatever

worldly ingot
#

Right because an initializer doesn't make too much sense

#

Well ya learn something new every day

slender elbow
#

no i don't

dry hazel
#

nerd

worldly ingot
#

Some people learn something new every day

quiet ice
#

Gradle seems to do it's stuff via

private static final ThreadLocal<TaskInfo> NEXT_INSTANCE = new ThreadLocal<>();

Well I suppose I could make subclassing work out after all. For most common usecases I already have found a solution, for the others I guess I'll throw an error as needed

weak meteor
#

how can i put this images?

#

on chat?

slender elbow
#

resource pack

#

font

weak meteor
#

so

#

no server sided code?

quiet ice
#

Balkanize some random chars noone uses anyways

slender elbow
#

well you'd need to send a component with the font for that bit

#

otherwise, little code is needed

weak meteor
#

oh

#

hmm

#

any forum post to follow?

#

never heard of that tbh

slender elbow
#

no idea

weak meteor
#

k

quiet ice
#

Ah right, fonts. Those exists these days

weak meteor
#

gotta search

slender elbow
#

i mean custom fonts have been a thing for, like, over a decade lol

#

but yeah, plenty of resources

quiet ice
#

Yeah, but afaik they used to balkanize stuff from the original (default) font [kinda like how people do with blockstates]. Or at least that is what I was taught was conventional back then

clear elm
#

anyone nows good yt tutorials to learn java minecraft plugins?

chrome beacon
#

Do you know Java?

inner mulch
#

is a hashcode of for example and item stack unique or would 2 itemstacks that are exactly the same have the same hashcode?

wary harness
#

any one can rcommend some lib for making command without adding it to plugin,yml

dry hazel
#

commandapi, cloud, acf

eternal night
dry hazel
#

but what if I subclass itemstack

#

ha

slender elbow
#

that is halal

river oracle
pliant topaz
#

Does anyone know how I would go about loading in schmetics with my plugin?
(The file I create with WorldEdit, but I need to load the schmetic through my own plugin, and I can't figure out how to do it)

slender elbow
#

?

#

in the same way i mock all other religions

eternal oxide
#

OR use Bukkit Structures

slender elbow
#

don't structures have an absurdly low size limit

#

i am now insulting anyone, mocking is different from insulting

#

but that's a conversation for another place

vague swallow
#

Does anyone know how to set the Head rotation of an armor stand to a vector?

remote swallow
#

mocking and insulting are 2 very different things

slender elbow
#

i can take a light hearted joke about any particular culture

vague swallow
slender elbow
#

not an insult

remote swallow
#

i dont have the paitence for this

eternal oxide
#

get a life and stop trying to be offended

eternal oxide
#

Talk to the hand ๐Ÿ–๏ธ

slender elbow
eternal oxide
#

there is, math, but it's annoying

slender elbow
#

yeah, meant in the api lol

#

hm

eternal oxide
#

for starters, when you have a vector you can;t calculate a yaw without knowing another direction

#

you need to know what is zero to calculate a yaw

devout kite
#

Hey i wanna show all Players but i it dont shows any, i get all CraftPlayers as a message

        List<Player> list = new ArrayList<>(Bukkit.getOnlinePlayers());
        for (Player player1 : list) {
            player.showPlayer(Main.getPlugin(), player1);
            player1.showPlayer(Main.getPlugin(), player);
            player1.sendMessage(String.valueOf(player));
        }```
vague swallow
crimson scarab
#

what is the equivalent of Block.getbycombinedid in 1.20

eternal oxide
quaint mantle
#

how do i get the contents of a decorated pot

remote swallow
#

idk if we have api for that yet

crimson scarab
quaint mantle
#

wwhat

crimson scarab
#

im just joking

#
public static void setBlockInNativeDataPalette(World world, int x, int y, int z, int blockId, byte data, boolean applyPhysics) {
    net.minecraft.server.v1_14_R1.World nmsWorld = ((CraftWorld) world).getHandle();
    net.minecraft.server.v1_14_R1.Chunk nmsChunk = nmsWorld.getChunkAt(x >> 4, z >> 4);
    IBlockData ibd = net.minecraft.server.v1_14_R1.Block.getByCombinedId(blockId + (data << 12));

    ChunkSection cs = nmsChunk.getSections()[y >> 4];
    if (cs == nmsChunk.a()) {
        cs = new ChunkSection(y >> 4 << 4);
        nmsChunk.getSections()[y >> 4] = cs;
    }

    if (applyPhysics)
       cs.getBlocks().setBlock(x & 15, y & 15, z & 15, ibd);
    else
       cs.getBlocks().b(x & 15, y & 15, z & 15, ibd);
}

How can this be converted to 1.20

#

it seems the mappings have changed and i have no idea how to get the equivilant

icy beacon
#

?nms

icy beacon
#

Just use Mojang mappings

mellow edge
#

I want to make ender dragon movement but REALLY dont wanna do it with NMS in 1.8 so I have no clue what to do.

chrome beacon
#

If you don't want to do nms you'll have to find a lib or smth

#

because you'll need it otherwise

mellow edge
#

How do this libs work? Through reflection?

#

Or through nms

chrome beacon
#

Depends on the lib

#

but reflection still needs to call nms

mellow edge
#

So if this is really the only option... I will have to stick with it, the only downside is that this is the only thing I need nms for...

flat wasp
#

I need help with a command that enables and disables fall damage

lost matrix
flat wasp
lost matrix
weak meteor
#

Can i use Hex Color in 1.8.8?

lost matrix
weak meteor
#

k thanks

#

is there like a dc server where can i sell my services as a dev?

lost matrix
#

Not an official one for spigot

#

?services

undone axleBOT
weak meteor
storm crystal
rare rover
#

That's a optimal core plugin cpu percentage on spark?

#

If I really need to optimize I will

#

My plugin is sitting at 1.43% with 1 player so I'm kinda concerned a bit but I can always optimize

wide cipher
#
#

im using gradle

echo basalt
#

add that as a repo

wide cipher
#

ok

#

worked, thanks

#

how can you get a player's handle as an Object class?

torn badge
#

Cancel the event and broadcast a message

#

I believe there is also setFormat(), but if it works already thatโ€™s alright

slender elbow
#

you'll find the real and proper answer in the paper discord

weak meteor
#

someone knows about Github -> Discord webhooks?

#

i did it one time and now it doesnt work

remote swallow
#

i used them once

weak meteor
#

nvm just worked out

#

lol

#

now /github has to be added to the final of the URL

#

weird

rare rover
#

๐Ÿ™‚

restive mango
#

How fast does giving an entity a velocity of like 0, 1, 0 actually move them? 1 block per tick?

worldly ingot
#

I don't think there's any direct correlation to a real unit

#

At least nothing meaningful enough for you to be able to predict anything

grim hound
#

It most probably uses it's own physics formulas

#

After setting/adding their velocity

grim hound
#

Which I think is the universal formula, probably used for most entities

grim hound
worldly ingot
#

TL;DR: It's a crap shoot. Trial and error. Set a value, if it's too slow, increase it. If it's too fast, reduce it.

grim hound
#

But if your goal is to predict it

#

Find the physics formulas for your entity type online

#

And apply them

#

Generalised Y velocity formula for the player /\

weak meteor
#

how can i add only the enchantment glint to the item but not an enchantment?

remote swallow
#

you cant you would have to add an enchant and give it hide enchants item flag

#

or packets

#

could probably do it with packets

weak meteor
#

i prefer to give Unbreaking X

#

lol

#

isnt that bad

remote swallow
#

if its a block i give it mending

grim hound
#

Or use commands and just do

weak meteor
#

im on 1.8.8 btw

#

so maybe that will be easier than on newer versions

grim hound
weak meteor
#

i can do a fake ItemStack object btw

#

like from GSON

#

and do well

#

"enchantments":[{}]

#

maybe?

#

i'll try

#

thanks

grim hound
#

Np

echo basalt
#

I usually just give like

#

luck of the sea 1

river oracle
#

I use fire protection

#

๐Ÿ’ช

echo basalt
#

throwback to the ps3 version where you could just grab a fire aspect book

#

and slap ppl with it

weak meteor
#

i miss so much ps3 minecraft

#

in general old minecraft

#

now i can't even mantain a survival 3 days cause i get bored

wide cipher
young knoll
worldly ingot
#

Loved that

#

StoredEnchantments was a mistake >:(

wide cipher
#

thanks

astral pilot
#

how do i create custom entity instance

minor junco
#

Extend the craftentity

#

Or living entity

astral pilot
pliant topaz
#

How would I go about loading in schematics using the Worldedit API? Cause everything I found online was outdated and worldedit-bukkit aswell as worldedit-core both don't seem to contain everything with schematics

rotund ravine
#

Try their discord

eternal oxide
#

good luck

astral pilot
#

can anyone explain what is clazz

#

what params does spawn need

eternal oxide
#

a clazz is a class as teh name class is protected you can;t use it

astral pilot
eternal oxide
#

a clazz is just a arg name used to refer to any class

astral pilot
eternal oxide
#

what?

#

pass it the required parameters

astral pilot
#

yea but idk what does it need

#

its asking for "Clazz"

#

lol

eternal oxide
#

the same as using any method in the API

#

its asking for a class

#

like Zombie.class

astral pilot
#

i see

#

thanks

wide cipher
#

doing this CraftPlayer player = (CraftPlayer) playerExpression.getSingle(e); GameProfile profile = player.getProfile(); ReflectionUtils.sendPacket(p, new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.a.a, player.getHandle())); String skin = Skin.STEVE.value + "\", \"" + Skin.STEVE.signature; profile.getProperties().removeAll("textures"); profile.getProperties().put("textures", new Property("textures", skin)); ReflectionUtils.sendPacket(p, new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.a.a, player.getHandle()));

#

how can i fix?

eternal oxide
#

ask in Skript discord

wide cipher
eternal oxide
#

its a Skript error unable to find the class

quaint mantle
#

Since CraftPlayer has a different name in the jar, it cannot be found.

eternal night
eternal oxide
#

no it doesn't

#

only NMS is obfuscated

shadow night
#

I thought cb stays the same and nms gets obfuscated

eternal night
#

it gets relocated

#

but yea, not obfuscated

#

just, _R3 is 1.20.3/1.20.4

#

you are running 1.20.2

#

update your server or downgrade the plugin to 1.20.2

shadow night
#

I like how mc is obfuscated as fuck and people still turn it into readable code

wide cipher
#

ok

wide cipher
eternal night
#

no

#

well

#

via reflection

#

but like, for NMS access you want a multi module setup anyway

wide cipher
#

like i need to use it like that but using the getCraftClass("entity.CraftPlayer you can't access the GameProfile

eternal night
#

what do you mean you can't access game profile

wide cipher
#

im prob doing it wrong but

eternal night
#

I mean, you are in reflection land

#

so you have to use reflection to grab the gameprofile field/method on the craft player

eternal oxide
#

you don;t need GameP{rofile in 1.20 to mess with textures

#

use PlayerProfile in the API

wide cipher
#

GameProfile profile = ((ReflectionUtils.getCraftClass("entity.CraftPlayer")) player).getProfile();

eternal night
#

wtf

wide cipher
#

shHH

eternal night
#

Yea I mean, that is completely wrong

#

again

#

you are in reflection land

#

you don't get to go back to normal types

eternal oxide
#

ALL textures for skins are set by url

wide cipher
#

yeah but its easier to use GameProfile

eternal oxide
#

No, this is exactly what PlayerProfile was added for

#

it is the API access to GameProfile

#

GameProfile is Mojang AuthLIb. PlayerProfile is Bukkit API

wide cipher
eternal oxide
#

the value and signature is just a URL and a checksum

#

you add it as a Property

#

of if using PlayerProfile you setSkin

wide cipher
#

wdym by checksum?

eternal oxide
#

its a checksum provided by Mojang to validate the skin

#

Changing a Player skin is not as easy as just changing teh skin and sending a packet

astral pilot
#

it seems like Zombie#setHealth cannot exceed 20

#

is there a way to make it exceed to 20

eternal oxide
#

yes attributes

astral pilot
eternal oxide
#

?jd-s search attribute

undone axleBOT
astral pilot
#

ok ill check those

queen apex
#

Anyone knows how to read .mca files using php?

astral pilot
#

yo is it also possible to modify the ai of those mobs

#

without nms?

eternal oxide
#

no

astral pilot
#

how about disabling some of their ai like making it so that zombies do not attack villagers but only players etc

eternal oxide
#

cancel their target event

#

if it's a villager

astral pilot
#

i see thanks

#

tho is there a way to set internal name on them

queen apex
astral pilot
#

so not all zombie mobs will be affected?

eternal oxide
#

place a flag in the mobs PDC that you want to be special

#

then detect that flag in the event

eternal oxide
#

?pdc

astral pilot
#

ah

#

ok thanks

wide cipher
eternal oxide
#

if you want to get CraftPlayer dynamically you can

#

I actually avoid all versioned imports and jump stright to NMS

#

?paste for me

undone axleBOT
eternal oxide
chrome beacon
#

Still needs to be remapped which makes the code version dependent

#

So just be aware of that

eternal oxide
#

yes, I only avoid the Bukkit versioning

wide cipher
#

ok

eternal oxide
#

all nms is version specific so you can;t easily avoid that

chrome beacon
#

So have you tried using the PlayerProfile API?

eternal oxide
#

Yeah I told him to usae it instead of GameProfile

wide cipher
#

im just gonna keep using GameProfile since it goes better with my other code, tho thanks for the suggestion

wide cipher
wide cipher
chrome beacon
#

They're still called that

wide cipher
#

why can't i access them

chrome beacon
#

Did you setup mojmaps correctly

#

?nms

wide cipher
#

oh i did the build tools, but do i need to remap it?

#

also how do i implement the remapped repo into gradle?

eternal oxide
#

if you are using NMS with spigot don;t use Gradle

#

Maven all the way

wide cipher
#

ok

#

ill switch

#

is there an easier way than copying the files over?

icy beacon
#

What's the best way to get rid of this warning

#

I'm 100% sure that under any circumstances this value will be List<Integer> in this case

#

My IDE doesn't know that and it's annoying

#

modification.getValue() is Object

astral pilot
dry hazel
#

no other way yea

#

you're casting to a parameterized type

chrome beacon
#

See if you can get rid of the cast in the first place

#

Why is it an object

icy beacon
icy beacon
icy beacon
#

listToString takes List<T>

#

Technically if I cast to List<?> it should also work but it looks dirty

astral pilot
dry hazel
#

what's the listToString method signature

icy beacon
icy beacon
dry hazel
#

you don't even need the generic for that

#

unless you're dealing with the item in a var

icy beacon
dry hazel
#

you can just use List<?>

icy beacon
#

Ah right

#

One sec

#

Yeah that's much better haha

#

Thx

astral pilot
glossy venture
#

anyone know how to do this?

#

im prob not experienced enough with streams to do this

#

basically i want to combine two sorted streams and remove duplicates (preferably prioritizing one stream)

#

one stream is sourced from the mongodb server cursor where it has already been sorted

#

the other stream comes from the local cache which i will sort with the fastComparator individually

icy beacon
#

Can't you collect the two streams into lists, join them and then get the resulting stream?

#

Or does it have to be done with streams only

wet breach
#
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class A {

    public static void main(String[] args) {
        List<Dog> dogList1 = Arrays.asList(new Dog("a", 1), new Dog("b", 2), new Dog("f", 3));
        List<Dog> dogList2 = Arrays.asList(new Dog("b", 4), new Dog("c", 5), new Dog("f", 6));
        List<Dog> dogList3 = Arrays.asList(new Dog("b", 7), new Dog("d", 8), new Dog("e", 9));
        List<Dog> dogs = new ArrayList<>(
                Stream.of(dogList1, dogList2, dogList3)
                        .flatMap(List::stream)
                        .collect(Collectors.toMap(Dog::getName,
                                d -> d,
                                (Dog x, Dog y) -> x == null ? y : x))
                        .values());
        dogs.forEach(System.out::println);
    }
}

class Dog {
    String name;
    int id;

    public Dog(String name, int id) {
        this.name = name;
        this.id = id;
    }

    public String getName() {
        return name;
    }

    @Override
    public String toString() {
        return "Dog{" +
                "name='" + name + '\'' +
                ", id=" + id +
                '}';
    }
}
#

have fun

glossy venture
glossy venture
#

i mean ig i can stream a temporary set yeah, but it would collect everything which i want to avoid

icy beacon
#

That exists?!

#

Holy shit

glossy venture
#

yh

wet breach
glossy venture
#

bc i dont want to request all the data from the server

#

imagine i have an operation on a database of 100k items

#

and 1000 items are cached

#

its a sorted findAll operation, so the server sorts the items on the database

#

and the cache is sorted locally

#

how would i zip those two streams together into one sorted stream without duplicates without requesting all items from the server

wet breach
#

what DB server are you using?

glossy venture
#

mongo

#

but im planning to add mysql support

#

and sqlite

#

n all that shit

wet breach
#

idk what mongo is cable of, but MySQLcould easily do this no problem without anything additional to include removing duplicate entries

#

in fact not only can it do that but you can even have it store such things in a memory DB as well as a cache

glossy venture
#

i have a cache locally

#

idrc what the db server does

#

i just dont want to load 100k items into memory

wet breach
#

sure but why sort your cache when you can just pull from a sorted cache ahead of time

glossy venture
#

bc my local cache is mutable

#

so has the latest changes

#

mongo probably does those optimizations too

#

but i want to include local changes made in memory which have not been saved yet

#

which works currently but i dont think its very efficient because its basically doing Stream.concat(cachedItems, remoteItems).distinct().sorted(comparator)

molten hearth
glossy venture
#

ok

#

nice

#

for u

molten hearth
#

bro hit me with the k

wet breach
#

you seem to keep adding more and more rules to this that don't seem necessary

glossy venture
#

that was exactly my original request

wet breach
#

yes, but if your cache is mutable, why bother sorting it

glossy venture
#

wdym

#

im sorting a stream from the local in-memory cache on the client when i need it to be sorted

#

im not sorting the cache

wet breach
#

why sort it at all?

glossy venture
#

tfdym

#

bc i need it for a sorted operation

#
datastore.findAll(..., /* useCaches */ true)
  .await()
  .sort(...)
``` should be sorted no?
wet breach
#

ok so you are doing the sorting during a stream which is ideal, but now why do you need to combine two streams?

glossy venture
#

because, idk if this is true, but i can imagine that if i have two streams sorted with the same sorting i can efficiently zip them

#

instead of doing the whole sorting on the entire contents of the whole stream

#

which could be like 100k items

#

while its already 99.99% sorted

#

because the database did that

#
cache: [4, 5, 7, 9]
dbres: [1, 2, 3, 6, 8, ...]
wet breach
#

why do you need the cache for this?

glossy venture
#

imagine im making a leaderboard

#

on a server

#

players are playing so their data is being edited in the cache

#

but not immediately saved to the database

#

now i want to display the leaderboard

#

it wont have the updated info until the data is saved by an autosave or a player leaving

#

there is an option to disable the use of caches in a bulk find operation and it is by default but i made it an option and now i want to optimize it because its fun

#

my datastore library

wet breach
molten hearth
#

the leaderboard needs to sort the data to know what the top x are

glossy venture
#

yeah

#

which it is already almost because the database did it

#

but not completely because the cache is included

wet breach
molten hearth
#

issue closed learn db features orby

glossy venture
#

this has none to do with the db bruh

#

because the db does not have the data

#

yet

molten hearth
#

(i was joking)

glossy venture
#

ik

#

but to frost

wet breach
glossy venture
#

how can it sort data it doesnt have wtf

wet breach
#

what are the odds that a single player is going to jump 100 positions?

#

or 1k?

glossy venture
#

like 5% per second

#

idk but why not do it without a reason

wet breach
#

so, not very likely. Then all that needs to be done is pull the relevant data in question for the positions

glossy venture
#

give me a reason not to do it

#

i already did it

#

but its slow probably

#

so im looking for a way to optimize it purely for fun

#

its disabled by default but streams have luckily made it pretty straightforward

#

so i implemented it

wet breach
#

doesn't mean they are always the best

#

everything has limits you know, and when you hit those limits you have to change or add to what your are doing or sometimes remove

#

it may be best to leverage the DB software here

glossy venture
#

streams are made for this tho

#

ik

#

i am

wet breach
#

streams are not the only thing either that exist, sometimes the most basic things are far better ๐Ÿ™‚

glossy venture
#

if it doesnt use cached items it just uses the iterable returned by the database

wet breach
#

well, you already said you can't use lists for an arbitrary reason, which I assume means hashsets are out? But both of those could be streamed even though you can sort either one with relative ease

#

it seems you just want an all in one solution which I don't think exists

icy beacon
#

Any idea how to create a cube of particles? This is probably really easy but my brain is refusing to brain

glossy venture
#

hashsets would be what id use to detect duplicates

#

but only on demand

icy beacon
#

I'm trying to surround a wg region with patricles

wet breach
#

if you have the corners and center you have all the locations

icy beacon
#

I do have two opposing corners. My problem is that I'm for some reason struggling to understand the logic of getting the others

wet breach
#

but, there is a I think utility method in bounding boxes for borders

icy beacon
#

I think if I get a pen and paper I'll figure it out

wet breach
#

if you have two opposing corners you use triangles to find the others ๐Ÿ™‚

#

the triangle is still 2d just it slices the box

#

you can use that to find a 3rd corner, and then rotate

icy beacon
#

Ok that makes sense yeah

wet breach
#

until you have all 8 points, but you only need half the points to cover the box though

#

since the other half is mirrored

icy beacon
#

I'm also thinking about the BoundingBox solution and checking the docs rn

eternal oxide
#

just min/max on x,y,z

icy beacon
#

Does that seem good...

eternal oxide
#

no

#

that would fil the whole area with particles

icy beacon
#

Oh shit

#

True

eternal oxide
#

you only want faces

wet breach
#

or borders depending on how they want it displayed

eternal oxide
#

it will take a few loops, likejava plot xMin and xMax for loop y and z min to max

wet breach
#

faces if they want the particles to show the entire cube, borders if they want just an outline

eternal oxide
#

so 2 for loops

#

woudl plot you two faces in that example

#

are you only doing 4 sides, or 6?

icy beacon
#

I'm doing all sides. I'm currently trying to figure this out with pen and paper also

eternal oxide
#
plot at min and max Z while for loop x and y
plot at min and max Y while for loop z and X```
#

that does all 6 faces

wet breach
#

Well, 4 sides makes sense if the region extends from both limits otherwise 6

icy beacon
#

So if I have this, I can find the coordinates of the lower left front corner as {maxX; minY; minZ}, then I can find the upper left front corner as {maxX; maxY; minZ;}, then I can find the upper right front corner as {minX; maxY; minZ}. For the back side, top right back corner is {minX; maxY; maxZ}, bottom right back corner is {minX; minY; maxZ} and bottom left corner is {maxX; minY; maxZ}.
Now I have all 8 corners but now what

#

I'm overthinking something am I not

eternal oxide
#
for (int y = yMin; y <= yMax; y++) {
  for (int z = zMin; z <= zMax; z++) {
    player.spawn minX, y, z...
    player.spawn maxX, y, z...
  }
}
//do same for other two```
icy beacon
torpid blaze
#

Hey,
I am trying to send plugin messages from bungeecord to paper and back. Paper receives the messages without problems but bungeecord does not.
I use this on spigot for sending:

main.getServer().getMessenger().registerOutgoingPluginChannel( main, "friends:bungee" );

try {
            ByteArrayOutputStream stream = new ByteArrayOutputStream();
            DataOutputStream out = new DataOutputStream(stream);
            out.writeUTF("amount");
            out.writeUTF("refresh");

            player.sendPluginMessage(main, "friends:bungee", stream.toByteArray());
        } catch (Exception e) {
            System.out.println(e);
        }

I currently just log every reveiced message on bungeecord. There I can see many default messages like register and so, but not a single of mine.
And I registered it on Bungeecord:

getProxy().registerChannel("friends:bungee");

Has anyone any idea why this is not working?

icy beacon
#

?whereami

wet breach
#

you just find the points that are on the same axis to draw the lines

#

so, a point that shares an x and y axis with another, is an opposing corner

icy beacon
eternal oxide
sterile axle
torpid blaze
#

I am sending it when the player joins

#

in the PlayerJoinEvent

sterile axle
#

you cannot send a message at the same tick as the player join

#

you must use the scheduler to delay it by one tick

torpid blaze
#

ok, is ther a PostJoinevent?

sterile axle
#

no just use the scheduler

torpid blaze
#

ok, thanks!+

sterile axle
#
plugin.getServer().getScheduler().runTaskLater(plugin, () -> <your message sending here>, 1L);
eternal oxide
#

just runTask if you are doing it next tick

sterile axle
#

cool, i just wrote that shit from memory

#

if there's a better method use that

icy beacon
#

Btw, would spawning a bunch of particles every second be performance-heavy? I mean I'm gonna test it now anyway but maybe I should like increase the delay between spawning them or something

eternal oxide
#

for teh client its bad

icy beacon
#

The client may suffer xD

#

And the server?

#

If the region is like 100x50x100

eternal oxide
#

depends how many as it can be an issue with network bandwidth

icy beacon
#

Alright then, hope all goes well

sterile axle
#

if you've got some mad cpu, lower the compression threshold and it will compress packets a lot smaller than usual, but it will increase cpu usage for both server and client. otherwise, if the network can handle it, fire away

slender elbow
# eternal oxide just runTask if you are doing it next tick

technically they are different, runTask = runTaskLater(..., 0), which causes some fun things where if you keep adding runTasks (and not runTaskLater(... 1)) inside the task itself it'll also run the newly added tasks on the current scheduler loop

#

definitely didn't have to learn that the hard way :D

eternal oxide
#

all scheduled tasks will be at best on the next tick

slender elbow
#

you are mistaken

eternal oxide
#

Nope

slender elbow
#

yes

eternal oxide
#

Nope

slender elbow
eternal oxide
slender elbow
#

except that it won't

eternal oxide
#

it will

slender elbow
#

literally look at the source code lmao

sterile axle
#

the docs are wrong

slender elbow
#

the docs are just wrong

eternal oxide
#

it does exactly what the javadoc says

slender elbow
#

no it does not

sterile axle
#

it clearly doesn't, the source code says so

eternal oxide
#

show?

eternal oxide
#

yes, it adds to teh queue to run the next tick

torpid blaze
#

I have one more question about pluginmessages, I send a message from bungeecord to player 1 with a payload. I console it there and when logging it on the spigot receiver server, the payload is received but for another player...
I have both mincrafts on the same laptop and therefore with the same ip but I think that shouldn't make a difference right?

eternal night
#

which causes some fun things where if you keep adding runTasks (and not runTaskLater(... 1)) inside the task itself it'll also run the newly added tasks on the current scheduler loop

eternal oxide
#

internally it calls teh runTaskLater with is basically overloading

#

it literally just adds it to teh scheduling queue

sterile axle
#

it sets delay = 0, and if you follow all the overloads down it ends here

    private CraftTask handle(final CraftTask task, final long delay) {
        task.setNextRun(currentTick + delay);
        addTask(task);
        return task;
    }
slender elbow
#

which the current scheduler loop pulls from

sterile axle
#

so it is set to run on currentTick

eternal oxide
#

no, addTask adds it to the queue

sterile axle
#

whether the server actually is capable of doing that, idk, but the actual setNextRun is set as currentTick

eternal oxide
#

which will not get processed until the next tick

slender elbow
#

except that it will

eternal night
#

"queue" kekwhyper

eternal oxide
#

I have never in many years of weorkgin with Bukkit and Executors seen a task run teh same tick it was scheduled.

slender elbow
#

might as well try

torpid blaze
sterile axle
#

i guess it depends where in the tick loop the addTask is actually called while it's processing plugin junk

#

(conjecture)

#

if its called right before the tasks get polled out of the "queue" then it will run same tick

#

otherwise, get fucked i guess it'll wait

torpid blaze
slender elbow
#

the scheduler keeps pulling from the queue on every task for whatever reason

eternal night
#
Bukkit.getScheduler().runTaskLater(this, () -> {
    getLogger().info("Outer on tick " + Bukkit.getCurrentTick());
    Bukkit.getScheduler().runTask(this, () -> {
        getLogger().info("Inner on tick " + Bukkit.getCurrentTick());
    });
}, 10L);

SpookyDance

#

spooky things

#

never seen. before

slender elbow
#

hmmm

sterile axle
#

maybe 1 tick isn't enough lmao

eternal oxide
eternal night
#
[12:39:30 INFO]: [Paper-Test-Plugin] Outer on tick 9
[12:39:30 INFO]: [Paper-Test-Plugin] Inner on tick 9
torpid blaze
#

but this has nothing to do with the problem

eternal night
#

tho I guess I'd have to check this on spigot

#

eh

slender elbow
eternal night
#

im too lazy to boot up spigot

sterile axle
#

oh i see it

#

hold on

sterile axle
eternal oxide
#

yeah, as the scheduler should run at the beginning of a tick it should be impossible to insert and run on teh same tick

eternal night
slender elbow
#

what

eternal night
#

it literally isn't

#

the schedule runs through a shitty version of linked list

#

if your task is at the front

#

and you schedule another task to run on the same tick via runTask

#

that is appended not prepended to the shitty version of a linked list

eternal oxide
#

um

slender elbow
#

so the scheduler pulls it

sterile axle
eternal oxide
#

I literally have never once seen a runTask ever run teh same tick

slender elbow
#

okay so, try

eternal oxide
#

err I have. if it did much code would fail which requires it to run next tick

eternal night
#

i s2g

#

I literally ran this

#

you can literally look at the source code

#

here new tasks are appended to the tail

#

the queue is the thing the main heartbeat consumes

eternal oxide
#

Don;t know what to say. If what you are saying is correct it would break so many plugins.

torpid blaze
#

@sterile axle I use this on bungeecord to send the message:

Collection<ProxiedPlayer> networkPlayers = ProxyServer.getInstance().getPlayers();
        if ( networkPlayers == null || networkPlayers.isEmpty() ) return;

        JSONObject payload = new JSONObject();
        payload.put("online", main.getFriendshipManager().getOnlineFriends(player.getUniqueId()).size());
        payload.put("total", main.getFriendshipManager().getFriends(player.getUniqueId()).size());

        ByteArrayDataOutput out = ByteStreams.newDataOutput();
        out.writeUTF( "amount" );
        out.writeUTF( payload.toJSONString() );

        System.out.println("--sending:");
        System.out.println(player.getName());
        System.out.println(payload.toString());

        player.getServer().getInfo().sendData( "friends:hub", out.toByteArray() );
eternal night
#

Clearly not given that is how it works lol

torpid blaze
#

@sterile axle and receives the message on spigot:

if (!channel.equalsIgnoreCase( "friends:hub"))
            return;

        ByteArrayDataInput in = ByteStreams.newDataInput( bytes );
        String subChannel = in.readUTF();

        if (subChannel.equalsIgnoreCase("amount"))
        {
            JSONParser parser = new JSONParser();
            JSONObject payload = null;
            try {
                payload = (JSONObject) parser.parse(in.readUTF());
            } catch (ParseException e) {
                System.out.println(e);
                return;
            }

            System.out.println(player.getName());
            System.out.println(payload.toString());

            main.getScoreboardManager().updateLobbyScoreboardForPlayer(player, (Long) payload.get("online"), (Long) payload.get("total"));
        }
sterile axle
#

we need a development-meta channel

sterile axle
torpid blaze
#

yea

slender elbow
#

the scheduler will tick at (almost) the very beginning of the mc tick, so tasks added during events/commands will run on the next tick, but tasks added inside a scheduled task itself will run on the current tick

eternal oxide
eternal night
#

I-

#

YES

eternal oxide
#

Well WTH, that has nothign to do with what the original question was!!!

eternal night
#

which causes some fun things where if you keep adding runTasks (and not runTaskLater(... 1)) inside the task itself it'll also run the newly added tasks on the current scheduler loop

#

that was literally in emilys initial statement ๐Ÿ˜ญ

eternal oxide
#

it had NOTHING to do with running a task inside a task

slender elbow
#

that's literally what i said lmao

eternal oxide
#

it was LITERALLY using runTask over runTaskLater

sterile axle
# torpid blaze

i have no idea sorry, idk how it determines the player to receive the message

eternal oxide
#

a single task not nested

slender elbow
#

i was pointing out that runTask is different from runTaskLater(1)

eternal night
eternal oxide
#

ONLY if nested

eternal night
#

which is still a difference

#

ยฏ_(ใƒ„)_/ยฏ

torpid blaze
#

@sterile axle :c ok.

wet breach
torpid blaze
#

still thanks!

slender elbow
#

lmao

eternal oxide
#

they never said nested

#

they just said they were different

eternal night
#

which causes some fun things where if you keep adding runTasks (and not runTaskLater(... 1)) inside the task itself it'll also run the newly added tasks on the current scheduler loop

#

which causes some fun things where if you keep adding runTasks (and not runTaskLater(... 1)) inside the task itself it'll also run the newly added tasks on the current scheduler loop

#

which causes some fun things where if you keep adding runTasks (and not runTaskLater(... 1)) inside the task itself it'll also run the newly added tasks on the current scheduler loop

eternal oxide
#

ok

dry hazel
#

stop spamming nerd

wet breach
#

they didn't use the term of nested you are correct

eternal night
#

true fuck

wet breach
#

which is where your misunderstanding is at

eternal night
#

misscommunication ๐Ÿ˜ญ

#

the biggest enemy

eternal oxide
#

So my previous statement is still factually correct

slender elbow
#

so is mine

eternal oxide
#

use runTask over runTaskLater

#

add unless nesting

#

yes

eternal night
#

perfection party

slender elbow
#

my description explicitly talks about scheduling tasks inside tasks

#

literally nesting

sterile axle
#

puts down popcorn and goes to get firehouse to wash y'all down

slender elbow
#

hoe lee

wet breach
#

alright now that is settled we can move on from this lol

sterile axle
#

frost you can now use the room to help @torpid blaze bc idk what's wrong with his stuff

#

ok bye

eternal oxide
quaint mantle
#

funny

wet breach
torpid blaze
#

I want to send some json data to a specific player

wet breach
#

I don't really know the bungee api as well as I do bukkits, but pluginmessage doesn't specifically use a particular connection to send a message as it isn't necessary or relevant just as long as its sent to the appropriate server

torpid blaze
#

but the spigot always receives it for the first player that joined I think

quaint mantle
#

I would rather use a websocket or redis if I have the choice though

wet breach
#

when you receive the pluginmessage it is up to you to then send the message from in it, to the appropriate player which I don't see why this is an issue

torpid blaze
#

but on spigot I use a player to send a message. But this doesn't matter. It always takes any player?

quaint mantle
#

So you don't depend on a player to receive and send data

torpid blaze
#

ok, so I should send the uuid of the player with the content?

wet breach
wet breach
quaint mantle
#

Plus ws allows you directly to send json

torpid blaze
quaint mantle
wet breach
torpid blaze
wet breach
torpid blaze
#

websockets would be good as I would also send like mesages from my webinterface to the server.

wet breach
#

it uses any player connection as long as the destination is the intended place you specified

torpid blaze
#

ok

wet breach
#

but as you said earlier the solution is simple

#

include the player UUID you want the message for ๐Ÿ™‚

torpid blaze
#

because on bungeecord I can get the receiver player and this is working. so I thought it would be similar on spigot

torpid blaze
dusky prawn
#

Hello, is there someone in here, who wanna learn me about implementing and using the Vault API?

chrome beacon
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

dusky prawn
#

?? Isn't that obvious? I wanna learn how to implement and use the Vault API?

quiet ice
#

That is too vague for us though

#

If you have no questions, just do dive in using it and ask the questions that arrive when they come

dusky prawn
#

Alright... (wth)

How can i implement the Vault API?
How can i then check if the player has x money?
How do i remove x money from player, IF the player has?

quiet ice
#

Though - it you use Vault: please use the service events

dusky prawn
#

...service events?

quiet ice
#

Also, please read all other issues before creating an issue over at the vault issue page(s). We get a LOT of duplicate questions

dusky prawn
#

Oh my lord

#

This isn't to any help

slender elbow
#

Vault's readme literally shows you how to use it tho

chrome beacon
#

^^ scroll down

slender elbow
#

if you fail to understand something in there, then you can bring that up

quiet ice
#

PLEASE Use the Service events though

#

The examples provided by vault will blow up one day or the other

slender elbow
#

you'd have to loadbefore vault for that to work as expected

young knoll
#

Isn't the idea to load after vault tho

slender elbow
#

if you load after vault, there is a chance that the plugin providing the impl loaded before your plugin and has already registered the service

#

so your handler for that event will never be called for that service

young knoll
#

Hence why they don't use that even in the examples I guess

quiet ice
slender elbow
#

because of plugins expecting the service to be available in onEnable, e.g. luckperms does loadbefore vault and then registers the service when vault enables (so, as soon as it can)

#

so the "ideal" solution is to check both in onEnable and the service event