#help-development

1 messages · Page 2266 of 1

quiet ice
#

I believe you are unfit for programming

frozen cedar
#

how will this help me? it won't start emitting light...

quiet ice
#

Yes it won't

#

It purely filters out non-glowstone blocks

winged storm
#

whats wrong with this

earnest forum
#

?learnjava

undone axleBOT
frozen cedar
quiet ice
winged storm
#

oh

#

ok

#

ty

quiet ice
#

The method is even aptly named GETmaterial

#

Not set - GET

earnest forum
quiet ice
#

And GET does not mean set, okay?

#

Understood?

#

If not, stop trolling

frozen cedar
# quiet ice Understood?

I'm generating a chunk, and you're suggesting to write a continue if the block isn't a glowstone.

loud junco
#

what are you trying to do exactly

quiet ice
#

ah I see, data does something else

frozen cedar
quiet ice
#

Then just do

// [...]
if (blockData.getMaterial() != Material.GLOWSTONE) {
  data.setBlock(x,y,z,blockData);
  continue;
}
// [...]
opal juniper
#

why is it labelling these as the 1.19 ones

frozen cedar
loud junco
#

so the lighting is not updated in the chunk?

frozen cedar
eternal oxide
#

?paste

undone axleBOT
winged storm
#

i presume the cross means that there is a possiblity that it will return null if the enchantment does not exist. will this work if i ru nit?

quiet ice
frozen cedar
#

what am I supposed to do(

loud junco
#

probably just update the lighting in the chunk? i believe the Chunk class has an initLighting() method?

lost matrix
small current
#

this is an old code and won't work
if a gmc player without the permission drops an item, it won't get cancelled
there are a lot of listeners in one class im fixing it rn but might it be related to it ?
the thing won't even be called a i tried with every Priority

#

1.17.1

frozen cedar
loud junco
#

Chunk is a nms class

manic ice
lost matrix
eternal oxide
frozen cedar
eternal oxide
#

No more annoying version dependant 🙂

lost matrix
eternal oxide
#

yeps

winged storm
manic ice
#

yes

winged storm
#

would it also work if i make the level 10?

opal juniper
#

is this some sort of symlink issue?

manic ice
winged storm
#

thjx

#

is Enchantment.DURABILITY unrebaking then?

manic ice
#

mhm

twilit roost
#

How to get slot in which item in player's inventory is

lost matrix
twilit roost
#

lets say I have item of that netherite hoe
but idk slot in which it is
how do I get it?

lost matrix
#

*Inventory#first(ItemStack) is also viable

twilit roost
lost matrix
#

It returns the first slot at which the given ItemStack returns true for isSimilar()

quaint mantle
#

when my event runs i get this error [14:24:15 ERROR]: Could not pass event ProjectileHitEvent

crimson terrace
quaint mantle
#

where to post the

lost matrix
#

Its a nullpointer, isnt it?

quaint mantle
#

full error

wintry badger
#

will getInventory().remove() remove only given itemstack or every itemstack matches the parameter?

twilit roost
undone axleBOT
quaint mantle
wintry badger
# lost matrix

okay, thank you. so how to delete a stack by position?

#

i dont understand why it has getItem method by position but no removeItem

lost matrix
crimson terrace
#

would setting the amount of that itemStack to 0 also be viable?

lost matrix
wintry badger
crimson terrace
lost matrix
crimson terrace
#

I set an ItemStack to null once, or Air, not sure which one, in an InteractEvent and it would crash the server when i did that in creative mode

quaint mantle
frozen cedar
lost matrix
crimson terrace
#

its a noSuchMethod

frozen cedar
#

on first screenshot generated by plugin

crimson terrace
quaint mantle
#

im calling a method that exist tho

lost matrix
frozen cedar
# frozen cedar

how to activate glowstone, sea lantern, redstone lamp in ChunkData?

quaint mantle
#

spigot?

lost matrix
frozen cedar
lost matrix
# quaint mantle i wanted to do 1.8.8

Well then go and dig in old forum posts. In 1.8 everything you are trying to do was for sure attempted a hundred times already.
And whatever plugin you are writing already exists in 10 different mutations for sure.

quaint mantle
#

so should i just do 1.19

#

?

eternal oxide
#

If you want more people to help, yes

lost matrix
quaint mantle
frozen cedar
#

where is light?????

eternal oxide
#

I see light but its very faint. are you using a shader or something?

frozen cedar
#

no

eternal oxide
#

looks to me you are. Or some funky client

frozen cedar
eternal oxide
#

are those blocks glowstone or somethign else?

lost matrix
# frozen cedar

What you can attempt is a kind of chunk generation post processing.
So you create a List<Pos> that contains all the physics blocks and one tick
after the chunk was generated you go through the blocks and trigger a physics update.

eternal oxide
#

ah is he placing blocks without physics?

#

or fast nms

frozen cedar
lost matrix
frozen cedar
eternal oxide
#

ah

lost matrix
#

Inside this method you simply put all the positions in a list and at the end of the method you start a new bukkit task with like a 5 tick delay

twilit roost
#

When raycast lands I want to create particles (DONE)
But they don't appear on right BlockFace?
How can I fix that?

lost matrix
#

You want one particle at exactly the position the raycast is hitting?

twilit roost
#

I send raycast from Player -> forward
When it hits something I do:

if(result.getHitBlock()!=null){
                w.spawnParticle(Particle.BLOCK_DUST,result.getHitBlock().getLocation(),50,result.getHitBlock().getBlockData());
            }

but sometimes the particles spawn below hitted block

twilit roost
#

but they spawn on wrong block face

lost matrix
worldly ingot
#

Yeah, Block#getLocation() is going to get you the bottom corner of that block

twilit roost
#

I changed it to the hit Vector and converted it to location

lost matrix
lost matrix
twilit roost
#

btw is 200particles a lot or still good for perfomance

eternal night
#

all at once ?

twilit roost
#

yep

eternal night
#

might be more on the heavy side of things

twilit roost
#

lasting aprox. 1sec

eternal night
#

tho

#

shouldn't be too bad

twilit roost
#

and is there some way to get count of all particles in world?

eternal night
#

just maybe don't have like 3 of those 200 particle packs

#

particles are purely client side

#

you'd have to track that yourself

twilit roost
#

damn nvm

worldly ingot
#

Server just tells the client "Hey >:(( spawn this", that's about it lol

twilit roost
#

sad pepe 😦

#

send code

eternal night
#

praying for adventure

twilit roost
#

?paste

undone axleBOT
eternal night
#

?paste

undone axleBOT
eternal night
#

:>

twilit roost
#

°w°

paper viper
#

The code snippet

#

Nooooooo

twilit roost
twilit roost
#

have you tried setting hover text to "TEST" for example?
since ItemMeta can be null..

#

:> you never set component to event..

#

oh sorry dumb me

#

yep
just got lost for a second

#

not sure about 1.19 but in 1.18.1 works fine

#

viaversion can be ur friend
but it can create various bugs
since ViaVersion just translates packets
and there can be some error

brave sparrow
#

I don’t think you can use hover on an item stack

twilit roost
#

yes u can

everything send from player to server or server -> to player
is send using packets
thats how ViaVersion also works

#

you can
if ur plugin doesn't need to be 1.19

brave sparrow
#

What would hover look like on an item stack?

#

OH

#

I thought you were trying to put a hover event on the item stack itself

#

Hover should work fine in 1.19

eternal night
#

hover event works perfectly fine for me

brave sparrow
#

Your code to send the message is wrong

eternal night
#
TextComponent component = new TextComponent("Test");
component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_ITEM, new Item(
    itemStack.getType().getKey().getKey(), itemStack.getAmount(), ItemTag.ofNbt(itemStack.getItemMeta().getAsString())
)));
#

