#help-development

1 messages ยท Page 211 of 1

trim creek
#

and is bad

#

D:

tardy delta
#

love how Unsafe.getUnsafe() just throws a securityexception

trim creek
#

oh wow I got a new error I didn't even notice

#

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown error 1146

#

what the heck is this

tardy delta
#

lmfao

trim creek
tardy delta
#

only java internals are supposed to call it :)

trim creek
#

bruuuuuuuuuuuuuuuuuuh

#

then lets make everything a Java external

#

and so no one will call it

tardy delta
trim creek
#

and make it be depressed

hybrid spoke
#

so spoof a java internal

tardy delta
#

spoof classloader

#

ah fuck i dont think its possible to spoof the platform classloader ๐Ÿคก

trim creek
#

Looks like I fucked up my whole fucking code

tardy delta
#

beat the platform

#

take it over

trim creek
#

the plugin... basically...

  • can't detect the fucking driver
  • can't create a table, because it doesn't exists... meanwhile its coded to create the fucking table when it doesn't exists...
tardy delta
#

i wanna learn some hacks in java lol

trim creek
#

Java.Hack();

#

and you are done

#

lol

tardy delta
#

Runtime.getRuntime().halt()

trim creek
#

๐Ÿคฃ

hybrid spoke
#

hacks in what way

tardy delta
#

Unsafe::throwException is a fun one too

#

idk i was looking at the advanced stuff and i felt like god

hybrid spoke
#

lmao

tardy delta
#

welcome to "how to crash the jvm"

#

learnt that from alex smh

dire salmon
#

is Unsafe safe to use tho?

tardy delta
#

lmfao

dire salmon
#

lmao

tardy delta
dire salmon
#

lol

hybrid spoke
#

Unsafe.getSafe

tardy delta
#

also fun one to block thread

#

Unsafe.becomeSafe()

river oracle
#

been trying to figure out brigadier with spigot as I wanted to use it, but
final CommandDispatcher<CommandSourceStack> dispatcher = new CommandDispatcher<>();
on github it wants you using CommandSourceStack it doesn't seem like that is visible at all do I need to use nms?

#

I'm aware of commadore but I'm fine using the brigadier command api

elfin atlas
#

does someone know to what targetSelector got changed? (NMS)

grim ice
#

a

vivid skiff
#

How can i add all nearby players to a gui?

elfin atlas
#

so a.a?

#

Then?

raw prairie
#

how might I create an explosion 2 blocks from where the player is facing?>

elfin atlas
#

Is it not working like in older versions?

#

1.19

elfin atlas
#

I'm trying to do this in the 1.19 version

chrome beacon
chrome beacon
#

Highly recommend using them. You can find a guide on the 1.19 release post

#

Asumming you're using maven

elfin atlas
elfin atlas
ivory sleet
#

Nms

#

And then you can use getSource().getBukkitEntity() or sth iirc

#

To get the bukkit sender

river oracle
#

๐Ÿ˜ข ok

river oracle
#

yea its like the names are different

#

๐Ÿคฏ

river oracle
#

look up the spigot mapping names you have than switch them out for mojang ^

#

๐Ÿฅณ then party and enjoy your easy development in the future

#

sometimes pain in the now will provide you with longterm benefit

elfin atlas
#

Thanks

trim lake
#

I hope someone can understand what I mean ๐Ÿ˜„

elfin atlas
river oracle
#

ok good luck

quaint mantle
#

how can i improve this config? yaml arena-selection: size: 27 title: "-" items: background: material: "BLACK_STAINED_GLASS_PANE" display-name: "" lore: [] previous-page: slot: 21 material: "ARROW" display-name: "&b&lPrevious Page" lore: [] close: slot: 22 material: "RED_DYE" display-name: "&c&lClose" next-page: slot: 23 material: "ARROW" display-name: "&b&lNext Page" lore: []

river oracle
#

idk

#

looks good to me

quaint mantle
#

alright, thanks

elfin atlas
#

Damn I hate this Obfuscated shit

river oracle
#

good thing mojang maps aren't obfuscated

river oracle
#

its in your .m2 file

#

just decompile the server jar with the mojang mappings in it

#

hell you could even decompile the obfuscated jar and then just use screaming sandles

#

then you look around for what u want

wary topaz
fluid river
#

?

#

there is no exists() on FileConfiguration

#

only on File

wary topaz
#

oh thanks

#

how can I migrate a fileconfig to a file

grand flint
#

On the playeradvancement event, how do I check if the advancement is rare or normal?

fluid river
#

?jd-s

undone axleBOT
fluid river
#

if there is nothing like this on javadocs

grand flint
#

I don't think that is the event that runs when a player gets an achivement is it?

fluid river
#

it is

grand flint
#

type?

fluid river
#

icon is itemstack

grand flint
#

What does that mean

fluid river
#

i mean that's the achievement from minecraft

#

but in spigotapi it's advancement

grand flint
#

ye what does that change

fluid river
#

if there is not RARE thing in javadocs

#

manually create a list with rare advancements

grand flint
#

this is it :)

wary topaz
#

if there is not a rare thing use spigot not api

#

there are some options in nms

fluid river
#

if your advancement is not rare then goodbye

fluid river
grand flint
#

can i not use these?

fluid river
#

instead of event

fluid river
#

try it

grand flint
#

ill check mc to see which one means what

wary topaz
#

@grand flint I think it would work

grand flint
#

oh look

#

the rare one is a challenge

river oracle
#

how do you even build a command with brigadier

        LiteralArgumentBuilder<CommandSourceStack> builder = literal("test").executes(new BukCom() {

            @Override
            public int run(CommandContext<CommandSourceStack> arg0) throws CommandSyntaxException {
                return 0;
            }

        });
