#help-development

1 messages Β· Page 2104 of 1

smoky oak
#

actually im curious about that too. @eternal oxide why'd you recommend this one?

eternal oxide
#

It doesn't clone or modify the location

smoky oak
#

poke

#

try to find which event creates them, then check that even if it is connected to the dragon, if yes, cancel the correct event

eternal oxide
smoky oak
#

im filling in mostly similar classes that all extend a preset

supple elk
smoky oak
#

I'm doing events that have effects in the world and chain together

supple elk
#

should it not be separated into ["plugins", "JetCore"]

#

oh whoops nvm I did dumb stuff

eternal oxide
#

Just multiple constructors

versed mango
#

so Player#getLocation().getBlock.getRelative(Blockface.DOWN) isn't working do i need to inport something to make that work?

supple elk
#

ok fixed but same thing happens

eternal oxide
#

Player is a Class, you need to use the player object

smoky oak
#

so it's, here, player.getLocation()...

versed mango
#

ah so i need to get the player class set up

smoky oak
eternal oxide
#

nope

smoky oak
#

k that makes my job easier

#

namely

#

class(HashMap<...> hashMap){
super(hashMap)
}

supple elk
versed mango
#
    void move(PlayerMoveEvent event) {
        Player player = event.getPlayer();
        Player.class
        Player.getLocation().getBlock().getRelative(BlockFace.DOWN);
    }``` did i do it right?
#

it doesn't bring up any errors now

eternal oxide
#

no

#

delete Player.class

versed mango
#

kk

eternal oxide
#

and change Player.getLoc to player.getLoc

versed mango
#

aight

#

done

#

that it?

eternal oxide
#

then you have to do somethign with the block you are getting

#

This line returns a Block player.getLocation().getBlock().getRelative(BlockFace.DOWN);

versed mango
#

i want it to be that the block they are standing on which for now is clay and latter will include mud.

eternal oxide
#

Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN);

versed mango
#

kk

glossy venture
#

Player#getLocation() is an instance method, meaning we are referring to <player object>.getLocation() the way we are writing it is just java notation

versed mango
#

ah ok

#

ok now i need to select the block type

#

right?

glossy venture
#

if it was a static method, it would be Player.getLocation()

#

referencing the class

#

instead of an instance

versed mango
#

ah ok

eternal oxide
#

if (block.getType() == Material.CLAY)

versed mango
#

that makes sence

versed mango
weary prawn
#

Can anyone help me understand the process of structures being built, I've got a void world chunk generator, and just did

@Override
public boolean shouldGenerateStructures() {
  return true;
}

to generate structures, but it didn't work. How do structures generate and how would I do it so that it can?

glossy venture
#

minecraft does extra checks per structure, and basically all of them need at least some blocks underneath or around them

weary prawn
#

hmmm

glossy venture
#

so i dont think you will be able to generate structures by just setting that to true

versed mango
#

what is the base walk speed of the player? or is there a way i can just use math to increase speed by 5%?

weary prawn
#

yeah it sounds like it, not sure how I could force it then, and I doubt searching through the nms is gonna help me

versed mango
#

i am useing player.setWalkspeed()

glossy venture
#

i recommend using attribute modifiers

#

also with that function the base speed is always 1

versed mango
#

i have no idea what those are

glossy venture
#

they modify attributes

glossy venture
#

like walk speed

#

in this case

smoky oak
#

do attributes get reset on relog?

versed mango
glossy venture
#

ill look it up

versed mango
#

thx

#

could i just do something like player.setWalkspeed(2) else player.setWalkspeed(1) or something like that?

glossy venture
#
private static final AttributeModifier SPEED_MODIFIER = new AttributeModifier("name", 2f, AttributeModifier.Operation.ADD_NUMBER);
                        // ^ added to the base speed, adjust to modify the strength of the effect

public void speedUpPlayer(Player player) {
  
  // get walk speed attribute
  AttributeInstance walkSpeed =             player.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED);
  
  // activate modifier
  walkSpeed.addModifier(SPEED_MODIFIER);

}

public void slowPlayerBackDown(Player player) {
  
  // get walking speed attribute
  AttributeInstance walkSpeed =             player.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED);
   
  // deactivate modifier
  walkSpeed.removeModifier(SPEED_MODIFIER);

}
glossy venture
#

or effects

versed mango
#

ah

glossy venture
#

then call speedUpPlayer(player) when you want the effect to start

#

and slowPlayerBackDown(player) when you want it to stop

#

so when someone leaves an area or somethign

versed mango
#

ok

smoky oak
#

so its permanent?

#

they'd start falling

#

dont disable flying

#

give player pdc the time until they can fly then chck if the system time is over that time, if yes, disable flying

#

yea if you do that with permissions or timings set flying faslse if the times run out

#

you can give them a few seconds of resistance after login

#

i believe that's already in the game for like a second or so too

#

afaik it does but im not 100% sure

#

ofc you need to apply a level of resistance that actually grants full damage immunity

versed mango
smoky oak
#

you can alternatively store the time of login and cancel all damage events that occur within 10 seconds of login

#

thugh that might get exploited

#

same

versed mango
#
    void move(PlayerMoveEvent event) {
        Player player = event.getPlayer();
        Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN);
        if (block.getType() == Material.CLAY);
        player.speedUpPlayer(player);
      //else if (block.getType() == Material.MUD);
      //player.speedUpPlayer(player);
        else
            player.speedPlayerBackDown(player);``` i dont think this works. the way i thought it did.
eternal oxide
#

; ends the line if (block.getType() == Material.CLAY);

glossy venture
#

you need to learn the java syntax

#

also the function is not a member of Player

#

so just do speedUpPlayer(player) and slowPlayerBackDown(player)

#

without the player. in front

versed mango
#

ah

glossy venture
#

its also called slowPlayerBackDown, not speedPlayerBackDown

versed mango
#

oops

glossy venture
#

yeah it gives full spawn protection too

#

ah

#

you could also cancel the fall damage

#

using some damage event

versed mango
#

fixed it. missed somthing else in the code that was not letting it call the speedUpPlayer and slowPlayerBackDown.

#

thx

weary prawn
#

couldn't you also just cancel the EntityDamageEvent after checking it's a player and has all the requirements that you want?

next stratus
#

Player p
pain.

steel swan
#

hey, i have a rank system made like this :

public enum Job {
        CITOYEN(""),
        STAFF(""),
        VISITEUR("");


        Job(String prefix) {

        }
    }

    public HashMap<Player, Job> jobs = new HashMap<Player, Job>();

    public void setjobs(Player player, Job job) {
        jobs.put(player, job);
    }

    public Job getjobs(Player player) {
        return jobs.get(player);
    }

