#help-development

1 messages ยท Page 1616 of 1

eternal oxide
#

because you will only have Monsters

#

just loop over teh returned entities

#

probably just array

crimson scarab
#

cant cast lambda parameter to monster

lunar schooner
#

I need to get the class of java.lang.Byte[], so I thought lets invoke java.lang.Class#arrayType() on java.lang.Byte, it did not like that ๐Ÿคฃ

valid crag
#

doesn't know what predicate is so doesn't use it in the getEntities call
uses a predicate in the stream filter call

eternal oxide
#

show the code you are actually trying

valid crag
#

byte[].class

lunar schooner
#

and now in C :/

#

Thats kindof where I was at lol

cold tartan
#

does anyone know how to load a preset world with a build? like create a new world and put a specific build in it

crimson scarab
#
for (Entity entity : event.getPlayer().getNearbyEntities(32, 32, 32, e -> { e instanceof Monster })) {
                BukkitTask task = new BukkitRunnable() {
                    public void run() {
                        if ((entity instanceof Monster || entity instanceof Player) && !entity.isDead()) {
                            entity.getWorld().strikeLightning(entity.getLocation());
                        }
                    }
                }.runTaskTimer(plugin, 20L, 20L);
            }
#

sorry once again

eternal oxide
#

why are you using a runnable?

crimson scarab
#

i want a delay

#

vetween strikes

#

and you cant freeze the thread

eternal oxide
#

you are creating a runnable for each entity 1 second later, but they all run in the same tick

#

you are also running a repeating task to fire a single lightning

valid crag
#

don't overload the scheduler

crimson scarab
#

how do you think i implement a delay then?

valid crag
#

instead of scheduling 100 tasks, 1 for each entity, schedule 1 task that processes all 100 entities

#

it will still be delayed, but less dumb

eternal oxide
#

they get damage by teh trident being dropped do them all at teh same time 1 second delayed

valid crag
#

i think this is the part where i say learn java

eternal oxide
#

you also check for player which will not be a monster

#

in the predicate you need to do all teh tests you need

#

a Predicate is simply a boolean test

crimson scarab
#

damn

lunar schooner
#

Ah, seems arrayType is implemented on java.lang.invoke.TypeDescriptor.OfField, darn

eternal oxide
#

so { e instanceof Monster || e instanceof Player}

lunar schooner
#

so err, where would one go about finding the actuall .class files of the java standard library? ๐Ÿค” i

crimson scarab
#

so if i want to do 1 task to process all the entites do i need a for loop inside the runnable

eternal oxide
#
final Collection<entity> entities = event.getPlayer().getNearbyEntities(32, 32, 32, e -> { e instanceof Monster || e instanceof Player });
    BukkitTask task = new BukkitRunnable() {
                    public void run() {
                        for (Entity entity : entities) {
                            entity.getWorld().strikeLightning(entity.getLocation());
                        }
                    }
                }.runTask(plugin, 20L);```
#

or something close

crimson scarab
#

thanks for all your help but im still getting an error here 32, 32, 32, e -> { e instanceof Monster || e instanceof Player });

eternal oxide
#

I've not got an ide up to check it

crimson scarab
#

inconvertible types

eternal oxide
#

a full error might be helpful

crimson scarab
#

Inconvertible types; cannot cast '<lambda parameter>' to 'org.bukkit.entity.Player'

paper viper
#

Just a quick question here. Is it fine to store your library instance as a singleton? (Like passing the instance around inside the framework). Currently i am using dependency injection to pass the instance around my library, but I have seen some people use singletons so that they don't have pass it in when using one of the library classes.

prime mountain
#

so i tried but I really do not like java and kotlin while a lot better, the entire ecosystem is more fragmented than ancient china

paper viper
#

how so

prime mountain
#

can i use mycommands to read and write from files and do math?

#

so i can cobble together functions and stuff

#

kinda like bash

lunar schooner
#

I'd say java has a great ecosystem tbh

#

Much, much better than the likes of C

lunar schooner
prime mountain
#

mavan and grandle, java not having a builtin package manager, there being no consistent basic gradle project details that dont assume you've worked with java before

tulip sky
#

how to open the book gui

prime mountain
#

thats just the tip of the iceberg

lunar schooner
#

Maven and Gradle work pretty much interchangeably in terms of dependencies

paper viper
#

Yeah

#

the Maven central is compatible in Gradle

lunar schooner
#

Sure, it's not as good as say Rust, but, its pretty decent still

paper viper
#

And also a built in package manager isnt necessary if gradle/maven already exists tbh

tulip sky
prime mountain
#

Ok so where do when im learning about compiling projects, does anyone even bother to tell me what Maven central is and what is from the stock marval, why would i ever choose gradle over mavel, why do the gradle build stuff end in a different suffix, etc

paper viper
#

thats what you have to learn.?

lunar schooner
#

so simply put

#

mavenCentral is a dependency repository

prime mountain
#

im not asking you

#

im just saying

lunar schooner
#

Seems pretty straightforward to me though

prime mountain
#

this is very obviously something made to makeup for oracles lack of care for java, and neither of them do a particularly good job at filling the void

paper viper
#

Oracle didnt create gradle or maven

#

lol

prime mountain
#

........

paper viper
#

Oh wait

#

yeah nvm

#

i read that sentence wrong

#

but yeah I think Oracle didnt bother to do anything about that

eager tusk
#

Hey guys, im searching for a "book gui" when a player joins it opens and theres a text, yk. does anyone know how i do it?

lunar schooner
#

I mean, they dont have the obligation to, so I dont blame them

paper viper
#

Also I feel like Gradle and Maven are very good anyways

#

we should be glad they exist

#

and use them

lunar schooner
#

I havent worked with Maven before, but Gradle is amazing

paper viper
#

Mhm

#

I used both

lunar schooner
#

Going further than Java too, works with CLang too if you want it to

paper viper
#

Gradle is pretty much like its own language

#

like almost

#

it tries to act as one

prime mountain
#

Maybe it was because i was diving through a bunch of weird Kotlin API spigot adaptions

paper viper
#

which is what makes it nice

lunar schooner
#

Groovy still scares me, but it works ๐Ÿคฃ

paper viper
#

(i mean technically it is cause groovy but you know what i mean)

#

lol

#

also the kotlin dsl too is cool

prime mountain
#

well

#

when i look up dsl

#

it tells me that a DSL is a

#

"Digital subscriber line"

paper viper
#

No

eager tusk
#
    broadcast "Welcome to Skript!"```
prime mountain
#

which isn't what that is

lunar schooner
paper viper
#

take some more effort googling lol

lunar schooner
#

So quick question, again JNI. Why the hell would JNIEnv#new_string() fail? I really cant figure it out, and the error is not at all usefull ๐Ÿคฃ

eager tusk
#

how the fuck can you all talk so long about fucking gradle and maven?

lunar schooner
#

too much time lol ยฏ_(ใƒ„)_/ยฏ

#

compiling Rust takes a bit, so I've got plenty time in between

lunar schooner
eager tusk
#

Ok

#

Can you answer me a question @lunar schooner

lunar schooner
#

sure

crimson scarab
#

how can i check if the player has no blocks above them

paper viper
#

get the location of the player

#

then loop Y value

#

get the Block from the location of Y value

#

if it isnt Air

#

and etc

eager tusk
lunar schooner
paper viper
#

Completely forgot about that lol

#

Use that

lunar schooner
eager tusk
#

no a book

lunar schooner
#

It's been a while since I've toyed with the GUI stuff in Spigot