public interface BukCom extends Command<CommandSourceStack> {

}```
I tried making my own interface to force type CommandSourceStack, but executes only takes in Command<Object> which then changes the type LiteralArgumentBuilder<CommandSourceStack> to LiteralArgumentBuilder<Object> which than can nolonger be registered by my dispatcher I'm honestly confused as hell how I'm supposed to get this work if all of the generics in the LiteralArgumentBuilder only take in Objects versus my CommandSource
wary topaz
#

is it possible to migrate from fileconfiguration to file?

grand flint
#

advancement.type or something?

river oracle
#

now this might get pretty tricky so hang in there

wary topaz
#

oik

river oracle
#

gimme a second

#

i'll show you a crazy example

wary topaz
#

if (getConfig().exists)

#

thats what i'm trying to do

river oracle
#

File file = new File(getDataFolder(), "config.yml");

#

๐Ÿ˜“

grand flint
#
public void onPlayerAdvancement(PlayerAdvancementDoneEvent e) {

        Advancement advancement = e.getAdvancement();

With this code, how do I check if advancement is a challenge type, how do I get it from advancement?

wary topaz
#

thanks mate ๐Ÿ˜„

river oracle
#

bukkit conifg api ๐Ÿ’€

wary topaz
#

where tf is that

#

?jd-s

undone axleBOT
wary topaz
#

I cant find it

river oracle
#

๐Ÿคฆ๐Ÿฝโ€โ™‚๏ธ its what your using lol

wary topaz
#

wait so did I do it right?

river oracle
#

yea I'm just making a joke lol

wary topaz
#

shit mb lMFAO

#

hows this?

hazy parrot
#

Is a bit odd

#

So if replay is inside of "DisabledCommands" list, it will be enabled?

wary topaz
#

if its not inside it will be enabled

hazy parrot
#

That is not what you have done

wary topaz
#

what did I do?

hazy parrot
#

You did if(replay is in list) enable reply

wary topaz
#

oh shoot

#
public Reply(Main plugin) {
        this.plugin = plugin;
        if (!(this.plugin.getConfig().getStringList("DisabledCommands").contains("reply"))){
        Objects.requireNonNull(this.plugin.getCommand("reply")).setExecutor(this);
        }
    }


#

okie but now its just doing this

#

plugin.yml is doing this

hazy parrot
#

What

wary topaz
hazy parrot
#

Is it "disabled"

#

?

wary topaz
#

well it doesnt return anything which I want it to return unknown command

river oracle
#

no he reloaded his server ๐Ÿ’€

wary topaz
#

so other plugins can take priority over it

#

I didnt reload the server

#

how can I made sure other plugins can take priority?

#

like remove it from plugin.yml once the command is disabled

river oracle
#

eh I never use the plugin.yml I just edit the command map directly

#

though you shouldn't be getting into that this early I don't think so I don't have a direct answer on how you'd do that

wary topaz
#

command map directly? wdym?

river oracle
#

you'd have to use reflection don't worry about it

wary topaz
#

How can I get the plugin.yml file

#

and edit it

hazy parrot
#

You can't get it that way as its inside of jar, you can get JarEntry of it but I'm not sure if you can edit it like that, you would have to Google

river oracle
#

What your doing isn't logistically possible

#

The way you want to do it

hazy parrot
#

Yeah, also there are better ways to accomplish what you want

wary topaz
#

i tried ?google but it made no help, what i'm trying to do is disable a command from my plugin and remove all traces until the command is removed from the config file

#

I need to access plugin.yml to remove the command

hazy parrot
#

You would have to use reflection to add it directly to commandmap without plugin.yml,there are probably other ways but as I never worked with any, I would not be able to help

grand flint
#

My intellij says build complete but the jar file is not there

hazy parrot
#

How are you building and what dep management system

grand flint
#

Nevermind, I fixed that issue, but now I get an error saying access denied

hazy parrot
#

Can you screenshot

grand flint
#

Yes, I use maven to build it

#

I been having this issue for a year now lol

hazy parrot
#

Lol looks like you are running intellij as other non admin user

grand flint
#

Nope

hazy parrot
#

Or your dir is read only for some reason

grand flint
#

Yes how can I fix that?

#

I been having this since I updated to windows 11 :d

hazy parrot
#

Can you try just to manually create some text file in that dir?

grand flint
#

I can

#

It works

#

Visual studio doesn't have this issue

#

Roblox Studio has an issue if I don't run it as admin, it will say permission denied and not launch

hazy parrot
#

So it's not readonly, your intellij is probably running as different user, idk how trough

grand flint
#

But that fixes when I run it as admin

#

It's just intellij

hazy parrot
#

Can you run ij as admin?

grand flint
#

I did

#

Even windows support couldn't find a solution

grand flint
hazy parrot
#

try to Google or ask at some forum ยฏ_(ใƒ„)_/ยฏ

grim oak
#

When using tabcomplete, how do i make it filter the results as the user types in the command

#

tyy

unreal sandal
#

Hello, I have a plugin called ranksystem with only one command called rank and when I type the command, the tab proposes to type /ranksystem:rank or /rank. How can I disable that ?

#

I just want the tab to propose /rank but not /ransystem:rank because that's really not beautiful

topaz cape
#

sometimes when the dependency is on a higher version of java intellij guesses it's not accessable

#

so does maven

winged anvil
#

lmao does anyone use vscode for java?

river oracle
#

me

#

I am your savior dear friend

#

what is it you require

winged anvil
#

i just wanna test

#

im tryna run my localhost server in the terminal

river oracle
#

๐Ÿ˜ข I thought I was needed for some specific form of help this hurt me inside

winged anvil
#

ik theres a way but idk how

#

lmaooo

river oracle
#

oh for servers I just use a custom panel I made

#

sowwy :(

winged anvil
#

why

river oracle
#

wdym why

winged anvil
#

why tf you got a custom panel

#

for localhost?

river oracle
#

because it makes running servers easy locally

winged anvil
#

2 much

river oracle
#

so easy to spin up new instances with preset plugins

#

its just a cli

winged anvil
#

i see

river oracle
#

though I'm making a version in java with a UI rn

#

previously I used python

winged anvil
#

oh nah

#

why do you use vs over intellij

#

just curious

river oracle
winged anvil
#

i cant even create a mf maven project

#

having major skill issues rn

river oracle
#

I use eclipse hotkeys so the hotkey might be different for you

river oracle
# winged anvil i cant even create a mf maven project

also a lot of people have an issue with vsc having slow autocomplete see that complained a lot here I'd advise upping the ram you give by default its like 500mb to 1gig but I just set it to 2gb as I have 32 at my disposal

wary topaz
#

this.plugin.getConfig().reload();
Any way to do this?

#

thanks

winged anvil
wary topaz
#
@EventHandler
    @Deprecated
    public void onPlayerChat(PlayerChatEvent event) {
        //Check if event is enabled:
        if(!(this.plugin.getConfig().getBoolean("ColorchatSupport"))) {
        }
        //Done :D
        else {
            Player player = event.getPlayer();
            if(player.hasPermission("betterserver.permissions.chat.chatcolor")) {
                event.setMessage(event.getMessage().replace('&', 'ยง'));
            }
        }
    }

Can someone help me debug it? It's doing a bunch of random stuff but it's pretty obvious what it's supposed to do.

#

it worked before I added the config checker

#

No that works i'm trying to make the config thing work

#

ill restart it

#

okie

#
@EventHandler

    public void onPlayerChat(AsyncPlayerChatEvent event) {
        //Check if event is enabled:
        if(!(this.plugin.getConfig().getBoolean("ColorchatSupport"))) {
        }
        //Done :D
        else {
            Player player = event.getPlayer();
            if(player.hasPermission("betterserver.permissions.chat.chatcolor")) {
                event.setMessage(colorize(event.getMessage()));

            }
        }
#

i added the string above

#

the thing that is not working is the config

#

omg

#

thank you i feel so stupid

hazy parrot
#

Also that if/else looks a bit messed up

wary topaz
#

my final question is how do I detect if the config.yml is null (has errors)

#

thanks ๐Ÿ˜„

fading spindle
#

events for when a bow is shot by a player? or when arrow lands on a block

hazy parrot
#

What

fading spindle
#

thanks if i will use the first one i should do something like EntityShootBowEvent instanceof Player?

hazy parrot
#

Why does it have to be type parameter if it will only accept class

wary topaz
#

im not giving the link to the spigot thing cause thats advertising

grand flint
#

How can I make the message secure in offline mode?

wary topaz
#

I had that problom too, you just have to cancel the message event and send a message to all players

grand flint
#

Is that not going to mess up my essentials chat

wary topaz
#

idfk

fringe hemlock
wary topaz
#

its in plugin.yml

fringe hemlock
#

ah

wary topaz
#

its like that for every class

#

unless I forgot something

fading spindle
#



    if (pie.getBow().getItemMeta().equals(ItemManager.shock_powder.getItemMeta() && pie.getEntityType().equals(Player)){
                

                //

            }

        }


    }```   how do I check if the entity that shot the bow is a playER?