The thing is, when a player leaves, or the server restarts, their role gets wiped out. How can i solve that?

next stratus
steel swan
#

where?

next stratus
#

I noticed the VISITEUR πŸ˜…

steel swan
#

i tried doing that :

public class PlayerClass {
        private String name;
        private int money;

        public PlayerClass(String aName, int aMoney){
            name = aName;
            money = aMoney;
        }

        public int getMoney(){
            return money;
        }
    }

    public void main(String[] args) throws FileNotFoundException, IOException {
        PlayerClass p1 = new PlayerClass("none", 0);
        ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("Person.txt"));
        out.writeObject(p1);
    }

(for the money)

next stratus
#

Ah no ;-;

steel swan
#

i know

#

that looks like a stupid error

next stratus
#

the main method is 😬

#

Also it shouldn't be in the object class

steel swan
#

ok so HOW can i do it pls

next stratus
#

you know OOP at all? If not that's cool I can explain basics

mighty pier
#

i have kits in a yamlconfiguration like this:

  kitname:
    delay:
    permission:
    items:
      ...``` how can i loop through all the kits?
mighty pier
#

no shit

next stratus
#

yeah, cool huh???

mighty pier
#

omfg

opal juniper
#

get the config section of kits, loop through all the keys of that section and get the config section of that key from the config section of kits

mighty pier
#

yes im asking how to do that

opal juniper
#

then you can do like get(β€œdelay”)

mighty pier
#

im trying to do that but its not working

opal juniper
#

show code then

mighty pier
#

for (String kit : KitData.get().getStringList("kits")){

opal juniper
#

no

mighty pier
#

no

opal juniper
#

KitData.get().getConfigSection(β€œkits”)

#

for string kit : section.getKeys()

next stratus
#

lol

mighty pier
#

ok ty

opal juniper
#

sommin like that

next stratus
#

i did say how but you didn't listen πŸ€·β€β™‚οΈ

opal juniper
#

i’m on phone so

next stratus
#

if anyone takes my dumb comments seriously you're hella boring at parties aren't you

mighty pier
#

some people are actually like that

next stratus
#

i try to make fun of stressful times and usually it works out πŸ€·β€β™‚οΈ

torn vale
torn vale
#

noo

#

I need 1.8.8 :/

next stratus
#

nope

#

1.8 is shit

torn vale
#

yea ik but for the project im working on I need the 1.8.8

next stratus
#

nope you can do it in 1.18 fine πŸ™‚

eternal night
#

bungeecord's api is not bound to the minecraft server version

next stratus
#

so they fucked up that api?

eternal night
#

wat

#

oh

#

it is

#

:kekw:

#

Anyway bungeecord existed in 1.8

#

you will just have to go on a little adventure

#

to find it

next stratus
#

yeah I knew it existed I just hate 1.8

#

well 1.12 and lower

eternal night
#

True, but poor people want their clicking to go fast

next stratus
#

just add plugins to emulate it lol

eternal night
#

Ssshh let them run unmaintained software known to contain bugs

onyx fjord
#

no

next stratus
#

imagine having to remember 89 as glowstone 😷

onyx fjord
#

we shouldnt give bad advice

eternal night
#

This is the spigot discord, isn't bad advise like, the motto :kappa:

onyx fjord
#

nononoono listen listen

next stratus
#

karen incoming?

smoky oak
#

whats the correct parse arg to turn a Object into a HashSet<HashSet<Object>>[]?

eternal night
#

cursed

#

idk what you are doing, but you are doing it wrong most certainly

smoky oak
#

now mind answering my question?

eternal night
#

HashSet<HashSet<Object>>[] is a signature that just should not exist. Write proper wrapper classes

#

anyway, what kind of object do you have

smoky oak
#

Object

eternal night
#

bruh

#

cool

#

object can be anything

#

what kind of question is "how do I transform anything into this specific type"

#

where does it come from

smoky oak
#

no i know that that Object was originally of that signature

#

im just not sure how to turnit back

eternal night
#

cast ?

smoky oak
#

just the signature in parenthesis?

#

err

eternal night
#

if you know an object is of said type you cast

smoky oak
#

() those

eternal night
#

You are writing HashSet<HashSet<Object>>[] types and don't know how to cast ?

smoky oak
#

i am unsure if just writing the signature is enough here

eternal night
#

Anyway, this is still garbage. You are breaking the type system for no reason

#

why do you only have an object

minor garnet
#
            final PacketContainer container = event.getPacket();
            final StructureModifier<WrappedChatComponent> components = container.getChatComponents();
            final WrappedChatComponent chat = components.read(0);
            plugin.sendMessage(chat.getJson());
            final IChatBaseComponent base = ChatSerializer.a(chat.getJson());
            
            final String message = base.getText();
            plugin.sendMessage(message);```
why the next message is a blank field
eternal night
#

Is this some kind of object output stream trash ?

#

spigot wraps their string messages in a parent without text

#

you are just getting said parents text, which is empty

minor garnet
#

so

smoky oak
#

It's a parser class. I shove everything in a hashMap<String, Object> then nulll check it in the super(hashMap) constructor

eternal night
#

You need a proper component serializer

#

Well if you know the object has that type 100% you can cast it. But again, this just does not sound like good object oriented staticly typed code

minor garnet
#

im forking a older plugin, he use reflection to use IBaseComponent using objects, message = this.plugin.getMessageMethod().invoke(chat.getHandle(), new Object[0]);

smoky oak
#

what part of that is static

eternal night
#

statically typed

#

not static

#

that is a difference

minor garnet
#

i dont know what the method c do

eternal night
#

java isn't javascript. You should care about your types and not just Object everything

smoky oak
#

im aware of that but in this instance its necessary

#

the purpose of that map is to transfer data of different types between objects that have no connection to each other

#

hence its position in the constructor and the super(hashMap) stuff

quiet ice
#

interfaces 🌟

eternal night
#

but I have no idea either

#

you are working with server internals

#

lemme see if I can find you the method

summer scroll
#

Can you somehow disable soul sand effect to certain players?

#

Yeah that could work I guess.

#

I can't test right now but does the player's movement speed got reduced when they walk in soul sand?

#

It would be decreased I guess?

#

Ah okay, so what I would do is increasing the walk speed when player walks in soul sand and revert it back if player is no longer walking in soul sand?

#

Too many checks smh

maiden briar
#

File file = Paths.get(scanner.next().replaceAll(" ", "%20")).toFile(); Does NOT work??? I have a path like this: C:\Users\First Last\Desktop\files

summer scroll
#

Anyways, thanks for this, gonna research more If I can.

maiden briar
#

It just prints the spaces with %20

#

Idk what is wrong

sharp flare
#

try scanner#next()#replace()

#

also use underscore or dash instead of whitespaces

tardy delta
#

