#help-development

1 messages Β· Page 1573 of 1

granite stirrup
#

and idk how to fix

#

it also cannot find the parent pom.xml

quaint mantle
#

Gg using maven in 2021

#

There’s the problem

granite stirrup
#

i think you might need to specify somewhere if its in maven repo or not

#

and im not sure how

#

it keeps trying to download from maven central 🀣

#

thing is it works fine with intellij run button

#

but idk if that uses ant or not

fluid cypress
#

this is returning false in a wall sign Block signBlock.getBlockData() instanceof Directional, what am i doing wrong?

blissful folio
#

how can I put items in armor stands equipment slots?

#

i.e. helmet slots

minor garnet
#

.setHelmet

desert lichen
#

@fluid cypress Sign is a Rotatable, Directional are for stairs for exemple

blissful folio
minor garnet
#

Let me see

desert lichen
#

Does armorStand.getEquipment().setHelmet work ?

minor garnet
#

Hmm

blissful folio
#

Ooh yes it does! Thank you

restive burrow
#

for some reason when i compile i get that

desert lichen
#

My bad, Sign is a Rotatable however WallSign is Directional

fluid cypress
#

well, its false with Directional anyway

#

so... another way of checking if its a wall sign?

granite stirrup
#

i finally got it to build but idk if i accidently shaded in the whole of lwjgl

#

i shaded in lwjgl

#

xd

restive burrow
desert lichen
#

@fluid cypress You can always check if material is a wall sign

granite stirrup
#

oh i guess i do need to shade in lwjgl

#

the app wont work without it

unreal quartz
desert lichen
#

What event should I listen to for a player teleporting with an end portal ? PlayerPortalEvent doesn't seam to work

quiet hearth
#

Is there a way to cycle through a players inventory and check if there is a certain item in it. Then see how many of that item there is?

        if (inv.getItem(i).getType().equals(steak)) {
            steakSlot = i;//Sets steakSlot to location of steak
                                    
       }
      }```
#

I tried that but it doesnt seem to work^

young knoll
#

What is steak

unreal quartz
#

tasty

granite stirrup
#

No one move to general

blissful saffron
#

how do I set a blocks breaking power

granite stirrup
#

Pretty sure that's client side?

desert lichen
#

It can be done with NMS I think

granite stirrup
#

Protocol lib

#

PacketPlayOutBlockBreakAnimation ?

blissful saffron
#

is it possible to make it so if your holding a certain item you get mining fatigue

granite stirrup
#

Pretty sure you have to schedule a thing every certain amount of ticks using bukkitscheduler and just check every players holding item

granite stirrup
#

EntityPortalEnterEvent?

sharp bough
#

if holding the item

#

thengive them mining atige

granite stirrup
sharp bough
#

so you dont have the constant check

fluid cypress
#

is it possible to remove a block from an AsyncPlayerChatEvent callback without having an exception? if not whats the proper way of doing that?

#

the not async version of the chat event is deprecated afaik, right?

desert lichen
granite stirrup
granite stirrup
desert lichen
#

For context I have a main world and a generated world that I want it to be deleted and regenerated at a point. What I'm trying to do is to link the generated world with it's nether and end

granite stirrup
#

Or try PlayerPortalEvent?

desert lichen
#

It's working fine with nether portals, but it doesn't fires with end portals idk why

granite stirrup
#

Code?

desert lichen
#

Just a sysout inside the event

@EventHandler
    public void onPortal(PlayerPortalEvent event) {
        System.out.println(event.getFrom().getWorld().getName());
    }
fluid cypress
lunar wedge
#

I'm so confused. Working with vault, making an economy plugin. The issue is, other plugins will not interact with it. If I take the SAME economy code, and put it into a different project, the other plugins have no issues. But in my main project, they just won't interact. It will interact with its self with economy commands, and is hooking into vault it seems.....

So I'm at a loss. Any thoughts?

granite stirrup
desert lichen
#

I will consider using entity enter portal event just for the end portal, since it's an instant teleportation anyway. I will teleport them to their bed location

fluid cypress
granite stirrup
#

Hmm not sure

fluid cypress
#

i mean, i could make a list and push in there the data, and then do all things from the main thread, consuming from that list, but maybe there is a non deprecated sync chat event or something, idk

granite stirrup
#

Might be better of storing data somewhere and accessing it on the main thread

blissful saffron
#

what event would I use to see if a player is holding something?

granite stirrup
#

I'm pretty sure

blissful saffron
#

I can see if a player has something in there inventory but idk how to see if they are holding it

granite stirrup
blissful saffron
#

would that lag the server if I had multiple checks doing that for multiple items?

granite stirrup
blissful saffron
#

yeah but I want to use diffrent effects for diffrent items like mining fatigue 1 then 2 then 3 for diffrent items

granite stirrup
#

Yeah you just add a new if

#

In the loop

#

To check for a different item

blissful saffron
#

Ahh okay ty for the help

fluid cypress
granite stirrup
#

Pretty sure minecraft is 1 thread

#

Spigot I think adds multithreading

#

But idk

shut field
sharp bough
shut field
desert lichen
# shut field huh?

you have a condition, which if not satisfied your function wont return

#

Hence the missing return

rigid otter
#

What difference between BukkitScheduler#runTask() and BukkitScheduler#runTaskLater() with delay 0?

#

Are they different or not?

desert lichen
#

I don't think so.
Using the docs:
BukkitRunnable#runTask:

Schedules this in the Bukkit scheduler to run on next tick.

And BukkitRunnable#runTaskLater:

Schedules this to run after the specified number of server ticks.
rigid otter
#

So, they are different

rigid otter
#

delay 0 will run immediately

#

But runTask will run next tick

desert lichen
#

But they should be in sync with the tick

#

It's not asynchronous

rigid otter
#

Yes

indigo iron
#

anyone know the worldguard flag that will allow playerinteractevent

#

when i right click with any item that has specific lore on a block it gives me an item works fine without worldguard but doesn't work with worldguard

granite stirrup
#

interact flag?

#

Or maybe use flag?

granite stirrup
#

You should put this in help server tho

indigo iron
#

oh alright mb

quaint mantle
#

im not sure

crude charm
#

should I be concerned?

granite stirrup
crude charm
granite stirrup
hexed hatch
#
    List<NamespacedKey> keyList = new ArrayList<>();

    public RecipeManager(StupidItems stupidItems) {
        ShapedRecipe remote = new ShapedRecipe(stupidItems.redstoneRemote);

        remote.shape("*&*","%B%","*^*");

        remote.setIngredient('*', Material.IRON_INGOT);
        remote.setIngredient('&', Material.REDSTONE_TORCH);
        remote.setIngredient('%', Material.REDSTONE);
        remote.setIngredient('B', Material.ENDER_EYE);
        remote.setIngredient('^', Material.AMETHYST_SHARD);

        Bukkit.getServer().addRecipe(remote);
        keyList.add(remote.getKey());
    }

    public void sendRecipes(Player player) {
        for (NamespacedKey key : keyList) {
            player.getDiscoveredRecipes().add(key);
        }
    }```
