#help-development

1 messages · Page 16 of 1

hoary perch
#

i just need to connect to the website to get the json

noble lantern
#

yes send a GET to it to the url you have, and read the JSON data returned back

Google is your best friend for this, you can do it in standard java without a lib

hoary perch
#
            json = HttpRequest.newBuilder()
                    .GET()
                    .uri(new URI("https://sessionserver.mojang.com/session/minecraft/profile/" + player.getUniqueId().toString().replace("-", "") + "?unsigned=false"))
                    .build()
                    .toString();```
would this work?
#

and then the json stuff

icy beacon
#

wasn't talking to you lol

noble lantern
#

try and see

Json you can use spigots built in Gson library import

#

in fact if you wanna be fancy you can parse it against a pojo class that matches the data result

#

However, if you wanna use something else for json, then feel free to but gson is provided by spigot so it helps make your jar less bulky with more libs compiled into it

somber sequoia
#

Does anyone know of a way to get your current project version from the pom inside of a plugin? I tried getClass().getPackage().getImplementationVersion() but it gives me null

worldly ingot
#

plugin.getDescription().getVersion(). Though this assumes you replace a version property in your plugin.yml

#

which you should be doing

prime sandal
#

One of the possible answers for someone who doesn't know kotlin at all is to write the code itself, it's more practical, a huge time saver on some projects, not to mention the rich library of kotlin itself

quaint mantle
#

Hey all I need some help with a very simple plugin i'm making.

The plugin works well, it's basically a /staff that shows the staff online, but when I do /staff it shows the following:

#
somber sequoia
#

you need to do .getName() on the player object to get their name

ancient plank
#

I wonder

quaint mantle
#

I think im doing that already @somber sequoia

#

this.staffList.add(player.getPlayer());

somber sequoia
#

yep i misstyped

#

i meant to say .getName() after .getPlayer()

#

very sorry for that

noble lantern
#

Packets and shit

quaint mantle
#

its all g, thank you

#

Im gonna edit and try it out. Appreciate it

#

Works, thank you ! @somber sequoia

sterile token
bright jasper
#

How does one send a text component using another (default.json is the default) font from a resource pack to a player

slate delta
#

any ideas?

tender shard
#

are there any PathfinderMobs that are not LivingEntities?

#

oh wait I'm stupid

#

PathfinderMob extends Mob extends LivingEntity

rain mason
#

is there a way to add that funny enchantment overlay to a player head?

rain mason
chrome beacon
fleet comet
#

@rain masonwhat you could do is use a custom texture pack with a model for the item of the zombie head and use a data model tag and set it when giving the item, then you could add the enchantment glint

#

thats the way i would do it

rain mason
#

alr, do y'all have any other idea on how to make the first head stand out from the other players? (it won't be all zombies it's just my skin)

echo basalt
visual tide
#

use a different item 🤷

fleet comet
#

hmmm... you could used a image modifer API from online to add the enchantment glint

#

but that would be more complex

#

to modify the skin

chrome beacon
#

Just use another item

fleet comet
#

heads*

rain mason
#

i could probably just use a nemtag or something idk, and add lore with the player's username

fleet comet
#

mhmm

#

does spigot have a armor stand pose method?

devout canyon
#

Where can we look to find out if a new version of Minecraft is a new revision? Like if 1.19.1 is 1_19_R2 or still R1

random gust
#

I want to load a world trough bungeecord only with packets, knows anyone how this works?

chrome beacon
fleet comet
#

i wanna be protected

chrome beacon
#

Then implement and send them

random gust
#

And you will not be used

fleet comet
#

ILL MAKE YOU A NOT INIT FINAL VAR!!

#

YOU WILL BE USELESS

random gust
#

OMG I CANNOT BE EXISTENT

#

do not dare to do that xd

chrome beacon
#

Don't worry I'll save you with reflection :p

fleet comet
#
private final Human staticDev = new Human(HumanNullifier(useSecurityGuard: true))```
random gust
#

Okay, then I will initial you with a reflection too

warm mica
#

I'm not sure whether it is or not

random gust
fleet comet
#

okay

#

well this isnt bungeecord

random gust
#

Is there an extra discord for bungee?

chrome beacon
#

No

#

This is Spigot and Bungeecord

#

Idk what jade is talking about

fleet comet
#

OH SHIT

#

hehehehe dont mind me ima just go

random gust
#

You're using a too old gradle version, try upgrading to the latest snapshot version

lapis lark
#

Hello, guys! Does NMS 1.19.1 same as 1.19 (1_19_R1)?

chrome beacon
#

Yes as long as you haven't done any chat nms

#

Try gradle v7.5

fleet comet
glad prawn
#

getEntityType is the same with getEntity#getType?

lapis lark
#

Well, I am a LuckyBlock dev and I am interested if I should add one more nms support for nbt

glad prawn
#

Thanks

lapis lark
#

So is it 1_19_R2 for 1.19.1 or still r1?

fleet comet
#

wait how do i save hashmap

#

as file

#
public void saveKingdoms() throws IOException {
        properties.putAll(kingdomMap);
        properties.store(new FileOutputStream("data.properties"), null);
    }``` im using this, but im not sure how to customize the destination of that file
tender shard
#

I wonder why the mappings viewer never works

sterile token
#

Im needing help i have been more than 10m trying to figure how to update a mongo document using a POJO class

fleet comet
#

google it

vocal cloud
fleet comet
#

what did you try

#

Also what IDE?

#

oh

#

google it lol already found something

#

@last temple

#

change the version there (:

sterile token
# vocal cloud Gotta be more specific than that

Okay im using a system called Pojo from mongo db, which likely use a java class acting as a Bson Document. But i dont know how to update the data on the db without creating it again. I tríed MongoCollection#updateOne() but its force me to cast it to Bson but i shouldnt cast it because i get an exception and my java class have nothing to do with bson

fleet comet
#

i feel like its /gradle-7.5.something-bin.zip

#

@last templeits actually /gradle-7.5-rc-1-bin.zip

#

i think

visual tide
fleet comet
#

it is

sterile token
#

Hahaha a

vocal cloud
#

ik what pojo is lmfao

fleet comet
#

what error?

#

your using groovy?

slate delta
#

how i can find the namespacekey from a specific craft

fleet comet
slate delta
sterile token
#

Pojo is a way of mapping data for mongo db. Its like you have a class which is used to save/update/delete is more like a model

sterile token
fleet comet
vocal cloud
#

You use findOneAndReplace usually

fleet comet
#

you do not need this btw

tender shard
#

F to everyone who still has to use 1.16 NMS lol. It's sooooo weird to see all those fucking letters again after using remapped for months

fleet comet
#

this

slate delta
atomic swift
#

is there an event for liquid touching a block

vocal cloud
slate delta
fleet comet
#

the name of the reciepe message

#

like

#

iron_pickaxe

#

i bealive

sterile token
#

Ok mime thanks brío, because using update One was forcing me to cast User.class into bson Document

#

Which have nothing do

#

I dont I know if I explain

slate delta
#

@fleet comet Where can I find all the names of the recipes?

fleet comet
#

does minecraft use the exact item name for the rec 2?

vocal cloud
delicate lynx
#

you might have to manually find them

sterile token
#

😍

fleet comet
#

you can try the item name

#

@slate delta

vocal cloud
slate delta
#

I would like to remove the recipes of furnace which transforms iron tools into iron nuggets in fact

young knoll
#

That doesn’t say anything about liquids

vocal cloud
fleet comet
#

u gotta manully find that then

slate delta
young knoll
#

It’s BlockFromToEvent

vocal cloud
#

Yeye

young knoll
#

Ye

vocal cloud
#

I got it the second time

fleet comet
#

how do i save the hashmap 2 a specific location?

public void saveKingdoms() throws IOException {
        properties.putAll(kingdomMap);
        properties.store(new FileOutputStream("data.properties"), null);
    }``` im using this, but im not sure how to customize the destination of that file
