#help-development

1 messages · Page 1504 of 1

wraith rapids
#

it could be removed by a plugin

shadow gazelle
#

Oh

wraith rapids
#

the player could die

paper viper
#

pretty sure it checks all possibilities

#

then yea only possible way is tick

#

ig

wraith rapids
#

the lib? if you're talking about red's txt lib, it just checks all slots each tick

shadow gazelle
#

Is there a tick event?

#

Wait, docs exist

wraith rapids
#

sort of, but only on paper iirc

#

you generally don't need an event for it, though

#

schedule a task that runs every tick

sage swift
#

HAHAHAAHA

wraith rapids
#

laugh at the miscreant

#

ridicule him

shadow gazelle
#

That's like shooting yourself in the foot tbh

wraith rapids
#

throw some rotten tomatoes at him

proud basin
#

it shouldn't show null as it's set to 0

sage swift
#

would you like to join the 1.8 support discord

wraith rapids
shadow gazelle
#

lmao

granite stirrup
sage swift
#

now that we can send links here

granite stirrup
#

theres no where in code u did

proud basin
#

I did

granite stirrup
#

u didnt

proud basin
#

int kills = 0;

granite stirrup
#

that only happens when u kill someone

#

🤦

wraith rapids
#

KILL

proud basin
#

no its set someone where else

granite stirrup
#

where

#

do u even put it into the map?

#

omg its so hot today

#

its says online its 16°C

#

its like hot as shit

#

it feels like 100°C

quaint mantle
#

Do custom recipes show up in the book if you have all the items in your inventory?

wraith rapids
#

if they have been registered, yes

#

or, they should, i think

granite stirrup
quaint mantle
#

what means registered?

#

I want to make them hidden

proud basin
last sleet
#

Quick question: if i make a "custom" craft by just making the vanilla recipe, but adding something else as product, will that override the vanilla recipe?

granite stirrup
wraith rapids
#

if you don't register them, they aren't craftable

last sleet
#

I will register them

#

but will they override the vanilla ones

wraith rapids
#

answering to the other dude

last sleet
#

Oh

wraith rapids
#

i don't know whether they'll override

#

try it and see i suppose

last sleet
#

ok

shadow gazelle
#

And save resources a bit?

wraith rapids
#

yeah, should be fine

#

also, if you have lots of enchants that do a similar thing, don't make a new task for each one

#

the only costly part about what you are doing is the getItemMeta call that needs to happen for the containsEnchant call

#

which means that you should only call getItemMeta once

candid silo
#

is it better on the server to stuff a bunch of stuff into one task as apposed to having multiple tasks?

wraith rapids
#

or as few times as possible

#

it depends on the kind of stuff and the amount of tasks involved

shadow gazelle
#

Would every second still be fine?

wraith rapids
#

well, people would be able to fly for an extra second

#

is that fine?

shadow gazelle
#

hm

#

I mean

#

It's not like it's going to be a PvP thing where they have to stop flying instantly when they go into an area

wraith rapids
#

make it configurable and forget about it

shadow gazelle
#

So it's probably fine, and I'd assume the chance of someone landing right on the second is pretty rare

#

time.run() is showing is invalid

wraith rapids
#

you do realize i have zero context for what time.run is or what you mean by invalid

shadow gazelle
#

lol, sorry

#

Cannot resolve run from time

int taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> time.run(), 0L, delaySeconds * 20)
wraith rapids
#

and what is time.run() supposed to be

proud basin
#

man I don't like json

gaunt hatch
#

json is nice what do you mean 🙂

shadow gazelle
proud basin
gaunt hatch
#

How so?

proud basin
#

but my code doesn't work

shadow gazelle
#

Ignore that

granite stirrup
#

XD

#

and then its mostly strings and things

wraith rapids
#

yes

granite stirrup
#
  "json": {
    "is": "cool"
  },
  "yes": {
    "or": "no"
  }
}```
wraith rapids
#

brilliant

#

json is strings and things

#

impeccable analysis

gaunt hatch
#

Yea and?

#

Are you having issues reading it to load from?

proud basin
#

but

#

mine broke

gaunt hatch
#

How are you reading it? Like line for line?

proud basin
#

uh

paper viper
#

json is not for configuration, but for storing data like in your case

proud basin
#

I deleted it

gaunt hatch
#

IDk if you use it but look into json serialization and deserialization

#

never have a issue after that

proud basin
#

not a big fan of json

wraith rapids
#

json is fine

gaunt hatch
#

So with my code i have serialization and deserialization all i do is pass into a code block and it sets it to the proper location in the class, and boom always works

proud basin
#

when I say and speak Json I say Johnson

granite stirrup
#

j son

#

jay son

#

i say it like that

paper viper
#

yeah

#

jay son

proud basin
#

you guys are weird

granite stirrup
#

jay's son (jk)

wraith rapids
#

what happened to tommy tom tom

proud basin
#

Tom?

#

Tag him

gaunt hatch
#

that moment when entity checking has issues in async calls in 1.17 RIP my log lol

wraith rapids
#

i can't find the right tom in the user list

#

the deer guy

#

i think his nick was iliketocode

#

his discriminator was 3111

proud basin
#

jo

ornate hollow
#

this is more of a maven question but how do i force the latest gson version i added as a dependency, bc when i cpackage the plugin and run it it says method deffinition not found

#

and is that a good idea

ornate hollow
#

it doesnt keep it

#

it defualts back to 2.8.0 that comes with spigot

wraith rapids
#

you want to shade and relocate if you want to use something other than what spigot uses

granite stirrup
#

why doesnt spigot use latest

#

lol

shadow gazelle
#

@wraith rapids alright, I'm stuck, how do you make a task?

ornate hollow
#

i have the shade plugin

wraith rapids
#

because spigot doesn't use the latest of anything

#

it's like a thing

granite stirrup
#

they need to

ornate hollow
#

but it is still defualting the older version

wraith rapids
#

we can't have comments in configs properly because we use ancient fucking snakeyaml

#

shade and relocate

granite stirrup
#

apparently md_5 is doing something about that

#

thats what i saw on the thread

#

but thats for 1.17

#

l

ornate hollow
granite stirrup
#

grab all the files and stuff them in ur project (jk idk how)

wraith rapids
#

google "shade and relocate maven"

ornate hollow
#

literally on uni they explaind us maven as you copy paste stuff and ti works, but i know from making random shit in java that is never true
and here i come again with maven issues

wraith rapids
#

yeah, you just need to find the right things to copy paste

#

and maybe tweak a few values here and there

granite stirrup
#

i mean maven is pretty pointless what it does is u could do it manually but its just a little harder i mean i guess its pretty useful if ur lazy like me

ornate hollow
#

yeah but noone told me what tags do what

#

fucked up

granite stirrup
#

yeah idfk

#

im out

sullen marlin
granite stirrup
#

oh gosh i hope md_5 didnt read the ping i sent

#

well it got deleted

#

;-;

granite stirrup
proud basin
#

yeah no I can't get my json to work

granite stirrup
#

whats ur code

wraith rapids
#

consider improving the unemployment rates

sullen marlin
#

the person that added comment support to snakeyaml did it so they could add it to spigot and theyre aware of the issue

granite stirrup
#

is 192.168 the starting for all private ipv4s?

paper viper
#

?

eternal oxide
proud basin
#
public static void loadPlayerData() throws FileNotFoundException {
        File tempFile = new File("playerDataStorage.json");
        boolean exists = tempFile.exists();
        if (exists == false) {
            try {
                File file = new File("playerDataStorage.json");
            } catch (IOException e) {

                e.printStackTrace();
            }

            try {
                Path path = Paths.get("playerDataStorage.json");
                Files.write(path, "{\"1\": \"/\"}".getBytes());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        File file = new File("playerDataStorage.json");
        HashMap<String, String> newPlayerData = new Gson().fromJson(new FileReader(file), HashMap.class);
        playerData = newPlayerData;
    }

    public static void savePlayerData() {
        try {
            String jsonString = new GsonBuilder().setPrettyPrinting().create().toJson(playerData);
            Path path = Paths.get("playerDataStorage.json");
            Files.write(path, jsonString.getBytes());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }```