tulip sky
#
{
    TArray<FVector> Generated;
    for (int32 x = floor(Pos.X / scalePoints) - pointsToCalculate; x < floor(Pos.X / scalePoints) + pointsToCalculate; x++)
    {
        for (int32 y = floor(Pos.Y / scalePoints) - pointsToCalculate; y < floor(Pos.Y / scalePoints) + pointsToCalculate; y++)
        {
            bool FoundSomething = false;
            for (int32 i = 0; i < Input.Num(); i++)
            {
                if (Input[i].X_Saved_Value == x && Input[i].Y_Saved_Value == y)
                {
                    Generated.Add(FVector(x * scalePoints - SelfPos.X,y * scalePoints - SelfPos.Y,Input[i].Z_Saved_Value));
                    FoundSomething = true;
                }
            }
            if (!FoundSomething)
            {
                Generated.Add(FVector(x * scalePoints - SelfPos.X,y * scalePoints - SelfPos.Y,TwoD_Perlin_Noise(x,y,scale,amplitude) - SelfPos.Z));
            }            
        }
    }
    Output.GeneratedPoints = Generated;
    Output.xFirstIndex = floor(Pos.X / scalePoints) - pointsToCalculate;
    Output.xLastIndex = floor(Pos.X / scalePoints) + pointsToCalculate;
    Output.yFirstIndex = floor(Pos.Y / scalePoints) - pointsToCalculate;
    Output.yLastIndex = floor(Pos.Y / scalePoints) + pointsToCalculate;
}```
bright jasper
#

How would i check if a user is between two opposite location objects

bright jasper
#

like two locations are points and it makes a box between those points like rise/run and i need to check between that box

lunar schooner
eager tusk
#

@lunar schooner this

lunar schooner
#

Thatll help you enormously to figure out the steps you need to take to get your result

tulip sky
#

C++ is better than Java, right?

lunar schooner
#

Disagreed

eager tusk
bright jasper
eager tusk
#

TheDutchMC

lunar schooner
#

C++ is better at certain things

#

but Java is better at other things

quaint mantle
#

how do i remove players from the online players counter with the ServerListPingEvent

bright jasper
#

C++ is what you write becomes code, which is better in many scenarios but it leaves room for memory leaks whereas in java its more difficult. A lot of code benefits from the way java does things. If you dont know what you are doing or are not fully attentive to your own code Java code will end up being more performant

quaint mantle
bright jasper
#

Also extending upon programs is more difficult in C++ since you need dynamic linking whereas in java you simply load classes into the JVM

eager tusk
lunar schooner
quaint mantle
bright jasper
eager tusk
#

Ok my guy

bright jasper
#

and learn, but once you do its way worth

keen acorn
#
        Villager villager = (Villager) e.getPlayer().getWorld().spawnEntity(e.getPlayer().getLocation().add(0, 100, 0), EntityType.VILLAGER);
        villager.setCustomName("Ender Dragon");
        List<MerchantRecipe> merchantRecipeList = new ArrayList<>();
        MerchantRecipe recipe = new MerchantRecipe(new ItemStack(Material.DIAMOND_SWORD), 1);
        recipe.setIngredients(Arrays.asList(new ItemStack(Material.ENDER_EYE, 6)));
        merchantRecipeList.add(recipe);
        villager.setProfession(Villager.Profession.ARMORER);
        villager.setVillagerLevel(1);
        villager.setVillagerType(Villager.Type.SNOW);
        villager.setRecipes(merchantRecipeList);
        villager.setGravity(false);
        villager.setInvisible(true);
        e.getPlayer().openMerchant(villager, true);
``` when this code runs, the villager gui opens for a split second then closes. regular vanilla vilagers work fine. clicking on this summoned villager also makes the GUi close
lunar schooner
#

using it right now actually! :"D

bright jasper
#

Its a bit harder in the sense that you cant just create a program that dynamically reads a "plugin" and just finds its entry function and injects itself in

lunar schooner
#

oh but you can ^_^

#

look into the libloading crate

bright jasper
#

๐Ÿ™ i need to recheck that then

quaint mantle
#

how do i remove players from the online players counter with the ServerListPingEvent, while keeping them online

lunar schooner
#

let me dig through my repos real quick and shoot you an example

bright jasper
#

For video games though i find Rust is a little lacking in terms of libraries. Atm making a 2d platformer in C++. Base engine is written in C++ but a lot of the game functionality in terms of world generators and weapon interactions are done in Lua

eternal oxide
# crimson scarab Inconvertible types; cannot cast '<lambda parameter>' to 'org.bukkit.entity.Play...

Sorry I had to leave for a bit. If you didn;t get it fixed...

final Collection<Entity> entities = event.getPlayer().getWorld().getNearbyEntities(player.getLocation(), 32D, 32D, 32D, (e) -> { return (e instanceof Monster || e instanceof Player); });
        
    BukkitTask task = new BukkitRunnable() {
        public void run() {
            for (Entity entity : entities) {
                entity.getWorld().strikeLightning(entity.getLocation());
            }
        }
    }.runTaskLater(plugin, 20L);```
bright jasper
#

Tried to do it in rust but it was a bit more locking/restrictive and opengl binding crates suck ass

#

so C++ is still king in gamedev

tulip sky
#

Im a Game dev ๐Ÿ˜‡ ๐Ÿ˜Œ

bright jasper
#

actually i didnt even use opengl i used BGFX which includes vulkan as well with a platform agnostic api

#

its really cool

quaint mantle
#

how do i remove players from the online players counter with the ServerListPingEvent, while keeping them online

lunar schooner
#
unsafe {
  let lib = match Library::new(filename.as_ref()) {
    Ok(lib) => lib,
    Err(e) => return Err(e.to_string())
  };

  //We need to stash it in a Vec due to lifetimes, libr MUST outlive plugin
  self.libs.push(lib);
  let lib = self.libs.last().unwrap();

  //Get the _plugin_create function from the library
  let constructor: Symbol<'_, *mut dyn Plugin> = match lib.get(b"_plugin_create") {
    Ok(symbol) => symbol,
    Err(e) => return Err(e.to_string())  
  };

  let boxed_raw: *mut dyn Plugin = constructor();
  Box::from_raw(boxed_raw)
}

This is all you need to do plugins

#

on the other side it's an extern C function

bright jasper
#

thats quite a bit easier than i thought actually

#

ill have to look into that

lunar schooner
bright jasper
#

aite need to go back to my original question making a graph one sec lmao

lunar schooner
#

so, what is wrong with this signature? [Ljava/lang/String;[Ljava/lang/Object;[Ljava/lang/Class;, I cant figure it out

keen acorn
#
        Villager villager = (Villager) e.getPlayer().getWorld().spawnEntity(e.getPlayer().getLocation().add(0, 100, 0), EntityType.VILLAGER);
        villager.setCustomName("Ender Dragon");
        List<MerchantRecipe> merchantRecipeList = new ArrayList<>();
        MerchantRecipe recipe = new MerchantRecipe(new ItemStack(Material.DIAMOND_SWORD), 1);
        recipe.setIngredients(Arrays.asList(new ItemStack(Material.ENDER_EYE, 6)));
        merchantRecipeList.add(recipe);
        villager.setProfession(Villager.Profession.ARMORER);
        villager.setVillagerLevel(1);
        villager.setVillagerType(Villager.Type.SNOW);
        villager.setRecipes(merchantRecipeList);
        villager.setGravity(false);
        villager.setInvisible(true);
        e.getPlayer().openMerchant(villager, true);
``` when this code runs, the villager gui opens for a split second then closes. regular vanilla vilagers work fine. clicking on this summoned villager also makes the GUi close

(please ping on response)
lunar schooner
#

O.o I just noticed it, I need to surround it with (..)V

crimson scarab
#

how to get a delay between loops

bright jasper
#

So here, I need a function that checks in between two opposite locations like a box and it either returns true or false (hence the colors of User(meant to write player but oh well already saved it)). What would be the equation for this

bright jasper
#

... did not know boundingbox was a thing

#

thanks

keen acorn
#

or smth like that

eternal oxide
bright jasper
#

Y coord

eternal oxide
keen acorn
bright jasper
#

ah

#

so just 0 for both would work

crimson scarab
#
            BukkitTask task = new BukkitRunnable() {
                public void run() {
                    for (Entity entity : entities) {
                        if (entity instanceof Monster && (world.getHighestBlockYAt(entity.getLocation()) < entity.getLocation().getY()) && !entity.isDead())
                            entity.getWorld().strikeLightning(entity.getLocation());
                            cancel();
                    }
                }
            }.runTaskTimer(plugin, 50L, 20L);
#

my issue is that the lightning lags the server

eternal oxide
#

no, has to be the same Y as yoru target location you want to test contains on

crimson scarab
#

