#help-development

1 messages · Page 1615 of 1

proud basin
#

ok so

quaint mantle
#

wait no this wont work

valid crag
#

no

proud basin
#

why not?

valid crag
#

you do
PlayerData data = playerMap.get(player.getUniqueId());

proud basin
#

oh your talking about what he said

valid crag
#

and then you do data.cooldownMap.put("cooldownName", new CooldownData("cooldownName", time))

#

for which you probably want to create a method on the PlayerData class, something like playerData.addCooldown(name, time)

proud basin
#

I still need to add all the data when the player joins

#

so lemme do that real quick

valid crag
#

myes

quaint mantle
#

are there any errors in console on load?

proud basin
#

also wouldn't I want to do public Map<String, CooldownData> cooldownMap = new HashMap<>(); instead of public Map<String, Long> cooldownMap = new HashMap<>();

valid crag
#

yes

proud basin
#

alrighty

#

done

#

may I ask why im making a new instance?

valid crag
#

of what? when?

plain oxide
#

Plugin does not work
I see the load confirmation using the onEnable() method, but the ones using other events don't work
I checked with /pl and the plugin is loaded

package dorokei.pyuagotto.dorokei;

import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scoreboard.Team;

import java.util.Objects;

public final class Dorokei extends JavaPlugin implements Listener {
    @Override
    public void onEnable() {
        // Plugin startup logic
        getLogger().info("てすとぷらぐいん");
    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }

    //JoinEvent
    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent p) {
        //入ってきたプレイヤーを取得
        //Player player = p.getPlayer();
        //Team nameHide = Objects.requireNonNull(Bukkit.getScoreboardManager()).getMainScoreboard().getTeam("nameHide");
        //System.out.println(nameHide);
        System.out.println("test");
        //assert nameHide != null;
        //nameHide.addEntry(player.getName());
    }

    @EventHandler
    public void onDropEvent(PlayerDropItemEvent e) {
        e.getPlayer().sendMessage("test");
    }
}```

Where should I fix it?
proud basin
#

Why am I doing ```java
data.cooldownMap.put(res.getString("Cooldown"), new CooldownData(res.getString("Cooldown"), res.getLong("Time")));

