#help-development

1 messages Β· Page 1845 of 1

wet breach
#

ideally you should use DI, but DI is not necessary for everything

#

it all depends on the purpose of the class

#

if the class is more for internal purposes DI isn't necessary, but if its something intended to be accessed outside of the library you should use DI but there are some edge cases where you shouldn't use it but most of the time you don't encounter such things

gleaming grove
#

i talking about Spring like DI where you just makes constructor with some Classes and they are automatically passed in

ivory sleet
#

Yeah

#

If your constructors only take 3-4 arguments it’s not a big deal

timid kraken
#

is there an event for when a new user is whitelisted? or when a user is removed from whitelist

ivory sleet
#

But as you exemplified yourself, spring, which is an enterprise library to build enterprise apps with, chances are you’ll end up with 10 args constructors thus assisted injection can be a life savior

wet breach
gleaming grove
#

i do my own DI library for spigot and it saves my time when when i comes to use classes like "Settings", "PlayerRepository" etc

ivory sleet
#

That’s a fine approach altho why not guice?

#

Or dagger or smtng w

gleaming grove
#

i've needed to make a little bit custom DI for Spigot purpose

wet breach
ivory sleet
#

It’s very sophisticated

wet breach
#

inject everything!

ivory sleet
timid kraken
#

why isn't there an event for this tho? it seems reasonable to have one

wet breach
#

because there is 2 events that cover this where you can check if its whitelisting

#

there is the commandpreprocessevent which is for players

#

and there is ServerCommandEvent for anything not a player

#

you can easily check from those events if the command being run is the whitelist one

timid kraken
#

but both of them work for many other commands aswell right, also what if the whitelist failed

#

like the username provided was wrong or smtg

wet breach
#

can check with that after letting the command run

#

so, wait like a tick or something run that method and you will know

#

or you could cancel the command, and then use the api methods to handle whitelisting

#

then you can provide customized output

timid kraken
#

ok that makes sense, but don't you think it'd be better if there was just an built in event for this?

wet breach
#

you could pr one if want, but I don't really think it is necessary or needed

#

given we already have events where you can easily obtain that information

timid kraken
#

well i could try the pr but im not sure if others will agree on this

wet breach
#

it isn't about others agreeing on it, but rather if the spigot team wants to accept it

west pecan
#

Aight so I'm kinda a big dummy, I have this build.xml file but have no clue how to build the jar file from it. I am trying to update an old plugin, all it has is build.xml. Any pointers would be appreciated.

timid kraken
karmic bear
#

how do I catch an error

