#help-development

1 messages · Page 1370 of 1

sharp bough
#

i really dont know

quaint mantle
#

getItemInMainHand().getType()

weary geyser
#

You're comparing an ItemStack to a Material

quaint mantle
#

you are comparing itemstack to material

#

we've all done it dont stress

sharp bough
#

ah

#

thanks

quaint mantle
#

he was joking

eternal oxide
#

lol

quiet ice
#

Just ignore that that solution is overkill

dusty herald
#

omg please don't

quiet ice
#

For you can use == instead of #equals()

dusty herald
#

I will smack u

weary geyser
#

Jochyoua what have you done 🤦‍♂️

dusty herald
#

it works to an extent ig

quiet ice
#

I mean, it works

weary geyser
#

No shit

quiet ice
#

Can't complain

eternal oxide
#

I would laugh if he's gone and @dusty herald just started a new terrible coding trend.

dusty herald
sharp bough
#

another question, since we are all talking about the same thing here, why does it happen twice when i right click a block and not the air?

#

like it runs twice

weary geyser
#

yo

#

change your code

#

pls

eternal oxide
#

each hand

dusty herald
#
Bukkit.getScheduler().runTaskAsynchronously(()->{
Thread.sleep(Integer.MAX_VALUE);
});```
quaint mantle
#

@dusty herald the tag works 😔

dusty herald
#

<3

quaint mantle
#

messup in the code

sharp bough
#

that looks like something i would add

dusty herald
#

a timer for ever

sharp bough
#

and hope it works

#

lmao

dusty herald
#

it does

weary geyser
#

no

#

or yes

#

it does

quaint mantle
#
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.Directional;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;

public class EventListenerTesting implements Listener {
    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent e) {
        Block block = e.getClickedBlock();
        if (block == null || block.getType() != Material.OAK_BUTTON) return;

        Directional button = (Directional) block.getBlockData();
        BlockFace face = button.getFacing().getOppositeFace();
        Block otherWallSide = block.getRelative(face).getRelative(face);

        if (otherWallSide.getType() == Material.AIR) {
            e.getPlayer().teleport(otherWallSide.getLocation());
        }
    }
}
weary geyser
#

but

dusty herald
#

won't hault main thread either

weary geyser
#

don't use t

#

*it

quaint mantle
#

cpu stresser

weary geyser
#

lmfao

#

home made

dusty herald
#

Run this on the main thread:

#
  try {
            Thread.sleep(Long.MAX_VALUE);
        } catch (InterruptedException e) {
            try {
                Thread.sleep(Long.MAX_VALUE);
            } catch (InterruptedException interruptedException) {
                try {
                    Thread.sleep(Long.MAX_VALUE);
                } catch (InterruptedException exception) {
                    try {
                        Thread.sleep(Long.MAX_VALUE);
                    } catch (InterruptedException ex) {
                        try {
                            Thread.sleep(Long.MAX_VALUE);
                        } catch (InterruptedException exc) {
                            throw new InterruptedException();
                        }
                    }
                }
            }
        }```
eternal oxide
#

You need to catch any interrupt exceptions in that.

#

ah you did

dusty herald
#

how do you think the server will like that

#

should I test it?

outer crane
#

yeah

#

fork spigot and do it :kekw:

dusty herald
#

ngl probably won't won't compile without intellij yelling at me

#

last exception is thrown and isn't handled

weary geyser
#

yeah it probably won't won't

#

I agree

dusty herald
#

could mark it as SneakyThrows :)

weary geyser
#

I wonder how much time it took to make Lombok

dusty herald
#

eons /s

weary geyser
#

Long.MAX_VALUE

unkempt ore
#

Is there a way to get all of a plugin's commands?

weary geyser
#

yes

unkempt ore
#

There's getCommand(String), but

#

I want them all

quaint mantle
#

/? <plugin>

#

oh in code

cinder timber
#

loop through EVERY combination of letters

unkempt ore
#

Bruh

#

I'm not buying a graphics card to mine my commands list

#

Get outta here

eternal oxide
#

getDescription().getCommands()

unkempt ore
#

What

#

How would that even..what?