paper viper
#

pretty sure you can just write directly

#

to a file

#

instead of getting string?

#

or am i wrong

empty swallow
#

imagine if used on a big server with tons of players, ram would be full of useless data

paper viper
#

Yeah you can

quaint mantle
#

why is the name key for the "PLAY_ONE_MINUTE" statistic wrong 🙃

shadow gazelle
#

How do I make a task?

rich yarrow
#

Hello guys! Can someone help me with a problem please?

    @EventHandler
    public void onBreak(final BlockBreakEvent e)
    {
        final Player p = e.getPlayer();
        if (p.hasPermission("lobbycore.build")) {
            return;
        }
        if (worlds.contains(p.getWorld().getName()))
        {
            e.setCancelled(true);
            p.sendMessage(ChatColor.translateAlternateColorCodes( '&', this.getConfig().getString("NoBreakMessage")));
        }
    }

i don't know why but i get the message twice when i break a block

granite stirrup
proud basin
granite stirrup
#

thats java

#

lol

proud basin
#

smh

#

You know what I mean

granite stirrup
#

also i think Paths.get() starts from root directory u might want it in ur plugin directory that gets created if u have config files and shit

proud basin
#

screw it

ivory sleet
#

you'd use File#toPath then

paper viper
#

.toJson(playerData, new FileWriter(path));

#

iirc

quaint mantle
#

🤢

ivory sleet
#

I use BufferedWriter but yeah

paper viper
#

first thing i copied lol

quaint mantle
#

if you're not gonna use a twr at least put it in a variable and close it manually

proud basin
#

im just gonna use mysql

granite stirrup
#

mysl is harder

quaint mantle
#

yeah because that's way fucking easier than writing to a file

proud basin
#

It is

#

because ive worked with it

quaint mantle
#

this is not to do with json or yaml or toml or a properties

#

this is to do with learning a library, an API and learning how to use the tools at your disposal

granite stirrup
#

u should probs use yaml instead cuz spigot has a thing for it

proud basin
#

Literally I have never worked with json

quaint mantle
#

and???

#

the file format is entirely irrelevant

wraith rapids
#

pulse

#

do me a favor

#

ripcord can't ping people by nick

paper viper
#

it was just the method

paper viper
wraith rapids
#

see if you can find iliketocode on this guild

paper viper
#

cant find him

#

hmm

wraith rapids
#

lmao did he get banned

granite stirrup
#

who knows

dusk flicker
#

looking in message logs it looks like it

shadow gazelle
#

?paste

undone axleBOT
wraith rapids
#

why did he get banned

shadow gazelle
dusk flicker
#

do you know their discord name NNY

#

not the nick

wraith rapids
#

i think it was like !tom or something

dusk flicker
#

either one of these?

#

v

wraith rapids
#

no he had like a deer avatar

dusk flicker
#

alr

dusty herald
#

they're no longer here

wraith rapids
#

i can see that

#

but why

granite stirrup
dusk flicker
#

I cant find anything public for a ban or kick cmd

dusty herald
#

they just left I guess

wraith rapids
#

i can't find any messages from him

dusk flicker
#

add them as a friend then

wraith rapids
#

ah

#

the user got deleted

dusk flicker
#

oof

wraith rapids
#

found him verifying himself

dusty herald
#

pff

#

that's sad

#

I'm sorry nnya

wraith rapids
#

@quaint mantle

granite stirrup
#

did he delete his discord

#

or did his discord get banned?

#

how do we know lol

paper viper
#

if it says Deleted User

#

it means he deleted his discord

granite stirrup
#

doesnt it appear the same for banned account users?

wraith rapids
#

i'm not sure if that is the same account though

#

that is the only message I could find

#

all instances of him being mentioned or talked to have no messages by him sent in the timeframe

granite stirrup
#

if his accounts deleted wouldnt all messages be deleted?

paper viper
#

its the same for bans too

#

if you get banned, the admin can choose whether to delete your messages or not

wraith rapids
#

thing is the message is from the deleted account

paper viper
#