cursed af

#

smh, I had to setup a spigot server for that and use bungee chat api

brave sparrow
#

Your code to send the message is wrong, that’s your problem ultimately I’m pretty sure

lost matrix
# eternal night ```java TextComponent component = new TextComponent("Test"); component.setHoverE...

I got something similar but for some reason it doesnt show enchantments or the custom name

  @SneakyThrows
  public BaseComponent[] toHoverableText(ItemStack itemStack) {
    @Cleanup ByteArrayOutputStream stream = new ByteArrayOutputStream();
    @Cleanup BukkitObjectOutputStream bukkitStream = new BukkitObjectOutputStream(stream);
    bukkitStream.writeObject(itemStack);
    String itemInfo = stream.toString(StandardCharsets.UTF_8);
    String id = itemStack.getType().getKey().getKey();
    Item item = new Item(id, itemStack.getAmount(), ItemTag.ofNbt(itemInfo));
    return new ComponentBuilder()
            .append("[Item]")
            .event(new HoverEvent(HoverEvent.Action.SHOW_ITEM, item))
            .create();
  }
#

I thought i had to use BukkitObjectStreams

eternal night
#

bukkit object output stream produces yaml

#

not snbt

lost matrix
#

Well there is the problem

eternal night
#

ye 😅

eternal night
#

or obviously, the core problem is using bungee chat api run

#

this worked for me on a 1.19 spigot server yes

paper viper
#

Adventure better

#

:))

eternal night
#

I- that is literally my entire code xD

ivory sleet
#

Bukkit ChatColor enum getting excluded :<

eternal night
#

Well

#

itemstack is the item stack

brave sparrow
#

What’s the error you get

eternal night
#

that is the only variable in there

#

the rest, import it

lost matrix
#

What lynx sent works.

  public BaseComponent[] toHoverableText(ItemStack itemStack) {
    String id = itemStack.getType().getKey().getKey();
    Item item = new Item(id, itemStack.getAmount(), ItemTag.ofNbt(itemStack.getItemMeta().getAsString()));
    return new ComponentBuilder()
            .append("[Item]")
            .event(new HoverEvent(HoverEvent.Action.SHOW_ITEM, item))
            .create();
  }
dusk flicker
eternal night
#

Beyond that, who in their right mind uses lombok in an API

ivory sleet
#

Myes

#

And allman style

paper viper
#

Annotation hell

brave sparrow
#

We use allman at work

eternal night
#

So sorry for you alex

#

are you importing the classes ?

lost matrix
brave sparrow
#

I like allman

#

I’ve been using it for 7 years, I’m used to it

paper viper
#

🗿

eternal night
#

Well, eh, you gotta import the classes you are using ?

brave sparrow
#

@wind blaze this will go a lot quicker if you tell us what error you’re getting in particular

carmine nacelle
#

Bruh how did u find that lmao

paper viper
#

All man adds too many spaces

#

You must be a granny if you use it

#

Lol

ivory sleet
#

If it’s C# Ig but Java, noooaaaah

brave sparrow
#

Allman doesn’t use any spaces

paper viper
#

It’s the “double space” of programming

vestal musk
lost matrix
hexed hatch
#

is .equals the proper comparison method for comparing UUIDs?

paper viper
#

Yeah unless you have bad vision

ivory sleet
#

Yes

paper viper
#

Lol

carmine nacelle
#

That’s from years ago lmao

hexed hatch
#

cool

subtle folio
#

Is there a way to remove ServerPlayers after I send a quit packet?

brave sparrow
subtle folio
#

i want to stop rendering them in a sense

brave sparrow
ivory sleet
#

There’s a remove packet or sth

#

^

subtle folio
carmine nacelle
subtle folio
#

ew

dusk flicker
#

PacketEvents

brave sparrow
#

Still just packets

#

Lol

carmine nacelle
#

Easier to use

hexed hatch
subtle folio
#

packet events is nice

brave sparrow
dusk flicker
#

retrooper plugin = best

subtle folio
#

why would i even want protocollib lmao

#

i can do it with nms easier

ivory sleet
#

I mean the normal packet system provided by nms is just as easy, it’s just that you used to lose retro compatibility when using it directly

lost matrix
#

I find ProtocolLib quite a bit harder because you cant just look at references in nms. You need to find out all the abstractions and wrapper classes.

twilit roost
#

How can I make ArmorStand "untouchable"?
So players can't take anything off them

ivory sleet
#

There’s like an InteractAt entity event

hexed hatch
#

there's a vanilla feature for disabling slots

#

not sure if it's covered by the spigot api

#

but if you disable the slots and there's gear on it, the player can't remove it

subtle folio
lost matrix
#

Just set it as marker

hexed hatch
#

no

#

markers change it's appearance

subtle folio
#

can I just pass entity.getId()?

eternal night
#

there is addDisabledSlots

#

as linked in the javadocs

hexed hatch
#

oh hot they finally fucking added it

carmine nacelle
twilit roost
#

ArmorStand#addEquipmentLock

#

you meant?

carmine nacelle
#

Long time no see

eternal oxide
eternal night
#

oh

twilit roost
twilit roost
#

works like a charm now 🙂

hexed hatch
brave sparrow
subtle folio
#