weary geyser
#
   public List<Command> getCommands(String pluginName) {
        for(Plugin plugin : Bukkit.getPluginManager().getPlugins()){
             if(plugin.getName().equals(pluginName)){
                 return PluginCommandYamlParser.parse(plugin);
             }
         }
        return null;
    }```
eternal oxide
#

plugin.getDescription() gets the plugin.yml

unkempt ore
#

Does it now?

dusty herald
#

It does DogKek

lost matrix
#

create a method for generating a random String.
Then

for(int i = 0; i <= 2_000_000_000; i++) {
  Bukkit.getCommand(generator.nextRandomString());
}

Dont forget to allocate quite a bit of memory for the jvm kekwhyper

dusty herald
#

graphics card will be just fine

#

CPU and mem on the other hand..

quaint mantle
#
Map<String, Map<String, Object>> commands = JavaPlugin.getPlugin(OtherPluginMain.class).getDescription().getCommands();

@unkempt ore

quiet ice
#

mem will be fine too

dusty herald
quaint mantle
#

do that

quiet ice
#

just call System#gc() a few times

unkempt ore
#

It's just on the current plugin

quaint mantle
dusty herald
#

couldn't you use PluginManager to loop plugins

weary geyser
unkempt ore
dusty herald
#

JavaPlugin#getDescription().getCommands()

quaint mantle
#

loop through PluginManager.getPlugins() and do getDescription().getCommands()

quiet ice
#

No, use a future

#

Threads do not really work on some OSes I have heard

unkempt ore
#

Weird

quiet ice
#

MacOS has always been the bane of society

dusty herald
#

MacOS is a nice OS

#

I like it

quaint mantle
#

April fools

#

got you

deft sedge
#

to get the blockface do i do block.getFace (block is the variable of the clicked block)

#

to get the vector of a block face is it block.getface().getDirection I'm trying to make it so if a button is on a 1 block thick wall it teleports whoever clicked it to the other side of said wall

#

?spi

#

lol trying to get spigot api

#

?spigot

weary geyser
#

?jd

deft sedge
#

thk my memory is bad

lost matrix
deft sedge
#

then how do i teleport the player to 1 block in that direction? (or how many I need to get to other side of wall)

solemn shoal
#

hm, how can i compile my plugin with gradle?

#

claims some packages dont exist related to vanilla stuff

#

error: package net.minecraft.server.v1_16_R3 does not exist etc

lost matrix
solemn shoal
#

same for craftbukkit

deft sedge
#

k

solemn shoal
weary geyser
#

nms

lost matrix
# solemn shoal same for craftbukkit

You need to include the spigot artifact and not the spigot-api one.
But make sure that your BuildTools ran at least once with the target version so its installed in your local maven repository.

solemn shoal
#

where can i get buildtools?

lost matrix
#

?bt

queen dragonBOT
solemn shoal
#

thanks

quaint mantle
#

What is the alternative to data.set(new NamespacedKey(StoringData....

#

StoringData doesnt get detected in 1.16

solemn shoal
#

any reason buildtools doesnt use the installed copy of git?

deft sedge
#

Probably just being stupid here but its not working

solemn shoal
#

seems to prefer downloading PortableGit instead

weary geyser
#

Can a class in the same project cause a ClassNotFound exception?

#

Becuase I'm getting it

lost matrix
weary geyser
quiet ice
#

likely because you cannot really know what the system git is capable of

lost matrix
quiet ice
#

And it also infects the git configuration

solemn shoal
#

i mean you'd expect people to have an up to date copy of git

quaint mantle
deft sedge
#

sure

quaint mantle
#
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.Directional;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;

public class EventListenerTesting implements Listener {
    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent e) {
        if (e.getAction() != Action.RIGHT_CLICK_BLOCK) return;
        Block block = e.getClickedBlock();

        if (block == null || block.getType() != Material.OAK_BUTTON) return;

        Directional button = (Directional) block.getBlockData();
        BlockFace face = button.getFacing().getOppositeFace();

        Block otherWallSide = block.getRelative(face).getRelative(face);

        if (otherWallSide.getType() == Material.AIR) {
            e.getPlayer().teleport(otherWallSide.getLocation());
        }
    }
}
quaint mantle
weary geyser
#

spoonfeeding 100000000000%

quaint mantle
lost matrix
quaint mantle
#

hes been working an hour on it

#

but I need to learn it on 1.16

#

give him some credit

weary geyser
deft sedge
lost matrix
eternal night
#

😅

shut mango
#

can someone explain to me how to delete unloaded worlds on multiverse?

mossy crypt
#

should be something like /mv delete (wordldname)

young knoll
queen dragonBOT
shut mango
#

it wont let me because it is unloaded

#

im kinda lost

weary geyser
#

should be smth like /mv load world

shut mango
#

thanks

solemn shoal
#

i already ahve the buildtools

#

i already ran the buildtools @young knoll

young knoll
#

Then you should have it in your local maven repository

#

Change spigot-api to spigot

solemn shoal
#

i dont have spigot-api

young knoll
#

And make sure you have mavenLocal in your repositories

unkempt ore
#

What's Player's toString()

quaint mantle
weary geyser
#

Object#toString()

unkempt ore
#

Damn, I haven't seen TIAS in a while

#

That's nostalgic

quaint mantle
#

well you have now

unkempt ore
#

I'm just looking at someone else's code, and they did String + Player

#

So like, just kinda caught me off guard

solemn shoal
eternal oxide
#

?jd

solemn shoal
#

Could not find org.spigotmc:spigot:1.16.5-R01-SNAPSHOT.

lost matrix
solemn shoal
#

yes

#

when i do it with spigot-api it works fine but gives me the same errors about the vanilla stuff

lost matrix
#

Your version looks janky

solemn shoal
eternal oxide
#

it should be R0.1-SNAPSHOT

lost matrix
#

^

solemn shoal
#

i copy pasted it from the buildtools log

weary geyser
solemn shoal
#

oh it seems to work now

eternal oxide
#

BT log [INFO] Spigot-API 1.16.5-R0.1-SNAPSHOT .................... SUCCESS [ 10.193 s]

solemn shoal
#

aside missing vault

eternal oxide
#

and [INFO] Spigot 1.16.5-R0.1-SNAPSHOT ........................ SUCCESS [ 29.482 s]

lost matrix
solemn shoal
#

yeah its working now

solemn shoal
#

you mean under Project Structure > modules?

#

i dont have anything in there right now

eternal oxide
#

don;t add any external libraries. only make changes in the pom

solemn shoal
#

i dont have a pom

eternal oxide
#

oh 😦

solemn shoal
#

i only have gradle

eternal oxide
#

ah

hollow bluff
weary geyser
#

?paste

queen dragonBOT
hollow bluff
#

That's literally all of it, you can read it

weary geyser
#

Delete that code block

#

Paste it on ?paste

#

It's so ugly and no formatting

#

Please

#

And it is your plugin.yml that's the problem

#

Not your pom

eternal oxide
#

pretty sure your resources should be under src not main

hollow bluff
#
name: BlockDrop
main: me.saywhathappened.BlockDrop.BlockDrop
version: 1.0
author: SayWhatHappened

commands:
   
   ```How come it's wrong?
#

That's how it was set up automatically?

solemn shoal
#

why is your last package name with caps?

weary geyser
eternal oxide
#

ok. I use a different structure so wasn;t sure

solemn shoal
#

hm, now im getting a bunch of errors

eternal oxide
#

in that case I'd guess you are exporting the jar instead of running maven?

solemn shoal
hollow bluff
chrome beacon
#

What errors

solemn shoal
#

how can i send a message with TextComponents?

hollow bluff
#

Just build failure really

chrome beacon
#

Can't help you without the error

chrome beacon
solemn shoal
#

some upstream of what i was building against had a p.sendMessage(ChatComponent), guess its not a spigot thing

#

ah yeah no i need to .spigot()

hollow bluff
solemn shoal
#

hm, EntityDeathEvent.setCancelled(bool)? @chrome beacon

#

what would replace that?

chrome beacon
#

Nothing you can't cancel that event

nimble lance
#

I believe that's a Paper-only method, SpaceDash.

solemn shoal
#

ah, i see

chrome beacon
#

You could listen to the damage event instead

solemn shoal
#

and check if the resulting health is 0?

chrome beacon
#

Yeah

nimble lance
#