in a time frame

wraith rapids
#

the message of him verifying himself

paper viper
#

by default and usually all messages are deleted

quaint mantle
#

Asking again, why is the namespaced key for the play time statistic wrong 🙃

shadow gazelle
granite stirrup
#

maybe player.getPlayer().getInventory().getChestplate() is null?

shadow gazelle
#

That doesn't make sense when it's finding the enchant and letting me fly

#

And getting past that to turn fly on in the first place

gloomy edge
#

Is there an event where I can get an iron door from a button when pressed

shadow gazelle
#

Or do you mean getting one placed as a block?

sage swift
#

why are you getting the player from the player

shadow gazelle
#

Because I had to use Bukkit.getOnlinePlayers() for getting the players

sage swift
#

also this is definitely the best way to do custom enchants 😆

#

and player is already a player object

shadow gazelle
shadow gazelle
#

So a custom library?

#

That would require adding another plugin?

paper viper
#

no

#

examples most likely

shadow gazelle
#

Looks like another library

paper viper
#

look at the second link

#

it leads to code

#

you can take a look at that code

shadow gazelle
quaint mantle
#

how do i turn a block into ice?

i tried using loc.getBlock().setType("ICE");
but it doesnt work

paper viper
#

you need to use Material

#

like Material.ICE

quaint mantle
#

oh

#

the class

paper viper
#

you cant use strings

quaint mantle
#

thanks!

paper viper
#

np

ivory sleet
#

Pulse pro

paper viper
#

help me out in help-server please

ornate hollow
#
Caused by: java.lang.NoSuchMethodError: 'com.google.gson.JsonElement com.google.gson.JsonParser.parseReader(java.io.Reader)

All i did is add the latest gson as dependecy, bc i need it for the api call

paper viper
#

lmao

ornate hollow
proud basin
#

How come the folder & file aren't being created ```java
public String pluginFolder = this.plugin.getDataFolder().getAbsolutePath();

public void writeJSON(String fileName, String subPath, String object, String value) {
    JSONObject main = new JSONObject();

    main.put(object, value);

    try {
        File file = new File(pluginFolder + File.separator + subPath + fileName + ".json");
        File filePath = new File(pluginFolder + File.separator + subPath);
        filePath.mkdirs();
        if (!file.exists()) {
            file.createNewFile();
        }
        FileWriter fileWriter = new FileWriter(file);
        fileWriter.write(main.toJSONString());
        fileWriter.flush();
        fileWriter.close();
    } catch (Exception e) {}
}
#

no errors

ornate hollow
#

on linux?

sage swift
#

e.printStackTrace() 🤦‍♂️

granite stirrup
#

bruh

proud basin
#

sh

#

error is here ```java
database.writeJSON("playerData", "data", "first", "second");

#

java.lang.NullPointerException

compact haven
#

database is null

granite stirrup
#

u never set database maybe?

crude charm
#

You probs dont connect to it

granite stirrup
#

lol no i think database is a class with the writeJSON

proud basin
#

^

compact haven
#

what a weird naming scheme rofl

proud basin
#

want me to name it JsonHandler?

unreal quartz
#

rename it to bob

proud basin
#

anyways that isn't the issue

proud basin
granite stirrup
#

maybe main is null?

proud basin
#

well that line is in the main class

crude charm
granite stirrup
proud basin
#

I don't think so

#

?paste

undone axleBOT
proud basin
ivory sleet
#

line 18 in main

crude charm
#

^

#

beat me to it lol

paper viper
#

the only possible reason to that is literally database being null

#

or something in writeJSON throws some npe

ivory sleet
#

no database is null

paper viper
#

Mhm

crude charm
#

What is line 18 in main?

paper viper
#

he posted it above

crude charm
#

oh

ivory sleet
#

But anyways jtx you should always provide the entire class and errors from the very beginning, it will make it easier for other people to aid you

dense geyser
#

Does anyone know what these enums are telling me? I originally thought they were to do with what a moving object had hit, but after trialling it, it doesn't appear to be correct. Are they to do with the type of moving object instead? (This is in the MovingObjectPosition class of NMS) https://gyazo.com/1e3616547b86983567a8986cd148694b

proud basin
#

it was just in the main in onEnable()

#

so nothing too special

ivory sleet
#

That cannot fit in onEnable

#

?paste the main class

undone axleBOT
proud basin
#

how come?

ivory sleet
#

Or nvm was looking at wrong stuff

#

but anyways you still havent sent the entire class so cant help you

proud basin
#
public class Volzo extends JavaPlugin {

    private JsonHandler jsonHandler;

    public void onEnable() {
        jsonHandler.writeJSON("playerData", "data", "first", "second");
    }
ivory sleet
#

okay that makes more sense

#

jsonHandler is null

empty swallow
#

this what I use

private void loadConfig() {
    try {
        if (!getDataFolder().exists()) {
            getDataFolder().mkdirs();
        }
        File file = new File(getDataFolder(), "config.yml");
        if (!file.exists()) {
            getLogger().info("Config.yml not found, creating!");
            saveDefaultConfig();
            // set default values
        } else {
            getLogger().info("Config.yml found, loaded!");
            // set values here
        }
    } catch (Exception e) {
        e.printStackTrace();

    }

}
ivory sleet
#

you probably need something like:

private JsonHandler jsonHandler = new JsonHandler(this);
#

also I suggest learning java by taking a course, it will help you with all these crucially trivial errors and will also save everyones time

#

?learnjava

undone axleBOT
mint maple
#

is there a way to place naturally like there is to breakNaturally

ivory sleet
eternal oxide
ivory sleet
#

But since I don’t know how your JsonHandler class is looking I can’t tell you how to do it

ivory sleet
#

that is not the entire class

proud basin
#
public class JsonHandler {

    public Volzo plugin;

    public JsonHandler(Volzo plugin) {
        this.plugin = plugin;
    }

    public String pluginFolder = this.plugin.getDataFolder().getAbsolutePath();

    public void writeJSON(String fileName, String subPath, String object, String value) {
        JSONObject main = new JSONObject();

        main.put(object, value);

        try {
            File file = new File(pluginFolder + File.separator + subPath + fileName + ".json");
            File filePath = new File(pluginFolder + File.separator + subPath);
            filePath.mkdirs();
            if (!file.exists()) {
                file.createNewFile();
            }
            FileWriter fileWriter = new FileWriter(file);
            fileWriter.write(main.toJSONString());
            fileWriter.flush();
            fileWriter.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
``` is that better 🙂
ivory sleet
#