and strikes all enemeis at once

eternal oxide
#

not difficult

keen acorn
eternal oxide
# crimson scarab and strikes all enemeis at once

Something like...

        final Entity[] entities = (Entity[]) event.getPlayer().getWorld().getNearbyEntities(player.getLocation(), 32D, 32D, 32D, (e) -> { return (e instanceof Monster || e instanceof Player); }).toArray();
        
        BukkitTask task = new BukkitRunnable() {
            int i = 0;
            public void run() {
                if (i >= entities.length) {
                    cancel();
                    return;
                }

                entities[i].getWorld().strikeLightning(entities[i].getLocation());
                i++
            }
        }.runTaskTimer(plugin, 20L, 20L);```
bright jasper
#
        // Event gets called on flag changes for some reason
        // Do not act on event if player is still on the plot when this happens
        Location location = ((Player) e.getPlotPlayer().getPlatformPlayer()).getLocation();
        if (BoundingBox.of(new Vector(plot.getTopAbs().getX(), plot.getTopAbs().getY(), plot.getTopAbs().getZ()),
                new Vector(plot.getBottomAbs().getX(), plot.getBottomAbs().getY(), plot.getBottomAbs().getZ()))
                .contains(location.getX(), location.getY(), location.getZ())) return;

tfw having to make a workaround because plotsquared has a bug

#

๐Ÿคก

keen acorn
#

pweeez

eternal oxide
keen acorn
#

maybe...

#

do they have to be close?

eternal oxide
#

I believe so

keen acorn
#

ok i will try smth 1 sec

wild reef
#

Hey is there anyone who could help me with using a Service from an other Plugin I've made? I did the same approach as always but doesn't work anymore, did that changed in 1.17? Just tell me if you need the code

eternal oxide
#

Nothing changed in teh service manager

wild reef
#

well that's how I am doing it rn:
Registering the service in onEnable

Bukkit.getServer().getServicesManager().register(PlayerRegisterService.class, this.registerService, this,
                    ServicePriority.Normal);

And here recieving the service in the other plugin (code also from onEnable)

RegisteredServiceProvider<PlayerRegisterService> provider = Bukkit.getServicesManager()
                .getRegistration(de.schmidi.playerRegistration.services.PlayerRegisterService.class);
        if (provider != null) {
            this.playerRegisterService = provider.getProvider();
        }

But the provider seems always to be null

crimson scarab
#

new error popping up

wild reef
#

The plugin is also running on the server

crimson scarab
#

java.lang.ClassCastException: class [Ljava.lang.Object; cannot be cast to class [Lorg.bukkit.entity.Entity; ([Ljava.lang.Object; is in module java.base of loader 'bootstrap'; [Lorg.bukkit.entity.Entity; is in unnamed module of loader 'app')

eternal oxide
#

yeah I thought it might do that due ot teh cast

#

its a simple fix. See if you can figure it out ๐Ÿ™‚

wild reef
eternal oxide
#

remove the cast for starters

crimson scarab
#

ok

#

now is the toarry and issue

eternal oxide
quaint mantle
#

how can i change the playercount on the ServerListPingEvent, i.e; hiding vanished/hidden players from the server list & playercount

wild reef
#

yea, that's from the plugin.yml:

depend: [PlayerRegistration, Vault]
eternal oxide
crimson scarab
#

ok i;ve got it working a slightly different way

eternal oxide
crimson scarab
#

but it is detecting the user me as a entity so can that be removed with predicate

eternal oxide
#

yes

#

add to the code in the Predicate to test if its you

wild reef
crimson scarab
#

alright i've got it working but i don't know if it will detect other players

#

does anyone know how to test another play

eternal oxide
#

what code did you put in teh Predicate to test?

crimson scarab
#

return ((e instanceof Monster || e instanceof Player) && e != event.getPlayer());

eternal oxide
#

ok

#

then yes it will pick up other players. Only the one dropping the staff will be ignored

crimson scarab
#

ah great

crude charm
#

This is really basic and I'm being dumb rn but how would I get the player I entered into a command e.g /punish bobby would make that say make a new punishment for bobby

eternal oxide
wild reef
eternal oxide
#

with getPlayer or getOfflinePlayer

crude charm
#

ok

eternal oxide
crude charm
bright jasper
#

I make do when PlotSquared API breaks and calls events when they shouldnt be

#
        // Event gets called on flag changes for some reason
        // Do not act on event if player is still on the plot when this happens
        Location location = ((Player) e.getPlotPlayer().getPlatformPlayer()).getLocation();
        if (BoundingBox.of(new Vector(plot.getTopAbs().getX() - 0.5, plot.getTopAbs().getY(), plot.getTopAbs().getZ() - 0.5),
                new Vector(plot.getBottomAbs().getX() + 0.5, plot.getBottomAbs().getY(), plot.getBottomAbs().getZ() + 0.5))
                .contains(location.getX(), location.getY(), location.getZ())) return;

had to do some weird shit like

eternal oxide
bright jasper
#

adding/subtracting 0.5 to a lot of the coords

crude charm
wild reef
eternal oxide
#

as you use it in the diamond before.

wild reef
eternal oxide
#

ah

#

yep, there should only be one class so it should make no difference

wild reef
#

yep, but u know sometimes strange things fix it

eternal oxide
#

yep

wild reef
#
System.out.println("known services: " + Bukkit.getServicesManager().getKnownServices());

this also shows the service

#

it is contained there, bruh

eternal oxide
#

Is your this.registerService actually an instance of PlayerRegisterService?

wild reef
#

yea

#

private PlayerRegisterService playerRegisterService;

eternal oxide
#

Then I see no reason for your issue ๐Ÿ˜ฆ

#

um, thats different

wild reef
#
RegisteredServiceProvider<PlayerRegisterService> provider = Bukkit.getServicesManager()
                .getRegistration(PlayerRegisterService.class);
        if (provider != null) {
            this.playerRegisterService = provider.getProvider();
        }
#

just a different variable name in the plugins

#

its the same var name in each plugin

eternal oxide
#

ok, but just so long as the instance you are registering this.registerService is the correct class

crude charm
#

How can I get the first argument (or zero) from outside the command?

wild reef
#

ye it is

eternal oxide
#

k

eternal oxide
wild reef
#

@eternal oxide

#

I really don't get it

eternal oxide
#

um, null?

lusty cipher
#

How can I get a list of all resources in my plugin?

wild reef
# eternal oxide um, null?

null comes from:

System.out.println(Bukkit.getServicesManager()
                .getRegistration(PlayerRegisterService.class));
lusty cipher
#

Oh I just thought of a genius idea to get a list of resources

eternal oxide
#

do both of your plugins use different packages?

#

you have no overlap?

wild reef
#
import de.schmidi.playerRegistration.services.PlayerRegisterService;
----
package de.schmidi.playerRegistration.services;
#

packages also match

crude charm
#

they cant be declared outside it

eternal oxide
#

yep, I was just wondering if you have (by mistake) created a duplicate package/class locally in yoru plugin

bright quartz
#

any idea how i could replicate the spectator mode flight but without the noclip part?

sullen dome
#

is it possible to disable only THIS error when running an application? there's no way to prevent it, and imo it's annoying that it always opens a new tab, where it jumps to

bright quartz
#

just a way to make a player instantly transferred into flight and locked in flight (unable to double press spacebar to go out)

sullen dome
#

ah nvm, i see

bright quartz
#

spectators cannot double press space to get out of flight

#

they get locked in flight

sullen dome
#

yeah i see

#

you could set them flight again, when they stop flying

#

if thats possible with #setFlying

lusty cipher
#

I assume the top half of a door is placed 1 tick after the other?

sullen dome
#

probably

#

notexture cool cool cool

bright quartz
#

also, i feel i should not

#

player.setFlying(); does not actually set them into the fly mode

#

it will most definitely stop you from flying if you are flying

#

but if you're on the ground it will not transfer you into flight mode immediately

#

it will only do that if you jump

#

wait what if i just teleport the player like one block up i think that would work

unique halo
#

how do i hit a entity through spigot code, i have the entity , and player
i tried

( (CraftEntity) e ).getHandle().damageEntity( DamageSource.playerAttack( (EntityHuman) p ), 1.0f);

but i just get errors

#

spigot 1.8.8 btw

digital plinth
#

never seen this error

#

wierd

#

this kind of error dont show up even when i frgot the command section in plugin yml

eternal oxide
#

Your command is not in your plugin.yml

digital plinth
#

but it is in it

eternal oxide
#

nope

digital plinth
eternal oxide
#

that error says the command you tried to retrieve is not there

digital plinth
#

id i palce the yml in the wrong place?

sullen dome
#

but idk exactly

digital plinth
eternal oxide
#

plugin.yml goes in resources

digital plinth
#

i dont remember such error show up when i forget stuff in yml

#

oh

#

okay thx

digital plinth
#

dream did make the minecrfat but always flying plugin

#

try cracking them open i suppose

mellow beacon
#

Can anyone help me figure out why this is red and why no essentials commands or chat prefixes are working?

bright quartz
#

if(player.getInventory().getItemInMainHand().getItemMeta().equals(ItemData.SPIRIT_STAFF.getItemMeta())) any idea why this isn't working? if i have my code right, the item meta of the item in the main hand should be identical to the itemmeta for the spirit staff because they are the exact same item

#

okay looking at my console i get the error Caused by: java.lang.NoSuchMethodError: 'org.bukkit.inventory.ItemStack org.bukkit.inventory.PlayerInventory.getItemInMainHand()'

lusty cipher
#

@mellow beacon Essentials failed to enable. Look into your console, there's probably some error message there.

quaint mantle
#

What would be the best way to store Quest data?

lusty cipher
#

SQL database is probably the best way

quaint mantle
#

but in which way?

mellow beacon
crimson scarab
#

hey I know this is dumb but how do I start a storm

#

i have googled it but its filled with plugins not help

proud basin
crimson scarab
#

my bad in java

crude charm
quaint mantle
#
private final Plugin plugin;

void run() {
    final Plugin p = this.plugin;
    new Lambda() -> {
        //p.method()
    }.run();
}
proud basin
lusty cipher
#

yes it is ^

crude charm
quaint mantle
#

?

crude charm
#

1 sec let me find the bloody class out of 500 lmfao

lusty cipher
#

final Plugin p = this.plugin; this is the relevant line

#

not the field above

#

you just have to create a copy of all variables as final variables before running the lambda method

crude charm
#

unless im blind I believe I dont have to get an instance of main, my util does that

quaint mantle
#

then why are you complaining

lusty cipher
#

The same applies for player and args btw

crude charm
lusty cipher
#

It's just basically you should do this with all variables that you use in lambdas

quaint mantle
#

we've already said everything you need to know

crude charm
#

but idk how to get an instance of the argument as I need stuff inside the method to define it

quaint mantle
#

just๐Ÿ‘use๐Ÿ‘final๐Ÿ‘variables

compact wigeon
#

Is there any good way (non-janky) to get around PlayerInteractEvent firing twice in 1.8.8 when right clicking certain intractable blocks such as cobble walls, fences, and crafting tables?

quaint mantle
#

you can compare them, if its under the cooldown time you ignore the event

compact wigeon
#

Thanks!

lusty cipher
#

why would one use 1.8.8 over 1.8.9 wtf

unique halo
young knoll
prisma needle
#

Hey guys, Is it possible to set multiple lines in the PlayerListHeader and PlayerListFooter? :)

young knoll
#

You can set them to 0 or subtract Heath directly

unique halo
crude charm
#

I want to get arg[0] in another class which is in another method

#

using final is efficient, yes but doesn't solve the problem

quaint mantle
#

Huh?

crude charm
#

like

#

/command player

and I want to get the player they enter in another class

quaint mantle
#

dependency injection

crude charm
#

hmm

#

ok

#

I do that with args right?

quaint mantle
#

you know java

#

Why does maven say cannot resolve the thingy when it's in the pom.xml with the repo?

#

maybe take a break

quaint mantle
#

send ss

#

lmao

#

one sec

#

trying to import NuVotifier

crude charm
quaint mantle
#

i need a server setup

quaint mantle
#

ight ty

#

how do i make a scoreboard

#

google

#

^

#

i suck

#

google

#

i will never make it as a dev

#

google

#

google^4

#

g o o g l e

#

there are spigot docs for a reason โค๏ธ

quaint mantle
#

What would be the best way to store quest Data via SQL?

dusk flicker
#

@ancient plank you want to deal with this kid if you around?

#

@grand swan sorry for the ping but like every staff is offline or DND/Away and this kid is just trolling and spamming channels

quaint mantle
#

or @quaint mantle

dusk flicker
#

imagine was offline so I didn't tag em

#

ยฏ_(ใƒ„)_/ยฏ

maiden mountain
#

Straight up proof when parents don't raise their kids

dusk flicker
#

fun fact there's two of them now

maiden mountain
#

Who?

quaint mantle
#

?kixk @normal citrus

#

?ban @normal citrus spam

undone axleBOT
#

Done. That felt good.

quaint mantle
#

and @lucid sapphire @quaint mantle

#

Yโ€™all need some fucking antispam

merry kindle
#

Hey i was wondering if this is possible with Pterodactyl?

Start a server in minecraft and a batch file will run to create that server on pterodactyl panel and then assign the ip and port(be a port from before so i don't got to open up tons of ports so for instance i log on my port is 25566 then quit and you login and take that port). Then all the files will go to the server that you just created. After everyone is off the server which ill just check that with bungeecord. Shut down and save the files then remove them. For someone else to use.

#

or the best way to just do it

fading lake
#

If you try to set a player flying to true before they're loaded in, does it have a chance of not setting flight ingame, but spigot thinking it is?

#

cause spigots giving me the wrong value for if a player is flying and I'm really confused

fading lake
lost matrix
fading lake
#

I tried delaying it by 200 ticks just to be sure, and it lead to the same issue, it just seems like the players flight and the spigot variable are unlinked for some reason

#

Printing isFlying returns true which is whats stumping me, even when the player isn't flying (allowflight is on), but fall dmg is still negated

lost matrix
#

Or spigot is acting weird.

fading lake
#
@EventHandler
private void onPlayerJoin(PlayerJoinEvent event) {
    Player player = event.getPlayer();
    Bukkit.getLogger().severe("1");
    if (player.hasPermission("hub.flight.auto")) {
        Bukkit.getLogger().severe("2");
        new BukkitRunnable() {
            @Override
            public void run() {
                player.setAllowFlight(true);
                player.setFlying(true);
                Bukkit.getLogger().severe("attempted change");
            }
        }.runTaskLater(HubCore.getCore(), 200);
    }    
}

Prints:
1
2
attempted change (after 10 secs)

#

printing isFlying on a timer loop is true until the player double jumps into flight, then disables it

young knoll
#

Are they on the ground

fading lake
#

Yes

lost matrix
#

What exactly doesnt work. What do you expect to happen and what is actually happening

fading lake
#

what I want it to do, is check if the player has that permission, and if they do, immediately launch them into flight when they join (not making them turn it on themselves by jumping into it, it already being on etc)

young knoll
#

Send them into the air first

fading lake
#

oh is it that simple lol

young knoll
#

The game disables flight when you touch the ground

#

And spigot may not notice that, might be a client side thing

lost matrix
#

If they stand on the ground then flying is disabled

fading lake
#

oh that makes sense, let me try it

lost matrix
#

Are you willing to use NMS? Because if its client side you can try and send a PacketPlayOutAbilities packet

#

But its most likely the fact that they are grounded

fading lake
#

yeah I'm fine using NMS, sorry give me a sec, servers acting weird

lost matrix
#

((CraftPlayer) player).getHandle().updateAbilities();
Try calling this manually

young knoll
#

It seems weird spigot thinks they are flying and the client doesnโ€™t

#

Unless something client side is going on

fading lake
fading lake
young knoll
#

Might be because you are calling setAllowFlight too

torn shuttle
#

finally, my rewrite is stable

#

boys, it feels good

#

it looks good, it works good

#

we good

digital plinth
lost matrix
young knoll
#

It probably varies

digital plinth
digital plinth
young knoll
#

Canโ€™t you just check which hand is being used in that case

lost matrix
#

If no events hook into them then it way under 0.01ms but if some Listeners tinker with the event then the discrepancy rises.

#

But you can get the hand that is related to the event from within it.

digital plinth
lost matrix
digital plinth
#

so this is how datapacks work

#

kinda weird

#

XD i think you are better off learning java and making plugins tbh

lost matrix
#
  @EventHandler
  public void onInteract(final PlayerInteractEvent event) {
    final Player player = event.getPlayer();
    final EquipmentSlot hand = event.getHand();
    if (hand == EquipmentSlot.HAND) {
      player.sendMessage("This is your main hand event.");
    } else {
      player.sendMessage("This is your off hand event.");
    }
  }
digital plinth
#

thx

lost matrix
#

I also went ahead and measured the delta of those two events

#

so around 50us - 80us on my machine

summer scroll
#

idk if this is helpful but the main hand will be called first, i remember do some testing before

#

just a fun fact ig

raw coral
#

Is there anything in the spigot api that allows me to stop mobs being able to travel throughout worlds

#

Ie: mob entering nether portal in the overworld and geting sent to the nether

raw coral
#

Ok thanks!

onyx fjord
#

This code might help

raw coral
#
 @EventHandler
    fun portalEvent(e: EntityPortalEvent){
        if(e.entity !is Player){
            e.isCancelled = true
        }
    }

think something like that will work?

onyx fjord
#

Try it and see peepoStare

#

Idk if that's personal preference but I prefer using !==

raw coral
#

or are you talking about something else

onyx fjord
#

Idk man, I'm not java expert

raw coral
#

anyway lol thats kotlin

#

that statement is

onyx fjord
#

Ohhh that's why

raw coral
#

!(e.entity instanceOf Player)

#

in java

onyx fjord
#

fun is having fun init

raw coral
#

yup

#

functions are lots of fun ๐Ÿ˜„

onyx fjord
#

Kotlin is like JavaScript syntax for java

#

I see similar stufd

formal warren
#

Hello, it is possible to make a Miencraft plugin as a web server?
Like, if someone dies, to be placed on a webpage that is created by the plugin?
Sorry if I sound dumb, I'm very new with those things xD
You guys here are the experts.

hybrid spoke
#

but your plugin wouldnt be a web server, it would just communicate with a web server

tribal holly
#

is it possible to summon an trident and apply it a vector like arrow ?

hybrid spoke
tribal holly
#

i know that's possible cause it extending arrow

#

but can't find doc for doing it

hybrid spoke
#

so you just wanna push the trident, right?

tribal holly
#

i wanna summon it at a location and apply it a custom vector

#

to make like a "trident rain"

#

and there's not attached to a plyer and cannot be pickable

hybrid spoke
#

spawning them already forces them to fall down

formal warren
tribal holly
hybrid spoke
#

and how would you like to apply a vector? do you mean setting the velocity?

hybrid spoke
tribal holly
#

well kinda dump i'm

hybrid spoke
# formal warren How is the Dynmap working?

A Google Maps-like map for your Minecraft server that can be viewed in a browser. Easy to set up when making use of Dynmap's integrated webserver which works out-of-the-box, while also available to be integrated into existing websites running on Apache and the like. Dynmap can render your worlds using different renderers, some suitable for performance, some for high detail.

#

since i didn't looked at the source code, if there is any public, i can't tell you what it does exactly. probably just doing some magical stuff and sending it to the webserver so it can display it

lost matrix
# formal warren How is the Dynmap working?

Dynmap loads every chunk one by one and makes a snapshot of it.
The 2D view is easily rendered by just getting the highest block on every x/z point in the chunk and then using the minecraft texture to render
a simple top down view.

The orthographic view on the other hand is a bit more complex to display as you need a proper 3D framework. A lot of it is just html, css and JavaScript.

formal warren
#

But Dynmap is working as a server, right? I mean, after I activate the plugin I can see the map in browser. So it doesn't communicate with someone externally, only itself and the server

opal juniper
#

myeah

#

it hosts the server in a new thread or whatever

#

as to not affect the mc server too much

formal warren
#

I see, thanks you for the time and the informations.
Programming is so haard.

lost matrix
#

Just looked at github. They start a simple jetty server to provide the website.

quaint mantle
#

Hello! I am trying to cancel item frames rotations on right click. Do you have idea?

#

This is what I tried:

#
    @EventHandler(ignoreCancelled = true)
    public void onPlayerRotateFurniture(PlayerInteractAtEntityEvent event) {
        Bukkit.broadcastMessage("OKAY");
        Bukkit.broadcastMessage("OKAYa: " + event.getRightClicked().getPersistentDataContainer().has(FURNITURE_KEY, PersistentDataType.STRING));
        if (event.getRightClicked() instanceof ItemFrame
                && event.getRightClicked().getPersistentDataContainer().has(FURNITURE_KEY, PersistentDataType.STRING)) {
            Bukkit.broadcastMessage("OKAY2");
            event.setCancelled(true);
        }
    }```