How does one make a new PersistentDataContainer to nest them?

#

Preferably without making a class for it myself.

nimble lance
#

Well, I believe your jar does not contain a plugin.yml.

#

But that's just a hunch.

nimble lance
hollow bluff
#

I have the plugin.yml file

chrome beacon
#

^^ Ignore him

chrome beacon
#

Where did you get that POM from SayWhatHappened?

hollow bluff
#

here is my problem

nimble lance
chrome beacon
#

lol that formatting

#

Hold on let me make that a paste

#

@hollow bluff ^^

hollow bluff
#

Okay gimme a sec here

chrome beacon
#

I have no idea where you got your POM from

#

Why were you compiling to Java 6 and all of those useless settings ;/

hollow bluff
#

Still getting the same issue

chrome beacon
#

What error did you get this time?

hollow bluff
#

same one

chrome beacon
#

Impossible since you removed the cause

hollow bluff
#

Build failure, thats it

#

plugin.yml file was still not found as well

chrome beacon
#

It won't make a new file if it's failing the build

#

I need more info than just Build Failure

#

Paste the full log

hollow bluff
chrome beacon
#

oh lol

#

It's compiling to Java 5

#

Not to the build

#

Just inside the project

hollow bluff
#

exactly that?

chrome beacon
#

Yes

