#help-development

1 messages · Page 1369 of 1

lost matrix
#

The "speed" is determined by the length of the vector. So all you need to do is get the length then the direction you want, normalize the direction and multiply it by the length.

eternal night
#

get the velocity vector of the source -> normalize it -> multiply it with the length of the targets projectile velocity vector

#

yikes

lost matrix
#

sniped

eternal night
#

😭

#

german efficiency

lost matrix
#

^^

sage swift
#

thank you

#

should use Vector#length? sounds scarily costly

#

ah, i can just use it once

lost matrix
#

It kind of is (because of the square root) you could also do some complicated math with the squared lenght but unless you do stuff every tick or so you should not worry about that.

#

Let me think how expensive a 3 axis vector rotation would be...

sage swift
#

works perfectly, thank you

eternal night
#

Go full InvSqrt

#

lol

queen nacelle
#

Hey do you guys with or without NMS know of a way to stop horses from like kicking up their hooves? Ive been digging through horse AI and im drawing a blank

eternal night
#

I think PathfinderGoalTame contains that logic. How you would go about disabling it tho, questionable

#

you would probably have to listen for the outgoing entity effect packet

queen nacelle
#

Really? Horses seem to just rear up when your running randomly too

eternal night
#

oh ?

queen nacelle
#

Yeah like if the entity is damaged it like does the weird think where it can kick up its feet too

#

So I thought maybe it was under AbstractHorse since its shared between donkey's horses and mules

#

but im drawing a blank, i might be just blind

sullen marlin
#

could be client side

queen nacelle
#

But when the horse rears up it stops movement of the horse, so there has to be some kind of logic

#

unless the server just detects the packet for rearing up and freezes you

eternal night
#

@queen nacelle

#

EntityHorseAbstract#getSoundHurt

queen nacelle
#

OH

#

Thank you

#

its Stand()

eternal night
#

yeah

#

but like, I really don't know how you will be able to disable this

queen nacelle
#

welp time for some fun ig

eternal night
#

Yeaaah good luck xD

hasty ingot
#

Anyone has any idea how this can be completed with? I'm inside custom class which extends NMS entity

eternal night
#

I mean, what is your goal here ?

#

have your custom entity break doors ?

#

The predicate basically is a filter to define in which difficulties the entity should be able to break doors

#

i don't know what the integer in the second constructor is

#

I think how long the entity needs (in ticks) to break the door

#

but could be totally off on that one

hasty ingot
#

mm i want this custom entity be able to break doors

hasty ingot
eternal night
#

I mean it is just a predicate ?

#

idk what your issue is

quaint mantle
#
// Pseudo

NPC.move();
if NPC.getBlockInFront().getType() == BlockType.DOOR {
    NPC.playAnimation(Animation.BLOCK_BREAK);
    NPC.getBlockInFront().setType(Material.AIR);
}

@hasty ingot

hasty ingot
#

Im in 1.16, in older versions you dont needed to specify the predicate inside PathfinderGoalBreakDoor constructor (was easier). I dont know how to create this predicate and give it to constructor

eternal night
#

ah, well if you'd want it to only destroy stuff on hard difficulty

#

it would be

#

d -> d == EnumDifficulty.HARD

hasty ingot
#

i'll try it

eternal night
#

you know the lambda syntax tho right ?

hasty ingot
#

yes

eternal night
#

kk

hasty ingot
#

it works, thanks 😄

eternal night
#

👏👏

leaden falcon
#

Why are these descriptions so weird?

#

For HERO_OF_THE_VILLAGE and BAD_OMEN

sullen marlin
#

cause they never got updated

#

you're welcome to update them

leaden falcon
#

alr

quaint mantle
#

LOL

hasty ingot
#

thanks for the suggestion 🙂

cinder thistle
#

Fuck off. Any IDE works fine. You think they’re well-known because they’re shitty? If that was the case, they wouldn’t be popular. Your statement was in no way related to his question.

#

You think. It’s your opinion.

#

Because I’m tired of people doing this

round finch
#

is breaking packet possible on bedrock?

cinder thistle
#

Wdym

round finch
#

like the cracks display

#

not on my own pc right now i just wanted to know for a plugin

#

i were thinking about making fake bedrock mining 😂

quaint mantle
#

Can the download link for buildtools be organized because it so messy and not a lot of people can find there version of the server like for example 1.8 buildtools idek where is the link for 1.8 it only shows 1.16+

cinder thistle
quaint mantle
#

Just give the mobs that burn during the day a lether helmet or effect them with fire resistance i guess

#

Theres an other option by affecting it with fire res

quaint mantle
#

I've got a plugin that keeps track of specially named chests that I'm looking to remove from the list when the chunk unloads. The problem is that something about removing chests in this function loads the chunk (and thus, all of the chests again). Am I missing something? (This code is called during ChunkUnloadEvent)

public static void RemoveChestsFromChunk(Chunk c) { 
  int X = c.getX();
  int Z = c.getZ();
  for(int i = 0; i < Chests.size(); i++) {
    DisposalChest dc = Chests.get(i);
    Location L = dc.getLocation();
    int oX = X * 16;
    int oZ = Z * 16;
    if(L.getX() >= oX && L.getX() <= oX + 16.0
      && L.getZ() >= oZ && L.getZ() <= oZ + 16.0) {
        plugin.getLogger().info("Removing chest at CHUNK=("+X+","+Z+")");
        //very simple wrapper for arraylist.remove()
        RemoveChest(dc);
      }
  } 
}
#

Event calling code, if it helps.

  @EventHandler
  public void onChunkUnload(ChunkUnloadEvent event) {
    DisposalChestManager.RemoveChestsFromChunk(event.getChunk());
  }
cinder thistle
#

Ignoring the question and just telling them to use a subjectively better IDE

#

It’s all too common

sullen marlin
#

?kick @idle pier

queen dragonBOT
#

👢 Kicked Vladimir02#6698

cinder thistle
#

Damn md out here

quaint mantle
#

Is there a way for me to check if a block is in a chunk without loading it?

random epoch
#

Damn dude I don’t think he was at fault

cinder thistle
#

You could cache your block locations and what chunk their in (coords or smth)

random epoch
#

Poor dude was just sharing his opinion

cinder thistle
#

That way you can check without actually interacting with the world

cinder thistle
quaint mantle
#