opal juniper
#

PlayerInteractEvent

quaint mantle
#

it is triggered, I get the 3 logs, but it is not cancelled

quaint mantle
opal juniper
#

mmm lemme see what you have done

#

Are you sure it is ItemFrame

quaint mantle
#

yes since it is detected

dense goblet
quaint mantle
#

I mean, I get the logs when I right click on it

opal juniper
#

no i mean instanceof ItemFrame

#

sometimes things have stupid names

quaint mantle
#

just the one that target item frames

quaint mantle
#

I get my "OKAY2" when I right click the item frame

#

so the right click on the item frame is detected

opal juniper
#

Remove the instanceof ItemFrame thing

#

cause

quaint mantle
#

why?

#

it won't change anything

opal juniper
#

only ur itemframes will have the data anyways

#

and it may be the issue

quaint mantle
#

No it can't be the issue

dense goblet
#

@quaint mantle

public void onItemUsedOnEntity(PlayerInteractEntityEvent e) {
        if(e.getRightClicked() instanceof ItemFrame)
            <code>
}
quaint mantle
#

since I get the "OKAY2" log

opal juniper
#

oh right

#

sorry

quaint mantle
#

no problems

#

I don't understand, they also use that event

#

bruh

#

I'll try with spigot instead of paper

dense goblet
#