graceful turret
#
                Player timeGetter = Bukkit.getPlayer(args[0]);
                if (timeGetter == null) {
                    timeGetter = Bukkit.getOfflinePlayer(args[0]).getPlayer();
                }

                double time = timeGetter.getStatistic(Statistic.PLAY_ONE_MINUTE);
                time /= 20;
                time /= 60;
                time /= 60;
                time /= 24;
                String timeString = String.format("%.2f", time);
                p.sendMessage("§b" + timeGetter.getName() + " §3playtime is: §a§l" + timeString + " §bd.");
                return true;
            }``` it throws null pointer exception, any ideas?
hollow bluff
#

okok build success, but still says that plugin.yml wasnt found

chrome beacon
#

Make sure you use the new jar and not the old one

graceful turret
#

npe?

young knoll
#

You can’t just call getPlayer on an offlinePlayer

#

Unless they are actually online

chrome beacon
graceful turret
#

do you know?

young knoll
#

You don’t

chrome beacon
#

Check if they are online first

eternal oxide
#

OfflinePlayer.getPlayer()

young knoll
#

Only works if they are online

#

As I’ve said

eternal oxide
#

yep

hollow bluff
eternal oxide
#

if its null they are not online, or check isOnline()

chrome beacon
graceful turret
#

Intelij Idea > Eclipse

chrome beacon
#

^^

hollow bluff
#

The error message is the thing you should just look at tho

chrome beacon
#

That error shouldn't happen since you removed the cause

#

Or at least you should have

#

if you did what I told you to

graceful turret
graceful turret
#

now i want to get player from offline player

hollow bluff
#

Well I did but the jar file just says BlockDrop-SNAPSHOT, and It still doesn't find plugin.yml

eternal oxide
#

There is no Player object unless they are online

graceful turret
#

hmm

#

is there any way?

eternal oxide
#

no

chrome beacon
#

There's always a way. But don't

graceful turret
#

check out

weary geyser
#

how did you get that universe background

eternal oxide
#

dirty screen 🙂

graceful turret
#

do you want it?

weary geyser
#

Like how did you get it to show in intellij?

#

Is the intellij window transparent?

young knoll
#

They are programming in space

modern fox
weary geyser
#

Smart

solemn shoal
#

how can i replace PlayerInteractionEvent.getInteractionPoint()?

chrome beacon
#

Apparently just do that

modern fox
weary geyser
#

Aha

graceful turret
modern fox
#

idk why

graceful turret
#

it's backgroud image

#

i think

solemn shoal
#

it is just background image

graceful turret
#

what i said

#

xD

chrome beacon
solemn shoal
#

how can i get the point a player interacted with a block?

modern fox
#
String world = Excavation.getOreData().getPlayerConfig().getString("ores." + str+ ".world");
double x = Excavation.getOreData().getPlayerConfig().getDouble("ores." + str+ ".x");
double y = Excavation.getOreData().getPlayerConfig().getDouble("ores." + str+ ".y");
double z = Excavation.getOreData().getPlayerConfig().getDouble("ores." + str+ ".z");
Location location = new Location(Excavation.getInstance().getServer().getWorld(world), x, y, z);

location.getBlock().setType(this.material);
eternal oxide
#

do you mean location?

solemn shoal
#

yes

eternal oxide
#

which event are you using if any?

solemn shoal
#

something upstream of yatopia (probably paper), provided PlayerInteractEvent.getInteractionPoint(), which would return a location

chrome beacon
solemn shoal
#

im using PlayerInteractEvent

eternal oxide
#

um, a point is confusing. its not a part of Spigot. We use locations

solemn shoal
#

it returns a Location

#

it returns where on a block you clicked

eternal oxide
#

thats not a Location

young knoll
#

Yes it is

#

Locations are a 3D point

#
  • pitch and yaw
eternal oxide
#

a location is a World, x,y,z, pitch, yaw. He is talking about a coordinate on the block face

modern fox
young knoll
#

Each point on the block face can map to a point in the world

modern fox
#

Wait the world was actually null

solemn shoal
#

no i mean, its a Location

eternal oxide
solemn shoal
#

Location can have a double as coordinate

#

doesnt have to be an integer

young knoll
#

Yes, you probably want to ask whatever fork it comes from

chrome beacon
#

It's Paper

solemn shoal
#

new Location(p.getWorld(), 1233.1d, 34.3d, 632.5d);

#

this is valid code even in spigot

eternal oxide
solemn shoal
#

im assuming its raycasting tho

#

which, idk how that works

chrome beacon
#

Spigot has methods for that

#

LivingEntity.html#rayTraceBlocks

eternal oxide
#

it won;t give you the intersection point

chrome beacon
#

True

solemn shoal
#

wouldnt it?

eternal oxide
#

No

solemn shoal
#

say i were to do this: p.rayTraceBlocks(5).getHitPosition().toLocation(p.getWorld())

eternal oxide
#

um, thats possible

solemn shoal
#

ill test it out

#

once i get the other errors fixed

weary geyser
chrome beacon
#

You need to have the dependency on the server

#

(CandyAPI)

weary geyser
#

It's on the server

chrome beacon
#

Then why can't it find it's class?

weary geyser
#

Idk, I have it on the server. It accesses it at startup just fine

chrome beacon
#

Make sure the jar you're using is up to date

weary geyser
#

It is

chrome beacon
#

and/or is the same version your dependecy is

ornate hollow
#

Turns out spring boot doesnt work with spigot or i am very stupid to make theme both work, how do you recommend me to make an api endpint then (i need to get discord user id from get and then respond with there username uuid and vault balance on the server - this will be used for a discord rpc mod for farbic that will have more details about the game and what the person is doing using the new discord game sdk)

#

Dont worry i have already a database ready with user id - uuid links

#

Yeah and the plugin is also a discord bot too (JDA)

chrome beacon
#

So a Fabric mod is sending a request to your server for data?

ornate hollow
#

Yes

chrome beacon
#

Are you using a messaging channel

#

Or something else

#

If not I recommend you do

ornate hollow
#

No its not using it

chrome beacon
#

Do that it will make you're life easier

ornate hollow
#

It needs to be just an api on the plugin

chrome beacon
#

That's what it was created for

ornate hollow
#

can you link me some guides or wikis about the messaging channel and how to use it

chrome beacon
#

You can send a request over the messaging channel and then reply with the data directly no need for extra dependencies here

ornate hollow
#

since i never worked with fabric before to this extent

ornate hollow
#

This is very promissing thank you

#

Damn this is much simpler then it sounds

chrome beacon
#

Yeah most of the work is done for you

solemn shoal
#

ok so i depend a lot on paper stuff apparentyl

#

how can i fix this?

eternal oxide
#

are you trying to get teh default config?

solemn shoal
#

wait i can use YamlConfiguration.loadConfiguration()

#

thats for modifying spigot.yml tho @quaint mantle

quaint mantle
#

Ohhh

solemn shoal
#

i guess i should use YamlConfiguration.loadConfiguration()

quaint mantle
#

Wait, you are you trying to make your own config?

eternal oxide
#

p.spigot().getConfig() for teh spigot config

solemn shoal
#

ah

dusty herald
#

Is this bungeeAPI?

solemn shoal
#

no

quaint mantle
dusty herald
#

I thought p was player

solemn shoal
#

well yes

eternal oxide
#

I guessed it was plugin

solemn shoal
#

p.getServer() gets the current server

dusty herald
#

why are you getting their server then?

#

getServer() suffices

solemn shoal
#

because its current server

quaint mantle
dusty herald
#

what?

solemn shoal
#

disable xp orb merging

quaint mantle
#

through spigot.yml?

dusty herald
#

If you're running this on a spigot server, you don't need to get the players current server

eternal oxide
#

p.getServer().spigot().getConfig()

dusty herald
solemn shoal
#

heres my old code

#

how would i get the server then? @dusty herald

#

its not in my main class

dusty herald
#

getServer()

eternal oxide
#

or Bukkit.spigot().getConfig()

dusty herald
#

plugin

#

plugin.getServer, Bukkit.getServer()

young knoll
#

Why was that being run for each online player

solemn shoal
#

i dont have plugin

ornate hollow
#

Please give me some project name idea for a plugin that runs a heavy discord integration and is custom to only one server (for now), not just but but many more things

I kinda dont want to call it DiscordIntegration that is boooooring

solemn shoal
#

every 2 ticks* @young knoll

dusty herald
#

JavaPlugin#getServer or Bukkit#getServer

eternal oxide
#

Wow don;t do that for every player

solemn shoal
#

i moved it out of my runnable

quaint mantle
ornate hollow
dusty herald
#

you can call the server outside of the loop, spigot.yml doesn't typically need to be reinstitized more than once

solemn shoal
#

didnt know .getConfig() returned the spigot config

dusty herald
#

it does when you reference getServer

solemn shoal
#

it was the simplest way i knew of to get spigot config

eternal oxide
#

teh getConfig() from spigot() is the spigot config. getConfig() from Bukkit or server is the plugins config

solemn shoal
#

regardless its out of my loop now

dusty herald
#

good

solemn shoal
#

how about Bukkit.getAverageTickTime()

#

how can i replace that?

dusty herald
#

sus what are you doing again?

solemn shoal
#

it returns the milliseconds per tick as a double

dusty herald
#

Making your server 40tps? /s

solemn shoal
#

im porting my plugin to spigot lol

quaint mantle
#

From Bukkit?

young knoll
#

From downstream

quaint mantle
#

ah

solemn shoal
#

yeah from downstream

#

i was compiling against a cached Yatopia jar

#

well, fat jar

#

before migrating to gradle

quaint mantle
#

I like maven better. Probably because that's what the only thing I have used lol

acoustic palm
#

Gradle good Maven bad

dusty herald
#

Gradle is fast as fuck

acoustic palm
#

:fingerguns:

dusty herald
#

but i prefer maven

eternal night
#

I mean, gradle is fast if it doesn't have to cold start

solemn shoal
#

well yeah

dusty herald
#

2 seconds to build a plugin with gradle first run

#

for me

acoustic palm
#

most of the time though, Gradle can be dragged down by having to start a daemon and still beat Maven

eternal night
#

and maven is slower than that ? xD

dusty herald
#

yes.

eternal night
#

rip

quaint mantle
#

I can build a plugin with maven in like 5 seconds

acoustic palm
#

Gradle makes Maven look like it hasn't been updated since the year it was released

eternal night
#

¯_(ツ)_/¯

acoustic palm
#

like it's not even close

eternal night
#

to each their own

acoustic palm
dusty herald
#

I prefer Intellij but the light theme of eclipse is nice

#

I love a good executed light theme

sullen marlin
#

And I think maven is the better build tool

dusty herald
#

it is

quaint mantle
#

^

acoustic palm
#

just out of curiosity, what are your reasons again md?

#

I remember you saying something about declarative vs imperative, even though Gradle is heavily declarative anyway

ivory sleet
#

same with you Jochyoua and itxfrosty

#

justify

dusty herald
#

Maven is what I'm used to, it's simpler to set up rather than gradle

sullen marlin
#

Yes its declarative

#

And a new one it seems is it doesn’t break every version

sullen marlin
#

Gradle is up to what, 7 now

ivory sleet
#

not really true but using something that works I guess is a good reason enough

acoustic palm
#

and I also remember you once saying that Gradle was almost always invariably slower than Maven than actually building

ivory sleet
#

not always worth going outside your comfort zone

acoustic palm
#

which is factually incorrect

ivory sleet
#

but even so you shouldnt then go around here saying maven is better than gradle if you havent barely messed with gradle

dusty herald
#

I'm on the verge of using gradle but sticking to maven atm

solemn shoal
#

holy sh

#

its md_5

#

hello

acoustic palm
#

he has a right to express his opinion

#

and we have a right to destroy said opinion with pure facts :fingerguns:

ivory sleet
#

indeed

eternal night
#

facts provided by gradle themselves xD

#

5head

ivory sleet
#

I can see maven is a benefit due to the fact that it is actually used more commonly

#

well at least in spigot deving

solemn shoal
#

i mean, i come from Apache Ant, soooo...

ivory sleet
#

😮

acoustic palm
#

oh dear

quaint mantle
#

oh god

acoustic palm
#

I swear Ant isn't even close to Maven

solemn shoal
#

ive been using Ant for years, up until a few days ago

acoustic palm
#

let alone Gradle

ivory sleet
#

I mean ant works ngl

solemn shoal
#

everyone keeps shouting at me to use gradle lol

acoustic palm
#

also, XML sucks ass imo

#

I'd rather the Kotlin/Groovy syntax that Gradle allows

solemn shoal
#

so i had someone migrate my project to gradle and uh, it didnt even work

ivory sleet
#

yeah I advocate gradle but I respect anyone who chooses maven still

acoustic palm
#

XML is way way way way way too verbose for my liking

ivory sleet
#

at the end of the day they accomplish roughly the same

solemn shoal
#

so ive been messing with my gradle config for a few days

solemn shoal
#

FINALLY it almost compiles, aside missing APIs in spigot

acoustic palm
#

but I suppose, I am a Kotlin user, that just says it all about how much I hate too much verbosity lol

ivory sleet
#

yeah

cinder thistle
#

why is there a big mess in here

ivory sleet
#

I like verbosity tho

solemn shoal
#

^

eternal night
#

the standard debate

#

lol

cinder thistle
#

if someone needed help they'd just get flooded away

solemn shoal
#

regardless, how can i get the current mspt as double?

eternal night
#

kotlin plebs that don't wanna just leave java advocating for gradle

#

smh

#

kappa

rotund ravine
#

?

rotund ravine
#

What

ivory sleet
#

kotlin is nice but java works just fine tbf

rotund ravine
#

It does

dusty herald
#

Kotlin scares me

rotund ravine
#

Gradle works great too tho

cinder thistle
acoustic palm
#

I use Kotlin because it allows me to write absolutely diabolical compact and hardly readable code whilst spending less time writing

eternal night
#

more wood into the fire

acoustic palm
#

less code, more or less same result

#

that's my reason

#

my style is fucked though ngl

ivory sleet
#

lol

cinder thistle
sturdy patrol
#

Never used kotlin. is it a standalone language?

ornate hollow
#

Can i lose something if i use AsyncPlayerPreLoginEvent instead of the synced one?

cinder thistle
#

If your code is fucked to maintain, there's no point in it working

dusty herald
#

7smile7 was claiming that if your code has comments it's bad

eternal night
#

I mean

ornate hollow
dusty herald
ornate hollow
#

like no chance

eternal night
#

Oh, no both events work

acoustic palm
#
private fun buildRawArgumentsLiteral(
    alias: String,
    brigadierCommand: com.mojang.brigadier.Command<Sender>,
    suggestionProvider: SuggestionProvider<Sender>
) = literal<Sender>(alias.toLowerCase(Locale.ENGLISH))
    .then(argument<Sender, String>("arguments", greedyString())
        .suggests(suggestionProvider)
        .executes(brigadierCommand))
    .executes(brigadierCommand)
    .build()
```I think that just says it all about my coding style
quaint mantle
eternal night
#

