#help-development

1 messages · Page 1686 of 1

dry forum
#

but theres no name defined for it, im just getting the names of all the config sections

waxen plinth
#

Ok then yeah use a set

#

I mean, just look at the exception

#

It tells you exactly what is going wrong and where

dry forum
#

works, thanks

spiral bramble
#
    @EventHandler
    public void useItemInHand(PlayerInteractEvent event)
    {
        if (event.getHand() == EquipmentSlot.HAND) {
            if (event.getPlayer().getItemInHand().getType().equals(Material.FIREWORK_ROCKET))
            {
                if (CoreMethods.isPlayerGliding(event.getPlayer())) 
                {
                    ItemStack chestplate = event.getPlayer().getInventory().getChestplate();
                    if (chestplate.getType().equals(Material.ELYTRA))
                    {
                        chestplate.setDurability((short) (chestplate.getDurability() + 2));
                    }
                }
            }
        }
    }```
Is anyone able to explain why this is getting called twice? I know it's related to the `OFF_HAND` but I can't figure out how to solve it
young knoll
#

Should only make it past that first if once

spiral bramble
#

I'm losing 4 durability on the Elytra when it should only be 2 though?

young knoll
#

Hmm

#

Wonder if the event is somehow called twice when you use a firework

waxen plinth
#

I would first like to address

#

Your code is poorly structured

young knoll
#

You don’t like staircases?

waxen plinth
#

You don't even need to check the hand of the event because fireworks can be used from either hand

#

I do not like arrow code, no

#
if (e.getAction() != Action.RIGHT_CLICK_AIR || e.getItem() == null || !e.getPlayer().isGliding()) {
  return;
}
ItemStack item = e.getItem();
if (item.getType() != Material.FIREWORK_ROCKET) {
  return;
}
ItemStack chest = e.getPlayer().getInventory().getChestplate();
if (chest.getType() != Material.ELYTRA) {
  return;
}
chest.setDurability((short) Math.min(chest.getType().getMaxDurability(), chest.getDurability() + 2));
e.getPlayer().getInventory().setChestplate(chest);```
#

Something like this would be a whole lot better

#

In that it works no matter which hand the firework is in, and it won't end up with negative durability if their elytra is already broken

#

You also don't need a separate utility to check if a player is gliding

#

It's an existing method of Player

#

You may also be able to do this on ProjectileLaunchEvent, which I would imagine is fired if they boost with a firework midair

#

But it's worth noting that the level of unbreaking on the item also affects the damage it takes when using a firework

#

Assuming you're trying to recreate the snapshot behavior

young knoll
#

Didn’t spigot fix negative durability at some point

waxen plinth
#

Not to my knowledge

young knoll
#

Or was that stack sizes of 0 when using setAmount

waxen plinth
#

Just use max to be safe

#

Probably stack size 0

#

I think that sets to air now

spiral bramble
#

Hey thanks for the input there!
Just gave it a try and I think the durability removal is broken as it completely breaks a new elytra

waxen plinth
#

Oh sorry it should be Math.min not Math.max

#

Sorry, used to doing Math.max to prevent things going negative but forgot durability is reversed, higher = less durability (for some reason)

spiral bramble
#

Yes! Absolute legend! Thank you so much!

waxen plinth
#

In the future

#

Avoid indenting your code with nested if statements

#

It makes it hard to follow and hard to keep onscreen

#

Use early-return, exit the method early when you hit a fail condition rather than nesting if statements

spiral bramble
#

Alright thanks, will do! I've always used nested statements

waxen plinth
#

Nested if should be avoided at all costs

#

And if-else should be avoided in general as well

spiral bramble
#

Alright thanks! I'll keep it in mind!

#

Sweet, and with that 1.18 style flight!

young knoll
#

1.18 also slows the rocket boost down

#

Haven’t really seen how much

waxen plinth
#

From 1.5 to 1.25 multiplier is what I heard

#

So, by 20%

atomic gyro
#

hey there yall, me again

waxen plinth
#

Hi

atomic gyro
#

getting an Access is denied error while trying to access the world folder of my server

waxen plinth
#

Access it how?

#

I know windows is weird about letting you use files that are in use by other programs

atomic gyro
#
try {
  FileReader file = new FileReader(player.getWorld().getWorldFolder());
  player.sendMessage(file.toString());
} catch (FileNotFoundException e) {
  e.printStackTrace();
}```
#

that's the code im using

waxen plinth
#

Can I see the full exception

atomic gyro
#
java.io.FileNotFoundException: .\world (Access is denied)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:211)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:153)
at java.base/java.io.FileReader.<init>(FileReader.java:75)
at me.omaknight.lootTableViewCommands.lootTableView.onCommand(lootTableView.java:53)
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45)
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149)
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.dispatchCommand(CraftServer.java:776)
at net.minecraft.server.network.PlayerConnection.handleCommand(PlayerConnection.java:1931)
at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1770)
at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1751)
at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:46)
at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:1)
at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:30)
at net.minecraft.server.TickTask.run(SourceFile:18)
at net.minecraft.util.thread.IAsyncTaskHandler.executeTask(SourceFile:151)
at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23)
at net.minecraft.util.thread.IAsyncTaskHandler.executeNext(SourceFile:125)
at net.minecraft.server.MinecraftServer.bf(MinecraftServer.java:1148)
at net.minecraft.server.MinecraftServer.executeNext(MinecraftServer.java:1141)
at net.minecraft.util.thread.IAsyncTaskHandler.awaitTasks(SourceFile:134)
at net.minecraft.server.MinecraftServer.sleepForTick(MinecraftServer.java:1125)
at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1054)
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305)
at java.base/java.lang.Thread.run(Thread.java:831)```
waxen plinth
#

Interesting

#

Not sure what would cause that other than windows file handles being weird

atomic gyro
#

i'm gonna try just calling the actual file name and see if that works

#

yeah no it cant find the file

flint ermine
#

Q: how can i mkae a command alias thats "ars help" i have one for "ars" as we have 2 plugins that use /rs just tring to reformat om=nes help output {there is no lang or messages file and the GH for it is 404}

waxen plinth
#

Uh?

#

That's not a very comprehensible question

#

What's the issue?

flint ermine
#

let me reprase,

we have 2 plugins that use /rs as their prefix,

we are tring to redo one of them so we can have /ars
we need to reformat /rs help to display /ars as /rs will not work, sadly the plugins GitHub is 404'ed so i cant just recompile it {would need to as it has no lan or messages.yml}, ive gone in commands.yml however /ars help will not work however using /ars to run advancedredstone:rs $1 $2 works

waxen plinth
#

Oh

#

You can't really just modify the command's help messages without editing their code

#

You'd need to decompile, edit, and recompile it

flint ermine
#

thats why i was wondering if i could override it with /ars

#

would just decompileing the jar work?

waxen plinth
#

Should

#

It's a pain but it should work

#

You'll need to manually sort out any dependencies it has

flint ermine
#

i assume just using 7zip would not work correct?

waxen plinth
#

It would not