wary topaz
#

any way I can automatically unnest my if statements?

#

LMFAO

undone axleBOT
tall dragon
#

someone help my brain remember. what was the class holding all the item sets named

wary topaz
#

sobs

tall dragon
#

like a bunch of listt of item sets

#

a set of items

#

that are like eachother

#

like WOOL

#

yeaaas

#

thanks

grand flint
tall dragon
#

i guess there is not one for music disks copege

#

i need sleep

grand flint
#

How do I check my javaversion

wary topaz
#

cmd.exe -> java -version

grand flint
#

Ok, how do I update my intellij version

#

Should I change this in pom.xml?

wary topaz
#

you need jetbrains toolbox to update intellij

grand flint
#

well it maches

#

should i change the one in pom.xml too?

#

what should i make it my java version is 17

#

Thank you

#

Also what would this be for 1.19.2

wary topaz
#

1.19.2-R0.1-SNAPSHOT

grand flint
#

with the r0?

#

ok thank you

#

Oh ye

#

Thank you

wary topaz
#

<version>1.19.2-R0.1-SNAPSHOT</version>

grand flint
eternal night
#

you have run build tools yes ?

#

for 1.19.2

fading spindle
#

it doesn't work, here is my updated code;

grand flint
#

what?

wary topaz
grand flint
#

No where do I run it

undone axleBOT
grand flint
#

Where should I run it

wary topaz
#

anywhjere

grand flint
#

wdym

#

Like in cmd?

wary topaz
#

oh you have to make a batch

grand flint
#

oh ok

#

ye ill read it ๐Ÿ‘

wary topaz
#

[20:52:58 INFO]: [BetterServer] There is a new update available.
It's been a hour and it still hasnt updated, anyone knows why?

new UpdateChecker(this, 105989).getVersion(version -> {
            if(this.getDescription().getVersion().equals(version)) {
                getLogger().info("There is not a new update available.");
            } else {
                getLogger().info("There is a new update available.
");
            }

        });
tall dragon
#

well we can't smell whats inside UpdateChecker. so you would need to share that

#

i guess its using Spiget api

wary topaz
#
package BetterServer.Commands.AdminEssentials;

import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Scanner;
import java.util.function.Consumer;


public class UpdateChecker {

    private final JavaPlugin plugin;
    private final int resourceId;

    public UpdateChecker(JavaPlugin plugin, int resourceId) {
        this.plugin = plugin;
        this.resourceId = resourceId;
    }

    public void getVersion(final Consumer<String> consumer) {
        Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
            try (InputStream inputStream = new URL("https://api.spigotmc.org/legacy/update.php?resource=" + this.resourceId).openStream(); Scanner scanner = new Scanner(inputStream)) {
                if (scanner.hasNext()) consumer.accept(scanner.next());
            } catch (IOException exception) {
                plugin.getLogger().info("Unable to check for updates: " + exception.getMessage());
            }
        });
    }
}
tall dragon
#

is 0.0.2.7 not latest version?

wary topaz
#

0.0.2.7 is the latest

tall dragon
#

well whats the problem then

wary topaz
tall dragon
#

api returns correct version

wary topaz
#

any way I can do updatechecker.equals(0.0.2.7)?

#

The 2.6 update was corrupted so I had to delete it

grand flint
#

ok i ran buildtools what do i do now

wary topaz
#

oh wait I dfigured out why my thing doesnt work thanks guys

#

so my next problom is in my config.yml file I whave a version which is set every time I update my plugin. if the jar file changes how can I make it so the version changes when the jar file reloads to its correct version but everything else stays the same?

grand flint
#

How do I solve this

fading spindle
#

why wont this work, ```@EventHandler
public void onPlayerInteract(EntityShootBowEvent pie) {

Entity entity = pie.getEntity();

if (entity instanceof Player){

if(pie.getBow().getItemMeta().equals(ItemManager.shock_powder.getItemMeta())) {
if (pie.getProjectile().getVelocity().equals(0)){
entity.teleport(pie.getProjectile().getLocation());}
}

    }


        }

    }``` I want the player to be TPED to the arrow when they shoot from the bow, to check if the bow is not midair i added an if condition that checked if the velocity was 0 if it was then it tped the player to the arrow, for some reason when i use the item in minecraftit does nothing the arrow lands and it doesn't tp me
undone axleBOT
wary topaz
#

stop using pie

#

thats my pie im hungry

fading spindle
grand flint
#

I run buildtools with the bat file and put latest as the version, I still get the error

wary topaz
fading spindle
#

wdym

#

oh ok, then how do i check if the velocity is 0

#

oh okthanks !

eternal oxide
#

getVelocity returns a vector I believe, so check it's length

fading spindle
#

oh ok

#

is there an other way to check if the object (arrow) is not moving

eternal oxide
#

getVelocity().length == 0

#

or getLength() I forget

fading spindle
wary topaz
#

changed it

fading spindle
#

no i fixed it added event handler and i implemented listener the first thing

eternal oxide
#

um, you are using a player interact event?

fresh timber
#

Is there a way I can change the Minimum/Maximum world height on my 1.19 server so players on 1.8 will not bug out when they get lower in the world? I use ViaRewind, ViaBackwords, and ViaVersion.

eternal oxide
#

Sorry, shootbow

#

the velocity will never be zero in that event

wary topaz
#

what's the different between getDefaultsSection and getDefaults

eternal oxide
#

watch the projectileHitEvent

wary topaz
#

also how do I access the config in the jar file (not edit just get info)

fading spindle
eternal oxide
#

ProjectileHitEvent

hazy parrot
wary topaz
#

I want to get the version thats built into the jar and add it to the config file

fading spindle
#

?

eternal oxide
#

yes

fading spindle
#

ok so i dont have to mess with velocity

wary topaz
hazy parrot
# wary topaz

Ig you can get jarfile and JarEntry and after that return inputstream, but you are just overcomplicating

#

Just make version class with constant or smth

wary topaz
#

when my plugin gets updated I want it to automatically change the version: in config.yml without deleting the file

#

but idk hw to check for the version

hazy parrot
#

If file is not delwted

wary topaz
#

it will take the users config.yml progress though

#

which is annoying

hazy parrot
#

Just make version class or smthing like that

rare rover
#

Looks pretty dope

wary topaz
#

ill get a pic for you of my plugins theme

rare rover
#

Alr, thanks

wary topaz
hybrid spoke
fading spindle
# eternal oxide yes

should this work? ``` @EventHandler
public void onPlayerInteract(ProjectileHitEvent pie) {

    Entity entity = pie.getEntity();

    if (entity instanceof Player) {

        if (((Player) entity).getItemInUse().getItemMeta().equals(ItemManager.shock_powder.getItemMeta())) {

           entity.teleport(pie.getEntity().getLocation());


        }


    }

}```
rare rover
#

What does NBT support do? I seen it but didn't download it

