#help-development

1 messages · Page 728 of 1

young knoll
#

I do not

kind hatch
#

It feels wrong to do so

echo basalt
#

the internet doesn't really synchronize and most of it just fails to work

#

like fr who the fuck is your target audience

young knoll
#

Thankfully your computer pulls time from the internet

echo basalt
#

don't write filler plugins just for the sake of publishing shit

#

average vk2pgz moment

kind hatch
young knoll
#

But what if those are wrong!

echo basalt
#

ok himothy him

kind hatch
#

What'd you give? List of contributions now.

vagrant stratus
#

You haven't really given much, tbh

echo basalt
#

goddamn I must've designed humanity if you did that much with just 6x 5 minute plugins

young knoll
echo basalt
#

what are my countless guides into advanced topics, such as multithreading, completablefutures or static abuse compared to "Pi", which displays a hardcoded message when you run a command

#

Just have high standards for yourself for a moment

kind hatch
#

You got a multithreading topic?

echo basalt
#

it's a bit shitty

#

but explains some of the problems

#

in a non-programmer analogy

vagrant stratus
#

Honestly pi just feels like something someone would add just to meet the premium plugin requirements

echo basalt
#

and what solutions we use in the real world (synchronization, queues)

vagrant stratus
#

Not really that useful

#

Oh, server

#

still not useful

echo basalt
#

just look for this and give it a read

kind hatch
vagrant stratus
#

No one seriously goes I want to run Spigot on my phone

echo basalt
vagrant stratus
#

eh

echo basalt
#

no clue how you want yours to work

#

The usual approach is just to make an interface and your own 19 impls

kind hatch
#

Yea, but then I end up with a bunch of empty methods that don't do anything in certain impls

vagrant stratus
#

You just make a fake player sleep, of which there are multiple threads I'm sure of

echo basalt
#

something stupid like

public interface MyDataStorage {

  CompletableFuture<Boolean> tryEnable(ConfigurationSection properties);

  CompletableFuture<MyData> fetchData(UUID playerId);
  CompletableFuture<Void> storeData(UUID playerId, MyData data);
  CompletableFuture<Void> deleteData(UUID playerId);

  CompletableFuture<Void> flush(); // Can be replaced with an executor. Join this onDisable 

  String getName();
}
young knoll
#

Just make hibernate do it

#

kek

echo basalt
#

And some other stupid stuff for remote databases n stuff

#

And then you have a registry where you toss all of them in and handle fallbacks n stuff

vagrant stratus
echo basalt
#
public class MyStorageRegistry {

  private final Map<String, MyDataStorage> storages = new ConcurrentHashMap<>();
  private String chosenStorageName;

  public void register(MyDataStorage storage) {
    storages.put(storage.getName(), storage);
  }

  public MyDataStorage get(String name) {
    return storages.get(name); // You should probably validate that `name` isn't null
  }

  public CompletableFuture<Boolean> tryEnable(FileConfiguration config) {
    chosenStorageName = config.getString("preferred");

    ...
  }
}
#

I have a fallback system for example

#

In case mysql fails to load it automatically falls back to sqlite

#

y'know it's really up to you

vagrant stratus
echo basalt
#

not 1000% how I'd do it nowadays but still an interesting topic

kind hatch
echo basalt
#

lately on my skyblock thing I'm like

#

somewhat giving up on this exact structure

young knoll
#

You can make life less painful by just supporting like

echo basalt
#

because it's too tied down to a single data storage type

young knoll
#

a few common databases

echo basalt
#

nightmare

vagrant stratus
young knoll
#

Alright I think the lad has been roasted enough

echo basalt
#

let's start rapping on him

kind hatch
#

Time to make a diss track

echo basalt
#

wait I thought this was #general

young knoll
#

#general is a vibe, not a place

echo basalt
#

this is also a vibe

young knoll
#

This currently has the #general vibe

vagrant stratus
kind hatch
#

Need a spigot-zone channel.

young knoll
#

Hey there is a domain for that

kind hatch
young knoll
#

Use a set instead of a list

vagrant stratus
#

Yea, I plan on it. Just not entirely sure on how I want to impl it though design wise

young knoll
#

kek

vagrant stratus
#

Something like one of these two would be cool. I'm just not sure how the backend is handled.

young knoll
#

Left looks nicer

vagrant stratus
#

would also require a separate page per item though 🤔

young knoll
#

Not that hard if they all follow the same format

vagrant stratus
#

I'd still have to decide on other things, like if the page creation is handled client side or server side

kind hatch
#

What you'll be showing on the page will depend on what you are storing.

echo basalt
#

make all pages by hand

young knoll
#

^ yeah

vagrant stratus
#

Might be genned client side by just looping through the api results. I'll have to check later

#

okay nvm, I suck at the game I was playing

#

I'll check now lmfao

young knoll
#

Lol

#

It’s pretty easy to generate a page with the api results

#

Also saves storing a bunch of pages

vagrant stratus
#

note: I know exactly 0 front end stuff

#

Not difficult for me to do backend, front end though is 😬

kind hatch
#

You really just need one page design for how you want to display a result. Then just load the data when the user goes to the specific malware page.

vagrant stratus
#

Yea, but I'd still need to know the HTML, CSS, and JS to actually make the page

#

of which I do not know

#

Making it look nice is its own thing

#

something else I don't know how to do

young knoll
#

The HTML and JS part is easy

#

CSS… idk black magic or something

kind hatch
#

Ur just bad. CSS is hella easy

young knoll
#

Yes writing CSS is easy

#

Writing CSS that looks good is black magic

kind hatch
#

Watchu talkin about?

vagrant stratus
#

I'm just not good at making things look nice 🤷‍♂️

young knoll
#

Hey I can make it look like an early internet website no problem

#

Nice and simple and clean

#

But nah modern websites need all the fancy schmancy stuff

vagrant stratus
#

I can't even do early internet lmao

kind hatch
#

The websites that rely too much on JS are the problem. CSS is very fast and people just aren't taking advantage of newer features.

vagrant stratus
#

Hell, I'm having issues just recreating things that already exist, let alone doing something myself

young knoll
#

You get a basic nav bar

#

You get a simple page with some tables and maybe an image

#

Take it or leave it

kind hatch
#

1v1 figma rn

young knoll
#

Slap a nice 1px black border on everything

#

Yeah

vagrant stratus
#

eh.

young knoll
#

I’m a Frontend

vagrant stratus
#

I'd want it to look nice, not shit

young knoll
#

Yeah well

#

Idk just grab a css framework :p

vagrant stratus
#

That doesn't mean I'd be able to make something nice out of it

kind hatch
#

Frameworks are also kinda restrictive

young knoll
#

Maybe some JS frameworks too