Excuse the sloppy code, I'm in proof of concept mode. Currently I'm trying to send a custom recipe to the player but I'm getting a NPE. 
https://paste.md-5.net/ehoxidifaj.sql
#

Anyone know what the issue might be?

#

There is no method in ShapedRecipe to set a NamespacedKey either

#

I know that sending custom recipes to the recipe book is doable, I've seen it on a server before

cloud berry
#

guys how do u get th block a player is facing? 😳 i cant find it

#

i know thers getFacing() but tahts just a blockface

hexed hatch
#

Turns out I'm an idiot, apparently the key is the first parameter for ShapedRecipe.

ShapedRecipe remote = new ShapedRecipe(REDSTONE_REMOTE_CRAFTING, stupidItems.redstoneRemote);
quaint mantle
#

so maybe?

crude charm
#

this was fine one second and then the next it just breaks

#

...

#

huh

#

I hate intelliJ so much

#

now it's saying that about all my classes

#

WTF

fluid cypress
#

the server waits untill all onDisable stuff is done before shuting down?

quaint mantle
#

yes

fluid cypress
#

even if it takes forever? will it kick all players before all onDisable stuff is done or after?

crude charm
#

before

glossy scroll
glossy scroll
sage swift
shut field
#

how would I do this?

sage swift
#

this.cancel(); should work

shut field
#

thanks

hasty prawn
fluid cypress
# crude charm before

what if i want to get a player inventory then? the player object is still available for the rest of the tick or something like that?

#

assuming all of the onDisable stuff is executed on the same tick

#

any idea why the split doesnt work?

String[] lines = shop.holographicText.split("\\n");
for (String line : lines) {
    System.out.println(line);
    hologram.appendTextLine(line);
}
[02:23:47 INFO]: asdads\nadha

"\n" doesnt work either

oblique pike
#

Guys, how do I increase attack damage of skeleton using the attributes ? I’m using just Monster#getAttribute()#setValue(), but it works for other mobs rather then skeleton

fluid cypress
#

do i need \\\\?

quaint mantle
#

you want lines right

#

\n

fluid cypress
#

no, \\\\ was what i need

#

i hate scaping scape characters for regex, i always forget that

quaint mantle
hasty prawn
#

Why did what happen

quaint mantle
#

wondering... because i tried this earlier, in Skript you can make toggling commands like...

/exampletoggle, and if {variable} is true, it'll set it to false, and then if the variable is false.. it sets to true, etc.

i was wondering if this is possible in Java? i tried it a little bit.. but it seemed to not work

#

i removed the code seeing as this was near 8 hours ago

#

hoewver i was wondering how something like this could be achieveable

#

is it litearlly the same?

If(boolean){
stuff
}
else{
more stuff
}
? or is it more complicated

#

considering i did the if(boolean).. hours ago, and didnt work.. im curious

quaint mantle
#

it need to be Deaths:
2

#

but it dont remove the old value from the scorebiard

drowsy helm
#

keep in mind that is not a per-player toggle. you would have to incorporate a map for that

limber mica
#

Is there a reason when you broadcast a message to every player and you do like [no] the text is invisble

quaint mantle
misty zenith
#

which pathfinder do move entity to a location that i give it ?

hasty prawn
limber mica
misty zenith
drowsy helm
#

ive never seen that before though

limber mica
#

yea

misty zenith
#

which pathfinder do move entity to a location that i give it ?
does any body now this ? :l

hasty prawn
misty zenith
#

let me check

hasty prawn
#

They take in an entity though, I'm not really sure how you can get them to move to a Location

misty zenith
#

do you now the parameter ?

hasty prawn
#

Are you using IntelliJ?

misty zenith
#

ye

hasty prawn
#

Ctrl click the method, it'll go to the declaration

misty zenith
#

Thq

drowsy helm
#

both GotoTarget and MoveTowardsTarget have some strange params

quaint mantle
misty zenith
#

PathfinderGoalMoveTowardsTarget(EntityCreature var0, double var1, float var3)
hmmm how it take location ?

drowsy helm
#
    this.a = var0;
    this.b = var1;
    this.i = var3;
    this.f = 0;
    this.j = var4;
    a(EnumSet.of(PathfinderGoal.Type.MOVE, PathfinderGoal.Type.JUMP));
  }``` for goto target
#

seems more useable

#

neither seem right

ionic reef
#

I'm having a bit of an odd issue rn. So Im making a plugin where theres a 'safari' which is where my pokemon will spawn (armor stand w/a custom head. Every 20mins the safari needs to refresh (remove all existing ones, spawn new ones). This all works when a player is online, it cycles through, removes all the existing ones, spawns new ones and teleports the new ones into the ground.

The issue occurs when theres no players online/loading the chunks where a pokemon spawns, in this case the pokemon spawn, fall (don't get teleported into the ground), and then doesn't remove. I've tried loading the chunks whenever I spawn one but it doesnt seem to be working...

Spawn method: https://paste.md-5.net/obolujokiw.cs (with attempt @ loading chunk)

hasty prawn
#

1.17 has a MoveToBlockGoal πŸ€” not sure what it's equivalent is before 1.17 (and remapped)

hasty prawn
drowsy helm
#

oops

hasty prawn
#

Why do you want them to be spawned if there's no players online?

drowsy helm
ionic reef
#

the only thing is that they dont remove either w/out a player

#

and they have to be cycled

hasty prawn
#

Just don't spawn them if the chunk isn't loaded

misty zenith
#
this.goalSelector.a(0, new PathfinderGoalGotoTarget(this, 0, 0) {
            @Override
            protected boolean a(IWorldReader iWorldReader, BlockPosition blockPosition) {
                return false;
            }
        });
``` so how it works ?
hasty prawn
ionic reef
misty zenith
#

?

hasty prawn
#

So when the chunk unloads, so are all the Pokemon within that Chunk.

hasty prawn
misty zenith
#

i want to move it to a location

quaint mantle
#

how to get command senders ign instead of CraftPlayer{name=BunkDev2}

hasty prawn
#

Cast to a Player and use getName

quaint mantle
#

ah mk

hasty prawn
misty zenith
quaint mantle
#

Player player = (Player) sender;

#

wat to chyange it to

hasty prawn
#

That is casting to a player

#

Just player.getName()

quaint mantle
#

player.getName()

#

whewre

drowsy helm
#

where you want to get the name

hasty prawn
#

^

reef wind
quaint mantle
#

so where i put player

misty zenith
#

hmmm answer my q ? :l

quaint mantle
#

i put player.getName();

misty zenith
#

😐

drowsy helm
#

or if its easier

Player player = (Player) sender);
String name = player.getName();
hasty prawn
misty zenith
#

@hasty prawn what should I do ? :l

hasty prawn
#

Yeah, it exists in EntityInsentient

hasty prawn
misty zenith
#

so what should I do

hasty prawn
drowsy helm
quaint mantle
hasty prawn
#