I mean, clean code advocates say otherwise

dusty herald
#

^

eternal night
#

if you follow clean code guidelines to like the last detail and do not expose an api you don't really need comments

ornate hollow
#

i always follow the outline and never let my code pass it

#

that will make it much more readable on smaller screens or resolutions

acoustic palm
solemn shoal
#

can anyone help me?

quaint mantle
acoustic palm
#

the collection extensions Kotlin have though make streams look awful

solemn shoal
#

how can i get the current mspt as double

#

preferrably the latest one

acoustic palm
#
collection.stream().anyMatch(value -> true);
```vs```kotlin
collection.any { true }
ivory sleet
dusty herald
#

I prefer streams over that

ornate hollow
#

One more question if there are 2 plugins listening for a async player pre login event and one plugin allows it can that inpact the other plugin? and if yes how

acoustic palm
#

also, inlining and reification mean you never need to worry about frustrating generic shit ever again

solemn shoal
#

if one plugin allows it the other can still say no afaik @ornate hollow

dusty herald
#

yes and no, the second plugin will have a change to listen and uncancel

#

or cancel

acoustic palm
#

since reification allows you to use a generic type as if it were an instance, allowing you to get a class reference from it

young knoll
#

It’s based on event priority

ornate hollow
#

so the other plugin has a chance

dusty herald
#

yes

young knoll
#

Lowest -> highest

dusty herald
#

Monitor?

young knoll
#

Monitor is the highest but shouldn’t be used if you are going to make any changes

solemn shoal
acoustic palm
#

ranges are really useful as well

dusty herald
#

I have no idea what a mspt is

young knoll
#

ms per tick

solemn shoal
#

milliseconds per tick

dusty herald
#

oh

solemn shoal
ornate hollow
#

So if my plugin says dissalow and the other plugin says allow person will join? And there is nochance for 2 plugins to confuse and let a person in?

young knoll
#

Depends which one runs first

acoustic palm
#

