#help-development

1 messages · Page 2146 of 1

harsh totem
#

It still gets the can't drop air error

        is = is.clone();
        is.setAmount(amount);
        final Map<Integer, ItemStack> map = p.getInventory().addItem(is);
        for (final ItemStack item : map.values()) {
            if (item.getType() != Material.AIR)
                p.getWorld().dropItemNaturally(p.getLocation(), item);
        }
    }```
#

even tho if the item is air it shouldn't get thrown

earnest forum
#

what are u trying to do

harsh totem
#

throw the not given items at the player

earnest forum
#

like if the inventory is full?

harsh totem
#

yes

earnest forum
#

get the player's inventory

#

the contents of it

harsh totem
#

and?

earnest forum
#

check if it contains air

#

if not

#

check if it contains the item ur trying to give to them and if its not full

#

and if both are false drop it on their body

lost matrix
#

Thats how i would approach it:

  private void giveAmount(Player p, ItemStack is, int amount) {
    is = is.clone();
    is.setAmount(amount);
    World world = p.getWorld();
    p.getInventory().addItem(is).values().stream()
            .filter(overflownItem -> !overflownItem.getType().isAir())
            .forEach(overflownItem -> world.dropItemNaturally(p.getLocation(), overflownItem));
  }

Look at the filter. There are several types of air now.

harsh totem
#

I don't think I need to do this.
If some items are not given the enter the hashMap and then it uses the for loop to drop the items in the hashMap at the player

lost matrix
#

So you need to use Material#isAir to be sure.

harsh totem
#

.forEach(left -> world.dropItemNaturally(p.getLocation(), left)); here

lost matrix
#

The items that are left

#

You can also call it "overflownItem"

harsh totem
#

ok

#

so you're just filtering the air from the hashmap

#

ok

lost matrix
#

Because the problem might occur even earlier.
I never had a problem with the overflown items containing air.

harsh totem
harsh totem
lost matrix
#

System.out.println(is) to make sure you dont actually pass an AIR itemstack to that method

lost matrix
harsh totem
#

ok eait

#

wait

#

the spaes are because i made it like that

lost matrix
#

Thats not a stack trace. I want to see where it tells you that it "can't drop air"

harsh totem
#

idk how to check

lost matrix
#

How to check what? Just show me the lines where it tells you that you cant drop air...

sterile token
#

How do you hide a block?

harsh totem
sterile token
#

You set it to air?

sterile token
undone axleBOT
lost matrix
sterile token
#

So its not easy right

lost matrix
#

(And some lines around it)

sterile token
#

The simple solition I think was to set it to air, and them set it back to original block

#

🤔

lost matrix
harsh totem
#
   19     is = is.clone();
   20     System.out.println(is);
   21     is.setAmount(amount);
   22    World world = p.getWorld();
   23     p.getInventory().addItem(is).values().stream()
   24             .filter(overflownItem -> !overflownItem.getType().isAir())
   25             .forEach(overflownItem -> world.dropItemNaturally(p.getLocation(), overflownItem));
   26     System.out.println();
   27     System.out.println(is);
   28
 }```
#

the numbers in the start are the lines

sterile token
#

Smile its for a protection plugin so i doesnt matter

#

So you hide/unhide the protection block let say

lost matrix
lost matrix
harsh totem
#

k

#

the console says Dropping: ItemStack{GOLD_NUGGET x 0, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"dark_purple","text":"2,000 Coins"}],"text":""}, lore=[{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"light_purple","text":"you can use this to trade with players"}],"text":""}], enchants={ARROW_INFINITE=1}, ItemFlags=[HIDE_ENCHANTS]}}
and the error is immediately after that

lost matrix
#

I see the problem. The amount is 0

harsh totem
#

oh

lost matrix
# harsh totem the console says ```Dropping: ItemStack{GOLD_NUGGET x 0, UNSPECIFIC_META:{meta-t...

Add a safeguard at the top of your method:

  private void giveAmount(Player p, ItemStack is, int amount) {
    Preconditions.checkArgument(amount > 0, "Amount must be at least 1.");
    is = is.clone();
    is.setAmount(amount);
    World world = p.getWorld();
    p.getInventory().addItem(is).values().stream()
            .filter(item -> !item.getType().isAir())
            .forEach(item -> world.dropItemNaturally(p.getLocation(), item));
  }

This enforces the constraints of the method.

harsh totem
#

ok

vivid cave
#

Hey guys, so i'm using a quite funky system for the chat, it relays messages from discord to players, relay player messages from a server to another (of the bungeecord network) with some funky pluginmessaging kind of feature, etcetera...
Anyway, what is sure is that there ain't no proper "chat", the message is caught, cancelled, formatted, and rebroadcasted. (not directly formatted for some difficult to explain reasons)
Whether this is a bad design and should be rewritten is not the purpose of my question though, I am just wondering if it will still work in 1.19, because i've been hearing they are completely changing the chat, and that the player messages have to be intercepted by their server first???
I'm a bit confused honestly by what is really going to be affected in the chat, but can I be relieved that despite all the weird implementations I've mentioned, it will still work?

misty current
#

if you are referring to the new chat encryption that is coming out, it will be fine because messages are decrypted on the server end, of course

vivid cave
#

ok so sole change, messages are just going through an encryption process but nth changes server side?

misty current
#

nope

#

messages are encrypted by the client, sent to the server and decrypted

tardy delta
#

1.19 lol

#

\😂

lost matrix
#

The whole packet communication between client and server is currently encrypted using AES anyways.
You wont feel a change unless you fiddle with raw packets before the decryption happens. And nobody does that really.

misty current
#

yea, unless you want to MIDM lol

vivid cave
#

packets*

misty current
#

plugin messages are encrypted and then decrypted most probably

#

like everything else

lost matrix
#

No changes. You dont see anything from the encryption.

vivid cave
#

oki

#

alright thanks a lot guys!

misty current
#

it's not a big deal since you are not trying to get the packet's contents before they are decrypted

vivid cave
#

i see^^

misty current
#

anyways does anyone know where is the entitydamagebyentity event called? I am trying to understand how minecraft calculates damage dealt

lost matrix
misty current
#

i'm not trying to get the damage of an Entitydamagebyentityevent

#

but trying to calculate the potential damage a player could deal to an entity

#

a method i can call where i provide the attacker, victim and it returns a double being the damage

lost matrix
#

Lets do some digging then

misty current
#

dont think that exists in spigot's api does it

lost matrix
#

I dont know an api method that exposes this.

glass mauve
#

how can I add an tab completion? for example I have a List<> of string and I want to show them in the tab completion and the user can press tab to paste the selected String. Minecraft already does this:

lost matrix
misty current
#

do you want to add your command to the tab completion shown in the screenshot?