unchecked cast lets goo

eternal night
#

Player p = (Player) cs;

lost matrix
#

Youve been here for years...

eternal night
#

the command sender may be the console

#

or a command block

#

but bro they can still execute the command

tardy delta
#

if the console executes that command, you will get a classcast exception

eternal night
#

you do an instanceOf check

tardy delta
#

^

#

why the Float.valueOf btw?

eternal night
#

p.getAllowFlight() == true is also a classic

lost matrix
#
Float speed = (float) Double.parseDouble("" + 0.03f);
eternal night
#

Yea but like true == true

#

is just redundant

tardy delta
#

also the logic wont work if i read it correctly

#

if cmd name == "fly" and has permission { execute command }
else { execute other flying stuff }

#

lemm paste that in an ide lol

#

the else part will execute for every other command

#

vscode isnt an ide shhh

#

nesting the cmd name check and then another if else for the fly checks would look better /_/

river oracle
tardy delta
#

i dont have intellij on linux πŸ˜‚

river oracle
#

I don't like intellij

tardy delta
#

dont tell me you're using eclipse

river oracle
#

I use vscode

tardy delta
#

smh

#

an ide has more functionality

#

without installing plugins

river oracle
#

Ahh see that's the cool thing about vscode I don't need 5 ides

river oracle
#

Intellij is gross

#

I tried to wake up the intellij simps

#

Enter vscode

chrome beacon
#

Intellij is free

river oracle
#

Yea

#

You need plugins but it supports pretty much any language

#

No I just made a maven archetype for that so I just run a Linux command and it's all set up

lost matrix
#

Imagine writing java in vs...

minor garnet
eternal night
#

I can't find shit xD

#

what mappings are those

minor garnet
#

mappings?

eternal night
#

spigot mappings ?

river oracle
eternal night
#

instead of whatever you are using

river oracle
#

It works fine unit tests work fine so wheres your complaint minus the fact it's nowhere near as bloated as intellij with features I'll never use

eternal night
#

jetbrains fleet hopefully just fixes that

minor garnet
#

i haver only those methods

eternal night
#

what version are you on

minor garnet
#

1.12.2

eternal night
#

rip

#

gl have fun

minor garnet
#

considering im forking a 1.5 plugin

river oracle
#

Why is the question

eternal night
#

forking a 1.5 plugin

#

sounds more like a rewrite

minor garnet
#

no

river oracle
#

Just rewrite it at that point lol

eternal night
#

okay should sound more like a rewrite

minor garnet
eternal night
#

Message remove is always such a funny concept because the only thing that does is replay the chat

tardy delta
#

isnt the ChatComponent api enough?

minor garnet
eternal night
#

but why not just recode that ?

minor garnet
eternal night
#

I don't see how that needs packets

#

just listen to the chat event on highest priority

#

and then cancel it and send either the same message

#

or one with the x at the end

#

to the players online

minor garnet
#

I wish this Wait cooldown would always be down you know

tardy delta
#

wait 2.1926805 seconds πŸ€”

eternal night
#

I mean, the plugin you are "forking" can also just replay the chat

#

it is just a matter of how many empty lines you throw

quaint mantle
#

Is there a way to create fake fps lag with packets for a single player?

minor garnet
#

no i lie, 9

quaint mantle
#

but not crash a user just create fake fps lag

#

I'm creating a minigame

#

I need this

minor garnet
eternal night
#

what kind of minigame wants to lag a player

#

but I guess you can spam the player with packets ?

quaint mantle
#

yes but what packets? I don't want to crash a user

#

just make it so the fps decreases

eternal night
#

I mean, spawn a lot of invisible armor stands or something

#

with packets

#

Β―_(ツ)_/Β―

quaint mantle
#

will that lag a server?

minor garnet
quaint mantle
#

also invisible packet based armor stands would be visible only to that player?

eternal night
#

Hmm

#

well not all messages no

#

only chat

#

But eek, I don't have any idea what methods were available in 1.12

minor garnet
small current
quaint mantle
#

i just want to cause fps lag

small current
#

Oh fps ?

minor garnet
small current
#

100 armor stands in one location

quaint mantle
#

Thank you, will try

grim ice
#

Not just that the plugin is 1.5, there's a high chance the plugin design is bullshit since it's way too old

#

that doesn't always apply, but it does most of the time in spigot plugins

#

at least to my experience

#

Rewriting it from 0 would be a better option imo

tardy delta
#

i rewrited my plugin twice

quaint mantle
#
        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(Bukkit.getWorld(player.getWorld()).getChunkAt(X +3, Z +3), 65535, 100));
    }```
Like this?
tardy delta
#

you're only sending one packet

quaint mantle
#

Z

summer scroll
#

Can I get the default hit cooldown of each material?

tidal void
#

can anyone help me im completley stumped on this
the plugin becomes null when method is called from another???

java.lang.NullPointerException: Cannot invoke "org.bukkit.plugin.Plugin.getServer()" because "plugin" is null
tidal void
summer scroll
#

Oh attack speed

vocal tundra
hybrid spoke
#

probably never instantiated

tidal void
#

ye but it runs ```public static JavaPlugin getPlugin() {
return JavaPlugin.getPlugin(WhMain.class);
}

#

but after load it dissapears but i dont think it should be getting garbage collected

left swift
#

when I send playerlist plugin message on BungeeCord channel it automatically send to the plugin incoming message with players on BungeeCord channel?

vocal tundra
#

try using the string method instead maybe? Bukkit.getPluginManager().getPlugin()

summer scroll
sacred mountain
#

hey whats the difference between using the NMS versions of entities?

#

like Player and CraftPlayer

#

or Creature/CraftCreature, Fireball/CraftLargeFireball

echo basalt
#

that's not NMS

#

that's CraftBukkit

#

If you notice, Player is an interface

sacred mountain
#

oh well that thing

echo basalt
#

CraftPlayer is the implementation of that interface

#

that grabs the friendly methods and calls the NMS methods

lavish robin
amber palm
#

Hi guys, i need help with finding a tnt plugin, i am creating the anarhy server, and i need a plugin which can customize the dynamite and the strength of its explosion

grim ice
#

too

#

or explosions

#

which are simpler to do

#

and idk why would u want to lag a player

#

and?

#

he wants to lag the client

#

not the server

#

Eitherway

#

do you guys know

#

how did spigot

#

provide a dependency for people to depend on (spigot-api) that only contains the abstraction, but the implementation is in the server jar

#

i want to do that for a plugin

#

so that devs can access only interfaces and such

#

Why

quaint mantle
#

That is true

tardy delta
glossy venture
#

damn this is the full parent tree of org.bukkit.Player

#

not even CraftPlayer

ivory sleet
#

yuh

glossy venture
#