when I can dojava
data.cooldownMap.put(res.getString("Cooldown"), res.getLong("Time"));```

valid crag
#

because you for some reason went and made a CooldownData class even though I said it'd be fine to just have a Map<String, Long>

#

which is fine

#

but now you need to create a new instance of it, instead of just putting a long in a map

#

@plain oxide you haven't registered your listener

#

Bukkit.getPluginManager().registerEvents()

proud basin
#

Didn't you say to make a new class?

valid crag
#

i said if cooldowns had more data than just a single long, you'd have to make a new class

proud basin
#

oh

#

must of missed that then

plain oxide
proud basin
#

so what was the next step again

#

trying to scroll up but it keeps glitching on me

valid crag
#

are you loading the data yet

proud basin
#

yeah

#

I did that already

#

I made it so when the player joins their data gets put into the map

valid crag
#

then you are done

proud basin
#

oh shit it was that simple

valid crag
#

the next step would be to do the reverse of what we did now

#

that is, to read the data from the object oriented model and save it in the db

proud basin
#

yea

#

I can do that

#

I did it before without doing it async hehe

valid crag
#

💀

#

by the way you want to load the data in the async player prelogin event

proud basin
#

Yeah that's what I did

valid crag
#

so your server doesn't shit bricks when a bunch of players join and you need to run to the db 20 times doing random queries

proud basin
#

yea

#

so if I wanted the cooldown time I would do data.cooldownMap.get("Time");

valid crag
#

if you wanted the cooldown time for ender pearls, you'd do data.cooldownMap.get("ender pearls")

proud basin
#

hm ok I see

#

wait

#

so when I'm saving I have to type out every single cooldown

fluid cypress
#

if i remove the plugin chunk ticket, the chunk will be unloaded instantly in that same tick?

mint frigate
#

can anyone give me a eclipse setup?

proud basin
#

setup eclipse for what

proud basin
mint frigate
outer sorrel
#

is there a way to run certain code when a message in chat is clicked or at least run multiple commands?

proud basin
sudden raft
#

does ProjectileSource#launchProjectile call ProjectileLaunchEvent?

#

seems like it doesn't, I'll test

short shale
#

how can i do to push player upwards?

hasty prawn
#

Set their Y velocity

short shale
#

ok, i will search about this

#

thx 🙂

waxen locust
#

hey, i seem to be getting the error [23:04:17] [Server thread/ERROR]: Could not pass event BlockBreakEvent to FallingFalling v1.0.0, and org.bukkit.event.EventException: null are there any common causes for this?

hidden delta
#

?paste

undone axleBOT
waxen locust
#

?

proud basin
#

@waxen locust Post your code in it

waxen locust
#

ok

proud basin
#

Can you post the full error?

waxen locust
#

sure

#

wait

#

i think i see it

#

nvm

#

just an error in my logic so an Interger object is null and is causing problems

torpid zinc
#

I get this error but it gives me no class written by me, only spigot classes...

#

I'm modifying someone's command, and only this command does it

#

no other command does it

hasty prawn
#

Send the full error

torpid zinc
#

it is the full error

hasty prawn
#

There's nothing under the Caused by: java.lang.ArrayIndexOutOfBoundsException?

torpid zinc
#

idk, its really weird

hasty prawn
#

?paste

undone axleBOT
hasty prawn
#

Send the command code

dusk flicker
#

?stacktraces

torpid zinc
#

it would be "/dac stats" the full command

dusk flicker
#

Check that out

torpid zinc
#

I did... normally it gives me my exact line in my own class where the error was caused

#

but here its NMS and other stuff

#

but no class of my plugin

dusk flicker
#

that class is a fucking mess

drowsy helm
#

Bro split your code up

dusk flicker
#

holy hell

torpid zinc
#

not my code

dusk flicker
#

then why are you here

torpid zinc
#

I'm fixing someones code

#

he wrote that in 2016 I believe

dusk flicker
#

dear lord

#

rewrite it then

drowsy helm
#

Use a command lib much easier

#

Like aikar acf

dusk flicker
#

ah its this plugin

torpid zinc
#

yes

#

I gotta update it for one server for 1.17

dusk flicker
#

Id recommend you just recode it

#

Honestly not a hard gamemode

torpid zinc
#

I would but not that much time with college coming soon

drowsy helm
#

Also not much reason making all those vars final

dusk flicker
#

this plugin is just a mess

torpid zinc
dusk flicker
#

ehh

#

speed shoulden't change

hasty prawn
#

Yeah that change is gonna be negligible

torpid zinc
#

you get a few ms, not noticeable but yeah

hasty prawn
#

I doubt its that much honestly lol

dusk flicker
#

It's not

hasty prawn
#

maybe a few ns

dusk flicker
drowsy helm
#

Should really only use final for apis tbh

#

Or proper constants

dusk flicker
#

Final has it's uses but I only tend to use it on stuff other people will interact with

drowsy helm
#

^

hasty prawn
#

Yeah I generally know my own code & what not to change

drowsy helm
#

It’s just a way to baby other devs to not use it lol

#

Change*

waxen locust
#

sorry for interrupting, I thought i had fixed the [23:04:17] [Server thread/ERROR]: Could not pass event BlockBreakEvent to FallingFalling v1.0.0 and org.bukkit.event.EventException: null error but apparently it still doesn't work. basically it runs fine the first time but when trying to update an existing score it breaks.
code: https://paste.md-5.net/akusaraxow.cs
error log: https://paste.md-5.net/fisehigowo.cs
relevant main class stuff: https://paste.md-5.net/tejebihejo.java (error is in the code pastebin so this shouldn't matter)

dusk flicker
#

Can you send us the entire error

dusk flicker
#

also please format your code better (your IDE can do it)

#

it's bad

waxen locust
hasty prawn
#

CTRL + ALT + L is the keybind for code format in IntelliJ I think

dusk flicker
#

I presume it's Eclipse

#

I don't think IntelliJ auto does the author and license things

hasty prawn
#

Oh true

waxen locust
hasty prawn
#

ref.blocksbroken and ref.kills are not the same thing

dusk flicker
#

do me a favor

dusk flicker
#

and please

#

formatting saves us time

waxen locust
#

ok

#

will do it rn

#

tysm

dawn falcon
#

hey does anyone know of a way to hide an Entity from a specified player?

light terrace
#

how to whitelist a people using spigot?

#

like if i want to whitelist : _Aslt

#

whitelist a player using commands

dawn falcon
#

you could register a command, that when it gets a username input, it stores that username in the "whitelist.json" file. Then register an event that triggers when a player attempts to connect, that checks if that username is in the "whitelist.json" file, and if not then kick them. found an article that might help with the reading of the json file part : https://attacomsian.com/blog/java-read-write-json-files.

quaint mantle
#

or just... /whitelist add _Aslt?

#

@light terrace

OfflinePlayer player = Bukkit.getOfflinePlayer(name);
player.setWhitelisted(isWhitelisted);
light terrace
silk mirage
#

just dispatch command

#

Bukkit#dispatchCommand

#

or smth like that

quaint mantle
#

how to send title for a player?

quaint mantle
#

player.sendTittle()

#

._.

#

this method is deprecated

#
if (!action.getPlayer().getInventory().contains(Material.AIR)){
                    action.getPlayer().closeInventory();
                    //action.getPlayer().sendMessage(ChatUtils.color("&f(&c!&f) &cYour inventory is full."));
                    action.getPlayer().sendTitle(null, ChatUtils.color("&cInventory Full"), 10, 30, 10);
                }
#

why its not working :/

#

What programm u using

#

Eclipse, IntelliJ IDEA

#

IntelliJ IDEA

#

Do you have any errors in console

#

no

#

it closed the inventory but didnt show any title

#

Set tittle to "", idk it maybe don't work with null, but its strange

chrome beacon
#

Subtitle requires a title iirc

quaint mantle
#

I'm just really sleepy right now

#

didnt work

#
if (!action.getPlayer().getInventory().contains(Material.AIR)){
                    action.getPlayer().closeInventory();
                    action.getPlayer().sendMessage(ChatUtils.color("&f(&c!&f) &cYour inventory is full."));
                    action.getPlayer().sendTitle("", ChatUtils.color("&cInventory Full"), 10, 30, 10);
                }
#

its sent the message

#

but not title

chrome beacon
quaint mantle
#

No

#

its nullable

chrome beacon
#

You do

quaint mantle
#

I have used it many times like his and everything worked

chrome beacon
#

This isn 't about spigot it's about Vanilla

#

It won't render subtitle only

quaint mantle
#
if (!action.getPlayer().getInventory().contains(Material.AIR)){
                    action.getPlayer().closeInventory();
                    action.getPlayer().sendTitle("title", ChatUtils.color("&cInventory Full"), 10, 30, 10);
                    action.getPlayer().sendMessage(ChatUtils.color("&f(&c!&f) &cYour inventory is full."));
                }
#

ok now see ^^

#

umm yes

#

it worked now

#

Set in tittle " "

#

If you don't the tittle

#

it worked with " "

quaint mantle
#

thanks both of you for helping :>

#

;)

#

np

quaint mantle
#
if (!action.getPlayer().getInventory().contains(new ItemStack(Material.AIR)))
#

this check wont work?

eternal night
#

Use first empty instead

quaint mantle
#

ok

light terrace
light terrace
hybrid spoke
hybrid spoke
quaint mantle
#

?learnjava

undone axleBOT
light terrace
#

how to unban someone (by name) using spigot library ?

reef wind
#

@light terrace please look above and learn Java before you try to make a plugin.

drowsy helm
#

Anyone know if theres an api for the spigot resources page (to get a list of plugins)

opal juniper
light terrace
reef wind
opal juniper
#

Get the ban list
Remove them

#

A lot of these questions can be solved by just googling things

reef wind
#

he will probably just come back every minute if he doesn’t learn basic Java

torn shuttle
#

damn it the way I'm handling entity queries is stinky and I don't like it

#

do I really have to rewrite it

light terrace
reef wind
light terrace
reef wind
#

so you should go and learn it before attempting to make a plugin

#

?learnjava

undone axleBOT
torn shuttle
#

fuck this I'm not going to rewrite it

#

feels good to see that I tried to spawn an entity 6800 times but it's using so little power to search for valid spawn locations that it's not even showing up in the timings

flat kindle
#

?paste

undone axleBOT
flat kindle
#

I have a question

#

I have a recursion with objects

#

as the recursion moves

#

do the player objects get duplicated?

#

In the memory

#

or any other objects for that matter

torn shuttle
flat kindle
#

yea so they are just passed around then

#

I was unsure so thanks for the anwser

hybrid spoke
torn shuttle
#

Gee I wonder why my bossbars aren't showing up

#

1 hour later, oh I just happened to forget to assign a player

quartz valve
#

Is there a Chunk event before ChunkLoad?

chrome beacon
exotic scroll
#

how to delay a task by a set amount of time

chrome beacon
undone axleBOT
stark marlin
chrome beacon
stark marlin
#

Oh, makes sense. Thanks! 😄

indigo crypt
#

Does anyone knows how to set multiple killers

hardy swan
#

is there a nicer way of writing this statement instead of leaving empty curlies?

while (!queue.isEmpty() && !queue.poll().equals(stopper)) {}
indigo crypt
#

mention me if you know how to do that

gleaming grove
#

guys do you think is it good idea to use Dependency Injection pattern in spigot?

echo basalt
#

Yes

#

Always use it

#

Generally static bad

gleaming grove
#

i mean the automatically injection

echo basalt
#

Ah

#

It's generally not used in spigot

#

But stuff like Velocity (proxy) uses it a lot

gleaming grove
#

i dont event know if its possible with java

#

but i do often use this approach with C#

echo basalt
#

It is possible with java

#

But IMO annotation processing is something I don't use much

gleaming grove
#

do you have some paper how it work under the hood?

echo basalt
#

Because it needs reflections to work

#

It basically just obtains the constructor and calls it using reflections

#

Either that or it does some weird hack at compile-time

gleaming grove
#

ye but how does Java knows when Constructor is triggered?

#

there is some reflection event onObjectCreated or sth?

echo basalt
#

Here's a framework that uses it

gleaming grove
#

o thanks : )

echo basalt
#

It does some bytecode stuff to change classes I think

torn shuttle
#
        List<SimplePersistentEntity> list = persistentEntities.get(chunkLocation);
        if (list == null) return;
        list.forEach((simplePersistentEntity -> {
            if (simplePersistentEntity.customBossEntity != null)
                simplePersistentEntity.customBossEntity.chunkLoad();
            else if (simplePersistentEntity.npcEntity != null)
                simplePersistentEntity.npcEntity.chunkLoad();
        }));
        persistentEntities.removeAll(chunkLocation);
        chunkLocations.remove(chunkLocation);

I'm sort of confused here, this is giving me a CME on list.forEach((simplePersistentEntity -> { , am I forgetting something here?

echo basalt
#

You're modifying the list while looping

#

Also for loops are better than Collection#forEach

torn shuttle
#

#forEach is a modification?

#

that's the part I don't get

#

why is it erroring there specifically?

echo basalt
#

as the forEach method is just a fancy for loop wrapper

#

Think of it like this

torn shuttle
#

I know this isn't the best setup for the iterator, I was just trying to see exactly where it was messing up

echo basalt
#
Collection<Object> collection = ...;

for(Object object : collection) {
  // Do stuff
  collection.add(anotherObject);
}
#

This will throw a CME

#

Now

torn shuttle
#

yeah but I am not doing that on that specific line am I

echo basalt
#

Let's say you're looping

#

And on another method that happens to be called at the same time

#

You're adding to the list

#

You get a CME

#

One thing you can do is clone the list

#

Another (which I believe will work but not 100% sure) is using the synchronized keyword

weak adder
#
player.getInventory().addItem(new ItemStack(Material.BOW, 1).addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 1000));
                sender.sendMessage("You Have Been Given a " + ChatColor.GREEN + "Punch 1000 Bow"));

Hello,
Im trying to add an enchantment for the bow but it gives me this error Cannot resolve method 'addItem(void)'

torn shuttle
#

this is so weird

echo basalt
#

ItemStack#addUnsafeEnchantment is a void

torn shuttle
#

I understand the underlying issue with a CME but I didn't think it would tell me it errors on the first line of the iterator

echo basalt
#
ItemStack item = ...;
item.addUnsafeEnchantment(...);
addItem(item);

works

echo basalt
torn shuttle
#

actually I wonder...

echo basalt
#

One amazing thing I used to do

#

Which made the garbage collector work extra hard

#

Was basically

#

for(Object obj : new ArrayList<>(list))

#

Which clones the list and loops through the clone

#

You won't have any CMEs on that

#

And you can modify the original list inside

#

But cloning a list temporarily isn't the best way to avoid CMEs honestly

valid crag
#

the iterator is the one that checks for modifications

#

basically, each collection has a modification counter in it

#

any modifications will bump the number up

#

the forEach call, and any other iterator like a for loop for that matter, will look at this modification counter at the start of every iteration

#

if the counter has changed, it throws an exception

#

this is why the forEach line is throwing the exception, and not the code that is actually causing the modification and the CME

echo basalt
#

^

crude charm
#

why TF does this not work

echo basalt
#

I couldn't bother explaining

torn shuttle
#

see that makes more sense, also this was never meant to modify the list as it iterated through it and it turns out I found a different bug

valid crag
#

it's not there for the purposes of debugging why your collection is being modified, it's there to prevent unwanted behaviour

#

well... something somewhere that you're calling is modifying it

echo basalt
valid crag
#

as for what that is it's not super simple to find out

crude charm
#

I was dumb

severe marsh
crude charm
#

but it's server.properties

#

show achevements

torn shuttle
severe marsh
#

thanks

torn shuttle
#

which makes sense

quaint mantle
torn shuttle
#

I guess

valid crag
#

the whole "is a chunk loaded" deal has gotten more and more batshit over the years

torn shuttle
#

I am genuinely rewriting everything due to that and entity spawns in loading chunks

#

it sucks, hard

valid crag
#

mojang keeps changing how things work under the hood and bukkit, being the colossal clump of indextrous shit that it is, can't reflect that

torn shuttle
#

as much as I hate it I think I'm going to have to run the code one tick later or smth

#

I really hate it

quaint mantle
valid crag
#

weren't you already answered

#

and also told to go to a different channel?

torn shuttle
#

man it's either this or feed data to my chunk checker to let it know about chunks that aren't done loading yet

eternal oxide
#

if (Tag.CROPS.isTagged(block.getType())

plain oxide
#

Code written other than Main.java does not work.
Do I need to draw any special code?

valid crag
#

the 1.17 entity loading mechanics change has caused other issues as well

#

for example, now it's basically impossible to detect when mobs load into the world

#

as opposed to them being spawned

#

previously, you'd listen to chunk load event and get the entities in the chunk

#

but now, the entities aren't loaded in the chunk yet by the time the event fires

torn shuttle
#

yeah this blows chunks

quaint mantle
#

well, yes, my answer went much later than I wanted, thank you dacha internet😒

valid crag
#

imagine linking the actual image instead of a laggy ass webpage

#

smh

eternal oxide
# quaint mantle https://prnt.sc/1ic92pr
if(Tag.CROPS.isTagged(type)) {
    Ageable crop = (Ageable) block.getBlockData();
    if (crop.getAge() == crop.getMaximumAge()) {
        block.breakNaturally(playerTool);
        block.setType(type);
        crop.setAge(0);
        block.setBlockData(crop);
    }
}``` This should be correct.
torn shuttle
#

