#help-development

1 messages Β· Page 734 of 1

upper hazel
#

why

quaint mantle
#

I was always using IntelliJ. This is going to change

eternal oxide
#

you would be skipping every other item

upper hazel
#

oh now i see

#

i have list with size 2

#

this remove

#

end size 1

#

but index

#

not restart

#

i need restart index in for

#

hm

eternal oxide
#

what exactly are you trying to do in the loop?

upper hazel
#

put the button in a free slot in the inventory and create more inv if needed until the list of buttons is empty.

#

Simply put, create an auto-generated inventories for the list.

quaint mantle
#

Im gonna spend a day to learn this... πŸ˜‚

orchid gazelle
#

please, change to dark theme

upper hazel
#

remove object in list in for loop bad idea now i see

#

if for use list for loop

quaint mantle
#

Why is it underlined?

tepid turret
#

[HELP] Sending Lists Between Classes

quaint mantle
#

Guys... why does eclipse show me two sources?

glad prawn
#

u can delete if u want

quaint mantle
#

Okay the second one, I found it thanks

tepid turret
#

Ugh i'm still struggling here, How do I do dependency injection between 2 non main classes without creating new instances of them constantly

#

This is in my NON Main class

    public void onEnable() {
        new TaggingSystem(this.plugin, this);
    }
#

this is in TaggingSystem.java

#
package me.assailent.infancyminigames.tagging;

import me.assailent.infancyminigames.InfancyMinigames;
import org.bukkit.Bukkit;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import me.assailent.infancyminigames.tagging.TipQueue;

import javax.inject.Inject;
import java.util.List;

public class TaggingSystem implements Listener {

    public TipQueue tipqueue;
    public TaggingSystem(InfancyMinigames plugin, TipQueue tq) {
        Bukkit.getPluginManager().registerEvents(this, plugin);
        tipqueue = tq;
    }

    List<Player> tagList = tipqueue.getPlayerList();
    
    public void onTag(EntityDamageByEntityEvent entityEvent) {
        if (entityEvent.getDamager().getType() == EntityType.PLAYER & entityEvent.getEntity().getType() == EntityType.PLAYER) {
            if (tipqueue.isTipEnabled() & tagList.contains(entityEvent.getDamager()) & tipqueue.getInPlayer() == entityEvent.getDamager()) {
                        tipqueue.setInPlayer((Player) entityEvent.getEntity());
            }
        }
    }
}
#

shi think i got it to work lemme check tho

#

nope i didnt

#

lol

sharp cargo
#

Hello, I'm encountering a blockage.. Basically I would like when a player orders /furnacegui it returns all the items cooked in their inventory, but I don't know how to proceed.. Possible to get help ?

glad prawn
tepid turret
#

TipQueue is not my main instance

sharp cargo
#

setCancelled only works with true, false

tepid turret
#

They were saying that because most languages allow 0 + 1 aswell as true + false

glad prawn
tepid turret
glad prawn
hazy parrot
#

Yeah strong types, sad

#

Hate when I have to write 4 chars instead of 1

pseudo hazel
#

strong types is one of the best things about languages that have it

hazy parrot
pseudo hazel
#

you can refactor by breaking a bunch of things and then fixing it again until it works

tepid turret
#

Thats what i'm trying to avoid

pseudo hazel
#

of what class

tepid turret
#

Whislt staying in the same instance

pseudo hazel
#

what class is taht onEnable function in

#

everytime you do "new" it will create a new instance

tepid turret
#

Its old let me update code rq

pseudo hazel
#

so if you dont want new instances, dont use new, but use an existing reference to an object

tepid turret
#

how do i reference an object in another class?

pseudo hazel
#

well you need to pass it in with teh constructor probably

#

idk what your structure is like

tepid turret
#

here ill upload to paste-md-5 or whatever

pseudo hazel
#

yeah

#

like idk where this public void onEnable() { new TaggingSystem(this.plugin, this); } is at

tepid turret
tepid turret
#

but im still trying the same thing

pseudo hazel
#

okay

#

so what sthe problem right now

#

you are creating a tipqueue and taggingsystem in your main class

#

thats fine

#

and then you pass in the tipqueue in the tagging system constructor

glad prawn
#

i dont think he has any problems rn, he just wants re use TipQueue instance

pseudo hazel
#

thats how you are supposed to do it

#

yeah they already are, so its fine

tepid turret
#

It returns an error in console

glad prawn
#

wat error

tepid turret
#

says that in the TaggingSystem
this.tipqueue is null

#

line 22 is the problem

#
 List<Player> tagList = this.tipqueue.getPlayerList();
pseudo hazel
#

okay

#

so when is that line of code going to run

tepid turret
#

When the tagging system is initialised iirc

pseudo hazel
#

okay, well I guess its probably before the rest of the constructor is getting called

#

i.e. before tipqueue has been set

glad prawn
#

yes

pseudo hazel
#

try initializing it in the constructor instead

#

so you can know the order for sure

#

instead of guessing

#

and also like morice wanted to point out, use UUID instead of references to Player directly

tepid turret
#

ahh

#

So wait does that mean

#

tagList will always = tipqueue.getPlayerList();

#

like its live updating or no?

#

nvm dumb question mb

glad prawn
#

yes it is

#

πŸ’€

tepid turret
#

anyways

#

how do i update it?

glad prawn
#

create a method ll reinit it

pseudo hazel
#

yeah, just do tagList = tipQueue.getPlayerList again

#

or dont keep a reference to tagList and just getPlayerList every time

clever lantern
#

how to ban ip without deprecated?

#

idk how to get IpBanList or something

eternal oxide
#

yes

#

yes

#

its cleanest

hybrid spoke
#

nobody cares moment

rigid otter
glad prawn
tepid turret
forest mountain
#

I am trying to use Fireball.class and i get the following problem:
no instance(s) of type variable(s) exist so that Fireball conforms to Projectile

fossil flax
#

how can i block the command of my plugin that are showing with the name firsti?

Example:
Normal command: /fly
Extra command: /pluginName:fly

warm walrus
#

how would i send a lightning bolt packet using NMS (mojang-remapped)?

wraith dragon
#

anyone?

echo basalt
warm walrus
#

how do i make client side lightning? (only visible to one player)

echo basalt
#

packets :3

young knoll
#

That could be a decent api addition though

warm walrus
worldly ingot
warm walrus
#

what NMS class would i use?

worldly ingot
#

Either SmallFireball or LargeFireball

warm walrus
#

i tried this

    public static void strikeLightning(Player player, int x, int y, int z) {
        CraftPlayer craftPlayer = (CraftPlayer) player;
        ServerGamePacketListenerImpl connection = craftPlayer.getHandle().connection;

        CraftLightningStrike lightningStrike = new CraftLightningStrike(
                (CraftServer) craftPlayer.getServer(),
                new LightningBolt(EntityType.LIGHTNING_BOLT, craftPlayer.getHandle().getServer().overworld())
        );

        connection.send(new ClientboundAddEntityPacket(lightningStrike.getHandle()));
    }
worldly ingot
#

TIL wither skulls are technically considered "fireballs" as well for some reason lol

echo basalt
#

uhh no

#

Lightning is its own packet

worldly ingot
#

Yeah it's add weather or something

warm walrus
warm walrus
#

well more like no class

worldly ingot
#

Actually that may have been consolidated alongside the player spawn packet in the 1.20.2 update

young knoll
#

To the internets

worldly ingot
#

Oh then disregard lol

warm walrus
#

i've been googling for half an hour

#

found nothing useful