(like manually store coords in a vector3 or something

cinder thistle
#

Yeah, manually

#

Sever all ties to the world other than yk the event

#

See if that works

#

No guarantees

quaint mantle
#

I'll give it a shot, thanks!

#

Hi, I am trying to execute commands when a user clicks an item and my problem is that when they do it it does not register when the user clicks in the air, does anyone know how I can solve it?

summer scroll
#

And also, show your code.

quaint mantle
summer scroll
quaint mantle
#

yes

summer scroll
#

your best bet is maybe try to debug it.

#

debug the action.

quaint mantle
#

I tried but the code does not run

summer scroll
#

how are you registering the event?

#

is the event registered?

quaint mantle
summer scroll
#

is the event getting fired?

#

try to debug to see if the event is registered or something.

quaint mantle
#

The event is executed but the problem is when the user clicks with the item in the air

summer scroll
quaint mantle
#

oh 😦

#

thx

young knoll
#

Probably PlayerInteractEntity

eternal oxide
#

Do you mean in an anvil?

#

I don;t see a specific event for that. You could check the interact event

#

yep

sage swift
#

is it possible to set or get the ItemStack of a Trident projectile?

eternal oxide
#

when in flight it is an entity

#

in hand/inventory its an ItemStack. Uses a standard Material

sage swift
#

well yes, but it must have information about itself stored in the Entity somehow

#

otherwise how does it show as enchanted or not

eternal oxide
#

the ItemStack version and the Entity version are independent of each other. There is no relation between them. Data does not transfer from one to another

sage swift
#

no, ThrowableProjectile interface has setItem and getItem

eternal oxide
#

Thats just the object you see when its in flight

sage swift
#

how does it know what to give you when you pick it back up, then?

eternal oxide
#

I would assume it would give you the item you set or a default ItemStack

#

I'd not actually thought about the pickup

sage swift
#

interesting, using setItem does actually change what you pick up, but it does not change whether the trident entity is enchanted while flying through the air

eternal oxide
#

If you launch an enchanted Trident does it show as an Enchanted trident in flight?

sage swift
#

if i myself launch it, yes

#

but if i ProjectileSource#launch and then setItem to enchanted, it does not

eternal oxide
#

Yet after setItem you can pickup whatever item you set

#

odd that only LaunchProjectile(Class) is exposed then

#

I'd have expected one to accept an ItemStack

sage swift
#

i assume it's because it sends the packet from launchProjectile, and does not update when the item is changed

#

but it does affect the damage the item does, so that's good

quaint mantle
eternal oxide
#

Um, you are checking every player on the server for the permissions when anyone clicks an Inveentory

#

If there is anyone without the permission the event exits

#

or if DisableItemMove is false it also exits

#

playerss is already a Player so you don;t need to call .getPlayer()

#

You are adding the players UUID to your player list, then attempting to fetch the player by name later.

#

Sorry but theres probably not a single line of that that is correct 😦

quaint mantle
#

Thanks 🙂 I'll get on that

quaint mantle
#

Indeed I was adding player uuid to the player array list and used the getPlayer by uuid and not by getPlayer "name" I assumed that that would work

stray halo
#

Hello, i would like to know in what ways i could create a "magic wand". Like just a stick that shoots out some particles in the direction i'm looking and when they hit an entity it takes damage

#

i just want to know how i could create the magic part

eternal oxide
#

There are two ways to do it...

#

either launch a disguised projectile and spawn particles on a timer, if you have to have a particle effect.

#

or raytrace the path of the projectile and spawn particles and deal with hits manually.

#

teh simplest one is the disguised projectile

stray halo
#

yeah, also cause i want it to be like i snowball, i mean i want it to go down with time and not it going only straight

#

would i disguise the projectile with packets?

eternal oxide
#

launch the Snowball and setItem to air.
At the same time start a timer to spawn a particle at the location of the Snowball entity.
stop the timer and remove the projectile on hit

stray halo
#

i didnt understand well the first part... Wdym for setting item to air?

eternal oxide
#

when you use launchProjectile you get a Snowball Entity. That entity has a method for setItem(ItemStack)

stray halo
#

You mean like the "display item"?

#

Like instead of a snowball i could display sth else?

eternal oxide
#

you should be able to setItem(new ItemStack(Material.AIR))

#

that would make the snowball invisible

stray halo
#

And the hitbox remains the same right?

eternal oxide
#

yes, its still a projectile

stray halo
#

i see now, thx a lot

#

i'll let you know if i encounter any issue

stray halo
#

@eternal oxide this is the code for the snowball
Snowball ball = player.launchProjectile(Snowball.class);
ball.setItem(new ItemStack(Material.AIR));

but it still displays as a normal snowball

quiet ice
#

Do you want to hide the snowball?

eternal oxide
#

He does

stray halo
#

yep

#

i thought using packets, but if there is any easier way its better

eternal oxide
#

I thought setting the item as it works for other itemstacks but I guess AIR is not one of them

stray halo
#

i just tried putting a diamond and it worked, so yeah i think air doesn't work

eternal oxide
#

Yep, I did this for egg spawning yesterday so I know actual items work

#

testing something

quiet ice
#

Looking at the javadocs I cannot find anything that might help here

stray halo
#

would packetplayoutentitydestroy work?

#

like destroying the ball for the player?

#

I'm not that good with packets so idk

maiden briar
dusty herald
#

reviews look genuine, why do you think they're faked?

quiet ice
dusty herald
#

why would someone fake a review and downloads thonk

maiden briar
chrome beacon
maiden briar
#

And how can I get in 1 day 1700 downloads?

stray halo
dusty herald
#

🤷 I suggest contacting support

#

?support

queen dragonBOT
dusty herald
#

technical support here for your needs

maiden briar
#

And they were all placed on the same timestamp (20:00), and the accounts were also created on that time, and data

stray halo
#

I DID IT

maiden briar
stray halo
#

my idea worked

dusty herald
#

nvm i

eternal oxide
#

what worked?

#

packets?

stray halo
#

Player player = event.getPlayer();
Snowball ball = player.launchProjectile(Snowball.class);
EntitySnowball e = ((CraftSnowball)ball).getHandle();
((CraftPlayer)player).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityDestroy(e.getId()));

stray halo
quiet ice
#

I'm not entirely sure, it might work

eternal oxide
#

You will have to recompile that every version

stray halo
#

wdym?

quiet ice
#

You need to use reflections (jk, even though that is an option)

dusty herald
#

plugin.getConfig().getString("storage.spy").equals("true")

eternal oxide
#

does that not have version specific imports?

stray halo
#

yes

#

but i just use it in a 1.16 server

#

i don't need other version

quiet ice
#

Think of the future!

dusty herald
#

also @maiden briar in your plugin.yml you don't need