#
            Location location = p.rayTraceBlocks(100, FluidCollisionMode.NEVER).getHitBlock().getLocation();
            if (location==null) return;
            w.createExplosion(location, 5, false);```
#

when i raycast

#

and it doesnt find a block

#

it makes an null pointer exception in my console

#

but the if statement doesnt work

mellow gulch
#

you sneak up on it.
with try{} and catch{}

candid galleon
#

don't catch the NPE

#

just check if the getHitBlock is null

#

you're grabbing its location instead of checking if its null

wet breach
#

and add the next statement inside that if code block

#
    World w = p.getWorld();
    Location location = p.rayTraceBlocks(100, FluidCollisionMode.NEVER).getHitBlock().getLocation();
    if (location != null) {
        w.createExplosion(location, 5, false);
    }
candid galleon
#

that's still gonna throw a NPE

#

just check if the getHitBlock is null
you're grabbing its location instead of checking if its null

wet breach
#

ah, I don't usually work with raytraceblocks stuff

#

didn't realize that getHitBlock() will npe

karmic bear
#

it didnt matter what nullchecks I would add, it still seemed to throw a NPE

#

I guess Gizmo is right, I should prob just put it in a try/catch block

mellow gulch
#

no don't do that i was half joking

karmic bear
#

oh

#

well im still stumped

candid galleon
#

just check if the getHitBlock is null
you're grabbing its location instead of checking if its null

wet breach
#

^

mellow gulch
#

why would

World w = p.getWorld();
Block hitBlock = p.rayTraceBlocks(100, FluidCollisionMode.NEVER).getHitBlock();
if (hitBlock != null) {
    w.createExplosion(hitBlock.getLocation(), 5, false);
}

not work?

candid galleon
#

that should work

wet breach
#

yeah it should work

gleaming grove
karmic bear
#

java.lang.NullPointerException: Cannot invoke "org.bukkit.util.RayTraceResult.getHitPosition()" because the return value of "org.bukkit.entity.Player.rayTraceBlocks(double, org.bukkit.FluidCollisionMode)" is null

#

still produces an NPE

mellow gulch
#

so 1 more if is needed

candid galleon
#

guess rayTraceBlocks can return null

mellow gulch
#
World w = p.getWorld();
RayTraceResult result = p.rayTraceBlocks(100, FluidCollisionMode.NEVER);
if(result!=null && result.getHitBlock()!=null) {
    w.createExplosion(result.getHitBlock().getLocation(), 5, false);
}
#

clean up as desired

karmic bear
#

thanks

mellow gulch
#

np

#

but ya i was joking earlier, you asked how to catch the exception, not how to prevent it

wet breach
#

lol

wet breach
mellow gulch
#

good to hear, almost didn't say it in fear of sounding like a smartass

fallow merlin
#

In Yarn mappings there is a class called DebugInfoSender
Similarly in MCP mappings there is a class called DebugPacketSender
Does this exist in Spigot and is there an easy way to modify these classes?
Normally I would just use mixins but those don't exist for spigot iirc

wet breach
#

idk, but if it makes you curious there is a DEBUG_STICK

#

I don't think Spigot uses that class

fallow merlin
#

No I'm using this to send data on the debug renderer channels

#

(minecraft already calls the DebugInfoSender functions whenever necessary and I really don't want to have to replicate that)

mellow gulch
#

idk if DebugPacketSender is in the server code, never looked, but i think this is likely a push toward the right direction

fallow merlin
#

and the mixins part how could I do that tho

#

mixins alternative rather

mellow gulch
#

people usually use reflection with nms

#

(when they need to gain access to private stuff, etc.)

fallow merlin
#

well yeah but mixins edit the original code

mellow gulch
#

it's not as powerful as mixins, but if you're clever you can get most things to work

fallow merlin
#

ok I'll try to do what I can lol

candid galleon
#

are you trying to edit client code via server plugins?

fallow merlin
mellow gulch
#

just double check to make sure you can't do it with spigot's api first though

fallow merlin
#

DebugInfoSender is code that sends debug stuff

candid galleon
#

you're trying to edit client code via server code?

fallow merlin
#

no

#

I have a mod on the client that reads the debug channels for info abt debug renderer params

candid galleon
#

server code with plugins?

fallow merlin
#

yes

mellow gulch
#

you can do things with channels in spigot

fallow merlin
#

Yeah my issue isn't the channels its getting them to execute at the correct time

mellow gulch
#

ah

fallow merlin
#

otherwise lag happens and thats bad

mellow gulch
#

how much debug code are you sending?
*debug data

fallow merlin
#

a bit, for example heres what the code would be on fabric

    @Inject(method = "sendPathfindingData", at = @At("HEAD"))
    private static void sendPathfindingData(World world, MobEntity mob, Path path, float nodeReachProximity, CallbackInfo ci) {
        if (!(world instanceof ServerWorld) || path == null || !RenderersState.INSTANCE.get(RenderersState.RendererType.PATHFINDING)) return;
        PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
        buf.writeInt(mob.getId()).writeFloat(nodeReachProximity);
        PacketUtils.writePathToBuffer(buf, path);
        sendToAll((ServerWorld) world, buf, CustomPayloadS2CPacket.DEBUG_PATH);
    }
mellow gulch
#

i use channels to send info for my own scoreboard system in an optional client mod and it isn't enough info to cause lag

fallow merlin
#

except other debug data

mellow gulch
#

how are you reading it in spigot-side?

fallow merlin
#

I'm not reading it spigot side, this was just to make sure it works

#

eg. in a single player world

mellow gulch
#

how do you know it causes lag when you use channels in spigot then?

fallow merlin
#

idk but it caused lag on the client

#

the best way for me to run these functions (i think) is to check in a radius every tick

#

but then theres Paths which are confusing af

#

(in spigot cuz obfuscation)

mellow gulch
#

the post by md_5 i linked tries to explain how to use mappings in spigot dev, i haven't done so yet though so im not of much help with that

#

i've been coping by decompiling spigot and compring fabric's mapping with it to find the gobldeygoo names i need

fallow merlin
#

I have the deobfuscated code I just cant use it in my ide which is annoying but its not as hard as no deobfuscation

#

yea same lol

mellow gulch
#

but ya, there is a way to do it, i just have yet to try it out

#

2nd post, under the NMS section of "Developer Notes"

mellow gulch
#

but if i was you i'd try to use spigot's built-in channels stuffs before going the nms route

fallow merlin
#

its just imo the nms route seems easier cuz I don't have to add all the detections n shiz lol

#

Just checked, it does exist in spigot under the name PacketDebug
and just like for fabric and mcp nothing has code except sendGameTestAddMarker which, if the client has the mods to make it work, spawns a small semi-transparent box with a name

torn shuttle
#

hm maybe I am just really stupid

mellow gulch
#

intereting

fallow merlin
#

It also only takes a blue and a green value because the client nulls out the red value

#

even though the packet takes r, g, and b ints

runic mesa
#

Can you explain the loop more, im expecting i use the boxs getMinx for all the respective ones but where do i sub in my variables in the loop

sudden raft
#

like

#

for one dimension you would do

for (int x = min; x < max; x++) {
  ...
}
#

for two dimensions you just add another for-loop inside

mellow gulch
fallow merlin
#

I'm just reimplementing it

sudden raft
mellow gulch
fallow merlin
#

*already forking purpur to add the methods myself*

mellow gulch
#

ok

dark arrow
#

I meant like for creeper , powered tag and all

dark arrow
#

how to give nbt tag to mobs that i summon

buoyant viper
#

use PDCs instead if u can

#

?pdc

night patrol
#

how to create sub command like /cord help

wet breach
#

when someone runs the command you just check which argument they used if any at all

#

and then decide what to do from there

night patrol
dark arrow
#

hey how to use appy bone meal and break naturally?

wet breach
swift adder
#

How could I make a command spawn an animal
I know how to make commands just not spawn mobs.

young knoll
#

World#spawn

swift adder
#

Oh okay

#

World.spawn?

#

Orrr?

young knoll
#

mhm

swift adder
#

Okay so

#

player.getLocation.World.Spawn

#

Then what?

candid galleon
swift adder
#

Thanks both of you

#

I got it now

dark arrow
#

hey how will i spawn mobs with items in their hand?

#

like summoning skeleton with sword

young knoll
#

Summon it and then add the item

#

LivingEntity#getEquipment has the methods you need

lavish hemlock
#

I too feel N

fallow merlin
#

what

lavish hemlock
#

you weren't there

#

fuck off :3

fallow merlin
#

rude

wet breach
lavish hemlock
#

ok so basically there was a deleted message

#

and it was from that one guy who just joined

#

and doesn't use ?services

wet breach
#

I know now

#

πŸ™‚

lavish hemlock
#

and it was just a bunch of spam but amidst it was the letter N in bold

wet breach
#

I was there it turns out

#

lmao

#

thought maybe you were referring to something else XD

young knoll
#

Some people are very impatient

wet breach
#

or just plain rude

young knoll
#

I mean, I am impatient too, but I try to control it

lavish hemlock
#

I'm rude but everyone loves me so it doesn't matter if I don't control it πŸ˜‰ /s

fallow merlin
#

I don't know you so I have no reason to love you
yet

wet breach
#

no one said you can't be rude elsewhere

lavish hemlock
#

this is like the only server I'm in tho

wet breach
#

you are only allowed to be rude online?

lavish hemlock
#

oh fair

#

but I don't go outside either

wet breach
#

lmao

lavish hemlock
#

so I don't have anyone to be rude to except for my lil sister

wet breach
#

good enough

split shale
#

?services

undone axleBOT
lavish hemlock
#

and now he services

wet breach
#

sibling rivalry is always good

#

especially if no one knows what the rivalry is about

fallow merlin
#

How do I recompile minecraft after I decompile it? (eg. after editing source for a jar mod)

wet breach
#

you don't

lavish hemlock
#

^ :)

#

but if you're working with somethin' like MCP there should be a way to recompile

fallow merlin
#

wait so how do other people do that what

wet breach
#

well you have to fix up quite a bit of things to get it to compile, sometimes it won't compile due to some info in the file you can't see

#

since you know it was compiled

#

so, sometimes you have to remake the file with the same info πŸ™‚

#

it can be a pain sometimes lol

#

another trick is to not compile

#

and just stuff the decompiled classes into a jar

#

doesn't help with running the jar, but works for API/coding purposes

#

this is why spigot doesn't decompile all the classes

#

and only decompiles what it actually uses

#

or needs

lavish hemlock
#

that is also performant ^

#

takes less time to decompile some of NMS as opposed to all of it

buoyant viper
#

one pet peeve i had with MCP was it never actually knew how to decompile the server

#

or at least, didnt make it easy

wet breach
#

o.O

buoyant viper
#

it was great for decompiling client but server? SoL

wet breach
#

well I guess that is true in a way, just mainly deobfuscated stuff

#

but I mean do you really need to decompile it though?

buoyant viper
#

if u wanted to make Bukkit 2 yes 😎

wet breach
#

you could just shade

buoyant viper
wet breach
#

shade and create a sources jar πŸ˜„

buoyant viper
#

the MCP license was weird

#

it was only for private use but that stopped no one

wet breach
buoyant viper
#

isnt that all licenses, honestly?

wet breach
#

yes and no

#

what I meant is that they had no intention in enforcing that aspect

#

but what it does do is protect them from certain other entities though

#

reverse engineering is not illegal and can't be prohibited from doing it for private uses

#

but you can be for commercial uses like Mojang license does

#

So, by MCP stating using their software is only for private uses Mojang doesn't really have any grounds to go after MCP

#

anyways I am not a lawyer so don't take it as gospel, but am telling you its purpose XD

wet breach
buoyant viper
#

god am i an idiot or something or does java JDK not set a JAVA_HOME on mac

wet breach
#

as it doesn't use it anymore

buoyant viper
#

wtfwhy

#

ok it may not but like a thousand other things do

#

pain

wet breach
#

they set the path to a directory that has a what you call it, its like a shortcut

#

but not quite a shortcut

buoyant viper
#

symbolic link?

wet breach
#

there you go

#

it has a symbolic link to which ever version you most recently installed

buoyant viper
#

its kinda weird bc i install java 8 and it still said 17 in terminal

#

and i made sure i logged out of everything and logged back in to refresh path

wet breach
#

path doesn't change no more

#

as I said the path for JDK is set to a directory that has symbolic links

#

which means new installs don't need to update path

#

just the links

buoyant viper
#

yes but then java 8 still shouldve overrode that i think

#

yet it kept 17

wet breach
#

should have, why it didn't not sure

#

but the way the install works is it doesn't concern itself with that symbolic link area other then ensuring its there, if it doesn't have perms to modify that it wont fail

buoyant viper
#

idk im gonna try install again and see what happens

wet breach
#

why not just update the symbolic link?

buoyant viper
#

bc it doesnt even look like its where it shouldve been

wet breach
#

or just update the path

buoyant viper
#

aka java 8 didnt even save itself to my drive

wet breach
#

or that could be the answer there

#

if its not installed then obviously that answers why nothing changed πŸ™‚

buoyant viper
#

supposed to be in /Libary/Java/JavaVirtualMachines/ but all i got is 17

wet breach
#

well, I don't mess with apple products so I wouldn't know

#

I just know that JDK stopped messing with the path or updating it on every new install now

buoyant viper
#

i havent touched this laptop in a few years but im on vacation rn n its all i took in terms of computers

wet breach
#

And stopped using JAVA_HOME

#

which is cool, but doesn't help when other tools still use that though

#

like Maven for example

#

Maven still looks for JAVA_HOME

#

-.-

lavish hemlock
#

ah

#

this is why jenv is a work of art

#

also

#

HOW THE FUCK

#

DOES SOMEONE THINK THAT'S A GOOD IDEA

#

tools would have to check 2 paths now

#

just for compat

wet breach
buoyant viper
#

apparently on mac the java 8 jre installed to Internet Plug-Ins

#

ok oracle

#

java homebrew install it is!

wet breach
buoyant viper
#

well no, but just jdk is fucky wucky for me sometimes

#

usually with anything using javafx

wet breach
#

JDK usually contains the JRE o.O

buoyant viper
#

i think javafx branched off into its own thing

#

idk

wet breach
#

after java 11, there is no more JRE its just a JDK now

wet breach
#

or 12

#

requires a separate install to have JavaFX now

#

even for end user

buoyant viper
#

removed in 11 looks like

wet breach
#

but now you know why you have issues sometimes πŸ˜‰

buoyant viper
#

i think i only had adoptopenjdk 8 at the time of that issue tho

#

so maybe adopt didnt bundle it?

#

i was very slow and reluctant to move past java 8 lol

wet breach
#

lol

#

I have been waiting for Java 16/17 for years

#

because it contains Unix Sockets πŸ™‚

#

natively that is

buoyant viper
#

i think my interest only peaked once 11 came out

#

bc of the upgraded HTTP api

#

HttpClient

wet breach
#

I plan to make a PR to bungeecord/spigot for unix sockets

buoyant viper
#

it replaced the need for my own http code, apache dep, or okhttp

wet breach
#

so that when bungee and spigot are on the same system you can choose that for communication method which is more secure and less overhead

#

apache HTTP libs are still decent

buoyant viper
#

yea but i do like the inbuilt one more, because its built in lol

wet breach
#

well built in doesn't always necessarily mean its native, most of the time it does

#

don't think anything native is needed for httpclient though I don't think

buoyant viper
#

it probably just wraps around methods weve all written ourselves already but

#

now we dont have to write it 😎

wet breach
#

probably I mean really you don't need http client per-say

#

could just do it the old fashion of handling sockets yourself

buoyant viper
#

just makes life easier having one

quaint mantle
#

was wondering if anyone else had issues trying to implement the Vault API into their plugins aswell?

sullen marlin
quaint mantle
sullen marlin
#

plugin.yml

#

depend / softdepend

quaint mantle
#

oh shoot

sullen marlin
#
BukkitWiki

When Bukkit loads a plugin, it needs to know some basic information about it. It reads this information from a YAML file, 'plugin.yml'. This file consists of a set of attributes, each defined on a new line and with no indentation.

A command block starts with the command's name, and then has a list of attributes.

A permission block starts wit...

tacit drift
#

Ugly milk bucket

dark arrow
#

lol

thorny python
#

is there a way to include & load datapack from plugin to server? instead of user have to put them into the server manually

sullen marlin
#

Copy to datapack folder?

thorny python
#

uh that's sound a workaround

#

so spigot dont have api for it right now? datapack support from plugin

spiral light
rough basin
#

I'm trying to find some projectiles with try() / catch(),
But it seems not working nah

chrome beacon
#

Also either make a projectile variable or add an () around the cast and event.getDamager()

spiral light
# rough basin

if(event.getDamager instanceof Projectile)

else if(event.getDamager instanceof LivingEntity)

rough basin
#

Thanks bro

#

I was wondering if anything other than LivingEntity or Projectile could be input in EntityDamageByEntityEvent.getDamager()

#

in short, Is there any reason to put else()?

spiral light
#

not rly since it does the same thing like before

rough basin
#

Thanks

delicate cargo
#

so i have a function for checking what recipe is in the crafting grid (custom gui) but for some reason "oak_log" and "oak_log" are not matching (for the ids.get(index).equals(recipe.idsIn[index]) part)

public String isRecipe(ItemStack[] items) {
        List<String> ids = new ArrayList<String>();
        for (ItemStack item : items) {
            if (item != null) {
                NamespacedKey key = new NamespacedKey((Plugin)Main.instance, "itemid");
                String id = item.getItemMeta().getPersistentDataContainer().get(key, PersistentDataType.STRING);
                ids.add(id);
                System.out.println(id);
            }
            else {
                ids.add(null);
            }
        }
        
        List<Recipe> recipes = new ArrayList<Recipe>(Main.instance.recipeManager.recipeMap.values());
        
        String outId = null;
        boolean recipeFound = false;
        
        int matches = 0;
        for (Recipe recipe : recipes) {
            if (matches > 8) {
                return recipe.idOut;
            }
            matches = 0;
            for (int index = 0; index < 9; index++) {
                if (ids.get(index).equals(recipe.idsIn[index])) {
                    matches++;
                    System.out.println(recipe.idsIn[index] + " == " + ids.get(index) + ", MATCHES TOTAL: " + matches);
                }
                else {
                    System.out.println(recipe.idsIn[index] + " != " + ids.get(index));
                }
            }
        }
        return null;
    }
    ```
