#development

1 messages · Page 41 of 1

minor summit
#

pepw it does do that

spiral prairie
#

what if they dont have permission for a disc?

#

itll break yey

dense drift
#

no it won't if you do it properly

spiral prairie
#

im doing it properly my guy

#

there shouldnt be any breaking here

dense drift
#
if (has permission) return;
setItemInHand(item without skin);
cancelEvent();```
spiral prairie
#

if the api made logical sense

dense drift
#

The item is used on the jukebox and you also add it back to the inventory

dense galleon
spiral prairie
#

i dont want to cancel the event

#

sorry

dense drift
#

ok then cancel it only if the item is a disk and the block is a jukebox ?

spiral prairie
#

i guess that could work

#

nobody will notice it

dense drift
#

and there's event.getUsedItem() or something

spiral prairie
#

yup noticed that

broken elbow
dense galleon
broken elbow
#

easy fix seems like

dense galleon
#

I can't find the link

broken elbow
#

it needs to contain the build number as well

dense galleon
#

Ah I forgot what the paper naming convention is mb

broken elbow
#

tho it might still not completely work tho. don't know enough bash but it seems like instead of it going to put the jars in servers/server1/paper.jar it will just put it in server1/paper.jar

dense galleon
#

Nah it works it works

broken elbow
#

ok then

dense galleon
#

It loops through all the directories in servers

broken elbow
#

interesting

#

yes but those are just strings

#

aren't they?

dense drift
#

curl -s -L -o "${server_dir}/paper.jar" "${paper_latest_build_url}" this is the download part

dense galleon
#

I assume it goes inside each directory when it loops?

#

I don't know bash much either, hence I am using ChatGPT for it

broken elbow
#

oh wait. there's more to the for loop then I saw

broken elbow
dense galleon
#

Honestly, ChatGPT can be really good if used correctly

#

It can be used a bit too much for spoonfeeding though

#

I mean I am being spoonfed bash code rn, but I genuinely cba to learn bash just to play around with Bungeecord

#

Specially since i'll move on to ptero soon

robust flower
#

In ArrowKt, how to I map Nel<Ior<A, B>> into Ior<Nel<A>, Nel<B>>

dense galleon
#

Bit of a weird request

#

Does anyone have an example BungeeCord plugin that I can clone?

#

My IntelliJ is completely broken and wont let me create new projects

dense galleon
#

Is it normal for Bungeecord plugin data folders to be named com.example.artifact.MainClass?

proud pebble
#

oh, it cant create any projects at all, thought it was just hte minecraft dev plugin that was acting up

#

tbh might be worth reinstalling intellij if its not functioning correctly

tardy cosmos
#

Planning to make an economy plugin based around BigDecimal, how should I go about storing that in an SQLite/MySQL database? As a DECIMAL or TEXT value? It seems like SQLite doesn't actually support a DECIMAL data type so might have to go with TEXT?

dense drift
#

I'd say TEXT

minor summit
#

store as blob and use jvm serialization

#

gaby no xD

dense drift
#

I almost used a super reaction kek

#

someone on SO also suggested that 🤣

minor summit
#

i mean, it is valid

#

just, eh, jvm serialization isn't particularly encouraged for long term storage

tardy cosmos
#

so are we decided on text then?

dense drift
#

I don't think any database will directly support BigDecimal as a number

#

or well not sqlite/mysql

minor summit
#

actually hold on

#

yeah ig go with text

sterile hinge
#

decimal should work I guess

tardy cosmos
#

Jdbc directly supports BigDecimal and MySQL works with it, SQLite just doesn't have a data type for it so I think TEXT is going to have to be the answer

shell moon
#

Also interested in that answer thonk

dreamy elk
tight junco
#

autosell has an api?

night ice
#

Hey, how does ArmorStandManipulateEvent works? Its not getting triggered when i click the armor stand

#

Is there something else to be done?

river solstice
#

Did you read the docs

#

'Called when a player interacts with an armor stand and will either swap, retrieve or place an item.'

night ice
river solstice
#

EntityInteractEvent when getEntity() is not null and armor stand

night ice
somber gale
#

Anyone here having knowledge with GitHub Actions in terms of releases?
Like I want to update my current action to trigger on release (no matter if normal or pre-release), but only trigger specific steps/jobs based on whether it is a pre-release or a normal one.

daring light
#

Hey, i have a Plugin that uses this Methode, my plugin has 1.17.1 and 1.18.1 support.

public void sendLabyModMessage( Player player, String key, JsonElement messageContent ) {
        byte[] bytes = getBytesToSend( key, messageContent.toString() );

        PacketDataSerializer pds = new PacketDataSerializer( Unpooled.wrappedBuffer( bytes ) );
        PacketPlayOutCustomPayload payloadPacket = new PacketPlayOutCustomPayload(new MinecraftKey("labymod3:main"), pds );
        ((CraftPlayer) player).getHandle().b.sendPacket( payloadPacket );
        
}

Now i have the problems that this imports...

import net.minecraft.network.PacketDataSerializer;
import net.minecraft.network.protocol.game.PacketPlayOutCustomPayload;
import net.minecraft.resources.MinecraftKey;

are the same name on the two Versions but they have not the exact same methods.
Here an Example 1.17.1:
((CraftPlayer) player).getHandle().b.sendPacket( payloadPacket );

Here an Example 1.18.1:
((CraftPlayer) player).getHandle().b.a( payloadPacket );

***the two methods uses the same imports. Can anyone help me fix this Problem?

dense drift
#

Use multiple modules and then load the correct one depending on the version that you are on

daring light
#

I do that with example this import because it has every verion another name:
import org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer;
and:
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer;

But the imports i showed in the last message have the same package name

dense drift
#

Not what I meant

daring light
#

Can you explain it to me? Do you mean in the pom.xml

dense drift
#

Create separated maven/gradle modules for each version, or use reflection

dense drift
#

What is 'that'?

daring light
#

Thanks for your help i will try to do that with sperated maven modules

dense drift
#

Np

daring light
# dense drift Np

I've never done this before, can you explain how it works? Unless it's too complicated then I'll have to figure it out myself

feral raptor
#

Having some trouble understanding something regarding custom Events.. So when you want to have a class call that event, do you have to instantiate a new Event every time or can the same Event object be re-used?

        CustomEvent customEvent = new CustomEvent(); //can be re-used?
        Bukkit.getPluginManager().callEvent(customEvent); //event call
        Bukkit.getPlayer("bitcash").sendMessage(customEvent.getData()); //what is the legality of this?

Additionally, for line 3 in the code above, how exactly is that code legal? a Listener was never initialized to listen for this event, so how am I able to use this event to gather data?

#

Alternatively, is there even a need to initialize this event? What stops me from just doing this

Bukkit.getPluginManager().callEvent(new CustomEvent());
ocean raptor
#

when you call the event bukkit uses the object you provided and other plugins edit that object with their listeners

#

so yes you need to use the same instance

ocean raptor
#

for example if your event implements cancellable you need to use first example you sent

#

but of course, do not use the same event instance everytime you use callEvent, you need to use a new one

patent vapor
#

Hi

feral raptor
#

That make sense, though what changes do Listeners actually make to an Event object?

patent vapor
#

I am currently having a problem adding a command in one of my menus using DeluxeMenus, I know it is probably something silly, but could someone help me, I think it is because it is a very long command because it is a written book that the user receives when clicking on a button in the menu.

river solstice
river solstice
#
class MyEvent ... {
  private int myInt = 0;

  public MyEvent(int otherInt) {
    myInt = otherInt;
  }

  public int squaredInt() {
    return myInt * myInt;
  }
}

If you call the event, ex.:
Bukkit.getPluginManager().callEvent(new MyEvent(1));

then all the listeners will get this object instance, with myInt equal to 1.

so if I have a listener

@EventHandler
public void iNeedAnInt(MyEvent event) {
  System.out.println(event.squaredInt()); // 1
}
#

of course, the listeners can also modify the object instance, its fields, whatever.

#

But generally you create a new instance of the event each time you call the event

muted trench
#

If you have any ideas please @ me

lyric gyro
#

modify the packet lol

muted trench
#

oh boy

#

what packet is that?

proud pebble
#

so ClientboundCommandsPacket or PacketPlayOutCommands

muted trench
#

danke!

proud pebble
#

depending on if your using remapped or not

night ice
#

Hey...So I have a problem now, I am adding a player as passenger to an armor stand. So the problem is as soon as I add the passenger, I am being removed from the armorstand as a passenger (atleast visually, because when I restart the server, I am sitting above the armorstand). Have anyone faced this issue prior? or have the solution for it...

#

The server is 1.12.2 btw

#

The return of addPassenger also returns true

kindred wedge
#

That's weird, looked like something kicks you from the armorstand. Maybe another plugin that is removing you from it? Or maybe you do accidently doing something weird in your code? This works for me:

    event.getEntity().addPassenger(event.getDamager());
}```