What is not working for you?

#

You're using PlayerInteractAtEntityEvent but I used PlayerInteractEntityEvent

#

Idk the difference but might be the reason

#

Docs say it's the same but with the location, though they advise to listen to the other version (without At)

quaint mantle
#

good idea

#

Great job @dense goblet , that was the issue!

dense goblet
#

Nice!

waxen plaza
#

how is it called when a player is asked to say something in chat and the plugin gets the input without it being sent to chat?

chrome beacon
#

Listen to the chat event and cancel it

waxen plaza
#

thanks. ๐Ÿ™‚

grim ice
#

is Developing in paper better, or worse? I use JDK 8

dense goblet
#

If you need features of paper (like an AI api) then use paper

#

Otherwise just develop for spigot api as all spigot plugins work on paper

#

But not all paper plugins work on spigot

grim ice
#

Oh okay

dense goblet
#

There is I think PaperAPI which allows you to use paper features if the server is running on paper, and otherwise it uses the spigot version

#

Like async chunkloading

#

With paper it will do async, with spigot it will do sync

prime mountain
#

So i need to pipe deserlized numbers into mycommand

#

player x is the 32st to do this, read line 31 of coords.txt

#

the math is a little to hard to do on the stop without coding stuff

hybrid spoke
#

why a .txt if you could just use the supported .yml format

prime mountain
#

oh well then i could do a .yml format then

#

the specific file is not important aslong as it can hold ascii text

hybrid spoke
prime mountain
#

i dont really wanna make a plugin java is ugly ๐Ÿฅบ

#

and constraining because i just wanna use my terminal editors and live in peace, that or VSCODE

maiden thicket
#

java not ugly

ivory sleet
#