yes you're doing it wrong again

wraith rapids
#

have you considered not using 1.8

proud basin
#

no

#

1.9+ dog

wraith rapids
#

perhaps consider considering it

proud basin
#

I will never, 1.8 is my home

wraith rapids
#

1.8 api sucks

proud basin
#

update it then

wraith rapids
#

if you were on even a remotely modern version, you'd do what you're trying to do in like 3 lines

#

no, that's not my job

#

backporting features to the 1.8 api is the job of you 1.8 plebians

#

something you have been failing to do for the last 6 years

#

and will fail to do for the next 6 years

proud basin
#

lmao

proud basin
vagrant stratus
ivory sleet
#

fields are initialized before constructors

#

but by a rough guess you don't understand a thing of what I just said

wraith rapids
#

protip

proud basin
#

wait

wraith rapids
#

make fields final

proud basin
#

I think I fixed it

wraith rapids
#

it'll help you

proud basin
#
public void writeJSON(String fileName, String subPath, String object, String value) {
        JSONObject main = new JSONObject();

        main.put(object, value);

        try {
            File file = new File(pluginFolder + File.separator + subPath + fileName + ".json");
            File filePath = new File(pluginFolder + File.separator + subPath);
            filePath.mkdirs();
            if (!file.exists()) {
                file.createNewFile();
            }
            FileWriter fileWriter = new FileWriter(file);
            fileWriter.write(main.toJSONString());
            fileWriter.flush();
            fileWriter.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        
    }
``` better?
paper viper
#

try with resources

sage swift
#

you need Bukkit.shutdown() somewhere in there

ivory sleet
#

the entire issue exists in the class not that method particularly

wraith rapids
#

probably doesn't even exist on 1.8

proud basin
#

it does

sage swift
#

alternatively Thead.sleep(Integer.MAX_VALUE)

wraith rapids
#

back before 1.9 you had to pull the plug from the machine to shut down your server

sage swift
#

or Runtime.getRuntime().halt(69)

vagrant stratus
wraith rapids
#

no

paper viper
sage swift
#

im funny remember

#

or were you too self-absorbed to

paper viper
#

doesnt mean if you are a gecko you can save 15% on car insurance

wraith rapids
#

insurance is for pussies

quaint mantle
#

my plugin doesnt work somehow, maybe my code is the problem... on the console it loads it normally.

sage swift
#

"hurr durr look at all this malwar guise!!"

wraith rapids
#

again, field initializers are called before your constructor

#

you have a field plugin

#

and you are assigning it in your constructor

#

but you are accessing it before the constructor is called

quaint mantle
# quaint mantle my plugin doesnt work somehow, maybe my code is the problem... on the console it...

`public void onHit(ProjectileHitEvent e) {
if (e.getEntity().getShooter() instanceof Stray && e.getHitEntity() instanceof Player) {
Player a =(Player) e.getHitEntity();
double x =(a.getLocation().getBlockX() -1);
double y =a.getLocation().getBlockY();
double z =(a.getLocation().getBlockZ()-1);
setblocksstuff(x,y,z,2);
setblocksstuff(x,y+1,z,2);

    }

  }

private void setblocksstuff(double x,double y, double z,double ancho){
    Location loc = new Location(null, x, y, z);
    for(int j=1;j<=ancho;j++){


    for(int i=1;i<=ancho;i++){
        loc.setX(x+i);
        loc.getBlock().setType(Material.ICE);
    }
loc.setX(x);
    }
    //loc.getBlock().setType("");
    
    
}`
wraith rapids
#

therefore it is null

vagrant stratus
wraith rapids
#

again, make it final, it'll tell you what to do and save you from a headache

sage swift
vagrant stratus
#

Malware's not going to be left up 🤷‍♂️

sage swift
#

but i want malware

vagrant stratus
#

oh well

eternal oxide
#

Perhaps there should be a list of guilty plugins/parties to make it harder for them to appear again.

wraith rapids
#

yeah because that has ever worked

vagrant stratus
wraith rapids
#

the moment you put a name on a list the name will be changed

eternal oxide
#

nice

wraith rapids
#

perhaps you didn't tell it to do anything

#

computers only do what you tell them to do

eternal oxide
#

I'm good, none of my plugins are on there 😄

quaint mantle
sage swift
#

does the code run

crude charm
#

@vagrant stratus LMFAO

sage swift
#

do you have @EventHandler

quaint mantle
#

i posted the code above

sage swift
#

do you have @EventHandler

vagrant stratus
quaint mantle
#

yes

proud basin
sage swift
#

add broadcasts throughout the code and see which print and which don't

wraith rapids
#

public String pluginFolder = this.plugin.getDataFolder().getAbsolutePath();

last sleet
#

Hey, so i've been trying to make a custom defence stat. I figured out the equation for it, but when i put the numbers through it, it doesn't seem to work.

quaint mantle
#

how so? (im new to all of this)

wraith rapids
#

this is a field declaration

#

you are declaring and assigning a value to this field

sage swift
#

Bukkit.broadcastMessage

last sleet
#

damage is now (before def) is the damage before defence is calculated

wraith rapids
#

in doing so, you are using the value assigned to the plugin field

#

by calling this.plugin.getDataFolder()

last sleet
#

DMG = [number] is the damage when defence is calculated

#

Is there something wrong with my equation?

wraith rapids
#

however, since this is declaration-assignment, the value of plugin has not been assigned yet; it is assigned in the constructor

#

which, again, is called after field declarations

last sleet
#

(Also ik that dmg before def is 6.25 and after its 6, but thats because I rounded it up)

wraith rapids
#

you are referencing a variable before assigning a value to it

#

i can't put it any simpler

#

learn java

paper viper
#

?learnjava

undone axleBOT
proud basin
wraith rapids
#

you are doing it differently

last sleet
#

Is there any problems with this equation?

#

When the system.out prints, the number doesnt change at all.

wraith rapids
#

integer division in a floating point context

proud basin
last sleet
#

Wdym by that?

wraith rapids
#

from how you usually do it

last sleet
#

I should change totalDef to be a floating point number?

quaint mantle
wraith rapids
#

you should change that division to change in a floating point context

sage swift
#

did you register the event

wraith rapids
#

you could for example cast totalDef to (float) immediately prior

proud basin
#

Do you just want me to put this.plugin.getDataFolder().getAbsolutePath(); instead of setting it to a variable

quaint mantle
wraith rapids
#

no, I want you to do the things in the right order

#

right now you are doing them backwards

sage swift
proud basin
#

Literally I don't think that's the issue

wraith rapids
#

but it is

#

a blind man can see it with his fucking forehead that that is the issue

granite stirrup
#

html isnt a programming language lol https://www.youtube.com/watch?v=wvDFdfJtSJw

Everybody likes tier lists. Right? In this video I am going over all of the languages that I have experience with and have used to determine once and for all what the best and worst programming languages are. This video is of course purely for fun, and should not be taken seriously.

🌎 Find Me Here:

My Courses: https://courses.webdevsimplified...

▶ Play video
#

neither css

#

XD

wraith rapids
#

they may not be turing complete but they are still languages

granite stirrup
#

languages u see they say programming languages

#

not lauguages

#

ik there are still languages thi

proud basin
maiden thicket
#

html is a

#

"scripting"

#

language

granite stirrup
#

no

#

html is a markup language

#

get ur facts right

wraith rapids
#

you are doing it differently such that it breaks

maiden thicket
#

o

#

well

wraith rapids
#

i don't know how you do it usually

maiden thicket
#

same difference

#

gottem

wraith rapids
#

i'm not your mom

#

but you are doing it wrong now

maiden thicket
#

oops

#

not u

#

but

#

other guy

next stratus
#

Where's the best place to find people who can do some coding work?

maiden thicket
#

just use the actual file object

#

xd

wraith rapids
#

cause he's a noob and doesn't know what else to use

eternal oxide
#

?services

undone axleBOT
next stratus
#

Ty

maiden thicket
#

@undone axle ❤️

next stratus
#

I gotta get a project remade somehow :/

granite stirrup
#

but the thing @next stratus everyone isnt gonna do it for free

next stratus
#

I know.

stone sinew
#

Whats better performance wise? List<Location> or Location[]?

next stratus
#

I'm gonna pay.

maiden thicket
#

wat

stone sinew
#

So list?

ivory sleet
#

no latter means the second one

#

or like the second of 2 alternatives

granite stirrup
stone sinew
proud basin
#

Your saying this is backwards so you want me to do this ```java
this.plugin.getDataFolder().getAbsolutePath(); = public String pluginFolder

proud basin
#

like wtf

maiden thicket
#

JavaPlugin#getDataFolder

ivory sleet
#

jtx the problem is the instance variable plugin

maiden thicket
#

that's all you need

ivory sleet
#

it isn't initialized thus null

maiden thicket
#

oh that

#

and make sure ur data folder also exists

#

but if ur making files - please don't use File#getAbsolutePath

#

just use the normal file reference

wraith rapids
#

@proud basin

#

ok

#

let's take it from the top

maiden thicket
#

new File(file reference (folder u want to put it in), "file.name");

wraith rapids
#

now

wraith rapids
#

focus your chin and nose in my direction

#

listen to what I say

proud basin
#

...

maiden thicket
#

setVector

#

ez

wraith rapids
#

do you know what a constructor is?

floral kindle
#

I've updated almost all my packages to the new version!

granite stirrup
maiden thicket
#

bob the builder is a constructor right

proud basin
wraith rapids
#

right

#

do you know what a field is?

next stratus
#

No but, the thing is the project I'm I need of is too big to be free.

granite stirrup
proud basin
granite stirrup
#

just curious

wraith rapids
#

right

#

so

#

you have a field

#

and you have a constructor

#

you have some code in both

next stratus
#

It's a custom mine system

wraith rapids
#

right?

floral kindle
proud basin
#

yes

maiden thicket
#

initialize field in constructor

#

ezpz

wraith rapids
#

you have this.plugin.getDataFolder().getAbsolutePath() in the field

proud basin
#

are you saying I don't need public JsonHandler(Volzo plugin) {
this.plugin = plugin;
}