this is it of nms Player mojang mapped

#

appearently EntityHuman

#

at runtime

ivory sleet
#

well

#

there's a local one, a remote one and a server one

glossy venture
#

oh yea

#

so i should do it on ServerPlayer

ivory sleet
#

yuh

glossy venture
#

bruh

#

not much different

#

EntityPlayer is ServerPlayer

knotty gale
#

yo so I have a listener that checks if a player was hit. that works fine. But hoiw do I make it detect if a player was hit by an arrow and who shot the arrow?

glossy venture
#

i think you can get the projectile

#

and get the shooter from there

#

to check if it is an arrow, you can use projectile.getType() == EntityType.ARROW i guess

#

idk

knotty gale
#

I have tried it but it wont work well

glossy venture
#

?

knotty gale
#

lemme try it again ig idk

ivory sleet
#

Yuh check EntityDamageByEntityEvent, get the damager, ensure its a projectile, ensure the projectile is an arrow, and ensure its shooter is a player pretty much

knotty gale
#

ok

ivory sleet
#

and yeah, ofc check if the damagee is a player in ur case

knotty gale
eternal needle
#

hi i don't now what but my plugin crash the server after some hours

knotty gale
#

possibly

ivory sleet
ivory sleet
knotty gale
#

ahh ok

knotty gale
grim ice
#

if my class A implements B, i want the user to only see B, not A

knotty gale
#

cause that brings an error

ivory sleet
#

I mean you grab the projectile from the event

tardy delta
#

make it 2 packages?

grim ice
#

yeah then?

tardy delta
#

conclure what happened with your name?

tardy delta
#

dunno how the maven dependency thing works but that should be possible no?

eternal needle
ivory sleet
#

I truncated the help thing cuz people were pinging me for ridiculous reasons also I am quite busy w/ a mod

grim ice
#

conclure u have an idea

#

of how to make a maven dependency for only one package

ivory sleet
#

I mean the java module system might assist you here

ivory sleet
#

project jigsaw in particular

#

tho u pretty much need a jar per module

grim ice
ivory sleet
grim ice
#

that seems like pain

ivory sleet
#

I mean its quite powerful

#

since it works similarly to the bukkit ServicesManager system in a way

#

(ServiceLoader) but ye

left swift
#
    @Override
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
        if (sender instanceof  Player player) {
            sendPlayerToServer(player, "hub");
            return true;
        }
        return false;
    }

    private void sendPlayerToServer(@NotNull Player player, String server) {
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream);
        try {
            dataOutputStream.writeUTF("Connect");
            dataOutputStream.writeUTF(server);
        } catch (IOException e) {
            e.printStackTrace();
        }
        player.sendPluginMessage(XEssentials.getInstance(), "BungeeCord", byteArrayOutputStream.toByteArray());
    }``````java
    @EventHandler
    public void onJoin(@NotNull PlayerJoinEvent event) {
        Test.sendPlayerList(event.getPlayer());
    }``````java
        getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
        getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new Test());```Why it doesn't print all players when is only one player on the server? When join another player it works.
grim ice
#

is there some guide of it that you know

ivory sleet
#

google java modules, I believe there should be plenty of resources regarding this topic :3

knotty gale
#

any reason this wouldnt work?

@EventHandler
    public void EntityDamageByEntityEvent(EntityDamageByEntityEvent e) {
        if(e.getCause() != EntityDamageByEntityEvent.DamageCause.PROJECTILE) {
            Projectile projectile = (Projectile)e.getDamager();
            if(((projectile.getShooter() instanceof Player)) && ((e.getEntity() instanceof Player))) {
                Bukkit.broadcastMessage(e.getEntity().getName() + " was shot");
            }
        }
    }
ivory sleet
#

no

#

looks fine

knotty gale
#

well it wont work

ivory sleet
#

let me test

knotty gale
#

ok

glossy venture
#

what doesnt work

#

what do you mean by "doesnt work"

#

does it give an error?

knotty gale
#

no error

#

the plugin just wont do what it does

ivory sleet
#

yeah im testing sth rn :3

glossy venture
#

debug it by putting print statements after every if statement

#

then you know which check fails

ivory sleet
#
new Listener() {
            @EventHandler void epic(EntityDamageByEntityEvent event) {
                if (!(event.getEntity() instanceof Player damagee)) {
                    return;
                }
                if (!(event.getDamager() instanceof Projectile projectile)) {
                    return;
                }
                if (!(projectile.getShooter() instanceof Player damager)) {
                    return;
                }
                System.out.printf("%s damaged %s",damager,damagee);
            }
        }

testing this with breakpoints rn

knotty gale
#

"|

#

😐

#

im honestly so dumb

rotund pond
#

Hello everyone, I just have a basic java question.
Do you have a code more optimised than mine ?

...
int timeLeftLong = (int) (module.getTimeLeft() / 1000); // Seconds left

int day = timeLeftLong / 86400; // Days left
timeLeftLong %= 86400; // I rmove these days
int hours = timeLeftLong / 3600; // Hours left
timeLeftLong %= 3600; // I remove these hours
int minutes = timeLeftLong / 60; // Minutes left

return String.format("%dd, %dh, %dmins", day, hours, minutes);
knotty gale
#

does anyone know how to make a command that toggles a mode. (this is for the plugin that I was using where it broadcasts the message) instead I want it to only do it when a mode is toggled

left swift
#

Ok, works, thank you!

cunning shard
#

uhhhhhhhhhhhhhhhhhhhhhhh

#

I need help with a thing if yall dont mind me asking

#

Im making this taser plugin and i cant figure out how to make it affect other entities and i cant figure out how to make it work within 5 blocks

This is what i have and no it doesn't work:


    @EventHandler
    public void onInteract(PlayerInteractEvent e) {
        Player p = e.getPlayer();
        if (e instanceof LivingEntity) {
            LivingEntity.add((LivingEntity) e);
        }
            if (p.getItemInHand().getType() == Material.CARROT_ON_A_STICK) {
            p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 100, 250));
            p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 100, 250));
            p.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, 100, 250));

            Location origin = p.getEyeLocation();
            Vector direction = origin.getDirection();



            }
        }

    }```
    
Im not the smartest and google wont help me
knotty gale
#

cause just players would work easier

cunning shard
#

preferably just players yeah

knotty gale
#

than do instead of LivingEntity do Player

cunning shard
#

sorry for asking but the add part is still invalid and idk why

knotty gale
#

any errors?

cunning shard
#

Cannot resolve method 'add' in 'Player'

knotty gale
#

hmm gimme a minute

cunning shard
#

oki

#

sorry

quaint mantle
#

How to use PacketPlayOutMapChunk to get nearby player's chunks?

ionic hatch
#