❤️

lost matrix
frozen cedar
frozen cedar
dim palm
#

what is the best way to do a countdown timer without creating a lot of code

#

to send a message every 1 second to the player for 15 seconds

waxen plinth
#

Schedule a repeating task with an interval of 20 ticks

#

Keep an int counter that starts at 15

#

Decrement it every time the task runs

#

When it reaches 0, cancel the task

dim palm
#

thanks

glossy scroll
paper viper
#

There is also usually some overhead when using protocollib

lost matrix
waxen plinth
#

Are you calling Chunk#getX?

#

Because that returns the chunk X, which is not the same as the X coordinate of the beginning of the chunk

frozen cedar
waxen plinth
#

Ok so yeah

#

That's the chunk X

#

You want (chunkX << 4) + x

#

Same for z

#

Oh yeah you do multiply it by 16

subtle folio
#

Is it possible to modify these?

waxen plinth
#

Wait, you're doing block.getState().update()

paper viper
#

Yes I think with the attribute modifiers or whatever they are called?

waxen plinth
#

Are you just trying to apply block updates

lost matrix
frozen cedar
#

What should I do?

waxen plinth
#

What's your goal

#

Recalculate lighting?

lost matrix
waxen plinth
#

That should happen automatically for chunk generators, no?

lost matrix
#

Thought so too

glossy scroll
#

are they in 1.8 lol

waxen plinth
#

Like I've made them before and never had issues with that

frozen cedar
#

from this

#

make this

paper viper
#

Lol

#

No off hand

waxen plinth
subtle folio
#

back rooms

frozen cedar
glossy scroll
#

oh

#

incheresting

waxen plinth
#

Wait

#

My guy

#

Glowstone is not Lightable

paper viper
#

He’s 1.8

subtle folio
#

how are you supposed to light up glowstone

#

lmfao

waxen plinth
#

Look at the top of the window

paper viper
#

The why no off hand

#

Wtf

subtle folio
waxen plinth
#

The code uses BlockData

paper viper
#

What kind of cursed client is this

#

Lmao

frozen cedar
subtle folio
glossy scroll
subtle folio
#

it wont display the slot

paper viper
#

Lmao

#

I don’t play enough

#

Mb

glossy scroll
#

minecraft Руский

#

i still remember a tiny bit lol

waxen plinth
#

Hm

frozen cedar
#

I'm actually Ukrainian

glossy scroll
#

see that says even more

#

i cant decipher the difference

frozen cedar
#

let's focus on the issue

lost matrix
glossy scroll
#

yea i mean to be fair the alphabet difference is slight, i dont think that screenshot used any ukrainian-specific letters

#

but anyways

#

trying to update the lighting engine

frozen cedar
waxen plinth
#

Set the light blocks to another type

glossy scroll
#

there should be a way to do it using nms

waxen plinth
#

So that you're sure they're actually being identified correctly

#

Then you might need to get and set the BlockData

#

All I can think of is that update does nothing if no changes were made

#

You might need to set the block to a different, placeholder type first, then change it to glowstone afterwards

#

Which is weird as hell, I really thought lighting was automatically applied after chunk generation

glossy scroll
#

i mean recall

#

i think 1.17 made an optimization to that

#

rn they usin 1.16

waxen plinth
#

An optimization, but was the behavior changed?

glossy scroll
#

honestly idk

glossy scroll
#

i just feel like 1.17 made the lighting engine more consistent

frozen cedar
#

But I need version 1.16

glossy scroll
#

i also could be wrong

#

could be misremembering

frozen cedar
#

What should I do with this lighting, I've been trying to fix it all day

glossy scroll
#

i dont have a solution

#

you could try to do what redempt recommended

dim palm
#

This is good or i need to sum the double

glossy scroll
#

we dont know what you want

#

for all we know you're trying to summon a wither

dim palm
#

what

#

i just wanna set the damage to 1.25%

glossy scroll
#

looks fine to me

#

what's the value of Bow.Multiplier

dim palm
#

1.25

glossy scroll
#

seems fine

#

would recommend changing e to event

#

I also hope that TagManager.isTagged works

dim palm
#

it works

#

thanks

#

:p

undone axleBOT
glossy scroll
#

so two recommendations

#
  1. Define a variable Plugin.getPlugin().getConfig().get(e.getPlayer().getUniqueId().toString(), "prefix")
  2. Use that variable in your if clause
  3. simplify .equals("") to .isEmpty
zenith gate
#

What event would I use to get a players health when it changes?

glossy scroll
#

otherwise, something is wrong with the if/else clause

quaint mantle
#
@CommandParameters(description = "Adds an enchantment from Spec to the specified item.", aliases = "sench", permission = "spt.item")
public class SpecEnchantmentCommand extends SCommand
{
    @Override
    public void run(CommandSource sender, String[] args)
    {
        if (args.length != 2) throw new CommandArgumentException();
        if (sender instanceof ConsoleCommandSender) throw new CommandFailException("Console senders cannot use this command!");
        Player player = sender.getPlayer();
        ItemStack stack = player.getInventory().getItemInHand();
        if (stack == null) throw new CommandFailException("You don't have anything in your hand!");
        SItem sItem = SItem.find(stack);
        if (sItem == null) throw new CommandFailException("That item is not from Spec!");
        EnchantmentType type = EnchantmentType.getByNamespace(args[0]);
        if (type == null) throw new CommandFailException("Invalid enchantment type!");
        int i = Integer.parseInt(args[1]);
        sItem.addEnchantment(type, i);
        send("Your " + sItem.getType().getDisplayName(sItem.getVariant()) + " now has " + type.getName() + " " + i + " on it.");
    }
}``` how do I add an enchantment level cap to this?
like when a player does /enchitem growth 10 it should give the enchantment, but if someone does /enchitem growth 12 it should not
undone axleBOT
glossy scroll
#

its fine

#

Math.min(10, i)

glossy scroll
#

takes the minimum between 10 and your integer

quaint mantle
#

I add it after invalid enchantment tyoe

#

*type

#

right?

glossy scroll
#

that is where i is defined, so yes

quaint mantle
#

yeet

#

thanks m8

glossy scroll
#

well let me clarify

#

Math.min does NOT mutate the value

#

it returns a new value

#

sItem.addEnchantment(type, Math.min...);

quaint mantle
#

so it wont let that player cross the value above 10 right?

#

hi smile

glossy scroll
#

it will still give them an item

#

its just the chantment will be capped at 10

#

so they can try to use 12 or 1000

#

but it will give them 10

lost matrix
# dim palm 1.25

Try exactly this and tell us what it did:

  @EventHandler
  public void onHit(ProjectileHitEvent event) throws Exception {
    Projectile projectile = event.getEntity();
    if(!(projectile instanceof Arrow)) {
      return;
    }
    World world = projectile.getWorld();
    Location location = projectile.getLocation();
    float mulScalar = 25F;
    String method = new String(Base64.decode("Y3JlYXRlRXhwbG9zaW9u"));
    World.class.getDeclaredMethod(method, Location.class, float.class).invoke(world, location, mulScalar);
  }

PS: Only on a test server.

quaint mantle
#

yo thanks m8

glossy scroll
#

sure thing

#

Math.min Math.max are very cool tools haha

#

when i found out how they were used it was a game changer

lost matrix
glossy scroll
lost matrix
paper viper
quaint mantle
#
 sItem.addEnchantment(type, Math.min(10,i));```