imagine that the code works when you do it right

#

fml

#

now I'll get to find out whether entities are loading correctly with chunk loads on 1.17 when you do it manually or not

torn shuttle
#

I agree but does minecraft agree ?

#

it's looking good so far

hybrid spoke
#

it does

#

spigot agrees too

flat kindle
#

How would I know if a conversation is still active with the conversation api in spiot?

#

?paste

undone axleBOT
flat kindle
#

if the conversation had ended does the getStatus method return null?

torn shuttle
#

stopping energy drinks cold turkey sucks

flat kindle
#

it actually doesnt

#

And now the entire server froze

hybrid spoke
#

yeah well

#

thats what a non breaking while loop does

#

freeze the server

flat kindle
#

GetState cannot return null

hybrid spoke
opal juniper
#

the conversation api... Sadge

hybrid spoke
#

whats the usecase of that

#

i've never used it before

opal juniper
#

when you need a series of text inputs

#

"what do you want this to be called" -> they reply

"what about this" -> they reply again

plush gulch
#

what would be the event of an activating totem of undying?

opal juniper
#

if they have no totem = cancelled

plush gulch
#

thanks

opal juniper
#

yeah its a pain doe

torn shuttle
#

god damn it now I gotta figure out gradle relocations again

#

I hate this

ivory sleet
#