granite stirrup
maiden thicket
#

u do

wraith rapids
#

no, i'm not

#

listen

#

you have this.plugin.getDataFolder().getAbsolutePath() in the field

#

do you acknowledge this

proud basin
#

hm

wraith rapids
#

you have this code in the field

next stratus
#

The previous dev won't hell me anymore

maiden thicket
#

jtx basically what he's saying is

#

you're using

wraith rapids
#

this runs when the field is declared

maiden thicket
#

a field

#

and in that field

#

ur referencing another field

#

which isnt initialized yet

granite stirrup
#

does jtx even know java

wraith rapids
#

now

#

you have a constructor

#

you still know what a constructor is?

#

or did you manage to forget

proud basin
#

yes i know what it is

wraith rapids
#

right

#

you have some code in your constructor

#

this.plugin = plugin;

proud basin
#

mhm

wraith rapids
#

now

#

let's look at these two bits of code

#

String path = this.plugin.getDataFolder().getAbsolutePath()

#

and
this.plugin = plugin;

#

do we see a relation here?

proud basin
#

oh remove this.?

wraith rapids
#

no

quaint mantle
#

how do i register an event?

wraith rapids
#

the first line of code relies on plugin

eternal oxide
#

NNYa you havn;t explained the init order of objects

wraith rapids
#

you are calling a method on plugin

#

do you understand

proud basin
#

ya

wraith rapids
#

you need a value in plugin

maiden thicket
wraith rapids
#

so you need to assign the plugin variable first

#

before running that code

#

because otherwise it's null

#

right

