#help-development

1 messages · Page 1853 of 1

rotund prawn
#

can someone help?

young knoll
#

What do you mean it’s not banning them

rotund prawn
#

its not banning him

#

he vcan join back

#

and its not doing anyhting

#

when i trxy to do it

proven coral
young knoll
#

Ah

#

Also no, the plugin would have to support it as far as I know

proven coral
#

agh

snow stratus
rotund prawn
#

whats that

#

doesnt work

snow stratus
#

Use .

#

Player.setBanned

rotund prawn
young knoll
#

That’s not a thing, at least not in 1.18

rotund prawn
#

im using 1.16.5

#

is there a another way for 1.16.5?

snow stratus
#

Huh, it isn’t a thing, could’ve swore it was

rotund prawn
#

oh no problem

#

gtg dinner

snow stratus
#

hmm,

Bukkit.getBanList() 

only takes Type.NAME and Type.IP

You might be able to do something like

Bukkit.getServer().getBannedPlayers().add(Bukkit.getOfflinePlayer(player.getUniqueId()));
player.kickPlayer("You are banned");

Not sure if it'll work though

@rotund prawn

snow stratus
#

and the only way to get the banlist is by doing

Bukkit.getBanList(Type.NAME)
or
Bukkit.getBanList(Type.IP)

Which is fine if the player is online since their name won't change.
If they're offline you're going to have to do a name lookup with Mojang's servers

unkempt peak
#

So what's the issue?

snow stratus
#

I guess nothing. idk why there's not a UUID Type

unkempt peak
#

Just use that

#

The api has a method for getting ips

snow stratus
#

That's fine if you want to IP ban someone

young knoll
#

I think you might be able to stick the uuid in as a string and have it work

unkempt peak
#

Why wouldn't you ip ban?

young knoll
#

Bans are weird

young knoll
snow stratus
#

Does an IP ban also player ban? Or can I pull out my phone hotspot and jump right back on with my same account?

snow stratus
unkempt peak
#

No you aren't given it a player

#

I'm pretty sure it would be IP only

snow stratus
# rotund prawn nope, doesnt work

You could always do old reliable
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "ban " + player.getName() + " You are banned!");

#

There has to be a better way than passing a player name as the argument, but I'm loading into a Tarkov raid rn

rotund prawn
unkempt peak
#

Not a fan of executing console commands in a plugin but maybe it would work

rotund prawn
#

getting errors

snow stratus
rotund prawn
#

doestn owrk

snow stratus
#

Bukkit, not Plugin

rotund prawn
#

oh

#

still doestn work

young knoll
#

You can easily make your own system using the login event and a file to save uuids

sullen marlin
#

The name ban list is the same as the uuid ban list

snow stratus
#

Yeah, but why reinvent the wheel when the ban file already does that

sullen marlin
#

The name is bad and predates uuids

#

Think of it as PLAYER

young knoll
#

So shoving a uuid in as a string works

snow stratus
unkempt peak
#

Yeah you don't have to use spigot/minecrafts banning system

young knoll
#

Or do you need to shove the name in still

young knoll
#

What’s spigots thoughts on duplicate stuff with better names

#

IE adding Type.UUID that just redirects to Type.NAME

unkempt peak
#

Or it would make alot more sense to rename Type.NAME to Type.PLAYER

buoyant viper
#

would be nice to be more descriptive in code

buoyant viper
young knoll
#

Renaming is a breaking change

unkempt peak
#

so its just Type.PLAYER and Type.IP

young knoll
#

Spigot avoids breaking changes

sullen marlin
#

Be the change you wish to see in the world

unkempt peak
#

Oh yeah

buoyant viper
#

ezpz PR

young knoll
#

Can’t tell if that’s an invite to PR a breaking change :p

buoyant viper
#

then make it not breaking

snow stratus
#

Just add another type that then calls NAME

unkempt peak
#

Or you know just add a ban method to the player class so you don't have to deal with all that

unkempt peak
#

OfflinePlayer

#

ban method

young knoll
#

Yeah that’s another option

foggy estuary
#

does anyone know how to prevent the timer becoming negative i tried doing ```
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
public void run() {
countdown --; //Taking away 1 from countdown every 1 second

final Score score = plugin.o.getScore(ChatColor.of("#fe6f5e") + "Time Left:"); //Making a offline player called "Time:" with a green name and adding it to the scoreboard
score.setScore(countdown); //Making it so after "Time:" it displays the int countdown(So how long it has left in seconds.)
 
if(countdown == 0) {
     for(Player p : Bukkit.getOnlinePlayers()) {
    p.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());

    
    if(countdown == -1) {
        countdown = countdown - countdown + 20;
        
            p.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
    }
     

    //plugin.getServer().getScheduler().cancelTasks(plugin);

     }
    ```
young knoll
#

If you don’t want to PR it, at least consider making a Jira issue

foggy estuary
#

Im not sure what the problem is then.

candid quail
#

@foggy estuary if countdown is less than zero

buoyant viper
#

^

foggy estuary
#

i tried that

candid quail
#

Make sure it's actually called?

#

Triple checked the signs?

