#help-development

1 messages ยท Page 1382 of 1

ebon abyss
#

@ebon shoal wrap your strings in quotation marks

#

& is sometimes a special character in yaml

ebon shoal
#

alright

woeful crescent
#

never mind I have to go, sorry

ebon shoal
#

but what about "Gamemode:"

ebon abyss
#

as I said earlier, not an issue

ebon shoal
#

oh

#

ok ill try wrapping the strings

ebon abyss
#

probably should've wrapped the no-permission one in quotes too but that parses

brittle badger
#

is it possible to turn a playerhead itemstack into a block?

ebon shoal
#

ty i dont have errors now

ebon abyss
brittle badger
#

another question, how can i set a falling block to despawn in a tick

#

also for some reason, fallingblock doesnt work with skulls, is there a workaround?

ebon abyss
brittle badger
#

the fallingblock is invisible

sleek pond
#

What

#

Skulls aren't gravity blocks

brittle badger
#

i spawned them as fallingblocks

sleek pond
#

That probly why it doesn't work

brittle badger
#

?

young knoll
#

Some not-full-block blocks just don't render when falling

lost matrix
#

Someone willing to help me find a circular reference that causes a Gson StackOverflow?

eternal oxide
#

post some code noob

#

well the error helps too ๐Ÿ˜‰

#

Am I going to be flooded with a book sized set of classes now

lost matrix
#

The serialized class is RecipeManager
The method in question is FileManager#persistRecipeManager(RecipeManager)

Maybe i should add this important detail:
The deserialisation only flows into a StackOverflow if the manager was desierialized once then serialized again.
Not when a clean RecipeManager is serialized.

The serialisation happens with this method

  public RecipeManager loadOrCreateRecipeManager() {
    if (!this.recipesFile.exists()) {
      return new RecipeManager();
    }
    RecipeManager recipeManager = null;
    try {
      final String json = Files.readString(this.recipesFile.toPath());
      recipeManager = GsonProvider.fromJson(json, RecipeManager.class); // Here
      recipeManager.registerAllPostSerialisation();
    } catch (final IOException e) {
      e.printStackTrace();
    }
    return recipeManager == null ? new RecipeManager() : recipeManager;
  }
spring fog
#