#

it should be there if you just register the command

glass mauve
misty current
#

then do what smile said

glass mauve
#

ok

misty current
#

implement TabExecutor instead of commandexecutor

glass mauve
#

does this works for Paper? or should I use a different way for paper

misty current
#

it's the same

#

if I listen for an event that is a superclass of another event that I call, will the listener be called?

lost matrix
#

The best i could find is the method:

EntityDamageEvent handleLivingEntityDamageEvent(Entity damagee, DamageSource source, double rawDamage, double hardHatModifier, double blockingModifier, double armorModifier, double resistanceModifier, double magicModifier, double absorptionModifier, Function<Double, Double> hardHat, Function<Double, Double> blocking, Function<Double, Double> armor, Function<Double, Double> resistance, Function<Double, Double> magic, Function<Double, Double> absorption)

In CraftEventFactory. But you would have to copy/paste a ton of stuff from LivingEntity#hurt(DamageSource source, float amount) in order to call this event.
I mean if you want to take one or two days then you could probably skim this method and recalculate the damage that would have been dealt. But this is only true
for this exact version then.

misty current
#

that's a lot of parameters

#

it is pretty weird that they require you to add all this stuff when you could most probably get them from the entity itself(like absorption hearts, potion effects)

#

don't feel like its worth it tho, also i'll probably do some custom damage stuff so unsure if i'll need it at all

#

but useful to know, thanks

quaint mantle
#

does anyone know how to make a player head itemstack

#

but not via uuid

#

i.e if i want to make a present palyer head

#

idk the UUIDs and all i have are the commands people use whcih dont provide uuids

lost matrix
tardy delta
misty current
#

you can get a player from a name

quaint mantle
#

i can do it for normal players

#

is there like a good site that people use for such things

misty current
#

even an offline one, but it is an expensive operation

quaint mantle
#

is that what i set the owner as?>

misty current
lost matrix
#

No thats the texture and signature as a single base64 String

misty current
#

if you need it as a player skin, you also need the signature

quaint mantle
#
eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTc4OWIzZTI4NjhkNzE2YTkyMWRlYzU5MzJkNTMwYTg5MmY2MDAyMzVmMTg3NzY2YmMwMmQxNDVlZDE2ODY1YiJ9fX0=

so this for example

#
        UUID uuid = UUID.fromString(stringUUID);
        ItemStack head = new ItemStack(Material.PLAYER_HEAD);
        SkullMeta sm = (SkullMeta) head.getItemMeta();
        sm.setOwningPlayer(core.getServer().getOfflinePlayer(uuid));
        sm.setDisplayName(name);
        sm.setLore(description);
        head.setItemMeta(sm);
        this.skullMap.put(uuid, head);
        return head;
#

this is what i have rn

lost matrix
quaint mantle
#

ok

misty current
#

i did something for that for a 1.8 project

quaint mantle
misty current
#

but i forgot where it was

lost matrix
quaint mantle
#

easssyyy

#

ty

#

kotlin is just typescript

#

haha

quaint mantle
#

haha

#

its slightly different

#

um

lost matrix
# quaint mantle easssyyy

Oh yeah btw this only works for newer versions. Cant remember when PlayerProfile was introduced in spigot.
1.16 1.17 or 1.18

quaint mantle
#

bc methods arent working

lost matrix
#

Do you use 1.18?

quaint mantle
#

i cant upload pic

#

yeah 1.18

#

profile.setProperty isnt a thing

#

theres something called

#

setTextures

lost matrix
#

Uh... its from paper. The methods in spigot are named slightly different.

quaint mantle
#

i am using paper rn

#

on my server

#

but not in maven

#

ceebs migrating bc they wont let me use paper t.t

lost matrix
#

Thats the problem with features that get earlier introduced in upstream...

quaint mantle
#

i see

#

so in spigot its different

#

profile.getProperties().put("textures", new Property("textures", base64));

#

something like this

lost matrix
#

Yeah that looks good

quaint mantle
#

they use urls

#

actually

#

i dont think theres anything in spigot for base64

#

which seems dangerous lol

quiet ice
#

?jd-s

undone axleBOT
quiet ice
#

This does not seem like the right way to do it, but eh

quaint mantle
#

nvm

#
        GameProfile profile = new GameProfile(UUID.randomUUID(), "");
        profile.getProperties().put("textures", new Property("textures", base64Texture));
lost matrix
#

Another recommendation:

quaint mantle
#

its gameprofile not playerprofile

lost matrix
#

Because then you dont have to re-create the heads everywhere and you can
just use them by calling enum methods.

ItemStack chest = CustomHead.CHEST.get()
quaint mantle
#

im gonna make enums

#

load them @ onEnable

#

so palyers rnt getting lag spikes or some shit

quiet ice
#

Isn't game profile NMS?

lost matrix
#

There has to be PlayerProfile

misty current
lost matrix
misty current
#

game profile should be the mojang one

quaint mantle
#

hm

#

it is ur right

lost matrix
misty current
#

oh nvm

quaint mantle
#

it looks like i just need to use a skin url but

#

its the same as getting a UUID rly

#

idm using nms tbh

#

nvm im not reflection is scary

#

might be the only way without paper though

lost matrix
#

Someone posted XSeries SkullUtils earlier. You can just use that if you dont want to use the api.

lost matrix
quaint mantle
#

with base64 tho?

lost matrix
#

Yes

quaint mantle
#
The URL must point to the Minecraft texture server. Example URL:

 http://textures.minecraft.net/texture/b3fbd454b599df593f57101bfca34e67d292a8861213d2202bb575da7fd091ac
 
lost matrix
quaint mantle
#

oh is that what it is

#

my bad

lost matrix
quaint mantle
#

thanks

#

oh wtf

#

How do you compare a bunch of number and decide which one is the biggest one, what was that method called?

#

For example, what people are doing with /baltop

lost matrix
quaint mantle
#

But I forgot what was the best way to compare all the currency holders, and make a list showing the top 5.

#

Make it so it lasts for like a bit ?

lost matrix
#

Send an empty String

quaint mantle
#

For example

player1uuid.yml
player2uuid.yml
player3uuid.yml

lost matrix
#

Unless the currency can only change while a player is online. Then its a bit easier.

quaint mantle
#

It's like tokens, in a way.

round agate
#

see how essentialx did with /baltop maybe you will get a better idea

lost matrix
#

Well... now that i think about it... that doesnt exaclty make it easier.

quaint mantle
#

What I was thinking of maybe is

Loop all the files in player-data, store all the currency values in a List<Integer>, then compare it of of there?

humble tulip
#

Map?

#

Uuid, Integer

lost matrix
terse raven
humble tulip
#