foggy estuary
#
            countdown = countdown - countdown + 20;
            
                p.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
        }```
#

is what i did

#

i can also do < 0

#

but it doesnt change it

candid quail
#

Change it to <=

foggy estuary
#

ok

next zinc
#

Anyone know how to detect if a player left clicks twice?

rotund prawn
#

@snow stratus found the problem. it was a nullpointerexpection

candid quail
#

@next zinc store a bool for first click second click, depends on what event

next zinc
#

Im using PlayerInteractEvent

foggy estuary
next zinc
#

and Ill try that and see how it works

woeful crescent
#

hey guys, i tried to make a class configurationserializable, but it's not working very well

#

it gives a noclassdeffound error before i even load anything

foggy estuary
#

My countdown always counts twice as fast.
Thus, not 60, 59, 58 ... but 60, 58, 56.
It happens after i do this if(countdown <= 0) { countdown = countdown - countdown + 20; for(Player p : Bukkit.getOnlinePlayers()) { p.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());

What have I done wrong?

woeful crescent
#

and can be used

ivory sleet
#

also

#

maybe just post the entire snippet

ivory sleet
#

and not just parts

young knoll
#

countdown -= 20 :p

ivory sleet
#

?paste btw

undone axleBOT
foggy estuary
#

The other guy told me to do <= so i listened

ivory sleet
#

so you don't know for yourself what you're doing?

foggy estuary
#

No i needed help with that

ivory sleet
#

well

#

post the entire runnable code

foggy estuary
wet breach
#

you shouldn't be checking if it is -1 because you shouldn't be allowing it to get that far

foggy estuary
#

I know i changed it to 0 after

wet breach
#

countdown = countdown -= countdown + 20;
this is very redundant

#

using -= is the same as doing countdown = countdown - (number)

#

so you can just collapse that down into a single =

young knoll
#

countdown -= 20

wet breach
#

https://paste.md-5.net/kiwuzegifo.cs#L46
on this line, we don't need to check if it is less than 0. If you really want to check if it is less than zero it should be an error check because you only care if it hits 0

#

the error check if it runs means something went really wrong XD

#

anyways once it hits 0, at the end of everything you want to do on 0, should be where it resets the timer or whatever else

#

<= means if it is less than or equal to

#

since it is a loop we shouldn't have a scenario where 0 gets skipped and now at -1 unless again something went really wrong

spiral light
#

from what is this:

Trying to mark a block for PostProcessing @ MutableBlockPosition{x=380, y=0, z=327}, but this operation is not supported.

while generating structures like villages/swamphut/stronghold ?

dense geyser
#

Is there a way to freeze Bukkit.getServerId() so it doesn't change?

buoyant viper
#

store it somewhere that doesnt change 😎

fleet imp
#

is there an onChat event or some

buoyant viper
#

theres AsyncPlayerChatEvent

fleet imp
#

oh thx

wet breach
#

And SyncPlayerChatEvent

#

depends which you need

opal juniper
buoyant viper
#

doesnt that actually wrap back around to the Async counterpart

wet breach
spiral light
flint carbon
#
    public void onInteract(PlayerInteractEvent e) {
        Player p = e.getPlayer();
        ItemStack item = new ItemStack(Material.PLAYER_HEAD);
        ItemMeta meta = item.getItemMeta();

        if (e.getAction().equals(Action.RIGHT_CLICK_AIR) || e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {

            if (p.getInventory().getItemInMainHand().equals(Material.PLAYER_HEAD)) {

                assert meta != null;
                if (meta.getDisplayName().contains("Infinity Gauntlet")) {

                    e.setCancelled(true);

                } else if (p.getInventory().getItemInOffHand().equals(Material.PLAYER_HEAD)) {
                    if (meta.getDisplayName().contains("Infinity Gauntlet")) {
                        e.setCancelled(true);
                    }
                }
            }
        }
    }
}```

Hey I am trying to deny player head placement of a specific item, but it says 

"'equals' between objects of inconvertible types 'ItemStack' and 'Material'"

I'm pretty new to Java so if my code looks bad, you know why
wet breach
#

if something is sync in the implementation your async scheduler isn't going to magically make it async

spiral light
#

nono...
in asyncplayerchatevent
if you need to place blocks for example ... you can call a BukkitSchedular

wet breach
#

Ah ok

slow oyster
#

I have a bit of a dilemma, a while back I added this method as a PR https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Bukkit.html#craftItem(org.bukkit.inventory.ItemStack[],org.bukkit.World,org.bukkit.entity.Player) I use it to add autocrafting to my plugin, but I've ran into an issue when trying to do the autocrafting for offline players, since it obviously takes a Player instance and I don't have that whilst the player is Offline. The player instance is used to send a PrepareItemCraftEvent. I'm thinking I'm going to need another method that just crafts vanilla recipes without the PrepareItemCraftEvent

wet breach
#

you don't need the object to make it appear they are online, you just need to construct enough of the player object to satisfy what you need 😛

sullen marlin
#

How can you craft offline players???

little trail
#

What's the format for a clickable link again

wet breach
#

however in terms of a PR, not sure why it would be a useful thing in the base code

opal juniper
spiral light
#

^^

wet breach
#

that is a good one

slow oyster
# sullen marlin How can you craft offline players???

What do you mean by craft offline players? The original method crafts an item as if it were the player, I.e using their inventory, the PrepareItemCraftEvent manipulates the result for custom recipes etc. Obviously this isn't possible for an offline player.

sullen marlin
#

well how can you craft as an offline playert

#

and why

slow oyster
wet breach
unreal quartz
#

and beware of any plugin which listens to the craft event and wants to do something with the player

wet breach
#

^

slow oyster
# sullen marlin and why

So my plugin allows you to create auto-crafting tables using chests above a crafting table as the ingredients, and you set your recipe in the table. It then runs even if the player is offline etc

sullen marlin
#

seems player is pointless in that scenario then

slow oyster
#

Apart from the PrepareItemCraftEvent

#

Which plugins use to create custom recipes

sullen marlin
#

wouldnt 'public static ItemStack craftItem(@NotNull ItemStack[] craftingMatrix)' be sufficient for you

sullen marlin
sullen marlin
#

look at ComponentBuilder, should be obvious

inland palm
#

hey!

#

i run a server and new help

#

whats a good anti cheat?

sullen marlin
#

this is a development channel

slow oyster
inland palm
#

oh

sullen marlin
#

yes there is addRecipe

slow oyster
#

Okay so if anyone complains I can just tell them to use the API correctly then 😄

#

the craftItem() method is probably going to work best then

fleet imp
#

how do i get the index of a char in a string

#

or, is there an event for using a cmd

sullen marlin
#

those questions seem unrelated, why do you say or

little trail
sullen marlin
candid quail
#

@sullen marlin what would your recommendation be for replacing NMS for NBTTagCompound without reliance on PDC?

fleet imp
little trail
#

..what

quaint mantle
#

use pdc

little trail
#

Why did you reply to me

sullen marlin
candid quail
#

PDC Doesn't stretch over to all the items I want use, I want to remove reliance upon NMS

sullen marlin
#

wat

#

every item has PDC

quaint mantle
#

what

candid quail
#

One sec might of had a brain fart

#

For like a month

foggy estuary
#

make it restart countdown from 20 again

#

manually

woeful crescent
#

you can take a look at how it creates packets and stuff there if you're not familiar with it

candid quail
#

I've had a brain fart for a month

little trail
fleet imp
#

caps lock

sullen marlin
#

?jd

slow oyster
#

Also @sullen marlin when I'm running CraftBukkit inside IntelliJ I always get a crash because Bukkit.getConsoleSender() returns null but is marked as @NotNull, changing it to Nullable fixes the issue for me 🤷‍♂️

#

I'm not sure why running in IntelliJ causes it to return Null though, but it also means that the Null check isn't needed if it's supposed to be NotNull 😄

rapid quiver
#

Is this the right place to ask for BossShopPro help?

slow oyster
young knoll
little trail
young knoll
#

broadcastMessage does not support components

little trail
#

so how on earth do so many servers use links

hasty prawn
#

The Spigot class wuv_u

little trail
#

editor is telling me broadcast is 2 strings not components

#

my server object is an org.bukkit.Server

sullen marlin
#

.spigot().broadcast

young knoll
#

Huh, why did I assume that didn't exist

#

I guess because .spigot stuff is still kinda weird :p