restive meadow
#

Anyone who knows NMS? Who can help with creating an NPC in 1.20.2.

warm walrus
worldly ingot
#

Yeah so apparently the "spawn weather entity" packet was removed in 1.16

worldly ingot
#

Just that spawn packet

#

The one you're using should be fine

warm walrus
#

it didn't work 😒

#

maybe i'm creating the entity object wrong?

small current
#

someone sent me this code

public static void Confirmation (Player Player, String Message, String Command) {
        TextComponent Text = new TextComponent(Common.Color("&a[βœ”]"));
        Text.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Click To Confirm.").create()));
        Text.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, Command));
        TextComponent MessageT = new TextComponent(Message);
        MessageT.addExtra(" " + Text);
        Player.spigot().sendMessage(MessageT);
    } 

i wont forgive him for the capitals and the naming but why this is the output

TextComponent{text=[βœ”], BaseComponent(color=, font=null, bold=null, italic=null, underline=null, strikethrough=null, obfuscated=null, insertion=null, extra=null, clickEvent=ClickEvent.(action=RUN_COMMAND, value=/event join), hoverEvent=HoverEvent(action=SHOW_TEXT, ...

i dont have access to a pc right now sooo

echo basalt
#

you aren't using the xyz

warm walrus
#

oh yeah you're right

worldly ingot
#

Yeah, double checked and it does use the standard spawn packet πŸ˜› Nothing overrides it anymore I don't think

#
    public Packet<PacketListenerPlayOut> getAddEntityPacket() {
        return new PacketPlayOutSpawnEntity(this);
    }```
warm walrus
#

but where do i even specify it?

echo basalt
#

LightningBolt lightning = EntityType.LIGHTNING_BOLT.create(world);
lightning.moveTo(loc.getX(), loc.getY(), loc.getZ());

warm walrus
#

do i just setpos?

warm walrus
#

didn't work

    public static void strikeLightning(Player player, int x, int y, int z) {
        CraftPlayer craftPlayer = (CraftPlayer) player;
        ServerGamePacketListenerImpl connection = craftPlayer.getHandle().connection;

        LightningBolt lightning = EntityType.LIGHTNING_BOLT.create(craftPlayer.getHandle().getServer().overworld());
        lightning.moveTo(x, y, z);

        connection.send(new ClientboundAddEntityPacket(lightning));
    }
young knoll
#

Is the player in the overworld

#

You should be using the players world

warm walrus
#

i want it to be in the overworld it's fine

#

and yeah the player is in the overworld

worldly ingot
#

There's not really any guarantee that it will actually be the overworld you want. Bear in mind that CraftBukkit sort of fucks with how worlds work

#

I would opt to use ((CraftWorld) theWorldYouWant).getHandle() instead if you can

warm walrus
#

i'm 99% sure it's not the problem because i have some npcs that i spawn in the same way and they show up but i will take your advice anyways

worldly ingot
#

I guess if you have a CraftPlayer then ((CraftWorld) craftPlayer.getWorld()).getHandle()

#

I mean hey, anything is worth an attempt

warm walrus
#

didn't work πŸ˜”

warm walrus
worldly ingot
#

Give me a minute

eternal oxide
#

why use nms to create lightning?

warm walrus
eternal oxide
#

ah ok

worldly ingot
#

PES_Think I can't see anything that wouldn't be working here

#

I'm fairly certain it's been the add entity packet since around 1.16

young knoll
#

That's what spigot uses

worldly ingot
#

Well Spigot actually adds it to the world

young knoll
#

Well yeah, but that eventually flows down to the addentity packet

worldly ingot
warm walrus
#

ok it works sorry yall

#

i don't even wanna say what the problem was it was very stupid

#

thanks @worldly ingot @young knoll @echo basalt

echo basalt
#

I'm more concerned at the variable naming

#
public static Collection<Location> generateLineAB(Location a, Location b, int points) {
  Vector aVec = a.toVector();
  Vector bVec = b.toVector();
  World world = a.getWorld();

  Vector difference = bVec.clone().subtract(aVec);
  double distance = difference.length();
  Vector offset = difference.normalize().multiply(points / distance);

  List<Location> locations = new ArrayList<>();

  for(int index = 0; index < points; index++) {
    locations.add(aVec.clone().add(offset.multiply(index)).toLocation(world));
  }
}
eternal oxide
#

This may not work as you intend. you are exponentially incrementing internalVector

echo basalt
#

you're also mutating ab

bronze crystal
#

How can I prevent the player from stacking an item into an inventory. for example the inventory is full of dirt and he should not be able to stack it (add it to the stack)

eternal oxide
#

If you don;t want items to stack, add a custom PDC tag to it

storm mango
#

Hello, I am making an inventory interface and want to prevent players from taking items out, but I found that getCurrentItem().getType() method of InventoryClickEvent may throw NPE, how can I solve this?🧐

young knoll
#

check if getCurrentItem is null

quaint mantle
#

Good evening guys, how could I make sure that the lore of my item is configurable via config, via a stringlist which obviously also calculates the " " spaces, I'm doing various tests but I still haven't reached the desired result, any advice?

young knoll
#

It's pretty easy to just convert a string list directly to lore

#

What issues are you having

quaint mantle
# young knoll What issues are you having

I tried to create a List, which counts the strings therefore List<String> and then initialized it with the StringList config and inserted it on item.setLore(lore);

young knoll
#

You should just be able to do List<String> lore = config.getStringList("lore")
and then ItemMeta#setLore with that list

quaint mantle
young knoll
#

What happens with that?

quaint mantle
young knoll
#

Well, when you are send the error

#

?stacktrace

undone axleBOT
quaint mantle
#

!hello

young knoll
#

hi

quaint mantle
#

Hi can you answer the question my friend in #help-server asked you

quaint mantle
young knoll
#

πŸ‘

zenith gate
#

How could i attach a debugger to my plugin?

young knoll
#

Intellij?

zenith gate
#

the debug button? that doesn't debug it while its in the server, I need something that would give me information there. Cause something is going on, server dont crash but an endless loop starts and idk what could be causing it.

young knoll
zenith gate
#

i tried following that but I cannot edit the command arguments.

#

i cant delete or add anything in there.

remote swallow
#

that command arg it shows you, you add to the server

#

when you start it

zenith gate
#

oh i'm just terrible at reading....

onyx fjord
#

@zenith gate make sure to run your server with a JDK that supports live reloading

zenith gate
#

17 should be good right?

slender elbow
#

you don't need live reloading to use the debugger lol

zenith gate
#

Well it don't matter it didn't display anything about my issue.. πŸ˜‚

shell robin
#

How can I cancel taking second-hand items from the GUI?

vague oracle
#

idk if this is what you mean but there is either inventoryclickevent or playerswapiteminhandevent something like that

#

Does anyone know off the top of their head whether ProjectileHitEvent or EntityDamageByEntityEvent gets called first

shell robin
vague oracle
#

dont use .equals i think that compares the entire object

#

you would want to use == to compare the instance of the object

#

could be wrong

young knoll
#

I think either work

vague oracle
#

I would assume tho you are in a GUI so you will need the InventoryClickEvent

#

find which slot number the second hand is

#

and compare it to the clicked slot and cancel it if so

lilac dagger
#

It's best to use equals to compare inventories if you're coding for 1.8.8

slender elbow
#

.equals on an inventory is better than ==

lilac dagger
#

Ye

shell robin
slender elbow
#

some things create a new bukkit inventory instance each time

vague oracle
young knoll
#

No idea

#

Best I could do is guess

vague oracle
#

All good I’ll wait till later πŸ™‚

lilac dagger
quaint mantle
lilac dagger
#

Projectile hit calls first with the block or entity it raytraced then if everything is alr, entitydamagebyentity is called

quaint mantle
rough blaze
#

Dependency 'me.boxxing.reviveme:reviveme:1_20_R1' not found

still getting errors

young knoll
#

?paste

undone axleBOT
quaint mantle
# young knoll Show your code

problem solved, I had to recreate the config because it wasn't updated with the lore, everything's fine thank you very much

tame wolf
#

Are there any APIs or Libraries for creating block displays yet?

young knoll
#

I mean

#

Spigot has api for them

tame wolf
#

Oh really?

fossil flax
#

my plugin can't find any command/event class i created.
i didnt modified anything, and i checked the directory of all classes.

young knoll
tame wolf
#

Is there a way to sort of mass produce them? Kinda like build a structure in-game and then being able to make a sort of schematic made from block displays for it?

young knoll
#

They work the same as any other entity

#

So you can just use a loop or whatnot

small current
#
@EventHandler(priority = EventPriority.HIGHEST)
    public void onPlayerRespawn(PlayerRespawnEvent event) {
        Player player = event.getPlayer();

        event.setRespawnLocation(ArenaManager.getCurrentArena().getLobby());
...
    }
#

this is my code

#

sometimes when the player is lagging

#

the location won't change

#

it is a very rare bug

#

but it happens

dawn flower
#

whats the best way to store aan array of itemstacks inside a config file that doesnt take 500 lines of the config file

lost matrix
dawn flower
#

idk

#

looks ig

lost matrix
kind hatch
#

Anyone know if Display Entities are capabale of displaying particles?

dawn flower
#

what item is at index 0 of the player's inventory including the offhand and armor? and what indexes contain the offhand and armor

echo basalt
#

offhand is 40

#

0-8 is hotbar

#

then 9 is upper left

dawn flower
#

so the full inv is 40?

echo basalt
#

If you account for the crafting grid it's 45

#

But just the contents themselves it's 40

dawn flower
echo basalt
#

In some instances

#

it doesn't store data but you can set stuff there

short pilot
#

Keep getting the good ol " uses the space-character (0x20) in its name" error but there are no spaces at all in my yml; i've even reset it to something like "temp" and it still fails to load

#
main: io.github.derec4.dragonforgekingdoms.DragonForgeKingdoms
version: 0.1.2
name: temp
echo basalt
#

the getContents array is different from getItem at index iirc

short pilot
#
name: DragonForge_Kingdoms
version: 0.1.1
main: io.github.derec4.dragonforgekingdoms.DragonForgeKingdoms
description: Framework for kingdoms server
author: Derex
api-version: 1.20

# Optional fields:
website: https://github.com/DereC4
prefix: DragonForge

This was original

echo basalt
#

Let me check if it has any invis characters

#

the file itself pls

short pilot
#

of course

#

uh

#

i cant drag and drop for some reason

echo basalt
#

right click -> open in -> file explorer

tall dragon
#

prolly needs to be verified ;d

#

not sure tho

echo basalt
#

might just be some weird encodin

#

oh yeah that too

remote swallow
#

just dm me it and ill upload it here

echo basalt
#

dms malware

short pilot
#

ez

dawn flower
echo basalt
#

starts from 0

dawn flower
#

aight ty

echo basalt
shadow night
#

Why

echo basalt
#

Why

kind hatch
#

Why

tall dragon
#

why

tame wolf
#

Why

dawn flower
tall dragon
lost matrix
dawn flower
#

im giving the player items from an array

tall dragon
#

??

#

xD

remote swallow
dawn flower
#

o hwait u provided an image

#

mb

lost matrix
echo basalt
# remote swallow

copied it to a test plugin and changed the main part and it works fine

#

so it's prob a compilation issue

remote swallow
#

@short pilot

short pilot
#

gotchu

#

ill double check my gradle first

rough blaze
#

getting these errors with this code

kind hatch
#

Reload the pom

remote swallow
#

is reviveme ur plugin

rough blaze
#

naw its the api im using

remote swallow
#

link it

remote swallow
#

the api isnt published on a repo, download the jar and mvn install it

#

Sometimes you have a certain .jar file that you need as dependency, but the author of that .jar was too lazy to properly upload it to a public repository. That’s bad, but not a problem. There are two ways to solve this, but only one proper way. The proper way: install the dependency The proper...

ivory sleet
#

ah goofy plugin

rough blaze
remote swallow
#

if that is what you mvn install it with

#

yes

dire marsh
#

is there a way to get rid of this server-side

rough blaze
unique edge
#

hey!, excuse me , does anyone know how to define arrow damage in mmoitems for bows?

#

beside just using power i mean

dire marsh
#

bruh

#

cringe

tepid holly
#

im tryna make an rpg server any plugins yall wanan suggest??

wet breach
dire marsh
#

we can't disable achievements, they're a core part of the server

wet breach
#

don't believe disabling the achievements in the config prevents plugins from still using it

dire marsh
#

you mean the vanilla achievements?

lost matrix
#

Its a static method which is not included in those type constraints

wet breach
#

but I also think you can disable the recipe book thing too from popping up or you could just set it to have all recipes discovered

#

really only an issue for new players though

lost matrix
#

?

#

Paste the method here pls

#

I doubt it

pine kelp
#

how can i download this plugin

lost matrix
echo basalt
#

You really need the generics?

pine kelp
#

i downloaded it and how can i play/open it

distant wave
#

can someone tell me why is it not passing the if statement

lost matrix
#

This very much looks like it should not be generic.
Whats the provideItemGeneric method?

distant wave
kind hatch
#

That would be why

#

OP is granted implicit * permissions

distant wave
#

damn

wet breach
echo basalt
#

Ew

wet breach
#

there are some plugins that don't evaluate op in that way

lost matrix
hazy parrot
#

wouldn't it be better to have Constant superclass instead of that generic thing

#

oh lol

lost matrix
#

This scales terrible...

hazy parrot
#

im sure its super fun to code that

echo basalt
#

Bro thinks he's about to revolutionize the planet

#

Speaking from experience bro does not listen to feedback

pine kelp
#

how can i playyy

#

with the plugin

kind hatch
#

Wdym?

lost matrix
#
public interface ItemRepresentable {

  ItemStack asItemRepresentation();

}
public enum MathematicConstant implements ItemRepresentable {
  PI(...);

  @Override
  public ItemStack asItemRepresentation() {
    return null;
  }
}
  public static <T extends ItemRepresentable> void fillInvMap(Map<Integer, Inventory> inventoryMap, Map<T, ItemStack> genericMap, T... t) {
  }
lost matrix
#

This way you never have to extend your if-else chain with more classes.
You simply implement the interface and boom, you can pass it to your fill method.

lilac dagger
#

What in the...

grim hound
#

Looks nice

lilac dagger
#

There are so many

grim hound
#

It's not like you can compress them

lilac dagger
#

I wonder how he did i

#

I assume is a constant too

grim hound
#

I would just change the name to "MathematicalConstants"

pine kelp
#

does it work with the essential mod

pseudo hazel
#

because minecraft probably copies teh items around and whatnot

#

similar to how string comparisons work

#

== is a direct reference/object adress comparison

#

and .equals can be specified by the class itself

remote swallow
#

use isSimilar

cursive falcon
#

== compares memory addresses, equals() compares values in objects

gleaming grove
#

If you aim for the clean code, I suggest you to instead of using big if statement, use Map that contains itemstack as Key, and action as a Value ``` Map<ItemStack, Consumer<ItemStack>> onClickActions;

public void registerActions()
{
    onClickActions = new HashMap<>();
    onClickActions.put(new ItemStack(Material.BLUE_DYE),itemStack ->
    {
        Bukkit.getConsoleSender().sendMessage("Hello world");
    });
}

public void onClick(ItemStack item)
{
    if(!onClickActions.containsKey(item))
    {
        return;
    }
    Consumer<ItemStack> action = onClickActions.get(item);
    action.accept(item);
}```
#

and propably Itemstack as input will be not enoght for some situations. So consider using own custom Inventory Event as Input, like @Data public class InvClickEvent { private Inventory inventory; private ItemStack button; private Player player; }

#

yes

#

@Value is java record, @Data is getters + setters

lilac dagger
#

Are these lombok?

#

Oh yes

#

Sorry i'm on my phone

echo basalt
#

Ew

lilac dagger
#

Better use slots

#

And register a consumer per slot to do stuff

#

Assumimg your inv remains in the same place

wet breach
#

one is an instance check the other is a contents check

#

since you are using static to compare a dynamic object

#

the instance check won't pass

#

but the contents check will

ruby mesa
#

Anyone know why I'm getting an out-of-order packet for some players?

eternal oxide
#

bad packet id I'd guess

uncut folio
#

how do i slow down a BlockIteration? i'm trying to make an itemDisplay move forward but it just instantly reaches the iteration's limit

kind hatch
#

Make the duration longer? IIRC, that stuff is handled in ticks.

uncut folio
#

it doesn't have a duration
just a max distance

#

it only ends once it reaches that max distance or hits a solid block

sterile token
short pilot
#

woohoo fixed my problem

#

we good

echo basalt
sterile token
quaint mantle
#

Guys, can it be made so that when the player returns to the server the first slot is automatically selected?

tall dragon
#

yes

quaint mantle
#

Okk

tepid turret
#

[HELP] Weird Behaviour In EntityDamageByEntityEvent if Statement

winter flower
#

Entity#drops isn't reliable

rough blaze
#

[00:12:37 WARN]: [boxxing] Task #14 for boxxing v1.0-SNAPSHOT generated an exception
java.lang.IncompatibleClassChangeError: Method 'java.lang.Boolean net.kokoricraft.reviveme.api.ReviveMeAPI.hasDowned(org.bukkit.entity.Player)' must be Methodref constant
at me.boxxing.Boxxing.checkMatchOver(Boxxing.java:157) ~[boxxing-1.0-SNAPSHOT.jar:?]
at me.boxxing.Boxxing.access$300(Boxxing.java:24) ~[boxxing-1.0-SNAPSHOT.jar:?]
at me.boxxing.Boxxing$3.run(Boxxing.java:57) ~[boxxing-1.0-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.20.1.jar:git-Paper-119]
at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:480) ~[paper-1.20.1.jar:git-Paper-119]
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1480) ~[paper-1.20.1.jar:git-Paper-119]
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:447) ~[paper-1.20.1.jar:git-Paper-119]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1394) ~[paper-1.20.1.jar:git-Paper-119]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1171) ~[paper-1.20.1.jar:git-Paper-119]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:318) ~[paper-1.20.1.jar:git-Paper-119]
at java.lang.Thread.run(Thread.java:833) ~[?:?]

Getting this error, what would I do to fix it?

torn oyster
#

what are the chances of generating the same uuid with UUID.randomUUID()

winter flower
#

it's like 0.1% of getting the same value

river oracle
echo basalt
#

you're doing some hacky shit

tepid turret
#

There is problems with all of the gameEnd's and winningPlayer's

boolean gameEnd = false;
        Player winningPlayer;
        this.plugin.getServer().getScheduler().runTaskTimer(this.plugin, task -> {
            gameTimer--;
            for (int i = 0; playerList.size() > i; i++) {
                playerList.get(i).spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(tip + gameTimer + " Seconds Left"));
                if (gameTimer < 10) {
                    playerList.get(i).playSound(playerList.get(i), Sound.BLOCK_NOTE_BLOCK_COW_BELL, 1, 1);
                }
                if (gameTimer <= 0) {
                    if (playerList.size() > 2) {
                        playerList.remove(inPlayer);
                        newRound();
                    } else {
                        if (playerList.get(i) != inPlayer) {
                            gameEnd = true;
                            winningPlayer = playerList.get(i);
                        }
                    }
                    task.cancel();
                }
            }
            if (gameEnd) {
                for (int i = 0; playerList.size() > i; i++) {
                    playerList.get(i).sendMessage(ChatColor.AQUA + "-----------------------------------------------------");
                    playerList.get(i).sendMessage(tip + "Game Has Ended");
                    playerList.get(i).sendMessage(ChatColor.AQUA + "-----------------------------------------------------");
                }
                for (Player player : Bukkit.getServer().getOnlinePlayers()) {
                   player.spigot().sendMessage(ChatMessageType.CHAT, new TextComponent(tip + winningPlayer.getDisplayName() + " Has Won a Game Of Tip!"));
                }
            }
        }, 0L, 20L);

"Variable used in lambda expression should be final or effectively final"

#

but I want it to change when the game ends

#

i think im doing a stupid

young knoll
#

There are at least 121 bits that are randomized, so that's 2^121 possibilities

echo basalt
#

I'm not going to lie

tepid turret
echo basalt
#

Well

#

Let's start by stripping some logic

tepid turret
#

I think I found it

echo basalt
#
public void sendMessage(String... messages) {
  ...
}
tepid turret
#

yea fixed it

#

lmfao

#

i was dumb

#

put game end in a diff function

echo basalt
#

not just that

#

For games (and especially minigames) you want to like

#

make a common base of what a game is

#

And de-coupling everything from the game class in a way

#

You also want to split stuff into more methods for cleanability (Example below)

short pilot
#

Alright so the way I have commands set up is switch statement between arguments based on the initial "parent" prefix (like faction create)

How do I register this? Do I need to just register the prefix command in both yml and onEnable() or do I register every individual command (e.g. "faction create "faction join")

rough blaze
#

[00:12:37 WARN]: [boxxing] Task #14 for boxxing v1.0-SNAPSHOT generated an exception
java.lang.IncompatibleClassChangeError: Method 'java.lang.Boolean net.kokoricraft.reviveme.api.ReviveMeAPI.hasDowned(org.bukkit.entity.Player)' must be Methodref constant
at me.boxxing.Boxxing.checkMatchOver(Boxxing.java:157) ~[boxxing-1.0-SNAPSHOT.jar:?]
at me.boxxing.Boxxing.access$300(Boxxing.java:24) ~[boxxing-1.0-SNAPSHOT.jar:?]
at me.boxxing.Boxxing$3.run(Boxxing.java:57) ~[boxxing-1.0-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.20.1.jar:git-Paper-119]
at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:480) ~[paper-1.20.1.jar:git-Paper-119]
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1480) ~[paper-1.20.1.jar:git-Paper-119]
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:447) ~[paper-1.20.1.jar:git-Paper-119]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1394) ~[paper-1.20.1.jar:git-Paper-119]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1171) ~[paper-1.20.1.jar:git-Paper-119]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:318) ~[paper-1.20.1.jar:git-Paper-119]
at java.lang.Thread.run(Thread.java:833) ~[?:?]

Getting this error, what would I do to fix it?

echo basalt
#

you already asked it go away

#

?paste

undone axleBOT
echo basalt
#

shoo

echo basalt
echo basalt
#

Example

young knoll
#

If you are using spigots system

#

You only need to register the base command

echo basalt
#

^

#

this is proprietary :p

young knoll
#

Shhh

#

Having an actual code based command api is something that’s been talked about

echo basalt
#

constructor abuse go brr

#

I should make it a factory class

lilac dagger
#

It is technically a factory

glad prawn
#

coems

lilac dagger
#

One question i have, how does your context work, it looks like it gives back exactly what you need

#

Without casting

worldly ingot
#

It just returns an untyped generic and Java will automatically adapt that type to the type required to compile

#

Sig probably looks something like this

public <T> T getArgument(String)```
worldly ingot
echo basalt
#

I'm not a fan of the static method but oh well

worldly ingot
#

It's better than exposing a constructor and creating a dead instance with no member methods

#

You don't have to be a fan of it for it to be the correct approach lol

short pilot
# echo basalt No clue what your structure looks like but ideally you register every subcommand...

I'm still a bit confused, let me give u a bit of insight

@Override
    public boolean onCommand(CommandSender source, Command command, String label, String[] args) {
        if (!(source instanceof Player player)) {
            source.sendMessage(ChatColor.RED + "This command can only be run by a player.");
            return false;
        }

        if (args.length == 0) {
            // Handle the /kingdom command without sub-commands
            player.sendMessage("Usage: /kingdom <sub-command>");
        } else {
            // Handle sub-commands
            String subCommand = args[0].toLowerCase();
            switch (subCommand) {
                case "create" -> {
                    
                case "remove" -> {
                    
                case "claim" -> {
                    
            }
        }
        return true;
#

basically a switch statement depending on arguments

#

but in onEnable, I'm registering like this

        this.getCommand("kingdom").setExecutor(new KingdomCommandManager());

Which is erroring out when the plugin is loaded

#

the yml has the appropriate commands

echo basalt
#

that's fine

#

Does the .yml just have "kingdom" as a command

#

Because subcommands aren't a thing in bukkit

short pilot
#
commands:
  kingdom:
    description: Kingdom parent command
    usage: /kingdom <arguments>
    permission: dragonforge.kingdom
  kingdom create:
    description: Create a kingdom
    usage: /kingdom create <name>
    permission: dragonforge.kingdom.create
#

right now just has these two

echo basalt
#

yeah remove the kingdom create part

#

Bukkit's really basic when it comes to commands

#

You just register the root itself and any subcommands are up to you

short pilot
#

ok

worldly ingot
echo basalt
#

anyways I opened my IDE and nearly threw up so I'm thinking about not working today

worldly ingot
#

Does your code look that bad?

echo basalt
#

No just burnout

keen star
#

yeah. I do. I saw your ticket

wet breach
keen star
#

I left this server for a bit

wet breach
#

did you like leave at some point?

#

ah got it

keen star
#

ye

wet breach
#

definitely explains that part lmao

keen star
#

It can get fixed soon. Testing it on 1.20.2 is going to be the wait though

#

the method in question got renamed to language. Or something on paper or something.

#

let me see if I can get it fixed quick. otherwise will be a tomorrow problem for me

torn oyster
#

is there an event for when an arrow lands

#

i want to make tnt arrows lol

remote swallow
#

Projectile hit event

torn oyster
#

ok thank you

keen star
#

fix deployed.

torn oyster
#

in relation to a creeper and tnt

#

do you know?

young knoll
#

I think creeper is like

#

3

restive jackal
#

I'm trying to set up a configuration file in my plugin, but when I run saveDefaultConfig like seen in articles I've found and the TntModifierPlugin repo, I get an invalid plugin type error when I try to start the server.

I have a config.yml:

foo: "bar"

and my main plugin file, TestPlugin.kt:

override fun onEnable() {
    saveDefaultConfig()
    registerListeners()
}

it does not generate the TestPlugin folder with my config file, and I get:

[22:38:09 ERROR]: [ModernPluginLoadingStrategy] Could not load plugin 'TestPlugin.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Abnormal plugin type
#

I think it has something to do with how I'm instantiating my plugin, but I'm not sure. I don't see much difference in the plugin I referenced.

#

wait

#

I think I might know what it is

nvm, don't think so

trim lake
#

Is there way how to get block breaking speed or edit block hardness? I will probably need to calculate breaking speed manuals, but thats sounds like pain.

shy forge
restive jackal
#

nah I was wrong just now. If I remove the line saveDefaultConfig(), it works and loads just fine. I even removed any dependencies within the plugin's listeners on the config, and it still only errors when that's in there

eternal oxide
#

if it errors on saveDefaultConfig you have no config in yoru jar

torn oyster
#

how come evokers are not moving anywhere when I do .setTarget()?

#

they just spawn vexes and their teeth things and not move

restive jackal
eternal oxide
#

you are probably building using Artifacts instead of Maven so the yml never gets included

restive jackal
#

I see. how do I make sure I'm building with maven instead? I haven't reloaded it in a while

#

I'm also very new to IJ and kotlin

eternal oxide
#

use the maven tab on the right of your screen and select package under lifecycles

torn oyster
#

but idk how

torn oyster
#

no, i'm using setTarget

#

but the evoker isn't really moving anywhere

#

it's just using its vexes and snapper things

#

it works for all other mobs

#

that i am using

eternal oxide
#

so long as you didn't alter/remove any of it's goals/brain it should move, unless you assigned an invalid target

torn oyster
#

i think evokers only move when they don't have a target

#

that's what i am guessing

eternal oxide
#

possibly

torn oyster
#

since they dont have anything to attack with other than their abilities

eternal oxide
#

I've never played with them

restive jackal
#

really weird

eternal oxide
#

did you take yoru built jar from the new target folder?

restive jackal
#

I did

#

moved it into the plugins folder

#

should I have unpacked it?

eternal oxide
#

no

restive jackal
#

ok I left it as is

eternal oxide
#

just make sure it came from the folder called target

restive jackal
#

it did

eternal oxide
#

open your built jar with 7zip and see if it contains a config

#

any archive program

shy forge
#

Not to be condescending but can you check under "file info" that it is the newly created jar that you're using?

#

Like, check the created date

restive jackal
#

yeah I made sure it was created at the time I built it

#

rn I'm installing a zip program. new installation of ubuntu. still getting everything the way I want it

restive jackal
#

the config is correct as well. currently it's a dummy config, just to get everything working

#

but it wasn't working with the previous config either anyway

eternal oxide
#

theres no reason for it to error on saveDefaultConfig.

#

?stacktrace post teh full error

undone axleBOT
restive jackal
#

yeah it's bizarre. I'm probably missing something somewhere else

#

1sec

#

not super used to kotlin yet so the ST is a little harder for me to parse

eternal oxide
#

does your main class extend JavaPlugin?

restive jackal
#

it does

eternal oxide
#

I don;t use kotlin so can only help on Java bits

#

did you add a constructoir to your main class which takes args? (I hope not)

restive jackal
#

nop

eternal oxide
#

?paste your main class

undone axleBOT
restive jackal
#

I haven't strayed much from what articles I've been referencing

eternal oxide
#

um, abstract?

restive jackal
#

wtf

eternal oxide
#

try public

restive jackal
#

jfc I know that's the issue

#

I had to use abstract at one point and I must have put it there by accident

eternal oxide
#

yep can;t instance bastract classes

restive jackal
#

lemme build it and test it πŸ€¦β€β™‚οΈ

#

if I would have seen that

shy forge
#

Tbh I'm surprised it worked without the config function

eternal oxide
#

Same, probably some kotlin fuckery

shy forge
#

Yeah... I had to google what a main class should look like in kotlin

restive jackal
#

lmao I cannot believe I have been pulling my hair out for hours because I missed a single keyword that I put in by accident randomly

#

thank you so much lol

eternal oxide
#

np πŸ™‚

shy forge
#

Hehe it happens

restive jackal
#

been a bit since I've done a lot of dev and... damn

#

so far I've been able to figure everything out using java resources and seeing what pisses off my IDE but that one pervaded me

shy forge
#

It's always just one line of code though, isn't it?

wet breach
#

and will continue attacking a player even if they switch to creative or spectator modes

distant wave
#

@echo basalt about your cuboid class, is there any easy way to serialize it into json object in gson?

frosty acorn
#

viewdistancetweaker

tepid turret
#

[HELP] getCommand(String) is null

bronze crystal
bronze crystal
#

get the armor slot and check what material type it is

dawn flower
#

does PlayerInventory#getContents get the armor contents and offhand too?

sullen marlin
#

yes

dawn flower
#

k

hushed spindle
#

BlockPistonExtendEvent#getBlocks() returns the blocks that are about to be moved, so before the piston extends. how can i get these blocks after they are moved

young knoll
#

Get the blocks, use the extend direction to offset

hushed spindle
#

oh right, shoulda thought of that

#

thank you

icy laurel
#

can I update a resource and link the download to a papermc hangar or modrinth page? My plan is to require papermc or any fork of it, but I'm not sure if I can do that on the spigot page

young knoll
#

If it's on SpigotMC it must work on spigot

#

At least afaik that's the rule

#

Maybe @vagrant stratus can weigh in

echo basalt
#

don't think the problem is competitor platforms, but rather the paper requirement

icy laurel
#

ok so can I write in the description of the resource that it is outdated and no longer maintained and link to a new page (e.g. modrinth or paper hanger), which then only supports paper?

glad prawn
#

u cant πŸ‘

echo granite
#

Which name would you prefer for a method that checks if a post was written by a guest - an unregistered player?

public class Post
{
    boolean wasWrittenByGuest()
    boolean writtenByGuest()
    boolean belongsToGuest()
    boolean isGuest()
    boolean isAnonymous()
    boolean isAuthorGuest()
}
quaint mantle
echo granite
daring torrent
#

Hello, I am looking for how to prevent a player from connecting to the server if he is already connected to the server. (This is for a plugin like AuthMe)

Because currently if someone tries to connect with the same name it disconnects the person.

So if anyone knows how to prevent a player from connecting depending on whether they are connected or not I am interested.

opal carbon
#

online mode

shadow night
#

Ig in the preLogin event you gotta see if there is a player with the same name in the server and if so, disconnect the connecting player?

daring torrent
young knoll
#

yes

quaint mantle
#

I think all my passwords were stolen :/

#

Oops wrong channel sorry

echo granite
young knoll
#

I'd be sus of anything that is obfuscated to all hell

echo granite
quaint mantle
quaint mantle
quaint mantle
#

Every class looks really similar to it.

echo granite
echo granite
quaint mantle
vagrant stratus
#

and 2) I did actually see a malware which made use of lua

#

hell, I'm seeing known malicious jars on virus total being detected by less programs than 9 months ago

#

between 2 years one jar went from 1 detection to 2 detections

#

I highly double eset will do better

valid burrow
#

im gonna loose my mind

remote swallow
#

im not

valid burrow
#

someone wanna help me debug chunky sql codwe

#

i cant do this anymore

#

i dont get ANY errors

#

and still

#

theres like a million

remote swallow
#

the plugin chunky sql or actual big sql

valid burrow
#

idk what would count as big tbh

remote swallow
#

do you actually print the stacktraces

valid burrow
#

yes

remote swallow
#

or do you throw new RuntimeException

valid burrow
#

no

#

theres just no errors acurring

remote swallow
#

so what isnt working

valid burrow
#

i have settings

#

that i save in a table

#

but

#

FOR SOME REASON

#

settings 4 changes setting 5

#

setting 67 dont safe at all

#

and

#

idk anymore

#

its confusing

remote swallow
#

?paste the code

undone axleBOT
valid burrow
#

what code xd its like 5 classes

remote swallow
#

and what storage type

valid burrow
remote swallow
remote swallow
#

mysql, mariadb, sqlite, h2, postgres

valid burrow
#

oh thats wat yopu mean

#

mysql

#

i thought u mean what i was trying to store

remote swallow
#

ah

valid burrow
#

?paste

undone axleBOT
valid burrow
#

im not alloed to safe the code apperently

remote swallow
#

too big

#

split it into different pastes

valid burrow
#

how many lines is ma

#

max

remote swallow
#

depends how much is on the line

valid burrow
#

just gonna use pastebun

remote swallow
#

smh

#

lower case classname

valid burrow
#

so

#

the class im calling is updatePlayerSettings

#

and it doesnt trow an error

#

but

#

it also doesnt seem to save

remote swallow
#

do you use futures for this

#

or scheduler

untold osprey
#

hellow, i'm learning to create a bukkin plugin, but my tuto say that i need to create a class with a super class name "java.plugin" on visual studio code
but i don't find how to do ?? anyone use visual studio and not eclipse ??

remote swallow
#

create a java project, create ur package, create a class eg PluginNamePlugin, then make it extend JavaPlugin and add the onEnable and onDisable

valid burrow
remote swallow
#

thats an issue then

#

you should do IO async

valid burrow
#

i mean it worked just fine with the other table

remote swallow
#

doing sql/IO on the main thread will pause it

valid burrow
#

and i literally just copy pasted the code and changed the values

valid burrow
#

where i execute the statement?

remote swallow
#

id use completable futures, try-with-resources and hikaricp or atm im a hibernate slag

remote swallow
#

@valid burrow heres a thing on fuatures

echo basalt
remote swallow
#

i forgot to dsiable the ping reply

untold osprey
#

ok, i've done but visual say that "pom.xml is inexistent or invalid"

vagrant stratus
glossy venture
#

1.8.8 spigot still has the full jar on maven right?

worldly ingot
#

The servers are never hosted on the maven repo, but the API is, yes

#

And yes you can build it with BT

glossy venture
#

oh i thought 1.8.8 had the full jar on maven

#

aight

worldly ingot
#

Nah, we'd get sued for that lol

remote swallow
#

whos we

#

md would get sued

river oracle
worldly ingot
#

I wouldn't really wanna test to see if we'll be on the bad side of Microsoft lawyers lol

river oracle
#

Which is crazy to me lol

#

Not insinuating we could get away with that btw

glossy venture
#

why tf does bukkit need mysql

young knoll
#

?

glossy venture
#

buildtools downloaded mysql jdbc for the bukkit 1.8.8 jar

young knoll
#

yes

glossy venture
#

and shaded it

young knoll
#

It's included for devs

glossy venture
#

ah

karmic phoenix
#
    @EventHandler
    public void onEnter(EntityPortalEnterEvent e) {
        Location location = ElytraFFASystem.getMain().getConfig().getLocation("portalspawn");
        if (location == null) {
            Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "There's no PORTAL spawn set, please set one as soon as you read this.");
            return;
        }
        e.getEntity().teleport(location);

    }

Hey everyone, I'm having trouble fixing this, the issue is basically when it gets to the teleporting part(e.getEntity.teleport(location);) it keeps repeating itself.

eternal oxide
#

it will because you are triggering the event you are in

karmic phoenix
#

I don't understand.

eternal oxide
#

you are calling teleport inside a teleport event

lost matrix
#

Yes, teleporting will call the event again, which will teleport the person, which will call the event again, and so on

karmic phoenix
#

Is there a way to stop it once the entity is teleported?

eternal oxide
#

a boolean

#

set before you teleport and reset after

lost matrix
#

First show us your code. The console output doesnt match the code you have shown us.

lost matrix
#

Do you also hava a listener for the EntityTeleportEvent?

karmic phoenix
#

No.

lost matrix
karmic phoenix
#

It isn't.

eternal oxide
#

no

#

its triggering because he's already stood IN a portal block

lost matrix
#

Ok but teleporting him out should not call the EnterEvent again

eternal oxide
#

it will because this event is triggered at teh beginning of a teleport IF he is in contact with a portal block

karmic phoenix
#

Am I able to provide a video to showcase what's happening?

eternal oxide
#

I don;t believe its from the interact

lost matrix
eternal oxide
#

Not sure if any forks allow async teleport

karmic phoenix
#

It also stops me from breaking blocks so I don't know how this is related.

eternal oxide
#

when it happens your server is actually locked in a loop and will eventually run out of memory/crash

chilly hearth
#

e

lost matrix
#

I dont like the boolean idea... Handling multiple teleports in one tick requires a Set then and you would need to schedule
the removal of entries.

eternal oxide
#

yep it's probably going to break

#

else he could set a flag on the player PDC and remove after

#

or just meta

lost matrix
eternal oxide
#

no need for permanent

karmic phoenix
#

I'm making like a space FFA using elytras, and there would be portals where a player could enter and teleport to a different place.

#

Like a blackhole.

lost matrix
#

I guess you need to use a Set<UUID>, dont teleport the player if he is already teleported and schedule a clear of the set for next tick.

eternal oxide
#
if (!player has meta) {
  player set meta;
  player teleport;
}
player remove meta;```
lost matrix
#

Depending on how bad the impl for the enter event is

karmic phoenix
#

I've never done anything with metas before, I don't even know what they are.

lost matrix
#

I think metadata is rubbish

eternal oxide
#

it is but its non permanent

#

PDC would work too and is simpler

lost matrix
#

I would just use a Set honestly

eternal oxide
#

yeah set or meta would work

karmic phoenix
#

What would be more "efficient".

lost matrix
#

Doesnt matter

chilly hearth
#

alr

#

so

#

its suppose to be working

#

but it gives error in console

eternal oxide
#

with the set you will probably need to schedule removal due to the teleport happenign the next tick. meta/pdc you wouldn't

lilac dagger
#

Probably having control over your own collections/maps

chilly hearth
#

that i cant cast the entity to witherskeleton

#

but it works

#

heres the error

lost matrix
#

I would argue that using a Set is easier to implement

chilly hearth
#

"java

eternal oxide
#

probably

chilly hearth
#

it says

#

i cant cast it to wither skeleton

#

but its working

lost matrix
#

If it throws an exception then its not working

chilly hearth
#

it is working

lost matrix
#

You are probably casting 2 different entities and one works, the other doesnt

chilly hearth
#

no

#

let me show u the code

#
  WitherSkeleton boss = (WitherSkeleton) e.getEntity();```
young knoll
#

You need to check before you cast

lost matrix
#

Alright, if this throws an exception then the method will exit right here and no other code will be executed.

chilly hearth
#

it is executing bro

lost matrix
#

Aka it will not work

chilly hearth
#

............

#

IT IS WORKIN

young knoll
#

Maybe on wither skeletons

#

But if anything else takes damage then no

chilly hearth
#

but it sends that error when i hit ther wither skeleton

#

heres the class

#
package me.airforce.bosses2.Events;

import com.google.common.util.concurrent.ListenableFuture;
import org.bukkit.ChatColor;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.WitherSkeleton;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;

public class HealthEvent implements Listener {

    @EventHandler
    public void OnBossDamage(EntityDamageEvent e){

        WitherSkeleton boss = (WitherSkeleton) e.getEntity();
        Double dmg = e.getDamage();

        if(boss.getScoreboardTags().contains("a")){
          boss.setCustomName(ChatColor.BLUE + "" + ChatColor.BOLD + "Ancient Wither Skeleton" + ChatColor.WHITE + "| " + ChatColor.RED +"❀\uFE0F " +Math.round(boss.getHealth()));







        }










    }



#

and its updating

#

tthe health

lost matrix
#

If you dont make sure to filter out any other entitiy which is not a WitherSkeleton then this breaks.
How do you make sure this is only called for WitherSkeletons?

karmic phoenix
chilly hearth
#

thats how

lost matrix
karmic phoenix
#

Main class ye?

young knoll
lost matrix
chilly hearth
#

um

#

so

#

what do i do

lost matrix
#

Check the scoreboard beforehand.
And make an instanceof check before casting blindly.

chilly hearth
#

wow just copy the words

#

man

young knoll
#

what

chilly hearth
#

alr let me try

karmic phoenix
#

Ok so how does this work?
Am I supposed to teleport the player and then put them in the Set?

chilly hearth
#

WAIT A MINUTE

#

I FORGOT

#

bro if i dont cast the entity

remote swallow
#

you stil cast it, just instanceof check it

chilly hearth
#

i wont get .gethealth

#

method

lost matrix
chilly hearth
remote swallow
#

if (e.getEntity() instanceof WitherSkeleton witherSkele) { 
  // code
}
chilly hearth
#

alr

young knoll
#

πŸ₯„

karmic phoenix
chilly hearth
#

worked thx

karmic phoenix
#

Oh forgot.

#
if (main.getAlreadyTeleoprtedPlayers().contains(e.getEntity().getUniqueId())) {
            main.getAlreadyTeleoprtedPlayers().remove(e.getEntity().getUniqueId());
            return;
        }
        e.getEntity().teleport(location);
        main.getAlreadyTeleoprtedPlayers().add(e.getEntity().getUniqueId());
#

like so?

eternal oxide
#

add before teleport

lost matrix
#

If this works then a simple boolean will do as well now that i think about it

karmic phoenix
#

Also a dumb question, should the following be public or private.

public static ElytraFFASystem main;
#

In main class private and in the EnterEvent class public yes?

#

Ok it's working fine now, but this time I get teleport twice.

lilac dagger
#

Private

eternal oxide
lilac dagger
#

But by the look of it you either want to use depenency injection a singleton pattern

karmic phoenix
#

I don't understand.

eternal oxide
#

before the teleport, event.setCancelled(true)

karmic phoenix
#

There isn't a e.setCancelled

eternal oxide
#

in EntityPortalEvent there is

karmic phoenix
#

Should I switch to it?

eternal oxide
#

which event are you using?

karmic phoenix
#

EnterEvent

#

EntityPortalEnterEvent

eternal oxide
#

yeah my bad, I was in wrong event

quaint mantle
#

Is there any way to force object to be garbage collected?

eternal oxide
#

no

river oracle
#

you could call System.gc() but remind yourself that System.gc() is cursed as fuck and you shouldn't probably use System.gc()

lofty badge
#

why aliases not working?

    aliases: rtp, randomtp, randomteleport```
quaint mantle
lofty badge
#

oh.. ok

#

thank u ^^

distant wave
#

guys, how should i serialize PermissionAttachment

ivory sleet
#

altho its preview still iirc

quaint mantle
#

So how?

ivory sleet
#

System.gc() as y2k mentioned altho its by no means forcing a gc sweep (and most jvm instances have it turned off)

ivory sleet
#

like java standard lib but the api is in preview

#

so :/

#

else

#

the closest u get is try with resources

quaint mantle
#

Eh

ivory sleet
#

i mean u have phantomreference, reference queue and cleaner if u wna listen to when the gcing is happening

#

technically finalize() also altho we avoid it for obvious reasons

#

actually idk but maybe ByteBuffer and Unsafe allow for explicit control over cleaning up

lofty badge
#

guys, how to make sit and lay commands in java?

lilac dagger
#

Finalize is deprecated too i think?

lofty badge
uncut folio
#

i'm trying to move an ItemDisplay along the player's line of sight using a BlockIterator but i can't seem to figure it out and i can't find anything on the spigot forums
how do i do it?

valid burrow
uncut folio
#

i just wanna make it move forward slowly

valid burrow
#

well

lofty badge
uncut folio
#

i've been trying to do it for hours but only one of 2 outcomes happen
either it goes to the BlockIterator's max distance instantly it does the same but far away from the max distance

ivory sleet
valid burrow
ivory sleet
#

But since a lot of goofy old libs use it they wanna have it deprecated for like 10 years or so

valid burrow
#

let*

ivory sleet
#

So everyone gets the chance to migrate

lofty badge
valid burrow
#

techno vision makes some good videos

#

Learn to code your own Spigot plugin in this complete tutorial series! In this episode, we create our plugin.yml file and setup a basic plugin.

--- Important Links ---

● Discord: https://discord.gg/m5fjByfrKP

--- Music ---

● Eddie Rohosy - Night Ride
● Phil Smiff - lake.side
● Xori - Dreamin
● Lakey- Blue Boi
● Chill Out Records - Minute Mix...

β–Ά Play video
lilac dagger
uncut folio
lofty badge
#

how to fast project reload in intelij idea?

valid burrow
#

dont do that

uncut folio
river oracle
#

you need while loops for iterators

#

unless yo umake some jank ass for loop

uncut folio
#

i'd rather just stick with the while loop

#

so far it's been working well but i have no idea how to make it slow down to make the itemDisplay move slowly

remote swallow
#

its easier than rewriting the wheel

lofty badge
#

lol

#

and it worked

lost matrix
#

I also dont understand the block iterator. Do you need the movement increments to snap in place with blocks?

opaque scarab
lost matrix
#

But this is written in python. Which means you need to run this alongside the server and use the rest endpoints in your
spigot plugin to request functionality.

opaque scarab
lofty badge
#

guys, how to fix this? [21:37:04] [Server thread/ERROR]: Could not call method 'public static org.bukkit.Location org.bukkit.Location.deserialize(java.util.Map)' of class org.bukkit.Location for deserialization java.lang.IllegalArgumentException: unknown world

code:

    private FileConfiguration homesConfig;

    public FluffieCraft_Commands() {
        homesFile = new File("plugins/FluffieCraft/fcc_homes.yml");
        homesConfig = YamlConfiguration.loadConfiguration(homesFile);
    }

    private void saveHomeLocation(UUID playerId, Location location) {
        String playerIdString = playerId.toString();
        homesConfig.set(playerIdString, location);
        saveHomesConfig();
    }

    private Location loadHomeLocation(UUID playerId) {
        String playerIdString = playerId.toString();
        if (homesConfig.contains(playerIdString)) {
            return (Location) homesConfig.get(playerIdString);
        }
        return null;
    }

    private void saveHomesConfig() {
        try {
            homesConfig.save(homesFile);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }```
lost matrix
lofty badge
# lofty badge guys, how to fix this? ```[21:37:04] [Server thread/ERROR]: Could not call metho...

Commands where used:

            Player player = (Player) sender;
            UUID playerId = player.getUniqueId();
            Location homeLocation = player.getLocation();
            saveHomeLocation(playerId, homeLocation);
            String format = "%s[%s] %s%s";
            String formattedMessage = String.format(format, ChatColor.GREEN, "FluffieCraft", ChatColor.WHITE, "Home point installed successfully!");
            player.sendMessage(formattedMessage);
        }

        if (command.getName().equalsIgnoreCase("home") && sender instanceof Player) {
            Player player = (Player) sender;
            UUID playerId = player.getUniqueId();
            Location homeLocation = loadHomeLocation(playerId);
            if (homeLocation != null) {
                player.teleport(homeLocation);
                String format = "%s[%s] %s%s";
                String formattedMessage = String.format(format, ChatColor.GREEN, "FluffieCraft", ChatColor.WHITE, "You have been successfully teleported home!");
                player.sendMessage(formattedMessage);
            }

            else {
                String format = "%s[%s] %s%s";
                String formattedMessage = String.format(format, ChatColor.RED, "FluffieCraft", ChatColor.WHITE, "You don't have a home point yet!");
                player.sendMessage(formattedMessage);
            }
lost matrix
opaque scarab
lost matrix
uncut folio
lost matrix
opaque scarab
lofty badge
lost matrix
lost matrix
lofty badge
#
    private File homesFile;
    private FileConfiguration homesConfig;

    public FluffieCraft_Commands() {
        homesFile = new File("plugins/FluffieCraft/fcc_homes.yml");
        homesConfig = YamlConfiguration.loadConfiguration(homesFile);
    }``` maybe it's a problem?
lost matrix
uncut folio
#

that's just something i can't avoid

lost matrix
#

Then you will instantly traverse it to the end

uncut folio
#

that was my main issue
i'm simply trying to slow the loop down

lost matrix
#

You can iterate the block iterator using a scheduled task, without a loop

uncut folio
#

gotcha

#

i'll let you know if it works

lofty badge
lost matrix
# uncut folio i'll let you know if it works
public class BlockIterationTask extends BukkitRunnable {
  
  private final BlockIterator iterator;

  public BlockIterationTask(BlockIterator iterator) {
    this.iterator = iterator;
  }

  @Override
  public void run() {
    if(!this.iterator.hasNext()) {
      this.cancel();
      return;
    }
    Block nextBlock = this.iterator.next();
    this.nextStep(nextBlock);
  }
  
  private void nextStep(Block block) {
    // Do some stuff with the next block in your iteration
  }
  
}

...

    JavaPlugin plugin = ...;
    BlockIterator iterator = ...;
    int delay = 0;
    int period = 5;
    new BlockIterationTask(iterator).runTaskTimer(plugin, delay, period);
lost matrix
#

Example on how to iterate via a task with 5 ticks delay between iterations

uncut folio
#

i really appreciate it

lofty badge
#

@lost matrix help pls

echo basalt
#

?learnjava moment

undone axleBOT
lost matrix
lost matrix
lost matrix
lofty badge
#

for all players

lost matrix
#

When a player joins: Load his home point
When a player quits: Save his home point

#

While a player is online: Keep all home points in a manager class which manages a Map<UUID, HomePoint> which maps each
online player ID to a home point

lofty badge
#

than remake my code pls

#

bro

#

i can send it to dm

lost matrix
#

Nope, send it here and we can give some tips on how to fix/improve your code

#

?paste

undone axleBOT
lofty badge
lost matrix
#

When does your exception occur?

echo basalt
#

mm naming stnadards

uncut folio
#

@lost matrix it worked! thank you so much

lofty badge
#

@lost matrix thanks, it's worked.. and really, how to make sit and lay without protocollib?

lost matrix
lofty badge
#

what the f***?

#

if firstrun, it's working, restarting server - this error again

#

rewrite this code please someone

lost matrix
lofty badge
lost matrix
lofty badge
#

oh... i forgot about this