softdepend:
   - tvheeAPI``` because you already loadbefore it, and checking for it onEnable is useless because it will crash without the plugin being installed
stray halo
# quiet ice Think of the future!

i'll just change it when important versions come out, its just a server with me and my friends, i won't share the plugin with others

maiden briar
#

Ok thanks

#

I am also planning to use maven for this

stray halo
dusty herald
#

maven is nice

maiden briar
#

That is ment with "clean start"

maiden briar
#

Thanks for the help 😄

#

Because I want to play fair with downloads

quiet ice
#

though why would one want to fake good reviews and downloads on your resources?

opal juniper
#

Is there like a Block#isPlaceable or Material#IsPlaceable

#

To check it can be placed?

quiet ice
#

Material#isSolid

#

Or Material#isBlock

opal juniper
#

Ok, thanks

fading lake
quiet ice
#

exactly my question, why would anyone break the rules for something that does not help them in any way

maiden briar
fading lake
maiden briar
#

Yes

fading lake
#

its probably illegal too

quiet ice
#

But he has not faked it according to him

maiden briar
#

And creating more accounts also illegal?

real vapor
#

Check rule 11. Without permission to do so, they will get banned.

vivid cave
#

does synchronized keyword ensure that a method can only be run ONCE at the same time?

#

(while being potentially invoked from different threads at the same time)

#

i know synchronized is not only about it, but is my statement a consequence of the whole process of synchronised stuff

eternal oxide
#

synchronized means only one Thread can access the method at once.

#

IF its on the method and not inside it

lost matrix
desert turret
#

Got a really annoying problem that makes no sense - I'm starting a recurring BukkitTask in order to display particle effects and storing it as a field, but when I try to cancel this task using the built-in cancel() method, nothing happens

particlesTask = Bukkit.getScheduler().runTaskTimer(plugin, () -> {
  // content
}, 20L, 20L);
//
public void stopParticlesTask() {
  if (particlesTask != null)
  particlesTask.cancel();
}
quaint mantle
#

If I use player.getWorld().spawnEntity(location, EntityType.ENDER_DRAGON); is it normal that the dragon just floats and does nothing in world ?

lost matrix
desert turret
#

yeah I'm sure the method is called

#

The weird thing is it worked once when I manually started the task. When it auto starts from a onEnable() method, I can't turn it off though

lost matrix
#

If the method is called then the task is cancelled

#

Did you make sure that you are using the same instance?

desert turret
#

yep

#

I also ran the .isCancelled() aftewards and the output was false though

lost matrix
#
public void stopParticlesTask() {
  if (particlesTask != null) {
    particlesTask.cancel();
    System.out.println("Task is cancelled.");
  }
}

Use this code and make sure again pls.

desert turret
#

ok one sec

lost matrix
desert turret
#

at least 20 ticks after

#

cos I typed the command

lost matrix
#

Ok

desert turret
#

the boolean is the isCancelled() method

lost matrix
#

Then the task is cancelled.
Output the task id in your cancellation and in your command

desert turret
#

0 is the task ID

#

I've also tried doing cancel task by ID method and still nothing

lost matrix
#

Makes no sense. What version are you on?

desert turret
#

1.12.2 but It's happened to me on 1.15 as well

#

or 1.16

lost matrix
#

And the task doesnt start again afterwards?

desert turret
#

no

#

when I run the start command the ID is the same

ivory sleet
#

maybe show more code

lost matrix
#

Yeah. What you described is not possible. We need more code.

desert turret
#

what more is needed?

#

the contents?

ivory sleet
#

What about sending that entire class?

#

It would surely give smile more meat on his legs to help you

lost matrix
#

Preferably all methods that modify the particlesTask field.
And the surrounding class of that field.

ivory sleet
#

?paste You can put it here 🙂

queen dragonBOT
lost matrix
ivory sleet
#

No I just made that up from my native language

#

lol

lost matrix
#

lul

desert turret
#

I can paste more but it's not really that helpful

ivory sleet
#

Its better than nothing still

desert turret
#

this is literally the rest of that start method:

    public void startParticlesTask() {
        if (particlesTask != null) {
            particlesTask.cancel();
        }
#

In case a task is already running, I cancel it, that's all

#

this is the field:

    public BukkitTask particlesTask;```
ivory sleet
#

I mean if the task is already cancelled then you can't cancel it again

desert turret
#

it's not cancelled though

ivory sleet
#

just showing us the field wont help either

#

send the entire class

#

wont bully you

desert turret
#

it's got confidential stuff on it unfortunately

#

but I can tell you nothing else affects that method

ivory sleet
#

confidential like what?

#

just censor it or remove it in the paste

lost matrix
#

"confidential stuff"
Thats something you should extract into a config file and never hard code.

desert turret
#

no... as in the code itself is the core of a minigame plugin

#

I could create a brand new plugin with just that method and it wouldn't cancel

#

it's happened to anothoer plugin of mine as well

ivory sleet
#

how are we suppose to help your ass now? I mean if you don't share what could be potential issue factors then it's implausible that we can help you tbf.

eternal oxide
#

There has to be something you are not telling us. What you have shown is impossible to not work.

desert turret
#

well I've already said nothing else in the class affects that method

eternal oxide
#

OK, you codes working then. Problem solved

ivory sleet
#

And don't be a fool thinking your code is the ultimate product such that you're scared of getting it hijacked here by sharing it.

desert turret
#

the wording of the javadocs seems to suggest cancellation isn't guaranteed

vivid cave
#

thanks @lost matrix and @eternal oxide so much for ur answers :3

desert turret
#

"will attempt to cancel this task"

lost matrix
# desert turret the wording of the javadocs seems to suggest cancellation isn't guaranteed
public class SpigotCore extends JavaPlugin implements Listener {

  private BukkitTask task;

  @Override
  public void onEnable() {
    this.task = Bukkit.getScheduler().runTaskTimer(this, () -> System.out.println("TEST"), 30, 30);
    Bukkit.getPluginManager().registerEvents(this, this);
  }

  @EventHandler
  public void onJoin(final PlayerJoinEvent event) {
    this.task.cancel();
  }

}

Just tested this. Works fine.

ivory sleet
lost matrix
desert turret
#

yeah

ivory sleet
#

but yes that javadoc is somewhat ambiguous

lost matrix
#

Its a particle task right?

eternal oxide
#

We only support Spigot here. Not forks.

lost matrix
#

Yes they matter in some very specific occasion. I thoght that the task could be async and somehow blocks. Then it would never exit the current run method and therefore could also not be cancelled.
But im just guessing because i dont have more information...

desert turret
#

can I dm you the contents?

lost matrix
#

Sure

vivid cave
#

is a way to annotate an object without the @

outer crane
#

papermc doesent mess with tasks on the latest builds too bad, likley not broken but as always try to develop on spigot here or ask in paper-help

lost matrix
quiet ice
#

Probably with ASM hacks

vivid cave
outer crane
#

that sounds cool

quiet ice
#

Then finding an alternative is your best option, otherwise you'd need grotesque ASM hacks (which may require a custom server)

lost matrix
#

@ivory sleet @eternal oxide Is a runnable that reads files on the main thread every second worth stealing?
Im thinking about writing a minigame that runs entirely on files from the hard drive. ^^

