#help-development

1 messages · Page 228 of 1

civic spoke
#

or stringify it some other way

icy beacon
#

sometimes the ide shows false positives, manually make sure that you avert all the edge cases

civic spoke
#

json was just the first thing that came to mind

red sedge
#

huh- why would you do that

civic spoke
icy beacon
#

well

red sedge
#

why would you broadcast a message no one will ever be able to see

icy beacon
#

broadcast message sends it to all the players afaik

#

^

#

do Bukkit.getLogger().info()

untold patio
#

Hmm

hazy parrot
untold patio
#

I tried with object output stream but didn't work

civic spoke
#

onEnable happens when /reload happens right??

jovial grotto
#

Also how would I save a hash map? I use a hashmap to keep track of variables etc and the plugin would lose its purpose if the server crashed/restarted

red sedge
untold patio
#

Ok, imma take a look

icy beacon
#

one sec

red sedge
civic spoke
red sedge
#

i thought we left that in 2016

icy beacon
#

well you shouldn't

#

it's a bad practice

#

if you do, make a plugin command

#

like /myplugin reload

#

and handle your reload there as you wish

red sedge
#

its not necessary bad practise i wouldnt say

#

if you want to support that command

civic spoke
#

:/

#

ok

icy beacon
#

from what i know, /reload cold stops and starts all the plugins

civic spoke
#

thanks for your help btw!

red sedge
#

go for it, its unnecessary effort cos most plugins wont do it

icy beacon
#

a lot of plugins will break

kind hatch
#

I think the consensus is that /reload is fine for development purposes, but to never use it in production.

icy beacon
#

^

red sedge
#

i dont think /reload is bad if youre willing to support it

icy beacon
#

i do use it in dev because i handled the edge cases sometimes

red sedge
#

the reason its bad is because most plugins dont support it

icy beacon
#

better off creating a plugin command to only reload itself

icy beacon
#

like the reload idea is good

#

but spigot can't read the plugin's mind

#

to know what will break and what won't

jovial grotto
#

How can I save a hashmap when the server stops the plugin (Bascially when onDisable is called I want to save a hashmap, and then when onEnable is called I want to load a hashmap)

red sedge
#

uh

icy beacon
#

?pdc or file storage

red sedge
#

load it to a file

red sedge
#

supprting /reload is a bad idea because its far too much effort to get perfect and it most likely wont be used at all since most plugins will break if you do /reload

icy beacon
red sedge
#

oh and also most likely you dont need to reload the entire plugin

jovial grotto
red sedge
#

try file storage

#

yeet the hashmap into a file

icy beacon
#

it kinda is, you can bind a pdc to a chunk i think

red sedge
#

and then load it on start

icy beacon
#

files are cool but bad users might just delete them

red sedge
#

but just wondering, why do you want to save a hashmap?

icy beacon
#

so it's dangerous

red sedge
red sedge
icy beacon
#

if the dev aims to persist data between restarts why would you break it

jovial grotto
red sedge
#

well if you aim to persist data between restarts

#

that data must be increasing somewhere

icy beacon
#

pdc

red sedge
#

so youshould give the option to server owners to delete that data

icy beacon
#

yeah... it's not exactly how it works i don't think lmao

#

if the plugin needs that data why would you delete it

#

like

red sedge
#

oka

#

one option you have is to store that in the players pdc itself

icy beacon
#

imagine i'm developing a plugin and i need to save some data for the plugin to be launched properly the next time

#

and some owner deletes it because they have the option to

#

that would be kinda

#

uh

#

not cool

jovial grotto
icy beacon
icy beacon
red sedge
jovial grotto
#

I guess it isn't the end of the world

red sedge
#

chopkeys

jovial grotto
#

If they lose it

red sedge
#

you can use the players pdc

#

or you can use files

#

which would be a better idea

icy beacon
jovial grotto
red sedge
#

since it will allow the server owner to get rid of the plugin easier without having left over data

#

just use a file

icy beacon
red sedge
#

its binded to the plugin?

icy beacon
#

yeah pdc requires namespacedkeys

#

and they require plugins

red sedge
#

isnt it binded to players nbt file?

icy beacon
#

you can use NamespacedKey().minecraft() but it's a bad idea

red sedge
icy beacon
#

it will remain but it won't be used

red sedge
#

but the nbt persists even if you remove the plugin

icy beacon
#

if the plugin is deleted

red sedge
#

you probably shouldnt do that

icy beacon
red sedge
#

kind of

icy beacon
#

in what way

red sedge
#

youre practically leaving trash behind

icy beacon
#

a couple hundred bytes

#

yeah fuck it use an h2 db then

#

to store the hashmap

red sedge
#

or..

icy beacon
#

not easy to edit and easy to get rid of

#

or make a mysql database

red sedge
#

why would you not want it to be editable?

#

anyways

icy beacon
#

easy to edit if you know what you are doing, easy to get rid of, no trash left behind

icy beacon
red sedge
# jovial grotto ye

the easiest way i can think of (if you dont wanna mess w databases) is having a yaml file

icy beacon
#

bruh

red sedge
#

i doubt they have any other data to store

winged anvil
#

lmfao

#

beef

icy beacon
red sedge
#

because we have different opinions and are discussing

#

such a heated fight innit

icy beacon
#

yeah i'm stressed and sweating

winged anvil
#

ong

jovial grotto
#

Yeah it is literally a persons UUID and then a Boolean

red sedge
#

yh

#

just yeet it into a yaml file

icy beacon
# red sedge mate, theyre making a fucking freeze plugin

if you are british i won't talk to you anymore, but anyways, if this is a talk of saving player data, you can just save it in pdc and not worry ever. what the plugin can do to optimize it is delete the pdc data after it's been used, and then the only case when the data is left unused is when the plugin is deleted and somebody is frozen

winged anvil
#

see thats major beef

icy beacon
icy beacon
#

are you... bri'ish?

red sedge
#

who knows

winged anvil
#

nah i agree with lol for plugins you distribute, use file storage, not pdc for the reasons they already stated

icy beacon
#

lord have mercy

icy beacon
red sedge
#

i dont really like pdc anyways

icy beacon
#

oh that's a convincing argument

#

have a nice day

red sedge
#

no its an opinion

winged anvil
#

the argument was, devs would leave behind data if a plugin was deleted. seems good enough for me

icy beacon
#

i mean, yeah, you are right, the data will be left behind, but why is it a problem if the amount of data is insignificant

red sedge
#

because it shouldnt be there

#

if i uninstall something, i expect it to be gone

icy beacon
#

the only way you can access it is if you hard view the nbt files, and if it's basically inaccessible, it's basically gone, no?

red sedge
#

that makes it worse

#

it makes it harder to get rid of

icy beacon
#