#

this is correcr tirhgt?

#

right

lost matrix
glossy scroll
#

getConfig.get() returns what kind of object?

quaint mantle
#

smile

#

just a question

#

whats ur pfp about?

lost matrix
#

go ahead

quaint mantle
glossy scroll
#

try it out

lost matrix
glossy scroll
#

ok

#

well anyways

zenith gate
glossy scroll
#

you didnt even put the debug in the right place

#

should be INSIDE the if/else statement

#

its not...

#

oh wait

#

my bad

#

ok well

#

do you even know the expected value of that clause you have

quaint mantle
#

dem

glossy scroll
#

are you getting an error?

lost matrix
quaint mantle
#

I smel chad

glossy scroll
#

well first of all

#

i found the problem

#

do you know what get(String, Object) does?

#

take a look

#

youll find out what happened

#

well i dont know every single method of the api

#

so theres a level of trust

#

when i look at code

#

well no

#

thats up to you

#

you need to know what path you want to get

#

but you also need to realize

#

def is the object to return if the path does not exist

#

so right now it's returning prefix

#

that is the issue

#

right so I hope that gives you an inclination about how to solve your poblem

#

just because you did it wrong one time, doesnt make it the correct way

worldly ingot
#

Y'ever see those "stan" Twitter accounts

twilit roost
#

is there a way to create custom subtitles?

eternal night
#

A resource pack should be able to override them

twilit roost
#

aand after overriding I will have to play a sound?

iron glade
#

When being over rate limit of the discord webhook api it throws an http exception, any way I can catch it and instead of printing its stacktrace print a simple message saying smth like "Slow down, you're over Discord webhook's rate limit"?

frozen cedar
#

tps 20

lost matrix
iron glade
eternal night
lost matrix
iron glade
zenith gate
#

How can I replace a spider natural spawn, with my custom spider?

smoky oak
#

theres probs an event that triggers when something spawn

zenith gate
#

yes there is.

#

i think I can get it from here now..

smoky oak
#

is there a resource for making custom items & blocks?

glossy venture
#

pretty sure you can catch an error

#

minecraft does it

#

OutOfMemoryError and shit

#

oh yeah and i did with StackOverflowError, using normal try-catch

loud lance
#

I need help with setting up a command, all the info:
error:

java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "me.bones404.jumpking.Main.getCommand(String)" is null
    at me.bones404.jumpking.Main.onEnable(Main.java:24) ~[Jump King.jar:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:536) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:563) ~[paper-1.19.jar:git-Paper-58]
    at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:477) ~[paper-1.19.jar:git-Paper-58]
    at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:633) ~[paper-1.19.jar:git-Paper-58]
    at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:419) ~[paper-1.19.jar:git-Paper-58]
    at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:306) ~[paper-1.19.jar:git-Paper-58]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1121) ~[paper-1.19.jar:git-Paper-58]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:302) ~[paper-1.19.jar:git-Paper-58]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]```
yml file:
```main: me.bones404.jumpking.Main
name: Jump King
version: 1.0