fading spindle
eternal oxide
#

if you only want to tp when you shoot a Block use event.getHitBlock()

#

but check it's not null, as it can be if you shot another entity like a Player or a mob

fading spindle
raw prairie
#

@eternal oxide

#

how might I detect an explosion when the player is facing a wall

#

this what I have rn

#

    @EventHandler
    public void onRightClick(PlayerInteractEvent event) {
        if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) {
            Player player = event.getPlayer();
            Location loc = player.getLocation().add(player.getLocation().getDirection().multiply(2));
                if (event.getItem() != null) {
                    double x = event.getPlayer().getAttackCooldown();
                    int y = (int) x;
                    if (x == y) {
                        if (event.getItem().getItemMeta().equals(ItemManager.GravHammer.getItemMeta())) {
                            player.getWorld().createExplosion(loc.getX(), loc.getY(), loc.getZ(), 5f);
                            player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 3, 255, false, false, false));
                            System.out.println("I work");
                        }
                    }
                }
        }```
tall dragon
wary topaz
raw prairie
#

its for when

#

people spam the axe

#

so they dont get the explody

hybrid spoke
#

thats simply a if(true)

tall dragon
#

but look at what ur doing

#

ur checking if x == x bassically

raw prairie
#

it works

#

so ๐Ÿคท

tall dragon
#

i mean it returns true yea lol

raw prairie
#

whats with that

tall dragon
#

probably this

hybrid spoke
#

?pmc

raw prairie
hybrid spoke
#

spigot api can take up to 3 hours until it updates

wary topaz
#

1 hour ago

hybrid spoke
#

also for me its 0.0.2.7

wary topaz
hybrid spoke
tall dragon
#

it returns the correct version.

wary topaz
#

for me its 0.0.2.5

hybrid spoke
raw prairie
wary topaz
#

tf

tall dragon
#

is a physical action

raw prairie
tall dragon
wary topaz
#

is there anything faster than spigot api

raw prairie
# tall dragon using EntityDamageByEntityEvent i would probably

already tried lol ```java

@EventHandler
public void onEntityDamage(EntityDamageByEntityEvent event) {

    if (event.getDamager() instanceof Player && event.getEntity() instanceof Player) {

        Player attacker = (Player) event.getDamager();

        if (attacker.getInventory().getItemInMainHand().equals(ItemManager.GravHammer)) {

                Player victim = (Player) event.getEntity();
                attacker.getWorld().createExplosion(attacker.getLocation().getX(), attacker.getLocation().getX(), attacker.getLocation().getX(), 5f);
                Bukkit.broadcastMessage("[CrystalBall] " + attacker.getName() + " hit " + victim.getName() + " with a netherite axe!");

        }

    }

}```
hybrid spoke
tall dragon
hybrid spoke
#

its all descripted in there

raw prairie
tall dragon
#

the item in main hand equals thingy

sonic goblet
#

^

raw prairie
tall dragon
#

try using #isSimilar

hybrid spoke
#

and you dont create arguments. they are like "commands". if the argument is what you are looking for, you react to it

raw prairie
sonic goblet
hybrid spoke
#

ok*

raw prairie
#

also, would this work for detecting a position 2 blocks from the player is facing? ```java
@EventHandler
public void onRightClick(PlayerInteractEvent event) {
if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) {
Player player = event.getPlayer();
Location loc = player.getLocation().add(player.getLocation().getDirection().multiply(2));
if (event.getItem() != null) {
double x = event.getPlayer().getAttackCooldown();
int y = (int) x;
if (x == y) {
if (event.getItem().getItemMeta().equals(ItemManager.GravHammer.getItemMeta())) {
player.getWorld().createExplosion(loc.getX(), loc.getY(), loc.getZ(), 5f);
player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 3, 255, false, false, false));
System.out.println("I work");
}
}
}
}

}```
sonic goblet
#

Ok.*

hybrid spoke
#

no, just ok*

raw prairie
#

forget the x and y shit

fading spindle
#
    public void onPlayerInteract(ProjectileHitEvent pie) {

        Entity entity = pie.getEntity();

        if (entity instanceof Player) {

            if (((Player) entity).getItemInUse().getItemMeta().equals(ItemManager.shock_powder.getItemMeta()) ) {

               entity.teleport(pie.getHitBlock().getLocation());


            }


        }

    }``` why wont this work i want the player to teleport whereever the arrow landed yet it doesn't do that
raw prairie
#

or use arrow instaed of pie

#

idk

#

haven't used projectile hit event

#

would this get the players direction 2 blocks ahead?
Location loc = player.getLocation().add(player.getLocation().getDirection().multiply(2));

fading spindle
#

the event is registered, though whats wrong with the meta check

hybrid spoke
raw prairie
#

halp me

hybrid spoke
#

thats unnecessary. you send the data my #sendPluginMessage

wet breach
fading spindle
raw prairie
hybrid spoke
#

bro

#

?pmc

wet breach
hybrid spoke
#

look that link up

fading spindle
#

oh ok

hybrid spoke
#

the player or any other entity

raw prairie
hybrid spoke
#

too many convos to follow

fading spindle
hybrid spoke
#

1

#

2

#

3

wet breach
rare rover
#
Location direction = player.getLocation().getDirection();
Location front = player.getLocation().add(direction);```
#

I think

#

And just multiply by the amount of blocks you want infront of the player

#

I did that on my phone so idk

#

Yeah

raw prairie
hybrid spoke
rare rover
#

Yeah

hybrid spoke
#

get the eye location

raw prairie
rare rover
#

Then do direction.toVector()

#

Or whatever you need

#

This would be so much easier on my pc

raw prairie
hybrid spoke
#

Vector playersDirection = player.getEyeLocation().getDirection();

#

multiply this then by 2

rare rover
#

Yes

#

Like that

raw prairie
#

nvm

#

lol

#

Location front = player.getLocation().add(playersDirection).multiply(2);?

raw prairie
raw prairie
#

player.getWorld().createExplosion(?, ?, ?, 5f);

rare rover
#

Yes, then add the previous location to the location parameter

#

If that's what your after

raw prairie
#

what

#

so front

rare rover
#

Front it

#

Is

#
Location loc = player.getLocation().clone().add(direction); // this should be 1 block in front of the player```
hybrid spoke
#

if he turns

rare rover
#

Teue

hybrid spoke
#

since the direction doesnt update in his normal location

rare rover
#

Yrue

#

Bro why is my phone so laggy

rare rover
#

True*

#

Use his

#

Yeah

raw prairie
#

@hybrid spoke

#

im so confused

hybrid spoke
#

i mean

#

what are you even trying to do

raw prairie
hybrid spoke
#

so then get the players direction
Vector playersDirection = player.getEyeLocation().getDirection();
multiply it by 2
playersDirection.multiply(2)
and add it to the explosions location what would be the players

raw prairie
#

maybe/

tall dragon
#

Herobrine

hybrid spoke
#

i think because NPCs can click inventories too

hazy parrot
#

Are npc only thing besides players that can be HumanEntity?

#

Just curious

wet breach
#

apparently ServerOperator is a HumanEntity as well

#

oh wait that is super

#

not sub

raw prairie
hybrid spoke
undone axleBOT
raw prairie
raw prairie
#