sterile token
#

Dont spam it every 10-20m

fleet comet
fleet comet
sterile token
#

If you want to your message get not lost open a thread on this channel

fleet comet
#

oh

sterile token
#

I think its better

#

hahaha sorry if i sound rude

jade roost
#

how do i check if the item the player is holding has a specific name

fleet comet
#

How do I save a hashmap 2 a folder, ive got this so far

#

(:

vocal cloud
fleet comet
#

but it takes a string

#

OH TOABSOULUTE

vocal cloud
fleet comet
#

ohh my god ur a life saver lol

sterile token
#

mike

sterile token
#

Would not be the place but

#

How do you save locations with mongo pojo?

vocal cloud
#

Not sure if you can. Either make a wrapper with a from -> to or something else.

sterile token
#

Because in my case im using a external location class

vocal cloud
#

You'd need to have a method to serialize/deserialize it

sterile token
#

Something like a codec right?

vocal cloud
#

Store the location as a string then have a getLocationString and a parsedLocation method

rain mason
#

is there a way to parse foo.bar as a Map? (so I can get all the keys)

vocal cloud
#

That way it can be stored in the DB just fine and can be read as a location in the object

sterile token
#

I find really ugly hahaha

#

So i use a custom location class which mostly contains string world, double x, y, z, float pitch and yaw

#

😂

#

And them a method like: Location toBukkit()

vocal cloud
#

Something like that

#

Hard to quantify what exactly you want

sterile token
#

Just being able to save spigot locations without serializing it into a string

delicate lynx
slate delta
delicate lynx
#

I did a manual search for it

rain mason
#

i'm guessing just look at the version's data/minecraft/recipes stuff

delicate lynx
sterile token
jade roost
#

where can i find some cool starter plugins to try code

#

xd

sterile token
#

I dont think i understand what you need

jade roost
#

ok ok

#

i need a place where can i find plugin coding ideas for beiggener

#

to work on my skills

slate delta
rain mason
#

maybe probably check r/minecraftsuggestions

#

@jade roost

sterile token
sterile token
jade roost
#

java skill

sterile token
#

Allright

#

?learnjava

undone axleBOT
jade roost
#

coo

#

cool

sterile token
#

You have there some usefull urls

jade roost
#

i am gonna start from there ig

#

then spigot

#

xd

sterile token
#

Yes that is how you must start you shouldnt start plugins without knowing the lang itself

#

😂

slate delta
slate delta
delicate lynx
#

just change the item, it will output all types

rain mason
#

that's probably outdated

#

and change your version

slate delta
#

thank you everyone

delicate lynx
#

that's how I found the iron pickaxe -> iron nuggets one

rain mason
#

yeah almost any armor can be smelted into nuggets

delicate lynx
#

it only told me the iron pickaxe one

rain mason
chrome beacon
#

If you want all the keys get the configuration section foo.bar and call getKeys on it

rain mason
#

oh cool thanks

young knoll
#

There’s also getMapList

rain mason
#

but that only returns yaml foo: bar: - something: false abc: def, - something2: true def: abc map lists, right?

#

like foo.bar (in this example)

tender shard
#

oh man

#

no NMS changes in 1.19.1?

young knoll
#

I’m sure there are

#

Mainly around chat

chrome beacon
#

^

tender shard
#

I meant no new package name etc

young knoll
#

Ah

tender shard
#

well it's only org.bukkit.craftbukkit, but anyway 😄

chrome beacon
#

Yeah the rest is fine as far as I'm aware

worldly ingot
#

No revision, correct

grim ice
#

Heya all

#

so uh I need to listen to system out prints

#

is there a way to do that

#

not in spigot tho

ivory sleet
#

Could proxy it

#

Like use setOut with a custom impl that delegates

grim ice
#

hmm? how

#

the sout isnt triggered by me

ivory sleet
#

So?

#

If they use sout and you injected a custom impl you’d be able to listen to it

grim ice
#

how would I do that then\

#

how to do that tho

humble rock
#

Heya, I've been coding spigot plugins for 2 days (I've got experience in other languages) and I've been able to to must stuff by just looking at the docs which is great :)

Only thing I'm struggling with right now is placing a wall sign when I right click my Iron pick toward a block, I'm using PlayerInteractEvent. Cheers.

ivory sleet
#

class SpecialForwardingPrintStream extends PrintStream{…}

then
System.setOut(SpecialForwardingPrintStream.create(System.out));

grim ice
#

oh i tried that

ivory sleet
#

Didnt work?

grim ice
#

i just get an out of memory error

#

wait

ivory sleet
#

Ugh how did you implement it?

grim ice
#

frick it did that was another app

ivory sleet
#

🥲

grim ice
#

💀

#

im stupid dont mind me

ivory sleet
#

💀💀💀💀

#

Lol dwdw

grim ice
#

lol

young knoll
#

You gotta be carful accidentally quantum entangling your plugin to other things

noble lantern
young knoll
#

Once I made a mistake in my plugin code and my fridge stopped working, it’s terrible

young knoll
#

The fabric discord probably

ripe urchin
#

is there by any chance mojmaps for 1.19.1 too?

young knoll
#

Yes

ripe urchin
#
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.19.1-R0.1-SNAPSHOT</version>
            <classifier>remapped-mojang</classifier>
            <scope>provided</scope>
        </dependency>
``` seems to not be working
chrome beacon
#

Did you run BuildTools

#

Also did you add the special source plugin

young knoll
#

Did you run buildtools with --remapped

ripe urchin
#

what special source plugin?

ripe urchin
#

thanks it works now

#

tried using without mojang remappings but just ended up with TONS of unmapped stuff

chrome beacon
#

Yeah

young knoll
#

Mojang may not always have the best names for stuff, but it’s so nice having them not change every version

chrome beacon
#

And having the same names everywhere; Forge, Fabric and Spigot

young knoll
#

Yep

delicate lynx
azure hawk
#
package buildserver.main.listeners;

import buildserver.main.Buildserver;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.AnvilInventory;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

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


public class inventoryListener implements Listener {
    private final Buildserver plugin;
    public inventoryListener(Buildserver main) {
        this.plugin = main;
    }
    public static List<Player> renameItem = new ArrayList<>();
    @EventHandler
    public void onInvClick(InventoryClickEvent event) {
        Player player = (Player) event.getWhoClicked();
        Inventory inv1 = player.getServer().createInventory(null, 45, "§3§nAlle Welten:");
        if(event.getClickedInventory().getTitle() == "§e§nMenü") {
            if(event.getCurrentItem().getType() == Material.COMPASS) {
                for (int i = 0; i < plugin.MAPS.size(); i++) {
                    ItemStack item1 = new ItemStack(Material.GRASS);
                    ItemMeta meta1 = item1.getItemMeta();
                    meta1.setDisplayName("§e" + plugin.MAPS.get(i));
                    List<String> lore1 = new ArrayList<String>();
                    lore1.add("§7Coming soon...");
                    meta1.setLore(lore1);
                    item1.setItemMeta(meta1);
                    inv1.setItem(i, item1);
                    player.openInventory(inv1);
                }}
                event.setCancelled(true);
        if(event.getClickedInventory().getTitle() == "§3§nAlle Welten:") {```