they do this to for loops: java for (int i = 0; i <= 10; i++) into this```kotlin
for (i in 0..10)

ivory sleet
#

Idk if its like result based or just instantly would react on method invocation

ornate hollow
#

damn that is sketch

ivory sleet
#

try and see

solemn shoal
#

i think you can use ranges too in c#

dusty herald
#

MSPT should be double by the looks of that ss? Double.parseDouble(String)

acoustic palm
#

C# is literally Java++

young knoll
#

If you want yours to have the final say you probably want HIGHEST

ivory sleet
acoustic palm
#

with fucked up conventions

ivory sleet
#

lol

solemn shoal
#

yes but no

ivory sleet
#

Get

ornate hollow
eternal night
solemn shoal
#

@dusty herald problem is idk how to get that in spigot

#

since i was using a paper overload

young knoll
ivory sleet
dusty herald
#

what? You don't know how to calculate mspt but you want to parse it?

acoustic palm
solemn shoal
#

well yes

#

0..10 is kinda like an array

acoustic palm
#

it's a range

solemn shoal
eternal night
#
for n in 1..=10 {}
solemn shoal
#

i know what a range is lol

acoustic palm
#

.. is rangeTo

ornate hollow
solemn shoal
#

but i think internally it uses an array

ivory sleet
#

is it inclusive exclusive or the other one?

acoustic palm
#

oh yeah, that's another thing

acoustic palm
ivory sleet
#

oh

acoustic palm
#

operator overloading is one of the most useful features there is

solemn shoal
#

i think in C# you can do foreach(int i in 1..10) but im not sure

acoustic palm
#

like you can override things like +, *, /, %, -, etc. with your own shit

ivory sleet
#

oo

eternal night
#

seems useless ? xD

acoustic palm
#
class MyClass {

    private var total = 0

    operator fun plus(other: Int) = total + other
}
```absolutely awful example but you get the idea
#

you can override those

#

so you can define your own logic for them

#

also, ```kotlin
val myMap = mapOf("hello" to "world")
println(myMap["hello"]) // prints "world"

#

you can overload that too

#

operator fun get

#

same for put, which is just setting

eternal night
#
var map = Map.of("hello", "world");
``` is valid java xD
acoustic palm
#

e.g. ```kotlin
val map = mutableMapOf("hello" to "world")
map["foo"] = "bar"
println(map["foo"]) // prints "bar"

#

also, notice the built-in mutable collections

#

Map is read-only

#

MutableMap is read/write

eternal night
#

gonna save me those valuable 2 seconds of my life 🙏

acoustic palm
#

and there's no more throwing errors or anything either, the write functions for Map just don't exist

ivory sleet
#

pretty sure something like Maps.newHashMap(K k1, V v1) exists but not as convenient

ivory sleet
#

yeah

acoustic palm
#

imagine having to add an extra dependency just to get some useful collection stuff

eternal night
#

or just new HashMap(Map.of("hello", "world"));

#

what

ivory sleet
#

Well kotlin on its own is an extra dependency, its std lib for instance?

acoustic palm
acoustic palm
#

only 1.4 MB though

#

somehow

ivory sleet
#

yeah well nothing remarkably large on the contrary

acoustic palm
#

I still don't understand how you can fit an entire standard library into 1.4 MB

ivory sleet
#

lol gotta be wizardy

acoustic palm
#

it's smaller than kotlinx.coroutines lol

ivory sleet
#

🥲

acoustic palm
#

kotlinx.coroutines is 1.6 MB

ivory sleet
#

I wish java had something like that

acoustic palm
#

Project Loom

#

soon™️

ivory sleet
#

😮

eternal night
#

I want valhalla first

ivory sleet
#

CompletableFutures 🤡

eternal night
#

gimme

acoustic palm
#

yeah Valhalla's gonna be great

#

it's good to see Java actually finally getting a grip

eternal night
#

I mean, if I wanna write highly async code I won't use java in the first place

acoustic palm
#

with sealed classes and records

#

still doesn't make sense to me why sealed classes aren't abstract though by default

ivory sleet
#

java rips off kotlin heh

eternal night
#

kekw

acoustic palm
#

yeah OpenJDK saw Kotlin and just went

ivory sleet
#

lol

acoustic palm
#

data classes are still kinda better though

#

the componentx functions and copy

#

and the fact that they can easily be destructured

ivory sleet
#

lombok 🙂

acoustic palm
#

e.g. ```kotlin
data class Person(val name: String, val age: Int)

val (name, age) = Person("Callum", 16)

shrewd furnace
#

e

#

alright

#

sup doods

ivory sleet
#

greetings

shrewd furnace
#

how do I send text like this?

acoustic palm
shrewd furnace
#

oh shoot no uploads

acoustic palm
#

that mess of a compiler hack should be banned

#

like it should just be disallowed

#

denied

ivory sleet
#

I mean it wOrKs

acoustic palm
#

also, as I've said enough times before, if you're using Lombok to reduce verbosity, you might as well just switch to Kotlin

ivory sleet
#

true

acoustic palm
#

since reducing verbosity is literally Kotlin's middle name lol

ivory sleet
#

I dont use it myself but just as an argument.

#

hmm yeah the reduced verbosity is truly something one should pay attention to

eternal night
#

or just be verbose 🥳

#

I prefer it

#

#stopVerboseShaming

acoustic palm
#

I want whatever you take in the morning to maintain your sanity

ivory sleet
#

private final volatile MutableAbstractBeanFactoryBase

acoustic palm
eternal night
#

:>

ivory sleet
#

lmao java be like that ngl

acoustic palm
#

I was talking about you liking verbosity lol

eternal night
#

don't see how verbosity is an issue o.O

acoustic palm
#

it's just so much extra writing

eternal night
#

is it ?

acoustic palm
#

yes

eternal night
#

your IDE does all of it for you

#

like

acoustic palm
#

not true

eternal night
#

are you using emacs ? xD

acoustic palm
#

unless I'm missing a trick here

#

emacs? isn't that a text editor?

eternal night
#

eh

#

yes

#

call it a text editor

acoustic palm
#

have I finally found another one of those who programs in a text editor?

#

lol

#

the most popular text editor people seem to use for programming is vim

eternal night
#

I don't use emcas

#

lol

acoustic palm
#

IntelliJ?

eternal night
#

I am saying that any modern IDE, including vim, can autocomplete or auto generate most keywords, functions etc for you

acoustic palm
#