resetScores

drowsy helm
quaint mantle
#

Ok thanks

drowsy helm
#

because you are treating the score as an index so the scoreboard is seeing 0 and 1 as different scores, not the value themselves

quaint mantle
#

Ok Thanks

misty zenith
#

PathEntity path = navigation.a(loc.getX(), loc.getZ(), loc.getZ()); is it correct ?

#

Cannot resolve method 'a(double, double, double)`

drowsy helm
#

maybe takes a float?

misty zenith
#

Cannot resolve method 'a(float, float, float)'

drowsy helm
#
  @Nullable
  public final PathEntity a(double var0, double var2, double var4, int var6) {
    return a(new BlockPosition(var0, var2, var4), var6);
  }```
#

theres quite a few overloads for a

#

also one that takes 4 doubles

misty zenith
#

what the var6 is actually do ?

drowsy helm
#

not sure honestly

hasty prawn
#

Lemme see if I can find out

drowsy helm
#
  
  @Nullable
  protected PathEntity a(Set<BlockPosition> var0, int var1, boolean var2, int var3) {
    if (var0.isEmpty())
      return null; 
    if (this.a.locY() < 0.0D)
      return null; 
    if (!a())
      return null; 
    if (this.c != null && !this.c.c() && var0.contains(this.p))
      return this.c; 
    this.b.getMethodProfiler().enter("pathfind");
    float var4 = (float)this.a.b(GenericAttributes.FOLLOW_RANGE);
    BlockPosition var5 = var2 ? this.a.getChunkCoordinates().up() : this.a.getChunkCoordinates();
    int var6 = (int)(var4 + var1);
    ChunkCache var7 = new ChunkCache(this.b, var5.b(-var6, -var6, -var6), var5.b(var6, var6, var6));
    PathEntity var8 = this.s.a(var7, this.a, var0, var4, var3, this.r);
    this.b.getMethodProfiler().exit();
    if (var8 != null && var8.m() != null) {
      this.p = var8.m();
      this.q = var3;
      f();
    } 
    return var8;
  }```
#

var3 in this context

hasty prawn
#

reachRange

quaint mantle
hasty prawn
#

?

#

I think it takes an Objective

#

Wait no

#

It takes an Entry name

quaint mantle
#

so how i do it if it changable?

burnt current
hasty prawn
quaint mantle
#

like i do

getScore(kills_variable)
so it can be 0,1,5,6 and more
so same on resetScores no?

hasty prawn
#

resetScores resets all of them

#

Read the docs on it, might help, I don't remember it all off the top of my head tbh

quaint mantle
#

so try do

board.resetScores(kills_var)?

hasty prawn
#

Try it

oblique pike
#

How do I increase attack damage of skeleton using the attributes ? I’m using just Monster#getAttribute()#setValue(), but it works for other mobs rather then skeleton\

eternal oxide
#

Other mobs are physical attacks, Skellys use a bow

quaint mantle
hasty prawn
quaint mantle
#

getEntries().map?

exotic scroll
#

what kind of data value is an entity?

hasty prawn
hasty prawn
# quaint mantle getEntries().map?

getEntries should return a list of all the entries in the Scoreboard, loop through those and reset their scores, then set the scores again

oblique pike
eternal oxide
#

or you could watch for the EntityDamageByEntityEvent, when its a projectile from a skelly increase the damage.

exotic scroll
#

I am stupid

exotic scroll
#

I think

#

he is trying to say

#

How to detect and change the powering stage of the bow of an skeleton

eternal oxide
tardy delta
#

is there a way to fix this: when i enter an command, my own /ban command and i press tab it doesnt show an online player list

hasty prawn
#

Are you returning an empty array

tardy delta
#

even if i enter the first letter of my name and press tab nothing happens

eternal oxide
#

you need to populate the tab completer

tardy delta
#

lemme check something first

hasty prawn
#

Sure. But if you return null it'll default to the online player list πŸ˜‰

eternal oxide
#

or don;t implement teh tab completer and it will alwasy offer players

hasty prawn
#

Even if you do; returning null will offer the player list

eternal oxide
#

true

tardy delta
#

ah also something wrong with the tabcomplete

eternal oxide
#

you need to check the length of args to see what complete you should offer

exotic scroll
#

spigot
πŸ’¦

tardy delta
#

like this?

hasty prawn
#

Yes

tardy delta
#

works thanks

burnt current
#

@eternal oxide Sorry but can you help me again? You helped me yesterday with a problem with JDBC. It was about DataSources. You told me to create a DataSource field. But unfortunately I don't know exactly how and where I should create the field in this case.

eternal oxide
burnt current
#

ohh ok

#

And what should I do about the rest of the error messages? I can also send you a screenshot of what is still marked in red

eternal oxide
#

yes an SS

burnt current
vital ridge
#

Do I have to close my connections somewhere?

eternal oxide
#

you don;t need any of that. I did say, you are only interested in the MySQL section inside the try/catch

#

@burnt current

burnt current
#

so i just need this part of the class?:

eternal oxide
#

and the setting options

burnt current
#

which is it?

eternal oxide
#

all the lines in the try/catch excluding the this.currentServer line

#

you will need to provide values for the ConnectTimeout etc

#

but those you can easily google for suitable settings

burnt current
eternal oxide
#

in your screenshot

burnt current
#

oh you mean in the first screenshot

#

you mean this.currentServer=serviceDescriptor.getId(); right?

vital ridge
#

What about my error?

vital ridge
eternal oxide
#

How many entries in Utils.getAllUsertagsLength()?

vital ridge
#
public static int getAllUsertagsLength() throws SQLException {

        try (
                final Connection connection = MySQL.getConnection();
                final ResultSet rs = connection.prepareStatement("SELECT COUNT(*) FROM all_usertags;").executeQuery()
        ) {

            int rowCount = 0;

            while (rs.next()) {
                rowCount = rs.getInt(1);
            }

            return rowCount;
        } catch (final SQLException e) {
            e.printStackTrace();
        }

            return -1;

    }
vital ridge
eternal oxide
#

Why do two queries when you can simply do one and loop it once?

#

SELECT * FROM all_usertags

#

then while (rs.next())

#

its a single query instead of one to get teh count, then a seperate query to get each usertag

#

as you are testing them all just get them all

vital ridge
#

Where im doing two queries?

#

First one is the resultset

eternal oxide
#

You are doing the first query to get the count for your for loop

#

which you don;t need

#

just get all_usertags as you are parsing each one anyway

#

you are running a separate query for every tag

vital ridge
#
public static int getAllUsertagsLength() throws SQLException {

        try (
                final Connection connection = MySQL.getConnection();
                final ResultSet rs = connection.prepareStatement("SELECT * FROM all_usertags;").executeQuery()
        ) {

            int rowCount = 0;

            while (rs.next()) {
                rowCount = rs.getInt(1);
            }

            return rowCount;
        } catch (final SQLException e) {
            e.printStackTrace();
        }

            return -1;

    }
#