@hybrid spoke would this work?

#
                            player.getWorld().createExplosion(front.getX(), front.getY(), front.getZ(), 5f);```
tall dragon
#

he has. legit given you the exact code needed to make work what u wanted..

tall dragon
#

so wut da problem

wet breach
#

have you tried doing some research yourself?

raw prairie
#
            Vector playersDirection = player.getEyeLocation().getDirection();
            Location front = player.getLocation().add(playersDirection).multiply(2);```
tall dragon
#

try and see if it works

wet breach
#

it sounds like you just want to be spoonfed

#

?spoon

undone axleBOT
#

Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.

hybrid spoke
hybrid spoke
round finch
#

Good tip for development

#

+debug

raw prairie
round finch
#

Wtf

tall dragon
round finch
#

Discord game?

raw prairie
#

its a mc mod

tall dragon
#

they are quite well made

raw prairie
#

also

#

I tried and seed

#

it didnt work

tall dragon
#

especially the drawing one is fun

round finch
#

Experiment

#

And do some output info

undone axleBOT
#

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

round finch
#

If it isn't out putting any error it not loading or if it's working you are doing something wrong if isn't what it surpose to

round finch
#

Sleep deprivation sry

hybrid spoke
#

lost my motivation in actually coding long ago

#

and still i have somehow 1k+ contributions on github

#

like before it breaks

#

then it would act like bedrock

#

btw it explicit says Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins

#

oh well nvm thats the default descr

ancient plank
#

propane

#

?jd-s

undone axleBOT
wet breach
#

a very handy event for explosions

ancient plank
#

What the heck

#

Since when was this a thing

hybrid spoke
wet breach
#

break animation as far as I know is client side, not aware of being able to cancel that

hybrid spoke
#

should be a new feature iirc

round finch
#

@raw prairie paste code

#

?paste

undone axleBOT
hybrid spoke
#

yeah exactly

#

thats the one if someone is breaking a block

ancient plank
hybrid spoke
ancient plank
#

Blockdamageabort is new tho

#

It's not in 1.16.5 jd

round finch
ancient plank
#

I think if you're reusing a world, i.e. hypixel bedwars maps, the better thing would be to just delete and replace, gg

#

Iirc that's the ideal route ppl say

tall dragon
#

@ancient plank ohw my gosh ur a daddy ornn enjoyer??!!

hybrid spoke
#

yes you can

#

it would just block the disabling in this case

#

and if you finished it finish disabling

#

just dont do anything async in there

#

that would be too late then

round finch
#

Can the client break if server isn't registering it?

round finch
#

Like fake breaking

wet breach
#

well cool I guess

round finch
#

On client side

wet breach
#

there is always ways to dysnc client and server

hybrid spoke
#

just never save the world

wet breach
#

when such things happen weird things do indeed happen on the client lol

#

like seeing a block that the server isn't tracking but the client believes it is real

hybrid spoke
#

on load you can tell it to not save the world in any case

#

could do that in the worldinitevent

hybrid spoke
ancient plank
#

I need to go through and move a lot of things off the main thread in my most recent plugin, but I'll do it later...

round finch
#

๐Ÿค”

ancient plank
shadow zinc
#

how can I perform the return operation with my two cfs? java public CompletableFuture<Integer> getMasteryTillLevelUp(Player p, String skill) { final CompletableFuture<Integer> future = new CompletableFuture<>(); Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { UUID uuid = p.getUniqueId(); CompletableFuture<Integer> futureCEXP = sqlGetter.getDataInt(uuid, skill, "CEXP"); CompletableFuture<Integer> futureEXP = sqlGetter.getDataInt(uuid, skill, "EXP"); try { future.complete(futureEXP.get() - futureCEXP.get()); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } }); return future; }

#

something like that

#

how can I make that less shit

loud frost
#

How do yall structure your command method? Making a complex command with branching args makes my code look so messy with all those conditionals.

loud frost
shadow zinc
shadow zinc
loud frost
loud frost
shadow zinc
#