#

            if(event.getCurrentItem().getType() == Material.GRASS) {
                Bukkit.broadcastMessage("1");
                if(player.getItemInHand().hasItemMeta()) {
                    Bukkit.broadcastMessage("2");
                    String wname = player.getItemInHand().getItemMeta().getDisplayName().replace("§e", "");
                    Bukkit.broadcastMessage("3");
                    player.teleport(Bukkit.getWorld(wname).getSpawnLocation());
                    Bukkit.broadcastMessage("4 FINAL");
                } else {
                    player.sendMessage("Its not working");
                }

            }
        }
                } else {
                    event.setCancelled(false);
                }



    }

}

Im trying to figure out why the second inventory when i click on any grass block doesnt teleport me or react at all. There are no errors of any kind and i've been on it for 30 minutes. Any ideas guys? ^^ Thx`

delicate lynx
#

please post that to a paste site

#
  1. don't use inventory names for checking custom inventories
rough drift
#

GRASS is the thing on top of grass block

#

like tall grass, but short

azure hawk
#

1.8.8 :)

rough drift
#

ah then idk

azure hawk
#

nice xd

ancient plank
azure hawk
#

xd

rough drift
#

go it wrong dozens of times

#

I finally learnt

ancient plank
#

my brain too small to learn anything

rough drift
#

bro I am having hallucinations rn

#

My brain is too dumb to realize i shouldn't

#

I gotta go sleep

#

been awake for 17+hours

sterile token
#

Where i intellij idea maven route?

chrome beacon
#

?

sterile token
#

Like where is it?

#

Located

#

Because i havent installed maven

vocal cloud
#

You talking about your .m2?

sterile token
#

No the maven bin folder

chrome beacon
#

Probably the bundled maven that comes with Intellij

#

I'd expect it to be in the Intellij installation folder

#

No access to a pc so I can't check

sterile token
#

yes that the issue i dont know where is the intallation folder

#

Allright thanks

delicate lynx
#

store the inventory after you create it and check if it's the same one

ripe urchin
#

so I've just started using NMS with mojmaps and when packaging i get this error
Basic element 'srgIn' must not contain child elements
it appears during the remap part, so did something go wrong?

chrome beacon
#

Could you send your pom

#

?paste

undone axleBOT
ripe urchin
chrome beacon
#

Try updating special source to 1.2.4

ripe urchin
azure hawk
#

Im trying to figure out why the second inventory when i click on any grass block doesnt teleport me or react at all. There are no errors of any kind and i've been on it for 30 minutes. Any ideas guys? ^^ Thx -Old text but now with pastebin

delicate lynx
#

nice racism in the code

chrome beacon
#

Don't compare inventories by their name

sullen marlin
#

Your line 87 pom is cooked

ripe urchin
#

huh yeah that doesn't look right

#

seems like IDEA had a mind of its own when i did a copy paste

azure hawk
chrome beacon
azure hawk
#

ok

#

sry

azure hawk
chrome beacon
#

We told you already

ripe urchin
#
[00:01:22] [Server thread/WARN]: [Corpses] Task #2 for Corpses v${project.version} generated an exception
java.lang.NoClassDefFoundError: com/jeff_media/morepersistentdatatypes/DataType
        at me.sebkuip.corpses.Ticker.lambda$tick$0(Ticker.java:34) ~[?:?]
        at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftTask.run(CraftTask.java:82) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3554-Spigot-2183145-6da8266]
        at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:415) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3554-Spigot-2183145-6da8266]
        at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1245) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3554-Spigot-2183145-6da8266]
        at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:394) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3554-Spigot-2183145-6da8266]
        at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1197) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3554-Spigot-2183145-6da8266]
        at net.minecraft.server.MinecraftServer.v(MinecraftServer.java:1013) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3554-Spigot-2183145-6da8266]
        at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:293) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3554-Spigot-2183145-6da8266]
        at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.lang.ClassNotFoundException: com.jeff_media.morepersistentdatatypes.DataType
        ... 9 more
``` dammit, seems like something broke the MorePersistentDataTypes
eternal night
#

you not shading it I presume ?

azure hawk
chrome beacon
#

We did

ripe urchin
#

i'm just starting out with NMS/mappings so it's all voodoo magic to me still haha

chrome beacon
#

Shading isn't NMS. It's a non-minecraft specfic thing that a build system like maven can do

#

It includes the dependency in your jar so you can use it

grim ice
#

?paste

undone axleBOT
ripe urchin
#

i assume it's edit something in the pom.xml

grim ice
#

So uh i have this json, and i wanna take the "/viewauction beac42119eac467f8095cee8148e91de" from it

#

do u guys have an idea on what to do?

azure hawk
chrome beacon
chrome beacon
azure hawk
#

it doesnt work

ripe urchin
chrome beacon
#

Don't forget to relocate

#

Read that part

atomic swift
#

umm im trying to use the BlockBreakEvent but i dont think its being triggered because i added some loggers Bukkit.getLogger.info(String) and they aren't printing

ripe urchin
#
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.3.0</version>
                <configuration>
                    <relocations>
                        <relocation>
                            <pattern>com.jeff_media.morepersistentdatatypes</pattern>
                            <shadedPattern>com.shaded.jeff_media.morepersistentdatatypes</shadedPattern>
                        </relocation>
                    </relocations>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
``` hope this should do the trick
atomic swift
ripe urchin
#

and that is in onLoad() right?

atomic swift
ripe urchin
#

or that sorry

delicate lynx
#

otherwise that doesn't do anything

atomic swift
#
    @Override
    public void onEnable() {
        saveDefaultConfig();
        getServer().getPluginManager().registerEvents(new Events(), this);
        getCommand("blreload").setExecutor(new Reload());
        getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "[BlockLimiter] Plugin Has Been Enabled!");
    }
ripe urchin
delicate lynx
#

show your events class

#

could do like me.sebkuip.corpses.shaded.morepersistentdatatypes

ripe urchin
#

ah okay that makes sense thanks

atomic swift
#
    public void onBlockBreak(BlockBreakEvent event){
        Bukkit.getLogger().info("1");
        Block block = event.getBlock();
        Location above = block.getLocation().add(0,1,0);
        CustomBlock custom = CustomBlock.byAlreadyPlaced(above.getBlock());
        
        if (custom != null) {
            Bukkit.getLogger().info("2");
            String namespace = custom.getNamespace();
            if (Iaddon.getInstance().getConfig().getStringList("items").contains(namespace)) {
                Bukkit.getLogger().info("3");
                if (Iaddon.getInstance().getConfig().getBoolean(namespace.replace(":", "") +".can-float")) {
                    Bukkit.getLogger().info("4");
                    return;
                    
                }
                above.getBlock().setType(Material.AIR);
                custom.drop(above);
                Bukkit.getLogger().info("5");
                return;
                
            } else Bukkit.getLogger().info("6"); return;
            
        } else Bukkit.getLogger().info("7"); return;
        
    }
delicate lynx
#

that is where you are shading the dependency to, so I would put it into it's own package

delicate lynx
atomic swift
#

thx

noble lantern
#

My code: https://paste.md-5.net/epilapequd.cpp (Messy as I'm just testing, this is called in a runnable every x seconds)

Video: https://imgur.com/a/M7lh5Ha

Goal:

I'm using this packet: https://wiki.vg/Protocol#Update_Entity_Position to update a fake ServerPlayer's location, I got the NPC walking however it is not following the path that I am desiring to make it go to

What im doing in the code, is attempting to split the packets up into multiple "steps", and send each "step" on a separate tick each time

The reason for this is making the raw number one block (4096) the entity will move at max speed on the client, but splitting it up across ticks is fine