The problem was that he had two different instances of its surrounding class with obsly two different instances of a task.

eternal oxide
#

oh god no.

young knoll
#

I mean

#

That sounds like an interesting challenge

ivory sleet
#

Oh well then we can conclude the spigot API isn't broken at the very least and yeah let alone your idea sounds intriguing

lost matrix
#

But at least its persistent...

young knoll
#

Write an entire plugin in 1 line

lost matrix
#
public class SpigotCore extends JavaPlugin implements Listener { @Override public void onEnable() { Bukkit.getPluginManager().registerEvents(this, this); }@EventHandler public void onBreak(final BlockBreakEvent event) { final Material type = event.getBlock().getType();if (type == Material.STONE) { event.getPlayer().damage(1); } }}

A plugin that punishes a user for digging stone blocks...

eternal oxide
#

now strip the whitespace too

lost matrix
#

Btw why arent there like monthly Spigot challenges? The Java discord has those and i can imagine that it would be fun in Spigot too.

rotund ravine
#

Cause we’re lazy

#

And so are the mods

quiet ice
#

And everyone else

clever sapphire
#

does anyone here knows but I can go down lines when I write a config file with code

#

I tried doing this newConfig.set(" ", "\n");

#

doesn't work

#

I want to like have one line spaces between some lines

eternal oxide
#

You can not insert blank lines in the config

clever sapphire
#

yayiks

#

and I assume there is no way to keep comments as well

opaque grove
#

Any similar to /fill command for plugins without we api, just want to fill 40 blocks

young knoll
#

Nested for loops

lost matrix
lost matrix
# opaque grove Any similar to /fill command for plugins without we api, just want to fill 40 bl...

I use BoundingBoxes for stuff like that. Some util method:

  public static void forEachBlockInBox(final BoundingBox box, final World world, final Consumer<Block> blockConsumer) {
    for (int x = (int) box.getMinX(); x <= (int) box.getMaxX() - 1; x++) {
      for (int y = (int) box.getMinY(); y <= (int) box.getMaxY() - 1; y++) {
        for (int z = (int) box.getMinZ(); z <= (int) box.getMaxZ() - 1; z++) {
          blockConsumer.accept(world.getBlockAt(x, y, z));
        }
      }
    }
  }

Because a BoundingBox can easily be created using two Blocks as corners.

quaint mantle
#

I know I can create custom items with datapacks but I would like to do it using a plugin, because later I want to program an Event that would occur on that specific item.

#

can u like add a specific tag to an ItemStack?

#

and then identify it?

lost matrix
quaint mantle
lost matrix
#

Identification should be done via the PersistentDataContainer

quaint mantle
#

why does it says /island help
when I try to do /is create

quaint mantle
lost matrix
quaint mantle
#

-_-

lost matrix
#

Its a whole key-value store inside your ItemStack. So more like HashMap with arbitrary types.

lost matrix
quaint mantle
#

also, can u add a specific modelid that it would take from a resourcepack?

lost matrix
#

You can set the model id and your resourcepack then defines how items with that model id are displayed. Your plugin cant detect certain ids from the resourcepack because it has no access to it.
(Unless you let the plugin assemble and define the resourcepack based on your code)

quaint mantle
lost matrix
quaint mantle
#

Was that a typo for Json or an actual thing?

lost matrix
#

Googles json library. If you have never worked with Gson or Jackson then you have bad cards at assembling a resourcepack from your plugin.

queen nacelle
#

Wait wait, are you some how sending a resource pack via plugin to the client and loading it without having the pack install?

quaint mantle
queen nacelle
#

Yeah I was gonna say not a thing

quaint mantle
#

No

#

the client automatically downloads the resourcepack from the server

#

otherwise there's no other way

queen nacelle
#

Yeah, so you guys are just making a pack with the plugin

quaint mantle
#

Yes

queen nacelle
#

Like generating the files

lost matrix
quaint mantle
lost matrix
#

And also generate the plugin on server startup

queen nacelle
#

You can disconnect them

lost matrix
paper geode
#

yep

quaint mantle
lost matrix
#

In 1.17 this will change partyparrot

queen nacelle
#

Oh?

#

What is changing in 1.17

quaint mantle
paper geode
#

good way

#

for the server

quaint mantle
#

Explain

queen nacelle
#

Do we get access to model data for entities and blocks finally

paper geode
#

afaik the server can force it?

lost matrix
#

In 1.17 you can make resourcepacks a hard dependency for clients to connect.

queen nacelle
#

Reallyyy

paper geode
lost matrix
queen nacelle
#

Your prob gonna need protocol lib for packets

#

I hate typing on phones

lost matrix
#

There is an event for the resourcepack interaction. So no packets needed 😄

queen nacelle
#

Is there really?

#

Damn been a hot minute since I've messed with resource packs

quaint mantle
#

@lost matrix Cant I just add a specific nbt tag? Wouldnt that be easier than persistent data storage?

queen nacelle
#

That is nbt

queen nacelle
#

Buttt

quaint mantle
#

Really?

#

oops

queen nacelle
#

You can grab custom model data with ItemStack#getItemMeta

quaint mantle
queen nacelle
#

There are getters and setters in meta

#

It doesn't need a path

#

You just gotta configure the pack correctly

#

The server can't grab paths on the client's machine

quaint mantle
#

true tho

#

Is there player right click event?

#

or event better right click event for specific item?

quiet ice
#

player interact event?

quaint mantle
quiet ice
#

Not just that

#

It applies to all right click/pressing for both hands, whether directed on air or on a block

quaint mantle
#

So it counts as both right click and left click?

quaint mantle
sage swift
#

left click counts main hand only, right click fires for both hands separately

quaint mantle
#

Cool

quiet ice
#

I don't think that it fires for left click

quaint mantle
#

it has what I need

sage swift
#

It does

#

Action can be left/right click block/air

quaint mantle
#

Oh no

quaint mantle
#

thats bad it must not be air, ill create a switch so air does nothing

quiet ice
#

You can do a switch with #getAction and use #hasBlock

quaint mantle
#

Yes

#

exactly

sage swift
#

if (Action != Action.RIGHT_CLICK_BLOCK) return;

quaint mantle
#

Thats actually better

sage swift
#

if (hand != EquipmentSlot.MAIN_HAND) return;

quaint mantle
quiet ice
#

Well yes, otherwise it may fire twice

quaint mantle
#

Oh

#

But why?

#

Oh

#

now I understand u

#

Whats an item that cant be used for anything? U cant craft with it, u cant use it, u know what I mean?

quiet ice
#

air likely

quaint mantle
#

Something u can hold

#

like an actual item

quiet ice
#

probably trophies like the ender dragon head, though you can wear that, so I do not really know

#

Most things in minecraft serve a purpose

