#help-development

1 messages Β· Page 1177 of 1

fading drift
#

this shit is all brand new to me and I hate how I don't instantly get it

sly topaz
#

I mean, system design isn't easy to get on the first go, I can ultimately tell you what to do on a high level but that won't help you with the implementation details and all the gotchas around this

#

the goal is clear though, have a system which you can easily retrieve and store data across a network

#

depending on the amount of information you're planning to share, the ways to go about it will vary

#

if it is simple information like you're trying to do right now, maybe a database and a redis cache is overkill, using sockets would do

#

however if you plan to share a lot of information across the network, you'll ultimately stumble upon all of this anyway so may as well suffer now

fading drift
#

fair enoughj

#

I'm having such an annoying issue

#

I have this class used to check names from my velocity plugin

#
        this.getServer().getMessenger()
                .registerIncomingPluginChannel(this, "xincraft:getname", nameChecker);```
#

its initialised like this

#

yet this never prints

    @Override
    public void onPluginMessageReceived(String channel, Player player, byte[] message) {
        System.out.println("Received message on channel: " + channel + ": " + Arrays.toString(message));```
#

however velocity literally says it prints

#
                boolean successful = sendPluginMessageToBackendUsingPlayer(player, MinecraftChannelIdentifier.create("xincraft", "getname"), byteArray.toByteArray());
                System.out.println("Sent player name to backend: " + successful);```
#

[22:30:29 INFO]: Sent player name to backend: true

#

wait I think im sending to the wrong server

#

I'm sending it to the player who was found not the one who requested

slender elbow
#

you need to send it to the player's server, not the player client

fading drift
#

I thought thats what I did

#
    public boolean sendPluginMessageToBackendUsingPlayer(Player player, ChannelIdentifier identifier, byte[] data) {
        Optional<ServerConnection> connection = player.getCurrentServer();
        // On success, returns true
        return connection.map(serverConnection -> serverConnection.sendPluginMessage(identifier, data)).orElse(false);
    }```
#

I think I'm just sending to the wrong server

#

holy shit I am

#

whoopsie

slender elbow
#

true

quaint mantle
#

how do you get the weight of a player's luckperms group?

young knoll
#

Get their user instance, get primary group, then use that to get the group object and use getWeight

quaint mantle
#

what is the user instance?

sly topaz
quaint mantle
#

How can I delete a new scoreboard registered on the server?

sly topaz
quaint mantle
#

getNewScoreboard()

sly topaz
#

yeah, those aren't really registered to the server, if you want to remove it then just set the player's scoreboard back to the main scoreboard or to some other scoreboard

#

that also means you'll have to store them on your own

quaint mantle
#

okey thanks!

nova quail
#

Is sending message to players and all chat stuff async?

worthy yarrow
#

iirc yes?

nova quail
#

Thanks

floral fern
#

There is a better way to test my plugins instead compile it everytime and insert into plugin folder of my server?

worthy yarrow
#

Hotswapping but uh not really recommended

floral fern
#

Hm, okay. Also if I will create a configuration file I can use File.createNewFile()? Or must I use saveResource()?

shadow night
worthy yarrow
#

well yeah kek

kind prairie
#

Lol

sly topaz
#

personally I recommend Files.createDirectories then Files.createFile

floral fern
#

Yeah, I don't see much difference between the functions. Only the "overwrite" parameter

blazing ocean
floral fern
#

Oh I can't send images

blazing ocean
#

?img

undone axleBOT
#

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

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

floral fern
#

K one sec

worthy yarrow
sly topaz
#

you can just create a FileConfiguration afterwards

floral fern
#

Ah

blazing ocean
worldly ingot
floral fern
#

I need a spigot account

blazing ocean
#

Or just use an image hosting site

worthy yarrow
sly topaz
floral fern
#

Ima create it later but this the code line:

final File configFile = new File(JokingHouse.MAIN_PLUGIN.getDataFolder(), name)
if (configFile.createNewFile()) {
  return configFile;
}
blazing ocean
worthy yarrow
#

Damn straight

sly topaz
#

but I agree, I just personally prefer the NIO APIs where possible

sly topaz
floral fern
#

(Sorry if I take to long to give a response slow connection)

sly topaz
#
var configFile = new File(JokingHouse.MAIN_PLUGIN.getDataFolder(), name);
if (configFile.exists() || (configFile.getParentFile().mkdirs() && configFile.createNewFile()))
  return configFile;
#

I hate that tbh

#
var configFile = new File(JokingHouse.MAIN_PLUGIN.getDataFolder(), name);
if (configFile.exists())
  return configFile;

var parent = configFile.getParentFile();
if (!parent.exists())
  parent.mkdirs();
if (configFile.createNewFile())
  return configFile;
clear elm
#

@rough drift how tf can i use ur lifesteal plugin

#

it automaticly delets from the plugin folder

river oracle
#

πŸ’€ idk why that just seems like something malware would do

#

Your PC okay mate?

clear elm
#

me?

floral fern
# sly topaz ```java var configFile = new File(JokingHouse.MAIN_PLUGIN.getDataFolder(), name)...

This is what I did, I think I can improve is btw

private YamlConfiguration createNewConfigFile(String name) throws FailedToCreateSettingsFile {
        final File configFile = new File(JokingHouse.MAIN_PLUGIN.getDataFolder(), name);

        try {
            if (configFile.getParentFile().mkdirs() && configFile.createNewFile())
                return YamlConfiguration.loadConfiguration(configFile);
        } catch (IOException exception) {
            throw new FailedToCreateSettingsFile();
        }
        
        return null;
    }

    public YamlConfiguration getConfigFile(String name) throws FailedToCreateSettingsFile {
        final File configFile = new File(JokingHouse.MAIN_PLUGIN.getDataFolder(), name);

        if (configFile.exists())
            return YamlConfiguration.loadConfiguration(configFile);
        
        return createNewConfigFile(name);
    }
rough drift
clear elm
#

does it work with paper too?

rough drift
clear elm
#

couldnt find it

rough drift
clear elm
#

for me it dont works i uploaded helix and lifesteal plugin but id dont wors

rough drift
clear elm
#

mb

#

sorry

river oracle
#

I'd go to his support server kekw