If you dont wanna deal with sorting u can use sqlite and then just do order by in a query

quaint mantle
terse raven
#

how do i disable the block destruction of an explosion while keeping the same entity damage?

humble tulip
lost matrix
grim ice
humble tulip
#

Honestly if u wanna use files use sqlite

humble tulip
lost matrix
grim ice
humble tulip
#

Ah ok

grim ice
#

I just answered his question

quaint mantle
#

MongoDB supports that as well, right ?

grim ice
#

man what ru even doing

humble tulip
#

Custom currency

lost matrix
quaint mantle
grim ice
#

If you wanna make a custom currency plugin then make it support both flat file and sql/nosql databases

#

Action bar is big enough

lost matrix
#

The action bar most certainly is enough...
Anyways: You should use one boss bar and simply show/hide it.

radiant cedar
#

how can i make it so that whoever joins the server spawns at a specific location at a specific world

lost matrix
humble tulip
#

Playerspawnlocationevent

radiant cedar
lost matrix
lost matrix
radiant cedar
#

no

lost matrix
#

Use the PlayerSpawnLocationEvent instead.

radiant cedar
#

i put it onJoin even which was already there

radiant cedar
radiant cedar
#

oh

#

alright exactly what im looking for

#

ty

humble tulip
#

Ye

humble tulip
#

Ye LOL

#

Been a thing for ages

main matrix
#

lmao

lost matrix
#

I usually split the action bar into 3 sections. Left, Middle and Right.
Never had an issue with space.

humble tulip
#

Do u know if i can do something like update table set column = column +1; in mongo

quaint mantle
#

@humble tulip would it be the same if I stored all the currency in one .yml file instead of a DB?

lost matrix
humble tulip
#

Or decrement

#

I guess +1 is not what inalways wanna do

humble tulip
lost matrix
#

Increment:

     val filter = Filters.eq(EconomyAccountProperty.ACCOUNT_ID, accountId)
     val action = Updates.inc(EconomyAccountProperty.BALANCE, amount)
     val result = mongoCollection.updateOne(filter, action)

Decrement:

     val filter = Filters.eq(EconomyAccountProperty.ACCOUNT_ID, accountId)
     val action = Updates.inc(EconomyAccountProperty.BALANCE, -amount)
     val result = mongoCollection.updateOne(filter, action)
humble tulip
#

Oh so you can increment by an amount

lost matrix
#

Yes

humble tulip
#

That's exactly what I'm looking for lol

radiant cedar
#

i still spawn where i leave

humble tulip
#

Don't teleport

#

Set the spawn location

quaint mantle
humble tulip
#

If you teleport them on that event, after your teleport code os run it reteleports to the spawn location that's default

lost matrix
humble tulip
#

You don't need mysql

#

You can create a.db file and use that

#

If you dont need it to sync across servers

#

And don't wanna use the data somewhere else

quaint mantle
#

No, I just want it to be locally, in 1 server for now.

humble tulip
#

Ok

tardy delta
#

lol who tf is user buildtools?

lost matrix
tardy delta
#

it changed for some reason

#

and its now on github too :/

#

can i change it?

kindred valley
#

Is there any way to input something in while loops' if conditions

lost matrix
#

first of all: If conditions are nothing you can loop throught