quaint mantle
#

I tought about shears, and just make them unbreakable

frosty mauve
#

Hey,everyone,I wonder know if there is the BungeeCord expend the player join (handshake) protocol to save the real ip of the player?

quiet ice
#

Bungeecord can do that already

#

I think

frosty mauve
#

yeah,I heard that from my friend,and I want to know more imformation about it.

wanton rampart
#

Anyone know the api elements that handle mob spawning and limits? I want to code in a per player mobs system that has a global cap still

pliant depot
#

Does anyone know any plugins that allow to like click one item over another item to make another item. Or anyone wanna make a custom plugin that kinda does this.

If this doesn't make sense:

-> Item 1, third slot
-> Drag item2 to into third slot
-> deltes both items
-> Gives the third item that you make it give
Item Merge kinda thing

Just because i want to make it so you can combind two T1 pickaxes into a T2

opal sluice
#

Hi, I don't understand why I have a ConcurrentModificationException on line 3 here :/

quiet ice
#

You are modifying the list while you iterate over it

opal sluice
#

I use iterator, and iterator remove function to avoid that but still saying that there is a problem :/

quiet ice
#

As a workaround you can clone the list

#

Though that will have some implications

opal sluice
#

Yeah, I understand, but which one I do change ?

#

The entity one ?

#

or it means the iterator ?

#

The error line is so confusing

quiet ice
#

What is the type of oldChunks?

opal sluice
#

A list of course

#

but I do get the list and transform it as an iterator

quiet ice
#

Like, implementation type, some lists behave differently

opal sluice
#

and I do it.remove() to remove an item from the iterator

#

ArrayList<>()

#

which implements List<>

quiet ice
#

Other way around

#

List is an interface, Arraylist is a class

opal sluice
#

yeah

#

sorry lol

quiet ice
#

But yeah, that one should work, do you have two threads accessing it or no?

opal sluice
#

Normally no

#

It's a timed runnable

#

But when it enters in this condition case

#

It set a boolean as true

#

so it can't go in even if the next run should go in

torn shuttle
#

so I got something really interesting reported to me

quiet ice
#

Honestly, I do not see anything wrong with the code with the knowledge that I have as of now

opal sluice
#

maybe with the full run function that will be better

torn shuttle
#

you said a cme?

minor garnet
#

is there a way to define the player's chat without the chat movements going up or down? to make a system similar to a nickname with raibown

chrome beacon
#

No. You need a mod for that

dusty herald
#

nvm I'm blind

bold parcel
#

whats the best way to convert a HashMap<String, Object> to a ConfigurationSection?

dusty herald
#

just loop through the entry set and check to see if it's a path

#

then do your thing

tribal sparrow
#

how would i get the center of a location, i've tried location.add(x > 0 ? 0.5 : -0.5, 0.0, z > 0 ? 0.5 : -0.5); which i found on google but that gets the corner of the location

dusty herald
#

Config#get(path, object)

pliant depot
#

Anyone, uhh, wanna code me a custom plugin as i don't know how to code this stuff

dusty herald
#

what is it

unreal quartz
#

i can make you hello world plugin for $5

pliant depot
#

2 things, you can just do one if u want:

1:
Pickaxe stat stuff

2:
The merge thing i was on about

dusty herald
#

I can do it for 6 /s

pliant depot
#

....

opal sluice
#

I don't understand 😢

#

It always stop at "Crash #3" (line 32)

quiet ice
#

Probably has to do with the iterator#remove operation, but that should not be the issue, usually

opal sluice
#

It doesn't even enter

#

It stops at it.next()

#

how the .next modifies the iterators

#

I don't understand 😢

#

Oh

#

Whe can't modifies the list that the iterator comes from

#

Well... still it should work..

#

I'm not changing it in any way x)

#

Oh wait I think I got it !

queen nacelle
#

take a deep copy of your list iterate through copy remove from the main list

opal sluice
#

That's what I though I was doing

queen nacelle
#

assuming your list isnt just primitives

#

huh weird

opal sluice
#

but the list was the .getValues

#

And I think I maybe modifies it

#

Uh. No

#

I don't

queen nacelle
#

good god of for loops

opal sluice
#

Ok I got it ^^'

#

There was a little modification AFTER the iterator has finished

#

but still you can't ? Idk but it works now x)

eternal oxide
#

Thats not how you use an iterator

opal sluice
eternal oxide
#

for(Iterator<String> it = oldChunksIterator.iterator(); it.hasNext();)

#

Thats wrong

opal sluice
#

Mmmh That's not wrong

#

That's even a good practice

#

doing While(iterator#hasNext)

eternal oxide
#

Thats defiitely wrong

opal sluice
#

Wait I read it somewhere

#

Let me find it x)

#

(maybe I misunderstood)