You also can do this for a EntityInteractEvent afcourse, code is writen in 1.19. But in 1.12 you are using getEntity().setPassenger() I think instead of addPassenger(). Maybe there is a 'Entity remove passenger' package or something you can intercept and then check who or what causes that package. Or disable all the other plugins you are using one by one and check again and again. To check if one of the other plugins causes this.
night ice
kindred wedge
dense galleon
#

How long does it take for my IntellIJ project to view updates in my .m2 directory?

#

I deleted a repository there 5 minutes ago and it still sees it, though I tried reloading the project from the disk and invalidating caches/restarting

#

Ofc reimported maven dependencies too

dense drift
#

What would be a lightweight framework for a simple http server? I need it for a plugin and it will be a callback for Discord's OAuth2
Edit: I will try the build-in HttpServer

hoary scarab
# dense drift What would be a lightweight framework for a simple http server? I need it for a ...
int port = 8080;
public int getPort() {
    return port;
}
    
public void setPort(int port) {
    this.port = port;
}
    
private ServerSocket server;
public ServerSocket getServer() {
    if(server != null)
        return server;
        
    try {
        server = new ServerSocket(port);
    } catch (IOException e) {
        e.printStackTrace();
    }
    return server;
}
    
@Override
public void run() {
    for(;;) {
        try {
            Socket incoming = getServer().accept();
            //TODO RateLimit
            Thread connection = new Thread(new Handler(incoming));
            connection.run();
                
            if(isStopped.get() || inputThread.isInterrupted())
                getServer().close();
        } catch(IOException e) {
            e.printStackTrace();
        }
    }
}
dense drift
#

No thank you kek

hoary scarab
#

"simple http server"

icy shadow
#

💀

hoary scarab
#

Curious what you think is the problem with it though?

torpid raft
#

for(;;) 😠

hoary scarab
torpid raft
#

not a real issue but i dont like seeing for(;;) instead over while(true)

hoary scarab
#

If i did while I would have to add a sleep

torpid raft
#

huh why?

hoary scarab
#

IDK Just would feel like it wouldn't receive connections. IDK if its since been fixed.

torpid raft
#

afaik there shouldnt be any difference between using for(;;) and while(true)

#

they both just loop foreva

hoary scarab
#

Ill switch it if I ever use that server again lol

torpid raft
#

😌

hoary scarab
#

Actually I think I have the same code in my server software so Ill test it there

minor summit
#

also connection.run will not spin a new thread, Thread#start does

hoary scarab
minor summit
#

no.. you're calling it on the Thread class

#

that will not create a new thread, Thread#start does

hoary scarab
#

Ah yeap.

#

My handler just overrides run()

minor summit
#

that's not-- you are sti

#

whatever

torpid raft
#

stinky

minor summit
#

rude

#

i just took a shower

torpid raft
#

you smell (good?)

hoary scarab
#

Thread runs the run method of the runnable handler is a runnble

minor summit
#

yes, but no new thread is ever created to run the handler

#

it will run synchronously

hoary scarab
#

Yeah I see what you meant (hence why I said "ah yeap")

dense galleon
#

Question

#

I made a common library which my Bungeecord plugin(s) and Paper plugin(s) will depend on.
I want to make sure this library is compiled alongside the rest of the plugin. How do I do that?

#

I was looking at how triumphcmd does it, but to me it looks like they just omit <scope>provided</scope>. Is it that simple?

tight junco
#

<scope>provided</scope> is basically the compileOnly function from gradle

#

which means the dependency isnt included in the plugin file and it obtained elsewhere

dense galleon
#

okay

#

But how do I make sure the dependency is included in the final jar?

broken elbow
#

What you want is scope compile and to use the maven shading plugin or whatever it is called

dense galleon
#

And then write <scope>compile</scope> in the dependency section?

#

Looks like it worked so I suppose that's the case

broken elbow
#

I believe so. If you look under <execution>, you've set the phase as package so the plugin will execute whenever the package task is executed

dense galleon
#

Is it bad practice to have a method in my plugin's main class like this one?

    public static KlyNetCore getInstance() {
        return getPlugin(KlyNetCore.class);
    }```
#

So that my other plugins which depend on it, can get access to instances of classes present in KlyNetCore?

#

I use dependency injection everywhere within the project, but outside of it I was thinking of getting the instance with that method

hoary scarab
#

No, but you should probs generate an instance. IDK how your getPlugin(<>) method works.
ex;

public class <Main> extends JavaPlugin {
    private static <Main> instance;

    public void onEnable() {
        instance = this;
    }

    public static <Main> getInstance() {
        return instance;
    }
}
dense galleon
#

It's a built-in method within JavaPlugin

broken elbow
broken elbow
dense galleon
#

Or what's better about the service manager?

broken elbow
#

I didn't say the other way is bad but ServiceManager is nice because it lets you split the api from the rest of the plugin

dense galleon
#

Fair enough

icy shadow
#

it’s bad but it’s also unlikely to cause any real problems

#

But yeah like blitz said, for internal use you should really use DI and for external use the services manager

eager hinge
#

anyone know how to fix 84 out of bounds for length 5

icy shadow
#

lmao what

proud pebble
proud pebble
#

well id assume its either an array or list

hoary scarab
eager hinge
#

thers no errors in console

#

it usually only happens when there are 1+ members in the server

hoary scarab
proud pebble
eager hinge
#

well trying to join

spiral prairie
proud pebble
#

then open your client logs and post the error from there

eager hinge
proud pebble
hoary scarab
proud pebble
spiral prairie
#

Why can't you use this?

proud pebble
#

or any form of development

hoary scarab
spiral prairie
#

And what's the point of having 2 instances of your main class

hoary scarab
spiral prairie
#

I know what you were thinking of

proud pebble
# eager hinge wdym

by that response im going to redirect you to either #general-plugins if its a plugin error with a plugin you dont have control over or #minecraft if its anything else cus it seems you arent diagnosing anything you are developing

spiral prairie
#

And my question persists lol

hoary scarab
#

How is this dude working on "folia support" when the src code for folia isn't even available yet?

spiral prairie
#

Magic

proud pebble
#

your main class should be a singleton class, never being reinstanced ever

spiral prairie
#

Yup

#

And if you use this, it will change a static constant from a non static context which imo is static abuse

proud pebble
#

atleast the plugin errors every time you try to create a second instance of the main class

spiral prairie
#

Since static should be available at any time

hoary scarab
#

Maybe I worded it wrong. I variablize the instance, privatized it so it won't be altered (Shouldn't be aleast) and use a public getter.
It allows you to use <Main>.getInstance() when ever you need access to said instance.

proud pebble
#

the only static abusey thing that i do is main class get instance using the method that yappery changed it to, using a getter so you cant modify the variable

hoary scarab
#

I can understand if people have like a shit ton of methods/fields and they used static on all would be considered abuse but I generally limited my static usage to a few methods per class, sometimes none.

proud pebble
#

tbh im on the edge for main class instance getter being static abuse or not

#

the only methods i usually make static are ones that only depend on the content inside of them

#

such as util classes

#

or a bunch of the item nbt related classes i use to modify itemstacks

hoary scarab
hoary scarab
mental cypress
#

Hmm?

#

Is "this dude" referring to me?

broken elbow
#

🤣 I was asking myself the same question

pulsar ferry
#

Not sure if it's publicly announced yet, but if you click the commit you can see it

proud pebble
mental cypress
#

Well yeah you can see the commit, but I didn't publish what you need to compile it 😛

broken elbow
#

Glare. Are you/we going to maintain a folia fork for PAPI?

mental cypress
#

I'm trying to make it so we don't need a fork at all.

pulsar ferry
#

You should in theory be able to maintain it without fork

#

Oh yeah that xD

mental cypress
#

I have expansion disk loading + downloading from eCloud working + parsing.

#

I had to disable calling the expansion register event for the time being.

hoary scarab
broken elbow
mental cypress
#

Correct

dense drift
#

Has anyone used HttpServer and HttpExchange before smiling_face_with_3_tears

mental cypress
#

We also have a problem with expansions that register their own tasks. Haven't figured out how we'll handle that yet.

broken elbow
#

No Gaby. No one has ever used those. Ever!

mental cypress
#

But we have progress.

dense drift
#

I want to get the query params and the moment I use exchange.getRequestURI().getRawQuery() and the request doesn't have any params it literally doesn't go past that method

broken elbow
#

emily. I do not recognise you. please bring back the eye

mental cypress
#

I mean a really easy solution is to make an interface and a bukkit / folia module for a couple of things and then we could add a new variable for expansions like "supportsFolia" true/false and register them in those ways.

#

But I'm trying to see if we can get around doing that for the time being.

minor summit
#

yeah but you can't really prevent all expansions from using this or that feature that won't work on folia

mental cypress
#

Well then they won't have their expansion working on Folia.

#

That's their problem 😛

minor summit
#

true

hoary scarab
#

I can't seem to find where the API is posted. I see dev.folia:folia-api:1.19.4-R0.1-SNAPSHOT from your commit but can't find it on any of the repos listed.

minor summit
#

installed locally

hoary scarab
#

That would do it lol

minor summit
#

on glare's own computer

#

btw glare I'm paying a visit

stuck hearth
#

Luck also used folia api IIRC recently

hoary scarab
#

I was wondering cause I asked either today or yesterday in papers discord if it was opened or if it was just the server for testing and was told the server.

broken elbow
#

yeah. glare got connections. he's the cool kid

dense galleon
#

I'm trying to get my Bungeecord plugin and my Paper plugin to communicate.
My Bungeecord plugin succesfully gets data across to my paper plugin, however for some reason it struggles to retrieve data sent by my paper plugin.
I register the channel in the onEnable() of my Bungeecord plugin like such getProxy().registerChannel(KlyCommon.PLAYER_DATA_CHANNEL);
And wait for incoming messages like such:

    @EventHandler
    public void onPluginMessage(PluginMessageEvent event) {
        if (event.getTag().equals(KlyCommon.PLAYER_DATA_CHANNEL)) {
            String playerDataJson = new String(event.getData());
            System.out.println("Received player data from KlyNetCore: " + playerDataJson);
            Gson gson = new Gson();
            PlayerData playerData = gson.fromJson(playerDataJson, PlayerData.class);
            System.out.println(plugin.getDbManager().getPlayerManager().updateData(playerData));
        }
    }```