sullen marlin
#

at the end of the day its just a loop

#

you can build it from sendMessage

young knoll
#

Has deprecating .spigot and merging it into bukkit ever been considered?

sullen marlin
#

its complicated, and also a bit pointless

#

because if you want to support any older version you'll just use the old method anyway

slow oyster
#

I forget there are spigot additions since I just depend on Bukkit

sullen marlin
young knoll
#

True

sullen marlin
#

we dont even publish bukkit to the maven repo since 1.15

slow oyster
#

Huh? As in depend on it in a plugin?

#

Oh

young knoll
#

.spigot() stuff comes from the days when spigot and bukkit had different maintainers :p

slow oyster
#

Maybe I am using spigot then

young knoll
slow oyster
#

Ah yeah <dependency> <groupId>org.spigotmc</groupId> <artifactId>spigot-api</artifactId> <version>1.14.4-R0.1-SNAPSHOT</version> <scope>provided</scope> </dependency>

half spoke
#

When I run a plugin it gives me this error in server console

#

[22:15:55 ERROR]: Could not load 'plugins/GrinchSimulator.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `ro.Fr33styler.GrinchSimulator.Main'
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:75) ~[patched_1.17.1.jar:git-Purpur-"4ff0630"]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:153) ~[patched_1.17.1.jar:git-Purpur-"4ff0630"]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:414) ~[patched_1.17.1.jar:git-Purpur-"4ff0630"]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:322) ~[patched_1.17.1.jar:git-Purpur-"4ff0630"]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:419) ~[patched_1.17.1.jar:git-Purpur-"4ff0630"]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:322) ~[patched_1.17.1.jar:git-Purpur-"4ff0630"]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1233) ~[patched_1.17.1.jar:git-Purpur-"4ff0630"]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:322) ~[patched_1.17.1.jar:git-Purpur-"4ff0630"]
at java.lang.Thread.run(Thread.java:831) ~[?:?]
Caused by: java.lang.ClassNotFoundException: ro.Fr33styler.GrinchSimulator.Main
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:153) ~[patched_1.17.1.jar:git-Purpur-"4ff0630"]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:105) ~[patched_1.17.1.jar:git-Purpur-"4ff0630"]
at java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[?:?]
at java.lang.Class.forName0(Native Method) ~[?:?]
at java.lang.Class.forName(Class.java:466) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:73) ~[patched_1.17.1.jar:git-Purpur-"4ff0630"]
... 8 more

young knoll
#

org.bukkit.plugin.InvalidPluginException: Cannot find main class ro.Fr33styler.GrinchSimulator.Main

sullen marlin
#

youre not running spigot

serene egret
#

your missing your main method?

young knoll
#

Also

serene egret
#

smth like that

young knoll
#

patched_1.17.1.jar:git-Purpur

quaint mantle
#

bla bla bla

half spoke
#

I am running purpur 1.17

young knoll
#

This isn't purpur

#

Anyway

#

Your main class entry is wrong

slow oyster
#

Man as a plugin dev all the derivatives of Bukkit really cause a lot of headaches, so many times I've had to completely change an event because Paper disables it or something similar 😄

serene egret
#

for some reason i cant figure out a way to cound this array to display on the tab footer, is there a better way of doing this?

#

sorry for cutting in

slow oyster
buoyant viper
#

u can just call .size from getOnlinePlayers

half spoke
young knoll
#

This

#

Is a discord for spigot

buoyant viper
#

not purpur

half spoke
#

yes well I was coding the plugin for spigot

buoyant viper
#

does the class exist?

little trail
buoyant viper
#

is the package correct?

half spoke
#

It should be correct

buoyant viper
buoyant viper
#

send plugin.yml

little trail
#

So if it's depreciated what am I meant to use?

buoyant viper
#

?paste

undone axleBOT
buoyant viper
young knoll
#

Read the javadocs

little trail
#

what

young knoll
#

They tell you why something is deprecated

little trail
#

i can’t though, it says "JavaScript is disabled" when it isn't

buoyant viper
#

its like how Player#showPlayer and hidePlayer are deprecated, but theyre new methods

little trail
#

On bungee ones, not the spigot ones

buoyant viper
#

so it could be something like that

little trail
#

However I don't know

#