#

They’ll do all the work for you

vagrant stratus
#

I can use bootstrap all I want, I can't make shit w/ it because I can't come up with an actual design

young knoll
#

Wikipedia

vagrant stratus
#

No

young knoll
#

Bam perfect design

kind hatch
#

no no, you can't make shit with bootstrap because it sucks massive donkey dick

vagrant stratus
#

My dude, I can't even make something w/ figma

#

I'm not good at designing stuff

vagrant stratus
young knoll
#

Yeah well

#

Idk what figma even is

kind hatch
#

Figma balls

#

There.. I said it

young knoll
#

Fuck I was gonna say that

kind hatch
#

It's just electron based design software

young knoll
#

Can it magically generate CSS for me

kind hatch
#

Not really. That's what some of the 3rd party plugins are for.

young knoll
#

I see

kind hatch
#

The autogenerated stuff is kinda bad. Even with their recent update

young knoll
#

Meh

#

Designing the Frontend of websites has just never been my thing

kind hatch
#

Why do you think I handled the BTGUI? lol

young knoll
#

“Does this line of CSS make it look nice?… nope”
“How about this one?… ope now the entire website is fucked”

young knoll
kind hatch
# young knoll Heh

I mean, you saw the process. The first one I made was kinda bad, so I remade it and it is what it is now.

#

It's just a process thing

#

Can only get good at it with practice

quaint mantle
#

i tried recreating the issue in a new project but couldn't, i modified the original code to be this:

