#development

1 messages · Page 79 of 1

worn jasper
#

God.... yes

#

I always confuse them

#

😭

#

Lombok, yes.

minor summit
#

everyone hates lambda

worn jasper
#

lol

#

yeah I really meant lombok

#

names are similar so I always confuse them

minor summit
#

you can also have non-component properties harold

data class Hello(val world: String) {
  val length: Int = world.length
}
warm steppe
#

has someone ever used laracord? is it possible to install it on docker like laravel sail?

dusty frost
#

This looks pretty informative, Laracord is built on Laravel Zero, so this is pretty much just what I said lol

#

oh yeah, turns out that's what the first link says lol

atomic trail
#

Ohhhh that's actually really nice to have

#

val is final and var isn't right?

atomic trail
pulsar ferry
pulsar ferry
# atomic trail What would that do? non-component property?

It means it's not part of the "data portion of the class"
For example:

data class Hello(val world: String) {
  val length: Int = world.length
}

val hello = Hello("world name")
val (world) = hello // Destructure the data class

// But if you try the non-component, it doesn't work
val (world, length) = hello // errors, length is not a component

// But 
data class Hello(val world: String, val length: Int)
val hello = Hello("world name", 10)
val (world, length) = hello // this works because both are components of the data class
icy shadow
#

Also means it won’t be used in things like equals and hashCode

dusky harness
#

And toString :))

stuck hearth
#

Data classes might be op?

atomic trail
#

How is it then accessed?

pulsar ferry
#

It's accessed like any other property, hello.length it's just not present in the destructuring, hashcode, equals, toString, etc

#

Here is a great visualization

#

The two instances are "identical" because their data components are the same, but the non-component property isn't

wintry swift
#
    public void setLore(ItemStack item, Integer line, String s) {
        ItemMeta meta = item.getItemMeta();
        if (meta == null) return;
        List<String> lore = meta.getLore();
        if (lore==null){
            lore = new ArrayList<>();
        }
        System.out.println("LINE: "+line+" -VS- SIZE: "+lore.size());
        System.out.println("commencing for loop");
        System.out.println(lore);
        while (line>lore.size()) {
            System.out.println("executing");
            lore.add("temp");
        }
        lore.set(line-1,colored(s));
        meta.setLore(lore);
        item.setItemMeta(meta);
    }```
I DONT UNDERSTAND!! why does the while loop not execute at all even though line>lore.size???
hoary scarab
#

Show the output.

hoary scarab
#

lore is size 0
lore.set(line-1,colored(s)); can't set a line with no index.

unborn ivy
#

hello, can anyone tell me how i can create weighted chances? example:

giveItems:
# give an item to the player
# material:chance (double)
  DIRT:20
  DIAMOND:10
  IRON_SWORD:50
# etc etc...
wintry swift
#

and it is not printing "executing"

hoary scarab
#

cause 1 is already greater than 0

wintry swift
#

1 is greater than 0, so it runs the code

#

adding lore increases to lore.size until it is equal to line

hoary scarab
#

I'm misreading something then. Give me a sec lol

#

Which is line 92?

wintry swift
# hoary scarab Which is line 92?

i disabled these 3 lines:

//lore.set(line-1,colored(s));
//meta.setLore(lore);
//item.setItemMeta(meta);```
and it prints "executing" now
#

wtf is going on

#

isnt it supposed to go through the while loop before executing these 3 lines?

hoary scarab
#

Should but java is wierd sometimes.

wintry swift
#

tf?

#

ok it's working now, i made no changes to the code

#

weird

hoary scarab
#

How i feel constantly.

stuck hearth
#

Cache money

hoary scarab
#

Do you have code already? What have you tried?

unborn ivy
#

i dont i just need some kind of starter

#

cant think of anything

hoary scarab
#

Easiest way use random get a number loop through all the objects with that number (or below) then choose a random from that list.

#

Not the best way though just something simple.

unborn ivy
#

ill see

rocky quarry
#

Nvm it won't work

sterile hinge
#

a map would work

wintry swift
#
package org.firstproject.nbttest;

import org.bukkit.plugin.java.JavaPlugin;

public final class NBTTest extends JavaPlugin {

    @Override
    public void onEnable() {
        getLogger().info("NBTTest has started");
        NBTCommands instance = new NBTCommands();
        getCommand("nbt").setExecutor(instance);
        getCommand("nbtDelete").setExecutor(instance);
        getCommand("nbtString").setExecutor(instance);
        getCommand("nbtBoolean").setExecutor(instance);
        getCommand("nbtDouble").setExecutor(instance);

    }
}```https://paste.helpch.at/fivagazalu.php
#

what did i do wrong guys

#
everything is imported

public class NBTCommands implements CommandExecutor {
    @Override
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String s, @NotNull String[] args) {
        if (sender instanceof Player){
            Player p = (Player) sender;
            ReadWriteNBT nbt = NBT.itemStackToNBT(p.getInventory().getItemInMainHand());

            if (p.isOp()){
                if(cmd.getName().equalsIgnoreCase("nbt")){
                    p.sendMessage("NBT: "+nbt);
                    return true;
                }else if (cmd.getName().equalsIgnoreCase("nbtDelete")){
                    nbt.removeKey(args[0]);
                }else if (cmd.getName().equalsIgnoreCase("nbtString")){
                    String joined = String.join(" ", Arrays.copyOfRange(args, 1, args.length));
                    nbt.setString(args[0], joined);
                }else if (cmd.getName().equalsIgnoreCase("nbtInt")){
                    try{
                        nbt.setDouble(args[0], Double.valueOf(args[1]));
                    }catch (NumberFormatException e){
                        p.sendMessage("Error: "+args[1] + " is not a number!");
                        return true;
                    }
                }else if (cmd.getName().equalsIgnoreCase("nbtBoolean")){
                    try{
                        nbt.setBoolean(args[0], Boolean.valueOf(args[1]));
                    }catch (NumberFormatException e){
                        p.sendMessage("Error: "+args[1] + " is not a number!");
                        return true;
                    }
                }else{
                    return false;
                }
                ItemStack returnItem = NBT.itemStackFromNBT(nbt);
                p.getInventory().setItemInMainHand(returnItem);
            }
        }
        return true;
    }
}
pulsar ferry
#

You didn't register the commands on your plugin.yml

wintry swift
#
name: NBTTest
version: '${project.version}'
main: org.firstproject.nbttest.NBTTest
api-version: '1.20'
depend: [NBTAPI]
commands:
  nbt:
    description: wassup
    usage: /nbt
  nbtDelete:
    description: wassup
    usage: /nbtDelete <key>
  nbtString:
    description: wassup
    usage: /nbtString <key> <string>
  nbtBoolean:
    description: wassup
    usage: /nbtBoolean <key> <boolean>
  nbtInt:
    description: wassup
    usage: /nbtInt <key> <integer>```
did i do smth wrong here
#

nvm i typo'ed on one thanks

rocky quarry
gusty kayak
#

I'm using deluxemenus and wanted to open a menu for someone that is offline but I can't. Is there a way that it's possible to open menus from players that are offline?

broken elbow
pulsar ferry
#

How and why would you want to open a menu for something that isn't present to see said menu? thonk

worn jasper
#

yeah like

#

I just got a brainfuck from reading that message

#

xD

night ice
robust flower
#

Please help me understand why the block type is different depending on the method I use to get it.

Method 1: always correct

val block = world.getBlockAt(location)
val blockType = block.type
// This 'blockType' is always correct

Method 2: sometimes correct

val chunk = world.getChunkAt(location)
val chunkSnapshot = chunk.getChunkSnapshot(false, false, false)
val blockType = chunkSnapshot.getBlockType(location.x % 16, location.y, location.z % 16)
// This 'blockType' is incorrect sometimes

I'm running this code in a loop, when I attempt to the the type of a specific block at (169,133,448), method 1 says it's a LIGHT_GRAY_WOOL and method 2 says it's a GOLD_BLOCK (method 1 is correct here), but I have no clue why is that. It's in the 70th iteration or something, so method 2 it works for the most part, but for this specific case I have no idea why they report different types.

hoary scarab
#

Shouldn't it be >> 4?

minor summit
#

i think it's actually xz & 15 because chunk mth

stuck hearth
#

x >> 4 >> 5 clueless

#

Err other way around

#

x << 5 << 4

robust flower
sterile hinge
#

(or alternatively, Math.floorMod(xz, 16))

worn jasper
#

Random issue, any recommendations for this?

I have a classes XHandler (X being anything), which extend GameHandler. I then have a class for each main command (jda/triumph-cmds) which receive one of those handlers via the constructor. Each command class has an executeSearch() method which does some logic and replies to the slash command. The issue is that, the exact same behaviour is required when clicking on a button of said message. For this I have a listener, that listens to that click. The thing is, that listener basically executes that method when clicking the button and passing the command class to it just sounds wrong? Any ideas?

river solstice
#

well imo executeSearch should be on a different class, not Command class, if you execute that same logic via a button press

#

similar to GameHandler, you'd need a class that would handle the search, and you would pass it either to the Command or the Listener class

#

tldr, extract the logic into a common class

merry knoll
worn jasper
worn jasper
worn jasper
#

so..

#

but yeah, that doesnt help much with the problem

merry knoll
worn jasper
merry knoll
#

or something along the strategy pattern or w.e.

worn jasper
#

has a total of like, 100 lines

merry knoll
#

its called

worn jasper
#

so each game would require a handler, command and that other class

#

which seems a bit excessive? idk

merry knoll
#

yes, not really excessive though no

#

its better than having it provide a method thats not used sometimes thats inherited

worn jasper
#

the handler class basically loads everything, stores their objects and has a list with all the names too, and 1 utility method for said game

merry knoll
#

unless i am understanding wrong the executeSearch() is not needed on some and is needed on something other than the command class?

#

oh wait no just the latter part

worn jasper
#

it basically gets the object from the handler class, formats everything in an embed, creates buttons and sends the message in discord.

merry knoll
#

yeah and the embed button has the exact same function right?

worn jasper
#

Now, the message may contain a button which is supposed to "redirect" the user to another object, which basically does the same thing as just using another command but via button this time.

merry knoll
#

yeah your issue is quite common in app / web dev