lost matrix
tardy delta
kindred valley
# lost matrix What are you trying to do?
while(true){
   Sysout("Choose a method: ");
   Scanner s =  new Scanner(System.in);
   int method = s.nextInt();
   
   //I need this part of code

   if(method == 1){
      //I want to make a scanner question here but it always ends the loop
   }
}```
tardy delta
#

why not creating the scanner outside the loop?

kindred valley
#

Its outside of the loop

tardy delta
#

do if scanner.hasNext in the while loop?

kindred valley
tardy delta
#

or hasNextInt or what you want

kindred valley
#

What does it do

tardy delta
#

checks if the user has entered something

kindred valley
#

Huh

#

why do i check it just to understand well

tardy delta
#

lmao what

radiant cedar
#

would this trigger before or after

#

playerjoinevent

dusk flicker
lost matrix
tardy delta
dusk flicker
#

ye

radiant cedar
#

unless im blind

lost matrix
radiant cedar
#

lol ye ok nvm

humble tulip
#

Need a pair of these👀

dusk flicker
#

what

#

oh

#

im fucking stupid

tardy delta
#

name doesnt seem to change in intellij

#

after i changed it globally and reconnected to git

lost matrix
#

You cant read and write in the same stream.
You have a listener for incoming messages that is completely separate from any sent messages.

prime kraken
#

Hi, I see the name of my Custom armor stand trough block, is it possible to disable it ? And It is possible to make the armor stand don't "follow player" like a NPC who when look at the player ?

lost matrix
prime kraken
lost matrix
#

Armorstands dont follow a player anyways. So im not sure what the question is about.

prime kraken
#

Not following like walk, like follow with head

#

Like npc on famous server

lost matrix
#

Yeah. Armorstands dont do that

prime kraken
#

Wait i will screen

lost matrix
#

You cant

prime kraken
#

Damn

#

Nvm i will search

lost matrix
#

So first of all:
Bukkit.getMessenger().registerOutgoingPluginChannel(MY INSTANCE, "BungeeCord");
This should be called once in the onEnable.

#

Ok. Now the first utf input from a BungeeCord message is always the sub-channel.
So your servername variable contains "GetServer" every time you receive the server message.

#
        ByteArrayDataInput in = ByteStreams.newDataInput(message);
        String subChannel= in.readUTF();
        if(subChannel.equals("GetServer") {
          String serverName = in.readUTF();
          System.out.println(serverName );
        }
#

When you read something from an ByteArrayDataInput, the byte pointer moves further into the message.
So every time you read something, you get the next message.
Example:

[0, 3, 3, 9, 2, 4]
                |

readByte -> reads '4'

[0, 3, 3, 9, 2, 4]
             |

readByte -> reads '2'

[0, 3, 3, 9, 2, 4]
          |

readByte -> reads '9'

And so on.

sage merlin
#

how do i create a java project with nothing in it no api no nothing just plain java

lost matrix
#

For your output:
You can only send to one single sub-channel when you send a message.
For example "GetServers"
out.writeUTF("GetServers");
And after that you need to send the message because there are no expected arguments.
So the Proxy receives "GetServer" and responds with a list of all servers.
This can then be read in the listener using:

        ByteArrayDataInput in = ByteStreams.newDataInput(message);
        String subChannel= in.readUTF();
        if(subChannel.equals("GetServers") {
          String[] serverList = in.readUTF().split(", ");
          System.out.println(Arrays.toString(serverList));
        }
wide coyote
sage merlin
lost matrix
#

Yeah. Then just click your way through

sage merlin
#

just plain java

lost matrix
sage merlin
#

alright thanks

wide coyote
#

"additional" libraries, not required

quiet ice
#

I mean, 99% of java API classes are also not required

radiant cedar
#

why are the world names capital
even tho all folders are non capital

lost matrix
quiet ice
#

Probably because you defined them with capital names

#

I do not think that the world name is equal to the folder name, but I could be incorrect about that

radiant cedar
#

oh i have command /warp WORLDNAME

#

maybe if u type capital the first time

#

it stays capital

#

that would make sense i think

lost matrix
#

Might be defined in the level.dat

#

It is indeed defined in the level.dat

#

Just send the player. BungeeCord doesnt do anything if he is on the right server already.

radiant cedar
lost matrix
#

You are getting into the realm where writing a BungeeCord plugin might be the better approach.
Then you can define custom channels, messages and responses.

#

2 different plugins. One is installed on bungeecord and one is installed on spigot.
Then those two communicate via the messaging channel.

#

You can also compile one jar that can be deployed on both types of servers.

radiant cedar
#

how come does this not work

crimson terrace
#

how are you determining that it does not work

radiant cedar
#

how does what not work

lost matrix
# radiant cedar

Bed is an instance of BlockState or BlockData. There are 2 different Bed classes and none of them
can be obtained by casting a Block.

crimson terrace
#

compare Materials I think that means

lost matrix
#

If you want to check the type of a Block you should use:

block.getType() == Material.BED
radiant cedar
#

how can I cancel event of someone right clicking a bed because if they set their spawn in a bed,

#

this doesnt work

lost matrix
#

PlayertInteractEvent -> cancel if they (right)click on a bed

radiant cedar
#

cant i just do instance of somethng

brave goblet
#

Make a list?

radiant cedar
#

do i have to do || each

brave goblet
#

No

#

make a list of all

lost matrix
#
if(Tag.BEDS.isTagged(material))
lost matrix
radiant cedar
#

wait what

brave goblet
lost matrix
#

The last thing he should do is making a list.
Either use a Set or use Tags.

brave goblet
#

typing >>>

#

What is tags?

radiant cedar
#

can u babysit and just type what i need to type lmao

#

pls

brave goblet
#

Mmmm i ask for that but it doesn't help

#

cause then u don't understand for next time

radiant cedar
#

true but

lost matrix
# radiant cedar i have no clue how to make this work
  @EventHandler
  public void onClick(PlayerInteractEvent event) {
    if(event.getAction() != Action.RIGHT_CLICK_BLOCK) {
      return;
    }
    if(Tag.BEDS.isTagged(event.getClickedBlock().getType())) {
      event.setCancelled(true);
    }
  }
radiant cedar
#

ok

#

ty

lost matrix
#

This is clearer:

  @EventHandler
  public void onClick(PlayerInteractEvent event) {
    if(event.getAction() != Action.RIGHT_CLICK_BLOCK) {
      return;
    }
    Block clickedBlock = event.getClickedBlock();
    if(clickedBlock == null) {
      return;
    }
    Material material = clickedBlock.getType();
    if(Tag.BEDS.isTagged(material)) {
      event.setCancelled(true);
    }
  }
radiant cedar
#

❤️

lost matrix
# brave goblet Make a list?

Btw a List scales really bad with multiple materials because it has to go through every single element when you call .contains() on it.
Sets dont care how many elements are in them. They always return true/false instantly.

brave goblet
lost matrix
kindred valley
lost matrix
kindred valley
kindred valley
#
Scanner s = new Scanner(System.in);
Sysout("Choose method: ");
int method = s.nextInt();
setSomething(method);
kindred valley
lost matrix
#
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    while (true) {
      String input = scanner.nextLine();
      System.out.println("Your wrote: " + input);
    }
  }
kindred valley
#

wait

#

?paste

undone axleBOT
kindred valley
#

I pointed the method i want to test for

#

sorry for language 🥴

lost matrix
#

Split this in a ton of different classes and methods. Nobody can read that.

quiet ice
#

Oh yeah, another tip for improving performance is that timings are useless af

#

I have no idea how it managed to get this popular while being near useless compared to spark

quaint mantle
#

anyone else have trouble compiling in maven when using libsdisguises

lost matrix
# kindred valley I pointed the method i want to test for

Here you can see on how to split up your code a bit:

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    while (true) {
      System.out.println("Choose 1, 2 or 3");
      String input = scanner.nextLine();
      switch (input) {
        case "1" -> runOne();
        case "2" -> runTwo();
        case "3" -> runThree();
        default -> System.out.println("Unknown input.");
      }
    }
  }

  private static void runOne() {
    System.out.println("This is the first method.");
  }

  private static void runTwo() {
    System.out.println("This is the second method.");
  }

  private static void runThree() {
    System.out.println("This is the third method.");
  }
quaint mantle
# lost matrix What trouble?

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Minigames: Fatal error compiling

#

removing libsdisguise works fine

lost matrix
#

Whats the fatal error?

quaint mantle
#

how do i check

#

soz

#

im pretty noob

lost matrix
#

There should be a hierarchy in your maven output

quaint mantle
#
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Minigames ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
#

this?

lost matrix
#

Do you use the terminal to compile or the buttons from IJ

quaint mantle
#

shift f10

#

so ye button i guess

lost matrix
#

Then you should have this

quaint mantle
#

ye

#

uh

#

i dmd it to u i cant send photos here

lost matrix
#

Then validate

quaint mantle
#

i dont have a spigot account lol

#

should probably make one

lost matrix
#

Now go up the hierarchy and check the exception

quaint mantle
#
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Minigames: Fatal error compiling: java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor (in unnamed module @0x26339ea0) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module @0x26339ea0 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
#

lol interesting

lost matrix
#

Use the latest lombok version if you use it.
And absolutely dont shade in libs-disguises

#

Show me your disguises dependency in your pom

quaint mantle
#
<dependency>
            <groupId>LibsDisguises</groupId>
            <artifactId>LibsDisguises</artifactId>
            <version>10.0.21</version>
            <scope>provided</scope>
        </dependency>
#

i think i shade my spigot jar

#

idek what shading is

#

i didnt learn properly

lost matrix
#

Use the provided scope on everything you dont want to be packed up with your jar.

quaint mantle
#

hm

#

i think libsdisguises and protocolib shouldnt be packed with it right?

#

i might just try adding the jar to my local repo, even jitpack doesnt work

opal juniper
#

define doesn't work

dark arrow
#
Player player = (Player) sender;
            Inventory inventory = Bukkit.createInventory(player,16);
            player.openInventory(inventory);
```This peice of code gives error even i cant find anything wrong
lost matrix
dark arrow
#

ohh

#

yah

tardy delta
#

