#help-development

1 messages ยท Page 2118 of 1

eternal night
#

no worries, build tools are a learning experience anyway

brittle lily
rough drift
#

I get first block in EntityExplodeEvent#blockList(), I get the entity world EntityExplodeEvent#getEntity().getWorld() and I try to do world.setType(firstBlock.getLocation(), firstBlock.getType()), that does not seem to work, any idea as to why?

#

snippet:

brittle lily
rough drift
#
@EventHandler
public void on(EntityExplodeEvent event) {
  Block firstBlock = event.blockList().get(0);
  World world = event.getEntity().getWorld();
  // 1 tick later
  world.setType(firstBlock.getLocation(), firstBlock.getType());
}
#

What's wrong? (the comment implies that I used the scheduler, too lazy to type the actual scheduler method call)

eternal night
#

blocks do not represent a snapshot of the data

#

think of Block like just a location pretty much

#

any form of data you grab from it queries the world

rough drift
brittle lily
# eternal night go ahead

If I make 2 plugins, both of them work . But both don't work at the same time.Always Someone Error. Why?

eternal night
#

That is so specific, that would really depend on the error

rough drift
#

Why not provide Location

eternal night
#

OOP does not work that way ?

#

all the methods on Block do not fit on the location type

quiet ice
#

Locations can have null worlds

eternal night
#

simply by contract of the Location type

#

that too

#

block data is a snapshot. Take the blocks block data

#

and then set it back a tick later

quiet ice
#

plus, locations are floating point numbers, blocks are integer numbers

rough drift
#

I see

#

thanks

brittle lily
#

Thank You For All Helps. ๐Ÿ™‚

eternal night
#

Ah sweet ๐Ÿ™‚

smoky adder
#

hello I would like to know if with the use of pom.xml I could import the api of another version while maintaining version 1.8.8

eternal night
#

well coding against any api than 1.8.8 would break the compatibility with 1.8.8 (if you use newer methods) unless you actively check if the actual server version is high enough

smoky adder
#

would like to send a title to the player when it enters ... but it does not go with p.sendTitle nor with the packets ... I used the spigot guide

eternal night
#

I mean, if 1.8.8 did not have title support in the API then rip you

wary harness
#

I need suggestion trying to create bridhe egg like on bedwars I am not sure how to calculate it so it places 2 blocks path wide

#

current sutuation