And lastly, this is how I send the data from my paper plugin to the bungeecord plugin:
```java
    public static void sendPlayerData(KlyNetCore plugin, Player player, PlayerData playerData) {
        Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
            Gson gson = new Gson();
            String playerDataJson = gson.toJson(playerData);
            System.out.println("Sending player data to KlyVault: " + playerDataJson);
            player.sendPluginMessage(plugin, KlyCommon.PLAYER_DATA_CHANNEL, playerDataJson.getBytes());
        });
    }```
In my paper plugin's `onEnable()`, i register both the incoming and outgoing channels:
`        getServer().getMessenger().registerOutgoingPluginChannel(this, KlyCommon.PLAYER_DATA_CHANNEL);`
`        getServer().getMessenger().registerIncomingPluginChannel(this, KlyCommon.PLAYER_DATA_CHANNEL, new KlyVaultBridger(this));`
#

For some reason though, my Bungeecord plugin doesn't receive the plugin messages sent by the Paper plugin.

broken elbow
#

have you tried printing something if the tag is not KlyCommon.PLAYER_DATA_CHANNEL

hoary scarab
#

Have you debugged it? Is the channel actually registered?

feral raptor
#

To my understanding, listeners receive the Event Object that you pass in while calling callEvent(Event object)

dense galleon
feral raptor
dense galleon
# broken elbow have you tried printing something if the tag is not `KlyCommon.PLAYER_DATA_CHANN...
[21:02:08 INFO]: [/82.9.38.18:61252] <-> InitialHandler has connected
[21:02:08 INFO]: [Klyser8|/82.9.38.18:61252] <-> ServerConnector [lobby] has connected
[21:02:09 INFO]: Received unknown plugin message from net.md_5.bungee.ServerConnection@6ad4df44: minecraft:register
[21:02:09 INFO]: Received unknown plugin message from net.md_5.bungee.ServerConnection@6ad4df44: minecraft:brand
[21:02:09 INFO] [KlyVault]: Loaded player data for 4f72a333-cff6-39ff-a08a-d3b8f10b017e (Klyser8)
[21:02:10 INFO]: Received unknown plugin message from Klyser8: minecraft:brand
[21:02:15 INFO]: [/82.9.38.18:61252|Klyser8] -> UpstreamBridge has disconnected
[21:02:16 INFO]: [/82.9.38.18:61252|Klyser8] <-> DownstreamBridge <-> [lobby] has disconnected
[21:02:16 INFO] [KlyVault]: Saved player data for 4f72a333-cff6-39ff-a08a-d3b8f10b017e (Klyser8)
[21:02:17 INFO]: [/82.9.38.18:61275] <-> InitialHandler has pinged
#

Not much pops up

#

It's supposed to send the message when the player disconnects

#

I suppose that means the issue is with me sending the message to my bungee plugin?

hoary scarab
hoary scarab
#

try debugging in another event

dense galleon
#

I'll try PlayerDropEvent

#

Alright now I am getting a strange error?

#

Though you are right, I can't use the PlayerQuitEvent

#

I need the data to be sent when the player quits the server though

broken elbow
dense galleon
#

I suppose that I can't use the PlayerQuitEvent for this though since it's the only event that has issues with this

broken elbow
dense galleon
#

I am sending the player data from my paper plugin to the Bungee plugin, so that it can be saved to my database

#

Basically, my Bungeecord plugin holds player data and passes it around to all the other backend servers based on which server the player is connected to

broken elbow
#

yeah that makes sense. I assume you also send it on a timer?

dense galleon
#

And any time they change servers, the data is removed from the player's old server, moved to the bungee plugin, saved to the database, and then sent to the new server

broken elbow
#

oh nvm then. my idea won't work for this

dense galleon
#

As an auto-save mechanism

#

I guess I need to find an alternative to saving the player's data when they quit the server?

broken elbow
#

I realised as you were typing the other message that you probably need the data on another spigot server if they change servers. I think the best you'll be able to do is maybe save and read directly in spigot

dense galleon
#

So pass the player data between different instances of my plugin..?

#

That doesn't sound right

broken elbow
#

you could also send message using sockets. that's another option. I can't tell you which one is best tho

dense galleon
#

No way this could be a bug with paper/spigot/bukkit right

broken elbow
#

don't think it is considered a bug

#

I believe messages are sent using the player connection and bcz the player has already disconected when PlayerQuitEvent is called, the connection is closed

dense galleon
#

Isn't there a way to send the message without a player connection

broken elbow
#

sockets

dense galleon
#

ugh this sucks

#

Hmm okay ill look into that tomorrow

torpid raft
#

sockets are based

#

you can also use a rest api

river solstice
#

If im not mistaken, you can keep the object and keep the way it was modified as long as you keep a reference to it, ex. as a field in your plugin class? Correct me if I'm wrong.

dense drift
#

So I need to host a small web server, with a GET endpoint and return some html (ideally using a template engine or smth, because I need to change a line of text). I've tried com.sun HttpServer but I don't like it very much 😬

river solstice
#

With java?

#

Why not just node express or smt

dense drift
#

Because it is for a plugin

river solstice
#

Ah I c

#

For REST I used spark

#

But not sure abt html and templating

dense drift
#

Yeah I know about spark but I need to return some html code 😬

#

Thinking about it, I just need to return the html code, I can use a placeholder at text and replace it before sending

stuck hearth
#

I agree

river solstice
#

Undertow maybe

#
public class Application {

    public static void main(String[] args) {
        Undertow server = Undertow.builder()
                // Set up the listener - you can change the port/host here
                // 0.0.0.0 means "listen on ALL available addresses"
                .addHttpListener(8080, "0.0.0.0")

                .setHandler(exchange -> {
                    // Sets the return Content-Type to text/html
                    exchange.getResponseHeaders()
                            .put(Headers.CONTENT_TYPE, "text/html");

                    // Returns a hard-coded HTML document
                    exchange.getResponseSender()
                            .send("<html>" +
                                    "<body>" +
                                    "<h1>Hello, world!</h1>" +
                                    "</body>" +
                                    "</html>");
                }).build();

        // Boot the web server
        server.start();
    }
} ```
#

Seems to be pretty simple to use and probably would be enough for what you need

dense drift
#

Yeah so is spark

river solstice
#

Didn't even know spark can send html file as a response lol

#

I just use it for json data

dense drift
#

On google it says you can do that xd lets see

feral raptor
#

when running a BukkitRunnable, what is the Plugin instance I should be passing

#

Should I just be making a new instance of my plugins main class (extending JavaPlugin)?

dusty frost
#

No

#

you should be passing the one (1) instance of your main class extending JavaPlugin

feral raptor
#

Yeah, I figured this eventually. I had it fixed to do that, thanks

#

any reason why this is considered dead code?

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        BukkitTask task = null;

        if (args.length == 2) {

            long initialDelay = Long.parseLong(args[0]);
            long spawnDelay = Long.parseLong(args[1]);

            task = new WitherSpawnTimed(this.plugin).runTaskTimer(this.plugin, initialDelay, spawnDelay);

            return true;
        } 

        // begin dead code
        if (args.length == 1 && args[0].equals("stop") && task != null) {
            task.cancel();
            return true;
        }
        // end
        
        return false;

    }
#

I nested the second conditional block into the first one and that fixed it.. starting to suspect the reason

dusky harness
# feral raptor any reason why this is considered dead code? ```java @Override public b...

The {} means that there is a new scope
this means that variables inside of {} can only be accessed inside of those {}
This also means that every time the } is reached, all variables in the {} are reset (since they can no longer be accessed)

So, your task is being reset every time the command is being ran, and so it'd always be null, so the check task != null always fails

#

for example, you can't access spawnDelay outside of the if statement

feral raptor
#

Wait really? So even though BukkitTask task exists outside the scope of the conditional block, its re-assigned value gets reset once the scope in which the re-assignment took place is left?

dusky harness
#