I really just need help with the map, is there any wizards who have messed with this packet before as well as the math with it?

tiny wolf
#

rq question, does dispatchCommand need to be run on the main thread

#

or can I run it async on some other thread

delicate lynx
#

main

naive bolt
#

not another version. silly 1.19.1

fleet comet
#

Does anybody know how Feather client's rust proxied launch works?

atomic swift
#

how can i remove a block from the world

worldly ingot
#

block.setType(Material.AIR)

#

As simple as that ;p

atomic swift
worldly ingot
#

Then you're doing something wrong lol. All relevant code would be helpful

fleet comet
#

code..

atomic swift
#
    @EventHandler
    public void onBlockBreak(BlockBreakEvent event){
        Bukkit.getLogger().info("1");
        Block block = event.getBlock();
        Location above = block.getLocation().add(0,1,0);
        CustomBlock custom = CustomBlock.byAlreadyPlaced(above.getBlock());
        
        if (custom != null) {
            Bukkit.getLogger().info("2");
            String namespace = custom.getNamespacedID();
            if (Iaddon.getInstance().getConfig().getStringList("items").contains(namespace)) {
                Bukkit.getLogger().info("3");
                if (Iaddon.getInstance().getConfig().getBoolean(namespace.replace(":", "") +".can-float")) {
                    Bukkit.getLogger().info("4");
                    return;
                    
                }
                above.getBlock().setType(Material.AIR);
                custom.drop(above);
                Bukkit.getLogger().info("5");
                return;
                
            } else Bukkit.getLogger().info("6 " + namespace); return;
            
        } else Bukkit.getLogger().info("7"); return;
        
    }
#

i need to remove the loggers

fleet comet
#

why above?

atomic swift
#

and if the block under is removed then i need to remove the itemsadder block

worldly ingot
#

I've a feeling this is to do with some weird client-sided block setting you have

mystic sky
#
                   map( ProtocolConstants.MINECRAFT_1_8, 0x02 ),
                    map( ProtocolConstants.MINECRAFT_1_9, 0x0F ),
                    map( ProtocolConstants.MINECRAFT_1_13, 0x0E ),
                    map( ProtocolConstants.MINECRAFT_1_15, 0x0F ),
                    map( ProtocolConstants.MINECRAFT_1_16, 0x0E ),
                    map( ProtocolConstants.MINECRAFT_1_17, 0x0F ),
                    map( ProtocolConstants.MINECRAFT_1_19, 0x5F ) <-
#

Where can i find new 1_19_1 ids

mystic sky
#

I tried to follow viaversion but uh

worldly ingot
#

If there's no specific id for 1.19.1, then it must match the id of the previous version

#

(notice how 1.10, 1.11, and 1.12 are also missing? Because they match that of 1.9)

sterile token
#

Future and CompletableFuture is the same?

mystic sky
#

I see

worldly ingot
#

CompletableFuture implements Future

sterile token
sterile token
worldly ingot
#

You get a few more methods from CompletableFuture (such as complete() ;p)

sterile token
#

So is it the same right?

worldly ingot
#

I mean, yeah. All CompletableFutures are Future, but not all Future are CompletableFutures

mystic sky
#

I thing that Feature get gives operations that are not ready

fleet comet
sterile token
fleet comet
#

i do my addon systems way differently ;-;

sterile token
#

Oh sorry i didnt udnerstand what it was

#

My bad!

fleet comet
#

there true addons that way, instead of being another plugin that uses the mains API.. the main uses reflection to make instance of class on external addon jar via YML that contains info abt it, then runs a method that registers everything the addon wants to register 🙂

#

its so bad

atomic swift
sterile token
fleet comet
#

papi does that?

worldly ingot
#

It returns the piston afaik

#

If you want the blocks it's pushing or pulling, you can listen for the BlockPistonExtendEvent and BlockPistonRetractEvent which both have getBlocks() methods

atomic swift
#

and do those get the block being pushed/pulled

#

and does getBlock().getLocation() get the original or the pushed/pulled loc

worldly ingot
#

getBlock() is the piston, so that would get you the piston location

#

getBlocks(), with an s, will get you a List of pushed/pulle blocks

slate delta
#

Does anyone know how I could get my to-do's from my Todoist and put them in a book page on Minecraft?
Is there an API or a plugin already made?

surreal spoke
#

Hi, ım trying to make a throwable sword, and ı need to teleport the normal armor stand to the small armor stand exact like the screenshot. I made this picture on vanilla minecraft and its working perfect. but ı cant figured it out how can ı do that in spigot. here is the vanilla command:
execute as @e[tag=body] at @e[tag=small] positioned ~ ~-0.5 ~ rotated ~ 0 positioned ^0.375 ^ ^-1 run tp ~ ~ ~
so ı just have to translate this vanilla comand to spigot.
even if the pitch or yaw changes the normal armor stand still teleporting to the small one as like in the screenshot
https://prnt.sc/houACay_KAFY

fleet comet
#

Just use the vanilla command and run it via spigot

surreal spoke
#

if ı do that ı wouldnt learn anything new

fleet comet
#

You already made the command in mc tho

surreal spoke
#

thats just 1 little command ı already knew minecraft vanilla coding well but ı wanna open a server in the future so ım learning spigot

#

ı just have a throwable axe in vanilla instead. but making it in spigot is diffrent

fleet comet
#

well i have no idea what that command does in simple terms so idk if i can help

surreal spoke
#

thats all

#

and tp the normal armor stand to this location

lost wolf
#

I see that the Skull interface has the PersistentDataHolder Superinterface, how can I store custom PersistentData on it so I can retrieve it later?

sterile token
young knoll
#

Because running commands from your code is bad design and bad for performance

surreal spoke
#

cause my vanilla throwable axe wouldnt work when there is more of them. spigot allows me to make it support multiplayer. I wanna make a server with fantasty weapons with some special powers that never done in any server. ı was doing fantasy weapons on vanilla singleplayer and people was loving it, then ı just said ı can make a server like that and get money with it

sterile token
#

I always forget that spigot is not multi threaded

#

So most of the time when doing that harcoded things tps goes down

surreal spoke
#

well ı got some ideas to optimize it for lower lag (ı could be get it wrong cause of my english)

young knoll
#

Just running .teleport on an entity is much faster than making the server execute a teleport command

noble lantern
charred pollen
#

how do i add Experience points to spawnEntity Experience Orb?

granite burrow
#

Is there a way to find out how much XP an item is worth

severe turret
#

any idea why it's telling me that the check is unnecessary

dusk flicker
#

the spawnEntity method will return an Entity

#

so store it in a variable, then cast to the ExperienceOrb, then set the xp

dusk flicker
#

It wont throw any errors if it is not present

ancient plank
#

also fun to note, if you have stuff you wanna do if it does actually remove something, #remove() returns a boolean wesmart

spare marsh
#

Quick question. So let’s say I have a java server. One of the functions for the server is to listen sockets. Do I run the ServerSocket on a different thread to let the server still run and each socket in its own server? I don’t want to stop the main thread tho

#

So let’s say for a mc server

ivory sleet
#

Use netty

#

Normal Java doesnt have a good thread per task api (until virtual threads with structured concurrency api releases)

charred pollen
dusk flicker
#

Entity newEntity = method...

#

?learnjava

undone axleBOT
young knoll
ancient plank
#

does it

#

I thought it returned a boolean

young knoll
#

I believe collections return a Boolean

charred pollen
#

idk how :/

ancient plank
#

oh ye it does

#

ignore me

charred pollen
ancient plank
#

learning java helps

dusk flicker
#

Probably should learn java

charred pollen
#

