#help-development

1 messages · Page 2240 of 1

feral prairie
#

how do i call it

chrome beacon
#

plugin.getDataFolder()

#

plugin being an instance of your main class

#

To pass that around you can use di

#

?di

undone axleBOT
feral prairie
#

is there a way i can get around the fact that its nonstatic

chrome beacon
#

🙃

chrome beacon
#

Is NMS imported to your project

#

Also if you're on a modern version you can just use p.getPing()

feral prairie
humble tulip
#

Look at this @feral prairie

chrome beacon
humble tulip
#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

humble tulip
#

?nms

mortal hare
#

minecraft client supports more than 64 stack sizes

feral prairie
#

im blind or something

hasty prawn
#

I think the max stack size is 127

#

Put 128 and see if it goes to negative peepoGiggles

mortal hare
#

signed

humble tulip
#

So it does go neg?

hasty prawn
#

Yeah I think it turns red when it's negative

mortal hare
#

at least on 1.8 its goes negative

#

i dunno if its patched

feral prairie
#

if u get them in 1.8

mortal hare
#

dupes

feral prairie
#

they still exist in 1.12

#

idk about futher

#

1.13 changed everything

glossy venture
chrome beacon
#

It's patched as far as I know

glossy venture
chrome beacon
glossy venture
#

nah prob not

humble tulip
#

Inventory.setItem?

glossy venture
#

but in server memory

#

it is

#

so thats cool

feral prairie
#

so after getDataFolder() what do i put after to make the file with a name i choose?

echo basalt
#

that's because they didn't bother micro-optimizing the server

glossy venture
#

also tf is color

glossy venture
#

it says TAG_COLOR = "color" but tf does that do
for the name or smth?

feral prairie
#

im trying to create a config folder

humble tulip
#

File file = new File(datafolder, filename);

ivory sleet
#

Inventory::setItem

glossy venture
echo basalt
glossy venture
#

oh yeah ofc

#

forgot abt that

echo basalt
glossy venture
#

probably both

glossy venture
#

multiplayer pretty important

humble tulip
#

Bump

ivory sleet
#

I mean of course a non functional goal in any production is speed performance and space performance

#

But usually it’s only worth to optimize something to the extent that you’ve reached the non functional goal as a functional goal

glossy venture
#

yeah but especially in game servers i feel like its a pretty important goal

river oracle
# humble tulip Bump

its a good design choice other than it being an abstract class you lose nothing by implementing that as an interface

feral prairie
humble tulip
#

I dont know if my database class should be creating player objects or there shpuld be a separate class for that

river oracle
#

it makes it easier to support multiple types of databases that is a win any way you cut it

glossy venture
feral prairie
#

where is yes?

glossy venture
#

not everything should be an interface

crisp steeple
ivory sleet
#

I mean the most actual significant optimizations will come from java itself

glossy venture
#

like a cache

#

or smth

river oracle
ivory sleet
#

Like project loom, panama, valhalla etc

glossy venture
feral prairie
ivory sleet
glossy venture
#

if it doesnt need to be multiinherited id leave it as an abstract class but it doesnt really mmatter

chrome beacon
crimson scarab
#

how do you end a scheduler

chrome beacon
#

?scheduling

undone axleBOT
ivory sleet
#

BukkitTask::cancel or BukkitRunnable::cancel

desert tinsel
#

mainmenu.setItem() instead of Inventory.setItem()

humble tulip
#

Bruh

feral prairie
#

im so lost

humble tulip
#

Ofc you need to call that method on mainmenu

chrome beacon
# feral prairie im so lost

I have a feeling your knowledge of Java is lacking. You might want to consider taking a java course to learn the basics

humble tulip
#

?learnjava

undone axleBOT
chrome beacon
#

Nice timing on that one

humble tulip
#

That was for someone else too😂

desert tinsel
#

😹

feral prairie
alpine urchin
feral prairie
#

im trying to port my mod to spigoit

glossy venture
#

what

alpine urchin
#

Instead of Idot. Learn java

#

some people just say learn java first

#

which i guess is ideal

humble tulip
#

You set the meta after putting it in the inv

alpine urchin
#

but i didnt have motivation to learn java without spigot additionally

#

didnt have full positives

chrome beacon
#

You should learn it before starting with Fabric and mods too

alpine urchin
#

but many are like that

feral prairie
#

yes but i dont understand a thing about spigoit i know how to code with fabric

alpine urchin
#

i ended up only learning what i needed for basic plugins at first

humble tulip
#

fabric isn't a programming language

ivory sleet
#

Spigot is very near just Java classes when it comes to managing files

#

idk if fabric is that as well

#

but you'll eventually have to implement your file management system using File, Files and Path

chrome beacon
#

You should be passing around objects when using Fabric

sterile token
#

How do i create a wand?

#

Im a bit messsy how to save the positions

feral prairie
agile anvil
sterile token
chrome beacon
river oracle
#

java is java no matter where you use it

chrome beacon
#

It's the same programming language

ivory sleet
#

this should be enough

humble tulip
#

For pos 1 and pos2

desert tinsel
#

Item with index 6 is null, why?

sterile token
#

Im doing a wand (an axe) for claiming. So you select 2 corners and them via a cuboid a region its generated

river oracle
#

you could also use an array for storing pos1 and pos2

humble tulip
#

I have a class tyat does this

#

But I'm not at my computer rn

sterile token
#

i have a cuboid and claim object that why

#

So i cannot use a map

humble tulip
#

Huh?

#

Just store the cuboid then??

sterile token
#

And for creating the cuboid i need the 2 locations already

desert tinsel
#

Actually, you need to put ItemMeta item2_meta = item2.getItemMeta();

river oracle
agile anvil
ivory sleet
#

verano basically you wanna map a player to the pair of locations

humble tulip
ivory sleet
#

ye

sterile token
ivory sleet
#

and for that you need to store them in relation to said players

#

which ends up requiring a map like structure

#