#

That would still leave you with compiled source code

#

You need something like procyon or fernflower

flint ermine
#

ill try those, hopefully will be simpler than eclipse

onyx shale
#

Well... you could always take a "sneak peak" at the plugin.yml inside the jar ans change the alias if its defined there

flint ermine
#

i found it, tried to recompile and well, failed horrably

#

its in org.dragonet.remoteredstone > rs > RSCommand.class

waxen plinth
#

Yeah it needs the classpath to compile

flint ermine
#

do you by chance know how id do that in eclipse?

waxen plinth
#

You know what? Just send me the jar, I'll do it

#

You don't even technically need to decompile and recompile

flint ermine
#

i have the decompiled java if you want it, and thats very kind of you

#

should i dm you?

waxen plinth
#

I have no idea if what I'm gonna try will actually work

#

But I wanna try it anyways

eternal oxide
#

what plugin is he working on?

waxen plinth
#

You should be able to do this with Statistics

opaque grove
#

I am creating a plugin that loads three new world: 1 new overworld, 1 new nether world and 1 new end world. But when i enter a portal it takes me to normal world, nether, end. How can i change the world in which the portal will get created (simply link custom nether to custom world). Ive tried with PlayerPortalEvent but I can just change the location the player will be teleported, not the world a portal is created. Ive read, that travelagent has done that but it was removed.

torn oyster
#

bump

#

what lol

#

it wants a short/byte

#

not an int

#

my material is stained clay

#

my int amount is 1

#

and my short/byte is t.getWoolColour()

quaint mantle
#

in the playerTeleport event, why is this making me face directly north east south or west, depending on what's closer instead of making me face the direction i was already facing?

#
event.getTo().setDirection(player.getFacing().getDirection());```
chrome pewter
#

hey i been looking into local Maven repository. And i cant see remapped-obf

#

any help please

frosty tinsel
chrome pewter
#

what the bulidtools flag

#

oh nervermind i do have it install

#

like i do have nms

opal juniper
#

it could just be the ones on North, South, East & West

crude sleet
tender forge
#

?ban @ripe lagoon

undone axleBOT
#

Done. That felt good.

solid cargo
#

Wow someone took action

exotic obsidian
#

hello guys

#

if i want to hide visibility of particles

#

how i can do that?

chrome beacon
#

Intercept the packets

#

I recommend using Protocollib. Note that not all particles can be hidden by the server

cerulean jasper
#

Hi, is it possible to get all regions in WorldGuard API? If anyone has experience with it. Looked through documentation but got confused :c

#

(and preferably do a for loop through them)

#

There's things like

region.contains(BlockVector3.at(20, 0, 30));

But I need to get all 400 regions on server that I have

#

not only at specific location

idle grotto
cerulean jasper
#

Oh thanks.. I was just thinking of that but im way too slow.. 😄

quaint mantle
#

Can u guys help me? It writes me "failed to verify username"
What to do? :C

tacit drift
halcyon mica
#

How would I go about registering default entity attributes for my custom nms entity

exotic obsidian
#

But I mean if a lot of players have particles and I want to hide the particles I just don't want to see it

proud basin
#

you can turn off particles in your game settings

halcyon mica
#

particles can still be forced by the server

quaint mantle
#

Creating an item framework to easily make new items

cerulean jasper
#

Oh no.. my jar file is 1kb and only has my yml file 😦 what am I doing wrong? Intelij IDEA.. 😄

shadow night
#

how do i get the amount of sleeping players?

lost matrix
# shadow night how do i get the amount of sleeping players?
  public long getSleepingPlayerCount() {
    return Bukkit.getOnlinePlayers().stream().filter(LivingEntity::isSleeping).count();
  }

Or

  public long getSleepingPlayerCount() {
    int count = 0;

    for (final Player player : Bukkit.getOnlinePlayers()) {
      if (player.isSleeping()) {
        count++;
      }
    }

    return count;
  }
lavish hemlock
#

The second instantiates less objects ftr.

lost matrix
# exotic obsidian i know

Simple approach to filter a specific packet type for a group of players:

public class ParticleFilter extends PacketAdapter {

  public ParticleFilter(final Plugin plugin) {
    super(plugin, Server.WORLD_PARTICLES);
  }

  private final Set<Player> filteredPlayers = new HashSet<>();

  public void addPlayer(final Player player) {
    this.filteredPlayers.add(player);
  }

  public void removePlayer(final Player player) {
    this.filteredPlayers.remove(player);
  }

  @Override
  public void onPacketSending(final PacketEvent event) {
    if (this.filteredPlayers.contains(event.getPlayer())) {
      event.setCancelled(true);
    }
  }
  
}

(Using ProtocolLib)

#

Just make sure to remove them when they log out.

lavish hemlock
#

damn that's clean
ProtocolLib epic

shadow night
#

why does paper says my plugin is legacy if its not?

lost matrix
shadow night
lost matrix
#

api-version: 1.17

cerulean jasper
#

I think I know the cause but... what am I supposed to do here lol

#

These are random modules registered in my IDE

lost matrix
cerulean jasper
#

Yes. I think I figured it out, I reset maven configuration and restarted, seems to work now

#

Although now .jar is 3.5mb 😄

#

still testing

shadow night
#

how do i do something in bed enter event only when the player is really sleeping

shadow night
#

._.

solid cargo
#

why do i still take dmg after skeleton's death

shadow night
solid cargo
#

so why do i take damage even after my custom boss is dead

lost matrix
solid cargo
#

ahhh

#

do i set it to stop in the skeleton.isDead?

halcyon mica
#

So I can‘t replace a NMS Entity's attributes in the constructor because of my entity because the super contructors rely on it and nullpoint immediately, and I can't modify the default attribute registry anymore because java 16 removed the field modifiers hack

#

So what am I supposed to do now

lost matrix
solid cargo
#

smile, how can i cancel it once ded

#

i wish there was a when method

lost matrix
lost matrix
solid cargo
#

so

#

when boss.isDead

#

is the same as

#

if boss.isDead?

lost matrix
#

I dont...

#

What?

solid cargo
#

no nothing

#

me just fantasizing

halcyon mica
#

And since my entity type is not part of that map, it fails to fetch the attributes and nullpointers during the constructor

#

I have set up a reflection way to replace the attributes with a valid one, but since it nullpointers in the constructor I cannot replace it in time

#

And thanks to Java 16's new reflection handling, replacing the default registry map is effectively impossible

lost matrix
# solid cargo smile, how can i cancel it once ded

One example on a self cancelling task. Although i dont recommend
having a ton of tasks. Just use one single task that maintains a collection of tickables.

    final UUID playerID = player.getUniqueId();

    new BukkitRunnable() {

      @Override
      public void run() {
        final Player onlinePlayer = Bukkit.getPlayer(playerID);
        if (onlinePlayer == null) {
          this.cancel();
        } else {
          onlinePlayer.sendMessage("Hi");
        }
      }

    }.runTaskTimer(plugin, 10, 10);
solid cargo
frosty tinsel
solid cargo
lost matrix
#

By the super constructor

halcyon mica
#

Indeed

#

It is also used to fetch the collision size

lost matrix
#

Ill have to take a look at that...

#

AttributeDefaults. This class looks like bad design.

halcyon mica
#

(Mojmap btw)

lost matrix
halcyon mica
#

Hm

#

I don't think I can do that, because the key is the entity type

#

Which I can't realisticially extend

lost matrix
#

Ah i see...

halcyon mica
#

maybe I can overwrite the entity type after the fact, and pass a valid one as placeholder

lost matrix
#

If that works

solid cargo
#

how can i set an id for a task that isnt in main class

lost matrix
solid cargo
#

how can i get it

lost matrix
#

You get it when scheduling the task

solid cargo
#

but

#

where

#

and how is the id made

lost matrix
#
    int taskId = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, task, 10, 10);
solid cargo
#

replace taskId with int?

lost matrix
#
    final BukkitTask bukkitTask = Bukkit.getScheduler().runTaskTimer(this.plugin, task, 10, 10);
    bukkitTask.cancel();
#

This is more than enough info

solid cargo
#

i see

#

one last question, not really about code

#

do i have to put this in the main class?

halcyon mica
#

Yep, this worked

#

Gotta love nms hacks

#

Entity persistence achieved

halcyon mica
#

When I create a offline player with a uuid, and use getPlayer to get the abstracted player, will it become a valid craftplayer and return true for isOnline when the player comes on?

exotic obsidian
#

hello guys

#

how i can save particales

#

when i do /reload

#
  • Im using database
torn vale
#

I have a Item-Builder and created a FIREWORK_CHARGE, how can I change the color of it?

tacit drift
atomic gyro
#

hey there yall

#

trying to read a file as return it as a string, having a bit of an issue

#
try {
  FileReader file = new FileReader("world/datapacks/Test Datapack/data/testpack/loot_tables/entities/custom.json");
  while(file.read() != -1) {
  testString += file.read();
    }
file.close();
player.sendMessage(testString);
} catch (FileNotFoundException e) {
  e.printStackTrace();
} catch (IOException e) {
  e.printStackTrace();
}```
#