so like this?

eternal oxide
#

No

#

you do not need the length at all

#

scrap that whole method

#

and remove the for loop in the other

agile anvil
#

Hello guys,
Coming with a strange question but anyway ^^ Does someone know how to remove the "transparent black" box of nametags (including holograms for instance: see the screenshot) with a resource pack? Is it even possible?

vital ridge
#

Okay?

agile anvil
granite stirrup
#

Pretty sure that's client sided

#

You might need a modified client for that

agile anvil
#

Oh okay :/ Thanks anyway !

vital ridge
#

Oh

#

So pretty much the method is useless

#

as as long as rs.next is true it still adds the itemstack to the gui?

eternal oxide
#

If you want it ordered just add an ORDER BY NUMBER to the end of the query

#

So SELECT * FROM all_usertags ORDER BY NUMBER

vital ridge
#

Okay so that will add the items in the gui in the right order as it is in the table?

eternal oxide
#

yes

vital ridge
#

Okay but

#

my mysql table has a number system

#

and every number has its own tag

#

and im grabbing the number from the database to add its own displayname to every single tag

#

so everysingle tag in the gui has its own displayname pretty much

#

and I cant do that without my for loop

eternal oxide
#

yes you can

#

the ORDER BY NUMBER is sorting your results by the NUMBER value

vital ridge
#

Yeah but i need to get the number in a variable

eternal oxide
#

Why? You never use it in yoru code

vital ridge
#

na wait

#

yea

#

it would still act like int i currently does

eternal oxide
#

you only ever use it in your query

vital ridge
#
try (

                        final Connection connection = MySQL.getConnection();
                        final ResultSet rs = connection.prepareStatement("SELECT * FROM all_usertags ORDER BY NUMBER;").executeQuery()

                ) {

                    while (rs.next()) {

                        final String userTag = rs.getString("USERTAG");

                        final String permission = rs.getString("PERMISSION").toLowerCase();

                        if (p.hasPermission("cubicxpchat." + permission)) {

                            final ItemStack item = new ItemStack(Config.getTagItem());
                            final ItemMeta im = item.getItemMeta();
                            im.setDisplayName(Config.getTagDisplayName(userTag));
                            im.setLocalizedName(userTag);

                            item.setItemMeta(im);

                            allItems.add(item);

                        }

                    }

                } catch (final SQLException x) {
                    x.printStackTrace();
                }
#

Okay so thats what you mean tright?

#

Get rid of the for loop

eternal oxide
#

yes

vital ridge
#

And the query change

eternal oxide
#

yes

#

now instead of 11 queries for 10 items you have one query.

#

Your server locking up was due to the lag caused performing SQL queries on the main thread + the overhead of doing a separate query for each item.

vital ridge
#

Yeah now I see.

cold tusk
#

Hello, what is a "NamespacedKey"? I have come across it several times and do not know what it is.

vital ridge
#

You can use it in PersistentDataContainers

eternal oxide
#

its a Unique identifier

vital ridge
#

The thing is I havent learned a thing about thread

#

I just know that you should use async only in spigot related stuff

#

Or it was otherway around

cold tusk
#

and what do the two Strings in the Constructor?

public NamespacedKey(@NotNull String namespace, @NotNull String key)
granite stirrup
burnt current
tardy delta
#

uhh i forgot but for maven to add an api i need to add an repo and deprendency to my pom.xml and do i need to do something else?

vapid sparrow
#

why am I getting getExecutor()' in 'org.bukkit.command.PluginCommand' cannot be applied?

vital ridge
#

instead of getExecutor

vital ridge
vapid sparrow
summer scroll
#

I'm trying to add support for WG6 and WG7, how can I do that? (without using any libs)

eternal oxide
undone axleBOT
vital ridge
eternal oxide
#

does your sysout display?

vital ridge
#

yea

#

but it displays twice

#

it couldnt be the permission tho

#

I have op

#

so it shouldnt matter at all

#

and the permission worked perfectly before

#

It basically displays me only the usertags i have access to

eternal oxide
#

take the final off your local variables, not needed

vital ridge
#

Intellij adds it back for me

eternal oxide
#

the ones in the while anyway

#

thats nice of it to tell you how to code

#

Won;t be long before it writes the plugins for you

vital ridge
#

Aight ill get rid of the setting

#

i know its possible

#

just havent googled it

eternal oxide
#

ok, if your sysout is showing the usertag and permission then yoru error must be in adding the items

vital ridge
#

Yea must be

#

I tried sysouting the permission boolean aswell

#

i have the perm

eternal oxide
vital ridge
#

Mhm did it.

tardy delta
#

idk what this is

eternal oxide
#

what is your allItems variable?

vital ridge
#

Its a normal arrayList

eternal oxide
vital ridge
#

Thats where i add them to my gui:

for (final ItemStack item : PageUtil.getPageItems(allItems, page, Utils.getAllUsertagsLength())) {
            gui.setItem(gui.firstEmpty(), item);
        }

Yes, I do.

#
public static List<ItemStack> getPageItems(final List<ItemStack> items, final int page, final int slots) {

        final int upperBound = page * slots;
        final int lowerBound = upperBound - slots;

        final List<ItemStack> newItems = new ArrayList<ItemStack>();

        for (int i = lowerBound; i < upperBound; i++) {
            try {
                newItems.add(items.get(i));
            } catch (final IndexOutOfBoundsException x) {
                continue;
            }
        }
        return newItems;
    }
eternal oxide
#

Why use Utils.getAllUsertagsLength() again? You have all of them in allItems

#

just do a size on allItems

vital ridge
#

Changed that.

eternal oxide
#

Now do a sysout after your while loop to see how many items you created

vital ridge
#

After? Shouldnt i do it in the permission section?

#

After the allitems.add(item)

eternal oxide
#

no, do it after as you won;t know how many are in it until the while loop finishes

#

after the whole while loop

vital ridge
#

Oh okay so ill sysout the allitems lenght

#

length

eternal oxide
#

yep

vital ridge
#

Idk why but it all of a sudden started to work lmao

#

I think the only thing i changed

#

That you told me

#

to create a variable before while loop

#

and initialize it in the while loop

#

Oh and

robust heron
#

when i try to launch the start.bat it just says this Unable to access jarfile spigot-1.17.jar and i press y to restart and it says it again

vital ridge
#

No I replaced the usertag method u didnt like

#

with allitems.size

eternal oxide
#

yep

#

nice

vital ridge
#

Thank you!

eternal oxide
#

ensure you have a spigot-1.17.jar with yoru bat file