or well if you dont want to manage the map yourself, use PDC or Metadata

acoustic pendant
#
        if (plugin.hidePlayersFile.getcFile().getBoolean(String.valueOf(player.getUniqueId()))) {
            player.getInventory().setItem(8, LobbyPlugin.getInstance().items.hide);
            for (Player pl : Bukkit.getOnlinePlayers()) {
                player.hidePlayer(pl);
                pl.hidePlayer(player);
            }
        } else if (!plugin.hidePlayersFile.getcFile().getBoolean(String.valueOf(player.getUniqueId()))){
            player.getInventory().setItem(8, LobbyPlugin.getInstance().items.Visible);
            for (Player pl : Bukkit.getOnlinePlayers()) {
                player.showPlayer(pl);
                pl.showPlayer(player);
            }
        }

Why is this not working and always giving me the second item?

agile anvil
#

Ok Verano:

    1. Do you need to save the two locations?
    1. Do you want to save them in memory or storage?
sterile token
#

My cuboid constructor is: Cuboid cuboid = new Cuboid(Location location1, Location location2)

ivory sleet
#

myes

#

now perhaps define a field in your player transfer class that caches a given cuboid

sterile token
#

And them i have a claim object which save the id, owner, cuboid, etc

#

let me send code

ivory sleet
sterile token
agile anvil
#

@sterile token ask your question pls 😂

acoustic pendant
ivory sleet
#

myes but if the value is false or well strictly speaking not true then its by definition false

crimson scarab
#
        BukkitTask taskID = Bukkit.getScheduler().runTaskTimer(plugin, new Runnable(){
            @Override
            public void run() {
                System.out.println("a");
                player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(counter[0] + "/" + String.valueOf(cooldown)));
                if (counter[0] == cooldown) {
                    taskID.cancel();
                }
                counter[0] += 1;
            }
        }, 0, 20);

this doesn't work what is going wrong

ivory sleet
#

hence why it probably fails your first if statement

ivory sleet
chrome beacon
acoustic pendant
ivory sleet
crimson scarab
chrome beacon
#

What's the problem

ivory sleet
#

oh yeah tapwatero

feral prairie
#

ok so would this create the file?

ivory sleet
#

you probably wanna go with Consumer<BukkitTask> instead

ivory sleet
chrome beacon
#

Also you probably want to place your files in your plugin directory

crimson scarab
ivory sleet
#

no

feral prairie
sterile token
humble tulip
#

int id

ivory sleet
#
Bukkit.getScheduler().runTask(plugin,task -> {
  task.cancel();
});

humble tulip
#

Not consumer

feral prairie
feral prairie
#

like this

sterile token
#

I dont understand what are you doing tho

feral prairie
#

im making a website

sterile token
#

Oh ok

#

Why you dont use SpringBoot?

chrome beacon
ivory sleet
humble tulip
#

Use try with resources

chrome beacon
#

^^

sterile token
brave sparrow
#

Imagine using SpringBoot in 2022

ivory sleet
#

server sided rendering Id assume?

sterile token
chrome beacon
ivory sleet
#

ktor :3 (frontend tho but still)

brave sparrow
#

It’s heavy is what it is

chrome beacon
sterile token
ivory sleet
brave sparrow
#

LMAO

humble tulip
ivory sleet
#

oo

sterile token
#

I wouldnt built websites on java, instead i would use NextJS (javascript fullstack framework)

ivory sleet
humble tulip
#

Nah wtf

ivory sleet
#

java has a html framework

#

iirc

#

but its pretty shitty

sterile token
#

Yeah i know

brave sparrow
#

Java is great for web

#

SpringBoot is just sucky

sterile token
#

HAHA

feral prairie
#

now how do i run the server, i only ask cause this is maven and i have only used gradle before

ivory sleet
brave sparrow
humble tulip
#

I can build a shitty website with js

brave sparrow
#

Java has great performance and with the right framework can be an exceptionally good choice

sterile token
#

Java is not the best for websites, websites league are between Python and Javascript

river oracle
#

the spigot server has nothing to do with neither maven nor gradle

ivory sleet
#

^even the future of Java looks unorthodoxly bright

brave sparrow
feral prairie
#

lol

brave sparrow
#

And Java and JavaScript are not mutually exclusive

ivory sleet
#

should have stayed w/gradle imo :3

brave sparrow
#

You can have a Java backend serving a JavaScript frontend

river oracle
#

it was gradle including it

feral prairie
#

o so i need to build the jar file?

river oracle
#

your plugin != The server

#

so you need to build the jar and run the server unless you configure something yourself

feral prairie
#

so which one

sterile token
agile anvil
river oracle
sterile token
river oracle
#

just use gradle

#

you confuse me

humble tulip
#

jar:jar

#

Obv

sterile token
#

Also that are the maven things for building

feral prairie
#

and idk how to change

sterile token
#

They should be package, compile, install, deploy

river oracle
#

👀 intellij legit gives you an option to use gradle with java

ivory sleet
#

^ take the opppurtunity

sterile token
#

When i reinstalled intellij it just download maven as default

#

🤔

chrome beacon
#

Wouldn't surprise me if they don't know Gradle either

river oracle
#

they kept talking about gradle so I figure they atleast must be semi-competent with it

#

I'm surprised you survived using fabric

feral prairie
#

so which setting do i use to change this

river oracle
#

Fabric is way harder than spigot

feral prairie
#

sorry

agile anvil
river oracle
# feral prairie uh no

you only say this because you weren't spoon fed a test environment and haven't the slightest clue on basic compilation and servers

#

you need build tools

#

run it

#

get the server jar run the server

subtle folio
#

maven > gradle

river oracle
#

its how fabric set up their environment

feral prairie
river oracle
#

how many times do I have to say that

feral prairie
#

ok

subtle folio
#

maven has package and clean

ivory sleet
#

yankees

subtle folio
#

all you’ll ever need

ivory sleet
#

you can use paperweight (gradle plugin)

feral prairie
#