this is returning a large string of numbers, which i guess is to be expected of .read(). what else should I be using?

proud basin
#

why do you have 2 catches?

atomic gyro
#

auto generated, not necessarily sure if i need both though

visual tide
quasi flint
#

can someone explain to me, why this isNearGround method always returns false?

proud basin
#

? @quasi flint

#

oh its there now

quasi flint
#

when i pass in the location, wether or not i actually stand on the block it always returns false

hasty prawn
#

You're adding 0.5

#

You should subtract if you want to look down

quasi flint
#

woops

upper osprey
#

How to show model animation per different player

hasty prawn
#

You'd have to use resource packs for the model and then probably send a packet to each player for whatever you wanted to show them

proud basin
#

or make a mod

hasty prawn
#

Yeah or do that

shadow night
#

how do i enable the PlayerBedEnterEvent only when the player really sleeps (not just clicks)

quasi flint
#

Can someone for the sanity of my soul say, why this spwes out air as the block

#

if(location.clone().subtract(location.getX(), 0.501, location.getZ()).getBlock().getType() != Material.AIR) {

        System.out.println(location.clone().getBlock().getType());
        return true;
    }
#

it is not supposed to do such a thing

hasty prawn
#

You're not subtracting anything from the printed value for that matter

quasi flint
#

not?

#

i only want the block 0.501 below him

#

and i do that

#

or am i completly dumb?

hasty prawn
#

Yeah the if check is probably fine, youre just printing a different block.

quasi flint
#

now its workin

#

removed the clone()

#

well that was not good XD

#

now its printing me oak_leaves when jumping on stone

hasty prawn
#

Don't subtract location.getX and location.getZ

#

That makes it always 0, Y, 0 instead of you location

quasi flint
#

like dis

#