eternal oxide
#
Iterator<String> it = oldChunksIterator.iterator();
while (it.hasNext()) {
  String oldChunkCoords = it.next();
  ...
}```
opal sluice
#

Yeah I know we can do that ^^

eternal oxide
#

your For loop is looking for an Iterator in it.hasNext()

#

its looking for a collection

opal sluice
#

?

eternal oxide
#

Well, it so hard to explain, its wrong

opal sluice
#

hmm not sure to understand the collection part, the for loop syntax is pretty clear

#

for(instanciation of vars; condition; do something after loop)

eternal oxide
#

I have never ever seen an iterator in a for loop and I'm 99.9% certain that will not work

#

well... um, its possible it will work, but extremely weird and a very odd use case.

opal sluice
#

I swear, there is a reason I do use it instead of the while

#

I can't find where I read it 😢

eternal oxide
#

YOu seem to be use an awful lot of maps, reason being?

#

is this a simple chunk regen?

opal sluice
#

A timed auto chunk regen

#

with a redundancy check

eternal oxide
#

Explain, when a block is broken after X amount of time it will regen?

opal sluice
#

When a block is broken in a chunk

#

the chunk is flagged

#

after the time, it place it in the "bin pending" (oldchunks)

#

and then, if the flag as reappeared, it doesn't regen

#

which is the redundancy part

eternal oxide
#

are you doing any ignoring for player placed chunks?

opal sluice
#

wdym by player placed chunks ?

#

like a whitelist ?

eternal oxide
#

Player places a diamond block, mines it and that will trigger your chunk regen?

opal sluice
#

yeah basically

eternal oxide
#

will it then regen the diamond block?

opal sluice
#

Oh no

#

The original chunk

#

from the world seed

eternal oxide
#

using worldedits regen?

opal sluice
#

Using FAWE

#

So yes WE

#

At first I thought about "deleting" the chunk data from the region file

#

But that's a bit risky to mess with files

eternal oxide
#

very

opal sluice
#

So, I moved over this method even if it's slower x)

#

OH

#

I REMEMBER WHY

#

The for loop is better cause it's confined

#

the while loop is not

#

That's something like that

eternal oxide
#

confined?

opal sluice
#

yeah

#

So, all the iterator operations

eternal oxide
#

well the Iterator reference is only within the for loop scope, but thats all

opal sluice
#

are only in the for loop

#

that's it

dusty herald
#

I don't like to use iterators that much Sadge

#

I use them in sql but that's about it

eternal oxide
#

This system seems very OTT.

quiet ice
#

You use them for for (Object o : iterable)-loops, if you want it or not

opal sluice
plain scroll
#

Whats the best way to start making plugins? ) 1.16.5 )

quiet ice
dusty herald
#

E c l I ps s

#

that page is gone

plain scroll
#

i have it?

dusty herald
opal sluice
plain scroll
dusty herald
#

have what the page?

plain scroll
dusty herald
#

stinky mobile

quiet ice
#

probably due to my semicolon

dusty herald
#

how could you betray me like this

quiet ice
#

But do not worry, an IntelliJ page is worked on

eternal oxide
opal sluice
#

That would be even worse if I would log each block and regen it one by one

eternal oxide
#

better than 25,600 blocks checked everytime you decide to regen a chunk

opal sluice
#

The chunk is only flagged, it will regen it anyway

#

it doesn't check for the blocks in the chunk

eternal oxide
#

FAWE will check that many blocks with its area regen

opal sluice
#

Oh, yeah maybe

eternal oxide
#

if you store only the changes you can easily and quickly undo them.

opal sluice
#

That would require to check for each block modified even by explosions/fire

eternal oxide
#

yes

opal sluice
#

and save them

eternal oxide
#

I would think that faster than checkign 25,600 every time you regen

opal sluice
#

The question is, can we get all the blocks modified

eternal oxide
#

You can even do it without FAWE

opal sluice
#

Yeah sure

eternal oxide
#

you can ignore player placed blocks if they are in a location already flagged for regen

#

Yours method is simpler for your tracking I guess. Just throw it at FAWE and tell it to regen

#

I've nto looked at FAWE so I've no idea how accurate its regen is

opal sluice
#

It's lighter also in db

lost matrix
#

Regenerating chunks with WE is not supported anymore i thought

#

Whats the problem anyways

eternal oxide
#

His code is messy and bloated.

#

Just talkign of alternate ways

lost matrix
#

Of doing what? (Just came here ^^)

eternal oxide
#

undoing changes made to chunks

opal sluice
eternal oxide
eternal oxide
#

Thats his current code

#

Its why I'm advising to track all block changes and manually undo rather than FAWE chunk regen

opal sluice
#

I swear I'll rework it 😂

lost matrix
#

Is it a chunk based claiming system?

opal sluice
#

It support chunks claims

#

But it doesn't claim

#

It juste regen chunks after a while

lost matrix
#

Wait. You are actually checking all the chunks at once.

opal sluice
#

?

eternal oxide
#

He seems to push a location to a temporary map, then after X amount of time it is moved into regen.

opal sluice
#

That's it

eternal oxide
#

Then I got lost with all his maps and code 😛

opal sluice
#

Well it's not that "messy"

#

Ok, there are a lot of maps 😂

#

And with comments, that would be easier to understand

lost matrix
#

Oh and the String abuse... Why not make a simple ChunkCoordIntPair class that encapsulates x and z and can be serialized to a String.
This prevents a lot of expensive String parsing on runtime.

I mean...

lost matrix
opal sluice
#

Commenting your code to know what does what it's a sign of failure ?

lost matrix
#

Code should be self documenting. You should be able to look at it and read it like a story so you know exactly whats happening.

opal sluice
#

HAHAHAHA

lost matrix
#

You can achieve that by extracting tons of new methods with meaningful names and properly named variables and fields.

opal sluice
#

That's obvious

#

And that's what my teachers also say

#

You can't just leave a code

dusty herald
#

I have my JavaDocs but that's about it

opal sluice
#

come back in 6 month

#

and "Oh yeah, this calculation is for that"

eternal oxide
#

I love comments

opal sluice
#

You MUST comment you code :/

dusty herald
#

ok let me show you something since u love comments

olive lance
#

So I have a feature that gives people wearing certain armor pieces certain effects and right now I’m checking every players armor on repeat would it happen less if I just checked on an inventoryclickevent? Also would that trigger when right clicking armor to equip

eternal oxide
#

comment like you are going to come back to the code later with dementia.

dusty herald
opal sluice
#

Here it's a draft so it doesn't have any cause I don't really need them

lost matrix
opal sluice
#

Wow...

dusty herald
#

is that enough comments for you ElgarL?

opal sluice
#

You don't have to comment each line of code, of course

#

But you need to put comments

#

That's a fact

dusty herald
#

yes you do

eternal oxide
dusty herald
#

it's either all comments or no comments

opal sluice
#

or you never worked with a team @lost matrix

#

No comments is like trying to be in the mind of the dev at the moment he code it

eternal oxide
ancient plank
#

I'd show my comments but my code is ass

dusty herald
#

crap.

#

since I keep my shit open source and I like to keep some of my shit organized I have a bit of commenting but it's what I prefer

eternal oxide
lost matrix
# opal sluice That's a fact

Its not. Read "clean code" from Bob Martin.
Commenting code is so pre 1990.
I have worked at several companies that wrote Java Enterprise code for Audi, John Deere, Mercedes and some more non automotive companies.
Every single one that didnt cripple themselves with old principles and tools like excel and Pascal based systems used modern concepts like delf-documenting code.

eternal oxide
#

I was born in the 60's so I comment.

opal sluice
ancient plank
#

I use comments because they help me remember what I was doing yesterday kekeke

lost matrix
#

I dont need comments because my code actually tells me what it is actually doing...

quiet ice
#

I usually go overdrive with javadocs, normal comments are rarely seen at my code

opal sluice
eternal oxide
#

until you have a stroke and forget how to format a for loop

ancient plank
quaint mantle
#

Imagine gate keeping good code because it has comments 👏, if you can understand your own code that's fucking fantastic but not everyone has the same mindset as you

wicked shale
#

^

lost matrix
#

There is usually a high correlation between bad code and code with a lot of comments. This is the most obvious sign of messy source code.

quaint mantle
#

If you want to keep your shit peer friendly comments are the way to go

quiet ice
#

Then there are javadocs, good javadocs indicate at least decent api

#

Without javadocs no good api can be built on

lost matrix
ancient plank
#

good javadocs yeah? ass-pressure

dusty herald
#

ade that is amazing

#

link me

ancient plank
dusty herald
#

wait what

quiet ice
#

yes, that is bukkit javadoc

#

has always been there

paper viper
#

"ass-pressure"

ancient plank
#

lmfao

paper viper
#

I like to ass-pressure while programming!

quiet ice
#

At least better than that abortion joke in the glibc manpage for the abort method (or something like that, idk what it really was about)

opal sluice
paper viper
#

I have to agree with ZeTioZ here. Sadly not everyone writes that code that way :/

#

Like people should do it. But do they?

#

Nope

lost matrix
# opal sluice That's actually, impossible :/

It is not. I was thrown into a huge project for John Deere with 9 people working on one repository. (Was a Quarkus mikro service architecture not a monolith) And was able to
pick up the code base in a week without much supervision. And they had not. a. single. comment. in there. The code was just written respecting modern clean code principles.

opal sluice
#

but you spent a week into figuring out the code

#

When with comments

#

you would take no time

#

if you can read

eternal oxide
#

I like clean code, comments and javadocs. I do all three 🙂

paper viper
#

Sometimes even with comments it takes time to digest, but at least you know what process is going on.

quaint mantle
#

You seem to have forgotten that most people here are hobbiests and not full blown Java developers

lost matrix
paper viper
#

he exaggerated it, but still yes it can help. Comments wont hurt

opal sluice
#

Yeah, it's not like

#

I read the comment, I know what it does

lost matrix
#

I dont... i have never seen commented code in any company ive worked with unless they provided exposed APIs

opal sluice
#

It does help to get into it

paper viper
#

its not about exposed APIs or not

#

unless ur the only person coding

opal sluice
#

Well, your companies like to lose money I guess ?

paper viper
#

there are still going to be other people who look at ur code. Ig you could explain it

#

Comments also can catch places where your logic may be wrong

#

sometimes even writing something can help identify major bugs

#

because hard coding is not good

#

In general, comments don't act as a way to hurt you. They are supposed to be advantageous

dusty herald
#

words from the magical developer of among us backdoor

paper viper
#

Shhhhh

dusty herald
#

I think I've made like 1 exe jar file before and that was when I was trying to port something from php to java to fuck around

paper viper
#

lmao

dusty herald
#

also why do people obfuscate open source code

#

or APIs

paper viper
#

thats kinda dumb

#

lol

#

just puts extra work on the contributers

lost matrix
dusty herald
#

// TODO: remove this comment

opal sluice
#

That's a non sense. Really.

paper viper
dusty herald
paper viper
#

yea lol

dusty herald
#

not enough comments tbh

lost matrix
paper viper
#

If I were to be fair, I don't actually put many many comments in my code, but rather focus on javadocs

dusty herald
#

that's what I do but I put it on things that don't need it

paper viper
#

Yea

dusty herald
#

did you ever make that release

paper viper
#

what release

#

the backdoor?

#

lol

dusty herald
#

yes

paper viper
#

Well I did. But the issue is how tf am i going to test it lmao

#

It would infect my own pc

#

I could use virtualbox

#

but like getting the jars back and forth lmao

deft sedge
#

How do I check what the player broke a block with when using the player Harvest Block event?

opal sluice
deft sedge
#

k thx

paper viper
#

np

lost matrix
paper viper
#

ok can you tell me what this method is doing

#

i didnt add comments to it

dusty herald
#

holy fuck

ancient plank
#

holy fuck

paper viper
#

This isn't "bad design". Notice the differentiations

ancient plank
#

It dither into minecraft's

paper viper
#

The reason of the conditionals within the loops is due to serpantine scanning

dusty herald
#

imagine trying to decipher raw NMS code 😳

#

scary

ancient plank
#

I've never messed with nms so

dusty herald
#

I've had to port NMS between 1.8 and latest

#

it's

paper viper
#

i had to read this document from the 1900s lol

dusty herald
#

heartbreaking

steep bay
#

How do you revoke all advancements from a player?

paper viper
#

AdvancementProgress

steep bay
#

that doesn't work

crisp iron
#

So im getting the entry with the highest key. Lets just say all the entries had the same value, will it just return a random entry then? or return null
https://paste.md-5.net/ehidimezaj.js

paper viper
#

Or does the method not exist

kind coral
#

is there a method to check if a block is a flower?

#

or do i need to make it myself

steep bay
dusty herald
#

get the material and compare it to a flower

paper viper
#

show me your full code

dusty herald
#

might need to make a switch statement between mats

steep bay
#

there's a nullpointerexception in line 71

kind coral
#

i was thinking about getting the name of the material and passing it trough an iteration

dusty herald
#

get the material type, compare it against enums of pre existing flowers and you should be set

#

no need for an iteration

paper viper
kind coral
#

like String str : new String[] {"poppy", "dandelion" } etc.

dusty herald
#

You could make an enum set of flowers

#

🤷‍♂️

paper viper
#

^

dusty herald
#

Flowers.valueOf(Material#getType)

#

throws an error if not in the enumset but I forgot which one

steep bay
eternal oxide
#

Tag.FLOWERS.isTagged(Material)

dusty herald
#

or that works

#

am on mobile rn

kind coral
dusty herald
kind coral
#

cooooooool

dusty herald
#

I've used them before for checking for tools DogKek

#

very nice

ancient plank
#

o:

#

this is a thing

dusty herald
#

yes

deft sedge
#

How do I make ceratain block that is broken not drop anything (I already have event handler and block detection set up)

dusty herald
#

BlockBreakEvent and clear the getDrops

eternal oxide
#

setYield(0) should stop drops

deft sedge
#

ok

crisp iron
#

So im getting the entry with the highest key. Lets just say all the entries had the same value, will it just return a random entry then? or return null
https://paste.md-5.net/ehidimezaj.js

deft sedge
#

and then after that how would I make it so that it just replaces the block back

dusty herald
#

just cancel the event and don't remove anything if that's what you plan on doing

kind coral
#

kinda strange

dusty herald
#

setYield(0) then like Elgar said

deft sedge
#

well I can't do that because basically what I'm trying to do is make it so that they have to break the block with a stone axe

dusty herald
#

you couldn't of told us that?

paper viper
#

please do not use .equals for enums

deft sedge
#

ok

kind coral
lost matrix
#

?pasze

#

?paste

queen dragonBOT
eternal oxide
deft sedge
#

i am in intelij

#

you have block break event

#

but the only event I could find for mine is PlayerHarvestBlockEvent

#

set drop items doesn't work for me

#

ok

deft sedge
#

nvm i see what happened

dusty herald
#

7smile7..

#

are those comments?

deft sedge
#

but if I were to use block break event, can I still get the player who broke the block?

dusty herald
#

yes

lost matrix
deft sedge
#

ok

dusty herald
#

tsk tsk tsk

#

for shame

deft sedge
#

ill do that

dusty herald
#

:)

lost matrix
#

This isnt clean code so... ;D

sour sand
#

is there a way to use an item stack in a recipie

#

rather than a material

lost matrix
#

Deprecated because its draft API

#

But you can still use it just fine

sour sand
#

so what i do RecipeChoice.ExactChoice.myitemstack

lost matrix
sour sand
#

o right ok

#

thanks

crisp iron
#

thanks @lost matrix

lost matrix
deft sedge
#

How do I have the block be replaced, but then still give them the item. I don't think I can use event.setCancelled(true); Because then it won't give them the item

lost matrix
#

But remember that the durability does not decrease if you cancel the event.

deft sedge
#

well that solves two problems

#

bc i don't want durability to go down

#

i'll do that, thanks!

south onyx
#

Bukkit.getWorld("world").getWorldBorder().setSize(150);

#

i need to set a world border of 150 by 150 blocks

#

will this work?

onyx shale
#

have you tried it instead of asking first though?

south onyx
#

im trying rn

onyx shale
#

should work as long as the center isnt messed up

deft sedge
#

This is going to sound stupid and complicated but here is what I want to do, I want to make it to where if a player presses a stone button, that is on a wall, it gets the player and teleports them to the other side of that wall, the reason I need to do this instead of using a simple cmd block is because A. I need to get the player's inventory who clicks on the button, and b I will have a lot of walls and I don't want to take the time to try to import a bunch of coordents I just wondered if something like this is possible, teleporting a player to the other side of the wall if a stone button on that wall is pressed. Is this a plausible thing, or is there a better way to do this

pliant depot
#

oH GOd

#

That's long

quaint mantle
eternal oxide
#

Yes, farily simple

pliant depot
#

I AM

deft sedge
#

Ik i'm sorry lol

pliant depot
#

LEAVE ME ALONE

weary geyser
#

what

quaint mantle
#

inb4 this kid becomes another yochran

pliant depot
#

...

weary geyser
#

....

lost matrix
quaint mantle
deft sedge
#

all because i wil make sure that there are no other buttons

pliant depot
#

Certain i guess

quaint mantle
#

pretty simple

eternal oxide
#

remembering players can place buttons

pliant depot
#

o

deft sedge
weary geyser
#

Does anyone know why I get a No usable constructor for Metadata error while getting a class from the DB? The metadata class looks like this (Morphia) ```public interface Metadata {

String getName();

}```

quaint mantle
#

well its an interface

eternal oxide
#

thats an interface not a class

weary geyser
#

*A class that implements that interface

deft sedge
quaint mantle
#

face

#

button is directional right?

lost matrix
deft sedge
#

ok

eternal oxide
weary geyser
#

It's with Morphia

deft sedge
lost matrix
weary geyser
#

Aha, so like they need to have an ObjectId etc?

quaint mantle
#

damn i was boutta spoonfeed

weary geyser
#

And implement serializable and stuff

quaint mantle
#

eh already wrote it all out

lost matrix
#

Also morphia should be able to automatically detect inheritance relations when you added the right package for classpath scanning.

lost matrix
dusty herald
#

What does your pfp say @weary geyser

quaint mantle
#
private final EnumSet<Material> buttonTypes = EnumSet.of(Material.STONE_BUTTON); // im not doing all of this

@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
    Block block = event.getBlock();
    if (block == null || !buttonTypes.contains(block.getType())) return;

    Directional button = (Directional) block.getBlockData();
    BlockFace face = button.getFacing().getOppositeFace();
    Block otherWallSide = block.getRelative(face).getRelative(face);

    if (block.getType() == Material.AIR) {
        e.getPlayer().teleport(block.getLocation());
    }
}

sorry for spoonfeed i just really wanted to make that

weary geyser
dusty herald
lost matrix
weary geyser
#

Oh I know, it says ":)"

quaint mantle
#

fine

#

is that the constructor?

#

havent used enumset in a while

lost matrix
#

EnumSet.of(Material.STONE_BUTTON); iirc

dusty herald
#

Tag.BUTTONS.isTagged(Material);

lost matrix
#

PlayerInteractEvent e

quaint mantle
#

i hate e

#

but i wasnt using an ide

#

im actually gonna test my code to see if im big brain

dusty herald
#

what do you normally use DogKek

lost matrix
#

All good ^^

quaint mantle
#

event

lost matrix
#

same

dusty herald
#

I like using e 😭

lost matrix
#

Single character variables are a bad habit. Idk where this comes from.

eternal oxide
#

It originated from only having registers

quaint mantle
#
import org.bukkit.Material;
import org.bukkit.Tag;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.Directional;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;

public class EventListenerTesting implements Listener {
    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent e) {
        Block block = e.getClickedBlock();
        if (block == null || !Tag.BUTTONS.isTagged(block.getType())) return;

        Directional button = (Directional) block.getBlockData();
        BlockFace face = button.getFacing().getOppositeFace();
        Block otherWallSide = block.getRelative(face).getRelative(face);

        if (block.getType() == Material.AIR) {
            e.getPlayer().teleport(otherWallSide.getLocation());
        }
    }
}
dusty herald
#

Just use Tags imagine

quaint mantle
#

k

dusty herald
#

good imagine

lost matrix
#

Eh. EnumSet is fine.

quaint mantle
#

dont reinvent the wheel right

dusty herald
#

let's reinvent the wheel

quaint mantle
#

weary geyser
#

let's make it cube shaped

quaint mantle
#

mb

lost matrix
#

public class ButtonCollection implements Collection<Material> and go!

weary geyser
#

Even better... public class ButtonCollection extends Object

lost matrix
#

I mean... every class extends Object.

weary geyser
#

I was only showing that it was nothing

lost matrix
#

So you dont have any work to do here.

weary geyser
#

¯_(ツ)_/¯

dusty herald
#

Imma steal that pfp sysdm thanks

#

I like the colors

weary geyser
#

Lmfao

quaint mantle
#
public abstract class $ extends Object
{
    //my comment.
}

i just gave you hatred

dusty herald
#

I hagecyihfh

weary geyser
#

ajw9o9dijaso

dusty herald
#

why.

weary geyser
#

I can't

quaint mantle
dusty herald
#

it should FeelsThinkingMan

sharp bough
#
    public void onRightClick(PlayerInteractEvent event){
        Player player = event.getPlayer();
        player.sendMessage("test");

        if(player.getInventory().getItemInMainHand().equals(Material.DIAMOND_PICKAXE)) {
            player.sendMessage("test1");
            if ((event.getAction().equals(Action.RIGHT_CLICK_AIR)) || (event.getAction().equals(Action.RIGHT_CLICK_BLOCK))) {
                player.sendMessage("test2");
                player.openInventory(openInv());
            }
        }
    }```
#

why isint that working?

#

test is working

quaint mantle
#

lmao

#

rookie mistake

sharp bough
#

ah

#

that bad?