#help-development

1 messages · Page 1491 of 1

quaint mantle
#

Unless you can do .setair

glossy venture
#

otherwise make a custom event

quaint mantle
#

how

#

do i just start polling

#

"is air gone is air gone"

#

Ah idk don’t make a custom event, you need to edit the players attributes.

glossy venture
#

yes thats one way to do it

quaint mantle
#

i dont have to edit anythign lol

#

there exists a func

#

but

glossy venture
#

he wants to listen to when it changes

quaint mantle
#

this isnt essential at all to my plugin

glossy venture
#

not always change it

quaint mantle
#

but im surprised it doesnt exist :p

#

cus it would be nice

#

oop

#

foundthe event

#

:p

#

Ah I didn’t know that was in the newest version but anyways setair is called which updates the entities metadata

#

spigot awesome

glossy venture
#

pog

quaint mantle
#

this was a HumanEntity that has the .setremainingair method

#

i can just do instanceof tho

glossy venture
#

wait we wouldve had to inject bytecode into the method

quaint mantle
#

I just assumed it was set air, and ik water breathing shit has to do with entity meta data packet/ the data watcher

glossy venture
#

to call our event if it didnt exist yet

#

how do you inject bytecode

#

fabric does it with mixins

chrome beacon
#

I mean you too can use Mixins

glossy venture
#

like they inject a method call to your method in your selected method

glossy venture
#

that would make creating efficient events easy

#

without having to poll them constantly

quaint mantle
#

Efficient events as in using the handlers list lol?

#

what is air out of

#

10?

opal juniper
#

Yes I think so

quaint mantle
#

alr my final code :p

#

lol

glossy venture
#

nice

quaint mantle
#

iwill be setting player invulnerable in hub anyways

chrome beacon
quaint mantle
#

but it will be nice to have no air bar changing :)

glossy venture
#

oooh

#

ty

quaint mantle
#

tysm guys

#

Yw make sure you test it

#

I’m kinda interested if that works

#

just did and realized i forgot to cancel event

#

it wasnt working lets see...

#

Lmk

#

muh server crashing wtf i do lol

#

Is it the cast

#

possibly

#

this happens on join tf

#

Is there a way to get the players data watcher?

#

Might be in craft player I mean if so. Find that setair method

#

And see what they do with the data watcher and see if you can replicate it

#

Just by adding to the data watcher in the exact way

#

lol

#

server hates me rn

#

WTF that listener was crashing server

#

Debug it see where it makes it to

#

does this cast look sussus amogus

#

i check if instanceof before casting :p

opal juniper
#

It’s fine

quaint mantle
#

LOL the second i jumped in water the server crashed

#

thats why my rejoins screwed server

#

i was in water

opal juniper
#

Are you sure that 10 is valid - try 1

quaint mantle
#

ah ok

#

weird to crash for lol

#

and so silently i see no errors either

opal juniper
#

No - I don’t think that is weird

chrome beacon
#

Why not cancel the event?

opal juniper
#

^^^

quaint mantle
#

i would assume

opal juniper
#

What?

chrome beacon
#

^^

#

What

quaint mantle
#

entityairchangeevent

#

set air and cancel event

#

that set air

#

calls itself again

opal juniper
#

ohhhhh shit ur causing a stack overflow

glossy venture
#

oh boy

quaint mantle
#

but i am not cancelling it rn

opal juniper
#

That’s probs why it crashes

chrome beacon
#

Well I said cancel the event

#

Don't set the air

quaint mantle
#

oh shit

chrome beacon
#

Just cancel

opal juniper
#

Cancel it instead of setting

quaint mantle
#

i just realized

glossy venture
#

maybe change the air with nbt

quaint mantle
#

LOL

glossy venture
#

so it doesnt fire the event

chrome beacon
#

No need to set the air

quaint mantle
#

ok

#

am trying

#

still going down weird

#

is air clientsided?

glossy venture
#

nah i dont think so

quaint mantle
#

think so i was spamming /reload and it kept going down

ebon isle
#

Hello, does anyone know why do I get this error?

chrome beacon
#

Show code

quaint mantle
#

i asusme

chrome beacon
#

Not really

quaint mantle
#

ive had this before

#

maybe this is different

#

oh

chrome beacon
#

It's not a nullpointer

quaint mantle
#

ok it is different

ebon isle
#

o.O

#

how can I fix it?

chrome beacon
ebon isle
#

Ouh sorry didn't see that

#

A min

quaint mantle
#

Hmm that's curious

#

my onhunger thing

#

does not cause stack overflow

#

OHH

#

i'm using e.setfoodlevel

#

(event method)

#

which likely changes the value

#

instead of essentially calling itself

#

.setamount

#

maybe that's it?

#

saw earlier, ignored it because was ambigous

#

ahh ok

#

it's 1:40AM

#

will continue this in the dawn

#

goodnight

chrome beacon
ebon isle
chrome beacon
#

The property isn't set yet

#

Well I recommend you head over to the TAB discord

#

They can probably help you better

ebon isle
#

Ouh, that's right.

#

Thanks for the help! 😄

void barn
#

I haven't been following Spigot stuff lately, what's the (planned) minimum version of Java for 1.17? I saw something about Bungeecord and Java 16 on the website.

chrome beacon
#

Vanilla Minecraft is using Java 16 now

#

So Spigot will follow

silk mirage
#

How do I avoid "Command dispatched Async" error

chrome beacon
#

Don't call it async

#

It's really that simple

silk mirage
#

I'm not

#

I'm just doing Bukkit.dispatchCommand

chrome beacon
#

Yeah and you're doing it async

void barn
chrome beacon
#

Yeah that a while ago

eternal night
#

prior to the java 16 announcement afaik

chrome beacon
#

^

silk mirage
chrome beacon
#

Call it sync

void barn
#