if(location.clone().subtract(0, 0.501,0).getBlock().getType() != Material.AIR) {

hasty prawn
#

Yes

quasi flint
#

good thing

#

now lets see if it works

#

wow this escallated

#

when tryin to jump now i get flagged to death

hasty prawn
#

What does that mean

quasi flint
#

its detecting me as an nofall hacker woops

#

but i know how to fix that

#

probably

#

Infact no

#

I could not fix it

quaint mantle
#

learn how anticheats work plss

quasi flint
#

well thats what i am trying to do

#

thanks anyways D:<

tardy delta
#

is new Example().doSomething() the same as Example e = new Example; e.doSomething() in a private method?

upper vale
#

Yes

#

well the second one needs a () but yeah

tardy delta
#

ok

upper vale
#

The 2nd one you just can’t access the same instance again

#

Becuase it’s not declared a variable

tardy delta
#

yea i know

hasty prawn
#

Just remember if doSomething() is private you can't call it outside of the Example class.

hasty prawn
hasty prawn
#

You said private so I was just making sure you knew hahahehe

tardy delta
#

yea inside a private method i make the object

hasty prawn
#

Ah, yeah that doesn't really matter as long as Example and doSomething can be accessed from that method.

#

It's modifier doesn't matter for calling other methodsbounce

tardy delta
#

whats the point of Player#chat()?

hasty prawn
#

My only guess would be is that is says something as them

dry pike
#

@ VectorExperts
Looking for some vector help. I'm trying to understand the axis' a bit better. I'm using 2 locations and creating a vector between them, I then normalize because I'm only interested in the direction of the vector. Now I want to turn the vector 90 to the left, now the 2 locations initially may not be at the same height level so when rotating the vector the vector may increase/decrease in height as it is rotated on the horizontal axis... This is my understanding. Im looking to modify the vector so the arrow will be parrallel to the ground, I believe this would be pitch? Therefore setting the vectors pitch to 0 would make the base of the vector and the end of the vector at the same height correct? Then I would be able to rotate the vector to the left and right with the vectors height staying the same at the base as well as the end of the vector. My last question is to rotate a vector to left or right I would rotate around the y axis correct? Therefore rotating the Y axis 90 degrees would turn to the right and -90 would turn to the left?

quaint mantle
#

0 in y = no modification to Y = parallel to ground

#

does it answer your question or did I read too quickly ?

dry pike
#

It answers getting the vector parralel to the ground. Thank you. Now in order to rotate the vector left/right i would rotate around the y axis correct?

quaint mantle
#

yeah indead. if you want to only change the x/z parameters the rotation has to be around the Y axis

dry pike
#

Okay Ill give it a go thanks!

quaint mantle
#

good luck !

shadow night
#

how do i make the command permission none, so everyone can use it?

dry pike
dry pike
#

Is there a simple way to spawn particles in game to help visualize vectors

quaint mantle
#

Hi guys. Strange bug :
I have to use the unusual method to register my listener:

Bukkit.getPluginManager().registerEvent(
   this.eventClass,
   this.listener,
   EventPriority.LOW,
   (listener1, previousEvent) -> {
      //...
   },
   plugin,
   false);

In the callback I use some instance able to transform an event A (let's say EntityDamageByEntityEvent) into a custom event B (let's say ItemLeftClickEvent).
since this class is generic, it contains a cast at some point:

eventClass.cast(event);

This cast throws an exception :
java.lang.ClassCastException: Cannot cast org.bukkit.event.entity.EntityDamageEvent to org.bukkit.event.entity.EntityDamageByEntityEvent

I used debugger to verify that "this.eventClass" is indeed a EntityDamageByEntityEvent (and not a EntityDamageEvent) when calling PluginManager#registerEvent method and I did not see any issue there.

How is it possible that my event handler retrieve a EntityDamageEvent and not an EntityDamageByEntityEvent ?

quaint mantle
dry pike
#

ok

quaint mantle
#

But I did it in LasersEnigma

#

I will give you a link. Just a sec

dry pike
#

Awesome

quaint mantle
#

you will have to do it yourself ^^

dry pike
#

Okay no worries Ill take a look and maybe get some ideas

keen lake
#

What are these random teams? Whenever I try to access them it says they do not exist.

#

I am trying to find out because I want to make nametags invisible but all available teams have this option on never and I can still see them.

quaint mantle
#

Is it a spigot issue ?

#

Or did I do something wrong :/

tardy delta
#

for some reason my resourcepack doesnt show up in the list

golden turret
#

use the Listener

#

Listener >>>>>> Bukkit.getPluginManager().registerEvent();

quaint mantle
#

I can't use a simple listener in my case.

#

I don't do this for fun... just for advanced modular features ^^

quaint mantle
golden turret
shadow night
#

how do i get server tps?

hasty prawn
#

./tps

golden turret
hasty prawn
#

Oh

golden turret
#

MinecraftServer#recentTicksPerSecond i think

shadow night
quaint mantle
# golden turret why

Because I dynamically build and register event listeners according to modifiable data saved in json.

golden turret
#

i worked with that these days

quaint mantle
#

But that does not change the fact that I should receive a EntityDamageByEntityEvent and not an EntityDamageEvent (that, in addition, can't be casted to an EntityDamageByEntityEvent).

worthy knoll
#

Why is it skipping a line?

#

Didn't happen before... before I don't know what

golden turret
quaint mantle
#

I think it's a spigot bug related to the lact of the static HandlerList within this particular event (that may explain why I retrieve its parent).

golden turret
golden turret
#

and call sublisteners

quaint mantle
shadow night
golden turret
golden turret
#

actually is from org.bukkit.craftbukkit

shadow night
golden turret
#

?buildtools

#

fuk]

shadow night
#

/buildtools

quaint mantle
worthy knoll
#

anyone?

quaint mantle
#

That's why I prefer registerEvent ^^

golden turret
#

¯_(ツ)_/¯

quaint mantle
#

Anyone know of a plugin like this to display custom titles under the players names

#

I think there is a difference. And I think that exactly because of the issue I found.
If you use the usual Listener you will only retrieve EntityDamageByEntityEvent because a cast check is probably done beforehand.
If you use registerEvent you may receive a EntityDamageEvent because this cast check is not done and because EntityDamageByEntityEvent does not have its own HandlerList (I suppose that's the reason of this spigot api bug).

worthy knoll
#

search for name tags plugin

quaint mantle
#

I will just add the check ^^

worthy knoll
#

or something

#

on GOOGLE

golden turret
quaint mantle
#

pretty sure plugins fall under development lol, thank you Wizarldy!

golden turret
hasty prawn
#

This channel is for developing plugins, #help-server is generally for finding them.

worthy knoll
#

SO

#

anyone have an idea about my small issue

hasty prawn
#

What was it

worthy knoll
#

(not very important but still very annoying)

worthy knoll
#

the thing is

#

that I kinda manipulated my jdks

#

I mean

golden turret
#

maybe there is an \n?

worthy knoll
#

nah...

hasty prawn
#

Send the code where you're sending that. You probably have a blank sout or a \n somewhere.

worthy knoll
#

I'll show you

golden turret
#

or it is because of the console width

#

check if you have useless spaces at the end

worthy knoll
#

well

#
ChatColor.DARK_GRAY + "[" + ChatColor.GRAY + "CastleSiege" + ChatColor.DARK_GRAY + "] " + ChatColor.RESET```
#

there ya go

#

happens on another plugin as well

#

an idea ?

hasty prawn
#

Does it do it if you remove ChatColor.RESET

worthy knoll
#

well

shadow night
#

how do i get server uptime?

worthy knoll
#

it didn't happen on my online server

#

hosted somewhere in france

solid cargo
#

how can i check if the EntityType im hitting is a player

worthy knoll
solid cargo
#

i want to send a message to the damager to see how much hp the damaged player has

worthy knoll
#

well, already answered ?

solid cargo
#

yeah but how do i get the targets health

worthy knoll
#

if( event.getDamagedEntity instanceof Player)

solid cargo
#

ahh

#

ok

worthy knoll
#

I mean, something like that

#

I don't know all ways of doing it

#

by the way

#

to get back on my issue

#

well

#

removed all jdk

#

and reinstall jdk 12 and the "runtime environment" thing

#

To be honest

#

java versions compatibility sucks

golden turret
#

which spigot version are you running

worthy knoll
#

1.8.8

#

for pvp

golden turret
#

use jdk 8

worthy knoll
#

well if I do

#

I can't run other servers

#

but okay

#

why not

golden turret
#

welcome to windows

worthy knoll
#

WHY DO YOU NEED TO LOG IN

golden turret
#

just specify the full path to the specific jdk in the other servers

#

use adoptopenjdk

hasty prawn
#

You can tell Windows to use a specific version of Java for a specific task.

worthy knoll
#

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

worthy knoll
#

understandable but

#

somehow my pc just doesn't want to act the way this guy's ants

#

xznts

#

wanrs

#

wanrs

#

wants

#

god damn

golden turret
#

AdoptOpenJDK provides prebuilt OpenJDK binaries from a fully open source set of build scripts and infrastructure. Supported platforms include Linux, macOS, Windows, ARM, Solaris, and AIX.

#

hope i helped

lavish hemlock
#

just build OpenJDK yourself
absolute gamer moment

worthy knoll
#

WHY DID

#

oh aaa

#

THANKS

#

I SAID

#

WINDOWS LAUNCH THIS SLDKFJSDLKJF MESSAGE

#

now my wifif keeps disconnecting

#

for 2 months now

#

anyway

#

U'kk cgecj tgat

#

I'll check that

#

hmmf

#

guess NOW I can code peacefully

#

thanksssssssssssssssssssss

solid cargo
#

I will leave it like this!

worthy knoll
#

you can use Math#round

#

or google

ivory sleet
#

str.format("%.1f",num); maybe

#

if I’m correct rounds to 1 decimal

solid cargo
#

math.round helped

fickle helm
#

is there a way to determine if an entity is a passenger? From what I've found you can only see if a entity has passengers

ivory sleet
#

hmm

#

there's not rly a method for that

solid cargo
#

how can i make it so that when i hit a mob, it dings for me

stone sinew
solid cargo
#

with a bow

fickle helm
#

in my case it would be for non player entities

ivory sleet
#

oh lol yapperyapss ye

lost matrix
stone sinew
solid cargo
fickle helm
#

more specifically jockey mobs like skeletons, zombies, etc

ivory sleet
#

All entities extend Entity btw

#

so would work for u perfectly fine 🙂

fickle helm
#

oh you're saying .isInsideVehicle is part of the Entity interface?

lost matrix
solid cargo
#

oh makes sense thanks!

quaint mantle
#

Anyone have any tutorials or starter points for making a plugin framework?

quaint mantle
#

E.g. framework for custom items, mobs etc.

solid cargo
#

some shiz wrong?

#

it said Line 16 is wrong which is:
ProjectileSource source = ( (Projectile) event.getEntity() ).getShooter();

stone sinew
#
public void onDamage(EntityDamageByEntityEvent event) {
    if(!(event.getDamager() instanceof Projectile)) return;

    // world.playSound()
}
lyric grove
#

How would i run a task async but get the variable outside?

#

as i cant run the world async

solid cargo
#

why is world red for me, it doesnt recommend me to import stuff also

unreal quartz
solid cargo
#

ah

stone sinew
#

CompleteableFuture

quaint mantle
#

hi

#

how can I prohibit the use of an experience bubble with a certain name?

quaint mantle
#

thanks

lyric grove
eternal oxide
#

Yeah, looks like thats only for dropped Items

quaint mantle
#

I need to prohibit the use of an experience bubble with the name

stone sinew
#

What do you mean experience bubble?

solid cargo
#

yo dumb question

#

but i cant seem to be able to define the world

#

ik that the first half is World world

stone sinew
lost matrix
#

This doesnt look like it needs to be done async. Im almost certain that spawning a new thread has
practically the same overhead on the main thread.

solid cargo
#

wait dont answer yet

solid cargo
#

i put it in the if statement

#

oh

#

lmfao

#

i fixed it

#

just need to move my 2 brain cells

stone sinew
#

👍

lyric grove
lost matrix
#

Not much. But if you remove the airdrop later anyways then you can just add a plugin ticket to the chunk
and keep the chunk loaded as long as the airdrop exists. This way the chunk wont constantly unload.

lyric grove
#

oh thanks

quaint mantle
lost matrix
# quaint mantle exp bottle

What exactly do you want to prevent? Throwing the bottle, exp spawning when the bottle pops
or picking up the experience afterwards.

quaint mantle
#

Throwing the bottle

solid cargo
#

this still doesnt work smh. I have tried to get a resolver, which tells what source the arrow comes from, still no ding on Mob hit

eternal oxide
#

ah thats completely different

lost matrix
golden turret
#

what is the probleme here

solid cargo
#

there are many problems

golden turret
#

list them

solid cargo
#

well, one

solid cargo
#

i want it so that when i hit a mob with arrow, it dings

#

or lets take it simply, play a sound

quaint mantle
golden turret
#

@solid cargo

if (event.getDamager() instanceof Projectile) {
  //dont forget to get the projectile sender
}```
crimson terrace
#

That also works if a shulker hits u tho

golden turret
solid cargo
golden turret
#

yes

#

check if the source is a player

#

if yes

#

gg

#

if not

#

sad

lost matrix
#
  @EventHandler
  public void onHit(EntityDamageByEntityEvent event) {
    Entity attacker = event.getDamager();
    
    // If attacker is not a Projectile then do nothing
    if (!(attacker instanceof Projectile)) {
      return;
    }

    Projectile projectile = (Projectile) attacker;
    ProjectileSource source = projectile.getShooter();

    // If ProjectileSource is not a Player then do nothing
    if (!(source instanceof Player)) {
      return;
    }

    Player shooter = (Player) source;
  }
solid cargo
#

i hate that in java if ur code even makes sense, it might not run

golden turret
#

no

lost matrix
golden turret
#

yes

lost matrix
#

If code misbehaves then its 99.9% the fault of whom write it.

solid cargo
#

ok that was a bold claim

manic crater
#

Idk how to fix this, so kinda wanna ask for help here so im gonna ask i hope im not bothering anyone's help session,

So im having this issue where when i click in this menu ive created it doesnt run the command for one of the items but for the other it does. And both of them have commands in them.

So i am wondering if someone can look into it and help me find out the problem.

golden turret
#

i wont say the solution

#

but iwilll say something that maybe can help

manic crater
#

will you at least tell me the line #?

#

alright cool

golden turret
#

do a simple item callback system

manic crater
lost matrix
golden turret
#

maybe he simply dont know about that

lost matrix
manic crater
#

yes for rn

#

its gonna be split up when done

quaint mantle
#

Thats horrible

lost matrix
quaint mantle
#

do it before and save yourself the hassle

manic crater
#

eh, well ill do it after this gets resolved then

golden turret
#

would save a lot of time

lost matrix
#
  1. Refactor all your single letter variables.
  2. Dont identify the click action by the ItemStack that was clicked but the slotID.
    Much more reliable for now.
    @manic crater
golden turret
#

yes

manic crater
golden turret
#

and make a simply system for to make an inventory based in a string

#

like

#

#########

1

#########

the # is black glass
the 1 is your item

lost matrix
golden turret
#

much faster too

manic crater
#

alright hold up let me quickly make an example and see if im on the right track.

shadow night
manic crater
#

bc cmd blocks can lag out ur server if multiple ppl open the menu.

shadow night
lost matrix
manic crater
#

wdym im using commands...

lost matrix
shadow night
golden turret
lost matrix
golden turret
#

sad

lost matrix
#

Then force push to master

golden turret
#

:C

lost matrix
#

Oh... gradle

#

hm

manic crater
#

Anyway sorry for long time trying to figure out something but

#

is this right?

if(e.getSlot() == 1)

#

agh i need to figure out better code block stuff i stg. xD

#

like do u think that would work by any chance or nah

lost matrix
manic crater
#

bro..

#

i used to use 1.8 now i dont but

#

What the hell

#

just use 1.8......

golden turret
manic crater
#

i mean 1.17

#

sdjghal

lost matrix
manic crater
golden turret
#

at least for items

manic crater
manic crater
golden turret
manic crater
#

ah ok

#

but still why dont u use 1.17???

#

1.17 has better stable support + its not broken like 1.8

golden turret
#

say it to 1.8 players

#

not for developers

manic crater
#

ppl only play on 1.8 to play on hypixel without lag back issues and bugs.

#
  • hypixel's developers develop plugins in 1.17....
manic crater
#

and i will be splitting up my entire plugin now so i dont have to hear like 500000 wtf's from ppl lmao

lost matrix
#

Well. 1.8 needs java 8 and i dont keep ancient software on my pc. Not gonna happen then.

golden turret
manic crater
#

never. never type that EVER again like that.

#

it looks so spam like and takes up literally 1000000% of this chat.

manic crater
#

Issue: Same issue still ocuring ;-;

golden turret
#

well, i want that wlib have compatiblity with all 1.8+ versions and these versions are very used

#

mainly in brazil

lost matrix
#

1.8 is like 8% or something

manic crater
#

literally 99% of users are on 1.17

#

prove me wrong.

golden turret
#

if a normal brazillian tries to run 1.17 his pc will explode

manic crater
lost matrix
manic crater
# lost matrix

i mean at least a lot of ppl are using like some what NEAR the latest versions.

golden turret
eternal oxide
#

It is, but its the most accurate metric we have

golden turret
#

for servers

#

i would say that if a community metric about minecraft version happen, 1.8 will have more than 8%

eternal oxide
#

I doubt it

golden turret
#

wont say that this is the most popular but relevant

manic crater
#

dude

#

literally

#

like

shadow tide
#

Would this work for a fireball?

velocity.multiply(2);
entity.setVelocity(velocity);```
manic crater
#

the 8% is hypixel ( bc they have like what 10k Servers. ) then is mineplex , the hive etc.

eternal oxide
#

hypixel is not on 1.8

manic crater
#

they are

manic crater
#

the only thing they dont have thats 1.8 is the Hypixel SMP features.

golden turret
eternal oxide
#

They are not. I'm told they are on 1.12 custom for pretty much everything

manic crater
golden turret
stone sinew
shadow tide
#

k, I was just asking because in minecraft the velocity is in x, y, and z, so I didn't know if I needed a single axis thing

manic crater
golden turret
shadow tide
#

it works fine for tnt

#

should I lower it for a fireball

golden turret
#

try and see

manic crater
#
if(e.getSlot() == 11) {
                p.performCommand("server skyblock");
                p.sendMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("sending-to-skyblock")));
                return;
            }
            
            if(e.getSlot() == 15) {
                p.performCommand("server Clicker");
                p.sendMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("sending-to-clicker")));
                return;
            }

For some reasonly only the SkyBlock one works and yet the clicker one doesnt. i dont understand the logic....

golden turret
#

velocity is a pain

shadow tide
#

k

golden turret
#

hope i helped

manic crater
#

like

golden turret
#

use rawSlot then

manic crater
#

it sends the msg

#

just doesnt execute the cmd

shadow tide
#

and I swear every time I export my plugin it says it cant find the main so I have to click f5 like ten times

manic crater
eternal oxide
# shadow tide k

getDirection() returns a unit vector which has a length of 1. That corresponds to 1 block per tick. Multiply for yoru desired speed

golden turret
#

p.sendMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("sending-to-clicker"))); runs? @manic crater

manic crater
#

yes it is, i have used it many times.

shadow tide
#

so like a sudo thing but for an armor stand? I got no clue

manic crater
#

getting an entity to perform a command.... well for starters i thought u said " Is it even possible to do this. "

And idk, but what i do know is, Citizens is all entity based, so decompile it and give it a look through.

eternal oxide
#

Entities don;t perform commands

manic crater
#

Yes they do, Citizens specifically has it execute a command if u add it to it.

quaint mantle
#

Entity#performCommand afaik

golden turret
#

no

eternal oxide
#

Only Players can perform commands

golden turret
manic crater
#

yeah but citizens, its entity based. not player based.

golden turret
#

nothing

golden turret
manic crater
#

yeah, but its still linked with in the entity.

#

look the only way that we will know what does what is if we asked the owner of citizens. 😆

eternal oxide
#

any code can issue a console command but its better to use available APIs if you can

manic crater
#

if(e.getSlot() == 11) {
                p.performCommand("server skyblock");
                p.sendMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("sending-to-skyblock")));
                return;
            }
            
            if(e.getSlot() == 15) {
                p.performCommand("server Clicker");
                p.sendMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("sending-to-clicker")));
                return;
            }

Back to this issue pls???

#

Cuz for some reason i cant get it to make the user execute the cmd, but yet for skyblock it runs fine.

#

and clicker it doesnt run the cmd or any other code besides the msg.

shadow tide
#

how do you make the explosion size larger, in minecraft its an nbt tag. explosionPower:1b

#

(for a fireball)

manic furnace
#

How can i put a hyperlink in the desription of a resource?

manic crater
#

wtf is a hyperlink

opal juniper
#

wrong chat

shadow tide
#

a link, you obviously don't use HTML

eternal oxide
opal juniper
manic furnace
#

Yes

quaint mantle
#

My bad, it's Server#dispatchCommand, you pass the entity as the commandsender

opal juniper
#

uh idk if you can

manic crater
#

Still doesnt work @eternal oxide :/

manic crater
eternal oxide
eternal oxide
#

or the server is offline

opal juniper
#

there are methods there

shadow tide
#

???

manic crater
shadow tide
opal juniper
#

oh wait mb

#

you said fireball

manic crater
#

wait.. i wanna see something rq.......

shadow tide
#

yeah

manic crater
shadow tide
#

and I don't know what you mean by "Cast to"

manic crater
#

like i literally sent u the LINK for NBT Tags for FIREBALLS

opal juniper
#

i mean if you get the entity object

#

then you can cast it to Fireball

shadow tide
#

ahh

opal juniper
#

Fireball#setYield()

shadow tide
#

so for a fireball how do I make the explosion larger or even better set NBT Tags

opal juniper
shadow tide
#

umm, is that for the Spigot API

#

?

opal juniper
#

yea?

shadow tide
#

idk

#

people are telling me about other things

#

and entity.setYield isn't a value

opal juniper
#

NBT shit is stupid and you should avoid it if there are better ways

shadow tide
#

k

opal juniper
shadow tide
#

then idk what you mean

opal juniper
#

Its not a method of Entity

shadow tide
#

what is it'

opal juniper
#

its a method of Fireball

#

which extends Projectile which in turn extends Entity

#

hmm

#

actually

#

are you spawning the fireballs in your plugin?

shadow tide
#

yes

opal juniper
#

Well World#spawnEntity returns the entity object

shadow tide
#
                    Entity entity = player.getWorld().spawnEntity(player.getLocation(), EntityType.FIREBALL);
                    Vector velocity = player.getEyeLocation().getDirection();
                    velocity.multiply(2);
                    entity.setVelocity(velocity);```
opal juniper
#

yeah ok

#

so cast the entity to Fireball

eternal oxide
#

((Fireball) entity).setYield(x)

opal juniper
#

and then you will have access to the setYield

#

what he said lol

shadow tide
#

I have no idea what you are talking about, sorry I just started developing plugins so can you just tell me the line of code I need to write and if you want, explain it

opal juniper
#

ElgarL did...

shadow tide
#

huh

#

where do I write that then

opal juniper
#

uh

eternal oxide
#

We'll let you work out that part

opal juniper
#

(it needs to go in a method)

shadow tide
#

in an entity. method? don't tell me the answer but give me hints

eternal oxide
#

Which entity do you think it would affect?

shadow tide
#

this one Entity entity = player.getWorld().spawnEntity(player.getLocation(), EntityType.FIREBALL);

eternal oxide
#

Looks promising

shadow tide
#

soo Entity entity = player.getWorld().spawnEntity(player.getLocation(), EntityType.FIREBALL, ((Fireball) entity).setYield(x));?

severe marsh
#

Anyone has any good conversation API tutorials which are easy to understand?

eternal oxide
#

no

shadow tide
#

uhh

eternal oxide
#

put it on its own line

shadow tide
#

err

#

I have no clue

eternal oxide
#

and replace x with whatever size you want

shadow tide
#

ik

eternal oxide
#
Entity entity = player.getWorld().spawnEntity(player.getLocation(), EntityType.FIREBALL);
((Fireball) entity).setYield(10);```
tepid cargo
#

Excuse me, is there a way to have autocomplete options for bungee commands i add?

quaint mantle
#

I'm trying to check if a player clicks a GUI,
Did some digging and ended up writing this. It should work,
But it constantly thinks i'm clicking the default player inventory
What can i do, is there any other way to check if a GUI is clicked instead of player inventory?

package com.plugin.TabCompleters.Utils;

import com.plugin.Main;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;

public class GUIUtils implements InventoryHolder {

    private Main main;
    private Player player;
    private Inventory GUI;

    public GUIUtils (Player player) {
        this.player = player;
        this.GUI = Bukkit.createInventory(player, 36, ChatColor.AQUA + "Odyssey GUI");
    }

    public void setGui() {
        this.player.openInventory(GUI);
    }

    @Override
    public Inventory getInventory() {
        return this.GUI;
    }

}
    @EventHandler
    public void onInventoryClick(InventoryClickEvent event) {
        Player player = (Player) event.getWhoClicked();
        GUIUtils guiUtils = new GUIUtils(player);

        if (!(event.getInventory().equals(guiUtils.getInventory()))) {
            player.sendMessage(ChatColor.GREEN + "Clicked GUI");
        } else {
            player.sendMessage(ChatColor.RED + "Clicked player inventory");
        }

    }
shadow tide
#

whaat?

#

ok

#

but that doesn't make any sense to me

eternal oxide
shadow tide
#

so explain

eternal oxide
#

What doesn;t make sense about it?

shadow tide
#

that a new line starts with (

#

I thought it always had to be a method

eternal oxide
#

when you spawn an Entity you are returned the Entity you spawned, but not as the type you asked for. Just a generic Entity

opal juniper
eternal oxide
#

So entity only behaves as a generic Entity. If you want to access the Fireball methods, you have to turn it into a Fireball

shadow tide
opal juniper
#

why can a line not start with a (

eternal oxide
#

You need to learn about java type casting

opal juniper
#

yep

shadow tide
#

WHAT IS THAT

#

my brain

eternal oxide
#

?learnjava

undone axleBOT
opal juniper
#

Casting is like changing the data type of a variable

shadow tide
eternal oxide
#

look at the second example

#

int myInt = (int) myDouble; // Manual casting: double to int

opal juniper
eternal oxide
#

that is casting a double to an int

shadow tide
#

ok

eternal oxide
#

see the (int)? That is a type cast

#

so casting your entity object to a Fireball

shadow tide
#

and ((Fireball) entity).setYield(10); is a type cast?

opal juniper
#

Yep

shadow tide
#

got it

eternal oxide
#

teh (...) are simply surrounding elements to control what order things happen

#

So first it casts the entity object into a Fireball, then you have access to teh fireball methods for setYield

shadow tide
#

ctrl + s, F5x20, export

torn vale
opal juniper
#

define "it not save the locations"

#

what doesn't work

#

also - you can just call Location#serialize()

#

and then Location.deserialise

torn vale
#

If I type /setspawn the config.yml doesn't get updatet. So it still looks like this after sending the command:

spawnX:
spawnY:
spawnZ:
spawnYaw:
spawnPitch:```
golden turret
#

you need to save the config

torn vale
#
                            LobbySystem.getPlugin(LobbySystem.class).getConfig().save("plugin/LobbySystem/config.yml");
                        } catch (IOException e) {
                            e.printStackTrace();```
Doesn't this save the config?
shadow tide
#

quick question how do I make a command only available for ops

#

I need an answer fast pls

eternal oxide
#

set it to ops in the plugin.yml

shadow tide
#

how

#

I only have 5 mins pls

eternal oxide
ivory sleet
#

?plugin-yml also works 😄

undone axleBOT
eternal oxide
#

eww what an ugly command

ivory sleet
eternal oxide
#

I guess it might make it memorable

shadow tide
#

alright I get the permission part in YML but what is the op permission? like minecraft.op or minecraft.operator

#

idk what it is

eternal oxide
#

set default:op

shadow tide
#

ahh

eternal oxide
#

if you want to command to only ever be available to ops, just don;t set a permission nor a default

shadow tide
#

?

#

I didn't

quaint mantle
#

that is the most ugly emoji i've ever seen

ivory sleet
#

lmao

#

first thing coming up when typing :sad

ruby dove
#

what happens if p.closeInventory() is called when the inventory is already closed?

hasty prawn
#

Try it and see

unreal quartz
#

your server explodes and the universe ends

ruby dove
#

was just about to xd i've been having an issue with it but im gonna try now

austere cove
#

yo does any of you know how mc's NbtAccounter works?

#

the values passed to it don't make sense to me

#

e.g. for an EndTag

#

doesn't store any data and the tag id is stored in a byte (=8bits) so I don't understand where the 64 bits is coming from

opaque grove
#

This code snippet only outputs something for mobs except for the ender dragon, why?

@EventHandler
    public void onEnderDragonDeath(EntityDeathEvent e) {
        Bukkit.broadcastMessage(String.valueOf(e.getEntity()));
        if (e.getEntity() instanceof EnderDragon) {
            System.out.println("test");
        }
    }
ruby dove
#

how do I check if the player has an open inventory? such as a chest or a GUI?

#

is it getOpenInventory or getInventory?

opal juniper
#

getOpenInventory

#

and i believe it is nullable

ruby dove
#

yeah

#

thx

shadow tide
#

is there an ItemMeta thing for damage

#

@opal juniper

opal juniper
#

?jd

opal juniper
#

rtfm

shadow tide
#

k

ruby dove
#

hello it's saying title doesnt match even on the onMove event, although it's only implemented in the onClose event and the title also matches so why is it displaying this??

  @EventHandler
    public void onClose(InventoryCloseEvent e) {
        Player p = (Player) e.getPlayer();
        
        if(FreezeExecutor.frozen.contains(p.getName())) {
            if(p.getOpenInventory().getTitle().equalsIgnoreCase("YOU HAVE BEEN FROZEN")) {
                FreezeMenu menu = new FreezeMenu(p);
                p.openInventory(menu.getInv());    
            }
            else {
                Chat.INFO.send(p, "title doesnt match");
            }
        }
    }

      @EventHandler
      public void onPlayerMove(PlayerMoveEvent e) {
        Player p = e.getPlayer();
        if (FreezeExecutor.frozen.contains(p.getName())) {
          e.setTo(e.getFrom());
          
          FreezeMenu menu = new FreezeMenu(p);
          
          p.openInventory(menu.getInv());
          Chat.FAIL.send(p, "You can't move while frozen.");
        } 
      }
shadow tide
# opal juniper rtfm

I did and I usually like documentations but spigot's is messy and that's why I resort to asking discord

ruby dove
#

what is itemmeta thing for damage 🤨

shadow tide
#

I want to change the damage of my item

#

@ruby dove

shadow tide
#

this throws an error meta.addAttributeModifier(GENERIC_ATTACK_DAMAGE, 1)

eternal oxide
#

and

#

You have told me nothing I can work with

shadow tide
#

I want to change the attribute GENERIC_ATTACK_DAMAGE

#

how do I do that

eternal oxide
#

Show me the error and I will teach you how to read it

young knoll
#

I mean that isn’t the format for that method

eternal oxide
#

I know the error already

#

but you need to learn how to read

shadow tide
#

it didn't actually throw an error. its just underlined red. I need to know the format for that method

#

I know how to read errors

eternal oxide
#

underlined in read = method does not exist

#

Look at teh method definition in teh javadoc

ruby dove
#

hello

shadow tide
#

GENERIC_ATTACK_DAMAGE was underlined in red. so its the wrong thing to put in the method

eternal oxide
#

the 1 is wrong

#

read the javadoc, it tells you the exact args the method requires

shadow tide
#

GENERIC_ATTACK_DAMAGE, 1, AttributeModifier.Operation I don't know what that last one means

eternal oxide
#

You are not reading the javadoc.

#

the method takes TWO arguments

shadow tide
#

I'm reading the spigot documentation

eternal oxide
#

read teh link I gave you

#
addAttributeModifier
boolean addAttributeModifier​(@NotNull Attribute attribute, @NotNull AttributeModifier modifier)

Add an Attribute and it's Modifier. AttributeModifiers```
shadow tide
#

I read that I'm talking about AttributeModifier

#

not addAttributeModifier

eternal oxide
#

ok, new AttributeModifier(...)

shadow tide
#

Listen, this documentation is super out of my comfort zone

eternal oxide
#

Yes, you need to learn more java to be comfortable

#

teh documentation is really good, once you know java

shadow tide
#

I guess I'm just used to w3schools and python's documentation

eternal oxide
#

This documentation is standard for all Java

shadow tide
#

ok

eternal oxide
#

you need to provide the modifier

#

AttributeModifier.Operation.ADD_NUMBER or any of the three

shadow tide
#

??? listen I'M SORRY FOR NOT KNOWING MORE JAVA

#

but I DON'T UNDERSTAND

eternal oxide
#

Without writing it for you (which you will learn nothing) I'm not sure I can dumb it down further.

#

You understand what a constructor is?

shadow tide
#

yes

#

I think

#

no

eternal oxide
winged anvil
#

elgar you know anything about plugin messaging ?

eternal oxide
#

when you use new Object you are creating an instance of the object, using its constructor

shadow tide
#
Description
AttributeModifier​(String name, double amount, AttributeModifier.Operation operation)
 
AttributeModifier​(UUID uuid, String name, double amount, AttributeModifier.Operation operation)
 
AttributeModifier​(UUID uuid, String name, double amount, AttributeModifier.Operation operation, EquipmentSlot slot)
 ``` this?
eternal oxide
#

yes

#

each of those is a constructor. you can use any of them

shadow tide
#

ok

eternal oxide
#

it tells you what you have to provide as arguments to create a new object

shadow tide
#

ok

#

lets make a thread so we don't bog up this channel

eternal oxide
#

so if you were using the top one, String, double, AttributeModifier.Operation

shadow tide
#

ElgarL teaches Cj stuff

ruby dove
#

hello it's saying title doesnt match even on the onMove event, although it's only implemented in the onClose event and the title also matches so why is it displaying this??

  @EventHandler
    public void onClose(InventoryCloseEvent e) {
        Player p = (Player) e.getPlayer();
        
        if(FreezeExecutor.frozen.contains(p.getName())) {
            if(p.getOpenInventory().getTitle().equalsIgnoreCase("YOU HAVE BEEN FROZEN")) {
                FreezeMenu menu = new FreezeMenu(p);
                p.openInventory(menu.getInv());    
            }
            else {
                Chat.INFO.send(p, "title doesnt match");
            }
        }
    }

      @EventHandler
      public void onPlayerMove(PlayerMoveEvent e) {
        Player p = e.getPlayer();
        if (FreezeExecutor.frozen.contains(p.getName())) {
          e.setTo(e.getFrom());
          
          FreezeMenu menu = new FreezeMenu(p);
          
          p.openInventory(menu.getInv());
          Chat.FAIL.send(p, "You can't move while frozen.");
        } 
      }
unkempt peak
lost matrix
ruby dove
#

ok cause I want to open the inventory again

#

when they close it

lost matrix
ruby dove
#

its a collection

lost matrix
ruby dove
#

string

lost matrix
ruby dove
#

oh sorry

#

let me check

#

o nvm it's an arraylist

lost matrix
#
  1. Dont compare players by their name
  2. Dont use lists if you call contains rly often
#

You should use a
private final Set<UUID>
instead

ruby dove
#

ok i will change it but how can I open the inventory after they closed it?

lost matrix
#

But you dont have to check the inventory name.
Just check if they are frozen.

young knoll
#

It’s not cancellable

ruby dove
#

it doesn't have a setcancelled

#

yea

lost matrix
young knoll
#

Nope

lost matrix
#

Ah i see... then just reopen the inv again i guess.

ruby dove
#

that's what im doing

trail remnant
ruby dove
#

well trying to do *

lost matrix
trail remnant
#

so would it be a set?

lost matrix
#

plugin.getConfig().getList() instead

trail remnant
#

ah ok thanks 😄

paper viper
#

what are yall thoughts about vavr?

ruby dove
#

can u help or nah

trail remnant
lost matrix
paper viper
#

Yeah

lost matrix
#

Btw
List<String> keys = (List<String>) plugin.getConfig().getKeys(false);
Do you even check the return types of your methods?
getKeys returns a Set<String>

trail remnant
#

yeah?

quaint mantle
#

you here?

#

compare enums

#

e.getEntityType() == EntityType.ENDER_DRAGON

ruby dove
#

Uhm-

frail zenith
#

hey can someone help me?

dusk flicker
#

?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. Create a thread in case the help channel you are using is already in use!

ruby dove
#

bluu freesze

trail remnant
#

quick question, how could i get the keys of a file created using File f = new File("plugins/Test/" + args[0] + ".yml");

quaint mantle
#
File pluginsDirectory = plugin.getDataFolder().getParentFile();

File testFileConfig = new File(pluginsDirectory.getAbsolutePath() + "/Test/" + args[0] + ".yml");
trail remnant
#

so that would get the keys or just the file itself?

quaint mantle
#

just the file