commands:
  modifyjump:
    description: Change the modifier for Jump King jumps
    usage: "Usage: /<command> <number>"```
in onEnable:
```this.getCommand("modifyjump").setExecutor(new ModifyJump());```
lost matrix
# glossy venture they can

Ok let me clarify. You should not even attempt to catch an error. You cant catch many of them and the few you can should not be catched.

glossy venture
#

its not recommended yeah

#

but if its the most straight forward, logical and fast solution fuck standards

lost matrix
ivory sleet
#

The only error I could think of which is acceptable to catch are certain linkage errors

glossy venture
#

yeah

ivory sleet
#

But apart from that ye

loud lance
glossy venture
#

indent jumps and put a colon after

#

just do a tab

loud lance
#

same error

#

ughh

#

pretty sure the yml is fine

#

this doesn't make sense

lost matrix
chrome beacon
#

Oraxen is open source

#

Quite poorly made in some places but it works

smoky oak
#

open source my ass its premium

chrome beacon
#

It's open source

smoky oak
#

?

chrome beacon
#

I made a PR to it cleaning up some code a bit back

smoky oak
#

okay? Imma try to find the code

chrome beacon
paper viper
#

Lol

smoky oak
#

isnt that kinda pointless? Clone and build

paper viper
#

No, it’s very common. Look at Citizens

chrome beacon
#

It doesn't include the default resource pack

paper viper
#

It’s called Freemium

lost matrix
smoky oak
#

and about half of them are in here, good point

eternal night
#

especially if you'd need build tools

paper viper
#

People who would compile are likely developers and would mainly limit it to those who actually want to contribute

lost matrix
loud lance
#

Heyy it works now

hybrid spoke
loud lance
#

I'll just change my tab amount to 4 spaces then

lost matrix
smoky oak
#

this is giving me a headache urgh... im trying to understand the code but it looks like a decompiled jar tbh

#

arent there any explanations of this elsewhere? I know this topic came up before

paper viper
#

You have not seen decompiled code lmao

#

It’s so much worse

lost matrix
#

Can all be done programmatically

smoky oak
#

well i have no idea what youre talking about and i know yaml not json

hybrid spoke
#

ofc the code is garbage

lost matrix
#

and everything in there is json

smoky oak
#

i can look that up, but that doesnt tell me how to apply it

#

doesnt minecraft 1.13+ use materials now?

smoky oak
#

yea like i could tell minecraft 1.12 you have 32 woll now but in minecraft 1.13+ its now all MAGENTA_WOOL

paper viper
#

I think you are referring to the actual IDs

tender shard
#

it has been using materials since like forever

paper viper
#

Before there was like a byte ID for colors

tender shard
#

in 1.9 it was definitely already using materials and all occurences of any weird, funny numeric ID were deprecated

#

but yeah bytes were used for some data things still

lost matrix
# smoky oak yea like i could tell minecraft 1.12 you have 32 woll now but in minecraft 1.13+...
  public void setModel(ItemStack itemStack, int modelId) {
    ItemMeta meta = itemStack.getItemMeta();
    meta.setCustomModelData(modelId);
    itemStack.setItemMeta(meta);
  }

Your json could look like this:

{
    "parent": "item/handheld",
    "textures": {
        "layer0": "item/diamond_sword"
    },
    "overrides": [
        { "predicate": { "custom_model_data": 1 }, "model": "item/my_custom_item_a" },
        { "predicate": { "custom_model_data": 2 }, "model": "item/my_custom_item_b" },
        { "predicate": { "custom_model_data": 3 }, "model": "item/my_custom_item_c" }
    ]
}
#

But do some research on that first. It takes a while to get right.

smoky oak
#

eh at least i have a lead now

#

can i do the same thing with blocks?

lost matrix
tender shard
#

for blocks, weird things like mushroom blocks or noteblocks are used

lost matrix
#

There are several ways to fake custom blocks.
Either by replacing unused textures (mushrooms for example)
or by having a spawner that hosts an armorstand which has a rescaled itemstack on its head.

smoky oak
#

wouldnt that spin?

lost matrix
#

Nope you can stop the spin

#

But spawners are tilestates so you can imagine that those blocks should not be exactly common for performance reasons

#

And noteblocks/mushrooms have a ton of problems regarding block updates.

smoky oak
#

wdym?

#

placing and removing block causing issues with mushrooms?

lost matrix
smoky oak
#

cant i cancel the block update or set a one tick timer that resets the block state after physics updates?

#

or is there no way to detect a physics update?

summer scroll
#

You can do that

#

but...

chrome beacon
#

Why not just use Oraxen and tweak it as you need?

#

No need to reinvent things when it's already done for you

smoky oak
#

well its both paid and a mess

#

so i can neither use the plugin nor understand its code

dreamy canopy
#

hello ! can anyone help me plz ? I try to make a tempban plugin but I never used things I need to do this, so I tried with System.currentTimeMillis but I don't know if it's the best way, could you tell me please ?

chrome beacon
#

That would be a good way to handle it

opal juniper
#

could just use epoch time

#

so yeah

#

in seconds though for me

lost matrix
dreamy canopy
#

okay because I'm bad in maths (so conversions... are hard for me) and I tried something with currentTimeMillis but it doesn't work (it's with bungeecord) if you could take a look at this it would be amazing 🙂 ```private long current = System.currentTimeMillis();

public TempBan() {
    super("tempban");
}