if you do e.getPlayer, doesn't it get the player that did the event in the first place?

knotty gale
# cunning shard sorry

I cant find anything. But all ik is that "add" is not valid in player try finding another way

warm saddle
#

how would i get the location of the enitity being attacked from an EntityDamageEvent method

chrome beacon
fresh drum
#

Hey ! Which packet is sended when a player interact ?

chrome beacon
steel swan
#

hey, i have this code that gives a player a Job (its an enum) :

public enum Job {
        CITOYEN(""),
        STAFF(""),
        VISITEUR("");


        Job(String prefix) {

        }
    }

    public HashMap<Player, Job> jobs = new HashMap<Player, Job>();

    public void setjobs(Player player, Job job) {
        jobs.put(player, job);
    }

    public Job getjobs(Player player) {
        return jobs.get(player);
    }

the thing is, if i give job to a player like : setjobs (player, STAFF)
When the player disconects or the server restarts, they have no rank anymore.
How could i fix that

fresh drum
quaint mantle
chrome beacon
steel swan
fresh drum
#

Thats why the listener don't works

chrome beacon
quaint mantle
fresh drum
warm saddle
#

Hey im using the EntityDamageEvent method, how would i get the loction of the entity that has been attacked?

quaint mantle
quaint mantle
#

if ur talking about entities being attacked, it would be entitydamagebyentity event

warm saddle
ionic hatch
quaint mantle
#

if you want only players

#

then just do if(event.getDamager() instanceof Player)

quaint mantle
#

How do i get the playercount of an server in the same bungeecord network?

the plugin i code is an Bukkit plugin, not an Bungeecord Plugin. but i want to get the playercount of an different server in my Bungeecord network.

#

is there any way?

shrewd sentinel
#

How does hypixel skyblock do mob spawning?

quaint mantle
#

oh okay thanks

warm saddle
#

is it possible to modify the explosion size of primed tnt or does it have to be a creeper

#

i dont want it for all of the primed tnt tho i just want it for the one im spawning

small lynx
lean gull
#

does anyone know of a simple way to make it so players can pull their bows and shoot without having arrows in their inventory?

sinful tundra
#

I have this written in my config.yml, how can I read it?

#

Like, is it a list, a map?

#

I meant through the items

#

It's like this:

items:
  cactus: 0
#

And I want to read all of the key,values in items

#

I want people to add what they want to the config

#

Like, every item to the list and it'll be added

#

Because I will never be able to know the path to each one of them

#

This is the code for the config file but idk how to find the required thing to get it

public static HashMap<String, Integer> getAllForbidden(Xpdestroyer instance) {
        Object map = instance.getConfig().get("items");
        HashMap<String, Integer> hashMap = new HashMap<>();
        System.out.println(map);
        return hashMap;
    }
#

Like, there's nothing for now I'm trying to test and read it but I need to get the configured list

small lynx
steel swan
#

?paste

undone axleBOT
steel swan
sinful tundra
#

Tnx

tardy delta
#

why Double.valueOf?

#

i wouldnt load the file every time you call that method

tardy delta
steel swan
#

my main class i think

#

yeah

#

and ?

#

oh

#

yeah but i have an error

#

if i dont put that

#

if i dont put the listeneer thing

#

i have an error

#

in wich class

#

which

#

oh

#

yeah

tardy delta
#

i can barely read that

steel swan
#

ok its done

#

lemme try it rn

#

well idk i thought u needed to implement a class like that

ivory sleet
#

mye

#

technically you could use a map

#

and then you pretty much listen to AsyncPlayerChatEvent if you're using spigot

#

nw :3

sacred prairie
#

How can i remove mob drops from zombies?

sacred prairie
#

Thank you

unique lintel
lyric grove
#

Which should i use? i know stream would be worse for performance but i think its cleaner

ivory sleet
#

Idk

#

both seem fine here

spiral hinge
#

Dont mind the messy code but for some reason I am getting this error in my IDE

Code

    @EventHandler
    public void onPlayerLeave(PlayerBedLeaveEvent event) {
        if (event.getPlayer().getGameMode() == GameMode.ADVENTURE) {
            System.out.println(event.getPlayer().getDisplayName() + "was killed because they were in Adventure mode.. soooo");
                BukkitTask task = new BukkitRunnable() {
                    @Override
                    public void run() {
                        if (event.getPlayer().isDead() == true) {
                            Bukkit.getScheduler().cancelTask(task.getTaskId());
                        } else {
                            event.getPlayer().setHealth(event.getPlayer().getHealth() - 1);
                        }
                    }
                }.runTaskTimer(this, 1, 20);
        }
        else {
            System.out.println(event.getPlayer().getDisplayName() + "was not killed because they were in" + event.getPlayer().getGameMode() + "mode.");
        }
    }

Error

Variable 'task' might not have been initialized```
smoky oak
#

try removing this exact part BukkitTask task =

ivory sleet
#

Instead of Bukkit.getScheduler().cancelTask(task.getTaskId()) use this.cancel()

#

since you're inside the run method of a BukkitRunnable

smoky oak
#

there a reason to use this.cancel() over just cancel()?

eternal night
#

this is just cool πŸ™‚

ivory sleet
#

I mean I'd advocate using this whenever possible as you can then see the caller

steel swan
#

hey i have this code

public static void main(String[] args){
        try {
            BufferedWriter writer = new BufferedWriter(new FileWriter("file.txt"));
            writer.write("98lop");
            writer.write("\nDev");
            writer.close();
        } catch (IOException e){
            e.printStackTrace();
        }



    }
#

to write smth in a file

#

why

#

doesnt it work

#

like i make it run, the file isnt created

#

and if i put it on ther server

#

it doesnt either

smoky oak
#

creating the file is something you do manually

steel swan
#

i did

#

its created

#

but doesnt work

#

it desnt write anything in it

eternal night
#

did ya flush the buffer

steel swan
#

wdym

#

how do i do that

eternal night
#

.flush()

steel swan
#

writer.flush() ?

eternal night
#

yes

steel swan
#

where?

eternal night
#

prior to closing

steel swan
#

still doesnt write

eternal night
#

are you sure the file.txt file is the right one ?

steel swan
eternal night
#

I presume FileWriter(String) just uses the user.dir

steel swan
#

so any idea why?

tardy delta
#

no file extensions smh

steel swan
#

.?

eternal night
#

idk ```java
try (final BufferedWriter writer = new BufferedWriter(new FileWriter("file.txt"))){
writer.write("File content!");
} catch (IOException e) {
throw new RuntimeException(e);
}

#

works well for me

ivory sleet
#

ye works for me as well

tardy delta
#

final is fancy too?

#

πŸ˜‚

ivory sleet
#

I mean final good :3

eternal night
#

idk my intellij just finals everything