but that means fabric is easy

ivory sleet
#

and everyhing becomes extremely easy

feral prairie
chrome beacon
#

Change what

crimson scarab
#

what does setlevel do?

feral prairie
#

nvm

ivory sleet
#

it sets the xp level probably

agile anvil
# feral prairie but that means fabric is easy

Well it's easy to consider smth we know as easy, as well that smth we don't know is hard. Spigot is quite simple to handle quickly, and has a pretty detailed wiki which explains how to make your first plugin. You should take a look at it before put the blame on the difficulty ;)

chrome beacon
#

Also knowing the programming language you're coding in helps

river oracle
#

knowing gradle or maven helps a lot too

river oracle
#

I'm confused why you opted for maven

feral prairie
agile anvil
river oracle
#

no clue how to on intellij I'm sure their's some easy way

feral prairie
brave sparrow
#

It looks like it’s doing what you wanted

#

What’s the issue

chrome beacon
#

You need to hook PlaceholderAPI if you want placeholders from it

brave sparrow
#

^

#

Maven and a plugin hook would be the best way

humble tulip
#

I have a maven project with 3 modules, core, spigot, bungee. Bungee and spigot depends on core. how do i build a combined jar?

brave sparrow
#

I imagine their page has documentation on how to reference it

humble tulip
#

i tried shading spigot and bungee into code but that leads to issues sine spigot and bungee depends on core

vale ember
#

you dont shade spigot and bungee into core, but shade all 3 into the root project ig

humble tulip
#

one sec

#

cant do that

#
    <groupId>me.saif</groupId>
    <artifactId>AltLookup</artifactId>
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>
#

packaging is pom

#

i cant make it jar

brave sparrow
humble tulip
#

so creating a module to have the output jar is the way to go?

#

i thought that was hacky

chrome beacon
#

Wait why are you shading Spigot and Bungee 👀

#

I hope you're using the wrong word there

humble tulip
chrome beacon
#

ah

#

nvm then

humble tulip
#

yeah

#

100mb jar file 😂

chrome beacon
#

I've seen a lot of people do that

subtle folio
#

shade spigot and paper 😎

smoky oak
#

what happens if i send a client chunks they've got no business rendering, then teleport them there after a moment?

#

do they retain those chunks?

chrome beacon
#

Try it and see I guess

undone axleBOT
humble tulip
#

best command^

#

second best is ?learnjava

subtle folio
#

third is ?paste

humble tulip
#

ye for sure

opal juniper
#

?main

chrome beacon
river oracle
#

true

opal juniper
#

yeah lolw

river oracle
#

I have that one in my quick copy patse though

smoky oak
#

thats not how youre supposed to use domains

opal juniper
#

yes it is

#

that is the best way