quaint mantle
#
public void addItemsToMenu(ItemStack item){
        int[] amount = {1,5,10,32,64};
        int slot = 20;
        for (int i : amount){
            item.setAmount(i);

            ItemMeta meta = item.getItemMeta();
            ArrayList<String> lore = new ArrayList<>();
            StringBuilder sb = new StringBuilder();

            for (String l: Objects.requireNonNull(meta.getLore())){
                if (l.contains("Coins")){

                    for (char c : l.toCharArray()){
                        if (Character.isDigit(c)){
                            sb.append(c);
                        }
                    }

                    int price = Integer.parseInt(String.valueOf(sb));
                    price = price * i;
                    String nl = "&6" + price + " " + "Coins";
                    l = nl;
                    nl = Utils.color(l);
                    lore.add(nl);
                }
                else {lore.add(l);}
            }
            meta.setLore(lore);
            item.setItemMeta(meta);
            secondaryMenu.setItem(slot, item);
            slot++;
        }
        item.setAmount(1);
    }
robust heron
#

i do

quaint mantle
#

So I want to change the lore of the item in this

#

if anyone can guide me

eternal oxide
reef wind
sand rune
#

Guys what I should write in the

p.setGamemode();

reef wind
#

?google

undone axleBOT
quaint mantle
sand rune
#

Oh thanks !@quaint mantle

reef wind
quaint mantle
tardy delta
#

does someone knows how to check if a player is in a worldguard region?

#

i'm stuck in the api

eternal oxide
#

I'm not writing it for you sorry. I've shown you all the code you need. You just have to put it together.

burnt current
#

I don't want you to write it for me.

cold tusk
#

Hello, is there a way to get the list of blocks that are powered by the BlockRedstoneEvent?

dense geyser
#

can you not listen to events in an abstract class?

eternal night
#

I don't think methods in parent classes are registered no

ivory sleet
#

Ah yeah and then we got EventHandler which isn’t annotated with @Inherited

#

In case you wanna inherit or smtng

sand rune
#

Guys how to send player to another server from gui

eternal night
#

read up on bungee plugin channels

grand coral
#

Anyone haves the NuVotifier Maven repo

unreal quartz
sand rune
#

@eternal night
I didn't understand anything

granite stirrup
#

Why does nuvotifier not work on pyterodatyl but geyser does

quaint mantle
#

Does anyone know how I can define persistent data in a mob? That is not removed after reboot.

granite stirrup
#

Nbt?

quaint mantle
granite stirrup
quaint mantle
#

Is there any way that doesn't need the API?

granite stirrup
#

I'm pretty sure you use nms if you don't want to use it

#

Your better of using nbtapi

#

For nbt

#

Pretty sure the nms class for nbt tho is NBTTagCompound

lusty cipher
#

The API is really useful, cuz it works from 1.7.10 all the way to 1.17 with just some minor incompatibilities and has a lot of utilities

#

I personally use it and have found it to be very reliable and nice to use from a developer standpoint

bleak reef
#

Sorry, I have a really random question, Im trying to use Block#setType()
To set an air block to a spruce door:

loc.getBlock.setType(Material.SPRUCE_DOOR)

However it only creates the bottom half of the door, Would anyone know of any ways to get around this?

chrome beacon
#

I think you have to place the upper part too

bleak reef
#

Ive tried that however it just destroys the lower part for me

granite stirrup
#

Place the top first?

bleak reef
#

Oh that could work, Ill try that

bleak reef
real spear
#

I am trying to create a plugin to link discord and Minecraft (ik these already exist, but I want to add a bit to this one) and was wondering how I could add a library to the plugin. I tried and got this error on server startup:
https://pastebin.com/Rvf9wL7t

quiet ice
#

maven or gradle?

granite stirrup
#

Shade in the lib you want

#

If your using jda shade that in

hidden delta
hidden delta
#

org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: net/dv8tion/jda/api/JDABuilder

granite stirrup
#

You clearly didn't shade it in

#

Otherwise it will work

quiet ice
#

Not necessarily, but it is the most logical reason

granite stirrup
#

Idk how to do it on gradle but for maven you use maven shade plugin

quaint mantle
#

Hello error:
Error on Console:

java.lang.ArrayIndexOutOfBoundsExeption: 0

Error on Minecraft:

An internal error occurred while attempting to perform this command.

code: https://haste-bin.xyz/unoculezut.java
Line: 34

ResultSet name = PVP.plugin.getManager().getSQL().query("SELECT * FROM names WHERE uuid = ('" + array[0] + "')");

Someone can help me? Thanks

granite stirrup
quiet ice
#

on gradle you use the shadow plugin

hidden delta
quiet ice
granite stirrup
#

Lol

quiet ice
#

Sometimes it finds it but is being an ass and says that it isn't there.
Ruined a week once

quaint mantle
real spear
quiet ice
#

maven or gradle?

granite stirrup
#

But adding it as external jar doesn't mean it's shades in

unreal quartz
hidden delta
#

It cannot be! if you are including the jar while build the project. the java will find the class you are looking for

#

but in your case, it cannot be found

quiet ice
#