i just need help to add exp on spawnEntity

young knoll
#

spawnEntity returns an entity, or the extract type of you are using the class rather than EntityType in the spawn method

dusk flicker
#

The question is already answered, the issue is the lack of knowledge as you have jumped into Spigot before learning the language that Spigot is built on, meaning you will have a bad time understanding the extensive API, and will keep coming back with questions that would be solved by a simple basic knowledge of Java

young knoll
#

You can then do with that returned value what you want

charred pollen
#

thats why i'm asking to learn here, the knowledge just doesn't get into the brain from nothing, if you dont wanna help just dont answer?

dusk flicker
#

The issue here isn't with Spigot, it's with your Java knowledge

#

hence the ?learnjava

dim palm
#

how can i get a random player from all online players

#

or players that are in a array

young knoll
#

Get a random index from 0 to array size

ancient plank
dusk flicker
#

thanks

ancient plank
#

yw

severe turret
#

any idea why it's telling me that the check is unnecessary 🙃

ancient plank
#

mfw

dusk flicker
#

You dont need the contains check as remove won't throw an error if it is not in the map

severe turret
#

yeah but

#

it feels weird.

young knoll
#

It’s not

#

It will just silently do nothing

severe turret
#

ig

ancient plank
#

I like maps

dusk flicker
#

same

#

I use sets a lot too

severe turret
#

you mean minor attracted people

#

💀

young knoll
#

A hashset is backed by a hashmap

#

It’s maps all the way down

dusk flicker
#

i honestly have no idea what the difference between set and a list is

#

lol

#

cba to ever figure that out

severe turret
#

different purposes

#

🤓

#

Set cannot have duplicates

young knoll
#

Set is generally faster for contains operations as well

ancient plank
#
Set<Type> set = new HashSet<>();

drake_nope

Map<String, String> map = new HashMap<>();
{
  map.put("a", "b");
  map.put("c", "d");
  map.put("e", "f");
}

Set<String> set = new HashSet<>();
{
  set.addAll(map.values());
  set.addAll(map.keySet());
}

drake_dope
@young knoll

young knoll
#

Perfect

noble lantern
glossy scroll
#

will Bukkit inventories save contents by default?

#

or does one need to cache the contents when the inventory closes?

noble lantern
#

as long as you hold a referance to it, the contents should stay

glossy scroll
#

so clarify something in your code for me

karmic stirrup
glossy scroll
#

blocksPerTick*Delta/Distance

#

using dimensional analysis

#

that means

#

you get a final unit of Blocks/Tick

noble lantern
balmy valve
#

Im trying to get a listener for if someone drops an item ontop of a specific block but I cant seem to get it working
The Drop detected fires but not sure how to get the other part working

#

the minus 1 is probably 2 much

noble lantern
worldly ingot
#

And onEnable() no less. That's going to be scheduled and run a tick after plugins are enabled

karmic stirrup
noble lantern
#

oh hahaha i didnt even see that sliver up there

worldly ingot
#

Just put the for loop in your onEnable() ;p Skip the task entirely

karmic stirrup
#

Ooh right, ty!

noble lantern
# glossy scroll

Ngl im and the worse possible ever at math

What variables are getting pluggin into this equation? Its a relevant location so it can only be so high before it throws an error

glossy scroll
#

blocksPerTick

#

that is a measure of velocity

#

meters (m) per second (s) for simplicity

#

then you multiply it by a distance (final - initial)

#

then you divide it by a distance (distance)

#

Using dimensional analysis, this means your final output is a speed

#

oh wait

#

that would make sense because youre sending many packets

noble lantern
#

Well thats the thing

glossy scroll
#

i think theres a floating point issue going on here

#

what i would do

#

is that i would multiply by 4096 at the very end

#

blocksPerTick * (vector.getX() - vector2.getX()) * 4096) / distance -> (blocksPerTick * (vector.getX() - vector2.getX()) / distance) * 4096

#

also

#

make the distance a double

#

that will cause rounding errors

#

overall the code is fine, its just that your use of parathesis and order of operations may be causing some rounding issues

noble lantern
#

Im trying to divide the said packet into said 10 (eg 10 packets, its what blocksPerSecond is for, its basically for spreading out the packets over a specific tick time) because when you call a whole block movement in a single packet the entity just moves at lightning speed

no floating point right here

noble lantern
small current
#

420

glossy scroll
#

shorts wont have any decimal places

#

you would need to divide that by 4096 to get the relative distance again

balmy valve
#

How in an item drop listener can I get that this dropped item is ontop of a chiseled quartz?
Or is a PlayerItemDrop the wrong listener to use

    @ParametersAreNonnullByDefault
    public SpiritualAltarListener() {
        SpiritsUnchained.getPluginManager().registerEvents(this, SpiritsUnchained.getInstance());
    }

    @EventHandler
    public void onDrop(PlayerDropItemEvent e) {
        Player player = e.getPlayer();
        player.sendMessage("Drop Detected");
        Item item = e.getItemDrop();
        Location location = item.getLocation();
        location.setY(location.getY()-.25);
        player.sendMessage(location.getBlock().toString());
        if (location.getBlock().getType() == Material.CHISELED_QUARTZ_BLOCK) {
            player.sendMessage("Drop Works");
        }
    }

Atm It is most defintely not getting that block xd

#

(the send messages were just so I could see what it was getting)

glossy scroll
#

i would go a different route

#

and try to make the block in question a "hopper"

noble lantern
glossy scroll
#

yep that seems ok to me

glossy scroll
#

every x ticks, get the entities above that block, and see if any of them are the items you want

#

if true, continue and etc

balmy valve
#

wouldnt that not be great on performance if there were alot of these?

glossy scroll
#

depends

#

you could make the timer every tick or every second

#

its not a super heavy comptuation

#

you would need literally thousands of them for it to make a big noticable impact

#

id recommend just checking once per second

#

that would not be very intense

balmy valve
#

alr

noble lantern
#

it just.... slightlyyy drifts off

#

and then endlesslessly gets worse and worse

glossy scroll
#

this.setPos(x, y, z);

#

?

#

what is this

noble lantern
#

The class extends ServerPlayer nms

#

it sets the position variables

glossy scroll
#

ok

small current
#

I spawned a particle when the npc should be

#

And it was blocks away

noble lantern
glossy scroll
#

oh?

small current
#

Found no solution

noble lantern
#

normally

small current
#

What i was doing

#

Was to move an npc

#

In a straight line

#

And it suddenly got slow

noble lantern
noble lantern
#

you were applying velocity

glossy scroll
#

what worked?

noble lantern
#

not an entity move

glossy scroll
#

how u fix it?

small current
noble lantern
#

look in the code im get blockPos

#

which are typically ints not doubles

small current
#

These move packets are strange

noble lantern
#

and it reminded me of that lol

glossy scroll
#

OH

noble lantern
glossy scroll
#

of COURSE

#

that makes a lot of sense lmfao

#

cant believe i didnt catch that

small current
glossy scroll
#

new PacketPlayOutEntity.PacketPlayOutRelEntityMove(this.entity.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), this.entity.isOnGround()); is what i decompiled lol

small current
#

I was doing it when 1.17.1 was latest

noble lantern
#

it was weird cause he would always like be on the block but.. swerve off of it it was weird lmfao