im planning on creating a big kingdoms plugin, what would be the best way to save players data:

  • create a Kingdomplayer object which has an atomicreference to an usersnapshot which stores the data
  • create things like Homemanager, KingdomManager which manages data for all players?
tall dragon
#

just have a KindomPlayer object which stores the player's uuid and any other data you need it to.

tardy delta
#

mye that would be the easiest

last sleet
#

Custom enchantments don't work when I try and add them to an itemstack and giving it to a player: the enchant's not there (it's not not rendered, it's just not there.). I checked Enchantment.values() and my enchantment is present there. I found someone with the same issue on an old thread, and adding load: STARTUP to plugin.yml fixed the issue, but only when restarting the server and not reloading it. Since restarts take ages on my computer, I want to know what causes customEnchants to not apply to items and why load: STARTUP fixes it... Here's my code:

tall dragon
#

minecraft clients cannot render custom enchantments

#

you need to add lore manually

tardy delta
#

why setting bool registered to true first and when an error occurred to false?

#

¯_(ツ)_/¯

last sleet
last sleet
tall dragon
#

i woulnt make custom enchantments like this anyway

#

i would just store any custom enchantments in the item's pdc

#

and add the lore.

river oracle
#

its a fine way to make custom enchants but considering he has been struggling with it for a day now I reccomend taking a simpler approach

last sleet
river oracle
#

aka PDC or lore

tall dragon
#

how does it make that simpler

last sleet
last sleet
tall dragon
#

uhh

#

dont rlly understand that statement

maiden briar
#

What is the best idea to synchronise chat messages between multiple instances of my plugin?
Bungee Messaging or Database Queries? Because I don't want to put a messages.yml on every Spigot instance with the same messages

tall dragon
#

uh. i have done that with redis pub/sub before. but i guess bungee messaging could work too.

maiden briar
#

Ok then I would use that

lost matrix
#

Im a big fan of redis too when it comes to cross server communication

maiden briar
#

Ok but then I have an idea. Thanks for answering

tall dragon
#

👍

kindred valley
lost matrix
#

Or make it a static field

kindred valley
lost matrix
#

Pass it as an argument. You learn more this way.

tardy delta
#

whats the best time to load player data? async pre login, login or join?

tall dragon
#

kinda depends

#

how your data is stored

tardy delta
#

i was thinking of a h2 database

lost matrix
#

I most circumstances: AsynPlayerPreLoginEvent

tardy delta
#

so embedded shouldnt take much response time

kindred valley
tardy delta
#

so loading unneccesary data

lost matrix
#

Benefit: In the PlayerJoinEvent all the data is already loaded and you dont need to do anything on the main thread.

kindred valley
tardy delta
quaint mantle
#
org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (near "-": syntax error)
        at org.sqlite.core.DB.newSQLException(DB.java:1030) ~[sqlite-jdbc-3.36.0.3.jar:?]
        at org.sqlite.core.DB.newSQLException(DB.java:1042) ~[sqlite-jdbc-3.36.0.3.jar:?]
        at org.sqlite.core.DB.throwex(DB.java:1007) ~[sqlite-jdbc-3.36.0.3.jar:?]
        at org.sqlite.core.NativeDB.prepare_utf8(Native Method) ~[sqlite-jdbc-3.36.0.3.jar:?]
        at org.sqlite.core.NativeDB.prepare(NativeDB.java:137) ~[sqlite-jdbc-3.36.0.3.jar:?]
        at org.sqlite.core.DB.prepare(DB.java:257) ~[sqlite-jdbc-3.36.0.3.jar:?]
        at org.sqlite.jdbc3.JDBC3Statement.executeQuery(JDBC3Statement.java:66) ~[sqlite-jdbc-3.36.0.3.jar:?]
        at org.andrej.utils.PlayerDataSetter.setPlayerConfigOnJoin(PlayerDataSetter.java:30) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]```
#

How do I fix this issue?

#
Connection connection = new SQLDataBase(new File("plugins/data/player-data.db")).getConnection();
        Statement statement = connection.createStatement();

        statement.executeQuery("CREATE TABLE IF NOT EXISTS currencies (uuid TEXT PRIMARY KEY, balance INTEGER, farming-chips INTEGER);");

        ResultSet result = statement.executeQuery("INSERT INTO currencies (" + p.getUniqueId().toString() + ", 0, 0);");```
#

This is the code that I'm running.

tall dragon
#

i think it cannot contain '-'

quaint mantle
#

use underscores instead

#

ooooh

#

okay okay

#

im dumb

radiant cedar
#

how can I make something like this

#

but for chests

quaint mantle
#

Just get the rightclicked block ?

#

and see if it's a chest ?

radiant cedar
#

but it can be ender chest or minecart chest

#

wait thats only 3 ill just type those

#

anywayyyyy

quaint mantle
#

or just check if the material ends with "chest"

#

That should include all cases

quiet ice
#

meanwhile, minecart with chest:

quaint mantle
#

isn't it represented as MINECART_CHEST?

opal juniper
#

thats the entity type ye

last sleet
#

would that work?

river oracle
#

you'd have to use a list

#

can't check contains on arrays

quaint mantle
last sleet
echo basalt
#

lowercase java programming

river oracle
#

Or just use a list

echo basalt
#

cursed

opal juniper
#

its CHEST_MINECART otherwise

quaint mantle
#

oh

#
statement.execute("CREATE TABLE IF NOT EXISTS currencies (uuid TEXT PRIMARY KEY, balance INTEGER, farming_chips INTEGER);");

        statement.execute("INSERT INTO currencies (" + p.getUniqueId().toString() + ", 0, 0);");```
#

This is correct, but it wont insert it for some reason.

#
Connection connection = new SQLDataBase(new File("plugins/data/player_data.db")).getConnection();
Statement statement = connection.createStatement();```
echo basalt
#

try INSERT INTO currencies (uuid, integer, integer) VALUES (<uuid>, 0, 0);

#

with SQLite, INSERT OR REPLACE INTO ...

quaint mantle
#

OMG

#

forgot values...

#

im so dumb

echo basalt
#

With MySQL, VALUES (...) ON DUPLICATE KEY UPDATE (uuid=values(uuid), balance=values(balance)) iirc

#

so you don't insert duplicate entries

quaint mantle
#

Wait, how would yo do it ?

#

Can you send a quick snippet ?

#

and Now I'm getting [SQLITE_ERROR] SQL error or missing database (unrecognized token: "86f4a314")

#

Even though it exists.

#

nvm i found the error

#

I'm saving the UUID and it has a -

#

but idk how to fix that.

echo basalt
#

add quotation marks

#

this is a simple demonstration of how sql injection may happen