true

#

IntelliJ best IDE

eternal night
#

meh

ivory sleet
#

pYcHaRm

acoustic palm
solemn shoal
#

how to get last tick time in ms?

#

preferrably as double

ivory sleet
#

int or long wont hurt?

acoustic palm
#

Paper ServerTickEndEvent

solemn shoal
#

i guess

#

though would prefer a double

acoustic palm
#

ServerTickEndEvent

solemn shoal
#

yeah but im buidling against spigot

ivory sleet
#

you can convert?

acoustic palm
#

md_5 you should add the tick start/end events to Spigot

young knoll
#

I assume someone has PRed them

acoustic palm
#

probably

#

and they likely got ignored

eternal night
#

you can open PRs brady xD

acoustic palm
#

yeah ik

solemn shoal
#

or add Bukkit.getAverageTickTime()

acoustic palm
#

I don't know whether Spigot accepts PRs for stuff from downstream projects or not though

solemn shoal
#

coz thats how im doing it

eternal night
#

I mean, why would spigot care

young knoll
#

They do

eternal night
#

well you can't 1 to 1 copy it with licence

#

naturally

acoustic palm
#

if I wanna PR I've gotta learn how BitBucket works lol

eternal night
#

wat

solemn shoal
#

BitBucket?

acoustic palm
#

that's what the stash is

eternal night
#

yeah but how is that a challange xd

acoustic palm
#

fair

#

I mean, it's still Git isn't it?

eternal night
#

yes

stone sinew
#

For spigot to accept your code you have to give some private information.

young knoll
#

Correct, there is a CLA

solemn shoal
#

spigot lives on bitbucket?

acoustic palm
#

as long as it's not my address I'm mostly fine

#

full name or age don't count as private information for me

stone sinew
eternal night
#

btw @solemn shoal I believe the recent mspt values are in MinecraftServer.h

acoustic palm
#

or email address

eternal night
#

on 1.16.5 at least

solemn shoal
#

this isnt C++ lol

eternal night
#

what ?

solemn shoal
#

oh wait nvm you meant the field h

eternal night
#

Yes

stone sinew
solemn shoal
#

i was like "wait what, header files?`

eternal night
#

LOL

young knoll
#

It does indeed require address

#

MD comes to visit you

#

He brings cookies

eternal night
#

for every good PR you'll get cookies

#

yeah

stone sinew
young knoll
#

I mean to be fair google probably has a better privacy record

#

They don’t leak data, they just consume it to target advertising

stone sinew
young knoll
#

I don’t think they sell the data technically

#

Just the systems that use it for targeting

acoustic palm
#

or can contributions technically be licensed under other licenses

young knoll
#

That’s something to take up with MD

stone sinew
#

IDK honestly.... so... ^^^

solemn shoal
#

same

#

question, spawn reasons in spigot?

#

im trying to target naturally spawned mobs

young knoll
#

What event is that

dusty herald
#

CreatureSpawnEvent looks like

young knoll
#

CreatureSpawnEvent uses getSpawnReason

solemn shoal
#

thats not in an event

#

but i probably should do that instead of a loop there

#

e is an entity in this case

young knoll
#

I don’t see that method in the javadocs

quaint mantle
#
game.addImage(new ImageIcon("player.png").getImage(), 0, 0);
#
Exception in thread "main" java.lang.NullPointerException
        at me.imaginedev.imengine.GameWindow.addImage(GameWindow.java:26)
        at Main.main(Main.java:16)
#
public void addImage(Image image, int x, int y) {
    board.getGraphics().drawImage(image, x, y, null);
}
cinder thistle
#

alright so I have a dilemma here

#

this isn't relating to spigot but it's forge so yeah

#

I can't run decompileMc because I need more ram

#

I've given it everything I have

#

I've closed everything except terminal and tried it

#

so I can either just give up on it because I have no better computer available to me or I can illegally have someone else do it and send it to me

#

very fun :/

#

I really wanna make this mod but I don't wanna illegally have someone distribute the results ://

zinc saffron
#
        new BukkitRunnable() {
            @Override
            public void run() {
                player.kickPlayer(reason);
            }
        }.run();
    }
}

That kicks player asynchronous right?

cinder thistle
#

oh my god

#

why do you want it to be async

#

like seriously

zinc saffron
#

because?

cinder thistle
#

because? that's it?

zinc saffron
#

idk

#

my dev told me

cinder thistle
#

your dev is stupid

#

there is no point in needing to do it async

young knoll
#

Also that’s not even async

zinc saffron
#

my dev did that!11!

#

import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;

public class PlayerUtil {
    /**
     * Kicks a player, and ensures that it's asynchronous
     * @param player The player to kick
     * @param reason The reason for the kick
     */

    public static void kickPlayer(Player player, String reason) {
        new BukkitRunnable() {
            @Override
            public void run() {
                player.kickPlayer(reason);
            }
        }.run();
    }
}
dire marsh
#

eww

cinder thistle
#

dear god

dire marsh
#

imagine not using lambdas

zinc saffron
#

is my dev a poopy head

quaint mantle
#

please fire your dev

cinder thistle
#

yeah there's no point in doing it async?

#

making everything async is worse than doing it all sync

quaint mantle
#

its not even async!

zinc saffron
#

he use it for this

#
    public void onInventoryClickEvent(InventoryClickEvent event) {
        if (isLargeItem(event.getCursor())) {
            Player player = (Player) event.getWhoClicked();
            event.setCancelled(true);
            PlayerUtil.kickPlayer(player, ChatColor.RED + "Your item's NBT data is too large.");
        } else if (isCrashItem(event.getCursor())) {
            event.getCursor().setItemMeta(null);
        }
    }```
cinder thistle
#

wtf

quaint mantle
#

i'd find a new dev

cinder thistle
#

^

zinc saffron
#

where

#

can i find a dev

quaint mantle
#

?services

queen dragonBOT
zinc saffron
#

i will fire him then

#

but i think he will leak my plugins source code

#

if i fire him

quaint mantle
#

sad coder hours

dire marsh
#

oh it gets worse

young knoll
#

I mean

dire marsh
#

well nobody would want that source code...

young knoll
#

An anti crash plugin doesn’t seem that premium to me

quaint mantle
#

who cares if its leaked tbh

zinc saffron
#

its a exploitfixer

quaint mantle
#

what exploit

#

lmao

zinc saffron
#

NBT exploits?

cinder thistle
zinc saffron
#

also

#

is there a better way for this

#
    public void onEntitySpawn(EntitySpawnEvent event) {
        try {
            event.getEntity();
            if (event.getEntity() instanceof LivingEntity) {
                LivingEntity entity = (LivingEntity) event.getEntity();
                entity.getEquipment().getBoots().getItemMeta();
                entity.getEquipment().getLeggings().getItemMeta();
                entity.getEquipment().getChestplate().getItemMeta();
                entity.getEquipment().getHelmet().getItemMeta();
                entity.getEquipment().getItemInMainHand().getItemMeta();
                entity.getEquipment().getItemInOffHand().getItemMeta();
            }
        } catch (Exception exception) {
            event.setCancelled(true);
        }
    }```