#

ive used == and that also doesnt work

spiral light
#

== for strings will not work

#

equals should work if the case is the same ... equalsIgnoreCase could be an idea ^^

delicate cargo
#

its the same case

spiral light
#

ids.get(index).equals(recipe.idsIn[index])

maybe print them out with " and check then if it is rly the same and not just a space at the end

delicate cargo
#

Cannot invoke "String.equals(Object)" because the return value of "java.util.List.get(int)" is null

#

yeah i forgor that air in the crafting is null

#

i gotta do a null check

#

ok so i check if they both == null

#

and if they do then increment matches

#

otherwise do the .equals() check

#

another thing: if i use onEnable() called from Main.instance, will that reload the plugin?

spiral light
#

no

delicate cargo
#

alr

#

also the crafting thing works!

#

ty

quaint mantle
#

guys

#

i have EntityPlayer.getDataWatcher().watch(10, (byte) 127); in 1.8

#

how to do it in 1.9

spiral light
#

where is the problem ?

quaint mantle
#

i want to do this thing in 1.16

#

there is no watch method in 1.16

#

but set

#

but the params

#

is not int, byte

#

i dont get it

spiral light
#

it is DataWatcherObject and a Value right ?

quaint mantle
#

and a byte

spiral light
#

3 values or 2 values ?