Oh that's really pleasant surprise 😄

silk mirage
#

How would I do that?

chrome beacon
#

BukkitRunnable or BukkitScheduler

#

It's up to you

silk mirage
#

Can't I just use java runnable?

void barn
#

I already identified so many places in my codebase where it can be expressed as a record

chrome beacon
silk mirage
#

I want to run it on another thread

#

So what would I do

chrome beacon
#

You don't

silk mirage
#

i do

chrome beacon
#

Well you can't avoid that error then

silk mirage
#

bruh

#

what an trash error

chrome beacon
#

lmao no

silk mirage
#

i won't care even tho if the code was async

#

because it was at last

chrome beacon
#

You're messing with compatability

#

and possibly breaking things

#

so yeah ofc it will warn you

silk mirage
#

well

#

i did this

#

what should i do instead of this

#

tell me that

#

...

chrome beacon
visual tide
#

i found this hardcore plugin that puts you into spectator mode when you die the 3rd time, but you cant fly through walls or go through any blocks, ive looked at the sourcecode and the only thing it seems to do is p.setGameMode(GameMode.SPECTATOR)
does anyone know how i can replicate this?

regal saffron
#

How can I add this?

ripe sparrow
#

add what?

regal saffron
#

this

#

How can I add big green circle

ripe sparrow
#

I would say it is utf-8 character of green circle in scoreboard team prefix?

regal saffron
#

Are you talking about this?

#

ripe sparrow
#

yeah, not sure if this specific character, but I would expect it is done this way...

visual tide
#

i dont even know if its intentional but its something cool that i would like to be able to do too

regal saffron
#

I tried that but it show like this..

#

wait

#

I fond

#

thanks

ripe sparrow
#

np :)

chrome beacon
visual tide
#

might be because theres no delay between respawning and getting put into gmsp and bukkit is glitching around

chrome beacon
#

From what I can find online you have 2 options:
Listen to the PlayerMoveEvent and cancel if they go in to a block

or

use packets to make the client think it's in sepectator mode while the player actually is in creative mode

wraith rapids
#

noclip may be maintained separately from gm3 in player abilities

eternal night
#

it isn't 😭

ebon isle
#

how can I delay this? I've google a lot about using bukkitScheduler (and tried it) no error on IDE but in CLI and I get bunch of error.

Can anyone help me?

I want to delay some methods inside PlayerJoin()

eternal night
#

this code is just registering your listeners. You don't want to delay the initial registration

ebon isle
eternal night
#

yes but then this code snippet is useless

ebon isle
#

true

#

a min

vivid lion
#

you dont delay the registration you delay inside the eventhandler annotated method within playerjoin class

ebon isle
#

Where do I start, I tried to follow some guide in google but I failed. Thanks for helping btw 😊

ivory sleet
#

What did you want to do?

ebon isle
ivory sleet
#

Have you ever worked with the BukkitScheduler?

ebon isle
ivory sleet
#

Hmm I can pull out an example

#
@EventHandler public void onSomeEvent(SomeEvent event) {
  Bukkit.getScheduler().runTaskLater(JavaPlugin.getProvidingPlugin(this.getClass()), () -> {
    yourDelayedMethods();
  },20L*seconds);
}
#

I’m on mobile so might have spelled something erroneously

ebon isle
#

Wait.

#

This works fine!

ivory sleet
ebon isle
#

I really don't know how I can't get it right.

#

thanks to you 🙂

icy nacelle
#

Hey, someone know if spigot 1.17 will have API breaks ?

ivory sleet
#

Spigot is working towards keeping version compatibility with that said there’s a big likelihood stuff won’t break but on the flip side no guarantee some stuff will work as usual.

icy nacelle
#

ok thx

keen kelp
#

what does adding synchronised before a method do

#