acoustic pendant
#
            for (Player pl : Bukkit.getOnlinePlayers()) {
                player.hidePlayer(pl);
                pl.hidePlayer(player);
            }``` 

how can i make so when a new player connects, it still hides?
#

i was thinking in offlineplayers but that doesn't work

smoky oak
#

do the same thing in onPlayerJoinEvent

brave sparrow
#

^

smoky oak
humble tulip
#

HELP

#

i just deleted my entire project with maven

#

AHHH

#

how to undo

#

i accidentally set the wrong build directory and it cleared everything

#

omg

feral prairie
#

so when is onEnable(); run?

humble tulip
#

FUCK IT DELETED ALL MY PROJECTS
WAT

feral prairie
#

safe delete i hope

humble tulip
#

@ivory sleet sry for the ping

#

i put one too many ../

acoustic pendant
smoky oak
#

you can supppress the messages

#

i dont know which of the join events you need to manipulate though

acoustic pendant
#
        for (Player pl : Bukkit.getOnlinePlayers()) {
            if (plugin.hidePlayersFile.getcFile().getBoolean(String.valueOf(player.getUniqueId()))) {
                player.hidePlayer(pl);
                pl.hidePlayer(player);
            } else if (!plugin.hidePlayersFile.getcFile().getBoolean(String.valueOf(player.getUniqueId()))) {
                player.showPlayer(pl);
                pl.showPlayer(player);
            }
            if (plugin.hidePlayersFile.getcFile().getBoolean(String.valueOf(pl.getUniqueId()))) {
                player.hidePlayer(pl);
                pl.hidePlayer(player);
            } else if (!plugin.hidePlayersFile.getcFile().getBoolean(String.valueOf(pl.getUniqueId()))) {
                player.showPlayer(pl);
                pl.showPlayer(player);
            }
        }

I tried this, but didn't work

smoky oak
#

theres like three

feral prairie
humble tulip
smoky oak
# feral prairie ?

It's ran after onLoad(), it's where you'll want to register your events and commands. you use onLoad() to check if you're reloading or if the server is starting up

feral prairie
#

ok

#

its starting up

#

but it didnt load the plugin

chrome beacon
#

You're probably missing the plugin.yml or smth

smoky oak
#

can u give us a screenshot of your project tree

feral prairie
smoky oak
#

its not that the files are missing then

#

what about the console, are there any errors there?

chrome beacon
#

?main

chrome beacon
#

;/

feral prairie
#

...

#

Jar does not contain plugin.yml

chrome beacon
#

How did you build the jar

smoky oak
#

im assuming you use maven if your tree looks like this

feral prairie
#

the highlighted one

chrome beacon
feral prairie
#

?

chrome beacon
#

Above

smoky oak
#

run button

chrome beacon
#

the one named package

chrome beacon
smoky oak
#

point

feral prairie
#

in lifecycle

#

right

chrome beacon
#

Yes

feral prairie
#

what are the folders for

chrome beacon
#

Storing things to be included in the jar

#

You can ignore them

feral prairie
#

ok

dusk flicker
#

Also please follow Java conventions

#

?conventions

undone axleBOT
smoky oak
#

What's ANSI

mortal hare
#

invisible contents in inventories

smoky oak
#

lemme guess you cancelled the drag event

feral prairie
mortal hare
#

no

chrome beacon
#

Nms

mortal hare
#

yes

chrome beacon
#

:)

#

I've done modded inventories before so I know how that works

feral prairie
#

still shows 0 plugins

smoky oak
#

can u screenshot your whole screen?

#

Event?

mortal hare
#

he meant static classes

feral prairie
mortal hare
#

of these events

ornate patio
#

what's a good "fail" sound

mortal hare
ornate patio
#

uh-

#

no like

#

for example a user searches for a player with a command

#

and the command couldn't find any player with the provided name

smoky oak
#

anvil breaking

humble tulip
#

😦

smoky oak
#

its obnoxious

#

nobody will fail

humble tulip
#

my files are curropted

mortal hare
#

thats a good idea

#

imma steal this sound idea

#

"borrow"

smoky oak
#

dont worry

#

i stole it too

#

:P

ornate patio
brave sparrow
#

@ornate patio I recommend item break

#

It’s more of a muted sound

ornate patio
#

yeah that sounds better actually

smoky oak
#

@feral prairie can you hit the run button - the green arrow to the right?

feral prairie
#

k

brave sparrow
#

They don’t share a superclass no

#

Store them as Object

#

Map<Object, Value>

brave sparrow
#

Or Map<Key, Object>

humble tulip
#

NONONONONO

smoky oak
#

whats your maven config? @feral prairie

humble tulip
#

i'm legit done

brave sparrow
#

You could, but that would be somewhat inefficient

feral prairie
brave sparrow
#

Why would you recreate the spigot API when you could use the one that’s already there

feral prairie
#

or build.xml

brave sparrow
#

The map won’t be any different under the hood, it treats everything as an object anyway

smoky oak
brave sparrow
#

What are you trying to do

smoky oak
undone axleBOT
smoky oak
#

actually thats a good point

#

what version do you want to compile for

feral prairie
#

1.19

smoky oak
#

remove the 1.13 part then and try compiling again

#

also

#

post your plugin.yml

#

and please use the paste website

brave sparrow
#

Then why are you throwing any argument exceptions

#

The map shouldn’t be accessible to the end developer

feral prairie
#

ok

brave sparrow
#

You shouldn’t make your exposed methods take Object

#

There should be a version of the method for each chat event, which is what spigot does

#

The underlying map doesn’t matter

smoky oak
#

THOSE two share event at the very least as superclass

brave sparrow
#

No

brave sparrow
#

They aren’t events as in things you can listen to, they’re the chat events

smoky oak
#

ah right

#

i thought you meant inventory events

brave sparrow
#

public void a(ClickEvent event) {}
public void a(HoverEvent event) {}

feral prairie
#

still didnt work

smoky oak
#

plugin yml please

feral prairie
coarse shadow
#

where can i check that what type should i write while using protocollib

#

in fields

brave sparrow
#

There is no superclass they both extend that isn’t too generic for your use case

#

Throwing a bunch of exceptions is not desired behavior

smoky oak
#

net.web.plugin is a package, not your main class. While not suggested to use main as name, if you do change that entry to net.web.plugin.main.
You should ABSOLUTELY fix the way you name your stuff though

#

i have no clue but apparantly its a naming convention

#

thats not the important part though

#

if you dont point your plugin yml to the class extending javaplugin it cant load

feral prairie
smoky oak
#

i said afterwards

#

for how you named your stuff

#

the right way to point is net.web.plugin.main

feral prairie
#

then whats worng with my current name

smoky oak
#

not wrong per se

feral prairie
#

so like this

smoky oak
#

yea

feral prairie
#

still doesnt work

#

...

smoky oak
#

any message in console?

#

you definitively fixed AN issue, apparantly it wasnt the only one

brave sparrow
#

That’s fine?

feral prairie
brave sparrow
#

You have can both methods with the same name that take a different parameter type

smoky oak
#

welp im stumped

#

cant help you much further here i fear

feral prairie
#

o wait

#

there is something

smoky oak
#

try replacing your weird version string with 1.19 tho

feral prairie
#

[Server thread/ERROR]: Could not load 'plugins\bukkit-sample-plugin-0.5.jar' in folder 'plugins': uses the space-character (0x20) in its name

smoky oak
#

maybe thats the issue

brave sparrow
#

@feral prairie @smoky oak @quaint mantle you don’t name your main class “Main” because of the Java naming convention, that dictates you should be specific as to what your program is in the main class. If every piece of code had their main class named “Main”, it would be extremely confusing as to what was what

#

Why not

smoky oak
feral prairie
smoky oak
#

it's because spaces in minecraft separate strings

#

in other words if you refer to your plugin you cant

#

because it thinks the words after the space dont belong to the name

eternal night
#

JDBC is not an ORM.

brave sparrow
#

And you believe the distinction to be what?

smoky oak
#

remove the space and recompile

eternal night
#

So yea, you get to "relate" your tables as much as you could with SQL

#

that is all that JDBC does for you

#

SELECT and JOIN

lime moat
#

sender.sendMessage(MiniMessage.miniMessage().deserialize("<rainbow>Hello world</rainbow>")); Is there an import to make MiniMessage work? I'm getting an error that it can't resolve the symbol... I'm very new to java, so if this is super dumb, I apologize 😅

eternal night
#

minimessage and components are paper-api land

#

if you want to use it on spigot you will have to use the spigot platform adventure offers

lime moat
#

I see, how would I use the paper api? (My server is indeed paper)

eternal night
#

you would switch the dependency. Tho you might be better off on the paper discord 🙂

feral prairie
#

so the plugin loaded but it did run and thing onEnable();

smoky oak
#

it be there on /plugins now`?

brave sparrow
#

You can store all the information about the message but you still have to make a new object whenever a message is “sent” to a player containing that information anyway

feral prairie
smoky oak
#

k

brave sparrow
#

It’s not memory inefficient, Java can churn through millions of objects without any difficulty

feral prairie
#