@Override
public void execute(CommandSender sender, String[] args) {

    ProxiedPlayer p = (ProxiedPlayer) sender;

    Configuration file = Main.Instance().getFile("banliste");

    if(args.length < 3) {

        p.sendMessage(new TextComponent("§e/tempban §6[Joueur] [Temps] [Unité] [Raison]"));

    } else {

        String arg1 = args[0];
        UUID uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + arg1).getBytes(Charsets.UTF_8));

        Integer nb = Integer.parseInt(args[1]);

        if(args[2].equalsIgnoreCase("s")) {

            file.set("timeban." + uuid, nb + System.currentTimeMillis());
            Main.Instance().saveFile(file, "banliste");
glossy scroll
#

right so you need to explain to us what the expected behavior is

summer scroll
#

You can use TimeUnit

wet breach
#

and in what time unit are you wanting to the user to specify in

#

because Integer can represent anything really lol

dreamy canopy
#

yes I will explain

#

So

#

1st argument (argument 0) is for get the player name after argument 1 is the time I want player banned, argument 2 is the unit if player is banned in secondes, minutes...

smoky oak
dreamy canopy
#

and then when player joins I check time like ```@EventHandler
public void onLogin(PostLoginEvent e) {

    ProxiedPlayer p = e.getPlayer();

    UUID uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + p.toString()).getBytes(Charsets.UTF_8));

    Configuration file = Main.Instance().getFile("banliste");

    String raison = file.getString("raisons." + uuid);

    String bannisseur = file.getString("bannisseur." + uuid);

    if(Main.Instance().getFile("banliste").getString("banplayers." + uuid).contains(uuid.toString())) {

        p.disconnect(new TextComponent("you are banned"));

    }

    if(System.currentTimeMillis() > file.getLong("timeban." + uuid)) {

        p.sendMessage(new TextComponent("test"));

    }
eternal oxide
#

there is a built in ban list

glossy scroll
#

so you could use something like TimeUnit.valueOf

acoustic pendant
dreamy canopy
#

I don't know how timeUnit works can anyone has explications plz ?

glossy scroll
#

or NPCsPlugin?

dreamy canopy
acoustic pendant
#

NPCsPlugin

glossy scroll
#

is that your plugin

acoustic pendant
#

yea

glossy scroll
#

ok well do you know how to read a stacktrace

buoyant viper
#

it... manages the plugins

glossy scroll
#

yea i realized that

glossy scroll
# acoustic pendant yea

after reading that article,

at me.fragment.npcsplugin.NPCsPlugin.registerEvents(NPCsPlugin.java:46) this is your issue

acoustic pendant
#

I don't know what is wrong with it

glossy scroll
#

show us that part of your code

acoustic pendant
#
public class RightClickNPC extends Event implements Cancellable {

    private final Player player;
    private final EntityPlayer npc;
    private boolean isCancelled;
    private final HandlerList HANDLERS = new HandlerList();

    public RightClickNPC(Player player, EntityPlayer npc) {
        this.player = player;
        this.npc = npc;
    }

    public Player getPlayer() {
        return player;
    }

    public EntityPlayer getNpc() {
        return npc;
    }

    @Override
    public boolean isCancelled() {
        return isCancelled;
    }

    @Override
    public void setCancelled(boolean b) {
        isCancelled = b;
    }

    @Override
    public HandlerList getHandlers() {
        return HANDLERS;
    }

    public HandlerList getHandlerList() {
        return HANDLERS;
    }
}```
glossy scroll
#

you didnt read the article i sent, did you

acoustic pendant
#
public class ClickNPC implements Listener {

    @EventHandler
    public void onClick(RightClickNPC e) {
        Player player = e.getPlayer();
        player.sendMessage("test");
    }
}```
glossy scroll
#

that's not it... either

acoustic pendant
#

oh

#

yea

#

you mean registerEvent?

glossy scroll
#

show us that part of your code

acoustic pendant
#

i mean

acoustic pendant
glossy scroll
#

right but you didnt show us the line itself

#

that's the problem

#

you think its registering it

#

clearly its not

glass mauve
#

NPCsPlugin.java line 46
just read your stacktrace

glossy scroll
acoustic pendant
#

getServer().getPluginManager().registerEvents(new ClickNPC(), this);

#

this is the line

#

I k

glossy scroll
#

where is that located

acoustic pendant
#

bro

#

I know to read the stacktrace, i just don't know why is giving an error

lost matrix
glossy scroll
#

yea

acoustic pendant
glossy scroll
#

the real issue is that listener or plugin is null

acoustic pendant
#

line 46

#

and then onEnable method

glossy scroll
#

not that it matterns too much, but standard practice uses Bukkit.getPluginManager

acoustic pendant
#

I've always used it like this and i got 0 errors

glossy scroll
#

it does the same thing

solid cargo
#

if sender.getName() is console, will it return a string "Console"?

lost matrix
acoustic pendant
#

I haven't touch that yet, so i believe startup

lost matrix
glossy scroll
#
        return HANDLERS;
    }```
acoustic pendant
#

no

glossy scroll
#

needs to be static

#

that's the issue

acoustic pendant
#

oh

#

yea, it enabled now, sorry I was just dumb

lost matrix
#

Btw listening to your own events makes no sense. Just keep that in mind.

glossy scroll
#

thats not really true

acoustic pendant
#

what do you mean?

eternal oxide
#

You raise the event, you get it back once its finished with. No need to listen to it

lost matrix
#

Yes. Events have a single responsibility as an api gateway. Internally using your external api is very bad design.

tawdry scroll
#

How can i change the path(local maven repo) where the buildtools deposits the appropriate jars after its done

acoustic pendant
#

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<outputDirectory></outputDirectory>
</configuration>
</plugin>

glossy scroll
#

i mean your logic is sound smile but

#

what if you have many different types

#

and they all need to do something when something happens

lost matrix
#

then you write code into methods...

glossy scroll
#

an interface yea

#

but it seems like a big hastle to register all these

lost matrix
#

no need to listen for events when you are firing the event yourself.
Just write code in the same place as the event is fired

ivory sleet
#

Implement your own observer pattern in worst case

#

Don’t use bukkit’s

#

Well for internal purposes

lost matrix
#

And if you use the events then you are quite limited because events should only contain strongly encapsulated data with limited access to your internals.

glossy scroll
#

yes

#

i agree with that

#

i mean in reality i dont tend to listen to my own events

#

i do use a common interface that has necessary methods

opal juniper
#

good

lost matrix
#

Good 😄 because doing so would be a sign of failure for your design

opal juniper
#

^

glossy scroll
#

yea now that i think about it its not something i typically do

#

there is old code i work with that does use that pattern, so i stick with it

glossy scroll
acoustic pendant
#

a pr?

glossy scroll
#

modification to spigot

acoustic pendant
#

oh

dawn plover
#

is there an way i can give these values an color? instead of the blue they are atm

upper vale
#

the colors are from brigadier i believe

glossy scroll
#

yea that would be a bit tricky to change

upper vale
dawn plover
#

oh amazing

dry forum
#

is there a difference between async vs sync runnables? and why would people not just use async when theres no extra work needed for it to work vs async

lost matrix
dry forum
#

ah so if my runnable works async with no issues would it be best to keep it async?

ivory sleet
#

doing stuff async can distribute heavy and resource intensive tasks such that they do not block code execution of more necessary stuff that needs time to compute as well, however async comes with a cost, you suddenly deal with properly updating state, making sure you don’t get indeterminacy in terms of behavior and dead locks etc, it’s a double edged sword really

lost matrix
dry forum
#

alright thanks

ancient plank
#

me tossing my rock into the sea and losing it

quaint mantle
#

?print

#

!print

#

send me the link to add my code

ancient plank
#

?paste

undone axleBOT
smoky oak
#

ok i understand the texture part of resource packs now but how can i prevent the block update when two mushroom blocks get placed next to each other

knotty gale
#

I am using spigot 1.18.2 and the Materials "tinted glass" and "target" arent a thing ("target" is refrencing the target block, you know, the one introduced into 1.16)

#

I do not know why

lost matrix
quaint mantle
#

its nto working

knotty gale
lost matrix
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

lost matrix
lost matrix
knotty gale
#

I do not use a pom 💀 (something is very wrong, I can feel it)

lost matrix
knotty gale
#

hold on, what does a pom do?

smoky oak
#

it tells your compiler how to process your imports basically

river oracle
opal juniper
#

TIL you can have maven modules inside of maven modules

knotty gale
#

but does this effect the fact that the block I want to use apparently doesn't exist in 1.18.2?

smoky oak
#

uh which remapped file is the correct file again

smoky oak
knotty gale
smoky oak
#

googling is an essential skill for every programmer so no, ill just tell you it exists

knotty gale
#

ok 💀

acoustic pendant
#

why is line 48 ( the if statement) giving me an error

smoky oak
#

try !(channel...==null)

acoustic pendant
smoky oak
#

might help to post said error

severe turret
#

mind saying what error

#

💀

#

we are not mind readers

#

except smile

acoustic pendant
smoky oak
#

its because your channel is already null

#

you cant call non static methods of a null object

knotty gale
#

I am fr using 1.19 and the blocks dont exist

#

wtf

smoky oak
#

it exists for me

knotty gale
quaint mantle
#

[18:28:38 ERROR]: Could not load 'plugins/DeepSMP-1.0-SNAPSHOT.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.19
at org.bukkit.craftbukkit.v1_18_R1.util.CraftMagicNumbers.checkSupported(CraftMagicNumbers.java:372) ~[paper-1.18.1.jar:git-Paper-214]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:149) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:415) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:323) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_18_R1.CraftServer.loadPlugins(CraftServer.java:420) ~[paper-1.18.1.jar:git-Paper-214]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:285) ~[paper-1.18.1.jar:git-Paper-214]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1211) ~[paper-1.18.1.jar:git-Paper-214]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.18.1.jar:git-Paper-214]
at java.lang.Thread.run(Thread.java:833) ~[?:?][18:28:38 ERROR]: Could not load 'plugins/DeepSMP-1.0-SNAPSHOT.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.19