clear elm
tranquil ferry
#

hey can i promote my plugin in a thread by making something as why should u use / compariosn / wiki / showcase

#

any smort ones here?

pure dagger
#

you cant put like 60 * 60 in yml right? as int

tranquil ferry
river oracle
tranquil ferry
#

import it as string use split and then make it int

river oracle
#

You can do so by making a math parser

pure dagger
tranquil ferry
pure dagger
#

thanks

river oracle
#

Easiest type to make is recursive descent

pure dagger
#

what

tranquil ferry
#

recursive descent

young knoll
#

Or just use an existing parser

#

Like Crunch

pure dagger
#

if i am not supposted to do static methods then i should do DI always?

rough drift
#

enlighten us with your funny parser

tranquil ferry
#

dont wanna get myself banned

#

hehe

rough drift
#

if it's cool enough sure, you can also just ask for feedback on it in #1100941063058894868 or for feature-related feedback (make a thread in #general), should be fine

#

just don't spam it and take it more as "look at this cool thing I made, what do you think about it" instead of "I made xyz plugin for just €9.99 buy now!1!!!"

rough drift
#

idk about that Β―_(ツ)_/Β―

tranquil ferry
#

./ping staff

pure dagger
tranquil ferry
pure dagger
#

okay

tranquil ferry
#

its eaz stuff

pure dagger
#

oh seemscool

worthy yarrow
#

google searches are even producing code snippets now

lilac dagger
#

google doesn't wanna lose the programmers

worthy yarrow
#

Google interview:
Question 1:

#

"How do you fix xyz"

#

googles it and shows them code snippet produced by said search

lilac dagger
#

you're hired

#

otherwise no, try again

#

actually we we'll call you

worthy yarrow
#

proceed to say, "I thought google had all the answers"

rough drift
#

I found the piece of code not checking for the correct interfaces

worthy yarrow
#

Embed failure?

#

nice

lilac dagger
#

based on the naming, it seems very user error prone

pure dagger
#

why is this all uppercase what is taht

#

?di

undone axleBOT
lilac dagger
#

it's probably an int somewhere above

#

java library has the same issue in some places

peak depot
#

what was the name of that command api/framework everybody uses

lilac dagger
#

brigadier?

#

or cloud framework

#

that i hear about

peak depot
#

nah so you could do @SubCommand("addPlayer") etc

lilac dagger
#

annotation based hmm

#

i can't think of any

eternal oxide
#

acf

peak depot
pure dagger
#

if i have a class only with methods that can be static, (but you say that static is bad), should i make instance of it everytime or what?

eternal oxide
#

if its stateless then static is fine

pure dagger
#

what does it mean?

#

stateless

eternal oxide
pure dagger
#

okay

quaint mantle
#

Static variable that doesn't change

pure dagger
#

so like im having methods to do something to a player, or turn amount of seconds as int to a timer as string , like 140 would be 00:02:20

#

and then its static

eternal oxide
#

utility methods

pure dagger
#

its stateless

eternal oxide
#

static is fine

pure dagger
#

so its ok

#

do you know a good way to manage cooldowns?

#

like a map with UUID and Long which is milliseconds

chrome beacon
#

That's a fine way of doing it

pure dagger
#

i always do it my way but its messy when its more cooldowns

chrome beacon
#

but if you want it to stay in sync with the rest of the server you can store the time in ticks

#

depends on the usecase really

pure dagger
# chrome beacon That's a fine way of doing it

i make a class, which has the map of <UUID, Long>, it has methods like hasCooldown(Player player), getCooldown(Player player), addCooldown(Player player),
when i add coldown i just put the uuid and system.currenttimemillis + cooldown, in the getCooldown method i check if the difference between the value from map and system.currenttimemillis is <= 0, then i remove and return 0, and hasCooldown just returns getCooldown() == 0

but if i want to make the cooldown time configurable i would probably need to do it like that: to map i add time when the cooldown was added, not time when cooldown will end, and then in getCooldown() method i would check if System.currentTimeMillis() >= value from map + cooldown

umm sorry for message that long

#

but

river oracle
#

generally unless you have a good reason not to store time in ticks

#

the entire server operates on that model

pure dagger
#

but will it work when plugin restarts?

river oracle
#

best way to approach this is to use a BukkitTask that runs every tick

pure dagger
#

because then if its a long cooldown like 4h, i store it in config

river oracle
#

and ticks down over time

#

or you could store it in PDC or even better a proper database

pure dagger
#

but then user has to connect databse?

river oracle
#

I'd opt for PDC here, but considering bukkit does a deep copy on ItemMeta that'd be performance suicide

river oracle
#

it is good for up to millions of entries theres no reason to avoid it

pure dagger
#

where is it stored

#

the data

river oracle
#

its a flat file

#

SQLite is a flat file database

#

the connection is just your plugin maintaining a lock file with the database

pure dagger
#

lock file?

river oracle
#

perhaps this is a good opprotunity to learn about databases

#

use SQLite and have some fun, I would reccomend not coming here for help with SQLite and trying to give it a go on your own

#

if you're absolutely desperate you can always come here for help, but there's so much joy in figuring it out yourself

#

pretty much everything above is juts technical jargan, but put simply SQLite is stored in a file you don't need to worry about having a server for it

sly topaz
#

a database for a cooldown is crazy

river oracle
sly topaz
#

just store it in a file

pseudo hazel
#

I mean, depends on the length of the cooldown

eternal oxide
#

depends the type of cooldown

pure dagger
#

πŸ˜΅β€πŸ’«

river oracle
#

I suppose you could use JSON, but I wouldn't use YAML

sly topaz
#

it really doesn't matter

pseudo hazel
#

yeah

#

use .txt

pure dagger
#

i dont get it

river oracle
#

.csv πŸ˜„

pure dagger
#

does it matter or not

pseudo hazel
#

no

#

why would it matter

eternal oxide
#

it all depends how many cooldowns you are storing, how often you are changing them.

river oracle
#

there are plenty of options, personally I'd go with SQLite or Json depending on what we're dealing with Shrug

pure dagger
#

do i have to acces the database or the file every time i want to do something with cooldowns, or can i store it in my plugin and on disable save it to file or database, or something like that