dont know if this will help ```[13:38:55 WARN]: Legacy plugin Website-Plugin v${1.0.0} does not specify an api-version.
[13:38:55 INFO]: [Website-Plugin] Loading Website-Plugin v${1.0.0}

brave sparrow
#

The issue arises when you leak memory, or retain attachments to objects you no longer need

smoky oak
#

OUCH

#

yea

#

replace that with 1.19

#

in your plugin yml

brave sparrow
#

It’s absolutely fine

#

And it happens whenever a message gets sent anyway

smoky oak
#

its not gamebreaking

#

but a good idea nonetheless

feral prairie
quaint mantle
#

Is there like a page that shows all the different imports and uses for Spigot?

brave sparrow
#

Java is designed to support the constant creation and destruction of objects

smoky oak
feral prairie
#

o

smoky oak
#

its the version identifier

brave sparrow
#

Even if you just stored each message as a static string there would still be a new object created to send them whenever you tell the api to send it to a player

feral prairie
#

1.19.0 ?

#

or just 1.19

smoky oak
#

no

#

just major version

#

1.19 is applicable for all 1.19 version (1.19 as well as 1.19.1 and 1.19.2 if they were to be made)

feral prairie
#

i thought it was plugin verison

smoky oak
#

thats the version number in your pom, that 0.5

brave sparrow
#

There’s object oriented languages and runtimes where you aren’t supposed to dynamically allocate objects and let them get destroyed often

#

For example, C# in unity

#

But Java isn’t designed to restrict you in that way

#

Heck, whenever you get an item stack from an inventory it’s a new object

#

You’re mutating your copy of the item, that’s why you have to set it back into the inventory when you’re done modifying it

smoky oak
#

careful with vectors though

#

those dont duplicate when you do math on them

#

I'd say ask in the intelliJ discord but since they've got that stupid 2FA requirement ill just say i have no idea

feral prairie
#

still didnt fix the main issue

smoky oak
#

and that would be?

smoky oak
#

what does the console say?

#

just [WebsitePlugin] loading or something or does it still give an error

feral prairie
#

it says it loaded

#

but after everything

#
java.lang.NullPointerException: Cannot invoke "java.io.InputStream.readAllBytes()" because "is" is null
    at net.web.plugin.http.website.inputStream.main(inputStream.java:17) ~[?:?]
    at net.web.plugin.main.onEnable(main.java:32) ~[?:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:479) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:520) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3539-Spigot-56be6a8-82f7574]
    at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:434) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3539-Spigot-56be6a8-82f7574]
    at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:582) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3539-Spigot-56be6a8-82f7574]
    at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:401) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3539-Spigot-56be6a8-82f7574]
    at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:255) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3539-Spigot-56be6a8-82f7574]
    at net.minecraft.server.MinecraftServer.v(MinecraftServer.java:966) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3539-Spigot-56be6a8-82f7574]
    at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:291) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3539-Spigot-56be6a8-82f7574]
    at java.lang.Thread.run(Thread.java:833) [?:?]
brave sparrow
#

Yeah you have an error in your code

#

It’s loading fine

#

Let’s see your onEnable

feral prairie
smoky oak
#

you forgot to assignt 'is'

agile anvil
#

Where do you declare inputStream and file ?

smoky oak
#

there's a 'caused by' message below that error

#

thats where the error comes from

feral prairie
#

the highlighted part?

agile anvil
#

Oh ...

#

Well the main method isn't called when the plugin is loaded

smoky oak
#

look at the error message again

#

see it says null pointer exception: is

agile anvil
#

The only part of the code called is the onEnable and onLoad that your overwrite

smoky oak
#

in other words your InputStream isnt properly registered for some reason

agile anvil
#

So you have to declare your variables there

feral prairie
#

strange

brave sparrow
#

There isn’t one

smoky oak
#

its probably because you're not using JavaPlugin#getResource but InputStream.class.GetResource

feral prairie
brave sparrow
#

Save what

smoky oak
# feral prairie yes?

that is the line with the issue. That method throws an error because the inputStream isnt assigned

#

you need to assign it properly

#

the way you do it it gets set to null which causes an error

agile anvil
# feral prairie yes?

Ohhhh sorry I thought inputStream was a variable but it's a class (Always put an UpperCase in front of a class name)

feral prairie
#

o opps

agile anvil
#

Here it's the way you get the inputstream that didn't work (maybe the file isn't found..)

feral prairie
#

but its supposed to make the file

agile anvil
feral prairie
#

o

#

i understand

#

so it would read the file

#

from resources?

#

right

#

i forgot to copy the resources

agile anvil
#

Well how you're doing it is : it will check if there is a folder html and a file main.html WITHIN THE JAR (not a directory outside the .jar). And if there is one, it will read it as a Stream

#

So check in your jar if there is that html file (you can open it as an archive)

feral prairie
#

ye

#

thats how i want that file to be

brave sparrow
#

But are you actually packaging it into the jar?

agile anvil
#

So in your IDE, under the resources folder, create a html folder and put your file in it

brave sparrow
#

Have you checked?

feral prairie
#

it works now

agile anvil
#

Perfect

grim ice
#

so uh

#

hi

umbral socket
#

is this structure good?

#

java is the src folder meaning that maven is going to use that to compile the plugin right?

buoyant viper
#

it was going good until there were about 15 classes in just .skywars

umbral socket
#

alright, all these errors appeared as soon as I set java as a src folder

mortal hare
#

imagine minecraft server modding without wiki.vg

#

what a gold mine these days

buoyant viper
#

imagine minecraft

umbral socket
#

I'm just figuring things out

umbral socket
# buoyant viper yes

alright, all these errors appeared as soon as I set java as a src folder. Why is that?

buoyant viper
#

whats the error

#

if ur using maven (or gradle even), all ur java source code goes into src/main/java

glass mauve
umbral socket
buoyant viper
agile anvil
#

Serialize it's location (world_name, block_x, block_y, block_z)

mortal hare
#

I love Adventure API

#

it makes debugging easier

#

just plop Component.text

#

and any typed value

#

and bam

#

its instantly serialized to string

#

without specifying to do so

#

and it works with primitives too

umbral socket
agile anvil
#

Bukkit#getWorld to get a world by it's name. Then World#getBlockAt if my memory is good

umbral socket
#

errors that I had before I supplied my pom with dependencies. Maybe I have to do something similar again? @buoyant viper

mortal hare
#

wtf

#

why does Player interface

#

have getPlayer() method

oak vapor
chrome beacon
fallen agate
#

How would I remove or change the UUID sent on a chat event?

chrome beacon
dense frost
fallen agate
#

Or I could just make my own chat formatting plugin lol

dense frost
chrome beacon
#

Why are you trying to change the UUID? To prevent those chat reports?

fallen agate
#

Yep, chat reports

dense frost
#

Event#getFormat(); not sure.

river oracle
#

how would anyone know how to remove it if its not even in the API yet

fallen agate
kind hatch
#

Not always

river oracle
#

no they haven't always been signed

fallen agate
#

Like forever

chrome beacon
#

Right now all messages are sent as system messages. So you can't report them. Until this is fixed it's fine

fallen agate
#

Alright

#

Thanks

river oracle
#

My first pub plugin gonna be disabling that lmao I just want a plugin to get downloads ahaha

chrome beacon
#

If you want to be extra safe use Protocollib and change the UUID in the packet

subtle folio
#

whats the weird "unsycronized chat error" ?

fallen agate
#

There's gonna be plenty of plugins that do that

subtle folio
#

alrady is a mod for it

#

for clients and servers

#

works rlly well

river oracle
#

only cuz fabric is so damn crazy fast at updating

fallen agate
#

I thought it only supported fabric servers

river oracle
#

fabric is literal crack at updating

subtle folio
#

eactly

#

fabric ontop

fallen agate
#

fabric is cool

river oracle
#

They have the most goated modded API

fallen agate
#

I've never made a fabric mod but I've heard it's easy

river oracle
#

Its so easy compared to forge

#

they give you a really nice test environment too

fallen agate
#

In Liveoverflow videos, I think he used fabric

river oracle
#

I personally didn't stick with modding because I prefer making plugins

chrome beacon
fallen agate
#

dude liveoverflows series is amazing

river oracle
fallen agate
#

forge gives a good testing environment too ig

river oracle
#

I've tried both but it was a while ago I just remember forge being annoying and also I heard it was annoying to update

chrome beacon
#

They have update tools

#

Your information is outdated

river oracle
#

if the update tools are so good honestly I'd like to know why it takes so long for lots of mods to update if its a CLI app

chrome beacon
#

Because updating from versions older than 1.13 requires a full rewrite

river oracle
#

no wonder it takes so long for all the good mods to update lol

#

too bad a lot of creators abandoned their projects too

fallen agate
#

Personally I just play with a few fabric mods and prefer to write server side plugins

#

Plugins are universal

river oracle
#

I think fabric might outpace forge eventually 🤷‍♂️ but it might take a super long time

fallen agate
#

And have been around for longer than server side mods

mortal hare
#

when did this got added in intellij

#

neat feature

#

no more right clicking into context menus

#

i guess

ivory sleet
#

I disabled it as it mainly came in the way imo

#

But ye might be useful in case you don’t wanna use keybinds for whatever reason

oak vapor
chrome beacon
#

Dev builds

mortal hare
#

whats easier for server to process? sending a window items packet with full inventory itemstacks (like cancel event), or iterating through inventory view and sending set slot packet

#

does it make any difference

#

in terms of performance

#

is it harder to send bigger packets than to iterate and send a smaller one

sterile token
#

What means this error: "only whitespace content allowed before start tag and not \u0 (position: START_DOCUMENT seen \u0... @1:1) " it happens when im doing mvn install

chrome beacon
brave sparrow
#

Yeah ^ if you’re always sending the entire inventory it’s roughly the same traffic either way

#

Might be a tiny bit faster to pack it all together into one, but it’s not likely to be a significant difference

chrome beacon
buoyant viper
# mortal hare

getPlayer().getPlayer().getPlayer().getPlayer().getPlayer().get<dies>

outer wadi
#

when adding a default config how can i create default sections

#

like

#
config:
  hello: "world"
#

for example

chrome beacon
#

If you're using the built in system you can just add that to the config in your jar

outer wadi
#

sorry?

modest garnet
#

How do you give a player HASTE effect

glass mauve
#

like every other effect ig

glass mauve
#

but there is no HASTE Effect

#

its called FAST_DIGGING or smth

modest garnet
#

exactly

#

oh ok ty

chrome beacon
glass mauve
#

FAST_DIGGING should be HASTE but im not sure

pallid forge
#

So, I keep getting a message saying my Inventory is null, and I can't figure out why.

Command Executor:
https://paste.md-5.net/axipugomec.java#

Inventory Class:
https://paste.md-5.net/xoqifotiri.java

Main:
enchantmentclick.createInventory();
(I have this running)

Most of it you can ignore, but I have a feeling it has to do with an error in my creation of the Inventory, (or that i have multiple instances of the same inventory accidentally) If you see the error, please let me know! im knew to this

eternal night
#

you are never setting invCTF

#

beyond that, your listener is eh

#

well

#

those methods should not be static

#

you are missing the @EventHandler annotation as well

pallid forge
pallid forge
eternal night
#

Welll ```java
Inventory invCTF = Bukkit.createInventory(null, 9,"invCTF");