it's the same scope, but once onCommand is finished running, all the data inside of the scope resets

feral raptor
#

I suppose my problem is the unguaranteed flow of execution then, where since it isn't guaranteed that the first if block will ever have its conditions passed

#

the second block could actually be rendered dead code

dusky harness
#

and you shouldn't be returning false (?)

#

as it uses some bukkit error command thing

#

prob better to just make your own error handling

#

at least that's just what i heard

feral raptor
#

Oh wait its because of the return statement.. now I see what you're saying

#

if the first block is met, the method is being returned thus it really is dead code

feral raptor
dusty frost
#

since the only time when you assign it, you return true

#

i might've been a little late lol

feral raptor
#

I guess it still is dead code in hindsight because every command execution is a new method call regardless

#

what would you recommend be the best way to create a command to cancel task?

#

Guess I could just make a nested class implementing CommandExecutor for it..

#

though that still entails an entirely new Command, not an arg of the existing one

sterile hinge
#

Well you just need to store or the task outside of the method somewhere

river solstice
#

wait till you find out about fields fingerguns

stuck hearth
#

I'm an American, I know all about fields

agile tangle
#

does anyone knows how i can create a placeholder like this example_one_<player> (example_one_creperozelot) <- and get the player (creperozelot)

dense galleon
#

Do sockets kinda work as a replacement to plugin messaging channels?

icy shadow
#

potentially

#

The downside is that they need a separate port

dense galleon
#

Yeah honestly the issue is that I am really struggling to understand how to even set sockets up

#

I need multiple instances of this plugin of mine to communicate with this one Bungeecord plugin

#

Which makes me think that each instance needs its own port?

#

I might honestly just find another way to save player data when they change servers instead of trying to figure sockets out

#

Will I need a different port for each instance of my plugin?

dense galleon
#

Yeaahh nah

#

I'll just find another way of using Plugin messaging

icy shadow
#

1 port per connection, really

#

whether that’s a server or a plugin

dense galleon
#

There must be a way to send player data through plugin messaging once the player quits

icy shadow
#

You might consider something like Redis or RabbitMQ, share a Single instance between all the servers = 1 port

dense galleon
#

Huh

#

A single instance of what

icy shadow
#

Redis or RabbitMQ

#

Lol

dense galleon
#

I am already biting off more than I can chew with this project i've been working on, if I add another layer of complication I will get burnt out

icy shadow
#

it’s that or plugin messages really ¯_(ツ)_/¯

dense galleon
#

Yeah

icy shadow
#

but it is quite literally impossible to use PMs if there aren’t any players connected

dense drift
#

So, I'm trying to replicate this header with the blurry background and the logo in middle but I can't figure out how to stack the elements properly 😭 https://imgur.com/a/Zfe12Ws

    <header class="header">
        <div class="headerBackground"></div>
        <img src="https://dunb17ur4ymx4.cloudfront.net/webstore/logos/69fe5d557019d0760290f117521adc73dae0ec0e.png" width="225rem" height="225rem" alt="aaa"/>
    </header>```
```css
* {
    padding: 0;
    margin: 0;
}

.header {
    overflow: hidden;
    height: 16.5rem;
    border: 3px dotted red;
}

.headerBackground {
    background: url("https://i.ibb.co/YhkDvG5/2023-01-29-18-38-13.png") center;
}```
dense galleon
#

Ffs

hoary scarab
#

Could always make your own bungee fork and remove the need of the player 🤷 lol

icy shadow
#

that’s… not how it works lmao

#

It’s not like they added the requirement for fun

dense drift
#

yeah lol

icy shadow
#

Plugin messages inherently rely on using the player’s connection

#

No players = no connection

dense drift
#

Redis is very nice and easy to use

dense galleon
#

Jesus it actually looks like the most realistic way of doing this is using sockets

icy shadow
dense galleon
icy shadow
#

that doesn’t actually answer my question

dense galleon
#

What indirection then

icy shadow
#

why not just communicate with the database directly

#

what benefit does the bungee plugin bring

dense galleon
#

I need the player data to be synced between paper servers, so the bungee plugin works as some form of bridge to pass the player data between the paper servers

icy shadow
#

uhh

pulsar ferry
#

Time to mention Kafka

icy shadow
#

how quickly does the data need to update?

#

synchronise, I mean

river solstice
dense galleon
#
  1. Player connects to the network
  2. Bungee plugin retrieves their data from the DB
  3. Bungee plugin sends the data to a Paper plugin found in the server the player is connected to

then

  1. Player changes servers
  2. Player data is sent over to the bungeecord plugin, and removed from the paper plugin
  3. Bungee plugin sends the data to that same plugin found in the new server the player is connected to
dense galleon
icy shadow
#

Because I can see a few flaws in this approach:

  1. having every individual server/plugin communicate with the db directly should probably be fine, just keep the cache on a short expiry time. You could always automatically purge the cache in some cases like when a player joins / leaves
  2. sure you need the data synced, but if there are no players online, who’s gonna notice if it’s not immediately updated?
pulsar ferry
#

Just rent a pc to have an alt connected 24/7 ez

dense drift
icy shadow
dense galleon
dense drift
dense galleon
#

It technically is more efficient

icy shadow
#

I also don’t think that’s gonna scale well, you’re passing potentially a lot of database traffic through the proxy

pulsar ferry
#

Hell yeah!

icy shadow
#

I’m not sure it is

river solstice
dense galleon
#

I mean I am only accessing the DB when a player disconnects/connects

icy shadow
#

databases are designed for high throughput and lots of queries, bungeecord is not

dense galleon
#

And every 5 minutes

dense drift
icy shadow
#

you could make thousands of queries / minute to a SQL database and it wouldn’t break a sweat

dense galleon
dense galleon
dense drift
#

Just use Redis if you don't want to query the db directly

icy shadow
dense galleon
#

Not sure how magical doing the queries async is

dense drift
#

it is the "same" (pub-sub) as using PMs but 10 times better and you don't need to send the message to bungee and then to the other servers

icy shadow
wheat carbon
#

@dense drift you need to have the background on the header element

#

that div headerBackground does absolutely nothing

dense drift
#

😭

icy shadow
dense galleon
dense galleon
dense drift
#

yeah well @wheat carbon the problem is, the logo will be blurry if I make the background blurry

wheat carbon
#

er

#

shouldn't

#

give me a few secs

icy shadow
tight junco
#

web dev continues to be the worst things conceived

#

i will take every opportunity to shit on web dev

icy shadow
dense galleon
#

So any time a player changes the server, store the data to the database and then have the other server retrieves it?

icy shadow
#

Sure, or just whenever the data changes in general

dense drift
#

I hate anything related to UIs but I can't ignore them any longer 😭 a website is needed 100% of times if you want to make any type of 'business' for example

icy shadow
#

You don’t really need to be stingy about it

#

Like I said, databases are designed for lots of queries

#

They can handle it

wheat carbon
#

@dense drift ok so you have your header element with the background

tight junco
#

fully convinced creating a website on word and pasting a photo of it onto a website is more enjoyable

dense galleon
#

I remember being taught that I should limit how many times I access the DB to avoid slowdowns

wheat carbon
#

then you have another div that contains all the content (the image), which also takes up 100% of the header space

#

on that second div, use backdrop-filter: blur(whatever)

dense drift
#

mhm

dense galleon
wheat carbon
#
div<header> <!--background here-->
    div<headercontent> <!--backdrop filter here-->
        image
    /div
/div```
#

like that

dense drift
#

ahhh so obvious

icy shadow
icy shadow
river solstice
# dense drift on the first image? Yeah, they are

Haven't tested but something like this could? work?

<head>
    <style>
    .my-header {
      position: relative;
      background-image: url("your-bg-img.jpg");
      background-size: cover;
      background-position: center;
    }

    .my-header img {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
    }
</style>
</head>
<body>
    <header class="my-header">
        <img width="50px" height="50px" src="your-img.jpg" alt="Site Logo"/>
    </header>
</body>
wheat carbon
#

@tight junco i kinda like web dev in a sadistic way tho

dense drift
#

looking good :3

wheat carbon
#

that with backdrop or m0dii's?

dense drift
#

backdrop

tight junco
dense drift
#

I just need to center the image on both axes now

tight junco
#

but to be fair if you actually know how to do it and can do it well it probably isnt that bad

#

but i physically do not have the mental stamina and will power to put effort into learning it

dense drift
#
.header {
    overflow: hidden;
    height: 16.5rem;
    background: url("https://i.ibb.co/YhkDvG5/2023-01-29-18-38-13.png") center;
}