sly topaz
#

just use bukkit's configuration api if you don't want to overcomplicate it

pure dagger
#

isnt it like

eternal oxide
#

Not enough details to tell if you shoudl read directly

pure dagger
#

bad to acces a cooldown every time, it can be really often, player can spam something or idk

sly topaz
#

it depends on how critical you think the data is, i.e., if you want it to persist through crashes

pseudo hazel
#

you dont read it every time

pure dagger
#

if its an item with cooldown, you have to check it every time player tries to use it

river oracle
#

well that and you'd want to cache anyways otherwise you'll crash your server lmao

pseudo hazel
#

use a map for local data and then save it to a file if something changes

river oracle
#

either way you'll have a cache

paper viper
#

Use the cooldown item component

sly topaz
#

oh that exists too

eternal oxide
#

Never access a db on the main thread. so If your code requires the data in the same tick you need to cache it

river oracle
pseudo hazel
#

yeah in 1.21.3+

river oracle
#

I forgot its on ItemStacks now

paper viper
#

Why are yall

#

Databases

#

Breh

sly topaz
pseudo hazel
#

I mean instead of a database you could also just use pdc

river oracle
pure dagger
#

i feell like everyone is saying different things

river oracle
#

ItemMeta is a deep copy

blazing ocean
#

hashmap frf

sly topaz
paper viper
#

For API

pseudo hazel
#

too heavy for what

pure dagger
blazing ocean
karmic phoenix
#

Hey everyone, I don't really wanna interrupt y'all, but I need help with something, that might be considered basic by some, so it should be quick, I've looked for a solution but couldn't find any. I can create a thread if you're willing to help.

eternal oxide
pure dagger
paper viper
#

API version

river oracle
pseudo hazel
#

then maybe just explain what you do want?

sly topaz
pseudo hazel
#

all projects go wrong because of wrong requirements

pure dagger
paper viper
#

If you are using items, I’d recommend the item cooldown component because it also adds a nice animation for the client, but it’s only 1.21.3+

sly topaz
#

personally that'd be either the item cooldown component or PDC, I am unsure why Miles believes it is too heavy but you can just change it up when your server scales enough for that to become a problem anyway

pseudo hazel
#

what else would have this cooldown

pure dagger
#

maybe typing in chat, or something not related to items

#

5 seconds

#

okay but then you dont have to save this

pseudo hazel
#

right

#

you just need to define what you actually want to use these cooldowns for

karmic phoenix
eternal night
#

PDC performance depends on what item you are checking that on

pseudo hazel
#

make the right tool for the right job

eternal night
#

if its a stick with nothing on it, w/e

#

if its a shulker box with a shit ton of items in it, ehh

pure dagger
#

i had a plugin with opening chests, i was storing players, and every player has a map of <ChestLocation, Cooldown>

#

i mean cooldown to open chests

#

it was actually playerinteractevent not opening chests but yes

pseudo hazel
#

so are you trying to find a solution for all cooldowns or like what are you trying to do right now

paper viper
#

Yeah we have no idea

undone axleBOT
#

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

eternal oxide
#

Your chests have a cooldown for opening?

pseudo hazel
#

find what you are trying to ask in the first place

pure dagger
eternal oxide
#

then the Chest itself shoudl have a map of player uuid and coldown

pseudo hazel
#

and then think about the edge cases and situations you need this system for

#

and then come up with a question to ask how something like that could be done

eternal oxide
#

it shoudl be on each chest not on the player

pure dagger
eternal oxide
#

pdc

river oracle
#

Chest has PDC

pure dagger
#

what if you destroy it and place again

pseudo hazel
#

then you can open it again...

eternal oxide
#

then its a different chest

pseudo hazel
#

if you destroy a chest all contents will spill out

river oracle
#

you can always copy the PDC to the Item too

#

if you want to

#

PersistentDatacontainer#copyTo

pure dagger
#

thats bad, because i wanted to like store the locations more, not the chests

pseudo hazel
#

then store it per player

eternal oxide
#

location shoudl be irrelevant

pure dagger
pseudo hazel
#

okay

#

same answer then

eternal oxide
#

Still pdc on the chest

pseudo hazel
#

why

pure dagger
#

but still chests can be destroyed and placed again, i think that my entire approach is bad, so doing the cooldown is harder

karmic phoenix
#

HashMap communication.

eternal oxide
#

If its location specific and not chest specific you sould store it in teh chunk pdc

eternal oxide
#

if you are allowing the chest to be broken, why are you doing a cooldown?

pseudo hazel
#

sounds like the cooldown should be on the inventory

karmic phoenix
split tinsel
#

How do you get a player's connection with NMS in version 1.21, for some reason the playerConnection variable is not showing up

pure dagger
pseudo hazel
#

then dont

#

keep it

#

and reopen it

#

I mean this is all depending on everything else you already have

pure dagger
#

so clear it every time?

pseudo hazel
#

why would it be cleared every time

blazing ocean
eternal oxide
#

however an inventory is not persistent so you are now back to the opriginal issue of saving data

pure dagger
pseudo hazel
#

and so using a file is the best

pure dagger
#

yml?

#

or

pseudo hazel
#

whatever

#

yml is easiest

pure dagger
#

can we make a thread?

#

or maybe not

pseudo hazel
#

you could

#

but i gtg

eternal oxide
#

yes thats optional

pure dagger
#

i think file is just the best

eternal oxide
#

IF your chests are always in teh same place

split tinsel
#

Truly an NMS moment of all time

blazing ocean
#

That's a spigot name

split tinsel
#

what they done renamed it to now

eternal night
blazing ocean
eternal night
#

you are (hopefully) using mojang mappings ^

split tinsel
#

Oh wait im dumb

pure dagger
#

i mean, there are values in config (locations of chests), and when player right clicks a chest, you check if the chest has the location, then check the cooldown to that location, umm idk how to do that better, i feel this is stupid

split tinsel
#

ClientboundRemoveEntitiesPacket

#

there we go

#

Do I just pass the entity id of the item to it?

pure dagger
pure dagger
#

so you can say whats wrong

pure dagger
split tinsel
#

Is this correct

public class CustomItemManager {
    public HashMap<Integer, Player> clientSidedItems = new HashMap<>();