Or did you use JDT / the IntelliJ equivalent (please don't)?

unreal quartz
#

you include it at compile time

#

doesn't mean its present at runtime

quiet ice
#

If latter, you are without help (outside of the libraries declaration in the plugin.yml)

rigid otter
#

Hello! Where is CraftPluginManager class? I mean, ScoreboardManager implemented by CraftScoreboardManager, then what about the implementation class of PluginManager?

rigid otter
#

I can't find it in craftbukkit

unreal quartz
#

it's called SimplePluginManager i think

quiet ice
#

I would bet that it is implemented by bukkit and not craftbukkit

rigid otter
#

I actually can't find what class that just a name relate to Plugin in craftbukkit package

rigid otter
#

Can you tell me path/to/SimplePluginManager?

#

Opp

quiet ice
#

org/bukkit/plugin

hidden delta
#

org.bukkit.plugin.SimplePluginManager

rigid otter
#

It inside bukkit instead of craftbukkit

quiet ice
#

CB doesn't implement any plugin stuff

rigid otter
#

Ok thank you I'll check it!

real spear
granite stirrup
#

Why are you not using maven or gradle

quiet ice
#

So JDT

#

Well, you are without help

real spear
hidden delta
quiet ice
#

I suggest the plugin.yml file, but that will only help in like 80% of instances; I am pretty sure here it does not apply

granite stirrup
quaint mantle
quiet ice
#

Your array is empty

hidden delta
real spear
hidden delta
#

every one here come to learn

real spear
#

Would Maven make this whole process easier?

quiet ice
#

nyes

hidden delta
#

I never used maven or gradle in minecraft plugin development

quiet ice
#

It will be easier, but also less convenient at the same time

unreal quartz
#

if you are used to it i find it much more convenient

rigid otter
#

I just wanna know how annotated @EventHandler function works. Why bukkit can call unknown functions, but just has an annotation.

hidden delta
#

when you are register your class, the bukkit foreach all the methods and check if it has the @EventHandler annotation

rigid otter
#

Ohh, maybe because I don't know about that foreach methods

hidden delta
#

you can for each methods with Class#class#getDeclaredMethods() or Class#class#getMethods()

#

getDeclaredMethods and getMethods are different

rigid otter
#

Okk thank you!

quaint mantle
hidden delta
#

can you send the class?

#

pastebin or hastebin

unreal quartz
#

are you making database requests on the main thread?

unreal quartz
hidden delta
#

Yeah it is bad!

#

He need to use async schedulers

granite stirrup
hidden delta
#

@quaint mantle

#

the thing you are doing here

#

if the result has more than 10 stats

#

the array will reach the limit and you get an error

real spear
granite stirrup
quiet ice
#

Why ANT of all things?

granite stirrup
#

I'm pretty sure eclipse uses ant?

quiet ice
#

Eclipse uses it's own build system by default, called JDT

granite stirrup
#

Thought it was ant

quiet ice
#

Or at least I call it that

unreal quartz
#

well i do not see an ant buildfile there

quiet ice
#

Eclipse Java Development Tools could be an ant wrapper, but I highly doubt it

hidden delta
tight jolt
#

I have trouble with player.openWorkbench can someone help me

hidden delta
#

@tight jolt explain

tight jolt
#

if i want to start the server the plugin crashes and shut down

hidden delta
#

if you want to open the workbench?

quiet ice
#

Without a stacktrace?

tight jolt
#

no if I start the Server

hidden delta
#

upload the log file into pastebin

#

and make it unlisted

quiet ice
#

(or any other paste service)

hidden delta
#

?paste

undone axleBOT
real spear
tight jolt
pallid arrow
#

ΠΊΠ°ΠΊ ΡΠ΄Π΅Π»Π°Ρ‚ΡŒ Ρ‚Π°ΠΊ ,Ρ‡Ρ‚ΠΎΠ±Ρ‹ ΠΊΠΎΠ³Π΄Π° я Π½Π°Π΄Π΅Π²Π°Π» шлСм выдавался эффСкт Π½ΠΎΡ‡Π½ΠΎΠ³ΠΎ зрСния, Π° ΠΏΠΎΡ‚ΠΎΠΌ ΠΊΠΎΠ³Π΄Π° я снимал ΠΏΡ€ΠΎΠΏΠ°Π΄Π°Π»?

#

Π±Π»ΡΡ‚ΡŒ

quiet ice
#

I know

pallid arrow
#

how to make sure that when I put on the helmet, the effect of night vision is issued, and then when I took off it disappeared?

granite stirrup
#

Isn't there a event for when you put on arnor?

#

Or no

tight jolt
#

@hidden delta oh du bist deutsch xD

hidden delta
#

java.lang.NullPointerException: Cannot invoke "tv.banko.tutorialreloaded.backpack.BackpackManager.save()" because "this.backpackManager" is null

hidden delta
tight jolt
#

ok

tight jolt
#

im new to codeing

#

na wie gehts

hidden delta
#

and you are trying to access

tight jolt
#

but if I put away the command Its working and thats not this.backpckManager

hidden delta
#

at tv.banko.tutorialreloaded.Main.onEnable(Main.java:45) ~[?:?]

#

what is in line 45?

#

in Main class

tight jolt
#

w8

pallid arrow
#

this

#

thank you

tight jolt
#

Objects.requireNonNull(getCommand("Crafting")).setExecutor(new CraftingCommand());

sage swift
#

what's in the CraftingCommand constructor

#

Objects.requireNonNull is useless btw

hidden delta
#

how does getCommand("Crafting") get null?

tight jolt
#

idk im new to codeing

hidden delta
#

there is something weird

sage swift
#

don't use requireNonNull, new to codeing

hidden delta
#

are you using the latest build

sage swift
#

anyways nice to meet you new to codeing

tight jolt
#

what latest?

#

1.16.4

hidden delta
#

which spigot server you are using? 1.16.4?

tight jolt
#

1.17

hidden delta
#

I see

tight jolt
#

do I have to code everything new?

sage swift
undone axleBOT
hidden delta
#

can you paste your Main there?

#

Hey @tight jolt

proud basin
#

wow gecko you really gonna do him like that

tight jolt
hidden delta
#

did you register your command inside the plugin.yml?

tight jolt
#

yes

sage swift
#

well yeah

hidden delta
#

it cannot be null if you are register it in plugin.yml

sage swift
#

you're probably trying to access backpackManager in the CraftingCommand constructor before you set it

#

the command is fine

tight jolt
#

can i screenshare to you

hidden delta
#

join general-1

tight jolt
#

you cant stream there

sage swift
#

i mean i told him the issue

#

it's not the command being null

hidden delta
#

it is in getCommand or in the CraftingCommand

sage swift
#

no

#

it literally says the backpackManager is null so it can't save

hidden delta
#

πŸ˜‹

sage swift
#

which is probably in the CraftingCommand constructor

hidden delta
#

miss spelling the command

sage swift
#

since he instantiates the backpackManager after the commands

hidden delta
sage swift
#

oh i didn't see the error

#

lol yeah

#

commands aren't capitalized

#

change to lowercase in code and in plugin.yml

tight jolt
#

thak you very much maybe one day I can be like you and can help retardet people πŸ™‚

burnt current
waxen plaza
#

It explains everything there

pallid arrow
#

how to solve this error?

hidden delta
eternal oxide
rigid otter
#

Can I create a plugin from Java Project instead of Maven Project?

opal juniper
#

Yeah

hidden delta
#

yeah

eternal oxide
#

Maven is easier though

opal juniper
#

You just have to depend on the actual jar

rigid otter
#

What about resources? Where is it located?

sage swift
#

?learnjava

undone axleBOT
opal juniper
#

U make it in src iirc

eternal oxide
#

You specify the resources location when you export

quiet ice
rigid otter
#

Okay!

sand rune
#

Guys how to send player to another server

rigid otter
#

I got it!

#

Use bungeecord

sand rune
#

I know

#

How to send player to server in the bungee network

quiet ice
sand rune
#

Using gui

quiet ice
sand rune
#

No

#

As command /hub

#

How to make some thing like it

quiet ice
#

Then read up the documentation of bungee's plugin message channel. I know that wiki.vg has a link to it

rigid otter
#

If no, if you are beginner on this, don't expect cool thing fast, just first know how to make it work in your plugin purely code, then in your command, then in your GUI

granite stirrup
#

/itemdb is a useful command

#

Really useful

tardy delta
#

worldpainter goes brrr

quaint mantle
#

how to get exploded blocks with all their state before explode?

eternal oxide
#

Check them in the Entity/Block explode event

quaint mantle
#
@EventHandler(priority = EventPriority.HIGHEST)
    public void blockExplode(BlockExplodeEvent e) {
        e.blockList().forEach(b -> {
            String custom_block = getCBT(b);
            if (!custom_block.equals("")) {
                breakEvent(b, custom_block, true);
            }
        });
    }
#

i have this. getCBT(Block) gets metadata and creating it if isn't exists. Break event summons items.

sage swift
#

getCockandBallTorture

quaint mantle
pallid arrow
#

how to make the effects disappear when I take off the helmet?

limber mica
#

Do you guys recommend looping through all online members then sending them all a message or using Bukkit#broadcastMessage

pallid arrow
#

code:
@EventHandler
public void onArmorWear(InventoryClickEvent event) {
for (Player player : Bukkit.getOnlinePlayers()) {
ItemStack helmet = player.getInventory().getHelmet();
if (helmet == null) continue;
if (helmet.getType() == Material.IRON_HELMET) {
player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 20, 1));
}
}
}
}