quaint mantle
#

2

spiral light
#

the DataWatcherObject is defined in the nms.Entity class (there are different types (POSE,SILENT,GRAVITY....)) each extended class could have more defined DataWatcherObject's .... the byte could be the same like in 1.8

spiral light
quaint mantle
#

i use it to make an npc's second layer visible

spiral light
#

the customisations ?

pine elbow
#

hey guys, quick question about Vault.
I'm trying to add it as a optional dependency for some extra stuff but now my plugin wont load without it.
Pretty sure this is because I try and import net.milkbowl.vault.economy.Economy in my main class.
What's the proper way of going about this? Using a separate class that loads vault and only call that one if the plugin is found?

spiral light
#

softdepend and not depend in plugin.yml

pine elbow
#

Oh, derp. i had softdepends

spiral light
#

any errors in log ?

pine elbow
spiral light
#

do you check if the plugin is loaded in onEnable ?

pine elbow
#

I do ecoRef = setupEconomy(); in there

    private Economy setupEconomy() {

        if( checkDependency("vault")){
            RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
            if (economyProvider != null) {
                return economyProvider.getProvider();
            }else{
                return null;
            }
        }else{
            return null;
        }

    }```

```java

    public boolean checkDependency(String dep){
        return Bukkit.getServer().getPluginManager().getPlugin(dep) != null;
    }```
spiral light
#

and if you have setupEconomy() and it returns null then you dont load some events ?

pine elbow
#

Uhh, Well in the event i just do if(plugin.ecoRef != null) to not run the part that uses economy

#

Should i seperate that into a seperate event and just not load that then?

spiral light
#

you shouldn't try to register a class/event that has Economy stuff in it ... make a extra class to access economy stuff

pine elbow
#

Alright, Thanks!

quaint mantle
#

Hey, i have a subclass with some extra fields. How do i calculate a hashCode for it?

public final class ClanImpl extends AbstractClanBase implements Clan {
    private final int id;

    ClanImpl(int id, String tag,
                       Component displayName,
                       UUID owner, Map<UUID, ClanMember> memberMap,
                       Map<String, ClanHome> homeMap,
                       Map<StatisticType, Integer> statistics) {
        super(tag, displayName, owner, memberMap, homeMap, statistics);
        this.id = id;
    }

    @Override
    public int getId() {
        return id;
    }

    @Override
    public @NotNull DraftClan toDraft() {
        return new DraftClanImpl(getTag(), getDisplayName(), getOwner(), memberMap(), homeMap(), getStatistics());
    }

    @Override
    public boolean equals(Object o) {
        return super.equals(o);
    }

    @Override
    public int hashCode() {
        int result = super.hashCode();
        result = (31 * result) + id;
        return result;
    }

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(this).add("id", id).add("super", super.toString()).toString();
    }
}
spiral light
#

why do you need the hascode ?

upper mica
#

Hello, is it good to keep File instance, or should I create new instance every time I use method to get that file?

quaint mantle
spiral light
quaint mantle
#

so yes, it is fine

spiral light
#

if its just the file its ok... but configuration could be an issue

quaint mantle
spiral light
upper mica
quaint mantle
#

i need. toString, equals and hashCode should be overriden.]

desert loom
#

I believe both eclipse/intelliJ offer a way to automatically generate hashcode/equals if you want to use that.

#

other than that, it's best to just google the proper way to implement those methods.

wise prairie
#

Hello Im new to Spigot plugin development and I was trying to create a plugin taht will need to store data of players. I want to make a folder in which there will be a file for every player that has joined the server with there last location before logging off. So can you tell me how I can
read and write yml files in different directories.

quaint mantle
#
return Objects.hash(super.hashCode(), id);
#

ah

spiral light
wise prairie
#

Can you plese send me a link

spiral light
hushed scroll
#

Does anyone have suggestions or references for the best setup for intelij/docker development? Looking to make it as efficient as possible

tardy delta
#

is this the right way of making a hikari datasource?

#

i got an error which says it cant find a suitable driver

lavish hemlock
#

you might need to import a SQL driver

#

like MySQL's Java connector

tardy delta
#

how can i do that?

#

i thought hikari would handle that

lavish hemlock
#

just

#

add a dependency

#

and boom you're done afaik

tardy delta
#

oh

lavish hemlock
#

since most drivers use service location I think?

#

older versions would require you to load their classes via Class.forName but that's not the case anymore

digital drift
#
public HikariDataSource getDatasource(String jdbcUrl, String username, String password) {
        HikariConfig config = new HikariConfig();
        config.setJdbcUrl(jdbcUrl);
        config.addDataSourceProperty("user", username);
        config.addDataSourceProperty("password", password);
        config.addDataSourceProperty("cachePrepStmts", true);
        config.addDataSourceProperty("prepStmtCacheSize", 250);
        config.addDataSourceProperty("prepStmtCacheSqlLimit", 2048);
        config.addDataSourceProperty("useServerPrepStmts", true);
        config.addDataSourceProperty("cacheCallableStmts", true);
        config.addDataSourceProperty("alwaysSendSetIsolation", false);
        config.addDataSourceProperty("cacheServerConfiguration", true);
        config.addDataSourceProperty("elideSetAutoCommits", true);
        config.addDataSourceProperty("useLocalSessionState", true);
        config.addDataSourceProperty("characterEncoding", "utf8");
        config.addDataSourceProperty("useUnicode", "true");
        config.addDataSourceProperty("maxLifetime", TimeUnit.MINUTES.toMillis(10));
        config.setConnectionTimeout(TimeUnit.SECONDS.toMillis(15));
        config.setLeakDetectionThreshold(TimeUnit.SECONDS.toMillis(10));
        return new HikariDataSource(config);
}
#

this always works

#

and shading hikari also includes the driver

#

what version of minecraft you running?

#

more specifically, some forge spigot hybrids like to goob up the classloaders where it can't find hikari or something weird like that

lavish hemlock
#

anyone else really hate stuff like Map<String, Object> for properties?

digital drift
#

because Object is basically dynamic typing?

lavish hemlock
#

well yeah but also bc the config property names become magic constants

quaint mantle
#

don't you have to set driver class name

digital drift
#

oh yeah

tardy delta
#

idk why people use a HikariConfig for the addDataSourceProperty methods, there is one in HikariDataSource too

digital drift
#

hikaricp handles that

tardy delta
#

oh

digital drift
zealous osprey
#

I also have a question, not concerning dbs tho.
I want to create an instance of a class using the

someClass.getDeclaredConstructor(x.class, y.class, ...).newInstance(a, b);

Thing is though that I have more than one constructor in my class which I'm inistiating, which seems to be causing an issue I guess cause I get the

 java.lang.NoSuchMethodException

Any words of advice why it isn't working ?

digital drift
#

what's the class?

#

can you send a screenshot so we can see the constructor definition?

zealous osprey
tardy delta
#

i'll try to recreate the error

quaint mantle
#

nothing special

#

now show exact code which causes the rror

zealous osprey
#

The bottom one is the specific constructor which I'm using, the one I want to use, but it just doesnt

quaint mantle
#

and by the way, why do you need to access constructor with reflect?

digital drift
#

idk, probably make sure you are using the same classes, like also checking your imports to make sure it's the exact same class

#

but why reflect lol

tardy delta
#

calling this(...) is also something

zealous osprey
tardy delta
#

instead of doing constructor stuff two times

zenith torrent
#

Is there any plugin/datapack which allows to make haste potion? And any datapack/plugin to create portals or smth, I need it to play survival with friends, I can't find anything for 1.18

digital drift
tardy delta
#

?paste

undone axleBOT
digital drift
#

you don't ever really wanna use reflect anyways for that, because something about the jvm GC or something something

zealous osprey
#

except that it is an abstract class

digital drift
#

i'm too tired to remember rn

quaint mantle
#

factory pattern is a way to go

digital drift
#

what you could do is make it not an abstract class, and those abstract methods, just make them empty

quaint mantle
#

in what context you are instantinating them

digital drift
#

so they can be override by children

quaint mantle
#

ah i see

#

itemType

acoustic pendant
#

why am i getting this error in my plugin?

#

customrecipes

tardy delta
#

wrong key name for a namespaced key?

quaint mantle
#

@zealous osprey

tardy delta
#

i think you're lacking one of these

quaint mantle
#
package com.manya.test;

import org.bukkit.inventory.ItemStack;

import java.util.UUID;

public class Items {

    static abstract class AbstractItem {
        private final ItemType type;

        public AbstractItem(ItemType type, ItemStack item, UUID uuid) {

            this.type = type;
        }
        // stuff
    }

    static class Item1 extends AbstractItem {

        public Item1(ItemType type, ItemStack item, UUID uuid) {
            super(type, item, uuid);
        }
    }

    static class Item2 extends AbstractItem {

        public Item2(ItemType type, ItemStack item, UUID uuid) {
            super(type, item, uuid);
        }
    }
    @FunctionalInterface
    interface ItemFactory<T extends AbstractItem> {
        T create(ItemType type, ItemStack item, UUID uuid);
    }

    enum ItemType {
        ITEM1(Item1::new),
        ITEM2(Item2::new);

        private final ItemFactory<?> factory;

        ItemType(ItemFactory<?> factory) {

            this.factory = factory;
        }
        
        public AbstractItem create(ItemStack item, UUID uuid) {
            return factory.create(this, item, uuid);
        }

    }
}
#

quick solution i made that works without refleciton

zealous osprey
#

That is very generous, sadly I gtg now, Ill pin it down somewhere and look trough it later, but thx ;P

tardy delta
#

whats the use of the itemfactory?

halcyon shuttle
#

yo guys any idea on why is spigot highlighting commandexecutor and changing it to executor? package me.Stephen.FirstPlugin.commands;

import me.Stephen.FirstPlugin.Main;

import org.bukkit.command.CommandExecutor;

public class HelloCommand implements CommandExecutor {

private Main plugin;

public HelloCommand(Main plugin){
    this.plugin = plugin;
}

}

Also its highlighting org.bukkit

quaint mantle
tardy delta
#

oooh i see

quaint mantle
#

so for every type you create a factory that creates new Items

acoustic pendant
lavish hemlock
#

factory patterns are nice just for cleanliness

quaint mantle
#

wha

tardy delta
#

but it says invalid key "&adiamond helmet"

lavish hemlock
#

I mean if you're trying to access minecraft:diamond_helmet, I don't think you should use your plugin as the namespace

tardy delta
#

so in some way its coloured

#

maow can you check my error about the mysql driver?

acoustic pendant
#

and then the name

acoustic pendant
tardy delta
#

well this line gets triggered

#

and as you say the displayname is &adiamond helmet

#

are you sure you use "diamond_helmet" as a key and not the coloured displayname?

#

i dont understand why i have three times my jar when running mvn package

#

i'm shading

dark arrow
#

how to summon mobs with nbt tags?

tardy delta
#

and not relocating stuff

acoustic pendant
tardy delta
#

for the lore use Arrays.asList tho

#

i dont understand it about the namepacedkey

tacit drift
#

wtf

#

tried like 5 times

#

it won't download minecraft_server.1.8.jar

halcyon shuttle
tardy delta
#

can you send a screen?

halcyon shuttle
#

Sure 1 sec

spiral light
acoustic pendant
spiral light
#

is there smth after ShapedRecipe recipe = ... ?

#

because just define a key and the result will not create the recipe

acoustic pendant
spiral light
#

what is the problem ?

halcyon shuttle
tardy delta
#

import it

halcyon shuttle
#

em

#

what do you mean

acoustic pendant
halcyon shuttle
acoustic pendant
#

i have changed many things about colors but don't really now what's happening

halcyon shuttle
#

i did and whole thing broke but ill try again

#

something like this?

tardy delta
#

hover over the red line ._.

halcyon shuttle
#

should i send a screen of that as well? it says to change commandexecutor to executor in general

#

and also to create class org,bukkit

halcyon shuttle
acoustic pendant
halcyon shuttle
eternal oxide
#

You created both CommandExecutor as a class and JavaPlugin

tardy delta
#

wait

eternal oxide
#

You have no Spigot/Bukkit dependency and then followed the IDE suggestion to create the class

tardy delta
#

ah i understand

halcyon shuttle
#

Well how can i fix that?

eternal oxide
halcyon shuttle
eternal oxide
#

go through that tutorial (its not for 1.18)

#

once you have it working you can then learn the 1.18 specific setup

halcyon shuttle
eternal oxide
#

bad title? the link is fine

halcyon shuttle
ancient plank
#

The link embed removal is fked for me

halcyon shuttle
#

Idk it showed me this

eternal oxide
ancient plank
worldly ingot
#

There are several things that your group must not begin with and those are:
[...]
net.bukkit
com.bukkit
[...]
com.mojang
I don't think those three are true anymore... unless I'm mistaken

#

orgbukkit and nms are true though

halcyon shuttle
worldly ingot
#

Yeah. It's just the two

        if (name.startsWith("org.bukkit.") || name.startsWith("net.minecraft.")) {
            throw new ClassNotFoundException(name);
        }```