    public Item dropClientSidedItem(Location location, Player player, ItemStack itemStack) {
        Item item = location.getWorld().dropItemNaturally(location, itemStack);

        Bukkit.getOnlinePlayers().stream().filter(p -> !(p == player)).forEach(p -> {
            ((CraftPlayer) p).getHandle().connection.sendPacket(new ClientboundRemoveEntitiesPacket(item.getEntityId()));
        });
        
        clientSidedItems.put(item.getEntityId(), player);
        
        return item;
    }
}
eternal oxide
#

If you pass an instance its stateless. If you hold it in the class you need it to be a singleton so not really stateless so shoudl not be static

neat wolf
#
protected final EntityCreature a; //THE ENTITY
    protected final double b; // x
    protected final double c; // y
    protected final double d; // z
    protected final double e; // speed
    protected boolean g;

    public PathfinderGoalLoc(EntityCreature entityCreature, double x, double y, double z, double speed) {
        this(entityCreature, x, y, z, speed, 5);
    }

    public PathfinderGoalLoc(EntityCreature paramEntityCreature,double x, double y, double z, double speed, int timeBetweenMovement)
    {
        a = paramEntityCreature;
        e = speed;
        b = x;
        c = y;
        d = z;
        this.a(EnumSet.of(Type.a));
    }

    //RUNS EVERY SINGLE TICK (THIS IS HOW ENTITIES WORK)
    //WILL START PATHFINDING GOAL IF ITS TRUE
    @Override
    public boolean a() {
        return true; //<- runs c
    }

    //RUNS IF A IS TRUE
    public void c() {
        //runner                    x      y        z     speed
        this.a.getNavigation().a(this.b, this.c, this.d, this.e);
    }

    //RUNS AFTER C
    //RUN EVERY TICK AS LONG AS ITS TRUE (AFTER C GOTS EXECUTED)
    public boolean b() {
        return true;
    }

    //RUNS WHEN B RETURNS FALSE
    public void d() {

    }
#

Hello, I'm looking for an equivalent of this following NPC path finder goal (written before nms remapping) how can I use the entity navigation component to make it follow a player for example? I can't find much information on the remapping version of NMS 1.21.1 so I'm a bit lost

#

and the tick method too ^^

chrome beacon
#

Convert the mappings

blazing ocean
#

what are those comments 😭

neat wolf
neat wolf
blazing ocean
#

use the search ba

eternal night
split tinsel
#

but won't the item still be able to be picked up by other players as its only hidden and not destroyed?

eternal oxide
#

setOwner

young knoll
#

Can’t other players pick up the item even if it is destroyed for their client

eternal night
#

Pretty sure pickup logic is server side anyway

#

yea

young knoll
#

I assume that’s a server side thing

blazing ocean
#

It is

young knoll
#

Does vanilla actually use that at all

#

Or is it solely for content creators

eternal night
#

it does

#

e.g. give command drops

#

or advancement rewards

young knoll
#

Interesting

eternal night
#

would be pretty ass if your inventory is full, your get an advcancemnt and someone else grabs it

river oracle
#

I think it'd be pretty great personally

#

I'm a leech on society so

young knoll
#

Swoop in with the elytra and yoink it

#

Flyby robbery

river oracle
#

PepeWithGun gimme your loot

young knoll
#

Hmm, working with a ChunkSource directly doesn’t seem fun

remote swallow
#

get ur own trial key

young knoll
#

And moonrise doesn’t help

river oracle
river oracle
remote swallow
river oracle
#

still means I'm 1 year better

remote swallow
#

your much more of a nerd

river oracle
remote swallow
#

i have cat ears you dont

river oracle
#

nerd behavior

remote swallow
#

nuhuh

river oracle
#

uhhuh

#

I HATE COLL1234567

remote swallow
#

NO

#

YOU CANT SAY THAT

young knoll
#

Blah, I need to figure out an efficient way to merge a bunch of small bounding boxes

river oracle
#

what's he gonna do ban me???

remote swallow
#

yeah

river oracle
#