but if you install the plugin again, it can reuse the data, which is good

#

what if you deleted the plugin by mistake with some worthy data, and all of it was stored in files?

red sedge
#

but you want to backup the data in the plugin

#

you cant

icy beacon
red sedge
#

many people do actually

icy beacon
#

i know a lot of server maintainers who never did backups until i advised them to

#

it's kinda fucked up

red sedge
icy beacon
#

trash bin?????

red sedge
#

idfk everyone calls it smth different

icy beacon
#

i thought literally everyone used ftp and a vds and not a local server to host a minecraft server

#

what

#

if you've found a way to manipulate the vds' trash bin with ftp and you find it reasonable, you've achieved a higher plane of existence

red sedge
#

sdfgiefjgkl

#

anyways i dont think ive seen anyone accidentally delete the plugin folder

icy beacon
#

people are clumsy

red sedge
#

ah yes

icy beacon
#

xd

red sedge
#

"so my hand fell and i selected the plugin folder, went across the screen clicked the delete button, and then my mouse also went to the confirm button and pressed it"

echo basalt
icy beacon
#

haven't seen a confirm button in ages, but btw, a while ago i used an explorer that, when alphabetically sorting, would mix files and folders together, so it was really easy to just select them together lmao

#

most explorers and ftp clients now separate them

#

but it's kinda bad

#

that it was possible

red sedge
#

at that point you probably shouldnt run a server

#

juss sayin

#

leave server running to people above 8

icy beacon
#

i mean, on the server i'm developing, all the plugins are private so i micromanage every piece of shit

#

have you been to r/admincraft? people do the wildest shit there

icy beacon
red sedge
icy beacon
#

i use mysql for convenience, but i used to use pdc before, because it was easy to manage everything

#

plugin files can be broken in a matter of seconds, but i haven't really seen people going into playerdata and messing with it

#

anyway

#

guess it's up to chopkeys anyway

red sedge
#

oh

#

fuck i forgot this was about chopkeys

icy beacon
#

xD

#

hottest beef ever

#

btw do you have experience with kotlin?

red sedge
#

nah

#

why

icy beacon
red sedge
quiet ice
#

So if that actually was what you wanted we got an issue

winged anvil
civic wind
undone kernel
#

when was meta.addItemFlags added

atomic swift
#

new AttributeModifier(String name, double amount, Operation operation) is the name just anything i want

warm mica
undone kernel
fresh timber
#

I am setting a format with this line:

event.setFormat("§8[§4§lOWNER§8] §f%s: %s");

how can I allow them to use color codes in this? I tried to use:

event.setFormat(ChatColor.translateAlternateColorCodes('&', "§8[§4§lOWNER§8] §f%s: %s"))

but it did not seem to work. How do I allow color codes with & for this?

quiet ice
undone kernel
undone kernel
quiet ice
#

And quite random too

undone kernel
#

it works like this

fresh timber
warm mica
#

please stop with what you are doing immediately

undone kernel
fresh timber
#

well that msg will contain & signs cus the 2nd %s is the msg

#

this should not help

#

its the same thing

quiet ice
#

You must set the message, not the format

undone kernel
fresh timber
#

;-;

quiet ice
#

Calling event.setFormat(ChatColor.translateAlternateColorCodes('&', "§8[§4§lOWNER§8] §f%s: %s")) is identically to calliung

String var10001 = ChatColor.translateAlternateColorCodes('&', "§8[§4§lOWNER§8] §f%s: %s");
event.setFormat(var10001);

which is identical to calling

String var10001 = "§8[§4§lOWNER§8] §f%s: %s";
event.setFormat(var10001);

which is identical to calling

event.setFormat("§8[§4§lOWNER§8] §f%s: %s");
quiet ice
undone kernel
fresh timber
#

in a chat format, %s first time is the players name and %s second time is name

quiet ice
#

You seem to confuse .setFormat with .setMessage

undone kernel
#

damn i do my chat things completely differently and probably wrong ;- ;

quiet ice
#

Oh, so many people do things completely wrong in bukkit world

fresh timber
#

but, how do I allow ppl to use chat colors

#

because it does not work to use &c or anything wiht translatealternatecolorcodes or anything else ive tried

quiet ice
#

?jd sigh

fresh timber
#

I hate this website

#

doesnt tell me anything

undone kernel
quiet ice
atomic swift
#

new AttributeModifier(String name, double amount, Operation operation) is the name just anything i want

red sedge
#

how would i go about making custom blocks with directions?

#

like for directionless ones i can use noteblocks

red sedge
#

but i dont think using noteblocks for ones that have a direction would be a good idea since therres only about 1000~ block states for noteblocks

red sedge
#

and each block would require 6 states just to function

civic spoke
#

how might you save/load a location to/from a string?

#

like i can do the x, y, z components easily but for the constructor how do i have the world argument

quiet ice
#

You can leave it null if needed

#

I believe

undone kernel
quiet ice
#

I prefer UUIDs

round finch
civic spoke
quiet ice
#

Try it out and find out. Probably will break everything instantly though as it is meant for semi-loaded locations

civic spoke
#

what even is a World?? is it for the different dimensions?

quiet ice
#

Yeah

quiet ice
#

Can't you make up new blockstates these days?

red sedge
#

dont think so

round finch
red sedge
#

oh what?

civic spoke
round finch
#

i did a spinning sign once

wary topaz
#

Line 20.

red sedge
civic spoke
#

oh

red sedge
#

youre overriding another block state

round finch
#

get the blockstate
change the blockstate
CB_shrug

wary topaz
#

?

#

Why?

quiet ice
#

it shouldn't even compile to be exact

quiet ice
#

You never assign anything to plugin and that assignment is run before the constructor

red sedge
#

it needs to be a valid block state form minecrafts existing ones

wary topaz
#

oh

#

alr

round finch
#

yeah it is needs to be existing block ofc

quiet ice
#

Protip: Use JavaPlugin#getProvidingPlugin

red sedge
quiet ice
#

Mushrooms, but those are limited too

red sedge
#

cant i just like change the nbt of the placed noteblock to a custom instrument like idk "hello"

#

imma try-

quiet ice
#

But can't you define more blocks through datapacks or does the client need to be aware of that too (i.e. resource packs aren't enough?)

round finch
#

pdc?

red sedge
#

custom models dont work w pdc

#

bedrock has custom blockstates :c

quiet ice
#

If PDC is the concern, just use chunk pdc as long as it isn't absurd amounts of data you need to store

red sedge
#

no its not the isuse

#

the custom models are

atomic swift
#

new AttributeModifier(String name, double amount, Operation operation) is the name just anything i want bc theres nothing in the javadoc

round finch
#

getCustomModelData?

quiet ice
#

that is for itemstacks

round finch
#