#

you solve it by seperating ui (in your case commands and button clicks etc)

#

from the controller completely

#

controller being your logic

worn jasper
#

How is that different from the handler? I suppose that one handles more storage I suppose

#

so you suggesting an MVC type thing?

merry knoll
#

mvvm ideally

#

mvc tends to get messy in my experience

worn jasper
#

So, the new class would be the controller, the handler would be the model and the command the view?

merry knoll
#

it should be fine in your case though

#

saves you 1 more class

#

model is just data / data logic

#

in your case i think you are correct

worn jasper
#

that's basically the handler, it just serves as storage

#

bad naming xD

merry knoll
#

not sure what exactly the handler does

worn jasper
#

loads stuff and caches it

#

basically

merry knoll
#

and your "view"

#

is just all user interaction classes

worn jasper
#

so commands and buttons

merry knoll
#

all they will do is notify the controller

#

that they happen

#

and load the "view" itself

#

so embed etc

worn jasper
#

So if I recall correctly about MV(V)C, View -> Controller -> Model -> View?

merry knoll
#

mvvm, itypoed there

#

model view vievmodel

#

model is your handler

#

view just displays and notifies

#

vm holds all view logic + view data

#

so whatever you display on the embed etc is also there

#

like so

#

vm is the "controller" there

worn jasper
#

So just to confirm:

  • Model is my handler, aka it stores data and that's about it.
  • View is all UI aka commands and buttons
  • VM is the bridge between them, in this case it manipulates the model and at the same time can update the view (in this case send messages, etc)
merry knoll
#

but data flows in a circle

merry knoll
#

and sends events to vm

#

vm is the one interacting and listening to model

worn jasper
#

But the logic to send a message for instance, would that be in the VM too? or would View get what's meant to be sent from VM and then send it itself?

merry knoll
#

you would have a message view

#

that would take its message from vm

#

in that pattern

#

in controller that part is a bit more interconnected, you can have it on either

#

hence the can get messy comment

#

this is a better one i think

#

since it shows the method names as an example

worn jasper
#

Hmm, one thing I forgot to mention is that I technically also already create the embeds in the handler, so it loads data, creates/formats an embed and stores an object with info + that already created embed. (Did this so that it doesn't need to create a new embed every single time the command is used)

merry knoll
#

like so

#

i would probably turn those embeds into their own class

#

so you can just send and pass vm class to it

#

so it registers

worn jasper
#

so the model would load data, ask another class to make the embeds, model gets them back and saves it?

#

I am a bit confused now

merry knoll
#

do you have actual data?

#

or your data is your views? aka embeds?

merry knoll
# merry knoll

in here model usually is a facade class that handles sql or rest stuff

worn jasper
# merry knoll do you have actual data?

I load jsons, then I create an embed with all the data formatted, then I have a record class with general info like name, category, reference list and the embedbuilder itself and I also store the JsonObject itself in case I require it for anything else later on. Then it's saved.

merry knoll
#

okay you got data then

#

your json stuff would be the model

#

and vm would not interact with the loading or reading that data

#

thats models job

worn jasper
#

Even the then I create an embed with all the data formatted?

merry knoll
#

you go "gimme this" and it loads / provides it

#

yes, vm creates the embed

worn jasper
#

oh so not the model?

#

cause rn it's the model that is creating it

merry knoll
#

model

#

does not interact

#

with the view at all

#

all it does is notifying vm in the case of a change

worn jasper
#

but then I wouldn't be able to save the embed?

merry knoll
#

vm is the one holding the reference

worn jasper
#
public record EntryData(String id, String displayName, String category,  String wikiUrl, EmbedBuilder embed, List<String> references, JsonObject object) {
}```
merry knoll
#

and it can also update the model

worn jasper
#

this is basically the record

merry knoll
#

okay so in your case

#

it would be like

worn jasper
#

I wouldn't be able to store the embed without generating it first.

merry knoll
#

why not? model holds your data

worn jasper
#

model has EntryData records cached

#

records are immutable

merry knoll
#

why is your embed in the record

worn jasper
#

so that I don't require to generate it the whole time

#

it only rlly needs to be created once.

merry knoll
#

that logic should be in the vm

#

if you wanna follow that pattern

#

you can cache it or w.e. you wanna do in there

#

and model should just handle the data itself

#

so json(io) stuff

#

and providing its data

worn jasper
#

So cached data will be in model and VM would contain the cached embeds?

merry knoll
#

and not sure if it is a requirement but the pattern is made for multiple threads

#

yes

#

your logic is in vm (all of it, creating embeds etc included)

#

your interaction listeners are in view

#

so event listeners etc are there and view holds a reference to vm

#

so it can notify it observer pattern style

#

if you feel like its too much of a refactor, i would just move your "search" logic into another class

#

and keep a reference to it

worn jasper
#

I mean, nothing is too much of a refactor if at the end means your project is well structured.

#

What's the naming conventions for these btw? Just GameModel, GameController and GameView or what? xD

merry knoll
#

somethingview

worn jasper
#

Also, random thing but wouldn't the VM class be like, big af? xD

merry knoll
#

somethingvievmodel

#

you can call it controller too doesnt matter too much

worn jasper
#

?

merry knoll
#

data is usually named repository

worn jasper
#

Hmm okay

merry knoll
#

or DAO

worn jasper
#

I saw something that stated DAOs have factories?

#

Would this be something useful for this case too or nha?

merry knoll
#

yes and no

#

depending on if you do unit tests

#

factories are there so you can just mock the class easier

#

if you dont care, then eh

#

i would probably include a di framework though, just cause it stops you from worrying about load orders

worn jasper
#

any recommendations?

#

Never used DI frameworks

royal hedge
#

id recommend dagger

merry knoll
#

dagger +1

royal hedge
#

its lightweight and doesnt use too much magic

rain wasp
#

How can i properly set an itemframes rotation (it has a map)?

graceful citrus
worn jasper
#

(thanks to both of your recommendations)

royal hedge
#

i wouldnt say triumph is that magical

#

its just that most di frameworks can automagically resolve interfaces to their implementation without you specifying anywhere which implementation to use

#

(thatll make more sense when after u use one btw)

worn jasper
#

Might be wrong, this is a presumption from a quick glance at the docs

royal hedge
#

its not magic though because you need to tell dagger where the @Provides methods come from with @Component(modules = <providing classes>)

worn jasper
#

part where I am confused is, where does it all start? xD

#

Taking my case as an example

#

I have the "handler" class for game A and another from game B, I want only a single instance to be used for everything, how would I do it? Just create a method inside that class that returns this and I set it as provides and singleton and voila or...?

#

I am a bit confused with the docs

#

might be useful

worn jasper
#

oh thanks

royal hedge
#

had to get the link from when ive sent it before 😭

#

idk why its unlisted

worn jasper
#

speedrunning this before bed

#

xd

worn jasper
#

@royal hedge do you have the playlist link? the links you sent still didn't cover enough for what I need

worn jasper
#

ok ty

minor summit
#

dagger is neat

royal hedge
#

No Jakarta or jpms support tho

#

But yeah its nice

rain wasp
#

how can i set the rotation of an itemframe with a map?

if (itemFrame.attachedFace == BlockFace.UP || itemFrame.attachedFace == BlockFace.DOWN || true) {
    var normalizedYaw = event.player.location.yaw % 360
    if (normalizedYaw < 0) {
        normalizedYaw += 360
    }
    itemFrame.rotation = when {
        315 < normalizedYaw || normalizedYaw <= 45 -> Rotation.NONE // South
        45 < normalizedYaw && normalizedYaw <= 135 -> Rotation.COUNTER_CLOCKWISE // West
        135 < normalizedYaw && normalizedYaw <= 225 -> Rotation.FLIPPED // North
        else /*225 < normalizedYaw && normalizedYaw <= 315*/ -> Rotation.CLOCKWISE //East
    }
}

this shit aint working

robust flower
#

I need an algorithm that, given a certain start point, it starts visiting the neighbor points in a 2D grid in a way that never visit the same point twice, and without using any memo of the points already visited (do not use any "visited" data structure to remember what points where already visited).

Is there an algorithm that does exactly that? The idea is to visit the neighbors and their neighbors recursively (or iteratively) until some condition is met, then stop branching there and resume in some other place. I have acces to multithreading, but doing this recursion/iteration single threaded is just fine too.

robust flower
# rain wasp how can i set the rotation of an itemframe with a map? ```kotlin if (itemFrame.a...

Not what you asked, but you can combine these two:

var normalizedYaw = event.player.location.yaw % 360
if (normalizedYaw < 0) {
    normalizedYaw += 360
}

Into a single line

val normalizedYaw = (event.player.location.yaw + 360) % 360

You can also improve these comparisons:

315 < normalizedYaw || normalizedYaw <= 45 -> Rotation.NONE // South
45 < normalizedYaw && normalizedYaw <= 135 -> Rotation.COUNTER_CLOCKWISE // West
135 < normalizedYaw && normalizedYaw <= 225 -> Rotation.FLIPPED // North
else /*225 < normalizedYaw && normalizedYaw <= 315*/ -> Rotation.CLOCKWISE // East

Can become:

normalizedYaw in 45..135 -> Rotation.COUNTER_CLOCKWISE // West
normalizedYaw in 136..225 -> Rotation.FLIPPED // North
normalizedYaw in 226..315 -> Rotation.CLOCKWISE // East
else -> Rotation.NONE // South (< 45 || > 315)
hoary scarab
robust flower
hoary scarab
#

Hmmm. Well I have a method that gets a new location in a "spiraling" grid pattern that does essentially what you are requesting. Which I use for skyblock but maybe it would help? Or maybe I'm just completely misreading your question lol.

#

Could also look at other open source skyblocks I guess lol

merry knoll
#

google discrete maths cycle or something similar

forest jay
#

I have a plugin that only shows entities when a player is close or looking in its vicinity. I am struggling however to make it efficient. Here is my code, its a bit of a mess, what should I do to make it more efficient? https://paste.helpch.at/eyanuqohes.kotlin

dusky harness
#

wdym struggling to make it efficient? do you have like a spark report?

#

tbh I probably cannot help because I have to leave soon, but a spark report should make it easier for others

forest jay
dusky harness
#

oh wow
try adding spark

forest jay
#

I know its better

#

I am not home and a customer sent me that ^

dusky harness
#

👍

#

so it doesn't happen in your testing?

forest jay
#

I mean, not that bad

#

But he had 100 people online loading a large world

#

with a lot of entities

#

I just dont know where I could make the code more efficient, since I cant run async due to the entity calls.

sterile hinge
#

spark would be far more insightful in that case

worn jasper
#

@merry knoll looks a bit better? xD

forest jay
sterile hinge
forest jay
#

Yeah but it will be a bit

dusky harness
forest jay
#

they dont exist on the server

#

and I use packets to fake them

#

they are passengers to normal entities, and they should only show when looking at the vanilla entity

minor summit
#

why not use real text displays?

dusky harness
#

With lambda attack or a modern version

dusky harness
minor summit
#

setPersistent(false) in shambles

dusky harness
minor summit
#

for a very long time

dusky harness
#

Oh wait also its per player isn't it

dusky harness
minor summit
#

yes?

dusky harness
#

That would've been very helpful to me a while ago D:

#

Hold on lemme check

#

Oo

forest jay
minor summit
#

text displays are absurdly cheap

#

at one point if you have too many the server will spend more time checking whether they are visible to players than anything else, but you need way too many

#

and you are struggling with that already and I doubt you have that many :^)

forest jay
#

For example, since one person may be looking at an entity, and another might not, I would run into issues when there were multiple of them showing on an entity. Like if I had a nametag. If one person is looking at it and seeing its textdisplay, then that means that its fake nametag (since the passenger gets rid of the nametag) then has to be offset above the entity which looks weird for the other person. (the text displays dont always show if you look at it, is has more prereqs than that)

#

And then for horses, you cant mount if thye have an entity, so I had to do some event and packet crap to get that to work

#

And then the big issue was the game doesnt allow people to teleport with passengers. It is a bug, but Mojang hasnt fixed it yet, and it wont be fixed in previous versions. This is a huge issue, and fake entities fixes it. This is the primary issue.

#

The event never goes through, neither the packets, so there is no way for me to listen for it.

minor summit
#

the game does allow it tho

forest jay
#

Well for some reason on 1.20.4 it doesnt work, a bunch of people who bought my plugin complained about it

minor summit
#

there are teleport flags in the api as well, and there is a paper pr to add a prepare teleport event where you can add the teleport with passengers flag

#

but, yeah

#

™️

forest jay
minor summit
#

which part

forest jay
#

allowing the teleport event to go through with passengers

minor summit
#

i mean, events are api

#

api is for developers

forest jay
#

Well yeah, so then I cant do anything about it

#

Cause /tp is something handled in vanilla

#

and it wasnt working with passengers, neither was nether/end portals

minor summit
#

so your plugin would be able to intercept the event and add the tp with passengers flag

#

but, it's wip

forest jay
#

yeah, and its only on paper, right?

minor summit
#

sure?

forest jay
#

so then it wouldnt be available on Spigot, which some of my customers use spigot or forks of spigot, and not paper

minor summit
#

cringe

forest jay
#

yeah ik but its not my choice

minor summit
#

it sure is

forest jay
#

I have to appease the customer, if my plugin works with a broader selection of server implementations, I can get more customers

minor summit
#

you should add bstats to make decisions 😄

#

i regret not doing that earlier

#

like, if targeting spigot is hindering and limiting your product development and progress, is it really worth it?

#

that will depend on the % of customers that use X or Y which bstats is great for

forest jay
#

since it is still "in progress" and just a PR

#

no matter what I have to account for it until it gets pushed into Paper, and anyways, a lot of people use outdated versions < 1.20 so I still have to support that as well

#

and I like a challenge

olive stump
#
[3043.244s][warning][os,thread] Failed to start the native thread for java.lang.Thread "HandshakeCompletedNotify-Thread"
[3044.245s][warning][os,thread] Failed to start thread "Unknown thread" - pthread_create failed (EAGAIN) for attributes: stacksize: 1024k, guardsize: 0k, detached.
[3044.245s][warning][os,thread] Failed to start the native thread for java.lang.Thread "HandshakeCompletedNotify-Thread"
[3045.462s][warning][os,thread] Failed to start thread "Unknown thread" - pthread_create failed (EAGAIN) for attributes: stacksize: 1024k, guardsize: 0k, detached.
[3045.462s][warning][os,thread] Failed to start the native thread for java.lang.Thread "Craft Scheduler Thread - 300"
[3045.463s][warning][os,thread] Failed to start thread "Unknown thread" - pthread_create failed (EAGAIN) for attributes: stacksize: 1024k, guardsize: 0k, detached.
[3045.463s][warning][os,thread] Failed to start the native thread for java.lang.Thread "Craft Async Scheduler Management Thread"
[14:03:30 ERROR]: Caught previously unhandled exception :
[14:03:30 ERROR]: Craft Async Scheduler Management Thread
java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached
        at java.lang.Thread.start0(Native Method) ~[?:?]
        at java.lang.Thread.start(Thread.java:809) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:945) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.processWorkerExit(ThreadPoolExecutor.java:1013) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1150) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
        at java.lang.Thread.run(Thread.java:840) ~[?:?]