.logo {
    display: flex;
    justify-content: center;

    backdrop-filter: blur(5px);
    height: inherit;
}```
wheat carbon
#

i can usually make anything with html and css

dense galleon
wheat carbon
#

it's not always pretty on the back end

#

but i can usually make anything so that's nice

#

honestly web dev for pc is fine, not really mentally straining, making things responsive is where the issues in web dev come in

river solstice
#

I always view the page in full width/height and I love when I use absolute positioning and resize the window and everything crumbles like a word document

icy shadow
dense galleon
tight junco
#

the problem comes in when you open multiple database connections every few seconds until you literally reach the max

#

ive done that before

dense galleon
#

And then sending the query?

dense galleon
#

That doesn't sound good

wheat carbon
river solstice
tight junco
#

hold please let me find what i did

wheat carbon
#

isnt' the default only like 10

tight junco
#

nonono

icy shadow
wheat carbon
#

wait no I'm mixing up the timeout defaults

tight junco
#

i mean i opened several thousands

wheat carbon
#

the timeout defaults were always too low for me

tight junco
#

nope

#

even pass that

dense galleon
tight junco
#

it was deranged

dense galleon
#

I doubt i'll even have more than 5

#

I think I'll be fine

icy shadow
#

What are you ever doing to need that many concurrent connections

tight junco
#

Yeah i was opening connections at a rate of 3600/hour

dense galleon
#

Rip this sucks, I spent the past few days making this whole Bungeecord<-->Paper system to avoid having any DB stuff in my paper plugins

wheat carbon
icy shadow
icy shadow
tight junco
#

well you see i wanted to obtain the amount of money someone had from sql

dense galleon
icy shadow
#

In theory

tight junco
#

so the error that crashed the server every day was HikariPool-1 - Connection is not available, request timed out after 30001ms. which is great

#

but for every person on the server, which at the time was about 60 i would basically just do

try (Connection connection HikariDataSource#getConnection()) {
  select user and check for a bank interest rate
}
#

and that ran every 3 minutes, ontop of scoreboard updates, actual bank balance checking etc

#

like none of it was cached just pure sql statements

icy shadow
#

that seems like a you problem

#

not a sql problem

tight junco
#

it was 2 years ago, i have grown and changed as a person

#

so yes at least 3600 connections that never closed, opened every hour HatDab

#

hire me

wheat carbon
#

what would you do now

#

instead of that

tight junco
#

not that

#

my initial thought is to just cache stuff in a map Shruge

#

only run queries when anything actually needs updating

wheat carbon
#

pretty much

#

only time you really need to get data from the database is on server start, or depending on the amount of data, perhaps when a player joins

tight junco
#

the problem was I took a job at a server where I was completely out of my depth on

#

like had only just started learning how to use MySQL like maybe a month or two prior

wheat carbon
#

that's ok

#

they hired an unqualified dev

#

seems like a them problem if ur code aint up to scratch

tight junco
#

to be honest if i didnt do that job for as long as i did, i would probably suck a lot more at my current stage

dense drift
#

is there any reason why display: flex; justify-content: center; centers the content of the white rectangle, and not itself? (the options are current commented out) https://paste.helpch.at/apemuvutas.xml

river solstice
#

yes, you have to justify content of the parent iirc

dense drift
#

ffs, justify-content facepalm

river solstice
dense drift
#

thanks for pointing out the obvious, M0dii kek

river solstice
#

the positioning, widths, heights of html/css is very weird

dense drift
#

I hate it because it was so obvious

river solstice
#

you'd think i'd take up the entire page

wheat carbon
#

what editor is that

river solstice
#

notepad++

wheat carbon
#

damn

#

showing its age

river solstice
#

h0h

wheat carbon
#

the tab at the top

#

index.html

river solstice
#

true

#

still kinda like it

dense drift
#

100% of itself ??

#

percentages are really weird

river solstice
#

well since the parent of the .mydiv is body

#

by default body takes up the height of the child elements

river solstice
#

and .mydiv 100% means to take up 100% of the height of the body

#

hence you should use 100dvh or 100vh

dense drift
#

ah yeah, I forgot about the body part

river solstice
#

I learnt this the hard way

#

debugging for hours lol

#

and then boom

#

bootstrap

#

fuck styling on my own

wheat carbon
#

you don't need to use vh for this

#

html is also a tag, you just need to set html height to 100%

#
html, body {
    height: 100%
}```
river solstice
#

I guess that's true indeed

little fulcrum
#

Hey

river solstice
#

but you should'nt really apply styling to your html tag

little fulcrum
#

One question, does anyone know how to delete the stats from the statistics extension?

wheat carbon
#

it's pretty standard practice for this

#

nearly any website you go to will have a variation of height styling on the html tag

river solstice
#

Body should be min-height: 100vh

#

Tldr it fuckswith responsive designs

dense drift
#

thanks ij

bronze cipher
dense galleon
#

How do I get the text from a Component? Component name = item.customName();

dense drift
#

TextComponent has content() or something like that

dense galleon
#

Ahh yeah my bad

dense galleon
#

I'm trying to give my Item entity a custom name, by appending differently colored digits.
Each digit is a separate color, based on the array written at the start of the method: https://paste.helpch.at/awisidogas.csharp

For some reason though, when printing the item.customName()'s contents It just shows -[ and nothing else

#

However, when printing the object itself, it shows that the right data is present:

[23:18:01 INFO]: [Klynes] [STDOUT] FINAL NAME: TextComponentImpl{content="-[", style=StyleImpl{obfuscated=not_set, bold=not_set, strikethrough=not_set, underlined=not_set, italic=not_set, color=null, clickEvent=null, hoverEvent=null, insertion=null, font=null}, children=[TextComponentImpl{content="8", style=StyleImpl{obfuscated=not_set, bold=not_set, strikethrough=not_set, underlined=not_set, italic=not_set, color=TextColorImpl{value="#ffccf3"}, clickEvent=null, hoverEvent=null, insertion=null, font=null}, children=[]}, TextComponentImpl{content="5", style=StyleImpl{obfuscated=not_set, bold=not_set, strikethrough=not_set, underlined=not_set, italic=not_set, color=TextColorImpl{value="#f1a1ff"}, clickEvent=null, hoverEvent=null, insertion=null, font=null}, children=[]}, TextComponentImpl{content="3", style=StyleImpl{obfuscated=not_set, bold=not_set, strikethrough=not_set, underlined=not_set, italic=not_set, color=TextColorImpl{value="#d07fff"}, clickEvent=null, hoverEvent=null, insertion=null, font=null}, children=[]}, TextComponentImpl{content="4", style=StyleImpl{obfuscated=not_set, bold=not_set, strikethrough=not_set, underlined=not_set, italic=not_set, color=TextColorImpl{value="#bd5cff"}, clickEvent=null, hoverEvent=null, insertion=null, font=null}, children=[]}, TextComponentImpl{content="]-", style=StyleImpl{obfuscated=not_set, bold=not_set, strikethrough=not_set, underlined=not_set, italic=not_set, color=null, clickEvent=null, hoverEvent=null, insertion=null, font=null}, children=[]}]}```
proud pebble
dense galleon
#

Right

#

How do I get the text then?

#

Like

dense drift
#

You might need to join the components

#

JoinConfiguration#separator(Component#empty))

dense galleon
#
        TextComponent name = (TextComponent) item.customName();
        TextComponent completeName = name;
        for (Component component : name.children()) {
            completeName = completeName.append(component);
        }``` I did this instead ops
river solstice
#

Use plain text serializer or smt like that

dense galleon
dense drift
#

Component#join accepts a JoinConfiguration and an Iterable<Component>

#

so you add the components in a list, and then use Component#join

#

that's just an idea, idk if it is the proper way of achieving what you want

dense galleon
#

TextComponent completeName = (TextComponent) Component.join(JoinConfiguration.separator(Component.empty()), name); like that?

dense drift
#

no

dense galleon
#

I am so confused

#

Why is it so inconvenient to create a text component one character at a time

dense drift
#
        for (char c : klynesString.toCharArray()) {
            TextComponent charComponent = Component.text(String.valueOf(c));
            charComponent = charComponent.color(colors[colorIndex % colors.length]);
            System.out.println("Current char: " + charComponent);
            name = name.append(charComponent);
            System.out.println("Current name: " + name.content());
            colorIndex++;
        }```
Here, instead of using name.append(), you add the `charComponent` into a list
and btw, you can do `text("text", color)` or `text().color()`
proud pebble
#

actually why is it 1 component and a list of children components and not just a list of components?

dense galleon
dense drift
#

and then join all components in that list with Component.join(configuration, list)

dense galleon
#

And that will do so that .content() prints the whole thing instead..?

#

That's really weird

dense drift
#

I don't remember having issues like this tbh

proud pebble
#

why
"-[" {
"8","5","3","4","]-"
}
and not
{ "-{","8","5","3","4","]-" }
thats what i want to know

dense drift
#

but it might be something to do with how names are rendered

dense galleon
#

honestly this is so weird I'll just do what I wanted to do differently 🫠

covert heath
#

Hello, i need to do a shop of tags, but i cant do it, Can you help me?
Sorry if i doesnt have a good english, i am from argentina

mental anchor
#

Heloooooo

stuck hearth
#

hi

dense galleon
#

Hmm I noticed something weird in my Bungeecord backend servers

#

For some reason, when a player quits the server, at times it takes several seconds for them to actually disconnect from it even though they actually aren't online

dense galleon
#

What is this error even
[01:51:19 ERROR]: [KlyNetCore] An error occurred while updating player data/settings: Data truncation: Incorrect datetime value: '2023-03-26 01:51:19' for column 'last_seen' at row 1

#

Timestamp currentTime = DBUtils.getCurrentTimestampWithoutMilliseconds();

    public static Timestamp getCurrentTimestampWithoutMilliseconds() {
        long time = System.currentTimeMillis();
        long timeWithoutMillis = (time / 1000) * 1000;
        return new Timestamp(timeWithoutMillis);
    }```
