#help-development

1 messages · Page 1669 of 1

quiet ice
#

Could yall stop being little children?

lean gull
#

k

opal juniper
#

how are you today geol

dim bluff
#

hi is there a way to take a string and do like ItemStack.matchItemStack or something

#

like with Material

lean gull
#

you mean .equals?

grim ice
#

new ItemStack(Material.matchMaterial(urmaterial)); if i understood u correctly

#

but if u want to clone an itemstack just do .clone()

#

.clone() works for all objects iirc

opal juniper
#

no it doesn’t

grim ice
#

o

#

i see

opal juniper
#

it has to implement Cloneable

grim ice
#

oh right

#

true my bad

dim bluff
#

Um.... I'll just make an extra string in my config to know the durability I guess.... just wanted to know if its possible without

grim ice
#

.clone() works for itemstack

grim ice
#

it is cloneable

#

just use clone() worst case is that it will copy the item uuid

#

new ItemStack(itemstack) works too

ivory sleet
#

It’s actually possible to call clone() on every object however it’s by default protected (from Object) and throws an exception unless overridden.

lean gull
#

hi conclure

#

can u help me pls

ivory sleet
#

Hello

#

There’s no item uuid btw

grim ice
ivory sleet
#

Yes

#

Well it does what it promises to do

lean gull
#

^^^

opal juniper
grim ice
#

@ivory sleet wait what??

#

items dont have uuids??

reef wind
undone axleBOT
grim ice
ivory sleet
#

Not ItemStacks at least

reef wind
dim bluff
#

I have a config file with keys = ItemStack and Value = cooldown time of the item

grim ice
#

i told him that, and he told me to frick off lol

opal juniper
reef wind
#

lmao wat

grim ice
opal juniper
#

this is floofsy

dim bluff
#

and would be cool to directly take the key and get the itemStack with Material + durability

grim ice
#

when you use them in minecraft they do have a uniqueid?

#

yeah im pretty sure it does have a unique id

ivory sleet
#

Thing is, player1 has the value of null which essentially means you cannot call any method on that variable.

grim ice
#

otherwise all items would stack

opal juniper
grim ice
#

but when they have unique ids (like different player heads) they can not stack

ivory sleet
#

No that’s not how it works

grim ice
#

really?

#

correct me please

ivory sleet
#

Well you could consider an ItemStack instances memory address as a unique id Ig

opal juniper
#

their meta data is different iirc

#

so they don’t stack

#

or whatever like the nbt

grim ice
ivory sleet
#

But no it’s just minecraft Container implementation that ensures they don’t stack unless wanted, kinda why they’re called ItemStack

lean gull
#

can someone pls help

grim ice
ivory sleet
#

yes however it’s rarely taken advantage of because of reasons

opal juniper
lean gull
opal juniper
#

your var is null

grim ice
#

"can someone pls help" "no one asked you"

lean gull
grim ice
#

this is killing me

reef wind
lean gull
ivory sleet
#

2Hex just ignore him if you’re not willing to help

alpine urchin
#

look

lean gull
opal juniper
#

because you haven’t assigned it a value

alpine urchin
#

let me explain

#

why you need to learn java first

lean gull
#

i have tho

alpine urchin
#

its like trying to write a difficult essay

reef wind
lean gull
#

retrooper please, shut the hell up.

alpine urchin
#

without knowing english properly

grim ice
#

this is annoying

#

even more annoying than me

opal juniper
quiet ice
#

no, you're still more annoying

narrow furnace
#

lol

ivory sleet
#

Don’t have to go around being a dick back to him then, it’s simple, you could block him and not care

narrow furnace
#

kidding ily 2hex

alpine urchin
#

how can you write and understand the essay you are writing without understanding the english language

#

life would be so much easier for you if you learned java in peace first

#

take your time

grim ice
lean gull
#

so no one's gonna help because yall are too toxic to?

grim ice
#

so better realize it now

opal juniper
#

wtf

narrow furnace
opal juniper
#

we will help

narrow furnace
#

who said that lmao

lean gull
#

not talking to you olije, you're ok

alpine urchin
#

thing is, if you notice everyone is giving you the same answer.

#

why don't you accept that answer

narrow furnace
#

^

grim ice
#

^

reef wind
alpine urchin
#

you're asking a community of developers

lean gull
#

no you're giving me a very short explination on why it's not working

#

not how to fix it, what to do with it, or a better explination

narrow furnace
#

no youre mad that thr answer youre getting isnt one that you like

alpine urchin
#

you will know why its not working if you know java

narrow furnace
#

but it is the only answer

grim ice
reef wind
lean gull
#

ok if you're toxic, please fuck off

alpine urchin
#

and once you learn java, you won't have to ask many questions in here anymore

#

and won't constantly need help for small problems

grim ice
lean gull
#

mute me lmao idc anymore

narrow furnace
alpine urchin
#

so we're helping you in the long run

opal juniper
#

if you show us more code it will be easier

reef wind
grim ice
#

LMFAO

lean gull
#

olije i spent a lot of time on this, i don't want it to be stolen (make fun, go ahead)

grim ice
#

"I like my code nto stolen"

#

IM SO FUCKIGN DONE

#

WHO THE FUCK WILL STEAL YOUR SPAGHETTI?

alpine urchin
#

we don't have time to steal your hello world plugin my friend

alpine urchin
#

we are busy with our own lives

reef wind
#

....

grim ice
#

bro

alpine urchin
#

and who cares if its stolen

ivory sleet
#

?kick @grim ice disrespectful

undone axleBOT
#

Done. That felt good.

narrow furnace
#

lol

reef wind
#

lmao

lean gull
#

ok if your name is prouddesk / 2hexx / retrooper please block me

ivory sleet
#

Can we all just be civilized here

grim ice
#

lmfao

reef wind
#

don't bother asking if you don't accept help

lean gull
opal juniper
#

Buenny Help Chat

alpine urchin
#

anyway, i love spigotmc community

#

how we all help

lean gull
#

i can try but i'm easily triggered

alpine urchin
#

if someone doesn't accept it

#

its up to them

grim ice
#

bad

alpine urchin
#

spigotmc is a very patient community

quiet ice
#

"patient"

grim ice
#