1 sec lemme search

atomic swift
quiet ice
#

-.-

#

They want to apply it on blocks

round finch
#

ye

atomic swift
#
ItemMeta meta = ItemStack#getItemMeta();
meta.setCustomModelData(Integer);
ItemStack#setItemMeta(meta);

red sedge
#

gosh why does java have to have weird ass blockstate rules

quiet ice
#

that is mc

red sedge
#

no but bedrock can just say "lets add custom_block_model_5843" and it does

quiet ice
#

Ah java edition you mean

red sedge
#

yas

#

i hate this

round finch
#

sadge

#

nothing i see

red sedge
#

redstone wire has a lot of statess

#

but since its not a full block and its insta brak

#

cant use it

#

alr im just gonna make a script for it

sterile token
#

Hi, how is called the thing thatis use by faction plugins to display the regions/areas corners? I try to look for them via Map view but its nothing to do with that i expect

undone kernel
#

why doesn't this work

chrome beacon
#

Looks like that constructor doesn't exist

sterile token
undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

undone kernel
chrome beacon
#

My guess is that your version doesn't have that one

undone kernel
#

i'm pretty sure I have everything that it'

#

s asking for

chrome beacon
#

What version of spigot are you depending on

sterile token
undone kernel
#

1.5.2

quiet ice
#

UUID.randomUUID().toString()

sterile token
chrome beacon
#

Also 1.5.2 💀

undone kernel
sterile token
#

1.5.2 is dinosaur

undone kernel
#

it shows up and everything

chrome beacon
#

It doesn't

sterile token
chrome beacon
#

Not in 1.5.2

quiet ice
#

Does anyone know some decent (J8-style) javadoc page for legacy versions?

sterile token
#

Spigot support only +1.16 up

undone kernel
#

and it works without the Equipment slot thing

chrome beacon
#

Yeah

#

The equipment slot param is new

sterile token
quiet ice
#

Does the attributeModifier class event exist in 1.5.2?

undone kernel
quiet ice
undone kernel
undone kernel
quiet ice
#

Probably has something to do with 1.5 vs 1.5.2. Ugh

sterile token
undone kernel
#

so I can't use the Equipment slot thing

chrome beacon
#

No

#

As I've said it doesn't exist

undone kernel
#

damn

#

so everything else exists except the one thing that is important

undone kernel
quiet ice
#

Yeah, the screenshot explains enough

undone kernel
#

yes it does

#

google it

quiet ice
#

(For reference eaglercraft is EoL though as fra s I know)

sterile token
#

totally agree

quiet ice
#

Or rather said the repos were meant to be taken down

undone kernel
#

I got the item and everything

#

but I can't add an attribute

red sedge
#

thats sad..

#

really hoped there would be more block states

undone kernel
#

bruh I just discovered that the AttributeModifier is a thing but YOU CAN'T ACTULLY USE IT

red sedge
#

most of them aint even solid blocks

#

i mean

#

i guess i could always go with the good old armor stand way

quiet ice
civic spoke
#

how do you do file io? i tried to read/write to a file but it's not finding it despite it being in the same directory

quiet ice
#

Are you sure that it is in the same dir?

undone kernel
quiet ice
#

i.e. did you do any typos or anything?

undone kernel
quiet ice
civic spoke
quiet ice
#

aha, cb

undone kernel
#

also how tf do I use this

quiet ice
undone kernel
#
    @EventHandler
    public void onArmorEquip(ArmorEquipEvent e) {
        Player p = e.getPlayer();
        if (e.getOldArmorPiece().getItemMeta().equals(itemManager.ultimateHelmet().getItemMeta())) {
            p.setMaxHealth(p.getMaxHealth()+5);
        }

    }```
like I have this code
civic spoke
#

<root server>/plugins/MninPlugin.jar and <root server>/plugins/mnin_data.json

undone kernel
#

nvm again it broke

quiet ice
civic spoke
quiet ice
#

What is the READ path and what is the WRITE path?

pine island
#

Havent used spigot in a million years and my 1.8(i know please dont shout at me) import is not working and yes i have my repos imported:

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

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.8.8-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</project>
civic spoke
quiet ice
# undone kernel

ugh, it is nearly impossible to obtain any decent javadocs for legacy CB

quiet ice
undone kernel
mighty pier
#

is there anything else i could do instead of ```java
if (something) {
if (othersomething) {

}else {

}
}else{

}```?

civic spoke
#

based on the logs

quiet ice
#

Okay, funny

pine island
quiet ice
#

I meant stacktrace when I said "exception"

pine island
quiet ice
undone kernel
#

oh wait I found the class for the attribute thing

quiet ice
#

Unless there really is no "AtrributeModifier" class, which would mean that you have some random atrifact adding that class on the compile classpath even though you do not want to

undone kernel
civic spoke
#
[15:51:29 ERROR]: Error occurred while disabling MninPlugin v1.0 (Is it up to date?)
java.lang.NoClassDefFoundError: org/json/JSONObject
    at mnin.DataSaver.saveData(DataSaver.java:29) ~[?:?]
    at mnin.MninPlugin.onDisable(MninPlugin.java:25) ~[?:?]
``` i am in pain
quiet ice
quiet ice
civic spoke
quiet ice
#

That is unless you want to play the classloader

#

Working as intended

round finch
civic spoke
undone kernel
quiet ice
civic spoke
#

i'm importing them

quiet ice
#

Loading != importing

civic spoke
#
package mnin;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.*;
import java.util.logging.Level;
import org.bukkit.command.*;

public class MninPlugin extends JavaPlugin {
    CommandRunner runner = CommandRunner.getInstance();
    DataSaver dataSaver = DataSaver.getInstance();
    
    // Fired when plugin is first enabled
    @Override
    public void onEnable() {
        try {
            dataSaver.loadData();
        } catch (FileNotFoundException e) {
            getLogger().log(Level.WARNING, "Save data file not found (" + dataSaver.getSaveFilename() + ")");
        }
    }
    
    // Fired when plugin is disabled
    @Override
    public void onDisable() {
        try {
            dataSaver.saveData();
        } catch (IOException e) {
            getLogger().log(Level.SEVERE, "Could not write to save data file");
        }
    }
    
    // Fired on command
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        return runner.runCommand(sender, command, label, args);
    }
}
quiet ice
#

Java will load classes as late as possible

#

But because spigot is spigot it will pseudo-close the classloader and thus refuse to load the classes when the plugin is disabled (which is the case when running onDisable)

#

It's really annoying behaviour, but unfortunately intended

#

(the classes being loaded/initialized late is very useful behaviour though)

civic spoke
#
package mnin;
import java.io.*;
import java.util.*;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.json.*;