#

it creates a method scoped variable with the same name

pallid forge
#

ooooh ok, so how would i set it?

eternal night
#

just invCTF = bla bla bla

pallid forge
#

oh, well thats simple enough lol

eternal night
#

generally speaking, the further you progress when learning java the less static state you want like this

pallid forge
#

that makes sense

quaint mantle
#

So I'm trying to place a block that's in my off hand through throwing a snowball, but the off-hand item is an ItemStack. This is a problem because in order for me to place a block using location.getBlock().setType(), the "()" inside setType() need to be a Material. How would I do this?

hasty prawn
quaint mantle
hasty prawn
#

Yes

quaint mantle
#

I tried that but it never seems to be a block even when it clearly is

hasty prawn
#

What material is it

quaint mantle
#

Stone

hasty prawn
#

Send what you're doing

quaint mantle
#

nvm i just did getType().isBlock() == true

#

thx

#

== true

#

lmao

#

i dont wanna hear it rn 😭

#

if true == true

shy shadow
#

Hey guys !
I was wondering if it was somehow possible to change the range of certain sounds ? 🤔

echo basalt
#

lower the volume or something

#

you can also just not play it for people outside of the range

#

but that messes with packets a bit

tender shard
#

does this class name make any sense? "EvenlyQuestionDistributor" -> https://paste.md-5.net/akokajagut.java
It's used to stop my quiz bot from asking the same question again unless all other questions have been asked too. But "Evenly" doesn't make sense since it's an adverb and there's no verb in the class name, right?