Is it possible to spawn a structure for the pre-generated structures list?
For example, a method to spawn a full-blown Taiga village in front of the player (i don't care about lag)

#

Preferably without having to 'build' the structure with Minecraft's current structures (such as how everything is split up into an absurd amount of different pieces and parts)

young knoll
#

You'll probably need to start it with NMS and then trigger all the Jigsaw blocks

lost matrix
eternal oxide
spring fog
#

hmmm

lost matrix
spring fog
#

Is it at least possible to generate a structure of any kind with chests with loot tables (rather than static contents)?

lost matrix
lost matrix
spring fog
#

welp

lost matrix
#

One way would be using WorldEdit for pasting schematics and then getting all TileEntities in the affected chunks and generate loot for each state that inherits from InventoryHolder

spring fog
#

Ah WorldEdit schematics may work for what I'm doing

young knoll
#

I mean I did just show an API for that

brittle badger
#

how can i find all entities right in front of a player?

spring fog
lost matrix
spring fog
#

I just effectively need something to allow me to just place down an entire damn village within a command

eternal oxide
young knoll
#

If you save the schematic with loottables it can be loaded with loottables

spring fog
#

Without me needing to spend weeks lmfao

lost matrix
#

But ill re try just to be safe

brittle badger
#

that doesnt work

lost matrix
lost matrix
vague cypress
#

This might be a strange question, but I'm trying to make a server hosted off of my pc with port-forwarding and when I go to open the "server" java application I can see a window pop up for a second and then close. Any way to fix this?

eternal oxide
vague cypress
#

No eula ever popped up...

brittle badger
lost matrix
brittle badger
#

why doesnt this work?

#
BoundingBox bb = BoundingBox.of(event.getPlayer().getLocation(), 1, 2, 1);
        Collection<Entity> entities = event.getPlayer().getWorld().getNearbyEntities(bb);
        for (Entity e : entities) {
            if (e == null) {return;}
            if (!(e instanceof Snowball)) {return;}
            Snowball snowball = (Snowball) e;
            if (!Objects.equals(snowball.getCustomName(), "Dodgeball")) {return;}
            snowball.setVelocity(snowball.getVelocity().multiply(-1));
            System.out.println("WOOT!");
            snowball.setTicksLived(0);
        }```
eternal oxide
#

you are returnign out of the for loop, continue

lost matrix
brittle badger
#

thanks!

brittle badger
#

is it possible to prevent a falling block from becoming a block

lost matrix
#

Sure listen for the EntityChangeBlockEvent and check if the entity is instanceof FallingBlock
Then cancel it

drowsy crest
#

Hey hey! How would I go about viewing net.minecraft server code? I understand to modify this, need to use reflection. I want to do some stuff with wandering villager trades

lost matrix
drowsy crest
#

I use gradle

lost matrix
#

Then change the spigot-api artifact to just spigot
And make sure the BuildTools ran at least once so the sources are installed in your local maven repository.

drowsy crest
#

hmm when I change

    compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT'
}```
to
```dependencies {
    compileOnly 'org.spigotmc:spigot:1.16.5-R0.1-SNAPSHOT'
}```

doesn't seem to do anything or am I wrong
drowsy crest
crude charm
#
    public void onDamage(){
        Events.subscribe(EntityDamageEvent.class)
                .handler(e -> {

                    Player player = (Player) e.getEntity();
//                    if (!(e.getEntityType() == EntityType.PLAYER)) return;

                    player.sendMessage("You took damage!");
                    e.setDamage(0);
//                    e.setCancelled(true);
                });

why is this not working? it prints the debug message.

#

and my //'s are just for testing

lost matrix
#

Events.subscribe <- what this?

lusty cipher
#

Which JDK / language version should one use for building Bukkit plugins for versions 1.14 to 1.16?

crude charm
drowsy crest
#
    @EventHandler
    public void EntityDamagListener(EntityDamageEvent event) {

        if (event.getEntity() instanceof Player) {
            // blah do stuff
        }
        
        
    }```
young knoll
drowsy crest
#

think that should be code

crude charm
#

no

lusty cipher
#

galacticraft dev also does bukkit :o?

drowsy crest
crude charm
#

I do

lusty cipher
drowsy crest
crude charm
#

the event works

young knoll
#

Mhm

crude charm
#

but canceling doesent

young knoll
#

I imagine this is an issue with whatever API

drowsy crest
crude charm
young knoll
#

Or an issue with other plugins

lusty cipher
drowsy crest
#

^

drowsy crest
crude charm
young knoll
#

You can try increasing the priority to highest

#

That will hopefully rule out any other plugins messing with it

crude charm
#

ok

#

it seems to work half the time

#

but fall damage and lava work

#

but drowning does

#

by does I mean u dont and doesent means you do

#

after adding a method named "solveWorldHunger" it seems to work lmfao

quaint mantle
#

Small question, would it be to heavy to put the mute check query on chat event ?

crude charm
#

check if the player is muted when they join

#

and then use an array list

quaint mantle
crude charm
#

copy cat

quaint mantle
#

nah

#

already was typeing

crude charm
quaint mantle
#

Xd, had this on login event first. I'll revert it back then ๐Ÿ™‚

young knoll
#

I mean itโ€™s an async event

#

So it probably doesnโ€™t matter too much

crude charm
#

yea it does, if u query every time it will

a) lag
b) delay the "you are muted" message

young knoll
#

But yes you should always cache database access

#

It wonโ€™t lag the server

crude charm
#

the db

young knoll
#

But yes it will delay the message

crude charm
#

if 100 people are getting if they are muted at the same time

#

the db will lag

young knoll
#

Thatโ€™s the databases problem :p

crude charm
#

it doesent have to be if you optimise the code pepewink

quaint mantle
#

Could just remove the message :p

crude charm
#

then it looks dumb

#

if they type and it does nothing

quaint mantle
#

That's true :p

#

if your db is lagging when checking if 100 people are muted at once your db might be underpowered

floral schooner
#

hey so I have all these plugins in my plugins folder but when I restart WE doesn't show up?

stone sinew
drowsy crest
#

but glad you got it

cinder thistle
#

Event priority should be first to last rather than low to high

quaint mantle
#

Hello, anyone knows how to change the amount of xp points to levels?

#

Like 11 xp to: 2 Levels

#

?jd

vast dome
#

does anyone know of a way to put a block onto an armor stand? ive tried

``` but it didnt work
eternal oxide
#

nothing wrong with that code

#

did you try creating an actual helmet and trying that first?

vast dome
#

well i just tried

ArmorStand block = (ArmorStand) location.getWorld().spawnEntity(location, EntityType.ARMOR_STAND);
block.setHelmet(new ItemStack(Material.DIAMOND_HELMET));

but the armor stand didnt get a helmet

stone sinew
vast dome
#

i just right clicked the armor stand and got a helmet but it doesnt show

humble heath
#

this line causes an error in my console

#

PrivateVailt.menu = (Map<String, ItemStack[]>)PlayerData.getPlayerDataConfig().get("menu", new HashMap<>());

vast dome
#

ok well the dirt block randomly worked but is there a way to make it so that there is a dirt block in place of it but not down scaled to the head

eternal oxide
humble heath
eternal oxide
#

Yep you tried to cast to a Map when you can;t do that

humble heath
#

so how do i get the map to load back in

eternal oxide
#

you use .getValues(true) on the returned MemorySection

humble heath
#

where that

eternal oxide
#

thats the result of yoru get method call

humble heath
#

where would i put that

woven coral
#

how do I add an entity to a scoreboards team?

#

since I want to change their glow color

sour sand
#

is there a way to add data like from a datapack. i am tring to make an advancement and to do that i need to be able to use a datapack is there a way to have one inbuilt into my plugin

outer crane
#

you need to use NameSpacedKeys

sour sand
#

ok but how do i use those

drowsy crest
#

Hey how would I go about modifying existing variables in a entity from a Bukkit entity?

I'm trying to modify the protected MerchantRecipeList trades; variable in EntityVillagerAbstract with NMS and Reflection. New to the whole reflections API and using Spigot NMS but for reference, something like this is what I'm trying to do if that helps clarify

    @EventHandler()
    public void CreatureSpawnListener(CreatureSpawnEvent event) {
        if (event.getEntity() instanceof WanderingTrader) {
            WanderingTrader trader = (WanderingTrader) event.getEntity();
            VillagerUtils.clearVillagerTrades(trader); // cast error
            

        }
    }```

```java
public class VillagerUtils {


    public static void clearVillagerTrades(EntityVillagerAbstract trader) {
        try {

            Field field = trader.getClass().getDeclaredField("trades");
            field.setAccessible(true);
            field.set(trader, null);
            field.setAccessible(false);

        } catch (NoSuchFieldException | IllegalAccessException e) {
            e.printStackTrace();
        }
    }

}```
#

think I'm on the verge of something actually

            WanderingTrader trader = (WanderingTrader) event.getEntity();
            EntityVillagerAbstract nmsVillager = ((CraftWanderingTrader) trader).getHandle();
sullen marlin
#

why do you need NMS for this

drowsy crest
#

I'm trying to clear trades to replace with something else. Thank you I'll check this out ๐Ÿ™‚

sullen marlin
#

which you dont need NMS for, see API above

grand cove
#

Is it possible to create a custom event for a player server action which is not currently supported by spigot? (like smithing)

eternal oxide
#

You can create any events you want. But plugins need to specifically listen for them

grand cove
#

Yea understandable, but where can I get the server "actions"

eternal oxide
#

If you mean you want to inject your event actions into the Bukkit enums, you can't

grand cove
#

I don't really know, I just want to add an event for smith crafting

outer crane
#

fork spigot?

eternal oxide
#

smith crafting?

outer crane
#

also that ^

grand cove
#

but not the crafting event

#

like this one

#

I would need a SmithItemEvent

outer crane
#

what are you trying to do with that event

grand cove
#

Adding an upgrade % chance of failure :)

eternal oxide
#

use the prepare event to add teh percentage as Lore, then detect on inventory click event when the item is removed to create the finished item

grand cove
#

interesting

#

I'll go for that, thanks !

novel lodge
#

In the same fashion as Hypixel Skyblock how could I make items different on the server side but not on the client side?

#

E.g. having two different weapons with 2 different IDs show as the same item on the client side

#

Is this only obtainable via mods?

eternal night
#

Is that item supposed to stack onto the other same looking item o.O

#

Because that would kinda ruin you

#

At least from a plugin perspective

eternal oxide
#

You store their datas in their PDC/meta

eternal night
#

^ which makes them unstackeable

eternal oxide
#

Then you apply their effects when they are used

eternal night
#

Well,if they have different PDC values

sullen marlin
grand cove
#

LOL

#

whaat

#

niiice

#

thanks โค๏ธ

eternal night
#

Yeah then stick to PDC and you should be good

novel lodge
#

ok

vapid oyster
#

I'm trying to work with MySQL and I use this method to check if a player exists. JAVA public boolean exists(UUID uuid, String pointType) { try { PreparedStatement ps = plugin.SQL.getConnection().prepareStatement("SELECT pointType FROM ac_daily_login WHERE uuid=? AND pointType=?"); ps.setString(1, pointType); ps.setString(2, uuid.toString()); ps.setString(3, pointType); ResultSet results = ps.executeQuery(); if (results.next()) { return true; } else { return false; } } catch (SQLException e) { plugin.getLogger().log(Level.SEVERE, ChatColor.RED + "Failed to check if Exists!", e); return false; } }What I want to do though, is check if the UUID and pointType exists in the same column, because I want to create a column for every pointType for each player.
This is an example of my table, I'm wanting to store each Material and Amount a player mines for every Material

eternal oxide
#

That code is blocking and will lag your server

vapid oyster
#

What do you mean?

eternal oxide
#

you are running single threaded

#

teh server is going to freeze untill your database responds

#

in your SCHEMA the players UUID shoudl be the unique key

#

names can change

vapid oyster
eternal oxide
#

k

vapid oyster
eternal oxide
#

I'd probably do a table per player

#

it would hold the pointType and amount

#

use the player uuid as the table name

vapid oyster
#

Huh, ya I guess I could, thanks for the idea!

eternal night
#

Table per player what

#

No please do not do that

eternal oxide
#

he's wanting to store a total for each type of block broken by each player

eternal night
#

What prevents a simple uuid + material primary key ?

#

Variable table names in SQL defeat the entire purpose

eternal oxide
#

I guess you could use column name for teh block type

earnest junco
eternal oxide
#

true

#

however that would be a pain to clean up

#

you'd have to check every block type

eternal night
#

What ? XD

#

delete from table where uuid = ?

#

Would still work just as fine

eternal oxide
#

If you are creating a key based on the players uuid and the block type

eternal night
#

Compound keys aren't a single collum o.O

eternal oxide
#

ah, sorry you didnt; say a compound key, I thought you meant a single key composed of teh two objects.

eternal night
#

Oh sorry, yeah my bad

#

Ye just compound primary key of uuid and material

#

Should deliver just what is needed here

vapid oyster
#

Is this the correct way to set a UNIQUE constraint? prepareStatement("CREATE TABLE IF NOT EXISTS ac_daily_login " + "(name VARCHAR(100),uuid VARCHAR(100) UNIQUE,pointType VARCHAR(100),pointAmount BIGINT(100),PRIMARY KEY (name));")

eternal oxide
#

no

#

FIrst, your primary key shoudl not be name

vapid oyster
#

Should it be UUID?

eternal oxide
#

yes

#

well it was agreed it shoudl be a key pair

vapid oyster
#

Ok, so after reading that I've come up with JAVA ps = plugin.SQL.getConnection().prepareStatement("CREATE TABLE IF NOT EXISTS ac_daily_login " + "(name VARCHAR(100),uuid VARCHAR(100) UNIQUE,pointType VARCHAR(100),pointAmount BIGINT(100), CONSTRAINT ac_daily_login PRIMARY KEY (uuid, pointType));");

eternal oxide
#

take unique off the uuid column

#

as you are using a key pair you will have duplicate uuids

eternal night
#

Also your constraint name should probably not be the same as the table XD

#

Just add a _pk at the end

#

Or Smth like that

vapid oyster
vapid oyster
#

Also could you guys let me know if this method seems correct? JAVA public void createPlayer(Player player, String pointType, long pointAmount) { try { // if (!exists(player.getUniqueId(), pointType)) { PreparedStatement ps2 = plugin.SQL.getConnection().prepareStatement("INSERT INTO ac_daily_login (name,uuid,pointType,pointAmount) VALUES (?,?,?,?) " + "ON DUPLICATE KEY UPDATE pointAmount=pointAmount+?;"); ps2.setString(1, player.getName()); ps2.setString(2, player.getUniqueId().toString()); ps2.setString(3, pointType); ps2.setLong(4, pointAmount); ps2.setLong(5, pointAmount); ps2.executeUpdate(); return; // } } catch (SQLException e) { plugin.getLogger().log(Level.SEVERE, ChatColor.RED + "Failed to create Player!", e); } }

#

It seems to be working fine, but just want to make sure that looks good. I run that each time a Player Breaks a block

young knoll
#

Hopefully async

eternal oxide
#

Not yet

#

this is his first attempt so no threading

vapid oyster
#

Ya not async yet, but just wanted to make sure I had the basics down before jumping ahead

young knoll
#

Itโ€™s annoying that on duplicate key update still increments auto increment columns

vapid oyster
#

I totally agree!

crude charm
#
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile (default-compile) on project assemble: Fatal error compiling: java.lang.ExceptionInInitializerError: com.sun.tools.javac.code.TypeTags -> [Help 1]
eternal oxide
#

Not enough info

full sand
#

Hey I got a problem I have an even to format chat but when I have luckperms and have there prefix, the prefix won't show up in chat. how do I fix that?

@EventHandler
    public void rgbMessage(AsyncPlayerChatEvent e){
        String message = translateHexColorCodes("&#", "", e.getMessage());
        Player p = e.getPlayer();
        e.setMessage(message);
        e.setFormat(ChatColor.translateAlternateColorCodes('&', config.getString("ChatFormat.Format").replace("%displayname%",p.getDisplayName()).replace("%name%", p.getName()).replace("%message%",     
        e.getMessage())));
    }
crude charm
eternal oxide
#

I'm going to guess you havn't included a repository that has that dependency

crude charm
#

I also tried this

#

but it didnt work

#

did the same thing

eternal oxide
#

what repo are you adding to yoru pom to access those dependencies?

crude charm
#

the ones provided on the github page

#

<dependency>
<groupId>me.missionary</groupId>
<artifactId>board</artifactId>
<version>1.1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>

#

and

eternal oxide
#

thats only appropriate IF you followed all their instructions on installing it locally

crude charm
#

for what one?

#

the former?

eternal oxide
#

the first one

crude charm
#

lms

eternal oxide
#

or, as it says to use jitpack

crude charm
#

how?

#

can I use maven and jitpck

eternal oxide
#

yes

crude charm
#

oh I see

eternal oxide
#
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>```
crude charm
#

yeah

#

ik

#

whats the version?

eternal oxide
#

whatever the release build is I guess

crude charm
#

why

#

tf

#

does

#

it

#

not

#

say

#

the

#

version

#

on the github page

full sand
#

Maybe try to find an other place to see its version

eternal oxide
#

1.1.0-SNAPSHOT it says in its pom

crude charm
#

ik

#

but it didnt work

#

Itried that

eternal oxide
#

have you just tried the code it says in jitpack?

crude charm
#

it has a placeholder for version

glass sparrow
crude charm
#

ok

eternal oxide
#

thats looking on spigot. You have added jitpack I hope

crude charm
glass sparrow
#

no

crude charm
#

ohim

#

so

#

dumb

#

KLMDAO

glass sparrow
#

remove <repositories>

crude charm
#

sdfgdsg

#

yeah ik

glass sparrow
#

cool

crude charm
#

but still

eternal oxide
#

still only spigot

crude charm
glass sparrow
#

try 1.0-SNAPSHOT or the github short hash

crude charm
#

ok

#

I tried it before

#

and it didnt work

eternal oxide
#

else change the order of your repos. They are searched in order after local

crude charm
#

ok

eternal oxide
#

that should be 1.1.0-SNAPSHOT

crude charm
#

moved jitpack first

eternal oxide
#

then try the hash

crude charm
#

wdym

glass sparrow
#

wheres the jitpack link?

eternal oxide
#

055208be5d

crude charm
#

working

#

uts working

#

the hash is working

glass sparrow
#

hashes always work

crude charm
#

time for MAYBE more issues :/

#

1 sec

#

yup

#

issues

#

huh

humble heath
eternal oxide
#

Did you try to clone its repo even though you are now using jitpack?

crude charm
#

ye I tried to cloneit

eternal oxide
#

you don;t need to

crude charm
#

why

#

I want a jar

#

to depend

eternal oxide
#

you are now getting it from jitpack

crude charm
#

no

#

for the server

eternal oxide
#

look in your .m2 folder

crude charm
#

I read about this folder

eternal oxide
#

actually, you have no scope on it, its proably been shaded into yoru jar

crude charm
#

so I dont need it?

#

it will run

#

without the depend jar?

#

running

eternal oxide
#

if its been shaded it will

crude charm
#

ok

rigid hazel
#

Because a console cant click. xD

fading lake
#

because youre only invoking it on the player that clicks it

rain flint
#

Hey, I have created a class CustomBlock, which contains the block itself + custom methods. I have a list containing all those customBlocks, and when one is created, it's added to the list (which is correctly done I checked). But then, from the CustomBlock class, I check if it's still "valid" (= if it's in the list), using customBlockList.contains(this) But it's always returning false, what am I doing wrong ?

(so my final code looks like this)

myClass:

customBlockList.add(new CustomBlock(data));


CustomBlock:

public boolean isValid() {
  return cusotmBlockList.contains(this);
}
rigid hazel
#

@rain flint Show more code please

fading lake
#

what class are you extending

rigid hazel
rain flint
#

I do not extend any class

fading lake
#

theres your issue

fading lake
rain flint
#

Why is it an issue ?

rigid hazel
#
                                AbstractArrow bulletArrow = player.launchProjectile(Arrow.class);
                                ItemMeta bulletArrwoMeta = bulletArrow.getItemStack().getItemMeta();
                                bulletArrwoMeta.setCustomModelData(this.plugin.getRocket().id);
                                bulletArrow.getItemStack().setItemMeta(bulletArrwoMeta);
                                final int[] i = {0};
                                Bukkit.getScheduler().scheduleSyncRepeatingTask(this.plugin, new BukkitRunnable() {
                                    @Override
                                    public void run() {
                                        bulletArrow.setVelocity(target.getLocation().getDirection().multiply(5));
                                        i[0] += 1;
                                        if(i[0] >= 4)
                                        {
                                            bulletArrow.getWorld().createExplosion(bulletArrow.getLocation(), 6);
                                            cancel();
                                        }
                                    }
                                }, 0, 20);```
fading lake
rigid hazel
rain flint
#

A reference, my constructor is CustomBlock(Block block) { this.block = block; }

rigid hazel
#
java.lang.UnsupportedOperationException: Use BukkitRunnable#runTaskTimer(Plugin, long, long)
        at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.scheduleSyncRepeatingTask(CraftScheduler.java:600) ~[patched_1.16.5.jar:git-Paper-466]
        at de.cimeyclust.custom_items.RocketLauncher.onShoot(RocketLauncher.java:115) ~[?:?]
        at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor25.execute(Unknown Source) ~[?:?]
        at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.16.5.jar:git-Paper-466]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.16.5.jar:git-Paper-466]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.16.5.jar:git-Paper-466]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:607) ~[patched_1.16.5.jar:git-Paper-466]
        at org.bukkit.craftbukkit.v1_16_R3.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:528) ~[patched_1.16.5.jar:git-Paper-466]
        at org.bukkit.craftbukkit.v1_16_R3.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:491) ~[patched_1.16.5.jar:git-Paper-466]
        at org.bukkit.craftbukkit.v1_16_R3.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:486) ~[patched_1.16.5.jar:git-Paper-466]
        at org.bukkit.craftbukkit.v1_16_R3.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:482) ~[patched_1.16.5.jar:git-Paper-466]```
fading lake
#

you probably need to create your own .equals then

#

put this in your class

@Override
public boolean equals(Object obj) {
  if (!(obj instanceof CustomBlock)) return false;
  return ((CustomBlock) obj).block.equals(block);
}
rain flint
#

Shouldn't them always be equals ? Like new CustomBlock() == (inside CustomBlock) this

fading lake
rigid hazel
rain flint
rigid hazel
#

I'm not sure, because of that i ask here

chrome beacon
rigid hazel
fading lake
chrome beacon
#

^^

ivory sleet
#

Isnโ€™t scheduleSyncRepeatingTask just calling runTaskTimer or smtng internally

earnest junco
#

"that old bs method" calls exactly the method you just posted kek

fading lake
crude charm
#

its not working :/

rigid hazel
#

@chrome beacon But .runTaskTimer() return BukkitTask not BukkitRunnable

#

What should I do?

crude charm
#

@eternal oxide

rigid hazel
#
                                Bukkit.getScheduler().scheduleSyncRepeatingTask(this.plugin, new BukkitRunnable() {
                                    @Override
                                    public void run() {
                                        bulletArrow.setVelocity(target.getLocation().getDirection().multiply(5));
                                        i[0] += 1;
                                        if(i[0] >= 4)
                                        {
                                            bulletArrow.getWorld().createExplosion(bulletArrow.getLocation(), 6);
                                            cancel();
                                        }
                                    }
                                }.runTaskTimer(this.plugin, 0L, 20L));```
#

What is my mistake?

fading lake
#
BukkitRunnable task = new BukkitRunnable() {
  @Override
  public void run() {
    
  }
};

task.runTaskTimer(plugin, 0, 20);
``` ๐Ÿค”
rigid hazel
#

Oh.

fading lake
#

wait#

#

hold up

rigid hazel
#

I dont need thi stuff before

fading lake
#

wait

rigid hazel
#

Okay

fading lake
#

replace the entire thing with this

BukkitRunnable task = new BukkitRunnable() {
  @Override
  public void run() {
    bulletArrow.setVelocity(target.getLocation().getDirection().multiply(5));
                                        i[0] += 1;
                                        if(i[0] >= 4)
                                        {
                                            bulletArrow.getWorld().createExplosion(bulletArrow.getLocation(), 6);
                                            cancel();
                                        }
  }
};

task.runTaskTimer(plugin, 0, 20);
``` get rid of the schedulesyncrepeatingtask thing
rigid hazel
#

Okay. I will try

earnest junco
#

i[0] += 1;
if(i[0] >= 4)
Looks like auto-generated code because you tried to change an outside variable inside your Runnable.
What are you attempting to do?

rigid hazel
#

"Looks like auto-generated code" 10/10

crude charm
#

can someone help me please

#

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project board: Fatal error compiling: java.lang.ExceptionInInitializerError: com.sun.tools.javac.code.TypeTags -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
zoibox@Williams-MacBook-Pro board %

fading lake
#

and how exactly have you broken maven

lost depot
#

how can i make an event handler for all player events? I tried to listen to PlayerEvent cause thats the super for all of them, but that ends up giving me an "Unable to find handler list" error on startup, so i guess that's not allowed?

crude charm
#

cd

#

mvn package

fading lake
#

afaik you can't youd have to listen to them all yourself

earnest junco
fading lake
fading lake
#

ikr

lost depot
#

thats dumb

crude charm
fading lake
#

interesting error

#

uhh

#

is there any errors in your pom.xml?

crude charm
#

idk

#

lms

full sand
#

Hey I got a problem I have an even to format chat but when I have luckperms and have there prefix, the prefix won't show up in chat. how do I fix that?

@EventHandler
public void rgbMessage(AsyncPlayerChatEvent e){
String message = translateHexColorCodes("&#", "", e.getMessage());
Player p = e.getPlayer();
e.setMessage(message);
e.setFormat(ChatColor.translateAlternateColorCodes('&', config.getString("ChatFormat.Format").replace("%displayname%",p.getDisplayName()).replace("%name%", p.getName()).replace("%message%",
e.getMessage())));
}

crude charm
#

no

#

nope

#
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>me.missionary</groupId>
    <artifactId>board</artifactId>
    <version>1.1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>Board</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <defaultGoal>clean package install</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.7.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>spigotmc-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.bukkit</groupId>
            <artifactId>bukkit</artifactId>
            <version>1.8.8-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.16.20</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</project>

fading lake
#

lol why are you importing the bukkit dependency

crude charm
#

its not mine :/

fading lake
#

oh

crude charm
#

so...

fading lake
#

it could be an issue with the maven compiler

#

select all the maven compiler plugin stuff between the <plugin></plugin> and paste

<version>3.8.1</version>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>8</source>
                    <target>8</target>
                    <compilerArgs>
                        <arg>-parameters</arg>
                    </compilerArgs>
                </configuration>

in

crude charm
#

ok

#

there is no maven compiler stuff :/

#

ill just add it

fading lake
#

๐Ÿค”

crude charm
#

nothing in between plugin

fading lake
#

what

crude charm
fading lake
#

o________________o

crude charm
#

im blind

#

lmfao

fading lake
#

mmmmmmm

#

should've gone to specsavers

#

yeah replace whats in that with what I pasted

crude charm
fading lake
#

try executing the mvn package now

crude charm
#

oh no

#

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project board: Fatal error compiling: java.lang.ExceptionInInitializerError: com.sun.tools.javac.code.TypeTags -> [Help 1]

fading lake
#

try removing the default goal line weird its working for me

crude charm
#

like compiling the same thing?

#

1 sec

#

try compile that

fading lake
#

aight

#

are you using the intellij buttons or the mvn command?

crude charm
#

mvn

#

u do u tho

#

I literally did

git clone
cd board
mvn package

fading lake
#

wait are you using intellij? how are you executing the maven commands

#

oh here we go I see

main dew
#

how I can check loaded chunk for player?

fading lake
#

@main dew you cant since thats clientside

crude charm
#

I did it in mac terminal before

#

but it also works in intelliJ

main dew
quaint mantle
#

Hi ! I need help with my plugin, it make some Post Request, all fine when I declared the url String inside the HTTPSPostRequest class, but now I'm trying to get that from the config.yml file and I get "Could not pass event PlayerAdvancementDoneEvent to TestPlugin2 v1.0"

Can someone help me? Thanks! I can share my code if needed...

main dew
fading lake
crude charm
#

did it work for u

#

im guessing not

#

whats wrong

fading lake
#

no im looking at it now

crude charm
#

ok

main dew
#

Server must know what chunk should send to player

crude charm
#

waste of memory

fading lake
#

you can check if its loaded entirely with Chunk#isLoaded

main dew
#

I don't want this

crude charm
#

but thats not what one its about to send

#

u cant find that

main dew
crude charm
#

as I said

eternal night
#

Pretty certain there is a PlayerChunkMap

crude charm
#

the server doesent store it

main dew
#

server must know this

eternal night
#

Yeah server definitely knows this

#

Else it would have to broadcast every single packet

#

To every single player

crude charm
#

im saying the server wouldn't store it

#

it would get it

#

not store it

eternal oxide
#

The server knows where every player is and it knows what chunks it has loaded

crude charm
#

thats not what he wants tho

#

ik that

#

but say what chunk the player will next load

#

or will load in 500 blocks

eternal oxide
#

impossible until the player moves and the server decides

crude charm
#

yea

#

thats what im saying

main dew
crude charm
#

@fading lake any update fixing that annoying pom

fading lake
#

not yet itskindathrowing me

eternal oxide
#

if you need to do somethign with chunks you can monitor the chunk load event

main dew
#

I would like to use contains

crude charm
#

@eternal oxide remember that pom issue before

#

well, im still getting it

#

:/

main dew
eternal oxide
crude charm
#

easier

fading lake
#

^

crude charm
#

cleaner

fading lake
#

cant you just steal one off spigotmc or github

#

like a normal pers

crude charm
#

I did

eternal oxide
#

not really, theres very little to creating and managing scoreboards

crude charm
#

depends

#

using an api for what im doing is just easier for me

fading lake
#

what does an api give you that something you create doesnt

crude charm
#

actually

#

I could just make my own util

fading lake
#

nO wAY

crude charm
#

ikr

#

ground breaking

fading lake
#
public class ScoreboardUtil {
    private final Scoreboard scoreboard;
    private final Objective objective;

    public ScoreboardUtil() {
        scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
        objective = scoreboard.registerNewObjective("Board", "dummy");

        objective.setDisplaySlot(DisplaySlot.SIDEBAR);
    }

    public ScoreboardUtil(Player player) {
        scoreboard = player.getScoreboard();
        objective = scoreboard.getObjective(DisplaySlot.SIDEBAR);
    }

    public Scoreboard getScoreboard() {
        return scoreboard;
    }

    public String getTitle() {
        return objective.getDisplayName();
    }

    public void setTitle(String name) {
        objective.setDisplayName(name);
    }

    public void set(int row, String text) {
        if (16 > row) {
            if(text.length() > 32) { text = text.substring(0, 32); }

            remove(row);

            objective.getScore(text).setScore(row);
        } else {
            throw new IndexOutOfBoundsException("row cannot be higher than 16");
        }
    }

    public void remove(int row) {
        for(String entry : scoreboard.getEntries()) {
            if(objective.getScore(entry).getScore() == row) {
                scoreboard.resetScores(entry);
                break;
            }
        }
    }
}
#

ezpz

eternal oxide
#

well, have you looked in yoru .m2 folder? as you have built your plugin you shoudl now have that api in yrou local

crude charm
#

and we all know

#

time equals

#

bruh

#

@fading lake I need to know something

#

something very important

#

this will change space and time as we know it

cedar meadow
#

whats this error

crude charm
#

does it update automatically?

fading lake
#

wdym

cedar meadow
#

its essentialsx

crude charm
#

does it update

fading lake
# cedar meadow

if youre using maven, try shading essentialsx into your repo

crude charm
#

is it static or dynamic

cedar meadow
#

i am not

#

its a error in the server

#

console

fading lake
#

which is coming from your plugin, what version is the server?

fading lake
cedar meadow
#

1.8.9

fading lake
#

what version of the API are you using?

cedar meadow
#

idk not my server

fading lake
#

no

#

wait

cedar meadow
#

im just developing it for them -_-

#

but i cant find out what this error is

fading lake
#

nono, what api are you using

#

whats the version of it

sleek pond
#

What mc server version

fading lake
#

the api that allows you to use spigot stuff in your plugin

cedar meadow
#

1.8

fading lake
sleek pond
#

Oh

#

Yeah

fading lake
#

so your API version is higher than your mc version @cedar meadow

cedar meadow
#

not really

#

im using 1.8 aswell

sleek pond
#

Factions

fading lake
#

1.8 doesnt have PotionData

sleek pond
#

Somewhere random in the plugin

cedar meadow
#

its either 1.8.9 or 1.8

cedar meadow
fading lake
#

what ide are you using?

sleek pond
#

If you type BlockType.BLACKSTONE does it give and error?

outer crane
crude charm
#

@fading lake can u plz give me a code example bigeyesmakebigcrys

sleek pond
#

Mspaintide

fading lake
crude charm
ivory sleet
outer crane
#

vim is too bloated

#

runs

quaint mantle
cedar meadow
#

thats the error

sleek pond
#

Use ?paste

outer crane
sleek pond
#

?paste

queen dragonBOT
outer crane
fading lake
sleek pond
#

Lmao

cedar meadow
queen dragonBOT
sleek pond
#

Bruh

#

Its a paste site

fading lake
sleek pond
#

Click the link

#

Paste your stuff

cedar meadow
#

how to fix it

fading lake
sleek pond
#

And do control and s

#

And copy the link at the top

crude charm
#

and it does the rest

fading lake
#

yes

cedar meadow
crude charm
#

can I use a list

#

in the set line

fading lake
#

no

lost matrix
crude charm
#

ok

fading lake
#

yeah I just realised hes trying to do stuff with essentials

fading lake
#

wait

#

sorry

cedar meadow
#

ik that

#

some1 told me to put that in

#

then send the error

fading lake
#

if so, you've got the wrong version

cedar meadow
#

yeh.

#

kits need work

lost matrix
quaint mantle
fading lake
#

who uses 1.8

olive jungle
#

I have a really quick question with BlockPopulators and the vanilla ones. If I wanted to replace JUST the vanilla tree populator, would it be possible to do so without the need to rewrite the entire Chunk Generator. Because to my knowledge, world.getpopulators only returns the populators without telling me which one of them is the tree populator that I want to replace.

fading lake
quaint mantle
chrome beacon
#

Also don't send web requests on the main thread

quaint mantle
lost matrix
fading lake
#

you have multiple classes extending JavaPlugin?

quaint mantle
full sand
#

Hey I got a problem I have an even to format chat but when I have luckperms and have there prefix, the prefix won't show up in chat. how do I fix that?

@EventHandler
public void rgbMessage(AsyncPlayerChatEvent e){
String message = translateHexColorCodes("&#", "", e.getMessage());
Player p = e.getPlayer();
e.setMessage(message);
e.setFormat(ChatColor.translateAlternateColorCodes('&', config.getString("ChatFormat.Format").replace("%displayname%",p.getDisplayName()).replace("%name%", p.getName()).replace("%message%",
e.getMessage())));
}

quaint mantle
#

That's why I extended it

chrome beacon
#

Yeah that won't work

fading lake
#

use dependency injection to send an instance of your main class to the event class, with that you can get the config

lost matrix
full sand
#

but what about other plugins that change the chat?

lost matrix
sleek pond
opal juniper
#

lmao

#

python is pretty fun tho

chrome beacon
#

Java > Python

sleek pond
#

C# > Java

opal juniper
#

I mean, it depends. I am all for java & Python

#

It depends on what you are doing

sleek pond
#

Hey

quaint mantle
#

Well, thanks for your help

sleek pond
#

Let's not spoil the fun jeff

opal juniper
#

๐Ÿ˜„

sleek pond
#

Some language competition is nice for the consumer

chrome beacon
#

True Python has less boilerplate

sleek pond
#

By less u mean none

chrome beacon
#

Yea

opal juniper
#

well, depends on how good you are

fading lake
opal juniper
#

i have seen some pretty garbage code from my friends in python

#

like once, there was 2 functions that they made, cause one had one line that was diffrerent. Each was 100 lines

crude charm
opal juniper
#

Why do people use c# for game dev? what about it is so good ?

chrome beacon
#

Unity uses C#

opal juniper
#

Yeah, is that why?

chrome beacon
#

Unreal uses C++

crude charm
#

@fading lake HELP!!!!!!!!

eternal oxide
#

I like Java as its platform agnostic

opal juniper
#

like, just in general why is C good for games

fading lake
crude charm
#

now

#

its going to be something dumb

#

because I havent read the error

chrome beacon
fading lake
#

wait what

opal juniper
fading lake
#

how is org.bukkit.Bukkit.getScoreboardManager() null

crude charm
#

c# > c++

crude charm
crude charm
#
package me.zoibox.hub.hub.scoreboard;

import me.lucko.helper.Events;
import me.zoibox.hub.hub.Hub;
import me.zoibox.hub.hub.utils.BungeeChannelApi;
import me.zoibox.hub.hub.utils.ScoreboardUtil;
import me.zoibox.hub.hub.utils.chat.CC;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerJoinEvent;

import java.util.ArrayList;
import java.util.List;

public class ScoreboardHandler {

    ScoreboardUtil scoreboardUtil = new ScoreboardUtil();


    private final Hub hub;
    private BungeeChannelApi bungeeChannelApi;

    public ScoreboardHandler(Hub hub){
        this.hub = hub;
        this.bungeeChannelApi = new BungeeChannelApi(hub);
    }

    int test = 1;

    public void createScoreboard(Player player) {
        scoreboardUtil.setTitle(Hub.mainColour + Hub.serverName);
        scoreboardUtil.set(0, Hub.ambientColour + "---------------------------");
        scoreboardUtil.set(1, Hub.mainColour + "Online Players: " + bungeeChannelApi.getPlayerCount("total"));
        scoreboardUtil.set(2, String.valueOf(test));
        scoreboardUtil.set(5, Hub.ambientColour + "--------------------------- ");

    }


    public void setScoreboard() {

        Events.subscribe(PlayerJoinEvent.class)
            .handler(event -> {

                Player player = event.getPlayer();
                player.setScoreboard(scoreboardUtil.getScoreboard());
                test++;

            });




    }

}

chrome beacon
#

?paste

queen dragonBOT
eternal oxide
crude charm
#

I cant copy\

#

:/

eternal oxide
#

of course you can. its in your latest.log

opal juniper
#

^^

crude charm
eternal oxide
#

show us ScoreboardUtil.java:15

crude charm
#

ok

#

there

#

(its nothingh)

#

blank

eternal oxide
#

impossible

opal juniper
#

can you send the method it is part of?

crude charm
#

oh util

#

๐Ÿ˜ 

fading lake
#

the line is objective = scoreboard.registerNewObjective("Board", "dummy"); @eternal oxide

crude charm
#

yea

opal juniper
#

huhhhhh, thats weird

crude charm
#

no its not

#

its this

#

scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();

opal juniper
#

funny man

crude charm
#

what

#

it is

eternal oxide
#

is this error when using that scoreboard API?

crude charm
#

no

#

@fading lake made this one ๐Ÿ™‚

fading lake
#

it was built for 1.8.9 so if they changed the way you make scoreboards, then welp

crude charm
#

im on 1.8.9

#

:/

opal juniper
#

idk why it would be null tho

eternal oxide
#

ok, You are attempting to initialize your Scoreboard before the server is started. Probably a Field in your main class so its being instanced as soon as your class is accessed

opal juniper
#

ooohhh, true

fading lake
#

oh yeah, you're supposed to create them per player, not at the start and send the same one to every player (I think? I havent used this util in a while)

#

wait

#

let me check

crude charm
#

ok

fading lake
#

yes, you make it and send it onto the player as they join

quaint mantle
fading lake
#

no

opal juniper
#

extremely illegal

#

life sentence kinda stuff

quaint mantle
#

and in PleromaMC.java:

FileConfiguration config = getConfig();
    
    public FileConfiguration thefile() {
        return config;
    }  
fading lake
#

where is HTTPSPostRequest instantiated

fading lake
crude charm
#

oh

quaint mantle
# fading lake where is HTTPSPostRequest instantiated
package com.kaonashi696.pleromamc;

import java.io.IOException;

import org.apache.commons.lang.StringUtils;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;

public class PlayerDeathListener implements Listener{
    
    @EventHandler
    public void onPlayerDeath(PlayerDeathEvent event) throws IOException {
        String deathMessage = event.getDeathMessage();
        if (StringUtils.isBlank(deathMessage)) return;
        
        HTTPSPostRequest.sendPOST("status=" + deathMessage);
    }

}
fading lake
#

where is PlayerDeathListener registered

quaint mantle
#

in PleromaMC

fading lake
#

show

quaint mantle
# fading lake show
public void onEnable() {        
        getServer().getPluginManager().registerEvents(new PlayerDeathListener(), this);
crude charm
#

how tf do I get an instance of player\

fading lake
#

inside PlayerDeathListener put this so it'd become PlayerDeathListener(this)

fading lake
crude charm
#

I use an api

fading lake
#

then you're fucked

fading lake
#

it should be throwing an error at you

#

is it?

quaint mantle
#

yes

fading lake
#

okay go to PlayerDeathListener

crude charm
#

nvm im just

#

really

#

reallu

#

really

#

dumb

fading lake
#

we know

crude charm
#

how do you feel

fading lake
#

put in

PleromaMC core;

public PlayerDeathListener(PleromaMC core) {
  this.core = core;
}
``` above the event listener
#

@quaint mantle

crude charm
#

uh oh

quaint mantle
fading lake
#

which one

quaint mantle
#

Oh no, sorry my mistake

#

No errors

fading lake
#

okay last thing

#

post the listeners source again

#

the listener

#

not the entire clas

crude charm
quaint mantle
#
@EventHandler
    public void onPlayerDeath(PlayerDeathEvent event) throws IOException {
        String deathMessage = event.getDeathMessage();
        if (StringUtils.isBlank(deathMessage)) return;
        
        HTTPSPostRequest.sendPOST("status=" + deathMessage);
    }
fading lake
crude charm
#

I sent class

fading lake
chrome beacon
#

You will kill the server

crude charm
#

?paste

queen dragonBOT
fading lake
crude charm
#

there

eternal oxide
#

line 73

crude charm
#

what about it

fading lake
#

move it to the thing thats executed when the player joins

fading lake
crude charm
#

ok

quaint mantle
#

yes

fading lake
#

okay good

#

go to HTTPSPostRequest

quaint mantle
# fading lake okay good

"The method sendPOST(String) in the type HTTPSPostRequest is not applicable for the arguments (PleromaMC, String)""

quaint mantle
fading lake
#

replace public static void sendPOST(String POST_PARAMS) throws IOException { with public static void sendPOST(PleromaMC core, String POST_PARAMS) throws IOException {

#

then instead of instantiating a PleromaMC instance, use core so core.getConfigorwhateverthemethodis

quaint mantle
#

no errors

fading lake
#

so send the sendpost method in chat

quaint mantle
#

so core.getString() for example

fading lake
#

no

#

core isnt a configurationsection

#

you need to use core.getConfig()

#

then .getString after that

#

i think

#

I cant remember the method to get the config from a plugin instance because im half asleep

quaint mantle
#

"getConfig cannot be resolved or is not a field"

fading lake
#

o_o

#

are you remembering the ()

#

and before anyone yells at me about static abuse, thats for debugging

crude charm
#

?paste

queen dragonBOT
quaint mantle
# fading lake o_o

And this?

FileConfiguration config = core.getConfig();
        String oauth = config.getString("oauth");
        String post_url = config.getString("post_url");
fading lake
#

that should be fine yeah

crude charm
#

no error

#

but doesent set one

fading lake
#

why are you loading the player listener weird

fading lake
crude charm
#

wdym

fading lake
#

no what do you mean

crude charm
quaint mantle
# fading lake that should be fine yeah

So sendPOST method:

public static void sendPOST(PleromaMC core, String POST_PARAMS) throws IOException {
        
        FileConfiguration config = core.getConfig();
        String oauth = config.getString("oauth");
        String post_url = config.getString("post_url");
        
        URL obj = new URL(post_url);
        HttpsURLConnection httpsURLConnection = (HttpsURLConnection) obj.openConnection();
        httpsURLConnection.setRequestMethod("POST");
        httpsURLConnection.setRequestProperty("Authorization","Bearer "+ oauth);

        // For POST only - START
        httpsURLConnection.setDoOutput(true);
        OutputStream os = httpsURLConnection.getOutputStream();
        os.write(POST_PARAMS.getBytes());
        os.flush();
        os.close();
        // For POST only - END

        int responseCode = httpsURLConnection.getResponseCode();
        System.out.println("POST Response Code :: " + responseCode);

        if (responseCode == HttpsURLConnection.HTTP_OK) { // success
            BufferedReader in = new BufferedReader(new InputStreamReader(httpsURLConnection.getInputStream()));
            String inputLine;
            StringBuffer response = new StringBuffer();

            while ((inputLine = in .readLine()) != null) {
                response.append(inputLine);
            } in .close();

            // print result
            System.out.println(response.toString());
        } else {
            System.out.println("POST request not worked");
        }
    }
crude charm
#

bruh

fading lake
crude charm
#

ye

#

hopefully

quaint mantle
#

xd

fading lake
#

auto moderator fuCK OFF

crude charm
#
    public void setScoreboard() {

        Events.subscribe(PlayerJoinEvent.class)
            .handler(event -> {

                Player player = event.getPlayer();
                player.setScoreboard(scoreboardUtil.getScoreboard());
                test++;

            });

quaint mantle
#

I saw the message, thanks @fading lake

#

So gonna test that and make the same for other listeners

quaint mantle
fading lake
#

yeah

#

basically

#

java has multithreading, so you know how you execute a method and it goes through it, it executes methods, waits for them to finish and then carries on

#

basically multithreading allows java to do multiple things at the same time

#

the problem with anything involving IO is that the server halts (waits) for it to finish which can cause insane lag spikes or crashes

#

so basically you're best running it asynchronously

fading lake
crude charm
#

but it dont

fading lake
#

huh

#

gimmie 5 mins

crude charm
#

o

#

m

#

gh

#

w

#

t

#

f

#

eighdidigdhgidiuhg

#

it workedI rejoined

#

and it worked

quaint mantle
fading lake
#

๐Ÿค”

fading lake
#

if you're not thinking of returning anything you should be fine

quaint mantle
#

Oke ๐Ÿ˜‹ thanks a lot again md_5

crude charm
#

ok now time to clean it up and hopefully not break it

fading lake
#

basically just do

new BukkitRunnable() {
  @Override
  public void run() {
    sendpostetc
  }
}.runTaskAsynchronously(core);
#

@quaint mantle ^

crude charm
#

@fading lake can you please help me ๐Ÿฅบ

fading lake
#

I thought you said you fixed it

crude charm
#

?paste

queen dragonBOT
crude charm
#

I fixed the scoreboard

#

but everything else. broke in the processes

fading lake
#

what

crude charm
#

no listeners

#

no commands

#

nothing in the loadmethod

fading lake
#

youve lost me I have no idea whwat you're trying to tell me

crude charm
#

nothing in the load method is working

#

its not running

fading lake
#

errors?

crude charm
#

not applicable

fading lake
#

load or loadplayer

crude charm
#

load

fading lake
#

is it because you don't call load()

crude charm
#

loadplayer is fine

#

?

fading lake
#

you dont call load()

crude charm
#

omg

#

m8

#

dfgfdgdfhdhdf

#

LMFAO

#

NO BULLY

fading lake
#

igiveup

crude charm
#

HAHAHAHAHA

rigid hazel
#
                                        double dX = player.getLocation().getX() - target.getLocation().getX();
                                        double dY = player.getLocation().getY() - target.getLocation().getY();
                                        double dZ = player.getLocation().getZ() - target.getLocation().getZ();

                                        double yaw = Math.atan2(dZ, dX);
                                        double pitch = Math.atan2(Math.sqrt(dZ * dZ + dX * dX), dY) + Math.PI;
                                        double X = Math.sin(pitch) * Math.cos(yaw);
                                        double Y = Math.sin(pitch) * Math.sin(yaw);
                                        double Z = Math.cos(pitch);

                                        Vector vector = new Vector(X, Y, Z);
                                        bulletArrow.setVelocity(vector);```
fading lake
#

I think you need to reinstall your brain today

crude charm
#

its midnight

fading lake
#

ah

rigid hazel
#

I try to set the velocity of an arrow to a player target

crude charm
#

ive been up till 5 the last 3 weeks

rigid hazel
#

But the arrow is always floating next to the target and dont it it

fading lake
#

wdym "floating next to the target"

rigid hazel
fading lake
#

that includes math, my brain has stopped

#

performs magical hand movements to summon 7smile7, elgarl, conclure or frostalf

eternal oxide
rigid hazel
eternal oxide
#

so a tracking arrow

rigid hazel
#

But the arrow always have the wrong vector as velocity

rigid hazel
eternal oxide
#

Are you trying to adjust it in flight?

novel lodge
#

How can I create a player entity?

rigid hazel
#

Is this wrong?

fading lake
#

use the citizens api

#

thats what everywhere like hypixel, cubecraft, mineplex etc does

eternal oxide
#
    public static Location getLocationWithTarget(final Location sourceLoc, final Location targetLoc) {
        
        Location delta = sourceLoc.clone().subtract(targetLoc);
        float distance =  (float) Math.sqrt(delta.getZ() * delta.getZ() + delta.getX() * delta.getX());
        float pitch = (float) Math.toDegrees(Math.atan2(delta.getY(), distance));
        float yaw = (float) Math.toDegrees(Math.atan2(delta.getZ(), delta.getX())+Math.PI/2);

        Location resultLoc = sourceLoc.clone();
        resultLoc.setPitch(pitch);
        resultLoc.setYaw(yaw);
        
        return resultLoc;
    }```This method returns a location with pitch and yaw to the target. From that you can get teh velocity
novel lodge
lost matrix
# fading lake use the citizens api

I mean citizens is (was) utter trash. There was a time where it occupied 20% of a tick just for running. Without any online user and one NPC standing at spawn.

eternal oxide
#

thats the location with adjusted pitch and yaw to teh destination

novel lodge
#

I've tried to add Citizens with AutoImport but apparently it doesn't exist

fading lake
#

the whole skyblock event thing a few days ago was an utter joke

#

tps dropped to like 9

rigid hazel
#

Or what?

eternal oxide
#

yes

rigid hazel
#

Okay

#

I will try

lost matrix
# rigid hazel I will try
  public void setTarget(final Projectile projectile, final Location targetLoc, final double velocity) {
    final Vector velocityVector = targetLoc.toVector().subtract(projectile.getLocation().toVector());
    velocityVector.normalize().multiply(velocity);
    projectile.setVelocity(velocityVector);
  }
#

Also make sure the projectile is not affected to gravity. But if you do this every tick then its not a concern.

rigid hazel
lost matrix
sand vector
#

is there any difference between if and case statements other than case being easier? Like speeds?

novel lodge
#

What is the most recent version of the citizens API

eternal oxide
#

@lost matrix why not use the vector length to set teh velocity?

#

that way you maintain whatever velocity was set before

lost matrix
lost matrix
rigid hazel
#

I only testet it on mobs and they arent running a lot but I'm sure this will follow targets too

ancient whale
#

Hey I'm looking to create an explosion on arrow hit, thing is, I need to keep track of the shooter in case someone dies to the explosion

@EventHandler
    public void onShootHit(ProjectileHitEvent e){

        if(!(e.getEntity() instanceof Arrow)) return;

        Arrow arrow = (Arrow) e.getEntity();

        if(!(arrow.getShooter() instanceof Player)) return;

        Player shooter = (Player) arrow.getShooter();

        Location targetLocation = e.getEntity().getLocation();

        TNTPrimed tnt = (TNTPrimed) targetLocation.getWorld().spawnEntity(targetLocation, EntityType.PRIMED_TNT);
        tnt.setFuseTicks(0);
        
        arrow.remove();
    }

This works well but sometime I can see the tnt before it explodes ๐Ÿ˜’

eternal oxide
#

set teh shooters uuid on the projectiles meta at launch

lost matrix
#

And the ProjectileLaunchEvent

eternal night
#

But why, doesn't get shooter work fine ?

ancient whale
#

I'm using 1.8.8 ๐Ÿ˜’

#

This code works fine, I actually store the tnt entity wih the shooter name in a hashmap

eternal oxide
#

so no pdc ๐Ÿ˜ฆ

ancient whale
#

But when it explodes, sometimes I can see the tnt

lost matrix
eternal oxide
#

oh you need the player for the tnt

eternal night
#

There should be a world.createExplosion method

#

I mean maybe not 1.8 is ancient

eternal oxide
#

primed tnt is an entity so you coudl still use meta

ancient whale
#

Yea, but How do I store the damager with this method

quaint mantle
#

when you shoot the arrow add the shooter's uuid and the arrow's uuid to a map

lost matrix
eternal oxide
#

I'd transfer shooter from the arrow to the primed tnt on hit, then in the explosion look for the meta to get the shooter.