#

Why doesn't my database like the datetime values i give it all of a sudden

#

I never had issues with it until now?

#

No way daylight savings could have an impact right?

tight junco
#

It probably does

dense galleon
#

For real?

tight junco
#

yes

dense galleon
#

Sheesh

tight junco
#

fucked by the farmers all over again NOOO

dense galleon
#

So most databases have issues with daylight savings?

tight junco
#

mayhaps

dense galleon
#

That's crazy

tight junco
#

most people use Date for it

#

im about to have my A key on copy and paste or else ima go fucking feral

dense galleon
#

Yeah, I want to keep track of the time too though :x

#

Ahh shit

#

My database is in another country which is one hour ahead

#

So it's daylight savings already there while it isn't where I am

#

That's probably what's up

proud pebble
#

instead of as a date string

dusty frost
#

or as your database's native datetime type

minor summit
#

or as a blob

#

save everything as a blob

dusty frost
#

😔

minor summit
#

everything

dense galleon
#

So, you know how the issue with "physical" currencies is that they can be duplicated in Minecraft server

#

My currency is supposed to be found physically but can then be right clicked to be "claimed"
In order to prevent any possible duplication glitches though, I was thinking of having each instance of this custom item have a UUID metadata

#

And when the player uses said item, the UUID of that item gets saved on a database

#

That way, even if they manage to duplicate it they won't be able to use the item

#

Could it become problematic when there is maybe 1000 UUIDs on the database?

dusty frost
#

nah, as long as you have an index on the UUID column

#

could even have a cache that keeps the UUIDs as a set, O(1) lookup easy

#

and you obviously won't run out of UUIDs lol

dense galleon
#

There is an absurdly small chance of a duplicate being a thing

#

But the consequences would be minor + it's pretty much impossible

feral raptor
#

So this command effectively executes a BukkitRunnable (WitherSpawnTimed) and has the option for accepting extended arguments specifying the specific coords of where the mobs should spawn, however its not working, instead it spawns at w.getSpawnLocation() regardless of args. If anyone has the chance to browse through the code and potentially see whats causing it not to work that'd be great and would be appreciated.

dusky harness
feral raptor
#

Yeah it does send

dusky harness
#

and then if you run the command again

#

does it still not work?

feral raptor
#

Let me try that real quick

#

yep