#

Others aren't inforced, just strongly discouraged lol

halcyon shuttle
#

I mean it starts with org.bukkit

halcyon shuttle
scenic hornet
#

So i have been having trouble finding this, bur im trying to find a plugin that can connect to my bungeecord server and to a discord bot, but i look everywhere but i can’t find anything

cold field
#

Hi Conclure, first thing first. Happy Christmas. Whenever you have time it would be great

summer scroll
#

That's how it is I guess

eternal oxide
#

First start is slow due to downloading libraries

young knoll
#

Because it has to load the world spawns

#

Heck, if it’s a first start it has to generate the world spawns

eternal oxide
#

yep

#

which part is slow?

summer scroll
#

Yeah the world part

young knoll
#

I can’t imagine the vanilla server is any better

eternal oxide
#

I had an MC server freeze just after assigning its port due to having a SatNav plugged in, it saw two networks and attempted to acces the net over teh Satnav, before failing and using teh correct network

paper viper
#

why do you use powershell XD

summer scroll
#

Other things are nicer other than startup time honestly xd

dark arrow
#

hey is it possible to increases the mob spawning rate?

#

how?

summer scroll
#

You can't use getEntities method with async

#

I don't know, but I don't think you can use getEntities with async in any versions.

#

Maybe, I never used that method before.