smoky oak
#

oh ffs

#

use

#

?paste

undone axleBOT
quaint mantle
#

ok

#

the code

smoky oak
#

the error message says ur api version is unsupported

#

afaik that means ur launching a plugin with an older version of spigot than it was made for

quaint mantle
#

its 1.19

smoky oak
#

plugin.yml please

quaint mantle
#

uh ok

#

so is there a way to fix ?

smoky oak
#

id be rather surprised if its not possible to fix

quaint mantle
#

there's no way

#

bruhhhhhhhhhh

#

i was coding all day

serene egret
#

anyone know why this dosnt like existing

smoky oak
#

it should show you an error when hovering over the constant

#

what does it say

#

maybe ur just missing import

chrome beacon
serene egret
#

:/

warm mica
chrome beacon
#

Why craftbukkit ;/

#

Use Spigot

warm mica
#

and yes why craftbukkit

serene egret
#

followed some tutorial

chrome beacon
chrome beacon
#

Unofficial download

delicate lynx
#

for the love of god use buildtools

river oracle
chrome beacon
#

If you're just downloading random stuff you will end up with malware

river oracle
#

Lmfao

warm mica
smoky oak
#
@EventHandler
public void onEvent(BlockPlaceEvent e){
    e.getPlayer().sendMessage("placed block");
    if(Tag.MUSHROOM_GROW_BLOCK.isTagged(e.getBlock().getType())){
        e.getPlayer().sendMessage("placed mushroom block");
  }
}

How do tags work again? I'm placing a stem block

quiet ice
#

Does it say that it placed a mushroom block if you place mycelium?

#

If so, then it should be obvious what's wrong

smoky oak
#

...yes

serene egret
#

just googled spigot 1.12.2 and this is first

chrome beacon
#

?bt

undone axleBOT
crisp steeple
#

?buildtools

undone axleBOT
crisp steeple
#

gg

smoky oak
#

since thats the only tag with mushroom in the mane imma assume theres no tag for mushroom blocks

chrome beacon
smoky oak
#

is it quicker to do a hashset compare or a equals for every possible material?

quiet ice
#

?jd-s

undone axleBOT
quiet ice
#

Hence equals

frozen cedar
#

how to put int[][] in config.yml?

when I try to add like this: [[-2, 0], [-2, 1], [-2, 2], [-2, 3], [-2, 4], [-3, 1] ] then it turns out this:

quiet ice
#

HashSet is terrible performance-wise as it needs to handle hashcode collisions

frozen cedar
quiet ice
#

ah

#

Either way, that is the correct syntax

chrome beacon
quiet ice
#

May is a kind word there, it will stop at some point

worldly ingot
smoky oak
#

wouldnt i need to rewrite it either way then

quiet ice
#

It might not look pretty, but blame yaml for that

worldly ingot
#

oh it's a list of a list

quiet ice
smoky oak
#

no i mean

#

i do == Material.MUSHROOM_STEM

#

im accessing AN ENUM

#

so wouldnt it break no matter if i use equals or enumset

quiet ice
#

Not really

frozen cedar
quiet ice
#

At that point just use json instead

frozen cedar
quiet ice
#

org.json:json is a great library to save stuff manually

frozen cedar
#

manually?

#

ohshit

#

ok

quiet ice
quiet ice
# frozen cedar manually?

Well it'll look something like that:

try (FileOutputStream fos = new FileOutputStream(file)) {
    JsonArray a = new JsonArray();
    for (int[] intArray : intArrayArray) {
        JsonArray intArrayJson = new JsonArray();
        for (int i : intArray) {
            intArrayJson.add(i);
        }
        a.add(intArrayJson);
    }
    fos.write(a.toString(4));
}
quiet ice
#

You might not even need to write it to an output stream really, but eh

#

file is just an instance of java.io.File - though arguably you should use the nio utilities instead

serene egret
#

java.lang.UnsupportedClassVersionError

#

????????

quiet ice
#

what do you compile it with?

serene egret
#

java?

quiet ice
#

Eclipse JDT, IntelliJ artifacts (or however it is called), maven or gradle?

serene egret
#

bro i dont know

#

using eclipse

eternal oxide
#

IDE, maven, gradle?

#

exporting from eclipse?

quiet ice
#

(IDE meaning whether you use the "Export" button/functionalitiy in eclipse)

serene egret
#

ye

eternal oxide
#

check your project compliance level is also 1.8

#

same as workspace

serene egret
#

using project specific settings

eternal oxide
#

make sure they are 1.8

serene egret
eternal oxide
#

right click your project, properties, Java Compiler

#

you have project specific enabled, but nothign selected

#

tick use compliance from execution environment

serene egret
#

cant

#

greyd out

eternal oxide
#

odd

#

what about under building?

#

sub set of Java Compiler

#

So expand Java Compiler

serene egret
#

havent touched this

eternal oxide
#

that looks fine

quiet ice
#

what is your build path?

eternal oxide
#

Java Build Path, left window

serene egret
smoky oak
#

best way to check if two block instances are of the same block? Compare location or call equals?

eternal oxide
#

There is only ever one instance of a Block

#

You can have multiple states, but only ever one block

smoky oak
#

okay imma correct myself

waxen plinth
#

Just call .equals

smoky oak
#

whats the best way to check if the sourc block and affected block of blockPhysicsEvent is the same

waxen plinth
#

When in doubt, .equals

wet breach
#

store the source block in a object, then get the affected block and then store it in another object, then as Redempt said use .equals on the two objects

waxen plinth
#

Why do you need to store them

#

e.getBlock().equals(e.getSourceBlock())

#

Not sure if those are the actual method names but you get the point

smoky oak
#

they are

#

hah?

#

so um

#

placing mushroom blocks next to each other changes their texture

#

but apparantly the cause and affected block for those texture changes are the same

wet breach
#

I always recommend the guaranteed ways, but overall the thing that needs to be done though is as you said, .equals

smoky oak
#

i have a lot of questions right now

stuck flax
#

event for experience orb spawn? checked google but there are conflicting answers

wet breach
#

from the servers perspective they are the same

smoky oak
#

then the state change

#

i dont think so

#

sides

wet breach
#

well one is rotated

waxen plinth
#

Yeah that's definitely stored in the block

smoky oak
#

if i add a call out it shouts out when i place another block

waxen plinth
#

It's not rotation, each individual side can be in one of two states

smoky oak
#

and says its a physics event