tardy delta
#

people are just missing a keyword

ivory sleet
#

too easy to mistakenly mutate stuff fourteenbrush

#

so yee

steel swan
#

its in this class

#

if it can be the cause

eternal night
#

you are running this as a jar right ?

#

not as a plugin you throw into your server

kind stream
#

how can i change 'Not authenticated with minecraft.net' message to something else

steel swan
#

yeah i click on "run"

eternal night
#

I mean

#

the run thing is a mvn build

#

not a java run

#

from the looks of it

#

m8 if your issue was that you just did not execute your code πŸ˜‚

ivory sleet
#

πŸ₯²

eternal night
#

the long time without a response worries me I was right

steel swan
#

ok so

#

i tried running it with the server

#

and

#

empty

#

mpty

#

mty

#

mp

#

[ ]

ivory sleet
#

well

#

thing is

#

that main method does not execute out of thin air

#

you gotta call it somewhere

steel swan
#

in onenable

ivory sleet
#

for instance in your onEnable

steel swan
#

for instance?

#

ok

ivory sleet
#

yes

steel swan
#

and how do i call it in onEnable
do i do it like mains() ?

ivory sleet
#

main();

steel swan
#

its asking for args

#

the String[] args

#

thing

eternal night
#

don't create a main method in a plugin

#

that makes no sense

ivory sleet
#

^that too

eternal night
#

the main method is the entry point when executing that jar using java -jar

#

which you won't do

ivory sleet
#

but pass null might be enough for your so called test

eternal night
#

true that

steel swan
#

ok so what do i put in the ()

#

null ?

ivory sleet
#

main(null);

steel swan
#

k

ivory sleet
#

ye

sacred barn
#

I read your full question, dont think you need a main method like @eternal night said, call your file writing in the onEnable? Calling main(null) for something like this i never seen

steel swan
#

works

#

thanks a lot

eternal night
#

I mean yea, that was mainly for testing

#

cartierbass is right tho, you don't want/need a main method

sacred barn
#

Have a method for your file writing > call it in onenable, would save headache

steel swan
#

yeah

#

i know

#

thats what i was gonna do

#

hmmm that was just for testing

left swift
#

is it possible to add custom suggestions when player is typing a normal chat message?

tardy delta
#

with packets i think

worldly ingot
#

No, the client will auto complete player names

glossy venture
#

only with commands i think

worldly ingot
#

So, whatever players are online according to the player (e.g. player info packet -> add player) is what the client will suggest in a chat message

glossy venture
#

send fake players

#

lol

worldly ingot
#

I mean, yeah, you could do that, but that comes with other implications ;p

tardy delta
#

couldnt you send a command tab completion packet but instead for normal chat?

worldly ingot
#

No, the client won't know what to do with that ;p

#

Again, it only tab completes player names

serene egret
#

do i need to import anything for this to work?

#

i already have org.bukkit.Sound

ornate heart
#

When did PDC get added to the API?

tardy delta
#

1.12 iirc

#

you could check out the docs

ornate heart
#

Gotchu. Thanks.

chrome beacon
#

?pdc

chrome beacon
#

1.14

tardy delta
#

aight

eternal night
#

1.13 had the CustomItemTag thing

hexed hatch
glossy venture
#

should subcommands be written as dumpReport, dumpreport or dump_report

#

because usually its like adduser instead of addUser

#

but dumpreport looks kinda weird or something

#

but idk

tardy delta
#

im confused whether or not youre talking about java now

#

with the convention it would be dumpReport

glossy venture
#

hmm

#

but dumpreport looks cleaner

#

we need a minecraft command naming standard

#

yes

tardy delta
#

ah is it for ingame?

#

then dumpreport

raw totem
#

Heyhey, goed evening πŸ™‚

Is there a way to disable certain minecraft commands such as /pl ?

tall dragon
#

yes

tardy delta
#

easiest way is to download luckperms

raw totem
#

oke cool πŸ™‚

tardy delta
#

do people even use google?

raw totem
#

That was in my mind but I was also strugling in my code πŸ™ˆ

tall dragon
#

imo u shoulnt mess with setting perms in ur own code

#

better off just using lp indeed

raw totem
#

πŸ‘ thanks

quaint mantle
#

can anyone link me to an example of a how to make a subcommand without using an api, im not sure how to create one.

hasty prawn
#

Use the args[] array that's passed in onCommand

quaint mantle
#

args[] being the subcommand.

#

that was what i was thinking but how would i then have a sub command of a sub command?

hasty prawn
#

args is just an array of everything after the main command

#

So, for example if they did /tp Player1 Player2, args would be [Player1, Player2]

quaint mantle
#

oh ok i didnt know that

hasty prawn
#

And you can basically just "tree" the sub commands.

#

If that makes sense

quaint mantle
#

yeah that makes sense thanks πŸ™‚

subtle tapir
#

That is the exact same way all the CLI abstraction APIs work.

quaint mantle
#

Who can help me?

subtle tapir
#

Just ask

quaint mantle
#

Kind of specific

#

Im creating a bukkit.inv that is useable by the player

#

the player can put certain itemstacks inside this inventory and it exchanges via exp

#

how would I go about iterating through the objects placed in that inventory without using a click event?

#

Like a inventoryCloseevent

#

Or something along those lines.

subtle tapir
#

CloseEvent could be problematic

#

Doesn't InventoryClickEvent fit your needs?

#

When do you want to iterate over the items?

quaint mantle
#

After olayer closes inventory

echo basalt
#

InventoryCloseEvent

zealous osprey
#

Sorry to interfere, but I have another question.
I'm currently looking into nicer UI varients and I noticed the use of clickable chat components, which I'd like to use.
Problem is, I can't seem to get it working with the 1.12.2 api.
Most, if not all versions that I've seen implementing this used
Player#sendMessage(TextComponent) that aparently doesn't exist for me ?
Also tried using a json formated string, which doesnt seem to work with either
Player#sendMessage(String) or Player#sendRawMessage(String)

quaint mantle
#

I hate events lmao, but I guess I could try

opal juniper
#

Player#spigot()#sendMessage

zealous osprey
#

...
Very much thank you <3

knotty gale
#

Hey. How do I make a toggle thing

#

so like if I do a command it toggles a mode

knotty gale
#

yes

#

boolean

kind patrol
#

to toggle a boolean just do boolean = !boolean

knotty gale
#

then I can run a command if it is true

tender shard
# kind patrol to toggle a boolean just do boolean = !boolean

way too simple. Better use a BooleanTogglerFactory:

public class BooleanToggler {
        
        private final boolean bool;
        
        private BooleanToggler(boolean bool) {
            this.bool = bool;
        }
        
        public boolean toggle() {
            return !bool;
        }
        