Ugliness doesnโ€™t make a language inherently worse (:

prime mountain
#

its less about the language its more about how confused I got when i tried to use gradle with kotlin and work with the 5 dozen unoffical apis

#

kinda just said "nope"

ivory sleet
#

Well you donโ€™t have to use 5 unofficial APIs, or gradle, or kotlin for that part

prime mountain
#

yea no after using kotlin over java im not even trying to use java, there is no point

ivory sleet
#

Lmao alright

wary harness
#

Small help around one thing
Is it good idead to block player i asyncpreloginevent
And load there data from mysql

#

So they are stuck in loading screen

#

Until data is retrived from mysql

undone axleBOT
chrome beacon
valid crag
#

yes

#

if the alternative is to block the join event

#

or if the alternative is to not have the player's data ready for when it's needed

hybrid spoke
#

or just let them join and freeze them until their data has been loaded

valid crag
#

and the server, too, if someone still wants to read the data

#

by the time the player is in the game their data should all be loaded and proper

#

anything else will run into issues when multiple plugins are at play

#

imagine for example an economy plugin that reported 0 for player's balances for the first 3 seconds they're online

keen acorn
#

Villager villager = (Villager) e.getPlayer().getWorld().spawnEntity(e.getPlayer().getLocation().add(0, 100, 0), EntityType.VILLAGER);
villager.setCustomName("Ender Dragon");
List<MerchantRecipe> merchantRecipeList = new ArrayList<>();
MerchantRecipe recipe = new MerchantRecipe(new ItemStack(Material.DIAMOND_SWORD), 1);
recipe.setIngredients(Arrays.asList(new ItemStack(Material.ENDER_EYE, 6)));
merchantRecipeList.add(recipe);
villager.setProfession(Villager.Profession.ARMORER);
villager.setVillagerLevel(1);
villager.setVillagerType(Villager.Type.SNOW);
villager.setRecipes(merchantRecipeList);
villager.setGravity(false);
villager.setInvisible(true);
e.getPlayer().openMerchant(villager, true);
when this code runs, the villager gui opens for a split second then closes. regular vanilla vilagers work fine. clicking on this summoned villager also makes the GUi close

(please ping on response)

undone axleBOT
keen acorn
#

when this code runs, the villager gui opens for a split second then closes. regular vanilla vilagers work fine. clicking on this summoned villager also makes the GUi close

(please ping on response)

hardy swan
#

does spigot itself use apache commons' WordUtils? why don't I have to shade it for my plugin to work?

indigo crypt
#

Does someone know how to loop it

quaint mantle
#

eclipse๐Ÿ˜ฌ

indigo crypt
#

i dont have any idea

indigo crypt
quaint mantle
#

Meh

#

while true do , or what you mean in Loop

indigo crypt
#

looping condition, if type.equal ZOMBIE, create Zombie variable. if type.equal SKELETON, create Skeleton variable and next...

#

how to do that

severe marsh
#

How do I make a countdown timer?

hybrid spoke
#

?scheduler

#

?scheduling

undone axleBOT
hybrid spoke
severe marsh
#

thank you

hybrid spoke
hybrid spoke
#

or what are you even trying to achieve

opal juniper
#

magic โญ

hybrid spoke
#

and check for each

indigo crypt
#

are you understand?

hybrid spoke
#

yeah and i just gave you what to loop over

#

to reach that

keen acorn
#

https://paste.md-5.net/sopogilode.coffeescript
when this code runs, the villager gui opens for a split second then closes. regular vanilla vilagers work fine. clicking on this summoned villager also makes the GUi close

(please ping on response)

hybrid spoke
#
for(entityType) {

  if(type.equals(entityType.name)) { yes }
}
wary harness
#

to save on every transaction

#

so if player switches server

#

data is already saved

#

and loaded

#

proparly on async pre login event

hybrid spoke
#

save it in an interval of X minutes and if they leave

wary harness
#

and then u get in problems like A server didn't save yet and player switched to server B

#

and loaded old balance before saving was finished on Server A

#

and that happens for many people because there servers are on different machines

hybrid spoke
#

and because of that you are saving the players data when he leaves the server

keen acorn
#

https://paste.md-5.net/sopogilode.coffeescript
when this code runs, the villager gui opens for a split second then closes. regular vanilla vilagers work fine. clicking on this summoned villager also makes the GUi close

(please ping on response)

is anyone going to help me

quaint mantle
#

hey how do i download a bukkit development build for making plugins

keen acorn
#

bukkit is outdated

#

use paper instead

quaint mantle
#

what if i want to update a bukkit plugin?

keen acorn
topaz moon
#

bukkit can run with spigot and paper

hybrid spoke
quaint mantle
#

alright thanks ill try

wary harness
#

event

#

mysql will not manage to save in time

keen acorn
wary harness
#

and server b will load old amount

hybrid spoke
keen acorn
#

its running the event twice because i am in creative mode i think

hybrid spoke
keen acorn
#

interactatentity

hybrid spoke
#

there we have the issue

#

cancel the event

#

ofc its not working

wary harness
summer scroll
#

Probably because you have two hands now.

wary harness
#

send amount of tokens from server a to b

#

thru messaging chanel

hybrid spoke
keen acorn
#

@hybrid spoke i am not checking if they are clicking a villager, I am checking if they are clicking an ender dragon

wary harness
#

interect event goes 2 times

hybrid spoke
#

listen for the hand

#

just like aglerr said

summer scroll
severe marsh
hybrid spoke
summer scroll
hybrid spoke
#

either getting it by singleton or DI

severe marsh
hardy swan
#

||Bukkit.getPluginManager().getPlugin("lmao");||

severe marsh
#

thanks

hardy swan
#

no don't quote me

#

that's not what they meant

#

although I also don't see a problem with doing that

summer scroll
#

cmon xd

opal juniper
summer scroll
#

bad guy

hybrid spoke
#

or go this way

public static final String plugin-name;

public void onEnable() {

  plugin-name = "YOUR_PLUGIN_NAME";
}

public void getPlugin-Name() {
  return plugin-name;
}
hardy swan
#

ok, I don't see a reason for dependency injection if the class doesn't even need any aspect of the instance instead of just passing it around like volleyball (e.g. using it for BukkitScheduler#runTask). But I also object having a singleton because it is illogical design-wise.

#

oh, he just needed the name?

summer scroll
#

no xd

#

he needs the instance of the main class to use scheduler

hardy swan
#

oh okk lol

hybrid spoke
#

i thought imma getting shittalked

#

because everything was wrong about this

#

but okay nvm

indigo crypt
#

Back to my problem:

    Zombie ent = (Zombie) mob;
}else if(type.equals("SKELETON")) {
    Skeleton ent = (Skeleton) mob;
}
// Looping to make variable
ent.justCallIt(true);```
I don't know how to explain it, I want loop condition to make some variable, and call it
#

like this code

hybrid spoke
#

didnt i just

#

gave you the solution?

hardy swan
#

type.equals("ZOMBIE") looks wrong

#

it should be around the lines of mob instanceof Zombie

indigo crypt
hybrid spoke
#

you wanted to have a loop for your type.equals thing

#

to avoid calling it for every entity

indigo crypt
#

maybe yes

hybrid spoke
#

otherwise EntityType#valueOf(type) is also a solution

#

and checking with instanceof afterwards

#

instead of an equal check

ancient plank
indigo crypt
#

ohh god, i dont know how to explain it

hybrid spoke
#

visualize it

keen acorn
#

ok i got it fixed with the double event thing ty bye

indigo crypt
#

normal code to use
Zombie entity = (Zombie) someEntity
and
Skeleton entity = (Skeleton) someEntity
and i want to make loop like this

  // make entity as Zombie
  Zombie entity = (Zombie) someEntity;
} else if(SomeString.equals("skele")){
  // make entity as Skeleton
  Skeleton entity = (Skeleton) someEntity;
}
// example output SomeString is jombie
entity.execute();```
are you understand
valid crag
#

for (entitytype et : entitytype.values()) if et.getentityclass().isinstance(mob) et.getentityclass().cast(mob)

#

literally no point in that though, that's not how java works

maiden briar
#

Does anyone know what (int) aInteger %2 does?

valid crag
#

takes mod 2 of ainteger

maiden briar
#

I don't understand

#

Will it take 50%?

valid crag
#

that takes mod 50 of ainteger

indigo crypt
maiden briar
#

So if it is 100 it returns 50?

valid crag
#

x % 2 divides x by 2 and returns the remainder

#

100 % 50 returns 0

#

because 100 is divided by 50 evenly to 2

#

with no remainder

maiden briar
#

Ah thx

valid crag
#

google modulus

#

this is basic math

maiden briar
#

Ok

tacit drift
#

can i get rid of

#

"Unknown map"?

valid crag
#

probably not

tacit drift
#

f

indigo crypt
valid crag
#

literally what

severe marsh
hybrid spoke
#

what

#

Entity.valueOf("Zombie") ent = (Entity.valueOf("Zombie")) someEntity; ?

valid crag
#

learn java'

chrome beacon
valid crag
#

java is strongly typed

severe marsh
#

How can I make countdown then?

valid crag
#

which means that you cannot dynamically define the type of a variable

hybrid spoke
#

or dont make it a local var

valid crag
#

you can only directly declare it as a Zombie or a Skeleton or whatever

severe marsh
#

hmmm alright ty

valid crag
#

the best you can do is generic type parameters and shit but that is far from what you want

indigo crypt
#

i dont know how to explain it. i want make some LivingEntity variable as Zombie or Skeleton
LivingEntity mob = (LivingEntity) mlocs.getWorld().spawnEntity(someLocation, EntityType.ZOMBIE);
and i want to make living entity as Zombie
normaly i use
Zombie ent = (Zombie) mob;
and use ent variable

and how to i make it to i check if mob type is skeleton and make mob as skeleton like this:
Skeleton ent = (Skeleton) mob;
someone understand it?

valid crag
#

use World::spawn

#

instead of spawnEntity

#

and pass the entity class instead of entity type

#

and it'll return an instance of that class and you don't need to cast or think about anything

indigo crypt
#

hmmm, wait. i will try it

indigo crypt
quaint mantle
#

why if, when variants more than 1?

valid crag
#

it would be helpful if you mentioned what the fuck you were doing

indigo crypt
valid crag
#

so far all we've heard has been incomprehensible babbling about loops and skeletons

#

what are you doing

indigo crypt
#

i want to pass entity class to some mob according condition, if string == jombie
pass entity class Zombie, and if string == some mob, pass entity class someMob

indigo crypt
valid crag
#

that is your attempted solution

#

but what are you actually doing

#

what are you trying to achieve

indigo crypt
#

?paste

undone axleBOT
hybrid spoke
indigo crypt
#

how to do that

hybrid spoke
#

it seems to me

#

that you don't even have to cast

dense goblet
#

You want different behaviour for every mob right

hybrid spoke
#

just use the superclass LivingEntity

valid crag
#

learn oop

#

a for loop will not help you here

hybrid spoke
#

it will make it cleaner for sure

#

but he should also split it in several methods

valid crag
#

instead of passing a string to this function, you should pass an object that defines the behavior you're stacking in here

#

this is a textbook example of oop being done wrong

indigo crypt
quaint mantle
#

how do i check for errors in eclipse

indigo crypt
dense goblet
# indigo crypt yes

Then you should use a hashmap between whatever you use to identify a mob and an object which applies the desired changes

dense goblet
#

Also try to re-use code where possible

#

Instead of having lots of similar lines

indigo crypt
indigo crypt
dense goblet
#

Just have one function for that and make them all use it

quaint mantle
#

hey if im updating a plugin and if i just add the latest spigot in the build path do i need to add the previous spigots the plugin was built with

chrome beacon
#

No

quaint mantle
#

thanks

chrome beacon
#

Well not unless it contains NMS

severe marsh
#
        new BukkitRunnable() {
            int countdownTime = 10;
            String word = "seconds";
            @Override
            public void run() {
                if (countdownTime == 0) {
                    player.sendMessage("Countdown over.");
                    // do something to stop it

                }
                if (countdownTime == 1) {
                    word = "second";
                }
                Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', "&6[&eArena&6] &7Match starts in " + countdownTime + " " + word + "."));
                countdownTime--;
            }
        }.runTaskTimer(Bukkit.getPluginManager().getPlugin("ArenaPlugin"), 100L, 20L);
``` How do I stop this task after `countdownTime` has hit 0?
kind coral
#

hi guys how would i make a custom plugin loader? i have a plugin that can have many addons, and i dont want to put them in the plugins folder

chrome beacon
grim ice
#

uh

#

what does they mean ehre

grim ice
#

can someone give me an example instead of psuedocode?

hybrid spoke
grim ice
#

the

dusk flicker
#

That's real code they have just it's a cleaner format for return statements that depend on conditions

grim ice
chrome beacon
grim ice
#

whatever

#

i dont get it tho

summer scroll
#

condition is boolean

dusk flicker
#

Do you understand the top if statement?

hybrid spoke
#
public SpawnTask createAFuckingSpawnTask() {
  return (spawnTaskList.hasSpace() ? new SpawnTask() : null);
}
``` or whatever

can be understood as

return a new SpawnTask if the list has space and if not return nothing (null (null isnt really nothing))
severe marsh
#

How do I cancel Runnable task?

dusk flicker
#

Basically a condition followed by a ? Operator is the same thing as an if statement, and the following param will be sent if it is true and the operator after : is what to return if it is false

summer scroll
#

boolean ? true : false;

dusk flicker
#

If you use IntelliJ it will auto suggest improvements to your code that use those statements

kind coral
severe marsh
torn shuttle
#

hm I have an idea but I should really talk to resource staff about it

#

is there a way to speak to resource staff directly?

dusk flicker
#

?support

undone axleBOT
dusk flicker
#

Or dm optic

#

@vagrant stratus ping ref ^

torn shuttle
#

yeah figures dms are closed

#

or maybe mine are

dusk flicker
#

Its yours I believe

torn shuttle
#

oh it was mine

#

huh

quaint mantle
#

can i get some help?
on line 29 if i add a sound other than the one already entered it gives me an error saying ""sound name" cannot be resolved or is not a field

paper viper
#

What other sound are you using

quaint mantle
#

im trying to replace that with block.bell.use

paper viper
#

Isnโ€™t that a sound too?

#

Just get it from the enum

severe marsh
#

How do I disable block drops?

high pewter
#

How do I safely get the UUID of a player (who has to have connected to the server atleast once in the past, but may or may not be currently online) from their playername in Bungeecord? I'm trying to write an economy plugin when players are stored in a database by their UUID and I'm wanting commands such as /bal [player] meaning I'd need to convert the entered playername to the respective UUID (or find tat no such player exists in which case I would return an error to the player)

proud basin
#

what if the player wants to type in their uuid instead

high pewter
#

I could make that an option I suppose but I highly, highly doubt all players (or even a few) will want to do that

gleaming grove
#

Guys i found that since 1.17 version all of packets class are in "net.minecraft.network.protocol.game" instead of "net.minecraft.server.[verision].[className] . Does it mean we no longer need to care about NMS reflections?

dusk flicker
#

they no longer include version's

gleaming grove
#

yea ๐Ÿ˜„

dusk flicker
#

Some classes may be in other packages so just know that, if I recall it follows Mojang's packages now

gleaming grove
#

what about bukkit, it as well remove verions from packet path?

dusk flicker
#

Like if a user is running bukkit?

#

Should be the same due to it being maintained by Spigot

gleaming grove
#

this is my old code to get bukkit class, so now i not longer need to include version?

dusk flicker
#

Im not sure on that, id check but I dont got a jar right now

quaint mantle
#

I tried making an event that cancels BlockPlaceEvent when you place a player head, tried this and whenever i put heads on the side of a block, it doesnt work the block gets placed. Any way to fix this? Heres my code

public class block_place implements Listener {

    @EventHandler
    public void onItemPlace(BlockPlaceEvent event) {
        Player player = event.getPlayer();
        if (event.getBlockPlaced().getType() == Material.PLAYER_HEAD) {
            event.setCancelled(true);
        }
    }
}
hybrid spoke
quaint mantle
#

Ok thank you

#

2.0F, 0.001F - how does this affect sounds

#

pitch, volume?

quaint mantle
maiden briar
#

java.lang.ArithmeticException: / by zero I have never seen this in my life

quaint mantle
#

well it's my personal preference anyway

opal juniper
#
private List<Location> line(Location start, Location end, double distanceBetweenLocations) {
    List<Location> locations = new LinkedList<>();
    Vector line = end.toVector().subtract(start.toVector());
    for(double d = 0; d < line.length(); d += distanceBetweenLocations) {
        line.multiply(d);
        locations.add(start.clone().add(line));
        line.normalize();
    }
    return locations;
}

Anyone know why this doesn't work - i am trying to get a list of locations on a line

#

you out here roasting him

quaint mantle
#

๐Ÿ˜ข

#

it's okay its a weird way to name classes ik

opal juniper
#

thats how python names stuff and i hate it

#

before you judge this is godciphers code

#

so

#

blame him

#

ye

#

i forget, is it:
line.normalize();
or
line = line.normalize();

#

the former right?

#

oke

#

okk

#
    private List<Location> line(Location start, Location end, double distanceBetweenLocations) {

        List<Location> locations = new ArrayList<>();
        Vector line = end.toVector().subtract(start.toVector());
        line.normalize();
        line.multiply(distanceBetweenLocations);
        for(int i = 0; i < 50; i++) {
            locations.add(start.add(line.multiply(i)));
        }
        return locations;
    }
#

or have i misunderstood

gleaming grove
#

guys do you know some good launcher? i need to test plugin on 2 accounts

opal juniper
#

ok

#

i want a size of 50

#

myeah ok

#

thanks

#

mhm

lost matrix
opal juniper
gleaming grove
#

it could be in online mode i have mutiple accounts

opal juniper
#

oh well it works anyways with actual accounts

#

ok

gleaming grove
opal juniper
#

myeah i always just use a fake one

#

sorry i got sidetracked by the venom trailer

#

im back

lost matrix
#

This would be my approach:

  private List<Location> line(final Location start, final Location end, final double distanceBetweenLocations) {
    final List<Location> locations = new ArrayList<>();
    final Vector fullLine = end.toVector().subtract(start.toVector());
    final double fullLength = fullLine.length();
    final Vector deltaLine = fullLine.clone().normalize().multiply(distanceBetweenLocations);
    final int increments = (int) (fullLength / distanceBetweenLocations);
    locations.add(start);
    for (int i = 0; i < increments; i++) {
      final Location nextLocation = locations.get(locations.size() - 1).clone().add(deltaLine);
      locations.add(nextLocation);
    }
    locations.add(end);
    return locations;
  }
opal juniper
#

Hmm

#

yeah that looks good

#

thanks

lost matrix
#

spoonfeed .

opal juniper
#

let me test it

#

hehhehe

hybrid spoke
opal juniper
#

same

#

uhh

lost matrix
#

No. It gives you N locations depending on the delta you specified

opal juniper
#

Yeah that should be good

lost matrix
#

Yeah this works too

  private List<Location> line(final Location start, final Location end, final double distanceBetweenLocations) {
    final Vector fullLine = end.toVector().subtract(start.toVector());
    final double fullLength = fullLine.length();
    final Vector deltaLine = fullLine.clone().normalize().multiply(distanceBetweenLocations);
    final int increments = (int) (fullLength / distanceBetweenLocations);
    final List<Location> locations = new ArrayList<>(increments);
    locations.add(start);
    for (int i = 0; i < increments; i++) {
      final Location nextLocation = locations.get(locations.size() - 1).clone().add(deltaLine);
      locations.add(nextLocation);
    }
    locations.add(end);
    return locations;
  }

But it doesnt make a huge dif

#

Wait. Does an ArrayList with initial size have null entries?

opal juniper
#

lmao

lost matrix
#

This came to mind because i thought about what would happen if i initialised an array with the given length and then wrapped it in an ArrayList later.

opal juniper
#

the insults are flying

left swift
#

Hi, i'm trying create packetplayoutentitymetadata using reflections, so i have one question, it is ok?

        Class c = Class.forName("net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata");
        Class types[] = new Class[3];
        types[0] = Class.forName("java.lang.Integer");
        types[1] = Class.forName("net.minecraft.network.syncher.DataWatcher");
        types[2] = Class.forName("java.lang.Boolean");

        Constructor constructor = c.getConstructor(types);

        Object argList[] = new Object[3];
        argList[0] = armorStand.getId();
        argList[1] = armorStand.getDataWatcher();
        argList[2] = true;

        Object object = constructor.newInstance(argList);```
lost matrix
#

Ofc because the backing array is copied with System.arrayCopy. Just was confused if giving an initial size would change the element count. Btw can you specify a custom growth function in default java lists? Never checked

#

Really? So changes on the list are reflected in the array?

#

Ew

#

Nice. Naming is on point.

lost matrix
#

Ah interesting

left swift
gleaming grove
#

@left swift What code do you use to send a packet to player?

left swift
lost matrix
lost matrix
gleaming grove
#

Guys do you know what am i doing wrong?

lost matrix
left swift
#

is there any other way to fix this?

#

ugh, I generally get the same error with these nms classes :/ what to do about it?

import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
import net.minecraft.network.protocol.game.PacketPlayOutMount;
import net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity;```
lost matrix
# left swift I wanted to use reflection because when I used the normal PacketPlayOutEntityMet...

This doesnt work?

  public void sendNMSDataWatcherPacket(final Entity bukkitEntity, final Player receivingPlayer, final boolean forceUpdate) {
    final net.minecraft.world.entity.Entity nmsEntity = ((CraftEntity) bukkitEntity).getHandle();
    final PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata(nmsEntity.getId(), nmsEntity.getDataWatcher(), forceUpdate);
    ((CraftPlayer) receivingPlayer).getHandle().b.sendPacket(packet);
  }
gleaming grove
left swift
# lost matrix This doesnt work? ```java public void sendNMSDataWatcherPacket(final Entity bu...

yup, cannot access this is my code ->

        Player p = e.getPlayer();

        WorldServer server = ((CraftWorld) p.getLocation().getWorld()).getHandle();

        EntityArmorStand armorStand = new EntityArmorStand(EntityTypes.c, server);
        armorStand.setSmall(true);
        armorStand.setMarker(true);
        armorStand.setCustomNameVisible(true);
        armorStand.setNoGravity(true);
        armorStand.setCustomName(CraftChatMessage.fromStringOrNull(p.getName()));

        EntityItem item = new EntityItem(EntityTypes.Q, server);

        item.startRiding(((CraftPlayer) p).getHandle());
        armorStand.startRiding(item);

        PacketPlayOutSpawnEntity itemPacket = new PacketPlayOutSpawnEntity(item);
        PacketPlayOutMount itemMount = new PacketPlayOutMount(item);

        PacketPlayOutSpawnEntity armorStandPacket = new PacketPlayOutSpawnEntity(armorStand);
        PacketPlayOutEntityMetadata armorStandMetaData = new PacketPlayOutEntityMetadata(armorStand.getId(), armorStand.getDataWatcher(), true);
        PacketPlayOutMount armorStandMount = new PacketPlayOutMount(armorStand);```
lost matrix
grim ice
#

arent holograms like rly easy

lost matrix
grim ice
#

o

#

so it doesnt take ram or what

lost matrix
#

Mind showing more code? This bit in the beginning doesnt tell much

grim ice
#

i mean

#

most ppl struggle with ram

#

(like me)

lost matrix
#

I literally know nobody who had a mem bottleneck before a CPU one.

grim ice
#

not when u have a 1gb server lol

lost matrix
#

Wait. Did the guy literally remove his message and then vanished?

grim ice
#

i might learn protocollib or what was its name but idk if its useful

marble granite
#

do any of you know if worldedit schematics save tile entity NBt?

#

ooh

#

nice

#

tysm

marble granite
#

this makes my job so much easier

#

but, also custom?

lost matrix
marble granite
#

idk the correct terminology, tags

lost matrix
#

What version are you on?

marble granite
#

1.16

lost matrix
#

Ah ok. Use PersistentDataContainer on them then you are on the safer side

marble granite
#

๐Ÿ‘

#

thx man

grim ice
#

ngl

#

nvm

lost matrix
#

So you are about to lie?