quaint mantle
#
statement.execute("INSERT INTO currencies (uuid, balance, farming_chips) VALUES ("+ p.getUniqueId() +", 0, 0);");```
crisp steeple
#

you need a \backslash"

echo basalt
#

VALUES (\"" + player.getUniqueId() + "\", ...")

crisp steeple
#

idk why the backslash char doesnt show up on discord

echo basalt
#

because it's used to escape the following char

#

which is why if you have emojis on, you can do :\) to bypass it

crisp steeple
#

\"

quaint mantle
#
statement.execute("INSERT INTO currencies (uuid, balance, farming_chips) VALUES (\"" + p.getUniqueId() + "\", 0, 0);");```
echo basalt
#

should work yeah

#

the \" makes a " character within the string

#

so it ends up like

INSERT INTO currencies (uuid, balance, farming_chips) VALUES ("1234abcd-1234abcd-1234-1234abcd", 0, 0); for example

tardy delta
#

in intellij whats the difference between an artifact and a jar built by mvn package?

tardy delta
#

a better practice in my eyes

quaint mantle
#

@echo basalt [SQLITE_ERROR] SQL error or missing database (table currencies has no column named farming_chips)

#

It does contain it.

echo basalt
#

¯_(ツ)_/¯

quaint mantle
#

But still errors me.

tardy delta
#

it doesnt like you

quaint mantle
#

ikr

crisp steeple
#

just have to keep in mind they start at 1 instead of 0

sterile token
#

Hi how are you people?

tardy delta
#

i assume that it builds the jar itself and puts it into the plugins folder

golden turret
#

guys, im cancelling the click event, but if i spam clicks the event "is not cancelled"

eternal oxide
#

You are probably accidentally triggering the drag event

#

Else it's a client bug and not really happening

golden turret
golden turret
eternal oxide
#

do you listen to the drag event?

golden turret
#

nop

#

InventoryClickEvent

eternal oxide
#

add it and cancel it

#

see if it is being triggered

golden turret
#

i will see

tardy delta
golden turret
#

nop

#

i mean

#

i use the 1st method

#

and when i edit something in the plugin

#

i simple compile it

#

place in the plugins folder

#

and do /reload

quaint mantle
#

@echo basalt you mentioned something about REPLACE INTO

dark arrow
#

how to get title of inventory

tardy delta
#

inv.getView().getTitle()

#

iirc

dark arrow
#

ok

golden turret
kind hatch
#

IIRC, there is no slot because the item is null.

tardy delta
#

¯_(ツ)_/¯

golden turret
#

debug is for debug

#

not to edit something

dark arrow
tardy delta
dark arrow
#

oh got it

tardy delta
#

mhm yes

#

depends

sterile token
#

How would you do a páginated menu?

tardy delta
#

if an array is easier afterwards use an array

sterile token
#

I have an Interface called menu. And them 2 classes 1 InventoryMenu and PáginatedMenu

#

So in páginated I keep an ArrayList of Menu. Is it okay?

small current
#

a player can hide in a tallgrass and hit the other player while the other player cannot damage the one in the tallgrass
can i fix it with any coding or whatever ?

#

1.17 server

#

.1

river oracle
#

better map design

#

IMO its the easiest solution

eternal oxide
#

Alternatively you could detect players tryign to move into tall grass and push them back

tall dragon
#

or you could shoot a ray from the attacker and see if you should hit a player in tall grass. though idk if this would be a good solution

river oracle
#

or you could just break the tall grass ASakashrug

hasty prawn
#

Removing the tall grass is definitely the most elegant solution lol

#

Anything else is gonna be janky

river oracle
#

listen tall grass is nice just not that nice

#

walk in hypixels steps and just get rid of it

tall dragon
#

that would indeed be the most clean.

kind hatch
#

Use a bow if you are the person outside of the tallgrass.

river oracle
#

anyone with more than one braincell would also counter this issue but we are talking about 1.8 pvpers

kind hatch
#

Or just step into the tallgrass. lol

left swift
#

what will be the best way to get main plugin class.

  • create public static method getInstance
  • transport ir via constructors Test(Main main) {...}
  • use JavaPlugin.getPlugin(Main.class);
    ?
tall dragon
#

?di

undone axleBOT
river oracle
lost matrix
#

-> JavaPlugin.getPlugin(Main.class); This one is bad

kind hatch
quiet ice
#