        public static class BooleanTogglerFactory {
            
            private final BooleanToggler toggler;
            
            public BooleanTogglerFactory(boolean bool) {
                this.toggler = new BooleanToggler(bool);
            }
            
            public BooleanToggler bake() {
                return toggler;
            }
        }
        
    }
#

now you can easily do

boolean toggledBool = new BooleanToggler.BooleanTogglerFactory(myBoolean).bake().toggle();
earnest forum
#

I think that's too simplified for me

tender shard
#
bool = bool != !Boolean.TRUE ? new boolean[] {Double.NaN == Double.NaN}[0] : Float.NaN != Float.NaN;

I think we can agree that this is the industry standard to toggle booleans

kindred valley
#

im trying to get generics better but i need to ask you a question

#
public static <E> E puanHesapla(E e1, E e2) {
        return e1 + e2;
    }```
#

why is this not true

tender shard
#

"not true"?

kindred valley
tender shard
#

no, it won't even compile

kindred valley
#

yes

tender shard
#

because the Operator "+" is not defined for every kind of object

#

E can be ANY kind of class

#

it could be "java.lang.Object"

#

and "+" is not defined for "Object"

#

I mean just imagine you'd do this:

Location newLoc = puanHesapla(location1, location2);

this makes no sense. you cannot apply "+" on a Location object

small lynx
#

I have replaced all my systems to vault and playerpoints

hexed hatch
#

why in god's name are you using static for that

#

Sorry, I was speaking to Rafael

#

I have no idea what you're using static for lol

kindred valley
small lynx
#

@hexed hatch the method is called in other classes

#

So it need to be static

hexed hatch
#

Okay? And?

#

Wrong

delicate lynx
#

static abuse

hexed hatch
#

Horribly terribly wrong

#

You really need to learn Java and how it works

#

That's my only advice

delicate lynx
#

fix that indentation too

tender shard
small lynx
#

Why the compiler give error when i dont make it static

kindred valley
tender shard
hexed hatch
delicate lynx
#

because you need to create an instance of the class to call non-static methods

tender shard
#

btw generics cannot handle primitives anyway

small lynx
#

I have changed the code to use Vault

#

Instead

#

So it will not lag

tender shard
#

this makes no sense

#

how would using vault get rid of any lags?

small lynx
#

Because my old XP system is not otimized

#

So now economy plugin handles it

tender shard
#

tbh I don't see anything wrong with those methods being static as they obviously are utility methods. what I'd be upset though would be that you have toe same 2 lines of code 4 times in those methods

#

if you have the exact same code more than once, you're doing something wrong

flat olive
#

BasicDBObject query = new BasicDBObject();

try{
    Bson projection = fields(include("name"), exclude("_id"));
    col.find(query).projection(projection).forEach(doc ->
            System.out.println(doc.toJson()));
    cursor.close();

} catch(Exception e) {
    System.out.println(e.getMessage());
}

Essentially this is a query that finds all of the fields that include the name "name" for whatever is in my columns, my output for each name is usually

{"name": "WhateverNameIs"}

How can I only access the name inside the actual field itself, so I can compare that string name with something else.

#

so if name is equal to user online then do whatever next

#

using mongodb

tender shard
#

what even is "col" or "cursor"?

flat olive
#

col represents the collection of what’s in my database

subtle tapir
#

col is a mongodb collection

#

JsonObject obj = new JsonParser().parse(doc.toJson()).getAsJsonObject(); String name = obj.get("name").getAsString();
could be a temporary solution

flat olive
#

So that gets the string inside the field?

#

my output is usually {β€œname: β€œnameHere”} but I’m just trying to access β€œnameHere”

tender shard
#

yeah, do what joestr said

subtle tapir
#

requires GSON though

flat olive
#

So what I’m doing is just formatting an object into json but what you did was format it into a string so I could access whatever is inside the field?

#

Okay I’ll try that in a sec

tender shard
#
    public static void main( String[] args ) {
        String json = "{\"name\": \"mfnalex\"}";
        JsonObject obj = JsonParser.parseString(json).getAsJsonObject();
        String name = obj.get("name").getAsString();
        System.out.println(name);
    }
#

this prints "mfnalex"

sand vector
#

Can someone guide me on where to look for custom enchants. When searching it's normally outdated.

tender shard
subtle tapir
#

BSON, GSON no wonder everbody is confused

quaint mantle
#

Someone help in pm?

tender shard
#

not me

#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

flat olive
quaint mantle
#

Basically, it's a bukkit inventory that opens and takes in certain items (ingame currency items) and iterates through them and sends amounts of exp based on whats put in

#

How do I store the items in the inventory so I can stick the contents into an array?

#

Im using InventoryCloseEvent right now but I think that a player putting in the item into the inventory doesn't add it to it's contents

#

It's empty because it's contents havent been set, but I only need to set whats put within the inventory

tender shard
#

Inventy#getContents() returns an ItemStack[] containing all the items that were put into the inventory

quaint mantle
#

Well yes, but like I said the inventory contents aren't put in.

#

It is simply opening a null inventory for the player to put in certain items

#

I just need a way for the items put into the null inventory opened for the player via command to be added to a itemstack[]

tender shard
#

if a player puts sth into the inventory, then it's inside the inventory

#

also what is a "null inventory"? You mean an inventory with no holder?

tender shard
quaint mantle
#

I can just send code.

#

@Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){ if (sender instanceof Player){ Player player = (Player) sender; Inventory exchangeGui = Bukkit.createInventory(player, 27, ChatColor.YELLOW + "Exp Exchanger"); player.openInventory(exchangeGui); } return true; }

#

|| @EventHandler public static void rewardExp(InventoryCloseEvent e){ if (e.getInventory().getSize() == 27){ ItemStack[] inv = e.getInventory().getContents(); Player player = (Player) e.getPlayer(); for (ItemStack item : inv) if(item != null) switch(item.getType()){ case GOLD_NUGGET -> player.setExp(player.getTotalExperience() + 100); case REDSTONE -> player.setExp(player.getTotalExperience() + 1000); case EMERALD -> player.setExp(player.getTotalExperience() + 10000); } } }||

undone axleBOT
tender shard
#

what exactly isn't working? does the first if statement eveluate to true?

onyx fjord
#

What event is triggered when player gets kicked for having invalid session

quaint mantle
#

Command is ran than blank inventory is opened for a player to put in certain items in.

#

Then a listener listens for when that specific inventory closes

#

then gets the items in an itemstack array that the player put in

tender shard
onyx fjord
#

Kk

quaint mantle
#

Console is throwing lots of errors

tender shard
#

why didn't you tell us about the errors ealier?

#

?paste the errors

undone axleBOT
onyx fjord
#

?paste

undone axleBOT
quaint mantle
tender shard
#

it's empty?

subtle tapir
#

remove trailing slash

delicate lynx
#

spigot-1.12.2.jar πŸ’€

tender shard
#
Caused by: java.lang.IllegalArgumentException: Experience progress must be between 0.0 and 1.0 (1000.0)

#

you can only set Exp to a value between 0 and 1

#

you have to use giveExp(amount)

quaint mantle
#

that doesn't exist.

#

atleast w the version im using

delicate lynx
#

sorry to hear that

quaint mantle
#

Im creating this for someone else, so I don't really have a choice in the matter

tender shard
quaint mantle
#

wants me to switch to java 14

#

that's fine I guess, maybe because its embedded in a switch statement.

tender shard
#

just use a regular switch

quaint mantle
#

I see my issue now, I just switched the version. For some reason intellij wasn't initially telling me

#

until I did getExp

#

Works fine, thank you all for the help.

tender shard
#
for(ItemStack item : myInv.getContents()) {
            if(item == null) continue;
            switch (item.getType()) {
                case GOLD_INGOT:
                    event.getPlayer().giveExp(10);
                    break;
                // etc...
            }
        }
kindred valley
#

i mean if its int, double?

tender shard
#

why do you need an "add" method anyway?

#

why don't you just do number1 + number2 ?

#

Who the heck needs a method for that

#

also obviously all you need is this

    public static int sum(int num1, int num2) {
        return num1 + num2;
    }
    
    public static double sum(double num1, double num2) {
        return num1 + num2;
    }
golden turret
#

?paste

undone axleBOT
kindred valley
tender shard
#
    public static double sum(double num1, double num2) {
        return num1 + num2;
    }
#

this works for all kinds of numbers

#

but it will always return a double

#

as I already said, generics do not support primitives

kindred valley
#

f*ck generics

quaint mantle
#

Are you sending this in reply to me?

#

Because if so I am very confused and I think you have a misunderstanding of the point and functionality of the program.

tender shard
#

just directly add your numbers

#

why do you need a method for this

#

how is add(1,2) easier than 1+2?

kindred valley
#

just trying to get the logic

#

because there is too f*cking generics on vanilla

rugged cargo
#

how do you get the itemstack that a player picked up? EntityPickupItemEvent doesn't give you an itemstack, but just an item reference.

tender shard
#

it makes no sense for them to be allowed in generics

kindred valley
tender shard
#

you can do weird stuff like this

    public static Number sum(Number num1, Number num2) {
        return new BigDecimal( num1.toString() ).add( new BigDecimal( num2.toString() ) );
    }
#

but now that will always be a boxed "Number" and you can't just do

int result = sum(1,2);
noble lantern
#

By chance does this look stupid as hell

quaint mantle
#

its really dumb how you cant perform operations on it

#

come the day where operator overloading exists, the number interface will be useful

tender shard
#

true but I also don't see a reason for when this would be needed

rugged cargo
#

i'd just make overloaded functions for int, double, etc. personally this is easier

tender shard
#

I still wonder why someone would need a "sum" function

rugged cargo
#

fair x + y + z + h is far simpler

flat olive
#

nice I made my own permissions core, 70% done

granite burrow
#

hey is there anyway to add in multiple outcomes for 1 crafting recipe? for example the converting logs to wood

tender shard
rugged cargo
#

maybe a static add function for x amount of custom objects would be useful since operator overloading isnt a thing

tender shard
granite burrow
#

dam, that sucks

tender shard
#

every Recipe always only has one output ItemStack

golden turret
#

actually

#

you can listen the click

tender shard
quaint mantle
#

IntStream.sum

rugged cargo
#

idk. lol. java isn't my primary language.

quaint mantle
#

shit++

#

RustLang

rugged cargo
#

alright, is this pfp better? lol

noble lantern
#

When initializing a class using reflection, I'm wanting to provide dependency injection if a class's constructor has a typeof JavaPlugin as the constructor argument

When using newInstance(theJavaPlugin) I get the warning I get "No arguments expected" is this warning safe to ignore or am I doing this all wrong for providing a constructor argument for said class?

granite burrow
worldly ingot
#

You can. Recipe groups

#

So long as they have the same group, they'll show up like that

quaint mantle
#

thats cool

#

didnt know

tender shard
#

didn't know either, nice. but still requires multiple recipes to be registered

worldly ingot
#

Yes it does

granite burrow
#

cool thank you ill look more into that

worldly ingot
#

The use of RecipeChoice will cycle the item types in the single recipe

tender shard
#

it's weird though

worldly ingot
#

but a group will show that little category thing

tender shard
#

why doesn't setGroup take a namespacedkey

worldly ingot
#

No real reason for it to

tender shard
#

well two plugins could use the same group name and then you have two unrelated things grouped

worldly ingot
#

I'd advise formatting the group as a key though

#

yourplugin:group_id

tender shard
#

everyone now uses the literal yourplugin string

granite burrow
worldly ingot
#

You would have to register 5 different recipes

#

Set their group to the same string, it will show like the doors do

granite burrow
#

okay cool ill try that out right now thank you πŸ˜„

rugged cargo
#

is it on purpose that EntityPickupItemEvent doesn't contain the itemstack that was picked up?

quaint mantle
#

how much you wanna bet it returns Item

#

?jd0s

#

?jd-s

undone axleBOT
quaint mantle
#

lmao

rugged cargo
#

it returns item i know

#

i need the nbt data for the item

quaint mantle
#

so just get the itemstack?

tender shard
#

wait

#

if you need NBT data of the item, why would you need the ItemStack?

rugged cargo
#

ive seen Item#getItemStack but how tf does that work?

tender shard
#

well

#

it returns the ItemStack

#

?

quaint mantle
#

πŸ€¦πŸΏβ€β™‚οΈ

#

first time ive ever facepalmed in this channel, be grateful

rugged cargo
#

ok, im going to try it and see if im just stupid

tender shard
#

an Item is basically an "ItemStack" laying around in the world

quaint mantle
#

Item = ItemStack tile entity

tender shard
#

it's like a "3d version" of the itemstack

#

basically the actual "drop" lol

quaint mantle
#

☹️

#

i like that one mod that makes the item drops realistic

#

adds more life to the game

rugged cargo
#

well you learn somethin new every day

#

i did not realize that you could get a valid ItemStack from Item

#

πŸ€¦β€β™‚οΈ :)

#

yipee! it worked!

noble lantern
tender shard
#

seems like the setGroup thingy doesn't really work at all

rugged cargo
#

that is broken. lol

vocal tundra
#

how come if you set an entities velocity they go super fast for like 1 tick and then just fall

kind hatch
# tender shard

It may be something to do with that one gamerule. It might show once you make it once.

tender shard