I mean yeah sorry for screaming

alpine urchin
#

excluding some people ofcourse

#

but majority

#

even the staff

vagrant stratus
lean gull
#

i gave everything related to the problem

alpine urchin
#

not enough

#

it would be easier if you provided full source code

vagrant stratus
#

While you'd think it's enough, it's not.
In the given context it should be correct, however for all we know something could be changed where it shouldn't be or called in the wrong place or whatever

reef wind
#

he wont show it

grim ice
#

no one wants to

reef wind
#

any plugin can be decompiled..

grim ice
#

^

lean gull
#

exepct i'm not sharing this with anyone but close friends

vagrant stratus
lean gull
#

i don't want money and i don't want rep

#

i just want a functioning gamerules plugin

reef wind
#

any plugin can be decompiled + not being toxic, but anyone with knowledge about java can do what you are trying to do because you don't have a lot of knowledge.

grim ice
vagrant stratus
grim ice
#

there is always someone who can make your work 3x better, so caring if someone steals it is dumb

#

and most people here can

#

no offense

alpine urchin
quiet ice
#

Meh, bad code sometimes is worth it (see intelliJ decompiler)

alpine urchin
#

or else

#

you're on your own

quiet ice
#

^

grim ice
#

^

alpine urchin
#

we cannot guess the issue

#

or where you did a mistake

#

in your code

quiet ice
#

Well, we can, but we would do it wrongly

lean gull
#

someone's being nice and being helpful in a thread so no thanks

grim ice
#

its prob conclure

#

oh its oli

alpine urchin
#

(i post these drake gifs too much lol)

#

they're too good

grim ice
#

poor guy

#

@lean gull they were talking behind your back yesterday, including oli :P

#

"nice" isn't the best way to describe that

lean gull
#

oh no!

grim ice
#

just informed you Shrug

quiet ice
#

who cares even

grim ice
#

but i find it pathetic to talk behind people's back, and it' forbidden in my religion either way Shrug

opal juniper
#

cool

#

i don’t remember asking

grim ice
#

😀

narrow furnace
#

are you talking about when someone said you and buenni are bad at coding

#

or somethingg

grim ice
#

but it was in an offensive way

narrow furnace
#

oh

grim ice
#

I don't mind that if you're trying to help someone progress, but if it's in an offensive way like it was, then you're pathetic

ivory sleet
#

Guys just stop

grim ice
#

sure, but it's just simple manners, isn't it?

ivory sleet
#

Do it elsewhere

lean gull
#

k they left it

ivory sleet
#

?kick @grim ice last kick, stop being such a dick

undone axleBOT
#

Done. That felt good.

grim ice
#

lmao

#

ok

lean gull
#

but u didn't even join to see if it's true

ivory sleet
#

I can read without joining

lean gull
#

oh ok

tardy delta
#

True i guess

quaint mantle
#

hi

#

how do I connect the vault economy?

#

I did everything as it is written on the vault page and I have an error

maiden briar
#

How can I make a rejoin system like in Hypixel for Bungee?

proud basin
#

what rejoin system do they have?

maiden briar
#

If you leave the server while you are in a bw game, and you join the server back you will be automatically teleported to that server

quaint mantle
#

sec

#

import net.milkbowl.vault.economy.Economy;

public class EconomyManager {

   public static Economy eco = null;


   public static void setupEconomy() {
        RegisteredServiceProvider<Economy> rsp = Bukkit.getServicesManager().getRegistration(Economy.class);
        if (rsp != null) eco = rsp.getProvider();
        
        }

}

#