sage swift
#

ouch that is not the way to detect armor equip

pallid arrow
#

where?

sage swift
#

the only foolproof way is to check it constantly, but paper has an equip event i believe

reef wind
#

beginning and end to make it easier to read the code like this

#

and put java after the one in the beginning

#

^

pallid arrow
#

?

reef wind
eternal oxide
#

stupid markip

sage swift
#

```java
doesn't work bro```

reef wind
#

fuck it

sage swift
#
lol: you're stupid```
pallid arrow
#

Ρ‡Π΅

sage swift
#

ΠΎΠ½ ΠΈΠ΄ΠΈΠΎΡ‚

pallid arrow
#

Π°

#

Π° ΠΊΠ°ΠΊ ΡΠ΄Π΅Π»Π°Ρ‚ΡŒ?

reef wind
#
gecko.setIQ(0)
``` who is stupid now?
sage swift
#
код сюда```
pallid arrow
#

Ρ‰Π° ΠΏΠΎΠΏΡ€ΠΎΠ±ΡƒΡŽ

reef wind
#

speak english bruh

pallid arrow
#

no

urban lava
#

PlayerItemDamageEvent does this event track armor damage as well?

pallid arrow
#

1

urban lava
#

and shields

pallid arrow
#

Π²ΠΎΡ‚

reef wind
#

wrong symbol dumb dumb

#

still wrong symbol

pallid arrow
#

a

#

aaaa

#

Ρ…Π΅Ρ…

stone light
#

I have this error in my logs Cannot find main class io.github.nightterror04' my main is io/github/nightterror04 is there something I'm doing wrong?

reef wind
#

` not '

pallid arrow
#
    @EventHandler   
    public void onArmorWear(InventoryClickEvent event) {
        for (Player player : Bukkit.getOnlinePlayers()) {
        ItemStack helmet = player.getInventory().getHelmet();
        if (helmet == null) continue;
        if (helmet.getType() == Material.IRON_HELMET) {
               java  player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 20, 1));
            }
        }
    }
}```
ivory sleet
#

Your main is a package?

reef wind
#

congrats

reef wind
pallid arrow
#

how to make the effects disappear when I take off the helmet?

ivory sleet
#

Cartero and is this a plugin?

stone light
#

yeah

ivory sleet
#

Add a dot and then main class name

stone light
#

ohh okay thanks

ivory sleet
#

Like if it was String it would be java.lang.String

limpid bronze
# pallid arrow ```java @EventHandler public void onArmorWear(InventoryClickEven...

If you do some effects when someone have armor, i recommend to do this :

@EventHandler
    public void onInventoryClose(InventoryCloseEvent event){
        Player player = (Player) event.getPlayer();
        Inventory inventory = event.getInventory();
        if(player.getInventory().getHelmet() != null && player.getInventory().getHelmet().isSimilar(new ItemBuilder(Material.DIAMOND_HELMET)
                .build())) { // ItemBuilder is a class, do new ItemStack() instead
            player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 30, 1));
        } else {
            if(player.hasPotionEffect(PotionEffectType.SPEED)) player.removePotionEffect(PotionEffectType.SPEED);
        }
    }
pallid arrow
#

thank you

urban lava
#

how would i remove durability damage using PlayerItemDamageEvent

#

but only if the item is at full durability

ivory sleet
#

Check if the durability is the max durability then set a new durability value.

urban lava
#

wait i think i got it

#

yeah

#

thanks

urban lava
#

or before

ivory sleet
#

uh idk actually

urban lava
#

ill try assuming it is after the damage

ivory sleet
#

Most likely

#

Or might not be

sand rune
#

Guys, how to use LuckPerms Bungee in my bukkit Plugin

ivory sleet
#

Just use the api

sand rune
#

When I use it , chat event don't work

ivory sleet
#

Or well you’d need lp Bukkit for that

limpid bronze
#

Hey, I want to make it so that when you click on an item (GUI), it starts a 1 minute BukkitRunnable. During this 1 minute the player can write something in the chat and it will be saved, if the 1 minute is over and he hasn't written anything, he can't save anything. The problem is that I don't know how to do this because I need both a Listener and a BukkitRunnable.

sand rune
#

Oh , but if I setup tebex , and put the same tebex plugin in each bungee server , if one purchase the ranks , does the command run in every server the plugin is in it@ivory sleet

#

@urban lava

urban lava
#

i have no idea

#

im new to this

granite stirrup
#

but idk

#

how

limpid bronze
#

Oh okay but idk how too

granite stirrup
#

oh wait you might have to use bukkitscheduler but i think theres a way to just use one instead of using a bunch of them

limpid bronze
#

Okay i will see for bukkitscheduler

granite stirrup
#

i got something in my mind but idk how to explain/code it

limpid bronze
hasty prawn
#

You can save them in a map and decrement the map in 1 scheduler and when it hits 0 just remove them

granite stirrup
#

yeah thats what i was kinda thinking

#

a little different tho

hasty prawn
#

Although if you're not gonna be making too many of them you might as well just make a scheduler for each one

#

Easier to do it that way

limpid bronze
#

Okay

granite stirrup
#

i mean you could run a bunch of them it would be fine but i think going for the other way is kinda better option because its future proof

hasty prawn
#

True that one probably is more scalable I guess, but idrk how efficient scheduler are. Maybe you can run 300,000 of them and be fine πŸ˜‚

granite stirrup
#

it schedules a thing to run on the next tick but idk about the repeating one

limpid bronze
#

I'm trying to make a scheduler but I can't, how do I do it?

granite stirrup
#

search on google

hardy swan
#

why do ShapelessRecipe and ShapedRecipe both have #getKey() but not Recipe interface ._.

limpid bronze
granite stirrup
#

idk

hardy swan
#

but I think namespaced keys are rather important aspect of the recipe too

granite stirrup
hardy swan
#

and I have to class cast it...

granite stirrup
pallid arrow
#

how to make night vision at night and blindness during the day?

limpid bronze
# granite stirrup it is on google

Okay i found it but there are 2 types of Scheduler Bukkit.getScheduler().scheduleSyncRepeatingTask and Bukkit.getScheduler().scheduleSyncDelayedTask
what should i use

hardy swan
granite stirrup
#

but theres other methods

undone axleBOT
ivory sleet
#

Go to the last section of that page

limpid bronze
#

Oh

granite stirrup
#

@ivory sleet do you know how to make a x,y array in java?

ivory sleet
#

Elaborate

granite stirrup
#

a 2D array

ivory sleet
#

Uh yeah

#

T[][]

granite stirrup
#

oof so i cant it with this private List<Something> screen;?

ivory sleet
#

Yes

#

Then it would be List<List<E>>

granite stirrup
#

ah ok