#

anyone help please

sterile hinge
#

You‘re reaching a thread/process limit of your container/os

olive stump
sterile hinge
#

Increase the limit

olive stump
sterile hinge
#

Depends on where the limit comes from

olive stump
#

It's hosted on a vps

sterile hinge
torpid raft
#

i feel like its more likely he ran out of memory than that he has too many processes

#

consider not setting your Xmx equal to the exact same amount as your available system memory

#

instead, set it to like 500mb-1gb below, you can play around to find a stable configuration

hoary scarab
#

For those wondering the new way to get NBTTagCompound is from the DataComponentMap.

public NBTTagCompound getCompoundTag(ItemStack item) {
    net.minecraft.world.item.ItemStack minecraftItem = CraftItemStack.asNMSCopy(item);
        
    DataComponentMap componentMap = minecraftItem.a(); // getComponents()
    CustomData typeData = componentMap.a(DataComponents.b); // get(DataComponents.CUSTOM_DATA)
    return typeData != null ? typeData.c() : null; // copyTag() || getUnsafe()
}
    
public void setCompound(net.minecraft.world.item.ItemStack minecraftItem, NBTTagCompound tag) {
    CustomData data = CustomData.a(tag); // of(tag)
    minecraftItem.b(DataComponents.b, data); // set(DataComponents.CUSTOM_DATA, data)
}
```Took me way longer then I should admit to figure this out.
stuck hearth
#

Every time I see java code I get sad

river solstice
#

ah yes a and b

hoary scarab
#

🤷 I can post the mapped version lol

river solstice
#

nah im just shitting on nms

hoary scarab
#

Added anyways

atomic trail
#

Does TriumphGui slots go from 0 or 1?

neat pierBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
HelpChat Paste - How To Use

tight junco
atomic trail
grave isle
atomic trail
#

@pulsar ferry Sorry for @ but is it possible to limit a paginated gui to specific slots? So when I use gui.addItem(item) it will only fill a specific area, or do I need to fill all other slots with something else?

grave isle
#

does someone know what changed with the offsets

tight junco
#

you can do uh

#

Builder#pageSize

atomic trail
atomic trail
spiral prairie
#

It works, I use it in my plugin

#

You can just use new GuiItem(Material.AIR)

atomic trail
#

Ah yeah because it's wrapped in GuiItem

#

Thanks!

marble flint
#

does anyone know why my discord will not let me create a bot

pulsar ferry
#

?not-discord

neat pierBOT
#
FAQ Answer:

Looking for discord support?
HelpChat is a Minecraft plugin and development support server and is not affiliated with discord in any way.
If you require support from discord, we recommend you to visit their official support website at https://support.discord.com
On this website, you can read their FAQs, or open a support ticket if necessary.

worn jasper
dark garnet
#

fuck you barry im not rewriting that, guess i give up

dusky harness
#

ctrl z

dark garnet
dusky harness
#

but it works if u just sent it

dark garnet
#

ill just rewrite it with less detail!

dusky harness
#

💀

dark garnet
#

ping if reply ^

unborn ivy
#

hello im trying to recompile an open source plugin that uses the log 4j LifeCycle.State enums, everything looks good in the code until I try to package it with maven, throwing me this error cannot find symbol, anyone know how i can fix this error?

#

take a look at the errors

unborn ivy
warm steppe
# dark garnet ping if reply ^

Nag author(s): '[srnyx]' of 'EventAlerts' about their usage of System.out/err.print. Please use logger instead (Logger#getLogger).

river solstice
#

get nagged

spiral prairie
#

Lmao I always use system.out.println for debug messages because some shit ain't working so I know to remove them

unborn ivy
#

getlogger info works too

spiral prairie
sterile hinge
#

It’s easier to just use a proper debugger

spiral prairie
#

💀

unborn ivy
#

we all know deep down we cba to make debugging stuff

icy shadow
#

speak for yourself

river solstice
unborn ivy
#

😭

warm steppe
#

use gradle

dark garnet
warm steppe
#

unprofeshnl

minor summit
#

if only loggers existed outside of minecraft plugins

stuck hearth
river solstice
#

Arrays.stream(EConfigFile.values()).forEach(cfg -> cfg.getConfig().load());

#
java.lang.NullPointerException: Cannot invoke "me.m0dii.pagrindai.utils.other.EConfigFile.getConfigFile()" because "me.m0dii.pagrindai.utils.other.EConfigFile.DUEL" is null
#

what

stuck hearth
#

Looks like something is null 😳

river solstice
#

yeah lmao

#

I call that in onEnable()

#

fsr the Enum is null

#

lol

misty light
#

tried adding evalx math to my papi expansion and now it won't load

#

doesnt show up in papi list

#

and this is what I have:

                    Expression math = new Expression(arguments);

                    try {
                        return math.evaluate().getStringValue();
                    } catch (
                            EvaluationException |
                            ParseException e) {
                        throw new RuntimeException(e);
                    }```
hoary scarab
#

Any reason ItemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); wouldn't be applied in 1.20.5?
Seems like the item is modified when given to the player.