final class DataSaver {
    private static DataSaver instance = null;
    private static final String filename = "mnin_data.json";
    private JSONObject savedData;
    private DataSaver() {
    }
    
    public String getSaveFilename() {return filename;}
    
    public void loadData() throws FileNotFoundException {
        File f = new File(filename);
        Scanner sc = new Scanner(f);
        ArrayList<String> lines = new ArrayList<>();
        while (sc.hasNextLine())
            lines.add(sc.nextLine());
        sc.close();
        String strData = String.join("\n", lines);
        savedData = new JSONObject(strData);
    }
    
    public void saveData() throws IOException {
        String strData = savedData.toString(4);
        FileWriter f = new FileWriter(filename);
        f.write(strData);
        f.close();
    }
    
    public JSONObject getSavedData(Player player) {
        return savedData.getJSONObject(player.getUniqueId().toString());
    }
    
    public void setSavedValue(Player player, SavedDataKey key, Object value) {
        if (value instanceof Location) {
            Location loc = (Location) value;
            double[] locData = new double[] {
                loc.getX(),
                loc.getY(),
                loc.getZ(),
                loc.getPitch(),
                loc.getYaw()
            };
            JSONArray arr = new JSONArray(locData);
            getSavedData(player).put(key.toString(), arr);
        } else {
            getSavedData(player).put(key.toString(), value);
        }
    }
    
    public boolean savedDataHas(Player player, SavedDataKey key) {
        return getSavedData(player).has(key.toString());
    }
// Snip
    public static DataSaver getInstance() {
        if (instance == null)
            instance = new DataSaver();
        return instance;
    }
}
#

DataSaver.java (sorry for the text wall)

#

saveData is where the error occurs

#

because it can't find JSONObject

hard ether
#

Is there a better method to use for broadcasting than broadcastMessage()?

quiet ice
#

Then do the same for any other class that will throw similar exceptions

#

It sounds stupid, but it works

civic spoke
quiet ice
#

okay hold on, that class should be loaded when constructing that class

#

Did you shade that class?

civic spoke
tulip nimbus
quiet ice
#

And what other stacktraces do you see? NoClassDefFoundException is usually not alone

quiet ice
# civic spoke ?

As in did you include that class in your jar. Or in layman's terms: Gib jar

civic spoke
#

it's in src/mnin which is included since MninPlugin which is also in there is included

quiet ice
#

Yeah, I really want to see that jar now

civic spoke
quiet ice
#

I guess you accidentally jar-in-jar'd (JIJ) org.json:json as I doubt you included the org.json:json source code in your plugin's source code folder

quiet ice
civic spoke
#

should i just extract that jar?

quiet ice
#

Really, give me the compiled jar, I can only do a guessing game without that jar

civic spoke
#

sent

quiet ice
#