ivory sleet
#

πŸ‘

quaint mantle
#

Hello how i setup ArrayList?
like

ArrayList array = []

array[0] = something

chrome beacon
#

new ArrayList<>()

hybrid spoke
#

?learnjava

undone axleBOT
chrome beacon
#

^^ You really should read through these

winged anvil
#

Any idea why PlayerInteractEvent is running twice? When I right click it sends "Testing" twice and when I left click it only sends once ```public class PlayerInteractListener implements Listener {

@EventHandler
public void onPlayerClick(PlayerInteractEvent e) {
    if (e.getClickedBlock().getType() == Material.CRIMSON_PLANKS) {
        e.getPlayer().sendMessage("Testing");
    }
}

}```

winged anvil
#

oh danggg

quaint mantle
quaint mantle
#

so why it say me to use array.set

hybrid spoke
#

a arraylist is not an array. its simply just a wrapper for an array.

quaint mantle
#

so how i create array type?

hybrid spoke
#

an array isn't an object itself

#

you create it with the help of other objects

quaint mantle
#

which import need..

hybrid spoke
#

just like String[] strings = new String[10]; <-- an array of max. 10 strings

quaint mantle
#

i was do this

#

but someone told me do without max

hybrid spoke
quaint mantle
#

but when i do new String[]
It give error

hybrid spoke
#

yeah because you need either to set the max capacity or the values inside

#

just like new String[] {"", "", ""}

#

or better String[] strings = {"", "", ""};

quaint mantle
#

so how i create empty array

hybrid spoke
#

for what

eternal oxide
#

Lists you can add to, Arrays are fixed size

quaint mantle
#

look the code

#

wait

deep sail
#

@dense kestrel i need help from u from dev

quaint mantle
#
String[] array = new String[];
                    ResultSet result = PVP.plugin.getManager().getSQL().query("SELECT * FROM PVP_stats ORDER BY 'kills' DESC LIMIT 10");
                    int counter = 0;
                    while(result.next()) {
                        array[counter] = result.getString("uuid") + "." + result.getInt("kills");
                        counter++;
                    }
#

@hybrid spoke

hybrid spoke
#

?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.

hybrid spoke
#

@deep sail ^

eternal oxide
deep sail
#

has to be from @dense kestrel

quaint mantle
eternal oxide
#

You can only use a String array if you know the size to start

#

if 10, then create it with 10

quaint mantle
#

i want size of 0 in start...

eternal oxide
#

no

quaint mantle
#

so 10?

hybrid spoke
#

it would just be an empty array for ever

eternal oxide
#

you MUST create it of the size you intend to use

quaint mantle
#

Ok

hybrid spoke
#

but i guess there is no fixed size, so use a list

#

just like elgar said

#

oh, there is a limit of 10. you could then create an array with the size of 10, yes. but i would prefer a list anyways

deep sail
#

@dense kestrel help please

dense kestrel
#

hey daddy!

deep sail
#

woah i do not feel like being sexualised

ivory sleet
#

Check the javadoc

eternal oxide
#

List<String> contents = new ArrayList<>()

quaint mantle
#

Thanks

hybrid spoke
#

why are you handling with database stuff if you don't even know arrays and lists

eternal oxide
#

Entry level to programming is WAY too low these days. Too much hand holding with IDEs.

ivory sleet
#

Spaghetti code PES_Blush

eternal oxide
#

I've seen assembly line workers who had machines that placed items on boards for them. When those machines broke and they were asked to do it by hand they had no clue how. They just watched the machine do it for them for years.

#

Thats todays programmers

ivory sleet
#

Lmao

eternal night
#

can't wait for the github copilot generation of devs

eternal oxide
#

oh my yep

ivory sleet
#

Copilot is just copy pasting open source right?

eternal oxide
#

almost

ivory sleet
#

Bad enough

eternal night
#

I mean it is gpt 3 trained on a ton of open source / stackoverflow

#

and then you kindly pray

eternal oxide
#

They ran tests where it auto filled in Comment blocks, then they put the cursor above teh comment block, hit tab and it filled in some poor devs security key

ivory sleet
#

Hmm wonder if it could clean up my code architecture

eternal night
#

code that can be cleaned by GPT 3 sounds like the spigot community lmfao

ivory sleet
urban lava
#

event.getItem().setDurability(0); this shoudl work to set the durabliiyt of the item to max

#

idc that its deprecated i have no idea how to use the itemmeta stuff

ivory sleet
#

No presumably not

eternal oxide
#

Probably as durability I believe is really a damage counter

quaint mantle
ivory sleet
#

event#getItem probably returns a CraftItemStack which if I am right won’t reflect it’s changes a jack shit to the inventory it’s contained in

#

Years sounds like a bad measurement strategy

urban lava
#

it broke instantly

eternal oxide
#

Get to my age and you start counting decades 😦

ivory sleet
#

Oh fair then epicmania

hybrid spoke
#

or did you heard 3 years ago from java so you know it by the name?

eternal oxide
#

anyway, learning is good. Keep going

hybrid spoke
#

i am getting rude. leaving the chat

eternal oxide
#

Just google more πŸ˜‰

hybrid spoke
#

cya

urban lava
#

which is what is confusing me

hasty prawn
#

What are you trying to do

#

Epic

urban lava
#

also my ide is throwing the error that it doesnt accept int

ivory sleet
#

β€œThis one”

#

It’s a short

urban lava
#

the code i showed

#

yeah

ivory sleet
#

(short)36

#

Or smtng

urban lava
#

but that also doesnt work

hasty prawn
#

You're setting the Durability?

urban lava
#

so nothing takes damage

ivory sleet
#

Why not go with the ItemMeta

urban lava
#

cuz idk how to use it

#

:C

hasty prawn
#

Use setUnbreakable

ivory sleet
#

ItemStack#getItemMeta

#

Check if instanceof Damageable

#

then cast and set the damage

hasty prawn
#

^

urban lava
#

i dont understand how to write that into code

ivory sleet
#

Uh well let me hop on pc

unreal quartz
#

?learnjava

undone axleBOT
quaint mantle
paper crest
#

these removed in 1.17 or is my idea?

hasty prawn
#

The packages changed in 1.17

ivory sleet
#
{
  ItemStack stack = ...;
  ItemMeta meta = wew.getItemMeta();
  if (meta instanceof Damageable damageable) {
    damageable.setDamage(99999999999999);
  }
  stack.setItemMeta(meta);
}
``` @urban lava
chrome beacon
#

?spoon ;/

undone axleBOT
#

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

hasty prawn
chrome beacon
#

^^

ivory sleet
#

it was an example lol

hasty prawn
#

Fair enough lol

ivory sleet
#

alexy nms versions are gone in 1.17

paper crest
ivory sleet
#

< official mojang mappings

unreal quartz
hasty prawn
#

wow

ivory sleet
#

remove the import Alexy, should give you a suggestion what to import alternatively

chrome beacon
ivory sleet
#

the name of that might had a change also lol

paper crest
#

oof