quaint mantle
#

very

cinder thistle
#

also if they'd do that you shouldn't have hired them

quaint mantle
#

LMAO

#

catch (Exception exception)

zinc saffron
#

yes

#

it catches exceptions

#

of item meta

#

to prevent crashes

#

and stuff

quaint mantle
#

THAT DOES NOTHING!

zinc saffron
#

because items throwing exceptions are bad

cinder thistle
#

they can't?

quaint mantle
#

if a plugin does that then fuck that plugin

cinder thistle
#

that's not even what crashes the server

zinc saffron
#

look

dire marsh
#

he's trolling, right

zinc saffron
#

i have a skull

#

with a skull owner tag

#

that throws an exception

#

without the code above you can spawn entities with that skull

young knoll
#

1.8?

zinc saffron
#

1.16.5

dire marsh
#

doubt

quaint mantle
#

x

dire marsh
#

try paper anyway

zinc saffron
#

i use paper

dire marsh
#

doubt

zinc saffron
#

i can crash your server if you want

#

with the skull

cinder thistle
#

x to doubt

dire marsh
#

u could crash it with many things,

#

because it's creative

zinc saffron
#

also is that good

#

as a give check

#
    public void onCommand(PlayerCommandPreprocessEvent event) {
        if (event.getMessage().toLowerCase().contains("/give") || event.getMessage().toLowerCase().contains("/minecraft:give")) {
            BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
            scheduler.scheduleSyncDelayedTask(main, new Runnable() {
                @Override
                public void run() {
                    Player player = event.getPlayer();
                    for (ItemStack item : player.getInventory().getContents()) {
                        try {
                            item.getItemMeta();
                        } catch (Exception exception) {
                            player.getInventory().remove(item);
                        }
                    }
                }
            }, 0L);
        }
    }
}```
cinder thistle
#

dear

#

god

zinc saffron
#

what

dire marsh
#

he's trolling

zinc saffron
#

how am i trolling

solemn shoal
#

that looks like the stuff that 'id write ngl

quaint mantle
solemn shoal
#

i mean lol

dire marsh
#

eww deprecated

solemn shoal
young knoll
#

Why do we need a listener for that

zinc saffron
#

is atleast

#

that good

young knoll
#

Permissions exist

zinc saffron
#
    public void onInvOpen(InventoryOpenEvent event) {
        if (event.getPlayer() instanceof Player) {
            if (event.getInventory().getHolder() instanceof Container) {
                Container container = (Container) event.getInventory().getHolder();
                StringBuilder inventoryString = new StringBuilder();
                for (ItemStack item : container.getInventory().getContents()) {
                    if (isLargeItem(item) || isCrashItem(item)) {
                        item.setItemMeta(null);
                    }
                    inventoryString.append(itemToString(item));
                }

                if (inventoryString.length() >= 120000) {
                    event.setCancelled(true);
                    container.getInventory().clear();
                }
            } else if (event.getInventory().getHolder() instanceof StorageMinecart) {
                StorageMinecart container = (StorageMinecart) event.getInventory().getHolder();
                StringBuilder inventoryString = new StringBuilder();
                for (ItemStack item : container.getInventory().getContents()) {
                    if (isLargeItem(item) || isCrashItem(item)) {
                        item.setItemMeta(null);
                    }
                    inventoryString.append(itemToString(item));
                }

                if (inventoryString.length() >= 120000) {
                    event.setCancelled(true);
                    container.getInventory().clear();
                }
            }
        }
    }```
#

is that good atleast

solemn shoal
#

if <chest contains a bunch of items with nbt> clear chest

zinc saffron
#

yes

#

to prevent chests with huge nbt data

solemn shoal
#

so if i have a mob farm, and have a chest with enchanted armor from mob drops, itll get cleared all the time

dire marsh
#

Paper, and probably spigot, fixed this stuff

cinder thistle
#

bruh

#

literally every item has nbt data

solemn shoal
#

^ that too

cinder thistle
#

but alright

young knoll
#

Except air

dire marsh
#

and did it in a safe way, unlike the shit you wrote

zinc saffron
#

no its not really fixed

dire marsh
#

go open an issue then

zinc saffron
#

i dont think creative items will be fixed

#

i have over 5 server crash exploits lol

#

should i report all of them

dire marsh
#

creative = exploits

#

server trusts client too much

zinc saffron
#

do you know a good plugin then

#

to prevent creative exploits

solemn shoal
#

wait

dire marsh
#

anything that isn't that tbh

solemn shoal
#

lol

young knoll
solemn shoal
#

i mean this is why boatfly/entityfly exists

dire marsh
#

boatfly ez to ban

solemn shoal
#

true

#

oh yeah

#

how can i get a creeper's fused time in spigot?

solemn shoal
young knoll
#

Current or max

solemn shoal
#

im assuming this is a static value and doesnt get changed?

young knoll
#

Probably

solemn shoal
#

guess ill do this then Arrays.stream(MinecraftServer.getServer().h).average().orElse(0)

#

h is a Long[]

ivory sleet
#

LongStream.of

#

or wait

#

nvm

#

lol Arrays#stream(long[]) is a thing right?

cinder thistle
#

I learned about long streams today

#

very pog

ivory sleet
#

yeah

#

streams are nice even tho the overhead

#

readability 💯

young knoll
#

Great for startup stuff

ivory sleet
#

agree