#

Well, bukkit methods aren't thread-safe so we can't call it async.

young knoll
#

Well, some are

summer scroll
#

Sure

eager escarp
#

Yo anyone know a plugin that works for 1.18 that clears items from the ground ?

quaint mantle
eternal oxide
#

I've always been fine reading chunk data Async, but recently Entities seem to have been broken out

quaint mantle
#

Well if you develop a normal java applications most likely it's not thread-safe unless you really try to do so

eternal oxide
#

I think 17 got dedicated events for entity loading

quaint mantle
#

What's the point of that plugin?

#

Just ask

#

Like support server owner?

#

Or what

#

Lul

young knoll
#

Windows Microsoft 11

quaint mantle
#

Gib link

#

10 seconds have passed

young knoll
#

The formatting in the htop section is a bit of a mess

quaint mantle
#

hello, i need some help
do you know how kill entity ? (Enderdragon)

i absolutely tested everything,
i looped all worlds & entities,

i have EnderDragon instance bc it's custom dragon, i set his life to 0, damaged health*2, it didn't worked,
i emulated /kill @e, it didn't work too, sometimes dragon stays alive

young knoll
#

.remove?

quaint mantle
tardy delta
#

yes

quaint mantle
#
private EntityEnderDragon dragon;```
summer scroll
#

is that nms?

young knoll
#

(Yes)

vague oracle
#

You will have to send an entity destroy packet

summer scroll
#

so it's sended by packet?

vague oracle
#

with the entity ID

summer scroll
#

yes, send a destroy packet

quaint mantle
tardy delta
#

use EnderDragon class

young knoll
#

I mean NMS doesn’t always mean packet

quaint mantle
tardy delta
#

hmm

quaint mantle
#
        AttributeInstance attributesHeal = dragon.getAttributeInstance(GenericAttributes.maxHealth);
        AttributeModifier modifierHeal = new AttributeModifier(maxHealthUID, "health",
                config.getDouble("ENDERDRAGON.health") - 1, 1);
        attributesHeal.b(modifierHeal);
        attributesHeal.a(modifierHeal);
        dragon.expToDrop = 0;
        w.addEntity(dragon);```
#

w = world

young knoll
#

Why do you need NMS for attributes

quaint mantle
#
       World w = ((CraftWorld) location.getWorld()).getHandle();
        dragon = new EntityEnderDragon(w);
        dragon.getDragonControllerManager().setControllerPhase(DragonControllerPhase.i);
        dragon.setLocation(location.getX(), location.getY(), location.getZ(), w.random.nextFloat() * 360.0F,
                0.0F);```
young knoll
#

Are you on a 6 year old version

quaint mantle
ivory sleet
#

πŸ₯΄

young knoll
#

Pretty sure 1.12 had API methods for entity attributes

#

Idk even 1.12 is old

quaint mantle
#

/kill worked for me,

#

but sometimes, it didn't

#

so anyone have an idea ?

#
dragon.getBukkitEntity().remove();```
peak granite
#

how do i check if the inventory of a block (chest, hopper) isn't empty

lusty cipher
#

does Bukkit::shutdown save the world and everything?

young knoll
#

Yes

ivory sleet
#

Yep

lusty cipher
#

πŸ‘Œ

dark arrow
#

i have created a .jar file

#

but i need to edit it now

#

how will i do it

#

i accidently removed the .java file

#

thats why i cant open that

vale ember
#

decompile it, edit, and recompile ig?

peak granite
#