private ItemStack item;
public ItemStack getItem() {
    if(item != null)
        return item;

    ItemStack i = new ItemStack(Material.ENDER_PEARL);
    ItemMeta m = i.getItemMeta();

    m.addEnchant(Enchantment.ARROW_DAMAGE, 1, true);
    m.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
    m.addItemFlags(ItemFlag.HIDE_ENCHANTS);

    i.setItemMeta(m);
    item = i;
    return item;
}

public void join(PlayerJoinEvent event) {
    event.getPlayer().getInventory().addItem(getItem());
}

public void interact(PlayerInteractEvent event) {
    Player p = event.getPlayer();
    ItemStack item = event.getItem();

    if(item != null) {
        p.sendMessage("IsItem: "+(item.isSimilar(getItem()));
        p.sendMessage("CustomItem: "+getItem().toString());
        p.sendMessage("Item: "+item.toString());
    }
}
````CustomItem` will contain "HIDE_ATTRIBUTES" but `Item` won't.

> IsItem: false
> CustomItem: ItemStack{ENDER_PEARL x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, {*Removed unnecessary*}, ItemFlags=[HIDE_ENCHANTS, HIDE_ATTRIBUTES]}}
> Item: ItemStack{ENDER_PEARL x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, {*Removed unnecessary*}, ItemFlags=[HIDE_ENCHANTS]}}
warm steppe
#

send #getItem

hoary scarab
warm steppe
#

try adding itemflags as an array

#

like m.addItemFlags(List.of(/* both flags here */));

#

@hoary scarab

#

cuz it seems like it is ignoring your first additemflags

hoary scarab
#

Thats not the issue though. The CustomItem contains the flags as seen from the debug text.
The clicked item does not.

#

It seems like PlayerInventory.addItem(getItem()) is removing certain flags.

#

Will still test though. Give me a sec.

#

m.addItemFlag(new ItemFlag[]{ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_ENCHANTS}); didn't work either.

#

Might just have to make my own ItemStack.isSimilar(ItemStack) method.

cosmic burrow
#

How can i make a placeholder extension for using in itemlore?

rancid bronze
#

ProtocolLib or custom implementation using NMS

#

?

#

Have heard of a couple situations where protocollib is actually quite slow

#

would love to hear some opinions

sterile hinge
#

Depends

turbid cove
dusky harness
#

If you mean in spark/timing reports, that's likely due to a plugin using plib being slow in it's listener which results in plib appearing slow

edgy ermine
#

Hello, is there a way to decrease plugin priority for deluxemenus? I'm currently using skript to add events to slots and realized that my code works with anything but deluxemenus gui. I had asked on their support server and they told me that plugin priority would need to be decreased. Is it possible?

unborn ivy
#

if it doesnt work you may have to code your menu in skript or use deluxemenu's entirely

worn jasper
#

simple solution: don't use skript

worn jasper
misty light
neat pierBOT
#
Possible Solution Found:

Your plugin / expansion shade PlaceholderAPI. Here's how to fix that:

  • For Maven, set <scope> to provided
  • For Gradle, use compileOnly instead of implementation
dark garnet
#

much better than the bump above

proud pebble
hoary scarab
flat talon
#

my placeholder api expansions placeholders get unregistered whenever i do /papi reload, do i have to listen to an event or something

hoary scarab
flat talon
#

ty

minor summit
#

this is so silly

hoary scarab
grave sky
#

hi, i have a inventory code, where on click it toggles a setting but i want the lore of the item to be updated i tried using inventory.setItem(11, tiltSetting); but this doesnt seems to be working. is there any to update the item or the inventory without reopening it?

my code:

    public static GuiBuilder createSettingsMenu(Player player, Plugin plugin) {
        GuiBuilder inventory = new GuiBuilder(3 * 9, formatColors("Settings"));

        // NewDamageTilt Setting
        ItemStack tiltSetting = new ItemBuilderGUI(Material.NETHERITE_SWORD)
                .name(formatColors("&eDirectional Damage Tilt"))
                .lore(formatColors(" "))
                .lore(formatColors("&fStatus:&r " + SettingsManager.getSettingStatus(player, "NewDamageTilt")))
                .flags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_ENCHANTS)
                .build();
        inventory.setItem(11, tiltSetting, p -> {
            SettingsManager.toggleSetting(player, "NewDamageTilt");
            inventory.setItem(11, tiltSetting);
        });
        return inventory;
    }
}
river solstice
#

it is working

#

you just have to update the inventory view for the player

grave sky
river solstice
#
                guiItem.setAction(e -> {
                    // do something

                    gui.update();
                });
grave sky
#

👍

neon pewter
#

is it possible to add text format to doc comment

dense drift
#

Javadoc comments support html

#

There is also the {@comment } tag

neon pewter
dense drift
#

Study what? You simply use html tags such as <ol> <ul> <table> etc. in the comment

neon pewter
#

oh

#

i have not learn html yet

#

ok thanks i figured it out

dense galleon
#

A month and a half ago I changed my .m2, but I forgot how I did that

#

(I'm trying to sort it out how google says rn)

minor summit
#

I don't think you can change the whole of .m2, but the local maven repo location, in $HOME/.m2/settings.xml <settings><localRepository> to change the local repo location (by default it's in $HOME/.m2/repository)

dense galleon
#

when running the install maven task, is there a way to check where the project is being 'published'? (not sure if that is the correct term)

#

Thing is: in my other project's pom.xml I can find the dependency

#

However, when I try using said dependency in any of my classes it won't work

minor summit
#

pretty sure it gets logged when you run the install goal

#

I haven't used maven in ages however

dense galleon
#

You recon it could be a good occasion to switch to gradle?

dense drift
#

doesn't it use the same cache as maven?

dense galleon
#

I have no idea

#

When converting from Maven to Gradle, what's the standard? Kotlin or Groovy?

broken elbow
#

Kotlin. I will not give any arguments for it :))

river solstice
#

Groovy

dense galleon
#

What's the equivalent of install in gradle?

#

To both publis to the local repository and compile the plugin?

river solstice
#

publishToMavenLocal?

broken elbow
#

Isn't there a gradle install command as well?

dense galleon
#

I don't think so

#

At least, I can't find it

dense galleon
broken elbow
#

hmm. maybe I'm wrong. I had not published anything to my local repository using gradle. Only maven

river solstice
#

or you can prob just make a different script that runs build and publish after

river solstice
broken elbow
#

not having to host a remote repository?

#

idk

river solstice
#

well I was just about to say if it's a simple use-case a flat-dir would do the trick

dense galleon
#

I'm making a bunch of plugins for my network, some plugins depend on others

river solstice
#

well you can ignore my comment then

dense galleon
#

Uhh switch expressions are not supported in -source 8

#

It says to use -source 14 instead..? Idk where I change that

#

In my settings.xml found in my .m2 directory, I set the localRepository to being C:\Users\<user>\.m2\repository, however when I run publishToLocalMaven it still goes to the old location..?

minor summit
#

Gradle uses the same logic as Maven to identify the location of your local Maven cache. If a local repository location is defined in a settings.xml, this location will be used. The settings.xml in <home directory of the current user>/.m2 takes precedence over the settings.xml in M2_HOME/conf. If no settings.xml is available, Gradle uses the default location <home directory of the current user>/.m2/repository.

dense galleon
#

Yeah but for some reason it's not publishing there?

#

It's still publishing in my old location

#

Can I just delete my .m2 folder refresh gradle?

#

I deleted my .m2 folder, yet everything's still working? Is it possible I have a duplicate .m2 my projects look into

stuck hearth
#

Did you like configure your local gradle to point somewhere else (.gradle/ I think?)

dense galleon
#

Ah also, I used to use maven im switching to gradle just now

stuck hearth
#

It's been a long time and I'm not at my pc, but I think you can set user wide settings
It'd be in appdata I think?

#

Oh

#

Probably not then

fleet shale
#

Has anyone had luck with making multiblock structures with their plugins i’m trying to make one and the method i have so far works for the end function but i can only get a successful detection if i build the structure in z+ x+ order and only one configuration works instead of it detecting the 3x3x1 when any blocks in its order are placed

dark garnet
torpid burrow
#

hi, i'm new to developement stuff i have a bukkit plugin made, how do i add an api to it? pretty weird question i know but this is the first time i'm trying to do something like this

feral raptor
#

https://gist.github.com/BitCashMC/cfb087a7b541a9d49f3f6c39ffd8d39f

If anyone can critique a dummy project of mine that handles login, registration of accounts using serialization please do, it would be a major help:

Gist of it: I'd like to know if the logic seems succinct and whether its too verbose or not

  • Customer represents the Customer with all of its behaviors and serves as a central aggregator for the app in the sense that most data displayed will depend on the Customer thats logged in
  • Session controls the current Session environment and possesses a Customer as a field which heavily influences the data displayed across the full app. Session also is where methods are stored for the registation and authentication attempts of accounts

I do have concerns that I did not organize the application the best way, and that the functionalities of a Customer and a Session may be too mixed up and therefore confusing to the client

Gist

GitHub Gist: instantly share code, notes, and snippets.

river solstice
#

empty line there, no empty like there, extra space there, no space there

icy shadow
#

surpressing the IOException on line 76 for example is questionable

torpid raft
#

i'm also curious why you decided to have an 'isLoggedIn' attribute for your Session class, maybe i don't follow exactly what you want this class to be responsible for?

dense galleon
#

Is it possible that my IntelliJ projects are looking into anothe folder that is not .m2 for the settings.xml file?

torpid raft
#

using ec2 seems suboptimal

#

it's pricey, and also doesn't offer the best performance compared to what you can get with providers that are meant for game servers

dusty frost
#

yeah a dedicated server would be cheaper and would perform better

coral vector
#

I need to create an account on the ecloud

torpid raft
#

rip

inner field
#

Is there a way to enable placeholders to be used in bungeecode like a tab plugin?

tribal fox
#

Because replacing a placeholder in a server from a bungeecord/velocity isn't do able

#

Hello, How I make it to use PAPI as a depend for my custom plugin, but I want so if the server doesn't have PAPI it will work okay.
Because its custom messages, so the user can configure the messages he want and use whatever placeholder he wants from PAPI if it's installed.
( My first plugin sorry if it's stupid question )

turbid jewel
#

How do they know the attack speed modifier of a sword, in this case -2.4000000953674316??
I need to know the value for attack damage modifier of a sword

minor summit
#

in a spigot plugin? Material.DIAMOND_SWORD.getDefaultAttributeModifiers()

robust flower
#

Is this code wrong in any way?

fun MovecraftLocation.chunkKey(): Long = (chunkX.toLong() shl 32) or chunkZ.toLong()

Where chunkX and chunkZ are defined as:

public int getChunkX() {
    return getX() >> 4;
}

public int getChunkZ() {
    return getZ() >> 4;
}
feral raptor
# torpid raft im curious as to why you decided to put the methods associated with loading and ...

The session class gets instantiated when a new session is created and will then use the given load functions to pair an account with the current session instance. I actually moved it to a "SessionService" utility class and made all the methods static. Will send it soon. I'm not sure if this is normal architecture or if its strange. If so, what would you recommend in this aspect that I do instead?

feral raptor
cyan veldt
#

how can I get a placeholder's value for a specific player in my plugin, i can't find any methods for it

#

is this how i am supposed to do it?
String CoinsCalculation = "%player_name%"; String Coins = PlaceholderAPI.setPlaceholders(player, CoinsCalculation);

#

note: im using %player_name% just for a example, not because i think i have to put the playername there

warm steppe
#

thats one way to do it

cyan veldt
warm steppe
#

you want to get a placeholder value from your own plugins placeholder?

warm steppe
#

Then use PlaceholderAPI#setPlaceholders

cyan veldt
grave sky
cyan veldt
tribal fox
#

Hello, How I make it to use PAPI as a depend for my custom plugin, but I want so if the server doesn't have PAPI it will work okay.
Because its custom messages, so the user can configure the messages he want and use whatever placeholder he wants from PAPI if it's installed.
( My first plugin sorry if it's stupid question )

cyan veldt
tardy sonnet
#

Hi!
I'm struggling with these NoClassDefFound and ClassNotFoundException errors/exceptions and I have no idea what's going on with them, I've googled countless times for a solution and nothing works, so my last chance is to ask people with more experience than me 🥺
Basically this error or exception sometimes breaks part of my plugin, causing some of my GUI's (from an external, personal and shaded library), commands or event classes to not work, they're not always the same ones but just random classes that stop working
This is most of the times fixed by restarting the server but I can't just restart the server randomly and tell my players to join back again because of the way my server's minigame (or game mode) works

Error (one of the many cases, could be any class): https://hastebin.com/share/fahecerivi.ruby
Class location: https://imgur.com/a/reWmPQV
My class: https://hastebin.com/share/abozuxihar.java
My GUI lib location: https://imgur.com/a/IWOPNEI
build.gradle: https://hastebin.com/share/sugozozeru.java

I doubt my GUI lib is the problem here since it has happened before with simple event or command classes
My GUI lib has a GUIManager that is registered in the main class for classes extending 'GUI' to work

First time posting here so I apologize if I'm missing something or if my request is inappropiate, lmk if I have to provide something else

grave sky
#

How can I update placeholders in an inventory? For example, if I use %myplugin_player_coins%, the placeholder won't update instantly unless I reopen the gui

cerulean night
#

Hi. I wonder how to use deluxe menu with an item, that if i am in inventory and right click it, it will open a menu. Do you know any plugin or how to do that ?

frail bronze
robust flower
#

Has anyone here already handled setting many blocks in a world at once while also moving the player? I am having issues where after setting tons of blocks and teleporting the player to this place, the player's client freezes for some seconds. Why would that be?

I also see these warn messages in the console, should I worry?

[09:33:50 WARN]: Block entity minecraft:furnace @ BlockPosition{x=534, y=167, z=71} state Block{minecraft:air} invalid for ticking:
[09:33:50 WARN]: Block entity minecraft:furnace @ BlockPosition{x=534, y=166, z=71} state Block{minecraft:air} invalid for ticking:
visual nova
#

For some reason my custom PlaceholderAPI expansions won't work, even though I'm registering it correctly.
[16:34:56 INFO]: [PlaceholderAPI] Successfully registered expansion: modern_player [0.0.1]
[16:34:56 INFO]: [PlaceholderAPI] Successfully registered expansion: modern_arena [0.0.1]

I also tried to debug the register and it says it's done successfully.
But the placeholders still do not work, neither on onRequest or onPlaceholderRequest.

#

I have the latest version of PlaceholderAPI I though it could be a bug on that specific version, turns out it does not work on previous versions either.

hoary scarab
#

Show your code and what the parse command outputs.

visual nova
#

Command: /papi parse me %modern_players_kills%
Result: %modern_players_kills%

onEnable() {
new ModernPlayerPlaceholderExtension(this).register();
}

I should mention that I also that PlaceholderAPI is added as a "softdepend" in plugin.yml
and my expansion class: https://pastebin.com/BwqS38hy

#

I've done this over 10 times without having issues like that before, I'm just confused.

robust flower
# hoary scarab Show your code and what the parse command outputs.

I've switched to the WE API and the experience is SOOOO much niceeer, the difference not even funny, so that error is not happening anymore (thanks God), but now I have some questions regarging the WE API.

I'm currently using EditSession#moveRegion to (obviously) move a region, and it has been a very pleasant experience. I've disabled most of the SideEffect and currently I've not noticed anything weird, except for the SideEffect.LIGHTING. It does what I assume it'll do when I turn it ON or OFF, but it behaves oddly when set to DELAYED - it only update light sometimes, in some of the moving operations, while others it doesn't update anything related to light at all, why is that?

Also, is there a way to "force" light updates in a region after all blocks have been set (using WE API only)? This is because disabling light updates reduces the total operation time from ~1.1s to ~0.35s, which is a massive gain IMO. I can afford calculating the light later on, in another tick or after some seconds, but I don't know how to do that.

I would also like to know if there's a comprehensive list of what each SideEffect is. Some are obvious, like LIGHTING or ENTITY_AI, but others like EVENTS, UPDATE and VALIDATION are unclear to me what they do, so if there's a small list anywhere describing what each side effect is, that would be awesome.

visual nova
sharp hemlock
#

so it looks like shiny utils is i assume a dependency? and then its a callback going to your plugin?

is it shaded properly

tardy sonnet
tardy sonnet
#

anyways it has happened before with an events class :/

sharp hemlock
#

and ur not uploading a new jar via while the current one is running no?

tardy sonnet
dense drift
winter galleon
#

@leaden plume i need ur help

ocean crow
#

Been looking into migrating from 1.16 nms to 1.20, didn’t know if there’s any tools or documentation out there for it as it’s been a while for me.

minor summit
#

I mean, stuff changed

#

nms is very much "fuck around and find out" territory

ocean crow
#

Yeah fair

#

I know a lots changed so that why I’m like ehhhh I could realistically leave it as is, but it’s nice to be on newer jars

minor summit
#

like, it depends on what the plugin currently does with nms to know what the alternatives today are, for some things there might even be supported API, the largest change is probably gonna be the use of mojang mappings rather than Spigot's stupid class and method names

ocean crow
#

It’s the core to our prison server, but yeah

#

Was gonna compare from spigots site but the compare on their repos is not working

bleak arch
#

does anyone know how to create custom guis in forge?

#

And custom items...

#

I didn't find much information on the internet

proud pebble
#

i dont think you can make custom guis in a forge server

#

well you can, but its lots and lots of extra work

bleak arch
#

Oh

rocky quarry
robust flower
worn jasper
#

Check Triumph-guis' code

#

(or better, use it)

royal hedge
#

because you don't have to reopen it

#

it's probably due to bukkit's funky item clones

#

you'll most likely have to do

ItemStack myItemStack = new ItemStack(Material.GOLD);
Inventory inventory = ...;
inventory.setItem(slot, myItemStack);
ItemStack mirroredItemStack = inventory.getItem(slot); // this one has its changes mirrored to the inventory
mirroredItemStack.editMeta(meta -> ...); // use setItemMeta on spigot
grave sky
atomic trail
#

Essentials question:

Is it possible to use Essentials chat format without having the EssentialsXChat plugin on the server? I just want the format using the api

cosmic musk
#

Does anyone know how to add an itemsadder menu layout to deluxemenu?

pulsar ferry
torn heart
#

if your client is modded then ignore everything I just said and just Google it because it's a well-known topic

cosmic musk
minor summit
#

no-one is going to help if you ask in the wrong channel

forest jay
#

Do you guys know where I can find documentation on packet bundles? I want to send multiple packets at once (that rely on one another) but I cant seem to figure out how to use a packet bundle (using NMS)

minor summit
#

documentation? bahahaha

#

but basically, see how the game uses it

#

i know it's used to bundle all the packets related to spawning an entity in the world

brittle ginkgo
#

what is a packet bundle

sterile hinge
#

A packet of packets

brittle ginkgo
#

ohh cool

#

a new minecraft update?

fleet shale
#

anyone have experience in trig here im working on a helical particle string but for the love of all that sholy i cant figure out this issue it keeps making an ablong oval with sharp corner turns or wierd shapes in the helix with this math and im absolute dog sheit with trig

                double x = helixRadius * Math.cos(angle);
                double y = helixRadius * Math.sin(angle);
                double z = helixRadius * Math.sin(angle);
                Location helixLocation = currentLocation.clone().add(x, y, z);
torpid raft
#

if you think about a helix as being drawn in 3d space, you are basically tracing a circle with 2 coordinates (which takes trig) while the third is simply linearly increasing

fleet shale
#

i attempted using 0 as the y but then the helix is just flattened to a 2d wave on the x and z axis and if i 0 the z or x respectively instead i get a 2d oriented in the other orientation on the y axis or x axis etc idk where im going wrong math is hard XD

#

this is the full void if it helps at all

public void summonParticleString(Location startLocation, Location endLocation, Particle particle, int count, double offsetX, double offsetY, double offsetZ, double speed, double helixRadius, double helixPitch) {
        World world = dim();
        if (world == null) return; // Ensure the world is not null

        new BukkitRunnable() {
            private double distance = startLocation.distance(endLocation);
            private double traveled = 0;
            private Location currentLocation = startLocation.clone();
            private double deltaX = (endLocation.getX() - startLocation.getX()) / distance;
            private double deltaY = (endLocation.getY() - startLocation.getY()) / distance;
            private double deltaZ = (endLocation.getZ() - startLocation.getZ()) / distance;
            private double angle = 0;

            @Override
            public void run() {
                if (traveled >= distance) {
                    cancel();
                    return;
                }

                world.spawnParticle(particle, currentLocation, count, offsetX, offsetY, offsetZ, speed);

                // Calculate helix position
                double x = helixRadius * Math.cos(angle);
                double y = helixRadius * Math.sin(angle);
                double z = helixRadius * Math.sin(angle);
                Location helixLocation = currentLocation.clone().add(x, y, z);

                // Spawn Flame particle at helix position
                world.spawnParticle(Particle.DRAGON_BREATH, helixLocation, 10, 0, 0, 0, -0);

                // Move the current location along the direction towards the end location
                currentLocation.add(deltaX, deltaY, deltaZ);
                traveled += Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ);

                // Increment angle for next helix position
                angle += Math.PI / 5; // Adjust the divisor to change the helix frequency
            }
        }.runTaskTimer(plugin, 0, 1); // Change 'plugin' to your plugin instance
    }
torn heart
#

anyway if you don't figure it out before 4 hours from now I'll send u a solution

#

because school

forest jay
#

I currently have a system that adds a client side entity to all nearby entities. This is ran through a getNearbyEntities call every 5 ticks (using a BukkitRunnable). This works great, however when an entity is spawned in, like a player, sometimes the plugin gets the player through getNearbyEntities before it is spawned in client side, meaning it tries to set the passenger and stuff with an unspawned entity. How can I know when it is spawned client side?

dusky harness
forest jay
#

I guess what I could do, is just have it remove it and add it back (like, when the player joins, wait 5 ticks, then add the entity, if it was already sent to player, remove it and re-add it)

fleet shale
atomic trail
#

Is there any way for TriumphGui to have actions on GuiItems that are set as AIR? It doesn't seem to work

atomic trail
#

Ahhh the currentItem will be null if clicked on air I believe, and therefore it won't work, any way to change this functionality? @pulsar ferry

#

Called from here in GuiListener

pulsar ferry
atomic trail
plush pond
#

hey i started trying to learn plugin development like an hour ago and im wondering why build artifacts is grayed out?

plush pond
#

and my plugin keeps disabling itself when i load it and its really frustrating, can anyone help me?

green hound
plush pond
#

and if i sent pictures it would have to be seperated into 3

green hound
plush pond
green hound
plush pond
#

the .jar?

green hound
#

Nope, content of the Main class, that's the class that extends JavaPlugin

plush pond
green hound
#

The first one
Well you use new MyFirstPlugin() when registering event listener which creates new instance of the main class. You can't do that and that's why you can see java.lang.IllegalArgumentException: Plugin already initialized! in the log.

Instead of creating new instance of the main class just use this to refer to the class itself (main in this case; or move the listener to separate class)

plush pond
#

ooh thank you, and what about for my build artifacts being grayed out? i was told in a tutorial i needed to click on it yet i couldnt.

green hound
#

Idk what you mean

plush pond
#

i would send a screenshot but yeah

green hound
plush pond
plush pond
#

okay nevermind mabye its doing it so fast i dont see it when i join because when somone else joins it doeses it

plush pond
#

why is player.sendMessage(getPlayerPrefix(player) + ChatColor.YELLOW + player.getName()); showing an error? im using vault api and its saying this method doesent exist

spark skiff
#

Do you have a method called "getPlayerPrefix?"

#

If so what what does it return

merry knoll
#

spigot is not the best place to learn honestly

plush pond
#

When you mean basic Java course how much understanding do you mean exactly? And I can’t really find any good ones.

dusky harness
dusky harness
plush pond
#

So can someone answer this then? The vault api says that’s the right syntax so unless I’ve installed it wrong I don’t know what I’ve done wrong

dusky harness
#

oh shoot oops

dusky harness
#

for example, notice in the red box it does econ.depositPlayer instead of just depositPlayer(...)

plush pond
#

Thanks 🙏 I have no idea why I couldn’t find this when looking online

unborn ivy
#

anyone got any idea why my itemstack's item meta fully disappear after applying NBT to it?

                    String side = game.isSide() ? "Heads" : "Tails";
                    String betOwnerName = game.getPlayer().getName();
                    int gameID = game.getGameID();
                    ItemStack rawBetItem = game.getItem();

                    // Returns an item with its item meta, etc
                    player.getInventory().addItem(rawBetItem);

                    // Create a NBT and assign the game ID to it
                    net.minecraft.server.v1_12_R1.ItemStack nmsItem = CraftItemStack.asNMSCopy(rawBetItem);
                    NBTTagCompound compound = new NBTTagCompound();
                    compound.set("gameID", new NBTTagString(String.valueOf(gameID)));
                    compound.set("playerName", new NBTTagString(betOwnerName));
                    nmsItem.setTag(compound);

                    ItemStack itemBetWithNBT = CraftItemStack.asBukkitCopy(nmsItem);

                    // Returns just the rawBetItem's item type with the applied NBT, no item meta
                    player.getInventory().addItem(itemBetWithNBT);
#

fyi if you're wondering about the gameID line, I know about new NBTTagInt(), but I was so confused on why this is happening I changed it to new NBTTagString(String.valueOf(gameID))

#

extra info: this is ran async, and is also ran in a nested for loop, not sure if thats gonna affect anything
edit: just tried this without running it async, came across the same issues

grave sky
#

maybe the issue is occurring because when you convert the item stack to an NMS item stack and then back to a Bukkit item stack some data might be lost in the conversion process? (sorryif I'm mistaken)

plush pond
#

hey my plugin isnt starting and i dont know whats wrong with it?

stuck hearth
#

show code

plush pond
stuck hearth
#

I assume in your plugin.yml under the main attribute it's probably something like ?
wafflesky.tebex.io.myfirstplugin.Messages

#

Your package is written as
package wafflesky.tebex.io.WaffleCore;

So it should probably be something like
wafflesky.tebex.io.WaffleCore.Messages

Although, the naming scheme is a little inconsistent, it idealistically should be
wafflesky.tebex.io.wafflecore.Messages
With your file structure looking something like
/src/main/java/wafflesky/tebex/io/wafflecore/Messages.class

plush pond
#

i have removed all variations of "MyFirstPlugin" that i can find yet its still saying i need to change cetain things to it. and the main: in plugin.yml is "main: wafflesky.tebex.io.WaffleCore.Messages"

#

and by the way you have worded it i dont understand if your telling me to rename the main attribute or the package

plush pond
#

okay i just reset everything and put my classes in a new project but now all that code from before doesent work yet the plugin loads fine.

night ice
hidden elm
merry knoll
merry knoll
proud pebble
#

nms's ItemStack#getOrCreateTag()

#

idk what version you are using so i cant tell you exactly the obfuscated name

#

i usually use screamingsandles to figure that out

atomic trail
#

How does HashSet#clone work in kt?

#

Is it just HashSet(items)?

#

To make a copy / clone of the set?

#

As I want to modify it while iterating

    fun claim() {
        for (item in HashSet(items)) {
            if(player.inventory.contains(Material.AIR)) {
                player.inventory.addItem(item)
                items.remove(item)
            }
        }
    }
spiral prairie
icy shadow
#

just do .toSet()

#

or i think kotlin might automatically do the clone? or whatever it takes to avoid the CME

#

might be making that up tho

atomic trail
#

Does kotlin have anything to simplify this?

    fun create(player: Player): Storage? {
        if(BY_PLAYER.containsKey(player.uniqueId)) {
            return BY_PLAYER[player.uniqueId]
        }
        
        val storage = Storage(player)
        BY_PLAYER[player.uniqueId] = storage
        return storage
    }
#

I feel like I'm just using it like java

icy shadow
#

.getOrPut

#

java also has .computeIfAbsent sooo hehe

tight junco
#

me love computeIfAbsent

#

when you do getOrPut you might aswell make the Storage not null (remove the ?)

atomic trail
#

Confused how it works tho BY_PLAYER.getOrPut(id, () -> Storage(Bukkit.getPlayer(id)))

icy shadow
#

thats not how you write lambdas in kotlin

#

{ id -> Storage(Bukkit.getPlayer(id)) }

#

or alternatively { Storage(Bukkit.getPlayer(it)) }

atomic trail
#

Ahhhh gotcha, thanks!

fleet shale
atomic trail
#

This should check for empty slots in inventory right? I just wanna check if there's any empty slots if(player.inventory.contents.any { it == null })

fleet shale
fleet shale
atomic trail
fleet shale
#

😭 this is wack the game supports scaling of text displays cmon spigot fix ittt

pulsar ferry
# icy shadow .getOrPut

A side comment on this, depending on the map you're using keep in mind getOrPut is not thread safe, computIfAbsent is

atomic trail
icy shadow
#

because of race conditions

#

the value being in the map might change in the time it takes to check initially, and then call the function

hidden elm
minor summit
#

api-version is major versions only, so 1.13, 1.14, 1.19, 1.20, ...

hidden elm
#

ohhhhh

fleet shale
#

can someone tell me how to effectively impliment mojangauthlib every method ive ettempted to use for impliment or compile etc with my build.gradle has failed it almsot worked at one point but went from working to red again and idk what im doing wrong here

hidden elm
minor summit
#

yes

fleet shale
# atomic trail Doesn't look like TextDisplay supports making the text larger

found a solution ```java
Transformation transformation = textDisplay.getTransformation();
transformation = new Transformation(
transformation.getTranslation(),
transformation.getLeftRotation(),
transformation.getScale().add(5, 5, 5),
transformation.getRightRotation());
textDisplay.setTransformation(transformation);
}