(It's not)

buoyant viper
#

now send ur main plugin class

tender shard
#

hidePlayer and showPlayer aren't deprecated when you use the correct one

buoyant viper
#

?paste

undone axleBOT
little trail
buoyant viper
buoyant viper
#

the package is wrong @half spoke

serene egret
young knoll
#

package ro.fr33styler.grinch;
vs
ro.Fr33styler.GrinchSimulator.Main

serene egret
#

does this make sense?

young knoll
buoyant viper
little trail
#

So what am I meant to use

#

if the constructor HoverEvent(HoverEvent.Action, BaseComponent[]) is depreciated and the bungee javadocs don't like any browser I use

buoyant viper
#

look around otherwise mayb some1 else knows ¯_(ツ)_/¯

young knoll
#

It's not deprecated

tender shard
young knoll
#

Let me guess, you are using the Paper API

young knoll
#

Ah wait right

#

It's content now

serene egret
little trail
#

So the ?jd is the wrong link?

#

as the bungee one there doesn't include hover event at all

#

But the one you sent does

tender shard
buoyant viper
#

?jd

tender shard
fleet imp
#

what is a java.lang.NoClassDefFoundError

buoyant viper
#

exactly what it says

tender shard
buoyant viper
#

java couldnt the class

tender shard
# serene egret

let me guess. you only set the value once and never update it

tender shard
buoyant viper
#

the java classn't

fleet imp
#

jaclassn't

foggy estuary
#

?paste

undone axleBOT
little trail
foggy estuary
little trail
#

Like I don’t know, a string?

foggy estuary
#

or anything

tender shard
#

check the javadocs, Content is an abstract class

#

it has subclasses, e.g. Text

#

new Text("string") is a Content

tender shard
serene egret
tender shard
#

what is Players? a class?

quaint mantle
#

Hey, I am quite a newbie to MC java development. When building an artifact it builds without faliure. However when I check the directory it is set to there is no jar. Any ideas?

tender shard
quaint mantle
#

I think maven

tender shard
#

it's by default in the "target/" directory

serene egret
slow oyster
#

Players is going to be out of scope outside of the run() function so you can't access it?

tender shard
slow oyster
#

create a static variable in your class probably

tender shard
#

ugh no not at all

quaint mantle
#

I set it to a folder on my desktop, yet didn't any jars built, Ill grab some screenshots.

tender shard
#

why would you want to store the amount of players the server had on startup instead of updating it every second or everytime a player joins leaves?

#

why don't you just directly use Bukkit.getOnlinePlayers().size()?

#

no need to cache that in some static variable that you will then have to update everytime

tender shard
slow oyster
tender shard
#

yeah but still, doing "int players = ..." will never update automagically, which is what they are probably expecting^^

quaint mantle
tender shard
#

where did you set the output path? in your build.gradle file?

quaint mantle
#

Hmm it appears to be empty

tender shard
#

if your build.gradle is empty, you probably are not using gradle ^^

foggy estuary
#

is this right though?

#

if it dies

tender shard
#

I doubt the damage will ever be 0 when you set it to 749 like one line above

foggy estuary
#

well do you know why once i kill it the ravanger doesnt spawn...?

tender shard
#

the if will always be false

foggy estuary
#

y

tender shard
#

because 749 is not <= 0

foggy estuary
#

how do i make the other mob spawn once the evok dies

tender shard
#

by stopping to set the evoks health to 749 before checking whether it's dead

foggy estuary
#

i dont understand, thats what i did. no?

serene egret
serene egret
tender shard
#

you probably only run this code once and then ever again, correct?

serene egret
#

yea

young knoll
#

That won’t work

tender shard
#

as I said, it will never update then

young knoll
#

The number of players online changes

serene egret
#

should i loop it or rerun this function periodically

young knoll
#

Yes

#

Use a schedular

tender shard
#

it's like writing down your age on a piece of paper and then looking at it next year. the number won't have changed unless you write down your new age again

young knoll
#

Or placeholder API, it could handle this

serene egret
#

how can i declare this to be used in the footer

tender shard
#

that does not make any sense at all

#

have a look at this:

#

?learnjava

undone axleBOT
tender shard
#

and about spigot scheduler programming

serene egret
#

alr

tender shard
#

e.g.

#
        Bukkit.getScheduler().runTaskTimer(yourPlugin, () -> {
            // Everything here runs one per second (every 20 ticks)
        }, 20L, 20L);
young knoll
#

?scheduling

undone axleBOT
tender shard
#

everything inside of that will run once per second

misty current
#

hey, i wanna get into bungee development and i'd need to create multiple instances of the same server and it's pretty annoying that everytime i need to change something in the spigot servers i need to go ahead and copy paste it multiple times. Is there a better way to manage it?

tender shard
#

I just have symlinked all my .jars and their configs

misty current
#

what do you mean?

tender shard
#

all plugins and their configs aren't actually inside every server's plugins/ folder but inside another folder

#

and all server's only have "symbolic" links to the actual files

#

so all servers share the same plugin files

misty current
#

o

young knoll
#

Huh

misty current
#

how can you do that?

young knoll
#

Does that apply to the plugin data too

tender shard
#

on linux: ln -s [target] [linkname]

tender shard
young knoll
#

Ahh

tender shard
#

e.g. ln -s ~/servers/lobby/plugins/WorldEdit.jar ~/plugins/WorldEdit.jar

young knoll
#

Shame,

tender shard
#

now WorldEdit is actually at ~/plugins/ instead of inside ~/servers/lobby/plugins

young knoll
#

Why can’t I just symlink the world itself :p

tender shard
#

and you only have to update one .jar file or config and all servers get the update

misty current
#

java not enough 😔

tender shard
#

e.g. if you have 5 servers:

for server in server1 server2 server3 server4 server5; do
  ln -s ~/servers/$server/plugins/WorldEdit.jar ~/plugins/WorldEdit.jar
done```
round elbow
#

sooo I am experiencing this weird ass thing
new Location(Bukkit.getWorld(a.split(" ")[3]), x, y, z).getBlock().setType(Material.HEAVY_WEIGHTED_PRESSURE_PLATE);
This sets a specific block to iron pressure plate
but it actually doesnt even if i fire this 1000 times
Unless i restart the server
is there a way to make it work by reloading the plugin instead of restarting the whole server? it seems to fire correctly without any errors but it doesnt physically work until server is restarted

misty current
#

i mean in general

#

recently i've found many cases where i need it

#

also rn i'm on windows since i'm testing in localhost

young knoll
#

I’d love to have a survival setup that is fully synced

#

But that would not be an easy task

tender shard
#

you can easily get git bash and learn shell on windows

#

I use it all the time to do stuff much faster than in explorer

misty current
#

so i can use bash command on windows?

tender shard
#

sure

misty current
#

o useful

tender shard
misty current
#

thanks

tender shard
#

np 🙂

#

but of cuurse you won't have ALL the typical linux commands

#

stuff like find, top, ps, grep is of course included, but you won't find stuff like systemctl

misty current
#

couldn't i

tender shard
#

sure, that only requires ln

#

that's included

misty current
#

what does the $ do in there?

#

$server

tender shard
#

it's a variable

#

e.g. look at this:

misty current
#

oh the bar

#

bar

#

var

#

ffs spelling

#

from the loop

tender shard
#
for name in mfnalex kill05; do
  echo $name
done
#

this prints

mfnalex
kill05```
misty current
#

it will send mfnalex and kill05

#

oh ye

tender shard
#

yes on 2 lines though

misty current
#

yup like println

#

i kinda know the basics because i used to make those shutdown files to mess with my friends

#

:p

tender shard
#

you can also easily do stuff like this

for file in logs/*.gz; do rm logs/$file.gz; done
#

so it also supports glob expanding (the * thing for files) and much more

misty current
#

so this runs something for every file

#

in logs

tender shard
#

that ends with .gz

#

yes

misty current
#

ahh oke

#

thanks

tender shard
#

np

misty current
#

and the tilde refers to the path the bash is in

#

doesn't it

tender shard
#

no

#

~ is your home path

#

e.g. /home/mfnalex or C:\Users\mfnalex

#

the current path is just a dot:
rm -rf . deletes the current directory and all it's contents

#

and .. is the folder above your current path

#

~ is just short for $HOME

young knoll
#

It deletes all .gz files in logs

tender shard
#

yep

young knoll
#

I’m a Linux

foggy estuary
#

?paste

undone axleBOT
foggy estuary
wooden fable
#

Is there any other way to do this? because new HoverEvent(action, componentbuilder) is deprecated:

message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Klik hier om te joinen!").color(ChatColor.GOLD).create()));
misty current
#

and can I assign a var to a path so i don't have to keep on copy pasting it?

sullen marlin
#

?jd

tender shard
young knoll
#
                
                
 if(e.getEntity().hasMetadata("Vin")){    
                    if(evok.getHealth() <= 0) {```
#

I wonder

sullen marlin
#

yes, use Text content

young knoll
#

Oh wow discord butchers that

sullen marlin
#

new Text(new ComponentBuilder(....))

tender shard
misty current
#

a easy

wooden fable
#

Thx md_5!!

misty current
#

oke lemme do some big brain coding

tender shard
#

ok 😄

#

but be aware, bash's if syntax is a bit weird

unreal quartz
foggy estuary
# young knoll I wonder
                if(e.getEntity().hasMetadata("Vin")){    
                    if(ent.isDead()) {``` ok well i did this too and nothing happend
young knoll
#

Debug it

tender shard
#

correct

misty current
#

what's the pause equivalent of bash

young knoll
#

Where does the code stop, add some print statements

unreal quartz
#

sleep

young knoll
#

Or attach an actual debugger if you want to be fancy

tender shard
misty current
#

keypress

tender shard
#

read

unreal quartz
#

-p switch

tender shard
#

read -p "Enter Text: " var puts the entered text into $var

#

just read simply waits for you to press enter

misty current
#

ok bash weird fr

tender shard
#

it's not weird 😄

#

it's just different 😛

misty current
#

you can't have spaces before and after the =

tender shard
#

nope, you can't

#

because it wouldn't make sense

unreal quartz
#

Because a bash script is literally a series of lines as you would write into your shell

misty current
#

ah right

#

makes sense

tender shard
#

echo = hi =
for example should print "= hi =" instead of assigning a variable

unreal quartz
#

var = a
it would take arg0 as 'var' and try to find a program calledl 'var' in your path

#

with = and a as arguments to the program 'var'

quaint mantle
#

Is it possible to give a falling block a name and check if it landed?

quaint mantle
#

yes

misty current
#

thanks for the help

tender shard
tender shard
quaint mantle
quaint mantle
tender shard
#

or do you mean when it has turned into a solid block?

tender shard
tender shard
#

if it's no longer valid, it's either dead or has despawned for other reasons, so that should work

quaint mantle
#

When he fell

tender shard
#

yeah as long as it has turned into a solid block, it probably is not valid anymore

#

so FallingBlock#isValid will be false once it landed

quaint mantle
#

okay, thanks

#

Anyone have a idea about a good practice plugin with boxing?

young knoll
#

Do you want to code one

unkempt peak
#

how do i stop named entities from being logged in the console on death?

#

I have alot of named entities and its spamming the console when they die

tender shard
quaint mantle
#

Anything

tender shard
#

maybe you can also add a filter to the existing logger

young knoll
#

If you aren’t coding it yourself

quaint mantle
#

pizdabol))

young knoll
#

This isn’t the right channel

wooden fable
#

player.sendMessage(TextComponent); is deprecated.

Does someone know how i can convert a ChatComponent into a Component so i can send it non deprecated?

tender shard
#

there is no Player#sendMessage(ChatComponent) in spigot

wooden fable
#

Oh i meant TextComponent

tender shard
#

That doesn't exist too

#

it's all String

young knoll
#

Player.spigot().sendMessage

tender shard
#

yeah but they said they use Player so I thought they must be using paper api or sth ^^

young knoll
#

Ah

#

AdVenture moment

#

Or is it just adventure? Idk

tender shard
#

Adventure Capitalist worst game ever

candid quail
#

Quick question does the PDC Persist between Item and Placed state?

tender shard
#

blocks do not have a PDC

wooden fable
#
TextComponent message = new TextComponent(".. .. ..");
tender shard
young knoll
tender shard
#

Text only extends Content which is no Component

wooden fable
# young knoll Did you see this?
message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(new ComponentBuilder("Klik hier om te joinen!").color(ChatColor.GOLD).create())));

I used it in my hover event

tender shard
tender shard
#

what is "message"?

#

ah a TextComponent I see

#

and on what are you calling sendMessage on?

wooden fable
#
Player p = (Player) sender;
            TextComponent message = new TextComponent("[FloppieSMP] Klik hier om de discord te joinen!");
            message.setColor(ChatColor.GOLD);
            message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(new ComponentBuilder("Klik hier om te joinen!").color(ChatColor.GOLD).create())));
            message.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "discord invite link lol"));
            p.sendMessage(message);

Full code

young knoll
#

Inb4 paper API

tender shard
#

p.spigot().sendMessage(message);

#

@wooden fable

wooden fable
#

still deprecated

unkempt peak
tender shard
candid quail
#

@tender shard The blocks I'm using it on stem from TileState

tender shard
young knoll
#

Then you can just use normal pdc

#

But it won’t automatically transfer when you place an item

candid quail
#

Just running into weird issues porting some nms code into PDC items

tender shard
young knoll
#

Use the BlockPlaceEvent

wooden fable
#
p.spigot().sendMessage(message);
candid quail
#

@tender shard take a poke:

    @EventHandler
    public void onPlayerPlaceBlock(final BlockPlaceEvent e) {
        Player p = e.getPlayer();
        if (!(e.getBlock().getState() instanceof TileState))
            return;
        else {
            if (e.getItemInHand().getItemMeta().hasLore()) {
                NamespacedKey k = new NamespacedKey(LabToolsPlugin.getPlugin(LabToolsPlugin.class), "cid");
                PersistentDataContainer co = e.getItemInHand().getItemMeta().getPersistentDataContainer();
                CraftableBlock c = CustomBlocks.get(co.get(k, PersistentDataType.STRING));
                String uid = co.get(k, PersistentDataType.STRING);
                TileState state = (TileState) e.getBlock().getState();
                PersistentDataContainer con = state.getPersistentDataContainer();
                con.set(k, PersistentDataType.STRING, uid);
                state.update();
                c.Place.Run(p, state);
            }
        }
    }
buoyant viper
young knoll
#

Yep paper API

#

Called it

wooden fable
#

Wait does it matter or not?

tender shard
buoyant viper
#

maam this is a spigot discord

tender shard
young knoll
#

Paper deprecated all bungee component methods

wooden fable
#

Oh okay thx!!!

tender shard
#

of course they will still work, they just want to use their system instead

#

but since they want to be compatible with spigot, they will never actually remove spigot methods

candid quail
#

Pretty sure as I set my item on creation (through crafting, I set the cid (which previously worked in NMS)) on the object but then transfer the pdc state on block place to tilestate

tender shard
#

you have to run it in a task instead

candid quail
#

Hmm, it's a pretty weird state tbh I've had it working with NMS

#

I'm switching out all my NBT Tag compounds to be PDC

#

@tender shard I'll give it a go

tender shard
#

tbh it's still easier to use my library

#

because you have block PDC's regardless of the block's state

#

so you can just instantly set a PDC value to the block, regardless of it was already placed or not

candid quail
#

I'll defo take a look!

tender shard
#

you can just do
PersistentDataContainer pdc = new CustomBlockData(yourBlock, yourPlugin);

#

then you have a PDC for that block 🙂

young knoll
#

I assume it uses chunk pdc

tender shard
#

ofc

young knoll
#

In the back end

tender shard
#

1.16.3+ only

#

it's just a wrapper around the chunk's pdc

young knoll
#

Nice

tender shard
#

yeah I had that idea in a dream

#

lol

candid quail
#

Ayy awesome

young knoll
#

World PDC when

tender shard
young knoll
#

Does it

tender shard
#

erm well

#

kinda

#

it's not a real PDC, it's what PDC uses in NMS

young knoll
#

So NBT

tender shard
#

non mojang mapped:

WorldServer fromWorld = ((CraftWorld) Bukkit.getWorlds().get(0)).getHandle();
WorldPersistentData persistentData = fromWorld.getWorldPersistentData()
MinecraftKey key = new MinecraftKey("cuve")
NBTTagCompound storageNBT = new PersistentCommandStorage(persistentData).a(key)
#

yeah actually just NBT

#

well but you could also just abuse some spawn chunk's PDC for a world PDC 😄

young knoll
#

True

#

I wonder if your block pdc would ever make it as a PR

gentle oriole
#

hi, is the if statement return immediately if the first operand is true? or does it check all the operands before it returns true?

tender shard
tender shard
gentle oriole
tender shard
#

|| = lazy, it stops once the first is not true

young knoll
#

It will short circuit

tender shard
#

| = continue to check all anyway

young knoll
#

So it will stop as soon as it finds a true

#

Or false in the case of &&

tender shard
#

I hate using | or & because it always looks like some bash commands

gentle oriole
#

anddd the only problem i can se is in the if statement

tender shard
#

can NEVER throw an NPE

#

unless you run it async and have very bad luck

gentle oriole
#

npe?

tender shard
#

nullpointerexception

gentle oriole
young knoll
#

args[x] will never be null in a command

#

Check the length

tender shard
gentle oriole
#

how do I do it?

young knoll
#

args.length

gentle oriole
#

oh

young knoll
#

Granted that would not be an NPE, but still

tender shard
#

yeah it would be ArrayIndexOutOfBounds. Maybe show the actual error you got @gentle oriole

tender shard
#

then either modules is null or enableDisable is null

gentle oriole
misty current
#

ok so i tested with it a bit (1 am shell o.o) with text files and i couldn't get it to work with symbolic links

candid quail
#

Ugh the NBT Tag Data is 10x more versatile than the PDC

young knoll
#

Not really

#

You can put anything in pdc with a type adapter

hasty prawn
#

So what actually implements PersistentDataHolder? TileStates, Entities, and Chunks?

tender shard
misty current
young knoll
#

In fact PDC is NBT

hasty prawn
#

Ahh gotcha

young knoll
#

It’s just a wrapper

misty current
#

when i edited a text file the other one didn't change

tender shard
#

let me check

misty current
#

while -f worked just fine

candid quail
#

But the PDC is rubbish at actually being Persistent, I had NBT Tag Data that could Persist from a precrafted state where as the PDC is wiped upon creation of a new Item on Crafting

unreal quartz
#

Some things simply won't work with symlinks

#

e.g. vim cannot read symlinked .vimrc configuration files

young knoll
#

You can easily copy the data yourself

tender shard
#

let's see about hard links

young knoll
#

I don’t think NBT is automatically copied when crafting

misty current
#

hard worked

young knoll
#

It is in smithing tables though

misty current
#

at least with text files

gentle oriole
#

im still getting null error. ive already changed it to

(args[0].length() != 1 && args[1].length() != 1) || !modules.contains(args[1]) || (!enableDisable.equalsIgnoreCase("enable") && !enableDisable.equalsIgnoreCase("disable"))
candid quail
#

@young knoll it's crazy but it did

tender shard
#

windows doesn't support symbolic links properly

#

you can create hard links instead

misty current
#

yeah sad

tender shard
#

ln file1 file2

young knoll
#

Drop the indexes, it’s just args.length

tender shard
#

works fine

gentle oriole
#

ah

misty current
#

i've added the -f so i don't have to delete the files if i need to rerun it for any reasons

unreal quartz
#

Your hostname is jagermeister

misty current
#

also does it persist through restarts?

unreal quartz
#

That's actually great lol

candid quail
#

Any ideas on Persisted Data from a Precrafted to a Crafted State (Without NBT)

gentle oriole
young knoll
#

No

tender shard
young knoll
#

args.length

#

Like I said

gentle oriole
#

but

#

AAHHHH

gentle oriole
#

I UNDERSTAND

worldly vessel
#

Hello, I want to use class from my manager plugin, but it seems like the class has two instances. Anyone knows how to fix this? (I'm sure I'm not shading anything from the manager plugin)
Error:
java.lang.ClassCastException: class ManagerPlugin cannot be cast to class ManagerPlugin (ManagerPlugin is in unnamed module of loader 'Manager.jar' @737ced05; ManagerPlugin is in unnamed module of loader 'plugin_im_usimg_the_api_in.jar' @9f2c1d3)
My code:

(ManagerPlugin) Bukkit.getServer().getPluginManager().getPlugin("ManagerPlugin")
misty current
#

make a static method in your manager plugin main class to get its instance

#

and call that

worldly vessel
#

I tried that too

worldly vessel
misty current
#

oke i managed to link stuff

#

time to sleep

#

ty again and bye

tender shard
candid quail
# young knoll You can easily copy the data yourself

I've abstracted a lot of the item creation process, for example to create a new custom item all I have to do is use this CraftableItem item = new CraftableItem(Material, Name, Lore, UniqueObjID, Material{} Recipe, ExecutionCodeOnUse()) in that same regards previously the NBTTag Data could persist as a part of the metadata container as it was treated as the same, whereas the PDC is not maintained between a precrafted and a crafted state, any suggestions on circumventing this would be bril

gentle oriole
#

its still erroring null...

public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        String enableDisable = args[0];
        String module = args[1];

        if (args.length != 2 || !modules.contains(args[1]) || (!enableDisable.equalsIgnoreCase("enable") && !enableDisable.equalsIgnoreCase("disable"))) {
            System.out.println(1);
            sender.sendMessage("Usage: /" + command.getName() + " [enable|disable|list] " + modules);
            return false;
        }
young knoll
karmic grove
#

so i wanna make my plugin combatible with lands plugin it says to add ```java
private final LandsIntegration landsIntegration;

public IntegrationExample(Plugin yourPlugin) {

    // view methods of this class: https://github.com/Angeschossen/LandsAPI/blob/4.8.17/src/main/java/me/angeschossen/lands/api/integration/LandsIntegrator.java
    this.landsIntegration = new LandsIntegration(yourPlugin);
}

// just a test
void test(Location location) {

// get a land area from a location
final Area area = landsIntegration.getAreaByLoc(location);

// check is a location claimed
final boolean isClaimed = landsIntegration.isClaimed(location);

}
candid quail
#

Hmm I'll take a look

young knoll
#

It does not say to add that in plugin.yml

#

That’s java code

tender shard
young knoll
#

You just need softdepend: [lands]

#

Or whatever the name is

karmic grove
#

thats all i need to add

young knoll
#

For the plugin.yml, yes

#

It will ensure lands loads before your plugin

gentle oriole
karmic grove
#

oh ok

tender shard
#

show the full stracktrace pls

gentle oriole
#

whats the thing called

#

the site

#

you can paste

tender shard
#

?paste

undone axleBOT
gentle oriole
tender shard
#

oh btw @misty current when installing git bash, there's an option enable support for real symbolic links

misty current
#

O

#

Thanks

young knoll
#

It does inside say array index out of bounds

unreal quartz
#

Alternatively, you could install Linux

misty current
#

I'll change tomorrow

young knoll
#

That should have been a reply, blah

tender shard
#

you can enable it in that file

young knoll
#

Discord let us add a reply when editing

#

Kthx

tender shard
young knoll
#

Yeah

gentle oriole
#

i only did /ad

buoyant viper
tender shard
buoyant viper
twin sapphire
#

How can i send TextComponent with ClickEvent with the MessageRaw Channel? I dont get it

young knoll
#

It says index 0 out of bounds for length 0

gentle oriole
tender shard
young knoll
#

Yes

#

So 0 arguments

tender shard
gentle oriole
#

but i didnt put anything in there when executing the command

tender shard
#

so you have an argument

tender shard
#

because you access the first element of the array (args[0]) although there is no first element

young knoll
#

There is no spoon

tender shard
#

check the length of the array before accessing it's contents

buoyant viper
#

god imagine per-chunk difficulty

young knoll
#

I mean

gentle oriole
young knoll
#

The game does kinda have that

buoyant viper
#

its per world iirc

young knoll
#

Local difficulty exists

tender shard
#

yes

young knoll
#

Controls stuff like the chance for mobs to wear armor

gentle oriole
#

but why did it say it errored on line 19

#

not 18

tender shard
#

the longer you stay inside one area the harder it gets there

young knoll
#

^

tender shard
young knoll
#

You can see it in F3

gentle oriole
#

line 18 is String enableDisable = args[0];

young knoll
#

Both of those won’t work if you have no args

tender shard
#

then your .jar doesn'T match your source code

#

you changed your code without recompiling and restarting the server if line 19 is the one with args[1]

#

your stacktrace cleary says that line 19 is the one with args[0]

gentle oriole
#

ah maybe it happened when I formatted it

tender shard
#

yeah probably^^

#

check the args.length() before accessing anything from it

young knoll
#

just length

#

It’s not a method

tender shard
#

oh right

gentle oriole
#

ah it finally worked

tender shard
#
if(args.length < 2)
// tell player "you need at least 2 arguments" and return
// now you can access your stuff
String val1 = args[0];
String val2 = args[1];
gentle oriole
#

so String val1 = null; null error?

young knoll
#

No that’s valid

tender shard
#

no

gentle oriole
#

eh?

young knoll
#

You just can’t do something like val1.trim() if the string is null

tender shard
#
String val1 = null; // fine
val1.toLowerCase(); // NullPointerException. "null" doesn't have a toLowerCase() method
gentle oriole
#

but didnt the error happened on String val1 = args[0];

#

and args[0] is null

young knoll
#

Yes but It wasn’t null

tender shard
#

yes, but you didnt have any nullpointerexception...

gentle oriole
#

it wasnt?

young knoll
#

It was array index out of bounds

#

Because index 0 did not exist

tender shard
#

As I already said 3 times, you had an ArrayIndexOutOfBoundsException

gentle oriole
#

ooohhh

tender shard
young knoll
#

Any variable can be null just fine (except primitives), you just can’t invoke any methods on said variable

tender shard
#

the "null" at the top is just the missing exception message

gentle oriole
#

thanks a lot

tender shard
#

np^^ next time pls instantly send the full stacktrace 😛

tender shard
# worldly vessel

DId you define a ServerManagerPlugin class inside both of your .jars or maybe even shaded the one into your other?

#

because if so of course they have the same name but they don't extend each other or sth

worldly vessel
#

Its even on the same java version

stone apex
#

Players that first join have a death bug.. I have 3 plugins. My first plugin teleports them to the new world at 0, 68, 0. The second plugin has an EventHandler that picks up on the change of worlds and teleports that player to the center of their plot. The third plugin is the plot plugin. I don't know why people are dying when they get sent to that world for the first time, once it happens once it never happens again..

#

But this is java code

hushed badger
#

hmm

#

maybe difference in height during tp?

#

what's the death msg?

stone apex
#

It's just player died in console

#

They are teleporting from y = 64 to y = 68

candid quail
#

@young knoll you free to jump in General to help me out with the CraftItemEvent?

hushed badger
stone apex
#

That is a patch for sure

hushed badger
#

what MC ver?

stone apex
#

1.18.1

hushed badger
#

mmk

stone apex
#

Using paper-109 but it's been around a bit

rough basin
#

?paste

undone axleBOT
candid quail
#

Anybody got an idea of comparing a CraftItemEvent to a ItemStack?

rough basin
#

i hate my code and life lmfao

hushed badger
next fossil
#

How do you convert from a DataWatcher to SynchedEntityData?

#
SynchedEntityData sed = npc.getEntityData();

It keeps giving me errors saying its a DataWatcher object, but there is none for the new Mojang Mapping itself

#

I keep getting NullPointerExceptions too because of it

gentle oriole
#

ArrayList<String> disabled = Modules.disabled; if I modify disabled, will Modules.disabled get modified as well?`

young knoll
gentle oriole
unreal quartz
#

Yes

gentle oriole
#

typo

candid quail
#

@young knoll more so extracting the result of the event in order to track down which custom it is to apply the pdc data I need to it

#

Happy to jump in general and show you where I'm stuck lol

gentle oriole
#

Hello, I have a problem. So firstly, I have two ArrayList String in class Modules. One of them is modules and the other one is disabled. Secondly. I have imported both said ArrayList into my Commands class.

    ArrayList<String> modules = Modules.modules;
    ArrayList<String> disabled = Modules.disabled;

Thirdly, I have a command that if I type /ad disable all, disabled = new ArrayList<>(modules); will execute. Causing Modules.modules to my knowledge to update. Fourthly, I have !disabled.contains("playerSlipped") in another class imported again using ArrayList<String> disabled = Modules.disabled;, The problem is !disabled.contains("playerSlipped") still returns true after executing /ad disable all. Fifthly, It only returns false when I reload confirm the server after executing /ad disable all

unreal quartz
rough basin
#

It seems that the task never works or is created, but no error is generated,
and the code in the previous line works normally. Is there any way to solve this problem?

Here is a full code of event and Task.
https://paste.md-5.net/pifirayosa.java

gentle oriole
unreal quartz
#

See array list clone method

gentle oriole
unreal quartz
#

Well it does

gentle oriole
#

im confuused

ebon siren
#

cast it

candid quail
#

@young knoll no joy

stone apex
candid quail
#

Wait

#

Figured it out

ebon siren
#
Object thing = new ArrayList<String>;
doTheFunctionThing((ArrayList<String>) thing);
#

or a more readable way

#
int someInt = 1;
float castedToAFloat = (float) someInt;
gentle oriole
#
ArrayList<String> disabled = Modules.disabled;
disabled = (ArrayList<String>) new ArrayList<>().clone();

System.out.println(disabled);
System.out.println(Modules.disabled);```Why doesnt it sync?
young knoll
#

Because .clone

gentle oriole
#

yes but isnt it supposed to sync with Modules?

#

when I reloaded it, thats when it synced. but disabled isnt syncing

storm quarry
#

how do you report a spigot plugin for using your code but making no mention/credit anywhere?

#

and i'm talking 90% of the codebase is my code not a little bit

candid quail
#

Ughh pdc

young knoll
#

Use the report button

storm quarry
#

the only report button I see is titled "Report Resource Update" which seems specific to an update or is that also just a general report button

candid quail
#

@young knoll am I not setting an Items PDC Correctly?

    @EventHandler
    public void onPlayerCraftItem(final CraftItemEvent e){
        List<CraftableItem> val = new ArrayList<CraftableItem>(CustomItems.values());
        List<CraftableBlock> CustomBl = new ArrayList<CraftableBlock>(CustomBlocks.values());
        Bukkit.getConsoleSender().sendMessage("Craft Event");
        for(int i = 0; i < CustomItems.size(); i++) {
            if(e.getInventory().getResult().equals(val.get(i).Item)) {
                NamespacedKey k = new NamespacedKey(LabToolsPlugin.getPlugin(LabToolsPlugin.class), "cid");
                e.getInventory().getResult().getItemMeta().getPersistentDataContainer().set(k, PersistentDataType.STRING, val.get(i).UniqueName);
                e.getWhoClicked().sendMessage(val.get(i).UniqueName);
            }
        }
        for(int i = 0; i < CustomBlocks.size(); i++) {
            if(e.getInventory().getResult().equals(CustomBl.get(i).Item)) {
                NamespacedKey k = new NamespacedKey(LabToolsPlugin.getPlugin(LabToolsPlugin.class), "cid");
                e.getInventory().getResult().getItemMeta().getPersistentDataContainer().set(k, PersistentDataType.STRING, 
CustomBl.get(i).UniqueName);
                e.getWhoClicked().sendMessage(CustomBl.get(i).UniqueName);
            }
        }
        

    }
}
young knoll
young knoll
#

You need to use setItemMeta after modifying it

stone apex
#

Can anyone join this server to see if they die lol not advertising but this death bug is the death of me

candid quail
#

Bout to fix a tonne of code @young knoll

rough basin
#

I just wants this task to repeat every 30 ticks and cancel itself.

stone apex
#

I already have mine and don't wanna start up a giant test server it's a super weird bug

buoyant viper
#

ezpz just keep deleting ur profile data

#

f

patent wadi
#

Hi, I'm trying to spawn a entity with type player but it wont, can someone suggest a method for this please?

young knoll
#

You cannot

#

You need packets

patent wadi
#

hmm

ancient plank
#

I love reading code without syntax highlighting

candid quail
#

@ancient plank ayyy

#

If it ain't precompiled jars being opened in notepad it aint worth it

young knoll
#

Microsoft word

candid quail
#

Never switching between NBT and PDC ever again lol

young knoll
#

Just never use NBT again

candid quail
#

Pretty much

#

It's a personal project more than anything

#

But better to use best practices instead of trying to take the easy way out

#

Ayy my wireless redstone is working again

#

This time not just in 1.17

swift adder
#

how to get spigot?

candid quail
#

@swift adder Build tools

swift adder
#

oh okay

mental moon
#

Is there a masterlist of all the NameSpacedKeys for all the registered recipes?
I want to make something that will "discover" all recipes for a player on join but I can't find the list to iterate from, or how to populate my own list.

karmic grove
#

is there a right click mob event or somthing like that or detect when damage is applied to certain mobs

late sonnet
sullen marlin
mental moon
hasty prawn
#

Bukkit.getServer().recipeIterator()

late sonnet
sullen marlin
#

Should return all recipes

young knoll
#

Assuming they have already been added

mental moon
#

Thanks, I'll look into it some more

karmic grove
#

atleast dont work for me

swift adder
hasty prawn
#

And EntityDamageEvent when they're damaged ^

swift adder
#

get the player then get the entity type

young knoll
#

Javadocs are here for reference

#

?jd

swift adder
#

ong

#

glad they made such a website

young knoll
#

No idea what that other link was

mental moon
#

I looked into the Recipe iterator, however I can't figure out how to turn that Recipe object into a NSK I can use for the #discoverRecipe(NameSpacedKey) function

sullen marlin
#

Check if Keyed, cast

#

Iirc there's still at least one type of recipe that isn't Keyed

late sonnet
#

In what case a recipe are not keyed (?

mental moon
#

Oh, I didn't realize recipes were a NSK. Thanks!

late sonnet
#

Or well maybe tomorrow can see what typw of recipe its not keyed xd

sullen marlin
#

Probably furnace recipe or something

#

One of the non crafting ones

young knoll
#

Merchant

#

Furnace is keyed

late sonnet
#

Merchant is a recipe?

young knoll
#

MerchantRecipe, yes

#

It technically extends recipe

late sonnet
#

I edit this class and dont remember xd

young knoll
mental moon
#

I'm probably not understanding right.
(recipe instanceof NameSpacedKey) gives me an inconvertible type error.
the only function off of recipe is #getResult() -> ItemStack

young knoll
#

Keyed

mental moon
#

Thank you, I found the NSK!

sullen marlin
#

What messages slow

#

Show

rough basin
#

Nothing

#

no Warning, no Errors.

#

just not working

sullen marlin
#

Did you register the event

rough basin
#

yeah i did

#

According to the debug message, it can be seen that up to line 16 is working normally.
But putting debug messages inside run() doesn't work either.

fleet imp
#

When I compile a Maven project, does it import the dependencies automatically?

#

or do i need the .jars in the same folder or some

sullen marlin
#

It does it automatically

fleet imp
#

then idk y im getting the err im getting. NoClassDefFoundError

young knoll
#

Did you shade

static ingot
fleet imp
#

wat

#

idk what that means