oh :(

remote swallow
#

hes a cool1234567 guy

river oracle
#

octtree or whatever

#

@young knoll check this one out https://en.wikipedia.org/wiki/Octree

An octree is a tree data structure in which each internal node has exactly eight children. Octrees are most often used to partition a three-dimensional space by recursively subdividing it into eight octants. Octrees are the three-dimensional analog of quadtrees. The word is derived from oct (Greek root meaning "eight") + tree. Octrees are often ...

remote swallow
#

thats how the simulation works

young knoll
#

I need to merge them not group them

#

The merged boxes shouldn’t contain any space that wasn’t part of the original boxes

river oracle
#

oh

#

can oyu merge them by doing like O(N) finding mins and maxes of the given boxes

#

or depending what you can do is if you can detect a bounding box is being made alongside another one or something Shrug

young knoll
#

Tbf arbitrary structures probably don’t boil down to that few bounding boxes anyway

#

Maybe I should just store a bitset for the entire space and flip bits that are occupied

#

My use case is dungeon generation (again)

#

If I was working with only rectangular rooms I could just use a single large bounding box, but that doesn’t work when rooms are arbitrary shapes

#

I either need to subdivide the rooms into multiple boxes or I need to have a way to do precise block-block collision checks fully async

lilac dagger
#

that would be a cuboid no?

umbral ridge
#

hey how often does weather change in minecraft? random? or is it on some specific interval

lilac dagger
#

specific interval

#

oh, weather is probably random

#

there's a timer for when it will change

umbral ridge
#

because now that i synchronized the server time with realtime i also need to take care of the weather. probably handle it myself... i'm making a forecast for weather in minecraft after this if i succeed XD

lilac dagger
#

you just need to edit the interval and you're set

umbral ridge
#

i could also get some apis and change the weather based on how it is in real life

#

yea

young knoll
#

You could just disable vanilla weather changes

#

And handle it yourself

native nexus
#

Do plugins need to be open source?

umbral ridge
young knoll
#

No but they should be :p

pseudo hazel
#

if its not opensource its just weak

umbral ridge
#

if plugins were open source and published one some site with high traffic.. people would judge every tiny bit of the code that isn't up to their expectations. the world is full of people who browse github just to judge code XD

alpine urchin
#

the questions is a bit flawed, but what are you getting at @native nexus

lilac dagger
#

people just don't like my code

native nexus
native nexus
pseudo hazel
#

yeah

native nexus
#

Cut with the bs

pseudo hazel
#

its not flawed

native nexus
#

But I like reading peoples code πŸ˜­πŸ˜‚

pseudo hazel
#

the answer is that you do not have to put it open source

#

but its highly encouraged

#

and there is really no reason not to

young knoll
#

I mean technically GPL

#

But that isn’t enforced so

pseudo hazel
#

okay let me rephrase my answer then

native nexus
#

Yeah if it’s not licensed then I guess you don’t

alpine urchin
pseudo hazel
#

I think you need to be able to show the source to people

#

spigot plugins are licensed with gpl

#

whether you like it or not xD

native nexus
alpine urchin
#

Yes, GPL does apply, however if your understanding of GPL is that it "forces you to become open source" then that's an oversimplification of the entire license, and would lead us to misunderstand the license.

#

so, open source necessary, no, follow the license? yes.

#

that's why the question could have been phrased more clear

native nexus
#

You could have easily said, did you mean something else?

pseudo hazel
#

welcome to the world of anti social developers

native nexus
#

Yeah clearly….

#

Sorry I am not on your level

#

Sorry you have to always be right

alpine urchin
#

you're arguing semantics here, a dictionary definition of "flawed" is imperfection, so being near perfect might be a complement.

#

lol cmon man

#

it's not that deep

lilac dagger
#

i bet you both missunderstood each other lol

native nexus
#

Sorry I have feelings

alpine urchin
#

it's not that deep

#

i said a bit flawed

#

"but what are you getting at (what are you asking)"

alpine urchin
#

lol

umbral ridge
#

this is like asking someone.. i have an apple. is apple good? as in fruit
and then they would ask you all sort of questions about it. referring to retrooper

native nexus
#

Please stop

sly topaz
#

that's the first thing that comes to mind when it comes to what you've described

#

there's other ways to go about it but eh, they're all very complex algorithms on their own lol

young knoll
#

I shall look into that

#

Currently leaning towards the bitset solution

plucky peak
#

okay so

#

im making

#

uh

#

a plugin for beta 1.7.3

#

and im

#

BRO

#

STOP 😭

#

im making a plugin for beta 1.7.3

#

and im trying to detect deaths

sly topaz
plucky peak
#

but it wont let me

alpine urchin
#

who u saying stop to lol

plucky peak
sly topaz
plucky peak
#

everytime i sent a new message

plucky peak
#

only commands

#

i added /msg and /list

alpine urchin
#

howcome you are working with 1.7.3?

plucky peak
#

trying to add funny death messages

sly topaz
#

you'd rather just use cursed legacy fabric instead of bukkit or hmod, whatever was available for that version

alpine urchin
#

?

plucky peak
alpine urchin
#

lmao

plucky peak
#

so i bought a beta server for us to play on

#

or not my friends just barteek

young knoll
#

If the death events didn’t exist back then

#

Then you’re out of luck there

plucky peak
#

uhhhh

sly topaz
eternal oxide
#

damage event probably existed

plucky peak
#

i mean like

sly topaz
#

your best shot at doing anything in that version

plucky peak
#

there is a death message plugin

#

i looked through its source code

#

but i couldnt understand

#

anything

eternal oxide
#

learn java moment

plucky peak
remote swallow
#

did you use a decompiler or just open a .class file

plucky peak
#

jdec.app

eternal oxide
#

then there is no way you would not be able to work out how to track a death WHIT the source of a death message plugin

plucky peak
plucky peak
#

i

#

took some code from it

#

and it didnt really

sly topaz
plucky peak
#

work

eternal oxide
#

too
many

plucky peak
#

it forced me to use their like weird

young knoll
#

Did people even know how to obfuscated back then

plucky peak
#

class

eternal oxide
#

presses of enter

sly topaz
#

sparkagabagoo, can you stop pressing enter

#

it is driving me nuts

plucky peak
#

okay

sly topaz
#

sorry for being harsh it is just a pet peeve of mine

plucky peak
#

yeah bro this plugin is forcing me to use its like weird code bruh

tall dragon
sly topaz
eternal oxide
# plucky peak

HeroicDeathListener looks like the code you want to look at

plucky peak
plucky peak
# plucky peak

this is like the closest thing i got to like event stuff

young knoll
#

Looks like an older version of the event system

plucky peak
#

yea it is

#

im making a plugin for beta 1.7.3 bruh

young knoll
#

Seems pretty simple

plucky peak
#

WAIT

young knoll
#

Event type, listener, priority, plugin

plucky peak
#

but i put this in my code already

#

and it did nothing

#

let me try this again bruh

umbral ridge
#

HeroicDeathEvent is a custom wrapper class

plucky peak
#

heroicdeathevent is some weird

#

can i swear on here?

pseudo hazel
#

yes

#

just dont be a jerk

plucky peak
#

should this not work?

#

ok i know my code is

upper hazel
#

what better 1 bukkit task or many

plucky peak
#

JUST DONT WORRY ABOUT MY CODE

#

ok i mean that other script doesnt have

#

uhm

#

@EventHandler

#

so maybe i should remove that?

young knoll
#

Β―_(ツ)_/Β―

#

I have no idea how that event system determined what method is the listener

eternal oxide
#

what version of spigot are you coding for?

plucky peak
shadow night
#

Oh damn, prehistoric times

#

Even before our event system

plucky peak
#

oh wait

#

this.plugin.recordDeath

young knoll
#

?howold b1.7.3

undone axleBOT
young knoll
#

Hey it’s old enough to use discord

shadow night
#

It is lol

plucky peak
young knoll
#

Idk, probably used to record the death

remote swallow
#

look at what record death is in the plugin

#

totally believe u know java too

young knoll
#

You’ve only shown small snippets of the code so we can’t really tell what it’s doing

eternal oxide
#

or drop in channel

plucky peak
#

what

remote swallow
young knoll
#

lol

eternal oxide
#

lol I wrote it πŸ˜›

plucky peak
#

dude this setup is so scuffed man

#

im using intellij and made a plugin using the 1.12.2 preset thing

remote swallow
#

this sounds kinda crazy

#

maybe you should update

plucky peak
#

yea bro

#

my friends hate new minecraft

eternal oxide
#

there is no 1.7.3 version up there

#

only 1.6.2

plucky peak
#

oh

young knoll
#

That’s release 1.6.2 too

#

Which is much newer

#

?howold 1.6.2

undone axleBOT
young knoll
#

Well, 2 years newer

#

Compiled under JDK 6, Bukkit 1.6.2-R0.1

#

Hell yeah java 6

remote swallow
#

fuckin love java 6

#

still use it on 1.21.3

umbral ridge
#

java 1 better

#

'96

eternal oxide
young knoll
#

That appears to use the same event system we have now

plucky peak
#

found another plugin

#

essentials for b1.7.3

#

or it came with the server pack

#

so i assume it is

#

same thing

eternal oxide
#

There was no 1.7.3 release

#

Probably a bugged Bukkit version

plucky peak
#

ok well it works on 1.7.3

plucky peak
#

im gonna check out the event registration

plucky peak
#

yeah its using old classes and stuff

shadow night
#

I remember that event system with classes that were just a lot of empty methods you could override kek

eternal oxide
#

its just a simple listener, registered in teh onEnable

plucky peak
#

ill just write it down anyways

#

PluginManager pm = this.getServer().getPluginManager();
pm.registerEvent(Type.ENTITY_DAMAGE, this.listener, Priority.Monitor, this);
pm.registerEvent(Type.ENTITY_DEATH, this.listener, Priority.Monitor, this);
pm.registerEvent(Type.PLAYER_RESPAWN, this.playerListener, Priority.Monitor, this);
pm.registerEvent(Type.PLAYER_QUIT, this.playerListener, Priority.Monitor, this);

shadow night
eternal oxide
#

yes

young knoll
#

See now that’s some wacky old event system

eternal oxide
#

private final HeroicDeathListener listener = new HeroicDeathListener(this);

#

then register the events

#

Back then there was no annotation system

young knoll
#

Oh wow

#

You extended EntityListener and override methods

sly topaz
#

in what version was fevents implemented

young knoll
#

Β―_(ツ)_/Β―

#

Sometime between beta 1.7.3 and full release 1.7.3 :p

warm mica
#

@lilac dagger I feel honored, but I'd appreciate if you'd be more creative on your own instead of copying feature by feature and config by config from my plugin, thanks

sly topaz
#

LMAO

#

bro got called out

eternal night
plucky peak
#

ok dude it doesnt even let me build the goddamn program

eternal oxide
#

Hes not too good at freestylin πŸ™‚

lilac dagger
#

i've been put to make these features lol

#

plus they're not copying

#

check it out

sly topaz
lilac dagger
#

@warm mica

plucky peak
#

ITS BECAUSE IM USING FUCKING 1.12.2 AS THE THING ITS READING OFF OF

sly topaz
plucky peak
#

im using 1.12.2

sly topaz
#

go to dms smh

lilac dagger
#

tell me what is like yours

eternal oxide
plucky peak
#

im just using 1.12.2 to make it because its the lowest version i could get to 😭

young knoll
#

Well that won’t work

sly topaz
#

just compile it yourself

young knoll
#

The api is entirely different

eternal oxide
#

You can;t build against 1.12 if you want it for 1.7

young knoll
#

Beta 1.7 at that

lilac dagger
#

@warm mica btw i've been told you've made the setup where you set using the hotbar, was i not the first to make that i wonder πŸ˜‚

sly topaz
warm mica
sly topaz
#

@plucky peak this project seems to port some new APIs to craftbukkit 1.7.3 beta, I'd use that

#

Java 8 even, that's crazy

lilac dagger
#

if players want a feature, i provide the feature

plucky peak
#

i thought coders were nice and friendly nerds lol

lilac dagger
#

well, he went at me

shadow night
sly topaz
#

most nerds are prideful assholes, don't get it wrong

shadow night
#

I personally covered ebic in metaphorical shit recently

plucky peak
#

i'd like to make my own thing

shadow night
sly topaz
#

you're crazy, but go off

plucky peak
#

lol

sly topaz
#

the 1.7.3 beta codebase isn't that big anyway so it shouldn't be too hard

young knoll
#

Gonna have to go to some shady old site

plucky peak
shadow night
#

Not even an inventory API :(

sly topaz
#

that forks ports inventory API

plucky peak
#

i got it on github

young knoll
#

What’s an inventory

shadow night
plucky peak
sly topaz
#

did inventories packets exist back then tho

young knoll
#

Did we have those back then

warm mica
shadow night
shadow night
lilac dagger
#

well, i'm just trying to do my job as a developer

young knoll
#

Display entity? Armor stand? Nah but you can have P I G

warm mica
lilac dagger
#

i'm sorry if some things look similar to yours

shadow night
#

Or lava item

young knoll
#

Hunger bar? Nope sorry

shadow night
#

Funny thing about b1.7.3: all blocks were automatically registered as items

eternal oxide
#

I found CB 1.2.5 while on this history dive

#

server start SO fast πŸ™‚

young knoll
#

Blocks were registered as items for a long time

#

Hell I think until 1.13?

shadow night
shadow night
young knoll
#

1.21 starts pretty quickly now

sly topaz
#

I mean, you can just go back on the commit history and compile it

young knoll
#

Thanks to Mojang majorly lowering the spawn chunk radius

shadow night
wet breach
#

some beta or alpha version

sly topaz
wet breach
#

I will have to go take a look

sly topaz
#

if worlds are generated that is, if not then idk, 1 minute and some?

shadow night
sly topaz
#

also windows

shadow night
#

I have a laptop

sly topaz
#

I do too

#

I say pc out of use

shadow night
#

My laptop is utter garbage

sly topaz
#

running a flaming celeron N4020

#

literally flaming, that thing doesn't explode because God is gracious

umbral ridge
#

at least it's 2 cores

#

I expected 1 XD

warm mica
sly topaz
#

it isn't too shabby honestly

sly topaz
#

I actually did try to use one via devcontainers, but it turned out more annoying than I thought

#

mostly because I don't have IJ ultimate

warm mica
#

Me neither, but at that setup it's prob faster to just upload

sly topaz
young knoll
#

Isn’t that just uploading but fancy

peak depot
#

am I being silly or did setHeldItemSlot get removed

remote swallow
peak depot
#

thx

fading drift
#

in rare cases a player on my server can hit another player and when I teleport them at the exact same time it’ll register the hit from where the player was teleported

#

is there a way to cancel ongoing hits or something? before I teleport the player or even after

eternal oxide
#

make them invulnerable for a few ticks

fading drift
#

i’m using spigot teleport method but my server runs paper so

#

idk

peak depot
#

is creature spawn event only blocking agresive animals or also neutral

native nexus
wraith delta
#

Whats the alternative to velocity.lengthSquared() > 0.01 because that seems to only check the Y, not walking.

#

such as when i walk nothing happens but if i jump it activates

eternal oxide
#

You have no x/z velocity when walking

wraith delta
#

Is there a way to check if moving without the player move event?

#

im checking every tick instead

eternal oxide
#

track last against current location in that tick

wraith delta
#

yikes tho, its per player, wish it were a single method

#

theres getWalkSpeed(), dont know if its the actual moving value

eternal oxide
#

no

#

its the speed you will walk when you actually walk

wraith delta
#

yea nvm. darn

slender elbow
#

just use the event

#

if you early-return when the data you're interested in checking isn't there then it isn't a problem

#

e.g. check on block changes, ignore rotation only moves etc

young knoll
#

The game actually stores the last position for living entities

#

Idk if that also applies to players tho

#

(Also we don’t expose it πŸ‘€)

wraith delta
#

i decided to go with storing the location to a hashmap, i have a runnable already looping. i want to avoid playermoveevent for performance

slender elbow
#

it really isn't bad

#

simply listening to the event doesn't really change anything

#

it's whatever logic you run in it that matters

#

hence returning if no data of interest has changed

#

people just give it bad rep without even trying lol

wraith delta
#

right i have returns on the ones i use but in this case i do have to read from file and map each time for all players, while it does cache it still needs to update values often

slender elbow
#

that just sounds very wrong at first sight but idk your architecture so you do you I guess

wraith delta
#

it works fine. dont want to add a player move event

young knoll
#

The heck do you need to constantly read from a file for

wraith delta
young knoll
#

That’s not regular

#

And has nothing to do with the movement event

wraith delta
#

fair. but anyways id still rather avoid unnecessary events if possible due to lots of players and decent amount of plugins.

#

even if the event returns, i still am checking some sort of condition which id assume might take the tinniest bit of performance but it adds up

slender elbow
#

it really is not noticeable

timid berry
#

does this overwrite existing config with the default one?

summer scroll
#

I personally think if you don't read the file on the move events it should be okay.

timid berry
#

how can i set color via config file

#

ive tried things

remote swallow
#

first, dont use Β§ use & and use ChatColor.translateAlternateColorCodes('&', text)

timid berry
young knoll
#

Try quoting the text in the yml file

wraith delta
# timid berry

You have a mistake in the config, you added β€˜. Do what he said ^ add β€œ text β€œ

timid berry
#

i see

timid berry
summer scroll
#

What should I do to control player list of player's tablist? I wanted to hide players if they are not on the same arena of a minigame, or hide all players that are inside minigame arena for player that's in a lobby.

obtuse hedge
#

its just eating the Y

wraith delta
timid berry
#

@obtuse hedge I still appreciate the help gang

glass mauve
#

is there a way to get the plugins that depend on my plugin in their plugin.yml at runtime?

#

well I am only interested in the number of plugins

#

couldnt find an easy way

#

I guess I could query all plugins and use the PluginDescriptionFile#getDepend

#

but therefore I would need to use PluginManager#getPlugins and does this return all plugins in onEnable or only the ones that got enabled previously?

#
long count = Arrays.stream(pluginManager.getPlugins())
                .flatMap(plugin -> plugin.getDescription().getDepend().stream())
                .filter(s -> s.equalsIgnoreCase(name)).count()

this fine?

mortal vortex
#

Is there some library for making GUIs. I saw a Kotlin one

#

But anything in Java?

frigid depot
#

is it possible to get an external jar of spigot 1.20.6 to add to my eclipse project like i could with a 1.8 jar

sullen marlin
#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

pure dagger
#

if a class has other class as field, and its final (maybe final list) is it stateless?

quaint mantle
#

how do u get CraftServer

#

can u just cast BukkitServer to CraftServer?

drowsy helm
#
Class clazz1{
  final List<Clazz<?>>
}

?

pure dagger
#

no, Just list of anything as a field

drowsy helm
#

give an example

blazing ocean
sly topaz
#

if it has a mutable field, it inherently becomes stateful

#

this is because you're depending on state that might be outside of the class's control

shadow night
#

What's this whole statelessness thing, are we doing fp or what

sly topaz
#

I mean, it is good to know the difference

#

stateless is anything that depends on things outside of the current method/class's control to execute

#

having an immutable field doesn't make it stateful, or a deferred immutable field even. For this case though, List impl, might be mutable so that doesn't apply

pseudo hazel
sonic goblet
quaint mantle
#

ty

deft fossil
#

Hi,
While ramping up with plugin development, I started a very simple plugin creation template.
Do you have any idea of what can be improved to make it more useful ?

https://github.com/Jaalon/spigot_plugin_template

For the moment, there’s two things:

  • a docker image with spigot downloaded, built & deployed
  • a very simple plugin with a command and a listener

I see already want to check at this improvements:

  • migrate to an annotation based configuration
  • use standard built tools to generate the spigot jar (instead of buildtool)
peak depot
#

how can I prevent Items from going back into the players inv on InvClose Event

fair rock
#

Like you put something in, close -> Items back in your inventory

#

something like that?

peak depot
#

I got It already but I mean like if you have a sword and lapis in an enchater inv how to prevent the lapis from going back to the player too since its put in via plugin

#

and it was just getting the closing inv and removing the items

fair rock
#

Make sense ^ If theres nothing, you cant get items

rough drift
deft fossil
rough drift
deft fossil
#

Ok I see, so Iβ€―guess I won’t include that to the project. Maybe just explore it for personal curiosity but keep using buildtool for the template

sly topaz
#

it also has some other features such as downloading git and maven if not present, but that's about it

#

one thing you could do is use that docker image and make it a devcontainer instead

#

another suggestion would be to use JetbrainsRuntime distribution instead of Corretto's and add the -XX:EnhancedClassRedefinition flag for hotswapping

#

you might also use patrick-choe's mojang-spigot-remapper considering you already run build tools to get the spigot jar, might be good to run it with --remapped and use the remapped sources in case they may want to use NMS

deft fossil
#

Yes, I was going to talk about hotswapping, will have a look to jetbrainsRuntime. Using it, it will make a devcontainer more usuable in practice

proud badge
#

Unless the menu is vanilla (opened by clicking on a block)

#

Or should it? Idk. I forgot

slender elbow
#

well, it does for stuff like anvils and crafting tables etc

#

since they aren't containers

#

upon closing the items will return to your inventory

sly topaz
#

wouldn't these be dropped

#

or are we talking about the case where the event is cancelled, making it like they were never placed in the inventory to begin with

#

inventory close isn't cancellable though, now that I'm looking at it so that shouldn't be possible

slender elbow
#

they used to drop, now they just return to the inventory, unless you don't have space then they'll drop

sly topaz
#

oh that's cool, since I don't really play newer versions I haven't noticed the behavior change

rough drift
#

can you edit the drops in the death event

#

like just edit the list

chrome beacon
#

Not entirely sure if you can add stuff to it

#

Give it a try

eternal oxide
#

You can't add

rough drift
#

ty

#

though not being able to add is dum

eternal oxide
#

just dropNaturally

#

for any additional items

peak depot
#

whats the best way to check if a player is in area using the PlayerMoveEvent or somehow getting the entites in range relativ to the area

junior geyser
#

There is also a location.getNearbyEntities method

#

To get all entities in a range around a location

peak depot
#

yeah but what of those is more performant prob the nearbyentits if I trigger it ever 0,5 sec rather then when everybody is moving no?

simple sentinel
#

Hey guys, i wanted to add something to a plugin that i have on my server

#

Its a marriage plugin

#

The problem is that i only can kiss my partner using /kiss, but i wanted to used shift + right click to kiss too!

#

How can i do that?

#

I asked for help using some IA but it didn't work 😭

eternal night
#

Do you already have a plugin compiling? even if it doesn't work

eternal night
#

Well, given you are asking in help-development I presume you wanna add that functionality via a new plugin?

#

(or by editing the existing one I guess)

river oracle
eternal night
#

What

simple sentinel
eternal night
#

Is it open source?

river oracle
#

?services

undone axleBOT
simple sentinel
eternal night
#

Whats the name of the plugin πŸ˜…

simple sentinel
eternal night
#

A family plugin has like a full platform submodule setup xD the world is crazy

river oracle
#

fr exactly what I was thinking lol

worldly ingot
#

String getGender();

#

Thank goodness it's not a boolean

eternal night
#

We are progressive like that party

worldly ingot
#

lol

remote swallow
river oracle
#

where is the Data Driven Gender Registry facepalmz

worldly ingot
#

Yes that one plugin

#

I remember it fondly

remote swallow
#

is it still on spigot i dont remember

worldly ingot
#

Literally no clue what you're on about btw lol

remote swallow
#

the one where it had mental illness in it as something

#

some person that was a troll here ages ago made it

river oracle
#

Lex?

eternal oxide
#

Its starting to ring bells

worldly ingot
#

That totally sounds like a Lax plugin

river oracle
#

Lax*

#

that was who it was

simple sentinel
worldly ingot
shadow night
river oracle
remote swallow
worldly ingot
#

I miss Lax :(

shadow night
#

Who's lax

river oracle
#

was he banned or did he just drop off the face of the earth

remote swallow
worldly ingot
#

He just got bored I'd imagine lol

#

Other things in life than Minecraft

remote swallow
#

i swear he was banned from here

river oracle
#

true

river oracle
#

I think he was mainly active during the time while I didn't talk here much lol

#

sad time I wouldn't want to be missing

worldly ingot
#

He was an IRC man. Don't think he ever joined the Discord

river oracle
#

that makes more sense then

worldly ingot
#

We even used it on the Spigot test server for a while!

#

OH WE STILL DO

river oracle
#

lmfao

river oracle
#

the reviews on his gender plugin are hillarious

remote swallow
#

he was here

worldly ingot
#

Oh he was! Long while ago then

remote swallow
#

okay so choco

#

check the ban list, im pretty sure hes on it

worldly ingot
#

Oh he is banned aPES_Laugh Yeah, I mean that makes sense

river oracle
#

ahaha lol

#

been a while since we had a good troll, we just have people like Epic and he's like not even that funny sadcat

remote swallow
#

fr

buoyant viper
remote swallow
#

oh and we have neon

river oracle
#

He's not a troll though just like young

#

those are very different things smh

remote swallow
#

hes underage, so therefore needs to be banned πŸ‘

shadow night
river oracle
#

okay God I was going to say enum I'm glad someone else agrees with me

remote swallow
#

cant be hard coding genders

eternal oxide
#

What? You wouldn't let me invent a gender?!

river oracle
#

ENUM because its funny

shadow night
#

Okay, I'll use registry if you want it

river oracle
shadow night
#

Lol

remote swallow
#

enum
TRUE;

shadow night
#

"what's your gender?"
"Hmm, maybe"

eternal oxide
#

getGender() { return Random...

shadow night
#

Lol

#

Guys, I know

#

Make it a double

remote swallow
#

enum

#

0.01

#

0.02

shadow night
#

Lol

buoyant viper
#

lgbtq engineer be like

Ο€ = gender

shadow night
#

That one physics teacher: hmm, about 10 Ig

blazing ocean
#

"mixed"

river oracle
worldly ingot
#

Somebody wrote that unironically and still decided to use -1 as true

slender elbow
#

i mean

#

it's all 1s bits

#

but yes it's moronic lol

simple sentinel
#

Could someone help me? I'm trying to edit a plugin, but the changes that I made are not working and i wanted to identify whats wrong with it

young knoll
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

river oracle