#
    public void onProjectile(ProjectileLaunchEvent e) {

        Projectile pro = e.getEntity();

        int ymax = pro.getLocation().getBlockY()+5;
        int ymin = pro.getLocation().getBlockY()-5;
        if (pro instanceof Egg) {
            new BukkitRunnable() {

                @Override
                public void run() {

                    if (pro == null) {
                        cancel();
                        return;
                    }
                    Location loc = pro.getLocation();

                    if(loc.getBlockY() > ymax || loc.getBlockY() < ymin){
                        pro.remove();
                    }

                    loc.setY(loc.getY() - 2);
                    loc.getBlock().setType(Material.WOOL);
                    loc.subtract(-0.8, 0, 0.8);

                    loc.getBlock().setType(Material.WOOL);
                    //loc.add(0.5,0,0.5);


                }
            }.runTaskTimer(pl, 0, 1);



    }```
#

code which I got

#

any one has better approach

eternal night
#

I mean, you'd grab the velocity of the egg and then basically rotate it 90 degrees

#

after removing the y coordinate value

wary harness
#

this is what I get

wet breach
#

probably doesn't help you are using floats

smoky adder
wary harness
eternal night
#

I mean, you'd be able to get the block to the relative right and left ?

wet breach
#

the only issue I can see running into 2 block wide paths, is deciding on which side you want to create the path on

eternal night
#

isn't that what you want here ๐Ÿค”

wet breach
#

to get a 2 block wide path

#

you need to +1 and -1 to both x and z

#

technically gives you a 2x2 box/grid in doing that, which is what you are wanting

wary harness
wet breach
#

I don't see how that won't work if you know how to do min/max

wary harness
#

missing blocks

wet breach
#

not sure if you could get it perfect

#

not without some more advanced math

wary harness
wet breach
#

need min and max

wary harness
#

I am grabbing location

#

from projctile on every tick

wet breach
#

is there a particular reason you need to do it every tick?

wary harness
#

when u throw egg

eternal night
#

prg == null is also a not-good check

wet breach
#

it makes a path to where ever it lands right?

wary harness
eternal night
#

I am certain it does not

wet breach
#

where the check is at wouldn't catch the null in time

eternal night
#

it never becomes null anyway

#

you are not assigning that variable to null anywhere

#

intellij is already screaming at you

wet breach
#

it shouldn't but if for some reason it were to some how be null, the check is at a spot where null would already been thrown ๐Ÿ˜›

eternal night
#

Tru that ^^

#

tho I think the getEntity method is NotNull

wary harness
#

good ๐Ÿ™‚

eternal night
#

ye

wet breach
#

anyways, if you are making a bridge to where ever the egg lands

#

in relation to where it was thrown from

sage dragon
#

Anyone knows a good library which allows me to easily make paged guis?

I'm tired of doing it myself ๐Ÿ˜…
(I have to adjust my code to the use cases of every project)

wet breach
#

you don't need to get the location of the projectile every tick

#

as long as you have the starting location and the ending location, you could just simply use math to know all the coords in between ๐Ÿ™‚

wary harness
#

like on hypixel bedwars

#

if you have played

wet breach
#

nope haven't

#

I don't care about other servers and their stuff

eternal night
#

the sigma mindset ๐Ÿ™kappa

#

it does not

#

I was lied to

wet breach
#

lol

#

I love how its a hypixel fandom page

wet breach
#

and in the trivia says it is most likely a reference to the bedwars plugin on hypixel

#

anyways, as far as using starting and ending points, you can turn locations into vectors and do math that way to know how to draw the bridge

#

but I guess some people like having stuff doing something every tick unnecessarily

earnest forum
#

it's hypixel skyblock fandom

wet breach
#

technically from the projectile vectors you could know the end point ahead of time too

earnest forum
#

and bridge egg is from bedwars

#

that's funny

wary harness
#

players need to pay 1 emerald for every egg

#

so they will not spam it all the time and I think server can handel

#

one projectile

#

one a wild

wet breach
#

that is up to you to determine, just stating that you could save on resources by not doing it every tick was all

quaint mantle
#

is there a docs for mojang mapped

#

my NMS entities are all updated

ivory sleet
#

docs?

#

no not really

quaint mantle
#

documenation

#

o

#

ok

ivory sleet
#

Ig the closest thing you can get is javadocs and parchment

quaint mantle
#

does anyone have a guide for making nms pets in 1.18

ivory sleet
#

no but that ought to be simple

#

you derive a custom entity, inject it into the entity registry and change the goals and attributes of it

#

in principle

wet breach
#

but in application there is a lot more o.o

ivory sleet
#

depends on how far you're willing to go

wet breach
#

well, just stating what was implied ๐Ÿ˜›

ivory sleet
#

if it boils down to where explicit packet management is needed, then yeah

quaint mantle
#

๐Ÿ˜ญ

vast sapphire
#

So Iโ€™m not the best with networking, how would I run a web server on a Minecraft server but have it accessible to a public domain that the server is using

fallen thunder
#

Hello I make my personnel API and I look how to use my plugin API. So I implement my API in my gradle project (yes I use gralde ;D) I see I can use them: getServer().getServicesManager().getRegistration(RedisDatabase.class); to get a RegisteredServicePRovider<Object From My API> and if is not null I do rsp.getProvider(). Idk if it's a good solution. Now I want know if I need to compile my API in my Plugin ?

wet breach
#

you would literally be wasting or sacrificing resources from the MC server to instead server web content

#

when there is literally software designed to do this specific thing

vast sapphire
#

So if I do localhost:8080 it should be open if I port forward 8080?

wet breach
#

not sure what player data you refer to, but what you describe still doesn't make it necessary to sacrifice minecraft server resources to serve web content

vast sapphire
#

The server is pretty beefy, web servers arenโ€™t too much to run?

wet breach
#

not sure if you understand that the more the web content is requested by people the more time your mc server is going to take serving it, instead of actually doing other things that the mc server is supposed to be doing for the players actually playing ๐Ÿ™‚

#

but hey its your server, and your players will enjoy that lag ๐Ÿ˜‰

#

it will be fine for now, until something or someone comes along and then hits that webserver of yours to serve 1 million pages

vast sapphire
#

It would be a single page website

wet breach
#

and yes web servers don't take much, but that is for apache or nginx. A custom java webserver isn't going to come anywhere close to what those are optimized to do

vast sapphire
#

I could use spring boot, not sure about the optimization but Iโ€™ve worked with it

wet breach
#

but you never made a webserver from the ground up

vast sapphire
#

The only thing I did was create an http server

#

I could do only an http server

wet breach
#

so the answer is no you haven't and thus lack the technical knowledge or experience on certain things. Sure you can make an http server, anyone can, hell my tv could serve content to the internet if I wanted it to. That doesn't mean its going to be secure or optimal to do so. You seem to think otherwise, and after all it is your server. I can only just tell you it isn't wise ๐Ÿ™‚

vast sapphire
#

Thereโ€™s no need for security, Iโ€™ve recently got into networking and web server development by watching videos

wet breach
#

then you don't know networking

vast sapphire
#

Not yet

wet breach
#

have fun I guess with no security or the belief it isn't needed

#

but security isn't just about preventing people from being able to get to the back end

vast sapphire
#

Itโ€™s not like a user is creating an account on the website, what security would I need?

wet breach
#

it also means preventing your applications being used in unintended ways as well

#

security also means avoiding things such as if someones using your webserver

#

to prevent players from playing too ๐Ÿ™‚

#

all I have to do is make that simple web server of yours, server 2-5 million pages

#

and your players would all drop out

#

however something like apache or nginx would handle such things easily

#

even on a server with small resources

#

second, using apache or nginx or just a second application dedicated to web content, prevents the web content from directly affecting the MC server

#

But this is all part of security as there is different levels and types of security which most of the youtube videos won't necessarily tell you about. But if you are really serious in about getting into networking and all that, I recommend going through actual schooling for it

#

you would learn a lot more and benefit a lot more from such things and will in most cases learn proper practices and habits instead of potentially learning bad habits from those videos lol

vast sapphire
#

What are the best resources for learning about networking and security?

brittle lily
#

Hey Guys I'm Making Duel Command And I Have a Problem. Even If I dont get duel request, I write /accept Im teleporting to arena. How Can I set this for just duel rquests

earnest forum
#

check if the player has a duel request before teleporting them

wet breach
# vast sapphire What are the best resources for learning about networking and security?

nothing you will be able to find freely. I mean there is plenty of resources that is freely available like documentation and manuals what have you. Most youtube videos don't go over best practices or what you should or should not be used in certain scenarios. Also a lot of those videos don't go into great details of why something may be bad to do or good to do as well as talking about more technical stuff to get a better understanding. Yes the documentation is there, but it only tells you about the features of something and not necessarily the scenarios in which you might not want to use it. Same with the Manuals.

#

This is why if you are serious about it, I do recommend taking proper courses for such things.

brittle lily
earnest forum
#

well depends on how you are doing duels

#

do you wanna show us your commands?

brittle lily
earnest forum
#

well you have to create a request system

brittle lily
#

yeah but ฤฑ dont know how to

earnest forum
#

I guess a simple way

#

create a hashmap

#

of Player, Player type

brittle lily
#

okay

earnest forum
#

whenever the player sends a request you put the first value as the sender and then the second value as the reciever

#

and then in your accept command

#

check if the player who ran the command is inside the hashmap as a value

#

using #containsValue(obj)

brittle lily
#

Thanks but Everybody using # why I dont ever use this

#

on my commands

prime kraken
#

Hello i got some problems, I use spigot under 1.16.5 for my plugin, i was using NMS all worked, and after a crash of the server due to a bad commandLine, my NPC for example don't work, my animated tab don't work, I don't remember had touch anything in intellij, did you know where does can this from ?

earnest forum
#

because when you type in like Player.getName()

#

it looks like a static method but it is not

#

Player#getName() shows that it is a method for each individual object

#

but when you code you just use .

serene juniper
#

Hello,i'm making plugin for my server because i can't find any plugin that i want TextComponent name = new TextComponent("SERVER"); name.setColor(ChatColor.RED); name.setBold(true); TextComponent empty = new TextComponent("\n"); TextComponent welcome = new TextComponent("We wanna welcome you to our serve"); welcome.setColor(ChatColor.RED); welcome.setBold(true); TextComponent website = new TextComponent("WEBSITE "); website.setColor(ChatColor.GOLD); website.setBold(true); website.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder( "Click here").color(ChatColor.GOLD).create())); website.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://google.rs")); TextComponent store = new TextComponent("STORE "); store.setColor(ChatColor.YELLOW); store.setBold(true); store.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder( "Click here").color(ChatColor.GOLD).create())); store.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://google.rs/store")); TextComponent discord = new TextComponent("DISCORD"); discord.setColor(ChatColor.BLUE); discord.setBold(true); discord.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder( "Click here").color(ChatColor.GOLD).create())); discord.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://google.rs/discord")); player.spigot().sendMessage(name,empty, welcome,empty, website, store, discord); I wanna use this to be send in chat when player join and is work but problem is breakline

#

Can you explain me how to add breakline so First line
Second Line ...

earnest forum
#

send each one separatly

#

but right after each other

minor garnet
#

some1 know why i getting this nullexcep and being kick when i send that packet, i commented out most of code, and it doing a null check, but it ended up not helping much
https://paste.md-5.net/ezegopoqoq.cs

serene juniper
#

Like this?

#

yea that works and last thing how to center it ?

brittle lily
manic furnace
serene juniper
#

You know this to be in center of chat

#

like other plugins do

#

But is there any options to be automatic you know

#

because i can change chat size in minecraft

#

and is not gonna be centered ?

#

Btw:I see that on internet that's why i aks

#

how many spaces should i use

#

one sec

fallen thunder
#

Hello I make my personnel API and I look how to use my plugin API. So I implement my API in my gradle project (yes I use gralde ;D) I see I can use them: getServer().getServicesManager().getRegistration(RedisDatabase.class); to get a RegisteredServicePRovider<Object From My API> and if is not null I do rsp.getProvider(). Idk if it's a good solution. Now I want know if I need to compile my API in my Plugin ?

serene juniper
#

I want like this

fallen thunder
noble lantern
#

If your compiling it in, you initialize the entire lib yourself

serene juniper
#

I don't need to import other packages or ?

noble lantern
#

If its a running plugin, have a static getter for the instance, and on the other plugin soft-depend on it, and check if its enabled

kind hatch
# serene juniper I want like this

Centered chat is an illusion of sorts. There is no way to get the chat width of a user so everyone just uses the default chat width size to make centered chat messages. It has to be done with spaces

fallen thunder
noble lantern
fallen thunder
noble lantern
#

I personally reccomend ChatColor.translateAlternateChatCodes or whatever its name it

serene juniper
#

ou okay

#

Tnx

noble lantern
serene juniper
#

wait i don't get with that hahaha

noble lantern
#

and you can just use convert("&c hi");

#

the method returns a String

#

so you could

#

player.sendMessage(convert("&c hi"));

fallen thunder
noble lantern
#

and your set

#

it will let you use classes from your API, and compile it

#

but wont actually shade the files into your jar

#

instead, relying on the plugins instance on the server

fallen thunder
#

OK I see

fallen thunder
noble lantern
serene juniper
#

I'm confused xD

noble lantern
#

And from there

#

PluginManager#isPluginEnabled("yourPlugin");

#

and then you can just call YourPluginMainClass.INSTANCE

#

and get the running instance from your plugin like that

#

can make it a getter if you like getters more

#

getInstance()

noble lantern
#

its a static method

undone axleBOT
fallen thunder
noble lantern
#

so it doesnt really matter

#

DI cant be used for this

#

its a external plugins API

fallen thunder
noble lantern
#

so you could just use AsiluxAPI.INSTANCE

#

and it gets the instance of your api

fallen thunder
#

Ok so I can

#

Ohhhhhhhhhhhhh

noble lantern
#

make getters for all your things youll need ofc

fallen thunder
#

Ok I see

noble lantern
#

all good, if it was di 100%

serene juniper
noble lantern
serene juniper
#

and this gonna work then

fallen thunder
serene juniper
#

I mean i don't need to edit anything in my code instead jst add your code you send

noble lantern
#

only INSTANCE

fallen thunder
#

ah the getter for another variable

noble lantern
#

eg BurchAPI.INSTANCE.getMyManagerHere()

fallen thunder
#

like getEconomy

noble lantern
#

yes

noble lantern
#

so eg

fallen thunder
#

okok np Thx bro I was lost ๐Ÿ˜ญ

noble lantern
#

new TextComponent(convert("&c myString));

noble lantern
serene juniper
#

At everyline and i can use color codes

noble lantern
#

that way you dont ever have to worry about them

serene juniper
#

ou okay

noble lantern
#

Its finally finished lets go

#

i like to make mean debug messages for myself

#

idk why

#

force of habit

hybrid spoke
#

dont we all do that

lavish hemlock
#

you're*

#

My debug messages are usually some dumb shit like

#

Paenis or FUCK

#

So y'know

noble lantern
#

I wonder when ill accidentally put a debug message on production

lavish hemlock
#

I get really happy when I see penises on my screen

small current
noble lantern
#

hasnt happened yet

#

LMAO

hybrid spoke
#

its always selfies of me so i get happy if it reachs the debug message

noble lantern
#

or the message happens

#

and your 10x more confused

#

thats probably the scariest part

serene juniper
#

How to display server online member?

        TextComponent welcome = new TextComponent(convert("                      &cWe wanna welcome you to our serve                      "));
golden kelp
#

The count?

serene juniper
#

yes

golden kelp
#

Just get all the online players and find it's size

#

Bukkit#getOnlinePlayers smth

serene juniper
#

hm,is there option to implement placeholder xD

golden kelp
#

And the get the size of that list

serene juniper
#

Is easier with that

golden kelp
#

It's not hard at all

#

Just calling one method

serene juniper
#

I mean to add placeholder so i can use %server_tps% %server_online% you know...

sterile grotto
golden kelp
#

Shorten the link

golden kelp
#

Just add those in the string and then #replace()

serene juniper
#

ou okay

noble lantern
#

and you can add it into your convert method i gave you too

#

PlaceholderAPI.setPlaceholders(aPlayer, aString); after you import it

serene juniper
#

yes i want that xD

#

i,m watching video about that so basiclly i need to add api in pom.xml

solid jungle
serene juniper
#

Then import it and and i can use placeholder like %player_name% ?

#

or?

noble lantern
solid jungle
noble lantern
#

also you can modify your convert() code to this, might want to check if PlaceholderAPI is enabled first ofc tho

golden kelp
#

Supported

noble lantern
# serene juniper What that do xD

First argument is the text you want translated

Second argument is a nullable Player

if checks if player is null, if the player is not null apply PlaceholderAPI placeholder

Last string colors the string with & color codes

#

If you dont have a player

solid jungle
noble lantern
#

you can just pass null

#

you could even make that convert() method more advanced

#

and remove placeholders that get left over (IE ones that dont get parsed)

sterile grotto
serene juniper
#

Because i,m not making public plugin i,m making is just for my self to dispaly welcome message xD

noble lantern
#

Placeholders from PlaceholderAPI need a player to parse against

#

if theres no player available, you cant parse (to my knowledge)

serene juniper
#

ou okay

#

tnx

solid jungle
#

not third party plugins

#

i forgot to mention that

sterile grotto
noble lantern
#

ranking systems can be really complex sometimes

#

a lot of stuff to handle

sterile grotto
#

it depends on what kind of system you wanna make

noble lantern
#

Using LuckPermsAPI its simple asf, but from scratch oh god

solid jungle
noble lantern
solid jungle
#

?

noble lantern
#

If you want to make plugins you cant sprint into it, you have to learn to walk first

noble lantern
sterile grotto
noble lantern
#

oh

#

what now

#

okay nvm then

#

didnt even know scoreboards had that feature

#

always thought it was invis armor stands or editing player nametags through packets

solid jungle
sterile grotto
serene juniper
#

@noble lanternsry for ping but i have problem i add part things that is needed to pom.xml

#

And String playername = PlaceHolderAPI.setPlaceHolders(player, "%player_name%");

#

this is not work because PlaceHolderAPI Is not imported but

#
import me.clip.placeholderapi.PlaceholderAPI;
#

clip is red

serene juniper
#
        <repository>
            <id>spigotmc-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/groups/public/</url>
        </repository>
        <repository>
            <id>placeholderapi</id>
            <url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.18.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>me.clip</groupId>
            <artifactId>placeholderapi</artifactId>
            <version>2.11.1</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>```
solid jungle
noble lantern
serene juniper
#

because in video he don't reload it

#

how to reload it

noble lantern
#

that button there

#

or

serene juniper
#

u

noble lantern
serene juniper
#

i do that now

noble lantern
#

both work

sterile grotto
serene juniper
noble lantern
serene juniper
#

tnx

sterile grotto
#

if it don't have this method in this version, then using reflection to change field is in the consideration

sterile grotto
solid jungle
serene juniper
#

and last thing TextComponent welcome = new TextComponent(convert(" &cWe wanna --- you to our serve ")); i wanna use this string

sterile grotto
#

if you do, then hold Ctrl then left click method or object to check it's source code

serene juniper
#

can i add like in javascript ${} or i need to do like 'we wanna' + playername 'to your ....'

rough drift
#

How can you get every class inside the .jar of a plugin that is using your lib?

sterile grotto
# solid jungle oh k thank you

how long have you been code in java, if you never do, I recommend you to learn some basic skills of coding then back to plugin writing

noble lantern
solid jungle
sterile grotto
solid jungle
noble lantern
#

got you

#

its COMPLICATED asf

rough drift
#

I believe that if I put the code in the lib it will just read its own

noble lantern
#

but i have a small written lib for it

rough drift
#

I have done it before, just need to figure out if it will read the lib's classes or the plugin's classes

final monolith
#

Any help?

noble lantern
#

is this ONLY searched for classes extending another class

#

but removing that is rather simple

noble lantern
#

What objects's class are you getting

rough drift
#

I just need to scan an entire package

#

thats really it tbh

noble lantern
#

you can just Object.getClass().getPackage()

#

So like

#

OtherPlugin.INSTANCE.getClass().getPackage()

#

and it gets that package

rough drift
#

ohk

#

perfec

#

I'll just do it until i am at the very top package

noble lantern
#

typically where main class is is fine

rough drift
#

good point

noble lantern
#

if they have classes outside theyre main class's package

#

thats all on them

sterile grotto
rough drift
#

I'll be the only one using this

#

so its fineeeee

noble lantern
#

even better

rough drift
#

like tbf I just made my core how I like to code

#

because I'll be using it

solid jungle
rough drift
#

if someone wants to commit, just learn how to use it

noble lantern
#

i have to make my lib appeal to others

#

so far

#

i think it appeals nicely

rough drift
#

OmniLib seems to be too bukkit like for some

#

I don't get that lmao

noble lantern
#

BurchAPI supremacy

#

those docs are only 50% of features of it too so far, lots of stuff is undocumented

solid jungle
noble lantern
#

because its simple to use

rough drift
#

I just put OmniLib every now and again in convos

#

it has some useful stuff, just gotta finnish it

noble lantern
#

i make sure to mention mine once a day in here

#

strategy is effective

solid jungle
#

Noice

rough drift
#

neat

solid jungle
#

Big Brain Strategy

#

mentioning your own project in the dev channel atleast once a day

#

Lmao

noble lantern
#

typically because it has some useful things in it for plugin dev

serene juniper
#

@noble lanterncan you come dm ๐Ÿ™‚ please

ivory sleet
noble lantern
#

I need to add MySQL support first preferably

#

package is a mess but meh

ivory sleet
#

ye

#

epic

rough drift
#

@noble lantern I am dum

#

I got classes

#

how do i register it now lmao

brave goblet
#

How can i read from a text file in the plugin folder?

noble lantern
rough drift
#

?

sterile grotto
sterile grotto
brave goblet
noble lantern
#

you need to invoke its constructor

brave goblet
#

i tried this

sterile grotto
rough drift
noble lantern
#

eg Class.getDeclaredConstructor().newInstance()

constructor may throw error if the only constructor that exists has an argument

rough drift
#

yeah

#

ik

brave goblet
#
 try {

            Scanner scanner = new Scanner(new File("tokens.txt"));
            while (scanner.hasNext()) {
                smellytoken = scanner.nextLine();
                rosstoken = scanner.nextLine();
            }
            scanner.close();
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        }
sterile grotto
brave goblet
#

why do i need that?

modern pumice
#

Hi i have this code, but its sends the message 2 times and how can i get the Honeylevel of a beehive:

    @EventHandler
    public void onInteract(PlayerInteractEvent e){
        Player p = e.getPlayer();
        Block block = e.getClickedBlock();

        if(p.hasPermission("basic.hivechecker")){
            if(e.getAction().isRightClick()){
                if(block != null){
                    if(block.getState() instanceof Beehive beehive){
                        int beeCount = beehive.getEntityCount();
                        int maxBees = beehive.getMaxEntities();

                        p.sendMessage("There are "+ beeCount +"/"+ maxBees + " Bees in the Hive!");
                        
                    }
                }
            }
        }
    }
brave goblet
#

the issue is that it's not finding the file

sterile grotto
#

can't find

#

which path you are using

brave goblet
noble lantern
#

try getBlockData() if thats your issue

brave goblet
noble lantern
#

instead of getState

serene juniper
#

@noble lantern why is this happening

sterile grotto
#

like you are using absolute path

noble lantern
#

its convert(string, player)

#

or

serene juniper
#

ouu

brave goblet
noble lantern
#

if you dont have a player you can make second argument null

serene juniper
#

you mean jut set null ?

brave goblet
#

it will be on a host and how will i know the absolute path then?

serene juniper
noble lantern
brave goblet
#

cause on my pc it would be easy

sterile grotto
noble lantern
brave goblet
#

i am just using the file name

serene juniper
#

then what to change

#

I,m dumb

noble lantern
# serene juniper

you just pass your player variable as the second argument to convert()

#

convert("MyString", aPlayer);

serene juniper
#

ou

#

so

#

wait

#

here ?

noble lantern
#

yep, it gets passed as the second argument of that method

serene juniper
#

I need to add Player in every end ?

#

like

brave goblet
serene juniper
#

like this?

sterile grotto
serene juniper
#

i,m dumb now so much

noble lantern
# serene juniper

I reccomend getting more acquitted with java, Player is the actual player object, while player is the variable you declared one line above

green prism
#

Guys I've a question for you that is a little bit strange... Do you think that I need/have to obfuscate a plugin code before sell it or not?
Because I don't want buyers to resell my plugin by only changing the pl description author's name

what do you think about?

modern pumice
serene juniper
#

so is not important

brave goblet
#

ah i see i think

noble lantern
sterile grotto
#

no, use this object to create another file object which located to your file

noble lantern
#

check if right click was on main hand

brave goblet
#

so basically File file = this.getDataFolder()?

brave goblet
#

right ok got that

sterile grotto
#

then you can do like File textFile = new File(file,"/$YOURTEXTFILENAMEORPATH");

brave goblet
#

ah right got it

#

ty sm!

queen niche
#
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "org.bukkit.Server.getPluginCommand(String)" is null

I keep getting this error after updating my plugin from 1.17 to 1.18.

My plugin.yml is fully configured.

main:


getServer().getPluginCommand("dcping").setExecutor(new dcping());
getServer().getPluginCommand("attractie").setExecutor(new attractie());
getServer().getPluginCommand("plugins").setExecutor(new plugin());

plugin.yml:

commands:
  dcping:
    description: Ping de plugin om te zien of er een connectie is.
    usage: /<command>
    permission-message: Je hebt geen permissies!
  attractie:
    description: announce dat een attractie open gaat.
    usage: /<command> [warp] [attractie-naam]
    permission-message: Je hebt geen permissies!
  plugins:
    description: Bekijk onze Plugins.
    permission: dcr.plugin
    permission-message: Je hebt geen permissies!
    usage: /<command>

permissions:
  dcr.plugin:
    description: Permissie voor plugin lijst.
    default: false
ivory sleet
#

use getCommand()

noble lantern
#

^

queen niche
#

okay thanks

noble lantern
#

or even better

#

inject a BukkitCommand into the CommandMap

ivory sleet
#

:/

noble lantern
#

runtime registration supremecy

ivory sleet
#

I mean using JavaPlugin::getCommand PluginCommand::setExecutor is technically happening during runtime as well

#

but ye

#

well

#

Ig it might be more flexible

noble lantern
#

only thing it really provides is allowing of dynamic commands during runtime

torn crescent
#

Hey, does anybdy know how to speed up the macros in IntelliJ?

noble lantern
#

no need to set in config.yml, thats really the only upside of it

ivory sleet
#

plugin.yml?

noble lantern
#

oop

#

yeah

#

that

ivory sleet
#

yeah well you have annotation processors if thats what annoys you

#

but guess thats effort

noble lantern
noble lantern
sterile grotto
noble lantern
#

new ApiCommand() and use BurchAPI.registerCommand("string", command);

ivory sleet
#

well annotation processing allows you to generate the plugin yml

noble lantern
#

but

#

work

#

yaml config api

#

waaah

#

wait could you even edit a yaml resource inside a jar file

#

i would assume that would corrupt it somehow

green prism
#

@noble lantern have u any Idea to optimize my plug-in?

#

I can't find anything on internettt

noble lantern
#

i mean i do, but i dont wanna go thorugh 500 lines of code

#

if its a method sure throw it at me

brave goblet
#

wait why when in inteliij it writes directories as / but in console it outputs as \

brave goblet
#

eg folder/file but in console it's folder\file

noble lantern
#

^

brave goblet
river oracle
#

That's why

native elbow
#

is there a way to use mojang mappings with gradle?

brave goblet
#

oh right

noble lantern
sterile grotto
river oracle
#

Windows is trying to be quirky

brave goblet
noble lantern
#

youd have to convert that maven plugin into gradle

#

and i dont think no ones done it yet

sterile grotto
brave goblet
noble lantern
brave goblet
#

also i got it to work :D! ty for ur support

noble lantern
#

i do my main pluginon maven, but any plugins i make with it are done in gradle

noble lantern
#

give intellij more ram

#

should be chillin

#

by default poor thing barely gets 1gb

noble lantern
sterile grotto
#

intellij almost use all of my RAM

modern pumice
noble lantern
#

i really love how easy external jar for dependencies is in gradle

ivory sleet
#

yup gradle is awesome

noble lantern
#

if i did that in maven

#

it would take me many minutes and brain power typing the install command

#

for every jar

ivory sleet
#

indeed

noble lantern
native elbow
#

but why isnt it possible to remap the jar using gradle

ivory sleet
#

it is

sterile grotto
native elbow
#

but how

noble lantern
#

^ you just have to convert the plugin

ivory sleet
#

well if you wanna map with mojang mappings there's paperweight userdev

#

gradle plugin

torn crescent
noble lantern
#

i never used intellij macros tbf

#

if i record something i use OBS

grim ice
#

OBS is good for better gpus

#

if u have an awesome cpu but not a really good gpu

#

u can use bandicam

#

that might seem like a weird option

#

but its viable

modern pumice
noble lantern
#

OBS has an option for software encoding for cpus

#

hardware encoding for gpus

#

or visa versa, cant remember

grim ice
#

Still

echo basalt
#

event.getHand() == HAND

modern pumice
serene juniper
#

member don't recieve message

crimson terrace
echo basalt
#

doesn't seem like you annotated it with @eventhandler

serene juniper
quaint mantle
#

delay by a couple ticks

crimson terrace
#

Bukkit scheduler

noble lantern
#

i dont see a eventhandler annotation

serene juniper
#

this?

noble lantern
#

you send send message to a player on theyre join event, no need to delay it

crimson terrace
#

you have to put @ EventHandler above the method

noble lantern
#

theyre already logged in an in the server by that event

#

^

serene juniper
crimson terrace
#

and register them to your plugin manager

serene juniper
#

hm sec

#

i think everythign i set

next zinc
#

Anyone know any good/easy ways to make cool particles in 1.18?

noble lantern
next zinc
#

I know it requires trig and stuff, but I just want to know if there are any other ways to do it potentially

echo basalt
serene juniper
noble lantern
#

you need to call this.getServer().getPluginManager().registerEvents(Listener, Plugin)

#

in your onEnable

next zinc
#

my weakest subject

#

but thanks for response

noble lantern
#

you could yoink code from open source stuff too

crimson terrace
#

for Listener you can probably use 'this' when registering the listener, as long as it isnt in a different class than the onEnable

serene juniper
#

i fixed tnx

crimson terrace
#

np ๐Ÿ™‚

hasty tartan
#

how to display this "[<count>]" text for my own command?

noble lantern
tall basin
quaint mantle
#

It's a brigadier thing yeah

serene juniper
#

Guys i first thing i fixed it but is not

quaint mantle
#

you could use the tabcompleter but it would have the side effect of being able to tab complete the count text

noble lantern
#

not a new Listener

#

eg this because your Listener is your main class

serene juniper
#

ou

#

getServer().getPluginManager().registerEvents(this, this);

#

this?

noble lantern
#

yes

smoky oak
#

does switch(null) err or fall to default:

noble lantern
#

falls to default

#

or null if you have an argument for it (if thats a thing cant remember)

smoky oak
#

nah its because i am working with default values

#

ie no entry in config, use default

noble lantern
#

you can just nullcheck before tbf

#

i dont like ide warnings

#

null check almost everything i can xd

smoky oak
#

switch(cfgSection.getString("target","compass"))

#

is that faster or slower than if you leave out the default value

noble lantern
#

doesnt matter its only in memory

#

until you save() it

smoky oak
#

which i dont

noble lantern
#

speed is not noticable, its just editing values in ram doing that

#

would take .00000001ms to execute that (exageration)

modern pumice
#
Bukkit.getPluginManager().registerEvents(new Listener() , this)
noble lantern
#

?

smoky oak
#

same issue other guy

noble lantern
noble lantern
smoky oak
#

worlds can't have the same name correct? So World#getName is a unique identifier?

serene juniper
smoky oak
#

also is it faster to call equals on getWorld or on getWorld.getName()

smoky oak
noble lantern
#

you had it there earlier

serene juniper
#

oou

#

i fixed

#

Tnx

#

I think thats not important hahaha

modern pumice
#

is the Listener in the main class?

smoky oak
#

can but doesnt need to be

#

if your plugin isonly that listener you should have it there

noble lantern
smoky oak
#

otherwise no

quaint mantle
# serene juniper

Instead of the first this use the instance of your JoinMessage class

serene juniper
#

i fixed i think

noble lantern
#

he doesnt have an instance

#

its just the one class

#

no di/static getter

#

sadness

quaint mantle
#

His listener is not in the main class though from what I understand

noble lantern
#

he removed implements Listener for some reason

#

he had it there earlier

#

his events in his main class

smoky oak
#

worlds can't have the same name correct? So World#getName is a unique identifier, and, if yes, is it faster to call equals on getWorld or on getWorld.getName()

noble lantern
#

but name checks are fine

smoky oak
#

k

#

i want to know if two locations are in the same world

noble lantern
#

yeah you can just compare name/uuid

#

i prefer UUID for simplicity and also the fact it doesn't change

smoky oak
#

oh good idea

#

also

#

is if(a){if(b){}} slower than if(a&&b){} ?

#

it would be more readable in the first format

noble lantern
#

speed is the same, but && for better readability

smoky oak
#

u sure? if(effectSection.getBoolean("dimension_restricted",true)&&targetLocation.getWorld().getName().equals(lodeLocation.getWorld().getName()))

noble lantern
#

yes its also good for null checks

#

if (thing != null && thing.get() = Thing.That) {}

smoky oak
#

the above code only gets called if lode exists and sets the target location to lode if it doesnt exist

#

so null check isnt necessary here

#

*the code above that

noble lantern
#

tbf i really wouldnt worry about performance for simple if statements

smoky oak
#

hah

#

true

noble lantern
#

its more or less for others readbability

#

its easier to read a block than a stairway of hell

smoky oak
#

idk it seems more readable to do it in steps here

noble lantern
#

if () {
if () {
if () {
if() {
}
}
}
}

#

stuff like thats normally rly hard to maintain and read

noble lantern
#

i always fucking think that when i see code like that

crimson terrace
#

thats code only a mother could love

lavish hemlock
#

lies

#

that mother would abandon that code on a doorstep

#

and then the owner of that house would abandon that code again

smoky oak
#

well my code atm looks a lot like this

if(a){ //use condition?
  if(!b){ //condition
    //cancel
  }
}
noble lantern
#

and if (variable)

#

boolean bool = a && !b;

if (bool)

crimson terrace
noble lantern
crimson terrace
noble lantern
#

since its named

smoky oak
#

again that'd look like this

if(effectSection.getBoolean("dimension_restricted",true)&&targetLocation.getWorld().getName().equals(lodeLocation.getWorld().getName()))

instead of like this

if(effectSection.getBoolean("dimension_restricted",true)){
  if(! targetLocation.getWorld().getName().equals(lodeLocation.getWorld().getName())){
  //cancel
  }
}
noble lantern
crimson terrace
#

welp, back to refactoring

noble lantern
#

eg like this

#

makes things more readable instead of everything on one line

#

zack the menace

#

in all honesty though moterius

#

do what fits your style

#

just no street fighter/stairway codes

smoky oak
#

welp you might be able to avoid staircases if you write code yourself

#

but not if you work in programming

noble lantern
#

wym?

#

exact reason why i dont use more than 2ifs, i always fuck up my brackets and end up with 400 compilation errors lmfao

smoky oak
#

jave code has the annoying ability to very quickly have far too many args and checks

noble lantern
#

all java is is just bloat code

#

barely any of it is actual logic

crimson terrace
#

I try to keep my classes smol so I dont crash my IDE creating errors while moving brackets

smoky oak
#

also it irritates me to no end that that gif above is low res

#

i can see that its if statements but i cant fucking read them

noble lantern
#

my largest class in this project is 290 lines xD

crimson terrace
#

thats really small, depending on the size of the project

quiet ice
smoky oak
#

howd you scan that

noble lantern
noble lantern
#

OOP-ify that shit

quiet ice
#

I prefer performance over useless OOP

crimson terrace
noble lantern
#

performance is negligable

noble lantern
quiet ice
#

The whole reason I wrote my own remapper is because tiny-remapper is slow AF. I highly prefer 200ms of runtime over 5s

noble lantern
noble lantern
quiet ice
#

The fact that it is monolithic is just a side-effect.

noble lantern
#

thought it was like the 1k line long event handler

quiet ice
#

I almost exclusively work with ASM

#

Oh, I have a Util class that might be that long

smoky oak
#

seriously? people code in asm still?

noble lantern
#

yeah util classes get long asf sometimes

#

my longest class in that screenshot is actually a util class

smoky oak
#

youre either a hacker or work on some really weird os

quiet ice
#

In java space ASM is almost always OW2 ASM

noble lantern
#

Just make your own asm ez

quiet ice
#

Or just java bytecode in general

noble lantern
#

i cant stand 20mb dependencies

#

i legit learned a bunch new shit just to get rid of Reflections 1mb file size

smoky oak
#

uh wheres the marketplace again

quiet ice
noble lantern
#

yeah database libs are a killer for jar size

#

cant wait till i add mongodb and mysql support for this lib

#

15mb jarfile when

#

its more or less on the users end for file size

#

if you use an api thats 15mb in size but it only does a few things it just looks fishy

#

oh xd

quiet ice
#

Anyways, does anyone know the correct syntax for List<? extends Enum<?> implements MyInterface> or something like that?

#

that is if it exists

noble lantern
quiet ice
#

Whatever, I need to chain two conditions

noble lantern
#

so just look for a List<? extends MyInterface>

#

or check for first enum first then MyInterface

quiet ice
#

Yes, but it also needs to extend the enum

quaint mantle
#

you can chain with &

noble lantern
#

wait

#

deadass

quaint mantle
#

Enum & MyInterface

noble lantern
#

naw

quaint mantle
#

Yeah

noble lantern
#

your lying

quaint mantle
#

Nope

noble lantern
#

imma check

crimson terrace
#

I thought it was with a comma but & also makes sense

quiet ice
#

The Eclipse compiler does not seem to like it

quiet ice
#

But let's see how javac reacts to it

noble lantern
#

it no like for me either

ivory sleet
#

generic types are intersectionable, not wildcards tho

#

<T extends BaseClass & Interface> works whils <? extends BaseClass & Interface> wouldnt

crimson terrace
#

gonna have to define a generic type in the method declaration or so

noble lantern
#

or an entire generic class to handle those methods

ivory sleet
#

ye type erasure at its finest

quaint mantle
#

Oh didn't know it doesn't work with wildcards

ivory sleet
crimson terrace
quiet ice
#

Yeah I guess I'd need to create a sperate class to make this intersection possible

lavish hemlock
#

ah

#

good ol' intersection types

noble lantern
#

thanks discord

#

wasnt offending anyone in anyway

smoky oak
#

wait did you post this in this server?

quiet ice
#

think of the children though

noble lantern
#

yes

#

maaan

#

i dont like children

smoky oak
#

why can i swear perfectly fine though

lavish hemlock
noble lantern
#

i guess the r word got added recently

#

fuck shit

#

nope can still swear

quiet ice
#

Let's wait until programming languages are added to it

noble lantern
#

im not old im barely 21 yet

smoky oak
#

honestly if a child is coding they know what they're getting themselves into

noble lantern
#

LMAO

lavish hemlock
noble lantern
smoky oak
#

i meant the language

lavish hemlock
#

the "R slur" is purely a subjective concept :p

quiet ice
#

99% of underage beginner people on here do not know what they are getting into

smoky oak
#

well the real question is how they decide that

lavish hemlock
#

and it's about as powerful as the word "idiot"

#

which

#

I can still say

#

lmao

quiet ice
#

dumfuck

smoky oak
#

i had the exact same thought maow

noble lantern
#

i remember my first time i started coding

#

and someone sent me javadocs

smoky oak
noble lantern
#

and i was so mad, was literally malding

#

had no idea how to use them

lavish hemlock
#

well the N word has no like, non-slur parallel

quiet ice
noble lantern
#

shitfaced

#

haha

#

evading

lavish hemlock
#

see while R and idiot are synonyms

#

there's no N and <x>

quaint mantle
#

There most certainly is?

lavish hemlock
#

every other synonym is also treated as strongly as the N word

quiet ice
lavish hemlock
#

Well my point is there's no way to discriminate against black people specifically with kindergarten-level insults

#

That's not my point though?

#

Like sure you have the Latin word for black

#

Or the country Niger

#

But they don't fucking count bc they're literally harmless

#

And why do you have to be so ad hominem too?

#

I didn't talk shit about you so why do you have to strut in and be all

#

"Are you dumb?"

#

Like

smoky oak
lavish hemlock
#

Chill the fuck out, dude.

smoky oak
#

the art of evasion indeed

#

โ€‹ ๐Ÿ˜›

warm saddle
#

heyo any ideas on how I would make a 60 second countdown on a scoreboard?

crimson terrace
#

runTaskTimer() would be a good start

#

if you run it every second you could update the timer every time it runs

smoky oak
#

effectSection.getInt("maximumRange",256) * effectSection.getInt("maximumRange",256) or
Math.pow(effectSection.getInt("maximumRange",256),2)?

serene juniper
#
        config.setup();
        config.get().addDefault("Version", "1.0.0");
        config.get().addDefault("Message:", "- ");
        config.get().options().copyDefaults(true);
        config.save();``` 
Can you explain me,i'm wanna make config file so i don't need anytime to debug plugin,just to reload plugin to server.So i wanna make config where messages are.
How to add Multiple messages you know like
```messages: 
    - 'HI', 'Click me', 'https://google.rs'
    - 'Second messages'```
So i can add infinity messages? with hover support and click event,so if i don't set like in first line is just default
quiet ice
#

I'd generally use a library such as Minimessage there

#

Although I never used it myself, I always used MineDown there

smoky oak
#

if i check a block in a not-generated chunk, what happens? Does it
a) return the block that would generate there
b) a, but saves the chunk
c) fail
?

quiet ice
#

a is unlikely to occur, b is likely to occur, c could occur

smoky oak
#

is there some way to check if that chunk has been generated yet? I could only find isLoaded in the docs

quiet ice
#

?jd-s

undone axleBOT
ancient plank
#

hehe

quiet ice
smoky oak
#

to be fair i try to find it myself before asking for help

trail pilot
#

how i can get server player online of an other server?

smoky oak
#

that was just isGenerated(coordX<<4,coordZ<<4) right?

quiet ice
#

2^4 should be 16

smoky oak
#

wait does << divide or multiply by 2^n ?

quiet ice
#

It shifts the bits to the left

#

So probably not what you want to do

smoky oak
#

i see that you answered my forming question by correcting yourself

quiet ice
#

I do not know how often I mix up left and right

smoky oak
#

it is thanks

quiet ice
#

Either way, it's in the direction the arrows are pointing to

#

Beware that there is a difference between the arithmetic shift right and the logical shift right

smoky oak
#

was the arithemic and >>> logic correct?

quiet ice
#

I'd assume so

grim ice
#

e@lavish hemlock

#

Where

#

r u

#

did he leave

river oracle
#

rip maow :(

grim ice
#

I just looked through

#

What did maow do wrong

#

what he said wasnt wrong

river oracle
#

oh did he get banned maybe

grim ice
#

There is no way to discriminate against black people in a nice way, it'll be racism eitherway

#

I dont see why he was called wrong

#

@ancient plank

#

Can you check if Maow is banned

dark arrow
#

is there any way to code spigot plugins in py?

grim ice
#

don't

smoky oak
#

yea dont

river oracle
compact haven
#

yeah itโ€™s not possible

grim ice
#

You will receive absolutely 0 support