@Override
public void onEnable() {
instance = this;
File config = new File(getDataFolder() + File.separator + "config.yml");
if (!config.exists()) {
getConfig().options().copyDefaults(true);
saveDefaultConfig();
EconomyManager.setupEconomy();

maiden briar
#

That means that or rsp or eco is null

quaint mantle
#

how can this be fixed?

maiden briar
#

What is the package name you are coding under?

quaint mantle
#

package experiencebuble;

maiden briar
#

Ok, I can't recogzine this line: at experiencebuble.GUI.onInventoryClick(GUI.java:96) ~[?:?] from the error

quaint mantle
#

what's wrong with that?

maiden briar
#

And you better name your packages like me.<name>.<plugin>

quaint mantle
#

double s = EconomyManager.eco.getBalance(p);
if(s > 100.0) {
p.sendMessage("бабок нема");
return;

maiden briar
maiden briar
#

Are you able for a screen share?

quaint mantle
#

@EventHandler
public void onInventoryClick(InventoryClickEvent e) {
p = (Player) e.getWhoClicked();
c = e.getClickedInventory();
Inventory i = e.getInventory();
if (!i.equals(GUI.i))
return;
if (c == null)
return;

    if (c.equals(i)) {
        e.setCancelled(true);

        if (i.equals(c) && e.getSlot() == 10) {
            if (e.getCurrentItem().getType() == Material.BARRIER)
                return;
            int exp = p.getTotalExperience();
            if (exp < 1395) {
                p.sendMessage("§c§lasdasd");
                 
                 
                sound();

                return;
            }
            double s = EconomyManager.eco.getBalance(p);
            if(s > 100.0) {
                p.sendMessage("no money");
                return;
            }
            
            p.sendMessage("ф");
        }
    }
}
maiden briar
#

Ok I need the reference to EconomyManager and please use code tags

hazy igloo
#

?paste pls

undone axleBOT
maiden briar
#

That is even better

quaint mantle
maiden briar
#

Ok and the reference to setupEconomy() is in your main?

quaint mantle
#

yes

#

EconomyManager.setupEconomy();

maiden briar
#

Ok let me look

quaint mantle
#

Main?

#

EconomyManager?

#

GUI?

maiden briar
#

Yes main

#

The full code pls

quaint mantle
maiden briar
quaint mantle
#

yes

maiden briar
#

Ok please do the following:

public static void setupEconomy() {
            RegisteredServiceProvider<Economy> rsp = Bukkit.getServicesManager().getRegistration(Economy.class);
            if (rsp != null) eco = rsp.getProvider();

            }

Change it to

public static void setupEconomy() {
            RegisteredServiceProvider<Economy> rsp = Bukkit.getServicesManager().getRegistration(Economy.class);
            System.out.println(rsp);
            if (rsp != null)
            {
              eco = rsp.getProvider();
              System.out.println(eco);
            }
}

Run it, and show the console output

quaint mantle
#

error

tall dragon
#

do you even have a economy providing plugin?

quaint mantle
tall dragon
#

in addition to vault you need a plugin like essentials to provide the economy

maiden briar
#

Ok, but I want to know the full console output

maiden briar
#

Vault only manages it

quaint mantle
#

he stands

#

Plugins (6): Essentials, ExperienceBuble, ItemJoin, PlaceholderAPI, ProtocolLib, Vault

maiden briar
#

Ok very good

#

But still waiting for the console output

#

Can you send me the log since you have applied my debug code?

#

I want to know what it has printed

quaint mantle
maiden briar
#

Also startup pls

quaint mantle
#

after clicking in the GUI, an error occurred

#

okay

maiden briar
#

Ok, but the most important part for me now is the part where your plugin got enabled

quaint mantle
maiden briar
#

What is the plugin name? Experiencebottle?

quaint mantle
#

yes

maiden briar
#

Ok it did not print anything

#

Then I am going to change the code of your main a little bit, and need to know the output

quaint mantle
#

okay

#

version - paper-1.12.2

maiden briar
#

Ok

#

But this is just basic Java that will work everywhere

quaint mantle
#

vault - 1.7.3

maiden briar
#

How is the code looking in your EconomyManager?

maiden briar
maiden briar
#

Ok look message above

quaint mantle
#

everything works fine, but an error appears after these lines:
double s = EconomyManager.eco.getBalance(p);
if(s > 100.0) {
p.sendMessage("бабок нема");
return;
}

maiden briar
#

Yes, I am currently finding out what it causes, and the way back to this is your startup (where the process begins)

#

Because in your startup you are setting the field eco

worn sierra
#

how should i design my project?

maiden briar
#

design?

worn sierra
#

like how should i start a project

quaint mantle
#

how can this be fixed?

worn sierra
#

yeah, design

#

not asking for patterns tho

maiden briar
#

You can create a package me.name.plugin

worn sierra
#

lol

maiden briar
quaint mantle
#

okay

maiden briar
#

If you did so create a new package commands and listeners

worn sierra
#

i am not asking how to create a class

#

or package

quaint mantle
#

I need to leave now, I'll be on the phone, ok?

worn sierra
#

asking that how should i plan my project

#

planning how to write

maiden briar
#

Oh that is more difficult

#

What is the idea?

worn sierra
#

no idea tbh

#

trying to understand all design patterns

maiden briar
#

Ok then I think you have to ask someone else, I am not very familar with this

maiden briar
quaint mantle
#

Okay

maiden briar
#

The problem is on a line where you are referencing the static field eco in EconomyManager. This field is null as shown in the error. You have to find out why it is null. In onEnable you are setting the field with a method in EconomyManager (setupEconomy()).

The following things could be wrong: (We simply don't know what of there is the problem)

  • if (!config.exists()) (onEnable) turns out to be false and does not get called
  • if (rsp != null) (setupEconomy()) turns also out to be false and does not get called (if rsp is null just throw an error)
  • eco = rsp.getProvider(); (setupEconomy()) could return null and you are not checking that

How to check:
You can always try printing conditions with System.out.println(Charset)
For example: System.out.println(rsp != null) (either true or false) or System.out.println(rsp) (null or <ClassName>)

wary harness
#

So got in small problem making enchant plugin and trying to make pick axe to brake sphear shapes

tacit drift
#

🤔

wary harness
#

like every level bigger sphere

#

I got some code

wary harness
#

but can't make it to work with proper radius numbers

maiden briar
#

Ok so if you level up the radius is not correct?

wary harness
young knoll
# tacit drift

Use the javadocs, getCause is not the name of the method

maiden briar
#

Ok good

wary harness
#

like if you go for whole number 1 2 3

#

I can 't use them like proper modifier

#

I need to play with decimals

lost matrix
# tacit drift

Pls dont suppress deprecations. If something is deprecated then there is a better way already implemented.

wary harness
#

I will show code it is stupid I know

maiden briar
wary harness
#

but best I could come with some tutorial

wary harness
#

like hemorrhoid's

lost matrix
wary harness
#

?paste

#

how to get link

#

?paste

undone axleBOT
wary harness
maiden briar
#

Probably this is helping

quaint mantle
maiden briar
#

Ok just save it if you are and tell me if you find the cause or not

#

You can always ping

#

But if I'm not online, I am sleeping

wary harness
#

xd

maiden briar
#

Haha

maiden briar
#

I will continue my work now, helped already over 40 minutes 😄

lost matrix
#
  @EventHandler
  public void onJoin(final PlayerJoinEvent event) {
    this.drawSimpleXZCircle(event.getPlayer().getLocation(), 0.1, 10, Material.STONE);
  }

  private void drawSimpleXZCircle(Location middle, final double deltaPhi, final double length, final Material material) {
    middle = middle.getBlock().getLocation().add(0.5, 0.5, 0.5);
    final Vector cursor = new Vector(length, 0, 0);
    for (int i = 0; i < (2 * Math.PI) / deltaPhi; i++) {
      middle.clone().add(cursor).getBlock().setType(material);
      cursor.rotateAroundY(deltaPhi);
    }
  }

This is a super simple approach and has some flaws.

  1. Calculating deltaPhi can be tricky. If you jsut chose something small then
    you will hit blocks multiple times.
  2. Its hard to fine tune it with double lengths.
wary harness
lost matrix
# wary harness ok thanks I will give it a shot

Ive experiemented a bit with an integer bound approach:

  @EventHandler
  public void onJoin(final PlayerJoinEvent event) {
    this.circleXZ(event.getPlayer().getLocation(), Material.STONE, 12);
  }

  public void circleXZ(final Location loc, final Material mat, final int radius) {
    final int cx = loc.getBlockX();
    final int cy = loc.getBlockY();
    final int cz = loc.getBlockZ();
    final World world = loc.getWorld();
    final int rSquared = radius * radius;
    for (int x = cx - radius; x <= cx + radius; x++) {
      for (int z = cz - radius; z <= cz + radius; z++) {
        if ((cx - x) * (cx - x) + (cz - z) * (cz - z) <= rSquared) {
          world.getBlockAt(x, cy, z).setType(mat);
        }
      }
    }
  }
wary harness
#

oh that look good

#

that could help

young knoll
#

I think a dimension was lost along the way in this conversation

lost matrix
#

Oh did he want spheres?

#

Maybe there is an environment agnostic voxel library for shapes.

wary harness
viscid forge
#

So Im trying to make my Custom enchant to work in the enchanter but it doesn't seem to want to put the name of the enchant

chrome beacon
#

You can't display the name there

grim ice
#

you can't make it work there, however you can listen for enchanting item event

#

and check for the exp lost

#

depending on that add a chance for the item to get ur enchant

#

u might want to add some extra checks if ur enchant conflicts with other enchants though

#

Here's a youtube video that will guide you:
https://www.youtube.com/watch?v=EVDUIivW7MQ

In this episode, I show you how to make custom enchantments in Spigot 1.14. There are a lot of different steps involved, so you need to pay attention closely. I demonstrate how to make two separate enchants, the glow enchant and the hemorrhage enchant.You will find no other resource that can help you do this, so a lot of hard work was put into ...

▶ Play video
#

it might be long but it's useful,

lost matrix
grim ice
#

or use hypixel skyblock way, make your own custom enchanting table

tall dragon
#

HotSwapping

grim ice
#

what is hot swapping

tall dragon
#

it lets you change minor code without building your plugin

#

and directly switches the classes out

#

while running

violet depot
#

How do i kill a player after entity dismount after 30 seconds?

violet depot
eternal oxide
#

?scheduling

undone axleBOT
violet depot
eternal oxide
#

to kill just damage him

violet depot
#

EntityDamageEvent?

eternal oxide
#

no, you are applying damage, no Event

violet depot
#

@EventHandler
public void onDismount(EntityDismountEvent e) {
Player p = (Player) e.getEntity();
Entity pig = e.getDismounted();
if (p instanceof Player);
{
if (pig.getCustomName().equalsIgnoreCase("Piggy"));{
Player n = p.getPlayer();
n.setHealth(0);}
}
}

violet depot
tardy delta
#

player.getPlayer() ? what does that?

violet depot
tardy delta
#

cringe

#

anyways is banning an offline player possible?

violet depot
tardy delta
#

oh

junior geyser
#

Anyone know the name of the partial that silverfish make when they burrow into a block?

opal juniper
#

it’s probably just a generic one

junior geyser
#

wait

#

wdym generic?

opal juniper
#

just like one that gets used for many things

narrow furnace
opal juniper
#

it’s probably the same as the digging

narrow furnace
#

why do u need a Player n

violet depot
junior geyser
opal juniper
#

nope

#

sorry lmao

junior geyser
#

ok thanks anyway

tall dragon
#

@junior geyser is that the same effect as when they spawn?

violet depot
tall dragon
#

i dont this this is actually usefull but eh

junior geyser
#

Ill try POOF, Thanks

north drum
#

does anyone knows a plugin to make players invisible for each other but only one player can see them all?

junior geyser
#

but not 100% sure

#

and idk how to do that with nms either

north drum
#

sorry I don't know excatly what nms is? can you explain that?

junior geyser
#

sry

narrow furnace
#

net.minecraft.server

junior geyser
#

net.minecraft.server

#

lol

narrow furnace
#

👀

tall dragon
#
player.showPlayer();
        player.hidePlayer();
#

?

junior geyser
north drum
#

i'm not really into programming of plugins, so i probaly don't will be able to code a plugin by myself

junior geyser
#

he needs to use packets

tall dragon
#

which is possible with that

junior geyser
tall dragon
#

void hidePlayer(@NotNull Plugin var1, @NotNull Player var2);

#

u can scecify the player

junior geyser
#

oh cool

#

i did not know that was a method

lost matrix
#

As long as you dont use an ancient version.

tall dragon
#

yea

tardy delta
#

my maths go really brr

tall dragon
#

🧢

tardy delta
#

wrote it down smh

opal juniper
#

number line?

#

wtf

junior geyser
tall dragon
#

no thats minecraft server code

junior geyser
#

Cause I dont got a POOF

tall dragon
#

thats why i said its probably useless

junior geyser
tall dragon
#

i looked that up on 1.16.5

#

maybe its different for ur version

junior geyser
#

I am using the 1.17 api, I dont think its changed

tall dragon
#

i just looked in EntitySilverfish.class

#

to find any particle effects

junior geyser
#

No Poof

#

huh

lost matrix
#

Particles is the NMS class

#

So its not part of the Spigot API

junior geyser
#

Ooh, ok that makes more scene

#

thanks

mellow edge
#

hi

#

how can I make that when tnt is placed it will be powered instantly

#

I have that code:

lost matrix
eternal oxide
#

I'd actually not cancel the event, I'd run a timer 1 tick delay to test if the block was placed, then spawn TNT entity and destroy the block

lost matrix
eternal oxide
#

leave all the inventory management upto the event, an other plugins could cancel the block place

lost matrix
#

Ah i see.

mellow edge
#
public void onPlaceEvent(BlockPlaceEvent e, Block placedblock) {
Material mat = e.getBlockPlaced().getType();
if(mat == Material.TNT) {
    Block block = (Block) e.getBlockPlaced().getState().getBlock();
    block.getLocation();
    //stuff
}
}```
lost matrix
mellow edge
#

ok thank you

#

something like this?

#
@EventHandler
public void onPlaceEvent(BlockPlaceEvent e, Block placedblock) {
Material mat = e.getBlockPlaced().getType();
if(mat == Material.TNT) {
    Block block = (Block) e.getBlockPlaced().getState().getBlock();
    //stuff
    e.setCancelled(true);
    e.getPlayer().getWorld().spawnEntity(block.getLocation(), EntityType.PRIMED_TNT);
}
}
}```
eternal oxide
#

no

#

thats not a valid Event method

tardy delta
#

remove the Block

grim ice
#

You don't even use the placedblock

#

that's dumb, remove it

mellow edge
#

zeah I removed it

tardy delta
#

YEEEEES FINALLYY

mellow edge
#

forgot

grim ice
eternal oxide
#

and this like is useless too Block block = (Block) e.getBlockPlaced().getState().getBlock();

grim ice
#

ye

tardy delta
mellow edge
#

no it isn't I did block.getLocation when I spawned an PRIMED_TNT entity

eternal oxide
#

Yes and thats pointless

mellow edge
#

why?

eternal oxide
#

you don;t need any of it

#

e.getBlockPlaced().getLocation()

grim ice
#

^

mellow edge
#

oh

#

ooops

tardy delta
#

even got it working so it doesnt say 0 days for example

mellow edge
#
Material mat = e.getBlockPlaced().getType();
if(mat == Material.TNT) {
    //stuff
    e.setCancelled(true);
    e.getPlayer().getWorld().spawnEntity(e.getBlockPlaced().getLocation(), EntityType.PRIMED_TNT);
}
}```
#

will this now work?

eternal oxide
#

yes, if you register the event

mellow edge
#

oofc I registered it

grim ice
#

also

mellow edge
#

if you mean that:

#

getServer().getPluginManager().registerEvents(new DetectTNT(), this);

grim ice
#

just use

#

if(mat != Material.TNT) return;

eternal oxide
#

cleaner code is always better

crude sleet
#

Hey, i want to show the level under the Player name but if i try that, there is a "0"

    public static void updateLevel(Player p) {
        NitUser user = new NitUser(p.getUniqueId().toString());
        WizardBuildSection section = (WizardBuildSection) user.getSection(new WizardBuildSection(p));
        
        Bukkit.getOnlinePlayers().forEach(all -> {
            Scoreboard scoreboard = all.getScoreboard();
            Objective obj;

            if(scoreboard.getObjective("level") == null) {
                obj = scoreboard.registerNewObjective("level", "dummy");
            } else {
                obj = scoreboard.getObjective("level");
            }

            obj.setDisplaySlot(DisplaySlot.BELOW_NAME);
            obj.setDisplayName("§7>> §bLevel§7: §b" + section.getLevel() + "§7 <<");

            all.setScoreboard(scoreboard);
        });
    }

Image Link: https://ibb.co/2g7kzLz

grim ice
eternal oxide
#

yours

grim ice
#

o i see

mellow edge
#

It's fine all I want this plugin to do is just to make that tnt explodes instantly for our bedwars

eternal oxide
#

if you want it to explode instantly you should spawn an explosion rather than a PrimedTNT

grim ice
#

yeah

#

the one elgar mentioned is much more configurable

tiny wolf
#

What event should I use to get when sand falls and lands?

#

/concrete

eternal oxide
#

probably BlockFormEvent

tiny wolf
#

Does that actually trigger from it?

eternal oxide
#

Test it and see. I did say probably

lost matrix
#

EntityChangeBlockEvent

#

FallingBlock is an Entity that changes a block

eternal oxide
#

Sounds more promising

grim ice
opal juniper
#

it’s what 7smile7 said

shadow skiff
#

is there an event for when a player takes damage?

spring river
eternal oxide
#

?jd There is a search box you can use keywords on the javadocs

lost matrix
hazy igloo
shadow skiff
#

ah

#

alr ty

crude sleet
#

Is there a way to remove the "score" for the "BELOW_NAME" Display Slot? I dont want any numbers

vague oracle
#

As far as im aware you can't remove the number thats the whole point of the score

next stratus
#

Anyone know how to create worldguard regions what support all versions? I think worldguardwrapper helps but idk how to use it correctly.

lost matrix
supple elk
#

anyway I can reference the cooldown object like that?

next stratus
lost matrix
supple elk
#

a n g e r

lost matrix
supple elk
#

sure

#

I could make this function accept an AnctiveCooldown

#

then pass itself into it

#

there it is

supple elk
#

so change it into that

lost matrix
#

Eh...

tardy delta
#

bruh i watched a video about a plugin who was free that time but now costs 10 dollar

lost matrix
supple elk
#

yeah

#

I can do it like this

lost matrix
#

You could make an anonymous class and overwrite the isDone method or use a Predicate<Integer> inside the class which is called inside the
isDone method or extend your ActiveCooldown with a new class ConditionalActiveCooldwn let me write an example for the latter.

supple elk
#

what do you think about the solution I just posted?

lost matrix
#
public class ConditionalActiveCooldown<T> extends ActiveCooldown {
  
  // But this will lead to a fat constructor
  // Maybe make a builder for this
  private final Predicate<T> condition;
  private final T object;

  @Override
  public boolean isDone() {
    return super.isDone() || condition.test(object);
  }
  
}
lost matrix
supple elk
#

I mean it seems useful for other things

#

so now I can access the other functions inside the ActiveCooldown which is useful

dim bluff
#

sup... small problem. My config file keeps removing a map each time I reload the server? I'm pretty sure it does save as it is...

next stratus
#

Anyone know how to create a basic worldguard cuboid region and set some flags to it? they've made it so complex now.

dim bluff
#

it only saves when I stop server, delete the config file and restart

tall dragon
mellow edge
#

why is player.getItemInHand deprecated?

opal juniper
#

normally there is a deprecation note

mellow edge
#

Can I still use it?

opal juniper
#

yes but it may get removed

#

ah

mellow edge
#

ok

#

so for now it is fine

opal juniper
#

you need to get the equipment iirc

#

oh

#

or just cast it to HumanEntity

#

and use the methods there

quiet ice
#

no need to cast player to humanEntity

#

it already extends it

opal juniper
#

or that cause i’m a dummy

quiet ice
#

player.getInventory().getItemInMainHand() should be used instead

lost matrix
quiet ice
#

since there are two hands now

lost matrix
mellow edge
#

ok

torn shuttle
#

this is more of a java question but this notation

        switch (transitiveBlockType){
            case ON_SPAWN -> customBossesConfigFields.setOnSpawnBlockStates(deserializedData);
            case ON_DEATH -> customBossesConfigFields.setOnRemoveBlockStates(deserializedData);
        }

automatically insert break behavior between case 1 and case 2 or does it propagate downwards?

dim bluff
dim bluff
#

I'm trying to find whats wrong tho for more info

quiet ice
#

Or well, there are no breaks

dim bluff
#

Sysout everything

shadow skiff
#

Hello, I am trying to make a plugin to kill a player when they take any sort of damage even the most small amount of damage. The System.out.println don't even print to console thus leaving me to believe that it isn't even registering the EntityDamageEvent

public class OHKO extends JavaPlugin {
    
    public void onEnable() {
    }
    
    public void onDisable() {
    }
    
    public void onDamage(EntityDamageEvent event) {
        System.out.println("Killed?");
        
        Player p = (Player) event.getEntity();
        p.setHealth(0);
        System.out.println("§4§lKilled?");
        }
        
}
quiet ice
#

@EventHandler is missing

shadow skiff
#

WOW, How did I miss that

quiet ice
#

You also need to implement Listener and register the event handler

shadow skiff
#

Thank you so much

tall dragon
#

@quiet ice the class extending JavaPlugin doesnt have to implement Listener

quiet ice
#

really

#

?stash

undone axleBOT
tall dragon
#

im fairly sure yea

quiet ice
#

no

#

This is impossible, JavaPlugin extends PluginBase implementing Plugin extending TabExecutor

opal juniper
#

wait plugin extends TabExecutor?

quiet ice
#

yes, which is why onCommand can be overriden

opal juniper
#

huh

#

wonder why it doesn’t implement Listener

quiet ice
#

because it isn't an event listener at it's heart

tall dragon
#

guess i am confused with a library then. mine will automatically implement it. my bad

opal juniper
next stratus
#

hey, has anyone here worked with worldguardwrapper and created regions and added a flag to them before? I can't work out how to do that :/

quiet ice
#

the tab executor is only extended since the extending java plugin class is the fallback implementation of the commands

dim bluff
#

hi... I think my onEnable has a prob... no clue what it is tho

tall dragon
#

thats the entire error?

dim bluff
#

nothing is rly loading. It fixes when a map I have in config.yml disappears

#

when the map above is in the config file there's a problem

tall dragon
#

show code where ur trying to load the map

dim bluff
#

(all broadcast stuff is just to see wazzup)

#

it worked when I was using Materials and not itemStack 😢

#

all done by 7smile7 basically

tall dragon
#

ur on 1.8?

dim bluff
#

yep 1.8.8

tall dragon
#

ah yea

dim bluff
#

... plz no

tall dragon
#

so annoying to deal with item durability

dim bluff
#

is it something to do with 1.8.8

tall dragon
#

well im not sure because your error only sais an error occurred

#

thats not alot of information

dim bluff
#

Well 1thing for sure is that the loading process isnt working

#

so I'm guessing its cuz of this "loadForm" thing

#

if durability is a problem it would be logical

#

then how do I deal with enchanted golden apples?....

tall dragon
#

i usually use a splitter

#

like "GOLDEN_APPLE|1"

quiet ice
#

Stacktraces are the most important thing in java development - ignoring them is a waste of time

tall dragon
#

and just split the string

dim bluff
#

how would that work to split

#

like what would the 2strings be

tall dragon
#

String[] values = configValue.split("\|");

torn shuttle
#

#split(character)

dim bluff
#

oh I see

tall dragon
#

and index 0 would be your item

#

and index 1 the dura

torn shuttle
#

don't forget to handle exceptions

dim bluff
#

but would that rly change the problem I have?

#

I'm gonna do it cuz its way better then doing substrings

tall dragon
#

maybe. but currently its handled a bit tricky with all the substrings

#

indeed

grim ice
#

dddaaaaaaaaaayum

dim bluff
#

lmao he carried 100% of it

#

I don't understand shit with config

grim ice
#

explains why the code is all final lol

dim bluff
#

yep

quiet ice
#

| is a special regex char, you need to escape it

#

... and \ is a special java char, you need to escape that too

dim bluff
#

what can I use

#

this no good?

quiet ice
#

string.split("\\|")

tall dragon
#

could use a different split char too

#

like ";"

dim bluff
#

oh ; looks good 🙂

quiet ice
#

ffs, discord also requires escaping of backslashes (why even?)

tall dragon
#

🙃

grim ice
#

\lol

dim bluff
#

will my item have any problems if I'm in 1.8.8 or its fine

grim ice
#

only one way to find out

dim bluff
#

the error was actually bigger 🙂

#

oop nothing

#

yooooo

#

it works

grim ice
#

thats easy to fix if you know java O.O

tall dragon
#

hurray

grim ice
#

o

#

ok

dim bluff
#

lmao 🙂 key[2] to get second string lets go.

grim ice
#

fix ur AIOBE tho

dim bluff
#

everything fixed

tall dragon
#

great

dim bluff
#

❤️ idk how the usage of substrings caused the death of my plugin but ok

grim ice
#

substrings cut a string

#

from an index to an index

quiet ice
#

not always

#

well technically yes, but the String#substring(int) method ends at the end of the string

grim ice
radiant aspen
#

Does anyone know of a method to see if a material can be placed in a certain location? e.g. cactus cant be placed next to other objects, snow cant be placed ontop of ice ect? is there a method to test this?

quiet ice
#

it should also be known that strings are immuteable, so they won't cut the current string instance

quiet ice
#

I have done this mistake far too often

grim ice
#

I never did

opal juniper
grim ice
#

your ide should tell you that if you ever do it?

opal juniper
#

not really

#

at least

#

not in my experience

quiet ice
#

No, it's 100% valid java, so it wont complain

grim ice
#

I'm pretty sure it did when i tried to do that

#

lemme try

hybrid spoke
#

your IDE wont tell you that

quiet ice
hybrid spoke
#

just if you are doing strange things

grim ice
quiet ice
#

Well, it will if you configured it to

grim ice
#

it should say result of ..... is ignored

#

or smth

#

i dont remember

quiet ice
#

Kinda like eclipse can complain about nullabillity, but wont by default

hybrid spoke
#

that comes if you dont use the return of a method

opal juniper
#

This is just java, but is there a way to know what the name of a file you are downloading from a URL is called? some metadata type stuff

hybrid spoke
quiet ice
#

it really depends on the underlying protocol

opal juniper
gilded spruce
#

can someone explain to me approximately how to make a randomizer that picks a random between certain coordinates? because i don't know how to start it

eternal oxide
#

between two locations, in a straight line?

grim ice
#

for every x and z

#

idk if u wanna do y

radiant aspen
grim ice
#

no d

grim ice
#

dont

radiant aspen
#

just do that for x y z variables

grim ice
#

never

#

random sucks

radiant aspen
unreal quartz
#

?

quiet ice
#

not always

eternal oxide
#

random is fine

radiant aspen
#

ive never had an issue with it

hybrid spoke
grim ice
#

use ThreadLocalRandom

quiet ice
#

Random is seeded

unreal quartz
radiant aspen
#

^ thats also true

#

but not really relivent in this case

torn shuttle
#

my laptop is so slow intellij can't quite manage to autosuggest classes in useful time 😦

unreal quartz
#

it "sucks" if you keep remaking the random object

torn shuttle
#

press F for my laptop

grim ice
unreal quartz
#

keep the random object stored somewhere and reuse that and you will be fine

quiet ice
#

ThreadLocalRandom is not seeded (or well it is, but you can't influence it), which may be worse in some cases

hybrid spoke
#

since he dont wanna use a special seed he should use ThreadLocalRandom since its more perfomant and doesnt create a Random instance everytime

gilded spruce
radiant aspen
#

it really doesnt matter that much

#

just use whatever one u want

opal juniper
#

i need to pass a parameter, how can i select one var or if it is null the second var without an if block?

eternal oxide
quiet ice
#

And while Random used to have the synchronized modifier everywhere, this is no longer the case in modern java versions, so it doesn't matter that much

gilded spruce
#

but how

torn shuttle
#

pretty easily

gilded spruce
#

okay

torn shuttle
#

just give it a lower value and a higher value

#

to randomize between

#

for each individual coord

radiant aspen
eternal oxide
# gilded spruce okay

You need to answer if you want random coords in a straight line between locations, or in a cuboid?

torn shuttle
#

can't prove it isn't

radiant aspen
quiet ice
#

still requires a modulo, an add operation and an array access at best, not very efficent

crimson terrace
#

For random numbers I usually just make a method i call each time i need one and give it a min and max value...

gilded spruce
quiet ice
#

random.nextBoolean() ? 200 : 6272

torn shuttle
#

then randomize a boolean value

#

damn it I blame my slow internet for being slower than geol there

gilded spruce
torn shuttle
gilded spruce
torn shuttle
#

I can pay you in runescape gold

quiet ice
#

randomize a gf? This is some serious work in today's world

worldly ice
#

random.nextBoolean() ? false : false

torn shuttle
#

:(

worldly ice
#

oof

torn shuttle
#

man this room sucks, they never resolve the real issues

ivory sleet
grim ice
torn shuttle
#

bbl 3d printing a procedurally generated gf

crimson terrace
#

Just ask musk to randomize a gf for you

worldly ice
#

he asked for a randomizer

grim ice
#

just simplify it to false

radiant aspen
eternal oxide
#

Did he ever answer if he wanted the random location to be along the line between start and end?

torn shuttle
#

he just wanted to pick between two specific locations

wary harness
ivory sleet
#

why

opal juniper
#

static

wary harness
#

qustion is it ok making pl field static

ivory sleet
#

Utils do not have state nor dependencies

grim ice
#

no

eternal oxide
#

So literally 0 or 1, ok

grim ice
#

also it should be final

wary harness
#

not multiple

opal juniper
torn shuttle
opal juniper
#

and why make it static

ivory sleet
#

MrAxeTv you shouldn't have any Utils instances floating around

wary harness
#

so static method can use it

ivory sleet
#

if you do then you successfully created an anti pattern

radiant aspen
#

static is best

#

if atleast 70% of your functions arnt static your a bad dev

tardy delta
#

ah shit

ivory sleet
#

jesus

torn shuttle
#

I'm at 90% so I must be a really good developer

torn shuttle
#

tbf I also threw the plugin into static, no way I'm going to get it any slower than that when I spend half my time making bukkit runnables

tardy delta
#

wew i wasnt even using it

quiet ice
tardy delta
#

i only used it for the plugin name

#

for the logger

radiant aspen
#

tbh, static isnt necessarily bad, it just depends how you use it

torn shuttle
#

I enjoy living dangerously

tardy delta
#

rawr

grim ice
#

anyone knows a java tutorial that isn't just the basics

torn shuttle
#

it's called documentation

radiant aspen
#

^

unreal quartz
#

make shit

#

thats your best tutorial

radiant aspen
#

there arnt many tutorials that go past the basics

grim ice
#

that's the slowest way isn't it

unreal quartz
#

its the best way to learn

ivory sleet
quiet ice
#

well, past the basics it always gets slow

torn shuttle
#

it's the only way to learn past a certain point

radiant aspen
#

you should look into Streams tho

#

streams are best

torn shuttle
#

especially my livestreams

ivory sleet
#

also look into nio as opposed to io

grim ice
lavish hemlock
eternal oxide
#

streams are generally slow, so avoid them if you have an alternative

torn shuttle
ivory sleet
#

they're

torn shuttle
#

ok I think I'm just avoiding working on transitive blocks at this point, I better go back to work

quiet ice
#

You should read all the 17 chapters of the JLS. Then you have covered the more advanced stuff

lavish hemlock
quiet ice
#

PStreams are a thing too

ivory sleet
#

they have to cache a lot of things they pull in lazily and create new objects sometimes

#

tho I suppose parallel streams are quite the deal

lavish hemlock
#

there's one situation where NIO is slower than an alternative tho

#

accessing files within a .jar

#

I benchmarked it myself :)

ivory sleet
#

how much slower

lavish hemlock
#

gimme a sec

quiet ice
#

gradle had a benchmark for that I recall

lavish hemlock
ivory sleet
#

hmm

#

interesting

grim ice
#

if someone codes java 8h/d in how much time will he get good

gilded spruce
ivory sleet
grim ice
#

if it was me PAIN

torn shuttle
ivory sleet
#

uh idk

#

depends how much effort you put in ig

lavish hemlock
#

Pro/Cons:

  • JarFile is faster if you need to do just access but is more restricted.
  • FileSystem is closer to actual files but slower to instantiate.
grim ice
#

hmm

quiet ice
radiant aspen
#

define good though

quiet ice
#

Started in mid-2019 and I would say that I was a good developer by the end of 2020. That being said I'm still learning a lot of stuff (especially in the JLS side of things)

radiant aspen
#

I dont know a single developer that looks back on their past work and thinks it was good

grim ice
radiant aspen
#

You can code spigot whenever you want

ivory sleet
#

geol was java your first programming language?

lavish hemlock
#

I actually also learned Java for 1.5 years, started back in early 2020.

eternal oxide
#

I've been programming over 40 yeas and I'd say I'm decent.

radiant aspen
#

I learnt java by coding spigot plugins

lavish hemlock
#

My first lang was Batch tho.

grim ice
#

how old are you?..

lavish hemlock
#

he is 200 years old

quiet ice
#

He's retired, that much to say

ivory sleet
#

Elgar boomer 😛

eternal oxide
#

yeps 🙂

grim ice
#

I mean he sounded old either way

radiant aspen
#

Its not that unusual to see older guys on the spigot forums tho tbh

grim ice
#

old people are always nice

lavish hemlock
#

but yeah I think I've learned a lot considering how many years I've spent programming

eternal oxide
#

We are usually too busy shooing kids off our lawns

torn shuttle
#

tbf on the matter of "being good at java", I think it's more granular than just that, you can get really into the specifics of something and get good at that without ever really messing with whole parts of java

grim ice
#

my first thing to learn was php but i gave up :P

radiant aspen
#

php sucks

torn shuttle
#

if you told me there are people out there that make a living programming java but have never used reflections I would easily believe that

radiant aspen
#

but ye if I were you id just start coding spigot plugins, its easier to learn to program if your programming something you like

torn shuttle
#

or messing with file saving

paper viper
lavish hemlock
paper viper
#

Yeah that is recommended

#

cause they are faster

torn shuttle
#

I wouldn't be surprised if using reflections is straight up forbidden in some businesses because that seems like a nightmare to coordinate and maintain

waxen plinth
#

I sure hope it's not banned anywhere, cause reflection is great

paper viper
#

who the hell would ban reflection

#

it allows you to use software which is coded horribly

quiet ice
#

they can be great from time to time, but I know someone is not removing dead code because of reflections

paper viper
#

or thats one of the big reasons

#

lol

lavish hemlock
#

now y'see my heart is set on a different kind of cursed beauty

ASM 😍

quiet ice
#

ASM is nice - as long as they don't copy & paste the Java language specification

#

(AnnotationNode is a perfect example of copy & paste)

lavish hemlock
#

nah they're just copy & pasting the Java virtual machine specification

eternal oxide
lavish hemlock
#

but uh ASM is designed primarily for speed, not actually usability lmao

torn shuttle
#

sorry I meant stackoverflow

#

github too

lavish hemlock
#

I will never work there

#

that's a shitty thing to do bc it's basically

eternal oxide
#

They do that to maintain clean room. They don;t want you stealing others code, which they would be liable for.

quiet ice
#

^

lavish hemlock
#

I mean yeah but also no

quiet ice
#

Stealing code can be a serious issue in enterprise world

grim ice
torn shuttle
#

if you find out apple stole your github project to process images when that was not with a license that allowed them to do it, a lot of people would go after them for a lot of money lol

grim ice
#

LOL

tardy delta
#

smh why am i watching this

lost matrix
#

listOfFlyingPlayer pls

#

And dont make it a list but a Set

tardy delta
#

Set<UUID>

#

🥺

crimson terrace
#

FourteenBrush used "wrong format", it was super effective!

tardy delta
#

huu

olive cliff
#

Please help in the animated scoreboard the player does not work %player_name%

grim ice
tardy delta
#

%player%?

tardy delta
olive cliff
open vapor
#

Whenever i use player.connect on bungeecord, the player gets timed out. I don't know what's causing this but it used to work and I didn't change anything.

lost matrix
grim ice
#

including the collection type kinda weird don't you agree

tardy delta
#

this goes so hard brrr

olive cliff
lavish hemlock
#

I dunno if that can also be final tho

lost matrix
tardy delta
#

did it like this

split lake
#

so i have a solution but it gives an console error, this line
this.getBukkitEntity().addPassenger(stand);

where 'this' is an nms entity and 'stand' is a bukkit entity. Gives the error:

java.lang.IllegalStateException: Use x.startRiding(y), not y.addPassenger(x)```
 But i can't use startRiding bc converting bukkit to nms isnt a thing so what should i do
tardy delta
#

startriding :stonks:

#

oh

split lake
#

this is the whole code btw

#

wait i cant send pics

split lake
#

    public Butterfly(Location loc) {
        super(EntityTypes.f, ((CraftWorld)loc.getWorld()).getHandle());
        this.setPosition(loc.getX(), loc.getY(), loc.getZ());
        this.setHealth(1);


        ArmorStand stand = loc.getWorld().spawn(loc, ArmorStand.class);
        stand.setInvisible(false);
        stand.setMarker(false);
        stand.addEquipmentLock(EquipmentSlot.HAND, ArmorStand.LockType.ADDING_OR_CHANGING);
        stand.getEquipment().setItemInMainHand(new ItemStack(Material.FISHING_ROD));
        this.getBukkitEntity().addPassenger(stand);

        spawnMembers(loc);

    }```
tardy delta
split lake
#

lol

tardy delta
#

bob ross 😳

split lake
#

bob ross cool af

wispy monolith
#

How to check if a specfic item slot is empty?

tardy delta
#

== null or type is air

wispy monolith
#

thx

tardy delta
#

np

split lake
wispy monolith
#

i just wanted to mkae sure that it's null

split lake
#

ooh okay

#

ty

#

tho

prime reef
#

how ridiculously inefficient would it be to implement my own pathfinding instead of using NMS

like I know how, but would there be significant performance overhead to have an entity just set its velocity/facing direction according to a "goal" location

#

the issue with NMS is of course the need to update it every time the game updates

tardy delta
#

any suggestions for my fly command? 🙄

prime reef
#

besides the fact that you could probably trim down some stuff using a map rather than a list or a set

#

and that you should be doing args.length >= 1 instead of ==

quaint mantle
#

@maiden briar

maiden briar
#

Yes