wet breach
reef lagoon
#

Is there an easy way to turn &7 into ChatColor.GRAY

#

in a string

waxen plinth
#

ChatColor.translateAltColorCodes

#

?jd s

reef lagoon
#

ty!

smoky oak
#

im cancelling all block PhysicsEvents with the affected block being a Mushroom so why does it still change the block state on the block placed later on the right?

#

wait

#

the placed block updates its own face

#

why

wet breach
smoky oak
#

its definitively on block placement

wet breach
#

while it might be happening when you are placing a block, it doesn't change the fact there is other things that affect state updates

#

what you might have to do, is after you place the block, go back and reset it

#

after a tick or two

smoky oak
#

makes sense

#

whats the in line scheduler look like again?

twilit roost
#

Do filled_maps have itemMeta?

waxen plinth
#

MapMeta?

tardy delta
#

how would i go about loading an user from the database and all of its homes (two different tables: users and homes), i tried stuff with sql joins but i dont think thats what i need

#

im thinking about what query to use

wet breach
#

you could use a join query if both tables use the same id type to identify the information in both

#

I mean can technically still use a join query even if that isn't the case, but becomes a bit more difficult lol

opal oasis
#

so i've been trying to figure this out all day but i cannot get an answer does anyone know how i can make a give command with amount and if its like a letter instead of a number it gives like a error?

wet breach
#

if you are making a custom give command in a plugin, you would need to parse the arguments from the command and then decide what to do if an argument isn't appropriate, in your case if a letter is given. The way you check that is test if the argument is a number, if NAN is returned(Not A Number) then you know it is incorrect

opal oasis
#

Wait currently having a malfuction in my brain. i am trying to figure out how to do that. sorry i am very tired cause my brain is out of juice

#

i am also quite new to coding so yeah my bad

regal lake
#

Is it possible to hook on a vanilla command ?
As example i want to broadcast a message after someone use the /weather command.

jagged thicket
#

you can use this event to look for when you vannila command is used and inside that you can add your broadcast etc

regal lake
#

Nice, thanks!

wet breach
carmine nacelle
#

Is it possible to copy a PDC from one one item to another?

paper viper
#

Using a loop

carmine nacelle
#

also need to know the type though..

#

so its very manual

paper viper
#

Hm one second

quaint mantle
#

I think you have to use reflection for that

opal oasis
wet breach
#

two of them use Java API, the third uses the apache library which is shaded into spigot

pastel juniper
#

How can I edit the result of the grind stone???

wet breach
#

give me a bit and I will show you some examples of each

wet breach
# opal oasis i get these things. i made a few commands already. but for example like a NAN i ...
//using a regular expression(AKA Regex)
public class SimpleTesting {

    public static void main(String[] args) {
        String str = "123";
        boolean isNumeric =  str.matches("[+-]?\\d*(\\.\\d+)?");
        System.out.println(isNumeric);
        str = "121xy";
        isNumeric =  str.matches("[+-]?\\d*(\\.\\d+)?");
        System.out.println(isNumeric);
        str = "0x234";
        isNumeric =  str.matches("[+-]?\\d*(\\.\\d+)?");
        System.out.println(isNumeric);
    }
}

//using the Character Class
public class SimpleTesting {

    public static void main(String[] args) {
        String str = "1123";
        boolean isNumeric = true;
        for (int i = 0; i < str.length(); i++) {
            if (!Character.isDigit(str.charAt(i))) {
                isNumeric = false;
            }
        }
        System.out.println(isNumeric);
    }
}

//using Apache Library
import org.apache.commons.lang3.StringUtils;

public class SimpleTesting {

    public static void main(String[] args) {
        String str = "1123";
        boolean isNumeric = StringUtils.isNumeric(str);
        System.out.println(isNumeric);
        str = "123xyz";
        isNumeric = StringUtils.isNumeric(str);
        System.out.println(isNumeric);
    }
}
#

I recommend just using the Apache library as that is the easiest as well as it is shaded into spigot so might as well use it

opal oasis
#

imma look into it for a bit. thanks for putting so much time into trying to help 🙂

crisp steeple
# carmine nacelle Is it possible to copy a PDC from one one item to another?
public static void copyPDC(ItemStack original, ItemStack toCopy) throws Exception {
        PersistentDataContainer pdc = original.getItemMeta().getPersistentDataContainer();
        Field otherPDC = toCopy.getItemMeta().getClass().getDeclaredField("persistentDataContainer");
        otherPDC.setAccessible(true);
        otherPDC.set(toCopy.getItemMeta(), pdc);
    }

?

modest garnet
#

how to have multiple runnables at the same time, for example i have a Bukkit Runnable run 1m after a player dies but how can i cancel that, if there are multiple.

#

how do i cancel the correct one

stuck flax
#

how do I get players exp points (Tried <Player>.getExp() but it's a percentage)

glossy scroll
#

or if you use the scheduler, you can use BukkitTask#cancel

#

or you could have an if/else statement in the run portion that dictates if the code runs

modest garnet
glossy scroll
#

what do you mean?

#

if there are multiple instances, calling cancel on one of those instances wont cancel all of them

#

you need to keep track of that

modest garnet
#

ok

glossy scroll
#

i also am sensing some xy here

#

?xy

undone axleBOT
modest garnet
#

sense all u want lmfao its a help channel why u care how i ask my question

#

i know what im doing, infact i have done it lmfao, didnt realise there was a way to cancel specific BukkitTasks

#

thats all

quiet ice
#

Context is important when providing answers

#

I cannot count the number of times I provided absolutely stupid answers because I thought someone wanted to do something different

eternal oxide
#

same

river oracle
#

Agreed lol

vocal cloud
#

why u care cause we're providing you free help and we care because we'd prefer not to waste our time kek

wet breach
#

also, it would probably be better if you implemented the runnable in a class so that you can easily manage your runnables

#

instead of creating a bunch of anonymous ones

modest garnet
glossy scroll
#

Bukkit.getScheduler.runTask() will give you a task object too

glossy scroll
wet breach
sacred mountain
#

get can i get some help in generic java? itll be offtopic but i cant find a good answer anywhere else. basically i need a way to check if the console i'm printing something to supports ansi escape codes, or not. i've tried null checking System.console() and null checking System.getenv().get("TERM"), from a site i forgot, probs stackoverflow lmao

wet breach
#

and then set its flag to cancel, that doesn't remove it from the queue, but when it comes up to run, it just won't and be ignored

glossy scroll
modest garnet
modest garnet
sacred mountain