#

made a void incase anyone else wants to use it ```java
public void createTextDisplay(Location loc, String text,int seconds /if you remove the disappear function remove this too/,int scale,Color bg) {
World world = getServer().getWorld("world name");
TextDisplay y = (TextDisplay) world.spawn(loc,TextDisplay.class);
String tt = ColorKey(text); //this is my own void for formatting the color codes with & symbol remove this and replace tt with text for your application
y.setText(tt);
y.setBillboard(Display.Billboard.CENTER);
y.isGlowing();
y.setGlowing(true);
y.setBackgroundColor(bg);

    Transformation transformation = y.getTransformation();
    transformation = new Transformation(
            transformation.getTranslation(),
            transformation.getLeftRotation(),
            transformation.getScale().add(scale, scale, scale),
            transformation.getRightRotation());
    y.setTransformation(transformation);

//keep this if you want it to disappear after a defined amount of time
new BukkitRunnable() {
@Override
public void run() {
for(Player p : Bukkit.getOnlinePlayers()) {
p.playEffect(loc,Effect.EXTINGUISH,1);
}
y.remove();

        }
    }.runTaskLater(plugin, seconds*20);

//--------------------------------------------------------------------
}

hidden elm
#

i am trying to make it so it does not play any noise for the weak hit noise when no damage is taken, but i dont think entitydamagebyentity accounts for nondamage hits. what do i do instead?

    @EventHandler
    public void onEntityDamage(EntityDamageByEntityEvent event) {
        if (event.getDamager() instanceof Player) {
            Player player = (Player) event.getDamager();
            boolean isCrit = player.getFallDistance() > 0.0F && !player.isOnGround();
            // getLogger().info("CONDITIONAL FOR damage being taken by a player");
            double damage = event.getDamage();
            if (damage > 0) {
                // getLogger().info("CONDITIONAL FOR damage being above zero");
                if (isCrit) {
                   // getLogger().info("CONDITIONAL FOR crit sound");
                    event.getEntity().getWorld().playSound(event.getEntity().getLocation(), Sound.ENTITY_PLAYER_ATTACK_CRIT, 100, 1);
                } else {
                    // getLogger().info("CONDITIONAL FOR strong attack");
                    event.getEntity().getWorld().playSound(event.getEntity().getLocation(), Sound.ENTITY_PLAYER_ATTACK_STRONG, 100, 1);
                }
            } else {
               // getLogger().info("CONDITIONAL FOR weak sound not playing");
            }
        }
    }
fleet shale
hidden elm
#

ok so my previous method didnt work because apparently you can't just do it in bukkit so does anyone know how to do it using protocol lib and block packets of sounds?

hidden elm
#

or like even use/have the protocol lib api

plush pond
#

So I’m new to spigot and in the last code I used it was extremely simple and to store a variable for a specific player you would just do {variable::%player’s uuid%} but now with spigot I have seen people say many different ways to store something to a player and I wanted to know how I do this and what’s the best way? I’ve looked online and I might just be bad at searching but I can’t find much info.

worn jasper
# plush pond So I’m new to spigot and in the last code I used it was extremely simple and to ...
  1. God thank you for stopping using skript, welcome to the sane club.
  2. Different ways yes, you could always have a class that contains all the info about your player that you want to store, then on join, you load that info from a file and store it in a hashmap, on quit, you remove it.

If you did not understand what I said, then you probably lack java basics Knowledge which in that case I would recommend learning java before trying anything with the bukkit api.

On a side note, use paper api instead of spigot.

plush pond
#

Is there some sort of tutorial on all the ways of data storing I could use? I like to know all my options before making a decision.

stuck hearth
#

I'm a little confused as to what you're trying to store and why

plush pond
#

Just information for certain players. Like if I have a levelsystem how am I going to store the levels? If I have a kills tracker where am I going to store the kills? This is what I want to learn how to do.

stuck hearth
#

Depending on the size and complexity of your data, you can use flatfiles like json/yaml, and those are fairly simple solutions.
You can also use storage solutions like MySQL, MariaDB, PostgreSQL, etc.. or NoSQL solutions like MongoDB

#

Or also depending you might be able to use PDC

dusky harness
#

Surprised afonso didn't mention PDC but if you want like leaderboard then PDC isn't optimal
But for yaml at least, I think spigot has an official wiki page on that @plush pond

#

But there's gotta be tons of yt tutorials and stuff on this

worn jasper
#

My answer was also not that technical since my gut tells me he is one of those people that has 0 knowledge with java, come from skript and want to go from 0 to 100 in 2 seconds lol

#

which is only going to cause him to ask even more questions here, taking up our time while he himself not learning much since he can't figure things out alone since he skipped several things.

#

I might be a pain in the ass but I am only thinking in the person's best interests

stuck hearth
#

My best interests?
All I wanted was a pepsi
Just one pepsi
and she wouldn't give it to me

worn jasper
#

bruh

atomic trail
atomic trail
#

Is using sqlite technically slower than just writing to a json file? Or does it depend?

sterile hinge
#

as always it depends, but sqlite performs pretty well generally

forest jay
#

I have this weird bug with unicode where when I sent the packet for update display name before the resource pack loads, it does this:

#

However when I send it after the pack has loaded, it does this:

#

Why does it do that? Is there anything I can do to avoid it?

warm steppe
#

send it after the pack has loaded?

#

or send it before pack and then when it loads send display name another time

forest jay
#

but load time isnt static

#

on my pc its like 2 seconds, on my friends its like 10 (its a dinosaur)

#

the resource pack status event runs before it loads, so I cant use that

warm steppe
#

oh

#

nvm then

bitter tiger
dense drift
#

you don't cancel the task you start at line 21

bitter tiger
#

ty

bitter tiger
#

https://paste.md-5.net/afinewibis.java

I would also like to put that when I place a spider web 5 are placed at once, but when I do it is placed one and like 9 timers, but I want 5 webs and 1 timer

stuck hearth
#

That's a lot of timer

bitter tiger
#

the timer get configured in the config.yml

olive stump
#

Hi I am facing some issues on geysermc

#

The players connecting from geysermc are crashing after joining

#

Have been trying to fix it from a week

minor summit
#

have you tried asking in the geyser discord?

somber gale
#

Any suggestions/ideas on how I can reduce this duplicate code?
I had the idea of using a method with a function (or bifunction?) argument, but I'm not sure if that would be the right aproach here or if it would even work....
profiles is a list of ProfileEntry.Builder instances and builder is just a single ProfileEntry.Builder instance.
https://paste.helpch.at/eyexiwoqep.java

somber gale
#

And to clarify a bit more... What I do give to the different builder methods (motd(...), favicon(...), etc) are lists with various types of content. Some contain Strings, others Integers and others Lists

stuck hearth
#

Sure why not

dark garnet
#
final Object contents = Array.newInstance(TEXT_ARRAY_CLASS, 1);
AnnoyingPlugin.log("contents type: " + contents.getClass().getName());
final Object text = TEXT_CONSTRUCTOR.newInstance(content);
AnnoyingPlugin.log("text type: " + text.getClass().getName());
Array.set(contents, 0, text); // ERROR: java.lang.IllegalArgumentException: array element type mismatch

contents type: [[Lnet.md_5.bungee.api.chat.hover.content.Text;
text type: net.md_5.bungee.api.chat.hover.content.Text

somber gale
#

Too much kotlin...

stuck hearth
#

Shame

void orchid
somber gale
#

I don't get your point

void orchid
#

I might be misunderstanding your case but you could omit the uses of the builder variable, and just go with the profiles instead. Like this:

        for(int i = 0; i < motds.size(); i++){
            profiles.get(i).motd(motds.get(i));
        }

somber gale
#

builder is the main builder and profiles a list of them.
The reason is, that they - after being build - are converted to a file where the list will be a profiles option and the builder the file itself.

Like, as an example:

profiles:
  - motd: ['Line A', 'Line B']
    favicon: imagea.png
  - favicon: imageb.png

motd:
  - Line 1
  - Line 2
void orchid
#

Ahh. You could delay those checks later when you're doing the converting

#

So if there's only a single motd, then they'd go straight to the motd section, otherwise they go to the profiles.motd section

somber gale
#

That's what I do right now...

#

Anyways, I'm off for now

void orchid
#

Alright

dense drift
somber gale
# void orchid So if there's only a single motd, then they'd go straight to the motd section, o...
#
  • What I effectively do is this:
    1. Load the different configuration parts of ServerListPlus, using its own internal API.
    2. Convert parts of each section into their own collection of things (Usually just lists).
    3. Find the largest possible list to determine how many profiles entries there need to be
    4. Go through each list and check if size is 1 or more than one. If one, add it to the builder (global), if more, iterate through all entries and add to the profiles list
    5. Finally, convert the builder and profiles as mentioned above into a ConfigurationNode and save everything to the YAML file.
somber gale
#

Also, I think I have a solution to simplify stuff?

private static int parseConfig(AdvancedServerList<?> core, PersonalizedStatusConf.StatusConf conf, String filename, Type type){
    // do stuff and get lists
    
    apply(motds, builder, profiles, ProfileEntry.Builder::motd);
    
    // do more stuff and return int
}

private static <T> void apply(List<T> list, ProfileEntry.Builder builder, List<ProfileEntry.Builder> profiles,
                              BiConsumer<ProfileEntry.Builder, T> builderConsumer){
    if(list.size() == 1){
        builderConsumer.accept(builder, list.get(0));
    }else
    if(list.size() > 1){
        for(int i = 0; i < list.size(); i++){
            builderConsumer.accept(profiles.get(i), list.get(i));
        }
    }
}
somber gale
#

tested it and it does indeed work.

lyric gyro
#

You can set somewhere that this is a funnel menu. At deluxmenus

void orchid
wind forge
#

Hey guys I’m having this error in my pterodactyl I cannot connect the node:

HTTP Error 403, Invalid credentials (Upon Wings —debug)

#

Any thought on that

neat pierBOT
#
📋 Your paste: itsdyl4n
https://paste.helpch.at/anuketogud

A member of staff has requested I move your message to a paste,
Most likely because it contains a config/error/code snippet.

river solstice
#

How does one make a Pet (make any mob follow specific player) using NMS? I'm still kinda new to NMS, so I'm not really sure what I'm doing lol (1.20.2)

river solstice
#

I currently have
compileOnly name: 'spigot-1.20.2-R0.1-SNAPSHOT-remapped-mojang'

Wrote some mediocre code and now I'm getting error:
java.lang.NoClassDefFoundError: net/minecraft/world/entity/PathfinderMob

#

am I missing something?

river solstice
#

I have added a plugin:
id "io.github.patrick.remapper" version "1.4.1"

tasks {
    remap {
        version.set("1.20.2")
    }
}

tasks.named('shadowJar') {
    dependsOn remap
}

that doesn't seem to do anything tho lol

vernal zenith
#

Anyone know how I can prevent a dropped item from going through a hopper? - SpigotAPI

tight junco
stuck hearth
#

Is there an event for when a player left clicks on an entity?
I'm having a hard time finding one

river solstice
#

EntityDamageByEntityEvent? angry_fingerguns

#

though not sure if it's called when damage is 0

stuck hearth
#

That was my concern with that one

neon forge
worn jasper
neon forge
worn jasper
#

and dont randomly ping people

neon forge
worn jasper
neon forge
#

i already said something there

worn jasper
#

you ask

#

and you wait.

neon forge
#

r u ok

worn jasper
#

Not the impatient one here

river solstice
#

I have a current project I'm incorporating nms to

pulsar ferry
#

Incorporating nms into a project sounds like a perfect use for paperweight :')

stuck hearth
#

true

lyric gyro
#

You can set somewhere that this is a hopper menu. At deluxmenus

marsh scaffold
#

I more or less need someone to help me decide what to use, so I'd appreciate it if you could help ✌️ and thank you in advance.

I'm trying to create a "creative" server (not really the concept of creative but more like the concept of creating worlds) that is a bit more or less not using plots but rather slimeworldmanager or advancedslimeworldmanager on 1.20.4;

Since I'm creating the slimeworlds, I've been thinking over on how can I make it so that each slimeworld has it's own:

  • tab
  • scoreboard
  • chat
  • commands
  • inventory
  • ender chest

and I came to a conclusion that I would get stopped at "commands" and "ender chest" so I've been thinking of switching from SWM to something else, but I can't just create infinite amount of worlds just for a 1k x 1k world for my players or 5kx5k for my donators (might actually do higher 10k x 10k or 25k x 25k max).

does anyone know if my approach is correct or should I just drop making so that my players are able to make custom commands (I took half my ideas from a server, fairly sure they make it per world, I don't want to create worlds).

TLDR using SWM/ASWM; need help if I should switch to something else (suggest please) cause I'm unable to make per slime world enderchest/command/inventory(?); won't use bukkit/nms createWorld cause it will be heavy on the server.

bitter tiger
bitter tiger
#

I think it's got to do with the colors but I don't really know

river solstice
#

How can I make monsters be passive (not attack players)? 😄 every possible way, NMS included

dusky harness
#

Unless u still want pathfinding

hoary scarab
#

I think there is a target event

river solstice
#

if I set target to null, it won't work?

dusky harness
#

uhh idk

#

but i kinda misread your question at first

#

so setting target to null and/or what yapperyapps said should work

river solstice
#

ight

#

thx

minor summit
#

could remove the respective mob goals

fast glade
#

to build onto that question, how could i make a mob ignore a specific player, as if the mob was on the same team as the player (without putting the player and mob on a team)? is that possible using paper api?

lyric gyro
#

anybody know any good particle libraries that support spigot 1.20.6 and paper 1.20.6?

strong plume
#

Hello, I want to use the happy hud plugin, but when I run this plugin on the server version 1.18.2, the plugin does not work):

merry knoll
torn heart
#

here is a guide if you're confused

dark garnet
#

anyone know of a library to create both http and websocket server on the same port? ping if reply

strong plume
#

[00:19:53 WARN]: org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.19
[00:19:53 WARN]: at org.bukkit.craftbukkit.v1_18_R2.util.CraftMagicNumbers.checkSupported(CraftMagicNumbers.java:375)
[00:19:53 WARN]: at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:149)
[00:19:53 WARN]: at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:415)
[00:19:53 WARN]: at PlugManX.jar//com.rylinaux.plugman.util.BukkitPluginUtil.load(BukkitPluginUtil.java:418)
[00:19:53 WARN]: at PlugManX.jar//com.rylinaux.plugman.command.LoadCommand.execute(LoadCommand.java:116)
[00:19:53 WARN]: at PlugManX.jar//com.rylinaux.plugman.PlugManCommandHandler.onCommand(PlugManCommandHandler.java:97)
[00:19:53 WARN]: at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45)
[00:19:53 WARN]: at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159)
[00:19:53 WARN]: at org.bukkit.craftbukkit.v1_18_R2.CraftServer.dispatchCommand(CraftServer.java:906)
[00:19:53 WARN]: at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:2307)
[00:19:53 WARN]: at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:2118)
[00:19:53 WARN]: at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:2099)
[00:19:53 WARN]: at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:46)
[00:19:53 WARN]: at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:6)
[00:19:53 WARN]: at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$ensureRunningOnSameThread$1(PlayerConnectionUtils.java:51)

#

[00:19:53 WARN]: at net.minecraft.server.TickTask.run(TickTask.java:18)
[00:19:53 WARN]: at net.minecraft.util.thread.IAsyncTaskHandler.d(IAsyncTaskHandler.java:153)
[00:19:53 WARN]: at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.d(IAsyncTaskHandlerReentrant.java:24)
[00:19:53 WARN]: at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1400)
[00:19:53 WARN]: at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:188)
[00:19:53 WARN]: at net.minecraft.util.thread.IAsyncTaskHandler.y(IAsyncTaskHandler.java:126)
[00:19:53 WARN]: at net.minecraft.server.MinecraftServer.be(MinecraftServer.java:1377)
[00:19:53 WARN]: at net.minecraft.server.MinecraftServer.y(MinecraftServer.java:1370)
[00:19:53 WARN]: at net.minecraft.util.thread.IAsyncTaskHandler.bo(IAsyncTaskHandler.java:114)
[00:19:53 WARN]: at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1504)
[00:19:53 WARN]: at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1226)
[00:19:53 WARN]: at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316)
[00:19:53 WARN]: at java.base/java.lang.Thread.run(Thread.java:1583)

torn heart
#

please put that into a pastebin

#

that is also literally in the rules somewhere

torn heart
#

^^^

dark garnet
#

and dont even try asking if u pirated the plugin please

strong plume
torn heart
dark garnet
#

^^^

dark garnet
torn heart
#

please go to the proper support channels for this

#

as has been pointed out to you twice

dark garnet
torn heart
#

we live in a society

dark garnet
dusky harness
#

oh

dark garnet
#

wait wdym

dusky harness
#

like is anyone else gonna use it besides you

dark garnet
#

oh yeah yeah

dusky harness
#

oh ok

worn jasper
#

never used websockets and http on the same port

dark garnet
#

yeah i got them working separately

worn jasper
#

always thought that would cause issues

#

lol

dark garnet
#

but i researched a bit and found it was possible

worn jasper
#

news to me

dusky harness
#

wouldn't cause issues I don't think, but might be difficult to find out how to support it
since you can't use 2 different libraries or anything

dark garnet
#

i mean discord uses the same port for theirs no?

worn jasper
#

any specific reason why you only want one port?

dusky harness
#

nginx for ex I think supports it

#

but if it's for public use then that's not viable

dark garnet
#

@worn jasper id rather have eventalerts.venox.network/api/v1 and eventalerts.venox.network/api/v1/socket/ than eventalerts.venox.network/api/v1 and eventalertssocket.venox.network/v1/ or something

worn jasper
#

can't you just redirect it?

#

lol

dark garnet
#

uh

dusky harness
#

nginx ftw

#

80% sure it can do this

dark garnet
#

yeah i dont know the capabilities of nginx fully

#

ill ask my host

#

ty

#

@dark garnet do this ok?

dusky harness
#

hehe

dark garnet
#

:(

worn jasper
#

lol

dusky harness
worn jasper
#

seems like an easier solution to the whole thing ngl

worn jasper
#

my suggestion is not doing so, but to achieve his goal with the api paths, he can just redirect

dusky harness
#

it'd still be the same port

#

i think

#

wait what is ws port

#

websocket is still port 80 by default

#

same as http

#

that's the issue

worn jasper
#

aka eventalerts.venox.network/api/v1 goes to the normal one and eventalerts.venox.network/api/v1/socket/ to eventalertssocket.venox.network/v1/

#

yeah but he can change the port no?

dusky harness
#

http redirects?

worn jasper
#

I am quite confused on why using a second port is a limitation

dusky harness
worn jasper
#

eh I suppose

dusky harness
#

or some java library but I don't know of one

worn jasper
#

spring doesn't do any of this?

dusky harness
#

¯_(ツ)_/¯

#

I should probably learn spring sometime

worn jasper
#

(idk, spring has a ton of tools)

dusky harness
#

it's such a big java library and I'm a java dev 😭

worn jasper
#

lets say...

dusky harness
#

🤨

worn jasper
#

I luckly found my beloved svelte on time

dusky harness
#

💀

worn jasper
#

otherwise I would be dead now

dusky harness
#

tried svelte
but web dev isn't for me atm

worn jasper
#

spring is one of those things...

#

you either understand it, pog

#

or you don't, and you cry

minor summit
#

noooo no no no

#

you don't try to understand spring

#

you just use it without asking questions

#

and it just works

worn jasper
#

tell that to my hello world

dark garnet
minor summit
#

spring is just convenient to use

dusky harness
#

that's all I know

worn jasper
dusky harness
#

framework* oops

worn jasper
#

don't touch it

#

keep your sanity

#

even php is better at that point

dark garnet
#

It looks scary just looking at the gradle file

worn jasper
#

(although if you do use php, use laravel atleast)

minor summit
#

the trick is learning how to use it without trying to understand how it works

worn jasper
#

or join the cool family, and use svelte

dark garnet
#

I’ll just remake spring

minor summit
#

some ex-spring devs did that

worn jasper
#

💀

minor summit
#

it's called micronaut

dark garnet
#

I’ll call mine boing

minor summit
#

woops

worn jasper
#

"fullstack framework?"

#

tf

minor summit
#

yes?

worn jasper
#

frontend with java?

minor summit
#

i pasted it on accident

minor summit
dusky harness
dark garnet
dusky harness
#

ktor ftw
no idea if they're equivalent but

#

ktor is nice