(alternative give a screenshot of the project folder, but what is the fun in that - plus it wouldn't affirm nor deny my current suspicion of accidental JIJ-ing)

#

okay, thanks to you using eclipse I already know how the project folder looks like

quiet ice
#

I hate to break it to you, but you got to decide: Maven or gradle?

#

(There is also Ant and other fringe build tools such as slbrachyura, but we shouldn't go that route, should we?)

civic spoke
quiet ice
#

Just that that does not work in your case

#

Unless you copy over the contents of org.json:json's source code to your source folder or the content's org.json:json's compiled .class files to your resource folder

#

which uhm, would be cursed AF

civic spoke
pure cloud
#

You'll thank yourself if you learn maven or gradle 🙂

quiet ice
#

For eclipse maven is better. Gradle's eclipse integration leaves much to be desired

#

(I know, technically it is an eclipse plugin providing gradle support, but whatever)

pure cloud
#

I'm surprised there are still people using Eclipse tbh

#

It's what I started off using but I quickly moved to IntelliJ

floral kindle
#

Does anyone know an alternative way to this function that is not working anymore?

entity.damage(1, player);

quiet ice
#

I wouldn't be able to make the switch - especially not nowadays as most of my stack would rely on IJ's eclipse project support

pure cloud
#

Anyway, either Maven or Gradle will make it much easier for you to build your software both now and in the future. I think Maven is probably a bit more well-known/supported, especially in the MC world. Afaik there's nothing you'd want to do that Maven can't do

civic spoke
#

yeah the cursed "solution" wasn't working; i'll switch to maven

quiet ice
#

it definitely does, you need to unzip the jar first though

floral kindle
pure cloud
quiet ice
#

Yeah it should still work

pure cloud
#

Are there errors in the console? Does it work on a server without any other plugins?

civic spoke
#

as for changing the project type to maven: what does that do for me?

pure cloud
#

Also, if you're interested in becoming more serious about writing software it's generally better to use tools like Maven rather than relying on your IDE to build your project

civic spoke
#

good idea

floral kindle
#

The Damage it showed was only because it was close only melee damage

pure cloud
#

But, basically, Maven will expect your project to be structured in a certain way, e.g. your source code will bein src/main/java, other files that go in your .jar are in src/main/resources. When you run the maven command in your terminal Maven will read a file called pom.xml and compile your project which produces your .jar file

#

A basic pom.xml will look like this:

<?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>Your Java package</groupId>
  <artifactId>Your Plugin Name</artifactId>
  <version>1.0.0-SNAPSHOT</version>

  <name>Your Plugin Name</name>
  <description></description>
  <url></url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>17</maven.compiler.source>
    <maven.compiler.target>17</maven.compiler.target>
  </properties>

    <dependencies>
      <dependency>
        <groupId>org.spigotmc</groupId>
        <artifactId>spigot-api</artifactId>
        <version>1.19.2-R0.1-SNAPSHOT</version>
      </dependency>
    </dependencies>
</project>
#

This tells Maven that you're using the Spigot API, so when you compile your code it can check that the function you're calling actually exist, you're calling them correctly, etc.

quiet ice
#

Do note that they also want to shade org.json:json

pure cloud
#

Now, for your JSON dependency you'd add it in the <dependencies> block. This tells Maven you're using that library. You can then tell Maven to include the code from the JSON dependency in your .jar, which will let Spigot load it when your plugin executes. This is called shading a jar, or producing a fat jar

trim lake
#

Im sorry for asking probably stupid question here again... But Im kinda lost. Is there way how to you TextComponent.formLegacyText in BaseComponent[]? I tried this but is not working Im getting error.``` BaseComponent[] testBuild = new ComponentBuilder(TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', "&eLOOOOL"))).create();

pure cloud
quiet ice
#

?jd

pure cloud
quiet ice
#

BaseComponent is basically an abstract class for all what you want

pure cloud
quiet ice
#

why it isn't is beyond me

#

Oh lol, I may be stupid there

#

Although I'd still get rid of the whole new ComponentBuilder step and use .fromLegacyText from the get-go

trim lake
#

I want to use BaseComponent bcs I want to have multiple messages on one line (some of them clickable). I know, I can makeit true TextComponent.addnext but someone told me here to use BaseComponent bcs its easier. Idk...

#

Im just new in java idk what is best option to use.

strong parcel
#

I am changing the player's swim speed using the code from this thread, and something strange is happening that I do not understand. https://www.spigotmc.org/threads/how-to-increase-player-swimming-speed.547842/ When the multiplier is set to something like 0.825, the player swims faster than normal. If I am multiplying a vector by a decimal, shouldn't it make the player slower? Does this have something to do with the normal movement speed being 0.2?

#

When the multiplier is below 0.2, the player swims slower than normal.

#

Is it because the normal walking speed is the multiplier?

#

And by changing the multiplier, I am changing that...

worldly ingot
#

The multiply operation adds one first, then multiplies

#

So you should be adding a modifier that multiplies the value 0.825 - 1

#

Oh, sorry, you're using vectors, not attributes. That's what I get for not reading the thread you linked

echo basalt
#

@sterile token I'll let you know I'm recoding my entire menu system and all the concepts you're stealing from me are obsolete :)

dusk flicker
#

LOL

undone kernel
torn badge
#

Anyone know how to properly cancel InventoryClickEvent with ClickType SWAP_OFF_HAND?

#

If I cancel it the clicked item doesn't move but rather duplicates into the off hand slot

torn badge
undone kernel
torn badge
#

Works for me

#

What version?

chrome beacon
#

1.5.2 💀

torn badge
#

tf

torn badge
undone kernel
#

idk

torn badge
#

Check it

#

Open implementation

undone kernel
undone kernel
torn badge
#

Okay on an array it should be length

undone kernel
#

yeah but size() doesn't exist 💀

torn badge
#

length not size()

#

size() is on newer versions

undone kernel
torn badge
undone kernel
#

it just takes me to the bukkit.getOnlinePlayers

torn badge
undone kernel
#

right here

#

can't do shat in 1.5.2 💀

kind hatch
undone kernel
#

what's an alternative to

Bukkit.broadcastMessage```
since it's deprecated
sacred hamlet
#

hello everyone !
who helpe me please ?




            Location loc = new Location(block.getWorld(), x1,y1,z);
            

            if( block.getWorld().getNearbyEntities(loc,1,1,1,(entity -> entity.getType() == EntityType.ITEM_FRAME))){
                block.breakNaturally();
                System.out.println("Breack");
            }else{
                System.out.println("Erreur");
            }
            ```

i go in get ITEM_FRAME for locality
#

ps: sorry i am french ^^

undone kernel
worldly ingot
#

It is on Paper. Likely what they're using

#

Best to ask for support with Paper API in the Paper Discord

kind hatch
#

I always forget that's a paper thing.

#

It's so dumb.

undone kernel
#

yes yes it si

#

is*

sacred hamlet
dim bronze
#

whats the site to find spigot mappings to mojang mappings?

river oracle
#

screamingsandles

dim bronze
#

thank you

undone kernel
#

how can I make this available everywhere like I put this in the main class and it works in all of em

vital yacht
vital yacht
#

No problem

undone kernel
#

ik ik i'm just using it for this one thing

#

also bruh

[18:03:05 ERROR]: Error occurred while enabling ServerThings v0.1 (Is it up to date?)
java.lang.NullPointerException: null
    at java.util.Objects.requireNonNull(Objects.java:208) ~[?:?]
    at me.darklife12345.serverthings.ServerThings.onEnable(ServerThings.java:24) ~[ServerThings-0.1.jar:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:542) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:565) ~[paper-1.19.2.jar:git-Paper-279]
    at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:479) ~[paper-1.19.2.jar:git-Paper-279]
    at org.bukkit.craftbukkit.v1_19_R1.CraftServer.reload(CraftServer.java:1025) ~[paper-1.19.2.jar:git-Paper-279]
    at org.bukkit.Bukkit.reload(Bukkit.java:930) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:54) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.craftbukkit.v1_19_R1.CraftServer.dispatchCommand(CraftServer.java:916) ~[paper-1.19.2.jar:git-Paper-279]
    at org.bukkit.craftbukkit.v1_19_R1.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64) ~[paper-1.19.2.jar:git-Paper-279]
    at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:264) ~[paper-1.19.2.jar:?]
    at net.minecraft.commands.Commands.performCommand(Commands.java:305) ~[?:?]
    at net.minecraft.commands.Commands.performCommand(Commands.java:289) ~[?:?]
    at net.minecraft.server.network.ServerGamePacketListenerImpl.performChatCommand(ServerGamePacketListenerImpl.java:2294) ~[?:?]
    at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$20(ServerGamePacketListenerImpl.java:2248) ~[?:?]
    at net.minecraft.util.thread.BlockableEventLoop.lambda$submitAsync$0(BlockableEventLoop.java:59) ~[?:?]
    at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
    at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.19.2.jar:git-Paper-279]
    at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
    at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
    at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1341) ~[paper-1.19.2.jar:git-Paper-279]
    at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:185) ~[paper-1.19.2.jar:git-Paper-279]
    at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
    at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1318) ~[paper-1.19.2.jar:git-Paper-279]
    at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1311) ~[paper-1.19.2.jar:git-Paper-279]
    at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
    at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1289) ~[paper-1.19.2.jar:git-Paper-279]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1177) ~[paper-1.19.2.jar:git-Paper-279]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:305) ~[paper-1.19.2.jar:git-Paper-279]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]
#
    public void onEnable() {
        //Config shit
        this.getConfig().options().copyDefaults();
        this.saveDefaultConfig();
        //Command Shit
        Objects.requireNonNull(this.getCommand("heal")).setExecutor(new Health(this));
        Objects.requireNonNull(this.getCommand("feed")).setExecutor(new Health(this));
        Objects.requireNonNull(this.getCommand("starve")).setExecutor(new Health(this));
        Objects.requireNonNull(this.getCommand("suicide")).setExecutor(new Health(this));
        Objects.requireNonNull(this.getCommand("multisummon")).setExecutor(new MS(this));
        Objects.requireNonNull(this.getCommand("unenchant")).setExecutor(new UnEnchant(this));
        Objects.requireNonNull(this.getCommand("online")).setExecutor(new Online(this));

        //Event Shit

        //Tab-completer Shit
    }```
undone kernel
vital yacht
vital yacht
#

Can you send your plugin.yml?

undone kernel
#
  #Health Commands
  heal:
    usage: /<command>
    description: Heals you or another player
  feed:
    usage: /<command>
    description: Feeds you or another player
  starve:
    usage: /<command>
    description: Starves you or another player
  suicide:
    usage: /<command>
    description: Kills you or another player
vital yacht
#

You only have 4 commands there but 7 in the class

#

So you need to register the rest

undone kernel
#

shit i'm stupid

vital yacht
#

Also did you use /reload?

undone kernel
#

I was thinking about the health commands

undone kernel
#

I am to lazy to restart a server

vital yacht
#

Yeah you don't really want to do that

#

It's going to break a lot of things

undone kernel
#

it breaks essentials I know that

#

but nothing really happens to mine

#

but thanks

vital yacht
#

Just don't ever use it in production

undone kernel
#

fps go brrr

#

yeah about that is this just paper

vital yacht
#

That will suppress any other null warnings though

undone kernel
#

bc i'm starting to think paper is doing some weird things

vital yacht
#

I would recommend moving your command registration to another method

#

Especially if you do this

vital yacht
#

Yeah

#

I'll edit it

undone kernel
#

you're

    @SuppressWarnings("ConstantConditions")```
#

is being really annoying now

#

it's highlighting it

vital yacht
#

You didn't move the commands into the new method

undone kernel
vital yacht
undone kernel
#

look at all this little code

#

idk it's some code I stole from yt

vital yacht
#

If you're going to use code from YouTube make sure you understand it

undone kernel
#

can I do events the same way

worldly ingot
#

You can do one of two things, both of which do different things

this.getConfig().options().copyDefaults();
this.saveConfig();

// OR
this.saveDefaultConfig();```
The former copies the default keys and values from the config.yml in your plugin, then re-saves the config with those default values in your plugin config directory. The latter basically copy/pastes the config.yml from your plugin into your plugin config directory if it doesn't exist yet
undone kernel
#

and it works

vital yacht
worldly ingot
#

You can just have saveDefaultConfig(); That's it. All you need

undone kernel
#

alr thanks

vital yacht
worldly ingot
#

Not necessarily. Consider this situation.

# This file is in your /plugins/MyPlugin/config.yml
FirstValue: 69

# This file is in your plugin's default config.yml file (the one you export with your plugin)
FirstValue: 69
SecondValue: 420```
Running `getConfig().options().copyDefaults()` and `saveConfig()` will copy `SecondValue: 420` into the config.yml in your server files, whereas running `saveDefaultConfig()` will not because the file already exists on disk
undone kernel
worldly ingot
#

The values in the config.yml exported with your plugin are also defined as defaults

#

It's basically automatically doing addDefault() for you

undone kernel
#

alr now i'm confused to I keep the default thing or no

worldly ingot
#

No, Catto. You can remove it lol

#

You should only need to call saveDefaultConfig()

undone kernel
#

bruh I forgot verifying changed my name 💀

worldly ingot
#

ye

vital yacht
#

Yeah I need to change my name at some point lol

undone kernel
worldly ingot
#

If you end up doing that, give me an @ and link me your Spigot profile, I'll update it on Discord. We have to do it manually

vital yacht
#

I will thank you

undone kernel
worldly ingot
#

Welllll do it after you've changed your forum name lol

vital yacht
undone kernel
#

once I figure out how to do it

undone kernel
vital yacht
undone kernel
#

i guess i'm stuck with this name for now

sterile token
vital yacht
#

Wait you’re the 1.5 person from HelpChat

undone kernel
undone kernel
vital yacht
#

Nice

fervent panther
#

Hi I'm making a sword that shoots cobwebs and I wanna either delete or explode a cobweb after it's been placed. Is there a good way of doing this?

#

Here's what I'm currently doing

if (customItemId.equals("spider_sword")) {
        World world = player.getWorld();

        FallingBlock cobweb = (FallingBlock) world.spawnFallingBlock(player.getLocation().add(0, 1, 0), Material.COBWEB.createBlockData());

        cobweb.setDropItem(false);
        cobweb.setVelocity(player.getLocation().getDirection().multiply(0.8));
}
undone kernel
#

also what's the thing to use custom items in recipes

sullen marlin
#

put a tag in the cobweb PDC and then use the falling block event

#

?pdc

sullen marlin
#

EntityChangeBlockEvent I think

fervent panther
#

Thanks!

#

I'm new to Java could you give me some advice on organizing my project?

#

I was trying to take a screenshot but it's not working for some reason

sullen marlin
#

Must verify to send images

fervent panther
#

oh

#

This is my current project structure

sullen marlin
#

Seems fine

fervent panther
#

Should I make a separate class to for all entity related events?

dusk flicker
#

honestly wouldent think thats a structure of someone new to java

#

like, thats better than most lol

fervent panther
#

Like where would I put EntityChangeBlockEvent

#

haha thanks

sullen marlin
#

You could have a class that handles all events related to the cobweb sword

dusk flicker
#

Generally when it comes to listeners, I create classes based on what the event is going to be used for. Example I would have any listeners related to a certain aspect of the game in one class

sullen marlin
#

Or the itemevents class is fine, since it's an item still

#

Rip

#

Just lost power

dusk flicker
#

oooof

sullen marlin
#

Oops wrong channel

dusk flicker
#

lol

fervent panther
#

Ok thanks!

undone kernel
#

alr so I have this sword code

    public ItemStack ultimateSword() {
        ItemStack ultimateSword = new ItemStack(Material.DIAMOND_SWORD, 1);
        ItemMeta meta = ultimateSword.getItemMeta();
        meta.setDisplayName("§4§kscary§1Ultimate Sword§4§kscary");
        meta.addEnchant(Enchantment.DAMAGE_ALL, 10, true);
        meta.addEnchant(Enchantment.KNOCKBACK, 10, true);
        meta.addEnchant(Enchantment.FIRE_ASPECT, 10, true);
        meta.addEnchant(Enchantment.DURABILITY, 10, true);
        AttributeModifier dmg = new AttributeModifier(UUID.randomUUID(), "generic.attackDamage", 70.0, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND);
        meta.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, dmg);
        ultimateSword.setItemMeta(meta);
        return ultimateSword;
    }```
and whenever I try to add an attribute it breaks my event to explode on right click
```java
                if (e.getItem().getItemMeta().equals(itemManager.ultimateSword().getItemMeta())) {
                    if (!cooldown.containsKey(p.getUniqueId()) || System.currentTimeMillis() - cooldown.get(p.getUniqueId()) > 5000) {
                        cooldown.put(p.getUniqueId(), System.currentTimeMillis());
                        p.sendMessage(colorize("&aYou've used the Ultimate Ability!"));
                        p.getWorld().createExplosion(p.getLocation(), 15f);
                    } else {
                        p.sendMessage(colorize("&4You can't use this for another &e" + (5000 - (System.currentTimeMillis() - cooldown.get(p.getUniqueId()))) / 1000 + " &4seconds!"));
                    }
                }```
anyone got any idea why this is happening
fervent panther
#

When you change an attribute the item stops exploding on right click?

#

Are you grabbing a new ultimateSword in mc after making the change in code?

undone kernel
#

when I added the attribute for more damage the event stopped working

fervent panther
undone kernel
fervent panther
#

Yes but the new sword has a different meta

#

when you're checking if the item the player using is the sword in the event it's comparing the meta including the new attribute

undone kernel
#

that's what it should do

#

to make sure the sword is authentic

fervent panther
#

yes

#

but if you don't get a new sword in minecraft after making a change to it in the code it won't detect is as the correct sword

#

your old sword isn't authentic anymore

undone kernel
#

i have no idea what you're trying to say

#

it's just one sword

#

OH do you mean like I get the sword with the updated code?

fervent panther
#

yeah

undone kernel
#

because yes I've done that and no it doesn't work

fervent panther
#

Ah ok

#

I don't have much spigot knowledge so I don't think I can help but I'm curious what attribute you're adding

fervent panther
#

How are you getting the sword?

undone kernel
fervent panther
#

oh I missed it lol

#

Looks cool

undone kernel
#

so whenever I run that command it should give me the updated sword

loud frost
#

This question is extremely related to what I have made in the past (and am currently refactoring) lol

#

How are you determining if your item is the sword in the event code?

#

nvm i see now

#

Its because when you add the attribute its metadata changes

#

so your conditional will always return false if anything is added.

#

You need to find a different way to verify the item

drowsy helm
#

just use pdc

#

so much easier

digital plinth
#

anyone know if you can force change a mob's texture to something else like protocallib's disguise

drowsy helm
#

protocol lib doesnt change textures

#

it just spoofs which entity is actually there

digital plinth
#

ah

#

so i have to make the client download a resourcepack?

drowsy helm
#

for texture, yes

digital plinth
#

okie

#

and can you like

#

give a mob a tag

#

and apply custom texture to mobs with tags only

#

i did it with items before

drowsy helm
#

iirc, no

digital plinth
#

tsk

#

:<

#

okay thx for the info

digital plinth
#

like the rainbow sheep

#

and cat

drowsy helm
#

pretty sure thats clientside

#

like hardcoded

digital plinth
#

is it something you can change with texture packs?

#

i think each mobs have their own texture

digital plinth
fresh timber
#

How can I change the hardness of a block?

river oracle
#

AFAIK you can't I'm pretty sure all those values are locked in nms

#

I doubt you find something but I'd suggest digging around nms

drowsy helm
fresh timber
#

hm oh yea

#

I could add mining fatigue if they are targeting it

#

wait is there an event for someone starting to break a block or is that just like interact event?

drowsy helm
#

yeah BlockDamageEvent or smth like that

#

then theres an Abort event

fresh timber
#

whats the abort event for

drowsy helm
#

if they abort breaking it

fresh timber
#

oh ye ok thx

#

I was abt to give up when I saw ppl using nms

#

it looks so confusing

drowsy helm
#

just use remapped

#

its easy

fresh timber
#

whats that

drowsy helm
#

mojang mappings for nms

#

just doesnt use obfuscated names

fresh timber
#

ima just use mining fatigue for now xd

#

wait... is there a way I can add mining fatigue but not make their hand move super slow

#

there must be cus hypixel does it

river oracle
#

Packets probably

fresh timber
#

for their dungeon hub

#

never done packets

river oracle
#

There's no avoiding nms 😈

fresh timber
#

😱

#

do I need any extra repositories/dependencies for nms to work cus I cant seem to get it to work.

remote swallow
#

?bt

undone axleBOT
remote swallow
#

also remove the -api on the dep

fresh timber
#

I dont see a dependency/repo on this page

undone kernel
drowsy helm
#

?pdc

drowsy helm
#

its just an nbt wrapper

#

use an id to differentiate items

digital plinth
#

can you make a zombie attack? like play the attack animation with no target in mind

vital yacht
#

I used PacketEvents which is a very nice library

vital yacht
remote swallow
pine island
#

is there a way to change the hit velocity of a player so for example i listen for a playerHitEvent and then make it so that their knockback is decreased by 25%?

icy beacon
summer scroll
#

Can you save a list of ItemStack inside an ItemStack, with pdc perhaps?

icy beacon
#

it doesn't seem that itemstack has pdc unfortunately

#

nbt maybe?

drowsy helm
#

just use base 64 encoding

icy beacon
drowsy helm
#

yes

icy beacon
#

strange, didn't see that in the docs

drowsy helm
#

wait wdym does have pdc

summer scroll
drowsy helm
#

yes a string, but its encoded

icy beacon
drowsy helm
#

not just 'saving'

#

yes ik what pdc is but your question doesnt make sense

icy beacon
#

for example Player extends PersistentDataHolder

#

and you can use its pdc

summer scroll
#

It's from ItemMeta.

icy beacon
#

ItemStack does'nt

icy beacon
#

yeah i guess it does

summer scroll
icy beacon
#

forgot it was a thing 😄

drowsy helm
#

i have a gist if you want to see how

sacred hamlet
#

What is list of event please (i check item frame place but i dont have évent)

drowsy helm
#

should be BlockPlaceEvent

sacred hamlet
drowsy helm
#

probs HangingPlaceEvent

sacred hamlet
#

I loock this but i loock Système.out.printer("évent") but 0 log is get

quaint mantle
#

How can I make an item given to myself when I join without giving me multiple times? Like I got the item then when I rejoin I get it again, is there a way I can update the item instead of giving me over and over?

mighty pier
onyx fjord
#

Why isn't it in English

#

Lol

quaint mantle
#

when I try to move any other item rather than my sword it gives the error

mighty pier
#

current item is item on the cursor

#

wait

#

no

drowsy helm
#

use pdc

mighty pier
#

or

quaint mantle
#

pdc?

mighty pier
#

spinnenballe

quaint mantle
#

?

mighty pier
#

@alpine herald

sonic goblet
#

?pdc

mighty pier
#

oh is that like the thing

#

wher

#

i forgot

onyx fjord
#

It stores data in item

#

And stuff like that

quaint mantle
#

ah

#

so I try to check the custom data will it not be null when I move other items?

#

I'm trying to cancel the move and drop event of my custom item but other items can move

#

oh okay

summer scroll
drowsy helm
#

looks good to me

#

probably better to use array though

#

not a huge deal

ivory sleet
humble tulip
#

^^

#

So you don't have to manually close the streams

glossy venture
#

why does my scoreboard flicker?
it looks like its only there for one tick
im using the bukkit api, i made a class to assist me
builder class: https://paste.md-5.net/wozilamago.java
code:

    private void updateScoreboardFor(Player player) {
        ScoreboardBuilder builder = ScoreboardBuilder.newBoard("kitpvp");
        builder.title(kitPvpScoreboardTitle).displayAt(DisplaySlot.SIDEBAR);

        final String prefixLine = ChatColor.GOLD + "" + ChatColor.BOLD + "| " + ChatColor.WHITE;
        if (scoreBoardTick % 12 * 5 == 0) /* current session */ {

            builder.addLines(ChatColor.GOLD + "" + ChatColor.BOLD + "» " + ChatColor.WHITE + "Session");
            builder.addLines(prefixLine + "Kills: " + ChatColor.RED + "69");
        } else /* total */ {

        }

        builder.update().show(player);
    }
#

i call this code every tick with a runTaskTimer

#

for each player

#

oh wait

#

i bet its switching to the empty liens

humble tulip
#

Why are you creating a new scoreboard every tick

rough drift
#

^

#

There's no need

glossy venture
#

ill optimize it later

#

i just want to get something working

#

its still flickering tho

opal juniper
#

probably cause u change it every tick

glossy venture
#

what is an entry

opal juniper
keen silo
#

Hey, is the "ProxyServer" Class the replacement for the "BungeeCord" Class?

glossy venture
#

oh nvm i can unregister the old one

cobalt marlin
#

Is there a way to make a dropped item despawn faster or increase its age? I want to make an item I spawn in the world despawn quickly without changing the global value

glossy venture
#

with nms you could edit the NBT tag

icy beacon
echo basalt
#

@sterile token opinions?

remote swallow
#

very A tbh

echo basalt
#

there's a lot more to it

orchid gazelle
#

Lmao

echo basalt
#

Button is the simplest menu element that just represents an item with an optional click handler

#

I have multiswitches that let you cycle between options and all

sterile token
#

Who is tagging me!

orchid gazelle
#

Nice job bro

echo basalt
#

me

sterile token
#

Oh ilusdionvjro

orchid gazelle
remote swallow
#

GunPoint hand it over

sterile token
#

Sorry i just seen the photo

echo basalt
#

I'm wondering how I'll animate it

sterile token
#

Discord is working for thetrush

echo basalt
#

but this is basically bootleg photoshop

#

on a very low resolution

sterile token
#

Oh ok

#

I prefer the oldsytem tho

echo basalt
#

this will be retrocompatible

#

I'll add some api methods that get the items from the pattern mask

#

the old system was way too simple and things like toggle switches are a pain to make

#

as it was made for static menus

orchid gazelle
#

Yo bois and girls

#

Any ideas how to force the server to send an update of a custom entity to the client?

echo basalt
#

send a metadata packet

#

containing ALL the data

orchid gazelle
#

Every tick..

#

then the updates would stack

echo basalt
#

why you want to do that

orchid gazelle
#

Because FallingBlocks do not get updated every tick

echo basalt
#

fallingblocks are a pain lmao

#

you just teleport them, their metadata doesn't change

orchid gazelle
#

And therefore the clients are doing weird precitions which lets the fallingblocks look like fucking skyrockets

echo basalt
#

you're tryna spawn a stationary one?

orchid gazelle
#

Oh I have done that already

echo basalt
#

client does predictions, you gotta send velocity packets each tick

orchid gazelle
#

Now that sucks

echo basalt
#

and maybe teleport it once in a while

orchid gazelle
#

I gotta get every player to send it to then too

#

Ouf

remote swallow
#

check radius

orchid gazelle
#

Yes

#

I know

echo basalt
#

just loop through all players in the world

#

then do distanceSquared checks

#

and all

orchid gazelle
#

Still kind of annoying isn't it

echo basalt
#

eh

#

if you're at that level, you're probably abstracting away half of it

orchid gazelle
#

Oh yes bro XD

#

Wait lemme show you something

#

U like my fallingblocks?

remote swallow
#

oh

#

god

orchid gazelle
#

(They also have a blueprint system attached and are getting saved and loaded via json)

glossy venture
#

hm i dont think having the scoreboard constantly updating on another thread really helped the flickering

#

server crshed

orchid gazelle
worn tundra
glossy venture
#

it was flickering

#

might have been client side

#

idk

orchid gazelle
#

Eh more like 40

glossy venture
#

60 fps scoreboard updating

#

its still fucking flickering

#

what the fuck

civic wind
#

You’ve got to allow for the molecules to combine and photo synthesise which then activates a chain reaction to the quantum nexus particles

#

That’s your problem right there

glossy venture
#

ah yes

#

of course

civic wind
#

You can thank me later

remote swallow
#

the easiest way to solve that problem is turn your monitor off

#

cant flicker is you cant see it

orchid gazelle
#

Ebic did you think anyone is dumb enough to spawn stationary MULTI-Fallingblocks?

glossy venture
#

tf is a multi fallingblock

orchid gazelle
#

Just what the name tells you

glossy venture
#

multiple?

orchid gazelle
glossy venture
#

oh

#

yeah so multiple

orchid gazelle
#

Yeah

#

Have not found anything online so I began writing that by myself =(

#

And I lost my mind multiple times, while reading through Server internals

vital yacht
echo basalt
#

that's not how it works

orchid gazelle
#

^

vital yacht
#

Why not?

echo basalt
#

just try and see

#

fallingblocks are special

#

and I just prefer to mount them on armorstands because fr they painful

orchid gazelle
#
  1. The Entity will despawn after 400 ticks
  2. The Entity despawns when hitting a ground instantly
  3. The client predicts movements so it will look like a skyrocket into the ground
echo basalt
#

I'd rather make them client-sided

#

and spam packets

glossy venture
#

ok now scoreboard only updates when marked needed

orchid gazelle
#

Yeah one thing, I gotta have collision and so on lol

echo basalt
#

than deal with the bukkit impl

glossy venture
#

flickering fixed

vital yacht
#

I was just looking at their code a couple days ago and I swear they have a check for it but maybe I’m not remembering correctly

echo basalt
#

because like

#

hell naw

#

just make a combined boundingbox

orchid gazelle
echo basalt
#

I know

#

I do funky nms shit sometimes

#

I've been messing with so many fake blocks lately

#

making a full client-sided prison system

orchid gazelle
#

Thats a lot of "fun"

remote swallow
#

i love when my brain decides its time to go smooth

orchid gazelle
remote swallow
#

normal people

#
ItemStack baseItem = null;
                for (String s : dataConfig.getConfigurationSection("auto-pickup.drop-swap").getKeys(false)) {
                    if (block.getType().toString().equals(s)) {
                        baseItem = new ItemBuilder(Material.valueOf(dataConfig.getString("auto-pickup.drop-swap." + s))).amount(1).build();
                    } else {
                        baseItem = new ItemBuilder(block.getType()).amount(1).build();
                    }
                }
``` can anyone see any reason for baseItem to be more than one