That’s trivial at most I’d say

#

Do you have the shadowJar plugin?

chrome beacon
#

Took me a while to figure out

#

After you've done it once it gets easier

quaint mantle
severe marsh
#

How do I make autocomplete?

quaint mantle
severe marsh
#

Thank you

quaint mantle
#

If you mean tab autocompletion then this example should help.

severe marsh
#

yeah I meant that

quaint mantle
#

that site really needs a redesign lmao

oblique pike
#

Is there any easy way to get a player who resurrected ender dragon?

quaint mantle
#

If there probably is no API for that I would just check who was the last player to place a ender crystal on a valid bedrock block to respawn the dragon. Then when the DragonBattle starts you simply do #hasBeenPreviouslyKilled() and that should be it.

hybrid spoke
#

not sure if there is a player statistic. otherwise save it yourself

fading pulsar
#

?psate

#

?paste

undone axleBOT
fading pulsar
eternal oxide
#

type is the Material

quaint mantle
#

at co2.rto.RTOPlus.Main.onPlayerJoin(Main.java:42) ~[RTOPlus.jar:?]
Shows you the error is in line 42

fading pulsar
#
player.setHealth(NowHP + 5);
player.setMaxHealth(DefaultHealth + 5 * NowLevel);
``` edit to

player.setMaxHealth(DefaultHealth + 5 * NowLevel);
player.setHealth(NowHP + 5);

quaint mantle
eternal oxide
#

Learn java

quaint mantle
quaint mantle
#

sry

quaint mantle
#

you need to make the max health higher before setting the health

fading pulsar
#

Sorry I am a beginner @@

quaint mantle
#

it is fine lol at least you didn't say "where is my error"

fading pulsar
#

thanks you

quaint mantle
#

you're welcome

fading pulsar
#

Emm

#

no't error but not change maxhealth...

hybrid spoke
#

since you have to probably go over the attribute

sharp lantern
#

can anyone help me please

hybrid spoke
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.

fading pulsar
chrome beacon
#

setMaxHealth is deprecated use attributes

fading pulsar
#

Emm what attributes can set maxhealth?
i just know setMaxHealth @@

chrome beacon
#

That would be the MAX_HEALTH attribute

hybrid spoke
hybrid spoke
#

okay, and?

fading pulsar
#

same?

hybrid spoke
#

most likely

#

just look for max health

fading pulsar
#

emm how to use xd have example project?

#

i write final Attribute GENERIC_MAX_HEALTH; in line 35

chrome beacon
#

.-.

chrome beacon
#

How much experience with Java do you have

fading pulsar
chrome beacon
#

Aight

hybrid spoke
#

with 3 months you should already know how to use javadocs

#

or a least google

fading pulsar
#

oh thanks you maxhealth have change 🙂

chrome beacon
#

?paste

undone axleBOT
fading pulsar
#

?paste

undone axleBOT
chrome beacon
#

Also you should avoid opening or closing the inventory in the event

#

Delay that until the next tick

tulip sky
tulip sky
chrome beacon
#

Don't detect inventories by name either

fading pulsar
oblique pike
#

Is there any way to achieve effect of "fear" (like creeper running away from cat, skeleton running away from dog) on other mobs?

outer crane
#

In vault, when is Economy#createPlayerAccount(OfflinePlayer offlinePalyer) called?

dense goblet
#

You need nms

drowsy gorge
#

Hello, I am coming to see you because I would like to make a patch for Spigot but I cannot find the sources. Can you clarify this for me? Thanks a lot !

hardy swan
#

that's how you get $200

outer crane
oblique pike
dense goblet
#

Otherwise it has to be nms :/ idk why spigot hasn't added AI support yet

ivory sleet
#

Its iirc inconsistent

#

Would be a whole lot nicer if it was registry based or something

dense goblet
#

Inconsistent by Mojang?

ivory sleet
#

No but goals change from version to version

oblique pike
dense goblet
#

Ah I see

ivory sleet
#

Yeah I believe even paper doesn’t have a too rich api when it comes to the goals altho sufficient enough probably

#

Nvm it’s kinda good

unreal quartz
#

just a paper hater smh

hybrid spoke
#

you cant be a specific hater if you hate everything

mystic sky
#

a

indigo crypt
#

Does anyone knows how to set multiple killers, because entityDeathEvent only catches someone who gets last hit

short shale
#

big lines can cause some lag in java?

ivory sleet
#

No

#

You can technically minimize all Java classes to 1 line wouldn’t do much of a difference

maiden briar
#

How can I remove this message?

oblique pike
#

Is there any examples of using Paper's AI api?

ivory sleet
#

Probably

#

Give it a google

flat kindle
#

Is there a way to check if itemIn main hand is a block?

oblique pike
#

For me it looks like it is only possible if you create your own entity

flat kindle
#

I cant seem to find a way to obtain the ID,and the isBlock method does not exist anymore

hardy swan
#

Material might have the isBlock method

oblique pike
flat kindle
#

oh you're right

#

found it

toxic mesa
#

Does #isgliding just check if the player is using an elytra?

quaint mantle
#

yes

toxic mesa
#

awesome ty

short shale
#

how can i do to add the player's inventory to an arraylist?

#

I already set an arraylist for the inventory type

#

i was trying this: inv.add(p.getInventory());

quaint mantle
#

PlayerInventory#getContents

hybrid spoke
#

#addAll

quaint mantle
#

it returns ItemStack[] but you can convert that to a List<ItemStack>

short shale
#

hmm, ok

#

i wil test it

#

thx ❤️

quaint mantle
#

How can i auto ignite tnt on placement without removing it and making a TNTprimed

ivory sleet
#

TNT#setUnstable?

quaint mantle
#

oh is that what that is?

cold tartan
#

?syntax

#

what is syntax

valid crag
#

noun
noun: syntax

1.
the arrangement of words and phrases to create well-formed sentences in a language.
"the syntax of English"
    a set of rules for or an analysis of the syntax of a language.
    plural noun: syntaxes
    "generative syntax"
    the branch of linguistics that deals with syntax.
2.
the structure of statements in a computer language.
cold tartan
#

lmfao i meant the command

#

?help

undone axleBOT
#
CafeBabe Help Menu
*Red V3*
**__Admin:__**

selfrole Add or remove a selfrole from yourself.

**__Cleanup:__**

cleanup Base command for deleting messages.

**__Core:__**

embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.

**__Downloader:__**

findcog Find which cog a command comes from.

**__Mod:__**

names Show previous names and nicknames of a member.

**__ModLog:__**

listcases List cases for the specified member.
reason Specify a reason for a modlog case.

**__Permissions:__**

permissions Command permission management tools.

chrome beacon
#

There is no syntax command

cold tartan
#

i swear there is

chrome beacon
#

Do you mean javadocs?

valid crag
#

the bot is 🚮

cold tartan
#

like with the bot

#

no i swear someone did it before

#

?javadocs

chrome beacon
#

?jd

oblique pike
#

How do i stop monsters targetting player?

tame coral
#

A smart way could be to make player invisible only serverside

#

But some mobs (such as guardian) can still see invisible players

chrome beacon
#

There is a target event iirc

#

Let me check

#

Yeah use EntityTargetLivingEntityEvent and cancel it

oblique pike
#

Sometimes it does not work

#

For example if i spawn creeper

#

I do not even see the event to be fired

#

But he still targets me

#

And even if i cancel this event

#

At some point it just doesn't get cancelled

vivid temple
#

is there a fall damage event?

oblique pike
vivid temple
chrome beacon
#

Use ==

left swift
#

How can i make EntityItem unpickable? which method (nms)

chrome beacon
#

Why NMS

left swift
chrome beacon
#

If it's packet items you don't need to do anything

left swift
valid crag
#

the client will attempt to pick it up but nothing will happen

hybrid spoke
#

?paste

undone axleBOT
hybrid spoke
#

use this

vivid zodiac
#

k'

vivid temple
#

how do i check if a player has custom armor equipped?

hybrid spoke
vivid zodiac
vivid temple
hybrid spoke
vivid temple
hybrid spoke
#

persistentdatacontainer

vivid temple
#

so how would that work?

hybrid spoke
#

store a NSK in it and search for it whenever you are equipping armor

#

or whenever you wanna check if its a custom armor

vivid temple
#

okay

#

thanks

vivid temple
#

so how do you check that?

chrome beacon
#

There's a lib you can use

hybrid spoke
#

trick a bit or make your own by listening for the playerinteract-, inventory Event

#

iirc there is already one

vivid temple
hybrid spoke
vivid temple
#

ah library

valid crag
#

imagine if that event ever got pulled here from downstream

chrome beacon
#

Would make things so much easier

#

Paper has a lot of neat api additions

left swift
chrome beacon
#

That's all I remember

left swift
#

oh, yes, thanks

chrome beacon
#

Yeah

left swift
#

ugh, what?

waxen plinth
#

Reflection time 👏

left swift
#

it is public class :/ why i have this issue?

chrome beacon
#

Make your life easier and use Protocollib

fluid cypress
#

which could be a tp that have TeleportCause.UNKNOWN type?

chrome beacon
#

If you get glitched through a block slightly when a block break is cancelled that will trigger Unknown iirc

#

And so do doors when their opening is cancelled

left swift
chrome beacon
#

Protocollib

#

No reason to reinvent everything

fluid cypress
#

im doing a /back command, should i care about unknown?

chrome beacon
paper viper
#

Tbh I’d use NMS over protocollib for some cases

valid crag
#

make the teleport cause list configurable and you don't need to care about anything

paper viper
#

Because protocolib has some limitations

chrome beacon
#

PacketWrapper makes Protocollib easy

valid crag
#

literally just like 4 method calls

chrome beacon
#

^^

left swift
chrome beacon
#

What

chrome beacon
#

What about it

#

PacketWrapper is slightly outdated you can easily fix it

left swift
#

someone just recommended it to me and I tried, but failed, I tried ordinary nms and so far I stayed

chrome beacon
#

Oh well you might not get support from here

#

NMS is undocummented and generally unsupported

paper viper
#

But that doesn’t count as documentation lol

fluid cypress
#

if i get the player location inside the PlayerTeleportEvent, ill get the old location? or the new one? if i get the new one, how can i get the old location previous to the tp?

chrome beacon
valid crag
#

use getFrom and getTo

#

the behaviour of Player::getLocation is undefined during a move event

fluid cypress
#

thanks

paper viper
#

For example heavy processes requiring a ton of packets to be sent to users may suffer if ProtocalLib is used, so some people switched to NMS

#

To optimize packets

chrome beacon
#

Not when you need to get spoonfed NMS code

valid crag
#

muh pocket performance

gleaming grove
#

There is some option to set default Lore color to White instead of Purple?

ivory sleet
#

Prefixify &f for every line

gleaming grove
#

meh i thought there is some option to avoid loop ;/

ivory sleet
#

That loop isn’t probably going to hurt performance the slightest

#

If it does you might wanna do the string operations async and then callback bit that has some latency on its own

gleaming grove
#

but in this case i need to run extra async function so it might hurt Ram

#

or not?

ivory sleet
#

What

#

Well ofc every method call is overhead

#

But point is, if string operations are too heavy then that might slow down server thread thus lag spikes

fluid cypress
#

Arrays.asList returns an inmutable list or a mutable one? what about List.of? which one is mutable?

ivory sleet
#

declaring a callback is negligible and even more negligible than that

#

It’s a fixed size list

#

Arrays::asList

#

List::of is an immutable one

fluid cypress
#

is there any way i can declare a normal list, mutable, dynamic size, etc, but inserting an item automatically?

#

like Arrays.asList(x) but mutable and dynamic size

ivory sleet
#

Lists.newArrayList(vararg)

eternal oxide
#

new ArrayList(x)

fluid cypress
ivory sleet
#

No

#

You can pass initialSize or a collection

#

iirc

eternal oxide
#

Depends what your original data format is

gleaming grove
#

@ivory sleet is there some fancy lamda for this kind of operation?

ivory sleet
#

No but why

#

Well there is

sturdy patrol
#

Probably description.stream().map(s -> ChatColor.WHITE + s).something

ivory sleet
#

Yeah ^

vague oracle
#

Does InventoryMoveItemEvent not work for players?

ivory sleet
#

But it’s not worth using consider the overhead

valid crag
#

it has nothing to do with players

#

it's for hoppers and shit

gleaming grove
#

right

ivory sleet
#

Maybe if you’re writing an enterprise app ¯_(ツ)_/¯

sturdy patrol
valid crag
#

just write an util that does it tbh

ivory sleet
#

Yeah

valid crag
#

pretty sure like google's collections libraries have utils that do similar things too so you don't even need to write it

ivory sleet
#

If not then Apache got it

fluid cypress
#

im saving the teleport history of each player using the PlayerTeleportEvent event, but i want to be able to teleport players from this plugin, without modifying that history, how could i know, inside the teleport event, that the tp was made by the plugin itself? is there any way to get the plugin that teleported the player? i can do e.getCause and know that it was a plugin, but not which plugin, or can i?

dense goblet
#

That would be the most proper way

#

Otherwise you'd have to set some flag and do it in a wishy-washy manner

fluid cypress
#

can i specify the cause when doing player.teleport?

dense goblet
#

Or, if the event fires instantly when you call teleport, pop the latest tp from your stack

fluid cypress
#

in that case, i could set the cause to unknown, bc im only listening to command and plugin causes

dense goblet
#

So have:
player.teleport()
teleports.pop()

fluid cypress
#

i assume plugin is the default, and i can overwrite it, right?

dense goblet
#

The params should show you if you can do so

fluid cypress
dense goblet
#

Yeah thing is idk if you can do custom causes so in the case that you can't you'd have to do the other way

fluid cypress
#

yea, ill do that, thanks

lament minnow
#

Is it better to shade custom Java annotations (E.G., Jetbrains annotations), or to use Spigot's bundled JavaX annotations?

valid crag
#

you generally don't need to shade such annotations

#

annotations are a little strange in that their classes aren't actually required to be present in the runtime

lament minnow
#

oh

#

well whoops

#

that contradicts something what i learned earlier from here

#

guess that i will remove them from shading for several pom.xml files

valid crag
#

if you're reflectively looking at the annotations at runtime, then you need the classes

#

but you probably aren't reflectively looking at things like @Nullable or @NotNull and whatever

ivory sleet
#

Yeah usually they aren’t even kept at runtime

lament minnow
#

as a half-related question, what about adding their javadoc urls to the javadoc plugin's links

#

does that do anything

#

do annotations what function similarly to javax just become converted to javax at compilation or something

#

to make things simpler

#

man, i need to look up more about annotations

#

Does this mean that they do not even need to have the compile scope in Maven?

chrome beacon
vivid zodiac
#

I create scoreboard, but how can i add player on team with command ?

compact cape
nimble loom
#

I need to get offline players names often, but dosent Bukkit.getOfflinePlayer(UUID) have a limit since its accessing an api?

ivory sleet
#

It literally doesn’t

chrome beacon
#

It might since it can fetch data from Mojang

ivory sleet
#

Yeah well Server#getOfflinePlayer(uuid) will never

#

Maybe methods on the OfflinePlayer will

chrome beacon
#

Ah only name one does?

ivory sleet
#

But not that call

#

Yeah

nimble loom
#

Oh ok thanks

ivory sleet
#

Works fine

#

JavaPlugin implements Plugin thus can be passed there (:

lament minnow
#

Does something like Swing need to be shaded/have the compile scope?

paper viper
#

If you are going to use it, yes

lament minnow
#

so both

paper viper
#

It’s default set to compile

lament minnow
#

should i shade it, though

swift dust
#

how i can create a custom config yml?

valid crag
#

have you tried googling

lament minnow
vivid zodiac
#

How can i find player on scoreboard team ?

waxen plaza
#

I started making a plugin that uses bundles, but I noticed I can't craft one. Can I craft it in 1.17?

lament minnow
waxen plaza
#

oh, that sucks, but I quess I could add the recipe myself 😅

lament minnow
#

it says that it can be enabled with a data pack

#

but it can probably be enabled by a plugin too, somehow

#

or, at least, simulated

waxen plaza
#

yes, probably will do so

restive abyss
#

i want to create a custom items system should i use JSON to save the data for each item or something else?

quaint mantle
#

after my inventory is closed, should i somehow dispose of the listener? are there any performance problems?

#

it's created and shown whenever a player runs a command

hasty prawn
#

You can keep the Listener running. Otherwise you're going to have to unregister and re-register it everytime the command runs, keep track if any inventories are open... etc, it's more of a pain to do & it really shouldn't make a performance difference anyways

#

Cause the first thing you check I assume is if they clicked within that Inventory I assume? So it's only doing 1 thing

valid crag
#

unregistering and registering listeners is significantly more expensive than a simple check against a boolean or a set or whatever in the event handler itself

hasty prawn
valid crag
#

every time event handler registrations are changed, the underlying arrays need to be rebaked

hasty prawn
#

PersistentDataContainer

#

?pdc

restive abyss
#

thank you i will look into it

kind coral
#

hi guys, im trying to make a subcommand to handle tabcompletions, how could i do that? i have a tab completion for the main command but i also want it for the "admin" subcommand, how could i achieve this? this is my current class. https://hastebin.com/cotoviligi.java ( Command Manager, also Main command )

ivory sleet
#

I have something horrible I wrote some time ago if you’re interested

hasty prawn
ivory sleet
#

https://github.com/NeptunMC/Casino I did this where every sub command handles the completion in case you’re interested, check command/nodes/admin/RollNode and ofc the manager classes

#

Don’t judge the code, was actually in a hurry when writing it lol

dusk flicker
#

What are the hotbar item id's?

hasty prawn
#

Like the slot ids?

dusk flicker
#

yeah

hasty prawn
#

0-8 I think

dusk flicker
#

alright

ivory sleet
#

69 (:

reef wind
#

nice

waxen plaza
#

Bundles do be experimental. I just found a glitch that kicks me when using a bundle lol.

quaint mantle
#

hey, how do i change the amount of players online

#

not to like, fake having players on -- to do the opposite

#

to make it so that vanished players dont appear

formal warren
#

Hello, I'm trying to create a Minecraft plugin but my onPlayerJoin event is not working. Like it's never seen by the server. Does someone know how to fix? I really appreciate


package com.test.pluginname.paladin;

import org.bukkit.ChatColor;
import org.bukkit.Server;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin{
    
    //VARIABLES
    Server thisServer = null;
    ConsoleCommandSender console = null;
    
    //START AREA
    @Override
    public void onEnable()
    { 
        thisServer = getServer();
        console = thisServer.getConsoleSender();
        
        console.sendMessage(ChatColor.WHITE+ "["+ChatColor.AQUA +"LastWords"+ChatColor.WHITE+"]"+ChatColor.GREEN+" Last Words has been enabled!" );
    }
    
    @Override
    public void onDisable()
    {
        console.sendMessage(ChatColor.WHITE+ "["+ChatColor.AQUA +"LastWords"+ChatColor.WHITE+"]"+ChatColor.RED+" Last Words has been disabled!" );
    }
    //END START AREA+-
    
    
    //EVENTS
    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event)
    {
        Player player = event.getPlayer();
        console.sendMessage("Test" );
        console.sendMessage("tfwefwefe: "+player.getUniqueId() +" test." );
        
        getServer().getConsoleSender().sendRawMessage("raw");
        player.sendMessage("TSTTSTST HI");
        
    }
}


valid crag
#

register the listener

formal warren
#

Hi @valid crag , I tried this:

Bukkit.getPluginManager().registerEvents(this, this);

But it's not working
How can I register it?

valid crag
#

it works fine

formal warren
#

It says:
The method registerEvents(Listener, Plugin) in the type PluginManager is not applicable for the arguments (Main, Main)
And it's an error

dusk flicker
#

For the hotbar item clicks, PlayerInteractEvent would be the correct event for that correct? I haven't done a hotbar setup in a long time

formal warren
#

Yes

#

OMG

formal warren
#

I tried for hours

blissful folio
#

how can I make an entity affect a player only it's in the FOV of the player? Should I use raytracing?

formal warren
#

The UUID is unique only for the name or the minecraft account?

For example, if I change my Minecraft name, will I have the same UUID or another one?

steep nova
#

same

dense goblet
#

@formal warren your event handlers must be in a class which implements Listener

valid crag
#

well, they don't "have" to, but they are pretty useless otherwise

quaint mantle
#

hey i just made a server and i want to edit a plugin i got

#

i dont know anything about java

#

can someone help me

valid crag
#

no

#

this channel is for development

#

done by developers

quaint mantle
#

where can i ask for help regarding plugin creation

dense goblet
#

Do you want to create one or edit one?

quaint mantle
#

edit one

dense goblet
#

You can ask about creating plugins here (after following the guides) but you probably won't get help with editing a plugin if you have no other experience in programming

#

You could ask the plugin developer to add the feature you want

valid crag
#

to do plugin creation or editing plugins you first need to learn programming

quaint mantle
#

i know basic stuff

valid crag
#

which is beyond the scope of this channel

dense goblet
#

They should have a github page for suggestions and bug reports

quaint mantle
#

but im having trouble sorting the files

dense goblet
#

Do you have the source code?

quaint mantle
#

yeah

dense goblet
#

Do you have IntelliJ?

quaint mantle
#

yeah

dense goblet
#

And you can edit the code in intellij right

valid crag
#

this will end in tears

dense goblet
#

So then to export you just follow the tutorials on the spigot page

quaint mantle
#

alright thanks

waxen plaza
#

How can I get the console logs in real time?

valid crag
#

append a log handler

waxen plaza
#

Bukkit.getLogger.addHandler ?

#

I tried this but I my server crashed maybe I did something wrong.

grim ice
#

how do i check if a StructureGrowEvent is a 2x2 spruce tree

#

help pls

lyric oar
#

Hello, is there a way to make an armorstand moving fluidly like a player instead of teleporting it block per block ?

valid crag
#

depends on who's looking at it

quaint mantle
#

hey, how do i change the amount of players online
not to like, fake having players on -- to do the opposite
to make it so that vanished players dont appear

crimson scarab
#

hey guys

#

got a lil issue here

#

so im making a custom weapon where a trident beingg dropped will strike all nearby enemies

#

but its striking each enemy two times

quaint mantle
#

show code

grim ice
#

@crimson scarab lemme guess

#

PlayerInteractEvent ?

crimson scarab
#

yes

grim ice
#

?jd

crimson scarab
#

wait no

grim ice
#

hm?

crimson scarab
#

my bad got distracted

#

sending paste bin soon

grim ice
#

if its PlayerInteractEvent then it's because its counting both hands

crimson scarab
dusk flicker
#

please use java conventions

#

?conventions

undone axleBOT
grim ice
#

NAMING

#

CONVENTIONS

#

wtf??

crimson scarab
#

my apologies

chrome beacon
grim ice
#

@crimson scarab oh alsoo

#

ur code can be abused rly easily

#

with displaynames

#

players can change their stuff to anything with that display name and abuse ur plugin

crimson scarab
#

even with the colours?

grim ice
#

yeah

opal juniper
#

I think so

#

Yeah

grim ice
#

they can change colors

crimson scarab
#

what is the alternative

grim ice
#

isSimilar

#

and ur itemstack

crimson scarab
#

does anybody have an idea on why the variable i is being counted to twice the amount before the scheduler ends

grim ice
#

thats really weird

#

is ur main class

#

registering the listener twice

crimson scarab
#

nope

grim ice
#

just check if u have the line repeated (ppl seem to do it sometimes)

#

hmmm

crimson scarab
#
    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(new zeusSceptre(), this);
        getCommand("givecustomsword").setExecutor(new giveWeapon());

    }
#

sorry again for the lack of conventions I was only aware of variables

grim ice
#

I can't figure out why it's being called twice, are you sure it did?

crimson scarab
eternal oxide
#

its running twice because you are counting ALL entities, then only applying damage and counting up for living ones.

#

so the first run doesn;t find enough

grim ice
#

o

crimson scarab
#

so do i need to change my entity list to exclude those i'm not targeting

eternal oxide
#

actually only players, monsters and not dead, yet the count is ALL entities

#

and create a Collection, so you are not calling it twice

grim ice
#

also u could replace the (entity instanceof Monster || entity instanceof Player) with checking if its not an animal

eternal oxide
#

If you use teh Predicate you don;t need any other test

grim ice
#

Elgar

#

do you know a way i can check if a tree is a 2x2 spruce

eternal oxide
#

in an event or something?

grim ice
#

ye

#

@EventHandler
public void Spruce(StructureGrowEvent e) {
for (BlockState b : e.getBlocks()) {
if (b.getType() == Material.PODZOL) {
b.setType(Material.AIR);

        }
    }
}
#

i thought of that

#

idk tho i havent tried it

stone sinew
grim ice
#

o

#

No

#

dark oak does not represent spruce

stone sinew
grim ice
#

I don;t think theres one for spruce

#

i searched in google there is nothing

stone sinew
grim ice
#

I checked that.

#

there is no TreeType.SPRUCE

#

it might be REDWOOD, I don't think so tho

stone sinew
#

REDWOOD or MEGA_REDWOOD

grim ice
#

hm

stone sinew
#

If anything just debug it... plant saplings use bonemeal and check if e.isFromBonemeal()

grim ice
#

hm

#

what im doing rn is stopping podzol from spawning

stone sinew
grim ice
#

Same thin

#

thing

#

it wont replace

#

will it

stone sinew
grim ice
#

oh god it will if its dirt

#

aaaaa

#

idk then

stone sinew
#

e.getBlocks().removeIf(b -> b.getType() == Material.PODZOL)
Adjust the code accordingly.

woeful crescent
#

How do I reduce a player's knockback in 1.8.8?

lunar schooner
#

Silly question maybe, but I've been pulling my hair out for an hour now. I need to get a constructor taking in a Class<?>[] reflectively, the question is how do I stick that Class<?>[] in the constructor. the compiler doesnt like any of:

  • Object.class.getClass.arrayType()
  • Class<?>[].class (This is allowed for Object[].class though?)
  • Class.forName("java.lang.Class").arrayType() (On Windows this is fine, On Linux with openjdk-16-jdk-headless doesn't like it)
  • Class.class.arrayType()
valid crag
#

you want an array of classes

#

not a class of an array

eternal oxide
#

Object.class.getConstructor(Class[].class)

crimson scarab
#

quick question how to remove item from list java?

lunar schooner
valid crag
#

you can further cast the Class[].class to a (Class<?>[])

crimson scarab
#

im not sure how to use filter for nearbyentites

valid crag
#

to get the exact type

#

class objects don't exist with type parameters because of type erasure

#

so Class[].class is equivalent to Class<?>[].class

lunar schooner
valid crag
#

yes, because it can't exist

#

because of said type erasure

stone sinew
valid crag
#

the distinction only exists at compile time

lunar schooner
#

Still curious though that some things work on Win but not on linux lol

valid crag
#

which is why you can cast a Class[].class to Class<?>[].class, but not create the latter directly

stone sinew
eternal oxide
#

ah

#

Yep chap earlier, I told him to use the predicate method thats in Bukkit

quaint mantle
#

how to create mob permanent metadata

#

after restart

unique halo
#

on spigot 1.8.8,
how do i make it so that a player cannot attack any entities? is there something like player.setcantattack(true) idk

vague oracle
#

EntityDamageByEntityEvent and cancel it if its a player

unique halo
#

also, does getNearbyEntities get all the entities within an ellipsoid of the player, or within a box of the player?

valid crag
#

a sphere

vague oracle
#

Most likely a box based on this "Returns a list of entities within a bounding box centered around a Location."

valid crag
#

in that case a cube

#

though i vaguely recall it being a sphere

vague oracle
#

Was a guess 🙂

valid crag
#

could be wrong ig, none of my logic has ever really hinged on it being either

vague oracle
#

If you want it to be a circle you could just do it yourself

tacit drift
#

for after restarts

#

and when the server starts

#

restore the mobs

#

just like how MythicMobs,WildStacker etc plugins do

unique halo
quaint mantle
#

?

tacit drift
#

idk

#

look on ws's github

quaint mantle
#

hey does anybody know the MC experience scale

#

is it like

#

(xp points / (their level * 2))

#

for xp adding/removign

proud basin
#

so I see that Map#get takes a long meaning I can't use it under a string is there another way around this?

crimson scarab
#

can somebody explain how to filter nearby entites i'm having issues

unique halo
#

how do i check if a coordinate, is inside of an entities bounding box?

eternal oxide
#

entity.getBoundingBox().contains(location.toVector())

unique halo
#

omg ty

#

does location.toVector just give (x, y, z) or is it (x, z, y) bcz i know that most things use z as height, instead of y

eternal oxide
#

its x,y,z and in all 3d its y is the veritcal axis

#

x/z is planar

unique halo
#

alr

valid crag
#

minecraft is pretty odd about its axes

#

i don't remember the details but y being used for the vertical axis is nonstandard

eternal oxide
#

only the +-

quaint mantle
#

so hey

dusk flicker
#

ye mc is weird

quaint mantle
#

how do i remove players from the online players counter with the ServerListPingEvent

eternal oxide
#

I've not done any 3d for many years, other than MC so I've likely forgotten

#

oh yes, normally GL etc is z is into teh screen

dusk flicker
#

I can get my self screwed up sometimes if im working with models and switch to mc and the axis's are diff lol

valid crag
#

yeah in rendering and shit z is the depth

dusk flicker
#

in most stuff it is

eternal oxide
#

I totally forgot that

crimson scarab
#
@EventHandler
    public void OnDropTrident(PlayerDropItemEvent event) {
        final int[] i = {0};
        if (event.getItemDrop().getItemStack().getItemMeta().getDisplayName().equals(ChatColor.LIGHT_PURPLE + "Zeus's Sceptre")) {
            event.setCancelled(true);
            BukkitScheduler scheduler = plugin.getServer().getScheduler();
            int size = event.getPlayer().getNearbyEntities(32, 32, 32).size();
            List<Entity> entities = (List<Entity>) event.getPlayer().getNearbyEntities(32, 32, 32).stream().filter(Monster.class::isInstance);
            for (Entity entity : entities){
                BukkitTask task = new BukkitRunnable() {
                    public void run() {
                        if (size <= i[0]) {
                            cancel();
                        }
                        if ((entity instanceof Monster || entity instanceof Player) && !entity.isDead()) {
                            entity.getWorld().strikeLightning(entity.getLocation());
                        }
                        i[0]++;
                        System.out.println(size + " | " + i[0]);
                    }
                }.runTaskTimer(plugin, 20L, 20L);
            }
        }
    }
#

My error is
java.lang.ClassCastException: class java.util.stream.ReferencePipeline$2 cannot be cast to class java.util.List (java.util.stream.ReferencePipeline$2 and java.util.List are in module java.base of loader 'bootstrap')

#

I believe it resonates from line 8

eternal oxide
#

That is way more complex than you need

#

You don;t need a counter

#

You only need getNearbyEntites with a Predicate to select which types

#

no filters

#

no streams

crimson scarab
#

i googled and look through docs for predicate but couldn't understand it

lunar schooner
eternal oxide
#

entities = event.getPlayer().getNearByEntities(32, 32, 32, e -> { e instanceof Monster});

crimson scarab
#

and why do i not need a counter?