glossy scroll
#
    private static long encode(double var0) {
        return MathHelper.lfloor(var0 * 4096.0D);
    }

    private static double decode(long var0) {
        return (double)var0 / 4096.0D;
    }

    public Vec3D decode(long var0, long var2, long var4) {
        if (var0 == 0L && var2 == 0L && var4 == 0L) {
            return this.base;
        } else {
            double var6 = var0 == 0L ? this.base.x : decode(encode(this.base.x) + var0);
            double var8 = var2 == 0L ? this.base.y : decode(encode(this.base.y) + var2);
            double var10 = var4 == 0L ? this.base.z : decode(encode(this.base.z) + var4);
            return new Vec3D(var6, var8, var10);
        }
    }

    public long encodeX(Vec3D var0) {
        return encode(var0.x - this.base.x);
    }

    public long encodeY(Vec3D var0) {
        return encode(var0.y - this.base.y);
    }

    public long encodeZ(Vec3D var0) {
        return encode(var0.z - this.base.z);
    }
noble lantern
glossy scroll
#

and thats how they encode/decode the position

#

no, i understand how it works haha

noble lantern
#

so if you call (0, 0, 4096) it tells an entity to move one full block forward

#

oh okay xD

#

i wish the packet supported speed

#

you have to regulate the speed by division and spread it out across ticks which is mad weird, so speeds basically done as blocks per tick lol

#

packets say max distance is 8 hm

glossy scroll
#

yes

#

because 8*4096 is the maximum short value

noble lantern
#

but it supports way bigger 🤔

#

OH

#

no it doesnt

#

lol hes gone

#

banished

#

shadow realm

#

forgot about the overflow to negative

glossy scroll
#

once larger than 8 block gap, you use the teleport packet

noble lantern
#

well

#

im gonna have to split distances larger than 8 in seperate tasks

glossy scroll
#

there is PacketPlayOutEntityVelocity which forgive me for not using mojang mappings lol

noble lantern
#

well n o nvm

#

i dont rly need to bother over 1 block for rn

#

since pathfinding i has is one block at a time idk why im bitching about 8 block limit kek

glossy scroll
#

i mean for most use cases 8 blocks in a single packet is more than enough

#

quite the distance

noble lantern
#

oh wtf i was afk and it came back to me

#

i just watch him run away 500+ blocks in the air and then hes just. there

#

anyways ty for help :))

willow widget
#

Any ideas on why I could get Caused by: java.lang.NoSuchMethodError: 'double java.util.Random.nextDouble(double, double)'? according to what I found the method is J8 and my server is on J16 :/

drowsy helm
#

anyone know what the Remap for PacketPlayOutEntityMetadata is?

#

what do you mean by "new config string"?

#

just have a new element in an array for each food

#

with all its variables

worldly ingot
drowsy helm
#

awesome thankyou

balmy valve
#

How do I make sure that the particles im spawning aren't shooting off when they spawn?

    private void tick(@Nonnull Block b) {
        Location l = b.getLocation();
        Collection<Player> players = b.getWorld().getNearbyEntitiesByType(
                Player.class,
                l,
                2
        );
        if (!players.isEmpty() && isComplete(b)) {
            l.getWorld().spawnParticle(Particle.END_ROD, radiusLocation(l), 1);
            l.getWorld().spawnParticle(Particle.END_ROD, radiusLocation(l), 1);
            l.getWorld().spawnParticle(Particle.END_ROD, radiusLocation(l), 1);
            l.getWorld().spawnParticle(Particle.END_ROD, radiusLocation(l), 1);
        }
    }

    private Location radiusLocation(Location start) {
        Random random = new Random();
        double X = start.getX() + random.nextDouble(1 + 1) - 1;
        double Y = start.getY() + random.nextDouble(3);
        double Z = start.getZ() + random.nextDouble(1 + 1) - 1;
        start.set(X,Y,Z);
        return start;
    }
```like these particles are flinging off the moment they are spawned and i dont know why
granite burrow
#

is it possible to make a player put down a clicked item?

balmy valve
#

(are you talking to me or brandon)

echo basalt
#

Set the data and all the offsets to 0

#

That's... not the solution to their problem

#

But async particles are indeed a good thing

bright jasper
#

Anyone know how to set a TextComponent or an Adventure Component to a bossbar?

balmy valve
echo basalt
#

to not lag the server

balmy valve
#

Any good resources for doing that or just google xd

#

As that would probably be a good idea

echo basalt
#

?workload

#

bruh

#

idk the command

#

7smile7's tutorial on workload distribution helps

#

you can run the runnable async

balmy valve
#

alr ill look into that

#

ty!

granite burrow
#

How can I get the current minecraft day?

vocal cloud
#

From the world

granite burrow
#

How? I tired World#getTime() & World#getFullTime() and it didnt return the right day count

vocal cloud
#

?jd-s

undone axleBOT
vocal cloud
#

From the docs it looks like you'll need to do some math

granite burrow
#

hmmm, I can get the approximate right time but not the exact right day count :/ looks like ima need to do more testing, thank you mike
Nevermind im dumb, I was using World#getGameTime() rather than World#getFullTime()

For anyone wondering the math to get it is simple its World#getFullTime()/24000

carmine nacelle
#

Alright guys im stuck.

        for(GUIItem guiItem : mainGUIItems) {
            if(currentGUIItemIndex >= 16) break;

            List<String> itemLore = new ArrayList<>();

            ItemStack itemStack = guiItem.getGuiItemStack();
            ItemMeta currentGUIItemMeta = itemStack.getItemMeta();

            if(guiItem.hasExraLore()) {
                List<String> extraLore = guiItem.getGuiItemLoreExtra();

                if(currentGUIItemMeta.hasLore()) {
                    for(String originalLoreLines : currentGUIItemMeta.getLore()) {
                        itemLore.add(replacePlaceholders(originalLoreLines, cadiaBees.hiveLevelManager.getHiveLevel(hiveLevel), container));
                    }
                }

                for(HiveLevel hiveLevels: cadiaBees.hiveLevelManager.getHiveLevels()) {
                    if(hiveLevels.getHiveLevel() > hiveLevel) {
                        for(String extraLoreLine : extraLore) {
                            String newLoreLine = replacePlaceholders(extraLoreLine, hiveLevels, container);

                            itemLore.add(cadiaBees.colorUtil.color(newLoreLine));
                        }
                    }
                }
            } else {
                if(currentGUIItemMeta.hasLore()) {
                    for(String originalLoreLines : currentGUIItemMeta.getLore()) {
                        itemLore.add(replacePlaceholders(originalLoreLines, cadiaBees.hiveLevelManager.getHiveLevel(hiveLevel), container));
                    }
                }
            }

            currentGUIItemMeta.setLore(itemLore);
            itemStack.setItemMeta(currentGUIItemMeta);
            hiveGUI.setItem(currentGUIItemIndex, addGlow(itemStack));
            currentGUIItemIndex++;
        }

This is my code for generating my gui items. For some reason the first time the gui is opened, it populates the right info then it starts duplicating after
https://i.gyazo.com/88cf9d16103d1f758c7a8a65d0bd9dfe.mp4

The "Extra" lore is the stuff relating to what you get with each upgrade and its supposed to disappear as you upgrade.

drowsy helm
#

what is guiItemLoreExtra()?

#

and is guiItem.getGuiItemStack just returning the same item

#

because that will be your issue

#

just clone it

#

Block#isBlockPowered()

boreal seal
#

Hey guys I got an question I work on new plugin right now and I have to deal with a lot of data that often used

#

Now I stick with MySQL

#

What would be the best thing to do to load all the data to cache on server start up

#

Or each time request to do a change

drowsy helm
#

depends what sort of data is it

boreal seal
#

I expect that it can reach up to 200 requests per second

echo basalt
#

You gotta work with data states

#

Read and write lock

#

Type of thing

boreal seal
#

For example I will store a list of users who are allowed to open a specific door

#

So each time asking for it would be fine ?

ivory sleet
#

What type of data

echo basalt
boreal seal
#

String by int int int (x y z)

#

(String player uuid)

#

Did I understand the data type question correctly ?

ivory sleet
#

Myeah Ig

#

Do as ImIllusion said

boreal seal
#

Imma google what are data states not really sure tbh

echo basalt
#

If the data is being saved, or being read

#

Don't allow other servers to modify it during the process

ivory sleet
#

Cache online players, you might wanna have a fixed thread pool or sth where you update the db data of any player whose data in memory got modified

rain mason
#

how would I load a custom head? this is my code, but it just loads a steve head
i also don't want to use NMS, as my server uses ViaVersion

drowsy helm
#

viaversion doesnt affect nms lol

rain mason
#

oh wait I forgot to profl.setTextures i'm guessing

drowsy helm
#

viaversion just translates the servers packet to the client's version you doing nms wont affect taht at all

rain mason
#

oh

boreal seal
#

Since I don’t collect per player

#

It’s per block placed

rain mason
#

well, is there any way to load the custom player head without using nms?

ivory sleet
#

Let me rephrase the initial question

boreal seal
#

About memory I have a dedicated server so it’s not a big deal I pay it I abuse it xD

ivory sleet
#

What is the data for?

#

What is it gonna be used for?

boreal seal
#

As I said every block

#

To see who placed the block

#

And doors and who access them

echo basalt
#

Coreprotect clone

drowsy helm
echo basalt
#

Basically

ivory sleet
#

Yeah why not use core protect?

#

But anyway you probably wanna cache data in active/loaded chunks

#

Or sth

drowsy helm
#

anyone know any tools that will let me upload and edit skins with a signature and texture string?

small current
#

how can i listen for

#

someone placing an item on an itemframe

#

oh nvm HangingPlaceEvent

boreal seal
#

Do you think requesting would work just fine ?

ivory sleet
#

I mean I would really try to keep it cached

#

Cause you dont want latency affecting your players post login ideally

native gale
#

Sorry for a silly question, but is it possible to somehow build 1.2.5 Spigot in 2022 or it is gone forever with that DMCA thing?

boreal seal
#

I don’t want a player to break a block and just after few seconds get the owner

#

Not sure how bad it can be

ivory sleet
#

Resorting to lazy loads (loading on post login) is only when the data is taking up enormous amount of space, which seems not to be the case for you

boreal seal
#

Space in memory won’t be issue

ivory sleet
#

200-300 users isnt much generally speaking when it comes to backend (altho it might be for a single server instance)

boreal seal
#

It’s a single world server

#

So I don’t see reason why load cache by chunks

#

So loading everything on start would be the best soluation ?

ivory sleet
#

I thought you required a more scalable management model

#

Myeah

#

Try it to begin with

#

If it doesnt fit you, do some lazy loading and put it into the cache

boreal seal
#

I’ll actually take a look at coreprotect source code

#

Even thought it works differently from what I need

#

But it supposed to store a lot of data

carmine nacelle
#

guiItem.getGuiItemStack gets the ItemStack from my GUIItem Object

carmine nacelle
boreal seal
#

I’ll see what coreprotect Dev would say about the idea you gived me

desert loom
#

if not, that's likely the reason you're getting repeated lore lines.

#

assuming you call that code more than once

rain mason
#

I added spigot & minecraft-server to my pom.xml, but still can't access GameProfile, how can I fix that?

eternal oxide
#
            <id>minecraft-repo</id>
            <url>https://libraries.minecraft.net/</url>
        </repository>``````        <!--Mojang -->
        <dependency>
            <groupId>com.mojang</groupId>
            <artifactId>authlib</artifactId>
            <version>3.5.41</version>
            <scope>provided</scope>
        </dependency>```