proud basin
#

yea you've lost me

maiden thicket
#

jtx

#

can u send ur class

#

rq

#

?paste

undone axleBOT
wraith rapids
#

do you know what a variable is

proud basin
#

yes

wraith rapids
#

you have a variable named plugin

#

right

proud basin
#

mhm

wraith rapids
#

what's in this variable?

#

what is the value of this variable?

granite stirrup
maiden thicket
shadow gazelle
proud basin
#

this.plugin = plugin;

maiden thicket
#

continue instead

#

if you return it'll break the for loop

wraith rapids
#

no, wrong -- you haven't put anything in the variable yet

this puts a thing in the variable
this.plugin = plugin;

maiden thicket
#

if u continue it'll go to the next player in the loop

wraith rapids
#

but you haven't done this.plugin = plugin yet

#

the field assignment happens before your constructor

granite stirrup
maiden thicket
#

second of all

#

you're checking if chestplate is null

wraith rapids
#

String path = this.plugin.getDataFolder().getAbsolutePath()

#

happens before

maiden thicket
#

then checking again if the chestplate has an enchantment

wraith rapids
#

this.plugin = plugin

eternal oxide
#

@proud basin when a class is instanced its Fields are set, be that null or a value. This happens BEFORE the constructor is called.

maiden thicket
#

an if else instead

proud basin
wraith rapids
#

yes

#

i was expecting your response

proud basin
#

wow rude

wraith rapids
#

it's called a leading question

maiden thicket
#

jtx could you send your class so i can see as wel what u doing xd

wraith rapids
#

it's intended to lead you to find the fault in your reasoning

shadow gazelle
maiden thicket
#

?paste

undone axleBOT
maiden thicket
#

ur checking if the chestplate is null then checking again if it contains an enchantment

#

do an else if instead

#

also

#

you have to have

#

curly braces

#

because if u dont have curly braces

granite stirrup
# shadow gazelle Anyone have any idea why this turns flight off when I start flying? https://past...

try java Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() { public void run() { for (Player player : Bukkit.getOnlinePlayers()) { if (player.getPlayer().getGameMode() == GameMode.CREATIVE || player.getPlayer().getGameMode() == GameMode.SPECTATOR) { continue; } if (player.getPlayer().getInventory().getChestplate() == null) { player.setAllowFlight(false); player.setFlying(false); } else if (!player.getPlayer().getInventory().getChestplate().containsEnchantment(Enchants.FLIGHT)) { player.setAllowFlight(false); player.setFlying(false); } else { player.setAllowFlight(true); } } } }, 0L, 10L);

maiden thicket
#

this will run only

maiden thicket
#

instead of this whole thing

maiden thicket
#

could you send the class

#

?paste

undone axleBOT
maiden thicket
#

through this

proud basin
maiden thicket
#

that does not look like the thing he is pointing out

#

that method

wraith rapids
#

@eternal oxide we've told him about the init order of objects 4 times

#

the issue is he doesn't know what init, order, or object mean

maiden thicket
#

that is a method jtx not a class

#

could you send the whole class

eternal oxide
#

@proud basin you can't set your path until AFTER you have assigned a value to plugin.

maiden thicket
#

ok

#

here