shy shadow
brave sparrow
shy shadow
#

Yea that's what I thought I could do, but then players wouldn't be able to track where it's from I guess

buoyant viper
sterile token
#

this.buttons.entrySet().stream().sorted(Comparator.comparingInt(Map.Entry::getKey)).map(Map.Entry::getValue).map(MenuButton::getItem).forEach(this.inventory::setItem).reduce(this.inventory, (a, b) -> a);

Randoms things that copilot suggest me

tender shard
brave sparrow
echo basalt
#

Let's say that the goat horn is generally to the left of the player, you can play the sound ~ 5 blocks left of the player, for example

#

something like difference = playerLoc.subtract(sourceLoc).normalize().multiply(5)

shy shadow
#

Oh yea true !

#

Thanks a lot guys ! Noice idea didn't think about that

lethal roost
#

how do i convert a material to a string?

#

nvrm

#

how do i like

#

"extract"

#

the id from a material

#

like i have this: Material.DIAMOND

#

return after doing something like mainhandItem.getType()

humble tulip
#

Spigot no longer uses ids

#

Use toString

quaint mantle
#

no

#

use #name

lethal roost
#

mainhandItem.getType().name()?

#

and if mainhandItem.getType() == Material.DIAMOND, will this ^ spit out DIAMOND?

#

wait i just realized a better solution to my problem, nvrm

#

thanks for the help anyways lol

lethal roost
#

aight back with another question