dense galleon
#
@Command(value = "artifacts", alias = "art")
public class ArtifactCommands extends BaseCommand {```
#

What even

#

I've made commands like this for 4 other plugins in the past week, why is this one just randomly not working

#

public abstract void registerCommand(@NotNull BaseCommand var1); this is literally what the method takes

#

And that is what I am giving it

feral raptor
#

if providesLocation was true then it *wouldn't * use the provided coords lol

dusky harness
#

🥲

dusky harness
# feral raptor Ah nvm, I found the issue. was just careless error, had the expressions reversed

btw didn't want to mention before since it wasn't the issue directly but this has some other issues too - no permission (allows for unlimited spawning of withers that cannot be stopped), providesLocation will never become false again after becoming true, if the user doesn't input valid argument amount then the code will still try to run (no return), if the user inputs invalid arguments then the command will throw an error or do completely nothing, and why isn't providesLocation and coords parameters in the WitherSpawnedTimed constructor?

#

I assume you'll fix some/most/all of these in the future but just wanted to point them out

feral raptor
#

Ah yeah those are all good points Ill keep noted to fix

#

thanks ^

#

why isnt providesLocation and coords parameters in the WitherSpawnedTimed constructor?

What would be the reason to do this? Or do you mean making those variables themselves fields of WitherSpawnTimed instead of being static fields belonging to the Command class

shell moon
manic robin
#

DM me if your cool

river solstice
#

yes, on right click, give them a shield in offhand

#

on release, remove

#

.5 could be too short though

river solstice
#

well I'm not sure, you can probably google that yourself

junior zenith
#

my onRequest method is not working

broken elbow
#

@junior zenith as a continuation from #general-plugins, set the identifier to lowercase.

feral raptor
#

This Listener is supposed to get the player's location's block and replace it with a Sign that says "hello, 123", but it doesn't work. Unsure why..

    @EventHandler
    public void onBlockPlace(BlockPlaceEvent event) {
        org.bukkit.block.Sign c = (Sign) event.getPlayer().getLocation().getBlock().getRelative(BlockFace.DOWN).getState();
        c.setType(Material.OAK_SIGN);
        
        c.setLine(0,"Hello, 123!");
        c.update(true);
    }
tight junco
#

Is the relative block actually a sign

#

cause you're getting the block right below the players feet

dense galleon
#

is the wiki right about the pack format being 12 for 1.19.4?

#

It gives me a warning in-game if I have it at 12 instead of 13

tight junco
#

it may not be

dense galleon
#

>:(

#

Btw do durability textures still exist

tight junco
#

probably

dense galleon
#

Hmm okay cause I can't get them to work

dense galleon
#

ah rip

#

bing told me 8 😂

dusky harness
somber gale
#

Like I want to shorten numbers (i.e. 10,000 to 10k) but this code only uses longs, so no decimal points allowed...

#

Would a BigDecimal work here?

#

Or is a simple replacement of long to float enough here?

somber gale
#

Replaced with double and seems to work. Tho, now I need to find a way to get rid of the decimals, or at least reduce them...

signal grove
#

And don’t cast it to a sign

#

You’ll have to set the block as a sign yourself

#

Also - you don’t check if the block placed is a sign… so all blocks being placed will turn into a sign

minor summit
#

(also you're getting the block below the player, not the block at the player's location)

dense galleon
#

Uh

#

There is this sound in Minecraft

#

minecraft:block.amethyst_block.resonate

#

For some reason it is not present in the PaperAPI?

#

I tried playing every single amethyst sound there is and none of them sound like resonate

stuck canopy
#

@somber gale Have a look at this

river solstice
#
> Bard isn’t currently supported in your country. Stay tuned!
Sigh. Google never learns.

By the time they add support for using this in my country, there's no reason for me to use it anymore as competitors have already swept in.

It's the same playbook with every US-only launch:

1. get everybody hyped up

2. make it accessible to only a minor subset of people but advertise it as a "launch" or "open beta" or whatever

3. tell the rest of the world that "lol, by "available" we mean US-only" or "Open means "open for people with US IP addresses only" etc.

4. Wait till competitors have launched global-from-the-start alternatives

5. Open up the service globally

6. ...

7. Shut down the service because there's no uptake (surprised_pikachu.jpg)

Rinse and repeat.
warm steppe
hoary scarab
icy shadow
#

thats also uh

#

not really going to make the logic any more concise

minor summit
#

CompactNumberFormatter moment

#

redux

uneven herald
#

I dont know if this is the right place, but can i host a website and a minecraft server with the same ip?

icy shadow
#

Yes

uneven herald
#

ty fingerguns

river solstice
#

same IP yes

#

same port no, though that should be obvious, since minecraft usually runs on 25565 and webservers on 80

jade wave
#

Actually it's a little harder than that- @river solstice

You cannot have an mc server linked with just an A record and also have a webserver, although, if you only plan on using java, you can use a TCP record to bypass that.

If you want bedrock support, with just your link (example: www.example.com) and a webserver that isn't possible unless your mc server and webserver run on the same server

river solstice
#

just use a subdomain

#

mc.mydomain.com - minecraft server
mydomain.com - webserver

minor summit
river solstice
#

who are u calling a nerd, nerd

#

englando pls muchos gracias

dense drift
#

esta bien

broken elbow
#

I don't think they understand what you're asking

minor summit
#

lol

dense drift
#

whats the event fired for placing an armor stand?

dense drift
#

yeah but I need to get the player who placed it, I will check BlockPlaceEvent

minor summit
#

i mean that won't work

#

it's not a block

dense drift
#

😭

#

I wonder if player interact event works

broken elbow
#

that doesn't always result in an entity spawn tho

lapis pilot
#

is this code going to make potions better ?

#
    @EventHandler
    public void onProjectileLaunch(ProjectileLaunchEvent event) {
        if (event.getEntityType() == EntityType.SPLASH_POTION && event.getEntity().getShooter() instanceof Player) {
            final ThrownPotion potion = (ThrownPotion) event.getEntity();
            
            // Make the splash potion entity async
            Bukkit.getScheduler().runTaskAsynchronously(this, () -> {
                potion.setTicksLived(1);
            });
        }
    }
}```
broken elbow
dense drift
broken elbow
#

Well then you should've started with that

minor summit
#

"can run async"?

#

you mean profile other threads besides the server thread or what?

dense drift
#

no not that spark

minor summit
#

ah yea yea

minor summit
#

consider another framework? fingerguns

dense drift
#

yeah 😬

#

suggestions?

#

I only need a small web server, and ideally with template engine support, like thymeleaf

#

I use spark for a Discord OAuth2 callback and I need to return a page with different content depending on the result of the auth

minor summit
#

uh i know about javalin, it's pretty nice and simple but idk about the template engine stuff, i barely know what that is lol

dense drift
minor summit
dense drift
minor summit
#

lol yeah

dense drift
#

do you know if I need com.fasterxml.jackson.core:jackson-databind:2.13.2?

minor summit
#

i don't think so, just that jackson is bae

dense drift
#

ah great, it is written in kotlin, +2.5mb kek

dense drift
#

@minor summit have you use Context#async?

fading stag
#

1.8mb btw

minor summit
#

idk I never used javalin lol

dense drift
#

smh

river solstice
proud pebble
#

currently attempting to use https://www.spigotmc.org/threads/how-to-set-blocks-incredibly-fast.476097/
with some small modifications to update it to 1.19.2 from 1.14.x. it does say it would update lighting but it doesnt seem to actually update the lighting and this packet shit is completely out of my depth, so im wondering whats the best places to look to try and get some answers on how to fix this,
my current idea is to get the ClientboundLightUpdatePacketData's List<byte[]> and manually modify them so that they are all 255, basically making every block have a sky light level of 15, but i dont think thats the best option

#

i know its definitly an issue with the packets im sending cause on relog lighting does fix itself

#

current code

#

when i say fixed, i mean the light levels being shown properly to the client

#

this wasnt an issue when resetting mines, just became an issue when using the same method for breaking blocks

proud pebble
#

perhaps lighting never actually gets updated

#

just feels like it does cus the chunks are reloaded due to me relogging

proud pebble
#

right, ive been trying to figure out why the index into the NibbleArray/DataLayer has been giving me out of bounds errors, turns out i was giving the SectionPos instead of the Section Coordinate relative to the block position

#

fun

sterile hinge
#

Not sure if that stuff actually works with e.g. starlight

proud pebble
sterile hinge
#

idk, but it might be the reason

proud pebble
#

welp guess ill die

stuck hearth
#

Classic

dusk crypt
#

Anyone knows how to link website to purchase items and automatically process it inside the server?

dusk crypt
lyric gyro
#

you can buy the tebex premium subscription

#

it allows you to use your own template and subdomain

#

other alternative is craftingstore

lyric gyro
forest jay
#

Oh wait, are you saying custom website, that interacts with Tebex/Buycraft?

frosty laurel
#

Hey guys, does anyone have experience working internally with HolographicDisplays? I tried the HD API, but that creates holograms entirely separate from the list available in the /hd list. I am trying to make the hologram I create appear in the list so my plugin users can modify the hologram's content, location, etc. using the HD commands after the fact if they'd like to. Any help would be appreciated, thanks!

river solstice
#

Yes, I have worked with holographic displays

#

I've switched to Decent Holograms immediately

jade wave
#

Decent holograms is amazing

icy shadow
#

so true

minor summit
torpid raft
#

e.printStackTrace()

worn jasper
#

uhm is normal that #setFireTicks(0); is not stopping players from burning...?

#

for context, they got on fire via fire aspect

dense drift
#

I know essentials has an /extinguish command, you can check what they do

worn jasper
#

they do exactly that lol

#

which is why I am confused

dense drift
#

Is the player still taking damage?

worn jasper
#

yeah

minor summit
#

skill issue

shell moon
#

xd

stuck hearth
#

Are you doing it in a task or just once?

#

Because it looks like essentials might loop it a few times

worn jasper
#

hmm just once

#

might try looping it a few times

hot rampart
#

What's a good way to save data about players?
Basically, someone runs a command, it needs to log their current location and a way to identify whose location it is (Probably by using their UUID)

#

I've tried looking into stuff like hashmaps or .yml files but I can't seem to find something that'd work, and there doesn't seem to be many resources on this specific topic either

stuck hearth
#

Well it depends on what you'd be using that data for and exactly what data you intend to save I guess.
It also matters how long you need that data saved. (Over restarts, or only during an active session?)
A Map would work if you don't need persistence in this scenario a simple UUID=Location would probably suffice, but if you do need persistence then storing it in a yml, json, etc... files would be fine, or you could look into sql solutions, but given the information above, that might be a bit much.

torpid raft
#

yeah like zod says the biggest factor in deciding which to use is what the lifetime for the data is going to be

#

do you care about the location even after the server restarts?

hot rampart
#

Saving it after server restarts would be preferable

#

but would .yml files work for multiple people?

torpid raft
#

why wouldn't they

#
data:
  uuid-1:
    location-x: 1
    location-y: 100
    location-z: 5.5
  uuid-2:
    location-x: 100
    location-y: 105
    location-z: -66
 ...
hot rampart
#

Well I don't know whose data needs to be saved until the run the command, so would doing it allow me to add new lines?

#

Or would there be a better way to go about it?

stuck hearth
#

I'd say this method is probably fine, if you're looking to store more than just that/more complex data types it might be worth considering other options

torpid raft
#

so no worries there

hot rampart
#

Alright. Also how do people make a command toggleable? Would I be able to just add a boolean as well as the location data?

#

Thanks for the help btw (And I promise I've tried searching this up first)

stuck hearth
#

Toggleable in what way?
Like disable/enable the command, or just allowing a boolean argument?

hot rampart
#

enabling/disabling the command

stuck hearth
#

Like adding a permission check?

#

I think there might be a way to actually disable it from the server, someone might be able to speak better on that, if that's what you're going for

hot rampart
#

I mean like if you run it once, it does stuff, but if you run it again it does other stuff.
Here's an example: You run if the first time, it'll set you to creative. You run it the second time and you'll be set to survival instead. Rinse and repeat

stuck hearth
#

Oh, yeah you can deffo add a boolean for that.

hot rampart
#

Alright, thanks a bunch

ancient chasm
#

Hello friends, I was recently watching a video on the MCC Island stuff, and I noticed the use of what I can only assume is boss bars. I was wondering if anybody had an idea on how this is done? I'm assuming it's just a textured boss bar with the percentage style and custom font for the icons, but I don't understand how they're adding distinct sections with their own backgrounds and aligning them in this way

#

Thought I could post a picture to show what I'm talking about, guess I can't 😅

minor summit
#

custom fonts, negative spaces, core shaders, lots of suffering

#

use imgur

ancient chasm
#

There we go. I'm not really looking to replicate it entirely, I'm just interested in the different ways to do vanilla UI mods. I was looking through the wiki and docs on text rendering and couldn't find anything about putting a background on it. Was looking through the decompiled source but the rendering code has gotten a lot more complex since 2014 😅

broken elbow
#

@pulsar ferry, reveal your secrets!

ancient chasm
#

oh, that's cool haha

#

I don't need the secrets, just curious about the background really 😂

#

I was about to pay for the server just to try and figure it out lmao

broken elbow
#

pay for what server?

ancient chasm
#

the mcc island server

#

the beta

broken elbow
#

Pretty sure the whitelist is not that big. Or is there no way to apply for that anymore? I'm not sure. I haven't played minecraft in months.

ancient chasm
#

I'm impatient

#

And I'll probably lose interest in the time it takes to get on the whitelist haha

stuck hearth
#

Is the suffering a requirement, or can I do without it?

pulsar ferry
#

A requirement

#

One of the main ones actually

stuck hearth
#

Oof, I'll stick to the suffering on this side of the fence

stray heron
#

Is it possible to set the gameTime value with packets to only a player?
By gameTime I mean worldAge, if so, could someone clue me in, please?

dense drift
#

Look at essentials' PlayerTime (ptime) command

stray heron
fiery pollen
#

Would anyone what this error could be?
[22:01:32 ERROR]: Ambiguous plugin name `Bank' for files `plugins\ShopBC.jar' and `plugins\BankBC.jar' in `plugins'

dense drift
warm steppe
#

are those custom made plugins? they probably have equal names in their plugin.yml

fiery pollen
#

Yeah, so its the first time I tried creating a API for one of my plugins and used it in another of my plugins. Is it possible that the issue could be that I am just importing the whole jar from the BankBC plugin into my ShopBC plugin?

#

But the name in both of my plugin.yml are different

lyric gyro
#

you have 2 different jars at your plugins folder

#

with same plugin name

fiery pollen
#

They don't, I just checked.

lyric gyro
#

well they need to have

#

same name

#

otherwise it wouldnt say that

fiery pollen
lyric gyro
#

by importing you mean importing it to the ide or importing it and shading

fiery pollen
#

Well just importing, not shading. Should I also be shading?
implementation files('E:\\LocalCompileJars\\BankBC.jar')

lyric gyro
#

well if you arent shading it, it should work fine

#

cause if you would shade you would override the ShopBC plugin.yml

#

with BankBC plugin.yml

#

also spigot's classloader will load the classes automatically if you depend on the plugin in plugin.yml

#

so no need to shade

#

open your ShopBC .jar file and check if youre accidentally shading BankBC

fiery pollen
#

Alright I'll do that, one sec

#

Wait wth, it's using the plugin.yml from the BankBC jar that is imported.

lyric gyro
#

can you send your gradle file

#

youre probably shading the jar then

fiery pollen
#
    id 'java'

    id "com.github.johnrengelman.shadow" version "7.0.0"
}

group = 'me.julespruvost'
version = '1.0-SNAPSHOT'

repositories {
    mavenCentral()
    maven {
        name = 'papermc-repo'
        url = 'https://repo.papermc.io/repository/maven-public/'
    }
    maven {
        name = 'sonatype'
        url = 'https://oss.sonatype.org/content/groups/public/'
    }
    maven {
        url = "https://repo.mattstudios.me/artifactory/public/"
    }
}

shadowJar {
    relocate("dev.triumphteam.gui", "me.julespruvost.gui")
}

dependencies {
    compileOnly 'io.papermc.paper:paper-api:1.19.3-R0.1-SNAPSHOT'

    compileOnly 'org.projectlombok:lombok:1.18.26'
    annotationProcessor 'org.projectlombok:lombok:1.18.26'

    implementation "dev.triumphteam:triumph-gui:3.1.2" // Replace version here

    implementation files('E:\\LocalCompileJars\\BankBC.jar')
}

def targetJavaVersion = 17
java {
    def javaVersion = JavaVersion.toVersion(targetJavaVersion)
    sourceCompatibility = javaVersion
    targetCompatibility = javaVersion
    if (JavaVersion.current() < javaVersion) {
        toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
    }
}

tasks.withType(JavaCompile).configureEach {
    if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
        options.release = targetJavaVersion
    }
}

processResources {
    def props = [version: version]
    inputs.properties props
    filteringCharset 'UTF-8'
    filesMatching('plugin.yml') {
        expand props
    }
}```
lyric gyro
#

try adding exclude "plugin.yml" to the shadowJar category

lyric gyro
#

at your ShopBC jar

fiery pollen
#

Wait, could it be because I am building it wrong, because I am not seeing my actual code from my ShopBC plugin but I am seeing it from BankBC

lyric gyro
#

what do you mean by that

fiery pollen
#

None of these files include the code from the ShopBC plugin.

#

And that's ShopBC decompiled.

lyric gyro
#

huh

#

no clue then

#

try cleaning your build folder

#

and trying to build again

fiery pollen
#

Bruh I am stupid, I was compiling it wrong. I started using gradle a few weeks ago and forgot to compile it using shadowJar. It works now, thanks anyway for the help!

lyric gyro
#

oh

#

its alright lol

#

im not a gradle expert either

#

i mostly use maven

#

(i know gradle is better)

fiery pollen
#

Yeah, I started using it because people told it is much better and has much more features.

#

Tho, I'm running into a few issues now. Receiving this error:
java.lang.ClassCastException: class me.julespruvost.bank.Bank cannot be cast to class me.julespruvost.bank.Bank (me.julespruvost.bank.Bank is in unnamed module of loader 'BankBC.jar' @3a394b43; me.julespruvost.bank.Bank is in unnamed module of loader 'ShopBC-1.0-SNAPSHOT-all.jar' @27b9b017)
So I understand the error, that I can cast my dependency Bank class to the actual plugin class. But that's the way of doing it no?

pulsar ferry
fiery pollen
#

Oh okay, that was it, thanks Matt!

fiery pollen
#

Why does this ▌ show up as this in the image:

#

Looks like its something to do with encoding, adding -Dfile.encoding=UTF-8 to my run.bat file doesn't work.

proud pebble
fiery pollen
#

Yeah that was it, thanks.

dense galleon
#

To increase the length of the day/night cycle, is the simplest solution disabling the day/night cycle through gamerules and having a runnable increasing the time of day by a custom amount each tick?

stuck hearth
#

I can only imagine that looking like it's skipping across the sky

dense galleon
#

I mean

#

I think that the way Minecraft does it is to set its position every tick, 24000 times a day

#

If I make the day last 72000 ticks, if anything it should look even smoother yknow? i think

stuck hearth
#

I dunno. Might have unintended consequences of time not passing correctly.

#

To that note, probably should just stay out of the discussion, if I don't know much. So good luck.

ancient chasm
ancient chasm
#

regardless of the jumpiness though, it seems like it'll add a lot of packets if you do it that way

ancient chasm
vestal talon
#

Someone here understands how to use ProtocolLib api?

#

I'm trying to make a armorstand packets but can't make them spawn, also I want to make sure new players joining the server could see the armorstand I sent before they joined the server

#

I would appreciate someone to help me figure it out (:

#
public static ProtocolManager manager = ProtocolLibrary.getProtocolManager();
    
    public static void despawnEntity(Entity entity) {
        PacketContainer packet = new PacketContainer(PacketType.Play.Server.ENTITY_DESTROY);
        packet.getIntegers().write(0, entity.getEntityId());
        try {
                  for(Player player : Bukkit.getOnlinePlayers()) {
                    ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
                  }
                } catch (InvocationTargetException e) {
                  e.printStackTrace();
              }
    }
    
    public static void spawnEntity(Location location, Vector vector, Entity entity) {
        PacketContainer packet = manager.createPacket(PacketType.Play.Server.SPAWN_ENTITY);

        packet.getEntityTypeModifier().write(0, EntityType.ARMOR_STAND);
        
        try {
            for(Player player : Bukkit.getOnlinePlayers()) {
                manager.sendServerPacket(player, packet);
            }
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }

    }
#

It's doesn't spawn the entity, also I would love to know if the player dies and respawn the packet still exists? (so I just need to handle players joining the server and send them the packets if needed?)

dense drift
#

how else would the game know where the entity is?

#

and I think there's manager.broadcastPacket() or smth like this that sends the packet to all players

dense drift
#

Would be possible to have fork a gitlab repo on github? I know there's this "mirror" system but idk how it works or if I could use it to fork the repo.

pulsar ferry
#

You can use the import system

#

For keeping up to date with upstream add both remotes and rebase your github remote onto the gitlab remote

minor summit
#

The "fork" thing on github is more artificial than anything else, it's no different than cloning the project locally and pushing to your own repo

dense drift
#

So the repo is on gitlab and I'm not gonna make an account on there just for one repo, and I want to keep everything on github

dense drift
pulsar ferry
#

You can

minor summit
#

you can have both projects as remote yes

#

git clone blah.blah.gitlab
git remote rename origin upstream
git remote add origin blah.blah.github
git push origin

dense drift
#

ah is it that easy?

pulsar ferry
#

remote-lab/main
remote-hub/main

rebase remote-hub/main onto remote-lab/main to keep up to day

dense drift
#

I really need to learn more git smh

minor summit
#

you really do

#

it's very powerful

dense drift
#

Yeah 😭

minor summit
#

i was forced to learn how to github when i wanted to contribute to paper kekw

#

erm, how to git

#

not gh

#

leave me alone it's 8 in the morning

dense drift
#

uh working on bigger projects is scary

#

thank you guys 😗

minor summit
#

it's fiiiiine

dense drift
#

yeah you can delete the branch and start over again kek

pulsar ferry
#

It's pretty scary tbh, specially when there are tons of branches going on at the same time and you have to rebase and fix conflicts and worry that you could be breaking other people's works and you wouldn't know how to fix

dense drift
#

exactly

#

I always fuck up when I want to edit a commit message because I somehow forget it will open a vim cli and I CAN NOT CLOSE IT

minor summit
pulsar ferry
#

Or were forgotten kek

dense drift
#

Like I use ctrl + : and q or whatever the syntax is but it types the q in the editor instead of exiting vim kek

pulsar ferry
#

When ever I need to edit things on terminal I just use nano, it's easier to use
But thankfully Gitkraken saves me a lot of trouble when it comes to conflicts

dense drift
#

I would use anything but vim

dense drift
#

yes probably something similar

dense galleon
#

Do you recon the day/night cycle will be choppy? I recon it might not even be noticeable

#

If it's 72000 steps a day

minor summit
#

it will be noticeable if people actually stop and stare at the sun/moon to look for it

dense drift
#

probably not, you can make it as smooth as you want

minor summit
#

but it's not something naturally disrupting

dense galleon
#

Yeah I mean if it were 1000 steps in a day it would be noticeable a lot

#

But with 72000 i think it will be so barely noticeable?

dense drift
#

wait to see how essential's ptime does, or some other command, the sun goes up and then back again kek

dense galleon
#

What is the point of doing that haha

#

To skip the day?

dense drift
#

I can't remember the command but it took me a while to figure out what is going on

minor summit
#

uh ptime doesn't affect the cycle's speed, it just changes the time point (for the player at least)

dense drift
#

yeah I can't remember if it was ptime, but it was smth to do with the time

dense galleon
#

Do you recon doing such a thing would be resource expensive for the server

minor summit
#

¯_(ツ)_/¯

dense drift
#

you can only test by trying ig, but there are probably heavier things that this already running on the server