rain mason
#

thanks

quaint mantle
#

how would i convert a string into a Pattern

#

Worldedit api

rain mason
#

for custom player heads

#

yeah, i'll probably keep it as GameProfile for now, until I found something that doesnt use NMS

#

nope

eternal oxide
#
    /**
     * Create a Skull with a texture using the new PlayerProfile
     * Post 1.18.2
     * 
     * @param id        UUID to assign the skull.
     * @param name        a name for the skull
     * @param texture    a Base64 texture String
     * @return            Skull ItemStack
     */
    public ItemStack getHeadByProfile(UUID id, String name, String base64Texture) {

        ItemStack head = new ItemStack(Material.PLAYER_HEAD);

        PlayerProfile profile = Bukkit.getServer().createPlayerProfile(id, name);

        try {
            profile.getTextures().setSkin(new URL(getURLFromBase64(base64Texture)));
            SkullMeta meta = (SkullMeta) head.getItemMeta();
            meta.setOwnerProfile(profile);
            head.setItemMeta(meta);
            
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }

        return head;
    }```
#
    private String getURLFromBase64(String base64) {
        
        return new String(Base64.getDecoder().decode(base64.getBytes())).replace("{\"textures\":{\"SKIN\":{\"url\":\"", "").replace("\"}}}", "");
    }```
rain mason
#

that was the exact same as my code tho

#

nothing changed

#

except the try catch block

eternal oxide
#

Thats setting heads using PlayerProfile rather than GameProfile

eternal oxide
#

a sample head String texture = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYTlmMTFjMGQ0OTdmMjI3MDg5Y2JmNjE0NjAxMTA5Y2FmNjE1NDUzOTQwZWY1ZjY0ZWJiMTc3OTU3ZTRmYTZlNSJ9fX0=";

#

yes

tender shard
#