like this maven <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>3.3.0</version> <configuration> <minimizeJar>true</minimizeJar> <!--If you do minimize the jar, you must apply the filter otherwise essential classes will be excluded from the final jar--> <relocations> <relocation> <pattern>com.neomechanical.neoutils</pattern> <shadedPattern>YOUR.PACKAGE.neoutils</shadedPattern> </relocation> </relocations> <filters> <filter> <artifact>*:*</artifact> <excludeDefaults>false</excludeDefaults> <includes> <include>com/neomechanical/neoutils/**</include> </includes> </filter> </filters> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> </execution> </executions> </plugin>

loud frost
#

Il take a look into that, thanks

quaint mantle
#

is it possible to add something like this?

#

there we go!

#

the NBT: 3 Tag(s)

#

so I will need nms?

#

wondering with something like this ^?

real blaze
#

I was thinking about making a 'quick reset' for villager trades, but I'm not sure what should be:

  • the activation method given that keypresses are client side
  • how to actually set the villager trades to one of the vanilla defaults
vagrant stratus
#

I'm dumb so what's the best way to handle an optional method, but not everything needs deactivate
e.g.

public abstract class Effect {

  public abstract void activate();
}

some effects may be only activatable, however some may be able to be deactivated yet it would be weird for all of them to have to use both

vagrant stratus
#

ehh, defaults would be useless I believe, given the effect would have different code for the required activate and optional deactivate

shadow zinc
#

something like this maybe?

#
abstract class test {
    public void activate() {
    }

    public void deactivate() {
    }
    public static class implementation extends test{
        @Override
        public void activate() {
            //do something if you want
        }
        //no deactivation
    }
}```
#

not entirely sure what ur doing tbh

vagrant stratus
#

That is a possibility, yea

shadow zinc
#

then default code could be something as well, depending on what happens with the absence of activation or deactivation

solemn frigate
#

im trying to use the bungeecord plugin messaging channel in my bukkit plugin but im getting this error: https://imgur.com/eDUCf2j

#

im pretty sure that i set up everything correctly so i have no idea why its throwing that error

shadow zinc
#

you may also want to consider using a plugin messaging framework

#

My util has one if you're interested in using it/stealing code

solemn frigate
#

(commented out because of the errors it was throwing)

sonic goblet
shadow zinc
#

?paste

undone axleBOT
solemn frigate
#

alr

shadow zinc
#

its a lot more elegant

solemn frigate
#

oof

#

could it be because im trying to send a custom plugin message?

loud frost
#

@shadow zinc I see you lol

shadow zinc
#

should have checked before, my bad

rough basin
#

Is player livingentity?

remote swallow
#

yes

maiden briar
#
@EventHandler
    public void onServerPing(ServerListPingEvent e)

Is there any way to check if the ping request came from BungeeCord by comparing the player's addresses? (On BungeeCord I do player.getServer().getInfo().ping();)

maiden briar
#

Sending data through the serverping is impossible

shadow zinc
#

I'm making an api, how do I use JavaPlugin.getPlugin to get the instance of the plugin that initialized my plugin?

#

what class do I pass into getPlugin(?)?

#

when I do ```java
private static JavaPlugin plugin;

public static JavaPlugin getInstance() {
    if (plugin == null) {
        try {
            plugin = JavaPlugin.getPlugin(NeoUtils.class);
            init();
        } catch (final IllegalArgumentException | IllegalStateException exception) {
            throw new IllegalStateException();
        }
    }

    return plugin;
}```
#

NeoUtils.class is my main class

frail gale
#

Why you're doing JavaPlugin.getPlugin()

#

You can just make an instance variable

#

after that assign it onEnable

#

And make a getter for it

#

Also no need to catch all theee exceptions

shadow zinc
#

onEnable isn't reliable

frail gale
#

Bruh why?

shadow zinc
#

so it can either be standalone or shaded

frail gale
#

Yea I understand you

shadow zinc
#

any ideas how getPlugin works?

frail gale
#

Pass your main class

shadow zinc
#

ah yes before my computer crashed I was going to mention something

frail gale
#

The way you're doing it should be right

#

I hate crashesh

shadow zinc
#
    private static JavaPlugin plugin;

    public static JavaPlugin getInstance() {
        if (plugin == null) {
            try {
                plugin = JavaPlugin.getPlugin(NeoUtils.class);
                init();
            } catch (final IllegalArgumentException | IllegalStateException exception) {
                throw new IllegalStateException();
            }
        }

        return plugin;
    }```
#

code

#

but

#

I get an error

#

let me find it real quick

frail gale
#

What is the error?

shadow zinc
#

its basically NeoConfig can't be cast to NeoUtils

#

NeoConfig is my plugin using the library

frail gale
#

That's cast exception

shadow zinc
#

yeah but its the line plugin = JavaPlugin.getPlugin(NeoUtils.class);

#

I'm not casting plugin

frail gale
#

You can try to get the plugin then print some value of it

#

To see if you're getting the instance

#

The class cast exception should be from something you are casting

#

It means it cannot be casted

shadow zinc
#
[20:14:55 ERROR]: Error occurred while enabling NeoConfig v1.5.4 (Is it up to date?)
java.lang.ClassCastException: Cannot cast com.neomechanical.neoconfig.NeoConfig to com.neomechanical.neoconfig.neoutils.NeoUtils
        at java.lang.Class.cast(Class.java:3889) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.getPlugin(JavaPlugin.java:408) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
        at com.neomechanical.neoconfig.neoutils.NeoUtils.getInstance(NeoUtils.java:16) ~[NeoConfig-1.5.4.jar:?]
        at com.neomechanical.neoconfig.neoutils.NeoUtils.init(NeoUtils.java:34) ~[NeoConfig-1.5.4.jar:?]
        at com.neomechanical.neoconfig.neoutils.NeoUtils.getNeoUtilities(NeoUtils.java:28) ~[NeoConfig-1.5.4.jar:?]
        at com.neomechanical.neoconfig.NeoConfig.onEnable(NeoConfig.java:69) ~[NeoConfig-1.5.4.jar:?]```
frail gale
#

Why you're casting NeoConfig with NeoUtils?

shadow zinc
#

im not

frail gale
#

Can you send the code when you're running the getInstance method

frail gale
#

I see you use onEnable

#

plugin = this

#

No need then to do JavaPlugin.getPlugin()

shadow zinc
#

but onEnable isn't called when I use it in another plugin shaded right?

frail gale
#

For shading yes

shadow zinc
#

so I can't do that

frail gale
#

I think the error is coming from where you're using the getInstance

shadow zinc
#

it is

#

thats what the error says

#

line 16

frail gale
#

Then your NeoUtils should be fine

shadow zinc
#

how if I'm getting errors?

frail gale
#

It's coming from NeoConfig

#

Maybe

shadow zinc
#

very unlikely

frail gale
#

As I said try to get the instance then print one value from the plugin

#

If you can't print any value

#

Then your plugin is not started

kindred aurora
#

Someone know how to get the player how trigger the mo spawner activation ??

shadow zinc
#

print something about the plugin instance when I can't get it without a cast exception?

#

not sure I follow sorry

frail gale
#

Try to do directly NeoUtils.getInstance().getDataFolder().toString()

shadow zinc
#

in neoconfig?

#

yeah right I understand

kindred aurora
#

get player in area of CreatureSpawner

shadow zinc
frail gale
#

That's strange

shadow zinc
#

gonna try getProvidingPlugin because why not

faint cypress
#

Hi! I have a question about thread safety and passing large amounts of information back to the main thread.
I have a class called LoadCostumeFileRunnable that extends BukkitRunnable. I use this class to asynchronously load in and process a large and complex file. I want to pass all of this information back to to my main thread as a HashMap<String, Costume>, where Costume is a class that contains two enum types(CostumeHead and CostumeBody), an int and an int[].

The copy-constructor for Costume looks like this:

    public Costume(Costume costume) {
        this.head = costume.getHead();
        this.body = costume.getBody();
        this.tempo = costume.getTempo();

        int i = 0;
        while (i < Costume.MOVEMENT_SPEED_ARRAY_SIZE) {
            this.movementSpeeds[i] = costume.getMovementSpeeds()[i];
            i += 1;
        }
    }

To start the async runnable I do:
new LoadCostumeFileRunnable(plugin, fileName).runTaskAsynchronously(plugin);.

In the LoadCostumeFileRunnable I have:

    @Override
    public void run() {
            final HashMap<String, Costume> callbackCostumeMap = new HashMap<>();
            // Load stuff
            Bukkit.getScheduler().runTask(this.plugin, () -> { plugin.callBackMethod(callbackCostumeMap) });
    }

Where callbackMethod() is:

    public void callbackMethod(@Nullable HashMap<String, Costume> costumeMap) {
        this.costumeMap.clear();
        for (HashMap.Entry<String, Costume> entry : costumeMap.entrySet()) {
            this.costumeMap.put(new String(entry.getKey()), new Costume(entry.getValue()));
        }
    }

Can anyone see any glaring problems with this? Particularly with how the data is copied back to the main thread?
(I fully intend to add to, remove from and edit the HashMap once it has been copied.)

shadow zinc
#

so it doesn't even get an instance

errant narwhal
#

I try to use javacord with my plugin using maven but when export plugin javacord not with in

shadow zinc
errant narwhal
#

shade???

shadow zinc
#

shade

errant narwhal
#

what is shade?

shadow zinc
shadow zinc
#

glad to hear

shadow zinc
#

I keep getting java [21:11:45 ERROR]: Error occurred while enabling NeoConfig v1.5.4 (Is it up to date?) java.lang.IllegalStateException: null at com.neomechanical.neoconfig.neoutils.NeoUtils.getInstance(NeoUtils.java:23) ~[NeoConfig-1.5.4.jar:?] at com.neomechanical.neoconfig.NeoConfig.onEnable(NeoConfig.java:70) ~[NeoConfig-1.5.4.jar:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:542) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]

#

when I try to do ```java
public static JavaPlugin getInstance() {
if (plugin == null) {
try {
plugin = JavaPlugin.getProvidingPlugin(Class.forName(Thread.currentThread().getStackTrace()[3].getClassName()));
if (plugin == null) {
throw new IllegalStateException("Cannot find plugin instance");
}
init();
} catch (final IllegalArgumentException | IllegalStateException exception) {
exception.printStackTrace();
throw new IllegalStateException();
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}

    return plugin;
}```
#

im making a library that will be standalone and shaded

chrome beacon
#

That looks like a real bad way to do it

#

Use DI

shadow zinc
#

if I could make it work that would be great

shadow zinc
chrome beacon
#

Definitely not a fan of that... Use DI

#

No need to over-engineer the code

#

Relying on where things are called is a bad idea

shadow zinc
#

alright, but can we at least discuss why it doesn't work?

chrome beacon
#

No idea it doesn't look like you sent the entire error

chrome beacon
#

Also have you tried printing out the class name in the stackstace so you have the right index

#

Yeah you have the wrong index in the stacktrace

#

as I said earlier that code is very much dependent on where you call getInstance

frail gale
#

@shadow zinc you can try NeoUtils.getPlugin(NeoUtils.class)

shadow zinc
hot panther
#

Does anyone here have an idea for a Bazaar plugin? There's quite a lot of mathematics behind it and maybe one of you knows an open source project?

drowsy helm
#

as in like hypixel bazaar?

#

i mean the maths isnt that complicated

shadow zinc
#

I need help finding the source of recursion

#
java.lang.StackOverflowError: null
        at java.text.DecimalFormat.getPositivePrefixFieldPositions(DecimalFormat.java:2590) ~[?:?]
        at java.text.DecimalFormat.subformat(DecimalFormat.java:1743) ~[?:?]
        at java.text.DecimalFormat.format(DecimalFormat.java:780) ~[?:?]
        at java.text.DecimalFormat.format(DecimalFormat.java:714) ~[?:?]
        at java.text.SimpleDateFormat.zeroPaddingNumber(SimpleDateFormat.java:1428) ~[?:?]
        at java.text.SimpleDateFormat.subFormat(SimpleDateFormat.java:1367) ~[?:?]
        at java.text.SimpleDateFormat.format(SimpleDateFormat.java:1001) ~[?:?]
        at java.text.SimpleDateFormat.format(SimpleDateFormat.java:971) ~[?:?]
        at java.text.DateFormat.format(DateFormat.java:378) ~[?:?]
        at com.neomechanical.neoutils.ServerMetrics.<init>(ServerMetrics.java:17) ~[NeoUtils-2.0.0-SNAPSHOT.jar:?]
        at com.neomechanical.neoutils.NeoUtilities.<init>(NeoUtilities.java:64) ~[NeoUtils-2.0.0-SNAPSHOT.jar:?]
        at com.neomechanical.neoutils.NeoUtils.init(NeoUtils.java:111) ~[NeoUtils-2.0.0-SNAPSHOT.jar:?]
        at com.neomechanical.neoutils.NeoUtils.getNeoUtilities(NeoUtils.java:101) ~[NeoUtils-2.0.0-SNAPSHOT.jar:?]
        at com.neomechanical.neoutils.version.Versioning.register(Versioning.java:40) ~[NeoUtils-2.0.0-SNAPSHOT.jar:?]
        at com.neomechanical.neoutils.NeoUtilities.<init>(NeoUtilities.java:71) ~[NeoUtils-2.0.0-SNAPSHOT.jar:?]
        at com.neomechanical.neoutils.NeoUtils.init(NeoUtils.java:111) ~[NeoUtils-2.0.0-SNAPSHOT.jar:?]
        at com.neomechanical.neoutils.NeoUtils.getNeoUtilities(NeoUtils.java:101) ~[NeoUtils-2.0.0-SNAPSHOT.jar:?]
        at com.neomechanical.neoutils.version.Versioning.register(Versioning.java:40) ~[NeoUtils-2.0.0-SNAPSHOT.jar:?]
        at com.neomechanical.neoutils.NeoUtilities.<init>(NeoUtilities.java:71) ~[NeoUtils-2.0.0-SNAPSHOT.jar:?]
        at com.neomechanical.neoutils.NeoUtils.init(NeoUtils.java:111) ~[NeoUtils-2.0.0-SNAPSHOT.jar:?]
        at com.neomechanical.neoutils.NeoUtils.getNeoUtilities(NeoUtils.java:101) ~[NeoUtils-2.0.0-SNAPSHOT.jar:?]
        at com.neomechanical.neoutils.version.Versioning.register(Versioning.java:40) ~[NeoUtils-2.0.0-SNAPSHOT.jar:?]
        at com.neomechanical.neoutils.NeoUtilities.<init>(NeoUtilities.java:71) ~[NeoUtils-2.0.0-SNAPSHOT.jar:?]
        at com.neomechanical.neoutils.NeoUtils.init(NeoUtils.java:111) ~[NeoUtils-2.0.0-SNAPSHOT.jar:?]
        at com.neomechanical.neoutils.NeoUtils.getNeoUtilities(NeoUtils.java:101) ~[NeoUtils-2.0.0-SNAPSHOT.jar:?]
        at com.neomechanical.neoutils.version.Versioning.register(Versioning.java:40) ~[NeoUtils-2.0.0-SNAPSHOT.jar:?]
        at com.neomechanical.neoutils.NeoUtilities.<init>(NeoUtilities.java:71) ~[NeoUtils-2.0.0-SNAPSHOT.jar:?]```
hot panther
#

I have absolutely no idea how to do this

shadow zinc
#

chuck on some rock and chug a coke for inspiration

drowsy helm
#

I reckon time travel isnโ€™t possible because it would throw a stack overflow

shadow zinc
#

Finally it works

#

best feeling

zenith spire
#

hey there, what is the difference from normal advancements to recipe advancements?
I need to only register normal advancements and get completely spamed of the others.

echo basalt
#

you can bypass the stack by just having a List<Runnable> and looping it

#

where the runnable internally adds to the list

hot panther
#

So I want there to be different points as rewards for each different mob. Is there a better way than doing it this way?

echo basalt
hot panther
echo basalt
#

yeah you can just add checks for those

#

name().endsWIth("MINECART")

#

or startsWith idk

hot panther
#

Nvm figured out: The Event only deals with LivingEntities

mighty pier
#
                for (int i = cube.getX1(); i <= cube.getX2();i++) {
                    for (int j = cube.getY1(); j <= cube.getY2(); j++) {
                        for (int k = cube.getZ1(); k <= cube.getZ2();k++) {
                            Block block = world.getBlockAt(i,j,k);
                            block.setType(material);
                        }
                    }
                }``` should i store the values in a list and then loop through the list so it doesnt eat that much cpu?
#

cause its in a bukkitrunnable and it can do it every second

drowsy helm
#

Blockphysics event or some shit oike that

raw prairie
#

Im having trouble with this code

#

player.getWorld().createExplosion(loc.getX(), loc., front.getZ(), 5f);

#

Trying to get 2 blocks from where the player is placing, but It doesn't seem to work.. Heres my code:


    @EventHandler
    public void onRightClick(PlayerInteractEvent event) {
        if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) {
            Player player = event.getPlayer();
            Vector playersDirection = player.getLocation().getDirection();
            Location loc = player.getLocation().add(playersDirection).multiply(2);
                if (event.getItem() != null) {
                    double x = event.getPlayer().getAttackCooldown();
                    int y = (int) x;
                    if (x == y) {
                        if (event.getItem().getItemMeta().equals(ItemManager.GravHammer.getItemMeta())) {
                            player.getWorld().createExplosion(loc.getX(), loc., front.getZ(), 5f);
                            player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 3, 255, false, false, false));
                            System.out.println("I work");
                        }
                    }
                }
        }

    }```
#

Any ideas?

#

NvM i got it, thank you

glad prawn
#

??:D

raw prairie
#

I thought too hard about the loc part

#

Kinda dumb for not realizing lol

glad prawn
#

I don't even understand the question. ๐Ÿ’€

trim creek
glad prawn
trim creek
#

he already figured out what he wanted

empty obsidian
#

hello guys can you help me?

#

how can i fix this?

glad prawn
echo basalt
empty obsidian
#

what kind of name do I need to write?

glad prawn
#

ItemMeta meta =

empty obsidian
#

like this?

undone axleBOT
gritty brook
empty obsidian
#

sorry im begginer ๐Ÿ˜„

round finch
#

also watch some youtube tutorials for this basic stuff

#

there is alot of (Spigot / Bukkit ) api coding tuts out there

#

or sources

#

quick google

#

plus your I-D-E tells what right!

glad prawn
fallow violet
#

it the class

glad prawn
#

Nice

fallow violet
#

you write item.getItemMeta(); and item is the class Item

#

so you write Item.getItemMeta();

round finch
fallow violet
#

dunno how to explain

glad prawn
#

XD

round finch
glad prawn
#

For what ๐Ÿ—ฟ. I understand it.

smoky finch
#

I have two plugins A and B. Plugin B depends on A. I can add custom "handlers" to A from my plugin B, but the problem is that these handlers are called when the server is shutting down, and when the server is shutting down B is always going to disable before A and when it disables all it's classes are unloaded. So I will just get errors that the class doesn't exist from plugin A. How can I fix this?

round finch
#

java-naming-conventions

chrome beacon
#

?conventions

kindred valley
round finch
round finch
#

better having it more clear

vital sandal
#

?pastebin

#

?bin

round finch
glad prawn
#

?paste

undone axleBOT
raw prairie
#

having trouble with calling the entitydamageby entity event

#

it only seems to run 1 time

#

then stops calling the code within

#

any ideas?

smoky finch
glad prawn
undone axleBOT
tardy delta
#

im feeling like an idiot having everything mutable with setters, why cant mongo just use reflections

tardy delta
#

you could identify items by adding a custom pdc tag

#

?pdc

tardy delta
#

what meh

raw prairie
tardy delta
#

pdc is simple

raw prairie
#

so it does

#

work

#

it only runs one time for sum reason

#

oh wait

#

๐Ÿคฆโ€โ™‚๏ธ

#

i didnt check durablility

round finch
#

Seems over do

#

why not just use the instances

elfin atlas
#

Does someone know what the Pathfinder is when a goat is attacking?

round finch
#

do you mean as Server log or in game player chat stuff?

#

i'm pretty sure every message will be there

#

idk what you're trying to?

raw prairie
#

Is there something to check when a totem of undying is used?

tardy delta
#

if i wanted to use mongodb on my plugin and the server not running on my pc, do i have to set the connection to some running mongodb server or run the server myself on that pc?

round finch
#

EntityPotionEffectEvent

raw prairie
#

kk

#

ty

round finch
#

most things you can easily just find in spigot doc

raw prairie
#

but how might I iniatlize the runnable I am using

#

cause this

#

doesnt work

#

Im using runTaskTimer

tardy delta
#

pass in your plugin instance

#

?di

undone axleBOT
glossy venture
#

anyone know why it is not including LWJGL?

#

it does show in the compile classpath

#

but not in the external libraries

#
dependencies {
    api 'it.unimi.dsi:fastutil:8.5.8'

    api 'net.orbyfied.j8:j8-registry:0.1.0'
    api 'net.orbyfied.j8:j8-util:0.2.1.1_hotfix2'
    api 'net.orbyfied.j8:j8-event:0.1.0_hotfix1'

    // platforms
    compileOnlyApi "org.lwjgl:lwjgl"
    compileOnlyApi "org.lwjgl:lwjgl-glfw"
    compileOnlyApi "org.lwjgl:lwjgl-jawt"
    compileOnlyApi "org.lwjgl:lwjgl-jemalloc"
}
round finch
#

i think the simple way is to use the message channel..

#

on reciving

#
 @Override
  public void onPluginMessageReceived(String channel, Player player, byte[] message) {
}
#

the Bungeecord does the global stuff

#

why not just send it via bungeecord?

abstract rampart
#

I don't know if this applies to you, but one major drawback of plugin messages is that both spigot servers sending/receiving messages must have atleast 1 player online.

round finch
#

yeah it sucks

#

tru

elfin atlas
#

Does someone know what the Pathfinder is when a goat is attacking?

abstract rampart
#

I got tired of dealing with plugin messaging weirdness and wrote my own socket stuff to use. Much more work but more reliable

round finch
#

Server log to Bungeecord?

abstract rampart
#

Depends on the use-case, if it's bound to loopback it's fine

round finch
#

socket more work for sure!

#

๐Ÿ‘

hybrid spoke
#

would rather use a webservice or some third party stuff

abstract rampart
round finch
abstract rampart
# raw prairie doesnt work

this refers to the object you're currently in. runTaskTimer wants the instance of your plugin. If you schedule it from within your plugin's main class, you can use this, otherwise you need to pass an instance of the plugin to the other class to use there.

#

Or get the instance some other way, but passing it's the easiest

raw prairie
#

every 10 seconds

#

I worked it out

#

but I haave trouble putting the totem in the offhand

round finch
#

there is a event? bruh

raw prairie
#

get invetory

#

or smth

ivory sleet
abstract rampart
#

    public OtherThing(MyPlugin plugin) {
        this.plugin = plugin;
    }

...{
  new BukkitRunnable() {...}.runTaskTimer(plugin, number, number);
}```
raw prairie
#

but how do I put the totem in the offhand

round finch
tardy delta
#

hmm wondering if plugin uses mongodb, the end user has to run the mongodb server themselves or connect to a public hosted one or what

abstract rampart
#

player.getInventory().setItemInOffHand(item);

round finch
#

lemme guess you want to check if there is a totem every 10 sec?

hybrid spoke
raw prairie
round finch
#

repeating task

raw prairie
round finch
#

you probably need

raw prairie
#

lol

#

I have a bukkit runnable

#
    public void onEntityDamage(EntityPotionEffectEvent e){
        if(e.getCause().equals(EntityPotionEffectEvent.Cause.TOTEM)){

            Player player = (Player) e.getEntity();
            Bukkit.getScheduler().runTaskTimer(plugin, () -> {
                player.sendMessage(ChatColor.RED + "[CrystalBall] " + ChatColor.GREEN + "Your shield is down! Wait 10 seconds for it to replenish!");
                player.getInventory().setItemInOffHand(Item);
                Bukkit.getScheduler().runTaskTimer(plugin, () -> {}, 2, 10);
            }, 0, 200);
        }
    }```
abstract rampart
#

You're scheduling a new timer (repeating task) every time that happens?

glad prawn
#

Tf is that

tardy delta
#

just have one task for the user, store it in a map somewhere or whatever

round finch
#

it gonna be alot of tasks

#

you could just use 1 task