if (!event.getBlock().isEmpty()) {

#

doesn't work

#

it's true even tho the chest is empty

dark arrow
chrome beacon
young knoll
#

You need to get the state of the block

peak granite
#

if (!event.getBlock().getState().isEmpty()) { ?

#

isEmpty is in red

chrome beacon
#

Cast it to a chest and check block inventory

peak granite
#

wym

#

if ((Chest) event.getBlock().getState()).isEmpty() {

chrome beacon
#

add getBlockInventory before isEmpty

peak granite
#

if ((Chest) event.getBlock().getState())).getBlockInventory.isEmpty() {

chrome beacon
#

You missed () on getBlockInventory

peak granite
#

getBlockInventory doesn't exist

chrome beacon
#

Add another () around ((Chest) event.getBlock().getState()))

#

I think?

#

maybe please use variables too many () make me confused

#

If it still doesn't exist make sure you cast to the right Chest

peak granite
#

if (((Chest) event.getBlock().getState().getBlockInventory().isEmpty())) {

#

yeah

#

getBlockInventory doesn't work

ancient plank
#

readability 100

chrome beacon
#

It's the () missing around your cast

potent pecan
#

And how can I check it? It returns the internal crafting in both

peak granite
#

if ((((Chest)) event.getBlock().getState().getBlockInventory().isEmpty())) {

chrome beacon
#

Not that part

tardy delta
#

aaah

tardy delta
#

((((:

peak granite
#

if ((((Chest) event.getBlock().getState()).getBlockInventory().isEmpty())) {

#

isEmpty is red

chrome beacon
#

So getBlockInventory works?

peak granite
#

ye

chrome beacon
#

What version of spigot

peak granite
#

1.18.1

chrome beacon
#

It does exist

spiral light
chrome beacon
#

^^

lusty cipher
#

is there some way to schedule a task for which the delay decreases with each execution?
say the first delay would be 5 mins, then 2 mins, 30 seconds, ...

peak granite
#

wym

#

seperate?

spiral light
lusty cipher
#

well I figured it was gonna be something like that

#

:(

spiral light
peak granite
#

why do u need to do that

#

lo

#

just a waste of lines

ancient plank
#

readability, debugability

chrome beacon
lusty cipher
chrome beacon
#

You can create your own BukkitRunnable class containing the time and such and do you calculations on that

tardy delta
lusty cipher
#

for debugging, it's a good thing to do

spiral light
ancient plank
#

"unnecessary variables" sure maybe but I'd prefer "unnecessary variables" than this

if ((((Chest)) event.getBlock().getState().getBlockInventory().isEmpty())) {
spiral light
ancient plank
#

readability > "unnecessary variables"

peak granite
#

no

tardy delta
#

yea true ((((

worldly ingot
#

less lines != better

#

or faster

ancient plank
#

reminds me of the time someone challenged me to make a really compact method to read a file and print every line in console

#

because "python does it in less lines so python is better"

worldly ingot
#

I hate those people PES_HuhWtf

peak granite
#

I hate those people :PES_HuhWtf:

ancient plank
#
package me.adelemphii.randomstuff;

public class FileReader {
    public void readFile(String path) {
        try (java.io.BufferedReader reader = new java.io.BufferedReader(new java.io.FileReader(path))) {
            String line;
            while ((line = reader.readLine()) != null) System.out.println(line); // I usually don't format my code like this
        } catch (java.io.IOException ex) {
            System.out.println(ex.getMessage());
        }
    }
}
peak granite
#

u forgot to put the brackets in the same line

spiral light
#

boolean isEmpty = (((Chest) event.getBlock().getState()).getBlockInventory()).isEmpty();

peak granite
#

:D

spiral light
#

just some ( and ) and you can easy compress those 4 lines into a working 1-liner without errors ^^

worldly ingot
#

oof. it's the in-line imports that bother me

ancient plank
peak granite
#

same

ancient plank
#

but they were counting package & imports to the total length of the code :)

worldly ingot
#

^

desert loom
#

1 liner minus catch

worldly ingot
#

nio is great

ancient plank
#

I didn't know about nio at the time

worldly ingot
#

I don't use nio as much as I should

vague oracle
#

Is there anyway to cancel players from sprinting, tried the PlayerToggleSprintEvent but doesn't work, from what I have seen online you have to use hunger, but they were from like 4 years ago, wondering if anything has changed.

ancient plank
#

Player#setSprinting maybe?

blazing scarab
#

conclure do you do code reviews

tardy delta
#

is there a way to hide this in console?

vague oracle
young knoll
#

Yeah hunger is the go to still

ivory sleet
young knoll
#

Just write code to perform code reviews for you

spiral light
# ivory sleet Sometimes, tho nothing official or professional but yeah

btw ... since the initWorld calls the Event "WorldInitEvent" where you can disable the KeepSpawnInMemory and the Method prepareLevels gets called after that and will result into do nothing if in the Event KeepSpawnInMemory is set to false ^^ now you can do a PR because there can't be smth bad happen

blazing scarab
wide coyote
blazing scarab
#

well that manya did. i was just coding sql implementations

ivory sleet
#

A bit hard to just review an api πŸ˜…

chrome beacon
#

You could go through the winterjam project πŸ‘€

#

I'm 101% sure parts of it are bad

ivory sleet
#

Hmm nah, but sure, I have tried cloning it on my laptop with a hdd

#

Didn’t work out :/

chrome beacon
#

aight

blazing scarab
#

no singletones or circular dependencies at all!!!

ivory sleet
ivory sleet
chrome beacon
#

I actually like how the Minecraft code works and look. Sure performance may not be the best but it's honestly quite easy to understand

blazing scarab
#

is this a joke

chrome beacon
#

No >.<

ivory sleet
#

Yeah, I’d agree apart from their abstraction of lwjgp or whatever it’s called

blazing scarab
#

maybe it is easy to understand

#

but fuck

ivory sleet
#

Minecraft has some code which is reasonable, other parts which are a bit wtf

chrome beacon
#

The parts I've looked at are fine

#

Maybe exept the structure spawning

#

My head hurt after that one

ivory sleet
#

Yea, like iirc they had a singleton for a sneakythrower roo_confuse

#

Ah thanks

lavish hemlock
#

doesn't Minecraft have a method that crashes the game

chrome beacon
#

It does

tender shard
#

why though

chrome beacon
#

Forcing a crash report

#

For debugging I guess?

tender shard
#

ah okay

blazing scarab
#

bukkit's still bad

lavish hemlock
#

still sounds funny without context tho

spiral light
lavish hemlock
tender shard
#

maow you are sneaky

#

silently followed me on github

lavish hemlock
#

there was a way to do that loudly?

#

like what do I just go to general and uhh

#

that

tender shard
#

πŸ˜„ yeah that's it basically

#

you could have notified me using a carrier pigeon

lavish hemlock
#

ah, true

ivory sleet
#

Anyways gepron1x the api looks good, like the only thing I can really criticize apis for is if they’re improper (might be able to review it a bit more thorough given an implementation)

lavish hemlock
#

I don't trust birds

#

they're all secretly robotic government spies

tender shard
#

that's so true!

#

wait wut

#

why is my booster role gone lol

lavish hemlock
#

oh shit man is blue

#

laugh at him

#

🀣

tender shard
#

too late πŸ˜›

#

I'm now fabulous again

lavish hemlock
#

damn

cold field
#

I know that this might sound stupid but I will ask anyway. What are the pros of having an API?

dark arrow
#

is it possible to make 2 mobs fight each other?

lavish hemlock
#

not forcing people who want to extend your plugin to resort to hacky bullshit to do so

#

also makes your code cleaner in the end tbh

chrome beacon
spiral light
#

craftbukkit of "EnchantmentStorageMeta" ?

dark arrow
#

i have writen zombie.setTarget(skeleton)

chrome beacon
#

Make sure it doesn't change target

peak granite
#

Inventory inv = ((((Chest) event.getBlock().getState()).getBlockInventory()));
if it's a double chest, it only gets that half of the chest

chrome beacon
#

Yeah

spiral light
#

dont use getBlockInventory

chrome beacon
#

try getInventory

peak granite
#

can i get the full chest

#

ok let me try

chrome beacon
#

or check if it's a double chest and use that

tardy delta
#

but yea thats not server side

peak granite
#

btw does Inventory inv = ((((Chest) event.getBlock().getState()).getInventory())); work on items like hoppers

#

and furnaces ?

tardy delta
#

kinda the same

chrome beacon
#

no since you're casting it to a chest

tardy delta
#

smh

peak granite
#

how do i make it so it does

chrome beacon
#

Cast it to something the 3 share

tardy delta
#

(Hopper) maybe?

chrome beacon
#

Can't be bothered to look it up

peak granite
#

i'm trying to get all blocks that have inventories

tardy delta
#

ah in that way im stupid

spiral light
peak granite
#

getInventory doesn't work on Container

spiral light
#

i think it does

#

ah ... which version ? 1.8 ?

peak granite
#

no

#

1.18.1

upper mica
#

Is it good to keep world instance in inventory holder? Does inventory holder gets "finalized" or something after inventory is closed? Or should I use world's UID?

indigo cave
#

@upper mica not sure if the garbage collector would remove that

#

So better uses worlds uid

upper mica
#

Oh ok thanks

open lily
#

In command /a b c, the command label will be b, right?

peak granite
#

b and c are args

open lily
#

so a is a label, thanks

peak granite
#

anyone

upper mica
#

wait

spiral light
upper mica
#

I read your question wrong lol

lusty cipher
chrome beacon
#

Show it?

ancient plank
#

πŸ˜”

chrome beacon
#

Maybe we can help you clean it up

ancient plank
#

cleaning code up is fun

#

unless the code is such a mess that I can't even read it but y'know

peak granite
chrome beacon
#

I usually just tell myself "I'll do it later", never do or forget how the code works

spiral light
ancient plank
#

Rewrote half of my first plugin, haven't touched it in 6 months

lusty cipher
lusty cipher
peak granite
spiral light
#

" Inventory inv = ((((Chest) event.getBlock().getState()).getInventory()));"

peak granite
#

ok?

#

i changed it to Inventory inv = ((Chest) event.getBlock().getState()).getInventory();

spiral light
#

still 1-liner

peak granite
#

ok??

spiral light
#

try smth like
if(block.getState() instanceof Container)
Container con = block.getState()
Inventory inv = con.getInventory()

peak granite
#

Cannot resolve method 'getInventory' in 'Container'

spiral light
#

wrong container import ?

peak granite
#

no

#

net.minecraft.server.v1_18_R3.Container;

spiral light
#

yeah

#

wrong

#

you dont want to use nms

peak granite
#

what do i i import

#

org.bukkit.block.Container ?

#

?

chrome beacon
#

yes

peak granite
#

that's not an import

#

lol

chrome beacon
#

It is if you update

tender shard
#

whe tf is there still no release version of maven shade plugin for java 16?

tender shard
chrome beacon
#

It doesn't exist in 1.8

tender shard
#

aren't they on 1.18?

chrome beacon
#

Oh

peak granite
#

i updated

solid cargo
#

yo can a count of online players be a double?

#

so i can use Math.ceil

peak granite
#

ye

tender shard
#

of course you can cast ints to doubles

solid cargo
#

wait. i dont have really a testing enviorment for this.

#

but:
this should return half of players (rounded up) right?
double halfPlayers = Math.ceil(Bukkit.getOnlinePlayers().size() /2D);

tender shard
#

just test it πŸ˜›

solid cargo
#

i dont have where

#

i have no friends to test it with

tender shard
#

erm just replace Bukkit.getOnlinePlayers().size() with some random numbers πŸ˜›

peak granite
#

open more mcs

tender shard
#
    public static void main(String args[]) {
        for(int i = 0; i < 20; i++) {
            System.out.println("Half of "+i+" runded up: " + Math.ceil(i /2D));
        }
    }
#

Half of 0 runded up: 0.0
Half of 1 runded up: 1.0
Half of 2 runded up: 1.0
Half of 3 runded up: 2.0
Half of 4 runded up: 2.0
Half of 5 runded up: 3.0
Half of 6 runded up: 3.0
Half of 7 runded up: 4.0
Half of 8 runded up: 4.0
Half of 9 runded up: 5.0
Half of 10 runded up: 5.0
Half of 11 runded up: 6.0
Half of 12 runded up: 6.0
Half of 13 runded up: 7.0
Half of 14 runded up: 7.0
Half of 15 runded up: 8.0
Half of 16 runded up: 8.0
Half of 17 runded up: 9.0
Half of 18 runded up: 9.0
Half of 19 runded up: 10.0

#

ignore the typo

#

so yes, it works

solid cargo
#

ok thank you very much!

summer scroll
#

Can you somehow make fishing in lava possible?

upper mica
#

Does Chunk#getTileEntities() return in random order?

chrome beacon
tender shard
summer scroll
chrome beacon
#

Make the fish hook not sink

#

and float like it's on water. Then throw in some water particles and you're done

upper mica
tardy delta
#

does (null instanceof Player) causes an npr o what?

chrome beacon
#

It won't cause a null pointer if that's what you're asking

tardy delta
#

ok

#

some stupid thing i did

summer scroll
#

I want it that It can actually fishing just like in water

tardy delta
#

also whats faster for comparing player instances? the player object itself or the uuid?

fleet imp
#

i have my config.yml saved as config. how would i get a specific option from config

tardy delta
#

wdym saved as? is it a FileConfiguration object?

#

if true you can call config.getString("key") or config.getInt("key") etc stuff on it

chrome beacon
#

A teleport task timer might also work but it won't be exactly the same as the water behavior

tardy delta
leaden belfry
#

Hey! Does someone know how to filter command suggestions on BungeeCord? I want to remove /bungee, /glist, ... form the list, but could not find a way. On the spigot servers I did it with PlayerCommandSendEvent

summer scroll
chrome beacon
#

You'll have to figure it out on your own

summer scroll
#

I need some references

chrome beacon
#

NMS is your reference

summer scroll
leaden belfry
chrome beacon
leaden belfry
# eternal oxide permissions

True, but the problem are commands from other plugins. For now I have overwritten those commands from other plugins, reimplement the features and set the correct permissions πŸ€”

chrome beacon
sacred mountain
tardy delta
#

what would be the best way to wait a little before you teleport a player to spawn? i dont want to the player to teleport to a chunk which isnt loaded and makes them "fall in the void"

sacred mountain
#

help

tardy delta
#

what help?

sacred mountain
#

int hte screenshot

tardy delta
#

duplicated tag <dependencies></dependencies>

sacred mountain
#

apparently dependencies is an invalid name

#

oh

#

i dont have another dependencies tag tho

eternal oxide
#

I bet you do

sacred mountain
#

smh

#

i reloaded the IDE and the error is now gone. bruh

eternal oxide
#

ok bruh

mighty sparrow
#

happened for me too when I was coding on android studio

#

intellij moment

sacred mountain
#

i dont get it

#

oh well

#

thanks nanyways

mighty sparrow
#

try coding java on eclipse instead

tardy delta
#

async task that waits until chunk is loaded?

mighty sparrow
#

do a kotlin coroutine

tender shard
tardy delta
#

uhm you sure?

sacred mountain
#

anyone know why my pom.xml hasnt updated my plugin structure

#

is there an update project button on eclipse

tender shard
#

it has ways to teleport players async and load chunks async

#

and it falls back to sync chunk loading if you're running regular spigot

#

I use it in all my plugins that need to load chunks or teleport players

tardy delta
#

hmm i'll take a look at it

tender shard
ivory sleet
#

You need to reload maven project presumably

sacred mountain
tardy delta
ivory sleet
#

Because they’ve done it for you?

tardy delta
#

hmm yea also can i teleport async?

#

prob not

ivory sleet
#

Depends on what method you use

sacred mountain
tardy delta
#

Player#teleport

ivory sleet
#

That probably won’t work, at least not on spigot

#

Worth a try but yeah

#

Thread safety and concurrency updates dont come free sadly

tardy delta
#

meh i was thinking about async thread and call Thread.sleep until chunk is loaded

ivory sleet
#

Yuck

tardy delta
#

whats the difference between ++a and a++ in a single statement?

mighty sparrow
#

++ increments before