like
public synchronised Method(){

wraith rapids
#

it makes it synchronized

keen kelp
#

and that means?

wraith rapids
#

that it's run synchronously

ivory sleet
#

It locks the method such that it can’t be executed concurrently

keen kelp
#

confusion++;

wraith rapids
#

google it

#

you'll find a guide

#

if you have questions about the guide you find, ask them here

#

but we don't want to re-write or copy the guide for you

keen kelp
#

so basically it makes it so that there can only be one of itself be running at the same time?

#

to prevent race conditions

wraith rapids
#

not exactly, but close-ish

#

the method itself can still be run as many times at the same time as you want

#

but all of those method invocations must be on the same thread

keen kelp
#

I see

wraith rapids
#

that is, the method can still recurse, in other words, call itself

#

but if another thread tries to call the method, that other thread will halt

#

and wait until the currently executing thread returns from the method

#

this prevents two threads from fucking with not-thread-safe state and shit at the same time

quaint mantle
#

How can i teleport player to default spawn location?

#

Will this work? p.teleport(p.getWorld().getSpawnLocation());

fickle helm
eternal oxide
#

Depends on when its called

quaint mantle
#

I made a spawn listener so if the spawn isn't set it'd teleport to default world location

#

Just wanted to know how to teleport a player to default spawn location

ripe sparrow
#

then you should use setter in the event...

#

not sure about exact name...

eternal oxide
#

Yes that should work. There are certain times you can;t teleport a player, in specific events is all.

ripe sparrow
#

?jd

quaint mantle
#

?paste

undone axleBOT
quaint mantle
#

Here is an example:

quaint mantle
young knoll
#

You may want to cache that config

quaint mantle
#

can anybody help me? i cant understand whats that error it is.

quaint mantle
#

java: constructor Metrics in class org.bstats.bukkit.Metrics cannot be applied to given types;
required: org.bukkit.plugin.java.JavaPlugin,int
found: org.inventivetalent.advancedslabs.AdvancedSlabs
reason: actual and formal argument lists differ in length

#

i can`t what is error mean is...

ripe sparrow
#

can you send the code snippet that shows this error?

queen dragonBOT
quaint mantle
#

okay, wait a while

glossy venture
#

i think that synchronized means that the actions are mirrored across all cpu cores to prevent multithreading problems

paper viper
#

What

glossy venture
#

oh wait

#

that convo was 2 hours ago

quaint mantle
paper viper
#

when you refer this

#

is it your main plugin class

ripe sparrow
eternal oxide
#

you also need a plugin id from bstats

glossy venture
#

does anyone know a good java javascript engine

#

so i can run js from java

#

wait wrong channel

#

whatever

#

nvm

#

not wrong channel

quaint mantle
ripe sparrow
#

provided that this extends JavaPlugin...

quaint mantle
eternal oxide
#

do NOT leave it using 0

#

register your plugin and use the ID bstats provides

quaint mantle
#

Hey, what's the the recommended method to create commands (with modern tab completion in colors, etc)?

ripe sparrow
quaint mantle
#

net.minecraft.server.worldserver is no more use on 1.16.5?

young knoll
#

I don’t think the tab completer line is necessary

ripe sparrow
#

I don't know, but I know it works this way for me :D

young knoll
#

You only need setExecutor

ivory sleet
#

Also TabExecutor (:

ripe sparrow
#

wut? :D

ripe sparrow
ivory sleet
#

It’s a shame PluginCommand#setTabExecutor doesn’t exist

#

Guess time for a pr

young knoll
#

Do you really need a different class for executor and tab executor

ripe sparrow
#

yeah, may do it, but I will wait for 1.17... and do it after the release...

#

although there probably won't be any conflicts anyway... but why risk it :D

lunar schooner
subtle vector
#

Spigot provides apis for mc right?

ivory sleet
#

Yeah essentially an abstraction of the Minecraft server implementation sepikill

#

TabExecutor extends CommandExecutor, TabCompleter

ember crag
#

hi, so whenever i have a playerbedenterevent, it gets called whenever the player right clicks on the bed and not whenever they actually enter the bed, how do i fix this?

tardy delta
#

uhm

[15:31:08] [Server thread/ERROR]: Error occurred while enabling MagmaBuildNetwork v1.0 (Is it up to date?)
java.lang.NullPointerException: null
        at io.github.FourteenBrush.MagmaBuildNetwork.DataManager.saveDefaultConfig(DataManager.java:53) ~[?:?]
        at io.github.FourteenBrush.MagmaBuildNetwork.DataManager.<init>(DataManager.java:19) ~[?:?]
        at io.github.FourteenBrush.MagmaBuildNetwork.Main.onEnable(Main.java:31) ~[?:?]

Line 51-58:

public void saveDefaultConfig() {
        if (this.configFile == null) {
            this.configFile = new File(Main.getInstance().getDataFolder(), "config.yml");
        }
        if (!this.configFile.exists()) {
            Main.getInstance().saveResource("config.yml", false);
        }
    }```
young knoll
#

Is main.getInstance null

tardy delta
#

getinstance returns private static Main instance;

#

so that would be a no

young knoll
#

Are you calling this code before you assign that

tardy delta
#

wait wanna see the whole datamanager class?

#

or something else

young knoll
#

I want you to answer

tardy delta
#

and now i'll retry

#

now its fixed but i have this


Error occurred while enabling MagmaBuildNetwork v1.0 (Is it up to date?)
java.lang.NoClassDefFoundError: io/github/FourteenBrush/MagmaBuildNetwork/Listeners/TradeListener

at this line


private DataManager data;
#

inside onEnable():
this.data = new DataManager();

quiet ice
#

Are you sure that you are providing the class in the jar?

#

And what is the previous error? NoClassDefFoundError is always preceded by another error

tardy delta
#

wdym? a tradelistener.class?

quiet ice
#

io/github/FourteenBrush/MagmaBuildNetwork/Listeners/TradeListener.class in this case

tardy delta
#

yes it is there

quiet ice
#

would be too easy

tardy delta
#

the previous error is one from another plugin that doesnt find a class definition either

#

i think i found it

#

only viaversion is doing strange things

spice ember
#

Does someone know how to check if world already exists in server's folder? (or if I use WorldCreator.name(name), will it first check if world is already created?)

hybrid spoke
#

i dont think its viaversion which is doing weirdos

quaint mantle
tardy delta
#

?paste

undone axleBOT
tardy delta
#

or it didnt found another plugin or something

#

ow yea last part is somthing else

eternal oxide
spice ember
#

But thanks

ivory sleet
#

Highly doubt you red all docs this fast

spice ember
#

I have it in my browser

#

🙂

#

(already)

spice ember
elfin creek
#

can i load worlds on requirement
like see
i have world 1
players joined world 1 and now its full
i want a new instance of world 1 to fit the new members

#

how can i do it

#

i looked up the docs but didnt get something i want

ember crag
#

is it possible to split commands into their own files?

#

like have each command be its own class file in a package somewhere

pulsar zenith
#

yes

#

make a onCommand

#

then do whatever you run for that command

#

then in your onEnable, set that class as your commands executor

ember crag
#

thx

spice ember
#

I just realized I don't need it

lyric grove
#

Is there a maximum amount of .replace you can have on a string?

ember crag
#

depends on how sane you are

lyric grove
#

im using this

#

and it only replaces some of the placeholders, and it changes the order i place them

ember crag
#

it works the best so you're not having to do .replace for everything

#

you can also use string.format too

lyric grove
#

thanks

quiet ice
#

isn't it using regexes which are not the best thing in the world?

#

Though I guess Apache commons is going to do the same thing

#

Yes, they are very good at killing performance if used unwisely

#

Though this is paranoid optimisation I guess

ember crag
#

yep pretty much

#

how would i convert minutes to a humanized duration?

lyric grove
#

Dont worry, its just a discord webhook that will announce probably only 5 times a day

#

But i have it in my pom

paper viper
#

you shaded it right?

lyric grove
#

How would i set it to shade?

paper viper
#

thats why

#

because you need to shade it in

#

add the shading plugin

lyric grove
#

yeah how would i?

#

oh

paper viper
lyric grove
#

But i am

paper viper
#

you arent using it correctly

#

hold on

#

and also whats with the finalName 🤔

#

remove that

thorny atlas
#

@fickle helm try with <scope>compile<scope>

paper viper
#

its always

#

by default set to compile

#

so that wont change anything

#

probably wrong ping also too

thorny atlas
#

Yes sorry bbuffalo lmao

fickle helm
#

wrong p word. lol

thorny atlas
#

my bad dud

fickle helm
#

I was already looking at this channel anyways

mellow gulch
#

is it true that spigot 1.17 is going to require java 16? if so, does anyone know what a JPMS module is?
I've been staying in java 14 because some of my plugins use Nashorn (javascript) and if i need to update to java 16, then i think im going to need to figure out how to use openjdk's Nashorn, or possibly an alternative. Any info will be much appreciated.

paper viper
#

Spigot 1.17 requires Java 16

lyric grove
paper viper
#

also, thats wrong syntax anyways you forgot a slash

#

so that wouldnt work

#

make sure you are using the correct jar too

quaint mantle
#

What is a cave air block?

#

We have air, void air and cave air

winter fog
#

I think thats what MC uses when generating caves

#

same with void, but the void

fickle helm
#

if there's a natural cave and there's an empty block then it is cave_air

quaint mantle
#

Not sure why spigot includes it then?

eternal night
#

it is a material, why would spigot not include it

#

o.O

quaint mantle
#

Because it’s never gonna be used

fickle helm
#

what else is there to explain? I think it is rather self explanatory

quaint mantle
#

I just found it strange sorry

fickle helm
#

can be used to determine if a coordinate is inside a cave

quaint mantle
#

Ah alright

mellow gulch
#

some time around the nether update mojang made 2 extra types of air to make it easier for them to generate caves and such

#

may have been before that actually, hmm, i don't remember when it was

quaint mantle
ripe sparrow
iron condor
#

how would you code an unstuck command?

#

or teleport player through blocks

ivory sleet
#

Brigadier can be implemented with the command executor as the dispatcher so yeah it sort of supports it

weary geyser
#

player.getLocation().add(x, y, z) @iron condor

quiet ice
#

Though afaik not with traditional spigot api

quaint mantle
#

Alright thanks

weary geyser
#

Does anyone know why I get a NPE when I register my placeholder at PlaceholderExpansion line 132?

ivory sleet
#

Send the stacktrace

weary geyser
#

Bet

ivory sleet
#

CandySkyCoins line 98

lyric grove
#

and its not working

weary geyser
#

@ivory sleet new CandySkyCoinsPlaceholder(this).register();

ivory sleet
#

And if u send that register method

weary geyser
#

It's a part of PlaceholderAPI but sure

#

The class extends PlaceholderExpansion

ivory sleet
#

If I was going to have a guess

#

Your plugin loads before PlaceholderAPI or smtng with plugman might mess with it

weary geyser
#

PAPI loads before tho

#

And without plugman it still errors

ivory sleet
#

Send the papi expansion class

sterile sinew
#

@ivory sleet add me it’s comp

weary geyser
ivory sleet
#

I am curious to see the register method also

weary geyser
#

@ivory sleet

thorny atlas
#

sysdm, can this be removed getRequiredPlugin() { return "CandySkyCoins"; }

weary geyser
#

Yes

thorny atlas
#

try it without that method

weary geyser
#

It didn't work when I tried it before

ivory sleet
#

What does getPlaceholderAPI return

weary geyser
#
    public final PlaceholderAPIPlugin getPlaceholderAPI() {
        return PlaceholderAPIPlugin.getInstance();
    }```
ivory sleet
#

Really feels like that plugin instance is null

weary geyser
#

åh juste jag är svensk också

#

Maybe

ivory sleet
#

Aaaa

#

Hmm you might wanna ask in the helpchat discord where all the papi devs are

weary geyser
#

Yup

ivory sleet
#

Go for it gl fingerguns

weary geyser
#

Thanks man

paper viper
ivory sleet
#

It’s bomp

paper viper
#

Oh

sterile sinew
#

Discord hates me that’s why lol

ember crag
#

how do i have a command take args?

sharp bough
#

so im having a hard time understanding how instances of classes work, im used to think that a function runs when called, recently i was told this is not how it works, that "new" calls a function and creates an instance of a class, does this mean that the entire class runs or just what i call (line by line, thats why the return, so this doesnt create a new HashMap)

#

but i think thats wrong?

paper viper
#

When you create a new instance of the class, whatever is in the constructor is executed

sharp bough
#

if it does run the entire class, how do returns work? or it goes line by line creating this methods

eternal oxide
sharp bough
paper viper
#

you have to initialize it using a constructor

royal vale
#

SpawnParticle spawnparticle = new SpawnParticle();
spawnparticle.put(player.getUniqueId, particle)

#

I think

paper viper
#

like

public class MyClass {
  public MyClass() { // this is my constructor

  }
}
vale cradle
paper viper
#

this wont work

royal vale
#

Ok

#

Btw, is anyone familiar with ProtocolLib?

sharp bough
#

oh thats whats everywhere? constructors? the
public void setPlayer(Player player){
this.player = player
}

#

for example

#

so it doesnt run

#

unless you call it

paper viper
#

that is a setter method

kind coral
#

i've found a plugin on spigot that shutdowns the server instead of just disabling itself

paper viper
#

and yes it doesnt run

#

unless you call it

sharp bough
#

why does everyone hate static

vale cradle
#

Have you looked at a Java tutorial?

sharp bough
paper viper
#

we dont hate it, you just cant code

#

lmfao

vale cradle
#

Before getting into spigot

sharp bough
#

what

#

a great idea

#

thats what i was missing

#

the tutorial!

vale cradle
#

So, you know what a constructor is? Right?

paper viper
#

Wow? You could've done that months ago and people like you wouldn't make us annoyed

ivory sleet
sharp bough
#

almost

vale cradle
#

Ye give them a look

warm galleon
#

how do i give somone red stained glass? whats the metadata fo it?

paper viper
#

you arent using 1.16 im guessing right

#

cause this was for color data values

warm galleon
#

1.8.8

#

legacy :3

#

nvm i use the short number after the :

sterile sinew
#

DyeColor.Red.data

#

Or some shit right

sterile sinew
sharp bough
#

like random plugins

#

that use static

sterile sinew
#

That doesent make it proper

#

You don’t just use static if you need something in another class. It depends what it is/ what purpose it’s serving

quaint mantle
#

do you have a library to recommend to send messages in rich format (with clickable links for example)?

young knoll
#

Adventure is good

#

But the built in one is usable

burnt current
#

Hey Does anyone know how to create mobs and items with your own textures in Spigot?

warm galleon
#

if variables or members change then nonstatic

#

its also more scalable, as my dad says lol

quaint mantle
#

let's go for adventure

sterile sinew
warm galleon
#

wait

#

does static or nonstatic mean that

next plume
#

They wouldn't have put 'static' in the language if they didn't want you to use it. 🤓

royal vale
#

Why was WrapperPlayServerUpdateSign removed in ProtocolLib (PacketWrapper)?

tacit path
winged portal
#

why when i try to upload an icon to my plugin crashes the browser?

neon nymph
#

Ey guys, is there anywhere on the internet that lists all items that have renamed namespace IDs and which versions they're on?

woven epoch
#

What would be the best way to make 3 entities into one? Say I wanted to have 3 armor stands in a line, not mounted, just 3 armor stands. Is there an easy way to link them together into one entity? Would I have to just listen for ones death and kill the others?

opal juniper
#

Yes

#

There is no easy clean way to do this afaik

winged portal
#

nvm, solved

vital ridge
#

Can someone tell me when the blockexplosionevent is registered?

#

I exploded a few blocks and it never registered lol

eternal night
#

I think it is closer to like a bed exploding

#

TNT does not explode as a block but simply converts to a TNTPrimed entity, which then explodes

opal juniper
#

there is a point where the tnt spawns the TNTPrimed

#

which then is an entity

vital ridge
#

Well entityexplodeevent cant let me get exploded blocks

#

so i cant cancel shit

opal juniper
#

Yeah it can

vital ridge
#

what method lol?

#

E.getentity

vital ridge
#

oh aight

#

tho

#

wanted to ask that before

opal juniper
#

or it implements cancellable so you could just cancel it if you want it to do nothing at all

vital ridge
#

i need to check if it contains armorstand

#

but i cant check if it contains material.armorstand

opal juniper
#

armourstand is an entity afaik

eternal night
#

^^

#

yes

vital ridge
#

yeah butr

#

i cant check that aswell

eternal night
#

totally different story

#

would be listed in entity damage event

opal juniper
#

damagetype or whatever

vital ridge
#

My armorstand is invulnerable

#

and i want it to only be destroyed

#

when exploded

#

thats the thing

#

Im looking for events

opal juniper
#

Ok, so listen for damage event

vital ridge
#

Doesnt work

#

entitydamageevent doesnt work

opal juniper
#

have not invunlernable

eternal night
#

well, implement invulnerability yourself

opal juniper
#

and cancel if it is not an explosion

eternal night
#

ye

opal juniper
#

yeah what he said

vital ridge
#

Oh yeah

#

havent thought bout that lol

#

Ill try it, but one quesiton

#

if i want to check

#

if a list contains specific block

#

whats like the enum for that?

#

Theres no BlockType

#

or Block.

opal juniper
#

you have to loop

vital ridge
#

loop through blocklist

eternal night
#

blocks are instances, not enum constants like Material

opal juniper
eternal night
#

you'll have to check their individual location/metadata

#

yeah whatever you wanna identify them by

vital ridge
#

So if i loop through the list

#

checking it with material will work?

#

ill try

opal juniper
#

yep,

vital ridge
#

I mean as i thought its refering that material is incompatible for block

#

but theres no errors

#

i mean its a warning

#
for (Block b : e.blockList()) {
            
            if (b instanceof ArmorStand) {
                
                System.out.println("its armorstand");
                
            }

that doesnt sysout nothing when i explode armorstand

quiet ice
#

can a block even be an ArmorStand?

vital ridge
#

Well you can place down an armorstand

#

like other blocks

#

so e.blockList does not containt armorstand

quiet ice
#

What exact class are you importing?

vital ridge
#

even if tnt explodes one?

quaint mantle
#
for (Entity entity : entityIterable) {
    if (entity instanceof ArmorStand) {
        //
    }
}
quiet ice
#

Either way it is likely wrong, you would likely need to check BlockMeta (or BlockData)

vital ridge
#

Well this event returns entity as the entity who explodes

#

example creeper or tnt

quiet ice
#

let me see

vital ridge
#

EntityExplosionEvent

quiet ice
#

?jd

quiet ice
#
Package org.bukkit.entity
Interface ArmorStand
#

You are surely using the wrong interface

vital ridge
#

Nah i was just talking crap what isnt true

#

I just understood smthing wrong

#

i meant that

#

i thought the list will contain armorstand

#

but it doesnt

quiet ice
#

yea it cannot since incompatible return types

vital ridge
#

Im trying to check this

#
for (Block b : e.blockList()) {
            
            if (b instanceof Skull) {
                
                System.out.println("skull");
                
            }
            
        }
#

but that returns nothing aswell

#

but skull is a block

#

oh yeah

#

cuz

#

It sysouts player_head

#

not skull

#

yeah now it works i used b.gettype and changed skull to material . player head

#

thanks.

sullen dome
#

omg geol you're alive (i guess lol).
why is this actually breaking blocks so weird?

private final BlockFace[] blockFaces = new BlockFace[]{BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST, BlockFace.EAST, BlockFace.DOWN};

    private void cutDownTreePart(Player player, Block startBlock) {
        if (isLog(startBlock)) {
            for (BlockFace face : blockFaces) {
                Block newBlock = startBlock.getRelative(face);
                if (isLog(newBlock)) {
                    newBlock.breakNaturally();
                    cutDownTreePart(player, newBlock);
                }
            }
        }
    }```

for example with normal trees (oak/birch) it only breaks like 2 blocks. 
for dark-oak-trees, it breaks like 5-6 blocks.
quiet ice
#

perhaps because of the initial if statement

sullen dome
#

the first one?

#

huh

quiet ice
#

After the new block is broken it will be air, thus failing that test

#

yeah, that is def. the reason for it

sullen dome
#

shouldn't the for-loop let it go into every direction (like for example y+1 everytime)? and they're definitely not air

quiet ice
#
 private void cutDownTreePart(Player player, Block startBlock) {
        if (isLog(startBlock)) {
            for (BlockFace face : blockFaces) {
                Block newBlock = startBlock.getRelative(face);
                if (isLog(newBlock)) {
                    // Block is still a log
                    newBlock.breakNaturally();
                    // block broken, now air
                    // calling cutDownTreePart calls if (isLog(newBlock)), which will now return false, thus not recursing further
                    cutDownTreePart(player, newBlock);
                }
            }
        }
    }
vital ridge
#

Im spawning a skullinto the world and im setting the persistentdatacontainer. When i sysout the keyset, it works perfectly and the sysout shows all the keys. However, in entityexplosionevent, when my skull gets exploded and i sysout the keyset, it returns nothing.

sullen dome
#

oh, it was because i first broke the block, and then called it on that block?

#

fml

vital ridge
#

Thats a problem because i cant keep my player head in the world depending of its persistentdata

#

even if tnt explodes it

sullen dome
#

wow, it actually works. yaaaaay
here's the code i used:

    @EventHandler
    public void onBlockBreak(BlockBreakEvent e) {
        if (e.getPlayer().isSneaking()) {
            if (isLog(e.getBlock())) {
                cutDownTreePart(e.getPlayer(), e.getBlock());
            }
        }
    }

    private final BlockFace[] blockFaces = new BlockFace[]{BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST, BlockFace.UP, BlockFace.DOWN};

    private void cutDownTreePart(Player player, Block startBlock) {
        if (isLog(startBlock)) {
            startBlock.breakNaturally();
            for (BlockFace face : blockFaces) {
                Block newBlock = startBlock.getRelative(face);
                if (isLog(newBlock)) {
                    cutDownTreePart(player, newBlock);
                }
            }
        }
    }
sharp bough
#

hahaa

#

thats mc looks better than real life

sullen dome
#

lol

sharp bough
#

mine is a 8pixel texture pack

sullen dome
#

if i could i would use seus instead

sharp bough
#

that looks like sht

sullen dome
#

but nah, amd doesnt like that

#

it hates seus so much, it instantly crashes my game

#

BeyondBelieve looks cool as well tho

delicate fractal
#

i need to know

sullen dome
#

which message dym

empty swallow
#

triple ``` at the beginning and ``` at the end

sullen dome
#

you mean this?

lol

then, what matt said

delicate fractal
#

yes

#

ok

sullen dome
delicate fractal
#
        @EventHandler
        public void onJoin(PlayerJoinEvent event){
            Player player =.getPlayer();
            if(!( player.hasPlayedBefore())) //send to hub or whatever

        }

    private void getPlayer() {
    }
}```
#

what is wrong

#

with the code

sullen dome
#

the bracket placement lol

#

nvm

#

my bad

#

what do you wanna do tho

delicate fractal
#

i want to make it so when new people join they spawn at the spawn that i set it to

sullen dome
#

then the code doesn't look that wrong. i just dont know what the getPlayer() should do lol

warm galleon
#

they

sullen dome
#

why do you have it then lmao

warm galleon
sullen dome
#

not you

#

first message was to you, second one to mylo

sullen dome
# delicate fractal me neither

well consider using smt like this:

@EventHandler
public void onWhatever(PlayerJoinEvent event){
  if(!event.getPlayer().hasPlayedBefore()) event.getPlayer().teleport(new Location(Bukkit.getWorld("worldname", x, y, z, yaw, pitch)));
}

where yaw and pitch are optional

#

nevermind, you have to use if(!hasPlayedBefore()){, i forgot the ! on begin

delicate fractal
#

oh ok

sullen dome
#

edited it*

delicate fractal
#

it has many errors

sullen dome
#

shouldn't. imported everything?

delicate fractal
#

wdym

sullen dome
#

you have to import the classes, that you use

empty swallow
#
import the org.bukkit.Listener thing;
public class joinEvent() implements Listener {
        @EventHandler
        public void onJoin(PlayerJoinEvent event){
            Player player =.getPlayer();
            if(!( player.hasPlayedBefore())) //send to hub or whatever

        }
}

in main:
public Main extends JavaPlugin {
 //getServer.getPluginManager.registerEvents(new joinEvent(), this);
}
delicate fractal
#

i dont understand im like new to scripting i started 20mins ago

empty swallow
#

etc etc

sullen dome
#

no offense, but it looks like you probably should learn a bit of the really basic java

#

before starting with spigot

delicate fractal
#

but i just want to make plugins for my server

#

i have to otherwise i cant run my server

empty swallow
#

but you need to learn java, which is what you make plugins with

sullen dome
#

yeah, but that requires java knowledge

delicate fractal
#

wth is java

sullen dome
#

oh god

delicate fractal
#

i have heard about it

delicate fractal
#

a type of coding ig

sullen dome
#

the engine where minecraft runs in lol

#

yes, hate me for saying engine lmao

delicate fractal
#

srry for my stupidnes

sullen dome
#

java is a coding language in this case tho.

empty swallow
#

java is the coding language in which minecraft & spigot are built on

sullen dome
#

like c++, c#, python, etc

delicate fractal
#

ye but i dont speek coding language lol

empty swallow
#

you will if you want to make plugins

sullen dome
#

then you shouldn't make plugins lol

delicate fractal
#

that will probably take ages for me to learn

sullen dome
#

you cannot repair a car if you don't know how. basically the same

#

one sec

delicate fractal
#

i have to much school to learn this

empty swallow
#

then dont make plugins, have someone else make them for you, or take the time to learn

delicate fractal
#

this is extra knowledge

empty swallow
#

it takes 30 minutes tops to learn basic java, and spigot/bukkit api

ivory sleet
#

?learnjava

undone axleBOT
chrome beacon
#

I already sent you tutorial links ._.

delicate fractal
#

ik

empty swallow
chrome beacon
#

Why are you here asking then?

sullen dome
#

then maybe stick to youtube tutorials. but watch out, dont look for Learning Java in x Hours that's trash stuff

delicate fractal
#

i asked for whats the problem with the plugin and then we came into this

empty swallow
sullen dome
#

yeah, because people in here don't like to spoonfeed with code

#

(what i did btw)

#

lol

delicate fractal
sullen dome
#

spigot has a java crash course? wow

ivory sleet
#

It’s really bad

empty swallow
sullen dome
#

thats actually quite cool

delicate fractal
#

i probably learn better by listening not by reading

empty swallow
delicate fractal
#

i use intelj

empty swallow
#

you can plug the text into google translate and have it read to you

sullen dome
#

maybe use eclipse for beginning? imo, intellij is pretty much for people who know what they do

sullen dome
#

but it depends on you pretty much

sullen dome
#

intellij looks a bit complicated in the first place maybe

#

like exporting stuff etc

#

but then, intellij has for example way more customizable-options via plugins and stuff

#

and eclipse is more like you instantly understand where to do what and how

delicate fractal
#

oh ok

sullen dome
#

except writing code. thats another thing, not IDE-Related

delicate fractal
#

i did already learn a bit to work with intelj

#

@chrome beacon teached me\

sullen dome
#

please

#

dont ping people

delicate fractal
#

oh srry

sullen dome
#

most people don't like that

delicate fractal
#

srry

#

i think ill keep myself watching yt mc videos instead of coding

#

its way to complicated for me

#

and i dont have the time to learn

#

to much school*\

sullen dome
#

i mean, if i would be able to speak fluent english and be able to be a good teacher, i could eventually teach you a small bit, but nah sadly none of them fits to me lol

delicate fractal
#

im also not english

#

so thats also a reason why i cant script, i dont understand alot of words

sullen dome
#

what is your main language tho?

delicate fractal
#

dutch

sullen dome
#

dutch ohh

delicate fractal
#

you?

sullen dome
#

german

delicate fractal
#

oh

#

nice neighbours

sullen dome
#

basically dutch. in normal xd

delicate fractal
#

ye lol

sullen dome
#

much stuff sounds almost the same

delicate fractal
#

true

#

like Papier

#

what is it in German

sullen dome
#

Papier xd

#

or Lastkraftwagenfahrer

well, probably not tbh

delicate fractal
#

ye that was the first thing i thought about

delicate fractal
sullen dome
#

german has so much sooo long words

#

and weird words

delicate fractal
#

dutch hasnt

#

i think

sullen dome
#

and german has like the weirdest grammar i ever heard of

hybrid spoke
#

lebenslangerschicksalsschatz

delicate fractal
#

ye its hard to learn

sullen dome
#

holy shit

delicate fractal
#

i have deutsch at school

sullen dome
#

umfahren ist das gegenteil von umfahren

delicate fractal
#

but like cant u talk english

#

u said?

sullen dome
#

i can write and read pretty good

delicate fractal
#

oh ok

#

i can

#

a bit

sullen dome
#

but i can't really talk, because of accent and stuff

delicate fractal
#

i do understand

sullen dome
delicate fractal
#

in eglish

sullen dome
#

well, but i do. i am not that confident, that i could talk in english

#

i did that 1 time in vc here

delicate fractal
#

oh

sullen dome
#

people actually laught at me lol

#

poor me xd

delicate fractal
#

lol

#

thats sad

sullen dome
#

yea

#

and worse? i was the only one with a working mic

delicate fractal
#

if i talk english people know that im dutch

#

by my accent

delicate fractal
sullen dome
#

and there were 3 people like Omg, i can hear that german accent, and i was just yeah, of course you can

delicate fractal
#

lmao

#

i had that once before

hybrid spoke
#

german accent is just like speaking english in german

delicate fractal
#

wanna here my accent lol

#

but idc about german accent cuz i have dutch accent

#

maybe almost the same

sullen dome
#

well, my accent is just like Hey, Ai Wod laik to took to ju

delicate fractal
#

hahaha

sullen dome
#

like that full german

delicate fractal
#

really

sullen dome
#

yea

#

pretty much

delicate fractal
#

wanna here me say that

#

join vc

sullen dome
#

and i'm sitting there, shaking, and thinking what can i say now

#

no way ahhhhhhh i'm out

delicate fractal
#

no hear me

#

not u talk

sullen dome
#

but i have that like all the time

#

isnt that awkward? lol

delicate fractal
#

but when i get comfortable with people then i dont have that

#

ye it is

#

who is on ur pf picture

sullen dome
#

i just continue talking to german people xd

#

long story, but not me xd

delicate fractal
#

talk to me:)

#

oh ok

sullen dome
#

i'm not a girl tho if you think so xd

delicate fractal
#

oh ok lol

#

me neither

sullen dome
#

yeah, but i have a girl as pfp

#

you dont lol

delicate fractal
#

maybe i have

sullen dome
#

who knows

delicate fractal
#

maybe the cat is a girl cat

sullen dome
#

:oooooo

delicate fractal
#

are u alot on discord

#

sad im the only one in c=vc

sullen dome
#

well, pretty much yeah

delicate fractal
#

vc

sullen dome
#

xd

delicate fractal
#

oh ok

#

nice

hybrid spoke
sullen dome
#

cmon, lemme come in xd. and hope that 10 seconds later, there's not like 10 people inside it just because of me

delicate fractal
#

wait is it bannable to ask someone to join ur discord

sullen dome
#

one sec

#

idk

#

i usually dont join discords tho

delicate fractal
delicate fractal
hybrid spoke
delicate fractal
#

ok thats awkaward ye

sullen dome
#

yeah

delicate fractal
#

lol

sullen dome
#

i knew it

delicate fractal
#

now we both in vc but both muted😂

sullen dome
#

at least, there are no 10 people inside, who are talking about my accent, one thing that's positive

delicate fractal
#

ture

#

true

#

oh

sullen dome
#

aaand there's the first one

delicate fractal
#

now someone joined

sullen dome
#

and the second one

#

i knew that

hybrid spoke
#

i dont think that they are in that channel because of your accent

delicate fractal
#

which place

#

what big city is it close to?

pearl hollow
#

I dont know why, but this:

#

produces this:

#

This is the scoreboard yml file that i had

#

or a pic of it

delicate fractal
#

der dir das und something

sullen dome
#

GodCypher, please join vc, i am so alone under dutch people xd

uneven relic
#

hi guys, someone know some plugin that give u the variable of the idiom?

#

i try get {locale} but dont work in Papi

#

Hello, does anyone know any plugin that gives you the variable of the language that the user has to be able to connect it? I want that having the variable according to the language the npc of the text in your language (translated by me before) but I don't know which one to use, I tried to use Advanced Multi Language but idk how to used it

chrome beacon
uneven relic
#

oh srry i thig that i talk about string is developed too

torn oyster
#

what would be the best way to make an antispam

#

like

#

detect if the message is similar

#

is there a String.isSimilar() method?

#

lemme checkm

valid vigil
#

if I have a command that takes a player as one of its arguments, is Bukkit.getPlayer the right method to get the actual Player object?

chrome beacon
#

Yes

valid vigil
#

thanks

wraith rapids
#

just make sure to null-check the return value

valid vigil
#

👍

wraith rapids
#

as names that do not have a corresponding player online will return null

dense goblet
twin venture
#

i have a problem with a plugin iam making anyone interested to help me find the issuse?

uneven relic
dense goblet
#

i.e. if the longest common subsequence is at least 85% the length of the shorter message. Also make sure to ignore case when comparing the two messages

eternal night
#

might want to look into something like the levenshtein distance

#

which is a pretty common way to calculate how "similar" one string is to another

wraith rapids
#

levenshtein distance and similarity are poor ways of implementing a spam filter

#

as you can get past the filter by appending random nonsense at the end

eternal night
#

^^ agreed, they are very easy to bypass

vital ridge
#

Im spawning in a skull with persistent data. When i try sysouting the persistent data in interacting event, the data is there as it should. But the data seems to be not there in entityexplode event, like it suddenly is just not there like it never existed.

#

Im not letting explode certain items with persistent data, but it seems to not work as the item what should have persistent data doesnt.

#

Anyone has any idea?

eternal night
#

you spawn in the flying wither skull with the respective pdc data and when it explodes it is gone ?

vital ridge
#

basically i have a mystery box plugin

#

it should be tnt proof

#

only my mystery box head tho

#

so it has a persistent data, always had

#

but in entity explode event its suddenly not there anymore

eternal night
#

so when iterating over the blocks in the EntityExplodeEvent the skulls "tile state" does not contain the pdc anymore ?

vital ridge
#

My current code:

@EventHandler
    public void onBoxExplosion(EntityExplodeEvent e) {

        System.out.println(e.blockList());

        List<Block> toRemove = new ArrayList<>();

        for (Block b : e.blockList()) {

            if (b.getType() == (Material.PLAYER_HEAD)) {

                Skull skull = (Skull) b.getState();

                    toRemove.add(b);

            }

        }
        e.blockList().removeAll(toRemove);

    }

If i were to do skull.getpersistentdata.getkeys

#

it would print out nothing

eternal oxide
#

An entity Skull is not a block

vital ridge
#

im using block

#

not entity

#
import org.bukkit.block.Skull;
eternal oxide
#

The entity that is exploding?

vital ridge
#

the entity that is exploding is usually creeper / tnt

eternal oxide
#

oh you are blowing up a skull with another explosion

vital ridge
#

mhm

#

|But yea the persistent data just gets lost

#

no idea why

eternal oxide
#

Where are you testing the PDC?

eternal night
#

I'll try to recreate it

vital ridge
#

You mean controlling if the skull has certain pdc and if yes then remove it?

#

Id do it in the for loop

#

adding the b into toRemove only if it has certain pdc

#

ive tried that tho

quaint mantle
#

does anyone know method getWorldProvider() is changed to what method?

vital ridge
#

that doesnt work, since printing out skulls pdc keys returns nothing

eternal night
#

okay cannot re-create your issue

eternal oxide
#

Yeah, I was going to say its unlikely as Blocks are single instance. The only ever represent one in world object.

eternal night
#

tho I am running paper-755