so if i enter valid material IDs in my config file like so:

  - DIAMOND
  - DIAMOND_SWORD
  - EMERALD```
and hit the reload command for my plugin, everything works fine

but if i mess up the id of one of these elements (say, instead of `DIAMOND` i type `DIMOND`) and reload my config, the plugin still happily tells you "Config reloaded successfully" and there aren't any errors in the chat, until the code actually has to use the material IDs which then outputs the error to the console

how do i make it so that the plugin straight up tells you the error you made in the config when you reload and send an error message like "An error occurred in the config"?
humble tulip
#

If you get an illegalargumentexception, that string is not a valid item

iron glade
#

What's the easiest way to convert a list to a String... ?

ivory sleet
#

how do u wanna convert it

compact haven
#

the easiest way? 🤔

ivory sleet
#

but well, String::join is always viable

compact haven
#

^ that's the easiest

#

unless you want some special functionality, then just use a StringBuilder and loop it

iron glade
#

sounds good, thanks guys

tender shard
tender shard
ornate patio
#

what would be the best way go about modifying the essentials /warp command

#

i want to make sure that if a player warps while riding a horse, the horse gets teleported with them

echo basalt
#

forking essentials is the proper way

#

you can also just do some funky command map injection

ornate patio
tender shard
#

you could listen to the PlayerCommandPreprocessEvent or whats it called. Then add the player's uuid to a set. and remove the entry on thje next tick. Listen to PlayerTeleportEvent and if the player is in a set, check if they are passenger of a horse, and if yes, teleport the horse too

compact haven
#

honestly this annoys me

tender shard
#

oh there's a typo anyway

ornate patio
compact haven
#

well I mean in the spigot API, not the quiz itself xd

tender shard
ornate patio
#

well yeah

tender shard
#

it probably has some good reason

ornate patio
#

but like what if the other plugin did it in a weird way

#

or does something completely different

#

i guess its fine doesnt matter

compact haven
#

there's a reason, but it's just anti-OO

#

and the only contract for that method existing is presented at runtime

#

which is not the time it should tell me, my IDE should tell me (but it can't because it's not a proper contract)

tender shard
#

i also wonder why ConfigurationSerializable allows three different ways to specify a deserialize method lol

#

you can either do static deserialize(...), static valueOf(...), or a constructor lol

#

why not just one

echo basalt
#

legacy reasons maybe?

tender shard
#

idk

daring egret
#

can someone tell me what is wrong with this code

echo basalt
#

ehh

#

not doing uppercase when giving the material

daring egret
#

really?

echo basalt
#

and also that nesting

#

but ehh that's irrelevant

#

it's probably a /give

daring egret
#

it is

#

but material auto corrects to having a uppercase M

#

this is the full thing

echo basalt
#

yeah nesting ew

daring egret
#

bro i'm new to plugin development

#

leave me alone

#

if it works it works

compact haven
#

someone has a blog post on this

#

@tender shard was it you

#

@daring egret would recommend reading that post for a better code style

#

much more readable and maintainable

daring egret
#

alright thank you

#

i'll try to apply that

compact haven
#

also you don't need to verify the command name in the class

#

if you set an executor, then the command is already guaranteed to be /give

river oracle
#

I'm curious what youtube tutorial people pick that up from

daring egret
#

i originally did that but this guy told me too

compact haven
#

that guy is not smart

daring egret
#

lmao

#

ik

river oracle
daring egret
#

hm

#

he told me on the lines of

#

"if you need to add more commands to 1 class" or something

#

like a gamemode command

#

gmc gms gma

#

that was his reasoning

compact haven
#

In that case then yes, you need it

daring egret
#

so why'd he tell me to do it here lol

compact haven
#

no clue, but you only have 1 command there

#

so not necessary

daring egret
#

yeah i got rid of it

#

you right

#

do u have a solution for the give command not working tho?

compact haven
#

also, use Material.matchMaterial(args[0]) instead of valueOf

daring egret
#

ohh okay

compact haven
#

after doing that, recompile & test

#

then lmk if there are any errors in console

daring egret
#

it works fine now

#

ty

#

you're a legend

compact haven
#

perfect

#

don't forget about that blog post just because the problem is fixed now!!

daring egret
#

yeah ik

compact haven
#

good aha

daring egret
#

i'm gonna rewrite it with the better indentations now

#

cause if this is how bad it looks for a simple give command o-o

compact haven
#

😄 best of luck man

lime moat
#

Hey, could someone help me setup my git in Intellij?

#

I'm honestly lost and can't really figure out how to push/pull/commit

compact haven
#

that is scary

ornate patio
#

does exiting a vehicle count as a teleport?

compact haven
#

the way out of the forest is upon you Froosty

#

just follow the map

lime moat
#

Welp

#

I definitely understand it

daring egret
#

lol

ornate patio
#

Trying to make the horse teleport with the player when the player warps

#

I've already verified that onWarpCommand and onWarp are called correctly

#

yet nothing happens at all when i try it

#

ok I've almost got it now

#

I'm just having weird client-server desync issues if I force the player on the horse too fast after a teleport

#

so my solution is to spam-teleport them onto the horse 20 times with a tick delay between each attempt

tender shard
ornate patio
#

only issue is

#

how do i cancel a task from within the callback

#
int attempts = 0;
Bukkit.getScheduler().runTaskTimer(SuperiorSteed.getInstance(), () -> {
    horse.addPassenger(player);
    attempts++;
    if (attempts >= 20) {
        // cancel?
    }
}, 0, 1);
#

well actually, incrementing the attempts doesnt even work

#

how would I even do this

tender shard
# daring egret leave me alone

you ask what's wrong with the code, then people tell you and then you tell them to leave you alone? So why did you ask?

compact haven
#

well for the incrementing part, you need an AtomicInt object

#

primitives & lambdas don't work well together

#

as for cancelling it within the task

tender shard
ivory sleet
#

ye or use a monotonic array

compact haven
#

I've never really figured that out, I've done so much bullshit to try and fix that

tender shard
#
int attempts = 0;
Bukkit.getScheduler().runTaskTimer(SuperiorSteed.getInstance(), (task) -> {
    horse.addPassenger(player);
    attempts++;
    if (attempts >= 20) {
        task.cancel();
    }
}, 0, 1);
ivory sleet
#

since atomic int does use volatile memory effects by default

tender shard
#

ignore the copy pasted "int" part

#

I only wanted to show that you can use a consumer instead of a runnable so that you cancel the task

ornate patio
#
AtomicInteger attempts = new AtomicInteger(0);
Bukkit.getScheduler().runTaskTimer(SuperiorSteed.getInstance(), task -> {
    horse.addPassenger(player);
    if (attempts.incrementAndGet() > 20) {
        task.cancel();
    }
}, 0, 1);

this is what i got now

ivory sleet
#

no

compact haven
#

wdym no

ornate patio
#

whats no

ivory sleet
#

just use an int array like int[] = {0}

compact haven
#

no

ivory sleet
#

?

compact haven
#

literally Atomic* class is meant for things like this, when you need a wrapper

ivory sleet
#

no its not

compact haven
#

using an array for nothing is just silly

ornate patio
#

i don’t even know what atomicint is lmao

ivory sleet
#

AtomicInteger is made for when you need to manage an int variable across multiple threads

ornate patio
compact haven
#

yes, concurrency

#

it works fine for this as well

ivory sleet
#

yes but an int[] is more performant

tender shard
#

i'd just use an anonymous class

compact haven
#

more performant

#

by like 4 bytes of class header

ornate patio
ivory sleet
#

since volatile memory effects will force to flush registries

#

and it disables jit and compiler from doing certain optimizations by specs

ornate patio
#

It does feel kinda goofy to use an int array tho

tender shard
#

I'd do this lol

        Bukkit.getScheduler().runTaskTimer(SuperiorSteed.getInstance(), new Runnable() {
            int attempts = 0;
            @Override
            public void run() {
                if(attempts++ > 20) {
                    cancel();
                }
            }
        }, 0, 1);
#

no wait

compact haven
#

I-

tender shard
#

1 sec lol

compact haven
#

does that even work

quaint mantle
#

yes

humble tulip
#

alex do u have a blog post for setting up a multimodule project?

compact haven
#

I mean I get the idea

#

why have I not seen that before lmao

tender shard
#
        new BukkitRunnable() {
            int attempts = 0;
            @Override
            public void run() {
                if(attempts++ > 20) {
                    cancel();
                }
            }
        }.runTaskTimer(plugin, 0,1);

This is what I'd do

humble tulip
#

with maven*

ornate patio
compact haven
#

whatever~ that, atomicinteger, or 1-element int[] works

humble tulip
#

does the first one work? since it's inside a runnable and not bukkitrunnable

tender shard
compact haven
#

just use whatever you think is more readable

humble tulip
#

i accidentally deleted my entire projects folder with maven today 😄

#

now the recovered files are curropted

tender shard
ivory sleet
#

yeah, I mean in worst case just go with a raw BukkitRunnable

humble tulip
#

what does this even mean?

#

there's not a bit of info

tender shard
#

check the full error

humble tulip
#

"multiple points"

#

how?

tender shard
#

by clicking the uppermost thing on the left side

#

you have the lowest one selected

#

selected the highest one

compact haven
#

do you have unit/integration tests