#

    public Volzo plugin;

    public JsonHandler(Volzo plugin) {
        this.plugin = plugin;
    }

    public String pluginFolder = this.plugin.getDataFolder().getAbsolutePath();

    public void writeJSON(String fileName, String subPath, String object, String value) {
        JSONObject main = new JSONObject();

        main.put(object, value);

        try {
            File file = new File(pluginFolder + File.separator + subPath + fileName + ".json");
            File filePath = new File(pluginFolder + File.separator + subPath);
            filePath.mkdirs();
            if (!file.exists()) {
                file.createNewFile();
            }
            FileWriter fileWriter = new FileWriter(file);
            fileWriter.write(main.toJSONString());
            fileWriter.flush();
            fileWriter.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}```
#

so

#

u see how u initialize plugin right

wraith rapids
#

anyways, i'm out

maiden thicket
#

but then u initialize pluginFolder while plugin is still null

#

because plugin isn't initialized when u create the pluginFolder variable

eternal oxide
#

I see wher he's confusing himself

maiden thicket
#

so instead of initializing the pluginFolder

#

outside of the constructor

#

initialize it in the constructor

#

after u initialize the plugin variable

eternal oxide
#

he thinks because he put public String pluginFolder = under his constructor he thinks it gets set after.

maiden thicket
#

yeah

wraith rapids
#

imagine if someone had told him that constructors fire after field declarations

proud basin
#

so? ```java
public JsonHandler(Volzo plugin) {
this.plugin = plugin;
String pluginFolder = this.plugin.getDataFolder().getAbsolutePath();
}

maiden thicket
#
    public Volzo plugin;
    public String pluginFolder;

    public JsonHandler(Volzo plugin) {
        this.plugin = plugin;
        this.pluginFolder = this.plugin.getDataFolder().getAbsolutePath();
    }

    public void writeJSON(String fileName, String subPath, String object, String value) {
        JSONObject main = new JSONObject();

        main.put(object, value);

        try {
            File file = new File(pluginFolder + File.separator + subPath + fileName + ".json");
            File filePath = new File(pluginFolder + File.separator + subPath);
            filePath.mkdirs();
            if (!file.exists()) {
                file.createNewFile();
            }
            FileWriter fileWriter = new FileWriter(file);
            fileWriter.write(main.toJSONString());
            fileWriter.flush();
            fileWriter.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}```
#

no

eternal oxide
#

If he read it and realized

maiden thicket
#

like how i did it

#

you're not creating the variable

#

in the constructor

proud basin
#

hm

maiden thicket
#

you're initializing it

wraith rapids
#

learn java

#

that's all i have to say at this point

maiden thicket
#

tbh i learnt java only from spigot dev

#

xd

#

never learnt it before then

digital plinth
#

why do i not see plugin.yml in the finished jar file

#

weirddd

proud basin
#

ah ok

maiden thicket
wraith rapids
#

learning spigot the bukkit api and java in parallel is fine

digital plinth
wraith rapids
#

being unable to look anything up or do any of your own learning is less so

maiden thicket
#

package typing an essay

wraith rapids
#

spit it out

digital plinth
wraith rapids
#

see announcements

#

tl;dr

proud basin
#

well at least no error pops up just gotta fix it so the folder is actually made

digital plinth
#

oh nvm

#

found it

#

thx

simple root
#

How do i use mojang mappings i want to learn this instead of learning NMS because that is what seems to be recommended now.

proud basin
#

there we go

maiden thicket
#

open cmd prompt and is run java -version

#

no

#

just

#

asking

#

does it say jdk 16 in there

#

when i downgraded my jdk to a lower version

#

i had to move it down in my Path env variable too

#

not just adjust my java home

maiden thicket
#

o

proud basin
#

interesting the file is not being made inside the folder but outside of it

maiden thicket
#

and Path variable is set too

#

hmm

digital plinth
maiden thicket
#

is this gradle or maven

#

maven

digital plinth
maiden thicket
#

oh

#

ok

#

is this ur shade 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>```
#

and in the pom.xml

#
    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>```
#

at the top

#

ignore there are no repos and the dependency since im using buildtools xd

#

and the special source maven plugin

proud basin
#

I have this ```java
File file = new File(pluginFolder + File.separator + subPath + fileName + ".json");
File filePath = new File(pluginFolder + File.separator + subPath);
filePath.mkdirs();
if (!file.exists()) {
file.createNewFile();
}
FileWriter fileWriter = new FileWriter(file);
fileWriter.write(main.toJSONString());
fileWriter.flush();
fileWriter.close();

maiden thicket
#

path

#

exist

#

like

#

the folder

#

create the folder before dong that

proud basin
#

I make the folder with filePath.mkdirs();

#

I got an idea

#

wait

maiden thicket
#

set ur java version to 1.8

proud basin
#

nvm

#

didn't work

maiden thicket
#

o

granite stirrup
#

do u have java 16?

maiden thicket
#

you're trying to update ur plugin to compile w java 16

#

hm

#

uh

ivory sleet
#

@digital plinth still got problems?

maiden thicket
#

did u set ur compiler plugin

proud basin
granite stirrup
proud basin
#

the folder

maiden thicket
#

what spigot version

proud basin
#

subpath

maiden thicket
#

1.17 im assuming

granite stirrup
#

make sure u have java 16 properly installed and make sure u have the latest maven shade plugin

maiden thicket
#

u probably already have the compiler plugin don't know if it matters as well but

#
            <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>```
#

does it look like that

#

actually

#

one second

#

i've been compiling my plugins with 1.8

#

give me a sec

#

ok ye java 16 works for me

#

ok

#

so

#

could u send ur whole xml if that's alright

#

alright tyty

digital plinth
#

that?

maiden thicket
#

try adjusting ur compiler plugin

#

and setting the source and target

#

see if that helps maybe

#
            <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>```
granite stirrup
#

@wanton fjord try the maven shade plugin version 3.2.4

maiden thicket
#

does spigot 1.12.2 even let you compile with jdk 16

#

o.o

granite stirrup
#

if u havent got that already

#

oh wait u have latest shade plugin nvm

#

yeah i didnt see it

#

yet

#

lol

#

i think what it is is somethings in that NMS class doesnt support java 16

granite stirrup
#

cuz java 16 is class file major version 60

#

@wanton fjord can you show the NMS.java file?

#

in com/craftmend/showsplus/nms/

#

hmm

#

whats AbstractFixture and AbstractLaser ?

#

??

#

why did he delete his messages

maiden thicket
wanton fjord
#

thanks for the effort but it's obvious i wont be getting any help here

maiden thicket
#

sorry man xd

wanton fjord
maiden thicket
#

no problemo sir

wanton fjord
#

nop nothing

#

thanks tho

maiden thicket
#

damn 😔

granite stirrup
#

well its a IllegalArgumentError in NMS.java

#

so it might be AbstractFixture or AbstractLaser

#

or whatever

#

lol

#

but i dont know about IllegalArgumentError

#

so it might be something different

wanton fjord
#

im not doing anything special in those classes they are just abstract classes i highly doubt it's that

#

and pretty sure the traceback would lead to those classes if they were actually an issue

#

solved it, it was indeed the version of maven shade

#

using the latest dev snapshot of it works

proud basin
#

Is there a way to disable default join message so I can replace it with a custom one?

granite stirrup
#

Yes

#

There's a method named SetJoinMessage I think

#

For the player

covert bluff
#
wantedEnchant = Enchantment.getByKey(NamespacedKey.minecraft(splitKeys[0]));

Does anyone know the vanilla name for Sharpness? Cause just putting "sharpness" doesn't work for NamespacedKey.minecraft(), but protection worked

jagged monolith
shadow gazelle
#

Is this how you make a crafting recipe that takes up the whole table?

recipe.shape(" 1 ", " 2 ", " 1 ", " 2 ", " 3 ", " 2 ", " 1 ", " 4 ", " 2 " );
eternal oxide
#

no

shadow gazelle
#

I mean, what I see is recipe.shape( " E ", " E ", " S " );

#

That's for a sword recipe

ivory sleet
#

yup

wraith rapids
#

"123"
"456"
"789"

covert bluff
#

wtf

ivory sleet
#

It would be like
E

E

S

covert bluff
#

several people are typing

shadow gazelle
ivory sleet
#

wym

wraith rapids
#

each string is a line

#

it's a grid

shadow gazelle
#

Sorry, that made no sense

eternal oxide
#

crafting grid is 3x3

shadow gazelle
#

I know... ?

dense geyser
wraith rapids
#

"123"
"456"
"789"

"123","456","789"

shadow gazelle
#

Just confused as to why that sword recipe is sideways, I guess

wraith rapids
#

it's not sideways

random wedge
#

I'm getting different results when mapping some things using the specialsource-maven-plugin vs the SpecialSource jar file. With the maven plugin everything maps perfectly, but with the jar file some things end up not mapping correctly. Is there something the maven plugin does that the SpecialSource commands provided in the 1.17 news and announcements post don't?

shadow gazelle
#

It looks like it is

#

I've only made crafting recipes with datapacks before, they don't use it that way

wraith rapids
#

E
E
S

" E "," E "," S "

#

E
E
S

" E"," E ","S "

granite stirrup
shadow gazelle
#

Ohhh

random wedge
#

But it maps properly with the maven plugin

wraith rapids
#


EES

" ","EES"," "

granite stirrup
ebon siren
#
        <dependency>

            <groupId>org.spigotmc</groupId>

            <artifactId>spigot-api</artifactId>

            <version>1.16.5-R0.1-SNAPSHOT</version>

            <scope>provided</scope>

        </dependency>

anybody know why i'm getting the Dependency 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT' not found error on those lines? it's in the pom.xml btw

covert bluff
#

is this in intellij

ebon siren
#

yes

covert bluff
#

can you try doing File > Invalidate Caches

#

and wait a few min and see if error still coems up

ebon siren
#

which checkboxes do i tick

#

just the middle one?

granite stirrup
dusk flicker
#

I hate how you spaced that out lmao

ebon siren
dusk flicker
#

oh god

#

Can you send us your full pom in a paste please

#

?paste

undone axleBOT
ebon siren
#

ok

dusk flicker
#

?maven

undone axleBOT
ebon siren
dusk flicker
#

Did you click the maven refresh thingy in IntelliJ

#

I believe its in the top right

ebon siren
#

yea

#

still errors

dusk flicker
#

hmm

granite stirrup
#

Maybe it's cuz of spacing

worldly burrow
#

How can I run a function every time a player right clicks?

ebon siren
#

i'm gonna try invalidating caches like notprankster_ suggested

dusk flicker
#

Try it like this

granite stirrup
dusk flicker
#
<repositories>
    <!-- This adds the Spigot Maven repository to the build -->
    <repository>
        <id>spigot-repo</id>
        <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
    </repository>
</repositories>

<dependencies>
    <!--This adds the Spigot API artifact to the build -->
    <dependency>
           <groupId>org.spigotmc</groupId>
           <artifactId>spigot-api</artifactId>
           <version>1.16.5-R0.1-SNAPSHOT</version>
           <scope>provided</scope>
    </dependency>
</dependencies>
ebon siren
#

yea that fixed it lol

dusk flicker
#

ah nice

#

alright good

granite stirrup
#

Wait in discord beta it has colors

ebon siren
#

yup

#

it's not just beta

dusk flicker
#

for reference that above code I sent for the pom is the correct spacing

worldly burrow
ebon siren
#

there were colors for quite a while

dusk flicker
#

thats what you should be using

ebon siren
#

alright

#

thanks for the help

granite stirrup
ivory sleet
granite stirrup
ivory sleet
#

Big flex

sacred vector
#

                    if(!player.getWorld().hasStorm()){
                        player.getWorld().setStorm(true);
                    }
                    if(player.getWorld().hasStorm()){
                        player.getWorld().setStorm(false);
                    }
``` So i cant get it to stop the storm. when they right click the item it can start a storm if there is none but not get rid of it
granite stirrup
#

I'm on android

#

That's why I can download it

ivory sleet
granite stirrup
hardy swan
dusk flicker
#

weird flex but okay

worldly burrow
# granite stirrup player interact event
@EventHandler
public void onRightClick (PlayerInteractEvent event) {
    Player p = event.getPlayer();
    if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
        p.chat("test");
    }
}``` I have placed this in the main plugin class, however, it is not registering the event.
ivory sleet
#

oh u need to mail them to get beta or what

dusk flicker
#

nah you can just signup

sacred vector
#

like the storm does not clear, but it can start

worldly burrow
granite stirrup
#

It doesn't auto register

gloomy edge
#

Is PlayerInteractEvent RIGHT_CLICK_BLOCK supposed to be ran when you place down a block?

dusk flicker
#

its when you right click a block

gloomy edge
#

Well it runs either way

ivory sleet
dusk flicker
#

google play store

worldly burrow
#

Sorry, I just started using spigot today, but can you elaborate or point me to some documentation on registering an event

dusk flicker
#

?registerevent

#

oof Conclure add it

quaint mantle
#

no lemme do it

#

conclure I wanna 😟

ivory sleet
#

?cc add eventapi <https://www.spigotmc.org/wiki/using-the-event-api/>

dusk flicker
#

maybe dont name it registerevent

#

yeah much better

undone axleBOT
#

Custom command successfully added.

dusk flicker
#

hot

quaint mantle
#

?eventapi

undone axleBOT
ivory sleet
#

Just made sure to get something out of that time I wasted on typing that message

dusk flicker
#

lol

quaint mantle
#

slow typer be like eyes_sus

gloomy edge
#

This is being ran when I place down a block is that normal behavior?

quaint mantle
#

yes

covert bluff
#

yes

vagrant stratus
#

you are right clicking a block after all

gloomy edge
#

True

hardy swan
#

Cancel the playerinteractevent if you do not want blocks to be placed

worldly burrow
#

Also, is there any way I can disable the "Build is outdated warning", I do not like waiting 20 seconds to run my server lul

empty swallow
#

Action.RIGHT_CLICK_AIR

vagrant stratus
empty swallow
#

way they worded it, they wanted it 😉

gloomy edge
#

Is there a way I can like if(placeDownBlock) then return cause I only want right click block

vagrant stratus
#

Not really

covert bluff
quaint mantle
#
@EventHandler
public void onInteract(PlayerInteractEvent event) {
    if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
        ItemStack item = event.getItem();
        
        if (item == null) return;

        if (item.getType().isBlock()) {
            // code
        }
    }
}
covert bluff
#

or i think it's possible to cast the evnet into a placeblock event

#

and then cancel that

quaint mantle
#

dont just take that code and use it, make sure you understand it

covert bluff
#

does anyone know vanilla name for sharpness

hardy swan
covert bluff
#

im trying to do NamespacedKey.minecraft("sharpness") and it is not working

hardy swan
#

Is that they dun cancel itemuse

covert bluff
#

what do i do to get encahntment by string then