i made a wrapper for the NMS pathfinder goal class, so that one can easily extend / implement custom pathfinders goals without NMS. However I had to split it up into one NMS "executor" per NMS version, and an abstract class for the actual thing I want people to extend. I wonder if there's any better way
CustomGoal abstract class: https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/ai/CustomGoal.java
NMS executor for custom goals (e.g., here's 1.19): https://github.com/JEFF-Media-GbR/JeffLib/blob/master/spigot_1_19_R1/src/main/java/com/jeff_media/jefflib/internal/nms/v1_19_R1/ai/CustomGoalExecutor.java

rain mason
#

yeah, exactly, that's why I don't understand why my code didn't work but their apparently works

#

how unexpected!!

#

doesn't even throw an error, which is weird

#

because it should've put the "§r"+name

#

probably

#

oh wait I found a bug

#

ok nevermind that bug fixed it

#

that's weird

#

I guess it really only works with the try catch

#

or maybe I just had the wrong base64 value in my old code? don't really know

drowsy helm
#

so your base64 getter isnt working then

hasty obsidian
#

can anyone explain what Vector direction is?

tender shard
#

a vector is like an "arrow" in a coordinate system and the direction is simply the direction it is pointing to. for example the direction of your player's location is the direction where you are looking at (pitch, yaw, roll)

hasty obsidian
#

ok thx

rain mason
echo basalt
rain mason
#

this code thingy

hasty obsidian
echo basalt
tender shard
rain mason
#

also a quick question, is there a way to make the TabCompleter return an "error"? something like vanilla commands

echo basalt
rain mason
#

alr gonna search it

young knoll
#

It’s the vanilla command system

grim ice
#

so uh

#

i need the "/viewauction beac42119eac467f8095cee8148e91de""

#

i thought about getting it as a string

#

then .split("/viewauction ")[1].split[" "][0]

noble lantern
#

spigot has built in gson lib

grim ice
#

its not a spigot project but ig ill use gson

#

buut the thing is

noble lantern
#

oh thought it was haha

grim ice
#

i dont think this json is correctly formatted

chrome beacon
#

Oh is it Mojangson?

grim ice
#

no

#
{"type":"flip","data":"{\"messages\":[{\"text\":\"\\nSNIPE: §5Spiritual Juju Shortbow §6?§6?§6?§6?§6? §a16.5M -> 19.3M \",\"onClick\":\"/viewauction beac42119eac467f8095cee8148e91de\",\"hover\":\"?HPB: 10\\n\"},{\"text\":\"§7 sellers ah\",\"onClick\":\"/cofl ahopen 5c0aaaeda6b44a6a8a908d04488e10db\",\"hover\":\"§7Open the ah for the seller\"},{\"text\":\" ? \",\"onClick\":\"/cofl dialog flipoptions beac42119eac467f8095cee8148e91de\",\"hover\":\"Expand flip options\"},{\"text\":\"\\nHPB: 10\",\"onClick\":\"/viewauction beac42119eac467f8095cee8148e91de\",\"hover\":null}],\"id\":\"beac42119eac467f8095cee8148e91de\",\"worth\":2832200,\"cost\":16500000,\"sound\":\"note.pling\"}"}
noble lantern
#

formats right

#

checked it

grim ice
#

the thing is

#

it's json inside of json

noble lantern
grim ice
#

but i need the json inside "data"

noble lantern
#

oh

chrome beacon
#

Just parse it as json then get data and parse contents?

noble lantern
#

yah that ones invalid

#

Wheres this json getting returned from

#

your api?

chrome beacon
#

Ah data is mojangson

grim ice
#

o

#

no im getting that from another mod

#

im working on a forge mod

#

rn

#

another forge mod prints some data every few moments and i need that data

chrome beacon
#

Use the TagParser to parse that in to a compond

grim ice
#

and idek whats tagparser

chrome beacon
#

TagParser is nms

#

So it's a thing in Forge too

grim ice
#

hmmmm

chrome beacon
#

Can't find it?

grim ice
#

ngl i dont know what that does

#

nah im not in intellij rn im just building some info ill start coding later

chrome beacon
#

CompoundTag tag = TagParser.parse(data);

#

Mojmaps ^

grim ice
#

alr ill see what i can do with that

gaunt mountain
#

Sup, dudes, dudettes, and everything in between. I've been looking for about two hours. Is there any API in Spigot that can make a block emit light, for example a custom lantern?

drowsy helm
#

wait are you asking to block light emission or emit light out of a block?

gaunt mountain
#

Oh, sorry. Emit light out of a block

#

Or entity, whatever a lantern counts as

native gale
#

1.17+ tho

echo basalt
twilit roost
#

How to speed up Projectile without messing up direction?

tender shard
twilit roost
#

ye im doing that
but on long distances it always lands little bit to left/right
which just messes the direction

odd forge
#

Hey, I'm currently updating my plugin to 1.19.1. Weirdly my commands only work if I prefix them with the plugin name:
/myplugin:mycommand works, but /mycommand doesn't (Unknown or incomplete command).
I haven't changed anything in the code and it worked fine in 1.19. I've tested other plugins that were already updated to 1.19.1 and their commands seem to work fine...
Any help would be appreciated 🙂

chrome beacon
#

Make sure the server is up to date

odd forge
#

I just built it 5 mins ago

chrome beacon
#

Do you have two plugins that add mycommand

odd forge
#

I don't think so, but that was my first guess too

#

But wouldn't it complain in the logs though?

#

I even renamed the command and it still didn't work

#

I also tried it with a completely fresh server
and with craftbukkit instead of spigot

vast raven
#

I made a plugin where in the config there is a number that changes and the saves it as defaults option, then with a command it adds to the config a thing, but on reload it keeps deleted, how to prevent that?

tender shard
#

save your config after changing it

twilit roost
#

do you save after adding the thing

chrome beacon
vast raven
odd forge
chrome beacon
#

Hm not sure then

odd forge
#

thats the actual code

#

Its the same as it was with 1.19 and that worked fine

vast raven
twilit roost
#

saveConfig should work only if u are using default config.yml

tender shard
#

just do MyPlugin#saveConfig

vast raven
#

I'm using config.yml

twilit roost
#

therefore it should work

vast raven
#

And saveconfig() method doesn't work

#

I mean

#

it keeps deleting the things I set in the file

#

Except the defaults

chrome beacon
#

Did you forget to load the file

twilit roost
chrome beacon
#

?configs

vast raven
undone axleBOT
vast raven
twilit roost
tender shard
#

wtf is deltaMovement

#

is this nms?

#
    @EventHandler
    public void onShoot(ProjectileLaunchEvent event) {
        event.getEntity().setVelocity(event.getEntity().getVelocity().multiply(2));
    }
#

this works perfectly fine for me

#

makes all projectiles twice as fast without any left/right offsets

twilit roost
#

yep nms

twilit roost
#

well I just set speed to 2
works fine
but im using speeds high as 10

tender shard
twilit roost
#

hmm

#

I normalized the vector before multiplying it
seems to work fine

echo basalt
rain mason
#

how would I detect when a player finishes editing a sign?

echo basalt
#

SignChangeEvent

boreal seal
#

^

rain mason
#

alr thanks

twilit roost
#

when I launch custom nms projectile, sometimes its visible, sometimes not
any clues why?

echo basalt
#

I've had issues with nms projectiles taking turns to a specific offset before, but not with visibility

twilit roost
#

can't it be bcs or rotation?
since snowball in my case is just 2d img

echo basalt
#

could be yeah

#

2d images can't really be rendered in 3d

twilit roost
#

but how could I make it visible for everyone in game

#

there can't be some universal rot

#

oor I could spawn 2 snowballs at same time, one having yRot 0 , second having yRot 90

echo basalt
#

that sounds a bit wasteful

#

if you want to have a 3d model uhh

#

well what I used to do was just create an item

#

and give it the specific velocity for a thrown projectile

#

and do raytracing and collision checks

twilit roost
#

oh damn I dont want to redo whole code again .. duke

echo basalt
#

that's part of the developer cycle

#

:)

#

man I miss doing fancy projectile stuff

#

and playing around with custom mobs

twilit roost
#

do you want to help me ? 😄

echo basalt
twilit roost
#

i have lots of custom mobs that needs to be created

twilit roost
echo basalt
#

I have some funnier stuff

twilit roost
#

I created one mini boss
it has 2 attacks

echo basalt
#

I did it through nms pathfinders

twilit roost
#

custom nms entities with custom pathfinder goals

reef lagoon
echo basalt
#

even have a "Pathfinder Injector" class where I just call some stupid stuff

twilit roost
#

in every version

echo basalt
#
PathfinderInjector.inject(Zombie.class, zombie -> new PathfinderGoalWhatever(zombie));
#

:)

#

or with plain nms and bukkit,

#

CreatureSpawnEvent

#

EntitiesLoadEvent

twilit roost
echo basalt
#

Cast to EntityInsentient (or Mob with mojmappings) and change the selectors

twilit roost
echo basalt
#

funky

#

I've been working on a zombies minigame lately

#

zombies respect clientsided blocks :)

#

yeah if you read above, it's a util I made

#

I can't really bother cleaning it up and sharing it

#

🥣

#

ah

twilit roost
chrome beacon
#

Use mojmaps

echo basalt
#

~you have the nms visualizer

twilit roost
#

use nms remapping

echo basalt
twilit roost
#

google

chrome beacon
#

Read 1.19 release post

#

Or mfnalex blog

echo basalt
#

I use paperweight on groovy duke

twilit roost
echo basalt
#

I forgor I can just do that instead of cancelling events lol

opal juniper
twilit roost
#

lol