(I know that calling a class Main isn't ideal, but I doubt you meant that)

river oracle
quiet ice
#

JavaPlugin#getPlugin is an incredibly powerful tool

lost matrix
# quiet ice how come so?

Its a bunch of unneeded internal casting and instance checking + it violates any pattern that might have been introduced.

tardy delta
#

why isnt this printing "null"?

quiet ice
#

?stash

undone axleBOT
hasty prawn
#

Because you need to do "null"

kind hatch
#

Because you set it to null.

hasty prawn
#

Setting null in YML just removes the path

kind hatch
#

Meaning it got removed.

lost matrix
tardy delta
#

well ye and then getting it back should return null no?

kind hatch
#

If it's not there, it will throw null.

lost matrix
#

Also you need to reload the config from disk again

#

getConfig() always gets the memory representation

quiet ice
#

Meh, the casting isn't that much of a deal tbh

tardy delta
#

ah so reloading it instead of saving

quiet ice
#

I'd consider it rather safe, the performance impact is a bit large, but caching exists so not an issue

lost matrix
sterile token
#

Math.round() is used for doing page pagination right?

kind hatch
#

I don't believe so. Pagination is normally done with whole numbers, so rounding seems unnecessary.

lost matrix
tardy delta
#

so saving saves it to disk and reloading loads it from disk into memory?

kind hatch
#

Yes

quaint mantle
#
    public NMSFrostWard(Location loc, org.bukkit.entity.Player target) {
        super(EntityType.SNOW_GOLEM, ((CraftWorld) loc.getWorld()).getHandle());
        Level craftWorld = ((CraftWorld) loc.getWorld()).getHandle();
        
        this.goalSelector.removeAllGoals();
        this.goalSelector.addGoal(0, new RangedAttackGoal(this, 1, 0, 1, .3f));

        this.setPos(loc.getX(), loc.getY(), loc.getZ());
        craftWorld.getWorld().addEntity(this, CreatureSpawnEvent.SpawnReason.CUSTOM);
        CraftPlayer targetCraftPlayer = (CraftPlayer) target;
        this.setTarget(targetCraftPlayer.getHandle());
        this.persist = true;
    }
sterile token
quaint mantle
#

DOES anyone know hwow to reduce the range of attack

#

on a shooting entity

sterile token
#

But thanks too

golden turret
kind hatch
sterile token
eternal oxide
golden turret
#

yes

sterile token
#

Allrgiht

golden turret
tardy delta
#

and if i have the file in my jar contain default data and i do ::options().coydefaults(true), then remove that data when running the plugin, saving and reloading and then get it back, will it return the default instead of null?

golden turret
#

a builder and the paginated itself

lost matrix
#

"private final Map<Object, Object> data;"

#

lol...

golden turret
#

like context

tardy delta
#

weird explenation lol

lost matrix
#

And you even have public getters for your collections and your "data"

radiant cedar
#

is it possible to make a world have the ender background

golden turret
#

no

radiant cedar
#

from either spigot or file editing or something

kind hatch
#

You mean the sky color?

radiant cedar
#

yes

golden turret
#

only end worlds have end background

radiant cedar
#

alright

#

is it possible to change the background at all

#

or nah

sterile token
#

I want to know if I doing okay or wrong.

Menu interface - Commom things between the types

InventoryMenu - Normal menu without pagination. Where keep track of MenuButton (The Item infact), open, close, update, etc

PaginatedMenu - Normal menu but with pagination. Where keep track of page as List<Menu>, etc

tall dragon
lost matrix
native elbow
#

can someone explain me how to use special-gradle?

olive lance
tardy delta
#

wdym still not null?

#

EntityPickupItemEvent iirc

#

and check if its a player

olive lance
#

im gonna run it a lot

quiet ice
#

It would be infinitely more expensive to post this task than actually running it

kind hatch
quiet ice
#

That is very infrequent

olive lance
#

on each player*

tardy delta
#

looks like this

quiet ice
#

It only really makes sense once you run it like 200 times a tick

tardy delta
#

im only removing the join string no?
then trying to get it back would return null i guess

lost matrix
olive lance
#

latest

#

well 1.16+

quiet ice
#

Also, you should use == instead of .equals() for materials

olive lance
#

is what ive supported up to now

tardy delta
kind hatch
tardy delta
#

iirc yes

#

@EventHandler and register it

#

if i remember correctly

dusk flicker
#

are you getting the message

olive lance
kind hatch
# tardy delta

That's odd. Are you changing any of the config settings with #options()?

tardy delta
crisp steeple
quiet ice
dusk flicker
#

what are you running 100 times a second lol

sterile token
quiet ice
#

Basically I'd void your for loop

olive lance
#

ok

#

it makes sense to actually

#

now that you mention it

tardy delta
#

lets try to restart it

dusk flicker
#

why not use an event for armor updates

tardy delta
#

stiill welcome to the server message

dusk flicker
#

also HCF?

olive lance
#

yea

radiant cedar
#

When I get the error "Can't keep up! Is the server overloaded?"
My computer seems to disconnect off the internet to the point where I have to restart it to reconnect

#

does anyone know anyhting

#

about this

dusk flicker
radiant cedar
#

ahh alright thank you

crisp steeple
dusk flicker
olive lance
#

i have seen that somewhere on github

crisp steeple
#

yea dont think theres any event for armor update in spigot rn

radiant cedar
crisp steeple
#

theres some libraries and forks but nothing in actual spigot i dont believe

radiant cedar
#

and when the ram is overloaded i think

tall dragon
#

nope @crisp steeple

radiant cedar
#

but why disconnect my internet lol

crisp steeple
dusk flicker
#

might have to look into PRing that event in

crisp steeple
#

never found any

dusk flicker
#

Would be very useful

olive lance
#

armor update event would be useful

#

yeah

tall dragon
crisp steeple
#

oh

#

yea pretty unfortunate

tall dragon
#

but there is a good lib

crisp steeple
#

think paper has it

tall dragon
#

by mfnalex i believe

radiant cedar
#

I have no idea why tho

tall dragon
dusk flicker
#

yep Paper has an armor update event

tall dragon
#

this ones worked good for me.

dusk flicker
#

I would recommend either use Paper's event, or that lib Epic sent

#

Rather than running that check that fast (Which you really wouldent need to do it that fast, 20 times a second would probably still be sufficient)

olive lance
#

50 times per seconds was from 50players each second

dusk flicker
#

oh

olive lance
#

but yea i will use mfnalexs thing

tardy delta
#

@kind hatch doesnt seem to work with removing the plugin folder and getConfig().options().copyDefaults(false)

winged anvil
#

it says that that version isn't found

kind hatch
frail sluice
#

for some reason Build Artifacts doesn't make a plugin jar for me. why is that?

tardy delta
#

mhm weird

kind hatch
#

Because the config now looks like this, but is reading from the internal jar.

radiant cedar
#

why does it say unloaded world: avalon as well even when my newWorld is avalon

radiant cedar
quaint mantle
frail sluice
#

I did that.

#

I am using gradle, maybe it affects that?

ivory sleet
#

gradle isnt supposed to work with artifacts

frail sluice
#

oh. that makes sense.

#

is there any alternative? it would be really helpful to have the jar directly in the plugins folder

ivory sleet
#

yeah

frail sluice
#

may I know what is it?

ivory sleet
#

belive this might be what you're looking for

quaint mantle
#

Is there also a way to do that with maven?

ivory sleet
#

nah thats for gradle specifically

#

but maven is quite similar

lost matrix
quaint mantle
frail sluice
olive lance
winged anvil
#
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
#

this is right for the maven shading right?

kind hatch
# tardy delta same with me

So, doing it manually seems to work. Not sure why it grabs the internal file instead of the one from disk to be cached, but if you do it this way, then you shouldn't have that issue.

#

I'm not sure where the disconnect is, as this is what those methods do internally.

frail sluice
#

how do I add a dependency from mavenCentral to my plugin? just adding it to the build.gradle doesn't work for me

crisp steeple
#

mavenCentral()

frail sluice
#

yea, obviously. but it doesn't add it to the jar

crisp steeple
#

idk then, i dont usually use gradle

frail sluice
#
repositories {
    mavenCentral()
    maven { url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
}

dependencies {
    compileOnly 'org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT'
    implementation 'net.dv8tion:JDA:5.0.0-alpha.11'
}

this is what I have

radiant cedar
#

how can I know if it is actually unloading the world

edgy drum
unique geyser
#

So I had a question
I am coding something that makes it so that certain players have certain items

So for example, let's day Bob has a special hoe

What I want to be able to is like /hoeholder

And then it would show who has it, even if they are online

kind hatch
#

Loop through every player, check if their inventory contains the hoe and return the players that do.

lost matrix
unique geyser
#

Thanks!

lost matrix
radiant cedar
#

Also another question

#

on YamlConfigurationSection

#

if I get something and turns out it doesnt exist in the yml

#

will playerRank still change to something

kind hatch
#

It'll throw null.

radiant cedar
#

ah alright

#

ty

frail sluice
#

I am trying to send a request to some external API but I get IllegalStateException: zip file closed. I believe its related to URL caching? how can I fix that?

eternal oxide
#

disable AI if it has any or disable gravity

midnight shore
#

you could teleport it to the spawn when it spawns so you'll disable every offset

eternal oxide
#

are you actually spawning it or dropping it?

#

dropping has a random element

#

spawning doesn't

golden kelp
#

Why do u guys add <> around links

eternal oxide
#

because in discord it prevents any inserts

kind hatch
#

To prevent embeds.

eternal oxide
#

^

crisp steeple
#

btw a lot of item movement is client side for some reason, so even teleporting/changing position might not fix

frail sluice
#

I try to use JDA in my spigot plugin but I get zip file closed in the console. how can I fix it?

round finch
#

?paste

undone axleBOT
frail sluice
waxen plinth
#

Restart, don't reload

frail sluice
#

every single time? while developing?

eternal oxide
#

yes, unless you are specifically testing reload

frail sluice
#

world loading takes up some time though

#

it'll make developing workflow much inefficient

lost matrix
#

You can optimize it down to 20-30ms if you have an nvme

eternal oxide
#

do you get the error when doing a fresh start?

waxen plinth
#

Reloads can save you lots of time in testing

#

But the error you're showing is the result of a reload

#

It happens sometimes

frail sluice
#

ok

#

thanks

waxen plinth
#

👍

frail sluice
#

seemed to solve it for now

waxen plinth
#

Also

#

Please tell me you're not using JDA on the main server thread

vocal cloud
#

Who needs a main thread anyways

left swift
#

Should I use CompletableFuture in the separated thread, when I'm waiting for a redis message request?

echo basalt
#

RegisteredServiceProvider or an API

midnight shore
#

Hi, how can i disable the render of the off-hand item for other players? i know i'll have to use packets but could someone help me with them?

crisp steeple
#

it depends, if you're going to use 2 completely seperate plugins on one server you would probably have to use plugin messages to communicate with them, another approach would just be to merge them together and make an api for accessing them both simultaneously

#

did you make this BanManager?

#

if so, you could use plugin messages

#

or make an api for it like zacken said

radiant cedar
#

does having every world created when server is enabled a bad idea

quiet ice
#

It depends on the circumstances

#

there is never an outright "right" or "wrong"

radiant cedar
#

but does it change ram usage

#

after they are all created

#

or does that just depend on if they are loaded or not

left swift
golden kelp
#

How does one make an array of objects in YAML. 12am questions

crisp steeple
#

presuming you’re just using the snake yaml in bukkit just .set(path, array) and it’ll make it a yaml array

half leaf
#

Hello any1

trail oriole
#
Location rLoc = new Location(player.getWorld(), getRandom(-199, 0), 66, getRandom(-199, -83));
if (rLoc.getBlockY() != Material.AIR) return;``` why won't the condition work
#

says I can't compare getBlockY() to a material

eternal night
#

it does

trail oriole
#

wait

#

nevermind

#

i'm probably dumb

#

if (rLoc.getBlock().equals(Block /*air*/)) return;

#

even in 1.8 ?

#

and how do I make the equals block ?

#

do I use material ?

#

and what do I compare it to ?

#

as a material ?

#

I can't just put air

half leaf
#

could any1 help me?

trail oriole
#

okay thanks

half leaf
#

could u help? plz

#

yes?

#

import org.bukkit.block.Sign;

crisp steeple
#

i think the problem might be that for some reason the block state doesnt actually update instantly when you use block#setType, someone on the forums was having a similar issue just a few minutes ago and ive run into some stuff like that sometimes

half leaf
#

.

half leaf
#

uhm

#

that seems alot of work cuz i've just started in the spigot api 2 weeks ago

undone axleBOT
half leaf
#

alr

crisp steeple
#

if you do end up delaying it by a few ticks be sure you run any checks you made again, as it could be possible to exploit if you dont

half leaf
#

alr thanks guys

granite owl
#
main.getPlugin(main.class);
``` is this usage correct to get a reference to the plugin instance if my main class is called well main?
crisp steeple
#

no

granite owl
#

elaboration?

undone axleBOT
crisp steeple
granite owl
#

public static void registerRecipes(main plugin)
{}

crisp steeple
#

so why did you change it then?

granite owl
#

because its in a different class

#

in a static context

crisp steeple
#

🙃

#

yea

granite owl
#

my main class only contains the bukkit callbacks themselves

#

and then passes the vars to the actual functions

crisp steeple
#

what

granite owl
#

like this

#
    public void onEnable()
    {
        Bukkit.getServer().getPluginManager().registerEvents(this, this);
        
        Items.registerRecipes(this);
    }
crisp steeple
#

yes but you should try to avoid static abuse

granite owl
#

wel

#

well

trail oriole
#
@EventHandler
    public void onRespawn(PlayerRespawnEvent e) {
        Player p = e.getPlayer();
        p.teleport(new Location(p.getWorld(), -103, 121, -18));
    }```
#

I have this piece of code

#

no errors but doesn't teleport me on player's respawn

granite owl
#

wait

trail oriole
#

my listener is registered, i have other event handlers in it

granite owl
#

use this code

trail oriole
#

do I need to do a scheduler to delay it ?

crisp steeple
#

dont make static listeners

granite owl
#

u need to override the callbacks designated respawn location

crisp steeple
#

event isnt a callback

#

or wait

granite owl
#

xD

crisp steeple
#

in this case i think it is

granite owl
#

almost all events

#

are callbacks

crisp steeple
#

not rly

#

usually they just give info about the event then you can work with it

granite owl
#

almost all take manipulation in

crisp steeple
#

some are sure, but it just depends on the event

granite owl
#

whether its to cancel the event

#

or to relocate its destination

#

@trail oriole ur answer

#

sure

crisp steeple
#

do not use static listeners 🙃

trail oriole
#

agreed

crisp steeple
#

bruh what is User

trail oriole
#

thanks still

#

LMAO

#

event not user

crisp steeple
#

lol

granite owl
#

gl guys last time i didnt use a static context to outsource the events and wrote everything in the event method itself, it got too messy

#

you can write thousands of different functionalities into one and the same function

#

i wont

crisp steeple
#

lmao

#

saying static is not messy

granite owl
#

but creating instances of functions that have only one purpose isnt?

crisp steeple
#

"User" seems like a very good example of a class that definitely should not be static

#

you would want instances of each individual User

granite owl
#

also funny that u call me out for passing the event as parameter for certain methods

#

but i suppose you are aware that u dont pass the object

#

but only a pointer

#

xD

#

right?

crisp steeple
#

of course it can, in this case it definitely is not

granite owl
#

otherwise i couldnt even cancel the event

crisp steeple
#

static should never be used as an event handler