#help-development

1 messages · Page 1967 of 1

waxen plinth
#

So they're constant values?

sterile token
#

Yeah

#

That are assigned where you need to send the message

vague swallow
#

sorry my english is 💩

#

but it requires doubles. What do I need to do if I want to use Integer variables for the equation?

waxen plinth
#

It seems like you're saying two different things here

#

Which is it

#

Are they reassigned each time?

#

Or do they never change?

waxen plinth
#

(int) Math.pow(2, 1)

muted sand
#

what's really the benefit of NMS?
cant you already do everything in the spigot api itself?

waxen plinth
#

No

#

The spigot api can't do everything

muted sand
#

oh :(

sterile token
waxen plinth
#

Okay so they're not constant values

sterile token
#

Oh sorry my bad

waxen plinth
#

And {name} would evaluate to the name of the player, correct?

vague swallow
waxen plinth
#

So if my username is Redempt and the input text is hello {name}

#

Then the output would be hello Redempt?

sterile token
# waxen plinth And `{name}` would evaluate to the name of the player, correct?

You would decire (via code) which placeholders you want to add and then replace it with the value on a message

For example on my coins command i would need 2 placeholders to be able to use {target} and {coins}. So you would add it as follow

Placeholders placeholder = new Placeholders();
placeholder.set("{target}", target.getName());
placeholder.set("{coins}", String.valueOf(10));

Player#sendMessage(placeholder.replace(Config#getString("Coins-Message")));

waxen plinth
#

Man that is so overcomplicated

sterile token
#

Hmn why?

waxen plinth
#

And you also didn't answer my question

sterile token
waxen plinth
#

My god man

#

Yes or no

#

Would it be my username

#

Is it dependent on the player

sterile token
#

No

#

It doesnt depend on player

waxen plinth
#

So they're all global values detached from players

#

And {coins} would be what exactly?

#

Some global coin counter rather than the number of coins I have?

muted sand
#

are there like some sort of "docs" to see what function names i should override for nms?

sterile token
#

I explain

subtle vector
#

How do I change the angle of the fireball projectile im shooting. so when I left click instead of it going straight it would shoot left of the plus sign in the middle of the screen?

waxen plinth
#

Listen for the player punching it, it probably fires EntityDamageByEntityEvent

#

Then schedule a task to run the next tick which modifies its velocity

#

Easiest way is to rotate it 90 degrees around the y axis, there's a method you can use for it I think it's Vector#rotateAroundYAxis or something

#

It's rotateAroundY

sterile token
#

Let say my config looks like this and command:

Messages:
  Coins: "Player {target} have {coins} coins"
// Command should be /coins <target>

public boolean onCommand(sender, args[]) { // just an example
  if (args.lenght == 0) return true;
  OfflinePlayer target = Bukkit.getPlayer(args[0]);
  Profile profile = Main.getInstance().getProfiles().getProfile(target.getUniquedId());
  if (profile == null) return;
  Placeholders placeholder = new Placeholder();
  placeholder.set("{target}", profile.getName());
  paceholder.set("{coins}", String.valueOf(profile.getCoins()));
  sender.sendMessage(placeholder.toString(Config.getString("Messages.Coins")));
} 
#

There redempt you have an example

waxen plinth
#

...

#

So it is dependent on players

#

It does set their name

#

And it is their coin count

#

It's really hard to help you because I keep asking you questions and you keep telling me it's supposed to be doing something entirely different from what it is

sterile token
#

It doesnt dependent from player, its just to avoid being doing String.replace("{placeholder}", "value") on every message sent to player. I though doing a key-value which store it temporary, and then a method for replacing all placeholders in that message

sterile token
muted sand
#

paceholder.set()
hey look i found a bug!

sterile token
#

What?

sterile token
waxen plinth
#

The value that is set for the placeholders depends on the player it's being generated for

sterile token
#

yes

muted sand
#

i use build tools to decompile the jar and find stuff methods yes?

wet breach
wet breach
#

well the source for spigot

sterile token
muted sand
inland scaffold
#

Can I pay someone to make me a plugin that adds a upgradable pickaxe with many cool enchants

wet breach
#

?services

undone axleBOT
sterile token
muted sand
#

what's reflection?
or do i go to javadocs?

#

lol

sterile token
#

Just search on goggle "Java reflections"

muted sand
#

oh okay

sterile token
#

And it should be info there

wet breach
muted sand
#

oh
back to the docs i go then
ty!

sterile token
#

For using NMS you use Reflections

muted sand
#

oh..

sterile token
#

For example, to get the server version

#

Any good tutorial about regex i wanna check via regex if a string contains text between {}?

dapper sapphire
#

How do I set an armor slot to nothing?
this doesnt seem to be working

     ItemStack item = new ItemStack(Material.AIR);
     p.getInventory().setHelmet(item);
tall dragon
#

so just set it to null

sterile token
#

Oh thanks

#

Redempt sorry i didnt want to make you get mad

tall dragon
#

oh yea redempt should be furious now

waxen plinth
#

I'm just having a bad day

dapper sapphire
#

Why might this be running logging twice?

@EventHandler
    public void onPlayerInteractEntity(final PlayerInteractAtEntityEvent e) {
        final Player p = e.getPlayer();
        if (e.getRightClicked() instanceof Player) {
            final Player clicked = (Player) e.getRightClicked();
            String data = clicked.getPersistentDataContainer().get(new NamespacedKey(this, "costume"), PersistentDataType.STRING);
            System.out.println(data);
        }
    }
tall dragon
#

simple

dapper sapphire
tall dragon
#

your main hand, and your off hand

dapper sapphire
#

How might I avoid it logging twice?

waxen plinth
#
if (e.getHand() != EquipmentSlot.HAND) return;```
tall dragon
#

^

sterile token
#

^

storm crescent
#

Is there a way to force the player to rejoin?

waxen plinth
#

No

tall dragon
#

if that were possible i would have a server with thousands of players :D

storm crescent
#

I just need the server to believe a player has logged off and logged back on without the player actually having to relog

tall dragon
#

may i ask what for

#

sounds like a xy problem

storm crescent
#

to update the player's uuid

waxen plinth
#

Update how

#

Are you doing fucky stuff with GameProfile

sterile token
storm crescent
#

yes

waxen plinth
#

I've done that before

sterile token
#

Oh lol

#

Really?

waxen plinth
#

I just fired a PlayerQuitEvent and then a PlayerJoinEvent

#

Yes

sterile token
#

How much do you ask for coding?

waxen plinth
#

$20/hour

sterile token
#

Oh

waxen plinth
storm crescent
waxen plinth
#

Here's the code for that project if anyone wants to mess with it

tall dragon
waxen plinth
#

I haven't updated it for a long time so it doesn't work on the latest versions

storm crescent
#

The Player just returns null

tall dragon
#

like saving/loading data it has about players

sterile token
waxen plinth
#

Probably not much

waxen plinth
sterile token
#

Oh lmao i have never downloaded so fastest

#

haha

#

Redempt

#

I done something similar but with Sockets doing Handshake and Login

storm crescent
quaint mantle
#

I just started making my first plugin using Maven, and I just setup NMS. When I try to create a custom entity class (as seen below), "public class EntityNPC extends EntityZombie" has a error over it saying "'x()' in 'net.minecraft.world.entity.EntityInsentient' clashes with 'x()' in 'net.minecraft.world.entity.EntityLiving'; attempting to use incompatible return type" java public class EntityNPC extends EntityZombie { public EntityNPC(World world) { super(world); } }

ebon arrow
#

What do you guys use for website dev?

quaint mantle
#

I've tried just about everything I can, and the error still won't go away. I'm using IntelliJ, if that means anything

quaint mantle
#

Yes

#

I wrote the first 4 lines of code and it won't go away regardless of how much more information I add

sterile token
tall dragon
quaint mantle
#

Do you think there's a problem with my spigot build?

tall dragon
#

what version u working on?

quaint mantle
#

In my pom.xml I have 1.18.1-R0.1-SNAPSHOT in my dependencies

lost matrix
#

and IntelliJ for the backend stuff

tall dragon
lost matrix
#

Or RubyMine

quaint mantle
#

I'd rather not downgrade to an older version

dapper sapphire
quaint mantle
#

if that's possible

tall dragon
quaint mantle
#

I've googled it just about a thousand times, and can't find anybody else with the problem

#

so I did some more digging, and apparently I'm supposed to use the Mojang mappings on 1.17+

tall dragon
#

that could work but to my knowledge thats only to make coding using nms easier for you. it was never a requirement

wet breach
#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

tall dragon
#

i c

quaint mantle
#

So... What exactly does that mean?

#

I'm already using Maven, so I shouldn't really have to do anything, at least by my understanding

tall dragon
#

what ru depending on, in ur pom

quaint mantle
#

1.18.1-R0.1-SNAPSHOT

tall dragon
#

yw show the whole dependency block

quaint mantle
#
<dependency>
  <groupId>org.spigotmc</groupId>
  <artifactId>spigot</artifactId>
  <version>1.18.1-R0.1-SNAPSHOT</version>
  <classifier>remapped-mojang</classifier>
  <scope>provided</scope>
</dependency>
tall dragon
#

yh

delicate lynx
#

don't you need spigot-api?

tall dragon
#

i think this means u actually need to use spigot-api

quaint mantle
#

but then I can't use NMS

tall dragon
#

did you try?

quaint mantle
#

yeah, when I first started I used spigot-api but I couldn't make the entity

#

I guess I could try again, though

#

Yeah, I swapped it out and then it just says it can't resolve symbol on EntityZombie

tall dragon
quaint mantle
#

Yes

wet breach
#

what error do you have?

#

IDE errors are not exactly the same as compile errors just fyi

#

so what is the IDE complaining about?

wet breach
#

ah that

#

that is because of mappings if I am not mistaken

quaint mantle
quaint mantle
# tall dragon this

I'm sorry if I seem clueless, but what exactly about it are you referring to?

tall dragon
#

oh i was just replying to that message so he could read your error

terse panther
#

how can I add NMS dependecy to a gradle project? (no maven)

quaint mantle
#

Oh, ok

terse panther
wet breach
#

you need to use mojang mappings

quaint mantle
#

So just re-run buildtools with --remapped, right?

terse panther
wet breach
#

you would have gotten to this link here

sterile token
wet breach
#

read the NMS portion it is applicable to 1.18

wet breach
sharp flare
#

solved

#

acts like trident with loyalty but for armorstands

ebon arrow
storm crescent
#

Does anyone know which EnumPlayerInfoAction is ADD_PLAYER and REMOVE_PLAYER for 1.17.1?

dapper sapphire
#

How do I use NBT data?

worldly ingot
#

Entity covers entity NBT, ItemMeta covers ItemStack NBT, and BlockState covers tile entity NBT

#

PersistentDataContainer for all of those types covers custom NBT

dapper sapphire
#

How I would I go about assigning a string to a book using NBT?

paper zealot
worldly ingot
#

ItemMeta#getPersistentDataContainer()

#

From there you have set() methods

dapper sapphire
#

Thank you

dapper sapphire
paper zealot
#

script

#

or just java

#

idk

dapper sapphire
#

Um I cant help you sorry, Just look up a tutorial or something.

paper zealot
#

okay

hasty prawn
#

?learnjava

undone axleBOT
quasi patrol
#

What type of error would I need to catch when attempting to set a player variable to a player who is not online?

young knoll
#

Hmm?

hasty prawn
#

Huh

#

Probably just need to check if it's null.

young knoll
#

Bukkit.getPlayer returns null if they aren't found ^

quasi patrol
#

Oh.

waxen plinth
#

pretty non-optimal honestly

#

it should just stop the server if the player isn't found

sterile token
#

Oh nice

#

Im having an issue

#

That it doesnt throw any exception btww

#

Never happen, please Jesus...

sterile token
#

?

#

What?

#

Its amazing having an issue without any Exception thrown

#

Oh its throwing NPE. Lmao plugin.yml has command registered

#

I dont find any cause why getting NPE, cuz command its registered on plugin.yml and via getCommand() method

#

What do you think?

#

I dont find any reason

hexed hatch
#

commands is misspelled

sterile token
#

OH

vast junco
#

How can I get the actual damage an item will inflict on a player (listening to EntityDamageByEntityEvent)?

sterile token
young knoll
#

getFinalDamage

storm crescent
#

Does anyone know why changing the uuid of a player by changing the UUID field in Entity causes some plugins to always return Player as null?

young knoll
#

Because you are doing something very hacky

storm crescent
#

For some reason only a select few plugins return Player as null, the rest work as intended

sterile token
sharp flare
#

Haven't heard watchdog but whats that

sterile token
young knoll
#

That’s fairly common rather than holding a player instance

sterile token
#

It based on NPC that get moved around you if detect extrange activity or always i dont know

#

I just know that sometimes it get bug and you can see the entity moving around you

sharp flare
#

oh I see

sterile token
#

But i think every anticheat its bypassable

sharp flare
#

but thats for armorstands, can work with npc's ig

sterile token
#

Imagine i bought a +60 dollars anticheat im still figthing again DMCA to get my money back. Because the anticheat its so good that doing a simple ping-spoof you can disable checks

sharp flare
#

I barely use nms if I really need it I have to learn it again lol

#

yeah not all anticheats are 100% protection

sterile token
#

Yeah but imagine paying 60 dollars for a shit

storm crescent
sharp flare
#

most of them are aggressive and mostly false positives

sterile token
#

That get me mad, because with that money and a bit more. I could bought a custom one and better

sharp flare
#

or make your own

sterile token
#

I dont know how they works

#

I only know they works over packets

young knoll
#

Good luck

storm crescent
#

Alright, thanks

sterile token
#

Just for curious

storm crescent
#

this way all plugins will store data to the seperate uuid instead of the player itself

sterile token
#

Why?

young knoll
#

Honestly it seems quite neat if it ever works

#

But I wouldn’t count on it

sharp flare
#

feels like singleplayer game saves

sterile token
#

I would do a custom Object for each player and save there the custom data there

storm crescent
sterile token
#

And of course using DB for persisting it

sterile token
#

i didnt understand

storm crescent
#

Its like a save file that allows all plugins to save data under a specific save file

#

this way players can go back and forth between different save files or restart if they wish

sterile token
#

Hum looks that its not working, the player its not being registered on PlayerList

#

But on tab i can see it Hahaha

sharp flare
sterile token
#

prob for using plugin message channel without player, i will inject it via Socket, doing Handshake protocol

storm crescent
#

Everything works fine currently except for the select few plugins that have broken getPlayer methods

sharp flare
#

u using db for it?

storm crescent
#

Yes

sharp flare
#

what db

storm crescent
#

MySQL

young knoll
#

Pick one of the broken plugins and look at the source I guess

sterile token
#

You are using a custom Object and DB but with different uuid, its the same as doing it using their uuid

sharp flare
#

oh mySql, still learning that currently this semester

young knoll
storm crescent
#

I took a look at one of the source code of one of the plugins and found that the player join event getPlayer method returns null

sterile token
storm crescent
#

Cannot invoke "org.bukkit.OfflinePlayer.getUniqueId()" because "player" is null

#

the player parameter is passed through a join event where it gets event.getPlayer

sterile token
#

I would recommend doing a custom Offline Player object and Player object

#

Wouldnt be better than using OfflinePlayer from bukkit?

storm crescent
#

It might but the issue is I can't modify this since its not my plugin

storm crescent
#

I'm just looking at the source code

sharp flare
#

what plugin is it

storm crescent
#

I'm not actually using the API or any methods of the plugin

#

BetonQuest

#

and VoxelSniper

sterile token
#

What are you doing?

storm crescent
#

but I'm currently trying to figure out BetonQuest

sterile token
#

A custom Data system

storm crescent
#

Yep

sterile token
#

And then?*

storm crescent
#

A custom data system that saves data to multiple player save files rather than the player itself

#

so a player could have 5 save files and swap between them

#
        return player.getUniqueId().toString();
    }``` most of the errors seem to have to do with this method
sharp flare
#

does it save inventories too?

storm crescent
#

Yes

#

it saves inventories balances custom currencies etc

#

basically anything that plugins can save

sterile token
#

This is one of the big problem when trying to use custom system. You have to adapt other plugins or code custom ones

#

🥵

storm crescent
sterile token
#

He?

#

You cannot save data with name

#

Player name can change, uuid its unique

young knoll
#

I mean

waxen plinth
young knoll
#

I think you’ve all missed the point

storm crescent
young knoll
#

They are changing the actual UUID of the EntityPlayer

waxen plinth
sterile token
waxen plinth
#

No but it would be pretty trivial to make it support json

sharp flare
#

why change the actual uuid

waxen plinth
#

I dunno why you would use json for config though

sterile token
#

Idk why

#

I dont find any reason

sharp flare
#

you can store a primary key for them instead since u use a databse for it

sterile token
#

Oh i love networking, bungeecords telling me enable ip forward, ip forward its enable. HAHAH. TThis is the real life

sterile token
storm crescent
waxen plinth
#

You can have a composite primary key

#

It's not the same as having two primary keys

sharp flare
#

you use their api for it, might be for listeners or handlers

sterile token
#

I ask because i see that people for saving for example player log, they save each log on a log_table and the primary key is log_id and uuid

#

And then idk how they link the profile save on other table with log

#

A complete mess for me

#

That why im #Mongo, just saving and parsing objects

waxen plinth
#

Mongo is the python of databases

sterile token
#

Explain reference, i dont understand OOP explanations

waxen plinth
#

no

vast junco
#

Is it possible to extend an event? I want to create a new method that slightly changes the logic of EntityDamageEvent#getFinalDamage()

waxen plinth
#

You can but if you want it to be heard by listeners of EntityDamageEvent then you will need to use its handler list

waxen plinth
#

Every event class needs to implement public HandlerList getHandlers() and public static HandlerList getHandlerList()

#

Just make these both return the HandlerList for EntityDamageEvent, which you can get with EntityDamageEvent.getHandlerList()

sterile token
#

Could custom plugin make proxy server telling?

pine island
#

is there a eventListner for when a command is issued?

sterile token
#

Go to package: org.bukkit.events

pine island
#

yeah

sterile token
#

And you have all the events there

#

Its called PlayerCommandProcessEvent or something like that

#

Search it on the docs

pine island
#

nice i dint know there was a doc for events

vast junco
valid solstice
#

java.lang.NullPointerException: Cannot invoke "java.util.List.equals(Object)" because "lore" is null

@EventHandler
    public void onClick(PlayerInteractEvent e){

        if(e.getPlayer().getInventory().getItemInMainHand().getType()==Material.AIR){
            return;
        }

        List<String> lore = e.getPlayer().getInventory().getItemInMainHand().getItemMeta().getLore() ;

        if(lore.equals(WurskiesAxe.wurskiesAxe.getItemMeta().getLore()) && lore!=null){```

anybody know what i'm doing wrong here?
sterile token
valid solstice
#

i just need help with determining my mistake

sterile token
#

If you are just starting i would straight recommend first learning the basics about Java. I tell it cuz from personal experience

valid solstice
sterile token
#

(lore.equals(WurskiesAxe.wurskiesAxe.getItemMeta().getLore() == null) return;

#

Try that

#

Wait i will refactor so you understand

pine island
#

im making a small plugin that sends the command that got issued by ops to avoid cheating in my smp, what would be better for that use case

waxen plinth
vast junco
waxen plinth
#

I thought you wanted to fire it and have it be listened to by all the same event listeners that get EntityDamageByEntityEvent

#

If that's not the case then make a new HandlerList and keep it in a static field, and just return that from the two methods

sterile token
#
@EventHandler
public void onClick(PlayerInteractEvent e){ 
  if (e.getPlayer().getInventory().getItemInMainHand().getType() == Material.AIR) return;
  List<String> lore = e.getPlayer().getInventory().getItemInMainHand().getItemMeta().getLore() ;
  if (lore == null) return;
  if (!lore.equals(WurskiesAxe.wurskiesAxe.getItemMeta().getLore())) return;
  
  // rest code
#

Try that

valid solstice
#

alright

vast junco
sterile token
#

Do you know what happening? I already defined the fake entity

vast junco
sterile token
valid solstice
valid solstice
#

yup seems to be working ty

sterile token
valid solstice
#

but theres another problem

#

but i can fix it

sterile token
#

I think the problem was that you where doing .equals before checking if lore was null or not

sterile token
#

Omg i would love to have the experience of developers

#

That they read 2 hours something new and they are done to do whatever they want

pine island
#

i want to check if the sender is console any idea?

river oracle
#

if(sender instanceof ConsoleCommandSender)

pine island
#

wait that wont work because sender is event.getPlayer()

waxen plinth
#

Or if (!(sender instanceof Player))

#

lol

#

What event is this

vast junco
#

maybe sender.equals(Bukkit.getServer().getConsoleSender())

pine island
#

PlayerCommandPreproceesEvent

river oracle
#

there is a seperate event for console

waxen plinth
#

PlayerCommandPreprocessEvent

pine island
#

yeah

waxen plinth
#

You want ServerCommandEvent

pine island
#

ohk

#

tysm

#

found it

vast junco
# waxen plinth **Player**CommandPreprocessEvent

I still haven't figured out extending EntityDamageByEntityEvent, I want my custom event to fire whenever EntityDamageByEntityEvent fires, but setting the handlers to the same thing as the parent class didn't work

waxen plinth
#

Please stop pinging me

#

If you're trying to get your event to fire instead of the regular EntityDamageByEntityEvent whenever EntityDamageByEntityEvent is fired, that's not gonna work

#

If you want to fire your event independently on its own handler list then you need to call Bukkit.getPluginManager().callEvent(your event here) whenever you want to fire it

river oracle
pine island
#

will this check case?

midnight shore
#

Get the args and say equalsIgnoreCase

pine island
#

that wont workfor that case

quasi patrol
#

I'm trying to use discord4J in my spigot minecraft plugin, but the server the plugin is in stops loading discord4j loads.

midnight shore
tardy delta
#

If you use equalsignorecase Will /BAN work?

pine island
#

this should be better

tardy delta
#

Because the command itself is registreredr lowercase

pine island
#

its a event

tardy delta
#

Why not just making a command instead of listening for the command event lol

pine island
#

huh no this will check if a command is issued it to avoid cheating in my smp

solemn valley
#

Is there any way to get Spigot permissions/prefixes into a BungeeCord plugin?

#

Using LuckPerms that is

solemn valley
#

not into Spigot

sharp flare
#

im not referring to your chat

solemn valley
#

oh sorry

quiet ice
#

You'd likely need to communicate via Plugin packets

solemn valley
quiet ice
#

Yes

solemn valley
#

Hm

#

Alright I'll try- but there wouldn't be any easier way right?

quiet ice
#

Perhaps some already Made Plugins, otherwise no

solemn valley
#

that I need to get

quiet ice
#

Bukkit and spigot have integrated Support for that

solemn valley
#

Oh

#

Plugin messenger?

quiet ice
#

Just Look Up Plugin channels

lost matrix
solemn valley
#

I just need like a doc link or something

quasi patrol
wet breach
# solemn valley I've never done Plugin Messaging before so I'm kinda stuck... How do I get a mes...
tardy delta
chrome beacon
#

There are multiple

tardy delta
#

Oh

lost matrix
#

Thats also one. Discord uses http requests in their API. Usually you dont want to manually tinker with requests so people write wrappers so you can just call methods.

desert tinsel
#

when i load my plugin, the .yml files have generated, but not enabled, i need to save the files manual and reload the plugin, and after the files have enabled, why?

chrome beacon
#

🤷‍♂️ Show your code

desert tinsel
desert loom
#

what do you mean by enabled?

desert tinsel
#

when i use a command with a message from file, i get an error

chrome beacon
#

Looks to me like you're loading then saving

#

You need to do the opposite

sharp flare
golden kelp
#

hello guys, how to give the player a spawner which spawns an entity (I want to give the spawner of a random entity)

tender shard
#

IIRC there's no thing as SpawnerMeta. You'll have to add some PDC tags yourself to store the entitytype, then listen to BlockPlaceEvent and change the placed spawner's BlockState to spawn the correct entitytype (CreatureSpawner#setSpawnedType())

golden kelp
#

frick

drowsy helm
#

^ use nbt then change the entity type on place

chrome beacon
#

You have two options;
1... What mfnalex said
2. Use NMS and modify the item

tender shard
#

Why NBT if PDC exists

golden kelp
#

what is PDC

tender shard
#

NMS isn't needed too

drowsy helm
#

same deal

tender shard
drowsy helm
#

persistent data container

chrome beacon
#

?pdc

tender shard
#

you can use that on the spawner's ItemMeta to save e.g. the EntityTypea s String

dire marsh
#

inb4 1.8

faint aspen
drowsy helm
#

can you show all your code stefan?

dire marsh
#

@faint aspen are you trying to move it whilst a player is inside it

drowsy helm
#

i have a feeling you are constantly applying a -1 velocity

faint aspen
#

yeah

#

exactly^^

#

But what other way can you make an minecart drive the opposite direction?

drowsy helm
#

yeah its repeating

#

so you are constantly putting it back and forth

#

you only want to apply the velocity once

tender shard
drowsy helm
#

yeah thats true

faint aspen
#

yeah

tender shard
#

I don't think you can easily do that

#

unless you also keep track of the direction the player is looking and the direction they were looking when the cart started to move

faint aspen
#

and you would have a problem when there is a turn

drowsy helm
#

you could cancel the player input

#

not sure of the event for that though

tender shard
#

there's only vehiclemoveevent and that can't be cancelled

#

and it also doesn't have any method to get the "input"

#

I don't think there's a proper way to do this imho

drowsy helm
#

yeah it seems complex

faint aspen
#

okay thanks anyways guys^^

tender shard
#

I wonder what you need it for 😛

#

(MAYBE paper has some events that you'd use)

faint aspen
#

Em it should be a railroad where the player can be transported and there should be two direction the arriving and the leaving railroad so. Thats why I need the minecart to take the opposite direction sometimes

tender shard
#

hm I guess you'll have to forget that idea 😦

faint aspen
#

😦

#

xD

tender shard
#

also just checked paper's docs and there's nothing helpful in there either

drowsy helm
#

i mean you can keep track of the "front" of the minecart and ensure its velocity is in the right direction

#

but it would be pretty hard

tender shard
drowsy helm
#

yeah

#

idk seems pretty hard

tender shard
#

well probably the slowing down delta-v for pressing W is always a fixed rate

#

but then again the cart could be going upstairs, downstairs, or have a changed maxspeed, etc etc

#

btw why do I keep hearing stuff about 1.18.2

#

are they actually going to release 1.18.2 before 1.19?

golden kelp
tender shard
golden kelp
#

I think u can give the player a spawner with some tag I think

drowsy helm
tender shard
#

hm maybe you can use a BlockStateMeta

drowsy helm
#

according to this you can do it

tender shard
#

yeah I think I am stupid

#

you can probably just get create an itemstack of CreatureSpawner

#

cast it's meta to BlockStateMeta

#

cast the BlockState to CreatureSpawner

#

then change it easily

#

I'll see if it works

golden kelp
#

please let me know if it does

tender shard
#

somehow it still only uses pig spawners

#

seems like you always manually have to set the type when placing a spawner

#

yeah I got it working but as said it requires a listener on blockpalceevent

#
    @EventHandler
    public void onSomething(PlayerInteractAtEntityEvent event) {
        ItemStack spawnerStack = new ItemStack(SPAWNER);
        BlockStateMeta meta = (BlockStateMeta) spawnerStack.getItemMeta();
        CreatureSpawner spawner = (CreatureSpawner) meta.getBlockState();
        spawner.setSpawnedType(event.getRightClicked().getType());
        meta.setBlockState(spawner);
        spawnerStack.setItemMeta(meta);
        event.getPlayer().getInventory().addItem(spawnerStack);
    }

    @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
    public void onPlace(BlockPlaceEvent event) {
        if(event.getItemInHand().getType() != SPAWNER) return;
        EntityType type = ((CreatureSpawner) ((BlockStateMeta)event.getItemInHand().getItemMeta()).getBlockState()).getSpawnedType();
        Bukkit.getScheduler().runTaskLater(this, () -> {
            ((CreatureSpawner) event.getBlockPlaced().getState()).setSpawnedType(type);
        },1);
    }
#

@golden kelp

golden kelp
#

Sorry What? Village? Did you mean Population to 10 billion?

tender shard
#

did you see the code I've sent?

#

the second listener "onPlace" makes your custom spawners actually work

#

by default you CAN give yourself spawners with a custom entitytype, but when placing those, it'll still be a pig spawner

#

that's what the onPlace listener is for

golden kelp
#

Yea I saw it, u big brain 100%

#

Btw, How do I spawn a chest with an ItemStack in it?

tender shard
#

into the world?

#
  1. set some block to Material.CHEST
  2. get the BlockState of that blocK
  3. cast it to Container, or Chest
  4. use getInventory() on that one
golden kelp
#

ook ty

#

Whats the class for Trapped Chest?

tender shard
#

you can just cast the blockstate to container

golden kelp
#

Aight

tender shard
#
    @EventHandler
    public void onChest(PlayerInteractEvent event) {
        if(event.getAction() != Action.LEFT_CLICK_BLOCK) return;
        if(event.getHand() != EquipmentSlot.HAND) return;
        Block block = event.getClickedBlock();
        block.setType(TRAPPED_CHEST);
        Container container = (Container) block.getState();
        container.getInventory().addItem(new ItemStack(DIAMOND));
    }
golden kelp
#

Thanks for spoon feeding twice in a row 😂

tender shard
#

i'm bored lol

golden kelp
#

Are u

#

want a plugin idea, i want to make it but I barely get any time

tender shard
#

feel free to post it lol

golden kelp
#

So 8 players can join a game and its a 9x9 square in the ground with stairs on each side & all of the players are teleported into a stair each (giving a chair like look) & theres a item frame in the middle which rotates and selects a random player, which has to do something (that something is decided by the player infront of the player who got selected)

I suck at explaining 😅

tender shard
#

sounds a bit like truth or dare or "spin the bottle" lol

golden kelp
#

Yep

#

"inspired"

midnight shore
#

Hello guys how Can you change the error message that appears when a server is not working in minecraft?

golden kelp
#

When its offline?

midnight shore
#

Yes

tender shard
#

when it's offline, it's offline

#

there must be some server running to send a motd / other message

#

you could just put your server behind a proxy like bungee, waterfall or velocity

#

then use that to send a message

#

but ofc that requires the proxy to be running

midnight shore
#

The server seems offline

valid solstice
#

Does Player#damage() bypass the resistance potion effect and armor resistance? or do they factor in those...?

tender shard
midnight shore
#

Okay

tender shard
#

you can use LivingEntity.damage(entity) to make one entity damage anotherone while also calculating potions effects etc

valid solstice
tender shard
valid solstice
#

oh i see what you mean

tender shard
#

you'll want to use sth like this

valid solstice
tender shard
#

yeah

valid solstice
#

tysm

tender shard
#

but yeah that only works if you have another entity that should deal the damage

tender shard
#

e.g. you can't use it for fall damage

#

because then you only have the victim entity but no attacker entity

valid solstice
#

another entity should deal the damage

tender shard
#

okay then use entity1.attack(entity2)

valid solstice
#

oh

valid solstice
#

like they'll swing their sword

tender shard
#

no

valid solstice
#

i'm confused

tender shard
#

it only calculates the dmage that would have been dealt if it would actually use their sword

#

and then deal that damage

valid solstice
#

ahhhhhhhhhh

tender shard
#

but you can also just call entity1.swingMainHand

valid solstice
#

alright i see

#

thanks man

tender shard
#

np

valid solstice
#

gonna try that out

valid solstice
#

since Player#damage, you can modify how much damage it does

#

i'm not sure about .attack()

tender shard
#

I don't think so. You could listen to EntityDamageByEntityEvent and customize it there, maybe

valid solstice
#

oh. alright. Thanks

chrome beacon
#

World is not an object

#

You did that right the first time

#

Then you need to add pitch and yaw

golden kelp
#

How to give the player a random lingering arrow

chrome beacon
#

Use your F3 screen to find them

chrome beacon
golden kelp
#

ok ty

tender shard
#

what don't you understand?

golden kelp
tender shard
#

PotionMeta potionMeta = (PotionMeta) yourPotionItemStack.getItemMeta()

midnight shore
#

Guys I have a problem, I added a team with a prefix and it works but it doesn’t show up in the tab list

#

Any idea?

chrome beacon
#

Oh I forgot to specify that it should be cast to potion meta

midnight shore
#

You add two commas and in the first you specify the yaw and in the second the pitch

#

To find out north you could to to mc, open F3 and look to north, then copy the two values that change when you move your head and you are good to go

golden kelp
manic furnace
#

When i have to cache some data in my plugin when the server starts, should i do that onEnable or onLoad?

grim ice
#

its a few seconds of research, he just helped him

olive oracle
#

How would I implement a cron-style scheduler into a plugin that runs a task asynchronously?
Would something like cron4j work fine?

grim ice
#

oh actually he helped you, anyways

midnight shore
manic furnace
#

Ok

lost matrix
young knoll
#

Oh my god it just clicked that 4j is for java

lost matrix
lost matrix
#

Im not quite sure what that means. When does the effect occur? Honestly never heard of a shake effect...

grim ice
#

Impossible

#

or actually maybe it is with packets

#

or

#

cancel damage event

midnight shore
grim ice
#

then setHealth()

#

or try .damage()

lost matrix
#

Do you mean the knockback?

grim ice
#

@lost matrix nah ur screen shakes when u get damaged

lost matrix
#

Ah i see. That is client side. There might be a workaround with just reducing the health instead of damaging the player.

grim ice
#

yes which is what i said

#

or maybe there is a packet sent to the client when damaging, cant u just stop it from sending

lost matrix
grim ice
#

speak your native language that might be better

#

or use google translator

lost matrix
#

Do you mean programmatically?

#

Have you tried just cancelling the damage event if the cause is FALL_DAMAGE?

midnight shore
#

You could cancel the event and subtract the desired amount of damage from the player’s health

golden kelp
#

How to give the player a random enchanted book

lost matrix
#

Generate a random enchanted book -> add it to the players inventory

golden kelp
#

How to generate a random enchanted book then

grim ice
#

ENCHANTMENT enum

dusk flicker
#

with a Random

grim ice
#

ThreadLocalRandom, get an int between 0 and ENCHANTEMENT Enum size

lost matrix
golden kelp
#

Where do u specify the ENCHANTMENT enum to the item stack?

grim ice
#

then u cant do what u want

#

its client side not smth u control

#

make a mod

#

if u want that

midnight shore
#

This does cancel every single type of damage a player could get

grim ice
#

thats if its not possible with packets

midnight shore
#

Ok so that’s right sorry

grim ice
#
public static ItemStack addEnchantment(ItemStack item, Enchantment enchant, int level, boolean ignoreRestriction){
        ItemMeta itemMeta = item.getItemMeta();
        itemMeta.addEnchant(enchant, level, ignoreRestriction);
        item.setItemMeta(itemMeta);
        return item;
}``` @golden kelp if ur lazy
golden kelp
#

Hell yea I am

grim ice
dusk flicker
#

?spoon

undone axleBOT
#

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

golden kelp
#

i didnt ask for it, neither am I a noobie

grim ice
#

gave them 4 lines of code

#

pointless

dusk flicker
#

No idea of context, all I saw was you giving someone code in what it seemed like that would solve their issue, which is generally defined as spoonfeeding

grim ice
#

he did it for every damage cause, by not checking for it and it still didnt do what he wanted (removing the shake effect)

grim ice
#

and imo it isnt spoonfeeding, he just used the time he could spend in google in discord

dusk flicker
#

alright, I really dont care to argue about something this stupid ¯_(ツ)_/¯

grim ice
#

Look at his code

#

he will ask you how to get "Entity" when he asks that it doesnt work then u tell him that its just a class name and u have to invoke the method from the event to get the entity after saying that instaceof doesnt work too (thats if he doesnt get autocomplete suggestions by intellIj tho)

#

prob gotta fix it before that happens

#

what did I say

dire marsh
#

learn java and spigot api

#

stop doing ctrl c ctrl v

grim ice
#

literally predicted it :o

golden kelp
#

What to use instead of ItemStack#setDurability as its deprecated

dire marsh
#

Damageable

grim ice
#

^

dire marsh
#

cast the item meta to that

#

though I kinda hate how it works, cause there's also entity damageable interface, and it's just meh..

golden kelp
#
ItemStack crossBow = new ItemStack(Material.CROSSBOW, 1);
Damageable damageable = (Damageable) crossBow.getItemMeta();
damageable.setDamage(1);

Btw will this set the damage to zero (meaning TOTAL DURABILITY - 1) or Set the durability to 1

vital yacht
#

Material.isInteractable()

sturdy finch
# vital yacht Material.isInteractable()

Oops, accidentally deleted the message.
Posting original message for posterity.

Does anybody know of a way to detect if an interactable block was right-clicked?
Or if there's an easier way to detect if an item was equipped when right-clicking, i.e. not consumed by e.g. right-clicking a door/chest or similar.

Thank you, will try 👍

vital yacht
#

Np

dire marsh
#

was wondering why so many messages were being deleted lol

ivory sleet
sturdy finch
vital yacht
ivory sleet
vital yacht
#

How are you doing?

burnt current
#

Short question: does somebody know a good tutorial for making a texture pack in 1.16.5 with models and textures for items which depend on the items or blocks name? For example you rename a gold ingot to "coin" and it has a coin texture.

ivory sleet
vital yacht
#

I’m doing pretty good, I’ve actually had more time to code lately

vital yacht
ivory sleet
burnt current
vital yacht
#

I’m trying to start some web development, can’t design for my life though

vital yacht
burnt current
#

1.16.5

vital yacht
#

You can use custom model data then, I’ll see if I can try to find a tutorial

ivory sleet
#

Lol web dev frontend I feel you

#

What framework do you use?

vital yacht
vital yacht
ivory sleet
#

Oh backend, still pog

vital yacht
#

Yeah no front end framework lol

burnt current
#

thank you

vital yacht
#

Just plain css/js for now

ivory sleet
#

Ah fair

vital yacht
ivory sleet
#

If you like Java, then angular might suit you in frontend

vital yacht
#

I want to be able to be good at plain css first

vital yacht
#

Thank you

ivory sleet
vital yacht
#

My websites always look terrible though lol

ivory sleet
#

hmm yeah same

#

tho I did take some courses in ux and ui

vital yacht
#

Did you do a Udemy course or something?

ivory sleet
#

no the courses I "took" was just reading some conventions on insta

vital yacht
#

Lol

ivory sleet
#

yeah

burnt current
lost matrix
burnt current
#

yeah but im not sure how to set the custom model data

lost matrix
#

with the method setCustomModelData(int)

main dew
#

How can I check if a player is in a block? (for example to check whether a block can be placed there)

lost matrix
main dew
#

honestly, I was more interested in checking a specific entity but I will try thanks

lost matrix
#
  public boolean hasEntitiesInside(Block block) {
    BoundingBox box = BoundingBox.of(block);
    World world = block.getWorld();
    return !world.getNearbyEntities(box).isEmpty();
  }

A bit like this

main dew
#

thanks I wouldn't expect something like this to exist 😅

worldly ingot
#

I believe Block#getBoundingBox() exists too

#

In lieu of BoundingBox#of()

#

They accomplish the same thing, but yeah

tender shard
worldly ingot
#

No

#

This isn't exact as some blocks Stairs contain many bounding boxes to establish their complete form. Also, the box may not be exactly the same as the collision shape (such as cactus, which is 16/16 of a block with 15/16 collisional bounds).

tender shard
#

well okay but it's still different from BoundingBox.of, which always rerturns 1x1x1

hasty prawn
#

Pretty sure Alex is right though isn't he? That would return a different bounding box for a fence to approximately get it's actual shape.

tender shard
#

I am right that block.getBoundingBox returns "roughly" the block's hitbox and that BoundingBox.of is always 1x1x1

#

but it's not the "exact" hitbox

hasty prawn
#

yes

midnight shore
#

Hi! I added https://wiki.citizensnpcs.co/API repository and dependency to my pom.xml but when i try to access CitizensAPI it returns null

API

Citizens has an extensive API that can be used for making your plugins work with NPCs or even for adding a brand new character that can be attached to an NPC. Make sure you always are using an up-to-date build of the CitizensAPI to ensure that your plugin works with the latest release of Citizens.

dusk flicker
#

Recommend you contact Citizens rather than here

#

They can help in a lot more depth

tender shard
#

did you add citizens as depend to plugin.yml ?

midnight shore
#

i don't know if i done everything right

midnight shore
midnight shore
tender shard
#

did you add <scope>provided</scope> to the dependency section?

lost matrix
midnight shore
midnight shore
tender shard
lost matrix
#

All good your scope is fine

tender shard
#

which you already have

#

are you sure that CitizensAPI is null? Because since it's a class, I doubt it can be null at all

#

what exactly returns null?

midnight shore
#

i mean i can't access it

#

sorry

tender shard
#

what's the error?

midnight shore
tender shard
#

did you click the maven reload button?

midnight shore
#

wait!

#

i found it

#

now it works

tender shard
midnight shore
#

ty

tender shard
#

np

sacred mountain
#

i just

#

ctrl shift O

tender shard
#

not everyone remembers all those fancy shortcuts 😛

#

(especially if they didn't know a reload button even exists)

#

hm ctrl+shit+o doesn't do anything for me anyway

#

weird

#

is it in the default keymap? because all I did was assign "run maven build" to alt+shift+p

worldly ingot
#

Organize imports in Eclipse

#

Not related to Maven, likely confused ;p

tender shard
#

in idea, ctrl+alt+o is optimize imports

#

so we finally found out why idea is better than eclipse - it makes your shift key live longer

maiden briar
#
public String format(CommandSender sender, MessageValueMap values) {
        String returnType = format(CommandSenderType.valueOf(sender), values);
        System.out.println("returnType " + returnType);
        return returnType;
    }

    public String format(CommandSenderType senderType, MessageValueMap values) {
        System.out.println(rawMessage);
        if (nullMessage)
            return null;

        StrSubstitutor strSubstitutor = new StrSubstitutor(values.getMessageValues(senderType), "%(", ")");
        System.out.println(strSubstitutor);
        String format = strSubstitutor.replace(rawMessage);
        System.out.println(format);

        if (senderType != CommandSenderType.PLAYER)
            format = ChatColor.stripColor(format);

        return format;
    }

In the first method I print the return value of the second method. The print statements in the second method are not called?

hasty prawn
maiden briar
#

No

hasty prawn
#

CommandSenderType is an enum right? Because that valueOf() call is odd if it is.

maiden briar
#

Yes

hasty prawn
#

I'd imagine that's where your problem is.

maiden briar
#

Ohh the method gets overriden in another class

#

That is the problem

dry pike
#

Looking to freeze a player without canceling move event for efficiency. Is there a way to attach a player to an invisible armorstand?

tall dragon
tender shard
#

people associate "playermoveevent" with laggy because some plugins do weird shit in it

#

doing simple stuff like cancelling it is like nothing for the server

tall dragon
hasty prawn
#

what if I want to calculate the sqrt of a random number 10000 times when the player moves hypixel_sad

tender shard
tall dragon
#

no indeed that should be fine

dry pike
#

I assumed it would considering if the player can be trying to move and it would be canceling 20 times a second, now add another frozen player, and so on

tender shard
#

yeah but just imagine what happens every tick anyway for every player

#

every player that moves causes collision checks, entity AI to do some things, etc etc etc

hasty prawn
#

The event is being fired regardless if you're listening to it or not.

tender shard
#

on every single tick

dry pike
#

Ok

tender shard
hasty prawn
#

Probably not

tender shard
olive lance
#

Eh I will still refrain from doing checks on player move event if I can help it

tender shard
#

alternatively set the movement speed to 0 and teleport them back to their original location every other second

olive lance
#

Most of the time there is another way such as that

tender shard
#

but tbh I guess that cancelling the move event will be better for TPS than allowing players to move

hasty prawn
#

Honestly yeah

granite pilot
#

if the server doesn't calculate anything further regarding the player's movement ^

olive lance
#

True

granite pilot
#

performance boost: stop everyone from moving every so often.

olive lance
#

What does it look like to the client when you cancel the movement event

lost matrix
#

With 100 players being frozen, all spam moving, you would have 100 hash table checks per tick.
Lets assume the hashCode impl of player is really bad and it takes 5us for one check.
Then this would result in 500us or .5ms which is about 1% of your tick. Thats your worst case scenario.

tender shard
#

something like this would be funny

@EventHandler
public void onCancellable(Cancellable cancelleble) {
  if(randomInt <= 10) cancellable.setCancelled(true);
  getLogger().info("Reduced lag by 10%!");
}
olive lance
#

Alright get this though

hasty prawn
#

100 players being frozen seems like a lot too, if you needed everyone frozen you wouldn't even need the hash table at all.

lost matrix
tender shard
tender shard
olive lance
#

I have 100 factions with 4 claims each making 400 claims and the claims are in a list inside the faction. How much would performance get hit if I checked for being inside the bounding box of every single claim and continuing when one is found, notifying the player they have entered a claim

#

On movement event

tender shard
#

just imagine you have 100 worldguard regions and 100 players

#

that must somehow result in up to 10k checks per tick

#

and not even that causes lag

lost matrix
tender shard
#

what does it do now?

olive lance
#

Yeah I feel like worldguard is more efficiently coded than my plugin

lost matrix
#

State of the art now is using chunks as buckets

tender shard
#

I really wonder if that's better

#

checking for locations is basically just if x > x2, && x < x3, ...

lost matrix
#

It is far better. Because now you only need to check all regions that are intersecting a chunk.
And when will you have more than 5 regions in a single chunk?

tender shard
#

I‘ve seen servers doing strange things

#

Treefarm = 1 large region

#

Every spot where a sapling is supposed to be planted = another region

dry pike
#

Thanks for the debate, helps me understand haha

tender shard
#

So about 1001 regions for a 1000 tree farm

#

Lol

rough drift
#

so i have the need to make an item have a texture unless it already has one, is there a way i can merge a resource pack into an existing one (if it exists, otherwise just send it) when the client joins

lost matrix
#

Still a big diff if you check all 1000 boxes or only the 10 boxes in your chunk

tender shard
#

I just wanted to say some people are weird enough to have more than 10 regions per chunk

rough drift
tender shard
#

what I still don't understand is...

#

the city's admin would have to manually add persons to all the regions

#

I wonder if they had some kind of client mod to run /rg addmember 1 thousand times

lost matrix
tender shard
#

merging that can get complicated though

#

e.g. if you have two minecraft/sounds.json files

#

isn't there some library to merge resource packs?

rough drift
#

like:

I have a texture for X item with X model data, i am only going to merge if there isn't one that matches the previous requirements

#

such as stick with model data of 1 will be merged in the resource pack of the server unless:

the server does not have a resourcepack, in which it will just send it
the resourcepack already has a stick with model data of 1

lost matrix
#

Resourcepacks are a hustle to work with. I have a 1k lines class that builds a resourcepack when the server starts. Cant imagine how tricky merging would be.

tardy delta
#

got two screens to code on lol

rough drift
#

merging would require extracting the files from within the resourcepack, and comparing the json values for the model data and item

tardy delta
#

more like i got a pc and a tv

quaint mantle
#

Is there a way to display an actionbar instead of title? I can't find anything in the docs.

rough drift
#

use player.spigot().sendMessage

#

iirc you can do it like that

tardy delta
#

player.spigot().sendMessage(ChatMessageType.ACTION_BAR, "hello world")

rough drift
#

yep

lost matrix
tardy delta
#

you need a runnable tho to keep it sending

quaint mantle
tardy delta
#

if you just call that method, it will maybe stay there for one tick

rough drift
#

no

#

it stays for ~1 second

tardy delta
#

could be longer i havent tested it

#

have only tested it in onJoin

dire marsh
#

wish you could specify time with actionbars :(

tardy delta
#

thats why

dire marsh
#

mojang pls

tardy delta
#

just runnable

quaint mantle
#

well the /title actionbar does have time

lost matrix
dire marsh
rough drift
#

people really makin skripts like that

tardy delta
#

7smile if i would have to send an actionbar for a specific amount of time, would i need to have to runnables, an inner repeating one to keep the runnable sending and a timer to cancel both of them after the specific amount of time?

quaint mantle
sacred mountain
#

chat

#

is not action bar

tardy delta
#

net.md_5 import i guess

lost matrix
quaint mantle
#

does not exist

#

since what version is this

#

its showing the methods

tardy delta
#

knowing the fact that if you call the method to display an actionbar, the actionbar only stays for ~ a second

quaint mantle
tardy delta
#

so you'd need to repeat it

lost matrix
tardy delta
#

and if you want to stop it after some time?

quaint mantle
#

set a bool to false and display nothing as actionbar

#

idk

#

but what version do I need for this because the import is not there

#

or do I need to decompile

tardy delta
#

like i would do it liek this

int task = Bukkit.getScheduler.runTaskTimer(plugin, () -> {
    player.spigot().sendMessage( // ... actionbar stuff
  }, 1L, 5L); // repeat it to prevent the actionbar stops sending
Bukkit.getScheduler().runTaskLater(plugin, () -> {
  Bukkit.getScheduler().cancelTask(taskId);
}, 20 * 5); // after 5 secs cancel the sending```
lost matrix
#
public class ActionBarRunnable implements Runnable {

  private final Map<Player, BaseComponent[]> activeBars = new HashMap<>();

  public void setActiveBar(final Player player, final String message) {
    this.activeBars.put(player, TextComponent.fromLegacyText(message));
  }

  public void removeMessage(final Player player) {
    this.activeBars.remove(player);
  }

  @Override
  public void run() {
    this.activeBars.forEach(this::sendBar);
  }

  private void sendBar(final Player player, final BaseComponent[] message) {
    player.spigot().sendMessage(ChatMessageType.ACTION_BAR, message);
  }

}

Then start this runnable in your onEnable.
If you want to send someone an actionbar -> add him

warm light
#

is there any side effect of using runTaskAsynchronously?

quaint mantle
#

if I'm not able to import this isn't gonna help anyway

#

do I need to decompile?

tardy delta
#

no :/

quaint mantle
#

I imported like this

lost matrix
quasi patrol
#

I have a problem where I am using Discord4J in my Minecraft Spigot Plugin, but when the D4J bot loads, the rest of the server stops loading.

warm light
lost matrix
ivory sleet
#

Believe it’s pretty much non blocking alr

#

Isn’t it

lost matrix
lost matrix
warm light
#

I am using a api which search head from a database. but it freeze the server on task. so I use async then. so I just asked about it😶

lost matrix
#

Thats a good example of when to use an async task. Was expecting the usual "wanna place blocks fast weeeee"

ivory sleet
#

Yeah, operations which to some extent are dependent on external services such as IO as it has to talk to the disk, and namely database requests.

tardy delta
#

are you ever talking to a disk?

ivory sleet
#

mye

#

happens

tardy delta
#

by accident

rough drift
burnt current
sacred mountain
#

my game almost crahgses lol

quaint mantle
#

hey so i am trying to deserialize a json file with jackson, and the json file has three arraylists in it, i want to deserialize them each seperatley, how would i do this?

cobalt tinsel
#

hey anyone willing to help me?

sacred mountain
#

syre

cobalt tinsel
#

well so

#

im coding a plugin

sacred mountain
#

yea

cobalt tinsel
#

but anytime I call the config, string

#

it spams error

#

on console

sacred mountain
#

error?

sacred mountain
#

i mean like

#

what is the error

cobalt tinsel
quaint mantle
lost matrix
quaint mantle
#

ive given up on type adaptors since none of them work with arraylists the way i need them too

#

anyway

quaint mantle
quaint mantle
rough drift
quaint mantle
rough drift
#

now figure out why that is

quaint mantle
#

the top line is the menu itself

rough drift
#

i am not really good at jackson

quaint mantle
rough drift
#

but ill throw a wild guess: Menu does not have a constructor that takes an array