for (Path path : paths) {
    if (Files.isDirectory(path)) {
        ItemStack item = new ItemStack(Material.YELLOW_WOOL);
        if (data.getDeleteMode()) item = new ItemStack(Material.RED_WOOL);
        folders.add(itemProperties(item, ChatColor.YELLOW + path.getFileName().toString(), List.of("Folder"), "folder"));
    }
    else {
        System.out.println(path.getFileName().toString());
        String a = "§f" + path.getFileName().toString();
        System.out.println(a);
        ItemStack item = new ItemStack(Material.WHITE_WOOL);
        //if (data.getDeleteMode()) item = new ItemStack(Material.ORANGE_WOOL);
        System.out.println(item.getItemMeta().getDisplayName());
        //item = itemProperties(item, a, List.of("File"), "file");
        ItemMeta meta = item.getItemMeta();
        meta.setDisplayName(a);
        item.setItemMeta(meta);
        System.out.println(item.getItemMeta().getDisplayName());
        files.add(item);
        System.out.println(files.get(files.size()-1).getItemMeta().getDisplayName());
    }
}```

and it now outputs this result, i am totally lost.
#

(i can't send images)

kind hatch
#

@vagrant stratus Do you have any idea what you want it to look like? Or better yet, what does the command line stuff look like?

#

?img

undone axleBOT
#

Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.

Here's some screenshot utilities that can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org

quaint mantle
#

i just sent it in a different channel and sent the link to the image

#

but i am so lost with this

#

the varable changes when i don't change it

vagrant stratus
kind hatch
#

I must be lost then. What are you making then? I thought we were talking about stuff for the anti malware project?

vagrant stratus
#

Yea, client-side. So an actual website

kind hatch
vagrant stratus
#

well, outside of the .jar stuff anyways

#

none of which are CLI based

kind hatch
#

Right, but don't your current tools only work via the command line?

#

or loaded through the server?

vagrant stratus
#

The new stuff is gonna be the paper fork & plugins. None of which will use CLI, but be config based

#

There will be the current Anti-Malware, but that'll be EOL'd once the new stuff releases

echo basalt
#

optic btw

#

I made a report

#

i'd like to delete my resource

#

it's useless

vagrant stratus
river oracle
#

anyone know why my GUI would be centering elements even though they should be anchored to the NORTHWEST according to my code.

c.gridx = 0;
c.gridy = 0;
c.anchor = GridBagConstraints.NORTHWEST;
add(recipeLabel, c);

c.gridy = 1;
c.weighty = 1;
c.fill = GridBagConstraints.VERTICAL;
add(displayContainer, c);
young knoll
#

Oh god it’s swing

#

I’m out

kind hatch
#

The PTSD is coming back

river oracle
#

it makes it to annoying

kind hatch
#

Are there not any libraries that have been made for JFX?

river oracle
#

🤷‍♂️ I could try javafx but It makes a muck of my pom and I don't like it really

#

all rodes lead back to me having to figure out how tf javafx works lol

kind hatch
river oracle
#

no I haven't thats probably it

kind hatch
#

Also, I think by default, if nothing is changed, elements will be placed in the center of the screen.

remote swallow
#

Use that netbeans gui thing

river oracle
#

I could just use intellijs

kind hatch
#

IJ's kinda sucks

#

Not near as easy as the netbeans one. At least when it comes to sizing.

#

I was contemplating buying the JFormDesigner plugin, but I never did. It's supposed to be easier apparently.

remote swallow
#

I havent

young knoll
#

I tried a free eclipse plugin for it

#

It… tried

lethal python
#

coll can i dm you for help with something, i don't want to paste my code here because everyone will laugh at me

echo basalt
#

lmfao

#

we'll laugh at you for admitting shame

shadow gazelle
#

lol

#

So to go with my weather plugin I want to make mostly realistic wind

#

As in if it's fast enough it'll make mobs fly around

#

I'm not sure how I should do that because I think applying a velocity to every entity in a world would cause performance issues

lethal python
#

ImIllusion can i dm u

echo basalt
#

just ask it here and understand why we're laughing at you

#

we point out your mistakes because we want you to improve as fast as possible

#

tough love type of deal

#

at the end of the day no one cares and you're here to get your problem solved

lethal python
#

ok turns out i have no idea what my problem even is

#

i made an inventory and for some reason when i open it it gets two copies of me as a viewer

#

i have an inventorycloseevent and event.getViewers() has 2 of me in it

vagrant stratus
#

Yo nerds. How do I make a rainbow using particles?

echo basalt
#

basically it's a semicircle

#

or well

#

7 of them

#

where the radius increases slightly

vagrant stratus
echo basalt
#

And you need to do some math to know when your angle starts and ends

#

It's really picky

vagrant stratus
#

yeaaa, I figured

#

I'd have to do some sort of sanity check loading it I'm sure

echo basalt
#

or well you gotta like atan2

glad prawn
#

who added letters to math? 💀

slender elbow
#

Alan Turing

#

famously known for inventing letters

glad prawn
#

😭😭😡

young knoll
#

Hey don’t be mean to him

#

He was a lad

paper viper
echo basalt
#

hol'up I'm getting there

paper viper
#

I thought you left lol

slender elbow
#

good evening

#

tips fedora

paper viper
#

🤠

young knoll
#

He also had enough people being mean to him when he was alive

echo basalt
#

yeah the idea is to render a semicircle around an axis perpendicular to the axis between the 2 points

#

or we can just use bezier curves lmfao

#

and make it 19x easier

#

with beziers it's just

#
public void renderRainbow(Location one, Location two) {
  double distance = one.distance(two);
  Vector difference = two.toVector().subtract(one.toVector();
  Vector middle = difference.multiply(0.5).add(0, distance, 0);

  drawBezier(one, middle, two);
}
#

type deal

#

it's kinda shit

#

thinking of the mathemathical way of doing this

#
public static final double BAND_RADIUS_INCREMENT = 0.1;
public static final double ANGULAR_DISTANCE_BETWEEN_PARTICLES = 1; // Might want to switch to a lerp based approach

public static final Color[] BAND_COLORS = {
  new Color(...) // the 7 colors or whatever
};

public void renderRainbow(Location start, Location end) {
  double diameter = start.distance(end);
  double radius = diameter / 2;

  Vector startVec = start.toVector();
  Vector endVec = end.toVector();

  Vector difference = endVector.clone().subtract(startVector);
  Vector middle = difference.clone().multiply(0.5);

  double startAngle = middle.angle(startVec);
  double endAngle = middle.angle(endVec);

  double min = Math.min(startAngle, endAngle);
  double max = Math.max(startAngle, endAngle);

  double increment = (max - min) * ANGULAR_DISTANCE_BETWEEN_PARTICLES;

  for(double angle = min; angle <= max; angle += increment) {
    double radians = Math.toRadians(angle);
    
     trig here idk i failed maths    
  }
}
#

hm

vagrant stratus
#

I failed maths too, hence me not having it made already lmfao

echo basalt
#

it's just cos sin

#

idk what order tho

echo basalt
#

something like

#

double y = radius * Math.sin(radians)

#

xz is a bit more complicated

#

I genuinely forgot

#

but for xz we need to calculate the angle of that separately

#

with atan2

thin iris
#

fuck atan2

echo basalt
#

all my homies hate atan2

#

double xzAngle = Math.atan2(z2 - z1, x2 - x1)

vagrant stratus
#

on another note, do skin URLs have to come from the usual site or can it just be... any site?

young knoll
#

They must be from Mojang

vagrant stratus
#

damn

#

can't just replace the skin service then by manually setting skins lmao

young knoll
#

They need to be signed essentially

#

Mineskin provides an api for this

#

Which citizens uses

vagrant stratus
#

hmm, guess it could theoretically be replaced then.

I don't want to rely on a third-party though 😐

#

And depending on how they do it, it might not even bypass the mojang bans lmao

young knoll
#

I’m pretty sure they just apply it to an account

#

So no, it won’t

vagrant stratus
#

shame

#

was hoping to reimpl skin handling, but not so... limiting ig

#

but if it requires mojang services, that's fucked lmfao

young knoll
#

Smh making a system to bypass the bans

vagrant stratus
#

Nah, it would still include bans. Just make it possible to decide what gets banned

#

instead of fuck you, global ban

#

Would include other useful skin related functionality, but it's not worth touching if it has to rely on their services

echo basalt
#

can't wait for ppl to apply shit to mineskin and report the donor accounts

#

thanks for the suggestion github

young knoll
#

Idk if that matters

#

In theory the account only needs the skin briefly and then they can just revert to Steve

#

Plus they would have to get it on the same account several times for it to be banned, if you aren’t being a dickhead it just gets removed

vagrant stratus
#

every acc loses the skin

#

so it doesn't matter

slender elbow
#

+1s blue a single pixel oops

young knoll
#

Every account that has it yes

#

I mean the account doesn’t get disabled unless they violate it repeatedly

vagrant stratus
#

ah

#

well regardless you probably can't get around it the way you're suggesting

#

it'll likely just be deletes file and bans hash kinda deal

young knoll
#

Yea but I’m not talking about getting around it

#

I’m saying the accounts donated to mineskin will probably be fine

vagrant stratus
#

ehh

#

They'll likely lose the skins, regardless of the amount of skins passed through them

#

but banned? Maybe?

young knoll
#

They will only get banned if they repeatedly get reported with a bad skin

vagrant stratus
#

Yea, and those have 1000s of skins used on them. Probably not difficult

young knoll
#

True but there are also a bunch of them

#

So it’d be hard to target one

vagrant stratus
#

okay so

#

you underestimate the lengths some people go

young knoll
#

True

vagrant stratus
#

It's also not hard to set -> wait -> report -> repeat

distant wave
#

Any idea how could i make player let sleep in bed but not set spawnpoint

strong parcel
#

Hey guys, I am having trouble with the EntityExplodeEvent

#

So I took e.blockList() and assigned it to a List<Block> variable. Then I removed blockes from the variable that should not be broken.

#

This used to work perfectly fine, but in recent testing, the blocks targeted by the explosion are still broken.

#

I also tried removing them directly using e.blockList().remove(block), but that had no effect

#

As well as e.blockList().clear() followed by e.blockList().addAll(blocksThatShouldBreak). This attempt resulted in explosions breaking no blocks at all regardless of the targets.

#

I don't understand what I need to do to edit the list of blocks that should be broken by the explosion.

#

All of the print statements fire at the appropriate times, so the code is definitely being run. It seems to me to have something to do with the event methods rather than the math or PDC calls.

vapid anvil
#

Maybe they made the block list read-only?

#

If there are separate events firing when the actual blocks are removed you could potentially cancel those instead

eternal oxide
#

you can;t remove a Block from a list you are currently iterating over unless you use an actual iterator.

valid kite
#

Is there any event for when an entity lands on a block?

eternal oxide
#

sometimes. Interact events

chilly hearth
#

e

#

btw

#

if we spawn an entity for example

#

and we set its customname as "example" + entity.gethealth it will show its health and will track when it go down am i right

#

ik its stuopid

#

just wana confirm

smoky oak
#

thats a snapshot of its health

#

update it when it gets damaged or heals

chilly hearth
#

how to

smoky oak
#

events?

chilly hearth
#

which event

smoky oak
#

EntityDamageEvent and EntityRegenEvent iirc

chilly hearth
#

like how to track it

smoky oak
#

uh
when those events happen, check if its that entity, if yes, change the custom name

chilly hearth
#

OHHH

#

UR SMART

#

smarty boiii

#

ik hes gona say "its basic" xd

#

nah i will just use scoreboard tags

smoky oak
#

fuck do u mean reference

chilly hearth
#

they work as well

smoky oak
#

id exists

chilly hearth
#

ik xd\

smoky oak
#

i mean zacken

chilly hearth
#

oh ye

smoky oak
#

an ID is not a reference, its the identification. It's not a reversible mapping

#

Reference = access to the object

#

uuid doesnt store location data

#

so you cant get the entity from an uuid

#

just make sure 'have i iterated over entity x yet?'

valid kite
#

if there's a specific one

ivory sleet
#

They’re not necessarily unique tho, its just the data type UUID, yes it stands for universally unique identifier but it just represents 128 bits in practice.

smoky oak
#

pretty sure the algorithm used is dependent on the current unix time

ivory sleet
#

I was just picking on ur words since what you said isn’t 100% correct

upper hazel
#

does it make sense to create an additional level of abstraction if this class does nothing

#

so i can just impl hashDataStore

#

end use him

distant wave
#

Any idea how to prevent bed set respawn

quiet ice
#

?jd-s

undone axleBOT
distant wave
distant wave
quiet ice
distant wave
#

Ill try that

#

Pretty straightforward solution smh

vapid anvil
#

I have actually had that

#

got a console warning, a sheep had spawned with the same UUID as something else

buoyant viper
#

sorry that was me

#

thousands a day suffer from identity fraud

hushed scaffold
#

My guess

vapid anvil
distant wave
#

Not on pc so i can show you rn

vapid anvil
distant wave
#

Thats a cool idea

#

Must have missed it

#

Cant find it anywhere

#

Got docs

#

?

vapid anvil
#

might be, I don't know

#

it's marked as experimental

vapid anvil
vapid anvil
#

🤷‍♂️ might have to find some convoluted Spigot workaround

#

maybe something in a PlayerInteractEvent

chrome beacon
#

Yeah PlayerInteractEvent

#

Cancel the event or in the next tick remove the bed position

vapid anvil
#

the issue would be how do you cancel the spawn set but also let the player sleep

chrome beacon
#

Then you'd do the second option

#

Just remove it next tick and hope the player doesn't die during that time

young knoll
#

PlayerBedExitEvent has an option to not set spawn

#

Idk exactly how that works

chrome beacon
#

It can be set just by right clicking

#

You don't need to enter the bed

young knoll
#

Yeah so idk why the event has that

#

Probably a legacy thing

chrome beacon
#

Yeah probably legacy

young knoll
#

I mean the spawn change event probably works

#

Even if it’s draft api

hexed crown
#

So a bit of a noob question as I just started with learning to make spiggot plugins, I keep getting this error
[13:26:31 ERROR] [Minecraft]: Could not load 'plugins\presenthunt-1.0-SNAPSHOT.jar' in folder 'plugins': uses the space-character (0x20) in its name
But there doesn't seem to be any spaces in my pom.xml file?

<?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>org.nephalem</groupId>
    <artifactId>presenthunt</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>PresentHunt</name>

    <description>A plugin where players can run to heads around spawn and right click them for prizes Each present can
        have 1 random reward from the regular rewards list When you get to ur final present, u get the mega prize
    </description>
    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

    <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>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.19.2-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</project>
distant wave
undone axleBOT
young knoll
#

Idk if it’s in 1.12

#

But if it is it should work

hexed crown
hexed crown
#

I'm confused as to why when I used intellij's Minecraft development plugin it made a pom.xml then lol

young knoll
#

That’s for maven

chrome beacon
#

The pom is for managing the Java project

#

plugin.yml is for the finished project during runtime

hexed crown
#

Wait then do I need to make a plugin.yml file or should it already be there?

chrome beacon
#

If you used the mc dev plugiin it's in the resources folder

hexed crown
#

Wait I found it sorry

#

Still new to this lol

#

Ayyy it worked! tyvm guys

vapid anvil
#

marked for removal, you get an error if you try using it

chrome beacon
#

Draft api should compile

vapid anvil
#

huh it does compile

#

I guess IntelliJ just considers it bad practise enough to mark it as an error

#

I know what deprecated means

young knoll
#

Has that really been draft api since 1.12

vapid anvil
#

it's specifically deprecated for removal, which I guess means its removal is imminent instead of at some point

young knoll
#

It’s not marked for removal in 1.20

vapid anvil
#

it is in 1.20.1

chrome beacon
#

It's not

vapid anvil
glad prawn
#

can we pass null to setBedSpawnLocation to remove sp 😦

young knoll
#

Are you using spigot api

glad prawn
#

like setDeathMessage

young knoll
#

Or are you using paper api

chrome beacon
#

It's marked for removal in Paper

#

Just checked

young knoll
#

Mhm

vapid anvil
#

nevermind, I guess it's just Paper that has it marked

icy beacon
#

Time for my favorite command

#

?whereami

chrome beacon
#

?fork

undone axleBOT
#

SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.

vapid anvil
#

if it's deprecated in Spigot what's the workaround supposed to be?

#

lmao you guys get pretty worked up about that huh

icy beacon
#

It's just kinda hard to provide support for software we don't develop

young knoll
#

It’s not deprecated in spigot

vapid anvil
#

well I'm asking about the software you do develop

young knoll
#

Spigot just used to use @Deprecated for draft api

icy beacon
young knoll
#

Now we use @Experimental

undone axleBOT
vapid anvil
#

that is what we're actually trying to figure out

#

nothing to do with Paper

scenic onyx
#

How i can get Entity in an ENUM? exist class?

hazy parrot
#

can you elaborate a little bit

lilac dagger
#

Entity#getType

#

then == EntityType#YOUR_TYPE

hexed crown
#

How do I add a fuction to an block? I wanna be able to right click a mob head / player head and have it give me an item

tall dragon
#

can be done with PlayerInteractEvent

upper hazel
#

is the privileges plugin similar to luckPerms or does it use it as a source of permission management?

hexed crown
quaint mantle
#

Hey guys, how can I get the worldserver from a resourceKey (1.18)

#
    @NotNull
    private static final ResourceKey<World> resourceKey;
    @NotNull
    private static final Method method;

    public FakeEntityPlayer18(@NotNull GameProfile gameProfile) {
        super(MinecraftServer.getServer(), /** how to return the worldserver by resourceKey*/, gameProfile);
#

To use EntityPlayer:

 public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile) {
#

I mean it's not necessary but for the versions 1.12 and 1.16 I have used it and it seemed to work

#

And what variable should I put as the world? A Bukkit world ?

chrome beacon
#

Yes

#

Also there's no need to reinvent the wheel

#

There are plenty of NPC apis you can use

#

Until you have to support 1.8-latest

#

and have to maintain that yourself instead of working on cool features

quaint mantle
#

^^

chrome beacon
#

Yeah I saw

#

I was thinking of doing the same

#

I've been researching on how to transpile Dart to Java

#

🤷‍♂️

quaint mantle
#

1 more question, how can I spawn here a fake player with the network manager?

private static final void spawnFakePlayer$lambda10(FakeEntityPlayer118 $fake) {
        Intrinsics.checkNotNullParameter((Object)$fake, (String)"$fake");
        EntityPlayer entityPlayer1 = (EntityPlayer) $fake;
        NetworkManager networkManager1 = $fake.b.a;
        EntityHuman entityHuman = (EntityHuman) entityPlayer1.getBukkitEntity().getPlayer();
        //MinecraftServer.getServer().
        try {
            //MinecraftServer.getServer().ac().a($fake.b.a, (EntityPlayer)$fake);
            //MinecraftServer.getServer().getPlayerList().a(entityHuman);
        }
        catch (Exception ex) {
            ex.printStackTrace();
            fakePlayers.remove($fake.cm());
            return;
        }
    }
upper hazel
#

plugins for donations
is this a new level of abstraction for luckPerms?

chrome beacon
#

^^

quaint mantle
#

Yeah, I'm using my friend's spoofer and I'm trying to learn on how to make it since he's going to uni soon and he didn't want to give me the source code since he said I have to be learning, but rn I am kind of in a hole because I don't know how to spawn a player (since I am kind of a beginner) and I decompiled his plugin and wanted to see how he did it

quaint mantle
#

I see, thanks a lot for your advice, but since I think I'm kind of getting close to it, if it would be already, could you tell me how to do those mappings in 1.18.2?

undone axleBOT
scenic onyx
#

I never understood how that site works

quaint mantle
#

Thanks a lot 🙂

scenic onyx
#

javadoc is more simple

#

I do not understand anything

hasty prawn
#

Well those are obfuscated that's kinda the point of those

drowsy helm
#

just use moj map

hasty prawn
#

They're all the same thing, just different names.

scenic onyx
#

NMS is you soluzion

#

ChatGPT is your soluzion

strong parcel
scenic onyx
#

i know

#

but i dont use ProtocolLib

strong parcel
#

That's rude, dude

chrome beacon
#

Show us the code you used

strong parcel
#

lol

scenic onyx
#

hahahah

#

so was you lol

strong parcel
#

ChatGPT is actually pretty helpful if you can get past the hallucinations

scenic onyx
#

it pay

strong parcel
#

Is there a way for students to get it?

#

Please teach

upper hazel
#

using api is the best solution don't listen to your friend

distant wave
scenic onyx
#

player1.teleport(player2.getLocation().add(y, x, z))

scenic onyx
#

nope

upper hazel
#

lol

scenic onyx
#

is normal api

#

dont use

#

simple

echo basalt
#

if you are a beginner you shouldn't use copilot

#

bros losing his marbles because I called him a beginner

upper hazel
#

what to do in such a situation when the customer doesn’t have enough money to order a plugin but i doesn’t want to refuse

echo basalt
#

send a rotation packet with the vehicle entity id?

echo basalt
#

because skill comes at a cost

#

eh

#

I've tried but I'm not great

distant wave
upper hazel
#

this money

echo basalt
#

@tall dragon

#

this guy knows about ij plugins

upper hazel
#

ProtocolLib use NMS ?

vapid anvil
#

internally yeah

tall dragon
upper hazel
#

so he not shold adapt to another version

#

but how

#

he not can work in

hasty prawn
#

He can because ProtocolLib handles that.

upper hazel
#

another verision

vapid anvil
#

I use ProtocolLib because I don't want to have to deal with NMS

#

the ProtocolLib dev handles updating the NMS code for new versions

echo basalt
#

plib just uses reflections mostly

upper hazel
#

all sayEveryone says that NMS is version sensitive, but how does ProtocolLib deal with this?

tall dragon
#

i could try if you explain the issue sure

echo basalt
#

it reflects into the nms packet and wraps all fields

#

regardless of version

upper hazel
#

he use reflection

#

this is reason?

#

one of the reasons

eternal oxide
#

open your jar with 7zip and see if the file really exists

tall dragon
#

r those java files?

#

in kotlin dir

quaint mantle
#

Hey, so I've checked the mappings, but I am still not sure how to make this spawnFakePlayer work:

    private static final void spawnFakePlayer$lambda10(FakeEntityPlayer118 $fake) {
        Intrinsics.checkNotNullParameter((Object)$fake, (String)"$fake");
        EntityPlayer entityPlayer1 = (EntityPlayer) $fake;
        NetworkManager networkManager1 = $fake.b.a;
        PlayerConnection connection = $fake.b;
        EntityHuman entityHuman = (EntityHuman) entityPlayer1.getBukkitEntity().getPlayer();
        //MinecraftServer.getServer().
        try {
            PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn(entityHuman);
            connection.
           //networkManager1.;
            //MinecraftServer.getServer().ac().a($fake.b.a, (EntityPlayer)$fake);
            //MinecraftServer.getServer().getPlayerList().a(entityHuman);
        }
        catch (Exception ex) {
            ex.printStackTrace();
            fakePlayers.remove($fake.cm());
            return;
        }
    }
tall dragon
#

pretty sure that can cause problems

#

rename it

#

to src/main/java

tall dragon
#

pretty sure that works out the box if you followed their demo yes

quaint mantle
tall dragon
#

;d

hasty prawn
#

gradle is okay when it does what you want it to do

tall dragon
hasty prawn
#

fair enough

tall dragon
#

thing just is. gradle has 300 different ways to achieve the same result

#

so everyone does it differently lol

hasty prawn
#

Gradle just does too many things for it to be able to do the simple things easily

#

Like making a fat jar requires a plugin

tall dragon
#

pretty much yea

hasty prawn
#

But, with that being said, if you learn how Gradle does things chefsKiss

tall dragon
#

i had to make a modular paperweight project a few weeks ago

#

lets just say im lucky i have a friend much smarter than me

#

pain

hasty prawn
#

Lol

#

I actually made a Gradle plugin recently, the documentation on Gradle's site is actually not bad

tall dragon
#

what the plugin do

hasty prawn
#

Applies Moj maps automatically

#

Basically just give it the MC version you want and it adds the moj map dependencies for you and then lets you rebuild back to Spigot

tall dragon
#

ahh interesting

#

thats what paperweight does for paper

chrome beacon
#

There are also like 3 plugins that can do that with Spigot

hasty prawn
#

Yeah, I'm sure there are now. When I first started using moj maps there wasn't one for gradle

chrome beacon
#

?notworking

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.

strong parcel
#

lol, i have been using Maven for over a year and still only know what one button does

vapid anvil
#

I know what 3 of the buttons do 😎

hexed crown
#

?paste

undone axleBOT
hexed crown
#

So I am trying to add the ability to turn mob heads and player heads into little presents that when you right click them it gives you a reward, I have tried running the code though ChatGPT but it can't seem th find the issue as to why it's not doing anything when you right click the heads
https://paste.md-5.net/faruguvoyi.java

#

There isn't any errors in the server logs

echo basalt
#

502 bad gateway md_5

river oracle
#

No 👎

#

It works 💪

valid kite
#

I'm guessing EntityAirChange event is triggered every tick but if not how often is it triggered?

opal juniper
#

whenever the amount of air changes PES_AngeryWut

#

which i think is less than every tick - depends if it is a discrete or continuous value

valid kite
#

Just making sure

hexed crown
small current
#

what is the best style of bossbar

#

for a countdown

echo basalt
#

Mob heads are a different material

echo basalt
hexed crown
valid kite
#

Turns out that EntityAirChange only really works when entities are in water

#

For me atleast anyways

#

Anyone know a good way to track when an entity falls or touchs a block?

clever lantern
#

is it wrong to use DI with listeners?

valid kite
#

Could i technically track an animation of the pig to see whenever it gets hurt or something?

#

Or entity

remote swallow
river oracle
unkempt peak
clever lantern
valid kite
#

Wait entityairchange event is for how much breath the entity has my bad

#

I think i found the solution to my problem

clever lantern
unkempt peak
#

That's what I thought, but for some reason it is returning null when the player right clicks a block

river oracle
clever lantern
unkempt peak
#

And, I have tried it with a sword item and a food item, the food item doesn't return null but the sword does

#

This is only when the event is RIGHT_CLICK_BLOCK

#

Is this because the food item tiggers a use action but the sword doesn't?

#

Sorry I had the wrong action

#

it's when clicking a block

mellow edge
#

if I iterate over Material class legacy values will be included, so could I maybe use !Material#isLegacy

worldly ingot
#

If your api version is set, it shouldn't include legacy materials

mellow edge
#

api-version: '1.20'

worldly ingot
#

Yeah then it shouldn't include them

#

If it does, then yeah, isLegacy() ¯_(ツ)_/¯

mellow edge
#

what is even the point of those legacy values?

kind hatch
#

For compatibility with older plugins that have not been updated.

tough mica
#

Hello,
i got a class when a player died hes get in the spectator mode. now is the problem if the player scrolls on the mouse he can fly. but i want that the player cant move. the another problem is that the player can get in another players und can teleport to another players. how can i fix that?

quaint mantle
#

¯_(ツ)_/¯ this thing is so much fun to send

quaint mantle
tough mica
#

yes, but which listeners?

quaint mantle
#

PlayerMoveEvent

tough mica
#

i tried it already, but the player can teleport into another players

#

that the hugest problem

quaint mantle
#

Hm. Wait, when I player moves the event gets triggered. So... if you can teleport to it, just save the previous location and teleport back the player.

remote swallow
#

player teleport event probably

quaint mantle
tough mica
#

yea, thats a solution . but isnt it possible to remove the function that the player can teleport to another players in the spectator mode

remote swallow
echo basalt
#

spawn an invisible armorstand

#

and force the player to spectate it

quaint mantle
tough mica
hexed crown
eternal night
#

interact is called twice

#

once for each hand

distant wave
#

does somene know why this count the bed spawnpoint?

#

even tho it shouldnt

eternal night
#

this count to the what ?

distant wave
eternal night
#

Use PlayerSpawnChangeEvent ?

distant wave
eternal night
#

skully my condolences, gl!

distant wave
#

i dont know how to fix that lmao 😭

distant wave
hexed crown
eternal night
#

hm ?

remote swallow
#

?interactevent

undone axleBOT
#

The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.

For example, only executing code if the main hand was used:

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
    if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
        return; // do not progress past this point  |
    }
    // provide functionality
}
glad prawn
distant wave
#

what if the player has a normal /spawnpoint somewhere else

distant wave
hexed crown
#

Ok I got it working, thank you!

tough mica
#

is it possible in the playermoveevent, to activate the mouseviewing?

small current
#

how to disable tab complete of a certain username(s) in commands?

worldly ingot
#

If it's your own command you can just omit them from your TabCompleter implementation

small current
worldly ingot
#

You can't know whether a suggestion is a player name though. You just kind of have to assume they're all player names

lethal python
#

Custom inventory has duplicate viewers

clever lantern
# small current great

you can use adventure library
BukkitAudiences.create(Plugin.getInstance()).filter(player -> !notInlcudedList.contains(player))

kind hatch
#

Adventure is not part of spigot though.

clever lantern
#

or just getOnlinePlayers and filter them by yourself

worldly ingot
#

I don't even know what that has to do with tab completion

clever lantern
#

someone knows what event is fired when player attacks other player?

remote swallow
#

entitiy damage event

worldly ingot
#

Or for a bit more precision, EntityDamageByEntityEvent

clever lantern
small current
#

wdym

#

what that code does

lethal python
#

i made a thread for a problem im having

remote swallow
small current
worldly ingot
#

That's your answer. Ignore anybody else suggesting anything else

#

Literally no clue why they mentioned Adventure

quaint mantle
#

When did mojang release mappings

#

What ver

remote swallow
#

mojmaps were 1.14 iirc

#

spigot started using them 1.17

quaint mantle
#

And is there a list of releasee versions like 1.18.2-R0.1-SNAPSHOT

worldly ingot
#

They'll all be <version>-R0.1-SNAPSHOT

sage dragon
#

Did Mojang remove the ability for zombies to wear heads in 1.20.2?

They aren't being rendered anymore

quaint mantle
#

Even back to 1.8?

worldly ingot
#

Starting from 1.8 actually, yeah

#

Exception to 1.8.9 because there was no server release for that version

quaint mantle
#

So 1.8.8

worldly ingot
#

Correct

wraith apex
#

Anyone know of the forum thread that talks about the faster methods of setting blocks in a world?

remote swallow
#

?distro

#

?workdistro

wraith apex
#

Thanks for the resource, however it's not what I'm looking for

remote swallow
#

do you know what discord ur in

tidal kettle
#

okk

#

but paper is in major part spiogt?

#

no?

lethal python
#

apparently there's a rule that if your thing is about paper then ur not meant to reply

tidal kettle
#

Ok ok i'm sorry

#

i don't know dat

lethal python
#

i only found out today

#

i hope u find help

tidal kettle
#

thx

wraith apex
#

If you're talking about coloured text in the console it is a thing

remote swallow
#

we cannot help with something that we dont add

tidal kettle
lethal python
#

u dont have to apologise so hard it's ok

remote swallow
#

we addon to the vanilla jar, paper then addon to us. so paper add stuff seperately

lethal python
#

epicebic are you good at spigot

remote swallow
#

depends on what

wraith apex
#

the colour thing is spigot though

remote swallow
#

spigot console uses ansi

#

papers uses the same as mc colour codes

#

removethe inspection, ignore it, or null check it

wraith apex
#

spigot is a server middleware

#

not a console

remote swallow
#

spigot has a console

glad prawn
#

Override onCommand method, setExecutor to this

wraith apex
#

it's up the console if it supports the extended colours

remote swallow
#

correct, paper use jline

#

we dont

wraith apex
#
public static String applyColour(String string,Color colour)
{
    return ChatColor.of(colour) + string;
}
#

'Color' is from awt

#

'ChatColor' is net.md_5.bungee.api.ChatColor

#

none of this is paper

remote swallow
#

okay?

#

if you want to use §6 in console you have to use paper

wraith apex
#

uh no

#

no you don't

#

colours work in spigot

lethal python
#

omg bri ish

wraith apex
lethal python
#

im bri ish too

wraith apex
#

¯_(ツ)_/¯

lethal python
#

🤝

wraith apex
sage dragon
#

How would I listen to packets in 1.20.2?

Seems like something changed in 1.20.2

wraith apex
#

although I'm using puffer

lethal python
#

logicaldark do u think u could check my thread

wraith apex
#

what thread

wraith apex
#

y

lethal python
#

maybe u know the answer

zealous scroll
#

would it be much strain on the server's storage to track player-placed blocks with a value in their pdc?

eternal valve
#

I want to write a small plugin to turn off vanilla fishing in Minecraf, where can I start?

#

My goal is to close the fish in vanilla and only the ones I added with itemsadder appear.

#

In addition, itemsadderda uses "fishing" so I just want to disable the vanilla loot table and run only "fishing" even if it is empty

vast ledge
zealous scroll
#

apparently saving it in the chunk's pdc is better isn't it?

hushed spindle
#

does anyone happen to have the item slot indexes for the creative menu armor slots

#

since the player inventory and creative inventory are different

#

actually nevermind ill just test that

#

they the same 👍

twin venture
#

InventoryCloseEvent : the item that is on the Courser will be removed no matter what i do is there a fix for it?

hazy parrot
#

a,b,c,d whatareyoudoing

#

its not class, result of getPluginCommand might be null

robust helm
#

How can I copy all properties of one Object(Player) to another object (also Player)? I was thinking about making a world profile system, so players have different effects, inventories, health, saturation etc. in each world

robust helm
heady grove
#

Hi, I am having an issue with the BlockDropItemEvent
I'm using the getBlockState() method which the docs (https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/block/BlockDropItemEvent.html#getBlockState()) states "Gets the BlockState of the block involved in this event before it was broken.", I interpret this as giving a BlockState of the block prior to the event happening i.e. the block itself not a BlockState for AIR
When I break carrots I seem to be getting a BlockState with a getBlock() result of Material.AIR

Does anyone know how I can determine the block that was broken/why I am getting a BlockState for Material.AIR

Code:

    @EventHandler(priority = EventPriority.HIGH)
    public void onBreakResultsInDrop(BlockDropItemEvent event) {
        if (!isCrop(event.getBlockState().getBlock())) {
            return;
        }

        new CropBreakEvent(event.getBlock(), event.getBlockState(), event.getPlayer(), event.getItems());
    }

    private boolean isCrop(Block block) {
        //TODO: Update
        return block.getType().equals(Material.CARROTS);
    }
#

Using a remote Java debugger the event.getBlockState() result is
"CraftBlock{pos=BlockPosition{x=-1, y=63, z=42},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@29012da7}"

warm mica
#

Thus event.getBlockState() is not the equivaleng of event.gegBlockState().getBlock().getState()

#

You'd have to pass the BlockState to isCrop

heady grove
#

Ah brilliant - I probably should've looked further into BlockState did not notice it had a getType() method also. Thank you for your help 🙂

bronze crystal
#

hi, how do I get an object with the interface CraftingInventory in 1.20

#

Getting CraftingInventory for Custom Crafting Table

barren nacelle
#

Does anyone know how to cancel a task timer inside of the task timer itself?

wraith apex
#

cancel()

young knoll
#

Show us your runnable

#

Since it depends on how you are doing it

barren nacelle
barren nacelle
barren nacelle
#

Here you go

#

In the if statement I want to cancel the loop

young knoll
#

Runnable.cancel()

#

Tho you should rename Runnable to not start with a cap

glad prawn
#

...(plugin, task -> { task.cancel(); });

young knoll
#

^

livid dove
#

God imagine not making your runnable a separate class so you can just do this.cancel

wraith apex
#

How to get cancelled

livid dove
#

Search your feelings you know it to be true

young knoll
#

I normally only do that if the runnable is more than a few lines

wraith apex
#
new BukkitRunnable()
{
    @Override
    public void run() 
    {
        cancel();
    }
}.runTaskTimer(MyPlugin.getInstance(),20,20);
livid dove
#

Ah I like the versatility of it being its own class.

Gets it's own fields, can added it to a manager if u were so inclined (for stuff like event checking etc )

glad prawn
livid dove
#

If usually say go to the church and ask God to forgive you.

But they sint even letting u in bro

wraith apex
glad prawn
#

clean🤑

wraith apex
#

so is this

livid dove
#

Clean isn't being it's own class

wraith apex
#

I've only shown a smol amount

#

it is

livid dove
#

Also you know someone is being pedantic when they see a runnable that just cancels itself being ran via run task timer and go "WhAt AbOuT lAmBdA ThO?" 💀

glad prawn
#

then

wraith apex
#

people like the very little verbosity it is

livid dove
#

Get that functional crap out of my OOP 💀

wraith apex
#

I can do all this complex shit in one line

livid dove
#

We are an instance based household sir

wraith apex
#

it's an aid

#

it's not a...

#

I must use it everywhere!

barren nacelle
#

How can reference main without making a new instance of my main class? I know it's probably basic java but I'm very stupid

young knoll
#

?di

undone axleBOT
brisk ice
#

Hello everyone, today when I wanted to download the plugins for my server, I downloaded one of the plugins, it directed me to the cloudfare page, the case is that it doesn't go beyond that page and I couldn't download anything, any solution?

wraith apex
#

store your main in an instance in itself

brisk ice
#

please

#

read mensage

wraith apex
#

for exmaple

young knoll
#

You can also use a static getter for your main

#

DI is generally preferred

#

But ehhhhhhh

wraith apex
#

then you can just do MyPlugin.instance

young knoll
#

Well, it needs to be static

#

And don’t make it public, make a getter

wraith apex
#

why a getter?

#

no need

#

but yes, it needs to be static

young knoll
#

So no one can mess with it

#

Well, not as easily

wraith apex
#

???

#

getters and setters are only needed if you need to control retrieval or setting of a variable like in race conditions

young knoll
#

Last thing you want is another plugin just doing MyPlugin.instance = null

wraith apex
#

they're not needed for literally every variable

wraith apex
young knoll
#

I never said to make a setter

#

Just a getter

wraith apex
#

also if you have another dev doing that, that sounds like a skill issue on their end

young knoll
#

Better safe than sorry

wraith apex
#

Aye, and I'm saying it's not needed

#

it's overkill

ivory sleet
#

Because java lacks whats called property semantics which languages like kotlin have encapsulation regarding data of objects become extremely nice, especially if u dont hate urself

#

there is more to a getter than just the field invocation

wraith apex
ivory sleet
#

yea

ivory sleet
wraith apex
#

no it is

barren nacelle
#

If the code compiles I'm fine with using it

ivory sleet
#

thats a poor mindset

wraith apex
#

thank you

wraith apex
barren nacelle
#

It's for a server only using my own plugins

wraith apex
#

they don't

ivory sleet
prime reef
#

💀

ivory sleet
#

i mean sure if u work procedurally then yeah

wraith apex
#

I do

ivory sleet
#

but java is not really procedural

prime reef
#

you generally want to avoid unprotected write access

#

this is why i like C#

wraith apex
#

then make it final

prime reef
#

there are a few ways you can accomplish this besides getters though

ivory sleet
#

code becomes really coupled the way object orientation works if you dont encapsulate ur fields

prime reef
#

If you don't need further write access that's fine

young knoll
#

public String name { get; set; } when

prime reef
#

I use struct-style classes where that's a factor

wraith apex
#

it's holding an instance of a main class

prime reef
wraith apex
#

there is nothing to write

prime reef
#

yeah I dropped in like

#

a minute ago

#

I don't have that context lmao

ivory sleet
barren nacelle
#

Nevermind the code didn't work

ivory sleet
#

again you prob dont know why encapsulation is so vital

young knoll
#

Can’t be final here

wraith apex
#

I do

young knoll
#

Since you assign it in onEnable

brisk ice
#

Does anyone really know why cloudfare won't let me download spigot plugins please help me

prime reef
brisk ice
#

yes thanks

#

sorry

wraith apex
#

the difference is that I'm past the point of by disenchantment of getters and setters for everything

prime reef
#

well, you don't need a setter

#

but that's also why it should be private

wraith apex
#

I'm never going to have a class set the main instance to null

#

that's just dumb

prime reef
#

it's good practice in case someone else ever touches your code

#

even if they won't

#

code conventions exist for a reason

young knoll
#

Or another plugin is on your server

prime reef
#

if you're entirely a hobbyist then do whtaever

young knoll
#

That isn’t your own

prime reef
wraith apex
#

and not mine

prime reef
#

i hope you don't work in tech

wraith apex
#

and note

#

to even do that

#

you'd have to have my plugin as a lib

#

or reflect access it

prime reef
#

no you wouldn't

#

reflection yes

#

and guess what some libraries do

wraith apex
#

not really my problem though

#

encapsulation can be but an illusion anyway if I can just reflect my way across a plugin

prime reef
#

encapsulation has more purposes than just write protection, y'know

#

java lacks pass by reference for primitives for instance

#

but that's neither here nor there

barren nacelle
#

I'll just use a getter

wraith apex
#

yes encapsulation hides what the class actually does and just provides you methods on how you can operate it

prime reef
wraith apex
young knoll
#

Can we just have C# properties

#

Or any kind of properties

prime reef
#

singleton pattern is very standard for this kind of thing

young knoll
#

Javaplz

wraith apex
#

singleton lmao

prime reef
wraith apex
#

singletons?

prime reef
wraith apex
#

you mean static

prime reef
#

no

#

i mean singleton pattern

wraith apex
#

static class

ivory sleet
# wraith apex I do

Clearly not, because if you have then you would be past the point of not being object oriented in Java. You know how much Java suffered cause of System.out and System.in hell just look at the implementation!? If we want to restrain consumers from touching our data unrestrained then you can't just do that whenever you feel like. Let's say the code you write becomes exposed to external modularity or you define an api layer, or you need to add thread safety, or maybe alter the implementation entirely. Why do you think Java decided to make record components expose methods and not final fields?

prime reef
#

that is not what a singleton is

#

static classes are tied to compilation units

#

not related

wraith apex
prime reef
#

singleton pattern involves maintaining a static, write-protected reference to an object of which there will only be a single instance at runtime

young knoll
wraith apex
#

and the label means nothing

ivory sleet
#

The issue with not using encapsulation doesn't come right away, but if you don't have any experience in the enterprise industry or in larger code bases you probably don't understand and cannot grasp the bigger issue of avoiding these practices we got together after many years of trial and erroring

prime reef
#

Seriously, though, if you'd drop the "I'm right/it's someone else's problem" attitude, I'd be very willing to help

#

I never judge people for inexperience, I judge them for the attitude they display alongside that inexperience

wraith apex
#

I'm not a hobbiest

prime reef
#

you are objectively wrong on multiple counts and we've explained why

wraith apex
#

lol

prime reef
#

cool, that's even worse

#

i hope you don't take that into the workplace

wraith apex
#

??

ivory sleet
#

Anhwylder chill a bit

wraith apex
#

dude

#

stop

prime reef
#

yeah mb, i'm getting unreasonably fired up here

wraith apex
#

the fucking insults man

ivory sleet
#

Try to keep this constructive

wraith apex
#

chill

prime reef
#

you're right, i'm sorry

#

lost my cool there, give me a sec

wraith apex
#

xD

prime reef
#

not sure what's up with me tonight

ivory sleet
#

I mean like, avoding encapsulation is just absurd but yeah, dw allg

#

i mean sure its possible

#

but so is a lot of things

#

singletons are already procedural enough as is, no need to make them stand out as that, we are trying object orienting ourselves at the end in java, we try to abstract away implementations to make things self conservative for long term, god idk even how long 5 years, maybe 10 or even 20

barren nacelle
#

wow I've created an argument over correct coding practices for java

ivory sleet
#

and also write once run everywhere (which is completely incorrect but im just gonna spit it out lol)

#

Anyway im gonna re qoute myself
"You know how much Java suffered cause of System.out and System.in hell just look at the implementation!? If we want to restrain consumers from touching our data unrestrained then you can't just do that whenever you feel like. Let's say the code you write becomes exposed to external modularity or you define an api layer, or you need to add thread safety, or maybe alter the implementation entirely. Why do you think Java decided to make record components expose methods and not final fields?"